diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-10-28 11:26:12 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-28 11:26:12 -0400 |
commit | 7a9787e1eba95a166265e6a260cf30af04ef0a99 (patch) | |
tree | e730a4565e0318140d2fbd2f0415d18a339d7336 /Documentation | |
parent | 41b9eb264c8407655db57b60b4457fe1b2ec9977 (diff) | |
parent | 0173a3265b228da319ceb9c1ec6a5682fd1b2d92 (diff) |
Merge commit 'v2.6.28-rc2' into x86/pci-ioapic-boot-irq-quirks
Diffstat (limited to 'Documentation')
303 files changed, 15554 insertions, 5624 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX index 1977fab38656..7286ad090db7 100644 --- a/Documentation/00-INDEX +++ b/Documentation/00-INDEX | |||
@@ -21,6 +21,9 @@ Changes | |||
21 | - list of changes that break older software packages. | 21 | - list of changes that break older software packages. |
22 | CodingStyle | 22 | CodingStyle |
23 | - how the boss likes the C code in the kernel to look. | 23 | - how the boss likes the C code in the kernel to look. |
24 | development-process/ | ||
25 | - An extended tutorial on how to work with the kernel development | ||
26 | process. | ||
24 | DMA-API.txt | 27 | DMA-API.txt |
25 | - DMA API, pci_ API & extensions for non-consistent memory machines. | 28 | - DMA API, pci_ API & extensions for non-consistent memory machines. |
26 | DMA-ISA-LPC.txt | 29 | DMA-ISA-LPC.txt |
@@ -89,8 +92,6 @@ cciss.txt | |||
89 | - info, major/minor #'s for Compaq's SMART Array Controllers. | 92 | - info, major/minor #'s for Compaq's SMART Array Controllers. |
90 | cdrom/ | 93 | cdrom/ |
91 | - directory with information on the CD-ROM drivers that Linux has. | 94 | - directory with information on the CD-ROM drivers that Linux has. |
92 | cli-sti-removal.txt | ||
93 | - cli()/sti() removal guide. | ||
94 | computone.txt | 95 | computone.txt |
95 | - info on Computone Intelliport II/Plus Multiport Serial Driver. | 96 | - info on Computone Intelliport II/Plus Multiport Serial Driver. |
96 | connector/ | 97 | connector/ |
@@ -161,8 +162,6 @@ hayes-esp.txt | |||
161 | - info on using the Hayes ESP serial driver. | 162 | - info on using the Hayes ESP serial driver. |
162 | highuid.txt | 163 | highuid.txt |
163 | - notes on the change from 16 bit to 32 bit user/group IDs. | 164 | - notes on the change from 16 bit to 32 bit user/group IDs. |
164 | hpet.txt | ||
165 | - High Precision Event Timer Driver for Linux. | ||
166 | timers/ | 165 | timers/ |
167 | - info on the timer related topics | 166 | - info on the timer related topics |
168 | hw_random.txt | 167 | hw_random.txt |
@@ -253,8 +252,6 @@ mono.txt | |||
253 | - how to execute Mono-based .NET binaries with the help of BINFMT_MISC. | 252 | - how to execute Mono-based .NET binaries with the help of BINFMT_MISC. |
254 | moxa-smartio | 253 | moxa-smartio |
255 | - file with info on installing/using Moxa multiport serial driver. | 254 | - file with info on installing/using Moxa multiport serial driver. |
256 | mtrr.txt | ||
257 | - how to use PPro Memory Type Range Registers to increase performance. | ||
258 | mutex-design.txt | 255 | mutex-design.txt |
259 | - info on the generic mutex subsystem. | 256 | - info on the generic mutex subsystem. |
260 | namespaces/ | 257 | namespaces/ |
@@ -361,8 +358,6 @@ telephony/ | |||
361 | - directory with info on telephony (e.g. voice over IP) support. | 358 | - directory with info on telephony (e.g. voice over IP) support. |
362 | time_interpolators.txt | 359 | time_interpolators.txt |
363 | - info on time interpolators. | 360 | - info on time interpolators. |
364 | tipar.txt | ||
365 | - information about Parallel link cable for Texas Instruments handhelds. | ||
366 | tty.txt | 361 | tty.txt |
367 | - guide to the locking policies of the tty layer. | 362 | - guide to the locking policies of the tty layer. |
368 | uml/ | 363 | uml/ |
diff --git a/Documentation/ABI/stable/sysfs-driver-usb-usbtmc b/Documentation/ABI/stable/sysfs-driver-usb-usbtmc new file mode 100644 index 000000000000..9a75fb22187d --- /dev/null +++ b/Documentation/ABI/stable/sysfs-driver-usb-usbtmc | |||
@@ -0,0 +1,62 @@ | |||
1 | What: /sys/bus/usb/drivers/usbtmc/devices/*/interface_capabilities | ||
2 | What: /sys/bus/usb/drivers/usbtmc/devices/*/device_capabilities | ||
3 | Date: August 2008 | ||
4 | Contact: Greg Kroah-Hartman <gregkh@suse.de> | ||
5 | Description: | ||
6 | These files show the various USB TMC capabilities as described | ||
7 | by the device itself. The full description of the bitfields | ||
8 | can be found in the USB TMC documents from the USB-IF entitled | ||
9 | "Universal Serial Bus Test and Measurement Class Specification | ||
10 | (USBTMC) Revision 1.0" section 4.2.1.8. | ||
11 | |||
12 | The files are read only. | ||
13 | |||
14 | |||
15 | What: /sys/bus/usb/drivers/usbtmc/devices/*/usb488_interface_capabilities | ||
16 | What: /sys/bus/usb/drivers/usbtmc/devices/*/usb488_device_capabilities | ||
17 | Date: August 2008 | ||
18 | Contact: Greg Kroah-Hartman <gregkh@suse.de> | ||
19 | Description: | ||
20 | These files show the various USB TMC capabilities as described | ||
21 | by the device itself. The full description of the bitfields | ||
22 | can be found in the USB TMC documents from the USB-IF entitled | ||
23 | "Universal Serial Bus Test and Measurement Class, Subclass | ||
24 | USB488 Specification (USBTMC-USB488) Revision 1.0" section | ||
25 | 4.2.2. | ||
26 | |||
27 | The files are read only. | ||
28 | |||
29 | |||
30 | What: /sys/bus/usb/drivers/usbtmc/devices/*/TermChar | ||
31 | Date: August 2008 | ||
32 | Contact: Greg Kroah-Hartman <gregkh@suse.de> | ||
33 | Description: | ||
34 | This file is the TermChar value to be sent to the USB TMC | ||
35 | device as described by the document, "Universal Serial Bus Test | ||
36 | and Measurement Class Specification | ||
37 | (USBTMC) Revision 1.0" as published by the USB-IF. | ||
38 | |||
39 | Note that the TermCharEnabled file determines if this value is | ||
40 | sent to the device or not. | ||
41 | |||
42 | |||
43 | What: /sys/bus/usb/drivers/usbtmc/devices/*/TermCharEnabled | ||
44 | Date: August 2008 | ||
45 | Contact: Greg Kroah-Hartman <gregkh@suse.de> | ||
46 | Description: | ||
47 | This file determines if the TermChar is to be sent to the | ||
48 | device on every transaction or not. For more details about | ||
49 | this, please see the document, "Universal Serial Bus Test and | ||
50 | Measurement Class Specification (USBTMC) Revision 1.0" as | ||
51 | published by the USB-IF. | ||
52 | |||
53 | |||
54 | What: /sys/bus/usb/drivers/usbtmc/devices/*/auto_abort | ||
55 | Date: August 2008 | ||
56 | Contact: Greg Kroah-Hartman <gregkh@suse.de> | ||
57 | Description: | ||
58 | This file determines if the the transaction of the USB TMC | ||
59 | device is to be automatically aborted if there is any error. | ||
60 | For more details about this, please see the document, | ||
61 | "Universal Serial Bus Test and Measurement Class Specification | ||
62 | (USBTMC) Revision 1.0" as published by the USB-IF. | ||
diff --git a/Documentation/ABI/testing/sysfs-bus-umc b/Documentation/ABI/testing/sysfs-bus-umc new file mode 100644 index 000000000000..948fec412446 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-umc | |||
@@ -0,0 +1,28 @@ | |||
1 | What: /sys/bus/umc/ | ||
2 | Date: July 2008 | ||
3 | KernelVersion: 2.6.27 | ||
4 | Contact: David Vrabel <david.vrabel@csr.com> | ||
5 | Description: | ||
6 | The Wireless Host Controller Interface (WHCI) | ||
7 | specification describes a PCI-based device with | ||
8 | multiple capabilities; the UWB Multi-interface | ||
9 | Controller (UMC). | ||
10 | |||
11 | The umc bus presents each of the individual | ||
12 | capabilties as a device. | ||
13 | |||
14 | What: /sys/bus/umc/devices/.../capability_id | ||
15 | Date: July 2008 | ||
16 | KernelVersion: 2.6.27 | ||
17 | Contact: David Vrabel <david.vrabel@csr.com> | ||
18 | Description: | ||
19 | The ID of this capability, with 0 being the radio | ||
20 | controller capability. | ||
21 | |||
22 | What: /sys/bus/umc/devices/.../version | ||
23 | Date: July 2008 | ||
24 | KernelVersion: 2.6.27 | ||
25 | Contact: David Vrabel <david.vrabel@csr.com> | ||
26 | Description: | ||
27 | The specification version this capability's hardware | ||
28 | interface complies with. | ||
diff --git a/Documentation/ABI/testing/sysfs-bus-usb b/Documentation/ABI/testing/sysfs-bus-usb index 11a3c1682cec..7772928ee48f 100644 --- a/Documentation/ABI/testing/sysfs-bus-usb +++ b/Documentation/ABI/testing/sysfs-bus-usb | |||
@@ -85,3 +85,62 @@ Description: | |||
85 | Users: | 85 | Users: |
86 | PowerTOP <power@bughost.org> | 86 | PowerTOP <power@bughost.org> |
87 | http://www.lesswatts.org/projects/powertop/ | 87 | http://www.lesswatts.org/projects/powertop/ |
88 | |||
89 | What: /sys/bus/usb/device/<busnum>-<devnum>...:<config num>-<interface num>/supports_autosuspend | ||
90 | Date: January 2008 | ||
91 | KernelVersion: 2.6.27 | ||
92 | Contact: Sarah Sharp <sarah.a.sharp@intel.com> | ||
93 | Description: | ||
94 | When read, this file returns 1 if the interface driver | ||
95 | for this interface supports autosuspend. It also | ||
96 | returns 1 if no driver has claimed this interface, as an | ||
97 | unclaimed interface will not stop the device from being | ||
98 | autosuspended if all other interface drivers are idle. | ||
99 | The file returns 0 if autosuspend support has not been | ||
100 | added to the driver. | ||
101 | Users: | ||
102 | USB PM tool | ||
103 | git://git.moblin.org/users/sarah/usb-pm-tool/ | ||
104 | |||
105 | What: /sys/bus/usb/device/.../authorized | ||
106 | Date: July 2008 | ||
107 | KernelVersion: 2.6.26 | ||
108 | Contact: David Vrabel <david.vrabel@csr.com> | ||
109 | Description: | ||
110 | Authorized devices are available for use by device | ||
111 | drivers, non-authorized one are not. By default, wired | ||
112 | USB devices are authorized. | ||
113 | |||
114 | Certified Wireless USB devices are not authorized | ||
115 | initially and should be (by writing 1) after the | ||
116 | device has been authenticated. | ||
117 | |||
118 | What: /sys/bus/usb/device/.../wusb_cdid | ||
119 | Date: July 2008 | ||
120 | KernelVersion: 2.6.27 | ||
121 | Contact: David Vrabel <david.vrabel@csr.com> | ||
122 | Description: | ||
123 | For Certified Wireless USB devices only. | ||
124 | |||
125 | A devices's CDID, as 16 space-separated hex octets. | ||
126 | |||
127 | What: /sys/bus/usb/device/.../wusb_ck | ||
128 | Date: July 2008 | ||
129 | KernelVersion: 2.6.27 | ||
130 | Contact: David Vrabel <david.vrabel@csr.com> | ||
131 | Description: | ||
132 | For Certified Wireless USB devices only. | ||
133 | |||
134 | Write the device's connection key (CK) to start the | ||
135 | authentication of the device. The CK is 16 | ||
136 | space-separated hex octets. | ||
137 | |||
138 | What: /sys/bus/usb/device/.../wusb_disconnect | ||
139 | Date: July 2008 | ||
140 | KernelVersion: 2.6.27 | ||
141 | Contact: David Vrabel <david.vrabel@csr.com> | ||
142 | Description: | ||
143 | For Certified Wireless USB devices only. | ||
144 | |||
145 | Write a 1 to force the device to disconnect | ||
146 | (equivalent to unplugging a wired USB device). | ||
diff --git a/Documentation/ABI/testing/sysfs-bus-usb-devices-usbsevseg b/Documentation/ABI/testing/sysfs-bus-usb-devices-usbsevseg new file mode 100644 index 000000000000..cb830df8777c --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-usb-devices-usbsevseg | |||
@@ -0,0 +1,43 @@ | |||
1 | Where: /sys/bus/usb/.../powered | ||
2 | Date: August 2008 | ||
3 | Kernel Version: 2.6.26 | ||
4 | Contact: Harrison Metzger <harrisonmetz@gmail.com> | ||
5 | Description: Controls whether the device's display will powered. | ||
6 | A value of 0 is off and a non-zero value is on. | ||
7 | |||
8 | Where: /sys/bus/usb/.../mode_msb | ||
9 | Where: /sys/bus/usb/.../mode_lsb | ||
10 | Date: August 2008 | ||
11 | Kernel Version: 2.6.26 | ||
12 | Contact: Harrison Metzger <harrisonmetz@gmail.com> | ||
13 | Description: Controls the devices display mode. | ||
14 | For a 6 character display the values are | ||
15 | MSB 0x06; LSB 0x3F, and | ||
16 | for an 8 character display the values are | ||
17 | MSB 0x08; LSB 0xFF. | ||
18 | |||
19 | Where: /sys/bus/usb/.../textmode | ||
20 | Date: August 2008 | ||
21 | Kernel Version: 2.6.26 | ||
22 | Contact: Harrison Metzger <harrisonmetz@gmail.com> | ||
23 | Description: Controls the way the device interprets its text buffer. | ||
24 | raw: each character controls its segment manually | ||
25 | hex: each character is between 0-15 | ||
26 | ascii: each character is between '0'-'9' and 'A'-'F'. | ||
27 | |||
28 | Where: /sys/bus/usb/.../text | ||
29 | Date: August 2008 | ||
30 | Kernel Version: 2.6.26 | ||
31 | Contact: Harrison Metzger <harrisonmetz@gmail.com> | ||
32 | Description: The text (or data) for the device to display | ||
33 | |||
34 | Where: /sys/bus/usb/.../decimals | ||
35 | Date: August 2008 | ||
36 | Kernel Version: 2.6.26 | ||
37 | Contact: Harrison Metzger <harrisonmetz@gmail.com> | ||
38 | Description: Controls the decimal places on the device. | ||
39 | To set the nth decimal place, give this field | ||
40 | the value of 10 ** n. Assume this field has | ||
41 | the value k and has 1 or more decimal places set, | ||
42 | to set the mth place (where m is not already set), | ||
43 | change this fields value to k + 10 ** m. \ No newline at end of file | ||
diff --git a/Documentation/ABI/testing/sysfs-class-regulator b/Documentation/ABI/testing/sysfs-class-regulator new file mode 100644 index 000000000000..3731f6f29bcb --- /dev/null +++ b/Documentation/ABI/testing/sysfs-class-regulator | |||
@@ -0,0 +1,328 @@ | |||
1 | What: /sys/class/regulator/.../state | ||
2 | Date: April 2008 | ||
3 | KernelVersion: 2.6.26 | ||
4 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
5 | Description: | ||
6 | Each regulator directory will contain a field called | ||
7 | state. This holds the regulator output state. | ||
8 | |||
9 | This will be one of the following strings: | ||
10 | |||
11 | 'enabled' | ||
12 | 'disabled' | ||
13 | 'unknown' | ||
14 | |||
15 | 'enabled' means the regulator output is ON and is supplying | ||
16 | power to the system. | ||
17 | |||
18 | 'disabled' means the regulator output is OFF and is not | ||
19 | supplying power to the system.. | ||
20 | |||
21 | 'unknown' means software cannot determine the state. | ||
22 | |||
23 | NOTE: this field can be used in conjunction with microvolts | ||
24 | and microamps to determine regulator output levels. | ||
25 | |||
26 | |||
27 | What: /sys/class/regulator/.../type | ||
28 | Date: April 2008 | ||
29 | KernelVersion: 2.6.26 | ||
30 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
31 | Description: | ||
32 | Each regulator directory will contain a field called | ||
33 | type. This holds the regulator type. | ||
34 | |||
35 | This will be one of the following strings: | ||
36 | |||
37 | 'voltage' | ||
38 | 'current' | ||
39 | 'unknown' | ||
40 | |||
41 | 'voltage' means the regulator output voltage can be controlled | ||
42 | by software. | ||
43 | |||
44 | 'current' means the regulator output current limit can be | ||
45 | controlled by software. | ||
46 | |||
47 | 'unknown' means software cannot control either voltage or | ||
48 | current limit. | ||
49 | |||
50 | |||
51 | What: /sys/class/regulator/.../microvolts | ||
52 | Date: April 2008 | ||
53 | KernelVersion: 2.6.26 | ||
54 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
55 | Description: | ||
56 | Each regulator directory will contain a field called | ||
57 | microvolts. This holds the regulator output voltage setting | ||
58 | measured in microvolts (i.e. E-6 Volts). | ||
59 | |||
60 | NOTE: This value should not be used to determine the regulator | ||
61 | output voltage level as this value is the same regardless of | ||
62 | whether the regulator is enabled or disabled. | ||
63 | |||
64 | |||
65 | What: /sys/class/regulator/.../microamps | ||
66 | Date: April 2008 | ||
67 | KernelVersion: 2.6.26 | ||
68 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
69 | Description: | ||
70 | Each regulator directory will contain a field called | ||
71 | microamps. This holds the regulator output current limit | ||
72 | setting measured in microamps (i.e. E-6 Amps). | ||
73 | |||
74 | NOTE: This value should not be used to determine the regulator | ||
75 | output current level as this value is the same regardless of | ||
76 | whether the regulator is enabled or disabled. | ||
77 | |||
78 | |||
79 | What: /sys/class/regulator/.../opmode | ||
80 | Date: April 2008 | ||
81 | KernelVersion: 2.6.26 | ||
82 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
83 | Description: | ||
84 | Each regulator directory will contain a field called | ||
85 | opmode. This holds the regulator operating mode setting. | ||
86 | |||
87 | The opmode value can be one of the following strings: | ||
88 | |||
89 | 'fast' | ||
90 | 'normal' | ||
91 | 'idle' | ||
92 | 'standby' | ||
93 | 'unknown' | ||
94 | |||
95 | The modes are described in include/linux/regulator/regulator.h | ||
96 | |||
97 | NOTE: This value should not be used to determine the regulator | ||
98 | output operating mode as this value is the same regardless of | ||
99 | whether the regulator is enabled or disabled. | ||
100 | |||
101 | |||
102 | What: /sys/class/regulator/.../min_microvolts | ||
103 | Date: April 2008 | ||
104 | KernelVersion: 2.6.26 | ||
105 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
106 | Description: | ||
107 | Each regulator directory will contain a field called | ||
108 | min_microvolts. This holds the minimum safe working regulator | ||
109 | output voltage setting for this domain measured in microvolts. | ||
110 | |||
111 | NOTE: this will return the string 'constraint not defined' if | ||
112 | the power domain has no min microvolts constraint defined by | ||
113 | platform code. | ||
114 | |||
115 | |||
116 | What: /sys/class/regulator/.../max_microvolts | ||
117 | Date: April 2008 | ||
118 | KernelVersion: 2.6.26 | ||
119 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
120 | Description: | ||
121 | Each regulator directory will contain a field called | ||
122 | max_microvolts. This holds the maximum safe working regulator | ||
123 | output voltage setting for this domain measured in microvolts. | ||
124 | |||
125 | NOTE: this will return the string 'constraint not defined' if | ||
126 | the power domain has no max microvolts constraint defined by | ||
127 | platform code. | ||
128 | |||
129 | |||
130 | What: /sys/class/regulator/.../min_microamps | ||
131 | Date: April 2008 | ||
132 | KernelVersion: 2.6.26 | ||
133 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
134 | Description: | ||
135 | Each regulator directory will contain a field called | ||
136 | min_microamps. This holds the minimum safe working regulator | ||
137 | output current limit setting for this domain measured in | ||
138 | microamps. | ||
139 | |||
140 | NOTE: this will return the string 'constraint not defined' if | ||
141 | the power domain has no min microamps constraint defined by | ||
142 | platform code. | ||
143 | |||
144 | |||
145 | What: /sys/class/regulator/.../max_microamps | ||
146 | Date: April 2008 | ||
147 | KernelVersion: 2.6.26 | ||
148 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
149 | Description: | ||
150 | Each regulator directory will contain a field called | ||
151 | max_microamps. This holds the maximum safe working regulator | ||
152 | output current limit setting for this domain measured in | ||
153 | microamps. | ||
154 | |||
155 | NOTE: this will return the string 'constraint not defined' if | ||
156 | the power domain has no max microamps constraint defined by | ||
157 | platform code. | ||
158 | |||
159 | |||
160 | What: /sys/class/regulator/.../name | ||
161 | Date: October 2008 | ||
162 | KernelVersion: 2.6.28 | ||
163 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
164 | Description: | ||
165 | Each regulator directory will contain a field called | ||
166 | name. This holds a string identifying the regulator for | ||
167 | display purposes. | ||
168 | |||
169 | NOTE: this will be empty if no suitable name is provided | ||
170 | by platform or regulator drivers. | ||
171 | |||
172 | |||
173 | What: /sys/class/regulator/.../num_users | ||
174 | Date: April 2008 | ||
175 | KernelVersion: 2.6.26 | ||
176 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
177 | Description: | ||
178 | Each regulator directory will contain a field called | ||
179 | num_users. This holds the number of consumer devices that | ||
180 | have called regulator_enable() on this regulator. | ||
181 | |||
182 | |||
183 | What: /sys/class/regulator/.../requested_microamps | ||
184 | Date: April 2008 | ||
185 | KernelVersion: 2.6.26 | ||
186 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
187 | Description: | ||
188 | Each regulator directory will contain a field called | ||
189 | requested_microamps. This holds the total requested load | ||
190 | current in microamps for this regulator from all its consumer | ||
191 | devices. | ||
192 | |||
193 | |||
194 | What: /sys/class/regulator/.../parent | ||
195 | Date: April 2008 | ||
196 | KernelVersion: 2.6.26 | ||
197 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
198 | Description: | ||
199 | Some regulator directories will contain a link called parent. | ||
200 | This points to the parent or supply regulator if one exists. | ||
201 | |||
202 | What: /sys/class/regulator/.../suspend_mem_microvolts | ||
203 | Date: May 2008 | ||
204 | KernelVersion: 2.6.26 | ||
205 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
206 | Description: | ||
207 | Each regulator directory will contain a field called | ||
208 | suspend_mem_microvolts. This holds the regulator output | ||
209 | voltage setting for this domain measured in microvolts when | ||
210 | the system is suspended to memory. | ||
211 | |||
212 | NOTE: this will return the string 'not defined' if | ||
213 | the power domain has no suspend to memory voltage defined by | ||
214 | platform code. | ||
215 | |||
216 | What: /sys/class/regulator/.../suspend_disk_microvolts | ||
217 | Date: May 2008 | ||
218 | KernelVersion: 2.6.26 | ||
219 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
220 | Description: | ||
221 | Each regulator directory will contain a field called | ||
222 | suspend_disk_microvolts. This holds the regulator output | ||
223 | voltage setting for this domain measured in microvolts when | ||
224 | the system is suspended to disk. | ||
225 | |||
226 | NOTE: this will return the string 'not defined' if | ||
227 | the power domain has no suspend to disk voltage defined by | ||
228 | platform code. | ||
229 | |||
230 | What: /sys/class/regulator/.../suspend_standby_microvolts | ||
231 | Date: May 2008 | ||
232 | KernelVersion: 2.6.26 | ||
233 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
234 | Description: | ||
235 | Each regulator directory will contain a field called | ||
236 | suspend_standby_microvolts. This holds the regulator output | ||
237 | voltage setting for this domain measured in microvolts when | ||
238 | the system is suspended to standby. | ||
239 | |||
240 | NOTE: this will return the string 'not defined' if | ||
241 | the power domain has no suspend to standby voltage defined by | ||
242 | platform code. | ||
243 | |||
244 | What: /sys/class/regulator/.../suspend_mem_mode | ||
245 | Date: May 2008 | ||
246 | KernelVersion: 2.6.26 | ||
247 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
248 | Description: | ||
249 | Each regulator directory will contain a field called | ||
250 | suspend_mem_mode. This holds the regulator operating mode | ||
251 | setting for this domain when the system is suspended to | ||
252 | memory. | ||
253 | |||
254 | NOTE: this will return the string 'not defined' if | ||
255 | the power domain has no suspend to memory mode defined by | ||
256 | platform code. | ||
257 | |||
258 | What: /sys/class/regulator/.../suspend_disk_mode | ||
259 | Date: May 2008 | ||
260 | KernelVersion: 2.6.26 | ||
261 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
262 | Description: | ||
263 | Each regulator directory will contain a field called | ||
264 | suspend_disk_mode. This holds the regulator operating mode | ||
265 | setting for this domain when the system is suspended to disk. | ||
266 | |||
267 | NOTE: this will return the string 'not defined' if | ||
268 | the power domain has no suspend to disk mode defined by | ||
269 | platform code. | ||
270 | |||
271 | What: /sys/class/regulator/.../suspend_standby_mode | ||
272 | Date: May 2008 | ||
273 | KernelVersion: 2.6.26 | ||
274 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
275 | Description: | ||
276 | Each regulator directory will contain a field called | ||
277 | suspend_standby_mode. This holds the regulator operating mode | ||
278 | setting for this domain when the system is suspended to | ||
279 | standby. | ||
280 | |||
281 | NOTE: this will return the string 'not defined' if | ||
282 | the power domain has no suspend to standby mode defined by | ||
283 | platform code. | ||
284 | |||
285 | What: /sys/class/regulator/.../suspend_mem_state | ||
286 | Date: May 2008 | ||
287 | KernelVersion: 2.6.26 | ||
288 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
289 | Description: | ||
290 | Each regulator directory will contain a field called | ||
291 | suspend_mem_state. This holds the regulator operating state | ||
292 | when suspended to memory. | ||
293 | |||
294 | This will be one of the following strings: | ||
295 | |||
296 | 'enabled' | ||
297 | 'disabled' | ||
298 | 'not defined' | ||
299 | |||
300 | What: /sys/class/regulator/.../suspend_disk_state | ||
301 | Date: May 2008 | ||
302 | KernelVersion: 2.6.26 | ||
303 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
304 | Description: | ||
305 | Each regulator directory will contain a field called | ||
306 | suspend_disk_state. This holds the regulator operating state | ||
307 | when suspended to disk. | ||
308 | |||
309 | This will be one of the following strings: | ||
310 | |||
311 | 'enabled' | ||
312 | 'disabled' | ||
313 | 'not defined' | ||
314 | |||
315 | What: /sys/class/regulator/.../suspend_standby_state | ||
316 | Date: May 2008 | ||
317 | KernelVersion: 2.6.26 | ||
318 | Contact: Liam Girdwood <lrg@slimlogic.co.uk> | ||
319 | Description: | ||
320 | Each regulator directory will contain a field called | ||
321 | suspend_standby_state. This holds the regulator operating | ||
322 | state when suspended to standby. | ||
323 | |||
324 | This will be one of the following strings: | ||
325 | |||
326 | 'enabled' | ||
327 | 'disabled' | ||
328 | 'not defined' | ||
diff --git a/Documentation/ABI/testing/sysfs-class-usb_host b/Documentation/ABI/testing/sysfs-class-usb_host new file mode 100644 index 000000000000..46b66ad1f1b4 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-class-usb_host | |||
@@ -0,0 +1,25 @@ | |||
1 | What: /sys/class/usb_host/usb_hostN/wusb_chid | ||
2 | Date: July 2008 | ||
3 | KernelVersion: 2.6.27 | ||
4 | Contact: David Vrabel <david.vrabel@csr.com> | ||
5 | Description: | ||
6 | Write the CHID (16 space-separated hex octets) for this host controller. | ||
7 | This starts the host controller, allowing it to accept connection from | ||
8 | WUSB devices. | ||
9 | |||
10 | Set an all zero CHID to stop the host controller. | ||
11 | |||
12 | What: /sys/class/usb_host/usb_hostN/wusb_trust_timeout | ||
13 | Date: July 2008 | ||
14 | KernelVersion: 2.6.27 | ||
15 | Contact: David Vrabel <david.vrabel@csr.com> | ||
16 | Description: | ||
17 | Devices that haven't sent a WUSB packet to the host | ||
18 | within 'wusb_trust_timeout' ms are considered to have | ||
19 | disconnected and are removed. The default value of | ||
20 | 4000 ms is the value required by the WUSB | ||
21 | specification. | ||
22 | |||
23 | Since this relates to security (specifically, the | ||
24 | lifetime of PTKs and GTKs) it should not be changed | ||
25 | from the default. | ||
diff --git a/Documentation/ABI/testing/sysfs-class-uwb_rc b/Documentation/ABI/testing/sysfs-class-uwb_rc new file mode 100644 index 000000000000..a0d18dbeb7a9 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-class-uwb_rc | |||
@@ -0,0 +1,144 @@ | |||
1 | What: /sys/class/uwb_rc | ||
2 | Date: July 2008 | ||
3 | KernelVersion: 2.6.27 | ||
4 | Contact: linux-usb@vger.kernel.org | ||
5 | Description: | ||
6 | Interfaces for WiMedia Ultra Wideband Common Radio | ||
7 | Platform (UWB) radio controllers. | ||
8 | |||
9 | Familiarity with the ECMA-368 'High Rate Ultra | ||
10 | Wideband MAC and PHY Specification' is assumed. | ||
11 | |||
12 | What: /sys/class/uwb_rc/beacon_timeout_ms | ||
13 | Date: July 2008 | ||
14 | KernelVersion: 2.6.27 | ||
15 | Description: | ||
16 | If no beacons are received from a device for at least | ||
17 | this time, the device will be considered to have gone | ||
18 | and it will be removed. The default is 3 superframes | ||
19 | (~197 ms) as required by the specification. | ||
20 | |||
21 | What: /sys/class/uwb_rc/uwbN/ | ||
22 | Date: July 2008 | ||
23 | KernelVersion: 2.6.27 | ||
24 | Contact: linux-usb@vger.kernel.org | ||
25 | Description: | ||
26 | An individual UWB radio controller. | ||
27 | |||
28 | What: /sys/class/uwb_rc/uwbN/beacon | ||
29 | Date: July 2008 | ||
30 | KernelVersion: 2.6.27 | ||
31 | Contact: linux-usb@vger.kernel.org | ||
32 | Description: | ||
33 | Write: | ||
34 | |||
35 | <channel> [<bpst offset>] | ||
36 | |||
37 | to start beaconing on a specific channel, or stop | ||
38 | beaconing if <channel> is -1. Valid channels depends | ||
39 | on the radio controller's supported band groups. | ||
40 | |||
41 | <bpst offset> may be used to try and join a specific | ||
42 | beacon group if more than one was found during a scan. | ||
43 | |||
44 | What: /sys/class/uwb_rc/uwbN/scan | ||
45 | Date: July 2008 | ||
46 | KernelVersion: 2.6.27 | ||
47 | Contact: linux-usb@vger.kernel.org | ||
48 | Description: | ||
49 | Write: | ||
50 | |||
51 | <channel> <type> [<bpst offset>] | ||
52 | |||
53 | to start (or stop) scanning on a channel. <type> is one of: | ||
54 | 0 - scan | ||
55 | 1 - scan outside BP | ||
56 | 2 - scan while inactive | ||
57 | 3 - scanning disabled | ||
58 | 4 - scan (with start time of <bpst offset>) | ||
59 | |||
60 | What: /sys/class/uwb_rc/uwbN/mac_address | ||
61 | Date: July 2008 | ||
62 | KernelVersion: 2.6.27 | ||
63 | Contact: linux-usb@vger.kernel.org | ||
64 | Description: | ||
65 | The EUI-48, in colon-separated hex octets, for this | ||
66 | radio controller. A write will change the radio | ||
67 | controller's EUI-48 but only do so while the device is | ||
68 | not beaconing or scanning. | ||
69 | |||
70 | What: /sys/class/uwb_rc/uwbN/wusbhc | ||
71 | Date: July 2008 | ||
72 | KernelVersion: 2.6.27 | ||
73 | Contact: linux-usb@vger.kernel.org | ||
74 | Description: | ||
75 | A symlink to the device (if any) of the WUSB Host | ||
76 | Controller PAL using this radio controller. | ||
77 | |||
78 | What: /sys/class/uwb_rc/uwbN/<EUI-48>/ | ||
79 | Date: July 2008 | ||
80 | KernelVersion: 2.6.27 | ||
81 | Contact: linux-usb@vger.kernel.org | ||
82 | Description: | ||
83 | A neighbour UWB device that has either been detected | ||
84 | as part of a scan or is a member of the radio | ||
85 | controllers beacon group. | ||
86 | |||
87 | What: /sys/class/uwb_rc/uwbN/<EUI-48>/BPST | ||
88 | Date: July 2008 | ||
89 | KernelVersion: 2.6.27 | ||
90 | Contact: linux-usb@vger.kernel.org | ||
91 | Description: | ||
92 | The time (using the radio controllers internal 1 ms | ||
93 | interval superframe timer) of the last beacon from | ||
94 | this device was received. | ||
95 | |||
96 | What: /sys/class/uwb_rc/uwbN/<EUI-48>/DevAddr | ||
97 | Date: July 2008 | ||
98 | KernelVersion: 2.6.27 | ||
99 | Contact: linux-usb@vger.kernel.org | ||
100 | Description: | ||
101 | The current DevAddr of this device in colon separated | ||
102 | hex octets. | ||
103 | |||
104 | What: /sys/class/uwb_rc/uwbN/<EUI-48>/EUI_48 | ||
105 | Date: July 2008 | ||
106 | KernelVersion: 2.6.27 | ||
107 | Contact: linux-usb@vger.kernel.org | ||
108 | Description: | ||
109 | |||
110 | The EUI-48 of this device in colon separated hex | ||
111 | octets. | ||
112 | |||
113 | What: /sys/class/uwb_rc/uwbN/<EUI-48>/BPST | ||
114 | Date: July 2008 | ||
115 | KernelVersion: 2.6.27 | ||
116 | Contact: linux-usb@vger.kernel.org | ||
117 | Description: | ||
118 | |||
119 | What: /sys/class/uwb_rc/uwbN/<EUI-48>/IEs | ||
120 | Date: July 2008 | ||
121 | KernelVersion: 2.6.27 | ||
122 | Contact: linux-usb@vger.kernel.org | ||
123 | Description: | ||
124 | The latest IEs included in this device's beacon, in | ||
125 | space separated hex octets with one IE per line. | ||
126 | |||
127 | What: /sys/class/uwb_rc/uwbN/<EUI-48>/LQE | ||
128 | Date: July 2008 | ||
129 | KernelVersion: 2.6.27 | ||
130 | Contact: linux-usb@vger.kernel.org | ||
131 | Description: | ||
132 | Link Quality Estimate - the Signal to Noise Ratio | ||
133 | (SNR) of all packets received from this device in dB. | ||
134 | This gives an estimate on a suitable PHY rate. Refer | ||
135 | to [ECMA-368] section 13.3 for more details. | ||
136 | |||
137 | What: /sys/class/uwb_rc/uwbN/<EUI-48>/RSSI | ||
138 | Date: July 2008 | ||
139 | KernelVersion: 2.6.27 | ||
140 | Contact: linux-usb@vger.kernel.org | ||
141 | Description: | ||
142 | Received Signal Strength Indication - the strength of | ||
143 | the received signal in dB. LQE is a more useful | ||
144 | measure of the radio link quality. | ||
diff --git a/Documentation/ABI/testing/sysfs-dev b/Documentation/ABI/testing/sysfs-dev new file mode 100644 index 000000000000..a9f2b8b0530f --- /dev/null +++ b/Documentation/ABI/testing/sysfs-dev | |||
@@ -0,0 +1,20 @@ | |||
1 | What: /sys/dev | ||
2 | Date: April 2008 | ||
3 | KernelVersion: 2.6.26 | ||
4 | Contact: Dan Williams <dan.j.williams@intel.com> | ||
5 | Description: The /sys/dev tree provides a method to look up the sysfs | ||
6 | path for a device using the information returned from | ||
7 | stat(2). There are two directories, 'block' and 'char', | ||
8 | beneath /sys/dev containing symbolic links with names of | ||
9 | the form "<major>:<minor>". These links point to the | ||
10 | corresponding sysfs path for the given device. | ||
11 | |||
12 | Example: | ||
13 | $ readlink /sys/dev/block/8:32 | ||
14 | ../../block/sdc | ||
15 | |||
16 | Entries in /sys/dev/char and /sys/dev/block will be | ||
17 | dynamically created and destroyed as devices enter and | ||
18 | leave the system. | ||
19 | |||
20 | Users: mdadm <linux-raid@vger.kernel.org> | ||
diff --git a/Documentation/ABI/testing/sysfs-devices-memory b/Documentation/ABI/testing/sysfs-devices-memory new file mode 100644 index 000000000000..7a16fe1e2270 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-devices-memory | |||
@@ -0,0 +1,24 @@ | |||
1 | What: /sys/devices/system/memory | ||
2 | Date: June 2008 | ||
3 | Contact: Badari Pulavarty <pbadari@us.ibm.com> | ||
4 | Description: | ||
5 | The /sys/devices/system/memory contains a snapshot of the | ||
6 | internal state of the kernel memory blocks. Files could be | ||
7 | added or removed dynamically to represent hot-add/remove | ||
8 | operations. | ||
9 | |||
10 | Users: hotplug memory add/remove tools | ||
11 | https://w3.opensource.ibm.com/projects/powerpc-utils/ | ||
12 | |||
13 | What: /sys/devices/system/memory/memoryX/removable | ||
14 | Date: June 2008 | ||
15 | Contact: Badari Pulavarty <pbadari@us.ibm.com> | ||
16 | Description: | ||
17 | The file /sys/devices/system/memory/memoryX/removable | ||
18 | indicates whether this memory block is removable or not. | ||
19 | This is useful for a user-level agent to determine | ||
20 | identify removable sections of the memory before attempting | ||
21 | potentially expensive hot-remove memory operation | ||
22 | |||
23 | Users: hotplug memory remove tools | ||
24 | https://w3.opensource.ibm.com/projects/powerpc-utils/ | ||
diff --git a/Documentation/ABI/testing/sysfs-firmware-sgi_uv b/Documentation/ABI/testing/sysfs-firmware-sgi_uv new file mode 100644 index 000000000000..4573fd4b7876 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-firmware-sgi_uv | |||
@@ -0,0 +1,27 @@ | |||
1 | What: /sys/firmware/sgi_uv/ | ||
2 | Date: August 2008 | ||
3 | Contact: Russ Anderson <rja@sgi.com> | ||
4 | Description: | ||
5 | The /sys/firmware/sgi_uv directory contains information | ||
6 | about the SGI UV platform. | ||
7 | |||
8 | Under that directory are a number of files: | ||
9 | |||
10 | partition_id | ||
11 | coherence_id | ||
12 | |||
13 | The partition_id entry contains the partition id. | ||
14 | SGI UV systems can be partitioned into multiple physical | ||
15 | machines, which each partition running a unique copy | ||
16 | of the operating system. Each partition will have a unique | ||
17 | partition id. To display the partition id, use the command: | ||
18 | |||
19 | cat /sys/firmware/sgi_uv/partition_id | ||
20 | |||
21 | The coherence_id entry contains the coherence id. | ||
22 | A partitioned SGI UV system can have one or more coherence | ||
23 | domain. The coherence id indicates which coherence domain | ||
24 | this partition is in. To display the coherence id, use the | ||
25 | command: | ||
26 | |||
27 | cat /sys/firmware/sgi_uv/coherence_id | ||
diff --git a/Documentation/ABI/testing/sysfs-gpio b/Documentation/ABI/testing/sysfs-gpio new file mode 100644 index 000000000000..8aab8092ad35 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-gpio | |||
@@ -0,0 +1,26 @@ | |||
1 | What: /sys/class/gpio/ | ||
2 | Date: July 2008 | ||
3 | KernelVersion: 2.6.27 | ||
4 | Contact: David Brownell <dbrownell@users.sourceforge.net> | ||
5 | Description: | ||
6 | |||
7 | As a Kconfig option, individual GPIO signals may be accessed from | ||
8 | userspace. GPIOs are only made available to userspace by an explicit | ||
9 | "export" operation. If a given GPIO is not claimed for use by | ||
10 | kernel code, it may be exported by userspace (and unexported later). | ||
11 | Kernel code may export it for complete or partial access. | ||
12 | |||
13 | GPIOs are identified as they are inside the kernel, using integers in | ||
14 | the range 0..INT_MAX. See Documentation/gpio.txt for more information. | ||
15 | |||
16 | /sys/class/gpio | ||
17 | /export ... asks the kernel to export a GPIO to userspace | ||
18 | /unexport ... to return a GPIO to the kernel | ||
19 | /gpioN ... for each exported GPIO #N | ||
20 | /value ... always readable, writes fail for input GPIOs | ||
21 | /direction ... r/w as: in, out (default low); write: high, low | ||
22 | /gpiochipN ... for each gpiochip; #N is its first GPIO | ||
23 | /base ... (r/o) same as N | ||
24 | /label ... (r/o) descriptive, not necessarily unique | ||
25 | /ngpio ... (r/o) number of GPIOs; numbered N to N + (ngpio - 1) | ||
26 | |||
diff --git a/Documentation/ABI/testing/sysfs-kernel-mm b/Documentation/ABI/testing/sysfs-kernel-mm new file mode 100644 index 000000000000..190d523ac159 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-kernel-mm | |||
@@ -0,0 +1,6 @@ | |||
1 | What: /sys/kernel/mm | ||
2 | Date: July 2008 | ||
3 | Contact: Nishanth Aravamudan <nacc@us.ibm.com>, VM maintainers | ||
4 | Description: | ||
5 | /sys/kernel/mm/ should contain any and all VM | ||
6 | related information in /sys/kernel/. | ||
diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-hugepages b/Documentation/ABI/testing/sysfs-kernel-mm-hugepages new file mode 100644 index 000000000000..e21c00571cf4 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-kernel-mm-hugepages | |||
@@ -0,0 +1,15 @@ | |||
1 | What: /sys/kernel/mm/hugepages/ | ||
2 | Date: June 2008 | ||
3 | Contact: Nishanth Aravamudan <nacc@us.ibm.com>, hugetlb maintainers | ||
4 | Description: | ||
5 | /sys/kernel/mm/hugepages/ contains a number of subdirectories | ||
6 | of the form hugepages-<size>kB, where <size> is the page size | ||
7 | of the hugepages supported by the kernel/CPU combination. | ||
8 | |||
9 | Under these directories are a number of files: | ||
10 | nr_hugepages | ||
11 | nr_overcommit_hugepages | ||
12 | free_hugepages | ||
13 | surplus_hugepages | ||
14 | resv_hugepages | ||
15 | See Documentation/vm/hugetlbpage.txt for details. | ||
diff --git a/Documentation/ABI/testing/sysfs-profiling b/Documentation/ABI/testing/sysfs-profiling new file mode 100644 index 000000000000..b02d8b8c173a --- /dev/null +++ b/Documentation/ABI/testing/sysfs-profiling | |||
@@ -0,0 +1,13 @@ | |||
1 | What: /sys/kernel/profile | ||
2 | Date: September 2008 | ||
3 | Contact: Dave Hansen <dave@linux.vnet.ibm.com> | ||
4 | Description: | ||
5 | /sys/kernel/profile is the runtime equivalent | ||
6 | of the boot-time profile= option. | ||
7 | |||
8 | You can get the same effect running: | ||
9 | |||
10 | echo 2 > /sys/kernel/profile | ||
11 | |||
12 | as you would by issuing profile=2 on the boot | ||
13 | command line. | ||
diff --git a/Documentation/ABI/testing/sysfs-wusb_cbaf b/Documentation/ABI/testing/sysfs-wusb_cbaf new file mode 100644 index 000000000000..a99c5f86a37a --- /dev/null +++ b/Documentation/ABI/testing/sysfs-wusb_cbaf | |||
@@ -0,0 +1,100 @@ | |||
1 | What: /sys/bus/usb/drivers/wusb_cbaf/.../wusb_* | ||
2 | Date: August 2008 | ||
3 | KernelVersion: 2.6.27 | ||
4 | Contact: David Vrabel <david.vrabel@csr.com> | ||
5 | Description: | ||
6 | Various files for managing Cable Based Association of | ||
7 | (wireless) USB devices. | ||
8 | |||
9 | The sequence of operations should be: | ||
10 | |||
11 | 1. Device is plugged in. | ||
12 | |||
13 | 2. The connection manager (CM) sees a device with CBA capability. | ||
14 | (the wusb_chid etc. files in /sys/devices/blah/OURDEVICE). | ||
15 | |||
16 | 3. The CM writes the host name, supported band groups, | ||
17 | and the CHID (host ID) into the wusb_host_name, | ||
18 | wusb_host_band_groups and wusb_chid files. These | ||
19 | get sent to the device and the CDID (if any) for | ||
20 | this host is requested. | ||
21 | |||
22 | 4. The CM can verify that the device's supported band | ||
23 | groups (wusb_device_band_groups) are compatible | ||
24 | with the host. | ||
25 | |||
26 | 5. The CM reads the wusb_cdid file. | ||
27 | |||
28 | 6. The CM looks it up its database. | ||
29 | |||
30 | - If it has a matching CHID,CDID entry, the device | ||
31 | has been authorized before and nothing further | ||
32 | needs to be done. | ||
33 | |||
34 | - If the CDID is zero (or the CM doesn't find a | ||
35 | matching CDID in its database), the device is | ||
36 | assumed to be not known. The CM may associate | ||
37 | the host with device by: writing a randomly | ||
38 | generated CDID to wusb_cdid and then a random CK | ||
39 | to wusb_ck (this uploads the new CC to the | ||
40 | device). | ||
41 | |||
42 | CMD may choose to prompt the user before | ||
43 | associating with a new device. | ||
44 | |||
45 | 7. Device is unplugged. | ||
46 | |||
47 | References: | ||
48 | [WUSB-AM] Association Models Supplement to the | ||
49 | Certified Wireless Universal Serial Bus | ||
50 | Specification, version 1.0. | ||
51 | |||
52 | What: /sys/bus/usb/drivers/wusb_cbaf/.../wusb_chid | ||
53 | Date: August 2008 | ||
54 | KernelVersion: 2.6.27 | ||
55 | Contact: David Vrabel <david.vrabel@csr.com> | ||
56 | Description: | ||
57 | The CHID of the host formatted as 16 space-separated | ||
58 | hex octets. | ||
59 | |||
60 | Writes fetches device's supported band groups and the | ||
61 | the CDID for any existing association with this host. | ||
62 | |||
63 | What: /sys/bus/usb/drivers/wusb_cbaf/.../wusb_host_name | ||
64 | Date: August 2008 | ||
65 | KernelVersion: 2.6.27 | ||
66 | Contact: David Vrabel <david.vrabel@csr.com> | ||
67 | Description: | ||
68 | A friendly name for the host as a UTF-8 encoded string. | ||
69 | |||
70 | What: /sys/bus/usb/drivers/wusb_cbaf/.../wusb_host_band_groups | ||
71 | Date: August 2008 | ||
72 | KernelVersion: 2.6.27 | ||
73 | Contact: David Vrabel <david.vrabel@csr.com> | ||
74 | Description: | ||
75 | The band groups supported by the host, in the format | ||
76 | defined in [WUSB-AM]. | ||
77 | |||
78 | What: /sys/bus/usb/drivers/wusb_cbaf/.../wusb_device_band_groups | ||
79 | Date: August 2008 | ||
80 | KernelVersion: 2.6.27 | ||
81 | Contact: David Vrabel <david.vrabel@csr.com> | ||
82 | Description: | ||
83 | The band groups supported by the device, in the format | ||
84 | defined in [WUSB-AM]. | ||
85 | |||
86 | What: /sys/bus/usb/drivers/wusb_cbaf/.../wusb_cdid | ||
87 | Date: August 2008 | ||
88 | KernelVersion: 2.6.27 | ||
89 | Contact: David Vrabel <david.vrabel@csr.com> | ||
90 | Description: | ||
91 | The device's CDID formatted as 16 space-separated hex | ||
92 | octets. | ||
93 | |||
94 | What: /sys/bus/usb/drivers/wusb_cbaf/.../wusb_ck | ||
95 | Date: August 2008 | ||
96 | KernelVersion: 2.6.27 | ||
97 | Contact: David Vrabel <david.vrabel@csr.com> | ||
98 | Description: | ||
99 | Write 16 space-separated random, hex octets to | ||
100 | associate with the device. | ||
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle index 6caa14615578..1875e502f872 100644 --- a/Documentation/CodingStyle +++ b/Documentation/CodingStyle | |||
@@ -474,25 +474,29 @@ make a good program). | |||
474 | So, you can either get rid of GNU emacs, or change it to use saner | 474 | So, you can either get rid of GNU emacs, or change it to use saner |
475 | values. To do the latter, you can stick the following in your .emacs file: | 475 | values. To do the latter, you can stick the following in your .emacs file: |
476 | 476 | ||
477 | (defun linux-c-mode () | 477 | (defun c-lineup-arglist-tabs-only (ignored) |
478 | "C mode with adjusted defaults for use with the Linux kernel." | 478 | "Line up argument lists by tabs, not spaces" |
479 | (interactive) | 479 | (let* ((anchor (c-langelem-pos c-syntactic-element)) |
480 | (c-mode) | 480 | (column (c-langelem-2nd-pos c-syntactic-element)) |
481 | (c-set-style "K&R") | 481 | (offset (- (1+ column) anchor)) |
482 | (setq tab-width 8) | 482 | (steps (floor offset c-basic-offset))) |
483 | (setq indent-tabs-mode t) | 483 | (* (max steps 1) |
484 | (setq c-basic-offset 8)) | 484 | c-basic-offset))) |
485 | 485 | ||
486 | This will define the M-x linux-c-mode command. When hacking on a | 486 | (add-hook 'c-mode-hook |
487 | module, if you put the string -*- linux-c -*- somewhere on the first | 487 | (lambda () |
488 | two lines, this mode will be automatically invoked. Also, you may want | 488 | (let ((filename (buffer-file-name))) |
489 | to add | 489 | ;; Enable kernel mode for the appropriate files |
490 | 490 | (when (and filename | |
491 | (setq auto-mode-alist (cons '("/usr/src/linux.*/.*\\.[ch]$" . linux-c-mode) | 491 | (string-match "~/src/linux-trees" filename)) |
492 | auto-mode-alist)) | 492 | (setq indent-tabs-mode t) |
493 | 493 | (c-set-style "linux") | |
494 | to your .emacs file if you want to have linux-c-mode switched on | 494 | (c-set-offset 'arglist-cont-nonempty |
495 | automagically when you edit source files under /usr/src/linux. | 495 | '(c-lineup-gcc-asm-reg |
496 | c-lineup-arglist-tabs-only)))))) | ||
497 | |||
498 | This will make emacs go better with the kernel coding style for C | ||
499 | files below ~/src/linux-trees. | ||
496 | 500 | ||
497 | But even if you fail in getting emacs to do sane formatting, not | 501 | But even if you fail in getting emacs to do sane formatting, not |
498 | everything is lost: use "indent". | 502 | everything is lost: use "indent". |
diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt index 80d150458c80..b8e86460046e 100644 --- a/Documentation/DMA-API.txt +++ b/Documentation/DMA-API.txt | |||
@@ -298,10 +298,10 @@ recommended that you never use these unless you really know what the | |||
298 | cache width is. | 298 | cache width is. |
299 | 299 | ||
300 | int | 300 | int |
301 | dma_mapping_error(dma_addr_t dma_addr) | 301 | dma_mapping_error(struct device *dev, dma_addr_t dma_addr) |
302 | 302 | ||
303 | int | 303 | int |
304 | pci_dma_mapping_error(dma_addr_t dma_addr) | 304 | pci_dma_mapping_error(struct pci_dev *hwdev, dma_addr_t dma_addr) |
305 | 305 | ||
306 | In some circumstances dma_map_single and dma_map_page will fail to create | 306 | In some circumstances dma_map_single and dma_map_page will fail to create |
307 | a mapping. A driver can check for these errors by testing the returned | 307 | a mapping. A driver can check for these errors by testing the returned |
@@ -337,7 +337,7 @@ With scatterlists, you use the resulting mapping like this: | |||
337 | int i, count = dma_map_sg(dev, sglist, nents, direction); | 337 | int i, count = dma_map_sg(dev, sglist, nents, direction); |
338 | struct scatterlist *sg; | 338 | struct scatterlist *sg; |
339 | 339 | ||
340 | for (i = 0, sg = sglist; i < count; i++, sg++) { | 340 | for_each_sg(sglist, sg, count, i) { |
341 | hw_address[i] = sg_dma_address(sg); | 341 | hw_address[i] = sg_dma_address(sg); |
342 | hw_len[i] = sg_dma_len(sg); | 342 | hw_len[i] = sg_dma_len(sg); |
343 | } | 343 | } |
diff --git a/Documentation/DMA-attributes.txt b/Documentation/DMA-attributes.txt index 6d772f84b477..b768cc0e402b 100644 --- a/Documentation/DMA-attributes.txt +++ b/Documentation/DMA-attributes.txt | |||
@@ -22,3 +22,12 @@ ready and available in memory. The DMA of the "completion indication" | |||
22 | could race with data DMA. Mapping the memory used for completion | 22 | could race with data DMA. Mapping the memory used for completion |
23 | indications with DMA_ATTR_WRITE_BARRIER would prevent the race. | 23 | indications with DMA_ATTR_WRITE_BARRIER would prevent the race. |
24 | 24 | ||
25 | DMA_ATTR_WEAK_ORDERING | ||
26 | ---------------------- | ||
27 | |||
28 | DMA_ATTR_WEAK_ORDERING specifies that reads and writes to the mapping | ||
29 | may be weakly ordered, that is that reads and writes may pass each other. | ||
30 | |||
31 | Since it is optional for platforms to implement DMA_ATTR_WEAK_ORDERING, | ||
32 | those that do not will simply ignore the attribute and exhibit default | ||
33 | behavior. | ||
diff --git a/Documentation/DMA-mapping.txt b/Documentation/DMA-mapping.txt index b463ecd0c7ce..c74fec8c2351 100644 --- a/Documentation/DMA-mapping.txt +++ b/Documentation/DMA-mapping.txt | |||
@@ -740,7 +740,7 @@ failure can be determined by: | |||
740 | dma_addr_t dma_handle; | 740 | dma_addr_t dma_handle; |
741 | 741 | ||
742 | dma_handle = pci_map_single(pdev, addr, size, direction); | 742 | dma_handle = pci_map_single(pdev, addr, size, direction); |
743 | if (pci_dma_mapping_error(dma_handle)) { | 743 | if (pci_dma_mapping_error(pdev, dma_handle)) { |
744 | /* | 744 | /* |
745 | * reduce current DMA mapping usage, | 745 | * reduce current DMA mapping usage, |
746 | * delay and try again later or | 746 | * delay and try again later or |
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index 0eb0d027eb32..fabc06466b93 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile | |||
@@ -6,13 +6,13 @@ | |||
6 | # To add a new book the only step required is to add the book to the | 6 | # To add a new book the only step required is to add the book to the |
7 | # list of DOCBOOKS. | 7 | # list of DOCBOOKS. |
8 | 8 | ||
9 | DOCBOOKS := wanbook.xml z8530book.xml mcabook.xml videobook.xml \ | 9 | DOCBOOKS := wanbook.xml z8530book.xml mcabook.xml \ |
10 | kernel-hacking.xml kernel-locking.xml deviceiobook.xml \ | 10 | kernel-hacking.xml kernel-locking.xml deviceiobook.xml \ |
11 | procfs-guide.xml writing_usb_driver.xml networking.xml \ | 11 | procfs-guide.xml writing_usb_driver.xml networking.xml \ |
12 | kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml \ | 12 | kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml \ |
13 | gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \ | 13 | gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \ |
14 | genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \ | 14 | genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \ |
15 | mac80211.xml debugobjects.xml | 15 | mac80211.xml debugobjects.xml sh.xml |
16 | 16 | ||
17 | ### | 17 | ### |
18 | # The build process is as follows (targets): | 18 | # The build process is as follows (targets): |
@@ -102,6 +102,13 @@ C-procfs-example = procfs_example.xml | |||
102 | C-procfs-example2 = $(addprefix $(obj)/,$(C-procfs-example)) | 102 | C-procfs-example2 = $(addprefix $(obj)/,$(C-procfs-example)) |
103 | $(obj)/procfs-guide.xml: $(C-procfs-example2) | 103 | $(obj)/procfs-guide.xml: $(C-procfs-example2) |
104 | 104 | ||
105 | # List of programs to build | ||
106 | ##oops, this is a kernel module::hostprogs-y := procfs_example | ||
107 | obj-m += procfs_example.o | ||
108 | |||
109 | # Tell kbuild to always build the programs | ||
110 | always := $(hostprogs-y) | ||
111 | |||
105 | notfoundtemplate = echo "*** You have to install docbook-utils or xmlto ***"; \ | 112 | notfoundtemplate = echo "*** You have to install docbook-utils or xmlto ***"; \ |
106 | exit 1 | 113 | exit 1 |
107 | db2xtemplate = db2TYPE -o $(dir $@) $< | 114 | db2xtemplate = db2TYPE -o $(dir $@) $< |
diff --git a/Documentation/DocBook/gadget.tmpl b/Documentation/DocBook/gadget.tmpl index 5a8ffa761e09..6ef2f0073e5a 100644 --- a/Documentation/DocBook/gadget.tmpl +++ b/Documentation/DocBook/gadget.tmpl | |||
@@ -524,6 +524,47 @@ These utilities include endpoint autoconfiguration. | |||
524 | <!-- !Edrivers/usb/gadget/epautoconf.c --> | 524 | <!-- !Edrivers/usb/gadget/epautoconf.c --> |
525 | </sect1> | 525 | </sect1> |
526 | 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/f_acm.c | ||
560 | !Edrivers/usb/gadget/f_ecm.c | ||
561 | !Edrivers/usb/gadget/f_subset.c | ||
562 | !Edrivers/usb/gadget/f_obex.c | ||
563 | !Edrivers/usb/gadget/f_serial.c | ||
564 | |||
565 | </sect1> | ||
566 | |||
567 | |||
527 | </chapter> | 568 | </chapter> |
528 | 569 | ||
529 | <chapter id="controllers"><title>Peripheral Controller Drivers</title> | 570 | <chapter id="controllers"><title>Peripheral Controller Drivers</title> |
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl index b7b1482f6e04..9d0058e788e5 100644 --- a/Documentation/DocBook/kernel-api.tmpl +++ b/Documentation/DocBook/kernel-api.tmpl | |||
@@ -283,6 +283,7 @@ X!Earch/x86/kernel/mca_32.c | |||
283 | <chapter id="security"> | 283 | <chapter id="security"> |
284 | <title>Security Framework</title> | 284 | <title>Security Framework</title> |
285 | !Isecurity/security.c | 285 | !Isecurity/security.c |
286 | !Esecurity/inode.c | ||
286 | </chapter> | 287 | </chapter> |
287 | 288 | ||
288 | <chapter id="audit"> | 289 | <chapter id="audit"> |
@@ -364,6 +365,10 @@ X!Edrivers/pnp/system.c | |||
364 | !Eblock/blk-barrier.c | 365 | !Eblock/blk-barrier.c |
365 | !Eblock/blk-tag.c | 366 | !Eblock/blk-tag.c |
366 | !Iblock/blk-tag.c | 367 | !Iblock/blk-tag.c |
368 | !Eblock/blk-integrity.c | ||
369 | !Iblock/blktrace.c | ||
370 | !Iblock/genhd.c | ||
371 | !Eblock/genhd.c | ||
367 | </chapter> | 372 | </chapter> |
368 | 373 | ||
369 | <chapter id="chrdev"> | 374 | <chapter id="chrdev"> |
diff --git a/Documentation/DocBook/kernel-hacking.tmpl b/Documentation/DocBook/kernel-hacking.tmpl index 4c63e5864160..ae15d55350ec 100644 --- a/Documentation/DocBook/kernel-hacking.tmpl +++ b/Documentation/DocBook/kernel-hacking.tmpl | |||
@@ -1105,7 +1105,7 @@ static struct block_device_operations opt_fops = { | |||
1105 | </listitem> | 1105 | </listitem> |
1106 | <listitem> | 1106 | <listitem> |
1107 | <para> | 1107 | <para> |
1108 | Function names as strings (__FUNCTION__). | 1108 | Function names as strings (__func__). |
1109 | </para> | 1109 | </para> |
1110 | </listitem> | 1110 | </listitem> |
1111 | <listitem> | 1111 | <listitem> |
diff --git a/Documentation/DocBook/kernel-locking.tmpl b/Documentation/DocBook/kernel-locking.tmpl index 2510763295d0..084f6ad7b7a0 100644 --- a/Documentation/DocBook/kernel-locking.tmpl +++ b/Documentation/DocBook/kernel-locking.tmpl | |||
@@ -219,10 +219,10 @@ | |||
219 | </para> | 219 | </para> |
220 | 220 | ||
221 | <sect1 id="lock-intro"> | 221 | <sect1 id="lock-intro"> |
222 | <title>Three Main Types of Kernel Locks: Spinlocks, Mutexes and Semaphores</title> | 222 | <title>Two Main Types of Kernel Locks: Spinlocks and Mutexes</title> |
223 | 223 | ||
224 | <para> | 224 | <para> |
225 | There are three main types of kernel locks. The fundamental type | 225 | There are two main types of kernel locks. The fundamental type |
226 | is the spinlock | 226 | is the spinlock |
227 | (<filename class="headerfile">include/asm/spinlock.h</filename>), | 227 | (<filename class="headerfile">include/asm/spinlock.h</filename>), |
228 | which is a very simple single-holder lock: if you can't get the | 228 | which is a very simple single-holder lock: if you can't get the |
@@ -240,14 +240,6 @@ | |||
240 | use a spinlock instead. | 240 | use a spinlock instead. |
241 | </para> | 241 | </para> |
242 | <para> | 242 | <para> |
243 | The third type is a semaphore | ||
244 | (<filename class="headerfile">include/linux/semaphore.h</filename>): it | ||
245 | can have more than one holder at any time (the number decided at | ||
246 | initialization time), although it is most commonly used as a | ||
247 | single-holder lock (a mutex). If you can't get a semaphore, your | ||
248 | task will be suspended and later on woken up - just like for mutexes. | ||
249 | </para> | ||
250 | <para> | ||
251 | Neither type of lock is recursive: see | 243 | Neither type of lock is recursive: see |
252 | <xref linkend="deadlock"/>. | 244 | <xref linkend="deadlock"/>. |
253 | </para> | 245 | </para> |
@@ -278,7 +270,7 @@ | |||
278 | </para> | 270 | </para> |
279 | 271 | ||
280 | <para> | 272 | <para> |
281 | Semaphores still exist, because they are required for | 273 | Mutexes still exist, because they are required for |
282 | synchronization between <firstterm linkend="gloss-usercontext">user | 274 | synchronization between <firstterm linkend="gloss-usercontext">user |
283 | contexts</firstterm>, as we will see below. | 275 | contexts</firstterm>, as we will see below. |
284 | </para> | 276 | </para> |
@@ -289,18 +281,17 @@ | |||
289 | 281 | ||
290 | <para> | 282 | <para> |
291 | If you have a data structure which is only ever accessed from | 283 | If you have a data structure which is only ever accessed from |
292 | user context, then you can use a simple semaphore | 284 | user context, then you can use a simple mutex |
293 | (<filename>linux/linux/semaphore.h</filename>) to protect it. This | 285 | (<filename>include/linux/mutex.h</filename>) to protect it. This |
294 | is the most trivial case: you initialize the semaphore to the number | 286 | is the most trivial case: you initialize the mutex. Then you can |
295 | of resources available (usually 1), and call | 287 | call <function>mutex_lock_interruptible()</function> to grab the mutex, |
296 | <function>down_interruptible()</function> to grab the semaphore, and | 288 | and <function>mutex_unlock()</function> to release it. There is also a |
297 | <function>up()</function> to release it. There is also a | 289 | <function>mutex_lock()</function>, which should be avoided, because it |
298 | <function>down()</function>, which should be avoided, because it | ||
299 | will not return if a signal is received. | 290 | will not return if a signal is received. |
300 | </para> | 291 | </para> |
301 | 292 | ||
302 | <para> | 293 | <para> |
303 | Example: <filename>linux/net/core/netfilter.c</filename> allows | 294 | Example: <filename>net/netfilter/nf_sockopt.c</filename> allows |
304 | registration of new <function>setsockopt()</function> and | 295 | registration of new <function>setsockopt()</function> and |
305 | <function>getsockopt()</function> calls, with | 296 | <function>getsockopt()</function> calls, with |
306 | <function>nf_register_sockopt()</function>. Registration and | 297 | <function>nf_register_sockopt()</function>. Registration and |
@@ -515,7 +506,7 @@ | |||
515 | <listitem> | 506 | <listitem> |
516 | <para> | 507 | <para> |
517 | If you are in a process context (any syscall) and want to | 508 | If you are in a process context (any syscall) and want to |
518 | lock other process out, use a semaphore. You can take a semaphore | 509 | lock other process out, use a mutex. You can take a mutex |
519 | and sleep (<function>copy_from_user*(</function> or | 510 | and sleep (<function>copy_from_user*(</function> or |
520 | <function>kmalloc(x,GFP_KERNEL)</function>). | 511 | <function>kmalloc(x,GFP_KERNEL)</function>). |
521 | </para> | 512 | </para> |
@@ -662,7 +653,7 @@ | |||
662 | <entry>SLBH</entry> | 653 | <entry>SLBH</entry> |
663 | <entry>SLBH</entry> | 654 | <entry>SLBH</entry> |
664 | <entry>SLBH</entry> | 655 | <entry>SLBH</entry> |
665 | <entry>DI</entry> | 656 | <entry>MLI</entry> |
666 | <entry>None</entry> | 657 | <entry>None</entry> |
667 | </row> | 658 | </row> |
668 | 659 | ||
@@ -692,8 +683,8 @@ | |||
692 | <entry>spin_lock_bh</entry> | 683 | <entry>spin_lock_bh</entry> |
693 | </row> | 684 | </row> |
694 | <row> | 685 | <row> |
695 | <entry>DI</entry> | 686 | <entry>MLI</entry> |
696 | <entry>down_interruptible</entry> | 687 | <entry>mutex_lock_interruptible</entry> |
697 | </row> | 688 | </row> |
698 | 689 | ||
699 | </tbody> | 690 | </tbody> |
@@ -1310,7 +1301,7 @@ as Alan Cox says, <quote>Lock data, not code</quote>. | |||
1310 | <para> | 1301 | <para> |
1311 | There is a coding bug where a piece of code tries to grab a | 1302 | There is a coding bug where a piece of code tries to grab a |
1312 | spinlock twice: it will spin forever, waiting for the lock to | 1303 | spinlock twice: it will spin forever, waiting for the lock to |
1313 | be released (spinlocks, rwlocks and semaphores are not | 1304 | be released (spinlocks, rwlocks and mutexes are not |
1314 | recursive in Linux). This is trivial to diagnose: not a | 1305 | recursive in Linux). This is trivial to diagnose: not a |
1315 | stay-up-five-nights-talk-to-fluffy-code-bunnies kind of | 1306 | stay-up-five-nights-talk-to-fluffy-code-bunnies kind of |
1316 | problem. | 1307 | problem. |
@@ -1335,7 +1326,7 @@ as Alan Cox says, <quote>Lock data, not code</quote>. | |||
1335 | 1326 | ||
1336 | <para> | 1327 | <para> |
1337 | This complete lockup is easy to diagnose: on SMP boxes the | 1328 | This complete lockup is easy to diagnose: on SMP boxes the |
1338 | watchdog timer or compiling with <symbol>DEBUG_SPINLOCKS</symbol> set | 1329 | watchdog timer or compiling with <symbol>DEBUG_SPINLOCK</symbol> set |
1339 | (<filename>include/linux/spinlock.h</filename>) will show this up | 1330 | (<filename>include/linux/spinlock.h</filename>) will show this up |
1340 | immediately when it happens. | 1331 | immediately when it happens. |
1341 | </para> | 1332 | </para> |
@@ -1558,7 +1549,7 @@ the amount of locking which needs to be done. | |||
1558 | <title>Read/Write Lock Variants</title> | 1549 | <title>Read/Write Lock Variants</title> |
1559 | 1550 | ||
1560 | <para> | 1551 | <para> |
1561 | Both spinlocks and semaphores have read/write variants: | 1552 | Both spinlocks and mutexes have read/write variants: |
1562 | <type>rwlock_t</type> and <structname>struct rw_semaphore</structname>. | 1553 | <type>rwlock_t</type> and <structname>struct rw_semaphore</structname>. |
1563 | These divide users into two classes: the readers and the writers. If | 1554 | These divide users into two classes: the readers and the writers. If |
1564 | you are only reading the data, you can get a read lock, but to write to | 1555 | you are only reading the data, you can get a read lock, but to write to |
@@ -1681,7 +1672,7 @@ the amount of locking which needs to be done. | |||
1681 | #include <linux/slab.h> | 1672 | #include <linux/slab.h> |
1682 | #include <linux/string.h> | 1673 | #include <linux/string.h> |
1683 | +#include <linux/rcupdate.h> | 1674 | +#include <linux/rcupdate.h> |
1684 | #include <linux/semaphore.h> | 1675 | #include <linux/mutex.h> |
1685 | #include <asm/errno.h> | 1676 | #include <asm/errno.h> |
1686 | 1677 | ||
1687 | struct object | 1678 | struct object |
@@ -1913,7 +1904,7 @@ machines due to caching. | |||
1913 | </listitem> | 1904 | </listitem> |
1914 | <listitem> | 1905 | <listitem> |
1915 | <para> | 1906 | <para> |
1916 | <function> put_user()</function> | 1907 | <function>put_user()</function> |
1917 | </para> | 1908 | </para> |
1918 | </listitem> | 1909 | </listitem> |
1919 | </itemizedlist> | 1910 | </itemizedlist> |
@@ -1927,13 +1918,13 @@ machines due to caching. | |||
1927 | 1918 | ||
1928 | <listitem> | 1919 | <listitem> |
1929 | <para> | 1920 | <para> |
1930 | <function>down_interruptible()</function> and | 1921 | <function>mutex_lock_interruptible()</function> and |
1931 | <function>down()</function> | 1922 | <function>mutex_lock()</function> |
1932 | </para> | 1923 | </para> |
1933 | <para> | 1924 | <para> |
1934 | There is a <function>down_trylock()</function> which can be | 1925 | There is a <function>mutex_trylock()</function> which can be |
1935 | used inside interrupt context, as it will not sleep. | 1926 | used inside interrupt context, as it will not sleep. |
1936 | <function>up()</function> will also never sleep. | 1927 | <function>mutex_unlock()</function> will also never sleep. |
1937 | </para> | 1928 | </para> |
1938 | </listitem> | 1929 | </listitem> |
1939 | </itemizedlist> | 1930 | </itemizedlist> |
@@ -2023,7 +2014,7 @@ machines due to caching. | |||
2023 | <para> | 2014 | <para> |
2024 | Prior to 2.5, or when <symbol>CONFIG_PREEMPT</symbol> is | 2015 | Prior to 2.5, or when <symbol>CONFIG_PREEMPT</symbol> is |
2025 | unset, processes in user context inside the kernel would not | 2016 | unset, processes in user context inside the kernel would not |
2026 | preempt each other (ie. you had that CPU until you have it up, | 2017 | preempt each other (ie. you had that CPU until you gave it up, |
2027 | except for interrupts). With the addition of | 2018 | except for interrupts). With the addition of |
2028 | <symbol>CONFIG_PREEMPT</symbol> in 2.5.4, this changed: when | 2019 | <symbol>CONFIG_PREEMPT</symbol> in 2.5.4, this changed: when |
2029 | in user context, higher priority tasks can "cut in": spinlocks | 2020 | in user context, higher priority tasks can "cut in": spinlocks |
diff --git a/Documentation/DocBook/kgdb.tmpl b/Documentation/DocBook/kgdb.tmpl index e8acd1f03456..372dec20c8da 100644 --- a/Documentation/DocBook/kgdb.tmpl +++ b/Documentation/DocBook/kgdb.tmpl | |||
@@ -98,6 +98,24 @@ | |||
98 | "Kernel debugging" select "KGDB: kernel debugging with remote gdb". | 98 | "Kernel debugging" select "KGDB: kernel debugging with remote gdb". |
99 | </para> | 99 | </para> |
100 | <para> | 100 | <para> |
101 | It is advised, but not required that you turn on the | ||
102 | CONFIG_FRAME_POINTER kernel option. This option inserts code to | ||
103 | into the compiled executable which saves the frame information in | ||
104 | registers or on the stack at different points which will allow a | ||
105 | debugger such as gdb to more accurately construct stack back traces | ||
106 | while debugging the kernel. | ||
107 | </para> | ||
108 | <para> | ||
109 | If the architecture that you are using supports the kernel option | ||
110 | CONFIG_DEBUG_RODATA, you should consider turning it off. This | ||
111 | option will prevent the use of software breakpoints because it | ||
112 | marks certain regions of the kernel's memory space as read-only. | ||
113 | If kgdb supports it for the architecture you are using, you can | ||
114 | use hardware breakpoints if you desire to run with the | ||
115 | CONFIG_DEBUG_RODATA option turned on, else you need to turn off | ||
116 | this option. | ||
117 | </para> | ||
118 | <para> | ||
101 | Next you should choose one of more I/O drivers to interconnect debugging | 119 | Next you should choose one of more I/O drivers to interconnect debugging |
102 | host and debugged target. Early boot debugging requires a KGDB | 120 | host and debugged target. Early boot debugging requires a KGDB |
103 | I/O driver that supports early debugging and the driver must be | 121 | I/O driver that supports early debugging and the driver must be |
diff --git a/Documentation/DocBook/mac80211.tmpl b/Documentation/DocBook/mac80211.tmpl index b651e0a4b1c0..77c3c202991b 100644 --- a/Documentation/DocBook/mac80211.tmpl +++ b/Documentation/DocBook/mac80211.tmpl | |||
@@ -145,7 +145,6 @@ usage should require reading the full document. | |||
145 | this though and the recommendation to allow only a single | 145 | this though and the recommendation to allow only a single |
146 | interface in STA mode at first! | 146 | interface in STA mode at first! |
147 | </para> | 147 | </para> |
148 | !Finclude/net/mac80211.h ieee80211_if_types | ||
149 | !Finclude/net/mac80211.h ieee80211_if_init_conf | 148 | !Finclude/net/mac80211.h ieee80211_if_init_conf |
150 | !Finclude/net/mac80211.h ieee80211_if_conf | 149 | !Finclude/net/mac80211.h ieee80211_if_conf |
151 | </chapter> | 150 | </chapter> |
@@ -177,8 +176,7 @@ usage should require reading the full document. | |||
177 | <title>functions/definitions</title> | 176 | <title>functions/definitions</title> |
178 | !Finclude/net/mac80211.h ieee80211_rx_status | 177 | !Finclude/net/mac80211.h ieee80211_rx_status |
179 | !Finclude/net/mac80211.h mac80211_rx_flags | 178 | !Finclude/net/mac80211.h mac80211_rx_flags |
180 | !Finclude/net/mac80211.h ieee80211_tx_control | 179 | !Finclude/net/mac80211.h ieee80211_tx_info |
181 | !Finclude/net/mac80211.h ieee80211_tx_status_flags | ||
182 | !Finclude/net/mac80211.h ieee80211_rx | 180 | !Finclude/net/mac80211.h ieee80211_rx |
183 | !Finclude/net/mac80211.h ieee80211_rx_irqsafe | 181 | !Finclude/net/mac80211.h ieee80211_rx_irqsafe |
184 | !Finclude/net/mac80211.h ieee80211_tx_status | 182 | !Finclude/net/mac80211.h ieee80211_tx_status |
@@ -189,12 +187,11 @@ usage should require reading the full document. | |||
189 | !Finclude/net/mac80211.h ieee80211_ctstoself_duration | 187 | !Finclude/net/mac80211.h ieee80211_ctstoself_duration |
190 | !Finclude/net/mac80211.h ieee80211_generic_frame_duration | 188 | !Finclude/net/mac80211.h ieee80211_generic_frame_duration |
191 | !Finclude/net/mac80211.h ieee80211_get_hdrlen_from_skb | 189 | !Finclude/net/mac80211.h ieee80211_get_hdrlen_from_skb |
192 | !Finclude/net/mac80211.h ieee80211_get_hdrlen | 190 | !Finclude/net/mac80211.h ieee80211_hdrlen |
193 | !Finclude/net/mac80211.h ieee80211_wake_queue | 191 | !Finclude/net/mac80211.h ieee80211_wake_queue |
194 | !Finclude/net/mac80211.h ieee80211_stop_queue | 192 | !Finclude/net/mac80211.h ieee80211_stop_queue |
195 | !Finclude/net/mac80211.h ieee80211_start_queues | ||
196 | !Finclude/net/mac80211.h ieee80211_stop_queues | ||
197 | !Finclude/net/mac80211.h ieee80211_wake_queues | 193 | !Finclude/net/mac80211.h ieee80211_wake_queues |
194 | !Finclude/net/mac80211.h ieee80211_stop_queues | ||
198 | </sect1> | 195 | </sect1> |
199 | </chapter> | 196 | </chapter> |
200 | 197 | ||
@@ -230,8 +227,7 @@ usage should require reading the full document. | |||
230 | <title>Multiple queues and QoS support</title> | 227 | <title>Multiple queues and QoS support</title> |
231 | <para>TBD</para> | 228 | <para>TBD</para> |
232 | !Finclude/net/mac80211.h ieee80211_tx_queue_params | 229 | !Finclude/net/mac80211.h ieee80211_tx_queue_params |
233 | !Finclude/net/mac80211.h ieee80211_tx_queue_stats_data | 230 | !Finclude/net/mac80211.h ieee80211_tx_queue_stats |
234 | !Finclude/net/mac80211.h ieee80211_tx_queue | ||
235 | </chapter> | 231 | </chapter> |
236 | 232 | ||
237 | <chapter id="AP"> | 233 | <chapter id="AP"> |
diff --git a/Documentation/DocBook/procfs-guide.tmpl b/Documentation/DocBook/procfs-guide.tmpl index 1fd6a1ec7591..9eba4b7af73d 100644 --- a/Documentation/DocBook/procfs-guide.tmpl +++ b/Documentation/DocBook/procfs-guide.tmpl | |||
@@ -14,27 +14,30 @@ | |||
14 | <othername>(J.A.K.)</othername> | 14 | <othername>(J.A.K.)</othername> |
15 | <surname>Mouw</surname> | 15 | <surname>Mouw</surname> |
16 | <affiliation> | 16 | <affiliation> |
17 | <orgname>Delft University of Technology</orgname> | ||
18 | <orgdiv>Faculty of Information Technology and Systems</orgdiv> | ||
19 | <address> | 17 | <address> |
20 | <email>J.A.K.Mouw@its.tudelft.nl</email> | 18 | <email>mouw@nl.linux.org</email> |
21 | <pob>PO BOX 5031</pob> | ||
22 | <postcode>2600 GA</postcode> | ||
23 | <city>Delft</city> | ||
24 | <country>The Netherlands</country> | ||
25 | </address> | 19 | </address> |
26 | </affiliation> | 20 | </affiliation> |
27 | </author> | 21 | </author> |
22 | <othercredit> | ||
23 | <contrib> | ||
24 | This software and documentation were written while working on the | ||
25 | LART computing board | ||
26 | (<ulink url="http://www.lartmaker.nl/">http://www.lartmaker.nl/</ulink>), | ||
27 | which was sponsored by the Delt University of Technology projects | ||
28 | Mobile Multi-media Communications and Ubiquitous Communications. | ||
29 | </contrib> | ||
30 | </othercredit> | ||
28 | </authorgroup> | 31 | </authorgroup> |
29 | 32 | ||
30 | <revhistory> | 33 | <revhistory> |
31 | <revision> | 34 | <revision> |
32 | <revnumber>1.0 </revnumber> | 35 | <revnumber>1.0</revnumber> |
33 | <date>May 30, 2001</date> | 36 | <date>May 30, 2001</date> |
34 | <revremark>Initial revision posted to linux-kernel</revremark> | 37 | <revremark>Initial revision posted to linux-kernel</revremark> |
35 | </revision> | 38 | </revision> |
36 | <revision> | 39 | <revision> |
37 | <revnumber>1.1 </revnumber> | 40 | <revnumber>1.1</revnumber> |
38 | <date>June 3, 2001</date> | 41 | <date>June 3, 2001</date> |
39 | <revremark>Revised after comments from linux-kernel</revremark> | 42 | <revremark>Revised after comments from linux-kernel</revremark> |
40 | </revision> | 43 | </revision> |
@@ -109,18 +112,6 @@ | |||
109 | </para> | 112 | </para> |
110 | 113 | ||
111 | <para> | 114 | <para> |
112 | This documentation was written while working on the LART | ||
113 | computing board (<ulink | ||
114 | url="http://www.lart.tudelft.nl/">http://www.lart.tudelft.nl/</ulink>), | ||
115 | which is sponsored by the Mobile Multi-media Communications | ||
116 | (<ulink | ||
117 | url="http://www.mmc.tudelft.nl/">http://www.mmc.tudelft.nl/</ulink>) | ||
118 | and Ubiquitous Communications (<ulink | ||
119 | url="http://www.ubicom.tudelft.nl/">http://www.ubicom.tudelft.nl/</ulink>) | ||
120 | projects. | ||
121 | </para> | ||
122 | |||
123 | <para> | ||
124 | Erik | 115 | Erik |
125 | </para> | 116 | </para> |
126 | </preface> | 117 | </preface> |
diff --git a/Documentation/DocBook/procfs_example.c b/Documentation/DocBook/procfs_example.c index 7064084c1c5e..8c6396e4bf31 100644 --- a/Documentation/DocBook/procfs_example.c +++ b/Documentation/DocBook/procfs_example.c | |||
@@ -1,28 +1,16 @@ | |||
1 | /* | 1 | /* |
2 | * procfs_example.c: an example proc interface | 2 | * procfs_example.c: an example proc interface |
3 | * | 3 | * |
4 | * Copyright (C) 2001, Erik Mouw (J.A.K.Mouw@its.tudelft.nl) | 4 | * Copyright (C) 2001, Erik Mouw (mouw@nl.linux.org) |
5 | * | 5 | * |
6 | * This file accompanies the procfs-guide in the Linux kernel | 6 | * This file accompanies the procfs-guide in the Linux kernel |
7 | * source. Its main use is to demonstrate the concepts and | 7 | * source. Its main use is to demonstrate the concepts and |
8 | * functions described in the guide. | 8 | * functions described in the guide. |
9 | * | 9 | * |
10 | * This software has been developed while working on the LART | 10 | * This software has been developed while working on the LART |
11 | * computing board (http://www.lart.tudelft.nl/), which is | 11 | * computing board (http://www.lartmaker.nl), which was sponsored |
12 | * sponsored by the Mobile Multi-media Communications | 12 | * by the Delt University of Technology projects Mobile Multi-media |
13 | * (http://www.mmc.tudelft.nl/) and Ubiquitous Communications | 13 | * Communications and Ubiquitous Communications. |
14 | * (http://www.ubicom.tudelft.nl/) projects. | ||
15 | * | ||
16 | * The author can be reached at: | ||
17 | * | ||
18 | * Erik Mouw | ||
19 | * Information and Communication Theory Group | ||
20 | * Faculty of Information Technology and Systems | ||
21 | * Delft University of Technology | ||
22 | * P.O. Box 5031 | ||
23 | * 2600 GA Delft | ||
24 | * The Netherlands | ||
25 | * | ||
26 | * | 14 | * |
27 | * This program is free software; you can redistribute | 15 | * This program is free software; you can redistribute |
28 | * it and/or modify it under the terms of the GNU General | 16 | * it and/or modify it under the terms of the GNU General |
@@ -189,8 +177,6 @@ static int __init init_procfs_example(void) | |||
189 | return 0; | 177 | return 0; |
190 | 178 | ||
191 | no_symlink: | 179 | no_symlink: |
192 | remove_proc_entry("tty", example_dir); | ||
193 | no_tty: | ||
194 | remove_proc_entry("bar", example_dir); | 180 | remove_proc_entry("bar", example_dir); |
195 | no_bar: | 181 | no_bar: |
196 | remove_proc_entry("foo", example_dir); | 182 | remove_proc_entry("foo", example_dir); |
@@ -206,7 +192,6 @@ out: | |||
206 | static void __exit cleanup_procfs_example(void) | 192 | static void __exit cleanup_procfs_example(void) |
207 | { | 193 | { |
208 | remove_proc_entry("jiffies_too", example_dir); | 194 | remove_proc_entry("jiffies_too", example_dir); |
209 | remove_proc_entry("tty", example_dir); | ||
210 | remove_proc_entry("bar", example_dir); | 195 | remove_proc_entry("bar", example_dir); |
211 | remove_proc_entry("foo", example_dir); | 196 | remove_proc_entry("foo", example_dir); |
212 | remove_proc_entry("jiffies", example_dir); | 197 | remove_proc_entry("jiffies", example_dir); |
@@ -222,3 +207,4 @@ module_exit(cleanup_procfs_example); | |||
222 | 207 | ||
223 | MODULE_AUTHOR("Erik Mouw"); | 208 | MODULE_AUTHOR("Erik Mouw"); |
224 | MODULE_DESCRIPTION("procfs examples"); | 209 | MODULE_DESCRIPTION("procfs examples"); |
210 | MODULE_LICENSE("GPL"); | ||
diff --git a/Documentation/DocBook/s390-drivers.tmpl b/Documentation/DocBook/s390-drivers.tmpl index 4acc73240a6d..95bfc12e5439 100644 --- a/Documentation/DocBook/s390-drivers.tmpl +++ b/Documentation/DocBook/s390-drivers.tmpl | |||
@@ -100,7 +100,7 @@ | |||
100 | the hardware structures represented here, please consult the Principles | 100 | the hardware structures represented here, please consult the Principles |
101 | of Operation. | 101 | of Operation. |
102 | </para> | 102 | </para> |
103 | !Iinclude/asm-s390/cio.h | 103 | !Iarch/s390/include/asm/cio.h |
104 | </sect1> | 104 | </sect1> |
105 | <sect1 id="ccwdev"> | 105 | <sect1 id="ccwdev"> |
106 | <title>ccw devices</title> | 106 | <title>ccw devices</title> |
@@ -114,7 +114,7 @@ | |||
114 | ccw device structure. Device drivers must not bypass those functions | 114 | ccw device structure. Device drivers must not bypass those functions |
115 | or strange side effects may happen. | 115 | or strange side effects may happen. |
116 | </para> | 116 | </para> |
117 | !Iinclude/asm-s390/ccwdev.h | 117 | !Iarch/s390/include/asm/ccwdev.h |
118 | !Edrivers/s390/cio/device.c | 118 | !Edrivers/s390/cio/device.c |
119 | !Edrivers/s390/cio/device_ops.c | 119 | !Edrivers/s390/cio/device_ops.c |
120 | </sect1> | 120 | </sect1> |
@@ -125,7 +125,7 @@ | |||
125 | measurement data which is made available by the channel subsystem | 125 | measurement data which is made available by the channel subsystem |
126 | for each channel attached device. | 126 | for each channel attached device. |
127 | </para> | 127 | </para> |
128 | !Iinclude/asm-s390/cmb.h | 128 | !Iarch/s390/include/asm/cmb.h |
129 | !Edrivers/s390/cio/cmf.c | 129 | !Edrivers/s390/cio/cmf.c |
130 | </sect1> | 130 | </sect1> |
131 | </chapter> | 131 | </chapter> |
@@ -142,7 +142,7 @@ | |||
142 | </para> | 142 | </para> |
143 | <sect1 id="ccwgroupdevices"> | 143 | <sect1 id="ccwgroupdevices"> |
144 | <title>ccw group devices</title> | 144 | <title>ccw group devices</title> |
145 | !Iinclude/asm-s390/ccwgroup.h | 145 | !Iarch/s390/include/asm/ccwgroup.h |
146 | !Edrivers/s390/cio/ccwgroup.c | 146 | !Edrivers/s390/cio/ccwgroup.c |
147 | </sect1> | 147 | </sect1> |
148 | </chapter> | 148 | </chapter> |
diff --git a/Documentation/DocBook/sh.tmpl b/Documentation/DocBook/sh.tmpl new file mode 100644 index 000000000000..0c3dc4c69dd1 --- /dev/null +++ b/Documentation/DocBook/sh.tmpl | |||
@@ -0,0 +1,105 @@ | |||
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="sh-drivers"> | ||
6 | <bookinfo> | ||
7 | <title>SuperH Interfaces Guide</title> | ||
8 | |||
9 | <authorgroup> | ||
10 | <author> | ||
11 | <firstname>Paul</firstname> | ||
12 | <surname>Mundt</surname> | ||
13 | <affiliation> | ||
14 | <address> | ||
15 | <email>lethal@linux-sh.org</email> | ||
16 | </address> | ||
17 | </affiliation> | ||
18 | </author> | ||
19 | </authorgroup> | ||
20 | |||
21 | <copyright> | ||
22 | <year>2008</year> | ||
23 | <holder>Paul Mundt</holder> | ||
24 | </copyright> | ||
25 | <copyright> | ||
26 | <year>2008</year> | ||
27 | <holder>Renesas Technology Corp.</holder> | ||
28 | </copyright> | ||
29 | |||
30 | <legalnotice> | ||
31 | <para> | ||
32 | This documentation is free software; you can redistribute | ||
33 | it and/or modify it under the terms of the GNU General Public | ||
34 | License version 2 as published by the Free Software Foundation. | ||
35 | </para> | ||
36 | |||
37 | <para> | ||
38 | This program is distributed in the hope that it will be | ||
39 | useful, but WITHOUT ANY WARRANTY; without even the implied | ||
40 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
41 | See the GNU General Public License for more details. | ||
42 | </para> | ||
43 | |||
44 | <para> | ||
45 | You should have received a copy of the GNU General Public | ||
46 | License along with this program; if not, write to the Free | ||
47 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
48 | MA 02111-1307 USA | ||
49 | </para> | ||
50 | |||
51 | <para> | ||
52 | For more details see the file COPYING in the source | ||
53 | distribution of Linux. | ||
54 | </para> | ||
55 | </legalnotice> | ||
56 | </bookinfo> | ||
57 | |||
58 | <toc></toc> | ||
59 | |||
60 | <chapter id="mm"> | ||
61 | <title>Memory Management</title> | ||
62 | <sect1 id="sh4"> | ||
63 | <title>SH-4</title> | ||
64 | <sect2 id="sq"> | ||
65 | <title>Store Queue API</title> | ||
66 | !Earch/sh/kernel/cpu/sh4/sq.c | ||
67 | </sect2> | ||
68 | </sect1> | ||
69 | <sect1 id="sh5"> | ||
70 | <title>SH-5</title> | ||
71 | <sect2 id="tlb"> | ||
72 | <title>TLB Interfaces</title> | ||
73 | !Iarch/sh/mm/tlb-sh5.c | ||
74 | !Iarch/sh/include/asm/tlb_64.h | ||
75 | </sect2> | ||
76 | </sect1> | ||
77 | </chapter> | ||
78 | <chapter id="clk"> | ||
79 | <title>Clock Framework Extensions</title> | ||
80 | !Iarch/sh/include/asm/clock.h | ||
81 | </chapter> | ||
82 | <chapter id="mach"> | ||
83 | <title>Machine Specific Interfaces</title> | ||
84 | <sect1 id="dreamcast"> | ||
85 | <title>mach-dreamcast</title> | ||
86 | !Iarch/sh/boards/mach-dreamcast/rtc.c | ||
87 | </sect1> | ||
88 | <sect1 id="x3proto"> | ||
89 | <title>mach-x3proto</title> | ||
90 | !Earch/sh/boards/mach-x3proto/ilsel.c | ||
91 | </sect1> | ||
92 | </chapter> | ||
93 | <chapter id="busses"> | ||
94 | <title>Busses</title> | ||
95 | <sect1 id="superhyway"> | ||
96 | <title>SuperHyway</title> | ||
97 | !Edrivers/sh/superhyway/superhyway.c | ||
98 | </sect1> | ||
99 | |||
100 | <sect1 id="maple"> | ||
101 | <title>Maple</title> | ||
102 | !Edrivers/sh/maple/maple.c | ||
103 | </sect1> | ||
104 | </chapter> | ||
105 | </book> | ||
diff --git a/Documentation/DocBook/uio-howto.tmpl b/Documentation/DocBook/uio-howto.tmpl index fdd7f4f887b7..df87d1b93605 100644 --- a/Documentation/DocBook/uio-howto.tmpl +++ b/Documentation/DocBook/uio-howto.tmpl | |||
@@ -21,6 +21,18 @@ | |||
21 | </affiliation> | 21 | </affiliation> |
22 | </author> | 22 | </author> |
23 | 23 | ||
24 | <copyright> | ||
25 | <year>2006-2008</year> | ||
26 | <holder>Hans-Jürgen Koch.</holder> | ||
27 | </copyright> | ||
28 | |||
29 | <legalnotice> | ||
30 | <para> | ||
31 | This documentation is Free Software licensed under the terms of the | ||
32 | GPL version 2. | ||
33 | </para> | ||
34 | </legalnotice> | ||
35 | |||
24 | <pubdate>2006-12-11</pubdate> | 36 | <pubdate>2006-12-11</pubdate> |
25 | 37 | ||
26 | <abstract> | 38 | <abstract> |
@@ -30,6 +42,12 @@ | |||
30 | 42 | ||
31 | <revhistory> | 43 | <revhistory> |
32 | <revision> | 44 | <revision> |
45 | <revnumber>0.5</revnumber> | ||
46 | <date>2008-05-22</date> | ||
47 | <authorinitials>hjk</authorinitials> | ||
48 | <revremark>Added description of write() function.</revremark> | ||
49 | </revision> | ||
50 | <revision> | ||
33 | <revnumber>0.4</revnumber> | 51 | <revnumber>0.4</revnumber> |
34 | <date>2007-11-26</date> | 52 | <date>2007-11-26</date> |
35 | <authorinitials>hjk</authorinitials> | 53 | <authorinitials>hjk</authorinitials> |
@@ -57,20 +75,9 @@ | |||
57 | </bookinfo> | 75 | </bookinfo> |
58 | 76 | ||
59 | <chapter id="aboutthisdoc"> | 77 | <chapter id="aboutthisdoc"> |
60 | <?dbhtml filename="about.html"?> | 78 | <?dbhtml filename="aboutthis.html"?> |
61 | <title>About this document</title> | 79 | <title>About this document</title> |
62 | 80 | ||
63 | <sect1 id="copyright"> | ||
64 | <?dbhtml filename="copyright.html"?> | ||
65 | <title>Copyright and License</title> | ||
66 | <para> | ||
67 | Copyright (c) 2006 by Hans-Jürgen Koch.</para> | ||
68 | <para> | ||
69 | This documentation is Free Software licensed under the terms of the | ||
70 | GPL version 2. | ||
71 | </para> | ||
72 | </sect1> | ||
73 | |||
74 | <sect1 id="translations"> | 81 | <sect1 id="translations"> |
75 | <?dbhtml filename="translations.html"?> | 82 | <?dbhtml filename="translations.html"?> |
76 | <title>Translations</title> | 83 | <title>Translations</title> |
@@ -189,6 +196,30 @@ interested in translating it, please email me | |||
189 | represents the total interrupt count. You can use this number | 196 | represents the total interrupt count. You can use this number |
190 | to figure out if you missed some interrupts. | 197 | to figure out if you missed some interrupts. |
191 | </para> | 198 | </para> |
199 | <para> | ||
200 | For some hardware that has more than one interrupt source internally, | ||
201 | but not separate IRQ mask and status registers, there might be | ||
202 | situations where userspace cannot determine what the interrupt source | ||
203 | was if the kernel handler disables them by writing to the chip's IRQ | ||
204 | register. In such a case, the kernel has to disable the IRQ completely | ||
205 | to leave the chip's register untouched. Now the userspace part can | ||
206 | determine the cause of the interrupt, but it cannot re-enable | ||
207 | interrupts. Another cornercase is chips where re-enabling interrupts | ||
208 | is a read-modify-write operation to a combined IRQ status/acknowledge | ||
209 | register. This would be racy if a new interrupt occurred | ||
210 | simultaneously. | ||
211 | </para> | ||
212 | <para> | ||
213 | To address these problems, UIO also implements a write() function. It | ||
214 | is normally not used and can be ignored for hardware that has only a | ||
215 | single interrupt source or has separate IRQ mask and status registers. | ||
216 | If you need it, however, a write to <filename>/dev/uioX</filename> | ||
217 | will call the <function>irqcontrol()</function> function implemented | ||
218 | by the driver. You have to write a 32-bit value that is usually either | ||
219 | 0 or 1 to disable or enable interrupts. If a driver does not implement | ||
220 | <function>irqcontrol()</function>, <function>write()</function> will | ||
221 | return with <varname>-ENOSYS</varname>. | ||
222 | </para> | ||
192 | 223 | ||
193 | <para> | 224 | <para> |
194 | To handle interrupts properly, your custom kernel module can | 225 | To handle interrupts properly, your custom kernel module can |
@@ -362,6 +393,14 @@ device is actually used. | |||
362 | <function>open()</function>, you will probably also want a custom | 393 | <function>open()</function>, you will probably also want a custom |
363 | <function>release()</function> function. | 394 | <function>release()</function> function. |
364 | </para></listitem> | 395 | </para></listitem> |
396 | |||
397 | <listitem><para> | ||
398 | <varname>int (*irqcontrol)(struct uio_info *info, s32 irq_on) | ||
399 | </varname>: Optional. If you need to be able to enable or disable | ||
400 | interrupts from userspace by writing to <filename>/dev/uioX</filename>, | ||
401 | you can implement this function. The parameter <varname>irq_on</varname> | ||
402 | will be 0 to disable interrupts and 1 to enable them. | ||
403 | </para></listitem> | ||
365 | </itemizedlist> | 404 | </itemizedlist> |
366 | 405 | ||
367 | <para> | 406 | <para> |
diff --git a/Documentation/DocBook/videobook.tmpl b/Documentation/DocBook/videobook.tmpl deleted file mode 100644 index 89817795e668..000000000000 --- a/Documentation/DocBook/videobook.tmpl +++ /dev/null | |||
@@ -1,1654 +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="V4LGuide"> | ||
6 | <bookinfo> | ||
7 | <title>Video4Linux Programming</title> | ||
8 | |||
9 | <authorgroup> | ||
10 | <author> | ||
11 | <firstname>Alan</firstname> | ||
12 | <surname>Cox</surname> | ||
13 | <affiliation> | ||
14 | <address> | ||
15 | <email>alan@redhat.com</email> | ||
16 | </address> | ||
17 | </affiliation> | ||
18 | </author> | ||
19 | </authorgroup> | ||
20 | |||
21 | <copyright> | ||
22 | <year>2000</year> | ||
23 | <holder>Alan Cox</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 | </legalnotice> | ||
54 | </bookinfo> | ||
55 | |||
56 | <toc></toc> | ||
57 | |||
58 | <chapter id="intro"> | ||
59 | <title>Introduction</title> | ||
60 | <para> | ||
61 | Parts of this document first appeared in Linux Magazine under a | ||
62 | ninety day exclusivity. | ||
63 | </para> | ||
64 | <para> | ||
65 | Video4Linux is intended to provide a common programming interface | ||
66 | for the many TV and capture cards now on the market, as well as | ||
67 | parallel port and USB video cameras. Radio, teletext decoders and | ||
68 | vertical blanking data interfaces are also provided. | ||
69 | </para> | ||
70 | </chapter> | ||
71 | <chapter id="radio"> | ||
72 | <title>Radio Devices</title> | ||
73 | <para> | ||
74 | There are a wide variety of radio interfaces available for PC's, and these | ||
75 | are generally very simple to program. The biggest problem with supporting | ||
76 | such devices is normally extracting documentation from the vendor. | ||
77 | </para> | ||
78 | <para> | ||
79 | The radio interface supports a simple set of control ioctls standardised | ||
80 | across all radio and tv interfaces. It does not support read or write, which | ||
81 | are used for video streams. The reason radio cards do not allow you to read | ||
82 | the audio stream into an application is that without exception they provide | ||
83 | a connection on to a soundcard. Soundcards can be used to read the radio | ||
84 | data just fine. | ||
85 | </para> | ||
86 | <sect1 id="registerradio"> | ||
87 | <title>Registering Radio Devices</title> | ||
88 | <para> | ||
89 | The Video4linux core provides an interface for registering devices. The | ||
90 | first step in writing our radio card driver is to register it. | ||
91 | </para> | ||
92 | <programlisting> | ||
93 | |||
94 | |||
95 | static struct video_device my_radio | ||
96 | { | ||
97 | "My radio", | ||
98 | VID_TYPE_TUNER, | ||
99 | radio_open. | ||
100 | radio_close, | ||
101 | NULL, /* no read */ | ||
102 | NULL, /* no write */ | ||
103 | NULL, /* no poll */ | ||
104 | radio_ioctl, | ||
105 | NULL, /* no special init function */ | ||
106 | NULL /* no private data */ | ||
107 | }; | ||
108 | |||
109 | |||
110 | </programlisting> | ||
111 | <para> | ||
112 | This declares our video4linux device driver interface. The VID_TYPE_ value | ||
113 | defines what kind of an interface we are, and defines basic capabilities. | ||
114 | </para> | ||
115 | <para> | ||
116 | The only defined value relevant for a radio card is VID_TYPE_TUNER which | ||
117 | indicates that the device can be tuned. Clearly our radio is going to have some | ||
118 | way to change channel so it is tuneable. | ||
119 | </para> | ||
120 | <para> | ||
121 | We declare an open and close routine, but we do not need read or write, | ||
122 | which are used to read and write video data to or from the card itself. As | ||
123 | we have no read or write there is no poll function. | ||
124 | </para> | ||
125 | <para> | ||
126 | The private initialise function is run when the device is registered. In | ||
127 | this driver we've already done all the work needed. The final pointer is a | ||
128 | private data pointer that can be used by the device driver to attach and | ||
129 | retrieve private data structures. We set this field "priv" to NULL for | ||
130 | the moment. | ||
131 | </para> | ||
132 | <para> | ||
133 | Having the structure defined is all very well but we now need to register it | ||
134 | with the kernel. | ||
135 | </para> | ||
136 | <programlisting> | ||
137 | |||
138 | |||
139 | static int io = 0x320; | ||
140 | |||
141 | int __init myradio_init(struct video_init *v) | ||
142 | { | ||
143 | if(!request_region(io, MY_IO_SIZE, "myradio")) | ||
144 | { | ||
145 | printk(KERN_ERR | ||
146 | "myradio: port 0x%03X is in use.\n", io); | ||
147 | return -EBUSY; | ||
148 | } | ||
149 | |||
150 | if(video_device_register(&my_radio, VFL_TYPE_RADIO)==-1) { | ||
151 | release_region(io, MY_IO_SIZE); | ||
152 | return -EINVAL; | ||
153 | } | ||
154 | return 0; | ||
155 | } | ||
156 | |||
157 | </programlisting> | ||
158 | <para> | ||
159 | The first stage of the initialisation, as is normally the case, is to check | ||
160 | that the I/O space we are about to fiddle with doesn't belong to some other | ||
161 | driver. If it is we leave well alone. If the user gives the address of the | ||
162 | wrong device then we will spot this. These policies will generally avoid | ||
163 | crashing the machine. | ||
164 | </para> | ||
165 | <para> | ||
166 | Now we ask the Video4Linux layer to register the device for us. We hand it | ||
167 | our carefully designed video_device structure and also tell it which group | ||
168 | of devices we want it registered with. In this case VFL_TYPE_RADIO. | ||
169 | </para> | ||
170 | <para> | ||
171 | The types available are | ||
172 | </para> | ||
173 | <table frame="all" id="Device_Types"><title>Device Types</title> | ||
174 | <tgroup cols="3" align="left"> | ||
175 | <tbody> | ||
176 | <row> | ||
177 | <entry>VFL_TYPE_RADIO</entry><entry>/dev/radio{n}</entry><entry> | ||
178 | |||
179 | Radio devices are assigned in this block. As with all of these | ||
180 | selections the actual number assignment is done by the video layer | ||
181 | accordijng to what is free.</entry> | ||
182 | </row><row> | ||
183 | <entry>VFL_TYPE_GRABBER</entry><entry>/dev/video{n}</entry><entry> | ||
184 | Video capture devices and also -- counter-intuitively for the name -- | ||
185 | hardware video playback devices such as MPEG2 cards.</entry> | ||
186 | </row><row> | ||
187 | <entry>VFL_TYPE_VBI</entry><entry>/dev/vbi{n}</entry><entry> | ||
188 | The VBI devices capture the hidden lines on a television picture | ||
189 | that carry further information like closed caption data, teletext | ||
190 | (primarily in Europe) and now Intercast and the ATVEC internet | ||
191 | television encodings.</entry> | ||
192 | </row><row> | ||
193 | <entry>VFL_TYPE_VTX</entry><entry>/dev/vtx[n}</entry><entry> | ||
194 | VTX is 'Videotext' also known as 'Teletext'. This is a system for | ||
195 | sending numbered, 40x25, mostly textual page images over the hidden | ||
196 | lines. Unlike the /dev/vbi interfaces, this is for 'smart' decoder | ||
197 | chips. (The use of the word smart here has to be taken in context, | ||
198 | the smartest teletext chips are fairly dumb pieces of technology). | ||
199 | </entry> | ||
200 | </row> | ||
201 | </tbody> | ||
202 | </tgroup> | ||
203 | </table> | ||
204 | <para> | ||
205 | We are most definitely a radio. | ||
206 | </para> | ||
207 | <para> | ||
208 | Finally we allocate our I/O space so that nobody treads on us and return 0 | ||
209 | to signify general happiness with the state of the universe. | ||
210 | </para> | ||
211 | </sect1> | ||
212 | <sect1 id="openradio"> | ||
213 | <title>Opening And Closing The Radio</title> | ||
214 | |||
215 | <para> | ||
216 | The functions we declared in our video_device are mostly very simple. | ||
217 | Firstly we can drop in what is basically standard code for open and close. | ||
218 | </para> | ||
219 | <programlisting> | ||
220 | |||
221 | |||
222 | static int users = 0; | ||
223 | |||
224 | static int radio_open(struct video_device *dev, int flags) | ||
225 | { | ||
226 | if(users) | ||
227 | return -EBUSY; | ||
228 | users++; | ||
229 | return 0; | ||
230 | } | ||
231 | |||
232 | </programlisting> | ||
233 | <para> | ||
234 | At open time we need to do nothing but check if someone else is also using | ||
235 | the radio card. If nobody is using it we make a note that we are using it, | ||
236 | then we ensure that nobody unloads our driver on us. | ||
237 | </para> | ||
238 | <programlisting> | ||
239 | |||
240 | |||
241 | static int radio_close(struct video_device *dev) | ||
242 | { | ||
243 | users--; | ||
244 | } | ||
245 | |||
246 | </programlisting> | ||
247 | <para> | ||
248 | At close time we simply need to reduce the user count and allow the module | ||
249 | to become unloadable. | ||
250 | </para> | ||
251 | <para> | ||
252 | If you are sharp you will have noticed neither the open nor the close | ||
253 | routines attempt to reset or change the radio settings. This is intentional. | ||
254 | It allows an application to set up the radio and exit. It avoids a user | ||
255 | having to leave an application running all the time just to listen to the | ||
256 | radio. | ||
257 | </para> | ||
258 | </sect1> | ||
259 | <sect1 id="ioctlradio"> | ||
260 | <title>The Ioctl Interface</title> | ||
261 | <para> | ||
262 | This leaves the ioctl routine, without which the driver will not be | ||
263 | terribly useful to anyone. | ||
264 | </para> | ||
265 | <programlisting> | ||
266 | |||
267 | |||
268 | static int radio_ioctl(struct video_device *dev, unsigned int cmd, void *arg) | ||
269 | { | ||
270 | switch(cmd) | ||
271 | { | ||
272 | case VIDIOCGCAP: | ||
273 | { | ||
274 | struct video_capability v; | ||
275 | v.type = VID_TYPE_TUNER; | ||
276 | v.channels = 1; | ||
277 | v.audios = 1; | ||
278 | v.maxwidth = 0; | ||
279 | v.minwidth = 0; | ||
280 | v.maxheight = 0; | ||
281 | v.minheight = 0; | ||
282 | strcpy(v.name, "My Radio"); | ||
283 | if(copy_to_user(arg, &v, sizeof(v))) | ||
284 | return -EFAULT; | ||
285 | return 0; | ||
286 | } | ||
287 | |||
288 | </programlisting> | ||
289 | <para> | ||
290 | VIDIOCGCAP is the first ioctl all video4linux devices must support. It | ||
291 | allows the applications to find out what sort of a card they have found and | ||
292 | to figure out what they want to do about it. The fields in the structure are | ||
293 | </para> | ||
294 | <table frame="all" id="video_capability_fields"><title>struct video_capability fields</title> | ||
295 | <tgroup cols="2" align="left"> | ||
296 | <tbody> | ||
297 | <row> | ||
298 | <entry>name</entry><entry>The device text name. This is intended for the user.</entry> | ||
299 | </row><row> | ||
300 | <entry>channels</entry><entry>The number of different channels you can tune on | ||
301 | this card. It could even by zero for a card that has | ||
302 | no tuning capability. For our simple FM radio it is 1. | ||
303 | An AM/FM radio would report 2.</entry> | ||
304 | </row><row> | ||
305 | <entry>audios</entry><entry>The number of audio inputs on this device. For our | ||
306 | radio there is only one audio input.</entry> | ||
307 | </row><row> | ||
308 | <entry>minwidth,minheight</entry><entry>The smallest size the card is capable of capturing | ||
309 | images in. We set these to zero. Radios do not | ||
310 | capture pictures</entry> | ||
311 | </row><row> | ||
312 | <entry>maxwidth,maxheight</entry><entry>The largest image size the card is capable of | ||
313 | capturing. For our radio we report 0. | ||
314 | </entry> | ||
315 | </row><row> | ||
316 | <entry>type</entry><entry>This reports the capabilities of the device, and | ||
317 | matches the field we filled in in the struct | ||
318 | video_device when registering.</entry> | ||
319 | </row> | ||
320 | </tbody> | ||
321 | </tgroup> | ||
322 | </table> | ||
323 | <para> | ||
324 | Having filled in the fields, we use copy_to_user to copy the structure into | ||
325 | the users buffer. If the copy fails we return an EFAULT to the application | ||
326 | so that it knows it tried to feed us garbage. | ||
327 | </para> | ||
328 | <para> | ||
329 | The next pair of ioctl operations select which tuner is to be used and let | ||
330 | the application find the tuner properties. We have only a single FM band | ||
331 | tuner in our example device. | ||
332 | </para> | ||
333 | <programlisting> | ||
334 | |||
335 | |||
336 | case VIDIOCGTUNER: | ||
337 | { | ||
338 | struct video_tuner v; | ||
339 | if(copy_from_user(&v, arg, sizeof(v))!=0) | ||
340 | return -EFAULT; | ||
341 | if(v.tuner) | ||
342 | return -EINVAL; | ||
343 | v.rangelow=(87*16000); | ||
344 | v.rangehigh=(108*16000); | ||
345 | v.flags = VIDEO_TUNER_LOW; | ||
346 | v.mode = VIDEO_MODE_AUTO; | ||
347 | v.signal = 0xFFFF; | ||
348 | strcpy(v.name, "FM"); | ||
349 | if(copy_to_user(&v, arg, sizeof(v))!=0) | ||
350 | return -EFAULT; | ||
351 | return 0; | ||
352 | } | ||
353 | |||
354 | </programlisting> | ||
355 | <para> | ||
356 | The VIDIOCGTUNER ioctl allows applications to query a tuner. The application | ||
357 | sets the tuner field to the tuner number it wishes to query. The query does | ||
358 | not change the tuner that is being used, it merely enquires about the tuner | ||
359 | in question. | ||
360 | </para> | ||
361 | <para> | ||
362 | We have exactly one tuner so after copying the user buffer to our temporary | ||
363 | structure we complain if they asked for a tuner other than tuner 0. | ||
364 | </para> | ||
365 | <para> | ||
366 | The video_tuner structure has the following fields | ||
367 | </para> | ||
368 | <table frame="all" id="video_tuner_fields"><title>struct video_tuner fields</title> | ||
369 | <tgroup cols="2" align="left"> | ||
370 | <tbody> | ||
371 | <row> | ||
372 | <entry>int tuner</entry><entry>The number of the tuner in question</entry> | ||
373 | </row><row> | ||
374 | <entry>char name[32]</entry><entry>A text description of this tuner. "FM" will do fine. | ||
375 | This is intended for the application.</entry> | ||
376 | </row><row> | ||
377 | <entry>u32 flags</entry> | ||
378 | <entry>Tuner capability flags</entry> | ||
379 | </row> | ||
380 | <row> | ||
381 | <entry>u16 mode</entry><entry>The current reception mode</entry> | ||
382 | |||
383 | </row><row> | ||
384 | <entry>u16 signal</entry><entry>The signal strength scaled between 0 and 65535. If | ||
385 | a device cannot tell the signal strength it should | ||
386 | report 65535. Many simple cards contain only a | ||
387 | signal/no signal bit. Such cards will report either | ||
388 | 0 or 65535.</entry> | ||
389 | |||
390 | </row><row> | ||
391 | <entry>u32 rangelow, rangehigh</entry><entry> | ||
392 | The range of frequencies supported by the radio | ||
393 | or TV. It is scaled according to the VIDEO_TUNER_LOW | ||
394 | flag.</entry> | ||
395 | |||
396 | </row> | ||
397 | </tbody> | ||
398 | </tgroup> | ||
399 | </table> | ||
400 | |||
401 | <table frame="all" id="video_tuner_flags"><title>struct video_tuner flags</title> | ||
402 | <tgroup cols="2" align="left"> | ||
403 | <tbody> | ||
404 | <row> | ||
405 | <entry>VIDEO_TUNER_PAL</entry><entry>A PAL TV tuner</entry> | ||
406 | </row><row> | ||
407 | <entry>VIDEO_TUNER_NTSC</entry><entry>An NTSC (US) TV tuner</entry> | ||
408 | </row><row> | ||
409 | <entry>VIDEO_TUNER_SECAM</entry><entry>A SECAM (French) TV tuner</entry> | ||
410 | </row><row> | ||
411 | <entry>VIDEO_TUNER_LOW</entry><entry> | ||
412 | The tuner frequency is scaled in 1/16th of a KHz | ||
413 | steps. If not it is in 1/16th of a MHz steps | ||
414 | </entry> | ||
415 | </row><row> | ||
416 | <entry>VIDEO_TUNER_NORM</entry><entry>The tuner can set its format</entry> | ||
417 | </row><row> | ||
418 | <entry>VIDEO_TUNER_STEREO_ON</entry><entry>The tuner is currently receiving a stereo signal</entry> | ||
419 | </row> | ||
420 | </tbody> | ||
421 | </tgroup> | ||
422 | </table> | ||
423 | |||
424 | <table frame="all" id="video_tuner_modes"><title>struct video_tuner modes</title> | ||
425 | <tgroup cols="2" align="left"> | ||
426 | <tbody> | ||
427 | <row> | ||
428 | <entry>VIDEO_MODE_PAL</entry><entry>PAL Format</entry> | ||
429 | </row><row> | ||
430 | <entry>VIDEO_MODE_NTSC</entry><entry>NTSC Format (USA)</entry> | ||
431 | </row><row> | ||
432 | <entry>VIDEO_MODE_SECAM</entry><entry>French Format</entry> | ||
433 | </row><row> | ||
434 | <entry>VIDEO_MODE_AUTO</entry><entry>A device that does not need to do | ||
435 | TV format switching</entry> | ||
436 | </row> | ||
437 | </tbody> | ||
438 | </tgroup> | ||
439 | </table> | ||
440 | <para> | ||
441 | The settings for the radio card are thus fairly simple. We report that we | ||
442 | are a tuner called "FM" for FM radio. In order to get the best tuning | ||
443 | resolution we report VIDEO_TUNER_LOW and select tuning to 1/16th of KHz. Its | ||
444 | unlikely our card can do that resolution but it is a fair bet the card can | ||
445 | do better than 1/16th of a MHz. VIDEO_TUNER_LOW is appropriate to almost all | ||
446 | radio usage. | ||
447 | </para> | ||
448 | <para> | ||
449 | We report that the tuner automatically handles deciding what format it is | ||
450 | receiving - true enough as it only handles FM radio. Our example card is | ||
451 | also incapable of detecting stereo or signal strengths so it reports a | ||
452 | strength of 0xFFFF (maximum) and no stereo detected. | ||
453 | </para> | ||
454 | <para> | ||
455 | To finish off we set the range that can be tuned to be 87-108Mhz, the normal | ||
456 | FM broadcast radio range. It is important to find out what the card is | ||
457 | actually capable of tuning. It is easy enough to simply use the FM broadcast | ||
458 | range. Unfortunately if you do this you will discover the FM broadcast | ||
459 | ranges in the USA, Europe and Japan are all subtly different and some users | ||
460 | cannot receive all the stations they wish. | ||
461 | </para> | ||
462 | <para> | ||
463 | The application also needs to be able to set the tuner it wishes to use. In | ||
464 | our case, with a single tuner this is rather simple to arrange. | ||
465 | </para> | ||
466 | <programlisting> | ||
467 | |||
468 | case VIDIOCSTUNER: | ||
469 | { | ||
470 | struct video_tuner v; | ||
471 | if(copy_from_user(&v, arg, sizeof(v))) | ||
472 | return -EFAULT; | ||
473 | if(v.tuner != 0) | ||
474 | return -EINVAL; | ||
475 | return 0; | ||
476 | } | ||
477 | |||
478 | </programlisting> | ||
479 | <para> | ||
480 | We copy the user supplied structure into kernel memory so we can examine it. | ||
481 | If the user has selected a tuner other than zero we reject the request. If | ||
482 | they wanted tuner 0 then, surprisingly enough, that is the current tuner already. | ||
483 | </para> | ||
484 | <para> | ||
485 | The next two ioctls we need to provide are to get and set the frequency of | ||
486 | the radio. These both use an unsigned long argument which is the frequency. | ||
487 | The scale of the frequency depends on the VIDEO_TUNER_LOW flag as I | ||
488 | mentioned earlier on. Since we have VIDEO_TUNER_LOW set this will be in | ||
489 | 1/16ths of a KHz. | ||
490 | </para> | ||
491 | <programlisting> | ||
492 | |||
493 | static unsigned long current_freq; | ||
494 | |||
495 | |||
496 | |||
497 | case VIDIOCGFREQ: | ||
498 | if(copy_to_user(arg, &current_freq, | ||
499 | sizeof(unsigned long)) | ||
500 | return -EFAULT; | ||
501 | return 0; | ||
502 | |||
503 | </programlisting> | ||
504 | <para> | ||
505 | Querying the frequency in our case is relatively simple. Our radio card is | ||
506 | too dumb to let us query the signal strength so we remember our setting if | ||
507 | we know it. All we have to do is copy it to the user. | ||
508 | </para> | ||
509 | <programlisting> | ||
510 | |||
511 | |||
512 | case VIDIOCSFREQ: | ||
513 | { | ||
514 | u32 freq; | ||
515 | if(copy_from_user(arg, &freq, | ||
516 | sizeof(unsigned long))!=0) | ||
517 | return -EFAULT; | ||
518 | if(hardware_set_freq(freq)<0) | ||
519 | return -EINVAL; | ||
520 | current_freq = freq; | ||
521 | return 0; | ||
522 | } | ||
523 | |||
524 | </programlisting> | ||
525 | <para> | ||
526 | Setting the frequency is a little more complex. We begin by copying the | ||
527 | desired frequency into kernel space. Next we call a hardware specific routine | ||
528 | to set the radio up. This might be as simple as some scaling and a few | ||
529 | writes to an I/O port. For most radio cards it turns out a good deal more | ||
530 | complicated and may involve programming things like a phase locked loop on | ||
531 | the card. This is what documentation is for. | ||
532 | </para> | ||
533 | <para> | ||
534 | The final set of operations we need to provide for our radio are the | ||
535 | volume controls. Not all radio cards can even do volume control. After all | ||
536 | there is a perfectly good volume control on the sound card. We will assume | ||
537 | our radio card has a simple 4 step volume control. | ||
538 | </para> | ||
539 | <para> | ||
540 | There are two ioctls with audio we need to support | ||
541 | </para> | ||
542 | <programlisting> | ||
543 | |||
544 | static int current_volume=0; | ||
545 | |||
546 | case VIDIOCGAUDIO: | ||
547 | { | ||
548 | struct video_audio v; | ||
549 | if(copy_from_user(&v, arg, sizeof(v))) | ||
550 | return -EFAULT; | ||
551 | if(v.audio != 0) | ||
552 | return -EINVAL; | ||
553 | v.volume = 16384*current_volume; | ||
554 | v.step = 16384; | ||
555 | strcpy(v.name, "Radio"); | ||
556 | v.mode = VIDEO_SOUND_MONO; | ||
557 | v.balance = 0; | ||
558 | v.base = 0; | ||
559 | v.treble = 0; | ||
560 | |||
561 | if(copy_to_user(arg. &v, sizeof(v))) | ||
562 | return -EFAULT; | ||
563 | return 0; | ||
564 | } | ||
565 | |||
566 | </programlisting> | ||
567 | <para> | ||
568 | Much like the tuner we start by copying the user structure into kernel | ||
569 | space. Again we check if the user has asked for a valid audio input. We have | ||
570 | only input 0 and we punt if they ask for another input. | ||
571 | </para> | ||
572 | <para> | ||
573 | Then we fill in the video_audio structure. This has the following format | ||
574 | </para> | ||
575 | <table frame="all" id="video_audio_fields"><title>struct video_audio fields</title> | ||
576 | <tgroup cols="2" align="left"> | ||
577 | <tbody> | ||
578 | <row> | ||
579 | <entry>audio</entry><entry>The input the user wishes to query</entry> | ||
580 | </row><row> | ||
581 | <entry>volume</entry><entry>The volume setting on a scale of 0-65535</entry> | ||
582 | </row><row> | ||
583 | <entry>base</entry><entry>The base level on a scale of 0-65535</entry> | ||
584 | </row><row> | ||
585 | <entry>treble</entry><entry>The treble level on a scale of 0-65535</entry> | ||
586 | </row><row> | ||
587 | <entry>flags</entry><entry>The features this audio device supports | ||
588 | </entry> | ||
589 | </row><row> | ||
590 | <entry>name</entry><entry>A text name to display to the user. We picked | ||
591 | "Radio" as it explains things quite nicely.</entry> | ||
592 | </row><row> | ||
593 | <entry>mode</entry><entry>The current reception mode for the audio | ||
594 | |||
595 | We report MONO because our card is too stupid to know if it is in | ||
596 | mono or stereo. | ||
597 | </entry> | ||
598 | </row><row> | ||
599 | <entry>balance</entry><entry>The stereo balance on a scale of 0-65535, 32768 is | ||
600 | middle.</entry> | ||
601 | </row><row> | ||
602 | <entry>step</entry><entry>The step by which the volume control jumps. This is | ||
603 | used to help make it easy for applications to set | ||
604 | slider behaviour.</entry> | ||
605 | </row> | ||
606 | </tbody> | ||
607 | </tgroup> | ||
608 | </table> | ||
609 | |||
610 | <table frame="all" id="video_audio_flags"><title>struct video_audio flags</title> | ||
611 | <tgroup cols="2" align="left"> | ||
612 | <tbody> | ||
613 | <row> | ||
614 | <entry>VIDEO_AUDIO_MUTE</entry><entry>The audio is currently muted. We | ||
615 | could fake this in our driver but we | ||
616 | choose not to bother.</entry> | ||
617 | </row><row> | ||
618 | <entry>VIDEO_AUDIO_MUTABLE</entry><entry>The input has a mute option</entry> | ||
619 | </row><row> | ||
620 | <entry>VIDEO_AUDIO_TREBLE</entry><entry>The input has a treble control</entry> | ||
621 | </row><row> | ||
622 | <entry>VIDEO_AUDIO_BASS</entry><entry>The input has a base control</entry> | ||
623 | </row> | ||
624 | </tbody> | ||
625 | </tgroup> | ||
626 | </table> | ||
627 | |||
628 | <table frame="all" id="video_audio_modes"><title>struct video_audio modes</title> | ||
629 | <tgroup cols="2" align="left"> | ||
630 | <tbody> | ||
631 | <row> | ||
632 | <entry>VIDEO_SOUND_MONO</entry><entry>Mono sound</entry> | ||
633 | </row><row> | ||
634 | <entry>VIDEO_SOUND_STEREO</entry><entry>Stereo sound</entry> | ||
635 | </row><row> | ||
636 | <entry>VIDEO_SOUND_LANG1</entry><entry>Alternative language 1 (TV specific)</entry> | ||
637 | </row><row> | ||
638 | <entry>VIDEO_SOUND_LANG2</entry><entry>Alternative language 2 (TV specific)</entry> | ||
639 | </row> | ||
640 | </tbody> | ||
641 | </tgroup> | ||
642 | </table> | ||
643 | <para> | ||
644 | Having filled in the structure we copy it back to user space. | ||
645 | </para> | ||
646 | <para> | ||
647 | The VIDIOCSAUDIO ioctl allows the user to set the audio parameters in the | ||
648 | video_audio structure. The driver does its best to honour the request. | ||
649 | </para> | ||
650 | <programlisting> | ||
651 | |||
652 | case VIDIOCSAUDIO: | ||
653 | { | ||
654 | struct video_audio v; | ||
655 | if(copy_from_user(&v, arg, sizeof(v))) | ||
656 | return -EFAULT; | ||
657 | if(v.audio) | ||
658 | return -EINVAL; | ||
659 | current_volume = v/16384; | ||
660 | hardware_set_volume(current_volume); | ||
661 | return 0; | ||
662 | } | ||
663 | |||
664 | </programlisting> | ||
665 | <para> | ||
666 | In our case there is very little that the user can set. The volume is | ||
667 | basically the limit. Note that we could pretend to have a mute feature | ||
668 | by rewriting this to | ||
669 | </para> | ||
670 | <programlisting> | ||
671 | |||
672 | case VIDIOCSAUDIO: | ||
673 | { | ||
674 | struct video_audio v; | ||
675 | if(copy_from_user(&v, arg, sizeof(v))) | ||
676 | return -EFAULT; | ||
677 | if(v.audio) | ||
678 | return -EINVAL; | ||
679 | current_volume = v/16384; | ||
680 | if(v.flags&VIDEO_AUDIO_MUTE) | ||
681 | hardware_set_volume(0); | ||
682 | else | ||
683 | hardware_set_volume(current_volume); | ||
684 | current_muted = v.flags & | ||
685 | VIDEO_AUDIO_MUTE; | ||
686 | return 0; | ||
687 | } | ||
688 | |||
689 | </programlisting> | ||
690 | <para> | ||
691 | This with the corresponding changes to the VIDIOCGAUDIO code to report the | ||
692 | state of the mute flag we save and to report the card has a mute function, | ||
693 | will allow applications to use a mute facility with this card. It is | ||
694 | questionable whether this is a good idea however. User applications can already | ||
695 | fake this themselves and kernel space is precious. | ||
696 | </para> | ||
697 | <para> | ||
698 | We now have a working radio ioctl handler. So we just wrap up the function | ||
699 | </para> | ||
700 | <programlisting> | ||
701 | |||
702 | |||
703 | } | ||
704 | return -ENOIOCTLCMD; | ||
705 | } | ||
706 | |||
707 | </programlisting> | ||
708 | <para> | ||
709 | and pass the Video4Linux layer back an error so that it knows we did not | ||
710 | understand the request we got passed. | ||
711 | </para> | ||
712 | </sect1> | ||
713 | <sect1 id="modradio"> | ||
714 | <title>Module Wrapper</title> | ||
715 | <para> | ||
716 | Finally we add in the usual module wrapping and the driver is done. | ||
717 | </para> | ||
718 | <programlisting> | ||
719 | |||
720 | #ifndef MODULE | ||
721 | |||
722 | static int io = 0x300; | ||
723 | |||
724 | #else | ||
725 | |||
726 | static int io = -1; | ||
727 | |||
728 | #endif | ||
729 | |||
730 | MODULE_AUTHOR("Alan Cox"); | ||
731 | MODULE_DESCRIPTION("A driver for an imaginary radio card."); | ||
732 | module_param(io, int, 0444); | ||
733 | MODULE_PARM_DESC(io, "I/O address of the card."); | ||
734 | |||
735 | static int __init init(void) | ||
736 | { | ||
737 | if(io==-1) | ||
738 | { | ||
739 | printk(KERN_ERR | ||
740 | "You must set an I/O address with io=0x???\n"); | ||
741 | return -EINVAL; | ||
742 | } | ||
743 | return myradio_init(NULL); | ||
744 | } | ||
745 | |||
746 | static void __exit cleanup(void) | ||
747 | { | ||
748 | video_unregister_device(&my_radio); | ||
749 | release_region(io, MY_IO_SIZE); | ||
750 | } | ||
751 | |||
752 | module_init(init); | ||
753 | module_exit(cleanup); | ||
754 | |||
755 | </programlisting> | ||
756 | <para> | ||
757 | In this example we set the IO base by default if the driver is compiled into | ||
758 | the kernel: you can still set it using "my_radio.irq" if this file is called <filename>my_radio.c</filename>. For the module we require the | ||
759 | user sets the parameter. We set io to a nonsense port (-1) so that we can | ||
760 | tell if the user supplied an io parameter or not. | ||
761 | </para> | ||
762 | <para> | ||
763 | We use MODULE_ defines to give an author for the card driver and a | ||
764 | description. We also use them to declare that io is an integer and it is the | ||
765 | address of the card, and can be read by anyone from sysfs. | ||
766 | </para> | ||
767 | <para> | ||
768 | The clean-up routine unregisters the video_device we registered, and frees | ||
769 | up the I/O space. Note that the unregister takes the actual video_device | ||
770 | structure as its argument. Unlike the file operations structure which can be | ||
771 | shared by all instances of a device a video_device structure as an actual | ||
772 | instance of the device. If you are registering multiple radio devices you | ||
773 | need to fill in one structure per device (most likely by setting up a | ||
774 | template and copying it to each of the actual device structures). | ||
775 | </para> | ||
776 | </sect1> | ||
777 | </chapter> | ||
778 | <chapter id="Video_Capture_Devices"> | ||
779 | <title>Video Capture Devices</title> | ||
780 | <sect1 id="introvid"> | ||
781 | <title>Video Capture Device Types</title> | ||
782 | <para> | ||
783 | The video capture devices share the same interfaces as radio devices. In | ||
784 | order to explain the video capture interface I will use the example of a | ||
785 | camera that has no tuners or audio input. This keeps the example relatively | ||
786 | clean. To get both combine the two driver examples. | ||
787 | </para> | ||
788 | <para> | ||
789 | Video capture devices divide into four categories. A little technology | ||
790 | backgrounder. Full motion video even at television resolution (which is | ||
791 | actually fairly low) is pretty resource-intensive. You are continually | ||
792 | passing megabytes of data every second from the capture card to the display. | ||
793 | several alternative approaches have emerged because copying this through the | ||
794 | processor and the user program is a particularly bad idea . | ||
795 | </para> | ||
796 | <para> | ||
797 | The first is to add the television image onto the video output directly. | ||
798 | This is also how some 3D cards work. These basic cards can generally drop the | ||
799 | video into any chosen rectangle of the display. Cards like this, which | ||
800 | include most mpeg1 cards that used the feature connector, aren't very | ||
801 | friendly in a windowing environment. They don't understand windows or | ||
802 | clipping. The video window is always on the top of the display. | ||
803 | </para> | ||
804 | <para> | ||
805 | Chroma keying is a technique used by cards to get around this. It is an old | ||
806 | television mixing trick where you mark all the areas you wish to replace | ||
807 | with a single clear colour that isn't used in the image - TV people use an | ||
808 | incredibly bright blue while computing people often use a particularly | ||
809 | virulent purple. Bright blue occurs on the desktop. Anyone with virulent | ||
810 | purple windows has another problem besides their TV overlay. | ||
811 | </para> | ||
812 | <para> | ||
813 | The third approach is to copy the data from the capture card to the video | ||
814 | card, but to do it directly across the PCI bus. This relieves the processor | ||
815 | from doing the work but does require some smartness on the part of the video | ||
816 | capture chip, as well as a suitable video card. Programming this kind of | ||
817 | card and more so debugging it can be extremely tricky. There are some quite | ||
818 | complicated interactions with the display and you may also have to cope with | ||
819 | various chipset bugs that show up when PCI cards start talking to each | ||
820 | other. | ||
821 | </para> | ||
822 | <para> | ||
823 | To keep our example fairly simple we will assume a card that supports | ||
824 | overlaying a flat rectangular image onto the frame buffer output, and which | ||
825 | can also capture stuff into processor memory. | ||
826 | </para> | ||
827 | </sect1> | ||
828 | <sect1 id="regvid"> | ||
829 | <title>Registering Video Capture Devices</title> | ||
830 | <para> | ||
831 | This time we need to add more functions for our camera device. | ||
832 | </para> | ||
833 | <programlisting> | ||
834 | static struct video_device my_camera | ||
835 | { | ||
836 | "My Camera", | ||
837 | VID_TYPE_OVERLAY|VID_TYPE_SCALES|\ | ||
838 | VID_TYPE_CAPTURE|VID_TYPE_CHROMAKEY, | ||
839 | camera_open. | ||
840 | camera_close, | ||
841 | camera_read, /* no read */ | ||
842 | NULL, /* no write */ | ||
843 | camera_poll, /* no poll */ | ||
844 | camera_ioctl, | ||
845 | NULL, /* no special init function */ | ||
846 | NULL /* no private data */ | ||
847 | }; | ||
848 | </programlisting> | ||
849 | <para> | ||
850 | We need a read() function which is used for capturing data from | ||
851 | the card, and we need a poll function so that a driver can wait for the next | ||
852 | frame to be captured. | ||
853 | </para> | ||
854 | <para> | ||
855 | We use the extra video capability flags that did not apply to the | ||
856 | radio interface. The video related flags are | ||
857 | </para> | ||
858 | <table frame="all" id="Capture_Capabilities"><title>Capture Capabilities</title> | ||
859 | <tgroup cols="2" align="left"> | ||
860 | <tbody> | ||
861 | <row> | ||
862 | <entry>VID_TYPE_CAPTURE</entry><entry>We support image capture</entry> | ||
863 | </row><row> | ||
864 | <entry>VID_TYPE_TELETEXT</entry><entry>A teletext capture device (vbi{n])</entry> | ||
865 | </row><row> | ||
866 | <entry>VID_TYPE_OVERLAY</entry><entry>The image can be directly overlaid onto the | ||
867 | frame buffer</entry> | ||
868 | </row><row> | ||
869 | <entry>VID_TYPE_CHROMAKEY</entry><entry>Chromakey can be used to select which parts | ||
870 | of the image to display</entry> | ||
871 | </row><row> | ||
872 | <entry>VID_TYPE_CLIPPING</entry><entry>It is possible to give the board a list of | ||
873 | rectangles to draw around. </entry> | ||
874 | </row><row> | ||
875 | <entry>VID_TYPE_FRAMERAM</entry><entry>The video capture goes into the video memory | ||
876 | and actually changes it. Applications need | ||
877 | to know this so they can clean up after the | ||
878 | card</entry> | ||
879 | </row><row> | ||
880 | <entry>VID_TYPE_SCALES</entry><entry>The image can be scaled to various sizes, | ||
881 | rather than being a single fixed size.</entry> | ||
882 | </row><row> | ||
883 | <entry>VID_TYPE_MONOCHROME</entry><entry>The capture will be monochrome. This isn't a | ||
884 | complete answer to the question since a mono | ||
885 | camera on a colour capture card will still | ||
886 | produce mono output.</entry> | ||
887 | </row><row> | ||
888 | <entry>VID_TYPE_SUBCAPTURE</entry><entry>The card allows only part of its field of | ||
889 | view to be captured. This enables | ||
890 | applications to avoid copying all of a large | ||
891 | image into memory when only some section is | ||
892 | relevant.</entry> | ||
893 | </row> | ||
894 | </tbody> | ||
895 | </tgroup> | ||
896 | </table> | ||
897 | <para> | ||
898 | We set VID_TYPE_CAPTURE so that we are seen as a capture card, | ||
899 | VID_TYPE_CHROMAKEY so the application knows it is time to draw in virulent | ||
900 | purple, and VID_TYPE_SCALES because we can be resized. | ||
901 | </para> | ||
902 | <para> | ||
903 | Our setup is fairly similar. This time we also want an interrupt line | ||
904 | for the 'frame captured' signal. Not all cards have this so some of them | ||
905 | cannot handle poll(). | ||
906 | </para> | ||
907 | <programlisting> | ||
908 | |||
909 | |||
910 | static int io = 0x320; | ||
911 | static int irq = 11; | ||
912 | |||
913 | int __init mycamera_init(struct video_init *v) | ||
914 | { | ||
915 | if(!request_region(io, MY_IO_SIZE, "mycamera")) | ||
916 | { | ||
917 | printk(KERN_ERR | ||
918 | "mycamera: port 0x%03X is in use.\n", io); | ||
919 | return -EBUSY; | ||
920 | } | ||
921 | |||
922 | if(video_device_register(&my_camera, | ||
923 | VFL_TYPE_GRABBER)==-1) { | ||
924 | release_region(io, MY_IO_SIZE); | ||
925 | return -EINVAL; | ||
926 | } | ||
927 | return 0; | ||
928 | } | ||
929 | |||
930 | </programlisting> | ||
931 | <para> | ||
932 | This is little changed from the needs of the radio card. We specify | ||
933 | VFL_TYPE_GRABBER this time as we want to be allocated a /dev/video name. | ||
934 | </para> | ||
935 | </sect1> | ||
936 | <sect1 id="opvid"> | ||
937 | <title>Opening And Closing The Capture Device</title> | ||
938 | <programlisting> | ||
939 | |||
940 | |||
941 | static int users = 0; | ||
942 | |||
943 | static int camera_open(struct video_device *dev, int flags) | ||
944 | { | ||
945 | if(users) | ||
946 | return -EBUSY; | ||
947 | if(request_irq(irq, camera_irq, 0, "camera", dev)<0) | ||
948 | return -EBUSY; | ||
949 | users++; | ||
950 | return 0; | ||
951 | } | ||
952 | |||
953 | |||
954 | static int camera_close(struct video_device *dev) | ||
955 | { | ||
956 | users--; | ||
957 | free_irq(irq, dev); | ||
958 | } | ||
959 | </programlisting> | ||
960 | <para> | ||
961 | The open and close routines are also quite similar. The only real change is | ||
962 | that we now request an interrupt for the camera device interrupt line. If we | ||
963 | cannot get the interrupt we report EBUSY to the application and give up. | ||
964 | </para> | ||
965 | </sect1> | ||
966 | <sect1 id="irqvid"> | ||
967 | <title>Interrupt Handling</title> | ||
968 | <para> | ||
969 | Our example handler is for an ISA bus device. If it was PCI you would be | ||
970 | able to share the interrupt and would have set IRQF_SHARED to indicate a | ||
971 | shared IRQ. We pass the device pointer as the interrupt routine argument. We | ||
972 | don't need to since we only support one card but doing this will make it | ||
973 | easier to upgrade the driver for multiple devices in the future. | ||
974 | </para> | ||
975 | <para> | ||
976 | Our interrupt routine needs to do little if we assume the card can simply | ||
977 | queue one frame to be read after it captures it. | ||
978 | </para> | ||
979 | <programlisting> | ||
980 | |||
981 | |||
982 | static struct wait_queue *capture_wait; | ||
983 | static int capture_ready = 0; | ||
984 | |||
985 | static void camera_irq(int irq, void *dev_id, | ||
986 | struct pt_regs *regs) | ||
987 | { | ||
988 | capture_ready=1; | ||
989 | wake_up_interruptible(&capture_wait); | ||
990 | } | ||
991 | </programlisting> | ||
992 | <para> | ||
993 | The interrupt handler is nice and simple for this card as we are assuming | ||
994 | the card is buffering the frame for us. This means we have little to do but | ||
995 | wake up anybody interested. We also set a capture_ready flag, as we may | ||
996 | capture a frame before an application needs it. In this case we need to know | ||
997 | that a frame is ready. If we had to collect the frame on the interrupt life | ||
998 | would be more complex. | ||
999 | </para> | ||
1000 | <para> | ||
1001 | The two new routines we need to supply are camera_read which returns a | ||
1002 | frame, and camera_poll which waits for a frame to become ready. | ||
1003 | </para> | ||
1004 | <programlisting> | ||
1005 | |||
1006 | |||
1007 | static int camera_poll(struct video_device *dev, | ||
1008 | struct file *file, struct poll_table *wait) | ||
1009 | { | ||
1010 | poll_wait(file, &capture_wait, wait); | ||
1011 | if(capture_read) | ||
1012 | return POLLIN|POLLRDNORM; | ||
1013 | return 0; | ||
1014 | } | ||
1015 | |||
1016 | </programlisting> | ||
1017 | <para> | ||
1018 | Our wait queue for polling is the capture_wait queue. This will cause the | ||
1019 | task to be woken up by our camera_irq routine. We check capture_read to see | ||
1020 | if there is an image present and if so report that it is readable. | ||
1021 | </para> | ||
1022 | </sect1> | ||
1023 | <sect1 id="rdvid"> | ||
1024 | <title>Reading The Video Image</title> | ||
1025 | <programlisting> | ||
1026 | |||
1027 | |||
1028 | static long camera_read(struct video_device *dev, char *buf, | ||
1029 | unsigned long count) | ||
1030 | { | ||
1031 | struct wait_queue wait = { current, NULL }; | ||
1032 | u8 *ptr; | ||
1033 | int len; | ||
1034 | int i; | ||
1035 | |||
1036 | add_wait_queue(&capture_wait, &wait); | ||
1037 | |||
1038 | while(!capture_ready) | ||
1039 | { | ||
1040 | if(file->flags&O_NDELAY) | ||
1041 | { | ||
1042 | remove_wait_queue(&capture_wait, &wait); | ||
1043 | current->state = TASK_RUNNING; | ||
1044 | return -EWOULDBLOCK; | ||
1045 | } | ||
1046 | if(signal_pending(current)) | ||
1047 | { | ||
1048 | remove_wait_queue(&capture_wait, &wait); | ||
1049 | current->state = TASK_RUNNING; | ||
1050 | return -ERESTARTSYS; | ||
1051 | } | ||
1052 | schedule(); | ||
1053 | current->state = TASK_INTERRUPTIBLE; | ||
1054 | } | ||
1055 | remove_wait_queue(&capture_wait, &wait); | ||
1056 | current->state = TASK_RUNNING; | ||
1057 | |||
1058 | </programlisting> | ||
1059 | <para> | ||
1060 | The first thing we have to do is to ensure that the application waits until | ||
1061 | the next frame is ready. The code here is almost identical to the mouse code | ||
1062 | we used earlier in this chapter. It is one of the common building blocks of | ||
1063 | Linux device driver code and probably one which you will find occurs in any | ||
1064 | drivers you write. | ||
1065 | </para> | ||
1066 | <para> | ||
1067 | We wait for a frame to be ready, or for a signal to interrupt our waiting. If a | ||
1068 | signal occurs we need to return from the system call so that the signal can | ||
1069 | be sent to the application itself. We also check to see if the user actually | ||
1070 | wanted to avoid waiting - ie if they are using non-blocking I/O and have other things | ||
1071 | to get on with. | ||
1072 | </para> | ||
1073 | <para> | ||
1074 | Next we copy the data from the card to the user application. This is rarely | ||
1075 | as easy as our example makes out. We will add capture_w, and capture_h here | ||
1076 | to hold the width and height of the captured image. We assume the card only | ||
1077 | supports 24bit RGB for now. | ||
1078 | </para> | ||
1079 | <programlisting> | ||
1080 | |||
1081 | |||
1082 | |||
1083 | capture_ready = 0; | ||
1084 | |||
1085 | ptr=(u8 *)buf; | ||
1086 | len = capture_w * 3 * capture_h; /* 24bit RGB */ | ||
1087 | |||
1088 | if(len>count) | ||
1089 | len=count; /* Doesn't all fit */ | ||
1090 | |||
1091 | for(i=0; i<len; i++) | ||
1092 | { | ||
1093 | put_user(inb(io+IMAGE_DATA), ptr); | ||
1094 | ptr++; | ||
1095 | } | ||
1096 | |||
1097 | hardware_restart_capture(); | ||
1098 | |||
1099 | return i; | ||
1100 | } | ||
1101 | |||
1102 | </programlisting> | ||
1103 | <para> | ||
1104 | For a real hardware device you would try to avoid the loop with put_user(). | ||
1105 | Each call to put_user() has a time overhead checking whether the accesses to user | ||
1106 | space are allowed. It would be better to read a line into a temporary buffer | ||
1107 | then copy this to user space in one go. | ||
1108 | </para> | ||
1109 | <para> | ||
1110 | Having captured the image and put it into user space we can kick the card to | ||
1111 | get the next frame acquired. | ||
1112 | </para> | ||
1113 | </sect1> | ||
1114 | <sect1 id="iocvid"> | ||
1115 | <title>Video Ioctl Handling</title> | ||
1116 | <para> | ||
1117 | As with the radio driver the major control interface is via the ioctl() | ||
1118 | function. Video capture devices support the same tuner calls as a radio | ||
1119 | device and also support additional calls to control how the video functions | ||
1120 | are handled. In this simple example the card has no tuners to avoid making | ||
1121 | the code complex. | ||
1122 | </para> | ||
1123 | <programlisting> | ||
1124 | |||
1125 | |||
1126 | |||
1127 | static int camera_ioctl(struct video_device *dev, unsigned int cmd, void *arg) | ||
1128 | { | ||
1129 | switch(cmd) | ||
1130 | { | ||
1131 | case VIDIOCGCAP: | ||
1132 | { | ||
1133 | struct video_capability v; | ||
1134 | v.type = VID_TYPE_CAPTURE|\ | ||
1135 | VID_TYPE_CHROMAKEY|\ | ||
1136 | VID_TYPE_SCALES|\ | ||
1137 | VID_TYPE_OVERLAY; | ||
1138 | v.channels = 1; | ||
1139 | v.audios = 0; | ||
1140 | v.maxwidth = 640; | ||
1141 | v.minwidth = 16; | ||
1142 | v.maxheight = 480; | ||
1143 | v.minheight = 16; | ||
1144 | strcpy(v.name, "My Camera"); | ||
1145 | if(copy_to_user(arg, &v, sizeof(v))) | ||
1146 | return -EFAULT; | ||
1147 | return 0; | ||
1148 | } | ||
1149 | |||
1150 | |||
1151 | </programlisting> | ||
1152 | <para> | ||
1153 | The first ioctl we must support and which all video capture and radio | ||
1154 | devices are required to support is VIDIOCGCAP. This behaves exactly the same | ||
1155 | as with a radio device. This time, however, we report the extra capabilities | ||
1156 | we outlined earlier on when defining our video_dev structure. | ||
1157 | </para> | ||
1158 | <para> | ||
1159 | We now set the video flags saying that we support overlay, capture, | ||
1160 | scaling and chromakey. We also report size limits - our smallest image is | ||
1161 | 16x16 pixels, our largest is 640x480. | ||
1162 | </para> | ||
1163 | <para> | ||
1164 | To keep things simple we report no audio and no tuning capabilities at all. | ||
1165 | </para> | ||
1166 | <programlisting> | ||
1167 | |||
1168 | case VIDIOCGCHAN: | ||
1169 | { | ||
1170 | struct video_channel v; | ||
1171 | if(copy_from_user(&v, arg, sizeof(v))) | ||
1172 | return -EFAULT; | ||
1173 | if(v.channel != 0) | ||
1174 | return -EINVAL; | ||
1175 | v.flags = 0; | ||
1176 | v.tuners = 0; | ||
1177 | v.type = VIDEO_TYPE_CAMERA; | ||
1178 | v.norm = VIDEO_MODE_AUTO; | ||
1179 | strcpy(v.name, "Camera Input");break; | ||
1180 | if(copy_to_user(&v, arg, sizeof(v))) | ||
1181 | return -EFAULT; | ||
1182 | return 0; | ||
1183 | } | ||
1184 | |||
1185 | |||
1186 | </programlisting> | ||
1187 | <para> | ||
1188 | This follows what is very much the standard way an ioctl handler looks | ||
1189 | in Linux. We copy the data into a kernel space variable and we check that the | ||
1190 | request is valid (in this case that the input is 0). Finally we copy the | ||
1191 | camera info back to the user. | ||
1192 | </para> | ||
1193 | <para> | ||
1194 | The VIDIOCGCHAN ioctl allows a user to ask about video channels (that is | ||
1195 | inputs to the video card). Our example card has a single camera input. The | ||
1196 | fields in the structure are | ||
1197 | </para> | ||
1198 | <table frame="all" id="video_channel_fields"><title>struct video_channel fields</title> | ||
1199 | <tgroup cols="2" align="left"> | ||
1200 | <tbody> | ||
1201 | <row> | ||
1202 | |||
1203 | <entry>channel</entry><entry>The channel number we are selecting</entry> | ||
1204 | </row><row> | ||
1205 | <entry>name</entry><entry>The name for this channel. This is intended | ||
1206 | to describe the port to the user. | ||
1207 | Appropriate names are therefore things like | ||
1208 | "Camera" "SCART input"</entry> | ||
1209 | </row><row> | ||
1210 | <entry>flags</entry><entry>Channel properties</entry> | ||
1211 | </row><row> | ||
1212 | <entry>type</entry><entry>Input type</entry> | ||
1213 | </row><row> | ||
1214 | <entry>norm</entry><entry>The current television encoding being used | ||
1215 | if relevant for this channel. | ||
1216 | </entry> | ||
1217 | </row> | ||
1218 | </tbody> | ||
1219 | </tgroup> | ||
1220 | </table> | ||
1221 | <table frame="all" id="video_channel_flags"><title>struct video_channel flags</title> | ||
1222 | <tgroup cols="2" align="left"> | ||
1223 | <tbody> | ||
1224 | <row> | ||
1225 | <entry>VIDEO_VC_TUNER</entry><entry>Channel has a tuner.</entry> | ||
1226 | </row><row> | ||
1227 | <entry>VIDEO_VC_AUDIO</entry><entry>Channel has audio.</entry> | ||
1228 | </row> | ||
1229 | </tbody> | ||
1230 | </tgroup> | ||
1231 | </table> | ||
1232 | <table frame="all" id="video_channel_types"><title>struct video_channel types</title> | ||
1233 | <tgroup cols="2" align="left"> | ||
1234 | <tbody> | ||
1235 | <row> | ||
1236 | <entry>VIDEO_TYPE_TV</entry><entry>Television input.</entry> | ||
1237 | </row><row> | ||
1238 | <entry>VIDEO_TYPE_CAMERA</entry><entry>Fixed camera input.</entry> | ||
1239 | </row><row> | ||
1240 | <entry>0</entry><entry>Type is unknown.</entry> | ||
1241 | </row> | ||
1242 | </tbody> | ||
1243 | </tgroup> | ||
1244 | </table> | ||
1245 | <table frame="all" id="video_channel_norms"><title>struct video_channel norms</title> | ||
1246 | <tgroup cols="2" align="left"> | ||
1247 | <tbody> | ||
1248 | <row> | ||
1249 | <entry>VIDEO_MODE_PAL</entry><entry>PAL encoded Television</entry> | ||
1250 | </row><row> | ||
1251 | <entry>VIDEO_MODE_NTSC</entry><entry>NTSC (US) encoded Television</entry> | ||
1252 | </row><row> | ||
1253 | <entry>VIDEO_MODE_SECAM</entry><entry>SECAM (French) Television </entry> | ||
1254 | </row><row> | ||
1255 | <entry>VIDEO_MODE_AUTO</entry><entry>Automatic switching, or format does not | ||
1256 | matter</entry> | ||
1257 | </row> | ||
1258 | </tbody> | ||
1259 | </tgroup> | ||
1260 | </table> | ||
1261 | <para> | ||
1262 | The corresponding VIDIOCSCHAN ioctl allows a user to change channel and to | ||
1263 | request the norm is changed - for example to switch between a PAL or an NTSC | ||
1264 | format camera. | ||
1265 | </para> | ||
1266 | <programlisting> | ||
1267 | |||
1268 | |||
1269 | case VIDIOCSCHAN: | ||
1270 | { | ||
1271 | struct video_channel v; | ||
1272 | if(copy_from_user(&v, arg, sizeof(v))) | ||
1273 | return -EFAULT; | ||
1274 | if(v.channel != 0) | ||
1275 | return -EINVAL; | ||
1276 | if(v.norm != VIDEO_MODE_AUTO) | ||
1277 | return -EINVAL; | ||
1278 | return 0; | ||
1279 | } | ||
1280 | |||
1281 | |||
1282 | </programlisting> | ||
1283 | <para> | ||
1284 | The implementation of this call in our driver is remarkably easy. Because we | ||
1285 | are assuming fixed format hardware we need only check that the user has not | ||
1286 | tried to change anything. | ||
1287 | </para> | ||
1288 | <para> | ||
1289 | The user also needs to be able to configure and adjust the picture they are | ||
1290 | seeing. This is much like adjusting a television set. A user application | ||
1291 | also needs to know the palette being used so that it knows how to display | ||
1292 | the image that has been captured. The VIDIOCGPICT and VIDIOCSPICT ioctl | ||
1293 | calls provide this information. | ||
1294 | </para> | ||
1295 | <programlisting> | ||
1296 | |||
1297 | |||
1298 | case VIDIOCGPICT | ||
1299 | { | ||
1300 | struct video_picture v; | ||
1301 | v.brightness = hardware_brightness(); | ||
1302 | v.hue = hardware_hue(); | ||
1303 | v.colour = hardware_saturation(); | ||
1304 | v.contrast = hardware_brightness(); | ||
1305 | /* Not settable */ | ||
1306 | v.whiteness = 32768; | ||
1307 | v.depth = 24; /* 24bit */ | ||
1308 | v.palette = VIDEO_PALETTE_RGB24; | ||
1309 | if(copy_to_user(&v, arg, | ||
1310 | sizeof(v))) | ||
1311 | return -EFAULT; | ||
1312 | return 0; | ||
1313 | } | ||
1314 | |||
1315 | |||
1316 | </programlisting> | ||
1317 | <para> | ||
1318 | The brightness, hue, color, and contrast provide the picture controls that | ||
1319 | are akin to a conventional television. Whiteness provides additional | ||
1320 | control for greyscale images. All of these values are scaled between 0-65535 | ||
1321 | and have 32768 as the mid point setting. The scaling means that applications | ||
1322 | do not have to worry about the capability range of the hardware but can let | ||
1323 | it make a best effort attempt. | ||
1324 | </para> | ||
1325 | <para> | ||
1326 | Our depth is 24, as this is in bits. We will be returning RGB24 format. This | ||
1327 | has one byte of red, then one of green, then one of blue. This then repeats | ||
1328 | for every other pixel in the image. The other common formats the interface | ||
1329 | defines are | ||
1330 | </para> | ||
1331 | <table frame="all" id="Framebuffer_Encodings"><title>Framebuffer Encodings</title> | ||
1332 | <tgroup cols="2" align="left"> | ||
1333 | <tbody> | ||
1334 | <row> | ||
1335 | <entry>GREY</entry><entry>Linear greyscale. This is for simple cameras and the | ||
1336 | like</entry> | ||
1337 | </row><row> | ||
1338 | <entry>RGB565</entry><entry>The top 5 bits hold 32 red levels, the next six bits | ||
1339 | hold green and the low 5 bits hold blue. </entry> | ||
1340 | </row><row> | ||
1341 | <entry>RGB555</entry><entry>The top bit is clear. The red green and blue levels | ||
1342 | each occupy five bits.</entry> | ||
1343 | </row> | ||
1344 | </tbody> | ||
1345 | </tgroup> | ||
1346 | </table> | ||
1347 | <para> | ||
1348 | Additional modes are support for YUV capture formats. These are common for | ||
1349 | TV and video conferencing applications. | ||
1350 | </para> | ||
1351 | <para> | ||
1352 | The VIDIOCSPICT ioctl allows a user to set some of the picture parameters. | ||
1353 | Exactly which ones are supported depends heavily on the card itself. It is | ||
1354 | possible to support many modes and effects in software. In general doing | ||
1355 | this in the kernel is a bad idea. Video capture is a performance-sensitive | ||
1356 | application and the programs can often do better if they aren't being | ||
1357 | 'helped' by an overkeen driver writer. Thus for our device we will report | ||
1358 | RGB24 only and refuse to allow a change. | ||
1359 | </para> | ||
1360 | <programlisting> | ||
1361 | |||
1362 | |||
1363 | case VIDIOCSPICT: | ||
1364 | { | ||
1365 | struct video_picture v; | ||
1366 | if(copy_from_user(&v, arg, sizeof(v))) | ||
1367 | return -EFAULT; | ||
1368 | if(v.depth!=24 || | ||
1369 | v.palette != VIDEO_PALETTE_RGB24) | ||
1370 | return -EINVAL; | ||
1371 | set_hardware_brightness(v.brightness); | ||
1372 | set_hardware_hue(v.hue); | ||
1373 | set_hardware_saturation(v.colour); | ||
1374 | set_hardware_brightness(v.contrast); | ||
1375 | return 0; | ||
1376 | } | ||
1377 | |||
1378 | |||
1379 | </programlisting> | ||
1380 | <para> | ||
1381 | We check the user has not tried to change the palette or the depth. We do | ||
1382 | not want to carry out some of the changes and then return an error. This may | ||
1383 | confuse the application which will be assuming no change occurred. | ||
1384 | </para> | ||
1385 | <para> | ||
1386 | In much the same way as you need to be able to set the picture controls to | ||
1387 | get the right capture images, many cards need to know what they are | ||
1388 | displaying onto when generating overlay output. In some cases getting this | ||
1389 | wrong even makes a nasty mess or may crash the computer. For that reason | ||
1390 | the VIDIOCSBUF ioctl used to set up the frame buffer information may well | ||
1391 | only be usable by root. | ||
1392 | </para> | ||
1393 | <para> | ||
1394 | We will assume our card is one of the old ISA devices with feature connector | ||
1395 | and only supports a couple of standard video modes. Very common for older | ||
1396 | cards although the PCI devices are way smarter than this. | ||
1397 | </para> | ||
1398 | <programlisting> | ||
1399 | |||
1400 | |||
1401 | static struct video_buffer capture_fb; | ||
1402 | |||
1403 | case VIDIOCGFBUF: | ||
1404 | { | ||
1405 | if(copy_to_user(arg, &capture_fb, | ||
1406 | sizeof(capture_fb))) | ||
1407 | return -EFAULT; | ||
1408 | return 0; | ||
1409 | |||
1410 | } | ||
1411 | |||
1412 | |||
1413 | </programlisting> | ||
1414 | <para> | ||
1415 | We keep the frame buffer information in the format the ioctl uses. This | ||
1416 | makes it nice and easy to work with in the ioctl calls. | ||
1417 | </para> | ||
1418 | <programlisting> | ||
1419 | |||
1420 | case VIDIOCSFBUF: | ||
1421 | { | ||
1422 | struct video_buffer v; | ||
1423 | |||
1424 | if(!capable(CAP_SYS_ADMIN)) | ||
1425 | return -EPERM; | ||
1426 | |||
1427 | if(copy_from_user(&v, arg, sizeof(v))) | ||
1428 | return -EFAULT; | ||
1429 | if(v.width!=320 && v.width!=640) | ||
1430 | return -EINVAL; | ||
1431 | if(v.height!=200 && v.height!=240 | ||
1432 | && v.height!=400 | ||
1433 | && v.height !=480) | ||
1434 | return -EINVAL; | ||
1435 | memcpy(&capture_fb, &v, sizeof(v)); | ||
1436 | hardware_set_fb(&v); | ||
1437 | return 0; | ||
1438 | } | ||
1439 | |||
1440 | |||
1441 | |||
1442 | </programlisting> | ||
1443 | <para> | ||
1444 | The capable() function checks a user has the required capability. The Linux | ||
1445 | operating system has a set of about 30 capabilities indicating privileged | ||
1446 | access to services. The default set up gives the superuser (uid 0) all of | ||
1447 | them and nobody else has any. | ||
1448 | </para> | ||
1449 | <para> | ||
1450 | We check that the user has the SYS_ADMIN capability, that is they are | ||
1451 | allowed to operate as the machine administrator. We don't want anyone but | ||
1452 | the administrator making a mess of the display. | ||
1453 | </para> | ||
1454 | <para> | ||
1455 | Next we check for standard PC video modes (320 or 640 wide with either | ||
1456 | EGA or VGA depths). If the mode is not a standard video mode we reject it as | ||
1457 | not supported by our card. If the mode is acceptable we save it so that | ||
1458 | VIDIOCFBUF will give the right answer next time it is called. The | ||
1459 | hardware_set_fb() function is some undescribed card specific function to | ||
1460 | program the card for the desired mode. | ||
1461 | </para> | ||
1462 | <para> | ||
1463 | Before the driver can display an overlay window it needs to know where the | ||
1464 | window should be placed, and also how large it should be. If the card | ||
1465 | supports clipping it needs to know which rectangles to omit from the | ||
1466 | display. The video_window structure is used to describe the way the image | ||
1467 | should be displayed. | ||
1468 | </para> | ||
1469 | <table frame="all" id="video_window_fields"><title>struct video_window fields</title> | ||
1470 | <tgroup cols="2" align="left"> | ||
1471 | <tbody> | ||
1472 | <row> | ||
1473 | <entry>width</entry><entry>The width in pixels of the desired image. The card | ||
1474 | may use a smaller size if this size is not available</entry> | ||
1475 | </row><row> | ||
1476 | <entry>height</entry><entry>The height of the image. The card may use a smaller | ||
1477 | size if this size is not available.</entry> | ||
1478 | </row><row> | ||
1479 | <entry>x</entry><entry> The X position of the top left of the window. This | ||
1480 | is in pixels relative to the left hand edge of the | ||
1481 | picture. Not all cards can display images aligned on | ||
1482 | any pixel boundary. If the position is unsuitable | ||
1483 | the card adjusts the image right and reduces the | ||
1484 | width.</entry> | ||
1485 | </row><row> | ||
1486 | <entry>y</entry><entry> The Y position of the top left of the window. This | ||
1487 | is counted in pixels relative to the top edge of the | ||
1488 | picture. As with the width if the card cannot | ||
1489 | display starting on this line it will adjust the | ||
1490 | values.</entry> | ||
1491 | </row><row> | ||
1492 | <entry>chromakey</entry><entry>The colour (expressed in RGB32 format) for the | ||
1493 | chromakey colour if chroma keying is being used. </entry> | ||
1494 | </row><row> | ||
1495 | <entry>clips</entry><entry>An array of rectangles that must not be drawn | ||
1496 | over.</entry> | ||
1497 | </row><row> | ||
1498 | <entry>clipcount</entry><entry>The number of clips in this array.</entry> | ||
1499 | </row> | ||
1500 | </tbody> | ||
1501 | </tgroup> | ||
1502 | </table> | ||
1503 | <para> | ||
1504 | Each clip is a struct video_clip which has the following fields | ||
1505 | </para> | ||
1506 | <table frame="all" id="video_clip_fields"><title>video_clip fields</title> | ||
1507 | <tgroup cols="2" align="left"> | ||
1508 | <tbody> | ||
1509 | <row> | ||
1510 | <entry>x, y</entry><entry>Co-ordinates relative to the display</entry> | ||
1511 | </row><row> | ||
1512 | <entry>width, height</entry><entry>Width and height in pixels</entry> | ||
1513 | </row><row> | ||
1514 | <entry>next</entry><entry>A spare field for the application to use</entry> | ||
1515 | </row> | ||
1516 | </tbody> | ||
1517 | </tgroup> | ||
1518 | </table> | ||
1519 | <para> | ||
1520 | The driver is required to ensure it always draws in the area requested or a smaller area, and that it never draws in any of the areas that are clipped. | ||
1521 | This may well mean it has to leave alone. small areas the application wished to be | ||
1522 | drawn. | ||
1523 | </para> | ||
1524 | <para> | ||
1525 | Our example card uses chromakey so does not have to address most of the | ||
1526 | clipping. We will add a video_window structure to our global variables to | ||
1527 | remember our parameters, as we did with the frame buffer. | ||
1528 | </para> | ||
1529 | <programlisting> | ||
1530 | |||
1531 | |||
1532 | case VIDIOCGWIN: | ||
1533 | { | ||
1534 | if(copy_to_user(arg, &capture_win, | ||
1535 | sizeof(capture_win))) | ||
1536 | return -EFAULT; | ||
1537 | return 0; | ||
1538 | } | ||
1539 | |||
1540 | |||
1541 | case VIDIOCSWIN: | ||
1542 | { | ||
1543 | struct video_window v; | ||
1544 | if(copy_from_user(&v, arg, sizeof(v))) | ||
1545 | return -EFAULT; | ||
1546 | if(v.width > 640 || v.height > 480) | ||
1547 | return -EINVAL; | ||
1548 | if(v.width < 16 || v.height < 16) | ||
1549 | return -EINVAL; | ||
1550 | hardware_set_key(v.chromakey); | ||
1551 | hardware_set_window(v); | ||
1552 | memcpy(&capture_win, &v, sizeof(v)); | ||
1553 | capture_w = v.width; | ||
1554 | capture_h = v.height; | ||
1555 | return 0; | ||
1556 | } | ||
1557 | |||
1558 | |||
1559 | </programlisting> | ||
1560 | <para> | ||
1561 | Because we are using Chromakey our setup is fairly simple. Mostly we have to | ||
1562 | check the values are sane and load them into the capture card. | ||
1563 | </para> | ||
1564 | <para> | ||
1565 | With all the setup done we can now turn on the actual capture/overlay. This | ||
1566 | is done with the VIDIOCCAPTURE ioctl. This takes a single integer argument | ||
1567 | where 0 is on and 1 is off. | ||
1568 | </para> | ||
1569 | <programlisting> | ||
1570 | |||
1571 | |||
1572 | case VIDIOCCAPTURE: | ||
1573 | { | ||
1574 | int v; | ||
1575 | if(get_user(v, (int *)arg)) | ||
1576 | return -EFAULT; | ||
1577 | if(v==0) | ||
1578 | hardware_capture_off(); | ||
1579 | else | ||
1580 | { | ||
1581 | if(capture_fb.width == 0 | ||
1582 | || capture_w == 0) | ||
1583 | return -EINVAL; | ||
1584 | hardware_capture_on(); | ||
1585 | } | ||
1586 | return 0; | ||
1587 | } | ||
1588 | |||
1589 | |||
1590 | </programlisting> | ||
1591 | <para> | ||
1592 | We grab the flag from user space and either enable or disable according to | ||
1593 | its value. There is one small corner case we have to consider here. Suppose | ||
1594 | that the capture was requested before the video window or the frame buffer | ||
1595 | had been set up. In those cases there will be unconfigured fields in our | ||
1596 | card data, as well as unconfigured hardware settings. We check for this case and | ||
1597 | return an error if the frame buffer or the capture window width is zero. | ||
1598 | </para> | ||
1599 | <programlisting> | ||
1600 | |||
1601 | |||
1602 | default: | ||
1603 | return -ENOIOCTLCMD; | ||
1604 | } | ||
1605 | } | ||
1606 | </programlisting> | ||
1607 | <para> | ||
1608 | |||
1609 | We don't need to support any other ioctls, so if we get this far, it is time | ||
1610 | to tell the video layer that we don't now what the user is talking about. | ||
1611 | </para> | ||
1612 | </sect1> | ||
1613 | <sect1 id="endvid"> | ||
1614 | <title>Other Functionality</title> | ||
1615 | <para> | ||
1616 | The Video4Linux layer supports additional features, including a high | ||
1617 | performance mmap() based capture mode and capturing part of the image. | ||
1618 | These features are out of the scope of the book. You should however have enough | ||
1619 | example code to implement most simple video4linux devices for radio and TV | ||
1620 | cards. | ||
1621 | </para> | ||
1622 | </sect1> | ||
1623 | </chapter> | ||
1624 | <chapter id="bugs"> | ||
1625 | <title>Known Bugs And Assumptions</title> | ||
1626 | <para> | ||
1627 | <variablelist> | ||
1628 | <varlistentry><term>Multiple Opens</term> | ||
1629 | <listitem> | ||
1630 | <para> | ||
1631 | The driver assumes multiple opens should not be allowed. A driver | ||
1632 | can work around this but not cleanly. | ||
1633 | </para> | ||
1634 | </listitem></varlistentry> | ||
1635 | |||
1636 | <varlistentry><term>API Deficiencies</term> | ||
1637 | <listitem> | ||
1638 | <para> | ||
1639 | The existing API poorly reflects compression capable devices. There | ||
1640 | are plans afoot to merge V4L, V4L2 and some other ideas into a | ||
1641 | better interface. | ||
1642 | </para> | ||
1643 | </listitem></varlistentry> | ||
1644 | </variablelist> | ||
1645 | |||
1646 | </para> | ||
1647 | </chapter> | ||
1648 | |||
1649 | <chapter id="pubfunctions"> | ||
1650 | <title>Public Functions Provided</title> | ||
1651 | !Edrivers/media/video/videodev.c | ||
1652 | </chapter> | ||
1653 | |||
1654 | </book> | ||
diff --git a/Documentation/DocBook/z8530book.tmpl b/Documentation/DocBook/z8530book.tmpl index 42c75ba71ba2..a42a8a4c7689 100644 --- a/Documentation/DocBook/z8530book.tmpl +++ b/Documentation/DocBook/z8530book.tmpl | |||
@@ -69,12 +69,6 @@ | |||
69 | device to be used as both a tty interface and as a synchronous | 69 | device to be used as both a tty interface and as a synchronous |
70 | controller is a project for Linux post the 2.4 release | 70 | controller is a project for Linux post the 2.4 release |
71 | </para> | 71 | </para> |
72 | <para> | ||
73 | The support code handles most common card configurations and | ||
74 | supports running both Cisco HDLC and Synchronous PPP. With extra | ||
75 | glue the frame relay and X.25 protocols can also be used with this | ||
76 | driver. | ||
77 | </para> | ||
78 | </chapter> | 72 | </chapter> |
79 | 73 | ||
80 | <chapter id="Driver_Modes"> | 74 | <chapter id="Driver_Modes"> |
@@ -179,35 +173,27 @@ | |||
179 | <para> | 173 | <para> |
180 | If you wish to use the network interface facilities of the driver, | 174 | If you wish to use the network interface facilities of the driver, |
181 | then you need to attach a network device to each channel that is | 175 | then you need to attach a network device to each channel that is |
182 | present and in use. In addition to use the SyncPPP and Cisco HDLC | 176 | present and in use. In addition to use the generic HDLC |
183 | you need to follow some additional plumbing rules. They may seem | 177 | you need to follow some additional plumbing rules. They may seem |
184 | complex but a look at the example hostess_sv11 driver should | 178 | complex but a look at the example hostess_sv11 driver should |
185 | reassure you. | 179 | reassure you. |
186 | </para> | 180 | </para> |
187 | <para> | 181 | <para> |
188 | The network device used for each channel should be pointed to by | 182 | The network device used for each channel should be pointed to by |
189 | the netdevice field of each channel. The dev-> priv field of the | 183 | the netdevice field of each channel. The hdlc-> priv field of the |
190 | network device points to your private data - you will need to be | 184 | network device points to your private data - you will need to be |
191 | able to find your ppp device from this. In addition to use the | 185 | able to find your private data from this. |
192 | sync ppp layer the private data must start with a void * pointer | ||
193 | to the syncppp structures. | ||
194 | </para> | 186 | </para> |
195 | <para> | 187 | <para> |
196 | The way most drivers approach this particular problem is to | 188 | The way most drivers approach this particular problem is to |
197 | create a structure holding the Z8530 device definition and | 189 | create a structure holding the Z8530 device definition and |
198 | put that and the syncppp pointer into the private field of | 190 | put that into the private field of the network device. The |
199 | the network device. The network device fields of the channels | 191 | network device fields of the channels then point back to the |
200 | then point back to the network devices. The ppp_device can also | 192 | network devices. |
201 | be put in the private structure conveniently. | ||
202 | </para> | 193 | </para> |
203 | <para> | 194 | <para> |
204 | If you wish to use the synchronous ppp then you need to attach | 195 | If you wish to use the generic HDLC then you need to register |
205 | the syncppp layer to the network device. You should do this before | 196 | the HDLC device. |
206 | you register the network device. The | ||
207 | <function>sppp_attach</function> requires that the first void * | ||
208 | pointer in your private data is pointing to an empty struct | ||
209 | ppp_device. The function fills in the initial data for the | ||
210 | ppp/hdlc layer. | ||
211 | </para> | 197 | </para> |
212 | <para> | 198 | <para> |
213 | Before you register your network device you will also need to | 199 | Before you register your network device you will also need to |
@@ -314,10 +300,10 @@ | |||
314 | buffer in sk_buff format and queues it for transmission. The | 300 | buffer in sk_buff format and queues it for transmission. The |
315 | caller must provide the entire packet with the exception of the | 301 | caller must provide the entire packet with the exception of the |
316 | bitstuffing and CRC. This is normally done by the caller via | 302 | bitstuffing and CRC. This is normally done by the caller via |
317 | the syncppp interface layer. It returns 0 if the buffer has been | 303 | the generic HDLC interface layer. It returns 0 if the buffer has been |
318 | queued and non zero values for queue full. If the function accepts | 304 | queued and non zero values for queue full. If the function accepts |
319 | the buffer it becomes property of the Z8530 layer and the caller | 305 | the buffer it becomes property of the Z8530 layer and the caller |
320 | should not free it. | 306 | should not free it. |
321 | </para> | 307 | </para> |
322 | <para> | 308 | <para> |
323 | The function <function>z8530_get_stats</function> returns a pointer | 309 | The function <function>z8530_get_stats</function> returns a pointer |
diff --git a/Documentation/HOWTO b/Documentation/HOWTO index 619e8caf30db..8495fc970391 100644 --- a/Documentation/HOWTO +++ b/Documentation/HOWTO | |||
@@ -77,7 +77,8 @@ documentation files are also added which explain how to use the feature. | |||
77 | When a kernel change causes the interface that the kernel exposes to | 77 | When a kernel change causes the interface that the kernel exposes to |
78 | userspace to change, it is recommended that you send the information or | 78 | userspace to change, it is recommended that you send the information or |
79 | a patch to the manual pages explaining the change to the manual pages | 79 | a patch to the manual pages explaining the change to the manual pages |
80 | maintainer at mtk.manpages@gmail.com. | 80 | maintainer at mtk.manpages@gmail.com, and CC the list |
81 | linux-api@vger.kernel.org. | ||
81 | 82 | ||
82 | Here is a list of files that are in the kernel source tree that are | 83 | Here is a list of files that are in the kernel source tree that are |
83 | required reading: | 84 | required reading: |
@@ -111,7 +112,7 @@ required reading: | |||
111 | 112 | ||
112 | Other excellent descriptions of how to create patches properly are: | 113 | Other excellent descriptions of how to create patches properly are: |
113 | "The Perfect Patch" | 114 | "The Perfect Patch" |
114 | http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt | 115 | http://userweb.kernel.org/~akpm/stuff/tpp.txt |
115 | "Linux kernel patch submission format" | 116 | "Linux kernel patch submission format" |
116 | http://linux.yyz.us/patch-format.html | 117 | http://linux.yyz.us/patch-format.html |
117 | 118 | ||
@@ -358,7 +359,7 @@ Here is a list of some of the different kernel trees available: | |||
358 | - pcmcia, Dominik Brodowski <linux@dominikbrodowski.net> | 359 | - pcmcia, Dominik Brodowski <linux@dominikbrodowski.net> |
359 | git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git | 360 | git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git |
360 | 361 | ||
361 | - SCSI, James Bottomley <James.Bottomley@SteelEye.com> | 362 | - SCSI, James Bottomley <James.Bottomley@hansenpartnership.com> |
362 | git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git | 363 | git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git |
363 | 364 | ||
364 | - x86, Ingo Molnar <mingo@elte.hu> | 365 | - x86, Ingo Molnar <mingo@elte.hu> |
@@ -619,7 +620,7 @@ all time. It should describe the patch completely, containing: | |||
619 | For more details on what this should all look like, please see the | 620 | For more details on what this should all look like, please see the |
620 | ChangeLog section of the document: | 621 | ChangeLog section of the document: |
621 | "The Perfect Patch" | 622 | "The Perfect Patch" |
622 | http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt | 623 | http://userweb.kernel.org/~akpm/stuff/tpp.txt |
623 | 624 | ||
624 | 625 | ||
625 | 626 | ||
diff --git a/Documentation/Intel-IOMMU.txt b/Documentation/Intel-IOMMU.txt index c2321903aa09..21bc416d887e 100644 --- a/Documentation/Intel-IOMMU.txt +++ b/Documentation/Intel-IOMMU.txt | |||
@@ -48,7 +48,7 @@ IOVA generation is pretty generic. We used the same technique as vmalloc() | |||
48 | but these are not global address spaces, but separate for each domain. | 48 | but these are not global address spaces, but separate for each domain. |
49 | Different DMA engines may support different number of domains. | 49 | Different DMA engines may support different number of domains. |
50 | 50 | ||
51 | We also allocate gaurd pages with each mapping, so we can attempt to catch | 51 | We also allocate guard pages with each mapping, so we can attempt to catch |
52 | any overflow that might happen. | 52 | any overflow that might happen. |
53 | 53 | ||
54 | 54 | ||
@@ -112,4 +112,4 @@ TBD | |||
112 | 112 | ||
113 | - For compatibility testing, could use unity map domain for all devices, just | 113 | - For compatibility testing, could use unity map domain for all devices, just |
114 | provide a 1-1 for all useful memory under a single domain for all devices. | 114 | provide a 1-1 for all useful memory under a single domain for all devices. |
115 | - API for paravirt ops for abstracting functionlity for VMM folks. | 115 | - API for paravirt ops for abstracting functionality for VMM folks. |
diff --git a/Documentation/MSI-HOWTO.txt b/Documentation/MSI-HOWTO.txt index a51f693c1541..256defd7e174 100644 --- a/Documentation/MSI-HOWTO.txt +++ b/Documentation/MSI-HOWTO.txt | |||
@@ -236,10 +236,8 @@ software system can set different pages for controlling accesses to the | |||
236 | MSI-X structure. The implementation of MSI support requires the PCI | 236 | MSI-X structure. The implementation of MSI support requires the PCI |
237 | subsystem, not a device driver, to maintain full control of the MSI-X | 237 | subsystem, not a device driver, to maintain full control of the MSI-X |
238 | table/MSI-X PBA (Pending Bit Array) and MMIO address space of the MSI-X | 238 | table/MSI-X PBA (Pending Bit Array) and MMIO address space of the MSI-X |
239 | table/MSI-X PBA. A device driver is prohibited from requesting the MMIO | 239 | table/MSI-X PBA. A device driver should not access the MMIO address |
240 | address space of the MSI-X table/MSI-X PBA. Otherwise, the PCI subsystem | 240 | space of the MSI-X table/MSI-X PBA. |
241 | will fail enabling MSI-X on its hardware device when it calls the function | ||
242 | pci_enable_msix(). | ||
243 | 241 | ||
244 | 5.3.2 API pci_enable_msix | 242 | 5.3.2 API pci_enable_msix |
245 | 243 | ||
diff --git a/Documentation/Makefile b/Documentation/Makefile new file mode 100644 index 000000000000..94b945733534 --- /dev/null +++ b/Documentation/Makefile | |||
@@ -0,0 +1,3 @@ | |||
1 | obj-m := DocBook/ accounting/ auxdisplay/ connector/ \ | ||
2 | filesystems/configfs/ ia64/ networking/ \ | ||
3 | pcmcia/ spi/ video4linux/ vm/ watchdog/src/ | ||
diff --git a/Documentation/PCI/pci.txt b/Documentation/PCI/pci.txt index 8d4dc6250c58..fd4907a2968c 100644 --- a/Documentation/PCI/pci.txt +++ b/Documentation/PCI/pci.txt | |||
@@ -163,6 +163,10 @@ need pass only as many optional fields as necessary: | |||
163 | o class and classmask fields default to 0 | 163 | o class and classmask fields default to 0 |
164 | o driver_data defaults to 0UL. | 164 | o driver_data defaults to 0UL. |
165 | 165 | ||
166 | Note that driver_data must match the value used by any of the pci_device_id | ||
167 | entries defined in the driver. This makes the driver_data field mandatory | ||
168 | if all the pci_device_id entries have a non-zero driver_data value. | ||
169 | |||
166 | Once added, the driver probe routine will be invoked for any unclaimed | 170 | Once added, the driver probe routine will be invoked for any unclaimed |
167 | PCI devices listed in its (newly updated) pci_ids list. | 171 | PCI devices listed in its (newly updated) pci_ids list. |
168 | 172 | ||
diff --git a/Documentation/PCI/pcieaer-howto.txt b/Documentation/PCI/pcieaer-howto.txt index 16c251230c82..ddeb14beacc8 100644 --- a/Documentation/PCI/pcieaer-howto.txt +++ b/Documentation/PCI/pcieaer-howto.txt | |||
@@ -203,22 +203,17 @@ to mmio_enabled. | |||
203 | 203 | ||
204 | 3.3 helper functions | 204 | 3.3 helper functions |
205 | 205 | ||
206 | 3.3.1 int pci_find_aer_capability(struct pci_dev *dev); | 206 | 3.3.1 int pci_enable_pcie_error_reporting(struct pci_dev *dev); |
207 | pci_find_aer_capability locates the PCI Express AER capability | ||
208 | in the device configuration space. If the device doesn't support | ||
209 | PCI-Express AER, the function returns 0. | ||
210 | |||
211 | 3.3.2 int pci_enable_pcie_error_reporting(struct pci_dev *dev); | ||
212 | pci_enable_pcie_error_reporting enables the device to send error | 207 | pci_enable_pcie_error_reporting enables the device to send error |
213 | messages to root port when an error is detected. Note that devices | 208 | messages to root port when an error is detected. Note that devices |
214 | don't enable the error reporting by default, so device drivers need | 209 | don't enable the error reporting by default, so device drivers need |
215 | call this function to enable it. | 210 | call this function to enable it. |
216 | 211 | ||
217 | 3.3.3 int pci_disable_pcie_error_reporting(struct pci_dev *dev); | 212 | 3.3.2 int pci_disable_pcie_error_reporting(struct pci_dev *dev); |
218 | pci_disable_pcie_error_reporting disables the device to send error | 213 | pci_disable_pcie_error_reporting disables the device to send error |
219 | messages to root port when an error is detected. | 214 | messages to root port when an error is detected. |
220 | 215 | ||
221 | 3.3.4 int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); | 216 | 3.3.3 int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); |
222 | pci_cleanup_aer_uncorrect_error_status cleanups the uncorrectable | 217 | pci_cleanup_aer_uncorrect_error_status cleanups the uncorrectable |
223 | error status register. | 218 | error status register. |
224 | 219 | ||
diff --git a/Documentation/RCU/checklist.txt b/Documentation/RCU/checklist.txt index cf5562cbe356..6e253407b3dc 100644 --- a/Documentation/RCU/checklist.txt +++ b/Documentation/RCU/checklist.txt | |||
@@ -210,7 +210,7 @@ over a rather long period of time, but improvements are always welcome! | |||
210 | number of updates per grace period. | 210 | number of updates per grace period. |
211 | 211 | ||
212 | 9. All RCU list-traversal primitives, which include | 212 | 9. All RCU list-traversal primitives, which include |
213 | rcu_dereference(), list_for_each_rcu(), list_for_each_entry_rcu(), | 213 | rcu_dereference(), list_for_each_entry_rcu(), |
214 | list_for_each_continue_rcu(), and list_for_each_safe_rcu(), | 214 | list_for_each_continue_rcu(), and list_for_each_safe_rcu(), |
215 | must be either within an RCU read-side critical section or | 215 | must be either within an RCU read-side critical section or |
216 | must be protected by appropriate update-side locks. RCU | 216 | must be protected by appropriate update-side locks. RCU |
diff --git a/Documentation/RCU/rcuref.txt b/Documentation/RCU/rcuref.txt index 451de2ad8329..4202ad093130 100644 --- a/Documentation/RCU/rcuref.txt +++ b/Documentation/RCU/rcuref.txt | |||
@@ -29,9 +29,9 @@ release_referenced() delete() | |||
29 | } | 29 | } |
30 | 30 | ||
31 | If this list/array is made lock free using RCU as in changing the | 31 | If this list/array is made lock free using RCU as in changing the |
32 | write_lock() in add() and delete() to spin_lock and changing read_lock | 32 | write_lock() in add() and delete() to spin_lock() and changing read_lock() |
33 | in search_and_reference to rcu_read_lock(), the atomic_get in | 33 | in search_and_reference() to rcu_read_lock(), the atomic_inc() in |
34 | search_and_reference could potentially hold reference to an element which | 34 | search_and_reference() could potentially hold reference to an element which |
35 | has already been deleted from the list/array. Use atomic_inc_not_zero() | 35 | has already been deleted from the list/array. Use atomic_inc_not_zero() |
36 | in this scenario as follows: | 36 | in this scenario as follows: |
37 | 37 | ||
@@ -40,20 +40,20 @@ add() search_and_reference() | |||
40 | { { | 40 | { { |
41 | alloc_object rcu_read_lock(); | 41 | alloc_object rcu_read_lock(); |
42 | ... search_for_element | 42 | ... search_for_element |
43 | atomic_set(&el->rc, 1); if (atomic_inc_not_zero(&el->rc)) { | 43 | atomic_set(&el->rc, 1); if (!atomic_inc_not_zero(&el->rc)) { |
44 | write_lock(&list_lock); rcu_read_unlock(); | 44 | spin_lock(&list_lock); rcu_read_unlock(); |
45 | return FAIL; | 45 | return FAIL; |
46 | add_element } | 46 | add_element } |
47 | ... ... | 47 | ... ... |
48 | write_unlock(&list_lock); rcu_read_unlock(); | 48 | spin_unlock(&list_lock); rcu_read_unlock(); |
49 | } } | 49 | } } |
50 | 3. 4. | 50 | 3. 4. |
51 | release_referenced() delete() | 51 | release_referenced() delete() |
52 | { { | 52 | { { |
53 | ... write_lock(&list_lock); | 53 | ... spin_lock(&list_lock); |
54 | if (atomic_dec_and_test(&el->rc)) ... | 54 | if (atomic_dec_and_test(&el->rc)) ... |
55 | call_rcu(&el->head, el_free); delete_element | 55 | call_rcu(&el->head, el_free); delete_element |
56 | ... write_unlock(&list_lock); | 56 | ... spin_unlock(&list_lock); |
57 | } ... | 57 | } ... |
58 | if (atomic_dec_and_test(&el->rc)) | 58 | if (atomic_dec_and_test(&el->rc)) |
59 | call_rcu(&el->head, el_free); | 59 | call_rcu(&el->head, el_free); |
diff --git a/Documentation/RCU/whatisRCU.txt b/Documentation/RCU/whatisRCU.txt index e04d643a9f57..96170824a717 100644 --- a/Documentation/RCU/whatisRCU.txt +++ b/Documentation/RCU/whatisRCU.txt | |||
@@ -786,8 +786,6 @@ RCU pointer/list traversal: | |||
786 | list_for_each_entry_rcu | 786 | list_for_each_entry_rcu |
787 | hlist_for_each_entry_rcu | 787 | hlist_for_each_entry_rcu |
788 | 788 | ||
789 | list_for_each_rcu (to be deprecated in favor of | ||
790 | list_for_each_entry_rcu) | ||
791 | list_for_each_continue_rcu (to be deprecated in favor of new | 789 | list_for_each_continue_rcu (to be deprecated in favor of new |
792 | list_for_each_entry_continue_rcu) | 790 | list_for_each_entry_continue_rcu) |
793 | 791 | ||
diff --git a/Documentation/SAK.txt b/Documentation/SAK.txt index b9019ca872ea..74be14679ed8 100644 --- a/Documentation/SAK.txt +++ b/Documentation/SAK.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | Linux 2.4.2 Secure Attention Key (SAK) handling | 1 | Linux 2.4.2 Secure Attention Key (SAK) handling |
2 | 18 March 2001, Andrew Morton <akpm@osdl.org> | 2 | 18 March 2001, Andrew Morton |
3 | 3 | ||
4 | An operating system's Secure Attention Key is a security tool which is | 4 | An operating system's Secure Attention Key is a security tool which is |
5 | provided as protection against trojan password capturing programs. It | 5 | provided as protection against trojan password capturing programs. It |
diff --git a/Documentation/SELinux.txt b/Documentation/SELinux.txt new file mode 100644 index 000000000000..07eae00f3314 --- /dev/null +++ b/Documentation/SELinux.txt | |||
@@ -0,0 +1,27 @@ | |||
1 | If you want to use SELinux, chances are you will want | ||
2 | to use the distro-provided policies, or install the | ||
3 | latest reference policy release from | ||
4 | http://oss.tresys.com/projects/refpolicy | ||
5 | |||
6 | However, if you want to install a dummy policy for | ||
7 | testing, you can do using 'mdp' provided under | ||
8 | scripts/selinux. Note that this requires the selinux | ||
9 | userspace to be installed - in particular you will | ||
10 | need checkpolicy to compile a kernel, and setfiles and | ||
11 | fixfiles to label the filesystem. | ||
12 | |||
13 | 1. Compile the kernel with selinux enabled. | ||
14 | 2. Type 'make' to compile mdp. | ||
15 | 3. Make sure that you are not running with | ||
16 | SELinux enabled and a real policy. If | ||
17 | you are, reboot with selinux disabled | ||
18 | before continuing. | ||
19 | 4. Run install_policy.sh: | ||
20 | cd scripts/selinux | ||
21 | sh install_policy.sh | ||
22 | |||
23 | Step 4 will create a new dummy policy valid for your | ||
24 | kernel, with a single selinux user, role, and type. | ||
25 | It will compile the policy, will set your SELINUXTYPE to | ||
26 | dummy in /etc/selinux/config, install the compiled policy | ||
27 | as 'dummy', and relabel your filesystem. | ||
diff --git a/Documentation/SubmitChecklist b/Documentation/SubmitChecklist index da10e0714241..ac5e0b2f1097 100644 --- a/Documentation/SubmitChecklist +++ b/Documentation/SubmitChecklist | |||
@@ -67,6 +67,8 @@ kernel patches. | |||
67 | 67 | ||
68 | 19: All new userspace interfaces are documented in Documentation/ABI/. | 68 | 19: All new userspace interfaces are documented in Documentation/ABI/. |
69 | See Documentation/ABI/README for more information. | 69 | See Documentation/ABI/README for more information. |
70 | Patches that change userspace interfaces should be CCed to | ||
71 | linux-api@vger.kernel.org. | ||
70 | 72 | ||
71 | 20: Check that it all passes `make headers_check'. | 73 | 20: Check that it all passes `make headers_check'. |
72 | 74 | ||
@@ -83,3 +85,6 @@ kernel patches. | |||
83 | 23: Tested after it has been merged into the -mm patchset to make sure | 85 | 23: Tested after it has been merged into the -mm patchset to make sure |
84 | that it still works with all of the other queued patches and various | 86 | that it still works with all of the other queued patches and various |
85 | changes in the VM, VFS, and other subsystems. | 87 | changes in the VM, VFS, and other subsystems. |
88 | |||
89 | 24: All memory barriers {e.g., barrier(), rmb(), wmb()} need a comment in the | ||
90 | source code that explains the logic of what they are doing and why. | ||
diff --git a/Documentation/SubmittingDrivers b/Documentation/SubmittingDrivers index 24f2eb40cae5..99e72a81fa2f 100644 --- a/Documentation/SubmittingDrivers +++ b/Documentation/SubmittingDrivers | |||
@@ -41,7 +41,7 @@ Linux 2.4: | |||
41 | Linux 2.6: | 41 | Linux 2.6: |
42 | The same rules apply as 2.4 except that you should follow linux-kernel | 42 | The same rules apply as 2.4 except that you should follow linux-kernel |
43 | to track changes in API's. The final contact point for Linux 2.6 | 43 | to track changes in API's. The final contact point for Linux 2.6 |
44 | submissions is Andrew Morton <akpm@osdl.org>. | 44 | submissions is Andrew Morton. |
45 | 45 | ||
46 | What Criteria Determine Acceptance | 46 | What Criteria Determine Acceptance |
47 | ---------------------------------- | 47 | ---------------------------------- |
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches index 118ca6e9404f..f309d3c6221c 100644 --- a/Documentation/SubmittingPatches +++ b/Documentation/SubmittingPatches | |||
@@ -77,7 +77,7 @@ Quilt: | |||
77 | http://savannah.nongnu.org/projects/quilt | 77 | http://savannah.nongnu.org/projects/quilt |
78 | 78 | ||
79 | Andrew Morton's patch scripts: | 79 | Andrew Morton's patch scripts: |
80 | http://www.zip.com.au/~akpm/linux/patches/ | 80 | http://userweb.kernel.org/~akpm/stuff/patch-scripts.tar.gz |
81 | Instead of these scripts, quilt is the recommended patch management | 81 | Instead of these scripts, quilt is the recommended patch management |
82 | tool (see above). | 82 | tool (see above). |
83 | 83 | ||
@@ -405,7 +405,7 @@ person it names. This tag documents that potentially interested parties | |||
405 | have been included in the discussion | 405 | have been included in the discussion |
406 | 406 | ||
407 | 407 | ||
408 | 14) Using Test-by: and Reviewed-by: | 408 | 14) Using Tested-by: and Reviewed-by: |
409 | 409 | ||
410 | A Tested-by: tag indicates that the patch has been successfully tested (in | 410 | A Tested-by: tag indicates that the patch has been successfully tested (in |
411 | some environment) by the person named. This tag informs maintainers that | 411 | some environment) by the person named. This tag informs maintainers that |
@@ -528,7 +528,33 @@ See more details on the proper patch format in the following | |||
528 | references. | 528 | references. |
529 | 529 | ||
530 | 530 | ||
531 | 16) Sending "git pull" requests (from Linus emails) | ||
531 | 532 | ||
533 | Please write the git repo address and branch name alone on the same line | ||
534 | so that I can't even by mistake pull from the wrong branch, and so | ||
535 | that a triple-click just selects the whole thing. | ||
536 | |||
537 | So the proper format is something along the lines of: | ||
538 | |||
539 | "Please pull from | ||
540 | |||
541 | git://jdelvare.pck.nerim.net/jdelvare-2.6 i2c-for-linus | ||
542 | |||
543 | to get these changes:" | ||
544 | |||
545 | so that I don't have to hunt-and-peck for the address and inevitably | ||
546 | get it wrong (actually, I've only gotten it wrong a few times, and | ||
547 | checking against the diffstat tells me when I get it wrong, but I'm | ||
548 | just a lot more comfortable when I don't have to "look for" the right | ||
549 | thing to pull, and double-check that I have the right branch-name). | ||
550 | |||
551 | |||
552 | Please use "git diff -M --stat --summary" to generate the diffstat: | ||
553 | the -M enables rename detection, and the summary enables a summary of | ||
554 | new/deleted or renamed files. | ||
555 | |||
556 | With rename detection, the statistics are rather different [...] | ||
557 | because git will notice that a fair number of the changes are renames. | ||
532 | 558 | ||
533 | ----------------------------------- | 559 | ----------------------------------- |
534 | SECTION 2 - HINTS, TIPS, AND TRICKS | 560 | SECTION 2 - HINTS, TIPS, AND TRICKS |
@@ -627,7 +653,7 @@ SECTION 3 - REFERENCES | |||
627 | ---------------------- | 653 | ---------------------- |
628 | 654 | ||
629 | Andrew Morton, "The perfect patch" (tpp). | 655 | Andrew Morton, "The perfect patch" (tpp). |
630 | <http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt> | 656 | <http://userweb.kernel.org/~akpm/stuff/tpp.txt> |
631 | 657 | ||
632 | Jeff Garzik, "Linux kernel patch submission format". | 658 | Jeff Garzik, "Linux kernel patch submission format". |
633 | <http://linux.yyz.us/patch-format.html> | 659 | <http://linux.yyz.us/patch-format.html> |
@@ -646,4 +672,9 @@ Kernel Documentation/CodingStyle: | |||
646 | 672 | ||
647 | Linus Torvalds's mail on the canonical patch format: | 673 | Linus Torvalds's mail on the canonical patch format: |
648 | <http://lkml.org/lkml/2005/4/7/183> | 674 | <http://lkml.org/lkml/2005/4/7/183> |
675 | |||
676 | Andi Kleen, "On submitting kernel patches" | ||
677 | Some strategies to get difficult or controversal changes in. | ||
678 | http://halobates.de/on-submitting-patches.pdf | ||
679 | |||
649 | -- | 680 | -- |
diff --git a/Documentation/accounting/Makefile b/Documentation/accounting/Makefile new file mode 100644 index 000000000000..31929eb875b1 --- /dev/null +++ b/Documentation/accounting/Makefile | |||
@@ -0,0 +1,10 @@ | |||
1 | # kbuild trick to avoid linker error. Can be omitted if a module is built. | ||
2 | obj- := dummy.o | ||
3 | |||
4 | # List of programs to build | ||
5 | hostprogs-y := getdelays | ||
6 | |||
7 | # Tell kbuild to always build the programs | ||
8 | always := $(hostprogs-y) | ||
9 | |||
10 | HOSTCFLAGS_getdelays.o += -I$(objtree)/usr/include | ||
diff --git a/Documentation/accounting/delay-accounting.txt b/Documentation/accounting/delay-accounting.txt index 1443cd71d263..8a12f0730c94 100644 --- a/Documentation/accounting/delay-accounting.txt +++ b/Documentation/accounting/delay-accounting.txt | |||
@@ -11,6 +11,7 @@ the delays experienced by a task while | |||
11 | a) waiting for a CPU (while being runnable) | 11 | a) waiting for a CPU (while being runnable) |
12 | b) completion of synchronous block I/O initiated by the task | 12 | b) completion of synchronous block I/O initiated by the task |
13 | c) swapping in pages | 13 | c) swapping in pages |
14 | d) memory reclaim | ||
14 | 15 | ||
15 | and makes these statistics available to userspace through | 16 | and makes these statistics available to userspace through |
16 | the taskstats interface. | 17 | the taskstats interface. |
@@ -41,7 +42,7 @@ this structure. See | |||
41 | include/linux/taskstats.h | 42 | include/linux/taskstats.h |
42 | for a description of the fields pertaining to delay accounting. | 43 | for a description of the fields pertaining to delay accounting. |
43 | It will generally be in the form of counters returning the cumulative | 44 | It will generally be in the form of counters returning the cumulative |
44 | delay seen for cpu, sync block I/O, swapin etc. | 45 | delay seen for cpu, sync block I/O, swapin, memory reclaim etc. |
45 | 46 | ||
46 | Taking the difference of two successive readings of a given | 47 | Taking the difference of two successive readings of a given |
47 | counter (say cpu_delay_total) for a task will give the delay | 48 | counter (say cpu_delay_total) for a task will give the delay |
@@ -94,7 +95,9 @@ CPU count real total virtual total delay total | |||
94 | 7876 92005750 100000000 24001500 | 95 | 7876 92005750 100000000 24001500 |
95 | IO count delay total | 96 | IO count delay total |
96 | 0 0 | 97 | 0 0 |
97 | MEM count delay total | 98 | SWAP count delay total |
99 | 0 0 | ||
100 | RECLAIM count delay total | ||
98 | 0 0 | 101 | 0 0 |
99 | 102 | ||
100 | Get delays seen in executing a given simple command | 103 | Get delays seen in executing a given simple command |
@@ -108,5 +111,7 @@ CPU count real total virtual total delay total | |||
108 | 6 4000250 4000000 0 | 111 | 6 4000250 4000000 0 |
109 | IO count delay total | 112 | IO count delay total |
110 | 0 0 | 113 | 0 0 |
111 | MEM count delay total | 114 | SWAP count delay total |
115 | 0 0 | ||
116 | RECLAIM count delay total | ||
112 | 0 0 | 117 | 0 0 |
diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c index 40121b5cca14..cc49400b4af8 100644 --- a/Documentation/accounting/getdelays.c +++ b/Documentation/accounting/getdelays.c | |||
@@ -196,14 +196,24 @@ void print_delayacct(struct taskstats *t) | |||
196 | " %15llu%15llu%15llu%15llu\n" | 196 | " %15llu%15llu%15llu%15llu\n" |
197 | "IO %15s%15s\n" | 197 | "IO %15s%15s\n" |
198 | " %15llu%15llu\n" | 198 | " %15llu%15llu\n" |
199 | "MEM %15s%15s\n" | 199 | "SWAP %15s%15s\n" |
200 | " %15llu%15llu\n" | ||
201 | "RECLAIM %12s%15s\n" | ||
200 | " %15llu%15llu\n", | 202 | " %15llu%15llu\n", |
201 | "count", "real total", "virtual total", "delay total", | 203 | "count", "real total", "virtual total", "delay total", |
202 | t->cpu_count, t->cpu_run_real_total, t->cpu_run_virtual_total, | 204 | (unsigned long long)t->cpu_count, |
203 | t->cpu_delay_total, | 205 | (unsigned long long)t->cpu_run_real_total, |
206 | (unsigned long long)t->cpu_run_virtual_total, | ||
207 | (unsigned long long)t->cpu_delay_total, | ||
208 | "count", "delay total", | ||
209 | (unsigned long long)t->blkio_count, | ||
210 | (unsigned long long)t->blkio_delay_total, | ||
211 | "count", "delay total", | ||
212 | (unsigned long long)t->swapin_count, | ||
213 | (unsigned long long)t->swapin_delay_total, | ||
204 | "count", "delay total", | 214 | "count", "delay total", |
205 | t->blkio_count, t->blkio_delay_total, | 215 | (unsigned long long)t->freepages_count, |
206 | "count", "delay total", t->swapin_count, t->swapin_delay_total); | 216 | (unsigned long long)t->freepages_delay_total); |
207 | } | 217 | } |
208 | 218 | ||
209 | void task_context_switch_counts(struct taskstats *t) | 219 | void task_context_switch_counts(struct taskstats *t) |
@@ -211,14 +221,17 @@ void task_context_switch_counts(struct taskstats *t) | |||
211 | printf("\n\nTask %15s%15s\n" | 221 | printf("\n\nTask %15s%15s\n" |
212 | " %15llu%15llu\n", | 222 | " %15llu%15llu\n", |
213 | "voluntary", "nonvoluntary", | 223 | "voluntary", "nonvoluntary", |
214 | t->nvcsw, t->nivcsw); | 224 | (unsigned long long)t->nvcsw, (unsigned long long)t->nivcsw); |
215 | } | 225 | } |
216 | 226 | ||
217 | void print_cgroupstats(struct cgroupstats *c) | 227 | void print_cgroupstats(struct cgroupstats *c) |
218 | { | 228 | { |
219 | printf("sleeping %llu, blocked %llu, running %llu, stopped %llu, " | 229 | printf("sleeping %llu, blocked %llu, running %llu, stopped %llu, " |
220 | "uninterruptible %llu\n", c->nr_sleeping, c->nr_io_wait, | 230 | "uninterruptible %llu\n", (unsigned long long)c->nr_sleeping, |
221 | c->nr_running, c->nr_stopped, c->nr_uninterruptible); | 231 | (unsigned long long)c->nr_io_wait, |
232 | (unsigned long long)c->nr_running, | ||
233 | (unsigned long long)c->nr_stopped, | ||
234 | (unsigned long long)c->nr_uninterruptible); | ||
222 | } | 235 | } |
223 | 236 | ||
224 | 237 | ||
diff --git a/Documentation/accounting/taskstats-struct.txt b/Documentation/accounting/taskstats-struct.txt index cd784f46bf8a..e7512c061c15 100644 --- a/Documentation/accounting/taskstats-struct.txt +++ b/Documentation/accounting/taskstats-struct.txt | |||
@@ -6,7 +6,7 @@ This document contains an explanation of the struct taskstats fields. | |||
6 | There are three different groups of fields in the struct taskstats: | 6 | There are three different groups of fields in the struct taskstats: |
7 | 7 | ||
8 | 1) Common and basic accounting fields | 8 | 1) Common and basic accounting fields |
9 | If CONFIG_TASKSTATS is set, the taskstats inteface is enabled and | 9 | If CONFIG_TASKSTATS is set, the taskstats interface is enabled and |
10 | the common fields and basic accounting fields are collected for | 10 | the common fields and basic accounting fields are collected for |
11 | delivery at do_exit() of a task. | 11 | delivery at do_exit() of a task. |
12 | 2) Delay accounting fields | 12 | 2) Delay accounting fields |
@@ -26,6 +26,8 @@ There are three different groups of fields in the struct taskstats: | |||
26 | 26 | ||
27 | 5) Time accounting for SMT machines | 27 | 5) Time accounting for SMT machines |
28 | 28 | ||
29 | 6) Extended delay accounting fields for memory reclaim | ||
30 | |||
29 | Future extension should add fields to the end of the taskstats struct, and | 31 | Future extension should add fields to the end of the taskstats struct, and |
30 | should not change the relative position of each field within the struct. | 32 | should not change the relative position of each field within the struct. |
31 | 33 | ||
@@ -170,4 +172,9 @@ struct taskstats { | |||
170 | __u64 ac_utimescaled; /* utime scaled on frequency etc */ | 172 | __u64 ac_utimescaled; /* utime scaled on frequency etc */ |
171 | __u64 ac_stimescaled; /* stime scaled on frequency etc */ | 173 | __u64 ac_stimescaled; /* stime scaled on frequency etc */ |
172 | __u64 cpu_scaled_run_real_total; /* scaled cpu_run_real_total */ | 174 | __u64 cpu_scaled_run_real_total; /* scaled cpu_run_real_total */ |
175 | |||
176 | 6) Extended delay accounting fields for memory reclaim | ||
177 | /* Delay waiting for memory reclaim */ | ||
178 | __u64 freepages_count; | ||
179 | __u64 freepages_delay_total; | ||
173 | } | 180 | } |
diff --git a/Documentation/arm/IXP4xx b/Documentation/arm/IXP4xx index 43edb4ecf27d..72fbcc4fcab0 100644 --- a/Documentation/arm/IXP4xx +++ b/Documentation/arm/IXP4xx | |||
@@ -32,7 +32,7 @@ Linux currently supports the following features on the IXP4xx chips: | |||
32 | - Flash access (MTD/JFFS) | 32 | - Flash access (MTD/JFFS) |
33 | - I2C through GPIO on IXP42x | 33 | - I2C through GPIO on IXP42x |
34 | - GPIO for input/output/interrupts | 34 | - GPIO for input/output/interrupts |
35 | See include/asm-arm/arch-ixp4xx/platform.h for access functions. | 35 | See arch/arm/mach-ixp4xx/include/mach/platform.h for access functions. |
36 | - Timers (watchdog, OS) | 36 | - Timers (watchdog, OS) |
37 | 37 | ||
38 | The following components of the chips are not supported by Linux and | 38 | The following components of the chips are not supported by Linux and |
diff --git a/Documentation/arm/Interrupts b/Documentation/arm/Interrupts index 0d3dbf1099bc..f09ab1b90ef1 100644 --- a/Documentation/arm/Interrupts +++ b/Documentation/arm/Interrupts | |||
@@ -138,14 +138,8 @@ So, what's changed? | |||
138 | 138 | ||
139 | Set active the IRQ edge(s)/level. This replaces the | 139 | Set active the IRQ edge(s)/level. This replaces the |
140 | SA1111 INTPOL manipulation, and the set_GPIO_IRQ_edge() | 140 | SA1111 INTPOL manipulation, and the set_GPIO_IRQ_edge() |
141 | function. Type should be one of the following: | 141 | function. Type should be one of IRQ_TYPE_xxx defined in |
142 | 142 | <linux/irq.h> | |
143 | #define IRQT_NOEDGE (0) | ||
144 | #define IRQT_RISING (__IRQT_RISEDGE) | ||
145 | #define IRQT_FALLING (__IRQT_FALEDGE) | ||
146 | #define IRQT_BOTHEDGE (__IRQT_RISEDGE|__IRQT_FALEDGE) | ||
147 | #define IRQT_LOW (__IRQT_LOWLVL) | ||
148 | #define IRQT_HIGH (__IRQT_HIGHLVL) | ||
149 | 143 | ||
150 | 3. set_GPIO_IRQ_edge() is obsolete, and should be replaced by set_irq_type. | 144 | 3. set_GPIO_IRQ_edge() is obsolete, and should be replaced by set_irq_type. |
151 | 145 | ||
@@ -164,7 +158,7 @@ So, what's changed? | |||
164 | be re-checked for pending events. (see the Neponset IRQ handler for | 158 | be re-checked for pending events. (see the Neponset IRQ handler for |
165 | details). | 159 | details). |
166 | 160 | ||
167 | 7. fixup_irq() is gone, as is include/asm-arm/arch-*/irq.h | 161 | 7. fixup_irq() is gone, as is arch/arm/mach-*/include/mach/irq.h |
168 | 162 | ||
169 | Please note that this will not solve all problems - some of them are | 163 | Please note that this will not solve all problems - some of them are |
170 | hardware based. Mixing level-based and edge-based IRQs on the same | 164 | hardware based. Mixing level-based and edge-based IRQs on the same |
diff --git a/Documentation/arm/README b/Documentation/arm/README index 9b9c8226fdc4..d98783fbe0c7 100644 --- a/Documentation/arm/README +++ b/Documentation/arm/README | |||
@@ -79,7 +79,7 @@ Machine/Platform support | |||
79 | To this end, we now have arch/arm/mach-$(MACHINE) directories which are | 79 | To this end, we now have arch/arm/mach-$(MACHINE) directories which are |
80 | designed to house the non-driver files for a particular machine (eg, PCI, | 80 | designed to house the non-driver files for a particular machine (eg, PCI, |
81 | memory management, architecture definitions etc). For all future | 81 | memory management, architecture definitions etc). For all future |
82 | machines, there should be a corresponding include/asm-arm/arch-$(MACHINE) | 82 | machines, there should be a corresponding arch/arm/mach-$(MACHINE)/include/mach |
83 | directory. | 83 | directory. |
84 | 84 | ||
85 | 85 | ||
@@ -176,7 +176,7 @@ Kernel entry (head.S) | |||
176 | class typically based around one or more system on a chip devices, and | 176 | class typically based around one or more system on a chip devices, and |
177 | acts as a natural container around the actual implementations. These | 177 | acts as a natural container around the actual implementations. These |
178 | classes are given directories - arch/arm/mach-<class> and | 178 | classes are given directories - arch/arm/mach-<class> and |
179 | include/asm-arm/arch-<class> - which contain the source files to | 179 | arch/arm/mach-<class> - which contain the source files to/include/mach |
180 | support the machine class. This directories also contain any machine | 180 | support the machine class. This directories also contain any machine |
181 | specific supporting code. | 181 | specific supporting code. |
182 | 182 | ||
diff --git a/Documentation/arm/Samsung-S3C24XX/GPIO.txt b/Documentation/arm/Samsung-S3C24XX/GPIO.txt index 8caea8c237ee..ea7ccfc4b274 100644 --- a/Documentation/arm/Samsung-S3C24XX/GPIO.txt +++ b/Documentation/arm/Samsung-S3C24XX/GPIO.txt | |||
@@ -13,16 +13,31 @@ Introduction | |||
13 | data-sheet/users manual to find out the complete list. | 13 | data-sheet/users manual to find out the complete list. |
14 | 14 | ||
15 | 15 | ||
16 | GPIOLIB | ||
17 | ------- | ||
18 | |||
19 | With the event of the GPIOLIB in drivers/gpio, support for some | ||
20 | of the GPIO functions such as reading and writing a pin will | ||
21 | be removed in favour of this common access method. | ||
22 | |||
23 | Once all the extant drivers have been converted, the functions | ||
24 | listed below will be removed (they may be marked as __deprecated | ||
25 | in the near future). | ||
26 | |||
27 | - s3c2410_gpio_getpin | ||
28 | - s3c2410_gpio_setpin | ||
29 | |||
30 | |||
16 | Headers | 31 | Headers |
17 | ------- | 32 | ------- |
18 | 33 | ||
19 | See include/asm-arm/arch-s3c2410/regs-gpio.h for the list | 34 | See arch/arm/mach-s3c2410/include/mach/regs-gpio.h for the list |
20 | of GPIO pins, and the configuration values for them. This | 35 | of GPIO pins, and the configuration values for them. This |
21 | is included by using #include <asm/arch/regs-gpio.h> | 36 | is included by using #include <mach/regs-gpio.h> |
22 | 37 | ||
23 | The GPIO management functions are defined in the hardware | 38 | The GPIO management functions are defined in the hardware |
24 | header include/asm-arm/arch-s3c2410/hardware.h which can be | 39 | header arch/arm/mach-s3c2410/include/mach/hardware.h which can be |
25 | included by #include <asm/arch/hardware.h> | 40 | included by #include <mach/hardware.h> |
26 | 41 | ||
27 | A useful amount of documentation can be found in the hardware | 42 | A useful amount of documentation can be found in the hardware |
28 | header on how the GPIO functions (and others) work. | 43 | header on how the GPIO functions (and others) work. |
diff --git a/Documentation/arm/Samsung-S3C24XX/Overview.txt b/Documentation/arm/Samsung-S3C24XX/Overview.txt index d04e1e30c47f..cff6227b4484 100644 --- a/Documentation/arm/Samsung-S3C24XX/Overview.txt +++ b/Documentation/arm/Samsung-S3C24XX/Overview.txt | |||
@@ -8,9 +8,10 @@ Introduction | |||
8 | 8 | ||
9 | The Samsung S3C24XX range of ARM9 System-on-Chip CPUs are supported | 9 | The Samsung S3C24XX range of ARM9 System-on-Chip CPUs are supported |
10 | by the 's3c2410' architecture of ARM Linux. Currently the S3C2410, | 10 | by the 's3c2410' architecture of ARM Linux. Currently the S3C2410, |
11 | S3C2412, S3C2413, S3C2440 and S3C2442 devices are supported. | 11 | S3C2412, S3C2413, S3C2440, S3C2442 and S3C2443 devices are supported. |
12 | |||
13 | Support for the S3C2400 and S3C24A0 series are in progress. | ||
12 | 14 | ||
13 | Support for the S3C2400 series is in progress. | ||
14 | 15 | ||
15 | Configuration | 16 | Configuration |
16 | ------------- | 17 | ------------- |
@@ -36,7 +37,23 @@ Layout | |||
36 | in arch/arm/mach-s3c2410 and S3C2440 in arch/arm/mach-s3c2440 | 37 | in arch/arm/mach-s3c2410 and S3C2440 in arch/arm/mach-s3c2440 |
37 | 38 | ||
38 | Register, kernel and platform data definitions are held in the | 39 | Register, kernel and platform data definitions are held in the |
39 | include/asm-arm/arch-s3c2410 directory. | 40 | arch/arm/mach-s3c2410 directory./include/mach |
41 | |||
42 | arch/arm/plat-s3c24xx: | ||
43 | |||
44 | Files in here are either common to all the s3c24xx family, | ||
45 | or are common to only some of them with names to indicate this | ||
46 | status. The files that are not common to all are generally named | ||
47 | with the initial cpu they support in the series to ensure a short | ||
48 | name without any possibility of confusion with newer devices. | ||
49 | |||
50 | As an example, initially s3c244x would cover s3c2440 and s3c2442, but | ||
51 | with the s3c2443 which does not share many of the same drivers in | ||
52 | this directory, the name becomes invalid. We stick to s3c2440-<x> | ||
53 | to indicate a driver that is s3c2440 and s3c2442 compatible. | ||
54 | |||
55 | This does mean that to find the status of any given SoC, a number | ||
56 | of directories may need to be searched. | ||
40 | 57 | ||
41 | 58 | ||
42 | Machines | 59 | Machines |
@@ -159,6 +176,17 @@ NAND | |||
159 | For more information see Documentation/arm/Samsung-S3C24XX/NAND.txt | 176 | For more information see Documentation/arm/Samsung-S3C24XX/NAND.txt |
160 | 177 | ||
161 | 178 | ||
179 | SD/MMC | ||
180 | ------ | ||
181 | |||
182 | The SD/MMC hardware pre S3C2443 is supported in the current | ||
183 | kernel, the driver is drivers/mmc/host/s3cmci.c and supports | ||
184 | 1 and 4 bit SD or MMC cards. | ||
185 | |||
186 | The SDIO behaviour of this driver has not been fully tested. There is no | ||
187 | current support for hardware SDIO interrupts. | ||
188 | |||
189 | |||
162 | Serial | 190 | Serial |
163 | ------ | 191 | ------ |
164 | 192 | ||
@@ -178,6 +206,9 @@ GPIO | |||
178 | The core contains support for manipulating the GPIO, see the | 206 | The core contains support for manipulating the GPIO, see the |
179 | documentation in GPIO.txt in the same directory as this file. | 207 | documentation in GPIO.txt in the same directory as this file. |
180 | 208 | ||
209 | Newer kernels carry GPIOLIB, and support is being moved towards | ||
210 | this with some of the older support in line to be removed. | ||
211 | |||
181 | 212 | ||
182 | Clock Management | 213 | Clock Management |
183 | ---------------- | 214 | ---------------- |
diff --git a/Documentation/arm/Samsung-S3C24XX/USB-Host.txt b/Documentation/arm/Samsung-S3C24XX/USB-Host.txt index b93b68e2b143..67671eba4231 100644 --- a/Documentation/arm/Samsung-S3C24XX/USB-Host.txt +++ b/Documentation/arm/Samsung-S3C24XX/USB-Host.txt | |||
@@ -49,7 +49,7 @@ Board Support | |||
49 | Platform Data | 49 | Platform Data |
50 | ------------- | 50 | ------------- |
51 | 51 | ||
52 | See linux/include/asm-arm/arch-s3c2410/usb-control.h for the | 52 | See arch/arm/mach-s3c2410/include/mach/usb-control.h for the |
53 | descriptions of the platform device data. An implementation | 53 | descriptions of the platform device data. An implementation |
54 | can be found in linux/arch/arm/mach-s3c2410/usb-simtec.c . | 54 | can be found in linux/arch/arm/mach-s3c2410/usb-simtec.c . |
55 | 55 | ||
diff --git a/Documentation/auxdisplay/Makefile b/Documentation/auxdisplay/Makefile new file mode 100644 index 000000000000..51fe23332c81 --- /dev/null +++ b/Documentation/auxdisplay/Makefile | |||
@@ -0,0 +1,10 @@ | |||
1 | # kbuild trick to avoid linker error. Can be omitted if a module is built. | ||
2 | obj- := dummy.o | ||
3 | |||
4 | # List of programs to build | ||
5 | hostprogs-y := cfag12864b-example | ||
6 | |||
7 | # Tell kbuild to always build the programs | ||
8 | always := $(hostprogs-y) | ||
9 | |||
10 | HOSTCFLAGS_cfag12864b-example.o += -I$(objtree)/usr/include | ||
diff --git a/Documentation/blackfin/kgdb.txt b/Documentation/blackfin/kgdb.txt deleted file mode 100644 index 84f6a484ae9a..000000000000 --- a/Documentation/blackfin/kgdb.txt +++ /dev/null | |||
@@ -1,155 +0,0 @@ | |||
1 | A Simple Guide to Configure KGDB | ||
2 | |||
3 | Sonic Zhang <sonic.zhang@analog.com> | ||
4 | Aug. 24th 2006 | ||
5 | |||
6 | |||
7 | This KGDB patch enables the kernel developer to do source level debugging on | ||
8 | the kernel for the Blackfin architecture. The debugging works over either the | ||
9 | ethernet interface or one of the uarts. Both software breakpoints and | ||
10 | hardware breakpoints are supported in this version. | ||
11 | http://docs.blackfin.uclinux.org/doku.php?id=kgdb | ||
12 | |||
13 | |||
14 | 2 known issues: | ||
15 | 1. This bug: | ||
16 | http://blackfin.uclinux.org/tracker/index.php?func=detail&aid=544&group_id=18&atid=145 | ||
17 | The GDB client for Blackfin uClinux causes incorrect values of local | ||
18 | variables to be displayed when the user breaks the running of kernel in GDB. | ||
19 | 2. Because of a hardware bug in Blackfin 533 v1.0.3: | ||
20 | 05000067 - Watchpoints (Hardware Breakpoints) are not supported | ||
21 | Hardware breakpoints cannot be set properly. | ||
22 | |||
23 | |||
24 | Debug over Ethernet: | ||
25 | |||
26 | 1. Compile and install the cross platform version of gdb for blackfin, which | ||
27 | can be found at $(BINROOT)/bfin-elf-gdb. | ||
28 | |||
29 | 2. Apply this patch to the 2.6.x kernel. Select the menuconfig option under | ||
30 | "Kernel hacking" -> "Kernel debugging" -> "KGDB: kernel debug with remote gdb". | ||
31 | With this selected, option "Full Symbolic/Source Debugging support" and | ||
32 | "Compile the kernel with frame pointers" are also selected. | ||
33 | |||
34 | 3. Select option "KGDB: connect over (Ethernet)". Add "kgdboe=@target-IP/,@host-IP/" to | ||
35 | the option "Compiled-in Kernel Boot Parameter" under "Kernel hacking". | ||
36 | |||
37 | 4. Connect minicom to the serial port and boot the kernel image. | ||
38 | |||
39 | 5. Configure the IP "/> ifconfig eth0 target-IP" | ||
40 | |||
41 | 6. Start GDB client "bfin-elf-gdb vmlinux". | ||
42 | |||
43 | 7. Connect to the target "(gdb) target remote udp:target-IP:6443". | ||
44 | |||
45 | 8. Set software breakpoint "(gdb) break sys_open". | ||
46 | |||
47 | 9. Continue "(gdb) c". | ||
48 | |||
49 | 10. Run ls in the target console "/> ls". | ||
50 | |||
51 | 11. Breakpoint hits. "Breakpoint 1: sys_open(..." | ||
52 | |||
53 | 12. Display local variables and function paramters. | ||
54 | (*) This operation gives wrong results, see known issue 1. | ||
55 | |||
56 | 13. Single stepping "(gdb) si". | ||
57 | |||
58 | 14. Remove breakpoint 1. "(gdb) del 1" | ||
59 | |||
60 | 15. Set hardware breakpoint "(gdb) hbreak sys_open". | ||
61 | |||
62 | 16. Continue "(gdb) c". | ||
63 | |||
64 | 17. Run ls in the target console "/> ls". | ||
65 | |||
66 | 18. Hardware breakpoint hits. "Breakpoint 1: sys_open(...". | ||
67 | (*) This hardware breakpoint will not be hit, see known issue 2. | ||
68 | |||
69 | 19. Continue "(gdb) c". | ||
70 | |||
71 | 20. Interrupt the target in GDB "Ctrl+C". | ||
72 | |||
73 | 21. Detach from the target "(gdb) detach". | ||
74 | |||
75 | 22. Exit GDB "(gdb) quit". | ||
76 | |||
77 | |||
78 | Debug over the UART: | ||
79 | |||
80 | 1. Compile and install the cross platform version of gdb for blackfin, which | ||
81 | can be found at $(BINROOT)/bfin-elf-gdb. | ||
82 | |||
83 | 2. Apply this patch to the 2.6.x kernel. Select the menuconfig option under | ||
84 | "Kernel hacking" -> "Kernel debugging" -> "KGDB: kernel debug with remote gdb". | ||
85 | With this selected, option "Full Symbolic/Source Debugging support" and | ||
86 | "Compile the kernel with frame pointers" are also selected. | ||
87 | |||
88 | 3. Select option "KGDB: connect over (UART)". Set "KGDB: UART port number" to be | ||
89 | a different one from the console. Don't forget to change the mode of | ||
90 | blackfin serial driver to PIO. Otherwise kgdb works incorrectly on UART. | ||
91 | |||
92 | 4. If you want connect to kgdb when the kernel boots, enable | ||
93 | "KGDB: Wait for gdb connection early" | ||
94 | |||
95 | 5. Compile kernel. | ||
96 | |||
97 | 6. Connect minicom to the serial port of the console and boot the kernel image. | ||
98 | |||
99 | 7. Start GDB client "bfin-elf-gdb vmlinux". | ||
100 | |||
101 | 8. Set the baud rate in GDB "(gdb) set remotebaud 57600". | ||
102 | |||
103 | 9. Connect to the target on the second serial port "(gdb) target remote /dev/ttyS1". | ||
104 | |||
105 | 10. Set software breakpoint "(gdb) break sys_open". | ||
106 | |||
107 | 11. Continue "(gdb) c". | ||
108 | |||
109 | 12. Run ls in the target console "/> ls". | ||
110 | |||
111 | 13. A breakpoint is hit. "Breakpoint 1: sys_open(..." | ||
112 | |||
113 | 14. All other operations are the same as that in KGDB over Ethernet. | ||
114 | |||
115 | |||
116 | Debug over the same UART as console: | ||
117 | |||
118 | 1. Compile and install the cross platform version of gdb for blackfin, which | ||
119 | can be found at $(BINROOT)/bfin-elf-gdb. | ||
120 | |||
121 | 2. Apply this patch to the 2.6.x kernel. Select the menuconfig option under | ||
122 | "Kernel hacking" -> "Kernel debugging" -> "KGDB: kernel debug with remote gdb". | ||
123 | With this selected, option "Full Symbolic/Source Debugging support" and | ||
124 | "Compile the kernel with frame pointers" are also selected. | ||
125 | |||
126 | 3. Select option "KGDB: connect over UART". Set "KGDB: UART port number" to console. | ||
127 | Don't forget to change the mode of blackfin serial driver to PIO. | ||
128 | Otherwise kgdb works incorrectly on UART. | ||
129 | |||
130 | 4. If you want connect to kgdb when the kernel boots, enable | ||
131 | "KGDB: Wait for gdb connection early" | ||
132 | |||
133 | 5. Connect minicom to the serial port and boot the kernel image. | ||
134 | |||
135 | 6. (Optional) Ask target to wait for gdb connection by entering Ctrl+A. In minicom, you should enter Ctrl+A+A. | ||
136 | |||
137 | 7. Start GDB client "bfin-elf-gdb vmlinux". | ||
138 | |||
139 | 8. Set the baud rate in GDB "(gdb) set remotebaud 57600". | ||
140 | |||
141 | 9. Connect to the target "(gdb) target remote /dev/ttyS0". | ||
142 | |||
143 | 10. Set software breakpoint "(gdb) break sys_open". | ||
144 | |||
145 | 11. Continue "(gdb) c". Then enter Ctrl+C twice to stop GDB connection. | ||
146 | |||
147 | 12. Run ls in the target console "/> ls". Dummy string can be seen on the console. | ||
148 | |||
149 | 13. Then connect the gdb to target again. "(gdb) target remote /dev/ttyS0". | ||
150 | Now you will find a breakpoint is hit. "Breakpoint 1: sys_open(..." | ||
151 | |||
152 | 14. All other operations are the same as that in KGDB over Ethernet. The only | ||
153 | difference is that after continue command in GDB, please stop GDB | ||
154 | connection by 2 "Ctrl+C"s and connect again after breakpoints are hit or | ||
155 | Ctrl+A is entered. | ||
diff --git a/Documentation/block/data-integrity.txt b/Documentation/block/data-integrity.txt index e9dc8d86adc7..e8ca040ba2cf 100644 --- a/Documentation/block/data-integrity.txt +++ b/Documentation/block/data-integrity.txt | |||
@@ -246,7 +246,7 @@ will require extra work due to the application tag. | |||
246 | retrieve the tag buffer using bio_integrity_get_tag(). | 246 | retrieve the tag buffer using bio_integrity_get_tag(). |
247 | 247 | ||
248 | 248 | ||
249 | 6.3 PASSING EXISTING INTEGRITY METADATA | 249 | 5.3 PASSING EXISTING INTEGRITY METADATA |
250 | 250 | ||
251 | Filesystems that either generate their own integrity metadata or | 251 | Filesystems that either generate their own integrity metadata or |
252 | are capable of transferring IMD from user space can use the | 252 | are capable of transferring IMD from user space can use the |
@@ -283,7 +283,7 @@ will require extra work due to the application tag. | |||
283 | integrity upon completion. | 283 | integrity upon completion. |
284 | 284 | ||
285 | 285 | ||
286 | 6.4 REGISTERING A BLOCK DEVICE AS CAPABLE OF EXCHANGING INTEGRITY | 286 | 5.4 REGISTERING A BLOCK DEVICE AS CAPABLE OF EXCHANGING INTEGRITY |
287 | METADATA | 287 | METADATA |
288 | 288 | ||
289 | To enable integrity exchange on a block device the gendisk must be | 289 | To enable integrity exchange on a block device the gendisk must be |
diff --git a/Documentation/block/deadline-iosched.txt b/Documentation/block/deadline-iosched.txt index c23cab13c3d1..72576769e0f4 100644 --- a/Documentation/block/deadline-iosched.txt +++ b/Documentation/block/deadline-iosched.txt | |||
@@ -30,12 +30,18 @@ write_expire (in ms) | |||
30 | Similar to read_expire mentioned above, but for writes. | 30 | Similar to read_expire mentioned above, but for writes. |
31 | 31 | ||
32 | 32 | ||
33 | fifo_batch | 33 | fifo_batch (number of requests) |
34 | ---------- | 34 | ---------- |
35 | 35 | ||
36 | When a read request expires its deadline, we must move some requests from | 36 | Requests are grouped into ``batches'' of a particular data direction (read or |
37 | the sorted io scheduler list to the block device dispatch queue. fifo_batch | 37 | write) which are serviced in increasing sector order. To limit extra seeking, |
38 | controls how many requests we move. | 38 | deadline expiries are only checked between batches. fifo_batch controls the |
39 | maximum number of requests per batch. | ||
40 | |||
41 | This parameter tunes the balance between per-request latency and aggregate | ||
42 | throughput. When low latency is the primary concern, smaller is better (where | ||
43 | a value of 1 yields first-come first-served behaviour). Increasing fifo_batch | ||
44 | generally improves throughput, at the cost of latency variation. | ||
39 | 45 | ||
40 | 46 | ||
41 | writes_starved (number of dispatches) | 47 | writes_starved (number of dispatches) |
diff --git a/Documentation/bt8xxgpio.txt b/Documentation/bt8xxgpio.txt new file mode 100644 index 000000000000..d8297e4ebd26 --- /dev/null +++ b/Documentation/bt8xxgpio.txt | |||
@@ -0,0 +1,67 @@ | |||
1 | =============================================================== | ||
2 | == BT8XXGPIO driver == | ||
3 | == == | ||
4 | == A driver for a selfmade cheap BT8xx based PCI GPIO-card == | ||
5 | == == | ||
6 | == For advanced documentation, see == | ||
7 | == http://www.bu3sch.de/btgpio.php == | ||
8 | =============================================================== | ||
9 | |||
10 | |||
11 | A generic digital 24-port PCI GPIO card can be built out of an ordinary | ||
12 | Brooktree bt848, bt849, bt878 or bt879 based analog TV tuner card. The | ||
13 | Brooktree chip is used in old analog Hauppauge WinTV PCI cards. You can easily | ||
14 | find them used for low prices on the net. | ||
15 | |||
16 | The bt8xx chip does have 24 digital GPIO ports. | ||
17 | These ports are accessible via 24 pins on the SMD chip package. | ||
18 | |||
19 | |||
20 | ============================================== | ||
21 | == How to physically access the GPIO pins == | ||
22 | ============================================== | ||
23 | |||
24 | The are several ways to access these pins. One might unsolder the whole chip | ||
25 | and put it on a custom PCI board, or one might only unsolder each individual | ||
26 | GPIO pin and solder that to some tiny wire. As the chip package really is tiny | ||
27 | there are some advanced soldering skills needed in any case. | ||
28 | |||
29 | The physical pinouts are drawn in the following ASCII art. | ||
30 | The GPIO pins are marked with G00-G23 | ||
31 | |||
32 | G G G G G G G G G G G G G G G G G G | ||
33 | 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 | ||
34 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 | ||
35 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ||
36 | --------------------------------------------------------------------------- | ||
37 | --| ^ ^ |-- | ||
38 | --| pin 86 pin 67 |-- | ||
39 | --| |-- | ||
40 | --| pin 61 > |-- G18 | ||
41 | --| |-- G19 | ||
42 | --| |-- G20 | ||
43 | --| |-- G21 | ||
44 | --| |-- G22 | ||
45 | --| pin 56 > |-- G23 | ||
46 | --| |-- | ||
47 | --| Brooktree 878/879 |-- | ||
48 | --| |-- | ||
49 | --| |-- | ||
50 | --| |-- | ||
51 | --| |-- | ||
52 | --| |-- | ||
53 | --| |-- | ||
54 | --| |-- | ||
55 | --| |-- | ||
56 | --| |-- | ||
57 | --| |-- | ||
58 | --| |-- | ||
59 | --| |-- | ||
60 | --| |-- | ||
61 | --| O |-- | ||
62 | --| |-- | ||
63 | --------------------------------------------------------------------------- | ||
64 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ||
65 | ^ | ||
66 | This is pin 1 | ||
67 | |||
diff --git a/Documentation/cciss.txt b/Documentation/cciss.txt index 63e59b8847c5..8244c6442faa 100644 --- a/Documentation/cciss.txt +++ b/Documentation/cciss.txt | |||
@@ -112,27 +112,18 @@ Hot plug support for SCSI tape drives | |||
112 | 112 | ||
113 | Hot plugging of SCSI tape drives is supported, with some caveats. | 113 | Hot plugging of SCSI tape drives is supported, with some caveats. |
114 | The cciss driver must be informed that changes to the SCSI bus | 114 | The cciss driver must be informed that changes to the SCSI bus |
115 | have been made, in addition to and prior to informing the SCSI | 115 | have been made. This may be done via the /proc filesystem. |
116 | mid layer. This may be done via the /proc filesystem. For example: | 116 | For example: |
117 | 117 | ||
118 | echo "rescan" > /proc/scsi/cciss0/1 | 118 | echo "rescan" > /proc/scsi/cciss0/1 |
119 | 119 | ||
120 | This causes the adapter to query the adapter about changes to the | 120 | This causes the driver to query the adapter about changes to the |
121 | physical SCSI buses and/or fibre channel arbitrated loop and the | 121 | physical SCSI buses and/or fibre channel arbitrated loop and the |
122 | driver to make note of any new or removed sequential access devices | 122 | driver to make note of any new or removed sequential access devices |
123 | or medium changers. The driver will output messages indicating what | 123 | or medium changers. The driver will output messages indicating what |
124 | devices have been added or removed and the controller, bus, target and | 124 | devices have been added or removed and the controller, bus, target and |
125 | lun used to address the device. Once this is done, the SCSI mid layer | 125 | lun used to address the device. It then notifies the SCSI mid layer |
126 | can be informed of changes to the virtual SCSI bus which the driver | 126 | of these changes. |
127 | presents to it in the usual way. For example: | ||
128 | |||
129 | echo scsi add-single-device 3 2 1 0 > /proc/scsi/scsi | ||
130 | |||
131 | to add a device on controller 3, bus 2, target 1, lun 0. Note that | ||
132 | the driver makes an effort to preserve the devices positions | ||
133 | in the virtual SCSI bus, so if you are only moving tape drives | ||
134 | around on the same adapter and not adding or removing tape drives | ||
135 | from the adapter, informing the SCSI mid layer may not be necessary. | ||
136 | 127 | ||
137 | Note that the naming convention of the /proc filesystem entries | 128 | Note that the naming convention of the /proc filesystem entries |
138 | contains a number in addition to the driver name. (E.g. "cciss0" | 129 | contains a number in addition to the driver name. (E.g. "cciss0" |
diff --git a/Documentation/cdrom/ide-cd b/Documentation/cdrom/ide-cd index 91c0dcc6fa5c..2c558cd6c1ef 100644 --- a/Documentation/cdrom/ide-cd +++ b/Documentation/cdrom/ide-cd | |||
@@ -145,8 +145,7 @@ useful for reading photocds. | |||
145 | 145 | ||
146 | To play an audio CD, you should first unmount and remove any data | 146 | To play an audio CD, you should first unmount and remove any data |
147 | CDROM. Any of the CDROM player programs should then work (workman, | 147 | CDROM. Any of the CDROM player programs should then work (workman, |
148 | workbone, cdplayer, etc.). Lacking anything else, you could use the | 148 | workbone, cdplayer, etc.). |
149 | cdtester program in Documentation/cdrom/sbpcd. | ||
150 | 149 | ||
151 | On a few drives, you can read digital audio directly using a program | 150 | On a few drives, you can read digital audio directly using a program |
152 | such as cdda2wav. The only types of drive which I've heard support | 151 | such as cdda2wav. The only types of drive which I've heard support |
diff --git a/Documentation/cgroups.txt b/Documentation/cgroups/cgroups.txt index d9014aa0eb68..d9014aa0eb68 100644 --- a/Documentation/cgroups.txt +++ b/Documentation/cgroups/cgroups.txt | |||
diff --git a/Documentation/cgroups/freezer-subsystem.txt b/Documentation/cgroups/freezer-subsystem.txt new file mode 100644 index 000000000000..c50ab58b72eb --- /dev/null +++ b/Documentation/cgroups/freezer-subsystem.txt | |||
@@ -0,0 +1,99 @@ | |||
1 | The cgroup freezer is useful to batch job management system which start | ||
2 | and stop sets of tasks in order to schedule the resources of a machine | ||
3 | according to the desires of a system administrator. This sort of program | ||
4 | is often used on HPC clusters to schedule access to the cluster as a | ||
5 | whole. The cgroup freezer uses cgroups to describe the set of tasks to | ||
6 | be started/stopped by the batch job management system. It also provides | ||
7 | a means to start and stop the tasks composing the job. | ||
8 | |||
9 | The cgroup freezer will also be useful for checkpointing running groups | ||
10 | of tasks. The freezer allows the checkpoint code to obtain a consistent | ||
11 | image of the tasks by attempting to force the tasks in a cgroup into a | ||
12 | quiescent state. Once the tasks are quiescent another task can | ||
13 | walk /proc or invoke a kernel interface to gather information about the | ||
14 | quiesced tasks. Checkpointed tasks can be restarted later should a | ||
15 | recoverable error occur. This also allows the checkpointed tasks to be | ||
16 | migrated between nodes in a cluster by copying the gathered information | ||
17 | to another node and restarting the tasks there. | ||
18 | |||
19 | Sequences of SIGSTOP and SIGCONT are not always sufficient for stopping | ||
20 | and resuming tasks in userspace. Both of these signals are observable | ||
21 | from within the tasks we wish to freeze. While SIGSTOP cannot be caught, | ||
22 | blocked, or ignored it can be seen by waiting or ptracing parent tasks. | ||
23 | SIGCONT is especially unsuitable since it can be caught by the task. Any | ||
24 | programs designed to watch for SIGSTOP and SIGCONT could be broken by | ||
25 | attempting to use SIGSTOP and SIGCONT to stop and resume tasks. We can | ||
26 | demonstrate this problem using nested bash shells: | ||
27 | |||
28 | $ echo $$ | ||
29 | 16644 | ||
30 | $ bash | ||
31 | $ echo $$ | ||
32 | 16690 | ||
33 | |||
34 | From a second, unrelated bash shell: | ||
35 | $ kill -SIGSTOP 16690 | ||
36 | $ kill -SIGCONT 16990 | ||
37 | |||
38 | <at this point 16990 exits and causes 16644 to exit too> | ||
39 | |||
40 | This happens because bash can observe both signals and choose how it | ||
41 | responds to them. | ||
42 | |||
43 | Another example of a program which catches and responds to these | ||
44 | signals is gdb. In fact any program designed to use ptrace is likely to | ||
45 | have a problem with this method of stopping and resuming tasks. | ||
46 | |||
47 | In contrast, the cgroup freezer uses the kernel freezer code to | ||
48 | prevent the freeze/unfreeze cycle from becoming visible to the tasks | ||
49 | being frozen. This allows the bash example above and gdb to run as | ||
50 | expected. | ||
51 | |||
52 | The freezer subsystem in the container filesystem defines a file named | ||
53 | freezer.state. Writing "FROZEN" to the state file will freeze all tasks in the | ||
54 | cgroup. Subsequently writing "THAWED" will unfreeze the tasks in the cgroup. | ||
55 | Reading will return the current state. | ||
56 | |||
57 | * Examples of usage : | ||
58 | |||
59 | # mkdir /containers/freezer | ||
60 | # mount -t cgroup -ofreezer freezer /containers | ||
61 | # mkdir /containers/0 | ||
62 | # echo $some_pid > /containers/0/tasks | ||
63 | |||
64 | to get status of the freezer subsystem : | ||
65 | |||
66 | # cat /containers/0/freezer.state | ||
67 | THAWED | ||
68 | |||
69 | to freeze all tasks in the container : | ||
70 | |||
71 | # echo FROZEN > /containers/0/freezer.state | ||
72 | # cat /containers/0/freezer.state | ||
73 | FREEZING | ||
74 | # cat /containers/0/freezer.state | ||
75 | FROZEN | ||
76 | |||
77 | to unfreeze all tasks in the container : | ||
78 | |||
79 | # echo THAWED > /containers/0/freezer.state | ||
80 | # cat /containers/0/freezer.state | ||
81 | THAWED | ||
82 | |||
83 | This is the basic mechanism which should do the right thing for user space task | ||
84 | in a simple scenario. | ||
85 | |||
86 | It's important to note that freezing can be incomplete. In that case we return | ||
87 | EBUSY. This means that some tasks in the cgroup are busy doing something that | ||
88 | prevents us from completely freezing the cgroup at this time. After EBUSY, | ||
89 | the cgroup will remain partially frozen -- reflected by freezer.state reporting | ||
90 | "FREEZING" when read. The state will remain "FREEZING" until one of these | ||
91 | things happens: | ||
92 | |||
93 | 1) Userspace cancels the freezing operation by writing "THAWED" to | ||
94 | the freezer.state file | ||
95 | 2) Userspace retries the freezing operation by writing "FROZEN" to | ||
96 | the freezer.state file (writing "FREEZING" is not legal | ||
97 | and returns EIO) | ||
98 | 3) The tasks that blocked the cgroup from entering the "FROZEN" | ||
99 | state disappear from the cgroup's set of tasks. | ||
diff --git a/Documentation/cli-sti-removal.txt b/Documentation/cli-sti-removal.txt deleted file mode 100644 index 60932b02fcb3..000000000000 --- a/Documentation/cli-sti-removal.txt +++ /dev/null | |||
@@ -1,133 +0,0 @@ | |||
1 | |||
2 | #### cli()/sti() removal guide, started by Ingo Molnar <mingo@redhat.com> | ||
3 | |||
4 | |||
5 | as of 2.5.28, five popular macros have been removed on SMP, and | ||
6 | are being phased out on UP: | ||
7 | |||
8 | cli(), sti(), save_flags(flags), save_flags_cli(flags), restore_flags(flags) | ||
9 | |||
10 | until now it was possible to protect driver code against interrupt | ||
11 | handlers via a cli(), but from now on other, more lightweight methods | ||
12 | have to be used for synchronization, such as spinlocks or semaphores. | ||
13 | |||
14 | for example, driver code that used to do something like: | ||
15 | |||
16 | struct driver_data; | ||
17 | |||
18 | irq_handler (...) | ||
19 | { | ||
20 | .... | ||
21 | driver_data.finish = 1; | ||
22 | driver_data.new_work = 0; | ||
23 | .... | ||
24 | } | ||
25 | |||
26 | ... | ||
27 | |||
28 | ioctl_func (...) | ||
29 | { | ||
30 | ... | ||
31 | cli(); | ||
32 | ... | ||
33 | driver_data.finish = 0; | ||
34 | driver_data.new_work = 2; | ||
35 | ... | ||
36 | sti(); | ||
37 | ... | ||
38 | } | ||
39 | |||
40 | was SMP-correct because the cli() function ensured that no | ||
41 | interrupt handler (amongst them the above irq_handler()) function | ||
42 | would execute while the cli()-ed section is executing. | ||
43 | |||
44 | but from now on a more direct method of locking has to be used: | ||
45 | |||
46 | DEFINE_SPINLOCK(driver_lock); | ||
47 | struct driver_data; | ||
48 | |||
49 | irq_handler (...) | ||
50 | { | ||
51 | unsigned long flags; | ||
52 | .... | ||
53 | spin_lock_irqsave(&driver_lock, flags); | ||
54 | .... | ||
55 | driver_data.finish = 1; | ||
56 | driver_data.new_work = 0; | ||
57 | .... | ||
58 | spin_unlock_irqrestore(&driver_lock, flags); | ||
59 | .... | ||
60 | } | ||
61 | |||
62 | ... | ||
63 | |||
64 | ioctl_func (...) | ||
65 | { | ||
66 | ... | ||
67 | spin_lock_irq(&driver_lock); | ||
68 | ... | ||
69 | driver_data.finish = 0; | ||
70 | driver_data.new_work = 2; | ||
71 | ... | ||
72 | spin_unlock_irq(&driver_lock); | ||
73 | ... | ||
74 | } | ||
75 | |||
76 | the above code has a number of advantages: | ||
77 | |||
78 | - the locking relation is easier to understand - actual lock usage | ||
79 | pinpoints the critical sections. cli() usage is too opaque. | ||
80 | Easier to understand means it's easier to debug. | ||
81 | |||
82 | - it's faster, because spinlocks are faster to acquire than the | ||
83 | potentially heavily-used IRQ lock. Furthermore, your driver does | ||
84 | not have to wait eg. for a big heavy SCSI interrupt to finish, | ||
85 | because the driver_lock spinlock is only used by your driver. | ||
86 | cli() on the other hand was used by many drivers, and extended | ||
87 | the critical section to the whole IRQ handler function - creating | ||
88 | serious lock contention. | ||
89 | |||
90 | |||
91 | to make the transition easier, we've still kept the cli(), sti(), | ||
92 | save_flags(), save_flags_cli() and restore_flags() macros defined | ||
93 | on UP systems - but their usage will be phased out until 2.6 is | ||
94 | released. | ||
95 | |||
96 | drivers that want to disable local interrupts (interrupts on the | ||
97 | current CPU), can use the following five macros: | ||
98 | |||
99 | local_irq_disable(), local_irq_enable(), local_save_flags(flags), | ||
100 | local_irq_save(flags), local_irq_restore(flags) | ||
101 | |||
102 | but beware, their meaning and semantics are much simpler, far from | ||
103 | that of the old cli(), sti(), save_flags(flags) and restore_flags(flags) | ||
104 | SMP meaning: | ||
105 | |||
106 | local_irq_disable() => turn local IRQs off | ||
107 | |||
108 | local_irq_enable() => turn local IRQs on | ||
109 | |||
110 | local_save_flags(flags) => save the current IRQ state into flags. The | ||
111 | state can be on or off. (on some | ||
112 | architectures there's even more bits in it.) | ||
113 | |||
114 | local_irq_save(flags) => save the current IRQ state into flags and | ||
115 | disable interrupts. | ||
116 | |||
117 | local_irq_restore(flags) => restore the IRQ state from flags. | ||
118 | |||
119 | (local_irq_save can save both irqs on and irqs off state, and | ||
120 | local_irq_restore can restore into both irqs on and irqs off state.) | ||
121 | |||
122 | another related change is that synchronize_irq() now takes a parameter: | ||
123 | synchronize_irq(irq). This change too has the purpose of making SMP | ||
124 | synchronization more lightweight - this way you can wait for your own | ||
125 | interrupt handler to finish, no need to wait for other IRQ sources. | ||
126 | |||
127 | |||
128 | why were these changes done? The main reason was the architectural burden | ||
129 | of maintaining the cli()/sti() interface - it became a real problem. The | ||
130 | new interrupt system is much more streamlined, easier to understand, debug, | ||
131 | and it's also a bit faster - the same happened to it that will happen to | ||
132 | cli()/sti() using drivers once they convert to spinlocks :-) | ||
133 | |||
diff --git a/Documentation/connector/Makefile b/Documentation/connector/Makefile new file mode 100644 index 000000000000..8df1a7285a06 --- /dev/null +++ b/Documentation/connector/Makefile | |||
@@ -0,0 +1,11 @@ | |||
1 | ifneq ($(CONFIG_CONNECTOR),) | ||
2 | obj-m += cn_test.o | ||
3 | endif | ||
4 | |||
5 | # List of programs to build | ||
6 | hostprogs-y := ucon | ||
7 | |||
8 | # Tell kbuild to always build the programs | ||
9 | always := $(hostprogs-y) | ||
10 | |||
11 | HOSTCFLAGS_ucon.o += -I$(objtree)/usr/include | ||
diff --git a/Documentation/controllers/memory.txt b/Documentation/controllers/memory.txt index 866b9cd9a959..1c07547d3f81 100644 --- a/Documentation/controllers/memory.txt +++ b/Documentation/controllers/memory.txt | |||
@@ -112,14 +112,22 @@ the per cgroup LRU. | |||
112 | 112 | ||
113 | 2.2.1 Accounting details | 113 | 2.2.1 Accounting details |
114 | 114 | ||
115 | All mapped pages (RSS) and unmapped user pages (Page Cache) are accounted. | 115 | All mapped anon pages (RSS) and cache pages (Page Cache) are accounted. |
116 | RSS pages are accounted at the time of page_add_*_rmap() unless they've already | 116 | (some pages which never be reclaimable and will not be on global LRU |
117 | been accounted for earlier. A file page will be accounted for as Page Cache; | 117 | are not accounted. we just accounts pages under usual vm management.) |
118 | it's mapped into the page tables of a process, duplicate accounting is carefully | 118 | |
119 | avoided. Page Cache pages are accounted at the time of add_to_page_cache(). | 119 | RSS pages are accounted at page_fault unless they've already been accounted |
120 | The corresponding routines that remove a page from the page tables or removes | 120 | for earlier. A file page will be accounted for as Page Cache when it's |
121 | a page from Page Cache is used to decrement the accounting counters of the | 121 | inserted into inode (radix-tree). While it's mapped into the page tables of |
122 | cgroup. | 122 | processes, duplicate accounting is carefully avoided. |
123 | |||
124 | A RSS page is unaccounted when it's fully unmapped. A PageCache page is | ||
125 | unaccounted when it's removed from radix-tree. | ||
126 | |||
127 | At page migration, accounting information is kept. | ||
128 | |||
129 | Note: we just account pages-on-lru because our purpose is to control amount | ||
130 | of used pages. not-on-lru pages are tend to be out-of-control from vm view. | ||
123 | 131 | ||
124 | 2.3 Shared Page Accounting | 132 | 2.3 Shared Page Accounting |
125 | 133 | ||
@@ -242,8 +250,7 @@ rmdir() if there are no tasks. | |||
242 | 1. Add support for accounting huge pages (as a separate controller) | 250 | 1. Add support for accounting huge pages (as a separate controller) |
243 | 2. Make per-cgroup scanner reclaim not-shared pages first | 251 | 2. Make per-cgroup scanner reclaim not-shared pages first |
244 | 3. Teach controller to account for shared-pages | 252 | 3. Teach controller to account for shared-pages |
245 | 4. Start reclamation when the limit is lowered | 253 | 4. Start reclamation in the background when the limit is |
246 | 5. Start reclamation in the background when the limit is | ||
247 | not yet hit but the usage is getting closer | 254 | not yet hit but the usage is getting closer |
248 | 255 | ||
249 | Summary | 256 | Summary |
diff --git a/Documentation/cpu-freq/governors.txt b/Documentation/cpu-freq/governors.txt index dcec0564d040..5b0cfa67aff9 100644 --- a/Documentation/cpu-freq/governors.txt +++ b/Documentation/cpu-freq/governors.txt | |||
@@ -122,7 +122,7 @@ around '10000' or more. | |||
122 | show_sampling_rate_(min|max): the minimum and maximum sampling rates | 122 | show_sampling_rate_(min|max): the minimum and maximum sampling rates |
123 | available that you may set 'sampling_rate' to. | 123 | available that you may set 'sampling_rate' to. |
124 | 124 | ||
125 | up_threshold: defines what the average CPU usaged between the samplings | 125 | up_threshold: defines what the average CPU usage between the samplings |
126 | of 'sampling_rate' needs to be for the kernel to make a decision on | 126 | of 'sampling_rate' needs to be for the kernel to make a decision on |
127 | whether it should increase the frequency. For example when it is set | 127 | whether it should increase the frequency. For example when it is set |
128 | to its default value of '80' it means that between the checking | 128 | to its default value of '80' it means that between the checking |
diff --git a/Documentation/cpu-freq/index.txt b/Documentation/cpu-freq/index.txt index ffdb5323df37..3d0b915035b9 100644 --- a/Documentation/cpu-freq/index.txt +++ b/Documentation/cpu-freq/index.txt | |||
@@ -35,11 +35,9 @@ Mailing List | |||
35 | ------------ | 35 | ------------ |
36 | There is a CPU frequency changing CVS commit and general list where | 36 | There is a CPU frequency changing CVS commit and general list where |
37 | you can report bugs, problems or submit patches. To post a message, | 37 | you can report bugs, problems or submit patches. To post a message, |
38 | send an email to cpufreq@lists.linux.org.uk, to subscribe go to | 38 | send an email to cpufreq@vger.kernel.org, to subscribe go to |
39 | http://lists.linux.org.uk/mailman/listinfo/cpufreq. Previous post to the | 39 | http://vger.kernel.org/vger-lists.html#cpufreq and follow the |
40 | mailing list are available to subscribers at | 40 | instructions there. |
41 | http://lists.linux.org.uk/mailman/private/cpufreq/. | ||
42 | |||
43 | 41 | ||
44 | Links | 42 | Links |
45 | ----- | 43 | ----- |
@@ -50,7 +48,7 @@ how to access the CVS repository: | |||
50 | * http://cvs.arm.linux.org.uk/ | 48 | * http://cvs.arm.linux.org.uk/ |
51 | 49 | ||
52 | the CPUFreq Mailing list: | 50 | the CPUFreq Mailing list: |
53 | * http://lists.linux.org.uk/mailman/listinfo/cpufreq | 51 | * http://vger.kernel.org/vger-lists.html#cpufreq |
54 | 52 | ||
55 | Clock and voltage scaling for the SA-1100: | 53 | Clock and voltage scaling for the SA-1100: |
56 | * http://www.lartmaker.nl/projects/scaling | 54 | * http://www.lartmaker.nl/projects/scaling |
diff --git a/Documentation/cpu-hotplug.txt b/Documentation/cpu-hotplug.txt index ba0aacde94fb..94bbc27ddd4f 100644 --- a/Documentation/cpu-hotplug.txt +++ b/Documentation/cpu-hotplug.txt | |||
@@ -59,15 +59,10 @@ apicid values in those tables for disabled apics. In the event BIOS doesn't | |||
59 | mark such hot-pluggable cpus as disabled entries, one could use this | 59 | mark such hot-pluggable cpus as disabled entries, one could use this |
60 | parameter "additional_cpus=x" to represent those cpus in the cpu_possible_map. | 60 | parameter "additional_cpus=x" to represent those cpus in the cpu_possible_map. |
61 | 61 | ||
62 | s390 uses the number of cpus it detects at IPL time to also the number of bits | ||
63 | in cpu_possible_map. If it is desired to add additional cpus at a later time | ||
64 | the number should be specified using this option or the possible_cpus option. | ||
65 | |||
66 | possible_cpus=n [s390 only] use this to set hotpluggable cpus. | 62 | possible_cpus=n [s390 only] use this to set hotpluggable cpus. |
67 | This option sets possible_cpus bits in | 63 | This option sets possible_cpus bits in |
68 | cpu_possible_map. Thus keeping the numbers of bits set | 64 | cpu_possible_map. Thus keeping the numbers of bits set |
69 | constant even if the machine gets rebooted. | 65 | constant even if the machine gets rebooted. |
70 | This option overrides additional_cpus. | ||
71 | 66 | ||
72 | CPU maps and such | 67 | CPU maps and such |
73 | ----------------- | 68 | ----------------- |
diff --git a/Documentation/cpusets.txt b/Documentation/cpusets.txt index 1f5a924d1e56..5c86c258c791 100644 --- a/Documentation/cpusets.txt +++ b/Documentation/cpusets.txt | |||
@@ -48,7 +48,7 @@ hooks, beyond what is already present, required to manage dynamic | |||
48 | job placement on large systems. | 48 | job placement on large systems. |
49 | 49 | ||
50 | Cpusets use the generic cgroup subsystem described in | 50 | Cpusets use the generic cgroup subsystem described in |
51 | Documentation/cgroup.txt. | 51 | Documentation/cgroups/cgroups.txt. |
52 | 52 | ||
53 | Requests by a task, using the sched_setaffinity(2) system call to | 53 | Requests by a task, using the sched_setaffinity(2) system call to |
54 | include CPUs in its CPU affinity mask, and using the mbind(2) and | 54 | include CPUs in its CPU affinity mask, and using the mbind(2) and |
@@ -635,14 +635,16 @@ prior 'mems' setting, will not be moved. | |||
635 | 635 | ||
636 | There is an exception to the above. If hotplug functionality is used | 636 | There is an exception to the above. If hotplug functionality is used |
637 | to remove all the CPUs that are currently assigned to a cpuset, | 637 | to remove all the CPUs that are currently assigned to a cpuset, |
638 | then the kernel will automatically update the cpus_allowed of all | 638 | then all the tasks in that cpuset will be moved to the nearest ancestor |
639 | tasks attached to CPUs in that cpuset to allow all CPUs. When memory | 639 | with non-empty cpus. But the moving of some (or all) tasks might fail if |
640 | hotplug functionality for removing Memory Nodes is available, a | 640 | cpuset is bound with another cgroup subsystem which has some restrictions |
641 | similar exception is expected to apply there as well. In general, | 641 | on task attaching. In this failing case, those tasks will stay |
642 | the kernel prefers to violate cpuset placement, over starving a task | 642 | in the original cpuset, and the kernel will automatically update |
643 | that has had all its allowed CPUs or Memory Nodes taken offline. User | 643 | their cpus_allowed to allow all online CPUs. When memory hotplug |
644 | code should reconfigure cpusets to only refer to online CPUs and Memory | 644 | functionality for removing Memory Nodes is available, a similar exception |
645 | Nodes when using hotplug to add or remove such resources. | 645 | is expected to apply there as well. In general, the kernel prefers to |
646 | violate cpuset placement, over starving a task that has had all | ||
647 | its allowed CPUs or Memory Nodes taken offline. | ||
646 | 648 | ||
647 | There is a second exception to the above. GFP_ATOMIC requests are | 649 | There is a second exception to the above. GFP_ATOMIC requests are |
648 | kernel internal allocations that must be satisfied, immediately. | 650 | kernel internal allocations that must be satisfied, immediately. |
diff --git a/Documentation/cris/README b/Documentation/cris/README index 795a1dabe6c7..d9b086869a60 100644 --- a/Documentation/cris/README +++ b/Documentation/cris/README | |||
@@ -27,7 +27,7 @@ operating system. | |||
27 | The ETRAX 100LX chip | 27 | The ETRAX 100LX chip |
28 | -------------------- | 28 | -------------------- |
29 | 29 | ||
30 | For reference, plase see the press-release: | 30 | For reference, please see the press-release: |
31 | 31 | ||
32 | http://www.axis.com/news/us/001101_etrax.htm | 32 | http://www.axis.com/news/us/001101_etrax.htm |
33 | 33 | ||
diff --git a/Documentation/development-process/1.Intro b/Documentation/development-process/1.Intro new file mode 100644 index 000000000000..8cc2cba2b10d --- /dev/null +++ b/Documentation/development-process/1.Intro | |||
@@ -0,0 +1,274 @@ | |||
1 | 1: A GUIDE TO THE KERNEL DEVELOPMENT PROCESS | ||
2 | |||
3 | The purpose of this document is to help developers (and their managers) | ||
4 | work with the development community with a minimum of frustration. It is | ||
5 | an attempt to document how this community works in a way which is | ||
6 | accessible to those who are not intimately familiar with Linux kernel | ||
7 | development (or, indeed, free software development in general). While | ||
8 | there is some technical material here, this is very much a process-oriented | ||
9 | discussion which does not require a deep knowledge of kernel programming to | ||
10 | understand. | ||
11 | |||
12 | |||
13 | 1.1: EXECUTIVE SUMMARY | ||
14 | |||
15 | The rest of this section covers the scope of the kernel development process | ||
16 | and the kinds of frustrations that developers and their employers can | ||
17 | encounter there. There are a great many reasons why kernel code should be | ||
18 | merged into the official ("mainline") kernel, including automatic | ||
19 | availability to users, community support in many forms, and the ability to | ||
20 | influence the direction of kernel development. Code contributed to the | ||
21 | Linux kernel must be made available under a GPL-compatible license. | ||
22 | |||
23 | Section 2 introduces the development process, the kernel release cycle, and | ||
24 | the mechanics of the merge window. The various phases in the patch | ||
25 | development, review, and merging cycle are covered. There is some | ||
26 | discussion of tools and mailing lists. Developers wanting to get started | ||
27 | with kernel development are encouraged to track down and fix bugs as an | ||
28 | initial exercise. | ||
29 | |||
30 | Section 3 covers early-stage project planning, with an emphasis on | ||
31 | involving the development community as soon as possible. | ||
32 | |||
33 | Section 4 is about the coding process; several pitfalls which have been | ||
34 | encountered by other developers are discussed. Some requirements for | ||
35 | patches are covered, and there is an introduction to some of the tools | ||
36 | which can help to ensure that kernel patches are correct. | ||
37 | |||
38 | Section 5 talks about the process of posting patches for review. To be | ||
39 | taken seriously by the development community, patches must be properly | ||
40 | formatted and described, and they must be sent to the right place. | ||
41 | Following the advice in this section should help to ensure the best | ||
42 | possible reception for your work. | ||
43 | |||
44 | Section 6 covers what happens after posting patches; the job is far from | ||
45 | done at that point. Working with reviewers is a crucial part of the | ||
46 | development process; this section offers a number of tips on how to avoid | ||
47 | problems at this important stage. Developers are cautioned against | ||
48 | assuming that the job is done when a patch is merged into the mainline. | ||
49 | |||
50 | Section 7 introduces a couple of "advanced" topics: managing patches with | ||
51 | git and reviewing patches posted by others. | ||
52 | |||
53 | Section 8 concludes the document with pointers to sources for more | ||
54 | information on kernel development. | ||
55 | |||
56 | |||
57 | 1.2: WHAT THIS DOCUMENT IS ABOUT | ||
58 | |||
59 | The Linux kernel, at over 6 million lines of code and well over 1000 active | ||
60 | contributors, is one of the largest and most active free software projects | ||
61 | in existence. Since its humble beginning in 1991, this kernel has evolved | ||
62 | into a best-of-breed operating system component which runs on pocket-sized | ||
63 | digital music players, desktop PCs, the largest supercomputers in | ||
64 | existence, and all types of systems in between. It is a robust, efficient, | ||
65 | and scalable solution for almost any situation. | ||
66 | |||
67 | With the growth of Linux has come an increase in the number of developers | ||
68 | (and companies) wishing to participate in its development. Hardware | ||
69 | vendors want to ensure that Linux supports their products well, making | ||
70 | those products attractive to Linux users. Embedded systems vendors, who | ||
71 | use Linux as a component in an integrated product, want Linux to be as | ||
72 | capable and well-suited to the task at hand as possible. Distributors and | ||
73 | other software vendors who base their products on Linux have a clear | ||
74 | interest in the capabilities, performance, and reliability of the Linux | ||
75 | kernel. And end users, too, will often wish to change Linux to make it | ||
76 | better suit their needs. | ||
77 | |||
78 | One of the most compelling features of Linux is that it is accessible to | ||
79 | these developers; anybody with the requisite skills can improve Linux and | ||
80 | influence the direction of its development. Proprietary products cannot | ||
81 | offer this kind of openness, which is a characteristic of the free software | ||
82 | process. But, if anything, the kernel is even more open than most other | ||
83 | free software projects. A typical three-month kernel development cycle can | ||
84 | involve over 1000 developers working for more than 100 different companies | ||
85 | (or for no company at all). | ||
86 | |||
87 | Working with the kernel development community is not especially hard. But, | ||
88 | that notwithstanding, many potential contributors have experienced | ||
89 | difficulties when trying to do kernel work. The kernel community has | ||
90 | evolved its own distinct ways of operating which allow it to function | ||
91 | smoothly (and produce a high-quality product) in an environment where | ||
92 | thousands of lines of code are being changed every day. So it is not | ||
93 | surprising that Linux kernel development process differs greatly from | ||
94 | proprietary development methods. | ||
95 | |||
96 | The kernel's development process may come across as strange and | ||
97 | intimidating to new developers, but there are good reasons and solid | ||
98 | experience behind it. A developer who does not understand the kernel | ||
99 | community's ways (or, worse, who tries to flout or circumvent them) will | ||
100 | have a frustrating experience in store. The development community, while | ||
101 | being helpful to those who are trying to learn, has little time for those | ||
102 | who will not listen or who do not care about the development process. | ||
103 | |||
104 | It is hoped that those who read this document will be able to avoid that | ||
105 | frustrating experience. There is a lot of material here, but the effort | ||
106 | involved in reading it will be repaid in short order. The development | ||
107 | community is always in need of developers who will help to make the kernel | ||
108 | better; the following text should help you - or those who work for you - | ||
109 | join our community. | ||
110 | |||
111 | |||
112 | 1.3: CREDITS | ||
113 | |||
114 | This document was written by Jonathan Corbet, corbet@lwn.net. It has been | ||
115 | improved by comments from Johannes Berg, James Berry, Alex Chiang, Roland | ||
116 | Dreier, Randy Dunlap, Jake Edge, Jiri Kosina, Matt Mackall, Arthur Marsh, | ||
117 | Amanda McPherson, Andrew Morton, Andrew Price, Tsugikazu Shibata, and | ||
118 | Jochen Voß. | ||
119 | |||
120 | This work was supported by the Linux Foundation; thanks especially to | ||
121 | Amanda McPherson, who saw the value of this effort and made it all happen. | ||
122 | |||
123 | |||
124 | 1.4: THE IMPORTANCE OF GETTING CODE INTO THE MAINLINE | ||
125 | |||
126 | Some companies and developers occasionally wonder why they should bother | ||
127 | learning how to work with the kernel community and get their code into the | ||
128 | mainline kernel (the "mainline" being the kernel maintained by Linus | ||
129 | Torvalds and used as a base by Linux distributors). In the short term, | ||
130 | contributing code can look like an avoidable expense; it seems easier to | ||
131 | just keep the code separate and support users directly. The truth of the | ||
132 | matter is that keeping code separate ("out of tree") is a false economy. | ||
133 | |||
134 | As a way of illustrating the costs of out-of-tree code, here are a few | ||
135 | relevant aspects of the kernel development process; most of these will be | ||
136 | discussed in greater detail later in this document. Consider: | ||
137 | |||
138 | - Code which has been merged into the mainline kernel is available to all | ||
139 | Linux users. It will automatically be present on all distributions which | ||
140 | enable it. There is no need for driver disks, downloads, or the hassles | ||
141 | of supporting multiple versions of multiple distributions; it all just | ||
142 | works, for the developer and for the user. Incorporation into the | ||
143 | mainline solves a large number of distribution and support problems. | ||
144 | |||
145 | - While kernel developers strive to maintain a stable interface to user | ||
146 | space, the internal kernel API is in constant flux. The lack of a stable | ||
147 | internal interface is a deliberate design decision; it allows fundamental | ||
148 | improvements to be made at any time and results in higher-quality code. | ||
149 | But one result of that policy is that any out-of-tree code requires | ||
150 | constant upkeep if it is to work with new kernels. Maintaining | ||
151 | out-of-tree code requires significant amounts of work just to keep that | ||
152 | code working. | ||
153 | |||
154 | Code which is in the mainline, instead, does not require this work as the | ||
155 | result of a simple rule requiring any developer who makes an API change | ||
156 | to also fix any code that breaks as the result of that change. So code | ||
157 | which has been merged into the mainline has significantly lower | ||
158 | maintenance costs. | ||
159 | |||
160 | - Beyond that, code which is in the kernel will often be improved by other | ||
161 | developers. Surprising results can come from empowering your user | ||
162 | community and customers to improve your product. | ||
163 | |||
164 | - Kernel code is subjected to review, both before and after merging into | ||
165 | the mainline. No matter how strong the original developer's skills are, | ||
166 | this review process invariably finds ways in which the code can be | ||
167 | improved. Often review finds severe bugs and security problems. This is | ||
168 | especially true for code which has been developed in a closed | ||
169 | environment; such code benefits strongly from review by outside | ||
170 | developers. Out-of-tree code is lower-quality code. | ||
171 | |||
172 | - Participation in the development process is your way to influence the | ||
173 | direction of kernel development. Users who complain from the sidelines | ||
174 | are heard, but active developers have a stronger voice - and the ability | ||
175 | to implement changes which make the kernel work better for their needs. | ||
176 | |||
177 | - When code is maintained separately, the possibility that a third party | ||
178 | will contribute a different implementation of a similar feature always | ||
179 | exists. Should that happen, getting your code merged will become much | ||
180 | harder - to the point of impossibility. Then you will be faced with the | ||
181 | unpleasant alternatives of either (1) maintaining a nonstandard feature | ||
182 | out of tree indefinitely, or (2) abandoning your code and migrating your | ||
183 | users over to the in-tree version. | ||
184 | |||
185 | - Contribution of code is the fundamental action which makes the whole | ||
186 | process work. By contributing your code you can add new functionality to | ||
187 | the kernel and provide capabilities and examples which are of use to | ||
188 | other kernel developers. If you have developed code for Linux (or are | ||
189 | thinking about doing so), you clearly have an interest in the continued | ||
190 | success of this platform; contributing code is one of the best ways to | ||
191 | help ensure that success. | ||
192 | |||
193 | All of the reasoning above applies to any out-of-tree kernel code, | ||
194 | including code which is distributed in proprietary, binary-only form. | ||
195 | There are, however, additional factors which should be taken into account | ||
196 | before considering any sort of binary-only kernel code distribution. These | ||
197 | include: | ||
198 | |||
199 | - The legal issues around the distribution of proprietary kernel modules | ||
200 | are cloudy at best; quite a few kernel copyright holders believe that | ||
201 | most binary-only modules are derived products of the kernel and that, as | ||
202 | a result, their distribution is a violation of the GNU General Public | ||
203 | license (about which more will be said below). Your author is not a | ||
204 | lawyer, and nothing in this document can possibly be considered to be | ||
205 | legal advice. The true legal status of closed-source modules can only be | ||
206 | determined by the courts. But the uncertainty which haunts those modules | ||
207 | is there regardless. | ||
208 | |||
209 | - Binary modules greatly increase the difficulty of debugging kernel | ||
210 | problems, to the point that most kernel developers will not even try. So | ||
211 | the distribution of binary-only modules will make it harder for your | ||
212 | users to get support from the community. | ||
213 | |||
214 | - Support is also harder for distributors of binary-only modules, who must | ||
215 | provide a version of the module for every distribution and every kernel | ||
216 | version they wish to support. Dozens of builds of a single module can | ||
217 | be required to provide reasonably comprehensive coverage, and your users | ||
218 | will have to upgrade your module separately every time they upgrade their | ||
219 | kernel. | ||
220 | |||
221 | - Everything that was said above about code review applies doubly to | ||
222 | closed-source code. Since this code is not available at all, it cannot | ||
223 | have been reviewed by the community and will, beyond doubt, have serious | ||
224 | problems. | ||
225 | |||
226 | Makers of embedded systems, in particular, may be tempted to disregard much | ||
227 | of what has been said in this section in the belief that they are shipping | ||
228 | a self-contained product which uses a frozen kernel version and requires no | ||
229 | more development after its release. This argument misses the value of | ||
230 | widespread code review and the value of allowing your users to add | ||
231 | capabilities to your product. But these products, too, have a limited | ||
232 | commercial life, after which a new version must be released. At that | ||
233 | point, vendors whose code is in the mainline and well maintained will be | ||
234 | much better positioned to get the new product ready for market quickly. | ||
235 | |||
236 | |||
237 | 1.5: LICENSING | ||
238 | |||
239 | Code is contributed to the Linux kernel under a number of licenses, but all | ||
240 | code must be compatible with version 2 of the GNU General Public License | ||
241 | (GPLv2), which is the license covering the kernel distribution as a whole. | ||
242 | In practice, that means that all code contributions are covered either by | ||
243 | GPLv2 (with, optionally, language allowing distribution under later | ||
244 | versions of the GPL) or the three-clause BSD license. Any contributions | ||
245 | which are not covered by a compatible license will not be accepted into the | ||
246 | kernel. | ||
247 | |||
248 | Copyright assignments are not required (or requested) for code contributed | ||
249 | to the kernel. All code merged into the mainline kernel retains its | ||
250 | original ownership; as a result, the kernel now has thousands of owners. | ||
251 | |||
252 | One implication of this ownership structure is that any attempt to change | ||
253 | the licensing of the kernel is doomed to almost certain failure. There are | ||
254 | few practical scenarios where the agreement of all copyright holders could | ||
255 | be obtained (or their code removed from the kernel). So, in particular, | ||
256 | there is no prospect of a migration to version 3 of the GPL in the | ||
257 | foreseeable future. | ||
258 | |||
259 | It is imperative that all code contributed to the kernel be legitimately | ||
260 | free software. For that reason, code from anonymous (or pseudonymous) | ||
261 | contributors will not be accepted. All contributors are required to "sign | ||
262 | off" on their code, stating that the code can be distributed with the | ||
263 | kernel under the GPL. Code which has not been licensed as free software by | ||
264 | its owner, or which risks creating copyright-related problems for the | ||
265 | kernel (such as code which derives from reverse-engineering efforts lacking | ||
266 | proper safeguards) cannot be contributed. | ||
267 | |||
268 | Questions about copyright-related issues are common on Linux development | ||
269 | mailing lists. Such questions will normally receive no shortage of | ||
270 | answers, but one should bear in mind that the people answering those | ||
271 | questions are not lawyers and cannot provide legal advice. If you have | ||
272 | legal questions relating to Linux source code, there is no substitute for | ||
273 | talking with a lawyer who understands this field. Relying on answers | ||
274 | obtained on technical mailing lists is a risky affair. | ||
diff --git a/Documentation/development-process/2.Process b/Documentation/development-process/2.Process new file mode 100644 index 000000000000..d750321acd5a --- /dev/null +++ b/Documentation/development-process/2.Process | |||
@@ -0,0 +1,459 @@ | |||
1 | 2: HOW THE DEVELOPMENT PROCESS WORKS | ||
2 | |||
3 | Linux kernel development in the early 1990's was a pretty loose affair, | ||
4 | with relatively small numbers of users and developers involved. With a | ||
5 | user base in the millions and with some 2,000 developers involved over the | ||
6 | course of one year, the kernel has since had to evolve a number of | ||
7 | processes to keep development happening smoothly. A solid understanding of | ||
8 | how the process works is required in order to be an effective part of it. | ||
9 | |||
10 | |||
11 | 2.1: THE BIG PICTURE | ||
12 | |||
13 | The kernel developers use a loosely time-based release process, with a new | ||
14 | major kernel release happening every two or three months. The recent | ||
15 | release history looks like this: | ||
16 | |||
17 | 2.6.26 July 13, 2008 | ||
18 | 2.6.25 April 16, 2008 | ||
19 | 2.6.24 January 24, 2008 | ||
20 | 2.6.23 October 9, 2007 | ||
21 | 2.6.22 July 8, 2007 | ||
22 | 2.6.21 April 25, 2007 | ||
23 | 2.6.20 February 4, 2007 | ||
24 | |||
25 | Every 2.6.x release is a major kernel release with new features, internal | ||
26 | API changes, and more. A typical 2.6 release can contain over 10,000 | ||
27 | changesets with changes to several hundred thousand lines of code. 2.6 is | ||
28 | thus the leading edge of Linux kernel development; the kernel uses a | ||
29 | rolling development model which is continually integrating major changes. | ||
30 | |||
31 | A relatively straightforward discipline is followed with regard to the | ||
32 | merging of patches for each release. At the beginning of each development | ||
33 | cycle, the "merge window" is said to be open. At that time, code which is | ||
34 | deemed to be sufficiently stable (and which is accepted by the development | ||
35 | community) is merged into the mainline kernel. The bulk of changes for a | ||
36 | new development cycle (and all of the major changes) will be merged during | ||
37 | this time, at a rate approaching 1,000 changes ("patches," or "changesets") | ||
38 | per day. | ||
39 | |||
40 | (As an aside, it is worth noting that the changes integrated during the | ||
41 | merge window do not come out of thin air; they have been collected, tested, | ||
42 | and staged ahead of time. How that process works will be described in | ||
43 | detail later on). | ||
44 | |||
45 | The merge window lasts for two weeks. At the end of this time, Linus | ||
46 | Torvalds will declare that the window is closed and release the first of | ||
47 | the "rc" kernels. For the kernel which is destined to be 2.6.26, for | ||
48 | example, the release which happens at the end of the merge window will be | ||
49 | called 2.6.26-rc1. The -rc1 release is the signal that the time to merge | ||
50 | new features has passed, and that the time to stabilize the next kernel has | ||
51 | begun. | ||
52 | |||
53 | Over the next six to ten weeks, only patches which fix problems should be | ||
54 | submitted to the mainline. On occasion a more significant change will be | ||
55 | allowed, but such occasions are rare; developers who try to merge new | ||
56 | features outside of the merge window tend to get an unfriendly reception. | ||
57 | As a general rule, if you miss the merge window for a given feature, the | ||
58 | best thing to do is to wait for the next development cycle. (An occasional | ||
59 | exception is made for drivers for previously-unsupported hardware; if they | ||
60 | touch no in-tree code, they cannot cause regressions and should be safe to | ||
61 | add at any time). | ||
62 | |||
63 | As fixes make their way into the mainline, the patch rate will slow over | ||
64 | time. Linus releases new -rc kernels about once a week; a normal series | ||
65 | will get up to somewhere between -rc6 and -rc9 before the kernel is | ||
66 | considered to be sufficiently stable and the final 2.6.x release is made. | ||
67 | At that point the whole process starts over again. | ||
68 | |||
69 | As an example, here is how the 2.6.25 development cycle went (all dates in | ||
70 | 2008): | ||
71 | |||
72 | January 24 2.6.24 stable release | ||
73 | February 10 2.6.25-rc1, merge window closes | ||
74 | February 15 2.6.25-rc2 | ||
75 | February 24 2.6.25-rc3 | ||
76 | March 4 2.6.25-rc4 | ||
77 | March 9 2.6.25-rc5 | ||
78 | March 16 2.6.25-rc6 | ||
79 | March 25 2.6.25-rc7 | ||
80 | April 1 2.6.25-rc8 | ||
81 | April 11 2.6.25-rc9 | ||
82 | April 16 2.6.25 stable release | ||
83 | |||
84 | How do the developers decide when to close the development cycle and create | ||
85 | the stable release? The most significant metric used is the list of | ||
86 | regressions from previous releases. No bugs are welcome, but those which | ||
87 | break systems which worked in the past are considered to be especially | ||
88 | serious. For this reason, patches which cause regressions are looked upon | ||
89 | unfavorably and are quite likely to be reverted during the stabilization | ||
90 | period. | ||
91 | |||
92 | The developers' goal is to fix all known regressions before the stable | ||
93 | release is made. In the real world, this kind of perfection is hard to | ||
94 | achieve; there are just too many variables in a project of this size. | ||
95 | There comes a point where delaying the final release just makes the problem | ||
96 | worse; the pile of changes waiting for the next merge window will grow | ||
97 | larger, creating even more regressions the next time around. So most 2.6.x | ||
98 | kernels go out with a handful of known regressions though, hopefully, none | ||
99 | of them are serious. | ||
100 | |||
101 | Once a stable release is made, its ongoing maintenance is passed off to the | ||
102 | "stable team," currently comprised of Greg Kroah-Hartman and Chris Wright. | ||
103 | The stable team will release occasional updates to the stable release using | ||
104 | the 2.6.x.y numbering scheme. To be considered for an update release, a | ||
105 | patch must (1) fix a significant bug, and (2) already be merged into the | ||
106 | mainline for the next development kernel. Continuing our 2.6.25 example, | ||
107 | the history (as of this writing) is: | ||
108 | |||
109 | May 1 2.6.25.1 | ||
110 | May 6 2.6.25.2 | ||
111 | May 9 2.6.25.3 | ||
112 | May 15 2.6.25.4 | ||
113 | June 7 2.6.25.5 | ||
114 | June 9 2.6.25.6 | ||
115 | June 16 2.6.25.7 | ||
116 | June 21 2.6.25.8 | ||
117 | June 24 2.6.25.9 | ||
118 | |||
119 | Stable updates for a given kernel are made for approximately six months; | ||
120 | after that, the maintenance of stable releases is solely the responsibility | ||
121 | of the distributors which have shipped that particular kernel. | ||
122 | |||
123 | |||
124 | 2.2: THE LIFECYCLE OF A PATCH | ||
125 | |||
126 | Patches do not go directly from the developer's keyboard into the mainline | ||
127 | kernel. There is, instead, a somewhat involved (if somewhat informal) | ||
128 | process designed to ensure that each patch is reviewed for quality and that | ||
129 | each patch implements a change which is desirable to have in the mainline. | ||
130 | This process can happen quickly for minor fixes, or, in the case of large | ||
131 | and controversial changes, go on for years. Much developer frustration | ||
132 | comes from a lack of understanding of this process or from attempts to | ||
133 | circumvent it. | ||
134 | |||
135 | In the hopes of reducing that frustration, this document will describe how | ||
136 | a patch gets into the kernel. What follows below is an introduction which | ||
137 | describes the process in a somewhat idealized way. A much more detailed | ||
138 | treatment will come in later sections. | ||
139 | |||
140 | The stages that a patch goes through are, generally: | ||
141 | |||
142 | - Design. This is where the real requirements for the patch - and the way | ||
143 | those requirements will be met - are laid out. Design work is often | ||
144 | done without involving the community, but it is better to do this work | ||
145 | in the open if at all possible; it can save a lot of time redesigning | ||
146 | things later. | ||
147 | |||
148 | - Early review. Patches are posted to the relevant mailing list, and | ||
149 | developers on that list reply with any comments they may have. This | ||
150 | process should turn up any major problems with a patch if all goes | ||
151 | well. | ||
152 | |||
153 | - Wider review. When the patch is getting close to ready for mainline | ||
154 | inclusion, it will be accepted by a relevant subsystem maintainer - | ||
155 | though this acceptance is not a guarantee that the patch will make it | ||
156 | all the way to the mainline. The patch will show up in the maintainer's | ||
157 | subsystem tree and into the staging trees (described below). When the | ||
158 | process works, this step leads to more extensive review of the patch and | ||
159 | the discovery of any problems resulting from the integration of this | ||
160 | patch with work being done by others. | ||
161 | |||
162 | - Merging into the mainline. Eventually, a successful patch will be | ||
163 | merged into the mainline repository managed by Linus Torvalds. More | ||
164 | comments and/or problems may surface at this time; it is important that | ||
165 | the developer be responsive to these and fix any issues which arise. | ||
166 | |||
167 | - Stable release. The number of users potentially affected by the patch | ||
168 | is now large, so, once again, new problems may arise. | ||
169 | |||
170 | - Long-term maintenance. While it is certainly possible for a developer | ||
171 | to forget about code after merging it, that sort of behavior tends to | ||
172 | leave a poor impression in the development community. Merging code | ||
173 | eliminates some of the maintenance burden, in that others will fix | ||
174 | problems caused by API changes. But the original developer should | ||
175 | continue to take responsibility for the code if it is to remain useful | ||
176 | in the longer term. | ||
177 | |||
178 | One of the largest mistakes made by kernel developers (or their employers) | ||
179 | is to try to cut the process down to a single "merging into the mainline" | ||
180 | step. This approach invariably leads to frustration for everybody | ||
181 | involved. | ||
182 | |||
183 | |||
184 | 2.3: HOW PATCHES GET INTO THE KERNEL | ||
185 | |||
186 | There is exactly one person who can merge patches into the mainline kernel | ||
187 | repository: Linus Torvalds. But, of the over 12,000 patches which went | ||
188 | into the 2.6.25 kernel, only 250 (around 2%) were directly chosen by Linus | ||
189 | himself. The kernel project has long since grown to a size where no single | ||
190 | developer could possibly inspect and select every patch unassisted. The | ||
191 | way the kernel developers have addressed this growth is through the use of | ||
192 | a lieutenant system built around a chain of trust. | ||
193 | |||
194 | The kernel code base is logically broken down into a set of subsystems: | ||
195 | networking, specific architecture support, memory management, video | ||
196 | devices, etc. Most subsystems have a designated maintainer, a developer | ||
197 | who has overall responsibility for the code within that subsystem. These | ||
198 | subsystem maintainers are the gatekeepers (in a loose way) for the portion | ||
199 | of the kernel they manage; they are the ones who will (usually) accept a | ||
200 | patch for inclusion into the mainline kernel. | ||
201 | |||
202 | Subsystem maintainers each manage their own version of the kernel source | ||
203 | tree, usually (but certainly not always) using the git source management | ||
204 | tool. Tools like git (and related tools like quilt or mercurial) allow | ||
205 | maintainers to track a list of patches, including authorship information | ||
206 | and other metadata. At any given time, the maintainer can identify which | ||
207 | patches in his or her repository are not found in the mainline. | ||
208 | |||
209 | When the merge window opens, top-level maintainers will ask Linus to "pull" | ||
210 | the patches they have selected for merging from their repositories. If | ||
211 | Linus agrees, the stream of patches will flow up into his repository, | ||
212 | becoming part of the mainline kernel. The amount of attention that Linus | ||
213 | pays to specific patches received in a pull operation varies. It is clear | ||
214 | that, sometimes, he looks quite closely. But, as a general rule, Linus | ||
215 | trusts the subsystem maintainers to not send bad patches upstream. | ||
216 | |||
217 | Subsystem maintainers, in turn, can pull patches from other maintainers. | ||
218 | For example, the networking tree is built from patches which accumulated | ||
219 | first in trees dedicated to network device drivers, wireless networking, | ||
220 | etc. This chain of repositories can be arbitrarily long, though it rarely | ||
221 | exceeds two or three links. Since each maintainer in the chain trusts | ||
222 | those managing lower-level trees, this process is known as the "chain of | ||
223 | trust." | ||
224 | |||
225 | Clearly, in a system like this, getting patches into the kernel depends on | ||
226 | finding the right maintainer. Sending patches directly to Linus is not | ||
227 | normally the right way to go. | ||
228 | |||
229 | |||
230 | 2.4: STAGING TREES | ||
231 | |||
232 | The chain of subsystem trees guides the flow of patches into the kernel, | ||
233 | but it also raises an interesting question: what if somebody wants to look | ||
234 | at all of the patches which are being prepared for the next merge window? | ||
235 | Developers will be interested in what other changes are pending to see | ||
236 | whether there are any conflicts to worry about; a patch which changes a | ||
237 | core kernel function prototype, for example, will conflict with any other | ||
238 | patches which use the older form of that function. Reviewers and testers | ||
239 | want access to the changes in their integrated form before all of those | ||
240 | changes land in the mainline kernel. One could pull changes from all of | ||
241 | the interesting subsystem trees, but that would be a big and error-prone | ||
242 | job. | ||
243 | |||
244 | The answer comes in the form of staging trees, where subsystem trees are | ||
245 | collected for testing and review. The older of these trees, maintained by | ||
246 | Andrew Morton, is called "-mm" (for memory management, which is how it got | ||
247 | started). The -mm tree integrates patches from a long list of subsystem | ||
248 | trees; it also has some patches aimed at helping with debugging. | ||
249 | |||
250 | Beyond that, -mm contains a significant collection of patches which have | ||
251 | been selected by Andrew directly. These patches may have been posted on a | ||
252 | mailing list, or they may apply to a part of the kernel for which there is | ||
253 | no designated subsystem tree. As a result, -mm operates as a sort of | ||
254 | subsystem tree of last resort; if there is no other obvious path for a | ||
255 | patch into the mainline, it is likely to end up in -mm. Miscellaneous | ||
256 | patches which accumulate in -mm will eventually either be forwarded on to | ||
257 | an appropriate subsystem tree or be sent directly to Linus. In a typical | ||
258 | development cycle, approximately 10% of the patches going into the mainline | ||
259 | get there via -mm. | ||
260 | |||
261 | The current -mm patch can always be found from the front page of | ||
262 | |||
263 | http://kernel.org/ | ||
264 | |||
265 | Those who want to see the current state of -mm can get the "-mm of the | ||
266 | moment" tree, found at: | ||
267 | |||
268 | http://userweb.kernel.org/~akpm/mmotm/ | ||
269 | |||
270 | Use of the MMOTM tree is likely to be a frustrating experience, though; | ||
271 | there is a definite chance that it will not even compile. | ||
272 | |||
273 | The other staging tree, started more recently, is linux-next, maintained by | ||
274 | Stephen Rothwell. The linux-next tree is, by design, a snapshot of what | ||
275 | the mainline is expected to look like after the next merge window closes. | ||
276 | Linux-next trees are announced on the linux-kernel and linux-next mailing | ||
277 | lists when they are assembled; they can be downloaded from: | ||
278 | |||
279 | http://www.kernel.org/pub/linux/kernel/people/sfr/linux-next/ | ||
280 | |||
281 | Some information about linux-next has been gathered at: | ||
282 | |||
283 | http://linux.f-seidel.de/linux-next/pmwiki/ | ||
284 | |||
285 | How the linux-next tree will fit into the development process is still | ||
286 | changing. As of this writing, the first full development cycle involving | ||
287 | linux-next (2.6.26) is coming to an end; thus far, it has proved to be a | ||
288 | valuable resource for finding and fixing integration problems before the | ||
289 | beginning of the merge window. See http://lwn.net/Articles/287155/ for | ||
290 | more information on how linux-next has worked to set up the 2.6.27 merge | ||
291 | window. | ||
292 | |||
293 | Some developers have begun to suggest that linux-next should be used as the | ||
294 | target for future development as well. The linux-next tree does tend to be | ||
295 | far ahead of the mainline and is more representative of the tree into which | ||
296 | any new work will be merged. The downside to this idea is that the | ||
297 | volatility of linux-next tends to make it a difficult development target. | ||
298 | See http://lwn.net/Articles/289013/ for more information on this topic, and | ||
299 | stay tuned; much is still in flux where linux-next is involved. | ||
300 | |||
301 | |||
302 | 2.5: TOOLS | ||
303 | |||
304 | As can be seen from the above text, the kernel development process depends | ||
305 | heavily on the ability to herd collections of patches in various | ||
306 | directions. The whole thing would not work anywhere near as well as it | ||
307 | does without suitably powerful tools. Tutorials on how to use these tools | ||
308 | are well beyond the scope of this document, but there is space for a few | ||
309 | pointers. | ||
310 | |||
311 | By far the dominant source code management system used by the kernel | ||
312 | community is git. Git is one of a number of distributed version control | ||
313 | systems being developed in the free software community. It is well tuned | ||
314 | for kernel development, in that it performs quite well when dealing with | ||
315 | large repositories and large numbers of patches. It also has a reputation | ||
316 | for being difficult to learn and use, though it has gotten better over | ||
317 | time. Some sort of familiarity with git is almost a requirement for kernel | ||
318 | developers; even if they do not use it for their own work, they'll need git | ||
319 | to keep up with what other developers (and the mainline) are doing. | ||
320 | |||
321 | Git is now packaged by almost all Linux distributions. There is a home | ||
322 | page at | ||
323 | |||
324 | http://git.or.cz/ | ||
325 | |||
326 | That page has pointers to documentation and tutorials. One should be | ||
327 | aware, in particular, of the Kernel Hacker's Guide to git, which has | ||
328 | information specific to kernel development: | ||
329 | |||
330 | http://linux.yyz.us/git-howto.html | ||
331 | |||
332 | Among the kernel developers who do not use git, the most popular choice is | ||
333 | almost certainly Mercurial: | ||
334 | |||
335 | http://www.selenic.com/mercurial/ | ||
336 | |||
337 | Mercurial shares many features with git, but it provides an interface which | ||
338 | many find easier to use. | ||
339 | |||
340 | The other tool worth knowing about is Quilt: | ||
341 | |||
342 | http://savannah.nongnu.org/projects/quilt/ | ||
343 | |||
344 | Quilt is a patch management system, rather than a source code management | ||
345 | system. It does not track history over time; it is, instead, oriented | ||
346 | toward tracking a specific set of changes against an evolving code base. | ||
347 | Some major subsystem maintainers use quilt to manage patches intended to go | ||
348 | upstream. For the management of certain kinds of trees (-mm, for example), | ||
349 | quilt is the best tool for the job. | ||
350 | |||
351 | |||
352 | 2.6: MAILING LISTS | ||
353 | |||
354 | A great deal of Linux kernel development work is done by way of mailing | ||
355 | lists. It is hard to be a fully-functioning member of the community | ||
356 | without joining at least one list somewhere. But Linux mailing lists also | ||
357 | represent a potential hazard to developers, who risk getting buried under a | ||
358 | load of electronic mail, running afoul of the conventions used on the Linux | ||
359 | lists, or both. | ||
360 | |||
361 | Most kernel mailing lists are run on vger.kernel.org; the master list can | ||
362 | be found at: | ||
363 | |||
364 | http://vger.kernel.org/vger-lists.html | ||
365 | |||
366 | There are lists hosted elsewhere, though; a number of them are at | ||
367 | lists.redhat.com. | ||
368 | |||
369 | The core mailing list for kernel development is, of course, linux-kernel. | ||
370 | This list is an intimidating place to be; volume can reach 500 messages per | ||
371 | day, the amount of noise is high, the conversation can be severely | ||
372 | technical, and participants are not always concerned with showing a high | ||
373 | degree of politeness. But there is no other place where the kernel | ||
374 | development community comes together as a whole; developers who avoid this | ||
375 | list will miss important information. | ||
376 | |||
377 | There are a few hints which can help with linux-kernel survival: | ||
378 | |||
379 | - Have the list delivered to a separate folder, rather than your main | ||
380 | mailbox. One must be able to ignore the stream for sustained periods of | ||
381 | time. | ||
382 | |||
383 | - Do not try to follow every conversation - nobody else does. It is | ||
384 | important to filter on both the topic of interest (though note that | ||
385 | long-running conversations can drift away from the original subject | ||
386 | without changing the email subject line) and the people who are | ||
387 | participating. | ||
388 | |||
389 | - Do not feed the trolls. If somebody is trying to stir up an angry | ||
390 | response, ignore them. | ||
391 | |||
392 | - When responding to linux-kernel email (or that on other lists) preserve | ||
393 | the Cc: header for all involved. In the absence of a strong reason (such | ||
394 | as an explicit request), you should never remove recipients. Always make | ||
395 | sure that the person you are responding to is in the Cc: list. This | ||
396 | convention also makes it unnecessary to explicitly ask to be copied on | ||
397 | replies to your postings. | ||
398 | |||
399 | - Search the list archives (and the net as a whole) before asking | ||
400 | questions. Some developers can get impatient with people who clearly | ||
401 | have not done their homework. | ||
402 | |||
403 | - Avoid top-posting (the practice of putting your answer above the quoted | ||
404 | text you are responding to). It makes your response harder to read and | ||
405 | makes a poor impression. | ||
406 | |||
407 | - Ask on the correct mailing list. Linux-kernel may be the general meeting | ||
408 | point, but it is not the best place to find developers from all | ||
409 | subsystems. | ||
410 | |||
411 | The last point - finding the correct mailing list - is a common place for | ||
412 | beginning developers to go wrong. Somebody who asks a networking-related | ||
413 | question on linux-kernel will almost certainly receive a polite suggestion | ||
414 | to ask on the netdev list instead, as that is the list frequented by most | ||
415 | networking developers. Other lists exist for the SCSI, video4linux, IDE, | ||
416 | filesystem, etc. subsystems. The best place to look for mailing lists is | ||
417 | in the MAINTAINERS file packaged with the kernel source. | ||
418 | |||
419 | |||
420 | 2.7: GETTING STARTED WITH KERNEL DEVELOPMENT | ||
421 | |||
422 | Questions about how to get started with the kernel development process are | ||
423 | common - from both individuals and companies. Equally common are missteps | ||
424 | which make the beginning of the relationship harder than it has to be. | ||
425 | |||
426 | Companies often look to hire well-known developers to get a development | ||
427 | group started. This can, in fact, be an effective technique. But it also | ||
428 | tends to be expensive and does not do much to grow the pool of experienced | ||
429 | kernel developers. It is possible to bring in-house developers up to speed | ||
430 | on Linux kernel development, given the investment of a bit of time. Taking | ||
431 | this time can endow an employer with a group of developers who understand | ||
432 | the kernel and the company both, and who can help to train others as well. | ||
433 | Over the medium term, this is often the more profitable approach. | ||
434 | |||
435 | Individual developers are often, understandably, at a loss for a place to | ||
436 | start. Beginning with a large project can be intimidating; one often wants | ||
437 | to test the waters with something smaller first. This is the point where | ||
438 | some developers jump into the creation of patches fixing spelling errors or | ||
439 | minor coding style issues. Unfortunately, such patches create a level of | ||
440 | noise which is distracting for the development community as a whole, so, | ||
441 | increasingly, they are looked down upon. New developers wishing to | ||
442 | introduce themselves to the community will not get the sort of reception | ||
443 | they wish for by these means. | ||
444 | |||
445 | Andrew Morton gives this advice for aspiring kernel developers | ||
446 | |||
447 | The #1 project for all kernel beginners should surely be "make sure | ||
448 | that the kernel runs perfectly at all times on all machines which | ||
449 | you can lay your hands on". Usually the way to do this is to work | ||
450 | with others on getting things fixed up (this can require | ||
451 | persistence!) but that's fine - it's a part of kernel development. | ||
452 | |||
453 | (http://lwn.net/Articles/283982/). | ||
454 | |||
455 | In the absence of obvious problems to fix, developers are advised to look | ||
456 | at the current lists of regressions and open bugs in general. There is | ||
457 | never any shortage of issues in need of fixing; by addressing these issues, | ||
458 | developers will gain experience with the process while, at the same time, | ||
459 | building respect with the rest of the development community. | ||
diff --git a/Documentation/development-process/3.Early-stage b/Documentation/development-process/3.Early-stage new file mode 100644 index 000000000000..307a159a70ca --- /dev/null +++ b/Documentation/development-process/3.Early-stage | |||
@@ -0,0 +1,195 @@ | |||
1 | 3: EARLY-STAGE PLANNING | ||
2 | |||
3 | When contemplating a Linux kernel development project, it can be tempting | ||
4 | to jump right in and start coding. As with any significant project, | ||
5 | though, much of the groundwork for success is best laid before the first | ||
6 | line of code is written. Some time spent in early planning and | ||
7 | communication can save far more time later on. | ||
8 | |||
9 | |||
10 | 3.1: SPECIFYING THE PROBLEM | ||
11 | |||
12 | Like any engineering project, a successful kernel enhancement starts with a | ||
13 | clear description of the problem to be solved. In some cases, this step is | ||
14 | easy: when a driver is needed for a specific piece of hardware, for | ||
15 | example. In others, though, it is tempting to confuse the real problem | ||
16 | with the proposed solution, and that can lead to difficulties. | ||
17 | |||
18 | Consider an example: some years ago, developers working with Linux audio | ||
19 | sought a way to run applications without dropouts or other artifacts caused | ||
20 | by excessive latency in the system. The solution they arrived at was a | ||
21 | kernel module intended to hook into the Linux Security Module (LSM) | ||
22 | framework; this module could be configured to give specific applications | ||
23 | access to the realtime scheduler. This module was implemented and sent to | ||
24 | the linux-kernel mailing list, where it immediately ran into problems. | ||
25 | |||
26 | To the audio developers, this security module was sufficient to solve their | ||
27 | immediate problem. To the wider kernel community, though, it was seen as a | ||
28 | misuse of the LSM framework (which is not intended to confer privileges | ||
29 | onto processes which they would not otherwise have) and a risk to system | ||
30 | stability. Their preferred solutions involved realtime scheduling access | ||
31 | via the rlimit mechanism for the short term, and ongoing latency reduction | ||
32 | work in the long term. | ||
33 | |||
34 | The audio community, however, could not see past the particular solution | ||
35 | they had implemented; they were unwilling to accept alternatives. The | ||
36 | resulting disagreement left those developers feeling disillusioned with the | ||
37 | entire kernel development process; one of them went back to an audio list | ||
38 | and posted this: | ||
39 | |||
40 | There are a number of very good Linux kernel developers, but they | ||
41 | tend to get outshouted by a large crowd of arrogant fools. Trying | ||
42 | to communicate user requirements to these people is a waste of | ||
43 | time. They are much too "intelligent" to listen to lesser mortals. | ||
44 | |||
45 | (http://lwn.net/Articles/131776/). | ||
46 | |||
47 | The reality of the situation was different; the kernel developers were far | ||
48 | more concerned about system stability, long-term maintenance, and finding | ||
49 | the right solution to the problem than they were with a specific module. | ||
50 | The moral of the story is to focus on the problem - not a specific solution | ||
51 | - and to discuss it with the development community before investing in the | ||
52 | creation of a body of code. | ||
53 | |||
54 | So, when contemplating a kernel development project, one should obtain | ||
55 | answers to a short set of questions: | ||
56 | |||
57 | - What, exactly, is the problem which needs to be solved? | ||
58 | |||
59 | - Who are the users affected by this problem? Which use cases should the | ||
60 | solution address? | ||
61 | |||
62 | - How does the kernel fall short in addressing that problem now? | ||
63 | |||
64 | Only then does it make sense to start considering possible solutions. | ||
65 | |||
66 | |||
67 | 3.2: EARLY DISCUSSION | ||
68 | |||
69 | When planning a kernel development project, it makes great sense to hold | ||
70 | discussions with the community before launching into implementation. Early | ||
71 | communication can save time and trouble in a number of ways: | ||
72 | |||
73 | - It may well be that the problem is addressed by the kernel in ways which | ||
74 | you have not understood. The Linux kernel is large and has a number of | ||
75 | features and capabilities which are not immediately obvious. Not all | ||
76 | kernel capabilities are documented as well as one might like, and it is | ||
77 | easy to miss things. Your author has seen the posting of a complete | ||
78 | driver which duplicated an existing driver that the new author had been | ||
79 | unaware of. Code which reinvents existing wheels is not only wasteful; | ||
80 | it will also not be accepted into the mainline kernel. | ||
81 | |||
82 | - There may be elements of the proposed solution which will not be | ||
83 | acceptable for mainline merging. It is better to find out about | ||
84 | problems like this before writing the code. | ||
85 | |||
86 | - It's entirely possible that other developers have thought about the | ||
87 | problem; they may have ideas for a better solution, and may be willing | ||
88 | to help in the creation of that solution. | ||
89 | |||
90 | Years of experience with the kernel development community have taught a | ||
91 | clear lesson: kernel code which is designed and developed behind closed | ||
92 | doors invariably has problems which are only revealed when the code is | ||
93 | released into the community. Sometimes these problems are severe, | ||
94 | requiring months or years of effort before the code can be brought up to | ||
95 | the kernel community's standards. Some examples include: | ||
96 | |||
97 | - The Devicescape network stack was designed and implemented for | ||
98 | single-processor systems. It could not be merged into the mainline | ||
99 | until it was made suitable for multiprocessor systems. Retrofitting | ||
100 | locking and such into code is a difficult task; as a result, the merging | ||
101 | of this code (now called mac80211) was delayed for over a year. | ||
102 | |||
103 | - The Reiser4 filesystem included a number of capabilities which, in the | ||
104 | core kernel developers' opinion, should have been implemented in the | ||
105 | virtual filesystem layer instead. It also included features which could | ||
106 | not easily be implemented without exposing the system to user-caused | ||
107 | deadlocks. The late revelation of these problems - and refusal to | ||
108 | address some of them - has caused Reiser4 to stay out of the mainline | ||
109 | kernel. | ||
110 | |||
111 | - The AppArmor security module made use of internal virtual filesystem | ||
112 | data structures in ways which were considered to be unsafe and | ||
113 | unreliable. This code has since been significantly reworked, but | ||
114 | remains outside of the mainline. | ||
115 | |||
116 | In each of these cases, a great deal of pain and extra work could have been | ||
117 | avoided with some early discussion with the kernel developers. | ||
118 | |||
119 | |||
120 | 3.3: WHO DO YOU TALK TO? | ||
121 | |||
122 | When developers decide to take their plans public, the next question will | ||
123 | be: where do we start? The answer is to find the right mailing list(s) and | ||
124 | the right maintainer. For mailing lists, the best approach is to look in | ||
125 | the MAINTAINERS file for a relevant place to post. If there is a suitable | ||
126 | subsystem list, posting there is often preferable to posting on | ||
127 | linux-kernel; you are more likely to reach developers with expertise in the | ||
128 | relevant subsystem and the environment may be more supportive. | ||
129 | |||
130 | Finding maintainers can be a bit harder. Again, the MAINTAINERS file is | ||
131 | the place to start. That file tends to not always be up to date, though, | ||
132 | and not all subsystems are represented there. The person listed in the | ||
133 | MAINTAINERS file may, in fact, not be the person who is actually acting in | ||
134 | that role currently. So, when there is doubt about who to contact, a | ||
135 | useful trick is to use git (and "git log" in particular) to see who is | ||
136 | currently active within the subsystem of interest. Look at who is writing | ||
137 | patches, and who, if anybody, is attaching Signed-off-by lines to those | ||
138 | patches. Those are the people who will be best placed to help with a new | ||
139 | development project. | ||
140 | |||
141 | If all else fails, talking to Andrew Morton can be an effective way to | ||
142 | track down a maintainer for a specific piece of code. | ||
143 | |||
144 | |||
145 | 3.4: WHEN TO POST? | ||
146 | |||
147 | If possible, posting your plans during the early stages can only be | ||
148 | helpful. Describe the problem being solved and any plans that have been | ||
149 | made on how the implementation will be done. Any information you can | ||
150 | provide can help the development community provide useful input on the | ||
151 | project. | ||
152 | |||
153 | One discouraging thing which can happen at this stage is not a hostile | ||
154 | reaction, but, instead, little or no reaction at all. The sad truth of the | ||
155 | matter is (1) kernel developers tend to be busy, (2) there is no shortage | ||
156 | of people with grand plans and little code (or even prospect of code) to | ||
157 | back them up, and (3) nobody is obligated to review or comment on ideas | ||
158 | posted by others. If a request-for-comments posting yields little in the | ||
159 | way of comments, do not assume that it means there is no interest in the | ||
160 | project. Unfortunately, you also cannot assume that there are no problems | ||
161 | with your idea. The best thing to do in this situation is to proceed, | ||
162 | keeping the community informed as you go. | ||
163 | |||
164 | |||
165 | 3.5: GETTING OFFICIAL BUY-IN | ||
166 | |||
167 | If your work is being done in a corporate environment - as most Linux | ||
168 | kernel work is - you must, obviously, have permission from suitably | ||
169 | empowered managers before you can post your company's plans or code to a | ||
170 | public mailing list. The posting of code which has not been cleared for | ||
171 | release under a GPL-compatible license can be especially problematic; the | ||
172 | sooner that a company's management and legal staff can agree on the posting | ||
173 | of a kernel development project, the better off everybody involved will be. | ||
174 | |||
175 | Some readers may be thinking at this point that their kernel work is | ||
176 | intended to support a product which does not yet have an officially | ||
177 | acknowledged existence. Revealing their employer's plans on a public | ||
178 | mailing list may not be a viable option. In cases like this, it is worth | ||
179 | considering whether the secrecy is really necessary; there is often no real | ||
180 | need to keep development plans behind closed doors. | ||
181 | |||
182 | That said, there are also cases where a company legitimately cannot | ||
183 | disclose its plans early in the development process. Companies with | ||
184 | experienced kernel developers may choose to proceed in an open-loop manner | ||
185 | on the assumption that they will be able to avoid serious integration | ||
186 | problems later. For companies without that sort of in-house expertise, the | ||
187 | best option is often to hire an outside developer to review the plans under | ||
188 | a non-disclosure agreement. The Linux Foundation operates an NDA program | ||
189 | designed to help with this sort of situation; more information can be found | ||
190 | at: | ||
191 | |||
192 | http://www.linuxfoundation.org/en/NDA_program | ||
193 | |||
194 | This kind of review is often enough to avoid serious problems later on | ||
195 | without requiring public disclosure of the project. | ||
diff --git a/Documentation/development-process/4.Coding b/Documentation/development-process/4.Coding new file mode 100644 index 000000000000..014aca8f14e2 --- /dev/null +++ b/Documentation/development-process/4.Coding | |||
@@ -0,0 +1,384 @@ | |||
1 | 4: GETTING THE CODE RIGHT | ||
2 | |||
3 | While there is much to be said for a solid and community-oriented design | ||
4 | process, the proof of any kernel development project is in the resulting | ||
5 | code. It is the code which will be examined by other developers and merged | ||
6 | (or not) into the mainline tree. So it is the quality of this code which | ||
7 | will determine the ultimate success of the project. | ||
8 | |||
9 | This section will examine the coding process. We'll start with a look at a | ||
10 | number of ways in which kernel developers can go wrong. Then the focus | ||
11 | will shift toward doing things right and the tools which can help in that | ||
12 | quest. | ||
13 | |||
14 | |||
15 | 4.1: PITFALLS | ||
16 | |||
17 | * Coding style | ||
18 | |||
19 | The kernel has long had a standard coding style, described in | ||
20 | Documentation/CodingStyle. For much of that time, the policies described | ||
21 | in that file were taken as being, at most, advisory. As a result, there is | ||
22 | a substantial amount of code in the kernel which does not meet the coding | ||
23 | style guidelines. The presence of that code leads to two independent | ||
24 | hazards for kernel developers. | ||
25 | |||
26 | The first of these is to believe that the kernel coding standards do not | ||
27 | matter and are not enforced. The truth of the matter is that adding new | ||
28 | code to the kernel is very difficult if that code is not coded according to | ||
29 | the standard; many developers will request that the code be reformatted | ||
30 | before they will even review it. A code base as large as the kernel | ||
31 | requires some uniformity of code to make it possible for developers to | ||
32 | quickly understand any part of it. So there is no longer room for | ||
33 | strangely-formatted code. | ||
34 | |||
35 | Occasionally, the kernel's coding style will run into conflict with an | ||
36 | employer's mandated style. In such cases, the kernel's style will have to | ||
37 | win before the code can be merged. Putting code into the kernel means | ||
38 | giving up a degree of control in a number of ways - including control over | ||
39 | how the code is formatted. | ||
40 | |||
41 | The other trap is to assume that code which is already in the kernel is | ||
42 | urgently in need of coding style fixes. Developers may start to generate | ||
43 | reformatting patches as a way of gaining familiarity with the process, or | ||
44 | as a way of getting their name into the kernel changelogs - or both. But | ||
45 | pure coding style fixes are seen as noise by the development community; | ||
46 | they tend to get a chilly reception. So this type of patch is best | ||
47 | avoided. It is natural to fix the style of a piece of code while working | ||
48 | on it for other reasons, but coding style changes should not be made for | ||
49 | their own sake. | ||
50 | |||
51 | The coding style document also should not be read as an absolute law which | ||
52 | can never be transgressed. If there is a good reason to go against the | ||
53 | style (a line which becomes far less readable if split to fit within the | ||
54 | 80-column limit, for example), just do it. | ||
55 | |||
56 | |||
57 | * Abstraction layers | ||
58 | |||
59 | Computer Science professors teach students to make extensive use of | ||
60 | abstraction layers in the name of flexibility and information hiding. | ||
61 | Certainly the kernel makes extensive use of abstraction; no project | ||
62 | involving several million lines of code could do otherwise and survive. | ||
63 | But experience has shown that excessive or premature abstraction can be | ||
64 | just as harmful as premature optimization. Abstraction should be used to | ||
65 | the level required and no further. | ||
66 | |||
67 | At a simple level, consider a function which has an argument which is | ||
68 | always passed as zero by all callers. One could retain that argument just | ||
69 | in case somebody eventually needs to use the extra flexibility that it | ||
70 | provides. By that time, though, chances are good that the code which | ||
71 | implements this extra argument has been broken in some subtle way which was | ||
72 | never noticed - because it has never been used. Or, when the need for | ||
73 | extra flexibility arises, it does not do so in a way which matches the | ||
74 | programmer's early expectation. Kernel developers will routinely submit | ||
75 | patches to remove unused arguments; they should, in general, not be added | ||
76 | in the first place. | ||
77 | |||
78 | Abstraction layers which hide access to hardware - often to allow the bulk | ||
79 | of a driver to be used with multiple operating systems - are especially | ||
80 | frowned upon. Such layers obscure the code and may impose a performance | ||
81 | penalty; they do not belong in the Linux kernel. | ||
82 | |||
83 | On the other hand, if you find yourself copying significant amounts of code | ||
84 | from another kernel subsystem, it is time to ask whether it would, in fact, | ||
85 | make sense to pull out some of that code into a separate library or to | ||
86 | implement that functionality at a higher level. There is no value in | ||
87 | replicating the same code throughout the kernel. | ||
88 | |||
89 | |||
90 | * #ifdef and preprocessor use in general | ||
91 | |||
92 | The C preprocessor seems to present a powerful temptation to some C | ||
93 | programmers, who see it as a way to efficiently encode a great deal of | ||
94 | flexibility into a source file. But the preprocessor is not C, and heavy | ||
95 | use of it results in code which is much harder for others to read and | ||
96 | harder for the compiler to check for correctness. Heavy preprocessor use | ||
97 | is almost always a sign of code which needs some cleanup work. | ||
98 | |||
99 | Conditional compilation with #ifdef is, indeed, a powerful feature, and it | ||
100 | is used within the kernel. But there is little desire to see code which is | ||
101 | sprinkled liberally with #ifdef blocks. As a general rule, #ifdef use | ||
102 | should be confined to header files whenever possible. | ||
103 | Conditionally-compiled code can be confined to functions which, if the code | ||
104 | is not to be present, simply become empty. The compiler will then quietly | ||
105 | optimize out the call to the empty function. The result is far cleaner | ||
106 | code which is easier to follow. | ||
107 | |||
108 | C preprocessor macros present a number of hazards, including possible | ||
109 | multiple evaluation of expressions with side effects and no type safety. | ||
110 | If you are tempted to define a macro, consider creating an inline function | ||
111 | instead. The code which results will be the same, but inline functions are | ||
112 | easier to read, do not evaluate their arguments multiple times, and allow | ||
113 | the compiler to perform type checking on the arguments and return value. | ||
114 | |||
115 | |||
116 | * Inline functions | ||
117 | |||
118 | Inline functions present a hazard of their own, though. Programmers can | ||
119 | become enamored of the perceived efficiency inherent in avoiding a function | ||
120 | call and fill a source file with inline functions. Those functions, | ||
121 | however, can actually reduce performance. Since their code is replicated | ||
122 | at each call site, they end up bloating the size of the compiled kernel. | ||
123 | That, in turn, creates pressure on the processor's memory caches, which can | ||
124 | slow execution dramatically. Inline functions, as a rule, should be quite | ||
125 | small and relatively rare. The cost of a function call, after all, is not | ||
126 | that high; the creation of large numbers of inline functions is a classic | ||
127 | example of premature optimization. | ||
128 | |||
129 | In general, kernel programmers ignore cache effects at their peril. The | ||
130 | classic time/space tradeoff taught in beginning data structures classes | ||
131 | often does not apply to contemporary hardware. Space *is* time, in that a | ||
132 | larger program will run slower than one which is more compact. | ||
133 | |||
134 | |||
135 | * Locking | ||
136 | |||
137 | In May, 2006, the "Devicescape" networking stack was, with great | ||
138 | fanfare, released under the GPL and made available for inclusion in the | ||
139 | mainline kernel. This donation was welcome news; support for wireless | ||
140 | networking in Linux was considered substandard at best, and the Devicescape | ||
141 | stack offered the promise of fixing that situation. Yet, this code did not | ||
142 | actually make it into the mainline until June, 2007 (2.6.22). What | ||
143 | happened? | ||
144 | |||
145 | This code showed a number of signs of having been developed behind | ||
146 | corporate doors. But one large problem in particular was that it was not | ||
147 | designed to work on multiprocessor systems. Before this networking stack | ||
148 | (now called mac80211) could be merged, a locking scheme needed to be | ||
149 | retrofitted onto it. | ||
150 | |||
151 | Once upon a time, Linux kernel code could be developed without thinking | ||
152 | about the concurrency issues presented by multiprocessor systems. Now, | ||
153 | however, this document is being written on a dual-core laptop. Even on | ||
154 | single-processor systems, work being done to improve responsiveness will | ||
155 | raise the level of concurrency within the kernel. The days when kernel | ||
156 | code could be written without thinking about locking are long past. | ||
157 | |||
158 | Any resource (data structures, hardware registers, etc.) which could be | ||
159 | accessed concurrently by more than one thread must be protected by a lock. | ||
160 | New code should be written with this requirement in mind; retrofitting | ||
161 | locking after the fact is a rather more difficult task. Kernel developers | ||
162 | should take the time to understand the available locking primitives well | ||
163 | enough to pick the right tool for the job. Code which shows a lack of | ||
164 | attention to concurrency will have a difficult path into the mainline. | ||
165 | |||
166 | |||
167 | * Regressions | ||
168 | |||
169 | One final hazard worth mentioning is this: it can be tempting to make a | ||
170 | change (which may bring big improvements) which causes something to break | ||
171 | for existing users. This kind of change is called a "regression," and | ||
172 | regressions have become most unwelcome in the mainline kernel. With few | ||
173 | exceptions, changes which cause regressions will be backed out if the | ||
174 | regression cannot be fixed in a timely manner. Far better to avoid the | ||
175 | regression in the first place. | ||
176 | |||
177 | It is often argued that a regression can be justified if it causes things | ||
178 | to work for more people than it creates problems for. Why not make a | ||
179 | change if it brings new functionality to ten systems for each one it | ||
180 | breaks? The best answer to this question was expressed by Linus in July, | ||
181 | 2007: | ||
182 | |||
183 | So we don't fix bugs by introducing new problems. That way lies | ||
184 | madness, and nobody ever knows if you actually make any real | ||
185 | progress at all. Is it two steps forwards, one step back, or one | ||
186 | step forward and two steps back? | ||
187 | |||
188 | (http://lwn.net/Articles/243460/). | ||
189 | |||
190 | An especially unwelcome type of regression is any sort of change to the | ||
191 | user-space ABI. Once an interface has been exported to user space, it must | ||
192 | be supported indefinitely. This fact makes the creation of user-space | ||
193 | interfaces particularly challenging: since they cannot be changed in | ||
194 | incompatible ways, they must be done right the first time. For this | ||
195 | reason, a great deal of thought, clear documentation, and wide review for | ||
196 | user-space interfaces is always required. | ||
197 | |||
198 | |||
199 | |||
200 | 4.2: CODE CHECKING TOOLS | ||
201 | |||
202 | For now, at least, the writing of error-free code remains an ideal that few | ||
203 | of us can reach. What we can hope to do, though, is to catch and fix as | ||
204 | many of those errors as possible before our code goes into the mainline | ||
205 | kernel. To that end, the kernel developers have put together an impressive | ||
206 | array of tools which can catch a wide variety of obscure problems in an | ||
207 | automated way. Any problem caught by the computer is a problem which will | ||
208 | not afflict a user later on, so it stands to reason that the automated | ||
209 | tools should be used whenever possible. | ||
210 | |||
211 | The first step is simply to heed the warnings produced by the compiler. | ||
212 | Contemporary versions of gcc can detect (and warn about) a large number of | ||
213 | potential errors. Quite often, these warnings point to real problems. | ||
214 | Code submitted for review should, as a rule, not produce any compiler | ||
215 | warnings. When silencing warnings, take care to understand the real cause | ||
216 | and try to avoid "fixes" which make the warning go away without addressing | ||
217 | its cause. | ||
218 | |||
219 | Note that not all compiler warnings are enabled by default. Build the | ||
220 | kernel with "make EXTRA_CFLAGS=-W" to get the full set. | ||
221 | |||
222 | The kernel provides several configuration options which turn on debugging | ||
223 | features; most of these are found in the "kernel hacking" submenu. Several | ||
224 | of these options should be turned on for any kernel used for development or | ||
225 | testing purposes. In particular, you should turn on: | ||
226 | |||
227 | - ENABLE_WARN_DEPRECATED, ENABLE_MUST_CHECK, and FRAME_WARN to get an | ||
228 | extra set of warnings for problems like the use of deprecated interfaces | ||
229 | or ignoring an important return value from a function. The output | ||
230 | generated by these warnings can be verbose, but one need not worry about | ||
231 | warnings from other parts of the kernel. | ||
232 | |||
233 | - DEBUG_OBJECTS will add code to track the lifetime of various objects | ||
234 | created by the kernel and warn when things are done out of order. If | ||
235 | you are adding a subsystem which creates (and exports) complex objects | ||
236 | of its own, consider adding support for the object debugging | ||
237 | infrastructure. | ||
238 | |||
239 | - DEBUG_SLAB can find a variety of memory allocation and use errors; it | ||
240 | should be used on most development kernels. | ||
241 | |||
242 | - DEBUG_SPINLOCK, DEBUG_SPINLOCK_SLEEP, and DEBUG_MUTEXES will find a | ||
243 | number of common locking errors. | ||
244 | |||
245 | There are quite a few other debugging options, some of which will be | ||
246 | discussed below. Some of them have a significant performance impact and | ||
247 | should not be used all of the time. But some time spent learning the | ||
248 | available options will likely be paid back many times over in short order. | ||
249 | |||
250 | One of the heavier debugging tools is the locking checker, or "lockdep." | ||
251 | This tool will track the acquisition and release of every lock (spinlock or | ||
252 | mutex) in the system, the order in which locks are acquired relative to | ||
253 | each other, the current interrupt environment, and more. It can then | ||
254 | ensure that locks are always acquired in the same order, that the same | ||
255 | interrupt assumptions apply in all situations, and so on. In other words, | ||
256 | lockdep can find a number of scenarios in which the system could, on rare | ||
257 | occasion, deadlock. This kind of problem can be painful (for both | ||
258 | developers and users) in a deployed system; lockdep allows them to be found | ||
259 | in an automated manner ahead of time. Code with any sort of non-trivial | ||
260 | locking should be run with lockdep enabled before being submitted for | ||
261 | inclusion. | ||
262 | |||
263 | As a diligent kernel programmer, you will, beyond doubt, check the return | ||
264 | status of any operation (such as a memory allocation) which can fail. The | ||
265 | fact of the matter, though, is that the resulting failure recovery paths | ||
266 | are, probably, completely untested. Untested code tends to be broken code; | ||
267 | you could be much more confident of your code if all those error-handling | ||
268 | paths had been exercised a few times. | ||
269 | |||
270 | The kernel provides a fault injection framework which can do exactly that, | ||
271 | especially where memory allocations are involved. With fault injection | ||
272 | enabled, a configurable percentage of memory allocations will be made to | ||
273 | fail; these failures can be restricted to a specific range of code. | ||
274 | Running with fault injection enabled allows the programmer to see how the | ||
275 | code responds when things go badly. See | ||
276 | Documentation/fault-injection/fault-injection.text for more information on | ||
277 | how to use this facility. | ||
278 | |||
279 | Other kinds of errors can be found with the "sparse" static analysis tool. | ||
280 | With sparse, the programmer can be warned about confusion between | ||
281 | user-space and kernel-space addresses, mixture of big-endian and | ||
282 | small-endian quantities, the passing of integer values where a set of bit | ||
283 | flags is expected, and so on. Sparse must be installed separately (it can | ||
284 | be found at http://www.kernel.org/pub/software/devel/sparse/ if your | ||
285 | distributor does not package it); it can then be run on the code by adding | ||
286 | "C=1" to your make command. | ||
287 | |||
288 | Other kinds of portability errors are best found by compiling your code for | ||
289 | other architectures. If you do not happen to have an S/390 system or a | ||
290 | Blackfin development board handy, you can still perform the compilation | ||
291 | step. A large set of cross compilers for x86 systems can be found at | ||
292 | |||
293 | http://www.kernel.org/pub/tools/crosstool/ | ||
294 | |||
295 | Some time spent installing and using these compilers will help avoid | ||
296 | embarrassment later. | ||
297 | |||
298 | |||
299 | 4.3: DOCUMENTATION | ||
300 | |||
301 | Documentation has often been more the exception than the rule with kernel | ||
302 | development. Even so, adequate documentation will help to ease the merging | ||
303 | of new code into the kernel, make life easier for other developers, and | ||
304 | will be helpful for your users. In many cases, the addition of | ||
305 | documentation has become essentially mandatory. | ||
306 | |||
307 | The first piece of documentation for any patch is its associated | ||
308 | changelog. Log entries should describe the problem being solved, the form | ||
309 | of the solution, the people who worked on the patch, any relevant | ||
310 | effects on performance, and anything else that might be needed to | ||
311 | understand the patch. | ||
312 | |||
313 | Any code which adds a new user-space interface - including new sysfs or | ||
314 | /proc files - should include documentation of that interface which enables | ||
315 | user-space developers to know what they are working with. See | ||
316 | Documentation/ABI/README for a description of how this documentation should | ||
317 | be formatted and what information needs to be provided. | ||
318 | |||
319 | The file Documentation/kernel-parameters.txt describes all of the kernel's | ||
320 | boot-time parameters. Any patch which adds new parameters should add the | ||
321 | appropriate entries to this file. | ||
322 | |||
323 | Any new configuration options must be accompanied by help text which | ||
324 | clearly explains the options and when the user might want to select them. | ||
325 | |||
326 | Internal API information for many subsystems is documented by way of | ||
327 | specially-formatted comments; these comments can be extracted and formatted | ||
328 | in a number of ways by the "kernel-doc" script. If you are working within | ||
329 | a subsystem which has kerneldoc comments, you should maintain them and add | ||
330 | them, as appropriate, for externally-available functions. Even in areas | ||
331 | which have not been so documented, there is no harm in adding kerneldoc | ||
332 | comments for the future; indeed, this can be a useful activity for | ||
333 | beginning kernel developers. The format of these comments, along with some | ||
334 | information on how to create kerneldoc templates can be found in the file | ||
335 | Documentation/kernel-doc-nano-HOWTO.txt. | ||
336 | |||
337 | Anybody who reads through a significant amount of existing kernel code will | ||
338 | note that, often, comments are most notable by their absence. Once again, | ||
339 | the expectations for new code are higher than they were in the past; | ||
340 | merging uncommented code will be harder. That said, there is little desire | ||
341 | for verbosely-commented code. The code should, itself, be readable, with | ||
342 | comments explaining the more subtle aspects. | ||
343 | |||
344 | Certain things should always be commented. Uses of memory barriers should | ||
345 | be accompanied by a line explaining why the barrier is necessary. The | ||
346 | locking rules for data structures generally need to be explained somewhere. | ||
347 | Major data structures need comprehensive documentation in general. | ||
348 | Non-obvious dependencies between separate bits of code should be pointed | ||
349 | out. Anything which might tempt a code janitor to make an incorrect | ||
350 | "cleanup" needs a comment saying why it is done the way it is. And so on. | ||
351 | |||
352 | |||
353 | 4.4: INTERNAL API CHANGES | ||
354 | |||
355 | The binary interface provided by the kernel to user space cannot be broken | ||
356 | except under the most severe circumstances. The kernel's internal | ||
357 | programming interfaces, instead, are highly fluid and can be changed when | ||
358 | the need arises. If you find yourself having to work around a kernel API, | ||
359 | or simply not using a specific functionality because it does not meet your | ||
360 | needs, that may be a sign that the API needs to change. As a kernel | ||
361 | developer, you are empowered to make such changes. | ||
362 | |||
363 | There are, of course, some catches. API changes can be made, but they need | ||
364 | to be well justified. So any patch making an internal API change should be | ||
365 | accompanied by a description of what the change is and why it is | ||
366 | necessary. This kind of change should also be broken out into a separate | ||
367 | patch, rather than buried within a larger patch. | ||
368 | |||
369 | The other catch is that a developer who changes an internal API is | ||
370 | generally charged with the task of fixing any code within the kernel tree | ||
371 | which is broken by the change. For a widely-used function, this duty can | ||
372 | lead to literally hundreds or thousands of changes - many of which are | ||
373 | likely to conflict with work being done by other developers. Needless to | ||
374 | say, this can be a large job, so it is best to be sure that the | ||
375 | justification is solid. | ||
376 | |||
377 | When making an incompatible API change, one should, whenever possible, | ||
378 | ensure that code which has not been updated is caught by the compiler. | ||
379 | This will help you to be sure that you have found all in-tree uses of that | ||
380 | interface. It will also alert developers of out-of-tree code that there is | ||
381 | a change that they need to respond to. Supporting out-of-tree code is not | ||
382 | something that kernel developers need to be worried about, but we also do | ||
383 | not have to make life harder for out-of-tree developers than it it needs to | ||
384 | be. | ||
diff --git a/Documentation/development-process/5.Posting b/Documentation/development-process/5.Posting new file mode 100644 index 000000000000..dd48132a74dd --- /dev/null +++ b/Documentation/development-process/5.Posting | |||
@@ -0,0 +1,278 @@ | |||
1 | 5: POSTING PATCHES | ||
2 | |||
3 | Sooner or later, the time comes when your work is ready to be presented to | ||
4 | the community for review and, eventually, inclusion into the mainline | ||
5 | kernel. Unsurprisingly, the kernel development community has evolved a set | ||
6 | of conventions and procedures which are used in the posting of patches; | ||
7 | following them will make life much easier for everybody involved. This | ||
8 | document will attempt to cover these expectations in reasonable detail; | ||
9 | more information can also be found in the files SubmittingPatches, | ||
10 | SubmittingDrivers, and SubmitChecklist in the kernel documentation | ||
11 | directory. | ||
12 | |||
13 | |||
14 | 5.1: WHEN TO POST | ||
15 | |||
16 | There is a constant temptation to avoid posting patches before they are | ||
17 | completely "ready." For simple patches, that is not a problem. If the | ||
18 | work being done is complex, though, there is a lot to be gained by getting | ||
19 | feedback from the community before the work is complete. So you should | ||
20 | consider posting in-progress work, or even making a git tree available so | ||
21 | that interested developers can catch up with your work at any time. | ||
22 | |||
23 | When posting code which is not yet considered ready for inclusion, it is a | ||
24 | good idea to say so in the posting itself. Also mention any major work | ||
25 | which remains to be done and any known problems. Fewer people will look at | ||
26 | patches which are known to be half-baked, but those who do will come in | ||
27 | with the idea that they can help you drive the work in the right direction. | ||
28 | |||
29 | |||
30 | 5.2: BEFORE CREATING PATCHES | ||
31 | |||
32 | There are a number of things which should be done before you consider | ||
33 | sending patches to the development community. These include: | ||
34 | |||
35 | - Test the code to the extent that you can. Make use of the kernel's | ||
36 | debugging tools, ensure that the kernel will build with all reasonable | ||
37 | combinations of configuration options, use cross-compilers to build for | ||
38 | different architectures, etc. | ||
39 | |||
40 | - Make sure your code is compliant with the kernel coding style | ||
41 | guidelines. | ||
42 | |||
43 | - Does your change have performance implications? If so, you should run | ||
44 | benchmarks showing what the impact (or benefit) of your change is; a | ||
45 | summary of the results should be included with the patch. | ||
46 | |||
47 | - Be sure that you have the right to post the code. If this work was done | ||
48 | for an employer, the employer likely has a right to the work and must be | ||
49 | agreeable with its release under the GPL. | ||
50 | |||
51 | As a general rule, putting in some extra thought before posting code almost | ||
52 | always pays back the effort in short order. | ||
53 | |||
54 | |||
55 | 5.3: PATCH PREPARATION | ||
56 | |||
57 | The preparation of patches for posting can be a surprising amount of work, | ||
58 | but, once again, attempting to save time here is not generally advisable | ||
59 | even in the short term. | ||
60 | |||
61 | Patches must be prepared against a specific version of the kernel. As a | ||
62 | general rule, a patch should be based on the current mainline as found in | ||
63 | Linus's git tree. It may become necessary to make versions against -mm, | ||
64 | linux-next, or a subsystem tree, though, to facilitate wider testing and | ||
65 | review. Depending on the area of your patch and what is going on | ||
66 | elsewhere, basing a patch against these other trees can require a | ||
67 | significant amount of work resolving conflicts and dealing with API | ||
68 | changes. | ||
69 | |||
70 | Only the most simple changes should be formatted as a single patch; | ||
71 | everything else should be made as a logical series of changes. Splitting | ||
72 | up patches is a bit of an art; some developers spend a long time figuring | ||
73 | out how to do it in the way that the community expects. There are a few | ||
74 | rules of thumb, however, which can help considerably: | ||
75 | |||
76 | - The patch series you post will almost certainly not be the series of | ||
77 | changes found in your working revision control system. Instead, the | ||
78 | changes you have made need to be considered in their final form, then | ||
79 | split apart in ways which make sense. The developers are interested in | ||
80 | discrete, self-contained changes, not the path you took to get to those | ||
81 | changes. | ||
82 | |||
83 | - Each logically independent change should be formatted as a separate | ||
84 | patch. These changes can be small ("add a field to this structure") or | ||
85 | large (adding a significant new driver, for example), but they should be | ||
86 | conceptually small and amenable to a one-line description. Each patch | ||
87 | should make a specific change which can be reviewed on its own and | ||
88 | verified to do what it says it does. | ||
89 | |||
90 | - As a way of restating the guideline above: do not mix different types of | ||
91 | changes in the same patch. If a single patch fixes a critical security | ||
92 | bug, rearranges a few structures, and reformats the code, there is a | ||
93 | good chance that it will be passed over and the important fix will be | ||
94 | lost. | ||
95 | |||
96 | - Each patch should yield a kernel which builds and runs properly; if your | ||
97 | patch series is interrupted in the middle, the result should still be a | ||
98 | working kernel. Partial application of a patch series is a common | ||
99 | scenario when the "git bisect" tool is used to find regressions; if the | ||
100 | result is a broken kernel, you will make life harder for developers and | ||
101 | users who are engaging in the noble work of tracking down problems. | ||
102 | |||
103 | - Do not overdo it, though. One developer recently posted a set of edits | ||
104 | to a single file as 500 separate patches - an act which did not make him | ||
105 | the most popular person on the kernel mailing list. A single patch can | ||
106 | be reasonably large as long as it still contains a single *logical* | ||
107 | change. | ||
108 | |||
109 | - It can be tempting to add a whole new infrastructure with a series of | ||
110 | patches, but to leave that infrastructure unused until the final patch | ||
111 | in the series enables the whole thing. This temptation should be | ||
112 | avoided if possible; if that series adds regressions, bisection will | ||
113 | finger the last patch as the one which caused the problem, even though | ||
114 | the real bug is elsewhere. Whenever possible, a patch which adds new | ||
115 | code should make that code active immediately. | ||
116 | |||
117 | Working to create the perfect patch series can be a frustrating process | ||
118 | which takes quite a bit of time and thought after the "real work" has been | ||
119 | done. When done properly, though, it is time well spent. | ||
120 | |||
121 | |||
122 | 5.4: PATCH FORMATTING | ||
123 | |||
124 | So now you have a perfect series of patches for posting, but the work is | ||
125 | not done quite yet. Each patch needs to be formatted into a message which | ||
126 | quickly and clearly communicates its purpose to the rest of the world. To | ||
127 | that end, each patch will be composed of the following: | ||
128 | |||
129 | - An optional "From" line naming the author of the patch. This line is | ||
130 | only necessary if you are passing on somebody else's patch via email, | ||
131 | but it never hurts to add it when in doubt. | ||
132 | |||
133 | - A one-line description of what the patch does. This message should be | ||
134 | enough for a reader who sees it with no other context to figure out the | ||
135 | scope of the patch; it is the line that will show up in the "short form" | ||
136 | changelogs. This message is usually formatted with the relevant | ||
137 | subsystem name first, followed by the purpose of the patch. For | ||
138 | example: | ||
139 | |||
140 | gpio: fix build on CONFIG_GPIO_SYSFS=n | ||
141 | |||
142 | - A blank line followed by a detailed description of the contents of the | ||
143 | patch. This description can be as long as is required; it should say | ||
144 | what the patch does and why it should be applied to the kernel. | ||
145 | |||
146 | - One or more tag lines, with, at a minimum, one Signed-off-by: line from | ||
147 | the author of the patch. Tags will be described in more detail below. | ||
148 | |||
149 | The above three items should, normally, be the text used when committing | ||
150 | the change to a revision control system. They are followed by: | ||
151 | |||
152 | - The patch itself, in the unified ("-u") patch format. Using the "-p" | ||
153 | option to diff will associate function names with changes, making the | ||
154 | resulting patch easier for others to read. | ||
155 | |||
156 | You should avoid including changes to irrelevant files (those generated by | ||
157 | the build process, for example, or editor backup files) in the patch. The | ||
158 | file "dontdiff" in the Documentation directory can help in this regard; | ||
159 | pass it to diff with the "-X" option. | ||
160 | |||
161 | The tags mentioned above are used to describe how various developers have | ||
162 | been associated with the development of this patch. They are described in | ||
163 | detail in the SubmittingPatches document; what follows here is a brief | ||
164 | summary. Each of these lines has the format: | ||
165 | |||
166 | tag: Full Name <email address> optional-other-stuff | ||
167 | |||
168 | The tags in common use are: | ||
169 | |||
170 | - Signed-off-by: this is a developer's certification that he or she has | ||
171 | the right to submit the patch for inclusion into the kernel. It is an | ||
172 | agreement to the Developer's Certificate of Origin, the full text of | ||
173 | which can be found in Documentation/SubmittingPatches. Code without a | ||
174 | proper signoff cannot be merged into the mainline. | ||
175 | |||
176 | - Acked-by: indicates an agreement by another developer (often a | ||
177 | maintainer of the relevant code) that the patch is appropriate for | ||
178 | inclusion into the kernel. | ||
179 | |||
180 | - Tested-by: states that the named person has tested the patch and found | ||
181 | it to work. | ||
182 | |||
183 | - Reviewed-by: the named developer has reviewed the patch for correctness; | ||
184 | see the reviewer's statement in Documentation/SubmittingPatches for more | ||
185 | detail. | ||
186 | |||
187 | - Reported-by: names a user who reported a problem which is fixed by this | ||
188 | patch; this tag is used to give credit to the (often underappreciated) | ||
189 | people who test our code and let us know when things do not work | ||
190 | correctly. | ||
191 | |||
192 | - Cc: the named person received a copy of the patch and had the | ||
193 | opportunity to comment on it. | ||
194 | |||
195 | Be careful in the addition of tags to your patches: only Cc: is appropriate | ||
196 | for addition without the explicit permission of the person named. | ||
197 | |||
198 | |||
199 | 5.5: SENDING THE PATCH | ||
200 | |||
201 | Before you mail your patches, there are a couple of other things you should | ||
202 | take care of: | ||
203 | |||
204 | - Are you sure that your mailer will not corrupt the patches? Patches | ||
205 | which have had gratuitous white-space changes or line wrapping performed | ||
206 | by the mail client will not apply at the other end, and often will not | ||
207 | be examined in any detail. If there is any doubt at all, mail the patch | ||
208 | to yourself and convince yourself that it shows up intact. | ||
209 | |||
210 | Documentation/email-clients.txt has some helpful hints on making | ||
211 | specific mail clients work for sending patches. | ||
212 | |||
213 | - Are you sure your patch is free of silly mistakes? You should always | ||
214 | run patches through scripts/checkpatch.pl and address the complaints it | ||
215 | comes up with. Please bear in mind that checkpatch.pl, while being the | ||
216 | embodiment of a fair amount of thought about what kernel patches should | ||
217 | look like, is not smarter than you. If fixing a checkpatch.pl complaint | ||
218 | would make the code worse, don't do it. | ||
219 | |||
220 | Patches should always be sent as plain text. Please do not send them as | ||
221 | attachments; that makes it much harder for reviewers to quote sections of | ||
222 | the patch in their replies. Instead, just put the patch directly into your | ||
223 | message. | ||
224 | |||
225 | When mailing patches, it is important to send copies to anybody who might | ||
226 | be interested in it. Unlike some other projects, the kernel encourages | ||
227 | people to err on the side of sending too many copies; don't assume that the | ||
228 | relevant people will see your posting on the mailing lists. In particular, | ||
229 | copies should go to: | ||
230 | |||
231 | - The maintainer(s) of the affected subsystem(s). As described earlier, | ||
232 | the MAINTAINERS file is the first place to look for these people. | ||
233 | |||
234 | - Other developers who have been working in the same area - especially | ||
235 | those who might be working there now. Using git to see who else has | ||
236 | modified the files you are working on can be helpful. | ||
237 | |||
238 | - If you are responding to a bug report or a feature request, copy the | ||
239 | original poster as well. | ||
240 | |||
241 | - Send a copy to the relevant mailing list, or, if nothing else applies, | ||
242 | the linux-kernel list. | ||
243 | |||
244 | - If you are fixing a bug, think about whether the fix should go into the | ||
245 | next stable update. If so, stable@kernel.org should get a copy of the | ||
246 | patch. Also add a "Cc: stable@kernel.org" to the tags within the patch | ||
247 | itself; that will cause the stable team to get a notification when your | ||
248 | fix goes into the mainline. | ||
249 | |||
250 | When selecting recipients for a patch, it is good to have an idea of who | ||
251 | you think will eventually accept the patch and get it merged. While it | ||
252 | is possible to send patches directly to Linus Torvalds and have him merge | ||
253 | them, things are not normally done that way. Linus is busy, and there are | ||
254 | subsystem maintainers who watch over specific parts of the kernel. Usually | ||
255 | you will be wanting that maintainer to merge your patches. If there is no | ||
256 | obvious maintainer, Andrew Morton is often the patch target of last resort. | ||
257 | |||
258 | Patches need good subject lines. The canonical format for a patch line is | ||
259 | something like: | ||
260 | |||
261 | [PATCH nn/mm] subsys: one-line description of the patch | ||
262 | |||
263 | where "nn" is the ordinal number of the patch, "mm" is the total number of | ||
264 | patches in the series, and "subsys" is the name of the affected subsystem. | ||
265 | Clearly, nn/mm can be omitted for a single, standalone patch. | ||
266 | |||
267 | If you have a significant series of patches, it is customary to send an | ||
268 | introductory description as part zero. This convention is not universally | ||
269 | followed though; if you use it, remember that information in the | ||
270 | introduction does not make it into the kernel changelogs. So please ensure | ||
271 | that the patches, themselves, have complete changelog information. | ||
272 | |||
273 | In general, the second and following parts of a multi-part patch should be | ||
274 | sent as a reply to the first part so that they all thread together at the | ||
275 | receiving end. Tools like git and quilt have commands to mail out a set of | ||
276 | patches with the proper threading. If you have a long series, though, and | ||
277 | are using git, please provide the --no-chain-reply-to option to avoid | ||
278 | creating exceptionally deep nesting. | ||
diff --git a/Documentation/development-process/6.Followthrough b/Documentation/development-process/6.Followthrough new file mode 100644 index 000000000000..a8fba3d83a85 --- /dev/null +++ b/Documentation/development-process/6.Followthrough | |||
@@ -0,0 +1,202 @@ | |||
1 | 6: FOLLOWTHROUGH | ||
2 | |||
3 | At this point, you have followed the guidelines given so far and, with the | ||
4 | addition of your own engineering skills, have posted a perfect series of | ||
5 | patches. One of the biggest mistakes that even experienced kernel | ||
6 | developers can make is to conclude that their work is now done. In truth, | ||
7 | posting patches indicates a transition into the next stage of the process, | ||
8 | with, possibly, quite a bit of work yet to be done. | ||
9 | |||
10 | It is a rare patch which is so good at its first posting that there is no | ||
11 | room for improvement. The kernel development process recognizes this fact, | ||
12 | and, as a result, is heavily oriented toward the improvement of posted | ||
13 | code. You, as the author of that code, will be expected to work with the | ||
14 | kernel community to ensure that your code is up to the kernel's quality | ||
15 | standards. A failure to participate in this process is quite likely to | ||
16 | prevent the inclusion of your patches into the mainline. | ||
17 | |||
18 | |||
19 | 6.1: WORKING WITH REVIEWERS | ||
20 | |||
21 | A patch of any significance will result in a number of comments from other | ||
22 | developers as they review the code. Working with reviewers can be, for | ||
23 | many developers, the most intimidating part of the kernel development | ||
24 | process. Life can be made much easier, though, if you keep a few things in | ||
25 | mind: | ||
26 | |||
27 | - If you have explained your patch well, reviewers will understand its | ||
28 | value and why you went to the trouble of writing it. But that value | ||
29 | will not keep them from asking a fundamental question: what will it be | ||
30 | like to maintain a kernel with this code in it five or ten years later? | ||
31 | Many of the changes you may be asked to make - from coding style tweaks | ||
32 | to substantial rewrites - come from the understanding that Linux will | ||
33 | still be around and under development a decade from now. | ||
34 | |||
35 | - Code review is hard work, and it is a relatively thankless occupation; | ||
36 | people remember who wrote kernel code, but there is little lasting fame | ||
37 | for those who reviewed it. So reviewers can get grumpy, especially when | ||
38 | they see the same mistakes being made over and over again. If you get a | ||
39 | review which seems angry, insulting, or outright offensive, resist the | ||
40 | impulse to respond in kind. Code review is about the code, not about | ||
41 | the people, and code reviewers are not attacking you personally. | ||
42 | |||
43 | - Similarly, code reviewers are not trying to promote their employers' | ||
44 | agendas at the expense of your own. Kernel developers often expect to | ||
45 | be working on the kernel years from now, but they understand that their | ||
46 | employer could change. They truly are, almost without exception, | ||
47 | working toward the creation of the best kernel they can; they are not | ||
48 | trying to create discomfort for their employers' competitors. | ||
49 | |||
50 | What all of this comes down to is that, when reviewers send you comments, | ||
51 | you need to pay attention to the technical observations that they are | ||
52 | making. Do not let their form of expression or your own pride keep that | ||
53 | from happening. When you get review comments on a patch, take the time to | ||
54 | understand what the reviewer is trying to say. If possible, fix the things | ||
55 | that the reviewer is asking you to fix. And respond back to the reviewer: | ||
56 | thank them, and describe how you will answer their questions. | ||
57 | |||
58 | Note that you do not have to agree with every change suggested by | ||
59 | reviewers. If you believe that the reviewer has misunderstood your code, | ||
60 | explain what is really going on. If you have a technical objection to a | ||
61 | suggested change, describe it and justify your solution to the problem. If | ||
62 | your explanations make sense, the reviewer will accept them. Should your | ||
63 | explanation not prove persuasive, though, especially if others start to | ||
64 | agree with the reviewer, take some time to think things over again. It can | ||
65 | be easy to become blinded by your own solution to a problem to the point | ||
66 | that you don't realize that something is fundamentally wrong or, perhaps, | ||
67 | you're not even solving the right problem. | ||
68 | |||
69 | One fatal mistake is to ignore review comments in the hope that they will | ||
70 | go away. They will not go away. If you repost code without having | ||
71 | responded to the comments you got the time before, you're likely to find | ||
72 | that your patches go nowhere. | ||
73 | |||
74 | Speaking of reposting code: please bear in mind that reviewers are not | ||
75 | going to remember all the details of the code you posted the last time | ||
76 | around. So it is always a good idea to remind reviewers of previously | ||
77 | raised issues and how you dealt with them; the patch changelog is a good | ||
78 | place for this kind of information. Reviewers should not have to search | ||
79 | through list archives to familiarize themselves with what was said last | ||
80 | time; if you help them get a running start, they will be in a better mood | ||
81 | when they revisit your code. | ||
82 | |||
83 | What if you've tried to do everything right and things still aren't going | ||
84 | anywhere? Most technical disagreements can be resolved through discussion, | ||
85 | but there are times when somebody simply has to make a decision. If you | ||
86 | honestly believe that this decision is going against you wrongly, you can | ||
87 | always try appealing to a higher power. As of this writing, that higher | ||
88 | power tends to be Andrew Morton. Andrew has a great deal of respect in the | ||
89 | kernel development community; he can often unjam a situation which seems to | ||
90 | be hopelessly blocked. Appealing to Andrew should not be done lightly, | ||
91 | though, and not before all other alternatives have been explored. And bear | ||
92 | in mind, of course, that he may not agree with you either. | ||
93 | |||
94 | |||
95 | 6.2: WHAT HAPPENS NEXT | ||
96 | |||
97 | If a patch is considered to be a good thing to add to the kernel, and once | ||
98 | most of the review issues have been resolved, the next step is usually | ||
99 | entry into a subsystem maintainer's tree. How that works varies from one | ||
100 | subsystem to the next; each maintainer has his or her own way of doing | ||
101 | things. In particular, there may be more than one tree - one, perhaps, | ||
102 | dedicated to patches planned for the next merge window, and another for | ||
103 | longer-term work. | ||
104 | |||
105 | For patches applying to areas for which there is no obvious subsystem tree | ||
106 | (memory management patches, for example), the default tree often ends up | ||
107 | being -mm. Patches which affect multiple subsystems can also end up going | ||
108 | through the -mm tree. | ||
109 | |||
110 | Inclusion into a subsystem tree can bring a higher level of visibility to a | ||
111 | patch. Now other developers working with that tree will get the patch by | ||
112 | default. Subsystem trees typically feed into -mm and linux-next as well, | ||
113 | making their contents visible to the development community as a whole. At | ||
114 | this point, there's a good chance that you will get more comments from a | ||
115 | new set of reviewers; these comments need to be answered as in the previous | ||
116 | round. | ||
117 | |||
118 | What may also happen at this point, depending on the nature of your patch, | ||
119 | is that conflicts with work being done by others turn up. In the worst | ||
120 | case, heavy patch conflicts can result in some work being put on the back | ||
121 | burner so that the remaining patches can be worked into shape and merged. | ||
122 | Other times, conflict resolution will involve working with the other | ||
123 | developers and, possibly, moving some patches between trees to ensure that | ||
124 | everything applies cleanly. This work can be a pain, but count your | ||
125 | blessings: before the advent of the linux-next tree, these conflicts often | ||
126 | only turned up during the merge window and had to be addressed in a hurry. | ||
127 | Now they can be resolved at leisure, before the merge window opens. | ||
128 | |||
129 | Some day, if all goes well, you'll log on and see that your patch has been | ||
130 | merged into the mainline kernel. Congratulations! Once the celebration is | ||
131 | complete (and you have added yourself to the MAINTAINERS file), though, it | ||
132 | is worth remembering an important little fact: the job still is not done. | ||
133 | Merging into the mainline brings its own challenges. | ||
134 | |||
135 | To begin with, the visibility of your patch has increased yet again. There | ||
136 | may be a new round of comments from developers who had not been aware of | ||
137 | the patch before. It may be tempting to ignore them, since there is no | ||
138 | longer any question of your code being merged. Resist that temptation, | ||
139 | though; you still need to be responsive to developers who have questions or | ||
140 | suggestions. | ||
141 | |||
142 | More importantly, though: inclusion into the mainline puts your code into | ||
143 | the hands of a much larger group of testers. Even if you have contributed | ||
144 | a driver for hardware which is not yet available, you will be surprised by | ||
145 | how many people will build your code into their kernels. And, of course, | ||
146 | where there are testers, there will be bug reports. | ||
147 | |||
148 | The worst sort of bug reports are regressions. If your patch causes a | ||
149 | regression, you'll find an uncomfortable number of eyes upon you; | ||
150 | regressions need to be fixed as soon as possible. If you are unwilling or | ||
151 | unable to fix the regression (and nobody else does it for you), your patch | ||
152 | will almost certainly be removed during the stabilization period. Beyond | ||
153 | negating all of the work you have done to get your patch into the mainline, | ||
154 | having a patch pulled as the result of a failure to fix a regression could | ||
155 | well make it harder for you to get work merged in the future. | ||
156 | |||
157 | After any regressions have been dealt with, there may be other, ordinary | ||
158 | bugs to deal with. The stabilization period is your best opportunity to | ||
159 | fix these bugs and ensure that your code's debut in a mainline kernel | ||
160 | release is as solid as possible. So, please, answer bug reports, and fix | ||
161 | the problems if at all possible. That's what the stabilization period is | ||
162 | for; you can start creating cool new patches once any problems with the old | ||
163 | ones have been taken care of. | ||
164 | |||
165 | And don't forget that there are other milestones which may also create bug | ||
166 | reports: the next mainline stable release, when prominent distributors pick | ||
167 | up a version of the kernel containing your patch, etc. Continuing to | ||
168 | respond to these reports is a matter of basic pride in your work. If that | ||
169 | is insufficient motivation, though, it's also worth considering that the | ||
170 | development community remembers developers who lose interest in their code | ||
171 | after it's merged. The next time you post a patch, they will be evaluating | ||
172 | it with the assumption that you will not be around to maintain it | ||
173 | afterward. | ||
174 | |||
175 | |||
176 | 6.3: OTHER THINGS THAT CAN HAPPEN | ||
177 | |||
178 | One day, you may open your mail client and see that somebody has mailed you | ||
179 | a patch to your code. That is one of the advantages of having your code | ||
180 | out there in the open, after all. If you agree with the patch, you can | ||
181 | either forward it on to the subsystem maintainer (be sure to include a | ||
182 | proper From: line so that the attribution is correct, and add a signoff of | ||
183 | your own), or send an Acked-by: response back and let the original poster | ||
184 | send it upward. | ||
185 | |||
186 | If you disagree with the patch, send a polite response explaining why. If | ||
187 | possible, tell the author what changes need to be made to make the patch | ||
188 | acceptable to you. There is a certain resistance to merging patches which | ||
189 | are opposed by the author and maintainer of the code, but it only goes so | ||
190 | far. If you are seen as needlessly blocking good work, those patches will | ||
191 | eventually flow around you and get into the mainline anyway. In the Linux | ||
192 | kernel, nobody has absolute veto power over any code. Except maybe Linus. | ||
193 | |||
194 | On very rare occasion, you may see something completely different: another | ||
195 | developer posts a different solution to your problem. At that point, | ||
196 | chances are that one of the two patches will not be merged, and "mine was | ||
197 | here first" is not considered to be a compelling technical argument. If | ||
198 | somebody else's patch displaces yours and gets into the mainline, there is | ||
199 | really only one way to respond: be pleased that your problem got solved and | ||
200 | get on with your work. Having one's work shoved aside in this manner can | ||
201 | be hurtful and discouraging, but the community will remember your reaction | ||
202 | long after they have forgotten whose patch actually got merged. | ||
diff --git a/Documentation/development-process/7.AdvancedTopics b/Documentation/development-process/7.AdvancedTopics new file mode 100644 index 000000000000..a2cf74093aa1 --- /dev/null +++ b/Documentation/development-process/7.AdvancedTopics | |||
@@ -0,0 +1,173 @@ | |||
1 | 7: ADVANCED TOPICS | ||
2 | |||
3 | At this point, hopefully, you have a handle on how the development process | ||
4 | works. There is still more to learn, however! This section will cover a | ||
5 | number of topics which can be helpful for developers wanting to become a | ||
6 | regular part of the Linux kernel development process. | ||
7 | |||
8 | 7.1: MANAGING PATCHES WITH GIT | ||
9 | |||
10 | The use of distributed version control for the kernel began in early 2002, | ||
11 | when Linus first started playing with the proprietary BitKeeper | ||
12 | application. While BitKeeper was controversial, the approach to software | ||
13 | version management it embodied most certainly was not. Distributed version | ||
14 | control enabled an immediate acceleration of the kernel development | ||
15 | project. In current times, there are several free alternatives to | ||
16 | BitKeeper. For better or for worse, the kernel project has settled on git | ||
17 | as its tool of choice. | ||
18 | |||
19 | Managing patches with git can make life much easier for the developer, | ||
20 | especially as the volume of those patches grows. Git also has its rough | ||
21 | edges and poses certain hazards; it is a young and powerful tool which is | ||
22 | still being civilized by its developers. This document will not attempt to | ||
23 | teach the reader how to use git; that would be sufficient material for a | ||
24 | long document in its own right. Instead, the focus here will be on how git | ||
25 | fits into the kernel development process in particular. Developers who | ||
26 | wish to come up to speed with git will find more information at: | ||
27 | |||
28 | http://git.or.cz/ | ||
29 | |||
30 | http://www.kernel.org/pub/software/scm/git/docs/user-manual.html | ||
31 | |||
32 | and on various tutorials found on the web. | ||
33 | |||
34 | The first order of business is to read the above sites and get a solid | ||
35 | understanding of how git works before trying to use it to make patches | ||
36 | available to others. A git-using developer should be able to obtain a copy | ||
37 | of the mainline repository, explore the revision history, commit changes to | ||
38 | the tree, use branches, etc. An understanding of git's tools for the | ||
39 | rewriting of history (such as rebase) is also useful. Git comes with its | ||
40 | own terminology and concepts; a new user of git should know about refs, | ||
41 | remote branches, the index, fast-forward merges, pushes and pulls, detached | ||
42 | heads, etc. It can all be a little intimidating at the outset, but the | ||
43 | concepts are not that hard to grasp with a bit of study. | ||
44 | |||
45 | Using git to generate patches for submission by email can be a good | ||
46 | exercise while coming up to speed. | ||
47 | |||
48 | When you are ready to start putting up git trees for others to look at, you | ||
49 | will, of course, need a server that can be pulled from. Setting up such a | ||
50 | server with git-daemon is relatively straightforward if you have a system | ||
51 | which is accessible to the Internet. Otherwise, free, public hosting sites | ||
52 | (Github, for example) are starting to appear on the net. Established | ||
53 | developers can get an account on kernel.org, but those are not easy to come | ||
54 | by; see http://kernel.org/faq/ for more information. | ||
55 | |||
56 | The normal git workflow involves the use of a lot of branches. Each line | ||
57 | of development can be separated into a separate "topic branch" and | ||
58 | maintained independently. Branches in git are cheap, there is no reason to | ||
59 | not make free use of them. And, in any case, you should not do your | ||
60 | development in any branch which you intend to ask others to pull from. | ||
61 | Publicly-available branches should be created with care; merge in patches | ||
62 | from development branches when they are in complete form and ready to go - | ||
63 | not before. | ||
64 | |||
65 | Git provides some powerful tools which can allow you to rewrite your | ||
66 | development history. An inconvenient patch (one which breaks bisection, | ||
67 | say, or which has some other sort of obvious bug) can be fixed in place or | ||
68 | made to disappear from the history entirely. A patch series can be | ||
69 | rewritten as if it had been written on top of today's mainline, even though | ||
70 | you have been working on it for months. Changes can be transparently | ||
71 | shifted from one branch to another. And so on. Judicious use of git's | ||
72 | ability to revise history can help in the creation of clean patch sets with | ||
73 | fewer problems. | ||
74 | |||
75 | Excessive use of this capability can lead to other problems, though, beyond | ||
76 | a simple obsession for the creation of the perfect project history. | ||
77 | Rewriting history will rewrite the changes contained in that history, | ||
78 | turning a tested (hopefully) kernel tree into an untested one. But, beyond | ||
79 | that, developers cannot easily collaborate if they do not have a shared | ||
80 | view of the project history; if you rewrite history which other developers | ||
81 | have pulled into their repositories, you will make life much more difficult | ||
82 | for those developers. So a simple rule of thumb applies here: history | ||
83 | which has been exported to others should generally be seen as immutable | ||
84 | thereafter. | ||
85 | |||
86 | So, once you push a set of changes to your publicly-available server, those | ||
87 | changes should not be rewritten. Git will attempt to enforce this rule if | ||
88 | you try to push changes which do not result in a fast-forward merge | ||
89 | (i.e. changes which do not share the same history). It is possible to | ||
90 | override this check, and there may be times when it is necessary to rewrite | ||
91 | an exported tree. Moving changesets between trees to avoid conflicts in | ||
92 | linux-next is one example. But such actions should be rare. This is one | ||
93 | of the reasons why development should be done in private branches (which | ||
94 | can be rewritten if necessary) and only moved into public branches when | ||
95 | it's in a reasonably advanced state. | ||
96 | |||
97 | As the mainline (or other tree upon which a set of changes is based) | ||
98 | advances, it is tempting to merge with that tree to stay on the leading | ||
99 | edge. For a private branch, rebasing can be an easy way to keep up with | ||
100 | another tree, but rebasing is not an option once a tree is exported to the | ||
101 | world. Once that happens, a full merge must be done. Merging occasionally | ||
102 | makes good sense, but overly frequent merges can clutter the history | ||
103 | needlessly. Suggested technique in this case is to merge infrequently, and | ||
104 | generally only at specific release points (such as a mainline -rc | ||
105 | release). If you are nervous about specific changes, you can always | ||
106 | perform test merges in a private branch. The git "rerere" tool can be | ||
107 | useful in such situations; it remembers how merge conflicts were resolved | ||
108 | so that you don't have to do the same work twice. | ||
109 | |||
110 | One of the biggest recurring complaints about tools like git is this: the | ||
111 | mass movement of patches from one repository to another makes it easy to | ||
112 | slip in ill-advised changes which go into the mainline below the review | ||
113 | radar. Kernel developers tend to get unhappy when they see that kind of | ||
114 | thing happening; putting up a git tree with unreviewed or off-topic patches | ||
115 | can affect your ability to get trees pulled in the future. Quoting Linus: | ||
116 | |||
117 | You can send me patches, but for me to pull a git patch from you, I | ||
118 | need to know that you know what you're doing, and I need to be able | ||
119 | to trust things *without* then having to go and check every | ||
120 | individual change by hand. | ||
121 | |||
122 | (http://lwn.net/Articles/224135/). | ||
123 | |||
124 | To avoid this kind of situation, ensure that all patches within a given | ||
125 | branch stick closely to the associated topic; a "driver fixes" branch | ||
126 | should not be making changes to the core memory management code. And, most | ||
127 | importantly, do not use a git tree to bypass the review process. Post an | ||
128 | occasional summary of the tree to the relevant list, and, when the time is | ||
129 | right, request that the tree be included in linux-next. | ||
130 | |||
131 | If and when others start to send patches for inclusion into your tree, | ||
132 | don't forget to review them. Also ensure that you maintain the correct | ||
133 | authorship information; the git "am" tool does its best in this regard, but | ||
134 | you may have to add a "From:" line to the patch if it has been relayed to | ||
135 | you via a third party. | ||
136 | |||
137 | When requesting a pull, be sure to give all the relevant information: where | ||
138 | your tree is, what branch to pull, and what changes will result from the | ||
139 | pull. The git request-pull command can be helpful in this regard; it will | ||
140 | format the request as other developers expect, and will also check to be | ||
141 | sure that you have remembered to push those changes to the public server. | ||
142 | |||
143 | |||
144 | 7.2: REVIEWING PATCHES | ||
145 | |||
146 | Some readers will certainly object to putting this section with "advanced | ||
147 | topics" on the grounds that even beginning kernel developers should be | ||
148 | reviewing patches. It is certainly true that there is no better way to | ||
149 | learn how to program in the kernel environment than by looking at code | ||
150 | posted by others. In addition, reviewers are forever in short supply; by | ||
151 | looking at code you can make a significant contribution to the process as a | ||
152 | whole. | ||
153 | |||
154 | Reviewing code can be an intimidating prospect, especially for a new kernel | ||
155 | developer who may well feel nervous about questioning code - in public - | ||
156 | which has been posted by those with more experience. Even code written by | ||
157 | the most experienced developers can be improved, though. Perhaps the best | ||
158 | piece of advice for reviewers (all reviewers) is this: phrase review | ||
159 | comments as questions rather than criticisms. Asking "how does the lock | ||
160 | get released in this path?" will always work better than stating "the | ||
161 | locking here is wrong." | ||
162 | |||
163 | Different developers will review code from different points of view. Some | ||
164 | are mostly concerned with coding style and whether code lines have trailing | ||
165 | white space. Others will focus primarily on whether the change implemented | ||
166 | by the patch as a whole is a good thing for the kernel or not. Yet others | ||
167 | will check for problematic locking, excessive stack usage, possible | ||
168 | security issues, duplication of code found elsewhere, adequate | ||
169 | documentation, adverse effects on performance, user-space ABI changes, etc. | ||
170 | All types of review, if they lead to better code going into the kernel, are | ||
171 | welcome and worthwhile. | ||
172 | |||
173 | |||
diff --git a/Documentation/development-process/8.Conclusion b/Documentation/development-process/8.Conclusion new file mode 100644 index 000000000000..1990ab4b4949 --- /dev/null +++ b/Documentation/development-process/8.Conclusion | |||
@@ -0,0 +1,74 @@ | |||
1 | 8: FOR MORE INFORMATION | ||
2 | |||
3 | There are numerous sources of information on Linux kernel development and | ||
4 | related topics. First among those will always be the Documentation | ||
5 | directory found in the kernel source distribution. The top-level HOWTO | ||
6 | file is an important starting point; SubmittingPatches and | ||
7 | SubmittingDrivers are also something which all kernel developers should | ||
8 | read. Many internal kernel APIs are documented using the kerneldoc | ||
9 | mechanism; "make htmldocs" or "make pdfdocs" can be used to generate those | ||
10 | documents in HTML or PDF format (though the version of TeX shipped by some | ||
11 | distributions runs into internal limits and fails to process the documents | ||
12 | properly). | ||
13 | |||
14 | Various web sites discuss kernel development at all levels of detail. Your | ||
15 | author would like to humbly suggest http://lwn.net/ as a source; | ||
16 | information on many specific kernel topics can be found via the LWN kernel | ||
17 | index at: | ||
18 | |||
19 | http://lwn.net/Kernel/Index/ | ||
20 | |||
21 | Beyond that, a valuable resource for kernel developers is: | ||
22 | |||
23 | http://kernelnewbies.org/ | ||
24 | |||
25 | Information about the linux-next tree gathers at: | ||
26 | |||
27 | http://linux.f-seidel.de/linux-next/pmwiki/ | ||
28 | |||
29 | And, of course, one should not forget http://kernel.org/, the definitive | ||
30 | location for kernel release information. | ||
31 | |||
32 | There are a number of books on kernel development: | ||
33 | |||
34 | Linux Device Drivers, 3rd Edition (Jonathan Corbet, Alessandro | ||
35 | Rubini, and Greg Kroah-Hartman). Online at | ||
36 | http://lwn.net/Kernel/LDD3/. | ||
37 | |||
38 | Linux Kernel Development (Robert Love). | ||
39 | |||
40 | Understanding the Linux Kernel (Daniel Bovet and Marco Cesati). | ||
41 | |||
42 | All of these books suffer from a common fault, though: they tend to be | ||
43 | somewhat obsolete by the time they hit the shelves, and they have been on | ||
44 | the shelves for a while now. Still, there is quite a bit of good | ||
45 | information to be found there. | ||
46 | |||
47 | Documentation for git can be found at: | ||
48 | |||
49 | http://www.kernel.org/pub/software/scm/git/docs/ | ||
50 | |||
51 | http://www.kernel.org/pub/software/scm/git/docs/user-manual.html | ||
52 | |||
53 | |||
54 | 9: CONCLUSION | ||
55 | |||
56 | Congratulations to anybody who has made it through this long-winded | ||
57 | document. Hopefully it has provided a helpful understanding of how the | ||
58 | Linux kernel is developed and how you can participate in that process. | ||
59 | |||
60 | In the end, it's the participation that matters. Any open source software | ||
61 | project is no more than the sum of what its contributors put into it. The | ||
62 | Linux kernel has progressed as quickly and as well as it has because it has | ||
63 | been helped by an impressively large group of developers, all of whom are | ||
64 | working to make it better. The kernel is a premier example of what can be | ||
65 | done when thousands of people work together toward a common goal. | ||
66 | |||
67 | The kernel can always benefit from a larger developer base, though. There | ||
68 | is always more work to do. But, just as importantly, most other | ||
69 | participants in the Linux ecosystem can benefit through contributing to the | ||
70 | kernel. Getting code into the mainline is the key to higher code quality, | ||
71 | lower maintenance and distribution costs, a higher level of influence over | ||
72 | the direction of kernel development, and more. It is a situation where | ||
73 | everybody involved wins. Fire up your editor and come join us; you will be | ||
74 | more than welcome. | ||
diff --git a/Documentation/devices.txt b/Documentation/devices.txt index e6244cde26e9..2be08240ee80 100644 --- a/Documentation/devices.txt +++ b/Documentation/devices.txt | |||
@@ -2560,9 +2560,6 @@ Your cooperation is appreciated. | |||
2560 | 96 = /dev/usb/hiddev0 1st USB HID device | 2560 | 96 = /dev/usb/hiddev0 1st USB HID device |
2561 | ... | 2561 | ... |
2562 | 111 = /dev/usb/hiddev15 16th USB HID device | 2562 | 111 = /dev/usb/hiddev15 16th USB HID device |
2563 | 112 = /dev/usb/auer0 1st auerswald ISDN device | ||
2564 | ... | ||
2565 | 127 = /dev/usb/auer15 16th auerswald ISDN device | ||
2566 | 128 = /dev/usb/brlvgr0 First Braille Voyager device | 2563 | 128 = /dev/usb/brlvgr0 First Braille Voyager device |
2567 | ... | 2564 | ... |
2568 | 131 = /dev/usb/brlvgr3 Fourth Braille Voyager device | 2565 | 131 = /dev/usb/brlvgr3 Fourth Braille Voyager device |
@@ -2574,6 +2571,9 @@ Your cooperation is appreciated. | |||
2574 | 160 = /dev/usb/legousbtower0 1st USB Legotower device | 2571 | 160 = /dev/usb/legousbtower0 1st USB Legotower device |
2575 | ... | 2572 | ... |
2576 | 175 = /dev/usb/legousbtower15 16th USB Legotower device | 2573 | 175 = /dev/usb/legousbtower15 16th USB Legotower device |
2574 | 176 = /dev/usb/usbtmc1 First USB TMC device | ||
2575 | ... | ||
2576 | 192 = /dev/usb/usbtmc16 16th USB TMC device | ||
2577 | 240 = /dev/usb/dabusb0 First daubusb device | 2577 | 240 = /dev/usb/dabusb0 First daubusb device |
2578 | ... | 2578 | ... |
2579 | 243 = /dev/usb/dabusb3 Fourth dabusb device | 2579 | 243 = /dev/usb/dabusb3 Fourth dabusb device |
diff --git a/Documentation/dontdiff b/Documentation/dontdiff index 881e6dd03aea..1e89a51ea49b 100644 --- a/Documentation/dontdiff +++ b/Documentation/dontdiff | |||
@@ -2,9 +2,13 @@ | |||
2 | *.aux | 2 | *.aux |
3 | *.bin | 3 | *.bin |
4 | *.cpio | 4 | *.cpio |
5 | *.css | 5 | *.csp |
6 | *.dsp | ||
6 | *.dvi | 7 | *.dvi |
8 | *.elf | ||
7 | *.eps | 9 | *.eps |
10 | *.fw | ||
11 | *.gen.S | ||
8 | *.gif | 12 | *.gif |
9 | *.grep | 13 | *.grep |
10 | *.grp | 14 | *.grp |
@@ -28,6 +32,7 @@ | |||
28 | *.s | 32 | *.s |
29 | *.sgml | 33 | *.sgml |
30 | *.so | 34 | *.so |
35 | *.so.dbg | ||
31 | *.symtypes | 36 | *.symtypes |
32 | *.tab.c | 37 | *.tab.c |
33 | *.tab.h | 38 | *.tab.h |
@@ -36,24 +41,17 @@ | |||
36 | *.xml | 41 | *.xml |
37 | *_MODULES | 42 | *_MODULES |
38 | *_vga16.c | 43 | *_vga16.c |
39 | *cscope* | ||
40 | *~ | 44 | *~ |
41 | *.9 | 45 | *.9 |
42 | *.9.gz | 46 | *.9.gz |
43 | .* | 47 | .* |
44 | .cscope | ||
45 | .gitignore | ||
46 | .mailmap | ||
47 | .mm | 48 | .mm |
48 | 53c700_d.h | 49 | 53c700_d.h |
49 | 53c8xx_d.h* | ||
50 | COPYING | ||
51 | CREDITS | ||
52 | CVS | 50 | CVS |
53 | ChangeSet | 51 | ChangeSet |
54 | Image | 52 | Image |
55 | Kerntypes | 53 | Kerntypes |
56 | MODS.txt | 54 | Module.markers |
57 | Module.symvers | 55 | Module.symvers |
58 | PENDING | 56 | PENDING |
59 | SCCS | 57 | SCCS |
@@ -71,7 +69,9 @@ autoconf.h* | |||
71 | bbootsect | 69 | bbootsect |
72 | bin2c | 70 | bin2c |
73 | binkernel.spec | 71 | binkernel.spec |
72 | binoffset | ||
74 | bootsect | 73 | bootsect |
74 | bounds.h | ||
75 | bsetup | 75 | bsetup |
76 | btfixupprep | 76 | btfixupprep |
77 | build | 77 | build |
@@ -87,39 +87,36 @@ config_data.h* | |||
87 | config_data.gz* | 87 | config_data.gz* |
88 | conmakehash | 88 | conmakehash |
89 | consolemap_deftbl.c* | 89 | consolemap_deftbl.c* |
90 | cpustr.h | ||
90 | crc32table.h* | 91 | crc32table.h* |
91 | cscope.* | 92 | cscope.* |
92 | defkeymap.c* | 93 | defkeymap.c |
93 | devlist.h* | 94 | devlist.h* |
94 | docproc | 95 | docproc |
95 | dummy_sym.c* | ||
96 | elf2ecoff | 96 | elf2ecoff |
97 | elfconfig.h* | 97 | elfconfig.h* |
98 | filelist | ||
99 | fixdep | 98 | fixdep |
100 | fore200e_mkfirm | 99 | fore200e_mkfirm |
101 | fore200e_pca_fw.c* | 100 | fore200e_pca_fw.c* |
102 | gconf | 101 | gconf |
103 | gen-devlist | 102 | gen-devlist |
104 | gen-kdb_cmds.c* | ||
105 | gen_crc32table | 103 | gen_crc32table |
106 | gen_init_cpio | 104 | gen_init_cpio |
107 | genksyms | 105 | genksyms |
108 | gentbl | ||
109 | *_gray256.c | 106 | *_gray256.c |
107 | ihex2fw | ||
110 | ikconfig.h* | 108 | ikconfig.h* |
111 | initramfs_data.cpio | 109 | initramfs_data.cpio |
112 | initramfs_data.cpio.gz | 110 | initramfs_data.cpio.gz |
113 | initramfs_list | 111 | initramfs_list |
114 | kallsyms | 112 | kallsyms |
115 | kconfig | 113 | kconfig |
116 | kconfig.tk | 114 | keywords.c |
117 | keywords.c* | ||
118 | ksym.c* | 115 | ksym.c* |
119 | ksym.h* | 116 | ksym.h* |
120 | kxgettext | 117 | kxgettext |
121 | lkc_defs.h | 118 | lkc_defs.h |
122 | lex.c* | 119 | lex.c |
123 | lex.*.c | 120 | lex.*.c |
124 | logo_*.c | 121 | logo_*.c |
125 | logo_*_clut224.c | 122 | logo_*_clut224.c |
@@ -128,7 +125,6 @@ lxdialog | |||
128 | mach-types | 125 | mach-types |
129 | mach-types.h | 126 | mach-types.h |
130 | machtypes.h | 127 | machtypes.h |
131 | make_times_h | ||
132 | map | 128 | map |
133 | maui_boot.h | 129 | maui_boot.h |
134 | mconf | 130 | mconf |
@@ -136,6 +132,7 @@ miboot* | |||
136 | mk_elfconfig | 132 | mk_elfconfig |
137 | mkboot | 133 | mkboot |
138 | mkbugboot | 134 | mkbugboot |
135 | mkcpustr | ||
139 | mkdep | 136 | mkdep |
140 | mkprep | 137 | mkprep |
141 | mktables | 138 | mktables |
@@ -143,11 +140,12 @@ mktree | |||
143 | modpost | 140 | modpost |
144 | modules.order | 141 | modules.order |
145 | modversions.h* | 142 | modversions.h* |
143 | ncscope.* | ||
146 | offset.h | 144 | offset.h |
147 | offsets.h | 145 | offsets.h |
148 | oui.c* | 146 | oui.c* |
149 | parse.c* | 147 | parse.c |
150 | parse.h* | 148 | parse.h |
151 | patches* | 149 | patches* |
152 | pca200e.bin | 150 | pca200e.bin |
153 | pca200e_ecd.bin2 | 151 | pca200e_ecd.bin2 |
@@ -155,7 +153,7 @@ piggy.gz | |||
155 | piggyback | 153 | piggyback |
156 | pnmtologo | 154 | pnmtologo |
157 | ppc_defs.h* | 155 | ppc_defs.h* |
158 | promcon_tbl.c* | 156 | promcon_tbl.c |
159 | pss_boot.h | 157 | pss_boot.h |
160 | qconf | 158 | qconf |
161 | raid6altivec*.c | 159 | raid6altivec*.c |
@@ -166,27 +164,38 @@ series | |||
166 | setup | 164 | setup |
167 | setup.bin | 165 | setup.bin |
168 | setup.elf | 166 | setup.elf |
169 | sim710_d.h* | ||
170 | sImage | 167 | sImage |
171 | sm_tbl* | 168 | sm_tbl* |
172 | split-include | 169 | split-include |
170 | syscalltab.h | ||
173 | tags | 171 | tags |
174 | tftpboot.img | 172 | tftpboot.img |
175 | timeconst.h | 173 | timeconst.h |
176 | times.h* | 174 | times.h* |
177 | tkparse | ||
178 | trix_boot.h | 175 | trix_boot.h |
179 | utsrelease.h* | 176 | utsrelease.h* |
177 | vdso-syms.lds | ||
180 | vdso.lds | 178 | vdso.lds |
179 | vdso32-int80-syms.lds | ||
180 | vdso32-syms.lds | ||
181 | vdso32-syscall-syms.lds | ||
182 | vdso32-sysenter-syms.lds | ||
183 | vdso32.lds | ||
184 | vdso32.so.dbg | ||
185 | vdso64.lds | ||
186 | vdso64.so.dbg | ||
181 | version.h* | 187 | version.h* |
182 | vmlinux | 188 | vmlinux |
183 | vmlinux-* | 189 | vmlinux-* |
184 | vmlinux.aout | 190 | vmlinux.aout |
185 | vmlinux*.lds* | 191 | vmlinux.lds |
186 | vmlinux*.scr | ||
187 | vsyscall.lds | 192 | vsyscall.lds |
193 | vsyscall_32.lds | ||
188 | wanxlfw.inc | 194 | wanxlfw.inc |
189 | uImage | 195 | uImage |
190 | unifdef | 196 | unifdef |
197 | wakeup.bin | ||
198 | wakeup.elf | ||
199 | wakeup.lds | ||
191 | zImage* | 200 | zImage* |
192 | zconf.hash.c | 201 | zconf.hash.c |
diff --git a/Documentation/edac.txt b/Documentation/edac.txt index a5c36842ecef..8eda3fb66416 100644 --- a/Documentation/edac.txt +++ b/Documentation/edac.txt | |||
@@ -222,74 +222,9 @@ both csrow2 and csrow3 are populated, this indicates a dual ranked | |||
222 | set of DIMMs for channels 0 and 1. | 222 | set of DIMMs for channels 0 and 1. |
223 | 223 | ||
224 | 224 | ||
225 | Within each of the 'mc','mcX' and 'csrowX' directories are several | 225 | Within each of the 'mcX' and 'csrowX' directories are several |
226 | EDAC control and attribute files. | 226 | EDAC control and attribute files. |
227 | 227 | ||
228 | |||
229 | ============================================================================ | ||
230 | DIRECTORY 'mc' | ||
231 | |||
232 | In directory 'mc' are EDAC system overall control and attribute files: | ||
233 | |||
234 | |||
235 | Panic on UE control file: | ||
236 | |||
237 | 'edac_mc_panic_on_ue' | ||
238 | |||
239 | An uncorrectable error will cause a machine panic. This is usually | ||
240 | desirable. It is a bad idea to continue when an uncorrectable error | ||
241 | occurs - it is indeterminate what was uncorrected and the operating | ||
242 | system context might be so mangled that continuing will lead to further | ||
243 | corruption. If the kernel has MCE configured, then EDAC will never | ||
244 | notice the UE. | ||
245 | |||
246 | LOAD TIME: module/kernel parameter: panic_on_ue=[0|1] | ||
247 | |||
248 | RUN TIME: echo "1" >/sys/devices/system/edac/mc/edac_mc_panic_on_ue | ||
249 | |||
250 | |||
251 | Log UE control file: | ||
252 | |||
253 | 'edac_mc_log_ue' | ||
254 | |||
255 | Generate kernel messages describing uncorrectable errors. These errors | ||
256 | are reported through the system message log system. UE statistics | ||
257 | will be accumulated even when UE logging is disabled. | ||
258 | |||
259 | LOAD TIME: module/kernel parameter: log_ue=[0|1] | ||
260 | |||
261 | RUN TIME: echo "1" >/sys/devices/system/edac/mc/edac_mc_log_ue | ||
262 | |||
263 | |||
264 | Log CE control file: | ||
265 | |||
266 | 'edac_mc_log_ce' | ||
267 | |||
268 | Generate kernel messages describing correctable errors. These | ||
269 | errors are reported through the system message log system. | ||
270 | CE statistics will be accumulated even when CE logging is disabled. | ||
271 | |||
272 | LOAD TIME: module/kernel parameter: log_ce=[0|1] | ||
273 | |||
274 | RUN TIME: echo "1" >/sys/devices/system/edac/mc/edac_mc_log_ce | ||
275 | |||
276 | |||
277 | Polling period control file: | ||
278 | |||
279 | 'edac_mc_poll_msec' | ||
280 | |||
281 | The time period, in milliseconds, for polling for error information. | ||
282 | Too small a value wastes resources. Too large a value might delay | ||
283 | necessary handling of errors and might loose valuable information for | ||
284 | locating the error. 1000 milliseconds (once each second) is the current | ||
285 | default. Systems which require all the bandwidth they can get, may | ||
286 | increase this. | ||
287 | |||
288 | LOAD TIME: module/kernel parameter: poll_msec=[0|1] | ||
289 | |||
290 | RUN TIME: echo "1000" >/sys/devices/system/edac/mc/edac_mc_poll_msec | ||
291 | |||
292 | |||
293 | ============================================================================ | 228 | ============================================================================ |
294 | 'mcX' DIRECTORIES | 229 | 'mcX' DIRECTORIES |
295 | 230 | ||
@@ -392,7 +327,7 @@ Sdram memory scrubbing rate: | |||
392 | 'sdram_scrub_rate' | 327 | 'sdram_scrub_rate' |
393 | 328 | ||
394 | Read/Write attribute file that controls memory scrubbing. The scrubbing | 329 | Read/Write attribute file that controls memory scrubbing. The scrubbing |
395 | rate is set by writing a minimum bandwith in bytes/sec to the attribute | 330 | rate is set by writing a minimum bandwidth in bytes/sec to the attribute |
396 | file. The rate will be translated to an internal value that gives at | 331 | file. The rate will be translated to an internal value that gives at |
397 | least the specified rate. | 332 | least the specified rate. |
398 | 333 | ||
@@ -537,7 +472,6 @@ Channel 1 DIMM Label control file: | |||
537 | motherboard specific and determination of this information | 472 | motherboard specific and determination of this information |
538 | must occur in userland at this time. | 473 | must occur in userland at this time. |
539 | 474 | ||
540 | |||
541 | ============================================================================ | 475 | ============================================================================ |
542 | SYSTEM LOGGING | 476 | SYSTEM LOGGING |
543 | 477 | ||
@@ -570,7 +504,6 @@ error type, a notice of "no info" and then an optional, | |||
570 | driver-specific error message. | 504 | driver-specific error message. |
571 | 505 | ||
572 | 506 | ||
573 | |||
574 | ============================================================================ | 507 | ============================================================================ |
575 | PCI Bus Parity Detection | 508 | PCI Bus Parity Detection |
576 | 509 | ||
@@ -604,6 +537,74 @@ Enable/Disable PCI Parity checking control file: | |||
604 | echo "0" >/sys/devices/system/edac/pci/check_pci_parity | 537 | echo "0" >/sys/devices/system/edac/pci/check_pci_parity |
605 | 538 | ||
606 | 539 | ||
540 | Parity Count: | ||
541 | |||
542 | 'pci_parity_count' | ||
543 | |||
544 | This attribute file will display the number of parity errors that | ||
545 | have been detected. | ||
546 | |||
547 | |||
548 | ============================================================================ | ||
549 | MODULE PARAMETERS | ||
550 | |||
551 | Panic on UE control file: | ||
552 | |||
553 | 'edac_mc_panic_on_ue' | ||
554 | |||
555 | An uncorrectable error will cause a machine panic. This is usually | ||
556 | desirable. It is a bad idea to continue when an uncorrectable error | ||
557 | occurs - it is indeterminate what was uncorrected and the operating | ||
558 | system context might be so mangled that continuing will lead to further | ||
559 | corruption. If the kernel has MCE configured, then EDAC will never | ||
560 | notice the UE. | ||
561 | |||
562 | LOAD TIME: module/kernel parameter: edac_mc_panic_on_ue=[0|1] | ||
563 | |||
564 | RUN TIME: echo "1" > /sys/module/edac_core/parameters/edac_mc_panic_on_ue | ||
565 | |||
566 | |||
567 | Log UE control file: | ||
568 | |||
569 | 'edac_mc_log_ue' | ||
570 | |||
571 | Generate kernel messages describing uncorrectable errors. These errors | ||
572 | are reported through the system message log system. UE statistics | ||
573 | will be accumulated even when UE logging is disabled. | ||
574 | |||
575 | LOAD TIME: module/kernel parameter: edac_mc_log_ue=[0|1] | ||
576 | |||
577 | RUN TIME: echo "1" > /sys/module/edac_core/parameters/edac_mc_log_ue | ||
578 | |||
579 | |||
580 | Log CE control file: | ||
581 | |||
582 | 'edac_mc_log_ce' | ||
583 | |||
584 | Generate kernel messages describing correctable errors. These | ||
585 | errors are reported through the system message log system. | ||
586 | CE statistics will be accumulated even when CE logging is disabled. | ||
587 | |||
588 | LOAD TIME: module/kernel parameter: edac_mc_log_ce=[0|1] | ||
589 | |||
590 | RUN TIME: echo "1" > /sys/module/edac_core/parameters/edac_mc_log_ce | ||
591 | |||
592 | |||
593 | Polling period control file: | ||
594 | |||
595 | 'edac_mc_poll_msec' | ||
596 | |||
597 | The time period, in milliseconds, for polling for error information. | ||
598 | Too small a value wastes resources. Too large a value might delay | ||
599 | necessary handling of errors and might loose valuable information for | ||
600 | locating the error. 1000 milliseconds (once each second) is the current | ||
601 | default. Systems which require all the bandwidth they can get, may | ||
602 | increase this. | ||
603 | |||
604 | LOAD TIME: module/kernel parameter: edac_mc_poll_msec=[0|1] | ||
605 | |||
606 | RUN TIME: echo "1000" > /sys/module/edac_core/parameters/edac_mc_poll_msec | ||
607 | |||
607 | 608 | ||
608 | Panic on PCI PARITY Error: | 609 | Panic on PCI PARITY Error: |
609 | 610 | ||
@@ -614,21 +615,13 @@ Panic on PCI PARITY Error: | |||
614 | error has been detected. | 615 | error has been detected. |
615 | 616 | ||
616 | 617 | ||
617 | module/kernel parameter: panic_on_pci_parity=[0|1] | 618 | module/kernel parameter: edac_panic_on_pci_pe=[0|1] |
618 | 619 | ||
619 | Enable: | 620 | Enable: |
620 | echo "1" >/sys/devices/system/edac/pci/panic_on_pci_parity | 621 | echo "1" > /sys/module/edac_core/parameters/edac_panic_on_pci_pe |
621 | 622 | ||
622 | Disable: | 623 | Disable: |
623 | echo "0" >/sys/devices/system/edac/pci/panic_on_pci_parity | 624 | echo "0" > /sys/module/edac_core/parameters/edac_panic_on_pci_pe |
624 | |||
625 | |||
626 | Parity Count: | ||
627 | |||
628 | 'pci_parity_count' | ||
629 | |||
630 | This attribute file will display the number of parity errors that | ||
631 | have been detected. | ||
632 | 625 | ||
633 | 626 | ||
634 | 627 | ||
diff --git a/Documentation/fb/intelfb.txt b/Documentation/fb/intelfb.txt index 27a3160650a4..dd9e944ea628 100644 --- a/Documentation/fb/intelfb.txt +++ b/Documentation/fb/intelfb.txt | |||
@@ -14,6 +14,7 @@ graphics devices. These would include: | |||
14 | Intel 915GM | 14 | Intel 915GM |
15 | Intel 945G | 15 | Intel 945G |
16 | Intel 945GM | 16 | Intel 945GM |
17 | Intel 945GME | ||
17 | Intel 965G | 18 | Intel 965G |
18 | Intel 965GM | 19 | Intel 965GM |
19 | 20 | ||
diff --git a/Documentation/fb/sh7760fb.txt b/Documentation/fb/sh7760fb.txt new file mode 100644 index 000000000000..c87bfe5c630a --- /dev/null +++ b/Documentation/fb/sh7760fb.txt | |||
@@ -0,0 +1,131 @@ | |||
1 | SH7760/SH7763 integrated LCDC Framebuffer driver | ||
2 | ================================================ | ||
3 | |||
4 | 0. Overwiew | ||
5 | ----------- | ||
6 | The SH7760/SH7763 have an integrated LCD Display controller (LCDC) which | ||
7 | supports (in theory) resolutions ranging from 1x1 to 1024x1024, | ||
8 | with color depths ranging from 1 to 16 bits, on STN, DSTN and TFT Panels. | ||
9 | |||
10 | Caveats: | ||
11 | * Framebuffer memory must be a large chunk allocated at the top | ||
12 | of Area3 (HW requirement). Because of this requirement you should NOT | ||
13 | make the driver a module since at runtime it may become impossible to | ||
14 | get a large enough contiguous chunk of memory. | ||
15 | |||
16 | * The driver does not support changing resolution while loaded | ||
17 | (displays aren't hotpluggable anyway) | ||
18 | |||
19 | * Heavy flickering may be observed | ||
20 | a) if you're using 15/16bit color modes at >= 640x480 px resolutions, | ||
21 | b) during PCMCIA (or any other slow bus) activity. | ||
22 | |||
23 | * Rotation works only 90degress clockwise, and only if horizontal | ||
24 | resolution is <= 320 pixels. | ||
25 | |||
26 | files: drivers/video/sh7760fb.c | ||
27 | include/asm-sh/sh7760fb.h | ||
28 | Documentation/fb/sh7760fb.txt | ||
29 | |||
30 | 1. Platform setup | ||
31 | ----------------- | ||
32 | SH7760: | ||
33 | Video data is fetched via the DMABRG DMA engine, so you have to | ||
34 | configure the SH DMAC for DMABRG mode (write 0x94808080 to the | ||
35 | DMARSRA register somewhere at boot). | ||
36 | |||
37 | PFC registers PCCR and PCDR must be set to peripheral mode. | ||
38 | (write zeros to both). | ||
39 | |||
40 | The driver does NOT do the above for you since board setup is, well, job | ||
41 | of the board setup code. | ||
42 | |||
43 | 2. Panel definitions | ||
44 | -------------------- | ||
45 | The LCDC must explicitly be told about the type of LCD panel | ||
46 | attached. Data must be wrapped in a "struct sh7760fb_platdata" and | ||
47 | passed to the driver as platform_data. | ||
48 | |||
49 | Suggest you take a closer look at the SH7760 Manual, Section 30. | ||
50 | (http://documentation.renesas.com/eng/products/mpumcu/e602291_sh7760.pdf) | ||
51 | |||
52 | The following code illustrates what needs to be done to | ||
53 | get the framebuffer working on a 640x480 TFT: | ||
54 | |||
55 | ====================== cut here ====================================== | ||
56 | |||
57 | #include <linux/fb.h> | ||
58 | #include <asm/sh7760fb.h> | ||
59 | |||
60 | /* | ||
61 | * NEC NL6440bc26-01 640x480 TFT | ||
62 | * dotclock 25175 kHz | ||
63 | * Xres 640 Yres 480 | ||
64 | * Htotal 800 Vtotal 525 | ||
65 | * HsynStart 656 VsynStart 490 | ||
66 | * HsynLenn 30 VsynLenn 2 | ||
67 | * | ||
68 | * The linux framebuffer layer does not use the syncstart/synclen | ||
69 | * values but right/left/upper/lower margin values. The comments | ||
70 | * for the x_margin explain how to calculate those from given | ||
71 | * panel sync timings. | ||
72 | */ | ||
73 | static struct fb_videomode nl6448bc26 = { | ||
74 | .name = "NL6448BC26", | ||
75 | .refresh = 60, | ||
76 | .xres = 640, | ||
77 | .yres = 480, | ||
78 | .pixclock = 39683, /* in picoseconds! */ | ||
79 | .hsync_len = 30, | ||
80 | .vsync_len = 2, | ||
81 | .left_margin = 114, /* HTOT - (HSYNSLEN + HSYNSTART) */ | ||
82 | .right_margin = 16, /* HSYNSTART - XRES */ | ||
83 | .upper_margin = 33, /* VTOT - (VSYNLEN + VSYNSTART) */ | ||
84 | .lower_margin = 10, /* VSYNSTART - YRES */ | ||
85 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
86 | .vmode = FB_VMODE_NONINTERLACED, | ||
87 | .flag = 0, | ||
88 | }; | ||
89 | |||
90 | static struct sh7760fb_platdata sh7760fb_nl6448 = { | ||
91 | .def_mode = &nl6448bc26, | ||
92 | .ldmtr = LDMTR_TFT_COLOR_16, /* 16bit TFT panel */ | ||
93 | .lddfr = LDDFR_8BPP, /* we want 8bit output */ | ||
94 | .ldpmmr = 0x0070, | ||
95 | .ldpspr = 0x0500, | ||
96 | .ldaclnr = 0, | ||
97 | .ldickr = LDICKR_CLKSRC(LCDC_CLKSRC_EXTERNAL) | | ||
98 | LDICKR_CLKDIV(1), | ||
99 | .rotate = 0, | ||
100 | .novsync = 1, | ||
101 | .blank = NULL, | ||
102 | }; | ||
103 | |||
104 | /* SH7760: | ||
105 | * 0xFE300800: 256 * 4byte xRGB palette ram | ||
106 | * 0xFE300C00: 42 bytes ctrl registers | ||
107 | */ | ||
108 | static struct resource sh7760_lcdc_res[] = { | ||
109 | [0] = { | ||
110 | .start = 0xFE300800, | ||
111 | .end = 0xFE300CFF, | ||
112 | .flags = IORESOURCE_MEM, | ||
113 | }, | ||
114 | [1] = { | ||
115 | .start = 65, | ||
116 | .end = 65, | ||
117 | .flags = IORESOURCE_IRQ, | ||
118 | }, | ||
119 | }; | ||
120 | |||
121 | static struct platform_device sh7760_lcdc_dev = { | ||
122 | .dev = { | ||
123 | .platform_data = &sh7760fb_nl6448, | ||
124 | }, | ||
125 | .name = "sh7760-lcdc", | ||
126 | .id = -1, | ||
127 | .resource = sh7760_lcdc_res, | ||
128 | .num_resources = ARRAY_SIZE(sh7760_lcdc_res), | ||
129 | }; | ||
130 | |||
131 | ====================== cut here ====================================== | ||
diff --git a/Documentation/fb/tridentfb.txt b/Documentation/fb/tridentfb.txt index 8a6c8a43e6a3..45d9de5b13a3 100644 --- a/Documentation/fb/tridentfb.txt +++ b/Documentation/fb/tridentfb.txt | |||
@@ -3,11 +3,25 @@ Tridentfb is a framebuffer driver for some Trident chip based cards. | |||
3 | The following list of chips is thought to be supported although not all are | 3 | The following list of chips is thought to be supported although not all are |
4 | tested: | 4 | tested: |
5 | 5 | ||
6 | those from the Image series with Cyber in their names - accelerated | 6 | those from the TGUI series 9440/96XX and with Cyber in their names |
7 | those with Blade in their names (Blade3D,CyberBlade...) - accelerated | 7 | those from the Image series and with Cyber in their names |
8 | the newer CyberBladeXP family - nonaccelerated | 8 | those with Blade in their names (Blade3D,CyberBlade...) |
9 | 9 | the newer CyberBladeXP family | |
10 | Only PCI/AGP based cards are supported, none of the older Tridents. | 10 | |
11 | All families are accelerated. Only PCI/AGP based cards are supported, | ||
12 | none of the older Tridents. | ||
13 | The driver supports 8, 16 and 32 bits per pixel depths. | ||
14 | The TGUI family requires a line length to be power of 2 if acceleration | ||
15 | is enabled. This means that range of possible resolutions and bpp is | ||
16 | limited comparing to the range if acceleration is disabled (see list | ||
17 | of parameters below). | ||
18 | |||
19 | Known bugs: | ||
20 | 1. The driver randomly locks up on 3DImage975 chip with acceleration | ||
21 | enabled. The same happens in X11 (Xorg). | ||
22 | 2. The ramdac speeds require some more fine tuning. It is possible to | ||
23 | switch resolution which the chip does not support at some depths for | ||
24 | older chips. | ||
11 | 25 | ||
12 | How to use it? | 26 | How to use it? |
13 | ============== | 27 | ============== |
@@ -17,12 +31,11 @@ video=tridentfb | |||
17 | 31 | ||
18 | The parameters for tridentfb are concatenated with a ':' as in this example. | 32 | The parameters for tridentfb are concatenated with a ':' as in this example. |
19 | 33 | ||
20 | video=tridentfb:800x600,bpp=16,noaccel | 34 | video=tridentfb:800x600-16@75,noaccel |
21 | 35 | ||
22 | The second level parameters that tridentfb understands are: | 36 | The second level parameters that tridentfb understands are: |
23 | 37 | ||
24 | noaccel - turns off acceleration (when it doesn't work for your card) | 38 | noaccel - turns off acceleration (when it doesn't work for your card) |
25 | accel - force text acceleration (for boards which by default are noacceled) | ||
26 | 39 | ||
27 | fp - use flat panel related stuff | 40 | fp - use flat panel related stuff |
28 | crt - assume monitor is present instead of fp | 41 | crt - assume monitor is present instead of fp |
@@ -31,21 +44,24 @@ center - for flat panels and resolutions smaller than native size center the | |||
31 | image, otherwise use | 44 | image, otherwise use |
32 | stretch | 45 | stretch |
33 | 46 | ||
34 | memsize - integer value in Kb, use if your card's memory size is misdetected. | 47 | memsize - integer value in KB, use if your card's memory size is misdetected. |
35 | look at the driver output to see what it says when initializing. | 48 | look at the driver output to see what it says when initializing. |
36 | memdiff - integer value in Kb,should be nonzero if your card reports | 49 | |
37 | more memory than it actually has.For instance mine is 192K less than | 50 | memdiff - integer value in KB, should be nonzero if your card reports |
51 | more memory than it actually has. For instance mine is 192K less than | ||
38 | detection says in all three BIOS selectable situations 2M, 4M, 8M. | 52 | detection says in all three BIOS selectable situations 2M, 4M, 8M. |
39 | Only use if your video memory is taken from main memory hence of | 53 | Only use if your video memory is taken from main memory hence of |
40 | configurable size.Otherwise use memsize. | 54 | configurable size. Otherwise use memsize. |
41 | If in some modes which barely fit the memory you see garbage at the bottom | 55 | If in some modes which barely fit the memory you see garbage |
42 | this might help by not letting change to that mode anymore. | 56 | at the bottom this might help by not letting change to that mode |
57 | anymore. | ||
43 | 58 | ||
44 | nativex - the width in pixels of the flat panel.If you know it (usually 1024 | 59 | nativex - the width in pixels of the flat panel.If you know it (usually 1024 |
45 | 800 or 1280) and it is not what the driver seems to detect use it. | 60 | 800 or 1280) and it is not what the driver seems to detect use it. |
46 | 61 | ||
47 | bpp - bits per pixel (8,16 or 32) | 62 | bpp - bits per pixel (8,16 or 32) |
48 | mode - a mode name like 800x600 (as described in Documentation/fb/modedb.txt) | 63 | mode - a mode name like 800x600-8@75 as described in |
64 | Documentation/fb/modedb.txt | ||
49 | 65 | ||
50 | Using insane values for the above parameters will probably result in driver | 66 | Using insane values for the above parameters will probably result in driver |
51 | misbehaviour so take care(for instance memsize=12345678 or memdiff=23784 or | 67 | misbehaviour so take care(for instance memsize=12345678 or memdiff=23784 or |
diff --git a/Documentation/fb/uvesafb.txt b/Documentation/fb/uvesafb.txt index bcfc233a0080..7ac3c4078ff9 100644 --- a/Documentation/fb/uvesafb.txt +++ b/Documentation/fb/uvesafb.txt | |||
@@ -52,7 +52,7 @@ are either given on the kernel command line or as module parameters, e.g.: | |||
52 | 52 | ||
53 | video=uvesafb:1024x768-32,mtrr:3,ywrap (compiled into the kernel) | 53 | video=uvesafb:1024x768-32,mtrr:3,ywrap (compiled into the kernel) |
54 | 54 | ||
55 | # modprobe uvesafb mode=1024x768-32 mtrr=3 scroll=ywrap (module) | 55 | # modprobe uvesafb mode_option=1024x768-32 mtrr=3 scroll=ywrap (module) |
56 | 56 | ||
57 | Accepted options: | 57 | Accepted options: |
58 | 58 | ||
@@ -105,7 +105,7 @@ vtotal:n | |||
105 | <mode> The mode you want to set, in the standard modedb format. Refer to | 105 | <mode> The mode you want to set, in the standard modedb format. Refer to |
106 | modedb.txt for a detailed description. When uvesafb is compiled as | 106 | modedb.txt for a detailed description. When uvesafb is compiled as |
107 | a module, the mode string should be provided as a value of the | 107 | a module, the mode string should be provided as a value of the |
108 | 'mode' option. | 108 | 'mode_option' option. |
109 | 109 | ||
110 | vbemode:x | 110 | vbemode:x |
111 | Force the use of VBE mode x. The mode will only be set if it's | 111 | Force the use of VBE mode x. The mode will only be set if it's |
diff --git a/Documentation/fb/viafb.modes b/Documentation/fb/viafb.modes new file mode 100644 index 000000000000..02e5b487f00e --- /dev/null +++ b/Documentation/fb/viafb.modes | |||
@@ -0,0 +1,870 @@ | |||
1 | # | ||
2 | # | ||
3 | # These data are based on the CRTC parameters in | ||
4 | # | ||
5 | # VIA Integration Graphics Chip | ||
6 | # (C) 2004 VIA Technologies Inc. | ||
7 | # | ||
8 | |||
9 | # | ||
10 | # 640x480, 60 Hz, Non-Interlaced (25.175 MHz dotclock) | ||
11 | # | ||
12 | # Horizontal Vertical | ||
13 | # Resolution 640 480 | ||
14 | # Scan Frequency 31.469 kHz 59.94 Hz | ||
15 | # Sync Width 3.813 us 0.064 ms | ||
16 | # 12 chars 2 lines | ||
17 | # Front Porch 0.636 us 0.318 ms | ||
18 | # 2 chars 10 lines | ||
19 | # Back Porch 1.907 us 1.048 ms | ||
20 | # 6 chars 33 lines | ||
21 | # Active Time 25.422 us 15.253 ms | ||
22 | # 80 chars 480 lines | ||
23 | # Blank Time 6.356 us 1.430 ms | ||
24 | # 20 chars 45 lines | ||
25 | # Polarity negative negative | ||
26 | # | ||
27 | |||
28 | mode "640x480-60" | ||
29 | # D: 25.175 MHz, H: 31.469 kHz, V: 59.94 Hz | ||
30 | geometry 640 480 640 480 32 | ||
31 | timings 39722 48 16 33 10 96 2 endmode mode "480x640-60" | ||
32 | # D: 24.823 MHz, H: 39.780 kHz, V: 60.00 Hz | ||
33 | geometry 480 640 480 640 32 timings 39722 72 24 19 1 48 3 endmode | ||
34 | # | ||
35 | # 640x480, 75 Hz, Non-Interlaced (31.50 MHz dotclock) | ||
36 | # | ||
37 | # Horizontal Vertical | ||
38 | # Resolution 640 480 | ||
39 | # Scan Frequency 37.500 kHz 75.00 Hz | ||
40 | # Sync Width 2.032 us 0.080 ms | ||
41 | # 8 chars 3 lines | ||
42 | # Front Porch 0.508 us 0.027 ms | ||
43 | # 2 chars 1 lines | ||
44 | # Back Porch 3.810 us 0.427 ms | ||
45 | # 15 chars 16 lines | ||
46 | # Active Time 20.317 us 12.800 ms | ||
47 | # 80 chars 480 lines | ||
48 | # Blank Time 6.349 us 0.533 ms | ||
49 | # 25 chars 20 lines | ||
50 | # Polarity negative negative | ||
51 | # | ||
52 | mode "640x480-75" | ||
53 | # D: 31.50 MHz, H: 37.500 kHz, V: 75.00 Hz | ||
54 | geometry 640 480 640 480 32 timings 31747 120 16 16 1 64 3 endmode | ||
55 | # | ||
56 | # 640x480, 85 Hz, Non-Interlaced (36.000 MHz dotclock) | ||
57 | # | ||
58 | # Horizontal Vertical | ||
59 | # Resolution 640 480 | ||
60 | # Scan Frequency 43.269 kHz 85.00 Hz | ||
61 | # Sync Width 1.556 us 0.069 ms | ||
62 | # 7 chars 3 lines | ||
63 | # Front Porch 1.556 us 0.023 ms | ||
64 | # 7 chars 1 lines | ||
65 | # Back Porch 2.222 us 0.578 ms | ||
66 | # 10 chars 25 lines | ||
67 | # Active Time 17.778 us 11.093 ms | ||
68 | # 80 chars 480 lines | ||
69 | # Blank Time 5.333 us 0.670 ms | ||
70 | # 24 chars 29 lines | ||
71 | # Polarity negative negative | ||
72 | # | ||
73 | mode "640x480-85" | ||
74 | # D: 36.000 MHz, H: 43.269 kHz, V: 85.00 Hz | ||
75 | geometry 640 480 640 480 32 timings 27777 80 56 25 1 56 3 endmode | ||
76 | # | ||
77 | # 640x480, 100 Hz, Non-Interlaced (43.163 MHz dotclock) | ||
78 | # | ||
79 | # Horizontal Vertical | ||
80 | # Resolution 640 480 | ||
81 | # Scan Frequency 50.900 kHz 100.00 Hz | ||
82 | # Sync Width 1.483 us 0.058 ms | ||
83 | # 8 chars 3 lines | ||
84 | # Front Porch 0.927 us 0.019 ms | ||
85 | # 5 chars 1 lines | ||
86 | # Back Porch 2.409 us 0.475 ms | ||
87 | # 13 chars 25 lines | ||
88 | # Active Time 14.827 us 9.430 ms | ||
89 | # 80 chars 480 lines | ||
90 | # Blank Time 4.819 us 0.570 ms | ||
91 | # 26 chars 29 lines | ||
92 | # Polarity positive positive | ||
93 | # | ||
94 | mode "640x480-100" | ||
95 | # D: 43.163 MHz, H: 50.900 kHz, V: 100.00 Hz | ||
96 | geometry 640 480 640 480 32 timings 23168 104 40 25 1 64 3 endmode | ||
97 | # | ||
98 | # 640x480, 120 Hz, Non-Interlaced (52.406 MHz dotclock) | ||
99 | # | ||
100 | # Horizontal Vertical | ||
101 | # Resolution 640 480 | ||
102 | # Scan Frequency 61.800 kHz 120.00 Hz | ||
103 | # Sync Width 1.221 us 0.048 ms | ||
104 | # 8 chars 3 lines | ||
105 | # Front Porch 0.763 us 0.016 ms | ||
106 | # 5 chars 1 lines | ||
107 | # Back Porch 1.984 us 0.496 ms | ||
108 | # 13 chars 31 lines | ||
109 | # Active Time 12.212 us 7.767 ms | ||
110 | # 80 chars 480 lines | ||
111 | # Blank Time 3.969 us 0.566 ms | ||
112 | # 26 chars 35 lines | ||
113 | # Polarity positive positive | ||
114 | # | ||
115 | mode "640x480-120" | ||
116 | # D: 52.406 MHz, H: 61.800 kHz, V: 120.00 Hz | ||
117 | geometry 640 480 640 480 32 timings 19081 104 40 31 1 64 3 endmode | ||
118 | # | ||
119 | # 720x480, 60 Hz, Non-Interlaced (26.880 MHz dotclock) | ||
120 | # | ||
121 | # Horizontal Vertical | ||
122 | # Resolution 720 480 | ||
123 | # Scan Frequency 30.000 kHz 60.241 Hz | ||
124 | # Sync Width 2.679 us 0.099 ms | ||
125 | # 9 chars 3 lines | ||
126 | # Front Porch 0.595 us 0.033 ms | ||
127 | # 2 chars 1 lines | ||
128 | # Back Porch 3.274 us 0.462 ms | ||
129 | # 11 chars 14 lines | ||
130 | # Active Time 26.786 us 16.000 ms | ||
131 | # 90 chars 480 lines | ||
132 | # Blank Time 6.548 us 0.600 ms | ||
133 | # 22 chars 18 lines | ||
134 | # Polarity positive positive | ||
135 | # | ||
136 | mode "720x480-60" | ||
137 | # D: 26.880 MHz, H: 30.000 kHz, V: 60.24 Hz | ||
138 | geometry 720 480 720 480 32 timings 37202 88 16 14 1 72 3 endmode | ||
139 | # | ||
140 | # 800x480, 60 Hz, Non-Interlaced (29.581 MHz dotclock) | ||
141 | # | ||
142 | # Horizontal Vertical | ||
143 | # Resolution 800 480 | ||
144 | # Scan Frequency 29.892 kHz 60.00 Hz | ||
145 | # Sync Width 2.704 us 100.604 us | ||
146 | # 10 chars 3 lines | ||
147 | # Front Porch 0.541 us 33.535 us | ||
148 | # 2 chars 1 lines | ||
149 | # Back Porch 3.245 us 435.949 us | ||
150 | # 12 chars 13 lines | ||
151 | # Active Time 27.044 us 16.097 ms | ||
152 | # 100 chars 480 lines | ||
153 | # Blank Time 6.491 us 0.570 ms | ||
154 | # 24 chars 17 lines | ||
155 | # Polarity positive positive | ||
156 | # | ||
157 | mode "800x480-60" | ||
158 | # D: 29.500 MHz, H: 29.738 kHz, V: 60.00 Hz | ||
159 | geometry 800 480 800 480 32 timings 33805 96 24 10 3 72 7 endmode | ||
160 | # | ||
161 | # 720x576, 60 Hz, Non-Interlaced (32.668 MHz dotclock) | ||
162 | # | ||
163 | # Horizontal Vertical | ||
164 | # Resolution 720 576 | ||
165 | # Scan Frequency 35.820 kHz 60.00 Hz | ||
166 | # Sync Width 2.204 us 0.083 ms | ||
167 | # 9 chars 3 lines | ||
168 | # Front Porch 0.735 us 0.027 ms | ||
169 | # 3 chars 1 lines | ||
170 | # Back Porch 2.939 us 0.459 ms | ||
171 | # 12 chars 17 lines | ||
172 | # Active Time 22.040 us 16.080 ms | ||
173 | # 90 chars 476 lines | ||
174 | # Blank Time 5.877 us 0.586 ms | ||
175 | # 24 chars 21 lines | ||
176 | # Polarity positive positive | ||
177 | # | ||
178 | mode "720x576-60" | ||
179 | # D: 32.668 MHz, H: 35.820 kHz, V: 60.00 Hz | ||
180 | geometry 720 576 720 576 32 timings 30611 96 24 17 1 72 3 endmode | ||
181 | # | ||
182 | # 800x600, 60 Hz, Non-Interlaced (40.00 MHz dotclock) | ||
183 | # | ||
184 | # Horizontal Vertical | ||
185 | # Resolution 800 600 | ||
186 | # Scan Frequency 37.879 kHz 60.32 Hz | ||
187 | # Sync Width 3.200 us 0.106 ms | ||
188 | # 16 chars 4 lines | ||
189 | # Front Porch 1.000 us 0.026 ms | ||
190 | # 5 chars 1 lines | ||
191 | # Back Porch 2.200 us 0.607 ms | ||
192 | # 11 chars 23 lines | ||
193 | # Active Time 20.000 us 15.840 ms | ||
194 | # 100 chars 600 lines | ||
195 | # Blank Time 6.400 us 0.739 ms | ||
196 | # 32 chars 28 lines | ||
197 | # Polarity positive positive | ||
198 | # | ||
199 | mode "800x600-60" | ||
200 | # D: 40.00 MHz, H: 37.879 kHz, V: 60.32 Hz | ||
201 | geometry 800 600 800 600 32 | ||
202 | timings 25000 88 40 23 1 128 4 hsync high vsync high endmode | ||
203 | # | ||
204 | # 800x600, 75 Hz, Non-Interlaced (49.50 MHz dotclock) | ||
205 | # | ||
206 | # Horizontal Vertical | ||
207 | # Resolution 800 600 | ||
208 | # Scan Frequency 46.875 kHz 75.00 Hz | ||
209 | # Sync Width 1.616 us 0.064 ms | ||
210 | # 10 chars 3 lines | ||
211 | # Front Porch 0.323 us 0.021 ms | ||
212 | # 2 chars 1 lines | ||
213 | # Back Porch 3.232 us 0.448 ms | ||
214 | # 20 chars 21 lines | ||
215 | # Active Time 16.162 us 12.800 ms | ||
216 | # 100 chars 600 lines | ||
217 | # Blank Time 5.172 us 0.533 ms | ||
218 | # 32 chars 25 lines | ||
219 | # Polarity positive positive | ||
220 | # | ||
221 | mode "800x600-75" | ||
222 | # D: 49.50 MHz, H: 46.875 kHz, V: 75.00 Hz | ||
223 | geometry 800 600 800 600 32 | ||
224 | timings 20203 160 16 21 1 80 3 hsync high vsync high endmode | ||
225 | # | ||
226 | # 800x600, 85 Hz, Non-Interlaced (56.25 MHz dotclock) | ||
227 | # | ||
228 | # Horizontal Vertical | ||
229 | # Resolution 800 600 | ||
230 | # Scan Frequency 53.674 kHz 85.061 Hz | ||
231 | # Sync Width 1.138 us 0.056 ms | ||
232 | # 8 chars 3 lines | ||
233 | # Front Porch 0.569 us 0.019 ms | ||
234 | # 4 chars 1 lines | ||
235 | # Back Porch 2.702 us 0.503 ms | ||
236 | # 19 chars 27 lines | ||
237 | # Active Time 14.222 us 11.179 ms | ||
238 | # 100 chars 600 lines | ||
239 | # Blank Time 4.409 us 0.578 ms | ||
240 | # 31 chars 31 lines | ||
241 | # Polarity positive positive | ||
242 | # | ||
243 | mode "800x600-85" | ||
244 | # D: 56.25 MHz, H: 53.674 kHz, V: 85.061 Hz | ||
245 | geometry 800 600 800 600 32 | ||
246 | timings 17777 152 32 27 1 64 3 hsync high vsync high endmode | ||
247 | # | ||
248 | # 800x600, 100 Hz, Non-Interlaced (67.50 MHz dotclock) | ||
249 | # | ||
250 | # Horizontal Vertical | ||
251 | # Resolution 800 600 | ||
252 | # Scan Frequency 62.500 kHz 100.00 Hz | ||
253 | # Sync Width 0.948 us 0.064 ms | ||
254 | # 8 chars 4 lines | ||
255 | # Front Porch 0.000 us 0.112 ms | ||
256 | # 0 chars 7 lines | ||
257 | # Back Porch 3.200 us 0.224 ms | ||
258 | # 27 chars 14 lines | ||
259 | # Active Time 11.852 us 9.600 ms | ||
260 | # 100 chars 600 lines | ||
261 | # Blank Time 4.148 us 0.400 ms | ||
262 | # 35 chars 25 lines | ||
263 | # Polarity positive positive | ||
264 | # | ||
265 | mode "800x600-100" | ||
266 | # D: 67.50 MHz, H: 62.500 kHz, V: 100.00 Hz | ||
267 | geometry 800 600 800 600 32 | ||
268 | timings 14667 216 0 14 7 64 4 hsync high vsync high endmode | ||
269 | # | ||
270 | # 800x600, 120 Hz, Non-Interlaced (83.950 MHz dotclock) | ||
271 | # | ||
272 | # Horizontal Vertical | ||
273 | # Resolution 800 600 | ||
274 | # Scan Frequency 77.160 kHz 120.00 Hz | ||
275 | # Sync Width 1.048 us 0.039 ms | ||
276 | # 11 chars 3 lines | ||
277 | # Front Porch 0.667 us 0.013 ms | ||
278 | # 7 chars 1 lines | ||
279 | # Back Porch 1.715 us 0.507 ms | ||
280 | # 18 chars 39 lines | ||
281 | # Active Time 9.529 us 7.776 ms | ||
282 | # 100 chars 600 lines | ||
283 | # Blank Time 3.431 us 0.557 ms | ||
284 | # 36 chars 43 lines | ||
285 | # Polarity positive positive | ||
286 | # | ||
287 | mode "800x600-120" | ||
288 | # D: 83.950 MHz, H: 77.160 kHz, V: 120.00 Hz | ||
289 | geometry 800 600 800 600 32 | ||
290 | timings 11912 144 56 39 1 88 3 hsync high vsync high endmode | ||
291 | # | ||
292 | # 848x480, 60 Hz, Non-Interlaced (31.490 MHz dotclock) | ||
293 | # | ||
294 | # Horizontal Vertical | ||
295 | # Resolution 848 480 | ||
296 | # Scan Frequency 29.820 kHz 60.00 Hz | ||
297 | # Sync Width 2.795 us 0.099 ms | ||
298 | # 11 chars 3 lines | ||
299 | # Front Porch 0.508 us 0.033 ms | ||
300 | # 2 chars 1 lines | ||
301 | # Back Porch 3.303 us 0.429 ms | ||
302 | # 13 chars 13 lines | ||
303 | # Active Time 26.929 us 16.097 ms | ||
304 | # 106 chars 480 lines | ||
305 | # Blank Time 6.605 us 0.570 ms | ||
306 | # 26 chars 17 lines | ||
307 | # Polarity positive positive | ||
308 | # | ||
309 | mode "848x480-60" | ||
310 | # D: 31.500 MHz, H: 29.830 kHz, V: 60.00 Hz | ||
311 | geometry 848 480 848 480 32 | ||
312 | timings 31746 104 24 12 3 80 5 hsync high vsync high endmode | ||
313 | # | ||
314 | # 856x480, 60 Hz, Non-Interlaced (31.728 MHz dotclock) | ||
315 | # | ||
316 | # Horizontal Vertical | ||
317 | # Resolution 856 480 | ||
318 | # Scan Frequency 29.820 kHz 60.00 Hz | ||
319 | # Sync Width 2.774 us 0.099 ms | ||
320 | # 11 chars 3 lines | ||
321 | # Front Porch 0.504 us 0.033 ms | ||
322 | # 2 chars 1 lines | ||
323 | # Back Porch 3.728 us 0.429 ms | ||
324 | # 13 chars 13 lines | ||
325 | # Active Time 26.979 us 16.097 ms | ||
326 | # 107 chars 480 lines | ||
327 | # Blank Time 6.556 us 0.570 ms | ||
328 | # 26 chars 17 lines | ||
329 | # Polarity positive positive | ||
330 | # | ||
331 | mode "856x480-60" | ||
332 | # D: 31.728 MHz, H: 29.820 kHz, V: 60.00 Hz | ||
333 | geometry 856 480 856 480 32 | ||
334 | timings 31518 104 16 13 1 88 3 | ||
335 | hsync high vsync high endmode mode "960x600-60" | ||
336 | # D: 45.250 MHz, H: 37.212 kHz, V: 60.00 Hz | ||
337 | geometry 960 600 960 600 32 timings 22099 128 32 15 3 96 6 endmode | ||
338 | # | ||
339 | # 1000x600, 60 Hz, Non-Interlaced (48.068 MHz dotclock) | ||
340 | # | ||
341 | # Horizontal Vertical | ||
342 | # Resolution 1000 600 | ||
343 | # Scan Frequency 37.320 kHz 60.00 Hz | ||
344 | # Sync Width 2.164 us 0.080 ms | ||
345 | # 13 chars 3 lines | ||
346 | # Front Porch 0.832 us 0.027 ms | ||
347 | # 5 chars 1 lines | ||
348 | # Back Porch 2.996 us 0.483 ms | ||
349 | # 18 chars 18 lines | ||
350 | # Active Time 20.804 us 16.077 ms | ||
351 | # 125 chars 600 lines | ||
352 | # Blank Time 5.991 us 0.589 ms | ||
353 | # 36 chars 22 lines | ||
354 | # Polarity negative positive | ||
355 | # | ||
356 | mode "1000x600-60" | ||
357 | # D: 48.068 MHz, H: 37.320 kHz, V: 60.00 Hz | ||
358 | geometry 1000 600 1000 600 32 | ||
359 | timings 20834 144 40 18 1 104 3 endmode mode "1024x576-60" | ||
360 | # D: 46.996 MHz, H: 35.820 kHz, V: 60.00 Hz | ||
361 | geometry 1024 576 1024 576 32 | ||
362 | timings 21278 144 40 17 1 104 3 endmode mode "1024x600-60" | ||
363 | # D: 48.964 MHz, H: 37.320 kHz, V: 60.00 Hz | ||
364 | geometry 1024 600 1024 600 32 | ||
365 | timings 20461 144 40 18 1 104 3 endmode mode "1088x612-60" | ||
366 | # D: 52.952 MHz, H: 38.040 kHz, V: 60.00 Hz | ||
367 | geometry 1088 612 1088 612 32 timings 18877 152 48 16 3 104 5 endmode | ||
368 | # | ||
369 | # 1024x512, 60 Hz, Non-Interlaced (41.291 MHz dotclock) | ||
370 | # | ||
371 | # Horizontal Vertical | ||
372 | # Resolution 1024 512 | ||
373 | # Scan Frequency 31.860 kHz 60.00 Hz | ||
374 | # Sync Width 2.519 us 0.094 ms | ||
375 | # 13 chars 3 lines | ||
376 | # Front Porch 0.775 us 0.031 ms | ||
377 | # 4 chars 1 lines | ||
378 | # Back Porch 3.294 us 0.465 ms | ||
379 | # 17 chars 15 lines | ||
380 | # Active Time 24.800 us 16.070 ms | ||
381 | # 128 chars 512 lines | ||
382 | # Blank Time 6.587 us 0.596 ms | ||
383 | # 34 chars 19 lines | ||
384 | # Polarity positive positive | ||
385 | # | ||
386 | mode "1024x512-60" | ||
387 | # D: 41.291 MHz, H: 31.860 kHz, V: 60.00 Hz | ||
388 | geometry 1024 512 1024 512 32 | ||
389 | timings 24218 126 32 15 1 104 3 hsync high vsync high endmode | ||
390 | # | ||
391 | # 1024x600, 60 Hz, Non-Interlaced (48.875 MHz dotclock) | ||
392 | # | ||
393 | # Horizontal Vertical | ||
394 | # Resolution 1024 768 | ||
395 | # Scan Frequency 37.252 kHz 60.00 Hz | ||
396 | # Sync Width 2.128 us 80.532us | ||
397 | # 13 chars 3 lines | ||
398 | # Front Porch 0.818 us 26.844 us | ||
399 | # 5 chars 1 lines | ||
400 | # Back Porch 2.946 us 483.192 us | ||
401 | # 18 chars 18 lines | ||
402 | # Active Time 20.951 us 16.697 ms | ||
403 | # 128 chars 622 lines | ||
404 | # Blank Time 5.893 us 0.591 ms | ||
405 | # 36 chars 22 lines | ||
406 | # Polarity negative positive | ||
407 | # | ||
408 | #mode "1024x600-60" | ||
409 | # # D: 48.875 MHz, H: 37.252 kHz, V: 60.00 Hz | ||
410 | # geometry 1024 600 1024 600 32 | ||
411 | # timings 20460 144 40 18 1 104 3 | ||
412 | # endmode | ||
413 | # | ||
414 | # 1024x768, 60 Hz, Non-Interlaced (65.00 MHz dotclock) | ||
415 | # | ||
416 | # Horizontal Vertical | ||
417 | # Resolution 1024 768 | ||
418 | # Scan Frequency 48.363 kHz 60.00 Hz | ||
419 | # Sync Width 2.092 us 0.124 ms | ||
420 | # 17 chars 6 lines | ||
421 | # Front Porch 0.369 us 0.062 ms | ||
422 | # 3 chars 3 lines | ||
423 | # Back Porch 2.462 us 0.601 ms | ||
424 | # 20 chars 29 lines | ||
425 | # Active Time 15.754 us 15.880 ms | ||
426 | # 128 chars 768 lines | ||
427 | # Blank Time 4.923 us 0.786 ms | ||
428 | # 40 chars 38 lines | ||
429 | # Polarity negative negative | ||
430 | # | ||
431 | mode "1024x768-60" | ||
432 | # D: 65.00 MHz, H: 48.363 kHz, V: 60.00 Hz | ||
433 | geometry 1024 768 1024 768 32 timings 15385 160 24 29 3 136 6 endmode | ||
434 | # | ||
435 | # 1024x768, 75 Hz, Non-Interlaced (78.75 MHz dotclock) | ||
436 | # | ||
437 | # Horizontal Vertical | ||
438 | # Resolution 1024 768 | ||
439 | # Scan Frequency 60.023 kHz 75.03 Hz | ||
440 | # Sync Width 1.219 us 0.050 ms | ||
441 | # 12 chars 3 lines | ||
442 | # Front Porch 0.203 us 0.017 ms | ||
443 | # 2 chars 1 lines | ||
444 | # Back Porch 2.235 us 0.466 ms | ||
445 | # 22 chars 28 lines | ||
446 | # Active Time 13.003 us 12.795 ms | ||
447 | # 128 chars 768 lines | ||
448 | # Blank Time 3.657 us 0.533 ms | ||
449 | # 36 chars 32 lines | ||
450 | # Polarity positive positive | ||
451 | # | ||
452 | mode "1024x768-75" | ||
453 | # D: 78.75 MHz, H: 60.023 kHz, V: 75.03 Hz | ||
454 | geometry 1024 768 1024 768 32 | ||
455 | timings 12699 176 16 28 1 96 3 hsync high vsync high endmode | ||
456 | # | ||
457 | # 1024x768, 85 Hz, Non-Interlaced (94.50 MHz dotclock) | ||
458 | # | ||
459 | # Horizontal Vertical | ||
460 | # Resolution 1024 768 | ||
461 | # Scan Frequency 68.677 kHz 85.00 Hz | ||
462 | # Sync Width 1.016 us 0.044 ms | ||
463 | # 12 chars 3 lines | ||
464 | # Front Porch 0.508 us 0.015 ms | ||
465 | # 6 chars 1 lines | ||
466 | # Back Porch 2.201 us 0.524 ms | ||
467 | # 26 chars 36 lines | ||
468 | # Active Time 10.836 us 11.183 ms | ||
469 | # 128 chars 768 lines | ||
470 | # Blank Time 3.725 us 0.582 ms | ||
471 | # 44 chars 40 lines | ||
472 | # Polarity positive positive | ||
473 | # | ||
474 | mode "1024x768-85" | ||
475 | # D: 94.50 MHz, H: 68.677 kHz, V: 85.00 Hz | ||
476 | geometry 1024 768 1024 768 32 | ||
477 | timings 10582 208 48 36 1 96 3 hsync high vsync high endmode | ||
478 | # | ||
479 | # 1024x768, 100 Hz, Non-Interlaced (110.0 MHz dotclock) | ||
480 | # | ||
481 | # Horizontal Vertical | ||
482 | # Resolution 1024 768 | ||
483 | # Scan Frequency 79.023 kHz 99.78 Hz | ||
484 | # Sync Width 0.800 us 0.101 ms | ||
485 | # 11 chars 8 lines | ||
486 | # Front Porch 0.000 us 0.000 ms | ||
487 | # 0 chars 0 lines | ||
488 | # Back Porch 2.545 us 0.202 ms | ||
489 | # 35 chars 16 lines | ||
490 | # Active Time 9.309 us 9.719 ms | ||
491 | # 128 chars 768 lines | ||
492 | # Blank Time 3.345 us 0.304 ms | ||
493 | # 46 chars 24 lines | ||
494 | # Polarity negative negative | ||
495 | # | ||
496 | mode "1024x768-100" | ||
497 | # D: 113.3 MHz, H: 79.023 kHz, V: 99.78 Hz | ||
498 | geometry 1024 768 1024 768 32 | ||
499 | timings 8825 280 0 16 0 88 8 endmode mode "1152x720-60" | ||
500 | # D: 66.750 MHz, H: 44.859 kHz, V: 60.00 Hz | ||
501 | geometry 1152 720 1152 720 32 timings 14981 168 56 19 3 112 6 endmode | ||
502 | # | ||
503 | # 1152x864, 75 Hz, Non-Interlaced (110.0 MHz dotclock) | ||
504 | # | ||
505 | # Horizontal Vertical | ||
506 | # Resolution 1152 864 | ||
507 | # Scan Frequency 75.137 kHz 74.99 Hz | ||
508 | # Sync Width 1.309 us 0.106 ms | ||
509 | # 18 chars 8 lines | ||
510 | # Front Porch 0.245 us 0.599 ms | ||
511 | # 3 chars 45 lines | ||
512 | # Back Porch 1.282 us 1.132 ms | ||
513 | # 18 chars 85 lines | ||
514 | # Active Time 10.473 us 11.499 ms | ||
515 | # 144 chars 864 lines | ||
516 | # Blank Time 2.836 us 1.837 ms | ||
517 | # 39 chars 138 lines | ||
518 | # Polarity positive positive | ||
519 | # | ||
520 | mode "1152x864-75" | ||
521 | # D: 110.0 MHz, H: 75.137 kHz, V: 74.99 Hz | ||
522 | geometry 1152 864 1152 864 32 | ||
523 | timings 9259 144 24 85 45 144 8 | ||
524 | hsync high vsync high endmode mode "1200x720-60" | ||
525 | # D: 70.184 MHz, H: 44.760 kHz, V: 60.00 Hz | ||
526 | geometry 1200 720 1200 720 32 | ||
527 | timings 14253 184 28 22 1 128 3 endmode mode "1280x600-60" | ||
528 | # D: 61.503 MHz, H: 37.320 kHz, V: 60.00 Hz | ||
529 | geometry 1280 600 1280 600 32 | ||
530 | timings 16260 184 28 18 1 128 3 endmode mode "1280x720-50" | ||
531 | # D: 60.466 MHz, H: 37.050 kHz, V: 50.00 Hz | ||
532 | geometry 1280 720 1280 720 32 | ||
533 | timings 16538 176 48 17 1 128 3 endmode mode "1280x768-50" | ||
534 | # D: 65.178 MHz, H: 39.550 kHz, V: 50.00 Hz | ||
535 | geometry 1280 768 1280 768 32 timings 15342 184 28 19 1 128 3 endmode | ||
536 | # | ||
537 | # 1280x768, 60 Hz, Non-Interlaced (80.136 MHz dotclock) | ||
538 | # | ||
539 | # Horizontal Vertical | ||
540 | # Resolution 1280 768 | ||
541 | # Scan Frequency 47.700 kHz 60.00 Hz | ||
542 | # Sync Width 1.697 us 0.063 ms | ||
543 | # 17 chars 3 lines | ||
544 | # Front Porch 0.799 us 0.021 ms | ||
545 | # 8 chars 1 lines | ||
546 | # Back Porch 2.496 us 0.483 ms | ||
547 | # 25 chars 23 lines | ||
548 | # Active Time 15.973 us 16.101 ms | ||
549 | # 160 chars 768 lines | ||
550 | # Blank Time 4.992 us 0.566 ms | ||
551 | # 50 chars 27 lines | ||
552 | # Polarity positive positive | ||
553 | # | ||
554 | mode "1280x768-60" | ||
555 | # D: 80.13 MHz, H: 47.700 kHz, V: 60.00 Hz | ||
556 | geometry 1280 768 1280 768 32 | ||
557 | timings 12480 200 48 23 1 126 3 hsync high vsync high endmode | ||
558 | # | ||
559 | # 1280x800, 60 Hz, Non-Interlaced (83.375 MHz dotclock) | ||
560 | # | ||
561 | # Horizontal Vertical | ||
562 | # Resolution 1280 800 | ||
563 | # Scan Frequency 49.628 kHz 60.00 Hz | ||
564 | # Sync Width 1.631 us 60.450 us | ||
565 | # 17 chars 3 lines | ||
566 | # Front Porch 0.768 us 20.15 us | ||
567 | # 8 chars 1 lines | ||
568 | # Back Porch 2.399 us 0.483 ms | ||
569 | # 25 chars 24 lines | ||
570 | # Active Time 15.352 us 16.120 ms | ||
571 | # 160 chars 800 lines | ||
572 | # Blank Time 4.798 us 0.564 ms | ||
573 | # 50 chars 28 lines | ||
574 | # Polarity negtive positive | ||
575 | # | ||
576 | mode "1280x800-60" | ||
577 | # D: 83.500 MHz, H: 49.702 kHz, V: 60.00 Hz | ||
578 | geometry 1280 800 1280 800 32 timings 11994 200 72 22 3 128 6 endmode | ||
579 | # | ||
580 | # 1280x960, 60 Hz, Non-Interlaced (108.00 MHz dotclock) | ||
581 | # | ||
582 | # Horizontal Vertical | ||
583 | # Resolution 1280 960 | ||
584 | # Scan Frequency 60.000 kHz 60.00 Hz | ||
585 | # Sync Width 1.037 us 0.050 ms | ||
586 | # 14 chars 3 lines | ||
587 | # Front Porch 0.889 us 0.017 ms | ||
588 | # 12 chars 1 lines | ||
589 | # Back Porch 2.889 us 0.600 ms | ||
590 | # 39 chars 36 lines | ||
591 | # Active Time 11.852 us 16.000 ms | ||
592 | # 160 chars 960 lines | ||
593 | # Blank Time 4.815 us 0.667 ms | ||
594 | # 65 chars 40 lines | ||
595 | # Polarity positive positive | ||
596 | # | ||
597 | mode "1280x960-60" | ||
598 | # D: 108.00 MHz, H: 60.000 kHz, V: 60.00 Hz | ||
599 | geometry 1280 960 1280 960 32 | ||
600 | timings 9259 312 96 36 1 112 3 hsync high vsync high endmode | ||
601 | # | ||
602 | # 1280x1024, 60 Hz, Non-Interlaced (108.00 MHz dotclock) | ||
603 | # | ||
604 | # Horizontal Vertical | ||
605 | # Resolution 1280 1024 | ||
606 | # Scan Frequency 63.981 kHz 60.02 Hz | ||
607 | # Sync Width 1.037 us 0.047 ms | ||
608 | # 14 chars 3 lines | ||
609 | # Front Porch 0.444 us 0.015 ms | ||
610 | # 6 chars 1 lines | ||
611 | # Back Porch 2.297 us 0.594 ms | ||
612 | # 31 chars 38 lines | ||
613 | # Active Time 11.852 us 16.005 ms | ||
614 | # 160 chars 1024 lines | ||
615 | # Blank Time 3.778 us 0.656 ms | ||
616 | # 51 chars 42 lines | ||
617 | # Polarity positive positive | ||
618 | # | ||
619 | mode "1280x1024-60" | ||
620 | # D: 108.00 MHz, H: 63.981 kHz, V: 60.02 Hz | ||
621 | geometry 1280 1024 1280 1024 32 | ||
622 | timings 9260 248 48 38 1 112 3 hsync high vsync high endmode | ||
623 | # | ||
624 | # 1280x1024, 75 Hz, Non-Interlaced (135.00 MHz dotclock) | ||
625 | # | ||
626 | # Horizontal Vertical | ||
627 | # Resolution 1280 1024 | ||
628 | # Scan Frequency 79.976 kHz 75.02 Hz | ||
629 | # Sync Width 1.067 us 0.038 ms | ||
630 | # 18 chars 3 lines | ||
631 | # Front Porch 0.119 us 0.012 ms | ||
632 | # 2 chars 1 lines | ||
633 | # Back Porch 1.837 us 0.475 ms | ||
634 | # 31 chars 38 lines | ||
635 | # Active Time 9.481 us 12.804 ms | ||
636 | # 160 chars 1024 lines | ||
637 | # Blank Time 3.022 us 0.525 ms | ||
638 | # 51 chars 42 lines | ||
639 | # Polarity positive positive | ||
640 | # | ||
641 | mode "1280x1024-75" | ||
642 | # D: 135.00 MHz, H: 79.976 kHz, V: 75.02 Hz | ||
643 | geometry 1280 1024 1280 1024 32 | ||
644 | timings 7408 248 16 38 1 144 3 hsync high vsync high endmode | ||
645 | # | ||
646 | # 1280x1024, 85 Hz, Non-Interlaced (157.50 MHz dotclock) | ||
647 | # | ||
648 | # Horizontal Vertical | ||
649 | # Resolution 1280 1024 | ||
650 | # Scan Frequency 91.146 kHz 85.02 Hz | ||
651 | # Sync Width 1.016 us 0.033 ms | ||
652 | # 20 chars 3 lines | ||
653 | # Front Porch 0.406 us 0.011 ms | ||
654 | # 8 chars 1 lines | ||
655 | # Back Porch 1.422 us 0.483 ms | ||
656 | # 28 chars 44 lines | ||
657 | # Active Time 8.127 us 11.235 ms | ||
658 | # 160 chars 1024 lines | ||
659 | # Blank Time 2.844 us 0.527 ms | ||
660 | # 56 chars 48 lines | ||
661 | # Polarity positive positive | ||
662 | # | ||
663 | mode "1280x1024-85" | ||
664 | # D: 157.50 MHz, H: 91.146 kHz, V: 85.02 Hz | ||
665 | geometry 1280 1024 1280 1024 32 | ||
666 | timings 6349 224 64 44 1 160 3 | ||
667 | hsync high vsync high endmode mode "1440x900-60" | ||
668 | # D: 106.500 MHz, H: 55.935 kHz, V: 60.00 Hz | ||
669 | geometry 1440 900 1440 900 32 | ||
670 | timings 9390 232 80 25 3 152 6 | ||
671 | hsync high vsync high endmode mode "1440x900-75" | ||
672 | # D: 136.750 MHz, H: 70.635 kHz, V: 75.00 Hz | ||
673 | geometry 1440 900 1440 900 32 | ||
674 | timings 7315 248 96 33 3 152 6 hsync high vsync high endmode | ||
675 | # | ||
676 | # 1440x1050, 60 Hz, Non-Interlaced (125.10 MHz dotclock) | ||
677 | # | ||
678 | # Horizontal Vertical | ||
679 | # Resolution 1440 1050 | ||
680 | # Scan Frequency 65.220 kHz 60.00 Hz | ||
681 | # Sync Width 1.204 us 0.046 ms | ||
682 | # 19 chars 3 lines | ||
683 | # Front Porch 0.760 us 0.015 ms | ||
684 | # 12 chars 1 lines | ||
685 | # Back Porch 1.964 us 0.495 ms | ||
686 | # 31 chars 33 lines | ||
687 | # Active Time 11.405 us 16.099 ms | ||
688 | # 180 chars 1050 lines | ||
689 | # Blank Time 3.928 us 0.567 ms | ||
690 | # 62 chars 37 lines | ||
691 | # Polarity positive positive | ||
692 | # | ||
693 | mode "1440x1050-60" | ||
694 | # D: 125.10 MHz, H: 65.220 kHz, V: 60.00 Hz | ||
695 | geometry 1440 1050 1440 1050 32 | ||
696 | timings 7993 248 96 33 1 152 3 | ||
697 | hsync high vsync high endmode mode "1600x900-60" | ||
698 | # D: 118.250 MHz, H: 55.990 kHz, V: 60.00 Hz | ||
699 | geometry 1600 900 1600 900 32 | ||
700 | timings 8415 256 88 26 3 168 5 endmode mode "1600x1024-60" | ||
701 | # D: 136.358 MHz, H: 63.600 kHz, V: 60.00 Hz | ||
702 | geometry 1600 1024 1600 1024 32 timings 7315 272 104 32 1 168 3 endmode | ||
703 | # | ||
704 | # 1600x1200, 60 Hz, Non-Interlaced (156.00 MHz dotclock) | ||
705 | # | ||
706 | # Horizontal Vertical | ||
707 | # Resolution 1600 1200 | ||
708 | # Scan Frequency 76.200 kHz 60.00 Hz | ||
709 | # Sync Width 1.026 us 0.105 ms | ||
710 | # 20 chars 8 lines | ||
711 | # Front Porch 0.205 us 0.131 ms | ||
712 | # 4 chars 10 lines | ||
713 | # Back Porch 1.636 us 0.682 ms | ||
714 | # 32 chars 52 lines | ||
715 | # Active Time 10.256 us 15.748 ms | ||
716 | # 200 chars 1200 lines | ||
717 | # Blank Time 2.872 us 0.866 ms | ||
718 | # 56 chars 66 lines | ||
719 | # Polarity negative negative | ||
720 | # | ||
721 | mode "1600x1200-60" | ||
722 | # D: 156.00 MHz, H: 76.200 kHz, V: 60.00 Hz | ||
723 | geometry 1600 1200 1600 1200 32 timings 6172 256 32 52 10 160 8 endmode | ||
724 | # | ||
725 | # 1600x1200, 75 Hz, Non-Interlaced (202.50 MHz dotclock) | ||
726 | # | ||
727 | # Horizontal Vertical | ||
728 | # Resolution 1600 1200 | ||
729 | # Scan Frequency 93.750 kHz 75.00 Hz | ||
730 | # Sync Width 0.948 us 0.032 ms | ||
731 | # 24 chars 3 lines | ||
732 | # Front Porch 0.316 us 0.011 ms | ||
733 | # 8 chars 1 lines | ||
734 | # Back Porch 1.501 us 0.491 ms | ||
735 | # 38 chars 46 lines | ||
736 | # Active Time 7.901 us 12.800 ms | ||
737 | # 200 chars 1200 lines | ||
738 | # Blank Time 2.765 us 0.533 ms | ||
739 | # 70 chars 50 lines | ||
740 | # Polarity positive positive | ||
741 | # | ||
742 | mode "1600x1200-75" | ||
743 | # D: 202.50 MHz, H: 93.750 kHz, V: 75.00 Hz | ||
744 | geometry 1600 1200 1600 1200 32 | ||
745 | timings 4938 304 64 46 1 192 3 | ||
746 | hsync high vsync high endmode mode "1680x1050-60" | ||
747 | # D: 146.250 MHz, H: 65.290 kHz, V: 59.954 Hz | ||
748 | geometry 1680 1050 1680 1050 32 | ||
749 | timings 6814 280 104 30 3 176 6 | ||
750 | hsync high vsync high endmode mode "1680x1050-75" | ||
751 | # D: 187.000 MHz, H: 82.306 kHz, V: 74.892 Hz | ||
752 | geometry 1680 1050 1680 1050 32 | ||
753 | timings 5348 296 120 40 3 176 6 | ||
754 | hsync high vsync high endmode mode "1792x1344-60" | ||
755 | # D: 202.975 MHz, H: 83.460 kHz, V: 60.00 Hz | ||
756 | geometry 1792 1344 1792 1344 32 | ||
757 | timings 4902 320 128 43 1 192 3 | ||
758 | hsync high vsync high endmode mode "1856x1392-60" | ||
759 | # D: 218.571 MHz, H: 86.460 kHz, V: 60.00 Hz | ||
760 | geometry 1856 1392 1856 1392 32 | ||
761 | timings 4577 336 136 45 1 200 3 | ||
762 | hsync high vsync high endmode mode "1920x1200-60" | ||
763 | # D: 193.250 MHz, H: 74.556 kHz, V: 60.00 Hz | ||
764 | geometry 1920 1200 1920 1200 32 | ||
765 | timings 5173 336 136 36 3 200 6 | ||
766 | hsync high vsync high endmode mode "1920x1440-60" | ||
767 | # D: 234.000 MHz, H:90.000 kHz, V: 60.00 Hz | ||
768 | geometry 1920 1440 1920 1440 32 | ||
769 | timings 4274 344 128 56 1 208 3 | ||
770 | hsync high vsync high endmode mode "1920x1440-75" | ||
771 | # D: 297.000 MHz, H:112.500 kHz, V: 75.00 Hz | ||
772 | geometry 1920 1440 1920 1440 32 | ||
773 | timings 3367 352 144 56 1 224 3 | ||
774 | hsync high vsync high endmode mode "2048x1536-60" | ||
775 | # D: 267.250 MHz, H: 95.446 kHz, V: 60.00 Hz | ||
776 | geometry 2048 1536 2048 1536 32 | ||
777 | timings 3742 376 152 49 3 224 4 hsync high vsync high endmode | ||
778 | # | ||
779 | # 1280x720, 60 Hz, Non-Interlaced (74.481 MHz dotclock) | ||
780 | # | ||
781 | # Horizontal Vertical | ||
782 | # Resolution 1280 720 | ||
783 | # Scan Frequency 44.760 kHz 60.00 Hz | ||
784 | # Sync Width 1.826 us 67.024 ms | ||
785 | # 17 chars 3 lines | ||
786 | # Front Porch 0.752 us 22.341 ms | ||
787 | # 7 chars 1 lines | ||
788 | # Back Porch 2.578 us 491.510 ms | ||
789 | # 24 chars 22 lines | ||
790 | # Active Time 17.186 us 16.086 ms | ||
791 | # 160 chars 720 lines | ||
792 | # Blank Time 5.156 us 0.581 ms | ||
793 | # 48 chars 26 lines | ||
794 | # Polarity negative negative | ||
795 | # | ||
796 | mode "1280x720-60" | ||
797 | # D: 74.481 MHz, H: 44.760 kHz, V: 60.00 Hz | ||
798 | geometry 1280 720 1280 720 32 timings 13426 192 64 22 1 136 3 endmode | ||
799 | # | ||
800 | # 1920x1080, 60 Hz, Non-Interlaced (172.798 MHz dotclock) | ||
801 | # | ||
802 | # Horizontal Vertical | ||
803 | # Resolution 1920 1080 | ||
804 | # Scan Frequency 67.080 kHz 60.00 Hz | ||
805 | # Sync Width 1.204 us 44.723 ms | ||
806 | # 26 chars 3 lines | ||
807 | # Front Porch 0.694 us 14.908 ms | ||
808 | # 15 chars 1 lines | ||
809 | # Back Porch 1.898 us 506.857 ms | ||
810 | # 41 chars 34 lines | ||
811 | # Active Time 11.111 us 16.100 ms | ||
812 | # 240 chars 1080 lines | ||
813 | # Blank Time 3.796 us 0.566 ms | ||
814 | # 82 chars 38 lines | ||
815 | # Polarity negative negative | ||
816 | # | ||
817 | mode "1920x1080-60" | ||
818 | # D: 74.481 MHz, H: 67.080 kHz, V: 60.00 Hz | ||
819 | geometry 1920 1080 1920 1080 32 timings 5787 328 120 34 1 208 3 endmode | ||
820 | # | ||
821 | # 1400x1050, 60 Hz, Non-Interlaced (122.61 MHz dotclock) | ||
822 | # | ||
823 | # Horizontal Vertical | ||
824 | # Resolution 1400 1050 | ||
825 | # Scan Frequency 65.218 kHz 59.99 Hz | ||
826 | # Sync Width 1.037 us 0.047 ms | ||
827 | # 19 chars 3 lines | ||
828 | # Front Porch 0.444 us 0.015 ms | ||
829 | # 11 chars 1 lines | ||
830 | # Back Porch 1.185 us 0.188 ms | ||
831 | # 30 chars 33 lines | ||
832 | # Active Time 12.963 us 16.411 ms | ||
833 | # 175 chars 1050 lines | ||
834 | # Blank Time 2.667 us 0.250 ms | ||
835 | # 60 chars 37 lines | ||
836 | # Polarity negative positive | ||
837 | # | ||
838 | mode "1400x1050-60" | ||
839 | # D: 122.750 MHz, H: 65.317 kHz, V: 59.99 Hz | ||
840 | geometry 1400 1050 1408 1050 32 | ||
841 | timings 8214 232 88 32 3 144 4 endmode mode "1400x1050-75" | ||
842 | # D: 156.000 MHz, H: 82.278 kHz, V: 74.867 Hz | ||
843 | geometry 1400 1050 1408 1050 32 timings 6410 248 104 42 3 144 4 endmode | ||
844 | # | ||
845 | # 1366x768, 60 Hz, Non-Interlaced (85.86 MHz dotclock) | ||
846 | # | ||
847 | # Horizontal Vertical | ||
848 | # Resolution 1366 768 | ||
849 | # Scan Frequency 47.700 kHz 60.00 Hz | ||
850 | # Sync Width 1.677 us 0.063 ms | ||
851 | # 18 chars 3 lines | ||
852 | # Front Porch 0.839 us 0.021 ms | ||
853 | # 9 chars 1 lines | ||
854 | # Back Porch 2.516 us 0.482 ms | ||
855 | # 27 chars 23 lines | ||
856 | # Active Time 15.933 us 16.101 ms | ||
857 | # 171 chars 768 lines | ||
858 | # Blank Time 5.031 us 0.566 ms | ||
859 | # 54 chars 27 lines | ||
860 | # Polarity negative positive | ||
861 | # | ||
862 | mode "1360x768-60" | ||
863 | # D: 84.750 MHz, H: 47.720 kHz, V: 60.00 Hz | ||
864 | geometry 1360 768 1360 768 32 | ||
865 | timings 11799 208 72 22 3 136 5 endmode mode "1366x768-60" | ||
866 | # D: 85.86 MHz, H: 47.700 kHz, V: 60.00 Hz | ||
867 | geometry 1366 768 1366 768 32 | ||
868 | timings 11647 216 72 23 1 144 3 endmode mode "1366x768-50" | ||
869 | # D: 69,924 MHz, H: 39.550 kHz, V: 50.00 Hz | ||
870 | geometry 1366 768 1366 768 32 timings 14301 200 56 19 1 144 3 endmode | ||
diff --git a/Documentation/fb/viafb.txt b/Documentation/fb/viafb.txt new file mode 100644 index 000000000000..67dbf442b0b6 --- /dev/null +++ b/Documentation/fb/viafb.txt | |||
@@ -0,0 +1,214 @@ | |||
1 | |||
2 | VIA Integration Graphic Chip Console Framebuffer Driver | ||
3 | |||
4 | [Platform] | ||
5 | ----------------------- | ||
6 | The console framebuffer driver is for graphics chips of | ||
7 | VIA UniChrome Family(CLE266, PM800 / CN400 / CN300, | ||
8 | P4M800CE / P4M800Pro / CN700 / VN800, | ||
9 | CX700 / VX700, K8M890, P4M890, | ||
10 | CN896 / P4M900, VX800) | ||
11 | |||
12 | [Driver features] | ||
13 | ------------------------ | ||
14 | Device: CRT, LCD, DVI | ||
15 | |||
16 | Support viafb_mode: | ||
17 | CRT: | ||
18 | 640x480(60, 75, 85, 100, 120 Hz), 720x480(60 Hz), | ||
19 | 720x576(60 Hz), 800x600(60, 75, 85, 100, 120 Hz), | ||
20 | 848x480(60 Hz), 856x480(60 Hz), 1024x512(60 Hz), | ||
21 | 1024x768(60, 75, 85, 100 Hz), 1152x864(75 Hz), | ||
22 | 1280x768(60 Hz), 1280x960(60 Hz), 1280x1024(60, 75, 85 Hz), | ||
23 | 1440x1050(60 Hz), 1600x1200(60, 75 Hz), 1280x720(60 Hz), | ||
24 | 1920x1080(60 Hz), 1400x1050(60 Hz), 800x480(60 Hz) | ||
25 | |||
26 | color depth: 8 bpp, 16 bpp, 32 bpp supports. | ||
27 | |||
28 | Support 2D hardware accelerator. | ||
29 | |||
30 | [Using the viafb module] | ||
31 | -- -- -------------------- | ||
32 | Start viafb with default settings: | ||
33 | #modprobe viafb | ||
34 | |||
35 | Start viafb with with user options: | ||
36 | #modprobe viafb viafb_mode=800x600 viafb_bpp=16 viafb_refresh=60 | ||
37 | viafb_active_dev=CRT+DVI viafb_dvi_port=DVP1 | ||
38 | viafb_mode1=1024x768 viafb_bpp=16 viafb_refresh1=60 | ||
39 | viafb_SAMM_ON=1 | ||
40 | |||
41 | viafb_mode: | ||
42 | 640x480 (default) | ||
43 | 720x480 | ||
44 | 800x600 | ||
45 | 1024x768 | ||
46 | ...... | ||
47 | |||
48 | viafb_bpp: | ||
49 | 8, 16, 32 (default:32) | ||
50 | |||
51 | viafb_refresh: | ||
52 | 60, 75, 85, 100, 120 (default:60) | ||
53 | |||
54 | viafb_lcd_dsp_method: | ||
55 | 0 : expansion (default) | ||
56 | 1 : centering | ||
57 | |||
58 | viafb_lcd_mode: | ||
59 | 0 : LCD panel with LSB data format input (default) | ||
60 | 1 : LCD panel with MSB data format input | ||
61 | |||
62 | viafb_lcd_panel_id: | ||
63 | 0 : Resolution: 640x480, Channel: single, Dithering: Enable | ||
64 | 1 : Resolution: 800x600, Channel: single, Dithering: Enable | ||
65 | 2 : Resolution: 1024x768, Channel: single, Dithering: Enable (default) | ||
66 | 3 : Resolution: 1280x768, Channel: single, Dithering: Enable | ||
67 | 4 : Resolution: 1280x1024, Channel: dual, Dithering: Enable | ||
68 | 5 : Resolution: 1400x1050, Channel: dual, Dithering: Enable | ||
69 | 6 : Resolution: 1600x1200, Channel: dual, Dithering: Enable | ||
70 | |||
71 | 8 : Resolution: 800x480, Channel: single, Dithering: Enable | ||
72 | 9 : Resolution: 1024x768, Channel: dual, Dithering: Enable | ||
73 | 10: Resolution: 1024x768, Channel: single, Dithering: Disable | ||
74 | 11: Resolution: 1024x768, Channel: dual, Dithering: Disable | ||
75 | 12: Resolution: 1280x768, Channel: single, Dithering: Disable | ||
76 | 13: Resolution: 1280x1024, Channel: dual, Dithering: Disable | ||
77 | 14: Resolution: 1400x1050, Channel: dual, Dithering: Disable | ||
78 | 15: Resolution: 1600x1200, Channel: dual, Dithering: Disable | ||
79 | 16: Resolution: 1366x768, Channel: single, Dithering: Disable | ||
80 | 17: Resolution: 1024x600, Channel: single, Dithering: Enable | ||
81 | 18: Resolution: 1280x768, Channel: dual, Dithering: Enable | ||
82 | 19: Resolution: 1280x800, Channel: single, Dithering: Enable | ||
83 | |||
84 | viafb_accel: | ||
85 | 0 : No 2D Hardware Acceleration | ||
86 | 1 : 2D Hardware Acceleration (default) | ||
87 | |||
88 | viafb_SAMM_ON: | ||
89 | 0 : viafb_SAMM_ON disable (default) | ||
90 | 1 : viafb_SAMM_ON enable | ||
91 | |||
92 | viafb_mode1: (secondary display device) | ||
93 | 640x480 (default) | ||
94 | 720x480 | ||
95 | 800x600 | ||
96 | 1024x768 | ||
97 | ... ... | ||
98 | |||
99 | viafb_bpp1: (secondary display device) | ||
100 | 8, 16, 32 (default:32) | ||
101 | |||
102 | viafb_refresh1: (secondary display device) | ||
103 | 60, 75, 85, 100, 120 (default:60) | ||
104 | |||
105 | viafb_active_dev: | ||
106 | This option is used to specify active devices.(CRT, DVI, CRT+LCD...) | ||
107 | DVI stands for DVI or HDMI, E.g., If you want to enable HDMI, | ||
108 | set viafb_active_dev=DVI. In SAMM case, the previous of | ||
109 | viafb_active_dev is primary device, and the following is | ||
110 | secondary device. | ||
111 | |||
112 | For example: | ||
113 | To enable one device, such as DVI only, we can use: | ||
114 | modprobe viafb viafb_active_dev=DVI | ||
115 | To enable two devices, such as CRT+DVI: | ||
116 | modprobe viafb viafb_active_dev=CRT+DVI; | ||
117 | |||
118 | For DuoView case, we can use: | ||
119 | modprobe viafb viafb_active_dev=CRT+DVI | ||
120 | OR | ||
121 | modprobe viafb viafb_active_dev=DVI+CRT... | ||
122 | |||
123 | For SAMM case: | ||
124 | If CRT is primary and DVI is secondary, we should use: | ||
125 | modprobe viafb viafb_active_dev=CRT+DVI viafb_SAMM_ON=1... | ||
126 | If DVI is primary and CRT is secondary, we should use: | ||
127 | modprobe viafb viafb_active_dev=DVI+CRT viafb_SAMM_ON=1... | ||
128 | |||
129 | viafb_display_hardware_layout: | ||
130 | This option is used to specify display hardware layout for CX700 chip. | ||
131 | 1 : LCD only | ||
132 | 2 : DVI only | ||
133 | 3 : LCD+DVI (default) | ||
134 | 4 : LCD1+LCD2 (internal + internal) | ||
135 | 16: LCD1+ExternalLCD2 (internal + external) | ||
136 | |||
137 | viafb_second_size: | ||
138 | This option is used to set second device memory size(MB) in SAMM case. | ||
139 | The minimal size is 16. | ||
140 | |||
141 | viafb_platform_epia_dvi: | ||
142 | This option is used to enable DVI on EPIA - M | ||
143 | 0 : No DVI on EPIA - M (default) | ||
144 | 1 : DVI on EPIA - M | ||
145 | |||
146 | viafb_bus_width: | ||
147 | When using 24 - Bit Bus Width Digital Interface, | ||
148 | this option should be set. | ||
149 | 12: 12-Bit LVDS or 12-Bit TMDS (default) | ||
150 | 24: 24-Bit LVDS or 24-Bit TMDS | ||
151 | |||
152 | viafb_device_lcd_dualedge: | ||
153 | When using Dual Edge Panel, this option should be set. | ||
154 | 0 : No Dual Edge Panel (default) | ||
155 | 1 : Dual Edge Panel | ||
156 | |||
157 | viafb_video_dev: | ||
158 | This option is used to specify video output devices(CRT, DVI, LCD) for | ||
159 | duoview case. | ||
160 | For example: | ||
161 | To output video on DVI, we should use: | ||
162 | modprobe viafb viafb_video_dev=DVI... | ||
163 | |||
164 | viafb_lcd_port: | ||
165 | This option is used to specify LCD output port, | ||
166 | available values are "DVP0" "DVP1" "DFP_HIGHLOW" "DFP_HIGH" "DFP_LOW". | ||
167 | for external LCD + external DVI on CX700(External LCD is on DVP0), | ||
168 | we should use: | ||
169 | modprobe viafb viafb_lcd_port=DVP0... | ||
170 | |||
171 | Notes: | ||
172 | 1. CRT may not display properly for DuoView CRT & DVI display at | ||
173 | the "640x480" PAL mode with DVI overscan enabled. | ||
174 | 2. SAMM stands for single adapter multi monitors. It is different from | ||
175 | multi-head since SAMM support multi monitor at driver layers, thus fbcon | ||
176 | layer doesn't even know about it; SAMM's second screen doesn't have a | ||
177 | device node file, thus a user mode application can't access it directly. | ||
178 | When SAMM is enabled, viafb_mode and viafb_mode1, viafb_bpp and | ||
179 | viafb_bpp1, viafb_refresh and viafb_refresh1 can be different. | ||
180 | 3. When console is depending on viafbinfo1, dynamically change resolution | ||
181 | and bpp, need to call VIAFB specified ioctl interface VIAFB_SET_DEVICE | ||
182 | instead of calling common ioctl function FBIOPUT_VSCREENINFO since | ||
183 | viafb doesn't support multi-head well, or it will cause screen crush. | ||
184 | 4. VX800 2D accelerator hasn't been supported in this driver yet. When | ||
185 | using driver on VX800, the driver will disable the acceleration | ||
186 | function as default. | ||
187 | |||
188 | |||
189 | [Configure viafb with "fbset" tool] | ||
190 | ----------------------------------- | ||
191 | "fbset" is an inbox utility of Linux. | ||
192 | 1. Inquire current viafb information, type, | ||
193 | # fbset -i | ||
194 | |||
195 | 2. Set various resolutions and viafb_refresh rates, | ||
196 | # fbset <resolution-vertical_sync> | ||
197 | |||
198 | example, | ||
199 | # fbset "1024x768-75" | ||
200 | or | ||
201 | # fbset -g 1024 768 1024 768 32 | ||
202 | Check the file "/etc/fb.modes" to find display modes available. | ||
203 | |||
204 | 3. Set the color depth, | ||
205 | # fbset -depth <value> | ||
206 | |||
207 | example, | ||
208 | # fbset -depth 16 | ||
209 | |||
210 | [Bootup with viafb]: | ||
211 | -------------------- | ||
212 | Add the following line to your grub.conf: | ||
213 | append = "video=viafb:viafb_mode=1024x768,viafb_bpp=32,viafb_refresh=85" | ||
214 | |||
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 65a1482457a8..05d71b4b9430 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -6,6 +6,24 @@ be removed from this file. | |||
6 | 6 | ||
7 | --------------------------- | 7 | --------------------------- |
8 | 8 | ||
9 | What: old static regulatory information and ieee80211_regdom module parameter | ||
10 | When: 2.6.29 | ||
11 | Why: The old regulatory infrastructure has been replaced with a new one | ||
12 | which does not require statically defined regulatory domains. We do | ||
13 | not want to keep static regulatory domains in the kernel due to the | ||
14 | the dynamic nature of regulatory law and localization. We kept around | ||
15 | the old static definitions for the regulatory domains of: | ||
16 | * US | ||
17 | * JP | ||
18 | * EU | ||
19 | and used by default the US when CONFIG_WIRELESS_OLD_REGULATORY was | ||
20 | set. We also kept around the ieee80211_regdom module parameter in case | ||
21 | some applications were relying on it. Changing regulatory domains | ||
22 | can now be done instead by using nl80211, as is done with iw. | ||
23 | Who: Luis R. Rodriguez <lrodriguez@atheros.com> | ||
24 | |||
25 | --------------------------- | ||
26 | |||
9 | What: dev->power.power_state | 27 | What: dev->power.power_state |
10 | When: July 2007 | 28 | When: July 2007 |
11 | Why: Broken design for runtime control over driver power states, confusing | 29 | Why: Broken design for runtime control over driver power states, confusing |
@@ -19,15 +37,6 @@ Who: Pavel Machek <pavel@suse.cz> | |||
19 | 37 | ||
20 | --------------------------- | 38 | --------------------------- |
21 | 39 | ||
22 | What: old NCR53C9x driver | ||
23 | When: October 2007 | ||
24 | Why: Replaced by the much better esp_scsi driver. Actual low-level | ||
25 | driver can be ported over almost trivially. | ||
26 | Who: David Miller <davem@davemloft.net> | ||
27 | Christoph Hellwig <hch@lst.de> | ||
28 | |||
29 | --------------------------- | ||
30 | |||
31 | What: Video4Linux API 1 ioctls and video_decoder.h from Video devices. | 40 | What: Video4Linux API 1 ioctls and video_decoder.h from Video devices. |
32 | When: December 2008 | 41 | When: December 2008 |
33 | Files: include/linux/video_decoder.h include/linux/videodev.h | 42 | Files: include/linux/video_decoder.h include/linux/videodev.h |
@@ -47,6 +56,30 @@ Who: Mauro Carvalho Chehab <mchehab@infradead.org> | |||
47 | 56 | ||
48 | --------------------------- | 57 | --------------------------- |
49 | 58 | ||
59 | What: old tuner-3036 i2c driver | ||
60 | When: 2.6.28 | ||
61 | Why: This driver is for VERY old i2c-over-parallel port teletext receiver | ||
62 | boxes. Rather then spending effort on converting this driver to V4L2, | ||
63 | and since it is extremely unlikely that anyone still uses one of these | ||
64 | devices, it was decided to drop it. | ||
65 | Who: Hans Verkuil <hverkuil@xs4all.nl> | ||
66 | Mauro Carvalho Chehab <mchehab@infradead.org> | ||
67 | |||
68 | --------------------------- | ||
69 | |||
70 | What: V4L2 dpc7146 driver | ||
71 | When: 2.6.28 | ||
72 | Why: Old driver for the dpc7146 demonstration board that is no longer | ||
73 | relevant. The last time this was tested on actual hardware was | ||
74 | probably around 2002. Since this is a driver for a demonstration | ||
75 | board the decision was made to remove it rather than spending a | ||
76 | lot of effort continually updating this driver to stay in sync | ||
77 | with the latest internal V4L2 or I2C API. | ||
78 | Who: Hans Verkuil <hverkuil@xs4all.nl> | ||
79 | Mauro Carvalho Chehab <mchehab@infradead.org> | ||
80 | |||
81 | --------------------------- | ||
82 | |||
50 | What: PCMCIA control ioctl (needed for pcmcia-cs [cardmgr, cardctl]) | 83 | What: PCMCIA control ioctl (needed for pcmcia-cs [cardmgr, cardctl]) |
51 | When: November 2005 | 84 | When: November 2005 |
52 | Files: drivers/pcmcia/: pcmcia_ioctl.c | 85 | Files: drivers/pcmcia/: pcmcia_ioctl.c |
@@ -138,24 +171,6 @@ Who: Kay Sievers <kay.sievers@suse.de> | |||
138 | 171 | ||
139 | --------------------------- | 172 | --------------------------- |
140 | 173 | ||
141 | What: find_task_by_pid | ||
142 | When: 2.6.26 | ||
143 | Why: With pid namespaces, calling this funciton will return the | ||
144 | wrong task when called from inside a namespace. | ||
145 | |||
146 | The best way to save a task pid and find a task by this | ||
147 | pid later, is to find this task's struct pid pointer (or get | ||
148 | it directly from the task) and call pid_task() later. | ||
149 | |||
150 | If someone really needs to get a task by its pid_t, then | ||
151 | he most likely needs the find_task_by_vpid() to get the | ||
152 | task from the same namespace as the current task is in, but | ||
153 | this may be not so in general. | ||
154 | |||
155 | Who: Pavel Emelyanov <xemul@openvz.org> | ||
156 | |||
157 | --------------------------- | ||
158 | |||
159 | What: ACPI procfs interface | 174 | What: ACPI procfs interface |
160 | When: July 2008 | 175 | When: July 2008 |
161 | Why: ACPI sysfs conversion should be finished by January 2008. | 176 | Why: ACPI sysfs conversion should be finished by January 2008. |
@@ -199,19 +214,6 @@ Who: Tejun Heo <htejun@gmail.com> | |||
199 | 214 | ||
200 | --------------------------- | 215 | --------------------------- |
201 | 216 | ||
202 | What: The arch/ppc and include/asm-ppc directories | ||
203 | When: Jun 2008 | ||
204 | Why: The arch/powerpc tree is the merged architecture for ppc32 and ppc64 | ||
205 | platforms. Currently there are efforts underway to port the remaining | ||
206 | arch/ppc platforms to the merged tree. New submissions to the arch/ppc | ||
207 | tree have been frozen with the 2.6.22 kernel release and that tree will | ||
208 | remain in bug-fix only mode until its scheduled removal. Platforms | ||
209 | that are not ported by June 2008 will be removed due to the lack of an | ||
210 | interested maintainer. | ||
211 | Who: linuxppc-dev@ozlabs.org | ||
212 | |||
213 | --------------------------- | ||
214 | |||
215 | What: i386/x86_64 bzImage symlinks | 217 | What: i386/x86_64 bzImage symlinks |
216 | When: April 2010 | 218 | When: April 2010 |
217 | 219 | ||
@@ -248,6 +250,9 @@ What (Why): | |||
248 | - xt_mark match revision 0 | 250 | - xt_mark match revision 0 |
249 | (superseded by xt_mark match revision 1) | 251 | (superseded by xt_mark match revision 1) |
250 | 252 | ||
253 | - xt_recent: the old ipt_recent proc dir | ||
254 | (superseded by /proc/net/xt_recent) | ||
255 | |||
251 | When: January 2009 or Linux 2.7.0, whichever comes first | 256 | When: January 2009 or Linux 2.7.0, whichever comes first |
252 | Why: Superseded by newer revisions or modules | 257 | Why: Superseded by newer revisions or modules |
253 | Who: Jan Engelhardt <jengelh@computergmbh.de> | 258 | Who: Jan Engelhardt <jengelh@computergmbh.de> |
@@ -282,11 +287,19 @@ Who: Glauber Costa <gcosta@redhat.com> | |||
282 | 287 | ||
283 | --------------------------- | 288 | --------------------------- |
284 | 289 | ||
285 | What: old style serial driver for ColdFire (CONFIG_SERIAL_COLDFIRE) | 290 | What: remove HID compat support |
286 | When: 2.6.28 | 291 | When: 2.6.29 |
287 | Why: This driver still uses the old interface and has been replaced | 292 | Why: needed only as a temporary solution until distros fix themselves up |
288 | by CONFIG_SERIAL_MCF. | 293 | Who: Jiri Slaby <jirislaby@gmail.com> |
289 | Who: Sebastian Siewior <sebastian@breakpoint.cc> | 294 | |
295 | --------------------------- | ||
296 | |||
297 | What: print_fn_descriptor_symbol() | ||
298 | When: October 2009 | ||
299 | Why: The %pF vsprintf format provides the same functionality in a | ||
300 | simpler way. print_fn_descriptor_symbol() is deprecated but | ||
301 | still present to give out-of-tree modules time to change. | ||
302 | Who: Bjorn Helgaas <bjorn.helgaas@hp.com> | ||
290 | 303 | ||
291 | --------------------------- | 304 | --------------------------- |
292 | 305 | ||
@@ -300,11 +313,15 @@ Who: ocfs2-devel@oss.oracle.com | |||
300 | 313 | ||
301 | --------------------------- | 314 | --------------------------- |
302 | 315 | ||
303 | What: asm/semaphore.h | 316 | What: SCTP_GET_PEER_ADDRS_NUM_OLD, SCTP_GET_PEER_ADDRS_OLD, |
304 | When: 2.6.26 | 317 | SCTP_GET_LOCAL_ADDRS_NUM_OLD, SCTP_GET_LOCAL_ADDRS_OLD |
305 | Why: Implementation became generic; users should now include | 318 | When: June 2009 |
306 | linux/semaphore.h instead. | 319 | Why: A newer version of the options have been introduced in 2005 that |
307 | Who: Matthew Wilcox <willy@linux.intel.com> | 320 | removes the limitions of the old API. The sctp library has been |
321 | converted to use these new options at the same time. Any user | ||
322 | space app that directly uses the old options should convert to using | ||
323 | the new options. | ||
324 | Who: Vlad Yasevich <vladislav.yasevich@hp.com> | ||
308 | 325 | ||
309 | --------------------------- | 326 | --------------------------- |
310 | 327 | ||
@@ -314,3 +331,39 @@ Why: This option was introduced just to allow older lm-sensors userspace | |||
314 | to keep working over the upgrade to 2.6.26. At the scheduled time of | 331 | to keep working over the upgrade to 2.6.26. At the scheduled time of |
315 | removal fixed lm-sensors (2.x or 3.x) should be readily available. | 332 | removal fixed lm-sensors (2.x or 3.x) should be readily available. |
316 | Who: Rene Herman <rene.herman@gmail.com> | 333 | Who: Rene Herman <rene.herman@gmail.com> |
334 | |||
335 | --------------------------- | ||
336 | |||
337 | What: Code that is now under CONFIG_WIRELESS_EXT_SYSFS | ||
338 | (in net/core/net-sysfs.c) | ||
339 | When: After the only user (hal) has seen a release with the patches | ||
340 | for enough time, probably some time in 2010. | ||
341 | Why: Over 1K .text/.data size reduction, data is available in other | ||
342 | ways (ioctls) | ||
343 | Who: Johannes Berg <johannes@sipsolutions.net> | ||
344 | |||
345 | --------------------------- | ||
346 | |||
347 | What: CONFIG_NF_CT_ACCT | ||
348 | When: 2.6.29 | ||
349 | Why: Accounting can now be enabled/disabled without kernel recompilation. | ||
350 | Currently used only to set a default value for a feature that is also | ||
351 | controlled by a kernel/module/sysfs/sysctl parameter. | ||
352 | Who: Krzysztof Piotr Oledzki <ole@ans.pl> | ||
353 | |||
354 | --------------------------- | ||
355 | |||
356 | What: ide-scsi (BLK_DEV_IDESCSI) | ||
357 | When: 2.6.29 | ||
358 | Why: The 2.6 kernel supports direct writing to ide CD drives, which | ||
359 | eliminates the need for ide-scsi. The new method is more | ||
360 | efficient in every way. | ||
361 | Who: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | ||
362 | |||
363 | --------------------------- | ||
364 | |||
365 | What: i2c_attach_client(), i2c_detach_client(), i2c_driver->detach_client() | ||
366 | When: 2.6.29 (ideally) or 2.6.30 (more likely) | ||
367 | Why: Deprecated by the new (standard) device driver binding model. Use | ||
368 | i2c_driver->probe() and ->remove() instead. | ||
369 | Who: Jean Delvare <khali@linux-fr.org> | ||
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index 8b22d7d8b991..8362860e21a7 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking | |||
@@ -144,8 +144,8 @@ prototypes: | |||
144 | void (*kill_sb) (struct super_block *); | 144 | void (*kill_sb) (struct super_block *); |
145 | locking rules: | 145 | locking rules: |
146 | may block BKL | 146 | may block BKL |
147 | get_sb yes yes | 147 | get_sb yes no |
148 | kill_sb yes yes | 148 | kill_sb yes no |
149 | 149 | ||
150 | ->get_sb() returns error or 0 with locked superblock attached to the vfsmount | 150 | ->get_sb() returns error or 0 with locked superblock attached to the vfsmount |
151 | (exclusive on ->s_umount). | 151 | (exclusive on ->s_umount). |
@@ -409,12 +409,12 @@ ioctl: yes (see below) | |||
409 | unlocked_ioctl: no (see below) | 409 | unlocked_ioctl: no (see below) |
410 | compat_ioctl: no | 410 | compat_ioctl: no |
411 | mmap: no | 411 | mmap: no |
412 | open: maybe (see below) | 412 | open: no |
413 | flush: no | 413 | flush: no |
414 | release: no | 414 | release: no |
415 | fsync: no (see below) | 415 | fsync: no (see below) |
416 | aio_fsync: no | 416 | aio_fsync: no |
417 | fasync: yes (see below) | 417 | fasync: no |
418 | lock: yes | 418 | lock: yes |
419 | readv: no | 419 | readv: no |
420 | writev: no | 420 | writev: no |
@@ -431,13 +431,6 @@ For many filesystems, it is probably safe to acquire the inode | |||
431 | semaphore. Note some filesystems (i.e. remote ones) provide no | 431 | semaphore. Note some filesystems (i.e. remote ones) provide no |
432 | protection for i_size so you will need to use the BKL. | 432 | protection for i_size so you will need to use the BKL. |
433 | 433 | ||
434 | ->open() locking is in-transit: big lock partially moved into the methods. | ||
435 | The only exception is ->open() in the instances of file_operations that never | ||
436 | end up in ->i_fop/->proc_fops, i.e. ones that belong to character devices | ||
437 | (chrdev_open() takes lock before replacing ->f_op and calling the secondary | ||
438 | method. As soon as we fix the handling of module reference counters all | ||
439 | instances of ->open() will be called without the BKL. | ||
440 | |||
441 | Note: ext2_release() was *the* source of contention on fs-intensive | 434 | Note: ext2_release() was *the* source of contention on fs-intensive |
442 | loads and dropping BKL on ->release() helps to get rid of that (we still | 435 | loads and dropping BKL on ->release() helps to get rid of that (we still |
443 | grab BKL for cases when we close a file that had been opened r/w, but that | 436 | grab BKL for cases when we close a file that had been opened r/w, but that |
@@ -510,6 +503,7 @@ prototypes: | |||
510 | void (*close)(struct vm_area_struct*); | 503 | void (*close)(struct vm_area_struct*); |
511 | int (*fault)(struct vm_area_struct*, struct vm_fault *); | 504 | int (*fault)(struct vm_area_struct*, struct vm_fault *); |
512 | int (*page_mkwrite)(struct vm_area_struct *, struct page *); | 505 | int (*page_mkwrite)(struct vm_area_struct *, struct page *); |
506 | int (*access)(struct vm_area_struct *, unsigned long, void*, int, int); | ||
513 | 507 | ||
514 | locking rules: | 508 | locking rules: |
515 | BKL mmap_sem PageLocked(page) | 509 | BKL mmap_sem PageLocked(page) |
@@ -517,6 +511,7 @@ open: no yes | |||
517 | close: no yes | 511 | close: no yes |
518 | fault: no yes | 512 | fault: no yes |
519 | page_mkwrite: no yes no | 513 | page_mkwrite: no yes no |
514 | access: no yes | ||
520 | 515 | ||
521 | ->page_mkwrite() is called when a previously read-only page is | 516 | ->page_mkwrite() is called when a previously read-only page is |
522 | about to become writeable. The file system is responsible for | 517 | about to become writeable. The file system is responsible for |
@@ -525,6 +520,11 @@ taking to lock out truncate, the page range should be verified to be | |||
525 | within i_size. The page mapping should also be checked that it is not | 520 | within i_size. The page mapping should also be checked that it is not |
526 | NULL. | 521 | NULL. |
527 | 522 | ||
523 | ->access() is called when get_user_pages() fails in | ||
524 | acces_process_vm(), typically used to debug a process through | ||
525 | /proc/pid/mem or ptrace. This function is needed only for | ||
526 | VM_IO | VM_PFNMAP VMAs. | ||
527 | |||
528 | ================================================================================ | 528 | ================================================================================ |
529 | Dubious stuff | 529 | Dubious stuff |
530 | 530 | ||
diff --git a/Documentation/filesystems/autofs4-mount-control.txt b/Documentation/filesystems/autofs4-mount-control.txt new file mode 100644 index 000000000000..c6341745df37 --- /dev/null +++ b/Documentation/filesystems/autofs4-mount-control.txt | |||
@@ -0,0 +1,393 @@ | |||
1 | |||
2 | Miscellaneous Device control operations for the autofs4 kernel module | ||
3 | ==================================================================== | ||
4 | |||
5 | The problem | ||
6 | =========== | ||
7 | |||
8 | There is a problem with active restarts in autofs (that is to say | ||
9 | restarting autofs when there are busy mounts). | ||
10 | |||
11 | During normal operation autofs uses a file descriptor opened on the | ||
12 | directory that is being managed in order to be able to issue control | ||
13 | operations. Using a file descriptor gives ioctl operations access to | ||
14 | autofs specific information stored in the super block. The operations | ||
15 | are things such as setting an autofs mount catatonic, setting the | ||
16 | expire timeout and requesting expire checks. As is explained below, | ||
17 | certain types of autofs triggered mounts can end up covering an autofs | ||
18 | mount itself which prevents us being able to use open(2) to obtain a | ||
19 | file descriptor for these operations if we don't already have one open. | ||
20 | |||
21 | Currently autofs uses "umount -l" (lazy umount) to clear active mounts | ||
22 | at restart. While using lazy umount works for most cases, anything that | ||
23 | needs to walk back up the mount tree to construct a path, such as | ||
24 | getcwd(2) and the proc file system /proc/<pid>/cwd, no longer works | ||
25 | because the point from which the path is constructed has been detached | ||
26 | from the mount tree. | ||
27 | |||
28 | The actual problem with autofs is that it can't reconnect to existing | ||
29 | mounts. Immediately one thinks of just adding the ability to remount | ||
30 | autofs file systems would solve it, but alas, that can't work. This is | ||
31 | because autofs direct mounts and the implementation of "on demand mount | ||
32 | and expire" of nested mount trees have the file system mounted directly | ||
33 | on top of the mount trigger directory dentry. | ||
34 | |||
35 | For example, there are two types of automount maps, direct (in the kernel | ||
36 | module source you will see a third type called an offset, which is just | ||
37 | a direct mount in disguise) and indirect. | ||
38 | |||
39 | Here is a master map with direct and indirect map entries: | ||
40 | |||
41 | /- /etc/auto.direct | ||
42 | /test /etc/auto.indirect | ||
43 | |||
44 | and the corresponding map files: | ||
45 | |||
46 | /etc/auto.direct: | ||
47 | |||
48 | /automount/dparse/g6 budgie:/autofs/export1 | ||
49 | /automount/dparse/g1 shark:/autofs/export1 | ||
50 | and so on. | ||
51 | |||
52 | /etc/auto.indirect: | ||
53 | |||
54 | g1 shark:/autofs/export1 | ||
55 | g6 budgie:/autofs/export1 | ||
56 | and so on. | ||
57 | |||
58 | For the above indirect map an autofs file system is mounted on /test and | ||
59 | mounts are triggered for each sub-directory key by the inode lookup | ||
60 | operation. So we see a mount of shark:/autofs/export1 on /test/g1, for | ||
61 | example. | ||
62 | |||
63 | The way that direct mounts are handled is by making an autofs mount on | ||
64 | each full path, such as /automount/dparse/g1, and using it as a mount | ||
65 | trigger. So when we walk on the path we mount shark:/autofs/export1 "on | ||
66 | top of this mount point". Since these are always directories we can | ||
67 | use the follow_link inode operation to trigger the mount. | ||
68 | |||
69 | But, each entry in direct and indirect maps can have offsets (making | ||
70 | them multi-mount map entries). | ||
71 | |||
72 | For example, an indirect mount map entry could also be: | ||
73 | |||
74 | g1 \ | ||
75 | / shark:/autofs/export5/testing/test \ | ||
76 | /s1 shark:/autofs/export/testing/test/s1 \ | ||
77 | /s2 shark:/autofs/export5/testing/test/s2 \ | ||
78 | /s1/ss1 shark:/autofs/export1 \ | ||
79 | /s2/ss2 shark:/autofs/export2 | ||
80 | |||
81 | and a similarly a direct mount map entry could also be: | ||
82 | |||
83 | /automount/dparse/g1 \ | ||
84 | / shark:/autofs/export5/testing/test \ | ||
85 | /s1 shark:/autofs/export/testing/test/s1 \ | ||
86 | /s2 shark:/autofs/export5/testing/test/s2 \ | ||
87 | /s1/ss1 shark:/autofs/export2 \ | ||
88 | /s2/ss2 shark:/autofs/export2 | ||
89 | |||
90 | One of the issues with version 4 of autofs was that, when mounting an | ||
91 | entry with a large number of offsets, possibly with nesting, we needed | ||
92 | to mount and umount all of the offsets as a single unit. Not really a | ||
93 | problem, except for people with a large number of offsets in map entries. | ||
94 | This mechanism is used for the well known "hosts" map and we have seen | ||
95 | cases (in 2.4) where the available number of mounts are exhausted or | ||
96 | where the number of privileged ports available is exhausted. | ||
97 | |||
98 | In version 5 we mount only as we go down the tree of offsets and | ||
99 | similarly for expiring them which resolves the above problem. There is | ||
100 | somewhat more detail to the implementation but it isn't needed for the | ||
101 | sake of the problem explanation. The one important detail is that these | ||
102 | offsets are implemented using the same mechanism as the direct mounts | ||
103 | above and so the mount points can be covered by a mount. | ||
104 | |||
105 | The current autofs implementation uses an ioctl file descriptor opened | ||
106 | on the mount point for control operations. The references held by the | ||
107 | descriptor are accounted for in checks made to determine if a mount is | ||
108 | in use and is also used to access autofs file system information held | ||
109 | in the mount super block. So the use of a file handle needs to be | ||
110 | retained. | ||
111 | |||
112 | |||
113 | The Solution | ||
114 | ============ | ||
115 | |||
116 | To be able to restart autofs leaving existing direct, indirect and | ||
117 | offset mounts in place we need to be able to obtain a file handle | ||
118 | for these potentially covered autofs mount points. Rather than just | ||
119 | implement an isolated operation it was decided to re-implement the | ||
120 | existing ioctl interface and add new operations to provide this | ||
121 | functionality. | ||
122 | |||
123 | In addition, to be able to reconstruct a mount tree that has busy mounts, | ||
124 | the uid and gid of the last user that triggered the mount needs to be | ||
125 | available because these can be used as macro substitution variables in | ||
126 | autofs maps. They are recorded at mount request time and an operation | ||
127 | has been added to retrieve them. | ||
128 | |||
129 | Since we're re-implementing the control interface, a couple of other | ||
130 | problems with the existing interface have been addressed. First, when | ||
131 | a mount or expire operation completes a status is returned to the | ||
132 | kernel by either a "send ready" or a "send fail" operation. The | ||
133 | "send fail" operation of the ioctl interface could only ever send | ||
134 | ENOENT so the re-implementation allows user space to send an actual | ||
135 | status. Another expensive operation in user space, for those using | ||
136 | very large maps, is discovering if a mount is present. Usually this | ||
137 | involves scanning /proc/mounts and since it needs to be done quite | ||
138 | often it can introduce significant overhead when there are many entries | ||
139 | in the mount table. An operation to lookup the mount status of a mount | ||
140 | point dentry (covered or not) has also been added. | ||
141 | |||
142 | Current kernel development policy recommends avoiding the use of the | ||
143 | ioctl mechanism in favor of systems such as Netlink. An implementation | ||
144 | using this system was attempted to evaluate its suitability and it was | ||
145 | found to be inadequate, in this case. The Generic Netlink system was | ||
146 | used for this as raw Netlink would lead to a significant increase in | ||
147 | complexity. There's no question that the Generic Netlink system is an | ||
148 | elegant solution for common case ioctl functions but it's not a complete | ||
149 | replacement probably because it's primary purpose in life is to be a | ||
150 | message bus implementation rather than specifically an ioctl replacement. | ||
151 | While it would be possible to work around this there is one concern | ||
152 | that lead to the decision to not use it. This is that the autofs | ||
153 | expire in the daemon has become far to complex because umount | ||
154 | candidates are enumerated, almost for no other reason than to "count" | ||
155 | the number of times to call the expire ioctl. This involves scanning | ||
156 | the mount table which has proved to be a big overhead for users with | ||
157 | large maps. The best way to improve this is try and get back to the | ||
158 | way the expire was done long ago. That is, when an expire request is | ||
159 | issued for a mount (file handle) we should continually call back to | ||
160 | the daemon until we can't umount any more mounts, then return the | ||
161 | appropriate status to the daemon. At the moment we just expire one | ||
162 | mount at a time. A Generic Netlink implementation would exclude this | ||
163 | possibility for future development due to the requirements of the | ||
164 | message bus architecture. | ||
165 | |||
166 | |||
167 | autofs4 Miscellaneous Device mount control interface | ||
168 | ==================================================== | ||
169 | |||
170 | The control interface is opening a device node, typically /dev/autofs. | ||
171 | |||
172 | All the ioctls use a common structure to pass the needed parameter | ||
173 | information and return operation results: | ||
174 | |||
175 | struct autofs_dev_ioctl { | ||
176 | __u32 ver_major; | ||
177 | __u32 ver_minor; | ||
178 | __u32 size; /* total size of data passed in | ||
179 | * including this struct */ | ||
180 | __s32 ioctlfd; /* automount command fd */ | ||
181 | |||
182 | __u32 arg1; /* Command parameters */ | ||
183 | __u32 arg2; | ||
184 | |||
185 | char path[0]; | ||
186 | }; | ||
187 | |||
188 | The ioctlfd field is a mount point file descriptor of an autofs mount | ||
189 | point. It is returned by the open call and is used by all calls except | ||
190 | the check for whether a given path is a mount point, where it may | ||
191 | optionally be used to check a specific mount corresponding to a given | ||
192 | mount point file descriptor, and when requesting the uid and gid of the | ||
193 | last successful mount on a directory within the autofs file system. | ||
194 | |||
195 | The fields arg1 and arg2 are used to communicate parameters and results of | ||
196 | calls made as described below. | ||
197 | |||
198 | The path field is used to pass a path where it is needed and the size field | ||
199 | is used account for the increased structure length when translating the | ||
200 | structure sent from user space. | ||
201 | |||
202 | This structure can be initialized before setting specific fields by using | ||
203 | the void function call init_autofs_dev_ioctl(struct autofs_dev_ioctl *). | ||
204 | |||
205 | All of the ioctls perform a copy of this structure from user space to | ||
206 | kernel space and return -EINVAL if the size parameter is smaller than | ||
207 | the structure size itself, -ENOMEM if the kernel memory allocation fails | ||
208 | or -EFAULT if the copy itself fails. Other checks include a version check | ||
209 | of the compiled in user space version against the module version and a | ||
210 | mismatch results in a -EINVAL return. If the size field is greater than | ||
211 | the structure size then a path is assumed to be present and is checked to | ||
212 | ensure it begins with a "/" and is NULL terminated, otherwise -EINVAL is | ||
213 | returned. Following these checks, for all ioctl commands except | ||
214 | AUTOFS_DEV_IOCTL_VERSION_CMD, AUTOFS_DEV_IOCTL_OPENMOUNT_CMD and | ||
215 | AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD the ioctlfd is validated and if it is | ||
216 | not a valid descriptor or doesn't correspond to an autofs mount point | ||
217 | an error of -EBADF, -ENOTTY or -EINVAL (not an autofs descriptor) is | ||
218 | returned. | ||
219 | |||
220 | |||
221 | The ioctls | ||
222 | ========== | ||
223 | |||
224 | An example of an implementation which uses this interface can be seen | ||
225 | in autofs version 5.0.4 and later in file lib/dev-ioctl-lib.c of the | ||
226 | distribution tar available for download from kernel.org in directory | ||
227 | /pub/linux/daemons/autofs/v5. | ||
228 | |||
229 | The device node ioctl operations implemented by this interface are: | ||
230 | |||
231 | |||
232 | AUTOFS_DEV_IOCTL_VERSION | ||
233 | ------------------------ | ||
234 | |||
235 | Get the major and minor version of the autofs4 device ioctl kernel module | ||
236 | implementation. It requires an initialized struct autofs_dev_ioctl as an | ||
237 | input parameter and sets the version information in the passed in structure. | ||
238 | It returns 0 on success or the error -EINVAL if a version mismatch is | ||
239 | detected. | ||
240 | |||
241 | |||
242 | AUTOFS_DEV_IOCTL_PROTOVER_CMD and AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD | ||
243 | ------------------------------------------------------------------ | ||
244 | |||
245 | Get the major and minor version of the autofs4 protocol version understood | ||
246 | by loaded module. This call requires an initialized struct autofs_dev_ioctl | ||
247 | with the ioctlfd field set to a valid autofs mount point descriptor | ||
248 | and sets the requested version number in structure field arg1. These | ||
249 | commands return 0 on success or one of the negative error codes if | ||
250 | validation fails. | ||
251 | |||
252 | |||
253 | AUTOFS_DEV_IOCTL_OPENMOUNT and AUTOFS_DEV_IOCTL_CLOSEMOUNT | ||
254 | ---------------------------------------------------------- | ||
255 | |||
256 | Obtain and release a file descriptor for an autofs managed mount point | ||
257 | path. The open call requires an initialized struct autofs_dev_ioctl with | ||
258 | the the path field set and the size field adjusted appropriately as well | ||
259 | as the arg1 field set to the device number of the autofs mount. The | ||
260 | device number can be obtained from the mount options shown in | ||
261 | /proc/mounts. The close call requires an initialized struct | ||
262 | autofs_dev_ioct with the ioctlfd field set to the descriptor obtained | ||
263 | from the open call. The release of the file descriptor can also be done | ||
264 | with close(2) so any open descriptors will also be closed at process exit. | ||
265 | The close call is included in the implemented operations largely for | ||
266 | completeness and to provide for a consistent user space implementation. | ||
267 | |||
268 | |||
269 | AUTOFS_DEV_IOCTL_READY_CMD and AUTOFS_DEV_IOCTL_FAIL_CMD | ||
270 | -------------------------------------------------------- | ||
271 | |||
272 | Return mount and expire result status from user space to the kernel. | ||
273 | Both of these calls require an initialized struct autofs_dev_ioctl | ||
274 | with the ioctlfd field set to the descriptor obtained from the open | ||
275 | call and the arg1 field set to the wait queue token number, received | ||
276 | by user space in the foregoing mount or expire request. The arg2 field | ||
277 | is set to the status to be returned. For the ready call this is always | ||
278 | 0 and for the fail call it is set to the errno of the operation. | ||
279 | |||
280 | |||
281 | AUTOFS_DEV_IOCTL_SETPIPEFD_CMD | ||
282 | ------------------------------ | ||
283 | |||
284 | Set the pipe file descriptor used for kernel communication to the daemon. | ||
285 | Normally this is set at mount time using an option but when reconnecting | ||
286 | to a existing mount we need to use this to tell the autofs mount about | ||
287 | the new kernel pipe descriptor. In order to protect mounts against | ||
288 | incorrectly setting the pipe descriptor we also require that the autofs | ||
289 | mount be catatonic (see next call). | ||
290 | |||
291 | The call requires an initialized struct autofs_dev_ioctl with the | ||
292 | ioctlfd field set to the descriptor obtained from the open call and | ||
293 | the arg1 field set to descriptor of the pipe. On success the call | ||
294 | also sets the process group id used to identify the controlling process | ||
295 | (eg. the owning automount(8) daemon) to the process group of the caller. | ||
296 | |||
297 | |||
298 | AUTOFS_DEV_IOCTL_CATATONIC_CMD | ||
299 | ------------------------------ | ||
300 | |||
301 | Make the autofs mount point catatonic. The autofs mount will no longer | ||
302 | issue mount requests, the kernel communication pipe descriptor is released | ||
303 | and any remaining waits in the queue released. | ||
304 | |||
305 | The call requires an initialized struct autofs_dev_ioctl with the | ||
306 | ioctlfd field set to the descriptor obtained from the open call. | ||
307 | |||
308 | |||
309 | AUTOFS_DEV_IOCTL_TIMEOUT_CMD | ||
310 | ---------------------------- | ||
311 | |||
312 | Set the expire timeout for mounts withing an autofs mount point. | ||
313 | |||
314 | The call requires an initialized struct autofs_dev_ioctl with the | ||
315 | ioctlfd field set to the descriptor obtained from the open call. | ||
316 | |||
317 | |||
318 | AUTOFS_DEV_IOCTL_REQUESTER_CMD | ||
319 | ------------------------------ | ||
320 | |||
321 | Return the uid and gid of the last process to successfully trigger a the | ||
322 | mount on the given path dentry. | ||
323 | |||
324 | The call requires an initialized struct autofs_dev_ioctl with the path | ||
325 | field set to the mount point in question and the size field adjusted | ||
326 | appropriately as well as the arg1 field set to the device number of the | ||
327 | containing autofs mount. Upon return the struct field arg1 contains the | ||
328 | uid and arg2 the gid. | ||
329 | |||
330 | When reconstructing an autofs mount tree with active mounts we need to | ||
331 | re-connect to mounts that may have used the original process uid and | ||
332 | gid (or string variations of them) for mount lookups within the map entry. | ||
333 | This call provides the ability to obtain this uid and gid so they may be | ||
334 | used by user space for the mount map lookups. | ||
335 | |||
336 | |||
337 | AUTOFS_DEV_IOCTL_EXPIRE_CMD | ||
338 | --------------------------- | ||
339 | |||
340 | Issue an expire request to the kernel for an autofs mount. Typically | ||
341 | this ioctl is called until no further expire candidates are found. | ||
342 | |||
343 | The call requires an initialized struct autofs_dev_ioctl with the | ||
344 | ioctlfd field set to the descriptor obtained from the open call. In | ||
345 | addition an immediate expire, independent of the mount timeout, can be | ||
346 | requested by setting the arg1 field to 1. If no expire candidates can | ||
347 | be found the ioctl returns -1 with errno set to EAGAIN. | ||
348 | |||
349 | This call causes the kernel module to check the mount corresponding | ||
350 | to the given ioctlfd for mounts that can be expired, issues an expire | ||
351 | request back to the daemon and waits for completion. | ||
352 | |||
353 | AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD | ||
354 | ------------------------------ | ||
355 | |||
356 | Checks if an autofs mount point is in use. | ||
357 | |||
358 | The call requires an initialized struct autofs_dev_ioctl with the | ||
359 | ioctlfd field set to the descriptor obtained from the open call and | ||
360 | it returns the result in the arg1 field, 1 for busy and 0 otherwise. | ||
361 | |||
362 | |||
363 | AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD | ||
364 | --------------------------------- | ||
365 | |||
366 | Check if the given path is a mountpoint. | ||
367 | |||
368 | The call requires an initialized struct autofs_dev_ioctl. There are two | ||
369 | possible variations. Both use the path field set to the path of the mount | ||
370 | point to check and the size field adjusted appropriately. One uses the | ||
371 | ioctlfd field to identify a specific mount point to check while the other | ||
372 | variation uses the path and optionaly arg1 set to an autofs mount type. | ||
373 | The call returns 1 if this is a mount point and sets arg1 to the device | ||
374 | number of the mount and field arg2 to the relevant super block magic | ||
375 | number (described below) or 0 if it isn't a mountpoint. In both cases | ||
376 | the the device number (as returned by new_encode_dev()) is returned | ||
377 | in field arg1. | ||
378 | |||
379 | If supplied with a file descriptor we're looking for a specific mount, | ||
380 | not necessarily at the top of the mounted stack. In this case the path | ||
381 | the descriptor corresponds to is considered a mountpoint if it is itself | ||
382 | a mountpoint or contains a mount, such as a multi-mount without a root | ||
383 | mount. In this case we return 1 if the descriptor corresponds to a mount | ||
384 | point and and also returns the super magic of the covering mount if there | ||
385 | is one or 0 if it isn't a mountpoint. | ||
386 | |||
387 | If a path is supplied (and the ioctlfd field is set to -1) then the path | ||
388 | is looked up and is checked to see if it is the root of a mount. If a | ||
389 | type is also given we are looking for a particular autofs mount and if | ||
390 | a match isn't found a fail is returned. If the the located path is the | ||
391 | root of a mount 1 is returned along with the super magic of the mount | ||
392 | or 0 otherwise. | ||
393 | |||
diff --git a/Documentation/filesystems/bfs.txt b/Documentation/filesystems/bfs.txt index ea825e178e79..78043d5a8fc3 100644 --- a/Documentation/filesystems/bfs.txt +++ b/Documentation/filesystems/bfs.txt | |||
@@ -26,11 +26,11 @@ You can simplify mounting by just typing: | |||
26 | 26 | ||
27 | this will allocate the first available loopback device (and load loop.o | 27 | this will allocate the first available loopback device (and load loop.o |
28 | kernel module if necessary) automatically. If the loopback driver is not | 28 | kernel module if necessary) automatically. If the loopback driver is not |
29 | loaded automatically, make sure that your kernel is compiled with kmod | 29 | loaded automatically, make sure that you have compiled the module and |
30 | support (CONFIG_KMOD) enabled. Beware that umount will not | 30 | that modprobe is functioning. Beware that umount will not deallocate |
31 | deallocate /dev/loopN device if /etc/mtab file on your system is a | 31 | /dev/loopN device if /etc/mtab file on your system is a symbolic link to |
32 | symbolic link to /proc/mounts. You will need to do it manually using | 32 | /proc/mounts. You will need to do it manually using "-d" switch of |
33 | "-d" switch of losetup(8). Read losetup(8) manpage for more info. | 33 | losetup(8). Read losetup(8) manpage for more info. |
34 | 34 | ||
35 | To create the BFS image under UnixWare you need to find out first which | 35 | To create the BFS image under UnixWare you need to find out first which |
36 | slice contains it. The command prtvtoc(1M) is your friend: | 36 | slice contains it. The command prtvtoc(1M) is your friend: |
diff --git a/Documentation/filesystems/configfs/Makefile b/Documentation/filesystems/configfs/Makefile new file mode 100644 index 000000000000..be7ec5e67dbc --- /dev/null +++ b/Documentation/filesystems/configfs/Makefile | |||
@@ -0,0 +1,3 @@ | |||
1 | ifneq ($(CONFIG_CONFIGFS_FS),) | ||
2 | obj-m += configfs_example_explicit.o configfs_example_macros.o | ||
3 | endif | ||
diff --git a/Documentation/filesystems/configfs/configfs.txt b/Documentation/filesystems/configfs/configfs.txt index 15838d706ea2..fabcb0e00f25 100644 --- a/Documentation/filesystems/configfs/configfs.txt +++ b/Documentation/filesystems/configfs/configfs.txt | |||
@@ -233,12 +233,10 @@ accomplished via the group operations specified on the group's | |||
233 | config_item_type. | 233 | config_item_type. |
234 | 234 | ||
235 | struct configfs_group_operations { | 235 | struct configfs_group_operations { |
236 | int (*make_item)(struct config_group *group, | 236 | struct config_item *(*make_item)(struct config_group *group, |
237 | const char *name, | 237 | const char *name); |
238 | struct config_item **new_item); | 238 | struct config_group *(*make_group)(struct config_group *group, |
239 | int (*make_group)(struct config_group *group, | 239 | const char *name); |
240 | const char *name, | ||
241 | struct config_group **new_group); | ||
242 | int (*commit_item)(struct config_item *item); | 240 | int (*commit_item)(struct config_item *item); |
243 | void (*disconnect_notify)(struct config_group *group, | 241 | void (*disconnect_notify)(struct config_group *group, |
244 | struct config_item *item); | 242 | struct config_item *item); |
@@ -313,9 +311,20 @@ the subsystem must be ready for it. | |||
313 | [An Example] | 311 | [An Example] |
314 | 312 | ||
315 | The best example of these basic concepts is the simple_children | 313 | The best example of these basic concepts is the simple_children |
316 | subsystem/group and the simple_child item in configfs_example.c It | 314 | subsystem/group and the simple_child item in configfs_example_explicit.c |
317 | shows a trivial object displaying and storing an attribute, and a simple | 315 | and configfs_example_macros.c. It shows a trivial object displaying and |
318 | group creating and destroying these children. | 316 | storing an attribute, and a simple group creating and destroying these |
317 | children. | ||
318 | |||
319 | The only difference between configfs_example_explicit.c and | ||
320 | configfs_example_macros.c is how the attributes of the childless item | ||
321 | are defined. The childless item has extended attributes, each with | ||
322 | their own show()/store() operation. This follows a convention commonly | ||
323 | used in sysfs. configfs_example_explicit.c creates these attributes | ||
324 | by explicitly defining the structures involved. Conversely | ||
325 | configfs_example_macros.c uses some convenience macros from configfs.h | ||
326 | to define the attributes. These macros are similar to their sysfs | ||
327 | counterparts. | ||
319 | 328 | ||
320 | [Hierarchy Navigation and the Subsystem Mutex] | 329 | [Hierarchy Navigation and the Subsystem Mutex] |
321 | 330 | ||
diff --git a/Documentation/filesystems/configfs/configfs_example.c b/Documentation/filesystems/configfs/configfs_example_explicit.c index 0b422acd470c..d428cc9f07f3 100644 --- a/Documentation/filesystems/configfs/configfs_example.c +++ b/Documentation/filesystems/configfs/configfs_example_explicit.c | |||
@@ -1,8 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | * vim: noexpandtab ts=8 sts=0 sw=8: | 2 | * vim: noexpandtab ts=8 sts=0 sw=8: |
3 | * | 3 | * |
4 | * configfs_example.c - This file is a demonstration module containing | 4 | * configfs_example_explicit.c - This file is a demonstration module |
5 | * a number of configfs subsystems. | 5 | * containing a number of configfs subsystems. It explicitly defines |
6 | * each structure without using the helper macros defined in | ||
7 | * configfs.h. | ||
6 | * | 8 | * |
7 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU General Public | 10 | * modify it under the terms of the GNU General Public |
@@ -273,22 +275,20 @@ static inline struct simple_children *to_simple_children(struct config_item *ite | |||
273 | return item ? container_of(to_config_group(item), struct simple_children, group) : NULL; | 275 | return item ? container_of(to_config_group(item), struct simple_children, group) : NULL; |
274 | } | 276 | } |
275 | 277 | ||
276 | static int simple_children_make_item(struct config_group *group, const char *name, struct config_item **new_item) | 278 | static struct config_item *simple_children_make_item(struct config_group *group, const char *name) |
277 | { | 279 | { |
278 | struct simple_child *simple_child; | 280 | struct simple_child *simple_child; |
279 | 281 | ||
280 | simple_child = kzalloc(sizeof(struct simple_child), GFP_KERNEL); | 282 | simple_child = kzalloc(sizeof(struct simple_child), GFP_KERNEL); |
281 | if (!simple_child) | 283 | if (!simple_child) |
282 | return -ENOMEM; | 284 | return ERR_PTR(-ENOMEM); |
283 | |||
284 | 285 | ||
285 | config_item_init_type_name(&simple_child->item, name, | 286 | config_item_init_type_name(&simple_child->item, name, |
286 | &simple_child_type); | 287 | &simple_child_type); |
287 | 288 | ||
288 | simple_child->storeme = 0; | 289 | simple_child->storeme = 0; |
289 | 290 | ||
290 | *new_item = &simple_child->item; | 291 | return &simple_child->item; |
291 | return 0; | ||
292 | } | 292 | } |
293 | 293 | ||
294 | static struct configfs_attribute simple_children_attr_description = { | 294 | static struct configfs_attribute simple_children_attr_description = { |
@@ -303,8 +303,8 @@ static struct configfs_attribute *simple_children_attrs[] = { | |||
303 | }; | 303 | }; |
304 | 304 | ||
305 | static ssize_t simple_children_attr_show(struct config_item *item, | 305 | static ssize_t simple_children_attr_show(struct config_item *item, |
306 | struct configfs_attribute *attr, | 306 | struct configfs_attribute *attr, |
307 | char *page) | 307 | char *page) |
308 | { | 308 | { |
309 | return sprintf(page, | 309 | return sprintf(page, |
310 | "[02-simple-children]\n" | 310 | "[02-simple-children]\n" |
@@ -319,7 +319,7 @@ static void simple_children_release(struct config_item *item) | |||
319 | } | 319 | } |
320 | 320 | ||
321 | static struct configfs_item_operations simple_children_item_ops = { | 321 | static struct configfs_item_operations simple_children_item_ops = { |
322 | .release = simple_children_release, | 322 | .release = simple_children_release, |
323 | .show_attribute = simple_children_attr_show, | 323 | .show_attribute = simple_children_attr_show, |
324 | }; | 324 | }; |
325 | 325 | ||
@@ -360,21 +360,19 @@ static struct configfs_subsystem simple_children_subsys = { | |||
360 | * children of its own. | 360 | * children of its own. |
361 | */ | 361 | */ |
362 | 362 | ||
363 | static int group_children_make_group(struct config_group *group, const char *name, struct config_group **new_group) | 363 | static struct config_group *group_children_make_group(struct config_group *group, const char *name) |
364 | { | 364 | { |
365 | struct simple_children *simple_children; | 365 | struct simple_children *simple_children; |
366 | 366 | ||
367 | simple_children = kzalloc(sizeof(struct simple_children), | 367 | simple_children = kzalloc(sizeof(struct simple_children), |
368 | GFP_KERNEL); | 368 | GFP_KERNEL); |
369 | if (!simple_children) | 369 | if (!simple_children) |
370 | return -ENOMEM; | 370 | return ERR_PTR(-ENOMEM); |
371 | |||
372 | 371 | ||
373 | config_group_init_type_name(&simple_children->group, name, | 372 | config_group_init_type_name(&simple_children->group, name, |
374 | &simple_children_type); | 373 | &simple_children_type); |
375 | 374 | ||
376 | *new_group = &simple_children->group; | 375 | return &simple_children->group; |
377 | return 0; | ||
378 | } | 376 | } |
379 | 377 | ||
380 | static struct configfs_attribute group_children_attr_description = { | 378 | static struct configfs_attribute group_children_attr_description = { |
@@ -389,8 +387,8 @@ static struct configfs_attribute *group_children_attrs[] = { | |||
389 | }; | 387 | }; |
390 | 388 | ||
391 | static ssize_t group_children_attr_show(struct config_item *item, | 389 | static ssize_t group_children_attr_show(struct config_item *item, |
392 | struct configfs_attribute *attr, | 390 | struct configfs_attribute *attr, |
393 | char *page) | 391 | char *page) |
394 | { | 392 | { |
395 | return sprintf(page, | 393 | return sprintf(page, |
396 | "[03-group-children]\n" | 394 | "[03-group-children]\n" |
diff --git a/Documentation/filesystems/configfs/configfs_example_macros.c b/Documentation/filesystems/configfs/configfs_example_macros.c new file mode 100644 index 000000000000..d8e30a0378aa --- /dev/null +++ b/Documentation/filesystems/configfs/configfs_example_macros.c | |||
@@ -0,0 +1,448 @@ | |||
1 | /* | ||
2 | * vim: noexpandtab ts=8 sts=0 sw=8: | ||
3 | * | ||
4 | * configfs_example_macros.c - This file is a demonstration module | ||
5 | * containing a number of configfs subsystems. It uses the helper | ||
6 | * macros defined by configfs.h | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public | ||
10 | * License as published by the Free Software Foundation; either | ||
11 | * version 2 of the License, or (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public | ||
19 | * License along with this program; if not, write to the | ||
20 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
21 | * Boston, MA 021110-1307, USA. | ||
22 | * | ||
23 | * Based on sysfs: | ||
24 | * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel | ||
25 | * | ||
26 | * configfs Copyright (C) 2005 Oracle. All rights reserved. | ||
27 | */ | ||
28 | |||
29 | #include <linux/init.h> | ||
30 | #include <linux/module.h> | ||
31 | #include <linux/slab.h> | ||
32 | |||
33 | #include <linux/configfs.h> | ||
34 | |||
35 | |||
36 | |||
37 | /* | ||
38 | * 01-childless | ||
39 | * | ||
40 | * This first example is a childless subsystem. It cannot create | ||
41 | * any config_items. It just has attributes. | ||
42 | * | ||
43 | * Note that we are enclosing the configfs_subsystem inside a container. | ||
44 | * This is not necessary if a subsystem has no attributes directly | ||
45 | * on the subsystem. See the next example, 02-simple-children, for | ||
46 | * such a subsystem. | ||
47 | */ | ||
48 | |||
49 | struct childless { | ||
50 | struct configfs_subsystem subsys; | ||
51 | int showme; | ||
52 | int storeme; | ||
53 | }; | ||
54 | |||
55 | static inline struct childless *to_childless(struct config_item *item) | ||
56 | { | ||
57 | return item ? container_of(to_configfs_subsystem(to_config_group(item)), struct childless, subsys) : NULL; | ||
58 | } | ||
59 | |||
60 | CONFIGFS_ATTR_STRUCT(childless); | ||
61 | #define CHILDLESS_ATTR(_name, _mode, _show, _store) \ | ||
62 | struct childless_attribute childless_attr_##_name = __CONFIGFS_ATTR(_name, _mode, _show, _store) | ||
63 | #define CHILDLESS_ATTR_RO(_name, _show) \ | ||
64 | struct childless_attribute childless_attr_##_name = __CONFIGFS_ATTR_RO(_name, _show); | ||
65 | |||
66 | static ssize_t childless_showme_read(struct childless *childless, | ||
67 | char *page) | ||
68 | { | ||
69 | ssize_t pos; | ||
70 | |||
71 | pos = sprintf(page, "%d\n", childless->showme); | ||
72 | childless->showme++; | ||
73 | |||
74 | return pos; | ||
75 | } | ||
76 | |||
77 | static ssize_t childless_storeme_read(struct childless *childless, | ||
78 | char *page) | ||
79 | { | ||
80 | return sprintf(page, "%d\n", childless->storeme); | ||
81 | } | ||
82 | |||
83 | static ssize_t childless_storeme_write(struct childless *childless, | ||
84 | const char *page, | ||
85 | size_t count) | ||
86 | { | ||
87 | unsigned long tmp; | ||
88 | char *p = (char *) page; | ||
89 | |||
90 | tmp = simple_strtoul(p, &p, 10); | ||
91 | if (!p || (*p && (*p != '\n'))) | ||
92 | return -EINVAL; | ||
93 | |||
94 | if (tmp > INT_MAX) | ||
95 | return -ERANGE; | ||
96 | |||
97 | childless->storeme = tmp; | ||
98 | |||
99 | return count; | ||
100 | } | ||
101 | |||
102 | static ssize_t childless_description_read(struct childless *childless, | ||
103 | char *page) | ||
104 | { | ||
105 | return sprintf(page, | ||
106 | "[01-childless]\n" | ||
107 | "\n" | ||
108 | "The childless subsystem is the simplest possible subsystem in\n" | ||
109 | "configfs. It does not support the creation of child config_items.\n" | ||
110 | "It only has a few attributes. In fact, it isn't much different\n" | ||
111 | "than a directory in /proc.\n"); | ||
112 | } | ||
113 | |||
114 | CHILDLESS_ATTR_RO(showme, childless_showme_read); | ||
115 | CHILDLESS_ATTR(storeme, S_IRUGO | S_IWUSR, childless_storeme_read, | ||
116 | childless_storeme_write); | ||
117 | CHILDLESS_ATTR_RO(description, childless_description_read); | ||
118 | |||
119 | static struct configfs_attribute *childless_attrs[] = { | ||
120 | &childless_attr_showme.attr, | ||
121 | &childless_attr_storeme.attr, | ||
122 | &childless_attr_description.attr, | ||
123 | NULL, | ||
124 | }; | ||
125 | |||
126 | CONFIGFS_ATTR_OPS(childless); | ||
127 | static struct configfs_item_operations childless_item_ops = { | ||
128 | .show_attribute = childless_attr_show, | ||
129 | .store_attribute = childless_attr_store, | ||
130 | }; | ||
131 | |||
132 | static struct config_item_type childless_type = { | ||
133 | .ct_item_ops = &childless_item_ops, | ||
134 | .ct_attrs = childless_attrs, | ||
135 | .ct_owner = THIS_MODULE, | ||
136 | }; | ||
137 | |||
138 | static struct childless childless_subsys = { | ||
139 | .subsys = { | ||
140 | .su_group = { | ||
141 | .cg_item = { | ||
142 | .ci_namebuf = "01-childless", | ||
143 | .ci_type = &childless_type, | ||
144 | }, | ||
145 | }, | ||
146 | }, | ||
147 | }; | ||
148 | |||
149 | |||
150 | /* ----------------------------------------------------------------- */ | ||
151 | |||
152 | /* | ||
153 | * 02-simple-children | ||
154 | * | ||
155 | * This example merely has a simple one-attribute child. Note that | ||
156 | * there is no extra attribute structure, as the child's attribute is | ||
157 | * known from the get-go. Also, there is no container for the | ||
158 | * subsystem, as it has no attributes of its own. | ||
159 | */ | ||
160 | |||
161 | struct simple_child { | ||
162 | struct config_item item; | ||
163 | int storeme; | ||
164 | }; | ||
165 | |||
166 | static inline struct simple_child *to_simple_child(struct config_item *item) | ||
167 | { | ||
168 | return item ? container_of(item, struct simple_child, item) : NULL; | ||
169 | } | ||
170 | |||
171 | static struct configfs_attribute simple_child_attr_storeme = { | ||
172 | .ca_owner = THIS_MODULE, | ||
173 | .ca_name = "storeme", | ||
174 | .ca_mode = S_IRUGO | S_IWUSR, | ||
175 | }; | ||
176 | |||
177 | static struct configfs_attribute *simple_child_attrs[] = { | ||
178 | &simple_child_attr_storeme, | ||
179 | NULL, | ||
180 | }; | ||
181 | |||
182 | static ssize_t simple_child_attr_show(struct config_item *item, | ||
183 | struct configfs_attribute *attr, | ||
184 | char *page) | ||
185 | { | ||
186 | ssize_t count; | ||
187 | struct simple_child *simple_child = to_simple_child(item); | ||
188 | |||
189 | count = sprintf(page, "%d\n", simple_child->storeme); | ||
190 | |||
191 | return count; | ||
192 | } | ||
193 | |||
194 | static ssize_t simple_child_attr_store(struct config_item *item, | ||
195 | struct configfs_attribute *attr, | ||
196 | const char *page, size_t count) | ||
197 | { | ||
198 | struct simple_child *simple_child = to_simple_child(item); | ||
199 | unsigned long tmp; | ||
200 | char *p = (char *) page; | ||
201 | |||
202 | tmp = simple_strtoul(p, &p, 10); | ||
203 | if (!p || (*p && (*p != '\n'))) | ||
204 | return -EINVAL; | ||
205 | |||
206 | if (tmp > INT_MAX) | ||
207 | return -ERANGE; | ||
208 | |||
209 | simple_child->storeme = tmp; | ||
210 | |||
211 | return count; | ||
212 | } | ||
213 | |||
214 | static void simple_child_release(struct config_item *item) | ||
215 | { | ||
216 | kfree(to_simple_child(item)); | ||
217 | } | ||
218 | |||
219 | static struct configfs_item_operations simple_child_item_ops = { | ||
220 | .release = simple_child_release, | ||
221 | .show_attribute = simple_child_attr_show, | ||
222 | .store_attribute = simple_child_attr_store, | ||
223 | }; | ||
224 | |||
225 | static struct config_item_type simple_child_type = { | ||
226 | .ct_item_ops = &simple_child_item_ops, | ||
227 | .ct_attrs = simple_child_attrs, | ||
228 | .ct_owner = THIS_MODULE, | ||
229 | }; | ||
230 | |||
231 | |||
232 | struct simple_children { | ||
233 | struct config_group group; | ||
234 | }; | ||
235 | |||
236 | static inline struct simple_children *to_simple_children(struct config_item *item) | ||
237 | { | ||
238 | return item ? container_of(to_config_group(item), struct simple_children, group) : NULL; | ||
239 | } | ||
240 | |||
241 | static struct config_item *simple_children_make_item(struct config_group *group, const char *name) | ||
242 | { | ||
243 | struct simple_child *simple_child; | ||
244 | |||
245 | simple_child = kzalloc(sizeof(struct simple_child), GFP_KERNEL); | ||
246 | if (!simple_child) | ||
247 | return ERR_PTR(-ENOMEM); | ||
248 | |||
249 | config_item_init_type_name(&simple_child->item, name, | ||
250 | &simple_child_type); | ||
251 | |||
252 | simple_child->storeme = 0; | ||
253 | |||
254 | return &simple_child->item; | ||
255 | } | ||
256 | |||
257 | static struct configfs_attribute simple_children_attr_description = { | ||
258 | .ca_owner = THIS_MODULE, | ||
259 | .ca_name = "description", | ||
260 | .ca_mode = S_IRUGO, | ||
261 | }; | ||
262 | |||
263 | static struct configfs_attribute *simple_children_attrs[] = { | ||
264 | &simple_children_attr_description, | ||
265 | NULL, | ||
266 | }; | ||
267 | |||
268 | static ssize_t simple_children_attr_show(struct config_item *item, | ||
269 | struct configfs_attribute *attr, | ||
270 | char *page) | ||
271 | { | ||
272 | return sprintf(page, | ||
273 | "[02-simple-children]\n" | ||
274 | "\n" | ||
275 | "This subsystem allows the creation of child config_items. These\n" | ||
276 | "items have only one attribute that is readable and writeable.\n"); | ||
277 | } | ||
278 | |||
279 | static void simple_children_release(struct config_item *item) | ||
280 | { | ||
281 | kfree(to_simple_children(item)); | ||
282 | } | ||
283 | |||
284 | static struct configfs_item_operations simple_children_item_ops = { | ||
285 | .release = simple_children_release, | ||
286 | .show_attribute = simple_children_attr_show, | ||
287 | }; | ||
288 | |||
289 | /* | ||
290 | * Note that, since no extra work is required on ->drop_item(), | ||
291 | * no ->drop_item() is provided. | ||
292 | */ | ||
293 | static struct configfs_group_operations simple_children_group_ops = { | ||
294 | .make_item = simple_children_make_item, | ||
295 | }; | ||
296 | |||
297 | static struct config_item_type simple_children_type = { | ||
298 | .ct_item_ops = &simple_children_item_ops, | ||
299 | .ct_group_ops = &simple_children_group_ops, | ||
300 | .ct_attrs = simple_children_attrs, | ||
301 | .ct_owner = THIS_MODULE, | ||
302 | }; | ||
303 | |||
304 | static struct configfs_subsystem simple_children_subsys = { | ||
305 | .su_group = { | ||
306 | .cg_item = { | ||
307 | .ci_namebuf = "02-simple-children", | ||
308 | .ci_type = &simple_children_type, | ||
309 | }, | ||
310 | }, | ||
311 | }; | ||
312 | |||
313 | |||
314 | /* ----------------------------------------------------------------- */ | ||
315 | |||
316 | /* | ||
317 | * 03-group-children | ||
318 | * | ||
319 | * This example reuses the simple_children group from above. However, | ||
320 | * the simple_children group is not the subsystem itself, it is a | ||
321 | * child of the subsystem. Creation of a group in the subsystem creates | ||
322 | * a new simple_children group. That group can then have simple_child | ||
323 | * children of its own. | ||
324 | */ | ||
325 | |||
326 | static struct config_group *group_children_make_group(struct config_group *group, const char *name) | ||
327 | { | ||
328 | struct simple_children *simple_children; | ||
329 | |||
330 | simple_children = kzalloc(sizeof(struct simple_children), | ||
331 | GFP_KERNEL); | ||
332 | if (!simple_children) | ||
333 | return ERR_PTR(-ENOMEM); | ||
334 | |||
335 | config_group_init_type_name(&simple_children->group, name, | ||
336 | &simple_children_type); | ||
337 | |||
338 | return &simple_children->group; | ||
339 | } | ||
340 | |||
341 | static struct configfs_attribute group_children_attr_description = { | ||
342 | .ca_owner = THIS_MODULE, | ||
343 | .ca_name = "description", | ||
344 | .ca_mode = S_IRUGO, | ||
345 | }; | ||
346 | |||
347 | static struct configfs_attribute *group_children_attrs[] = { | ||
348 | &group_children_attr_description, | ||
349 | NULL, | ||
350 | }; | ||
351 | |||
352 | static ssize_t group_children_attr_show(struct config_item *item, | ||
353 | struct configfs_attribute *attr, | ||
354 | char *page) | ||
355 | { | ||
356 | return sprintf(page, | ||
357 | "[03-group-children]\n" | ||
358 | "\n" | ||
359 | "This subsystem allows the creation of child config_groups. These\n" | ||
360 | "groups are like the subsystem simple-children.\n"); | ||
361 | } | ||
362 | |||
363 | static struct configfs_item_operations group_children_item_ops = { | ||
364 | .show_attribute = group_children_attr_show, | ||
365 | }; | ||
366 | |||
367 | /* | ||
368 | * Note that, since no extra work is required on ->drop_item(), | ||
369 | * no ->drop_item() is provided. | ||
370 | */ | ||
371 | static struct configfs_group_operations group_children_group_ops = { | ||
372 | .make_group = group_children_make_group, | ||
373 | }; | ||
374 | |||
375 | static struct config_item_type group_children_type = { | ||
376 | .ct_item_ops = &group_children_item_ops, | ||
377 | .ct_group_ops = &group_children_group_ops, | ||
378 | .ct_attrs = group_children_attrs, | ||
379 | .ct_owner = THIS_MODULE, | ||
380 | }; | ||
381 | |||
382 | static struct configfs_subsystem group_children_subsys = { | ||
383 | .su_group = { | ||
384 | .cg_item = { | ||
385 | .ci_namebuf = "03-group-children", | ||
386 | .ci_type = &group_children_type, | ||
387 | }, | ||
388 | }, | ||
389 | }; | ||
390 | |||
391 | /* ----------------------------------------------------------------- */ | ||
392 | |||
393 | /* | ||
394 | * We're now done with our subsystem definitions. | ||
395 | * For convenience in this module, here's a list of them all. It | ||
396 | * allows the init function to easily register them. Most modules | ||
397 | * will only have one subsystem, and will only call register_subsystem | ||
398 | * on it directly. | ||
399 | */ | ||
400 | static struct configfs_subsystem *example_subsys[] = { | ||
401 | &childless_subsys.subsys, | ||
402 | &simple_children_subsys, | ||
403 | &group_children_subsys, | ||
404 | NULL, | ||
405 | }; | ||
406 | |||
407 | static int __init configfs_example_init(void) | ||
408 | { | ||
409 | int ret; | ||
410 | int i; | ||
411 | struct configfs_subsystem *subsys; | ||
412 | |||
413 | for (i = 0; example_subsys[i]; i++) { | ||
414 | subsys = example_subsys[i]; | ||
415 | |||
416 | config_group_init(&subsys->su_group); | ||
417 | mutex_init(&subsys->su_mutex); | ||
418 | ret = configfs_register_subsystem(subsys); | ||
419 | if (ret) { | ||
420 | printk(KERN_ERR "Error %d while registering subsystem %s\n", | ||
421 | ret, | ||
422 | subsys->su_group.cg_item.ci_namebuf); | ||
423 | goto out_unregister; | ||
424 | } | ||
425 | } | ||
426 | |||
427 | return 0; | ||
428 | |||
429 | out_unregister: | ||
430 | for (; i >= 0; i--) { | ||
431 | configfs_unregister_subsystem(example_subsys[i]); | ||
432 | } | ||
433 | |||
434 | return ret; | ||
435 | } | ||
436 | |||
437 | static void __exit configfs_example_exit(void) | ||
438 | { | ||
439 | int i; | ||
440 | |||
441 | for (i = 0; example_subsys[i]; i++) { | ||
442 | configfs_unregister_subsystem(example_subsys[i]); | ||
443 | } | ||
444 | } | ||
445 | |||
446 | module_init(configfs_example_init); | ||
447 | module_exit(configfs_example_exit); | ||
448 | MODULE_LICENSE("GPL"); | ||
diff --git a/Documentation/filesystems/ext3.txt b/Documentation/filesystems/ext3.txt index b45f3c1b8b43..9dd2a3bb2acc 100644 --- a/Documentation/filesystems/ext3.txt +++ b/Documentation/filesystems/ext3.txt | |||
@@ -96,6 +96,11 @@ errors=remount-ro(*) Remount the filesystem read-only on an error. | |||
96 | errors=continue Keep going on a filesystem error. | 96 | errors=continue Keep going on a filesystem error. |
97 | errors=panic Panic and halt the machine if an error occurs. | 97 | errors=panic Panic and halt the machine if an error occurs. |
98 | 98 | ||
99 | data_err=ignore(*) Just print an error message if an error occurs | ||
100 | in a file data buffer in ordered mode. | ||
101 | data_err=abort Abort the journal if an error occurs in a file | ||
102 | data buffer in ordered mode. | ||
103 | |||
99 | grpid Give objects the same group ID as their creator. | 104 | grpid Give objects the same group ID as their creator. |
100 | bsdgroups | 105 | bsdgroups |
101 | 106 | ||
@@ -193,6 +198,5 @@ kernel source: <file:fs/ext3/> | |||
193 | programs: http://e2fsprogs.sourceforge.net/ | 198 | programs: http://e2fsprogs.sourceforge.net/ |
194 | http://ext2resize.sourceforge.net | 199 | http://ext2resize.sourceforge.net |
195 | 200 | ||
196 | useful links: http://www.zip.com.au/~akpm/linux/ext3/ext3-usage.html | 201 | useful links: http://www-106.ibm.com/developerworks/linux/library/l-fs7/ |
197 | http://www-106.ibm.com/developerworks/linux/library/l-fs7/ | ||
198 | http://www-106.ibm.com/developerworks/linux/library/l-fs8/ | 202 | http://www-106.ibm.com/developerworks/linux/library/l-fs8/ |
diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt index 80e193d82e2e..174eaff7ded9 100644 --- a/Documentation/filesystems/ext4.txt +++ b/Documentation/filesystems/ext4.txt | |||
@@ -2,19 +2,24 @@ | |||
2 | Ext4 Filesystem | 2 | Ext4 Filesystem |
3 | =============== | 3 | =============== |
4 | 4 | ||
5 | This is a development version of the ext4 filesystem, an advanced level | 5 | Ext4 is an an advanced level of the ext3 filesystem which incorporates |
6 | of the ext3 filesystem which incorporates scalability and reliability | 6 | scalability and reliability enhancements for supporting large filesystems |
7 | enhancements for supporting large filesystems (64 bit) in keeping with | 7 | (64 bit) in keeping with increasing disk capacities and state-of-the-art |
8 | increasing disk capacities and state-of-the-art feature requirements. | 8 | feature requirements. |
9 | 9 | ||
10 | Mailing list: linux-ext4@vger.kernel.org | 10 | Mailing list: linux-ext4@vger.kernel.org |
11 | Web site: http://ext4.wiki.kernel.org | ||
11 | 12 | ||
12 | 13 | ||
13 | 1. Quick usage instructions: | 14 | 1. Quick usage instructions: |
14 | =========================== | 15 | =========================== |
15 | 16 | ||
17 | Note: More extensive information for getting started with ext4 can be | ||
18 | found at the ext4 wiki site at the URL: | ||
19 | http://ext4.wiki.kernel.org/index.php/Ext4_Howto | ||
20 | |||
16 | - Compile and install the latest version of e2fsprogs (as of this | 21 | - Compile and install the latest version of e2fsprogs (as of this |
17 | writing version 1.41) from: | 22 | writing version 1.41.3) from: |
18 | 23 | ||
19 | http://sourceforge.net/project/showfiles.php?group_id=2406 | 24 | http://sourceforge.net/project/showfiles.php?group_id=2406 |
20 | 25 | ||
@@ -26,28 +31,32 @@ Mailing list: linux-ext4@vger.kernel.org | |||
26 | 31 | ||
27 | git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git | 32 | git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git |
28 | 33 | ||
29 | - Create a new filesystem using the ext4dev filesystem type: | 34 | - Note that it is highly important to install the mke2fs.conf file |
35 | that comes with the e2fsprogs 1.41.x sources in /etc/mke2fs.conf. If | ||
36 | you have edited the /etc/mke2fs.conf file installed on your system, | ||
37 | you will need to merge your changes with the version from e2fsprogs | ||
38 | 1.41.x. | ||
39 | |||
40 | - Create a new filesystem using the ext4 filesystem type: | ||
30 | 41 | ||
31 | # mke2fs -t ext4dev /dev/hda1 | 42 | # mke2fs -t ext4 /dev/hda1 |
32 | 43 | ||
33 | Or configure an existing ext3 filesystem to support extents and set | 44 | Or to configure an existing ext3 filesystem to support extents: |
34 | the test_fs flag to indicate that it's ok for an in-development | ||
35 | filesystem to touch this filesystem: | ||
36 | 45 | ||
37 | # tune2fs -O extents -E test_fs /dev/hda1 | 46 | # tune2fs -O extents /dev/hda1 |
38 | 47 | ||
39 | If the filesystem was created with 128 byte inodes, it can be | 48 | If the filesystem was created with 128 byte inodes, it can be |
40 | converted to use 256 byte for greater efficiency via: | 49 | converted to use 256 byte for greater efficiency via: |
41 | 50 | ||
42 | # tune2fs -I 256 /dev/hda1 | 51 | # tune2fs -I 256 /dev/hda1 |
43 | 52 | ||
44 | (Note: we currently do not have tools to convert an ext4dev | 53 | (Note: we currently do not have tools to convert an ext4 |
45 | filesystem back to ext3; so please do not do try this on production | 54 | filesystem back to ext3; so please do not do try this on production |
46 | filesystems.) | 55 | filesystems.) |
47 | 56 | ||
48 | - Mounting: | 57 | - Mounting: |
49 | 58 | ||
50 | # mount -t ext4dev /dev/hda1 /wherever | 59 | # mount -t ext4 /dev/hda1 /wherever |
51 | 60 | ||
52 | - When comparing performance with other filesystems, remember that | 61 | - When comparing performance with other filesystems, remember that |
53 | ext3/4 by default offers higher data integrity guarantees than most. | 62 | ext3/4 by default offers higher data integrity guarantees than most. |
@@ -98,8 +107,8 @@ exist yet so I'm not sure they're in the near-term roadmap. | |||
98 | The big performance win will come with mballoc, delalloc and flex_bg | 107 | The big performance win will come with mballoc, delalloc and flex_bg |
99 | grouping of bitmaps and inode tables. Some test results available here: | 108 | grouping of bitmaps and inode tables. Some test results available here: |
100 | 109 | ||
101 | - http://www.bullopensource.org/ext4/20080530/ffsb-write-2.6.26-rc2.html | 110 | - http://www.bullopensource.org/ext4/20080818-ffsb/ffsb-write-2.6.27-rc1.html |
102 | - http://www.bullopensource.org/ext4/20080530/ffsb-readwrite-2.6.26-rc2.html | 111 | - http://www.bullopensource.org/ext4/20080818-ffsb/ffsb-readwrite-2.6.27-rc1.html |
103 | 112 | ||
104 | 3. Options | 113 | 3. Options |
105 | ========== | 114 | ========== |
@@ -171,6 +180,11 @@ barrier=<0|1(*)> This enables/disables the use of write barriers in | |||
171 | your disks are battery-backed in one way or another, | 180 | your disks are battery-backed in one way or another, |
172 | disabling barriers may safely improve performance. | 181 | disabling barriers may safely improve performance. |
173 | 182 | ||
183 | inode_readahead=n This tuning parameter controls the maximum | ||
184 | number of inode table blocks that ext4's inode | ||
185 | table readahead algorithm will pre-read into | ||
186 | the buffer cache. The default value is 32 blocks. | ||
187 | |||
174 | orlov (*) This enables the new Orlov block allocator. It is | 188 | orlov (*) This enables the new Orlov block allocator. It is |
175 | enabled by default. | 189 | enabled by default. |
176 | 190 | ||
@@ -203,15 +217,17 @@ noreservation | |||
203 | bsddf (*) Make 'df' act like BSD. | 217 | bsddf (*) Make 'df' act like BSD. |
204 | minixdf Make 'df' act like Minix. | 218 | minixdf Make 'df' act like Minix. |
205 | 219 | ||
206 | check=none Don't do extra checking of bitmaps on mount. | ||
207 | nocheck | ||
208 | |||
209 | debug Extra debugging information is sent to syslog. | 220 | debug Extra debugging information is sent to syslog. |
210 | 221 | ||
211 | errors=remount-ro(*) Remount the filesystem read-only on an error. | 222 | errors=remount-ro(*) Remount the filesystem read-only on an error. |
212 | errors=continue Keep going on a filesystem error. | 223 | errors=continue Keep going on a filesystem error. |
213 | errors=panic Panic and halt the machine if an error occurs. | 224 | errors=panic Panic and halt the machine if an error occurs. |
214 | 225 | ||
226 | data_err=ignore(*) Just print an error message if an error occurs | ||
227 | in a file data buffer in ordered mode. | ||
228 | data_err=abort Abort the journal if an error occurs in a file | ||
229 | data buffer in ordered mode. | ||
230 | |||
215 | grpid Give objects the same group ID as their creator. | 231 | grpid Give objects the same group ID as their creator. |
216 | bsdgroups | 232 | bsdgroups |
217 | 233 | ||
@@ -237,8 +253,6 @@ nobh (a) cache disk block mapping information | |||
237 | "nobh" option tries to avoid associating buffer | 253 | "nobh" option tries to avoid associating buffer |
238 | heads (supported only for "writeback" mode). | 254 | heads (supported only for "writeback" mode). |
239 | 255 | ||
240 | mballoc (*) Use the multiple block allocator for block allocation | ||
241 | nomballoc disabled multiple block allocator for block allocation. | ||
242 | stripe=n Number of filesystem blocks that mballoc will try | 256 | stripe=n Number of filesystem blocks that mballoc will try |
243 | to use for allocation size and alignment. For RAID5/6 | 257 | to use for allocation size and alignment. For RAID5/6 |
244 | systems this should be the number of data | 258 | systems this should be the number of data |
@@ -246,6 +260,7 @@ stripe=n Number of filesystem blocks that mballoc will try | |||
246 | delalloc (*) Deferring block allocation until write-out time. | 260 | delalloc (*) Deferring block allocation until write-out time. |
247 | nodelalloc Disable delayed allocation. Blocks are allocation | 261 | nodelalloc Disable delayed allocation. Blocks are allocation |
248 | when data is copied from user to page cache. | 262 | when data is copied from user to page cache. |
263 | |||
249 | Data Mode | 264 | Data Mode |
250 | ========= | 265 | ========= |
251 | There are 3 different data modes: | 266 | There are 3 different data modes: |
diff --git a/Documentation/filesystems/fiemap.txt b/Documentation/filesystems/fiemap.txt new file mode 100644 index 000000000000..1e3defcfe50b --- /dev/null +++ b/Documentation/filesystems/fiemap.txt | |||
@@ -0,0 +1,228 @@ | |||
1 | ============ | ||
2 | Fiemap Ioctl | ||
3 | ============ | ||
4 | |||
5 | The fiemap ioctl is an efficient method for userspace to get file | ||
6 | extent mappings. Instead of block-by-block mapping (such as bmap), fiemap | ||
7 | returns a list of extents. | ||
8 | |||
9 | |||
10 | Request Basics | ||
11 | -------------- | ||
12 | |||
13 | A fiemap request is encoded within struct fiemap: | ||
14 | |||
15 | struct fiemap { | ||
16 | __u64 fm_start; /* logical offset (inclusive) at | ||
17 | * which to start mapping (in) */ | ||
18 | __u64 fm_length; /* logical length of mapping which | ||
19 | * userspace cares about (in) */ | ||
20 | __u32 fm_flags; /* FIEMAP_FLAG_* flags for request (in/out) */ | ||
21 | __u32 fm_mapped_extents; /* number of extents that were | ||
22 | * mapped (out) */ | ||
23 | __u32 fm_extent_count; /* size of fm_extents array (in) */ | ||
24 | __u32 fm_reserved; | ||
25 | struct fiemap_extent fm_extents[0]; /* array of mapped extents (out) */ | ||
26 | }; | ||
27 | |||
28 | |||
29 | fm_start, and fm_length specify the logical range within the file | ||
30 | which the process would like mappings for. Extents returned mirror | ||
31 | those on disk - that is, the logical offset of the 1st returned extent | ||
32 | may start before fm_start, and the range covered by the last returned | ||
33 | extent may end after fm_length. All offsets and lengths are in bytes. | ||
34 | |||
35 | Certain flags to modify the way in which mappings are looked up can be | ||
36 | set in fm_flags. If the kernel doesn't understand some particular | ||
37 | flags, it will return EBADR and the contents of fm_flags will contain | ||
38 | the set of flags which caused the error. If the kernel is compatible | ||
39 | with all flags passed, the contents of fm_flags will be unmodified. | ||
40 | It is up to userspace to determine whether rejection of a particular | ||
41 | flag is fatal to it's operation. This scheme is intended to allow the | ||
42 | fiemap interface to grow in the future but without losing | ||
43 | compatibility with old software. | ||
44 | |||
45 | fm_extent_count specifies the number of elements in the fm_extents[] array | ||
46 | that can be used to return extents. If fm_extent_count is zero, then the | ||
47 | fm_extents[] array is ignored (no extents will be returned), and the | ||
48 | fm_mapped_extents count will hold the number of extents needed in | ||
49 | fm_extents[] to hold the file's current mapping. Note that there is | ||
50 | nothing to prevent the file from changing between calls to FIEMAP. | ||
51 | |||
52 | The following flags can be set in fm_flags: | ||
53 | |||
54 | * FIEMAP_FLAG_SYNC | ||
55 | If this flag is set, the kernel will sync the file before mapping extents. | ||
56 | |||
57 | * FIEMAP_FLAG_XATTR | ||
58 | If this flag is set, the extents returned will describe the inodes | ||
59 | extended attribute lookup tree, instead of it's data tree. | ||
60 | |||
61 | |||
62 | Extent Mapping | ||
63 | -------------- | ||
64 | |||
65 | Extent information is returned within the embedded fm_extents array | ||
66 | which userspace must allocate along with the fiemap structure. The | ||
67 | number of elements in the fiemap_extents[] array should be passed via | ||
68 | fm_extent_count. The number of extents mapped by kernel will be | ||
69 | returned via fm_mapped_extents. If the number of fiemap_extents | ||
70 | allocated is less than would be required to map the requested range, | ||
71 | the maximum number of extents that can be mapped in the fm_extent[] | ||
72 | array will be returned and fm_mapped_extents will be equal to | ||
73 | fm_extent_count. In that case, the last extent in the array will not | ||
74 | complete the requested range and will not have the FIEMAP_EXTENT_LAST | ||
75 | flag set (see the next section on extent flags). | ||
76 | |||
77 | Each extent is described by a single fiemap_extent structure as | ||
78 | returned in fm_extents. | ||
79 | |||
80 | struct fiemap_extent { | ||
81 | __u64 fe_logical; /* logical offset in bytes for the start of | ||
82 | * the extent */ | ||
83 | __u64 fe_physical; /* physical offset in bytes for the start | ||
84 | * of the extent */ | ||
85 | __u64 fe_length; /* length in bytes for the extent */ | ||
86 | __u64 fe_reserved64[2]; | ||
87 | __u32 fe_flags; /* FIEMAP_EXTENT_* flags for this extent */ | ||
88 | __u32 fe_reserved[3]; | ||
89 | }; | ||
90 | |||
91 | All offsets and lengths are in bytes and mirror those on disk. It is valid | ||
92 | for an extents logical offset to start before the request or it's logical | ||
93 | length to extend past the request. Unless FIEMAP_EXTENT_NOT_ALIGNED is | ||
94 | returned, fe_logical, fe_physical, and fe_length will be aligned to the | ||
95 | block size of the file system. With the exception of extents flagged as | ||
96 | FIEMAP_EXTENT_MERGED, adjacent extents will not be merged. | ||
97 | |||
98 | The fe_flags field contains flags which describe the extent returned. | ||
99 | A special flag, FIEMAP_EXTENT_LAST is always set on the last extent in | ||
100 | the file so that the process making fiemap calls can determine when no | ||
101 | more extents are available, without having to call the ioctl again. | ||
102 | |||
103 | Some flags are intentionally vague and will always be set in the | ||
104 | presence of other more specific flags. This way a program looking for | ||
105 | a general property does not have to know all existing and future flags | ||
106 | which imply that property. | ||
107 | |||
108 | For example, if FIEMAP_EXTENT_DATA_INLINE or FIEMAP_EXTENT_DATA_TAIL | ||
109 | are set, FIEMAP_EXTENT_NOT_ALIGNED will also be set. A program looking | ||
110 | for inline or tail-packed data can key on the specific flag. Software | ||
111 | which simply cares not to try operating on non-aligned extents | ||
112 | however, can just key on FIEMAP_EXTENT_NOT_ALIGNED, and not have to | ||
113 | worry about all present and future flags which might imply unaligned | ||
114 | data. Note that the opposite is not true - it would be valid for | ||
115 | FIEMAP_EXTENT_NOT_ALIGNED to appear alone. | ||
116 | |||
117 | * FIEMAP_EXTENT_LAST | ||
118 | This is the last extent in the file. A mapping attempt past this | ||
119 | extent will return nothing. | ||
120 | |||
121 | * FIEMAP_EXTENT_UNKNOWN | ||
122 | The location of this extent is currently unknown. This may indicate | ||
123 | the data is stored on an inaccessible volume or that no storage has | ||
124 | been allocated for the file yet. | ||
125 | |||
126 | * FIEMAP_EXTENT_DELALLOC | ||
127 | - This will also set FIEMAP_EXTENT_UNKNOWN. | ||
128 | Delayed allocation - while there is data for this extent, it's | ||
129 | physical location has not been allocated yet. | ||
130 | |||
131 | * FIEMAP_EXTENT_ENCODED | ||
132 | This extent does not consist of plain filesystem blocks but is | ||
133 | encoded (e.g. encrypted or compressed). Reading the data in this | ||
134 | extent via I/O to the block device will have undefined results. | ||
135 | |||
136 | Note that it is *always* undefined to try to update the data | ||
137 | in-place by writing to the indicated location without the | ||
138 | assistance of the filesystem, or to access the data using the | ||
139 | information returned by the FIEMAP interface while the filesystem | ||
140 | is mounted. In other words, user applications may only read the | ||
141 | extent data via I/O to the block device while the filesystem is | ||
142 | unmounted, and then only if the FIEMAP_EXTENT_ENCODED flag is | ||
143 | clear; user applications must not try reading or writing to the | ||
144 | filesystem via the block device under any other circumstances. | ||
145 | |||
146 | * FIEMAP_EXTENT_DATA_ENCRYPTED | ||
147 | - This will also set FIEMAP_EXTENT_ENCODED | ||
148 | The data in this extent has been encrypted by the file system. | ||
149 | |||
150 | * FIEMAP_EXTENT_NOT_ALIGNED | ||
151 | Extent offsets and length are not guaranteed to be block aligned. | ||
152 | |||
153 | * FIEMAP_EXTENT_DATA_INLINE | ||
154 | This will also set FIEMAP_EXTENT_NOT_ALIGNED | ||
155 | Data is located within a meta data block. | ||
156 | |||
157 | * FIEMAP_EXTENT_DATA_TAIL | ||
158 | This will also set FIEMAP_EXTENT_NOT_ALIGNED | ||
159 | Data is packed into a block with data from other files. | ||
160 | |||
161 | * FIEMAP_EXTENT_UNWRITTEN | ||
162 | Unwritten extent - the extent is allocated but it's data has not been | ||
163 | initialized. This indicates the extent's data will be all zero if read | ||
164 | through the filesystem but the contents are undefined if read directly from | ||
165 | the device. | ||
166 | |||
167 | * FIEMAP_EXTENT_MERGED | ||
168 | This will be set when a file does not support extents, i.e., it uses a block | ||
169 | based addressing scheme. Since returning an extent for each block back to | ||
170 | userspace would be highly inefficient, the kernel will try to merge most | ||
171 | adjacent blocks into 'extents'. | ||
172 | |||
173 | |||
174 | VFS -> File System Implementation | ||
175 | --------------------------------- | ||
176 | |||
177 | File systems wishing to support fiemap must implement a ->fiemap callback on | ||
178 | their inode_operations structure. The fs ->fiemap call is responsible for | ||
179 | defining it's set of supported fiemap flags, and calling a helper function on | ||
180 | each discovered extent: | ||
181 | |||
182 | struct inode_operations { | ||
183 | ... | ||
184 | |||
185 | int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, | ||
186 | u64 len); | ||
187 | |||
188 | ->fiemap is passed struct fiemap_extent_info which describes the | ||
189 | fiemap request: | ||
190 | |||
191 | struct fiemap_extent_info { | ||
192 | unsigned int fi_flags; /* Flags as passed from user */ | ||
193 | unsigned int fi_extents_mapped; /* Number of mapped extents */ | ||
194 | unsigned int fi_extents_max; /* Size of fiemap_extent array */ | ||
195 | struct fiemap_extent *fi_extents_start; /* Start of fiemap_extent array */ | ||
196 | }; | ||
197 | |||
198 | It is intended that the file system should not need to access any of this | ||
199 | structure directly. | ||
200 | |||
201 | |||
202 | Flag checking should be done at the beginning of the ->fiemap callback via the | ||
203 | fiemap_check_flags() helper: | ||
204 | |||
205 | int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags); | ||
206 | |||
207 | The struct fieinfo should be passed in as recieved from ioctl_fiemap(). The | ||
208 | set of fiemap flags which the fs understands should be passed via fs_flags. If | ||
209 | fiemap_check_flags finds invalid user flags, it will place the bad values in | ||
210 | fieinfo->fi_flags and return -EBADR. If the file system gets -EBADR, from | ||
211 | fiemap_check_flags(), it should immediately exit, returning that error back to | ||
212 | ioctl_fiemap(). | ||
213 | |||
214 | |||
215 | For each extent in the request range, the file system should call | ||
216 | the helper function, fiemap_fill_next_extent(): | ||
217 | |||
218 | int fiemap_fill_next_extent(struct fiemap_extent_info *info, u64 logical, | ||
219 | u64 phys, u64 len, u32 flags, u32 dev); | ||
220 | |||
221 | fiemap_fill_next_extent() will use the passed values to populate the | ||
222 | next free extent in the fm_extents array. 'General' extent flags will | ||
223 | automatically be set from specific flags on behalf of the calling file | ||
224 | system so that the userspace API is not broken. | ||
225 | |||
226 | fiemap_fill_next_extent() returns 0 on success, and 1 when the | ||
227 | user-supplied fm_extents array is full. If an error is encountered | ||
228 | while copying the extent to user memory, -EFAULT will be returned. | ||
diff --git a/Documentation/filesystems/nfs-rdma.txt b/Documentation/filesystems/nfs-rdma.txt index d0ec45ae4e7d..44bd766f2e5d 100644 --- a/Documentation/filesystems/nfs-rdma.txt +++ b/Documentation/filesystems/nfs-rdma.txt | |||
@@ -5,7 +5,7 @@ | |||
5 | ################################################################################ | 5 | ################################################################################ |
6 | 6 | ||
7 | Author: NetApp and Open Grid Computing | 7 | Author: NetApp and Open Grid Computing |
8 | Date: April 15, 2008 | 8 | Date: May 29, 2008 |
9 | 9 | ||
10 | Table of Contents | 10 | Table of Contents |
11 | ~~~~~~~~~~~~~~~~~ | 11 | ~~~~~~~~~~~~~~~~~ |
@@ -60,16 +60,18 @@ Installation | |||
60 | The procedures described in this document have been tested with | 60 | The procedures described in this document have been tested with |
61 | distributions from Red Hat's Fedora Project (http://fedora.redhat.com/). | 61 | distributions from Red Hat's Fedora Project (http://fedora.redhat.com/). |
62 | 62 | ||
63 | - Install nfs-utils-1.1.1 or greater on the client | 63 | - Install nfs-utils-1.1.2 or greater on the client |
64 | 64 | ||
65 | An NFS/RDMA mount point can only be obtained by using the mount.nfs | 65 | An NFS/RDMA mount point can be obtained by using the mount.nfs command in |
66 | command in nfs-utils-1.1.1 or greater. To see which version of mount.nfs | 66 | nfs-utils-1.1.2 or greater (nfs-utils-1.1.1 was the first nfs-utils |
67 | you are using, type: | 67 | version with support for NFS/RDMA mounts, but for various reasons we |
68 | recommend using nfs-utils-1.1.2 or greater). To see which version of | ||
69 | mount.nfs you are using, type: | ||
68 | 70 | ||
69 | > /sbin/mount.nfs -V | 71 | $ /sbin/mount.nfs -V |
70 | 72 | ||
71 | If the version is less than 1.1.1 or the command does not exist, | 73 | If the version is less than 1.1.2 or the command does not exist, |
72 | then you will need to install the latest version of nfs-utils. | 74 | you should install the latest version of nfs-utils. |
73 | 75 | ||
74 | Download the latest package from: | 76 | Download the latest package from: |
75 | 77 | ||
@@ -77,22 +79,33 @@ Installation | |||
77 | 79 | ||
78 | Uncompress the package and follow the installation instructions. | 80 | Uncompress the package and follow the installation instructions. |
79 | 81 | ||
80 | If you will not be using GSS and NFSv4, the installation process | 82 | If you will not need the idmapper and gssd executables (you do not need |
81 | can be simplified by disabling these features when running configure: | 83 | these to create an NFS/RDMA enabled mount command), the installation |
84 | process can be simplified by disabling these features when running | ||
85 | configure: | ||
82 | 86 | ||
83 | > ./configure --disable-gss --disable-nfsv4 | 87 | $ ./configure --disable-gss --disable-nfsv4 |
84 | 88 | ||
85 | For more information on this see the package's README and INSTALL files. | 89 | To build nfs-utils you will need the tcp_wrappers package installed. For |
90 | more information on this see the package's README and INSTALL files. | ||
86 | 91 | ||
87 | After building the nfs-utils package, there will be a mount.nfs binary in | 92 | After building the nfs-utils package, there will be a mount.nfs binary in |
88 | the utils/mount directory. This binary can be used to initiate NFS v2, v3, | 93 | the utils/mount directory. This binary can be used to initiate NFS v2, v3, |
89 | or v4 mounts. To initiate a v4 mount, the binary must be called mount.nfs4. | 94 | or v4 mounts. To initiate a v4 mount, the binary must be called |
90 | The standard technique is to create a symlink called mount.nfs4 to mount.nfs. | 95 | mount.nfs4. The standard technique is to create a symlink called |
96 | mount.nfs4 to mount.nfs. | ||
91 | 97 | ||
92 | NOTE: mount.nfs and therefore nfs-utils-1.1.1 or greater is only needed | 98 | This mount.nfs binary should be installed at /sbin/mount.nfs as follows: |
99 | |||
100 | $ sudo cp utils/mount/mount.nfs /sbin/mount.nfs | ||
101 | |||
102 | In this location, mount.nfs will be invoked automatically for NFS mounts | ||
103 | by the system mount commmand. | ||
104 | |||
105 | NOTE: mount.nfs and therefore nfs-utils-1.1.2 or greater is only needed | ||
93 | on the NFS client machine. You do not need this specific version of | 106 | on the NFS client machine. You do not need this specific version of |
94 | nfs-utils on the server. Furthermore, only the mount.nfs command from | 107 | nfs-utils on the server. Furthermore, only the mount.nfs command from |
95 | nfs-utils-1.1.1 is needed on the client. | 108 | nfs-utils-1.1.2 is needed on the client. |
96 | 109 | ||
97 | - Install a Linux kernel with NFS/RDMA | 110 | - Install a Linux kernel with NFS/RDMA |
98 | 111 | ||
@@ -156,8 +169,8 @@ Check RDMA and NFS Setup | |||
156 | this time. For example, if you are using a Mellanox Tavor/Sinai/Arbel | 169 | this time. For example, if you are using a Mellanox Tavor/Sinai/Arbel |
157 | card: | 170 | card: |
158 | 171 | ||
159 | > modprobe ib_mthca | 172 | $ modprobe ib_mthca |
160 | > modprobe ib_ipoib | 173 | $ modprobe ib_ipoib |
161 | 174 | ||
162 | If you are using InfiniBand, make sure there is a Subnet Manager (SM) | 175 | If you are using InfiniBand, make sure there is a Subnet Manager (SM) |
163 | running on the network. If your IB switch has an embedded SM, you can | 176 | running on the network. If your IB switch has an embedded SM, you can |
@@ -166,7 +179,7 @@ Check RDMA and NFS Setup | |||
166 | 179 | ||
167 | If an SM is running on your network, you should see the following: | 180 | If an SM is running on your network, you should see the following: |
168 | 181 | ||
169 | > cat /sys/class/infiniband/driverX/ports/1/state | 182 | $ cat /sys/class/infiniband/driverX/ports/1/state |
170 | 4: ACTIVE | 183 | 4: ACTIVE |
171 | 184 | ||
172 | where driverX is mthca0, ipath5, ehca3, etc. | 185 | where driverX is mthca0, ipath5, ehca3, etc. |
@@ -174,10 +187,10 @@ Check RDMA and NFS Setup | |||
174 | To further test the InfiniBand software stack, use IPoIB (this | 187 | To further test the InfiniBand software stack, use IPoIB (this |
175 | assumes you have two IB hosts named host1 and host2): | 188 | assumes you have two IB hosts named host1 and host2): |
176 | 189 | ||
177 | host1> ifconfig ib0 a.b.c.x | 190 | host1$ ifconfig ib0 a.b.c.x |
178 | host2> ifconfig ib0 a.b.c.y | 191 | host2$ ifconfig ib0 a.b.c.y |
179 | host1> ping a.b.c.y | 192 | host1$ ping a.b.c.y |
180 | host2> ping a.b.c.x | 193 | host2$ ping a.b.c.x |
181 | 194 | ||
182 | For other device types, follow the appropriate procedures. | 195 | For other device types, follow the appropriate procedures. |
183 | 196 | ||
@@ -202,11 +215,11 @@ NFS/RDMA Setup | |||
202 | /vol0 192.168.0.47(fsid=0,rw,async,insecure,no_root_squash) | 215 | /vol0 192.168.0.47(fsid=0,rw,async,insecure,no_root_squash) |
203 | /vol0 192.168.0.0/255.255.255.0(fsid=0,rw,async,insecure,no_root_squash) | 216 | /vol0 192.168.0.0/255.255.255.0(fsid=0,rw,async,insecure,no_root_squash) |
204 | 217 | ||
205 | The IP address(es) is(are) the client's IPoIB address for an InfiniBand HCA or the | 218 | The IP address(es) is(are) the client's IPoIB address for an InfiniBand |
206 | cleint's iWARP address(es) for an RNIC. | 219 | HCA or the cleint's iWARP address(es) for an RNIC. |
207 | 220 | ||
208 | NOTE: The "insecure" option must be used because the NFS/RDMA client does not | 221 | NOTE: The "insecure" option must be used because the NFS/RDMA client does |
209 | use a reserved port. | 222 | not use a reserved port. |
210 | 223 | ||
211 | Each time a machine boots: | 224 | Each time a machine boots: |
212 | 225 | ||
@@ -214,43 +227,45 @@ NFS/RDMA Setup | |||
214 | 227 | ||
215 | For InfiniBand using a Mellanox adapter: | 228 | For InfiniBand using a Mellanox adapter: |
216 | 229 | ||
217 | > modprobe ib_mthca | 230 | $ modprobe ib_mthca |
218 | > modprobe ib_ipoib | 231 | $ modprobe ib_ipoib |
219 | > ifconfig ib0 a.b.c.d | 232 | $ ifconfig ib0 a.b.c.d |
220 | 233 | ||
221 | NOTE: use unique addresses for the client and server | 234 | NOTE: use unique addresses for the client and server |
222 | 235 | ||
223 | - Start the NFS server | 236 | - Start the NFS server |
224 | 237 | ||
225 | If the NFS/RDMA server was built as a module (CONFIG_SUNRPC_XPRT_RDMA=m in kernel config), | 238 | If the NFS/RDMA server was built as a module (CONFIG_SUNRPC_XPRT_RDMA=m in |
226 | load the RDMA transport module: | 239 | kernel config), load the RDMA transport module: |
227 | 240 | ||
228 | > modprobe svcrdma | 241 | $ modprobe svcrdma |
229 | 242 | ||
230 | Regardless of how the server was built (module or built-in), start the server: | 243 | Regardless of how the server was built (module or built-in), start the |
244 | server: | ||
231 | 245 | ||
232 | > /etc/init.d/nfs start | 246 | $ /etc/init.d/nfs start |
233 | 247 | ||
234 | or | 248 | or |
235 | 249 | ||
236 | > service nfs start | 250 | $ service nfs start |
237 | 251 | ||
238 | Instruct the server to listen on the RDMA transport: | 252 | Instruct the server to listen on the RDMA transport: |
239 | 253 | ||
240 | > echo rdma 2050 > /proc/fs/nfsd/portlist | 254 | $ echo rdma 2050 > /proc/fs/nfsd/portlist |
241 | 255 | ||
242 | - On the client system | 256 | - On the client system |
243 | 257 | ||
244 | If the NFS/RDMA client was built as a module (CONFIG_SUNRPC_XPRT_RDMA=m in kernel config), | 258 | If the NFS/RDMA client was built as a module (CONFIG_SUNRPC_XPRT_RDMA=m in |
245 | load the RDMA client module: | 259 | kernel config), load the RDMA client module: |
246 | 260 | ||
247 | > modprobe xprtrdma.ko | 261 | $ modprobe xprtrdma.ko |
248 | 262 | ||
249 | Regardless of how the client was built (module or built-in), issue the mount.nfs command: | 263 | Regardless of how the client was built (module or built-in), use this |
264 | command to mount the NFS/RDMA server: | ||
250 | 265 | ||
251 | > /path/to/your/mount.nfs <IPoIB-server-name-or-address>:/<export> /mnt -i -o rdma,port=2050 | 266 | $ mount -o rdma,port=2050 <IPoIB-server-name-or-address>:/<export> /mnt |
252 | 267 | ||
253 | To verify that the mount is using RDMA, run "cat /proc/mounts" and check the | 268 | To verify that the mount is using RDMA, run "cat /proc/mounts" and check |
254 | "proto" field for the given mount. | 269 | the "proto" field for the given mount. |
255 | 270 | ||
256 | Congratulations! You're using NFS/RDMA! | 271 | Congratulations! You're using NFS/RDMA! |
diff --git a/Documentation/filesystems/nfsroot.txt b/Documentation/filesystems/nfsroot.txt index 31b329172343..68baddf3c3e0 100644 --- a/Documentation/filesystems/nfsroot.txt +++ b/Documentation/filesystems/nfsroot.txt | |||
@@ -169,7 +169,7 @@ They depend on various facilities being available: | |||
169 | 3.1) Booting from a floppy using syslinux | 169 | 3.1) Booting from a floppy using syslinux |
170 | 170 | ||
171 | When building kernels, an easy way to create a boot floppy that uses | 171 | When building kernels, an easy way to create a boot floppy that uses |
172 | syslinux is to use the zdisk or bzdisk make targets which use | 172 | syslinux is to use the zdisk or bzdisk make targets which use zimage |
173 | and bzimage images respectively. Both targets accept the | 173 | and bzimage images respectively. Both targets accept the |
174 | FDARGS parameter which can be used to set the kernel command line. | 174 | FDARGS parameter which can be used to set the kernel command line. |
175 | 175 | ||
diff --git a/Documentation/filesystems/ntfs.txt b/Documentation/filesystems/ntfs.txt index e79ee2db183a..ac2a261c5f7d 100644 --- a/Documentation/filesystems/ntfs.txt +++ b/Documentation/filesystems/ntfs.txt | |||
@@ -40,7 +40,7 @@ Web site | |||
40 | ======== | 40 | ======== |
41 | 41 | ||
42 | There is plenty of additional information on the linux-ntfs web site | 42 | There is plenty of additional information on the linux-ntfs web site |
43 | at http://linux-ntfs.sourceforge.net/ | 43 | at http://www.linux-ntfs.org/ |
44 | 44 | ||
45 | The web site has a lot of additional information, such as a comprehensive | 45 | The web site has a lot of additional information, such as a comprehensive |
46 | FAQ, documentation on the NTFS on-disk format, information on the Linux-NTFS | 46 | FAQ, documentation on the NTFS on-disk format, information on the Linux-NTFS |
@@ -272,7 +272,7 @@ And you would know that /dev/hda2 has a size of 37768814 - 4209030 + 1 = | |||
272 | For Win2k and later dynamic disks, you can for example use the ldminfo utility | 272 | For Win2k and later dynamic disks, you can for example use the ldminfo utility |
273 | which is part of the Linux LDM tools (the latest version at the time of | 273 | which is part of the Linux LDM tools (the latest version at the time of |
274 | writing is linux-ldm-0.0.8.tar.bz2). You can download it from: | 274 | writing is linux-ldm-0.0.8.tar.bz2). You can download it from: |
275 | http://linux-ntfs.sourceforge.net/downloads.html | 275 | http://www.linux-ntfs.org/ |
276 | Simply extract the downloaded archive (tar xvjf linux-ldm-0.0.8.tar.bz2), go | 276 | Simply extract the downloaded archive (tar xvjf linux-ldm-0.0.8.tar.bz2), go |
277 | into it (cd linux-ldm-0.0.8) and change to the test directory (cd test). You | 277 | into it (cd linux-ldm-0.0.8) and change to the test directory (cd test). You |
278 | will find the precompiled (i386) ldminfo utility there. NOTE: You will not be | 278 | will find the precompiled (i386) ldminfo utility there. NOTE: You will not be |
diff --git a/Documentation/filesystems/ocfs2.txt b/Documentation/filesystems/ocfs2.txt index c318a8bbb1ef..4340cc825796 100644 --- a/Documentation/filesystems/ocfs2.txt +++ b/Documentation/filesystems/ocfs2.txt | |||
@@ -76,3 +76,9 @@ localalloc=8(*) Allows custom localalloc size in MB. If the value is too | |||
76 | large, the fs will silently revert it to the default. | 76 | large, the fs will silently revert it to the default. |
77 | Localalloc is not enabled for local mounts. | 77 | Localalloc is not enabled for local mounts. |
78 | localflocks This disables cluster aware flock. | 78 | localflocks This disables cluster aware flock. |
79 | inode64 Indicates that Ocfs2 is allowed to create inodes at | ||
80 | any location in the filesystem, including those which | ||
81 | will result in inode numbers occupying more than 32 | ||
82 | bits of significance. | ||
83 | user_xattr (*) Enables Extended User Attributes. | ||
84 | nouser_xattr Disables Extended User Attributes. | ||
diff --git a/Documentation/filesystems/omfs.txt b/Documentation/filesystems/omfs.txt new file mode 100644 index 000000000000..1d0d41ff5c65 --- /dev/null +++ b/Documentation/filesystems/omfs.txt | |||
@@ -0,0 +1,106 @@ | |||
1 | Optimized MPEG Filesystem (OMFS) | ||
2 | |||
3 | Overview | ||
4 | ======== | ||
5 | |||
6 | OMFS is a filesystem created by SonicBlue for use in the ReplayTV DVR | ||
7 | and Rio Karma MP3 player. The filesystem is extent-based, utilizing | ||
8 | block sizes from 2k to 8k, with hash-based directories. This | ||
9 | filesystem driver may be used to read and write disks from these | ||
10 | devices. | ||
11 | |||
12 | Note, it is not recommended that this FS be used in place of a general | ||
13 | filesystem for your own streaming media device. Native Linux filesystems | ||
14 | will likely perform better. | ||
15 | |||
16 | More information is available at: | ||
17 | |||
18 | http://linux-karma.sf.net/ | ||
19 | |||
20 | Various utilities, including mkomfs and omfsck, are included with | ||
21 | omfsprogs, available at: | ||
22 | |||
23 | http://bobcopeland.com/karma/ | ||
24 | |||
25 | Instructions are included in its README. | ||
26 | |||
27 | Options | ||
28 | ======= | ||
29 | |||
30 | OMFS supports the following mount-time options: | ||
31 | |||
32 | uid=n - make all files owned by specified user | ||
33 | gid=n - make all files owned by specified group | ||
34 | umask=xxx - set permission umask to xxx | ||
35 | fmask=xxx - set umask to xxx for files | ||
36 | dmask=xxx - set umask to xxx for directories | ||
37 | |||
38 | Disk format | ||
39 | =========== | ||
40 | |||
41 | OMFS discriminates between "sysblocks" and normal data blocks. The sysblock | ||
42 | group consists of super block information, file metadata, directory structures, | ||
43 | and extents. Each sysblock has a header containing CRCs of the entire | ||
44 | sysblock, and may be mirrored in successive blocks on the disk. A sysblock may | ||
45 | have a smaller size than a data block, but since they are both addressed by the | ||
46 | same 64-bit block number, any remaining space in the smaller sysblock is | ||
47 | unused. | ||
48 | |||
49 | Sysblock header information: | ||
50 | |||
51 | struct omfs_header { | ||
52 | __be64 h_self; /* FS block where this is located */ | ||
53 | __be32 h_body_size; /* size of useful data after header */ | ||
54 | __be16 h_crc; /* crc-ccitt of body_size bytes */ | ||
55 | char h_fill1[2]; | ||
56 | u8 h_version; /* version, always 1 */ | ||
57 | char h_type; /* OMFS_INODE_X */ | ||
58 | u8 h_magic; /* OMFS_IMAGIC */ | ||
59 | u8 h_check_xor; /* XOR of header bytes before this */ | ||
60 | __be32 h_fill2; | ||
61 | }; | ||
62 | |||
63 | Files and directories are both represented by omfs_inode: | ||
64 | |||
65 | struct omfs_inode { | ||
66 | struct omfs_header i_head; /* header */ | ||
67 | __be64 i_parent; /* parent containing this inode */ | ||
68 | __be64 i_sibling; /* next inode in hash bucket */ | ||
69 | __be64 i_ctime; /* ctime, in milliseconds */ | ||
70 | char i_fill1[35]; | ||
71 | char i_type; /* OMFS_[DIR,FILE] */ | ||
72 | __be32 i_fill2; | ||
73 | char i_fill3[64]; | ||
74 | char i_name[OMFS_NAMELEN]; /* filename */ | ||
75 | __be64 i_size; /* size of file, in bytes */ | ||
76 | }; | ||
77 | |||
78 | Directories in OMFS are implemented as a large hash table. Filenames are | ||
79 | hashed then prepended into the bucket list beginning at OMFS_DIR_START. | ||
80 | Lookup requires hashing the filename, then seeking across i_sibling pointers | ||
81 | until a match is found on i_name. Empty buckets are represented by block | ||
82 | pointers with all-1s (~0). | ||
83 | |||
84 | A file is an omfs_inode structure followed by an extent table beginning at | ||
85 | OMFS_EXTENT_START: | ||
86 | |||
87 | struct omfs_extent_entry { | ||
88 | __be64 e_cluster; /* start location of a set of blocks */ | ||
89 | __be64 e_blocks; /* number of blocks after e_cluster */ | ||
90 | }; | ||
91 | |||
92 | struct omfs_extent { | ||
93 | __be64 e_next; /* next extent table location */ | ||
94 | __be32 e_extent_count; /* total # extents in this table */ | ||
95 | __be32 e_fill; | ||
96 | struct omfs_extent_entry e_entry; /* start of extent entries */ | ||
97 | }; | ||
98 | |||
99 | Each extent holds the block offset followed by number of blocks allocated to | ||
100 | the extent. The final extent in each table is a terminator with e_cluster | ||
101 | being ~0 and e_blocks being ones'-complement of the total number of blocks | ||
102 | in the table. | ||
103 | |||
104 | If this table overflows, a continuation inode is written and pointed to by | ||
105 | e_next. These have a header but lack the rest of the inode structure. | ||
106 | |||
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index 7f268f327d75..bcceb99b81dd 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt | |||
@@ -296,6 +296,7 @@ Table 1-4: Kernel info in /proc | |||
296 | uptime System uptime | 296 | uptime System uptime |
297 | version Kernel version | 297 | version Kernel version |
298 | video bttv info of video resources (2.4) | 298 | video bttv info of video resources (2.4) |
299 | vmallocinfo Show vmalloced areas | ||
299 | .............................................................................. | 300 | .............................................................................. |
300 | 301 | ||
301 | You can, for example, check which interrupts are currently in use and what | 302 | You can, for example, check which interrupts are currently in use and what |
@@ -557,6 +558,49 @@ VmallocTotal: total size of vmalloc memory area | |||
557 | VmallocUsed: amount of vmalloc area which is used | 558 | VmallocUsed: amount of vmalloc area which is used |
558 | VmallocChunk: largest contigious block of vmalloc area which is free | 559 | VmallocChunk: largest contigious block of vmalloc area which is free |
559 | 560 | ||
561 | .............................................................................. | ||
562 | |||
563 | vmallocinfo: | ||
564 | |||
565 | Provides information about vmalloced/vmaped areas. One line per area, | ||
566 | containing the virtual address range of the area, size in bytes, | ||
567 | caller information of the creator, and optional information depending | ||
568 | on the kind of area : | ||
569 | |||
570 | pages=nr number of pages | ||
571 | phys=addr if a physical address was specified | ||
572 | ioremap I/O mapping (ioremap() and friends) | ||
573 | vmalloc vmalloc() area | ||
574 | vmap vmap()ed pages | ||
575 | user VM_USERMAP area | ||
576 | vpages buffer for pages pointers was vmalloced (huge area) | ||
577 | N<node>=nr (Only on NUMA kernels) | ||
578 | Number of pages allocated on memory node <node> | ||
579 | |||
580 | > cat /proc/vmallocinfo | ||
581 | 0xffffc20000000000-0xffffc20000201000 2101248 alloc_large_system_hash+0x204 ... | ||
582 | /0x2c0 pages=512 vmalloc N0=128 N1=128 N2=128 N3=128 | ||
583 | 0xffffc20000201000-0xffffc20000302000 1052672 alloc_large_system_hash+0x204 ... | ||
584 | /0x2c0 pages=256 vmalloc N0=64 N1=64 N2=64 N3=64 | ||
585 | 0xffffc20000302000-0xffffc20000304000 8192 acpi_tb_verify_table+0x21/0x4f... | ||
586 | phys=7fee8000 ioremap | ||
587 | 0xffffc20000304000-0xffffc20000307000 12288 acpi_tb_verify_table+0x21/0x4f... | ||
588 | phys=7fee7000 ioremap | ||
589 | 0xffffc2000031d000-0xffffc2000031f000 8192 init_vdso_vars+0x112/0x210 | ||
590 | 0xffffc2000031f000-0xffffc2000032b000 49152 cramfs_uncompress_init+0x2e ... | ||
591 | /0x80 pages=11 vmalloc N0=3 N1=3 N2=2 N3=3 | ||
592 | 0xffffc2000033a000-0xffffc2000033d000 12288 sys_swapon+0x640/0xac0 ... | ||
593 | pages=2 vmalloc N1=2 | ||
594 | 0xffffc20000347000-0xffffc2000034c000 20480 xt_alloc_table_info+0xfe ... | ||
595 | /0x130 [x_tables] pages=4 vmalloc N0=4 | ||
596 | 0xffffffffa0000000-0xffffffffa000f000 61440 sys_init_module+0xc27/0x1d00 ... | ||
597 | pages=14 vmalloc N2=14 | ||
598 | 0xffffffffa000f000-0xffffffffa0014000 20480 sys_init_module+0xc27/0x1d00 ... | ||
599 | pages=4 vmalloc N1=4 | ||
600 | 0xffffffffa0014000-0xffffffffa0017000 12288 sys_init_module+0xc27/0x1d00 ... | ||
601 | pages=2 vmalloc N1=2 | ||
602 | 0xffffffffa0017000-0xffffffffa0022000 45056 sys_init_module+0xc27/0x1d00 ... | ||
603 | pages=10 vmalloc N0=10 | ||
560 | 604 | ||
561 | 1.3 IDE devices in /proc/ide | 605 | 1.3 IDE devices in /proc/ide |
562 | ---------------------------- | 606 | ---------------------------- |
@@ -879,45 +923,44 @@ CPUs. | |||
879 | The "procs_blocked" line gives the number of processes currently blocked, | 923 | The "procs_blocked" line gives the number of processes currently blocked, |
880 | waiting for I/O to complete. | 924 | waiting for I/O to complete. |
881 | 925 | ||
926 | |||
882 | 1.9 Ext4 file system parameters | 927 | 1.9 Ext4 file system parameters |
883 | ------------------------------ | 928 | ------------------------------ |
884 | Ext4 file system have one directory per partition under /proc/fs/ext4/ | ||
885 | # ls /proc/fs/ext4/hdc/ | ||
886 | group_prealloc max_to_scan mb_groups mb_history min_to_scan order2_req | ||
887 | stats stream_req | ||
888 | |||
889 | mb_groups: | ||
890 | This file gives the details of mutiblock allocator buddy cache of free blocks | ||
891 | |||
892 | mb_history: | ||
893 | Multiblock allocation history. | ||
894 | 929 | ||
895 | stats: | 930 | Information about mounted ext4 file systems can be found in |
896 | This file indicate whether the multiblock allocator should start collecting | 931 | /proc/fs/ext4. Each mounted filesystem will have a directory in |
897 | statistics. The statistics are shown during unmount | 932 | /proc/fs/ext4 based on its device name (i.e., /proc/fs/ext4/hdc or |
933 | /proc/fs/ext4/dm-0). The files in each per-device directory are shown | ||
934 | in Table 1-10, below. | ||
898 | 935 | ||
899 | group_prealloc: | 936 | Table 1-10: Files in /proc/fs/ext4/<devname> |
900 | The multiblock allocator normalize the block allocation request to | 937 | .............................................................................. |
901 | group_prealloc filesystem blocks if we don't have strip value set. | 938 | File Content |
902 | The stripe value can be specified at mount time or during mke2fs. | 939 | mb_groups details of multiblock allocator buddy cache of free blocks |
903 | 940 | mb_history multiblock allocation history | |
904 | max_to_scan: | 941 | stats controls whether the multiblock allocator should start |
905 | How long multiblock allocator can look for a best extent (in found extents) | 942 | collecting statistics, which are shown during the unmount |
906 | 943 | group_prealloc the multiblock allocator will round up allocation | |
907 | min_to_scan: | 944 | requests to a multiple of this tuning parameter if the |
908 | How long multiblock allocator must look for a best extent | 945 | stripe size is not set in the ext4 superblock |
909 | 946 | max_to_scan The maximum number of extents the multiblock allocator | |
910 | order2_req: | 947 | will search to find the best extent |
911 | Multiblock allocator use 2^N search using buddies only for requests greater | 948 | min_to_scan The minimum number of extents the multiblock allocator |
912 | than or equal to order2_req. The request size is specfied in file system | 949 | will search to find the best extent |
913 | blocks. A value of 2 indicate only if the requests are greater than or equal | 950 | order2_req Tuning parameter which controls the minimum size for |
914 | to 4 blocks. | 951 | requests (as a power of 2) where the buddy cache is |
952 | used | ||
953 | stream_req Files which have fewer blocks than this tunable | ||
954 | parameter will have their blocks allocated out of a | ||
955 | block group specific preallocation pool, so that small | ||
956 | files are packed closely together. Each large file | ||
957 | will have its blocks allocated out of its own unique | ||
958 | preallocation pool. | ||
959 | inode_readahead Tuning parameter which controls the maximum number of | ||
960 | inode table blocks that ext4's inode table readahead | ||
961 | algorithm will pre-read into the buffer cache | ||
962 | .............................................................................. | ||
915 | 963 | ||
916 | stream_req: | ||
917 | Files smaller than stream_req are served by the stream allocator, whose | ||
918 | purpose is to pack requests as close each to other as possible to | ||
919 | produce smooth I/O traffic. Avalue of 16 indicate that file smaller than 16 | ||
920 | filesystem block size will use group based preallocation. | ||
921 | 964 | ||
922 | ------------------------------------------------------------------------------ | 965 | ------------------------------------------------------------------------------ |
923 | Summary | 966 | Summary |
@@ -1278,6 +1321,18 @@ debugging information is displayed on console. | |||
1278 | NMI switch that most IA32 servers have fires unknown NMI up, for example. | 1321 | NMI switch that most IA32 servers have fires unknown NMI up, for example. |
1279 | If a system hangs up, try pressing the NMI switch. | 1322 | If a system hangs up, try pressing the NMI switch. |
1280 | 1323 | ||
1324 | panic_on_unrecovered_nmi | ||
1325 | ------------------------ | ||
1326 | |||
1327 | The default Linux behaviour on an NMI of either memory or unknown is to continue | ||
1328 | operation. For many environments such as scientific computing it is preferable | ||
1329 | that the box is taken out and the error dealt with than an uncorrected | ||
1330 | parity/ECC error get propogated. | ||
1331 | |||
1332 | A small number of systems do generate NMI's for bizarre random reasons such as | ||
1333 | power management so the default is off. That sysctl works like the existing | ||
1334 | panic controls already in that directory. | ||
1335 | |||
1281 | nmi_watchdog | 1336 | nmi_watchdog |
1282 | ------------ | 1337 | ------------ |
1283 | 1338 | ||
@@ -1288,12 +1343,24 @@ determine whether or not they are still functioning properly. | |||
1288 | Because the NMI watchdog shares registers with oprofile, by disabling the NMI | 1343 | Because the NMI watchdog shares registers with oprofile, by disabling the NMI |
1289 | watchdog, oprofile may have more registers to utilize. | 1344 | watchdog, oprofile may have more registers to utilize. |
1290 | 1345 | ||
1291 | maps_protect | 1346 | msgmni |
1292 | ------------ | 1347 | ------ |
1348 | |||
1349 | Maximum number of message queue ids on the system. | ||
1350 | This value scales to the amount of lowmem. It is automatically recomputed | ||
1351 | upon memory add/remove or ipc namespace creation/removal. | ||
1352 | When a value is written into this file, msgmni's value becomes fixed, i.e. it | ||
1353 | is not recomputed anymore when one of the above events occurs. | ||
1354 | Use auto_msgmni to change this behavior. | ||
1293 | 1355 | ||
1294 | Enables/Disables the protection of the per-process proc entries "maps" and | 1356 | auto_msgmni |
1295 | "smaps". When enabled, the contents of these files are visible only to | 1357 | ----------- |
1296 | readers that are allowed to ptrace() the given process. | 1358 | |
1359 | Enables/Disables automatic recomputing of msgmni upon memory add/remove or | ||
1360 | upon ipc namespace creation/removal (see the msgmni description above). | ||
1361 | Echoing "1" into this file enables msgmni automatic recomputing. | ||
1362 | Echoing "0" turns it off. | ||
1363 | auto_msgmni default value is 1. | ||
1297 | 1364 | ||
1298 | 1365 | ||
1299 | 2.4 /proc/sys/vm - The virtual memory subsystem | 1366 | 2.4 /proc/sys/vm - The virtual memory subsystem |
@@ -1317,15 +1384,18 @@ causes the kernel to prefer to reclaim dentries and inodes. | |||
1317 | dirty_background_ratio | 1384 | dirty_background_ratio |
1318 | ---------------------- | 1385 | ---------------------- |
1319 | 1386 | ||
1320 | Contains, as a percentage of total system memory, the number of pages at which | 1387 | Contains, as a percentage of the dirtyable system memory (free pages + mapped |
1321 | the pdflush background writeback daemon will start writing out dirty data. | 1388 | pages + file cache, not including locked pages and HugePages), the number of |
1389 | pages at which the pdflush background writeback daemon will start writing out | ||
1390 | dirty data. | ||
1322 | 1391 | ||
1323 | dirty_ratio | 1392 | dirty_ratio |
1324 | ----------------- | 1393 | ----------------- |
1325 | 1394 | ||
1326 | Contains, as a percentage of total system memory, the number of pages at which | 1395 | Contains, as a percentage of the dirtyable system memory (free pages + mapped |
1327 | a process which is generating disk writes will itself start writing out dirty | 1396 | pages + file cache, not including locked pages and HugePages), the number of |
1328 | data. | 1397 | pages at which a process which is generating disk writes will itself start |
1398 | writing out dirty data. | ||
1329 | 1399 | ||
1330 | dirty_writeback_centisecs | 1400 | dirty_writeback_centisecs |
1331 | ------------------------- | 1401 | ------------------------- |
@@ -1430,7 +1500,7 @@ used because pages_free(1355) is smaller than watermark + protection[2] | |||
1430 | normal page requirement. If requirement is DMA zone(index=0), protection[0] | 1500 | normal page requirement. If requirement is DMA zone(index=0), protection[0] |
1431 | (=0) is used. | 1501 | (=0) is used. |
1432 | 1502 | ||
1433 | zone[i]'s protection[j] is calculated by following exprssion. | 1503 | zone[i]'s protection[j] is calculated by following expression. |
1434 | 1504 | ||
1435 | (i < j): | 1505 | (i < j): |
1436 | zone[i]->protection[j] | 1506 | zone[i]->protection[j] |
@@ -2345,22 +2415,29 @@ will be dumped when the <pid> process is dumped. coredump_filter is a bitmask | |||
2345 | of memory types. If a bit of the bitmask is set, memory segments of the | 2415 | of memory types. If a bit of the bitmask is set, memory segments of the |
2346 | corresponding memory type are dumped, otherwise they are not dumped. | 2416 | corresponding memory type are dumped, otherwise they are not dumped. |
2347 | 2417 | ||
2348 | The following 4 memory types are supported: | 2418 | The following 7 memory types are supported: |
2349 | - (bit 0) anonymous private memory | 2419 | - (bit 0) anonymous private memory |
2350 | - (bit 1) anonymous shared memory | 2420 | - (bit 1) anonymous shared memory |
2351 | - (bit 2) file-backed private memory | 2421 | - (bit 2) file-backed private memory |
2352 | - (bit 3) file-backed shared memory | 2422 | - (bit 3) file-backed shared memory |
2423 | - (bit 4) ELF header pages in file-backed private memory areas (it is | ||
2424 | effective only if the bit 2 is cleared) | ||
2425 | - (bit 5) hugetlb private memory | ||
2426 | - (bit 6) hugetlb shared memory | ||
2353 | 2427 | ||
2354 | Note that MMIO pages such as frame buffer are never dumped and vDSO pages | 2428 | Note that MMIO pages such as frame buffer are never dumped and vDSO pages |
2355 | are always dumped regardless of the bitmask status. | 2429 | are always dumped regardless of the bitmask status. |
2356 | 2430 | ||
2357 | Default value of coredump_filter is 0x3; this means all anonymous memory | 2431 | Note bit 0-4 doesn't effect any hugetlb memory. hugetlb memory are only |
2358 | segments are dumped. | 2432 | effected by bit 5-6. |
2433 | |||
2434 | Default value of coredump_filter is 0x23; this means all anonymous memory | ||
2435 | segments and hugetlb private memory are dumped. | ||
2359 | 2436 | ||
2360 | If you don't want to dump all shared memory segments attached to pid 1234, | 2437 | If you don't want to dump all shared memory segments attached to pid 1234, |
2361 | write 1 to the process's proc file. | 2438 | write 0x21 to the process's proc file. |
2362 | 2439 | ||
2363 | $ echo 0x1 > /proc/1234/coredump_filter | 2440 | $ echo 0x21 > /proc/1234/coredump_filter |
2364 | 2441 | ||
2365 | When a new process is created, the process inherits the bitmask status from its | 2442 | When a new process is created, the process inherits the bitmask status from its |
2366 | parent. It is useful to set up coredump_filter before the program runs. | 2443 | parent. It is useful to set up coredump_filter before the program runs. |
diff --git a/Documentation/filesystems/quota.txt b/Documentation/filesystems/quota.txt index a590c4093eff..5e8de25bf0f1 100644 --- a/Documentation/filesystems/quota.txt +++ b/Documentation/filesystems/quota.txt | |||
@@ -3,14 +3,14 @@ Quota subsystem | |||
3 | =============== | 3 | =============== |
4 | 4 | ||
5 | Quota subsystem allows system administrator to set limits on used space and | 5 | Quota subsystem allows system administrator to set limits on used space and |
6 | number of used inodes (inode is a filesystem structure which is associated | 6 | number of used inodes (inode is a filesystem structure which is associated with |
7 | with each file or directory) for users and/or groups. For both used space and | 7 | each file or directory) for users and/or groups. For both used space and number |
8 | number of used inodes there are actually two limits. The first one is called | 8 | of used inodes there are actually two limits. The first one is called softlimit |
9 | softlimit and the second one hardlimit. An user can never exceed a hardlimit | 9 | and the second one hardlimit. An user can never exceed a hardlimit for any |
10 | for any resource. User is allowed to exceed softlimit but only for limited | 10 | resource (unless he has CAP_SYS_RESOURCE capability). User is allowed to exceed |
11 | period of time. This period is called "grace period" or "grace time". When | 11 | softlimit but only for limited period of time. This period is called "grace |
12 | grace time is over, user is not able to allocate more space/inodes until he | 12 | period" or "grace time". When grace time is over, user is not able to allocate |
13 | frees enough of them to get below softlimit. | 13 | more space/inodes until he frees enough of them to get below softlimit. |
14 | 14 | ||
15 | Quota limits (and amount of grace time) are set independently for each | 15 | Quota limits (and amount of grace time) are set independently for each |
16 | filesystem. | 16 | filesystem. |
@@ -53,6 +53,12 @@ in parentheses): | |||
53 | QUOTA_NL_BSOFTLONGWARN - space (block) softlimit is exceeded | 53 | QUOTA_NL_BSOFTLONGWARN - space (block) softlimit is exceeded |
54 | longer than given grace period. | 54 | longer than given grace period. |
55 | QUOTA_NL_BSOFTWARN - space (block) softlimit | 55 | QUOTA_NL_BSOFTWARN - space (block) softlimit |
56 | - four warnings are also defined for the event when user stops | ||
57 | exceeding some limit: | ||
58 | QUOTA_NL_IHARDBELOW - inode hardlimit | ||
59 | QUOTA_NL_ISOFTBELOW - inode softlimit | ||
60 | QUOTA_NL_BHARDBELOW - space (block) hardlimit | ||
61 | QUOTA_NL_BSOFTBELOW - space (block) softlimit | ||
56 | QUOTA_NL_A_DEV_MAJOR (u32) | 62 | QUOTA_NL_A_DEV_MAJOR (u32) |
57 | - major number of a device with the affected filesystem | 63 | - major number of a device with the affected filesystem |
58 | QUOTA_NL_A_DEV_MINOR (u32) | 64 | QUOTA_NL_A_DEV_MINOR (u32) |
diff --git a/Documentation/filesystems/ramfs-rootfs-initramfs.txt b/Documentation/filesystems/ramfs-rootfs-initramfs.txt index 7be232b44ee4..62fe9b1e0890 100644 --- a/Documentation/filesystems/ramfs-rootfs-initramfs.txt +++ b/Documentation/filesystems/ramfs-rootfs-initramfs.txt | |||
@@ -263,7 +263,7 @@ User Mode Linux, like so: | |||
263 | sleep(999999999); | 263 | sleep(999999999); |
264 | } | 264 | } |
265 | EOF | 265 | EOF |
266 | gcc -static hello2.c -o init | 266 | gcc -static hello.c -o init |
267 | echo init | cpio -o -H newc | gzip > test.cpio.gz | 267 | echo init | cpio -o -H newc | gzip > test.cpio.gz |
268 | # Testing external initramfs using the initrd loading mechanism. | 268 | # Testing external initramfs using the initrd loading mechanism. |
269 | qemu -kernel /boot/vmlinuz -initrd test.cpio.gz /dev/zero | 269 | qemu -kernel /boot/vmlinuz -initrd test.cpio.gz /dev/zero |
diff --git a/Documentation/filesystems/relay.txt b/Documentation/filesystems/relay.txt index 094f2d2f38b1..510b722667ac 100644 --- a/Documentation/filesystems/relay.txt +++ b/Documentation/filesystems/relay.txt | |||
@@ -294,6 +294,16 @@ user-defined data with a channel, and is immediately available | |||
294 | (including in create_buf_file()) via chan->private_data or | 294 | (including in create_buf_file()) via chan->private_data or |
295 | buf->chan->private_data. | 295 | buf->chan->private_data. |
296 | 296 | ||
297 | Buffer-only channels | ||
298 | -------------------- | ||
299 | |||
300 | These channels have no files associated and can be created with | ||
301 | relay_open(NULL, NULL, ...). Such channels are useful in scenarios such | ||
302 | as when doing early tracing in the kernel, before the VFS is up. In these | ||
303 | cases, one may open a buffer-only channel and then call | ||
304 | relay_late_setup_files() when the kernel is ready to handle files, | ||
305 | to expose the buffered data to the userspace. | ||
306 | |||
297 | Channel 'modes' | 307 | Channel 'modes' |
298 | --------------- | 308 | --------------- |
299 | 309 | ||
diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt index 7f27b8f840d0..9e9c348275a9 100644 --- a/Documentation/filesystems/sysfs.txt +++ b/Documentation/filesystems/sysfs.txt | |||
@@ -248,6 +248,7 @@ The top level sysfs directory looks like: | |||
248 | block/ | 248 | block/ |
249 | bus/ | 249 | bus/ |
250 | class/ | 250 | class/ |
251 | dev/ | ||
251 | devices/ | 252 | devices/ |
252 | firmware/ | 253 | firmware/ |
253 | net/ | 254 | net/ |
@@ -274,6 +275,11 @@ fs/ contains a directory for some filesystems. Currently each | |||
274 | filesystem wanting to export attributes must create its own hierarchy | 275 | filesystem wanting to export attributes must create its own hierarchy |
275 | below fs/ (see ./fuse.txt for an example). | 276 | below fs/ (see ./fuse.txt for an example). |
276 | 277 | ||
278 | dev/ contains two directories char/ and block/. Inside these two | ||
279 | directories there are symlinks named <major>:<minor>. These symlinks | ||
280 | point to the sysfs directory for the given device. /sys/dev provides a | ||
281 | quick way to lookup the sysfs interface for a device from the result of | ||
282 | a stat(2) operation. | ||
277 | 283 | ||
278 | More information can driver-model specific features can be found in | 284 | More information can driver-model specific features can be found in |
279 | Documentation/driver-model/. | 285 | Documentation/driver-model/. |
diff --git a/Documentation/filesystems/ubifs.txt b/Documentation/filesystems/ubifs.txt index 540e9e7f59c5..dd84ea3c10da 100644 --- a/Documentation/filesystems/ubifs.txt +++ b/Documentation/filesystems/ubifs.txt | |||
@@ -57,7 +57,7 @@ Similarly to JFFS2, UBIFS supports on-the-flight compression which makes | |||
57 | it possible to fit quite a lot of data to the flash. | 57 | it possible to fit quite a lot of data to the flash. |
58 | 58 | ||
59 | Similarly to JFFS2, UBIFS is tolerant of unclean reboots and power-cuts. | 59 | Similarly to JFFS2, UBIFS is tolerant of unclean reboots and power-cuts. |
60 | It does not need stuff like ckfs.ext2. UBIFS automatically replays its | 60 | It does not need stuff like fsck.ext2. UBIFS automatically replays its |
61 | journal and recovers from crashes, ensuring that the on-flash data | 61 | journal and recovers from crashes, ensuring that the on-flash data |
62 | structures are consistent. | 62 | structures are consistent. |
63 | 63 | ||
@@ -86,6 +86,15 @@ norm_unmount (*) commit on unmount; the journal is committed | |||
86 | fast_unmount do not commit on unmount; this option makes | 86 | fast_unmount do not commit on unmount; this option makes |
87 | unmount faster, but the next mount slower | 87 | unmount faster, but the next mount slower |
88 | because of the need to replay the journal. | 88 | because of the need to replay the journal. |
89 | bulk_read read more in one go to take advantage of flash | ||
90 | media that read faster sequentially | ||
91 | no_bulk_read (*) do not bulk-read | ||
92 | no_chk_data_crc skip checking of CRCs on data nodes in order to | ||
93 | improve read performance. Use this option only | ||
94 | if the flash media is highly reliable. The effect | ||
95 | of this option is that corruption of the contents | ||
96 | of a file can go unnoticed. | ||
97 | chk_data_crc (*) do not skip checking CRCs on data nodes | ||
89 | 98 | ||
90 | 99 | ||
91 | Quick usage instructions | 100 | Quick usage instructions |
diff --git a/Documentation/filesystems/vfat.txt b/Documentation/filesystems/vfat.txt index 2d5e1e582e13..bbac4f1d9056 100644 --- a/Documentation/filesystems/vfat.txt +++ b/Documentation/filesystems/vfat.txt | |||
@@ -96,6 +96,14 @@ shortname=lower|win95|winnt|mixed | |||
96 | emulate the Windows 95 rule for create. | 96 | emulate the Windows 95 rule for create. |
97 | Default setting is `lower'. | 97 | Default setting is `lower'. |
98 | 98 | ||
99 | tz=UTC -- Interpret timestamps as UTC rather than local time. | ||
100 | This option disables the conversion of timestamps | ||
101 | between local time (as used by Windows on FAT) and UTC | ||
102 | (which Linux uses internally). This is particuluarly | ||
103 | useful when mounting devices (like digital cameras) | ||
104 | that are set to UTC in order to avoid the pitfalls of | ||
105 | local time. | ||
106 | |||
99 | <bool>: 0,1,yes,no,true,false | 107 | <bool>: 0,1,yes,no,true,false |
100 | 108 | ||
101 | TODO | 109 | TODO |
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index b7522c6cbae3..c4d348dabe94 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt | |||
@@ -143,7 +143,7 @@ struct file_system_type { | |||
143 | 143 | ||
144 | The get_sb() method has the following arguments: | 144 | The get_sb() method has the following arguments: |
145 | 145 | ||
146 | struct file_system_type *fs_type: decribes the filesystem, partly initialized | 146 | struct file_system_type *fs_type: describes the filesystem, partly initialized |
147 | by the specific filesystem code | 147 | by the specific filesystem code |
148 | 148 | ||
149 | int flags: mount flags | 149 | int flags: mount flags |
@@ -895,9 +895,9 @@ struct dentry_operations { | |||
895 | iput() yourself | 895 | iput() yourself |
896 | 896 | ||
897 | d_dname: called when the pathname of a dentry should be generated. | 897 | d_dname: called when the pathname of a dentry should be generated. |
898 | Usefull for some pseudo filesystems (sockfs, pipefs, ...) to delay | 898 | Useful for some pseudo filesystems (sockfs, pipefs, ...) to delay |
899 | pathname generation. (Instead of doing it when dentry is created, | 899 | pathname generation. (Instead of doing it when dentry is created, |
900 | its done only when the path is needed.). Real filesystems probably | 900 | it's done only when the path is needed.). Real filesystems probably |
901 | dont want to use it, because their dentries are present in global | 901 | dont want to use it, because their dentries are present in global |
902 | dcache hash, so their hash should be an invariant. As no lock is | 902 | dcache hash, so their hash should be an invariant. As no lock is |
903 | held, d_dname() should not try to modify the dentry itself, unless | 903 | held, d_dname() should not try to modify the dentry itself, unless |
diff --git a/Documentation/ftrace.txt b/Documentation/ftrace.txt index f218f616ff6b..d330fe3103da 100644 --- a/Documentation/ftrace.txt +++ b/Documentation/ftrace.txt | |||
@@ -4,6 +4,7 @@ | |||
4 | Copyright 2008 Red Hat Inc. | 4 | Copyright 2008 Red Hat Inc. |
5 | Author: Steven Rostedt <srostedt@redhat.com> | 5 | Author: Steven Rostedt <srostedt@redhat.com> |
6 | License: The GNU Free Documentation License, Version 1.2 | 6 | License: The GNU Free Documentation License, Version 1.2 |
7 | (dual licensed under the GPL v2) | ||
7 | Reviewers: Elias Oltmanns, Randy Dunlap, Andrew Morton, | 8 | Reviewers: Elias Oltmanns, Randy Dunlap, Andrew Morton, |
8 | John Kacur, and David Teigland. | 9 | John Kacur, and David Teigland. |
9 | 10 | ||
diff --git a/Documentation/gpio.txt b/Documentation/gpio.txt index c35ca9e40d4c..b1b988701247 100644 --- a/Documentation/gpio.txt +++ b/Documentation/gpio.txt | |||
@@ -240,6 +240,10 @@ signal, or (b) something wrongly believes it's safe to remove drivers | |||
240 | needed to manage a signal that's in active use. That is, requesting a | 240 | needed to manage a signal that's in active use. That is, requesting a |
241 | GPIO can serve as a kind of lock. | 241 | GPIO can serve as a kind of lock. |
242 | 242 | ||
243 | Some platforms may also use knowledge about what GPIOs are active for | ||
244 | power management, such as by powering down unused chip sectors and, more | ||
245 | easily, gating off unused clocks. | ||
246 | |||
243 | These two calls are optional because not not all current Linux platforms | 247 | These two calls are optional because not not all current Linux platforms |
244 | offer such functionality in their GPIO support; a valid implementation | 248 | offer such functionality in their GPIO support; a valid implementation |
245 | could return success for all gpio_request() calls. Unlike the other calls, | 249 | could return success for all gpio_request() calls. Unlike the other calls, |
@@ -264,7 +268,7 @@ map between them using calls like: | |||
264 | /* map GPIO numbers to IRQ numbers */ | 268 | /* map GPIO numbers to IRQ numbers */ |
265 | int gpio_to_irq(unsigned gpio); | 269 | int gpio_to_irq(unsigned gpio); |
266 | 270 | ||
267 | /* map IRQ numbers to GPIO numbers */ | 271 | /* map IRQ numbers to GPIO numbers (avoid using this) */ |
268 | int irq_to_gpio(unsigned irq); | 272 | int irq_to_gpio(unsigned irq); |
269 | 273 | ||
270 | Those return either the corresponding number in the other namespace, or | 274 | Those return either the corresponding number in the other namespace, or |
@@ -284,7 +288,8 @@ system wakeup capabilities. | |||
284 | 288 | ||
285 | Non-error values returned from irq_to_gpio() would most commonly be used | 289 | Non-error values returned from irq_to_gpio() would most commonly be used |
286 | with gpio_get_value(), for example to initialize or update driver state | 290 | with gpio_get_value(), for example to initialize or update driver state |
287 | when the IRQ is edge-triggered. | 291 | when the IRQ is edge-triggered. Note that some platforms don't support |
292 | this reverse mapping, so you should avoid using it. | ||
288 | 293 | ||
289 | 294 | ||
290 | Emulating Open Drain Signals | 295 | Emulating Open Drain Signals |
@@ -347,15 +352,12 @@ necessarily be nonportable. | |||
347 | Dynamic definition of GPIOs is not currently standard; for example, as | 352 | Dynamic definition of GPIOs is not currently standard; for example, as |
348 | a side effect of configuring an add-on board with some GPIO expanders. | 353 | a side effect of configuring an add-on board with some GPIO expanders. |
349 | 354 | ||
350 | These calls are purely for kernel space, but a userspace API could be built | ||
351 | on top of them. | ||
352 | |||
353 | 355 | ||
354 | GPIO implementor's framework (OPTIONAL) | 356 | GPIO implementor's framework (OPTIONAL) |
355 | ======================================= | 357 | ======================================= |
356 | As noted earlier, there is an optional implementation framework making it | 358 | As noted earlier, there is an optional implementation framework making it |
357 | easier for platforms to support different kinds of GPIO controller using | 359 | easier for platforms to support different kinds of GPIO controller using |
358 | the same programming interface. | 360 | the same programming interface. This framework is called "gpiolib". |
359 | 361 | ||
360 | As a debugging aid, if debugfs is available a /sys/kernel/debug/gpio file | 362 | As a debugging aid, if debugfs is available a /sys/kernel/debug/gpio file |
361 | will be found there. That will list all the controllers registered through | 363 | will be found there. That will list all the controllers registered through |
@@ -392,11 +394,21 @@ either NULL or the label associated with that GPIO when it was requested. | |||
392 | 394 | ||
393 | Platform Support | 395 | Platform Support |
394 | ---------------- | 396 | ---------------- |
395 | To support this framework, a platform's Kconfig will "select HAVE_GPIO_LIB" | 397 | To support this framework, a platform's Kconfig will "select" either |
398 | ARCH_REQUIRE_GPIOLIB or ARCH_WANT_OPTIONAL_GPIOLIB | ||
396 | and arrange that its <asm/gpio.h> includes <asm-generic/gpio.h> and defines | 399 | and arrange that its <asm/gpio.h> includes <asm-generic/gpio.h> and defines |
397 | three functions: gpio_get_value(), gpio_set_value(), and gpio_cansleep(). | 400 | three functions: gpio_get_value(), gpio_set_value(), and gpio_cansleep(). |
398 | They may also want to provide a custom value for ARCH_NR_GPIOS. | 401 | They may also want to provide a custom value for ARCH_NR_GPIOS. |
399 | 402 | ||
403 | ARCH_REQUIRE_GPIOLIB means that the gpio-lib code will always get compiled | ||
404 | into the kernel on that architecture. | ||
405 | |||
406 | ARCH_WANT_OPTIONAL_GPIOLIB means the gpio-lib code defaults to off and the user | ||
407 | can enable it and build it into the kernel optionally. | ||
408 | |||
409 | If neither of these options are selected, the platform does not support | ||
410 | GPIOs through GPIO-lib and the code cannot be enabled by the user. | ||
411 | |||
400 | Trivial implementations of those functions can directly use framework | 412 | Trivial implementations of those functions can directly use framework |
401 | code, which always dispatches through the gpio_chip: | 413 | code, which always dispatches through the gpio_chip: |
402 | 414 | ||
@@ -439,4 +451,120 @@ becomes available. That may mean the device should not be registered until | |||
439 | calls for that GPIO can work. One way to address such dependencies is for | 451 | calls for that GPIO can work. One way to address such dependencies is for |
440 | such gpio_chip controllers to provide setup() and teardown() callbacks to | 452 | such gpio_chip controllers to provide setup() and teardown() callbacks to |
441 | board specific code; those board specific callbacks would register devices | 453 | board specific code; those board specific callbacks would register devices |
442 | once all the necessary resources are available. | 454 | once all the necessary resources are available, and remove them later when |
455 | the GPIO controller device becomes unavailable. | ||
456 | |||
457 | |||
458 | Sysfs Interface for Userspace (OPTIONAL) | ||
459 | ======================================== | ||
460 | Platforms which use the "gpiolib" implementors framework may choose to | ||
461 | configure a sysfs user interface to GPIOs. This is different from the | ||
462 | debugfs interface, since it provides control over GPIO direction and | ||
463 | value instead of just showing a gpio state summary. Plus, it could be | ||
464 | present on production systems without debugging support. | ||
465 | |||
466 | Given approprate hardware documentation for the system, userspace could | ||
467 | know for example that GPIO #23 controls the write protect line used to | ||
468 | protect boot loader segments in flash memory. System upgrade procedures | ||
469 | may need to temporarily remove that protection, first importing a GPIO, | ||
470 | then changing its output state, then updating the code before re-enabling | ||
471 | the write protection. In normal use, GPIO #23 would never be touched, | ||
472 | and the kernel would have no need to know about it. | ||
473 | |||
474 | Again depending on appropriate hardware documentation, on some systems | ||
475 | userspace GPIO can be used to determine system configuration data that | ||
476 | standard kernels won't know about. And for some tasks, simple userspace | ||
477 | GPIO drivers could be all that the system really needs. | ||
478 | |||
479 | Note that standard kernel drivers exist for common "LEDs and Buttons" | ||
480 | GPIO tasks: "leds-gpio" and "gpio_keys", respectively. Use those | ||
481 | instead of talking directly to the GPIOs; they integrate with kernel | ||
482 | frameworks better than your userspace code could. | ||
483 | |||
484 | |||
485 | Paths in Sysfs | ||
486 | -------------- | ||
487 | There are three kinds of entry in /sys/class/gpio: | ||
488 | |||
489 | - Control interfaces used to get userspace control over GPIOs; | ||
490 | |||
491 | - GPIOs themselves; and | ||
492 | |||
493 | - GPIO controllers ("gpio_chip" instances). | ||
494 | |||
495 | That's in addition to standard files including the "device" symlink. | ||
496 | |||
497 | The control interfaces are write-only: | ||
498 | |||
499 | /sys/class/gpio/ | ||
500 | |||
501 | "export" ... Userspace may ask the kernel to export control of | ||
502 | a GPIO to userspace by writing its number to this file. | ||
503 | |||
504 | Example: "echo 19 > export" will create a "gpio19" node | ||
505 | for GPIO #19, if that's not requested by kernel code. | ||
506 | |||
507 | "unexport" ... Reverses the effect of exporting to userspace. | ||
508 | |||
509 | Example: "echo 19 > unexport" will remove a "gpio19" | ||
510 | node exported using the "export" file. | ||
511 | |||
512 | GPIO signals have paths like /sys/class/gpio/gpio42/ (for GPIO #42) | ||
513 | and have the following read/write attributes: | ||
514 | |||
515 | /sys/class/gpio/gpioN/ | ||
516 | |||
517 | "direction" ... reads as either "in" or "out". This value may | ||
518 | normally be written. Writing as "out" defaults to | ||
519 | initializing the value as low. To ensure glitch free | ||
520 | operation, values "low" and "high" may be written to | ||
521 | configure the GPIO as an output with that initial value. | ||
522 | |||
523 | Note that this attribute *will not exist* if the kernel | ||
524 | doesn't support changing the direction of a GPIO, or | ||
525 | it was exported by kernel code that didn't explicitly | ||
526 | allow userspace to reconfigure this GPIO's direction. | ||
527 | |||
528 | "value" ... reads as either 0 (low) or 1 (high). If the GPIO | ||
529 | is configured as an output, this value may be written; | ||
530 | any nonzero value is treated as high. | ||
531 | |||
532 | GPIO controllers have paths like /sys/class/gpio/chipchip42/ (for the | ||
533 | controller implementing GPIOs starting at #42) and have the following | ||
534 | read-only attributes: | ||
535 | |||
536 | /sys/class/gpio/gpiochipN/ | ||
537 | |||
538 | "base" ... same as N, the first GPIO managed by this chip | ||
539 | |||
540 | "label" ... provided for diagnostics (not always unique) | ||
541 | |||
542 | "ngpio" ... how many GPIOs this manges (N to N + ngpio - 1) | ||
543 | |||
544 | Board documentation should in most cases cover what GPIOs are used for | ||
545 | what purposes. However, those numbers are not always stable; GPIOs on | ||
546 | a daughtercard might be different depending on the base board being used, | ||
547 | or other cards in the stack. In such cases, you may need to use the | ||
548 | gpiochip nodes (possibly in conjunction with schematics) to determine | ||
549 | the correct GPIO number to use for a given signal. | ||
550 | |||
551 | |||
552 | Exporting from Kernel code | ||
553 | -------------------------- | ||
554 | Kernel code can explicitly manage exports of GPIOs which have already been | ||
555 | requested using gpio_request(): | ||
556 | |||
557 | /* export the GPIO to userspace */ | ||
558 | int gpio_export(unsigned gpio, bool direction_may_change); | ||
559 | |||
560 | /* reverse gpio_export() */ | ||
561 | void gpio_unexport(); | ||
562 | |||
563 | After a kernel driver requests a GPIO, it may only be made available in | ||
564 | the sysfs interface by gpio_export(). The driver can control whether the | ||
565 | signal direction may change. This helps drivers prevent userspace code | ||
566 | from accidentally clobbering important system state. | ||
567 | |||
568 | This explicit exporting can help with debugging (by making some kinds | ||
569 | of experiments easier), or can provide an always-there interface that's | ||
570 | suitable for documenting as part of a board support package. | ||
diff --git a/Documentation/hwmon/adt7470 b/Documentation/hwmon/adt7470 new file mode 100644 index 000000000000..75d13ca147cc --- /dev/null +++ b/Documentation/hwmon/adt7470 | |||
@@ -0,0 +1,76 @@ | |||
1 | Kernel driver adt7470 | ||
2 | ===================== | ||
3 | |||
4 | Supported chips: | ||
5 | * Analog Devices ADT7470 | ||
6 | Prefix: 'adt7470' | ||
7 | Addresses scanned: I2C 0x2C, 0x2E, 0x2F | ||
8 | Datasheet: Publicly available at the Analog Devices website | ||
9 | |||
10 | Author: Darrick J. Wong | ||
11 | |||
12 | Description | ||
13 | ----------- | ||
14 | |||
15 | This driver implements support for the Analog Devices ADT7470 chip. There may | ||
16 | be other chips that implement this interface. | ||
17 | |||
18 | The ADT7470 uses the 2-wire interface compatible with the SMBus 2.0 | ||
19 | specification. Using an analog to digital converter it measures up to ten (10) | ||
20 | external temperatures. It has four (4) 16-bit counters for measuring fan speed. | ||
21 | There are four (4) PWM outputs that can be used to control fan speed. | ||
22 | |||
23 | A sophisticated control system for the PWM outputs is designed into the ADT7470 | ||
24 | that allows fan speed to be adjusted automatically based on any of the ten | ||
25 | temperature sensors. Each PWM output is individually adjustable and | ||
26 | programmable. Once configured, the ADT7470 will adjust the PWM outputs in | ||
27 | response to the measured temperatures with further host intervention. This | ||
28 | feature can also be disabled for manual control of the PWM's. | ||
29 | |||
30 | Each of the measured inputs (temperature, fan speed) has corresponding high/low | ||
31 | limit values. The ADT7470 will signal an ALARM if any measured value exceeds | ||
32 | either limit. | ||
33 | |||
34 | The ADT7470 DOES NOT sample all inputs continuously. A single pin on the | ||
35 | ADT7470 is connected to a multitude of thermal diodes, but the chip must be | ||
36 | instructed explicitly to read the multitude of diodes. If you want to use | ||
37 | automatic fan control mode, you must manually read any of the temperature | ||
38 | sensors or the fan control algorithm will not run. The chip WILL NOT DO THIS | ||
39 | AUTOMATICALLY; this must be done from userspace. This may be a bug in the chip | ||
40 | design, given that many other AD chips take care of this. The driver will not | ||
41 | read the registers more often than once every 5 seconds. Further, | ||
42 | configuration data is only read once per minute. | ||
43 | |||
44 | Special Features | ||
45 | ---------------- | ||
46 | |||
47 | The ADT7470 has a 8-bit ADC and is capable of measuring temperatures with 1 | ||
48 | degC resolution. | ||
49 | |||
50 | The Analog Devices datasheet is very detailed and describes a procedure for | ||
51 | determining an optimal configuration for the automatic PWM control. | ||
52 | |||
53 | Configuration Notes | ||
54 | ------------------- | ||
55 | |||
56 | Besides standard interfaces driver adds the following: | ||
57 | |||
58 | * PWM Control | ||
59 | |||
60 | * pwm#_auto_point1_pwm and pwm#_auto_point1_temp and | ||
61 | * pwm#_auto_point2_pwm and pwm#_auto_point2_temp - | ||
62 | |||
63 | point1: Set the pwm speed at a lower temperature bound. | ||
64 | point2: Set the pwm speed at a higher temperature bound. | ||
65 | |||
66 | The ADT7470 will scale the pwm between the lower and higher pwm speed when | ||
67 | the temperature is between the two temperature boundaries. PWM values range | ||
68 | from 0 (off) to 255 (full speed). Fan speed will be set to maximum when the | ||
69 | temperature sensor associated with the PWM control exceeds | ||
70 | pwm#_auto_point2_temp. | ||
71 | |||
72 | Notes | ||
73 | ----- | ||
74 | |||
75 | As stated above, the temperature inputs must be read periodically from | ||
76 | userspace in order for the automatic pwm algorithm to run. | ||
diff --git a/Documentation/hwmon/adt7473 b/Documentation/hwmon/adt7473 index 2126de34c711..1cbf671822e2 100644 --- a/Documentation/hwmon/adt7473 +++ b/Documentation/hwmon/adt7473 | |||
@@ -14,14 +14,14 @@ Description | |||
14 | 14 | ||
15 | This driver implements support for the Analog Devices ADT7473 chip family. | 15 | This driver implements support for the Analog Devices ADT7473 chip family. |
16 | 16 | ||
17 | The LM85 uses the 2-wire interface compatible with the SMBUS 2.0 | 17 | The ADT7473 uses the 2-wire interface compatible with the SMBUS 2.0 |
18 | specification. Using an analog to digital converter it measures three (3) | 18 | specification. Using an analog to digital converter it measures three (3) |
19 | temperatures and two (2) voltages. It has three (3) 16-bit counters for | 19 | temperatures and two (2) voltages. It has four (4) 16-bit counters for |
20 | measuring fan speed. There are three (3) PWM outputs that can be used | 20 | measuring fan speed. There are three (3) PWM outputs that can be used |
21 | to control fan speed. | 21 | to control fan speed. |
22 | 22 | ||
23 | A sophisticated control system for the PWM outputs is designed into the | 23 | A sophisticated control system for the PWM outputs is designed into the |
24 | LM85 that allows fan speed to be adjusted automatically based on any of the | 24 | ADT7473 that allows fan speed to be adjusted automatically based on any of the |
25 | three temperature sensors. Each PWM output is individually adjustable and | 25 | three temperature sensors. Each PWM output is individually adjustable and |
26 | programmable. Once configured, the ADT7473 will adjust the PWM outputs in | 26 | programmable. Once configured, the ADT7473 will adjust the PWM outputs in |
27 | response to the measured temperatures without further host intervention. | 27 | response to the measured temperatures without further host intervention. |
@@ -46,14 +46,6 @@ from the raw value to get the temperature value. | |||
46 | The Analog Devices datasheet is very detailed and describes a procedure for | 46 | The Analog Devices datasheet is very detailed and describes a procedure for |
47 | determining an optimal configuration for the automatic PWM control. | 47 | determining an optimal configuration for the automatic PWM control. |
48 | 48 | ||
49 | Hardware Configurations | ||
50 | ----------------------- | ||
51 | |||
52 | The ADT7473 chips have an optional SMBALERT output that can be used to | ||
53 | signal the chipset in case a limit is exceeded or the temperature sensors | ||
54 | fail. Individual sensor interrupts can be masked so they won't trigger | ||
55 | SMBALERT. The SMBALERT output if configured replaces the PWM2 function. | ||
56 | |||
57 | Configuration Notes | 49 | Configuration Notes |
58 | ------------------- | 50 | ------------------- |
59 | 51 | ||
@@ -61,8 +53,8 @@ Besides standard interfaces driver adds the following: | |||
61 | 53 | ||
62 | * PWM Control | 54 | * PWM Control |
63 | 55 | ||
64 | * pwm#_auto_point1_pwm and pwm#_auto_point1_temp and | 56 | * pwm#_auto_point1_pwm and temp#_auto_point1_temp and |
65 | * pwm#_auto_point2_pwm and pwm#_auto_point2_temp - | 57 | * pwm#_auto_point2_pwm and temp#_auto_point2_temp - |
66 | 58 | ||
67 | point1: Set the pwm speed at a lower temperature bound. | 59 | point1: Set the pwm speed at a lower temperature bound. |
68 | point2: Set the pwm speed at a higher temperature bound. | 60 | point2: Set the pwm speed at a higher temperature bound. |
diff --git a/Documentation/hwmon/dme1737 b/Documentation/hwmon/dme1737 index 8f446070e64a..001d2e70bc11 100644 --- a/Documentation/hwmon/dme1737 +++ b/Documentation/hwmon/dme1737 | |||
@@ -10,6 +10,10 @@ Supported chips: | |||
10 | Prefix: 'sch311x' | 10 | Prefix: 'sch311x' |
11 | Addresses scanned: none, address read from Super-I/O config space | 11 | Addresses scanned: none, address read from Super-I/O config space |
12 | Datasheet: http://www.nuhorizons.com/FeaturedProducts/Volume1/SMSC/311x.pdf | 12 | Datasheet: http://www.nuhorizons.com/FeaturedProducts/Volume1/SMSC/311x.pdf |
13 | * SMSC SCH5027 | ||
14 | Prefix: 'sch5027' | ||
15 | Addresses scanned: I2C 0x2c, 0x2d, 0x2e | ||
16 | Datasheet: Provided by SMSC upon request and under NDA | ||
13 | 17 | ||
14 | Authors: | 18 | Authors: |
15 | Juerg Haefliger <juergh@gmail.com> | 19 | Juerg Haefliger <juergh@gmail.com> |
@@ -22,34 +26,36 @@ Module Parameters | |||
22 | and PWM output control functions. Using this parameter | 26 | and PWM output control functions. Using this parameter |
23 | shouldn't be required since the BIOS usually takes care | 27 | shouldn't be required since the BIOS usually takes care |
24 | of this. | 28 | of this. |
25 | 29 | * probe_all_addr: bool Include non-standard LPC addresses 0x162e and 0x164e | |
26 | Note that there is no need to use this parameter if the driver loads without | 30 | when probing for ISA devices. This is required for the |
27 | complaining. The driver will say so if it is necessary. | 31 | following boards: |
32 | - VIA EPIA SN18000 | ||
28 | 33 | ||
29 | 34 | ||
30 | Description | 35 | Description |
31 | ----------- | 36 | ----------- |
32 | 37 | ||
33 | This driver implements support for the hardware monitoring capabilities of the | 38 | This driver implements support for the hardware monitoring capabilities of the |
34 | SMSC DME1737 and Asus A8000 (which are the same) and SMSC SCH311x Super-I/O | 39 | SMSC DME1737 and Asus A8000 (which are the same), SMSC SCH5027, and SMSC |
35 | chips. These chips feature monitoring of 3 temp sensors temp[1-3] (2 remote | 40 | SCH311x Super-I/O chips. These chips feature monitoring of 3 temp sensors |
36 | diodes and 1 internal), 7 voltages in[0-6] (6 external and 1 internal) and up | 41 | temp[1-3] (2 remote diodes and 1 internal), 7 voltages in[0-6] (6 external and |
37 | to 6 fan speeds fan[1-6]. Additionally, the chips implement up to 5 PWM | 42 | 1 internal) and up to 6 fan speeds fan[1-6]. Additionally, the chips implement |
38 | outputs pwm[1-3,5-6] for controlling fan speeds both manually and | 43 | up to 5 PWM outputs pwm[1-3,5-6] for controlling fan speeds both manually and |
39 | automatically. | 44 | automatically. |
40 | 45 | ||
41 | For the DME1737 and A8000, fan[1-2] and pwm[1-2] are always present. Fan[3-6] | 46 | For the DME1737, A8000 and SCH5027, fan[1-2] and pwm[1-2] are always present. |
42 | and pwm[3,5-6] are optional features and their availability depends on the | 47 | Fan[3-6] and pwm[3,5-6] are optional features and their availability depends on |
43 | configuration of the chip. The driver will detect which features are present | 48 | the configuration of the chip. The driver will detect which features are |
44 | during initialization and create the sysfs attributes accordingly. | 49 | present during initialization and create the sysfs attributes accordingly. |
45 | 50 | ||
46 | For the SCH311x, fan[1-3] and pwm[1-3] are always present and fan[4-6] and | 51 | For the SCH311x, fan[1-3] and pwm[1-3] are always present and fan[4-6] and |
47 | pwm[5-6] don't exist. | 52 | pwm[5-6] don't exist. |
48 | 53 | ||
49 | The hardware monitoring features of the DME1737 and A8000 are only accessible | 54 | The hardware monitoring features of the DME1737, A8000, and SCH5027 are only |
50 | via SMBus, while the SCH311x only provides access via the ISA bus. The driver | 55 | accessible via SMBus, while the SCH311x only provides access via the ISA bus. |
51 | will therefore register itself as an I2C client driver if it detects a DME1737 | 56 | The driver will therefore register itself as an I2C client driver if it detects |
52 | or A8000 and as a platform driver if it detects a SCH311x chip. | 57 | a DME1737, A8000, or SCH5027 and as a platform driver if it detects a SCH311x |
58 | chip. | ||
53 | 59 | ||
54 | 60 | ||
55 | Voltage Monitoring | 61 | Voltage Monitoring |
@@ -60,6 +66,7 @@ scaling resistors. The values returned by the driver therefore reflect true | |||
60 | millivolts and don't need scaling. The voltage inputs are mapped as follows | 66 | millivolts and don't need scaling. The voltage inputs are mapped as follows |
61 | (the last column indicates the input ranges): | 67 | (the last column indicates the input ranges): |
62 | 68 | ||
69 | DME1737, A8000: | ||
63 | in0: +5VTR (+5V standby) 0V - 6.64V | 70 | in0: +5VTR (+5V standby) 0V - 6.64V |
64 | in1: Vccp (processor core) 0V - 3V | 71 | in1: Vccp (processor core) 0V - 3V |
65 | in2: VCC (internal +3.3V) 0V - 4.38V | 72 | in2: VCC (internal +3.3V) 0V - 4.38V |
@@ -68,6 +75,24 @@ millivolts and don't need scaling. The voltage inputs are mapped as follows | |||
68 | in5: VTR (+3.3V standby) 0V - 4.38V | 75 | in5: VTR (+3.3V standby) 0V - 4.38V |
69 | in6: Vbat (+3.0V) 0V - 4.38V | 76 | in6: Vbat (+3.0V) 0V - 4.38V |
70 | 77 | ||
78 | SCH311x: | ||
79 | in0: +2.5V 0V - 6.64V | ||
80 | in1: Vccp (processor core) 0V - 2V | ||
81 | in2: VCC (internal +3.3V) 0V - 4.38V | ||
82 | in3: +5V 0V - 6.64V | ||
83 | in4: +12V 0V - 16V | ||
84 | in5: VTR (+3.3V standby) 0V - 4.38V | ||
85 | in6: Vbat (+3.0V) 0V - 4.38V | ||
86 | |||
87 | SCH5027: | ||
88 | in0: +5VTR (+5V standby) 0V - 6.64V | ||
89 | in1: Vccp (processor core) 0V - 3V | ||
90 | in2: VCC (internal +3.3V) 0V - 4.38V | ||
91 | in3: V2_IN 0V - 1.5V | ||
92 | in4: V1_IN 0V - 1.5V | ||
93 | in5: VTR (+3.3V standby) 0V - 4.38V | ||
94 | in6: Vbat (+3.0V) 0V - 4.38V | ||
95 | |||
71 | Each voltage input has associated min and max limits which trigger an alarm | 96 | Each voltage input has associated min and max limits which trigger an alarm |
72 | when crossed. | 97 | when crossed. |
73 | 98 | ||
diff --git a/Documentation/hwmon/ibmaem b/Documentation/hwmon/ibmaem index 2fefaf582a43..e98bdfea3467 100644 --- a/Documentation/hwmon/ibmaem +++ b/Documentation/hwmon/ibmaem | |||
@@ -1,8 +1,11 @@ | |||
1 | Kernel driver ibmaem | 1 | Kernel driver ibmaem |
2 | ====================== | 2 | ====================== |
3 | 3 | ||
4 | This driver talks to the IBM Systems Director Active Energy Manager, known | ||
5 | henceforth as AEM. | ||
6 | |||
4 | Supported systems: | 7 | Supported systems: |
5 | * Any recent IBM System X server with Active Energy Manager support. | 8 | * Any recent IBM System X server with AEM support. |
6 | This includes the x3350, x3550, x3650, x3655, x3755, x3850 M2, | 9 | This includes the x3350, x3550, x3650, x3655, x3755, x3850 M2, |
7 | x3950 M2, and certain HS2x/LS2x/QS2x blades. The IPMI host interface | 10 | x3950 M2, and certain HS2x/LS2x/QS2x blades. The IPMI host interface |
8 | driver ("ipmi-si") needs to be loaded for this driver to do anything. | 11 | driver ("ipmi-si") needs to be loaded for this driver to do anything. |
@@ -14,24 +17,22 @@ Author: Darrick J. Wong | |||
14 | Description | 17 | Description |
15 | ----------- | 18 | ----------- |
16 | 19 | ||
17 | This driver implements sensor reading support for the energy and power | 20 | This driver implements sensor reading support for the energy and power meters |
18 | meters available on various IBM System X hardware through the BMC. All | 21 | available on various IBM System X hardware through the BMC. All sensor banks |
19 | sensor banks will be exported as platform devices; this driver can talk | 22 | will be exported as platform devices; this driver can talk to both v1 and v2 |
20 | to both v1 and v2 interfaces. This driver is completely separate from the | 23 | interfaces. This driver is completely separate from the older ibmpex driver. |
21 | older ibmpex driver. | ||
22 | 24 | ||
23 | The v1 AEM interface has a simple set of features to monitor energy use. | 25 | The v1 AEM interface has a simple set of features to monitor energy use. There |
24 | There is a register that displays an estimate of raw energy consumption | 26 | is a register that displays an estimate of raw energy consumption since the |
25 | since the last BMC reset, and a power sensor that returns average power | 27 | last BMC reset, and a power sensor that returns average power use over a |
26 | use over a configurable interval. | 28 | configurable interval. |
27 | 29 | ||
28 | The v2 AEM interface is a bit more sophisticated, being able to present | 30 | The v2 AEM interface is a bit more sophisticated, being able to present a wider |
29 | a wider range of energy and power use registers, the power cap as | 31 | range of energy and power use registers, the power cap as set by the AEM |
30 | set by the AEM software, and temperature sensors. | 32 | software, and temperature sensors. |
31 | 33 | ||
32 | Special Features | 34 | Special Features |
33 | ---------------- | 35 | ---------------- |
34 | 36 | ||
35 | The "power_cap" value displays the current system power cap, as set by | 37 | The "power_cap" value displays the current system power cap, as set by the AEM |
36 | the Active Energy Manager software. Setting the power cap from the host | 38 | software. Setting the power cap from the host is not currently supported. |
37 | is not currently supported. | ||
diff --git a/Documentation/hwmon/it87 b/Documentation/hwmon/it87 index f4ce1fdbeff6..042c0415140b 100644 --- a/Documentation/hwmon/it87 +++ b/Documentation/hwmon/it87 | |||
@@ -6,12 +6,14 @@ Supported chips: | |||
6 | Prefix: 'it87' | 6 | Prefix: 'it87' |
7 | Addresses scanned: from Super I/O config space (8 I/O ports) | 7 | Addresses scanned: from Super I/O config space (8 I/O ports) |
8 | Datasheet: Publicly available at the ITE website | 8 | Datasheet: Publicly available at the ITE website |
9 | http://www.ite.com.tw/ | 9 | http://www.ite.com.tw/product_info/file/pc/IT8705F_V.0.4.1.pdf |
10 | * IT8712F | 10 | * IT8712F |
11 | Prefix: 'it8712' | 11 | Prefix: 'it8712' |
12 | Addresses scanned: from Super I/O config space (8 I/O ports) | 12 | Addresses scanned: from Super I/O config space (8 I/O ports) |
13 | Datasheet: Publicly available at the ITE website | 13 | Datasheet: Publicly available at the ITE website |
14 | http://www.ite.com.tw/ | 14 | http://www.ite.com.tw/product_info/file/pc/IT8712F_V0.9.1.pdf |
15 | http://www.ite.com.tw/product_info/file/pc/Errata%20V0.1%20for%20IT8712F%20V0.9.1.pdf | ||
16 | http://www.ite.com.tw/product_info/file/pc/IT8712F_V0.9.3.pdf | ||
15 | * IT8716F/IT8726F | 17 | * IT8716F/IT8726F |
16 | Prefix: 'it8716' | 18 | Prefix: 'it8716' |
17 | Addresses scanned: from Super I/O config space (8 I/O ports) | 19 | Addresses scanned: from Super I/O config space (8 I/O ports) |
@@ -90,14 +92,13 @@ upper VID bits share their pins with voltage inputs (in5 and in6) so you | |||
90 | can't have both on a given board. | 92 | can't have both on a given board. |
91 | 93 | ||
92 | The IT8716F, IT8718F and later IT8712F revisions have support for | 94 | The IT8716F, IT8718F and later IT8712F revisions have support for |
93 | 2 additional fans. They are supported by the driver for the IT8716F and | 95 | 2 additional fans. The additional fans are supported by the driver. |
94 | IT8718F but not for the IT8712F | ||
95 | 96 | ||
96 | The IT8716F and IT8718F, and late IT8712F and IT8705F also have optional | 97 | The IT8716F and IT8718F, and late IT8712F and IT8705F also have optional |
97 | 16-bit tachometer counters for fans 1 to 3. This is better (no more fan | 98 | 16-bit tachometer counters for fans 1 to 3. This is better (no more fan |
98 | clock divider mess) but not compatible with the older chips and | 99 | clock divider mess) but not compatible with the older chips and |
99 | revisions. For now, the driver only uses the 16-bit mode on the | 100 | revisions. The 16-bit tachometer mode is enabled by the driver when one |
100 | IT8716F and IT8718F. | 101 | of the above chips is detected. |
101 | 102 | ||
102 | The IT8726F is just bit enhanced IT8716F with additional hardware | 103 | The IT8726F is just bit enhanced IT8716F with additional hardware |
103 | for AMD power sequencing. Therefore the chip will appear as IT8716F | 104 | for AMD power sequencing. Therefore the chip will appear as IT8716F |
@@ -135,10 +136,10 @@ once-only alarms. | |||
135 | The IT87xx only updates its values each 1.5 seconds; reading it more often | 136 | The IT87xx only updates its values each 1.5 seconds; reading it more often |
136 | will do no harm, but will return 'old' values. | 137 | will do no harm, but will return 'old' values. |
137 | 138 | ||
138 | To change sensor N to a thermistor, 'echo 2 > tempN_type' where N is 1, 2, | 139 | To change sensor N to a thermistor, 'echo 4 > tempN_type' where N is 1, 2, |
139 | or 3. To change sensor N to a thermal diode, 'echo 3 > tempN_type'. | 140 | or 3. To change sensor N to a thermal diode, 'echo 3 > tempN_type'. |
140 | Give 0 for unused sensor. Any other value is invalid. To configure this at | 141 | Give 0 for unused sensor. Any other value is invalid. To configure this at |
141 | startup, consult lm_sensors's /etc/sensors.conf. (2 = thermistor; | 142 | startup, consult lm_sensors's /etc/sensors.conf. (4 = thermistor; |
142 | 3 = thermal diode) | 143 | 3 = thermal diode) |
143 | 144 | ||
144 | 145 | ||
diff --git a/Documentation/hwmon/lm85 b/Documentation/hwmon/lm85 index 9549237530cf..400620741290 100644 --- a/Documentation/hwmon/lm85 +++ b/Documentation/hwmon/lm85 | |||
@@ -96,11 +96,6 @@ initial testing of the ADM1027 it was 1.00 degC steps. Analog Devices has | |||
96 | confirmed this "bug". The ADT7463 is reported to work as described in the | 96 | confirmed this "bug". The ADT7463 is reported to work as described in the |
97 | documentation. The current lm85 driver does not show the offset register. | 97 | documentation. The current lm85 driver does not show the offset register. |
98 | 98 | ||
99 | The ADT7463 has a THERM asserted counter. This counter has a 22.76ms | ||
100 | resolution and a range of 5.8 seconds. The driver implements a 32-bit | ||
101 | accumulator of the counter value to extend the range to over a year. The | ||
102 | counter will stay at it's max value until read. | ||
103 | |||
104 | See the vendor datasheets for more information. There is application note | 99 | See the vendor datasheets for more information. There is application note |
105 | from National (AN-1260) with some additional information about the LM85. | 100 | from National (AN-1260) with some additional information about the LM85. |
106 | The Analog Devices datasheet is very detailed and describes a procedure for | 101 | The Analog Devices datasheet is very detailed and describes a procedure for |
@@ -168,16 +163,6 @@ configured individually according to the following options. | |||
168 | * pwm#_auto_pwm_min - this specifies the PWM value for temp#_auto_temp_off | 163 | * pwm#_auto_pwm_min - this specifies the PWM value for temp#_auto_temp_off |
169 | temperature. (PWM value from 0 to 255) | 164 | temperature. (PWM value from 0 to 255) |
170 | 165 | ||
171 | * pwm#_auto_pwm_freq - select base frequency of PWM output. You can select | ||
172 | in range of 10.0 to 94.0 Hz in .1 Hz units. | ||
173 | (Values 100 to 940). | ||
174 | |||
175 | The pwm#_auto_pwm_freq can be set to one of the following 8 values. Setting the | ||
176 | frequency to a value not on this list, will result in the next higher frequency | ||
177 | being selected. The actual device frequency may vary slightly from this | ||
178 | specification as designed by the manufacturer. Consult the datasheet for more | ||
179 | details. (PWM Frequency values: 100, 150, 230, 300, 380, 470, 620, 940) | ||
180 | |||
181 | * pwm#_auto_pwm_minctl - this flags selects for temp#_auto_temp_off temperature | 166 | * pwm#_auto_pwm_minctl - this flags selects for temp#_auto_temp_off temperature |
182 | the bahaviour of fans. Write 1 to let fans spinning at | 167 | the bahaviour of fans. Write 1 to let fans spinning at |
183 | pwm#_auto_pwm_min or write 0 to let them off. | 168 | pwm#_auto_pwm_min or write 0 to let them off. |
@@ -206,13 +191,15 @@ Configuration choices: | |||
206 | 191 | ||
207 | The National LM85's have two vendor specific configuration | 192 | The National LM85's have two vendor specific configuration |
208 | features. Tach. mode and Spinup Control. For more details on these, | 193 | features. Tach. mode and Spinup Control. For more details on these, |
209 | see the LM85 datasheet or Application Note AN-1260. | 194 | see the LM85 datasheet or Application Note AN-1260. These features |
195 | are not currently supported by the lm85 driver. | ||
210 | 196 | ||
211 | The Analog Devices ADM1027 has several vendor specific enhancements. | 197 | The Analog Devices ADM1027 has several vendor specific enhancements. |
212 | The number of pulses-per-rev of the fans can be set, Tach monitoring | 198 | The number of pulses-per-rev of the fans can be set, Tach monitoring |
213 | can be optimized for PWM operation, and an offset can be applied to | 199 | can be optimized for PWM operation, and an offset can be applied to |
214 | the temperatures to compensate for systemic errors in the | 200 | the temperatures to compensate for systemic errors in the |
215 | measurements. | 201 | measurements. These features are not currently supported by the lm85 |
202 | driver. | ||
216 | 203 | ||
217 | In addition to the ADM1027 features, the ADT7463 also has Tmin control | 204 | In addition to the ADM1027 features, the ADT7463 also has Tmin control |
218 | and THERM asserted counts. Automatic Tmin control acts to adjust the | 205 | and THERM asserted counts. Automatic Tmin control acts to adjust the |
diff --git a/Documentation/hwmon/lm87 b/Documentation/hwmon/lm87 index ec27aa1b94cb..6b47b67fd968 100644 --- a/Documentation/hwmon/lm87 +++ b/Documentation/hwmon/lm87 | |||
@@ -65,11 +65,10 @@ The LM87 has four pins which can serve one of two possible functions, | |||
65 | depending on the hardware configuration. | 65 | depending on the hardware configuration. |
66 | 66 | ||
67 | Some functions share pins, so not all functions are available at the same | 67 | Some functions share pins, so not all functions are available at the same |
68 | time. Which are depends on the hardware setup. This driver assumes that | 68 | time. Which are depends on the hardware setup. This driver normally |
69 | the BIOS configured the chip correctly. In that respect, it differs from | 69 | assumes that firmware configured the chip correctly. Where this is not |
70 | the original driver (from lm_sensors for Linux 2.4), which would force the | 70 | the case, platform code must set the I2C client's platform_data to point |
71 | LM87 to an arbitrary, compile-time chosen mode, regardless of the actual | 71 | to a u8 value to be written to the channel register. |
72 | chipset wiring. | ||
73 | 72 | ||
74 | For reference, here is the list of exclusive functions: | 73 | For reference, here is the list of exclusive functions: |
75 | - in0+in5 (default) or temp3 | 74 | - in0+in5 (default) or temp3 |
diff --git a/Documentation/hwmon/lm90 b/Documentation/hwmon/lm90 index aa4a0ec20081..0e8411710238 100644 --- a/Documentation/hwmon/lm90 +++ b/Documentation/hwmon/lm90 | |||
@@ -8,10 +8,10 @@ Supported chips: | |||
8 | Datasheet: Publicly available at the National Semiconductor website | 8 | Datasheet: Publicly available at the National Semiconductor website |
9 | http://www.national.com/pf/LM/LM90.html | 9 | http://www.national.com/pf/LM/LM90.html |
10 | * National Semiconductor LM89 | 10 | * National Semiconductor LM89 |
11 | Prefix: 'lm99' | 11 | Prefix: 'lm89' (no auto-detection) |
12 | Addresses scanned: I2C 0x4c and 0x4d | 12 | Addresses scanned: I2C 0x4c and 0x4d |
13 | Datasheet: Publicly available at the National Semiconductor website | 13 | Datasheet: Publicly available at the National Semiconductor website |
14 | http://www.national.com/pf/LM/LM89.html | 14 | http://www.national.com/mpf/LM/LM89.html |
15 | * National Semiconductor LM99 | 15 | * National Semiconductor LM99 |
16 | Prefix: 'lm99' | 16 | Prefix: 'lm99' |
17 | Addresses scanned: I2C 0x4c and 0x4d | 17 | Addresses scanned: I2C 0x4c and 0x4d |
@@ -21,18 +21,32 @@ Supported chips: | |||
21 | Prefix: 'lm86' | 21 | Prefix: 'lm86' |
22 | Addresses scanned: I2C 0x4c | 22 | Addresses scanned: I2C 0x4c |
23 | Datasheet: Publicly available at the National Semiconductor website | 23 | Datasheet: Publicly available at the National Semiconductor website |
24 | http://www.national.com/pf/LM/LM86.html | 24 | http://www.national.com/mpf/LM/LM86.html |
25 | * Analog Devices ADM1032 | 25 | * Analog Devices ADM1032 |
26 | Prefix: 'adm1032' | 26 | Prefix: 'adm1032' |
27 | Addresses scanned: I2C 0x4c and 0x4d | 27 | Addresses scanned: I2C 0x4c and 0x4d |
28 | Datasheet: Publicly available at the Analog Devices website | 28 | Datasheet: Publicly available at the ON Semiconductor website |
29 | http://www.analog.com/en/prod/0,2877,ADM1032,00.html | 29 | http://www.onsemi.com/PowerSolutions/product.do?id=ADM1032 |
30 | * Analog Devices ADT7461 | 30 | * Analog Devices ADT7461 |
31 | Prefix: 'adt7461' | 31 | Prefix: 'adt7461' |
32 | Addresses scanned: I2C 0x4c and 0x4d | 32 | Addresses scanned: I2C 0x4c and 0x4d |
33 | Datasheet: Publicly available at the Analog Devices website | 33 | Datasheet: Publicly available at the ON Semiconductor website |
34 | http://www.analog.com/en/prod/0,2877,ADT7461,00.html | 34 | http://www.onsemi.com/PowerSolutions/product.do?id=ADT7461 |
35 | Note: Only if in ADM1032 compatibility mode | 35 | * Maxim MAX6646 |
36 | Prefix: 'max6646' | ||
37 | Addresses scanned: I2C 0x4d | ||
38 | Datasheet: Publicly available at the Maxim website | ||
39 | http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3497 | ||
40 | * Maxim MAX6647 | ||
41 | Prefix: 'max6646' | ||
42 | Addresses scanned: I2C 0x4e | ||
43 | Datasheet: Publicly available at the Maxim website | ||
44 | http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3497 | ||
45 | * Maxim MAX6649 | ||
46 | Prefix: 'max6646' | ||
47 | Addresses scanned: I2C 0x4c | ||
48 | Datasheet: Publicly available at the Maxim website | ||
49 | http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3497 | ||
36 | * Maxim MAX6657 | 50 | * Maxim MAX6657 |
37 | Prefix: 'max6657' | 51 | Prefix: 'max6657' |
38 | Addresses scanned: I2C 0x4c | 52 | Addresses scanned: I2C 0x4c |
@@ -70,25 +84,21 @@ Description | |||
70 | 84 | ||
71 | The LM90 is a digital temperature sensor. It senses its own temperature as | 85 | The LM90 is a digital temperature sensor. It senses its own temperature as |
72 | well as the temperature of up to one external diode. It is compatible | 86 | well as the temperature of up to one external diode. It is compatible |
73 | with many other devices such as the LM86, the LM89, the LM99, the ADM1032, | 87 | with many other devices, many of which are supported by this driver. |
74 | the MAX6657, MAX6658, MAX6659, MAX6680 and the MAX6681 all of which are | ||
75 | supported by this driver. | ||
76 | 88 | ||
77 | Note that there is no easy way to differentiate between the MAX6657, | 89 | Note that there is no easy way to differentiate between the MAX6657, |
78 | MAX6658 and MAX6659 variants. The extra address and features of the | 90 | MAX6658 and MAX6659 variants. The extra address and features of the |
79 | MAX6659 are not supported by this driver. The MAX6680 and MAX6681 only | 91 | MAX6659 are not supported by this driver. The MAX6680 and MAX6681 only |
80 | differ in their pinout, therefore they obviously can't (and don't need to) | 92 | differ in their pinout, therefore they obviously can't (and don't need to) |
81 | be distinguished. Additionally, the ADT7461 is supported if found in | 93 | be distinguished. |
82 | ADM1032 compatibility mode. | ||
83 | 94 | ||
84 | The specificity of this family of chipsets over the ADM1021/LM84 | 95 | The specificity of this family of chipsets over the ADM1021/LM84 |
85 | family is that it features critical limits with hysteresis, and an | 96 | family is that it features critical limits with hysteresis, and an |
86 | increased resolution of the remote temperature measurement. | 97 | increased resolution of the remote temperature measurement. |
87 | 98 | ||
88 | The different chipsets of the family are not strictly identical, although | 99 | The different chipsets of the family are not strictly identical, although |
89 | very similar. This driver doesn't handle any specific feature for now, | 100 | very similar. For reference, here comes a non-exhaustive list of specific |
90 | with the exception of SMBus PEC. For reference, here comes a non-exhaustive | 101 | features: |
91 | list of specific features: | ||
92 | 102 | ||
93 | LM90: | 103 | LM90: |
94 | * Filter and alert configuration register at 0xBF. | 104 | * Filter and alert configuration register at 0xBF. |
@@ -114,9 +124,11 @@ ADT7461: | |||
114 | * Lower resolution for remote temperature | 124 | * Lower resolution for remote temperature |
115 | 125 | ||
116 | MAX6657 and MAX6658: | 126 | MAX6657 and MAX6658: |
127 | * Better local resolution | ||
117 | * Remote sensor type selection | 128 | * Remote sensor type selection |
118 | 129 | ||
119 | MAX6659: | 130 | MAX6659: |
131 | * Better local resolution | ||
120 | * Selectable address | 132 | * Selectable address |
121 | * Second critical temperature limit | 133 | * Second critical temperature limit |
122 | * Remote sensor type selection | 134 | * Remote sensor type selection |
@@ -127,7 +139,8 @@ MAX6680 and MAX6681: | |||
127 | 139 | ||
128 | All temperature values are given in degrees Celsius. Resolution | 140 | All temperature values are given in degrees Celsius. Resolution |
129 | is 1.0 degree for the local temperature, 0.125 degree for the remote | 141 | is 1.0 degree for the local temperature, 0.125 degree for the remote |
130 | temperature. | 142 | temperature, except for the MAX6657, MAX6658 and MAX6659 which have a |
143 | resolution of 0.125 degree for both temperatures. | ||
131 | 144 | ||
132 | Each sensor has its own high and low limits, plus a critical limit. | 145 | Each sensor has its own high and low limits, plus a critical limit. |
133 | Additionally, there is a relative hysteresis value common to both critical | 146 | Additionally, there is a relative hysteresis value common to both critical |
diff --git a/Documentation/hwmon/pc87360 b/Documentation/hwmon/pc87360 index 89a8fcfa78df..cbac32b59c8c 100644 --- a/Documentation/hwmon/pc87360 +++ b/Documentation/hwmon/pc87360 | |||
@@ -5,12 +5,7 @@ Supported chips: | |||
5 | * National Semiconductor PC87360, PC87363, PC87364, PC87365 and PC87366 | 5 | * National Semiconductor PC87360, PC87363, PC87364, PC87365 and PC87366 |
6 | Prefixes: 'pc87360', 'pc87363', 'pc87364', 'pc87365', 'pc87366' | 6 | Prefixes: 'pc87360', 'pc87363', 'pc87364', 'pc87365', 'pc87366' |
7 | Addresses scanned: none, address read from Super I/O config space | 7 | Addresses scanned: none, address read from Super I/O config space |
8 | Datasheets: | 8 | Datasheets: No longer available |
9 | http://www.national.com/pf/PC/PC87360.html | ||
10 | http://www.national.com/pf/PC/PC87363.html | ||
11 | http://www.national.com/pf/PC/PC87364.html | ||
12 | http://www.national.com/pf/PC/PC87365.html | ||
13 | http://www.national.com/pf/PC/PC87366.html | ||
14 | 9 | ||
15 | Authors: Jean Delvare <khali@linux-fr.org> | 10 | Authors: Jean Delvare <khali@linux-fr.org> |
16 | 11 | ||
diff --git a/Documentation/hwmon/pc87427 b/Documentation/hwmon/pc87427 index 9a0708f9f49e..d1ebbe510f35 100644 --- a/Documentation/hwmon/pc87427 +++ b/Documentation/hwmon/pc87427 | |||
@@ -5,7 +5,7 @@ Supported chips: | |||
5 | * National Semiconductor PC87427 | 5 | * National Semiconductor PC87427 |
6 | Prefix: 'pc87427' | 6 | Prefix: 'pc87427' |
7 | Addresses scanned: none, address read from Super I/O config space | 7 | Addresses scanned: none, address read from Super I/O config space |
8 | Datasheet: http://www.winbond.com.tw/E-WINBONDHTM/partner/apc_007.html | 8 | Datasheet: No longer available |
9 | 9 | ||
10 | Author: Jean Delvare <khali@linux-fr.org> | 10 | Author: Jean Delvare <khali@linux-fr.org> |
11 | 11 | ||
diff --git a/Documentation/hwmon/sysfs-interface b/Documentation/hwmon/sysfs-interface index 2d845730d4e0..6dbfd5efd991 100644 --- a/Documentation/hwmon/sysfs-interface +++ b/Documentation/hwmon/sysfs-interface | |||
@@ -329,6 +329,10 @@ power[1-*]_average Average power use | |||
329 | Unit: microWatt | 329 | Unit: microWatt |
330 | RO | 330 | RO |
331 | 331 | ||
332 | power[1-*]_average_interval Power use averaging interval | ||
333 | Unit: milliseconds | ||
334 | RW | ||
335 | |||
332 | power[1-*]_average_highest Historical average maximum power use | 336 | power[1-*]_average_highest Historical average maximum power use |
333 | Unit: microWatt | 337 | Unit: microWatt |
334 | RO | 338 | RO |
@@ -354,6 +358,14 @@ power[1-*]_reset_history Reset input_highest, input_lowest, | |||
354 | WO | 358 | WO |
355 | 359 | ||
356 | ********** | 360 | ********** |
361 | * Energy * | ||
362 | ********** | ||
363 | |||
364 | energy[1-*]_input Cumulative energy use | ||
365 | Unit: microJoule | ||
366 | RO | ||
367 | |||
368 | ********** | ||
357 | * Alarms * | 369 | * Alarms * |
358 | ********** | 370 | ********** |
359 | 371 | ||
diff --git a/Documentation/hwmon/w83627hf b/Documentation/hwmon/w83627hf index 880a59f53da9..6ee36dbafd64 100644 --- a/Documentation/hwmon/w83627hf +++ b/Documentation/hwmon/w83627hf | |||
@@ -40,10 +40,6 @@ Module Parameters | |||
40 | (default is 1) | 40 | (default is 1) |
41 | Use 'init=0' to bypass initializing the chip. | 41 | Use 'init=0' to bypass initializing the chip. |
42 | Try this if your computer crashes when you load the module. | 42 | Try this if your computer crashes when you load the module. |
43 | * reset: int | ||
44 | (default is 0) | ||
45 | The driver used to reset the chip on load, but does no more. Use | ||
46 | 'reset=1' to restore the old behavior. Report if you need to do this. | ||
47 | 43 | ||
48 | Description | 44 | Description |
49 | ----------- | 45 | ----------- |
diff --git a/Documentation/hwmon/w83781d b/Documentation/hwmon/w83781d index 6f800a0283e9..c91e0b63ea1d 100644 --- a/Documentation/hwmon/w83781d +++ b/Documentation/hwmon/w83781d | |||
@@ -353,7 +353,7 @@ in6=255 | |||
353 | 353 | ||
354 | # PWM | 354 | # PWM |
355 | 355 | ||
356 | Additional info about PWM on the AS99127F (may apply to other Asus | 356 | * Additional info about PWM on the AS99127F (may apply to other Asus |
357 | chips as well) by Jean Delvare as of 2004-04-09: | 357 | chips as well) by Jean Delvare as of 2004-04-09: |
358 | 358 | ||
359 | AS99127F revision 2 seems to have two PWM registers at 0x59 and 0x5A, | 359 | AS99127F revision 2 seems to have two PWM registers at 0x59 and 0x5A, |
@@ -396,7 +396,7 @@ Please contact us if you can figure out how it is supposed to work. As | |||
396 | long as we don't know more, the w83781d driver doesn't handle PWM on | 396 | long as we don't know more, the w83781d driver doesn't handle PWM on |
397 | AS99127F chips at all. | 397 | AS99127F chips at all. |
398 | 398 | ||
399 | Additional info about PWM on the AS99127F rev.1 by Hector Martin: | 399 | * Additional info about PWM on the AS99127F rev.1 by Hector Martin: |
400 | 400 | ||
401 | I've been fiddling around with the (in)famous 0x59 register and | 401 | I've been fiddling around with the (in)famous 0x59 register and |
402 | found out the following values do work as a form of coarse pwm: | 402 | found out the following values do work as a form of coarse pwm: |
@@ -418,3 +418,36 @@ change. | |||
418 | My mobo is an ASUS A7V266-E. This behavior is similar to what I got | 418 | My mobo is an ASUS A7V266-E. This behavior is similar to what I got |
419 | with speedfan under Windows, where 0-15% would be off, 15-2x% (can't | 419 | with speedfan under Windows, where 0-15% would be off, 15-2x% (can't |
420 | remember the exact value) would be 70% and higher would be full on. | 420 | remember the exact value) would be 70% and higher would be full on. |
421 | |||
422 | * Additional info about PWM on the AS99127F rev.1 from lm-sensors | ||
423 | ticket #2350: | ||
424 | |||
425 | I conducted some experiment on Asus P3B-F motherboard with AS99127F | ||
426 | (Ver. 1). | ||
427 | |||
428 | I confirm that 0x59 register control the CPU_Fan Header on this | ||
429 | motherboard, and 0x5a register control PWR_Fan. | ||
430 | |||
431 | In order to reduce the dependency of specific fan, the measurement is | ||
432 | conducted with a digital scope without fan connected. I found out that | ||
433 | P3B-F actually output variable DC voltage on fan header center pin, | ||
434 | looks like PWM is filtered on this motherboard. | ||
435 | |||
436 | Here are some of measurements: | ||
437 | |||
438 | 0x80 20 mV | ||
439 | 0x81 20 mV | ||
440 | 0x82 232 mV | ||
441 | 0x83 1.2 V | ||
442 | 0x84 2.31 V | ||
443 | 0x85 3.44 V | ||
444 | 0x86 4.62 V | ||
445 | 0x87 5.81 V | ||
446 | 0x88 7.01 V | ||
447 | 9x89 8.22 V | ||
448 | 0x8a 9.42 V | ||
449 | 0x8b 10.6 V | ||
450 | 0x8c 11.9 V | ||
451 | 0x8d 12.4 V | ||
452 | 0x8e 12.4 V | ||
453 | 0x8f 12.4 V | ||
diff --git a/Documentation/hwmon/w83791d b/Documentation/hwmon/w83791d index f153b2f6d62c..5663e491655c 100644 --- a/Documentation/hwmon/w83791d +++ b/Documentation/hwmon/w83791d | |||
@@ -22,6 +22,7 @@ Credits: | |||
22 | 22 | ||
23 | Additional contributors: | 23 | Additional contributors: |
24 | Sven Anders <anders@anduras.de> | 24 | Sven Anders <anders@anduras.de> |
25 | Marc Hulsman <m.hulsman@tudelft.nl> | ||
25 | 26 | ||
26 | Module Parameters | 27 | Module Parameters |
27 | ----------------- | 28 | ----------------- |
@@ -57,30 +58,35 @@ internal state that allows no clean access (Bank with ID register is not | |||
57 | currently selected). If you know the address of the chip, use a 'force' | 58 | currently selected). If you know the address of the chip, use a 'force' |
58 | parameter; this will put it into a more well-behaved state first. | 59 | parameter; this will put it into a more well-behaved state first. |
59 | 60 | ||
60 | The driver implements three temperature sensors, five fan rotation speed | 61 | The driver implements three temperature sensors, ten voltage sensors, |
61 | sensors, and ten voltage sensors. | 62 | five fan rotation speed sensors and manual PWM control of each fan. |
62 | 63 | ||
63 | Temperatures are measured in degrees Celsius and measurement resolution is 1 | 64 | Temperatures are measured in degrees Celsius and measurement resolution is 1 |
64 | degC for temp1 and 0.5 degC for temp2 and temp3. An alarm is triggered when | 65 | degC for temp1 and 0.5 degC for temp2 and temp3. An alarm is triggered when |
65 | the temperature gets higher than the Overtemperature Shutdown value; it stays | 66 | the temperature gets higher than the Overtemperature Shutdown value; it stays |
66 | on until the temperature falls below the Hysteresis value. | 67 | on until the temperature falls below the Hysteresis value. |
67 | 68 | ||
68 | Fan rotation speeds are reported in RPM (rotations per minute). An alarm is | ||
69 | triggered if the rotation speed has dropped below a programmable limit. Fan | ||
70 | readings can be divided by a programmable divider (1, 2, 4, 8 for fan 1/2/3 | ||
71 | and 1, 2, 4, 8, 16, 32, 64 or 128 for fan 4/5) to give the readings more | ||
72 | range or accuracy. | ||
73 | |||
74 | Voltage sensors (also known as IN sensors) report their values in millivolts. | 69 | Voltage sensors (also known as IN sensors) report their values in millivolts. |
75 | An alarm is triggered if the voltage has crossed a programmable minimum | 70 | An alarm is triggered if the voltage has crossed a programmable minimum |
76 | or maximum limit. | 71 | or maximum limit. |
77 | 72 | ||
73 | Fan rotation speeds are reported in RPM (rotations per minute). An alarm is | ||
74 | triggered if the rotation speed has dropped below a programmable limit. Fan | ||
75 | readings can be divided by a programmable divider (1, 2, 4, 8, 16, | ||
76 | 32, 64 or 128 for all fans) to give the readings more range or accuracy. | ||
77 | |||
78 | Each fan controlled is controlled by PWM. The PWM duty cycle can be read and | ||
79 | set for each fan separately. Valid values range from 0 (stop) to 255 (full). | ||
80 | PWM 1-3 support Thermal Cruise mode, in which the PWMs are automatically | ||
81 | regulated to keep respectively temp 1-3 at a certain target temperature. | ||
82 | See below for the description of the sysfs-interface. | ||
83 | |||
78 | The w83791d has a global bit used to enable beeping from the speaker when an | 84 | The w83791d has a global bit used to enable beeping from the speaker when an |
79 | alarm is triggered as well as a bitmask to enable or disable the beep for | 85 | alarm is triggered as well as a bitmask to enable or disable the beep for |
80 | specific alarms. You need both the global beep enable bit and the | 86 | specific alarms. You need both the global beep enable bit and the |
81 | corresponding beep bit to be on for a triggered alarm to sound a beep. | 87 | corresponding beep bit to be on for a triggered alarm to sound a beep. |
82 | 88 | ||
83 | The sysfs interface to the gloabal enable is via the sysfs beep_enable file. | 89 | The sysfs interface to the global enable is via the sysfs beep_enable file. |
84 | This file is used for both legacy and new code. | 90 | This file is used for both legacy and new code. |
85 | 91 | ||
86 | The sysfs interface to the beep bitmask has migrated from the original legacy | 92 | The sysfs interface to the beep bitmask has migrated from the original legacy |
@@ -105,6 +111,27 @@ going forward. | |||
105 | The driver reads the hardware chip values at most once every three seconds. | 111 | The driver reads the hardware chip values at most once every three seconds. |
106 | User mode code requesting values more often will receive cached values. | 112 | User mode code requesting values more often will receive cached values. |
107 | 113 | ||
114 | /sys files | ||
115 | ---------- | ||
116 | The sysfs-interface is documented in the 'sysfs-interface' file. Only | ||
117 | chip-specific options are documented here. | ||
118 | |||
119 | pwm[1-3]_enable - this file controls mode of fan/temperature control for | ||
120 | fan 1-3. Fan/PWM 4-5 only support manual mode. | ||
121 | * 1 Manual mode | ||
122 | * 2 Thermal Cruise mode | ||
123 | * 3 Fan Speed Cruise mode (no further support) | ||
124 | |||
125 | temp[1-3]_target - defines the target temperature for Thermal Cruise mode. | ||
126 | Unit: millidegree Celsius | ||
127 | RW | ||
128 | |||
129 | temp[1-3]_tolerance - temperature tolerance for Thermal Cruise mode. | ||
130 | Specifies an interval around the target temperature | ||
131 | in which the fan speed is not changed. | ||
132 | Unit: millidegree Celsius | ||
133 | RW | ||
134 | |||
108 | Alarms bitmap vs. beep_mask bitmask | 135 | Alarms bitmap vs. beep_mask bitmask |
109 | ------------------------------------ | 136 | ------------------------------------ |
110 | For legacy code using the alarms and beep_mask files: | 137 | For legacy code using the alarms and beep_mask files: |
@@ -132,7 +159,3 @@ tart2 : alarms: 0x020000 beep_mask: 0x080000 <== mismatch | |||
132 | tart3 : alarms: 0x040000 beep_mask: 0x100000 <== mismatch | 159 | tart3 : alarms: 0x040000 beep_mask: 0x100000 <== mismatch |
133 | case_open : alarms: 0x001000 beep_mask: 0x001000 | 160 | case_open : alarms: 0x001000 beep_mask: 0x001000 |
134 | global_enable: alarms: -------- beep_mask: 0x800000 (modified via beep_enable) | 161 | global_enable: alarms: -------- beep_mask: 0x800000 (modified via beep_enable) |
135 | |||
136 | W83791D TODO: | ||
137 | --------------- | ||
138 | Provide a patch for smart-fan control (still need appropriate motherboard/fans) | ||
diff --git a/Documentation/i2c/busses/i2c-i801 b/Documentation/i2c/busses/i2c-i801 index c31e0291e167..81c0c59a60ea 100644 --- a/Documentation/i2c/busses/i2c-i801 +++ b/Documentation/i2c/busses/i2c-i801 | |||
@@ -13,8 +13,9 @@ Supported adapters: | |||
13 | * Intel 631xESB/632xESB (ESB2) | 13 | * Intel 631xESB/632xESB (ESB2) |
14 | * Intel 82801H (ICH8) | 14 | * Intel 82801H (ICH8) |
15 | * Intel 82801I (ICH9) | 15 | * Intel 82801I (ICH9) |
16 | * Intel Tolapai | 16 | * Intel EP80579 (Tolapai) |
17 | * Intel ICH10 | 17 | * Intel 82801JI (ICH10) |
18 | * Intel PCH | ||
18 | Datasheets: Publicly available at the Intel website | 19 | Datasheets: Publicly available at the Intel website |
19 | 20 | ||
20 | Authors: | 21 | Authors: |
@@ -32,7 +33,7 @@ Description | |||
32 | ----------- | 33 | ----------- |
33 | 34 | ||
34 | The ICH (properly known as the 82801AA), ICH0 (82801AB), ICH2 (82801BA), | 35 | The ICH (properly known as the 82801AA), ICH0 (82801AB), ICH2 (82801BA), |
35 | ICH3 (82801CA/CAM) and later devices are Intel chips that are a part of | 36 | ICH3 (82801CA/CAM) and later devices (PCH) are Intel chips that are a part of |
36 | Intel's '810' chipset for Celeron-based PCs, '810E' chipset for | 37 | Intel's '810' chipset for Celeron-based PCs, '810E' chipset for |
37 | Pentium-based PCs, '815E' chipset, and others. | 38 | Pentium-based PCs, '815E' chipset, and others. |
38 | 39 | ||
diff --git a/Documentation/i2c/busses/i2c-viapro b/Documentation/i2c/busses/i2c-viapro index 1405fb69984c..22efedf60c87 100644 --- a/Documentation/i2c/busses/i2c-viapro +++ b/Documentation/i2c/busses/i2c-viapro | |||
@@ -16,6 +16,9 @@ Supported adapters: | |||
16 | * VIA Technologies, Inc. CX700 | 16 | * VIA Technologies, Inc. CX700 |
17 | Datasheet: available on request and under NDA from VIA | 17 | Datasheet: available on request and under NDA from VIA |
18 | 18 | ||
19 | * VIA Technologies, Inc. VX800/VX820 | ||
20 | Datasheet: available on http://linux.via.com.tw | ||
21 | |||
19 | Authors: | 22 | Authors: |
20 | Kyösti Mälkki <kmalkki@cc.hut.fi>, | 23 | Kyösti Mälkki <kmalkki@cc.hut.fi>, |
21 | Mark D. Studebaker <mdsxyz123@yahoo.com>, | 24 | Mark D. Studebaker <mdsxyz123@yahoo.com>, |
@@ -49,6 +52,7 @@ Your lspci -n listing must show one of these : | |||
49 | device 1106:3372 (VT8237S) | 52 | device 1106:3372 (VT8237S) |
50 | device 1106:3287 (VT8251) | 53 | device 1106:3287 (VT8251) |
51 | device 1106:8324 (CX700) | 54 | device 1106:8324 (CX700) |
55 | device 1106:8353 (VX800/VX820) | ||
52 | 56 | ||
53 | If none of these show up, you should look in the BIOS for settings like | 57 | If none of these show up, you should look in the BIOS for settings like |
54 | enable ACPI / SMBus or even USB. | 58 | enable ACPI / SMBus or even USB. |
@@ -57,5 +61,5 @@ Except for the oldest chips (VT82C596A/B, VT82C686A and most probably | |||
57 | VT8231), this driver supports I2C block transactions. Such transactions | 61 | VT8231), this driver supports I2C block transactions. Such transactions |
58 | are mainly useful to read from and write to EEPROMs. | 62 | are mainly useful to read from and write to EEPROMs. |
59 | 63 | ||
60 | The CX700 additionally appears to support SMBus PEC, although this driver | 64 | The CX700/VX800/VX820 additionally appears to support SMBus PEC, although |
61 | doesn't implement it yet. | 65 | this driver doesn't implement it yet. |
diff --git a/Documentation/i2c/dev-interface b/Documentation/i2c/dev-interface index 9dd79123ddd9..3e742ba25536 100644 --- a/Documentation/i2c/dev-interface +++ b/Documentation/i2c/dev-interface | |||
@@ -4,6 +4,10 @@ the /dev interface. You need to load module i2c-dev for this. | |||
4 | 4 | ||
5 | Each registered i2c adapter gets a number, counting from 0. You can | 5 | Each registered i2c adapter gets a number, counting from 0. You can |
6 | examine /sys/class/i2c-dev/ to see what number corresponds to which adapter. | 6 | examine /sys/class/i2c-dev/ to see what number corresponds to which adapter. |
7 | Alternatively, you can run "i2cdetect -l" to obtain a formated list of all | ||
8 | i2c adapters present on your system at a given time. i2cdetect is part of | ||
9 | the i2c-tools package. | ||
10 | |||
7 | I2C device files are character device files with major device number 89 | 11 | I2C device files are character device files with major device number 89 |
8 | and a minor device number corresponding to the number assigned as | 12 | and a minor device number corresponding to the number assigned as |
9 | explained above. They should be called "i2c-%d" (i2c-0, i2c-1, ..., | 13 | explained above. They should be called "i2c-%d" (i2c-0, i2c-1, ..., |
@@ -17,30 +21,34 @@ So let's say you want to access an i2c adapter from a C program. The | |||
17 | first thing to do is "#include <linux/i2c-dev.h>". Please note that | 21 | first thing to do is "#include <linux/i2c-dev.h>". Please note that |
18 | there are two files named "i2c-dev.h" out there, one is distributed | 22 | there are two files named "i2c-dev.h" out there, one is distributed |
19 | with the Linux kernel and is meant to be included from kernel | 23 | with the Linux kernel and is meant to be included from kernel |
20 | driver code, the other one is distributed with lm_sensors and is | 24 | driver code, the other one is distributed with i2c-tools and is |
21 | meant to be included from user-space programs. You obviously want | 25 | meant to be included from user-space programs. You obviously want |
22 | the second one here. | 26 | the second one here. |
23 | 27 | ||
24 | Now, you have to decide which adapter you want to access. You should | 28 | Now, you have to decide which adapter you want to access. You should |
25 | inspect /sys/class/i2c-dev/ to decide this. Adapter numbers are assigned | 29 | inspect /sys/class/i2c-dev/ or run "i2cdetect -l" to decide this. |
26 | somewhat dynamically, so you can not even assume /dev/i2c-0 is the | 30 | Adapter numbers are assigned somewhat dynamically, so you can not |
27 | first adapter. | 31 | assume much about them. They can even change from one boot to the next. |
28 | 32 | ||
29 | Next thing, open the device file, as follows: | 33 | Next thing, open the device file, as follows: |
34 | |||
30 | int file; | 35 | int file; |
31 | int adapter_nr = 2; /* probably dynamically determined */ | 36 | int adapter_nr = 2; /* probably dynamically determined */ |
32 | char filename[20]; | 37 | char filename[20]; |
33 | 38 | ||
34 | sprintf(filename,"/dev/i2c-%d",adapter_nr); | 39 | snprintf(filename, 19, "/dev/i2c-%d", adapter_nr); |
35 | if ((file = open(filename,O_RDWR)) < 0) { | 40 | file = open(filename, O_RDWR); |
41 | if (file < 0) { | ||
36 | /* ERROR HANDLING; you can check errno to see what went wrong */ | 42 | /* ERROR HANDLING; you can check errno to see what went wrong */ |
37 | exit(1); | 43 | exit(1); |
38 | } | 44 | } |
39 | 45 | ||
40 | When you have opened the device, you must specify with what device | 46 | When you have opened the device, you must specify with what device |
41 | address you want to communicate: | 47 | address you want to communicate: |
48 | |||
42 | int addr = 0x40; /* The I2C address */ | 49 | int addr = 0x40; /* The I2C address */ |
43 | if (ioctl(file,I2C_SLAVE,addr) < 0) { | 50 | |
51 | if (ioctl(file, I2C_SLAVE, addr) < 0) { | ||
44 | /* ERROR HANDLING; you can check errno to see what went wrong */ | 52 | /* ERROR HANDLING; you can check errno to see what went wrong */ |
45 | exit(1); | 53 | exit(1); |
46 | } | 54 | } |
@@ -48,31 +56,41 @@ address you want to communicate: | |||
48 | Well, you are all set up now. You can now use SMBus commands or plain | 56 | Well, you are all set up now. You can now use SMBus commands or plain |
49 | I2C to communicate with your device. SMBus commands are preferred if | 57 | I2C to communicate with your device. SMBus commands are preferred if |
50 | the device supports them. Both are illustrated below. | 58 | the device supports them. Both are illustrated below. |
59 | |||
51 | __u8 register = 0x10; /* Device register to access */ | 60 | __u8 register = 0x10; /* Device register to access */ |
52 | __s32 res; | 61 | __s32 res; |
53 | char buf[10]; | 62 | char buf[10]; |
63 | |||
54 | /* Using SMBus commands */ | 64 | /* Using SMBus commands */ |
55 | res = i2c_smbus_read_word_data(file,register); | 65 | res = i2c_smbus_read_word_data(file, register); |
56 | if (res < 0) { | 66 | if (res < 0) { |
57 | /* ERROR HANDLING: i2c transaction failed */ | 67 | /* ERROR HANDLING: i2c transaction failed */ |
58 | } else { | 68 | } else { |
59 | /* res contains the read word */ | 69 | /* res contains the read word */ |
60 | } | 70 | } |
71 | |||
61 | /* Using I2C Write, equivalent of | 72 | /* Using I2C Write, equivalent of |
62 | i2c_smbus_write_word_data(file,register,0x6543) */ | 73 | i2c_smbus_write_word_data(file, register, 0x6543) */ |
63 | buf[0] = register; | 74 | buf[0] = register; |
64 | buf[1] = 0x43; | 75 | buf[1] = 0x43; |
65 | buf[2] = 0x65; | 76 | buf[2] = 0x65; |
66 | if ( write(file,buf,3) != 3) { | 77 | if (write(file, buf, 3) ! =3) { |
67 | /* ERROR HANDLING: i2c transaction failed */ | 78 | /* ERROR HANDLING: i2c transaction failed */ |
68 | } | 79 | } |
80 | |||
69 | /* Using I2C Read, equivalent of i2c_smbus_read_byte(file) */ | 81 | /* Using I2C Read, equivalent of i2c_smbus_read_byte(file) */ |
70 | if (read(file,buf,1) != 1) { | 82 | if (read(file, buf, 1) != 1) { |
71 | /* ERROR HANDLING: i2c transaction failed */ | 83 | /* ERROR HANDLING: i2c transaction failed */ |
72 | } else { | 84 | } else { |
73 | /* buf[0] contains the read byte */ | 85 | /* buf[0] contains the read byte */ |
74 | } | 86 | } |
75 | 87 | ||
88 | Note that only a subset of the I2C and SMBus protocols can be achieved by | ||
89 | the means of read() and write() calls. In particular, so-called combined | ||
90 | transactions (mixing read and write messages in the same transaction) | ||
91 | aren't supported. For this reason, this interface is almost never used by | ||
92 | user-space programs. | ||
93 | |||
76 | IMPORTANT: because of the use of inline functions, you *have* to use | 94 | IMPORTANT: because of the use of inline functions, you *have* to use |
77 | '-O' or some variation when you compile your program! | 95 | '-O' or some variation when you compile your program! |
78 | 96 | ||
@@ -80,31 +98,29 @@ IMPORTANT: because of the use of inline functions, you *have* to use | |||
80 | Full interface description | 98 | Full interface description |
81 | ========================== | 99 | ========================== |
82 | 100 | ||
83 | The following IOCTLs are defined and fully supported | 101 | The following IOCTLs are defined: |
84 | (see also i2c-dev.h): | ||
85 | 102 | ||
86 | ioctl(file,I2C_SLAVE,long addr) | 103 | ioctl(file, I2C_SLAVE, long addr) |
87 | Change slave address. The address is passed in the 7 lower bits of the | 104 | Change slave address. The address is passed in the 7 lower bits of the |
88 | argument (except for 10 bit addresses, passed in the 10 lower bits in this | 105 | argument (except for 10 bit addresses, passed in the 10 lower bits in this |
89 | case). | 106 | case). |
90 | 107 | ||
91 | ioctl(file,I2C_TENBIT,long select) | 108 | ioctl(file, I2C_TENBIT, long select) |
92 | Selects ten bit addresses if select not equals 0, selects normal 7 bit | 109 | Selects ten bit addresses if select not equals 0, selects normal 7 bit |
93 | addresses if select equals 0. Default 0. This request is only valid | 110 | addresses if select equals 0. Default 0. This request is only valid |
94 | if the adapter has I2C_FUNC_10BIT_ADDR. | 111 | if the adapter has I2C_FUNC_10BIT_ADDR. |
95 | 112 | ||
96 | ioctl(file,I2C_PEC,long select) | 113 | ioctl(file, I2C_PEC, long select) |
97 | Selects SMBus PEC (packet error checking) generation and verification | 114 | Selects SMBus PEC (packet error checking) generation and verification |
98 | if select not equals 0, disables if select equals 0. Default 0. | 115 | if select not equals 0, disables if select equals 0. Default 0. |
99 | Used only for SMBus transactions. This request only has an effect if the | 116 | Used only for SMBus transactions. This request only has an effect if the |
100 | the adapter has I2C_FUNC_SMBUS_PEC; it is still safe if not, it just | 117 | the adapter has I2C_FUNC_SMBUS_PEC; it is still safe if not, it just |
101 | doesn't have any effect. | 118 | doesn't have any effect. |
102 | 119 | ||
103 | ioctl(file,I2C_FUNCS,unsigned long *funcs) | 120 | ioctl(file, I2C_FUNCS, unsigned long *funcs) |
104 | Gets the adapter functionality and puts it in *funcs. | 121 | Gets the adapter functionality and puts it in *funcs. |
105 | 122 | ||
106 | ioctl(file,I2C_RDWR,struct i2c_rdwr_ioctl_data *msgset) | 123 | ioctl(file, I2C_RDWR, struct i2c_rdwr_ioctl_data *msgset) |
107 | |||
108 | Do combined read/write transaction without stop in between. | 124 | Do combined read/write transaction without stop in between. |
109 | Only valid if the adapter has I2C_FUNC_I2C. The argument is | 125 | Only valid if the adapter has I2C_FUNC_I2C. The argument is |
110 | a pointer to a | 126 | a pointer to a |
@@ -120,10 +136,9 @@ ioctl(file,I2C_RDWR,struct i2c_rdwr_ioctl_data *msgset) | |||
120 | The slave address and whether to use ten bit address mode has to be | 136 | The slave address and whether to use ten bit address mode has to be |
121 | set in each message, overriding the values set with the above ioctl's. | 137 | set in each message, overriding the values set with the above ioctl's. |
122 | 138 | ||
123 | 139 | ioctl(file, I2C_SMBUS, struct i2c_smbus_ioctl_data *args) | |
124 | Other values are NOT supported at this moment, except for I2C_SMBUS, | 140 | Not meant to be called directly; instead, use the access functions |
125 | which you should never directly call; instead, use the access functions | 141 | below. |
126 | below. | ||
127 | 142 | ||
128 | You can do plain i2c transactions by using read(2) and write(2) calls. | 143 | You can do plain i2c transactions by using read(2) and write(2) calls. |
129 | You do not need to pass the address byte; instead, set it through | 144 | You do not need to pass the address byte; instead, set it through |
@@ -148,7 +163,52 @@ what happened. The 'write' transactions return 0 on success; the | |||
148 | returns the number of values read. The block buffers need not be longer | 163 | returns the number of values read. The block buffers need not be longer |
149 | than 32 bytes. | 164 | than 32 bytes. |
150 | 165 | ||
151 | The above functions are all macros, that resolve to calls to the | 166 | The above functions are all inline functions, that resolve to calls to |
152 | i2c_smbus_access function, that on its turn calls a specific ioctl | 167 | the i2c_smbus_access function, that on its turn calls a specific ioctl |
153 | with the data in a specific format. Read the source code if you | 168 | with the data in a specific format. Read the source code if you |
154 | want to know what happens behind the screens. | 169 | want to know what happens behind the screens. |
170 | |||
171 | |||
172 | Implementation details | ||
173 | ====================== | ||
174 | |||
175 | For the interested, here's the code flow which happens inside the kernel | ||
176 | when you use the /dev interface to I2C: | ||
177 | |||
178 | 1* Your program opens /dev/i2c-N and calls ioctl() on it, as described in | ||
179 | section "C example" above. | ||
180 | |||
181 | 2* These open() and ioctl() calls are handled by the i2c-dev kernel | ||
182 | driver: see i2c-dev.c:i2cdev_open() and i2c-dev.c:i2cdev_ioctl(), | ||
183 | respectively. You can think of i2c-dev as a generic I2C chip driver | ||
184 | that can be programmed from user-space. | ||
185 | |||
186 | 3* Some ioctl() calls are for administrative tasks and are handled by | ||
187 | i2c-dev directly. Examples include I2C_SLAVE (set the address of the | ||
188 | device you want to access) and I2C_PEC (enable or disable SMBus error | ||
189 | checking on future transactions.) | ||
190 | |||
191 | 4* Other ioctl() calls are converted to in-kernel function calls by | ||
192 | i2c-dev. Examples include I2C_FUNCS, which queries the I2C adapter | ||
193 | functionality using i2c.h:i2c_get_functionality(), and I2C_SMBUS, which | ||
194 | performs an SMBus transaction using i2c-core.c:i2c_smbus_xfer(). | ||
195 | |||
196 | The i2c-dev driver is responsible for checking all the parameters that | ||
197 | come from user-space for validity. After this point, there is no | ||
198 | difference between these calls that came from user-space through i2c-dev | ||
199 | and calls that would have been performed by kernel I2C chip drivers | ||
200 | directly. This means that I2C bus drivers don't need to implement | ||
201 | anything special to support access from user-space. | ||
202 | |||
203 | 5* These i2c-core.c/i2c.h functions are wrappers to the actual | ||
204 | implementation of your I2C bus driver. Each adapter must declare | ||
205 | callback functions implementing these standard calls. | ||
206 | i2c.h:i2c_get_functionality() calls i2c_adapter.algo->functionality(), | ||
207 | while i2c-core.c:i2c_smbus_xfer() calls either | ||
208 | adapter.algo->smbus_xfer() if it is implemented, or if not, | ||
209 | i2c-core.c:i2c_smbus_xfer_emulated() which in turn calls | ||
210 | i2c_adapter.algo->master_xfer(). | ||
211 | |||
212 | After your I2C bus driver has processed these requests, execution runs | ||
213 | up the call chain, with almost no processing done, except by i2c-dev to | ||
214 | package the returned data, if any, in suitable format for the ioctl. | ||
diff --git a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients deleted file mode 100644 index 7bf82c08f6ca..000000000000 --- a/Documentation/i2c/porting-clients +++ /dev/null | |||
@@ -1,160 +0,0 @@ | |||
1 | Revision 7, 2007-04-19 | ||
2 | Jean Delvare <khali@linux-fr.org> | ||
3 | Greg KH <greg@kroah.com> | ||
4 | |||
5 | This is a guide on how to convert I2C chip drivers from Linux 2.4 to | ||
6 | Linux 2.6. I have been using existing drivers (lm75, lm78) as examples. | ||
7 | Then I converted a driver myself (lm83) and updated this document. | ||
8 | Note that this guide is strongly oriented towards hardware monitoring | ||
9 | drivers. Many points are still valid for other type of drivers, but | ||
10 | others may be irrelevant. | ||
11 | |||
12 | There are two sets of points below. The first set concerns technical | ||
13 | changes. The second set concerns coding policy. Both are mandatory. | ||
14 | |||
15 | Although reading this guide will help you porting drivers, I suggest | ||
16 | you keep an eye on an already ported driver while porting your own | ||
17 | driver. This will help you a lot understanding what this guide | ||
18 | exactly means. Choose the chip driver that is the more similar to | ||
19 | yours for best results. | ||
20 | |||
21 | Technical changes: | ||
22 | |||
23 | * [Driver type] Any driver that was relying on i2c-isa has to be | ||
24 | converted to a proper isa, platform or pci driver. This is not | ||
25 | covered by this guide. | ||
26 | |||
27 | * [Includes] Get rid of "version.h" and <linux/i2c-proc.h>. | ||
28 | Includes typically look like that: | ||
29 | #include <linux/module.h> | ||
30 | #include <linux/init.h> | ||
31 | #include <linux/slab.h> | ||
32 | #include <linux/jiffies.h> | ||
33 | #include <linux/i2c.h> | ||
34 | #include <linux/hwmon.h> /* for hardware monitoring drivers */ | ||
35 | #include <linux/hwmon-sysfs.h> | ||
36 | #include <linux/hwmon-vid.h> /* if you need VRM support */ | ||
37 | #include <linux/err.h> /* for class registration */ | ||
38 | Please respect this inclusion order. Some extra headers may be | ||
39 | required for a given driver (e.g. "lm75.h"). | ||
40 | |||
41 | * [Addresses] SENSORS_I2C_END becomes I2C_CLIENT_END, ISA addresses | ||
42 | are no more handled by the i2c core. Address ranges are no more | ||
43 | supported either, define each individual address separately. | ||
44 | SENSORS_INSMOD_<n> becomes I2C_CLIENT_INSMOD_<n>. | ||
45 | |||
46 | * [Client data] Get rid of sysctl_id. Try using standard names for | ||
47 | register values (for example, temp_os becomes temp_max). You're | ||
48 | still relatively free here, but you *have* to follow the standard | ||
49 | names for sysfs files (see the Sysctl section below). | ||
50 | |||
51 | * [Function prototypes] The detect functions loses its flags | ||
52 | parameter. Sysctl (e.g. lm75_temp) and miscellaneous functions | ||
53 | are off the list of prototypes. This usually leaves five | ||
54 | prototypes: | ||
55 | static int lm75_attach_adapter(struct i2c_adapter *adapter); | ||
56 | static int lm75_detect(struct i2c_adapter *adapter, int address, | ||
57 | int kind); | ||
58 | static void lm75_init_client(struct i2c_client *client); | ||
59 | static int lm75_detach_client(struct i2c_client *client); | ||
60 | static struct lm75_data lm75_update_device(struct device *dev); | ||
61 | |||
62 | * [Sysctl] All sysctl stuff is of course gone (defines, ctl_table | ||
63 | and functions). Instead, you have to define show and set functions for | ||
64 | each sysfs file. Only define set for writable values. Take a look at an | ||
65 | existing 2.6 driver for details (it87 for example). Don't forget | ||
66 | to define the attributes for each file (this is that step that | ||
67 | links callback functions). Use the file names specified in | ||
68 | Documentation/hwmon/sysfs-interface for the individual files. Also | ||
69 | convert the units these files read and write to the specified ones. | ||
70 | If you need to add a new type of file, please discuss it on the | ||
71 | sensors mailing list <lm-sensors@lm-sensors.org> by providing a | ||
72 | patch to the Documentation/hwmon/sysfs-interface file. | ||
73 | |||
74 | * [Attach] The attach function should make sure that the adapter's | ||
75 | class has I2C_CLASS_HWMON (or whatever class is suitable for your | ||
76 | driver), using the following construct: | ||
77 | if (!(adapter->class & I2C_CLASS_HWMON)) | ||
78 | return 0; | ||
79 | Call i2c_probe() instead of i2c_detect(). | ||
80 | |||
81 | * [Detect] As mentioned earlier, the flags parameter is gone. | ||
82 | The type_name and client_name strings are replaced by a single | ||
83 | name string, which will be filled with a lowercase, short string. | ||
84 | The labels used for error paths are reduced to the number needed. | ||
85 | It is advised that the labels are given descriptive names such as | ||
86 | exit and exit_free. Don't forget to properly set err before | ||
87 | jumping to error labels. By the way, labels should be left-aligned. | ||
88 | Use kzalloc instead of kmalloc. | ||
89 | Use i2c_set_clientdata to set the client data (as opposed to | ||
90 | a direct access to client->data). | ||
91 | Use strlcpy instead of strcpy or snprintf to copy the client name. | ||
92 | Replace the sysctl directory registration by calls to | ||
93 | device_create_file. Move the driver initialization before any | ||
94 | sysfs file creation. | ||
95 | Register the client with the hwmon class (using hwmon_device_register) | ||
96 | if applicable. | ||
97 | Drop client->id. | ||
98 | Drop any 24RF08 corruption prevention you find, as this is now done | ||
99 | at the i2c-core level, and doing it twice voids it. | ||
100 | Don't add I2C_CLIENT_ALLOW_USE to client->flags, it's the default now. | ||
101 | |||
102 | * [Init] Limits must not be set by the driver (can be done later in | ||
103 | user-space). Chip should not be reset default (although a module | ||
104 | parameter may be used to force it), and initialization should be | ||
105 | limited to the strictly necessary steps. | ||
106 | |||
107 | * [Detach] Remove the call to i2c_deregister_entry. Do not log an | ||
108 | error message if i2c_detach_client fails, as i2c-core will now do | ||
109 | it for you. | ||
110 | Unregister from the hwmon class if applicable. | ||
111 | |||
112 | * [Update] The function prototype changed, it is now | ||
113 | passed a device structure, which you have to convert to a client | ||
114 | using to_i2c_client(dev). The update function should return a | ||
115 | pointer to the client data. | ||
116 | Don't access client->data directly, use i2c_get_clientdata(client) | ||
117 | instead. | ||
118 | Use time_after() instead of direct jiffies comparison. | ||
119 | |||
120 | * [Interface] Make sure there is a MODULE_LICENSE() line, at the bottom | ||
121 | of the file (after MODULE_AUTHOR() and MODULE_DESCRIPTION(), in this | ||
122 | order). | ||
123 | |||
124 | * [Driver] The flags field of the i2c_driver structure is gone. | ||
125 | I2C_DF_NOTIFY is now the default behavior. | ||
126 | The i2c_driver structure has a driver member, which is itself a | ||
127 | structure, those name member should be initialized to a driver name | ||
128 | string. i2c_driver itself has no name member anymore. | ||
129 | |||
130 | * [Driver model] Instead of shutdown or reboot notifiers, provide a | ||
131 | shutdown() method in your driver. | ||
132 | |||
133 | * [Power management] Use the driver model suspend() and resume() | ||
134 | callbacks instead of the obsolete pm_register() calls. | ||
135 | |||
136 | Coding policy: | ||
137 | |||
138 | * [Copyright] Use (C), not (c), for copyright. | ||
139 | |||
140 | * [Debug/log] Get rid of #ifdef DEBUG/#endif constructs whenever you | ||
141 | can. Calls to printk for debugging purposes are replaced by calls to | ||
142 | dev_dbg where possible, else to pr_debug. Here is an example of how | ||
143 | to call it (taken from lm75_detect): | ||
144 | dev_dbg(&client->dev, "Starting lm75 update\n"); | ||
145 | Replace other printk calls with the dev_info, dev_err or dev_warn | ||
146 | function, as appropriate. | ||
147 | |||
148 | * [Constants] Constants defines (registers, conversions) should be | ||
149 | aligned. This greatly improves readability. | ||
150 | Alignments are achieved by the means of tabs, not spaces. Remember | ||
151 | that tabs are set to 8 in the Linux kernel code. | ||
152 | |||
153 | * [Layout] Avoid extra empty lines between comments and what they | ||
154 | comment. Respect the coding style (see Documentation/CodingStyle), | ||
155 | in particular when it comes to placing curly braces. | ||
156 | |||
157 | * [Comments] Make sure that no comment refers to a file that isn't | ||
158 | part of the Linux source tree (typically doc/chips/<chip name>), | ||
159 | and that remaining comments still match the code. Merging comment | ||
160 | lines when possible is encouraged. | ||
diff --git a/Documentation/i2c/smbus-protocol b/Documentation/i2c/smbus-protocol index 24bfb65da17d..9df47441f0e7 100644 --- a/Documentation/i2c/smbus-protocol +++ b/Documentation/i2c/smbus-protocol | |||
@@ -109,8 +109,8 @@ specified through the Comm byte. | |||
109 | S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] P | 109 | S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] P |
110 | 110 | ||
111 | 111 | ||
112 | SMBus Process Call | 112 | SMBus Process Call: i2c_smbus_process_call() |
113 | ================== | 113 | ============================================= |
114 | 114 | ||
115 | This command selects a device register (through the Comm byte), sends | 115 | This command selects a device register (through the Comm byte), sends |
116 | 16 bits of data to it, and reads 16 bits of data in return. | 116 | 16 bits of data to it, and reads 16 bits of data in return. |
diff --git a/Documentation/i2c/upgrading-clients b/Documentation/i2c/upgrading-clients new file mode 100644 index 000000000000..9a45f9bb6a25 --- /dev/null +++ b/Documentation/i2c/upgrading-clients | |||
@@ -0,0 +1,281 @@ | |||
1 | Upgrading I2C Drivers to the new 2.6 Driver Model | ||
2 | ================================================= | ||
3 | |||
4 | Ben Dooks <ben-linux@fluff.org> | ||
5 | |||
6 | Introduction | ||
7 | ------------ | ||
8 | |||
9 | This guide outlines how to alter existing Linux 2.6 client drivers from | ||
10 | the old to the new new binding methods. | ||
11 | |||
12 | |||
13 | Example old-style driver | ||
14 | ------------------------ | ||
15 | |||
16 | |||
17 | struct example_state { | ||
18 | struct i2c_client client; | ||
19 | .... | ||
20 | }; | ||
21 | |||
22 | static struct i2c_driver example_driver; | ||
23 | |||
24 | static unsigned short ignore[] = { I2C_CLIENT_END }; | ||
25 | static unsigned short normal_addr[] = { OUR_ADDR, I2C_CLIENT_END }; | ||
26 | |||
27 | I2C_CLIENT_INSMOD; | ||
28 | |||
29 | static int example_attach(struct i2c_adapter *adap, int addr, int kind) | ||
30 | { | ||
31 | struct example_state *state; | ||
32 | struct device *dev = &adap->dev; /* to use for dev_ reports */ | ||
33 | int ret; | ||
34 | |||
35 | state = kzalloc(sizeof(struct example_state), GFP_KERNEL); | ||
36 | if (state == NULL) { | ||
37 | dev_err(dev, "failed to create our state\n"); | ||
38 | return -ENOMEM; | ||
39 | } | ||
40 | |||
41 | example->client.addr = addr; | ||
42 | example->client.flags = 0; | ||
43 | example->client.adapter = adap; | ||
44 | |||
45 | i2c_set_clientdata(&state->i2c_client, state); | ||
46 | strlcpy(client->i2c_client.name, "example", I2C_NAME_SIZE); | ||
47 | |||
48 | ret = i2c_attach_client(&state->i2c_client); | ||
49 | if (ret < 0) { | ||
50 | dev_err(dev, "failed to attach client\n"); | ||
51 | kfree(state); | ||
52 | return ret; | ||
53 | } | ||
54 | |||
55 | dev = &state->i2c_client.dev; | ||
56 | |||
57 | /* rest of the initialisation goes here. */ | ||
58 | |||
59 | dev_info(dev, "example client created\n"); | ||
60 | |||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | static int __devexit example_detach(struct i2c_client *client) | ||
65 | { | ||
66 | struct example_state *state = i2c_get_clientdata(client); | ||
67 | |||
68 | i2c_detach_client(client); | ||
69 | kfree(state); | ||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | static int example_attach_adapter(struct i2c_adapter *adap) | ||
74 | { | ||
75 | return i2c_probe(adap, &addr_data, example_attach); | ||
76 | } | ||
77 | |||
78 | static struct i2c_driver example_driver = { | ||
79 | .driver = { | ||
80 | .owner = THIS_MODULE, | ||
81 | .name = "example", | ||
82 | }, | ||
83 | .attach_adapter = example_attach_adapter, | ||
84 | .detach_client = __devexit_p(example_detach), | ||
85 | .suspend = example_suspend, | ||
86 | .resume = example_resume, | ||
87 | }; | ||
88 | |||
89 | |||
90 | Updating the client | ||
91 | ------------------- | ||
92 | |||
93 | The new style binding model will check against a list of supported | ||
94 | devices and their associated address supplied by the code registering | ||
95 | the busses. This means that the driver .attach_adapter and | ||
96 | .detach_adapter methods can be removed, along with the addr_data, | ||
97 | as follows: | ||
98 | |||
99 | - static struct i2c_driver example_driver; | ||
100 | |||
101 | - static unsigned short ignore[] = { I2C_CLIENT_END }; | ||
102 | - static unsigned short normal_addr[] = { OUR_ADDR, I2C_CLIENT_END }; | ||
103 | |||
104 | - I2C_CLIENT_INSMOD; | ||
105 | |||
106 | - static int example_attach_adapter(struct i2c_adapter *adap) | ||
107 | - { | ||
108 | - return i2c_probe(adap, &addr_data, example_attach); | ||
109 | - } | ||
110 | |||
111 | static struct i2c_driver example_driver = { | ||
112 | - .attach_adapter = example_attach_adapter, | ||
113 | - .detach_client = __devexit_p(example_detach), | ||
114 | } | ||
115 | |||
116 | Add the probe and remove methods to the i2c_driver, as so: | ||
117 | |||
118 | static struct i2c_driver example_driver = { | ||
119 | + .probe = example_probe, | ||
120 | + .remove = __devexit_p(example_remove), | ||
121 | } | ||
122 | |||
123 | Change the example_attach method to accept the new parameters | ||
124 | which include the i2c_client that it will be working with: | ||
125 | |||
126 | - static int example_attach(struct i2c_adapter *adap, int addr, int kind) | ||
127 | + static int example_probe(struct i2c_client *client, | ||
128 | + const struct i2c_device_id *id) | ||
129 | |||
130 | Change the name of example_attach to example_probe to align it with the | ||
131 | i2c_driver entry names. The rest of the probe routine will now need to be | ||
132 | changed as the i2c_client has already been setup for use. | ||
133 | |||
134 | The necessary client fields have already been setup before | ||
135 | the probe function is called, so the following client setup | ||
136 | can be removed: | ||
137 | |||
138 | - example->client.addr = addr; | ||
139 | - example->client.flags = 0; | ||
140 | - example->client.adapter = adap; | ||
141 | - | ||
142 | - strlcpy(client->i2c_client.name, "example", I2C_NAME_SIZE); | ||
143 | |||
144 | The i2c_set_clientdata is now: | ||
145 | |||
146 | - i2c_set_clientdata(&state->client, state); | ||
147 | + i2c_set_clientdata(client, state); | ||
148 | |||
149 | The call to i2c_attach_client is no longer needed, if the probe | ||
150 | routine exits successfully, then the driver will be automatically | ||
151 | attached by the core. Change the probe routine as so: | ||
152 | |||
153 | - ret = i2c_attach_client(&state->i2c_client); | ||
154 | - if (ret < 0) { | ||
155 | - dev_err(dev, "failed to attach client\n"); | ||
156 | - kfree(state); | ||
157 | - return ret; | ||
158 | - } | ||
159 | |||
160 | |||
161 | Remove the storage of 'struct i2c_client' from the 'struct example_state' | ||
162 | as we are provided with the i2c_client in our example_probe. Instead we | ||
163 | store a pointer to it for when it is needed. | ||
164 | |||
165 | struct example_state { | ||
166 | - struct i2c_client client; | ||
167 | + struct i2c_client *client; | ||
168 | |||
169 | the new i2c client as so: | ||
170 | |||
171 | - struct device *dev = &adap->dev; /* to use for dev_ reports */ | ||
172 | + struct device *dev = &i2c_client->dev; /* to use for dev_ reports */ | ||
173 | |||
174 | And remove the change after our client is attached, as the driver no | ||
175 | longer needs to register a new client structure with the core: | ||
176 | |||
177 | - dev = &state->i2c_client.dev; | ||
178 | |||
179 | In the probe routine, ensure that the new state has the client stored | ||
180 | in it: | ||
181 | |||
182 | static int example_probe(struct i2c_client *i2c_client, | ||
183 | const struct i2c_device_id *id) | ||
184 | { | ||
185 | struct example_state *state; | ||
186 | struct device *dev = &i2c_client->dev; | ||
187 | int ret; | ||
188 | |||
189 | state = kzalloc(sizeof(struct example_state), GFP_KERNEL); | ||
190 | if (state == NULL) { | ||
191 | dev_err(dev, "failed to create our state\n"); | ||
192 | return -ENOMEM; | ||
193 | } | ||
194 | |||
195 | + state->client = i2c_client; | ||
196 | |||
197 | Update the detach method, by changing the name to _remove and | ||
198 | to delete the i2c_detach_client call. It is possible that you | ||
199 | can also remove the ret variable as it is not not needed for | ||
200 | any of the core functions. | ||
201 | |||
202 | - static int __devexit example_detach(struct i2c_client *client) | ||
203 | + static int __devexit example_remove(struct i2c_client *client) | ||
204 | { | ||
205 | struct example_state *state = i2c_get_clientdata(client); | ||
206 | |||
207 | - i2c_detach_client(client); | ||
208 | |||
209 | And finally ensure that we have the correct ID table for the i2c-core | ||
210 | and other utilities: | ||
211 | |||
212 | + struct i2c_device_id example_idtable[] = { | ||
213 | + { "example", 0 }, | ||
214 | + { } | ||
215 | +}; | ||
216 | + | ||
217 | +MODULE_DEVICE_TABLE(i2c, example_idtable); | ||
218 | |||
219 | static struct i2c_driver example_driver = { | ||
220 | .driver = { | ||
221 | .owner = THIS_MODULE, | ||
222 | .name = "example", | ||
223 | }, | ||
224 | + .id_table = example_ids, | ||
225 | |||
226 | |||
227 | Our driver should now look like this: | ||
228 | |||
229 | struct example_state { | ||
230 | struct i2c_client *client; | ||
231 | .... | ||
232 | }; | ||
233 | |||
234 | static int example_probe(struct i2c_client *client, | ||
235 | const struct i2c_device_id *id) | ||
236 | { | ||
237 | struct example_state *state; | ||
238 | struct device *dev = &client->dev; | ||
239 | |||
240 | state = kzalloc(sizeof(struct example_state), GFP_KERNEL); | ||
241 | if (state == NULL) { | ||
242 | dev_err(dev, "failed to create our state\n"); | ||
243 | return -ENOMEM; | ||
244 | } | ||
245 | |||
246 | state->client = client; | ||
247 | i2c_set_clientdata(client, state); | ||
248 | |||
249 | /* rest of the initialisation goes here. */ | ||
250 | |||
251 | dev_info(dev, "example client created\n"); | ||
252 | |||
253 | return 0; | ||
254 | } | ||
255 | |||
256 | static int __devexit example_remove(struct i2c_client *client) | ||
257 | { | ||
258 | struct example_state *state = i2c_get_clientdata(client); | ||
259 | |||
260 | kfree(state); | ||
261 | return 0; | ||
262 | } | ||
263 | |||
264 | static struct i2c_device_id example_idtable[] = { | ||
265 | { "example", 0 }, | ||
266 | { } | ||
267 | }; | ||
268 | |||
269 | MODULE_DEVICE_TABLE(i2c, example_idtable); | ||
270 | |||
271 | static struct i2c_driver example_driver = { | ||
272 | .driver = { | ||
273 | .owner = THIS_MODULE, | ||
274 | .name = "example", | ||
275 | }, | ||
276 | .id_table = example_idtable, | ||
277 | .probe = example_probe, | ||
278 | .remove = __devexit_p(example_remove), | ||
279 | .suspend = example_suspend, | ||
280 | .resume = example_resume, | ||
281 | }; | ||
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients index 6b61b3a2e90b..6b9af7d479c2 100644 --- a/Documentation/i2c/writing-clients +++ b/Documentation/i2c/writing-clients | |||
@@ -10,23 +10,21 @@ General remarks | |||
10 | =============== | 10 | =============== |
11 | 11 | ||
12 | Try to keep the kernel namespace as clean as possible. The best way to | 12 | Try to keep the kernel namespace as clean as possible. The best way to |
13 | do this is to use a unique prefix for all global symbols. This is | 13 | do this is to use a unique prefix for all global symbols. This is |
14 | especially important for exported symbols, but it is a good idea to do | 14 | especially important for exported symbols, but it is a good idea to do |
15 | it for non-exported symbols too. We will use the prefix `foo_' in this | 15 | it for non-exported symbols too. We will use the prefix `foo_' in this |
16 | tutorial, and `FOO_' for preprocessor variables. | 16 | tutorial. |
17 | 17 | ||
18 | 18 | ||
19 | The driver structure | 19 | The driver structure |
20 | ==================== | 20 | ==================== |
21 | 21 | ||
22 | Usually, you will implement a single driver structure, and instantiate | 22 | Usually, you will implement a single driver structure, and instantiate |
23 | all clients from it. Remember, a driver structure contains general access | 23 | all clients from it. Remember, a driver structure contains general access |
24 | routines, and should be zero-initialized except for fields with data you | 24 | routines, and should be zero-initialized except for fields with data you |
25 | provide. A client structure holds device-specific information like the | 25 | provide. A client structure holds device-specific information like the |
26 | driver model device node, and its I2C address. | 26 | driver model device node, and its I2C address. |
27 | 27 | ||
28 | /* iff driver uses driver model ("new style") binding model: */ | ||
29 | |||
30 | static struct i2c_device_id foo_idtable[] = { | 28 | static struct i2c_device_id foo_idtable[] = { |
31 | { "foo", my_id_for_foo }, | 29 | { "foo", my_id_for_foo }, |
32 | { "bar", my_id_for_bar }, | 30 | { "bar", my_id_for_bar }, |
@@ -40,7 +38,6 @@ static struct i2c_driver foo_driver = { | |||
40 | .name = "foo", | 38 | .name = "foo", |
41 | }, | 39 | }, |
42 | 40 | ||
43 | /* iff driver uses driver model ("new style") binding model: */ | ||
44 | .id_table = foo_ids, | 41 | .id_table = foo_ids, |
45 | .probe = foo_probe, | 42 | .probe = foo_probe, |
46 | .remove = foo_remove, | 43 | .remove = foo_remove, |
@@ -49,24 +46,19 @@ static struct i2c_driver foo_driver = { | |||
49 | .detect = foo_detect, | 46 | .detect = foo_detect, |
50 | .address_data = &addr_data, | 47 | .address_data = &addr_data, |
51 | 48 | ||
52 | /* else, driver uses "legacy" binding model: */ | ||
53 | .attach_adapter = foo_attach_adapter, | ||
54 | .detach_client = foo_detach_client, | ||
55 | |||
56 | /* these may be used regardless of the driver binding model */ | ||
57 | .shutdown = foo_shutdown, /* optional */ | 49 | .shutdown = foo_shutdown, /* optional */ |
58 | .suspend = foo_suspend, /* optional */ | 50 | .suspend = foo_suspend, /* optional */ |
59 | .resume = foo_resume, /* optional */ | 51 | .resume = foo_resume, /* optional */ |
60 | .command = foo_command, /* optional */ | 52 | .command = foo_command, /* optional, deprecated */ |
61 | } | 53 | } |
62 | 54 | ||
63 | The name field is the driver name, and must not contain spaces. It | 55 | The name field is the driver name, and must not contain spaces. It |
64 | should match the module name (if the driver can be compiled as a module), | 56 | should match the module name (if the driver can be compiled as a module), |
65 | although you can use MODULE_ALIAS (passing "foo" in this example) to add | 57 | although you can use MODULE_ALIAS (passing "foo" in this example) to add |
66 | another name for the module. If the driver name doesn't match the module | 58 | another name for the module. If the driver name doesn't match the module |
67 | name, the module won't be automatically loaded (hotplug/coldplug). | 59 | name, the module won't be automatically loaded (hotplug/coldplug). |
68 | 60 | ||
69 | All other fields are for call-back functions which will be explained | 61 | All other fields are for call-back functions which will be explained |
70 | below. | 62 | below. |
71 | 63 | ||
72 | 64 | ||
@@ -74,34 +66,13 @@ Extra client data | |||
74 | ================= | 66 | ================= |
75 | 67 | ||
76 | Each client structure has a special `data' field that can point to any | 68 | Each client structure has a special `data' field that can point to any |
77 | structure at all. You should use this to keep device-specific data, | 69 | structure at all. You should use this to keep device-specific data. |
78 | especially in drivers that handle multiple I2C or SMBUS devices. You | ||
79 | do not always need this, but especially for `sensors' drivers, it can | ||
80 | be very useful. | ||
81 | 70 | ||
82 | /* store the value */ | 71 | /* store the value */ |
83 | void i2c_set_clientdata(struct i2c_client *client, void *data); | 72 | void i2c_set_clientdata(struct i2c_client *client, void *data); |
84 | 73 | ||
85 | /* retrieve the value */ | 74 | /* retrieve the value */ |
86 | void *i2c_get_clientdata(struct i2c_client *client); | 75 | void *i2c_get_clientdata(const struct i2c_client *client); |
87 | |||
88 | An example structure is below. | ||
89 | |||
90 | struct foo_data { | ||
91 | struct i2c_client client; | ||
92 | enum chips type; /* To keep the chips type for `sensors' drivers. */ | ||
93 | |||
94 | /* Because the i2c bus is slow, it is often useful to cache the read | ||
95 | information of a chip for some time (for example, 1 or 2 seconds). | ||
96 | It depends of course on the device whether this is really worthwhile | ||
97 | or even sensible. */ | ||
98 | struct mutex update_lock; /* When we are reading lots of information, | ||
99 | another process should not update the | ||
100 | below information */ | ||
101 | char valid; /* != 0 if the following fields are valid. */ | ||
102 | unsigned long last_updated; /* In jiffies */ | ||
103 | /* Add the read information here too */ | ||
104 | }; | ||
105 | 76 | ||
106 | 77 | ||
107 | Accessing the client | 78 | Accessing the client |
@@ -109,11 +80,9 @@ Accessing the client | |||
109 | 80 | ||
110 | Let's say we have a valid client structure. At some time, we will need | 81 | Let's say we have a valid client structure. At some time, we will need |
111 | to gather information from the client, or write new information to the | 82 | to gather information from the client, or write new information to the |
112 | client. How we will export this information to user-space is less | 83 | client. |
113 | important at this moment (perhaps we do not need to do this at all for | ||
114 | some obscure clients). But we need generic reading and writing routines. | ||
115 | 84 | ||
116 | I have found it useful to define foo_read and foo_write function for this. | 85 | I have found it useful to define foo_read and foo_write functions for this. |
117 | For some cases, it will be easier to call the i2c functions directly, | 86 | For some cases, it will be easier to call the i2c functions directly, |
118 | but many chips have some kind of register-value idea that can easily | 87 | but many chips have some kind of register-value idea that can easily |
119 | be encapsulated. | 88 | be encapsulated. |
@@ -121,33 +90,33 @@ be encapsulated. | |||
121 | The below functions are simple examples, and should not be copied | 90 | The below functions are simple examples, and should not be copied |
122 | literally. | 91 | literally. |
123 | 92 | ||
124 | int foo_read_value(struct i2c_client *client, u8 reg) | 93 | int foo_read_value(struct i2c_client *client, u8 reg) |
125 | { | 94 | { |
126 | if (reg < 0x10) /* byte-sized register */ | 95 | if (reg < 0x10) /* byte-sized register */ |
127 | return i2c_smbus_read_byte_data(client,reg); | 96 | return i2c_smbus_read_byte_data(client, reg); |
128 | else /* word-sized register */ | 97 | else /* word-sized register */ |
129 | return i2c_smbus_read_word_data(client,reg); | 98 | return i2c_smbus_read_word_data(client, reg); |
130 | } | 99 | } |
131 | 100 | ||
132 | int foo_write_value(struct i2c_client *client, u8 reg, u16 value) | 101 | int foo_write_value(struct i2c_client *client, u8 reg, u16 value) |
133 | { | 102 | { |
134 | if (reg == 0x10) /* Impossible to write - driver error! */ { | 103 | if (reg == 0x10) /* Impossible to write - driver error! */ |
135 | return -1; | 104 | return -EINVAL; |
136 | else if (reg < 0x10) /* byte-sized register */ | 105 | else if (reg < 0x10) /* byte-sized register */ |
137 | return i2c_smbus_write_byte_data(client,reg,value); | 106 | return i2c_smbus_write_byte_data(client, reg, value); |
138 | else /* word-sized register */ | 107 | else /* word-sized register */ |
139 | return i2c_smbus_write_word_data(client,reg,value); | 108 | return i2c_smbus_write_word_data(client, reg, value); |
140 | } | 109 | } |
141 | 110 | ||
142 | 111 | ||
143 | Probing and attaching | 112 | Probing and attaching |
144 | ===================== | 113 | ===================== |
145 | 114 | ||
146 | The Linux I2C stack was originally written to support access to hardware | 115 | The Linux I2C stack was originally written to support access to hardware |
147 | monitoring chips on PC motherboards, and thus it embeds some assumptions | 116 | monitoring chips on PC motherboards, and thus used to embed some assumptions |
148 | that are more appropriate to SMBus (and PCs) than to I2C. One of these | 117 | that were more appropriate to SMBus (and PCs) than to I2C. One of these |
149 | assumptions is that most adapters and devices drivers support the SMBUS_QUICK | 118 | assumptions was that most adapters and devices drivers support the SMBUS_QUICK |
150 | protocol to probe device presence. Another is that devices and their drivers | 119 | protocol to probe device presence. Another was that devices and their drivers |
151 | can be sufficiently configured using only such probe primitives. | 120 | can be sufficiently configured using only such probe primitives. |
152 | 121 | ||
153 | As Linux and its I2C stack became more widely used in embedded systems | 122 | As Linux and its I2C stack became more widely used in embedded systems |
@@ -164,6 +133,9 @@ since the "legacy" model requires drivers to create "i2c_client" device | |||
164 | objects after SMBus style probing, while the Linux driver model expects | 133 | objects after SMBus style probing, while the Linux driver model expects |
165 | drivers to be given such device objects in their probe() routines. | 134 | drivers to be given such device objects in their probe() routines. |
166 | 135 | ||
136 | The legacy model is deprecated now and will soon be removed, so we no | ||
137 | longer document it here. | ||
138 | |||
167 | 139 | ||
168 | Standard Driver Model Binding ("New Style") | 140 | Standard Driver Model Binding ("New Style") |
169 | ------------------------------------------- | 141 | ------------------------------------------- |
@@ -193,8 +165,8 @@ matches the device's name. It is passed the entry that was matched so | |||
193 | the driver knows which one in the table matched. | 165 | the driver knows which one in the table matched. |
194 | 166 | ||
195 | 167 | ||
196 | Device Creation (Standard driver model) | 168 | Device Creation |
197 | --------------------------------------- | 169 | --------------- |
198 | 170 | ||
199 | If you know for a fact that an I2C device is connected to a given I2C bus, | 171 | If you know for a fact that an I2C device is connected to a given I2C bus, |
200 | you can instantiate that device by simply filling an i2c_board_info | 172 | you can instantiate that device by simply filling an i2c_board_info |
@@ -221,8 +193,8 @@ in the I2C bus driver. You may want to save the returned i2c_client | |||
221 | reference for later use. | 193 | reference for later use. |
222 | 194 | ||
223 | 195 | ||
224 | Device Detection (Standard driver model) | 196 | Device Detection |
225 | ---------------------------------------- | 197 | ---------------- |
226 | 198 | ||
227 | Sometimes you do not know in advance which I2C devices are connected to | 199 | Sometimes you do not know in advance which I2C devices are connected to |
228 | a given I2C bus. This is for example the case of hardware monitoring | 200 | a given I2C bus. This is for example the case of hardware monitoring |
@@ -246,8 +218,8 @@ otherwise misdetections are likely to occur and things can get wrong | |||
246 | quickly. | 218 | quickly. |
247 | 219 | ||
248 | 220 | ||
249 | Device Deletion (Standard driver model) | 221 | Device Deletion |
250 | --------------------------------------- | 222 | --------------- |
251 | 223 | ||
252 | Each I2C device which has been created using i2c_new_device() or | 224 | Each I2C device which has been created using i2c_new_device() or |
253 | i2c_new_probed_device() can be unregistered by calling | 225 | i2c_new_probed_device() can be unregistered by calling |
@@ -256,264 +228,37 @@ called automatically before the underlying I2C bus itself is removed, as a | |||
256 | device can't survive its parent in the device driver model. | 228 | device can't survive its parent in the device driver model. |
257 | 229 | ||
258 | 230 | ||
259 | Legacy Driver Binding Model | 231 | Initializing the driver |
260 | --------------------------- | 232 | ======================= |
233 | |||
234 | When the kernel is booted, or when your foo driver module is inserted, | ||
235 | you have to do some initializing. Fortunately, just registering the | ||
236 | driver module is usually enough. | ||
261 | 237 | ||
262 | Most i2c devices can be present on several i2c addresses; for some this | 238 | static int __init foo_init(void) |
263 | is determined in hardware (by soldering some chip pins to Vcc or Ground), | 239 | { |
264 | for others this can be changed in software (by writing to specific client | 240 | return i2c_add_driver(&foo_driver); |
265 | registers). Some devices are usually on a specific address, but not always; | 241 | } |
266 | and some are even more tricky. So you will probably need to scan several | 242 | |
267 | i2c addresses for your clients, and do some sort of detection to see | 243 | static void __exit foo_cleanup(void) |
268 | whether it is actually a device supported by your driver. | 244 | { |
245 | i2c_del_driver(&foo_driver); | ||
246 | } | ||
247 | |||
248 | /* Substitute your own name and email address */ | ||
249 | MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>" | ||
250 | MODULE_DESCRIPTION("Driver for Barf Inc. Foo I2C devices"); | ||
269 | 251 | ||
270 | To give the user a maximum of possibilities, some default module parameters | 252 | /* a few non-GPL license types are also allowed */ |
271 | are defined to help determine what addresses are scanned. Several macros | 253 | MODULE_LICENSE("GPL"); |
272 | are defined in i2c.h to help you support them, as well as a generic | 254 | |
273 | detection algorithm. | 255 | module_init(foo_init); |
274 | 256 | module_exit(foo_cleanup); | |
275 | You do not have to use this parameter interface; but don't try to use | 257 | |
276 | function i2c_probe() if you don't. | 258 | Note that some functions are marked by `__init'. These functions can |
277 | 259 | be removed after kernel booting (or module loading) is completed. | |
278 | 260 | Likewise, functions marked by `__exit' are dropped by the compiler when | |
279 | Probing classes (Legacy model) | 261 | the code is built into the kernel, as they would never be called. |
280 | ------------------------------ | ||
281 | |||
282 | All parameters are given as lists of unsigned 16-bit integers. Lists are | ||
283 | terminated by I2C_CLIENT_END. | ||
284 | The following lists are used internally: | ||
285 | |||
286 | normal_i2c: filled in by the module writer. | ||
287 | A list of I2C addresses which should normally be examined. | ||
288 | probe: insmod parameter. | ||
289 | A list of pairs. The first value is a bus number (-1 for any I2C bus), | ||
290 | the second is the address. These addresses are also probed, as if they | ||
291 | were in the 'normal' list. | ||
292 | ignore: insmod parameter. | ||
293 | A list of pairs. The first value is a bus number (-1 for any I2C bus), | ||
294 | the second is the I2C address. These addresses are never probed. | ||
295 | This parameter overrules the 'normal_i2c' list only. | ||
296 | force: insmod parameter. | ||
297 | A list of pairs. The first value is a bus number (-1 for any I2C bus), | ||
298 | the second is the I2C address. A device is blindly assumed to be on | ||
299 | the given address, no probing is done. | ||
300 | |||
301 | Additionally, kind-specific force lists may optionally be defined if | ||
302 | the driver supports several chip kinds. They are grouped in a | ||
303 | NULL-terminated list of pointers named forces, those first element if the | ||
304 | generic force list mentioned above. Each additional list correspond to an | ||
305 | insmod parameter of the form force_<kind>. | ||
306 | |||
307 | Fortunately, as a module writer, you just have to define the `normal_i2c' | ||
308 | parameter. The complete declaration could look like this: | ||
309 | |||
310 | /* Scan 0x4c to 0x4f */ | ||
311 | static const unsigned short normal_i2c[] = { 0x4c, 0x4d, 0x4e, 0x4f, | ||
312 | I2C_CLIENT_END }; | ||
313 | |||
314 | /* Magic definition of all other variables and things */ | ||
315 | I2C_CLIENT_INSMOD; | ||
316 | /* Or, if your driver supports, say, 2 kind of devices: */ | ||
317 | I2C_CLIENT_INSMOD_2(foo, bar); | ||
318 | |||
319 | If you use the multi-kind form, an enum will be defined for you: | ||
320 | enum chips { any_chip, foo, bar, ... } | ||
321 | You can then (and certainly should) use it in the driver code. | ||
322 | |||
323 | Note that you *have* to call the defined variable `normal_i2c', | ||
324 | without any prefix! | ||
325 | |||
326 | |||
327 | Attaching to an adapter (Legacy model) | ||
328 | -------------------------------------- | ||
329 | |||
330 | Whenever a new adapter is inserted, or for all adapters if the driver is | ||
331 | being registered, the callback attach_adapter() is called. Now is the | ||
332 | time to determine what devices are present on the adapter, and to register | ||
333 | a client for each of them. | ||
334 | |||
335 | The attach_adapter callback is really easy: we just call the generic | ||
336 | detection function. This function will scan the bus for us, using the | ||
337 | information as defined in the lists explained above. If a device is | ||
338 | detected at a specific address, another callback is called. | ||
339 | |||
340 | int foo_attach_adapter(struct i2c_adapter *adapter) | ||
341 | { | ||
342 | return i2c_probe(adapter,&addr_data,&foo_detect_client); | ||
343 | } | ||
344 | |||
345 | Remember, structure `addr_data' is defined by the macros explained above, | ||
346 | so you do not have to define it yourself. | ||
347 | |||
348 | The i2c_probe function will call the foo_detect_client | ||
349 | function only for those i2c addresses that actually have a device on | ||
350 | them (unless a `force' parameter was used). In addition, addresses that | ||
351 | are already in use (by some other registered client) are skipped. | ||
352 | |||
353 | |||
354 | The detect client function (Legacy model) | ||
355 | ----------------------------------------- | ||
356 | |||
357 | The detect client function is called by i2c_probe. The `kind' parameter | ||
358 | contains -1 for a probed detection, 0 for a forced detection, or a positive | ||
359 | number for a forced detection with a chip type forced. | ||
360 | |||
361 | Returning an error different from -ENODEV in a detect function will cause | ||
362 | the detection to stop: other addresses and adapters won't be scanned. | ||
363 | This should only be done on fatal or internal errors, such as a memory | ||
364 | shortage or i2c_attach_client failing. | ||
365 | |||
366 | For now, you can ignore the `flags' parameter. It is there for future use. | ||
367 | |||
368 | int foo_detect_client(struct i2c_adapter *adapter, int address, | ||
369 | int kind) | ||
370 | { | ||
371 | int err = 0; | ||
372 | int i; | ||
373 | struct i2c_client *client; | ||
374 | struct foo_data *data; | ||
375 | const char *name = ""; | ||
376 | |||
377 | /* Let's see whether this adapter can support what we need. | ||
378 | Please substitute the things you need here! */ | ||
379 | if (!i2c_check_functionality(adapter,I2C_FUNC_SMBUS_WORD_DATA | | ||
380 | I2C_FUNC_SMBUS_WRITE_BYTE)) | ||
381 | goto ERROR0; | ||
382 | |||
383 | /* OK. For now, we presume we have a valid client. We now create the | ||
384 | client structure, even though we cannot fill it completely yet. | ||
385 | But it allows us to access several i2c functions safely */ | ||
386 | |||
387 | if (!(data = kzalloc(sizeof(struct foo_data), GFP_KERNEL))) { | ||
388 | err = -ENOMEM; | ||
389 | goto ERROR0; | ||
390 | } | ||
391 | |||
392 | client = &data->client; | ||
393 | i2c_set_clientdata(client, data); | ||
394 | |||
395 | client->addr = address; | ||
396 | client->adapter = adapter; | ||
397 | client->driver = &foo_driver; | ||
398 | |||
399 | /* Now, we do the remaining detection. If no `force' parameter is used. */ | ||
400 | |||
401 | /* First, the generic detection (if any), that is skipped if any force | ||
402 | parameter was used. */ | ||
403 | if (kind < 0) { | ||
404 | /* The below is of course bogus */ | ||
405 | if (foo_read(client, FOO_REG_GENERIC) != FOO_GENERIC_VALUE) | ||
406 | goto ERROR1; | ||
407 | } | ||
408 | |||
409 | /* Next, specific detection. This is especially important for `sensors' | ||
410 | devices. */ | ||
411 | |||
412 | /* Determine the chip type. Not needed if a `force_CHIPTYPE' parameter | ||
413 | was used. */ | ||
414 | if (kind <= 0) { | ||
415 | i = foo_read(client, FOO_REG_CHIPTYPE); | ||
416 | if (i == FOO_TYPE_1) | ||
417 | kind = chip1; /* As defined in the enum */ | ||
418 | else if (i == FOO_TYPE_2) | ||
419 | kind = chip2; | ||
420 | else { | ||
421 | printk("foo: Ignoring 'force' parameter for unknown chip at " | ||
422 | "adapter %d, address 0x%02x\n",i2c_adapter_id(adapter),address); | ||
423 | goto ERROR1; | ||
424 | } | ||
425 | } | ||
426 | |||
427 | /* Now set the type and chip names */ | ||
428 | if (kind == chip1) { | ||
429 | name = "chip1"; | ||
430 | } else if (kind == chip2) { | ||
431 | name = "chip2"; | ||
432 | } | ||
433 | |||
434 | /* Fill in the remaining client fields. */ | ||
435 | strlcpy(client->name, name, I2C_NAME_SIZE); | ||
436 | data->type = kind; | ||
437 | mutex_init(&data->update_lock); /* Only if you use this field */ | ||
438 | |||
439 | /* Any other initializations in data must be done here too. */ | ||
440 | |||
441 | /* This function can write default values to the client registers, if | ||
442 | needed. */ | ||
443 | foo_init_client(client); | ||
444 | |||
445 | /* Tell the i2c layer a new client has arrived */ | ||
446 | if ((err = i2c_attach_client(client))) | ||
447 | goto ERROR1; | ||
448 | |||
449 | return 0; | ||
450 | |||
451 | /* OK, this is not exactly good programming practice, usually. But it is | ||
452 | very code-efficient in this case. */ | ||
453 | |||
454 | ERROR1: | ||
455 | kfree(data); | ||
456 | ERROR0: | ||
457 | return err; | ||
458 | } | ||
459 | |||
460 | |||
461 | Removing the client (Legacy model) | ||
462 | ================================== | ||
463 | |||
464 | The detach_client call back function is called when a client should be | ||
465 | removed. It may actually fail, but only when panicking. This code is | ||
466 | much simpler than the attachment code, fortunately! | ||
467 | |||
468 | int foo_detach_client(struct i2c_client *client) | ||
469 | { | ||
470 | int err; | ||
471 | |||
472 | /* Try to detach the client from i2c space */ | ||
473 | if ((err = i2c_detach_client(client))) | ||
474 | return err; | ||
475 | |||
476 | kfree(i2c_get_clientdata(client)); | ||
477 | return 0; | ||
478 | } | ||
479 | |||
480 | |||
481 | Initializing the module or kernel | ||
482 | ================================= | ||
483 | |||
484 | When the kernel is booted, or when your foo driver module is inserted, | ||
485 | you have to do some initializing. Fortunately, just attaching (registering) | ||
486 | the driver module is usually enough. | ||
487 | |||
488 | static int __init foo_init(void) | ||
489 | { | ||
490 | int res; | ||
491 | |||
492 | if ((res = i2c_add_driver(&foo_driver))) { | ||
493 | printk("foo: Driver registration failed, module not inserted.\n"); | ||
494 | return res; | ||
495 | } | ||
496 | return 0; | ||
497 | } | ||
498 | |||
499 | static void __exit foo_cleanup(void) | ||
500 | { | ||
501 | i2c_del_driver(&foo_driver); | ||
502 | } | ||
503 | |||
504 | /* Substitute your own name and email address */ | ||
505 | MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>" | ||
506 | MODULE_DESCRIPTION("Driver for Barf Inc. Foo I2C devices"); | ||
507 | |||
508 | /* a few non-GPL license types are also allowed */ | ||
509 | MODULE_LICENSE("GPL"); | ||
510 | |||
511 | module_init(foo_init); | ||
512 | module_exit(foo_cleanup); | ||
513 | |||
514 | Note that some functions are marked by `__init', and some data structures | ||
515 | by `__initdata'. These functions and structures can be removed after | ||
516 | kernel booting (or module loading) is completed. | ||
517 | 262 | ||
518 | 263 | ||
519 | Power Management | 264 | Power Management |
@@ -548,33 +293,35 @@ Command function | |||
548 | 293 | ||
549 | A generic ioctl-like function call back is supported. You will seldom | 294 | A generic ioctl-like function call back is supported. You will seldom |
550 | need this, and its use is deprecated anyway, so newer design should not | 295 | need this, and its use is deprecated anyway, so newer design should not |
551 | use it. Set it to NULL. | 296 | use it. |
552 | 297 | ||
553 | 298 | ||
554 | Sending and receiving | 299 | Sending and receiving |
555 | ===================== | 300 | ===================== |
556 | 301 | ||
557 | If you want to communicate with your device, there are several functions | 302 | If you want to communicate with your device, there are several functions |
558 | to do this. You can find all of them in i2c.h. | 303 | to do this. You can find all of them in <linux/i2c.h>. |
559 | 304 | ||
560 | If you can choose between plain i2c communication and SMBus level | 305 | If you can choose between plain I2C communication and SMBus level |
561 | communication, please use the last. All adapters understand SMBus level | 306 | communication, please use the latter. All adapters understand SMBus level |
562 | commands, but only some of them understand plain i2c! | 307 | commands, but only some of them understand plain I2C! |
563 | 308 | ||
564 | 309 | ||
565 | Plain i2c communication | 310 | Plain I2C communication |
566 | ----------------------- | 311 | ----------------------- |
567 | 312 | ||
568 | extern int i2c_master_send(struct i2c_client *,const char* ,int); | 313 | int i2c_master_send(struct i2c_client *client, const char *buf, |
569 | extern int i2c_master_recv(struct i2c_client *,char* ,int); | 314 | int count); |
315 | int i2c_master_recv(struct i2c_client *client, char *buf, int count); | ||
570 | 316 | ||
571 | These routines read and write some bytes from/to a client. The client | 317 | These routines read and write some bytes from/to a client. The client |
572 | contains the i2c address, so you do not have to include it. The second | 318 | contains the i2c address, so you do not have to include it. The second |
573 | parameter contains the bytes the read/write, the third the length of the | 319 | parameter contains the bytes to read/write, the third the number of bytes |
574 | buffer. Returned is the actual number of bytes read/written. | 320 | to read/write (must be less than the length of the buffer.) Returned is |
575 | 321 | the actual number of bytes read/written. | |
576 | extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msg, | 322 | |
577 | int num); | 323 | int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msg, |
324 | int num); | ||
578 | 325 | ||
579 | This sends a series of messages. Each message can be a read or write, | 326 | This sends a series of messages. Each message can be a read or write, |
580 | and they can be mixed in any way. The transactions are combined: no | 327 | and they can be mixed in any way. The transactions are combined: no |
@@ -583,49 +330,45 @@ for each message the client address, the number of bytes of the message | |||
583 | and the message data itself. | 330 | and the message data itself. |
584 | 331 | ||
585 | You can read the file `i2c-protocol' for more information about the | 332 | You can read the file `i2c-protocol' for more information about the |
586 | actual i2c protocol. | 333 | actual I2C protocol. |
587 | 334 | ||
588 | 335 | ||
589 | SMBus communication | 336 | SMBus communication |
590 | ------------------- | 337 | ------------------- |
591 | 338 | ||
592 | extern s32 i2c_smbus_xfer (struct i2c_adapter * adapter, u16 addr, | 339 | s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, |
593 | unsigned short flags, | 340 | unsigned short flags, char read_write, u8 command, |
594 | char read_write, u8 command, int size, | 341 | int size, union i2c_smbus_data *data); |
595 | union i2c_smbus_data * data); | 342 | |
596 | 343 | This is the generic SMBus function. All functions below are implemented | |
597 | This is the generic SMBus function. All functions below are implemented | 344 | in terms of it. Never use this function directly! |
598 | in terms of it. Never use this function directly! | 345 | |
599 | 346 | s32 i2c_smbus_read_byte(struct i2c_client *client); | |
600 | 347 | s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value); | |
601 | extern s32 i2c_smbus_read_byte(struct i2c_client * client); | 348 | s32 i2c_smbus_read_byte_data(struct i2c_client *client, u8 command); |
602 | extern s32 i2c_smbus_write_byte(struct i2c_client * client, u8 value); | 349 | s32 i2c_smbus_write_byte_data(struct i2c_client *client, |
603 | extern s32 i2c_smbus_read_byte_data(struct i2c_client * client, u8 command); | 350 | u8 command, u8 value); |
604 | extern s32 i2c_smbus_write_byte_data(struct i2c_client * client, | 351 | s32 i2c_smbus_read_word_data(struct i2c_client *client, u8 command); |
605 | u8 command, u8 value); | 352 | s32 i2c_smbus_write_word_data(struct i2c_client *client, |
606 | extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command); | 353 | u8 command, u16 value); |
607 | extern s32 i2c_smbus_write_word_data(struct i2c_client * client, | 354 | s32 i2c_smbus_process_call(struct i2c_client *client, |
608 | u8 command, u16 value); | 355 | u8 command, u16 value); |
609 | extern s32 i2c_smbus_read_block_data(struct i2c_client * client, | 356 | s32 i2c_smbus_read_block_data(struct i2c_client *client, |
610 | u8 command, u8 *values); | 357 | u8 command, u8 *values); |
611 | extern s32 i2c_smbus_write_block_data(struct i2c_client * client, | 358 | s32 i2c_smbus_write_block_data(struct i2c_client *client, |
612 | u8 command, u8 length, | 359 | u8 command, u8 length, const u8 *values); |
613 | u8 *values); | 360 | s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, |
614 | extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client, | 361 | u8 command, u8 length, u8 *values); |
615 | u8 command, u8 length, u8 *values); | 362 | s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, |
616 | extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client, | 363 | u8 command, u8 length, |
617 | u8 command, u8 length, | 364 | const u8 *values); |
618 | u8 *values); | ||
619 | 365 | ||
620 | These ones were removed from i2c-core because they had no users, but could | 366 | These ones were removed from i2c-core because they had no users, but could |
621 | be added back later if needed: | 367 | be added back later if needed: |
622 | 368 | ||
623 | extern s32 i2c_smbus_write_quick(struct i2c_client * client, u8 value); | 369 | s32 i2c_smbus_write_quick(struct i2c_client *client, u8 value); |
624 | extern s32 i2c_smbus_process_call(struct i2c_client * client, | 370 | s32 i2c_smbus_block_process_call(struct i2c_client *client, |
625 | u8 command, u16 value); | 371 | u8 command, u8 length, u8 *values); |
626 | extern s32 i2c_smbus_block_process_call(struct i2c_client *client, | ||
627 | u8 command, u8 length, | ||
628 | u8 *values) | ||
629 | 372 | ||
630 | All these transactions return a negative errno value on failure. The 'write' | 373 | All these transactions return a negative errno value on failure. The 'write' |
631 | transactions return 0 on success; the 'read' transactions return the read | 374 | transactions return 0 on success; the 'read' transactions return the read |
@@ -642,7 +385,5 @@ General purpose routines | |||
642 | Below all general purpose routines are listed, that were not mentioned | 385 | Below all general purpose routines are listed, that were not mentioned |
643 | before. | 386 | before. |
644 | 387 | ||
645 | /* This call returns a unique low identifier for each registered adapter. | 388 | /* Return the adapter number for a specific adapter */ |
646 | */ | 389 | int i2c_adapter_id(struct i2c_adapter *adap); |
647 | extern int i2c_adapter_id(struct i2c_adapter *adap); | ||
648 | |||
diff --git a/Documentation/ia64/Makefile b/Documentation/ia64/Makefile new file mode 100644 index 000000000000..b75db69ec483 --- /dev/null +++ b/Documentation/ia64/Makefile | |||
@@ -0,0 +1,8 @@ | |||
1 | # kbuild trick to avoid linker error. Can be omitted if a module is built. | ||
2 | obj- := dummy.o | ||
3 | |||
4 | # List of programs to build | ||
5 | hostprogs-y := aliasing-test | ||
6 | |||
7 | # Tell kbuild to always build the programs | ||
8 | always := $(hostprogs-y) | ||
diff --git a/Documentation/ia64/kvm.txt b/Documentation/ia64/kvm.txt index bec9d815da33..84f7cb3d5bec 100644 --- a/Documentation/ia64/kvm.txt +++ b/Documentation/ia64/kvm.txt | |||
@@ -1,7 +1,8 @@ | |||
1 | Currently, kvm module in EXPERIMENTAL stage on IA64. This means that | 1 | Currently, kvm module is in EXPERIMENTAL stage on IA64. This means that |
2 | interfaces are not stable enough to use. So, plase had better don't run | 2 | interfaces are not stable enough to use. So, please don't run critical |
3 | critical applications in virtual machine. We will try our best to make it | 3 | applications in virtual machine. |
4 | strong in future versions! | 4 | We will try our best to improve it in future versions! |
5 | |||
5 | Guide: How to boot up guests on kvm/ia64 | 6 | Guide: How to boot up guests on kvm/ia64 |
6 | 7 | ||
7 | This guide is to describe how to enable kvm support for IA-64 systems. | 8 | This guide is to describe how to enable kvm support for IA-64 systems. |
@@ -50,9 +51,9 @@ Note: For step 2, please make sure that host page size == TARGET_PAGE_SIZE of qe | |||
50 | /usr/local/bin/qemu-system-ia64 -smp xx -m 512 -hda $your_image | 51 | /usr/local/bin/qemu-system-ia64 -smp xx -m 512 -hda $your_image |
51 | (xx is the number of virtual processors for the guest, now the maximum value is 4) | 52 | (xx is the number of virtual processors for the guest, now the maximum value is 4) |
52 | 53 | ||
53 | 5. Known possibile issue on some platforms with old Firmware. | 54 | 5. Known possible issue on some platforms with old Firmware. |
54 | 55 | ||
55 | If meet strange host crashe issues, try to solve it through either of the following ways: | 56 | In the event of strange host crash issues, try to solve it through either of the following ways: |
56 | 57 | ||
57 | (1): Upgrade your Firmware to the latest one. | 58 | (1): Upgrade your Firmware to the latest one. |
58 | 59 | ||
@@ -65,8 +66,8 @@ index 0b53344..f02b0f7 100644 | |||
65 | mov ar.pfs = loc1 | 66 | mov ar.pfs = loc1 |
66 | mov rp = loc0 | 67 | mov rp = loc0 |
67 | ;; | 68 | ;; |
68 | - srlz.d // seralize restoration of psr.l | 69 | - srlz.d // serialize restoration of psr.l |
69 | + srlz.i // seralize restoration of psr.l | 70 | + srlz.i // serialize restoration of psr.l |
70 | + ;; | 71 | + ;; |
71 | br.ret.sptk.many b0 | 72 | br.ret.sptk.many b0 |
72 | END(ia64_pal_call_static) | 73 | END(ia64_pal_call_static) |
diff --git a/Documentation/ia64/paravirt_ops.txt b/Documentation/ia64/paravirt_ops.txt new file mode 100644 index 000000000000..39ded02ec33f --- /dev/null +++ b/Documentation/ia64/paravirt_ops.txt | |||
@@ -0,0 +1,137 @@ | |||
1 | Paravirt_ops on IA64 | ||
2 | ==================== | ||
3 | 21 May 2008, Isaku Yamahata <yamahata@valinux.co.jp> | ||
4 | |||
5 | |||
6 | Introduction | ||
7 | ------------ | ||
8 | The aim of this documentation is to help with maintainability and/or to | ||
9 | encourage people to use paravirt_ops/IA64. | ||
10 | |||
11 | paravirt_ops (pv_ops in short) is a way for virtualization support of | ||
12 | Linux kernel on x86. Several ways for virtualization support were | ||
13 | proposed, paravirt_ops is the winner. | ||
14 | On the other hand, now there are also several IA64 virtualization | ||
15 | technologies like kvm/IA64, xen/IA64 and many other academic IA64 | ||
16 | hypervisors so that it is good to add generic virtualization | ||
17 | infrastructure on Linux/IA64. | ||
18 | |||
19 | |||
20 | What is paravirt_ops? | ||
21 | --------------------- | ||
22 | It has been developed on x86 as virtualization support via API, not ABI. | ||
23 | It allows each hypervisor to override operations which are important for | ||
24 | hypervisors at API level. And it allows a single kernel binary to run on | ||
25 | all supported execution environments including native machine. | ||
26 | Essentially paravirt_ops is a set of function pointers which represent | ||
27 | operations corresponding to low level sensitive instructions and high | ||
28 | level functionalities in various area. But one significant difference | ||
29 | from usual function pointer table is that it allows optimization with | ||
30 | binary patch. It is because some of these operations are very | ||
31 | performance sensitive and indirect call overhead is not negligible. | ||
32 | With binary patch, indirect C function call can be transformed into | ||
33 | direct C function call or in-place execution to eliminate the overhead. | ||
34 | |||
35 | Thus, operations of paravirt_ops are classified into three categories. | ||
36 | - simple indirect call | ||
37 | These operations correspond to high level functionality so that the | ||
38 | overhead of indirect call isn't very important. | ||
39 | |||
40 | - indirect call which allows optimization with binary patch | ||
41 | Usually these operations correspond to low level instructions. They | ||
42 | are called frequently and performance critical. So the overhead is | ||
43 | very important. | ||
44 | |||
45 | - a set of macros for hand written assembly code | ||
46 | Hand written assembly codes (.S files) also need paravirtualization | ||
47 | because they include sensitive instructions or some of code paths in | ||
48 | them are very performance critical. | ||
49 | |||
50 | |||
51 | The relation to the IA64 machine vector | ||
52 | --------------------------------------- | ||
53 | Linux/IA64 has the IA64 machine vector functionality which allows the | ||
54 | kernel to switch implementations (e.g. initialization, ipi, dma api...) | ||
55 | depending on executing platform. | ||
56 | We can replace some implementations very easily defining a new machine | ||
57 | vector. Thus another approach for virtualization support would be | ||
58 | enhancing the machine vector functionality. | ||
59 | But paravirt_ops approach was taken because | ||
60 | - virtualization support needs wider support than machine vector does. | ||
61 | e.g. low level instruction paravirtualization. It must be | ||
62 | initialized very early before platform detection. | ||
63 | |||
64 | - virtualization support needs more functionality like binary patch. | ||
65 | Probably the calling overhead might not be very large compared to the | ||
66 | emulation overhead of virtualization. However in the native case, the | ||
67 | overhead should be eliminated completely. | ||
68 | A single kernel binary should run on each environment including native, | ||
69 | and the overhead of paravirt_ops on native environment should be as | ||
70 | small as possible. | ||
71 | |||
72 | - for full virtualization technology, e.g. KVM/IA64 or | ||
73 | Xen/IA64 HVM domain, the result would be | ||
74 | (the emulated platform machine vector. probably dig) + (pv_ops). | ||
75 | This means that the virtualization support layer should be under | ||
76 | the machine vector layer. | ||
77 | |||
78 | Possibly it might be better to move some function pointers from | ||
79 | paravirt_ops to machine vector. In fact, Xen domU case utilizes both | ||
80 | pv_ops and machine vector. | ||
81 | |||
82 | |||
83 | IA64 paravirt_ops | ||
84 | ----------------- | ||
85 | In this section, the concrete paravirt_ops will be discussed. | ||
86 | Because of the architecture difference between ia64 and x86, the | ||
87 | resulting set of functions is very different from x86 pv_ops. | ||
88 | |||
89 | - C function pointer tables | ||
90 | They are not very performance critical so that simple C indirect | ||
91 | function call is acceptable. The following structures are defined at | ||
92 | this moment. For details see linux/include/asm-ia64/paravirt.h | ||
93 | - struct pv_info | ||
94 | This structure describes the execution environment. | ||
95 | - struct pv_init_ops | ||
96 | This structure describes the various initialization hooks. | ||
97 | - struct pv_iosapic_ops | ||
98 | This structure describes hooks to iosapic operations. | ||
99 | - struct pv_irq_ops | ||
100 | This structure describes hooks to irq related operations | ||
101 | - struct pv_time_op | ||
102 | This structure describes hooks to steal time accounting. | ||
103 | |||
104 | - a set of indirect calls which need optimization | ||
105 | Currently this class of functions correspond to a subset of IA64 | ||
106 | intrinsics. At this moment the optimization with binary patch isn't | ||
107 | implemented yet. | ||
108 | struct pv_cpu_op is defined. For details see | ||
109 | linux/include/asm-ia64/paravirt_privop.h | ||
110 | Mostly they correspond to ia64 intrinsics 1-to-1. | ||
111 | Caveat: Now they are defined as C indirect function pointers, but in | ||
112 | order to support binary patch optimization, they will be changed | ||
113 | using GCC extended inline assembly code. | ||
114 | |||
115 | - a set of macros for hand written assembly code (.S files) | ||
116 | For maintenance purpose, the taken approach for .S files is single | ||
117 | source code and compile multiple times with different macros definitions. | ||
118 | Each pv_ops instance must define those macros to compile. | ||
119 | The important thing here is that sensitive, but non-privileged | ||
120 | instructions must be paravirtualized and that some privileged | ||
121 | instructions also need paravirtualization for reasonable performance. | ||
122 | Developers who modify .S files must be aware of that. At this moment | ||
123 | an easy checker is implemented to detect paravirtualization breakage. | ||
124 | But it doesn't cover all the cases. | ||
125 | |||
126 | Sometimes this set of macros is called pv_cpu_asm_op. But there is no | ||
127 | corresponding structure in the source code. | ||
128 | Those macros mostly 1:1 correspond to a subset of privileged | ||
129 | instructions. See linux/include/asm-ia64/native/inst.h. | ||
130 | And some functions written in assembly also need to be overrided so | ||
131 | that each pv_ops instance have to define some macros. Again see | ||
132 | linux/include/asm-ia64/native/inst.h. | ||
133 | |||
134 | |||
135 | Those structures must be initialized very early before start_kernel. | ||
136 | Probably initialized in head.S using multi entry point or some other trick. | ||
137 | For native case implementation see linux/arch/ia64/kernel/paravirt.c. | ||
diff --git a/Documentation/ia64/xen.txt b/Documentation/ia64/xen.txt new file mode 100644 index 000000000000..c61a99f7c8bb --- /dev/null +++ b/Documentation/ia64/xen.txt | |||
@@ -0,0 +1,183 @@ | |||
1 | Recipe for getting/building/running Xen/ia64 with pv_ops | ||
2 | -------------------------------------------------------- | ||
3 | |||
4 | This recipe describes how to get xen-ia64 source and build it, | ||
5 | and run domU with pv_ops. | ||
6 | |||
7 | ============ | ||
8 | Requirements | ||
9 | ============ | ||
10 | |||
11 | - python | ||
12 | - mercurial | ||
13 | it (aka "hg") is an open-source source code | ||
14 | management software. See the below. | ||
15 | http://www.selenic.com/mercurial/wiki/ | ||
16 | - git | ||
17 | - bridge-utils | ||
18 | |||
19 | ================================= | ||
20 | Getting and Building Xen and Dom0 | ||
21 | ================================= | ||
22 | |||
23 | My environment is; | ||
24 | Machine : Tiger4 | ||
25 | Domain0 OS : RHEL5 | ||
26 | DomainU OS : RHEL5 | ||
27 | |||
28 | 1. Download source | ||
29 | # hg clone http://xenbits.xensource.com/ext/ia64/xen-unstable.hg | ||
30 | # cd xen-unstable.hg | ||
31 | # hg clone http://xenbits.xensource.com/ext/ia64/linux-2.6.18-xen.hg | ||
32 | |||
33 | 2. # make world | ||
34 | |||
35 | 3. # make install-tools | ||
36 | |||
37 | 4. copy kernels and xen | ||
38 | # cp xen/xen.gz /boot/efi/efi/redhat/ | ||
39 | # cp build-linux-2.6.18-xen_ia64/vmlinux.gz \ | ||
40 | /boot/efi/efi/redhat/vmlinuz-2.6.18.8-xen | ||
41 | |||
42 | 5. make initrd for Dom0/DomU | ||
43 | # make -C linux-2.6.18-xen.hg ARCH=ia64 modules_install \ | ||
44 | O=$(/bin/pwd)/build-linux-2.6.18-xen_ia64 | ||
45 | # mkinitrd -f /boot/efi/efi/redhat/initrd-2.6.18.8-xen.img \ | ||
46 | 2.6.18.8-xen --builtin mptspi --builtin mptbase \ | ||
47 | --builtin mptscsih --builtin uhci-hcd --builtin ohci-hcd \ | ||
48 | --builtin ehci-hcd | ||
49 | |||
50 | ================================ | ||
51 | Making a disk image for guest OS | ||
52 | ================================ | ||
53 | |||
54 | 1. make file | ||
55 | # dd if=/dev/zero of=/root/rhel5.img bs=1M seek=4096 count=0 | ||
56 | # mke2fs -F -j /root/rhel5.img | ||
57 | # mount -o loop /root/rhel5.img /mnt | ||
58 | # cp -ax /{dev,var,etc,usr,bin,sbin,lib} /mnt | ||
59 | # mkdir /mnt/{root,proc,sys,home,tmp} | ||
60 | |||
61 | Note: You may miss some device files. If so, please create them | ||
62 | with mknod. Or you can use tar instead of cp. | ||
63 | |||
64 | 2. modify DomU's fstab | ||
65 | # vi /mnt/etc/fstab | ||
66 | /dev/xvda1 / ext3 defaults 1 1 | ||
67 | none /dev/pts devpts gid=5,mode=620 0 0 | ||
68 | none /dev/shm tmpfs defaults 0 0 | ||
69 | none /proc proc defaults 0 0 | ||
70 | none /sys sysfs defaults 0 0 | ||
71 | |||
72 | 3. modify inittab | ||
73 | set runlevel to 3 to avoid X trying to start | ||
74 | # vi /mnt/etc/inittab | ||
75 | id:3:initdefault: | ||
76 | Start a getty on the hvc0 console | ||
77 | X0:2345:respawn:/sbin/mingetty hvc0 | ||
78 | tty1-6 mingetty can be commented out | ||
79 | |||
80 | 4. add hvc0 into /etc/securetty | ||
81 | # vi /mnt/etc/securetty (add hvc0) | ||
82 | |||
83 | 5. umount | ||
84 | # umount /mnt | ||
85 | |||
86 | FYI, virt-manager can also make a disk image for guest OS. | ||
87 | It's GUI tools and easy to make it. | ||
88 | |||
89 | ================== | ||
90 | Boot Xen & Domain0 | ||
91 | ================== | ||
92 | |||
93 | 1. replace elilo | ||
94 | elilo of RHEL5 can boot Xen and Dom0. | ||
95 | If you use old elilo (e.g RHEL4), please download from the below | ||
96 | http://elilo.sourceforge.net/cgi-bin/blosxom | ||
97 | and copy into /boot/efi/efi/redhat/ | ||
98 | # cp elilo-3.6-ia64.efi /boot/efi/efi/redhat/elilo.efi | ||
99 | |||
100 | 2. modify elilo.conf (like the below) | ||
101 | # vi /boot/efi/efi/redhat/elilo.conf | ||
102 | prompt | ||
103 | timeout=20 | ||
104 | default=xen | ||
105 | relocatable | ||
106 | |||
107 | image=vmlinuz-2.6.18.8-xen | ||
108 | label=xen | ||
109 | vmm=xen.gz | ||
110 | initrd=initrd-2.6.18.8-xen.img | ||
111 | read-only | ||
112 | append=" -- rhgb root=/dev/sda2" | ||
113 | |||
114 | The append options before "--" are for xen hypervisor, | ||
115 | the options after "--" are for dom0. | ||
116 | |||
117 | FYI, your machine may need console options like | ||
118 | "com1=19200,8n1 console=vga,com1". For example, | ||
119 | append="com1=19200,8n1 console=vga,com1 -- rhgb console=tty0 \ | ||
120 | console=ttyS0 root=/dev/sda2" | ||
121 | |||
122 | ===================================== | ||
123 | Getting and Building domU with pv_ops | ||
124 | ===================================== | ||
125 | |||
126 | 1. get pv_ops tree | ||
127 | # git clone http://people.valinux.co.jp/~yamahata/xen-ia64/linux-2.6-xen-ia64.git/ | ||
128 | |||
129 | 2. git branch (if necessary) | ||
130 | # cd linux-2.6-xen-ia64/ | ||
131 | # git checkout -b your_branch origin/xen-ia64-domu-minimal-2008may19 | ||
132 | (Note: The current branch is xen-ia64-domu-minimal-2008may19. | ||
133 | But you would find the new branch. You can see with | ||
134 | "git branch -r" to get the branch lists. | ||
135 | http://people.valinux.co.jp/~yamahata/xen-ia64/for_eagl/linux-2.6-ia64-pv-ops.git/ | ||
136 | is also available. The tree is based on | ||
137 | git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6 test) | ||
138 | |||
139 | |||
140 | 3. copy .config for pv_ops of domU | ||
141 | # cp arch/ia64/configs/xen_domu_wip_defconfig .config | ||
142 | |||
143 | 4. make kernel with pv_ops | ||
144 | # make oldconfig | ||
145 | # make | ||
146 | |||
147 | 5. install the kernel and initrd | ||
148 | # cp vmlinux.gz /boot/efi/efi/redhat/vmlinuz-2.6-pv_ops-xenU | ||
149 | # make modules_install | ||
150 | # mkinitrd -f /boot/efi/efi/redhat/initrd-2.6-pv_ops-xenU.img \ | ||
151 | 2.6.26-rc3xen-ia64-08941-g1b12161 --builtin mptspi \ | ||
152 | --builtin mptbase --builtin mptscsih --builtin uhci-hcd \ | ||
153 | --builtin ohci-hcd --builtin ehci-hcd | ||
154 | |||
155 | ======================== | ||
156 | Boot DomainU with pv_ops | ||
157 | ======================== | ||
158 | |||
159 | 1. make config of DomU | ||
160 | # vi /etc/xen/rhel5 | ||
161 | kernel = "/boot/efi/efi/redhat/vmlinuz-2.6-pv_ops-xenU" | ||
162 | ramdisk = "/boot/efi/efi/redhat/initrd-2.6-pv_ops-xenU.img" | ||
163 | vcpus = 1 | ||
164 | memory = 512 | ||
165 | name = "rhel5" | ||
166 | disk = [ 'file:/root/rhel5.img,xvda1,w' ] | ||
167 | root = "/dev/xvda1 ro" | ||
168 | extra= "rhgb console=hvc0" | ||
169 | |||
170 | 2. After boot xen and dom0, start xend | ||
171 | # /etc/init.d/xend start | ||
172 | ( In the debugging case, # XEND_DEBUG=1 xend trace_start ) | ||
173 | |||
174 | 3. start domU | ||
175 | # xm create -c rhel5 | ||
176 | |||
177 | ========= | ||
178 | Reference | ||
179 | ========= | ||
180 | - Wiki of Xen/IA64 upstream merge | ||
181 | http://wiki.xensource.com/xenwiki/XenIA64/UpstreamMerge | ||
182 | |||
183 | Written by Akio Takebe <takebe_akio@jp.fujitsu.com> on 28 May 2008 | ||
diff --git a/Documentation/input/cs461x.txt b/Documentation/input/cs461x.txt index afe0d6543e09..202e9dbacec3 100644 --- a/Documentation/input/cs461x.txt +++ b/Documentation/input/cs461x.txt | |||
@@ -31,7 +31,7 @@ The driver works with ALSA drivers simultaneously. For example, the xracer | |||
31 | uses joystick as input device and PCM device as sound output in one time. | 31 | uses joystick as input device and PCM device as sound output in one time. |
32 | There are no sound or input collisions detected. The source code have | 32 | There are no sound or input collisions detected. The source code have |
33 | comments about them; but I've found the joystick can be initialized | 33 | comments about them; but I've found the joystick can be initialized |
34 | separately of ALSA modules. So, you canm use only one joystick driver | 34 | separately of ALSA modules. So, you can use only one joystick driver |
35 | without ALSA drivers. The ALSA drivers are not needed to compile or | 35 | without ALSA drivers. The ALSA drivers are not needed to compile or |
36 | run this driver. | 36 | run this driver. |
37 | 37 | ||
diff --git a/Documentation/input/gameport-programming.txt b/Documentation/input/gameport-programming.txt index 14e0a8b70225..03a74fc3b496 100644 --- a/Documentation/input/gameport-programming.txt +++ b/Documentation/input/gameport-programming.txt | |||
@@ -1,5 +1,3 @@ | |||
1 | $Id: gameport-programming.txt,v 1.3 2001/04/24 13:51:37 vojtech Exp $ | ||
2 | |||
3 | Programming gameport drivers | 1 | Programming gameport drivers |
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 2 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
5 | 3 | ||
diff --git a/Documentation/input/input.txt b/Documentation/input/input.txt index ff8cea0225f9..686ee9932dff 100644 --- a/Documentation/input/input.txt +++ b/Documentation/input/input.txt | |||
@@ -1,7 +1,6 @@ | |||
1 | Linux Input drivers v1.0 | 1 | Linux Input drivers v1.0 |
2 | (c) 1999-2001 Vojtech Pavlik <vojtech@ucw.cz> | 2 | (c) 1999-2001 Vojtech Pavlik <vojtech@ucw.cz> |
3 | Sponsored by SuSE | 3 | Sponsored by SuSE |
4 | $Id: input.txt,v 1.8 2002/05/29 03:15:01 bradleym Exp $ | ||
5 | ---------------------------------------------------------------------------- | 4 | ---------------------------------------------------------------------------- |
6 | 5 | ||
7 | 0. Disclaimer | 6 | 0. Disclaimer |
diff --git a/Documentation/input/joystick-api.txt b/Documentation/input/joystick-api.txt index acbd32b88454..c507330740cd 100644 --- a/Documentation/input/joystick-api.txt +++ b/Documentation/input/joystick-api.txt | |||
@@ -5,8 +5,6 @@ | |||
5 | 5 | ||
6 | 7 Aug 1998 | 6 | 7 Aug 1998 |
7 | 7 | ||
8 | $Id: joystick-api.txt,v 1.2 2001/05/08 21:21:23 vojtech Exp $ | ||
9 | |||
10 | 1. Initialization | 8 | 1. Initialization |
11 | ~~~~~~~~~~~~~~~~~ | 9 | ~~~~~~~~~~~~~~~~~ |
12 | 10 | ||
diff --git a/Documentation/input/joystick-parport.txt b/Documentation/input/joystick-parport.txt index ede5f33daad3..1c856f32ff2c 100644 --- a/Documentation/input/joystick-parport.txt +++ b/Documentation/input/joystick-parport.txt | |||
@@ -2,7 +2,6 @@ | |||
2 | (c) 1998-2000 Vojtech Pavlik <vojtech@ucw.cz> | 2 | (c) 1998-2000 Vojtech Pavlik <vojtech@ucw.cz> |
3 | (c) 1998 Andree Borrmann <a.borrmann@tu-bs.de> | 3 | (c) 1998 Andree Borrmann <a.borrmann@tu-bs.de> |
4 | Sponsored by SuSE | 4 | Sponsored by SuSE |
5 | $Id: joystick-parport.txt,v 1.6 2001/09/25 09:31:32 vojtech Exp $ | ||
6 | ---------------------------------------------------------------------------- | 5 | ---------------------------------------------------------------------------- |
7 | 6 | ||
8 | 0. Disclaimer | 7 | 0. Disclaimer |
diff --git a/Documentation/input/joystick.txt b/Documentation/input/joystick.txt index 389de9bd9878..154d767b2acb 100644 --- a/Documentation/input/joystick.txt +++ b/Documentation/input/joystick.txt | |||
@@ -1,7 +1,6 @@ | |||
1 | Linux Joystick driver v2.0.0 | 1 | Linux Joystick driver v2.0.0 |
2 | (c) 1996-2000 Vojtech Pavlik <vojtech@ucw.cz> | 2 | (c) 1996-2000 Vojtech Pavlik <vojtech@ucw.cz> |
3 | Sponsored by SuSE | 3 | Sponsored by SuSE |
4 | $Id: joystick.txt,v 1.12 2002/03/03 12:13:07 jdeneux Exp $ | ||
5 | ---------------------------------------------------------------------------- | 4 | ---------------------------------------------------------------------------- |
6 | 5 | ||
7 | 0. Disclaimer | 6 | 0. Disclaimer |
diff --git a/Documentation/ioctl-number.txt b/Documentation/ioctl-number.txt index 3bb5f466a90d..b880ce5dbd33 100644 --- a/Documentation/ioctl-number.txt +++ b/Documentation/ioctl-number.txt | |||
@@ -92,6 +92,7 @@ Code Seq# Include File Comments | |||
92 | 'J' 00-1F drivers/scsi/gdth_ioctl.h | 92 | 'J' 00-1F drivers/scsi/gdth_ioctl.h |
93 | 'K' all linux/kd.h | 93 | 'K' all linux/kd.h |
94 | 'L' 00-1F linux/loop.h | 94 | 'L' 00-1F linux/loop.h |
95 | 'L' 20-2F driver/usb/misc/vstusb.h | ||
95 | 'L' E0-FF linux/ppdd.h encrypted disk device driver | 96 | 'L' E0-FF linux/ppdd.h encrypted disk device driver |
96 | <http://linux01.gwdg.de/~alatham/ppdd.html> | 97 | <http://linux01.gwdg.de/~alatham/ppdd.html> |
97 | 'M' all linux/soundcard.h | 98 | 'M' all linux/soundcard.h |
@@ -105,12 +106,13 @@ Code Seq# Include File Comments | |||
105 | 'T' all linux/soundcard.h conflict! | 106 | 'T' all linux/soundcard.h conflict! |
106 | 'T' all asm-i386/ioctls.h conflict! | 107 | 'T' all asm-i386/ioctls.h conflict! |
107 | 'U' 00-EF linux/drivers/usb/usb.h | 108 | 'U' 00-EF linux/drivers/usb/usb.h |
108 | 'U' F0-FF drivers/usb/auerswald.c | ||
109 | 'V' all linux/vt.h | 109 | 'V' all linux/vt.h |
110 | 'W' 00-1F linux/watchdog.h conflict! | 110 | 'W' 00-1F linux/watchdog.h conflict! |
111 | 'W' 00-1F linux/wanrouter.h conflict! | 111 | 'W' 00-1F linux/wanrouter.h conflict! |
112 | 'X' all linux/xfs_fs.h | 112 | 'X' all linux/xfs_fs.h |
113 | 'Y' all linux/cyclades.h | 113 | 'Y' all linux/cyclades.h |
114 | '[' 00-07 linux/usb/usbtmc.h USB Test and Measurement Devices | ||
115 | <mailto:gregkh@suse.de> | ||
114 | 'a' all ATM on linux | 116 | 'a' all ATM on linux |
115 | <http://lrcwww.epfl.ch/linux-atm/magic.html> | 117 | <http://lrcwww.epfl.ch/linux-atm/magic.html> |
116 | 'b' 00-FF bit3 vme host bridge | 118 | 'b' 00-FF bit3 vme host bridge |
diff --git a/Documentation/ioctl/cdrom.txt b/Documentation/ioctl/cdrom.txt index 62d4af44ec4a..59df81c8da2b 100644 --- a/Documentation/ioctl/cdrom.txt +++ b/Documentation/ioctl/cdrom.txt | |||
@@ -271,14 +271,14 @@ CDROMCLOSETRAY pendant of CDROMEJECT | |||
271 | 271 | ||
272 | usage: | 272 | usage: |
273 | 273 | ||
274 | ioctl(fd, CDROMEJECT, 0); | 274 | ioctl(fd, CDROMCLOSETRAY, 0); |
275 | 275 | ||
276 | inputs: none | 276 | inputs: none |
277 | 277 | ||
278 | outputs: none | 278 | outputs: none |
279 | 279 | ||
280 | error returns: | 280 | error returns: |
281 | ENOSYS cd drive not capable of ejecting | 281 | ENOSYS cd drive not capable of closing the tray |
282 | EBUSY other processes are accessing drive, or door is locked | 282 | EBUSY other processes are accessing drive, or door is locked |
283 | 283 | ||
284 | notes: | 284 | notes: |
diff --git a/Documentation/ioctl/ioctl-decoding.txt b/Documentation/ioctl/ioctl-decoding.txt index bfdf7f3ee4f0..e35efb0cec2e 100644 --- a/Documentation/ioctl/ioctl-decoding.txt +++ b/Documentation/ioctl/ioctl-decoding.txt | |||
@@ -1,6 +1,6 @@ | |||
1 | To decode a hex IOCTL code: | 1 | To decode a hex IOCTL code: |
2 | 2 | ||
3 | Most architecures use this generic format, but check | 3 | Most architectures use this generic format, but check |
4 | include/ARCH/ioctl.h for specifics, e.g. powerpc | 4 | include/ARCH/ioctl.h for specifics, e.g. powerpc |
5 | uses 3 bits to encode read/write and 13 bits for size. | 5 | uses 3 bits to encode read/write and 13 bits for size. |
6 | 6 | ||
@@ -18,7 +18,7 @@ uses 3 bits to encode read/write and 13 bits for size. | |||
18 | 7-0 function # | 18 | 7-0 function # |
19 | 19 | ||
20 | 20 | ||
21 | So for example 0x82187201 is a read with arg length of 0x218, | 21 | So for example 0x82187201 is a read with arg length of 0x218, |
22 | character 'r' function 1. Grepping the source reveals this is: | 22 | character 'r' function 1. Grepping the source reveals this is: |
23 | 23 | ||
24 | #define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct dirent [2]) | 24 | #define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct dirent [2]) |
diff --git a/Documentation/iostats.txt b/Documentation/iostats.txt index 5925c3cd030d..59a69ec67c40 100644 --- a/Documentation/iostats.txt +++ b/Documentation/iostats.txt | |||
@@ -143,7 +143,7 @@ disk and partition statistics are consistent again. Since we still don't | |||
143 | keep record of the partition-relative address, an operation is attributed to | 143 | keep record of the partition-relative address, an operation is attributed to |
144 | the partition which contains the first sector of the request after the | 144 | the partition which contains the first sector of the request after the |
145 | eventual merges. As requests can be merged across partition, this could lead | 145 | eventual merges. As requests can be merged across partition, this could lead |
146 | to some (probably insignificant) innacuracy. | 146 | to some (probably insignificant) inaccuracy. |
147 | 147 | ||
148 | Additional notes | 148 | Additional notes |
149 | ---------------- | 149 | ---------------- |
diff --git a/Documentation/isdn/README.mISDN b/Documentation/isdn/README.mISDN new file mode 100644 index 000000000000..cd8bf920e77b --- /dev/null +++ b/Documentation/isdn/README.mISDN | |||
@@ -0,0 +1,6 @@ | |||
1 | mISDN is a new modular ISDN driver, in the long term it should replace | ||
2 | the old I4L driver architecture for passiv ISDN cards. | ||
3 | It was designed to allow a broad range of applications and interfaces | ||
4 | but only have the basic function in kernel, the interface to the user | ||
5 | space is based on sockets with a own address family AF_ISDN. | ||
6 | |||
diff --git a/Documentation/ja_JP/HOWTO b/Documentation/ja_JP/HOWTO index 488c77fa3aae..0775cf4798b2 100644 --- a/Documentation/ja_JP/HOWTO +++ b/Documentation/ja_JP/HOWTO | |||
@@ -11,14 +11,14 @@ for non English (read: Japanese) speakers and is not intended as a | |||
11 | fork. So if you have any comments or updates for this file, please try | 11 | fork. So if you have any comments or updates for this file, please try |
12 | to update the original English file first. | 12 | to update the original English file first. |
13 | 13 | ||
14 | Last Updated: 2007/11/16 | 14 | Last Updated: 2008/08/21 |
15 | ================================== | 15 | ================================== |
16 | ã“ã‚Œã¯ã€ | 16 | ã“ã‚Œã¯ã€ |
17 | linux-2.6.24/Documentation/HOWTO | 17 | linux-2.6.27/Documentation/HOWTO |
18 | ã®å’Œè¨³ã§ã™ã€‚ | 18 | ã®å’Œè¨³ã§ã™ã€‚ |
19 | 19 | ||
20 | 翻訳団体: JF プãƒã‚¸ã‚§ã‚¯ãƒˆ < http://www.linux.or.jp/JF/ > | 20 | 翻訳団体: JF プãƒã‚¸ã‚§ã‚¯ãƒˆ < http://www.linux.or.jp/JF/ > |
21 | 翻訳日: 2007/11/10 | 21 | 翻訳日: 2008/8/5 |
22 | 翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com> | 22 | 翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com> |
23 | æ ¡æ£è€…: æ¾å€‰ã•ã‚“ <nbh--mats at nifty dot com> | 23 | æ ¡æ£è€…: æ¾å€‰ã•ã‚“ <nbh--mats at nifty dot com> |
24 | å°æž— é›…å…¸ã•ã‚“ (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp> | 24 | å°æž— é›…å…¸ã•ã‚“ (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp> |
@@ -287,13 +287,15 @@ Linux カーãƒãƒ«ã®é–‹ç™ºãƒ—ãƒã‚»ã‚¹ã¯ç¾åœ¨å¹¾ã¤ã‹ã®ç•°ãªã‚‹ãƒ¡ã‚¤ãƒ³ã‚ | |||
287 | ã«å®‰å®šã—ãŸçŠ¶æ…‹ã«ã‚ã‚‹ã¨åˆ¤æ–ã—ãŸã¨ãã«ãƒªãƒªãƒ¼ã‚¹ã•ã‚Œã¾ã™ã€‚目標ã¯æ¯Žé€±æ–° | 287 | ã«å®‰å®šã—ãŸçŠ¶æ…‹ã«ã‚ã‚‹ã¨åˆ¤æ–ã—ãŸã¨ãã«ãƒªãƒªãƒ¼ã‚¹ã•ã‚Œã¾ã™ã€‚目標ã¯æ¯Žé€±æ–° |
288 | ã—ã„ -rc カーãƒãƒ«ã‚’リリースã™ã‚‹ã“ã¨ã§ã™ã€‚ | 288 | ã—ã„ -rc カーãƒãƒ«ã‚’リリースã™ã‚‹ã“ã¨ã§ã™ã€‚ |
289 | 289 | ||
290 | - 以下㮠URL ã§å„ -rc リリースã«å˜åœ¨ã™ã‚‹æ—¢çŸ¥ã®å¾Œæˆ»ã‚Šå•é¡Œã®ãƒªã‚¹ãƒˆ | ||
291 | ãŒè¿½è·¡ã•ã‚Œã¾ã™- | ||
292 | http://kernelnewbies.org/known_regressions | ||
293 | |||
294 | - ã“ã®ãƒ—ãƒã‚»ã‚¹ã¯ã‚«ãƒ¼ãƒãƒ«ãŒ 「準備ãŒã§ããŸã€ã¨è€ƒãˆã‚‰ã‚Œã‚‹ã¾ã§ç¶™ç¶šã—ã¾ | 290 | - ã“ã®ãƒ—ãƒã‚»ã‚¹ã¯ã‚«ãƒ¼ãƒãƒ«ãŒ 「準備ãŒã§ããŸã€ã¨è€ƒãˆã‚‰ã‚Œã‚‹ã¾ã§ç¶™ç¶šã—ã¾ |
295 | ã™ã€‚ã“ã®ãƒ—ãƒã‚»ã‚¹ã¯ã ã„ãŸã„ 6週間継続ã—ã¾ã™ã€‚ | 291 | ã™ã€‚ã“ã®ãƒ—ãƒã‚»ã‚¹ã¯ã ã„ãŸã„ 6週間継続ã—ã¾ã™ã€‚ |
296 | 292 | ||
293 | - å„リリースã§ã®æ—¢çŸ¥ã®å¾Œæˆ»ã‚Šå•é¡Œ(regression: ã“ã®ãƒªãƒªãƒ¼ã‚¹ã®ä¸ã§æ–°è¦ | ||
294 | ã«ä½œã‚Šè¾¼ã¾ã‚ŒãŸå•é¡Œã‚’指ã™) ã¯ãã®éƒ½åº¦ Linux-kernel メーリングリスト | ||
295 | ã«æŠ•ç¨¿ã•ã‚Œã¾ã™ã€‚ゴールã¨ã—ã¦ã¯ã€ã‚«ãƒ¼ãƒãƒ«ãŒ 「準備ãŒã§ããŸã€ã¨å®£è¨€ | ||
296 | ã™ã‚‹å‰ã«ã“ã®ãƒªã‚¹ãƒˆã®é•·ã•ã‚’ゼãƒã«æ¸›ã‚‰ã™ã“ã¨ã§ã™ãŒã€ç¾å®Ÿã«ã¯ã€æ•°å€‹ã® | ||
297 | 後戻りå•é¡ŒãŒãƒªãƒªãƒ¼ã‚¹æ™‚ã«ãŸã³ãŸã³æ®‹ã£ã¦ã—ã¾ã„ã¾ã™ã€‚ | ||
298 | |||
297 | Andrew Morton ㌠Linux-kernel メーリングリストã«ã‚«ãƒ¼ãƒãƒ«ãƒªãƒªãƒ¼ã‚¹ã«ã¤ã„ | 299 | Andrew Morton ㌠Linux-kernel メーリングリストã«ã‚«ãƒ¼ãƒãƒ«ãƒªãƒªãƒ¼ã‚¹ã«ã¤ã„ |
298 | ã¦æ›¸ã„ãŸã“ã¨ã‚’ã“ã“ã§è¨€ã£ã¦ãŠãã“ã¨ã¯ä¾¡å€¤ãŒã‚ã‚Šã¾ã™- | 300 | ã¦æ›¸ã„ãŸã“ã¨ã‚’ã“ã“ã§è¨€ã£ã¦ãŠãã“ã¨ã¯ä¾¡å€¤ãŒã‚ã‚Šã¾ã™- |
299 | 「カーãƒãƒ«ãŒã„ã¤ãƒªãƒªãƒ¼ã‚¹ã•ã‚Œã‚‹ã‹ã¯èª°ã‚‚知りã¾ã›ã‚“。ãªãœãªã‚‰ã€ã“ã‚Œã¯ç¾ | 301 | 「カーãƒãƒ«ãŒã„ã¤ãƒªãƒªãƒ¼ã‚¹ã•ã‚Œã‚‹ã‹ã¯èª°ã‚‚知りã¾ã›ã‚“。ãªãœãªã‚‰ã€ã“ã‚Œã¯ç¾ |
@@ -303,18 +305,20 @@ Andrew Morton ㌠Linux-kernel メーリングリストã«ã‚«ãƒ¼ãƒãƒ«ãƒªãƒªãƒ¼ã | |||
303 | 2.6.x.y -stable カーãƒãƒ«ãƒ„リー | 305 | 2.6.x.y -stable カーãƒãƒ«ãƒ„リー |
304 | --------------------------- | 306 | --------------------------- |
305 | 307 | ||
306 | ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã«4ã¤ç›®ã®æ•°å—ãŒã¤ã„ãŸã‚«ãƒ¼ãƒãƒ«ã¯ -stable カーãƒãƒ«ã§ã™ã€‚ã“れ㫠| 308 | ãƒãƒ¼ã‚¸ãƒ§ãƒ³ç•ªå·ãŒ4ã¤ã®æ•°å—ã«åˆ†ã‹ã‚Œã¦ã„るカーãƒãƒ«ã¯ -stable カーãƒãƒ«ã§ã™ã€‚ |
307 | ã¯ã€2.6.x カーãƒãƒ«ã§è¦‹ã¤ã‹ã£ãŸã‚»ã‚ュリティå•é¡Œã‚„é‡å¤§ãªå¾Œæˆ»ã‚Šã«å¯¾ã™ã‚‹æ¯” | 309 | ã“ã‚Œã«ã¯ã€2.6.x カーãƒãƒ«ã§è¦‹ã¤ã‹ã£ãŸã‚»ã‚ュリティå•é¡Œã‚„é‡å¤§ãªå¾Œæˆ»ã‚Šã«å¯¾ |
308 | 較的å°ã•ã„é‡è¦ãªä¿®æ£ãŒå«ã¾ã‚Œã¾ã™ã€‚ | 310 | ã™ã‚‹æ¯”較的å°ã•ã„é‡è¦ãªä¿®æ£ãŒå«ã¾ã‚Œã¾ã™ã€‚ |
309 | 311 | ||
310 | ã“ã‚Œã¯ã€é–‹ç™º/実験的ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®ãƒ†ã‚¹ãƒˆã«å”力ã™ã‚‹ã“ã¨ã«èˆˆå‘³ãŒç„¡ã〠| 312 | ã“ã‚Œã¯ã€é–‹ç™º/実験的ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã®ãƒ†ã‚¹ãƒˆã«å”力ã™ã‚‹ã“ã¨ã«èˆˆå‘³ãŒç„¡ã〠|
311 | 最新ã®å®‰å®šã—ãŸã‚«ãƒ¼ãƒãƒ«ã‚’使ã„ãŸã„ユーザã«æŽ¨å¥¨ã™ã‚‹ãƒ–ランãƒã§ã™ã€‚ | 313 | 最新ã®å®‰å®šã—ãŸã‚«ãƒ¼ãƒãƒ«ã‚’使ã„ãŸã„ユーザã«æŽ¨å¥¨ã™ã‚‹ãƒ–ランãƒã§ã™ã€‚ |
312 | 314 | ||
313 | ã‚‚ã—ã€2.6.x.y カーãƒãƒ«ãŒå˜åœ¨ã—ãªã„å ´åˆã«ã¯ã€ç•ªå·ãŒä¸€ç•ªå¤§ãã„ 2.6.x | 315 | ã‚‚ã—ã€2.6.x.y カーãƒãƒ«ãŒå˜åœ¨ã—ãªã„å ´åˆã«ã¯ã€ç•ªå·ãŒä¸€ç•ªå¤§ãã„ 2.6.x ㌠|
314 | ãŒæœ€æ–°ã®å®‰å®šç‰ˆã‚«ãƒ¼ãƒãƒ«ã§ã™ã€‚ | 316 | 最新ã®å®‰å®šç‰ˆã‚«ãƒ¼ãƒãƒ«ã§ã™ã€‚ |
315 | 317 | ||
316 | 2.6.x.y 㯠"stable" ãƒãƒ¼ãƒ <stable@kernel.org> ã§ãƒ¡ãƒ³ãƒ†ã•ã‚Œã¦ãŠã‚Šã€ã | 318 | 2.6.x.y 㯠"stable" ãƒãƒ¼ãƒ <stable@kernel.org> ã§ãƒ¡ãƒ³ãƒ†ã•ã‚Œã¦ãŠã‚Šã€å¿… |
317 | ã„ãŸã„隔週ã§ãƒªãƒªãƒ¼ã‚¹ã•ã‚Œã¦ã„ã¾ã™ã€‚ | 319 | è¦ã«å¿œã˜ã¦ãƒªãƒªãƒ¼ã‚¹ã•ã‚Œã¾ã™ã€‚通常ã®ãƒªãƒªãƒ¼ã‚¹æœŸé–“㯠2週間毎ã§ã™ãŒã€å·®ã—迫㣠|
320 | ãŸå•é¡ŒãŒãªã‘ã‚Œã°ã‚‚ã†å°‘ã—é•·ããªã‚‹ã“ã¨ã‚‚ã‚ã‚Šã¾ã™ã€‚ã‚»ã‚ュリティ関連ã®å•é¡Œ | ||
321 | ã®å ´åˆã¯ã“ã‚Œã«å¯¾ã—ã¦ã ã„ãŸã„ã®å ´åˆã€ã™ãã«ãƒªãƒªãƒ¼ã‚¹ãŒã•ã‚Œã¾ã™ã€‚ | ||
318 | 322 | ||
319 | カーãƒãƒ«ãƒ„リーã«å…¥ã£ã¦ã„ã‚‹ã€Documentation/stable_kernel_rules.txt ファ | 323 | カーãƒãƒ«ãƒ„リーã«å…¥ã£ã¦ã„ã‚‹ã€Documentation/stable_kernel_rules.txt ファ |
320 | イルã«ã¯ã©ã®ã‚ˆã†ãªç¨®é¡žã®å¤‰æ›´ãŒ -stable ツリーã«å—ã‘入れå¯èƒ½ã‹ã€ã¾ãŸãƒª | 324 | イルã«ã¯ã©ã®ã‚ˆã†ãªç¨®é¡žã®å¤‰æ›´ãŒ -stable ツリーã«å—ã‘入れå¯èƒ½ã‹ã€ã¾ãŸãƒª |
@@ -341,7 +345,9 @@ linux-kernel メーリングリストã§åŽé›†ã•ã‚ŒãŸå¤šæ•°ã®ãƒ‘ッãƒã¨åŒæ | |||
341 | メインラインã¸å…¥ã‚Œã‚‹ã‚ˆã†ã« Linus ã«ãƒ—ッシュã—ã¾ã™ã€‚ | 345 | メインラインã¸å…¥ã‚Œã‚‹ã‚ˆã†ã« Linus ã«ãƒ—ッシュã—ã¾ã™ã€‚ |
342 | 346 | ||
343 | メインカーãƒãƒ«ãƒ„リーã«å«ã‚ã‚‹ãŸã‚ã« Linus ã«é€ã‚‹å‰ã«ã€ã™ã¹ã¦ã®æ–°ã—ã„パッ | 347 | メインカーãƒãƒ«ãƒ„リーã«å«ã‚ã‚‹ãŸã‚ã« Linus ã«é€ã‚‹å‰ã«ã€ã™ã¹ã¦ã®æ–°ã—ã„パッ |
344 | ãƒãŒ -mm ツリーã§ãƒ†ã‚¹ãƒˆã•ã‚Œã‚‹ã“ã¨ãŒå¼·ã推奨ã•ã‚Œã¾ã™ã€‚ | 348 | ãƒãŒ -mm ツリーã§ãƒ†ã‚¹ãƒˆã•ã‚Œã‚‹ã“ã¨ãŒå¼·ã推奨ã•ã‚Œã¦ã„ã¾ã™ã€‚マージウィン |
349 | ドウãŒé–‹ãå‰ã« -mm ツリーã«ç¾ã‚Œãªã‹ã£ãŸãƒ‘ッãƒã¯ãƒ¡ã‚¤ãƒ³ãƒ©ã‚¤ãƒ³ã«ãƒžãƒ¼ã‚¸ã• | ||
350 | れるã“ã¨ã¯å›°é›£ã«ãªã‚Šã¾ã™ã€‚ | ||
345 | 351 | ||
346 | ã“れらã®ã‚«ãƒ¼ãƒãƒ«ã¯å®‰å®šã—ã¦å‹•ä½œã™ã¹ãシステムã¨ã—ã¦ä½¿ã†ã®ã«ã¯é©åˆ‡ã§ã¯ã‚ | 352 | ã“れらã®ã‚«ãƒ¼ãƒãƒ«ã¯å®‰å®šã—ã¦å‹•ä½œã™ã¹ãシステムã¨ã—ã¦ä½¿ã†ã®ã«ã¯é©åˆ‡ã§ã¯ã‚ |
347 | ã‚Šã¾ã›ã‚“ã—ã€ã‚«ãƒ¼ãƒãƒ«ãƒ–ランãƒã®ä¸ã§ã‚‚ã‚‚ã£ã¨ã‚‚動作ã«ãƒªã‚¹ã‚¯ãŒé«˜ã„ã‚‚ã®ã§ã™ã€‚ | 353 | ã‚Šã¾ã›ã‚“ã—ã€ã‚«ãƒ¼ãƒãƒ«ãƒ–ランãƒã®ä¸ã§ã‚‚ã‚‚ã£ã¨ã‚‚動作ã«ãƒªã‚¹ã‚¯ãŒé«˜ã„ã‚‚ã®ã§ã™ã€‚ |
@@ -395,13 +401,15 @@ linux-kernel メーリングリストã§åŽé›†ã•ã‚ŒãŸå¤šæ•°ã®ãƒ‘ッãƒã¨åŒæ | |||
395 | - pcmcia, Dominik Brodowski <linux@dominikbrodowski.net> | 401 | - pcmcia, Dominik Brodowski <linux@dominikbrodowski.net> |
396 | git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git | 402 | git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git |
397 | 403 | ||
398 | - SCSI, James Bottomley <James.Bottomley@SteelEye.com> | 404 | - SCSI, James Bottomley <James.Bottomley@hansenpartnership.com> |
399 | git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git | 405 | git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git |
400 | 406 | ||
407 | - x86, Ingo Molnar <mingo@elte.hu> | ||
408 | git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git | ||
409 | |||
401 | quilt ツリー- | 410 | quilt ツリー- |
402 | - USB, PCI ドライãƒã‚³ã‚¢ã¨ I2C, Greg Kroah-Hartman <gregkh@suse.de> | 411 | - USB, ドライãƒã‚³ã‚¢ã¨ I2C, Greg Kroah-Hartman <gregkh@suse.de> |
403 | kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ | 412 | kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ |
404 | - x86-64 㨠i386 ã®ä»²é–“ Andi Kleen <ak@suse.de> | ||
405 | 413 | ||
406 | ãã®ä»–ã®ã‚«ãƒ¼ãƒãƒ«ãƒ„リー㯠http://git.kernel.org/ 㨠MAINTAINERS ファ | 414 | ãã®ä»–ã®ã‚«ãƒ¼ãƒãƒ«ãƒ„リー㯠http://git.kernel.org/ 㨠MAINTAINERS ファ |
407 | イルã«ä¸€è¦§è¡¨ãŒã‚ã‚Šã¾ã™ã€‚ | 415 | イルã«ä¸€è¦§è¡¨ãŒã‚ã‚Šã¾ã™ã€‚ |
@@ -412,13 +420,32 @@ linux-kernel メーリングリストã§åŽé›†ã•ã‚ŒãŸå¤šæ•°ã®ãƒ‘ッãƒã¨åŒæ | |||
412 | bugzilla.kernel.org 㯠Linux カーãƒãƒ«é–‹ç™ºè€…ãŒã‚«ãƒ¼ãƒãƒ«ã®ãƒã‚°ã‚’追跡ã™ã‚‹ | 420 | bugzilla.kernel.org 㯠Linux カーãƒãƒ«é–‹ç™ºè€…ãŒã‚«ãƒ¼ãƒãƒ«ã®ãƒã‚°ã‚’追跡ã™ã‚‹ |
413 | å ´æ‰€ã§ã™ã€‚ユーザã¯è¦‹ã¤ã‘ãŸãƒã‚°ã®å…¨ã¦ã‚’ã“ã®ãƒ„ールã§å ±å‘Šã™ã¹ãã§ã™ã€‚ | 421 | å ´æ‰€ã§ã™ã€‚ユーザã¯è¦‹ã¤ã‘ãŸãƒã‚°ã®å…¨ã¦ã‚’ã“ã®ãƒ„ールã§å ±å‘Šã™ã¹ãã§ã™ã€‚ |
414 | ã©ã† kernel bugzilla を使ã†ã‹ã®è©³ç´°ã¯ã€ä»¥ä¸‹ã‚’å‚ç…§ã—ã¦ãã ã•ã„- | 422 | ã©ã† kernel bugzilla を使ã†ã‹ã®è©³ç´°ã¯ã€ä»¥ä¸‹ã‚’å‚ç…§ã—ã¦ãã ã•ã„- |
415 | http://test.kernel.org/bugzilla/faq.html | 423 | http://bugzilla.kernel.org/page.cgi?id=faq.html |
416 | |||
417 | メインカーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã«ã‚るファイル REPORTING-BUGS ã¯ã‚«ãƒ¼ãƒ | 424 | メインカーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã«ã‚るファイル REPORTING-BUGS ã¯ã‚«ãƒ¼ãƒ |
418 | ルãƒã‚°ã‚‰ã—ã„ã‚‚ã®ã«ã¤ã„ã¦ã©ã†ãƒ¬ãƒãƒ¼ãƒˆã™ã‚‹ã‹ã®è‰¯ã„テンプレートã§ã‚ã‚Šã€å• | 425 | ルãƒã‚°ã‚‰ã—ã„ã‚‚ã®ã«ã¤ã„ã¦ã©ã†ãƒ¬ãƒãƒ¼ãƒˆã™ã‚‹ã‹ã®è‰¯ã„テンプレートã§ã‚ã‚Šã€å• |
419 | é¡Œã®è¿½è·¡ã‚’助ã‘ã‚‹ãŸã‚ã«ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã«ã¨ã£ã¦ã©ã‚“ãªæƒ…å ±ãŒå¿…è¦ãªã®ã‹ã®è©³ | 426 | é¡Œã®è¿½è·¡ã‚’助ã‘ã‚‹ãŸã‚ã«ã‚«ãƒ¼ãƒãƒ«é–‹ç™ºè€…ã«ã¨ã£ã¦ã©ã‚“ãªæƒ…å ±ãŒå¿…è¦ãªã®ã‹ã®è©³ |
420 | ç´°ãŒæ›¸ã‹ã‚Œã¦ã„ã¾ã™ã€‚ | 427 | ç´°ãŒæ›¸ã‹ã‚Œã¦ã„ã¾ã™ã€‚ |
421 | 428 | ||
429 | ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã®ç®¡ç† | ||
430 | ------------------- | ||
431 | |||
432 | ã‚ãªãŸã®ãƒãƒƒã‚ングã®ã‚¹ã‚ルを訓練ã™ã‚‹æœ€é«˜ã®æ–¹æ³•ã®ã²ã¨ã¤ã«ã€ä»–人ãŒãƒ¬ãƒãƒ¼ | ||
433 | トã—ãŸãƒã‚°ã‚’ä¿®æ£ã™ã‚‹ã“ã¨ãŒã‚ã‚Šã¾ã™ã€‚ã‚ãªãŸãŒã‚«ãƒ¼ãƒãƒ«ã‚’より安定化ã•ã›ã‚‹ | ||
434 | ã“ã«å¯„与ã™ã‚‹ã¨ã„ã†ã“ã¨ã ã‘ã§ãªãã€ã‚ãªãŸã¯ ç¾å®Ÿã®å•é¡Œã‚’ä¿®æ£ã™ã‚‹ã“ã¨ã‚’ | ||
435 | å¦ã³ã€è‡ªåˆ†ã®ã‚¹ã‚ルも強化ã§ãã€ã¾ãŸä»–ã®é–‹ç™ºè€…ãŒã‚ãªãŸã®å˜åœ¨ã«æ°—ãŒã¤ã | ||
436 | ã¾ã™ã€‚ãƒã‚°ã‚’ä¿®æ£ã™ã‚‹ã“ã¨ã¯ã€å¤šãã®é–‹ç™ºè€…ã®ä¸ã‹ã‚‰è‡ªåˆ†ãŒåŠŸç¸¾ã‚’ã‚ã’る最善 | ||
437 | ã®é“ã§ã™ã€ãªãœãªã‚‰å¤šãã®äººã¯ä»–人ã®ãƒã‚°ã®ä¿®æ£ã«æ™‚間を浪費ã™ã‚‹ã“ã¨ã‚’好㾠| ||
438 | ãªã„ã‹ã‚‰ã§ã™ã€‚ | ||
439 | |||
440 | ã™ã§ã«ãƒ¬ãƒãƒ¼ãƒˆã•ã‚ŒãŸãƒã‚°ã®ãŸã‚ã«ä»•äº‹ã‚’ã™ã‚‹ãŸã‚ã«ã¯ã€ | ||
441 | http://bugzilla.kernel.org ã«è¡Œã£ã¦ãã ã•ã„。もã—今後ã®ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã« | ||
442 | ã¤ã„ã¦ã‚¢ãƒ‰ãƒã‚¤ã‚¹ã‚’å—ã‘ãŸã„ã®ã§ã‚ã‚Œã°ã€bugme-new メーリングリスト(æ–°ã— | ||
443 | ã„ãƒã‚°ãƒ¬ãƒãƒ¼ãƒˆã ã‘ãŒã“ã“ã«ãƒ¡ãƒ¼ãƒ«ã•ã‚Œã‚‹) ã¾ãŸã¯ bugme-janitor メーリン | ||
444 | グリスト(bugzilla ã®å¤‰æ›´æ¯Žã«ã“ã“ã«ãƒ¡ãƒ¼ãƒ«ã•ã‚Œã‚‹)ã‚’è³¼èªã§ãã¾ã™ã€‚ | ||
445 | |||
446 | http://lists.linux-foundation.org/mailman/listinfo/bugme-new | ||
447 | http://lists.linux-foundation.org/mailman/listinfo/bugme-janitors | ||
448 | |||
422 | メーリングリスト | 449 | メーリングリスト |
423 | ------------- | 450 | ------------- |
424 | 451 | ||
diff --git a/Documentation/ja_JP/SubmitChecklist b/Documentation/ja_JP/SubmitChecklist new file mode 100644 index 000000000000..6c42e071d723 --- /dev/null +++ b/Documentation/ja_JP/SubmitChecklist | |||
@@ -0,0 +1,111 @@ | |||
1 | NOTE: | ||
2 | This is a version of Documentation/SubmitChecklist into Japanese. | ||
3 | This document is maintained by Takenori Nagano <t-nagano@ah.jp.nec.com> | ||
4 | and the JF Project team <http://www.linux.or.jp/JF/>. | ||
5 | If you find any difference between this document and the original file | ||
6 | or a problem with the translation, | ||
7 | please contact the maintainer of this file or JF project. | ||
8 | |||
9 | Please also note that the purpose of this file is to be easier to read | ||
10 | for non English (read: Japanese) speakers and is not intended as a | ||
11 | fork. So if you have any comments or updates of this file, please try | ||
12 | to update the original English file first. | ||
13 | |||
14 | Last Updated: 2008/07/14 | ||
15 | ================================== | ||
16 | ã“ã‚Œã¯ã€ | ||
17 | linux-2.6.26/Documentation/SubmitChecklist ã®å’Œè¨³ã§ã™ã€‚ | ||
18 | |||
19 | 翻訳団体: JF プãƒã‚¸ã‚§ã‚¯ãƒˆ < http://www.linux.or.jp/JF/ > | ||
20 | 翻訳日: 2008/07/14 | ||
21 | 翻訳者: Takenori Nagano <t-nagano at ah dot jp dot nec dot com> | ||
22 | æ ¡æ£è€…: Masanori Kobayashi ã•ã‚“ <zap03216 at nifty dot ne dot jp> | ||
23 | ================================== | ||
24 | |||
25 | |||
26 | Linux カーãƒãƒ«ãƒ‘ッãƒæŠ•ç¨¿è€…å‘ã‘ãƒã‚§ãƒƒã‚¯ãƒªã‚¹ãƒˆ | ||
27 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
28 | |||
29 | 本書ã§ã¯ã€ãƒ‘ッãƒã‚’ã‚ˆã‚Šç´ æ—©ãå–り込んã§ã‚‚らã„ãŸã„開発者ãŒå®Ÿè·µã™ã¹ã基本的ãªäº‹æŸ„ | ||
30 | ã‚’ã„ãã¤ã‹ç´¹ä»‹ã—ã¾ã™ã€‚ã“ã“ã«ã‚ã‚‹å…¨ã¦ã®äº‹æŸ„ã¯ã€Documentation/SubmittingPatches | ||
31 | ãªã©ã®Linuxカーãƒãƒ«ãƒ‘ッãƒæŠ•ç¨¿ã«éš›ã—ã¦ã®å¿ƒå¾—を補足ã™ã‚‹ã‚‚ã®ã§ã™ã€‚ | ||
32 | |||
33 | 1: 妥当ãªCONFIGオプションや変更ã•ã‚ŒãŸCONFIGオプションã€ã¤ã¾ã‚Š =y, =m, =n | ||
34 | å…¨ã¦ã§æ£ã—ãビルドã§ãã‚‹ã“ã¨ã‚’確èªã—ã¦ãã ã•ã„。ãã®éš›ã€gccåŠã³ãƒªãƒ³ã‚«ãŒ | ||
35 | warningã‚„errorを出ã—ã¦ã„ãªã„ã“ã¨ã‚‚確èªã—ã¦ãã ã•ã„。 | ||
36 | |||
37 | 2: allnoconfig, allmodconfig オプションを用ã„ã¦æ£ã—ãビルドã§ãã‚‹ã“ã¨ã‚’ | ||
38 | 確èªã—ã¦ãã ã•ã„。 | ||
39 | |||
40 | 3: 手許ã®ã‚¯ãƒã‚¹ã‚³ãƒ³ãƒ‘イルツールやOSDLã®PLMã®ã‚ˆã†ãªã‚‚ã®ã‚’用ã„ã¦ã€è¤‡æ•°ã® | ||
41 | アーã‚テクãƒãƒ£ã«ãŠã„ã¦ã‚‚æ£ã—ãビルドã§ãã‚‹ã“ã¨ã‚’確èªã—ã¦ãã ã•ã„。 | ||
42 | |||
43 | 4: 64bité•·ã®'unsigned long'を使用ã—ã¦ã„ã‚‹ppc64ã¯ã€ã‚¯ãƒã‚¹ã‚³ãƒ³ãƒ‘イルã§ã® | ||
44 | ãƒã‚§ãƒƒã‚¯ã«é©å½“ãªã‚¢ãƒ¼ã‚テクãƒãƒ£ã§ã™ã€‚ | ||
45 | |||
46 | 5: カーãƒãƒ«ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°ã‚¹ã‚¿ã‚¤ãƒ«ã«æº–æ‹ ã—ã¦ã„ã‚‹ã‹ã©ã†ã‹ç¢ºèªã—ã¦ãã ã•ã„(!) | ||
47 | |||
48 | 6: CONFIGオプションã®è¿½åŠ ・変更をã—ãŸå ´åˆã«ã¯ã€CONFIGメニューãŒå£Šã‚Œã¦ã„ãªã„ | ||
49 | ã“ã¨ã‚’確èªã—ã¦ãã ã•ã„。 | ||
50 | |||
51 | 7: æ–°ã—ãKconfigã®ã‚ªãƒ—ã‚·ãƒ§ãƒ³ã‚’è¿½åŠ ã™ã‚‹éš›ã«ã¯ã€å¿…ãšãã®helpも記述ã—ã¦ãã ã•ã„。 | ||
52 | |||
53 | 8: é©åˆ‡ãªKconfigã®ä¾å˜é–¢ä¿‚を考ãˆãªãŒã‚‰æ…Žé‡ã«ãƒã‚§ãƒƒã‚¯ã—ã¦ãã ã•ã„。 | ||
54 | ãŸã ã—ã€ã“ã®ä½œæ¥ã¯ãƒžã‚·ãƒ³ã‚’使ã£ãŸãƒ†ã‚¹ãƒˆã§ãã¡ã‚“ã¨è¡Œã†ã®ãŒã¨ã¦ã‚‚困難ã§ã™ã€‚ | ||
55 | ã†ã¾ãã‚„ã‚‹ã«ã¯ã€è‡ªåˆ†ã®é ã§è€ƒãˆã‚‹ã“ã¨ã§ã™ã€‚ | ||
56 | |||
57 | 9: sparseを利用ã—ã¦ã¡ã‚ƒã‚“ã¨ã—ãŸã‚³ãƒ¼ãƒ‰ãƒã‚§ãƒƒã‚¯ã‚’ã—ã¦ãã ã•ã„。 | ||
58 | |||
59 | 10: 'make checkstack' 㨠'make namespacecheck' を利用ã—ã€å•é¡ŒãŒç™ºè¦‹ã•ã‚ŒãŸã‚‰ | ||
60 | ä¿®æ£ã—ã¦ãã ã•ã„。'make checkstack' ã¯æ˜Žç¤ºçš„ã«å•é¡Œã‚’示ã—ã¾ã›ã‚“ãŒã€ã©ã‚Œã‹ | ||
61 | 1ã¤ã®é–¢æ•°ãŒ512ãƒã‚¤ãƒˆã‚ˆã‚Šå¤§ãã„スタックを使ã£ã¦ã„ã‚Œã°ã€ä¿®æ£ã™ã¹ã候補㨠| ||
62 | ãªã‚Šã¾ã™ã€‚ | ||
63 | |||
64 | 11: ã‚°ãƒãƒ¼ãƒãƒ«ãªkernel API を説明ã™ã‚‹ kernel-doc をソースã®ä¸ã«å«ã‚ã¦ãã ã•ã„。 | ||
65 | ( staticãªé–¢æ•°ã«ãŠã„ã¦ã¯å¿…é ˆã§ã¯ã‚ã‚Šã¾ã›ã‚“ãŒã€å«ã‚ã¦ã‚‚らã£ã¦ã‚‚çµæ§‹ã§ã™ ) | ||
66 | ãã—ã¦ã€'make htmldocs' ã‚‚ã—ã㯠'make mandocs' を利用ã—ã¦è¿½è¨˜ã—㟠| ||
67 | ドã‚ュメントã®ãƒã‚§ãƒƒã‚¯ã‚’è¡Œã„ã€å•é¡ŒãŒè¦‹ã¤ã‹ã£ãŸå ´åˆã«ã¯ä¿®æ£ã‚’è¡Œã£ã¦ãã ã•ã„。 | ||
68 | |||
69 | 12: CONFIG_PREEMPT, CONFIG_DEBUG_PREEMPT, CONFIG_DEBUG_SLAB, | ||
70 | CONFIG_DEBUG_PAGEALLOC, CONFIG_DEBUG_MUTEXES, CONFIG_DEBUG_SPINLOCK, | ||
71 | CONFIG_DEBUG_SPINLOCK_SLEEP ã“れら全ã¦ã‚’åŒæ™‚ã«æœ‰åŠ¹ã«ã—ã¦å‹•ä½œç¢ºèªã‚’ | ||
72 | è¡Œã£ã¦ãã ã•ã„。 | ||
73 | |||
74 | 13: CONFIG_SMP, CONFIG_PREEMPT を有効ã«ã—ãŸå ´åˆã¨ç„¡åŠ¹ã«ã—ãŸå ´åˆã®ä¸¡æ–¹ã§ | ||
75 | ビルドã—ãŸä¸Šã€å‹•ä½œç¢ºèªã‚’è¡Œã£ã¦ãã ã•ã„。 | ||
76 | |||
77 | 14: ã‚‚ã—パッãƒãŒãƒ‡ã‚£ã‚¹ã‚¯ã®I/O性能ãªã©ã«å½±éŸ¿ã‚’与ãˆã‚‹ã‚ˆã†ã§ã‚ã‚Œã°ã€ | ||
78 | 'CONFIG_LBD'オプションを有効ã«ã—ãŸå ´åˆã¨ç„¡åŠ¹ã«ã—ãŸå ´åˆã®ä¸¡æ–¹ã§ | ||
79 | テストを実施ã—ã¦ã¿ã¦ãã ã•ã„。 | ||
80 | |||
81 | 15: lockdepã®æ©Ÿèƒ½ã‚’å…¨ã¦æœ‰åŠ¹ã«ã—ãŸä¸Šã§ã€å…¨ã¦ã®ã‚³ãƒ¼ãƒ‰ãƒ‘スを評価ã—ã¦ãã ã•ã„。 | ||
82 | |||
83 | 16: /proc ã«æ–°ã—ã„ã‚¨ãƒ³ãƒˆãƒªã‚’è¿½åŠ ã—ãŸå ´åˆã«ã¯ã€Documentation/ é…下㫠| ||
84 | å¿…ãšãƒ‰ã‚ãƒ¥ãƒ¡ãƒ³ãƒˆã‚’è¿½åŠ ã—ã¦ãã ã•ã„。 | ||
85 | |||
86 | 17: æ–°ã—ã„ãƒ–ãƒ¼ãƒˆãƒ‘ãƒ©ãƒ¡ãƒ¼ã‚¿ã‚’è¿½åŠ ã—ãŸå ´åˆã«ã¯ã€ | ||
87 | å¿…ãšDocumentation/kernel-parameters.txt ã«èª¬æ˜Žã‚’è¿½åŠ ã—ã¦ãã ã•ã„。 | ||
88 | |||
89 | 18: æ–°ã—ãmoduleã«ãƒ‘ãƒ©ãƒ¡ãƒ¼ã‚¿ã‚’è¿½åŠ ã—ãŸå ´åˆã«ã¯ã€MODULE_PARM_DESC()ã‚’ | ||
90 | 利用ã—ã¦å¿…ãšãã®èª¬æ˜Žã‚’記述ã—ã¦ãã ã•ã„。 | ||
91 | |||
92 | 19: æ–°ã—ã„userspaceインタフェースを作æˆã—ãŸå ´åˆã«ã¯ã€Documentation/ABI/ ã« | ||
93 | Documentation/ABI/README ã‚’å‚考ã«ã—ã¦å¿…ãšãƒ‰ã‚ãƒ¥ãƒ¡ãƒ³ãƒˆã‚’è¿½åŠ ã—ã¦ãã ã•ã„。 | ||
94 | |||
95 | 20: 'make headers_check'を実行ã—ã¦å…¨ãå•é¡ŒãŒãªã„ã“ã¨ã‚’確èªã—ã¦ãã ã•ã„。 | ||
96 | |||
97 | 21: å°‘ãªãã¨ã‚‚slabã‚¢ãƒã‚±ãƒ¼ã‚·ãƒ§ãƒ³ã¨pageã‚¢ãƒã‚±ãƒ¼ã‚·ãƒ§ãƒ³ã«å¤±æ•—ã—ãŸå ´åˆã® | ||
98 | 挙動ã«ã¤ã„ã¦ã€fault-injectionを利用ã—ã¦ç¢ºèªã—ã¦ãã ã•ã„。 | ||
99 | Documentation/fault-injection/ ã‚’å‚ç…§ã—ã¦ãã ã•ã„。 | ||
100 | |||
101 | è¿½åŠ ã—ãŸã‚³ãƒ¼ãƒ‰ãŒã‹ãªã‚Šã®é‡ã§ã‚ã£ãŸãªã‚‰ã°ã€ã‚µãƒ–システム特有㮠| ||
102 | fault-injectionã‚’è¿½åŠ ã—ãŸã»ã†ãŒè‰¯ã„ã‹ã‚‚ã—ã‚Œã¾ã›ã‚“。 | ||
103 | |||
104 | 22: æ–°ãŸã«è¿½åŠ ã—ãŸã‚³ãƒ¼ãƒ‰ã¯ã€`gcc -W'ã§ã‚³ãƒ³ãƒ‘イルã—ã¦ãã ã•ã„。 | ||
105 | ã“ã®ã‚ªãƒ—ションã¯å¤§é‡ã®ä¸è¦ãªãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ã‚’出力ã—ã¾ã™ãŒã€ | ||
106 | "warning: comparison between signed and unsigned" ã®ã‚ˆã†ãªãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ã¯ã€ | ||
107 | ãƒã‚°ã‚’見ã¤ã‘ã‚‹ã®ã«å½¹ã«ç«‹ã¡ã¾ã™ã€‚ | ||
108 | |||
109 | 23: 投稿ã—ãŸãƒ‘ッãƒãŒ -mm パッãƒã‚»ãƒƒãƒˆã«ãƒžãƒ¼ã‚¸ã•ã‚ŒãŸå¾Œã€å…¨ã¦ã®æ—¢å˜ã®ãƒ‘ッãƒã‚„ | ||
110 | VM, VFS ãŠã‚ˆã³ãã®ä»–ã®ã‚µãƒ–システムã«é–¢ã™ã‚‹æ§˜ã€…ãªå¤‰æ›´ã¨ã€ç¾æ™‚点ã§ã‚‚å…±å˜ | ||
111 | ã§ãã‚‹ã“ã¨ã‚’確èªã™ã‚‹ãƒ†ã‚¹ãƒˆã‚’è¡Œã£ã¦ãã ã•ã„。 | ||
diff --git a/Documentation/kdump/kdump.txt b/Documentation/kdump/kdump.txt index 9691c7f5166c..3f4bc840da8b 100644 --- a/Documentation/kdump/kdump.txt +++ b/Documentation/kdump/kdump.txt | |||
@@ -65,26 +65,26 @@ Install kexec-tools | |||
65 | 65 | ||
66 | 2) Download the kexec-tools user-space package from the following URL: | 66 | 2) Download the kexec-tools user-space package from the following URL: |
67 | 67 | ||
68 | http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/kexec-tools-testing.tar.gz | 68 | http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/kexec-tools.tar.gz |
69 | 69 | ||
70 | This is a symlink to the latest version, which at the time of writing is | 70 | This is a symlink to the latest version. |
71 | 20061214, the only release of kexec-tools-testing so far. As other versions | ||
72 | are released, the older ones will remain available at | ||
73 | http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/ | ||
74 | 71 | ||
75 | Note: Latest kexec-tools-testing git tree is available at | 72 | The latest kexec-tools git tree is available at: |
76 | 73 | ||
77 | git://git.kernel.org/pub/scm/linux/kernel/git/horms/kexec-tools-testing.git | 74 | git://git.kernel.org/pub/scm/linux/kernel/git/horms/kexec-tools.git |
78 | or | 75 | or |
79 | http://www.kernel.org/git/?p=linux/kernel/git/horms/kexec-tools-testing.git;a=summary | 76 | http://www.kernel.org/git/?p=linux/kernel/git/horms/kexec-tools.git |
77 | |||
78 | More information about kexec-tools can be found at | ||
79 | http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/README.html | ||
80 | 80 | ||
81 | 3) Unpack the tarball with the tar command, as follows: | 81 | 3) Unpack the tarball with the tar command, as follows: |
82 | 82 | ||
83 | tar xvpzf kexec-tools-testing.tar.gz | 83 | tar xvpzf kexec-tools.tar.gz |
84 | 84 | ||
85 | 4) Change to the kexec-tools directory, as follows: | 85 | 4) Change to the kexec-tools directory, as follows: |
86 | 86 | ||
87 | cd kexec-tools-testing-VERSION | 87 | cd kexec-tools-VERSION |
88 | 88 | ||
89 | 5) Configure the package, as follows: | 89 | 5) Configure the package, as follows: |
90 | 90 | ||
@@ -109,7 +109,8 @@ There are two possible methods of using Kdump. | |||
109 | 2) Or use the system kernel binary itself as dump-capture kernel and there is | 109 | 2) Or use the system kernel binary itself as dump-capture kernel and there is |
110 | no need to build a separate dump-capture kernel. This is possible | 110 | no need to build a separate dump-capture kernel. This is possible |
111 | only with the architecutres which support a relocatable kernel. As | 111 | only with the architecutres which support a relocatable kernel. As |
112 | of today, i386, x86_64 and ia64 architectures support relocatable kernel. | 112 | of today, i386, x86_64, ppc64 and ia64 architectures support relocatable |
113 | kernel. | ||
113 | 114 | ||
114 | Building a relocatable kernel is advantageous from the point of view that | 115 | Building a relocatable kernel is advantageous from the point of view that |
115 | one does not have to build a second kernel for capturing the dump. But | 116 | one does not have to build a second kernel for capturing the dump. But |
@@ -207,8 +208,15 @@ Dump-capture kernel config options (Arch Dependent, i386 and x86_64) | |||
207 | Dump-capture kernel config options (Arch Dependent, ppc64) | 208 | Dump-capture kernel config options (Arch Dependent, ppc64) |
208 | ---------------------------------------------------------- | 209 | ---------------------------------------------------------- |
209 | 210 | ||
210 | * Make and install the kernel and its modules. DO NOT add this kernel | 211 | 1) Enable "Build a kdump crash kernel" support under "Kernel" options: |
211 | to the boot loader configuration files. | 212 | |
213 | CONFIG_CRASH_DUMP=y | ||
214 | |||
215 | 2) Enable "Build a relocatable kernel" support | ||
216 | |||
217 | CONFIG_RELOCATABLE=y | ||
218 | |||
219 | Make and install the kernel and its modules. | ||
212 | 220 | ||
213 | Dump-capture kernel config options (Arch Dependent, ia64) | 221 | Dump-capture kernel config options (Arch Dependent, ia64) |
214 | ---------------------------------------------------------- | 222 | ---------------------------------------------------------- |
diff --git a/Documentation/kernel-doc-nano-HOWTO.txt b/Documentation/kernel-doc-nano-HOWTO.txt index 0bd32748a467..c6841eee9598 100644 --- a/Documentation/kernel-doc-nano-HOWTO.txt +++ b/Documentation/kernel-doc-nano-HOWTO.txt | |||
@@ -168,10 +168,10 @@ if ($#ARGV < 0) { | |||
168 | mkdir $ARGV[0],0777; | 168 | mkdir $ARGV[0],0777; |
169 | $state = 0; | 169 | $state = 0; |
170 | while (<STDIN>) { | 170 | while (<STDIN>) { |
171 | if (/^\.TH \"[^\"]*\" 4 \"([^\"]*)\"/) { | 171 | if (/^\.TH \"[^\"]*\" 9 \"([^\"]*)\"/) { |
172 | if ($state == 1) { close OUT } | 172 | if ($state == 1) { close OUT } |
173 | $state = 1; | 173 | $state = 1; |
174 | $fn = "$ARGV[0]/$1.4"; | 174 | $fn = "$ARGV[0]/$1.9"; |
175 | print STDERR "Creating $fn\n"; | 175 | print STDERR "Creating $fn\n"; |
176 | open OUT, ">$fn" or die "can't open $fn: $!\n"; | 176 | open OUT, ">$fn" or die "can't open $fn: $!\n"; |
177 | print OUT $_; | 177 | print OUT $_; |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 62b6e8067a5b..63bac584f9cb 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -87,7 +87,8 @@ parameter is applicable: | |||
87 | SH SuperH architecture is enabled. | 87 | SH SuperH architecture is enabled. |
88 | SMP The kernel is an SMP kernel. | 88 | SMP The kernel is an SMP kernel. |
89 | SPARC Sparc architecture is enabled. | 89 | SPARC Sparc architecture is enabled. |
90 | SWSUSP Software suspend is enabled. | 90 | SWSUSP Software suspend (hibernation) is enabled. |
91 | SUSPEND System suspend states are enabled. | ||
91 | TS Appropriate touchscreen support is enabled. | 92 | TS Appropriate touchscreen support is enabled. |
92 | USB USB support is enabled. | 93 | USB USB support is enabled. |
93 | USBHID USB Human Interface Device support is enabled. | 94 | USBHID USB Human Interface Device support is enabled. |
@@ -100,6 +101,7 @@ parameter is applicable: | |||
100 | X86-64 X86-64 architecture is enabled. | 101 | X86-64 X86-64 architecture is enabled. |
101 | More X86-64 boot options can be found in | 102 | More X86-64 boot options can be found in |
102 | Documentation/x86_64/boot-options.txt . | 103 | Documentation/x86_64/boot-options.txt . |
104 | X86 Either 32bit or 64bit x86 (same as X86-32+X86-64) | ||
103 | 105 | ||
104 | In addition, the following text indicates that the option: | 106 | In addition, the following text indicates that the option: |
105 | 107 | ||
@@ -147,10 +149,12 @@ and is between 256 and 4096 characters. It is defined in the file | |||
147 | default: 0 | 149 | default: 0 |
148 | 150 | ||
149 | acpi_sleep= [HW,ACPI] Sleep options | 151 | acpi_sleep= [HW,ACPI] Sleep options |
150 | Format: { s3_bios, s3_mode, s3_beep, old_ordering } | 152 | Format: { s3_bios, s3_mode, s3_beep, s4_nohwsig, old_ordering } |
151 | See Documentation/power/video.txt for s3_bios and s3_mode. | 153 | See Documentation/power/video.txt for s3_bios and s3_mode. |
152 | s3_beep is for debugging; it makes the PC's speaker beep | 154 | s3_beep is for debugging; it makes the PC's speaker beep |
153 | as soon as the kernel's real-mode entry point is called. | 155 | as soon as the kernel's real-mode entry point is called. |
156 | s4_nohwsig prevents ACPI hardware signature from being | ||
157 | used during resume from hibernation. | ||
154 | old_ordering causes the ACPI 1.0 ordering of the _PTS | 158 | old_ordering causes the ACPI 1.0 ordering of the _PTS |
155 | control method, wrt putting devices into low power | 159 | control method, wrt putting devices into low power |
156 | states, to be enforced (the ACPI 2.0 ordering of _PTS is | 160 | states, to be enforced (the ACPI 2.0 ordering of _PTS is |
@@ -214,20 +218,47 @@ and is between 256 and 4096 characters. It is defined in the file | |||
214 | acpi.debug_level= [HW,ACPI] | 218 | acpi.debug_level= [HW,ACPI] |
215 | Format: <int> | 219 | Format: <int> |
216 | Each bit of the <int> indicates an ACPI debug level, | 220 | Each bit of the <int> indicates an ACPI debug level, |
217 | 1: enable, 0: disable. It is useful for boot time | 221 | which corresponds to the level in an ACPI_DEBUG_PRINT |
218 | debugging. After system has booted up, it can be set | 222 | statement. After system has booted up, this mask |
219 | via /sys/module/acpi/parameters/debug_level. | 223 | can be set via /sys/module/acpi/parameters/debug_level. |
220 | CONFIG_ACPI_DEBUG must be enabled for this to produce any output. | 224 | |
221 | Available bits (add the numbers together) to enable different | 225 | CONFIG_ACPI_DEBUG must be enabled for this to produce |
222 | debug output levels of the ACPI subsystem: | 226 | any output. The number can be in decimal or prefixed |
223 | 0x01 error 0x02 warn 0x04 init 0x08 debug object | 227 | with 0x in hex. Some of these options produce so much |
224 | 0x10 info 0x20 init names 0x40 parse 0x80 load | 228 | output that the system is unusable. |
225 | 0x100 dispatch 0x200 execute 0x400 names 0x800 operation region | 229 | |
226 | 0x1000 bfield 0x2000 tables 0x4000 values 0x8000 objects | 230 | The following global components are defined by the |
227 | 0x10000 resources 0x20000 user requests 0x40000 package. | 231 | ACPI CA: |
228 | The number can be in decimal or prefixed with 0x in hex. | 232 | 0x01 error |
229 | Warning: Many of these options can produce a lot of | 233 | 0x02 warn |
230 | output and make your system unusable. Be very careful. | 234 | 0x04 init |
235 | 0x08 debug object | ||
236 | 0x10 info | ||
237 | 0x20 init names | ||
238 | 0x40 parse | ||
239 | 0x80 load | ||
240 | 0x100 dispatch | ||
241 | 0x200 execute | ||
242 | 0x400 names | ||
243 | 0x800 operation region | ||
244 | 0x1000 bfield | ||
245 | 0x2000 tables | ||
246 | 0x4000 values | ||
247 | 0x8000 objects | ||
248 | 0x10000 resources | ||
249 | 0x20000 user requests | ||
250 | 0x40000 package | ||
251 | The number can be in decimal or prefixed with 0x in hex. | ||
252 | Warning: Many of these options can produce a lot of | ||
253 | output and make your system unusable. Be very careful. | ||
254 | |||
255 | acpi.power_nocheck= [HW,ACPI] | ||
256 | Format: 1/0 enable/disable the check of power state. | ||
257 | On some bogus BIOS the _PSC object/_STA object of | ||
258 | power resource can't return the correct device power | ||
259 | state. In such case it is unneccessary to check its | ||
260 | power state again in power transition. | ||
261 | 1 : disable the power state check | ||
231 | 262 | ||
232 | acpi_pm_good [X86-32,X86-64] | 263 | acpi_pm_good [X86-32,X86-64] |
233 | Override the pmtimer bug detection: force the kernel | 264 | Override the pmtimer bug detection: force the kernel |
@@ -281,6 +312,11 @@ and is between 256 and 4096 characters. It is defined in the file | |||
281 | isolate - enable device isolation (each device, as far | 312 | isolate - enable device isolation (each device, as far |
282 | as possible, will get its own protection | 313 | as possible, will get its own protection |
283 | domain) | 314 | domain) |
315 | fullflush - enable flushing of IO/TLB entries when | ||
316 | they are unmapped. Otherwise they are | ||
317 | flushed before they will be reused, which | ||
318 | is a lot of faster | ||
319 | |||
284 | amd_iommu_size= [HW,X86-64] | 320 | amd_iommu_size= [HW,X86-64] |
285 | Define the size of the aperture for the AMD IOMMU | 321 | Define the size of the aperture for the AMD IOMMU |
286 | driver. Possible values are: | 322 | driver. Possible values are: |
@@ -362,6 +398,8 @@ and is between 256 and 4096 characters. It is defined in the file | |||
362 | no delay (0). | 398 | no delay (0). |
363 | Format: integer | 399 | Format: integer |
364 | 400 | ||
401 | bootmem_debug [KNL] Enable bootmem allocator debug messages. | ||
402 | |||
365 | bttv.card= [HW,V4L] bttv (bt848 + bt878 based grabber cards) | 403 | bttv.card= [HW,V4L] bttv (bt848 + bt878 based grabber cards) |
366 | bttv.radio= Most important insmod options are available as | 404 | bttv.radio= Most important insmod options are available as |
367 | kernel args too. | 405 | kernel args too. |
@@ -458,12 +496,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
458 | Range: 0 - 8192 | 496 | Range: 0 - 8192 |
459 | Default: 64 | 497 | Default: 64 |
460 | 498 | ||
461 | disable_8254_timer | ||
462 | enable_8254_timer | ||
463 | [IA32/X86_64] Disable/Enable interrupt 0 timer routing | ||
464 | over the 8254 in addition to over the IO-APIC. The | ||
465 | kernel tries to set a sensible default. | ||
466 | |||
467 | hpet= [X86-32,HPET] option to control HPET usage | 499 | hpet= [X86-32,HPET] option to control HPET usage |
468 | Format: { enable (default) | disable | force } | 500 | Format: { enable (default) | disable | force } |
469 | disable: disable HPET and use PIT instead | 501 | disable: disable HPET and use PIT instead |
@@ -654,11 +686,12 @@ and is between 256 and 4096 characters. It is defined in the file | |||
654 | earlyprintk= [X86-32,X86-64,SH,BLACKFIN] | 686 | earlyprintk= [X86-32,X86-64,SH,BLACKFIN] |
655 | earlyprintk=vga | 687 | earlyprintk=vga |
656 | earlyprintk=serial[,ttySn[,baudrate]] | 688 | earlyprintk=serial[,ttySn[,baudrate]] |
689 | earlyprintk=dbgp | ||
657 | 690 | ||
658 | Append ",keep" to not disable it when the real console | 691 | Append ",keep" to not disable it when the real console |
659 | takes over. | 692 | takes over. |
660 | 693 | ||
661 | Only vga or serial at a time, not both. | 694 | Only vga or serial or usb debug port at a time. |
662 | 695 | ||
663 | Currently only ttyS0 and ttyS1 are supported. | 696 | Currently only ttyS0 and ttyS1 are supported. |
664 | 697 | ||
@@ -685,7 +718,7 @@ and is between 256 and 4096 characters. It is defined in the file | |||
685 | See Documentation/block/as-iosched.txt and | 718 | See Documentation/block/as-iosched.txt and |
686 | Documentation/block/deadline-iosched.txt for details. | 719 | Documentation/block/deadline-iosched.txt for details. |
687 | 720 | ||
688 | elfcorehdr= [X86-32, X86_64] | 721 | elfcorehdr= [IA64,PPC,SH,X86-32,X86_64] |
689 | Specifies physical address of start of kernel core | 722 | Specifies physical address of start of kernel core |
690 | image elf header. Generally kexec loader will | 723 | image elf header. Generally kexec loader will |
691 | pass this option to capture kernel. | 724 | pass this option to capture kernel. |
@@ -774,9 +807,26 @@ and is between 256 and 4096 characters. It is defined in the file | |||
774 | hisax= [HW,ISDN] | 807 | hisax= [HW,ISDN] |
775 | See Documentation/isdn/README.HiSax. | 808 | See Documentation/isdn/README.HiSax. |
776 | 809 | ||
777 | hugepages= [HW,X86-32,IA-64] Maximal number of HugeTLB pages. | 810 | hugepages= [HW,X86-32,IA-64] HugeTLB pages to allocate at boot. |
778 | hugepagesz= [HW,IA-64,PPC] The size of the HugeTLB pages. | 811 | hugepagesz= [HW,IA-64,PPC,X86-64] The size of the HugeTLB pages. |
779 | 812 | On x86-64 and powerpc, this option can be specified | |
813 | multiple times interleaved with hugepages= to reserve | ||
814 | huge pages of different sizes. Valid pages sizes on | ||
815 | x86-64 are 2M (when the CPU supports "pse") and 1G | ||
816 | (when the CPU supports the "pdpe1gb" cpuinfo flag) | ||
817 | Note that 1GB pages can only be allocated at boot time | ||
818 | using hugepages= and not freed afterwards. | ||
819 | default_hugepagesz= | ||
820 | [same as hugepagesz=] The size of the default | ||
821 | HugeTLB page size. This is the size represented by | ||
822 | the legacy /proc/ hugepages APIs, used for SHM, and | ||
823 | default size when mounting hugetlbfs filesystems. | ||
824 | Defaults to the default architecture's huge page size | ||
825 | if not specified. | ||
826 | |||
827 | hlt [BUGS=ARM,SH] | ||
828 | |||
829 | i8042.debug [HW] Toggle i8042 debug mode | ||
780 | i8042.direct [HW] Put keyboard port into non-translated mode | 830 | i8042.direct [HW] Put keyboard port into non-translated mode |
781 | i8042.dumbkbd [HW] Pretend that controller can only read data from | 831 | i8042.dumbkbd [HW] Pretend that controller can only read data from |
782 | keyboard and cannot control its state | 832 | keyboard and cannot control its state |
@@ -1001,6 +1051,10 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1001 | (only serial suported for now) | 1051 | (only serial suported for now) |
1002 | Format: <serial_device>[,baud] | 1052 | Format: <serial_device>[,baud] |
1003 | 1053 | ||
1054 | kmac= [MIPS] korina ethernet MAC address. | ||
1055 | Configure the RouterBoard 532 series on-chip | ||
1056 | Ethernet adapter MAC address. | ||
1057 | |||
1004 | l2cr= [PPC] | 1058 | l2cr= [PPC] |
1005 | 1059 | ||
1006 | l3cr= [PPC] | 1060 | l3cr= [PPC] |
@@ -1055,6 +1109,9 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1055 | 1109 | ||
1056 | * [no]ncq: Turn on or off NCQ. | 1110 | * [no]ncq: Turn on or off NCQ. |
1057 | 1111 | ||
1112 | * nohrst, nosrst, norst: suppress hard, soft | ||
1113 | and both resets. | ||
1114 | |||
1058 | If there are multiple matching configurations changing | 1115 | If there are multiple matching configurations changing |
1059 | the same attribute, the last one is used. | 1116 | the same attribute, the last one is used. |
1060 | 1117 | ||
@@ -1184,6 +1241,10 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1184 | mem=nopentium [BUGS=X86-32] Disable usage of 4MB pages for kernel | 1241 | mem=nopentium [BUGS=X86-32] Disable usage of 4MB pages for kernel |
1185 | memory. | 1242 | memory. |
1186 | 1243 | ||
1244 | memchunk=nn[KMG] | ||
1245 | [KNL,SH] Allow user to override the default size for | ||
1246 | per-device physically contiguous DMA buffers. | ||
1247 | |||
1187 | memmap=exactmap [KNL,X86-32,X86_64] Enable setting of an exact | 1248 | memmap=exactmap [KNL,X86-32,X86_64] Enable setting of an exact |
1188 | E820 memory map, as specified by the user. | 1249 | E820 memory map, as specified by the user. |
1189 | Such memmap=exactmap lines can be constructed based on | 1250 | Such memmap=exactmap lines can be constructed based on |
@@ -1206,7 +1267,30 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1206 | or | 1267 | or |
1207 | memmap=0x10000$0x18690000 | 1268 | memmap=0x10000$0x18690000 |
1208 | 1269 | ||
1209 | memtest= [KNL,X86_64] Enable memtest | 1270 | memory_corruption_check=0/1 [X86] |
1271 | Some BIOSes seem to corrupt the first 64k of | ||
1272 | memory when doing things like suspend/resume. | ||
1273 | Setting this option will scan the memory | ||
1274 | looking for corruption. Enabling this will | ||
1275 | both detect corruption and prevent the kernel | ||
1276 | from using the memory being corrupted. | ||
1277 | However, its intended as a diagnostic tool; if | ||
1278 | repeatable BIOS-originated corruption always | ||
1279 | affects the same memory, you can use memmap= | ||
1280 | to prevent the kernel from using that memory. | ||
1281 | |||
1282 | memory_corruption_check_size=size [X86] | ||
1283 | By default it checks for corruption in the low | ||
1284 | 64k, making this memory unavailable for normal | ||
1285 | use. Use this parameter to scan for | ||
1286 | corruption in more or less memory. | ||
1287 | |||
1288 | memory_corruption_check_period=seconds [X86] | ||
1289 | By default it checks for corruption every 60 | ||
1290 | seconds. Use this parameter to check at some | ||
1291 | other rate. 0 disables periodic checking. | ||
1292 | |||
1293 | memtest= [KNL,X86] Enable memtest | ||
1210 | Format: <integer> | 1294 | Format: <integer> |
1211 | range: 0,4 : pattern number | 1295 | range: 0,4 : pattern number |
1212 | default : 0 <disable> | 1296 | default : 0 <disable> |
@@ -1225,6 +1309,14 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1225 | 1309 | ||
1226 | mga= [HW,DRM] | 1310 | mga= [HW,DRM] |
1227 | 1311 | ||
1312 | mminit_loglevel= | ||
1313 | [KNL] When CONFIG_DEBUG_MEMORY_INIT is set, this | ||
1314 | parameter allows control of the logging verbosity for | ||
1315 | the additional memory initialisation checks. A value | ||
1316 | of 0 disables mminit logging and a level of 4 will | ||
1317 | log everything. Information is printed at KERN_DEBUG | ||
1318 | so loglevel=8 may also need to be specified. | ||
1319 | |||
1228 | mousedev.tap_time= | 1320 | mousedev.tap_time= |
1229 | [MOUSE] Maximum time between finger touching and | 1321 | [MOUSE] Maximum time between finger touching and |
1230 | leaving touchpad surface for touch to be considered | 1322 | leaving touchpad surface for touch to be considered |
@@ -1279,6 +1371,13 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1279 | This usage is only documented in each driver source | 1371 | This usage is only documented in each driver source |
1280 | file if at all. | 1372 | file if at all. |
1281 | 1373 | ||
1374 | nf_conntrack.acct= | ||
1375 | [NETFILTER] Enable connection tracking flow accounting | ||
1376 | 0 to disable accounting | ||
1377 | 1 to enable accounting | ||
1378 | Default value depends on CONFIG_NF_CT_ACCT that is | ||
1379 | going to be removed in 2.6.29. | ||
1380 | |||
1282 | nfsaddrs= [NFS] | 1381 | nfsaddrs= [NFS] |
1283 | See Documentation/filesystems/nfsroot.txt. | 1382 | See Documentation/filesystems/nfsroot.txt. |
1284 | 1383 | ||
@@ -1328,6 +1427,8 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1328 | 1427 | ||
1329 | nodisconnect [HW,SCSI,M68K] Disables SCSI disconnects. | 1428 | nodisconnect [HW,SCSI,M68K] Disables SCSI disconnects. |
1330 | 1429 | ||
1430 | nodsp [SH] Disable hardware DSP at boot time. | ||
1431 | |||
1331 | noefi [X86-32,X86-64] Disable EFI runtime services support. | 1432 | noefi [X86-32,X86-64] Disable EFI runtime services support. |
1332 | 1433 | ||
1333 | noexec [IA-64] | 1434 | noexec [IA-64] |
@@ -1344,13 +1445,15 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1344 | noexec32=off: disable non-executable mappings | 1445 | noexec32=off: disable non-executable mappings |
1345 | read implies executable mappings | 1446 | read implies executable mappings |
1346 | 1447 | ||
1448 | nofpu [SH] Disable hardware FPU at boot time. | ||
1449 | |||
1347 | nofxsr [BUGS=X86-32] Disables x86 floating point extended | 1450 | nofxsr [BUGS=X86-32] Disables x86 floating point extended |
1348 | register save and restore. The kernel will only save | 1451 | register save and restore. The kernel will only save |
1349 | legacy floating-point registers on task switch. | 1452 | legacy floating-point registers on task switch. |
1350 | 1453 | ||
1351 | noclflush [BUGS=X86] Don't use the CLFLUSH instruction | 1454 | noclflush [BUGS=X86] Don't use the CLFLUSH instruction |
1352 | 1455 | ||
1353 | nohlt [BUGS=ARM] | 1456 | nohlt [BUGS=ARM,SH] |
1354 | 1457 | ||
1355 | no-hlt [BUGS=X86-32] Tells the kernel that the hlt | 1458 | no-hlt [BUGS=X86-32] Tells the kernel that the hlt |
1356 | instruction doesn't work correctly and not to | 1459 | instruction doesn't work correctly and not to |
@@ -1388,6 +1491,12 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1388 | 1491 | ||
1389 | nolapic_timer [X86-32,APIC] Do not use the local APIC timer. | 1492 | nolapic_timer [X86-32,APIC] Do not use the local APIC timer. |
1390 | 1493 | ||
1494 | nox2apic [X86-64,APIC] Do not enable x2APIC mode. | ||
1495 | |||
1496 | x2apic_phys [X86-64,APIC] Use x2apic physical mode instead of | ||
1497 | default x2apic cluster mode on platforms | ||
1498 | supporting x2apic. | ||
1499 | |||
1391 | noltlbs [PPC] Do not use large page/tlb entries for kernel | 1500 | noltlbs [PPC] Do not use large page/tlb entries for kernel |
1392 | lowmem mapping on PPC40x. | 1501 | lowmem mapping on PPC40x. |
1393 | 1502 | ||
@@ -1507,7 +1616,7 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1507 | See also Documentation/paride.txt. | 1616 | See also Documentation/paride.txt. |
1508 | 1617 | ||
1509 | pci=option[,option...] [PCI] various PCI subsystem options: | 1618 | pci=option[,option...] [PCI] various PCI subsystem options: |
1510 | off [X86-32] don't probe for the PCI bus | 1619 | off [X86] don't probe for the PCI bus |
1511 | bios [X86-32] force use of PCI BIOS, don't access | 1620 | bios [X86-32] force use of PCI BIOS, don't access |
1512 | the hardware directly. Use this if your machine | 1621 | the hardware directly. Use this if your machine |
1513 | has a non-standard PCI host bridge. | 1622 | has a non-standard PCI host bridge. |
@@ -1515,9 +1624,9 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1515 | hardware access methods are allowed. Use this | 1624 | hardware access methods are allowed. Use this |
1516 | if you experience crashes upon bootup and you | 1625 | if you experience crashes upon bootup and you |
1517 | suspect they are caused by the BIOS. | 1626 | suspect they are caused by the BIOS. |
1518 | conf1 [X86-32] Force use of PCI Configuration | 1627 | conf1 [X86] Force use of PCI Configuration |
1519 | Mechanism 1. | 1628 | Mechanism 1. |
1520 | conf2 [X86-32] Force use of PCI Configuration | 1629 | conf2 [X86] Force use of PCI Configuration |
1521 | Mechanism 2. | 1630 | Mechanism 2. |
1522 | noaer [PCIE] If the PCIEAER kernel config parameter is | 1631 | noaer [PCIE] If the PCIEAER kernel config parameter is |
1523 | enabled, this kernel boot option can be used to | 1632 | enabled, this kernel boot option can be used to |
@@ -1548,37 +1657,37 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1548 | this option if the kernel is unable to allocate | 1657 | this option if the kernel is unable to allocate |
1549 | IRQs or discover secondary PCI buses on your | 1658 | IRQs or discover secondary PCI buses on your |
1550 | motherboard. | 1659 | motherboard. |
1551 | rom [X86-32] Assign address space to expansion ROMs. | 1660 | rom [X86] Assign address space to expansion ROMs. |
1552 | Use with caution as certain devices share | 1661 | Use with caution as certain devices share |
1553 | address decoders between ROMs and other | 1662 | address decoders between ROMs and other |
1554 | resources. | 1663 | resources. |
1555 | norom [X86-32,X86_64] Do not assign address space to | 1664 | norom [X86] Do not assign address space to |
1556 | expansion ROMs that do not already have | 1665 | expansion ROMs that do not already have |
1557 | BIOS assigned address ranges. | 1666 | BIOS assigned address ranges. |
1558 | irqmask=0xMMMM [X86-32] Set a bit mask of IRQs allowed to be | 1667 | irqmask=0xMMMM [X86] Set a bit mask of IRQs allowed to be |
1559 | assigned automatically to PCI devices. You can | 1668 | assigned automatically to PCI devices. You can |
1560 | make the kernel exclude IRQs of your ISA cards | 1669 | make the kernel exclude IRQs of your ISA cards |
1561 | this way. | 1670 | this way. |
1562 | pirqaddr=0xAAAAA [X86-32] Specify the physical address | 1671 | pirqaddr=0xAAAAA [X86] Specify the physical address |
1563 | of the PIRQ table (normally generated | 1672 | of the PIRQ table (normally generated |
1564 | by the BIOS) if it is outside the | 1673 | by the BIOS) if it is outside the |
1565 | F0000h-100000h range. | 1674 | F0000h-100000h range. |
1566 | lastbus=N [X86-32] Scan all buses thru bus #N. Can be | 1675 | lastbus=N [X86] Scan all buses thru bus #N. Can be |
1567 | useful if the kernel is unable to find your | 1676 | useful if the kernel is unable to find your |
1568 | secondary buses and you want to tell it | 1677 | secondary buses and you want to tell it |
1569 | explicitly which ones they are. | 1678 | explicitly which ones they are. |
1570 | assign-busses [X86-32] Always assign all PCI bus | 1679 | assign-busses [X86] Always assign all PCI bus |
1571 | numbers ourselves, overriding | 1680 | numbers ourselves, overriding |
1572 | whatever the firmware may have done. | 1681 | whatever the firmware may have done. |
1573 | usepirqmask [X86-32] Honor the possible IRQ mask stored | 1682 | usepirqmask [X86] Honor the possible IRQ mask stored |
1574 | in the BIOS $PIR table. This is needed on | 1683 | in the BIOS $PIR table. This is needed on |
1575 | some systems with broken BIOSes, notably | 1684 | some systems with broken BIOSes, notably |
1576 | some HP Pavilion N5400 and Omnibook XE3 | 1685 | some HP Pavilion N5400 and Omnibook XE3 |
1577 | notebooks. This will have no effect if ACPI | 1686 | notebooks. This will have no effect if ACPI |
1578 | IRQ routing is enabled. | 1687 | IRQ routing is enabled. |
1579 | noacpi [X86-32] Do not use ACPI for IRQ routing | 1688 | noacpi [X86] Do not use ACPI for IRQ routing |
1580 | or for PCI scanning. | 1689 | or for PCI scanning. |
1581 | use_crs [X86-32] Use _CRS for PCI resource | 1690 | use_crs [X86] Use _CRS for PCI resource |
1582 | allocation. | 1691 | allocation. |
1583 | routeirq Do IRQ routing for all PCI devices. | 1692 | routeirq Do IRQ routing for all PCI devices. |
1584 | This is normally done in pci_enable_device(), | 1693 | This is normally done in pci_enable_device(), |
@@ -1607,6 +1716,12 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1607 | reserved for the CardBus bridge's memory | 1716 | reserved for the CardBus bridge's memory |
1608 | window. The default value is 64 megabytes. | 1717 | window. The default value is 64 megabytes. |
1609 | 1718 | ||
1719 | pcie_aspm= [PCIE] Forcibly enable or disable PCIe Active State Power | ||
1720 | Management. | ||
1721 | off Disable ASPM. | ||
1722 | force Enable ASPM even on devices that claim not to support it. | ||
1723 | WARNING: Forcing ASPM on may cause system lockups. | ||
1724 | |||
1610 | pcmv= [HW,PCMCIA] BadgePAD 4 | 1725 | pcmv= [HW,PCMCIA] BadgePAD 4 |
1611 | 1726 | ||
1612 | pd. [PARIDE] | 1727 | pd. [PARIDE] |
@@ -1634,6 +1749,10 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1634 | Override pmtimer IOPort with a hex value. | 1749 | Override pmtimer IOPort with a hex value. |
1635 | e.g. pmtmr=0x508 | 1750 | e.g. pmtmr=0x508 |
1636 | 1751 | ||
1752 | pnp.debug [PNP] | ||
1753 | Enable PNP debug messages. This depends on the | ||
1754 | CONFIG_PNP_DEBUG_MESSAGES option. | ||
1755 | |||
1637 | pnpacpi= [ACPI] | 1756 | pnpacpi= [ACPI] |
1638 | { off } | 1757 | { off } |
1639 | 1758 | ||
@@ -1654,6 +1773,11 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1654 | autoconfiguration. | 1773 | autoconfiguration. |
1655 | Ranges are in pairs (memory base and size). | 1774 | Ranges are in pairs (memory base and size). |
1656 | 1775 | ||
1776 | dynamic_printk | ||
1777 | Enables pr_debug()/dev_dbg() calls if | ||
1778 | CONFIG_DYNAMIC_PRINTK_DEBUG has been enabled. These can also | ||
1779 | be switched on/off via <debugfs>/dynamic_printk/modules | ||
1780 | |||
1657 | print-fatal-signals= | 1781 | print-fatal-signals= |
1658 | [KNL] debug: print fatal signals | 1782 | [KNL] debug: print fatal signals |
1659 | print-fatal-signals=1: print segfault info to | 1783 | print-fatal-signals=1: print segfault info to |
@@ -1856,6 +1980,12 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1856 | shapers= [NET] | 1980 | shapers= [NET] |
1857 | Maximal number of shapers. | 1981 | Maximal number of shapers. |
1858 | 1982 | ||
1983 | show_msr= [x86] show boot-time MSR settings | ||
1984 | Format: { <integer> } | ||
1985 | Show boot-time (BIOS-initialized) MSR settings. | ||
1986 | The parameter means the number of CPUs to show, | ||
1987 | for example 1 means boot CPU only. | ||
1988 | |||
1859 | sim710= [SCSI,HW] | 1989 | sim710= [SCSI,HW] |
1860 | See header of drivers/scsi/sim710.c. | 1990 | See header of drivers/scsi/sim710.c. |
1861 | 1991 | ||
@@ -2038,6 +2168,9 @@ and is between 256 and 4096 characters. It is defined in the file | |||
2038 | 2168 | ||
2039 | snd-ymfpci= [HW,ALSA] | 2169 | snd-ymfpci= [HW,ALSA] |
2040 | 2170 | ||
2171 | softlockup_panic= | ||
2172 | [KNL] Should the soft-lockup detector generate panics. | ||
2173 | |||
2041 | sonypi.*= [HW] Sony Programmable I/O Control Device driver | 2174 | sonypi.*= [HW] Sony Programmable I/O Control Device driver |
2042 | See Documentation/sonypi.txt | 2175 | See Documentation/sonypi.txt |
2043 | 2176 | ||
@@ -2102,6 +2235,12 @@ and is between 256 and 4096 characters. It is defined in the file | |||
2102 | 2235 | ||
2103 | tdfx= [HW,DRM] | 2236 | tdfx= [HW,DRM] |
2104 | 2237 | ||
2238 | test_suspend= [SUSPEND] | ||
2239 | Specify "mem" (for Suspend-to-RAM) or "standby" (for | ||
2240 | standby suspend) as the system sleep state to briefly | ||
2241 | enter during system startup. The system is woken from | ||
2242 | this state using a wakeup-capable RTC alarm. | ||
2243 | |||
2105 | thash_entries= [KNL,NET] | 2244 | thash_entries= [KNL,NET] |
2106 | Set number of hash buckets for TCP connection | 2245 | Set number of hash buckets for TCP connection |
2107 | 2246 | ||
@@ -2111,7 +2250,7 @@ and is between 256 and 4096 characters. It is defined in the file | |||
2111 | 2250 | ||
2112 | thermal.crt= [HW,ACPI] | 2251 | thermal.crt= [HW,ACPI] |
2113 | -1: disable all critical trip points in all thermal zones | 2252 | -1: disable all critical trip points in all thermal zones |
2114 | <degrees C>: lower all critical trip points | 2253 | <degrees C>: override all critical trip points |
2115 | 2254 | ||
2116 | thermal.nocrt= [HW,ACPI] | 2255 | thermal.nocrt= [HW,ACPI] |
2117 | Set to disable actions on ACPI thermal zone | 2256 | Set to disable actions on ACPI thermal zone |
@@ -2129,13 +2268,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
2129 | <deci-seconds>: poll all this frequency | 2268 | <deci-seconds>: poll all this frequency |
2130 | 0: no polling (default) | 2269 | 0: no polling (default) |
2131 | 2270 | ||
2132 | tipar.timeout= [HW,PPT] | ||
2133 | Set communications timeout in tenths of a second | ||
2134 | (default 15). | ||
2135 | |||
2136 | tipar.delay= [HW,PPT] | ||
2137 | Set inter-bit delay in microseconds (default 10). | ||
2138 | |||
2139 | tmscsim= [HW,SCSI] | 2271 | tmscsim= [HW,SCSI] |
2140 | See comment before function dc390_setup() in | 2272 | See comment before function dc390_setup() in |
2141 | drivers/scsi/tmscsim.c. | 2273 | drivers/scsi/tmscsim.c. |
@@ -2169,6 +2301,10 @@ and is between 256 and 4096 characters. It is defined in the file | |||
2169 | Note that genuine overcurrent events won't be | 2301 | Note that genuine overcurrent events won't be |
2170 | reported either. | 2302 | reported either. |
2171 | 2303 | ||
2304 | unknown_nmi_panic | ||
2305 | [X86-32,X86-64] | ||
2306 | Set unknown_nmi_panic=1 early on boot. | ||
2307 | |||
2172 | usbcore.autosuspend= | 2308 | usbcore.autosuspend= |
2173 | [USB] The autosuspend time delay (in seconds) used | 2309 | [USB] The autosuspend time delay (in seconds) used |
2174 | for newly-detected USB devices (default 2). This | 2310 | for newly-detected USB devices (default 2). This |
@@ -2176,6 +2312,25 @@ and is between 256 and 4096 characters. It is defined in the file | |||
2176 | autosuspended. Devices for which the delay is set | 2312 | autosuspended. Devices for which the delay is set |
2177 | to a negative value won't be autosuspended at all. | 2313 | to a negative value won't be autosuspended at all. |
2178 | 2314 | ||
2315 | usbcore.usbfs_snoop= | ||
2316 | [USB] Set to log all usbfs traffic (default 0 = off). | ||
2317 | |||
2318 | usbcore.blinkenlights= | ||
2319 | [USB] Set to cycle leds on hubs (default 0 = off). | ||
2320 | |||
2321 | usbcore.old_scheme_first= | ||
2322 | [USB] Start with the old device initialization | ||
2323 | scheme (default 0 = off). | ||
2324 | |||
2325 | usbcore.use_both_schemes= | ||
2326 | [USB] Try the other device initialization scheme | ||
2327 | if the first one fails (default 1 = enabled). | ||
2328 | |||
2329 | usbcore.initial_descriptor_timeout= | ||
2330 | [USB] Specifies timeout for the initial 64-byte | ||
2331 | USB_REQ_GET_DESCRIPTOR request in milliseconds | ||
2332 | (default 5000 = 5.0 seconds). | ||
2333 | |||
2179 | usbhid.mousepoll= | 2334 | usbhid.mousepoll= |
2180 | [USBHID] The interval which mice are to be polled at. | 2335 | [USBHID] The interval which mice are to be polled at. |
2181 | 2336 | ||
diff --git a/Documentation/keys.txt b/Documentation/keys.txt index d5c7a57d1700..b56aacc1fff8 100644 --- a/Documentation/keys.txt +++ b/Documentation/keys.txt | |||
@@ -864,7 +864,7 @@ payload contents" for more information. | |||
864 | request_key_with_auxdata() respectively. | 864 | request_key_with_auxdata() respectively. |
865 | 865 | ||
866 | These two functions return with the key potentially still under | 866 | These two functions return with the key potentially still under |
867 | construction. To wait for contruction completion, the following should be | 867 | construction. To wait for construction completion, the following should be |
868 | called: | 868 | called: |
869 | 869 | ||
870 | int wait_for_key_construction(struct key *key, bool intr); | 870 | int wait_for_key_construction(struct key *key, bool intr); |
diff --git a/Documentation/kobject.txt b/Documentation/kobject.txt index 51a8021ee532..f5d2aad65a67 100644 --- a/Documentation/kobject.txt +++ b/Documentation/kobject.txt | |||
@@ -118,6 +118,10 @@ the name of the kobject, call kobject_rename(): | |||
118 | 118 | ||
119 | int kobject_rename(struct kobject *kobj, const char *new_name); | 119 | int kobject_rename(struct kobject *kobj, const char *new_name); |
120 | 120 | ||
121 | Note kobject_rename does perform any locking or have a solid notion of | ||
122 | what names are valid so the provide must provide their own sanity checking | ||
123 | and serialization. | ||
124 | |||
121 | There is a function called kobject_set_name() but that is legacy cruft and | 125 | There is a function called kobject_set_name() but that is legacy cruft and |
122 | is being removed. If your code needs to call this function, it is | 126 | is being removed. If your code needs to call this function, it is |
123 | incorrect and needs to be fixed. | 127 | incorrect and needs to be fixed. |
diff --git a/Documentation/laptops/acer-wmi.txt b/Documentation/laptops/acer-wmi.txt index 69b5dd4e5a59..2b3a6b5260bf 100644 --- a/Documentation/laptops/acer-wmi.txt +++ b/Documentation/laptops/acer-wmi.txt | |||
@@ -1,7 +1,7 @@ | |||
1 | Acer Laptop WMI Extras Driver | 1 | Acer Laptop WMI Extras Driver |
2 | http://code.google.com/p/aceracpi | 2 | http://code.google.com/p/aceracpi |
3 | Version 0.1 | 3 | Version 0.2 |
4 | 9th February 2008 | 4 | 18th August 2008 |
5 | 5 | ||
6 | Copyright 2007-2008 Carlos Corbacho <carlos@strangeworlds.co.uk> | 6 | Copyright 2007-2008 Carlos Corbacho <carlos@strangeworlds.co.uk> |
7 | 7 | ||
@@ -87,17 +87,7 @@ acer-wmi come with built-in wireless. However, should you feel so inclined to | |||
87 | ever wish to remove the card, or swap it out at some point, please get in touch | 87 | ever wish to remove the card, or swap it out at some point, please get in touch |
88 | with me, as we may well be able to gain some data on wireless card detection. | 88 | with me, as we may well be able to gain some data on wireless card detection. |
89 | 89 | ||
90 | To read the status of the wireless radio (0=off, 1=on): | 90 | The wireless radio is exposed through rfkill. |
91 | cat /sys/devices/platform/acer-wmi/wireless | ||
92 | |||
93 | To enable the wireless radio: | ||
94 | echo 1 > /sys/devices/platform/acer-wmi/wireless | ||
95 | |||
96 | To disable the wireless radio: | ||
97 | echo 0 > /sys/devices/platform/acer-wmi/wireless | ||
98 | |||
99 | To set the state of the wireless radio when loading acer-wmi, pass: | ||
100 | wireless=X (where X is 0 or 1) | ||
101 | 91 | ||
102 | Bluetooth | 92 | Bluetooth |
103 | ********* | 93 | ********* |
@@ -117,17 +107,7 @@ For the adventurously minded - if you want to buy an internal bluetooth | |||
117 | module off the internet that is compatible with your laptop and fit it, then | 107 | module off the internet that is compatible with your laptop and fit it, then |
118 | it will work just fine with acer-wmi. | 108 | it will work just fine with acer-wmi. |
119 | 109 | ||
120 | To read the status of the bluetooth module (0=off, 1=on): | 110 | Bluetooth is exposed through rfkill. |
121 | cat /sys/devices/platform/acer-wmi/wireless | ||
122 | |||
123 | To enable the bluetooth module: | ||
124 | echo 1 > /sys/devices/platform/acer-wmi/bluetooth | ||
125 | |||
126 | To disable the bluetooth module: | ||
127 | echo 0 > /sys/devices/platform/acer-wmi/bluetooth | ||
128 | |||
129 | To set the state of the bluetooth module when loading acer-wmi, pass: | ||
130 | bluetooth=X (where X is 0 or 1) | ||
131 | 111 | ||
132 | 3G | 112 | 3G |
133 | ** | 113 | ** |
diff --git a/Documentation/laptops/disk-shock-protection.txt b/Documentation/laptops/disk-shock-protection.txt new file mode 100644 index 000000000000..0e6ba2663834 --- /dev/null +++ b/Documentation/laptops/disk-shock-protection.txt | |||
@@ -0,0 +1,149 @@ | |||
1 | Hard disk shock protection | ||
2 | ========================== | ||
3 | |||
4 | Author: Elias Oltmanns <eo@nebensachen.de> | ||
5 | Last modified: 2008-10-03 | ||
6 | |||
7 | |||
8 | 0. Contents | ||
9 | ----------- | ||
10 | |||
11 | 1. Intro | ||
12 | 2. The interface | ||
13 | 3. References | ||
14 | 4. CREDITS | ||
15 | |||
16 | |||
17 | 1. Intro | ||
18 | -------- | ||
19 | |||
20 | ATA/ATAPI-7 specifies the IDLE IMMEDIATE command with unload feature. | ||
21 | Issuing this command should cause the drive to switch to idle mode and | ||
22 | unload disk heads. This feature is being used in modern laptops in | ||
23 | conjunction with accelerometers and appropriate software to implement | ||
24 | a shock protection facility. The idea is to stop all I/O operations on | ||
25 | the internal hard drive and park its heads on the ramp when critical | ||
26 | situations are anticipated. The desire to have such a feature | ||
27 | available on GNU/Linux systems has been the original motivation to | ||
28 | implement a generic disk head parking interface in the Linux kernel. | ||
29 | Please note, however, that other components have to be set up on your | ||
30 | system in order to get disk shock protection working (see | ||
31 | section 3. References below for pointers to more information about | ||
32 | that). | ||
33 | |||
34 | |||
35 | 2. The interface | ||
36 | ---------------- | ||
37 | |||
38 | For each ATA device, the kernel exports the file | ||
39 | block/*/device/unload_heads in sysfs (here assumed to be mounted under | ||
40 | /sys). Access to /sys/block/*/device/unload_heads is denied with | ||
41 | -EOPNOTSUPP if the device does not support the unload feature. | ||
42 | Otherwise, writing an integer value to this file will take the heads | ||
43 | of the respective drive off the platter and block all I/O operations | ||
44 | for the specified number of milliseconds. When the timeout expires and | ||
45 | no further disk head park request has been issued in the meantime, | ||
46 | normal operation will be resumed. The maximal value accepted for a | ||
47 | timeout is 30000 milliseconds. Exceeding this limit will return | ||
48 | -EOVERFLOW, but heads will be parked anyway and the timeout will be | ||
49 | set to 30 seconds. However, you can always change a timeout to any | ||
50 | value between 0 and 30000 by issuing a subsequent head park request | ||
51 | before the timeout of the previous one has expired. In particular, the | ||
52 | total timeout can exceed 30 seconds and, more importantly, you can | ||
53 | cancel a previously set timeout and resume normal operation | ||
54 | immediately by specifying a timeout of 0. Values below -2 are rejected | ||
55 | with -EINVAL (see below for the special meaning of -1 and -2). If the | ||
56 | timeout specified for a recent head park request has not yet expired, | ||
57 | reading from /sys/block/*/device/unload_heads will report the number | ||
58 | of milliseconds remaining until normal operation will be resumed; | ||
59 | otherwise, reading the unload_heads attribute will return 0. | ||
60 | |||
61 | For example, do the following in order to park the heads of drive | ||
62 | /dev/sda and stop all I/O operations for five seconds: | ||
63 | |||
64 | # echo 5000 > /sys/block/sda/device/unload_heads | ||
65 | |||
66 | A simple | ||
67 | |||
68 | # cat /sys/block/sda/device/unload_heads | ||
69 | |||
70 | will show you how many milliseconds are left before normal operation | ||
71 | will be resumed. | ||
72 | |||
73 | A word of caution: The fact that the interface operates on a basis of | ||
74 | milliseconds may raise expectations that cannot be satisfied in | ||
75 | reality. In fact, the ATA specs clearly state that the time for an | ||
76 | unload operation to complete is vendor specific. The hint in ATA-7 | ||
77 | that this will typically be within 500 milliseconds apparently has | ||
78 | been dropped in ATA-8. | ||
79 | |||
80 | There is a technical detail of this implementation that may cause some | ||
81 | confusion and should be discussed here. When a head park request has | ||
82 | been issued to a device successfully, all I/O operations on the | ||
83 | controller port this device is attached to will be deferred. That is | ||
84 | to say, any other device that may be connected to the same port will | ||
85 | be affected too. The only exception is that a subsequent head unload | ||
86 | request to that other device will be executed immediately. Further | ||
87 | operations on that port will be deferred until the timeout specified | ||
88 | for either device on the port has expired. As far as PATA (old style | ||
89 | IDE) configurations are concerned, there can only be two devices | ||
90 | attached to any single port. In SATA world we have port multipliers | ||
91 | which means that a user-issued head parking request to one device may | ||
92 | actually result in stopping I/O to a whole bunch of devices. However, | ||
93 | since this feature is supposed to be used on laptops and does not seem | ||
94 | to be very useful in any other environment, there will be mostly one | ||
95 | device per port. Even if the CD/DVD writer happens to be connected to | ||
96 | the same port as the hard drive, it generally *should* recover just | ||
97 | fine from the occasional buffer under-run incurred by a head park | ||
98 | request to the HD. Actually, when you are using an ide driver rather | ||
99 | than its libata counterpart (i.e. your disk is called /dev/hda | ||
100 | instead of /dev/sda), then parking the heads of one drive (drive X) | ||
101 | will generally not affect the mode of operation of another drive | ||
102 | (drive Y) on the same port as described above. It is only when a port | ||
103 | reset is required to recover from an exception on drive Y that further | ||
104 | I/O operations on that drive (and the reset itself) will be delayed | ||
105 | until drive X is no longer in the parked state. | ||
106 | |||
107 | Finally, there are some hard drives that only comply with an earlier | ||
108 | version of the ATA standard than ATA-7, but do support the unload | ||
109 | feature nonetheless. Unfortunately, there is no safe way Linux can | ||
110 | detect these devices, so you won't be able to write to the | ||
111 | unload_heads attribute. If you know that your device really does | ||
112 | support the unload feature (for instance, because the vendor of your | ||
113 | laptop or the hard drive itself told you so), then you can tell the | ||
114 | kernel to enable the usage of this feature for that drive by writing | ||
115 | the special value -1 to the unload_heads attribute: | ||
116 | |||
117 | # echo -1 > /sys/block/sda/device/unload_heads | ||
118 | |||
119 | will enable the feature for /dev/sda, and giving -2 instead of -1 will | ||
120 | disable it again. | ||
121 | |||
122 | |||
123 | 3. References | ||
124 | ------------- | ||
125 | |||
126 | There are several laptops from different vendors featuring shock | ||
127 | protection capabilities. As manufacturers have refused to support open | ||
128 | source development of the required software components so far, Linux | ||
129 | support for shock protection varies considerably between different | ||
130 | hardware implementations. Ideally, this section should contain a list | ||
131 | of pointers at different projects aiming at an implementation of shock | ||
132 | protection on different systems. Unfortunately, I only know of a | ||
133 | single project which, although still considered experimental, is fit | ||
134 | for use. Please feel free to add projects that have been the victims | ||
135 | of my ignorance. | ||
136 | |||
137 | - http://www.thinkwiki.org/wiki/HDAPS | ||
138 | See this page for information about Linux support of the hard disk | ||
139 | active protection system as implemented in IBM/Lenovo Thinkpads. | ||
140 | |||
141 | |||
142 | 4. CREDITS | ||
143 | ---------- | ||
144 | |||
145 | This implementation of disk head parking has been inspired by a patch | ||
146 | originally published by Jon Escombe <lists@dresco.co.uk>. My efforts | ||
147 | to develop an implementation of this feature that is fit to be merged | ||
148 | into mainline have been aided by various kernel developers, in | ||
149 | particular by Tejun Heo and Bartlomiej Zolnierkiewicz. | ||
diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt index 64b3f146e4b0..71f0fe1fc1b0 100644 --- a/Documentation/laptops/thinkpad-acpi.txt +++ b/Documentation/laptops/thinkpad-acpi.txt | |||
@@ -1,7 +1,7 @@ | |||
1 | ThinkPad ACPI Extras Driver | 1 | ThinkPad ACPI Extras Driver |
2 | 2 | ||
3 | Version 0.20 | 3 | Version 0.21 |
4 | April 09th, 2008 | 4 | May 29th, 2008 |
5 | 5 | ||
6 | Borislav Deianov <borislav@users.sf.net> | 6 | Borislav Deianov <borislav@users.sf.net> |
7 | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 7 | Henrique de Moraes Holschuh <hmh@hmh.eng.br> |
@@ -44,7 +44,7 @@ detailed description): | |||
44 | - LCD brightness control | 44 | - LCD brightness control |
45 | - Volume control | 45 | - Volume control |
46 | - Fan control and monitoring: fan speed, fan enable/disable | 46 | - Fan control and monitoring: fan speed, fan enable/disable |
47 | - Experimental: WAN enable and disable | 47 | - WAN enable and disable |
48 | 48 | ||
49 | A compatibility table by model and feature is maintained on the web | 49 | A compatibility table by model and feature is maintained on the web |
50 | site, http://ibm-acpi.sf.net/. I appreciate any success or failure | 50 | site, http://ibm-acpi.sf.net/. I appreciate any success or failure |
@@ -621,7 +621,8 @@ Bluetooth | |||
621 | --------- | 621 | --------- |
622 | 622 | ||
623 | procfs: /proc/acpi/ibm/bluetooth | 623 | procfs: /proc/acpi/ibm/bluetooth |
624 | sysfs device attribute: bluetooth_enable | 624 | sysfs device attribute: bluetooth_enable (deprecated) |
625 | sysfs rfkill class: switch "tpacpi_bluetooth_sw" | ||
625 | 626 | ||
626 | This feature shows the presence and current state of a ThinkPad | 627 | This feature shows the presence and current state of a ThinkPad |
627 | Bluetooth device in the internal ThinkPad CDC slot. | 628 | Bluetooth device in the internal ThinkPad CDC slot. |
@@ -643,8 +644,12 @@ Sysfs notes: | |||
643 | 0: disables Bluetooth / Bluetooth is disabled | 644 | 0: disables Bluetooth / Bluetooth is disabled |
644 | 1: enables Bluetooth / Bluetooth is enabled. | 645 | 1: enables Bluetooth / Bluetooth is enabled. |
645 | 646 | ||
646 | Note: this interface will be probably be superseded by the | 647 | Note: this interface has been superseded by the generic rfkill |
647 | generic rfkill class, so it is NOT to be considered stable yet. | 648 | class. It has been deprecated, and it will be removed in year |
649 | 2010. | ||
650 | |||
651 | rfkill controller switch "tpacpi_bluetooth_sw": refer to | ||
652 | Documentation/rfkill.txt for details. | ||
648 | 653 | ||
649 | Video output control -- /proc/acpi/ibm/video | 654 | Video output control -- /proc/acpi/ibm/video |
650 | -------------------------------------------- | 655 | -------------------------------------------- |
@@ -1370,16 +1375,12 @@ with EINVAL, try to set pwm1_enable to 1 and pwm1 to at least 128 (255 | |||
1370 | would be the safest choice, though). | 1375 | would be the safest choice, though). |
1371 | 1376 | ||
1372 | 1377 | ||
1373 | EXPERIMENTAL: WAN | 1378 | WAN |
1374 | ----------------- | 1379 | --- |
1375 | 1380 | ||
1376 | procfs: /proc/acpi/ibm/wan | 1381 | procfs: /proc/acpi/ibm/wan |
1377 | sysfs device attribute: wwan_enable | 1382 | sysfs device attribute: wwan_enable (deprecated) |
1378 | 1383 | sysfs rfkill class: switch "tpacpi_wwan_sw" | |
1379 | This feature is marked EXPERIMENTAL because the implementation | ||
1380 | directly accesses hardware registers and may not work as expected. USE | ||
1381 | WITH CAUTION! To use this feature, you need to supply the | ||
1382 | experimental=1 parameter when loading the module. | ||
1383 | 1384 | ||
1384 | This feature shows the presence and current state of a W-WAN (Sierra | 1385 | This feature shows the presence and current state of a W-WAN (Sierra |
1385 | Wireless EV-DO) device. | 1386 | Wireless EV-DO) device. |
@@ -1404,8 +1405,12 @@ Sysfs notes: | |||
1404 | 0: disables WWAN card / WWAN card is disabled | 1405 | 0: disables WWAN card / WWAN card is disabled |
1405 | 1: enables WWAN card / WWAN card is enabled. | 1406 | 1: enables WWAN card / WWAN card is enabled. |
1406 | 1407 | ||
1407 | Note: this interface will be probably be superseded by the | 1408 | Note: this interface has been superseded by the generic rfkill |
1408 | generic rfkill class, so it is NOT to be considered stable yet. | 1409 | class. It has been deprecated, and it will be removed in year |
1410 | 2010. | ||
1411 | |||
1412 | rfkill controller switch "tpacpi_wwan_sw": refer to | ||
1413 | Documentation/rfkill.txt for details. | ||
1409 | 1414 | ||
1410 | Multiple Commands, Module Parameters | 1415 | Multiple Commands, Module Parameters |
1411 | ------------------------------------ | 1416 | ------------------------------------ |
diff --git a/Documentation/leds-class.txt b/Documentation/leds-class.txt index 18860ad9935a..6399557cdab3 100644 --- a/Documentation/leds-class.txt +++ b/Documentation/leds-class.txt | |||
@@ -59,7 +59,7 @@ Hardware accelerated blink of LEDs | |||
59 | 59 | ||
60 | Some LEDs can be programmed to blink without any CPU interaction. To | 60 | Some LEDs can be programmed to blink without any CPU interaction. To |
61 | support this feature, a LED driver can optionally implement the | 61 | support this feature, a LED driver can optionally implement the |
62 | blink_set() function (see <linux/leds.h>). If implemeted, triggers can | 62 | blink_set() function (see <linux/leds.h>). If implemented, triggers can |
63 | attempt to use it before falling back to software timers. The blink_set() | 63 | attempt to use it before falling back to software timers. The blink_set() |
64 | function should return 0 if the blink setting is supported, or -EINVAL | 64 | function should return 0 if the blink setting is supported, or -EINVAL |
65 | otherwise, which means that LED blinking will be handled by software. | 65 | otherwise, which means that LED blinking will be handled by software. |
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c index 82fafe0429fe..7228369d1014 100644 --- a/Documentation/lguest/lguest.c +++ b/Documentation/lguest/lguest.c | |||
@@ -36,11 +36,13 @@ | |||
36 | #include <sched.h> | 36 | #include <sched.h> |
37 | #include <limits.h> | 37 | #include <limits.h> |
38 | #include <stddef.h> | 38 | #include <stddef.h> |
39 | #include <signal.h> | ||
39 | #include "linux/lguest_launcher.h" | 40 | #include "linux/lguest_launcher.h" |
40 | #include "linux/virtio_config.h" | 41 | #include "linux/virtio_config.h" |
41 | #include "linux/virtio_net.h" | 42 | #include "linux/virtio_net.h" |
42 | #include "linux/virtio_blk.h" | 43 | #include "linux/virtio_blk.h" |
43 | #include "linux/virtio_console.h" | 44 | #include "linux/virtio_console.h" |
45 | #include "linux/virtio_rng.h" | ||
44 | #include "linux/virtio_ring.h" | 46 | #include "linux/virtio_ring.h" |
45 | #include "asm-x86/bootparam.h" | 47 | #include "asm-x86/bootparam.h" |
46 | /*L:110 We can ignore the 39 include files we need for this program, but I do | 48 | /*L:110 We can ignore the 39 include files we need for this program, but I do |
@@ -64,8 +66,8 @@ typedef uint8_t u8; | |||
64 | #endif | 66 | #endif |
65 | /* We can have up to 256 pages for devices. */ | 67 | /* We can have up to 256 pages for devices. */ |
66 | #define DEVICE_PAGES 256 | 68 | #define DEVICE_PAGES 256 |
67 | /* This will occupy 2 pages: it must be a power of 2. */ | 69 | /* This will occupy 3 pages: it must be a power of 2. */ |
68 | #define VIRTQUEUE_NUM 128 | 70 | #define VIRTQUEUE_NUM 256 |
69 | 71 | ||
70 | /*L:120 verbose is both a global flag and a macro. The C preprocessor allows | 72 | /*L:120 verbose is both a global flag and a macro. The C preprocessor allows |
71 | * this, and although I wouldn't recommend it, it works quite nicely here. */ | 73 | * this, and although I wouldn't recommend it, it works quite nicely here. */ |
@@ -74,12 +76,19 @@ static bool verbose; | |||
74 | do { if (verbose) printf(args); } while(0) | 76 | do { if (verbose) printf(args); } while(0) |
75 | /*:*/ | 77 | /*:*/ |
76 | 78 | ||
77 | /* The pipe to send commands to the waker process */ | 79 | /* File descriptors for the Waker. */ |
78 | static int waker_fd; | 80 | struct { |
81 | int pipe[2]; | ||
82 | int lguest_fd; | ||
83 | } waker_fds; | ||
84 | |||
79 | /* The pointer to the start of guest memory. */ | 85 | /* The pointer to the start of guest memory. */ |
80 | static void *guest_base; | 86 | static void *guest_base; |
81 | /* The maximum guest physical address allowed, and maximum possible. */ | 87 | /* The maximum guest physical address allowed, and maximum possible. */ |
82 | static unsigned long guest_limit, guest_max; | 88 | static unsigned long guest_limit, guest_max; |
89 | /* The pipe for signal hander to write to. */ | ||
90 | static int timeoutpipe[2]; | ||
91 | static unsigned int timeout_usec = 500; | ||
83 | 92 | ||
84 | /* a per-cpu variable indicating whose vcpu is currently running */ | 93 | /* a per-cpu variable indicating whose vcpu is currently running */ |
85 | static unsigned int __thread cpu_id; | 94 | static unsigned int __thread cpu_id; |
@@ -155,11 +164,14 @@ struct virtqueue | |||
155 | /* Last available index we saw. */ | 164 | /* Last available index we saw. */ |
156 | u16 last_avail_idx; | 165 | u16 last_avail_idx; |
157 | 166 | ||
158 | /* The routine to call when the Guest pings us. */ | 167 | /* The routine to call when the Guest pings us, or timeout. */ |
159 | void (*handle_output)(int fd, struct virtqueue *me); | 168 | void (*handle_output)(int fd, struct virtqueue *me, bool timeout); |
160 | 169 | ||
161 | /* Outstanding buffers */ | 170 | /* Outstanding buffers */ |
162 | unsigned int inflight; | 171 | unsigned int inflight; |
172 | |||
173 | /* Is this blocked awaiting a timer? */ | ||
174 | bool blocked; | ||
163 | }; | 175 | }; |
164 | 176 | ||
165 | /* Remember the arguments to the program so we can "reboot" */ | 177 | /* Remember the arguments to the program so we can "reboot" */ |
@@ -190,6 +202,9 @@ static void *_convert(struct iovec *iov, size_t size, size_t align, | |||
190 | return iov->iov_base; | 202 | return iov->iov_base; |
191 | } | 203 | } |
192 | 204 | ||
205 | /* Wrapper for the last available index. Makes it easier to change. */ | ||
206 | #define lg_last_avail(vq) ((vq)->last_avail_idx) | ||
207 | |||
193 | /* The virtio configuration space is defined to be little-endian. x86 is | 208 | /* The virtio configuration space is defined to be little-endian. x86 is |
194 | * little-endian too, but it's nice to be explicit so we have these helpers. */ | 209 | * little-endian too, but it's nice to be explicit so we have these helpers. */ |
195 | #define cpu_to_le16(v16) (v16) | 210 | #define cpu_to_le16(v16) (v16) |
@@ -199,6 +214,33 @@ static void *_convert(struct iovec *iov, size_t size, size_t align, | |||
199 | #define le32_to_cpu(v32) (v32) | 214 | #define le32_to_cpu(v32) (v32) |
200 | #define le64_to_cpu(v64) (v64) | 215 | #define le64_to_cpu(v64) (v64) |
201 | 216 | ||
217 | /* Is this iovec empty? */ | ||
218 | static bool iov_empty(const struct iovec iov[], unsigned int num_iov) | ||
219 | { | ||
220 | unsigned int i; | ||
221 | |||
222 | for (i = 0; i < num_iov; i++) | ||
223 | if (iov[i].iov_len) | ||
224 | return false; | ||
225 | return true; | ||
226 | } | ||
227 | |||
228 | /* Take len bytes from the front of this iovec. */ | ||
229 | static void iov_consume(struct iovec iov[], unsigned num_iov, unsigned len) | ||
230 | { | ||
231 | unsigned int i; | ||
232 | |||
233 | for (i = 0; i < num_iov; i++) { | ||
234 | unsigned int used; | ||
235 | |||
236 | used = iov[i].iov_len < len ? iov[i].iov_len : len; | ||
237 | iov[i].iov_base += used; | ||
238 | iov[i].iov_len -= used; | ||
239 | len -= used; | ||
240 | } | ||
241 | assert(len == 0); | ||
242 | } | ||
243 | |||
202 | /* The device virtqueue descriptors are followed by feature bitmasks. */ | 244 | /* The device virtqueue descriptors are followed by feature bitmasks. */ |
203 | static u8 *get_feature_bits(struct device *dev) | 245 | static u8 *get_feature_bits(struct device *dev) |
204 | { | 246 | { |
@@ -254,6 +296,7 @@ static void *map_zeroed_pages(unsigned int num) | |||
254 | PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, fd, 0); | 296 | PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, fd, 0); |
255 | if (addr == MAP_FAILED) | 297 | if (addr == MAP_FAILED) |
256 | err(1, "Mmaping %u pages of /dev/zero", num); | 298 | err(1, "Mmaping %u pages of /dev/zero", num); |
299 | close(fd); | ||
257 | 300 | ||
258 | return addr; | 301 | return addr; |
259 | } | 302 | } |
@@ -540,69 +583,64 @@ static void add_device_fd(int fd) | |||
540 | * watch, but handing a file descriptor mask through to the kernel is fairly | 583 | * watch, but handing a file descriptor mask through to the kernel is fairly |
541 | * icky. | 584 | * icky. |
542 | * | 585 | * |
543 | * Instead, we fork off a process which watches the file descriptors and writes | 586 | * Instead, we clone off a thread which watches the file descriptors and writes |
544 | * the LHREQ_BREAK command to the /dev/lguest file descriptor to tell the Host | 587 | * the LHREQ_BREAK command to the /dev/lguest file descriptor to tell the Host |
545 | * stop running the Guest. This causes the Launcher to return from the | 588 | * stop running the Guest. This causes the Launcher to return from the |
546 | * /dev/lguest read with -EAGAIN, where it will write to /dev/lguest to reset | 589 | * /dev/lguest read with -EAGAIN, where it will write to /dev/lguest to reset |
547 | * the LHREQ_BREAK and wake us up again. | 590 | * the LHREQ_BREAK and wake us up again. |
548 | * | 591 | * |
549 | * This, of course, is merely a different *kind* of icky. | 592 | * This, of course, is merely a different *kind* of icky. |
593 | * | ||
594 | * Given my well-known antipathy to threads, I'd prefer to use processes. But | ||
595 | * it's easier to share Guest memory with threads, and trivial to share the | ||
596 | * devices.infds as the Launcher changes it. | ||
550 | */ | 597 | */ |
551 | static void wake_parent(int pipefd, int lguest_fd) | 598 | static int waker(void *unused) |
552 | { | 599 | { |
553 | /* Add the pipe from the Launcher to the fdset in the device_list, so | 600 | /* Close the write end of the pipe: only the Launcher has it open. */ |
554 | * we watch it, too. */ | 601 | close(waker_fds.pipe[1]); |
555 | add_device_fd(pipefd); | ||
556 | 602 | ||
557 | for (;;) { | 603 | for (;;) { |
558 | fd_set rfds = devices.infds; | 604 | fd_set rfds = devices.infds; |
559 | unsigned long args[] = { LHREQ_BREAK, 1 }; | 605 | unsigned long args[] = { LHREQ_BREAK, 1 }; |
606 | unsigned int maxfd = devices.max_infd; | ||
607 | |||
608 | /* We also listen to the pipe from the Launcher. */ | ||
609 | FD_SET(waker_fds.pipe[0], &rfds); | ||
610 | if (waker_fds.pipe[0] > maxfd) | ||
611 | maxfd = waker_fds.pipe[0]; | ||
560 | 612 | ||
561 | /* Wait until input is ready from one of the devices. */ | 613 | /* Wait until input is ready from one of the devices. */ |
562 | select(devices.max_infd+1, &rfds, NULL, NULL, NULL); | 614 | select(maxfd+1, &rfds, NULL, NULL, NULL); |
563 | /* Is it a message from the Launcher? */ | 615 | |
564 | if (FD_ISSET(pipefd, &rfds)) { | 616 | /* Message from Launcher? */ |
565 | int fd; | 617 | if (FD_ISSET(waker_fds.pipe[0], &rfds)) { |
566 | /* If read() returns 0, it means the Launcher has | 618 | char c; |
567 | * exited. We silently follow. */ | 619 | /* If this fails, then assume Launcher has exited. |
568 | if (read(pipefd, &fd, sizeof(fd)) == 0) | 620 | * Don't do anything on exit: we're just a thread! */ |
569 | exit(0); | 621 | if (read(waker_fds.pipe[0], &c, 1) != 1) |
570 | /* Otherwise it's telling us to change what file | 622 | _exit(0); |
571 | * descriptors we're to listen to. Positive means | 623 | continue; |
572 | * listen to a new one, negative means stop | 624 | } |
573 | * listening. */ | 625 | |
574 | if (fd >= 0) | 626 | /* Send LHREQ_BREAK command to snap the Launcher out of it. */ |
575 | FD_SET(fd, &devices.infds); | 627 | pwrite(waker_fds.lguest_fd, args, sizeof(args), cpu_id); |
576 | else | ||
577 | FD_CLR(-fd - 1, &devices.infds); | ||
578 | } else /* Send LHREQ_BREAK command. */ | ||
579 | pwrite(lguest_fd, args, sizeof(args), cpu_id); | ||
580 | } | 628 | } |
629 | return 0; | ||
581 | } | 630 | } |
582 | 631 | ||
583 | /* This routine just sets up a pipe to the Waker process. */ | 632 | /* This routine just sets up a pipe to the Waker process. */ |
584 | static int setup_waker(int lguest_fd) | 633 | static void setup_waker(int lguest_fd) |
585 | { | 634 | { |
586 | int pipefd[2], child; | 635 | /* This pipe is closed when Launcher dies, telling Waker. */ |
587 | 636 | if (pipe(waker_fds.pipe) != 0) | |
588 | /* We create a pipe to talk to the Waker, and also so it knows when the | 637 | err(1, "Creating pipe for Waker"); |
589 | * Launcher dies (and closes pipe). */ | 638 | |
590 | pipe(pipefd); | 639 | /* Waker also needs to know the lguest fd */ |
591 | child = fork(); | 640 | waker_fds.lguest_fd = lguest_fd; |
592 | if (child == -1) | ||
593 | err(1, "forking"); | ||
594 | |||
595 | if (child == 0) { | ||
596 | /* We are the Waker: close the "writing" end of our copy of the | ||
597 | * pipe and start waiting for input. */ | ||
598 | close(pipefd[1]); | ||
599 | wake_parent(pipefd[0], lguest_fd); | ||
600 | } | ||
601 | /* Close the reading end of our copy of the pipe. */ | ||
602 | close(pipefd[0]); | ||
603 | 641 | ||
604 | /* Here is the fd used to talk to the waker. */ | 642 | if (clone(waker, malloc(4096) + 4096, CLONE_VM | SIGCHLD, NULL) == -1) |
605 | return pipefd[1]; | 643 | err(1, "Creating Waker"); |
606 | } | 644 | } |
607 | 645 | ||
608 | /* | 646 | /* |
@@ -661,19 +699,22 @@ static unsigned get_vq_desc(struct virtqueue *vq, | |||
661 | unsigned int *out_num, unsigned int *in_num) | 699 | unsigned int *out_num, unsigned int *in_num) |
662 | { | 700 | { |
663 | unsigned int i, head; | 701 | unsigned int i, head; |
702 | u16 last_avail; | ||
664 | 703 | ||
665 | /* Check it isn't doing very strange things with descriptor numbers. */ | 704 | /* Check it isn't doing very strange things with descriptor numbers. */ |
666 | if ((u16)(vq->vring.avail->idx - vq->last_avail_idx) > vq->vring.num) | 705 | last_avail = lg_last_avail(vq); |
706 | if ((u16)(vq->vring.avail->idx - last_avail) > vq->vring.num) | ||
667 | errx(1, "Guest moved used index from %u to %u", | 707 | errx(1, "Guest moved used index from %u to %u", |
668 | vq->last_avail_idx, vq->vring.avail->idx); | 708 | last_avail, vq->vring.avail->idx); |
669 | 709 | ||
670 | /* If there's nothing new since last we looked, return invalid. */ | 710 | /* If there's nothing new since last we looked, return invalid. */ |
671 | if (vq->vring.avail->idx == vq->last_avail_idx) | 711 | if (vq->vring.avail->idx == last_avail) |
672 | return vq->vring.num; | 712 | return vq->vring.num; |
673 | 713 | ||
674 | /* Grab the next descriptor number they're advertising, and increment | 714 | /* Grab the next descriptor number they're advertising, and increment |
675 | * the index we've seen. */ | 715 | * the index we've seen. */ |
676 | head = vq->vring.avail->ring[vq->last_avail_idx++ % vq->vring.num]; | 716 | head = vq->vring.avail->ring[last_avail % vq->vring.num]; |
717 | lg_last_avail(vq)++; | ||
677 | 718 | ||
678 | /* If their number is silly, that's a fatal mistake. */ | 719 | /* If their number is silly, that's a fatal mistake. */ |
679 | if (head >= vq->vring.num) | 720 | if (head >= vq->vring.num) |
@@ -821,8 +862,8 @@ static bool handle_console_input(int fd, struct device *dev) | |||
821 | unsigned long args[] = { LHREQ_BREAK, 0 }; | 862 | unsigned long args[] = { LHREQ_BREAK, 0 }; |
822 | /* Close the fd so Waker will know it has to | 863 | /* Close the fd so Waker will know it has to |
823 | * exit. */ | 864 | * exit. */ |
824 | close(waker_fd); | 865 | close(waker_fds.pipe[1]); |
825 | /* Just in case waker is blocked in BREAK, send | 866 | /* Just in case Waker is blocked in BREAK, send |
826 | * unbreak now. */ | 867 | * unbreak now. */ |
827 | write(fd, args, sizeof(args)); | 868 | write(fd, args, sizeof(args)); |
828 | exit(2); | 869 | exit(2); |
@@ -839,7 +880,7 @@ static bool handle_console_input(int fd, struct device *dev) | |||
839 | 880 | ||
840 | /* Handling output for console is simple: we just get all the output buffers | 881 | /* Handling output for console is simple: we just get all the output buffers |
841 | * and write them to stdout. */ | 882 | * and write them to stdout. */ |
842 | static void handle_console_output(int fd, struct virtqueue *vq) | 883 | static void handle_console_output(int fd, struct virtqueue *vq, bool timeout) |
843 | { | 884 | { |
844 | unsigned int head, out, in; | 885 | unsigned int head, out, in; |
845 | int len; | 886 | int len; |
@@ -854,6 +895,24 @@ static void handle_console_output(int fd, struct virtqueue *vq) | |||
854 | } | 895 | } |
855 | } | 896 | } |
856 | 897 | ||
898 | /* This is called when we no longer want to hear about Guest changes to a | ||
899 | * virtqueue. This is more efficient in high-traffic cases, but it means we | ||
900 | * have to set a timer to check if any more changes have occurred. */ | ||
901 | static void block_vq(struct virtqueue *vq) | ||
902 | { | ||
903 | struct itimerval itm; | ||
904 | |||
905 | vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY; | ||
906 | vq->blocked = true; | ||
907 | |||
908 | itm.it_interval.tv_sec = 0; | ||
909 | itm.it_interval.tv_usec = 0; | ||
910 | itm.it_value.tv_sec = 0; | ||
911 | itm.it_value.tv_usec = timeout_usec; | ||
912 | |||
913 | setitimer(ITIMER_REAL, &itm, NULL); | ||
914 | } | ||
915 | |||
857 | /* | 916 | /* |
858 | * The Network | 917 | * The Network |
859 | * | 918 | * |
@@ -861,22 +920,39 @@ static void handle_console_output(int fd, struct virtqueue *vq) | |||
861 | * and write them (ignoring the first element) to this device's file descriptor | 920 | * and write them (ignoring the first element) to this device's file descriptor |
862 | * (/dev/net/tun). | 921 | * (/dev/net/tun). |
863 | */ | 922 | */ |
864 | static void handle_net_output(int fd, struct virtqueue *vq) | 923 | static void handle_net_output(int fd, struct virtqueue *vq, bool timeout) |
865 | { | 924 | { |
866 | unsigned int head, out, in; | 925 | unsigned int head, out, in, num = 0; |
867 | int len; | 926 | int len; |
868 | struct iovec iov[vq->vring.num]; | 927 | struct iovec iov[vq->vring.num]; |
928 | static int last_timeout_num; | ||
869 | 929 | ||
870 | /* Keep getting output buffers from the Guest until we run out. */ | 930 | /* Keep getting output buffers from the Guest until we run out. */ |
871 | while ((head = get_vq_desc(vq, iov, &out, &in)) != vq->vring.num) { | 931 | while ((head = get_vq_desc(vq, iov, &out, &in)) != vq->vring.num) { |
872 | if (in) | 932 | if (in) |
873 | errx(1, "Input buffers in output queue?"); | 933 | errx(1, "Input buffers in output queue?"); |
874 | /* Check header, but otherwise ignore it (we told the Guest we | 934 | len = writev(vq->dev->fd, iov, out); |
875 | * supported no features, so it shouldn't have anything | 935 | if (len < 0) |
876 | * interesting). */ | 936 | err(1, "Writing network packet to tun"); |
877 | (void)convert(&iov[0], struct virtio_net_hdr); | ||
878 | len = writev(vq->dev->fd, iov+1, out-1); | ||
879 | add_used_and_trigger(fd, vq, head, len); | 937 | add_used_and_trigger(fd, vq, head, len); |
938 | num++; | ||
939 | } | ||
940 | |||
941 | /* Block further kicks and set up a timer if we saw anything. */ | ||
942 | if (!timeout && num) | ||
943 | block_vq(vq); | ||
944 | |||
945 | /* We never quite know how long should we wait before we check the | ||
946 | * queue again for more packets. We start at 500 microseconds, and if | ||
947 | * we get fewer packets than last time, we assume we made the timeout | ||
948 | * too small and increase it by 10 microseconds. Otherwise, we drop it | ||
949 | * by one microsecond every time. It seems to work well enough. */ | ||
950 | if (timeout) { | ||
951 | if (num < last_timeout_num) | ||
952 | timeout_usec += 10; | ||
953 | else if (timeout_usec > 1) | ||
954 | timeout_usec--; | ||
955 | last_timeout_num = num; | ||
880 | } | 956 | } |
881 | } | 957 | } |
882 | 958 | ||
@@ -887,7 +963,6 @@ static bool handle_tun_input(int fd, struct device *dev) | |||
887 | unsigned int head, in_num, out_num; | 963 | unsigned int head, in_num, out_num; |
888 | int len; | 964 | int len; |
889 | struct iovec iov[dev->vq->vring.num]; | 965 | struct iovec iov[dev->vq->vring.num]; |
890 | struct virtio_net_hdr *hdr; | ||
891 | 966 | ||
892 | /* First we need a network buffer from the Guests's recv virtqueue. */ | 967 | /* First we need a network buffer from the Guests's recv virtqueue. */ |
893 | head = get_vq_desc(dev->vq, iov, &out_num, &in_num); | 968 | head = get_vq_desc(dev->vq, iov, &out_num, &in_num); |
@@ -896,25 +971,23 @@ static bool handle_tun_input(int fd, struct device *dev) | |||
896 | * early, the Guest won't be ready yet. Wait until the device | 971 | * early, the Guest won't be ready yet. Wait until the device |
897 | * status says it's ready. */ | 972 | * status says it's ready. */ |
898 | /* FIXME: Actually want DRIVER_ACTIVE here. */ | 973 | /* FIXME: Actually want DRIVER_ACTIVE here. */ |
899 | if (dev->desc->status & VIRTIO_CONFIG_S_DRIVER_OK) | 974 | |
900 | warn("network: no dma buffer!"); | 975 | /* Now tell it we want to know if new things appear. */ |
976 | dev->vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY; | ||
977 | wmb(); | ||
978 | |||
901 | /* We'll turn this back on if input buffers are registered. */ | 979 | /* We'll turn this back on if input buffers are registered. */ |
902 | return false; | 980 | return false; |
903 | } else if (out_num) | 981 | } else if (out_num) |
904 | errx(1, "Output buffers in network recv queue?"); | 982 | errx(1, "Output buffers in network recv queue?"); |
905 | 983 | ||
906 | /* First element is the header: we set it to 0 (no features). */ | ||
907 | hdr = convert(&iov[0], struct virtio_net_hdr); | ||
908 | hdr->flags = 0; | ||
909 | hdr->gso_type = VIRTIO_NET_HDR_GSO_NONE; | ||
910 | |||
911 | /* Read the packet from the device directly into the Guest's buffer. */ | 984 | /* Read the packet from the device directly into the Guest's buffer. */ |
912 | len = readv(dev->fd, iov+1, in_num-1); | 985 | len = readv(dev->fd, iov, in_num); |
913 | if (len <= 0) | 986 | if (len <= 0) |
914 | err(1, "reading network"); | 987 | err(1, "reading network"); |
915 | 988 | ||
916 | /* Tell the Guest about the new packet. */ | 989 | /* Tell the Guest about the new packet. */ |
917 | add_used_and_trigger(fd, dev->vq, head, sizeof(*hdr) + len); | 990 | add_used_and_trigger(fd, dev->vq, head, len); |
918 | 991 | ||
919 | verbose("tun input packet len %i [%02x %02x] (%s)\n", len, | 992 | verbose("tun input packet len %i [%02x %02x] (%s)\n", len, |
920 | ((u8 *)iov[1].iov_base)[0], ((u8 *)iov[1].iov_base)[1], | 993 | ((u8 *)iov[1].iov_base)[0], ((u8 *)iov[1].iov_base)[1], |
@@ -927,11 +1000,18 @@ static bool handle_tun_input(int fd, struct device *dev) | |||
927 | /*L:215 This is the callback attached to the network and console input | 1000 | /*L:215 This is the callback attached to the network and console input |
928 | * virtqueues: it ensures we try again, in case we stopped console or net | 1001 | * virtqueues: it ensures we try again, in case we stopped console or net |
929 | * delivery because Guest didn't have any buffers. */ | 1002 | * delivery because Guest didn't have any buffers. */ |
930 | static void enable_fd(int fd, struct virtqueue *vq) | 1003 | static void enable_fd(int fd, struct virtqueue *vq, bool timeout) |
931 | { | 1004 | { |
932 | add_device_fd(vq->dev->fd); | 1005 | add_device_fd(vq->dev->fd); |
933 | /* Tell waker to listen to it again */ | 1006 | /* Snap the Waker out of its select loop. */ |
934 | write(waker_fd, &vq->dev->fd, sizeof(vq->dev->fd)); | 1007 | write(waker_fds.pipe[1], "", 1); |
1008 | } | ||
1009 | |||
1010 | static void net_enable_fd(int fd, struct virtqueue *vq, bool timeout) | ||
1011 | { | ||
1012 | /* We don't need to know again when Guest refills receive buffer. */ | ||
1013 | vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY; | ||
1014 | enable_fd(fd, vq, timeout); | ||
935 | } | 1015 | } |
936 | 1016 | ||
937 | /* When the Guest tells us they updated the status field, we handle it. */ | 1017 | /* When the Guest tells us they updated the status field, we handle it. */ |
@@ -951,7 +1031,7 @@ static void update_device_status(struct device *dev) | |||
951 | for (vq = dev->vq; vq; vq = vq->next) { | 1031 | for (vq = dev->vq; vq; vq = vq->next) { |
952 | memset(vq->vring.desc, 0, | 1032 | memset(vq->vring.desc, 0, |
953 | vring_size(vq->config.num, getpagesize())); | 1033 | vring_size(vq->config.num, getpagesize())); |
954 | vq->last_avail_idx = 0; | 1034 | lg_last_avail(vq) = 0; |
955 | } | 1035 | } |
956 | } else if (dev->desc->status & VIRTIO_CONFIG_S_FAILED) { | 1036 | } else if (dev->desc->status & VIRTIO_CONFIG_S_FAILED) { |
957 | warnx("Device %s configuration FAILED", dev->name); | 1037 | warnx("Device %s configuration FAILED", dev->name); |
@@ -960,10 +1040,10 @@ static void update_device_status(struct device *dev) | |||
960 | 1040 | ||
961 | verbose("Device %s OK: offered", dev->name); | 1041 | verbose("Device %s OK: offered", dev->name); |
962 | for (i = 0; i < dev->desc->feature_len; i++) | 1042 | for (i = 0; i < dev->desc->feature_len; i++) |
963 | verbose(" %08x", get_feature_bits(dev)[i]); | 1043 | verbose(" %02x", get_feature_bits(dev)[i]); |
964 | verbose(", accepted"); | 1044 | verbose(", accepted"); |
965 | for (i = 0; i < dev->desc->feature_len; i++) | 1045 | for (i = 0; i < dev->desc->feature_len; i++) |
966 | verbose(" %08x", get_feature_bits(dev) | 1046 | verbose(" %02x", get_feature_bits(dev) |
967 | [dev->desc->feature_len+i]); | 1047 | [dev->desc->feature_len+i]); |
968 | 1048 | ||
969 | if (dev->ready) | 1049 | if (dev->ready) |
@@ -1000,7 +1080,7 @@ static void handle_output(int fd, unsigned long addr) | |||
1000 | if (strcmp(vq->dev->name, "console") != 0) | 1080 | if (strcmp(vq->dev->name, "console") != 0) |
1001 | verbose("Output to %s\n", vq->dev->name); | 1081 | verbose("Output to %s\n", vq->dev->name); |
1002 | if (vq->handle_output) | 1082 | if (vq->handle_output) |
1003 | vq->handle_output(fd, vq); | 1083 | vq->handle_output(fd, vq, false); |
1004 | return; | 1084 | return; |
1005 | } | 1085 | } |
1006 | } | 1086 | } |
@@ -1014,6 +1094,29 @@ static void handle_output(int fd, unsigned long addr) | |||
1014 | strnlen(from_guest_phys(addr), guest_limit - addr)); | 1094 | strnlen(from_guest_phys(addr), guest_limit - addr)); |
1015 | } | 1095 | } |
1016 | 1096 | ||
1097 | static void handle_timeout(int fd) | ||
1098 | { | ||
1099 | char buf[32]; | ||
1100 | struct device *i; | ||
1101 | struct virtqueue *vq; | ||
1102 | |||
1103 | /* Clear the pipe */ | ||
1104 | read(timeoutpipe[0], buf, sizeof(buf)); | ||
1105 | |||
1106 | /* Check each device and virtqueue: flush blocked ones. */ | ||
1107 | for (i = devices.dev; i; i = i->next) { | ||
1108 | for (vq = i->vq; vq; vq = vq->next) { | ||
1109 | if (!vq->blocked) | ||
1110 | continue; | ||
1111 | |||
1112 | vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY; | ||
1113 | vq->blocked = false; | ||
1114 | if (vq->handle_output) | ||
1115 | vq->handle_output(fd, vq, true); | ||
1116 | } | ||
1117 | } | ||
1118 | } | ||
1119 | |||
1017 | /* This is called when the Waker wakes us up: check for incoming file | 1120 | /* This is called when the Waker wakes us up: check for incoming file |
1018 | * descriptors. */ | 1121 | * descriptors. */ |
1019 | static void handle_input(int fd) | 1122 | static void handle_input(int fd) |
@@ -1024,16 +1127,20 @@ static void handle_input(int fd) | |||
1024 | for (;;) { | 1127 | for (;;) { |
1025 | struct device *i; | 1128 | struct device *i; |
1026 | fd_set fds = devices.infds; | 1129 | fd_set fds = devices.infds; |
1130 | int num; | ||
1027 | 1131 | ||
1132 | num = select(devices.max_infd+1, &fds, NULL, NULL, &poll); | ||
1133 | /* Could get interrupted */ | ||
1134 | if (num < 0) | ||
1135 | continue; | ||
1028 | /* If nothing is ready, we're done. */ | 1136 | /* If nothing is ready, we're done. */ |
1029 | if (select(devices.max_infd+1, &fds, NULL, NULL, &poll) == 0) | 1137 | if (num == 0) |
1030 | break; | 1138 | break; |
1031 | 1139 | ||
1032 | /* Otherwise, call the device(s) which have readable file | 1140 | /* Otherwise, call the device(s) which have readable file |
1033 | * descriptors and a method of handling them. */ | 1141 | * descriptors and a method of handling them. */ |
1034 | for (i = devices.dev; i; i = i->next) { | 1142 | for (i = devices.dev; i; i = i->next) { |
1035 | if (i->handle_input && FD_ISSET(i->fd, &fds)) { | 1143 | if (i->handle_input && FD_ISSET(i->fd, &fds)) { |
1036 | int dev_fd; | ||
1037 | if (i->handle_input(fd, i)) | 1144 | if (i->handle_input(fd, i)) |
1038 | continue; | 1145 | continue; |
1039 | 1146 | ||
@@ -1043,13 +1150,12 @@ static void handle_input(int fd) | |||
1043 | * buffers to deliver into. Console also uses | 1150 | * buffers to deliver into. Console also uses |
1044 | * it when it discovers that stdin is closed. */ | 1151 | * it when it discovers that stdin is closed. */ |
1045 | FD_CLR(i->fd, &devices.infds); | 1152 | FD_CLR(i->fd, &devices.infds); |
1046 | /* Tell waker to ignore it too, by sending a | ||
1047 | * negative fd number (-1, since 0 is a valid | ||
1048 | * FD number). */ | ||
1049 | dev_fd = -i->fd - 1; | ||
1050 | write(waker_fd, &dev_fd, sizeof(dev_fd)); | ||
1051 | } | 1153 | } |
1052 | } | 1154 | } |
1155 | |||
1156 | /* Is this the timeout fd? */ | ||
1157 | if (FD_ISSET(timeoutpipe[0], &fds)) | ||
1158 | handle_timeout(fd); | ||
1053 | } | 1159 | } |
1054 | } | 1160 | } |
1055 | 1161 | ||
@@ -1098,7 +1204,7 @@ static struct lguest_device_desc *new_dev_desc(u16 type) | |||
1098 | /* Each device descriptor is followed by the description of its virtqueues. We | 1204 | /* Each device descriptor is followed by the description of its virtqueues. We |
1099 | * specify how many descriptors the virtqueue is to have. */ | 1205 | * specify how many descriptors the virtqueue is to have. */ |
1100 | static void add_virtqueue(struct device *dev, unsigned int num_descs, | 1206 | static void add_virtqueue(struct device *dev, unsigned int num_descs, |
1101 | void (*handle_output)(int fd, struct virtqueue *me)) | 1207 | void (*handle_output)(int, struct virtqueue *, bool)) |
1102 | { | 1208 | { |
1103 | unsigned int pages; | 1209 | unsigned int pages; |
1104 | struct virtqueue **i, *vq = malloc(sizeof(*vq)); | 1210 | struct virtqueue **i, *vq = malloc(sizeof(*vq)); |
@@ -1114,6 +1220,7 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs, | |||
1114 | vq->last_avail_idx = 0; | 1220 | vq->last_avail_idx = 0; |
1115 | vq->dev = dev; | 1221 | vq->dev = dev; |
1116 | vq->inflight = 0; | 1222 | vq->inflight = 0; |
1223 | vq->blocked = false; | ||
1117 | 1224 | ||
1118 | /* Initialize the configuration. */ | 1225 | /* Initialize the configuration. */ |
1119 | vq->config.num = num_descs; | 1226 | vq->config.num = num_descs; |
@@ -1246,6 +1353,24 @@ static void setup_console(void) | |||
1246 | } | 1353 | } |
1247 | /*:*/ | 1354 | /*:*/ |
1248 | 1355 | ||
1356 | static void timeout_alarm(int sig) | ||
1357 | { | ||
1358 | write(timeoutpipe[1], "", 1); | ||
1359 | } | ||
1360 | |||
1361 | static void setup_timeout(void) | ||
1362 | { | ||
1363 | if (pipe(timeoutpipe) != 0) | ||
1364 | err(1, "Creating timeout pipe"); | ||
1365 | |||
1366 | if (fcntl(timeoutpipe[1], F_SETFL, | ||
1367 | fcntl(timeoutpipe[1], F_GETFL) | O_NONBLOCK) != 0) | ||
1368 | err(1, "Making timeout pipe nonblocking"); | ||
1369 | |||
1370 | add_device_fd(timeoutpipe[0]); | ||
1371 | signal(SIGALRM, timeout_alarm); | ||
1372 | } | ||
1373 | |||
1249 | /*M:010 Inter-guest networking is an interesting area. Simplest is to have a | 1374 | /*M:010 Inter-guest networking is an interesting area. Simplest is to have a |
1250 | * --sharenet=<name> option which opens or creates a named pipe. This can be | 1375 | * --sharenet=<name> option which opens or creates a named pipe. This can be |
1251 | * used to send packets to another guest in a 1:1 manner. | 1376 | * used to send packets to another guest in a 1:1 manner. |
@@ -1264,10 +1389,25 @@ static void setup_console(void) | |||
1264 | 1389 | ||
1265 | static u32 str2ip(const char *ipaddr) | 1390 | static u32 str2ip(const char *ipaddr) |
1266 | { | 1391 | { |
1267 | unsigned int byte[4]; | 1392 | unsigned int b[4]; |
1393 | |||
1394 | if (sscanf(ipaddr, "%u.%u.%u.%u", &b[0], &b[1], &b[2], &b[3]) != 4) | ||
1395 | errx(1, "Failed to parse IP address '%s'", ipaddr); | ||
1396 | return (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3]; | ||
1397 | } | ||
1268 | 1398 | ||
1269 | sscanf(ipaddr, "%u.%u.%u.%u", &byte[0], &byte[1], &byte[2], &byte[3]); | 1399 | static void str2mac(const char *macaddr, unsigned char mac[6]) |
1270 | return (byte[0] << 24) | (byte[1] << 16) | (byte[2] << 8) | byte[3]; | 1400 | { |
1401 | unsigned int m[6]; | ||
1402 | if (sscanf(macaddr, "%02x:%02x:%02x:%02x:%02x:%02x", | ||
1403 | &m[0], &m[1], &m[2], &m[3], &m[4], &m[5]) != 6) | ||
1404 | errx(1, "Failed to parse mac address '%s'", macaddr); | ||
1405 | mac[0] = m[0]; | ||
1406 | mac[1] = m[1]; | ||
1407 | mac[2] = m[2]; | ||
1408 | mac[3] = m[3]; | ||
1409 | mac[4] = m[4]; | ||
1410 | mac[5] = m[5]; | ||
1271 | } | 1411 | } |
1272 | 1412 | ||
1273 | /* This code is "adapted" from libbridge: it attaches the Host end of the | 1413 | /* This code is "adapted" from libbridge: it attaches the Host end of the |
@@ -1288,6 +1428,7 @@ static void add_to_bridge(int fd, const char *if_name, const char *br_name) | |||
1288 | errx(1, "interface %s does not exist!", if_name); | 1428 | errx(1, "interface %s does not exist!", if_name); |
1289 | 1429 | ||
1290 | strncpy(ifr.ifr_name, br_name, IFNAMSIZ); | 1430 | strncpy(ifr.ifr_name, br_name, IFNAMSIZ); |
1431 | ifr.ifr_name[IFNAMSIZ-1] = '\0'; | ||
1291 | ifr.ifr_ifindex = ifidx; | 1432 | ifr.ifr_ifindex = ifidx; |
1292 | if (ioctl(fd, SIOCBRADDIF, &ifr) < 0) | 1433 | if (ioctl(fd, SIOCBRADDIF, &ifr) < 0) |
1293 | err(1, "can't add %s to bridge %s", if_name, br_name); | 1434 | err(1, "can't add %s to bridge %s", if_name, br_name); |
@@ -1296,64 +1437,75 @@ static void add_to_bridge(int fd, const char *if_name, const char *br_name) | |||
1296 | /* This sets up the Host end of the network device with an IP address, brings | 1437 | /* This sets up the Host end of the network device with an IP address, brings |
1297 | * it up so packets will flow, the copies the MAC address into the hwaddr | 1438 | * it up so packets will flow, the copies the MAC address into the hwaddr |
1298 | * pointer. */ | 1439 | * pointer. */ |
1299 | static void configure_device(int fd, const char *devname, u32 ipaddr, | 1440 | static void configure_device(int fd, const char *tapif, u32 ipaddr) |
1300 | unsigned char hwaddr[6]) | ||
1301 | { | 1441 | { |
1302 | struct ifreq ifr; | 1442 | struct ifreq ifr; |
1303 | struct sockaddr_in *sin = (struct sockaddr_in *)&ifr.ifr_addr; | 1443 | struct sockaddr_in *sin = (struct sockaddr_in *)&ifr.ifr_addr; |
1304 | 1444 | ||
1305 | /* Don't read these incantations. Just cut & paste them like I did! */ | ||
1306 | memset(&ifr, 0, sizeof(ifr)); | 1445 | memset(&ifr, 0, sizeof(ifr)); |
1307 | strcpy(ifr.ifr_name, devname); | 1446 | strcpy(ifr.ifr_name, tapif); |
1447 | |||
1448 | /* Don't read these incantations. Just cut & paste them like I did! */ | ||
1308 | sin->sin_family = AF_INET; | 1449 | sin->sin_family = AF_INET; |
1309 | sin->sin_addr.s_addr = htonl(ipaddr); | 1450 | sin->sin_addr.s_addr = htonl(ipaddr); |
1310 | if (ioctl(fd, SIOCSIFADDR, &ifr) != 0) | 1451 | if (ioctl(fd, SIOCSIFADDR, &ifr) != 0) |
1311 | err(1, "Setting %s interface address", devname); | 1452 | err(1, "Setting %s interface address", tapif); |
1312 | ifr.ifr_flags = IFF_UP; | 1453 | ifr.ifr_flags = IFF_UP; |
1313 | if (ioctl(fd, SIOCSIFFLAGS, &ifr) != 0) | 1454 | if (ioctl(fd, SIOCSIFFLAGS, &ifr) != 0) |
1314 | err(1, "Bringing interface %s up", devname); | 1455 | err(1, "Bringing interface %s up", tapif); |
1315 | |||
1316 | /* SIOC stands for Socket I/O Control. G means Get (vs S for Set | ||
1317 | * above). IF means Interface, and HWADDR is hardware address. | ||
1318 | * Simple! */ | ||
1319 | if (ioctl(fd, SIOCGIFHWADDR, &ifr) != 0) | ||
1320 | err(1, "getting hw address for %s", devname); | ||
1321 | memcpy(hwaddr, ifr.ifr_hwaddr.sa_data, 6); | ||
1322 | } | 1456 | } |
1323 | 1457 | ||
1324 | /*L:195 Our network is a Host<->Guest network. This can either use bridging or | 1458 | static int get_tun_device(char tapif[IFNAMSIZ]) |
1325 | * routing, but the principle is the same: it uses the "tun" device to inject | ||
1326 | * packets into the Host as if they came in from a normal network card. We | ||
1327 | * just shunt packets between the Guest and the tun device. */ | ||
1328 | static void setup_tun_net(const char *arg) | ||
1329 | { | 1459 | { |
1330 | struct device *dev; | ||
1331 | struct ifreq ifr; | 1460 | struct ifreq ifr; |
1332 | int netfd, ipfd; | 1461 | int netfd; |
1333 | u32 ip; | 1462 | |
1334 | const char *br_name = NULL; | 1463 | /* Start with this zeroed. Messy but sure. */ |
1335 | struct virtio_net_config conf; | 1464 | memset(&ifr, 0, sizeof(ifr)); |
1336 | 1465 | ||
1337 | /* We open the /dev/net/tun device and tell it we want a tap device. A | 1466 | /* We open the /dev/net/tun device and tell it we want a tap device. A |
1338 | * tap device is like a tun device, only somehow different. To tell | 1467 | * tap device is like a tun device, only somehow different. To tell |
1339 | * the truth, I completely blundered my way through this code, but it | 1468 | * the truth, I completely blundered my way through this code, but it |
1340 | * works now! */ | 1469 | * works now! */ |
1341 | netfd = open_or_die("/dev/net/tun", O_RDWR); | 1470 | netfd = open_or_die("/dev/net/tun", O_RDWR); |
1342 | memset(&ifr, 0, sizeof(ifr)); | 1471 | ifr.ifr_flags = IFF_TAP | IFF_NO_PI | IFF_VNET_HDR; |
1343 | ifr.ifr_flags = IFF_TAP | IFF_NO_PI; | ||
1344 | strcpy(ifr.ifr_name, "tap%d"); | 1472 | strcpy(ifr.ifr_name, "tap%d"); |
1345 | if (ioctl(netfd, TUNSETIFF, &ifr) != 0) | 1473 | if (ioctl(netfd, TUNSETIFF, &ifr) != 0) |
1346 | err(1, "configuring /dev/net/tun"); | 1474 | err(1, "configuring /dev/net/tun"); |
1475 | |||
1476 | if (ioctl(netfd, TUNSETOFFLOAD, | ||
1477 | TUN_F_CSUM|TUN_F_TSO4|TUN_F_TSO6|TUN_F_TSO_ECN) != 0) | ||
1478 | err(1, "Could not set features for tun device"); | ||
1479 | |||
1347 | /* We don't need checksums calculated for packets coming in this | 1480 | /* We don't need checksums calculated for packets coming in this |
1348 | * device: trust us! */ | 1481 | * device: trust us! */ |
1349 | ioctl(netfd, TUNSETNOCSUM, 1); | 1482 | ioctl(netfd, TUNSETNOCSUM, 1); |
1350 | 1483 | ||
1484 | memcpy(tapif, ifr.ifr_name, IFNAMSIZ); | ||
1485 | return netfd; | ||
1486 | } | ||
1487 | |||
1488 | /*L:195 Our network is a Host<->Guest network. This can either use bridging or | ||
1489 | * routing, but the principle is the same: it uses the "tun" device to inject | ||
1490 | * packets into the Host as if they came in from a normal network card. We | ||
1491 | * just shunt packets between the Guest and the tun device. */ | ||
1492 | static void setup_tun_net(char *arg) | ||
1493 | { | ||
1494 | struct device *dev; | ||
1495 | int netfd, ipfd; | ||
1496 | u32 ip = INADDR_ANY; | ||
1497 | bool bridging = false; | ||
1498 | char tapif[IFNAMSIZ], *p; | ||
1499 | struct virtio_net_config conf; | ||
1500 | |||
1501 | netfd = get_tun_device(tapif); | ||
1502 | |||
1351 | /* First we create a new network device. */ | 1503 | /* First we create a new network device. */ |
1352 | dev = new_device("net", VIRTIO_ID_NET, netfd, handle_tun_input); | 1504 | dev = new_device("net", VIRTIO_ID_NET, netfd, handle_tun_input); |
1353 | 1505 | ||
1354 | /* Network devices need a receive and a send queue, just like | 1506 | /* Network devices need a receive and a send queue, just like |
1355 | * console. */ | 1507 | * console. */ |
1356 | add_virtqueue(dev, VIRTQUEUE_NUM, enable_fd); | 1508 | add_virtqueue(dev, VIRTQUEUE_NUM, net_enable_fd); |
1357 | add_virtqueue(dev, VIRTQUEUE_NUM, handle_net_output); | 1509 | add_virtqueue(dev, VIRTQUEUE_NUM, handle_net_output); |
1358 | 1510 | ||
1359 | /* We need a socket to perform the magic network ioctls to bring up the | 1511 | /* We need a socket to perform the magic network ioctls to bring up the |
@@ -1364,28 +1516,50 @@ static void setup_tun_net(const char *arg) | |||
1364 | 1516 | ||
1365 | /* If the command line was --tunnet=bridge:<name> do bridging. */ | 1517 | /* If the command line was --tunnet=bridge:<name> do bridging. */ |
1366 | if (!strncmp(BRIDGE_PFX, arg, strlen(BRIDGE_PFX))) { | 1518 | if (!strncmp(BRIDGE_PFX, arg, strlen(BRIDGE_PFX))) { |
1367 | ip = INADDR_ANY; | 1519 | arg += strlen(BRIDGE_PFX); |
1368 | br_name = arg + strlen(BRIDGE_PFX); | 1520 | bridging = true; |
1369 | add_to_bridge(ipfd, ifr.ifr_name, br_name); | 1521 | } |
1370 | } else /* It is an IP address to set up the device with */ | 1522 | |
1523 | /* A mac address may follow the bridge name or IP address */ | ||
1524 | p = strchr(arg, ':'); | ||
1525 | if (p) { | ||
1526 | str2mac(p+1, conf.mac); | ||
1527 | add_feature(dev, VIRTIO_NET_F_MAC); | ||
1528 | *p = '\0'; | ||
1529 | } | ||
1530 | |||
1531 | /* arg is now either an IP address or a bridge name */ | ||
1532 | if (bridging) | ||
1533 | add_to_bridge(ipfd, tapif, arg); | ||
1534 | else | ||
1371 | ip = str2ip(arg); | 1535 | ip = str2ip(arg); |
1372 | 1536 | ||
1373 | /* Set up the tun device, and get the mac address for the interface. */ | 1537 | /* Set up the tun device. */ |
1374 | configure_device(ipfd, ifr.ifr_name, ip, conf.mac); | 1538 | configure_device(ipfd, tapif, ip); |
1375 | 1539 | ||
1376 | /* Tell Guest what MAC address to use. */ | ||
1377 | add_feature(dev, VIRTIO_NET_F_MAC); | ||
1378 | add_feature(dev, VIRTIO_F_NOTIFY_ON_EMPTY); | 1540 | add_feature(dev, VIRTIO_F_NOTIFY_ON_EMPTY); |
1541 | /* Expect Guest to handle everything except UFO */ | ||
1542 | add_feature(dev, VIRTIO_NET_F_CSUM); | ||
1543 | add_feature(dev, VIRTIO_NET_F_GUEST_CSUM); | ||
1544 | add_feature(dev, VIRTIO_NET_F_GUEST_TSO4); | ||
1545 | add_feature(dev, VIRTIO_NET_F_GUEST_TSO6); | ||
1546 | add_feature(dev, VIRTIO_NET_F_GUEST_ECN); | ||
1547 | add_feature(dev, VIRTIO_NET_F_HOST_TSO4); | ||
1548 | add_feature(dev, VIRTIO_NET_F_HOST_TSO6); | ||
1549 | add_feature(dev, VIRTIO_NET_F_HOST_ECN); | ||
1379 | set_config(dev, sizeof(conf), &conf); | 1550 | set_config(dev, sizeof(conf), &conf); |
1380 | 1551 | ||
1381 | /* We don't need the socket any more; setup is done. */ | 1552 | /* We don't need the socket any more; setup is done. */ |
1382 | close(ipfd); | 1553 | close(ipfd); |
1383 | 1554 | ||
1384 | verbose("device %u: tun net %u.%u.%u.%u\n", | 1555 | devices.device_num++; |
1385 | devices.device_num++, | 1556 | |
1386 | (u8)(ip>>24),(u8)(ip>>16),(u8)(ip>>8),(u8)ip); | 1557 | if (bridging) |
1387 | if (br_name) | 1558 | verbose("device %u: tun %s attached to bridge: %s\n", |
1388 | verbose("attached to bridge: %s\n", br_name); | 1559 | devices.device_num, tapif, arg); |
1560 | else | ||
1561 | verbose("device %u: tun %s: %s\n", | ||
1562 | devices.device_num, tapif, arg); | ||
1389 | } | 1563 | } |
1390 | 1564 | ||
1391 | /* Our block (disk) device should be really simple: the Guest asks for a block | 1565 | /* Our block (disk) device should be really simple: the Guest asks for a block |
@@ -1550,7 +1724,7 @@ static bool handle_io_finish(int fd, struct device *dev) | |||
1550 | } | 1724 | } |
1551 | 1725 | ||
1552 | /* When the Guest submits some I/O, we just need to wake the I/O thread. */ | 1726 | /* When the Guest submits some I/O, we just need to wake the I/O thread. */ |
1553 | static void handle_virtblk_output(int fd, struct virtqueue *vq) | 1727 | static void handle_virtblk_output(int fd, struct virtqueue *vq, bool timeout) |
1554 | { | 1728 | { |
1555 | struct vblk_info *vblk = vq->dev->priv; | 1729 | struct vblk_info *vblk = vq->dev->priv; |
1556 | char c = 0; | 1730 | char c = 0; |
@@ -1621,6 +1795,64 @@ static void setup_block_file(const char *filename) | |||
1621 | verbose("device %u: virtblock %llu sectors\n", | 1795 | verbose("device %u: virtblock %llu sectors\n", |
1622 | devices.device_num, le64_to_cpu(conf.capacity)); | 1796 | devices.device_num, le64_to_cpu(conf.capacity)); |
1623 | } | 1797 | } |
1798 | |||
1799 | /* Our random number generator device reads from /dev/random into the Guest's | ||
1800 | * input buffers. The usual case is that the Guest doesn't want random numbers | ||
1801 | * and so has no buffers although /dev/random is still readable, whereas | ||
1802 | * console is the reverse. | ||
1803 | * | ||
1804 | * The same logic applies, however. */ | ||
1805 | static bool handle_rng_input(int fd, struct device *dev) | ||
1806 | { | ||
1807 | int len; | ||
1808 | unsigned int head, in_num, out_num, totlen = 0; | ||
1809 | struct iovec iov[dev->vq->vring.num]; | ||
1810 | |||
1811 | /* First we need a buffer from the Guests's virtqueue. */ | ||
1812 | head = get_vq_desc(dev->vq, iov, &out_num, &in_num); | ||
1813 | |||
1814 | /* If they're not ready for input, stop listening to this file | ||
1815 | * descriptor. We'll start again once they add an input buffer. */ | ||
1816 | if (head == dev->vq->vring.num) | ||
1817 | return false; | ||
1818 | |||
1819 | if (out_num) | ||
1820 | errx(1, "Output buffers in rng?"); | ||
1821 | |||
1822 | /* This is why we convert to iovecs: the readv() call uses them, and so | ||
1823 | * it reads straight into the Guest's buffer. We loop to make sure we | ||
1824 | * fill it. */ | ||
1825 | while (!iov_empty(iov, in_num)) { | ||
1826 | len = readv(dev->fd, iov, in_num); | ||
1827 | if (len <= 0) | ||
1828 | err(1, "Read from /dev/random gave %i", len); | ||
1829 | iov_consume(iov, in_num, len); | ||
1830 | totlen += len; | ||
1831 | } | ||
1832 | |||
1833 | /* Tell the Guest about the new input. */ | ||
1834 | add_used_and_trigger(fd, dev->vq, head, totlen); | ||
1835 | |||
1836 | /* Everything went OK! */ | ||
1837 | return true; | ||
1838 | } | ||
1839 | |||
1840 | /* And this creates a "hardware" random number device for the Guest. */ | ||
1841 | static void setup_rng(void) | ||
1842 | { | ||
1843 | struct device *dev; | ||
1844 | int fd; | ||
1845 | |||
1846 | fd = open_or_die("/dev/random", O_RDONLY); | ||
1847 | |||
1848 | /* The device responds to return from I/O thread. */ | ||
1849 | dev = new_device("rng", VIRTIO_ID_RNG, fd, handle_rng_input); | ||
1850 | |||
1851 | /* The device has one virtqueue, where the Guest places inbufs. */ | ||
1852 | add_virtqueue(dev, VIRTQUEUE_NUM, enable_fd); | ||
1853 | |||
1854 | verbose("device %u: rng\n", devices.device_num++); | ||
1855 | } | ||
1624 | /* That's the end of device setup. */ | 1856 | /* That's the end of device setup. */ |
1625 | 1857 | ||
1626 | /*L:230 Reboot is pretty easy: clean up and exec() the Launcher afresh. */ | 1858 | /*L:230 Reboot is pretty easy: clean up and exec() the Launcher afresh. */ |
@@ -1628,11 +1860,12 @@ static void __attribute__((noreturn)) restart_guest(void) | |||
1628 | { | 1860 | { |
1629 | unsigned int i; | 1861 | unsigned int i; |
1630 | 1862 | ||
1631 | /* Closing pipes causes the Waker thread and io_threads to die, and | 1863 | /* Since we don't track all open fds, we simply close everything beyond |
1632 | * closing /dev/lguest cleans up the Guest. Since we don't track all | 1864 | * stderr. */ |
1633 | * open fds, we simply close everything beyond stderr. */ | ||
1634 | for (i = 3; i < FD_SETSIZE; i++) | 1865 | for (i = 3; i < FD_SETSIZE; i++) |
1635 | close(i); | 1866 | close(i); |
1867 | |||
1868 | /* The exec automatically gets rid of the I/O and Waker threads. */ | ||
1636 | execv(main_args[0], main_args); | 1869 | execv(main_args[0], main_args); |
1637 | err(1, "Could not exec %s", main_args[0]); | 1870 | err(1, "Could not exec %s", main_args[0]); |
1638 | } | 1871 | } |
@@ -1663,7 +1896,7 @@ static void __attribute__((noreturn)) run_guest(int lguest_fd) | |||
1663 | /* ERESTART means that we need to reboot the guest */ | 1896 | /* ERESTART means that we need to reboot the guest */ |
1664 | } else if (errno == ERESTART) { | 1897 | } else if (errno == ERESTART) { |
1665 | restart_guest(); | 1898 | restart_guest(); |
1666 | /* EAGAIN means the Waker wanted us to look at some input. | 1899 | /* EAGAIN means a signal (timeout). |
1667 | * Anything else means a bug or incompatible change. */ | 1900 | * Anything else means a bug or incompatible change. */ |
1668 | } else if (errno != EAGAIN) | 1901 | } else if (errno != EAGAIN) |
1669 | err(1, "Running guest failed"); | 1902 | err(1, "Running guest failed"); |
@@ -1691,13 +1924,14 @@ static struct option opts[] = { | |||
1691 | { "verbose", 0, NULL, 'v' }, | 1924 | { "verbose", 0, NULL, 'v' }, |
1692 | { "tunnet", 1, NULL, 't' }, | 1925 | { "tunnet", 1, NULL, 't' }, |
1693 | { "block", 1, NULL, 'b' }, | 1926 | { "block", 1, NULL, 'b' }, |
1927 | { "rng", 0, NULL, 'r' }, | ||
1694 | { "initrd", 1, NULL, 'i' }, | 1928 | { "initrd", 1, NULL, 'i' }, |
1695 | { NULL }, | 1929 | { NULL }, |
1696 | }; | 1930 | }; |
1697 | static void usage(void) | 1931 | static void usage(void) |
1698 | { | 1932 | { |
1699 | errx(1, "Usage: lguest [--verbose] " | 1933 | errx(1, "Usage: lguest [--verbose] " |
1700 | "[--tunnet=(<ipaddr>|bridge:<bridgename>)\n" | 1934 | "[--tunnet=(<ipaddr>:<macaddr>|bridge:<bridgename>:<macaddr>)\n" |
1701 | "|--block=<filename>|--initrd=<filename>]...\n" | 1935 | "|--block=<filename>|--initrd=<filename>]...\n" |
1702 | "<mem-in-mb> vmlinux [args...]"); | 1936 | "<mem-in-mb> vmlinux [args...]"); |
1703 | } | 1937 | } |
@@ -1765,6 +1999,9 @@ int main(int argc, char *argv[]) | |||
1765 | case 'b': | 1999 | case 'b': |
1766 | setup_block_file(optarg); | 2000 | setup_block_file(optarg); |
1767 | break; | 2001 | break; |
2002 | case 'r': | ||
2003 | setup_rng(); | ||
2004 | break; | ||
1768 | case 'i': | 2005 | case 'i': |
1769 | initrd_name = optarg; | 2006 | initrd_name = optarg; |
1770 | break; | 2007 | break; |
@@ -1783,6 +2020,9 @@ int main(int argc, char *argv[]) | |||
1783 | /* We always have a console device */ | 2020 | /* We always have a console device */ |
1784 | setup_console(); | 2021 | setup_console(); |
1785 | 2022 | ||
2023 | /* We can timeout waiting for Guest network transmit. */ | ||
2024 | setup_timeout(); | ||
2025 | |||
1786 | /* Now we load the kernel */ | 2026 | /* Now we load the kernel */ |
1787 | start = load_kernel(open_or_die(argv[optind+1], O_RDONLY)); | 2027 | start = load_kernel(open_or_die(argv[optind+1], O_RDONLY)); |
1788 | 2028 | ||
@@ -1826,10 +2066,10 @@ int main(int argc, char *argv[]) | |||
1826 | * /dev/lguest file descriptor. */ | 2066 | * /dev/lguest file descriptor. */ |
1827 | lguest_fd = tell_kernel(pgdir, start); | 2067 | lguest_fd = tell_kernel(pgdir, start); |
1828 | 2068 | ||
1829 | /* We fork off a child process, which wakes the Launcher whenever one | 2069 | /* We clone off a thread, which wakes the Launcher whenever one of the |
1830 | * of the input file descriptors needs attention. We call this the | 2070 | * input file descriptors needs attention. We call this the Waker, and |
1831 | * Waker, and we'll cover it in a moment. */ | 2071 | * we'll cover it in a moment. */ |
1832 | waker_fd = setup_waker(lguest_fd); | 2072 | setup_waker(lguest_fd); |
1833 | 2073 | ||
1834 | /* Finally, run the Guest. This doesn't return. */ | 2074 | /* Finally, run the Guest. This doesn't return. */ |
1835 | run_guest(lguest_fd); | 2075 | run_guest(lguest_fd); |
diff --git a/Documentation/local_ops.txt b/Documentation/local_ops.txt index 4269a1105b37..f4f8b1c6c8ba 100644 --- a/Documentation/local_ops.txt +++ b/Documentation/local_ops.txt | |||
@@ -36,7 +36,7 @@ It can be done by slightly modifying the standard atomic operations : only | |||
36 | their UP variant must be kept. It typically means removing LOCK prefix (on | 36 | their UP variant must be kept. It typically means removing LOCK prefix (on |
37 | i386 and x86_64) and any SMP sychronization barrier. If the architecture does | 37 | i386 and x86_64) and any SMP sychronization barrier. If the architecture does |
38 | not have a different behavior between SMP and UP, including asm-generic/local.h | 38 | not have a different behavior between SMP and UP, including asm-generic/local.h |
39 | in your archtecture's local.h is sufficient. | 39 | in your architecture's local.h is sufficient. |
40 | 40 | ||
41 | The local_t type is defined as an opaque signed long by embedding an | 41 | The local_t type is defined as an opaque signed long by embedding an |
42 | atomic_long_t inside a structure. This is made so a cast from this type to a | 42 | atomic_long_t inside a structure. This is made so a cast from this type to a |
diff --git a/Documentation/markers.txt b/Documentation/markers.txt index d9f50a19fa0c..089f6138fcd9 100644 --- a/Documentation/markers.txt +++ b/Documentation/markers.txt | |||
@@ -50,10 +50,12 @@ Connecting a function (probe) to a marker is done by providing a probe (function | |||
50 | to call) for the specific marker through marker_probe_register() and can be | 50 | to call) for the specific marker through marker_probe_register() and can be |
51 | activated by calling marker_arm(). Marker deactivation can be done by calling | 51 | activated by calling marker_arm(). Marker deactivation can be done by calling |
52 | marker_disarm() as many times as marker_arm() has been called. Removing a probe | 52 | marker_disarm() as many times as marker_arm() has been called. Removing a probe |
53 | is done through marker_probe_unregister(); it will disarm the probe and make | 53 | is done through marker_probe_unregister(); it will disarm the probe. |
54 | sure there is no caller left using the probe when it returns. Probe removal is | 54 | marker_synchronize_unregister() must be called before the end of the module exit |
55 | preempt-safe because preemption is disabled around the probe call. See the | 55 | function to make sure there is no caller left using the probe. This, and the |
56 | "Probe example" section below for a sample probe module. | 56 | fact that preemption is disabled around the probe call, make sure that probe |
57 | removal and module unload are safe. See the "Probe example" section below for a | ||
58 | sample probe module. | ||
57 | 59 | ||
58 | The marker mechanism supports inserting multiple instances of the same marker. | 60 | The marker mechanism supports inserting multiple instances of the same marker. |
59 | Markers can be put in inline functions, inlined static functions, and | 61 | Markers can be put in inline functions, inlined static functions, and |
diff --git a/Documentation/md.txt b/Documentation/md.txt index a8b430627473..1da9d1b1793f 100644 --- a/Documentation/md.txt +++ b/Documentation/md.txt | |||
@@ -236,6 +236,11 @@ All md devices contain: | |||
236 | writing the word for the desired state, however some states | 236 | writing the word for the desired state, however some states |
237 | cannot be explicitly set, and some transitions are not allowed. | 237 | cannot be explicitly set, and some transitions are not allowed. |
238 | 238 | ||
239 | Select/poll works on this file. All changes except between | ||
240 | active_idle and active (which can be frequent and are not | ||
241 | very interesting) are notified. active->active_idle is | ||
242 | reported if the metadata is externally managed. | ||
243 | |||
239 | clear | 244 | clear |
240 | No devices, no size, no level | 245 | No devices, no size, no level |
241 | Writing is equivalent to STOP_ARRAY ioctl | 246 | Writing is equivalent to STOP_ARRAY ioctl |
@@ -292,6 +297,10 @@ Each directory contains: | |||
292 | writemostly - device will only be subject to read | 297 | writemostly - device will only be subject to read |
293 | requests if there are no other options. | 298 | requests if there are no other options. |
294 | This applies only to raid1 arrays. | 299 | This applies only to raid1 arrays. |
300 | blocked - device has failed, metadata is "external", | ||
301 | and the failure hasn't been acknowledged yet. | ||
302 | Writes that would write to this device if | ||
303 | it were not faulty are blocked. | ||
295 | spare - device is working, but not a full member. | 304 | spare - device is working, but not a full member. |
296 | This includes spares that are in the process | 305 | This includes spares that are in the process |
297 | of being recovered to | 306 | of being recovered to |
@@ -301,6 +310,12 @@ Each directory contains: | |||
301 | Writing "remove" removes the device from the array. | 310 | Writing "remove" removes the device from the array. |
302 | Writing "writemostly" sets the writemostly flag. | 311 | Writing "writemostly" sets the writemostly flag. |
303 | Writing "-writemostly" clears the writemostly flag. | 312 | Writing "-writemostly" clears the writemostly flag. |
313 | Writing "blocked" sets the "blocked" flag. | ||
314 | Writing "-blocked" clear the "blocked" flag and allows writes | ||
315 | to complete. | ||
316 | |||
317 | This file responds to select/poll. Any change to 'faulty' | ||
318 | or 'blocked' causes an event. | ||
304 | 319 | ||
305 | errors | 320 | errors |
306 | An approximate count of read errors that have been detected on | 321 | An approximate count of read errors that have been detected on |
@@ -332,7 +347,7 @@ Each directory contains: | |||
332 | for storage of data. This will normally be the same as the | 347 | for storage of data. This will normally be the same as the |
333 | component_size. This can be written while assembling an | 348 | component_size. This can be written while assembling an |
334 | array. If a value less than the current component_size is | 349 | array. If a value less than the current component_size is |
335 | written, component_size will be reduced to this value. | 350 | written, it will be rejected. |
336 | 351 | ||
337 | 352 | ||
338 | An active md device will also contain and entry for each active device | 353 | An active md device will also contain and entry for each active device |
@@ -381,6 +396,19 @@ also have | |||
381 | 'check' and 'repair' will start the appropriate process | 396 | 'check' and 'repair' will start the appropriate process |
382 | providing the current state is 'idle'. | 397 | providing the current state is 'idle'. |
383 | 398 | ||
399 | This file responds to select/poll. Any important change in the value | ||
400 | triggers a poll event. Sometimes the value will briefly be | ||
401 | "recover" if a recovery seems to be needed, but cannot be | ||
402 | achieved. In that case, the transition to "recover" isn't | ||
403 | notified, but the transition away is. | ||
404 | |||
405 | degraded | ||
406 | This contains a count of the number of devices by which the | ||
407 | arrays is degraded. So an optimal array with show '0'. A | ||
408 | single failed/missing drive will show '1', etc. | ||
409 | This file responds to select/poll, any increase or decrease | ||
410 | in the count of missing devices will trigger an event. | ||
411 | |||
384 | mismatch_count | 412 | mismatch_count |
385 | When performing 'check' and 'repair', and possibly when | 413 | When performing 'check' and 'repair', and possibly when |
386 | performing 'resync', md will count the number of errors that are | 414 | performing 'resync', md will count the number of errors that are |
diff --git a/Documentation/moxa-smartio b/Documentation/moxa-smartio index fe24ecc6372e..5337e80a5b96 100644 --- a/Documentation/moxa-smartio +++ b/Documentation/moxa-smartio | |||
@@ -1,14 +1,22 @@ | |||
1 | ============================================================================= | 1 | ============================================================================= |
2 | 2 | MOXA Smartio/Industio Family Device Driver Installation Guide | |
3 | MOXA Smartio Family Device Driver Ver 1.1 Installation Guide | 3 | for Linux Kernel 2.4.x, 2.6.x |
4 | for Linux Kernel 2.2.x and 2.0.3x | 4 | Copyright (C) 2008, Moxa Inc. |
5 | Copyright (C) 1999, Moxa Technologies Co, Ltd. | ||
6 | ============================================================================= | 5 | ============================================================================= |
6 | Date: 01/21/2008 | ||
7 | |||
7 | Content | 8 | Content |
8 | 9 | ||
9 | 1. Introduction | 10 | 1. Introduction |
10 | 2. System Requirement | 11 | 2. System Requirement |
11 | 3. Installation | 12 | 3. Installation |
13 | 3.1 Hardware installation | ||
14 | 3.2 Driver files | ||
15 | 3.3 Device naming convention | ||
16 | 3.4 Module driver configuration | ||
17 | 3.5 Static driver configuration for Linux kernel 2.4.x and 2.6.x. | ||
18 | 3.6 Custom configuration | ||
19 | 3.7 Verify driver installation | ||
12 | 4. Utilities | 20 | 4. Utilities |
13 | 5. Setserial | 21 | 5. Setserial |
14 | 6. Troubleshooting | 22 | 6. Troubleshooting |
@@ -16,27 +24,48 @@ Content | |||
16 | ----------------------------------------------------------------------------- | 24 | ----------------------------------------------------------------------------- |
17 | 1. Introduction | 25 | 1. Introduction |
18 | 26 | ||
19 | The Smartio family Linux driver, Ver. 1.1, supports following multiport | 27 | The Smartio/Industio/UPCI family Linux driver supports following multiport |
20 | boards. | 28 | boards. |
21 | 29 | ||
22 | -C104P/H/HS, C104H/PCI, C104HS/PCI, CI-104J 4 port multiport board. | 30 | - 2 ports multiport board |
23 | -C168P/H/HS, C168H/PCI 8 port multiport board. | 31 | CP-102U, CP-102UL, CP-102UF |
24 | 32 | CP-132U-I, CP-132UL, | |
25 | This driver has been modified a little and cleaned up from the Moxa | 33 | CP-132, CP-132I, CP132S, CP-132IS, |
26 | contributed driver code and merged into Linux 2.2.14pre. In particular | 34 | CI-132, CI-132I, CI-132IS, |
27 | official major/minor numbers have been assigned which are different to | 35 | (C102H, C102HI, C102HIS, C102P, CP-102, CP-102S) |
28 | those the original Moxa supplied driver used. | 36 | |
37 | - 4 ports multiport board | ||
38 | CP-104EL, | ||
39 | CP-104UL, CP-104JU, | ||
40 | CP-134U, CP-134U-I, | ||
41 | C104H/PCI, C104HS/PCI, | ||
42 | CP-114, CP-114I, CP-114S, CP-114IS, CP-114UL, | ||
43 | C104H, C104HS, | ||
44 | CI-104J, CI-104JS, | ||
45 | CI-134, CI-134I, CI-134IS, | ||
46 | (C114HI, CT-114I, C104P) | ||
47 | POS-104UL, | ||
48 | CB-114, | ||
49 | CB-134I | ||
50 | |||
51 | - 8 ports multiport board | ||
52 | CP-118EL, CP-168EL, | ||
53 | CP-118U, CP-168U, | ||
54 | C168H/PCI, | ||
55 | C168H, C168HS, | ||
56 | (C168P), | ||
57 | CB-108 | ||
29 | 58 | ||
30 | This driver and installation procedure have been developed upon Linux Kernel | 59 | This driver and installation procedure have been developed upon Linux Kernel |
31 | 2.2.5 and backward compatible to 2.0.3x. This driver supports Intel x86 and | 60 | 2.4.x and 2.6.x. This driver supports Intel x86 hardware platform. In order |
32 | Alpha hardware platform. In order to maintain compatibility, this version | 61 | to maintain compatibility, this version has also been properly tested with |
33 | has also been properly tested with RedHat, OpenLinux, TurboLinux and | 62 | RedHat, Mandrake, Fedora and S.u.S.E Linux. However, if compatibility problem |
34 | S.u.S.E Linux. However, if compatibility problem occurs, please contact | 63 | occurs, please contact Moxa at support@moxa.com.tw. |
35 | Moxa at support@moxa.com.tw. | ||
36 | 64 | ||
37 | In addition to device driver, useful utilities are also provided in this | 65 | In addition to device driver, useful utilities are also provided in this |
38 | version. They are | 66 | version. They are |
39 | - msdiag Diagnostic program for detecting installed Moxa Smartio boards. | 67 | - msdiag Diagnostic program for displaying installed Moxa |
68 | Smartio/Industio boards. | ||
40 | - msmon Monitor program to observe data count and line status signals. | 69 | - msmon Monitor program to observe data count and line status signals. |
41 | - msterm A simple terminal program which is useful in testing serial | 70 | - msterm A simple terminal program which is useful in testing serial |
42 | ports. | 71 | ports. |
@@ -47,8 +76,7 @@ Content | |||
47 | GNU General Public License in this version. Please refer to GNU General | 76 | GNU General Public License in this version. Please refer to GNU General |
48 | Public License announcement in each source code file for more detail. | 77 | Public License announcement in each source code file for more detail. |
49 | 78 | ||
50 | In Moxa's ftp sites, you may always find latest driver at | 79 | In Moxa's Web sites, you may always find latest driver at http://web.moxa.com. |
51 | ftp://ftp.moxa.com or ftp://ftp.moxa.com.tw. | ||
52 | 80 | ||
53 | This version of driver can be installed as Loadable Module (Module driver) | 81 | This version of driver can be installed as Loadable Module (Module driver) |
54 | or built-in into kernel (Static driver). You may refer to following | 82 | or built-in into kernel (Static driver). You may refer to following |
@@ -61,8 +89,8 @@ Content | |||
61 | 89 | ||
62 | ----------------------------------------------------------------------------- | 90 | ----------------------------------------------------------------------------- |
63 | 2. System Requirement | 91 | 2. System Requirement |
64 | - Hardware platform: Intel x86 or Alpha machine | 92 | - Hardware platform: Intel x86 machine |
65 | - Kernel version: 2.0.3x or 2.2.x | 93 | - Kernel version: 2.4.x or 2.6.x |
66 | - gcc version 2.72 or later | 94 | - gcc version 2.72 or later |
67 | - Maximum 4 boards can be installed in combination | 95 | - Maximum 4 boards can be installed in combination |
68 | 96 | ||
@@ -70,9 +98,18 @@ Content | |||
70 | 3. Installation | 98 | 3. Installation |
71 | 99 | ||
72 | 3.1 Hardware installation | 100 | 3.1 Hardware installation |
101 | 3.2 Driver files | ||
102 | 3.3 Device naming convention | ||
103 | 3.4 Module driver configuration | ||
104 | 3.5 Static driver configuration for Linux kernel 2.4.x, 2.6.x. | ||
105 | 3.6 Custom configuration | ||
106 | 3.7 Verify driver installation | ||
107 | |||
108 | |||
109 | 3.1 Hardware installation | ||
73 | 110 | ||
74 | There are two types of buses, ISA and PCI, for Smartio family multiport | 111 | There are two types of buses, ISA and PCI, for Smartio/Industio |
75 | board. | 112 | family multiport board. |
76 | 113 | ||
77 | ISA board | 114 | ISA board |
78 | --------- | 115 | --------- |
@@ -81,47 +118,57 @@ Content | |||
81 | installation procedure in User's Manual before proceed any further. | 118 | installation procedure in User's Manual before proceed any further. |
82 | Please make sure the JP1 is open after the ISA board is set properly. | 119 | Please make sure the JP1 is open after the ISA board is set properly. |
83 | 120 | ||
84 | PCI board | 121 | PCI/UPCI board |
85 | --------- | 122 | -------------- |
86 | You may need to adjust IRQ usage in BIOS to avoid from IRQ conflict | 123 | You may need to adjust IRQ usage in BIOS to avoid from IRQ conflict |
87 | with other ISA devices. Please refer to hardware installation | 124 | with other ISA devices. Please refer to hardware installation |
88 | procedure in User's Manual in advance. | 125 | procedure in User's Manual in advance. |
89 | 126 | ||
90 | IRQ Sharing | 127 | PCI IRQ Sharing |
91 | ----------- | 128 | ----------- |
92 | Each port within the same multiport board shares the same IRQ. Up to | 129 | Each port within the same multiport board shares the same IRQ. Up to |
93 | 4 Moxa Smartio Family multiport boards can be installed together on | 130 | 4 Moxa Smartio/Industio PCI Family multiport boards can be installed |
94 | one system and they can share the same IRQ. | 131 | together on one system and they can share the same IRQ. |
132 | |||
95 | 133 | ||
96 | 3.2 Driver files and device naming convention | 134 | 3.2 Driver files |
97 | 135 | ||
98 | The driver file may be obtained from ftp, CD-ROM or floppy disk. The | 136 | The driver file may be obtained from ftp, CD-ROM or floppy disk. The |
99 | first step, anyway, is to copy driver file "mxser.tgz" into specified | 137 | first step, anyway, is to copy driver file "mxser.tgz" into specified |
100 | directory. e.g. /moxa. The execute commands as below. | 138 | directory. e.g. /moxa. The execute commands as below. |
101 | 139 | ||
140 | # cd / | ||
141 | # mkdir moxa | ||
102 | # cd /moxa | 142 | # cd /moxa |
103 | # tar xvf /dev/fd0 | 143 | # tar xvf /dev/fd0 |
144 | |||
104 | or | 145 | or |
146 | |||
147 | # cd / | ||
148 | # mkdir moxa | ||
105 | # cd /moxa | 149 | # cd /moxa |
106 | # cp /mnt/cdrom/<driver directory>/mxser.tgz . | 150 | # cp /mnt/cdrom/<driver directory>/mxser.tgz . |
107 | # tar xvfz mxser.tgz | 151 | # tar xvfz mxser.tgz |
108 | 152 | ||
153 | |||
154 | 3.3 Device naming convention | ||
155 | |||
109 | You may find all the driver and utilities files in /moxa/mxser. | 156 | You may find all the driver and utilities files in /moxa/mxser. |
110 | Following installation procedure depends on the model you'd like to | 157 | Following installation procedure depends on the model you'd like to |
111 | run the driver. If you prefer module driver, please refer to 3.3. | 158 | run the driver. If you prefer module driver, please refer to 3.4. |
112 | If static driver is required, please refer to 3.4. | 159 | If static driver is required, please refer to 3.5. |
113 | 160 | ||
114 | Dialin and callout port | 161 | Dialin and callout port |
115 | ----------------------- | 162 | ----------------------- |
116 | This driver remains traditional serial device properties. There're | 163 | This driver remains traditional serial device properties. There are |
117 | two special file name for each serial port. One is dial-in port | 164 | two special file name for each serial port. One is dial-in port |
118 | which is named "ttyMxx". For callout port, the naming convention | 165 | which is named "ttyMxx". For callout port, the naming convention |
119 | is "cumxx". | 166 | is "cumxx". |
120 | 167 | ||
121 | Device naming when more than 2 boards installed | 168 | Device naming when more than 2 boards installed |
122 | ----------------------------------------------- | 169 | ----------------------------------------------- |
123 | Naming convention for each Smartio multiport board is pre-defined | 170 | Naming convention for each Smartio/Industio multiport board is |
124 | as below. | 171 | pre-defined as below. |
125 | 172 | ||
126 | Board Num. Dial-in Port Callout port | 173 | Board Num. Dial-in Port Callout port |
127 | 1st board ttyM0 - ttyM7 cum0 - cum7 | 174 | 1st board ttyM0 - ttyM7 cum0 - cum7 |
@@ -129,6 +176,12 @@ Content | |||
129 | 3rd board ttyM16 - ttyM23 cum16 - cum23 | 176 | 3rd board ttyM16 - ttyM23 cum16 - cum23 |
130 | 4th board ttyM24 - ttym31 cum24 - cum31 | 177 | 4th board ttyM24 - ttym31 cum24 - cum31 |
131 | 178 | ||
179 | |||
180 | !!!!!!!!!!!!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
181 | Under Kernel 2.6 the cum Device is Obsolete. So use ttyM* | ||
182 | device instead. | ||
183 | !!!!!!!!!!!!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
184 | |||
132 | Board sequence | 185 | Board sequence |
133 | -------------- | 186 | -------------- |
134 | This driver will activate ISA boards according to the parameter set | 187 | This driver will activate ISA boards according to the parameter set |
@@ -138,69 +191,131 @@ Content | |||
138 | For PCI boards, their sequence will be after ISA boards and C168H/PCI | 191 | For PCI boards, their sequence will be after ISA boards and C168H/PCI |
139 | has higher priority than C104H/PCI boards. | 192 | has higher priority than C104H/PCI boards. |
140 | 193 | ||
141 | 3.3 Module driver configuration | 194 | 3.4 Module driver configuration |
142 | Module driver is easiest way to install. If you prefer static driver | 195 | Module driver is easiest way to install. If you prefer static driver |
143 | installation, please skip this paragraph. | 196 | installation, please skip this paragraph. |
144 | 1. Find "Makefile" in /moxa/mxser, then run | ||
145 | 197 | ||
146 | # make install | 198 | |
199 | ------------- Prepare to use the MOXA driver-------------------- | ||
200 | 3.4.1 Create tty device with correct major number | ||
201 | Before using MOXA driver, your system must have the tty devices | ||
202 | which are created with driver's major number. We offer one shell | ||
203 | script "msmknod" to simplify the procedure. | ||
204 | This step is only needed to be executed once. But you still | ||
205 | need to do this procedure when: | ||
206 | a. You change the driver's major number. Please refer the "3.7" | ||
207 | section. | ||
208 | b. Your total installed MOXA boards number is changed. Maybe you | ||
209 | add/delete one MOXA board. | ||
210 | c. You want to change the tty name. This needs to modify the | ||
211 | shell script "msmknod" | ||
212 | |||
213 | The procedure is: | ||
214 | # cd /moxa/mxser/driver | ||
215 | # ./msmknod | ||
216 | |||
217 | This shell script will require the major number for dial-in | ||
218 | device and callout device to create tty device. You also need | ||
219 | to specify the total installed MOXA board number. Default major | ||
220 | numbers for dial-in device and callout device are 30, 35. If | ||
221 | you need to change to other number, please refer section "3.7" | ||
222 | for more detailed procedure. | ||
223 | Msmknod will delete any special files occupying the same device | ||
224 | naming. | ||
225 | |||
226 | 3.4.2 Build the MOXA driver and utilities | ||
227 | Before using the MOXA driver and utilities, you need compile the | ||
228 | all the source code. This step is only need to be executed once. | ||
229 | But you still re-compile the source code if you modify the source | ||
230 | code. For example, if you change the driver's major number (see | ||
231 | "3.7" section), then you need to do this step again. | ||
232 | |||
233 | Find "Makefile" in /moxa/mxser, then run | ||
234 | |||
235 | # make clean; make install | ||
236 | |||
237 | !!!!!!!!!! NOTE !!!!!!!!!!!!!!!!! | ||
238 | For Red Hat 9, Red Hat Enterprise Linux AS3/ES3/WS3 & Fedora Core1: | ||
239 | # make clean; make installsp1 | ||
240 | |||
241 | For Red Hat Enterprise Linux AS4/ES4/WS4: | ||
242 | # make clean; make installsp2 | ||
243 | !!!!!!!!!! NOTE !!!!!!!!!!!!!!!!! | ||
147 | 244 | ||
148 | The driver files "mxser.o" and utilities will be properly compiled | 245 | The driver files "mxser.o" and utilities will be properly compiled |
149 | and copied to system directories respectively.Then run | 246 | and copied to system directories respectively. |
150 | 247 | ||
151 | # insmod mxser | 248 | ------------- Load MOXA driver-------------------- |
249 | 3.4.3 Load the MOXA driver | ||
152 | 250 | ||
153 | to activate the modular driver. You may run "lsmod" to check | 251 | # modprobe mxser <argument> |
154 | if "mxser.o" is activated. | ||
155 | 252 | ||
156 | 2. Create special files by executing "msmknod". | 253 | will activate the module driver. You may run "lsmod" to check |
157 | # cd /moxa/mxser/driver | 254 | if "mxser" is activated. If the MOXA board is ISA board, the |
158 | # ./msmknod | 255 | <argument> is needed. Please refer to section "3.4.5" for more |
256 | information. | ||
257 | |||
258 | |||
259 | ------------- Load MOXA driver on boot -------------------- | ||
260 | 3.4.4 For the above description, you may manually execute | ||
261 | "modprobe mxser" to activate this driver and run | ||
262 | "rmmod mxser" to remove it. | ||
263 | However, it's better to have a boot time configuration to | ||
264 | eliminate manual operation. Boot time configuration can be | ||
265 | achieved by rc file. We offer one "rc.mxser" file to simplify | ||
266 | the procedure under "moxa/mxser/driver". | ||
159 | 267 | ||
160 | Default major numbers for dial-in device and callout device are | 268 | But if you use ISA board, please modify the "modprobe ..." command |
161 | 174, 175. Msmknod will delete any special files occupying the same | 269 | to add the argument (see "3.4.5" section). After modifying the |
162 | device naming. | 270 | rc.mxser, please try to execute "/moxa/mxser/driver/rc.mxser" |
271 | manually to make sure the modification is ok. If any error | ||
272 | encountered, please try to modify again. If the modification is | ||
273 | completed, follow the below step. | ||
163 | 274 | ||
164 | 3. Up to now, you may manually execute "insmod mxser" to activate | 275 | Run following command for setting rc files. |
165 | this driver and run "rmmod mxser" to remove it. However, it's | ||
166 | better to have a boot time configuration to eliminate manual | ||
167 | operation. | ||
168 | Boot time configuration can be achieved by rc file. Run following | ||
169 | command for setting rc files. | ||
170 | 276 | ||
171 | # cd /moxa/mxser/driver | 277 | # cd /moxa/mxser/driver |
172 | # cp ./rc.mxser /etc/rc.d | 278 | # cp ./rc.mxser /etc/rc.d |
173 | # cd /etc/rc.d | 279 | # cd /etc/rc.d |
174 | 280 | ||
175 | You may have to modify part of the content in rc.mxser to specify | 281 | Check "rc.serial" is existed or not. If "rc.serial" doesn't exist, |
176 | parameters for ISA board. Please refer to rc.mxser for more detail. | 282 | create it by vi, run "chmod 755 rc.serial" to change the permission. |
177 | Find "rc.serial". If "rc.serial" doesn't exist, create it by vi. | 283 | Add "/etc/rc.d/rc.mxser" in last line, |
178 | Add "rc.mxser" in last line. Next, open rc.local by vi | ||
179 | and append following content. | ||
180 | 284 | ||
181 | if [ -f /etc/rc.d/rc.serial ]; then | 285 | Reboot and check if moxa.o activated by "lsmod" command. |
182 | sh /etc/rc.d/rc.serial | ||
183 | fi | ||
184 | 286 | ||
185 | 4. Reboot and check if mxser.o activated by "lsmod" command. | 287 | 3.4.5. If you'd like to drive Smartio/Industio ISA boards in the system, |
186 | 5. If you'd like to drive Smartio ISA boards in the system, you'll | 288 | you'll have to add parameter to specify CAP address of given |
187 | have to add parameter to specify CAP address of given board while | 289 | board while activating "mxser.o". The format for parameters are |
188 | activating "mxser.o". The format for parameters are as follows. | 290 | as follows. |
189 | 291 | ||
190 | insmod mxser ioaddr=0x???,0x???,0x???,0x??? | 292 | modprobe mxser ioaddr=0x???,0x???,0x???,0x??? |
191 | | | | | | 293 | | | | | |
192 | | | | +- 4th ISA board | 294 | | | | +- 4th ISA board |
193 | | | +------ 3rd ISA board | 295 | | | +------ 3rd ISA board |
194 | | +------------ 2nd ISA board | 296 | | +------------ 2nd ISA board |
195 | +------------------- 1st ISA board | 297 | +------------------- 1st ISA board |
196 | 298 | ||
197 | 3.4 Static driver configuration | 299 | 3.5 Static driver configuration for Linux kernel 2.4.x and 2.6.x |
300 | |||
301 | Note: To use static driver, you must install the linux kernel | ||
302 | source package. | ||
303 | |||
304 | 3.5.1 Backup the built-in driver in the kernel. | ||
305 | # cd /usr/src/linux/drivers/char | ||
306 | # mv mxser.c mxser.c.old | ||
307 | |||
308 | For Red Hat 7.x user, you need to create link: | ||
309 | # cd /usr/src | ||
310 | # ln -s linux-2.4 linux | ||
198 | 311 | ||
199 | 1. Create link | 312 | 3.5.2 Create link |
200 | # cd /usr/src/linux/drivers/char | 313 | # cd /usr/src/linux/drivers/char |
201 | # ln -s /moxa/mxser/driver/mxser.c mxser.c | 314 | # ln -s /moxa/mxser/driver/mxser.c mxser.c |
202 | 315 | ||
203 | 2. Add CAP address list for ISA boards | 316 | 3.5.3 Add CAP address list for ISA boards. For PCI boards user, |
317 | please skip this step. | ||
318 | |||
204 | In module mode, the CAP address for ISA board is given by | 319 | In module mode, the CAP address for ISA board is given by |
205 | parameter. In static driver configuration, you'll have to | 320 | parameter. In static driver configuration, you'll have to |
206 | assign it within driver's source code. If you will not | 321 | assign it within driver's source code. If you will not |
@@ -222,73 +337,55 @@ Content | |||
222 | static int mxserBoardCAP[] | 337 | static int mxserBoardCAP[] |
223 | = {0x280, 0x180, 0x00, 0x00}; | 338 | = {0x280, 0x180, 0x00, 0x00}; |
224 | 339 | ||
225 | 3. Modify tty_io.c | 340 | 3.5.4 Setup kernel configuration |
226 | # cd /usr/src/linux/drivers/char/ | ||
227 | # vi tty_io.c | ||
228 | Find pty_init(), insert "mxser_init()" as | ||
229 | 341 | ||
230 | pty_init(); | 342 | Configure the kernel: |
231 | mxser_init(); | ||
232 | 343 | ||
233 | 4. Modify tty.h | 344 | # cd /usr/src/linux |
234 | # cd /usr/src/linux/include/linux | 345 | # make menuconfig |
235 | # vi tty.h | ||
236 | Find extern int tty_init(void), insert "mxser_init()" as | ||
237 | 346 | ||
238 | extern int tty_init(void); | 347 | You will go into a menu-driven system. Please select [Character |
239 | extern int mxser_init(void); | 348 | devices][Non-standard serial port support], enable the [Moxa |
240 | 349 | SmartIO support] driver with "[*]" for built-in (not "[M]"), then | |
241 | 5. Modify Makefile | 350 | select [Exit] to exit this program. |
242 | # cd /usr/src/linux/drivers/char | ||
243 | # vi Makefile | ||
244 | Find L_OBJS := tty_io.o ...... random.o, add | ||
245 | "mxser.o" at last of this line as | ||
246 | L_OBJS := tty_io.o ....... mxser.o | ||
247 | 351 | ||
248 | 6. Rebuild kernel | 352 | 3.5.5 Rebuild kernel |
249 | The following are for Linux kernel rebuilding,for your reference only. | 353 | The following are for Linux kernel rebuilding, for your |
354 | reference only. | ||
250 | For appropriate details, please refer to the Linux document. | 355 | For appropriate details, please refer to the Linux document. |
251 | 356 | ||
252 | If 'lilo' utility is installed, please use 'make zlilo' to rebuild | ||
253 | kernel. If 'lilo' is not installed, please follow the following steps. | ||
254 | |||
255 | a. cd /usr/src/linux | 357 | a. cd /usr/src/linux |
256 | b. make clean /* take a few minutes */ | 358 | b. make clean /* take a few minutes */ |
257 | c. make bzImage /* take probably 10-20 minutes */ | 359 | c. make dep /* take a few minutes */ |
258 | d. Backup original boot kernel. /* optional step */ | 360 | d. make bzImage /* take probably 10-20 minutes */ |
259 | e. cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz | 361 | e. make install /* copy boot image to correct position */ |
260 | f. Please make sure the boot kernel (vmlinuz) is in the | 362 | f. Please make sure the boot kernel (vmlinuz) is in the |
261 | correct position. If you use 'lilo' utility, you should | 363 | correct position. |
262 | check /etc/lilo.conf 'image' item specified the path | 364 | g. If you use 'lilo' utility, you should check /etc/lilo.conf |
263 | which is the 'vmlinuz' path, or you will load wrong | 365 | 'image' item specified the path which is the 'vmlinuz' path, |
264 | (or old) boot kernel image (vmlinuz). | 366 | or you will load wrong (or old) boot kernel image (vmlinuz). |
265 | g. chmod 400 /vmlinuz | 367 | After checking /etc/lilo.conf, please run "lilo". |
266 | h. lilo | 368 | |
267 | i. rdev -R /vmlinuz 1 | 369 | Note that if the result of "make bzImage" is ERROR, then you have to |
268 | j. sync | 370 | go back to Linux configuration Setup. Type "make menuconfig" in |
269 | 371 | directory /usr/src/linux. | |
270 | Note that if the result of "make zImage" is ERROR, then you have to | 372 | |
271 | go back to Linux configuration Setup. Type "make config" in directory | 373 | |
272 | /usr/src/linux or "setup". | 374 | 3.5.6 Make tty device and special file |
273 | |||
274 | Since system include file, /usr/src/linux/include/linux/interrupt.h, | ||
275 | is modified each time the MOXA driver is installed, kernel rebuilding | ||
276 | is inevitable. And it takes about 10 to 20 minutes depends on the | ||
277 | machine. | ||
278 | |||
279 | 7. Make utility | ||
280 | # cd /moxa/mxser/utility | ||
281 | # make install | ||
282 | |||
283 | 8. Make special file | ||
284 | # cd /moxa/mxser/driver | 375 | # cd /moxa/mxser/driver |
285 | # ./msmknod | 376 | # ./msmknod |
286 | 377 | ||
287 | 9. Reboot | 378 | 3.5.7 Make utility |
379 | # cd /moxa/mxser/utility | ||
380 | # make clean; make install | ||
381 | |||
382 | 3.5.8 Reboot | ||
288 | 383 | ||
289 | 3.5 Custom configuration | 384 | |
385 | |||
386 | 3.6 Custom configuration | ||
290 | Although this driver already provides you default configuration, you | 387 | Although this driver already provides you default configuration, you |
291 | still can change the device name and major number.The instruction to | 388 | still can change the device name and major number. The instruction to |
292 | change these parameters are shown as below. | 389 | change these parameters are shown as below. |
293 | 390 | ||
294 | Change Device name | 391 | Change Device name |
@@ -306,33 +403,37 @@ Content | |||
306 | 2 free major numbers for this driver. There are 3 steps to change | 403 | 2 free major numbers for this driver. There are 3 steps to change |
307 | major numbers. | 404 | major numbers. |
308 | 405 | ||
309 | 1. Find free major numbers | 406 | 3.6.1 Find free major numbers |
310 | In /proc/devices, you may find all the major numbers occupied | 407 | In /proc/devices, you may find all the major numbers occupied |
311 | in the system. Please select 2 major numbers that are available. | 408 | in the system. Please select 2 major numbers that are available. |
312 | e.g. 40, 45. | 409 | e.g. 40, 45. |
313 | 2. Create special files | 410 | 3.6.2 Create special files |
314 | Run /moxa/mxser/driver/msmknod to create special files with | 411 | Run /moxa/mxser/driver/msmknod to create special files with |
315 | specified major numbers. | 412 | specified major numbers. |
316 | 3. Modify driver with new major number | 413 | 3.6.3 Modify driver with new major number |
317 | Run vi to open /moxa/mxser/driver/mxser.c. Locate the line | 414 | Run vi to open /moxa/mxser/driver/mxser.c. Locate the line |
318 | contains "MXSERMAJOR". Change the content as below. | 415 | contains "MXSERMAJOR". Change the content as below. |
319 | #define MXSERMAJOR 40 | 416 | #define MXSERMAJOR 40 |
320 | #define MXSERCUMAJOR 45 | 417 | #define MXSERCUMAJOR 45 |
321 | 4. Run # make install in /moxa/mxser/driver. | 418 | 3.6.4 Run "make clean; make install" in /moxa/mxser/driver. |
322 | 419 | ||
323 | 3.6 Verify driver installation | 420 | 3.7 Verify driver installation |
324 | You may refer to /var/log/messages to check the latest status | 421 | You may refer to /var/log/messages to check the latest status |
325 | log reported by this driver whenever it's activated. | 422 | log reported by this driver whenever it's activated. |
423 | |||
326 | ----------------------------------------------------------------------------- | 424 | ----------------------------------------------------------------------------- |
327 | 4. Utilities | 425 | 4. Utilities |
328 | There are 3 utilities contained in this driver. They are msdiag, msmon and | 426 | There are 3 utilities contained in this driver. They are msdiag, msmon and |
329 | msterm. These 3 utilities are released in form of source code. They should | 427 | msterm. These 3 utilities are released in form of source code. They should |
330 | be compiled into executable file and copied into /usr/bin. | 428 | be compiled into executable file and copied into /usr/bin. |
331 | 429 | ||
430 | Before using these utilities, please load driver (refer 3.4 & 3.5) and | ||
431 | make sure you had run the "msmknod" utility. | ||
432 | |||
332 | msdiag - Diagnostic | 433 | msdiag - Diagnostic |
333 | -------------------- | 434 | -------------------- |
334 | This utility provides the function to detect what Moxa Smartio multiport | 435 | This utility provides the function to display what Moxa Smartio/Industio |
335 | board exists in the system. | 436 | board found by driver in the system. |
336 | 437 | ||
337 | msmon - Port Monitoring | 438 | msmon - Port Monitoring |
338 | ----------------------- | 439 | ----------------------- |
@@ -353,12 +454,13 @@ Content | |||
353 | application, for example, sending AT command to a modem connected to the | 454 | application, for example, sending AT command to a modem connected to the |
354 | port or used as a terminal for login purpose. Note that this is only a | 455 | port or used as a terminal for login purpose. Note that this is only a |
355 | dumb terminal emulation without handling full screen operation. | 456 | dumb terminal emulation without handling full screen operation. |
457 | |||
356 | ----------------------------------------------------------------------------- | 458 | ----------------------------------------------------------------------------- |
357 | 5. Setserial | 459 | 5. Setserial |
358 | 460 | ||
359 | Supported Setserial parameters are listed as below. | 461 | Supported Setserial parameters are listed as below. |
360 | 462 | ||
361 | uart set UART type(16450-->disable FIFO, 16550A-->enable FIFO) | 463 | uart set UART type(16450-->disable FIFO, 16550A-->enable FIFO) |
362 | close_delay set the amount of time(in 1/100 of a second) that DTR | 464 | close_delay set the amount of time(in 1/100 of a second) that DTR |
363 | should be kept low while being closed. | 465 | should be kept low while being closed. |
364 | closing_wait set the amount of time(in 1/100 of a second) that the | 466 | closing_wait set the amount of time(in 1/100 of a second) that the |
@@ -366,7 +468,13 @@ Content | |||
366 | being closed, before the receiver is disable. | 468 | being closed, before the receiver is disable. |
367 | spd_hi Use 57.6kb when the application requests 38.4kb. | 469 | spd_hi Use 57.6kb when the application requests 38.4kb. |
368 | spd_vhi Use 115.2kb when the application requests 38.4kb. | 470 | spd_vhi Use 115.2kb when the application requests 38.4kb. |
471 | spd_shi Use 230.4kb when the application requests 38.4kb. | ||
472 | spd_warp Use 460.8kb when the application requests 38.4kb. | ||
369 | spd_normal Use 38.4kb when the application requests 38.4kb. | 473 | spd_normal Use 38.4kb when the application requests 38.4kb. |
474 | spd_cust Use the custom divisor to set the speed when the | ||
475 | application requests 38.4kb. | ||
476 | divisor This option set the custom divison. | ||
477 | baud_base This option set the base baud rate. | ||
370 | 478 | ||
371 | ----------------------------------------------------------------------------- | 479 | ----------------------------------------------------------------------------- |
372 | 6. Troubleshooting | 480 | 6. Troubleshooting |
@@ -375,8 +483,9 @@ Content | |||
375 | possible. If all the possible solutions fail, please contact our technical | 483 | possible. If all the possible solutions fail, please contact our technical |
376 | support team to get more help. | 484 | support team to get more help. |
377 | 485 | ||
378 | Error msg: More than 4 Moxa Smartio family boards found. Fifth board and | 486 | |
379 | after are ignored. | 487 | Error msg: More than 4 Moxa Smartio/Industio family boards found. Fifth board |
488 | and after are ignored. | ||
380 | Solution: | 489 | Solution: |
381 | To avoid this problem, please unplug fifth and after board, because Moxa | 490 | To avoid this problem, please unplug fifth and after board, because Moxa |
382 | driver supports up to 4 boards. | 491 | driver supports up to 4 boards. |
@@ -384,7 +493,7 @@ Content | |||
384 | Error msg: Request_irq fail, IRQ(?) may be conflict with another device. | 493 | Error msg: Request_irq fail, IRQ(?) may be conflict with another device. |
385 | Solution: | 494 | Solution: |
386 | Other PCI or ISA devices occupy the assigned IRQ. If you are not sure | 495 | Other PCI or ISA devices occupy the assigned IRQ. If you are not sure |
387 | which device causes the situation,please check /proc/interrupts to find | 496 | which device causes the situation, please check /proc/interrupts to find |
388 | free IRQ and simply change another free IRQ for Moxa board. | 497 | free IRQ and simply change another free IRQ for Moxa board. |
389 | 498 | ||
390 | Error msg: Board #: C1xx Series(CAP=xxx) interrupt number invalid. | 499 | Error msg: Board #: C1xx Series(CAP=xxx) interrupt number invalid. |
@@ -397,15 +506,18 @@ Content | |||
397 | Moxa ISA board needs an interrupt vector.Please refer to user's manual | 506 | Moxa ISA board needs an interrupt vector.Please refer to user's manual |
398 | "Hardware Installation" chapter to set interrupt vector. | 507 | "Hardware Installation" chapter to set interrupt vector. |
399 | 508 | ||
400 | Error msg: Couldn't install MOXA Smartio family driver! | 509 | Error msg: Couldn't install MOXA Smartio/Industio family driver! |
401 | Solution: | 510 | Solution: |
402 | Load Moxa driver fail, the major number may conflict with other devices. | 511 | Load Moxa driver fail, the major number may conflict with other devices. |
403 | Please refer to previous section 3.5 to change a free major number for | 512 | Please refer to previous section 3.7 to change a free major number for |
404 | Moxa driver. | 513 | Moxa driver. |
405 | 514 | ||
406 | Error msg: Couldn't install MOXA Smartio family callout driver! | 515 | Error msg: Couldn't install MOXA Smartio/Industio family callout driver! |
407 | Solution: | 516 | Solution: |
408 | Load Moxa callout driver fail, the callout device major number may | 517 | Load Moxa callout driver fail, the callout device major number may |
409 | conflict with other devices. Please refer to previous section 3.5 to | 518 | conflict with other devices. Please refer to previous section 3.7 to |
410 | change a free callout device major number for Moxa driver. | 519 | change a free callout device major number for Moxa driver. |
520 | |||
521 | |||
411 | ----------------------------------------------------------------------------- | 522 | ----------------------------------------------------------------------------- |
523 | |||
diff --git a/Documentation/mtd/nand_ecc.txt b/Documentation/mtd/nand_ecc.txt new file mode 100644 index 000000000000..bdf93b7f0f24 --- /dev/null +++ b/Documentation/mtd/nand_ecc.txt | |||
@@ -0,0 +1,714 @@ | |||
1 | Introduction | ||
2 | ============ | ||
3 | |||
4 | Having looked at the linux mtd/nand driver and more specific at nand_ecc.c | ||
5 | I felt there was room for optimisation. I bashed the code for a few hours | ||
6 | performing tricks like table lookup removing superfluous code etc. | ||
7 | After that the speed was increased by 35-40%. | ||
8 | Still I was not too happy as I felt there was additional room for improvement. | ||
9 | |||
10 | Bad! I was hooked. | ||
11 | I decided to annotate my steps in this file. Perhaps it is useful to someone | ||
12 | or someone learns something from it. | ||
13 | |||
14 | |||
15 | The problem | ||
16 | =========== | ||
17 | |||
18 | NAND flash (at least SLC one) typically has sectors of 256 bytes. | ||
19 | However NAND flash is not extremely reliable so some error detection | ||
20 | (and sometimes correction) is needed. | ||
21 | |||
22 | This is done by means of a Hamming code. I'll try to explain it in | ||
23 | laymans terms (and apologies to all the pro's in the field in case I do | ||
24 | not use the right terminology, my coding theory class was almost 30 | ||
25 | years ago, and I must admit it was not one of my favourites). | ||
26 | |||
27 | As I said before the ecc calculation is performed on sectors of 256 | ||
28 | bytes. This is done by calculating several parity bits over the rows and | ||
29 | columns. The parity used is even parity which means that the parity bit = 1 | ||
30 | if the data over which the parity is calculated is 1 and the parity bit = 0 | ||
31 | if the data over which the parity is calculated is 0. So the total | ||
32 | number of bits over the data over which the parity is calculated + the | ||
33 | parity bit is even. (see wikipedia if you can't follow this). | ||
34 | Parity is often calculated by means of an exclusive or operation, | ||
35 | sometimes also referred to as xor. In C the operator for xor is ^ | ||
36 | |||
37 | Back to ecc. | ||
38 | Let's give a small figure: | ||
39 | |||
40 | byte 0: bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 rp0 rp2 rp4 ... rp14 | ||
41 | byte 1: bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 rp1 rp2 rp4 ... rp14 | ||
42 | byte 2: bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 rp0 rp3 rp4 ... rp14 | ||
43 | byte 3: bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 rp1 rp3 rp4 ... rp14 | ||
44 | byte 4: bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 rp0 rp2 rp5 ... rp14 | ||
45 | .... | ||
46 | byte 254: bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 rp0 rp3 rp5 ... rp15 | ||
47 | byte 255: bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 rp1 rp3 rp5 ... rp15 | ||
48 | cp1 cp0 cp1 cp0 cp1 cp0 cp1 cp0 | ||
49 | cp3 cp3 cp2 cp2 cp3 cp3 cp2 cp2 | ||
50 | cp5 cp5 cp5 cp5 cp4 cp4 cp4 cp4 | ||
51 | |||
52 | This figure represents a sector of 256 bytes. | ||
53 | cp is my abbreviaton for column parity, rp for row parity. | ||
54 | |||
55 | Let's start to explain column parity. | ||
56 | cp0 is the parity that belongs to all bit0, bit2, bit4, bit6. | ||
57 | so the sum of all bit0, bit2, bit4 and bit6 values + cp0 itself is even. | ||
58 | Similarly cp1 is the sum of all bit1, bit3, bit5 and bit7. | ||
59 | cp2 is the parity over bit0, bit1, bit4 and bit5 | ||
60 | cp3 is the parity over bit2, bit3, bit6 and bit7. | ||
61 | cp4 is the parity over bit0, bit1, bit2 and bit3. | ||
62 | cp5 is the parity over bit4, bit5, bit6 and bit7. | ||
63 | Note that each of cp0 .. cp5 is exactly one bit. | ||
64 | |||
65 | Row parity actually works almost the same. | ||
66 | rp0 is the parity of all even bytes (0, 2, 4, 6, ... 252, 254) | ||
67 | rp1 is the parity of all odd bytes (1, 3, 5, 7, ..., 253, 255) | ||
68 | rp2 is the parity of all bytes 0, 1, 4, 5, 8, 9, ... | ||
69 | (so handle two bytes, then skip 2 bytes). | ||
70 | rp3 is covers the half rp2 does not cover (bytes 2, 3, 6, 7, 10, 11, ...) | ||
71 | for rp4 the rule is cover 4 bytes, skip 4 bytes, cover 4 bytes, skip 4 etc. | ||
72 | so rp4 calculates parity over bytes 0, 1, 2, 3, 8, 9, 10, 11, 16, ...) | ||
73 | and rp5 covers the other half, so bytes 4, 5, 6, 7, 12, 13, 14, 15, 20, .. | ||
74 | The story now becomes quite boring. I guess you get the idea. | ||
75 | rp6 covers 8 bytes then skips 8 etc | ||
76 | rp7 skips 8 bytes then covers 8 etc | ||
77 | rp8 covers 16 bytes then skips 16 etc | ||
78 | rp9 skips 16 bytes then covers 16 etc | ||
79 | rp10 covers 32 bytes then skips 32 etc | ||
80 | rp11 skips 32 bytes then covers 32 etc | ||
81 | rp12 covers 64 bytes then skips 64 etc | ||
82 | rp13 skips 64 bytes then covers 64 etc | ||
83 | rp14 covers 128 bytes then skips 128 | ||
84 | rp15 skips 128 bytes then covers 128 | ||
85 | |||
86 | In the end the parity bits are grouped together in three bytes as | ||
87 | follows: | ||
88 | ECC Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 | ||
89 | ECC 0 rp07 rp06 rp05 rp04 rp03 rp02 rp01 rp00 | ||
90 | ECC 1 rp15 rp14 rp13 rp12 rp11 rp10 rp09 rp08 | ||
91 | ECC 2 cp5 cp4 cp3 cp2 cp1 cp0 1 1 | ||
92 | |||
93 | I detected after writing this that ST application note AN1823 | ||
94 | (http://www.st.com/stonline/books/pdf/docs/10123.pdf) gives a much | ||
95 | nicer picture.(but they use line parity as term where I use row parity) | ||
96 | Oh well, I'm graphically challenged, so suffer with me for a moment :-) | ||
97 | And I could not reuse the ST picture anyway for copyright reasons. | ||
98 | |||
99 | |||
100 | Attempt 0 | ||
101 | ========= | ||
102 | |||
103 | Implementing the parity calculation is pretty simple. | ||
104 | In C pseudocode: | ||
105 | for (i = 0; i < 256; i++) | ||
106 | { | ||
107 | if (i & 0x01) | ||
108 | rp1 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp1; | ||
109 | else | ||
110 | rp0 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp1; | ||
111 | if (i & 0x02) | ||
112 | rp3 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp3; | ||
113 | else | ||
114 | rp2 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp2; | ||
115 | if (i & 0x04) | ||
116 | rp5 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp5; | ||
117 | else | ||
118 | rp4 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp4; | ||
119 | if (i & 0x08) | ||
120 | rp7 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp7; | ||
121 | else | ||
122 | rp6 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp6; | ||
123 | if (i & 0x10) | ||
124 | rp9 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp9; | ||
125 | else | ||
126 | rp8 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp8; | ||
127 | if (i & 0x20) | ||
128 | rp11 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp11; | ||
129 | else | ||
130 | rp10 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp10; | ||
131 | if (i & 0x40) | ||
132 | rp13 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp13; | ||
133 | else | ||
134 | rp12 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp12; | ||
135 | if (i & 0x80) | ||
136 | rp15 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp15; | ||
137 | else | ||
138 | rp14 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ bit3 ^ bit2 ^ bit1 ^ bit0 ^ rp14; | ||
139 | cp0 = bit6 ^ bit4 ^ bit2 ^ bit0 ^ cp0; | ||
140 | cp1 = bit7 ^ bit5 ^ bit3 ^ bit1 ^ cp1; | ||
141 | cp2 = bit5 ^ bit4 ^ bit1 ^ bit0 ^ cp2; | ||
142 | cp3 = bit7 ^ bit6 ^ bit3 ^ bit2 ^ cp3 | ||
143 | cp4 = bit3 ^ bit2 ^ bit1 ^ bit0 ^ cp4 | ||
144 | cp5 = bit7 ^ bit6 ^ bit5 ^ bit4 ^ cp5 | ||
145 | } | ||
146 | |||
147 | |||
148 | Analysis 0 | ||
149 | ========== | ||
150 | |||
151 | C does have bitwise operators but not really operators to do the above | ||
152 | efficiently (and most hardware has no such instructions either). | ||
153 | Therefore without implementing this it was clear that the code above was | ||
154 | not going to bring me a Nobel prize :-) | ||
155 | |||
156 | Fortunately the exclusive or operation is commutative, so we can combine | ||
157 | the values in any order. So instead of calculating all the bits | ||
158 | individually, let us try to rearrange things. | ||
159 | For the column parity this is easy. We can just xor the bytes and in the | ||
160 | end filter out the relevant bits. This is pretty nice as it will bring | ||
161 | all cp calculation out of the if loop. | ||
162 | |||
163 | Similarly we can first xor the bytes for the various rows. | ||
164 | This leads to: | ||
165 | |||
166 | |||
167 | Attempt 1 | ||
168 | ========= | ||
169 | |||
170 | const char parity[256] = { | ||
171 | 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, | ||
172 | 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, | ||
173 | 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, | ||
174 | 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, | ||
175 | 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, | ||
176 | 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, | ||
177 | 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, | ||
178 | 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, | ||
179 | 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, | ||
180 | 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, | ||
181 | 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, | ||
182 | 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, | ||
183 | 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, | ||
184 | 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, | ||
185 | 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, | ||
186 | 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 | ||
187 | }; | ||
188 | |||
189 | void ecc1(const unsigned char *buf, unsigned char *code) | ||
190 | { | ||
191 | int i; | ||
192 | const unsigned char *bp = buf; | ||
193 | unsigned char cur; | ||
194 | unsigned char rp0, rp1, rp2, rp3, rp4, rp5, rp6, rp7; | ||
195 | unsigned char rp8, rp9, rp10, rp11, rp12, rp13, rp14, rp15; | ||
196 | unsigned char par; | ||
197 | |||
198 | par = 0; | ||
199 | rp0 = 0; rp1 = 0; rp2 = 0; rp3 = 0; | ||
200 | rp4 = 0; rp5 = 0; rp6 = 0; rp7 = 0; | ||
201 | rp8 = 0; rp9 = 0; rp10 = 0; rp11 = 0; | ||
202 | rp12 = 0; rp13 = 0; rp14 = 0; rp15 = 0; | ||
203 | |||
204 | for (i = 0; i < 256; i++) | ||
205 | { | ||
206 | cur = *bp++; | ||
207 | par ^= cur; | ||
208 | if (i & 0x01) rp1 ^= cur; else rp0 ^= cur; | ||
209 | if (i & 0x02) rp3 ^= cur; else rp2 ^= cur; | ||
210 | if (i & 0x04) rp5 ^= cur; else rp4 ^= cur; | ||
211 | if (i & 0x08) rp7 ^= cur; else rp6 ^= cur; | ||
212 | if (i & 0x10) rp9 ^= cur; else rp8 ^= cur; | ||
213 | if (i & 0x20) rp11 ^= cur; else rp10 ^= cur; | ||
214 | if (i & 0x40) rp13 ^= cur; else rp12 ^= cur; | ||
215 | if (i & 0x80) rp15 ^= cur; else rp14 ^= cur; | ||
216 | } | ||
217 | code[0] = | ||
218 | (parity[rp7] << 7) | | ||
219 | (parity[rp6] << 6) | | ||
220 | (parity[rp5] << 5) | | ||
221 | (parity[rp4] << 4) | | ||
222 | (parity[rp3] << 3) | | ||
223 | (parity[rp2] << 2) | | ||
224 | (parity[rp1] << 1) | | ||
225 | (parity[rp0]); | ||
226 | code[1] = | ||
227 | (parity[rp15] << 7) | | ||
228 | (parity[rp14] << 6) | | ||
229 | (parity[rp13] << 5) | | ||
230 | (parity[rp12] << 4) | | ||
231 | (parity[rp11] << 3) | | ||
232 | (parity[rp10] << 2) | | ||
233 | (parity[rp9] << 1) | | ||
234 | (parity[rp8]); | ||
235 | code[2] = | ||
236 | (parity[par & 0xf0] << 7) | | ||
237 | (parity[par & 0x0f] << 6) | | ||
238 | (parity[par & 0xcc] << 5) | | ||
239 | (parity[par & 0x33] << 4) | | ||
240 | (parity[par & 0xaa] << 3) | | ||
241 | (parity[par & 0x55] << 2); | ||
242 | code[0] = ~code[0]; | ||
243 | code[1] = ~code[1]; | ||
244 | code[2] = ~code[2]; | ||
245 | } | ||
246 | |||
247 | Still pretty straightforward. The last three invert statements are there to | ||
248 | give a checksum of 0xff 0xff 0xff for an empty flash. In an empty flash | ||
249 | all data is 0xff, so the checksum then matches. | ||
250 | |||
251 | I also introduced the parity lookup. I expected this to be the fastest | ||
252 | way to calculate the parity, but I will investigate alternatives later | ||
253 | on. | ||
254 | |||
255 | |||
256 | Analysis 1 | ||
257 | ========== | ||
258 | |||
259 | The code works, but is not terribly efficient. On my system it took | ||
260 | almost 4 times as much time as the linux driver code. But hey, if it was | ||
261 | *that* easy this would have been done long before. | ||
262 | No pain. no gain. | ||
263 | |||
264 | Fortunately there is plenty of room for improvement. | ||
265 | |||
266 | In step 1 we moved from bit-wise calculation to byte-wise calculation. | ||
267 | However in C we can also use the unsigned long data type and virtually | ||
268 | every modern microprocessor supports 32 bit operations, so why not try | ||
269 | to write our code in such a way that we process data in 32 bit chunks. | ||
270 | |||
271 | Of course this means some modification as the row parity is byte by | ||
272 | byte. A quick analysis: | ||
273 | for the column parity we use the par variable. When extending to 32 bits | ||
274 | we can in the end easily calculate p0 and p1 from it. | ||
275 | (because par now consists of 4 bytes, contributing to rp1, rp0, rp1, rp0 | ||
276 | respectively) | ||
277 | also rp2 and rp3 can be easily retrieved from par as rp3 covers the | ||
278 | first two bytes and rp2 the last two bytes. | ||
279 | |||
280 | Note that of course now the loop is executed only 64 times (256/4). | ||
281 | And note that care must taken wrt byte ordering. The way bytes are | ||
282 | ordered in a long is machine dependent, and might affect us. | ||
283 | Anyway, if there is an issue: this code is developed on x86 (to be | ||
284 | precise: a DELL PC with a D920 Intel CPU) | ||
285 | |||
286 | And of course the performance might depend on alignment, but I expect | ||
287 | that the I/O buffers in the nand driver are aligned properly (and | ||
288 | otherwise that should be fixed to get maximum performance). | ||
289 | |||
290 | Let's give it a try... | ||
291 | |||
292 | |||
293 | Attempt 2 | ||
294 | ========= | ||
295 | |||
296 | extern const char parity[256]; | ||
297 | |||
298 | void ecc2(const unsigned char *buf, unsigned char *code) | ||
299 | { | ||
300 | int i; | ||
301 | const unsigned long *bp = (unsigned long *)buf; | ||
302 | unsigned long cur; | ||
303 | unsigned long rp0, rp1, rp2, rp3, rp4, rp5, rp6, rp7; | ||
304 | unsigned long rp8, rp9, rp10, rp11, rp12, rp13, rp14, rp15; | ||
305 | unsigned long par; | ||
306 | |||
307 | par = 0; | ||
308 | rp0 = 0; rp1 = 0; rp2 = 0; rp3 = 0; | ||
309 | rp4 = 0; rp5 = 0; rp6 = 0; rp7 = 0; | ||
310 | rp8 = 0; rp9 = 0; rp10 = 0; rp11 = 0; | ||
311 | rp12 = 0; rp13 = 0; rp14 = 0; rp15 = 0; | ||
312 | |||
313 | for (i = 0; i < 64; i++) | ||
314 | { | ||
315 | cur = *bp++; | ||
316 | par ^= cur; | ||
317 | if (i & 0x01) rp5 ^= cur; else rp4 ^= cur; | ||
318 | if (i & 0x02) rp7 ^= cur; else rp6 ^= cur; | ||
319 | if (i & 0x04) rp9 ^= cur; else rp8 ^= cur; | ||
320 | if (i & 0x08) rp11 ^= cur; else rp10 ^= cur; | ||
321 | if (i & 0x10) rp13 ^= cur; else rp12 ^= cur; | ||
322 | if (i & 0x20) rp15 ^= cur; else rp14 ^= cur; | ||
323 | } | ||
324 | /* | ||
325 | we need to adapt the code generation for the fact that rp vars are now | ||
326 | long; also the column parity calculation needs to be changed. | ||
327 | we'll bring rp4 to 15 back to single byte entities by shifting and | ||
328 | xoring | ||
329 | */ | ||
330 | rp4 ^= (rp4 >> 16); rp4 ^= (rp4 >> 8); rp4 &= 0xff; | ||
331 | rp5 ^= (rp5 >> 16); rp5 ^= (rp5 >> 8); rp5 &= 0xff; | ||
332 | rp6 ^= (rp6 >> 16); rp6 ^= (rp6 >> 8); rp6 &= 0xff; | ||
333 | rp7 ^= (rp7 >> 16); rp7 ^= (rp7 >> 8); rp7 &= 0xff; | ||
334 | rp8 ^= (rp8 >> 16); rp8 ^= (rp8 >> 8); rp8 &= 0xff; | ||
335 | rp9 ^= (rp9 >> 16); rp9 ^= (rp9 >> 8); rp9 &= 0xff; | ||
336 | rp10 ^= (rp10 >> 16); rp10 ^= (rp10 >> 8); rp10 &= 0xff; | ||
337 | rp11 ^= (rp11 >> 16); rp11 ^= (rp11 >> 8); rp11 &= 0xff; | ||
338 | rp12 ^= (rp12 >> 16); rp12 ^= (rp12 >> 8); rp12 &= 0xff; | ||
339 | rp13 ^= (rp13 >> 16); rp13 ^= (rp13 >> 8); rp13 &= 0xff; | ||
340 | rp14 ^= (rp14 >> 16); rp14 ^= (rp14 >> 8); rp14 &= 0xff; | ||
341 | rp15 ^= (rp15 >> 16); rp15 ^= (rp15 >> 8); rp15 &= 0xff; | ||
342 | rp3 = (par >> 16); rp3 ^= (rp3 >> 8); rp3 &= 0xff; | ||
343 | rp2 = par & 0xffff; rp2 ^= (rp2 >> 8); rp2 &= 0xff; | ||
344 | par ^= (par >> 16); | ||
345 | rp1 = (par >> 8); rp1 &= 0xff; | ||
346 | rp0 = (par & 0xff); | ||
347 | par ^= (par >> 8); par &= 0xff; | ||
348 | |||
349 | code[0] = | ||
350 | (parity[rp7] << 7) | | ||
351 | (parity[rp6] << 6) | | ||
352 | (parity[rp5] << 5) | | ||
353 | (parity[rp4] << 4) | | ||
354 | (parity[rp3] << 3) | | ||
355 | (parity[rp2] << 2) | | ||
356 | (parity[rp1] << 1) | | ||
357 | (parity[rp0]); | ||
358 | code[1] = | ||
359 | (parity[rp15] << 7) | | ||
360 | (parity[rp14] << 6) | | ||
361 | (parity[rp13] << 5) | | ||
362 | (parity[rp12] << 4) | | ||
363 | (parity[rp11] << 3) | | ||
364 | (parity[rp10] << 2) | | ||
365 | (parity[rp9] << 1) | | ||
366 | (parity[rp8]); | ||
367 | code[2] = | ||
368 | (parity[par & 0xf0] << 7) | | ||
369 | (parity[par & 0x0f] << 6) | | ||
370 | (parity[par & 0xcc] << 5) | | ||
371 | (parity[par & 0x33] << 4) | | ||
372 | (parity[par & 0xaa] << 3) | | ||
373 | (parity[par & 0x55] << 2); | ||
374 | code[0] = ~code[0]; | ||
375 | code[1] = ~code[1]; | ||
376 | code[2] = ~code[2]; | ||
377 | } | ||
378 | |||
379 | The parity array is not shown any more. Note also that for these | ||
380 | examples I kinda deviated from my regular programming style by allowing | ||
381 | multiple statements on a line, not using { } in then and else blocks | ||
382 | with only a single statement and by using operators like ^= | ||
383 | |||
384 | |||
385 | Analysis 2 | ||
386 | ========== | ||
387 | |||
388 | The code (of course) works, and hurray: we are a little bit faster than | ||
389 | the linux driver code (about 15%). But wait, don't cheer too quickly. | ||
390 | THere is more to be gained. | ||
391 | If we look at e.g. rp14 and rp15 we see that we either xor our data with | ||
392 | rp14 or with rp15. However we also have par which goes over all data. | ||
393 | This means there is no need to calculate rp14 as it can be calculated from | ||
394 | rp15 through rp14 = par ^ rp15; | ||
395 | (or if desired we can avoid calculating rp15 and calculate it from | ||
396 | rp14). That is why some places refer to inverse parity. | ||
397 | Of course the same thing holds for rp4/5, rp6/7, rp8/9, rp10/11 and rp12/13. | ||
398 | Effectively this means we can eliminate the else clause from the if | ||
399 | statements. Also we can optimise the calculation in the end a little bit | ||
400 | by going from long to byte first. Actually we can even avoid the table | ||
401 | lookups | ||
402 | |||
403 | Attempt 3 | ||
404 | ========= | ||
405 | |||
406 | Odd replaced: | ||
407 | if (i & 0x01) rp5 ^= cur; else rp4 ^= cur; | ||
408 | if (i & 0x02) rp7 ^= cur; else rp6 ^= cur; | ||
409 | if (i & 0x04) rp9 ^= cur; else rp8 ^= cur; | ||
410 | if (i & 0x08) rp11 ^= cur; else rp10 ^= cur; | ||
411 | if (i & 0x10) rp13 ^= cur; else rp12 ^= cur; | ||
412 | if (i & 0x20) rp15 ^= cur; else rp14 ^= cur; | ||
413 | with | ||
414 | if (i & 0x01) rp5 ^= cur; | ||
415 | if (i & 0x02) rp7 ^= cur; | ||
416 | if (i & 0x04) rp9 ^= cur; | ||
417 | if (i & 0x08) rp11 ^= cur; | ||
418 | if (i & 0x10) rp13 ^= cur; | ||
419 | if (i & 0x20) rp15 ^= cur; | ||
420 | |||
421 | and outside the loop added: | ||
422 | rp4 = par ^ rp5; | ||
423 | rp6 = par ^ rp7; | ||
424 | rp8 = par ^ rp9; | ||
425 | rp10 = par ^ rp11; | ||
426 | rp12 = par ^ rp13; | ||
427 | rp14 = par ^ rp15; | ||
428 | |||
429 | And after that the code takes about 30% more time, although the number of | ||
430 | statements is reduced. This is also reflected in the assembly code. | ||
431 | |||
432 | |||
433 | Analysis 3 | ||
434 | ========== | ||
435 | |||
436 | Very weird. Guess it has to do with caching or instruction parallellism | ||
437 | or so. I also tried on an eeePC (Celeron, clocked at 900 Mhz). Interesting | ||
438 | observation was that this one is only 30% slower (according to time) | ||
439 | executing the code as my 3Ghz D920 processor. | ||
440 | |||
441 | Well, it was expected not to be easy so maybe instead move to a | ||
442 | different track: let's move back to the code from attempt2 and do some | ||
443 | loop unrolling. This will eliminate a few if statements. I'll try | ||
444 | different amounts of unrolling to see what works best. | ||
445 | |||
446 | |||
447 | Attempt 4 | ||
448 | ========= | ||
449 | |||
450 | Unrolled the loop 1, 2, 3 and 4 times. | ||
451 | For 4 the code starts with: | ||
452 | |||
453 | for (i = 0; i < 4; i++) | ||
454 | { | ||
455 | cur = *bp++; | ||
456 | par ^= cur; | ||
457 | rp4 ^= cur; | ||
458 | rp6 ^= cur; | ||
459 | rp8 ^= cur; | ||
460 | rp10 ^= cur; | ||
461 | if (i & 0x1) rp13 ^= cur; else rp12 ^= cur; | ||
462 | if (i & 0x2) rp15 ^= cur; else rp14 ^= cur; | ||
463 | cur = *bp++; | ||
464 | par ^= cur; | ||
465 | rp5 ^= cur; | ||
466 | rp6 ^= cur; | ||
467 | ... | ||
468 | |||
469 | |||
470 | Analysis 4 | ||
471 | ========== | ||
472 | |||
473 | Unrolling once gains about 15% | ||
474 | Unrolling twice keeps the gain at about 15% | ||
475 | Unrolling three times gives a gain of 30% compared to attempt 2. | ||
476 | Unrolling four times gives a marginal improvement compared to unrolling | ||
477 | three times. | ||
478 | |||
479 | I decided to proceed with a four time unrolled loop anyway. It was my gut | ||
480 | feeling that in the next steps I would obtain additional gain from it. | ||
481 | |||
482 | The next step was triggered by the fact that par contains the xor of all | ||
483 | bytes and rp4 and rp5 each contain the xor of half of the bytes. | ||
484 | So in effect par = rp4 ^ rp5. But as xor is commutative we can also say | ||
485 | that rp5 = par ^ rp4. So no need to keep both rp4 and rp5 around. We can | ||
486 | eliminate rp5 (or rp4, but I already foresaw another optimisation). | ||
487 | The same holds for rp6/7, rp8/9, rp10/11 rp12/13 and rp14/15. | ||
488 | |||
489 | |||
490 | Attempt 5 | ||
491 | ========= | ||
492 | |||
493 | Effectively so all odd digit rp assignments in the loop were removed. | ||
494 | This included the else clause of the if statements. | ||
495 | Of course after the loop we need to correct things by adding code like: | ||
496 | rp5 = par ^ rp4; | ||
497 | Also the initial assignments (rp5 = 0; etc) could be removed. | ||
498 | Along the line I also removed the initialisation of rp0/1/2/3. | ||
499 | |||
500 | |||
501 | Analysis 5 | ||
502 | ========== | ||
503 | |||
504 | Measurements showed this was a good move. The run-time roughly halved | ||
505 | compared with attempt 4 with 4 times unrolled, and we only require 1/3rd | ||
506 | of the processor time compared to the current code in the linux kernel. | ||
507 | |||
508 | However, still I thought there was more. I didn't like all the if | ||
509 | statements. Why not keep a running parity and only keep the last if | ||
510 | statement. Time for yet another version! | ||
511 | |||
512 | |||
513 | Attempt 6 | ||
514 | ========= | ||
515 | |||
516 | THe code within the for loop was changed to: | ||
517 | |||
518 | for (i = 0; i < 4; i++) | ||
519 | { | ||
520 | cur = *bp++; tmppar = cur; rp4 ^= cur; | ||
521 | cur = *bp++; tmppar ^= cur; rp6 ^= tmppar; | ||
522 | cur = *bp++; tmppar ^= cur; rp4 ^= cur; | ||
523 | cur = *bp++; tmppar ^= cur; rp8 ^= tmppar; | ||
524 | |||
525 | cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp6 ^= cur; | ||
526 | cur = *bp++; tmppar ^= cur; rp6 ^= cur; | ||
527 | cur = *bp++; tmppar ^= cur; rp4 ^= cur; | ||
528 | cur = *bp++; tmppar ^= cur; rp10 ^= tmppar; | ||
529 | |||
530 | cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp6 ^= cur; rp8 ^= cur; | ||
531 | cur = *bp++; tmppar ^= cur; rp6 ^= cur; rp8 ^= cur; | ||
532 | cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp8 ^= cur; | ||
533 | cur = *bp++; tmppar ^= cur; rp8 ^= cur; | ||
534 | |||
535 | cur = *bp++; tmppar ^= cur; rp4 ^= cur; rp6 ^= cur; | ||
536 | cur = *bp++; tmppar ^= cur; rp6 ^= cur; | ||
537 | cur = *bp++; tmppar ^= cur; rp4 ^= cur; | ||
538 | cur = *bp++; tmppar ^= cur; | ||
539 | |||
540 | par ^= tmppar; | ||
541 | if ((i & 0x1) == 0) rp12 ^= tmppar; | ||
542 | if ((i & 0x2) == 0) rp14 ^= tmppar; | ||
543 | } | ||
544 | |||
545 | As you can see tmppar is used to accumulate the parity within a for | ||
546 | iteration. In the last 3 statements is is added to par and, if needed, | ||
547 | to rp12 and rp14. | ||
548 | |||
549 | While making the changes I also found that I could exploit that tmppar | ||
550 | contains the running parity for this iteration. So instead of having: | ||
551 | rp4 ^= cur; rp6 = cur; | ||
552 | I removed the rp6 = cur; statement and did rp6 ^= tmppar; on next | ||
553 | statement. A similar change was done for rp8 and rp10 | ||
554 | |||
555 | |||
556 | Analysis 6 | ||
557 | ========== | ||
558 | |||
559 | Measuring this code again showed big gain. When executing the original | ||
560 | linux code 1 million times, this took about 1 second on my system. | ||
561 | (using time to measure the performance). After this iteration I was back | ||
562 | to 0.075 sec. Actually I had to decide to start measuring over 10 | ||
563 | million interations in order not to loose too much accuracy. This one | ||
564 | definitely seemed to be the jackpot! | ||
565 | |||
566 | There is a little bit more room for improvement though. There are three | ||
567 | places with statements: | ||
568 | rp4 ^= cur; rp6 ^= cur; | ||
569 | It seems more efficient to also maintain a variable rp4_6 in the while | ||
570 | loop; This eliminates 3 statements per loop. Of course after the loop we | ||
571 | need to correct by adding: | ||
572 | rp4 ^= rp4_6; | ||
573 | rp6 ^= rp4_6 | ||
574 | Furthermore there are 4 sequential assingments to rp8. This can be | ||
575 | encoded slightly more efficient by saving tmppar before those 4 lines | ||
576 | and later do rp8 = rp8 ^ tmppar ^ notrp8; | ||
577 | (where notrp8 is the value of rp8 before those 4 lines). | ||
578 | Again a use of the commutative property of xor. | ||
579 | Time for a new test! | ||
580 | |||
581 | |||
582 | Attempt 7 | ||
583 | ========= | ||
584 | |||
585 | The new code now looks like: | ||
586 | |||
587 | for (i = 0; i < 4; i++) | ||
588 | { | ||
589 | cur = *bp++; tmppar = cur; rp4 ^= cur; | ||
590 | cur = *bp++; tmppar ^= cur; rp6 ^= tmppar; | ||
591 | cur = *bp++; tmppar ^= cur; rp4 ^= cur; | ||
592 | cur = *bp++; tmppar ^= cur; rp8 ^= tmppar; | ||
593 | |||
594 | cur = *bp++; tmppar ^= cur; rp4_6 ^= cur; | ||
595 | cur = *bp++; tmppar ^= cur; rp6 ^= cur; | ||
596 | cur = *bp++; tmppar ^= cur; rp4 ^= cur; | ||
597 | cur = *bp++; tmppar ^= cur; rp10 ^= tmppar; | ||
598 | |||
599 | notrp8 = tmppar; | ||
600 | cur = *bp++; tmppar ^= cur; rp4_6 ^= cur; | ||
601 | cur = *bp++; tmppar ^= cur; rp6 ^= cur; | ||
602 | cur = *bp++; tmppar ^= cur; rp4 ^= cur; | ||
603 | cur = *bp++; tmppar ^= cur; | ||
604 | rp8 = rp8 ^ tmppar ^ notrp8; | ||
605 | |||
606 | cur = *bp++; tmppar ^= cur; rp4_6 ^= cur; | ||
607 | cur = *bp++; tmppar ^= cur; rp6 ^= cur; | ||
608 | cur = *bp++; tmppar ^= cur; rp4 ^= cur; | ||
609 | cur = *bp++; tmppar ^= cur; | ||
610 | |||
611 | par ^= tmppar; | ||
612 | if ((i & 0x1) == 0) rp12 ^= tmppar; | ||
613 | if ((i & 0x2) == 0) rp14 ^= tmppar; | ||
614 | } | ||
615 | rp4 ^= rp4_6; | ||
616 | rp6 ^= rp4_6; | ||
617 | |||
618 | |||
619 | Not a big change, but every penny counts :-) | ||
620 | |||
621 | |||
622 | Analysis 7 | ||
623 | ========== | ||
624 | |||
625 | Acutally this made things worse. Not very much, but I don't want to move | ||
626 | into the wrong direction. Maybe something to investigate later. Could | ||
627 | have to do with caching again. | ||
628 | |||
629 | Guess that is what there is to win within the loop. Maybe unrolling one | ||
630 | more time will help. I'll keep the optimisations from 7 for now. | ||
631 | |||
632 | |||
633 | Attempt 8 | ||
634 | ========= | ||
635 | |||
636 | Unrolled the loop one more time. | ||
637 | |||
638 | |||
639 | Analysis 8 | ||
640 | ========== | ||
641 | |||
642 | This makes things worse. Let's stick with attempt 6 and continue from there. | ||
643 | Although it seems that the code within the loop cannot be optimised | ||
644 | further there is still room to optimize the generation of the ecc codes. | ||
645 | We can simply calcualate the total parity. If this is 0 then rp4 = rp5 | ||
646 | etc. If the parity is 1, then rp4 = !rp5; | ||
647 | But if rp4 = rp5 we do not need rp5 etc. We can just write the even bits | ||
648 | in the result byte and then do something like | ||
649 | code[0] |= (code[0] << 1); | ||
650 | Lets test this. | ||
651 | |||
652 | |||
653 | Attempt 9 | ||
654 | ========= | ||
655 | |||
656 | Changed the code but again this slightly degrades performance. Tried all | ||
657 | kind of other things, like having dedicated parity arrays to avoid the | ||
658 | shift after parity[rp7] << 7; No gain. | ||
659 | Change the lookup using the parity array by using shift operators (e.g. | ||
660 | replace parity[rp7] << 7 with: | ||
661 | rp7 ^= (rp7 << 4); | ||
662 | rp7 ^= (rp7 << 2); | ||
663 | rp7 ^= (rp7 << 1); | ||
664 | rp7 &= 0x80; | ||
665 | No gain. | ||
666 | |||
667 | The only marginal change was inverting the parity bits, so we can remove | ||
668 | the last three invert statements. | ||
669 | |||
670 | Ah well, pity this does not deliver more. Then again 10 million | ||
671 | iterations using the linux driver code takes between 13 and 13.5 | ||
672 | seconds, whereas my code now takes about 0.73 seconds for those 10 | ||
673 | million iterations. So basically I've improved the performance by a | ||
674 | factor 18 on my system. Not that bad. Of course on different hardware | ||
675 | you will get different results. No warranties! | ||
676 | |||
677 | But of course there is no such thing as a free lunch. The codesize almost | ||
678 | tripled (from 562 bytes to 1434 bytes). Then again, it is not that much. | ||
679 | |||
680 | |||
681 | Correcting errors | ||
682 | ================= | ||
683 | |||
684 | For correcting errors I again used the ST application note as a starter, | ||
685 | but I also peeked at the existing code. | ||
686 | The algorithm itself is pretty straightforward. Just xor the given and | ||
687 | the calculated ecc. If all bytes are 0 there is no problem. If 11 bits | ||
688 | are 1 we have one correctable bit error. If there is 1 bit 1, we have an | ||
689 | error in the given ecc code. | ||
690 | It proved to be fastest to do some table lookups. Performance gain | ||
691 | introduced by this is about a factor 2 on my system when a repair had to | ||
692 | be done, and 1% or so if no repair had to be done. | ||
693 | Code size increased from 330 bytes to 686 bytes for this function. | ||
694 | (gcc 4.2, -O3) | ||
695 | |||
696 | |||
697 | Conclusion | ||
698 | ========== | ||
699 | |||
700 | The gain when calculating the ecc is tremendous. Om my development hardware | ||
701 | a speedup of a factor of 18 for ecc calculation was achieved. On a test on an | ||
702 | embedded system with a MIPS core a factor 7 was obtained. | ||
703 | On a test with a Linksys NSLU2 (ARMv5TE processor) the speedup was a factor | ||
704 | 5 (big endian mode, gcc 4.1.2, -O3) | ||
705 | For correction not much gain could be obtained (as bitflips are rare). Then | ||
706 | again there are also much less cycles spent there. | ||
707 | |||
708 | It seems there is not much more gain possible in this, at least when | ||
709 | programmed in C. Of course it might be possible to squeeze something more | ||
710 | out of it with an assembler program, but due to pipeline behaviour etc | ||
711 | this is very tricky (at least for intel hw). | ||
712 | |||
713 | Author: Frans Meulenbroeks | ||
714 | Copyright (C) 2008 Koninklijke Philips Electronics NV. | ||
diff --git a/Documentation/networking/LICENSE.qlge b/Documentation/networking/LICENSE.qlge new file mode 100644 index 000000000000..123b6edd7f18 --- /dev/null +++ b/Documentation/networking/LICENSE.qlge | |||
@@ -0,0 +1,46 @@ | |||
1 | Copyright (c) 2003-2008 QLogic Corporation | ||
2 | QLogic Linux Networking HBA Driver | ||
3 | |||
4 | This program includes a device driver for Linux 2.6 that may be | ||
5 | distributed with QLogic hardware specific firmware binary file. | ||
6 | You may modify and redistribute the device driver code under the | ||
7 | GNU General Public License as published by the Free Software | ||
8 | Foundation (version 2 or a later version). | ||
9 | |||
10 | You may redistribute the hardware specific firmware binary file | ||
11 | under the following terms: | ||
12 | |||
13 | 1. Redistribution of source code (only if applicable), | ||
14 | must retain the above copyright notice, this list of | ||
15 | conditions and the following disclaimer. | ||
16 | |||
17 | 2. Redistribution in binary form must reproduce the above | ||
18 | copyright notice, this list of conditions and the | ||
19 | following disclaimer in the documentation and/or other | ||
20 | materials provided with the distribution. | ||
21 | |||
22 | 3. The name of QLogic Corporation may not be used to | ||
23 | endorse or promote products derived from this software | ||
24 | without specific prior written permission | ||
25 | |||
26 | REGARDLESS OF WHAT LICENSING MECHANISM IS USED OR APPLICABLE, | ||
27 | THIS PROGRAM IS PROVIDED BY QLOGIC CORPORATION "AS IS'' AND ANY | ||
28 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
29 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||
30 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR | ||
31 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
32 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | ||
33 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
34 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
35 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
36 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
37 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
38 | POSSIBILITY OF SUCH DAMAGE. | ||
39 | |||
40 | USER ACKNOWLEDGES AND AGREES THAT USE OF THIS PROGRAM WILL NOT | ||
41 | CREATE OR GIVE GROUNDS FOR A LICENSE BY IMPLICATION, ESTOPPEL, OR | ||
42 | OTHERWISE IN ANY INTELLECTUAL PROPERTY RIGHTS (PATENT, COPYRIGHT, | ||
43 | TRADE SECRET, MASK WORK, OR OTHER PROPRIETARY RIGHT) EMBODIED IN | ||
44 | ANY OTHER QLOGIC HARDWARE OR SOFTWARE EITHER SOLELY OR IN | ||
45 | COMBINATION WITH THIS PROGRAM. | ||
46 | |||
diff --git a/Documentation/networking/Makefile b/Documentation/networking/Makefile new file mode 100644 index 000000000000..6d8af1ac56c4 --- /dev/null +++ b/Documentation/networking/Makefile | |||
@@ -0,0 +1,8 @@ | |||
1 | # kbuild trick to avoid linker error. Can be omitted if a module is built. | ||
2 | obj- := dummy.o | ||
3 | |||
4 | # List of programs to build | ||
5 | hostprogs-y := ifenslave | ||
6 | |||
7 | # Tell kbuild to always build the programs | ||
8 | always := $(hostprogs-y) | ||
diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt index a0cda062bc33..688dfe1e6b70 100644 --- a/Documentation/networking/bonding.txt +++ b/Documentation/networking/bonding.txt | |||
@@ -289,35 +289,73 @@ downdelay | |||
289 | fail_over_mac | 289 | fail_over_mac |
290 | 290 | ||
291 | Specifies whether active-backup mode should set all slaves to | 291 | Specifies whether active-backup mode should set all slaves to |
292 | the same MAC address (the traditional behavior), or, when | 292 | the same MAC address at enslavement (the traditional |
293 | enabled, change the bond's MAC address when changing the | 293 | behavior), or, when enabled, perform special handling of the |
294 | active interface (i.e., fail over the MAC address itself). | 294 | bond's MAC address in accordance with the selected policy. |
295 | 295 | ||
296 | Fail over MAC is useful for devices that cannot ever alter | 296 | Possible values are: |
297 | their MAC address, or for devices that refuse incoming | 297 | |
298 | broadcasts with their own source MAC (which interferes with | 298 | none or 0 |
299 | the ARP monitor). | 299 | |
300 | 300 | This setting disables fail_over_mac, and causes | |
301 | The down side of fail over MAC is that every device on the | 301 | bonding to set all slaves of an active-backup bond to |
302 | network must be updated via gratuitous ARP, vs. just updating | 302 | the same MAC address at enslavement time. This is the |
303 | a switch or set of switches (which often takes place for any | 303 | default. |
304 | traffic, not just ARP traffic, if the switch snoops incoming | 304 | |
305 | traffic to update its tables) for the traditional method. If | 305 | active or 1 |
306 | the gratuitous ARP is lost, communication may be disrupted. | 306 | |
307 | 307 | The "active" fail_over_mac policy indicates that the | |
308 | When fail over MAC is used in conjuction with the mii monitor, | 308 | MAC address of the bond should always be the MAC |
309 | devices which assert link up prior to being able to actually | 309 | address of the currently active slave. The MAC |
310 | transmit and receive are particularly susecptible to loss of | 310 | address of the slaves is not changed; instead, the MAC |
311 | the gratuitous ARP, and an appropriate updelay setting may be | 311 | address of the bond changes during a failover. |
312 | required. | 312 | |
313 | 313 | This policy is useful for devices that cannot ever | |
314 | A value of 0 disables fail over MAC, and is the default. A | 314 | alter their MAC address, or for devices that refuse |
315 | value of 1 enables fail over MAC. This option is enabled | 315 | incoming broadcasts with their own source MAC (which |
316 | automatically if the first slave added cannot change its MAC | 316 | interferes with the ARP monitor). |
317 | address. This option may be modified via sysfs only when no | 317 | |
318 | slaves are present in the bond. | 318 | The down side of this policy is that every device on |
319 | 319 | the network must be updated via gratuitous ARP, | |
320 | This option was added in bonding version 3.2.0. | 320 | vs. just updating a switch or set of switches (which |
321 | often takes place for any traffic, not just ARP | ||
322 | traffic, if the switch snoops incoming traffic to | ||
323 | update its tables) for the traditional method. If the | ||
324 | gratuitous ARP is lost, communication may be | ||
325 | disrupted. | ||
326 | |||
327 | When this policy is used in conjuction with the mii | ||
328 | monitor, devices which assert link up prior to being | ||
329 | able to actually transmit and receive are particularly | ||
330 | susecptible to loss of the gratuitous ARP, and an | ||
331 | appropriate updelay setting may be required. | ||
332 | |||
333 | follow or 2 | ||
334 | |||
335 | The "follow" fail_over_mac policy causes the MAC | ||
336 | address of the bond to be selected normally (normally | ||
337 | the MAC address of the first slave added to the bond). | ||
338 | However, the second and subsequent slaves are not set | ||
339 | to this MAC address while they are in a backup role; a | ||
340 | slave is programmed with the bond's MAC address at | ||
341 | failover time (and the formerly active slave receives | ||
342 | the newly active slave's MAC address). | ||
343 | |||
344 | This policy is useful for multiport devices that | ||
345 | either become confused or incur a performance penalty | ||
346 | when multiple ports are programmed with the same MAC | ||
347 | address. | ||
348 | |||
349 | |||
350 | The default policy is none, unless the first slave cannot | ||
351 | change its MAC address, in which case the active policy is | ||
352 | selected by default. | ||
353 | |||
354 | This option may be modified via sysfs only when no slaves are | ||
355 | present in the bond. | ||
356 | |||
357 | This option was added in bonding version 3.2.0. The "follow" | ||
358 | policy was added in bonding version 3.3.0. | ||
321 | 359 | ||
322 | lacp_rate | 360 | lacp_rate |
323 | 361 | ||
@@ -338,7 +376,8 @@ max_bonds | |||
338 | Specifies the number of bonding devices to create for this | 376 | Specifies the number of bonding devices to create for this |
339 | instance of the bonding driver. E.g., if max_bonds is 3, and | 377 | instance of the bonding driver. E.g., if max_bonds is 3, and |
340 | the bonding driver is not already loaded, then bond0, bond1 | 378 | the bonding driver is not already loaded, then bond0, bond1 |
341 | and bond2 will be created. The default value is 1. | 379 | and bond2 will be created. The default value is 1. Specifying |
380 | a value of 0 will load bonding, but will not create any devices. | ||
342 | 381 | ||
343 | miimon | 382 | miimon |
344 | 383 | ||
@@ -501,6 +540,17 @@ mode | |||
501 | swapped with the new curr_active_slave that was | 540 | swapped with the new curr_active_slave that was |
502 | chosen. | 541 | chosen. |
503 | 542 | ||
543 | num_grat_arp | ||
544 | |||
545 | Specifies the number of gratuitous ARPs to be issued after a | ||
546 | failover event. One gratuitous ARP is issued immediately after | ||
547 | the failover, subsequent ARPs are sent at a rate of one per link | ||
548 | monitor interval (arp_interval or miimon, whichever is active). | ||
549 | |||
550 | The valid range is 0 - 255; the default value is 1. This option | ||
551 | affects only the active-backup mode. This option was added for | ||
552 | bonding version 3.3.0. | ||
553 | |||
504 | primary | 554 | primary |
505 | 555 | ||
506 | A string (eth0, eth2, etc) specifying which slave is the | 556 | A string (eth0, eth2, etc) specifying which slave is the |
@@ -581,7 +631,7 @@ xmit_hash_policy | |||
581 | in environments where a layer3 gateway device is | 631 | in environments where a layer3 gateway device is |
582 | required to reach most destinations. | 632 | required to reach most destinations. |
583 | 633 | ||
584 | This algorithm is 802.3ad complient. | 634 | This algorithm is 802.3ad compliant. |
585 | 635 | ||
586 | layer3+4 | 636 | layer3+4 |
587 | 637 | ||
diff --git a/Documentation/networking/can.txt b/Documentation/networking/can.txt index 641d2afacffa..2035bc4932f2 100644 --- a/Documentation/networking/can.txt +++ b/Documentation/networking/can.txt | |||
@@ -35,8 +35,9 @@ This file contains | |||
35 | 6.1 general settings | 35 | 6.1 general settings |
36 | 6.2 local loopback of sent frames | 36 | 6.2 local loopback of sent frames |
37 | 6.3 CAN controller hardware filters | 37 | 6.3 CAN controller hardware filters |
38 | 6.4 currently supported CAN hardware | 38 | 6.4 The virtual CAN driver (vcan) |
39 | 6.5 todo | 39 | 6.5 currently supported CAN hardware |
40 | 6.6 todo | ||
40 | 41 | ||
41 | 7 Credits | 42 | 7 Credits |
42 | 43 | ||
@@ -186,7 +187,7 @@ solution for a couple of reasons: | |||
186 | 187 | ||
187 | The Linux network devices (by default) just can handle the | 188 | The Linux network devices (by default) just can handle the |
188 | transmission and reception of media dependent frames. Due to the | 189 | transmission and reception of media dependent frames. Due to the |
189 | arbritration on the CAN bus the transmission of a low prio CAN-ID | 190 | arbitration on the CAN bus the transmission of a low prio CAN-ID |
190 | may be delayed by the reception of a high prio CAN frame. To | 191 | may be delayed by the reception of a high prio CAN frame. To |
191 | reflect the correct* traffic on the node the loopback of the sent | 192 | reflect the correct* traffic on the node the loopback of the sent |
192 | data has to be performed right after a successful transmission. If | 193 | data has to be performed right after a successful transmission. If |
@@ -481,7 +482,7 @@ solution for a couple of reasons: | |||
481 | - stats_timer: To calculate the Socket CAN core statistics | 482 | - stats_timer: To calculate the Socket CAN core statistics |
482 | (e.g. current/maximum frames per second) this 1 second timer is | 483 | (e.g. current/maximum frames per second) this 1 second timer is |
483 | invoked at can.ko module start time by default. This timer can be | 484 | invoked at can.ko module start time by default. This timer can be |
484 | disabled by using stattimer=0 on the module comandline. | 485 | disabled by using stattimer=0 on the module commandline. |
485 | 486 | ||
486 | - debug: (removed since SocketCAN SVN r546) | 487 | - debug: (removed since SocketCAN SVN r546) |
487 | 488 | ||
@@ -584,7 +585,42 @@ solution for a couple of reasons: | |||
584 | @133MHz with four SJA1000 CAN controllers from 2002 under heavy bus | 585 | @133MHz with four SJA1000 CAN controllers from 2002 under heavy bus |
585 | load without any problems ... | 586 | load without any problems ... |
586 | 587 | ||
587 | 6.4 currently supported CAN hardware (September 2007) | 588 | 6.4 The virtual CAN driver (vcan) |
589 | |||
590 | Similar to the network loopback devices, vcan offers a virtual local | ||
591 | CAN interface. A full qualified address on CAN consists of | ||
592 | |||
593 | - a unique CAN Identifier (CAN ID) | ||
594 | - the CAN bus this CAN ID is transmitted on (e.g. can0) | ||
595 | |||
596 | so in common use cases more than one virtual CAN interface is needed. | ||
597 | |||
598 | The virtual CAN interfaces allow the transmission and reception of CAN | ||
599 | frames without real CAN controller hardware. Virtual CAN network | ||
600 | devices are usually named 'vcanX', like vcan0 vcan1 vcan2 ... | ||
601 | When compiled as a module the virtual CAN driver module is called vcan.ko | ||
602 | |||
603 | Since Linux Kernel version 2.6.24 the vcan driver supports the Kernel | ||
604 | netlink interface to create vcan network devices. The creation and | ||
605 | removal of vcan network devices can be managed with the ip(8) tool: | ||
606 | |||
607 | - Create a virtual CAN network interface: | ||
608 | ip link add type vcan | ||
609 | |||
610 | - Create a virtual CAN network interface with a specific name 'vcan42': | ||
611 | ip link add dev vcan42 type vcan | ||
612 | |||
613 | - Remove a (virtual CAN) network interface 'vcan42': | ||
614 | ip link del vcan42 | ||
615 | |||
616 | The tool 'vcan' from the SocketCAN SVN repository on BerliOS is obsolete. | ||
617 | |||
618 | Virtual CAN network device creation in older Kernels: | ||
619 | In Linux Kernel versions < 2.6.24 the vcan driver creates 4 vcan | ||
620 | netdevices at module load time by default. This value can be changed | ||
621 | with the module parameter 'numdev'. E.g. 'modprobe vcan numdev=8' | ||
622 | |||
623 | 6.5 currently supported CAN hardware | ||
588 | 624 | ||
589 | On the project website http://developer.berlios.de/projects/socketcan | 625 | On the project website http://developer.berlios.de/projects/socketcan |
590 | there are different drivers available: | 626 | there are different drivers available: |
@@ -603,7 +639,7 @@ solution for a couple of reasons: | |||
603 | 639 | ||
604 | Please check the Mailing Lists on the berlios OSS project website. | 640 | Please check the Mailing Lists on the berlios OSS project website. |
605 | 641 | ||
606 | 6.5 todo (September 2007) | 642 | 6.6 todo |
607 | 643 | ||
608 | The configuration interface for CAN network drivers is still an open | 644 | The configuration interface for CAN network drivers is still an open |
609 | issue that has not been finalized in the socketcan project. Also the | 645 | issue that has not been finalized in the socketcan project. Also the |
diff --git a/Documentation/networking/cs89x0.txt b/Documentation/networking/cs89x0.txt index 6387d3decf85..c725d33b316f 100644 --- a/Documentation/networking/cs89x0.txt +++ b/Documentation/networking/cs89x0.txt | |||
@@ -3,7 +3,7 @@ NOTE | |||
3 | ---- | 3 | ---- |
4 | 4 | ||
5 | This document was contributed by Cirrus Logic for kernel 2.2.5. This version | 5 | This document was contributed by Cirrus Logic for kernel 2.2.5. This version |
6 | has been updated for 2.3.48 by Andrew Morton <andrewm@uow.edu.au> | 6 | has been updated for 2.3.48 by Andrew Morton. |
7 | 7 | ||
8 | Cirrus make a copy of this driver available at their website, as | 8 | Cirrus make a copy of this driver available at their website, as |
9 | described below. In general, you should use the driver version which | 9 | described below. In general, you should use the driver version which |
@@ -690,7 +690,7 @@ latest drivers and technical publications. | |||
690 | 6.4 Current maintainer | 690 | 6.4 Current maintainer |
691 | 691 | ||
692 | In February 2000 the maintenance of this driver was assumed by Andrew | 692 | In February 2000 the maintenance of this driver was assumed by Andrew |
693 | Morton <akpm@zip.com.au> | 693 | Morton. |
694 | 694 | ||
695 | 6.5 Kernel module parameters | 695 | 6.5 Kernel module parameters |
696 | 696 | ||
diff --git a/Documentation/networking/dm9000.txt b/Documentation/networking/dm9000.txt new file mode 100644 index 000000000000..65df3dea5561 --- /dev/null +++ b/Documentation/networking/dm9000.txt | |||
@@ -0,0 +1,167 @@ | |||
1 | DM9000 Network driver | ||
2 | ===================== | ||
3 | |||
4 | Copyright 2008 Simtec Electronics, | ||
5 | Ben Dooks <ben@simtec.co.uk> <ben-linux@fluff.org> | ||
6 | |||
7 | |||
8 | Introduction | ||
9 | ------------ | ||
10 | |||
11 | This file describes how to use the DM9000 platform-device based network driver | ||
12 | that is contained in the files drivers/net/dm9000.c and drivers/net/dm9000.h. | ||
13 | |||
14 | The driver supports three DM9000 variants, the DM9000E which is the first chip | ||
15 | supported as well as the newer DM9000A and DM9000B devices. It is currently | ||
16 | maintained and tested by Ben Dooks, who should be CC: to any patches for this | ||
17 | driver. | ||
18 | |||
19 | |||
20 | Defining the platform device | ||
21 | ---------------------------- | ||
22 | |||
23 | The minimum set of resources attached to the platform device are as follows: | ||
24 | |||
25 | 1) The physical address of the address register | ||
26 | 2) The physical address of the data register | ||
27 | 3) The IRQ line the device's interrupt pin is connected to. | ||
28 | |||
29 | These resources should be specified in that order, as the ordering of the | ||
30 | two address regions is important (the driver expects these to be address | ||
31 | and then data). | ||
32 | |||
33 | An example from arch/arm/mach-s3c2410/mach-bast.c is: | ||
34 | |||
35 | static struct resource bast_dm9k_resource[] = { | ||
36 | [0] = { | ||
37 | .start = S3C2410_CS5 + BAST_PA_DM9000, | ||
38 | .end = S3C2410_CS5 + BAST_PA_DM9000 + 3, | ||
39 | .flags = IORESOURCE_MEM, | ||
40 | }, | ||
41 | [1] = { | ||
42 | .start = S3C2410_CS5 + BAST_PA_DM9000 + 0x40, | ||
43 | .end = S3C2410_CS5 + BAST_PA_DM9000 + 0x40 + 0x3f, | ||
44 | .flags = IORESOURCE_MEM, | ||
45 | }, | ||
46 | [2] = { | ||
47 | .start = IRQ_DM9000, | ||
48 | .end = IRQ_DM9000, | ||
49 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, | ||
50 | } | ||
51 | }; | ||
52 | |||
53 | static struct platform_device bast_device_dm9k = { | ||
54 | .name = "dm9000", | ||
55 | .id = 0, | ||
56 | .num_resources = ARRAY_SIZE(bast_dm9k_resource), | ||
57 | .resource = bast_dm9k_resource, | ||
58 | }; | ||
59 | |||
60 | Note the setting of the IRQ trigger flag in bast_dm9k_resource[2].flags, | ||
61 | as this will generate a warning if it is not present. The trigger from | ||
62 | the flags field will be passed to request_irq() when registering the IRQ | ||
63 | handler to ensure that the IRQ is setup correctly. | ||
64 | |||
65 | This shows a typical platform device, without the optional configuration | ||
66 | platform data supplied. The next example uses the same resources, but adds | ||
67 | the optional platform data to pass extra configuration data: | ||
68 | |||
69 | static struct dm9000_plat_data bast_dm9k_platdata = { | ||
70 | .flags = DM9000_PLATF_16BITONLY, | ||
71 | }; | ||
72 | |||
73 | static struct platform_device bast_device_dm9k = { | ||
74 | .name = "dm9000", | ||
75 | .id = 0, | ||
76 | .num_resources = ARRAY_SIZE(bast_dm9k_resource), | ||
77 | .resource = bast_dm9k_resource, | ||
78 | .dev = { | ||
79 | .platform_data = &bast_dm9k_platdata, | ||
80 | } | ||
81 | }; | ||
82 | |||
83 | The platform data is defined in include/linux/dm9000.h and described below. | ||
84 | |||
85 | |||
86 | Platform data | ||
87 | ------------- | ||
88 | |||
89 | Extra platform data for the DM9000 can describe the IO bus width to the | ||
90 | device, whether or not an external PHY is attached to the device and | ||
91 | the availability of an external configuration EEPROM. | ||
92 | |||
93 | The flags for the platform data .flags field are as follows: | ||
94 | |||
95 | DM9000_PLATF_8BITONLY | ||
96 | |||
97 | The IO should be done with 8bit operations. | ||
98 | |||
99 | DM9000_PLATF_16BITONLY | ||
100 | |||
101 | The IO should be done with 16bit operations. | ||
102 | |||
103 | DM9000_PLATF_32BITONLY | ||
104 | |||
105 | The IO should be done with 32bit operations. | ||
106 | |||
107 | DM9000_PLATF_EXT_PHY | ||
108 | |||
109 | The chip is connected to an external PHY. | ||
110 | |||
111 | DM9000_PLATF_NO_EEPROM | ||
112 | |||
113 | This can be used to signify that the board does not have an | ||
114 | EEPROM, or that the EEPROM should be hidden from the user. | ||
115 | |||
116 | DM9000_PLATF_SIMPLE_PHY | ||
117 | |||
118 | Switch to using the simpler PHY polling method which does not | ||
119 | try and read the MII PHY state regularly. This is only available | ||
120 | when using the internal PHY. See the section on link state polling | ||
121 | for more information. | ||
122 | |||
123 | The config symbol DM9000_FORCE_SIMPLE_PHY_POLL, Kconfig entry | ||
124 | "Force simple NSR based PHY polling" allows this flag to be | ||
125 | forced on at build time. | ||
126 | |||
127 | |||
128 | PHY Link state polling | ||
129 | ---------------------- | ||
130 | |||
131 | The driver keeps track of the link state and informs the network core | ||
132 | about link (carrier) availablilty. This is managed by several methods | ||
133 | depending on the version of the chip and on which PHY is being used. | ||
134 | |||
135 | For the internal PHY, the original (and currently default) method is | ||
136 | to read the MII state, either when the status changes if we have the | ||
137 | necessary interrupt support in the chip or every two seconds via a | ||
138 | periodic timer. | ||
139 | |||
140 | To reduce the overhead for the internal PHY, there is now the option | ||
141 | of using the DM9000_FORCE_SIMPLE_PHY_POLL config, or DM9000_PLATF_SIMPLE_PHY | ||
142 | platform data option to read the summary information without the | ||
143 | expensive MII accesses. This method is faster, but does not print | ||
144 | as much information. | ||
145 | |||
146 | When using an external PHY, the driver currently has to poll the MII | ||
147 | link status as there is no method for getting an interrupt on link change. | ||
148 | |||
149 | |||
150 | DM9000A / DM9000B | ||
151 | ----------------- | ||
152 | |||
153 | These chips are functionally similar to the DM9000E and are supported easily | ||
154 | by the same driver. The features are: | ||
155 | |||
156 | 1) Interrupt on internal PHY state change. This means that the periodic | ||
157 | polling of the PHY status may be disabled on these devices when using | ||
158 | the internal PHY. | ||
159 | |||
160 | 2) TCP/UDP checksum offloading, which the driver does not currently support. | ||
161 | |||
162 | |||
163 | ethtool | ||
164 | ------- | ||
165 | |||
166 | The driver supports the ethtool interface for access to the driver | ||
167 | state information, the PHY state and the EEPROM. | ||
diff --git a/Documentation/networking/e1000.txt b/Documentation/networking/e1000.txt index 61b171cf5313..2df71861e578 100644 --- a/Documentation/networking/e1000.txt +++ b/Documentation/networking/e1000.txt | |||
@@ -513,21 +513,11 @@ Additional Configurations | |||
513 | Intel(R) PRO/1000 PT Dual Port Server Connection | 513 | Intel(R) PRO/1000 PT Dual Port Server Connection |
514 | Intel(R) PRO/1000 PT Dual Port Server Adapter | 514 | Intel(R) PRO/1000 PT Dual Port Server Adapter |
515 | Intel(R) PRO/1000 PF Dual Port Server Adapter | 515 | Intel(R) PRO/1000 PF Dual Port Server Adapter |
516 | Intel(R) PRO/1000 PT Quad Port Server Adapter | 516 | Intel(R) PRO/1000 PT Quad Port Server Adapter |
517 | 517 | ||
518 | NAPI | 518 | NAPI |
519 | ---- | 519 | ---- |
520 | NAPI (Rx polling mode) is supported in the e1000 driver. NAPI is enabled | 520 | NAPI (Rx polling mode) is enabled in the e1000 driver. |
521 | or disabled based on the configuration of the kernel. To override | ||
522 | the default, use the following compile-time flags. | ||
523 | |||
524 | To enable NAPI, compile the driver module, passing in a configuration option: | ||
525 | |||
526 | make CFLAGS_EXTRA=-DE1000_NAPI install | ||
527 | |||
528 | To disable NAPI, compile the driver module, passing in a configuration option: | ||
529 | |||
530 | make CFLAGS_EXTRA=-DE1000_NO_NAPI install | ||
531 | 521 | ||
532 | See www.cyberus.ca/~hadi/usenix-paper.tgz for more information on NAPI. | 522 | See www.cyberus.ca/~hadi/usenix-paper.tgz for more information on NAPI. |
533 | 523 | ||
diff --git a/Documentation/networking/ifenslave.c b/Documentation/networking/ifenslave.c index a12059886755..1b96ccda3836 100644 --- a/Documentation/networking/ifenslave.c +++ b/Documentation/networking/ifenslave.c | |||
@@ -1081,7 +1081,7 @@ static int set_if_addr(char *master_ifname, char *slave_ifname) | |||
1081 | 1081 | ||
1082 | } | 1082 | } |
1083 | 1083 | ||
1084 | ipaddr = ifr.ifr_addr.sa_data; | 1084 | ipaddr = (unsigned char *)ifr.ifr_addr.sa_data; |
1085 | v_print("Interface '%s': set IP %s to %d.%d.%d.%d\n", | 1085 | v_print("Interface '%s': set IP %s to %d.%d.%d.%d\n", |
1086 | slave_ifname, ifra[i].desc, | 1086 | slave_ifname, ifra[i].desc, |
1087 | ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3]); | 1087 | ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3]); |
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt index 946b66e1b652..d84932650fd3 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt | |||
@@ -551,8 +551,9 @@ icmp_echo_ignore_broadcasts - BOOLEAN | |||
551 | icmp_ratelimit - INTEGER | 551 | icmp_ratelimit - INTEGER |
552 | Limit the maximal rates for sending ICMP packets whose type matches | 552 | Limit the maximal rates for sending ICMP packets whose type matches |
553 | icmp_ratemask (see below) to specific targets. | 553 | icmp_ratemask (see below) to specific targets. |
554 | 0 to disable any limiting, otherwise the maximal rate in jiffies(1) | 554 | 0 to disable any limiting, |
555 | Default: 100 | 555 | otherwise the minimal space between responses in milliseconds. |
556 | Default: 1000 | ||
556 | 557 | ||
557 | icmp_ratemask - INTEGER | 558 | icmp_ratemask - INTEGER |
558 | Mask made of ICMP types for which rates are being limited. | 559 | Mask made of ICMP types for which rates are being limited. |
@@ -1023,11 +1024,23 @@ max_addresses - INTEGER | |||
1023 | autoconfigured addresses. | 1024 | autoconfigured addresses. |
1024 | Default: 16 | 1025 | Default: 16 |
1025 | 1026 | ||
1027 | disable_ipv6 - BOOLEAN | ||
1028 | Disable IPv6 operation. | ||
1029 | Default: FALSE (enable IPv6 operation) | ||
1030 | |||
1031 | accept_dad - INTEGER | ||
1032 | Whether to accept DAD (Duplicate Address Detection). | ||
1033 | 0: Disable DAD | ||
1034 | 1: Enable DAD (default) | ||
1035 | 2: Enable DAD, and disable IPv6 operation if MAC-based duplicate | ||
1036 | link-local address has been found. | ||
1037 | |||
1026 | icmp/*: | 1038 | icmp/*: |
1027 | ratelimit - INTEGER | 1039 | ratelimit - INTEGER |
1028 | Limit the maximal rates for sending ICMPv6 packets. | 1040 | Limit the maximal rates for sending ICMPv6 packets. |
1029 | 0 to disable any limiting, otherwise the maximal rate in jiffies(1) | 1041 | 0 to disable any limiting, |
1030 | Default: 100 | 1042 | otherwise the minimal space between responses in milliseconds. |
1043 | Default: 1000 | ||
1031 | 1044 | ||
1032 | 1045 | ||
1033 | IPv6 Update by: | 1046 | IPv6 Update by: |
diff --git a/Documentation/networking/ixgb.txt b/Documentation/networking/ixgb.txt index 7c98277777eb..a0d0ffb5e584 100644 --- a/Documentation/networking/ixgb.txt +++ b/Documentation/networking/ixgb.txt | |||
@@ -1,7 +1,7 @@ | |||
1 | Linux* Base Driver for the Intel(R) PRO/10GbE Family of Adapters | 1 | Linux Base Driver for 10 Gigabit Intel(R) Network Connection |
2 | ================================================================ | 2 | ============================================================= |
3 | 3 | ||
4 | November 17, 2004 | 4 | October 9, 2007 |
5 | 5 | ||
6 | 6 | ||
7 | Contents | 7 | Contents |
@@ -9,94 +9,151 @@ Contents | |||
9 | 9 | ||
10 | - In This Release | 10 | - In This Release |
11 | - Identifying Your Adapter | 11 | - Identifying Your Adapter |
12 | - Building and Installation | ||
12 | - Command Line Parameters | 13 | - Command Line Parameters |
13 | - Improving Performance | 14 | - Improving Performance |
15 | - Additional Configurations | ||
16 | - Known Issues/Troubleshooting | ||
14 | - Support | 17 | - Support |
15 | 18 | ||
16 | 19 | ||
20 | |||
17 | In This Release | 21 | In This Release |
18 | =============== | 22 | =============== |
19 | 23 | ||
20 | This file describes the Linux* Base Driver for the Intel(R) PRO/10GbE Family | 24 | This file describes the ixgb Linux Base Driver for the 10 Gigabit Intel(R) |
21 | of Adapters, version 1.0.x. | 25 | Network Connection. This driver includes support for Itanium(R)2-based |
26 | systems. | ||
27 | |||
28 | For questions related to hardware requirements, refer to the documentation | ||
29 | supplied with your 10 Gigabit adapter. All hardware requirements listed apply | ||
30 | to use with Linux. | ||
31 | |||
32 | The following features are available in this kernel: | ||
33 | - Native VLANs | ||
34 | - Channel Bonding (teaming) | ||
35 | - SNMP | ||
36 | |||
37 | Channel Bonding documentation can be found in the Linux kernel source: | ||
38 | /Documentation/networking/bonding.txt | ||
39 | |||
40 | The driver information previously displayed in the /proc filesystem is not | ||
41 | supported in this release. Alternatively, you can use ethtool (version 1.6 | ||
42 | or later), lspci, and ifconfig to obtain the same information. | ||
43 | |||
44 | Instructions on updating ethtool can be found in the section "Additional | ||
45 | Configurations" later in this document. | ||
22 | 46 | ||
23 | For questions related to hardware requirements, refer to the documentation | ||
24 | supplied with your Intel PRO/10GbE adapter. All hardware requirements listed | ||
25 | apply to use with Linux. | ||
26 | 47 | ||
27 | Identifying Your Adapter | 48 | Identifying Your Adapter |
28 | ======================== | 49 | ======================== |
29 | 50 | ||
30 | To verify your Intel adapter is supported, find the board ID number on the | 51 | The following Intel network adapters are compatible with the drivers in this |
31 | adapter. Look for a label that has a barcode and a number in the format | 52 | release: |
32 | A12345-001. | 53 | |
54 | Controller Adapter Name Physical Layer | ||
55 | ---------- ------------ -------------- | ||
56 | 82597EX Intel(R) PRO/10GbE LR/SR/CX4 10G Base-LR (1310 nm optical fiber) | ||
57 | Server Adapters 10G Base-SR (850 nm optical fiber) | ||
58 | 10G Base-CX4(twin-axial copper cabling) | ||
59 | |||
60 | For more information on how to identify your adapter, go to the Adapter & | ||
61 | Driver ID Guide at: | ||
62 | |||
63 | http://support.intel.com/support/network/sb/CS-012904.htm | ||
64 | |||
65 | |||
66 | Building and Installation | ||
67 | ========================= | ||
68 | |||
69 | select m for "Intel(R) PRO/10GbE support" located at: | ||
70 | Location: | ||
71 | -> Device Drivers | ||
72 | -> Network device support (NETDEVICES [=y]) | ||
73 | -> Ethernet (10000 Mbit) (NETDEV_10000 [=y]) | ||
74 | 1. make modules && make modules_install | ||
75 | |||
76 | 2. Load the module: | ||
77 | |||
78 | Â Â Â Â modprobe ixgb <parameter>=<value> | ||
79 | |||
80 | The insmod command can be used if the full | ||
81 | path to the driver module is specified. For example: | ||
82 | |||
83 | insmod /lib/modules/<KERNEL VERSION>/kernel/drivers/net/ixgb/ixgb.ko | ||
84 | |||
85 | With 2.6 based kernels also make sure that older ixgb drivers are | ||
86 | removed from the kernel, before loading the new module: | ||
33 | 87 | ||
34 | Use the above information and the Adapter & Driver ID Guide at: | 88 | rmmod ixgb; modprobe ixgb |
35 | 89 | ||
36 | http://support.intel.com/support/network/adapter/pro100/21397.htm | 90 | 3. Assign an IP address to the interface by entering the following, where |
91 | x is the interface number: | ||
37 | 92 | ||
38 | For the latest Intel network drivers for Linux, go to: | 93 | ifconfig ethx <IP_address> |
94 | |||
95 | 4. Verify that the interface works. Enter the following, where <IP_address> | ||
96 | is the IP address for another machine on the same subnet as the interface | ||
97 | that is being tested: | ||
98 | |||
99 | ping <IP_address> | ||
39 | 100 | ||
40 | http://downloadfinder.intel.com/scripts-df/support_intel.asp | ||
41 | 101 | ||
42 | Command Line Parameters | 102 | Command Line Parameters |
43 | ======================= | 103 | ======================= |
44 | 104 | ||
45 | If the driver is built as a module, the following optional parameters are | 105 | If the driver is built as a module, the following optional parameters are |
46 | used by entering them on the command line with the modprobe or insmod command | 106 | used by entering them on the command line with the modprobe command using |
47 | using this syntax: | 107 | this syntax: |
48 | 108 | ||
49 | modprobe ixgb [<option>=<VAL1>,<VAL2>,...] | 109 | modprobe ixgb [<option>=<VAL1>,<VAL2>,...] |
50 | 110 | ||
51 | insmod ixgb [<option>=<VAL1>,<VAL2>,...] | 111 | For example, with two 10GbE PCI adapters, entering: |
52 | 112 | ||
53 | For example, with two PRO/10GbE PCI adapters, entering: | 113 | modprobe ixgb TxDescriptors=80,128 |
54 | 114 | ||
55 | insmod ixgb TxDescriptors=80,128 | 115 | loads the ixgb driver with 80 TX resources for the first adapter and 128 TX |
56 | |||
57 | loads the ixgb driver with 80 TX resources for the first adapter and 128 TX | ||
58 | resources for the second adapter. | 116 | resources for the second adapter. |
59 | 117 | ||
60 | The default value for each parameter is generally the recommended setting, | 118 | The default value for each parameter is generally the recommended setting, |
61 | unless otherwise noted. Also, if the driver is statically built into the | 119 | unless otherwise noted. |
62 | kernel, the driver is loaded with the default values for all the parameters. | ||
63 | Ethtool can be used to change some of the parameters at runtime. | ||
64 | 120 | ||
65 | FlowControl | 121 | FlowControl |
66 | Valid Range: 0-3 (0=none, 1=Rx only, 2=Tx only, 3=Rx&Tx) | 122 | Valid Range: 0-3 (0=none, 1=Rx only, 2=Tx only, 3=Rx&Tx) |
67 | Default: Read from the EEPROM | 123 | Default: Read from the EEPROM |
68 | If EEPROM is not detected, default is 3 | 124 | If EEPROM is not detected, default is 1 |
69 | This parameter controls the automatic generation(Tx) and response(Rx) to | 125 | This parameter controls the automatic generation(Tx) and response(Rx) to |
70 | Ethernet PAUSE frames. | 126 | Ethernet PAUSE frames. There are hardware bugs associated with enabling |
127 | Tx flow control so beware. | ||
71 | 128 | ||
72 | RxDescriptors | 129 | RxDescriptors |
73 | Valid Range: 64-512 | 130 | Valid Range: 64-512 |
74 | Default Value: 512 | 131 | Default Value: 512 |
75 | This value is the number of receive descriptors allocated by the driver. | 132 | This value is the number of receive descriptors allocated by the driver. |
76 | Increasing this value allows the driver to buffer more incoming packets. | 133 | Increasing this value allows the driver to buffer more incoming packets. |
77 | Each descriptor is 16 bytes. A receive buffer is also allocated for | 134 | Each descriptor is 16 bytes. A receive buffer is also allocated for |
78 | each descriptor and can be either 2048, 4056, 8192, or 16384 bytes, | 135 | each descriptor and can be either 2048, 4056, 8192, or 16384 bytes, |
79 | depending on the MTU setting. When the MTU size is 1500 or less, the | 136 | depending on the MTU setting. When the MTU size is 1500 or less, the |
80 | receive buffer size is 2048 bytes. When the MTU is greater than 1500 the | 137 | receive buffer size is 2048 bytes. When the MTU is greater than 1500 the |
81 | receive buffer size will be either 4056, 8192, or 16384 bytes. The | 138 | receive buffer size will be either 4056, 8192, or 16384 bytes. The |
82 | maximum MTU size is 16114. | 139 | maximum MTU size is 16114. |
83 | 140 | ||
84 | RxIntDelay | 141 | RxIntDelay |
85 | Valid Range: 0-65535 (0=off) | 142 | Valid Range: 0-65535 (0=off) |
86 | Default Value: 6 | 143 | Default Value: 72 |
87 | This value delays the generation of receive interrupts in units of | 144 | This value delays the generation of receive interrupts in units of |
88 | 0.8192 microseconds. Receive interrupt reduction can improve CPU | 145 | 0.8192 microseconds. Receive interrupt reduction can improve CPU |
89 | efficiency if properly tuned for specific network traffic. Increasing | 146 | efficiency if properly tuned for specific network traffic. Increasing |
90 | this value adds extra latency to frame reception and can end up | 147 | this value adds extra latency to frame reception and can end up |
91 | decreasing the throughput of TCP traffic. If the system is reporting | 148 | decreasing the throughput of TCP traffic. If the system is reporting |
92 | dropped receives, this value may be set too high, causing the driver to | 149 | dropped receives, this value may be set too high, causing the driver to |
93 | run out of available receive descriptors. | 150 | run out of available receive descriptors. |
94 | 151 | ||
95 | TxDescriptors | 152 | TxDescriptors |
96 | Valid Range: 64-4096 | 153 | Valid Range: 64-4096 |
97 | Default Value: 256 | 154 | Default Value: 256 |
98 | This value is the number of transmit descriptors allocated by the driver. | 155 | This value is the number of transmit descriptors allocated by the driver. |
99 | Increasing this value allows the driver to queue more transmits. Each | 156 | Increasing this value allows the driver to queue more transmits. Each |
100 | descriptor is 16 bytes. | 157 | descriptor is 16 bytes. |
101 | 158 | ||
102 | XsumRX | 159 | XsumRX |
@@ -105,51 +162,49 @@ Default Value: 1 | |||
105 | A value of '1' indicates that the driver should enable IP checksum | 162 | A value of '1' indicates that the driver should enable IP checksum |
106 | offload for received packets (both UDP and TCP) to the adapter hardware. | 163 | offload for received packets (both UDP and TCP) to the adapter hardware. |
107 | 164 | ||
108 | XsumTX | ||
109 | Valid Range: 0-1 | ||
110 | Default Value: 1 | ||
111 | A value of '1' indicates that the driver should enable IP checksum | ||
112 | offload for transmitted packets (both UDP and TCP) to the adapter | ||
113 | hardware. | ||
114 | 165 | ||
115 | Improving Performance | 166 | Improving Performance |
116 | ===================== | 167 | ===================== |
117 | 168 | ||
118 | With the Intel PRO/10 GbE adapter, the default Linux configuration will very | 169 | With the 10 Gigabit server adapters, the default Linux configuration will |
119 | likely limit the total available throughput artificially. There is a set of | 170 | very likely limit the total available throughput artificially. There is a set |
120 | things that when applied together increase the ability of Linux to transmit | 171 | of configuration changes that, when applied together, will increase the ability |
121 | and receive data. The following enhancements were originally acquired from | 172 | of Linux to transmit and receive data. The following enhancements were |
122 | settings published at http://www.spec.org/web99 for various submitted results | 173 | originally acquired from settings published at http://www.spec.org/web99/ for |
123 | using Linux. | 174 | various submitted results using Linux. |
124 | 175 | ||
125 | NOTE: These changes are only suggestions, and serve as a starting point for | 176 | NOTE: These changes are only suggestions, and serve as a starting point for |
126 | tuning your network performance. | 177 | tuning your network performance. |
127 | 178 | ||
128 | The changes are made in three major ways, listed in order of greatest effect: | 179 | The changes are made in three major ways, listed in order of greatest effect: |
129 | - Use ifconfig to modify the mtu (maximum transmission unit) and the txqueuelen | 180 | - Use ifconfig to modify the mtu (maximum transmission unit) and the txqueuelen |
130 | parameter. | 181 | parameter. |
131 | - Use sysctl to modify /proc parameters (essentially kernel tuning) | 182 | - Use sysctl to modify /proc parameters (essentially kernel tuning) |
132 | - Use setpci to modify the MMRBC field in PCI-X configuration space to increase | 183 | - Use setpci to modify the MMRBC field in PCI-X configuration space to increase |
133 | transmit burst lengths on the bus. | 184 | transmit burst lengths on the bus. |
134 | 185 | ||
135 | NOTE: setpci modifies the adapter's configuration registers to allow it to read | 186 | NOTE: setpci modifies the adapter's configuration registers to allow it to read |
136 | up to 4k bytes at a time (for transmits). However, for some systems the | 187 | up to 4k bytes at a time (for transmits). However, for some systems the |
137 | behavior after modifying this register may be undefined (possibly errors of some | 188 | behavior after modifying this register may be undefined (possibly errors of |
138 | kind). A power-cycle, hard reset or explicitly setting the e6 register back to | 189 | some kind). A power-cycle, hard reset or explicitly setting the e6 register |
139 | 22 (setpci -d 8086:1048 e6.b=22) may be required to get back to a stable | 190 | back to 22 (setpci -d 8086:1a48 e6.b=22) may be required to get back to a |
140 | configuration. | 191 | stable configuration. |
141 | 192 | ||
142 | - COPY these lines and paste them into ixgb_perf.sh: | 193 | - COPY these lines and paste them into ixgb_perf.sh: |
143 | #!/bin/bash | 194 | #!/bin/bash |
144 | echo "configuring network performance , edit this file to change the interface" | 195 | echo "configuring network performance , edit this file to change the interface |
196 | or device ID of 10GbE card" | ||
145 | # set mmrbc to 4k reads, modify only Intel 10GbE device IDs | 197 | # set mmrbc to 4k reads, modify only Intel 10GbE device IDs |
146 | setpci -d 8086:1048 e6.b=2e | 198 | # replace 1a48 with appropriate 10GbE device's ID installed on the system, |
147 | # set the MTU (max transmission unit) - it requires your switch and clients to change too! | 199 | # if needed. |
200 | setpci -d 8086:1a48 e6.b=2e | ||
201 | # set the MTU (max transmission unit) - it requires your switch and clients | ||
202 | # to change as well. | ||
148 | # set the txqueuelen | 203 | # set the txqueuelen |
149 | # your ixgb adapter should be loaded as eth1 for this to work, change if needed | 204 | # your ixgb adapter should be loaded as eth1 for this to work, change if needed |
150 | ifconfig eth1 mtu 9000 txqueuelen 1000 up | 205 | ifconfig eth1 mtu 9000 txqueuelen 1000 up |
151 | # call the sysctl utility to modify /proc/sys entries | 206 | # call the sysctl utility to modify /proc/sys entries |
152 | sysctl -p ./sysctl_ixgb.conf | 207 | sysctl -p ./sysctl_ixgb.conf |
153 | - END ixgb_perf.sh | 208 | - END ixgb_perf.sh |
154 | 209 | ||
155 | - COPY these lines and paste them into sysctl_ixgb.conf: | 210 | - COPY these lines and paste them into sysctl_ixgb.conf: |
@@ -159,54 +214,220 @@ sysctl -p ./sysctl_ixgb.conf | |||
159 | # several network benchmark tests, your mileage may vary | 214 | # several network benchmark tests, your mileage may vary |
160 | 215 | ||
161 | ### IPV4 specific settings | 216 | ### IPV4 specific settings |
162 | net.ipv4.tcp_timestamps = 0 # turns TCP timestamp support off, default 1, reduces CPU use | 217 | # turn TCP timestamp support off, default 1, reduces CPU use |
163 | net.ipv4.tcp_sack = 0 # turn SACK support off, default on | 218 | net.ipv4.tcp_timestamps = 0 |
164 | # on systems with a VERY fast bus -> memory interface this is the big gainer | 219 | # turn SACK support off, default on |
165 | net.ipv4.tcp_rmem = 10000000 10000000 10000000 # sets min/default/max TCP read buffer, default 4096 87380 174760 | 220 | # on systems with a VERY fast bus -> memory interface this is the big gainer |
166 | net.ipv4.tcp_wmem = 10000000 10000000 10000000 # sets min/pressure/max TCP write buffer, default 4096 16384 131072 | 221 | net.ipv4.tcp_sack = 0 |
167 | net.ipv4.tcp_mem = 10000000 10000000 10000000 # sets min/pressure/max TCP buffer space, default 31744 32256 32768 | 222 | # set min/default/max TCP read buffer, default 4096 87380 174760 |
223 | net.ipv4.tcp_rmem = 10000000 10000000 10000000 | ||
224 | # set min/pressure/max TCP write buffer, default 4096 16384 131072 | ||
225 | net.ipv4.tcp_wmem = 10000000 10000000 10000000 | ||
226 | # set min/pressure/max TCP buffer space, default 31744 32256 32768 | ||
227 | net.ipv4.tcp_mem = 10000000 10000000 10000000 | ||
168 | 228 | ||
169 | ### CORE settings (mostly for socket and UDP effect) | 229 | ### CORE settings (mostly for socket and UDP effect) |
170 | net.core.rmem_max = 524287 # maximum receive socket buffer size, default 131071 | 230 | # set maximum receive socket buffer size, default 131071 |
171 | net.core.wmem_max = 524287 # maximum send socket buffer size, default 131071 | 231 | net.core.rmem_max = 524287 |
172 | net.core.rmem_default = 524287 # default receive socket buffer size, default 65535 | 232 | # set maximum send socket buffer size, default 131071 |
173 | net.core.wmem_default = 524287 # default send socket buffer size, default 65535 | 233 | net.core.wmem_max = 524287 |
174 | net.core.optmem_max = 524287 # maximum amount of option memory buffers, default 10240 | 234 | # set default receive socket buffer size, default 65535 |
175 | net.core.netdev_max_backlog = 300000 # number of unprocessed input packets before kernel starts dropping them, default 300 | 235 | net.core.rmem_default = 524287 |
236 | # set default send socket buffer size, default 65535 | ||
237 | net.core.wmem_default = 524287 | ||
238 | # set maximum amount of option memory buffers, default 10240 | ||
239 | net.core.optmem_max = 524287 | ||
240 | # set number of unprocessed input packets before kernel starts dropping them; default 300 | ||
241 | net.core.netdev_max_backlog = 300000 | ||
176 | - END sysctl_ixgb.conf | 242 | - END sysctl_ixgb.conf |
177 | 243 | ||
178 | Edit the ixgb_perf.sh script if necessary to change eth1 to whatever interface | 244 | Edit the ixgb_perf.sh script if necessary to change eth1 to whatever interface |
179 | your ixgb driver is using. | 245 | your ixgb driver is using and/or replace '1a48' with appropriate 10GbE device's |
246 | ID installed on the system. | ||
180 | 247 | ||
181 | NOTE: Unless these scripts are added to the boot process, these changes will | 248 | NOTE: Unless these scripts are added to the boot process, these changes will |
182 | only last only until the next system reboot. | 249 | only last only until the next system reboot. |
183 | 250 | ||
184 | 251 | ||
185 | Resolving Slow UDP Traffic | 252 | Resolving Slow UDP Traffic |
186 | -------------------------- | 253 | -------------------------- |
254 | If your server does not seem to be able to receive UDP traffic as fast as it | ||
255 | can receive TCP traffic, it could be because Linux, by default, does not set | ||
256 | the network stack buffers as large as they need to be to support high UDP | ||
257 | transfer rates. One way to alleviate this problem is to allow more memory to | ||
258 | be used by the IP stack to store incoming data. | ||
187 | 259 | ||
188 | If your server does not seem to be able to receive UDP traffic as fast as it | 260 | For instance, use the commands: |
189 | can receive TCP traffic, it could be because Linux, by default, does not set | ||
190 | the network stack buffers as large as they need to be to support high UDP | ||
191 | transfer rates. One way to alleviate this problem is to allow more memory to | ||
192 | be used by the IP stack to store incoming data. | ||
193 | |||
194 | For instance, use the commands: | ||
195 | sysctl -w net.core.rmem_max=262143 | 261 | sysctl -w net.core.rmem_max=262143 |
196 | and | 262 | and |
197 | sysctl -w net.core.rmem_default=262143 | 263 | sysctl -w net.core.rmem_default=262143 |
198 | to increase the read buffer memory max and default to 262143 (256k - 1) from | 264 | to increase the read buffer memory max and default to 262143 (256k - 1) from |
199 | defaults of max=131071 (128k - 1) and default=65535 (64k - 1). These variables | 265 | defaults of max=131071 (128k - 1) and default=65535 (64k - 1). These variables |
200 | will increase the amount of memory used by the network stack for receives, and | 266 | will increase the amount of memory used by the network stack for receives, and |
201 | can be increased significantly more if necessary for your application. | 267 | can be increased significantly more if necessary for your application. |
202 | 268 | ||
269 | |||
270 | Additional Configurations | ||
271 | ========================= | ||
272 | |||
273 | Configuring the Driver on Different Distributions | ||
274 | ------------------------------------------------- | ||
275 | Configuring a network driver to load properly when the system is started is | ||
276 | distribution dependent. Typically, the configuration process involves adding | ||
277 | an alias line to /etc/modprobe.conf as well as editing other system startup | ||
278 | scripts and/or configuration files. Many popular Linux distributions ship | ||
279 | with tools to make these changes for you. To learn the proper way to | ||
280 | configure a network device for your system, refer to your distribution | ||
281 | documentation. If during this process you are asked for the driver or module | ||
282 | name, the name for the Linux Base Driver for the Intel 10GbE Family of | ||
283 | Adapters is ixgb. | ||
284 | |||
285 | Viewing Link Messages | ||
286 | --------------------- | ||
287 | Link messages will not be displayed to the console if the distribution is | ||
288 | restricting system messages. In order to see network driver link messages on | ||
289 | your console, set dmesg to eight by entering the following: | ||
290 | |||
291 | dmesg -n 8 | ||
292 | |||
293 | NOTE: This setting is not saved across reboots. | ||
294 | |||
295 | |||
296 | Jumbo Frames | ||
297 | ------------ | ||
298 | The driver supports Jumbo Frames for all adapters. Jumbo Frames support is | ||
299 | enabled by changing the MTU to a value larger than the default of 1500. | ||
300 | The maximum value for the MTU is 16114. Use the ifconfig command to | ||
301 | increase the MTU size. For example: | ||
302 | |||
303 | ifconfig ethx mtu 9000 up | ||
304 | |||
305 | The maximum MTU setting for Jumbo Frames is 16114. This value coincides | ||
306 | with the maximum Jumbo Frames size of 16128. | ||
307 | |||
308 | |||
309 | Ethtool | ||
310 | ------- | ||
311 | The driver utilizes the ethtool interface for driver configuration and | ||
312 | diagnostics, as well as displaying statistical information. Ethtool | ||
313 | version 1.6 or later is required for this functionality. | ||
314 | |||
315 | The latest release of ethtool can be found from | ||
316 | http://sourceforge.net/projects/gkernel | ||
317 | |||
318 | NOTE: Ethtool 1.6 only supports a limited set of ethtool options. Support | ||
319 | for a more complete ethtool feature set can be enabled by upgrading | ||
320 | to the latest version. | ||
321 | |||
322 | |||
323 | NAPI | ||
324 | ---- | ||
325 | |||
326 | NAPI (Rx polling mode) is supported in the ixgb driver. NAPI is enabled | ||
327 | or disabled based on the configuration of the kernel. see CONFIG_IXGB_NAPI | ||
328 | |||
329 | See www.cyberus.ca/~hadi/usenix-paper.tgz for more information on NAPI. | ||
330 | |||
331 | |||
332 | Known Issues/Troubleshooting | ||
333 | ============================ | ||
334 | |||
335 | NOTE: After installing the driver, if your Intel Network Connection is not | ||
336 | working, verify in the "In This Release" section of the readme that you have | ||
337 | installed the correct driver. | ||
338 | |||
339 | Intel(R) PRO/10GbE CX4 Server Adapter Cable Interoperability Issue with | ||
340 | Fujitsu XENPAK Module in SmartBits Chassis | ||
341 | --------------------------------------------------------------------- | ||
342 | Excessive CRC errors may be observed if the Intel(R) PRO/10GbE CX4 | ||
343 | Server adapter is connected to a Fujitsu XENPAK CX4 module in a SmartBits | ||
344 | chassis using 15 m/24AWG cable assemblies manufactured by Fujitsu or Leoni. | ||
345 | The CRC errors may be received either by the Intel(R) PRO/10GbE CX4 | ||
346 | Server adapter or the SmartBits. If this situation occurs using a different | ||
347 | cable assembly may resolve the issue. | ||
348 | |||
349 | CX4 Server Adapter Cable Interoperability Issues with HP Procurve 3400cl | ||
350 | Switch Port | ||
351 | ------------------------------------------------------------------------ | ||
352 | Excessive CRC errors may be observed if the Intel(R) PRO/10GbE CX4 Server | ||
353 | adapter is connected to an HP Procurve 3400cl switch port using short cables | ||
354 | (1 m or shorter). If this situation occurs, using a longer cable may resolve | ||
355 | the issue. | ||
356 | |||
357 | Excessive CRC errors may be observed using Fujitsu 24AWG cable assemblies that | ||
358 | Are 10 m or longer or where using a Leoni 15 m/24AWG cable assembly. The CRC | ||
359 | errors may be received either by the CX4 Server adapter or at the switch. If | ||
360 | this situation occurs, using a different cable assembly may resolve the issue. | ||
361 | |||
362 | |||
363 | Jumbo Frames System Requirement | ||
364 | ------------------------------- | ||
365 | Memory allocation failures have been observed on Linux systems with 64 MB | ||
366 | of RAM or less that are running Jumbo Frames. If you are using Jumbo | ||
367 | Frames, your system may require more than the advertised minimum | ||
368 | requirement of 64 MB of system memory. | ||
369 | |||
370 | |||
371 | Performance Degradation with Jumbo Frames | ||
372 | ----------------------------------------- | ||
373 | Degradation in throughput performance may be observed in some Jumbo frames | ||
374 | environments. If this is observed, increasing the application's socket buffer | ||
375 | size and/or increasing the /proc/sys/net/ipv4/tcp_*mem entry values may help. | ||
376 | See the specific application manual and /usr/src/linux*/Documentation/ | ||
377 | networking/ip-sysctl.txt for more details. | ||
378 | |||
379 | |||
380 | Allocating Rx Buffers when Using Jumbo Frames | ||
381 | --------------------------------------------- | ||
382 | Allocating Rx buffers when using Jumbo Frames on 2.6.x kernels may fail if | ||
383 | the available memory is heavily fragmented. This issue may be seen with PCI-X | ||
384 | adapters or with packet split disabled. This can be reduced or eliminated | ||
385 | by changing the amount of available memory for receive buffer allocation, by | ||
386 | increasing /proc/sys/vm/min_free_kbytes. | ||
387 | |||
388 | |||
389 | Multiple Interfaces on Same Ethernet Broadcast Network | ||
390 | ------------------------------------------------------ | ||
391 | Due to the default ARP behavior on Linux, it is not possible to have | ||
392 | one system on two IP networks in the same Ethernet broadcast domain | ||
393 | (non-partitioned switch) behave as expected. All Ethernet interfaces | ||
394 | will respond to IP traffic for any IP address assigned to the system. | ||
395 | This results in unbalanced receive traffic. | ||
396 | |||
397 | If you have multiple interfaces in a server, do either of the following: | ||
398 | |||
399 | - Turn on ARP filtering by entering: | ||
400 | echo 1 > /proc/sys/net/ipv4/conf/all/arp_filter | ||
401 | |||
402 | - Install the interfaces in separate broadcast domains - either in | ||
403 | different switches or in a switch partitioned to VLANs. | ||
404 | |||
405 | |||
406 | UDP Stress Test Dropped Packet Issue | ||
407 | -------------------------------------- | ||
408 | Under small packets UDP stress test with 10GbE driver, the Linux system | ||
409 | may drop UDP packets due to the fullness of socket buffers. You may want | ||
410 | to change the driver's Flow Control variables to the minimum value for | ||
411 | controlling packet reception. | ||
412 | |||
413 | |||
414 | Tx Hangs Possible Under Stress | ||
415 | ------------------------------ | ||
416 | Under stress conditions, if TX hangs occur, turning off TSO | ||
417 | "ethtool -K eth0 tso off" may resolve the problem. | ||
418 | |||
419 | |||
203 | Support | 420 | Support |
204 | ======= | 421 | ======= |
205 | 422 | ||
206 | For general information and support, go to the Intel support website at: | 423 | For general information, go to the Intel support website at: |
207 | 424 | ||
208 | http://support.intel.com | 425 | http://support.intel.com |
209 | 426 | ||
427 | or the Intel Wired Networking project hosted by Sourceforge at: | ||
428 | |||
429 | http://sourceforge.net/projects/e1000 | ||
430 | |||
210 | If an issue is identified with the released source code on the supported | 431 | If an issue is identified with the released source code on the supported |
211 | kernel with a supported adapter, email the specific information related to | 432 | kernel with a supported adapter, email the specific information related |
212 | the issue to linux.nics@intel.com. | 433 | to the issue to e1000-devel@lists.sf.net |
diff --git a/Documentation/networking/mac80211_hwsim/README b/Documentation/networking/mac80211_hwsim/README new file mode 100644 index 000000000000..2ff8ccb8dc37 --- /dev/null +++ b/Documentation/networking/mac80211_hwsim/README | |||
@@ -0,0 +1,67 @@ | |||
1 | mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211 | ||
2 | Copyright (c) 2008, Jouni Malinen <j@w1.fi> | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License version 2 as | ||
6 | published by the Free Software Foundation. | ||
7 | |||
8 | |||
9 | Introduction | ||
10 | |||
11 | mac80211_hwsim is a Linux kernel module that can be used to simulate | ||
12 | arbitrary number of IEEE 802.11 radios for mac80211. It can be used to | ||
13 | test most of the mac80211 functionality and user space tools (e.g., | ||
14 | hostapd and wpa_supplicant) in a way that matches very closely with | ||
15 | the normal case of using real WLAN hardware. From the mac80211 view | ||
16 | point, mac80211_hwsim is yet another hardware driver, i.e., no changes | ||
17 | to mac80211 are needed to use this testing tool. | ||
18 | |||
19 | The main goal for mac80211_hwsim is to make it easier for developers | ||
20 | to test their code and work with new features to mac80211, hostapd, | ||
21 | and wpa_supplicant. The simulated radios do not have the limitations | ||
22 | of real hardware, so it is easy to generate an arbitrary test setup | ||
23 | and always reproduce the same setup for future tests. In addition, | ||
24 | since all radio operation is simulated, any channel can be used in | ||
25 | tests regardless of regulatory rules. | ||
26 | |||
27 | mac80211_hwsim kernel module has a parameter 'radios' that can be used | ||
28 | to select how many radios are simulated (default 2). This allows | ||
29 | configuration of both very simply setups (e.g., just a single access | ||
30 | point and a station) or large scale tests (multiple access points with | ||
31 | hundreds of stations). | ||
32 | |||
33 | mac80211_hwsim works by tracking the current channel of each virtual | ||
34 | radio and copying all transmitted frames to all other radios that are | ||
35 | currently enabled and on the same channel as the transmitting | ||
36 | radio. Software encryption in mac80211 is used so that the frames are | ||
37 | actually encrypted over the virtual air interface to allow more | ||
38 | complete testing of encryption. | ||
39 | |||
40 | A global monitoring netdev, hwsim#, is created independent of | ||
41 | mac80211. This interface can be used to monitor all transmitted frames | ||
42 | regardless of channel. | ||
43 | |||
44 | |||
45 | Simple example | ||
46 | |||
47 | This example shows how to use mac80211_hwsim to simulate two radios: | ||
48 | one to act as an access point and the other as a station that | ||
49 | associates with the AP. hostapd and wpa_supplicant are used to take | ||
50 | care of WPA2-PSK authentication. In addition, hostapd is also | ||
51 | processing access point side of association. | ||
52 | |||
53 | Please note that the current Linux kernel does not enable AP mode, so a | ||
54 | simple patch is needed to enable AP mode selection: | ||
55 | http://johannes.sipsolutions.net/patches/kernel/all/LATEST/006-allow-ap-vlan-modes.patch | ||
56 | |||
57 | |||
58 | # Build mac80211_hwsim as part of kernel configuration | ||
59 | |||
60 | # Load the module | ||
61 | modprobe mac80211_hwsim | ||
62 | |||
63 | # Run hostapd (AP) for wlan0 | ||
64 | hostapd hostapd.conf | ||
65 | |||
66 | # Run wpa_supplicant (station) for wlan1 | ||
67 | wpa_supplicant -Dwext -iwlan1 -c wpa_supplicant.conf | ||
diff --git a/Documentation/networking/mac80211_hwsim/hostapd.conf b/Documentation/networking/mac80211_hwsim/hostapd.conf new file mode 100644 index 000000000000..08cde7e35f2e --- /dev/null +++ b/Documentation/networking/mac80211_hwsim/hostapd.conf | |||
@@ -0,0 +1,11 @@ | |||
1 | interface=wlan0 | ||
2 | driver=nl80211 | ||
3 | |||
4 | hw_mode=g | ||
5 | channel=1 | ||
6 | ssid=mac80211 test | ||
7 | |||
8 | wpa=2 | ||
9 | wpa_key_mgmt=WPA-PSK | ||
10 | wpa_pairwise=CCMP | ||
11 | wpa_passphrase=12345678 | ||
diff --git a/Documentation/networking/mac80211_hwsim/wpa_supplicant.conf b/Documentation/networking/mac80211_hwsim/wpa_supplicant.conf new file mode 100644 index 000000000000..299128cff035 --- /dev/null +++ b/Documentation/networking/mac80211_hwsim/wpa_supplicant.conf | |||
@@ -0,0 +1,10 @@ | |||
1 | ctrl_interface=/var/run/wpa_supplicant | ||
2 | |||
3 | network={ | ||
4 | ssid="mac80211 test" | ||
5 | psk="12345678" | ||
6 | key_mgmt=WPA-PSK | ||
7 | proto=WPA2 | ||
8 | pairwise=CCMP | ||
9 | group=CCMP | ||
10 | } | ||
diff --git a/Documentation/networking/multiqueue.txt b/Documentation/networking/multiqueue.txt index ea5a42e8f79f..4caa0e314cc2 100644 --- a/Documentation/networking/multiqueue.txt +++ b/Documentation/networking/multiqueue.txt | |||
@@ -3,19 +3,11 @@ | |||
3 | =========================================== | 3 | =========================================== |
4 | 4 | ||
5 | Section 1: Base driver requirements for implementing multiqueue support | 5 | Section 1: Base driver requirements for implementing multiqueue support |
6 | Section 2: Qdisc support for multiqueue devices | ||
7 | Section 3: Brief howto using PRIO or RR for multiqueue devices | ||
8 | |||
9 | 6 | ||
10 | Intro: Kernel support for multiqueue devices | 7 | Intro: Kernel support for multiqueue devices |
11 | --------------------------------------------------------- | 8 | --------------------------------------------------------- |
12 | 9 | ||
13 | Kernel support for multiqueue devices is only an API that is presented to the | 10 | Kernel support for multiqueue devices is always present. |
14 | netdevice layer for base drivers to implement. This feature is part of the | ||
15 | core networking stack, and all network devices will be running on the | ||
16 | multiqueue-aware stack. If a base driver only has one queue, then these | ||
17 | changes are transparent to that driver. | ||
18 | |||
19 | 11 | ||
20 | Section 1: Base driver requirements for implementing multiqueue support | 12 | Section 1: Base driver requirements for implementing multiqueue support |
21 | ----------------------------------------------------------------------- | 13 | ----------------------------------------------------------------------- |
@@ -32,84 +24,56 @@ netif_{start|stop|wake}_subqueue() functions to manage each queue while the | |||
32 | device is still operational. netdev->queue_lock is still used when the device | 24 | device is still operational. netdev->queue_lock is still used when the device |
33 | comes online or when it's completely shut down (unregister_netdev(), etc.). | 25 | comes online or when it's completely shut down (unregister_netdev(), etc.). |
34 | 26 | ||
35 | Finally, the base driver should indicate that it is a multiqueue device. The | ||
36 | feature flag NETIF_F_MULTI_QUEUE should be added to the netdev->features | ||
37 | bitmap on device initialization. Below is an example from e1000: | ||
38 | |||
39 | #ifdef CONFIG_E1000_MQ | ||
40 | if ( (adapter->hw.mac.type == e1000_82571) || | ||
41 | (adapter->hw.mac.type == e1000_82572) || | ||
42 | (adapter->hw.mac.type == e1000_80003es2lan)) | ||
43 | netdev->features |= NETIF_F_MULTI_QUEUE; | ||
44 | #endif | ||
45 | |||
46 | 27 | ||
47 | Section 2: Qdisc support for multiqueue devices | 28 | Section 2: Qdisc support for multiqueue devices |
48 | ----------------------------------------------- | ||
49 | 29 | ||
50 | Currently two qdiscs support multiqueue devices. A new round-robin qdisc, | 30 | ----------------------------------------------- |
51 | sch_rr, and sch_prio. The qdisc is responsible for classifying the skb's to | ||
52 | bands and queues, and will store the queue mapping into skb->queue_mapping. | ||
53 | Use this field in the base driver to determine which queue to send the skb | ||
54 | to. | ||
55 | 31 | ||
56 | sch_rr has been added for hardware that doesn't want scheduling policies from | 32 | Currently two qdiscs are optimized for multiqueue devices. The first is the |
57 | software, so it's a straight round-robin qdisc. It uses the same syntax and | 33 | default pfifo_fast qdisc. This qdisc supports one qdisc per hardware queue. |
58 | classification priomap that sch_prio uses, so it should be intuitive to | 34 | A new round-robin qdisc, sch_multiq also supports multiple hardware queues. The |
59 | configure for people who've used sch_prio. | 35 | qdisc is responsible for classifying the skb's and then directing the skb's to |
36 | bands and queues based on the value in skb->queue_mapping. Use this field in | ||
37 | the base driver to determine which queue to send the skb to. | ||
60 | 38 | ||
61 | In order to utilitize the multiqueue features of the qdiscs, the network | 39 | sch_multiq has been added for hardware that wishes to avoid head-of-line |
62 | device layer needs to enable multiple queue support. This can be done by | 40 | blocking. It will cycle though the bands and verify that the hardware queue |
63 | selecting NETDEVICES_MULTIQUEUE under Drivers. | 41 | associated with the band is not stopped prior to dequeuing a packet. |
64 | 42 | ||
65 | The PRIO qdisc naturally plugs into a multiqueue device. If | 43 | On qdisc load, the number of bands is based on the number of queues on the |
66 | NETDEVICES_MULTIQUEUE is selected, then on qdisc load, the number of | 44 | hardware. Once the association is made, any skb with skb->queue_mapping set, |
67 | bands requested is compared to the number of queues on the hardware. If they | 45 | will be queued to the band associated with the hardware queue. |
68 | are equal, it sets a one-to-one mapping up between the queues and bands. If | ||
69 | they're not equal, it will not load the qdisc. This is the same behavior | ||
70 | for RR. Once the association is made, any skb that is classified will have | ||
71 | skb->queue_mapping set, which will allow the driver to properly queue skb's | ||
72 | to multiple queues. | ||
73 | 46 | ||
74 | 47 | ||
75 | Section 3: Brief howto using PRIO and RR for multiqueue devices | 48 | Section 3: Brief howto using MULTIQ for multiqueue devices |
76 | --------------------------------------------------------------- | 49 | --------------------------------------------------------------- |
77 | 50 | ||
78 | The userspace command 'tc,' part of the iproute2 package, is used to configure | 51 | The userspace command 'tc,' part of the iproute2 package, is used to configure |
79 | qdiscs. To add the PRIO qdisc to your network device, assuming the device is | 52 | qdiscs. To add the MULTIQ qdisc to your network device, assuming the device |
80 | called eth0, run the following command: | 53 | is called eth0, run the following command: |
81 | 54 | ||
82 | # tc qdisc add dev eth0 root handle 1: prio bands 4 multiqueue | 55 | # tc qdisc add dev eth0 root handle 1: multiq |
83 | 56 | ||
84 | This will create 4 bands, 0 being highest priority, and associate those bands | 57 | The qdisc will allocate the number of bands to equal the number of queues that |
85 | to the queues on your NIC. Assuming eth0 has 4 Tx queues, the band mapping | 58 | the device reports, and bring the qdisc online. Assuming eth0 has 4 Tx |
86 | would look like: | 59 | queues, the band mapping would look like: |
87 | 60 | ||
88 | band 0 => queue 0 | 61 | band 0 => queue 0 |
89 | band 1 => queue 1 | 62 | band 1 => queue 1 |
90 | band 2 => queue 2 | 63 | band 2 => queue 2 |
91 | band 3 => queue 3 | 64 | band 3 => queue 3 |
92 | 65 | ||
93 | Traffic will begin flowing through each queue if your TOS values are assigning | 66 | Traffic will begin flowing through each queue based on either the simple_tx_hash |
94 | traffic across the various bands. For example, ssh traffic will always try to | 67 | function or based on netdev->select_queue() if you have it defined. |
95 | go out band 0 based on TOS -> Linux priority conversion (realtime traffic), | ||
96 | so it will be sent out queue 0. ICMP traffic (pings) fall into the "normal" | ||
97 | traffic classification, which is band 1. Therefore pings will be send out | ||
98 | queue 1 on the NIC. | ||
99 | |||
100 | Note the use of the multiqueue keyword. This is only in versions of iproute2 | ||
101 | that support multiqueue networking devices; if this is omitted when loading | ||
102 | a qdisc onto a multiqueue device, the qdisc will load and operate the same | ||
103 | if it were loaded onto a single-queue device (i.e. - sends all traffic to | ||
104 | queue 0). | ||
105 | |||
106 | Another alternative to multiqueue band allocation can be done by using the | ||
107 | multiqueue option and specify 0 bands. If this is the case, the qdisc will | ||
108 | allocate the number of bands to equal the number of queues that the device | ||
109 | reports, and bring the qdisc online. | ||
110 | 68 | ||
111 | The behavior of tc filters remains the same, where it will override TOS priority | 69 | The behavior of tc filters remains the same. However a new tc action, |
112 | classification. | 70 | skbedit, has been added. Assuming you wanted to route all traffic to a |
71 | specific host, for example 192.168.0.3, through a specific queue you could use | ||
72 | this action and establish a filter such as: | ||
113 | 73 | ||
74 | tc filter add dev eth0 parent 1: protocol ip prio 1 u32 \ | ||
75 | match ip dst 192.168.0.3 \ | ||
76 | action skbedit queue_mapping 3 | ||
114 | 77 | ||
115 | Author: Peter P. Waskiewicz Jr. <peter.p.waskiewicz.jr@intel.com> | 78 | Author: Alexander Duyck <alexander.h.duyck@intel.com> |
79 | Original Author: Peter P. Waskiewicz Jr. <peter.p.waskiewicz.jr@intel.com> | ||
diff --git a/Documentation/networking/packet_mmap.txt b/Documentation/networking/packet_mmap.txt index db0cd5169581..07c53d596035 100644 --- a/Documentation/networking/packet_mmap.txt +++ b/Documentation/networking/packet_mmap.txt | |||
@@ -326,7 +326,7 @@ just one call to mmap is needed: | |||
326 | mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); | 326 | mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); |
327 | 327 | ||
328 | If tp_frame_size is a divisor of tp_block_size frames will be | 328 | If tp_frame_size is a divisor of tp_block_size frames will be |
329 | contiguosly spaced by tp_frame_size bytes. If not, each | 329 | contiguously spaced by tp_frame_size bytes. If not, each |
330 | tp_block_size/tp_frame_size frames there will be a gap between | 330 | tp_block_size/tp_frame_size frames there will be a gap between |
331 | the frames. This is because a frame cannot be spawn across two | 331 | the frames. This is because a frame cannot be spawn across two |
332 | blocks. | 332 | blocks. |
diff --git a/Documentation/networking/phonet.txt b/Documentation/networking/phonet.txt new file mode 100644 index 000000000000..6a07e45d4a93 --- /dev/null +++ b/Documentation/networking/phonet.txt | |||
@@ -0,0 +1,175 @@ | |||
1 | Linux Phonet protocol family | ||
2 | ============================ | ||
3 | |||
4 | Introduction | ||
5 | ------------ | ||
6 | |||
7 | Phonet is a packet protocol used by Nokia cellular modems for both IPC | ||
8 | and RPC. With the Linux Phonet socket family, Linux host processes can | ||
9 | receive and send messages from/to the modem, or any other external | ||
10 | device attached to the modem. The modem takes care of routing. | ||
11 | |||
12 | Phonet packets can be exchanged through various hardware connections | ||
13 | depending on the device, such as: | ||
14 | - USB with the CDC Phonet interface, | ||
15 | - infrared, | ||
16 | - Bluetooth, | ||
17 | - an RS232 serial port (with a dedicated "FBUS" line discipline), | ||
18 | - the SSI bus with some TI OMAP processors. | ||
19 | |||
20 | |||
21 | Packets format | ||
22 | -------------- | ||
23 | |||
24 | Phonet packets have a common header as follows: | ||
25 | |||
26 | struct phonethdr { | ||
27 | uint8_t pn_media; /* Media type (link-layer identifier) */ | ||
28 | uint8_t pn_rdev; /* Receiver device ID */ | ||
29 | uint8_t pn_sdev; /* Sender device ID */ | ||
30 | uint8_t pn_res; /* Resource ID or function */ | ||
31 | uint16_t pn_length; /* Big-endian message byte length (minus 6) */ | ||
32 | uint8_t pn_robj; /* Receiver object ID */ | ||
33 | uint8_t pn_sobj; /* Sender object ID */ | ||
34 | }; | ||
35 | |||
36 | On Linux, the link-layer header includes the pn_media byte (see below). | ||
37 | The next 7 bytes are part of the network-layer header. | ||
38 | |||
39 | The device ID is split: the 6 higher-order bits consitute the device | ||
40 | address, while the 2 lower-order bits are used for multiplexing, as are | ||
41 | the 8-bit object identifiers. As such, Phonet can be considered as a | ||
42 | network layer with 6 bits of address space and 10 bits for transport | ||
43 | protocol (much like port numbers in IP world). | ||
44 | |||
45 | The modem always has address number zero. All other device have a their | ||
46 | own 6-bit address. | ||
47 | |||
48 | |||
49 | Link layer | ||
50 | ---------- | ||
51 | |||
52 | Phonet links are always point-to-point links. The link layer header | ||
53 | consists of a single Phonet media type byte. It uniquely identifies the | ||
54 | link through which the packet is transmitted, from the modem's | ||
55 | perspective. Each Phonet network device shall prepend and set the media | ||
56 | type byte as appropriate. For convenience, a common phonet_header_ops | ||
57 | link-layer header operations structure is provided. It sets the | ||
58 | media type according to the network device hardware address. | ||
59 | |||
60 | Linux Phonet network interfaces support a dedicated link layer packets | ||
61 | type (ETH_P_PHONET) which is out of the Ethernet type range. They can | ||
62 | only send and receive Phonet packets. | ||
63 | |||
64 | The virtual TUN tunnel device driver can also be used for Phonet. This | ||
65 | requires IFF_TUN mode, _without_ the IFF_NO_PI flag. In this case, | ||
66 | there is no link-layer header, so there is no Phonet media type byte. | ||
67 | |||
68 | Note that Phonet interfaces are not allowed to re-order packets, so | ||
69 | only the (default) Linux FIFO qdisc should be used with them. | ||
70 | |||
71 | |||
72 | Network layer | ||
73 | ------------- | ||
74 | |||
75 | The Phonet socket address family maps the Phonet packet header: | ||
76 | |||
77 | struct sockaddr_pn { | ||
78 | sa_family_t spn_family; /* AF_PHONET */ | ||
79 | uint8_t spn_obj; /* Object ID */ | ||
80 | uint8_t spn_dev; /* Device ID */ | ||
81 | uint8_t spn_resource; /* Resource or function */ | ||
82 | uint8_t spn_zero[...]; /* Padding */ | ||
83 | }; | ||
84 | |||
85 | The resource field is only used when sending and receiving; | ||
86 | It is ignored by bind() and getsockname(). | ||
87 | |||
88 | |||
89 | Low-level datagram protocol | ||
90 | --------------------------- | ||
91 | |||
92 | Applications can send Phonet messages using the Phonet datagram socket | ||
93 | protocol from the PF_PHONET family. Each socket is bound to one of the | ||
94 | 2^10 object IDs available, and can send and receive packets with any | ||
95 | other peer. | ||
96 | |||
97 | struct sockaddr_pn addr = { .spn_family = AF_PHONET, }; | ||
98 | ssize_t len; | ||
99 | socklen_t addrlen = sizeof(addr); | ||
100 | int fd; | ||
101 | |||
102 | fd = socket(PF_PHONET, SOCK_DGRAM, 0); | ||
103 | bind(fd, (struct sockaddr *)&addr, sizeof(addr)); | ||
104 | /* ... */ | ||
105 | |||
106 | sendto(fd, msg, msglen, 0, (struct sockaddr *)&addr, sizeof(addr)); | ||
107 | len = recvfrom(fd, buf, sizeof(buf), 0, | ||
108 | (struct sockaddr *)&addr, &addrlen); | ||
109 | |||
110 | This protocol follows the SOCK_DGRAM connection-less semantics. | ||
111 | However, connect() and getpeername() are not supported, as they did | ||
112 | not seem useful with Phonet usages (could be added easily). | ||
113 | |||
114 | |||
115 | Phonet Pipe protocol | ||
116 | -------------------- | ||
117 | |||
118 | The Phonet Pipe protocol is a simple sequenced packets protocol | ||
119 | with end-to-end congestion control. It uses the passive listening | ||
120 | socket paradigm. The listening socket is bound to an unique free object | ||
121 | ID. Each listening socket can handle up to 255 simultaneous | ||
122 | connections, one per accept()'d socket. | ||
123 | |||
124 | int lfd, cfd; | ||
125 | |||
126 | lfd = socket(PF_PHONET, SOCK_SEQPACKET, PN_PROTO_PIPE); | ||
127 | listen (lfd, INT_MAX); | ||
128 | |||
129 | /* ... */ | ||
130 | cfd = accept(lfd, NULL, NULL); | ||
131 | for (;;) | ||
132 | { | ||
133 | char buf[...]; | ||
134 | ssize_t len = read(cfd, buf, sizeof(buf)); | ||
135 | |||
136 | /* ... */ | ||
137 | |||
138 | write(cfd, msg, msglen); | ||
139 | } | ||
140 | |||
141 | Connections are established between two endpoints by a "third party" | ||
142 | application. This means that both endpoints are passive; so connect() | ||
143 | is not possible. | ||
144 | |||
145 | WARNING: | ||
146 | When polling a connected pipe socket for writability, there is an | ||
147 | intrinsic race condition whereby writability might be lost between the | ||
148 | polling and the writing system calls. In this case, the socket will | ||
149 | block until write becomes possible again, unless non-blocking mode | ||
150 | is enabled. | ||
151 | |||
152 | |||
153 | The pipe protocol provides two socket options at the SOL_PNPIPE level: | ||
154 | |||
155 | PNPIPE_ENCAP accepts one integer value (int) of: | ||
156 | |||
157 | PNPIPE_ENCAP_NONE: The socket operates normally (default). | ||
158 | |||
159 | PNPIPE_ENCAP_IP: The socket is used as a backend for a virtual IP | ||
160 | interface. This requires CAP_NET_ADMIN capability. GPRS data | ||
161 | support on Nokia modems can use this. Note that the socket cannot | ||
162 | be reliably poll()'d or read() from while in this mode. | ||
163 | |||
164 | PNPIPE_IFINDEX is a read-only integer value. It contains the | ||
165 | interface index of the network interface created by PNPIPE_ENCAP, | ||
166 | or zero if encapsulation is off. | ||
167 | |||
168 | |||
169 | Authors | ||
170 | ------- | ||
171 | |||
172 | Linux Phonet was initially written by Sakari Ailus. | ||
173 | Other contributors include Mikä Liljeberg, Andras Domokos, | ||
174 | Carlos Chinea and Rémi Denis-Courmont. | ||
175 | Copyright (C) 2008 Nokia Corporation. | ||
diff --git a/Documentation/networking/regulatory.txt b/Documentation/networking/regulatory.txt new file mode 100644 index 000000000000..a96989a8ff35 --- /dev/null +++ b/Documentation/networking/regulatory.txt | |||
@@ -0,0 +1,194 @@ | |||
1 | Linux wireless regulatory documentation | ||
2 | --------------------------------------- | ||
3 | |||
4 | This document gives a brief review over how the Linux wireless | ||
5 | regulatory infrastructure works. | ||
6 | |||
7 | More up to date information can be obtained at the project's web page: | ||
8 | |||
9 | http://wireless.kernel.org/en/developers/Regulatory | ||
10 | |||
11 | Keeping regulatory domains in userspace | ||
12 | --------------------------------------- | ||
13 | |||
14 | Due to the dynamic nature of regulatory domains we keep them | ||
15 | in userspace and provide a framework for userspace to upload | ||
16 | to the kernel one regulatory domain to be used as the central | ||
17 | core regulatory domain all wireless devices should adhere to. | ||
18 | |||
19 | How to get regulatory domains to the kernel | ||
20 | ------------------------------------------- | ||
21 | |||
22 | Userspace gets a regulatory domain in the kernel by having | ||
23 | a userspace agent build it and send it via nl80211. Only | ||
24 | expected regulatory domains will be respected by the kernel. | ||
25 | |||
26 | A currently available userspace agent which can accomplish this | ||
27 | is CRDA - central regulatory domain agent. Its documented here: | ||
28 | |||
29 | http://wireless.kernel.org/en/developers/Regulatory/CRDA | ||
30 | |||
31 | Essentially the kernel will send a udev event when it knows | ||
32 | it needs a new regulatory domain. A udev rule can be put in place | ||
33 | to trigger crda to send the respective regulatory domain for a | ||
34 | specific ISO/IEC 3166 alpha2. | ||
35 | |||
36 | Below is an example udev rule which can be used: | ||
37 | |||
38 | # Example file, should be put in /etc/udev/rules.d/regulatory.rules | ||
39 | KERNEL=="regulatory*", ACTION=="change", SUBSYSTEM=="platform", RUN+="/sbin/crda" | ||
40 | |||
41 | The alpha2 is passed as an environment variable under the variable COUNTRY. | ||
42 | |||
43 | Who asks for regulatory domains? | ||
44 | -------------------------------- | ||
45 | |||
46 | * Users | ||
47 | |||
48 | Users can use iw: | ||
49 | |||
50 | http://wireless.kernel.org/en/users/Documentation/iw | ||
51 | |||
52 | An example: | ||
53 | |||
54 | # set regulatory domain to "Costa Rica" | ||
55 | iw reg set CR | ||
56 | |||
57 | This will request the kernel to set the regulatory domain to | ||
58 | the specificied alpha2. The kernel in turn will then ask userspace | ||
59 | to provide a regulatory domain for the alpha2 specified by the user | ||
60 | by sending a uevent. | ||
61 | |||
62 | * Wireless subsystems for Country Information elements | ||
63 | |||
64 | The kernel will send a uevent to inform userspace a new | ||
65 | regulatory domain is required. More on this to be added | ||
66 | as its integration is added. | ||
67 | |||
68 | * Drivers | ||
69 | |||
70 | If drivers determine they need a specific regulatory domain | ||
71 | set they can inform the wireless core using regulatory_hint(). | ||
72 | They have two options -- they either provide an alpha2 so that | ||
73 | crda can provide back a regulatory domain for that country or | ||
74 | they can build their own regulatory domain based on internal | ||
75 | custom knowledge so the wireless core can respect it. | ||
76 | |||
77 | *Most* drivers will rely on the first mechanism of providing a | ||
78 | regulatory hint with an alpha2. For these drivers there is an additional | ||
79 | check that can be used to ensure compliance based on custom EEPROM | ||
80 | regulatory data. This additional check can be used by drivers by | ||
81 | registering on its struct wiphy a reg_notifier() callback. This notifier | ||
82 | is called when the core's regulatory domain has been changed. The driver | ||
83 | can use this to review the changes made and also review who made them | ||
84 | (driver, user, country IE) and determine what to allow based on its | ||
85 | internal EEPROM data. Devices drivers wishing to be capable of world | ||
86 | roaming should use this callback. More on world roaming will be | ||
87 | added to this document when its support is enabled. | ||
88 | |||
89 | Device drivers who provide their own built regulatory domain | ||
90 | do not need a callback as the channels registered by them are | ||
91 | the only ones that will be allowed and therefore *additional* | ||
92 | cannels cannot be enabled. | ||
93 | |||
94 | Example code - drivers hinting an alpha2: | ||
95 | ------------------------------------------ | ||
96 | |||
97 | This example comes from the zd1211rw device driver. You can start | ||
98 | by having a mapping of your device's EEPROM country/regulatory | ||
99 | domain value to to a specific alpha2 as follows: | ||
100 | |||
101 | static struct zd_reg_alpha2_map reg_alpha2_map[] = { | ||
102 | { ZD_REGDOMAIN_FCC, "US" }, | ||
103 | { ZD_REGDOMAIN_IC, "CA" }, | ||
104 | { ZD_REGDOMAIN_ETSI, "DE" }, /* Generic ETSI, use most restrictive */ | ||
105 | { ZD_REGDOMAIN_JAPAN, "JP" }, | ||
106 | { ZD_REGDOMAIN_JAPAN_ADD, "JP" }, | ||
107 | { ZD_REGDOMAIN_SPAIN, "ES" }, | ||
108 | { ZD_REGDOMAIN_FRANCE, "FR" }, | ||
109 | |||
110 | Then you can define a routine to map your read EEPROM value to an alpha2, | ||
111 | as follows: | ||
112 | |||
113 | static int zd_reg2alpha2(u8 regdomain, char *alpha2) | ||
114 | { | ||
115 | unsigned int i; | ||
116 | struct zd_reg_alpha2_map *reg_map; | ||
117 | for (i = 0; i < ARRAY_SIZE(reg_alpha2_map); i++) { | ||
118 | reg_map = ®_alpha2_map[i]; | ||
119 | if (regdomain == reg_map->reg) { | ||
120 | alpha2[0] = reg_map->alpha2[0]; | ||
121 | alpha2[1] = reg_map->alpha2[1]; | ||
122 | return 0; | ||
123 | } | ||
124 | } | ||
125 | return 1; | ||
126 | } | ||
127 | |||
128 | Lastly, you can then hint to the core of your discovered alpha2, if a match | ||
129 | was found. You need to do this after you have registered your wiphy. You | ||
130 | are expected to do this during initialization. | ||
131 | |||
132 | r = zd_reg2alpha2(mac->regdomain, alpha2); | ||
133 | if (!r) | ||
134 | regulatory_hint(hw->wiphy, alpha2, NULL); | ||
135 | |||
136 | Example code - drivers providing a built in regulatory domain: | ||
137 | -------------------------------------------------------------- | ||
138 | |||
139 | If you have regulatory information you can obtain from your | ||
140 | driver and you *need* to use this we let you build a regulatory domain | ||
141 | structure and pass it to the wireless core. To do this you should | ||
142 | kmalloc() a structure big enough to hold your regulatory domain | ||
143 | structure and you should then fill it with your data. Finally you simply | ||
144 | call regulatory_hint() with the regulatory domain structure in it. | ||
145 | |||
146 | Bellow is a simple example, with a regulatory domain cached using the stack. | ||
147 | Your implementation may vary (read EEPROM cache instead, for example). | ||
148 | |||
149 | Example cache of some regulatory domain | ||
150 | |||
151 | struct ieee80211_regdomain mydriver_jp_regdom = { | ||
152 | .n_reg_rules = 3, | ||
153 | .alpha2 = "JP", | ||
154 | //.alpha2 = "99", /* If I have no alpha2 to map it to */ | ||
155 | .reg_rules = { | ||
156 | /* IEEE 802.11b/g, channels 1..14 */ | ||
157 | REG_RULE(2412-20, 2484+20, 40, 6, 20, 0), | ||
158 | /* IEEE 802.11a, channels 34..48 */ | ||
159 | REG_RULE(5170-20, 5240+20, 40, 6, 20, | ||
160 | NL80211_RRF_PASSIVE_SCAN), | ||
161 | /* IEEE 802.11a, channels 52..64 */ | ||
162 | REG_RULE(5260-20, 5320+20, 40, 6, 20, | ||
163 | NL80211_RRF_NO_IBSS | | ||
164 | NL80211_RRF_DFS), | ||
165 | } | ||
166 | }; | ||
167 | |||
168 | Then in some part of your code after your wiphy has been registered: | ||
169 | |||
170 | int r; | ||
171 | struct ieee80211_regdomain *rd; | ||
172 | int size_of_regd; | ||
173 | int num_rules = mydriver_jp_regdom.n_reg_rules; | ||
174 | unsigned int i; | ||
175 | |||
176 | size_of_regd = sizeof(struct ieee80211_regdomain) + | ||
177 | (num_rules * sizeof(struct ieee80211_reg_rule)); | ||
178 | |||
179 | rd = kzalloc(size_of_regd, GFP_KERNEL); | ||
180 | if (!rd) | ||
181 | return -ENOMEM; | ||
182 | |||
183 | memcpy(rd, &mydriver_jp_regdom, sizeof(struct ieee80211_regdomain)); | ||
184 | |||
185 | for (i=0; i < num_rules; i++) { | ||
186 | memcpy(&rd->reg_rules[i], &mydriver_jp_regdom.reg_rules[i], | ||
187 | sizeof(struct ieee80211_reg_rule)); | ||
188 | } | ||
189 | r = regulatory_hint(hw->wiphy, NULL, rd); | ||
190 | if (r) { | ||
191 | kfree(rd); | ||
192 | return r; | ||
193 | } | ||
194 | |||
diff --git a/Documentation/networking/s2io.txt b/Documentation/networking/s2io.txt index 1e28e2ddb90a..c3d6b4d5d014 100644 --- a/Documentation/networking/s2io.txt +++ b/Documentation/networking/s2io.txt | |||
@@ -52,13 +52,10 @@ d. MSI/MSI-X. Can be enabled on platforms which support this feature | |||
52 | (IA64, Xeon) resulting in noticeable performance improvement(upto 7% | 52 | (IA64, Xeon) resulting in noticeable performance improvement(upto 7% |
53 | on certain platforms). | 53 | on certain platforms). |
54 | 54 | ||
55 | e. NAPI. Compile-time option(CONFIG_S2IO_NAPI) for better Rx interrupt | 55 | e. Statistics. Comprehensive MAC-level and software statistics displayed |
56 | moderation. | ||
57 | |||
58 | f. Statistics. Comprehensive MAC-level and software statistics displayed | ||
59 | using "ethtool -S" option. | 56 | using "ethtool -S" option. |
60 | 57 | ||
61 | g. Multi-FIFO/Ring. Supports up to 8 transmit queues and receive rings, | 58 | f. Multi-FIFO/Ring. Supports up to 8 transmit queues and receive rings, |
62 | with multiple steering options. | 59 | with multiple steering options. |
63 | 60 | ||
64 | 4. Command line parameters | 61 | 4. Command line parameters |
diff --git a/Documentation/networking/tc-actions-env-rules.txt b/Documentation/networking/tc-actions-env-rules.txt index 01e716d185f4..dcadf6f88e34 100644 --- a/Documentation/networking/tc-actions-env-rules.txt +++ b/Documentation/networking/tc-actions-env-rules.txt | |||
@@ -4,26 +4,27 @@ The "enviromental" rules for authors of any new tc actions are: | |||
4 | 1) If you stealeth or borroweth any packet thou shalt be branching | 4 | 1) If you stealeth or borroweth any packet thou shalt be branching |
5 | from the righteous path and thou shalt cloneth. | 5 | from the righteous path and thou shalt cloneth. |
6 | 6 | ||
7 | For example if your action queues a packet to be processed later | 7 | For example if your action queues a packet to be processed later, |
8 | or intentionaly branches by redirecting a packet then you need to | 8 | or intentionally branches by redirecting a packet, then you need to |
9 | clone the packet. | 9 | clone the packet. |
10 | |||
10 | There are certain fields in the skb tc_verd that need to be reset so we | 11 | There are certain fields in the skb tc_verd that need to be reset so we |
11 | avoid loops etc. A few are generic enough so much so that skb_act_clone() | 12 | avoid loops, etc. A few are generic enough that skb_act_clone() |
12 | resets them for you. So invoke skb_act_clone() rather than skb_clone() | 13 | resets them for you, so invoke skb_act_clone() rather than skb_clone(). |
13 | 14 | ||
14 | 2) If you munge any packet thou shalt call pskb_expand_head in the case | 15 | 2) If you munge any packet thou shalt call pskb_expand_head in the case |
15 | someone else is referencing the skb. After that you "own" the skb. | 16 | someone else is referencing the skb. After that you "own" the skb. |
16 | You must also tell us if it is ok to munge the packet (TC_OK2MUNGE), | 17 | You must also tell us if it is ok to munge the packet (TC_OK2MUNGE), |
17 | this way any action downstream can stomp on the packet. | 18 | this way any action downstream can stomp on the packet. |
18 | 19 | ||
19 | 3) dropping packets you dont own is a nono. You simply return | 20 | 3) Dropping packets you don't own is a no-no. You simply return |
20 | TC_ACT_SHOT to the caller and they will drop it. | 21 | TC_ACT_SHOT to the caller and they will drop it. |
21 | 22 | ||
22 | The "enviromental" rules for callers of actions (qdiscs etc) are: | 23 | The "enviromental" rules for callers of actions (qdiscs etc) are: |
23 | 24 | ||
24 | *) thou art responsible for freeing anything returned as being | 25 | *) Thou art responsible for freeing anything returned as being |
25 | TC_ACT_SHOT/STOLEN/QUEUED. If none of TC_ACT_SHOT/STOLEN/QUEUED is | 26 | TC_ACT_SHOT/STOLEN/QUEUED. If none of TC_ACT_SHOT/STOLEN/QUEUED is |
26 | returned then all is great and you dont need to do anything. | 27 | returned, then all is great and you don't need to do anything. |
27 | 28 | ||
28 | Post on netdev if something is unclear. | 29 | Post on netdev if something is unclear. |
29 | 30 | ||
diff --git a/Documentation/networking/tproxy.txt b/Documentation/networking/tproxy.txt new file mode 100644 index 000000000000..7b5996d9357e --- /dev/null +++ b/Documentation/networking/tproxy.txt | |||
@@ -0,0 +1,85 @@ | |||
1 | Transparent proxy support | ||
2 | ========================= | ||
3 | |||
4 | This feature adds Linux 2.2-like transparent proxy support to current kernels. | ||
5 | To use it, enable NETFILTER_TPROXY, the socket match and the TPROXY target in | ||
6 | your kernel config. You will need policy routing too, so be sure to enable that | ||
7 | as well. | ||
8 | |||
9 | |||
10 | 1. Making non-local sockets work | ||
11 | ================================ | ||
12 | |||
13 | The idea is that you identify packets with destination address matching a local | ||
14 | socket on your box, set the packet mark to a certain value, and then match on that | ||
15 | value using policy routing to have those packets delivered locally: | ||
16 | |||
17 | # iptables -t mangle -N DIVERT | ||
18 | # iptables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT | ||
19 | # iptables -t mangle -A DIVERT -j MARK --set-mark 1 | ||
20 | # iptables -t mangle -A DIVERT -j ACCEPT | ||
21 | |||
22 | # ip rule add fwmark 1 lookup 100 | ||
23 | # ip route add local 0.0.0.0/0 dev lo table 100 | ||
24 | |||
25 | Because of certain restrictions in the IPv4 routing output code you'll have to | ||
26 | modify your application to allow it to send datagrams _from_ non-local IP | ||
27 | addresses. All you have to do is enable the (SOL_IP, IP_TRANSPARENT) socket | ||
28 | option before calling bind: | ||
29 | |||
30 | fd = socket(AF_INET, SOCK_STREAM, 0); | ||
31 | /* - 8< -*/ | ||
32 | int value = 1; | ||
33 | setsockopt(fd, SOL_IP, IP_TRANSPARENT, &value, sizeof(value)); | ||
34 | /* - 8< -*/ | ||
35 | name.sin_family = AF_INET; | ||
36 | name.sin_port = htons(0xCAFE); | ||
37 | name.sin_addr.s_addr = htonl(0xDEADBEEF); | ||
38 | bind(fd, &name, sizeof(name)); | ||
39 | |||
40 | A trivial patch for netcat is available here: | ||
41 | http://people.netfilter.org/hidden/tproxy/netcat-ip_transparent-support.patch | ||
42 | |||
43 | |||
44 | 2. Redirecting traffic | ||
45 | ====================== | ||
46 | |||
47 | Transparent proxying often involves "intercepting" traffic on a router. This is | ||
48 | usually done with the iptables REDIRECT target; however, there are serious | ||
49 | limitations of that method. One of the major issues is that it actually | ||
50 | modifies the packets to change the destination address -- which might not be | ||
51 | acceptable in certain situations. (Think of proxying UDP for example: you won't | ||
52 | be able to find out the original destination address. Even in case of TCP | ||
53 | getting the original destination address is racy.) | ||
54 | |||
55 | The 'TPROXY' target provides similar functionality without relying on NAT. Simply | ||
56 | add rules like this to the iptables ruleset above: | ||
57 | |||
58 | # iptables -t mangle -A PREROUTING -p tcp --dport 80 -j TPROXY \ | ||
59 | --tproxy-mark 0x1/0x1 --on-port 50080 | ||
60 | |||
61 | Note that for this to work you'll have to modify the proxy to enable (SOL_IP, | ||
62 | IP_TRANSPARENT) for the listening socket. | ||
63 | |||
64 | |||
65 | 3. Iptables extensions | ||
66 | ====================== | ||
67 | |||
68 | To use tproxy you'll need to have the 'socket' and 'TPROXY' modules | ||
69 | compiled for iptables. A patched version of iptables is available | ||
70 | here: http://git.balabit.hu/?p=bazsi/iptables-tproxy.git | ||
71 | |||
72 | |||
73 | 4. Application support | ||
74 | ====================== | ||
75 | |||
76 | 4.1. Squid | ||
77 | ---------- | ||
78 | |||
79 | Squid 3.HEAD has support built-in. To use it, pass | ||
80 | '--enable-linux-netfilter' to configure and set the 'tproxy' option on | ||
81 | the HTTP listener you redirect traffic to with the TPROXY iptables | ||
82 | target. | ||
83 | |||
84 | For more information please consult the following page on the Squid | ||
85 | wiki: http://wiki.squid-cache.org/Features/Tproxy4 | ||
diff --git a/Documentation/networking/udplite.txt b/Documentation/networking/udplite.txt index 3870f280280b..855d8da57a23 100644 --- a/Documentation/networking/udplite.txt +++ b/Documentation/networking/udplite.txt | |||
@@ -148,7 +148,7 @@ | |||
148 | getsockopt(sockfd, SOL_SOCKET, SO_NO_CHECK, &value, ...); | 148 | getsockopt(sockfd, SOL_SOCKET, SO_NO_CHECK, &value, ...); |
149 | 149 | ||
150 | is meaningless (as in TCP). Packets with a zero checksum field are | 150 | is meaningless (as in TCP). Packets with a zero checksum field are |
151 | illegal (cf. RFC 3828, sec. 3.1) will be silently discarded. | 151 | illegal (cf. RFC 3828, sec. 3.1) and will be silently discarded. |
152 | 152 | ||
153 | 4) Fragmentation | 153 | 4) Fragmentation |
154 | 154 | ||
diff --git a/Documentation/networking/vortex.txt b/Documentation/networking/vortex.txt index 6356d3faed36..bd70976b8160 100644 --- a/Documentation/networking/vortex.txt +++ b/Documentation/networking/vortex.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | Documentation/networking/vortex.txt | 1 | Documentation/networking/vortex.txt |
2 | Andrew Morton <andrewm@uow.edu.au> | 2 | Andrew Morton |
3 | 30 April 2000 | 3 | 30 April 2000 |
4 | 4 | ||
5 | 5 | ||
@@ -11,7 +11,7 @@ The driver was written by Donald Becker <becker@scyld.com> | |||
11 | Don is no longer the prime maintainer of this version of the driver. | 11 | Don is no longer the prime maintainer of this version of the driver. |
12 | Please report problems to one or more of: | 12 | Please report problems to one or more of: |
13 | 13 | ||
14 | Andrew Morton <akpm@osdl.org> | 14 | Andrew Morton |
15 | Netdev mailing list <netdev@vger.kernel.org> | 15 | Netdev mailing list <netdev@vger.kernel.org> |
16 | Linux kernel mailing list <linux-kernel@vger.kernel.org> | 16 | Linux kernel mailing list <linux-kernel@vger.kernel.org> |
17 | 17 | ||
@@ -305,11 +305,6 @@ Donald's wake-on-LAN page: | |||
305 | 305 | ||
306 | ftp://ftp.3com.com/pub/nic/3c90x/3c90xx2.exe | 306 | ftp://ftp.3com.com/pub/nic/3c90x/3c90xx2.exe |
307 | 307 | ||
308 | Driver updates and a detailed changelog for the modifications which | ||
309 | were made for the 2.3/2,4 series kernel is available at | ||
310 | |||
311 | http://www.zip.com.au/~akpm/linux/#3c59x-bc | ||
312 | |||
313 | 308 | ||
314 | Autonegotiation notes | 309 | Autonegotiation notes |
315 | --------------------- | 310 | --------------------- |
diff --git a/Documentation/pcmcia/Makefile b/Documentation/pcmcia/Makefile new file mode 100644 index 000000000000..accde871ae77 --- /dev/null +++ b/Documentation/pcmcia/Makefile | |||
@@ -0,0 +1,10 @@ | |||
1 | # kbuild trick to avoid linker error. Can be omitted if a module is built. | ||
2 | obj- := dummy.o | ||
3 | |||
4 | # List of programs to build | ||
5 | hostprogs-y := crc32hash | ||
6 | |||
7 | # Tell kbuild to always build the programs | ||
8 | always := $(hostprogs-y) | ||
9 | |||
10 | HOSTCFLAGS_crc32hash.o += -I$(objtree)/usr/include | ||
diff --git a/Documentation/pcmcia/crc32hash.c b/Documentation/pcmcia/crc32hash.c index cbc36d299af8..4210e5abab8a 100644 --- a/Documentation/pcmcia/crc32hash.c +++ b/Documentation/pcmcia/crc32hash.c | |||
@@ -26,7 +26,7 @@ int main(int argc, char **argv) { | |||
26 | printf("no string passed as argument\n"); | 26 | printf("no string passed as argument\n"); |
27 | return -1; | 27 | return -1; |
28 | } | 28 | } |
29 | result = crc32(argv[1], strlen(argv[1])); | 29 | result = crc32((unsigned char const *)argv[1], strlen(argv[1])); |
30 | printf("0x%x\n", result); | 30 | printf("0x%x\n", result); |
31 | return 0; | 31 | return 0; |
32 | } | 32 | } |
diff --git a/Documentation/pcmcia/driver-changes.txt b/Documentation/pcmcia/driver-changes.txt index 96f155e68750..059934363caf 100644 --- a/Documentation/pcmcia/driver-changes.txt +++ b/Documentation/pcmcia/driver-changes.txt | |||
@@ -1,5 +1,11 @@ | |||
1 | This file details changes in 2.6 which affect PCMCIA card driver authors: | 1 | This file details changes in 2.6 which affect PCMCIA card driver authors: |
2 | 2 | ||
3 | * New configuration loop helper (as of 2.6.28) | ||
4 | By calling pcmcia_loop_config(), a driver can iterate over all available | ||
5 | configuration options. During a driver's probe() phase, one doesn't need | ||
6 | to use pcmcia_get_{first,next}_tuple, pcmcia_get_tuple_data and | ||
7 | pcmcia_parse_tuple directly in most if not all cases. | ||
8 | |||
3 | * New release helper (as of 2.6.17) | 9 | * New release helper (as of 2.6.17) |
4 | Instead of calling pcmcia_release_{configuration,io,irq,win}, all that's | 10 | Instead of calling pcmcia_release_{configuration,io,irq,win}, all that's |
5 | necessary now is calling pcmcia_disable_device. As there is no valid | 11 | necessary now is calling pcmcia_disable_device. As there is no valid |
diff --git a/Documentation/power/00-INDEX b/Documentation/power/00-INDEX index a55d7f1c836d..fb742c213c9e 100644 --- a/Documentation/power/00-INDEX +++ b/Documentation/power/00-INDEX | |||
@@ -1,5 +1,7 @@ | |||
1 | 00-INDEX | 1 | 00-INDEX |
2 | - This file | 2 | - This file |
3 | apm-acpi.txt | ||
4 | - basic info about the APM and ACPI support. | ||
3 | basic-pm-debugging.txt | 5 | basic-pm-debugging.txt |
4 | - Debugging suspend and resume | 6 | - Debugging suspend and resume |
5 | devices.txt | 7 | devices.txt |
@@ -14,8 +16,6 @@ notifiers.txt | |||
14 | - Registering suspend notifiers in device drivers | 16 | - Registering suspend notifiers in device drivers |
15 | pci.txt | 17 | pci.txt |
16 | - How the PCI Subsystem Does Power Management | 18 | - How the PCI Subsystem Does Power Management |
17 | pm.txt | ||
18 | - info on Linux power management support. | ||
19 | pm_qos_interface.txt | 19 | pm_qos_interface.txt |
20 | - info on Linux PM Quality of Service interface | 20 | - info on Linux PM Quality of Service interface |
21 | power_supply_class.txt | 21 | power_supply_class.txt |
diff --git a/Documentation/power/apm-acpi.txt b/Documentation/power/apm-acpi.txt new file mode 100644 index 000000000000..1bd799dc17e8 --- /dev/null +++ b/Documentation/power/apm-acpi.txt | |||
@@ -0,0 +1,32 @@ | |||
1 | APM or ACPI? | ||
2 | ------------ | ||
3 | If you have a relatively recent x86 mobile, desktop, or server system, | ||
4 | odds are it supports either Advanced Power Management (APM) or | ||
5 | Advanced Configuration and Power Interface (ACPI). ACPI is the newer | ||
6 | of the two technologies and puts power management in the hands of the | ||
7 | operating system, allowing for more intelligent power management than | ||
8 | is possible with BIOS controlled APM. | ||
9 | |||
10 | The best way to determine which, if either, your system supports is to | ||
11 | build a kernel with both ACPI and APM enabled (as of 2.3.x ACPI is | ||
12 | enabled by default). If a working ACPI implementation is found, the | ||
13 | ACPI driver will override and disable APM, otherwise the APM driver | ||
14 | will be used. | ||
15 | |||
16 | No, sorry, you cannot have both ACPI and APM enabled and running at | ||
17 | once. Some people with broken ACPI or broken APM implementations | ||
18 | would like to use both to get a full set of working features, but you | ||
19 | simply cannot mix and match the two. Only one power management | ||
20 | interface can be in control of the machine at once. Think about it.. | ||
21 | |||
22 | User-space Daemons | ||
23 | ------------------ | ||
24 | Both APM and ACPI rely on user-space daemons, apmd and acpid | ||
25 | respectively, to be completely functional. Obtain both of these | ||
26 | daemons from your Linux distribution or from the Internet (see below) | ||
27 | and be sure that they are started sometime in the system boot process. | ||
28 | Go ahead and start both. If ACPI or APM is not available on your | ||
29 | system the associated daemon will exit gracefully. | ||
30 | |||
31 | apmd: http://worldvisions.ca/~apenwarr/apmd/ | ||
32 | acpid: http://acpid.sf.net/ | ||
diff --git a/Documentation/power/pm.txt b/Documentation/power/pm.txt deleted file mode 100644 index be841507e43f..000000000000 --- a/Documentation/power/pm.txt +++ /dev/null | |||
@@ -1,257 +0,0 @@ | |||
1 | Linux Power Management Support | ||
2 | |||
3 | This document briefly describes how to use power management with your | ||
4 | Linux system and how to add power management support to Linux drivers. | ||
5 | |||
6 | APM or ACPI? | ||
7 | ------------ | ||
8 | If you have a relatively recent x86 mobile, desktop, or server system, | ||
9 | odds are it supports either Advanced Power Management (APM) or | ||
10 | Advanced Configuration and Power Interface (ACPI). ACPI is the newer | ||
11 | of the two technologies and puts power management in the hands of the | ||
12 | operating system, allowing for more intelligent power management than | ||
13 | is possible with BIOS controlled APM. | ||
14 | |||
15 | The best way to determine which, if either, your system supports is to | ||
16 | build a kernel with both ACPI and APM enabled (as of 2.3.x ACPI is | ||
17 | enabled by default). If a working ACPI implementation is found, the | ||
18 | ACPI driver will override and disable APM, otherwise the APM driver | ||
19 | will be used. | ||
20 | |||
21 | No, sorry, you cannot have both ACPI and APM enabled and running at | ||
22 | once. Some people with broken ACPI or broken APM implementations | ||
23 | would like to use both to get a full set of working features, but you | ||
24 | simply cannot mix and match the two. Only one power management | ||
25 | interface can be in control of the machine at once. Think about it.. | ||
26 | |||
27 | User-space Daemons | ||
28 | ------------------ | ||
29 | Both APM and ACPI rely on user-space daemons, apmd and acpid | ||
30 | respectively, to be completely functional. Obtain both of these | ||
31 | daemons from your Linux distribution or from the Internet (see below) | ||
32 | and be sure that they are started sometime in the system boot process. | ||
33 | Go ahead and start both. If ACPI or APM is not available on your | ||
34 | system the associated daemon will exit gracefully. | ||
35 | |||
36 | apmd: http://worldvisions.ca/~apenwarr/apmd/ | ||
37 | acpid: http://acpid.sf.net/ | ||
38 | |||
39 | Driver Interface -- OBSOLETE, DO NOT USE! | ||
40 | ----------------************************* | ||
41 | |||
42 | Note: pm_register(), pm_access(), pm_dev_idle() and friends are | ||
43 | obsolete. Please do not use them. Instead you should properly hook | ||
44 | your driver into the driver model, and use its suspend()/resume() | ||
45 | callbacks to do this kind of stuff. | ||
46 | |||
47 | If you are writing a new driver or maintaining an old driver, it | ||
48 | should include power management support. Without power management | ||
49 | support, a single driver may prevent a system with power management | ||
50 | capabilities from ever being able to suspend (safely). | ||
51 | |||
52 | Overview: | ||
53 | 1) Register each instance of a device with "pm_register" | ||
54 | 2) Call "pm_access" before accessing the hardware. | ||
55 | (this will ensure that the hardware is awake and ready) | ||
56 | 3) Your "pm_callback" is called before going into a | ||
57 | suspend state (ACPI D1-D3) or after resuming (ACPI D0) | ||
58 | from a suspend. | ||
59 | 4) Call "pm_dev_idle" when the device is not being used | ||
60 | (optional but will improve device idle detection) | ||
61 | 5) When unloaded, unregister the device with "pm_unregister" | ||
62 | |||
63 | /* | ||
64 | * Description: Register a device with the power-management subsystem | ||
65 | * | ||
66 | * Parameters: | ||
67 | * type - device type (PCI device, system device, ...) | ||
68 | * id - instance number or unique identifier | ||
69 | * cback - request handler callback (suspend, resume, ...) | ||
70 | * | ||
71 | * Returns: Registered PM device or NULL on error | ||
72 | * | ||
73 | * Examples: | ||
74 | * dev = pm_register(PM_SYS_DEV, PM_SYS_VGA, vga_callback); | ||
75 | * | ||
76 | * struct pci_dev *pci_dev = pci_find_dev(...); | ||
77 | * dev = pm_register(PM_PCI_DEV, PM_PCI_ID(pci_dev), callback); | ||
78 | */ | ||
79 | struct pm_dev *pm_register(pm_dev_t type, unsigned long id, pm_callback cback); | ||
80 | |||
81 | /* | ||
82 | * Description: Unregister a device with the power management subsystem | ||
83 | * | ||
84 | * Parameters: | ||
85 | * dev - PM device previously returned from pm_register | ||
86 | */ | ||
87 | void pm_unregister(struct pm_dev *dev); | ||
88 | |||
89 | /* | ||
90 | * Description: Unregister all devices with a matching callback function | ||
91 | * | ||
92 | * Parameters: | ||
93 | * cback - previously registered request callback | ||
94 | * | ||
95 | * Notes: Provided for easier porting from old APM interface | ||
96 | */ | ||
97 | void pm_unregister_all(pm_callback cback); | ||
98 | |||
99 | /* | ||
100 | * Power management request callback | ||
101 | * | ||
102 | * Parameters: | ||
103 | * dev - PM device previously returned from pm_register | ||
104 | * rqst - request type | ||
105 | * data - data, if any, associated with the request | ||
106 | * | ||
107 | * Returns: 0 if the request is successful | ||
108 | * EINVAL if the request is not supported | ||
109 | * EBUSY if the device is now busy and cannot handle the request | ||
110 | * ENOMEM if the device was unable to handle the request due to memory | ||
111 | * | ||
112 | * Details: The device request callback will be called before the | ||
113 | * device/system enters a suspend state (ACPI D1-D3) or | ||
114 | * or after the device/system resumes from suspend (ACPI D0). | ||
115 | * For PM_SUSPEND, the ACPI D-state being entered is passed | ||
116 | * as the "data" argument to the callback. The device | ||
117 | * driver should save (PM_SUSPEND) or restore (PM_RESUME) | ||
118 | * device context when the request callback is called. | ||
119 | * | ||
120 | * Once a driver returns 0 (success) from a suspend | ||
121 | * request, it should not process any further requests or | ||
122 | * access the device hardware until a call to "pm_access" is made. | ||
123 | */ | ||
124 | typedef int (*pm_callback)(struct pm_dev *dev, pm_request_t rqst, void *data); | ||
125 | |||
126 | Driver Details | ||
127 | -------------- | ||
128 | This is just a quick Q&A as a stopgap until a real driver writers' | ||
129 | power management guide is available. | ||
130 | |||
131 | Q: When is a device suspended? | ||
132 | |||
133 | Devices can be suspended based on direct user request (eg. laptop lid | ||
134 | closes), system power policy (eg. sleep after 30 minutes of console | ||
135 | inactivity), or device power policy (eg. power down device after 5 | ||
136 | minutes of inactivity) | ||
137 | |||
138 | Q: Must a driver honor a suspend request? | ||
139 | |||
140 | No, a driver can return -EBUSY from a suspend request and this | ||
141 | will stop the system from suspending. When a suspend request | ||
142 | fails, all suspended devices are resumed and the system continues | ||
143 | to run. Suspend can be retried at a later time. | ||
144 | |||
145 | Q: Can the driver block suspend/resume requests? | ||
146 | |||
147 | Yes, a driver can delay its return from a suspend or resume | ||
148 | request until the device is ready to handle requests. It | ||
149 | is advantageous to return as quickly as possible from a | ||
150 | request as suspend/resume are done serially. | ||
151 | |||
152 | Q: What context is a suspend/resume initiated from? | ||
153 | |||
154 | A suspend or resume is initiated from a kernel thread context. | ||
155 | It is safe to block, allocate memory, initiate requests | ||
156 | or anything else you can do within the kernel. | ||
157 | |||
158 | Q: Will requests continue to arrive after a suspend? | ||
159 | |||
160 | Possibly. It is the driver's responsibility to queue(*), | ||
161 | fail, or drop any requests that arrive after returning | ||
162 | success to a suspend request. It is important that the | ||
163 | driver not access its device until after it receives | ||
164 | a resume request as the device's bus may no longer | ||
165 | be active. | ||
166 | |||
167 | (*) If a driver queues requests for processing after | ||
168 | resume be aware that the device, network, etc. | ||
169 | might be in a different state than at suspend time. | ||
170 | It's probably better to drop requests unless | ||
171 | the driver is a storage device. | ||
172 | |||
173 | Q: Do I have to manage bus-specific power management registers | ||
174 | |||
175 | No. It is the responsibility of the bus driver to manage | ||
176 | PCI, USB, etc. power management registers. The bus driver | ||
177 | or the power management subsystem will also enable any | ||
178 | wake-on functionality that the device has. | ||
179 | |||
180 | Q: So, really, what do I need to do to support suspend/resume? | ||
181 | |||
182 | You need to save any device context that would | ||
183 | be lost if the device was powered off and then restore | ||
184 | it at resume time. When ACPI is active, there are | ||
185 | three levels of device suspend states; D1, D2, and D3. | ||
186 | (The suspend state is passed as the "data" argument | ||
187 | to the device callback.) With D3, the device is powered | ||
188 | off and loses all context, D1 and D2 are shallower power | ||
189 | states and require less device context to be saved. To | ||
190 | play it safe, just save everything at suspend and restore | ||
191 | everything at resume. | ||
192 | |||
193 | Q: Where do I store device context for suspend? | ||
194 | |||
195 | Anywhere in memory, kmalloc a buffer or store it | ||
196 | in the device descriptor. You are guaranteed that the | ||
197 | contents of memory will be restored and accessible | ||
198 | before resume, even when the system suspends to disk. | ||
199 | |||
200 | Q: What do I need to do for ACPI vs. APM vs. etc? | ||
201 | |||
202 | Drivers need not be aware of the specific power management | ||
203 | technology that is active. They just need to be aware | ||
204 | of when the overlying power management system requests | ||
205 | that they suspend or resume. | ||
206 | |||
207 | Q: What about device dependencies? | ||
208 | |||
209 | When a driver registers a device, the power management | ||
210 | subsystem uses the information provided to build a | ||
211 | tree of device dependencies (eg. USB device X is on | ||
212 | USB controller Y which is on PCI bus Z) When power | ||
213 | management wants to suspend a device, it first sends | ||
214 | a suspend request to its driver, then the bus driver, | ||
215 | and so on up to the system bus. Device resumes | ||
216 | proceed in the opposite direction. | ||
217 | |||
218 | Q: Who do I contact for additional information about | ||
219 | enabling power management for my specific driver/device? | ||
220 | |||
221 | ACPI Development mailing list: linux-acpi@vger.kernel.org | ||
222 | |||
223 | System Interface -- OBSOLETE, DO NOT USE! | ||
224 | ----------------************************* | ||
225 | If you are providing new power management support to Linux (ie. | ||
226 | adding support for something like APM or ACPI), you should | ||
227 | communicate with drivers through the existing generic power | ||
228 | management interface. | ||
229 | |||
230 | /* | ||
231 | * Send a request to all devices | ||
232 | * | ||
233 | * Parameters: | ||
234 | * rqst - request type | ||
235 | * data - data, if any, associated with the request | ||
236 | * | ||
237 | * Returns: 0 if the request is successful | ||
238 | * See "pm_callback" return for errors | ||
239 | * | ||
240 | * Details: Walk list of registered devices and call pm_send | ||
241 | * for each until complete or an error is encountered. | ||
242 | * If an error is encountered for a suspend request, | ||
243 | * return all devices to the state they were in before | ||
244 | * the suspend request. | ||
245 | */ | ||
246 | int pm_send_all(pm_request_t rqst, void *data); | ||
247 | |||
248 | /* | ||
249 | * Find a matching device | ||
250 | * | ||
251 | * Parameters: | ||
252 | * type - device type (PCI device, system device, or 0 to match all devices) | ||
253 | * from - previous match or NULL to start from the beginning | ||
254 | * | ||
255 | * Returns: Matching device or NULL if none found | ||
256 | */ | ||
257 | struct pm_dev *pm_find(pm_dev_t type, struct pm_dev *from); | ||
diff --git a/Documentation/power/pm_qos_interface.txt b/Documentation/power/pm_qos_interface.txt index 49adb1a33514..c40866e8b957 100644 --- a/Documentation/power/pm_qos_interface.txt +++ b/Documentation/power/pm_qos_interface.txt | |||
@@ -1,4 +1,4 @@ | |||
1 | PM quality of Service interface. | 1 | PM Quality Of Service Interface. |
2 | 2 | ||
3 | This interface provides a kernel and user mode interface for registering | 3 | This interface provides a kernel and user mode interface for registering |
4 | performance expectations by drivers, subsystems and user space applications on | 4 | performance expectations by drivers, subsystems and user space applications on |
@@ -7,6 +7,11 @@ one of the parameters. | |||
7 | Currently we have {cpu_dma_latency, network_latency, network_throughput} as the | 7 | Currently we have {cpu_dma_latency, network_latency, network_throughput} as the |
8 | initial set of pm_qos parameters. | 8 | initial set of pm_qos parameters. |
9 | 9 | ||
10 | Each parameters have defined units: | ||
11 | * latency: usec | ||
12 | * timeout: usec | ||
13 | * throughput: kbs (kilo bit / sec) | ||
14 | |||
10 | The infrastructure exposes multiple misc device nodes one per implemented | 15 | The infrastructure exposes multiple misc device nodes one per implemented |
11 | parameter. The set of parameters implement is defined by pm_qos_power_init() | 16 | parameter. The set of parameters implement is defined by pm_qos_power_init() |
12 | and pm_qos_params.h. This is done because having the available parameters | 17 | and pm_qos_params.h. This is done because having the available parameters |
diff --git a/Documentation/power/power_supply_class.txt b/Documentation/power/power_supply_class.txt index a8686e5a6857..c6cd4956047c 100644 --- a/Documentation/power/power_supply_class.txt +++ b/Documentation/power/power_supply_class.txt | |||
@@ -101,6 +101,10 @@ of charge when battery became full/empty". It also could mean "value of | |||
101 | charge when battery considered full/empty at given conditions (temperature, | 101 | charge when battery considered full/empty at given conditions (temperature, |
102 | age)". I.e. these attributes represents real thresholds, not design values. | 102 | age)". I.e. these attributes represents real thresholds, not design values. |
103 | 103 | ||
104 | CHARGE_COUNTER - the current charge counter (in µAh). This could easily | ||
105 | be negative; there is no empty or full value. It is only useful for | ||
106 | relative, time-based measurements. | ||
107 | |||
104 | ENERGY_FULL, ENERGY_EMPTY - same as above but for energy. | 108 | ENERGY_FULL, ENERGY_EMPTY - same as above but for energy. |
105 | 109 | ||
106 | CAPACITY - capacity in percents. | 110 | CAPACITY - capacity in percents. |
diff --git a/Documentation/power/regulator/consumer.txt b/Documentation/power/regulator/consumer.txt new file mode 100644 index 000000000000..82b7a43aadba --- /dev/null +++ b/Documentation/power/regulator/consumer.txt | |||
@@ -0,0 +1,182 @@ | |||
1 | Regulator Consumer Driver Interface | ||
2 | =================================== | ||
3 | |||
4 | This text describes the regulator interface for consumer device drivers. | ||
5 | Please see overview.txt for a description of the terms used in this text. | ||
6 | |||
7 | |||
8 | 1. Consumer Regulator Access (static & dynamic drivers) | ||
9 | ======================================================= | ||
10 | |||
11 | A consumer driver can get access to it's supply regulator by calling :- | ||
12 | |||
13 | regulator = regulator_get(dev, "Vcc"); | ||
14 | |||
15 | The consumer passes in it's struct device pointer and power supply ID. The core | ||
16 | then finds the correct regulator by consulting a machine specific lookup table. | ||
17 | If the lookup is successful then this call will return a pointer to the struct | ||
18 | regulator that supplies this consumer. | ||
19 | |||
20 | To release the regulator the consumer driver should call :- | ||
21 | |||
22 | regulator_put(regulator); | ||
23 | |||
24 | Consumers can be supplied by more than one regulator e.g. codec consumer with | ||
25 | analog and digital supplies :- | ||
26 | |||
27 | digital = regulator_get(dev, "Vcc"); /* digital core */ | ||
28 | analog = regulator_get(dev, "Avdd"); /* analog */ | ||
29 | |||
30 | The regulator access functions regulator_get() and regulator_put() will | ||
31 | usually be called in your device drivers probe() and remove() respectively. | ||
32 | |||
33 | |||
34 | 2. Regulator Output Enable & Disable (static & dynamic drivers) | ||
35 | ==================================================================== | ||
36 | |||
37 | A consumer can enable it's power supply by calling:- | ||
38 | |||
39 | int regulator_enable(regulator); | ||
40 | |||
41 | NOTE: The supply may already be enabled before regulator_enabled() is called. | ||
42 | This may happen if the consumer shares the regulator or the regulator has been | ||
43 | previously enabled by bootloader or kernel board initialization code. | ||
44 | |||
45 | A consumer can determine if a regulator is enabled by calling :- | ||
46 | |||
47 | int regulator_is_enabled(regulator); | ||
48 | |||
49 | This will return > zero when the regulator is enabled. | ||
50 | |||
51 | |||
52 | A consumer can disable it's supply when no longer needed by calling :- | ||
53 | |||
54 | int regulator_disable(regulator); | ||
55 | |||
56 | NOTE: This may not disable the supply if it's shared with other consumers. The | ||
57 | regulator will only be disabled when the enabled reference count is zero. | ||
58 | |||
59 | Finally, a regulator can be forcefully disabled in the case of an emergency :- | ||
60 | |||
61 | int regulator_force_disable(regulator); | ||
62 | |||
63 | NOTE: this will immediately and forcefully shutdown the regulator output. All | ||
64 | consumers will be powered off. | ||
65 | |||
66 | |||
67 | 3. Regulator Voltage Control & Status (dynamic drivers) | ||
68 | ====================================================== | ||
69 | |||
70 | Some consumer drivers need to be able to dynamically change their supply | ||
71 | voltage to match system operating points. e.g. CPUfreq drivers can scale | ||
72 | voltage along with frequency to save power, SD drivers may need to select the | ||
73 | correct card voltage, etc. | ||
74 | |||
75 | Consumers can control their supply voltage by calling :- | ||
76 | |||
77 | int regulator_set_voltage(regulator, min_uV, max_uV); | ||
78 | |||
79 | Where min_uV and max_uV are the minimum and maximum acceptable voltages in | ||
80 | microvolts. | ||
81 | |||
82 | NOTE: this can be called when the regulator is enabled or disabled. If called | ||
83 | when enabled, then the voltage changes instantly, otherwise the voltage | ||
84 | configuration changes and the voltage is physically set when the regulator is | ||
85 | next enabled. | ||
86 | |||
87 | The regulators configured voltage output can be found by calling :- | ||
88 | |||
89 | int regulator_get_voltage(regulator); | ||
90 | |||
91 | NOTE: get_voltage() will return the configured output voltage whether the | ||
92 | regulator is enabled or disabled and should NOT be used to determine regulator | ||
93 | output state. However this can be used in conjunction with is_enabled() to | ||
94 | determine the regulator physical output voltage. | ||
95 | |||
96 | |||
97 | 4. Regulator Current Limit Control & Status (dynamic drivers) | ||
98 | =========================================================== | ||
99 | |||
100 | Some consumer drivers need to be able to dynamically change their supply | ||
101 | current limit to match system operating points. e.g. LCD backlight driver can | ||
102 | change the current limit to vary the backlight brightness, USB drivers may want | ||
103 | to set the limit to 500mA when supplying power. | ||
104 | |||
105 | Consumers can control their supply current limit by calling :- | ||
106 | |||
107 | int regulator_set_current_limit(regulator, min_uV, max_uV); | ||
108 | |||
109 | Where min_uA and max_uA are the minimum and maximum acceptable current limit in | ||
110 | microamps. | ||
111 | |||
112 | NOTE: this can be called when the regulator is enabled or disabled. If called | ||
113 | when enabled, then the current limit changes instantly, otherwise the current | ||
114 | limit configuration changes and the current limit is physically set when the | ||
115 | regulator is next enabled. | ||
116 | |||
117 | A regulators current limit can be found by calling :- | ||
118 | |||
119 | int regulator_get_current_limit(regulator); | ||
120 | |||
121 | NOTE: get_current_limit() will return the current limit whether the regulator | ||
122 | is enabled or disabled and should not be used to determine regulator current | ||
123 | load. | ||
124 | |||
125 | |||
126 | 5. Regulator Operating Mode Control & Status (dynamic drivers) | ||
127 | ============================================================= | ||
128 | |||
129 | Some consumers can further save system power by changing the operating mode of | ||
130 | their supply regulator to be more efficient when the consumers operating state | ||
131 | changes. e.g. consumer driver is idle and subsequently draws less current | ||
132 | |||
133 | Regulator operating mode can be changed indirectly or directly. | ||
134 | |||
135 | Indirect operating mode control. | ||
136 | -------------------------------- | ||
137 | Consumer drivers can request a change in their supply regulator operating mode | ||
138 | by calling :- | ||
139 | |||
140 | int regulator_set_optimum_mode(struct regulator *regulator, int load_uA); | ||
141 | |||
142 | This will cause the core to recalculate the total load on the regulator (based | ||
143 | on all it's consumers) and change operating mode (if necessary and permitted) | ||
144 | to best match the current operating load. | ||
145 | |||
146 | The load_uA value can be determined from the consumers datasheet. e.g.most | ||
147 | datasheets have tables showing the max current consumed in certain situations. | ||
148 | |||
149 | Most consumers will use indirect operating mode control since they have no | ||
150 | knowledge of the regulator or whether the regulator is shared with other | ||
151 | consumers. | ||
152 | |||
153 | Direct operating mode control. | ||
154 | ------------------------------ | ||
155 | Bespoke or tightly coupled drivers may want to directly control regulator | ||
156 | operating mode depending on their operating point. This can be achieved by | ||
157 | calling :- | ||
158 | |||
159 | int regulator_set_mode(struct regulator *regulator, unsigned int mode); | ||
160 | unsigned int regulator_get_mode(struct regulator *regulator); | ||
161 | |||
162 | Direct mode will only be used by consumers that *know* about the regulator and | ||
163 | are not sharing the regulator with other consumers. | ||
164 | |||
165 | |||
166 | 6. Regulator Events | ||
167 | =================== | ||
168 | Regulators can notify consumers of external events. Events could be received by | ||
169 | consumers under regulator stress or failure conditions. | ||
170 | |||
171 | Consumers can register interest in regulator events by calling :- | ||
172 | |||
173 | int regulator_register_notifier(struct regulator *regulator, | ||
174 | struct notifier_block *nb); | ||
175 | |||
176 | Consumers can uregister interest by calling :- | ||
177 | |||
178 | int regulator_unregister_notifier(struct regulator *regulator, | ||
179 | struct notifier_block *nb); | ||
180 | |||
181 | Regulators use the kernel notifier framework to send event to thier interested | ||
182 | consumers. | ||
diff --git a/Documentation/power/regulator/machine.txt b/Documentation/power/regulator/machine.txt new file mode 100644 index 000000000000..ce3487d99abe --- /dev/null +++ b/Documentation/power/regulator/machine.txt | |||
@@ -0,0 +1,93 @@ | |||
1 | Regulator Machine Driver Interface | ||
2 | =================================== | ||
3 | |||
4 | The regulator machine driver interface is intended for board/machine specific | ||
5 | initialisation code to configure the regulator subsystem. | ||
6 | |||
7 | Consider the following machine :- | ||
8 | |||
9 | Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V] | ||
10 | | | ||
11 | +-> [Consumer B @ 3.3V] | ||
12 | |||
13 | The drivers for consumers A & B must be mapped to the correct regulator in | ||
14 | order to control their power supply. This mapping can be achieved in machine | ||
15 | initialisation code by creating a struct regulator_consumer_supply for | ||
16 | each regulator. | ||
17 | |||
18 | struct regulator_consumer_supply { | ||
19 | struct device *dev; /* consumer */ | ||
20 | const char *supply; /* consumer supply - e.g. "vcc" */ | ||
21 | }; | ||
22 | |||
23 | e.g. for the machine above | ||
24 | |||
25 | static struct regulator_consumer_supply regulator1_consumers[] = { | ||
26 | { | ||
27 | .dev = &platform_consumerB_device.dev, | ||
28 | .supply = "Vcc", | ||
29 | },}; | ||
30 | |||
31 | static struct regulator_consumer_supply regulator2_consumers[] = { | ||
32 | { | ||
33 | .dev = &platform_consumerA_device.dev, | ||
34 | .supply = "Vcc", | ||
35 | },}; | ||
36 | |||
37 | This maps Regulator-1 to the 'Vcc' supply for Consumer B and maps Regulator-2 | ||
38 | to the 'Vcc' supply for Consumer A. | ||
39 | |||
40 | Constraints can now be registered by defining a struct regulator_init_data | ||
41 | for each regulator power domain. This structure also maps the consumers | ||
42 | to their supply regulator :- | ||
43 | |||
44 | static struct regulator_init_data regulator1_data = { | ||
45 | .constraints = { | ||
46 | .min_uV = 3300000, | ||
47 | .max_uV = 3300000, | ||
48 | .valid_modes_mask = REGULATOR_MODE_NORMAL, | ||
49 | }, | ||
50 | .num_consumer_supplies = ARRAY_SIZE(regulator1_consumers), | ||
51 | .consumer_supplies = regulator1_consumers, | ||
52 | }; | ||
53 | |||
54 | Regulator-1 supplies power to Regulator-2. This relationship must be registered | ||
55 | with the core so that Regulator-1 is also enabled when Consumer A enables it's | ||
56 | supply (Regulator-2). The supply regulator is set by the supply_regulator_dev | ||
57 | field below:- | ||
58 | |||
59 | static struct regulator_init_data regulator2_data = { | ||
60 | .supply_regulator_dev = &platform_regulator1_device.dev, | ||
61 | .constraints = { | ||
62 | .min_uV = 1800000, | ||
63 | .max_uV = 2000000, | ||
64 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, | ||
65 | .valid_modes_mask = REGULATOR_MODE_NORMAL, | ||
66 | }, | ||
67 | .num_consumer_supplies = ARRAY_SIZE(regulator2_consumers), | ||
68 | .consumer_supplies = regulator2_consumers, | ||
69 | }; | ||
70 | |||
71 | Finally the regulator devices must be registered in the usual manner. | ||
72 | |||
73 | static struct platform_device regulator_devices[] = { | ||
74 | { | ||
75 | .name = "regulator", | ||
76 | .id = DCDC_1, | ||
77 | .dev = { | ||
78 | .platform_data = ®ulator1_data, | ||
79 | }, | ||
80 | }, | ||
81 | { | ||
82 | .name = "regulator", | ||
83 | .id = DCDC_2, | ||
84 | .dev = { | ||
85 | .platform_data = ®ulator2_data, | ||
86 | }, | ||
87 | }, | ||
88 | }; | ||
89 | /* register regulator 1 device */ | ||
90 | platform_device_register(&wm8350_regulator_devices[0]); | ||
91 | |||
92 | /* register regulator 2 device */ | ||
93 | platform_device_register(&wm8350_regulator_devices[1]); | ||
diff --git a/Documentation/power/regulator/overview.txt b/Documentation/power/regulator/overview.txt new file mode 100644 index 000000000000..bdcb332bd7fb --- /dev/null +++ b/Documentation/power/regulator/overview.txt | |||
@@ -0,0 +1,171 @@ | |||
1 | Linux voltage and current regulator framework | ||
2 | ============================================= | ||
3 | |||
4 | About | ||
5 | ===== | ||
6 | |||
7 | This framework is designed to provide a standard kernel interface to control | ||
8 | voltage and current regulators. | ||
9 | |||
10 | The intention is to allow systems to dynamically control regulator power output | ||
11 | in order to save power and prolong battery life. This applies to both voltage | ||
12 | regulators (where voltage output is controllable) and current sinks (where | ||
13 | current limit is controllable). | ||
14 | |||
15 | (C) 2008 Wolfson Microelectronics PLC. | ||
16 | Author: Liam Girdwood <lg@opensource.wolfsonmicro.com> | ||
17 | |||
18 | |||
19 | Nomenclature | ||
20 | ============ | ||
21 | |||
22 | Some terms used in this document:- | ||
23 | |||
24 | o Regulator - Electronic device that supplies power to other devices. | ||
25 | Most regulators can enable and disable their output whilst | ||
26 | some can control their output voltage and or current. | ||
27 | |||
28 | Input Voltage -> Regulator -> Output Voltage | ||
29 | |||
30 | |||
31 | o PMIC - Power Management IC. An IC that contains numerous regulators | ||
32 | and often contains other susbsystems. | ||
33 | |||
34 | |||
35 | o Consumer - Electronic device that is supplied power by a regulator. | ||
36 | Consumers can be classified into two types:- | ||
37 | |||
38 | Static: consumer does not change it's supply voltage or | ||
39 | current limit. It only needs to enable or disable it's | ||
40 | power supply. It's supply voltage is set by the hardware, | ||
41 | bootloader, firmware or kernel board initialisation code. | ||
42 | |||
43 | Dynamic: consumer needs to change it's supply voltage or | ||
44 | current limit to meet operation demands. | ||
45 | |||
46 | |||
47 | o Power Domain - Electronic circuit that is supplied it's input power by the | ||
48 | output power of a regulator, switch or by another power | ||
49 | domain. | ||
50 | |||
51 | The supply regulator may be behind a switch(s). i.e. | ||
52 | |||
53 | Regulator -+-> Switch-1 -+-> Switch-2 --> [Consumer A] | ||
54 | | | | ||
55 | | +-> [Consumer B], [Consumer C] | ||
56 | | | ||
57 | +-> [Consumer D], [Consumer E] | ||
58 | |||
59 | That is one regulator and three power domains: | ||
60 | |||
61 | Domain 1: Switch-1, Consumers D & E. | ||
62 | Domain 2: Switch-2, Consumers B & C. | ||
63 | Domain 3: Consumer A. | ||
64 | |||
65 | and this represents a "supplies" relationship: | ||
66 | |||
67 | Domain-1 --> Domain-2 --> Domain-3. | ||
68 | |||
69 | A power domain may have regulators that are supplied power | ||
70 | by other regulators. i.e. | ||
71 | |||
72 | Regulator-1 -+-> Regulator-2 -+-> [Consumer A] | ||
73 | | | ||
74 | +-> [Consumer B] | ||
75 | |||
76 | This gives us two regulators and two power domains: | ||
77 | |||
78 | Domain 1: Regulator-2, Consumer B. | ||
79 | Domain 2: Consumer A. | ||
80 | |||
81 | and a "supplies" relationship: | ||
82 | |||
83 | Domain-1 --> Domain-2 | ||
84 | |||
85 | |||
86 | o Constraints - Constraints are used to define power levels for performance | ||
87 | and hardware protection. Constraints exist at three levels: | ||
88 | |||
89 | Regulator Level: This is defined by the regulator hardware | ||
90 | operating parameters and is specified in the regulator | ||
91 | datasheet. i.e. | ||
92 | |||
93 | - voltage output is in the range 800mV -> 3500mV. | ||
94 | - regulator current output limit is 20mA @ 5V but is | ||
95 | 10mA @ 10V. | ||
96 | |||
97 | Power Domain Level: This is defined in software by kernel | ||
98 | level board initialisation code. It is used to constrain a | ||
99 | power domain to a particular power range. i.e. | ||
100 | |||
101 | - Domain-1 voltage is 3300mV | ||
102 | - Domain-2 voltage is 1400mV -> 1600mV | ||
103 | - Domain-3 current limit is 0mA -> 20mA. | ||
104 | |||
105 | Consumer Level: This is defined by consumer drivers | ||
106 | dynamically setting voltage or current limit levels. | ||
107 | |||
108 | e.g. a consumer backlight driver asks for a current increase | ||
109 | from 5mA to 10mA to increase LCD illumination. This passes | ||
110 | to through the levels as follows :- | ||
111 | |||
112 | Consumer: need to increase LCD brightness. Lookup and | ||
113 | request next current mA value in brightness table (the | ||
114 | consumer driver could be used on several different | ||
115 | personalities based upon the same reference device). | ||
116 | |||
117 | Power Domain: is the new current limit within the domain | ||
118 | operating limits for this domain and system state (e.g. | ||
119 | battery power, USB power) | ||
120 | |||
121 | Regulator Domains: is the new current limit within the | ||
122 | regulator operating parameters for input/ouput voltage. | ||
123 | |||
124 | If the regulator request passes all the constraint tests | ||
125 | then the new regulator value is applied. | ||
126 | |||
127 | |||
128 | Design | ||
129 | ====== | ||
130 | |||
131 | The framework is designed and targeted at SoC based devices but may also be | ||
132 | relevant to non SoC devices and is split into the following four interfaces:- | ||
133 | |||
134 | |||
135 | 1. Consumer driver interface. | ||
136 | |||
137 | This uses a similar API to the kernel clock interface in that consumer | ||
138 | drivers can get and put a regulator (like they can with clocks atm) and | ||
139 | get/set voltage, current limit, mode, enable and disable. This should | ||
140 | allow consumers complete control over their supply voltage and current | ||
141 | limit. This also compiles out if not in use so drivers can be reused in | ||
142 | systems with no regulator based power control. | ||
143 | |||
144 | See Documentation/power/regulator/consumer.txt | ||
145 | |||
146 | 2. Regulator driver interface. | ||
147 | |||
148 | This allows regulator drivers to register their regulators and provide | ||
149 | operations to the core. It also has a notifier call chain for propagating | ||
150 | regulator events to clients. | ||
151 | |||
152 | See Documentation/power/regulator/regulator.txt | ||
153 | |||
154 | 3. Machine interface. | ||
155 | |||
156 | This interface is for machine specific code and allows the creation of | ||
157 | voltage/current domains (with constraints) for each regulator. It can | ||
158 | provide regulator constraints that will prevent device damage through | ||
159 | overvoltage or over current caused by buggy client drivers. It also | ||
160 | allows the creation of a regulator tree whereby some regulators are | ||
161 | supplied by others (similar to a clock tree). | ||
162 | |||
163 | See Documentation/power/regulator/machine.txt | ||
164 | |||
165 | 4. Userspace ABI. | ||
166 | |||
167 | The framework also exports a lot of useful voltage/current/opmode data to | ||
168 | userspace via sysfs. This could be used to help monitor device power | ||
169 | consumption and status. | ||
170 | |||
171 | See Documentation/ABI/testing/regulator-sysfs.txt | ||
diff --git a/Documentation/power/regulator/regulator.txt b/Documentation/power/regulator/regulator.txt new file mode 100644 index 000000000000..4200accb9bba --- /dev/null +++ b/Documentation/power/regulator/regulator.txt | |||
@@ -0,0 +1,30 @@ | |||
1 | Regulator Driver Interface | ||
2 | ========================== | ||
3 | |||
4 | The regulator driver interface is relatively simple and designed to allow | ||
5 | regulator drivers to register their services with the core framework. | ||
6 | |||
7 | |||
8 | Registration | ||
9 | ============ | ||
10 | |||
11 | Drivers can register a regulator by calling :- | ||
12 | |||
13 | struct regulator_dev *regulator_register(struct device *dev, | ||
14 | struct regulator_desc *regulator_desc); | ||
15 | |||
16 | This will register the regulators capabilities and operations to the regulator | ||
17 | core. | ||
18 | |||
19 | Regulators can be unregistered by calling :- | ||
20 | |||
21 | void regulator_unregister(struct regulator_dev *rdev); | ||
22 | |||
23 | |||
24 | Regulator Events | ||
25 | ================ | ||
26 | Regulators can send events (e.g. over temp, under voltage, etc) to consumer | ||
27 | drivers by calling :- | ||
28 | |||
29 | int regulator_notifier_call_chain(struct regulator_dev *rdev, | ||
30 | unsigned long event, void *data); | ||
diff --git a/Documentation/power/s2ram.txt b/Documentation/power/s2ram.txt index b05f512130ea..2ebdc6091ce1 100644 --- a/Documentation/power/s2ram.txt +++ b/Documentation/power/s2ram.txt | |||
@@ -54,3 +54,21 @@ used to run with "radeonfb" (it's an ATI Radeon mobility). It turns out | |||
54 | that "radeonfb" simply cannot resume that device - it tries to set the | 54 | that "radeonfb" simply cannot resume that device - it tries to set the |
55 | PLL's, and it just _hangs_. Using the regular VGA console and letting X | 55 | PLL's, and it just _hangs_. Using the regular VGA console and letting X |
56 | resume it instead works fine. | 56 | resume it instead works fine. |
57 | |||
58 | NOTE | ||
59 | ==== | ||
60 | pm_trace uses the system's Real Time Clock (RTC) to save the magic number. | ||
61 | Reason for this is that the RTC is the only reliably available piece of | ||
62 | hardware during resume operations where a value can be set that will | ||
63 | survive a reboot. | ||
64 | |||
65 | Consequence is that after a resume (even if it is successful) your system | ||
66 | clock will have a value corresponding to the magic mumber instead of the | ||
67 | correct date/time! It is therefore advisable to use a program like ntp-date | ||
68 | or rdate to reset the correct date/time from an external time source when | ||
69 | using this trace option. | ||
70 | |||
71 | As the clock keeps ticking it is also essential that the reboot is done | ||
72 | quickly after the resume failure. The trace option does not use the seconds | ||
73 | or the low order bits of the minutes of the RTC, but a too long delay will | ||
74 | corrupt the magic value. | ||
diff --git a/Documentation/powerpc/00-INDEX b/Documentation/powerpc/00-INDEX index 3be84aa38dfe..e3960b8c8689 100644 --- a/Documentation/powerpc/00-INDEX +++ b/Documentation/powerpc/00-INDEX | |||
@@ -18,12 +18,6 @@ mpc52xx.txt | |||
18 | - Linux 2.6.x on MPC52xx family | 18 | - Linux 2.6.x on MPC52xx family |
19 | mpc52xx-device-tree-bindings.txt | 19 | mpc52xx-device-tree-bindings.txt |
20 | - MPC5200 Device Tree Bindings | 20 | - MPC5200 Device Tree Bindings |
21 | ppc_htab.txt | ||
22 | - info about the Linux/PPC /proc/ppc_htab entry | ||
23 | SBC8260_memory_mapping.txt | ||
24 | - EST SBC8260 board info | ||
25 | smp.txt | ||
26 | - use and state info about Linux/PPC on MP machines | ||
27 | sound.txt | 21 | sound.txt |
28 | - info on sound support under Linux/PPC | 22 | - info on sound support under Linux/PPC |
29 | zImage_layout.txt | 23 | zImage_layout.txt |
diff --git a/Documentation/powerpc/SBC8260_memory_mapping.txt b/Documentation/powerpc/SBC8260_memory_mapping.txt deleted file mode 100644 index e6e9ee0506c3..000000000000 --- a/Documentation/powerpc/SBC8260_memory_mapping.txt +++ /dev/null | |||
@@ -1,197 +0,0 @@ | |||
1 | Please mail me (Jon Diekema, diekema_jon@si.com or diekema@cideas.com) | ||
2 | if you have questions, comments or corrections. | ||
3 | |||
4 | * EST SBC8260 Linux memory mapping rules | ||
5 | |||
6 | http://www.estc.com/ | ||
7 | http://www.estc.com/products/boards/SBC8260-8240_ds.html | ||
8 | |||
9 | Initial conditions: | ||
10 | ------------------- | ||
11 | |||
12 | Tasks that need to be perform by the boot ROM before control is | ||
13 | transferred to zImage (compressed Linux kernel): | ||
14 | |||
15 | - Define the IMMR to 0xf0000000 | ||
16 | |||
17 | - Initialize the memory controller so that RAM is available at | ||
18 | physical address 0x00000000. On the SBC8260 is this 16M (64M) | ||
19 | SDRAM. | ||
20 | |||
21 | - The boot ROM should only clear the RAM that it is using. | ||
22 | |||
23 | The reason for doing this is to enhances the chances of a | ||
24 | successful post mortem on a Linux panic. One of the first | ||
25 | items to examine is the 16k (LOG_BUF_LEN) circular console | ||
26 | buffer called log_buf which is defined in kernel/printk.c. | ||
27 | |||
28 | - To enhance boot ROM performance, the I-cache can be enabled. | ||
29 | |||
30 | Date: Mon, 22 May 2000 14:21:10 -0700 | ||
31 | From: Neil Russell <caret@c-side.com> | ||
32 | |||
33 | LiMon (LInux MONitor) runs with and starts Linux with MMU | ||
34 | off, I-cache enabled, D-cache disabled. The I-cache doesn't | ||
35 | need hints from the MMU to work correctly as the D-cache | ||
36 | does. No D-cache means no special code to handle devices in | ||
37 | the presence of cache (no snooping, etc). The use of the | ||
38 | I-cache means that the monitor can run acceptably fast | ||
39 | directly from ROM, rather than having to copy it to RAM. | ||
40 | |||
41 | - Build the board information structure (see | ||
42 | include/asm-ppc/est8260.h for its definition) | ||
43 | |||
44 | - The compressed Linux kernel (zImage) contains a bootstrap loader | ||
45 | that is position independent; you can load it into any RAM, | ||
46 | ROM or FLASH memory address >= 0x00500000 (above 5 MB), or | ||
47 | at its link address of 0x00400000 (4 MB). | ||
48 | |||
49 | Note: If zImage is loaded at its link address of 0x00400000 (4 MB), | ||
50 | then zImage will skip the step of moving itself to | ||
51 | its link address. | ||
52 | |||
53 | - Load R3 with the address of the board information structure | ||
54 | |||
55 | - Transfer control to zImage | ||
56 | |||
57 | - The Linux console port is SMC1, and the baud rate is controlled | ||
58 | from the bi_baudrate field of the board information structure. | ||
59 | On thing to keep in mind when picking the baud rate, is that | ||
60 | there is no flow control on the SMC ports. I would stick | ||
61 | with something safe and standard like 19200. | ||
62 | |||
63 | On the EST SBC8260, the SMC1 port is on the COM1 connector of | ||
64 | the board. | ||
65 | |||
66 | |||
67 | EST SBC8260 defaults: | ||
68 | --------------------- | ||
69 | |||
70 | Chip | ||
71 | Memory Sel Bus Use | ||
72 | --------------------- --- --- ---------------------------------- | ||
73 | 0x00000000-0x03FFFFFF CS2 60x (16M or 64M)/64M SDRAM | ||
74 | 0x04000000-0x04FFFFFF CS4 local 4M/16M SDRAM (soldered to the board) | ||
75 | 0x21000000-0x21000000 CS7 60x 1B/64K Flash present detect (from the flash SIMM) | ||
76 | 0x21000001-0x21000001 CS7 60x 1B/64K Switches (read) and LEDs (write) | ||
77 | 0x22000000-0x2200FFFF CS5 60x 8K/64K EEPROM | ||
78 | 0xFC000000-0xFCFFFFFF CS6 60x 2M/16M flash (8 bits wide, soldered to the board) | ||
79 | 0xFE000000-0xFFFFFFFF CS0 60x 4M/16M flash (SIMM) | ||
80 | |||
81 | Notes: | ||
82 | ------ | ||
83 | |||
84 | - The chip selects can map 32K blocks and up (powers of 2) | ||
85 | |||
86 | - The SDRAM machine can handled up to 128Mbytes per chip select | ||
87 | |||
88 | - Linux uses the 60x bus memory (the SDRAM DIMM) for the | ||
89 | communications buffers. | ||
90 | |||
91 | - BATs can map 128K-256Mbytes each. There are four data BATs and | ||
92 | four instruction BATs. Generally the data and instruction BATs | ||
93 | are mapped the same. | ||
94 | |||
95 | - The IMMR must be set above the kernel virtual memory addresses, | ||
96 | which start at 0xC0000000. Otherwise, the kernel may crash as | ||
97 | soon as you start any threads or processes due to VM collisions | ||
98 | in the kernel or user process space. | ||
99 | |||
100 | |||
101 | Details from Dan Malek <dan_malek@mvista.com> on 10/29/1999: | ||
102 | |||
103 | The user application virtual space consumes the first 2 Gbytes | ||
104 | (0x00000000 to 0x7FFFFFFF). The kernel virtual text starts at | ||
105 | 0xC0000000, with data following. There is a "protection hole" | ||
106 | between the end of kernel data and the start of the kernel | ||
107 | dynamically allocated space, but this space is still within | ||
108 | 0xCxxxxxxx. | ||
109 | |||
110 | Obviously the kernel can't map any physical addresses 1:1 in | ||
111 | these ranges. | ||
112 | |||
113 | |||
114 | Details from Dan Malek <dan_malek@mvista.com> on 5/19/2000: | ||
115 | |||
116 | During the early kernel initialization, the kernel virtual | ||
117 | memory allocator is not operational. Prior to this KVM | ||
118 | initialization, we choose to map virtual to physical addresses | ||
119 | 1:1. That is, the kernel virtual address exactly matches the | ||
120 | physical address on the bus. These mappings are typically done | ||
121 | in arch/ppc/kernel/head.S, or arch/ppc/mm/init.c. Only | ||
122 | absolutely necessary mappings should be done at this time, for | ||
123 | example board control registers or a serial uart. Normal device | ||
124 | driver initialization should map resources later when necessary. | ||
125 | |||
126 | Although platform dependent, and certainly the case for embedded | ||
127 | 8xx, traditionally memory is mapped at physical address zero, | ||
128 | and I/O devices above physical address 0x80000000. The lowest | ||
129 | and highest (above 0xf0000000) I/O addresses are traditionally | ||
130 | used for devices or registers we need to map during kernel | ||
131 | initialization and prior to KVM operation. For this reason, | ||
132 | and since it followed prior PowerPC platform examples, I chose | ||
133 | to map the embedded 8xx kernel to the 0xc0000000 virtual address. | ||
134 | This way, we can enable the MMU to map the kernel for proper | ||
135 | operation, and still map a few windows before the KVM is operational. | ||
136 | |||
137 | On some systems, you could possibly run the kernel at the | ||
138 | 0x80000000 or any other virtual address. It just depends upon | ||
139 | mapping that must be done prior to KVM operational. You can never | ||
140 | map devices or kernel spaces that overlap with the user virtual | ||
141 | space. This is why default IMMR mapping used by most BDM tools | ||
142 | won't work. They put the IMMR at something like 0x10000000 or | ||
143 | 0x02000000 for example. You simply can't map these addresses early | ||
144 | in the kernel, and continue proper system operation. | ||
145 | |||
146 | The embedded 8xx/82xx kernel is mature enough that all you should | ||
147 | need to do is map the IMMR someplace at or above 0xf0000000 and it | ||
148 | should boot far enough to get serial console messages and KGDB | ||
149 | connected on any platform. There are lots of other subtle memory | ||
150 | management design features that you simply don't need to worry | ||
151 | about. If you are changing functions related to MMU initialization, | ||
152 | you are likely breaking things that are known to work and are | ||
153 | heading down a path of disaster and frustration. Your changes | ||
154 | should be to make the flexibility of the processor fit Linux, | ||
155 | not force arbitrary and non-workable memory mappings into Linux. | ||
156 | |||
157 | - You don't want to change KERNELLOAD or KERNELBASE, otherwise the | ||
158 | virtual memory and MMU code will get confused. | ||
159 | |||
160 | arch/ppc/Makefile:KERNELLOAD = 0xc0000000 | ||
161 | |||
162 | include/asm-ppc/page.h:#define PAGE_OFFSET 0xc0000000 | ||
163 | include/asm-ppc/page.h:#define KERNELBASE PAGE_OFFSET | ||
164 | |||
165 | - RAM is at physical address 0x00000000, and gets mapped to | ||
166 | virtual address 0xC0000000 for the kernel. | ||
167 | |||
168 | |||
169 | Physical addresses used by the Linux kernel: | ||
170 | -------------------------------------------- | ||
171 | |||
172 | 0x00000000-0x3FFFFFFF 1GB reserved for RAM | ||
173 | 0xF0000000-0xF001FFFF 128K IMMR 64K used for dual port memory, | ||
174 | 64K for 8260 registers | ||
175 | |||
176 | |||
177 | Logical addresses used by the Linux kernel: | ||
178 | ------------------------------------------- | ||
179 | |||
180 | 0xF0000000-0xFFFFFFFF 256M BAT0 (IMMR: dual port RAM, registers) | ||
181 | 0xE0000000-0xEFFFFFFF 256M BAT1 (I/O space for custom boards) | ||
182 | 0xC0000000-0xCFFFFFFF 256M BAT2 (RAM) | ||
183 | 0xD0000000-0xDFFFFFFF 256M BAT3 (if RAM > 256MByte) | ||
184 | |||
185 | |||
186 | EST SBC8260 Linux mapping: | ||
187 | -------------------------- | ||
188 | |||
189 | DBAT0, IBAT0, cache inhibited: | ||
190 | |||
191 | Chip | ||
192 | Memory Sel Use | ||
193 | --------------------- --- --------------------------------- | ||
194 | 0xF0000000-0xF001FFFF n/a IMMR: dual port RAM, registers | ||
195 | |||
196 | DBAT1, IBAT1, cache inhibited: | ||
197 | |||
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt index de2e5c05d6e7..02ea9a971b8e 100644 --- a/Documentation/powerpc/booting-without-of.txt +++ b/Documentation/powerpc/booting-without-of.txt | |||
@@ -41,12 +41,25 @@ Table of Contents | |||
41 | VI - System-on-a-chip devices and nodes | 41 | VI - System-on-a-chip devices and nodes |
42 | 1) Defining child nodes of an SOC | 42 | 1) Defining child nodes of an SOC |
43 | 2) Representing devices without a current OF specification | 43 | 2) Representing devices without a current OF specification |
44 | a) PHY nodes | 44 | a) MDIO IO device |
45 | b) Interrupt controllers | 45 | b) Gianfar-compatible ethernet nodes |
46 | c) CFI or JEDEC memory-mapped NOR flash | 46 | c) PHY nodes |
47 | d) 4xx/Axon EMAC ethernet nodes | 47 | d) Interrupt controllers |
48 | e) Xilinx IP cores | 48 | e) I2C |
49 | f) USB EHCI controllers | 49 | f) Freescale SOC USB controllers |
50 | g) Freescale SOC SEC Security Engines | ||
51 | h) Board Control and Status (BCSR) | ||
52 | i) Freescale QUICC Engine module (QE) | ||
53 | j) CFI or JEDEC memory-mapped NOR flash | ||
54 | k) Global Utilities Block | ||
55 | l) Freescale Communications Processor Module | ||
56 | m) Chipselect/Local Bus | ||
57 | n) 4xx/Axon EMAC ethernet nodes | ||
58 | o) Xilinx IP cores | ||
59 | p) Freescale Synchronous Serial Interface | ||
60 | q) USB EHCI controllers | ||
61 | r) MDIO on GPIOs | ||
62 | s) SPI busses | ||
50 | 63 | ||
51 | VII - Marvell Discovery mv64[345]6x System Controller chips | 64 | VII - Marvell Discovery mv64[345]6x System Controller chips |
52 | 1) The /system-controller node | 65 | 1) The /system-controller node |
@@ -77,10 +90,12 @@ Table of Contents | |||
77 | 3) OpenPIC Interrupt Controllers | 90 | 3) OpenPIC Interrupt Controllers |
78 | 4) ISA Interrupt Controllers | 91 | 4) ISA Interrupt Controllers |
79 | 92 | ||
80 | VIII - Specifying GPIO information for devices | 93 | IX - Specifying GPIO information for devices |
81 | 1) gpios property | 94 | 1) gpios property |
82 | 2) gpio-controller nodes | 95 | 2) gpio-controller nodes |
83 | 96 | ||
97 | X - Specifying device power management information (sleep property) | ||
98 | |||
84 | Appendix A - Sample SOC node for MPC8540 | 99 | Appendix A - Sample SOC node for MPC8540 |
85 | 100 | ||
86 | 101 | ||
@@ -263,7 +278,7 @@ it with special cases. | |||
263 | a 64-bit platform. | 278 | a 64-bit platform. |
264 | 279 | ||
265 | d) request and get assigned a platform number (see PLATFORM_* | 280 | d) request and get assigned a platform number (see PLATFORM_* |
266 | constants in include/asm-powerpc/processor.h | 281 | constants in arch/powerpc/include/asm/processor.h |
267 | 282 | ||
268 | 32-bit embedded kernels: | 283 | 32-bit embedded kernels: |
269 | 284 | ||
@@ -325,7 +340,7 @@ the block to RAM before passing it to the kernel. | |||
325 | --------- | 340 | --------- |
326 | 341 | ||
327 | The kernel is entered with r3 pointing to an area of memory that is | 342 | The kernel is entered with r3 pointing to an area of memory that is |
328 | roughly described in include/asm-powerpc/prom.h by the structure | 343 | roughly described in arch/powerpc/include/asm/prom.h by the structure |
329 | boot_param_header: | 344 | boot_param_header: |
330 | 345 | ||
331 | struct boot_param_header { | 346 | struct boot_param_header { |
@@ -693,7 +708,7 @@ device or bus to be described by the device tree. | |||
693 | In general, the format of an address for a device is defined by the | 708 | In general, the format of an address for a device is defined by the |
694 | parent bus type, based on the #address-cells and #size-cells | 709 | parent bus type, based on the #address-cells and #size-cells |
695 | properties. Note that the parent's parent definitions of #address-cells | 710 | properties. Note that the parent's parent definitions of #address-cells |
696 | and #size-cells are not inhereted so every node with children must specify | 711 | and #size-cells are not inherited so every node with children must specify |
697 | them. The kernel requires the root node to have those properties defining | 712 | them. The kernel requires the root node to have those properties defining |
698 | addresses format for devices directly mapped on the processor bus. | 713 | addresses format for devices directly mapped on the processor bus. |
699 | 714 | ||
@@ -1762,7 +1777,7 @@ platforms are moved over to use the flattened-device-tree model. | |||
1762 | 1777 | ||
1763 | Xilinx uartlite devices are simple fixed speed serial ports. | 1778 | Xilinx uartlite devices are simple fixed speed serial ports. |
1764 | 1779 | ||
1765 | Requred properties: | 1780 | Required properties: |
1766 | - current-speed : Baud rate of uartlite | 1781 | - current-speed : Baud rate of uartlite |
1767 | 1782 | ||
1768 | v) Xilinx hwicap | 1783 | v) Xilinx hwicap |
@@ -1784,7 +1799,7 @@ platforms are moved over to use the flattened-device-tree model. | |||
1784 | Xilinx UART 16550 devices are very similar to the NS16550 but with | 1799 | Xilinx UART 16550 devices are very similar to the NS16550 but with |
1785 | different register spacing and an offset from the base address. | 1800 | different register spacing and an offset from the base address. |
1786 | 1801 | ||
1787 | Requred properties: | 1802 | Required properties: |
1788 | - clock-frequency : Frequency of the clock input | 1803 | - clock-frequency : Frequency of the clock input |
1789 | - reg-offset : A value of 3 is required | 1804 | - reg-offset : A value of 3 is required |
1790 | - reg-shift : A value of 2 is required | 1805 | - reg-shift : A value of 2 is required |
@@ -1815,6 +1830,118 @@ platforms are moved over to use the flattened-device-tree model. | |||
1815 | big-endian; | 1830 | big-endian; |
1816 | }; | 1831 | }; |
1817 | 1832 | ||
1833 | r) Freescale Display Interface Unit | ||
1834 | |||
1835 | The Freescale DIU is a LCD controller, with proper hardware, it can also | ||
1836 | drive DVI monitors. | ||
1837 | |||
1838 | Required properties: | ||
1839 | - compatible : should be "fsl-diu". | ||
1840 | - reg : should contain at least address and length of the DIU register | ||
1841 | set. | ||
1842 | - Interrupts : one DIU interrupt should be describe here. | ||
1843 | |||
1844 | Example (MPC8610HPCD) | ||
1845 | display@2c000 { | ||
1846 | compatible = "fsl,diu"; | ||
1847 | reg = <0x2c000 100>; | ||
1848 | interrupts = <72 2>; | ||
1849 | interrupt-parent = <&mpic>; | ||
1850 | }; | ||
1851 | |||
1852 | s) Freescale on board FPGA | ||
1853 | |||
1854 | This is the memory-mapped registers for on board FPGA. | ||
1855 | |||
1856 | Required properities: | ||
1857 | - compatible : should be "fsl,fpga-pixis". | ||
1858 | - reg : should contain the address and the lenght of the FPPGA register | ||
1859 | set. | ||
1860 | |||
1861 | Example (MPC8610HPCD) | ||
1862 | board-control@e8000000 { | ||
1863 | compatible = "fsl,fpga-pixis"; | ||
1864 | reg = <0xe8000000 32>; | ||
1865 | }; | ||
1866 | |||
1867 | r) MDIO on GPIOs | ||
1868 | |||
1869 | Currently defined compatibles: | ||
1870 | - virtual,gpio-mdio | ||
1871 | |||
1872 | MDC and MDIO lines connected to GPIO controllers are listed in the | ||
1873 | gpios property as described in section VIII.1 in the following order: | ||
1874 | |||
1875 | MDC, MDIO. | ||
1876 | |||
1877 | Example: | ||
1878 | |||
1879 | mdio { | ||
1880 | compatible = "virtual,mdio-gpio"; | ||
1881 | #address-cells = <1>; | ||
1882 | #size-cells = <0>; | ||
1883 | gpios = <&qe_pio_a 11 | ||
1884 | &qe_pio_c 6>; | ||
1885 | }; | ||
1886 | |||
1887 | s) SPI (Serial Peripheral Interface) busses | ||
1888 | |||
1889 | SPI busses can be described with a node for the SPI master device | ||
1890 | and a set of child nodes for each SPI slave on the bus. For this | ||
1891 | discussion, it is assumed that the system's SPI controller is in | ||
1892 | SPI master mode. This binding does not describe SPI controllers | ||
1893 | in slave mode. | ||
1894 | |||
1895 | The SPI master node requires the following properties: | ||
1896 | - #address-cells - number of cells required to define a chip select | ||
1897 | address on the SPI bus. | ||
1898 | - #size-cells - should be zero. | ||
1899 | - compatible - name of SPI bus controller following generic names | ||
1900 | recommended practice. | ||
1901 | No other properties are required in the SPI bus node. It is assumed | ||
1902 | that a driver for an SPI bus device will understand that it is an SPI bus. | ||
1903 | However, the binding does not attempt to define the specific method for | ||
1904 | assigning chip select numbers. Since SPI chip select configuration is | ||
1905 | flexible and non-standardized, it is left out of this binding with the | ||
1906 | assumption that board specific platform code will be used to manage | ||
1907 | chip selects. Individual drivers can define additional properties to | ||
1908 | support describing the chip select layout. | ||
1909 | |||
1910 | SPI slave nodes must be children of the SPI master node and can | ||
1911 | contain the following properties. | ||
1912 | - reg - (required) chip select address of device. | ||
1913 | - compatible - (required) name of SPI device following generic names | ||
1914 | recommended practice | ||
1915 | - spi-max-frequency - (required) Maximum SPI clocking speed of device in Hz | ||
1916 | - spi-cpol - (optional) Empty property indicating device requires | ||
1917 | inverse clock polarity (CPOL) mode | ||
1918 | - spi-cpha - (optional) Empty property indicating device requires | ||
1919 | shifted clock phase (CPHA) mode | ||
1920 | - spi-cs-high - (optional) Empty property indicating device requires | ||
1921 | chip select active high | ||
1922 | |||
1923 | SPI example for an MPC5200 SPI bus: | ||
1924 | spi@f00 { | ||
1925 | #address-cells = <1>; | ||
1926 | #size-cells = <0>; | ||
1927 | compatible = "fsl,mpc5200b-spi","fsl,mpc5200-spi"; | ||
1928 | reg = <0xf00 0x20>; | ||
1929 | interrupts = <2 13 0 2 14 0>; | ||
1930 | interrupt-parent = <&mpc5200_pic>; | ||
1931 | |||
1932 | ethernet-switch@0 { | ||
1933 | compatible = "micrel,ks8995m"; | ||
1934 | spi-max-frequency = <1000000>; | ||
1935 | reg = <0>; | ||
1936 | }; | ||
1937 | |||
1938 | codec@1 { | ||
1939 | compatible = "ti,tlv320aic26"; | ||
1940 | spi-max-frequency = <100000>; | ||
1941 | reg = <1>; | ||
1942 | }; | ||
1943 | }; | ||
1944 | |||
1818 | VII - Marvell Discovery mv64[345]6x System Controller chips | 1945 | VII - Marvell Discovery mv64[345]6x System Controller chips |
1819 | =========================================================== | 1946 | =========================================================== |
1820 | 1947 | ||
@@ -1828,7 +1955,7 @@ prefixed with the string "marvell,", for Marvell Technology Group Ltd. | |||
1828 | 1) The /system-controller node | 1955 | 1) The /system-controller node |
1829 | 1956 | ||
1830 | This node is used to represent the system-controller and must be | 1957 | This node is used to represent the system-controller and must be |
1831 | present when the system uses a system contller chip. The top-level | 1958 | present when the system uses a system controller chip. The top-level |
1832 | system-controller node contains information that is global to all | 1959 | system-controller node contains information that is global to all |
1833 | devices within the system controller chip. The node name begins | 1960 | devices within the system controller chip. The node name begins |
1834 | with "system-controller" followed by the unit address, which is | 1961 | with "system-controller" followed by the unit address, which is |
@@ -2422,8 +2549,8 @@ encodings listed below: | |||
2422 | 2 = high to low edge sensitive type enabled | 2549 | 2 = high to low edge sensitive type enabled |
2423 | 3 = low to high edge sensitive type enabled | 2550 | 3 = low to high edge sensitive type enabled |
2424 | 2551 | ||
2425 | VIII - Specifying GPIO information for devices | 2552 | IX - Specifying GPIO information for devices |
2426 | ============================================== | 2553 | ============================================ |
2427 | 2554 | ||
2428 | 1) gpios property | 2555 | 1) gpios property |
2429 | ----------------- | 2556 | ----------------- |
@@ -2471,116 +2598,151 @@ Example of two SOC GPIO banks defined as gpio-controller nodes: | |||
2471 | gpio-controller; | 2598 | gpio-controller; |
2472 | }; | 2599 | }; |
2473 | 2600 | ||
2601 | X - Specifying Device Power Management Information (sleep property) | ||
2602 | =================================================================== | ||
2603 | |||
2604 | Devices on SOCs often have mechanisms for placing devices into low-power | ||
2605 | states that are decoupled from the devices' own register blocks. Sometimes, | ||
2606 | this information is more complicated than a cell-index property can | ||
2607 | reasonably describe. Thus, each device controlled in such a manner | ||
2608 | may contain a "sleep" property which describes these connections. | ||
2609 | |||
2610 | The sleep property consists of one or more sleep resources, each of | ||
2611 | which consists of a phandle to a sleep controller, followed by a | ||
2612 | controller-specific sleep specifier of zero or more cells. | ||
2613 | |||
2614 | The semantics of what type of low power modes are possible are defined | ||
2615 | by the sleep controller. Some examples of the types of low power modes | ||
2616 | that may be supported are: | ||
2617 | |||
2618 | - Dynamic: The device may be disabled or enabled at any time. | ||
2619 | - System Suspend: The device may request to be disabled or remain | ||
2620 | awake during system suspend, but will not be disabled until then. | ||
2621 | - Permanent: The device is disabled permanently (until the next hard | ||
2622 | reset). | ||
2623 | |||
2624 | Some devices may share a clock domain with each other, such that they should | ||
2625 | only be suspended when none of the devices are in use. Where reasonable, | ||
2626 | such nodes should be placed on a virtual bus, where the bus has the sleep | ||
2627 | property. If the clock domain is shared among devices that cannot be | ||
2628 | reasonably grouped in this manner, then create a virtual sleep controller | ||
2629 | (similar to an interrupt nexus, except that defining a standardized | ||
2630 | sleep-map should wait until its necessity is demonstrated). | ||
2631 | |||
2474 | Appendix A - Sample SOC node for MPC8540 | 2632 | Appendix A - Sample SOC node for MPC8540 |
2475 | ======================================== | 2633 | ======================================== |
2476 | 2634 | ||
2477 | Note that the #address-cells and #size-cells for the SoC node | 2635 | soc@e0000000 { |
2478 | in this example have been explicitly listed; these are likely | ||
2479 | not necessary as they are usually the same as the root node. | ||
2480 | |||
2481 | soc8540@e0000000 { | ||
2482 | #address-cells = <1>; | 2636 | #address-cells = <1>; |
2483 | #size-cells = <1>; | 2637 | #size-cells = <1>; |
2484 | #interrupt-cells = <2>; | 2638 | compatible = "fsl,mpc8540-ccsr", "simple-bus"; |
2485 | device_type = "soc"; | 2639 | device_type = "soc"; |
2486 | ranges = <00000000 e0000000 00100000> | 2640 | ranges = <0x00000000 0xe0000000 0x00100000> |
2487 | reg = <e0000000 00003000>; | ||
2488 | bus-frequency = <0>; | 2641 | bus-frequency = <0>; |
2489 | 2642 | interrupt-parent = <&pic>; | |
2490 | mdio@24520 { | ||
2491 | reg = <24520 20>; | ||
2492 | device_type = "mdio"; | ||
2493 | compatible = "gianfar"; | ||
2494 | |||
2495 | ethernet-phy@0 { | ||
2496 | linux,phandle = <2452000> | ||
2497 | interrupt-parent = <40000>; | ||
2498 | interrupts = <35 1>; | ||
2499 | reg = <0>; | ||
2500 | device_type = "ethernet-phy"; | ||
2501 | }; | ||
2502 | |||
2503 | ethernet-phy@1 { | ||
2504 | linux,phandle = <2452001> | ||
2505 | interrupt-parent = <40000>; | ||
2506 | interrupts = <35 1>; | ||
2507 | reg = <1>; | ||
2508 | device_type = "ethernet-phy"; | ||
2509 | }; | ||
2510 | |||
2511 | ethernet-phy@3 { | ||
2512 | linux,phandle = <2452002> | ||
2513 | interrupt-parent = <40000>; | ||
2514 | interrupts = <35 1>; | ||
2515 | reg = <3>; | ||
2516 | device_type = "ethernet-phy"; | ||
2517 | }; | ||
2518 | |||
2519 | }; | ||
2520 | 2643 | ||
2521 | ethernet@24000 { | 2644 | ethernet@24000 { |
2522 | #size-cells = <0>; | 2645 | #address-cells = <1>; |
2646 | #size-cells = <1>; | ||
2523 | device_type = "network"; | 2647 | device_type = "network"; |
2524 | model = "TSEC"; | 2648 | model = "TSEC"; |
2525 | compatible = "gianfar"; | 2649 | compatible = "gianfar", "simple-bus"; |
2526 | reg = <24000 1000>; | 2650 | reg = <0x24000 0x1000>; |
2527 | mac-address = [ 00 E0 0C 00 73 00 ]; | 2651 | local-mac-address = [ 00 E0 0C 00 73 00 ]; |
2528 | interrupts = <d 3 e 3 12 3>; | 2652 | interrupts = <29 2 30 2 34 2>; |
2529 | interrupt-parent = <40000>; | 2653 | phy-handle = <&phy0>; |
2530 | phy-handle = <2452000>; | 2654 | sleep = <&pmc 00000080>; |
2655 | ranges; | ||
2656 | |||
2657 | mdio@24520 { | ||
2658 | reg = <0x24520 0x20>; | ||
2659 | compatible = "fsl,gianfar-mdio"; | ||
2660 | |||
2661 | phy0: ethernet-phy@0 { | ||
2662 | interrupts = <5 1>; | ||
2663 | reg = <0>; | ||
2664 | device_type = "ethernet-phy"; | ||
2665 | }; | ||
2666 | |||
2667 | phy1: ethernet-phy@1 { | ||
2668 | interrupts = <5 1>; | ||
2669 | reg = <1>; | ||
2670 | device_type = "ethernet-phy"; | ||
2671 | }; | ||
2672 | |||
2673 | phy3: ethernet-phy@3 { | ||
2674 | interrupts = <7 1>; | ||
2675 | reg = <3>; | ||
2676 | device_type = "ethernet-phy"; | ||
2677 | }; | ||
2678 | }; | ||
2531 | }; | 2679 | }; |
2532 | 2680 | ||
2533 | ethernet@25000 { | 2681 | ethernet@25000 { |
2534 | #address-cells = <1>; | ||
2535 | #size-cells = <0>; | ||
2536 | device_type = "network"; | 2682 | device_type = "network"; |
2537 | model = "TSEC"; | 2683 | model = "TSEC"; |
2538 | compatible = "gianfar"; | 2684 | compatible = "gianfar"; |
2539 | reg = <25000 1000>; | 2685 | reg = <0x25000 0x1000>; |
2540 | mac-address = [ 00 E0 0C 00 73 01 ]; | 2686 | local-mac-address = [ 00 E0 0C 00 73 01 ]; |
2541 | interrupts = <13 3 14 3 18 3>; | 2687 | interrupts = <13 2 14 2 18 2>; |
2542 | interrupt-parent = <40000>; | 2688 | phy-handle = <&phy1>; |
2543 | phy-handle = <2452001>; | 2689 | sleep = <&pmc 00000040>; |
2544 | }; | 2690 | }; |
2545 | 2691 | ||
2546 | ethernet@26000 { | 2692 | ethernet@26000 { |
2547 | #address-cells = <1>; | ||
2548 | #size-cells = <0>; | ||
2549 | device_type = "network"; | 2693 | device_type = "network"; |
2550 | model = "FEC"; | 2694 | model = "FEC"; |
2551 | compatible = "gianfar"; | 2695 | compatible = "gianfar"; |
2552 | reg = <26000 1000>; | 2696 | reg = <0x26000 0x1000>; |
2553 | mac-address = [ 00 E0 0C 00 73 02 ]; | 2697 | local-mac-address = [ 00 E0 0C 00 73 02 ]; |
2554 | interrupts = <19 3>; | 2698 | interrupts = <41 2>; |
2555 | interrupt-parent = <40000>; | 2699 | phy-handle = <&phy3>; |
2556 | phy-handle = <2452002>; | 2700 | sleep = <&pmc 00000020>; |
2557 | }; | 2701 | }; |
2558 | 2702 | ||
2559 | serial@4500 { | 2703 | serial@4500 { |
2560 | device_type = "serial"; | 2704 | #address-cells = <1>; |
2561 | compatible = "ns16550"; | 2705 | #size-cells = <1>; |
2562 | reg = <4500 100>; | 2706 | compatible = "fsl,mpc8540-duart", "simple-bus"; |
2563 | clock-frequency = <0>; | 2707 | sleep = <&pmc 00000002>; |
2564 | interrupts = <1a 3>; | 2708 | ranges; |
2565 | interrupt-parent = <40000>; | 2709 | |
2710 | serial@4500 { | ||
2711 | device_type = "serial"; | ||
2712 | compatible = "ns16550"; | ||
2713 | reg = <0x4500 0x100>; | ||
2714 | clock-frequency = <0>; | ||
2715 | interrupts = <42 2>; | ||
2716 | }; | ||
2717 | |||
2718 | serial@4600 { | ||
2719 | device_type = "serial"; | ||
2720 | compatible = "ns16550"; | ||
2721 | reg = <0x4600 0x100>; | ||
2722 | clock-frequency = <0>; | ||
2723 | interrupts = <42 2>; | ||
2724 | }; | ||
2566 | }; | 2725 | }; |
2567 | 2726 | ||
2568 | pic@40000 { | 2727 | pic: pic@40000 { |
2569 | linux,phandle = <40000>; | ||
2570 | interrupt-controller; | 2728 | interrupt-controller; |
2571 | #address-cells = <0>; | 2729 | #address-cells = <0>; |
2572 | reg = <40000 40000>; | 2730 | #interrupt-cells = <2>; |
2731 | reg = <0x40000 0x40000>; | ||
2573 | compatible = "chrp,open-pic"; | 2732 | compatible = "chrp,open-pic"; |
2574 | device_type = "open-pic"; | 2733 | device_type = "open-pic"; |
2575 | }; | 2734 | }; |
2576 | 2735 | ||
2577 | i2c@3000 { | 2736 | i2c@3000 { |
2578 | interrupt-parent = <40000>; | 2737 | interrupts = <43 2>; |
2579 | interrupts = <1b 3>; | 2738 | reg = <0x3000 0x100>; |
2580 | reg = <3000 18>; | ||
2581 | device_type = "i2c"; | ||
2582 | compatible = "fsl-i2c"; | 2739 | compatible = "fsl-i2c"; |
2583 | dfsrr; | 2740 | dfsrr; |
2741 | sleep = <&pmc 00000004>; | ||
2584 | }; | 2742 | }; |
2585 | 2743 | ||
2744 | pmc: power@e0070 { | ||
2745 | compatible = "fsl,mpc8540-pmc", "fsl,mpc8548-pmc"; | ||
2746 | reg = <0xe0070 0x20>; | ||
2747 | }; | ||
2586 | }; | 2748 | }; |
diff --git a/Documentation/powerpc/dts-bindings/fsl/83xx-512x-pci.txt b/Documentation/powerpc/dts-bindings/fsl/83xx-512x-pci.txt new file mode 100644 index 000000000000..35a465362408 --- /dev/null +++ b/Documentation/powerpc/dts-bindings/fsl/83xx-512x-pci.txt | |||
@@ -0,0 +1,40 @@ | |||
1 | * Freescale 83xx and 512x PCI bridges | ||
2 | |||
3 | Freescale 83xx and 512x SOCs include the same pci bridge core. | ||
4 | |||
5 | 83xx/512x specific notes: | ||
6 | - reg: should contain two address length tuples | ||
7 | The first is for the internal pci bridge registers | ||
8 | The second is for the pci config space access registers | ||
9 | |||
10 | Example (MPC8313ERDB) | ||
11 | pci0: pci@e0008500 { | ||
12 | cell-index = <1>; | ||
13 | interrupt-map-mask = <0xf800 0x0 0x0 0x7>; | ||
14 | interrupt-map = < | ||
15 | /* IDSEL 0x0E -mini PCI */ | ||
16 | 0x7000 0x0 0x0 0x1 &ipic 18 0x8 | ||
17 | 0x7000 0x0 0x0 0x2 &ipic 18 0x8 | ||
18 | 0x7000 0x0 0x0 0x3 &ipic 18 0x8 | ||
19 | 0x7000 0x0 0x0 0x4 &ipic 18 0x8 | ||
20 | |||
21 | /* IDSEL 0x0F - PCI slot */ | ||
22 | 0x7800 0x0 0x0 0x1 &ipic 17 0x8 | ||
23 | 0x7800 0x0 0x0 0x2 &ipic 18 0x8 | ||
24 | 0x7800 0x0 0x0 0x3 &ipic 17 0x8 | ||
25 | 0x7800 0x0 0x0 0x4 &ipic 18 0x8>; | ||
26 | interrupt-parent = <&ipic>; | ||
27 | interrupts = <66 0x8>; | ||
28 | bus-range = <0x0 0x0>; | ||
29 | ranges = <0x02000000 0x0 0x90000000 0x90000000 0x0 0x10000000 | ||
30 | 0x42000000 0x0 0x80000000 0x80000000 0x0 0x10000000 | ||
31 | 0x01000000 0x0 0x00000000 0xe2000000 0x0 0x00100000>; | ||
32 | clock-frequency = <66666666>; | ||
33 | #interrupt-cells = <1>; | ||
34 | #size-cells = <2>; | ||
35 | #address-cells = <3>; | ||
36 | reg = <0xe0008500 0x100 /* internal registers */ | ||
37 | 0xe0008300 0x8>; /* config space access registers */ | ||
38 | compatible = "fsl,mpc8349-pci"; | ||
39 | device_type = "pci"; | ||
40 | }; | ||
diff --git a/Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt b/Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt new file mode 100644 index 000000000000..d015dcec4011 --- /dev/null +++ b/Documentation/powerpc/dts-bindings/fsl/8xxx_gpio.txt | |||
@@ -0,0 +1,40 @@ | |||
1 | GPIO controllers on MPC8xxx SoCs | ||
2 | |||
3 | This is for the non-QE/CPM/GUTs GPIO controllers as found on | ||
4 | 8349, 8572, 8610 and compatible. | ||
5 | |||
6 | Every GPIO controller node must have #gpio-cells property defined, | ||
7 | this information will be used to translate gpio-specifiers. | ||
8 | |||
9 | Required properties: | ||
10 | - compatible : "fsl,<CHIP>-gpio" followed by "fsl,mpc8349-gpio" for | ||
11 | 83xx, "fsl,mpc8572-gpio" for 85xx and "fsl,mpc8610-gpio" for 86xx. | ||
12 | - #gpio-cells : Should be two. The first cell is the pin number and the | ||
13 | second cell is used to specify optional parameters (currently unused). | ||
14 | - interrupts : Interrupt mapping for GPIO IRQ (currently unused). | ||
15 | - interrupt-parent : Phandle for the interrupt controller that | ||
16 | services interrupts for this device. | ||
17 | - gpio-controller : Marks the port as GPIO controller. | ||
18 | |||
19 | Example of gpio-controller nodes for a MPC8347 SoC: | ||
20 | |||
21 | gpio1: gpio-controller@c00 { | ||
22 | #gpio-cells = <2>; | ||
23 | compatible = "fsl,mpc8347-gpio", "fsl,mpc8349-gpio"; | ||
24 | reg = <0xc00 0x100>; | ||
25 | interrupts = <74 0x8>; | ||
26 | interrupt-parent = <&ipic>; | ||
27 | gpio-controller; | ||
28 | }; | ||
29 | |||
30 | gpio2: gpio-controller@d00 { | ||
31 | #gpio-cells = <2>; | ||
32 | compatible = "fsl,mpc8347-gpio", "fsl,mpc8349-gpio"; | ||
33 | reg = <0xd00 0x100>; | ||
34 | interrupts = <75 0x8>; | ||
35 | interrupt-parent = <&ipic>; | ||
36 | gpio-controller; | ||
37 | }; | ||
38 | |||
39 | See booting-without-of.txt for details of how to specify GPIO | ||
40 | information for devices. | ||
diff --git a/Documentation/powerpc/dts-bindings/fsl/board.txt b/Documentation/powerpc/dts-bindings/fsl/board.txt index 74ae6f1cd2d6..81a917ef96e9 100644 --- a/Documentation/powerpc/dts-bindings/fsl/board.txt +++ b/Documentation/powerpc/dts-bindings/fsl/board.txt | |||
@@ -2,13 +2,13 @@ | |||
2 | 2 | ||
3 | Required properties: | 3 | Required properties: |
4 | 4 | ||
5 | - device_type : Should be "board-control" | 5 | - compatible : Should be "fsl,<board>-bcsr" |
6 | - reg : Offset and length of the register set for the device | 6 | - reg : Offset and length of the register set for the device |
7 | 7 | ||
8 | Example: | 8 | Example: |
9 | 9 | ||
10 | bcsr@f8000000 { | 10 | bcsr@f8000000 { |
11 | device_type = "board-control"; | 11 | compatible = "fsl,mpc8360mds-bcsr"; |
12 | reg = <f8000000 8000>; | 12 | reg = <f8000000 8000>; |
13 | }; | 13 | }; |
14 | 14 | ||
diff --git a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/gpio.txt b/Documentation/powerpc/dts-bindings/fsl/cpm_qe/gpio.txt new file mode 100644 index 000000000000..1815dfede1bc --- /dev/null +++ b/Documentation/powerpc/dts-bindings/fsl/cpm_qe/gpio.txt | |||
@@ -0,0 +1,38 @@ | |||
1 | Every GPIO controller node must have #gpio-cells property defined, | ||
2 | this information will be used to translate gpio-specifiers. | ||
3 | |||
4 | On CPM1 devices, all ports are using slightly different register layouts. | ||
5 | Ports A, C and D are 16bit ports and Ports B and E are 32bit ports. | ||
6 | |||
7 | On CPM2 devices, all ports are 32bit ports and use a common register layout. | ||
8 | |||
9 | Required properties: | ||
10 | - compatible : "fsl,cpm1-pario-bank-a", "fsl,cpm1-pario-bank-b", | ||
11 | "fsl,cpm1-pario-bank-c", "fsl,cpm1-pario-bank-d", | ||
12 | "fsl,cpm1-pario-bank-e", "fsl,cpm2-pario-bank" | ||
13 | - #gpio-cells : Should be two. The first cell is the pin number and the | ||
14 | second cell is used to specify optional paramters (currently unused). | ||
15 | - gpio-controller : Marks the port as GPIO controller. | ||
16 | |||
17 | Example of three SOC GPIO banks defined as gpio-controller nodes: | ||
18 | |||
19 | CPM1_PIO_A: gpio-controller@950 { | ||
20 | #gpio-cells = <2>; | ||
21 | compatible = "fsl,cpm1-pario-bank-a"; | ||
22 | reg = <0x950 0x10>; | ||
23 | gpio-controller; | ||
24 | }; | ||
25 | |||
26 | CPM1_PIO_B: gpio-controller@ab8 { | ||
27 | #gpio-cells = <2>; | ||
28 | compatible = "fsl,cpm1-pario-bank-b"; | ||
29 | reg = <0xab8 0x10>; | ||
30 | gpio-controller; | ||
31 | }; | ||
32 | |||
33 | CPM1_PIO_E: gpio-controller@ac8 { | ||
34 | #gpio-cells = <2>; | ||
35 | compatible = "fsl,cpm1-pario-bank-e"; | ||
36 | reg = <0xac8 0x18>; | ||
37 | gpio-controller; | ||
38 | }; | ||
diff --git a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/usb.txt b/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/usb.txt index c8f44d6bcbcf..9ccd5f30405b 100644 --- a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/usb.txt +++ b/Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/usb.txt | |||
@@ -1,22 +1,37 @@ | |||
1 | * USB (Universal Serial Bus Controller) | 1 | Freescale QUICC Engine USB Controller |
2 | 2 | ||
3 | Required properties: | 3 | Required properties: |
4 | - compatible : could be "qe_udc" or "fhci-hcd". | 4 | - compatible : should be "fsl,<chip>-qe-usb", "fsl,mpc8323-qe-usb". |
5 | - mode : the could be "host" or "slave". | 5 | - reg : the first two cells should contain usb registers location and |
6 | - reg : Offset and length of the register set for the device | 6 | length, the next two two cells should contain PRAM location and |
7 | - interrupts : <a b> where a is the interrupt number and b is a | 7 | length. |
8 | field that represents an encoding of the sense and level | 8 | - interrupts : should contain USB interrupt. |
9 | information for the interrupt. This should be encoded based on | 9 | - interrupt-parent : interrupt source phandle. |
10 | the information in section 2) depending on the type of interrupt | 10 | - fsl,fullspeed-clock : specifies the full speed USB clock source: |
11 | controller you have. | 11 | "none": clock source is disabled |
12 | - interrupt-parent : the phandle for the interrupt controller that | 12 | "brg1" through "brg16": clock source is BRG1-BRG16, respectively |
13 | services interrupts for this device. | 13 | "clk1" through "clk24": clock source is CLK1-CLK24, respectively |
14 | - fsl,lowspeed-clock : specifies the low speed USB clock source: | ||
15 | "none": clock source is disabled | ||
16 | "brg1" through "brg16": clock source is BRG1-BRG16, respectively | ||
17 | "clk1" through "clk24": clock source is CLK1-CLK24, respectively | ||
18 | - hub-power-budget : USB power budget for the root hub, in mA. | ||
19 | - gpios : should specify GPIOs in this order: USBOE, USBTP, USBTN, USBRP, | ||
20 | USBRN, SPEED (optional), and POWER (optional). | ||
14 | 21 | ||
15 | Example(slave): | 22 | Example: |
16 | usb@6c0 { | 23 | |
17 | compatible = "qe_udc"; | 24 | usb@6c0 { |
18 | reg = <6c0 40>; | 25 | compatible = "fsl,mpc8360-qe-usb", "fsl,mpc8323-qe-usb"; |
19 | interrupts = <8b 0>; | 26 | reg = <0x6c0 0x40 0x8b00 0x100>; |
20 | interrupt-parent = <700>; | 27 | interrupts = <11>; |
21 | mode = "slave"; | 28 | interrupt-parent = <&qeic>; |
22 | }; | 29 | fsl,fullspeed-clock = "clk21"; |
30 | gpios = <&qe_pio_b 2 0 /* USBOE */ | ||
31 | &qe_pio_b 3 0 /* USBTP */ | ||
32 | &qe_pio_b 8 0 /* USBTN */ | ||
33 | &qe_pio_b 9 0 /* USBRP */ | ||
34 | &qe_pio_b 11 0 /* USBRN */ | ||
35 | &qe_pio_e 20 0 /* SPEED */ | ||
36 | &qe_pio_e 21 0 /* POWER */>; | ||
37 | }; | ||
diff --git a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/serial.txt b/Documentation/powerpc/dts-bindings/fsl/cpm_qe/serial.txt index b35f3482e3e4..2ea76d9d137c 100644 --- a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/serial.txt +++ b/Documentation/powerpc/dts-bindings/fsl/cpm_qe/serial.txt | |||
@@ -7,6 +7,15 @@ Currently defined compatibles: | |||
7 | - fsl,cpm2-scc-uart | 7 | - fsl,cpm2-scc-uart |
8 | - fsl,qe-uart | 8 | - fsl,qe-uart |
9 | 9 | ||
10 | Modem control lines connected to GPIO controllers are listed in the gpios | ||
11 | property as described in booting-without-of.txt, section IX.1 in the following | ||
12 | order: | ||
13 | |||
14 | CTS, RTS, DCD, DSR, DTR, and RI. | ||
15 | |||
16 | The gpios property is optional and can be left out when control lines are | ||
17 | not used. | ||
18 | |||
10 | Example: | 19 | Example: |
11 | 20 | ||
12 | serial@11a00 { | 21 | serial@11a00 { |
@@ -18,4 +27,6 @@ Example: | |||
18 | interrupt-parent = <&PIC>; | 27 | interrupt-parent = <&PIC>; |
19 | fsl,cpm-brg = <1>; | 28 | fsl,cpm-brg = <1>; |
20 | fsl,cpm-command = <00800000>; | 29 | fsl,cpm-command = <00800000>; |
30 | gpios = <&gpio_c 15 0 | ||
31 | &gpio_d 29 0>; | ||
21 | }; | 32 | }; |
diff --git a/Documentation/powerpc/dts-bindings/fsl/dma.txt b/Documentation/powerpc/dts-bindings/fsl/dma.txt index 86826df00e64..cc453110fc46 100644 --- a/Documentation/powerpc/dts-bindings/fsl/dma.txt +++ b/Documentation/powerpc/dts-bindings/fsl/dma.txt | |||
@@ -20,7 +20,7 @@ Required properties: | |||
20 | - compatible : compatible list, contains 2 entries, first is | 20 | - compatible : compatible list, contains 2 entries, first is |
21 | "fsl,CHIP-dma-channel", where CHIP is the processor | 21 | "fsl,CHIP-dma-channel", where CHIP is the processor |
22 | (mpc8349, mpc8350, etc.) and the second is | 22 | (mpc8349, mpc8350, etc.) and the second is |
23 | "fsl,elo-dma-channel" | 23 | "fsl,elo-dma-channel". However, see note below. |
24 | - reg : <registers mapping for channel> | 24 | - reg : <registers mapping for channel> |
25 | - cell-index : dma channel index starts at 0. | 25 | - cell-index : dma channel index starts at 0. |
26 | 26 | ||
@@ -82,7 +82,7 @@ Required properties: | |||
82 | - compatible : compatible list, contains 2 entries, first is | 82 | - compatible : compatible list, contains 2 entries, first is |
83 | "fsl,CHIP-dma-channel", where CHIP is the processor | 83 | "fsl,CHIP-dma-channel", where CHIP is the processor |
84 | (mpc8540, mpc8560, etc.) and the second is | 84 | (mpc8540, mpc8560, etc.) and the second is |
85 | "fsl,eloplus-dma-channel" | 85 | "fsl,eloplus-dma-channel". However, see note below. |
86 | - cell-index : dma channel index starts at 0. | 86 | - cell-index : dma channel index starts at 0. |
87 | - reg : <registers mapping for channel> | 87 | - reg : <registers mapping for channel> |
88 | - interrupts : <interrupt mapping for DMA channel IRQ> | 88 | - interrupts : <interrupt mapping for DMA channel IRQ> |
@@ -125,3 +125,12 @@ Example: | |||
125 | interrupts = <17 2>; | 125 | interrupts = <17 2>; |
126 | }; | 126 | }; |
127 | }; | 127 | }; |
128 | |||
129 | Note on DMA channel compatible properties: The compatible property must say | ||
130 | "fsl,elo-dma-channel" or "fsl,eloplus-dma-channel" to be used by the Elo DMA | ||
131 | driver (fsldma). Any DMA channel used by fsldma cannot be used by another | ||
132 | DMA driver, such as the SSI sound drivers for the MPC8610. Therefore, any DMA | ||
133 | channel that should be used for another driver should not use | ||
134 | "fsl,elo-dma-channel" or "fsl,eloplus-dma-channel". For the SSI drivers, for | ||
135 | example, the compatible property should be "fsl,ssi-dma-channel". See ssi.txt | ||
136 | for more information. | ||
diff --git a/Documentation/powerpc/dts-bindings/fsl/mcu-mpc8349emitx.txt b/Documentation/powerpc/dts-bindings/fsl/mcu-mpc8349emitx.txt new file mode 100644 index 000000000000..0f766333b6eb --- /dev/null +++ b/Documentation/powerpc/dts-bindings/fsl/mcu-mpc8349emitx.txt | |||
@@ -0,0 +1,17 @@ | |||
1 | Freescale MPC8349E-mITX-compatible Power Management Micro Controller Unit (MCU) | ||
2 | |||
3 | Required properties: | ||
4 | - compatible : "fsl,<mcu-chip>-<board>", "fsl,mcu-mpc8349emitx". | ||
5 | - reg : should specify I2C address (0x0a). | ||
6 | - #gpio-cells : should be 2. | ||
7 | - gpio-controller : should be present. | ||
8 | |||
9 | Example: | ||
10 | |||
11 | mcu@0a { | ||
12 | #gpio-cells = <2>; | ||
13 | compatible = "fsl,mc9s08qg8-mpc8349emitx", | ||
14 | "fsl,mcu-mpc8349emitx"; | ||
15 | reg = <0x0a>; | ||
16 | gpio-controller; | ||
17 | }; | ||
diff --git a/Documentation/powerpc/dts-bindings/fsl/pmc.txt b/Documentation/powerpc/dts-bindings/fsl/pmc.txt new file mode 100644 index 000000000000..02f6f43ee1b7 --- /dev/null +++ b/Documentation/powerpc/dts-bindings/fsl/pmc.txt | |||
@@ -0,0 +1,63 @@ | |||
1 | * Power Management Controller | ||
2 | |||
3 | Properties: | ||
4 | - compatible: "fsl,<chip>-pmc". | ||
5 | |||
6 | "fsl,mpc8349-pmc" should be listed for any chip whose PMC is | ||
7 | compatible. "fsl,mpc8313-pmc" should also be listed for any chip | ||
8 | whose PMC is compatible, and implies deep-sleep capability. | ||
9 | |||
10 | "fsl,mpc8548-pmc" should be listed for any chip whose PMC is | ||
11 | compatible. "fsl,mpc8536-pmc" should also be listed for any chip | ||
12 | whose PMC is compatible, and implies deep-sleep capability. | ||
13 | |||
14 | "fsl,mpc8641d-pmc" should be listed for any chip whose PMC is | ||
15 | compatible; all statements below that apply to "fsl,mpc8548-pmc" also | ||
16 | apply to "fsl,mpc8641d-pmc". | ||
17 | |||
18 | Compatibility does not include bit assigments in SCCR/PMCDR/DEVDISR; these | ||
19 | bit assigments are indicated via the sleep specifier in each device's | ||
20 | sleep property. | ||
21 | |||
22 | - reg: For devices compatible with "fsl,mpc8349-pmc", the first resource | ||
23 | is the PMC block, and the second resource is the Clock Configuration | ||
24 | block. | ||
25 | |||
26 | For devices compatible with "fsl,mpc8548-pmc", the first resource | ||
27 | is a 32-byte block beginning with DEVDISR. | ||
28 | |||
29 | - interrupts: For "fsl,mpc8349-pmc"-compatible devices, the first | ||
30 | resource is the PMC block interrupt. | ||
31 | |||
32 | - fsl,mpc8313-wakeup-timer: For "fsl,mpc8313-pmc"-compatible devices, | ||
33 | this is a phandle to an "fsl,gtm" node on which timer 4 can be used as | ||
34 | a wakeup source from deep sleep. | ||
35 | |||
36 | Sleep specifiers: | ||
37 | |||
38 | fsl,mpc8349-pmc: Sleep specifiers consist of one cell. For each bit | ||
39 | that is set in the cell, the corresponding bit in SCCR will be saved | ||
40 | and cleared on suspend, and restored on resume. This sleep controller | ||
41 | supports disabling and resuming devices at any time. | ||
42 | |||
43 | fsl,mpc8536-pmc: Sleep specifiers consist of three cells, the third of | ||
44 | which will be ORed into PMCDR upon suspend, and cleared from PMCDR | ||
45 | upon resume. The first two cells are as described for fsl,mpc8578-pmc. | ||
46 | This sleep controller only supports disabling devices during system | ||
47 | sleep, or permanently. | ||
48 | |||
49 | fsl,mpc8548-pmc: Sleep specifiers consist of one or two cells, the | ||
50 | first of which will be ORed into DEVDISR (and the second into | ||
51 | DEVDISR2, if present -- this cell should be zero or absent if the | ||
52 | hardware does not have DEVDISR2) upon a request for permanent device | ||
53 | disabling. This sleep controller does not support configuring devices | ||
54 | to disable during system sleep (unless supported by another compatible | ||
55 | match), or dynamically. | ||
56 | |||
57 | Example: | ||
58 | |||
59 | power@b00 { | ||
60 | compatible = "fsl,mpc8313-pmc", "fsl,mpc8349-pmc"; | ||
61 | reg = <0xb00 0x100 0xa00 0x100>; | ||
62 | interrupts = <80 8>; | ||
63 | }; | ||
diff --git a/Documentation/powerpc/dts-bindings/fsl/ssi.txt b/Documentation/powerpc/dts-bindings/fsl/ssi.txt index d100555d488a..a2d963998a65 100644 --- a/Documentation/powerpc/dts-bindings/fsl/ssi.txt +++ b/Documentation/powerpc/dts-bindings/fsl/ssi.txt | |||
@@ -24,6 +24,12 @@ Required properties: | |||
24 | "rj-master" - r.j., SSI is clock master | 24 | "rj-master" - r.j., SSI is clock master |
25 | "ac97-slave" - AC97 mode, SSI is clock slave | 25 | "ac97-slave" - AC97 mode, SSI is clock slave |
26 | "ac97-master" - AC97 mode, SSI is clock master | 26 | "ac97-master" - AC97 mode, SSI is clock master |
27 | - fsl,playback-dma: phandle to a node for the DMA channel to use for | ||
28 | playback of audio. This is typically dictated by SOC | ||
29 | design. See the notes below. | ||
30 | - fsl,capture-dma: phandle to a node for the DMA channel to use for | ||
31 | capture (recording) of audio. This is typically dictated | ||
32 | by SOC design. See the notes below. | ||
27 | 33 | ||
28 | Optional properties: | 34 | Optional properties: |
29 | - codec-handle : phandle to a 'codec' node that defines an audio | 35 | - codec-handle : phandle to a 'codec' node that defines an audio |
@@ -36,3 +42,20 @@ Child 'codec' node required properties: | |||
36 | Child 'codec' node optional properties: | 42 | Child 'codec' node optional properties: |
37 | - clock-frequency : The frequency of the input clock, which typically | 43 | - clock-frequency : The frequency of the input clock, which typically |
38 | comes from an on-board dedicated oscillator. | 44 | comes from an on-board dedicated oscillator. |
45 | |||
46 | Notes on fsl,playback-dma and fsl,capture-dma: | ||
47 | |||
48 | On SOCs that have an SSI, specific DMA channels are hard-wired for playback | ||
49 | and capture. On the MPC8610, for example, SSI1 must use DMA channel 0 for | ||
50 | playback and DMA channel 1 for capture. SSI2 must use DMA channel 2 for | ||
51 | playback and DMA channel 3 for capture. The developer can choose which | ||
52 | DMA controller to use, but the channels themselves are hard-wired. The | ||
53 | purpose of these two properties is to represent this hardware design. | ||
54 | |||
55 | The device tree nodes for the DMA channels that are referenced by | ||
56 | "fsl,playback-dma" and "fsl,capture-dma" must be marked as compatible with | ||
57 | "fsl,ssi-dma-channel". The SOC-specific compatible string (e.g. | ||
58 | "fsl,mpc8610-dma-channel") can remain. If these nodes are left as | ||
59 | "fsl,elo-dma-channel" or "fsl,eloplus-dma-channel", then the generic Elo DMA | ||
60 | drivers (fsldma) will attempt to use them, and it will conflict with the | ||
61 | sound drivers. | ||
diff --git a/Documentation/powerpc/dts-bindings/fsl/tsec.txt b/Documentation/powerpc/dts-bindings/fsl/tsec.txt index 583ef6b56c43..cf55fa4112d2 100644 --- a/Documentation/powerpc/dts-bindings/fsl/tsec.txt +++ b/Documentation/powerpc/dts-bindings/fsl/tsec.txt | |||
@@ -24,46 +24,39 @@ Example: | |||
24 | 24 | ||
25 | * Gianfar-compatible ethernet nodes | 25 | * Gianfar-compatible ethernet nodes |
26 | 26 | ||
27 | Required properties: | 27 | Properties: |
28 | 28 | ||
29 | - device_type : Should be "network" | 29 | - device_type : Should be "network" |
30 | - model : Model of the device. Can be "TSEC", "eTSEC", or "FEC" | 30 | - model : Model of the device. Can be "TSEC", "eTSEC", or "FEC" |
31 | - compatible : Should be "gianfar" | 31 | - compatible : Should be "gianfar" |
32 | - reg : Offset and length of the register set for the device | 32 | - reg : Offset and length of the register set for the device |
33 | - mac-address : List of bytes representing the ethernet address of | 33 | - local-mac-address : List of bytes representing the ethernet address of |
34 | this controller | 34 | this controller |
35 | - interrupts : <a b> where a is the interrupt number and b is a | 35 | - interrupts : For FEC devices, the first interrupt is the device's |
36 | field that represents an encoding of the sense and level | 36 | interrupt. For TSEC and eTSEC devices, the first interrupt is |
37 | information for the interrupt. This should be encoded based on | 37 | transmit, the second is receive, and the third is error. |
38 | the information in section 2) depending on the type of interrupt | ||
39 | controller you have. | ||
40 | - interrupt-parent : the phandle for the interrupt controller that | ||
41 | services interrupts for this device. | ||
42 | - phy-handle : The phandle for the PHY connected to this ethernet | 38 | - phy-handle : The phandle for the PHY connected to this ethernet |
43 | controller. | 39 | controller. |
44 | - fixed-link : <a b c d e> where a is emulated phy id - choose any, | 40 | - fixed-link : <a b c d e> where a is emulated phy id - choose any, |
45 | but unique to the all specified fixed-links, b is duplex - 0 half, | 41 | but unique to the all specified fixed-links, b is duplex - 0 half, |
46 | 1 full, c is link speed - d#10/d#100/d#1000, d is pause - 0 no | 42 | 1 full, c is link speed - d#10/d#100/d#1000, d is pause - 0 no |
47 | pause, 1 pause, e is asym_pause - 0 no asym_pause, 1 asym_pause. | 43 | pause, 1 pause, e is asym_pause - 0 no asym_pause, 1 asym_pause. |
48 | |||
49 | Recommended properties: | ||
50 | |||
51 | - phy-connection-type : a string naming the controller/PHY interface type, | 44 | - phy-connection-type : a string naming the controller/PHY interface type, |
52 | i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id", "sgmii", | 45 | i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id", "sgmii", |
53 | "tbi", or "rtbi". This property is only really needed if the connection | 46 | "tbi", or "rtbi". This property is only really needed if the connection |
54 | is of type "rgmii-id", as all other connection types are detected by | 47 | is of type "rgmii-id", as all other connection types are detected by |
55 | hardware. | 48 | hardware. |
56 | 49 | - fsl,magic-packet : If present, indicates that the hardware supports | |
50 | waking up via magic packet. | ||
57 | 51 | ||
58 | Example: | 52 | Example: |
59 | ethernet@24000 { | 53 | ethernet@24000 { |
60 | #size-cells = <0>; | ||
61 | device_type = "network"; | 54 | device_type = "network"; |
62 | model = "TSEC"; | 55 | model = "TSEC"; |
63 | compatible = "gianfar"; | 56 | compatible = "gianfar"; |
64 | reg = <24000 1000>; | 57 | reg = <0x24000 0x1000>; |
65 | mac-address = [ 00 E0 0C 00 73 00 ]; | 58 | local-mac-address = [ 00 E0 0C 00 73 00 ]; |
66 | interrupts = <d 3 e 3 12 3>; | 59 | interrupts = <29 2 30 2 34 2>; |
67 | interrupt-parent = <40000>; | 60 | interrupt-parent = <&mpic>; |
68 | phy-handle = <2452000> | 61 | phy-handle = <&phy0> |
69 | }; | 62 | }; |
diff --git a/Documentation/powerpc/dts-bindings/fsl/upm-nand.txt b/Documentation/powerpc/dts-bindings/fsl/upm-nand.txt new file mode 100644 index 000000000000..84a04d5eb8e6 --- /dev/null +++ b/Documentation/powerpc/dts-bindings/fsl/upm-nand.txt | |||
@@ -0,0 +1,28 @@ | |||
1 | Freescale Localbus UPM programmed to work with NAND flash | ||
2 | |||
3 | Required properties: | ||
4 | - compatible : "fsl,upm-nand". | ||
5 | - reg : should specify localbus chip select and size used for the chip. | ||
6 | - fsl,upm-addr-offset : UPM pattern offset for the address latch. | ||
7 | - fsl,upm-cmd-offset : UPM pattern offset for the command latch. | ||
8 | - gpios : may specify optional GPIO connected to the Ready-Not-Busy pin. | ||
9 | |||
10 | Example: | ||
11 | |||
12 | upm@1,0 { | ||
13 | compatible = "fsl,upm-nand"; | ||
14 | reg = <1 0 1>; | ||
15 | fsl,upm-addr-offset = <16>; | ||
16 | fsl,upm-cmd-offset = <8>; | ||
17 | gpios = <&qe_pio_e 18 0>; | ||
18 | |||
19 | flash { | ||
20 | #address-cells = <1>; | ||
21 | #size-cells = <1>; | ||
22 | compatible = "..."; | ||
23 | |||
24 | partition@0 { | ||
25 | ... | ||
26 | }; | ||
27 | }; | ||
28 | }; | ||
diff --git a/Documentation/powerpc/dts-bindings/gpio/led.txt b/Documentation/powerpc/dts-bindings/gpio/led.txt new file mode 100644 index 000000000000..ff51f4c0fa9d --- /dev/null +++ b/Documentation/powerpc/dts-bindings/gpio/led.txt | |||
@@ -0,0 +1,15 @@ | |||
1 | LED connected to GPIO | ||
2 | |||
3 | Required properties: | ||
4 | - compatible : should be "gpio-led". | ||
5 | - label : (optional) the label for this LED. If omitted, the label is | ||
6 | taken from the node name (excluding the unit address). | ||
7 | - gpios : should specify LED GPIO. | ||
8 | |||
9 | Example: | ||
10 | |||
11 | led@0 { | ||
12 | compatible = "gpio-led"; | ||
13 | label = "hdd"; | ||
14 | gpios = <&mcu_pio 0 1>; | ||
15 | }; | ||
diff --git a/Documentation/powerpc/eeh-pci-error-recovery.txt b/Documentation/powerpc/eeh-pci-error-recovery.txt index df7afe43d462..9d4e33df624c 100644 --- a/Documentation/powerpc/eeh-pci-error-recovery.txt +++ b/Documentation/powerpc/eeh-pci-error-recovery.txt | |||
@@ -133,7 +133,7 @@ error. Given an arbitrary address, the routine | |||
133 | pci_get_device_by_addr() will find the pci device associated | 133 | pci_get_device_by_addr() will find the pci device associated |
134 | with that address (if any). | 134 | with that address (if any). |
135 | 135 | ||
136 | The default include/asm-powerpc/io.h macros readb(), inb(), insb(), | 136 | The default arch/powerpc/include/asm/io.h macros readb(), inb(), insb(), |
137 | etc. include a check to see if the i/o read returned all-0xff's. | 137 | etc. include a check to see if the i/o read returned all-0xff's. |
138 | If so, these make a call to eeh_dn_check_failure(), which in turn | 138 | If so, these make a call to eeh_dn_check_failure(), which in turn |
139 | asks the firmware if the all-ff's value is the sign of a true EEH | 139 | asks the firmware if the all-ff's value is the sign of a true EEH |
diff --git a/Documentation/powerpc/ppc_htab.txt b/Documentation/powerpc/ppc_htab.txt deleted file mode 100644 index 8b8c7df29fa9..000000000000 --- a/Documentation/powerpc/ppc_htab.txt +++ /dev/null | |||
@@ -1,118 +0,0 @@ | |||
1 | Information about /proc/ppc_htab | ||
2 | ===================================================================== | ||
3 | |||
4 | This document and the related code was written by me (Cort Dougan), please | ||
5 | email me (cort@fsmlabs.com) if you have questions, comments or corrections. | ||
6 | |||
7 | Last Change: 2.16.98 | ||
8 | |||
9 | This entry in the proc directory is readable by all users but only | ||
10 | writable by root. | ||
11 | |||
12 | The ppc_htab interface is a user level way of accessing the | ||
13 | performance monitoring registers as well as providing information | ||
14 | about the PTE hash table. | ||
15 | |||
16 | 1. Reading | ||
17 | |||
18 | Reading this file will give you information about the memory management | ||
19 | hash table that serves as an extended tlb for page translation on the | ||
20 | powerpc. It will also give you information about performance measurement | ||
21 | specific to the cpu that you are using. | ||
22 | |||
23 | Explanation of the 604 Performance Monitoring Fields: | ||
24 | MMCR0 - the current value of the MMCR0 register | ||
25 | PMC1 | ||
26 | PMC2 - the value of the performance counters and a | ||
27 | description of what events they are counting | ||
28 | which are based on MMCR0 bit settings. | ||
29 | Explanation of the PTE Hash Table fields: | ||
30 | |||
31 | Size - hash table size in Kb. | ||
32 | Buckets - number of buckets in the table. | ||
33 | Address - the virtual kernel address of the hash table base. | ||
34 | Entries - the number of ptes that can be stored in the hash table. | ||
35 | User/Kernel - how many pte's are in use by the kernel or user at that time. | ||
36 | Overflows - How many of the entries are in their secondary hash location. | ||
37 | Percent full - ratio of free pte entries to in use entries. | ||
38 | Reloads - Count of how many hash table misses have occurred | ||
39 | that were fixed with a reload from the linux tables. | ||
40 | Should always be 0 on 603 based machines. | ||
41 | Non-error Misses - Count of how many hash table misses have occurred | ||
42 | that were completed with the creation of a pte in the linux | ||
43 | tables with a call to do_page_fault(). | ||
44 | Error Misses - Number of misses due to errors such as bad address | ||
45 | and permission violations. This includes kernel access of | ||
46 | bad user addresses that are fixed up by the trap handler. | ||
47 | |||
48 | Note that calculation of the data displayed from /proc/ppc_htab takes | ||
49 | a long time and spends a great deal of time in the kernel. It would | ||
50 | be quite hard on performance to read this file constantly. In time | ||
51 | there may be a counter in the kernel that allows successive reads from | ||
52 | this file only after a given amount of time has passed to reduce the | ||
53 | possibility of a user slowing the system by reading this file. | ||
54 | |||
55 | 2. Writing | ||
56 | |||
57 | Writing to the ppc_htab allows you to change the characteristics of | ||
58 | the powerpc PTE hash table and setup performance monitoring. | ||
59 | |||
60 | Resizing the PTE hash table is not enabled right now due to many | ||
61 | complications with moving the hash table, rehashing the entries | ||
62 | and many many SMP issues that would have to be dealt with. | ||
63 | |||
64 | Write options to ppc_htab: | ||
65 | |||
66 | - To set the size of the hash table to 64Kb: | ||
67 | |||
68 | echo 'size 64' > /proc/ppc_htab | ||
69 | |||
70 | The size must be a multiple of 64 and must be greater than or equal to | ||
71 | 64. | ||
72 | |||
73 | - To turn off performance monitoring: | ||
74 | |||
75 | echo 'off' > /proc/ppc_htab | ||
76 | |||
77 | - To reset the counters without changing what they're counting: | ||
78 | |||
79 | echo 'reset' > /proc/ppc_htab | ||
80 | |||
81 | Note that counting will continue after the reset if it is enabled. | ||
82 | |||
83 | - To count only events in user mode or only in kernel mode: | ||
84 | |||
85 | echo 'user' > /proc/ppc_htab | ||
86 | ...or... | ||
87 | echo 'kernel' > /proc/ppc_htab | ||
88 | |||
89 | Note that these two options are exclusive of one another and the | ||
90 | lack of either of these options counts user and kernel. | ||
91 | Using 'reset' and 'off' reset these flags. | ||
92 | |||
93 | - The 604 has 2 performance counters which can each count events from | ||
94 | a specific set of events. These sets are disjoint so it is not | ||
95 | possible to count _any_ combination of 2 events. One event can | ||
96 | be counted by PMC1 and one by PMC2. | ||
97 | |||
98 | To start counting a particular event use: | ||
99 | |||
100 | echo 'event' > /proc/ppc_htab | ||
101 | |||
102 | and choose from these events: | ||
103 | |||
104 | PMC1 | ||
105 | ---- | ||
106 | 'ic miss' - instruction cache misses | ||
107 | 'dtlb' - data tlb misses (not hash table misses) | ||
108 | |||
109 | PMC2 | ||
110 | ---- | ||
111 | 'dc miss' - data cache misses | ||
112 | 'itlb' - instruction tlb misses (not hash table misses) | ||
113 | 'load miss time' - cycles to complete a load miss | ||
114 | |||
115 | 3. Bugs | ||
116 | |||
117 | The PMC1 and PMC2 counters can overflow and give no indication of that | ||
118 | in /proc/ppc_htab. | ||
diff --git a/Documentation/powerpc/qe_firmware.txt b/Documentation/powerpc/qe_firmware.txt index 896266432d33..06da4d4b44f9 100644 --- a/Documentation/powerpc/qe_firmware.txt +++ b/Documentation/powerpc/qe_firmware.txt | |||
@@ -217,7 +217,7 @@ Although it is not recommended, you can specify '0' in the soc.model | |||
217 | field to skip matching SOCs altogether. | 217 | field to skip matching SOCs altogether. |
218 | 218 | ||
219 | The 'model' field is a 16-bit number that matches the actual SOC. The | 219 | The 'model' field is a 16-bit number that matches the actual SOC. The |
220 | 'major' and 'minor' fields are the major and minor revision numbrs, | 220 | 'major' and 'minor' fields are the major and minor revision numbers, |
221 | respectively, of the SOC. | 221 | respectively, of the SOC. |
222 | 222 | ||
223 | For example, to match the 8323, revision 1.0: | 223 | For example, to match the 8323, revision 1.0: |
diff --git a/Documentation/powerpc/smp.txt b/Documentation/powerpc/smp.txt deleted file mode 100644 index 5b581b849ff7..000000000000 --- a/Documentation/powerpc/smp.txt +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | Information about Linux/PPC SMP mode | ||
2 | ===================================================================== | ||
3 | |||
4 | This document and the related code was written by me | ||
5 | (Cort Dougan, cort@fsmlabs.com) please email me if you have questions, | ||
6 | comments or corrections. | ||
7 | |||
8 | Last Change: 3.31.99 | ||
9 | |||
10 | If you want to help by writing code or testing different hardware please | ||
11 | email me! | ||
12 | |||
13 | 1. State of Supported Hardware | ||
14 | |||
15 | PowerSurge Architecture - tested on UMAX s900, Apple 9600 | ||
16 | The second processor on this machine boots up just fine and | ||
17 | enters its idle loop. Hopefully a completely working SMP kernel | ||
18 | on this machine will be done shortly. | ||
19 | |||
20 | The code makes the assumption of only two processors. The changes | ||
21 | necessary to work with any number would not be overly difficult but | ||
22 | I don't have any machines with >2 processors so it's not high on my | ||
23 | list of priorities. If anyone else would like do to the work email | ||
24 | me and I can point out the places that need changed. If you have >2 | ||
25 | processors and don't want to add support yourself let me know and I | ||
26 | can take a look into it. | ||
27 | |||
28 | BeBox | ||
29 | BeBox support hasn't been added to the 2.1.X kernels from 2.0.X | ||
30 | but work is being done and SMP support for BeBox is in the works. | ||
31 | |||
32 | CHRP | ||
33 | CHRP SMP works and is fairly solid. It's been tested on the IBM F50 | ||
34 | with 4 processors for quite some time now. | ||
diff --git a/Documentation/rfkill.txt b/Documentation/rfkill.txt index a83ff23cd68c..b65f0799df48 100644 --- a/Documentation/rfkill.txt +++ b/Documentation/rfkill.txt | |||
@@ -1,89 +1,569 @@ | |||
1 | rfkill - RF switch subsystem support | 1 | rfkill - RF switch subsystem support |
2 | ==================================== | 2 | ==================================== |
3 | 3 | ||
4 | 1 Implementation details | 4 | 1 Introduction |
5 | 2 Driver support | 5 | 2 Implementation details |
6 | 3 Userspace support | 6 | 3 Kernel driver guidelines |
7 | 3.1 wireless device drivers | ||
8 | 3.2 platform/switch drivers | ||
9 | 3.3 input device drivers | ||
10 | 4 Kernel API | ||
11 | 5 Userspace support | ||
7 | 12 | ||
8 | =============================================================================== | ||
9 | 1: Implementation details | ||
10 | 13 | ||
11 | The rfkill switch subsystem offers support for keys often found on laptops | 14 | 1. Introduction: |
12 | to enable wireless devices like WiFi and Bluetooth. | 15 | |
16 | The rfkill switch subsystem exists to add a generic interface to circuitry that | ||
17 | can enable or disable the signal output of a wireless *transmitter* of any | ||
18 | type. By far, the most common use is to disable radio-frequency transmitters. | ||
13 | 19 | ||
14 | This is done by providing the user 3 possibilities: | 20 | Note that disabling the signal output means that the the transmitter is to be |
15 | 1 - The rfkill system handles all events; userspace is not aware of events. | 21 | made to not emit any energy when "blocked". rfkill is not about blocking data |
16 | 2 - The rfkill system handles all events; userspace is informed about the events. | 22 | transmissions, it is about blocking energy emission. |
17 | 3 - The rfkill system does not handle events; userspace handles all events. | ||
18 | 23 | ||
19 | The buttons to enable and disable the wireless radios are important in | 24 | The rfkill subsystem offers support for keys and switches often found on |
25 | laptops to enable wireless devices like WiFi and Bluetooth, so that these keys | ||
26 | and switches actually perform an action in all wireless devices of a given type | ||
27 | attached to the system. | ||
28 | |||
29 | The buttons to enable and disable the wireless transmitters are important in | ||
20 | situations where the user is for example using his laptop on a location where | 30 | situations where the user is for example using his laptop on a location where |
21 | wireless radios _must_ be disabled (e.g. airplanes). | 31 | radio-frequency transmitters _must_ be disabled (e.g. airplanes). |
22 | Because of this requirement, userspace support for the keys should not be | 32 | |
23 | made mandatory. Because userspace might want to perform some additional smarter | 33 | Because of this requirement, userspace support for the keys should not be made |
24 | tasks when the key is pressed, rfkill still provides userspace the possibility | 34 | mandatory. Because userspace might want to perform some additional smarter |
25 | to take over the task to handle the key events. | 35 | tasks when the key is pressed, rfkill provides userspace the possibility to |
36 | take over the task to handle the key events. | ||
37 | |||
38 | =============================================================================== | ||
39 | 2: Implementation details | ||
40 | |||
41 | The rfkill subsystem is composed of various components: the rfkill class, the | ||
42 | rfkill-input module (an input layer handler), and some specific input layer | ||
43 | events. | ||
44 | |||
45 | The rfkill class provides kernel drivers with an interface that allows them to | ||
46 | know when they should enable or disable a wireless network device transmitter. | ||
47 | This is enabled by the CONFIG_RFKILL Kconfig option. | ||
48 | |||
49 | The rfkill class support makes sure userspace will be notified of all state | ||
50 | changes on rfkill devices through uevents. It provides a notification chain | ||
51 | for interested parties in the kernel to also get notified of rfkill state | ||
52 | changes in other drivers. It creates several sysfs entries which can be used | ||
53 | by userspace. See section "Userspace support". | ||
54 | |||
55 | The rfkill-input module provides the kernel with the ability to implement a | ||
56 | basic response when the user presses a key or button (or toggles a switch) | ||
57 | related to rfkill functionality. It is an in-kernel implementation of default | ||
58 | policy of reacting to rfkill-related input events and neither mandatory nor | ||
59 | required for wireless drivers to operate. It is enabled by the | ||
60 | CONFIG_RFKILL_INPUT Kconfig option. | ||
61 | |||
62 | rfkill-input is a rfkill-related events input layer handler. This handler will | ||
63 | listen to all rfkill key events and will change the rfkill state of the | ||
64 | wireless devices accordingly. With this option enabled userspace could either | ||
65 | do nothing or simply perform monitoring tasks. | ||
66 | |||
67 | The rfkill-input module also provides EPO (emergency power-off) functionality | ||
68 | for all wireless transmitters. This function cannot be overridden, and it is | ||
69 | always active. rfkill EPO is related to *_RFKILL_ALL input layer events. | ||
70 | |||
71 | |||
72 | Important terms for the rfkill subsystem: | ||
73 | |||
74 | In order to avoid confusion, we avoid the term "switch" in rfkill when it is | ||
75 | referring to an electronic control circuit that enables or disables a | ||
76 | transmitter. We reserve it for the physical device a human manipulates | ||
77 | (which is an input device, by the way): | ||
78 | |||
79 | rfkill switch: | ||
80 | |||
81 | A physical device a human manipulates. Its state can be perceived by | ||
82 | the kernel either directly (through a GPIO pin, ACPI GPE) or by its | ||
83 | effect on a rfkill line of a wireless device. | ||
84 | |||
85 | rfkill controller: | ||
86 | |||
87 | A hardware circuit that controls the state of a rfkill line, which a | ||
88 | kernel driver can interact with *to modify* that state (i.e. it has | ||
89 | either write-only or read/write access). | ||
90 | |||
91 | rfkill line: | ||
92 | |||
93 | An input channel (hardware or software) of a wireless device, which | ||
94 | causes a wireless transmitter to stop emitting energy (BLOCK) when it | ||
95 | is active. Point of view is extremely important here: rfkill lines are | ||
96 | always seen from the PoV of a wireless device (and its driver). | ||
97 | |||
98 | soft rfkill line/software rfkill line: | ||
99 | |||
100 | A rfkill line the wireless device driver can directly change the state | ||
101 | of. Related to rfkill_state RFKILL_STATE_SOFT_BLOCKED. | ||
102 | |||
103 | hard rfkill line/hardware rfkill line: | ||
104 | |||
105 | A rfkill line that works fully in hardware or firmware, and that cannot | ||
106 | be overridden by the kernel driver. The hardware device or the | ||
107 | firmware just exports its status to the driver, but it is read-only. | ||
108 | Related to rfkill_state RFKILL_STATE_HARD_BLOCKED. | ||
109 | |||
110 | The enum rfkill_state describes the rfkill state of a transmitter: | ||
111 | |||
112 | When a rfkill line or rfkill controller is in the RFKILL_STATE_UNBLOCKED state, | ||
113 | the wireless transmitter (radio TX circuit for example) is *enabled*. When the | ||
114 | it is in the RFKILL_STATE_SOFT_BLOCKED or RFKILL_STATE_HARD_BLOCKED, the | ||
115 | wireless transmitter is to be *blocked* from operating. | ||
116 | |||
117 | RFKILL_STATE_SOFT_BLOCKED indicates that a call to toggle_radio() can change | ||
118 | that state. RFKILL_STATE_HARD_BLOCKED indicates that a call to toggle_radio() | ||
119 | will not be able to change the state and will return with a suitable error if | ||
120 | attempts are made to set the state to RFKILL_STATE_UNBLOCKED. | ||
121 | |||
122 | RFKILL_STATE_HARD_BLOCKED is used by drivers to signal that the device is | ||
123 | locked in the BLOCKED state by a hardwire rfkill line (typically an input pin | ||
124 | that, when active, forces the transmitter to be disabled) which the driver | ||
125 | CANNOT override. | ||
126 | |||
127 | Full rfkill functionality requires two different subsystems to cooperate: the | ||
128 | input layer and the rfkill class. The input layer issues *commands* to the | ||
129 | entire system requesting that devices registered to the rfkill class change | ||
130 | state. The way this interaction happens is not complex, but it is not obvious | ||
131 | either: | ||
132 | |||
133 | Kernel Input layer: | ||
134 | |||
135 | * Generates KEY_WWAN, KEY_WLAN, KEY_BLUETOOTH, SW_RFKILL_ALL, and | ||
136 | other such events when the user presses certain keys, buttons, or | ||
137 | toggles certain physical switches. | ||
26 | 138 | ||
27 | The system inside the kernel has been split into 2 separate sections: | 139 | THE INPUT LAYER IS NEVER USED TO PROPAGATE STATUS, NOTIFICATIONS OR THE |
28 | 1 - RFKILL | 140 | KIND OF STUFF AN ON-SCREEN-DISPLAY APPLICATION WOULD REPORT. It is |
29 | 2 - RFKILL_INPUT | 141 | used to issue *commands* for the system to change behaviour, and these |
142 | commands may or may not be carried out by some kernel driver or | ||
143 | userspace application. It follows that doing user feedback based only | ||
144 | on input events is broken, as there is no guarantee that an input event | ||
145 | will be acted upon. | ||
30 | 146 | ||
31 | The first option enables rfkill support and will make sure userspace will | 147 | Most wireless communication device drivers implementing rfkill |
32 | be notified of any events through the input device. It also creates several | 148 | functionality MUST NOT generate these events, and have no reason to |
33 | sysfs entries which can be used by userspace. See section "Userspace support". | 149 | register themselves with the input layer. Doing otherwise is a common |
150 | misconception. There is an API to propagate rfkill status change | ||
151 | information, and it is NOT the input layer. | ||
34 | 152 | ||
35 | The second option provides an rfkill input handler. This handler will | 153 | rfkill class: |
36 | listen to all rfkill key events and will toggle the radio accordingly. | ||
37 | With this option enabled userspace could either do nothing or simply | ||
38 | perform monitoring tasks. | ||
39 | 154 | ||
155 | * Calls a hook in a driver to effectively change the wireless | ||
156 | transmitter state; | ||
157 | * Keeps track of the wireless transmitter state (with help from | ||
158 | the driver); | ||
159 | * Generates userspace notifications (uevents) and a call to a | ||
160 | notification chain (kernel) when there is a wireless transmitter | ||
161 | state change; | ||
162 | * Connects a wireless communications driver with the common rfkill | ||
163 | control system, which, for example, allows actions such as | ||
164 | "switch all bluetooth devices offline" to be carried out by | ||
165 | userspace or by rfkill-input. | ||
166 | |||
167 | THE RFKILL CLASS NEVER ISSUES INPUT EVENTS. THE RFKILL CLASS DOES | ||
168 | NOT LISTEN TO INPUT EVENTS. NO DRIVER USING THE RFKILL CLASS SHALL | ||
169 | EVER LISTEN TO, OR ACT ON RFKILL INPUT EVENTS. Doing otherwise is | ||
170 | a layering violation. | ||
171 | |||
172 | Most wireless data communication drivers in the kernel have just to | ||
173 | implement the rfkill class API to work properly. Interfacing to the | ||
174 | input layer is not often required (and is very often a *bug*) on | ||
175 | wireless drivers. | ||
176 | |||
177 | Platform drivers often have to attach to the input layer to *issue* | ||
178 | (but never to listen to) rfkill events for rfkill switches, and also to | ||
179 | the rfkill class to export a control interface for the platform rfkill | ||
180 | controllers to the rfkill subsystem. This does NOT mean the rfkill | ||
181 | switch is attached to a rfkill class (doing so is almost always wrong). | ||
182 | It just means the same kernel module is the driver for different | ||
183 | devices (rfkill switches and rfkill controllers). | ||
184 | |||
185 | |||
186 | Userspace input handlers (uevents) or kernel input handlers (rfkill-input): | ||
187 | |||
188 | * Implements the policy of what should happen when one of the input | ||
189 | layer events related to rfkill operation is received. | ||
190 | * Uses the sysfs interface (userspace) or private rfkill API calls | ||
191 | to tell the devices registered with the rfkill class to change | ||
192 | their state (i.e. translates the input layer event into real | ||
193 | action). | ||
194 | * rfkill-input implements EPO by handling EV_SW SW_RFKILL_ALL 0 | ||
195 | (power off all transmitters) in a special way: it ignores any | ||
196 | overrides and local state cache and forces all transmitters to the | ||
197 | RFKILL_STATE_SOFT_BLOCKED state (including those which are already | ||
198 | supposed to be BLOCKED). Note that the opposite event (power on all | ||
199 | transmitters) is handled normally. | ||
200 | |||
201 | Userspace uevent handler or kernel platform-specific drivers hooked to the | ||
202 | rfkill notifier chain: | ||
203 | |||
204 | * Taps into the rfkill notifier chain or to KOBJ_CHANGE uevents, | ||
205 | in order to know when a device that is registered with the rfkill | ||
206 | class changes state; | ||
207 | * Issues feedback notifications to the user; | ||
208 | * In the rare platforms where this is required, synthesizes an input | ||
209 | event to command all *OTHER* rfkill devices to also change their | ||
210 | statues when a specific rfkill device changes state. | ||
211 | |||
212 | |||
213 | =============================================================================== | ||
214 | 3: Kernel driver guidelines | ||
215 | |||
216 | Remember: point-of-view is everything for a driver that connects to the rfkill | ||
217 | subsystem. All the details below must be measured/perceived from the point of | ||
218 | view of the specific driver being modified. | ||
219 | |||
220 | The first thing one needs to know is whether his driver should be talking to | ||
221 | the rfkill class or to the input layer. In rare cases (platform drivers), it | ||
222 | could happen that you need to do both, as platform drivers often handle a | ||
223 | variety of devices in the same driver. | ||
224 | |||
225 | Do not mistake input devices for rfkill controllers. The only type of "rfkill | ||
226 | switch" device that is to be registered with the rfkill class are those | ||
227 | directly controlling the circuits that cause a wireless transmitter to stop | ||
228 | working (or the software equivalent of them), i.e. what we call a rfkill | ||
229 | controller. Every other kind of "rfkill switch" is just an input device and | ||
230 | MUST NOT be registered with the rfkill class. | ||
231 | |||
232 | A driver should register a device with the rfkill class when ALL of the | ||
233 | following conditions are met (they define a rfkill controller): | ||
234 | |||
235 | 1. The device is/controls a data communications wireless transmitter; | ||
236 | |||
237 | 2. The kernel can interact with the hardware/firmware to CHANGE the wireless | ||
238 | transmitter state (block/unblock TX operation); | ||
239 | |||
240 | 3. The transmitter can be made to not emit any energy when "blocked": | ||
241 | rfkill is not about blocking data transmissions, it is about blocking | ||
242 | energy emission; | ||
243 | |||
244 | A driver should register a device with the input subsystem to issue | ||
245 | rfkill-related events (KEY_WLAN, KEY_BLUETOOTH, KEY_WWAN, KEY_WIMAX, | ||
246 | SW_RFKILL_ALL, etc) when ALL of the folowing conditions are met: | ||
247 | |||
248 | 1. It is directly related to some physical device the user interacts with, to | ||
249 | command the O.S./firmware/hardware to enable/disable a data communications | ||
250 | wireless transmitter. | ||
251 | |||
252 | Examples of the physical device are: buttons, keys and switches the user | ||
253 | will press/touch/slide/switch to enable or disable the wireless | ||
254 | communication device. | ||
255 | |||
256 | 2. It is NOT slaved to another device, i.e. there is no other device that | ||
257 | issues rfkill-related input events in preference to this one. | ||
258 | |||
259 | Please refer to the corner cases and examples section for more details. | ||
260 | |||
261 | When in doubt, do not issue input events. For drivers that should generate | ||
262 | input events in some platforms, but not in others (e.g. b43), the best solution | ||
263 | is to NEVER generate input events in the first place. That work should be | ||
264 | deferred to a platform-specific kernel module (which will know when to generate | ||
265 | events through the rfkill notifier chain) or to userspace. This avoids the | ||
266 | usual maintenance problems with DMI whitelisting. | ||
267 | |||
268 | |||
269 | Corner cases and examples: | ||
40 | ==================================== | 270 | ==================================== |
41 | 2: Driver support | ||
42 | 271 | ||
43 | To build a driver with rfkill subsystem support, the driver should | 272 | 1. If the device is an input device that, because of hardware or firmware, |
44 | depend on the Kconfig symbol RFKILL; it should _not_ depend on | 273 | causes wireless transmitters to be blocked regardless of the kernel's will, it |
45 | RKFILL_INPUT. | 274 | is still just an input device, and NOT to be registered with the rfkill class. |
46 | 275 | ||
47 | Unless key events trigger an interrupt to which the driver listens, polling | 276 | 2. If the wireless transmitter switch control is read-only, it is an input |
48 | will be required to determine the key state changes. For this the input | 277 | device and not to be registered with the rfkill class (and maybe not to be made |
49 | layer providers the input-polldev handler. | 278 | an input layer event source either, see below). |
50 | 279 | ||
51 | A driver should implement a few steps to correctly make use of the | 280 | 3. If there is some other device driver *closer* to the actual hardware the |
52 | rfkill subsystem. First for non-polling drivers: | 281 | user interacted with (the button/switch/key) to issue an input event, THAT is |
282 | the device driver that should be issuing input events. | ||
53 | 283 | ||
54 | - rfkill_allocate() | 284 | E.g: |
55 | - input_allocate_device() | 285 | [RFKILL slider switch] -- [GPIO hardware] -- [WLAN card rf-kill input] |
56 | - rfkill_register() | 286 | (platform driver) (wireless card driver) |
57 | - input_register_device() | 287 | |
288 | The user is closer to the RFKILL slide switch plaform driver, so the driver | ||
289 | which must issue input events is the platform driver looking at the GPIO | ||
290 | hardware, and NEVER the wireless card driver (which is just a slave). It is | ||
291 | very likely that there are other leaves than just the WLAN card rf-kill input | ||
292 | (e.g. a bluetooth card, etc)... | ||
293 | |||
294 | On the other hand, some embedded devices do this: | ||
295 | |||
296 | [RFKILL slider switch] -- [WLAN card rf-kill input] | ||
297 | (wireless card driver) | ||
58 | 298 | ||
59 | For polling drivers: | 299 | In this situation, the wireless card driver *could* register itself as an input |
300 | device and issue rf-kill related input events... but in order to AVOID the need | ||
301 | for DMI whitelisting, the wireless card driver does NOT do it. Userspace (HAL) | ||
302 | or a platform driver (that exists only on these embedded devices) will do the | ||
303 | dirty job of issuing the input events. | ||
60 | 304 | ||
305 | |||
306 | COMMON MISTAKES in kernel drivers, related to rfkill: | ||
307 | ==================================== | ||
308 | |||
309 | 1. NEVER confuse input device keys and buttons with input device switches. | ||
310 | |||
311 | 1a. Switches are always set or reset. They report the current state | ||
312 | (on position or off position). | ||
313 | |||
314 | 1b. Keys and buttons are either in the pressed or not-pressed state, and | ||
315 | that's it. A "button" that latches down when you press it, and | ||
316 | unlatches when you press it again is in fact a switch as far as input | ||
317 | devices go. | ||
318 | |||
319 | Add the SW_* events you need for switches, do NOT try to emulate a button using | ||
320 | KEY_* events just because there is no such SW_* event yet. Do NOT try to use, | ||
321 | for example, KEY_BLUETOOTH when you should be using SW_BLUETOOTH instead. | ||
322 | |||
323 | 2. Input device switches (sources of EV_SW events) DO store their current state | ||
324 | (so you *must* initialize it by issuing a gratuitous input layer event on | ||
325 | driver start-up and also when resuming from sleep), and that state CAN be | ||
326 | queried from userspace through IOCTLs. There is no sysfs interface for this, | ||
327 | but that doesn't mean you should break things trying to hook it to the rfkill | ||
328 | class to get a sysfs interface :-) | ||
329 | |||
330 | 3. Do not issue *_RFKILL_ALL events by default, unless you are sure it is the | ||
331 | correct event for your switch/button. These events are emergency power-off | ||
332 | events when they are trying to turn the transmitters off. An example of an | ||
333 | input device which SHOULD generate *_RFKILL_ALL events is the wireless-kill | ||
334 | switch in a laptop which is NOT a hotkey, but a real switch that kills radios | ||
335 | in hardware, even if the O.S. has gone to lunch. An example of an input device | ||
336 | which SHOULD NOT generate *_RFKILL_ALL events by default, is any sort of hot | ||
337 | key that does nothing by itself, as well as any hot key that is type-specific | ||
338 | (e.g. the one for WLAN). | ||
339 | |||
340 | |||
341 | 3.1 Guidelines for wireless device drivers | ||
342 | ------------------------------------------ | ||
343 | |||
344 | (in this text, rfkill->foo means the foo field of struct rfkill). | ||
345 | |||
346 | 1. Each independent transmitter in a wireless device (usually there is only one | ||
347 | transmitter per device) should have a SINGLE rfkill class attached to it. | ||
348 | |||
349 | 2. If the device does not have any sort of hardware assistance to allow the | ||
350 | driver to rfkill the device, the driver should emulate it by taking all actions | ||
351 | required to silence the transmitter. | ||
352 | |||
353 | 3. If it is impossible to silence the transmitter (i.e. it still emits energy, | ||
354 | even if it is just in brief pulses, when there is no data to transmit and there | ||
355 | is no hardware support to turn it off) do NOT lie to the users. Do not attach | ||
356 | it to a rfkill class. The rfkill subsystem does not deal with data | ||
357 | transmission, it deals with energy emission. If the transmitter is emitting | ||
358 | energy, it is not blocked in rfkill terms. | ||
359 | |||
360 | 4. It doesn't matter if the device has multiple rfkill input lines affecting | ||
361 | the same transmitter, their combined state is to be exported as a single state | ||
362 | per transmitter (see rule 1). | ||
363 | |||
364 | This rule exists because users of the rfkill subsystem expect to get (and set, | ||
365 | when possible) the overall transmitter rfkill state, not of a particular rfkill | ||
366 | line. | ||
367 | |||
368 | 5. The wireless device driver MUST NOT leave the transmitter enabled during | ||
369 | suspend and hibernation unless: | ||
370 | |||
371 | 5.1. The transmitter has to be enabled for some sort of functionality | ||
372 | like wake-on-wireless-packet or autonomous packed forwarding in a mesh | ||
373 | network, and that functionality is enabled for this suspend/hibernation | ||
374 | cycle. | ||
375 | |||
376 | AND | ||
377 | |||
378 | 5.2. The device was not on a user-requested BLOCKED state before | ||
379 | the suspend (i.e. the driver must NOT unblock a device, not even | ||
380 | to support wake-on-wireless-packet or remain in the mesh). | ||
381 | |||
382 | In other words, there is absolutely no allowed scenario where a driver can | ||
383 | automatically take action to unblock a rfkill controller (obviously, this deals | ||
384 | with scenarios where soft-blocking or both soft and hard blocking is happening. | ||
385 | Scenarios where hardware rfkill lines are the only ones blocking the | ||
386 | transmitter are outside of this rule, since the wireless device driver does not | ||
387 | control its input hardware rfkill lines in the first place). | ||
388 | |||
389 | 6. During resume, rfkill will try to restore its previous state. | ||
390 | |||
391 | 7. After a rfkill class is suspended, it will *not* call rfkill->toggle_radio | ||
392 | until it is resumed. | ||
393 | |||
394 | |||
395 | Example of a WLAN wireless driver connected to the rfkill subsystem: | ||
396 | -------------------------------------------------------------------- | ||
397 | |||
398 | A certain WLAN card has one input pin that causes it to block the transmitter | ||
399 | and makes the status of that input pin available (only for reading!) to the | ||
400 | kernel driver. This is a hard rfkill input line (it cannot be overridden by | ||
401 | the kernel driver). | ||
402 | |||
403 | The card also has one PCI register that, if manipulated by the driver, causes | ||
404 | it to block the transmitter. This is a soft rfkill input line. | ||
405 | |||
406 | It has also a thermal protection circuitry that shuts down its transmitter if | ||
407 | the card overheats, and makes the status of that protection available (only for | ||
408 | reading!) to the kernel driver. This is also a hard rfkill input line. | ||
409 | |||
410 | If either one of these rfkill lines are active, the transmitter is blocked by | ||
411 | the hardware and forced offline. | ||
412 | |||
413 | The driver should allocate and attach to its struct device *ONE* instance of | ||
414 | the rfkill class (there is only one transmitter). | ||
415 | |||
416 | It can implement the get_state() hook, and return RFKILL_STATE_HARD_BLOCKED if | ||
417 | either one of its two hard rfkill input lines are active. If the two hard | ||
418 | rfkill lines are inactive, it must return RFKILL_STATE_SOFT_BLOCKED if its soft | ||
419 | rfkill input line is active. Only if none of the rfkill input lines are | ||
420 | active, will it return RFKILL_STATE_UNBLOCKED. | ||
421 | |||
422 | Since the device has a hardware rfkill line, it IS subject to state changes | ||
423 | external to rfkill. Therefore, the driver must make sure that it calls | ||
424 | rfkill_force_state() to keep the status always up-to-date, and it must do a | ||
425 | rfkill_force_state() on resume from sleep. | ||
426 | |||
427 | Every time the driver gets a notification from the card that one of its rfkill | ||
428 | lines changed state (polling might be needed on badly designed cards that don't | ||
429 | generate interrupts for such events), it recomputes the rfkill state as per | ||
430 | above, and calls rfkill_force_state() to update it. | ||
431 | |||
432 | The driver should implement the toggle_radio() hook, that: | ||
433 | |||
434 | 1. Returns an error if one of the hardware rfkill lines are active, and the | ||
435 | caller asked for RFKILL_STATE_UNBLOCKED. | ||
436 | |||
437 | 2. Activates the soft rfkill line if the caller asked for state | ||
438 | RFKILL_STATE_SOFT_BLOCKED. It should do this even if one of the hard rfkill | ||
439 | lines are active, effectively double-blocking the transmitter. | ||
440 | |||
441 | 3. Deactivates the soft rfkill line if none of the hardware rfkill lines are | ||
442 | active and the caller asked for RFKILL_STATE_UNBLOCKED. | ||
443 | |||
444 | =============================================================================== | ||
445 | 4: Kernel API | ||
446 | |||
447 | To build a driver with rfkill subsystem support, the driver should depend on | ||
448 | (or select) the Kconfig symbol RFKILL; it should _not_ depend on RKFILL_INPUT. | ||
449 | |||
450 | The hardware the driver talks to may be write-only (where the current state | ||
451 | of the hardware is unknown), or read-write (where the hardware can be queried | ||
452 | about its current state). | ||
453 | |||
454 | The rfkill class will call the get_state hook of a device every time it needs | ||
455 | to know the *real* current state of the hardware. This can happen often, but | ||
456 | it does not do any polling, so it is not enough on hardware that is subject | ||
457 | to state changes outside of the rfkill subsystem. | ||
458 | |||
459 | Therefore, calling rfkill_force_state() when a state change happens is | ||
460 | mandatory when the device has a hardware rfkill line, or when something else | ||
461 | like the firmware could cause its state to be changed without going through the | ||
462 | rfkill class. | ||
463 | |||
464 | Some hardware provides events when its status changes. In these cases, it is | ||
465 | best for the driver to not provide a get_state hook, and instead register the | ||
466 | rfkill class *already* with the correct status, and keep it updated using | ||
467 | rfkill_force_state() when it gets an event from the hardware. | ||
468 | |||
469 | rfkill_force_state() must be used on the device resume handlers to update the | ||
470 | rfkill status, should there be any chance of the device status changing during | ||
471 | the sleep. | ||
472 | |||
473 | There is no provision for a statically-allocated rfkill struct. You must | ||
474 | use rfkill_allocate() to allocate one. | ||
475 | |||
476 | You should: | ||
61 | - rfkill_allocate() | 477 | - rfkill_allocate() |
62 | - input_allocate_polled_device() | 478 | - modify rfkill fields (flags, name) |
479 | - modify state to the current hardware state (THIS IS THE ONLY TIME | ||
480 | YOU CAN ACCESS state DIRECTLY) | ||
63 | - rfkill_register() | 481 | - rfkill_register() |
64 | - input_register_polled_device() | ||
65 | 482 | ||
66 | When a key event has been detected, the correct event should be | 483 | The only way to set a device to the RFKILL_STATE_HARD_BLOCKED state is through |
67 | sent over the input device which has been registered by the driver. | 484 | a suitable return of get_state() or through rfkill_force_state(). |
68 | 485 | ||
69 | ==================================== | 486 | When a device is in the RFKILL_STATE_HARD_BLOCKED state, the only way to switch |
70 | 3: Userspace support | 487 | it to a different state is through a suitable return of get_state() or through |
488 | rfkill_force_state(). | ||
71 | 489 | ||
72 | For each key an input device will be created which will send out the correct | 490 | If toggle_radio() is called to set a device to state RFKILL_STATE_SOFT_BLOCKED |
73 | key event when the rfkill key has been pressed. | 491 | when that device is already at the RFKILL_STATE_HARD_BLOCKED state, it should |
492 | not return an error. Instead, it should try to double-block the transmitter, | ||
493 | so that its state will change from RFKILL_STATE_HARD_BLOCKED to | ||
494 | RFKILL_STATE_SOFT_BLOCKED should the hardware blocking cease. | ||
495 | |||
496 | Please refer to the source for more documentation. | ||
497 | |||
498 | =============================================================================== | ||
499 | 5: Userspace support | ||
500 | |||
501 | rfkill devices issue uevents (with an action of "change"), with the following | ||
502 | environment variables set: | ||
503 | |||
504 | RFKILL_NAME | ||
505 | RFKILL_STATE | ||
506 | RFKILL_TYPE | ||
507 | |||
508 | The ABI for these variables is defined by the sysfs attributes. It is best | ||
509 | to take a quick look at the source to make sure of the possible values. | ||
510 | |||
511 | It is expected that HAL will trap those, and bridge them to DBUS, etc. These | ||
512 | events CAN and SHOULD be used to give feedback to the user about the rfkill | ||
513 | status of the system. | ||
514 | |||
515 | Input devices may issue events that are related to rfkill. These are the | ||
516 | various KEY_* events and SW_* events supported by rfkill-input.c. | ||
517 | |||
518 | ******IMPORTANT****** | ||
519 | When rfkill-input is ACTIVE, userspace is NOT TO CHANGE THE STATE OF AN RFKILL | ||
520 | SWITCH IN RESPONSE TO AN INPUT EVENT also handled by rfkill-input, unless it | ||
521 | has set to true the user_claim attribute for that particular switch. This rule | ||
522 | is *absolute*; do NOT violate it. | ||
523 | ******IMPORTANT****** | ||
524 | |||
525 | Userspace must not assume it is the only source of control for rfkill switches. | ||
526 | Their state CAN and WILL change due to firmware actions, direct user actions, | ||
527 | and the rfkill-input EPO override for *_RFKILL_ALL. | ||
528 | |||
529 | When rfkill-input is not active, userspace must initiate a rfkill status | ||
530 | change by writing to the "state" attribute in order for anything to happen. | ||
531 | |||
532 | Take particular care to implement EV_SW SW_RFKILL_ALL properly. When that | ||
533 | switch is set to OFF, *every* rfkill device *MUST* be immediately put into the | ||
534 | RFKILL_STATE_SOFT_BLOCKED state, no questions asked. | ||
74 | 535 | ||
75 | The following sysfs entries will be created: | 536 | The following sysfs entries will be created: |
76 | 537 | ||
77 | name: Name assigned by driver to this key (interface or driver name). | 538 | name: Name assigned by driver to this key (interface or driver name). |
78 | type: Name of the key type ("wlan", "bluetooth", etc). | 539 | type: Name of the key type ("wlan", "bluetooth", etc). |
79 | state: Current state of the key. 1: On, 0: Off. | 540 | state: Current state of the transmitter |
541 | 0: RFKILL_STATE_SOFT_BLOCKED | ||
542 | transmitter is forced off, but one can override it | ||
543 | by a write to the state attribute; | ||
544 | 1: RFKILL_STATE_UNBLOCKED | ||
545 | transmiter is NOT forced off, and may operate if | ||
546 | all other conditions for such operation are met | ||
547 | (such as interface is up and configured, etc); | ||
548 | 2: RFKILL_STATE_HARD_BLOCKED | ||
549 | transmitter is forced off by something outside of | ||
550 | the driver's control. One cannot set a device to | ||
551 | this state through writes to the state attribute; | ||
80 | claim: 1: Userspace handles events, 0: Kernel handles events | 552 | claim: 1: Userspace handles events, 0: Kernel handles events |
81 | 553 | ||
82 | Both the "state" and "claim" entries are also writable. For the "state" entry | 554 | Both the "state" and "claim" entries are also writable. For the "state" entry |
83 | this means that when 1 or 0 is written all radios, not yet in the requested | 555 | this means that when 1 or 0 is written, the device rfkill state (if not yet in |
84 | state, will be will be toggled accordingly. | 556 | the requested state), will be will be toggled accordingly. |
557 | |||
85 | For the "claim" entry writing 1 to it means that the kernel no longer handles | 558 | For the "claim" entry writing 1 to it means that the kernel no longer handles |
86 | key events even though RFKILL_INPUT input was enabled. When "claim" has been | 559 | key events even though RFKILL_INPUT input was enabled. When "claim" has been |
87 | set to 0, userspace should make sure that it listens for the input events or | 560 | set to 0, userspace should make sure that it listens for the input events or |
88 | check the sysfs "state" entry regularly to correctly perform the required | 561 | check the sysfs "state" entry regularly to correctly perform the required tasks |
89 | tasks when the rkfill key is pressed. | 562 | when the rkfill key is pressed. |
563 | |||
564 | A note about input devices and EV_SW events: | ||
565 | |||
566 | In order to know the current state of an input device switch (like | ||
567 | SW_RFKILL_ALL), you will need to use an IOCTL. That information is not | ||
568 | available through sysfs in a generic way at this time, and it is not available | ||
569 | through the rfkill class AT ALL. | ||
diff --git a/Documentation/s390/CommonIO b/Documentation/s390/CommonIO index bf0baa19ec24..339207d11d95 100644 --- a/Documentation/s390/CommonIO +++ b/Documentation/s390/CommonIO | |||
@@ -70,13 +70,19 @@ Command line parameters | |||
70 | 70 | ||
71 | Note: While already known devices can be added to the list of devices to be | 71 | Note: While already known devices can be added to the list of devices to be |
72 | ignored, there will be no effect on then. However, if such a device | 72 | ignored, there will be no effect on then. However, if such a device |
73 | disappears and then reappears, it will then be ignored. | 73 | disappears and then reappears, it will then be ignored. To make |
74 | known devices go away, you need the "purge" command (see below). | ||
74 | 75 | ||
75 | For example, | 76 | For example, |
76 | "echo add 0.0.a000-0.0.accc, 0.0.af00-0.0.afff > /proc/cio_ignore" | 77 | "echo add 0.0.a000-0.0.accc, 0.0.af00-0.0.afff > /proc/cio_ignore" |
77 | will add 0.0.a000-0.0.accc and 0.0.af00-0.0.afff to the list of ignored | 78 | will add 0.0.a000-0.0.accc and 0.0.af00-0.0.afff to the list of ignored |
78 | devices. | 79 | devices. |
79 | 80 | ||
81 | You can remove already known but now ignored devices via | ||
82 | "echo purge > /proc/cio_ignore" | ||
83 | All devices ignored but still registered and not online (= not in use) | ||
84 | will be deregistered and thus removed from the system. | ||
85 | |||
80 | The devices can be specified either by bus id (0.x.abcd) or, for 2.4 backward | 86 | The devices can be specified either by bus id (0.x.abcd) or, for 2.4 backward |
81 | compatibility, by the device number in hexadecimal (0xabcd or abcd). Device | 87 | compatibility, by the device number in hexadecimal (0xabcd or abcd). Device |
82 | numbers given as 0xabcd will be interpreted as 0.0.abcd. | 88 | numbers given as 0xabcd will be interpreted as 0.0.abcd. |
@@ -98,8 +104,7 @@ debugfs entries | |||
98 | handling). | 104 | handling). |
99 | 105 | ||
100 | - /sys/kernel/debug/s390dbf/cio_msg/sprintf | 106 | - /sys/kernel/debug/s390dbf/cio_msg/sprintf |
101 | Various debug messages from the common I/O-layer, including messages | 107 | Various debug messages from the common I/O-layer. |
102 | printed when cio_msg=yes. | ||
103 | 108 | ||
104 | - /sys/kernel/debug/s390dbf/cio_trace/hex_ascii | 109 | - /sys/kernel/debug/s390dbf/cio_trace/hex_ascii |
105 | Logs the calling of functions in the common I/O-layer and, if applicable, | 110 | Logs the calling of functions in the common I/O-layer and, if applicable, |
diff --git a/Documentation/s390/driver-model.txt b/Documentation/s390/driver-model.txt index e938c442277d..bde473df748d 100644 --- a/Documentation/s390/driver-model.txt +++ b/Documentation/s390/driver-model.txt | |||
@@ -25,7 +25,7 @@ device 4711 via subchannel 1 in subchannel set 0, and subchannel 2 is a non-I/O | |||
25 | subchannel. Device 1234 is accessed via subchannel 0 in subchannel set 1. | 25 | subchannel. Device 1234 is accessed via subchannel 0 in subchannel set 1. |
26 | 26 | ||
27 | The subchannel named 'defunct' does not represent any real subchannel on the | 27 | The subchannel named 'defunct' does not represent any real subchannel on the |
28 | system; it is a pseudo subchannel where disconnnected ccw devices are moved to | 28 | system; it is a pseudo subchannel where disconnected ccw devices are moved to |
29 | if they are displaced by another ccw device becoming operational on their | 29 | if they are displaced by another ccw device becoming operational on their |
30 | former subchannel. The ccw devices will be moved again to a proper subchannel | 30 | former subchannel. The ccw devices will be moved again to a proper subchannel |
31 | if they become operational again on that subchannel. | 31 | if they become operational again on that subchannel. |
diff --git a/Documentation/scheduler/sched-design-CFS.txt b/Documentation/scheduler/sched-design-CFS.txt index 88bcb8767335..9d8eb553884c 100644 --- a/Documentation/scheduler/sched-design-CFS.txt +++ b/Documentation/scheduler/sched-design-CFS.txt | |||
@@ -1,151 +1,242 @@ | |||
1 | ============= | ||
2 | CFS Scheduler | ||
3 | ============= | ||
1 | 4 | ||
2 | This is the CFS scheduler. | ||
3 | |||
4 | 80% of CFS's design can be summed up in a single sentence: CFS basically | ||
5 | models an "ideal, precise multi-tasking CPU" on real hardware. | ||
6 | |||
7 | "Ideal multi-tasking CPU" is a (non-existent :-)) CPU that has 100% | ||
8 | physical power and which can run each task at precise equal speed, in | ||
9 | parallel, each at 1/nr_running speed. For example: if there are 2 tasks | ||
10 | running then it runs each at 50% physical power - totally in parallel. | ||
11 | |||
12 | On real hardware, we can run only a single task at once, so while that | ||
13 | one task runs, the other tasks that are waiting for the CPU are at a | ||
14 | disadvantage - the current task gets an unfair amount of CPU time. In | ||
15 | CFS this fairness imbalance is expressed and tracked via the per-task | ||
16 | p->wait_runtime (nanosec-unit) value. "wait_runtime" is the amount of | ||
17 | time the task should now run on the CPU for it to become completely fair | ||
18 | and balanced. | ||
19 | |||
20 | ( small detail: on 'ideal' hardware, the p->wait_runtime value would | ||
21 | always be zero - no task would ever get 'out of balance' from the | ||
22 | 'ideal' share of CPU time. ) | ||
23 | |||
24 | CFS's task picking logic is based on this p->wait_runtime value and it | ||
25 | is thus very simple: it always tries to run the task with the largest | ||
26 | p->wait_runtime value. In other words, CFS tries to run the task with | ||
27 | the 'gravest need' for more CPU time. So CFS always tries to split up | ||
28 | CPU time between runnable tasks as close to 'ideal multitasking | ||
29 | hardware' as possible. | ||
30 | |||
31 | Most of the rest of CFS's design just falls out of this really simple | ||
32 | concept, with a few add-on embellishments like nice levels, | ||
33 | multiprocessing and various algorithm variants to recognize sleepers. | ||
34 | |||
35 | In practice it works like this: the system runs a task a bit, and when | ||
36 | the task schedules (or a scheduler tick happens) the task's CPU usage is | ||
37 | 'accounted for': the (small) time it just spent using the physical CPU | ||
38 | is deducted from p->wait_runtime. [minus the 'fair share' it would have | ||
39 | gotten anyway]. Once p->wait_runtime gets low enough so that another | ||
40 | task becomes the 'leftmost task' of the time-ordered rbtree it maintains | ||
41 | (plus a small amount of 'granularity' distance relative to the leftmost | ||
42 | task so that we do not over-schedule tasks and trash the cache) then the | ||
43 | new leftmost task is picked and the current task is preempted. | ||
44 | |||
45 | The rq->fair_clock value tracks the 'CPU time a runnable task would have | ||
46 | fairly gotten, had it been runnable during that time'. So by using | ||
47 | rq->fair_clock values we can accurately timestamp and measure the | ||
48 | 'expected CPU time' a task should have gotten. All runnable tasks are | ||
49 | sorted in the rbtree by the "rq->fair_clock - p->wait_runtime" key, and | ||
50 | CFS picks the 'leftmost' task and sticks to it. As the system progresses | ||
51 | forwards, newly woken tasks are put into the tree more and more to the | ||
52 | right - slowly but surely giving a chance for every task to become the | ||
53 | 'leftmost task' and thus get on the CPU within a deterministic amount of | ||
54 | time. | ||
55 | |||
56 | Some implementation details: | ||
57 | |||
58 | - the introduction of Scheduling Classes: an extensible hierarchy of | ||
59 | scheduler modules. These modules encapsulate scheduling policy | ||
60 | details and are handled by the scheduler core without the core | ||
61 | code assuming about them too much. | ||
62 | |||
63 | - sched_fair.c implements the 'CFS desktop scheduler': it is a | ||
64 | replacement for the vanilla scheduler's SCHED_OTHER interactivity | ||
65 | code. | ||
66 | |||
67 | I'd like to give credit to Con Kolivas for the general approach here: | ||
68 | he has proven via RSDL/SD that 'fair scheduling' is possible and that | ||
69 | it results in better desktop scheduling. Kudos Con! | ||
70 | |||
71 | The CFS patch uses a completely different approach and implementation | ||
72 | from RSDL/SD. My goal was to make CFS's interactivity quality exceed | ||
73 | that of RSDL/SD, which is a high standard to meet :-) Testing | ||
74 | feedback is welcome to decide this one way or another. [ and, in any | ||
75 | case, all of SD's logic could be added via a kernel/sched_sd.c module | ||
76 | as well, if Con is interested in such an approach. ] | ||
77 | |||
78 | CFS's design is quite radical: it does not use runqueues, it uses a | ||
79 | time-ordered rbtree to build a 'timeline' of future task execution, | ||
80 | and thus has no 'array switch' artifacts (by which both the vanilla | ||
81 | scheduler and RSDL/SD are affected). | ||
82 | |||
83 | CFS uses nanosecond granularity accounting and does not rely on any | ||
84 | jiffies or other HZ detail. Thus the CFS scheduler has no notion of | ||
85 | 'timeslices' and has no heuristics whatsoever. There is only one | ||
86 | central tunable (you have to switch on CONFIG_SCHED_DEBUG): | ||
87 | |||
88 | /proc/sys/kernel/sched_granularity_ns | ||
89 | |||
90 | which can be used to tune the scheduler from 'desktop' (low | ||
91 | latencies) to 'server' (good batching) workloads. It defaults to a | ||
92 | setting suitable for desktop workloads. SCHED_BATCH is handled by the | ||
93 | CFS scheduler module too. | ||
94 | |||
95 | Due to its design, the CFS scheduler is not prone to any of the | ||
96 | 'attacks' that exist today against the heuristics of the stock | ||
97 | scheduler: fiftyp.c, thud.c, chew.c, ring-test.c, massive_intr.c all | ||
98 | work fine and do not impact interactivity and produce the expected | ||
99 | behavior. | ||
100 | |||
101 | the CFS scheduler has a much stronger handling of nice levels and | ||
102 | SCHED_BATCH: both types of workloads should be isolated much more | ||
103 | agressively than under the vanilla scheduler. | ||
104 | |||
105 | ( another detail: due to nanosec accounting and timeline sorting, | ||
106 | sched_yield() support is very simple under CFS, and in fact under | ||
107 | CFS sched_yield() behaves much better than under any other | ||
108 | scheduler i have tested so far. ) | ||
109 | |||
110 | - sched_rt.c implements SCHED_FIFO and SCHED_RR semantics, in a simpler | ||
111 | way than the vanilla scheduler does. It uses 100 runqueues (for all | ||
112 | 100 RT priority levels, instead of 140 in the vanilla scheduler) | ||
113 | and it needs no expired array. | ||
114 | |||
115 | - reworked/sanitized SMP load-balancing: the runqueue-walking | ||
116 | assumptions are gone from the load-balancing code now, and | ||
117 | iterators of the scheduling modules are used. The balancing code got | ||
118 | quite a bit simpler as a result. | ||
119 | |||
120 | |||
121 | Group scheduler extension to CFS | ||
122 | ================================ | ||
123 | |||
124 | Normally the scheduler operates on individual tasks and strives to provide | ||
125 | fair CPU time to each task. Sometimes, it may be desirable to group tasks | ||
126 | and provide fair CPU time to each such task group. For example, it may | ||
127 | be desirable to first provide fair CPU time to each user on the system | ||
128 | and then to each task belonging to a user. | ||
129 | |||
130 | CONFIG_FAIR_GROUP_SCHED strives to achieve exactly that. It lets | ||
131 | SCHED_NORMAL/BATCH tasks be be grouped and divides CPU time fairly among such | ||
132 | groups. At present, there are two (mutually exclusive) mechanisms to group | ||
133 | tasks for CPU bandwidth control purpose: | ||
134 | |||
135 | - Based on user id (CONFIG_FAIR_USER_SCHED) | ||
136 | In this option, tasks are grouped according to their user id. | ||
137 | - Based on "cgroup" pseudo filesystem (CONFIG_FAIR_CGROUP_SCHED) | ||
138 | This options lets the administrator create arbitrary groups | ||
139 | of tasks, using the "cgroup" pseudo filesystem. See | ||
140 | Documentation/cgroups.txt for more information about this | ||
141 | filesystem. | ||
142 | 5 | ||
143 | Only one of these options to group tasks can be chosen and not both. | 6 | 1. OVERVIEW |
7 | |||
8 | CFS stands for "Completely Fair Scheduler," and is the new "desktop" process | ||
9 | scheduler implemented by Ingo Molnar and merged in Linux 2.6.23. It is the | ||
10 | replacement for the previous vanilla scheduler's SCHED_OTHER interactivity | ||
11 | code. | ||
12 | |||
13 | 80% of CFS's design can be summed up in a single sentence: CFS basically models | ||
14 | an "ideal, precise multi-tasking CPU" on real hardware. | ||
15 | |||
16 | "Ideal multi-tasking CPU" is a (non-existent :-)) CPU that has 100% physical | ||
17 | power and which can run each task at precise equal speed, in parallel, each at | ||
18 | 1/nr_running speed. For example: if there are 2 tasks running, then it runs | ||
19 | each at 50% physical power --- i.e., actually in parallel. | ||
20 | |||
21 | On real hardware, we can run only a single task at once, so we have to | ||
22 | introduce the concept of "virtual runtime." The virtual runtime of a task | ||
23 | specifies when its next timeslice would start execution on the ideal | ||
24 | multi-tasking CPU described above. In practice, the virtual runtime of a task | ||
25 | is its actual runtime normalized to the total number of running tasks. | ||
26 | |||
27 | |||
28 | |||
29 | 2. FEW IMPLEMENTATION DETAILS | ||
30 | |||
31 | In CFS the virtual runtime is expressed and tracked via the per-task | ||
32 | p->se.vruntime (nanosec-unit) value. This way, it's possible to accurately | ||
33 | timestamp and measure the "expected CPU time" a task should have gotten. | ||
34 | |||
35 | [ small detail: on "ideal" hardware, at any time all tasks would have the same | ||
36 | p->se.vruntime value --- i.e., tasks would execute simultaneously and no task | ||
37 | would ever get "out of balance" from the "ideal" share of CPU time. ] | ||
38 | |||
39 | CFS's task picking logic is based on this p->se.vruntime value and it is thus | ||
40 | very simple: it always tries to run the task with the smallest p->se.vruntime | ||
41 | value (i.e., the task which executed least so far). CFS always tries to split | ||
42 | up CPU time between runnable tasks as close to "ideal multitasking hardware" as | ||
43 | possible. | ||
44 | |||
45 | Most of the rest of CFS's design just falls out of this really simple concept, | ||
46 | with a few add-on embellishments like nice levels, multiprocessing and various | ||
47 | algorithm variants to recognize sleepers. | ||
48 | |||
49 | |||
50 | |||
51 | 3. THE RBTREE | ||
52 | |||
53 | CFS's design is quite radical: it does not use the old data structures for the | ||
54 | runqueues, but it uses a time-ordered rbtree to build a "timeline" of future | ||
55 | task execution, and thus has no "array switch" artifacts (by which both the | ||
56 | previous vanilla scheduler and RSDL/SD are affected). | ||
57 | |||
58 | CFS also maintains the rq->cfs.min_vruntime value, which is a monotonic | ||
59 | increasing value tracking the smallest vruntime among all tasks in the | ||
60 | runqueue. The total amount of work done by the system is tracked using | ||
61 | min_vruntime; that value is used to place newly activated entities on the left | ||
62 | side of the tree as much as possible. | ||
63 | |||
64 | The total number of running tasks in the runqueue is accounted through the | ||
65 | rq->cfs.load value, which is the sum of the weights of the tasks queued on the | ||
66 | runqueue. | ||
67 | |||
68 | CFS maintains a time-ordered rbtree, where all runnable tasks are sorted by the | ||
69 | p->se.vruntime key (there is a subtraction using rq->cfs.min_vruntime to | ||
70 | account for possible wraparounds). CFS picks the "leftmost" task from this | ||
71 | tree and sticks to it. | ||
72 | As the system progresses forwards, the executed tasks are put into the tree | ||
73 | more and more to the right --- slowly but surely giving a chance for every task | ||
74 | to become the "leftmost task" and thus get on the CPU within a deterministic | ||
75 | amount of time. | ||
76 | |||
77 | Summing up, CFS works like this: it runs a task a bit, and when the task | ||
78 | schedules (or a scheduler tick happens) the task's CPU usage is "accounted | ||
79 | for": the (small) time it just spent using the physical CPU is added to | ||
80 | p->se.vruntime. Once p->se.vruntime gets high enough so that another task | ||
81 | becomes the "leftmost task" of the time-ordered rbtree it maintains (plus a | ||
82 | small amount of "granularity" distance relative to the leftmost task so that we | ||
83 | do not over-schedule tasks and trash the cache), then the new leftmost task is | ||
84 | picked and the current task is preempted. | ||
85 | |||
86 | |||
87 | |||
88 | 4. SOME FEATURES OF CFS | ||
89 | |||
90 | CFS uses nanosecond granularity accounting and does not rely on any jiffies or | ||
91 | other HZ detail. Thus the CFS scheduler has no notion of "timeslices" in the | ||
92 | way the previous scheduler had, and has no heuristics whatsoever. There is | ||
93 | only one central tunable (you have to switch on CONFIG_SCHED_DEBUG): | ||
94 | |||
95 | /proc/sys/kernel/sched_granularity_ns | ||
96 | |||
97 | which can be used to tune the scheduler from "desktop" (i.e., low latencies) to | ||
98 | "server" (i.e., good batching) workloads. It defaults to a setting suitable | ||
99 | for desktop workloads. SCHED_BATCH is handled by the CFS scheduler module too. | ||
100 | |||
101 | Due to its design, the CFS scheduler is not prone to any of the "attacks" that | ||
102 | exist today against the heuristics of the stock scheduler: fiftyp.c, thud.c, | ||
103 | chew.c, ring-test.c, massive_intr.c all work fine and do not impact | ||
104 | interactivity and produce the expected behavior. | ||
105 | |||
106 | The CFS scheduler has a much stronger handling of nice levels and SCHED_BATCH | ||
107 | than the previous vanilla scheduler: both types of workloads are isolated much | ||
108 | more aggressively. | ||
109 | |||
110 | SMP load-balancing has been reworked/sanitized: the runqueue-walking | ||
111 | assumptions are gone from the load-balancing code now, and iterators of the | ||
112 | scheduling modules are used. The balancing code got quite a bit simpler as a | ||
113 | result. | ||
114 | |||
115 | |||
116 | |||
117 | 5. Scheduling policies | ||
118 | |||
119 | CFS implements three scheduling policies: | ||
120 | |||
121 | - SCHED_NORMAL (traditionally called SCHED_OTHER): The scheduling | ||
122 | policy that is used for regular tasks. | ||
123 | |||
124 | - SCHED_BATCH: Does not preempt nearly as often as regular tasks | ||
125 | would, thereby allowing tasks to run longer and make better use of | ||
126 | caches but at the cost of interactivity. This is well suited for | ||
127 | batch jobs. | ||
128 | |||
129 | - SCHED_IDLE: This is even weaker than nice 19, but its not a true | ||
130 | idle timer scheduler in order to avoid to get into priority | ||
131 | inversion problems which would deadlock the machine. | ||
132 | |||
133 | SCHED_FIFO/_RR are implemented in sched_rt.c and are as specified by | ||
134 | POSIX. | ||
135 | |||
136 | The command chrt from util-linux-ng 2.13.1.1 can set all of these except | ||
137 | SCHED_IDLE. | ||
144 | 138 | ||
145 | Group scheduler tunables: | ||
146 | 139 | ||
147 | When CONFIG_FAIR_USER_SCHED is defined, a directory is created in sysfs for | 140 | |
148 | each new user and a "cpu_share" file is added in that directory. | 141 | 6. SCHEDULING CLASSES |
142 | |||
143 | The new CFS scheduler has been designed in such a way to introduce "Scheduling | ||
144 | Classes," an extensible hierarchy of scheduler modules. These modules | ||
145 | encapsulate scheduling policy details and are handled by the scheduler core | ||
146 | without the core code assuming too much about them. | ||
147 | |||
148 | sched_fair.c implements the CFS scheduler described above. | ||
149 | |||
150 | sched_rt.c implements SCHED_FIFO and SCHED_RR semantics, in a simpler way than | ||
151 | the previous vanilla scheduler did. It uses 100 runqueues (for all 100 RT | ||
152 | priority levels, instead of 140 in the previous scheduler) and it needs no | ||
153 | expired array. | ||
154 | |||
155 | Scheduling classes are implemented through the sched_class structure, which | ||
156 | contains hooks to functions that must be called whenever an interesting event | ||
157 | occurs. | ||
158 | |||
159 | This is the (partial) list of the hooks: | ||
160 | |||
161 | - enqueue_task(...) | ||
162 | |||
163 | Called when a task enters a runnable state. | ||
164 | It puts the scheduling entity (task) into the red-black tree and | ||
165 | increments the nr_running variable. | ||
166 | |||
167 | - dequeue_tree(...) | ||
168 | |||
169 | When a task is no longer runnable, this function is called to keep the | ||
170 | corresponding scheduling entity out of the red-black tree. It decrements | ||
171 | the nr_running variable. | ||
172 | |||
173 | - yield_task(...) | ||
174 | |||
175 | This function is basically just a dequeue followed by an enqueue, unless the | ||
176 | compat_yield sysctl is turned on; in that case, it places the scheduling | ||
177 | entity at the right-most end of the red-black tree. | ||
178 | |||
179 | - check_preempt_curr(...) | ||
180 | |||
181 | This function checks if a task that entered the runnable state should | ||
182 | preempt the currently running task. | ||
183 | |||
184 | - pick_next_task(...) | ||
185 | |||
186 | This function chooses the most appropriate task eligible to run next. | ||
187 | |||
188 | - set_curr_task(...) | ||
189 | |||
190 | This function is called when a task changes its scheduling class or changes | ||
191 | its task group. | ||
192 | |||
193 | - task_tick(...) | ||
194 | |||
195 | This function is mostly called from time tick functions; it might lead to | ||
196 | process switch. This drives the running preemption. | ||
197 | |||
198 | - task_new(...) | ||
199 | |||
200 | The core scheduler gives the scheduling module an opportunity to manage new | ||
201 | task startup. The CFS scheduling module uses it for group scheduling, while | ||
202 | the scheduling module for a real-time task does not use it. | ||
203 | |||
204 | |||
205 | |||
206 | 7. GROUP SCHEDULER EXTENSIONS TO CFS | ||
207 | |||
208 | Normally, the scheduler operates on individual tasks and strives to provide | ||
209 | fair CPU time to each task. Sometimes, it may be desirable to group tasks and | ||
210 | provide fair CPU time to each such task group. For example, it may be | ||
211 | desirable to first provide fair CPU time to each user on the system and then to | ||
212 | each task belonging to a user. | ||
213 | |||
214 | CONFIG_GROUP_SCHED strives to achieve exactly that. It lets tasks to be | ||
215 | grouped and divides CPU time fairly among such groups. | ||
216 | |||
217 | CONFIG_RT_GROUP_SCHED permits to group real-time (i.e., SCHED_FIFO and | ||
218 | SCHED_RR) tasks. | ||
219 | |||
220 | CONFIG_FAIR_GROUP_SCHED permits to group CFS (i.e., SCHED_NORMAL and | ||
221 | SCHED_BATCH) tasks. | ||
222 | |||
223 | At present, there are two (mutually exclusive) mechanisms to group tasks for | ||
224 | CPU bandwidth control purposes: | ||
225 | |||
226 | - Based on user id (CONFIG_USER_SCHED) | ||
227 | |||
228 | With this option, tasks are grouped according to their user id. | ||
229 | |||
230 | - Based on "cgroup" pseudo filesystem (CONFIG_CGROUP_SCHED) | ||
231 | |||
232 | This options needs CONFIG_CGROUPS to be defined, and lets the administrator | ||
233 | create arbitrary groups of tasks, using the "cgroup" pseudo filesystem. See | ||
234 | Documentation/cgroups.txt for more information about this filesystem. | ||
235 | |||
236 | Only one of these options to group tasks can be chosen and not both. | ||
237 | |||
238 | When CONFIG_USER_SCHED is defined, a directory is created in sysfs for each new | ||
239 | user and a "cpu_share" file is added in that directory. | ||
149 | 240 | ||
150 | # cd /sys/kernel/uids | 241 | # cd /sys/kernel/uids |
151 | # cat 512/cpu_share # Display user 512's CPU share | 242 | # cat 512/cpu_share # Display user 512's CPU share |
@@ -155,16 +246,14 @@ each new user and a "cpu_share" file is added in that directory. | |||
155 | 2048 | 246 | 2048 |
156 | # | 247 | # |
157 | 248 | ||
158 | CPU bandwidth between two users are divided in the ratio of their CPU shares. | 249 | CPU bandwidth between two users is divided in the ratio of their CPU shares. |
159 | For ex: if you would like user "root" to get twice the bandwidth of user | 250 | For example: if you would like user "root" to get twice the bandwidth of user |
160 | "guest", then set the cpu_share for both the users such that "root"'s | 251 | "guest," then set the cpu_share for both the users such that "root"'s cpu_share |
161 | cpu_share is twice "guest"'s cpu_share | 252 | is twice "guest"'s cpu_share. |
162 | |||
163 | 253 | ||
164 | When CONFIG_FAIR_CGROUP_SCHED is defined, a "cpu.shares" file is created | 254 | When CONFIG_CGROUP_SCHED is defined, a "cpu.shares" file is created for each |
165 | for each group created using the pseudo filesystem. See example steps | 255 | group created using the pseudo filesystem. See example steps below to create |
166 | below to create task groups and modify their CPU share using the "cgroups" | 256 | task groups and modify their CPU share using the "cgroups" pseudo filesystem. |
167 | pseudo filesystem | ||
168 | 257 | ||
169 | # mkdir /dev/cpuctl | 258 | # mkdir /dev/cpuctl |
170 | # mount -t cgroup -ocpu none /dev/cpuctl | 259 | # mount -t cgroup -ocpu none /dev/cpuctl |
diff --git a/Documentation/scsi/ChangeLog.megaraid b/Documentation/scsi/ChangeLog.megaraid index 37796fe45bd0..eaa4801f2ce6 100644 --- a/Documentation/scsi/ChangeLog.megaraid +++ b/Documentation/scsi/ChangeLog.megaraid | |||
@@ -409,7 +409,7 @@ i. Function reordering so that inline functions are defined before they | |||
409 | megaraid_mbox_prepare_pthru, megaraid_mbox_prepare_epthru, | 409 | megaraid_mbox_prepare_pthru, megaraid_mbox_prepare_epthru, |
410 | megaraid_busywait_mbox | 410 | megaraid_busywait_mbox |
411 | 411 | ||
412 | - Andrew Morton <akpm@osdl.org>, 08.19.2004 | 412 | - Andrew Morton, 08.19.2004 |
413 | linux-scsi mailing list | 413 | linux-scsi mailing list |
414 | 414 | ||
415 | "Something else to clean up after inclusion: every instance of an | 415 | "Something else to clean up after inclusion: every instance of an |
@@ -471,13 +471,13 @@ vi. Add support for 64-bit applications. Current drivers assume only | |||
471 | vii. Move the function declarations for the management module from | 471 | vii. Move the function declarations for the management module from |
472 | megaraid_mm.h to megaraid_mm.c | 472 | megaraid_mm.h to megaraid_mm.c |
473 | 473 | ||
474 | - Andrew Morton <akpm@osdl.org>, 08.19.2004 | 474 | - Andrew Morton, 08.19.2004 |
475 | linux-scsi mailing list | 475 | linux-scsi mailing list |
476 | 476 | ||
477 | viii. Change default values for MEGARAID_NEWGEN, MEGARAID_MM, and | 477 | viii. Change default values for MEGARAID_NEWGEN, MEGARAID_MM, and |
478 | MEGARAID_MAILBOX to 'n' in Kconfig.megaraid | 478 | MEGARAID_MAILBOX to 'n' in Kconfig.megaraid |
479 | 479 | ||
480 | - Andrew Morton <akpm@osdl.org>, 08.19.2004 | 480 | - Andrew Morton, 08.19.2004 |
481 | linux-scsi mailing list | 481 | linux-scsi mailing list |
482 | 482 | ||
483 | ix. replace udelay with msleep | 483 | ix. replace udelay with msleep |
diff --git a/Documentation/scsi/ChangeLog.megaraid_sas b/Documentation/scsi/ChangeLog.megaraid_sas index 716fcc1cafb5..c851ef497795 100644 --- a/Documentation/scsi/ChangeLog.megaraid_sas +++ b/Documentation/scsi/ChangeLog.megaraid_sas | |||
@@ -1,3 +1,26 @@ | |||
1 | |||
2 | 1 Release Date : Thur.July. 24 11:41:51 PST 2008 - | ||
3 | (emaild-id:megaraidlinux@lsi.com) | ||
4 | Sumant Patro | ||
5 | Bo Yang | ||
6 | |||
7 | 2 Current Version : 00.00.04.01 | ||
8 | 3 Older Version : 00.00.03.22 | ||
9 | |||
10 | 1. Add the new controller (0078, 0079) support to the driver | ||
11 | Those controllers are LSI's next generatation(gen2) SAS controllers. | ||
12 | |||
13 | 1 Release Date : Mon.June. 23 10:12:45 PST 2008 - | ||
14 | (emaild-id:megaraidlinux@lsi.com) | ||
15 | Sumant Patro | ||
16 | Bo Yang | ||
17 | |||
18 | 2 Current Version : 00.00.03.22 | ||
19 | 3 Older Version : 00.00.03.20 | ||
20 | |||
21 | 1. Add shutdown DCMD cmd to the shutdown routine to make FW shutdown proper. | ||
22 | 2. Unexpected interrupt occurs in HWR Linux driver, add the dumy readl pci flush will fix this issue. | ||
23 | |||
1 | 1 Release Date : Mon. March 10 11:02:31 PDT 2008 - | 24 | 1 Release Date : Mon. March 10 11:02:31 PDT 2008 - |
2 | (emaild-id:megaraidlinux@lsi.com) | 25 | (emaild-id:megaraidlinux@lsi.com) |
3 | Sumant Patro | 26 | Sumant Patro |
diff --git a/Documentation/scsi/ibmmca.txt b/Documentation/scsi/ibmmca.txt index a810421f1fb3..3920f28710c4 100644 --- a/Documentation/scsi/ibmmca.txt +++ b/Documentation/scsi/ibmmca.txt | |||
@@ -524,7 +524,7 @@ | |||
524 | - Michael Lang | 524 | - Michael Lang |
525 | 525 | ||
526 | June 25 1997: (v1.8b) | 526 | June 25 1997: (v1.8b) |
527 | 1) Some cosmetical changes for the handling of SCSI-device-types. | 527 | 1) Some cosmetic changes for the handling of SCSI-device-types. |
528 | Now, also CD-Burners / WORMs and SCSI-scanners should work. For | 528 | Now, also CD-Burners / WORMs and SCSI-scanners should work. For |
529 | MO-drives I have no experience, therefore not yet supported. | 529 | MO-drives I have no experience, therefore not yet supported. |
530 | In logical_devices I changed from different type-variables to one | 530 | In logical_devices I changed from different type-variables to one |
@@ -914,7 +914,7 @@ | |||
914 | in version 4.0. This was never really necessary, as all troubles were | 914 | in version 4.0. This was never really necessary, as all troubles were |
915 | based on non-command related reasons up to now, so bypassing commands | 915 | based on non-command related reasons up to now, so bypassing commands |
916 | did not help to avoid any bugs. It is kept in 3.2X for debugging reasons. | 916 | did not help to avoid any bugs. It is kept in 3.2X for debugging reasons. |
917 | 5) Dynamical reassignment of ldns was again verified and analyzed to be | 917 | 5) Dynamic reassignment of ldns was again verified and analyzed to be |
918 | completely inoperational. This is corrected and should work now. | 918 | completely inoperational. This is corrected and should work now. |
919 | 6) All commands that get sent to the SCSI adapter were verified and | 919 | 6) All commands that get sent to the SCSI adapter were verified and |
920 | completed in such a way, that they are now completely conform to the | 920 | completed in such a way, that they are now completely conform to the |
@@ -1386,7 +1386,7 @@ | |||
1386 | concerning the Linux-kernel in special, this SCSI-driver comes without any | 1386 | concerning the Linux-kernel in special, this SCSI-driver comes without any |
1387 | warranty. Its functionality is tested as good as possible on certain | 1387 | warranty. Its functionality is tested as good as possible on certain |
1388 | machines and combinations of computer hardware, which does not exclude, | 1388 | machines and combinations of computer hardware, which does not exclude, |
1389 | that dataloss or severe damage of hardware is possible while using this | 1389 | that data loss or severe damage of hardware is possible while using this |
1390 | part of software on some arbitrary computer hardware or in combination | 1390 | part of software on some arbitrary computer hardware or in combination |
1391 | with other software packages. It is highly recommended to make backup | 1391 | with other software packages. It is highly recommended to make backup |
1392 | copies of your data before using this software. Furthermore, personal | 1392 | copies of your data before using this software. Furthermore, personal |
diff --git a/Documentation/scsi/lpfc.txt b/Documentation/scsi/lpfc.txt index 4dbe41370a6d..5741ea8aa88a 100644 --- a/Documentation/scsi/lpfc.txt +++ b/Documentation/scsi/lpfc.txt | |||
@@ -36,7 +36,7 @@ Cable pull and temporary device Loss: | |||
36 | being removed, a switch rebooting, or a device reboot), the driver could | 36 | being removed, a switch rebooting, or a device reboot), the driver could |
37 | hide the disappearance of the device from the midlayer. I/O's issued to | 37 | hide the disappearance of the device from the midlayer. I/O's issued to |
38 | the LLDD would simply be queued for a short duration, allowing the device | 38 | the LLDD would simply be queued for a short duration, allowing the device |
39 | to reappear or link come back alive, with no inadvertant side effects | 39 | to reappear or link come back alive, with no inadvertent side effects |
40 | to the system. If the driver did not hide these conditions, i/o would be | 40 | to the system. If the driver did not hide these conditions, i/o would be |
41 | errored by the driver, the mid-layer would exhaust its retries, and the | 41 | errored by the driver, the mid-layer would exhaust its retries, and the |
42 | device would be taken offline. Manual intervention would be required to | 42 | device would be taken offline. Manual intervention would be required to |
diff --git a/Documentation/scsi/scsi_fc_transport.txt b/Documentation/scsi/scsi_fc_transport.txt index d403e46d8463..38d324d62b25 100644 --- a/Documentation/scsi/scsi_fc_transport.txt +++ b/Documentation/scsi/scsi_fc_transport.txt | |||
@@ -65,7 +65,7 @@ Overview: | |||
65 | discussion will concentrate on NPIV. | 65 | discussion will concentrate on NPIV. |
66 | 66 | ||
67 | Note: World Wide Name assignment (and uniqueness guarantees) are left | 67 | Note: World Wide Name assignment (and uniqueness guarantees) are left |
68 | up to an administrative entity controling the vport. For example, | 68 | up to an administrative entity controlling the vport. For example, |
69 | if vports are to be associated with virtual machines, a XEN mgmt | 69 | if vports are to be associated with virtual machines, a XEN mgmt |
70 | utility would be responsible for creating wwpn/wwnn's for the vport, | 70 | utility would be responsible for creating wwpn/wwnn's for the vport, |
71 | using it's own naming authority and OUI. (Note: it already does this | 71 | using it's own naming authority and OUI. (Note: it already does this |
@@ -91,7 +91,7 @@ Device Trees and Vport Objects: | |||
91 | Here's what to expect in the device tree : | 91 | Here's what to expect in the device tree : |
92 | The typical Physical Port's Scsi_Host: | 92 | The typical Physical Port's Scsi_Host: |
93 | /sys/devices/.../host17/ | 93 | /sys/devices/.../host17/ |
94 | and it has the typical decendent tree: | 94 | and it has the typical descendant tree: |
95 | /sys/devices/.../host17/rport-17:0-0/target17:0:0/17:0:0:0: | 95 | /sys/devices/.../host17/rport-17:0-0/target17:0:0/17:0:0:0: |
96 | and then the vport is created on the Physical Port: | 96 | and then the vport is created on the Physical Port: |
97 | /sys/devices/.../host17/vport-17:0-0 | 97 | /sys/devices/.../host17/vport-17:0-0 |
@@ -192,7 +192,7 @@ Vport States: | |||
192 | independent of the adapter's link state. | 192 | independent of the adapter's link state. |
193 | - Instantiation of the vport on the FC link via ELS traffic, etc. | 193 | - Instantiation of the vport on the FC link via ELS traffic, etc. |
194 | This is equivalent to a "link up" and successfull link initialization. | 194 | This is equivalent to a "link up" and successfull link initialization. |
195 | Futher information can be found in the interfaces section below for | 195 | Further information can be found in the interfaces section below for |
196 | Vport Creation. | 196 | Vport Creation. |
197 | 197 | ||
198 | Once a vport has been instantiated with the kernel/LLDD, a vport state | 198 | Once a vport has been instantiated with the kernel/LLDD, a vport state |
@@ -436,6 +436,42 @@ Other: | |||
436 | was updated to remove all vports for the fc_host as well. | 436 | was updated to remove all vports for the fc_host as well. |
437 | 437 | ||
438 | 438 | ||
439 | Transport supplied functions | ||
440 | ---------------------------- | ||
441 | |||
442 | The following functions are supplied by the FC-transport for use by LLDs. | ||
443 | |||
444 | fc_vport_create - create a vport | ||
445 | fc_vport_terminate - detach and remove a vport | ||
446 | |||
447 | Details: | ||
448 | |||
449 | /** | ||
450 | * fc_vport_create - Admin App or LLDD requests creation of a vport | ||
451 | * @shost: scsi host the virtual port is connected to. | ||
452 | * @ids: The world wide names, FC4 port roles, etc for | ||
453 | * the virtual port. | ||
454 | * | ||
455 | * Notes: | ||
456 | * This routine assumes no locks are held on entry. | ||
457 | */ | ||
458 | struct fc_vport * | ||
459 | fc_vport_create(struct Scsi_Host *shost, struct fc_vport_identifiers *ids) | ||
460 | |||
461 | /** | ||
462 | * fc_vport_terminate - Admin App or LLDD requests termination of a vport | ||
463 | * @vport: fc_vport to be terminated | ||
464 | * | ||
465 | * Calls the LLDD vport_delete() function, then deallocates and removes | ||
466 | * the vport from the shost and object tree. | ||
467 | * | ||
468 | * Notes: | ||
469 | * This routine assumes no locks are held on entry. | ||
470 | */ | ||
471 | int | ||
472 | fc_vport_terminate(struct fc_vport *vport) | ||
473 | |||
474 | |||
439 | Credits | 475 | Credits |
440 | ======= | 476 | ======= |
441 | The following people have contributed to this document: | 477 | The following people have contributed to this document: |
diff --git a/Documentation/serial/driver b/Documentation/serial/driver index 88ad615dd338..77ba0afbe4db 100644 --- a/Documentation/serial/driver +++ b/Documentation/serial/driver | |||
@@ -186,6 +186,17 @@ hardware. | |||
186 | Locking: port_sem taken. | 186 | Locking: port_sem taken. |
187 | Interrupts: caller dependent. | 187 | Interrupts: caller dependent. |
188 | 188 | ||
189 | flush_buffer(port) | ||
190 | Flush any write buffers, reset any DMA state and stop any | ||
191 | ongoing DMA transfers. | ||
192 | |||
193 | This will be called whenever the port->info->xmit circular | ||
194 | buffer is cleared. | ||
195 | |||
196 | Locking: port->lock taken. | ||
197 | Interrupts: locally disabled. | ||
198 | This call must not sleep | ||
199 | |||
189 | set_termios(port,termios,oldtermios) | 200 | set_termios(port,termios,oldtermios) |
190 | Change the port parameters, including word length, parity, stop | 201 | Change the port parameters, including word length, parity, stop |
191 | bits. Update read_status_mask and ignore_status_mask to indicate | 202 | bits. Update read_status_mask and ignore_status_mask to indicate |
diff --git a/Documentation/sh/clk.txt b/Documentation/sh/clk.txt index 9aef710e9a4b..114b595cfa97 100644 --- a/Documentation/sh/clk.txt +++ b/Documentation/sh/clk.txt | |||
@@ -12,7 +12,7 @@ means no changes to adjanced clock | |||
12 | Internally, the clk_set_rate_ex forwards request to clk->ops->set_rate method, | 12 | Internally, the clk_set_rate_ex forwards request to clk->ops->set_rate method, |
13 | if it is present in ops structure. The method should set the clock rate and adjust | 13 | if it is present in ops structure. The method should set the clock rate and adjust |
14 | all needed clocks according to the passed algo_id. | 14 | all needed clocks according to the passed algo_id. |
15 | Exact values for algo_id are machine-dependend. For the sh7722, the following | 15 | Exact values for algo_id are machine-dependent. For the sh7722, the following |
16 | values are defined: | 16 | values are defined: |
17 | 17 | ||
18 | NO_CHANGE = 0, | 18 | NO_CHANGE = 0, |
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt index 72aff61e7315..e0e54a27fc10 100644 --- a/Documentation/sound/alsa/ALSA-Configuration.txt +++ b/Documentation/sound/alsa/ALSA-Configuration.txt | |||
@@ -746,8 +746,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
746 | Module snd-hda-intel | 746 | Module snd-hda-intel |
747 | -------------------- | 747 | -------------------- |
748 | 748 | ||
749 | Module for Intel HD Audio (ICH6, ICH6M, ESB2, ICH7, ICH8), | 749 | Module for Intel HD Audio (ICH6, ICH6M, ESB2, ICH7, ICH8, ICH9, ICH10, |
750 | ATI SB450, SB600, RS600, | 750 | PCH, SCH), |
751 | ATI SB450, SB600, R600, RS600, RS690, RS780, RV610, RV620, | ||
752 | RV630, RV635, RV670, RV770, | ||
751 | VIA VT8251/VT8237A, | 753 | VIA VT8251/VT8237A, |
752 | SIS966, ULI M5461 | 754 | SIS966, ULI M5461 |
753 | 755 | ||
@@ -807,6 +809,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
807 | ALC260 | 809 | ALC260 |
808 | hp HP machines | 810 | hp HP machines |
809 | hp-3013 HP machines (3013-variant) | 811 | hp-3013 HP machines (3013-variant) |
812 | hp-dc7600 HP DC7600 | ||
810 | fujitsu Fujitsu S7020 | 813 | fujitsu Fujitsu S7020 |
811 | acer Acer TravelMate | 814 | acer Acer TravelMate |
812 | will Will laptops (PB V7900) | 815 | will Will laptops (PB V7900) |
@@ -828,8 +831,11 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
828 | hippo Hippo (ATI) with jack detection, Sony UX-90s | 831 | hippo Hippo (ATI) with jack detection, Sony UX-90s |
829 | hippo_1 Hippo (Benq) with jack detection | 832 | hippo_1 Hippo (Benq) with jack detection |
830 | sony-assamd Sony ASSAMD | 833 | sony-assamd Sony ASSAMD |
834 | toshiba-s06 Toshiba S06 | ||
835 | toshiba-rx1 Toshiba RX1 | ||
831 | ultra Samsung Q1 Ultra Vista model | 836 | ultra Samsung Q1 Ultra Vista model |
832 | lenovo-3000 Lenovo 3000 y410 | 837 | lenovo-3000 Lenovo 3000 y410 |
838 | nec NEC Versa S9100 | ||
833 | basic fixed pin assignment w/o SPDIF | 839 | basic fixed pin assignment w/o SPDIF |
834 | auto auto-config reading BIOS (default) | 840 | auto auto-config reading BIOS (default) |
835 | 841 | ||
@@ -838,6 +844,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
838 | 3stack 3-stack model | 844 | 3stack 3-stack model |
839 | toshiba Toshiba A205 | 845 | toshiba Toshiba A205 |
840 | acer Acer laptops | 846 | acer Acer laptops |
847 | acer-aspire Acer Aspire One | ||
841 | dell Dell OEM laptops (Vostro 1200) | 848 | dell Dell OEM laptops (Vostro 1200) |
842 | zepto Zepto laptops | 849 | zepto Zepto laptops |
843 | test for testing/debugging purpose, almost all controls can | 850 | test for testing/debugging purpose, almost all controls can |
@@ -847,6 +854,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
847 | 854 | ||
848 | ALC269 | 855 | ALC269 |
849 | basic Basic preset | 856 | basic Basic preset |
857 | quanta Quanta FL1 | ||
858 | eeepc-p703 ASUS Eeepc P703 P900A | ||
859 | eeepc-p901 ASUS Eeepc P901 S101 | ||
850 | 860 | ||
851 | ALC662/663 | 861 | ALC662/663 |
852 | 3stack-dig 3-stack (2-channel) with SPDIF | 862 | 3stack-dig 3-stack (2-channel) with SPDIF |
@@ -856,10 +866,17 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
856 | lenovo-101e Lenovo laptop | 866 | lenovo-101e Lenovo laptop |
857 | eeepc-p701 ASUS Eeepc P701 | 867 | eeepc-p701 ASUS Eeepc P701 |
858 | eeepc-ep20 ASUS Eeepc EP20 | 868 | eeepc-ep20 ASUS Eeepc EP20 |
869 | ecs ECS/Foxconn mobo | ||
859 | m51va ASUS M51VA | 870 | m51va ASUS M51VA |
860 | g71v ASUS G71V | 871 | g71v ASUS G71V |
861 | h13 ASUS H13 | 872 | h13 ASUS H13 |
862 | g50v ASUS G50V | 873 | g50v ASUS G50V |
874 | asus-mode1 ASUS | ||
875 | asus-mode2 ASUS | ||
876 | asus-mode3 ASUS | ||
877 | asus-mode4 ASUS | ||
878 | asus-mode5 ASUS | ||
879 | asus-mode6 ASUS | ||
863 | auto auto-config reading BIOS (default) | 880 | auto auto-config reading BIOS (default) |
864 | 881 | ||
865 | ALC882/885 | 882 | ALC882/885 |
@@ -891,12 +908,14 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
891 | lenovo-101e Lenovo 101E | 908 | lenovo-101e Lenovo 101E |
892 | lenovo-nb0763 Lenovo NB0763 | 909 | lenovo-nb0763 Lenovo NB0763 |
893 | lenovo-ms7195-dig Lenovo MS7195 | 910 | lenovo-ms7195-dig Lenovo MS7195 |
911 | lenovo-sky Lenovo Sky | ||
894 | haier-w66 Haier W66 | 912 | haier-w66 Haier W66 |
895 | 3stack-hp HP machines with 3stack (Lucknow, Samba boards) | 913 | 3stack-hp HP machines with 3stack (Lucknow, Samba boards) |
896 | 6stack-dell Dell machines with 6stack (Inspiron 530) | 914 | 6stack-dell Dell machines with 6stack (Inspiron 530) |
897 | mitac Mitac 8252D | 915 | mitac Mitac 8252D |
898 | clevo-m720 Clevo M720 laptop series | 916 | clevo-m720 Clevo M720 laptop series |
899 | fujitsu-pi2515 Fujitsu AMILO Pi2515 | 917 | fujitsu-pi2515 Fujitsu AMILO Pi2515 |
918 | 3stack-6ch-intel Intel DG33* boards | ||
900 | auto auto-config reading BIOS (default) | 919 | auto auto-config reading BIOS (default) |
901 | 920 | ||
902 | ALC861/660 | 921 | ALC861/660 |
@@ -929,7 +948,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
929 | allout 5-jack in back, 2-jack in front, SPDIF out | 948 | allout 5-jack in back, 2-jack in front, SPDIF out |
930 | auto auto-config reading BIOS (default) | 949 | auto auto-config reading BIOS (default) |
931 | 950 | ||
932 | AD1882 | 951 | AD1882 / AD1882A |
933 | 3stack 3-stack mode (default) | 952 | 3stack 3-stack mode (default) |
934 | 6stack 6-stack mode | 953 | 6stack 6-stack mode |
935 | 954 | ||
@@ -1024,6 +1043,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1024 | intel-mac-v3 Intel Mac Type 3 | 1043 | intel-mac-v3 Intel Mac Type 3 |
1025 | intel-mac-v4 Intel Mac Type 4 | 1044 | intel-mac-v4 Intel Mac Type 4 |
1026 | intel-mac-v5 Intel Mac Type 5 | 1045 | intel-mac-v5 Intel Mac Type 5 |
1046 | intel-mac-auto Intel Mac (detect type according to subsystem id) | ||
1027 | macmini Intel Mac Mini (equivalent with type 3) | 1047 | macmini Intel Mac Mini (equivalent with type 3) |
1028 | macbook Intel Mac Book (eq. type 5) | 1048 | macbook Intel Mac Book (eq. type 5) |
1029 | macbook-pro-v1 Intel Mac Book Pro 1st generation (eq. type 3) | 1049 | macbook-pro-v1 Intel Mac Book Pro 1st generation (eq. type 3) |
@@ -1078,7 +1098,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1078 | register value without FIFO size correction as the current | 1098 | register value without FIFO size correction as the current |
1079 | DMA pointer. position_fix=2 will make the driver to use | 1099 | DMA pointer. position_fix=2 will make the driver to use |
1080 | the position buffer instead of reading SD_LPIB register. | 1100 | the position buffer instead of reading SD_LPIB register. |
1081 | (Usually SD_LPLIB register is more accurate than the | 1101 | (Usually SD_LPIB register is more accurate than the |
1082 | position buffer.) | 1102 | position buffer.) |
1083 | 1103 | ||
1084 | NB: If you get many "azx_get_response timeout" messages at | 1104 | NB: If you get many "azx_get_response timeout" messages at |
@@ -1143,8 +1163,6 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1143 | 1163 | ||
1144 | This module supports autoprobe and multiple cards. | 1164 | This module supports autoprobe and multiple cards. |
1145 | 1165 | ||
1146 | Power management is _not_ supported. | ||
1147 | |||
1148 | Module snd-ice1712 | 1166 | Module snd-ice1712 |
1149 | ------------------ | 1167 | ------------------ |
1150 | 1168 | ||
@@ -1167,6 +1185,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1167 | * Event Electronics, EZ8 | 1185 | * Event Electronics, EZ8 |
1168 | * Digigram VX442 | 1186 | * Digigram VX442 |
1169 | * Lionstracs, Mediastaton | 1187 | * Lionstracs, Mediastaton |
1188 | * Terrasoniq TS 88 | ||
1170 | 1189 | ||
1171 | model - Use the given board model, one of the following: | 1190 | model - Use the given board model, one of the following: |
1172 | delta1010, dio2496, delta66, delta44, audiophile, delta410, | 1191 | delta1010, dio2496, delta66, delta44, audiophile, delta410, |
@@ -1201,7 +1220,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1201 | * TerraTec Phase 22 | 1220 | * TerraTec Phase 22 |
1202 | * TerraTec Phase 28 | 1221 | * TerraTec Phase 28 |
1203 | * AudioTrak Prodigy 7.1 | 1222 | * AudioTrak Prodigy 7.1 |
1204 | * AudioTrak Prodigy 7.1LT | 1223 | * AudioTrak Prodigy 7.1 LT |
1224 | * AudioTrak Prodigy 7.1 XT | ||
1225 | * AudioTrak Prodigy 7.1 HIFI | ||
1226 | * AudioTrak Prodigy 7.1 HD2 | ||
1205 | * AudioTrak Prodigy 192 | 1227 | * AudioTrak Prodigy 192 |
1206 | * Pontis MS300 | 1228 | * Pontis MS300 |
1207 | * Albatron K8X800 Pro II | 1229 | * Albatron K8X800 Pro II |
@@ -1212,12 +1234,16 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1212 | * Shuttle SN25P | 1234 | * Shuttle SN25P |
1213 | * Onkyo SE-90PCI | 1235 | * Onkyo SE-90PCI |
1214 | * Onkyo SE-200PCI | 1236 | * Onkyo SE-200PCI |
1237 | * ESI Juli@ | ||
1238 | * Hercules Fortissimo IV | ||
1239 | * EGO-SYS WaveTerminal 192M | ||
1215 | 1240 | ||
1216 | model - Use the given board model, one of the following: | 1241 | model - Use the given board model, one of the following: |
1217 | revo51, revo71, amp2000, prodigy71, prodigy71lt, | 1242 | revo51, revo71, amp2000, prodigy71, prodigy71lt, |
1218 | prodigy192, aureon51, aureon71, universe, ap192, | 1243 | prodigy71xt, prodigy71hifi, prodigyhd2, prodigy192, |
1219 | k8x800, phase22, phase28, ms300, av710, se200pci, | 1244 | juli, aureon51, aureon71, universe, ap192, k8x800, |
1220 | se90pci | 1245 | phase22, phase28, ms300, av710, se200pci, se90pci, |
1246 | fortissimo4, sn25p, WT192M | ||
1221 | 1247 | ||
1222 | This module supports multiple cards and autoprobe. | 1248 | This module supports multiple cards and autoprobe. |
1223 | 1249 | ||
@@ -1256,7 +1282,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1256 | 1282 | ||
1257 | Module for AC'97 motherboards from Intel and compatibles. | 1283 | Module for AC'97 motherboards from Intel and compatibles. |
1258 | * Intel i810/810E, i815, i820, i830, i84x, MX440 | 1284 | * Intel i810/810E, i815, i820, i830, i84x, MX440 |
1259 | ICH5, ICH6, ICH7, ESB2 | 1285 | ICH5, ICH6, ICH7, 6300ESB, ESB2 |
1260 | * SiS 7012 (SiS 735) | 1286 | * SiS 7012 (SiS 735) |
1261 | * NVidia NForce, NForce2, NForce3, MCP04, CK804 | 1287 | * NVidia NForce, NForce2, NForce3, MCP04, CK804 |
1262 | CK8, CK8S, MCP501 | 1288 | CK8, CK8S, MCP501 |
@@ -1627,8 +1653,6 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1627 | 1653 | ||
1628 | This module supports autoprobe and multiple cards. | 1654 | This module supports autoprobe and multiple cards. |
1629 | 1655 | ||
1630 | Power management is _not_ supported. | ||
1631 | |||
1632 | Module snd-pcsp | 1656 | Module snd-pcsp |
1633 | ----------------- | 1657 | ----------------- |
1634 | 1658 | ||
@@ -1954,6 +1978,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1954 | * CHIC True Sound 4Dwave | 1978 | * CHIC True Sound 4Dwave |
1955 | * Shark Predator4D-PCI | 1979 | * Shark Predator4D-PCI |
1956 | * Jaton SonicWave 4D | 1980 | * Jaton SonicWave 4D |
1981 | * SiS SI7018 PCI Audio | ||
1982 | * Hoontech SoundTrack Digital 4DWave NX | ||
1957 | 1983 | ||
1958 | pcm_channels - max channels (voices) reserved for PCM | 1984 | pcm_channels - max channels (voices) reserved for PCM |
1959 | wavetable_size - max wavetable size in kB (4-?kb) | 1985 | wavetable_size - max wavetable size in kB (4-?kb) |
@@ -1969,12 +1995,25 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1969 | 1995 | ||
1970 | vid - Vendor ID for the device (optional) | 1996 | vid - Vendor ID for the device (optional) |
1971 | pid - Product ID for the device (optional) | 1997 | pid - Product ID for the device (optional) |
1998 | nrpacks - Max. number of packets per URB (default: 8) | ||
1999 | async_unlink - Use async unlink mode (default: yes) | ||
1972 | device_setup - Device specific magic number (optional) | 2000 | device_setup - Device specific magic number (optional) |
1973 | - Influence depends on the device | 2001 | - Influence depends on the device |
1974 | - Default: 0x0000 | 2002 | - Default: 0x0000 |
2003 | ignore_ctl_error - Ignore any USB-controller regarding mixer | ||
2004 | interface (default: no) | ||
1975 | 2005 | ||
1976 | This module supports multiple devices, autoprobe and hotplugging. | 2006 | This module supports multiple devices, autoprobe and hotplugging. |
1977 | 2007 | ||
2008 | NB: nrpacks parameter can be modified dynamically via sysfs. | ||
2009 | Don't put the value over 20. Changing via sysfs has no sanity | ||
2010 | check. | ||
2011 | NB: async_unlink=0 would cause Oops. It remains just for | ||
2012 | debugging purpose (if any). | ||
2013 | NB: ignore_ctl_error=1 may help when you get an error at accessing | ||
2014 | the mixer element such as URB error -22. This happens on some | ||
2015 | buggy USB device or the controller. | ||
2016 | |||
1978 | Module snd-usb-caiaq | 2017 | Module snd-usb-caiaq |
1979 | -------------------- | 2018 | -------------------- |
1980 | 2019 | ||
@@ -2080,13 +2119,11 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
2080 | Module snd-virtuoso | 2119 | Module snd-virtuoso |
2081 | ------------------- | 2120 | ------------------- |
2082 | 2121 | ||
2083 | Module for sound cards based on the Asus AV200 chip, i.e., | 2122 | Module for sound cards based on the Asus AV100/AV200 chips, |
2084 | Xonar D2 and Xonar D2X. | 2123 | i.e., Xonar D1, DX, D2, D2X and HDAV1.3 (Deluxe). |
2085 | 2124 | ||
2086 | This module supports autoprobe and multiple cards. | 2125 | This module supports autoprobe and multiple cards. |
2087 | 2126 | ||
2088 | Power management is _not_ supported. | ||
2089 | |||
2090 | Module snd-vx222 | 2127 | Module snd-vx222 |
2091 | ---------------- | 2128 | ---------------- |
2092 | 2129 | ||
diff --git a/Documentation/sound/alsa/Audiophile-Usb.txt b/Documentation/sound/alsa/Audiophile-Usb.txt index 2ad5e6306c44..a4c53d8961e1 100644 --- a/Documentation/sound/alsa/Audiophile-Usb.txt +++ b/Documentation/sound/alsa/Audiophile-Usb.txt | |||
@@ -236,15 +236,15 @@ The parameter can be given: | |||
236 | alias snd-card-1 snd-usb-audio | 236 | alias snd-card-1 snd-usb-audio |
237 | options snd-usb-audio index=1 device_setup=0x09 | 237 | options snd-usb-audio index=1 device_setup=0x09 |
238 | 238 | ||
239 | CAUTION when initializaing the device | 239 | CAUTION when initializing the device |
240 | ------------------------------------- | 240 | ------------------------------------- |
241 | 241 | ||
242 | * Correct initialization on the device requires that device_setup is given to | 242 | * Correct initialization on the device requires that device_setup is given to |
243 | the module BEFORE the device is turned on. So, if you use the "manual probing" | 243 | the module BEFORE the device is turned on. So, if you use the "manual probing" |
244 | method described above, take care to power-on the device AFTER this initialization. | 244 | method described above, take care to power-on the device AFTER this initialization. |
245 | 245 | ||
246 | * Failing to respect this will lead in a misconfiguration of the device. In this case | 246 | * Failing to respect this will lead to a misconfiguration of the device. In this case |
247 | turn off the device, unproble the snd-usb-audio module, then probe it again with | 247 | turn off the device, unprobe the snd-usb-audio module, then probe it again with |
248 | correct device_setup parameter and then (and only then) turn on the device again. | 248 | correct device_setup parameter and then (and only then) turn on the device again. |
249 | 249 | ||
250 | * If you've correctly initialized the device in a valid mode and then want to switch | 250 | * If you've correctly initialized the device in a valid mode and then want to switch |
@@ -388,9 +388,9 @@ There are 2 main potential issues when using Jackd with the device: | |||
388 | 388 | ||
389 | Jack supports big endian devices only in recent versions (thanks to | 389 | Jack supports big endian devices only in recent versions (thanks to |
390 | Andreas Steinmetz for his first big-endian patch). I can't remember | 390 | Andreas Steinmetz for his first big-endian patch). I can't remember |
391 | extacly when this support was released into jackd, let's just say that | 391 | exactly when this support was released into jackd, let's just say that |
392 | with jackd version 0.103.0 it's almost ok (just a small bug is affecting | 392 | with jackd version 0.103.0 it's almost ok (just a small bug is affecting |
393 | 16bits Big-Endian devices, but since you've read carefully the above | 393 | 16bits Big-Endian devices, but since you've read carefully the above |
394 | paragraphs, you're now using kernel >= 2.6.23 and your 16bits devices | 394 | paragraphs, you're now using kernel >= 2.6.23 and your 16bits devices |
395 | are now Little Endians ;-) ). | 395 | are now Little Endians ;-) ). |
396 | 396 | ||
diff --git a/Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl b/Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl index c4d2e3507af9..9d644f7e241e 100644 --- a/Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl +++ b/Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl | |||
@@ -42,7 +42,7 @@ | |||
42 | <sect1><title>Device Components</title> | 42 | <sect1><title>Device Components</title> |
43 | !Esound/core/device.c | 43 | !Esound/core/device.c |
44 | </sect1> | 44 | </sect1> |
45 | <sect1><title>KMOD and Device File Entries</title> | 45 | <sect1><title>Module requests and Device File Entries</title> |
46 | !Esound/core/sound.c | 46 | !Esound/core/sound.c |
47 | </sect1> | 47 | </sect1> |
48 | <sect1><title>Memory Management Helpers</title> | 48 | <sect1><title>Memory Management Helpers</title> |
diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl index e13c4e67029f..87a7c07ab658 100644 --- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl | |||
@@ -5073,8 +5073,7 @@ struct _snd_pcm_runtime { | |||
5073 | with <constant>SNDRV_DMA_TYPE_CONTINUOUS</constant> type and the | 5073 | with <constant>SNDRV_DMA_TYPE_CONTINUOUS</constant> type and the |
5074 | <function>snd_dma_continuous_data(GFP_KERNEL)</function> device pointer, | 5074 | <function>snd_dma_continuous_data(GFP_KERNEL)</function> device pointer, |
5075 | where <constant>GFP_KERNEL</constant> is the kernel allocation flag to | 5075 | where <constant>GFP_KERNEL</constant> is the kernel allocation flag to |
5076 | use. For the SBUS, <constant>SNDRV_DMA_TYPE_SBUS</constant> and | 5076 | use. |
5077 | <function>snd_dma_sbus_data(sbus_dev)</function> are used instead. | ||
5078 | For the PCI scatter-gather buffers, use | 5077 | For the PCI scatter-gather buffers, use |
5079 | <constant>SNDRV_DMA_TYPE_DEV_SG</constant> with | 5078 | <constant>SNDRV_DMA_TYPE_DEV_SG</constant> with |
5080 | <function>snd_dma_pci_data(pci)</function> | 5079 | <function>snd_dma_pci_data(pci)</function> |
@@ -6135,44 +6134,58 @@ struct _snd_pcm_runtime { | |||
6135 | </para> | 6134 | </para> |
6136 | </section> | 6135 | </section> |
6137 | 6136 | ||
6138 | <section id="useful-functions-snd-assert"> | 6137 | <section id="useful-functions-snd-bug"> |
6139 | <title><function>snd_assert()</function></title> | 6138 | <title><function>snd_BUG()</function></title> |
6140 | <para> | 6139 | <para> |
6141 | <function>snd_assert()</function> macro is similar with the | 6140 | It shows the <computeroutput>BUG?</computeroutput> message and |
6142 | normal <function>assert()</function> macro. For example, | 6141 | stack trace as well as <function>snd_BUG_ON</function> at the point. |
6142 | It's useful to show that a fatal error happens there. | ||
6143 | </para> | ||
6144 | <para> | ||
6145 | When no debug flag is set, this macro is ignored. | ||
6146 | </para> | ||
6147 | </section> | ||
6148 | |||
6149 | <section id="useful-functions-snd-bug-on"> | ||
6150 | <title><function>snd_BUG_ON()</function></title> | ||
6151 | <para> | ||
6152 | <function>snd_BUG_ON()</function> macro is similar with | ||
6153 | <function>WARN_ON()</function> macro. For example, | ||
6143 | 6154 | ||
6144 | <informalexample> | 6155 | <informalexample> |
6145 | <programlisting> | 6156 | <programlisting> |
6146 | <![CDATA[ | 6157 | <![CDATA[ |
6147 | snd_assert(pointer != NULL, return -EINVAL); | 6158 | snd_BUG_ON(!pointer); |
6148 | ]]> | 6159 | ]]> |
6149 | </programlisting> | 6160 | </programlisting> |
6150 | </informalexample> | 6161 | </informalexample> |
6151 | </para> | ||
6152 | 6162 | ||
6153 | <para> | 6163 | or it can be used as the condition, |
6154 | The first argument is the expression to evaluate, and the | 6164 | <informalexample> |
6155 | second argument is the action if it fails. When | 6165 | <programlisting> |
6156 | <constant>CONFIG_SND_DEBUG</constant>, is set, it will show an | 6166 | <![CDATA[ |
6157 | error message such as <computeroutput>BUG? (xxx)</computeroutput> | 6167 | if (snd_BUG_ON(non_zero_is_bug)) |
6158 | together with stack trace. | 6168 | return -EINVAL; |
6159 | </para> | 6169 | ]]> |
6160 | <para> | 6170 | </programlisting> |
6161 | When no debug flag is set, this macro is ignored. | 6171 | </informalexample> |
6162 | </para> | ||
6163 | </section> | ||
6164 | 6172 | ||
6165 | <section id="useful-functions-snd-bug"> | ||
6166 | <title><function>snd_BUG()</function></title> | ||
6167 | <para> | ||
6168 | It shows the <computeroutput>BUG?</computeroutput> message and | ||
6169 | stack trace as well as <function>snd_assert</function> at the point. | ||
6170 | It's useful to show that a fatal error happens there. | ||
6171 | </para> | 6173 | </para> |
6174 | |||
6172 | <para> | 6175 | <para> |
6173 | When no debug flag is set, this macro is ignored. | 6176 | The macro takes an conditional expression to evaluate. |
6177 | When <constant>CONFIG_SND_DEBUG</constant>, is set, the | ||
6178 | expression is actually evaluated. If it's non-zero, it shows | ||
6179 | the warning message such as | ||
6180 | <computeroutput>BUG? (xxx)</computeroutput> | ||
6181 | normally followed by stack trace. It returns the evaluated | ||
6182 | value. | ||
6183 | When no <constant>CONFIG_SND_DEBUG</constant> is set, this | ||
6184 | macro always returns zero. | ||
6174 | </para> | 6185 | </para> |
6186 | |||
6175 | </section> | 6187 | </section> |
6188 | |||
6176 | </chapter> | 6189 | </chapter> |
6177 | 6190 | ||
6178 | 6191 | ||
diff --git a/Documentation/sound/alsa/hda_codec.txt b/Documentation/sound/alsa/hda_codec.txt index 8e1b02526698..34e87ec1379c 100644 --- a/Documentation/sound/alsa/hda_codec.txt +++ b/Documentation/sound/alsa/hda_codec.txt | |||
@@ -67,7 +67,7 @@ CONFIG_SND_HDA_POWER_SAVE kconfig. It's called when the codec needs | |||
67 | to power up or may power down. The controller should check the all | 67 | to power up or may power down. The controller should check the all |
68 | belonging codecs on the bus whether they are actually powered off | 68 | belonging codecs on the bus whether they are actually powered off |
69 | (check codec->power_on), and optionally the driver may power down the | 69 | (check codec->power_on), and optionally the driver may power down the |
70 | contoller side, too. | 70 | controller side, too. |
71 | 71 | ||
72 | The bus instance is created via snd_hda_bus_new(). You need to pass | 72 | The bus instance is created via snd_hda_bus_new(). You need to pass |
73 | the card instance, the template, and the pointer to store the | 73 | the card instance, the template, and the pointer to store the |
diff --git a/Documentation/sound/alsa/soc/dapm.txt b/Documentation/sound/alsa/soc/dapm.txt index c784a18b94dc..46f9684d0b29 100644 --- a/Documentation/sound/alsa/soc/dapm.txt +++ b/Documentation/sound/alsa/soc/dapm.txt | |||
@@ -68,7 +68,7 @@ Audio DAPM widgets fall into a number of types:- | |||
68 | (Widgets are defined in include/sound/soc-dapm.h) | 68 | (Widgets are defined in include/sound/soc-dapm.h) |
69 | 69 | ||
70 | Widgets are usually added in the codec driver and the machine driver. There are | 70 | Widgets are usually added in the codec driver and the machine driver. There are |
71 | convience macros defined in soc-dapm.h that can be used to quickly build a | 71 | convenience macros defined in soc-dapm.h that can be used to quickly build a |
72 | list of widgets of the codecs and machines DAPM widgets. | 72 | list of widgets of the codecs and machines DAPM widgets. |
73 | 73 | ||
74 | Most widgets have a name, register, shift and invert. Some widgets have extra | 74 | Most widgets have a name, register, shift and invert. Some widgets have extra |
@@ -135,11 +135,7 @@ when the Mic is inserted:- | |||
135 | 135 | ||
136 | static int spitz_mic_bias(struct snd_soc_dapm_widget* w, int event) | 136 | static int spitz_mic_bias(struct snd_soc_dapm_widget* w, int event) |
137 | { | 137 | { |
138 | if(SND_SOC_DAPM_EVENT_ON(event)) | 138 | gpio_set_value(SPITZ_GPIO_MIC_BIAS, SND_SOC_DAPM_EVENT_ON(event)); |
139 | set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_MIC_BIAS); | ||
140 | else | ||
141 | reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_MIC_BIAS); | ||
142 | |||
143 | return 0; | 139 | return 0; |
144 | } | 140 | } |
145 | 141 | ||
@@ -269,11 +265,7 @@ powered only when the spk is in use. | |||
269 | /* turn speaker amplifier on/off depending on use */ | 265 | /* turn speaker amplifier on/off depending on use */ |
270 | static int corgi_amp_event(struct snd_soc_dapm_widget *w, int event) | 266 | static int corgi_amp_event(struct snd_soc_dapm_widget *w, int event) |
271 | { | 267 | { |
272 | if (SND_SOC_DAPM_EVENT_ON(event)) | 268 | gpio_set_value(CORGI_GPIO_APM_ON, SND_SOC_DAPM_EVENT_ON(event)); |
273 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_APM_ON); | ||
274 | else | ||
275 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_APM_ON); | ||
276 | |||
277 | return 0; | 269 | return 0; |
278 | } | 270 | } |
279 | 271 | ||
diff --git a/Documentation/sparc/sbus_drivers.txt b/Documentation/sparc/sbus_drivers.txt deleted file mode 100644 index eb1e28ad8822..000000000000 --- a/Documentation/sparc/sbus_drivers.txt +++ /dev/null | |||
@@ -1,309 +0,0 @@ | |||
1 | |||
2 | Writing SBUS Drivers | ||
3 | |||
4 | David S. Miller (davem@redhat.com) | ||
5 | |||
6 | The SBUS driver interfaces of the Linux kernel have been | ||
7 | revamped completely for 2.4.x for several reasons. Foremost were | ||
8 | performance and complexity concerns. This document details these | ||
9 | new interfaces and how they are used to write an SBUS device driver. | ||
10 | |||
11 | SBUS drivers need to include <asm/sbus.h> to get access | ||
12 | to functions and structures described here. | ||
13 | |||
14 | Probing and Detection | ||
15 | |||
16 | Each SBUS device inside the machine is described by a | ||
17 | structure called "struct sbus_dev". Likewise, each SBUS bus | ||
18 | found in the system is described by a "struct sbus_bus". For | ||
19 | each SBUS bus, the devices underneath are hung in a tree-like | ||
20 | fashion off of the bus structure. | ||
21 | |||
22 | The SBUS device structure contains enough information | ||
23 | for you to implement your device probing algorithm and obtain | ||
24 | the bits necessary to run your device. The most commonly | ||
25 | used members of this structure, and their typical usage, | ||
26 | will be detailed below. | ||
27 | |||
28 | Here is a piece of skeleton code for performing a device | ||
29 | probe in an SBUS driver under Linux: | ||
30 | |||
31 | static int __devinit mydevice_probe_one(struct sbus_dev *sdev) | ||
32 | { | ||
33 | struct mysdevice *mp = kzalloc(sizeof(*mp), GFP_KERNEL); | ||
34 | |||
35 | if (!mp) | ||
36 | return -ENODEV; | ||
37 | |||
38 | ... | ||
39 | dev_set_drvdata(&sdev->ofdev.dev, mp); | ||
40 | return 0; | ||
41 | ... | ||
42 | } | ||
43 | |||
44 | static int __devinit mydevice_probe(struct of_device *dev, | ||
45 | const struct of_device_id *match) | ||
46 | { | ||
47 | struct sbus_dev *sdev = to_sbus_device(&dev->dev); | ||
48 | |||
49 | return mydevice_probe_one(sdev); | ||
50 | } | ||
51 | |||
52 | static int __devexit mydevice_remove(struct of_device *dev) | ||
53 | { | ||
54 | struct sbus_dev *sdev = to_sbus_device(&dev->dev); | ||
55 | struct mydevice *mp = dev_get_drvdata(&dev->dev); | ||
56 | |||
57 | return mydevice_remove_one(sdev, mp); | ||
58 | } | ||
59 | |||
60 | static struct of_device_id mydevice_match[] = { | ||
61 | { | ||
62 | .name = "mydevice", | ||
63 | }, | ||
64 | {}, | ||
65 | }; | ||
66 | |||
67 | MODULE_DEVICE_TABLE(of, mydevice_match); | ||
68 | |||
69 | static struct of_platform_driver mydevice_driver = { | ||
70 | .match_table = mydevice_match, | ||
71 | .probe = mydevice_probe, | ||
72 | .remove = __devexit_p(mydevice_remove), | ||
73 | .driver = { | ||
74 | .name = "mydevice", | ||
75 | }, | ||
76 | }; | ||
77 | |||
78 | static int __init mydevice_init(void) | ||
79 | { | ||
80 | return of_register_driver(&mydevice_driver, &sbus_bus_type); | ||
81 | } | ||
82 | |||
83 | static void __exit mydevice_exit(void) | ||
84 | { | ||
85 | of_unregister_driver(&mydevice_driver); | ||
86 | } | ||
87 | |||
88 | module_init(mydevice_init); | ||
89 | module_exit(mydevice_exit); | ||
90 | |||
91 | The mydevice_match table is a series of entries which | ||
92 | describes what SBUS devices your driver is meant for. In the | ||
93 | simplest case you specify a string for the 'name' field. Every | ||
94 | SBUS device with a 'name' property matching your string will | ||
95 | be passed one-by-one to your .probe method. | ||
96 | |||
97 | You should store away your device private state structure | ||
98 | pointer in the drvdata area so that you can retrieve it later on | ||
99 | in your .remove method. | ||
100 | |||
101 | Any memory allocated, registers mapped, IRQs registered, | ||
102 | etc. must be undone by your .remove method so that all resources | ||
103 | of your device are released by the time it returns. | ||
104 | |||
105 | You should _NOT_ use the for_each_sbus(), for_each_sbusdev(), | ||
106 | and for_all_sbusdev() interfaces. They are deprecated, will be | ||
107 | removed, and no new driver should reference them ever. | ||
108 | |||
109 | Mapping and Accessing I/O Registers | ||
110 | |||
111 | Each SBUS device structure contains an array of descriptors | ||
112 | which describe each register set. We abuse struct resource for that. | ||
113 | They each correspond to the "reg" properties provided by the OBP firmware. | ||
114 | |||
115 | Before you can access your device's registers you must map | ||
116 | them. And later if you wish to shutdown your driver (for module | ||
117 | unload or similar) you must unmap them. You must treat them as | ||
118 | a resource, which you allocate (map) before using and free up | ||
119 | (unmap) when you are done with it. | ||
120 | |||
121 | The mapping information is stored in an opaque value | ||
122 | typed as an "unsigned long". This is the type of the return value | ||
123 | of the mapping interface, and the arguments to the unmapping | ||
124 | interface. Let's say you want to map the first set of registers. | ||
125 | Perhaps part of your driver software state structure looks like: | ||
126 | |||
127 | struct mydevice { | ||
128 | unsigned long control_regs; | ||
129 | ... | ||
130 | struct sbus_dev *sdev; | ||
131 | ... | ||
132 | }; | ||
133 | |||
134 | At initialization time you then use the sbus_ioremap | ||
135 | interface to map in your registers, like so: | ||
136 | |||
137 | static void init_one_mydevice(struct sbus_dev *sdev) | ||
138 | { | ||
139 | struct mydevice *mp; | ||
140 | ... | ||
141 | |||
142 | mp->control_regs = sbus_ioremap(&sdev->resource[0], 0, | ||
143 | CONTROL_REGS_SIZE, "mydevice regs"); | ||
144 | if (!mp->control_regs) { | ||
145 | /* Failure, cleanup and return. */ | ||
146 | } | ||
147 | } | ||
148 | |||
149 | Second argument to sbus_ioremap is an offset for | ||
150 | cranky devices with broken OBP PROM. The sbus_ioremap uses only | ||
151 | a start address and flags from the resource structure. | ||
152 | Therefore it is possible to use the same resource to map | ||
153 | several sets of registers or even to fabricate a resource | ||
154 | structure if driver gets physical address from some private place. | ||
155 | This practice is discouraged though. Use whatever OBP PROM | ||
156 | provided to you. | ||
157 | |||
158 | And here is how you might unmap these registers later at | ||
159 | driver shutdown or module unload time, using the sbus_iounmap | ||
160 | interface: | ||
161 | |||
162 | static void mydevice_unmap_regs(struct mydevice *mp) | ||
163 | { | ||
164 | sbus_iounmap(mp->control_regs, CONTROL_REGS_SIZE); | ||
165 | } | ||
166 | |||
167 | Finally, to actually access your registers there are 6 | ||
168 | interface routines at your disposal. Accesses are byte (8 bit), | ||
169 | word (16 bit), or longword (32 bit) sized. Here they are: | ||
170 | |||
171 | u8 sbus_readb(unsigned long reg) /* read byte */ | ||
172 | u16 sbus_readw(unsigned long reg) /* read word */ | ||
173 | u32 sbus_readl(unsigned long reg) /* read longword */ | ||
174 | void sbus_writeb(u8 value, unsigned long reg) /* write byte */ | ||
175 | void sbus_writew(u16 value, unsigned long reg) /* write word */ | ||
176 | void sbus_writel(u32 value, unsigned long reg) /* write longword */ | ||
177 | |||
178 | So, let's say your device has a control register of some sort | ||
179 | at offset zero. The following might implement resetting your device: | ||
180 | |||
181 | #define CONTROL 0x00UL | ||
182 | |||
183 | #define CONTROL_RESET 0x00000001 /* Reset hardware */ | ||
184 | |||
185 | static void mydevice_reset(struct mydevice *mp) | ||
186 | { | ||
187 | sbus_writel(CONTROL_RESET, mp->regs + CONTROL); | ||
188 | } | ||
189 | |||
190 | Or perhaps there is a data port register at an offset of | ||
191 | 16 bytes which allows you to read bytes from a fifo in the device: | ||
192 | |||
193 | #define DATA 0x10UL | ||
194 | |||
195 | static u8 mydevice_get_byte(struct mydevice *mp) | ||
196 | { | ||
197 | return sbus_readb(mp->regs + DATA); | ||
198 | } | ||
199 | |||
200 | It's pretty straightforward, and clueful readers may have | ||
201 | noticed that these interfaces mimick the PCI interfaces of the | ||
202 | Linux kernel. This was not by accident. | ||
203 | |||
204 | WARNING: | ||
205 | |||
206 | DO NOT try to treat these opaque register mapping | ||
207 | values as a memory mapped pointer to some structure | ||
208 | which you can dereference. | ||
209 | |||
210 | It may be memory mapped, it may not be. In fact it | ||
211 | could be a physical address, or it could be the time | ||
212 | of day xor'd with 0xdeadbeef. :-) | ||
213 | |||
214 | Whatever it is, it's an implementation detail. The | ||
215 | interface was done this way to shield the driver | ||
216 | author from such complexities. | ||
217 | |||
218 | Doing DVMA | ||
219 | |||
220 | SBUS devices can perform DMA transactions in a way similar | ||
221 | to PCI but dissimilar to ISA, e.g. DMA masters supply address. | ||
222 | In contrast to PCI, however, that address (a bus address) is | ||
223 | translated by IOMMU before a memory access is performed and therefore | ||
224 | it is virtual. Sun calls this procedure DVMA. | ||
225 | |||
226 | Linux supports two styles of using SBUS DVMA: "consistent memory" | ||
227 | and "streaming DVMA". CPU view of consistent memory chunk is, well, | ||
228 | consistent with a view of a device. Think of it as an uncached memory. | ||
229 | Typically this way of doing DVMA is not very fast and drivers use it | ||
230 | mostly for control blocks or queues. On some CPUs we cannot flush or | ||
231 | invalidate individual pages or cache lines and doing explicit flushing | ||
232 | over ever little byte in every control block would be wasteful. | ||
233 | |||
234 | Streaming DVMA is a preferred way to transfer large amounts of data. | ||
235 | This process works in the following way: | ||
236 | 1. a CPU stops accessing a certain part of memory, | ||
237 | flushes its caches covering that memory; | ||
238 | 2. a device does DVMA accesses, then posts an interrupt; | ||
239 | 3. CPU invalidates its caches and starts to access the memory. | ||
240 | |||
241 | A single streaming DVMA operation can touch several discontiguous | ||
242 | regions of a virtual bus address space. This is called a scatter-gather | ||
243 | DVMA. | ||
244 | |||
245 | [TBD: Why do not we neither Solaris attempt to map disjoint pages | ||
246 | into a single virtual chunk with the help of IOMMU, so that non SG | ||
247 | DVMA masters would do SG? It'd be very helpful for RAID.] | ||
248 | |||
249 | In order to perform a consistent DVMA a driver does something | ||
250 | like the following: | ||
251 | |||
252 | char *mem; /* Address in the CPU space */ | ||
253 | u32 busa; /* Address in the SBus space */ | ||
254 | |||
255 | mem = (char *) sbus_alloc_consistent(sdev, MYMEMSIZE, &busa); | ||
256 | |||
257 | Then mem is used when CPU accesses this memory and u32 | ||
258 | is fed to the device so that it can do DVMA. This is typically | ||
259 | done with an sbus_writel() into some device register. | ||
260 | |||
261 | Do not forget to free the DVMA resources once you are done: | ||
262 | |||
263 | sbus_free_consistent(sdev, MYMEMSIZE, mem, busa); | ||
264 | |||
265 | Streaming DVMA is more interesting. First you allocate some | ||
266 | memory suitable for it or pin down some user pages. Then it all works | ||
267 | like this: | ||
268 | |||
269 | char *mem = argumen1; | ||
270 | unsigned int size = argument2; | ||
271 | u32 busa; /* Address in the SBus space */ | ||
272 | |||
273 | *mem = 1; /* CPU can access */ | ||
274 | busa = sbus_map_single(sdev, mem, size); | ||
275 | if (busa == 0) ....... | ||
276 | |||
277 | /* Tell the device to use busa here */ | ||
278 | /* CPU cannot access the memory without sbus_dma_sync_single() */ | ||
279 | |||
280 | sbus_unmap_single(sdev, busa, size); | ||
281 | if (*mem == 0) .... /* CPU can access again */ | ||
282 | |||
283 | It is possible to retain mappings and ask the device to | ||
284 | access data again and again without calling sbus_unmap_single. | ||
285 | However, CPU caches must be invalidated with sbus_dma_sync_single | ||
286 | before such access. | ||
287 | |||
288 | [TBD but what about writeback caches here... do we have any?] | ||
289 | |||
290 | There is an equivalent set of functions doing the same thing | ||
291 | only with several memory segments at once for devices capable of | ||
292 | scatter-gather transfers. Use the Source, Luke. | ||
293 | |||
294 | Examples | ||
295 | |||
296 | drivers/net/sunhme.c | ||
297 | This is a complicated driver which illustrates many concepts | ||
298 | discussed above and plus it handles both PCI and SBUS boards. | ||
299 | |||
300 | drivers/scsi/esp.c | ||
301 | Check it out for scatter-gather DVMA. | ||
302 | |||
303 | drivers/sbus/char/bpp.c | ||
304 | A non-DVMA device. | ||
305 | |||
306 | drivers/net/sunlance.c | ||
307 | Lance driver abuses consistent mappings for data transfer. | ||
308 | It is a nifty trick which we do not particularly recommend... | ||
309 | Just check it out and know that it's legal. | ||
diff --git a/Documentation/sparse.txt b/Documentation/sparse.txt index 1a3bdc27d95e..42f43fa59f24 100644 --- a/Documentation/sparse.txt +++ b/Documentation/sparse.txt | |||
@@ -73,10 +73,10 @@ recompiled, or use "make C=2" to run sparse on the files whether they need to | |||
73 | be recompiled or not. The latter is a fast way to check the whole tree if you | 73 | be recompiled or not. The latter is a fast way to check the whole tree if you |
74 | have already built it. | 74 | have already built it. |
75 | 75 | ||
76 | The optional make variable CHECKFLAGS can be used to pass arguments to sparse. | 76 | The optional make variable CF can be used to pass arguments to sparse. The |
77 | The build system passes -Wbitwise to sparse automatically. To perform | 77 | build system passes -Wbitwise to sparse automatically. To perform endianness |
78 | endianness checks, you may define __CHECK_ENDIAN__: | 78 | checks, you may define __CHECK_ENDIAN__: |
79 | 79 | ||
80 | make C=2 CHECKFLAGS="-D__CHECK_ENDIAN__" | 80 | make C=2 CF="-D__CHECK_ENDIAN__" |
81 | 81 | ||
82 | These checks are disabled by default as they generate a host of warnings. | 82 | These checks are disabled by default as they generate a host of warnings. |
diff --git a/Documentation/specialix.txt b/Documentation/specialix.txt index 4a4b428ce8f6..6eb6f3a3331c 100644 --- a/Documentation/specialix.txt +++ b/Documentation/specialix.txt | |||
@@ -270,8 +270,8 @@ The pinout of the connectors on the IO8+ is: | |||
270 | Hardware handshaking issues. | 270 | Hardware handshaking issues. |
271 | ============================ | 271 | ============================ |
272 | 272 | ||
273 | The driver can be compiled in two different ways. The default | 273 | The driver can be told to operate in two different ways. The default |
274 | ("Specialix DTR/RTS pin is RTS" is off) the pin behaves as DTR when | 274 | behaviour is specialix.sx_rtscts = 0 where the pin behaves as DTR when |
275 | hardware handshaking is off. It behaves as the RTS hardware | 275 | hardware handshaking is off. It behaves as the RTS hardware |
276 | handshaking signal when hardware handshaking is selected. | 276 | handshaking signal when hardware handshaking is selected. |
277 | 277 | ||
@@ -280,7 +280,7 @@ cable will either be compatible with hardware handshaking or with | |||
280 | software handshaking. So switching on the fly is not really an | 280 | software handshaking. So switching on the fly is not really an |
281 | option. | 281 | option. |
282 | 282 | ||
283 | I actually prefer to use the "Specialix DTR/RTS pin is RTS" option. | 283 | I actually prefer to use the "specialix.sx_rtscts=1" option. |
284 | This makes the DTR/RTS pin always an RTS pin, and ioctls to | 284 | This makes the DTR/RTS pin always an RTS pin, and ioctls to |
285 | change DTR are always ignored. I have a cable that is configured | 285 | change DTR are always ignored. I have a cable that is configured |
286 | for this. | 286 | for this. |
@@ -379,7 +379,5 @@ it doesn't fit in your computer, bring back the card. | |||
379 | You have to WRITE to the address register to even | 379 | You have to WRITE to the address register to even |
380 | read-probe a CD186x register. Disable autodetection? | 380 | read-probe a CD186x register. Disable autodetection? |
381 | -- Specialix: any suggestions? | 381 | -- Specialix: any suggestions? |
382 | - Arbitrary baud rates are not implemented yet. | ||
383 | If you need this, bug me about it. | ||
384 | 382 | ||
385 | 383 | ||
diff --git a/Documentation/spi/Makefile b/Documentation/spi/Makefile new file mode 100644 index 000000000000..a5b03c88beae --- /dev/null +++ b/Documentation/spi/Makefile | |||
@@ -0,0 +1,11 @@ | |||
1 | # kbuild trick to avoid linker error. Can be omitted if a module is built. | ||
2 | obj- := dummy.o | ||
3 | |||
4 | # List of programs to build | ||
5 | hostprogs-y := spidev_test spidev_fdx | ||
6 | |||
7 | # Tell kbuild to always build the programs | ||
8 | always := $(hostprogs-y) | ||
9 | |||
10 | HOSTCFLAGS_spidev_test.o += -I$(objtree)/usr/include | ||
11 | HOSTCFLAGS_spidev_fdx.o += -I$(objtree)/usr/include | ||
diff --git a/Documentation/spi/pxa2xx b/Documentation/spi/pxa2xx index f3853cc37bde..6bb916d57c95 100644 --- a/Documentation/spi/pxa2xx +++ b/Documentation/spi/pxa2xx | |||
@@ -19,7 +19,7 @@ Declaring PXA2xx Master Controllers | |||
19 | ----------------------------------- | 19 | ----------------------------------- |
20 | Typically a SPI master is defined in the arch/.../mach-*/board-*.c as a | 20 | Typically a SPI master is defined in the arch/.../mach-*/board-*.c as a |
21 | "platform device". The master configuration is passed to the driver via a table | 21 | "platform device". The master configuration is passed to the driver via a table |
22 | found in include/asm-arm/arch-pxa/pxa2xx_spi.h: | 22 | found in arch/arm/mach-pxa/include/mach/pxa2xx_spi.h: |
23 | 23 | ||
24 | struct pxa2xx_spi_master { | 24 | struct pxa2xx_spi_master { |
25 | enum pxa_ssp_type ssp_type; | 25 | enum pxa_ssp_type ssp_type; |
@@ -94,9 +94,9 @@ using the "spi_board_info" structure found in "linux/spi/spi.h". See | |||
94 | 94 | ||
95 | Each slave device attached to the PXA must provide slave specific configuration | 95 | Each slave device attached to the PXA must provide slave specific configuration |
96 | information via the structure "pxa2xx_spi_chip" found in | 96 | information via the structure "pxa2xx_spi_chip" found in |
97 | "include/asm-arm/arch-pxa/pxa2xx_spi.h". The pxa2xx_spi master controller driver | 97 | "arch/arm/mach-pxa/include/mach/pxa2xx_spi.h". The pxa2xx_spi master controller driver |
98 | will uses the configuration whenever the driver communicates with the slave | 98 | will uses the configuration whenever the driver communicates with the slave |
99 | device. | 99 | device. All fields are optional. |
100 | 100 | ||
101 | struct pxa2xx_spi_chip { | 101 | struct pxa2xx_spi_chip { |
102 | u8 tx_threshold; | 102 | u8 tx_threshold; |
@@ -112,14 +112,17 @@ used to configure the SSP hardware fifo. These fields are critical to the | |||
112 | performance of pxa2xx_spi driver and misconfiguration will result in rx | 112 | performance of pxa2xx_spi driver and misconfiguration will result in rx |
113 | fifo overruns (especially in PIO mode transfers). Good default values are | 113 | fifo overruns (especially in PIO mode transfers). Good default values are |
114 | 114 | ||
115 | .tx_threshold = 12, | 115 | .tx_threshold = 8, |
116 | .rx_threshold = 4, | 116 | .rx_threshold = 8, |
117 | |||
118 | The range is 1 to 16 where zero indicates "use default". | ||
117 | 119 | ||
118 | The "pxa2xx_spi_chip.dma_burst_size" field is used to configure PXA2xx DMA | 120 | The "pxa2xx_spi_chip.dma_burst_size" field is used to configure PXA2xx DMA |
119 | engine and is related the "spi_device.bits_per_word" field. Read and understand | 121 | engine and is related the "spi_device.bits_per_word" field. Read and understand |
120 | the PXA2xx "Developer Manual" sections on the DMA controller and SSP Controllers | 122 | the PXA2xx "Developer Manual" sections on the DMA controller and SSP Controllers |
121 | to determine the correct value. An SSP configured for byte-wide transfers would | 123 | to determine the correct value. An SSP configured for byte-wide transfers would |
122 | use a value of 8. | 124 | use a value of 8. The driver will determine a reasonable default if |
125 | dma_burst_size == 0. | ||
123 | 126 | ||
124 | The "pxa2xx_spi_chip.timeout" fields is used to efficiently handle | 127 | The "pxa2xx_spi_chip.timeout" fields is used to efficiently handle |
125 | trailing bytes in the SSP receiver fifo. The correct value for this field is | 128 | trailing bytes in the SSP receiver fifo. The correct value for this field is |
@@ -137,7 +140,13 @@ function for asserting/deasserting a slave device chip select. If the field is | |||
137 | NULL, the pxa2xx_spi master controller driver assumes that the SSP port is | 140 | NULL, the pxa2xx_spi master controller driver assumes that the SSP port is |
138 | configured to use SSPFRM instead. | 141 | configured to use SSPFRM instead. |
139 | 142 | ||
140 | NSSP SALVE SAMPLE | 143 | NOTE: the SPI driver cannot control the chip select if SSPFRM is used, so the |
144 | chipselect is dropped after each spi_transfer. Most devices need chip select | ||
145 | asserted around the complete message. Use SSPFRM as a GPIO (through cs_control) | ||
146 | to accomodate these chips. | ||
147 | |||
148 | |||
149 | NSSP SLAVE SAMPLE | ||
141 | ----------------- | 150 | ----------------- |
142 | The pxa2xx_spi_chip structure is passed to the pxa2xx_spi driver in the | 151 | The pxa2xx_spi_chip structure is passed to the pxa2xx_spi driver in the |
143 | "spi_board_info.controller_data" field. Below is a sample configuration using | 152 | "spi_board_info.controller_data" field. Below is a sample configuration using |
@@ -206,18 +215,21 @@ static void __init streetracer_init(void) | |||
206 | 215 | ||
207 | DMA and PIO I/O Support | 216 | DMA and PIO I/O Support |
208 | ----------------------- | 217 | ----------------------- |
209 | The pxa2xx_spi driver support both DMA and interrupt driven PIO message | 218 | The pxa2xx_spi driver supports both DMA and interrupt driven PIO message |
210 | transfers. The driver defaults to PIO mode and DMA transfers must enabled by | 219 | transfers. The driver defaults to PIO mode and DMA transfers must be enabled |
211 | setting the "enable_dma" flag in the "pxa2xx_spi_master" structure and | 220 | by setting the "enable_dma" flag in the "pxa2xx_spi_master" structure. The DMA |
212 | ensuring that the "pxa2xx_spi_chip.dma_burst_size" field is non-zero. The DMA | 221 | mode supports both coherent and stream based DMA mappings. |
213 | mode support both coherent and stream based DMA mappings. | ||
214 | 222 | ||
215 | The following logic is used to determine the type of I/O to be used on | 223 | The following logic is used to determine the type of I/O to be used on |
216 | a per "spi_transfer" basis: | 224 | a per "spi_transfer" basis: |
217 | 225 | ||
218 | if !enable_dma or dma_burst_size == 0 then | 226 | if !enable_dma then |
219 | always use PIO transfers | 227 | always use PIO transfers |
220 | 228 | ||
229 | if spi_message.len > 8191 then | ||
230 | print "rate limited" warning | ||
231 | use PIO transfers | ||
232 | |||
221 | if spi_message.is_dma_mapped and rx_dma_buf != 0 and tx_dma_buf != 0 then | 233 | if spi_message.is_dma_mapped and rx_dma_buf != 0 and tx_dma_buf != 0 then |
222 | use coherent DMA mode | 234 | use coherent DMA mode |
223 | 235 | ||
diff --git a/Documentation/spi/spi-summary b/Documentation/spi/spi-summary index 6d5f18143c50..8bae2f018d34 100644 --- a/Documentation/spi/spi-summary +++ b/Documentation/spi/spi-summary | |||
@@ -210,7 +210,7 @@ board should normally be set up and registered. | |||
210 | 210 | ||
211 | So for example arch/.../mach-*/board-*.c files might have code like: | 211 | So for example arch/.../mach-*/board-*.c files might have code like: |
212 | 212 | ||
213 | #include <asm/arch/spi.h> /* for mysoc_spi_data */ | 213 | #include <mach/spi.h> /* for mysoc_spi_data */ |
214 | 214 | ||
215 | /* if your mach-* infrastructure doesn't support kernels that can | 215 | /* if your mach-* infrastructure doesn't support kernels that can |
216 | * run on multiple boards, pdata wouldn't benefit from "__init". | 216 | * run on multiple boards, pdata wouldn't benefit from "__init". |
@@ -227,7 +227,7 @@ So for example arch/.../mach-*/board-*.c files might have code like: | |||
227 | 227 | ||
228 | And SOC-specific utility code might look something like: | 228 | And SOC-specific utility code might look something like: |
229 | 229 | ||
230 | #include <asm/arch/spi.h> | 230 | #include <mach/spi.h> |
231 | 231 | ||
232 | static struct platform_device spi2 = { ... }; | 232 | static struct platform_device spi2 = { ... }; |
233 | 233 | ||
diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt index 276a7e637822..bde799e06598 100644 --- a/Documentation/sysctl/kernel.txt +++ b/Documentation/sysctl/kernel.txt | |||
@@ -351,9 +351,10 @@ kernel. This value defaults to SHMMAX. | |||
351 | 351 | ||
352 | softlockup_thresh: | 352 | softlockup_thresh: |
353 | 353 | ||
354 | This value can be used to lower the softlockup tolerance | 354 | This value can be used to lower the softlockup tolerance threshold. The |
355 | threshold. The default threshold is 10s. If a cpu is locked up | 355 | default threshold is 60 seconds. If a cpu is locked up for 60 seconds, |
356 | for 10s, the kernel complains. Valid values are 1-60s. | 356 | the kernel complains. Valid values are 1-60 seconds. Setting this |
357 | tunable to zero will disable the softlockup detection altogether. | ||
357 | 358 | ||
358 | ============================================================== | 359 | ============================================================== |
359 | 360 | ||
@@ -368,4 +369,5 @@ can be ORed together: | |||
368 | 2 - A module was force loaded by insmod -f. | 369 | 2 - A module was force loaded by insmod -f. |
369 | Set by modutils >= 2.4.9 and module-init-tools. | 370 | Set by modutils >= 2.4.9 and module-init-tools. |
370 | 4 - Unsafe SMP processors: SMP with CPUs not designed for SMP. | 371 | 4 - Unsafe SMP processors: SMP with CPUs not designed for SMP. |
372 | 64 - A module from drivers/staging was loaded. | ||
371 | 373 | ||
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt index 8a4863c4edd4..d79eeda7a699 100644 --- a/Documentation/sysctl/vm.txt +++ b/Documentation/sysctl/vm.txt | |||
@@ -116,7 +116,7 @@ of kilobytes free. The VM uses this number to compute a pages_min | |||
116 | value for each lowmem zone in the system. Each lowmem zone gets | 116 | value for each lowmem zone in the system. Each lowmem zone gets |
117 | a number of reserved free pages based proportionally on its size. | 117 | a number of reserved free pages based proportionally on its size. |
118 | 118 | ||
119 | Some minimal ammount of memory is needed to satisfy PF_MEMALLOC | 119 | Some minimal amount of memory is needed to satisfy PF_MEMALLOC |
120 | allocations; if you set this to lower than 1024KB, your system will | 120 | allocations; if you set this to lower than 1024KB, your system will |
121 | become subtly broken, and prone to deadlock under high loads. | 121 | become subtly broken, and prone to deadlock under high loads. |
122 | 122 | ||
diff --git a/Documentation/sysfs-rules.txt b/Documentation/sysfs-rules.txt index 80ef562160bb..6049a2a84dda 100644 --- a/Documentation/sysfs-rules.txt +++ b/Documentation/sysfs-rules.txt | |||
@@ -3,9 +3,8 @@ Rules on how to access information in the Linux kernel sysfs | |||
3 | The kernel-exported sysfs exports internal kernel implementation details | 3 | The kernel-exported sysfs exports internal kernel implementation details |
4 | and depends on internal kernel structures and layout. It is agreed upon | 4 | and depends on internal kernel structures and layout. It is agreed upon |
5 | by the kernel developers that the Linux kernel does not provide a stable | 5 | by the kernel developers that the Linux kernel does not provide a stable |
6 | internal API. As sysfs is a direct export of kernel internal | 6 | internal API. Therefore, there are aspects of the sysfs interface that |
7 | structures, the sysfs interface cannot provide a stable interface either; | 7 | may not be stable across kernel releases. |
8 | it may always change along with internal kernel changes. | ||
9 | 8 | ||
10 | To minimize the risk of breaking users of sysfs, which are in most cases | 9 | To minimize the risk of breaking users of sysfs, which are in most cases |
11 | low-level userspace applications, with a new kernel release, the users | 10 | low-level userspace applications, with a new kernel release, the users |
diff --git a/Documentation/sysrq.txt b/Documentation/sysrq.txt index 5ce0952aa065..10a0263ebb3f 100644 --- a/Documentation/sysrq.txt +++ b/Documentation/sysrq.txt | |||
@@ -95,7 +95,9 @@ On all - write a character to /proc/sysrq-trigger. e.g.: | |||
95 | 95 | ||
96 | 'p' - Will dump the current registers and flags to your console. | 96 | 'p' - Will dump the current registers and flags to your console. |
97 | 97 | ||
98 | 'q' - Will dump a list of all running timers. | 98 | 'q' - Will dump per CPU lists of all armed hrtimers (but NOT regular |
99 | timer_list timers) and detailed information about all | ||
100 | clockevent devices. | ||
99 | 101 | ||
100 | 'r' - Turns off keyboard raw mode and sets it to XLATE. | 102 | 'r' - Turns off keyboard raw mode and sets it to XLATE. |
101 | 103 | ||
diff --git a/Documentation/telephony/ixj.txt b/Documentation/telephony/ixj.txt index 621024fd3a18..44d124005bad 100644 --- a/Documentation/telephony/ixj.txt +++ b/Documentation/telephony/ixj.txt | |||
@@ -305,21 +305,14 @@ driver, like this: | |||
305 | 305 | ||
306 | which will result in the needed drivers getting loaded automatically. | 306 | which will result in the needed drivers getting loaded automatically. |
307 | 307 | ||
308 | g. if you are planning on using kerneld to automatically load the | 308 | g. if you are planning on having the kernel automatically request |
309 | module for you, then you need to edit /etc/conf.modules and add the | 309 | the module for you, then you need to edit /etc/conf.modules and add the |
310 | following lines: | 310 | following lines: |
311 | 311 | ||
312 | options ixj dspio=0x340 xio=0x330 ixjdebug=0 | 312 | options ixj dspio=0x340 xio=0x330 ixjdebug=0 |
313 | 313 | ||
314 | If you do this, then when you execute an application that uses the | 314 | If you do this, then when you execute an application that uses the |
315 | module kerneld will load the module for you. Note that to do this, | 315 | module the kernel will request that it is loaded. |
316 | you need to have your kernel set to support kerneld. You can check | ||
317 | for this by looking at /usr/src/linux/.config and you should see this: | ||
318 | |||
319 | # Loadable module support | ||
320 | # | ||
321 | <snip> | ||
322 | CONFIG_KMOD=y | ||
323 | 316 | ||
324 | h. if you want non-root users to be able to read and write to the | 317 | h. if you want non-root users to be able to read and write to the |
325 | ixj devices (this is a good idea!) you should do the following: | 318 | ixj devices (this is a good idea!) you should do the following: |
diff --git a/Documentation/timers/00-INDEX b/Documentation/timers/00-INDEX new file mode 100644 index 000000000000..397dc35e1323 --- /dev/null +++ b/Documentation/timers/00-INDEX | |||
@@ -0,0 +1,10 @@ | |||
1 | 00-INDEX | ||
2 | - this file | ||
3 | highres.txt | ||
4 | - High resolution timers and dynamic ticks design notes | ||
5 | hpet.txt | ||
6 | - High Precision Event Timer Driver for Linux | ||
7 | hrtimers.txt | ||
8 | - subsystem for high-resolution kernel timers | ||
9 | timer_stats.txt | ||
10 | - timer usage statistics | ||
diff --git a/Documentation/timers/highres.txt b/Documentation/timers/highres.txt index a73ecf5b4bdb..21332233cef1 100644 --- a/Documentation/timers/highres.txt +++ b/Documentation/timers/highres.txt | |||
@@ -125,7 +125,7 @@ increase of flexibility and the avoidance of duplicated code across | |||
125 | architectures justifies the slight increase of the binary size. | 125 | architectures justifies the slight increase of the binary size. |
126 | 126 | ||
127 | The conversion of an architecture has no functional impact, but allows to | 127 | The conversion of an architecture has no functional impact, but allows to |
128 | utilize the high resolution and dynamic tick functionalites without any change | 128 | utilize the high resolution and dynamic tick functionalities without any change |
129 | to the clock event device and timer interrupt code. After the conversion the | 129 | to the clock event device and timer interrupt code. After the conversion the |
130 | enabling of high resolution timers and dynamic ticks is simply provided by | 130 | enabling of high resolution timers and dynamic ticks is simply provided by |
131 | adding the kernel/time/Kconfig file to the architecture specific Kconfig and | 131 | adding the kernel/time/Kconfig file to the architecture specific Kconfig and |
diff --git a/Documentation/hpet.txt b/Documentation/timers/hpet.txt index 6ad52d9dad6c..e7c09abcfab4 100644 --- a/Documentation/hpet.txt +++ b/Documentation/timers/hpet.txt | |||
@@ -1,21 +1,32 @@ | |||
1 | High Precision Event Timer Driver for Linux | 1 | High Precision Event Timer Driver for Linux |
2 | 2 | ||
3 | The High Precision Event Timer (HPET) hardware is the future replacement | 3 | The High Precision Event Timer (HPET) hardware follows a specification |
4 | for the 8254 and Real Time Clock (RTC) periodic timer functionality. | 4 | by Intel and Microsoft which can be found at |
5 | Each HPET can have up to 32 timers. It is possible to configure the | 5 | |
6 | first two timers as legacy replacements for 8254 and RTC periodic timers. | 6 | http://www.intel.com/technology/architecture/hpetspec.htm |
7 | A specification done by Intel and Microsoft can be found at | 7 | |
8 | <http://www.intel.com/technology/architecture/hpetspec.htm>. | 8 | Each HPET has one fixed-rate counter (at 10+ MHz, hence "High Precision") |
9 | and up to 32 comparators. Normally three or more comparators are provided, | ||
10 | each of which can generate oneshot interupts and at least one of which has | ||
11 | additional hardware to support periodic interrupts. The comparators are | ||
12 | also called "timers", which can be misleading since usually timers are | ||
13 | independent of each other ... these share a counter, complicating resets. | ||
14 | |||
15 | HPET devices can support two interrupt routing modes. In one mode, the | ||
16 | comparators are additional interrupt sources with no particular system | ||
17 | role. Many x86 BIOS writers don't route HPET interrupts at all, which | ||
18 | prevents use of that mode. They support the other "legacy replacement" | ||
19 | mode where the first two comparators block interrupts from 8254 timers | ||
20 | and from the RTC. | ||
9 | 21 | ||
10 | The driver supports detection of HPET driver allocation and initialization | 22 | The driver supports detection of HPET driver allocation and initialization |
11 | of the HPET before the driver module_init routine is called. This enables | 23 | of the HPET before the driver module_init routine is called. This enables |
12 | platform code which uses timer 0 or 1 as the main timer to intercept HPET | 24 | platform code which uses timer 0 or 1 as the main timer to intercept HPET |
13 | initialization. An example of this initialization can be found in | 25 | initialization. An example of this initialization can be found in |
14 | arch/i386/kernel/time_hpet.c. | 26 | arch/x86/kernel/hpet.c. |
15 | 27 | ||
16 | The driver provides two APIs which are very similar to the API found in | 28 | The driver provides a userspace API which resembles the API found in the |
17 | the rtc.c driver. There is a user space API and a kernel space API. | 29 | RTC driver framework. An example user space program is provided below. |
18 | An example user space program is provided below. | ||
19 | 30 | ||
20 | #include <stdio.h> | 31 | #include <stdio.h> |
21 | #include <stdlib.h> | 32 | #include <stdlib.h> |
@@ -286,15 +297,3 @@ out: | |||
286 | 297 | ||
287 | return; | 298 | return; |
288 | } | 299 | } |
289 | |||
290 | The kernel API has three interfaces exported from the driver: | ||
291 | |||
292 | hpet_register(struct hpet_task *tp, int periodic) | ||
293 | hpet_unregister(struct hpet_task *tp) | ||
294 | hpet_control(struct hpet_task *tp, unsigned int cmd, unsigned long arg) | ||
295 | |||
296 | The kernel module using this interface fills in the ht_func and ht_data | ||
297 | members of the hpet_task structure before calling hpet_register. | ||
298 | hpet_control simply vectors to the hpet_ioctl routine and has the same | ||
299 | commands and respective arguments as the user API. hpet_unregister | ||
300 | is used to terminate usage of the HPET timer reserved by hpet_register. | ||
diff --git a/Documentation/tracepoints.txt b/Documentation/tracepoints.txt new file mode 100644 index 000000000000..5d354e167494 --- /dev/null +++ b/Documentation/tracepoints.txt | |||
@@ -0,0 +1,101 @@ | |||
1 | Using the Linux Kernel Tracepoints | ||
2 | |||
3 | Mathieu Desnoyers | ||
4 | |||
5 | |||
6 | This document introduces Linux Kernel Tracepoints and their use. It provides | ||
7 | examples of how to insert tracepoints in the kernel and connect probe functions | ||
8 | to them and provides some examples of probe functions. | ||
9 | |||
10 | |||
11 | * Purpose of tracepoints | ||
12 | |||
13 | A tracepoint placed in code provides a hook to call a function (probe) that you | ||
14 | can provide at runtime. A tracepoint can be "on" (a probe is connected to it) or | ||
15 | "off" (no probe is attached). When a tracepoint is "off" it has no effect, | ||
16 | except for adding a tiny time penalty (checking a condition for a branch) and | ||
17 | space penalty (adding a few bytes for the function call at the end of the | ||
18 | instrumented function and adds a data structure in a separate section). When a | ||
19 | tracepoint is "on", the function you provide is called each time the tracepoint | ||
20 | is executed, in the execution context of the caller. When the function provided | ||
21 | ends its execution, it returns to the caller (continuing from the tracepoint | ||
22 | site). | ||
23 | |||
24 | You can put tracepoints at important locations in the code. They are | ||
25 | lightweight hooks that can pass an arbitrary number of parameters, | ||
26 | which prototypes are described in a tracepoint declaration placed in a header | ||
27 | file. | ||
28 | |||
29 | They can be used for tracing and performance accounting. | ||
30 | |||
31 | |||
32 | * Usage | ||
33 | |||
34 | Two elements are required for tracepoints : | ||
35 | |||
36 | - A tracepoint definition, placed in a header file. | ||
37 | - The tracepoint statement, in C code. | ||
38 | |||
39 | In order to use tracepoints, you should include linux/tracepoint.h. | ||
40 | |||
41 | In include/trace/subsys.h : | ||
42 | |||
43 | #include <linux/tracepoint.h> | ||
44 | |||
45 | DEFINE_TRACE(subsys_eventname, | ||
46 | TPPTOTO(int firstarg, struct task_struct *p), | ||
47 | TPARGS(firstarg, p)); | ||
48 | |||
49 | In subsys/file.c (where the tracing statement must be added) : | ||
50 | |||
51 | #include <trace/subsys.h> | ||
52 | |||
53 | void somefct(void) | ||
54 | { | ||
55 | ... | ||
56 | trace_subsys_eventname(arg, task); | ||
57 | ... | ||
58 | } | ||
59 | |||
60 | Where : | ||
61 | - subsys_eventname is an identifier unique to your event | ||
62 | - subsys is the name of your subsystem. | ||
63 | - eventname is the name of the event to trace. | ||
64 | - TPPTOTO(int firstarg, struct task_struct *p) is the prototype of the function | ||
65 | called by this tracepoint. | ||
66 | - TPARGS(firstarg, p) are the parameters names, same as found in the prototype. | ||
67 | |||
68 | Connecting a function (probe) to a tracepoint is done by providing a probe | ||
69 | (function to call) for the specific tracepoint through | ||
70 | register_trace_subsys_eventname(). Removing a probe is done through | ||
71 | unregister_trace_subsys_eventname(); it will remove the probe sure there is no | ||
72 | caller left using the probe when it returns. Probe removal is preempt-safe | ||
73 | because preemption is disabled around the probe call. See the "Probe example" | ||
74 | section below for a sample probe module. | ||
75 | |||
76 | The tracepoint mechanism supports inserting multiple instances of the same | ||
77 | tracepoint, but a single definition must be made of a given tracepoint name over | ||
78 | all the kernel to make sure no type conflict will occur. Name mangling of the | ||
79 | tracepoints is done using the prototypes to make sure typing is correct. | ||
80 | Verification of probe type correctness is done at the registration site by the | ||
81 | compiler. Tracepoints can be put in inline functions, inlined static functions, | ||
82 | and unrolled loops as well as regular functions. | ||
83 | |||
84 | The naming scheme "subsys_event" is suggested here as a convention intended | ||
85 | to limit collisions. Tracepoint names are global to the kernel: they are | ||
86 | considered as being the same whether they are in the core kernel image or in | ||
87 | modules. | ||
88 | |||
89 | |||
90 | * Probe / tracepoint example | ||
91 | |||
92 | See the example provided in samples/tracepoints/src | ||
93 | |||
94 | Compile them with your kernel. | ||
95 | |||
96 | Run, as root : | ||
97 | modprobe tracepoint-example (insmod order is not important) | ||
98 | modprobe tracepoint-probe-example | ||
99 | cat /proc/tracepoint-example (returns an expected error) | ||
100 | rmmod tracepoint-example tracepoint-probe-example | ||
101 | dmesg | ||
diff --git a/Documentation/tracers/mmiotrace.txt b/Documentation/tracers/mmiotrace.txt index a4afb560a45b..5bbbe2096223 100644 --- a/Documentation/tracers/mmiotrace.txt +++ b/Documentation/tracers/mmiotrace.txt | |||
@@ -36,7 +36,7 @@ $ mount -t debugfs debugfs /debug | |||
36 | $ echo mmiotrace > /debug/tracing/current_tracer | 36 | $ echo mmiotrace > /debug/tracing/current_tracer |
37 | $ cat /debug/tracing/trace_pipe > mydump.txt & | 37 | $ cat /debug/tracing/trace_pipe > mydump.txt & |
38 | Start X or whatever. | 38 | Start X or whatever. |
39 | $ echo "X is up" > /debug/tracing/marker | 39 | $ echo "X is up" > /debug/tracing/trace_marker |
40 | $ echo none > /debug/tracing/current_tracer | 40 | $ echo none > /debug/tracing/current_tracer |
41 | Check for lost events. | 41 | Check for lost events. |
42 | 42 | ||
@@ -59,9 +59,8 @@ The 'cat' process should stay running (sleeping) in the background. | |||
59 | Load the driver you want to trace and use it. Mmiotrace will only catch MMIO | 59 | Load the driver you want to trace and use it. Mmiotrace will only catch MMIO |
60 | accesses to areas that are ioremapped while mmiotrace is active. | 60 | accesses to areas that are ioremapped while mmiotrace is active. |
61 | 61 | ||
62 | [Unimplemented feature:] | ||
63 | During tracing you can place comments (markers) into the trace by | 62 | During tracing you can place comments (markers) into the trace by |
64 | $ echo "X is up" > /debug/tracing/marker | 63 | $ echo "X is up" > /debug/tracing/trace_marker |
65 | This makes it easier to see which part of the (huge) trace corresponds to | 64 | This makes it easier to see which part of the (huge) trace corresponds to |
66 | which action. It is recommended to place descriptive markers about what you | 65 | which action. It is recommended to place descriptive markers about what you |
67 | do. | 66 | do. |
diff --git a/Documentation/unaligned-memory-access.txt b/Documentation/unaligned-memory-access.txt index b0472ac5226a..f866c72291bf 100644 --- a/Documentation/unaligned-memory-access.txt +++ b/Documentation/unaligned-memory-access.txt | |||
@@ -218,9 +218,35 @@ If use of such macros is not convenient, another option is to use memcpy(), | |||
218 | where the source or destination (or both) are of type u8* or unsigned char*. | 218 | where the source or destination (or both) are of type u8* or unsigned char*. |
219 | Due to the byte-wise nature of this operation, unaligned accesses are avoided. | 219 | Due to the byte-wise nature of this operation, unaligned accesses are avoided. |
220 | 220 | ||
221 | |||
222 | Alignment vs. Networking | ||
223 | ======================== | ||
224 | |||
225 | On architectures that require aligned loads, networking requires that the IP | ||
226 | header is aligned on a four-byte boundary to optimise the IP stack. For | ||
227 | regular ethernet hardware, the constant NET_IP_ALIGN is used. On most | ||
228 | architectures this constant has the value 2 because the normal ethernet | ||
229 | header is 14 bytes long, so in order to get proper alignment one needs to | ||
230 | DMA to an address which can be expressed as 4*n + 2. One notable exception | ||
231 | here is powerpc which defines NET_IP_ALIGN to 0 because DMA to unaligned | ||
232 | addresses can be very expensive and dwarf the cost of unaligned loads. | ||
233 | |||
234 | For some ethernet hardware that cannot DMA to unaligned addresses like | ||
235 | 4*n+2 or non-ethernet hardware, this can be a problem, and it is then | ||
236 | required to copy the incoming frame into an aligned buffer. Because this is | ||
237 | unnecessary on architectures that can do unaligned accesses, the code can be | ||
238 | made dependent on CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS like so: | ||
239 | |||
240 | #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS | ||
241 | skb = original skb | ||
242 | #else | ||
243 | skb = copy skb | ||
244 | #endif | ||
245 | |||
221 | -- | 246 | -- |
222 | Author: Daniel Drake <dsd@gentoo.org> | 247 | Authors: Daniel Drake <dsd@gentoo.org>, |
248 | Johannes Berg <johannes@sipsolutions.net> | ||
223 | With help from: Alan Cox, Avuton Olrich, Heikki Orsila, Jan Engelhardt, | 249 | With help from: Alan Cox, Avuton Olrich, Heikki Orsila, Jan Engelhardt, |
224 | Johannes Berg, Kyle McMartin, Kyle Moffett, Randy Dunlap, Robert Hancock, | 250 | Kyle McMartin, Kyle Moffett, Randy Dunlap, Robert Hancock, Uli Kunitz, |
225 | Uli Kunitz, Vadim Lobanov | 251 | Vadim Lobanov |
226 | 252 | ||
diff --git a/Documentation/usb/WUSB-Design-overview.txt b/Documentation/usb/WUSB-Design-overview.txt new file mode 100644 index 000000000000..4c3d62c7843a --- /dev/null +++ b/Documentation/usb/WUSB-Design-overview.txt | |||
@@ -0,0 +1,448 @@ | |||
1 | |||
2 | Linux UWB + Wireless USB + WiNET | ||
3 | |||
4 | (C) 2005-2006 Intel Corporation | ||
5 | Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> | ||
6 | |||
7 | This program is free software; you can redistribute it and/or | ||
8 | modify it under the terms of the GNU General Public License version | ||
9 | 2 as published by the Free Software Foundation. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
19 | 02110-1301, USA. | ||
20 | |||
21 | |||
22 | Please visit http://bughost.org/thewiki/Design-overview.txt-1.8 for | ||
23 | updated content. | ||
24 | |||
25 | * Design-overview.txt-1.8 | ||
26 | |||
27 | This code implements a Ultra Wide Band stack for Linux, as well as | ||
28 | drivers for the the USB based UWB radio controllers defined in the | ||
29 | Wireless USB 1.0 specification (including Wireless USB host controller | ||
30 | and an Intel WiNET controller). | ||
31 | |||
32 | 1. Introduction | ||
33 | 1. HWA: Host Wire adapters, your Wireless USB dongle | ||
34 | |||
35 | 2. DWA: Device Wired Adaptor, a Wireless USB hub for wired | ||
36 | devices | ||
37 | 3. WHCI: Wireless Host Controller Interface, the PCI WUSB host | ||
38 | adapter | ||
39 | 2. The UWB stack | ||
40 | 1. Devices and hosts: the basic structure | ||
41 | |||
42 | 2. Host Controller life cycle | ||
43 | |||
44 | 3. On the air: beacons and enumerating the radio neighborhood | ||
45 | |||
46 | 4. Device lists | ||
47 | 5. Bandwidth allocation | ||
48 | |||
49 | 3. Wireless USB Host Controller drivers | ||
50 | |||
51 | 4. Glossary | ||
52 | |||
53 | |||
54 | Introduction | ||
55 | |||
56 | UWB is a wide-band communication protocol that is to serve also as the | ||
57 | low-level protocol for others (much like TCP sits on IP). Currently | ||
58 | these others are Wireless USB and TCP/IP, but seems Bluetooth and | ||
59 | Firewire/1394 are coming along. | ||
60 | |||
61 | UWB uses a band from roughly 3 to 10 GHz, transmitting at a max of | ||
62 | ~-41dB (or 0.074 uW/MHz--geography specific data is still being | ||
63 | negotiated w/ regulators, so watch for changes). That band is divided in | ||
64 | a bunch of ~1.5 GHz wide channels (or band groups) composed of three | ||
65 | subbands/subchannels (528 MHz each). Each channel is independent of each | ||
66 | other, so you could consider them different "busses". Initially this | ||
67 | driver considers them all a single one. | ||
68 | |||
69 | Radio time is divided in 65536 us long /superframes/, each one divided | ||
70 | in 256 256us long /MASs/ (Media Allocation Slots), which are the basic | ||
71 | time/media allocation units for transferring data. At the beginning of | ||
72 | each superframe there is a Beacon Period (BP), where every device | ||
73 | transmit its beacon on a single MAS. The length of the BP depends on how | ||
74 | many devices are present and the length of their beacons. | ||
75 | |||
76 | Devices have a MAC (fixed, 48 bit address) and a device (changeable, 16 | ||
77 | bit address) and send periodic beacons to advertise themselves and pass | ||
78 | info on what they are and do. They advertise their capabilities and a | ||
79 | bunch of other stuff. | ||
80 | |||
81 | The different logical parts of this driver are: | ||
82 | |||
83 | * | ||
84 | |||
85 | *UWB*: the Ultra-Wide-Band stack -- manages the radio and | ||
86 | associated spectrum to allow for devices sharing it. Allows to | ||
87 | control bandwidth assingment, beaconing, scanning, etc | ||
88 | |||
89 | * | ||
90 | |||
91 | *WUSB*: the layer that sits on top of UWB to provide Wireless USB. | ||
92 | The Wireless USB spec defines means to control a UWB radio and to | ||
93 | do the actual WUSB. | ||
94 | |||
95 | |||
96 | HWA: Host Wire adapters, your Wireless USB dongle | ||
97 | |||
98 | WUSB also defines a device called a Host Wire Adaptor (HWA), which in | ||
99 | mere terms is a USB dongle that enables your PC to have UWB and Wireless | ||
100 | USB. The Wireless USB Host Controller in a HWA looks to the host like a | ||
101 | [Wireless] USB controller connected via USB (!) | ||
102 | |||
103 | The HWA itself is broken in two or three main interfaces: | ||
104 | |||
105 | * | ||
106 | |||
107 | *RC*: Radio control -- this implements an interface to the | ||
108 | Ultra-Wide-Band radio controller. The driver for this implements a | ||
109 | USB-based UWB Radio Controller to the UWB stack. | ||
110 | |||
111 | * | ||
112 | |||
113 | *HC*: the wireless USB host controller. It looks like a USB host | ||
114 | whose root port is the radio and the WUSB devices connect to it. | ||
115 | To the system it looks like a separate USB host. The driver (will) | ||
116 | implement a USB host controller (similar to UHCI, OHCI or EHCI) | ||
117 | for which the root hub is the radio...To reiterate: it is a USB | ||
118 | controller that is connected via USB instead of PCI. | ||
119 | |||
120 | * | ||
121 | |||
122 | *WINET*: some HW provide a WiNET interface (IP over UWB). This | ||
123 | package provides a driver for it (it looks like a network | ||
124 | interface, winetX). The driver detects when there is a link up for | ||
125 | their type and kick into gear. | ||
126 | |||
127 | |||
128 | DWA: Device Wired Adaptor, a Wireless USB hub for wired devices | ||
129 | |||
130 | These are the complement to HWAs. They are a USB host for connecting | ||
131 | wired devices, but it is connected to your PC connected via Wireless | ||
132 | USB. To the system it looks like yet another USB host. To the untrained | ||
133 | eye, it looks like a hub that connects upstream wirelessly. | ||
134 | |||
135 | We still offer no support for this; however, it should share a lot of | ||
136 | code with the HWA-RC driver; there is a bunch of factorization work that | ||
137 | has been done to support that in upcoming releases. | ||
138 | |||
139 | |||
140 | WHCI: Wireless Host Controller Interface, the PCI WUSB host adapter | ||
141 | |||
142 | This is your usual PCI device that implements WHCI. Similar in concept | ||
143 | to EHCI, it allows your wireless USB devices (including DWAs) to connect | ||
144 | to your host via a PCI interface. As in the case of the HWA, it has a | ||
145 | Radio Control interface and the WUSB Host Controller interface per se. | ||
146 | |||
147 | There is still no driver support for this, but will be in upcoming | ||
148 | releases. | ||
149 | |||
150 | |||
151 | The UWB stack | ||
152 | |||
153 | The main mission of the UWB stack is to keep a tally of which devices | ||
154 | are in radio proximity to allow drivers to connect to them. As well, it | ||
155 | provides an API for controlling the local radio controllers (RCs from | ||
156 | now on), such as to start/stop beaconing, scan, allocate bandwidth, etc. | ||
157 | |||
158 | |||
159 | Devices and hosts: the basic structure | ||
160 | |||
161 | The main building block here is the UWB device (struct uwb_dev). For | ||
162 | each device that pops up in radio presence (ie: the UWB host receives a | ||
163 | beacon from it) you get a struct uwb_dev that will show up in | ||
164 | /sys/class/uwb and in /sys/bus/uwb/devices. | ||
165 | |||
166 | For each RC that is detected, a new struct uwb_rc is created. In turn, a | ||
167 | RC is also a device, so they also show in /sys/class/uwb and | ||
168 | /sys/bus/uwb/devices, but at the same time, only radio controllers show | ||
169 | up in /sys/class/uwb_rc. | ||
170 | |||
171 | * | ||
172 | |||
173 | [*] The reason for RCs being also devices is that not only we can | ||
174 | see them while enumerating the system device tree, but also on the | ||
175 | radio (their beacons and stuff), so the handling has to be | ||
176 | likewise to that of a device. | ||
177 | |||
178 | Each RC driver is implemented by a separate driver that plugs into the | ||
179 | interface that the UWB stack provides through a struct uwb_rc_ops. The | ||
180 | spec creators have been nice enough to make the message format the same | ||
181 | for HWA and WHCI RCs, so the driver is really a very thin transport that | ||
182 | moves the requests from the UWB API to the device [/uwb_rc_ops->cmd()/] | ||
183 | and sends the replies and notifications back to the API | ||
184 | [/uwb_rc_neh_grok()/]. Notifications are handled to the UWB daemon, that | ||
185 | is chartered, among other things, to keep the tab of how the UWB radio | ||
186 | neighborhood looks, creating and destroying devices as they show up or | ||
187 | dissapear. | ||
188 | |||
189 | Command execution is very simple: a command block is sent and a event | ||
190 | block or reply is expected back. For sending/receiving command/events, a | ||
191 | handle called /neh/ (Notification/Event Handle) is opened with | ||
192 | /uwb_rc_neh_open()/. | ||
193 | |||
194 | The HWA-RC (USB dongle) driver (drivers/uwb/hwa-rc.c) does this job for | ||
195 | the USB connected HWA. Eventually, drivers/whci-rc.c will do the same | ||
196 | for the PCI connected WHCI controller. | ||
197 | |||
198 | |||
199 | Host Controller life cycle | ||
200 | |||
201 | So let's say we connect a dongle to the system: it is detected and | ||
202 | firmware uploaded if needed [for Intel's i1480 | ||
203 | /drivers/uwb/ptc/usb.c:ptc_usb_probe()/] and then it is reenumerated. | ||
204 | Now we have a real HWA device connected and | ||
205 | /drivers/uwb/hwa-rc.c:hwarc_probe()/ picks it up, that will set up the | ||
206 | Wire-Adaptor environment and then suck it into the UWB stack's vision of | ||
207 | the world [/drivers/uwb/lc-rc.c:uwb_rc_add()/]. | ||
208 | |||
209 | * | ||
210 | |||
211 | [*] The stack should put a new RC to scan for devices | ||
212 | [/uwb_rc_scan()/] so it finds what's available around and tries to | ||
213 | connect to them, but this is policy stuff and should be driven | ||
214 | from user space. As of now, the operator is expected to do it | ||
215 | manually; see the release notes for documentation on the procedure. | ||
216 | |||
217 | When a dongle is disconnected, /drivers/uwb/hwa-rc.c:hwarc_disconnect()/ | ||
218 | takes time of tearing everything down safely (or not...). | ||
219 | |||
220 | |||
221 | On the air: beacons and enumerating the radio neighborhood | ||
222 | |||
223 | So assuming we have devices and we have agreed for a channel to connect | ||
224 | on (let's say 9), we put the new RC to beacon: | ||
225 | |||
226 | * | ||
227 | |||
228 | $ echo 9 0 > /sys/class/uwb_rc/uwb0/beacon | ||
229 | |||
230 | Now it is visible. If there were other devices in the same radio channel | ||
231 | and beacon group (that's what the zero is for), the dongle's radio | ||
232 | control interface will send beacon notifications on its | ||
233 | notification/event endpoint (NEEP). The beacon notifications are part of | ||
234 | the event stream that is funneled into the API with | ||
235 | /drivers/uwb/neh.c:uwb_rc_neh_grok()/ and delivered to the UWBD, the UWB | ||
236 | daemon through a notification list. | ||
237 | |||
238 | UWBD wakes up and scans the event list; finds a beacon and adds it to | ||
239 | the BEACON CACHE (/uwb_beca/). If he receives a number of beacons from | ||
240 | the same device, he considers it to be 'onair' and creates a new device | ||
241 | [/drivers/uwb/lc-dev.c:uwbd_dev_onair()/]. Similarly, when no beacons | ||
242 | are received in some time, the device is considered gone and wiped out | ||
243 | [uwbd calls periodically /uwb/beacon.c:uwb_beca_purge()/ that will purge | ||
244 | the beacon cache of dead devices]. | ||
245 | |||
246 | |||
247 | Device lists | ||
248 | |||
249 | All UWB devices are kept in the list of the struct bus_type uwb_bus. | ||
250 | |||
251 | |||
252 | Bandwidth allocation | ||
253 | |||
254 | The UWB stack maintains a local copy of DRP availability through | ||
255 | processing of incoming *DRP Availability Change* notifications. This | ||
256 | local copy is currently used to present the current bandwidth | ||
257 | availability to the user through the sysfs file | ||
258 | /sys/class/uwb_rc/uwbx/bw_avail. In the future the bandwidth | ||
259 | availability information will be used by the bandwidth reservation | ||
260 | routines. | ||
261 | |||
262 | The bandwidth reservation routines are in progress and are thus not | ||
263 | present in the current release. When completed they will enable a user | ||
264 | to initiate DRP reservation requests through interaction with sysfs. DRP | ||
265 | reservation requests from remote UWB devices will also be handled. The | ||
266 | bandwidth management done by the UWB stack will include callbacks to the | ||
267 | higher layers will enable the higher layers to use the reservations upon | ||
268 | completion. [Note: The bandwidth reservation work is in progress and | ||
269 | subject to change.] | ||
270 | |||
271 | |||
272 | Wireless USB Host Controller drivers | ||
273 | |||
274 | *WARNING* This section needs a lot of work! | ||
275 | |||
276 | As explained above, there are three different types of HCs in the WUSB | ||
277 | world: HWA-HC, DWA-HC and WHCI-HC. | ||
278 | |||
279 | HWA-HC and DWA-HC share that they are Wire-Adapters (USB or WUSB | ||
280 | connected controllers), and their transfer management system is almost | ||
281 | identical. So is their notification delivery system. | ||
282 | |||
283 | HWA-HC and WHCI-HC share that they are both WUSB host controllers, so | ||
284 | they have to deal with WUSB device life cycle and maintenance, wireless | ||
285 | root-hub | ||
286 | |||
287 | HWA exposes a Host Controller interface (HWA-HC 0xe0/02/02). This has | ||
288 | three endpoints (Notifications, Data Transfer In and Data Transfer | ||
289 | Out--known as NEP, DTI and DTO in the code). | ||
290 | |||
291 | We reserve UWB bandwidth for our Wireless USB Cluster, create a Cluster | ||
292 | ID and tell the HC to use all that. Then we start it. This means the HC | ||
293 | starts sending MMCs. | ||
294 | |||
295 | * | ||
296 | |||
297 | The MMCs are blocks of data defined somewhere in the WUSB1.0 spec | ||
298 | that define a stream in the UWB channel time allocated for sending | ||
299 | WUSB IEs (host to device commands/notifications) and Device | ||
300 | Notifications (device initiated to host). Each host defines a | ||
301 | unique Wireless USB cluster through MMCs. Devices can connect to a | ||
302 | single cluster at the time. The IEs are Information Elements, and | ||
303 | among them are the bandwidth allocations that tell each device | ||
304 | when can they transmit or receive. | ||
305 | |||
306 | Now it all depends on external stimuli. | ||
307 | |||
308 | *New device connection* | ||
309 | |||
310 | A new device pops up, it scans the radio looking for MMCs that give out | ||
311 | the existence of Wireless USB channels. Once one (or more) are found, | ||
312 | selects which one to connect to. Sends a /DN_Connect/ (device | ||
313 | notification connect) during the DNTS (Device Notification Time | ||
314 | Slot--announced in the MMCs | ||
315 | |||
316 | HC picks the /DN_Connect/ out (nep module sends to notif.c for delivery | ||
317 | into /devconnect/). This process starts the authentication process for | ||
318 | the device. First we allocate a /fake port/ and assign an | ||
319 | unauthenticated address (128 to 255--what we really do is | ||
320 | 0x80 | fake_port_idx). We fiddle with the fake port status and /khubd/ | ||
321 | sees a new connection, so he moves on to enable the fake port with a reset. | ||
322 | |||
323 | So now we are in the reset path -- we know we have a non-yet enumerated | ||
324 | device with an unauthorized address; we ask user space to authenticate | ||
325 | (FIXME: not yet done, similar to bluetooth pairing), then we do the key | ||
326 | exchange (FIXME: not yet done) and issue a /set address 0/ to bring the | ||
327 | device to the default state. Device is authenticated. | ||
328 | |||
329 | From here, the USB stack takes control through the usb_hcd ops. khubd | ||
330 | has seen the port status changes, as we have been toggling them. It will | ||
331 | start enumerating and doing transfers through usb_hcd->urb_enqueue() to | ||
332 | read descriptors and move our data. | ||
333 | |||
334 | *Device life cycle and keep alives* | ||
335 | |||
336 | Everytime there is a succesful transfer to/from a device, we update a | ||
337 | per-device activity timestamp. If not, every now and then we check and | ||
338 | if the activity timestamp gets old, we ping the device by sending it a | ||
339 | Keep Alive IE; it responds with a /DN_Alive/ pong during the DNTS (this | ||
340 | arrives to us as a notification through | ||
341 | devconnect.c:wusb_handle_dn_alive(). If a device times out, we | ||
342 | disconnect it from the system (cleaning up internal information and | ||
343 | toggling the bits in the fake hub port, which kicks khubd into removing | ||
344 | the rest of the stuff). | ||
345 | |||
346 | This is done through devconnect:__wusb_check_devs(), which will scan the | ||
347 | device list looking for whom needs refreshing. | ||
348 | |||
349 | If the device wants to disconnect, it will either die (ugly) or send a | ||
350 | /DN_Disconnect/ that will prompt a disconnection from the system. | ||
351 | |||
352 | *Sending and receiving data* | ||
353 | |||
354 | Data is sent and received through /Remote Pipes/ (rpipes). An rpipe is | ||
355 | /aimed/ at an endpoint in a WUSB device. This is the same for HWAs and | ||
356 | DWAs. | ||
357 | |||
358 | Each HC has a number of rpipes and buffers that can be assigned to them; | ||
359 | when doing a data transfer (xfer), first the rpipe has to be aimed and | ||
360 | prepared (buffers assigned), then we can start queueing requests for | ||
361 | data in or out. | ||
362 | |||
363 | Data buffers have to be segmented out before sending--so we send first a | ||
364 | header (segment request) and then if there is any data, a data buffer | ||
365 | immediately after to the DTI interface (yep, even the request). If our | ||
366 | buffer is bigger than the max segment size, then we just do multiple | ||
367 | requests. | ||
368 | |||
369 | [This sucks, because doing USB scatter gatter in Linux is resource | ||
370 | intensive, if any...not that the current approach is not. It just has to | ||
371 | be cleaned up a lot :)]. | ||
372 | |||
373 | If reading, we don't send data buffers, just the segment headers saying | ||
374 | we want to read segments. | ||
375 | |||
376 | When the xfer is executed, we receive a notification that says data is | ||
377 | ready in the DTI endpoint (handled through | ||
378 | xfer.c:wa_handle_notif_xfer()). In there we read from the DTI endpoint a | ||
379 | descriptor that gives us the status of the transfer, its identification | ||
380 | (given when we issued it) and the segment number. If it was a data read, | ||
381 | we issue another URB to read into the destination buffer the chunk of | ||
382 | data coming out of the remote endpoint. Done, wait for the next guy. The | ||
383 | callbacks for the URBs issued from here are the ones that will declare | ||
384 | the xfer complete at some point and call it's callback. | ||
385 | |||
386 | Seems simple, but the implementation is not trivial. | ||
387 | |||
388 | * | ||
389 | |||
390 | *WARNING* Old!! | ||
391 | |||
392 | The main xfer descriptor, wa_xfer (equivalent to a URB) contains an | ||
393 | array of segments, tallys on segments and buffers and callback | ||
394 | information. Buried in there is a lot of URBs for executing the segments | ||
395 | and buffer transfers. | ||
396 | |||
397 | For OUT xfers, there is an array of segments, one URB for each, another | ||
398 | one of buffer URB. When submitting, we submit URBs for segment request | ||
399 | 1, buffer 1, segment 2, buffer 2...etc. Then we wait on the DTI for xfer | ||
400 | result data; when all the segments are complete, we call the callback to | ||
401 | finalize the transfer. | ||
402 | |||
403 | For IN xfers, we only issue URBs for the segments we want to read and | ||
404 | then wait for the xfer result data. | ||
405 | |||
406 | *URB mapping into xfers* | ||
407 | |||
408 | This is done by hwahc_op_urb_[en|de]queue(). In enqueue() we aim an | ||
409 | rpipe to the endpoint where we have to transmit, create a transfer | ||
410 | context (wa_xfer) and submit it. When the xfer is done, our callback is | ||
411 | called and we assign the status bits and release the xfer resources. | ||
412 | |||
413 | In dequeue() we are basically cancelling/aborting the transfer. We issue | ||
414 | a xfer abort request to the HC, cancell all the URBs we had submitted | ||
415 | and not yet done and when all that is done, the xfer callback will be | ||
416 | called--this will call the URB callback. | ||
417 | |||
418 | |||
419 | Glossary | ||
420 | |||
421 | *DWA* -- Device Wire Adapter | ||
422 | |||
423 | USB host, wired for downstream devices, upstream connects wirelessly | ||
424 | with Wireless USB. | ||
425 | |||
426 | *EVENT* -- Response to a command on the NEEP | ||
427 | |||
428 | *HWA* -- Host Wire Adapter / USB dongle for UWB and Wireless USB | ||
429 | |||
430 | *NEH* -- Notification/Event Handle | ||
431 | |||
432 | Handle/file descriptor for receiving notifications or events. The WA | ||
433 | code requires you to get one of this to listen for notifications or | ||
434 | events on the NEEP. | ||
435 | |||
436 | *NEEP* -- Notification/Event EndPoint | ||
437 | |||
438 | Stuff related to the management of the first endpoint of a HWA USB | ||
439 | dongle that is used to deliver an stream of events and notifications to | ||
440 | the host. | ||
441 | |||
442 | *NOTIFICATION* -- Message coming in the NEEP as response to something. | ||
443 | |||
444 | *RC* -- Radio Control | ||
445 | |||
446 | Design-overview.txt-1.8 (last edited 2006-11-04 12:22:24 by | ||
447 | InakyPerezGonzalez) | ||
448 | |||
diff --git a/Documentation/usb/anchors.txt b/Documentation/usb/anchors.txt index 7304bcf5a306..6f24f566955a 100644 --- a/Documentation/usb/anchors.txt +++ b/Documentation/usb/anchors.txt | |||
@@ -42,9 +42,38 @@ This function kills all URBs associated with an anchor. The URBs | |||
42 | are called in the reverse temporal order they were submitted. | 42 | are called in the reverse temporal order they were submitted. |
43 | This way no data can be reordered. | 43 | This way no data can be reordered. |
44 | 44 | ||
45 | usb_unlink_anchored_urbs() | ||
46 | -------------------------- | ||
47 | |||
48 | This function unlinks all URBs associated with an anchor. The URBs | ||
49 | are processed in the reverse temporal order they were submitted. | ||
50 | This is similar to usb_kill_anchored_urbs(), but it will not sleep. | ||
51 | 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 | ||
53 | finite time. | ||
54 | |||
55 | usb_scuttle_anchored_urbs() | ||
56 | --------------------------- | ||
57 | |||
58 | All URBs of an anchor are unanchored en masse. | ||
59 | |||
45 | usb_wait_anchor_empty_timeout() | 60 | usb_wait_anchor_empty_timeout() |
46 | ------------------------------- | 61 | ------------------------------- |
47 | 62 | ||
48 | This function waits for all URBs associated with an anchor to finish | 63 | This function waits for all URBs associated with an anchor to finish |
49 | or a timeout, whichever comes first. Its return value will tell you | 64 | or a timeout, whichever comes first. Its return value will tell you |
50 | whether the timeout was reached. | 65 | whether the timeout was reached. |
66 | |||
67 | usb_anchor_empty() | ||
68 | ------------------ | ||
69 | |||
70 | Returns true if no URBs are associated with an anchor. Locking | ||
71 | is the caller's responsibility. | ||
72 | |||
73 | usb_get_from_anchor() | ||
74 | --------------------- | ||
75 | |||
76 | 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 | ||
78 | destinations in one anchor you have no guarantee the chronologically | ||
79 | first submitted URB is returned. \ No newline at end of file | ||
diff --git a/Documentation/usb/auerswald.txt b/Documentation/usb/auerswald.txt deleted file mode 100644 index 7ee4d8f69116..000000000000 --- a/Documentation/usb/auerswald.txt +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | Auerswald USB kernel driver | ||
2 | =========================== | ||
3 | |||
4 | What is it? What can I do with it? | ||
5 | ================================== | ||
6 | The auerswald USB kernel driver connects your linux 2.4.x | ||
7 | system to the auerswald usb-enabled devices. | ||
8 | |||
9 | There are two types of auerswald usb devices: | ||
10 | a) small PBX systems (ISDN) | ||
11 | b) COMfort system telephones (ISDN) | ||
12 | |||
13 | The driver installation creates the devices | ||
14 | /dev/usb/auer0..15. These devices carry a vendor- | ||
15 | specific protocol. You may run all auerswald java | ||
16 | software on it. The java software needs a native | ||
17 | library "libAuerUsbJNINative.so" installed on | ||
18 | your system. This library is available from | ||
19 | auerswald and shipped as part of the java software. | ||
20 | |||
21 | You may create the devices with: | ||
22 | mknod -m 666 /dev/usb/auer0 c 180 112 | ||
23 | ... | ||
24 | mknod -m 666 /dev/usb/auer15 c 180 127 | ||
25 | |||
26 | Future plans | ||
27 | ============ | ||
28 | - Connection to ISDN4LINUX (the hisax interface) | ||
29 | |||
30 | The maintainer of this driver is wolfgang@iksw-muees.de | ||
diff --git a/Documentation/usb/authorization.txt b/Documentation/usb/authorization.txt index 2af400609498..381b22ee7834 100644 --- a/Documentation/usb/authorization.txt +++ b/Documentation/usb/authorization.txt | |||
@@ -8,7 +8,7 @@ not) in a system. This feature will allow you to implement a lock-down | |||
8 | of USB devices, fully controlled by user space. | 8 | of USB devices, fully controlled by user space. |
9 | 9 | ||
10 | As of now, when a USB device is connected it is configured and | 10 | As of now, when a USB device is connected it is configured and |
11 | it's interfaces inmediately made available to the users. With this | 11 | its interfaces are immediately made available to the users. With this |
12 | modification, only if root authorizes the device to be configured will | 12 | modification, only if root authorizes the device to be configured will |
13 | then it be possible to use it. | 13 | then it be possible to use it. |
14 | 14 | ||
diff --git a/Documentation/usb/gadget_serial.txt b/Documentation/usb/gadget_serial.txt index 815f5c2301ff..9b22bd14c348 100644 --- a/Documentation/usb/gadget_serial.txt +++ b/Documentation/usb/gadget_serial.txt | |||
@@ -1,6 +1,7 @@ | |||
1 | 1 | ||
2 | Linux Gadget Serial Driver v2.0 | 2 | Linux Gadget Serial Driver v2.0 |
3 | 11/20/2004 | 3 | 11/20/2004 |
4 | (updated 8-May-2008 for v2.3) | ||
4 | 5 | ||
5 | 6 | ||
6 | License and Disclaimer | 7 | License and Disclaimer |
@@ -31,7 +32,7 @@ Prerequisites | |||
31 | ------------- | 32 | ------------- |
32 | Versions of the gadget serial driver are available for the | 33 | Versions of the gadget serial driver are available for the |
33 | 2.4 Linux kernels, but this document assumes you are using | 34 | 2.4 Linux kernels, but this document assumes you are using |
34 | version 2.0 or later of the gadget serial driver in a 2.6 | 35 | version 2.3 or later of the gadget serial driver in a 2.6 |
35 | Linux kernel. | 36 | Linux kernel. |
36 | 37 | ||
37 | This document assumes that you are familiar with Linux and | 38 | This document assumes that you are familiar with Linux and |
@@ -40,6 +41,12 @@ standard utilities, use minicom and HyperTerminal, and work with | |||
40 | USB and serial devices. It also assumes you configure the Linux | 41 | USB and serial devices. It also assumes you configure the Linux |
41 | gadget and usb drivers as modules. | 42 | gadget and usb drivers as modules. |
42 | 43 | ||
44 | With version 2.3 of the driver, major and minor device nodes are | ||
45 | no longer statically defined. Your Linux based system should mount | ||
46 | sysfs in /sys, and use "mdev" (in Busybox) or "udev" to make the | ||
47 | /dev nodes matching the sysfs /sys/class/tty files. | ||
48 | |||
49 | |||
43 | 50 | ||
44 | Overview | 51 | Overview |
45 | -------- | 52 | -------- |
@@ -104,15 +111,8 @@ driver. All this are listed under "USB Gadget Support" when | |||
104 | configuring the kernel. Then rebuild and install the kernel or | 111 | configuring the kernel. Then rebuild and install the kernel or |
105 | modules. | 112 | modules. |
106 | 113 | ||
107 | The gadget serial driver uses major number 127, for now. So you | ||
108 | will need to create a device node for it, like this: | ||
109 | |||
110 | mknod /dev/ttygserial c 127 0 | ||
111 | |||
112 | You only need to do this once. | ||
113 | |||
114 | Then you must load the gadget serial driver. To load it as an | 114 | Then you must load the gadget serial driver. To load it as an |
115 | ACM device, do this: | 115 | ACM device (recommended for interoperability), do this: |
116 | 116 | ||
117 | modprobe g_serial use_acm=1 | 117 | modprobe g_serial use_acm=1 |
118 | 118 | ||
@@ -125,6 +125,23 @@ controller driver. This must be done each time you reboot the gadget | |||
125 | side Linux system. You can add this to the start up scripts, if | 125 | side Linux system. You can add this to the start up scripts, if |
126 | desired. | 126 | desired. |
127 | 127 | ||
128 | Your system should use mdev (from busybox) or udev to make the | ||
129 | device nodes. After this gadget driver has been set up you should | ||
130 | then see a /dev/ttyGS0 node: | ||
131 | |||
132 | # ls -l /dev/ttyGS0 | cat | ||
133 | crw-rw---- 1 root root 253, 0 May 8 14:10 /dev/ttyGS0 | ||
134 | # | ||
135 | |||
136 | Note that the major number (253, above) is system-specific. If | ||
137 | you need to create /dev nodes by hand, the right numbers to use | ||
138 | will be in the /sys/class/tty/ttyGS0/dev file. | ||
139 | |||
140 | When you link this gadget driver early, perhaps even statically, | ||
141 | you may want to set up an /etc/inittab entry to run "getty" on it. | ||
142 | The /dev/ttyGS0 line should work like most any other serial port. | ||
143 | |||
144 | |||
128 | If gadget serial is loaded as an ACM device you will want to use | 145 | If gadget serial is loaded as an ACM device you will want to use |
129 | either the Windows or Linux ACM driver on the host side. If gadget | 146 | either the Windows or Linux ACM driver on the host side. If gadget |
130 | serial is loaded as a bulk in/out device, you will want to use the | 147 | serial is loaded as a bulk in/out device, you will want to use the |
diff --git a/Documentation/usb/misc_usbsevseg.txt b/Documentation/usb/misc_usbsevseg.txt new file mode 100644 index 000000000000..0f6be4f9930b --- /dev/null +++ b/Documentation/usb/misc_usbsevseg.txt | |||
@@ -0,0 +1,46 @@ | |||
1 | USB 7-Segment Numeric Display | ||
2 | Manufactured by Delcom Engineering | ||
3 | |||
4 | Device Information | ||
5 | ------------------ | ||
6 | USB VENDOR_ID 0x0fc5 | ||
7 | USB PRODUCT_ID 0x1227 | ||
8 | Both the 6 character and 8 character displays have PRODUCT_ID, | ||
9 | and according to Delcom Engineering no queryable information | ||
10 | can be obtained from the device to tell them apart. | ||
11 | |||
12 | Device Modes | ||
13 | ------------ | ||
14 | By default, the driver assumes the display is only 6 characters | ||
15 | The mode for 6 characters is: | ||
16 | MSB 0x06; LSB 0x3f | ||
17 | For the 8 character display: | ||
18 | MSB 0x08; LSB 0xff | ||
19 | The device can accept "text" either in raw, hex, or ascii textmode. | ||
20 | raw controls each segment manually, | ||
21 | hex expects a value between 0-15 per character, | ||
22 | ascii expects a value between '0'-'9' and 'A'-'F'. | ||
23 | The default is ascii. | ||
24 | |||
25 | Device Operation | ||
26 | ---------------- | ||
27 | 1. Turn on the device: | ||
28 | echo 1 > /sys/bus/usb/.../powered | ||
29 | 2. Set the device's mode: | ||
30 | echo $mode_msb > /sys/bus/usb/.../mode_msb | ||
31 | echo $mode_lsb > /sys/bus/usb/.../mode_lsb | ||
32 | 3. Set the textmode: | ||
33 | echo $textmode > /sys/bus/usb/.../textmode | ||
34 | 4. set the text (for example): | ||
35 | echo "123ABC" > /sys/bus/usb/.../text (ascii) | ||
36 | echo "A1B2" > /sys/bus/usb/.../text (ascii) | ||
37 | echo -ne "\x01\x02\x03" > /sys/bus/usb/.../text (hex) | ||
38 | 5. Set the decimal places. | ||
39 | The device has either 6 or 8 decimal points. | ||
40 | to set the nth decimal place calculate 10 ** n | ||
41 | and echo it in to /sys/bus/usb/.../decimals | ||
42 | To set multiple decimals points sum up each power. | ||
43 | For example, to set the 0th and 3rd decimal place | ||
44 | echo 1001 > /sys/bus/usb/.../decimals | ||
45 | |||
46 | |||
diff --git a/Documentation/usb/persist.txt b/Documentation/usb/persist.txt index d56cb1a11550..074b159b77c2 100644 --- a/Documentation/usb/persist.txt +++ b/Documentation/usb/persist.txt | |||
@@ -81,8 +81,11 @@ re-enumeration shows that the device now attached to that port has the | |||
81 | same descriptors as before, including the Vendor and Product IDs, then | 81 | same descriptors as before, including the Vendor and Product IDs, then |
82 | the kernel continues to use the same device structure. In effect, the | 82 | the kernel continues to use the same device structure. In effect, the |
83 | kernel treats the device as though it had merely been reset instead of | 83 | kernel treats the device as though it had merely been reset instead of |
84 | unplugged. The same thing happens if the host controller is in the | 84 | unplugged. |
85 | expected state but a USB device was unplugged and then replugged. | 85 | |
86 | The same thing happens if the host controller is in the expected state | ||
87 | but a USB device was unplugged and then replugged, or if a USB device | ||
88 | fails to carry out a normal resume. | ||
86 | 89 | ||
87 | If no device is now attached to the port, or if the descriptors are | 90 | If no device is now attached to the port, or if the descriptors are |
88 | different from what the kernel remembers, then the treatment is what | 91 | different from what the kernel remembers, then the treatment is what |
diff --git a/Documentation/usb/power-management.txt b/Documentation/usb/power-management.txt index b2fc4d4a9917..e48ea1d51010 100644 --- a/Documentation/usb/power-management.txt +++ b/Documentation/usb/power-management.txt | |||
@@ -350,12 +350,12 @@ without holding the mutex. | |||
350 | 350 | ||
351 | There also are a couple of utility routines drivers can use: | 351 | There also are a couple of utility routines drivers can use: |
352 | 352 | ||
353 | usb_autopm_enable() sets pm_usage_cnt to 1 and then calls | 353 | usb_autopm_enable() sets pm_usage_cnt to 0 and then calls |
354 | usb_autopm_set_interface(), which will attempt an autoresume. | ||
355 | |||
356 | usb_autopm_disable() sets pm_usage_cnt to 0 and then calls | ||
357 | usb_autopm_set_interface(), which will attempt an autosuspend. | 354 | usb_autopm_set_interface(), which will attempt an autosuspend. |
358 | 355 | ||
356 | usb_autopm_disable() sets pm_usage_cnt to 1 and then calls | ||
357 | usb_autopm_set_interface(), which will attempt an autoresume. | ||
358 | |||
359 | The conventional usage pattern is that a driver calls | 359 | The conventional usage pattern is that a driver calls |
360 | usb_autopm_get_interface() in its open routine and | 360 | usb_autopm_get_interface() in its open routine and |
361 | usb_autopm_put_interface() in its close or release routine. But | 361 | usb_autopm_put_interface() in its close or release routine. But |
@@ -436,7 +436,12 @@ post_reset; the USB core guarantees that this is true of internal | |||
436 | suspend/resume events as well. | 436 | suspend/resume events as well. |
437 | 437 | ||
438 | If a driver wants to block all suspend/resume calls during some | 438 | If a driver wants to block all suspend/resume calls during some |
439 | critical section, it can simply acquire udev->pm_mutex. | 439 | critical section, it can simply acquire udev->pm_mutex. Note that |
440 | calls to resume may be triggered indirectly. Block IO due to memory | ||
441 | allocations can make the vm subsystem resume a device. Thus while | ||
442 | holding this lock you must not allocate memory with GFP_KERNEL or | ||
443 | GFP_NOFS. | ||
444 | |||
440 | Alternatively, if the critical section might call some of the | 445 | Alternatively, if the critical section might call some of the |
441 | usb_autopm_* routines, the driver can avoid deadlock by doing: | 446 | usb_autopm_* routines, the driver can avoid deadlock by doing: |
442 | 447 | ||
diff --git a/Documentation/usb/uhci.txt b/Documentation/usb/uhci.txt deleted file mode 100644 index 2f25952c86c6..000000000000 --- a/Documentation/usb/uhci.txt +++ /dev/null | |||
@@ -1,165 +0,0 @@ | |||
1 | Specification and Internals for the New UHCI Driver (Whitepaper...) | ||
2 | |||
3 | brought to you by | ||
4 | |||
5 | Georg Acher, acher@in.tum.de (executive slave) (base guitar) | ||
6 | Deti Fliegl, deti@fliegl.de (executive slave) (lead voice) | ||
7 | Thomas Sailer, sailer@ife.ee.ethz.ch (chief consultant) (cheer leader) | ||
8 | |||
9 | $Id: README.uhci,v 1.1 1999/12/14 14:03:02 fliegl Exp $ | ||
10 | |||
11 | This document and the new uhci sources can be found on | ||
12 | http://hotswap.in.tum.de/usb | ||
13 | |||
14 | 1. General issues | ||
15 | |||
16 | 1.1 Why a new UHCI driver, we already have one?!? | ||
17 | |||
18 | Correct, but its internal structure got more and more mixed up by the (still | ||
19 | ongoing) efforts to get isochronous transfers (ISO) to work. | ||
20 | Since there is an increasing need for reliable ISO-transfers (especially | ||
21 | for USB-audio needed by TS and for a DAB-USB-Receiver build by GA and DF), | ||
22 | this state was a bit unsatisfying in our opinion, so we've decided (based | ||
23 | on knowledge and experiences with the old UHCI driver) to start | ||
24 | from scratch with a new approach, much simpler but at the same time more | ||
25 | powerful. | ||
26 | It is inspired by the way Win98/Win2000 handles USB requests via URBs, | ||
27 | but it's definitely 100% free of MS-code and doesn't crash while | ||
28 | unplugging an used ISO-device like Win98 ;-) | ||
29 | Some code for HW setup and root hub management was taken from the | ||
30 | original UHCI driver, but heavily modified to fit into the new code. | ||
31 | The invention of the basic concept, and major coding were completed in two | ||
32 | days (and nights) on the 16th and 17th of October 1999, now known as the | ||
33 | great USB-October-Revolution started by GA, DF, and TS ;-) | ||
34 | |||
35 | Since the concept is in no way UHCI dependent, we hope that it will also be | ||
36 | transferred to the OHCI-driver, so both drivers share a common API. | ||
37 | |||
38 | 1.2. Advantages and disadvantages | ||
39 | |||
40 | + All USB transfer types work now! | ||
41 | + Asynchronous operation | ||
42 | + Simple, but powerful interface (only two calls for start and cancel) | ||
43 | + Easy migration to the new API, simplified by a compatibility API | ||
44 | + Simple usage of ISO transfers | ||
45 | + Automatic linking of requests | ||
46 | + ISO transfers allow variable length for each frame and striping | ||
47 | + No CPU dependent and non-portable atomic memory access, no asm()-inlines | ||
48 | + Tested on x86 and Alpha | ||
49 | |||
50 | - Rewriting for ISO transfers needed | ||
51 | |||
52 | 1.3. Is there some compatibility to the old API? | ||
53 | |||
54 | Yes, but only for control, bulk and interrupt transfers. We've implemented | ||
55 | some wrapper calls for these transfer types. The usbcore works fine with | ||
56 | these wrappers. For ISO there's no compatibility, because the old ISO-API | ||
57 | and its semantics were unnecessary complicated in our opinion. | ||
58 | |||
59 | 1.4. What's really working? | ||
60 | |||
61 | As said above, CTRL and BULK already work fine even with the wrappers, | ||
62 | so legacy code wouldn't notice the change. | ||
63 | Regarding to Thomas, ISO transfers now run stable with USB audio. | ||
64 | INT transfers (e.g. mouse driver) work fine, too. | ||
65 | |||
66 | 1.5. Are there any bugs? | ||
67 | |||
68 | No ;-) | ||
69 | Hm... | ||
70 | Well, of course this implementation needs extensive testing on all available | ||
71 | hardware, but we believe that any fixes shouldn't harm the overall concept. | ||
72 | |||
73 | 1.6. What should be done next? | ||
74 | |||
75 | A large part of the request handling seems to be identical for UHCI and | ||
76 | OHCI, so it would be a good idea to extract the common parts and have only | ||
77 | the HW specific stuff in uhci.c. Furthermore, all other USB device drivers | ||
78 | should need URBification, if they use isochronous or interrupt transfers. | ||
79 | One thing missing in the current implementation (and the old UHCI driver) | ||
80 | is fair queueing for BULK transfers. Since this would need (in principle) | ||
81 | the alteration of already constructed TD chains (to switch from depth to | ||
82 | breadth execution), another way has to be found. Maybe some simple | ||
83 | heuristics work with the same effect. | ||
84 | |||
85 | --------------------------------------------------------------------------- | ||
86 | |||
87 | 2. Internal structure and mechanisms | ||
88 | |||
89 | To get quickly familiar with the internal structures, here's a short | ||
90 | description how the new UHCI driver works. However, the ultimate source of | ||
91 | truth is only uhci.c! | ||
92 | |||
93 | 2.1. Descriptor structure (QHs and TDs) | ||
94 | |||
95 | During initialization, the following skeleton is allocated in init_skel: | ||
96 | |||
97 | framespecific | common chain | ||
98 | |||
99 | framelist[] | ||
100 | [ 0 ]-----> TD --> TD -------\ | ||
101 | [ 1 ]-----> TD --> TD --------> TD ----> QH -------> QH -------> QH ---> NULL | ||
102 | ... TD --> TD -------/ | ||
103 | [1023]-----> TD --> TD ------/ | ||
104 | |||
105 | ^^ ^^ ^^ ^^ ^^ ^^ | ||
106 | 1024 TDs for 7 TDs for 1 TD for Start of Start of End Chain | ||
107 | ISO INT (2-128ms) 1ms-INT CTRL Chain BULK Chain | ||
108 | |||
109 | For each CTRL or BULK transfer a new QH is allocated and the containing data | ||
110 | transfers are appended as (vertical) TDs. After building the whole QH with its | ||
111 | dangling TDs, the QH is inserted before the BULK Chain QH (for CTRL) or | ||
112 | before the End Chain QH (for BULK). Since only the QH->next pointers are | ||
113 | affected, no atomic memory operation is required. The three QHs in the | ||
114 | common chain are never equipped with TDs! | ||
115 | |||
116 | For ISO or INT, the TD for each frame is simply inserted into the appropriate | ||
117 | ISO/INT-TD-chain for the desired frame. The 7 skeleton INT-TDs are scattered | ||
118 | among the 1024 frames similar to the old UHCI driver. | ||
119 | |||
120 | For CTRL/BULK/ISO, the last TD in the transfer has the IOC-bit set. For INT, | ||
121 | every TD (there is only one...) has the IOC-bit set. | ||
122 | |||
123 | Besides the data for the UHCI controller (2 or 4 32bit words), the descriptors | ||
124 | are double-linked through the .vertical and .horizontal elements in the | ||
125 | SW data of the descriptor (using the double-linked list structures and | ||
126 | operations), but SW-linking occurs only in closed domains, i.e. for each of | ||
127 | the 1024 ISO-chains and the 8 INT-chains there is a closed cycle. This | ||
128 | simplifies all insertions and unlinking operations and avoids costly | ||
129 | bus_to_virt()-calls. | ||
130 | |||
131 | 2.2. URB structure and linking to QH/TDs | ||
132 | |||
133 | During assembly of the QH and TDs of the requested action, these descriptors | ||
134 | are stored in urb->urb_list, so the allocated QH/TD descriptors are bound to | ||
135 | this URB. | ||
136 | If the assembly was successful and the descriptors were added to the HW chain, | ||
137 | the corresponding URB is inserted into a global URB list for this controller. | ||
138 | This list stores all pending URBs. | ||
139 | |||
140 | 2.3. Interrupt processing | ||
141 | |||
142 | Since UHCI provides no means to directly detect completed transactions, the | ||
143 | following is done in each UHCI interrupt (uhci_interrupt()): | ||
144 | |||
145 | For each URB in the pending queue (process_urb()), the ACTIVE-flag of the | ||
146 | associated TDs are processed (depending on the transfer type | ||
147 | process_{transfer|interrupt|iso}()). If the TDs are not active anymore, | ||
148 | they indicate the completion of the transaction and the status is calculated. | ||
149 | Inactive QH/TDs are removed from the HW chain (since the host controller | ||
150 | already removed the TDs from the QH, no atomic access is needed) and | ||
151 | eventually the URB is marked as completed (OK or errors) and removed from the | ||
152 | pending queue. Then the next linked URB is submitted. After (or immediately | ||
153 | before) that, the completion handler is called. | ||
154 | |||
155 | 2.4. Unlinking URBs | ||
156 | |||
157 | First, all QH/TDs stored in the URB are unlinked from the HW chain. | ||
158 | To ensure that the host controller really left a vertical TD chain, we | ||
159 | wait for one frame. After that, the TDs are physically destroyed. | ||
160 | |||
161 | 2.5. URB linking and the consequences | ||
162 | |||
163 | Since URBs can be linked and the corresponding submit_urb is called in | ||
164 | the UHCI-interrupt, all work associated with URB/QH/TD assembly has to be | ||
165 | interrupt save. This forces kmalloc to use GFP_ATOMIC in the interrupt. | ||
diff --git a/Documentation/usb/wusb-cbaf b/Documentation/usb/wusb-cbaf new file mode 100644 index 000000000000..2e78b70f3adc --- /dev/null +++ b/Documentation/usb/wusb-cbaf | |||
@@ -0,0 +1,139 @@ | |||
1 | #! /bin/bash | ||
2 | # | ||
3 | |||
4 | set -e | ||
5 | |||
6 | progname=$(basename $0) | ||
7 | function help | ||
8 | { | ||
9 | cat <<EOF | ||
10 | Usage: $progname COMMAND DEVICEs [ARGS] | ||
11 | |||
12 | Command for manipulating the pairing/authentication credentials of a | ||
13 | Wireless USB device that supports wired-mode Cable-Based-Association. | ||
14 | |||
15 | Works in conjunction with the wusb-cba.ko driver from http://linuxuwb.org. | ||
16 | |||
17 | |||
18 | DEVICE | ||
19 | |||
20 | sysfs path to the device to authenticate; for example, both this | ||
21 | guys are the same: | ||
22 | |||
23 | /sys/devices/pci0000:00/0000:00:1d.7/usb1/1-4/1-4.4/1-4.4:1.1 | ||
24 | /sys/bus/usb/drivers/wusb-cbaf/1-4.4:1.1 | ||
25 | |||
26 | COMMAND/ARGS are | ||
27 | |||
28 | start | ||
29 | |||
30 | Start a WUSB host controller (by setting up a CHID) | ||
31 | |||
32 | set-chid DEVICE HOST-CHID HOST-BANDGROUP HOST-NAME | ||
33 | |||
34 | Sets host information in the device; after this you can call the | ||
35 | get-cdid to see how does this device report itself to us. | ||
36 | |||
37 | get-cdid DEVICE | ||
38 | |||
39 | Get the device ID associated to the HOST-CHDI we sent with | ||
40 | 'set-chid'. We might not know about it. | ||
41 | |||
42 | set-cc DEVICE | ||
43 | |||
44 | If we allow the device to connect, set a random new CDID and CK | ||
45 | (connection key). Device saves them for the next time it wants to | ||
46 | connect wireless. We save them for that next time also so we can | ||
47 | authenticate the device (when we see the CDID he uses to id | ||
48 | itself) and the CK to crypto talk to it. | ||
49 | |||
50 | CHID is always 16 hex bytes in 'XX YY ZZ...' form | ||
51 | BANDGROUP is almost always 0001 | ||
52 | |||
53 | Examples: | ||
54 | |||
55 | You can default most arguments to '' to get a sane value: | ||
56 | |||
57 | $ $progname set-chid '' '' '' "My host name" | ||
58 | |||
59 | A full sequence: | ||
60 | |||
61 | $ $progname set-chid '' '' '' "My host name" | ||
62 | $ $progname get-cdid '' | ||
63 | $ $progname set-cc '' | ||
64 | |||
65 | EOF | ||
66 | } | ||
67 | |||
68 | |||
69 | # Defaults | ||
70 | # FIXME: CHID should come from a database :), band group from the host | ||
71 | host_CHID="00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff" | ||
72 | host_band_group="0001" | ||
73 | host_name=$(hostname) | ||
74 | |||
75 | devs="$(echo /sys/bus/usb/drivers/wusb-cbaf/[0-9]*)" | ||
76 | hdevs="$(for h in /sys/class/uwb_rc/*/wusbhc; do readlink -f $h; done)" | ||
77 | |||
78 | result=0 | ||
79 | case $1 in | ||
80 | start) | ||
81 | for dev in ${2:-$hdevs} | ||
82 | do | ||
83 | uwb_rc=$(readlink -f $dev/uwb_rc) | ||
84 | if cat $uwb_rc/beacon | grep -q -- "-1" | ||
85 | then | ||
86 | echo 13 0 > $uwb_rc/beacon | ||
87 | echo I: started beaconing on ch 13 on $(basename $uwb_rc) >&2 | ||
88 | fi | ||
89 | echo $host_CHID > $dev/wusb_chid | ||
90 | echo I: started host $(basename $dev) >&2 | ||
91 | done | ||
92 | ;; | ||
93 | stop) | ||
94 | for dev in ${2:-$hdevs} | ||
95 | do | ||
96 | echo 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > $dev/wusb_chid | ||
97 | echo I: stopped host $(basename $dev) >&2 | ||
98 | uwb_rc=$(readlink -f $dev/uwb_rc) | ||
99 | echo -1 | cat > $uwb_rc/beacon | ||
100 | echo I: stopped beaconing on $(basename $uwb_rc) >&2 | ||
101 | done | ||
102 | ;; | ||
103 | set-chid) | ||
104 | shift | ||
105 | for dev in ${2:-$devs}; do | ||
106 | echo "${4:-$host_name}" > $dev/wusb_host_name | ||
107 | echo "${3:-$host_band_group}" > $dev/wusb_host_band_groups | ||
108 | echo ${2:-$host_CHID} > $dev/wusb_chid | ||
109 | done | ||
110 | ;; | ||
111 | get-cdid) | ||
112 | for dev in ${2:-$devs} | ||
113 | do | ||
114 | cat $dev/wusb_cdid | ||
115 | done | ||
116 | ;; | ||
117 | set-cc) | ||
118 | for dev in ${2:-$devs}; do | ||
119 | shift | ||
120 | CDID="$(head --bytes=16 /dev/urandom | od -tx1 -An)" | ||
121 | CK="$(head --bytes=16 /dev/urandom | od -tx1 -An)" | ||
122 | echo "$CDID" > $dev/wusb_cdid | ||
123 | echo "$CK" > $dev/wusb_ck | ||
124 | |||
125 | echo I: CC set >&2 | ||
126 | echo "CHID: $(cat $dev/wusb_chid)" | ||
127 | echo "CDID:$CDID" | ||
128 | echo "CK: $CK" | ||
129 | done | ||
130 | ;; | ||
131 | help|h|--help|-h) | ||
132 | help | ||
133 | ;; | ||
134 | *) | ||
135 | echo "E: Unknown usage" 1>&2 | ||
136 | help 1>&2 | ||
137 | result=1 | ||
138 | esac | ||
139 | exit $result | ||
diff --git a/Documentation/video4linux/CARDLIST.au0828 b/Documentation/video4linux/CARDLIST.au0828 index 86d1c8e7b18f..d5cb4ea287b2 100644 --- a/Documentation/video4linux/CARDLIST.au0828 +++ b/Documentation/video4linux/CARDLIST.au0828 | |||
@@ -1,4 +1,6 @@ | |||
1 | 0 -> Unknown board (au0828) | 1 | 0 -> Unknown board (au0828) |
2 | 1 -> Hauppauge HVR950Q (au0828) [2040:7200,2040:7210,2040:7217,2040:721b,2040:721f,2040:7280,0fd9:0008] | 2 | 1 -> Hauppauge HVR950Q (au0828) [2040:7200,2040:7210,2040:7217,2040:721b,2040:721e,2040:721f,2040:7280,0fd9:0008] |
3 | 2 -> Hauppauge HVR850 (au0828) [2040:7240] | 3 | 2 -> Hauppauge HVR850 (au0828) [2040:7240] |
4 | 3 -> DViCO FusionHDTV USB (au0828) [0fe9:d620] | 4 | 3 -> DViCO FusionHDTV USB (au0828) [0fe9:d620] |
5 | 4 -> Hauppauge HVR950Q rev xxF8 (au0828) [2040:7201,2040:7211,2040:7281] | ||
6 | 5 -> Hauppauge Woodbury (au0828) [2040:8200] | ||
diff --git a/Documentation/video4linux/CARDLIST.bttv b/Documentation/video4linux/CARDLIST.bttv index f32efb6fb12c..60ba66836038 100644 --- a/Documentation/video4linux/CARDLIST.bttv +++ b/Documentation/video4linux/CARDLIST.bttv | |||
@@ -150,3 +150,4 @@ | |||
150 | 149 -> Typhoon TV-Tuner PCI (50684) | 150 | 149 -> Typhoon TV-Tuner PCI (50684) |
151 | 150 -> Geovision GV-600 [008a:763c] | 151 | 150 -> Geovision GV-600 [008a:763c] |
152 | 151 -> Kozumi KTV-01C | 152 | 151 -> Kozumi KTV-01C |
153 | 152 -> Encore ENL TV-FM-2 [1000:1801] | ||
diff --git a/Documentation/video4linux/CARDLIST.cx23885 b/Documentation/video4linux/CARDLIST.cx23885 index 191194ea1e25..64823ccacd69 100644 --- a/Documentation/video4linux/CARDLIST.cx23885 +++ b/Documentation/video4linux/CARDLIST.cx23885 | |||
@@ -8,3 +8,6 @@ | |||
8 | 7 -> Hauppauge WinTV-HVR1200 [0070:71d1,0070:71d3] | 8 | 7 -> Hauppauge WinTV-HVR1200 [0070:71d1,0070:71d3] |
9 | 8 -> Hauppauge WinTV-HVR1700 [0070:8101] | 9 | 8 -> Hauppauge WinTV-HVR1700 [0070:8101] |
10 | 9 -> Hauppauge WinTV-HVR1400 [0070:8010] | 10 | 9 -> Hauppauge WinTV-HVR1400 [0070:8010] |
11 | 10 -> DViCO FusionHDTV7 Dual Express [18ac:d618] | ||
12 | 11 -> DViCO FusionHDTV DVB-T Dual Express [18ac:db78] | ||
13 | 12 -> Leadtek Winfast PxDVR3200 H [107d:6681] | ||
diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88 index 7cf5685d3645..a5227e308f4a 100644 --- a/Documentation/video4linux/CARDLIST.cx88 +++ b/Documentation/video4linux/CARDLIST.cx88 | |||
@@ -66,3 +66,11 @@ | |||
66 | 65 -> DViCO FusionHDTV 7 Gold [18ac:d610] | 66 | 65 -> DViCO FusionHDTV 7 Gold [18ac:d610] |
67 | 66 -> Prolink Pixelview MPEG 8000GT [1554:4935] | 67 | 66 -> Prolink Pixelview MPEG 8000GT [1554:4935] |
68 | 67 -> Kworld PlusTV HD PCI 120 (ATSC 120) [17de:08c1] | 68 | 67 -> Kworld PlusTV HD PCI 120 (ATSC 120) [17de:08c1] |
69 | 68 -> Hauppauge WinTV-HVR4000 DVB-S/S2/T/Hybrid [0070:6900,0070:6904,0070:6902] | ||
70 | 69 -> Hauppauge WinTV-HVR4000(Lite) DVB-S/S2 [0070:6905,0070:6906] | ||
71 | 70 -> TeVii S460 DVB-S/S2 [d460:9022] | ||
72 | 71 -> Omicom SS4 DVB-S/S2 PCI [A044:2011] | ||
73 | 72 -> TBS 8920 DVB-S/S2 [8920:8888] | ||
74 | 73 -> TeVii S420 DVB-S [d420:9022] | ||
75 | 74 -> Prolink Pixelview Global Extreme [1554:4976] | ||
76 | 75 -> PROF 7300 DVB-S/S2 [B033:3033] | ||
diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx index 1d6a245c828f..187cc48d0924 100644 --- a/Documentation/video4linux/CARDLIST.em28xx +++ b/Documentation/video4linux/CARDLIST.em28xx | |||
@@ -1,17 +1,59 @@ | |||
1 | 0 -> Unknown EM2800 video grabber (em2800) [eb1a:2800] | 1 | 0 -> Unknown EM2800 video grabber (em2800) [eb1a:2800] |
2 | 1 -> Unknown EM2750/28xx video grabber (em2820/em2840) [eb1a:2750,eb1a:2820,eb1a:2821,eb1a:2860,eb1a:2861,eb1a:2870,eb1a:2881,eb1a:2883] | 2 | 1 -> Unknown EM2750/28xx video grabber (em2820/em2840) [eb1a:2820,eb1a:2860,eb1a:2861,eb1a:2870,eb1a:2881,eb1a:2883] |
3 | 2 -> Terratec Cinergy 250 USB (em2820/em2840) [0ccd:0036] | 3 | 2 -> Terratec Cinergy 250 USB (em2820/em2840) [0ccd:0036] |
4 | 3 -> Pinnacle PCTV USB 2 (em2820/em2840) [2304:0208] | 4 | 3 -> Pinnacle PCTV USB 2 (em2820/em2840) [2304:0208] |
5 | 4 -> Hauppauge WinTV USB 2 (em2820/em2840) [2040:4200,2040:4201] | 5 | 4 -> Hauppauge WinTV USB 2 (em2820/em2840) [2040:4200,2040:4201] |
6 | 5 -> MSI VOX USB 2.0 (em2820/em2840) | 6 | 5 -> MSI VOX USB 2.0 (em2820/em2840) |
7 | 6 -> Terratec Cinergy 200 USB (em2800) | 7 | 6 -> Terratec Cinergy 200 USB (em2800) |
8 | 7 -> Leadtek Winfast USB II (em2800) | 8 | 7 -> Leadtek Winfast USB II (em2800) [0413:6023] |
9 | 8 -> Kworld USB2800 (em2800) | 9 | 8 -> Kworld USB2800 (em2800) |
10 | 9 -> Pinnacle Dazzle DVC 90/DVC 100 (em2820/em2840) [2304:0207,2304:021a] | 10 | 9 -> Pinnacle Dazzle DVC 90/DVC 100 (em2820/em2840) [2304:0207,2304:021a] |
11 | 10 -> Hauppauge WinTV HVR 900 (em2880) [2040:6500,2040:6502] | 11 | 10 -> Hauppauge WinTV HVR 900 (em2880) [2040:6500] |
12 | 11 -> Terratec Hybrid XS (em2880) [0ccd:0042] | 12 | 11 -> Terratec Hybrid XS (em2880) [0ccd:0042] |
13 | 12 -> Kworld PVR TV 2800 RF (em2820/em2840) | 13 | 12 -> Kworld PVR TV 2800 RF (em2820/em2840) |
14 | 13 -> Terratec Prodigy XS (em2880) [0ccd:0047] | 14 | 13 -> Terratec Prodigy XS (em2880) [0ccd:0047] |
15 | 14 -> Pixelview Prolink PlayTV USB 2.0 (em2820/em2840) | 15 | 14 -> Pixelview Prolink PlayTV USB 2.0 (em2820/em2840) [eb1a:2821] |
16 | 15 -> V-Gear PocketTV (em2800) | 16 | 15 -> V-Gear PocketTV (em2800) |
17 | 16 -> Hauppauge WinTV HVR 950 (em2880) [2040:6513,2040:6517,2040:651b,2040:651f] | 17 | 16 -> Hauppauge WinTV HVR 950 (em2883) [2040:6513,2040:6517,2040:651b,2040:651f] |
18 | 17 -> Pinnacle PCTV HD Pro Stick (em2880) [2304:0227] | ||
19 | 18 -> Hauppauge WinTV HVR 900 (R2) (em2880) [2040:6502] | ||
20 | 19 -> PointNix Intra-Oral Camera (em2860) | ||
21 | 20 -> AMD ATI TV Wonder HD 600 (em2880) [0438:b002] | ||
22 | 21 -> eMPIA Technology, Inc. GrabBeeX+ Video Encoder (em2800) [eb1a:2801] | ||
23 | 22 -> Unknown EM2750/EM2751 webcam grabber (em2750) [eb1a:2750,eb1a:2751] | ||
24 | 23 -> Huaqi DLCW-130 (em2750) | ||
25 | 24 -> D-Link DUB-T210 TV Tuner (em2820/em2840) [2001:f112] | ||
26 | 25 -> Gadmei UTV310 (em2820/em2840) | ||
27 | 26 -> Hercules Smart TV USB 2.0 (em2820/em2840) | ||
28 | 27 -> Pinnacle PCTV USB 2 (Philips FM1216ME) (em2820/em2840) | ||
29 | 28 -> Leadtek Winfast USB II Deluxe (em2820/em2840) | ||
30 | 29 -> Pinnacle Dazzle DVC 100 (em2820/em2840) | ||
31 | 30 -> Videology 20K14XUSB USB2.0 (em2820/em2840) | ||
32 | 31 -> Usbgear VD204v9 (em2821) | ||
33 | 32 -> Supercomp USB 2.0 TV (em2821) | ||
34 | 33 -> SIIG AVTuner-PVR/Prolink PlayTV USB 2.0 (em2821) | ||
35 | 34 -> Terratec Cinergy A Hybrid XS (em2860) [0ccd:004f] | ||
36 | 35 -> Typhoon DVD Maker (em2860) | ||
37 | 36 -> NetGMBH Cam (em2860) | ||
38 | 37 -> Gadmei UTV330 (em2860) | ||
39 | 38 -> Yakumo MovieMixer (em2861) | ||
40 | 39 -> KWorld PVRTV 300U (em2861) [eb1a:e300] | ||
41 | 40 -> Plextor ConvertX PX-TV100U (em2861) [093b:a005] | ||
42 | 41 -> Kworld 350 U DVB-T (em2870) [eb1a:e350] | ||
43 | 42 -> Kworld 355 U DVB-T (em2870) [eb1a:e355,eb1a:e357] | ||
44 | 43 -> Terratec Cinergy T XS (em2870) [0ccd:0043] | ||
45 | 44 -> Terratec Cinergy T XS (MT2060) (em2870) | ||
46 | 45 -> Pinnacle PCTV DVB-T (em2870) | ||
47 | 46 -> Compro, VideoMate U3 (em2870) [185b:2870] | ||
48 | 47 -> KWorld DVB-T 305U (em2880) [eb1a:e305] | ||
49 | 48 -> KWorld DVB-T 310U (em2880) [eb1a:e310] | ||
50 | 49 -> MSI DigiVox A/D (em2880) [eb1a:e310] | ||
51 | 50 -> MSI DigiVox A/D II (em2880) [eb1a:e320] | ||
52 | 51 -> Terratec Hybrid XS Secam (em2880) [0ccd:004c] | ||
53 | 52 -> DNT DA2 Hybrid (em2881) | ||
54 | 53 -> Pinnacle Hybrid Pro (em2881) | ||
55 | 54 -> Kworld VS-DVB-T 323UR (em2882) [eb1a:e323] | ||
56 | 55 -> Terratec Hybrid XS (em2882) (em2882) [0ccd:005e] | ||
57 | 56 -> Pinnacle Hybrid Pro (2) (em2882) [2304:0226] | ||
58 | 57 -> Kworld PlusTV HD Hybrid 330 (em2883) [eb1a:a316] | ||
59 | 58 -> Compro VideoMate ForYou/Stereo (em2820/em2840) [185b:2041] | ||
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index 67937df1e974..dc67eef38ff9 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 | |||
@@ -37,7 +37,7 @@ | |||
37 | 36 -> UPMOST PURPLE TV [12ab:0800] | 37 | 36 -> UPMOST PURPLE TV [12ab:0800] |
38 | 37 -> Items MuchTV Plus / IT-005 | 38 | 37 -> Items MuchTV Plus / IT-005 |
39 | 38 -> Terratec Cinergy 200 TV [153b:1152] | 39 | 38 -> Terratec Cinergy 200 TV [153b:1152] |
40 | 39 -> LifeView FlyTV Platinum Mini [5168:0212,4e42:0212] | 40 | 39 -> LifeView FlyTV Platinum Mini [5168:0212,4e42:0212,5169:1502] |
41 | 40 -> Compro VideoMate TV PVR/FM [185b:c100] | 41 | 40 -> Compro VideoMate TV PVR/FM [185b:c100] |
42 | 41 -> Compro VideoMate TV Gold+ [185b:c100] | 42 | 41 -> Compro VideoMate TV Gold+ [185b:c100] |
43 | 42 -> Sabrent SBT-TVFM (saa7130) | 43 | 42 -> Sabrent SBT-TVFM (saa7130) |
@@ -76,7 +76,7 @@ | |||
76 | 75 -> AVerMedia AVerTVHD MCE A180 [1461:1044] | 76 | 75 -> AVerMedia AVerTVHD MCE A180 [1461:1044] |
77 | 76 -> SKNet MonsterTV Mobile [1131:4ee9] | 77 | 76 -> SKNet MonsterTV Mobile [1131:4ee9] |
78 | 77 -> Pinnacle PCTV 40i/50i/110i (saa7133) [11bd:002e] | 78 | 77 -> Pinnacle PCTV 40i/50i/110i (saa7133) [11bd:002e] |
79 | 78 -> ASUSTeK P7131 Dual [1043:4862,1043:4857] | 79 | 78 -> ASUSTeK P7131 Dual [1043:4862] |
80 | 79 -> Sedna/MuchTV PC TV Cardbus TV/Radio (ITO25 Rev:2B) | 80 | 79 -> Sedna/MuchTV PC TV Cardbus TV/Radio (ITO25 Rev:2B) |
81 | 80 -> ASUS Digimatrix TV [1043:0210] | 81 | 80 -> ASUS Digimatrix TV [1043:0210] |
82 | 81 -> Philips Tiger reference design [1131:2018] | 82 | 81 -> Philips Tiger reference design [1131:2018] |
@@ -128,7 +128,7 @@ | |||
128 | 127 -> Beholder BeholdTV 507 FM/RDS / BeholdTV 509 FM [0000:5071,0000:507B,5ace:5070,5ace:5090] | 128 | 127 -> Beholder BeholdTV 507 FM/RDS / BeholdTV 509 FM [0000:5071,0000:507B,5ace:5070,5ace:5090] |
129 | 128 -> Beholder BeholdTV Columbus TVFM [0000:5201] | 129 | 128 -> Beholder BeholdTV Columbus TVFM [0000:5201] |
130 | 129 -> Beholder BeholdTV 607 / BeholdTV 609 [5ace:6070,5ace:6071,5ace:6072,5ace:6073,5ace:6090,5ace:6091,5ace:6092,5ace:6093] | 130 | 129 -> Beholder BeholdTV 607 / BeholdTV 609 [5ace:6070,5ace:6071,5ace:6072,5ace:6073,5ace:6090,5ace:6091,5ace:6092,5ace:6093] |
131 | 130 -> Beholder BeholdTV M6 / BeholdTV M6 Extra [5ace:6190,5ace:6193,5ace:6191] | 131 | 130 -> Beholder BeholdTV M6 [5ace:6190] |
132 | 131 -> Twinhan Hybrid DTV-DVB 3056 PCI [1822:0022] | 132 | 131 -> Twinhan Hybrid DTV-DVB 3056 PCI [1822:0022] |
133 | 132 -> Genius TVGO AM11MCE | 133 | 132 -> Genius TVGO AM11MCE |
134 | 133 -> NXP Snake DVB-S reference design | 134 | 133 -> NXP Snake DVB-S reference design |
@@ -141,3 +141,13 @@ | |||
141 | 140 -> Avermedia DVB-S Pro A700 [1461:a7a1] | 141 | 140 -> Avermedia DVB-S Pro A700 [1461:a7a1] |
142 | 141 -> Avermedia DVB-S Hybrid+FM A700 [1461:a7a2] | 142 | 141 -> Avermedia DVB-S Hybrid+FM A700 [1461:a7a2] |
143 | 142 -> Beholder BeholdTV H6 [5ace:6290] | 143 | 142 -> Beholder BeholdTV H6 [5ace:6290] |
144 | 143 -> Beholder BeholdTV M63 [5ace:6191] | ||
145 | 144 -> Beholder BeholdTV M6 Extra [5ace:6193] | ||
146 | 145 -> AVerMedia MiniPCI DVB-T Hybrid M103 [1461:f636] | ||
147 | 146 -> ASUSTeK P7131 Analog | ||
148 | 147 -> Asus Tiger 3in1 [1043:4878] | ||
149 | 148 -> Encore ENLTV-FM v5.3 [1a7f:2008] | ||
150 | 149 -> Avermedia PCI pure analog (M135A) [1461:f11d] | ||
151 | 150 -> Zogis Real Angel 220 | ||
152 | 151 -> ADS Tech Instant HDTV [1421:0380] | ||
153 | 152 -> Asus Tiger Rev:1.00 [1043:4857] | ||
diff --git a/Documentation/video4linux/CARDLIST.tuner b/Documentation/video4linux/CARDLIST.tuner index 0e2394695bb8..691d2f37dc57 100644 --- a/Documentation/video4linux/CARDLIST.tuner +++ b/Documentation/video4linux/CARDLIST.tuner | |||
@@ -74,3 +74,5 @@ tuner=72 - Thomson FE6600 | |||
74 | tuner=73 - Samsung TCPG 6121P30A | 74 | tuner=73 - Samsung TCPG 6121P30A |
75 | tuner=75 - Philips TEA5761 FM Radio | 75 | tuner=75 - Philips TEA5761 FM Radio |
76 | tuner=76 - Xceive 5000 tuner | 76 | tuner=76 - Xceive 5000 tuner |
77 | tuner=77 - TCL tuner MF02GIP-5N-E | ||
78 | tuner=78 - Philips FMD1216MEX MK3 Hybrid Tuner | ||
diff --git a/Documentation/video4linux/Makefile b/Documentation/video4linux/Makefile new file mode 100644 index 000000000000..1ed0e98d057d --- /dev/null +++ b/Documentation/video4linux/Makefile | |||
@@ -0,0 +1,8 @@ | |||
1 | # kbuild trick to avoid linker error. Can be omitted if a module is built. | ||
2 | obj- := dummy.o | ||
3 | |||
4 | # List of programs to build | ||
5 | hostprogs-y := v4lgrab | ||
6 | |||
7 | # Tell kbuild to always build the programs | ||
8 | always := $(hostprogs-y) | ||
diff --git a/Documentation/video4linux/cx18.txt b/Documentation/video4linux/cx18.txt index 6842c262890f..914cb7e734a2 100644 --- a/Documentation/video4linux/cx18.txt +++ b/Documentation/video4linux/cx18.txt | |||
@@ -1,36 +1,30 @@ | |||
1 | Some notes regarding the cx18 driver for the Conexant CX23418 MPEG | 1 | Some notes regarding the cx18 driver for the Conexant CX23418 MPEG |
2 | encoder chip: | 2 | encoder chip: |
3 | 3 | ||
4 | 1) The only hardware currently supported is the Hauppauge HVR-1600 | 4 | 1) Currently supported are: |
5 | card and the Compro VideoMate H900 (note that this card only | ||
6 | supports analog input, it has no digital tuner!). | ||
7 | 5 | ||
8 | 2) Some people have problems getting the i2c bus to work. Cause unknown. | 6 | - Hauppauge HVR-1600 |
9 | The symptom is that the eeprom cannot be read and the card is | 7 | - Compro VideoMate H900 |
10 | unusable. | 8 | - Yuan MPC718 |
9 | - Conexant Raptor PAL/SECAM devkit | ||
11 | 10 | ||
12 | 3) The audio from the analog tuner is mono only. Probably caused by | 11 | 2) Some people have problems getting the i2c bus to work. |
13 | incorrect audio register information in the datasheet. We are | 12 | The symptom is that the eeprom cannot be read and the card is |
14 | waiting for updated information from Conexant. | 13 | unusable. This is probably fixed, but if you have problems |
14 | then post to the video4linux or ivtv-users mailinglist. | ||
15 | 15 | ||
16 | 4) VBI (raw or sliced) has not yet been implemented. | 16 | 3) VBI (raw or sliced) has not yet been implemented. |
17 | 17 | ||
18 | 5) MPEG indexing is not yet implemented. | 18 | 4) MPEG indexing is not yet implemented. |
19 | 19 | ||
20 | 6) The driver is still a bit rough around the edges, this should | 20 | 5) The driver is still a bit rough around the edges, this should |
21 | improve over time. | 21 | improve over time. |
22 | 22 | ||
23 | 23 | ||
24 | Firmware: | 24 | Firmware: |
25 | 25 | ||
26 | The firmware needs to be extracted from the Windows Hauppauge HVR-1600 | 26 | You can obtain the firmware files here: |
27 | driver, available here: | ||
28 | |||
29 | http://hauppauge.lightpath.net/software/install_cd/hauppauge_cd_3.4d1.zip | ||
30 | 27 | ||
31 | Unzip, then copy the following files to the firmware directory | 28 | http://dl.ivtvdriver.org/ivtv/firmware/cx18-firmware.tar.gz |
32 | and rename them as follows: | ||
33 | 29 | ||
34 | Drivers/Driver18/hcw18apu.rom -> v4l-cx23418-apu.fw | 30 | Untar and copy the .fw files to your firmware directory. |
35 | Drivers/Driver18/hcw18enc.rom -> v4l-cx23418-cpu.fw | ||
36 | Drivers/Driver18/hcw18mlC.rom -> v4l-cx23418-dig.fw | ||
diff --git a/Documentation/video4linux/gspca.txt b/Documentation/video4linux/gspca.txt new file mode 100644 index 000000000000..004818fab040 --- /dev/null +++ b/Documentation/video4linux/gspca.txt | |||
@@ -0,0 +1,274 @@ | |||
1 | List of the webcams known by gspca. | ||
2 | |||
3 | The modules are: | ||
4 | gspca_main main driver | ||
5 | gspca_xxxx subdriver module with xxxx as follows | ||
6 | |||
7 | xxxx vend:prod | ||
8 | ---- | ||
9 | spca501 0000:0000 MystFromOri Unknow Camera | ||
10 | m5602 0402:5602 ALi Video Camera Controller | ||
11 | spca501 040a:0002 Kodak DVC-325 | ||
12 | spca500 040a:0300 Kodak EZ200 | ||
13 | zc3xx 041e:041e Creative WebCam Live! | ||
14 | spca500 041e:400a Creative PC-CAM 300 | ||
15 | sunplus 041e:400b Creative PC-CAM 600 | ||
16 | sunplus 041e:4012 PC-Cam350 | ||
17 | sunplus 041e:4013 Creative Pccam750 | ||
18 | zc3xx 041e:4017 Creative Webcam Mobile PD1090 | ||
19 | spca508 041e:4018 Creative Webcam Vista (PD1100) | ||
20 | spca561 041e:401a Creative Webcam Vista (PD1100) | ||
21 | zc3xx 041e:401c Creative NX | ||
22 | spca505 041e:401d Creative Webcam NX ULTRA | ||
23 | zc3xx 041e:401e Creative Nx Pro | ||
24 | zc3xx 041e:401f Creative Webcam Notebook PD1171 | ||
25 | pac207 041e:4028 Creative Webcam Vista Plus | ||
26 | zc3xx 041e:4029 Creative WebCam Vista Pro | ||
27 | zc3xx 041e:4034 Creative Instant P0620 | ||
28 | zc3xx 041e:4035 Creative Instant P0620D | ||
29 | zc3xx 041e:4036 Creative Live ! | ||
30 | zc3xx 041e:403a Creative Nx Pro 2 | ||
31 | spca561 041e:403b Creative Webcam Vista (VF0010) | ||
32 | zc3xx 041e:4051 Creative Live!Cam Notebook Pro (VF0250) | ||
33 | ov519 041e:4052 Creative Live! VISTA IM | ||
34 | zc3xx 041e:4053 Creative Live!Cam Video IM | ||
35 | ov519 041e:405f Creative Live! VISTA VF0330 | ||
36 | ov519 041e:4060 Creative Live! VISTA VF0350 | ||
37 | ov519 041e:4061 Creative Live! VISTA VF0400 | ||
38 | ov519 041e:4064 Creative Live! VISTA VF0420 | ||
39 | ov519 041e:4068 Creative Live! VISTA VF0470 | ||
40 | spca561 0458:7004 Genius VideoCAM Express V2 | ||
41 | sunplus 0458:7006 Genius Dsc 1.3 Smart | ||
42 | zc3xx 0458:7007 Genius VideoCam V2 | ||
43 | zc3xx 0458:700c Genius VideoCam V3 | ||
44 | zc3xx 0458:700f Genius VideoCam Web V2 | ||
45 | sonixj 0458:7025 Genius Eye 311Q | ||
46 | sonixj 0458:702e Genius Slim 310 NB | ||
47 | sonixj 045e:00f5 MicroSoft VX3000 | ||
48 | sonixj 045e:00f7 MicroSoft VX1000 | ||
49 | ov519 045e:028c Micro$oft xbox cam | ||
50 | spca508 0461:0815 Micro Innovation IC200 | ||
51 | sunplus 0461:0821 Fujifilm MV-1 | ||
52 | zc3xx 0461:0a00 MicroInnovation WebCam320 | ||
53 | spca500 046d:0890 Logitech QuickCam traveler | ||
54 | vc032x 046d:0892 Logitech Orbicam | ||
55 | vc032x 046d:0896 Logitech Orbicam | ||
56 | zc3xx 046d:08a0 Logitech QC IM | ||
57 | zc3xx 046d:08a1 Logitech QC IM 0x08A1 +sound | ||
58 | zc3xx 046d:08a2 Labtec Webcam Pro | ||
59 | zc3xx 046d:08a3 Logitech QC Chat | ||
60 | zc3xx 046d:08a6 Logitech QCim | ||
61 | zc3xx 046d:08a7 Logitech QuickCam Image | ||
62 | zc3xx 046d:08a9 Logitech Notebook Deluxe | ||
63 | zc3xx 046d:08aa Labtec Webcam Notebook | ||
64 | zc3xx 046d:08ac Logitech QuickCam Cool | ||
65 | zc3xx 046d:08ad Logitech QCCommunicate STX | ||
66 | zc3xx 046d:08ae Logitech QuickCam for Notebooks | ||
67 | zc3xx 046d:08af Logitech QuickCam Cool | ||
68 | zc3xx 046d:08b9 Logitech QC IM ??? | ||
69 | zc3xx 046d:08d7 Logitech QCam STX | ||
70 | zc3xx 046d:08d9 Logitech QuickCam IM/Connect | ||
71 | zc3xx 046d:08d8 Logitech Notebook Deluxe | ||
72 | zc3xx 046d:08da Logitech QuickCam Messenger | ||
73 | zc3xx 046d:08dd Logitech QuickCam for Notebooks | ||
74 | spca500 046d:0900 Logitech Inc. ClickSmart 310 | ||
75 | spca500 046d:0901 Logitech Inc. ClickSmart 510 | ||
76 | sunplus 046d:0905 Logitech ClickSmart 820 | ||
77 | tv8532 046d:0920 QC Express | ||
78 | tv8532 046d:0921 Labtec Webcam | ||
79 | spca561 046d:0928 Logitech QC Express Etch2 | ||
80 | spca561 046d:0929 Labtec Webcam Elch2 | ||
81 | spca561 046d:092a Logitech QC for Notebook | ||
82 | spca561 046d:092b Labtec Webcam Plus | ||
83 | spca561 046d:092c Logitech QC chat Elch2 | ||
84 | spca561 046d:092d Logitech QC Elch2 | ||
85 | spca561 046d:092e Logitech QC Elch2 | ||
86 | spca561 046d:092f Logitech QuickCam Express Plus | ||
87 | sunplus 046d:0960 Logitech ClickSmart 420 | ||
88 | sunplus 0471:0322 Philips DMVC1300K | ||
89 | zc3xx 0471:0325 Philips SPC 200 NC | ||
90 | zc3xx 0471:0326 Philips SPC 300 NC | ||
91 | sonixj 0471:0327 Philips SPC 600 NC | ||
92 | sonixj 0471:0328 Philips SPC 700 NC | ||
93 | zc3xx 0471:032d Philips SPC 210 NC | ||
94 | zc3xx 0471:032e Philips SPC 315 NC | ||
95 | sonixj 0471:0330 Philips SPC 710 NC | ||
96 | spca501 0497:c001 Smile International | ||
97 | sunplus 04a5:3003 Benq DC 1300 | ||
98 | sunplus 04a5:3008 Benq DC 1500 | ||
99 | sunplus 04a5:300a Benq DC 3410 | ||
100 | spca500 04a5:300c Benq DC 1016 | ||
101 | finepix 04cb:0104 Fujifilm FinePix 4800 | ||
102 | finepix 04cb:0109 Fujifilm FinePix A202 | ||
103 | finepix 04cb:010b Fujifilm FinePix A203 | ||
104 | finepix 04cb:010f Fujifilm FinePix A204 | ||
105 | finepix 04cb:0111 Fujifilm FinePix A205 | ||
106 | finepix 04cb:0113 Fujifilm FinePix A210 | ||
107 | finepix 04cb:0115 Fujifilm FinePix A303 | ||
108 | finepix 04cb:0117 Fujifilm FinePix A310 | ||
109 | finepix 04cb:0119 Fujifilm FinePix F401 | ||
110 | finepix 04cb:011b Fujifilm FinePix F402 | ||
111 | finepix 04cb:011d Fujifilm FinePix F410 | ||
112 | finepix 04cb:0121 Fujifilm FinePix F601 | ||
113 | finepix 04cb:0123 Fujifilm FinePix F700 | ||
114 | finepix 04cb:0125 Fujifilm FinePix M603 | ||
115 | finepix 04cb:0127 Fujifilm FinePix S300 | ||
116 | finepix 04cb:0129 Fujifilm FinePix S304 | ||
117 | finepix 04cb:012b Fujifilm FinePix S500 | ||
118 | finepix 04cb:012d Fujifilm FinePix S602 | ||
119 | finepix 04cb:012f Fujifilm FinePix S700 | ||
120 | finepix 04cb:0131 Fujifilm FinePix unknown model | ||
121 | finepix 04cb:013b Fujifilm FinePix unknown model | ||
122 | finepix 04cb:013d Fujifilm FinePix unknown model | ||
123 | finepix 04cb:013f Fujifilm FinePix F420 | ||
124 | sunplus 04f1:1001 JVC GC A50 | ||
125 | spca561 04fc:0561 Flexcam 100 | ||
126 | sunplus 04fc:500c Sunplus CA500C | ||
127 | sunplus 04fc:504a Aiptek Mini PenCam 1.3 | ||
128 | sunplus 04fc:504b Maxell MaxPocket LE 1.3 | ||
129 | sunplus 04fc:5330 Digitrex 2110 | ||
130 | sunplus 04fc:5360 Sunplus Generic | ||
131 | spca500 04fc:7333 PalmPixDC85 | ||
132 | sunplus 04fc:ffff Pure DigitalDakota | ||
133 | spca501 0506:00df 3Com HomeConnect Lite | ||
134 | sunplus 052b:1513 Megapix V4 | ||
135 | tv8532 0545:808b Veo Stingray | ||
136 | tv8532 0545:8333 Veo Stingray | ||
137 | sunplus 0546:3155 Polaroid PDC3070 | ||
138 | sunplus 0546:3191 Polaroid Ion 80 | ||
139 | sunplus 0546:3273 Polaroid PDC2030 | ||
140 | ov519 054c:0154 Sonny toy4 | ||
141 | ov519 054c:0155 Sonny toy5 | ||
142 | zc3xx 055f:c005 Mustek Wcam300A | ||
143 | spca500 055f:c200 Mustek Gsmart 300 | ||
144 | sunplus 055f:c211 Kowa Bs888e Microcamera | ||
145 | spca500 055f:c220 Gsmart Mini | ||
146 | sunplus 055f:c230 Mustek Digicam 330K | ||
147 | sunplus 055f:c232 Mustek MDC3500 | ||
148 | sunplus 055f:c360 Mustek DV4000 Mpeg4 | ||
149 | sunplus 055f:c420 Mustek gSmart Mini 2 | ||
150 | sunplus 055f:c430 Mustek Gsmart LCD 2 | ||
151 | sunplus 055f:c440 Mustek DV 3000 | ||
152 | sunplus 055f:c520 Mustek gSmart Mini 3 | ||
153 | sunplus 055f:c530 Mustek Gsmart LCD 3 | ||
154 | sunplus 055f:c540 Gsmart D30 | ||
155 | sunplus 055f:c630 Mustek MDC4000 | ||
156 | sunplus 055f:c650 Mustek MDC5500Z | ||
157 | zc3xx 055f:d003 Mustek WCam300A | ||
158 | zc3xx 055f:d004 Mustek WCam300 AN | ||
159 | conex 0572:0041 Creative Notebook cx11646 | ||
160 | ov519 05a9:0519 OmniVision | ||
161 | ov519 05a9:0530 OmniVision | ||
162 | ov519 05a9:4519 OmniVision | ||
163 | ov519 05a9:8519 OmniVision | ||
164 | sunplus 05da:1018 Digital Dream Enigma 1.3 | ||
165 | stk014 05e1:0893 Syntek DV4000 | ||
166 | spca561 060b:a001 Maxell Compact Pc PM3 | ||
167 | zc3xx 0698:2003 CTX M730V built in | ||
168 | spca500 06bd:0404 Agfa CL20 | ||
169 | spca500 06be:0800 Optimedia | ||
170 | sunplus 06d6:0031 Trust 610 LCD PowerC@m Zoom | ||
171 | spca506 06e1:a190 ADS Instant VCD | ||
172 | spca508 0733:0110 ViewQuest VQ110 | ||
173 | spca508 0130:0130 Clone Digital Webcam 11043 | ||
174 | spca501 0733:0401 Intel Create and Share | ||
175 | spca501 0733:0402 ViewQuest M318B | ||
176 | spca505 0733:0430 Intel PC Camera Pro | ||
177 | sunplus 0733:1311 Digital Dream Epsilon 1.3 | ||
178 | sunplus 0733:1314 Mercury 2.1MEG Deluxe Classic Cam | ||
179 | sunplus 0733:2211 Jenoptik jdc 21 LCD | ||
180 | sunplus 0733:2221 Mercury Digital Pro 3.1p | ||
181 | sunplus 0733:3261 Concord 3045 spca536a | ||
182 | sunplus 0733:3281 Cyberpix S550V | ||
183 | spca506 0734:043b 3DeMon USB Capture aka | ||
184 | spca500 084d:0003 D-Link DSC-350 | ||
185 | spca500 08ca:0103 Aiptek PocketDV | ||
186 | sunplus 08ca:0104 Aiptek PocketDVII 1.3 | ||
187 | sunplus 08ca:0106 Aiptek Pocket DV3100+ | ||
188 | sunplus 08ca:2008 Aiptek Mini PenCam 2 M | ||
189 | sunplus 08ca:2010 Aiptek PocketCam 3M | ||
190 | sunplus 08ca:2016 Aiptek PocketCam 2 Mega | ||
191 | sunplus 08ca:2018 Aiptek Pencam SD 2M | ||
192 | sunplus 08ca:2020 Aiptek Slim 3000F | ||
193 | sunplus 08ca:2022 Aiptek Slim 3200 | ||
194 | sunplus 08ca:2024 Aiptek DV3500 Mpeg4 | ||
195 | sunplus 08ca:2028 Aiptek PocketCam4M | ||
196 | sunplus 08ca:2040 Aiptek PocketDV4100M | ||
197 | sunplus 08ca:2042 Aiptek PocketDV5100 | ||
198 | sunplus 08ca:2050 Medion MD 41437 | ||
199 | sunplus 08ca:2060 Aiptek PocketDV5300 | ||
200 | tv8532 0923:010f ICM532 cams | ||
201 | mars 093a:050f Mars-Semi Pc-Camera | ||
202 | pac207 093a:2460 PAC207 Qtec Webcam 100 | ||
203 | pac207 093a:2463 Philips SPC 220 NC | ||
204 | pac207 093a:2464 Labtec Webcam 1200 | ||
205 | pac207 093a:2468 PAC207 | ||
206 | pac207 093a:2470 Genius GF112 | ||
207 | pac207 093a:2471 Genius VideoCam ge111 | ||
208 | pac207 093a:2472 Genius VideoCam ge110 | ||
209 | pac207 093a:2476 Genius e-Messenger 112 | ||
210 | pac7311 093a:2600 PAC7311 Typhoon | ||
211 | pac7311 093a:2601 Philips SPC 610 NC | ||
212 | pac7311 093a:2603 PAC7312 | ||
213 | pac7311 093a:2608 Trust WB-3300p | ||
214 | pac7311 093a:260e Gigaware VGA PC Camera, Trust WB-3350p, SIGMA cam 2350 | ||
215 | pac7311 093a:260f SnakeCam | ||
216 | pac7311 093a:2621 PAC731x | ||
217 | pac7311 093a:2624 PAC7302 | ||
218 | pac7311 093a:2626 Labtec 2200 | ||
219 | pac7311 093a:262a Webcam 300k | ||
220 | zc3xx 0ac8:0302 Z-star Vimicro zc0302 | ||
221 | vc032x 0ac8:0321 Vimicro generic vc0321 | ||
222 | vc032x 0ac8:0323 Vimicro Vc0323 | ||
223 | vc032x 0ac8:0328 A4Tech PK-130MG | ||
224 | zc3xx 0ac8:301b Z-Star zc301b | ||
225 | zc3xx 0ac8:303b Vimicro 0x303b | ||
226 | zc3xx 0ac8:305b Z-star Vimicro zc0305b | ||
227 | zc3xx 0ac8:307b Ldlc VC302+Ov7620 | ||
228 | vc032x 0ac8:c001 Sony embedded vimicro | ||
229 | vc032x 0ac8:c002 Sony embedded vimicro | ||
230 | spca508 0af9:0010 Hama USB Sightcam 100 | ||
231 | spca508 0af9:0011 Hama USB Sightcam 100 | ||
232 | sonixb 0c45:6001 Genius VideoCAM NB | ||
233 | sonixb 0c45:6005 Microdia Sweex Mini Webcam | ||
234 | sonixb 0c45:6007 Sonix sn9c101 + Tas5110D | ||
235 | sonixb 0c45:6009 spcaCam@120 | ||
236 | sonixb 0c45:600d spcaCam@120 | ||
237 | sonixb 0c45:6011 Microdia PC Camera (SN9C102) | ||
238 | sonixb 0c45:6019 Generic Sonix OV7630 | ||
239 | sonixb 0c45:6024 Generic Sonix Tas5130c | ||
240 | sonixb 0c45:6025 Xcam Shanga | ||
241 | sonixb 0c45:6028 Sonix Btc Pc380 | ||
242 | sonixb 0c45:6029 spcaCam@150 | ||
243 | sonixb 0c45:602c Generic Sonix OV7630 | ||
244 | sonixb 0c45:602d LIC-200 LG | ||
245 | sonixb 0c45:602e Genius VideoCam Messenger | ||
246 | sonixj 0c45:6040 Speed NVC 350K | ||
247 | sonixj 0c45:607c Sonix sn9c102p Hv7131R | ||
248 | sonixj 0c45:60c0 Sangha Sn535 | ||
249 | sonixj 0c45:60ec SN9C105+MO4000 | ||
250 | sonixj 0c45:60fb Surfer NoName | ||
251 | sonixj 0c45:60fc LG-LIC300 | ||
252 | sonixj 0c45:6128 Microdia/Sonix SNP325 | ||
253 | sonixj 0c45:612a Avant Camera | ||
254 | sonixj 0c45:612c Typhoon Rasy Cam 1.3MPix | ||
255 | sonixj 0c45:6130 Sonix Pccam | ||
256 | sonixj 0c45:6138 Sn9c120 Mo4000 | ||
257 | sonixj 0c45:613b Surfer SN-206 | ||
258 | sonixj 0c45:613c Sonix Pccam168 | ||
259 | sonixj 0c45:6143 Sonix Pccam168 | ||
260 | sunplus 0d64:0303 Sunplus FashionCam DXG | ||
261 | etoms 102c:6151 Qcam Sangha CIF | ||
262 | etoms 102c:6251 Qcam xxxxxx VGA | ||
263 | zc3xx 10fd:0128 Typhoon Webshot II USB 300k 0x0128 | ||
264 | spca561 10fd:7e50 FlyCam Usb 100 | ||
265 | zc3xx 10fd:8050 Typhoon Webshot II USB 300k | ||
266 | spca501 1776:501c Arowana 300K CMOS Camera | ||
267 | t613 17a1:0128 TASCORP JPEG Webcam, NGS Cyclops | ||
268 | vc032x 17ef:4802 Lenovo Vc0323+MI1310_SOC | ||
269 | pac207 2001:f115 D-Link DSB-C120 | ||
270 | spca500 2899:012c Toptro Industrial | ||
271 | spca508 8086:0110 Intel Easy PC Camera | ||
272 | spca500 8086:0630 Intel Pocket PC Camera | ||
273 | spca506 99fa:8988 Grandtec V.cap | ||
274 | spca561 abcd:cdee Petcam | ||
diff --git a/Documentation/video4linux/m5602.txt b/Documentation/video4linux/m5602.txt new file mode 100644 index 000000000000..4450ab13f37b --- /dev/null +++ b/Documentation/video4linux/m5602.txt | |||
@@ -0,0 +1,12 @@ | |||
1 | This document describes the ALi m5602 bridge connected | ||
2 | to the following supported sensors: | ||
3 | OmniVision OV9650, | ||
4 | Samsung s5k83a, | ||
5 | Samsung s5k4aa, | ||
6 | Micron mt9m111, | ||
7 | Pixel plus PO1030 | ||
8 | |||
9 | This driver mimics the windows drivers, which have a braindead implementation sending bayer-encoded frames at VGA resolution. | ||
10 | In a perfect world we should be able to reprogram the m5602 and the connected sensor in hardware instead, supporting a range of resolutions and pixelformats | ||
11 | |||
12 | Anyway, have fun and please report any bugs to m560x-driver-devel@lists.sourceforge.net | ||
diff --git a/Documentation/video4linux/sn9c102.txt b/Documentation/video4linux/sn9c102.txt index b26f5195af51..73de4050d637 100644 --- a/Documentation/video4linux/sn9c102.txt +++ b/Documentation/video4linux/sn9c102.txt | |||
@@ -157,7 +157,7 @@ Loading can be done as shown below: | |||
157 | 157 | ||
158 | [root@localhost home]# modprobe sn9c102 | 158 | [root@localhost home]# modprobe sn9c102 |
159 | 159 | ||
160 | Note that the module is called "sn9c102" for historic reasons, althought it | 160 | Note that the module is called "sn9c102" for historic reasons, although it |
161 | does not just support the SN9C102. | 161 | does not just support the SN9C102. |
162 | 162 | ||
163 | At this point all the devices supported by the driver and connected to the USB | 163 | At this point all the devices supported by the driver and connected to the USB |
diff --git a/Documentation/video4linux/soc-camera.txt b/Documentation/video4linux/soc-camera.txt new file mode 100644 index 000000000000..178ef3c5e579 --- /dev/null +++ b/Documentation/video4linux/soc-camera.txt | |||
@@ -0,0 +1,120 @@ | |||
1 | Soc-Camera Subsystem | ||
2 | ==================== | ||
3 | |||
4 | Terminology | ||
5 | ----------- | ||
6 | |||
7 | The following terms are used in this document: | ||
8 | - camera / camera device / camera sensor - a video-camera sensor chip, capable | ||
9 | of connecting to a variety of systems and interfaces, typically uses i2c for | ||
10 | control and configuration, and a parallel or a serial bus for data. | ||
11 | - camera host - an interface, to which a camera is connected. Typically a | ||
12 | specialised interface, present on many SoCs, e.g., PXA27x and PXA3xx, SuperH, | ||
13 | AVR32, i.MX27, i.MX31. | ||
14 | - camera host bus - a connection between a camera host and a camera. Can be | ||
15 | parallel or serial, consists of data and control lines, e.g., clock, vertical | ||
16 | and horizontal synchronization signals. | ||
17 | |||
18 | Purpose of the soc-camera subsystem | ||
19 | ----------------------------------- | ||
20 | |||
21 | The soc-camera subsystem provides a unified API between camera host drivers and | ||
22 | camera sensor drivers. It implements a V4L2 interface to the user, currently | ||
23 | only the mmap method is supported. | ||
24 | |||
25 | This subsystem has been written to connect drivers for System-on-Chip (SoC) | ||
26 | video capture interfaces with drivers for CMOS camera sensor chips to enable | ||
27 | the reuse of sensor drivers with various hosts. The subsystem has been designed | ||
28 | to support multiple camera host interfaces and multiple cameras per interface, | ||
29 | although most applications have only one camera sensor. | ||
30 | |||
31 | Existing drivers | ||
32 | ---------------- | ||
33 | |||
34 | As of 2.6.27-rc4 there are two host drivers in the mainline: pxa_camera.c for | ||
35 | PXA27x SoCs and sh_mobile_ceu_camera.c for SuperH SoCs, and four sensor drivers: | ||
36 | mt9m001.c, mt9m111.c, mt9v022.c and a generic soc_camera_platform.c driver. This | ||
37 | list is not supposed to be updated, look for more examples in your tree. | ||
38 | |||
39 | Camera host API | ||
40 | --------------- | ||
41 | |||
42 | A host camera driver is registered using the | ||
43 | |||
44 | soc_camera_host_register(struct soc_camera_host *); | ||
45 | |||
46 | function. The host object can be initialized as follows: | ||
47 | |||
48 | static struct soc_camera_host pxa_soc_camera_host = { | ||
49 | .drv_name = PXA_CAM_DRV_NAME, | ||
50 | .ops = &pxa_soc_camera_host_ops, | ||
51 | }; | ||
52 | |||
53 | All camera host methods are passed in a struct soc_camera_host_ops: | ||
54 | |||
55 | static struct soc_camera_host_ops pxa_soc_camera_host_ops = { | ||
56 | .owner = THIS_MODULE, | ||
57 | .add = pxa_camera_add_device, | ||
58 | .remove = pxa_camera_remove_device, | ||
59 | .suspend = pxa_camera_suspend, | ||
60 | .resume = pxa_camera_resume, | ||
61 | .set_fmt_cap = pxa_camera_set_fmt_cap, | ||
62 | .try_fmt_cap = pxa_camera_try_fmt_cap, | ||
63 | .init_videobuf = pxa_camera_init_videobuf, | ||
64 | .reqbufs = pxa_camera_reqbufs, | ||
65 | .poll = pxa_camera_poll, | ||
66 | .querycap = pxa_camera_querycap, | ||
67 | .try_bus_param = pxa_camera_try_bus_param, | ||
68 | .set_bus_param = pxa_camera_set_bus_param, | ||
69 | }; | ||
70 | |||
71 | .add and .remove methods are called when a sensor is attached to or detached | ||
72 | from the host, apart from performing host-internal tasks they shall also call | ||
73 | sensor driver's .init and .release methods respectively. .suspend and .resume | ||
74 | methods implement host's power-management functionality and its their | ||
75 | responsibility to call respective sensor's methods. .try_bus_param and | ||
76 | .set_bus_param are used to negotiate physical connection parameters between the | ||
77 | host and the sensor. .init_videobuf is called by soc-camera core when a | ||
78 | video-device is opened, further video-buffer management is implemented completely | ||
79 | by the specific camera host driver. The rest of the methods are called from | ||
80 | respective V4L2 operations. | ||
81 | |||
82 | Camera API | ||
83 | ---------- | ||
84 | |||
85 | Sensor drivers can use struct soc_camera_link, typically provided by the | ||
86 | platform, and used to specify to which camera host bus the sensor is connected, | ||
87 | and arbitrarily provide platform .power and .reset methods for the camera. | ||
88 | soc_camera_device_register() and soc_camera_device_unregister() functions are | ||
89 | used to add a sensor driver to or remove one from the system. The registration | ||
90 | function takes a pointer to struct soc_camera_device as the only parameter. | ||
91 | This struct can be initialized as follows: | ||
92 | |||
93 | /* link to driver operations */ | ||
94 | icd->ops = &mt9m001_ops; | ||
95 | /* link to the underlying physical (e.g., i2c) device */ | ||
96 | icd->control = &client->dev; | ||
97 | /* window geometry */ | ||
98 | icd->x_min = 20; | ||
99 | icd->y_min = 12; | ||
100 | icd->x_current = 20; | ||
101 | icd->y_current = 12; | ||
102 | icd->width_min = 48; | ||
103 | icd->width_max = 1280; | ||
104 | icd->height_min = 32; | ||
105 | icd->height_max = 1024; | ||
106 | icd->y_skip_top = 1; | ||
107 | /* camera bus ID, typically obtained from platform data */ | ||
108 | icd->iface = icl->bus_id; | ||
109 | |||
110 | struct soc_camera_ops provides .probe and .remove methods, which are called by | ||
111 | the soc-camera core, when a camera is matched against or removed from a camera | ||
112 | host bus, .init, .release, .suspend, and .resume are called from the camera host | ||
113 | driver as discussed above. Other members of this struct provide respective V4L2 | ||
114 | functionality. | ||
115 | |||
116 | struct soc_camera_device also links to an array of struct soc_camera_data_format, | ||
117 | listing pixel formats, supported by the camera. | ||
118 | |||
119 | -- | ||
120 | Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de> | ||
diff --git a/Documentation/video4linux/w9968cf.txt b/Documentation/video4linux/w9968cf.txt index e0bba8393c77..05138e8aea07 100644 --- a/Documentation/video4linux/w9968cf.txt +++ b/Documentation/video4linux/w9968cf.txt | |||
@@ -193,9 +193,6 @@ Description: Automatic 'ovcamchip' module loading: 0 disabled, 1 enabled. | |||
193 | loads that module automatically. This action is performed as | 193 | loads that module automatically. This action is performed as |
194 | once soon as the 'w9968cf' module is loaded into memory. | 194 | once soon as the 'w9968cf' module is loaded into memory. |
195 | Default: 1 | 195 | Default: 1 |
196 | Note: The kernel must be compiled with the CONFIG_KMOD option | ||
197 | enabled for the 'ovcamchip' module to be loaded and for | ||
198 | this parameter to be present. | ||
199 | ------------------------------------------------------------------------------- | 196 | ------------------------------------------------------------------------------- |
200 | Name: simcams | 197 | Name: simcams |
201 | Type: int | 198 | Type: int |
diff --git a/Documentation/vm/Makefile b/Documentation/vm/Makefile new file mode 100644 index 000000000000..6f562f778b28 --- /dev/null +++ b/Documentation/vm/Makefile | |||
@@ -0,0 +1,8 @@ | |||
1 | # kbuild trick to avoid linker error. Can be omitted if a module is built. | ||
2 | obj- := dummy.o | ||
3 | |||
4 | # List of programs to build | ||
5 | hostprogs-y := slabinfo | ||
6 | |||
7 | # Tell kbuild to always build the programs | ||
8 | always := $(hostprogs-y) | ||
diff --git a/Documentation/vm/hugetlbpage.txt b/Documentation/vm/hugetlbpage.txt index 3102b81bef88..ea8714fcc3ad 100644 --- a/Documentation/vm/hugetlbpage.txt +++ b/Documentation/vm/hugetlbpage.txt | |||
@@ -77,7 +77,7 @@ memory that is preset in system at this time. System administrators may want | |||
77 | to put this command in one of the local rc init files. This will enable the | 77 | to put this command in one of the local rc init files. This will enable the |
78 | kernel to request huge pages early in the boot process (when the possibility | 78 | kernel to request huge pages early in the boot process (when the possibility |
79 | of getting physical contiguous pages is still very high). In either | 79 | of getting physical contiguous pages is still very high). In either |
80 | case, adminstrators will want to verify the number of hugepages actually | 80 | case, administrators will want to verify the number of hugepages actually |
81 | allocated by checking the sysctl or meminfo. | 81 | allocated by checking the sysctl or meminfo. |
82 | 82 | ||
83 | /proc/sys/vm/nr_overcommit_hugepages indicates how large the pool of | 83 | /proc/sys/vm/nr_overcommit_hugepages indicates how large the pool of |
@@ -95,6 +95,29 @@ this condition holds, however, no more surplus huge pages will be | |||
95 | allowed on the system until one of the two sysctls are increased | 95 | allowed on the system until one of the two sysctls are increased |
96 | sufficiently, or the surplus huge pages go out of use and are freed. | 96 | sufficiently, or the surplus huge pages go out of use and are freed. |
97 | 97 | ||
98 | With support for multiple hugepage pools at run-time available, much of | ||
99 | the hugepage userspace interface has been duplicated in sysfs. The above | ||
100 | information applies to the default hugepage size (which will be | ||
101 | controlled by the proc interfaces for backwards compatibility). The root | ||
102 | hugepage control directory is | ||
103 | |||
104 | /sys/kernel/mm/hugepages | ||
105 | |||
106 | For each hugepage size supported by the running kernel, a subdirectory | ||
107 | will exist, of the form | ||
108 | |||
109 | hugepages-${size}kB | ||
110 | |||
111 | Inside each of these directories, the same set of files will exist: | ||
112 | |||
113 | nr_hugepages | ||
114 | nr_overcommit_hugepages | ||
115 | free_hugepages | ||
116 | resv_hugepages | ||
117 | surplus_hugepages | ||
118 | |||
119 | which function as described above for the default hugepage-sized case. | ||
120 | |||
98 | If the user applications are going to request hugepages using mmap system | 121 | If the user applications are going to request hugepages using mmap system |
99 | call, then it is required that system administrator mount a file system of | 122 | call, then it is required that system administrator mount a file system of |
100 | type hugetlbfs: | 123 | type hugetlbfs: |
diff --git a/Documentation/vm/numa_memory_policy.txt b/Documentation/vm/numa_memory_policy.txt index bad16d3f6a47..6aaaeb38730c 100644 --- a/Documentation/vm/numa_memory_policy.txt +++ b/Documentation/vm/numa_memory_policy.txt | |||
@@ -58,7 +58,7 @@ most general to most specific: | |||
58 | the policy at the time they were allocated. | 58 | the policy at the time they were allocated. |
59 | 59 | ||
60 | VMA Policy: A "VMA" or "Virtual Memory Area" refers to a range of a task's | 60 | VMA Policy: A "VMA" or "Virtual Memory Area" refers to a range of a task's |
61 | virtual adddress space. A task may define a specific policy for a range | 61 | virtual address space. A task may define a specific policy for a range |
62 | of its virtual address space. See the MEMORY POLICIES APIS section, | 62 | of its virtual address space. See the MEMORY POLICIES APIS section, |
63 | below, for an overview of the mbind() system call used to set a VMA | 63 | below, for an overview of the mbind() system call used to set a VMA |
64 | policy. | 64 | policy. |
@@ -353,7 +353,7 @@ follows: | |||
353 | 353 | ||
354 | Because of this extra reference counting, and because we must lookup | 354 | Because of this extra reference counting, and because we must lookup |
355 | shared policies in a tree structure under spinlock, shared policies are | 355 | shared policies in a tree structure under spinlock, shared policies are |
356 | more expensive to use in the page allocation path. This is expecially | 356 | more expensive to use in the page allocation path. This is especially |
357 | true for shared policies on shared memory regions shared by tasks running | 357 | true for shared policies on shared memory regions shared by tasks running |
358 | on different NUMA nodes. This extra overhead can be avoided by always | 358 | on different NUMA nodes. This extra overhead can be avoided by always |
359 | falling back to task or system default policy for shared memory regions, | 359 | falling back to task or system default policy for shared memory regions, |
diff --git a/Documentation/vm/page_migration b/Documentation/vm/page_migration index 99f89aa10169..d5fdfd34bbaf 100644 --- a/Documentation/vm/page_migration +++ b/Documentation/vm/page_migration | |||
@@ -18,10 +18,11 @@ migrate_pages function call takes two sets of nodes and moves pages of a | |||
18 | process that are located on the from nodes to the destination nodes. | 18 | process that are located on the from nodes to the destination nodes. |
19 | Page migration functions are provided by the numactl package by Andi Kleen | 19 | Page migration functions are provided by the numactl package by Andi Kleen |
20 | (a version later than 0.9.3 is required. Get it from | 20 | (a version later than 0.9.3 is required. Get it from |
21 | ftp://ftp.suse.com/pub/people/ak). numactl provided libnuma which | 21 | ftp://oss.sgi.com/www/projects/libnuma/download/). numactl provides libnuma |
22 | provides an interface similar to other numa functionality for page migration. | 22 | which provides an interface similar to other numa functionality for page |
23 | cat /proc/<pid>/numa_maps allows an easy review of where the pages of | 23 | migration. cat /proc/<pid>/numa_maps allows an easy review of where the |
24 | a process are located. See also the numa_maps manpage in the numactl package. | 24 | pages of a process are located. See also the numa_maps documentation in the |
25 | proc(5) man page. | ||
25 | 26 | ||
26 | Manual migration is useful if for example the scheduler has relocated | 27 | Manual migration is useful if for example the scheduler has relocated |
27 | a process to a processor on a distant node. A batch scheduler or an | 28 | a process to a processor on a distant node. A batch scheduler or an |
diff --git a/Documentation/vm/unevictable-lru.txt b/Documentation/vm/unevictable-lru.txt new file mode 100644 index 000000000000..125eed560e5a --- /dev/null +++ b/Documentation/vm/unevictable-lru.txt | |||
@@ -0,0 +1,615 @@ | |||
1 | |||
2 | This document describes the Linux memory management "Unevictable LRU" | ||
3 | infrastructure and the use of this infrastructure to manage several types | ||
4 | of "unevictable" pages. The document attempts to provide the overall | ||
5 | rationale behind this mechanism and the rationale for some of the design | ||
6 | decisions that drove the implementation. The latter design rationale is | ||
7 | discussed in the context of an implementation description. Admittedly, one | ||
8 | can obtain the implementation details--the "what does it do?"--by reading the | ||
9 | code. One hopes that the descriptions below add value by provide the answer | ||
10 | to "why does it do that?". | ||
11 | |||
12 | Unevictable LRU Infrastructure: | ||
13 | |||
14 | The Unevictable LRU adds an additional LRU list to track unevictable pages | ||
15 | and to hide these pages from vmscan. This mechanism is based on a patch by | ||
16 | Larry Woodman of Red Hat to address several scalability problems with page | ||
17 | reclaim in Linux. The problems have been observed at customer sites on large | ||
18 | memory x86_64 systems. For example, a non-numal x86_64 platform with 128GB | ||
19 | of main memory will have over 32 million 4k pages in a single zone. When a | ||
20 | large fraction of these pages are not evictable for any reason [see below], | ||
21 | vmscan will spend a lot of time scanning the LRU lists looking for the small | ||
22 | fraction of pages that are evictable. This can result in a situation where | ||
23 | all cpus are spending 100% of their time in vmscan for hours or days on end, | ||
24 | with the system completely unresponsive. | ||
25 | |||
26 | The Unevictable LRU infrastructure addresses the following classes of | ||
27 | unevictable pages: | ||
28 | |||
29 | + page owned by ramfs | ||
30 | + page mapped into SHM_LOCKed shared memory regions | ||
31 | + page mapped into VM_LOCKED [mlock()ed] vmas | ||
32 | |||
33 | The infrastructure might be able to handle other conditions that make pages | ||
34 | unevictable, either by definition or by circumstance, in the future. | ||
35 | |||
36 | |||
37 | The Unevictable LRU List | ||
38 | |||
39 | The Unevictable LRU infrastructure consists of an additional, per-zone, LRU list | ||
40 | called the "unevictable" list and an associated page flag, PG_unevictable, to | ||
41 | indicate that the page is being managed on the unevictable list. The | ||
42 | PG_unevictable flag is analogous to, and mutually exclusive with, the PG_active | ||
43 | flag in that it indicates on which LRU list a page resides when PG_lru is set. | ||
44 | The unevictable LRU list is source configurable based on the UNEVICTABLE_LRU | ||
45 | Kconfig option. | ||
46 | |||
47 | The Unevictable LRU infrastructure maintains unevictable pages on an additional | ||
48 | LRU list for a few reasons: | ||
49 | |||
50 | 1) We get to "treat unevictable pages just like we treat other pages in the | ||
51 | system, which means we get to use the same code to manipulate them, the | ||
52 | same code to isolate them (for migrate, etc.), the same code to keep track | ||
53 | of the statistics, etc..." [Rik van Riel] | ||
54 | |||
55 | 2) We want to be able to migrate unevictable pages between nodes--for memory | ||
56 | defragmentation, workload management and memory hotplug. The linux kernel | ||
57 | can only migrate pages that it can successfully isolate from the lru lists. | ||
58 | If we were to maintain pages elsewise than on an lru-like list, where they | ||
59 | can be found by isolate_lru_page(), we would prevent their migration, unless | ||
60 | we reworked migration code to find the unevictable pages. | ||
61 | |||
62 | |||
63 | The unevictable LRU list does not differentiate between file backed and swap | ||
64 | backed [anon] pages. This differentiation is only important while the pages | ||
65 | are, in fact, evictable. | ||
66 | |||
67 | The unevictable LRU list benefits from the "arrayification" of the per-zone | ||
68 | LRU lists and statistics originally proposed and posted by Christoph Lameter. | ||
69 | |||
70 | The unevictable list does not use the lru pagevec mechanism. Rather, | ||
71 | unevictable pages are placed directly on the page's zone's unevictable | ||
72 | list under the zone lru_lock. The reason for this is to prevent stranding | ||
73 | of pages on the unevictable list when one task has the page isolated from the | ||
74 | lru and other tasks are changing the "evictability" state of the page. | ||
75 | |||
76 | |||
77 | Unevictable LRU and Memory Controller Interaction | ||
78 | |||
79 | The memory controller data structure automatically gets a per zone unevictable | ||
80 | lru list as a result of the "arrayification" of the per-zone LRU lists. The | ||
81 | memory controller tracks the movement of pages to and from the unevictable list. | ||
82 | When a memory control group comes under memory pressure, the controller will | ||
83 | not attempt to reclaim pages on the unevictable list. This has a couple of | ||
84 | effects. Because the pages are "hidden" from reclaim on the unevictable list, | ||
85 | the reclaim process can be more efficient, dealing only with pages that have | ||
86 | a chance of being reclaimed. On the other hand, if too many of the pages | ||
87 | charged to the control group are unevictable, the evictable portion of the | ||
88 | working set of the tasks in the control group may not fit into the available | ||
89 | memory. This can cause the control group to thrash or to oom-kill tasks. | ||
90 | |||
91 | |||
92 | Unevictable LRU: Detecting Unevictable Pages | ||
93 | |||
94 | The function page_evictable(page, vma) in vmscan.c determines whether a | ||
95 | page is evictable or not. For ramfs pages and pages in SHM_LOCKed regions, | ||
96 | page_evictable() tests a new address space flag, AS_UNEVICTABLE, in the page's | ||
97 | address space using a wrapper function. Wrapper functions are used to set, | ||
98 | clear and test the flag to reduce the requirement for #ifdef's throughout the | ||
99 | source code. AS_UNEVICTABLE is set on ramfs inode/mapping when it is created. | ||
100 | This flag remains for the life of the inode. | ||
101 | |||
102 | For shared memory regions, AS_UNEVICTABLE is set when an application | ||
103 | successfully SHM_LOCKs the region and is removed when the region is | ||
104 | SHM_UNLOCKed. Note that shmctl(SHM_LOCK, ...) does not populate the page | ||
105 | tables for the region as does, for example, mlock(). So, we make no special | ||
106 | effort to push any pages in the SHM_LOCKed region to the unevictable list. | ||
107 | Vmscan will do this when/if it encounters the pages during reclaim. On | ||
108 | SHM_UNLOCK, shmctl() scans the pages in the region and "rescues" them from the | ||
109 | unevictable list if no other condition keeps them unevictable. If a SHM_LOCKed | ||
110 | region is destroyed, the pages are also "rescued" from the unevictable list in | ||
111 | the process of freeing them. | ||
112 | |||
113 | page_evictable() detects mlock()ed pages by testing an additional page flag, | ||
114 | PG_mlocked via the PageMlocked() wrapper. If the page is NOT mlocked, and a | ||
115 | non-NULL vma is supplied, page_evictable() will check whether the vma is | ||
116 | VM_LOCKED via is_mlocked_vma(). is_mlocked_vma() will SetPageMlocked() and | ||
117 | update the appropriate statistics if the vma is VM_LOCKED. This method allows | ||
118 | efficient "culling" of pages in the fault path that are being faulted in to | ||
119 | VM_LOCKED vmas. | ||
120 | |||
121 | |||
122 | Unevictable Pages and Vmscan [shrink_*_list()] | ||
123 | |||
124 | If unevictable pages are culled in the fault path, or moved to the unevictable | ||
125 | list at mlock() or mmap() time, vmscan will never encounter the pages until | ||
126 | they have become evictable again, for example, via munlock() and have been | ||
127 | "rescued" from the unevictable list. However, there may be situations where we | ||
128 | decide, for the sake of expediency, to leave a unevictable page on one of the | ||
129 | regular active/inactive LRU lists for vmscan to deal with. Vmscan checks for | ||
130 | such pages in all of the shrink_{active|inactive|page}_list() functions and | ||
131 | will "cull" such pages that it encounters--that is, it diverts those pages to | ||
132 | the unevictable list for the zone being scanned. | ||
133 | |||
134 | There may be situations where a page is mapped into a VM_LOCKED vma, but the | ||
135 | page is not marked as PageMlocked. Such pages will make it all the way to | ||
136 | shrink_page_list() where they will be detected when vmscan walks the reverse | ||
137 | map in try_to_unmap(). If try_to_unmap() returns SWAP_MLOCK, shrink_page_list() | ||
138 | will cull the page at that point. | ||
139 | |||
140 | Note that for anonymous pages, shrink_page_list() attempts to add the page to | ||
141 | the swap cache before it tries to unmap the page. To avoid this unnecessary | ||
142 | consumption of swap space, shrink_page_list() calls try_to_munlock() to check | ||
143 | whether any VM_LOCKED vmas map the page without attempting to unmap the page. | ||
144 | If try_to_munlock() returns SWAP_MLOCK, shrink_page_list() will cull the page | ||
145 | without consuming swap space. try_to_munlock() will be described below. | ||
146 | |||
147 | To "cull" an unevictable page, vmscan simply puts the page back on the lru | ||
148 | list using putback_lru_page()--the inverse operation to isolate_lru_page()-- | ||
149 | after dropping the page lock. Because the condition which makes the page | ||
150 | unevictable may change once the page is unlocked, putback_lru_page() will | ||
151 | recheck the unevictable state of a page that it places on the unevictable lru | ||
152 | list. If the page has become unevictable, putback_lru_page() removes it from | ||
153 | the list and retries, including the page_unevictable() test. Because such a | ||
154 | race is a rare event and movement of pages onto the unevictable list should be | ||
155 | rare, these extra evictabilty checks should not occur in the majority of calls | ||
156 | to putback_lru_page(). | ||
157 | |||
158 | |||
159 | Mlocked Page: Prior Work | ||
160 | |||
161 | The "Unevictable Mlocked Pages" infrastructure is based on work originally | ||
162 | posted by Nick Piggin in an RFC patch entitled "mm: mlocked pages off LRU". | ||
163 | Nick posted his patch as an alternative to a patch posted by Christoph | ||
164 | Lameter to achieve the same objective--hiding mlocked pages from vmscan. | ||
165 | In Nick's patch, he used one of the struct page lru list link fields as a count | ||
166 | of VM_LOCKED vmas that map the page. This use of the link field for a count | ||
167 | prevented the management of the pages on an LRU list. Thus, mlocked pages were | ||
168 | not migratable as isolate_lru_page() could not find them and the lru list link | ||
169 | field was not available to the migration subsystem. Nick resolved this by | ||
170 | putting mlocked pages back on the lru list before attempting to isolate them, | ||
171 | thus abandoning the count of VM_LOCKED vmas. When Nick's patch was integrated | ||
172 | with the Unevictable LRU work, the count was replaced by walking the reverse | ||
173 | map to determine whether any VM_LOCKED vmas mapped the page. More on this | ||
174 | below. | ||
175 | |||
176 | |||
177 | Mlocked Pages: Basic Management | ||
178 | |||
179 | Mlocked pages--pages mapped into a VM_LOCKED vma--represent one class of | ||
180 | unevictable pages. When such a page has been "noticed" by the memory | ||
181 | management subsystem, the page is marked with the PG_mlocked [PageMlocked()] | ||
182 | flag. A PageMlocked() page will be placed on the unevictable LRU list when | ||
183 | it is added to the LRU. Pages can be "noticed" by memory management in | ||
184 | several places: | ||
185 | |||
186 | 1) in the mlock()/mlockall() system call handlers. | ||
187 | 2) in the mmap() system call handler when mmap()ing a region with the | ||
188 | MAP_LOCKED flag, or mmap()ing a region in a task that has called | ||
189 | mlockall() with the MCL_FUTURE flag. Both of these conditions result | ||
190 | in the VM_LOCKED flag being set for the vma. | ||
191 | 3) in the fault path, if mlocked pages are "culled" in the fault path, | ||
192 | and when a VM_LOCKED stack segment is expanded. | ||
193 | 4) as mentioned above, in vmscan:shrink_page_list() with attempting to | ||
194 | reclaim a page in a VM_LOCKED vma--via try_to_unmap() or try_to_munlock(). | ||
195 | |||
196 | Mlocked pages become unlocked and rescued from the unevictable list when: | ||
197 | |||
198 | 1) mapped in a range unlocked via the munlock()/munlockall() system calls. | ||
199 | 2) munmapped() out of the last VM_LOCKED vma that maps the page, including | ||
200 | unmapping at task exit. | ||
201 | 3) when the page is truncated from the last VM_LOCKED vma of an mmap()ed file. | ||
202 | 4) before a page is COWed in a VM_LOCKED vma. | ||
203 | |||
204 | |||
205 | Mlocked Pages: mlock()/mlockall() System Call Handling | ||
206 | |||
207 | Both [do_]mlock() and [do_]mlockall() system call handlers call mlock_fixup() | ||
208 | for each vma in the range specified by the call. In the case of mlockall(), | ||
209 | this is the entire active address space of the task. Note that mlock_fixup() | ||
210 | is used for both mlock()ing and munlock()ing a range of memory. A call to | ||
211 | mlock() an already VM_LOCKED vma, or to munlock() a vma that is not VM_LOCKED | ||
212 | is treated as a no-op--mlock_fixup() simply returns. | ||
213 | |||
214 | If the vma passes some filtering described in "Mlocked Pages: Filtering Vmas" | ||
215 | below, mlock_fixup() will attempt to merge the vma with its neighbors or split | ||
216 | off a subset of the vma if the range does not cover the entire vma. Once the | ||
217 | vma has been merged or split or neither, mlock_fixup() will call | ||
218 | __mlock_vma_pages_range() to fault in the pages via get_user_pages() and | ||
219 | to mark the pages as mlocked via mlock_vma_page(). | ||
220 | |||
221 | Note that the vma being mlocked might be mapped with PROT_NONE. In this case, | ||
222 | get_user_pages() will be unable to fault in the pages. That's OK. If pages | ||
223 | do end up getting faulted into this VM_LOCKED vma, we'll handle them in the | ||
224 | fault path or in vmscan. | ||
225 | |||
226 | Also note that a page returned by get_user_pages() could be truncated or | ||
227 | migrated out from under us, while we're trying to mlock it. To detect | ||
228 | this, __mlock_vma_pages_range() tests the page_mapping after acquiring | ||
229 | the page lock. If the page is still associated with its mapping, we'll | ||
230 | go ahead and call mlock_vma_page(). If the mapping is gone, we just | ||
231 | unlock the page and move on. Worse case, this results in page mapped | ||
232 | in a VM_LOCKED vma remaining on a normal LRU list without being | ||
233 | PageMlocked(). Again, vmscan will detect and cull such pages. | ||
234 | |||
235 | mlock_vma_page(), called with the page locked [N.B., not "mlocked"], will | ||
236 | TestSetPageMlocked() for each page returned by get_user_pages(). We use | ||
237 | TestSetPageMlocked() because the page might already be mlocked by another | ||
238 | task/vma and we don't want to do extra work. We especially do not want to | ||
239 | count an mlocked page more than once in the statistics. If the page was | ||
240 | already mlocked, mlock_vma_page() is done. | ||
241 | |||
242 | If the page was NOT already mlocked, mlock_vma_page() attempts to isolate the | ||
243 | page from the LRU, as it is likely on the appropriate active or inactive list | ||
244 | at that time. If the isolate_lru_page() succeeds, mlock_vma_page() will | ||
245 | putback the page--putback_lru_page()--which will notice that the page is now | ||
246 | mlocked and divert the page to the zone's unevictable LRU list. If | ||
247 | mlock_vma_page() is unable to isolate the page from the LRU, vmscan will handle | ||
248 | it later if/when it attempts to reclaim the page. | ||
249 | |||
250 | |||
251 | Mlocked Pages: Filtering Special Vmas | ||
252 | |||
253 | mlock_fixup() filters several classes of "special" vmas: | ||
254 | |||
255 | 1) vmas with VM_IO|VM_PFNMAP set are skipped entirely. The pages behind | ||
256 | these mappings are inherently pinned, so we don't need to mark them as | ||
257 | mlocked. In any case, most of the pages have no struct page in which to | ||
258 | so mark the page. Because of this, get_user_pages() will fail for these | ||
259 | vmas, so there is no sense in attempting to visit them. | ||
260 | |||
261 | 2) vmas mapping hugetlbfs page are already effectively pinned into memory. | ||
262 | We don't need nor want to mlock() these pages. However, to preserve the | ||
263 | prior behavior of mlock()--before the unevictable/mlock changes--mlock_fixup() | ||
264 | will call make_pages_present() in the hugetlbfs vma range to allocate the | ||
265 | huge pages and populate the ptes. | ||
266 | |||
267 | 3) vmas with VM_DONTEXPAND|VM_RESERVED are generally user space mappings of | ||
268 | kernel pages, such as the vdso page, relay channel pages, etc. These pages | ||
269 | are inherently unevictable and are not managed on the LRU lists. | ||
270 | mlock_fixup() treats these vmas the same as hugetlbfs vmas. It calls | ||
271 | make_pages_present() to populate the ptes. | ||
272 | |||
273 | Note that for all of these special vmas, mlock_fixup() does not set the | ||
274 | VM_LOCKED flag. Therefore, we won't have to deal with them later during | ||
275 | munlock() or munmap()--for example, at task exit. Neither does mlock_fixup() | ||
276 | account these vmas against the task's "locked_vm". | ||
277 | |||
278 | Mlocked Pages: Downgrading the Mmap Semaphore. | ||
279 | |||
280 | mlock_fixup() must be called with the mmap semaphore held for write, because | ||
281 | it may have to merge or split vmas. However, mlocking a large region of | ||
282 | memory can take a long time--especially if vmscan must reclaim pages to | ||
283 | satisfy the regions requirements. Faulting in a large region with the mmap | ||
284 | semaphore held for write can hold off other faults on the address space, in | ||
285 | the case of a multi-threaded task. It can also hold off scans of the task's | ||
286 | address space via /proc. While testing under heavy load, it was observed that | ||
287 | the ps(1) command could be held off for many minutes while a large segment was | ||
288 | mlock()ed down. | ||
289 | |||
290 | To address this issue, and to make the system more responsive during mlock()ing | ||
291 | of large segments, mlock_fixup() downgrades the mmap semaphore to read mode | ||
292 | during the call to __mlock_vma_pages_range(). This works fine. However, the | ||
293 | callers of mlock_fixup() expect the semaphore to be returned in write mode. | ||
294 | So, mlock_fixup() "upgrades" the semphore to write mode. Linux does not | ||
295 | support an atomic upgrade_sem() call, so mlock_fixup() must drop the semaphore | ||
296 | and reacquire it in write mode. In a multi-threaded task, it is possible for | ||
297 | the task memory map to change while the semaphore is dropped. Therefore, | ||
298 | mlock_fixup() looks up the vma at the range start address after reacquiring | ||
299 | the semaphore in write mode and verifies that it still covers the original | ||
300 | range. If not, mlock_fixup() returns an error [-EAGAIN]. All callers of | ||
301 | mlock_fixup() have been changed to deal with this new error condition. | ||
302 | |||
303 | Note: when munlocking a region, all of the pages should already be resident-- | ||
304 | unless we have racing threads mlocking() and munlocking() regions. So, | ||
305 | unlocking should not have to wait for page allocations nor faults of any kind. | ||
306 | Therefore mlock_fixup() does not downgrade the semaphore for munlock(). | ||
307 | |||
308 | |||
309 | Mlocked Pages: munlock()/munlockall() System Call Handling | ||
310 | |||
311 | The munlock() and munlockall() system calls are handled by the same functions-- | ||
312 | do_mlock[all]()--as the mlock() and mlockall() system calls with the unlock | ||
313 | vs lock operation indicated by an argument. So, these system calls are also | ||
314 | handled by mlock_fixup(). Again, if called for an already munlock()ed vma, | ||
315 | mlock_fixup() simply returns. Because of the vma filtering discussed above, | ||
316 | VM_LOCKED will not be set in any "special" vmas. So, these vmas will be | ||
317 | ignored for munlock. | ||
318 | |||
319 | If the vma is VM_LOCKED, mlock_fixup() again attempts to merge or split off | ||
320 | the specified range. The range is then munlocked via the function | ||
321 | __mlock_vma_pages_range()--the same function used to mlock a vma range-- | ||
322 | passing a flag to indicate that munlock() is being performed. | ||
323 | |||
324 | Because the vma access protections could have been changed to PROT_NONE after | ||
325 | faulting in and mlocking some pages, get_user_pages() was unreliable for visiting | ||
326 | these pages for munlocking. Because we don't want to leave pages mlocked(), | ||
327 | get_user_pages() was enhanced to accept a flag to ignore the permissions when | ||
328 | fetching the pages--all of which should be resident as a result of previous | ||
329 | mlock()ing. | ||
330 | |||
331 | For munlock(), __mlock_vma_pages_range() unlocks individual pages by calling | ||
332 | munlock_vma_page(). munlock_vma_page() unconditionally clears the PG_mlocked | ||
333 | flag using TestClearPageMlocked(). As with mlock_vma_page(), munlock_vma_page() | ||
334 | use the Test*PageMlocked() function to handle the case where the page might | ||
335 | have already been unlocked by another task. If the page was mlocked, | ||
336 | munlock_vma_page() updates that zone statistics for the number of mlocked | ||
337 | pages. Note, however, that at this point we haven't checked whether the page | ||
338 | is mapped by other VM_LOCKED vmas. | ||
339 | |||
340 | We can't call try_to_munlock(), the function that walks the reverse map to check | ||
341 | for other VM_LOCKED vmas, without first isolating the page from the LRU. | ||
342 | try_to_munlock() is a variant of try_to_unmap() and thus requires that the page | ||
343 | not be on an lru list. [More on these below.] However, the call to | ||
344 | isolate_lru_page() could fail, in which case we couldn't try_to_munlock(). | ||
345 | So, we go ahead and clear PG_mlocked up front, as this might be the only chance | ||
346 | we have. If we can successfully isolate the page, we go ahead and | ||
347 | try_to_munlock(), which will restore the PG_mlocked flag and update the zone | ||
348 | page statistics if it finds another vma holding the page mlocked. If we fail | ||
349 | to isolate the page, we'll have left a potentially mlocked page on the LRU. | ||
350 | This is fine, because we'll catch it later when/if vmscan tries to reclaim the | ||
351 | page. This should be relatively rare. | ||
352 | |||
353 | Mlocked Pages: Migrating Them... | ||
354 | |||
355 | A page that is being migrated has been isolated from the lru lists and is | ||
356 | held locked across unmapping of the page, updating the page's mapping | ||
357 | [address_space] entry and copying the contents and state, until the | ||
358 | page table entry has been replaced with an entry that refers to the new | ||
359 | page. Linux supports migration of mlocked pages and other unevictable | ||
360 | pages. This involves simply moving the PageMlocked and PageUnevictable states | ||
361 | from the old page to the new page. | ||
362 | |||
363 | Note that page migration can race with mlocking or munlocking of the same | ||
364 | page. This has been discussed from the mlock/munlock perspective in the | ||
365 | respective sections above. Both processes [migration, m[un]locking], hold | ||
366 | the page locked. This provides the first level of synchronization. Page | ||
367 | migration zeros out the page_mapping of the old page before unlocking it, | ||
368 | so m[un]lock can skip these pages by testing the page mapping under page | ||
369 | lock. | ||
370 | |||
371 | When completing page migration, we place the new and old pages back onto the | ||
372 | lru after dropping the page lock. The "unneeded" page--old page on success, | ||
373 | new page on failure--will be freed when the reference count held by the | ||
374 | migration process is released. To ensure that we don't strand pages on the | ||
375 | unevictable list because of a race between munlock and migration, page | ||
376 | migration uses the putback_lru_page() function to add migrated pages back to | ||
377 | the lru. | ||
378 | |||
379 | |||
380 | Mlocked Pages: mmap(MAP_LOCKED) System Call Handling | ||
381 | |||
382 | In addition the the mlock()/mlockall() system calls, an application can request | ||
383 | that a region of memory be mlocked using the MAP_LOCKED flag with the mmap() | ||
384 | call. Furthermore, any mmap() call or brk() call that expands the heap by a | ||
385 | task that has previously called mlockall() with the MCL_FUTURE flag will result | ||
386 | in the newly mapped memory being mlocked. Before the unevictable/mlock changes, | ||
387 | the kernel simply called make_pages_present() to allocate pages and populate | ||
388 | the page table. | ||
389 | |||
390 | To mlock a range of memory under the unevictable/mlock infrastructure, the | ||
391 | mmap() handler and task address space expansion functions call | ||
392 | mlock_vma_pages_range() specifying the vma and the address range to mlock. | ||
393 | mlock_vma_pages_range() filters vmas like mlock_fixup(), as described above in | ||
394 | "Mlocked Pages: Filtering Vmas". It will clear the VM_LOCKED flag, which will | ||
395 | have already been set by the caller, in filtered vmas. Thus these vma's need | ||
396 | not be visited for munlock when the region is unmapped. | ||
397 | |||
398 | For "normal" vmas, mlock_vma_pages_range() calls __mlock_vma_pages_range() to | ||
399 | fault/allocate the pages and mlock them. Again, like mlock_fixup(), | ||
400 | mlock_vma_pages_range() downgrades the mmap semaphore to read mode before | ||
401 | attempting to fault/allocate and mlock the pages; and "upgrades" the semaphore | ||
402 | back to write mode before returning. | ||
403 | |||
404 | The callers of mlock_vma_pages_range() will have already added the memory | ||
405 | range to be mlocked to the task's "locked_vm". To account for filtered vmas, | ||
406 | mlock_vma_pages_range() returns the number of pages NOT mlocked. All of the | ||
407 | callers then subtract a non-negative return value from the task's locked_vm. | ||
408 | A negative return value represent an error--for example, from get_user_pages() | ||
409 | attempting to fault in a vma with PROT_NONE access. In this case, we leave | ||
410 | the memory range accounted as locked_vm, as the protections could be changed | ||
411 | later and pages allocated into that region. | ||
412 | |||
413 | |||
414 | Mlocked Pages: munmap()/exit()/exec() System Call Handling | ||
415 | |||
416 | When unmapping an mlocked region of memory, whether by an explicit call to | ||
417 | munmap() or via an internal unmap from exit() or exec() processing, we must | ||
418 | munlock the pages if we're removing the last VM_LOCKED vma that maps the pages. | ||
419 | Before the unevictable/mlock changes, mlocking did not mark the pages in any way, | ||
420 | so unmapping them required no processing. | ||
421 | |||
422 | To munlock a range of memory under the unevictable/mlock infrastructure, the | ||
423 | munmap() hander and task address space tear down function call | ||
424 | munlock_vma_pages_all(). The name reflects the observation that one always | ||
425 | specifies the entire vma range when munlock()ing during unmap of a region. | ||
426 | Because of the vma filtering when mlocking() regions, only "normal" vmas that | ||
427 | actually contain mlocked pages will be passed to munlock_vma_pages_all(). | ||
428 | |||
429 | munlock_vma_pages_all() clears the VM_LOCKED vma flag and, like mlock_fixup() | ||
430 | for the munlock case, calls __munlock_vma_pages_range() to walk the page table | ||
431 | for the vma's memory range and munlock_vma_page() each resident page mapped by | ||
432 | the vma. This effectively munlocks the page, only if this is the last | ||
433 | VM_LOCKED vma that maps the page. | ||
434 | |||
435 | |||
436 | Mlocked Page: try_to_unmap() | ||
437 | |||
438 | [Note: the code changes represented by this section are really quite small | ||
439 | compared to the text to describe what happening and why, and to discuss the | ||
440 | implications.] | ||
441 | |||
442 | Pages can, of course, be mapped into multiple vmas. Some of these vmas may | ||
443 | have VM_LOCKED flag set. It is possible for a page mapped into one or more | ||
444 | VM_LOCKED vmas not to have the PG_mlocked flag set and therefore reside on one | ||
445 | of the active or inactive LRU lists. This could happen if, for example, a | ||
446 | task in the process of munlock()ing the page could not isolate the page from | ||
447 | the LRU. As a result, vmscan/shrink_page_list() might encounter such a page | ||
448 | as described in "Unevictable Pages and Vmscan [shrink_*_list()]". To | ||
449 | handle this situation, try_to_unmap() has been enhanced to check for VM_LOCKED | ||
450 | vmas while it is walking a page's reverse map. | ||
451 | |||
452 | try_to_unmap() is always called, by either vmscan for reclaim or for page | ||
453 | migration, with the argument page locked and isolated from the LRU. BUG_ON() | ||
454 | assertions enforce this requirement. Separate functions handle anonymous and | ||
455 | mapped file pages, as these types of pages have different reverse map | ||
456 | mechanisms. | ||
457 | |||
458 | try_to_unmap_anon() | ||
459 | |||
460 | To unmap anonymous pages, each vma in the list anchored in the anon_vma must be | ||
461 | visited--at least until a VM_LOCKED vma is encountered. If the page is being | ||
462 | unmapped for migration, VM_LOCKED vmas do not stop the process because mlocked | ||
463 | pages are migratable. However, for reclaim, if the page is mapped into a | ||
464 | VM_LOCKED vma, the scan stops. try_to_unmap() attempts to acquire the mmap | ||
465 | semphore of the mm_struct to which the vma belongs in read mode. If this is | ||
466 | successful, try_to_unmap() will mlock the page via mlock_vma_page()--we | ||
467 | wouldn't have gotten to try_to_unmap() if the page were already mlocked--and | ||
468 | will return SWAP_MLOCK, indicating that the page is unevictable. If the | ||
469 | mmap semaphore cannot be acquired, we are not sure whether the page is really | ||
470 | unevictable or not. In this case, try_to_unmap() will return SWAP_AGAIN. | ||
471 | |||
472 | try_to_unmap_file() -- linear mappings | ||
473 | |||
474 | Unmapping of a mapped file page works the same, except that the scan visits | ||
475 | all vmas that maps the page's index/page offset in the page's mapping's | ||
476 | reverse map priority search tree. It must also visit each vma in the page's | ||
477 | mapping's non-linear list, if the list is non-empty. As for anonymous pages, | ||
478 | on encountering a VM_LOCKED vma for a mapped file page, try_to_unmap() will | ||
479 | attempt to acquire the associated mm_struct's mmap semaphore to mlock the page, | ||
480 | returning SWAP_MLOCK if this is successful, and SWAP_AGAIN, if not. | ||
481 | |||
482 | try_to_unmap_file() -- non-linear mappings | ||
483 | |||
484 | If a page's mapping contains a non-empty non-linear mapping vma list, then | ||
485 | try_to_un{map|lock}() must also visit each vma in that list to determine | ||
486 | whether the page is mapped in a VM_LOCKED vma. Again, the scan must visit | ||
487 | all vmas in the non-linear list to ensure that the pages is not/should not be | ||
488 | mlocked. If a VM_LOCKED vma is found in the list, the scan could terminate. | ||
489 | However, there is no easy way to determine whether the page is actually mapped | ||
490 | in a given vma--either for unmapping or testing whether the VM_LOCKED vma | ||
491 | actually pins the page. | ||
492 | |||
493 | So, try_to_unmap_file() handles non-linear mappings by scanning a certain | ||
494 | number of pages--a "cluster"--in each non-linear vma associated with the page's | ||
495 | mapping, for each file mapped page that vmscan tries to unmap. If this happens | ||
496 | to unmap the page we're trying to unmap, try_to_unmap() will notice this on | ||
497 | return--(page_mapcount(page) == 0)--and return SWAP_SUCCESS. Otherwise, it | ||
498 | will return SWAP_AGAIN, causing vmscan to recirculate this page. We take | ||
499 | advantage of the cluster scan in try_to_unmap_cluster() as follows: | ||
500 | |||
501 | For each non-linear vma, try_to_unmap_cluster() attempts to acquire the mmap | ||
502 | semaphore of the associated mm_struct for read without blocking. If this | ||
503 | attempt is successful and the vma is VM_LOCKED, try_to_unmap_cluster() will | ||
504 | retain the mmap semaphore for the scan; otherwise it drops it here. Then, | ||
505 | for each page in the cluster, if we're holding the mmap semaphore for a locked | ||
506 | vma, try_to_unmap_cluster() calls mlock_vma_page() to mlock the page. This | ||
507 | call is a no-op if the page is already locked, but will mlock any pages in | ||
508 | the non-linear mapping that happen to be unlocked. If one of the pages so | ||
509 | mlocked is the page passed in to try_to_unmap(), try_to_unmap_cluster() will | ||
510 | return SWAP_MLOCK, rather than the default SWAP_AGAIN. This will allow vmscan | ||
511 | to cull the page, rather than recirculating it on the inactive list. Again, | ||
512 | if try_to_unmap_cluster() cannot acquire the vma's mmap sem, it returns | ||
513 | SWAP_AGAIN, indicating that the page is mapped by a VM_LOCKED vma, but | ||
514 | couldn't be mlocked. | ||
515 | |||
516 | |||
517 | Mlocked pages: try_to_munlock() Reverse Map Scan | ||
518 | |||
519 | TODO/FIXME: a better name might be page_mlocked()--analogous to the | ||
520 | page_referenced() reverse map walker--especially if we continue to call this | ||
521 | from shrink_page_list(). See related TODO/FIXME below. | ||
522 | |||
523 | When munlock_vma_page()--see "Mlocked Pages: munlock()/munlockall() System | ||
524 | Call Handling" above--tries to munlock a page, or when shrink_page_list() | ||
525 | encounters an anonymous page that is not yet in the swap cache, they need to | ||
526 | determine whether or not the page is mapped by any VM_LOCKED vma, without | ||
527 | actually attempting to unmap all ptes from the page. For this purpose, the | ||
528 | unevictable/mlock infrastructure introduced a variant of try_to_unmap() called | ||
529 | try_to_munlock(). | ||
530 | |||
531 | try_to_munlock() calls the same functions as try_to_unmap() for anonymous and | ||
532 | mapped file pages with an additional argument specifing unlock versus unmap | ||
533 | processing. Again, these functions walk the respective reverse maps looking | ||
534 | for VM_LOCKED vmas. When such a vma is found for anonymous pages and file | ||
535 | pages mapped in linear VMAs, as in the try_to_unmap() case, the functions | ||
536 | attempt to acquire the associated mmap semphore, mlock the page via | ||
537 | mlock_vma_page() and return SWAP_MLOCK. This effectively undoes the | ||
538 | pre-clearing of the page's PG_mlocked done by munlock_vma_page() and informs | ||
539 | shrink_page_list() that the anonymous page should be culled rather than added | ||
540 | to the swap cache in preparation for a try_to_unmap() that will almost | ||
541 | certainly fail. | ||
542 | |||
543 | If try_to_unmap() is unable to acquire a VM_LOCKED vma's associated mmap | ||
544 | semaphore, it will return SWAP_AGAIN. This will allow shrink_page_list() | ||
545 | to recycle the page on the inactive list and hope that it has better luck | ||
546 | with the page next time. | ||
547 | |||
548 | For file pages mapped into non-linear vmas, the try_to_munlock() logic works | ||
549 | slightly differently. On encountering a VM_LOCKED non-linear vma that might | ||
550 | map the page, try_to_munlock() returns SWAP_AGAIN without actually mlocking | ||
551 | the page. munlock_vma_page() will just leave the page unlocked and let | ||
552 | vmscan deal with it--the usual fallback position. | ||
553 | |||
554 | Note that try_to_munlock()'s reverse map walk must visit every vma in a pages' | ||
555 | reverse map to determine that a page is NOT mapped into any VM_LOCKED vma. | ||
556 | However, the scan can terminate when it encounters a VM_LOCKED vma and can | ||
557 | successfully acquire the vma's mmap semphore for read and mlock the page. | ||
558 | Although try_to_munlock() can be called many [very many!] times when | ||
559 | munlock()ing a large region or tearing down a large address space that has been | ||
560 | mlocked via mlockall(), overall this is a fairly rare event. In addition, | ||
561 | although shrink_page_list() calls try_to_munlock() for every anonymous page that | ||
562 | it handles that is not yet in the swap cache, on average anonymous pages will | ||
563 | have very short reverse map lists. | ||
564 | |||
565 | Mlocked Page: Page Reclaim in shrink_*_list() | ||
566 | |||
567 | shrink_active_list() culls any obviously unevictable pages--i.e., | ||
568 | !page_evictable(page, NULL)--diverting these to the unevictable lru | ||
569 | list. However, shrink_active_list() only sees unevictable pages that | ||
570 | made it onto the active/inactive lru lists. Note that these pages do not | ||
571 | have PageUnevictable set--otherwise, they would be on the unevictable list and | ||
572 | shrink_active_list would never see them. | ||
573 | |||
574 | Some examples of these unevictable pages on the LRU lists are: | ||
575 | |||
576 | 1) ramfs pages that have been placed on the lru lists when first allocated. | ||
577 | |||
578 | 2) SHM_LOCKed shared memory pages. shmctl(SHM_LOCK) does not attempt to | ||
579 | allocate or fault in the pages in the shared memory region. This happens | ||
580 | when an application accesses the page the first time after SHM_LOCKing | ||
581 | the segment. | ||
582 | |||
583 | 3) Mlocked pages that could not be isolated from the lru and moved to the | ||
584 | unevictable list in mlock_vma_page(). | ||
585 | |||
586 | 3) Pages mapped into multiple VM_LOCKED vmas, but try_to_munlock() couldn't | ||
587 | acquire the vma's mmap semaphore to test the flags and set PageMlocked. | ||
588 | munlock_vma_page() was forced to let the page back on to the normal | ||
589 | LRU list for vmscan to handle. | ||
590 | |||
591 | shrink_inactive_list() also culls any unevictable pages that it finds | ||
592 | on the inactive lists, again diverting them to the appropriate zone's unevictable | ||
593 | lru list. shrink_inactive_list() should only see SHM_LOCKed pages that became | ||
594 | SHM_LOCKed after shrink_active_list() had moved them to the inactive list, or | ||
595 | pages mapped into VM_LOCKED vmas that munlock_vma_page() couldn't isolate from | ||
596 | the lru to recheck via try_to_munlock(). shrink_inactive_list() won't notice | ||
597 | the latter, but will pass on to shrink_page_list(). | ||
598 | |||
599 | shrink_page_list() again culls obviously unevictable pages that it could | ||
600 | encounter for similar reason to shrink_inactive_list(). As already discussed, | ||
601 | shrink_page_list() proactively looks for anonymous pages that should have | ||
602 | PG_mlocked set but don't--these would not be detected by page_evictable()--to | ||
603 | avoid adding them to the swap cache unnecessarily. File pages mapped into | ||
604 | VM_LOCKED vmas but without PG_mlocked set will make it all the way to | ||
605 | try_to_unmap(). shrink_page_list() will divert them to the unevictable list when | ||
606 | try_to_unmap() returns SWAP_MLOCK, as discussed above. | ||
607 | |||
608 | TODO/FIXME: If we can enhance the swap cache to reliably remove entries | ||
609 | with page_count(page) > 2, as long as all ptes are mapped to the page and | ||
610 | not the swap entry, we can probably remove the call to try_to_munlock() in | ||
611 | shrink_page_list() and just remove the page from the swap cache when | ||
612 | try_to_unmap() returns SWAP_MLOCK. Currently, remove_exclusive_swap_page() | ||
613 | doesn't seem to allow that. | ||
614 | |||
615 | |||
diff --git a/Documentation/volatile-considered-harmful.txt b/Documentation/volatile-considered-harmful.txt index 10c2e411cca8..991c26a6ef64 100644 --- a/Documentation/volatile-considered-harmful.txt +++ b/Documentation/volatile-considered-harmful.txt | |||
@@ -114,6 +114,6 @@ CREDITS | |||
114 | 114 | ||
115 | Original impetus and research by Randy Dunlap | 115 | Original impetus and research by Randy Dunlap |
116 | Written by Jonathan Corbet | 116 | Written by Jonathan Corbet |
117 | Improvements via coments from Satyam Sharma, Johannes Stezenbach, Jesper | 117 | Improvements via comments from Satyam Sharma, Johannes Stezenbach, Jesper |
118 | Juhl, Heikki Orsila, H. Peter Anvin, Philipp Hahn, and Stefan | 118 | Juhl, Heikki Orsila, H. Peter Anvin, Philipp Hahn, and Stefan |
119 | Richter. | 119 | Richter. |
diff --git a/Documentation/w1/00-INDEX b/Documentation/w1/00-INDEX index 5270cf4cb109..cb49802745dc 100644 --- a/Documentation/w1/00-INDEX +++ b/Documentation/w1/00-INDEX | |||
@@ -1,5 +1,7 @@ | |||
1 | 00-INDEX | 1 | 00-INDEX |
2 | - This file | 2 | - This file |
3 | slaves/ | ||
4 | - Drivers that provide support for specific family codes. | ||
3 | masters/ | 5 | masters/ |
4 | - Individual chips providing 1-wire busses. | 6 | - Individual chips providing 1-wire busses. |
5 | w1.generic | 7 | w1.generic |
diff --git a/Documentation/w1/masters/ds2490 b/Documentation/w1/masters/ds2490 index 239f9ae01843..28176def3d6f 100644 --- a/Documentation/w1/masters/ds2490 +++ b/Documentation/w1/masters/ds2490 | |||
@@ -16,3 +16,55 @@ which allows to build USB <-> W1 bridges. | |||
16 | DS9490(R) is a USB <-> W1 bus master device | 16 | DS9490(R) is a USB <-> W1 bus master device |
17 | which has 0x81 family ID integrated chip and DS2490 | 17 | which has 0x81 family ID integrated chip and DS2490 |
18 | low-level operational chip. | 18 | low-level operational chip. |
19 | |||
20 | Notes and limitations. | ||
21 | - The weak pullup current is a minimum of 0.9mA and maximum of 6.0mA. | ||
22 | - The 5V strong pullup is supported with a minimum of 5.9mA and a | ||
23 | maximum of 30.4 mA. (From DS2490.pdf) | ||
24 | - While the ds2490 supports a hardware search the code doesn't take | ||
25 | advantage of it (in tested case it only returned first device). | ||
26 | - The hardware will detect when devices are attached to the bus on the | ||
27 | next bus (reset?) operation, however only a message is printed as | ||
28 | the core w1 code doesn't make use of the information. Connecting | ||
29 | one device tends to give multiple new device notifications. | ||
30 | - The number of USB bus transactions could be reduced if w1_reset_send | ||
31 | was added to the API. The name is just a suggestion. It would take | ||
32 | a write buffer and a read buffer (along with sizes) as arguments. | ||
33 | The ds2490 block I/O command supports reset, write buffer, read | ||
34 | buffer, and strong pullup all in one command, instead of the current | ||
35 | 1 reset bus, 2 write the match rom command and slave rom id, 3 block | ||
36 | write and read data. The write buffer needs to have the match rom | ||
37 | command and slave rom id prepended to the front of the requested | ||
38 | write buffer, both of which are known to the driver. | ||
39 | - The hardware supports normal, flexible, and overdrive bus | ||
40 | communication speeds, but only the normal is supported. | ||
41 | - The registered w1_bus_master functions don't define error | ||
42 | conditions. If a bus search is in progress and the ds2490 is | ||
43 | removed it can produce a good amount of error output before the bus | ||
44 | search finishes. | ||
45 | - The hardware supports detecting some error conditions, such as | ||
46 | short, alarming presence on reset, and no presence on reset, but the | ||
47 | driver doesn't query those values. | ||
48 | - The ds2490 specification doesn't cover short bulk in reads in | ||
49 | detail, but my observation is if fewer bytes are requested than are | ||
50 | available, the bulk read will return an error and the hardware will | ||
51 | clear the entire bulk in buffer. It would be possible to read the | ||
52 | maximum buffer size to not run into this error condition, only extra | ||
53 | bytes in the buffer is a logic error in the driver. The code should | ||
54 | should match reads and writes as well as data sizes. Reads and | ||
55 | writes are serialized and the status verifies that the chip is idle | ||
56 | (and data is available) before the read is executed, so it should | ||
57 | not happen. | ||
58 | - Running x86_64 2.6.24 UHCI under qemu 0.9.0 under x86_64 2.6.22-rc6 | ||
59 | with a OHCI controller, ds2490 running in the guest would operate | ||
60 | normally the first time the module was loaded after qemu attached | ||
61 | the ds2490 hardware, but if the module was unloaded, then reloaded | ||
62 | most of the time one of the bulk out or in, and usually the bulk in | ||
63 | would fail. qemu sets a 50ms timeout and the bulk in would timeout | ||
64 | even when the status shows data available. A bulk out write would | ||
65 | show a successful completion, but the ds2490 status register would | ||
66 | show 0 bytes written. Detaching qemu from the ds2490 hardware and | ||
67 | reattaching would clear the problem. usbmon output in the guest and | ||
68 | host did not explain the problem. My guess is a bug in either qemu | ||
69 | or the host OS and more likely the host OS. | ||
70 | -- 03-06-2008 David Fries <David@Fries.net> | ||
diff --git a/Documentation/w1/slaves/00-INDEX b/Documentation/w1/slaves/00-INDEX new file mode 100644 index 000000000000..f8101d6b07b7 --- /dev/null +++ b/Documentation/w1/slaves/00-INDEX | |||
@@ -0,0 +1,4 @@ | |||
1 | 00-INDEX | ||
2 | - This file | ||
3 | w1_therm | ||
4 | - The Maxim/Dallas Semiconductor ds18*20 temperature sensor. | ||
diff --git a/Documentation/w1/slaves/w1_therm b/Documentation/w1/slaves/w1_therm new file mode 100644 index 000000000000..0403aaaba878 --- /dev/null +++ b/Documentation/w1/slaves/w1_therm | |||
@@ -0,0 +1,41 @@ | |||
1 | Kernel driver w1_therm | ||
2 | ==================== | ||
3 | |||
4 | Supported chips: | ||
5 | * Maxim ds18*20 based temperature sensors. | ||
6 | |||
7 | Author: Evgeniy Polyakov <johnpol@2ka.mipt.ru> | ||
8 | |||
9 | |||
10 | Description | ||
11 | ----------- | ||
12 | |||
13 | w1_therm provides basic temperature conversion for ds18*20 devices. | ||
14 | supported family codes: | ||
15 | W1_THERM_DS18S20 0x10 | ||
16 | W1_THERM_DS1822 0x22 | ||
17 | W1_THERM_DS18B20 0x28 | ||
18 | |||
19 | Support is provided through the sysfs w1_slave file. Each open and | ||
20 | read sequence will initiate a temperature conversion then provide two | ||
21 | lines of ASCII output. The first line contains the nine hex bytes | ||
22 | read along with a calculated crc value and YES or NO if it matched. | ||
23 | If the crc matched the returned values are retained. The second line | ||
24 | displays the retained values along with a temperature in millidegrees | ||
25 | Centigrade after t=. | ||
26 | |||
27 | Parasite powered devices are limited to one slave performing a | ||
28 | temperature conversion at a time. If none of the devices are parasite | ||
29 | powered it would be possible to convert all the devices at the same | ||
30 | time and then go back to read individual sensors. That isn't | ||
31 | currently supported. The driver also doesn't support reduced | ||
32 | precision (which would also reduce the conversion time). | ||
33 | |||
34 | The module parameter strong_pullup can be set to 0 to disable the | ||
35 | strong pullup or 1 to enable. If enabled the 5V strong pullup will be | ||
36 | enabled when the conversion is taking place provided the master driver | ||
37 | must support the strong pullup (or it falls back to a pullup | ||
38 | resistor). The DS18b20 temperature sensor specification lists a | ||
39 | maximum current draw of 1.5mA and that a 5k pullup resistor is not | ||
40 | sufficient. The strong pullup is designed to provide the additional | ||
41 | current required. | ||
diff --git a/Documentation/w1/w1.generic b/Documentation/w1/w1.generic index 4c6509dd4789..e3333eec4320 100644 --- a/Documentation/w1/w1.generic +++ b/Documentation/w1/w1.generic | |||
@@ -79,10 +79,13 @@ w1 master sysfs interface | |||
79 | <xx-xxxxxxxxxxxxx> - a directory for a found device. The format is family-serial | 79 | <xx-xxxxxxxxxxxxx> - a directory for a found device. The format is family-serial |
80 | bus - (standard) symlink to the w1 bus | 80 | bus - (standard) symlink to the w1 bus |
81 | driver - (standard) symlink to the w1 driver | 81 | driver - (standard) symlink to the w1 driver |
82 | w1_master_add - Manually register a slave device | ||
82 | w1_master_attempts - the number of times a search was attempted | 83 | w1_master_attempts - the number of times a search was attempted |
83 | w1_master_max_slave_count | 84 | w1_master_max_slave_count |
84 | - the maximum slaves that may be attached to a master | 85 | - the maximum slaves that may be attached to a master |
85 | w1_master_name - the name of the device (w1_bus_masterX) | 86 | w1_master_name - the name of the device (w1_bus_masterX) |
87 | w1_master_pullup - 5V strong pullup 0 enabled, 1 disabled | ||
88 | w1_master_remove - Manually remove a slave device | ||
86 | w1_master_search - the number of searches left to do, -1=continual (default) | 89 | w1_master_search - the number of searches left to do, -1=continual (default) |
87 | w1_master_slave_count | 90 | w1_master_slave_count |
88 | - the number of slaves found | 91 | - the number of slaves found |
@@ -90,7 +93,13 @@ w1_master_slaves - the names of the slaves, one per line | |||
90 | w1_master_timeout - the delay in seconds between searches | 93 | w1_master_timeout - the delay in seconds between searches |
91 | 94 | ||
92 | If you have a w1 bus that never changes (you don't add or remove devices), | 95 | If you have a w1 bus that never changes (you don't add or remove devices), |
93 | you can set w1_master_search to a positive value to disable searches. | 96 | you can set the module parameter search_count to a small positive number |
97 | for an initially small number of bus searches. Alternatively it could be | ||
98 | set to zero, then manually add the slave device serial numbers by | ||
99 | w1_master_add device file. The w1_master_add and w1_master_remove files | ||
100 | generally only make sense when searching is disabled, as a search will | ||
101 | redetect manually removed devices that are present and timeout manually | ||
102 | added devices that aren't on the bus. | ||
94 | 103 | ||
95 | 104 | ||
96 | w1 slave sysfs interface | 105 | w1 slave sysfs interface |
diff --git a/Documentation/watchdog/src/Makefile b/Documentation/watchdog/src/Makefile new file mode 100644 index 000000000000..40e5f46e4740 --- /dev/null +++ b/Documentation/watchdog/src/Makefile | |||
@@ -0,0 +1,8 @@ | |||
1 | # kbuild trick to avoid linker error. Can be omitted if a module is built. | ||
2 | obj- := dummy.o | ||
3 | |||
4 | # List of programs to build | ||
5 | hostprogs-y := watchdog-simple watchdog-test | ||
6 | |||
7 | # Tell kbuild to always build the programs | ||
8 | always := $(hostprogs-y) | ||
diff --git a/Documentation/x86/00-INDEX b/Documentation/x86/00-INDEX new file mode 100644 index 000000000000..dbe3377754af --- /dev/null +++ b/Documentation/x86/00-INDEX | |||
@@ -0,0 +1,4 @@ | |||
1 | 00-INDEX | ||
2 | - this file | ||
3 | mtrr.txt | ||
4 | - how to use x86 Memory Type Range Registers to increase performance | ||
diff --git a/Documentation/x86/i386/boot.txt b/Documentation/x86/boot.txt index 147bfe511cdd..83c0033ee9e0 100644 --- a/Documentation/x86/i386/boot.txt +++ b/Documentation/x86/boot.txt | |||
@@ -308,7 +308,7 @@ Protocol: 2.00+ | |||
308 | 308 | ||
309 | Field name: start_sys | 309 | Field name: start_sys |
310 | Type: read | 310 | Type: read |
311 | Offset/size: 0x20c/4 | 311 | Offset/size: 0x20c/2 |
312 | Protocol: 2.00+ | 312 | Protocol: 2.00+ |
313 | 313 | ||
314 | The load low segment (0x1000). Obsolete. | 314 | The load low segment (0x1000). Obsolete. |
diff --git a/Documentation/mtrr.txt b/Documentation/x86/mtrr.txt index c39ac395970e..cc071dc333c2 100644 --- a/Documentation/mtrr.txt +++ b/Documentation/x86/mtrr.txt | |||
@@ -18,7 +18,7 @@ Richard Gooch | |||
18 | The AMD K6-2 (stepping 8 and above) and K6-3 processors have two | 18 | The AMD K6-2 (stepping 8 and above) and K6-3 processors have two |
19 | MTRRs. These are supported. The AMD Athlon family provide 8 Intel | 19 | MTRRs. These are supported. The AMD Athlon family provide 8 Intel |
20 | style MTRRs. | 20 | style MTRRs. |
21 | 21 | ||
22 | The Centaur C6 (WinChip) has 8 MCRs, allowing write-combining. These | 22 | The Centaur C6 (WinChip) has 8 MCRs, allowing write-combining. These |
23 | are supported. | 23 | are supported. |
24 | 24 | ||
@@ -87,7 +87,7 @@ reg00: base=0x00000000 ( 0MB), size= 64MB: write-back, count=1 | |||
87 | reg01: base=0xfb000000 (4016MB), size= 16MB: write-combining, count=1 | 87 | reg01: base=0xfb000000 (4016MB), size= 16MB: write-combining, count=1 |
88 | reg02: base=0xfb000000 (4016MB), size= 4kB: uncachable, count=1 | 88 | reg02: base=0xfb000000 (4016MB), size= 4kB: uncachable, count=1 |
89 | 89 | ||
90 | Some cards (especially Voodoo Graphics boards) need this 4 kB area | 90 | Some cards (especially Voodoo Graphics boards) need this 4 kB area |
91 | excluded from the beginning of the region because it is used for | 91 | excluded from the beginning of the region because it is used for |
92 | registers. | 92 | registers. |
93 | 93 | ||
diff --git a/Documentation/x86/pat.txt b/Documentation/x86/pat.txt index 17965f927c15..c93ff5f4c0dd 100644 --- a/Documentation/x86/pat.txt +++ b/Documentation/x86/pat.txt | |||
@@ -14,6 +14,10 @@ PAT allows for different types of memory attributes. The most commonly used | |||
14 | ones that will be supported at this time are Write-back, Uncached, | 14 | ones that will be supported at this time are Write-back, Uncached, |
15 | Write-combined and Uncached Minus. | 15 | Write-combined and Uncached Minus. |
16 | 16 | ||
17 | |||
18 | PAT APIs | ||
19 | -------- | ||
20 | |||
17 | There are many different APIs in the kernel that allows setting of memory | 21 | There are many different APIs in the kernel that allows setting of memory |
18 | attributes at the page level. In order to avoid aliasing, these interfaces | 22 | attributes at the page level. In order to avoid aliasing, these interfaces |
19 | should be used thoughtfully. Below is a table of interfaces available, | 23 | should be used thoughtfully. Below is a table of interfaces available, |
@@ -26,38 +30,38 @@ address range to avoid any aliasing. | |||
26 | API | RAM | ACPI,... | Reserved/Holes | | 30 | API | RAM | ACPI,... | Reserved/Holes | |
27 | -----------------------|----------|------------|------------------| | 31 | -----------------------|----------|------------|------------------| |
28 | | | | | | 32 | | | | | |
29 | ioremap | -- | UC | UC | | 33 | ioremap | -- | UC- | UC- | |
30 | | | | | | 34 | | | | | |
31 | ioremap_cache | -- | WB | WB | | 35 | ioremap_cache | -- | WB | WB | |
32 | | | | | | 36 | | | | | |
33 | ioremap_nocache | -- | UC | UC | | 37 | ioremap_nocache | -- | UC- | UC- | |
34 | | | | | | 38 | | | | | |
35 | ioremap_wc | -- | -- | WC | | 39 | ioremap_wc | -- | -- | WC | |
36 | | | | | | 40 | | | | | |
37 | set_memory_uc | UC | -- | -- | | 41 | set_memory_uc | UC- | -- | -- | |
38 | set_memory_wb | | | | | 42 | set_memory_wb | | | | |
39 | | | | | | 43 | | | | | |
40 | set_memory_wc | WC | -- | -- | | 44 | set_memory_wc | WC | -- | -- | |
41 | set_memory_wb | | | | | 45 | set_memory_wb | | | | |
42 | | | | | | 46 | | | | | |
43 | pci sysfs resource | -- | -- | UC | | 47 | pci sysfs resource | -- | -- | UC- | |
44 | | | | | | 48 | | | | | |
45 | pci sysfs resource_wc | -- | -- | WC | | 49 | pci sysfs resource_wc | -- | -- | WC | |
46 | is IORESOURCE_PREFETCH| | | | | 50 | is IORESOURCE_PREFETCH| | | | |
47 | | | | | | 51 | | | | | |
48 | pci proc | -- | -- | UC | | 52 | pci proc | -- | -- | UC- | |
49 | !PCIIOC_WRITE_COMBINE | | | | | 53 | !PCIIOC_WRITE_COMBINE | | | | |
50 | | | | | | 54 | | | | | |
51 | pci proc | -- | -- | WC | | 55 | pci proc | -- | -- | WC | |
52 | PCIIOC_WRITE_COMBINE | | | | | 56 | PCIIOC_WRITE_COMBINE | | | | |
53 | | | | | | 57 | | | | | |
54 | /dev/mem | -- | UC | UC | | 58 | /dev/mem | -- | WB/WC/UC- | WB/WC/UC- | |
55 | read-write | | | | | 59 | read-write | | | | |
56 | | | | | | 60 | | | | | |
57 | /dev/mem | -- | UC | UC | | 61 | /dev/mem | -- | UC- | UC- | |
58 | mmap SYNC flag | | | | | 62 | mmap SYNC flag | | | | |
59 | | | | | | 63 | | | | | |
60 | /dev/mem | -- | WB/WC/UC | WB/WC/UC | | 64 | /dev/mem | -- | WB/WC/UC- | WB/WC/UC- | |
61 | mmap !SYNC flag | |(from exist-| (from exist- | | 65 | mmap !SYNC flag | |(from exist-| (from exist- | |
62 | and | | ing alias)| ing alias) | | 66 | and | | ing alias)| ing alias) | |
63 | any alias to this area| | | | | 67 | any alias to this area| | | | |
@@ -68,7 +72,7 @@ pci proc | -- | -- | WC | | |||
68 | and | | | | | 72 | and | | | | |
69 | MTRR says WB | | | | | 73 | MTRR says WB | | | | |
70 | | | | | | 74 | | | | | |
71 | /dev/mem | -- | -- | UC_MINUS | | 75 | /dev/mem | -- | -- | UC- | |
72 | mmap !SYNC flag | | | | | 76 | mmap !SYNC flag | | | | |
73 | no alias to this area | | | | | 77 | no alias to this area | | | | |
74 | and | | | | | 78 | and | | | | |
@@ -98,3 +102,35 @@ types. | |||
98 | 102 | ||
99 | Drivers should use set_memory_[uc|wc] to set access type for RAM ranges. | 103 | Drivers should use set_memory_[uc|wc] to set access type for RAM ranges. |
100 | 104 | ||
105 | |||
106 | PAT debugging | ||
107 | ------------- | ||
108 | |||
109 | With CONFIG_DEBUG_FS enabled, PAT memtype list can be examined by | ||
110 | |||
111 | # mount -t debugfs debugfs /sys/kernel/debug | ||
112 | # cat /sys/kernel/debug/x86/pat_memtype_list | ||
113 | PAT memtype list: | ||
114 | uncached-minus @ 0x7fadf000-0x7fae0000 | ||
115 | uncached-minus @ 0x7fb19000-0x7fb1a000 | ||
116 | uncached-minus @ 0x7fb1a000-0x7fb1b000 | ||
117 | uncached-minus @ 0x7fb1b000-0x7fb1c000 | ||
118 | uncached-minus @ 0x7fb1c000-0x7fb1d000 | ||
119 | uncached-minus @ 0x7fb1d000-0x7fb1e000 | ||
120 | uncached-minus @ 0x7fb1e000-0x7fb25000 | ||
121 | uncached-minus @ 0x7fb25000-0x7fb26000 | ||
122 | uncached-minus @ 0x7fb26000-0x7fb27000 | ||
123 | uncached-minus @ 0x7fb27000-0x7fb28000 | ||
124 | uncached-minus @ 0x7fb28000-0x7fb2e000 | ||
125 | uncached-minus @ 0x7fb2e000-0x7fb2f000 | ||
126 | uncached-minus @ 0x7fb2f000-0x7fb30000 | ||
127 | uncached-minus @ 0x7fb31000-0x7fb32000 | ||
128 | uncached-minus @ 0x80000000-0x90000000 | ||
129 | |||
130 | This list shows physical address ranges and various PAT settings used to | ||
131 | access those physical address ranges. | ||
132 | |||
133 | Another, more verbose way of getting PAT related debug messages is with | ||
134 | "debugpat" boot parameter. With this parameter, various debug messages are | ||
135 | printed to dmesg log. | ||
136 | |||
diff --git a/Documentation/x86/i386/usb-legacy-support.txt b/Documentation/x86/usb-legacy-support.txt index 1894cdfc69d9..1894cdfc69d9 100644 --- a/Documentation/x86/i386/usb-legacy-support.txt +++ b/Documentation/x86/usb-legacy-support.txt | |||
diff --git a/Documentation/x86/x86_64/boot-options.txt b/Documentation/x86/x86_64/boot-options.txt index b0c7b6c4abda..72ffb5373ec7 100644 --- a/Documentation/x86/x86_64/boot-options.txt +++ b/Documentation/x86/x86_64/boot-options.txt | |||
@@ -54,10 +54,6 @@ APICs | |||
54 | apicmaintimer. Useful when your PIT timer is totally | 54 | apicmaintimer. Useful when your PIT timer is totally |
55 | broken. | 55 | broken. |
56 | 56 | ||
57 | disable_8254_timer / enable_8254_timer | ||
58 | Enable interrupt 0 timer routing over the 8254 in addition to over | ||
59 | the IO-APIC. The kernel tries to set a sensible default. | ||
60 | |||
61 | Early Console | 57 | Early Console |
62 | 58 | ||
63 | syntax: earlyprintk=vga | 59 | syntax: earlyprintk=vga |
diff --git a/Documentation/x86/i386/zero-page.txt b/Documentation/x86/zero-page.txt index 169ad423a3d1..169ad423a3d1 100644 --- a/Documentation/x86/i386/zero-page.txt +++ b/Documentation/x86/zero-page.txt | |||