diff options
Diffstat (limited to 'Documentation')
143 files changed, 8711 insertions, 5385 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX index f08ca9535733..8b0563633442 100644 --- a/Documentation/00-INDEX +++ b/Documentation/00-INDEX | |||
@@ -12,6 +12,8 @@ Following translations are available on the WWW: | |||
12 | 12 | ||
13 | 00-INDEX | 13 | 00-INDEX |
14 | - this file. | 14 | - this file. |
15 | ABI/ | ||
16 | - info on kernel <-> userspace ABI and relative interface stability. | ||
15 | BUG-HUNTING | 17 | BUG-HUNTING |
16 | - brute force method of doing binary search of patches to find bug. | 18 | - brute force method of doing binary search of patches to find bug. |
17 | Changes | 19 | Changes |
@@ -25,37 +27,57 @@ DMA-mapping.txt | |||
25 | DocBook/ | 27 | DocBook/ |
26 | - directory with DocBook templates etc. for kernel documentation. | 28 | - directory with DocBook templates etc. for kernel documentation. |
27 | HOWTO | 29 | HOWTO |
28 | - The process and procedures of how to do Linux kernel development. | 30 | - the process and procedures of how to do Linux kernel development. |
29 | IO-mapping.txt | 31 | IO-mapping.txt |
30 | - how to access I/O mapped memory from within device drivers. | 32 | - how to access I/O mapped memory from within device drivers. |
31 | IPMI.txt | 33 | IPMI.txt |
32 | - info on Linux Intelligent Platform Management Interface (IPMI) Driver. | 34 | - info on Linux Intelligent Platform Management Interface (IPMI) Driver. |
33 | IRQ-affinity.txt | 35 | IRQ-affinity.txt |
34 | - how to select which CPU(s) handle which interrupt events on SMP. | 36 | - how to select which CPU(s) handle which interrupt events on SMP. |
37 | IRQ.txt | ||
38 | - description of what an IRQ is. | ||
35 | ManagementStyle | 39 | ManagementStyle |
36 | - how to (attempt to) manage kernel hackers. | 40 | - how to (attempt to) manage kernel hackers. |
37 | MSI-HOWTO.txt | 41 | MSI-HOWTO.txt |
38 | - the Message Signaled Interrupts (MSI) Driver Guide HOWTO and FAQ. | 42 | - the Message Signaled Interrupts (MSI) Driver Guide HOWTO and FAQ. |
43 | PCIEBUS-HOWTO.txt | ||
44 | - a guide describing the PCI Express Port Bus driver. | ||
39 | RCU/ | 45 | RCU/ |
40 | - directory with info on RCU (read-copy update). | 46 | - directory with info on RCU (read-copy update). |
41 | README.DAC960 | 47 | README.DAC960 |
42 | - info on Mylex DAC960/DAC1100 PCI RAID Controller Driver for Linux. | 48 | - info on Mylex DAC960/DAC1100 PCI RAID Controller Driver for Linux. |
49 | README.cycladesZ | ||
50 | - info on Cyclades-Z firmware loading. | ||
43 | SAK.txt | 51 | SAK.txt |
44 | - info on Secure Attention Keys. | 52 | - info on Secure Attention Keys. |
53 | SecurityBugs | ||
54 | - procedure for reporting security bugs found in the kernel. | ||
55 | SubmitChecklist | ||
56 | - Linux kernel patch submission checklist. | ||
45 | SubmittingDrivers | 57 | SubmittingDrivers |
46 | - procedure to get a new driver source included into the kernel tree. | 58 | - procedure to get a new driver source included into the kernel tree. |
47 | SubmittingPatches | 59 | SubmittingPatches |
48 | - procedure to get a source patch included into the kernel tree. | 60 | - procedure to get a source patch included into the kernel tree. |
49 | VGA-softcursor.txt | 61 | VGA-softcursor.txt |
50 | - how to change your VGA cursor from a blinking underscore. | 62 | - how to change your VGA cursor from a blinking underscore. |
63 | accounting/ | ||
64 | - documentation on accounting and taskstats. | ||
65 | aoe/ | ||
66 | - description of AoE (ATA over Ethernet) along with config examples. | ||
51 | applying-patches.txt | 67 | applying-patches.txt |
52 | - description of various trees and how to apply their patches. | 68 | - description of various trees and how to apply their patches. |
53 | arm/ | 69 | arm/ |
54 | - directory with info about Linux on the ARM architecture. | 70 | - directory with info about Linux on the ARM architecture. |
71 | atomic_ops.txt | ||
72 | - semantics and behavior of atomic and bitmask operations. | ||
73 | auxdisplay/ | ||
74 | - misc. LCD driver documentation (cfag12864b, ks0108). | ||
55 | basic_profiling.txt | 75 | basic_profiling.txt |
56 | - basic instructions for those who wants to profile Linux kernel. | 76 | - basic instructions for those who wants to profile Linux kernel. |
57 | binfmt_misc.txt | 77 | binfmt_misc.txt |
58 | - info on the kernel support for extra binary formats. | 78 | - info on the kernel support for extra binary formats. |
79 | blackfin/ | ||
80 | - directory with documentation for the Blackfin arch. | ||
59 | block/ | 81 | block/ |
60 | - info on the Block I/O (BIO) layer. | 82 | - info on the Block I/O (BIO) layer. |
61 | cachetlb.txt | 83 | cachetlb.txt |
@@ -68,16 +90,32 @@ cli-sti-removal.txt | |||
68 | - cli()/sti() removal guide. | 90 | - cli()/sti() removal guide. |
69 | computone.txt | 91 | computone.txt |
70 | - info on Computone Intelliport II/Plus Multiport Serial Driver. | 92 | - info on Computone Intelliport II/Plus Multiport Serial Driver. |
93 | connector/ | ||
94 | - docs on the netlink based userspace<->kernel space communication mod. | ||
95 | console/ | ||
96 | - documentation on Linux console drivers. | ||
71 | cpqarray.txt | 97 | cpqarray.txt |
72 | - info on using Compaq's SMART2 Intelligent Disk Array Controllers. | 98 | - info on using Compaq's SMART2 Intelligent Disk Array Controllers. |
73 | cpu-freq/ | 99 | cpu-freq/ |
74 | - info on CPU frequency and voltage scaling. | 100 | - info on CPU frequency and voltage scaling. |
101 | cpu-hotplug.txt | ||
102 | - document describing CPU hotplug support in the Linux kernel. | ||
103 | cpu-load.txt | ||
104 | - document describing how CPU load statistics are collected. | ||
105 | cpusets.txt | ||
106 | - documents the cpusets feature; assign CPUs and Mem to a set of tasks. | ||
107 | cputopology.txt | ||
108 | - documentation on how CPU topology info is exported via sysfs. | ||
75 | cris/ | 109 | cris/ |
76 | - directory with info about Linux on CRIS architecture. | 110 | - directory with info about Linux on CRIS architecture. |
77 | crypto/ | 111 | crypto/ |
78 | - directory with info on the Crypto API. | 112 | - directory with info on the Crypto API. |
113 | dcdbas.txt | ||
114 | - information on the Dell Systems Management Base Driver. | ||
79 | debugging-modules.txt | 115 | debugging-modules.txt |
80 | - some notes on debugging modules after Linux 2.6.3. | 116 | - some notes on debugging modules after Linux 2.6.3. |
117 | dell_rbu.txt | ||
118 | - document demonstrating the use of the Dell Remote BIOS Update driver. | ||
81 | device-mapper/ | 119 | device-mapper/ |
82 | - directory with info on Device Mapper. | 120 | - directory with info on Device Mapper. |
83 | devices.txt | 121 | devices.txt |
@@ -86,32 +124,52 @@ digiepca.txt | |||
86 | - info on Digi Intl. {PC,PCI,EISA}Xx and Xem series cards. | 124 | - info on Digi Intl. {PC,PCI,EISA}Xx and Xem series cards. |
87 | dnotify.txt | 125 | dnotify.txt |
88 | - info about directory notification in Linux. | 126 | - info about directory notification in Linux. |
127 | dontdiff | ||
128 | - file containing a list of files that should never be diff'ed. | ||
89 | driver-model/ | 129 | driver-model/ |
90 | - directory with info about Linux driver model. | 130 | - directory with info about Linux driver model. |
131 | drivers/ | ||
132 | - directory with driver documentation (currently only EDAC). | ||
91 | dvb/ | 133 | dvb/ |
92 | - info on Linux Digital Video Broadcast (DVB) subsystem. | 134 | - info on Linux Digital Video Broadcast (DVB) subsystem. |
93 | early-userspace/ | 135 | early-userspace/ |
94 | - info about initramfs, klibc, and userspace early during boot. | 136 | - info about initramfs, klibc, and userspace early during boot. |
137 | ecryptfs.txt | ||
138 | - docs on eCryptfs: stacked cryptographic filesystem for Linux. | ||
95 | eisa.txt | 139 | eisa.txt |
96 | - info on EISA bus support. | 140 | - info on EISA bus support. |
97 | exception.txt | 141 | exception.txt |
98 | - how Linux v2.2 handles exceptions without verify_area etc. | 142 | - how Linux v2.2 handles exceptions without verify_area etc. |
143 | fault-injection/ | ||
144 | - dir with docs about the fault injection capabilities infrastructure. | ||
99 | fb/ | 145 | fb/ |
100 | - directory with info on the frame buffer graphics abstraction layer. | 146 | - directory with info on the frame buffer graphics abstraction layer. |
147 | feature-removal-schedule.txt | ||
148 | - list of files and features that are going to be removed. | ||
101 | filesystems/ | 149 | filesystems/ |
102 | - directory with info on the various filesystems that Linux supports. | 150 | - directory with info on the various filesystems that Linux supports. |
103 | firmware_class/ | 151 | firmware_class/ |
104 | - request_firmware() hotplug interface info. | 152 | - request_firmware() hotplug interface info. |
105 | floppy.txt | 153 | floppy.txt |
106 | - notes and driver options for the floppy disk driver. | 154 | - notes and driver options for the floppy disk driver. |
155 | fujitsu/ | ||
156 | - Fujitsu FR-V Linux documentation. | ||
157 | gpio.txt | ||
158 | - overview of GPIO (General Purpose Input/Output) access conventions. | ||
107 | hayes-esp.txt | 159 | hayes-esp.txt |
108 | - info on using the Hayes ESP serial driver. | 160 | - info on using the Hayes ESP serial driver. |
109 | highuid.txt | 161 | highuid.txt |
110 | - notes on the change from 16 bit to 32 bit user/group IDs. | 162 | - notes on the change from 16 bit to 32 bit user/group IDs. |
111 | hpet.txt | 163 | hpet.txt |
112 | - High Precision Event Timer Driver for Linux. | 164 | - High Precision Event Timer Driver for Linux. |
165 | hrtimer/ | ||
166 | - info on the timer_stats debugging facility for timer (ab)use. | ||
167 | hrtimers/ | ||
168 | - info on the hrtimers subsystem for high-resolution kernel timers. | ||
113 | hw_random.txt | 169 | hw_random.txt |
114 | - info on Linux support for random number generator in i8xx chipsets. | 170 | - info on Linux support for random number generator in i8xx chipsets. |
171 | hwmon/ | ||
172 | - directory with docs on various hardware monitoring drivers. | ||
115 | i2c/ | 173 | i2c/ |
116 | - directory with info about the I2C bus/protocol (2 wire, kHz speed). | 174 | - directory with info about the I2C bus/protocol (2 wire, kHz speed). |
117 | i2o/ | 175 | i2o/ |
@@ -122,16 +180,22 @@ ia64/ | |||
122 | - directory with info about Linux on Intel 64 bit architecture. | 180 | - directory with info about Linux on Intel 64 bit architecture. |
123 | ide.txt | 181 | ide.txt |
124 | - important info for users of ATA devices (IDE/EIDE disks and CD-ROMS). | 182 | - important info for users of ATA devices (IDE/EIDE disks and CD-ROMS). |
183 | infiniband/ | ||
184 | - directory with documents concerning Linux InfiniBand support. | ||
125 | initrd.txt | 185 | initrd.txt |
126 | - how to use the RAM disk as an initial/temporary root filesystem. | 186 | - how to use the RAM disk as an initial/temporary root filesystem. |
127 | input/ | 187 | input/ |
128 | - info on Linux input device support. | 188 | - info on Linux input device support. |
129 | io_ordering.txt | 189 | io_ordering.txt |
130 | - info on ordering I/O writes to memory-mapped addresses. | 190 | - info on ordering I/O writes to memory-mapped addresses. |
191 | ioctl/ | ||
192 | - directory with documents describing various IOCTL calls. | ||
131 | ioctl-number.txt | 193 | ioctl-number.txt |
132 | - how to implement and register device/driver ioctl calls. | 194 | - how to implement and register device/driver ioctl calls. |
133 | iostats.txt | 195 | iostats.txt |
134 | - info on I/O statistics Linux kernel provides. | 196 | - info on I/O statistics Linux kernel provides. |
197 | irqflags-tracing.txt | ||
198 | - how to use the irq-flags tracing feature. | ||
135 | isapnp.txt | 199 | isapnp.txt |
136 | - info on Linux ISA Plug & Play support. | 200 | - info on Linux ISA Plug & Play support. |
137 | isdn/ | 201 | isdn/ |
@@ -140,26 +204,40 @@ java.txt | |||
140 | - info on the in-kernel binary support for Java(tm). | 204 | - info on the in-kernel binary support for Java(tm). |
141 | kbuild/ | 205 | kbuild/ |
142 | - directory with info about the kernel build process. | 206 | - directory with info about the kernel build process. |
143 | kdumpt.txt | 207 | kdump/ |
144 | - mini HowTo on getting the crash dump code to work. | 208 | - directory with mini HowTo on getting the crash dump code to work. |
145 | kernel-doc-nano-HOWTO.txt | 209 | kernel-doc-nano-HOWTO.txt |
146 | - mini HowTo on generation and location of kernel documentation files. | 210 | - mini HowTo on generation and location of kernel documentation files. |
147 | kernel-docs.txt | 211 | kernel-docs.txt |
148 | - listing of various WWW + books that document kernel internals. | 212 | - listing of various WWW + books that document kernel internals. |
149 | kernel-parameters.txt | 213 | kernel-parameters.txt |
150 | - summary listing of command line / boot prompt args for the kernel. | 214 | - summary listing of command line / boot prompt args for the kernel. |
215 | keys-request-key.txt | ||
216 | - description of the kernel key request service. | ||
217 | keys.txt | ||
218 | - description of the kernel key retention service. | ||
151 | kobject.txt | 219 | kobject.txt |
152 | - info of the kobject infrastructure of the Linux kernel. | 220 | - info of the kobject infrastructure of the Linux kernel. |
221 | kprobes.txt | ||
222 | - documents the kernel probes debugging feature. | ||
223 | kref.txt | ||
224 | - docs on adding reference counters (krefs) to kernel objects. | ||
153 | laptop-mode.txt | 225 | laptop-mode.txt |
154 | - How to conserve battery power using laptop-mode. | 226 | - how to conserve battery power using laptop-mode. |
155 | ldm.txt | 227 | ldm.txt |
156 | - a brief description of LDM (Windows Dynamic Disks). | 228 | - a brief description of LDM (Windows Dynamic Disks). |
229 | leds-class.txt | ||
230 | - documents LED handling under Linux. | ||
231 | local_ops.txt | ||
232 | - semantics and behavior of local atomic operations. | ||
233 | lockdep-design.txt | ||
234 | - documentation on the runtime locking correctness validator. | ||
157 | locks.txt | 235 | locks.txt |
158 | - info on file locking implementations, flock() vs. fcntl(), etc. | 236 | - info on file locking implementations, flock() vs. fcntl(), etc. |
159 | logo.gif | 237 | logo.gif |
160 | - Full colour GIF image of Linux logo (penguin). | 238 | - full colour GIF image of Linux logo (penguin - Tux). |
161 | logo.txt | 239 | logo.txt |
162 | - Info on creator of above logo & site to get additional images from. | 240 | - info on creator of above logo & site to get additional images from. |
163 | m68k/ | 241 | m68k/ |
164 | - directory with info about Linux on Motorola 68k architecture. | 242 | - directory with info about Linux on Motorola 68k architecture. |
165 | magic-number.txt | 243 | magic-number.txt |
@@ -170,6 +248,8 @@ mca.txt | |||
170 | - info on supporting Micro Channel Architecture (e.g. PS/2) systems. | 248 | - info on supporting Micro Channel Architecture (e.g. PS/2) systems. |
171 | md.txt | 249 | md.txt |
172 | - info on boot arguments for the multiple devices driver. | 250 | - info on boot arguments for the multiple devices driver. |
251 | memory-barriers.txt | ||
252 | - info on Linux kernel memory barriers. | ||
173 | memory.txt | 253 | memory.txt |
174 | - info on typical Linux memory problems. | 254 | - info on typical Linux memory problems. |
175 | mips/ | 255 | mips/ |
@@ -177,9 +257,11 @@ mips/ | |||
177 | mono.txt | 257 | mono.txt |
178 | - how to execute Mono-based .NET binaries with the help of BINFMT_MISC. | 258 | - how to execute Mono-based .NET binaries with the help of BINFMT_MISC. |
179 | moxa-smartio | 259 | moxa-smartio |
180 | - info on installing/using Moxa multiport serial driver. | 260 | - file with info on installing/using Moxa multiport serial driver. |
181 | mtrr.txt | 261 | mtrr.txt |
182 | - how to use PPro Memory Type Range Registers to increase performance. | 262 | - how to use PPro Memory Type Range Registers to increase performance. |
263 | mutex-design.txt | ||
264 | - info on the generic mutex subsystem. | ||
183 | nbd.txt | 265 | nbd.txt |
184 | - info on a TCP implementation of a network block device. | 266 | - info on a TCP implementation of a network block device. |
185 | netlabel/ | 267 | netlabel/ |
@@ -190,6 +272,8 @@ nfsroot.txt | |||
190 | - short guide on setting up a diskless box with NFS root filesystem. | 272 | - short guide on setting up a diskless box with NFS root filesystem. |
191 | nmi_watchdog.txt | 273 | nmi_watchdog.txt |
192 | - info on NMI watchdog for SMP systems. | 274 | - info on NMI watchdog for SMP systems. |
275 | nommu-mmap.txt | ||
276 | - documentation about no-mmu memory mapping support. | ||
193 | numastat.txt | 277 | numastat.txt |
194 | - info on how to read Numa policy hit/miss statistics in sysfs. | 278 | - info on how to read Numa policy hit/miss statistics in sysfs. |
195 | oops-tracing.txt | 279 | oops-tracing.txt |
@@ -202,8 +286,16 @@ parport.txt | |||
202 | - how to use the parallel-port driver. | 286 | - how to use the parallel-port driver. |
203 | parport-lowlevel.txt | 287 | parport-lowlevel.txt |
204 | - description and usage of the low level parallel port functions. | 288 | - description and usage of the low level parallel port functions. |
289 | pci-error-recovery.txt | ||
290 | - info on PCI error recovery. | ||
205 | pci.txt | 291 | pci.txt |
206 | - info on the PCI subsystem for device driver authors. | 292 | - info on the PCI subsystem for device driver authors. |
293 | pcieaer-howto.txt | ||
294 | - the PCI Express Advanced Error Reporting Driver Guide HOWTO. | ||
295 | pcmcia/ | ||
296 | - info on the Linux PCMCIA driver. | ||
297 | pi-futex.txt | ||
298 | - documentation on lightweight PI-futexes. | ||
207 | pm.txt | 299 | pm.txt |
208 | - info on Linux power management support. | 300 | - info on Linux power management support. |
209 | pnp.txt | 301 | pnp.txt |
@@ -214,18 +306,32 @@ powerpc/ | |||
214 | - directory with info on using Linux with the PowerPC. | 306 | - directory with info on using Linux with the PowerPC. |
215 | preempt-locking.txt | 307 | preempt-locking.txt |
216 | - info on locking under a preemptive kernel. | 308 | - info on locking under a preemptive kernel. |
309 | prio_tree.txt | ||
310 | - info on radix-priority-search-tree use for indexing vmas. | ||
217 | ramdisk.txt | 311 | ramdisk.txt |
218 | - short guide on how to set up and use the RAM disk. | 312 | - short guide on how to set up and use the RAM disk. |
313 | rbtree.txt | ||
314 | - info on what red-black trees are and what they are for. | ||
219 | riscom8.txt | 315 | riscom8.txt |
220 | - notes on using the RISCom/8 multi-port serial driver. | 316 | - notes on using the RISCom/8 multi-port serial driver. |
317 | robust-futex-ABI.txt | ||
318 | - documentation of the robust futex ABI. | ||
319 | robust-futexes.txt | ||
320 | - a description of what robust futexes are. | ||
221 | rocket.txt | 321 | rocket.txt |
222 | - info on the Comtrol RocketPort multiport serial driver. | 322 | - info on the Comtrol RocketPort multiport serial driver. |
223 | rpc-cache.txt | 323 | rpc-cache.txt |
224 | - introduction to the caching mechanisms in the sunrpc layer. | 324 | - introduction to the caching mechanisms in the sunrpc layer. |
325 | rt-mutex-design.txt | ||
326 | - description of the RealTime mutex implementation design. | ||
327 | rt-mutex.txt | ||
328 | - desc. of RT-mutex subsystem with PI (Priority Inheritance) support. | ||
225 | rtc.txt | 329 | rtc.txt |
226 | - notes on how to use the Real Time Clock (aka CMOS clock) driver. | 330 | - notes on how to use the Real Time Clock (aka CMOS clock) driver. |
227 | s390/ | 331 | s390/ |
228 | - directory with info on using Linux on the IBM S390. | 332 | - directory with info on using Linux on the IBM S390. |
333 | sched-arch.txt | ||
334 | - CPU Scheduler implementation hints for architecture specific code. | ||
229 | sched-coding.txt | 335 | sched-coding.txt |
230 | - reference for various scheduler-related methods in the O(1) scheduler. | 336 | - reference for various scheduler-related methods in the O(1) scheduler. |
231 | sched-design.txt | 337 | sched-design.txt |
@@ -240,22 +346,32 @@ serial/ | |||
240 | - directory with info on the low level serial API. | 346 | - directory with info on the low level serial API. |
241 | serial-console.txt | 347 | serial-console.txt |
242 | - how to set up Linux with a serial line console as the default. | 348 | - how to set up Linux with a serial line console as the default. |
349 | sgi-ioc4.txt | ||
350 | - description of the SGI IOC4 PCI (multi function) device. | ||
243 | sgi-visws.txt | 351 | sgi-visws.txt |
244 | - short blurb on the SGI Visual Workstations. | 352 | - short blurb on the SGI Visual Workstations. |
245 | sh/ | 353 | sh/ |
246 | - directory with info on porting Linux to a new architecture. | 354 | - directory with info on porting Linux to a new architecture. |
355 | sharedsubtree.txt | ||
356 | - a description of shared subtrees for namespaces. | ||
247 | smart-config.txt | 357 | smart-config.txt |
248 | - description of the Smart Config makefile feature. | 358 | - description of the Smart Config makefile feature. |
249 | smp.txt | 359 | smp.txt |
250 | - a few notes on symmetric multi-processing. | 360 | - a few notes on symmetric multi-processing. |
361 | sony-laptop.txt | ||
362 | - Sony Notebook Control Driver (SNC) Readme. | ||
251 | sonypi.txt | 363 | sonypi.txt |
252 | - info on Linux Sony Programmable I/O Device support. | 364 | - info on Linux Sony Programmable I/O Device support. |
253 | sound/ | 365 | sound/ |
254 | - directory with info on sound card support. | 366 | - directory with info on sound card support. |
255 | sparc/ | 367 | sparc/ |
256 | - directory with info on using Linux on Sparc architecture. | 368 | - directory with info on using Linux on Sparc architecture. |
369 | sparse.txt | ||
370 | - info on how to obtain and use the sparse tool for typechecking. | ||
257 | specialix.txt | 371 | specialix.txt |
258 | - info on hardware/driver for specialix IO8+ multiport serial card. | 372 | - info on hardware/driver for specialix IO8+ multiport serial card. |
373 | spi/ | ||
374 | - overview of Linux kernel Serial Peripheral Interface (SPI) support. | ||
259 | spinlocks.txt | 375 | spinlocks.txt |
260 | - info on using spinlocks to provide exclusive access in kernel. | 376 | - info on using spinlocks to provide exclusive access in kernel. |
261 | stable_api_nonsense.txt | 377 | stable_api_nonsense.txt |
@@ -274,24 +390,32 @@ sysrq.txt | |||
274 | - info on the magic SysRq key. | 390 | - info on the magic SysRq key. |
275 | telephony/ | 391 | telephony/ |
276 | - directory with info on telephony (e.g. voice over IP) support. | 392 | - directory with info on telephony (e.g. voice over IP) support. |
393 | thinkpad-acpi.txt | ||
394 | - information on the (IBM and Lenovo) ThinkPad ACPI Extras driver. | ||
277 | time_interpolators.txt | 395 | time_interpolators.txt |
278 | - info on time interpolators. | 396 | - info on time interpolators. |
279 | tipar.txt | 397 | tipar.txt |
280 | - information about Parallel link cable for Texas Instruments handhelds. | 398 | - information about Parallel link cable for Texas Instruments handhelds. |
281 | tty.txt | 399 | tty.txt |
282 | - guide to the locking policies of the tty layer. | 400 | - guide to the locking policies of the tty layer. |
283 | unicode.txt | ||
284 | - info on the Unicode character/font mapping used in Linux. | ||
285 | uml/ | 401 | uml/ |
286 | - directory with information about User Mode Linux. | 402 | - directory with information about User Mode Linux. |
403 | unicode.txt | ||
404 | - info on the Unicode character/font mapping used in Linux. | ||
405 | unshare.txt | ||
406 | - description of the Linux unshare system call. | ||
287 | usb/ | 407 | usb/ |
288 | - directory with info regarding the Universal Serial Bus. | 408 | - directory with info regarding the Universal Serial Bus. |
409 | video-output.txt | ||
410 | - sysfs class driver interface to enable/disable a video output device. | ||
289 | video4linux/ | 411 | video4linux/ |
290 | - directory with info regarding video/TV/radio cards and linux. | 412 | - directory with info regarding video/TV/radio cards and linux. |
291 | vm/ | 413 | vm/ |
292 | - directory with info on the Linux vm code. | 414 | - directory with info on the Linux vm code. |
293 | voyager.txt | 415 | voyager.txt |
294 | - guide to running Linux on the Voyager architecture. | 416 | - guide to running Linux on the Voyager architecture. |
417 | w1/ | ||
418 | - directory with documents regarding the 1-wire (w1) subsystem. | ||
295 | watchdog/ | 419 | watchdog/ |
296 | - how to auto-reboot Linux if it has "fallen and can't get up". ;-) | 420 | - how to auto-reboot Linux if it has "fallen and can't get up". ;-) |
297 | x86_64/ | 421 | x86_64/ |
diff --git a/Documentation/ABI/removed/raw1394_legacy_isochronous b/Documentation/ABI/removed/raw1394_legacy_isochronous new file mode 100644 index 000000000000..1b629622d883 --- /dev/null +++ b/Documentation/ABI/removed/raw1394_legacy_isochronous | |||
@@ -0,0 +1,16 @@ | |||
1 | What: legacy isochronous ABI of raw1394 (1st generation iso ABI) | ||
2 | Date: June 2007 (scheduled), removed in kernel v2.6.23 | ||
3 | Contact: linux1394-devel@lists.sourceforge.net | ||
4 | Description: | ||
5 | The two request types RAW1394_REQ_ISO_SEND, RAW1394_REQ_ISO_LISTEN have | ||
6 | been deprecated for quite some time. They are very inefficient as they | ||
7 | come with high interrupt load and several layers of callbacks for each | ||
8 | packet. Because of these deficiencies, the video1394 and dv1394 drivers | ||
9 | and the 3rd-generation isochronous ABI in raw1394 (rawiso) were created. | ||
10 | |||
11 | Users: | ||
12 | libraw1394 users via the long deprecated API raw1394_iso_write, | ||
13 | raw1394_start_iso_write, raw1394_start_iso_rcv, raw1394_stop_iso_rcv | ||
14 | |||
15 | libdc1394, which optionally uses these old libraw1394 calls | ||
16 | alternatively to the more efficient video1394 ABI | ||
diff --git a/Documentation/ABI/testing/sysfs-bus-usb b/Documentation/ABI/testing/sysfs-bus-usb index f9937add033d..9734577d1711 100644 --- a/Documentation/ABI/testing/sysfs-bus-usb +++ b/Documentation/ABI/testing/sysfs-bus-usb | |||
@@ -39,3 +39,16 @@ Description: | |||
39 | If you want to suspend a device immediately but leave it | 39 | If you want to suspend a device immediately but leave it |
40 | free to wake up in response to I/O requests, you should | 40 | free to wake up in response to I/O requests, you should |
41 | write "0" to power/autosuspend. | 41 | write "0" to power/autosuspend. |
42 | |||
43 | What: /sys/bus/usb/devices/.../power/persist | ||
44 | Date: May 2007 | ||
45 | KernelVersion: 2.6.23 | ||
46 | Contact: Alan Stern <stern@rowland.harvard.edu> | ||
47 | Description: | ||
48 | If CONFIG_USB_PERSIST is set, then each USB device directory | ||
49 | will contain a file named power/persist. The file holds a | ||
50 | boolean value (0 or 1) indicating whether or not the | ||
51 | "USB-Persist" facility is enabled for the device. Since the | ||
52 | facility is inherently dangerous, it is disabled by default | ||
53 | for all devices except hubs. For more information, see | ||
54 | Documentation/usb/persist.txt. | ||
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle index b49b92edb396..7f1730f1a1ae 100644 --- a/Documentation/CodingStyle +++ b/Documentation/CodingStyle | |||
@@ -218,6 +218,18 @@ no space after the prefix increment & decrement unary operators: | |||
218 | 218 | ||
219 | and no space around the '.' and "->" structure member operators. | 219 | and no space around the '.' and "->" structure member operators. |
220 | 220 | ||
221 | Do not leave trailing whitespace at the ends of lines. Some editors with | ||
222 | "smart" indentation will insert whitespace at the beginning of new lines as | ||
223 | appropriate, so you can start typing the next line of code right away. | ||
224 | However, some such editors do not remove the whitespace if you end up not | ||
225 | putting a line of code there, such as if you leave a blank line. As a result, | ||
226 | you end up with lines containing trailing whitespace. | ||
227 | |||
228 | Git will warn you about patches that introduce trailing whitespace, and can | ||
229 | optionally strip the trailing whitespace for you; however, if applying a series | ||
230 | of patches, this may make later patches in the series fail by changing their | ||
231 | context lines. | ||
232 | |||
221 | 233 | ||
222 | Chapter 4: Naming | 234 | Chapter 4: Naming |
223 | 235 | ||
@@ -621,12 +633,27 @@ covers RTL which is used frequently with assembly language in the kernel. | |||
621 | 633 | ||
622 | Kernel developers like to be seen as literate. Do mind the spelling | 634 | Kernel developers like to be seen as literate. Do mind the spelling |
623 | of kernel messages to make a good impression. Do not use crippled | 635 | of kernel messages to make a good impression. Do not use crippled |
624 | words like "dont" and use "do not" or "don't" instead. | 636 | words like "dont"; use "do not" or "don't" instead. Make the messages |
637 | concise, clear, and unambiguous. | ||
625 | 638 | ||
626 | Kernel messages do not have to be terminated with a period. | 639 | Kernel messages do not have to be terminated with a period. |
627 | 640 | ||
628 | Printing numbers in parentheses (%d) adds no value and should be avoided. | 641 | Printing numbers in parentheses (%d) adds no value and should be avoided. |
629 | 642 | ||
643 | There are a number of driver model diagnostic macros in <linux/device.h> | ||
644 | which you should use to make sure messages are matched to the right device | ||
645 | and driver, and are tagged with the right level: dev_err(), dev_warn(), | ||
646 | dev_info(), and so forth. For messages that aren't associated with a | ||
647 | particular device, <linux/kernel.h> defines pr_debug() and pr_info(). | ||
648 | |||
649 | Coming up with good debugging messages can be quite a challenge; and once | ||
650 | you have them, they can be a huge help for remote troubleshooting. Such | ||
651 | messages should be compiled out when the DEBUG symbol is not defined (that | ||
652 | is, by default they are not included). When you use dev_dbg() or pr_debug(), | ||
653 | that's automatic. Many subsystems have Kconfig options to turn on -DDEBUG. | ||
654 | A related convention uses VERBOSE_DEBUG to add dev_vdbg() messages to the | ||
655 | ones already enabled by DEBUG. | ||
656 | |||
630 | 657 | ||
631 | Chapter 14: Allocating memory | 658 | Chapter 14: Allocating memory |
632 | 659 | ||
@@ -726,6 +753,33 @@ need them. Feel free to peruse that header file to see what else is already | |||
726 | defined that you shouldn't reproduce in your code. | 753 | defined that you shouldn't reproduce in your code. |
727 | 754 | ||
728 | 755 | ||
756 | Chapter 18: Editor modelines and other cruft | ||
757 | |||
758 | Some editors can interpret configuration information embedded in source files, | ||
759 | indicated with special markers. For example, emacs interprets lines marked | ||
760 | like this: | ||
761 | |||
762 | -*- mode: c -*- | ||
763 | |||
764 | Or like this: | ||
765 | |||
766 | /* | ||
767 | Local Variables: | ||
768 | compile-command: "gcc -DMAGIC_DEBUG_FLAG foo.c" | ||
769 | End: | ||
770 | */ | ||
771 | |||
772 | Vim interprets markers that look like this: | ||
773 | |||
774 | /* vim:set sw=8 noet */ | ||
775 | |||
776 | Do not include any of these in source files. People have their own personal | ||
777 | editor configurations, and your source files should not override them. This | ||
778 | includes markers for indentation and mode configuration. People may use their | ||
779 | own custom mode, or may have some other magic method for making indentation | ||
780 | work correctly. | ||
781 | |||
782 | |||
729 | 783 | ||
730 | Appendix I: References | 784 | Appendix I: References |
731 | 785 | ||
@@ -751,4 +805,5 @@ Kernel CodingStyle, by greg@kroah.com at OLS 2002: | |||
751 | http://www.kroah.com/linux/talks/ols_2002_kernel_codingstyle_talk/html/ | 805 | http://www.kroah.com/linux/talks/ols_2002_kernel_codingstyle_talk/html/ |
752 | 806 | ||
753 | -- | 807 | -- |
754 | Last updated on 2006-December-06. | 808 | Last updated on 2007-July-13. |
809 | |||
diff --git a/Documentation/DMA-mapping.txt b/Documentation/DMA-mapping.txt index 028614cdd062..e07f2530326b 100644 --- a/Documentation/DMA-mapping.txt +++ b/Documentation/DMA-mapping.txt | |||
@@ -664,109 +664,6 @@ It is that simple. | |||
664 | Well, not for some odd devices. See the next section for information | 664 | Well, not for some odd devices. See the next section for information |
665 | about that. | 665 | about that. |
666 | 666 | ||
667 | DAC Addressing for Address Space Hungry Devices | ||
668 | |||
669 | There exists a class of devices which do not mesh well with the PCI | ||
670 | DMA mapping API. By definition these "mappings" are a finite | ||
671 | resource. The number of total available mappings per bus is platform | ||
672 | specific, but there will always be a reasonable amount. | ||
673 | |||
674 | What is "reasonable"? Reasonable means that networking and block I/O | ||
675 | devices need not worry about using too many mappings. | ||
676 | |||
677 | As an example of a problematic device, consider compute cluster cards. | ||
678 | They can potentially need to access gigabytes of memory at once via | ||
679 | DMA. Dynamic mappings are unsuitable for this kind of access pattern. | ||
680 | |||
681 | To this end we've provided a small API by which a device driver | ||
682 | may use DAC cycles to directly address all of physical memory. | ||
683 | Not all platforms support this, but most do. It is easy to determine | ||
684 | whether the platform will work properly at probe time. | ||
685 | |||
686 | First, understand that there may be a SEVERE performance penalty for | ||
687 | using these interfaces on some platforms. Therefore, you MUST only | ||
688 | use these interfaces if it is absolutely required. %99 of devices can | ||
689 | use the normal APIs without any problems. | ||
690 | |||
691 | Note that for streaming type mappings you must either use these | ||
692 | interfaces, or the dynamic mapping interfaces above. You may not mix | ||
693 | usage of both for the same device. Such an act is illegal and is | ||
694 | guaranteed to put a banana in your tailpipe. | ||
695 | |||
696 | However, consistent mappings may in fact be used in conjunction with | ||
697 | these interfaces. Remember that, as defined, consistent mappings are | ||
698 | always going to be SAC addressable. | ||
699 | |||
700 | The first thing your driver needs to do is query the PCI platform | ||
701 | layer if it is capable of handling your devices DAC addressing | ||
702 | capabilities: | ||
703 | |||
704 | int pci_dac_dma_supported(struct pci_dev *hwdev, u64 mask); | ||
705 | |||
706 | You may not use the following interfaces if this routine fails. | ||
707 | |||
708 | Next, DMA addresses using this API are kept track of using the | ||
709 | dma64_addr_t type. It is guaranteed to be big enough to hold any | ||
710 | DAC address the platform layer will give to you from the following | ||
711 | routines. If you have consistent mappings as well, you still | ||
712 | use plain dma_addr_t to keep track of those. | ||
713 | |||
714 | All mappings obtained here will be direct. The mappings are not | ||
715 | translated, and this is the purpose of this dialect of the DMA API. | ||
716 | |||
717 | All routines work with page/offset pairs. This is the _ONLY_ way to | ||
718 | portably refer to any piece of memory. If you have a cpu pointer | ||
719 | (which may be validly DMA'd too) you may easily obtain the page | ||
720 | and offset using something like this: | ||
721 | |||
722 | struct page *page = virt_to_page(ptr); | ||
723 | unsigned long offset = offset_in_page(ptr); | ||
724 | |||
725 | Here are the interfaces: | ||
726 | |||
727 | dma64_addr_t pci_dac_page_to_dma(struct pci_dev *pdev, | ||
728 | struct page *page, | ||
729 | unsigned long offset, | ||
730 | int direction); | ||
731 | |||
732 | The DAC address for the tuple PAGE/OFFSET are returned. The direction | ||
733 | argument is the same as for pci_{map,unmap}_single(). The same rules | ||
734 | for cpu/device access apply here as for the streaming mapping | ||
735 | interfaces. To reiterate: | ||
736 | |||
737 | The cpu may touch the buffer before pci_dac_page_to_dma. | ||
738 | The device may touch the buffer after pci_dac_page_to_dma | ||
739 | is made, but the cpu may NOT. | ||
740 | |||
741 | When the DMA transfer is complete, invoke: | ||
742 | |||
743 | void pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev, | ||
744 | dma64_addr_t dma_addr, | ||
745 | size_t len, int direction); | ||
746 | |||
747 | This must be done before the CPU looks at the buffer again. | ||
748 | This interface behaves identically to pci_dma_sync_{single,sg}_for_cpu(). | ||
749 | |||
750 | And likewise, if you wish to let the device get back at the buffer after | ||
751 | the cpu has read/written it, invoke: | ||
752 | |||
753 | void pci_dac_dma_sync_single_for_device(struct pci_dev *pdev, | ||
754 | dma64_addr_t dma_addr, | ||
755 | size_t len, int direction); | ||
756 | |||
757 | before letting the device access the DMA area again. | ||
758 | |||
759 | If you need to get back to the PAGE/OFFSET tuple from a dma64_addr_t | ||
760 | the following interfaces are provided: | ||
761 | |||
762 | struct page *pci_dac_dma_to_page(struct pci_dev *pdev, | ||
763 | dma64_addr_t dma_addr); | ||
764 | unsigned long pci_dac_dma_to_offset(struct pci_dev *pdev, | ||
765 | dma64_addr_t dma_addr); | ||
766 | |||
767 | This is possible with the DAC interfaces purely because they are | ||
768 | not translated in any way. | ||
769 | |||
770 | Optimizing Unmap State Space Consumption | 667 | Optimizing Unmap State Space Consumption |
771 | 668 | ||
772 | On many platforms, pci_unmap_{single,page}() is simply a nop. | 669 | On many platforms, pci_unmap_{single,page}() is simply a nop. |
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index 6fd1646d3204..08687e45e19d 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile | |||
@@ -15,11 +15,11 @@ DOCBOOKS := wanbook.xml z8530book.xml mcabook.xml videobook.xml \ | |||
15 | 15 | ||
16 | ### | 16 | ### |
17 | # The build process is as follows (targets): | 17 | # The build process is as follows (targets): |
18 | # (xmldocs) | 18 | # (xmldocs) [by docproc] |
19 | # file.tmpl --> file.xml +--> file.ps (psdocs) | 19 | # file.tmpl --> file.xml +--> file.ps (psdocs) [by db2ps or xmlto] |
20 | # +--> file.pdf (pdfdocs) | 20 | # +--> file.pdf (pdfdocs) [by db2pdf or xmlto] |
21 | # +--> DIR=file (htmldocs) | 21 | # +--> DIR=file (htmldocs) [by xmlto] |
22 | # +--> man/ (mandocs) | 22 | # +--> man/ (mandocs) [by xmlto] |
23 | 23 | ||
24 | 24 | ||
25 | # for PDF and PS output you can choose between xmlto and docbook-utils tools | 25 | # for PDF and PS output you can choose between xmlto and docbook-utils tools |
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl index 38f88b6ae405..eb42bf9847cb 100644 --- a/Documentation/DocBook/kernel-api.tmpl +++ b/Documentation/DocBook/kernel-api.tmpl | |||
@@ -139,8 +139,10 @@ X!Ilib/string.c | |||
139 | !Elib/cmdline.c | 139 | !Elib/cmdline.c |
140 | </sect1> | 140 | </sect1> |
141 | 141 | ||
142 | <sect1><title>CRC Functions</title> | 142 | <sect1 id="crc"><title>CRC Functions</title> |
143 | !Elib/crc7.c | ||
143 | !Elib/crc16.c | 144 | !Elib/crc16.c |
145 | !Elib/crc-itu-t.c | ||
144 | !Elib/crc32.c | 146 | !Elib/crc32.c |
145 | !Elib/crc-ccitt.c | 147 | !Elib/crc-ccitt.c |
146 | </sect1> | 148 | </sect1> |
@@ -157,7 +159,6 @@ X!Ilib/string.c | |||
157 | !Earch/i386/lib/usercopy.c | 159 | !Earch/i386/lib/usercopy.c |
158 | </sect1> | 160 | </sect1> |
159 | <sect1><title>More Memory Management Functions</title> | 161 | <sect1><title>More Memory Management Functions</title> |
160 | !Iinclude/linux/rmap.h | ||
161 | !Emm/readahead.c | 162 | !Emm/readahead.c |
162 | !Emm/filemap.c | 163 | !Emm/filemap.c |
163 | !Emm/memory.c | 164 | !Emm/memory.c |
@@ -406,6 +407,10 @@ X!Edrivers/pnp/system.c | |||
406 | !Edrivers/pnp/manager.c | 407 | !Edrivers/pnp/manager.c |
407 | !Edrivers/pnp/support.c | 408 | !Edrivers/pnp/support.c |
408 | </sect1> | 409 | </sect1> |
410 | <sect1><title>Userspace IO devices</title> | ||
411 | !Edrivers/uio/uio.c | ||
412 | !Iinclude/linux/uio_driver.h | ||
413 | </sect1> | ||
409 | </chapter> | 414 | </chapter> |
410 | 415 | ||
411 | <chapter id="blkdev"> | 416 | <chapter id="blkdev"> |
@@ -643,4 +648,70 @@ X!Idrivers/video/console/fonts.c | |||
643 | !Edrivers/spi/spi.c | 648 | !Edrivers/spi/spi.c |
644 | </chapter> | 649 | </chapter> |
645 | 650 | ||
651 | <chapter id="i2c"> | ||
652 | <title>I<superscript>2</superscript>C and SMBus Subsystem</title> | ||
653 | |||
654 | <para> | ||
655 | I<superscript>2</superscript>C (or without fancy typography, "I2C") | ||
656 | is an acronym for the "Inter-IC" bus, a simple bus protocol which is | ||
657 | widely used where low data rate communications suffice. | ||
658 | Since it's also a licensed trademark, some vendors use another | ||
659 | name (such as "Two-Wire Interface", TWI) for the same bus. | ||
660 | I2C only needs two signals (SCL for clock, SDA for data), conserving | ||
661 | board real estate and minimizing signal quality issues. | ||
662 | Most I2C devices use seven bit addresses, and bus speeds of up | ||
663 | to 400 kHz; there's a high speed extension (3.4 MHz) that's not yet | ||
664 | found wide use. | ||
665 | I2C is a multi-master bus; open drain signaling is used to | ||
666 | arbitrate between masters, as well as to handshake and to | ||
667 | synchronize clocks from slower clients. | ||
668 | </para> | ||
669 | |||
670 | <para> | ||
671 | The Linux I2C programming interfaces support only the master | ||
672 | side of bus interactions, not the slave side. | ||
673 | The programming interface is structured around two kinds of driver, | ||
674 | and two kinds of device. | ||
675 | An I2C "Adapter Driver" abstracts the controller hardware; it binds | ||
676 | to a physical device (perhaps a PCI device or platform_device) and | ||
677 | exposes a <structname>struct i2c_adapter</structname> representing | ||
678 | each I2C bus segment it manages. | ||
679 | On each I2C bus segment will be I2C devices represented by a | ||
680 | <structname>struct i2c_client</structname>. Those devices will | ||
681 | be bound to a <structname>struct i2c_driver</structname>, | ||
682 | which should follow the standard Linux driver model. | ||
683 | (At this writing, a legacy model is more widely used.) | ||
684 | There are functions to perform various I2C protocol operations; at | ||
685 | this writing all such functions are usable only from task context. | ||
686 | </para> | ||
687 | |||
688 | <para> | ||
689 | The System Management Bus (SMBus) is a sibling protocol. Most SMBus | ||
690 | systems are also I2C conformant. The electrical constraints are | ||
691 | tighter for SMBus, and it standardizes particular protocol messages | ||
692 | and idioms. Controllers that support I2C can also support most | ||
693 | SMBus operations, but SMBus controllers don't support all the protocol | ||
694 | options that an I2C controller will. | ||
695 | There are functions to perform various SMBus protocol operations, | ||
696 | either using I2C primitives or by issuing SMBus commands to | ||
697 | i2c_adapter devices which don't support those I2C operations. | ||
698 | </para> | ||
699 | |||
700 | !Iinclude/linux/i2c.h | ||
701 | !Fdrivers/i2c/i2c-boardinfo.c i2c_register_board_info | ||
702 | !Edrivers/i2c/i2c-core.c | ||
703 | </chapter> | ||
704 | |||
705 | <chapter id="splice"> | ||
706 | <title>splice API</title> | ||
707 | <para>) | ||
708 | splice is a method for moving blocks of data around inside the | ||
709 | kernel, without continually transferring it between the kernel | ||
710 | and user space. | ||
711 | </para> | ||
712 | !Iinclude/linux/splice.h | ||
713 | !Ffs/splice.c | ||
714 | </chapter> | ||
715 | |||
716 | |||
646 | </book> | 717 | </book> |
diff --git a/Documentation/DocBook/procfs-guide.tmpl b/Documentation/DocBook/procfs-guide.tmpl index 45cad23efefa..2de84dc195a8 100644 --- a/Documentation/DocBook/procfs-guide.tmpl +++ b/Documentation/DocBook/procfs-guide.tmpl | |||
@@ -352,49 +352,93 @@ entry->write_proc = write_proc_foo; | |||
352 | <funcsynopsis> | 352 | <funcsynopsis> |
353 | <funcprototype> | 353 | <funcprototype> |
354 | <funcdef>int <function>read_func</function></funcdef> | 354 | <funcdef>int <function>read_func</function></funcdef> |
355 | <paramdef>char* <parameter>page</parameter></paramdef> | 355 | <paramdef>char* <parameter>buffer</parameter></paramdef> |
356 | <paramdef>char** <parameter>start</parameter></paramdef> | 356 | <paramdef>char** <parameter>start</parameter></paramdef> |
357 | <paramdef>off_t <parameter>off</parameter></paramdef> | 357 | <paramdef>off_t <parameter>off</parameter></paramdef> |
358 | <paramdef>int <parameter>count</parameter></paramdef> | 358 | <paramdef>int <parameter>count</parameter></paramdef> |
359 | <paramdef>int* <parameter>eof</parameter></paramdef> | 359 | <paramdef>int* <parameter>peof</parameter></paramdef> |
360 | <paramdef>void* <parameter>data</parameter></paramdef> | 360 | <paramdef>void* <parameter>data</parameter></paramdef> |
361 | </funcprototype> | 361 | </funcprototype> |
362 | </funcsynopsis> | 362 | </funcsynopsis> |
363 | 363 | ||
364 | <para> | 364 | <para> |
365 | The read function should write its information into the | 365 | The read function should write its information into the |
366 | <parameter>page</parameter>. For proper use, the function | 366 | <parameter>buffer</parameter>, which will be exactly |
367 | should start writing at an offset of | 367 | <literal>PAGE_SIZE</literal> bytes long. |
368 | <parameter>off</parameter> in <parameter>page</parameter> and | ||
369 | write at most <parameter>count</parameter> bytes, but because | ||
370 | most read functions are quite simple and only return a small | ||
371 | amount of information, these two parameters are usually | ||
372 | ignored (it breaks pagers like <literal>more</literal> and | ||
373 | <literal>less</literal>, but <literal>cat</literal> still | ||
374 | works). | ||
375 | </para> | 368 | </para> |
376 | 369 | ||
377 | <para> | 370 | <para> |
378 | If the <parameter>off</parameter> and | 371 | The parameter |
379 | <parameter>count</parameter> parameters are properly used, | 372 | <parameter>peof</parameter> should be used to signal that the |
380 | <parameter>eof</parameter> should be used to signal that the | ||
381 | end of the file has been reached by writing | 373 | end of the file has been reached by writing |
382 | <literal>1</literal> to the memory location | 374 | <literal>1</literal> to the memory location |
383 | <parameter>eof</parameter> points to. | 375 | <parameter>peof</parameter> points to. |
384 | </para> | 376 | </para> |
385 | 377 | ||
386 | <para> | 378 | <para> |
387 | The parameter <parameter>start</parameter> doesn't seem to be | 379 | The <parameter>data</parameter> |
388 | used anywhere in the kernel. The <parameter>data</parameter> | ||
389 | parameter can be used to create a single call back function for | 380 | parameter can be used to create a single call back function for |
390 | several files, see <xref linkend="usingdata"/>. | 381 | several files, see <xref linkend="usingdata"/>. |
391 | </para> | 382 | </para> |
392 | 383 | ||
393 | <para> | 384 | <para> |
394 | The <function>read_func</function> function must return the | 385 | The rest of the parameters and the return value are described |
395 | number of bytes written into the <parameter>page</parameter>. | 386 | by a comment in <filename>fs/proc/generic.c</filename> as follows: |
396 | </para> | 387 | </para> |
397 | 388 | ||
389 | <blockquote> | ||
390 | <para> | ||
391 | You have three ways to return data: | ||
392 | </para> | ||
393 | <orderedlist> | ||
394 | <listitem> | ||
395 | <para> | ||
396 | Leave <literal>*start = NULL</literal>. (This is the default.) | ||
397 | Put the data of the requested offset at that | ||
398 | offset within the buffer. Return the number (<literal>n</literal>) | ||
399 | of bytes there are from the beginning of the | ||
400 | buffer up to the last byte of data. If the | ||
401 | number of supplied bytes (<literal>= n - offset</literal>) is | ||
402 | greater than zero and you didn't signal eof | ||
403 | and the reader is prepared to take more data | ||
404 | you will be called again with the requested | ||
405 | offset advanced by the number of bytes | ||
406 | absorbed. This interface is useful for files | ||
407 | no larger than the buffer. | ||
408 | </para> | ||
409 | </listitem> | ||
410 | <listitem> | ||
411 | <para> | ||
412 | Set <literal>*start</literal> to an unsigned long value less than | ||
413 | the buffer address but greater than zero. | ||
414 | Put the data of the requested offset at the | ||
415 | beginning of the buffer. Return the number of | ||
416 | bytes of data placed there. If this number is | ||
417 | greater than zero and you didn't signal eof | ||
418 | and the reader is prepared to take more data | ||
419 | you will be called again with the requested | ||
420 | offset advanced by <literal>*start</literal>. This interface is | ||
421 | useful when you have a large file consisting | ||
422 | of a series of blocks which you want to count | ||
423 | and return as wholes. | ||
424 | (Hack by Paul.Russell@rustcorp.com.au) | ||
425 | </para> | ||
426 | </listitem> | ||
427 | <listitem> | ||
428 | <para> | ||
429 | Set <literal>*start</literal> to an address within the buffer. | ||
430 | Put the data of the requested offset at <literal>*start</literal>. | ||
431 | Return the number of bytes of data placed there. | ||
432 | If this number is greater than zero and you | ||
433 | didn't signal eof and the reader is prepared to | ||
434 | take more data you will be called again with the | ||
435 | requested offset advanced by the number of bytes | ||
436 | absorbed. | ||
437 | </para> | ||
438 | </listitem> | ||
439 | </orderedlist> | ||
440 | </blockquote> | ||
441 | |||
398 | <para> | 442 | <para> |
399 | <xref linkend="example"/> shows how to use a read call back | 443 | <xref linkend="example"/> shows how to use a read call back |
400 | function. | 444 | function. |
diff --git a/Documentation/DocBook/uio-howto.tmpl b/Documentation/DocBook/uio-howto.tmpl new file mode 100644 index 000000000000..e3bb29a8d8dd --- /dev/null +++ b/Documentation/DocBook/uio-howto.tmpl | |||
@@ -0,0 +1,611 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | ||
3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" []> | ||
4 | |||
5 | <book id="index"> | ||
6 | <bookinfo> | ||
7 | <title>The Userspace I/O HOWTO</title> | ||
8 | |||
9 | <author> | ||
10 | <firstname>Hans-Jürgen</firstname> | ||
11 | <surname>Koch</surname> | ||
12 | <authorblurb><para>Linux developer, Linutronix</para></authorblurb> | ||
13 | <affiliation> | ||
14 | <orgname> | ||
15 | <ulink url="http://www.linutronix.de">Linutronix</ulink> | ||
16 | </orgname> | ||
17 | |||
18 | <address> | ||
19 | <email>hjk@linutronix.de</email> | ||
20 | </address> | ||
21 | </affiliation> | ||
22 | </author> | ||
23 | |||
24 | <pubdate>2006-12-11</pubdate> | ||
25 | |||
26 | <abstract> | ||
27 | <para>This HOWTO describes concept and usage of Linux kernel's | ||
28 | Userspace I/O system.</para> | ||
29 | </abstract> | ||
30 | |||
31 | <revhistory> | ||
32 | <revision> | ||
33 | <revnumber>0.3</revnumber> | ||
34 | <date>2007-04-29</date> | ||
35 | <authorinitials>hjk</authorinitials> | ||
36 | <revremark>Added section about userspace drivers.</revremark> | ||
37 | </revision> | ||
38 | <revision> | ||
39 | <revnumber>0.2</revnumber> | ||
40 | <date>2007-02-13</date> | ||
41 | <authorinitials>hjk</authorinitials> | ||
42 | <revremark>Update after multiple mappings were added.</revremark> | ||
43 | </revision> | ||
44 | <revision> | ||
45 | <revnumber>0.1</revnumber> | ||
46 | <date>2006-12-11</date> | ||
47 | <authorinitials>hjk</authorinitials> | ||
48 | <revremark>First draft.</revremark> | ||
49 | </revision> | ||
50 | </revhistory> | ||
51 | </bookinfo> | ||
52 | |||
53 | <chapter id="aboutthisdoc"> | ||
54 | <?dbhtml filename="about.html"?> | ||
55 | <title>About this document</title> | ||
56 | |||
57 | <sect1 id="copyright"> | ||
58 | <?dbhtml filename="copyright.html"?> | ||
59 | <title>Copyright and License</title> | ||
60 | <para> | ||
61 | Copyright (c) 2006 by Hans-Jürgen Koch.</para> | ||
62 | <para> | ||
63 | This documentation is Free Software licensed under the terms of the | ||
64 | GPL version 2. | ||
65 | </para> | ||
66 | </sect1> | ||
67 | |||
68 | <sect1 id="translations"> | ||
69 | <?dbhtml filename="translations.html"?> | ||
70 | <title>Translations</title> | ||
71 | |||
72 | <para>If you know of any translations for this document, or you are | ||
73 | interested in translating it, please email me | ||
74 | <email>hjk@linutronix.de</email>. | ||
75 | </para> | ||
76 | </sect1> | ||
77 | |||
78 | <sect1 id="preface"> | ||
79 | <title>Preface</title> | ||
80 | <para> | ||
81 | For many types of devices, creating a Linux kernel driver is | ||
82 | overkill. All that is really needed is some way to handle an | ||
83 | interrupt and provide access to the memory space of the | ||
84 | device. The logic of controlling the device does not | ||
85 | necessarily have to be within the kernel, as the device does | ||
86 | not need to take advantage of any of other resources that the | ||
87 | kernel provides. One such common class of devices that are | ||
88 | like this are for industrial I/O cards. | ||
89 | </para> | ||
90 | <para> | ||
91 | To address this situation, the userspace I/O system (UIO) was | ||
92 | designed. For typical industrial I/O cards, only a very small | ||
93 | kernel module is needed. The main part of the driver will run in | ||
94 | user space. This simplifies development and reduces the risk of | ||
95 | serious bugs within a kernel module. | ||
96 | </para> | ||
97 | </sect1> | ||
98 | |||
99 | <sect1 id="thanks"> | ||
100 | <title>Acknowledgments</title> | ||
101 | <para>I'd like to thank Thomas Gleixner and Benedikt Spranger of | ||
102 | Linutronix, who have not only written most of the UIO code, but also | ||
103 | helped greatly writing this HOWTO by giving me all kinds of background | ||
104 | information.</para> | ||
105 | </sect1> | ||
106 | |||
107 | <sect1 id="feedback"> | ||
108 | <title>Feedback</title> | ||
109 | <para>Find something wrong with this document? (Or perhaps something | ||
110 | right?) I would love to hear from you. Please email me at | ||
111 | <email>hjk@linutronix.de</email>.</para> | ||
112 | </sect1> | ||
113 | </chapter> | ||
114 | |||
115 | <chapter id="about"> | ||
116 | <?dbhtml filename="about.html"?> | ||
117 | <title>About UIO</title> | ||
118 | |||
119 | <para>If you use UIO for your card's driver, here's what you get:</para> | ||
120 | |||
121 | <itemizedlist> | ||
122 | <listitem> | ||
123 | <para>only one small kernel module to write and maintain.</para> | ||
124 | </listitem> | ||
125 | <listitem> | ||
126 | <para>develop the main part of your driver in user space, | ||
127 | with all the tools and libraries you're used to.</para> | ||
128 | </listitem> | ||
129 | <listitem> | ||
130 | <para>bugs in your driver won't crash the kernel.</para> | ||
131 | </listitem> | ||
132 | <listitem> | ||
133 | <para>updates of your driver can take place without recompiling | ||
134 | the kernel.</para> | ||
135 | </listitem> | ||
136 | <listitem> | ||
137 | <para>if you need to keep some parts of your driver closed source, | ||
138 | you can do so without violating the GPL license on the kernel.</para> | ||
139 | </listitem> | ||
140 | </itemizedlist> | ||
141 | |||
142 | <sect1 id="how_uio_works"> | ||
143 | <title>How UIO works</title> | ||
144 | <para> | ||
145 | Each UIO device is accessed through a device file and several | ||
146 | sysfs attribute files. The device file will be called | ||
147 | <filename>/dev/uio0</filename> for the first device, and | ||
148 | <filename>/dev/uio1</filename>, <filename>/dev/uio2</filename> | ||
149 | and so on for subsequent devices. | ||
150 | </para> | ||
151 | |||
152 | <para><filename>/dev/uioX</filename> is used to access the | ||
153 | address space of the card. Just use | ||
154 | <function>mmap()</function> to access registers or RAM | ||
155 | locations of your card. | ||
156 | </para> | ||
157 | |||
158 | <para> | ||
159 | Interrupts are handled by reading from | ||
160 | <filename>/dev/uioX</filename>. A blocking | ||
161 | <function>read()</function> from | ||
162 | <filename>/dev/uioX</filename> will return as soon as an | ||
163 | interrupt occurs. You can also use | ||
164 | <function>select()</function> on | ||
165 | <filename>/dev/uioX</filename> to wait for an interrupt. The | ||
166 | integer value read from <filename>/dev/uioX</filename> | ||
167 | represents the total interrupt count. You can use this number | ||
168 | to figure out if you missed some interrupts. | ||
169 | </para> | ||
170 | |||
171 | <para> | ||
172 | To handle interrupts properly, your custom kernel module can | ||
173 | provide its own interrupt handler. It will automatically be | ||
174 | called by the built-in handler. | ||
175 | </para> | ||
176 | |||
177 | <para> | ||
178 | For cards that don't generate interrupts but need to be | ||
179 | polled, there is the possibility to set up a timer that | ||
180 | triggers the interrupt handler at configurable time intervals. | ||
181 | See <filename>drivers/uio/uio_dummy.c</filename> for an | ||
182 | example of this technique. | ||
183 | </para> | ||
184 | |||
185 | <para> | ||
186 | Each driver provides attributes that are used to read or write | ||
187 | variables. These attributes are accessible through sysfs | ||
188 | files. A custom kernel driver module can add its own | ||
189 | attributes to the device owned by the uio driver, but not added | ||
190 | to the UIO device itself at this time. This might change in the | ||
191 | future if it would be found to be useful. | ||
192 | </para> | ||
193 | |||
194 | <para> | ||
195 | The following standard attributes are provided by the UIO | ||
196 | framework: | ||
197 | </para> | ||
198 | <itemizedlist> | ||
199 | <listitem> | ||
200 | <para> | ||
201 | <filename>name</filename>: The name of your device. It is | ||
202 | recommended to use the name of your kernel module for this. | ||
203 | </para> | ||
204 | </listitem> | ||
205 | <listitem> | ||
206 | <para> | ||
207 | <filename>version</filename>: A version string defined by your | ||
208 | driver. This allows the user space part of your driver to deal | ||
209 | with different versions of the kernel module. | ||
210 | </para> | ||
211 | </listitem> | ||
212 | <listitem> | ||
213 | <para> | ||
214 | <filename>event</filename>: The total number of interrupts | ||
215 | handled by the driver since the last time the device node was | ||
216 | read. | ||
217 | </para> | ||
218 | </listitem> | ||
219 | </itemizedlist> | ||
220 | <para> | ||
221 | These attributes appear under the | ||
222 | <filename>/sys/class/uio/uioX</filename> directory. Please | ||
223 | note that this directory might be a symlink, and not a real | ||
224 | directory. Any userspace code that accesses it must be able | ||
225 | to handle this. | ||
226 | </para> | ||
227 | <para> | ||
228 | Each UIO device can make one or more memory regions available for | ||
229 | memory mapping. This is necessary because some industrial I/O cards | ||
230 | require access to more than one PCI memory region in a driver. | ||
231 | </para> | ||
232 | <para> | ||
233 | Each mapping has its own directory in sysfs, the first mapping | ||
234 | appears as <filename>/sys/class/uio/uioX/maps/map0/</filename>. | ||
235 | Subsequent mappings create directories <filename>map1/</filename>, | ||
236 | <filename>map2/</filename>, and so on. These directories will only | ||
237 | appear if the size of the mapping is not 0. | ||
238 | </para> | ||
239 | <para> | ||
240 | Each <filename>mapX/</filename> directory contains two read-only files | ||
241 | that show start address and size of the memory: | ||
242 | </para> | ||
243 | <itemizedlist> | ||
244 | <listitem> | ||
245 | <para> | ||
246 | <filename>addr</filename>: The address of memory that can be mapped. | ||
247 | </para> | ||
248 | </listitem> | ||
249 | <listitem> | ||
250 | <para> | ||
251 | <filename>size</filename>: The size, in bytes, of the memory | ||
252 | pointed to by addr. | ||
253 | </para> | ||
254 | </listitem> | ||
255 | </itemizedlist> | ||
256 | |||
257 | <para> | ||
258 | From userspace, the different mappings are distinguished by adjusting | ||
259 | the <varname>offset</varname> parameter of the | ||
260 | <function>mmap()</function> call. To map the memory of mapping N, you | ||
261 | have to use N times the page size as your offset: | ||
262 | </para> | ||
263 | <programlisting format="linespecific"> | ||
264 | offset = N * getpagesize(); | ||
265 | </programlisting> | ||
266 | |||
267 | </sect1> | ||
268 | </chapter> | ||
269 | |||
270 | <chapter id="using-uio_dummy" xreflabel="Using uio_dummy"> | ||
271 | <?dbhtml filename="using-uio_dummy.html"?> | ||
272 | <title>Using uio_dummy</title> | ||
273 | <para> | ||
274 | Well, there is no real use for uio_dummy. Its only purpose is | ||
275 | to test most parts of the UIO system (everything except | ||
276 | hardware interrupts), and to serve as an example for the | ||
277 | kernel module that you will have to write yourself. | ||
278 | </para> | ||
279 | |||
280 | <sect1 id="what_uio_dummy_does"> | ||
281 | <title>What uio_dummy does</title> | ||
282 | <para> | ||
283 | The kernel module <filename>uio_dummy.ko</filename> creates a | ||
284 | device that uses a timer to generate periodic interrupts. The | ||
285 | interrupt handler does nothing but increment a counter. The | ||
286 | driver adds two custom attributes, <varname>count</varname> | ||
287 | and <varname>freq</varname>, that appear under | ||
288 | <filename>/sys/devices/platform/uio_dummy/</filename>. | ||
289 | </para> | ||
290 | |||
291 | <para> | ||
292 | The attribute <varname>count</varname> can be read and | ||
293 | written. The associated file | ||
294 | <filename>/sys/devices/platform/uio_dummy/count</filename> | ||
295 | appears as a normal text file and contains the total number of | ||
296 | timer interrupts. If you look at it (e.g. using | ||
297 | <function>cat</function>), you'll notice it is slowly counting | ||
298 | up. | ||
299 | </para> | ||
300 | |||
301 | <para> | ||
302 | The attribute <varname>freq</varname> can be read and written. | ||
303 | The content of | ||
304 | <filename>/sys/devices/platform/uio_dummy/freq</filename> | ||
305 | represents the number of system timer ticks between two timer | ||
306 | interrupts. The default value of <varname>freq</varname> is | ||
307 | the value of the kernel variable <varname>HZ</varname>, which | ||
308 | gives you an interval of one second. Lower values will | ||
309 | increase the frequency. Try the following: | ||
310 | </para> | ||
311 | <programlisting format="linespecific"> | ||
312 | cd /sys/devices/platform/uio_dummy/ | ||
313 | echo 100 > freq | ||
314 | </programlisting> | ||
315 | <para> | ||
316 | Use <function>cat count</function> to see how the interrupt | ||
317 | frequency changes. | ||
318 | </para> | ||
319 | </sect1> | ||
320 | </chapter> | ||
321 | |||
322 | <chapter id="custom_kernel_module" xreflabel="Writing your own kernel module"> | ||
323 | <?dbhtml filename="custom_kernel_module.html"?> | ||
324 | <title>Writing your own kernel module</title> | ||
325 | <para> | ||
326 | Please have a look at <filename>uio_dummy.c</filename> as an | ||
327 | example. The following paragraphs explain the different | ||
328 | sections of this file. | ||
329 | </para> | ||
330 | |||
331 | <sect1 id="uio_info"> | ||
332 | <title>struct uio_info</title> | ||
333 | <para> | ||
334 | This structure tells the framework the details of your driver, | ||
335 | Some of the members are required, others are optional. | ||
336 | </para> | ||
337 | |||
338 | <itemizedlist> | ||
339 | <listitem><para> | ||
340 | <varname>char *name</varname>: Required. The name of your driver as | ||
341 | it will appear in sysfs. I recommend using the name of your module for this. | ||
342 | </para></listitem> | ||
343 | |||
344 | <listitem><para> | ||
345 | <varname>char *version</varname>: Required. This string appears in | ||
346 | <filename>/sys/class/uio/uioX/version</filename>. | ||
347 | </para></listitem> | ||
348 | |||
349 | <listitem><para> | ||
350 | <varname>struct uio_mem mem[ MAX_UIO_MAPS ]</varname>: Required if you | ||
351 | have memory that can be mapped with <function>mmap()</function>. For each | ||
352 | mapping you need to fill one of the <varname>uio_mem</varname> structures. | ||
353 | See the description below for details. | ||
354 | </para></listitem> | ||
355 | |||
356 | <listitem><para> | ||
357 | <varname>long irq</varname>: Required. If your hardware generates an | ||
358 | interrupt, it's your modules task to determine the irq number during | ||
359 | initialization. If you don't have a hardware generated interrupt but | ||
360 | want to trigger the interrupt handler in some other way, set | ||
361 | <varname>irq</varname> to <varname>UIO_IRQ_CUSTOM</varname>. The | ||
362 | uio_dummy module does this as it triggers the event mechanism in a timer | ||
363 | routine. If you had no interrupt at all, you could set | ||
364 | <varname>irq</varname> to <varname>UIO_IRQ_NONE</varname>, though this | ||
365 | rarely makes sense. | ||
366 | </para></listitem> | ||
367 | |||
368 | <listitem><para> | ||
369 | <varname>unsigned long irq_flags</varname>: Required if you've set | ||
370 | <varname>irq</varname> to a hardware interrupt number. The flags given | ||
371 | here will be used in the call to <function>request_irq()</function>. | ||
372 | </para></listitem> | ||
373 | |||
374 | <listitem><para> | ||
375 | <varname>int (*mmap)(struct uio_info *info, struct vm_area_struct | ||
376 | *vma)</varname>: Optional. If you need a special | ||
377 | <function>mmap()</function> function, you can set it here. If this | ||
378 | pointer is not NULL, your <function>mmap()</function> will be called | ||
379 | instead of the built-in one. | ||
380 | </para></listitem> | ||
381 | |||
382 | <listitem><para> | ||
383 | <varname>int (*open)(struct uio_info *info, struct inode *inode) | ||
384 | </varname>: Optional. You might want to have your own | ||
385 | <function>open()</function>, e.g. to enable interrupts only when your | ||
386 | device is actually used. | ||
387 | </para></listitem> | ||
388 | |||
389 | <listitem><para> | ||
390 | <varname>int (*release)(struct uio_info *info, struct inode *inode) | ||
391 | </varname>: Optional. If you define your own | ||
392 | <function>open()</function>, you will probably also want a custom | ||
393 | <function>release()</function> function. | ||
394 | </para></listitem> | ||
395 | </itemizedlist> | ||
396 | |||
397 | <para> | ||
398 | Usually, your device will have one or more memory regions that can be mapped | ||
399 | to user space. For each region, you have to set up a | ||
400 | <varname>struct uio_mem</varname> in the <varname>mem[]</varname> array. | ||
401 | Here's a description of the fields of <varname>struct uio_mem</varname>: | ||
402 | </para> | ||
403 | |||
404 | <itemizedlist> | ||
405 | <listitem><para> | ||
406 | <varname>int memtype</varname>: Required if the mapping is used. Set this to | ||
407 | <varname>UIO_MEM_PHYS</varname> if you you have physical memory on your | ||
408 | card to be mapped. Use <varname>UIO_MEM_LOGICAL</varname> for logical | ||
409 | memory (e.g. allocated with <function>kmalloc()</function>). There's also | ||
410 | <varname>UIO_MEM_VIRTUAL</varname> for virtual memory. | ||
411 | </para></listitem> | ||
412 | |||
413 | <listitem><para> | ||
414 | <varname>unsigned long addr</varname>: Required if the mapping is used. | ||
415 | Fill in the address of your memory block. This address is the one that | ||
416 | appears in sysfs. | ||
417 | </para></listitem> | ||
418 | |||
419 | <listitem><para> | ||
420 | <varname>unsigned long size</varname>: Fill in the size of the | ||
421 | memory block that <varname>addr</varname> points to. If <varname>size</varname> | ||
422 | is zero, the mapping is considered unused. Note that you | ||
423 | <emphasis>must</emphasis> initialize <varname>size</varname> with zero for | ||
424 | all unused mappings. | ||
425 | </para></listitem> | ||
426 | |||
427 | <listitem><para> | ||
428 | <varname>void *internal_addr</varname>: If you have to access this memory | ||
429 | region from within your kernel module, you will want to map it internally by | ||
430 | using something like <function>ioremap()</function>. Addresses | ||
431 | returned by this function cannot be mapped to user space, so you must not | ||
432 | store it in <varname>addr</varname>. Use <varname>internal_addr</varname> | ||
433 | instead to remember such an address. | ||
434 | </para></listitem> | ||
435 | </itemizedlist> | ||
436 | |||
437 | <para> | ||
438 | Please do not touch the <varname>kobj</varname> element of | ||
439 | <varname>struct uio_mem</varname>! It is used by the UIO framework | ||
440 | to set up sysfs files for this mapping. Simply leave it alone. | ||
441 | </para> | ||
442 | </sect1> | ||
443 | |||
444 | <sect1 id="adding_irq_handler"> | ||
445 | <title>Adding an interrupt handler</title> | ||
446 | <para> | ||
447 | What you need to do in your interrupt handler depends on your | ||
448 | hardware and on how you want to handle it. You should try to | ||
449 | keep the amount of code in your kernel interrupt handler low. | ||
450 | If your hardware requires no action that you | ||
451 | <emphasis>have</emphasis> to perform after each interrupt, | ||
452 | then your handler can be empty.</para> <para>If, on the other | ||
453 | hand, your hardware <emphasis>needs</emphasis> some action to | ||
454 | be performed after each interrupt, then you | ||
455 | <emphasis>must</emphasis> do it in your kernel module. Note | ||
456 | that you cannot rely on the userspace part of your driver. Your | ||
457 | userspace program can terminate at any time, possibly leaving | ||
458 | your hardware in a state where proper interrupt handling is | ||
459 | still required. | ||
460 | </para> | ||
461 | |||
462 | <para> | ||
463 | There might also be applications where you want to read data | ||
464 | from your hardware at each interrupt and buffer it in a piece | ||
465 | of kernel memory you've allocated for that purpose. With this | ||
466 | technique you could avoid loss of data if your userspace | ||
467 | program misses an interrupt. | ||
468 | </para> | ||
469 | |||
470 | <para> | ||
471 | A note on shared interrupts: Your driver should support | ||
472 | interrupt sharing whenever this is possible. It is possible if | ||
473 | and only if your driver can detect whether your hardware has | ||
474 | triggered the interrupt or not. This is usually done by looking | ||
475 | at an interrupt status register. If your driver sees that the | ||
476 | IRQ bit is actually set, it will perform its actions, and the | ||
477 | handler returns IRQ_HANDLED. If the driver detects that it was | ||
478 | not your hardware that caused the interrupt, it will do nothing | ||
479 | and return IRQ_NONE, allowing the kernel to call the next | ||
480 | possible interrupt handler. | ||
481 | </para> | ||
482 | |||
483 | <para> | ||
484 | If you decide not to support shared interrupts, your card | ||
485 | won't work in computers with no free interrupts. As this | ||
486 | frequently happens on the PC platform, you can save yourself a | ||
487 | lot of trouble by supporting interrupt sharing. | ||
488 | </para> | ||
489 | </sect1> | ||
490 | |||
491 | </chapter> | ||
492 | |||
493 | <chapter id="userspace_driver" xreflabel="Writing a driver in user space"> | ||
494 | <?dbhtml filename="userspace_driver.html"?> | ||
495 | <title>Writing a driver in userspace</title> | ||
496 | <para> | ||
497 | Once you have a working kernel module for your hardware, you can | ||
498 | write the userspace part of your driver. You don't need any special | ||
499 | libraries, your driver can be written in any reasonable language, | ||
500 | you can use floating point numbers and so on. In short, you can | ||
501 | use all the tools and libraries you'd normally use for writing a | ||
502 | userspace application. | ||
503 | </para> | ||
504 | |||
505 | <sect1 id="getting_uio_information"> | ||
506 | <title>Getting information about your UIO device</title> | ||
507 | <para> | ||
508 | Information about all UIO devices is available in sysfs. The | ||
509 | first thing you should do in your driver is check | ||
510 | <varname>name</varname> and <varname>version</varname> to | ||
511 | make sure your talking to the right device and that its kernel | ||
512 | driver has the version you expect. | ||
513 | </para> | ||
514 | <para> | ||
515 | You should also make sure that the memory mapping you need | ||
516 | exists and has the size you expect. | ||
517 | </para> | ||
518 | <para> | ||
519 | There is a tool called <varname>lsuio</varname> that lists | ||
520 | UIO devices and their attributes. It is available here: | ||
521 | </para> | ||
522 | <para> | ||
523 | <ulink url="http://www.osadl.org/projects/downloads/UIO/user/"> | ||
524 | http://www.osadl.org/projects/downloads/UIO/user/</ulink> | ||
525 | </para> | ||
526 | <para> | ||
527 | With <varname>lsuio</varname> you can quickly check if your | ||
528 | kernel module is loaded and which attributes it exports. | ||
529 | Have a look at the manpage for details. | ||
530 | </para> | ||
531 | <para> | ||
532 | The source code of <varname>lsuio</varname> can serve as an | ||
533 | example for getting information about an UIO device. | ||
534 | The file <filename>uio_helper.c</filename> contains a lot of | ||
535 | functions you could use in your userspace driver code. | ||
536 | </para> | ||
537 | </sect1> | ||
538 | |||
539 | <sect1 id="mmap_device_memory"> | ||
540 | <title>mmap() device memory</title> | ||
541 | <para> | ||
542 | After you made sure you've got the right device with the | ||
543 | memory mappings you need, all you have to do is to call | ||
544 | <function>mmap()</function> to map the device's memory | ||
545 | to userspace. | ||
546 | </para> | ||
547 | <para> | ||
548 | The parameter <varname>offset</varname> of the | ||
549 | <function>mmap()</function> call has a special meaning | ||
550 | for UIO devices: It is used to select which mapping of | ||
551 | your device you want to map. To map the memory of | ||
552 | mapping N, you have to use N times the page size as | ||
553 | your offset: | ||
554 | </para> | ||
555 | <programlisting format="linespecific"> | ||
556 | offset = N * getpagesize(); | ||
557 | </programlisting> | ||
558 | <para> | ||
559 | N starts from zero, so if you've got only one memory | ||
560 | range to map, set <varname>offset = 0</varname>. | ||
561 | A drawback of this technique is that memory is always | ||
562 | mapped beginning with its start address. | ||
563 | </para> | ||
564 | </sect1> | ||
565 | |||
566 | <sect1 id="wait_for_interrupts"> | ||
567 | <title>Waiting for interrupts</title> | ||
568 | <para> | ||
569 | After you successfully mapped your devices memory, you | ||
570 | can access it like an ordinary array. Usually, you will | ||
571 | perform some initialization. After that, your hardware | ||
572 | starts working and will generate an interrupt as soon | ||
573 | as it's finished, has some data available, or needs your | ||
574 | attention because an error occured. | ||
575 | </para> | ||
576 | <para> | ||
577 | <filename>/dev/uioX</filename> is a read-only file. A | ||
578 | <function>read()</function> will always block until an | ||
579 | interrupt occurs. There is only one legal value for the | ||
580 | <varname>count</varname> parameter of | ||
581 | <function>read()</function>, and that is the size of a | ||
582 | signed 32 bit integer (4). Any other value for | ||
583 | <varname>count</varname> causes <function>read()</function> | ||
584 | to fail. The signed 32 bit integer read is the interrupt | ||
585 | count of your device. If the value is one more than the value | ||
586 | you read the last time, everything is OK. If the difference | ||
587 | is greater than one, you missed interrupts. | ||
588 | </para> | ||
589 | <para> | ||
590 | You can also use <function>select()</function> on | ||
591 | <filename>/dev/uioX</filename>. | ||
592 | </para> | ||
593 | </sect1> | ||
594 | |||
595 | </chapter> | ||
596 | |||
597 | <appendix id="app1"> | ||
598 | <title>Further information</title> | ||
599 | <itemizedlist> | ||
600 | <listitem><para> | ||
601 | <ulink url="http://www.osadl.org"> | ||
602 | OSADL homepage.</ulink> | ||
603 | </para></listitem> | ||
604 | <listitem><para> | ||
605 | <ulink url="http://www.linutronix.de"> | ||
606 | Linutronix homepage.</ulink> | ||
607 | </para></listitem> | ||
608 | </itemizedlist> | ||
609 | </appendix> | ||
610 | |||
611 | </book> | ||
diff --git a/Documentation/HOWTO b/Documentation/HOWTO index ced9207bedcf..f8cc3f8ed152 100644 --- a/Documentation/HOWTO +++ b/Documentation/HOWTO | |||
@@ -249,6 +249,9 @@ process is as follows: | |||
249 | release a new -rc kernel every week. | 249 | release a new -rc kernel every week. |
250 | - Process continues until the kernel is considered "ready", the | 250 | - Process continues until the kernel is considered "ready", the |
251 | process should last around 6 weeks. | 251 | process should last around 6 weeks. |
252 | - A list of known regressions present in each -rc release is | ||
253 | tracked at the following URI: | ||
254 | http://kernelnewbies.org/known_regressions | ||
252 | 255 | ||
253 | It is worth mentioning what Andrew Morton wrote on the linux-kernel | 256 | It is worth mentioning what Andrew Morton wrote on the linux-kernel |
254 | mailing list about kernel releases: | 257 | mailing list about kernel releases: |
@@ -322,39 +325,34 @@ kernel releases as described above. | |||
322 | Here is a list of some of the different kernel trees available: | 325 | Here is a list of some of the different kernel trees available: |
323 | git trees: | 326 | git trees: |
324 | - Kbuild development tree, Sam Ravnborg <sam@ravnborg.org> | 327 | - Kbuild development tree, Sam Ravnborg <sam@ravnborg.org> |
325 | kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git | 328 | git.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git |
326 | 329 | ||
327 | - ACPI development tree, Len Brown <len.brown@intel.com> | 330 | - ACPI development tree, Len Brown <len.brown@intel.com> |
328 | kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git | 331 | git.kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git |
329 | 332 | ||
330 | - Block development tree, Jens Axboe <axboe@suse.de> | 333 | - Block development tree, Jens Axboe <axboe@suse.de> |
331 | kernel.org:/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git | 334 | git.kernel.org:/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git |
332 | 335 | ||
333 | - DRM development tree, Dave Airlie <airlied@linux.ie> | 336 | - DRM development tree, Dave Airlie <airlied@linux.ie> |
334 | kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git | 337 | git.kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git |
335 | 338 | ||
336 | - ia64 development tree, Tony Luck <tony.luck@intel.com> | 339 | - ia64 development tree, Tony Luck <tony.luck@intel.com> |
337 | kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git | 340 | git.kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git |
338 | |||
339 | - ieee1394 development tree, Jody McIntyre <scjody@modernduck.com> | ||
340 | kernel.org:/pub/scm/linux/kernel/git/scjody/ieee1394.git | ||
341 | 341 | ||
342 | - infiniband, Roland Dreier <rolandd@cisco.com> | 342 | - infiniband, Roland Dreier <rolandd@cisco.com> |
343 | kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git | 343 | git.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git |
344 | 344 | ||
345 | - libata, Jeff Garzik <jgarzik@pobox.com> | 345 | - libata, Jeff Garzik <jgarzik@pobox.com> |
346 | kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git | 346 | git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git |
347 | 347 | ||
348 | - network drivers, Jeff Garzik <jgarzik@pobox.com> | 348 | - network drivers, Jeff Garzik <jgarzik@pobox.com> |
349 | kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git | 349 | git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git |
350 | 350 | ||
351 | - pcmcia, Dominik Brodowski <linux@dominikbrodowski.net> | 351 | - pcmcia, Dominik Brodowski <linux@dominikbrodowski.net> |
352 | kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git | 352 | git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git |
353 | 353 | ||
354 | - SCSI, James Bottomley <James.Bottomley@SteelEye.com> | 354 | - SCSI, James Bottomley <James.Bottomley@SteelEye.com> |
355 | kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git | 355 | git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git |
356 | |||
357 | Other git kernel trees can be found listed at http://kernel.org/git | ||
358 | 356 | ||
359 | quilt trees: | 357 | quilt trees: |
360 | - USB, PCI, Driver Core, and I2C, Greg Kroah-Hartman <gregkh@suse.de> | 358 | - USB, PCI, Driver Core, and I2C, Greg Kroah-Hartman <gregkh@suse.de> |
@@ -362,6 +360,9 @@ Here is a list of some of the different kernel trees available: | |||
362 | - x86-64, partly i386, Andi Kleen <ak@suse.de> | 360 | - x86-64, partly i386, Andi Kleen <ak@suse.de> |
363 | ftp.firstfloor.org:/pub/ak/x86_64/quilt/ | 361 | ftp.firstfloor.org:/pub/ak/x86_64/quilt/ |
364 | 362 | ||
363 | Other kernel trees can be found listed at http://git.kernel.org/ and in | ||
364 | the MAINTAINERS file. | ||
365 | |||
365 | Bug Reporting | 366 | Bug Reporting |
366 | ------------- | 367 | ------------- |
367 | 368 | ||
diff --git a/Documentation/RCU/checklist.txt b/Documentation/RCU/checklist.txt index f4dffadbcb00..42b01bc2e1b4 100644 --- a/Documentation/RCU/checklist.txt +++ b/Documentation/RCU/checklist.txt | |||
@@ -222,7 +222,15 @@ over a rather long period of time, but improvements are always welcome! | |||
222 | deadlock as soon as the RCU callback happens to interrupt that | 222 | deadlock as soon as the RCU callback happens to interrupt that |
223 | acquisition's critical section. | 223 | acquisition's critical section. |
224 | 224 | ||
225 | 13. SRCU (srcu_read_lock(), srcu_read_unlock(), and synchronize_srcu()) | 225 | 13. RCU callbacks can be and are executed in parallel. In many cases, |
226 | the callback code simply wrappers around kfree(), so that this | ||
227 | is not an issue (or, more accurately, to the extent that it is | ||
228 | an issue, the memory-allocator locking handles it). However, | ||
229 | if the callbacks do manipulate a shared data structure, they | ||
230 | must use whatever locking or other synchronization is required | ||
231 | to safely access and/or modify that data structure. | ||
232 | |||
233 | 14. SRCU (srcu_read_lock(), srcu_read_unlock(), and synchronize_srcu()) | ||
226 | may only be invoked from process context. Unlike other forms of | 234 | may only be invoked from process context. Unlike other forms of |
227 | RCU, it -is- permissible to block in an SRCU read-side critical | 235 | RCU, it -is- permissible to block in an SRCU read-side critical |
228 | section (demarked by srcu_read_lock() and srcu_read_unlock()), | 236 | section (demarked by srcu_read_lock() and srcu_read_unlock()), |
diff --git a/Documentation/SM501.txt b/Documentation/SM501.txt new file mode 100644 index 000000000000..3a1bd95d3767 --- /dev/null +++ b/Documentation/SM501.txt | |||
@@ -0,0 +1,66 @@ | |||
1 | SM501 Driver | ||
2 | ============ | ||
3 | |||
4 | Copyright 2006, 2007 Simtec Electronics | ||
5 | |||
6 | Core | ||
7 | ---- | ||
8 | |||
9 | The core driver in drivers/mfd provides common services for the | ||
10 | drivers which manage the specific hardware blocks. These services | ||
11 | include locking for common registers, clock control and resource | ||
12 | management. | ||
13 | |||
14 | The core registers drivers for both PCI and generic bus based | ||
15 | chips via the platform device and driver system. | ||
16 | |||
17 | On detection of a device, the core initialises the chip (which may | ||
18 | be specified by the platform data) and then exports the selected | ||
19 | peripheral set as platform devices for the specific drivers. | ||
20 | |||
21 | The core re-uses the platform device system as the platform device | ||
22 | system provides enough features to support the drivers without the | ||
23 | need to create a new bus-type and the associated code to go with it. | ||
24 | |||
25 | |||
26 | Resources | ||
27 | --------- | ||
28 | |||
29 | Each peripheral has a view of the device which is implicitly narrowed to | ||
30 | the specific set of resources that peripheral requires in order to | ||
31 | function correctly. | ||
32 | |||
33 | The centralised memory allocation allows the driver to ensure that the | ||
34 | maximum possible resource allocation can be made to the video subsystem | ||
35 | as this is by-far the most resource-sensitive of the on-chip functions. | ||
36 | |||
37 | The primary issue with memory allocation is that of moving the video | ||
38 | buffers once a display mode is chosen. Indeed when a video mode change | ||
39 | occurs the memory footprint of the video subsystem changes. | ||
40 | |||
41 | Since video memory is difficult to move without changing the display | ||
42 | (unless sufficient contiguous memory can be provided for the old and new | ||
43 | modes simultaneously) the video driver fully utilises the memory area | ||
44 | given to it by aligning fb0 to the start of the area and fb1 to the end | ||
45 | of it. Any memory left over in the middle is used for the acceleration | ||
46 | functions, which are transient and thus their location is less critical | ||
47 | as it can be moved. | ||
48 | |||
49 | |||
50 | Configuration | ||
51 | ------------- | ||
52 | |||
53 | The platform device driver uses a set of platform data to pass | ||
54 | configurations through to the core and the subsidiary drivers | ||
55 | so that there can be support for more than one system carrying | ||
56 | an SM501 built into a single kernel image. | ||
57 | |||
58 | The PCI driver assumes that the PCI card behaves as per the Silicon | ||
59 | Motion reference design. | ||
60 | |||
61 | There is an errata (AB-5) affecting the selection of the | ||
62 | of the M1XCLK and M1CLK frequencies. These two clocks | ||
63 | must be sourced from the same PLL, although they can then | ||
64 | be divided down individually. If this is not set, then SM501 may | ||
65 | lock and hang the whole system. The driver will refuse to | ||
66 | attach if the PLL selection is different. | ||
diff --git a/Documentation/SubmitChecklist b/Documentation/SubmitChecklist index 6ebffb57e3db..19e7f65c269f 100644 --- a/Documentation/SubmitChecklist +++ b/Documentation/SubmitChecklist | |||
@@ -1,4 +1,4 @@ | |||
1 | Linux Kernel patch sumbittal checklist | 1 | Linux Kernel patch submission checklist |
2 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 2 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
3 | 3 | ||
4 | Here are some basic things that developers should do if they want to see their | 4 | Here are some basic things that developers should do if they want to see their |
@@ -9,7 +9,6 @@ Documentation/SubmittingPatches and elsewhere regarding submitting Linux | |||
9 | kernel patches. | 9 | kernel patches. |
10 | 10 | ||
11 | 11 | ||
12 | |||
13 | 1: Builds cleanly with applicable or modified CONFIG options =y, =m, and | 12 | 1: Builds cleanly with applicable or modified CONFIG options =y, =m, and |
14 | =n. No gcc warnings/errors, no linker warnings/errors. | 13 | =n. No gcc warnings/errors, no linker warnings/errors. |
15 | 14 | ||
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches index d91125ab6f49..3f9a7912e69b 100644 --- a/Documentation/SubmittingPatches +++ b/Documentation/SubmittingPatches | |||
@@ -340,8 +340,32 @@ now, but you can do this to mark internal company procedures or just | |||
340 | point out some special detail about the sign-off. | 340 | point out some special detail about the sign-off. |
341 | 341 | ||
342 | 342 | ||
343 | 13) When to use Acked-by: | ||
343 | 344 | ||
344 | 13) The canonical patch format | 345 | The Signed-off-by: tag indicates that the signer was involved in the |
346 | development of the patch, or that he/she was in the patch's delivery path. | ||
347 | |||
348 | If a person was not directly involved in the preparation or handling of a | ||
349 | patch but wishes to signify and record their approval of it then they can | ||
350 | arrange to have an Acked-by: line added to the patch's changelog. | ||
351 | |||
352 | Acked-by: is often used by the maintainer of the affected code when that | ||
353 | maintainer neither contributed to nor forwarded the patch. | ||
354 | |||
355 | Acked-by: is not as formal as Signed-off-by:. It is a record that the acker | ||
356 | has at least reviewed the patch and has indicated acceptance. Hence patch | ||
357 | mergers will sometimes manually convert an acker's "yep, looks good to me" | ||
358 | into an Acked-by:. | ||
359 | |||
360 | Acked-by: does not necessarily indicate acknowledgement of the entire patch. | ||
361 | For example, if a patch affects multiple subsystems and has an Acked-by: from | ||
362 | one subsystem maintainer then this usually indicates acknowledgement of just | ||
363 | the part which affects that maintainer's code. Judgement should be used here. | ||
364 | When in doubt people should refer to the original discussion in the mailing | ||
365 | list archives. | ||
366 | |||
367 | |||
368 | 14) The canonical patch format | ||
345 | 369 | ||
346 | The canonical patch subject line is: | 370 | The canonical patch subject line is: |
347 | 371 | ||
@@ -440,9 +464,25 @@ section Linus Computer Science 101. | |||
440 | Nuff said. If your code deviates too much from this, it is likely | 464 | Nuff said. If your code deviates too much from this, it is likely |
441 | to be rejected without further review, and without comment. | 465 | to be rejected without further review, and without comment. |
442 | 466 | ||
467 | Once significant exception is when moving code from one file to | ||
468 | another in this case you should not modify the moved code at all in | ||
469 | the same patch which moves it. This clearly delineates the act of | ||
470 | moving the code and your changes. This greatly aids review of the | ||
471 | actual differences and allows tools to better track the history of | ||
472 | the code itself. | ||
473 | |||
443 | Check your patches with the patch style checker prior to submission | 474 | Check your patches with the patch style checker prior to submission |
444 | (scripts/checkpatch.pl). You should be able to justify all | 475 | (scripts/checkpatch.pl). The style checker should be viewed as |
445 | violations that remain in your patch. | 476 | a guide not as the final word. If your code looks better with |
477 | a violation then its probably best left alone. | ||
478 | |||
479 | The checker reports at three levels: | ||
480 | - ERROR: things that are very likely to be wrong | ||
481 | - WARNING: things requiring careful review | ||
482 | - CHECK: things requiring thought | ||
483 | |||
484 | You should be able to justify all violations that remain in your | ||
485 | patch. | ||
446 | 486 | ||
447 | 487 | ||
448 | 488 | ||
diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c index 71acc28ed0d1..24c5aade8998 100644 --- a/Documentation/accounting/getdelays.c +++ b/Documentation/accounting/getdelays.c | |||
@@ -49,6 +49,7 @@ char name[100]; | |||
49 | int dbg; | 49 | int dbg; |
50 | int print_delays; | 50 | int print_delays; |
51 | int print_io_accounting; | 51 | int print_io_accounting; |
52 | int print_task_context_switch_counts; | ||
52 | __u64 stime, utime; | 53 | __u64 stime, utime; |
53 | 54 | ||
54 | #define PRINTF(fmt, arg...) { \ | 55 | #define PRINTF(fmt, arg...) { \ |
@@ -195,7 +196,7 @@ void print_delayacct(struct taskstats *t) | |||
195 | "IO %15s%15s\n" | 196 | "IO %15s%15s\n" |
196 | " %15llu%15llu\n" | 197 | " %15llu%15llu\n" |
197 | "MEM %15s%15s\n" | 198 | "MEM %15s%15s\n" |
198 | " %15llu%15llu\n\n", | 199 | " %15llu%15llu\n" |
199 | "count", "real total", "virtual total", "delay total", | 200 | "count", "real total", "virtual total", "delay total", |
200 | t->cpu_count, t->cpu_run_real_total, t->cpu_run_virtual_total, | 201 | t->cpu_count, t->cpu_run_real_total, t->cpu_run_virtual_total, |
201 | t->cpu_delay_total, | 202 | t->cpu_delay_total, |
@@ -204,6 +205,14 @@ void print_delayacct(struct taskstats *t) | |||
204 | "count", "delay total", t->swapin_count, t->swapin_delay_total); | 205 | "count", "delay total", t->swapin_count, t->swapin_delay_total); |
205 | } | 206 | } |
206 | 207 | ||
208 | void task_context_switch_counts(struct taskstats *t) | ||
209 | { | ||
210 | printf("\n\nTask %15s%15s\n" | ||
211 | " %15lu%15lu\n", | ||
212 | "voluntary", "nonvoluntary", | ||
213 | t->nvcsw, t->nivcsw); | ||
214 | } | ||
215 | |||
207 | void print_ioacct(struct taskstats *t) | 216 | void print_ioacct(struct taskstats *t) |
208 | { | 217 | { |
209 | printf("%s: read=%llu, write=%llu, cancelled_write=%llu\n", | 218 | printf("%s: read=%llu, write=%llu, cancelled_write=%llu\n", |
@@ -235,7 +244,7 @@ int main(int argc, char *argv[]) | |||
235 | struct msgtemplate msg; | 244 | struct msgtemplate msg; |
236 | 245 | ||
237 | while (1) { | 246 | while (1) { |
238 | c = getopt(argc, argv, "diw:r:m:t:p:vl"); | 247 | c = getopt(argc, argv, "qdiw:r:m:t:p:vl"); |
239 | if (c < 0) | 248 | if (c < 0) |
240 | break; | 249 | break; |
241 | 250 | ||
@@ -248,6 +257,10 @@ int main(int argc, char *argv[]) | |||
248 | printf("printing IO accounting\n"); | 257 | printf("printing IO accounting\n"); |
249 | print_io_accounting = 1; | 258 | print_io_accounting = 1; |
250 | break; | 259 | break; |
260 | case 'q': | ||
261 | printf("printing task/process context switch rates\n"); | ||
262 | print_task_context_switch_counts = 1; | ||
263 | break; | ||
251 | case 'w': | 264 | case 'w': |
252 | logfile = strdup(optarg); | 265 | logfile = strdup(optarg); |
253 | printf("write to file %s\n", logfile); | 266 | printf("write to file %s\n", logfile); |
@@ -389,6 +402,8 @@ int main(int argc, char *argv[]) | |||
389 | print_delayacct((struct taskstats *) NLA_DATA(na)); | 402 | print_delayacct((struct taskstats *) NLA_DATA(na)); |
390 | if (print_io_accounting) | 403 | if (print_io_accounting) |
391 | print_ioacct((struct taskstats *) NLA_DATA(na)); | 404 | print_ioacct((struct taskstats *) NLA_DATA(na)); |
405 | if (print_task_context_switch_counts) | ||
406 | task_context_switch_counts((struct taskstats *) NLA_DATA(na)); | ||
392 | if (fd) { | 407 | if (fd) { |
393 | if (write(fd, NLA_DATA(na), na->nla_len) < 0) { | 408 | if (write(fd, NLA_DATA(na), na->nla_len) < 0) { |
394 | err(1,"write error\n"); | 409 | err(1,"write error\n"); |
diff --git a/Documentation/accounting/taskstats-struct.txt b/Documentation/accounting/taskstats-struct.txt index 661c797eaf79..8aa7529f8258 100644 --- a/Documentation/accounting/taskstats-struct.txt +++ b/Documentation/accounting/taskstats-struct.txt | |||
@@ -22,6 +22,8 @@ There are three different groups of fields in the struct taskstats: | |||
22 | /* Extended accounting fields end */ | 22 | /* Extended accounting fields end */ |
23 | Their values are collected if CONFIG_TASK_XACCT is set. | 23 | Their values are collected if CONFIG_TASK_XACCT is set. |
24 | 24 | ||
25 | 4) Per-task and per-thread context switch count statistics | ||
26 | |||
25 | Future extension should add fields to the end of the taskstats struct, and | 27 | Future extension should add fields to the end of the taskstats struct, and |
26 | should not change the relative position of each field within the struct. | 28 | should not change the relative position of each field within the struct. |
27 | 29 | ||
@@ -158,4 +160,8 @@ struct taskstats { | |||
158 | 160 | ||
159 | /* Extended accounting fields end */ | 161 | /* Extended accounting fields end */ |
160 | 162 | ||
163 | 4) Per-task and per-thread statistics | ||
164 | __u64 nvcsw; /* Context voluntary switch counter */ | ||
165 | __u64 nivcsw; /* Context involuntary switch counter */ | ||
166 | |||
161 | } | 167 | } |
diff --git a/Documentation/atomic_ops.txt b/Documentation/atomic_ops.txt index 2a63d5662a93..05851e9982ed 100644 --- a/Documentation/atomic_ops.txt +++ b/Documentation/atomic_ops.txt | |||
@@ -149,7 +149,7 @@ defined which accomplish this: | |||
149 | void smp_mb__before_atomic_dec(void); | 149 | void smp_mb__before_atomic_dec(void); |
150 | void smp_mb__after_atomic_dec(void); | 150 | void smp_mb__after_atomic_dec(void); |
151 | void smp_mb__before_atomic_inc(void); | 151 | void smp_mb__before_atomic_inc(void); |
152 | void smp_mb__after_atomic_dec(void); | 152 | void smp_mb__after_atomic_inc(void); |
153 | 153 | ||
154 | For example, smp_mb__before_atomic_dec() can be used like so: | 154 | For example, smp_mb__before_atomic_dec() can be used like so: |
155 | 155 | ||
diff --git a/Documentation/blackfin/kgdb.txt b/Documentation/blackfin/kgdb.txt new file mode 100644 index 000000000000..84f6a484ae9a --- /dev/null +++ b/Documentation/blackfin/kgdb.txt | |||
@@ -0,0 +1,155 @@ | |||
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/barrier.txt b/Documentation/block/barrier.txt index a272c3db8094..7d279f2f5bb2 100644 --- a/Documentation/block/barrier.txt +++ b/Documentation/block/barrier.txt | |||
@@ -82,23 +82,12 @@ including draining and flushing. | |||
82 | typedef void (prepare_flush_fn)(request_queue_t *q, struct request *rq); | 82 | typedef void (prepare_flush_fn)(request_queue_t *q, struct request *rq); |
83 | 83 | ||
84 | int blk_queue_ordered(request_queue_t *q, unsigned ordered, | 84 | int blk_queue_ordered(request_queue_t *q, unsigned ordered, |
85 | prepare_flush_fn *prepare_flush_fn, | 85 | prepare_flush_fn *prepare_flush_fn); |
86 | unsigned gfp_mask); | ||
87 | |||
88 | int blk_queue_ordered_locked(request_queue_t *q, unsigned ordered, | ||
89 | prepare_flush_fn *prepare_flush_fn, | ||
90 | unsigned gfp_mask); | ||
91 | |||
92 | The only difference between the two functions is whether or not the | ||
93 | caller is holding q->queue_lock on entry. The latter expects the | ||
94 | caller is holding the lock. | ||
95 | 86 | ||
96 | @q : the queue in question | 87 | @q : the queue in question |
97 | @ordered : the ordered mode the driver/device supports | 88 | @ordered : the ordered mode the driver/device supports |
98 | @prepare_flush_fn : this function should prepare @rq such that it | 89 | @prepare_flush_fn : this function should prepare @rq such that it |
99 | flushes cache to physical medium when executed | 90 | flushes cache to physical medium when executed |
100 | @gfp_mask : gfp_mask used when allocating data structures | ||
101 | for ordered processing | ||
102 | 91 | ||
103 | For example, SCSI disk driver's prepare_flush_fn looks like the | 92 | For example, SCSI disk driver's prepare_flush_fn looks like the |
104 | following. | 93 | following. |
@@ -106,9 +95,10 @@ following. | |||
106 | static void sd_prepare_flush(request_queue_t *q, struct request *rq) | 95 | static void sd_prepare_flush(request_queue_t *q, struct request *rq) |
107 | { | 96 | { |
108 | memset(rq->cmd, 0, sizeof(rq->cmd)); | 97 | memset(rq->cmd, 0, sizeof(rq->cmd)); |
109 | rq->flags |= REQ_BLOCK_PC; | 98 | rq->cmd_type = REQ_TYPE_BLOCK_PC; |
110 | rq->timeout = SD_TIMEOUT; | 99 | rq->timeout = SD_TIMEOUT; |
111 | rq->cmd[0] = SYNCHRONIZE_CACHE; | 100 | rq->cmd[0] = SYNCHRONIZE_CACHE; |
101 | rq->cmd_len = 10; | ||
112 | } | 102 | } |
113 | 103 | ||
114 | The following seven ordered modes are supported. The following table | 104 | The following seven ordered modes are supported. The following table |
diff --git a/Documentation/cachetlb.txt b/Documentation/cachetlb.txt index debf6813934a..866b76139420 100644 --- a/Documentation/cachetlb.txt +++ b/Documentation/cachetlb.txt | |||
@@ -253,7 +253,7 @@ Here are the routines, one by one: | |||
253 | 253 | ||
254 | The first of these two routines is invoked after map_vm_area() | 254 | The first of these two routines is invoked after map_vm_area() |
255 | has installed the page table entries. The second is invoked | 255 | has installed the page table entries. The second is invoked |
256 | before unmap_vm_area() deletes the page table entries. | 256 | before unmap_kernel_range() deletes the page table entries. |
257 | 257 | ||
258 | There exists another whole class of cpu cache issues which currently | 258 | There exists another whole class of cpu cache issues which currently |
259 | require a whole different set of interfaces to handle properly. | 259 | require a whole different set of interfaces to handle properly. |
diff --git a/Documentation/cdrom/00-INDEX b/Documentation/cdrom/00-INDEX index 916dafe29d3f..433edf23dc49 100644 --- a/Documentation/cdrom/00-INDEX +++ b/Documentation/cdrom/00-INDEX | |||
@@ -2,32 +2,10 @@ | |||
2 | - this file (info on CD-ROMs and Linux) | 2 | - this file (info on CD-ROMs and Linux) |
3 | Makefile | 3 | Makefile |
4 | - only used to generate TeX output from the documentation. | 4 | - only used to generate TeX output from the documentation. |
5 | aztcd | ||
6 | - info on Aztech/Orchid/Okano/Wearnes/Conrad/CyCDROM driver. | ||
7 | cdrom-standard.tex | 5 | cdrom-standard.tex |
8 | - LaTeX document on standardizing the CD-ROM programming interface. | 6 | - LaTeX document on standardizing the CD-ROM programming interface. |
9 | cdu31a | ||
10 | - info on the Sony CDU31A/CDU33A CD-ROM driver. | ||
11 | cm206 | ||
12 | - info on the Philips/LMS cm206/cm260 CD-ROM driver. | ||
13 | gscd | ||
14 | - info on the Goldstar R420 CD-ROM driver. | ||
15 | ide-cd | 7 | ide-cd |
16 | - info on setting up and using ATAPI (aka IDE) CD-ROMs. | 8 | - info on setting up and using ATAPI (aka IDE) CD-ROMs. |
17 | isp16 | ||
18 | - info on the CD-ROM interface on ISP16, MAD16 or Mozart sound card. | ||
19 | mcd | ||
20 | - info on limitations of standard Mitsumi CD-ROM driver. | ||
21 | mcdx | ||
22 | - info on improved Mitsumi CD-ROM driver. | ||
23 | optcd | ||
24 | - info on the Optics Storage 8000 AT CD-ROM driver | ||
25 | packet-writing.txt | 9 | packet-writing.txt |
26 | - Info on the CDRW packet writing module | 10 | - Info on the CDRW packet writing module |
27 | sbpcd | ||
28 | - info on the SoundBlaster/Panasonic CD-ROM interface driver. | ||
29 | sjcd | ||
30 | - info on the SANYO CDR-H94A CD-ROM interface driver. | ||
31 | sonycd535 | ||
32 | - info on the Sony CDU-535 (and 531) CD-ROM driver. | ||
33 | 11 | ||
diff --git a/Documentation/cdrom/aztcd b/Documentation/cdrom/aztcd deleted file mode 100644 index 6bf0290ef7ce..000000000000 --- a/Documentation/cdrom/aztcd +++ /dev/null | |||
@@ -1,822 +0,0 @@ | |||
1 | $Id: README.aztcd,v 2.60 1997/11/29 09:51:25 root Exp root $ | ||
2 | Readme-File Documentation/cdrom/aztcd | ||
3 | for | ||
4 | AZTECH CD-ROM CDA268-01A, ORCHID CD-3110, | ||
5 | OKANO/WEARNES CDD110, CONRAD TXC, CyCDROM CR520, CR540 | ||
6 | CD-ROM Drives | ||
7 | Version 2.6 and newer | ||
8 | (for other drives see 6.-8.) | ||
9 | |||
10 | NOTE: THIS DRIVER WILL WORK WITH THE CD-ROM DRIVES LISTED, WHICH HAVE | ||
11 | A PROPRIETARY INTERFACE (implemented on a sound card or on an | ||
12 | ISA-AT-bus card). | ||
13 | IT WILL DEFINITELY NOT WORK WITH CD-ROM DRIVES WITH *IDE*-INTERFACE, | ||
14 | such as the Aztech CDA269-031SE !!! (The only known exceptions are | ||
15 | 'faked' IDE drives like the CyCDROM CR520ie which work with aztcd | ||
16 | under certain conditions, see 7.). IF YOU'RE USING A CD-ROM DRIVE | ||
17 | WITH IDE-INTERFACE, SOMETIMES ALSO CALLED ATAPI-COMPATIBLE, PLEASE | ||
18 | USE THE ide-cd.c DRIVER, WRITTEN BY MARK LORD AND SCOTT SNYDER ! | ||
19 | THE STANDARD-KERNEL 1.2.x NOW ALSO SUPPORTS IDE-CDROM-DRIVES, SEE THE | ||
20 | HARDDISK (!) SECTION OF make config, WHEN COMPILING A NEW KERNEL!!! | ||
21 | ---------------------------------------------------------------------------- | ||
22 | |||
23 | Contents of this file: | ||
24 | 1. NOTE | ||
25 | 2. INSTALLATION | ||
26 | 3. CONFIGURING YOUR KERNEL | ||
27 | 4. RECOMPILING YOUR KERNEL | ||
28 | 4.1 AZTCD AS A RUN-TIME LOADABLE MODULE | ||
29 | 4.2 CDROM CONNECTED TO A SOUNDCARD | ||
30 | 5. KNOWN PROBLEMS, FUTURE DEVELOPMENTS | ||
31 | 5.1 MULTISESSION SUPPORT | ||
32 | 5.2 STATUS RECOGNITION | ||
33 | 5.3 DOSEMU's CDROM SUPPORT | ||
34 | 6. BUG REPORTS | ||
35 | 7. OTHER DRIVES | ||
36 | 8. IF YOU DON'T SUCCEED ... DEBUGGING | ||
37 | 9. TECHNICAL HISTORY OF THE DRIVER | ||
38 | 10. ACKNOWLEDGMENTS | ||
39 | 11. PROGRAMMING ADD ONS: CDPLAY.C | ||
40 | APPENDIX: Source code of cdplay.c | ||
41 | ---------------------------------------------------------------------------- | ||
42 | |||
43 | 1. NOTE | ||
44 | This software has been successfully in alpha and beta test and is part of | ||
45 | the standard kernel since kernel 1.1.8x since December 1994. It works with | ||
46 | AZTECH CDA268-01A, ORCHID CDS-3110, ORCHID/WEARNES CDD110 and CONRAD TXC | ||
47 | (Nr.99 31 23 -series 04) and has proven to be stable with kernel | ||
48 | versions 1.0.9 and newer. But with any software there still may be bugs in it. | ||
49 | So if you encounter problems, you are invited to help us improve this software. | ||
50 | Please send me a detailed bug report (see chapter BUG REPORTS). You are also | ||
51 | invited in helping us to increase the number of drives, which are supported. | ||
52 | |||
53 | Please read the README-files carefully and always keep a backup copy of your | ||
54 | old kernel, in order to reboot if something goes wrong! | ||
55 | |||
56 | 2. INSTALLATION | ||
57 | The driver consists of a header file 'aztcd.h', which normally should reside | ||
58 | in /usr/src/linux/drivers/cdrom and the source code 'aztcd.c', which normally | ||
59 | resides in the same place. It uses /dev/aztcd (/dev/aztcd0 in some distri- | ||
60 | butions), which must be a valid block device with major number 29 and reside | ||
61 | in directory /dev. To mount a CD-ROM, your kernel needs to have the ISO9660- | ||
62 | filesystem support included. | ||
63 | |||
64 | PLEASE NOTE: aztcd.c has been developed in parallel to the linux kernel, | ||
65 | which had and is having many major and minor changes which are not backward | ||
66 | compatible. Quite definitely aztcd.c version 1.80 and newer will NOT work | ||
67 | in kernels older than 1.3.33. So please always use the most recent version | ||
68 | of aztcd.c with the appropriate linux-kernel. | ||
69 | |||
70 | 3. CONFIGURING YOUR KERNEL | ||
71 | If your kernel is already configured for using the AZTECH driver you will | ||
72 | see the following message while Linux boots: | ||
73 | Aztech CD-ROM Init: DriverVersion=<version number> BaseAddress=<baseaddress> | ||
74 | Aztech CD-ROM Init: FirmwareVersion=<firmware version id of your I/O-card>>> | ||
75 | Aztech CD-ROM Init: <drive type> detected | ||
76 | Aztech CD-ROM Init: End | ||
77 | If the message looks different and you are sure to have a supported drive, | ||
78 | it may have a different base address. The Aztech driver does look for the | ||
79 | CD-ROM drive at the base address specified in aztcd.h at compile time. This | ||
80 | address can be overwritten by boot parameter aztcd=....You should reboot and | ||
81 | start Linux with boot parameter aztcd=<base address>, e.g. aztcd=0x320. If | ||
82 | you do not know the base address, start your PC with DOS and look at the boot | ||
83 | message of your CD-ROM's DOS driver. If that still does not help, use boot | ||
84 | parameter aztcd=<base address>,0x79 , this tells aztcd to try a little harder. | ||
85 | aztcd may be configured to use autoprobing the base address by recompiling | ||
86 | it (see chapter 4.). | ||
87 | |||
88 | If the message looks correct, as user 'root' you should be able to mount the | ||
89 | drive by | ||
90 | mount -t iso9660 -r /dev/aztcd0 /mnt | ||
91 | and use it as any other filesystem. (If this does not work, check if | ||
92 | /dev/aztcd0 and /mnt do exist and create them, if necessary by doing | ||
93 | mknod /dev/aztcd0 b 29 0 | ||
94 | mkdir /mnt | ||
95 | |||
96 | If you still get a different message while Linux boots or when you get the | ||
97 | message, that the ISO9660-filesystem is not supported by your kernel, when | ||
98 | you try to mount the CD-ROM drive, you have to recompile your kernel. | ||
99 | |||
100 | If you do *not* have an Aztech/Orchid/Okano/Wearnes/TXC drive and want to | ||
101 | bypass drive detection during Linux boot up, start with boot parameter aztcd=0. | ||
102 | |||
103 | Most distributions nowadays do contain a boot disk image containing aztcd. | ||
104 | Please note, that this driver will not work with IDE/ATAPI drives! With these | ||
105 | you must use ide-cd.c instead. | ||
106 | |||
107 | 4. RECOMPILING YOUR KERNEL | ||
108 | If your kernel is not yet configured for the AZTECH driver and the ISO9660- | ||
109 | filesystem, you have to recompile your kernel: | ||
110 | |||
111 | - Edit aztcd.h to set the I/O-address to your I/O-Base address (AZT_BASE_ADDR), | ||
112 | the driver does not use interrupts or DMA, so if you are using an AZTECH | ||
113 | CD268, an ORCHID CD-3110 or ORCHID/WEARNES CDD110 that's the only item you | ||
114 | have to set up. If you have a soundcard, read chapter 4.2. | ||
115 | Users of other drives should read chapter OTHER DRIVES of this file. | ||
116 | You also can configure that address by kernel boot parameter aztcd=... | ||
117 | - aztcd may be configured to use autoprobing the base address by setting | ||
118 | AZT_BASE_ADDR to '-1'. In that case aztcd probes the addresses listed | ||
119 | under AZT_BASE_AUTO. But please remember, that autoprobing always may | ||
120 | incorrectly influence other hardware components too! | ||
121 | - There are some other points, which may be configured, e.g. auto-eject the | ||
122 | CD when unmounting a drive, tray locking etc., see aztcd.h for details. | ||
123 | - If you're using a linux kernel version prior to 2.1.0, in aztcd.h | ||
124 | uncomment the line '#define AZT_KERNEL_PRIOR_2_1' | ||
125 | - Build a new kernel, configure it for 'Aztech/Orchid/Okano/Wearnes support' | ||
126 | (if you want aztcd to be part of the kernel). Do not configure it for | ||
127 | 'Aztech... support', if you want to use aztcd as a run time loadable module. | ||
128 | But in any case you must have the ISO9660-filesystem included in your | ||
129 | kernel. | ||
130 | - Activate the new kernel, normally this is done by running LILO (don't for- | ||
131 | get to configure it before and to keep a copy of your old kernel in case | ||
132 | something goes wrong!). | ||
133 | - Reboot | ||
134 | - If you've included aztcd in your kernel, you now should see during boot | ||
135 | some messages like | ||
136 | Aztech CD-ROM Init: DriverVersion=<version number> BaseAddress=<baseaddress> | ||
137 | Aztech CD-ROM Init: FirmwareVersion=<firmware version id of your I/O-card> | ||
138 | Aztech CD-ROM Init: <drive type> detected | ||
139 | Aztech CD-ROM Init: End | ||
140 | - If you have not included aztcd in your kernel, but want to load aztcd as a | ||
141 | run time loadable module see 4.1. | ||
142 | - If the message looks correct, as user 'root' you should be able to mount | ||
143 | the drive by | ||
144 | mount -t iso9660 -r /dev/aztcd0 /mnt | ||
145 | and use it as any other filesystem. (If this does not work, check if | ||
146 | /dev/aztcd0 and /mnt do exist and create them, if necessary by doing | ||
147 | mknod /dev/aztcd0 b 29 0 | ||
148 | mkdir /mnt | ||
149 | - If this still does not help, see chapters OTHER DRIVES and DEBUGGING. | ||
150 | |||
151 | 4.1 AZTCD AS A RUN-TIME LOADABLE MODULE | ||
152 | If you do not need aztcd permanently, you can also load and remove the driver | ||
153 | during runtime via insmod and rmmod. To build aztcd as a loadable module you | ||
154 | must configure your kernel for AZTECH module support (answer 'm' when con- | ||
155 | figuring the kernel). Anyhow, you may run into problems, if the version of | ||
156 | your boot kernel is not the same than the source kernel version, from which | ||
157 | you create the modules. So rebuild your kernel, if necessary. | ||
158 | |||
159 | Now edit the base address of your AZTECH interface card in | ||
160 | /usr/src/linux/drivers/cdrom/aztcd.h to the appropriate value. | ||
161 | aztcd may be configured to use autoprobing the base address by setting | ||
162 | AZT_BASE_ADDR to '-1'. In that case aztcd probes the addresses listed | ||
163 | under AZT_BASE_AUTO. But please remember, that autoprobing always may | ||
164 | incorrectly influence other hardware components too! | ||
165 | There are also some special features which may be configured, e.g. | ||
166 | auto-eject a CD when unmounting the drive etc; see aztcd.h for details. | ||
167 | Then change to /usr/src/linux and do a | ||
168 | make modules | ||
169 | make modules_install | ||
170 | After that you can run-time load the driver via | ||
171 | insmod /lib/modules/X.X.X/misc/aztcd.o | ||
172 | and remove it via rmmod aztcd. | ||
173 | If you did not set the correct base address in aztcd.h, you can also supply the | ||
174 | base address when loading the driver via | ||
175 | insmod /lib/modules/X.X.X/misc/aztcd.o aztcd=<base address> | ||
176 | Again specifying aztcd=-1 will cause autoprobing. | ||
177 | If you do not have the iso9660-filesystem in your boot kernel, you also have | ||
178 | to load it before you can mount the CDROM: | ||
179 | insmod /lib/modules/X.X.X/fs/isofs.o | ||
180 | The mount procedure works as described in 4. above. | ||
181 | (In all commands 'X.X.X' is the current linux kernel version number) | ||
182 | |||
183 | 4.2 CDROM CONNECTED TO A SOUNDCARD | ||
184 | Most soundcards do have a bus interface to the CDROM-drive. In many cases | ||
185 | this soundcard needs to be configured, before the CDROM can be used. This | ||
186 | configuration procedure consists of writing some kind of initialization | ||
187 | data to the soundcard registers. The AZTECH-CDROM driver in the moment does | ||
188 | only support one type of soundcard (SoundWave32). Users of other soundcards | ||
189 | should try to boot DOS first and let their DOS drivers initialize the | ||
190 | soundcard and CDROM, then warm boot (or use loadlin) their PC to start | ||
191 | Linux. | ||
192 | Support for the CDROM-interface of SoundWave32-soundcards is directly | ||
193 | implemented in the AZTECH driver. Please edit linux/drivers/cdrom/aztdc.h, | ||
194 | uncomment line '#define AZT_SW32' and set the appropriate value for | ||
195 | AZT_BASE_ADDR and AZT_SW32_BASE_ADDR. This support was tested with an Orchid | ||
196 | CDS-3110 connected to a SoundWave32. | ||
197 | If you want your soundcard to be supported, find out, how it needs to be | ||
198 | configured and mail me (see 6.) the appropriate information. | ||
199 | |||
200 | 5. KNOWN PROBLEMS, FUTURE DEVELOPMENTS | ||
201 | 5.1 MULTISESSION SUPPORT | ||
202 | Multisession support for CD's still is a myth. I implemented and tested a basic | ||
203 | support for multisession and XA CDs, but I still have not enough CDs and appli- | ||
204 | cations to test it rigorously. So if you'd like to help me, please contact me | ||
205 | (Email address see below). As of version 1.4 and newer you can enable the | ||
206 | multisession support in aztcd.h by setting AZT_MULTISESSION to 1. Doing so | ||
207 | will cause the ISO9660-filesystem to deal with multisession CDs, ie. redirect | ||
208 | requests to the Table of Contents (TOC) information from the last session, | ||
209 | which contains the info of all previous sessions etc.. If you do set | ||
210 | AZT_MULTISESSION to 0, you can use multisession CDs anyway. In that case the | ||
211 | drive's firmware will do automatic redirection. For the ISO9660-filesystem any | ||
212 | multisession CD will then look like a 'normal' single session CD. But never- | ||
213 | theless the data of all sessions are viewable and accessible. So with practical- | ||
214 | ly all real world applications you won't notice the difference. But as future | ||
215 | applications may make use of advanced multisession features, I've started to | ||
216 | implement the interface for the ISO9660 multisession interface via ioctl | ||
217 | CDROMMULTISESSION. | ||
218 | |||
219 | 5.2 STATUS RECOGNITION | ||
220 | The drive status recognition does not work correctly in all cases. Changing | ||
221 | a disk or having the door open, when a drive is already mounted, is detected | ||
222 | by the Aztech driver itself, but nevertheless causes multiple read attempts | ||
223 | by the different layers of the ISO9660-filesystem driver, which finally timeout, | ||
224 | so you have to wait quite a little... But isn't it bad style to change a disk | ||
225 | in a mounted drive, anyhow ?! | ||
226 | |||
227 | The driver uses busy wait in most cases for the drive handshake (macros | ||
228 | STEN_LOW and DTEN_LOW). I tested with a 486/DX2 at 66MHz and a Pentium at | ||
229 | 60MHz and 90MHz. Whenever you use a much faster machine you are likely to get | ||
230 | timeout messages. In that case edit aztcd.h and increase the timeout value | ||
231 | AZT_TIMEOUT. | ||
232 | |||
233 | For some 'slow' drive commands I implemented waiting with a timer waitqueue | ||
234 | (macro STEN_LOW_WAIT). If you get this timeout message, you may also edit | ||
235 | aztcd.h and increase the timeout value AZT_STATUS_DELAY. The waitqueue has | ||
236 | shown to be a little critical. If you get kernel panic messages, edit aztcd.c | ||
237 | and substitute STEN_LOW_WAIT by STEN_LOW. Busy waiting with STEN_LOW is more | ||
238 | stable, but also causes CPU overhead. | ||
239 | |||
240 | 5.3 DOSEMU's CD-ROM SUPPORT | ||
241 | With release 1.20 aztcd was modified to allow access to CD-ROMS when running | ||
242 | under dosemu-0.60.0 aztcd-versions before 1.20 are most likely to crash | ||
243 | Linux, when a CD-ROM is accessed under dosemu. This problem has partly been | ||
244 | fixed, but still when accessing a directory for the first time the system | ||
245 | might hang for some 30sec. So be patient, when using dosemu's CD-ROM support | ||
246 | in combination with aztcd :-) ! | ||
247 | This problem has now (July 1995) been fixed by a modification to dosemu's | ||
248 | CD-ROM driver. The new version came with dosemu-0.60.2, see dosemu's | ||
249 | README.CDROM. | ||
250 | |||
251 | 6. BUG REPORTS | ||
252 | Please send detailed bug reports and bug fixes via EMail to | ||
253 | |||
254 | Werner.Zimmermann@fht-esslingen.de | ||
255 | |||
256 | Please include a description of your CD-ROM drive type and interface card, | ||
257 | the exact firmware message during Linux bootup, the version number of the | ||
258 | AZTECH-CDROM-driver and the Linux kernel version. Also a description of your | ||
259 | system's other hardware could be of interest, especially microprocessor type, | ||
260 | clock frequency, other interface cards such as soundcards, ethernet adapter, | ||
261 | game cards etc.. | ||
262 | |||
263 | I will try to collect the reports and make the necessary modifications from | ||
264 | time to time. I may also come back to you directly with some bug fixes and | ||
265 | ask you to do further testing and debugging. | ||
266 | |||
267 | Editors of CD-ROMs are invited to send a 'cooperation' copy of their | ||
268 | CD-ROMs to the volunteers, who provided the CD-ROM support for Linux. My | ||
269 | snail mail address for such 'stuff' is | ||
270 | Prof. Dr. W. Zimmermann | ||
271 | Fachhochschule fuer Technik Esslingen | ||
272 | Fachbereich IT | ||
273 | Flandernstrasse 101 | ||
274 | D-73732 Esslingen | ||
275 | Germany | ||
276 | |||
277 | |||
278 | 7. OTHER DRIVES | ||
279 | The following drives ORCHID CDS3110, OKANO CDD110, WEARNES CDD110 and Conrad | ||
280 | TXC Nr. 993123-series 04 nearly look the same as AZTECH CDA268-01A, especially | ||
281 | they seem to use the same command codes. So it was quite simple to make the | ||
282 | AZTECH driver work with these drives. | ||
283 | |||
284 | Unfortunately I do not have any of these drives available, so I couldn't test | ||
285 | it myself. In some installations, it seems necessary to initialize the drive | ||
286 | with the DOS driver before (especially if combined with a sound card) and then | ||
287 | do a warm boot (CTRL-ALT-RESET) or start Linux from DOS, e.g. with 'loadlin'. | ||
288 | |||
289 | If you do not succeed, read chapter DEBUGGING. Thanks in advance! | ||
290 | |||
291 | Sorry for the inconvenience, but it is difficult to develop for hardware, | ||
292 | which you don't have available for testing. So if you like, please help us. | ||
293 | |||
294 | If you do have a CyCDROM CR520ie thanks to Hilmar Berger's help your chances | ||
295 | are good, that it will work with aztcd. The CR520ie is sold as an IDE-drive | ||
296 | and really is connected to the IDE interface (primary at 0x1F0 or secondary | ||
297 | at 0x170, configured as slave, not as master). Nevertheless it is not ATAPI | ||
298 | compatible but still uses Aztech's command codes. | ||
299 | |||
300 | |||
301 | 8. DEBUGGING : IF YOU DON'T SUCCEED, TRY THE FOLLOWING | ||
302 | -reread the complete README file | ||
303 | -make sure, that your drive is hardware configured for | ||
304 | transfer mode: polled | ||
305 | IRQ: not used | ||
306 | DMA: not used | ||
307 | Base Address: something like 300, 320 ... | ||
308 | You can check this, when you start the DOS driver, which came with your | ||
309 | drive. By appropriately configuring the drive and the DOS driver you can | ||
310 | check, whether your drive does operate in this mode correctly under DOS. If | ||
311 | it does not operate under DOS, it won't under Linux. | ||
312 | If your drive's base address is something like 0x170 or 0x1F0 (and it is | ||
313 | not a CyCDROM CR520ie or CR 940ie) you most likely are having an IDE/ATAPI- | ||
314 | compatible drive, which is not supported by aztcd.c, use ide-cd.c instead. | ||
315 | Make sure the Base Address is configured correctly in aztcd.h, also make | ||
316 | sure, that /dev/aztcd0 exists with the correct major number (compare it with | ||
317 | the entry in file /usr/include/linux/major.h for the Aztech drive). | ||
318 | -insert a CD-ROM and close the tray | ||
319 | -cold boot your PC (i.e. via the power on switch or the reset button) | ||
320 | -if you start Linux via DOS, e.g. using loadlin, make sure, that the DOS | ||
321 | driver for the CD-ROM drive is not loaded (comment out the calling lines | ||
322 | in DOS' config.sys!) | ||
323 | -look for the aztcd: init message during Linux init and note them exactly | ||
324 | -log in as root and do a mount -t iso9660 /dev/aztcd0 /mnt | ||
325 | -if you don't succeed in the first time, try several times. Try also to open | ||
326 | and close the tray, then mount again. Please note carefully all commands | ||
327 | you typed in and the aztcd-messages, which you get. | ||
328 | -if you get an 'Aztech CD-ROM init: aborted' message, read the remarks about | ||
329 | the version string below. | ||
330 | |||
331 | If this does not help, do the same with the following differences | ||
332 | -start DOS before; make now sure, that the DOS driver for the CD-ROM is | ||
333 | loaded under DOS (i.e. uncomment it again in config.sys) | ||
334 | -warm boot your PC (i.e. via CTRL-ALT-DEL) | ||
335 | if you have it, you can also start via loadlin (try both). | ||
336 | ... | ||
337 | Again note all commands and the aztcd-messages. | ||
338 | |||
339 | If you see STEN_LOW or STEN_LOW_WAIT error messages, increase the timeout | ||
340 | values. | ||
341 | |||
342 | If this still does not help, | ||
343 | -look in aztcd.c for the lines #if 0 | ||
344 | #define AZT_TEST1 | ||
345 | ... | ||
346 | #endif | ||
347 | and substitute '#if 0' by '#if 1'. | ||
348 | -recompile your kernel and repeat the above two procedures. You will now get | ||
349 | a bundle of debugging messages from the driver. Again note your commands | ||
350 | and the appropriate messages. If you have syslogd running, these messages | ||
351 | may also be found in syslogd's kernel log file. Nevertheless in some | ||
352 | installations syslogd does not yet run, when init() is called, thus look for | ||
353 | the aztcd-messages during init, before the login-prompt appears. | ||
354 | Then look in aztcd.c, to find out, what happened. The normal calling sequence | ||
355 | is: aztcd_init() during Linux bootup procedure init() | ||
356 | after doing a 'mount -t iso9660 /dev/aztcd0 /mnt' the normal calling sequence is | ||
357 | aztcd_open() -> Status 2c after cold reboot with CDROM or audio CD inserted | ||
358 | -> Status 8 after warm reboot with CDROM inserted | ||
359 | -> Status 2e after cold reboot with no disk, closed tray | ||
360 | -> Status 6e after cold reboot, mount with door open | ||
361 | aztUpdateToc() | ||
362 | aztGetDiskInfo() | ||
363 | aztGetQChannelInfo() repeated several times | ||
364 | aztGetToc() | ||
365 | aztGetQChannelInfo() repeated several times | ||
366 | a list of track information | ||
367 | do_aztcd_request() } | ||
368 | azt_transfer() } repeated several times | ||
369 | azt_poll } | ||
370 | Check, if there is a difference in the calling sequence or the status flags! | ||
371 | |||
372 | There are a lot of other messages, eg. the ACMD-command code (defined in | ||
373 | aztcd.h), status info from the getAztStatus-command and the state sequence of | ||
374 | the finite state machine in azt_poll(). The most important are the status | ||
375 | messages, look how they are defined and try to understand, if they make | ||
376 | sense in the context where they appear. With a CD-ROM inserted the status | ||
377 | should always be 8, except in aztcd_open(). Try to open the tray, insert an | ||
378 | audio disk, insert no disk or reinsert the CD-ROM and check, if the status | ||
379 | bits change accordingly. The status bits are the most likely point, where | ||
380 | the drive manufacturers may implement changes. | ||
381 | |||
382 | If you still don't succeed, a good point to start is to look in aztcd.c in | ||
383 | function aztcd_init, where the drive should be detected during init. Do the | ||
384 | following: | ||
385 | -reboot the system with boot parameter 'aztcd=<your base address>,0x79'. With | ||
386 | parameter 0x79 most of the drive version detection is bypassed. After that | ||
387 | you should see the complete version string including leading and trailing | ||
388 | blanks during init. | ||
389 | Now adapt the statement | ||
390 | if ((result[1]=='A')&&(result[2]=='Z' ...) | ||
391 | in aztcd_init() to exactly match the first 3 or 4 letters you have seen. | ||
392 | -Another point is the 'smart' card detection feature in aztcd_init(). Normally | ||
393 | the CD-ROM drive is ready, when aztcd_init is trying to read the version | ||
394 | string and a time consuming ACMD_SOFT_RESET command can be avoided. This is | ||
395 | detected by looking, if AFL_OP_OK can be read correctly. If the CD-ROM drive | ||
396 | hangs in some unknown state, e.g. because of an error before a warm start or | ||
397 | because you first operated under DOS, even the version string may be correct, | ||
398 | but the following commands will not. Then change the code in such a way, | ||
399 | that the ACMD_SOFT_RESET is issued in any case, by substituting the | ||
400 | if-statement 'if ( ...=AFL_OP_OK)' by 'if (1)'. | ||
401 | |||
402 | If you succeed, please mail me the exact version string of your drive and | ||
403 | the code modifications, you have made together with a short explanation. | ||
404 | If you don't succeed, you may mail me the output of the debugging messages. | ||
405 | But remember, they are only useful, if they are exact and complete and you | ||
406 | describe in detail your hardware setup and what you did (cold/warm reboot, | ||
407 | with/without DOS, DOS-driver started/not started, which Linux-commands etc.) | ||
408 | |||
409 | |||
410 | 9. TECHNICAL HISTORY OF THE DRIVER | ||
411 | The AZTECH-Driver is a rework of the Mitsumi-Driver. Four major items had to | ||
412 | be reworked: | ||
413 | |||
414 | a) The Mitsumi drive does issue complete status information acknowledging | ||
415 | each command, the Aztech drive does only signal that the command was | ||
416 | processed. So whenever the complete status information is needed, an extra | ||
417 | ACMD_GET_STATUS command is issued. The handshake procedure for the drive | ||
418 | can be found in the functions aztSendCmd(), sendAztCmd() and getAztStatus(). | ||
419 | |||
420 | b) The Aztech Drive does not have a ACMD_GET_DISK_INFO command, so the | ||
421 | necessary info about the number of tracks (firstTrack, lastTrack), disk | ||
422 | length etc. has to be read from the TOC in the lead in track (see function | ||
423 | aztGetDiskInfo()). | ||
424 | |||
425 | c) Whenever data is read from the drive, the Mitsumi drive is started with a | ||
426 | command to read an indefinite (0xffffff) number of sectors. When the appropriate | ||
427 | number of sectors is read, the drive is stopped by a ACDM_STOP command. This | ||
428 | does not work with the Aztech drive. I did not find a way to stop it. The | ||
429 | stop and pause commands do only work in AUDIO mode but not in DATA mode. | ||
430 | Therefore I had to modify the 'finite state machine' in function azt_poll to | ||
431 | only read a certain number of sectors and then start a new read on demand. As I | ||
432 | have not completely understood, how the buffer/caching scheme of the Mitsumi | ||
433 | driver was implemented, I am not sure, if I have covered all cases correctly, | ||
434 | whenever you get timeout messages, the bug is most likely to be in that | ||
435 | function azt_poll() around switch(cmd) .... case ACD_S_DATA. | ||
436 | |||
437 | d) I did not get information about changing drive mode. So I doubt, that the | ||
438 | code around function azt_poll() case AZT_S_MODE does work. In my test I have | ||
439 | not been able to switch to reading in raw mode. For reading raw mode, Aztech | ||
440 | uses a different command than for cooked mode, which I only have implemen- | ||
441 | ted in the ioctl-section but not in the section which is used by the ISO9660. | ||
442 | |||
443 | The driver was developed on an AST PC with Intel 486/DX2, 8MB RAM, 340MB IDE | ||
444 | hard disk and on an AST PC with Intel Pentium 60MHz, 16MB RAM, 520MB IDE | ||
445 | running Linux kernel version 1.0.9 from the LST 1.8 Distribution. The kernel | ||
446 | was compiled with gcc.2.5.8. My CD-ROM drive is an Aztech CDA268-01A. My | ||
447 | drive says, that it has Firmware Version AZT26801A1.3. It came with an ISA-bus | ||
448 | interface card and works with polled I/O without DMA and without interrupts. | ||
449 | The code for all other drives was 'remote' tested and debugged by a number of | ||
450 | volunteers on the Internet. | ||
451 | |||
452 | Points, where I feel that possible problems might be and all points where I | ||
453 | did not completely understand the drive's behaviour or trust my own code are | ||
454 | marked with /*???*/ in the source code. There are also some parts in the | ||
455 | Mitsumi driver, where I did not completely understand their code. | ||
456 | |||
457 | |||
458 | 10. ACKNOWLEDGMENTS | ||
459 | Without the help of P.Bush, Aztech, who delivered technical information | ||
460 | about the Aztech Drive and without the help of E.Moenkeberg, GWDG, who did a | ||
461 | great job in analyzing the command structure of various CD-ROM drives, this | ||
462 | work would not have been possible. E.Moenkeberg was also a great help in | ||
463 | making the software 'kernel ready' and in answering many of the CDROM-related | ||
464 | questions in the newsgroups. He really is *the* Linux CD-ROM guru. Thanks | ||
465 | also to all the guys on the Internet, who collected valuable technical | ||
466 | information about CDROMs. | ||
467 | |||
468 | Joe Nardone (joe@access.digex.net) was a patient tester even for my first | ||
469 | trial, which was more than slow, and made suggestions for code improvement. | ||
470 | Especially the 'finite state machine' azt_poll() was rewritten by Joe to get | ||
471 | clean C code and avoid the ugly 'gotos', which I copied from mcd.c. | ||
472 | |||
473 | Robby Schirmer (schirmer@fmi.uni-passau.de) tested the audio stuff (ioctls) | ||
474 | and suggested a lot of patches for them. | ||
475 | |||
476 | Joseph Piskor and Peter Nugent were the first users with the ORCHID CD3110 | ||
477 | and also were very patient with the problems which occurred. | ||
478 | |||
479 | Reinhard Max delivered the information for the CDROM-interface of the | ||
480 | SoundWave32 soundcards. | ||
481 | |||
482 | Jochen Kunz and Olaf Kaluza delivered the information for supporting Conrad's | ||
483 | TXC drive. | ||
484 | |||
485 | Hilmar Berger delivered the patches for supporting CyCDROM CR520ie. | ||
486 | |||
487 | Anybody, who is interested in these items should have a look at 'ftp.gwdg.de', | ||
488 | directory 'pub/linux/cdrom' and at 'ftp.cdrom.com', directory 'pub/cdrom'. | ||
489 | |||
490 | 11. PROGRAMMING ADD ONs: cdplay.c | ||
491 | You can use the ioctl-functions included in aztcd.c in your own programs. As | ||
492 | an example on how to do this, you will find a tiny CD Player for audio CDs | ||
493 | named 'cdplay.c'. It allows you to play audio CDs. You can play a specified | ||
494 | track, pause and resume or skip tracks forward and backwards. If you quit the | ||
495 | program without stopping the drive, playing is continued. You can also | ||
496 | (mis)use cdplay to read and hexdump data disks. You can find the code in the | ||
497 | APPENDIX of this file, which you should cut out with an editor and store in a | ||
498 | separate file 'cdplay.c'. To compile it and make it executable, do | ||
499 | gcc -s -Wall -O2 -L/usr/lib cdplay.c -o /usr/local/bin/cdplay # compiles it | ||
500 | chmod +755 /usr/local/bin/cdplay # makes it executable | ||
501 | ln -s /dev/aztcd0 /dev/cdrom # creates a link | ||
502 | (for /usr/lib substitute the top level directory, where your include files | ||
503 | reside, and for /usr/local/bin the directory, where you want the executable | ||
504 | binary to reside ) | ||
505 | |||
506 | You have to set the correct permissions for cdplay *and* for /dev/mcd0 or | ||
507 | /dev/aztcd0 in order to use it. Remember, that you should not have /dev/cdrom | ||
508 | mounted, when you're playing audio CDs. | ||
509 | |||
510 | This program is just a hack for testing the ioctl-functions in aztcd.c. I will | ||
511 | not maintain it, so if you run into problems, discard it or have a look into | ||
512 | the source code 'cdplay.c'. The program does only contain a minimum of user | ||
513 | protection and input error detection. If you use the commands in the wrong | ||
514 | order or if you try to read a CD at wrong addresses, you may get error messages | ||
515 | or even hang your machine. If you get STEN_LOW, STEN_LOW_WAIT or segment violation | ||
516 | error messages when using cdplay, after that, the system might not be stable | ||
517 | any more, so you'd better reboot. As the ioctl-functions run in kernel mode, | ||
518 | most normal Linux-multitasking protection features do not work. By using | ||
519 | uninitialized 'wild' pointers etc., it is easy to write to other users' data | ||
520 | and program areas, destroy kernel tables etc.. So if you experiment with ioctls | ||
521 | as always when you are doing systems programming and kernel hacking, you | ||
522 | should have a backup copy of your system in a safe place (and you also | ||
523 | should try restoring from a backup copy first)! | ||
524 | |||
525 | A reworked and improved version called 'cdtester.c', which has yet more | ||
526 | features for testing CDROM-drives can be found in | ||
527 | Documentation/cdrom/sbpcd, written by E.Moenkeberg. | ||
528 | |||
529 | Werner Zimmermann | ||
530 | Fachhochschule fuer Technik Esslingen | ||
531 | (EMail: Werner.Zimmermann@fht-esslingen.de) | ||
532 | October, 1997 | ||
533 | |||
534 | --------------------------------------------------------------------------- | ||
535 | APPENDIX: Source code of cdplay.c | ||
536 | |||
537 | /* Tiny Audio CD Player | ||
538 | |||
539 | Copyright 1994, 1995, 1996 Werner Zimmermann (Werner.Zimmermann@fht-esslingen.de) | ||
540 | |||
541 | This program originally was written to test the audio functions of the | ||
542 | AZTECH.CDROM-driver, but it should work with every CD-ROM drive. Before | ||
543 | using it, you should set a symlink from /dev/cdrom to your real CDROM | ||
544 | device. | ||
545 | |||
546 | The GNU General Public License applies to this program. | ||
547 | |||
548 | History: V0.1 W.Zimmermann: First release. Nov. 8, 1994 | ||
549 | V0.2 W.Zimmermann: Enhanced functionality. Nov. 9, 1994 | ||
550 | V0.3 W.Zimmermann: Additional functions. Nov. 28, 1994 | ||
551 | V0.4 W.Zimmermann: fixed some bugs. Dec. 17, 1994 | ||
552 | V0.5 W.Zimmermann: clean 'scanf' commands without compiler warnings | ||
553 | Jan. 6, 1995 | ||
554 | V0.6 W.Zimmermann: volume control (still experimental). Jan. 24, 1995 | ||
555 | V0.7 W.Zimmermann: read raw modified. July 26, 95 | ||
556 | */ | ||
557 | |||
558 | #include <stdio.h> | ||
559 | #include <ctype.h> | ||
560 | #include <sys/ioctl.h> | ||
561 | #include <sys/types.h> | ||
562 | #include <fcntl.h> | ||
563 | #include <unistd.h> | ||
564 | #include <linux/cdrom.h> | ||
565 | #include <linux/../../drivers/cdrom/aztcd.h> | ||
566 | |||
567 | void help(void) | ||
568 | { printf("Available Commands: STOP s EJECT/CLOSE e QUIT q\n"); | ||
569 | printf(" PLAY TRACK t PAUSE p RESUME r\n"); | ||
570 | printf(" NEXT TRACK n REPEAT LAST l HELP h\n"); | ||
571 | printf(" SUB CHANNEL c TRACK INFO i PLAY AT a\n"); | ||
572 | printf(" READ d READ RAW w VOLUME v\n"); | ||
573 | } | ||
574 | |||
575 | int main(void) | ||
576 | { int handle; | ||
577 | unsigned char command=' ', ini=0, first=1, last=1; | ||
578 | unsigned int cmd, i,j,k, arg1,arg2,arg3; | ||
579 | struct cdrom_ti ti; | ||
580 | struct cdrom_tochdr tocHdr; | ||
581 | struct cdrom_subchnl subchnl; | ||
582 | struct cdrom_tocentry entry; | ||
583 | struct cdrom_msf msf; | ||
584 | union { struct cdrom_msf msf; | ||
585 | unsigned char buf[CD_FRAMESIZE_RAW]; | ||
586 | } azt; | ||
587 | struct cdrom_volctrl volctrl; | ||
588 | |||
589 | printf("\nMini-Audio CD-Player V0.72 (C) 1994,1995,1996 W.Zimmermann\n"); | ||
590 | handle=open("/dev/cdrom",O_RDWR); | ||
591 | ioctl(handle,CDROMRESUME); | ||
592 | |||
593 | if (handle<=0) | ||
594 | { printf("Drive Error: already playing, no audio disk, door open\n"); | ||
595 | printf(" or no permission (you must be ROOT in order to use this program)\n"); | ||
596 | } | ||
597 | else | ||
598 | { help(); | ||
599 | while (1) | ||
600 | { printf("Type command (h = help): "); | ||
601 | scanf("%s",&command); | ||
602 | switch (command) | ||
603 | { case 'e': cmd=CDROMEJECT; | ||
604 | ioctl(handle,cmd); | ||
605 | break; | ||
606 | case 'p': if (!ini) | ||
607 | { printf("Command not allowed - play track first\n"); | ||
608 | } | ||
609 | else | ||
610 | { cmd=CDROMPAUSE; | ||
611 | if (ioctl(handle,cmd)) printf("Drive Error\n"); | ||
612 | } | ||
613 | break; | ||
614 | case 'r': if (!ini) | ||
615 | { printf("Command not allowed - play track first\n"); | ||
616 | } | ||
617 | else | ||
618 | { cmd=CDROMRESUME; | ||
619 | if (ioctl(handle,cmd)) printf("Drive Error\n"); | ||
620 | } | ||
621 | break; | ||
622 | case 's': cmd=CDROMPAUSE; | ||
623 | if (ioctl(handle,cmd)) printf("Drive error or already stopped\n"); | ||
624 | cmd=CDROMSTOP; | ||
625 | if (ioctl(handle,cmd)) printf("Drive error\n"); | ||
626 | break; | ||
627 | case 't': cmd=CDROMREADTOCHDR; | ||
628 | if (ioctl(handle,cmd,&tocHdr)) printf("Drive Error\n"); | ||
629 | first=tocHdr.cdth_trk0; | ||
630 | last= tocHdr.cdth_trk1; | ||
631 | if ((first==0)||(first>last)) | ||
632 | { printf ("--could not read TOC\n"); | ||
633 | } | ||
634 | else | ||
635 | { printf("--first track: %d --last track: %d --enter track number: ",first,last); | ||
636 | cmd=CDROMPLAYTRKIND; | ||
637 | scanf("%i",&arg1); | ||
638 | ti.cdti_trk0=arg1; | ||
639 | if (ti.cdti_trk0<first) ti.cdti_trk0=first; | ||
640 | if (ti.cdti_trk0>last) ti.cdti_trk0=last; | ||
641 | ti.cdti_ind0=0; | ||
642 | ti.cdti_trk1=last; | ||
643 | ti.cdti_ind1=0; | ||
644 | if (ioctl(handle,cmd,&ti)) printf("Drive Error\n"); | ||
645 | ini=1; | ||
646 | } | ||
647 | break; | ||
648 | case 'n': if (!ini++) | ||
649 | { if (ioctl(handle,CDROMREADTOCHDR,&tocHdr)) printf("Drive Error\n"); | ||
650 | first=tocHdr.cdth_trk0; | ||
651 | last= tocHdr.cdth_trk1; | ||
652 | ti.cdti_trk0=first-1; | ||
653 | } | ||
654 | if ((first==0)||(first>last)) | ||
655 | { printf ("--could not read TOC\n"); | ||
656 | } | ||
657 | else | ||
658 | { cmd=CDROMPLAYTRKIND; | ||
659 | if (++ti.cdti_trk0 > last) ti.cdti_trk0=last; | ||
660 | ti.cdti_ind0=0; | ||
661 | ti.cdti_trk1=last; | ||
662 | ti.cdti_ind1=0; | ||
663 | if (ioctl(handle,cmd,&ti)) printf("Drive Error\n"); | ||
664 | ini=1; | ||
665 | } | ||
666 | break; | ||
667 | case 'l': if (!ini++) | ||
668 | { if (ioctl(handle,CDROMREADTOCHDR,&tocHdr)) printf("Drive Error\n"); | ||
669 | first=tocHdr.cdth_trk0; | ||
670 | last= tocHdr.cdth_trk1; | ||
671 | ti.cdti_trk0=first+1; | ||
672 | } | ||
673 | if ((first==0)||(first>last)) | ||
674 | { printf ("--could not read TOC\n"); | ||
675 | } | ||
676 | else | ||
677 | { cmd=CDROMPLAYTRKIND; | ||
678 | if (--ti.cdti_trk0 < first) ti.cdti_trk0=first; | ||
679 | ti.cdti_ind0=0; | ||
680 | ti.cdti_trk1=last; | ||
681 | ti.cdti_ind1=0; | ||
682 | if (ioctl(handle,cmd,&ti)) printf("Drive Error\n"); | ||
683 | ini=1; | ||
684 | } | ||
685 | break; | ||
686 | case 'c': subchnl.cdsc_format=CDROM_MSF; | ||
687 | if (ioctl(handle,CDROMSUBCHNL,&subchnl)) | ||
688 | printf("Drive Error\n"); | ||
689 | else | ||
690 | { printf("AudioStatus:%s Track:%d Mode:%d MSF=%d:%d:%d\n", \ | ||
691 | subchnl.cdsc_audiostatus==CDROM_AUDIO_PLAY ? "PLAYING":"NOT PLAYING",\ | ||
692 | subchnl.cdsc_trk,subchnl.cdsc_adr, \ | ||
693 | subchnl.cdsc_absaddr.msf.minute, subchnl.cdsc_absaddr.msf.second, \ | ||
694 | subchnl.cdsc_absaddr.msf.frame); | ||
695 | } | ||
696 | break; | ||
697 | case 'i': if (!ini) | ||
698 | { printf("Command not allowed - play track first\n"); | ||
699 | } | ||
700 | else | ||
701 | { cmd=CDROMREADTOCENTRY; | ||
702 | printf("Track No.: "); | ||
703 | scanf("%d",&arg1); | ||
704 | entry.cdte_track=arg1; | ||
705 | if (entry.cdte_track<first) entry.cdte_track=first; | ||
706 | if (entry.cdte_track>last) entry.cdte_track=last; | ||
707 | entry.cdte_format=CDROM_MSF; | ||
708 | if (ioctl(handle,cmd,&entry)) | ||
709 | { printf("Drive error or invalid track no.\n"); | ||
710 | } | ||
711 | else | ||
712 | { printf("Mode %d Track, starts at %d:%d:%d\n", \ | ||
713 | entry.cdte_adr,entry.cdte_addr.msf.minute, \ | ||
714 | entry.cdte_addr.msf.second,entry.cdte_addr.msf.frame); | ||
715 | } | ||
716 | } | ||
717 | break; | ||
718 | case 'a': cmd=CDROMPLAYMSF; | ||
719 | printf("Address (min:sec:frame) "); | ||
720 | scanf("%d:%d:%d",&arg1,&arg2,&arg3); | ||
721 | msf.cdmsf_min0 =arg1; | ||
722 | msf.cdmsf_sec0 =arg2; | ||
723 | msf.cdmsf_frame0=arg3; | ||
724 | if (msf.cdmsf_sec0 > 59) msf.cdmsf_sec0 =59; | ||
725 | if (msf.cdmsf_frame0> 74) msf.cdmsf_frame0=74; | ||
726 | msf.cdmsf_min1=60; | ||
727 | msf.cdmsf_sec1=00; | ||
728 | msf.cdmsf_frame1=00; | ||
729 | if (ioctl(handle,cmd,&msf)) | ||
730 | { printf("Drive error or invalid address\n"); | ||
731 | } | ||
732 | break; | ||
733 | #ifdef AZT_PRIVATE_IOCTLS /*not supported by every CDROM driver*/ | ||
734 | case 'd': cmd=CDROMREADCOOKED; | ||
735 | printf("Address (min:sec:frame) "); | ||
736 | scanf("%d:%d:%d",&arg1,&arg2,&arg3); | ||
737 | azt.msf.cdmsf_min0 =arg1; | ||
738 | azt.msf.cdmsf_sec0 =arg2; | ||
739 | azt.msf.cdmsf_frame0=arg3; | ||
740 | if (azt.msf.cdmsf_sec0 > 59) azt.msf.cdmsf_sec0 =59; | ||
741 | if (azt.msf.cdmsf_frame0> 74) azt.msf.cdmsf_frame0=74; | ||
742 | if (ioctl(handle,cmd,&azt.msf)) | ||
743 | { printf("Drive error, invalid address or unsupported command\n"); | ||
744 | } | ||
745 | k=0; | ||
746 | getchar(); | ||
747 | for (i=0;i<128;i++) | ||
748 | { printf("%4d:",i*16); | ||
749 | for (j=0;j<16;j++) | ||
750 | { printf("%2x ",azt.buf[i*16+j]); | ||
751 | } | ||
752 | for (j=0;j<16;j++) | ||
753 | { if (isalnum(azt.buf[i*16+j])) | ||
754 | printf("%c",azt.buf[i*16+j]); | ||
755 | else | ||
756 | printf("."); | ||
757 | } | ||
758 | printf("\n"); | ||
759 | k++; | ||
760 | if (k>=20) | ||
761 | { printf("press ENTER to continue\n"); | ||
762 | getchar(); | ||
763 | k=0; | ||
764 | } | ||
765 | } | ||
766 | break; | ||
767 | case 'w': cmd=CDROMREADRAW; | ||
768 | printf("Address (min:sec:frame) "); | ||
769 | scanf("%d:%d:%d",&arg1,&arg2,&arg3); | ||
770 | azt.msf.cdmsf_min0 =arg1; | ||
771 | azt.msf.cdmsf_sec0 =arg2; | ||
772 | azt.msf.cdmsf_frame0=arg3; | ||
773 | if (azt.msf.cdmsf_sec0 > 59) azt.msf.cdmsf_sec0 =59; | ||
774 | if (azt.msf.cdmsf_frame0> 74) azt.msf.cdmsf_frame0=74; | ||
775 | if (ioctl(handle,cmd,&azt)) | ||
776 | { printf("Drive error, invalid address or unsupported command\n"); | ||
777 | } | ||
778 | k=0; | ||
779 | for (i=0;i<147;i++) | ||
780 | { printf("%4d:",i*16); | ||
781 | for (j=0;j<16;j++) | ||
782 | { printf("%2x ",azt.buf[i*16+j]); | ||
783 | } | ||
784 | for (j=0;j<16;j++) | ||
785 | { if (isalnum(azt.buf[i*16+j])) | ||
786 | printf("%c",azt.buf[i*16+j]); | ||
787 | else | ||
788 | printf("."); | ||
789 | } | ||
790 | printf("\n"); | ||
791 | k++; | ||
792 | if (k>=20) | ||
793 | { getchar(); | ||
794 | k=0; | ||
795 | } | ||
796 | } | ||
797 | break; | ||
798 | #endif | ||
799 | case 'v': cmd=CDROMVOLCTRL; | ||
800 | printf("--Channel 0 Left (0-255): "); | ||
801 | scanf("%d",&arg1); | ||
802 | printf("--Channel 1 Right (0-255): "); | ||
803 | scanf("%d",&arg2); | ||
804 | volctrl.channel0=arg1; | ||
805 | volctrl.channel1=arg2; | ||
806 | volctrl.channel2=0; | ||
807 | volctrl.channel3=0; | ||
808 | if (ioctl(handle,cmd,&volctrl)) | ||
809 | { printf("Drive error or unsupported command\n"); | ||
810 | } | ||
811 | break; | ||
812 | case 'q': if (close(handle)) printf("Drive Error: CLOSE\n"); | ||
813 | exit(0); | ||
814 | case 'h': help(); | ||
815 | break; | ||
816 | default: printf("unknown command\n"); | ||
817 | break; | ||
818 | } | ||
819 | } | ||
820 | } | ||
821 | return 0; | ||
822 | } | ||
diff --git a/Documentation/cdrom/cdu31a b/Documentation/cdrom/cdu31a deleted file mode 100644 index c0667da09c00..000000000000 --- a/Documentation/cdrom/cdu31a +++ /dev/null | |||
@@ -1,196 +0,0 @@ | |||
1 | |||
2 | CDU31A/CDU33A Driver Info | ||
3 | ------------------------- | ||
4 | |||
5 | Information on the Sony CDU31A/CDU33A CDROM driver for the Linux | ||
6 | kernel. | ||
7 | |||
8 | Corey Minyard (minyard@metronet.com) | ||
9 | |||
10 | Colossians 3:17 | ||
11 | |||
12 | Crude Table of Contents | ||
13 | ----------------------- | ||
14 | |||
15 | Setting Up the Hardware | ||
16 | Configuring the Kernel | ||
17 | Configuring as a Module | ||
18 | Driver Special Features | ||
19 | |||
20 | |||
21 | This device driver handles Sony CDU31A/CDU33A CDROM drives and | ||
22 | provides a complete block-level interface as well as an ioctl() | ||
23 | interface as specified in include/linux/cdrom.h). With this | ||
24 | interface, CDROMs can be accessed, standard audio CDs can be played | ||
25 | back normally, and CD audio information can be read off the drive. | ||
26 | |||
27 | Note that this will only work for CDU31A/CDU33A drives. Some vendors | ||
28 | market their drives as CDU31A compatible. They lie. Their drives are | ||
29 | really CDU31A hardware interface compatible (they can plug into the | ||
30 | same card). They are not software compatible. | ||
31 | |||
32 | Setting Up the Hardware | ||
33 | ----------------------- | ||
34 | |||
35 | The CDU31A driver is unable to safely tell if an interface card is | ||
36 | present that it can use because the interface card does not announce | ||
37 | its presence in any way besides placing 4 I/O locations in memory. It | ||
38 | used to just probe memory and attempt commands, but Linus wisely asked | ||
39 | me to remove that because it could really screw up other hardware in | ||
40 | the system. | ||
41 | |||
42 | Because of this, you must tell the kernel where the drive interface | ||
43 | is, what interrupts are used, and possibly if you are on a PAS-16 | ||
44 | soundcard. | ||
45 | |||
46 | If you have the Sony CDU31A/CDU33A drive interface card, the following | ||
47 | diagram will help you set it up. If you have another card, you are on | ||
48 | your own. You need to make sure that the I/O address and interrupt is | ||
49 | not used by another card in the system. You will need to know the I/O | ||
50 | address and interrupt you have set. Note that use of interrupts is | ||
51 | highly recommended, if possible, it really cuts down on CPU used. | ||
52 | Unfortunately, most soundcards do not support interrupts for their | ||
53 | CDROM interfaces. By default, the Sony interface card comes with | ||
54 | interrupts disabled. | ||
55 | |||
56 | +----------+-----------------+----------------------+ | ||
57 | | JP1 | 34 Pin Conn | | | ||
58 | | JP2 +-----------------+ | | ||
59 | | JP3 | | ||
60 | | JP4 | | ||
61 | | +--+ | ||
62 | | | +-+ | ||
63 | | | | | External | ||
64 | | | | | Connector | ||
65 | | | | | | ||
66 | | | +-+ | ||
67 | | +--+ | ||
68 | | | | ||
69 | | +--------+ | ||
70 | | | | ||
71 | +------------------------------------------+ | ||
72 | |||
73 | JP1 sets the Base Address, using the following settings: | ||
74 | |||
75 | Address Pin 1 Pin 2 | ||
76 | ------- ----- ----- | ||
77 | 0x320 Short Short | ||
78 | 0x330 Short Open | ||
79 | 0x340 Open Short | ||
80 | 0x360 Open Open | ||
81 | |||
82 | JP2 and JP3 configure the DMA channel; they must be set the same. | ||
83 | |||
84 | DMA Pin 1 Pin 2 Pin 3 | ||
85 | --- ----- ----- ----- | ||
86 | 1 On Off On | ||
87 | 2 Off On Off | ||
88 | 3 Off Off On | ||
89 | |||
90 | JP4 Configures the IRQ: | ||
91 | |||
92 | IRQ Pin 1 Pin 2 Pin 3 Pin 4 | ||
93 | --- ----- ----- ----- ----- | ||
94 | 3 Off Off On Off | ||
95 | 4 Off Off* Off On | ||
96 | 5 On Off Off Off | ||
97 | 6 Off On Off Off | ||
98 | |||
99 | The documentation states to set this for interrupt | ||
100 | 4, but I think that is a mistake. | ||
101 | |||
102 | Note that if you have another interface card, you will need to look at | ||
103 | the documentation to find the I/O base address. This is specified to | ||
104 | the SLCD.SYS driver for DOS with the /B: parameter, so you can look at | ||
105 | you DOS driver setup to find the address, if necessary. | ||
106 | |||
107 | Configuring the Kernel | ||
108 | ---------------------- | ||
109 | |||
110 | You must tell the kernel where the drive is at boot time. This can be | ||
111 | done at the Linux boot prompt, by using LILO, or by using Bootlin. | ||
112 | Note that this is no substitute for HOWTOs and LILO documentation, if | ||
113 | you are confused please read those for info on bootline configuration | ||
114 | and LILO. | ||
115 | |||
116 | At the linux boot prompt, press the ALT key and add the following line | ||
117 | after the boot name (you can let the kernel boot, it will tell you the | ||
118 | default boot name while booting): | ||
119 | |||
120 | cdu31a=<base address>,<interrupt>[,PAS] | ||
121 | |||
122 | The base address needs to have "0x" in front of it, since it is in | ||
123 | hex. For instance, to configure a drive at address 320 on interrupt 5, | ||
124 | use the following: | ||
125 | |||
126 | cdu31a=0x320,5 | ||
127 | |||
128 | I use the following boot line: | ||
129 | |||
130 | cdu31a=0x1f88,0,PAS | ||
131 | |||
132 | because I have a PAS-16 which does not support interrupt for the | ||
133 | CDU31A interface. | ||
134 | |||
135 | Adding this as an append line at the beginning of the /etc/lilo.conf | ||
136 | file will set it for lilo configurations. I have the following as the | ||
137 | first line in my lilo.conf file: | ||
138 | |||
139 | append="cdu31a=0x1f88,0" | ||
140 | |||
141 | I'm not sure how to set up Bootlin (I have never used it), if someone | ||
142 | would like to fill in this section please do. | ||
143 | |||
144 | |||
145 | Configuring as a Module | ||
146 | ----------------------- | ||
147 | |||
148 | The driver supports loading as a module. However, you must specify | ||
149 | the boot address and interrupt on the boot line to insmod. You can't | ||
150 | use modprobe to load it, since modprobe doesn't support setting | ||
151 | variables. | ||
152 | |||
153 | Anyway, I use the following line to load my driver as a module | ||
154 | |||
155 | /sbin/insmod /lib/modules/`uname -r`/misc/cdu31a.o cdu31a_port=0x1f88 | ||
156 | |||
157 | You can set the following variables in the driver: | ||
158 | |||
159 | cdu31a_port=<I/O address> - sets the base I/O. If hex, put 0x in | ||
160 | front of it. This must be specified. | ||
161 | |||
162 | cdu31a_irq=<interrupt> - Sets the interrupt number. Leaving this | ||
163 | off will turn interrupts off. | ||
164 | |||
165 | |||
166 | Driver Special Features | ||
167 | ----------------------- | ||
168 | |||
169 | This section describes features beyond the normal audio and CD-ROM | ||
170 | functions of the drive. | ||
171 | |||
172 | 2048 byte buffer mode | ||
173 | |||
174 | If a disk is mounted with -o block=2048, data is copied straight from | ||
175 | the drive data port to the buffer. Otherwise, the readahead buffer | ||
176 | must be involved to hold the other 1K of data when a 1K block | ||
177 | operation is done. Note that with 2048 byte blocks you cannot execute | ||
178 | files from the CD. | ||
179 | |||
180 | XA compatibility | ||
181 | |||
182 | The driver should support XA disks for both the CDU31A and CDU33A. It | ||
183 | does this transparently, the using program doesn't need to set it. | ||
184 | |||
185 | Multi-Session | ||
186 | |||
187 | A multi-session disk looks just like a normal disk to the user. Just | ||
188 | mount one normally, and all the data should be there. A special | ||
189 | thanks to Koen for help with this! | ||
190 | |||
191 | Raw sector I/O | ||
192 | |||
193 | Using the CDROMREADAUDIO it is possible to read raw audio and data | ||
194 | tracks. Both operations return 2352 bytes per sector. On the data | ||
195 | tracks, the first 12 bytes is not returned by the drive and the value | ||
196 | of that data is indeterminate. | ||
diff --git a/Documentation/cdrom/cm206 b/Documentation/cdrom/cm206 deleted file mode 100644 index 810368f4f7c4..000000000000 --- a/Documentation/cdrom/cm206 +++ /dev/null | |||
@@ -1,185 +0,0 @@ | |||
1 | This is the readme file for the driver for the Philips/LMS cdrom drive | ||
2 | cm206 in combination with the cm260 host adapter card. | ||
3 | |||
4 | (c) 1995 David A. van Leeuwen | ||
5 | |||
6 | Changes since version 0.99 | ||
7 | -------------------------- | ||
8 | - Interfacing to the kernel is routed though an extra interface layer, | ||
9 | cdrom.c. This allows runtime-configurable `behavior' of the cdrom-drive, | ||
10 | independent of the driver. | ||
11 | |||
12 | Features since version 0.33 | ||
13 | --------------------------- | ||
14 | - Full audio support, that is, both workman, workbone and cdp work | ||
15 | now reasonably. Reading TOC still takes some time. xmcd has been | ||
16 | reported to run successfully. | ||
17 | - Made auto-probe code a little better, I hope | ||
18 | |||
19 | Features since version 0.28 | ||
20 | --------------------------- | ||
21 | - Full speed transfer rate (300 kB/s). | ||
22 | - Minimum kernel memory usage for buffering (less than 3 kB). | ||
23 | - Multisession support. | ||
24 | - Tray locking. | ||
25 | - Statistics of driver accessible to the user. | ||
26 | - Module support. | ||
27 | - Auto-probing of adapter card's base port and irq line, | ||
28 | also configurable at boot time or module load time. | ||
29 | |||
30 | |||
31 | Decide how you are going to use the driver. There are two | ||
32 | options: | ||
33 | |||
34 | (a) installing the driver as a resident part of the kernel | ||
35 | (b) compiling the driver as a loadable module | ||
36 | |||
37 | Further, you must decide if you are going to specify the base port | ||
38 | address and the interrupt request line of the adapter card cm260 as | ||
39 | boot options for (a), module parameters for (b), use automatic | ||
40 | probing of these values, or hard-wire your adaptor card's settings | ||
41 | into the source code. If you don't care, you can choose | ||
42 | autoprobing, which is the default. In that case you can move on to | ||
43 | the next step. | ||
44 | |||
45 | Compiling the kernel | ||
46 | -------------------- | ||
47 | 1) move to /usr/src/linux and do a | ||
48 | |||
49 | make config | ||
50 | |||
51 | If you have chosen option (a), answer yes to CONFIG_CM206 and | ||
52 | CONFIG_ISO9660_FS. | ||
53 | |||
54 | If you have chosen option (b), answer yes to CONFIG_MODVERSIONS | ||
55 | and no (!) to CONFIG_CM206 and CONFIG_ISO9660_FS. | ||
56 | |||
57 | 2) then do a | ||
58 | |||
59 | make clean; make zImage; make modules | ||
60 | |||
61 | 3) do the usual things to install a new image (backup the old one, run | ||
62 | `rdev -R zImage 1', copy the new image in place, run lilo). Might | ||
63 | be `make zlilo'. | ||
64 | |||
65 | Using the driver as a module | ||
66 | ---------------------------- | ||
67 | If you will only occasionally use the cd-rom driver, you can choose | ||
68 | option (b), install as a loadable module. You may have to re-compile | ||
69 | the module when you upgrade the kernel to a new version. | ||
70 | |||
71 | Since version 0.96, much of the functionality has been transferred to | ||
72 | a generic cdrom interface in the file cdrom.c. The module cm206.o | ||
73 | depends on cdrom.o. If the latter is not compiled into the kernel, | ||
74 | you must explicitly load it before cm206.o: | ||
75 | |||
76 | insmod /usr/src/linux/modules/cdrom.o | ||
77 | |||
78 | To install the module, you use the command, as root | ||
79 | |||
80 | insmod /usr/src/linux/modules/cm206.o | ||
81 | |||
82 | You can specify the base address on the command line as well as the irq | ||
83 | line to be used, e.g. | ||
84 | |||
85 | insmod /usr/src/linux/modules/cm206.o cm206=0x300,11 | ||
86 | |||
87 | The order of base port and irq line doesn't matter; if you specify only | ||
88 | one, the other will have the value of the compiled-in default. You | ||
89 | may also have to install the file-system module `iso9660.o', if you | ||
90 | didn't compile that into the kernel. | ||
91 | |||
92 | |||
93 | Using the driver as part of the kernel | ||
94 | -------------------------------------- | ||
95 | If you have chosen option (a), you can specify the base-port | ||
96 | address and irq on the lilo boot command line, e.g.: | ||
97 | |||
98 | LILO: linux cm206=0x340,11 | ||
99 | |||
100 | This assumes that your linux kernel image keyword is `linux'. | ||
101 | If you specify either IRQ (3--11) or base port (0x300--0x370), | ||
102 | auto probing is turned off for both settings, thus setting the | ||
103 | other value to the compiled-in default. | ||
104 | |||
105 | Note that you can also put these parameters in the lilo configuration file: | ||
106 | |||
107 | # linux config | ||
108 | image = /vmlinuz | ||
109 | root = /dev/hda1 | ||
110 | label = Linux | ||
111 | append = "cm206=0x340,11" | ||
112 | read-only | ||
113 | |||
114 | |||
115 | If module parameters and LILO config options don't work | ||
116 | ------------------------------------------------------- | ||
117 | If autoprobing does not work, you can hard-wire the default values | ||
118 | of the base port address (CM206_BASE) and interrupt request line | ||
119 | (CM206_IRQ) into the file /usr/src/linux/drivers/cdrom/cm206.h. Change | ||
120 | the defines of CM206_IRQ and CM206_BASE. | ||
121 | |||
122 | |||
123 | Mounting the cdrom | ||
124 | ------------------ | ||
125 | 1) Make sure that the right device is installed in /dev. | ||
126 | |||
127 | mknod /dev/cm206cd b 32 0 | ||
128 | |||
129 | 2) Make sure there is a mount point, e.g., /cdrom | ||
130 | |||
131 | mkdir /cdrom | ||
132 | |||
133 | 3) mount using a command like this (run as root): | ||
134 | |||
135 | mount -rt iso9660 /dev/cm206cd /cdrom | ||
136 | |||
137 | 4) For user-mounts, add a line in /etc/fstab | ||
138 | |||
139 | /dev/cm206cd /cdrom iso9660 ro,noauto,user | ||
140 | |||
141 | This will allow users to give the commands | ||
142 | |||
143 | mount /cdrom | ||
144 | umount /cdrom | ||
145 | |||
146 | If things don't work | ||
147 | -------------------- | ||
148 | |||
149 | - Try to do a `dmesg' to find out if the driver said anything about | ||
150 | what is going wrong during the initialization. | ||
151 | |||
152 | - Try to do a `dd if=/dev/cm206cd | od -tc | less' to read from the | ||
153 | CD. | ||
154 | |||
155 | - Look in the /proc directory to see if `cm206' shows up under one of | ||
156 | `interrupts', `ioports', `devices' or `modules' (if applicable). | ||
157 | |||
158 | |||
159 | DISCLAIMER | ||
160 | ---------- | ||
161 | I cannot guarantee that this driver works, or that the hardware will | ||
162 | not be harmed, although I consider it most unlikely. | ||
163 | |||
164 | I hope that you'll find this driver in some way useful. | ||
165 | |||
166 | David van Leeuwen | ||
167 | david@tm.tno.nl | ||
168 | |||
169 | Note for Linux CDROM vendors | ||
170 | ----------------------------- | ||
171 | You are encouraged to include this driver on your Linux CDROM. If | ||
172 | you do, you might consider sending me a free copy of that cd-rom. | ||
173 | You can contact me through my e-mail address, david@tm.tno.nl. | ||
174 | If this driver is compiled into a kernel to boot off a cdrom, | ||
175 | you should actually send me a free copy of that cd-rom. | ||
176 | |||
177 | Copyright | ||
178 | --------- | ||
179 | The copyright of the cm206 driver for Linux is | ||
180 | |||
181 | (c) 1995 David A. van Leeuwen | ||
182 | |||
183 | The driver is released under the conditions of the GNU general public | ||
184 | license, which can be found in the file COPYING in the root of this | ||
185 | source tree. | ||
diff --git a/Documentation/cdrom/gscd b/Documentation/cdrom/gscd deleted file mode 100644 index d01ca36b5c43..000000000000 --- a/Documentation/cdrom/gscd +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | Goldstar R420 CD-Rom device driver README | ||
2 | |||
3 | For all kind of other information about the GoldStar R420 CDROM | ||
4 | and this Linux device driver see the WWW page: | ||
5 | |||
6 | http://linux.rz.fh-hannover.de/~raupach | ||
7 | |||
8 | |||
9 | If you are the editor of a Linux CD, you should | ||
10 | enable gscd.c within your boot floppy kernel. Please, | ||
11 | send me one of your CDs for free. | ||
12 | |||
13 | |||
14 | This current driver version 0.4a only supports reading data from the disk. | ||
15 | Currently we have no audio and no multisession or XA support. | ||
16 | The polling interface is used, no DMA. | ||
17 | |||
18 | |||
19 | Sometimes the GoldStar R420 is sold in a 'Reveal Multimedia Kit'. This kit's | ||
20 | drive interface is compatible, too. | ||
21 | |||
22 | |||
23 | Installation | ||
24 | ------------ | ||
25 | |||
26 | Change to '/usr/src/linux/drivers/cdrom' and edit the file 'gscd.h'. Insert | ||
27 | the i/o address of your interface card. | ||
28 | |||
29 | The default base address is 0x340. This will work for most applications. | ||
30 | Address selection is accomplished by jumpers PN801-1 to PN801-4 on the | ||
31 | GoldStar Interface Card. | ||
32 | Appropriate settings are: 0x300, 0x310, 0x320, 0x330, 0x340, 0x350, 0x360 | ||
33 | 0x370, 0x380, 0x390, 0x3A0, 0x3B0, 0x3C0, 0x3D0, 0x3E0, 0x3F0 | ||
34 | |||
35 | Then go back to '/usr/src/linux/' and 'make config' to build the new | ||
36 | configuration for your kernel. If you want to use the GoldStar driver | ||
37 | like a module, don't select 'GoldStar CDROM support'. By the way, you | ||
38 | have to include the iso9660 filesystem. | ||
39 | |||
40 | Now start compiling the kernel with 'make zImage'. | ||
41 | If you want to use the driver as a module, you have to do 'make modules' | ||
42 | and 'make modules_install', additionally. | ||
43 | Install your new kernel as usual - maybe you do it with 'make zlilo'. | ||
44 | |||
45 | Before you can use the driver, you have to | ||
46 | mknod /dev/gscd0 b 16 0 | ||
47 | to create the appropriate device file (you only need to do this once). | ||
48 | |||
49 | If you use modules, you can try to insert the driver. | ||
50 | Say: 'insmod /usr/src/linux/modules/gscd.o' | ||
51 | or: 'insmod /usr/src/linux/modules/gscd.o gscd=<address>' | ||
52 | The driver should report its results. | ||
53 | |||
54 | That's it! Mount a disk, i.e. 'mount -rt iso9660 /dev/gscd0 /cdrom' | ||
55 | |||
56 | Feel free to report errors and suggestions to the following address. | ||
57 | Be sure, I'm very happy to receive your comments! | ||
58 | |||
59 | Oliver Raupach Hannover, Juni 1995 | ||
60 | (raupach@nwfs1.rz.fh-hannover.de) | ||
diff --git a/Documentation/cdrom/isp16 b/Documentation/cdrom/isp16 deleted file mode 100644 index cc86533ac9f3..000000000000 --- a/Documentation/cdrom/isp16 +++ /dev/null | |||
@@ -1,100 +0,0 @@ | |||
1 | -- Documentation/cdrom/isp16 | ||
2 | |||
3 | Docs by Eric van der Maarel <H.T.M.v.d.Maarel@marin.nl> | ||
4 | |||
5 | This is the README for version 0.6 of the cdrom interface on an | ||
6 | ISP16, MAD16 or Mozart sound card. | ||
7 | |||
8 | The detection and configuration of this interface used to be included | ||
9 | in both the sjcd and optcd cdrom driver. Drives supported by these | ||
10 | drivers came packed with Media Magic's multi media kit, which also | ||
11 | included the ISP16 card. The idea (thanks Leo Spiekman) | ||
12 | to move it from these drivers into a separate module and moreover, not to | ||
13 | rely on the MAD16 sound driver, are as follows: | ||
14 | -duplication of code in the kernel is a waste of resources and should | ||
15 | be avoided; | ||
16 | -however, kernels and notably those included with Linux distributions | ||
17 | (cf Slackware 3.0 included version 0.5 of the isp16 configuration | ||
18 | code included in the drivers) don't always come with sound support | ||
19 | included. Especially when they already include a bunch of cdrom drivers. | ||
20 | Hence, the cdrom interface should be configurable _independently_ of | ||
21 | sound support. | ||
22 | |||
23 | The ISP16, MAD16 and Mozart sound cards have an OPTi 82C928 or an | ||
24 | OPTi 82C929 chip. The interface on these cards should work with | ||
25 | any cdrom attached to the card, which is 'electrically' compatible | ||
26 | with Sanyo/Panasonic, Sony or Mitsumi non-ide drives. However, the | ||
27 | command sets for any proprietary drives may differ | ||
28 | (and hence may not be supported in the kernel) from these four types. | ||
29 | For a fact I know the interface works and the way of configuration | ||
30 | as described in this documentation works in combination with the | ||
31 | sjcd (in Sanyo/Panasonic compatibility mode) cdrom drivers | ||
32 | (probably with the optcd (in Sony compatibility mode) as well). | ||
33 | If you have such an OPTi based sound card and you want to use the | ||
34 | cdrom interface with a cdrom drive supported by any of the other cdrom | ||
35 | drivers, it will probably work. Please let me know any experience you | ||
36 | might have). | ||
37 | I understand that cards based on the OPTi 82C929 chips may be configured | ||
38 | (hardware jumpers that is) as an IDE interface. Initialisation of such a | ||
39 | card in this mode is not supported (yet?). | ||
40 | |||
41 | The suggestion to configure the ISP16 etc. sound card by booting DOS and | ||
42 | do a warm reboot to boot Linux somehow doesn't work, at least not | ||
43 | on my machine (IPC P90), with the OPTi 82C928 based card. | ||
44 | |||
45 | Booting the kernel through the boot manager LILO allows the use | ||
46 | of some command line options on the 'LILO boot:' prompt. At boot time | ||
47 | press Alt or Shift while the LILO prompt is written on the screen and enter | ||
48 | any kernel options. Alternatively these options may be used in | ||
49 | the appropriate section in /etc/lilo.conf. Adding 'append="<cmd_line_options>"' | ||
50 | will do the trick as well. | ||
51 | The syntax of 'cmd_line_options' is | ||
52 | |||
53 | isp16=[<port>[,<irq>[,<dma>]]][[,]<drive_type>] | ||
54 | |||
55 | If there is no ISP16 or compatibles detected, there's probably no harm done. | ||
56 | These options indicate the values that your cdrom drive has been (or will be) | ||
57 | configured to use. | ||
58 | Valid values for the base i/o address are: | ||
59 | port=0x340,0x320,0x330,0x360 | ||
60 | for the interrupt request number | ||
61 | irq=0,3,5,7,9,10,11 | ||
62 | for the direct memory access line | ||
63 | dma=0,3,5,6,7 | ||
64 | and for the type of drive | ||
65 | drive_type=noisp16,Sanyo,Panasonic,Sony,Mitsumi. | ||
66 | Note that these options are case sensitive. | ||
67 | The values 0 for irq and dma indicate that they are not used, and | ||
68 | the drive will be used in 'polling' mode. The values 5 and 7 for irq | ||
69 | should be avoided in order to avoid any conflicts with optional | ||
70 | sound card configuration. | ||
71 | The syntax of the command line does not allow the specification of | ||
72 | irq when there's nothing specified for the base address and no | ||
73 | specification of dma when there is no specification of irq. | ||
74 | The value 'noisp16' for drive_type, which may be used as the first | ||
75 | non-integer option value (e.g. 'isp16=noisp16'), makes sure that probing | ||
76 | for and subsequent configuration of an ISP16-compatible card is skipped | ||
77 | all together. This can be useful to overcome possible conflicts which | ||
78 | may arise while the kernel is probing your hardware. | ||
79 | The default values are | ||
80 | port=0x340 | ||
81 | irq=0 | ||
82 | dma=0 | ||
83 | drive_type=Sanyo | ||
84 | reflecting my own configuration. The defaults can be changed in | ||
85 | the file linux/drivers/cdrom/ips16.h. | ||
86 | |||
87 | The cdrom interface can be configured at run time by loading the | ||
88 | initialisation driver as a module. In that case, the interface | ||
89 | parameters can be set by giving appropriate values on the command | ||
90 | line. Configuring the driver can then be done by the following | ||
91 | command (assuming you have iso16.o installed in a proper place): | ||
92 | |||
93 | insmod isp16.o isp16_cdrom_base=<port> isp16_cdrom_irq=<irq> \ | ||
94 | isp16_cdrom_dma=<dma> isp16_cdrom_type=<drive_type> | ||
95 | |||
96 | where port, irq, dma and drive_type can have any of the values mentioned | ||
97 | above. | ||
98 | |||
99 | |||
100 | Have fun! | ||
diff --git a/Documentation/cdrom/mcdx b/Documentation/cdrom/mcdx deleted file mode 100644 index 2bac4b7ff6da..000000000000 --- a/Documentation/cdrom/mcdx +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | If you are using the driver as a module, you can specify your ports and IRQs | ||
2 | like | ||
3 | |||
4 | # insmod mcdx.o mcdx=0x300,11,0x304,5 | ||
5 | |||
6 | and so on ("address,IRQ" pairs). | ||
7 | This will override the configuration in mcdx.h. | ||
8 | |||
9 | This driver: | ||
10 | |||
11 | o handles XA and (hopefully) multi session CDs as well as | ||
12 | ordinary CDs; | ||
13 | o supports up to 5 drives (of course, you'll need free | ||
14 | IRQs, i/o ports and slots); | ||
15 | o plays audio | ||
16 | |||
17 | This version doesn't support yet: | ||
18 | |||
19 | o shared IRQs (but it seems to be possible - I've successfully | ||
20 | connected two drives to the same irq. So it's `only' a | ||
21 | problem of the driver.) | ||
22 | |||
23 | This driver never will: | ||
24 | |||
25 | o Read digital audio (i.e. copy directly), due to missing | ||
26 | hardware features. | ||
27 | |||
28 | |||
29 | heiko@lotte.sax.de | ||
diff --git a/Documentation/cdrom/optcd b/Documentation/cdrom/optcd deleted file mode 100644 index 6f46c7adb243..000000000000 --- a/Documentation/cdrom/optcd +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | This is the README file for the Optics Storage 8000 AT CDROM device driver. | ||
2 | |||
3 | This is the driver for the so-called 'DOLPHIN' drive, with the 34-pin | ||
4 | Sony-compatible interface. For the IDE-compatible Optics Storage 8001 | ||
5 | drive, you will want the ATAPI CDROM driver. The driver also seems to | ||
6 | work with the Lasermate CR328A. If you have a drive that works with | ||
7 | this driver, and that doesn't report itself as DOLPHIN, please drop me | ||
8 | a mail. | ||
9 | |||
10 | The support for multisession CDs is in ALPHA stage. If you use it, | ||
11 | please mail me your experiences. Multisession support can be disabled | ||
12 | at compile time. | ||
13 | |||
14 | You can find some older versions of the driver at | ||
15 | dutette.et.tudelft.nl:/pub/linux/ | ||
16 | and at Eberhard's mirror | ||
17 | ftp.gwdg.de:/pub/linux/cdrom/drivers/optics/ | ||
18 | |||
19 | Before you can use the driver, you have to create the device file once: | ||
20 | # mknod /dev/optcd0 b 17 0 | ||
21 | |||
22 | To specify the base address if the driver is "compiled-in" to your kernel, | ||
23 | you can use the kernel command line item (LILO option) | ||
24 | optcd=0x340 | ||
25 | with the right address. | ||
26 | |||
27 | If you have compiled optcd as a module, you can load it with | ||
28 | # insmod /usr/src/linux/modules/optcd.o | ||
29 | or | ||
30 | # insmod /usr/src/linux/modules/optcd.o optcd=0x340 | ||
31 | with the matching address value of your interface card. | ||
32 | |||
33 | The driver employs a number of buffers to do read-ahead and block size | ||
34 | conversion. The number of buffers is configurable in optcd.h, and has | ||
35 | influence on the driver performance. For my machine (a P75), 6 buffers | ||
36 | seems optimal, as can be seen from this table: | ||
37 | |||
38 | #bufs kb/s %cpu | ||
39 | 1 97 0.1 | ||
40 | 2 191 0.3 | ||
41 | 3 188 0.2 | ||
42 | 4 246 0.3 | ||
43 | 5 189 19 | ||
44 | 6 280 0.4 | ||
45 | 7 281 7.0 | ||
46 | 8 246 2.8 | ||
47 | 16 281 3.4 | ||
48 | |||
49 | If you get a throughput significantly below 300 kb/s, try tweaking | ||
50 | N_BUFS, and don't forget to mail me your results! | ||
51 | |||
52 | I'd appreciate success/failure reports. If you find a bug, try | ||
53 | recompiling the driver with some strategically chosen debug options | ||
54 | (these can be found in optcd.h) and include the messages generated in | ||
55 | your bug report. Good luck. | ||
56 | |||
57 | Leo Spiekman (spiekman@dutette.et.tudelft.nl) | ||
diff --git a/Documentation/cdrom/sbpcd b/Documentation/cdrom/sbpcd deleted file mode 100644 index b3ba63f4ce3e..000000000000 --- a/Documentation/cdrom/sbpcd +++ /dev/null | |||
@@ -1,1061 +0,0 @@ | |||
1 | This README belongs to release 4.2 or newer of the SoundBlaster Pro | ||
2 | (Matsushita, Kotobuki, Panasonic, CreativeLabs, Longshine and Teac) | ||
3 | CD-ROM driver for Linux. | ||
4 | |||
5 | sbpcd really, really is NOT for ANY IDE/ATAPI drive! | ||
6 | Not even if you have an "original" SoundBlaster card with an IDE interface! | ||
7 | So, you'd better have a look into README.ide if your port address is 0x1F0, | ||
8 | 0x170, 0x1E8, 0x168 or similar. | ||
9 | I get tons of mails from IDE/ATAPI drive users - I really can't continue | ||
10 | any more to answer them all. So, if your drive/interface information sheets | ||
11 | mention "IDE" (primary, secondary, tertiary, quaternary) and the DOS driver | ||
12 | invoking line within your CONFIG.SYS is using an address below 0x230: | ||
13 | DON'T ROB MY LAST NERVE - jumper your interface to address 0x170 and IRQ 15 | ||
14 | (that is the "secondary IDE" configuration), set your drive to "master" and | ||
15 | use ide-cd as your driver. If you do not have a second IDE hard disk, use the | ||
16 | LILO commands | ||
17 | hdb=noprobe hdc=cdrom | ||
18 | and get lucky. | ||
19 | To make it fully clear to you: if you mail me about IDE/ATAPI drive problems, | ||
20 | my answer is above, and I simply will discard your mail, hoping to stop the | ||
21 | flood and to find time to lead my 12-year old son towards happy computing. | ||
22 | |||
23 | The driver is able to drive the whole family of "traditional" AT-style (that | ||
24 | is NOT the new "Enhanced IDE" or "ATAPI" drive standard) Matsushita, | ||
25 | Kotobuki, Panasonic drives, sometimes labelled as "CreativeLabs". The | ||
26 | well-known drives are CR-521, CR-522, CR-523, CR-562, CR-563. | ||
27 | CR-574 is an IDE/ATAPI drive. | ||
28 | |||
29 | The Longshine LCS-7260 is a double-speed drive which uses the "old" | ||
30 | Matsushita command set. It is supported - with help by Serge Robyns. | ||
31 | Vertos ("Elitegroup Computer Systems", ECS) has a similar drive - support | ||
32 | has started; get in contact if you have such a "Vertos 100" or "ECS-AT" | ||
33 | drive. | ||
34 | |||
35 | There exists an "IBM External ISA CD-ROM Drive" which in fact is a CR-563 | ||
36 | with a special controller board. This drive is supported (the interface is | ||
37 | of the "LaserMate" type), and it is possibly the best buy today (cheaper than | ||
38 | an internal drive, and you can use it as an internal, too - e.g. plug it into | ||
39 | a soundcard). | ||
40 | |||
41 | CreativeLabs has a new drive "CD200" and a similar drive "CD200F". The latter | ||
42 | is made by Funai and sometimes named "E2550UA", newer models may be named | ||
43 | "MK4015". The CD200F drives should fully work. | ||
44 | CD200 drives without "F" are still giving problems: drive detection and | ||
45 | playing audio should work, data access will result in errors. I need qualified | ||
46 | feedback about the bugs within the data functions or a drive (I never saw a | ||
47 | CD200). | ||
48 | |||
49 | The quad-speed Teac CD-55A drive is supported, but still does not reach "full | ||
50 | speed". The data rate already reaches 500 kB/sec if you set SBP_BUFFER_FRAMES | ||
51 | to 64 (it is not recommended to do that for normal "file access" usage, but it | ||
52 | can speed up things a lot if you use something like "dd" to read from the | ||
53 | drive; I use it for verifying self-written CDs this way). | ||
54 | The drive itself is able to deliver 600 kB/sec, so this needs | ||
55 | work; with the normal setup, the performance currently is not even as good as | ||
56 | double-speed. | ||
57 | |||
58 | This driver is NOT for Mitsumi or Sony or Aztech or Philips or XXX drives, | ||
59 | and again: this driver is in no way usable for any IDE/ATAPI drive. If you | ||
60 | think your drive should work and it doesn't: send me the DOS driver for your | ||
61 | beast (gzipped + uuencoded) and your CONFIG.SYS if you want to ask me for help, | ||
62 | and include an original log message excerpt, and try to give all information | ||
63 | a complete idiot needs to understand your hassle already with your first | ||
64 | mail. And if you want to say "as I have mailed you before", be sure that I | ||
65 | don't remember your "case" by such remarks; at the moment, I have some | ||
66 | hundreds of open correspondences about Linux CDROM questions (hope to reduce if | ||
67 | the IDE/ATAPI user questions disappear). | ||
68 | |||
69 | |||
70 | This driver will work with the soundcard interfaces (SB Pro, SB 16, Galaxy, | ||
71 | SoundFX, Mozart, MAD16 ...) and with the "no-sound" cards (Panasonic CI-101P, | ||
72 | LaserMate, WDH-7001C, Longshine LCS-6853, Teac ...). | ||
73 | |||
74 | It works with the "configurable" interface "Sequoia S-1000", too, which is | ||
75 | used on the Spea Media FX and Ensonic Soundscape sound cards. You have to | ||
76 | specify the type "SBPRO 2" and the true CDROM port address with it, not the | ||
77 | "configuration port" address. | ||
78 | |||
79 | If you have a sound card which needs a "configuration driver" instead of | ||
80 | jumpers for interface types and addresses (like Mozart cards) - those | ||
81 | drivers get invoked before the DOS CDROM driver in your CONFIG.SYS, typical | ||
82 | names are "cdsetup.sys" and "mztinit.sys" - let the sound driver do the | ||
83 | CDROM port configuration (the leading comments in linux/drivers/sound/mad16.c | ||
84 | are just for you!). Hannu Savolainen's mad16.c code is able to set up my | ||
85 | Mozart card - I simply had to add | ||
86 | #define MAD16_CONF 0x06 | ||
87 | #define MAD16_CDSEL 0x03 | ||
88 | to configure the CDROM interface for type "Panasonic" (LaserMate) and address | ||
89 | 0x340. | ||
90 | |||
91 | The interface type has to get configured in linux/drivers/cdrom/sbpcd.h, | ||
92 | because the register layout is different between the "SoundBlaster" and the | ||
93 | "LaserMate" type. | ||
94 | |||
95 | I got a report that the Teac interface card "I/F E117098" is of type | ||
96 | "SoundBlaster" (i.e. you have to set SBPRO to 1) even with the addresses | ||
97 | 0x300 and above. This is unusual, and it can't get covered by the auto | ||
98 | probing scheme. | ||
99 | The Teac 16-bit interface cards (like P/N E950228-00A, default address 0x2C0) | ||
100 | need the SBPRO 3 setup. | ||
101 | |||
102 | If auto-probing found the drive, the address is correct. The reported type | ||
103 | may be wrong. A "mount" will give success only if the interface type is set | ||
104 | right. Playing audio should work with a wrong set interface type, too. | ||
105 | |||
106 | With some Teac and some CD200 drives I have seen interface cards which seem | ||
107 | to lack the "drive select" lines; always drive 0 gets addressed. To avoid | ||
108 | "mirror drives" (four drives detected where you only have one) with such | ||
109 | interface cards, set MAX_DRIVES to 1 and jumper your drive to ID 0 (if | ||
110 | possible). | ||
111 | |||
112 | |||
113 | Up to 4 drives per interface card, and up to 4 interface cards are supported. | ||
114 | All supported drive families can be mixed, but the CR-521 drives are | ||
115 | hard-wired to drive ID 0. The drives have to use different drive IDs, and each | ||
116 | drive has to get a unique minor number (0...3), corresponding indirectly to | ||
117 | its drive ID. | ||
118 | The drive IDs may be selected freely from 0 to 3 - they do not have to be in | ||
119 | consecutive order. | ||
120 | |||
121 | As Don Carroll, don@ds9.us.dell.com or FIDO 1:382/14, told me, it is possible | ||
122 | to change old drives to any ID, too. He writes in this sense: | ||
123 | "In order to be able to use more than one single speed drive | ||
124 | (they do not have the ID jumpers) you must add a DIP switch | ||
125 | and two resistors. The pads are already on the board next to | ||
126 | the power connector. You will see the silkscreen for the | ||
127 | switch if you remove the top cover. | ||
128 | 1 2 3 4 | ||
129 | ID 0 = x F F x O = "on" | ||
130 | ID 1 = x O F x F = "off" | ||
131 | ID 2 = x F O x x = "don't care" | ||
132 | ID 3 = x O O x | ||
133 | Next to the switch are the positions for R76 (7k) and R78 | ||
134 | (12k). I had to play around with the resistor values - ID 3 | ||
135 | did not work with other values. If the values are not good, | ||
136 | ID 3 behaves like ID 0." | ||
137 | |||
138 | To use more than 4 drives, you simply need a second controller card at a | ||
139 | different address and a second cable. | ||
140 | |||
141 | The driver supports reading of data from the CD and playing of audio tracks. | ||
142 | The audio part should run with WorkMan, xcdplayer, with the "non-X11" products | ||
143 | CDplayer and WorkBone - tell me if it is not compatible with other software. | ||
144 | The only accepted measure for correctness with the audio functions is the | ||
145 | "cdtester" utility (appended) - most audio player programmers seem to be | ||
146 | better musicians than programmers. ;-) | ||
147 | |||
148 | With the CR-56x and the CD200 drives, the reading of audio frames is possible. | ||
149 | This is implemented by an IOCTL function which reads READ_AUDIO frames of | ||
150 | 2352 bytes at once (configurable with the "READ_AUDIO" define, default is 0). | ||
151 | Reading the same frame a second time gives different data; the frame data | ||
152 | start at a different position, but all read bytes are valid, and we always | ||
153 | read 98 consecutive chunks (of 24 Bytes) as a frame. Reading more than 1 frame | ||
154 | at once possibly misses some chunks at each frame boundary. This lack has to | ||
155 | get corrected by external, "higher level" software which reads the same frame | ||
156 | again and tries to find and eliminate overlapping chunks (24-byte-pieces). | ||
157 | |||
158 | The transfer rate with reading audio (1-frame-pieces) currently is very slow. | ||
159 | This can be better reading bigger chunks, but the "missing" chunks possibly | ||
160 | occur at the beginning of each single frame. | ||
161 | The software interface possibly may change a bit the day the SCSI driver | ||
162 | supports it too. | ||
163 | |||
164 | With all but the CR-52x drives, MultiSession is supported. | ||
165 | Photo CDs work (the "old" drives like CR-521 can access only the first | ||
166 | session of a photoCD). | ||
167 | At ftp.gwdg.de:/pub/linux/hpcdtoppm/ you will find Hadmut Danisch's package to | ||
168 | convert photo CD image files and Gerd Knorr's viewing utility. | ||
169 | |||
170 | The transfer rate will reach 150 kB/sec with CR-52x drives, 300 kB/sec with | ||
171 | CR-56x drives, and currently not more than 500 kB/sec (usually less than | ||
172 | 250 kB/sec) with the Teac quad speed drives. | ||
173 | XA (PhotoCD) disks with "old" drives give only 50 kB/sec. | ||
174 | |||
175 | This release consists of | ||
176 | - this README file | ||
177 | - the driver file linux/drivers/cdrom/sbpcd.c | ||
178 | - the stub files linux/drivers/cdrom/sbpcd[234].c | ||
179 | - the header file linux/drivers/cdrom/sbpcd.h. | ||
180 | |||
181 | |||
182 | To install: | ||
183 | ----------- | ||
184 | |||
185 | 1. Setup your hardware parameters. Though the driver does "auto-probing" at a | ||
186 | lot of (not all possible!) addresses, this step is recommended for | ||
187 | everyday use. You should let sbpcd auto-probe once and use the reported | ||
188 | address if a drive got found. The reported type may be incorrect; it is | ||
189 | correct if you can mount a data CD. There is no choice for you with the | ||
190 | type; only one is right, the others are deadly wrong. | ||
191 | |||
192 | a. Go into /usr/src/linux/drivers/cdrom/sbpcd.h and configure it for your | ||
193 | hardware (near the beginning): | ||
194 | a1. Set it up for the appropriate type of interface board. | ||
195 | "Original" CreativeLabs sound cards need "SBPRO 1". | ||
196 | Most "compatible" sound cards (almost all "non-CreativeLabs" cards) | ||
197 | need "SBPRO 0". | ||
198 | The "no-sound" board from OmniCd needs the "SBPRO 1" setup. | ||
199 | The Teac 8-bit "no-sound" boards need the "SBPRO 1" setup. | ||
200 | The Teac 16-bit "no-sound" boards need the "SBPRO 3" setup. | ||
201 | All other "no-sound" boards need the "SBPRO 0" setup. | ||
202 | The Spea Media FX and Ensoniq SoundScape cards need "SBPRO 2". | ||
203 | sbpcd.c holds some examples in its auto-probe list. | ||
204 | If you configure "SBPRO" wrong, the playing of audio CDs will work, | ||
205 | but you will not be able to mount a data CD. | ||
206 | a2. Tell the address of your CDROM_PORT (not of the sound port). | ||
207 | a3. If 4 drives get found, but you have only one, set MAX_DRIVES to 1. | ||
208 | a4. Set DISTRIBUTION to 0. | ||
209 | b. Additionally for 2.a1 and 2.a2, the setup may be done during | ||
210 | boot time (via the "kernel command line" or "LILO option"): | ||
211 | sbpcd=0x320,LaserMate | ||
212 | or | ||
213 | sbpcd=0x230,SoundBlaster | ||
214 | or | ||
215 | sbpcd=0x338,SoundScape | ||
216 | or | ||
217 | sbpcd=0x2C0,Teac16bit | ||
218 | This is especially useful if you install a fresh distribution. | ||
219 | If the second parameter is a number, it gets taken as the type | ||
220 | setting; 0 is "LaserMate", 1 is "SoundBlaster", 2 is "SoundScape", | ||
221 | 3 is "Teac16bit". | ||
222 | So, for example | ||
223 | sbpcd=0x230,1 | ||
224 | is equivalent to | ||
225 | sbpcd=0x230,SoundBlaster | ||
226 | |||
227 | 2. "cd /usr/src/linux" and do a "make config" and select "y" for Matsushita | ||
228 | CD-ROM support and for ISO9660 FileSystem support. If you do not have a | ||
229 | second, third, or fourth controller installed, do not say "y" to the | ||
230 | secondary Matsushita CD-ROM questions. | ||
231 | |||
232 | 3. Then make the kernel image ("make zlilo" or similar). | ||
233 | |||
234 | 4. Make the device file(s). This step usually already has been done by the | ||
235 | MAKEDEV script. | ||
236 | The driver uses MAJOR 25, so, if necessary, do | ||
237 | mknod /dev/sbpcd b 25 0 (if you have only one drive) | ||
238 | and/or | ||
239 | mknod /dev/sbpcd0 b 25 0 | ||
240 | mknod /dev/sbpcd1 b 25 1 | ||
241 | mknod /dev/sbpcd2 b 25 2 | ||
242 | mknod /dev/sbpcd3 b 25 3 | ||
243 | to make the node(s). | ||
244 | |||
245 | The "first found" drive gets MINOR 0 (regardless of its jumpered ID), the | ||
246 | "next found" (at the same cable) gets MINOR 1, ... | ||
247 | |||
248 | For a second interface board, you have to make nodes like | ||
249 | mknod /dev/sbpcd4 b 26 0 | ||
250 | mknod /dev/sbpcd5 b 26 1 | ||
251 | and so on. Use the MAJORs 26, 27, 28. | ||
252 | |||
253 | If you further make a link like | ||
254 | ln -s sbpcd /dev/cdrom | ||
255 | you can use the name /dev/cdrom, too. | ||
256 | |||
257 | 5. Reboot with the new kernel. | ||
258 | |||
259 | You should now be able to do | ||
260 | mkdir /CD | ||
261 | and | ||
262 | mount -rt iso9660 /dev/sbpcd /CD | ||
263 | or | ||
264 | mount -rt iso9660 -o block=2048 /dev/sbpcd /CD | ||
265 | and see the contents of your CD in the /CD directory. | ||
266 | To use audio CDs, a mounting is not recommended (and it would fail if the | ||
267 | first track is not a data track). | ||
268 | |||
269 | |||
270 | Using sbpcd as a "loadable module": | ||
271 | ----------------------------------- | ||
272 | |||
273 | If you do NOT select "Matsushita/Panasonic CDROM driver support" during the | ||
274 | "make config" of your kernel, you can build the "loadable module" sbpcd.o. | ||
275 | |||
276 | If sbpcd gets used as a module, the support of more than one interface | ||
277 | card (i.e. drives 4...15) is disabled. | ||
278 | |||
279 | You can specify interface address and type with the "insmod" command like: | ||
280 | # insmod /usr/src/linux/modules/sbpcd.o sbpcd=0x340,0 | ||
281 | or | ||
282 | # insmod /usr/src/linux/modules/sbpcd.o sbpcd=0x230,1 | ||
283 | or | ||
284 | # insmod /usr/src/linux/modules/sbpcd.o sbpcd=0x338,2 | ||
285 | where the last number represents the SBPRO setting (no strings allowed here). | ||
286 | |||
287 | |||
288 | Things of interest: | ||
289 | ------------------- | ||
290 | |||
291 | The driver is configured to try the LaserMate type of interface at I/O port | ||
292 | 0x0340 first. If this is not appropriate, sbpcd.h should get changed | ||
293 | (you will find the right place - just at the beginning). | ||
294 | |||
295 | No DMA and no IRQ is used. | ||
296 | |||
297 | To reduce or increase the amount of kernel messages, edit sbpcd.c and play | ||
298 | with the "DBG_xxx" switches (initialization of the variable "sbpcd_debug"). | ||
299 | Don't forget to reflect on what you do; enabling all DBG_xxx switches at once | ||
300 | may crash your system, and each message line is accompanied by a delay. | ||
301 | |||
302 | The driver uses the "variable BLOCK_SIZE" feature. To use it, you have to | ||
303 | specify "block=2048" as a mount option. Doing this will disable the direct | ||
304 | execution of a binary from the CD; you have to copy it to a device with the | ||
305 | standard BLOCK_SIZE (1024) first. So, do not use this if your system is | ||
306 | directly "running from the CDROM" (like some of Yggdrasil's installation | ||
307 | variants). There are CDs on the market (like the German "unifix" Linux | ||
308 | distribution) which MUST get handled with a block_size of 1024. Generally, | ||
309 | one can say all the CDs which hold files of the name YMTRANS.TBL are defective; | ||
310 | do not use block=2048 with those. | ||
311 | |||
312 | Within sbpcd.h, you will find some "#define"s (e.g. EJECT and JUKEBOX). With | ||
313 | these, you can configure the driver for some special things. | ||
314 | You can use the appended program "cdtester" to set the auto-eject feature | ||
315 | during runtime. Jeff Tranter's "eject" utility can do this, too (and more) | ||
316 | for you. | ||
317 | |||
318 | There is an ioctl CDROMMULTISESSION to obtain with a user program if | ||
319 | the CD is an XA disk and - if it is - where the last session starts. The | ||
320 | "cdtester" program illustrates how to call it. | ||
321 | |||
322 | |||
323 | Auto-probing at boot time: | ||
324 | -------------------------- | ||
325 | |||
326 | The driver does auto-probing at many well-known interface card addresses, | ||
327 | but not all: | ||
328 | Some probings can cause a hang if an NE2000 ethernet card gets touched, because | ||
329 | SBPCD's auto-probing happens before the initialization of the net drivers. | ||
330 | Those "hazardous" addresses are excluded from auto-probing; the "kernel | ||
331 | command line" feature has to be used during installation if you have your | ||
332 | drive at those addresses. The "module" version is allowed to probe at those | ||
333 | addresses, too. | ||
334 | |||
335 | The auto-probing looks first at the configured address resp. the address | ||
336 | submitted by the kernel command line. With this, it is possible to use this | ||
337 | driver within installation boot floppies, and for any non-standard address, | ||
338 | too. | ||
339 | |||
340 | Auto-probing will make an assumption about the interface type ("SBPRO" or not), | ||
341 | based upon the address. That assumption may be wrong (initialization will be | ||
342 | o.k., but you will get I/O errors during mount). In that case, use the "kernel | ||
343 | command line" feature and specify address & type at boot time to find out the | ||
344 | right setup. | ||
345 | |||
346 | For everyday use, address and type should get configured within sbpcd.h. That | ||
347 | will stop the auto-probing due to success with the first try. | ||
348 | |||
349 | The kernel command "sbpcd=0" suppresses each auto-probing and causes | ||
350 | the driver not to find any drive; it is meant for people who love sbpcd | ||
351 | so much that they do not want to miss it, even if they miss the drives. ;-) | ||
352 | |||
353 | If you configure "#define CDROM_PORT 0" in sbpcd.h, the auto-probing is | ||
354 | initially disabled and needs an explicit kernel command to get activated. | ||
355 | Once activated, it does not stop before success or end-of-list. This may be | ||
356 | useful within "universal" CDROM installation boot floppies (but using the | ||
357 | loadable module would be better because it allows an "extended" auto-probing | ||
358 | without fearing NE2000 cards). | ||
359 | |||
360 | To shorten the auto-probing list to a single entry, set DISTRIBUTION 0 within | ||
361 | sbpcd.h. | ||
362 | |||
363 | |||
364 | Setting up address and interface type: | ||
365 | -------------------------------------- | ||
366 | |||
367 | If your I/O port address is not 0x340, you have to look for the #defines near | ||
368 | the beginning of sbpcd.h and configure them: set SBPRO to 0 or 1 or 2, and | ||
369 | change CDROM_PORT to the address of your CDROM I/O port. | ||
370 | |||
371 | Almost all of the "SoundBlaster compatible" cards behave like the no-sound | ||
372 | interfaces, i.e. need SBPRO 0! | ||
373 | |||
374 | With "original" SB Pro cards, an initial setting of CD_volume through the | ||
375 | sound card's MIXER register gets done. | ||
376 | If you are using a "compatible" sound card of types "LaserMate" or "SPEA", | ||
377 | you can set SOUND_BASE (in sbpcd.h) to get it done with your card, too... | ||
378 | |||
379 | |||
380 | Using audio CDs: | ||
381 | ---------------- | ||
382 | |||
383 | Workman, WorkBone, xcdplayer, cdplayer and the nice little tool "cdplay" (see | ||
384 | README.aztcd from the Aztech driver package) should work. | ||
385 | |||
386 | The program CDplayer likes to talk to "/dev/mcd" only, xcdplayer wants | ||
387 | "/dev/rsr0", workman loves "/dev/sr0" or "/dev/cdrom" - so, make the | ||
388 | appropriate links to use them without the need to supply parameters. | ||
389 | |||
390 | |||
391 | Copying audio tracks: | ||
392 | --------------------- | ||
393 | |||
394 | The following program will copy track 1 (or a piece of it) from an audio CD | ||
395 | into the file "track01": | ||
396 | |||
397 | /*=================== begin program ========================================*/ | ||
398 | /* | ||
399 | * read an audio track from a CD | ||
400 | * | ||
401 | * (c) 1994 Eberhard Moenkeberg <emoenke@gwdg.de> | ||
402 | * may be used & enhanced freely | ||
403 | * | ||
404 | * Due to non-existent sync bytes at the beginning of each audio frame (or due | ||
405 | * to a firmware bug within all known drives?), it is currently a kind of | ||
406 | * fortune if two consecutive frames fit together. | ||
407 | * Usually, they overlap, or a little piece is missing. This happens in units | ||
408 | * of 24-byte chunks. It has to get fixed by higher-level software (reading | ||
409 | * until an overlap occurs, and then eliminate the overlapping chunks). | ||
410 | * ftp.gwdg.de:/pub/linux/misc/cdda2wav-sbpcd.*.tar.gz holds an example of | ||
411 | * such an algorithm. | ||
412 | * This example program further is missing to obtain the SubChannel data | ||
413 | * which belong to each frame. | ||
414 | * | ||
415 | * This is only an example of the low-level access routine. The read data are | ||
416 | * pure 16-bit CDDA values; they have to get converted to make sound out of | ||
417 | * them. | ||
418 | * It is no fun to listen to it without prior overlap/underlap correction! | ||
419 | */ | ||
420 | #include <stdio.h> | ||
421 | #include <sys/ioctl.h> | ||
422 | #include <sys/types.h> | ||
423 | #include <linux/cdrom.h> | ||
424 | |||
425 | static struct cdrom_tochdr hdr; | ||
426 | static struct cdrom_tocentry entry[101]; | ||
427 | static struct cdrom_read_audio arg; | ||
428 | static u_char buffer[CD_FRAMESIZE_RAW]; | ||
429 | static int datafile, drive; | ||
430 | static int i, j, limit, track, err; | ||
431 | static char filename[32]; | ||
432 | |||
433 | int main(int argc, char *argv[]) | ||
434 | { | ||
435 | /* | ||
436 | * open /dev/cdrom | ||
437 | */ | ||
438 | drive=open("/dev/cdrom", 0); | ||
439 | if (drive<0) | ||
440 | { | ||
441 | fprintf(stderr, "can't open drive.\n"); | ||
442 | exit (-1); | ||
443 | } | ||
444 | /* | ||
445 | * get TocHeader | ||
446 | */ | ||
447 | fprintf(stdout, "getting TocHeader...\n"); | ||
448 | err=ioctl(drive, CDROMREADTOCHDR, &hdr); | ||
449 | if (err!=0) | ||
450 | { | ||
451 | fprintf(stderr, "can't get TocHeader (error %d).\n", err); | ||
452 | exit (-1); | ||
453 | } | ||
454 | else | ||
455 | fprintf(stdout, "TocHeader: %d %d\n", hdr.cdth_trk0, hdr.cdth_trk1); | ||
456 | /* | ||
457 | * get and display all TocEntries | ||
458 | */ | ||
459 | fprintf(stdout, "getting TocEntries...\n"); | ||
460 | for (i=1;i<=hdr.cdth_trk1+1;i++) | ||
461 | { | ||
462 | if (i!=hdr.cdth_trk1+1) entry[i].cdte_track = i; | ||
463 | else entry[i].cdte_track = CDROM_LEADOUT; | ||
464 | entry[i].cdte_format = CDROM_LBA; | ||
465 | err=ioctl(drive, CDROMREADTOCENTRY, &entry[i]); | ||
466 | if (err!=0) | ||
467 | { | ||
468 | fprintf(stderr, "can't get TocEntry #%d (error %d).\n", i, err); | ||
469 | exit (-1); | ||
470 | } | ||
471 | else | ||
472 | { | ||
473 | fprintf(stdout, "TocEntry #%d: %1X %1X %06X %02X\n", | ||
474 | entry[i].cdte_track, | ||
475 | entry[i].cdte_adr, | ||
476 | entry[i].cdte_ctrl, | ||
477 | entry[i].cdte_addr.lba, | ||
478 | entry[i].cdte_datamode); | ||
479 | } | ||
480 | } | ||
481 | fprintf(stdout, "got all TocEntries.\n"); | ||
482 | /* | ||
483 | * ask for track number (not implemented here) | ||
484 | */ | ||
485 | track=1; | ||
486 | #if 0 /* just read a little piece (4 seconds) */ | ||
487 | entry[track+1].cdte_addr.lba=entry[track].cdte_addr.lba+300; | ||
488 | #endif | ||
489 | /* | ||
490 | * read track into file | ||
491 | */ | ||
492 | sprintf(filename, "track%02d\0", track); | ||
493 | datafile=creat(filename, 0755); | ||
494 | if (datafile<0) | ||
495 | { | ||
496 | fprintf(stderr, "can't open datafile %s.\n", filename); | ||
497 | exit (-1); | ||
498 | } | ||
499 | arg.addr.lba=entry[track].cdte_addr.lba; | ||
500 | arg.addr_format=CDROM_LBA; /* CDROM_MSF would be possible here, too. */ | ||
501 | arg.nframes=1; | ||
502 | arg.buf=&buffer[0]; | ||
503 | limit=entry[track+1].cdte_addr.lba; | ||
504 | for (;arg.addr.lba<limit;arg.addr.lba++) | ||
505 | { | ||
506 | err=ioctl(drive, CDROMREADAUDIO, &arg); | ||
507 | if (err!=0) | ||
508 | { | ||
509 | fprintf(stderr, "can't read abs. frame #%d (error %d).\n", | ||
510 | arg.addr.lba, err); | ||
511 | } | ||
512 | j=write(datafile, &buffer[0], CD_FRAMESIZE_RAW); | ||
513 | if (j!=CD_FRAMESIZE_RAW) | ||
514 | { | ||
515 | fprintf(stderr,"I/O error (datafile) at rel. frame %d\n", | ||
516 | arg.addr.lba-entry[track].cdte_addr.lba); | ||
517 | } | ||
518 | arg.addr.lba++; | ||
519 | } | ||
520 | return 0; | ||
521 | } | ||
522 | /*===================== end program ========================================*/ | ||
523 | |||
524 | At ftp.gwdg.de:/pub/linux/misc/cdda2wav-sbpcd.*.tar.gz is an adapted version of | ||
525 | Heiko Eissfeldt's digital-audio to .WAV converter (the original is there, too). | ||
526 | This is preliminary, as Heiko himself will care about it. | ||
527 | |||
528 | |||
529 | Known problems: | ||
530 | --------------- | ||
531 | |||
532 | Currently, the detection of disk change or removal is actively disabled. | ||
533 | |||
534 | Most attempts to read the UPC/EAN code result in a stream of zeroes. All my | ||
535 | drives are mostly telling there is no UPC/EAN code on disk or there is, but it | ||
536 | is an all-zero number. I guess now almost no CD holds such a number. | ||
537 | |||
538 | Bug reports, comments, wishes, donations (technical information is a donation, | ||
539 | too :-) etc. to emoenke@gwdg.de. | ||
540 | |||
541 | SnailMail address, preferable for CD editors if they want to submit a free | ||
542 | "cooperation" copy: | ||
543 | Eberhard Moenkeberg | ||
544 | Reinholdstr. 14 | ||
545 | D-37083 Goettingen | ||
546 | Germany | ||
547 | --- | ||
548 | |||
549 | |||
550 | Appendix -- the "cdtester" utility: | ||
551 | |||
552 | /* | ||
553 | * cdtester.c -- test the audio functions of a CD driver | ||
554 | * | ||
555 | * (c) 1995 Eberhard Moenkeberg <emoenke@gwdg.de> | ||
556 | * published under the GPL | ||
557 | * | ||
558 | * made under heavy use of the "Tiny Audio CD Player" | ||
559 | * from Werner Zimmermann <zimmerma@rz.fht-esslingen.de> | ||
560 | * (see linux/drivers/block/README.aztcd) | ||
561 | */ | ||
562 | #undef AZT_PRIVATE_IOCTLS /* not supported by every CDROM driver */ | ||
563 | #define SBP_PRIVATE_IOCTLS /* not supported by every CDROM driver */ | ||
564 | |||
565 | #include <stdio.h> | ||
566 | #include <stdio.h> | ||
567 | #include <malloc.h> | ||
568 | #include <sys/ioctl.h> | ||
569 | #include <sys/types.h> | ||
570 | #include <linux/cdrom.h> | ||
571 | |||
572 | #ifdef AZT_PRIVATE_IOCTLS | ||
573 | #include <linux/../../drivers/cdrom/aztcd.h> | ||
574 | #endif /* AZT_PRIVATE_IOCTLS */ | ||
575 | #ifdef SBP_PRIVATE_IOCTLS | ||
576 | #include <linux/../../drivers/cdrom/sbpcd.h> | ||
577 | #include <linux/fs.h> | ||
578 | #endif /* SBP_PRIVATE_IOCTLS */ | ||
579 | |||
580 | struct cdrom_tochdr hdr; | ||
581 | struct cdrom_tochdr tocHdr; | ||
582 | struct cdrom_tocentry TocEntry[101]; | ||
583 | struct cdrom_tocentry entry; | ||
584 | struct cdrom_multisession ms_info; | ||
585 | struct cdrom_read_audio read_audio; | ||
586 | struct cdrom_ti ti; | ||
587 | struct cdrom_subchnl subchnl; | ||
588 | struct cdrom_msf msf; | ||
589 | struct cdrom_volctrl volctrl; | ||
590 | #ifdef AZT_PRIVATE_IOCTLS | ||
591 | union | ||
592 | { | ||
593 | struct cdrom_msf msf; | ||
594 | unsigned char buf[CD_FRAMESIZE_RAW]; | ||
595 | } azt; | ||
596 | #endif /* AZT_PRIVATE_IOCTLS */ | ||
597 | int i, i1, i2, i3, j, k; | ||
598 | unsigned char sequence=0; | ||
599 | unsigned char command[80]; | ||
600 | unsigned char first=1, last=1; | ||
601 | char *default_device="/dev/cdrom"; | ||
602 | char dev[20]; | ||
603 | char filename[20]; | ||
604 | int drive; | ||
605 | int datafile; | ||
606 | int rc; | ||
607 | |||
608 | void help(void) | ||
609 | { | ||
610 | printf("Available Commands:\n"); | ||
611 | printf("STOP s EJECT e QUIT q\n"); | ||
612 | printf("PLAY TRACK t PAUSE p RESUME r\n"); | ||
613 | printf("NEXT TRACK n REPEAT LAST l HELP h\n"); | ||
614 | printf("SUBCHANNEL_Q c TRACK INFO i PLAY AT a\n"); | ||
615 | printf("READ d READ RAW w READ AUDIO A\n"); | ||
616 | printf("MS-INFO M TOC T START S\n"); | ||
617 | printf("SET EJECTSW X DEVICE D DEBUG Y\n"); | ||
618 | printf("AUDIO_BUFSIZ Z RESET R SET VOLUME v\n"); | ||
619 | printf("GET VOLUME V\n"); | ||
620 | } | ||
621 | |||
622 | /* | ||
623 | * convert MSF number (3 bytes only) to Logical_Block_Address | ||
624 | */ | ||
625 | int msf2lba(u_char *msf) | ||
626 | { | ||
627 | int i; | ||
628 | |||
629 | i=(msf[0] * CD_SECS + msf[1]) * CD_FRAMES + msf[2] - CD_BLOCK_OFFSET; | ||
630 | if (i<0) return (0); | ||
631 | return (i); | ||
632 | } | ||
633 | /* | ||
634 | * convert logical_block_address to m-s-f_number (3 bytes only) | ||
635 | */ | ||
636 | void lba2msf(int lba, unsigned char *msf) | ||
637 | { | ||
638 | lba += CD_BLOCK_OFFSET; | ||
639 | msf[0] = lba / (CD_SECS*CD_FRAMES); | ||
640 | lba %= CD_SECS*CD_FRAMES; | ||
641 | msf[1] = lba / CD_FRAMES; | ||
642 | msf[2] = lba % CD_FRAMES; | ||
643 | } | ||
644 | |||
645 | int init_drive(char *dev) | ||
646 | { | ||
647 | unsigned char msf_ent[3]; | ||
648 | |||
649 | /* | ||
650 | * open the device | ||
651 | */ | ||
652 | drive=open(dev,0); | ||
653 | if (drive<0) return (-1); | ||
654 | /* | ||
655 | * get TocHeader | ||
656 | */ | ||
657 | printf("getting TocHeader...\n"); | ||
658 | rc=ioctl(drive,CDROMREADTOCHDR,&hdr); | ||
659 | if (rc!=0) | ||
660 | { | ||
661 | printf("can't get TocHeader (error %d).\n",rc); | ||
662 | return (-2); | ||
663 | } | ||
664 | else | ||
665 | first=hdr.cdth_trk0; | ||
666 | last=hdr.cdth_trk1; | ||
667 | printf("TocHeader: %d %d\n",hdr.cdth_trk0,hdr.cdth_trk1); | ||
668 | /* | ||
669 | * get and display all TocEntries | ||
670 | */ | ||
671 | printf("getting TocEntries...\n"); | ||
672 | for (i=1;i<=hdr.cdth_trk1+1;i++) | ||
673 | { | ||
674 | if (i!=hdr.cdth_trk1+1) TocEntry[i].cdte_track = i; | ||
675 | else TocEntry[i].cdte_track = CDROM_LEADOUT; | ||
676 | TocEntry[i].cdte_format = CDROM_LBA; | ||
677 | rc=ioctl(drive,CDROMREADTOCENTRY,&TocEntry[i]); | ||
678 | if (rc!=0) | ||
679 | { | ||
680 | printf("can't get TocEntry #%d (error %d).\n",i,rc); | ||
681 | } | ||
682 | else | ||
683 | { | ||
684 | lba2msf(TocEntry[i].cdte_addr.lba,&msf_ent[0]); | ||
685 | if (TocEntry[i].cdte_track==CDROM_LEADOUT) | ||
686 | { | ||
687 | printf("TocEntry #%02X: %1X %1X %02d:%02d:%02d (lba: 0x%06X) %02X\n", | ||
688 | TocEntry[i].cdte_track, | ||
689 | TocEntry[i].cdte_adr, | ||
690 | TocEntry[i].cdte_ctrl, | ||
691 | msf_ent[0], | ||
692 | msf_ent[1], | ||
693 | msf_ent[2], | ||
694 | TocEntry[i].cdte_addr.lba, | ||
695 | TocEntry[i].cdte_datamode); | ||
696 | } | ||
697 | else | ||
698 | { | ||
699 | printf("TocEntry #%02d: %1X %1X %02d:%02d:%02d (lba: 0x%06X) %02X\n", | ||
700 | TocEntry[i].cdte_track, | ||
701 | TocEntry[i].cdte_adr, | ||
702 | TocEntry[i].cdte_ctrl, | ||
703 | msf_ent[0], | ||
704 | msf_ent[1], | ||
705 | msf_ent[2], | ||
706 | TocEntry[i].cdte_addr.lba, | ||
707 | TocEntry[i].cdte_datamode); | ||
708 | } | ||
709 | } | ||
710 | } | ||
711 | return (hdr.cdth_trk1); /* number of tracks */ | ||
712 | } | ||
713 | |||
714 | void display(int size,unsigned char *buffer) | ||
715 | { | ||
716 | k=0; | ||
717 | getchar(); | ||
718 | for (i=0;i<(size+1)/16;i++) | ||
719 | { | ||
720 | printf("%4d:",i*16); | ||
721 | for (j=0;j<16;j++) | ||
722 | { | ||
723 | printf(" %02X",buffer[i*16+j]); | ||
724 | } | ||
725 | printf(" "); | ||
726 | for (j=0;j<16;j++) | ||
727 | { | ||
728 | if (isalnum(buffer[i*16+j])) | ||
729 | printf("%c",buffer[i*16+j]); | ||
730 | else | ||
731 | printf("."); | ||
732 | } | ||
733 | printf("\n"); | ||
734 | k++; | ||
735 | if (k>=20) | ||
736 | { | ||
737 | printf("press ENTER to continue\n"); | ||
738 | getchar(); | ||
739 | k=0; | ||
740 | } | ||
741 | } | ||
742 | } | ||
743 | |||
744 | int main(int argc, char *argv[]) | ||
745 | { | ||
746 | printf("\nTesting tool for a CDROM driver's audio functions V0.1\n"); | ||
747 | printf("(C) 1995 Eberhard Moenkeberg <emoenke@gwdg.de>\n"); | ||
748 | printf("initializing...\n"); | ||
749 | |||
750 | rc=init_drive(default_device); | ||
751 | if (rc<0) printf("could not open %s (rc=%d).\n",default_device,rc); | ||
752 | help(); | ||
753 | while (1) | ||
754 | { | ||
755 | printf("Give a one-letter command (h = help): "); | ||
756 | scanf("%s",command); | ||
757 | command[1]=0; | ||
758 | switch (command[0]) | ||
759 | { | ||
760 | case 'D': | ||
761 | printf("device name (f.e. /dev/sbpcd3): ? "); | ||
762 | scanf("%s",&dev); | ||
763 | close(drive); | ||
764 | rc=init_drive(dev); | ||
765 | if (rc<0) printf("could not open %s (rc %d).\n",dev,rc); | ||
766 | break; | ||
767 | case 'e': | ||
768 | rc=ioctl(drive,CDROMEJECT); | ||
769 | if (rc<0) printf("CDROMEJECT: rc=%d.\n",rc); | ||
770 | break; | ||
771 | case 'p': | ||
772 | rc=ioctl(drive,CDROMPAUSE); | ||
773 | if (rc<0) printf("CDROMPAUSE: rc=%d.\n",rc); | ||
774 | break; | ||
775 | case 'r': | ||
776 | rc=ioctl(drive,CDROMRESUME); | ||
777 | if (rc<0) printf("CDROMRESUME: rc=%d.\n",rc); | ||
778 | break; | ||
779 | case 's': | ||
780 | rc=ioctl(drive,CDROMSTOP); | ||
781 | if (rc<0) printf("CDROMSTOP: rc=%d.\n",rc); | ||
782 | break; | ||
783 | case 'S': | ||
784 | rc=ioctl(drive,CDROMSTART); | ||
785 | if (rc<0) printf("CDROMSTART: rc=%d.\n",rc); | ||
786 | break; | ||
787 | case 't': | ||
788 | rc=ioctl(drive,CDROMREADTOCHDR,&tocHdr); | ||
789 | if (rc<0) | ||
790 | { | ||
791 | printf("CDROMREADTOCHDR: rc=%d.\n",rc); | ||
792 | break; | ||
793 | } | ||
794 | first=tocHdr.cdth_trk0; | ||
795 | last= tocHdr.cdth_trk1; | ||
796 | if ((first==0)||(first>last)) | ||
797 | { | ||
798 | printf ("--got invalid TOC data.\n"); | ||
799 | } | ||
800 | else | ||
801 | { | ||
802 | printf("--enter track number(first=%d, last=%d): ",first,last); | ||
803 | scanf("%d",&i1); | ||
804 | ti.cdti_trk0=i1; | ||
805 | if (ti.cdti_trk0<first) ti.cdti_trk0=first; | ||
806 | if (ti.cdti_trk0>last) ti.cdti_trk0=last; | ||
807 | ti.cdti_ind0=0; | ||
808 | ti.cdti_trk1=last; | ||
809 | ti.cdti_ind1=0; | ||
810 | rc=ioctl(drive,CDROMSTOP); | ||
811 | rc=ioctl(drive,CDROMPLAYTRKIND,&ti); | ||
812 | if (rc<0) printf("CDROMPLAYTRKIND: rc=%d.\n",rc); | ||
813 | } | ||
814 | break; | ||
815 | case 'n': | ||
816 | rc=ioctl(drive,CDROMSTOP); | ||
817 | if (++ti.cdti_trk0>last) ti.cdti_trk0=last; | ||
818 | ti.cdti_ind0=0; | ||
819 | ti.cdti_trk1=last; | ||
820 | ti.cdti_ind1=0; | ||
821 | rc=ioctl(drive,CDROMPLAYTRKIND,&ti); | ||
822 | if (rc<0) printf("CDROMPLAYTRKIND: rc=%d.\n",rc); | ||
823 | break; | ||
824 | case 'l': | ||
825 | rc=ioctl(drive,CDROMSTOP); | ||
826 | if (--ti.cdti_trk0<first) ti.cdti_trk0=first; | ||
827 | ti.cdti_ind0=0; | ||
828 | ti.cdti_trk1=last; | ||
829 | ti.cdti_ind1=0; | ||
830 | rc=ioctl(drive,CDROMPLAYTRKIND,&ti); | ||
831 | if (rc<0) printf("CDROMPLAYTRKIND: rc=%d.\n",rc); | ||
832 | break; | ||
833 | case 'c': | ||
834 | subchnl.cdsc_format=CDROM_MSF; | ||
835 | rc=ioctl(drive,CDROMSUBCHNL,&subchnl); | ||
836 | if (rc<0) printf("CDROMSUBCHNL: rc=%d.\n",rc); | ||
837 | else | ||
838 | { | ||
839 | printf("AudioStatus:%s Track:%d Mode:%d MSF=%02d:%02d:%02d\n", | ||
840 | subchnl.cdsc_audiostatus==CDROM_AUDIO_PLAY ? "PLAYING":"NOT PLAYING", | ||
841 | subchnl.cdsc_trk,subchnl.cdsc_adr, | ||
842 | subchnl.cdsc_absaddr.msf.minute, | ||
843 | subchnl.cdsc_absaddr.msf.second, | ||
844 | subchnl.cdsc_absaddr.msf.frame); | ||
845 | } | ||
846 | break; | ||
847 | case 'i': | ||
848 | printf("Track No.: "); | ||
849 | scanf("%d",&i1); | ||
850 | entry.cdte_track=i1; | ||
851 | if (entry.cdte_track<first) entry.cdte_track=first; | ||
852 | if (entry.cdte_track>last) entry.cdte_track=last; | ||
853 | entry.cdte_format=CDROM_MSF; | ||
854 | rc=ioctl(drive,CDROMREADTOCENTRY,&entry); | ||
855 | if (rc<0) printf("CDROMREADTOCENTRY: rc=%d.\n",rc); | ||
856 | else | ||
857 | { | ||
858 | printf("Mode %d Track, starts at %02d:%02d:%02d\n", | ||
859 | entry.cdte_adr, | ||
860 | entry.cdte_addr.msf.minute, | ||
861 | entry.cdte_addr.msf.second, | ||
862 | entry.cdte_addr.msf.frame); | ||
863 | } | ||
864 | break; | ||
865 | case 'a': | ||
866 | printf("Address (min:sec:frm) "); | ||
867 | scanf("%d:%d:%d",&i1,&i2,&i3); | ||
868 | msf.cdmsf_min0=i1; | ||
869 | msf.cdmsf_sec0=i2; | ||
870 | msf.cdmsf_frame0=i3; | ||
871 | if (msf.cdmsf_sec0>59) msf.cdmsf_sec0=59; | ||
872 | if (msf.cdmsf_frame0>74) msf.cdmsf_frame0=74; | ||
873 | lba2msf(TocEntry[last+1].cdte_addr.lba-1,&msf.cdmsf_min1); | ||
874 | rc=ioctl(drive,CDROMSTOP); | ||
875 | rc=ioctl(drive,CDROMPLAYMSF,&msf); | ||
876 | if (rc<0) printf("CDROMPLAYMSF: rc=%d.\n",rc); | ||
877 | break; | ||
878 | case 'V': | ||
879 | rc=ioctl(drive,CDROMVOLREAD,&volctrl); | ||
880 | if (rc<0) printf("CDROMVOLCTRL: rc=%d.\n",rc); | ||
881 | printf("Volume: channel 0 (left) %d, channel 1 (right) %d\n",volctrl.channel0,volctrl.channel1); | ||
882 | break; | ||
883 | case 'R': | ||
884 | rc=ioctl(drive,CDROMRESET); | ||
885 | if (rc<0) printf("CDROMRESET: rc=%d.\n",rc); | ||
886 | break; | ||
887 | #ifdef AZT_PRIVATE_IOCTLS /*not supported by every CDROM driver*/ | ||
888 | case 'd': | ||
889 | printf("Address (min:sec:frm) "); | ||
890 | scanf("%d:%d:%d",&i1,&i2,&i3); | ||
891 | azt.msf.cdmsf_min0=i1; | ||
892 | azt.msf.cdmsf_sec0=i2; | ||
893 | azt.msf.cdmsf_frame0=i3; | ||
894 | if (azt.msf.cdmsf_sec0>59) azt.msf.cdmsf_sec0=59; | ||
895 | if (azt.msf.cdmsf_frame0>74) azt.msf.cdmsf_frame0=74; | ||
896 | rc=ioctl(drive,CDROMREADMODE1,&azt.msf); | ||
897 | if (rc<0) printf("CDROMREADMODE1: rc=%d.\n",rc); | ||
898 | else display(CD_FRAMESIZE,azt.buf); | ||
899 | break; | ||
900 | case 'w': | ||
901 | printf("Address (min:sec:frame) "); | ||
902 | scanf("%d:%d:%d",&i1,&i2,&i3); | ||
903 | azt.msf.cdmsf_min0=i1; | ||
904 | azt.msf.cdmsf_sec0=i2; | ||
905 | azt.msf.cdmsf_frame0=i3; | ||
906 | if (azt.msf.cdmsf_sec0>59) azt.msf.cdmsf_sec0=59; | ||
907 | if (azt.msf.cdmsf_frame0>74) azt.msf.cdmsf_frame0=74; | ||
908 | rc=ioctl(drive,CDROMREADMODE2,&azt.msf); | ||
909 | if (rc<0) printf("CDROMREADMODE2: rc=%d.\n",rc); | ||
910 | else display(CD_FRAMESIZE_RAW,azt.buf); /* currently only 2336 */ | ||
911 | break; | ||
912 | #endif | ||
913 | case 'v': | ||
914 | printf("--Channel 0 (Left) (0-255): "); | ||
915 | scanf("%d",&i1); | ||
916 | volctrl.channel0=i1; | ||
917 | printf("--Channel 1 (Right) (0-255): "); | ||
918 | scanf("%d",&i1); | ||
919 | volctrl.channel1=i1; | ||
920 | volctrl.channel2=0; | ||
921 | volctrl.channel3=0; | ||
922 | rc=ioctl(drive,CDROMVOLCTRL,&volctrl); | ||
923 | if (rc<0) printf("CDROMVOLCTRL: rc=%d.\n",rc); | ||
924 | break; | ||
925 | case 'q': | ||
926 | close(drive); | ||
927 | exit(0); | ||
928 | case 'h': | ||
929 | help(); | ||
930 | break; | ||
931 | case 'T': /* display TOC entry - without involving the driver */ | ||
932 | scanf("%d",&i); | ||
933 | if ((i<hdr.cdth_trk0)||(i>hdr.cdth_trk1)) | ||
934 | printf("invalid track number.\n"); | ||
935 | else | ||
936 | printf("TocEntry %02d: adr=%01X ctrl=%01X msf=%02d:%02d:%02d mode=%02X\n", | ||
937 | TocEntry[i].cdte_track, | ||
938 | TocEntry[i].cdte_adr, | ||
939 | TocEntry[i].cdte_ctrl, | ||
940 | TocEntry[i].cdte_addr.msf.minute, | ||
941 | TocEntry[i].cdte_addr.msf.second, | ||
942 | TocEntry[i].cdte_addr.msf.frame, | ||
943 | TocEntry[i].cdte_datamode); | ||
944 | break; | ||
945 | case 'A': /* read audio data into file */ | ||
946 | printf("Address (min:sec:frm) ? "); | ||
947 | scanf("%d:%d:%d",&i1,&i2,&i3); | ||
948 | read_audio.addr.msf.minute=i1; | ||
949 | read_audio.addr.msf.second=i2; | ||
950 | read_audio.addr.msf.frame=i3; | ||
951 | read_audio.addr_format=CDROM_MSF; | ||
952 | printf("# of frames ? "); | ||
953 | scanf("%d",&i1); | ||
954 | read_audio.nframes=i1; | ||
955 | k=read_audio.nframes*CD_FRAMESIZE_RAW; | ||
956 | read_audio.buf=malloc(k); | ||
957 | if (read_audio.buf==NULL) | ||
958 | { | ||
959 | printf("can't malloc %d bytes.\n",k); | ||
960 | break; | ||
961 | } | ||
962 | sprintf(filename,"audio_%02d%02d%02d_%02d.%02d\0", | ||
963 | read_audio.addr.msf.minute, | ||
964 | read_audio.addr.msf.second, | ||
965 | read_audio.addr.msf.frame, | ||
966 | read_audio.nframes, | ||
967 | ++sequence); | ||
968 | datafile=creat(filename, 0755); | ||
969 | if (datafile<0) | ||
970 | { | ||
971 | printf("can't open datafile %s.\n",filename); | ||
972 | break; | ||
973 | } | ||
974 | rc=ioctl(drive,CDROMREADAUDIO,&read_audio); | ||
975 | if (rc!=0) | ||
976 | { | ||
977 | printf("CDROMREADAUDIO: rc=%d.\n",rc); | ||
978 | } | ||
979 | else | ||
980 | { | ||
981 | rc=write(datafile,&read_audio.buf,k); | ||
982 | if (rc!=k) printf("datafile I/O error (%d).\n",rc); | ||
983 | } | ||
984 | close(datafile); | ||
985 | break; | ||
986 | case 'X': /* set EJECT_SW (0: disable, 1: enable auto-ejecting) */ | ||
987 | scanf("%d",&i); | ||
988 | rc=ioctl(drive,CDROMEJECT_SW,i); | ||
989 | if (rc!=0) | ||
990 | printf("CDROMEJECT_SW: rc=%d.\n",rc); | ||
991 | else | ||
992 | printf("EJECT_SW set to %d\n",i); | ||
993 | break; | ||
994 | case 'M': /* get the multisession redirection info */ | ||
995 | ms_info.addr_format=CDROM_LBA; | ||
996 | rc=ioctl(drive,CDROMMULTISESSION,&ms_info); | ||
997 | if (rc!=0) | ||
998 | { | ||
999 | printf("CDROMMULTISESSION(lba): rc=%d.\n",rc); | ||
1000 | } | ||
1001 | else | ||
1002 | { | ||
1003 | if (ms_info.xa_flag) printf("MultiSession offset (lba): %d (0x%06X)\n",ms_info.addr.lba,ms_info.addr.lba); | ||
1004 | else | ||
1005 | { | ||
1006 | printf("this CD is not an XA disk.\n"); | ||
1007 | break; | ||
1008 | } | ||
1009 | } | ||
1010 | ms_info.addr_format=CDROM_MSF; | ||
1011 | rc=ioctl(drive,CDROMMULTISESSION,&ms_info); | ||
1012 | if (rc!=0) | ||
1013 | { | ||
1014 | printf("CDROMMULTISESSION(msf): rc=%d.\n",rc); | ||
1015 | } | ||
1016 | else | ||
1017 | { | ||
1018 | if (ms_info.xa_flag) | ||
1019 | printf("MultiSession offset (msf): %02d:%02d:%02d (0x%02X%02X%02X)\n", | ||
1020 | ms_info.addr.msf.minute, | ||
1021 | ms_info.addr.msf.second, | ||
1022 | ms_info.addr.msf.frame, | ||
1023 | ms_info.addr.msf.minute, | ||
1024 | ms_info.addr.msf.second, | ||
1025 | ms_info.addr.msf.frame); | ||
1026 | else printf("this CD is not an XA disk.\n"); | ||
1027 | } | ||
1028 | break; | ||
1029 | #ifdef SBP_PRIVATE_IOCTLS | ||
1030 | case 'Y': /* set the driver's message level */ | ||
1031 | #if 0 /* not implemented yet */ | ||
1032 | printf("enter switch name (f.e. DBG_CMD): "); | ||
1033 | scanf("%s",&dbg_switch); | ||
1034 | j=get_dbg_num(dbg_switch); | ||
1035 | #else | ||
1036 | printf("enter DDIOCSDBG switch number: "); | ||
1037 | scanf("%d",&j); | ||
1038 | #endif | ||
1039 | printf("enter 0 for \"off\", 1 for \"on\": "); | ||
1040 | scanf("%d",&i); | ||
1041 | if (i==0) j|=0x80; | ||
1042 | printf("calling \"ioctl(drive,DDIOCSDBG,%d)\"\n",j); | ||
1043 | rc=ioctl(drive,DDIOCSDBG,j); | ||
1044 | printf("DDIOCSDBG: rc=%d.\n",rc); | ||
1045 | break; | ||
1046 | case 'Z': /* set the audio buffer size */ | ||
1047 | printf("# frames wanted: ? "); | ||
1048 | scanf("%d",&j); | ||
1049 | rc=ioctl(drive,CDROMAUDIOBUFSIZ,j); | ||
1050 | printf("%d frames granted.\n",rc); | ||
1051 | break; | ||
1052 | #endif /* SBP_PRIVATE_IOCTLS */ | ||
1053 | default: | ||
1054 | printf("unknown command: \"%s\".\n",command); | ||
1055 | break; | ||
1056 | } | ||
1057 | } | ||
1058 | return 0; | ||
1059 | } | ||
1060 | /*==========================================================================*/ | ||
1061 | |||
diff --git a/Documentation/cdrom/sjcd b/Documentation/cdrom/sjcd deleted file mode 100644 index 74a14847b93a..000000000000 --- a/Documentation/cdrom/sjcd +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | -- Documentation/cdrom/sjcd | ||
2 | 80% of the work takes 20% of the time, | ||
3 | 20% of the work takes 80% of the time... | ||
4 | (Murphy's law) | ||
5 | |||
6 | Once started, training can not be stopped... | ||
7 | (Star Wars) | ||
8 | |||
9 | This is the README for the sjcd cdrom driver, version 1.6. | ||
10 | |||
11 | This file is meant as a tips & tricks edge for the usage of the SANYO CDR-H94A | ||
12 | cdrom drive. It will grow as the questions arise. ;-) | ||
13 | For info on configuring the ISP16 sound card look at Documentation/cdrom/isp16. | ||
14 | |||
15 | The driver should work with any of the Panasonic, Sony or Mitsumi style | ||
16 | CDROM interfaces. | ||
17 | The cdrom interface on Media Magic's soft configurable sound card ISP16, | ||
18 | which used to be included in the driver, is now supported in a separate module. | ||
19 | This initialisation module will probably also work with other interfaces | ||
20 | based on an OPTi 82C928 or 82C929 chip (like MAD16 and Mozart): see the | ||
21 | documentation Documentation/cdrom/isp16. | ||
22 | |||
23 | The device major for sjcd is 18, and minor is 0. Create a block special | ||
24 | file in your /dev directory (e.g., /dev/sjcd) with these numbers. | ||
25 | (For those who don't know, being root and doing the following should do | ||
26 | the trick: | ||
27 | mknod -m 644 /dev/sjcd b 18 0 | ||
28 | and mount the cdrom by /dev/sjcd). | ||
29 | |||
30 | The default configuration parameters are: | ||
31 | base address 0x340 | ||
32 | no irq | ||
33 | no dma | ||
34 | (Actually the CDR-H94A doesn't know how to use irq and dma.) | ||
35 | As of version 1.2, setting base address at boot time is supported | ||
36 | through the use of command line options: type at the "boot:" prompt: | ||
37 | linux sjcd=<base_address> | ||
38 | (where you would use the kernel labeled "linux" in lilo's configuration | ||
39 | file /etc/lilo.conf). You could also use 'append="sjcd=<configuration_info>"' | ||
40 | in the appropriate section of /etc/lilo.conf | ||
41 | If you're building a kernel yourself you can set your default base | ||
42 | i/o address with SJCD_BASE_ADDR in /usr/src/linux/drivers/cdrom/sjcd.h. | ||
43 | |||
44 | The sjcd driver supports being loaded as a module. The following | ||
45 | command will set the base i/o address on the fly (assuming you | ||
46 | have installed the module in an appropriate place). | ||
47 | insmod sjcd.o sjcd_base=<base_address> | ||
48 | |||
49 | |||
50 | Have fun! | ||
51 | |||
52 | If something is wrong, please email to vadim@rbrf.ru | ||
53 | or vadim@ipsun.ras.ru | ||
54 | or model@cecmow.enet.dec.com | ||
55 | or H.T.M.v.d.Maarel@marin.nl | ||
56 | |||
57 | It happens sometimes that Vadim is not reachable by mail. For these | ||
58 | instances, Eric van der Maarel will help too. | ||
59 | |||
60 | Vadim V. Model, Eric van der Maarel, Eberhard Moenkeberg | ||
diff --git a/Documentation/cdrom/sonycd535 b/Documentation/cdrom/sonycd535 deleted file mode 100644 index b81e109970aa..000000000000 --- a/Documentation/cdrom/sonycd535 +++ /dev/null | |||
@@ -1,122 +0,0 @@ | |||
1 | README FOR LINUX SONY CDU-535/531 DRIVER | ||
2 | ======================================== | ||
3 | |||
4 | This is the Sony CDU-535 (and 531) driver version 0.7 for Linux. | ||
5 | I do not think I have the documentation to add features like DMA support | ||
6 | so if anyone else wants to pursue it or help me with it, please do. | ||
7 | (I need to see what was done for the CDU-31A driver -- perhaps I can | ||
8 | steal some of that code.) | ||
9 | |||
10 | This is a Linux device driver for the Sony CDU-535 CDROM drive. This is | ||
11 | one of the older Sony drives with its own interface card (Sony bus). | ||
12 | The DOS driver for this drive is named SONY_CDU.SYS - when you boot DOS | ||
13 | your drive should be identified as a SONY CDU-535. The driver works | ||
14 | with a CDU-531 also. One user reported that the driver worked on drives | ||
15 | OEM'ed by Procomm, drive and interface board were labelled Procomm. | ||
16 | |||
17 | The Linux driver is based on Corey Minyard's sonycd 0.3 driver for | ||
18 | the CDU-31A. Ron Jeppesen just changed the commands that were sent | ||
19 | to the drive to correspond to the CDU-535 commands and registers. | ||
20 | There were enough changes to let bugs creep in but it seems to be stable. | ||
21 | Ron was able to tar an entire CDROM (should read all blocks) and built | ||
22 | ghostview and xfig off Walnut Creek's X11R5/GNU CDROM. xcdplayer and | ||
23 | workman work with the driver. Others have used the driver without | ||
24 | problems except those dealing with wait loops (fixed in third release). | ||
25 | Like Minyard's original driver this one uses a polled interface (this | ||
26 | is also the default setup for the DOS driver). It has not been tried | ||
27 | with interrupts or DMA enabled on the board. | ||
28 | |||
29 | REQUIREMENTS | ||
30 | ============ | ||
31 | |||
32 | - Sony CDU-535 drive, preferably without interrupts and DMA | ||
33 | enabled on the card. | ||
34 | |||
35 | - Drive must be set up as unit 1. Only the first unit will be | ||
36 | recognized | ||
37 | |||
38 | - You must enter your interface address into | ||
39 | /usr/src/linux/drivers/cdrom/sonycd535.h and build the | ||
40 | appropriate kernel or use the "kernel command line" parameter | ||
41 | sonycd535=0x320 | ||
42 | with the correct interface address. | ||
43 | |||
44 | NOTES: | ||
45 | ====== | ||
46 | |||
47 | 1) The drive MUST be turned on when booting or it will not be recognized! | ||
48 | (but see comments on modularized version below) | ||
49 | |||
50 | 2) when the cdrom device is opened the eject button is disabled to keep the | ||
51 | user from ejecting a mounted disk and replacing it with another. | ||
52 | Unfortunately xcdplayer and workman also open the cdrom device so you | ||
53 | have to use the eject button in the software. Keep this in mind if your | ||
54 | cdrom player refuses to give up its disk -- exit workman or xcdplayer, or | ||
55 | umount the drive if it has been mounted. | ||
56 | |||
57 | THANKS | ||
58 | ====== | ||
59 | |||
60 | Many thanks to Ron Jeppesen (ronj.an@site007.saic.com) for getting | ||
61 | this project off the ground. He wrote the initial release | ||
62 | and the first two patches to this driver (0.1, 0.2, and 0.3). | ||
63 | Thanks also to Eberhard Moenkeberg (emoenke@gwdg.de) for prodding | ||
64 | me to place this code into the mainstream Linux source tree | ||
65 | (as of Linux version 1.1.91), as well as some patches to make | ||
66 | it a better device citizen. Further thanks to Joel Katz | ||
67 | <joelkatz@webchat.org> for his MODULE patches (see details below), | ||
68 | Porfiri Claudio <C.Porfiri@nisms.tei.ericsson.se> for patches | ||
69 | to make the driver work with the older CDU-510/515 series, and | ||
70 | Heiko Eissfeldt <heiko@colossus.escape.de> for pointing out that | ||
71 | the verify_area() checks were ignoring the results of said checks | ||
72 | (note: verify_area() has since been replaced by access_ok()). | ||
73 | |||
74 | (Acknowledgments from Ron Jeppesen in the 0.3 release:) | ||
75 | Thanks to Corey Minyard who wrote the original CDU-31A driver on which | ||
76 | this driver is based. Thanks to Ken Pizzini and Bob Blair who provided | ||
77 | patches and feedback on the first release of this driver. | ||
78 | |||
79 | Ken Pizzini | ||
80 | ken@halcyon.com | ||
81 | |||
82 | ------------------------------------------------------------------------------ | ||
83 | (The following is from Joel Katz <joelkatz@webchat.org>.) | ||
84 | |||
85 | To build a version of sony535.o that can be installed as a module, | ||
86 | use the following command: | ||
87 | |||
88 | gcc -c -D__KERNEL__ -DMODULE -O2 sonycd535.c -o sonycd535.o | ||
89 | |||
90 | To install the module, simply type: | ||
91 | |||
92 | insmod sony535.o | ||
93 | or | ||
94 | insmod sony535.o sonycd535=<address> | ||
95 | |||
96 | And to remove it: | ||
97 | |||
98 | rmmod sony535 | ||
99 | |||
100 | The code checks to see if MODULE is defined and behaves as it used | ||
101 | to if MODULE is not defined. That means your patched file should behave | ||
102 | exactly as it used to if compiled into the kernel. | ||
103 | |||
104 | I have an external drive, and I usually leave it powered off. I used | ||
105 | to have to reboot if I needed to use the CDROM drive. Now I don't. | ||
106 | |||
107 | Even if you have an internal drive, why waste the 96K of memory | ||
108 | (unswappable) that the driver uses if you use your CD-ROM drive infrequently? | ||
109 | |||
110 | This driver will not install (whether compiled in or loaded as a | ||
111 | module) if the CDROM drive is not available during its initialization. This | ||
112 | means that you can have the driver compiled into the kernel and still load | ||
113 | the module later (assuming the driver doesn't install itself during | ||
114 | power-on). This only wastes 12K when you boot with the CDROM drive off. | ||
115 | |||
116 | This is what I usually do; I leave the driver compiled into the | ||
117 | kernel, but load it as a module if I powered the system up with the drive | ||
118 | off and then later decided to use the CDROM drive. | ||
119 | |||
120 | Since the driver only uses a single page to point to the chunks, | ||
121 | attempting to set the buffer cache to more than 2 Megabytes would be very | ||
122 | bad; don't do that. | ||
diff --git a/Documentation/connector/cn_test.c b/Documentation/connector/cn_test.c index 3e73231695b3..be7af146dd30 100644 --- a/Documentation/connector/cn_test.c +++ b/Documentation/connector/cn_test.c | |||
@@ -124,9 +124,8 @@ static void cn_test_timer_func(unsigned long __data) | |||
124 | struct cn_msg *m; | 124 | struct cn_msg *m; |
125 | char data[32]; | 125 | char data[32]; |
126 | 126 | ||
127 | m = kmalloc(sizeof(*m) + sizeof(data), GFP_ATOMIC); | 127 | m = kzalloc(sizeof(*m) + sizeof(data), GFP_ATOMIC); |
128 | if (m) { | 128 | if (m) { |
129 | memset(m, 0, sizeof(*m) + sizeof(data)); | ||
130 | 129 | ||
131 | memcpy(&m->id, &cn_test_id, sizeof(m->id)); | 130 | memcpy(&m->id, &cn_test_id, sizeof(m->id)); |
132 | m->seq = cn_test_timer_counter; | 131 | m->seq = cn_test_timer_counter; |
diff --git a/Documentation/console/console.txt b/Documentation/console/console.txt index d3e17447321c..877a1b26cc3d 100644 --- a/Documentation/console/console.txt +++ b/Documentation/console/console.txt | |||
@@ -29,7 +29,7 @@ In newer kernels, the following are also available: | |||
29 | 29 | ||
30 | If sysfs is enabled, the contents of /sys/class/vtconsole can be | 30 | If sysfs is enabled, the contents of /sys/class/vtconsole can be |
31 | examined. This shows the console backends currently registered by the | 31 | examined. This shows the console backends currently registered by the |
32 | system which are named vtcon<n> where <n> is an integer fro 0 to 15. Thus: | 32 | system which are named vtcon<n> where <n> is an integer from 0 to 15. Thus: |
33 | 33 | ||
34 | ls /sys/class/vtconsole | 34 | ls /sys/class/vtconsole |
35 | . .. vtcon0 vtcon1 | 35 | . .. vtcon0 vtcon1 |
diff --git a/Documentation/driver-model/devres.txt b/Documentation/driver-model/devres.txt index 6c8d8f27db34..8569072fa387 100644 --- a/Documentation/driver-model/devres.txt +++ b/Documentation/driver-model/devres.txt | |||
@@ -207,7 +207,7 @@ responsibility. This is usually non-issue because bus ops and | |||
207 | resource allocations already do the job. | 207 | resource allocations already do the job. |
208 | 208 | ||
209 | For an example of single-instance devres type, read pcim_iomap_table() | 209 | For an example of single-instance devres type, read pcim_iomap_table() |
210 | in lib/iomap.c. | 210 | in lib/devres.c. |
211 | 211 | ||
212 | All devres interface functions can be called without context if the | 212 | All devres interface functions can be called without context if the |
213 | right gfp mask is given. | 213 | right gfp mask is given. |
diff --git a/Documentation/driver-model/platform.txt b/Documentation/driver-model/platform.txt index 19c4a6e13676..2a97320ee17f 100644 --- a/Documentation/driver-model/platform.txt +++ b/Documentation/driver-model/platform.txt | |||
@@ -96,6 +96,46 @@ System setup also associates those clocks with the device, so that that | |||
96 | calls to clk_get(&pdev->dev, clock_name) return them as needed. | 96 | calls to clk_get(&pdev->dev, clock_name) return them as needed. |
97 | 97 | ||
98 | 98 | ||
99 | Legacy Drivers: Device Probing | ||
100 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
101 | Some drivers are not fully converted to the driver model, because they take | ||
102 | on a non-driver role: the driver registers its platform device, rather than | ||
103 | leaving that for system infrastructure. Such drivers can't be hotplugged | ||
104 | or coldplugged, since those mechanisms require device creation to be in a | ||
105 | different system component than the driver. | ||
106 | |||
107 | The only "good" reason for this is to handle older system designs which, like | ||
108 | original IBM PCs, rely on error-prone "probe-the-hardware" models for hardware | ||
109 | configuration. Newer systems have largely abandoned that model, in favor of | ||
110 | bus-level support for dynamic configuration (PCI, USB), or device tables | ||
111 | provided by the boot firmware (e.g. PNPACPI on x86). There are too many | ||
112 | conflicting options about what might be where, and even educated guesses by | ||
113 | an operating system will be wrong often enough to make trouble. | ||
114 | |||
115 | This style of driver is discouraged. If you're updating such a driver, | ||
116 | please try to move the device enumeration to a more appropriate location, | ||
117 | outside the driver. This will usually be cleanup, since such drivers | ||
118 | tend to already have "normal" modes, such as ones using device nodes that | ||
119 | were created by PNP or by platform device setup. | ||
120 | |||
121 | None the less, there are some APIs to support such legacy drivers. Avoid | ||
122 | using these calls except with such hotplug-deficient drivers. | ||
123 | |||
124 | struct platform_device *platform_device_alloc( | ||
125 | char *name, unsigned id); | ||
126 | |||
127 | You can use platform_device_alloc() to dynamically allocate a device, which | ||
128 | you will then initialize with resources and platform_device_register(). | ||
129 | A better solution is usually: | ||
130 | |||
131 | struct platform_device *platform_device_register_simple( | ||
132 | char *name, unsigned id, | ||
133 | struct resource *res, unsigned nres); | ||
134 | |||
135 | You can use platform_device_register_simple() as a one-step call to allocate | ||
136 | and register a device. | ||
137 | |||
138 | |||
99 | Device Naming and Driver Binding | 139 | Device Naming and Driver Binding |
100 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 140 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
101 | The platform_device.dev.bus_id is the canonical name for the devices. | 141 | The platform_device.dev.bus_id is the canonical name for the devices. |
diff --git a/Documentation/drivers/edac/edac.txt b/Documentation/drivers/edac/edac.txt index 3c5a9e4297b4..a5c36842ecef 100644 --- a/Documentation/drivers/edac/edac.txt +++ b/Documentation/drivers/edac/edac.txt | |||
@@ -2,22 +2,42 @@ | |||
2 | 2 | ||
3 | EDAC - Error Detection And Correction | 3 | EDAC - Error Detection And Correction |
4 | 4 | ||
5 | Written by Doug Thompson <norsk5@xmission.com> | 5 | Written by Doug Thompson <dougthompson@xmission.com> |
6 | 7 Dec 2005 | 6 | 7 Dec 2005 |
7 | 17 Jul 2007 Updated | ||
7 | 8 | ||
8 | 9 | ||
9 | EDAC was written by: | 10 | EDAC is maintained and written by: |
10 | Thayne Harbaugh, | ||
11 | modified by Dave Peterson, Doug Thompson, et al, | ||
12 | from the bluesmoke.sourceforge.net project. | ||
13 | 11 | ||
12 | Doug Thompson, Dave Jiang, Dave Peterson et al, | ||
13 | original author: Thayne Harbaugh, | ||
14 | |||
15 | Contact: | ||
16 | website: bluesmoke.sourceforge.net | ||
17 | mailing list: bluesmoke-devel@lists.sourceforge.net | ||
18 | |||
19 | "bluesmoke" was the name for this device driver when it was "out-of-tree" | ||
20 | and maintained at sourceforge.net. When it was pushed into 2.6.16 for the | ||
21 | first time, it was renamed to 'EDAC'. | ||
22 | |||
23 | The bluesmoke project at sourceforge.net is now utilized as a 'staging area' | ||
24 | for EDAC development, before it is sent upstream to kernel.org | ||
25 | |||
26 | At the bluesmoke/EDAC project site, is a series of quilt patches against | ||
27 | recent kernels, stored in a SVN respository. For easier downloading, there | ||
28 | is also a tarball snapshot available. | ||
14 | 29 | ||
15 | ============================================================================ | 30 | ============================================================================ |
16 | EDAC PURPOSE | 31 | EDAC PURPOSE |
17 | 32 | ||
18 | The 'edac' kernel module goal is to detect and report errors that occur | 33 | The 'edac' kernel module goal is to detect and report errors that occur |
19 | within the computer system. In the initial release, memory Correctable Errors | 34 | within the computer system running under linux. |
20 | (CE) and Uncorrectable Errors (UE) are the primary errors being harvested. | 35 | |
36 | MEMORY | ||
37 | |||
38 | In the initial release, memory Correctable Errors (CE) and Uncorrectable | ||
39 | Errors (UE) are the primary errors being harvested. These types of errors | ||
40 | are harvested by the 'edac_mc' class of device. | ||
21 | 41 | ||
22 | Detecting CE events, then harvesting those events and reporting them, | 42 | Detecting CE events, then harvesting those events and reporting them, |
23 | CAN be a predictor of future UE events. With CE events, the system can | 43 | CAN be a predictor of future UE events. With CE events, the system can |
@@ -25,9 +45,27 @@ continue to operate, but with less safety. Preventive maintenance and | |||
25 | proactive part replacement of memory DIMMs exhibiting CEs can reduce | 45 | proactive part replacement of memory DIMMs exhibiting CEs can reduce |
26 | the likelihood of the dreaded UE events and system 'panics'. | 46 | the likelihood of the dreaded UE events and system 'panics'. |
27 | 47 | ||
48 | NON-MEMORY | ||
49 | |||
50 | A new feature for EDAC, the edac_device class of device, was added in | ||
51 | the 2.6.23 version of the kernel. | ||
52 | |||
53 | This new device type allows for non-memory type of ECC hardware detectors | ||
54 | to have their states harvested and presented to userspace via the sysfs | ||
55 | interface. | ||
56 | |||
57 | Some architectures have ECC detectors for L1, L2 and L3 caches, along with DMA | ||
58 | engines, fabric switches, main data path switches, interconnections, | ||
59 | and various other hardware data paths. If the hardware reports it, then | ||
60 | a edac_device device probably can be constructed to harvest and present | ||
61 | that to userspace. | ||
62 | |||
63 | |||
64 | PCI BUS SCANNING | ||
28 | 65 | ||
29 | In addition, PCI Bus Parity and SERR Errors are scanned for on PCI devices | 66 | In addition, PCI Bus Parity and SERR Errors are scanned for on PCI devices |
30 | in order to determine if errors are occurring on data transfers. | 67 | in order to determine if errors are occurring on data transfers. |
68 | |||
31 | The presence of PCI Parity errors must be examined with a grain of salt. | 69 | The presence of PCI Parity errors must be examined with a grain of salt. |
32 | There are several add-in adapters that do NOT follow the PCI specification | 70 | There are several add-in adapters that do NOT follow the PCI specification |
33 | with regards to Parity generation and reporting. The specification says | 71 | with regards to Parity generation and reporting. The specification says |
@@ -35,11 +73,17 @@ the vendor should tie the parity status bits to 0 if they do not intend | |||
35 | to generate parity. Some vendors do not do this, and thus the parity bit | 73 | to generate parity. Some vendors do not do this, and thus the parity bit |
36 | can "float" giving false positives. | 74 | can "float" giving false positives. |
37 | 75 | ||
38 | [There are patches in the kernel queue which will allow for storage of | 76 | In the kernel there is a pci device attribute located in sysfs that is |
39 | quirks of PCI devices reporting false parity positives. The 2.6.18 | 77 | checked by the EDAC PCI scanning code. If that attribute is set, |
40 | kernel should have those patches included. When that becomes available, | 78 | PCI parity/error scannining is skipped for that device. The attribute |
41 | then EDAC will be patched to utilize that information to "skip" such | 79 | is: |
42 | devices.] | 80 | |
81 | broken_parity_status | ||
82 | |||
83 | as is located in /sys/devices/pci<XXX>/0000:XX:YY.Z directorys for | ||
84 | PCI devices. | ||
85 | |||
86 | FUTURE HARDWARE SCANNING | ||
43 | 87 | ||
44 | EDAC will have future error detectors that will be integrated with | 88 | EDAC will have future error detectors that will be integrated with |
45 | EDAC or added to it, in the following list: | 89 | EDAC or added to it, in the following list: |
@@ -57,13 +101,14 @@ and the like. | |||
57 | ============================================================================ | 101 | ============================================================================ |
58 | EDAC VERSIONING | 102 | EDAC VERSIONING |
59 | 103 | ||
60 | EDAC is composed of a "core" module (edac_mc.ko) and several Memory | 104 | EDAC is composed of a "core" module (edac_core.ko) and several Memory |
61 | Controller (MC) driver modules. On a given system, the CORE | 105 | Controller (MC) driver modules. On a given system, the CORE |
62 | is loaded and one MC driver will be loaded. Both the CORE and | 106 | is loaded and one MC driver will be loaded. Both the CORE and |
63 | the MC driver have individual versions that reflect current release | 107 | the MC driver (or edac_device driver) have individual versions that reflect |
64 | level of their respective modules. Thus, to "report" on what version | 108 | current release level of their respective modules. |
65 | a system is running, one must report both the CORE's and the | 109 | |
66 | MC driver's versions. | 110 | Thus, to "report" on what version a system is running, one must report both |
111 | the CORE's and the MC driver's versions. | ||
67 | 112 | ||
68 | 113 | ||
69 | LOADING | 114 | LOADING |
@@ -88,8 +133,9 @@ EDAC sysfs INTERFACE | |||
88 | EDAC presents a 'sysfs' interface for control, reporting and attribute | 133 | EDAC presents a 'sysfs' interface for control, reporting and attribute |
89 | reporting purposes. | 134 | reporting purposes. |
90 | 135 | ||
91 | EDAC lives in the /sys/devices/system/edac directory. Within this directory | 136 | EDAC lives in the /sys/devices/system/edac directory. |
92 | there currently reside 2 'edac' components: | 137 | |
138 | Within this directory there currently reside 2 'edac' components: | ||
93 | 139 | ||
94 | mc memory controller(s) system | 140 | mc memory controller(s) system |
95 | pci PCI control and status system | 141 | pci PCI control and status system |
@@ -188,7 +234,7 @@ In directory 'mc' are EDAC system overall control and attribute files: | |||
188 | 234 | ||
189 | Panic on UE control file: | 235 | Panic on UE control file: |
190 | 236 | ||
191 | 'panic_on_ue' | 237 | 'edac_mc_panic_on_ue' |
192 | 238 | ||
193 | An uncorrectable error will cause a machine panic. This is usually | 239 | An uncorrectable error will cause a machine panic. This is usually |
194 | desirable. It is a bad idea to continue when an uncorrectable error | 240 | desirable. It is a bad idea to continue when an uncorrectable error |
@@ -199,12 +245,12 @@ Panic on UE control file: | |||
199 | 245 | ||
200 | LOAD TIME: module/kernel parameter: panic_on_ue=[0|1] | 246 | LOAD TIME: module/kernel parameter: panic_on_ue=[0|1] |
201 | 247 | ||
202 | RUN TIME: echo "1" >/sys/devices/system/edac/mc/panic_on_ue | 248 | RUN TIME: echo "1" >/sys/devices/system/edac/mc/edac_mc_panic_on_ue |
203 | 249 | ||
204 | 250 | ||
205 | Log UE control file: | 251 | Log UE control file: |
206 | 252 | ||
207 | 'log_ue' | 253 | 'edac_mc_log_ue' |
208 | 254 | ||
209 | Generate kernel messages describing uncorrectable errors. These errors | 255 | Generate kernel messages describing uncorrectable errors. These errors |
210 | are reported through the system message log system. UE statistics | 256 | are reported through the system message log system. UE statistics |
@@ -212,12 +258,12 @@ Log UE control file: | |||
212 | 258 | ||
213 | LOAD TIME: module/kernel parameter: log_ue=[0|1] | 259 | LOAD TIME: module/kernel parameter: log_ue=[0|1] |
214 | 260 | ||
215 | RUN TIME: echo "1" >/sys/devices/system/edac/mc/log_ue | 261 | RUN TIME: echo "1" >/sys/devices/system/edac/mc/edac_mc_log_ue |
216 | 262 | ||
217 | 263 | ||
218 | Log CE control file: | 264 | Log CE control file: |
219 | 265 | ||
220 | 'log_ce' | 266 | 'edac_mc_log_ce' |
221 | 267 | ||
222 | Generate kernel messages describing correctable errors. These | 268 | Generate kernel messages describing correctable errors. These |
223 | errors are reported through the system message log system. | 269 | errors are reported through the system message log system. |
@@ -225,12 +271,12 @@ Log CE control file: | |||
225 | 271 | ||
226 | LOAD TIME: module/kernel parameter: log_ce=[0|1] | 272 | LOAD TIME: module/kernel parameter: log_ce=[0|1] |
227 | 273 | ||
228 | RUN TIME: echo "1" >/sys/devices/system/edac/mc/log_ce | 274 | RUN TIME: echo "1" >/sys/devices/system/edac/mc/edac_mc_log_ce |
229 | 275 | ||
230 | 276 | ||
231 | Polling period control file: | 277 | Polling period control file: |
232 | 278 | ||
233 | 'poll_msec' | 279 | 'edac_mc_poll_msec' |
234 | 280 | ||
235 | The time period, in milliseconds, for polling for error information. | 281 | The time period, in milliseconds, for polling for error information. |
236 | Too small a value wastes resources. Too large a value might delay | 282 | Too small a value wastes resources. Too large a value might delay |
@@ -241,7 +287,7 @@ Polling period control file: | |||
241 | 287 | ||
242 | LOAD TIME: module/kernel parameter: poll_msec=[0|1] | 288 | LOAD TIME: module/kernel parameter: poll_msec=[0|1] |
243 | 289 | ||
244 | RUN TIME: echo "1000" >/sys/devices/system/edac/mc/poll_msec | 290 | RUN TIME: echo "1000" >/sys/devices/system/edac/mc/edac_mc_poll_msec |
245 | 291 | ||
246 | 292 | ||
247 | ============================================================================ | 293 | ============================================================================ |
@@ -587,3 +633,95 @@ Parity Count: | |||
587 | 633 | ||
588 | 634 | ||
589 | ======================================================================= | 635 | ======================================================================= |
636 | |||
637 | |||
638 | EDAC_DEVICE type of device | ||
639 | |||
640 | In the header file, edac_core.h, there is a series of edac_device structures | ||
641 | and APIs for the EDAC_DEVICE. | ||
642 | |||
643 | User space access to an edac_device is through the sysfs interface. | ||
644 | |||
645 | At the location /sys/devices/system/edac (sysfs) new edac_device devices will | ||
646 | appear. | ||
647 | |||
648 | There is a three level tree beneath the above 'edac' directory. For example, | ||
649 | the 'test_device_edac' device (found at the bluesmoke.sourceforget.net website) | ||
650 | installs itself as: | ||
651 | |||
652 | /sys/devices/systm/edac/test-instance | ||
653 | |||
654 | in this directory are various controls, a symlink and one or more 'instance' | ||
655 | directorys. | ||
656 | |||
657 | The standard default controls are: | ||
658 | |||
659 | log_ce boolean to log CE events | ||
660 | log_ue boolean to log UE events | ||
661 | panic_on_ue boolean to 'panic' the system if an UE is encountered | ||
662 | (default off, can be set true via startup script) | ||
663 | poll_msec time period between POLL cycles for events | ||
664 | |||
665 | The test_device_edac device adds at least one of its own custom control: | ||
666 | |||
667 | test_bits which in the current test driver does nothing but | ||
668 | show how it is installed. A ported driver can | ||
669 | add one or more such controls and/or attributes | ||
670 | for specific uses. | ||
671 | One out-of-tree driver uses controls here to allow | ||
672 | for ERROR INJECTION operations to hardware | ||
673 | injection registers | ||
674 | |||
675 | The symlink points to the 'struct dev' that is registered for this edac_device. | ||
676 | |||
677 | INSTANCES | ||
678 | |||
679 | One or more instance directories are present. For the 'test_device_edac' case: | ||
680 | |||
681 | test-instance0 | ||
682 | |||
683 | |||
684 | In this directory there are two default counter attributes, which are totals of | ||
685 | counter in deeper subdirectories. | ||
686 | |||
687 | ce_count total of CE events of subdirectories | ||
688 | ue_count total of UE events of subdirectories | ||
689 | |||
690 | BLOCKS | ||
691 | |||
692 | At the lowest directory level is the 'block' directory. There can be 0, 1 | ||
693 | or more blocks specified in each instance. | ||
694 | |||
695 | test-block0 | ||
696 | |||
697 | |||
698 | In this directory the default attributes are: | ||
699 | |||
700 | ce_count which is counter of CE events for this 'block' | ||
701 | of hardware being monitored | ||
702 | ue_count which is counter of UE events for this 'block' | ||
703 | of hardware being monitored | ||
704 | |||
705 | |||
706 | The 'test_device_edac' device adds 4 attributes and 1 control: | ||
707 | |||
708 | test-block-bits-0 for every POLL cycle this counter | ||
709 | is incremented | ||
710 | test-block-bits-1 every 10 cycles, this counter is bumped once, | ||
711 | and test-block-bits-0 is set to 0 | ||
712 | test-block-bits-2 every 100 cycles, this counter is bumped once, | ||
713 | and test-block-bits-1 is set to 0 | ||
714 | test-block-bits-3 every 1000 cycles, this counter is bumped once, | ||
715 | and test-block-bits-2 is set to 0 | ||
716 | |||
717 | |||
718 | reset-counters writing ANY thing to this control will | ||
719 | reset all the above counters. | ||
720 | |||
721 | |||
722 | Use of the 'test_device_edac' driver should any others to create their own | ||
723 | unique drivers for their hardware systems. | ||
724 | |||
725 | The 'test_device_edac' sample driver is located at the | ||
726 | bluesmoke.sourceforge.net project site for EDAC. | ||
727 | |||
diff --git a/Documentation/dvb/bt8xx.txt b/Documentation/dvb/bt8xx.txt index 4e7614e606c5..ecb47adda063 100644 --- a/Documentation/dvb/bt8xx.txt +++ b/Documentation/dvb/bt8xx.txt | |||
@@ -9,19 +9,29 @@ for accessing the i2c bus and the gpio pins of the bt8xx chipset. | |||
9 | Please see Documentation/dvb/cards.txt => o Cards based on the Conexant Bt8xx PCI bridge: | 9 | Please see Documentation/dvb/cards.txt => o Cards based on the Conexant Bt8xx PCI bridge: |
10 | 10 | ||
11 | Compiling kernel please enable: | 11 | Compiling kernel please enable: |
12 | a.)"Device drivers" => "Multimedia devices" => "Video For Linux" => "BT848 Video For Linux" | 12 | a.)"Device drivers" => "Multimedia devices" => "Video For Linux" => "Enable Video for Linux API 1 (DEPRECATED)" |
13 | b.)"Device drivers" => "Multimedia devices" => "Digital Video Broadcasting Devices" | 13 | b.)"Device drivers" => "Multimedia devices" => "Video For Linux" => "Video Capture Adapters" => "BT848 Video For Linux" |
14 | => "DVB for Linux" "DVB Core Support" "Bt8xx based PCI Cards" | 14 | c.)"Device drivers" => "Multimedia devices" => "Digital Video Broadcasting Devices" => "DVB for Linux" "DVB Core Support" "Bt8xx based PCI Cards" |
15 | 15 | ||
16 | 2) Loading Modules | 16 | Please use the following options with care as deselection of drivers which are in fact necessary |
17 | ================== | 17 | may result in DVB devices that cannot be tuned due to lack of driver support: |
18 | You can save RAM by deselecting every frontend module that your DVB card does not need. | ||
19 | |||
20 | First please remove the static dependency of DVB card drivers on all frontend modules for all possible card variants by enabling: | ||
21 | d.) "Device drivers" => "Multimedia devices" => "Digital Video Broadcasting Devices" | ||
22 | => "DVB for Linux" "DVB Core Support" "Load and attach frontend modules as needed" | ||
18 | 23 | ||
19 | In default cases bttv is loaded automatically. | 24 | If you know the frontend driver that your card needs please enable: |
20 | To load the backend either place dvb-bt8xx in etc/modules, or apply manually: | 25 | e.)"Device drivers" => "Multimedia devices" => "Digital Video Broadcasting Devices" |
26 | => "DVB for Linux" "DVB Core Support" "Customise DVB Frontends" => "Customise the frontend modules to build" | ||
27 | Then please select your card-specific frontend module. | ||
21 | 28 | ||
22 | $ modprobe dvb-bt8xx | 29 | 2) Loading Modules |
30 | ================== | ||
23 | 31 | ||
24 | All frontends will be loaded automatically. | 32 | Regular case: If the bttv driver detects a bt8xx-based DVB card, all frontend and backend modules will be loaded automatically. |
33 | Exceptions are: | ||
34 | - Old TwinHan DST cards or clones with or without CA slot and not containing an Eeprom. | ||
25 | People running udev please see Documentation/dvb/udev.txt. | 35 | People running udev please see Documentation/dvb/udev.txt. |
26 | 36 | ||
27 | In the following cases overriding the PCI type detection for dvb-bt8xx might be necessary: | 37 | In the following cases overriding the PCI type detection for dvb-bt8xx might be necessary: |
@@ -30,7 +40,6 @@ In the following cases overriding the PCI type detection for dvb-bt8xx might be | |||
30 | ------------------------------ | 40 | ------------------------------ |
31 | 41 | ||
32 | $ modprobe bttv card=113 | 42 | $ modprobe bttv card=113 |
33 | $ modprobe dvb-bt8xx | ||
34 | $ modprobe dst | 43 | $ modprobe dst |
35 | 44 | ||
36 | Useful parameters for verbosity level and debugging the dst module: | 45 | Useful parameters for verbosity level and debugging the dst module: |
@@ -65,10 +74,9 @@ DViCO FusionHDTV 5 Lite: 135 | |||
65 | Notice: The order of the card ID should be uprising: | 74 | Notice: The order of the card ID should be uprising: |
66 | Example: | 75 | Example: |
67 | $ modprobe bttv card=113 card=135 | 76 | $ modprobe bttv card=113 card=135 |
68 | $ modprobe dvb-bt8xx | ||
69 | 77 | ||
70 | For a full list of card ID's please see Documentation/video4linux/CARDLIST.bttv. | 78 | For a full list of card ID's please see Documentation/video4linux/CARDLIST.bttv. |
71 | In case of further problems send questions to the mailing list: www.linuxdvb.org. | 79 | In case of further problems please subscribe and send questions to the mailing list: linux-dvb@linuxtv.org. |
72 | 80 | ||
73 | Authors: Richard Walker, | 81 | Authors: Richard Walker, |
74 | Jamie Honan, | 82 | Jamie Honan, |
diff --git a/Documentation/dvb/get_dvb_firmware b/Documentation/dvb/get_dvb_firmware index 4820366b6ae8..b4d306ae9234 100644 --- a/Documentation/dvb/get_dvb_firmware +++ b/Documentation/dvb/get_dvb_firmware | |||
@@ -24,7 +24,8 @@ use IO::Handle; | |||
24 | @components = ( "sp8870", "sp887x", "tda10045", "tda10046", | 24 | @components = ( "sp8870", "sp887x", "tda10045", "tda10046", |
25 | "tda10046lifeview", "av7110", "dec2000t", "dec2540t", | 25 | "tda10046lifeview", "av7110", "dec2000t", "dec2540t", |
26 | "dec3000s", "vp7041", "dibusb", "nxt2002", "nxt2004", | 26 | "dec3000s", "vp7041", "dibusb", "nxt2002", "nxt2004", |
27 | "or51211", "or51132_qam", "or51132_vsb", "bluebird"); | 27 | "or51211", "or51132_qam", "or51132_vsb", "bluebird", |
28 | "opera1"); | ||
28 | 29 | ||
29 | # Check args | 30 | # Check args |
30 | syntax() if (scalar(@ARGV) != 1); | 31 | syntax() if (scalar(@ARGV) != 1); |
@@ -56,7 +57,7 @@ syntax(); | |||
56 | 57 | ||
57 | sub sp8870 { | 58 | sub sp8870 { |
58 | my $sourcefile = "tt_Premium_217g.zip"; | 59 | my $sourcefile = "tt_Premium_217g.zip"; |
59 | my $url = "http://www.technotrend.de/new/217g/$sourcefile"; | 60 | my $url = "http://www.softwarepatch.pl/9999ccd06a4813cb827dbb0005071c71/$sourcefile"; |
60 | my $hash = "53970ec17a538945a6d8cb608a7b3899"; | 61 | my $hash = "53970ec17a538945a6d8cb608a7b3899"; |
61 | my $outfile = "dvb-fe-sp8870.fw"; | 62 | my $outfile = "dvb-fe-sp8870.fw"; |
62 | my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1); | 63 | my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1); |
@@ -210,6 +211,45 @@ sub dec3000s { | |||
210 | 211 | ||
211 | $outfile; | 212 | $outfile; |
212 | } | 213 | } |
214 | sub opera1{ | ||
215 | my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 0); | ||
216 | |||
217 | checkstandard(); | ||
218 | my $fwfile1="dvb-usb-opera1-fpga-01.fw"; | ||
219 | my $fwfile2="dvb-usb-opera-01.fw"; | ||
220 | extract("2830SCap2.sys", 0x62e8, 55024, "$tmpdir/opera1-fpga.fw"); | ||
221 | extract("2830SLoad2.sys",0x3178,0x3685-0x3178,"$tmpdir/fw1part1"); | ||
222 | extract("2830SLoad2.sys",0x0980,0x3150-0x0980,"$tmpdir/fw1part2"); | ||
223 | delzero("$tmpdir/fw1part1","$tmpdir/fw1part1-1"); | ||
224 | delzero("$tmpdir/fw1part2","$tmpdir/fw1part2-1"); | ||
225 | verify("$tmpdir/fw1part1-1","5e0909858fdf0b5b09ad48b9fe622e70"); | ||
226 | verify("$tmpdir/fw1part2-1","d6e146f321427e931df2c6fcadac37a1"); | ||
227 | verify("$tmpdir/opera1-fpga.fw","0f8133f5e9051f5f3c1928f7e5a1b07d"); | ||
228 | |||
229 | my $RES1="\x01\x92\x7f\x00\x01\x00"; | ||
230 | my $RES0="\x01\x92\x7f\x00\x00\x00"; | ||
231 | my $DAT1="\x01\x00\xe6\x00\x01\x00"; | ||
232 | my $DAT0="\x01\x00\xe6\x00\x00\x00"; | ||
233 | open FW,">$tmpdir/opera.fw"; | ||
234 | print FW "$RES1"; | ||
235 | print FW "$DAT1"; | ||
236 | print FW "$RES1"; | ||
237 | print FW "$DAT1"; | ||
238 | appendfile(FW,"$tmpdir/fw1part1-1"); | ||
239 | print FW "$RES0"; | ||
240 | print FW "$DAT0"; | ||
241 | print FW "$RES1"; | ||
242 | print FW "$DAT1"; | ||
243 | appendfile(FW,"$tmpdir/fw1part2-1"); | ||
244 | print FW "$RES1"; | ||
245 | print FW "$DAT1"; | ||
246 | print FW "$RES0"; | ||
247 | print FW "$DAT0"; | ||
248 | copy ("$tmpdir/opera1-fpga.fw",$fwfile1); | ||
249 | copy ("$tmpdir/opera.fw",$fwfile2); | ||
250 | |||
251 | $fwfile1.",".$fwfile2; | ||
252 | } | ||
213 | 253 | ||
214 | sub vp7041 { | 254 | sub vp7041 { |
215 | my $sourcefile = "2.422.zip"; | 255 | my $sourcefile = "2.422.zip"; |
@@ -440,6 +480,25 @@ sub appendfile { | |||
440 | close(INFILE); | 480 | close(INFILE); |
441 | } | 481 | } |
442 | 482 | ||
483 | sub delzero{ | ||
484 | my ($infile,$outfile) =@_; | ||
485 | |||
486 | open INFILE,"<$infile"; | ||
487 | open OUTFILE,">$outfile"; | ||
488 | while (1){ | ||
489 | $rcount=sysread(INFILE,$buf,22); | ||
490 | $len=ord(substr($buf,0,1)); | ||
491 | print OUTFILE substr($buf,0,1); | ||
492 | print OUTFILE substr($buf,2,$len+3); | ||
493 | last if ($rcount<1); | ||
494 | printf OUTFILE "%c",0; | ||
495 | #print $len." ".length($buf)."\n"; | ||
496 | |||
497 | } | ||
498 | close(INFILE); | ||
499 | close(OUTFILE); | ||
500 | } | ||
501 | |||
443 | sub syntax() { | 502 | sub syntax() { |
444 | print STDERR "syntax: get_dvb_firmware <component>\n"; | 503 | print STDERR "syntax: get_dvb_firmware <component>\n"; |
445 | print STDERR "Supported components:\n"; | 504 | print STDERR "Supported components:\n"; |
diff --git a/Documentation/dvb/opera-firmware.txt b/Documentation/dvb/opera-firmware.txt new file mode 100644 index 000000000000..93e784c2607b --- /dev/null +++ b/Documentation/dvb/opera-firmware.txt | |||
@@ -0,0 +1,27 @@ | |||
1 | To extract the firmware for the Opera DVB-S1 USB-Box | ||
2 | you need to copy the files: | ||
3 | |||
4 | 2830SCap2.sys | ||
5 | 2830SLoad2.sys | ||
6 | |||
7 | from the windriver disk into this directory. | ||
8 | |||
9 | Then run | ||
10 | |||
11 | ./get_dvb_firware opera1 | ||
12 | |||
13 | and after that you have 2 files: | ||
14 | |||
15 | dvb-usb-opera-01.fw | ||
16 | dvb-usb-opera1-fpga-01.fw | ||
17 | |||
18 | in here. | ||
19 | |||
20 | Copy them into /lib/firmware/ . | ||
21 | |||
22 | After that the driver can load the firmware | ||
23 | (if you have enabled firmware loading | ||
24 | in kernel config and have hotplug running). | ||
25 | |||
26 | |||
27 | Marco Gittler <g.marco@freenet.de> \ No newline at end of file | ||
diff --git a/Documentation/fault-injection/failcmd.sh b/Documentation/fault-injection/failcmd.sh deleted file mode 100644 index 63177aba8106..000000000000 --- a/Documentation/fault-injection/failcmd.sh +++ /dev/null | |||
@@ -1,4 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | echo 1 > /proc/self/make-it-fail | ||
4 | exec $* | ||
diff --git a/Documentation/fault-injection/failmodule.sh b/Documentation/fault-injection/failmodule.sh deleted file mode 100644 index 474a8b971f9c..000000000000 --- a/Documentation/fault-injection/failmodule.sh +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | # | ||
3 | # Usage: failmodule <failname> <modulename> [stacktrace-depth] | ||
4 | # | ||
5 | # <failname>: "failslab", "fail_alloc_page", or "fail_make_request" | ||
6 | # | ||
7 | # <modulename>: module name that you want to inject faults. | ||
8 | # | ||
9 | # [stacktrace-depth]: the maximum number of stacktrace walking allowed | ||
10 | # | ||
11 | |||
12 | STACKTRACE_DEPTH=5 | ||
13 | if [ $# -gt 2 ]; then | ||
14 | STACKTRACE_DEPTH=$3 | ||
15 | fi | ||
16 | |||
17 | if [ ! -d /debug/$1 ]; then | ||
18 | echo "Fault-injection $1 does not exist" >&2 | ||
19 | exit 1 | ||
20 | fi | ||
21 | if [ ! -d /sys/module/$2 ]; then | ||
22 | echo "Module $2 does not exist" >&2 | ||
23 | exit 1 | ||
24 | fi | ||
25 | |||
26 | # Disable any fault injection | ||
27 | echo 0 > /debug/$1/stacktrace-depth | ||
28 | |||
29 | echo `cat /sys/module/$2/sections/.text` > /debug/$1/require-start | ||
30 | echo `cat /sys/module/$2/sections/.exit.text` > /debug/$1/require-end | ||
31 | echo $STACKTRACE_DEPTH > /debug/$1/stacktrace-depth | ||
diff --git a/Documentation/fault-injection/fault-injection.txt b/Documentation/fault-injection/fault-injection.txt index b7ca560b9340..4bc374a14345 100644 --- a/Documentation/fault-injection/fault-injection.txt +++ b/Documentation/fault-injection/fault-injection.txt | |||
@@ -103,6 +103,11 @@ configuration of fault-injection capabilities. | |||
103 | default is 'N', setting it to 'Y' will inject failures | 103 | default is 'N', setting it to 'Y' will inject failures |
104 | only into non-sleep allocations (GFP_ATOMIC allocations). | 104 | only into non-sleep allocations (GFP_ATOMIC allocations). |
105 | 105 | ||
106 | - /debug/fail_page_alloc/min-order: | ||
107 | |||
108 | specifies the minimum page allocation order to be injected | ||
109 | failures. | ||
110 | |||
106 | o Boot option | 111 | o Boot option |
107 | 112 | ||
108 | In order to inject faults while debugfs is not available (early boot time), | 113 | In order to inject faults while debugfs is not available (early boot time), |
@@ -156,70 +161,77 @@ o add a hook to insert failures | |||
156 | Application Examples | 161 | Application Examples |
157 | -------------------- | 162 | -------------------- |
158 | 163 | ||
159 | o inject slab allocation failures into module init/cleanup code | 164 | o Inject slab allocation failures into module init/exit code |
160 | 165 | ||
161 | ------------------------------------------------------------------------------ | ||
162 | #!/bin/bash | 166 | #!/bin/bash |
163 | 167 | ||
164 | FAILCMD=Documentation/fault-injection/failcmd.sh | 168 | FAILTYPE=failslab |
165 | BLACKLIST="root_plug evbug" | 169 | echo Y > /debug/$FAILTYPE/task-filter |
166 | 170 | echo 10 > /debug/$FAILTYPE/probability | |
167 | FAILNAME=failslab | 171 | echo 100 > /debug/$FAILTYPE/interval |
168 | echo Y > /debug/$FAILNAME/task-filter | 172 | echo -1 > /debug/$FAILTYPE/times |
169 | echo 10 > /debug/$FAILNAME/probability | 173 | echo 0 > /debug/$FAILTYPE/space |
170 | echo 100 > /debug/$FAILNAME/interval | 174 | echo 2 > /debug/$FAILTYPE/verbose |
171 | echo -1 > /debug/$FAILNAME/times | 175 | echo 1 > /debug/$FAILTYPE/ignore-gfp-wait |
172 | echo 2 > /debug/$FAILNAME/verbose | ||
173 | echo 1 > /debug/$FAILNAME/ignore-gfp-wait | ||
174 | 176 | ||
175 | blacklist() | 177 | faulty_system() |
176 | { | 178 | { |
177 | echo $BLACKLIST | grep $1 > /dev/null 2>&1 | 179 | bash -c "echo 1 > /proc/self/make-it-fail && exec $*" |
178 | } | 180 | } |
179 | 181 | ||
180 | oops() | 182 | if [ $# -eq 0 ] |
181 | { | 183 | then |
182 | dmesg | grep BUG > /dev/null 2>&1 | 184 | echo "Usage: $0 modulename [ modulename ... ]" |
183 | } | 185 | exit 1 |
186 | fi | ||
187 | |||
188 | for m in $* | ||
189 | do | ||
190 | echo inserting $m... | ||
191 | faulty_system modprobe $m | ||
184 | 192 | ||
185 | find /lib/modules/`uname -r` -name '*.ko' -exec basename {} .ko \; | | 193 | echo removing $m... |
186 | while read i | 194 | faulty_system modprobe -r $m |
187 | do | 195 | done |
188 | oops && exit 1 | ||
189 | |||
190 | if ! blacklist $i | ||
191 | then | ||
192 | echo inserting $i... | ||
193 | bash $FAILCMD modprobe $i | ||
194 | fi | ||
195 | done | ||
196 | |||
197 | lsmod | awk '{ if ($3 == 0) { print $1 } }' | | ||
198 | while read i | ||
199 | do | ||
200 | oops && exit 1 | ||
201 | |||
202 | if ! blacklist $i | ||
203 | then | ||
204 | echo removing $i... | ||
205 | bash $FAILCMD modprobe -r $i | ||
206 | fi | ||
207 | done | ||
208 | 196 | ||
209 | ------------------------------------------------------------------------------ | 197 | ------------------------------------------------------------------------------ |
210 | 198 | ||
211 | o inject slab allocation failures only for a specific module | 199 | o Inject page allocation failures only for a specific module |
212 | 200 | ||
213 | ------------------------------------------------------------------------------ | ||
214 | #!/bin/bash | 201 | #!/bin/bash |
215 | 202 | ||
216 | FAILMOD=Documentation/fault-injection/failmodule.sh | 203 | FAILTYPE=fail_page_alloc |
204 | module=$1 | ||
217 | 205 | ||
218 | echo injecting errors into the module $1... | 206 | if [ -z $module ] |
207 | then | ||
208 | echo "Usage: $0 <modulename>" | ||
209 | exit 1 | ||
210 | fi | ||
219 | 211 | ||
220 | modprobe $1 | 212 | modprobe $module |
221 | bash $FAILMOD failslab $1 10 | ||
222 | echo 25 > /debug/failslab/probability | ||
223 | 213 | ||
224 | ------------------------------------------------------------------------------ | 214 | if [ ! -d /sys/module/$module/sections ] |
215 | then | ||
216 | echo Module $module is not loaded | ||
217 | exit 1 | ||
218 | fi | ||
219 | |||
220 | cat /sys/module/$module/sections/.text > /debug/$FAILTYPE/require-start | ||
221 | cat /sys/module/$module/sections/.data > /debug/$FAILTYPE/require-end | ||
222 | |||
223 | echo N > /debug/$FAILTYPE/task-filter | ||
224 | echo 10 > /debug/$FAILTYPE/probability | ||
225 | echo 100 > /debug/$FAILTYPE/interval | ||
226 | echo -1 > /debug/$FAILTYPE/times | ||
227 | echo 0 > /debug/$FAILTYPE/space | ||
228 | echo 2 > /debug/$FAILTYPE/verbose | ||
229 | echo 1 > /debug/$FAILTYPE/ignore-gfp-wait | ||
230 | echo 1 > /debug/$FAILTYPE/ignore-gfp-highmem | ||
231 | echo 10 > /debug/$FAILTYPE/stacktrace-depth | ||
232 | |||
233 | trap "echo 0 > /debug/$FAILTYPE/probability" SIGINT SIGTERM EXIT | ||
234 | |||
235 | echo "Injecting errors into the module $module... (interrupt to stop)" | ||
236 | sleep 1000000 | ||
225 | 237 | ||
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 769862197ac8..c175eedadb5f 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -26,9 +26,7 @@ Who: Hans Verkuil <hverkuil@xs4all.nl> and | |||
26 | 26 | ||
27 | --------------------------- | 27 | --------------------------- |
28 | 28 | ||
29 | What: /sys/devices/.../power/state | 29 | What: dev->power.power_state |
30 | dev->power.power_state | ||
31 | dpm_runtime_{suspend,resume)() | ||
32 | When: July 2007 | 30 | When: July 2007 |
33 | Why: Broken design for runtime control over driver power states, confusing | 31 | Why: Broken design for runtime control over driver power states, confusing |
34 | driver-internal runtime power management with: mechanisms to support | 32 | driver-internal runtime power management with: mechanisms to support |
@@ -41,24 +39,6 @@ Who: Pavel Machek <pavel@suse.cz> | |||
41 | 39 | ||
42 | --------------------------- | 40 | --------------------------- |
43 | 41 | ||
44 | What: RAW driver (CONFIG_RAW_DRIVER) | ||
45 | When: December 2005 | ||
46 | Why: declared obsolete since kernel 2.6.3 | ||
47 | O_DIRECT can be used instead | ||
48 | Who: Adrian Bunk <bunk@stusta.de> | ||
49 | |||
50 | --------------------------- | ||
51 | |||
52 | What: raw1394: requests of type RAW1394_REQ_ISO_SEND, RAW1394_REQ_ISO_LISTEN | ||
53 | When: June 2007 | ||
54 | Why: Deprecated in favour of the more efficient and robust rawiso interface. | ||
55 | Affected are applications which use the deprecated part of libraw1394 | ||
56 | (raw1394_iso_write, raw1394_start_iso_write, raw1394_start_iso_rcv, | ||
57 | raw1394_stop_iso_rcv) or bypass libraw1394. | ||
58 | Who: Dan Dennedy <dan@dennedy.org>, Stefan Richter <stefanr@s5r6.in-berlin.de> | ||
59 | |||
60 | --------------------------- | ||
61 | |||
62 | What: old NCR53C9x driver | 42 | What: old NCR53C9x driver |
63 | When: October 2007 | 43 | When: October 2007 |
64 | Why: Replaced by the much better esp_scsi driver. Actual low-level | 44 | Why: Replaced by the much better esp_scsi driver. Actual low-level |
@@ -71,6 +51,7 @@ Who: David Miller <davem@davemloft.net> | |||
71 | What: Video4Linux API 1 ioctls and video_decoder.h from Video devices. | 51 | What: Video4Linux API 1 ioctls and video_decoder.h from Video devices. |
72 | When: December 2006 | 52 | When: December 2006 |
73 | Files: include/linux/video_decoder.h | 53 | Files: include/linux/video_decoder.h |
54 | Check: include/linux/video_decoder.h | ||
74 | Why: V4L1 AP1 was replaced by V4L2 API. during migration from 2.4 to 2.6 | 55 | Why: V4L1 AP1 was replaced by V4L2 API. during migration from 2.4 to 2.6 |
75 | series. The old API have lots of drawbacks and don't provide enough | 56 | series. The old API have lots of drawbacks and don't provide enough |
76 | means to work with all video and audio standards. The newer API is | 57 | means to work with all video and audio standards. The newer API is |
@@ -104,6 +85,7 @@ Who: Dominik Brodowski <linux@brodo.de> | |||
104 | What: remove EXPORT_SYMBOL(kernel_thread) | 85 | What: remove EXPORT_SYMBOL(kernel_thread) |
105 | When: August 2006 | 86 | When: August 2006 |
106 | Files: arch/*/kernel/*_ksyms.c | 87 | Files: arch/*/kernel/*_ksyms.c |
88 | Check: kernel_thread | ||
107 | Why: kernel_thread is a low-level implementation detail. Drivers should | 89 | Why: kernel_thread is a low-level implementation detail. Drivers should |
108 | use the <linux/kthread.h> API instead which shields them from | 90 | use the <linux/kthread.h> API instead which shields them from |
109 | implementation details and provides a higherlevel interface that | 91 | implementation details and provides a higherlevel interface that |
@@ -128,13 +110,6 @@ Who: Adrian Bunk <bunk@stusta.de> | |||
128 | 110 | ||
129 | --------------------------- | 111 | --------------------------- |
130 | 112 | ||
131 | What: drivers depending on OSS_OBSOLETE_DRIVER | ||
132 | When: options in 2.6.20, code in 2.6.22 | ||
133 | Why: OSS drivers with ALSA replacements | ||
134 | Who: Adrian Bunk <bunk@stusta.de> | ||
135 | |||
136 | --------------------------- | ||
137 | |||
138 | What: Unused EXPORT_SYMBOL/EXPORT_SYMBOL_GPL exports | 113 | What: Unused EXPORT_SYMBOL/EXPORT_SYMBOL_GPL exports |
139 | (temporary transition config option provided until then) | 114 | (temporary transition config option provided until then) |
140 | The transition config option will also be removed at the same time. | 115 | The transition config option will also be removed at the same time. |
@@ -161,6 +136,15 @@ Who: Greg Kroah-Hartman <gregkh@suse.de> | |||
161 | 136 | ||
162 | --------------------------- | 137 | --------------------------- |
163 | 138 | ||
139 | What: vm_ops.nopage | ||
140 | When: Soon, provided in-kernel callers have been converted | ||
141 | Why: This interface is replaced by vm_ops.fault, but it has been around | ||
142 | forever, is used by a lot of drivers, and doesn't cost much to | ||
143 | maintain. | ||
144 | Who: Nick Piggin <npiggin@suse.de> | ||
145 | |||
146 | --------------------------- | ||
147 | |||
164 | What: Interrupt only SA_* flags | 148 | What: Interrupt only SA_* flags |
165 | When: September 2007 | 149 | When: September 2007 |
166 | Why: The interrupt related SA_* flags are replaced by IRQF_* to move them | 150 | Why: The interrupt related SA_* flags are replaced by IRQF_* to move them |
@@ -180,15 +164,6 @@ Who: Kay Sievers <kay.sievers@suse.de> | |||
180 | 164 | ||
181 | --------------------------- | 165 | --------------------------- |
182 | 166 | ||
183 | What: i2c-isa | ||
184 | When: December 2006 | ||
185 | Why: i2c-isa is a non-sense and doesn't fit in the device driver | ||
186 | model. Drivers relying on it are better implemented as platform | ||
187 | drivers. | ||
188 | Who: Jean Delvare <khali@linux-fr.org> | ||
189 | |||
190 | --------------------------- | ||
191 | |||
192 | What: i2c_adapter.list | 167 | What: i2c_adapter.list |
193 | When: July 2007 | 168 | When: July 2007 |
194 | Why: Superfluous, this list duplicates the one maintained by the driver | 169 | Why: Superfluous, this list duplicates the one maintained by the driver |
@@ -205,28 +180,6 @@ Who: Adrian Bunk <bunk@stusta.de> | |||
205 | 180 | ||
206 | --------------------------- | 181 | --------------------------- |
207 | 182 | ||
208 | What: ACPI hooks (X86_SPEEDSTEP_CENTRINO_ACPI) in speedstep-centrino driver | ||
209 | When: December 2006 | ||
210 | Why: Speedstep-centrino driver with ACPI hooks and acpi-cpufreq driver are | ||
211 | functionally very much similar. They talk to ACPI in same way. Only | ||
212 | difference between them is the way they do frequency transitions. | ||
213 | One uses MSRs and the other one uses IO ports. Functionaliy of | ||
214 | speedstep_centrino with ACPI hooks is now merged into acpi-cpufreq. | ||
215 | That means one common driver will support all Intel Enhanced Speedstep | ||
216 | capable CPUs. That means less confusion over name of | ||
217 | speedstep-centrino driver (with that driver supposed to be used on | ||
218 | non-centrino platforms). That means less duplication of code and | ||
219 | less maintenance effort and no possibility of these two drivers | ||
220 | going out of sync. | ||
221 | Current users of speedstep_centrino with ACPI hooks are requested to | ||
222 | switch over to acpi-cpufreq driver. speedstep-centrino will continue | ||
223 | to work using older non-ACPI static table based scheme even after this | ||
224 | date. | ||
225 | |||
226 | Who: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> | ||
227 | |||
228 | --------------------------- | ||
229 | |||
230 | What: ACPI procfs interface | 183 | What: ACPI procfs interface |
231 | When: July 2008 | 184 | When: July 2008 |
232 | Why: ACPI sysfs conversion should be finished by January 2008. | 185 | Why: ACPI sysfs conversion should be finished by January 2008. |
@@ -244,14 +197,6 @@ Who: Len Brown <len.brown@intel.com> | |||
244 | 197 | ||
245 | --------------------------- | 198 | --------------------------- |
246 | 199 | ||
247 | What: sk98lin network driver | ||
248 | When: July 2007 | ||
249 | Why: In kernel tree version of driver is unmaintained. Sk98lin driver | ||
250 | replaced by the skge driver. | ||
251 | Who: Stephen Hemminger <shemminger@osdl.org> | ||
252 | |||
253 | --------------------------- | ||
254 | |||
255 | What: Compaq touchscreen device emulation | 200 | What: Compaq touchscreen device emulation |
256 | When: Oct 2007 | 201 | When: Oct 2007 |
257 | Files: drivers/input/tsdev.c | 202 | Files: drivers/input/tsdev.c |
@@ -266,25 +211,6 @@ Who: Richard Purdie <rpurdie@rpsys.net> | |||
266 | 211 | ||
267 | --------------------------- | 212 | --------------------------- |
268 | 213 | ||
269 | What: Multipath cached routing support in ipv4 | ||
270 | When: in 2.6.23 | ||
271 | Why: Code was merged, then submitter immediately disappeared leaving | ||
272 | us with no maintainer and lots of bugs. The code should not have | ||
273 | been merged in the first place, and many aspects of it's | ||
274 | implementation are blocking more critical core networking | ||
275 | development. It's marked EXPERIMENTAL and no distribution | ||
276 | enables it because it cause obscure crashes due to unfixable bugs | ||
277 | (interfaces don't return errors so memory allocation can't be | ||
278 | handled, calling contexts of these interfaces make handling | ||
279 | errors impossible too because they get called after we've | ||
280 | totally commited to creating a route object, for example). | ||
281 | This problem has existed for years and no forward progress | ||
282 | has ever been made, and nobody steps up to try and salvage | ||
283 | this code, so we're going to finally just get rid of it. | ||
284 | Who: David S. Miller <davem@davemloft.net> | ||
285 | |||
286 | --------------------------- | ||
287 | |||
288 | What: read_dev_chars(), read_conf_data{,_lpm}() (s390 common I/O layer) | 214 | What: read_dev_chars(), read_conf_data{,_lpm}() (s390 common I/O layer) |
289 | When: December 2007 | 215 | When: December 2007 |
290 | Why: These functions are a leftover from 2.4 times. They have several | 216 | Why: These functions are a leftover from 2.4 times. They have several |
@@ -309,6 +235,14 @@ Who: Jean Delvare <khali@linux-fr.org> | |||
309 | 235 | ||
310 | --------------------------- | 236 | --------------------------- |
311 | 237 | ||
238 | What: 'time' kernel boot parameter | ||
239 | When: January 2008 | ||
240 | Why: replaced by 'printk.time=<value>' so that printk timestamps can be | ||
241 | enabled or disabled as needed | ||
242 | Who: Randy Dunlap <randy.dunlap@oracle.com> | ||
243 | |||
244 | --------------------------- | ||
245 | |||
312 | What: drivers depending on OSS_OBSOLETE | 246 | What: drivers depending on OSS_OBSOLETE |
313 | When: options in 2.6.23, code in 2.6.25 | 247 | When: options in 2.6.23, code in 2.6.25 |
314 | Why: obsolete OSS drivers | 248 | Why: obsolete OSS drivers |
@@ -334,3 +268,41 @@ Who: Tejun Heo <htejun@gmail.com> | |||
334 | 268 | ||
335 | --------------------------- | 269 | --------------------------- |
336 | 270 | ||
271 | What: Legacy RTC drivers (under drivers/i2c/chips) | ||
272 | When: November 2007 | ||
273 | Why: Obsolete. We have a RTC subsystem with better drivers. | ||
274 | Who: Jean Delvare <khali@linux-fr.org> | ||
275 | |||
276 | --------------------------- | ||
277 | |||
278 | What: iptables SAME target | ||
279 | When: 1.1. 2008 | ||
280 | Files: net/ipv4/netfilter/ipt_SAME.c, include/linux/netfilter_ipv4/ipt_SAME.h | ||
281 | Why: Obsolete for multiple years now, NAT core provides the same behaviour. | ||
282 | Unfixable broken wrt. 32/64 bit cleanness. | ||
283 | Who: Patrick McHardy <kaber@trash.net> | ||
284 | |||
285 | --------------------------- | ||
286 | |||
287 | What: The arch/ppc and include/asm-ppc directories | ||
288 | When: Jun 2008 | ||
289 | Why: The arch/powerpc tree is the merged architecture for ppc32 and ppc64 | ||
290 | platforms. Currently there are efforts underway to port the remaining | ||
291 | arch/ppc platforms to the merged tree. New submissions to the arch/ppc | ||
292 | tree have been frozen with the 2.6.22 kernel release and that tree will | ||
293 | remain in bug-fix only mode until its scheduled removal. Platforms | ||
294 | that are not ported by June 2008 will be removed due to the lack of an | ||
295 | interested maintainer. | ||
296 | Who: linuxppc-dev@ozlabs.org | ||
297 | |||
298 | --------------------------- | ||
299 | |||
300 | What: mthca driver's MSI support | ||
301 | When: January 2008 | ||
302 | Files: drivers/infiniband/hw/mthca/*.[ch] | ||
303 | Why: All mthca hardware also supports MSI-X, which provides | ||
304 | strictly more functionality than MSI. So there is no point in | ||
305 | having both MSI-X and MSI support in the driver. | ||
306 | Who: Roland Dreier <rolandd@cisco.com> | ||
307 | |||
308 | --------------------------- | ||
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index d866551be037..f0f825808ca4 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking | |||
@@ -510,13 +510,24 @@ More details about quota locking can be found in fs/dquot.c. | |||
510 | prototypes: | 510 | prototypes: |
511 | void (*open)(struct vm_area_struct*); | 511 | void (*open)(struct vm_area_struct*); |
512 | void (*close)(struct vm_area_struct*); | 512 | void (*close)(struct vm_area_struct*); |
513 | int (*fault)(struct vm_area_struct*, struct vm_fault *); | ||
513 | struct page *(*nopage)(struct vm_area_struct*, unsigned long, int *); | 514 | struct page *(*nopage)(struct vm_area_struct*, unsigned long, int *); |
515 | int (*page_mkwrite)(struct vm_area_struct *, struct page *); | ||
514 | 516 | ||
515 | locking rules: | 517 | locking rules: |
516 | BKL mmap_sem | 518 | BKL mmap_sem PageLocked(page) |
517 | open: no yes | 519 | open: no yes |
518 | close: no yes | 520 | close: no yes |
521 | fault: no yes | ||
519 | nopage: no yes | 522 | nopage: no yes |
523 | page_mkwrite: no yes no | ||
524 | |||
525 | ->page_mkwrite() is called when a previously read-only page is | ||
526 | about to become writeable. The file system is responsible for | ||
527 | protecting against truncate races. Once appropriate action has been | ||
528 | taking to lock out truncate, the page range should be verified to be | ||
529 | within i_size. The page mapping should also be checked that it is not | ||
530 | NULL. | ||
520 | 531 | ||
521 | ================================================================================ | 532 | ================================================================================ |
522 | Dubious stuff | 533 | Dubious stuff |
diff --git a/Documentation/filesystems/configfs/configfs.txt b/Documentation/filesystems/configfs/configfs.txt index b34cdb50eab4..d1b98257d000 100644 --- a/Documentation/filesystems/configfs/configfs.txt +++ b/Documentation/filesystems/configfs/configfs.txt | |||
@@ -238,6 +238,8 @@ config_item_type. | |||
238 | struct config_group *(*make_group)(struct config_group *group, | 238 | struct config_group *(*make_group)(struct config_group *group, |
239 | const char *name); | 239 | const char *name); |
240 | int (*commit_item)(struct config_item *item); | 240 | int (*commit_item)(struct config_item *item); |
241 | void (*disconnect_notify)(struct config_group *group, | ||
242 | struct config_item *item); | ||
241 | void (*drop_item)(struct config_group *group, | 243 | void (*drop_item)(struct config_group *group, |
242 | struct config_item *item); | 244 | struct config_item *item); |
243 | }; | 245 | }; |
@@ -268,6 +270,16 @@ the item in other threads, the memory is safe. It may take some time | |||
268 | for the item to actually disappear from the subsystem's usage. But it | 270 | for the item to actually disappear from the subsystem's usage. But it |
269 | is gone from configfs. | 271 | is gone from configfs. |
270 | 272 | ||
273 | When drop_item() is called, the item's linkage has already been torn | ||
274 | down. It no longer has a reference on its parent and has no place in | ||
275 | the item hierarchy. If a client needs to do some cleanup before this | ||
276 | teardown happens, the subsystem can implement the | ||
277 | ct_group_ops->disconnect_notify() method. The method is called after | ||
278 | configfs has removed the item from the filesystem view but before the | ||
279 | item is removed from its parent group. Like drop_item(), | ||
280 | disconnect_notify() is void and cannot fail. Client subsystems should | ||
281 | not drop any references here, as they still must do it in drop_item(). | ||
282 | |||
271 | A config_group cannot be removed while it still has child items. This | 283 | A config_group cannot be removed while it still has child items. This |
272 | is implemented in the configfs rmdir(2) code. ->drop_item() will not be | 284 | is implemented in the configfs rmdir(2) code. ->drop_item() will not be |
273 | called, as the item has not been dropped. rmdir(2) will fail, as the | 285 | called, as the item has not been dropped. rmdir(2) will fail, as the |
@@ -280,18 +292,18 @@ tells configfs to make the subsystem appear in the file tree. | |||
280 | 292 | ||
281 | struct configfs_subsystem { | 293 | struct configfs_subsystem { |
282 | struct config_group su_group; | 294 | struct config_group su_group; |
283 | struct semaphore su_sem; | 295 | struct mutex su_mutex; |
284 | }; | 296 | }; |
285 | 297 | ||
286 | int configfs_register_subsystem(struct configfs_subsystem *subsys); | 298 | int configfs_register_subsystem(struct configfs_subsystem *subsys); |
287 | void configfs_unregister_subsystem(struct configfs_subsystem *subsys); | 299 | void configfs_unregister_subsystem(struct configfs_subsystem *subsys); |
288 | 300 | ||
289 | A subsystem consists of a toplevel config_group and a semaphore. | 301 | A subsystem consists of a toplevel config_group and a mutex. |
290 | The group is where child config_items are created. For a subsystem, | 302 | The group is where child config_items are created. For a subsystem, |
291 | this group is usually defined statically. Before calling | 303 | this group is usually defined statically. Before calling |
292 | configfs_register_subsystem(), the subsystem must have initialized the | 304 | configfs_register_subsystem(), the subsystem must have initialized the |
293 | group via the usual group _init() functions, and it must also have | 305 | group via the usual group _init() functions, and it must also have |
294 | initialized the semaphore. | 306 | initialized the mutex. |
295 | When the register call returns, the subsystem is live, and it | 307 | When the register call returns, the subsystem is live, and it |
296 | will be visible via configfs. At that point, mkdir(2) can be called and | 308 | will be visible via configfs. At that point, mkdir(2) can be called and |
297 | the subsystem must be ready for it. | 309 | the subsystem must be ready for it. |
@@ -303,7 +315,7 @@ subsystem/group and the simple_child item in configfs_example.c It | |||
303 | shows a trivial object displaying and storing an attribute, and a simple | 315 | shows a trivial object displaying and storing an attribute, and a simple |
304 | group creating and destroying these children. | 316 | group creating and destroying these children. |
305 | 317 | ||
306 | [Hierarchy Navigation and the Subsystem Semaphore] | 318 | [Hierarchy Navigation and the Subsystem Mutex] |
307 | 319 | ||
308 | There is an extra bonus that configfs provides. The config_groups and | 320 | There is an extra bonus that configfs provides. The config_groups and |
309 | config_items are arranged in a hierarchy due to the fact that they | 321 | config_items are arranged in a hierarchy due to the fact that they |
@@ -314,19 +326,19 @@ and config_item->ci_parent structure members. | |||
314 | 326 | ||
315 | A subsystem can navigate the cg_children list and the ci_parent pointer | 327 | A subsystem can navigate the cg_children list and the ci_parent pointer |
316 | to see the tree created by the subsystem. This can race with configfs' | 328 | to see the tree created by the subsystem. This can race with configfs' |
317 | management of the hierarchy, so configfs uses the subsystem semaphore to | 329 | management of the hierarchy, so configfs uses the subsystem mutex to |
318 | protect modifications. Whenever a subsystem wants to navigate the | 330 | protect modifications. Whenever a subsystem wants to navigate the |
319 | hierarchy, it must do so under the protection of the subsystem | 331 | hierarchy, it must do so under the protection of the subsystem |
320 | semaphore. | 332 | mutex. |
321 | 333 | ||
322 | A subsystem will be prevented from acquiring the semaphore while a newly | 334 | A subsystem will be prevented from acquiring the mutex while a newly |
323 | allocated item has not been linked into this hierarchy. Similarly, it | 335 | allocated item has not been linked into this hierarchy. Similarly, it |
324 | will not be able to acquire the semaphore while a dropping item has not | 336 | will not be able to acquire the mutex while a dropping item has not |
325 | yet been unlinked. This means that an item's ci_parent pointer will | 337 | yet been unlinked. This means that an item's ci_parent pointer will |
326 | never be NULL while the item is in configfs, and that an item will only | 338 | never be NULL while the item is in configfs, and that an item will only |
327 | be in its parent's cg_children list for the same duration. This allows | 339 | be in its parent's cg_children list for the same duration. This allows |
328 | a subsystem to trust ci_parent and cg_children while they hold the | 340 | a subsystem to trust ci_parent and cg_children while they hold the |
329 | semaphore. | 341 | mutex. |
330 | 342 | ||
331 | [Item Aggregation Via symlink(2)] | 343 | [Item Aggregation Via symlink(2)] |
332 | 344 | ||
@@ -386,6 +398,33 @@ As a consequence of this, default_groups cannot be removed directly via | |||
386 | rmdir(2). They also are not considered when rmdir(2) on the parent | 398 | rmdir(2). They also are not considered when rmdir(2) on the parent |
387 | group is checking for children. | 399 | group is checking for children. |
388 | 400 | ||
401 | [Dependant Subsystems] | ||
402 | |||
403 | Sometimes other drivers depend on particular configfs items. For | ||
404 | example, ocfs2 mounts depend on a heartbeat region item. If that | ||
405 | region item is removed with rmdir(2), the ocfs2 mount must BUG or go | ||
406 | readonly. Not happy. | ||
407 | |||
408 | configfs provides two additional API calls: configfs_depend_item() and | ||
409 | configfs_undepend_item(). A client driver can call | ||
410 | configfs_depend_item() on an existing item to tell configfs that it is | ||
411 | depended on. configfs will then return -EBUSY from rmdir(2) for that | ||
412 | item. When the item is no longer depended on, the client driver calls | ||
413 | configfs_undepend_item() on it. | ||
414 | |||
415 | These API cannot be called underneath any configfs callbacks, as | ||
416 | they will conflict. They can block and allocate. A client driver | ||
417 | probably shouldn't calling them of its own gumption. Rather it should | ||
418 | be providing an API that external subsystems call. | ||
419 | |||
420 | How does this work? Imagine the ocfs2 mount process. When it mounts, | ||
421 | it asks for a heartbeat region item. This is done via a call into the | ||
422 | heartbeat code. Inside the heartbeat code, the region item is looked | ||
423 | up. Here, the heartbeat code calls configfs_depend_item(). If it | ||
424 | succeeds, then heartbeat knows the region is safe to give to ocfs2. | ||
425 | If it fails, it was being torn down anyway, and heartbeat can gracefully | ||
426 | pass up an error. | ||
427 | |||
389 | [Committable Items] | 428 | [Committable Items] |
390 | 429 | ||
391 | NOTE: Committable items are currently unimplemented. | 430 | NOTE: Committable items are currently unimplemented. |
diff --git a/Documentation/filesystems/configfs/configfs_example.c b/Documentation/filesystems/configfs/configfs_example.c index 2d6a14a463e0..25151fd5c2c6 100644 --- a/Documentation/filesystems/configfs/configfs_example.c +++ b/Documentation/filesystems/configfs/configfs_example.c | |||
@@ -277,11 +277,10 @@ static struct config_item *simple_children_make_item(struct config_group *group, | |||
277 | { | 277 | { |
278 | struct simple_child *simple_child; | 278 | struct simple_child *simple_child; |
279 | 279 | ||
280 | simple_child = kmalloc(sizeof(struct simple_child), GFP_KERNEL); | 280 | simple_child = kzalloc(sizeof(struct simple_child), GFP_KERNEL); |
281 | if (!simple_child) | 281 | if (!simple_child) |
282 | return NULL; | 282 | return NULL; |
283 | 283 | ||
284 | memset(simple_child, 0, sizeof(struct simple_child)); | ||
285 | 284 | ||
286 | config_item_init_type_name(&simple_child->item, name, | 285 | config_item_init_type_name(&simple_child->item, name, |
287 | &simple_child_type); | 286 | &simple_child_type); |
@@ -364,12 +363,11 @@ static struct config_group *group_children_make_group(struct config_group *group | |||
364 | { | 363 | { |
365 | struct simple_children *simple_children; | 364 | struct simple_children *simple_children; |
366 | 365 | ||
367 | simple_children = kmalloc(sizeof(struct simple_children), | 366 | simple_children = kzalloc(sizeof(struct simple_children), |
368 | GFP_KERNEL); | 367 | GFP_KERNEL); |
369 | if (!simple_children) | 368 | if (!simple_children) |
370 | return NULL; | 369 | return NULL; |
371 | 370 | ||
372 | memset(simple_children, 0, sizeof(struct simple_children)); | ||
373 | 371 | ||
374 | config_group_init_type_name(&simple_children->group, name, | 372 | config_group_init_type_name(&simple_children->group, name, |
375 | &simple_children_type); | 373 | &simple_children_type); |
@@ -453,7 +451,7 @@ static int __init configfs_example_init(void) | |||
453 | subsys = example_subsys[i]; | 451 | subsys = example_subsys[i]; |
454 | 452 | ||
455 | config_group_init(&subsys->su_group); | 453 | config_group_init(&subsys->su_group); |
456 | init_MUTEX(&subsys->su_sem); | 454 | mutex_init(&subsys->su_mutex); |
457 | ret = configfs_register_subsystem(subsys); | 455 | ret = configfs_register_subsystem(subsys); |
458 | if (ret) { | 456 | if (ret) { |
459 | printk(KERN_ERR "Error %d while registering subsystem %s\n", | 457 | printk(KERN_ERR "Error %d while registering subsystem %s\n", |
diff --git a/Documentation/ecryptfs.txt b/Documentation/filesystems/ecryptfs.txt index 01d8a08351ac..01d8a08351ac 100644 --- a/Documentation/ecryptfs.txt +++ b/Documentation/filesystems/ecryptfs.txt | |||
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index 8756a07f4dc3..4a37e25e694c 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt | |||
@@ -42,6 +42,7 @@ Table of Contents | |||
42 | 2.12 /proc/<pid>/oom_adj - Adjust the oom-killer score | 42 | 2.12 /proc/<pid>/oom_adj - Adjust the oom-killer score |
43 | 2.13 /proc/<pid>/oom_score - Display current oom-killer score | 43 | 2.13 /proc/<pid>/oom_score - Display current oom-killer score |
44 | 2.14 /proc/<pid>/io - Display the IO accounting fields | 44 | 2.14 /proc/<pid>/io - Display the IO accounting fields |
45 | 2.15 /proc/<pid>/coredump_filter - Core dump filtering settings | ||
45 | 46 | ||
46 | ------------------------------------------------------------------------------ | 47 | ------------------------------------------------------------------------------ |
47 | Preface | 48 | Preface |
@@ -171,7 +172,9 @@ read the file /proc/PID/status: | |||
171 | This shows you nearly the same information you would get if you viewed it with | 172 | This shows you nearly the same information you would get if you viewed it with |
172 | the ps command. In fact, ps uses the proc file system to obtain its | 173 | the ps command. In fact, ps uses the proc file system to obtain its |
173 | information. The statm file contains more detailed information about the | 174 | information. The statm file contains more detailed information about the |
174 | process memory usage. Its seven fields are explained in Table 1-2. | 175 | process memory usage. Its seven fields are explained in Table 1-2. The stat |
176 | file contains details information about the process itself. Its fields are | ||
177 | explained in Table 1-3. | ||
175 | 178 | ||
176 | 179 | ||
177 | Table 1-2: Contents of the statm files (as of 2.6.8-rc3) | 180 | Table 1-2: Contents of the statm files (as of 2.6.8-rc3) |
@@ -188,16 +191,65 @@ Table 1-2: Contents of the statm files (as of 2.6.8-rc3) | |||
188 | dt number of dirty pages (always 0 on 2.6) | 191 | dt number of dirty pages (always 0 on 2.6) |
189 | .............................................................................. | 192 | .............................................................................. |
190 | 193 | ||
194 | |||
195 | Table 1-3: Contents of the stat files (as of 2.6.22-rc3) | ||
196 | .............................................................................. | ||
197 | Field Content | ||
198 | pid process id | ||
199 | tcomm filename of the executable | ||
200 | state state (R is running, S is sleeping, D is sleeping in an | ||
201 | uninterruptible wait, Z is zombie, T is traced or stopped) | ||
202 | ppid process id of the parent process | ||
203 | pgrp pgrp of the process | ||
204 | sid session id | ||
205 | tty_nr tty the process uses | ||
206 | tty_pgrp pgrp of the tty | ||
207 | flags task flags | ||
208 | min_flt number of minor faults | ||
209 | cmin_flt number of minor faults with child's | ||
210 | maj_flt number of major faults | ||
211 | cmaj_flt number of major faults with child's | ||
212 | utime user mode jiffies | ||
213 | stime kernel mode jiffies | ||
214 | cutime user mode jiffies with child's | ||
215 | cstime kernel mode jiffies with child's | ||
216 | priority priority level | ||
217 | nice nice level | ||
218 | num_threads number of threads | ||
219 | start_time time the process started after system boot | ||
220 | vsize virtual memory size | ||
221 | rss resident set memory size | ||
222 | rsslim current limit in bytes on the rss | ||
223 | start_code address above which program text can run | ||
224 | end_code address below which program text can run | ||
225 | start_stack address of the start of the stack | ||
226 | esp current value of ESP | ||
227 | eip current value of EIP | ||
228 | pending bitmap of pending signals (obsolete) | ||
229 | blocked bitmap of blocked signals (obsolete) | ||
230 | sigign bitmap of ignored signals (obsolete) | ||
231 | sigcatch bitmap of catched signals (obsolete) | ||
232 | wchan address where process went to sleep | ||
233 | 0 (place holder) | ||
234 | 0 (place holder) | ||
235 | exit_signal signal to send to parent thread on exit | ||
236 | task_cpu which CPU the task is scheduled on | ||
237 | rt_priority realtime priority | ||
238 | policy scheduling policy (man sched_setscheduler) | ||
239 | blkio_ticks time spent waiting for block IO | ||
240 | .............................................................................. | ||
241 | |||
242 | |||
191 | 1.2 Kernel data | 243 | 1.2 Kernel data |
192 | --------------- | 244 | --------------- |
193 | 245 | ||
194 | Similar to the process entries, the kernel data files give information about | 246 | Similar to the process entries, the kernel data files give information about |
195 | the running kernel. The files used to obtain this information are contained in | 247 | the running kernel. The files used to obtain this information are contained in |
196 | /proc and are listed in Table 1-3. Not all of these will be present in your | 248 | /proc and are listed in Table 1-4. Not all of these will be present in your |
197 | system. It depends on the kernel configuration and the loaded modules, which | 249 | system. It depends on the kernel configuration and the loaded modules, which |
198 | files are there, and which are missing. | 250 | files are there, and which are missing. |
199 | 251 | ||
200 | Table 1-3: Kernel info in /proc | 252 | Table 1-4: Kernel info in /proc |
201 | .............................................................................. | 253 | .............................................................................. |
202 | File Content | 254 | File Content |
203 | apm Advanced power management info | 255 | apm Advanced power management info |
@@ -473,10 +525,10 @@ IDE devices: | |||
473 | 525 | ||
474 | More detailed information can be found in the controller specific | 526 | More detailed information can be found in the controller specific |
475 | subdirectories. These are named ide0, ide1 and so on. Each of these | 527 | subdirectories. These are named ide0, ide1 and so on. Each of these |
476 | directories contains the files shown in table 1-4. | 528 | directories contains the files shown in table 1-5. |
477 | 529 | ||
478 | 530 | ||
479 | Table 1-4: IDE controller info in /proc/ide/ide? | 531 | Table 1-5: IDE controller info in /proc/ide/ide? |
480 | .............................................................................. | 532 | .............................................................................. |
481 | File Content | 533 | File Content |
482 | channel IDE channel (0 or 1) | 534 | channel IDE channel (0 or 1) |
@@ -486,11 +538,11 @@ Table 1-4: IDE controller info in /proc/ide/ide? | |||
486 | .............................................................................. | 538 | .............................................................................. |
487 | 539 | ||
488 | Each device connected to a controller has a separate subdirectory in the | 540 | Each device connected to a controller has a separate subdirectory in the |
489 | controllers directory. The files listed in table 1-5 are contained in these | 541 | controllers directory. The files listed in table 1-6 are contained in these |
490 | directories. | 542 | directories. |
491 | 543 | ||
492 | 544 | ||
493 | Table 1-5: IDE device information | 545 | Table 1-6: IDE device information |
494 | .............................................................................. | 546 | .............................................................................. |
495 | File Content | 547 | File Content |
496 | cache The cache | 548 | cache The cache |
@@ -1014,6 +1066,13 @@ check the amount of free space (value is in seconds). Default settings are: 4, | |||
1014 | resume it if we have a value of 3 or more percent; consider information about | 1066 | resume it if we have a value of 3 or more percent; consider information about |
1015 | the amount of free space valid for 30 seconds | 1067 | the amount of free space valid for 30 seconds |
1016 | 1068 | ||
1069 | audit_argv_kb | ||
1070 | ------------- | ||
1071 | |||
1072 | The file contains a single value denoting the limit on the argv array size | ||
1073 | for execve (in KiB). This limit is only applied when system call auditing for | ||
1074 | execve is enabled, otherwise the value is ignored. | ||
1075 | |||
1017 | ctrl-alt-del | 1076 | ctrl-alt-del |
1018 | ------------ | 1077 | ------------ |
1019 | 1078 | ||
@@ -1297,6 +1356,21 @@ nr_hugepages configures number of hugetlb page reserved for the system. | |||
1297 | hugetlb_shm_group contains group id that is allowed to create SysV shared | 1356 | hugetlb_shm_group contains group id that is allowed to create SysV shared |
1298 | memory segment using hugetlb page. | 1357 | memory segment using hugetlb page. |
1299 | 1358 | ||
1359 | hugepages_treat_as_movable | ||
1360 | -------------------------- | ||
1361 | |||
1362 | This parameter is only useful when kernelcore= is specified at boot time to | ||
1363 | create ZONE_MOVABLE for pages that may be reclaimed or migrated. Huge pages | ||
1364 | are not movable so are not normally allocated from ZONE_MOVABLE. A non-zero | ||
1365 | value written to hugepages_treat_as_movable allows huge pages to be allocated | ||
1366 | from ZONE_MOVABLE. | ||
1367 | |||
1368 | Once enabled, the ZONE_MOVABLE is treated as an area of memory the huge | ||
1369 | pages pool can easily grow or shrink within. Assuming that applications are | ||
1370 | not running that mlock() a lot of memory, it is likely the huge pages pool | ||
1371 | can grow to the size of ZONE_MOVABLE by repeatedly entering the desired value | ||
1372 | into nr_hugepages and triggering page reclaim. | ||
1373 | |||
1300 | laptop_mode | 1374 | laptop_mode |
1301 | ----------- | 1375 | ----------- |
1302 | 1376 | ||
@@ -2111,4 +2185,41 @@ those 64-bit counters, process A could see an intermediate result. | |||
2111 | More information about this can be found within the taskstats documentation in | 2185 | More information about this can be found within the taskstats documentation in |
2112 | Documentation/accounting. | 2186 | Documentation/accounting. |
2113 | 2187 | ||
2188 | 2.15 /proc/<pid>/coredump_filter - Core dump filtering settings | ||
2189 | --------------------------------------------------------------- | ||
2190 | When a process is dumped, all anonymous memory is written to a core file as | ||
2191 | long as the size of the core file isn't limited. But sometimes we don't want | ||
2192 | to dump some memory segments, for example, huge shared memory. Conversely, | ||
2193 | sometimes we want to save file-backed memory segments into a core file, not | ||
2194 | only the individual files. | ||
2195 | |||
2196 | /proc/<pid>/coredump_filter allows you to customize which memory segments | ||
2197 | will be dumped when the <pid> process is dumped. coredump_filter is a bitmask | ||
2198 | of memory types. If a bit of the bitmask is set, memory segments of the | ||
2199 | corresponding memory type are dumped, otherwise they are not dumped. | ||
2200 | |||
2201 | The following 4 memory types are supported: | ||
2202 | - (bit 0) anonymous private memory | ||
2203 | - (bit 1) anonymous shared memory | ||
2204 | - (bit 2) file-backed private memory | ||
2205 | - (bit 3) file-backed shared memory | ||
2206 | |||
2207 | Note that MMIO pages such as frame buffer are never dumped and vDSO pages | ||
2208 | are always dumped regardless of the bitmask status. | ||
2209 | |||
2210 | Default value of coredump_filter is 0x3; this means all anonymous memory | ||
2211 | segments are dumped. | ||
2212 | |||
2213 | If you don't want to dump all shared memory segments attached to pid 1234, | ||
2214 | write 1 to the process's proc file. | ||
2215 | |||
2216 | $ echo 0x1 > /proc/1234/coredump_filter | ||
2217 | |||
2218 | When a new process is created, the process inherits the bitmask status from its | ||
2219 | parent. It is useful to set up coredump_filter before the program runs. | ||
2220 | For example: | ||
2221 | |||
2222 | $ echo 0x7 > /proc/self/coredump_filter | ||
2223 | $ ./some_program | ||
2224 | |||
2114 | ------------------------------------------------------------------------------ | 2225 | ------------------------------------------------------------------------------ |
diff --git a/Documentation/filesystems/tmpfs.txt b/Documentation/filesystems/tmpfs.txt index 6dd050878a20..145e44086358 100644 --- a/Documentation/filesystems/tmpfs.txt +++ b/Documentation/filesystems/tmpfs.txt | |||
@@ -94,10 +94,10 @@ largest node numbers in the range. For example, mpol=bind:0-3,5,7,9-15 | |||
94 | 94 | ||
95 | Note that trying to mount a tmpfs with an mpol option will fail if the | 95 | Note that trying to mount a tmpfs with an mpol option will fail if the |
96 | running kernel does not support NUMA; and will fail if its nodelist | 96 | running kernel does not support NUMA; and will fail if its nodelist |
97 | specifies a node >= MAX_NUMNODES. If your system relies on that tmpfs | 97 | specifies a node which is not online. If your system relies on that |
98 | being mounted, but from time to time runs a kernel built without NUMA | 98 | tmpfs being mounted, but from time to time runs a kernel built without |
99 | capability (perhaps a safe recovery kernel), or configured to support | 99 | NUMA capability (perhaps a safe recovery kernel), or with fewer nodes |
100 | fewer nodes, then it is advisable to omit the mpol option from automatic | 100 | online, then it is advisable to omit the mpol option from automatic |
101 | mount options. It can be added later, when the tmpfs is already mounted | 101 | mount options. It can be added later, when the tmpfs is already mounted |
102 | on MountPoint, by 'mount -o remount,mpol=Policy:NodeList MountPoint'. | 102 | on MountPoint, by 'mount -o remount,mpol=Policy:NodeList MountPoint'. |
103 | 103 | ||
@@ -121,4 +121,4 @@ RAM/SWAP in 10240 inodes and it is only accessible by root. | |||
121 | Author: | 121 | Author: |
122 | Christoph Rohland <cr@sap.com>, 1.12.01 | 122 | Christoph Rohland <cr@sap.com>, 1.12.01 |
123 | Updated: | 123 | Updated: |
124 | Hugh Dickins <hugh@veritas.com>, 19 February 2006 | 124 | Hugh Dickins <hugh@veritas.com>, 4 June 2007 |
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index a47cc819f37b..045f3e055a28 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | Original author: Richard Gooch <rgooch@atnf.csiro.au> | 4 | Original author: Richard Gooch <rgooch@atnf.csiro.au> |
5 | 5 | ||
6 | Last updated on October 28, 2005 | 6 | Last updated on June 24, 2007. |
7 | 7 | ||
8 | Copyright (C) 1999 Richard Gooch | 8 | Copyright (C) 1999 Richard Gooch |
9 | Copyright (C) 2005 Pekka Enberg | 9 | Copyright (C) 2005 Pekka Enberg |
@@ -107,7 +107,7 @@ file /proc/filesystems. | |||
107 | struct file_system_type | 107 | struct file_system_type |
108 | ----------------------- | 108 | ----------------------- |
109 | 109 | ||
110 | This describes the filesystem. As of kernel 2.6.13, the following | 110 | This describes the filesystem. As of kernel 2.6.22, the following |
111 | members are defined: | 111 | members are defined: |
112 | 112 | ||
113 | struct file_system_type { | 113 | struct file_system_type { |
@@ -119,6 +119,8 @@ struct file_system_type { | |||
119 | struct module *owner; | 119 | struct module *owner; |
120 | struct file_system_type * next; | 120 | struct file_system_type * next; |
121 | struct list_head fs_supers; | 121 | struct list_head fs_supers; |
122 | struct lock_class_key s_lock_key; | ||
123 | struct lock_class_key s_umount_key; | ||
122 | }; | 124 | }; |
123 | 125 | ||
124 | name: the name of the filesystem type, such as "ext2", "iso9660", | 126 | name: the name of the filesystem type, such as "ext2", "iso9660", |
@@ -137,11 +139,12 @@ struct file_system_type { | |||
137 | 139 | ||
138 | next: for internal VFS use: you should initialize this to NULL | 140 | next: for internal VFS use: you should initialize this to NULL |
139 | 141 | ||
142 | s_lock_key, s_umount_key: lockdep-specific | ||
143 | |||
140 | The get_sb() method has the following arguments: | 144 | The get_sb() method has the following arguments: |
141 | 145 | ||
142 | struct super_block *sb: the superblock structure. This is partially | 146 | struct file_system_type *fs_type: decribes the filesystem, partly initialized |
143 | initialized by the VFS and the rest must be initialized by the | 147 | by the specific filesystem code |
144 | get_sb() method | ||
145 | 148 | ||
146 | int flags: mount flags | 149 | int flags: mount flags |
147 | 150 | ||
@@ -150,12 +153,13 @@ The get_sb() method has the following arguments: | |||
150 | void *data: arbitrary mount options, usually comes as an ASCII | 153 | void *data: arbitrary mount options, usually comes as an ASCII |
151 | string | 154 | string |
152 | 155 | ||
153 | int silent: whether or not to be silent on error | 156 | struct vfsmount *mnt: a vfs-internal representation of a mount point |
154 | 157 | ||
155 | The get_sb() method must determine if the block device specified | 158 | The get_sb() method must determine if the block device specified |
156 | in the superblock contains a filesystem of the type the method | 159 | in the dev_name and fs_type contains a filesystem of the type the method |
157 | supports. On success the method returns the superblock pointer, on | 160 | supports. If it succeeds in opening the named block device, it initializes a |
158 | failure it returns NULL. | 161 | struct super_block descriptor for the filesystem contained by the block device. |
162 | On failure it returns an error. | ||
159 | 163 | ||
160 | The most interesting member of the superblock structure that the | 164 | The most interesting member of the superblock structure that the |
161 | get_sb() method fills in is the "s_op" field. This is a pointer to | 165 | get_sb() method fills in is the "s_op" field. This is a pointer to |
@@ -193,7 +197,7 @@ struct super_operations | |||
193 | ----------------------- | 197 | ----------------------- |
194 | 198 | ||
195 | This describes how the VFS can manipulate the superblock of your | 199 | This describes how the VFS can manipulate the superblock of your |
196 | filesystem. As of kernel 2.6.13, the following members are defined: | 200 | filesystem. As of kernel 2.6.22, the following members are defined: |
197 | 201 | ||
198 | struct super_operations { | 202 | struct super_operations { |
199 | struct inode *(*alloc_inode)(struct super_block *sb); | 203 | struct inode *(*alloc_inode)(struct super_block *sb); |
@@ -216,8 +220,6 @@ struct super_operations { | |||
216 | void (*clear_inode) (struct inode *); | 220 | void (*clear_inode) (struct inode *); |
217 | void (*umount_begin) (struct super_block *); | 221 | void (*umount_begin) (struct super_block *); |
218 | 222 | ||
219 | void (*sync_inodes) (struct super_block *sb, | ||
220 | struct writeback_control *wbc); | ||
221 | int (*show_options)(struct seq_file *, struct vfsmount *); | 223 | int (*show_options)(struct seq_file *, struct vfsmount *); |
222 | 224 | ||
223 | ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); | 225 | ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); |
@@ -300,9 +302,6 @@ or bottom half). | |||
300 | 302 | ||
301 | umount_begin: called when the VFS is unmounting a filesystem. | 303 | umount_begin: called when the VFS is unmounting a filesystem. |
302 | 304 | ||
303 | sync_inodes: called when the VFS is writing out dirty data associated with | ||
304 | a superblock. | ||
305 | |||
306 | show_options: called by the VFS to show mount options for /proc/<pid>/mounts. | 305 | show_options: called by the VFS to show mount options for /proc/<pid>/mounts. |
307 | 306 | ||
308 | quota_read: called by the VFS to read from filesystem quota file. | 307 | quota_read: called by the VFS to read from filesystem quota file. |
@@ -324,7 +323,7 @@ struct inode_operations | |||
324 | ----------------------- | 323 | ----------------------- |
325 | 324 | ||
326 | This describes how the VFS can manipulate an inode in your | 325 | This describes how the VFS can manipulate an inode in your |
327 | filesystem. As of kernel 2.6.13, the following members are defined: | 326 | filesystem. As of kernel 2.6.22, the following members are defined: |
328 | 327 | ||
329 | struct inode_operations { | 328 | struct inode_operations { |
330 | int (*create) (struct inode *,struct dentry *,int, struct nameidata *); | 329 | int (*create) (struct inode *,struct dentry *,int, struct nameidata *); |
@@ -348,6 +347,7 @@ struct inode_operations { | |||
348 | ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); | 347 | ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); |
349 | ssize_t (*listxattr) (struct dentry *, char *, size_t); | 348 | ssize_t (*listxattr) (struct dentry *, char *, size_t); |
350 | int (*removexattr) (struct dentry *, const char *); | 349 | int (*removexattr) (struct dentry *, const char *); |
350 | void (*truncate_range)(struct inode *, loff_t, loff_t); | ||
351 | }; | 351 | }; |
352 | 352 | ||
353 | Again, all methods are called without any locks being held, unless | 353 | Again, all methods are called without any locks being held, unless |
@@ -444,6 +444,9 @@ otherwise noted. | |||
444 | removexattr: called by the VFS to remove an extended attribute from | 444 | removexattr: called by the VFS to remove an extended attribute from |
445 | a file. This method is called by removexattr(2) system call. | 445 | a file. This method is called by removexattr(2) system call. |
446 | 446 | ||
447 | truncate_range: a method provided by the underlying filesystem to truncate a | ||
448 | range of blocks , i.e. punch a hole somewhere in a file. | ||
449 | |||
447 | 450 | ||
448 | The Address Space Object | 451 | The Address Space Object |
449 | ======================== | 452 | ======================== |
@@ -522,7 +525,7 @@ struct address_space_operations | |||
522 | ------------------------------- | 525 | ------------------------------- |
523 | 526 | ||
524 | This describes how the VFS can manipulate mapping of a file to page cache in | 527 | This describes how the VFS can manipulate mapping of a file to page cache in |
525 | your filesystem. As of kernel 2.6.16, the following members are defined: | 528 | your filesystem. As of kernel 2.6.22, the following members are defined: |
526 | 529 | ||
527 | struct address_space_operations { | 530 | struct address_space_operations { |
528 | int (*writepage)(struct page *page, struct writeback_control *wbc); | 531 | int (*writepage)(struct page *page, struct writeback_control *wbc); |
@@ -543,6 +546,7 @@ struct address_space_operations { | |||
543 | int); | 546 | int); |
544 | /* migrate the contents of a page to the specified target */ | 547 | /* migrate the contents of a page to the specified target */ |
545 | int (*migratepage) (struct page *, struct page *); | 548 | int (*migratepage) (struct page *, struct page *); |
549 | int (*launder_page) (struct page *); | ||
546 | }; | 550 | }; |
547 | 551 | ||
548 | writepage: called by the VM to write a dirty page to backing store. | 552 | writepage: called by the VM to write a dirty page to backing store. |
@@ -689,6 +693,10 @@ struct address_space_operations { | |||
689 | transfer any private data across and update any references | 693 | transfer any private data across and update any references |
690 | that it has to the page. | 694 | that it has to the page. |
691 | 695 | ||
696 | launder_page: Called before freeing a page - it writes back the dirty page. To | ||
697 | prevent redirtying the page, it is kept locked during the whole | ||
698 | operation. | ||
699 | |||
692 | The File Object | 700 | The File Object |
693 | =============== | 701 | =============== |
694 | 702 | ||
@@ -699,9 +707,10 @@ struct file_operations | |||
699 | ---------------------- | 707 | ---------------------- |
700 | 708 | ||
701 | This describes how the VFS can manipulate an open file. As of kernel | 709 | This describes how the VFS can manipulate an open file. As of kernel |
702 | 2.6.17, the following members are defined: | 710 | 2.6.22, the following members are defined: |
703 | 711 | ||
704 | struct file_operations { | 712 | struct file_operations { |
713 | struct module *owner; | ||
705 | loff_t (*llseek) (struct file *, loff_t, int); | 714 | loff_t (*llseek) (struct file *, loff_t, int); |
706 | ssize_t (*read) (struct file *, char __user *, size_t, loff_t *); | 715 | ssize_t (*read) (struct file *, char __user *, size_t, loff_t *); |
707 | ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); | 716 | ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); |
@@ -728,10 +737,8 @@ struct file_operations { | |||
728 | int (*check_flags)(int); | 737 | int (*check_flags)(int); |
729 | int (*dir_notify)(struct file *filp, unsigned long arg); | 738 | int (*dir_notify)(struct file *filp, unsigned long arg); |
730 | int (*flock) (struct file *, int, struct file_lock *); | 739 | int (*flock) (struct file *, int, struct file_lock *); |
731 | ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, size_t, unsigned | 740 | ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, size_t, unsigned int); |
732 | int); | 741 | ssize_t (*splice_read)(struct file *, struct pipe_inode_info *, size_t, unsigned int); |
733 | ssize_t (*splice_read)(struct file *, struct pipe_inode_info *, size_t, unsigned | ||
734 | int); | ||
735 | }; | 742 | }; |
736 | 743 | ||
737 | Again, all methods are called without any locks being held, unless | 744 | Again, all methods are called without any locks being held, unless |
diff --git a/Documentation/firmware_class/README b/Documentation/firmware_class/README index e9cc8bb26f7d..c3480aa66ba8 100644 --- a/Documentation/firmware_class/README +++ b/Documentation/firmware_class/README | |||
@@ -1,7 +1,7 @@ | |||
1 | 1 | ||
2 | request_firmware() hotplug interface: | 2 | request_firmware() hotplug interface: |
3 | ------------------------------------ | 3 | ------------------------------------ |
4 | Copyright (C) 2003 Manuel Estrada Sainz <ranty@debian.org> | 4 | Copyright (C) 2003 Manuel Estrada Sainz |
5 | 5 | ||
6 | Why: | 6 | Why: |
7 | --- | 7 | --- |
diff --git a/Documentation/firmware_class/firmware_sample_driver.c b/Documentation/firmware_class/firmware_sample_driver.c index 87feccdb5c9f..6865cbe075ec 100644 --- a/Documentation/firmware_class/firmware_sample_driver.c +++ b/Documentation/firmware_class/firmware_sample_driver.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * firmware_sample_driver.c - | 2 | * firmware_sample_driver.c - |
3 | * | 3 | * |
4 | * Copyright (c) 2003 Manuel Estrada Sainz <ranty@debian.org> | 4 | * Copyright (c) 2003 Manuel Estrada Sainz |
5 | * | 5 | * |
6 | * Sample code on how to use request_firmware() from drivers. | 6 | * Sample code on how to use request_firmware() from drivers. |
7 | * | 7 | * |
diff --git a/Documentation/firmware_class/firmware_sample_firmware_class.c b/Documentation/firmware_class/firmware_sample_firmware_class.c index 9e1b0e4051cd..fba943aacf93 100644 --- a/Documentation/firmware_class/firmware_sample_firmware_class.c +++ b/Documentation/firmware_class/firmware_sample_firmware_class.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * firmware_sample_firmware_class.c - | 2 | * firmware_sample_firmware_class.c - |
3 | * | 3 | * |
4 | * Copyright (c) 2003 Manuel Estrada Sainz <ranty@debian.org> | 4 | * Copyright (c) 2003 Manuel Estrada Sainz |
5 | * | 5 | * |
6 | * NOTE: This is just a probe of concept, if you think that your driver would | 6 | * NOTE: This is just a probe of concept, if you think that your driver would |
7 | * be well served by this mechanism please contact me first. | 7 | * be well served by this mechanism please contact me first. |
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/firmware.h> | 19 | #include <linux/firmware.h> |
20 | 20 | ||
21 | 21 | ||
22 | MODULE_AUTHOR("Manuel Estrada Sainz <ranty@debian.org>"); | 22 | MODULE_AUTHOR("Manuel Estrada Sainz"); |
23 | MODULE_DESCRIPTION("Hackish sample for using firmware class directly"); | 23 | MODULE_DESCRIPTION("Hackish sample for using firmware class directly"); |
24 | MODULE_LICENSE("GPL"); | 24 | MODULE_LICENSE("GPL"); |
25 | 25 | ||
@@ -78,6 +78,7 @@ static CLASS_DEVICE_ATTR(loading, 0644, | |||
78 | firmware_loading_show, firmware_loading_store); | 78 | firmware_loading_show, firmware_loading_store); |
79 | 79 | ||
80 | static ssize_t firmware_data_read(struct kobject *kobj, | 80 | static ssize_t firmware_data_read(struct kobject *kobj, |
81 | struct bin_attribute *bin_attr, | ||
81 | char *buffer, loff_t offset, size_t count) | 82 | char *buffer, loff_t offset, size_t count) |
82 | { | 83 | { |
83 | struct class_device *class_dev = to_class_dev(kobj); | 84 | struct class_device *class_dev = to_class_dev(kobj); |
@@ -88,6 +89,7 @@ static ssize_t firmware_data_read(struct kobject *kobj, | |||
88 | return count; | 89 | return count; |
89 | } | 90 | } |
90 | static ssize_t firmware_data_write(struct kobject *kobj, | 91 | static ssize_t firmware_data_write(struct kobject *kobj, |
92 | struct bin_attribute *bin_attr, | ||
91 | char *buffer, loff_t offset, size_t count) | 93 | char *buffer, loff_t offset, size_t count) |
92 | { | 94 | { |
93 | struct class_device *class_dev = to_class_dev(kobj); | 95 | struct class_device *class_dev = to_class_dev(kobj); |
diff --git a/Documentation/gpio.txt b/Documentation/gpio.txt index 36af58eba136..218a8650f48d 100644 --- a/Documentation/gpio.txt +++ b/Documentation/gpio.txt | |||
@@ -75,6 +75,9 @@ using the include file: | |||
75 | If you stick to this convention then it'll be easier for other developers to | 75 | If you stick to this convention then it'll be easier for other developers to |
76 | see what your code is doing, and help maintain it. | 76 | see what your code is doing, and help maintain it. |
77 | 77 | ||
78 | Note that these operations include I/O barriers on platforms which need to | ||
79 | use them; drivers don't need to add them explicitly. | ||
80 | |||
78 | 81 | ||
79 | Identifying GPIOs | 82 | Identifying GPIOs |
80 | ----------------- | 83 | ----------------- |
diff --git a/Documentation/hrtimer/timer_stats.txt b/Documentation/hrtimer/timer_stats.txt index 22b0814d0ad0..20d368c59814 100644 --- a/Documentation/hrtimer/timer_stats.txt +++ b/Documentation/hrtimer/timer_stats.txt | |||
@@ -67,3 +67,7 @@ executed on expiry. | |||
67 | 67 | ||
68 | Thomas, Ingo | 68 | Thomas, Ingo |
69 | 69 | ||
70 | Added flag to indicate 'deferrable timer' in /proc/timer_stats. A deferrable | ||
71 | timer will appear as follows | ||
72 | 10D, 1 swapper queue_delayed_work_on (delayed_work_timer_fn) | ||
73 | |||
diff --git a/Documentation/hwmon/abituguru b/Documentation/hwmon/abituguru index b2c0d61b39a2..87ffa0f5ec70 100644 --- a/Documentation/hwmon/abituguru +++ b/Documentation/hwmon/abituguru | |||
@@ -2,7 +2,7 @@ Kernel driver abituguru | |||
2 | ======================= | 2 | ======================= |
3 | 3 | ||
4 | Supported chips: | 4 | Supported chips: |
5 | * Abit uGuru revision 1-3 (Hardware Monitor part only) | 5 | * Abit uGuru revision 1 & 2 (Hardware Monitor part only) |
6 | Prefix: 'abituguru' | 6 | Prefix: 'abituguru' |
7 | Addresses scanned: ISA 0x0E0 | 7 | Addresses scanned: ISA 0x0E0 |
8 | Datasheet: Not available, this driver is based on reverse engineering. | 8 | Datasheet: Not available, this driver is based on reverse engineering. |
@@ -20,8 +20,8 @@ Supported chips: | |||
20 | uGuru 2.1.0.0 ~ 2.1.2.8 (AS8, AV8, AA8, AG8, AA8XE, AX8) | 20 | uGuru 2.1.0.0 ~ 2.1.2.8 (AS8, AV8, AA8, AG8, AA8XE, AX8) |
21 | uGuru 2.2.0.0 ~ 2.2.0.6 (AA8 Fatal1ty) | 21 | uGuru 2.2.0.0 ~ 2.2.0.6 (AA8 Fatal1ty) |
22 | uGuru 2.3.0.0 ~ 2.3.0.9 (AN8) | 22 | uGuru 2.3.0.0 ~ 2.3.0.9 (AN8) |
23 | uGuru 3.0.0.0 ~ 3.0.1.2 (AW8, AL8, NI8) | 23 | uGuru 3.0.0.0 ~ 3.0.x.x (AW8, AL8, AT8, NI8 SLI, AT8 32X, AN8 32X, |
24 | uGuru 4.xxxxx? (AT8 32X) (2) | 24 | AW9D-MAX) (2) |
25 | 1) For revisions 2 and 3 uGuru's the driver can autodetect the | 25 | 1) For revisions 2 and 3 uGuru's the driver can autodetect the |
26 | sensortype (Volt or Temp) for bank1 sensors, for revision 1 uGuru's | 26 | sensortype (Volt or Temp) for bank1 sensors, for revision 1 uGuru's |
27 | this doesnot always work. For these uGuru's the autodection can | 27 | this doesnot always work. For these uGuru's the autodection can |
@@ -30,8 +30,9 @@ Supported chips: | |||
30 | bank1_types=1,1,0,0,0,0,0,2,0,0,0,0,2,0,0,1 | 30 | bank1_types=1,1,0,0,0,0,0,2,0,0,0,0,2,0,0,1 |
31 | You may also need to specify the fan_sensors option for these boards | 31 | You may also need to specify the fan_sensors option for these boards |
32 | fan_sensors=5 | 32 | fan_sensors=5 |
33 | 2) The current version of the abituguru driver is known to NOT work | 33 | 2) There is a seperate abituguru3 driver for these motherboards, |
34 | on these Motherboards | 34 | the abituguru (without the 3 !) driver will not work on these |
35 | motherboards (and visa versa)! | ||
35 | 36 | ||
36 | Authors: | 37 | Authors: |
37 | Hans de Goede <j.w.r.degoede@hhs.nl>, | 38 | Hans de Goede <j.w.r.degoede@hhs.nl>, |
@@ -43,8 +44,10 @@ Module Parameters | |||
43 | ----------------- | 44 | ----------------- |
44 | 45 | ||
45 | * force: bool Force detection. Note this parameter only causes the | 46 | * force: bool Force detection. Note this parameter only causes the |
46 | detection to be skipped, if the uGuru can't be read | 47 | detection to be skipped, and thus the insmod to |
47 | the module initialization (insmod) will still fail. | 48 | succeed. If the uGuru can't be read the actual hwmon |
49 | driver will not load and thus no hwmon device will get | ||
50 | registered. | ||
48 | * bank1_types: int[] Bank1 sensortype autodetection override: | 51 | * bank1_types: int[] Bank1 sensortype autodetection override: |
49 | -1 autodetect (default) | 52 | -1 autodetect (default) |
50 | 0 volt sensor | 53 | 0 volt sensor |
@@ -69,13 +72,15 @@ dmesg | grep abituguru | |||
69 | Description | 72 | Description |
70 | ----------- | 73 | ----------- |
71 | 74 | ||
72 | This driver supports the hardware monitoring features of the Abit uGuru chip | 75 | This driver supports the hardware monitoring features of the first and |
73 | found on Abit uGuru featuring motherboards (most modern Abit motherboards). | 76 | second revision of the Abit uGuru chip found on Abit uGuru featuring |
77 | motherboards (most modern Abit motherboards). | ||
74 | 78 | ||
75 | The uGuru chip in reality is a Winbond W83L950D in disguise (despite Abit | 79 | The first and second revision of the uGuru chip in reality is a Winbond |
76 | claiming it is "a new microprocessor designed by the ABIT Engineers"). | 80 | W83L950D in disguise (despite Abit claiming it is "a new microprocessor |
77 | Unfortunatly this doesn't help since the W83L950D is a generic | 81 | designed by the ABIT Engineers"). Unfortunatly this doesn't help since the |
78 | microcontroller with a custom Abit application running on it. | 82 | W83L950D is a generic microcontroller with a custom Abit application running |
83 | on it. | ||
79 | 84 | ||
80 | Despite Abit not releasing any information regarding the uGuru, Olle | 85 | Despite Abit not releasing any information regarding the uGuru, Olle |
81 | Sandberg <ollebull@gmail.com> has managed to reverse engineer the sensor part | 86 | Sandberg <ollebull@gmail.com> has managed to reverse engineer the sensor part |
diff --git a/Documentation/hwmon/abituguru3 b/Documentation/hwmon/abituguru3 new file mode 100644 index 000000000000..fa598aac22fa --- /dev/null +++ b/Documentation/hwmon/abituguru3 | |||
@@ -0,0 +1,65 @@ | |||
1 | Kernel driver abituguru3 | ||
2 | ======================== | ||
3 | |||
4 | Supported chips: | ||
5 | * Abit uGuru revision 3 (Hardware Monitor part, reading only) | ||
6 | Prefix: 'abituguru3' | ||
7 | Addresses scanned: ISA 0x0E0 | ||
8 | Datasheet: Not available, this driver is based on reverse engineering. | ||
9 | Note: | ||
10 | The uGuru is a microcontroller with onboard firmware which programs | ||
11 | it to behave as a hwmon IC. There are many different revisions of the | ||
12 | firmware and thus effectivly many different revisions of the uGuru. | ||
13 | Below is an incomplete list with which revisions are used for which | ||
14 | Motherboards: | ||
15 | uGuru 1.00 ~ 1.24 (AI7, KV8-MAX3, AN7) | ||
16 | uGuru 2.0.0.0 ~ 2.0.4.2 (KV8-PRO) | ||
17 | uGuru 2.1.0.0 ~ 2.1.2.8 (AS8, AV8, AA8, AG8, AA8XE, AX8) | ||
18 | uGuru 2.3.0.0 ~ 2.3.0.9 (AN8) | ||
19 | uGuru 3.0.0.0 ~ 3.0.x.x (AW8, AL8, AT8, NI8 SLI, AT8 32X, AN8 32X, | ||
20 | AW9D-MAX) | ||
21 | The abituguru3 driver is only for revison 3.0.x.x motherboards, | ||
22 | this driver will not work on older motherboards. For older | ||
23 | motherboards use the abituguru (without the 3 !) driver. | ||
24 | |||
25 | Authors: | ||
26 | Hans de Goede <j.w.r.degoede@hhs.nl>, | ||
27 | (Initial reverse engineering done by Louis Kruger) | ||
28 | |||
29 | |||
30 | Module Parameters | ||
31 | ----------------- | ||
32 | |||
33 | * force: bool Force detection. Note this parameter only causes the | ||
34 | detection to be skipped, and thus the insmod to | ||
35 | succeed. If the uGuru can't be read the actual hwmon | ||
36 | driver will not load and thus no hwmon device will get | ||
37 | registered. | ||
38 | * verbose: bool Should the driver be verbose? | ||
39 | 0/off/false normal output | ||
40 | 1/on/true + verbose error reporting (default) | ||
41 | Default: 1 (the driver is still in the testing phase) | ||
42 | |||
43 | Description | ||
44 | ----------- | ||
45 | |||
46 | This driver supports the hardware monitoring features of the third revision of | ||
47 | the Abit uGuru chip, found on recent Abit uGuru featuring motherboards. | ||
48 | |||
49 | The 3rd revision of the uGuru chip in reality is a Winbond W83L951G. | ||
50 | Unfortunatly this doesn't help since the W83L951G is a generic microcontroller | ||
51 | with a custom Abit application running on it. | ||
52 | |||
53 | Despite Abit not releasing any information regarding the uGuru revision 3, | ||
54 | Louis Kruger has managed to reverse engineer the sensor part of the uGuru. | ||
55 | Without his work this driver would not have been possible. | ||
56 | |||
57 | Known Issues | ||
58 | ------------ | ||
59 | |||
60 | The voltage and frequency control parts of the Abit uGuru are not supported, | ||
61 | neither is writing any of the sensor settings and writing / reading the | ||
62 | fanspeed control registers (FanEQ) | ||
63 | |||
64 | If you encounter any problems please mail me <j.w.r.degoede@hhs.nl> and | ||
65 | include the output of: "dmesg | grep abituguru" | ||
diff --git a/Documentation/hwmon/dme1737 b/Documentation/hwmon/dme1737 new file mode 100644 index 000000000000..1a0f3d64ab80 --- /dev/null +++ b/Documentation/hwmon/dme1737 | |||
@@ -0,0 +1,257 @@ | |||
1 | Kernel driver dme1737 | ||
2 | ===================== | ||
3 | |||
4 | Supported chips: | ||
5 | * SMSC DME1737 and compatibles (like Asus A8000) | ||
6 | Prefix: 'dme1737' | ||
7 | Addresses scanned: I2C 0x2c, 0x2d, 0x2e | ||
8 | Datasheet: Provided by SMSC upon request and under NDA | ||
9 | |||
10 | Authors: | ||
11 | Juerg Haefliger <juergh@gmail.com> | ||
12 | |||
13 | |||
14 | Module Parameters | ||
15 | ----------------- | ||
16 | |||
17 | * force_start: bool Enables the monitoring of voltage, fan and temp inputs | ||
18 | and PWM output control functions. Using this parameter | ||
19 | shouldn't be required since the BIOS usually takes care | ||
20 | of this. | ||
21 | |||
22 | Note that there is no need to use this parameter if the driver loads without | ||
23 | complaining. The driver will say so if it is necessary. | ||
24 | |||
25 | |||
26 | Description | ||
27 | ----------- | ||
28 | |||
29 | This driver implements support for the hardware monitoring capabilities of the | ||
30 | SMSC DME1737 and Asus A8000 (which are the same) Super-I/O chips. This chip | ||
31 | features monitoring of 3 temp sensors temp[1-3] (2 remote diodes and 1 | ||
32 | internal), 7 voltages in[0-6] (6 external and 1 internal) and 6 fan speeds | ||
33 | fan[1-6]. Additionally, the chip implements 5 PWM outputs pwm[1-3,5-6] for | ||
34 | controlling fan speeds both manually and automatically. | ||
35 | |||
36 | Fan[3-6] and pwm[3,5-6] are optional features and their availability is | ||
37 | dependent on the configuration of the chip. The driver will detect which | ||
38 | features are present during initialization and create the sysfs attributes | ||
39 | accordingly. | ||
40 | |||
41 | |||
42 | Voltage Monitoring | ||
43 | ------------------ | ||
44 | |||
45 | The voltage inputs are sampled with 12-bit resolution and have internal | ||
46 | scaling resistors. The values returned by the driver therefore reflect true | ||
47 | millivolts and don't need scaling. The voltage inputs are mapped as follows | ||
48 | (the last column indicates the input ranges): | ||
49 | |||
50 | in0: +5VTR (+5V standby) 0V - 6.64V | ||
51 | in1: Vccp (processor core) 0V - 3V | ||
52 | in2: VCC (internal +3.3V) 0V - 4.38V | ||
53 | in3: +5V 0V - 6.64V | ||
54 | in4: +12V 0V - 16V | ||
55 | in5: VTR (+3.3V standby) 0V - 4.38V | ||
56 | in6: Vbat (+3.0V) 0V - 4.38V | ||
57 | |||
58 | Each voltage input has associated min and max limits which trigger an alarm | ||
59 | when crossed. | ||
60 | |||
61 | |||
62 | Temperature Monitoring | ||
63 | ---------------------- | ||
64 | |||
65 | Temperatures are measured with 12-bit resolution and reported in millidegree | ||
66 | Celsius. The chip also features offsets for all 3 temperature inputs which - | ||
67 | when programmed - get added to the input readings. The chip does all the | ||
68 | scaling by itself and the driver therefore reports true temperatures that don't | ||
69 | need any user-space adjustments. The temperature inputs are mapped as follows | ||
70 | (the last column indicates the input ranges): | ||
71 | |||
72 | temp1: Remote diode 1 (3904 type) temperature -127C - +127C | ||
73 | temp2: DME1737 internal temperature -127C - +127C | ||
74 | temp3: Remote diode 2 (3904 type) temperature -127C - +127C | ||
75 | |||
76 | Each temperature input has associated min and max limits which trigger an alarm | ||
77 | when crossed. Additionally, each temperature input has a fault attribute that | ||
78 | returns 1 when a faulty diode or an unconnected input is detected and 0 | ||
79 | otherwise. | ||
80 | |||
81 | |||
82 | Fan Monitoring | ||
83 | -------------- | ||
84 | |||
85 | Fan RPMs are measured with 16-bit resolution. The chip provides inputs for 6 | ||
86 | fan tachometers. All 6 inputs have an associated min limit which triggers an | ||
87 | alarm when crossed. Fan inputs 1-4 provide type attributes that need to be set | ||
88 | to the number of pulses per fan revolution that the connected tachometer | ||
89 | generates. Supported values are 1, 2, and 4. Fan inputs 5-6 only support fans | ||
90 | that generate 2 pulses per revolution. Fan inputs 5-6 also provide a max | ||
91 | attribute that needs to be set to the maximum attainable RPM (fan at 100% duty- | ||
92 | cycle) of the input. The chip adjusts the sampling rate based on this value. | ||
93 | |||
94 | |||
95 | PWM Output Control | ||
96 | ------------------ | ||
97 | |||
98 | This chip features 5 PWM outputs. PWM outputs 1-3 are associated with fan | ||
99 | inputs 1-3 and PWM outputs 5-6 are associated with fan inputs 5-6. PWM outputs | ||
100 | 1-3 can be configured to operate either in manual or automatic mode by setting | ||
101 | the appropriate enable attribute accordingly. PWM outputs 5-6 can only operate | ||
102 | in manual mode, their enable attributes are therefore read-only. When set to | ||
103 | manual mode, the fan speed is set by writing the duty-cycle value to the | ||
104 | appropriate PWM attribute. In automatic mode, the PWM attribute returns the | ||
105 | current duty-cycle as set by the fan controller in the chip. All PWM outputs | ||
106 | support the setting of the output frequency via the freq attribute. | ||
107 | |||
108 | In automatic mode, the chip supports the setting of the PWM ramp rate which | ||
109 | defines how fast the PWM output is adjusting to changes of the associated | ||
110 | temperature input. Associating PWM outputs to temperature inputs is done via | ||
111 | temperature zones. The chip features 3 zones whose assignments to temperature | ||
112 | inputs is static and determined during initialization. These assignments can | ||
113 | be retrieved via the zone[1-3]_auto_channels_temp attributes. Each PWM output | ||
114 | is assigned to one (or hottest of multiple) temperature zone(s) through the | ||
115 | pwm[1-3]_auto_channels_zone attributes. Each PWM output has 3 distinct output | ||
116 | duty-cycles: full, low, and min. Full is internally hard-wired to 255 (100%) | ||
117 | and low and min can be programmed via pwm[1-3]_auto_point1_pwm and | ||
118 | pwm[1-3]_auto_pwm_min, respectively. The thermal thresholds of the zones are | ||
119 | programmed via zone[1-3]_auto_point[1-3]_temp and | ||
120 | zone[1-3]_auto_point1_temp_hyst: | ||
121 | |||
122 | pwm[1-3]_auto_point2_pwm full-speed duty-cycle (255, i.e., 100%) | ||
123 | pwm[1-3]_auto_point1_pwm low-speed duty-cycle | ||
124 | pwm[1-3]_auto_pwm_min min-speed duty-cycle | ||
125 | |||
126 | zone[1-3]_auto_point3_temp full-speed temp (all outputs) | ||
127 | zone[1-3]_auto_point2_temp full-speed temp | ||
128 | zone[1-3]_auto_point1_temp low-speed temp | ||
129 | zone[1-3]_auto_point1_temp_hyst min-speed temp | ||
130 | |||
131 | The chip adjusts the output duty-cycle linearly in the range of auto_point1_pwm | ||
132 | to auto_point2_pwm if the temperature of the associated zone is between | ||
133 | auto_point1_temp and auto_point2_temp. If the temperature drops below the | ||
134 | auto_point1_temp_hyst value, the output duty-cycle is set to the auto_pwm_min | ||
135 | value which only supports two values: 0 or auto_point1_pwm. That means that the | ||
136 | fan either turns completely off or keeps spinning with the low-speed | ||
137 | duty-cycle. If any of the temperatures rise above the auto_point3_temp value, | ||
138 | all PWM outputs are set to 100% duty-cycle. | ||
139 | |||
140 | Following is another representation of how the chip sets the output duty-cycle | ||
141 | based on the temperature of the associated thermal zone: | ||
142 | |||
143 | Duty-Cycle Duty-Cycle | ||
144 | Temperature Rising Temp Falling Temp | ||
145 | ----------- ----------- ------------ | ||
146 | full-speed full-speed full-speed | ||
147 | |||
148 | < linearly adjusted duty-cycle > | ||
149 | |||
150 | low-speed low-speed low-speed | ||
151 | min-speed low-speed | ||
152 | min-speed min-speed min-speed | ||
153 | min-speed min-speed | ||
154 | |||
155 | |||
156 | Sysfs Attributes | ||
157 | ---------------- | ||
158 | |||
159 | Following is a list of all sysfs attributes that the driver provides, their | ||
160 | permissions and a short description: | ||
161 | |||
162 | Name Perm Description | ||
163 | ---- ---- ----------- | ||
164 | cpu0_vid RO CPU core reference voltage in | ||
165 | millivolts. | ||
166 | vrm RW Voltage regulator module version | ||
167 | number. | ||
168 | |||
169 | in[0-6]_input RO Measured voltage in millivolts. | ||
170 | in[0-6]_min RW Low limit for voltage input. | ||
171 | in[0-6]_max RW High limit for voltage input. | ||
172 | in[0-6]_alarm RO Voltage input alarm. Returns 1 if | ||
173 | voltage input is or went outside the | ||
174 | associated min-max range, 0 otherwise. | ||
175 | |||
176 | temp[1-3]_input RO Measured temperature in millidegree | ||
177 | Celsius. | ||
178 | temp[1-3]_min RW Low limit for temp input. | ||
179 | temp[1-3]_max RW High limit for temp input. | ||
180 | temp[1-3]_offset RW Offset for temp input. This value will | ||
181 | be added by the chip to the measured | ||
182 | temperature. | ||
183 | temp[1-3]_alarm RO Alarm for temp input. Returns 1 if temp | ||
184 | input is or went outside the associated | ||
185 | min-max range, 0 otherwise. | ||
186 | temp[1-3]_fault RO Temp input fault. Returns 1 if the chip | ||
187 | detects a faulty thermal diode or an | ||
188 | unconnected temp input, 0 otherwise. | ||
189 | |||
190 | zone[1-3]_auto_channels_temp RO Temperature zone to temperature input | ||
191 | mapping. This attribute is a bitfield | ||
192 | and supports the following values: | ||
193 | 1: temp1 | ||
194 | 2: temp2 | ||
195 | 4: temp3 | ||
196 | zone[1-3]_auto_point1_temp_hyst RW Auto PWM temp point1 hysteresis. The | ||
197 | output of the corresponding PWM is set | ||
198 | to the pwm_auto_min value if the temp | ||
199 | falls below the auto_point1_temp_hyst | ||
200 | value. | ||
201 | zone[1-3]_auto_point[1-3]_temp RW Auto PWM temp points. Auto_point1 is | ||
202 | the low-speed temp, auto_point2 is the | ||
203 | full-speed temp, and auto_point3 is the | ||
204 | temp at which all PWM outputs are set | ||
205 | to full-speed (100% duty-cycle). | ||
206 | |||
207 | fan[1-6]_input RO Measured fan speed in RPM. | ||
208 | fan[1-6]_min RW Low limit for fan input. | ||
209 | fan[1-6]_alarm RO Alarm for fan input. Returns 1 if fan | ||
210 | input is or went below the associated | ||
211 | min value, 0 otherwise. | ||
212 | fan[1-4]_type RW Type of attached fan. Expressed in | ||
213 | number of pulses per revolution that | ||
214 | the fan generates. Supported values are | ||
215 | 1, 2, and 4. | ||
216 | fan[5-6]_max RW Max attainable RPM at 100% duty-cycle. | ||
217 | Required for chip to adjust the | ||
218 | sampling rate accordingly. | ||
219 | |||
220 | pmw[1-3,5-6] RO/RW Duty-cycle of PWM output. Supported | ||
221 | values are 0-255 (0%-100%). Only | ||
222 | writeable if the associated PWM is in | ||
223 | manual mode. | ||
224 | pwm[1-3]_enable RW Enable of PWM outputs 1-3. Supported | ||
225 | values are: | ||
226 | 0: turned off (output @ 100%) | ||
227 | 1: manual mode | ||
228 | 2: automatic mode | ||
229 | pwm[5-6]_enable RO Enable of PWM outputs 5-6. Always | ||
230 | returns 1 since these 2 outputs are | ||
231 | hard-wired to manual mode. | ||
232 | pmw[1-3,5-6]_freq RW Frequency of PWM output. Supported | ||
233 | values are in the range 11Hz-30000Hz | ||
234 | (default is 25000Hz). | ||
235 | pmw[1-3]_ramp_rate RW Ramp rate of PWM output. Determines how | ||
236 | fast the PWM duty-cycle will change | ||
237 | when the PWM is in automatic mode. | ||
238 | Expressed in ms per PWM step. Supported | ||
239 | values are in the range 0ms-206ms | ||
240 | (default is 0, which means the duty- | ||
241 | cycle changes instantly). | ||
242 | pwm[1-3]_auto_channels_zone RW PWM output to temperature zone mapping. | ||
243 | This attribute is a bitfield and | ||
244 | supports the following values: | ||
245 | 1: zone1 | ||
246 | 2: zone2 | ||
247 | 4: zone3 | ||
248 | 6: highest of zone[2-3] | ||
249 | 7: highest of zone[1-3] | ||
250 | pwm[1-3]_auto_pwm_min RW Auto PWM min pwm. Minimum PWM duty- | ||
251 | cycle. Supported values are 0 or | ||
252 | auto_point1_pwm. | ||
253 | pwm[1-3]_auto_point1_pwm RW Auto PWM pwm point. Auto_point1 is the | ||
254 | low-speed duty-cycle. | ||
255 | pwm[1-3]_auto_point2_pwm RO Auto PWM pwm point. Auto_point2 is the | ||
256 | full-speed duty-cycle which is hard- | ||
257 | wired to 255 (100% duty-cycle). | ||
diff --git a/Documentation/hwmon/f71805f b/Documentation/hwmon/f71805f index bfd0f154959c..94e0d2cbd3d2 100644 --- a/Documentation/hwmon/f71805f +++ b/Documentation/hwmon/f71805f | |||
@@ -5,11 +5,11 @@ Supported chips: | |||
5 | * Fintek F71805F/FG | 5 | * Fintek F71805F/FG |
6 | Prefix: 'f71805f' | 6 | Prefix: 'f71805f' |
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: Provided by Fintek on request | 8 | Datasheet: Available from the Fintek website |
9 | * Fintek F71872F/FG | 9 | * Fintek F71872F/FG |
10 | Prefix: 'f71872f' | 10 | Prefix: 'f71872f' |
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: Provided by Fintek on request | 12 | Datasheet: Available from the Fintek website |
13 | 13 | ||
14 | Author: Jean Delvare <khali@linux-fr.org> | 14 | Author: Jean Delvare <khali@linux-fr.org> |
15 | 15 | ||
@@ -128,7 +128,9 @@ it. | |||
128 | When the PWM method is used, you can select the operating frequency, | 128 | When the PWM method is used, you can select the operating frequency, |
129 | from 187.5 kHz (default) to 31 Hz. The best frequency depends on the | 129 | from 187.5 kHz (default) to 31 Hz. The best frequency depends on the |
130 | fan model. As a rule of thumb, lower frequencies seem to give better | 130 | fan model. As a rule of thumb, lower frequencies seem to give better |
131 | control, but may generate annoying high-pitch noise. Fintek recommends | 131 | control, but may generate annoying high-pitch noise. So a frequency just |
132 | above the audible range, such as 25 kHz, may be a good choice; if this | ||
133 | doesn't give you good linear control, try reducing it. Fintek recommends | ||
132 | not going below 1 kHz, as the fan tachometers get confused by lower | 134 | not going below 1 kHz, as the fan tachometers get confused by lower |
133 | frequencies as well. | 135 | frequencies as well. |
134 | 136 | ||
@@ -136,16 +138,23 @@ When the DC method is used, Fintek recommends not going below 5 V, which | |||
136 | corresponds to a pwm value of 106 for the driver. The driver doesn't | 138 | corresponds to a pwm value of 106 for the driver. The driver doesn't |
137 | enforce this limit though. | 139 | enforce this limit though. |
138 | 140 | ||
139 | Three different fan control modes are supported: | 141 | Three different fan control modes are supported; the mode number is written |
142 | to the pwm<n>_enable file. | ||
140 | 143 | ||
141 | * Manual mode | 144 | * 1: Manual mode |
142 | You ask for a specific PWM duty cycle or DC voltage. | 145 | You ask for a specific PWM duty cycle or DC voltage by writing to the |
146 | pwm<n> file. | ||
143 | 147 | ||
144 | * Fan speed mode | 148 | * 2: Temperature mode |
145 | You ask for a specific fan speed. This mode assumes that pwm1 | 149 | You define 3 temperature/fan speed trip points using the |
146 | corresponds to fan1, pwm2 to fan2 and pwm3 to fan3. | 150 | pwm<n>_auto_point<m>_temp and _fan files. These define a staircase |
151 | relationship between temperature and fan speed with two additional points | ||
152 | interpolated between the values that you define. When the temperature | ||
153 | is below auto_point1_temp the fan is switched off. | ||
147 | 154 | ||
148 | * Temperature mode | 155 | * 3: Fan speed mode |
149 | You define 3 temperature/fan speed trip points, and the fan speed is | 156 | You ask for a specific fan speed by writing to the fan<n>_target file. |
150 | adjusted depending on the measured temperature, using interpolation. | 157 | |
151 | This mode is not yet supported by the driver. | 158 | Both of the automatic modes require that pwm1 corresponds to fan1, pwm2 to |
159 | fan2 and pwm3 to fan3. Temperature mode also requires that temp1 corresponds | ||
160 | to pwm1 and fan1, etc. | ||
diff --git a/Documentation/hwmon/it87 b/Documentation/hwmon/it87 index c0528d6f9ace..81ecc7e41c50 100644 --- a/Documentation/hwmon/it87 +++ b/Documentation/hwmon/it87 | |||
@@ -12,11 +12,12 @@ Supported chips: | |||
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/ |
15 | * IT8716F | 15 | * IT8716F/IT8726F |
16 | Prefix: 'it8716' | 16 | Prefix: 'it8716' |
17 | Addresses scanned: from Super I/O config space (8 I/O ports) | 17 | Addresses scanned: from Super I/O config space (8 I/O ports) |
18 | Datasheet: Publicly available at the ITE website | 18 | Datasheet: Publicly available at the ITE website |
19 | http://www.ite.com.tw/product_info/file/pc/IT8716F_V0.3.ZIP | 19 | http://www.ite.com.tw/product_info/file/pc/IT8716F_V0.3.ZIP |
20 | http://www.ite.com.tw/product_info/file/pc/IT8726F_V0.3.pdf | ||
20 | * IT8718F | 21 | * IT8718F |
21 | Prefix: 'it8718' | 22 | Prefix: 'it8718' |
22 | Addresses scanned: from Super I/O config space (8 I/O ports) | 23 | Addresses scanned: from Super I/O config space (8 I/O ports) |
@@ -68,7 +69,7 @@ Description | |||
68 | ----------- | 69 | ----------- |
69 | 70 | ||
70 | This driver implements support for the IT8705F, IT8712F, IT8716F, | 71 | This driver implements support for the IT8705F, IT8712F, IT8716F, |
71 | IT8718F and SiS950 chips. | 72 | IT8718F, IT8726F and SiS950 chips. |
72 | 73 | ||
73 | These chips are 'Super I/O chips', supporting floppy disks, infrared ports, | 74 | These chips are 'Super I/O chips', supporting floppy disks, infrared ports, |
74 | joysticks and other miscellaneous stuff. For hardware monitoring, they | 75 | joysticks and other miscellaneous stuff. For hardware monitoring, they |
@@ -97,6 +98,10 @@ clock divider mess) but not compatible with the older chips and | |||
97 | revisions. For now, the driver only uses the 16-bit mode on the | 98 | revisions. For now, the driver only uses the 16-bit mode on the |
98 | IT8716F and IT8718F. | 99 | IT8716F and IT8718F. |
99 | 100 | ||
101 | The IT8726F is just bit enhanced IT8716F with additional hardware | ||
102 | for AMD power sequencing. Therefore the chip will appear as IT8716F | ||
103 | to userspace applications. | ||
104 | |||
100 | Temperatures are measured in degrees Celsius. An alarm is triggered once | 105 | Temperatures are measured in degrees Celsius. An alarm is triggered once |
101 | when the Overtemperature Shutdown limit is crossed. | 106 | when the Overtemperature Shutdown limit is crossed. |
102 | 107 | ||
diff --git a/Documentation/hwmon/lm90 b/Documentation/hwmon/lm90 index 438cb24cee5b..aa4a0ec20081 100644 --- a/Documentation/hwmon/lm90 +++ b/Documentation/hwmon/lm90 | |||
@@ -48,6 +48,18 @@ Supported chips: | |||
48 | Addresses scanned: I2C 0x4c, 0x4d (unsupported 0x4e) | 48 | Addresses scanned: I2C 0x4c, 0x4d (unsupported 0x4e) |
49 | Datasheet: Publicly available at the Maxim website | 49 | Datasheet: Publicly available at the Maxim website |
50 | http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2578 | 50 | http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2578 |
51 | * Maxim MAX6680 | ||
52 | Prefix: 'max6680' | ||
53 | Addresses scanned: I2C 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, | ||
54 | 0x4c, 0x4d and 0x4e | ||
55 | Datasheet: Publicly available at the Maxim website | ||
56 | http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3370 | ||
57 | * Maxim MAX6681 | ||
58 | Prefix: 'max6680' | ||
59 | Addresses scanned: I2C 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, | ||
60 | 0x4c, 0x4d and 0x4e | ||
61 | Datasheet: Publicly available at the Maxim website | ||
62 | http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3370 | ||
51 | 63 | ||
52 | 64 | ||
53 | Author: Jean Delvare <khali@linux-fr.org> | 65 | Author: Jean Delvare <khali@linux-fr.org> |
@@ -59,11 +71,15 @@ Description | |||
59 | The LM90 is a digital temperature sensor. It senses its own temperature as | 71 | The LM90 is a digital temperature sensor. It senses its own temperature as |
60 | well as the temperature of up to one external diode. It is compatible | 72 | well as the temperature of up to one external diode. It is compatible |
61 | with many other devices such as the LM86, the LM89, the LM99, the ADM1032, | 73 | with many other devices such as the LM86, the LM89, the LM99, the ADM1032, |
62 | the MAX6657, MAX6658 and the MAX6659 all of which are supported by this driver. | 74 | the MAX6657, MAX6658, MAX6659, MAX6680 and the MAX6681 all of which are |
63 | Note that there is no easy way to differentiate between the last three | 75 | supported by this driver. |
64 | variants. The extra address and features of the MAX6659 are not supported by | 76 | |
65 | this driver. Additionally, the ADT7461 is supported if found in ADM1032 | 77 | Note that there is no easy way to differentiate between the MAX6657, |
66 | compatibility mode. | 78 | MAX6658 and MAX6659 variants. The extra address and features of the |
79 | 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) | ||
81 | be distinguished. Additionally, the ADT7461 is supported if found in | ||
82 | ADM1032 compatibility mode. | ||
67 | 83 | ||
68 | The specificity of this family of chipsets over the ADM1021/LM84 | 84 | The specificity of this family of chipsets over the ADM1021/LM84 |
69 | family is that it features critical limits with hysteresis, and an | 85 | family is that it features critical limits with hysteresis, and an |
@@ -93,18 +109,22 @@ ADM1032: | |||
93 | * ALERT is triggered by open remote sensor. | 109 | * ALERT is triggered by open remote sensor. |
94 | * SMBus PEC support for Write Byte and Receive Byte transactions. | 110 | * SMBus PEC support for Write Byte and Receive Byte transactions. |
95 | 111 | ||
96 | ADT7461 | 112 | ADT7461: |
97 | * Extended temperature range (breaks compatibility) | 113 | * Extended temperature range (breaks compatibility) |
98 | * Lower resolution for remote temperature | 114 | * Lower resolution for remote temperature |
99 | 115 | ||
100 | MAX6657 and MAX6658: | 116 | MAX6657 and MAX6658: |
101 | * Remote sensor type selection | 117 | * Remote sensor type selection |
102 | 118 | ||
103 | MAX6659 | 119 | MAX6659: |
104 | * Selectable address | 120 | * Selectable address |
105 | * Second critical temperature limit | 121 | * Second critical temperature limit |
106 | * Remote sensor type selection | 122 | * Remote sensor type selection |
107 | 123 | ||
124 | MAX6680 and MAX6681: | ||
125 | * Selectable address | ||
126 | * Remote sensor type selection | ||
127 | |||
108 | All temperature values are given in degrees Celsius. Resolution | 128 | All temperature values are given in degrees Celsius. Resolution |
109 | is 1.0 degree for the local temperature, 0.125 degree for the remote | 129 | is 1.0 degree for the local temperature, 0.125 degree for the remote |
110 | temperature. | 130 | temperature. |
@@ -141,7 +161,7 @@ SMBus Read Byte, and PEC will work properly. | |||
141 | Additionally, the ADM1032 doesn't support SMBus Send Byte with PEC. | 161 | Additionally, the ADM1032 doesn't support SMBus Send Byte with PEC. |
142 | Instead, it will try to write the PEC value to the register (because the | 162 | Instead, it will try to write the PEC value to the register (because the |
143 | SMBus Send Byte transaction with PEC is similar to a Write Byte transaction | 163 | SMBus Send Byte transaction with PEC is similar to a Write Byte transaction |
144 | without PEC), which is not what we want. Thus, PEC is explicitely disabled | 164 | without PEC), which is not what we want. Thus, PEC is explicitly disabled |
145 | on SMBus Send Byte transactions in the lm90 driver. | 165 | on SMBus Send Byte transactions in the lm90 driver. |
146 | 166 | ||
147 | PEC on byte data transactions represents a significant increase in bandwidth | 167 | PEC on byte data transactions represents a significant increase in bandwidth |
diff --git a/Documentation/hwmon/lm93 b/Documentation/hwmon/lm93 new file mode 100644 index 000000000000..4e4a1dc1d2da --- /dev/null +++ b/Documentation/hwmon/lm93 | |||
@@ -0,0 +1,412 @@ | |||
1 | Kernel driver lm93 | ||
2 | ================== | ||
3 | |||
4 | Supported chips: | ||
5 | * National Semiconductor LM93 | ||
6 | Prefix 'lm93' | ||
7 | Addresses scanned: I2C 0x2c-0x2e | ||
8 | Datasheet: http://www.national.com/ds.cgi/LM/LM93.pdf | ||
9 | |||
10 | Author: | ||
11 | Mark M. Hoffman <mhoffman@lightlink.com> | ||
12 | Ported to 2.6 by Eric J. Bowersox <ericb@aspsys.com> | ||
13 | Adapted to 2.6.20 by Carsten Emde <ce@osadl.org> | ||
14 | Modified for mainline integration by Hans J. Koch <hjk@linutronix.de> | ||
15 | |||
16 | Module Parameters | ||
17 | ----------------- | ||
18 | |||
19 | (specific to LM93) | ||
20 | * init: integer | ||
21 | Set to non-zero to force some initializations (default is 0). | ||
22 | * disable_block: integer | ||
23 | A "0" allows SMBus block data transactions if the host supports them. A "1" | ||
24 | disables SMBus block data transactions. The default is 0. | ||
25 | * vccp_limit_type: integer array (2) | ||
26 | Configures in7 and in8 limit type, where 0 means absolute and non-zero | ||
27 | means relative. "Relative" here refers to "Dynamic Vccp Monitoring using | ||
28 | VID" from the datasheet. It greatly simplifies the interface to allow | ||
29 | only one set of limits (absolute or relative) to be in operation at a | ||
30 | time (even though the hardware is capable of enabling both). There's | ||
31 | not a compelling use case for enabling both at once, anyway. The default | ||
32 | is "0,0". | ||
33 | * vid_agtl: integer | ||
34 | A "0" configures the VID pins for V(ih) = 2.1V min, V(il) = 0.8V max. | ||
35 | A "1" configures the VID pins for V(ih) = 0.8V min, V(il) = 0.4V max. | ||
36 | (The latter setting is referred to as AGTL+ Compatible in the datasheet.) | ||
37 | I.e. this parameter controls the VID pin input thresholds; if your VID | ||
38 | inputs are not working, try changing this. The default value is "0". | ||
39 | |||
40 | (common among sensor drivers) | ||
41 | * force: short array (min = 1, max = 48) | ||
42 | List of adapter,address pairs to assume to be present. Autodetection | ||
43 | of the target device will still be attempted. Use one of the more | ||
44 | specific force directives below if this doesn't detect the device. | ||
45 | * force_lm93: short array (min = 1, max = 48) | ||
46 | List of adapter,address pairs which are unquestionably assumed to contain | ||
47 | a 'lm93' chip | ||
48 | * ignore: short array (min = 1, max = 48) | ||
49 | List of adapter,address pairs not to scan | ||
50 | * ignore_range: short array (min = 1, max = 48) | ||
51 | List of adapter,start-addr,end-addr triples not to scan | ||
52 | * probe: short array (min = 1, max = 48) | ||
53 | List of adapter,address pairs to scan additionally | ||
54 | * probe_range: short array (min = 1, max = 48) | ||
55 | List of adapter,start-addr,end-addr triples to scan additionally | ||
56 | |||
57 | |||
58 | Hardware Description | ||
59 | -------------------- | ||
60 | |||
61 | (from the datasheet) | ||
62 | |||
63 | The LM93, hardware monitor, has a two wire digital interface compatible with | ||
64 | SMBus 2.0. Using an 8-bit ADC, the LM93 measures the temperature of two remote | ||
65 | diode connected transistors as well as its own die and 16 power supply | ||
66 | voltages. To set fan speed, the LM93 has two PWM outputs that are each | ||
67 | controlled by up to four temperature zones. The fancontrol algorithm is lookup | ||
68 | table based. The LM93 includes a digital filter that can be invoked to smooth | ||
69 | temperature readings for better control of fan speed. The LM93 has four | ||
70 | tachometer inputs to measure fan speed. Limit and status registers for all | ||
71 | measured values are included. The LM93 builds upon the functionality of | ||
72 | previous motherboard management ASICs and uses some of the LM85 s features | ||
73 | (i.e. smart tachometer mode). It also adds measurement and control support | ||
74 | for dynamic Vccp monitoring and PROCHOT. It is designed to monitor a dual | ||
75 | processor Xeon class motherboard with a minimum of external components. | ||
76 | |||
77 | |||
78 | Driver Description | ||
79 | ------------------ | ||
80 | |||
81 | This driver implements support for the National Semiconductor LM93. | ||
82 | |||
83 | |||
84 | User Interface | ||
85 | -------------- | ||
86 | |||
87 | #PROCHOT: | ||
88 | |||
89 | The LM93 can monitor two #PROCHOT signals. The results are found in the | ||
90 | sysfs files prochot1, prochot2, prochot1_avg, prochot2_avg, prochot1_max, | ||
91 | and prochot2_max. prochot1_max and prochot2_max contain the user limits | ||
92 | for #PROCHOT1 and #PROCHOT2, respectively. prochot1 and prochot2 contain | ||
93 | the current readings for the most recent complete time interval. The | ||
94 | value of prochot1_avg and prochot2_avg is something like a 2 period | ||
95 | exponential moving average (but not quite - check the datasheet). Note | ||
96 | that this third value is calculated by the chip itself. All values range | ||
97 | from 0-255 where 0 indicates no throttling, and 255 indicates > 99.6%. | ||
98 | |||
99 | The monitoring intervals for the two #PROCHOT signals is also configurable. | ||
100 | These intervals can be found in the sysfs files prochot1_interval and | ||
101 | prochot2_interval. The values in these files specify the intervals for | ||
102 | #P1_PROCHOT and #P2_PROCHOT, respectively. Selecting a value not in this | ||
103 | list will cause the driver to use the next largest interval. The available | ||
104 | intervals are: | ||
105 | |||
106 | #PROCHOT intervals: 0.73, 1.46, 2.9, 5.8, 11.7, 23.3, 46.6, 93.2, 186, 372 | ||
107 | |||
108 | It is possible to configure the LM93 to logically short the two #PROCHOT | ||
109 | signals. I.e. when #P1_PROCHOT is asserted, the LM93 will automatically | ||
110 | assert #P2_PROCHOT, and vice-versa. This mode is enabled by writing a | ||
111 | non-zero integer to the sysfs file prochot_short. | ||
112 | |||
113 | The LM93 can also override the #PROCHOT pins by driving a PWM signal onto | ||
114 | one or both of them. When overridden, the signal has a period of 3.56 mS, | ||
115 | a minimum pulse width of 5 clocks (at 22.5kHz => 6.25% duty cycle), and | ||
116 | a maximum pulse width of 80 clocks (at 22.5kHz => 99.88% duty cycle). | ||
117 | |||
118 | The sysfs files prochot1_override and prochot2_override contain boolean | ||
119 | intgers which enable or disable the override function for #P1_PROCHOT and | ||
120 | #P2_PROCHOT, respectively. The sysfs file prochot_override_duty_cycle | ||
121 | contains a value controlling the duty cycle for the PWM signal used when | ||
122 | the override function is enabled. This value ranges from 0 to 15, with 0 | ||
123 | indicating minimum duty cycle and 15 indicating maximum. | ||
124 | |||
125 | #VRD_HOT: | ||
126 | |||
127 | The LM93 can monitor two #VRD_HOT signals. The results are found in the | ||
128 | sysfs files vrdhot1 and vrdhot2. There is one value per file: a boolean for | ||
129 | which 1 indicates #VRD_HOT is asserted and 0 indicates it is negated. These | ||
130 | files are read-only. | ||
131 | |||
132 | Smart Tach Mode: | ||
133 | |||
134 | (from the datasheet) | ||
135 | |||
136 | If a fan is driven using a low-side drive PWM, the tachometer | ||
137 | output of the fan is corrupted. The LM93 includes smart tachometer | ||
138 | circuitry that allows an accurate tachometer reading to be | ||
139 | achieved despite the signal corruption. In smart tach mode all | ||
140 | four signals are measured within 4 seconds. | ||
141 | |||
142 | Smart tach mode is enabled by the driver by writing 1 or 2 (associating the | ||
143 | the fan tachometer with a pwm) to the sysfs file fan<n>_smart_tach. A zero | ||
144 | will disable the function for that fan. Note that Smart tach mode cannot be | ||
145 | enabled if the PWM output frequency is 22500 Hz (see below). | ||
146 | |||
147 | Manual PWM: | ||
148 | |||
149 | The LM93 has a fixed or override mode for the two PWM outputs (although, there | ||
150 | are still some conditions that will override even this mode - see section | ||
151 | 15.10.6 of the datasheet for details.) The sysfs files pwm1_override | ||
152 | and pwm2_override are used to enable this mode; each is a boolean integer | ||
153 | where 0 disables and 1 enables the manual control mode. The sysfs files pwm1 | ||
154 | and pwm2 are used to set the manual duty cycle; each is an integer (0-255) | ||
155 | where 0 is 0% duty cycle, and 255 is 100%. Note that the duty cycle values | ||
156 | are constrained by the hardware. Selecting a value which is not available | ||
157 | will cause the driver to use the next largest value. Also note: when manual | ||
158 | PWM mode is disabled, the value of pwm1 and pwm2 indicates the current duty | ||
159 | cycle chosen by the h/w. | ||
160 | |||
161 | PWM Output Frequency: | ||
162 | |||
163 | The LM93 supports several different frequencies for the PWM output channels. | ||
164 | The sysfs files pwm1_freq and pwm2_freq are used to select the frequency. The | ||
165 | frequency values are constrained by the hardware. Selecting a value which is | ||
166 | not available will cause the driver to use the next largest value. Also note | ||
167 | that this parameter has implications for the Smart Tach Mode (see above). | ||
168 | |||
169 | PWM Output Frequencies: 12, 36, 48, 60, 72, 84, 96, 22500 (h/w default) | ||
170 | |||
171 | Automatic PWM: | ||
172 | |||
173 | The LM93 is capable of complex automatic fan control, with many different | ||
174 | points of configuration. To start, each PWM output can be bound to any | ||
175 | combination of eight control sources. The final PWM is the largest of all | ||
176 | individual control sources to which the PWM output is bound. | ||
177 | |||
178 | The eight control sources are: temp1-temp4 (aka "zones" in the datasheet), | ||
179 | #PROCHOT 1 & 2, and #VRDHOT 1 & 2. The bindings are expressed as a bitmask | ||
180 | in the sysfs files pwm<n>_auto_channels, where a "1" enables the binding, and | ||
181 | a "0" disables it. The h/w default is 0x0f (all temperatures bound). | ||
182 | |||
183 | 0x01 - Temp 1 | ||
184 | 0x02 - Temp 2 | ||
185 | 0x04 - Temp 3 | ||
186 | 0x08 - Temp 4 | ||
187 | 0x10 - #PROCHOT 1 | ||
188 | 0x20 - #PROCHOT 2 | ||
189 | 0x40 - #VRDHOT 1 | ||
190 | 0x80 - #VRDHOT 2 | ||
191 | |||
192 | The function y = f(x) takes a source temperature x to a PWM output y. This | ||
193 | function of the LM93 is derived from a base temperature and a table of 12 | ||
194 | temperature offsets. The base temperature is expressed in degrees C in the | ||
195 | sysfs files temp<n>_auto_base. The offsets are expressed in cumulative | ||
196 | degrees C, with the value of offset <i> for temperature value <n> being | ||
197 | contained in the file temp<n>_auto_offset<i>. E.g. if the base temperature | ||
198 | is 40C: | ||
199 | |||
200 | offset # temp<n>_auto_offset<i> range pwm | ||
201 | 1 0 - 25.00% | ||
202 | 2 0 - 28.57% | ||
203 | 3 1 40C - 41C 32.14% | ||
204 | 4 1 41C - 42C 35.71% | ||
205 | 5 2 42C - 44C 39.29% | ||
206 | 6 2 44C - 46C 42.86% | ||
207 | 7 2 48C - 50C 46.43% | ||
208 | 8 2 50C - 52C 50.00% | ||
209 | 9 2 52C - 54C 53.57% | ||
210 | 10 2 54C - 56C 57.14% | ||
211 | 11 2 56C - 58C 71.43% | ||
212 | 12 2 58C - 60C 85.71% | ||
213 | > 60C 100.00% | ||
214 | |||
215 | Valid offsets are in the range 0C <= x <= 7.5C in 0.5C increments. | ||
216 | |||
217 | There is an independent base temperature for each temperature channel. Note, | ||
218 | however, there are only two tables of offsets: one each for temp[12] and | ||
219 | temp[34]. Therefore, any change to e.g. temp1_auto_offset<i> will also | ||
220 | affect temp2_auto_offset<i>. | ||
221 | |||
222 | The LM93 can also apply hysteresis to the offset table, to prevent unwanted | ||
223 | oscillation between two steps in the offsets table. These values are found in | ||
224 | the sysfs files temp<n>_auto_offset_hyst. The value in this file has the | ||
225 | same representation as in temp<n>_auto_offset<i>. | ||
226 | |||
227 | If a temperature reading falls below the base value for that channel, the LM93 | ||
228 | will use the minimum PWM value. These values are found in the sysfs files | ||
229 | temp<n>_auto_pwm_min. Note, there are only two minimums: one each for temp[12] | ||
230 | and temp[34]. Therefore, any change to e.g. temp1_auto_pwm_min will also | ||
231 | affect temp2_auto_pwm_min. | ||
232 | |||
233 | PWM Spin-Up Cycle: | ||
234 | |||
235 | A spin-up cycle occurs when a PWM output is commanded from 0% duty cycle to | ||
236 | some value > 0%. The LM93 supports a minimum duty cycle during spin-up. These | ||
237 | values are found in the sysfs files pwm<n>_auto_spinup_min. The value in this | ||
238 | file has the same representation as other PWM duty cycle values. The | ||
239 | duration of the spin-up cycle is also configurable. These values are found in | ||
240 | the sysfs files pwm<n>_auto_spinup_time. The value in this file is | ||
241 | the spin-up time in seconds. The available spin-up times are constrained by | ||
242 | the hardware. Selecting a value which is not available will cause the driver | ||
243 | to use the next largest value. | ||
244 | |||
245 | Spin-up Durations: 0 (disabled, h/w default), 0.1, 0.25, 0.4, 0.7, 1.0, | ||
246 | 2.0, 4.0 | ||
247 | |||
248 | #PROCHOT and #VRDHOT PWM Ramping: | ||
249 | |||
250 | If the #PROCHOT or #VRDHOT signals are asserted while bound to a PWM output | ||
251 | channel, the LM93 will ramp the PWM output up to 100% duty cycle in discrete | ||
252 | steps. The duration of each step is configurable. There are two files, with | ||
253 | one value each in seconds: pwm_auto_prochot_ramp and pwm_auto_vrdhot_ramp. | ||
254 | The available ramp times are constrained by the hardware. Selecting a value | ||
255 | which is not available will cause the driver to use the next largest value. | ||
256 | |||
257 | Ramp Times: 0 (disabled, h/w default) to 0.75 in 0.05 second intervals | ||
258 | |||
259 | Fan Boost: | ||
260 | |||
261 | For each temperature channel, there is a boost temperature: if the channel | ||
262 | exceeds this limit, the LM93 will immediately drive both PWM outputs to 100%. | ||
263 | This limit is expressed in degrees C in the sysfs files temp<n>_auto_boost. | ||
264 | There is also a hysteresis temperature for this function: after the boost | ||
265 | limit is reached, the temperature channel must drop below this value before | ||
266 | the boost function is disabled. This temperature is also expressed in degrees | ||
267 | C in the sysfs files temp<n>_auto_boost_hyst. | ||
268 | |||
269 | GPIO Pins: | ||
270 | |||
271 | The LM93 can monitor the logic level of four dedicated GPIO pins as well as the | ||
272 | four tach input pins. GPIO0-GPIO3 correspond to (fan) tach 1-4, respectively. | ||
273 | All eight GPIOs are read by reading the bitmask in the sysfs file gpio. The | ||
274 | LSB is GPIO0, and the MSB is GPIO7. | ||
275 | |||
276 | |||
277 | LM93 Unique sysfs Files | ||
278 | ----------------------- | ||
279 | |||
280 | file description | ||
281 | ------------------------------------------------------------- | ||
282 | |||
283 | prochot<n> current #PROCHOT % | ||
284 | |||
285 | prochot<n>_avg moving average #PROCHOT % | ||
286 | |||
287 | prochot<n>_max limit #PROCHOT % | ||
288 | |||
289 | prochot_short enable or disable logical #PROCHOT pin short | ||
290 | |||
291 | prochot<n>_override force #PROCHOT assertion as PWM | ||
292 | |||
293 | prochot_override_duty_cycle | ||
294 | duty cycle for the PWM signal used when | ||
295 | #PROCHOT is overridden | ||
296 | |||
297 | prochot<n>_interval #PROCHOT PWM sampling interval | ||
298 | |||
299 | vrdhot<n> 0 means negated, 1 means asserted | ||
300 | |||
301 | fan<n>_smart_tach enable or disable smart tach mode | ||
302 | |||
303 | pwm<n>_auto_channels select control sources for PWM outputs | ||
304 | |||
305 | pwm<n>_auto_spinup_min minimum duty cycle during spin-up | ||
306 | |||
307 | pwm<n>_auto_spinup_time duration of spin-up | ||
308 | |||
309 | pwm_auto_prochot_ramp ramp time per step when #PROCHOT asserted | ||
310 | |||
311 | pwm_auto_vrdhot_ramp ramp time per step when #VRDHOT asserted | ||
312 | |||
313 | temp<n>_auto_base temperature channel base | ||
314 | |||
315 | temp<n>_auto_offset[1-12] | ||
316 | temperature channel offsets | ||
317 | |||
318 | temp<n>_auto_offset_hyst | ||
319 | temperature channel offset hysteresis | ||
320 | |||
321 | temp<n>_auto_boost temperature channel boost (PWMs to 100%) limit | ||
322 | |||
323 | temp<n>_auto_boost_hyst temperature channel boost hysteresis | ||
324 | |||
325 | gpio input state of 8 GPIO pins; read-only | ||
326 | |||
327 | |||
328 | Sample Configuration File | ||
329 | ------------------------- | ||
330 | |||
331 | Here is a sample LM93 chip config for sensors.conf: | ||
332 | |||
333 | ---------- cut here ---------- | ||
334 | chip "lm93-*" | ||
335 | |||
336 | # VOLTAGE INPUTS | ||
337 | |||
338 | # labels and scaling based on datasheet recommendations | ||
339 | label in1 "+12V1" | ||
340 | compute in1 @ * 12.945, @ / 12.945 | ||
341 | set in1_min 12 * 0.90 | ||
342 | set in1_max 12 * 1.10 | ||
343 | |||
344 | label in2 "+12V2" | ||
345 | compute in2 @ * 12.945, @ / 12.945 | ||
346 | set in2_min 12 * 0.90 | ||
347 | set in2_max 12 * 1.10 | ||
348 | |||
349 | label in3 "+12V3" | ||
350 | compute in3 @ * 12.945, @ / 12.945 | ||
351 | set in3_min 12 * 0.90 | ||
352 | set in3_max 12 * 1.10 | ||
353 | |||
354 | label in4 "FSB_Vtt" | ||
355 | |||
356 | label in5 "3GIO" | ||
357 | |||
358 | label in6 "ICH_Core" | ||
359 | |||
360 | label in7 "Vccp1" | ||
361 | |||
362 | label in8 "Vccp2" | ||
363 | |||
364 | label in9 "+3.3V" | ||
365 | set in9_min 3.3 * 0.90 | ||
366 | set in9_max 3.3 * 1.10 | ||
367 | |||
368 | label in10 "+5V" | ||
369 | set in10_min 5.0 * 0.90 | ||
370 | set in10_max 5.0 * 1.10 | ||
371 | |||
372 | label in11 "SCSI_Core" | ||
373 | |||
374 | label in12 "Mem_Core" | ||
375 | |||
376 | label in13 "Mem_Vtt" | ||
377 | |||
378 | label in14 "Gbit_Core" | ||
379 | |||
380 | # Assuming R1/R2 = 4.1143, and 3.3V reference | ||
381 | # -12V = (4.1143 + 1) * (@ - 3.3) + 3.3 | ||
382 | label in15 "-12V" | ||
383 | compute in15 @ * 5.1143 - 13.57719, (@ + 13.57719) / 5.1143 | ||
384 | set in15_min -12 * 0.90 | ||
385 | set in15_max -12 * 1.10 | ||
386 | |||
387 | label in16 "+3.3VSB" | ||
388 | set in16_min 3.3 * 0.90 | ||
389 | set in16_max 3.3 * 1.10 | ||
390 | |||
391 | # TEMPERATURE INPUTS | ||
392 | |||
393 | label temp1 "CPU1" | ||
394 | label temp2 "CPU2" | ||
395 | label temp3 "LM93" | ||
396 | |||
397 | # TACHOMETER INPUTS | ||
398 | |||
399 | label fan1 "Fan1" | ||
400 | set fan1_min 3000 | ||
401 | label fan2 "Fan2" | ||
402 | set fan2_min 3000 | ||
403 | label fan3 "Fan3" | ||
404 | set fan3_min 3000 | ||
405 | label fan4 "Fan4" | ||
406 | set fan4_min 3000 | ||
407 | |||
408 | # PWM OUTPUTS | ||
409 | |||
410 | label pwm1 "CPU1" | ||
411 | label pwm2 "CPU2" | ||
412 | |||
diff --git a/Documentation/hwmon/smsc47b397 b/Documentation/hwmon/smsc47b397 index 20682f15ae41..3a43b6948924 100644 --- a/Documentation/hwmon/smsc47b397 +++ b/Documentation/hwmon/smsc47b397 | |||
@@ -4,6 +4,7 @@ Kernel driver smsc47b397 | |||
4 | Supported chips: | 4 | Supported chips: |
5 | * SMSC LPC47B397-NC | 5 | * SMSC LPC47B397-NC |
6 | * SMSC SCH5307-NS | 6 | * SMSC SCH5307-NS |
7 | * SMSC SCH5317 | ||
7 | Prefix: 'smsc47b397' | 8 | Prefix: 'smsc47b397' |
8 | Addresses scanned: none, address read from Super I/O config space | 9 | Addresses scanned: none, address read from Super I/O config space |
9 | Datasheet: In this file | 10 | Datasheet: In this file |
@@ -18,8 +19,8 @@ The following specification describes the SMSC LPC47B397-NC[1] sensor chip | |||
18 | provided by Craig Kelly (In-Store Broadcast Network) and edited/corrected | 19 | provided by Craig Kelly (In-Store Broadcast Network) and edited/corrected |
19 | by Mark M. Hoffman <mhoffman@lightlink.com>. | 20 | by Mark M. Hoffman <mhoffman@lightlink.com>. |
20 | 21 | ||
21 | [1] And SMSC SCH5307-NS, which has a different device ID but is otherwise | 22 | [1] And SMSC SCH5307-NS and SCH5317, which have different device IDs but are |
22 | compatible. | 23 | otherwise compatible. |
23 | 24 | ||
24 | * * * * * | 25 | * * * * * |
25 | 26 | ||
@@ -131,7 +132,7 @@ OUT DX,AL | |||
131 | The registers of interest for identifying the SIO on the dc7100 are Device ID | 132 | The registers of interest for identifying the SIO on the dc7100 are Device ID |
132 | (0x20) and Device Rev (0x21). | 133 | (0x20) and Device Rev (0x21). |
133 | 134 | ||
134 | The Device ID will read 0x6F (for SCH5307-NS, 0x81) | 135 | The Device ID will read 0x6F (0x81 for SCH5307-NS, and 0x85 for SCH5317) |
135 | The Device Rev currently reads 0x01 | 136 | The Device Rev currently reads 0x01 |
136 | 137 | ||
137 | Obtaining the HWM Base Address. | 138 | Obtaining the HWM Base Address. |
diff --git a/Documentation/hwmon/sysfs-interface b/Documentation/hwmon/sysfs-interface index a9a18ad0d17a..b3a9e1b9dbda 100644 --- a/Documentation/hwmon/sysfs-interface +++ b/Documentation/hwmon/sysfs-interface | |||
@@ -172,11 +172,10 @@ pwm[1-*] Pulse width modulation fan control. | |||
172 | 255 is max or 100%. | 172 | 255 is max or 100%. |
173 | 173 | ||
174 | pwm[1-*]_enable | 174 | pwm[1-*]_enable |
175 | Switch PWM on and off. | 175 | Fan speed control method: |
176 | Not always present even if pwmN is. | 176 | 0: no fan speed control (i.e. fan at full speed) |
177 | 0: turn off | 177 | 1: manual fan speed control enabled (using pwm[1-*]) |
178 | 1: turn on in manual mode | 178 | 2+: automatic fan speed control enabled |
179 | 2+: turn on in automatic mode | ||
180 | Check individual chip documentation files for automatic mode | 179 | Check individual chip documentation files for automatic mode |
181 | details. | 180 | details. |
182 | RW | 181 | RW |
@@ -343,9 +342,9 @@ to notify open diodes, unconnected fans etc. where the hardware | |||
343 | supports it. When this boolean has value 1, the measurement for that | 342 | supports it. When this boolean has value 1, the measurement for that |
344 | channel should not be trusted. | 343 | channel should not be trusted. |
345 | 344 | ||
346 | in[0-*]_input_fault | 345 | in[0-*]_fault |
347 | fan[1-*]_input_fault | 346 | fan[1-*]_fault |
348 | temp[1-*]_input_fault | 347 | temp[1-*]_fault |
349 | Input fault condition | 348 | Input fault condition |
350 | 0: no fault occured | 349 | 0: no fault occured |
351 | 1: fault condition | 350 | 1: fault condition |
diff --git a/Documentation/hwmon/w83627ehf b/Documentation/hwmon/w83627ehf index 030fac6cec7a..ccc2bcb61068 100644 --- a/Documentation/hwmon/w83627ehf +++ b/Documentation/hwmon/w83627ehf | |||
@@ -22,9 +22,9 @@ This driver implements support for the Winbond W83627EHF, W83627EHG, and | |||
22 | W83627DHG super I/O chips. We will refer to them collectively as Winbond chips. | 22 | W83627DHG super I/O chips. We will refer to them collectively as Winbond chips. |
23 | 23 | ||
24 | The chips implement three temperature sensors, five fan rotation | 24 | The chips implement three temperature sensors, five fan rotation |
25 | speed sensors, ten analog voltage sensors (only nine for the 627DHG), alarms | 25 | speed sensors, ten analog voltage sensors (only nine for the 627DHG), one |
26 | with beep warnings (control unimplemented), and some automatic fan regulation | 26 | VID (6 pins), alarms with beep warnings (control unimplemented), and |
27 | strategies (plus manual fan control mode). | 27 | some automatic fan regulation strategies (plus manual fan control mode). |
28 | 28 | ||
29 | Temperatures are measured in degrees Celsius and measurement resolution is 1 | 29 | Temperatures are measured in degrees Celsius and measurement resolution is 1 |
30 | degC for temp1 and 0.5 degC for temp2 and temp3. An alarm is triggered when | 30 | degC for temp1 and 0.5 degC for temp2 and temp3. An alarm is triggered when |
diff --git a/Documentation/i2c/busses/i2c-i801 b/Documentation/i2c/busses/i2c-i801 index c34f0db78a30..fe6406f2f9a6 100644 --- a/Documentation/i2c/busses/i2c-i801 +++ b/Documentation/i2c/busses/i2c-i801 | |||
@@ -5,8 +5,8 @@ Supported adapters: | |||
5 | '810' and '810E' chipsets) | 5 | '810' and '810E' chipsets) |
6 | * Intel 82801BA (ICH2 - part of the '815E' chipset) | 6 | * Intel 82801BA (ICH2 - part of the '815E' chipset) |
7 | * Intel 82801CA/CAM (ICH3) | 7 | * Intel 82801CA/CAM (ICH3) |
8 | * Intel 82801DB (ICH4) (HW PEC supported, 32 byte buffer not supported) | 8 | * Intel 82801DB (ICH4) (HW PEC supported) |
9 | * Intel 82801EB/ER (ICH5) (HW PEC supported, 32 byte buffer not supported) | 9 | * Intel 82801EB/ER (ICH5) (HW PEC supported) |
10 | * Intel 6300ESB | 10 | * Intel 6300ESB |
11 | * Intel 82801FB/FR/FW/FRW (ICH6) | 11 | * Intel 82801FB/FR/FW/FRW (ICH6) |
12 | * Intel 82801G (ICH7) | 12 | * Intel 82801G (ICH7) |
diff --git a/Documentation/i2c/busses/i2c-piix4 b/Documentation/i2c/busses/i2c-piix4 index 7cbe43fa2701..fa0c786a8bf5 100644 --- a/Documentation/i2c/busses/i2c-piix4 +++ b/Documentation/i2c/busses/i2c-piix4 | |||
@@ -6,7 +6,7 @@ Supported adapters: | |||
6 | Datasheet: Publicly available at the Intel website | 6 | Datasheet: Publicly available at the Intel website |
7 | * ServerWorks OSB4, CSB5, CSB6 and HT-1000 southbridges | 7 | * ServerWorks OSB4, CSB5, CSB6 and HT-1000 southbridges |
8 | Datasheet: Only available via NDA from ServerWorks | 8 | Datasheet: Only available via NDA from ServerWorks |
9 | * ATI IXP200, IXP300, IXP400 and SB600 southbridges | 9 | * ATI IXP200, IXP300, IXP400, SB600 and SB700 southbridges |
10 | Datasheet: Not publicly available | 10 | Datasheet: Not publicly available |
11 | * Standard Microsystems (SMSC) SLC90E66 (Victory66) southbridge | 11 | * Standard Microsystems (SMSC) SLC90E66 (Victory66) southbridge |
12 | Datasheet: Publicly available at the SMSC website http://www.smsc.com | 12 | Datasheet: Publicly available at the SMSC website http://www.smsc.com |
diff --git a/Documentation/i2c/busses/i2c-taos-evm b/Documentation/i2c/busses/i2c-taos-evm new file mode 100644 index 000000000000..9146e33be6dd --- /dev/null +++ b/Documentation/i2c/busses/i2c-taos-evm | |||
@@ -0,0 +1,46 @@ | |||
1 | Kernel driver i2c-taos-evm | ||
2 | |||
3 | Author: Jean Delvare <khali@linux-fr.org> | ||
4 | |||
5 | This is a driver for the evaluation modules for TAOS I2C/SMBus chips. | ||
6 | The modules include an SMBus master with limited capabilities, which can | ||
7 | be controlled over the serial port. Virtually all evaluation modules | ||
8 | are supported, but a few lines of code need to be added for each new | ||
9 | module to instantiate the right I2C chip on the bus. Obviously, a driver | ||
10 | for the chip in question is also needed. | ||
11 | |||
12 | Currently supported devices are: | ||
13 | |||
14 | * TAOS TSL2550 EVM | ||
15 | |||
16 | For addtional information on TAOS products, please see | ||
17 | http://www.taosinc.com/ | ||
18 | |||
19 | |||
20 | Using this driver | ||
21 | ----------------- | ||
22 | |||
23 | In order to use this driver, you'll need the serport driver, and the | ||
24 | inputattach tool, which is part of the input-utils package. The following | ||
25 | commands will tell the kernel that you have a TAOS EVM on the first | ||
26 | serial port: | ||
27 | |||
28 | # modprobe serport | ||
29 | # inputattach --taos-evm /dev/ttyS0 | ||
30 | |||
31 | |||
32 | Technical details | ||
33 | ----------------- | ||
34 | |||
35 | Only 4 SMBus transaction types are supported by the TAOS evaluation | ||
36 | modules: | ||
37 | * Receive Byte | ||
38 | * Send Byte | ||
39 | * Read Byte | ||
40 | * Write Byte | ||
41 | |||
42 | The communication protocol is text-based and pretty simple. It is | ||
43 | described in a PDF document on the CD which comes with the evaluation | ||
44 | module. The communication is rather slow, because the serial port has | ||
45 | to operate at 1200 bps. However, I don't think this is a big concern in | ||
46 | practice, as these modules are meant for evaluation and testing only. | ||
diff --git a/Documentation/i2c/chips/max6875 b/Documentation/i2c/chips/max6875 index 96fec562a8e9..a0cd8af2f408 100644 --- a/Documentation/i2c/chips/max6875 +++ b/Documentation/i2c/chips/max6875 | |||
@@ -99,7 +99,7 @@ And then read the data | |||
99 | 99 | ||
100 | or | 100 | or |
101 | 101 | ||
102 | count = i2c_smbus_read_i2c_block_data(fd, 0x84, buffer); | 102 | count = i2c_smbus_read_i2c_block_data(fd, 0x84, 16, buffer); |
103 | 103 | ||
104 | The block read should read 16 bytes. | 104 | The block read should read 16 bytes. |
105 | 0x84 is the block read command. | 105 | 0x84 is the block read command. |
diff --git a/Documentation/i2c/chips/x1205 b/Documentation/i2c/chips/x1205 deleted file mode 100644 index 09407c991fe5..000000000000 --- a/Documentation/i2c/chips/x1205 +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | Kernel driver x1205 | ||
2 | =================== | ||
3 | |||
4 | Supported chips: | ||
5 | * Xicor X1205 RTC | ||
6 | Prefix: 'x1205' | ||
7 | Addresses scanned: none | ||
8 | Datasheet: http://www.intersil.com/cda/deviceinfo/0,1477,X1205,00.html | ||
9 | |||
10 | Authors: | ||
11 | Karen Spearel <kas11@tampabay.rr.com>, | ||
12 | Alessandro Zummo <a.zummo@towertech.it> | ||
13 | |||
14 | Description | ||
15 | ----------- | ||
16 | |||
17 | This module aims to provide complete access to the Xicor X1205 RTC. | ||
18 | Recently Xicor has merged with Intersil, but the chip is | ||
19 | still sold under the Xicor brand. | ||
20 | |||
21 | This chip is located at address 0x6f and uses a 2-byte register addressing. | ||
22 | Two bytes need to be written to read a single register, while most | ||
23 | other chips just require one and take the second one as the data | ||
24 | to be written. To prevent corrupting unknown chips, the user must | ||
25 | explicitely set the probe parameter. | ||
26 | |||
27 | example: | ||
28 | |||
29 | modprobe x1205 probe=0,0x6f | ||
30 | |||
31 | The module supports one more option, hctosys, which is used to set the | ||
32 | software clock from the x1205. On systems where the x1205 is the | ||
33 | only hardware rtc, this parameter could be used to achieve a correct | ||
34 | date/time earlier in the system boot sequence. | ||
35 | |||
36 | example: | ||
37 | |||
38 | modprobe x1205 probe=0,0x6f hctosys=1 | ||
diff --git a/Documentation/i2c/summary b/Documentation/i2c/summary index aea60bf7e8f0..003c7319b8c7 100644 --- a/Documentation/i2c/summary +++ b/Documentation/i2c/summary | |||
@@ -67,7 +67,6 @@ i2c-proc: The /proc/sys/dev/sensors interface for device (client) drivers | |||
67 | Algorithm drivers | 67 | Algorithm drivers |
68 | ----------------- | 68 | ----------------- |
69 | 69 | ||
70 | i2c-algo-8xx: An algorithm for CPM's I2C device in Motorola 8xx processors (NOT BUILT BY DEFAULT) | ||
71 | i2c-algo-bit: A bit-banging algorithm | 70 | i2c-algo-bit: A bit-banging algorithm |
72 | i2c-algo-pcf: A PCF 8584 style algorithm | 71 | i2c-algo-pcf: A PCF 8584 style algorithm |
73 | i2c-algo-ibm_ocp: An algorithm for the I2C device in IBM 4xx processors (NOT BUILT BY DEFAULT) | 72 | i2c-algo-ibm_ocp: An algorithm for the I2C device in IBM 4xx processors (NOT BUILT BY DEFAULT) |
@@ -81,6 +80,5 @@ i2c-pcf-epp: PCF8584 on a EPP parallel port (uses i2c-algo-pcf) (NOT mkpatch | |||
81 | i2c-philips-par: Philips style parallel port adapter (uses i2c-algo-bit) | 80 | i2c-philips-par: Philips style parallel port adapter (uses i2c-algo-bit) |
82 | i2c-adap-ibm_ocp: IBM 4xx processor I2C device (uses i2c-algo-ibm_ocp) (NOT BUILT BY DEFAULT) | 81 | i2c-adap-ibm_ocp: IBM 4xx processor I2C device (uses i2c-algo-ibm_ocp) (NOT BUILT BY DEFAULT) |
83 | i2c-pport: Primitive parallel port adapter (uses i2c-algo-bit) | 82 | i2c-pport: Primitive parallel port adapter (uses i2c-algo-bit) |
84 | i2c-rpx: RPX board Motorola 8xx I2C device (uses i2c-algo-8xx) (NOT BUILT BY DEFAULT) | ||
85 | i2c-velleman: Velleman K8000 parallel port adapter (uses i2c-algo-bit) | 83 | i2c-velleman: Velleman K8000 parallel port adapter (uses i2c-algo-bit) |
86 | 84 | ||
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients index 3d8d36b0ad12..2c170032bf37 100644 --- a/Documentation/i2c/writing-clients +++ b/Documentation/i2c/writing-clients | |||
@@ -571,7 +571,7 @@ SMBus communication | |||
571 | u8 command, u8 length, | 571 | u8 command, u8 length, |
572 | u8 *values); | 572 | u8 *values); |
573 | extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client, | 573 | extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client, |
574 | u8 command, u8 *values); | 574 | u8 command, u8 length, u8 *values); |
575 | 575 | ||
576 | These ones were removed in Linux 2.6.10 because they had no users, but could | 576 | These ones were removed in Linux 2.6.10 because they had no users, but could |
577 | be added back later if needed: | 577 | be added back later if needed: |
diff --git a/Documentation/i386/zero-page.txt b/Documentation/i386/zero-page.txt index c04a421f4a7c..75b3680c41eb 100644 --- a/Documentation/i386/zero-page.txt +++ b/Documentation/i386/zero-page.txt | |||
@@ -37,6 +37,7 @@ Offset Type Description | |||
37 | 0x1d0 unsigned long EFI memory descriptor map pointer | 37 | 0x1d0 unsigned long EFI memory descriptor map pointer |
38 | 0x1d4 unsigned long EFI memory descriptor map size | 38 | 0x1d4 unsigned long EFI memory descriptor map size |
39 | 0x1e0 unsigned long ALT_MEM_K, alternative mem check, in Kb | 39 | 0x1e0 unsigned long ALT_MEM_K, alternative mem check, in Kb |
40 | 0x1e4 unsigned long Scratch field for the kernel setup code | ||
40 | 0x1e8 char number of entries in E820MAP (below) | 41 | 0x1e8 char number of entries in E820MAP (below) |
41 | 0x1e9 unsigned char number of entries in EDDBUF (below) | 42 | 0x1e9 unsigned char number of entries in EDDBUF (below) |
42 | 0x1ea unsigned char number of entries in EDD_MBR_SIG_BUFFER (below) | 43 | 0x1ea unsigned char number of entries in EDD_MBR_SIG_BUFFER (below) |
diff --git a/Documentation/ia64/aliasing-test.c b/Documentation/ia64/aliasing-test.c index d485256ee1ce..773a814d4093 100644 --- a/Documentation/ia64/aliasing-test.c +++ b/Documentation/ia64/aliasing-test.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <sys/mman.h> | 19 | #include <sys/mman.h> |
20 | #include <sys/stat.h> | 20 | #include <sys/stat.h> |
21 | #include <unistd.h> | 21 | #include <unistd.h> |
22 | #include <linux/pci.h> | ||
22 | 23 | ||
23 | int sum; | 24 | int sum; |
24 | 25 | ||
@@ -34,13 +35,19 @@ int map_mem(char *path, off_t offset, size_t length, int touch) | |||
34 | return -1; | 35 | return -1; |
35 | } | 36 | } |
36 | 37 | ||
38 | if (fnmatch("/proc/bus/pci/*", path, 0) == 0) { | ||
39 | rc = ioctl(fd, PCIIOC_MMAP_IS_MEM); | ||
40 | if (rc == -1) | ||
41 | perror("PCIIOC_MMAP_IS_MEM ioctl"); | ||
42 | } | ||
43 | |||
37 | addr = mmap(NULL, length, PROT_READ|PROT_WRITE, MAP_SHARED, fd, offset); | 44 | addr = mmap(NULL, length, PROT_READ|PROT_WRITE, MAP_SHARED, fd, offset); |
38 | if (addr == MAP_FAILED) | 45 | if (addr == MAP_FAILED) |
39 | return 1; | 46 | return 1; |
40 | 47 | ||
41 | if (touch) { | 48 | if (touch) { |
42 | c = (int *) addr; | 49 | c = (int *) addr; |
43 | while (c < (int *) (offset + length)) | 50 | while (c < (int *) (addr + length)) |
44 | sum += *c++; | 51 | sum += *c++; |
45 | } | 52 | } |
46 | 53 | ||
@@ -54,7 +61,7 @@ int map_mem(char *path, off_t offset, size_t length, int touch) | |||
54 | return 0; | 61 | return 0; |
55 | } | 62 | } |
56 | 63 | ||
57 | int scan_sysfs(char *path, char *file, off_t offset, size_t length, int touch) | 64 | int scan_tree(char *path, char *file, off_t offset, size_t length, int touch) |
58 | { | 65 | { |
59 | struct dirent **namelist; | 66 | struct dirent **namelist; |
60 | char *name, *path2; | 67 | char *name, *path2; |
@@ -93,7 +100,7 @@ int scan_sysfs(char *path, char *file, off_t offset, size_t length, int touch) | |||
93 | } else { | 100 | } else { |
94 | r = lstat(path2, &buf); | 101 | r = lstat(path2, &buf); |
95 | if (r == 0 && S_ISDIR(buf.st_mode)) { | 102 | if (r == 0 && S_ISDIR(buf.st_mode)) { |
96 | rc = scan_sysfs(path2, file, offset, length, touch); | 103 | rc = scan_tree(path2, file, offset, length, touch); |
97 | if (rc < 0) | 104 | if (rc < 0) |
98 | return rc; | 105 | return rc; |
99 | } | 106 | } |
@@ -238,10 +245,15 @@ int main() | |||
238 | else | 245 | else |
239 | fprintf(stderr, "FAIL: /dev/mem 0x0-0x100000 not accessible\n"); | 246 | fprintf(stderr, "FAIL: /dev/mem 0x0-0x100000 not accessible\n"); |
240 | 247 | ||
241 | scan_sysfs("/sys/class/pci_bus", "legacy_mem", 0, 0xA0000, 1); | 248 | scan_tree("/sys/class/pci_bus", "legacy_mem", 0, 0xA0000, 1); |
242 | scan_sysfs("/sys/class/pci_bus", "legacy_mem", 0xA0000, 0x20000, 0); | 249 | scan_tree("/sys/class/pci_bus", "legacy_mem", 0xA0000, 0x20000, 0); |
243 | scan_sysfs("/sys/class/pci_bus", "legacy_mem", 0xC0000, 0x40000, 1); | 250 | scan_tree("/sys/class/pci_bus", "legacy_mem", 0xC0000, 0x40000, 1); |
244 | scan_sysfs("/sys/class/pci_bus", "legacy_mem", 0, 1024*1024, 0); | 251 | scan_tree("/sys/class/pci_bus", "legacy_mem", 0, 1024*1024, 0); |
245 | 252 | ||
246 | scan_rom("/sys/devices", "rom"); | 253 | scan_rom("/sys/devices", "rom"); |
254 | |||
255 | scan_tree("/proc/bus/pci", "??.?", 0, 0xA0000, 1); | ||
256 | scan_tree("/proc/bus/pci", "??.?", 0xA0000, 0x20000, 0); | ||
257 | scan_tree("/proc/bus/pci", "??.?", 0xC0000, 0x40000, 1); | ||
258 | scan_tree("/proc/bus/pci", "??.?", 0, 1024*1024, 0); | ||
247 | } | 259 | } |
diff --git a/Documentation/ia64/aliasing.txt b/Documentation/ia64/aliasing.txt index 9a431a7d0f5d..aa3e953f0f7b 100644 --- a/Documentation/ia64/aliasing.txt +++ b/Documentation/ia64/aliasing.txt | |||
@@ -112,6 +112,18 @@ POTENTIAL ATTRIBUTE ALIASING CASES | |||
112 | 112 | ||
113 | The /dev/mem mmap constraints apply. | 113 | The /dev/mem mmap constraints apply. |
114 | 114 | ||
115 | mmap of /proc/bus/pci/.../??.? | ||
116 | |||
117 | This is an MMIO mmap of PCI functions, which additionally may or | ||
118 | may not be requested as using the WC attribute. | ||
119 | |||
120 | If WC is requested, and the region in kern_memmap is either WC | ||
121 | or UC, and the EFI memory map designates the region as WC, then | ||
122 | the WC mapping is allowed. | ||
123 | |||
124 | Otherwise, the user mapping must use the same attribute as the | ||
125 | kernel mapping. | ||
126 | |||
115 | read/write of /dev/mem | 127 | read/write of /dev/mem |
116 | 128 | ||
117 | This uses copy_from_user(), which implicitly uses a kernel | 129 | This uses copy_from_user(), which implicitly uses a kernel |
diff --git a/Documentation/ioctl-number.txt b/Documentation/ioctl-number.txt index 3de7d379cf07..5c7fbf9d96b4 100644 --- a/Documentation/ioctl-number.txt +++ b/Documentation/ioctl-number.txt | |||
@@ -67,7 +67,7 @@ Code Seq# Include File Comments | |||
67 | 0x00 00-1F linux/wavefront.h conflict! | 67 | 0x00 00-1F linux/wavefront.h conflict! |
68 | 0x02 all linux/fd.h | 68 | 0x02 all linux/fd.h |
69 | 0x03 all linux/hdreg.h | 69 | 0x03 all linux/hdreg.h |
70 | 0x04 all linux/umsdos_fs.h | 70 | 0x04 D2-DC linux/umsdos_fs.h Dead since 2.6.11, but don't reuse these. |
71 | 0x06 all linux/lp.h | 71 | 0x06 all linux/lp.h |
72 | 0x09 all linux/md.h | 72 | 0x09 all linux/md.h |
73 | 0x12 all linux/fs.h | 73 | 0x12 all linux/fs.h |
diff --git a/Documentation/ja_JP/HOWTO b/Documentation/ja_JP/HOWTO new file mode 100644 index 000000000000..b2446a090870 --- /dev/null +++ b/Documentation/ja_JP/HOWTO | |||
@@ -0,0 +1,650 @@ | |||
1 | NOTE: | ||
2 | This is Japanese translated version of "Documentation/HOWTO". | ||
3 | This one is maintained by Tsugikazu Shibata <tshibata@ab.jp.nec.com> | ||
4 | and JF Project team <www.linux.or.jp/JF>. | ||
5 | If you find difference with original file or problem in translation, | ||
6 | please contact maintainer of this file or JF project. | ||
7 | |||
8 | Please also note that purpose of this file is easier to read for non | ||
9 | English natives and not to be intended to fork. So, if you have any | ||
10 | comments or updates of this file, please try to update Original(English) | ||
11 | file at first. | ||
12 | |||
13 | Last Updated: 2007/06/04 | ||
14 | ================================== | ||
15 | これは、 | ||
16 | linux-2.6.21/Documentation/HOWTO | ||
17 | の和訳です。 | ||
18 | |||
19 | 翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ > | ||
20 | 翻訳日: 2007/06/04 | ||
21 | 翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com> | ||
22 | 校正者: 松倉さん <nbh--mats at nifty dot com> | ||
23 | 小林 雅典さん (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp> | ||
24 | 武井伸光さん、<takei at webmasters dot gr dot jp> | ||
25 | かねこさん (Seiji Kaneko) <skaneko at a2 dot mbn dot or dot jp> | ||
26 | 野口さん (Kenji Noguchi) <tokyo246 at gmail dot com> | ||
27 | 河内さん (Takayoshi Kochi) <t-kochi at bq dot jp dot nec dot com> | ||
28 | 岩本さん (iwamoto) <iwamoto.kn at ncos dot nec dot co dot jp> | ||
29 | ================================== | ||
30 | |||
31 | Linux カーネル開発のやり方 | ||
32 | ------------------------------- | ||
33 | |||
34 | これは上のトピック( Linux カーネル開発のやり方)の重要な事柄を網羅した | ||
35 | ドキュメントです。ここには Linux カーネル開発者になるための方法と | ||
36 | Linux カーネル開発コミュニティと共に活動するやり方を学ぶ方法が含まれて | ||
37 | います。カーネルプログラミングに関する技術的な項目に関することは何も含 | ||
38 | めないようにしていますが、カーネル開発者となるための正しい方向に向かう | ||
39 | 手助けになります。 | ||
40 | |||
41 | もし、このドキュメントのどこかが古くなっていた場合には、このドキュメン | ||
42 | トの最後にリストしたメンテナーにパッチを送ってください。 | ||
43 | |||
44 | はじめに | ||
45 | --------- | ||
46 | |||
47 | あなたは Linux カーネルの開発者になる方法を学びたいのでしょうか? そ | ||
48 | れともあなたは上司から「このデバイスの Linux ドライバを書くように」と | ||
49 | 言われているのでしょうか? | ||
50 | この文書の目的は、あなたが踏むべき手順と、コミュニティと一緒にうまく働 | ||
51 | くヒントを書き下すことで、あなたが知るべき全てのことを教えることです。 | ||
52 | また、このコミュニティがなぜ今うまくまわっているのかという理由の一部も | ||
53 | 説明しようと試みています。 | ||
54 | |||
55 | カーネルは 少量のアーキテクチャ依存部分がアセンブリ言語で書かれている | ||
56 | 以外は大部分は C 言語で書かれています。C言語をよく理解していることはカー | ||
57 | ネル開発者には必要です。アーキテクチャ向けの低レベル部分の開発をするの | ||
58 | でなければ、(どんなアーキテクチャでも)アセンブリ(訳注: 言語)は必要あり | ||
59 | ません。以下の本は、C 言語の十分な知識や何年もの経験に取って代わるもの | ||
60 | ではありませんが、少なくともリファレンスとしてはいい本です。 | ||
61 | - "The C Programming Language" by Kernighan and Ritchie [Prentice Hall] | ||
62 | -『プログラミング言語C第2版』(B.W. カーニハン/D.M. リッチー著 石田晴久訳) [共立出版] | ||
63 | - "Practical C Programming" by Steve Oualline [O'Reilly] | ||
64 | - 『C実践プログラミング第3版』(Steve Oualline著 望月康司監訳 谷口功訳) [オライリージャパン] | ||
65 | - "C: A Reference Manual" by Harbison and Steele [Prentice Hall] | ||
66 | - 『新・詳説 C 言語 H&S リファレンス』 | ||
67 | (サミュエル P ハービソン/ガイ L スティール共著 斉藤 信男監訳)[ソフトバンク] | ||
68 | |||
69 | カーネルは GNU C と GNU ツールチェインを使って書かれています。カーネル | ||
70 | は ISO C89 仕様に準拠して書く一方で、標準には無い言語拡張を多く使って | ||
71 | います。カーネルは標準 C ライブラリとは関係がないといった、C 言語フリー | ||
72 | スタンディング環境です。そのため、C の標準で使えないものもあります。任 | ||
73 | 意の long long の除算や浮動小数点は使えません。 | ||
74 | ときどき、カーネルがツールチェインや C 言語拡張に置いている前提がどう | ||
75 | なっているのかわかりにくいことがあり、また、残念なことに決定的なリファ | ||
76 | レンスは存在しません。情報を得るには、gcc の info ページ( info gcc )を | ||
77 | みてください。 | ||
78 | |||
79 | あなたは既存の開発コミュニティと一緒に作業する方法を学ぼうとしているこ | ||
80 | とに留意してください。そのコミュニティは、コーディング、スタイル、 | ||
81 | 開発手順について高度な標準を持つ、多様な人の集まりです。 | ||
82 | 地理的に分散した大規模なチームに対してもっともうまくいくとわかったこと | ||
83 | をベースにしながら、これらの標準は長い時間をかけて築かれてきました。 | ||
84 | これらはきちんと文書化されていますから、事前にこれらの標準についてでき | ||
85 | るだけたくさん学んでください。また皆があなたやあなたの会社のやり方に合わ | ||
86 | せてくれると思わないでください。 | ||
87 | |||
88 | 法的問題 | ||
89 | ------------ | ||
90 | |||
91 | Linux カーネルのソースコードは GPL ライセンスの下でリリースされていま | ||
92 | す。ライセンスの詳細については、ソースツリーのメインディレクトリに存在 | ||
93 | する、COPYING のファイルをみてください。もしライセンスについてさらに質 | ||
94 | 問があれば、Linux Kernel メーリングリストに質問するのではなく、どうぞ | ||
95 | 法律家に相談してください。メーリングリストの人達は法律家ではなく、法的 | ||
96 | 問題については彼らの声明はあてにするべきではありません。 | ||
97 | |||
98 | GPL に関する共通の質問や回答については、以下を参照してください。 | ||
99 | http://www.gnu.org/licenses/gpl-faq.html | ||
100 | |||
101 | ドキュメント | ||
102 | ------------ | ||
103 | |||
104 | Linux カーネルソースツリーは幅広い範囲のドキュメントを含んでおり、それ | ||
105 | らはカーネルコミュニティと会話する方法を学ぶのに非常に貴重なものです。 | ||
106 | 新しい機能がカーネルに追加される場合、その機能の使い方について説明した | ||
107 | 新しいドキュメントファイルも追加することを勧めます。 | ||
108 | カーネルの変更が、カーネルがユーザ空間に公開しているインターフェイスの | ||
109 | 変更を引き起こす場合、その変更を説明するマニュアルページのパッチや情報 | ||
110 | をマニュアルページのメンテナ mtk-manpages@gmx.net に送ることを勧めます。 | ||
111 | |||
112 | 以下はカーネルソースツリーに含まれている読んでおくべきファイルの一覧で | ||
113 | す- | ||
114 | |||
115 | README | ||
116 | このファイルは Linuxカーネルの簡単な背景とカーネルを設定(訳注 | ||
117 | configure )し、生成(訳注 build )するために必要なことは何かが書かれ | ||
118 | ています。カーネルに関して初めての人はここからスタートするとよいで | ||
119 | しょう。 | ||
120 | |||
121 | Documentation/Changes | ||
122 | このファイルはカーネルをうまく生成(訳注 build )し、走らせるのに最 | ||
123 | 小限のレベルで必要な数々のソフトウェアパッケージの一覧を示してい | ||
124 | ます。 | ||
125 | |||
126 | Documentation/CodingStyle | ||
127 | これは Linux カーネルのコーディングスタイルと背景にある理由を記述 | ||
128 | しています。全ての新しいコードはこのドキュメントにあるガイドライン | ||
129 | に従っていることを期待されています。大部分のメンテナーはこれらのルー | ||
130 | ルに従っているものだけを受け付け、多くの人は正しいスタイルのコード | ||
131 | だけをレビューします。 | ||
132 | |||
133 | Documentation/SubmittingPatches | ||
134 | Documentation/SubmittingDrivers | ||
135 | これらのファイルには、どうやってうまくパッチを作って投稿するかに | ||
136 | ついて非常に詳しく書かれており、以下を含みます(これだけに限らない | ||
137 | けれども) | ||
138 | - Email に含むこと | ||
139 | - Email の形式 | ||
140 | - だれに送るか | ||
141 | これらのルールに従えばうまくいくことを保証することではありません | ||
142 | が (すべてのパッチは内容とスタイルについて精査を受けるので)、 | ||
143 | ルールに従わなければ間違いなくうまくいかないでしょう。 | ||
144 | この他にパッチを作る方法についてのよくできた記述は- | ||
145 | |||
146 | "The Perfect Patch" | ||
147 | http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt | ||
148 | "Linux kernel patch submission format" | ||
149 | http://linux.yyz.us/patch-format.html | ||
150 | |||
151 | Documentation/stable_api_nonsense.txt | ||
152 | このファイルはカーネルの中に不変のAPIを持たないことにした意識的な | ||
153 | 決断の背景にある理由について書かれています。以下のようなことを含 | ||
154 | んでいます- | ||
155 | - サブシステムとの間に層を作ること(コンパチビリティのため?) | ||
156 | - オペレーティングシステム間のドライバの移植性 | ||
157 | - カーネルソースツリーの素早い変更を遅らせる(もしくは素早い変更 | ||
158 | を妨げる) | ||
159 | このドキュメントは Linux 開発の思想を理解するのに非常に重要です。 | ||
160 | そして、他のOSでの開発者が Linux に移る時にとても重要です。 | ||
161 | |||
162 | Documentation/SecurityBugs | ||
163 | もし Linux カーネルでセキュリティ問題を発見したように思ったら、こ | ||
164 | のドキュメントのステップに従ってカーネル開発者に連絡し、問題解決を | ||
165 | 支援してください。 | ||
166 | |||
167 | Documentation/ManagementStyle | ||
168 | このドキュメントは Linux カーネルのメンテナー達がどう行動するか、 | ||
169 | 彼らの手法の背景にある共有されている精神について記述しています。こ | ||
170 | れはカーネル開発の初心者なら(もしくは、単に興味があるだけの人でも) | ||
171 | 重要です。なぜならこのドキュメントは、カーネルメンテナー達の独特な | ||
172 | 行動についての多くの誤解や混乱を解消するからです。 | ||
173 | |||
174 | Documentation/stable_kernel_rules.txt | ||
175 | このファイルはどのように stable カーネルのリリースが行われるかのルー | ||
176 | ルが記述されています。そしてこれらのリリースの中のどこかで変更を取 | ||
177 | り入れてもらいたい場合に何をすればいいかが示されています。 | ||
178 | |||
179 | Documentation/kernel-docs.txt | ||
180 | カーネル開発に付随する外部ドキュメントのリストです。もしあなたが | ||
181 | 探しているものがカーネル内のドキュメントでみつからなかった場合、 | ||
182 | このリストをあたってみてください。 | ||
183 | |||
184 | Documentation/applying-patches.txt | ||
185 | パッチとはなにか、パッチをどうやって様々なカーネルの開発ブランチに | ||
186 | 適用するのかについて正確に記述した良い入門書です。 | ||
187 | |||
188 | カーネルはソースコードから自動的に生成可能な多数のドキュメントを自分自 | ||
189 | 身でもっています。これにはカーネル内 API のすべての記述や、どう正しく | ||
190 | ロックをかけるかの規則が含まれます。このドキュメントは | ||
191 | Documentation/DocBook/ ディレクトリに作られ、以下のように | ||
192 | make pdfdocs | ||
193 | make psdocs | ||
194 | make htmldocs | ||
195 | make mandocs | ||
196 | コマンドを実行するとメインカーネルのソースディレクトリから | ||
197 | それぞれ、PDF, Postscript, HTML, man page の形式で生成されます。 | ||
198 | |||
199 | カーネル開発者になるには | ||
200 | --------------------------- | ||
201 | |||
202 | もしあなたが、Linux カーネル開発について何も知らないならば、 | ||
203 | KernelNewbies プロジェクトを見るべきです | ||
204 | http://kernelnewbies.org | ||
205 | |||
206 | このサイトには役に立つメーリングリストがあり、基本的なカーネル開発に関 | ||
207 | するほとんどどんな種類の質問もできます (既に回答されているようなことを | ||
208 | 聞く前にまずはアーカイブを調べてください)。 | ||
209 | またここには、リアルタイムで質問を聞くことができる IRC チャネルや、Linux | ||
210 | カーネルの開発に関して学ぶのに便利なたくさんの役に立つドキュメントがあ | ||
211 | ります。 | ||
212 | |||
213 | web サイトには、コードの構成、サブシステム、現在存在するプロジェクト(ツ | ||
214 | リーにあるもの無いものの両方)の基本的な管理情報があります。 | ||
215 | ここには、また、カーネルのコンパイルのやり方やパッチの当て方などの間接 | ||
216 | 的な基本情報も記述されています。 | ||
217 | |||
218 | あなたがどこからスタートしてよいかわからないが、Linux カーネル開発コミュ | ||
219 | ニティに参加して何かすることをさがしている場合には、Linux kernel | ||
220 | Janitor's プロジェクトにいけばよいでしょう - | ||
221 | http://janitor.kernelnewbies.org/ | ||
222 | ここはそのようなスタートをするのにうってつけの場所です。ここには、 | ||
223 | Linux カーネルソースツリーの中に含まれる、きれいにし、修正しなければな | ||
224 | らない、単純な問題のリストが記述されています。このプロジェクトに関わる | ||
225 | 開発者と一緒に作業することで、あなたのパッチを Linuxカーネルツリーに入 | ||
226 | れるための基礎を学ぶことができ、そしてもしあなたがまだアイディアを持っ | ||
227 | ていない場合には、次にやる仕事の方向性が見えてくるかもしれません。 | ||
228 | |||
229 | もしあなたが、すでにひとまとまりコードを書いていて、カーネルツリーに入 | ||
230 | れたいと思っていたり、それに関する適切な支援を求めたい場合、カーネル | ||
231 | メンターズプロジェクトはそのような皆さんを助けるためにできました。 | ||
232 | ここにはメーリングリストがあり、以下から参照できます | ||
233 | http://selenic.com/mailman/listinfo/kernel-mentors | ||
234 | |||
235 | 実際に Linux カーネルのコードについて修正を加える前に、どうやってその | ||
236 | コードが動作するのかを理解することが必要です。そのためには、特別なツー | ||
237 | ルの助けを借りてでも、それを直接よく読むことが最良の方法です(ほとんど | ||
238 | のトリッキーな部分は十分にコメントしてありますから)。そういうツールで | ||
239 | 特におすすめなのは、Linux クロスリファレンスプロジェクトです。これは、 | ||
240 | 自己参照方式で、索引がついた web 形式で、ソースコードを参照することが | ||
241 | できます。この最新の素晴しいカーネルコードのリポジトリは以下で見つかり | ||
242 | ます- | ||
243 | http://sosdg.org/~coywolf/lxr/ | ||
244 | |||
245 | 開発プロセス | ||
246 | ----------------------- | ||
247 | |||
248 | Linux カーネルの開発プロセスは現在幾つかの異なるメインカーネル「ブラン | ||
249 | チ」と多数のサブシステム毎のカーネルブランチから構成されます。 | ||
250 | これらのブランチとは- | ||
251 | - メインの 2.6.x カーネルツリー | ||
252 | - 2.6.x.y -stable カーネルツリー | ||
253 | - 2.6.x -git カーネルパッチ | ||
254 | - 2.6.x -mm カーネルパッチ | ||
255 | - サブシステム毎のカーネルツリーとパッチ | ||
256 | |||
257 | 2.6.x カーネルツリー | ||
258 | ----------------- | ||
259 | |||
260 | 2.6.x カーネルは Linus Torvalds によってメンテナンスされ、kernel.org | ||
261 | の pub/linux/kernel/v2.6/ ディレクトリに存在します。この開発プロセスは | ||
262 | 以下のとおり- | ||
263 | |||
264 | - 新しいカーネルがリリースされた直後に、2週間の特別期間が設けられ、 | ||
265 | この期間中に、メンテナー達は Linus に大きな差分を送ることができま | ||
266 | す。このような差分は通常 -mm カーネルに数週間含まれてきたパッチで | ||
267 | す。 大きな変更は git(カーネルのソース管理ツール、詳細は | ||
268 | http://git.or.cz/ 参照) を使って送るのが好ましいやり方ですが、パッ | ||
269 | チファイルの形式のまま送るのでも十分です。 | ||
270 | |||
271 | - 2週間後、-rc1 カーネルがリリースされ、この後にはカーネル全体の安定 | ||
272 | 性に影響をあたえるような新機能は含まない類のパッチしか取り込むこと | ||
273 | はできません。新しいドライバ(もしくはファイルシステム)のパッチは | ||
274 | -rc1 の後で受け付けられることもあることを覚えておいてください。な | ||
275 | ぜなら、変更が独立していて、追加されたコードの外の領域に影響を与え | ||
276 | ない限り、退行のリスクは無いからです。-rc1 がリリースされた後、 | ||
277 | Linus へパッチを送付するのに git を使うこともできますが、パッチは | ||
278 | レビューのために、パブリックなメーリングリストへも同時に送る必要が | ||
279 | あります。 | ||
280 | |||
281 | - 新しい -rc は Linus が、最新の git ツリーがテスト目的であれば十分 | ||
282 | に安定した状態にあると判断したときにリリースされます。目標は毎週新 | ||
283 | しい -rc カーネルをリリースすることです。 | ||
284 | |||
285 | - このプロセスはカーネルが 「準備ができた」と考えられるまで継続しま | ||
286 | す。このプロセスはだいたい 6週間継続します。 | ||
287 | |||
288 | Andrew Morton が Linux-kernel メーリングリストにカーネルリリースについ | ||
289 | て書いたことをここで言っておくことは価値があります- | ||
290 | 「カーネルがいつリリースされるかは誰も知りません。なぜなら、これは現 | ||
291 | 実に認識されたバグの状況によりリリースされるのであり、前もって決めら | ||
292 | れた計画によってリリースされるものではないからです。」 | ||
293 | |||
294 | 2.6.x.y -stable カーネルツリー | ||
295 | --------------------------- | ||
296 | |||
297 | バージョンに4つ目の数字がついたカーネルは -stable カーネルです。これに | ||
298 | は、2.6.x カーネルで見つかったセキュリティ問題や重大な後戻りに対する比 | ||
299 | 較的小さい重要な修正が含まれます。 | ||
300 | |||
301 | これは、開発/実験的バージョンのテストに協力することに興味が無く、 | ||
302 | 最新の安定したカーネルを使いたいユーザに推奨するブランチです。 | ||
303 | |||
304 | もし、2.6.x.y カーネルが存在しない場合には、番号が一番大きい 2.6.x | ||
305 | が最新の安定版カーネルです。 | ||
306 | |||
307 | 2.6.x.y は "stable" チーム <stable@kernel.org> でメンテされており、だ | ||
308 | いたい隔週でリリースされています。 | ||
309 | |||
310 | カーネルツリーに入っている、Documentation/stable_kernel_rules.txt ファ | ||
311 | イルにはどのような種類の変更が -stable ツリーに受け入れ可能か、またリ | ||
312 | リースプロセスがどう動くかが記述されています。 | ||
313 | |||
314 | 2.6.x -git パッチ | ||
315 | ------------------ | ||
316 | |||
317 | git リポジトリで管理されているLinus のカーネルツリーの毎日のスナップ | ||
318 | ショットがあります。(だから -git という名前がついています)。これらのパッ | ||
319 | チはおおむね毎日リリースされており、Linus のツリーの現状を表します。こ | ||
320 | れは -rc カーネルと比べて、パッチが大丈夫かどうかも確認しないで自動的 | ||
321 | に生成されるので、より実験的です。 | ||
322 | |||
323 | 2.6.x -mm カーネルパッチ | ||
324 | ------------------------ | ||
325 | |||
326 | Andrew Morton によってリリースされる実験的なカーネルパッチ群です。 | ||
327 | Andrew は個別のサブシステムカーネルツリーとパッチを全て集めてきて | ||
328 | linux-kernel メーリングリストで収集された多数のパッチと同時に一つにま | ||
329 | とめます。 | ||
330 | このツリーは新機能とパッチが検証される場となります。ある期間の間パッチ | ||
331 | が -mm に入って価値を証明されたら、Andrew やサブシステムメンテナが、メ | ||
332 | インラインへ入れるように Linus にプッシュします。 | ||
333 | |||
334 | メインカーネルツリーに含めるために Linus に送る前に、すべての新しいパッ | ||
335 | チが -mm ツリーでテストされることが強く推奨されます。 | ||
336 | |||
337 | これらのカーネルは安定して動作すべきシステムとして使うのには適切ではあ | ||
338 | りませんし、カーネルブランチの中でももっとも動作にリスクが高いものです。 | ||
339 | |||
340 | もしあなたが、カーネル開発プロセスの支援をしたいと思っているのであれば、 | ||
341 | どうぞこれらのカーネルリリースをテストに使ってみて、そしてもし問題があ | ||
342 | れば、またもし全てが正しく動作したとしても、linux-kernel メーリングリ | ||
343 | ストにフィードバックを提供してください。 | ||
344 | |||
345 | すべての他の実験的パッチに加えて、これらのカーネルは通常リリース時点で | ||
346 | メインラインの -git カーネルに含まれる全ての変更も含んでいます。 | ||
347 | |||
348 | -mm カーネルは決まったスケジュールではリリースされません、しかし通常幾 | ||
349 | つかの -mm カーネル (1 から 3 が普通)が各-rc カーネルの間にリリースさ | ||
350 | れます。 | ||
351 | |||
352 | サブシステム毎のカーネルツリーとパッチ | ||
353 | ------------------------------------------- | ||
354 | |||
355 | カーネルの様々な領域で何が起きているかを見られるようにするため、多くの | ||
356 | カーネルサブシステム開発者は彼らの開発ツリーを公開しています。これらの | ||
357 | ツリーは説明したように -mm カーネルリリースに入れ込まれます。 | ||
358 | |||
359 | 以下はさまざまなカーネルツリーの中のいくつかのリスト- | ||
360 | |||
361 | git ツリー- | ||
362 | - Kbuild の開発ツリー、Sam Ravnborg <sam@ravnborg.org> | ||
363 | kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git | ||
364 | |||
365 | - ACPI の開発ツリー、 Len Brown <len.brown@intel.com> | ||
366 | kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git | ||
367 | |||
368 | - Block の開発ツリー、Jens Axboe <axboe@suse.de> | ||
369 | kernel.org:/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git | ||
370 | |||
371 | - DRM の開発ツリー、Dave Airlie <airlied@linux.ie> | ||
372 | kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git | ||
373 | |||
374 | - ia64 の開発ツリー、Tony Luck <tony.luck@intel.com> | ||
375 | kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git | ||
376 | |||
377 | - ieee1394 の開発ツリー、Jody McIntyre <scjody@modernduck.com> | ||
378 | kernel.org:/pub/scm/linux/kernel/git/scjody/ieee1394.git | ||
379 | |||
380 | - infiniband, Roland Dreier <rolandd@cisco.com> | ||
381 | kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git | ||
382 | |||
383 | - libata, Jeff Garzik <jgarzik@pobox.com> | ||
384 | kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git | ||
385 | |||
386 | - ネットワークドライバ, Jeff Garzik <jgarzik@pobox.com> | ||
387 | kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git | ||
388 | |||
389 | - pcmcia, Dominik Brodowski <linux@dominikbrodowski.net> | ||
390 | kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git | ||
391 | |||
392 | - SCSI, James Bottomley <James.Bottomley@SteelEye.com> | ||
393 | kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git | ||
394 | |||
395 | その他の git カーネルツリーは http://kernel.org/git に一覧表がありま | ||
396 | す。 | ||
397 | |||
398 | quilt ツリー- | ||
399 | - USB, PCI ドライバコアと I2C, Greg Kroah-Hartman <gregkh@suse.de> | ||
400 | kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ | ||
401 | |||
402 | バグレポート | ||
403 | ------------- | ||
404 | |||
405 | bugzilla.kernel.org は Linux カーネル開発者がカーネルのバグを追跡する | ||
406 | 場所です。ユーザは見つけたバグの全てをこのツールで報告すべきです。 | ||
407 | どう kernel bugzilla を使うかの詳細は、以下を参照してください- | ||
408 | http://test.kernel.org/bugzilla/faq.html | ||
409 | |||
410 | メインカーネルソースディレクトリにあるファイル REPORTING-BUGS はカーネ | ||
411 | ルバグらしいものについてどうレポートするかの良いテンプレートであり、問 | ||
412 | 題の追跡を助けるためにカーネル開発者にとってどんな情報が必要なのかの詳 | ||
413 | 細が書かれています。 | ||
414 | |||
415 | メーリングリスト | ||
416 | ------------- | ||
417 | |||
418 | 上のいくつかのドキュメントで述べていますが、コアカーネル開発者の大部分 | ||
419 | は Linux kernel メーリングリストに参加しています。このリストの登録/脱 | ||
420 | 退の方法については以下を参照してください- | ||
421 | http://vger.kernel.org/vger-lists.html#linux-kernel | ||
422 | |||
423 | このメーリングリストのアーカイブは web 上の多数の場所に存在します。こ | ||
424 | れらのアーカイブを探すにはサーチエンジンを使いましょう。例えば- | ||
425 | http://dir.gmane.org/gmane.linux.kernel | ||
426 | |||
427 | リストに投稿する前にすでにその話題がアーカイブに存在するかどうかを検索 | ||
428 | することを是非やってください。多数の事がすでに詳細に渡って議論されて | ||
429 | おり、アーカイブにのみ記録されています。 | ||
430 | |||
431 | 大部分のカーネルサブシステムも自分の個別の開発を実施するメーリングリス | ||
432 | トを持っています。個々のグループがどんなリストを持っているかは、 | ||
433 | MAINTAINERS ファイルにリストがありますので参照してください。 | ||
434 | |||
435 | 多くのリストは kernel.org でホストされています。これらの情報は以下にあ | ||
436 | ります- | ||
437 | http://vger.kernel.org/vger-lists.html | ||
438 | |||
439 | メーリングリストを使う場合、良い行動習慣に従うようにしましょう。 | ||
440 | 少し安っぽいが、以下の URL は上のリスト(や他のリスト)で会話する場合の | ||
441 | シンプルなガイドラインを示しています- | ||
442 | http://www.albion.com/netiquette/ | ||
443 | |||
444 | もし複数の人があなたのメールに返事をした場合、CC: で受ける人のリストは | ||
445 | だいぶ多くなるでしょう。良い理由がない場合、CC: リストから誰かを削除を | ||
446 | しないように、また、メーリングリストのアドレスだけにリプライすることの | ||
447 | ないようにしましょう。1つは送信者から、もう1つはリストからのように、メー | ||
448 | ルを2回受けることになってもそれに慣れ、しゃれたメールヘッダーを追加し | ||
449 | てこの状態を変えようとしないように。人々はそのようなことは好みません。 | ||
450 | |||
451 | 今までのメールでのやりとりとその間のあなたの発言はそのまま残し、 | ||
452 | "John Kernlehacker wrote ...:" の行をあなたのリプライの先頭行にして、 | ||
453 | メールの先頭でなく、各引用行の間にあなたの言いたいことを追加するべきで | ||
454 | す。 | ||
455 | |||
456 | もしパッチをメールに付ける場合は、Documentaion/SubmittingPatches に提 | ||
457 | 示されているように、それは プレーンな可読テキストにすることを忘れない | ||
458 | ようにしましょう。カーネル開発者は 添付や圧縮したパッチを扱いたがりま | ||
459 | せん- | ||
460 | 彼らはあなたのパッチの行毎にコメントを入れたいので、そのためにはそうす | ||
461 | るしかありません。あなたのメールプログラムが空白やタブを圧縮しないよう | ||
462 | に確認した方がいいです。最初の良いテストとしては、自分にメールを送って | ||
463 | みて、そのパッチを自分で当ててみることです。もしそれがうまく行かないな | ||
464 | ら、あなたのメールプログラムを直してもらうか、正しく動くように変えるべ | ||
465 | きです。 | ||
466 | |||
467 | とりわけ、他の登録者に対する尊敬を表すようにすることを覚えておいてくだ | ||
468 | さい。 | ||
469 | |||
470 | コミュニティと共に働くこと | ||
471 | -------------------------- | ||
472 | |||
473 | カーネルコミュニティのゴールは可能なかぎり最高のカーネルを提供すること | ||
474 | です。あなたがパッチを受け入れてもらうために投稿した場合、それは、技術 | ||
475 | 的メリットだけがレビューされます。その際、あなたは何を予想すべきでしょ | ||
476 | うか? | ||
477 | - 批判 | ||
478 | - コメント | ||
479 | - 変更の要求 | ||
480 | - パッチの正当性の証明要求 | ||
481 | - 沈黙 | ||
482 | |||
483 | 思い出してください、ここはあなたのパッチをカーネルに入れる話です。あ | ||
484 | なたは、あなたのパッチに対する批判とコメントを受け入れるべきで、それら | ||
485 | を技術的レベルで評価して、パッチを再作成するか、なぜそれらの変更をすべ | ||
486 | きでないかを明確で簡潔な理由の説明を提供してください。 | ||
487 | もし、あなたのパッチに何も反応がない場合、たまにはメールの山に埋もれて | ||
488 | 見逃され、あなたの投稿が忘れられてしまうこともあるので、数日待って再度 | ||
489 | 投稿してください。 | ||
490 | |||
491 | あなたがやるべきでないものは? | ||
492 | - 質問なしにあなたのパッチが受け入れられると想像すること | ||
493 | - 守りに入ること | ||
494 | - コメントを無視すること | ||
495 | - 要求された変更を何もしないでパッチを出し直すこと | ||
496 | |||
497 | 可能な限り最高の技術的解決を求めているコミュニティでは、パッチがどのく | ||
498 | らい有益なのかについては常に異なる意見があります。あなたは協調的である | ||
499 | べきですし、また、あなたのアイディアをカーネルに対してうまく合わせるよ | ||
500 | うにすることが望まれています。もしくは、最低限あなたのアイディアがそれ | ||
501 | だけの価値があるとすすんで証明するようにしなければなりません。 | ||
502 | 正しい解決に向かって進もうという意志がある限り、間違うことがあっても許 | ||
503 | 容されることを忘れないでください。 | ||
504 | |||
505 | あなたの最初のパッチに単に 1ダースもの修正を求めるリストの返答になるこ | ||
506 | とも普通のことです。これはあなたのパッチが受け入れられないということで | ||
507 | は *ありません*、そしてあなた自身に反対することを意味するのでも *ありま | ||
508 | せん*。単に自分のパッチに対して指摘された問題を全て修正して再送すれば | ||
509 | いいのです。 | ||
510 | |||
511 | カーネルコミュニティと企業組織のちがい | ||
512 | ----------------------------------------------------------------- | ||
513 | |||
514 | カーネルコミュニティは大部分の伝統的な会社の開発環境とは異ったやり方で | ||
515 | 動いています。以下は問題を避けるためにできるとよいことののリストです- | ||
516 | |||
517 | あなたの提案する変更について言うときのうまい言い方: | ||
518 | |||
519 | - "これは複数の問題を解決します" | ||
520 | - "これは2000行のコードを削除します" | ||
521 | - "以下のパッチは、私が言おうとしていることを説明するものです" | ||
522 | - "私はこれを5つの異なるアーキテクチャでテストしたのですが..." | ||
523 | - "以下は一連の小さなパッチ群ですが..." | ||
524 | - "これは典型的なマシンでの性能を向上させます.." | ||
525 | |||
526 | やめた方がいい悪い言い方: | ||
527 | |||
528 | - このやり方で AIX/ptx/Solaris ではできたので、できるはずだ | ||
529 | - 私はこれを20年もの間やってきた、だから | ||
530 | - これは、私の会社が金儲けをするために必要だ | ||
531 | - これは我々のエンタープライズ向け商品ラインのためである | ||
532 | - これは 私が自分のアイディアを記述した、1000ページの設計資料である | ||
533 | - 私はこれについて、6ケ月作業している。 | ||
534 | - 以下は ... に関する5000行のパッチです | ||
535 | - 私は現在のぐちゃぐちゃを全部書き直した、それが以下です... | ||
536 | - 私は〆切がある、そのためこのパッチは今すぐ適用される必要がある | ||
537 | |||
538 | カーネルコミュニティが大部分の伝統的なソフトウェアエンジニアリングの労 | ||
539 | 働環境と異なるもう一つの点は、やりとりに顔を合わせないということです。 | ||
540 | email と irc を第一のコミュニケーションの形とする一つの利点は、性別や | ||
541 | 民族の差別がないことです。Linux カーネルの職場環境は女性や少数民族を受 | ||
542 | 容します。なぜなら、email アドレスによってのみあなたが認識されるからで | ||
543 | す。 | ||
544 | 国際的な側面からも活動領域を均等にするようにします。なぜならば、あなた | ||
545 | は人の名前で性別を想像できないからです。ある男性が アンドレアという名 | ||
546 | 前で、女性の名前は パット かもしれません (訳注 Andrea は米国では女性、 | ||
547 | それ以外(欧州など)では男性名として使われることが多い。同様に、Pat は | ||
548 | Patricia (主に女性名)や Patrick (主に男性名)の略称)。 | ||
549 | Linux カーネルの活動をして、意見を表明したことがある大部分の女性は、前 | ||
550 | 向きな経験をもっています。 | ||
551 | |||
552 | 言葉の壁は英語が得意でない一部の人には問題になります。 | ||
553 | メーリングリストの中できちんとアイディアを交換するには、相当うまく英語 | ||
554 | を操れる必要があることもあります。そのため、あなたは自分のメール | ||
555 | を送る前に英語で意味が通じているかをチェックすることをお薦めします。 | ||
556 | |||
557 | 変更を分割する | ||
558 | --------------------- | ||
559 | |||
560 | Linux カーネルコミュニティは、一度に大量のコードの塊を喜んで受容するこ | ||
561 | とはありません。変更は正確に説明される必要があり、議論され、小さい、個 | ||
562 | 別の部分に分割する必要があります。これはこれまで多くの会社がやり慣れて | ||
563 | きたことと全く正反対のことです。あなたのプロポーザルは、開発プロセスのと | ||
564 | ても早い段階から紹介されるべきです。そうすれば あなたは自分のやってい | ||
565 | ることにフィードバックを得られます。これは、コミュニティからみれば、あ | ||
566 | なたが彼らと一緒にやっているように感じられ、単にあなたの提案する機能の | ||
567 | ゴミ捨て場として使っているのではない、と感じられるでしょう。 | ||
568 | しかし、一度に 50 もの email をメーリングリストに送りつけるようなことは | ||
569 | やってはいけません、あなたのパッチ群はいつもどんな時でもそれよりは小さ | ||
570 | くなければなりません。 | ||
571 | |||
572 | パッチを分割する理由は以下です- | ||
573 | |||
574 | 1) 小さいパッチはあなたのパッチが適用される見込みを大きくします、カー | ||
575 | ネルの人達はパッチが正しいかどうかを確認する時間や労力をかけないか | ||
576 | らです。5行のパッチはメンテナがたった1秒見るだけで適用できます。し | ||
577 | かし、500行のパッチは、正しいことをレビューするのに数時間かかるかも | ||
578 | しれません(時間はパッチのサイズなどにより指数関数に比例してかかりま | ||
579 | す) | ||
580 | 小さいパッチは何かあったときにデバッグもとても簡単になります。パッ | ||
581 | チを1個1個取り除くのは、とても大きなパッチを当てた後に(かつ、何かお | ||
582 | かしくなった後で)解剖するのに比べればとても簡単です。 | ||
583 | |||
584 | 2) 小さいパッチを送るだけでなく、送るまえに、書き直して、シンプルにす | ||
585 | る(もしくは、単に順番を変えるだけでも)ことも、とても重要です。 | ||
586 | |||
587 | 以下はカーネル開発者の Al Viro のたとえ話しです: | ||
588 | |||
589 | "生徒の数学の宿題を採点する先生のことを考えてみてください、先 | ||
590 | 生は生徒が解に到達するまでの試行錯誤をみたいとは思わないでしょ | ||
591 | う。先生は簡潔な最高の解をみたいのです。良い生徒はこれを知って | ||
592 | おり、そして最終解の前の中間作業を提出することは決してないので | ||
593 | す" | ||
594 | カーネル開発でもこれは同じです。メンテナー達とレビューア達は、 | ||
595 | 問題を解決する解の背後になる思考プロセスをみたいとは思いません。 | ||
596 | 彼らは単純であざやかな解決方法をみたいのです。 | ||
597 | |||
598 | あざやかな解を説明するのと、コミュニティと共に仕事をし、未解決の仕事を | ||
599 | 議論することのバランスをキープするのは難しいかもしれません。 | ||
600 | ですから、開発プロセスの早期段階で改善のためのフィードバックをもらうよ | ||
601 | うにするのもいいですが、変更点を小さい部分に分割して全体ではまだ完成し | ||
602 | ていない仕事を(部分的に)取り込んでもらえるようにすることもいいことです。 | ||
603 | |||
604 | また、でき上がっていないものや、"将来直す" ようなパッチを、本流に含め | ||
605 | てもらうように送っても、それは受け付けられないことを理解してください。 | ||
606 | |||
607 | あなたの変更を正当化する | ||
608 | ------------------- | ||
609 | |||
610 | あなたのパッチを分割するのと同時に、なぜその変更を追加しなければならな | ||
611 | いかを Linux コミュニティに知らせることはとても重要です。新機能は必要 | ||
612 | 性と有用性で正当化されなければなりません。 | ||
613 | |||
614 | あなたの変更の説明 | ||
615 | -------------------- | ||
616 | |||
617 | あなたのパッチを送付する場合には、メールの中のテキストで何を言うかにつ | ||
618 | いて、特別に注意を払ってください。この情報はパッチの ChangeLog に使わ | ||
619 | れ、いつも皆がみられるように保管されます。これは次のような項目を含め、 | ||
620 | パッチを完全に記述するべきです- | ||
621 | |||
622 | - なぜ変更が必要か | ||
623 | - パッチ全体の設計アプローチ | ||
624 | - 実装の詳細 | ||
625 | - テスト結果 | ||
626 | |||
627 | これについて全てがどのようにあるべきかについての詳細は、以下のドキュメ | ||
628 | ントの ChangeLog セクションをみてください- | ||
629 | "The Perfect Patch" | ||
630 | http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt | ||
631 | |||
632 | これらのどれもが、時にはとても困難です。これらの慣例を完璧に実施するに | ||
633 | は数年かかるかもしれません。これは継続的な改善のプロセスであり、そのた | ||
634 | めには多数の忍耐と決意を必要とするものです。でも、諦めないで、これは可 | ||
635 | 能なことです。多数の人がすでにできていますし、彼らも皆最初はあなたと同 | ||
636 | じところからスタートしたのですから。 | ||
637 | |||
638 | Paolo Ciarrocchi に感謝、彼は彼の書いた "Development Process" | ||
639 | (http://linux.tar.bz/articles/2.6-development_process)セクショ | ||
640 | ンをこのテキストの原型にすることを許可してくれました。 | ||
641 | Rundy Dunlap と Gerrit Huizenga はメーリングリストでやるべきこととやっ | ||
642 | てはいけないことのリストを提供してくれました。 | ||
643 | 以下の人々のレビュー、コメント、貢献に感謝。 | ||
644 | Pat Mochel, Hanna Linder, Randy Dunlap, Kay Sievers, | ||
645 | Vojtech Pavlik, Jan Kara, Josh Boyer, Kees Cook, Andrew Morton, Andi | ||
646 | Kleen, Vadim Lobanov, Jesper Juhl, Adrian Bunk, Keri Harris, Frans Pop, | ||
647 | David A. Wheeler, Junio Hamano, Michael Kerrisk, と Alex Shepard | ||
648 | 彼らの支援なしでは、このドキュメントはできなかったでしょう。 | ||
649 | |||
650 | Maintainer: Greg Kroah-Hartman <greg@kroah.com> | ||
diff --git a/Documentation/ja_JP/stable_api_nonsense.txt b/Documentation/ja_JP/stable_api_nonsense.txt new file mode 100644 index 000000000000..b3f2b27f0881 --- /dev/null +++ b/Documentation/ja_JP/stable_api_nonsense.txt | |||
@@ -0,0 +1,263 @@ | |||
1 | NOTE: | ||
2 | This is a Japanese translated version of | ||
3 | "Documentation/stable_api_nonsense.txt". | ||
4 | This one is maintained by | ||
5 | IKEDA, Munehiro <m-ikeda@ds.jp.nec.com> | ||
6 | and JF Project team <http://www.linux.or.jp/JF/>. | ||
7 | If you find difference with original file or problem in translation, | ||
8 | please contact the maintainer of this file or JF project. | ||
9 | |||
10 | Please also note that purpose of this file is easier to read for non | ||
11 | English natives and not to be intended to fork. So, if you have any | ||
12 | comments or updates of this file, please try to update | ||
13 | Original(English) file at first. | ||
14 | |||
15 | ================================== | ||
16 | これは、 | ||
17 | linux-2.6.22-rc4/Documentation/stable_api_nonsense.txt の和訳 | ||
18 | です。 | ||
19 | 翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ > | ||
20 | 翻訳日 : 2007/06/11 | ||
21 | 原著作者: Greg Kroah-Hartman < greg at kroah dot com > | ||
22 | 翻訳者 : 池田 宗広 < m-ikeda at ds dot jp dot nec dot com > | ||
23 | 校正者 : Masanori Kobayashi さん < zap03216 at nifty dot ne dot jp > | ||
24 | Seiji Kaneko さん < skaneko at a2 dot mbn dot or dot jp > | ||
25 | ================================== | ||
26 | |||
27 | |||
28 | |||
29 | Linux カーネルのドライバインターフェース | ||
30 | (あなたの質問すべてに対する回答とその他諸々) | ||
31 | |||
32 | Greg Kroah-Hartman <greg at kroah dot com> | ||
33 | |||
34 | |||
35 | この文書は、なぜ Linux ではバイナリカーネルインターフェースが定義 | ||
36 | されていないのか、またはなぜ不変のカーネルインターフェースを持たな | ||
37 | いのか、ということを説明するために書かれた。ここでの話題は「カーネ | ||
38 | ル内部の」インターフェースについてであり、ユーザー空間とのインター | ||
39 | フェースではないことを理解してほしい。カーネルとユーザー空間とのイ | ||
40 | ンターフェースとはアプリケーションプログラムが使用するものであり、 | ||
41 | つまりシステムコールのインターフェースがこれに当たる。これは今まで | ||
42 | 長きに渡り、かつ今後も「まさしく」不変である。私は確か 0.9 か何か | ||
43 | より前のカーネルを使ってビルドした古いプログラムを持っているが、そ | ||
44 | れは最新の 2.6 カーネルでもきちんと動作する。ユーザー空間とのイン | ||
45 | ターフェースは、ユーザーとアプリケーションプログラマが不変性を信頼 | ||
46 | してよいものの一つである。 | ||
47 | |||
48 | |||
49 | 要旨 | ||
50 | ---- | ||
51 | |||
52 | あなたは不変のカーネルインターフェースが必要だと考えているかもしれ | ||
53 | ないが、実際のところはそうではない。あなたは必要としているものが分 | ||
54 | かっていない。あなたが必要としているものは安定して動作するドライバ | ||
55 | であり、それはドライバがメインのカーネルツリーに含まれる場合のみ得 | ||
56 | ることができる。ドライバがメインのカーネルツリーに含まれていると、 | ||
57 | 他にも多くの良いことがある。それは、Linux をより強固で、安定な、成 | ||
58 | 熟したオペレーティングシステムにすることができるということだ。これ | ||
59 | こそ、そもそもあなたが Linux を使う理由のはずだ。 | ||
60 | |||
61 | |||
62 | はじめに | ||
63 | -------- | ||
64 | |||
65 | カーネル内部のインターフェース変更を心配しなければならないドライバ | ||
66 | を書きたいなどというのは、変わり者だけだ。この世界のほとんどの人は、 | ||
67 | そのようなドライバがどんなインターフェースを使っているかなど知らな | ||
68 | いし、そんなドライバのことなど全く気にもかけていない。 | ||
69 | |||
70 | |||
71 | まず初めに、クローズソースとか、ソースコードの隠蔽とか、バイナリの | ||
72 | みが配布される使い物にならない代物[訳注(1)]とか、実体はバイナリ | ||
73 | コードでそれを読み込むためのラッパー部分のみソースコードが公開され | ||
74 | ているとか、その他用語は何であれ GPL の下にソースコードがリリース | ||
75 | されていないカーネルドライバに関する法的な問題について、私は「いか | ||
76 | なる議論も」行うつもりがない。法的な疑問があるのならば、プログラマ | ||
77 | である私ではなく、弁護士に相談して欲しい。ここでは単に、技術的な問 | ||
78 | 題について述べることにする。(法的な問題を軽視しているわけではない。 | ||
79 | それらは実際に存在するし、あなたはそれをいつも気にかけておく必要が | ||
80 | ある) | ||
81 | |||
82 | 訳注(1) | ||
83 | 「使い物にならない代物」の原文は "blob" | ||
84 | |||
85 | |||
86 | さてここでは、バイナリカーネルインターフェースについてと、ソースレ | ||
87 | ベルでのインターフェースの不変性について、という二つの話題を取り上 | ||
88 | げる。この二つは互いに依存する関係にあるが、まずはバイナリインター | ||
89 | フェースについて議論を行いやっつけてしまおう。 | ||
90 | |||
91 | |||
92 | バイナリカーネルインターフェース | ||
93 | -------------------------------- | ||
94 | |||
95 | もしソースレベルでのインターフェースが不変ならば、バイナリインター | ||
96 | フェースも当然のように不変である、というのは正しいだろうか?正しく | ||
97 | ない。Linux カーネルに関する以下の事実を考えてみてほしい。 | ||
98 | - あなたが使用するCコンパイラのバージョンによって、カーネル内部 | ||
99 | の構造体の配置構造は異なったものになる。また、関数は異なった方 | ||
100 | 法でカーネルに含まれることになるかもしれない(例えばインライン | ||
101 | 関数として扱われたり、扱われなかったりする)。個々の関数がどの | ||
102 | ようにコンパイルされるかはそれほど重要ではないが、構造体のパデ | ||
103 | ィングが異なるというのは非常に重要である。 | ||
104 | - あなたがカーネルのビルドオプションをどのように設定するかによっ | ||
105 | て、カーネルには広い範囲で異なった事態が起こり得る。 | ||
106 | - データ構造は異なるデータフィールドを持つかもしれない | ||
107 | - いくつかの関数は全く実装されていない状態になり得る | ||
108 | (例:SMP向けではないビルドでは、いくつかのロックは中身が | ||
109 | カラにコンパイルされる) | ||
110 | - カーネル内のメモリは、異なった方法で配置され得る。これはビ | ||
111 | ルドオプションに依存している。 | ||
112 | - Linux は様々な異なるプロセッサアーキテクチャ上で動作する。 | ||
113 | あるアーキテクチャ用のバイナリドライバを、他のアーキテクチャで | ||
114 | 正常に動作させる方法はない。 | ||
115 | |||
116 | |||
117 | ある特定のカーネル設定を使用し、カーネルをビルドしたのと正確に同じ | ||
118 | Cコンパイラを使用して単にカーネルモジュールをコンパイルするだけで | ||
119 | も、あなたはこれらいくつもの問題に直面することになる。ある特定の | ||
120 | Linux ディストリビューションの、ある特定のリリースバージョン用にモ | ||
121 | ジュールを提供しようと思っただけでも、これらの問題を引き起こすには | ||
122 | 十分である。にも関わらず Linux ディストリビューションの数と、サ | ||
123 | ポートするディストリビューションのリリース数を掛け算し、それら一つ | ||
124 | 一つについてビルドを行ったとしたら、今度はリリースごとのビルドオプ | ||
125 | ションの違いという悪夢にすぐさま悩まされることになる。また、ディス | ||
126 | トリビューションの各リリースバージョンには、異なるハードウェア(プ | ||
127 | ロセッサタイプや種々のオプション)に対応するため、何種類かのカーネ | ||
128 | ルが含まれているということも理解して欲しい。従って、ある一つのリ | ||
129 | リースバージョンだけのためにモジュールを作成する場合でも、あなたは | ||
130 | 何バージョンものモジュールを用意しなければならない。 | ||
131 | |||
132 | |||
133 | 信じて欲しい。このような方法でサポートを続けようとするなら、あなた | ||
134 | はいずれ正気を失うだろう。遠い昔、私はそれがいかに困難なことか、身 | ||
135 | をもって学んだのだ・・・ | ||
136 | |||
137 | |||
138 | 不変のカーネルソースレベルインターフェース | ||
139 | ------------------------------------------ | ||
140 | |||
141 | メインカーネルツリーに含まれていない Linux カーネルドライバを継続 | ||
142 | してサポートしていこうとしている人たちとの議論においては、これは極 | ||
143 | めて「引火性の高い」話題である。[訳注(2)] | ||
144 | |||
145 | 訳注(2) | ||
146 | 「引火性の高い」の原文は "volatile"。 | ||
147 | volatile には「揮発性の」「爆発しやすい」という意味の他、「変わり | ||
148 | やすい」「移り気な」という意味がある。 | ||
149 | 「(この話題は)爆発的に激しい論争を巻き起こしかねない」ということ | ||
150 | を、「(カーネルのソースレベルインターフェースは)移ろい行くもので | ||
151 | ある」ということを連想させる "volatile" という単語で表現している。 | ||
152 | |||
153 | |||
154 | Linux カーネルの開発は継続的に速いペースで行われ、決して歩みを緩め | ||
155 | ることがない。その中でカーネル開発者達は、現状のインターフェースに | ||
156 | あるバグを見つけ、より良い方法を考え出す。彼らはやがて、現状のイン | ||
157 | ターフェースがより正しく動作するように修正を行う。その過程で関数の | ||
158 | 名前は変更されるかもしれず、構造体は大きく、または小さくなるかもし | ||
159 | れず、関数の引数は検討しなおされるかもしれない。そのような場合、引 | ||
160 | き続き全てが正常に動作するよう、カーネル内でこれらのインターフェー | ||
161 | スを使用している個所も全て同時に修正される。 | ||
162 | |||
163 | |||
164 | 具体的な例として、カーネル内の USB インターフェースを挙げる。USB | ||
165 | サブシステムはこれまでに少なくとも3回の書き直しが行われ、その結果 | ||
166 | インターフェースが変更された。これらの書き直しはいくつかの異なった | ||
167 | 問題を修正するために行われた。 | ||
168 | - 同期的データストリームが非同期に変更された。これにより多数のド | ||
169 | ライバを単純化でき、全てのドライバのスループットが向上した。今 | ||
170 | やほとんど全ての USB デバイスは、考えられる最高の速度で動作し | ||
171 | ている。 | ||
172 | - USB ドライバが USB サブシステムのコアから行う、データパケット | ||
173 | 用のメモリ確保方法が変更された。これに伴い、いくつもの文書化さ | ||
174 | れたデッドロック条件を回避するため、全ての USB ドライバはより | ||
175 | 多くの情報を USB コアに提供しなければならないようになっている。 | ||
176 | |||
177 | |||
178 | このできごとは、数多く存在するクローズソースのオペレーティングシス | ||
179 | テムとは全く対照的だ。それらは長期に渡り古い USB インターフェース | ||
180 | をメンテナンスしなければならない。古いインターフェースが残ることで、 | ||
181 | 新たな開発者が偶然古いインターフェースを使い、正しくない方法で開発 | ||
182 | を行ってしまう可能性が生じる。これによりシステムの安定性は危険にさ | ||
183 | らされることになる。 | ||
184 | |||
185 | |||
186 | 上に挙げたどちらの例においても、開発者達はその変更が重要かつ必要で | ||
187 | あることに合意し、比較的楽にそれを実行した。もし Linux がソースレ | ||
188 | ベルでインターフェースの不変性を保証しなければならないとしたら、新 | ||
189 | しいインターフェースを作ると同時に、古い、問題のある方を今後ともメ | ||
190 | ンテナンスするという余計な仕事を USB の開発者にさせなければならな | ||
191 | い。Linux の USB 開発者は、自分の時間を使って仕事をしている。よっ | ||
192 | て、価値のない余計な仕事を報酬もなしに実行しろと言うことはできない。 | ||
193 | |||
194 | |||
195 | セキュリティ問題も、Linux にとっては非常に重要である。ひとたびセキ | ||
196 | ュリティに関する問題が発見されれば、それは極めて短期間のうちに修正 | ||
197 | される。セキュリティ問題の発生を防ぐための修正は、カーネルの内部イ | ||
198 | ンターフェースの変更を何度も引き起こしてきた。その際同時に、変更さ | ||
199 | れたインターフェースを使用する全てのドライバもまた変更された。これ | ||
200 | により問題が解消し、将来偶然に問題が再発してしまわないことが保証さ | ||
201 | れる。もし内部インターフェースの変更が許されないとしたら、このよう | ||
202 | にセキュリティ問題を修正し、将来再発しないことを保証することなど不 | ||
203 | 可能なのだ。 | ||
204 | |||
205 | |||
206 | カーネルのインターフェースは時が経つにつれクリーンナップを受ける。 | ||
207 | 誰も使っていないインターフェースは削除される。これにより、可能な限 | ||
208 | りカーネルが小さく保たれ、現役の全てのインターフェースが可能な限り | ||
209 | テストされることを保証しているのだ。(使われていないインターフェー | ||
210 | スの妥当性をテストすることは不可能と言っていいだろう) | ||
211 | |||
212 | |||
213 | |||
214 | これから何をすべきか | ||
215 | ----------------------- | ||
216 | |||
217 | では、もしメインのカーネルツリーに含まれない Linux カーネルドライ | ||
218 | バがあったとして、あなたは、つまり開発者は何をするべきだろうか?全 | ||
219 | てのディストリビューションの全てのカーネルバージョン向けにバイナリ | ||
220 | のドライバを供給することは悪夢であり、カーネルインターフェースの変 | ||
221 | 更を追いかけ続けることもまた過酷な仕事だ。 | ||
222 | |||
223 | |||
224 | 答えは簡単。そのドライバをメインのカーネルツリーに入れてしまえばよ | ||
225 | い。(ここで言及しているのは、GPL に従って公開されるドライバのこと | ||
226 | だということに注意してほしい。あなたのコードがそれに該当しないなら | ||
227 | ば、さよなら。幸運を祈ります。ご自分で何とかしてください。Andrew | ||
228 | と Linus からのコメント<Andrew と Linus のコメントへのリンクをこ | ||
229 | こに置く>をどうぞ)ドライバがメインツリーに入れば、カーネルのイン | ||
230 | ターフェースが変更された場合、変更を行った開発者によってドライバも | ||
231 | 修正されることになるだろう。あなたはほとんど労力を払うことなしに、 | ||
232 | 常にビルド可能できちんと動作するドライバを手に入れることができる。 | ||
233 | |||
234 | |||
235 | ドライバをメインのカーネルツリーに入れると、非常に好ましい以下の効 | ||
236 | 果がある。 | ||
237 | - ドライバの品質が向上する一方で、(元の開発者にとっての)メンテ | ||
238 | ナンスコストは下がる。 | ||
239 | - あなたのドライバに他の開発者が機能を追加してくれる。 | ||
240 | - 誰かがあなたのドライバにあるバグを見つけ、修正してくれる。 | ||
241 | - 誰かがあなたのドライバにある改善点を見つけてくれる。 | ||
242 | - 外部インターフェースが変更されドライバの更新が必要になった場合、 | ||
243 | 誰かがあなたの代わりに更新してくれる。 | ||
244 | - ドライバを入れてくれとディストロに頼まなくても、そのドライバは | ||
245 | 全ての Linux ディストリビューションに自動的に含まれてリリース | ||
246 | される。 | ||
247 | |||
248 | |||
249 | Linux では、他のどのオペレーティングシステムよりも数多くのデバイス | ||
250 | が「そのまま」使用できるようになった。また Linux は、どのオペレー | ||
251 | ティングシステムよりも数多くのプロセッサアーキテクチャ上でそれらの | ||
252 | デバイスを使用することができるようにもなった。このように、Linux の | ||
253 | 開発モデルは実証されており、今後も間違いなく正しい方向へと進んでい | ||
254 | くだろう。:) | ||
255 | |||
256 | |||
257 | |||
258 | ------ | ||
259 | |||
260 | この文書の初期の草稿に対し、Randy Dunlap, Andrew Morton, David | ||
261 | Brownell, Hanna Linder, Robert Love, Nishanth Aravamudan から査読 | ||
262 | と助言を頂きました。感謝申し上げます。 | ||
263 | |||
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index bb5306e9a5c3..e08ef8759a07 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt | |||
@@ -501,6 +501,20 @@ more details, with real examples. | |||
501 | The third parameter may be a text as in this example, but it may also | 501 | The third parameter may be a text as in this example, but it may also |
502 | be an expanded variable or a macro. | 502 | be an expanded variable or a macro. |
503 | 503 | ||
504 | cc-fullversion | ||
505 | cc-fullversion is useful when the exact version of gcc is needed. | ||
506 | One typical use-case is when a specific GCC version is broken. | ||
507 | cc-fullversion points out a more specific version than cc-version does. | ||
508 | |||
509 | Example: | ||
510 | #arch/powerpc/Makefile | ||
511 | $(Q)if test "$(call cc-fullversion)" = "040200" ; then \ | ||
512 | echo -n '*** GCC-4.2.0 cannot compile the 64-bit powerpc ' ; \ | ||
513 | false ; \ | ||
514 | fi | ||
515 | |||
516 | In this example for a specific GCC version the build will error out explaining | ||
517 | to the user why it stops. | ||
504 | 518 | ||
505 | === 4 Host Program support | 519 | === 4 Host Program support |
506 | 520 | ||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 7ce5ea949d1a..fb80e9ffea68 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -34,7 +34,6 @@ parameter is applicable: | |||
34 | APIC APIC support is enabled. | 34 | APIC APIC support is enabled. |
35 | APM Advanced Power Management support is enabled. | 35 | APM Advanced Power Management support is enabled. |
36 | AX25 Appropriate AX.25 support is enabled. | 36 | AX25 Appropriate AX.25 support is enabled. |
37 | CD Appropriate CD support is enabled. | ||
38 | DRM Direct Rendering Management support is enabled. | 37 | DRM Direct Rendering Management support is enabled. |
39 | EDD BIOS Enhanced Disk Drive Services (EDD) is enabled | 38 | EDD BIOS Enhanced Disk Drive Services (EDD) is enabled |
40 | EFI EFI Partitioning (GPT) is enabled | 39 | EFI EFI Partitioning (GPT) is enabled |
@@ -170,7 +169,10 @@ and is between 256 and 4096 characters. It is defined in the file | |||
170 | acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS | 169 | acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS |
171 | Format: To spoof as Windows 98: ="Microsoft Windows" | 170 | Format: To spoof as Windows 98: ="Microsoft Windows" |
172 | 171 | ||
173 | acpi_osi= [HW,ACPI] empty param disables _OSI | 172 | acpi_osi= [HW,ACPI] Modify list of supported OS interface strings |
173 | acpi_osi="string1" # add string1 -- only one string | ||
174 | acpi_osi="!string2" # remove built-in string2 | ||
175 | acpi_osi= # disable all strings | ||
174 | 176 | ||
175 | acpi_serialize [HW,ACPI] force serialization of AML methods | 177 | acpi_serialize [HW,ACPI] force serialization of AML methods |
176 | 178 | ||
@@ -235,16 +237,9 @@ and is between 256 and 4096 characters. It is defined in the file | |||
235 | Disable PIN 1 of APIC timer | 237 | Disable PIN 1 of APIC timer |
236 | Can be useful to work around chipset bugs. | 238 | Can be useful to work around chipset bugs. |
237 | 239 | ||
238 | ad1816= [HW,OSS] | ||
239 | Format: <io>,<irq>,<dma>,<dma2> | ||
240 | See also Documentation/sound/oss/AD1816. | ||
241 | |||
242 | ad1848= [HW,OSS] | 240 | ad1848= [HW,OSS] |
243 | Format: <io>,<irq>,<dma>,<dma2>,<type> | 241 | Format: <io>,<irq>,<dma>,<dma2>,<type> |
244 | 242 | ||
245 | adlib= [HW,OSS] | ||
246 | Format: <io> | ||
247 | |||
248 | advansys= [HW,SCSI] | 243 | advansys= [HW,SCSI] |
249 | See header of drivers/scsi/advansys.c. | 244 | See header of drivers/scsi/advansys.c. |
250 | 245 | ||
@@ -323,9 +318,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
323 | 318 | ||
324 | autotest [IA64] | 319 | autotest [IA64] |
325 | 320 | ||
326 | aztcd= [HW,CD] Aztech CD268 CDROM driver | ||
327 | Format: <io>,0x79 (?) | ||
328 | |||
329 | baycom_epp= [HW,AX25] | 321 | baycom_epp= [HW,AX25] |
330 | Format: <io>,<mode> | 322 | Format: <io>,<mode> |
331 | 323 | ||
@@ -368,10 +360,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
368 | possible to determine what the correct size should be. | 360 | possible to determine what the correct size should be. |
369 | This option provides an override for these situations. | 361 | This option provides an override for these situations. |
370 | 362 | ||
371 | cdu31a= [HW,CD] | ||
372 | Format: <io>,<irq>[,PAS] | ||
373 | See header of drivers/cdrom/cdu31a.c. | ||
374 | |||
375 | chandev= [HW,NET] Generic channel device initialisation | 363 | chandev= [HW,NET] Generic channel device initialisation |
376 | 364 | ||
377 | checkreqprot [SELINUX] Set initial checkreqprot flag value. | 365 | checkreqprot [SELINUX] Set initial checkreqprot flag value. |
@@ -425,9 +413,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
425 | hpet= [IA-32,HPET] option to disable HPET and use PIT. | 413 | hpet= [IA-32,HPET] option to disable HPET and use PIT. |
426 | Format: disable | 414 | Format: disable |
427 | 415 | ||
428 | cm206= [HW,CD] | ||
429 | Format: { auto | [<io>,][<irq>] } | ||
430 | |||
431 | com20020= [HW,NET] ARCnet - COM20020 chipset | 416 | com20020= [HW,NET] ARCnet - COM20020 chipset |
432 | Format: | 417 | Format: |
433 | <io>[,<irq>[,<nodeID>[,<backplane>[,<ckp>[,<timeout>]]]]] | 418 | <io>[,<irq>[,<nodeID>[,<backplane>[,<ckp>[,<timeout>]]]]] |
@@ -459,13 +444,20 @@ and is between 256 and 4096 characters. It is defined in the file | |||
459 | Documentation/networking/netconsole.txt for an | 444 | Documentation/networking/netconsole.txt for an |
460 | alternative. | 445 | alternative. |
461 | 446 | ||
462 | uart,io,<addr>[,options] | 447 | uart[8250],io,<addr>[,options] |
463 | uart,mmio,<addr>[,options] | 448 | uart[8250],mmio,<addr>[,options] |
464 | Start an early, polled-mode console on the 8250/16550 | 449 | Start an early, polled-mode console on the 8250/16550 |
465 | UART at the specified I/O port or MMIO address, | 450 | UART at the specified I/O port or MMIO address, |
466 | switching to the matching ttyS device later. The | 451 | switching to the matching ttyS device later. The |
467 | options are the same as for ttyS, above. | 452 | options are the same as for ttyS, above. |
468 | 453 | ||
454 | earlycon= [KNL] Output early console device and options. | ||
455 | uart[8250],io,<addr>[,options] | ||
456 | uart[8250],mmio,<addr>[,options] | ||
457 | Start an early, polled-mode console on the 8250/16550 | ||
458 | UART at the specified I/O port or MMIO address. | ||
459 | The options are the same as for ttyS, above. | ||
460 | |||
469 | cpcihp_generic= [HW,PCI] Generic port I/O CompactPCI driver | 461 | cpcihp_generic= [HW,PCI] Generic port I/O CompactPCI driver |
470 | Format: | 462 | Format: |
471 | <first_slot>,<last_slot>,<port>,<enum_bit>[,<debug>] | 463 | <first_slot>,<last_slot>,<port>,<enum_bit>[,<debug>] |
@@ -657,9 +649,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
657 | gpt [EFI] Forces disk with valid GPT signature but | 649 | gpt [EFI] Forces disk with valid GPT signature but |
658 | invalid Protective MBR to be treated as GPT. | 650 | invalid Protective MBR to be treated as GPT. |
659 | 651 | ||
660 | gscd= [HW,CD] | ||
661 | Format: <io> | ||
662 | |||
663 | gvp11= [HW,SCSI] | 652 | gvp11= [HW,SCSI] |
664 | 653 | ||
665 | hashdist= [KNL,NUMA] Large hashes allocated during boot | 654 | hashdist= [KNL,NUMA] Large hashes allocated during boot |
@@ -823,14 +812,37 @@ and is between 256 and 4096 characters. It is defined in the file | |||
823 | tasks in the system -- can cause problems and | 812 | tasks in the system -- can cause problems and |
824 | suboptimal load balancer performance. | 813 | suboptimal load balancer performance. |
825 | 814 | ||
826 | isp16= [HW,CD] | ||
827 | Format: <io>,<irq>,<dma>,<setup> | ||
828 | |||
829 | iucv= [HW,NET] | 815 | iucv= [HW,NET] |
830 | 816 | ||
831 | js= [HW,JOY] Analog joystick | 817 | js= [HW,JOY] Analog joystick |
832 | See Documentation/input/joystick.txt. | 818 | See Documentation/input/joystick.txt. |
833 | 819 | ||
820 | kernelcore=nn[KMG] [KNL,IA-32,IA-64,PPC,X86-64] This parameter | ||
821 | specifies the amount of memory usable by the kernel | ||
822 | for non-movable allocations. The requested amount is | ||
823 | spread evenly throughout all nodes in the system. The | ||
824 | remaining memory in each node is used for Movable | ||
825 | pages. In the event, a node is too small to have both | ||
826 | kernelcore and Movable pages, kernelcore pages will | ||
827 | take priority and other nodes will have a larger number | ||
828 | of kernelcore pages. The Movable zone is used for the | ||
829 | allocation of pages that may be reclaimed or moved | ||
830 | by the page migration subsystem. This means that | ||
831 | HugeTLB pages may not be allocated from this zone. | ||
832 | Note that allocations like PTEs-from-HighMem still | ||
833 | use the HighMem zone if it exists, and the Normal | ||
834 | zone if it does not. | ||
835 | |||
836 | movablecore=nn[KMG] [KNL,IA-32,IA-64,PPC,X86-64] This parameter | ||
837 | is similar to kernelcore except it specifies the | ||
838 | amount of memory used for migratable allocations. | ||
839 | If both kernelcore and movablecore is specified, | ||
840 | then kernelcore will be at *least* the specified | ||
841 | value but may be more. If movablecore on its own | ||
842 | is specified, the administrator must be careful | ||
843 | that the amount of memory usable for all allocations | ||
844 | is not too small. | ||
845 | |||
834 | keepinitrd [HW,ARM] | 846 | keepinitrd [HW,ARM] |
835 | 847 | ||
836 | kstack=N [IA-32,X86-64] Print N words from the kernel stack | 848 | kstack=N [IA-32,X86-64] Print N words from the kernel stack |
@@ -964,11 +976,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
964 | 976 | ||
965 | mcatest= [IA-64] | 977 | mcatest= [IA-64] |
966 | 978 | ||
967 | mcd= [HW,CD] | ||
968 | Format: <port>,<irq>,<mitsumi_bug_93_wait> | ||
969 | |||
970 | mcdx= [HW,CD] | ||
971 | |||
972 | mce [IA-32] Machine Check Exception | 979 | mce [IA-32] Machine Check Exception |
973 | 980 | ||
974 | md= [HW] RAID subsystems devices and level | 981 | md= [HW] RAID subsystems devices and level |
@@ -1011,49 +1018,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1011 | 1018 | ||
1012 | mga= [HW,DRM] | 1019 | mga= [HW,DRM] |
1013 | 1020 | ||
1014 | migration_cost= | ||
1015 | [KNL,SMP] debug: override scheduler migration costs | ||
1016 | Format: <level-1-usecs>,<level-2-usecs>,... | ||
1017 | This debugging option can be used to override the | ||
1018 | default scheduler migration cost matrix. The numbers | ||
1019 | are indexed by 'CPU domain distance'. | ||
1020 | E.g. migration_cost=1000,2000,3000 on an SMT NUMA | ||
1021 | box will set up an intra-core migration cost of | ||
1022 | 1 msec, an inter-core migration cost of 2 msecs, | ||
1023 | and an inter-node migration cost of 3 msecs. | ||
1024 | |||
1025 | WARNING: using the wrong values here can break | ||
1026 | scheduler performance, so it's only for scheduler | ||
1027 | development purposes, not production environments. | ||
1028 | |||
1029 | migration_debug= | ||
1030 | [KNL,SMP] migration cost auto-detect verbosity | ||
1031 | Format=<0|1|2> | ||
1032 | If a system's migration matrix reported at bootup | ||
1033 | seems erroneous then this option can be used to | ||
1034 | increase verbosity of the detection process. | ||
1035 | We default to 0 (no extra messages), 1 will print | ||
1036 | some more information, and 2 will be really | ||
1037 | verbose (probably only useful if you also have a | ||
1038 | serial console attached to the system). | ||
1039 | |||
1040 | migration_factor= | ||
1041 | [KNL,SMP] multiply/divide migration costs by a factor | ||
1042 | Format=<percent> | ||
1043 | This debug option can be used to proportionally | ||
1044 | increase or decrease the auto-detected migration | ||
1045 | costs for all entries of the migration matrix. | ||
1046 | E.g. migration_factor=150 will increase migration | ||
1047 | costs by 50%. (and thus the scheduler will be less | ||
1048 | eager migrating cache-hot tasks) | ||
1049 | migration_factor=80 will decrease migration costs | ||
1050 | by 20%. (thus the scheduler will be more eager to | ||
1051 | migrate tasks) | ||
1052 | |||
1053 | WARNING: using the wrong values here can break | ||
1054 | scheduler performance, so it's only for scheduler | ||
1055 | development purposes, not production environments. | ||
1056 | |||
1057 | mousedev.tap_time= | 1021 | mousedev.tap_time= |
1058 | [MOUSE] Maximum time between finger touching and | 1022 | [MOUSE] Maximum time between finger touching and |
1059 | leaving touchpad surface for touch to be considered | 1023 | leaving touchpad surface for touch to be considered |
@@ -1190,6 +1154,8 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1190 | 1154 | ||
1191 | nointroute [IA-64] | 1155 | nointroute [IA-64] |
1192 | 1156 | ||
1157 | nojitter [IA64] Disables jitter checking for ITC timers. | ||
1158 | |||
1193 | nolapic [IA-32,APIC] Do not enable or use the local APIC. | 1159 | nolapic [IA-32,APIC] Do not enable or use the local APIC. |
1194 | 1160 | ||
1195 | nolapic_timer [IA-32,APIC] Do not use the local APIC timer. | 1161 | nolapic_timer [IA-32,APIC] Do not use the local APIC timer. |
@@ -1221,6 +1187,8 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1221 | 1187 | ||
1222 | nosmp [SMP] Tells an SMP kernel to act as a UP kernel. | 1188 | nosmp [SMP] Tells an SMP kernel to act as a UP kernel. |
1223 | 1189 | ||
1190 | nosoftlockup [KNL] Disable the soft-lockup detector. | ||
1191 | |||
1224 | nosync [HW,M68K] Disables sync negotiation for all devices. | 1192 | nosync [HW,M68K] Disables sync negotiation for all devices. |
1225 | 1193 | ||
1226 | notsc [BUGS=IA-32] Disable Time Stamp Counter | 1194 | notsc [BUGS=IA-32] Disable Time Stamp Counter |
@@ -1229,20 +1197,19 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1229 | 1197 | ||
1230 | nowb [ARM] | 1198 | nowb [ARM] |
1231 | 1199 | ||
1200 | numa_zonelist_order= [KNL, BOOT] Select zonelist order for NUMA. | ||
1201 | one of ['zone', 'node', 'default'] can be specified | ||
1202 | This can be set from sysctl after boot. | ||
1203 | See Documentation/sysctl/vm.txt for details. | ||
1204 | |||
1232 | nr_uarts= [SERIAL] maximum number of UARTs to be registered. | 1205 | nr_uarts= [SERIAL] maximum number of UARTs to be registered. |
1233 | 1206 | ||
1234 | opl3= [HW,OSS] | 1207 | opl3= [HW,OSS] |
1235 | Format: <io> | 1208 | Format: <io> |
1236 | 1209 | ||
1237 | opl3sa2= [HW,OSS] Format: | ||
1238 | <io>,<irq>,<dma>,<dma2>,<mss_io>,<mpu_io>,<ymode>,<loopback>[,<isapnp>,<multiple] | ||
1239 | |||
1240 | oprofile.timer= [HW] | 1210 | oprofile.timer= [HW] |
1241 | Use timer interrupt instead of performance counters | 1211 | Use timer interrupt instead of performance counters |
1242 | 1212 | ||
1243 | optcd= [HW,CD] | ||
1244 | Format: <io> | ||
1245 | |||
1246 | osst= [HW,SCSI] SCSI Tape Driver | 1213 | osst= [HW,SCSI] SCSI Tape Driver |
1247 | Format: <buffer_size>,<write_threshold> | 1214 | Format: <buffer_size>,<write_threshold> |
1248 | See also Documentation/scsi/st.txt. | 1215 | See also Documentation/scsi/st.txt. |
@@ -1421,6 +1388,15 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1421 | autoconfiguration. | 1388 | autoconfiguration. |
1422 | Ranges are in pairs (memory base and size). | 1389 | Ranges are in pairs (memory base and size). |
1423 | 1390 | ||
1391 | print-fatal-signals= | ||
1392 | [KNL] debug: print fatal signals | ||
1393 | print-fatal-signals=1: print segfault info to | ||
1394 | the kernel console. | ||
1395 | default: off. | ||
1396 | |||
1397 | printk.time= Show timing data prefixed to each printk message line | ||
1398 | Format: <bool> (1/Y/y=enable, 0/N/n=disable) | ||
1399 | |||
1424 | profile= [KNL] Enable kernel profiling via /proc/profile | 1400 | profile= [KNL] Enable kernel profiling via /proc/profile |
1425 | Format: [schedule,]<number> | 1401 | Format: [schedule,]<number> |
1426 | Param: "schedule" - profile schedule points. | 1402 | Param: "schedule" - profile schedule points. |
@@ -1533,6 +1509,10 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1533 | 1509 | ||
1534 | rootfstype= [KNL] Set root filesystem type | 1510 | rootfstype= [KNL] Set root filesystem type |
1535 | 1511 | ||
1512 | rootwait [KNL] Wait (indefinitely) for root device to show up. | ||
1513 | Useful for devices that are detected asynchronously | ||
1514 | (e.g. USB and MMC devices). | ||
1515 | |||
1536 | rw [KNL] Mount root device read-write on boot | 1516 | rw [KNL] Mount root device read-write on boot |
1537 | 1517 | ||
1538 | S [KNL] Run init in single mode | 1518 | S [KNL] Run init in single mode |
@@ -1545,11 +1525,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1545 | 1525 | ||
1546 | sbni= [NET] Granch SBNI12 leased line adapter | 1526 | sbni= [NET] Granch SBNI12 leased line adapter |
1547 | 1527 | ||
1548 | sbpcd= [HW,CD] Soundblaster CD adapter | ||
1549 | Format: <io>,<type> | ||
1550 | See a comment before function sbpcd_setup() in | ||
1551 | drivers/cdrom/sbpcd.c. | ||
1552 | |||
1553 | sc1200wdt= [HW,WDT] SC1200 WDT (watchdog) driver | 1528 | sc1200wdt= [HW,WDT] SC1200 WDT (watchdog) driver |
1554 | Format: <io>[,<timeout>[,<isapnp>]] | 1529 | Format: <io>[,<timeout>[,<isapnp>]] |
1555 | 1530 | ||
@@ -1602,41 +1577,41 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1602 | simeth= [IA-64] | 1577 | simeth= [IA-64] |
1603 | simscsi= | 1578 | simscsi= |
1604 | 1579 | ||
1605 | sjcd= [HW,CD] | ||
1606 | Format: <io>,<irq>,<dma> | ||
1607 | See header of drivers/cdrom/sjcd.c. | ||
1608 | |||
1609 | slram= [HW,MTD] | 1580 | slram= [HW,MTD] |
1610 | 1581 | ||
1611 | slub_debug [MM, SLUB] | 1582 | slub_debug[=options[,slabs]] [MM, SLUB] |
1612 | Enabling slub_debug allows one to determine the culprit | 1583 | Enabling slub_debug allows one to determine the |
1613 | if slab objects become corrupted. Enabling slub_debug | 1584 | culprit if slab objects become corrupted. Enabling |
1614 | creates guard zones around objects and poisons objects | 1585 | slub_debug can create guard zones around objects and |
1615 | when not in use. Also tracks the last alloc / free. | 1586 | may poison objects when not in use. Also tracks the |
1616 | For more information see Documentation/vm/slub.txt. | 1587 | last alloc / free. For more information see |
1588 | Documentation/vm/slub.txt. | ||
1617 | 1589 | ||
1618 | slub_max_order= [MM, SLUB] | 1590 | slub_max_order= [MM, SLUB] |
1619 | Determines the maximum allowed order for slabs. Setting | 1591 | Determines the maximum allowed order for slabs. |
1620 | this too high may cause fragmentation. | 1592 | A high setting may cause OOMs due to memory |
1621 | For more information see Documentation/vm/slub.txt. | 1593 | fragmentation. For more information see |
1594 | Documentation/vm/slub.txt. | ||
1622 | 1595 | ||
1623 | slub_min_objects= [MM, SLUB] | 1596 | slub_min_objects= [MM, SLUB] |
1624 | The minimum objects per slab. SLUB will increase the | 1597 | The minimum number of objects per slab. SLUB will |
1625 | slab order up to slub_max_order to generate a | 1598 | increase the slab order up to slub_max_order to |
1626 | sufficiently big slab to satisfy the number of objects. | 1599 | generate a sufficiently large slab able to contain |
1627 | The higher the number of objects the smaller the overhead | 1600 | the number of objects indicated. The higher the number |
1628 | of tracking slabs. | 1601 | of objects the smaller the overhead of tracking slabs |
1602 | and the less frequently locks need to be acquired. | ||
1629 | For more information see Documentation/vm/slub.txt. | 1603 | For more information see Documentation/vm/slub.txt. |
1630 | 1604 | ||
1631 | slub_min_order= [MM, SLUB] | 1605 | slub_min_order= [MM, SLUB] |
1632 | Determines the mininum page order for slabs. Must be | 1606 | Determines the mininum page order for slabs. Must be |
1633 | lower than slub_max_order | 1607 | lower than slub_max_order. |
1634 | For more information see Documentation/vm/slub.txt. | 1608 | For more information see Documentation/vm/slub.txt. |
1635 | 1609 | ||
1636 | slub_nomerge [MM, SLUB] | 1610 | slub_nomerge [MM, SLUB] |
1637 | Disable merging of slabs of similar size. May be | 1611 | Disable merging of slabs with similar size. May be |
1638 | necessary if there is some reason to distinguish | 1612 | necessary if there is some reason to distinguish |
1639 | allocs to different slabs. | 1613 | allocs to different slabs. Debug options disable |
1614 | merging on their own. | ||
1640 | For more information see Documentation/vm/slub.txt. | 1615 | For more information see Documentation/vm/slub.txt. |
1641 | 1616 | ||
1642 | smart2= [HW] | 1617 | smart2= [HW] |
@@ -1778,9 +1753,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1778 | 1753 | ||
1779 | snd-ymfpci= [HW,ALSA] | 1754 | snd-ymfpci= [HW,ALSA] |
1780 | 1755 | ||
1781 | sonycd535= [HW,CD] | ||
1782 | Format: <io>[,<irq>] | ||
1783 | |||
1784 | sonypi.*= [HW] Sony Programmable I/O Control Device driver | 1756 | sonypi.*= [HW] Sony Programmable I/O Control Device driver |
1785 | See Documentation/sonypi.txt | 1757 | See Documentation/sonypi.txt |
1786 | 1758 | ||
@@ -1852,6 +1824,7 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1852 | Set number of hash buckets for TCP connection | 1824 | Set number of hash buckets for TCP connection |
1853 | 1825 | ||
1854 | time Show timing data prefixed to each printk message line | 1826 | time Show timing data prefixed to each printk message line |
1827 | [deprecated, see 'printk.time'] | ||
1855 | 1828 | ||
1856 | tipar.timeout= [HW,PPT] | 1829 | tipar.timeout= [HW,PPT] |
1857 | Set communications timeout in tenths of a second | 1830 | Set communications timeout in tenths of a second |
@@ -1909,11 +1882,14 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1909 | usbhid.mousepoll= | 1882 | usbhid.mousepoll= |
1910 | [USBHID] The interval which mice are to be polled at. | 1883 | [USBHID] The interval which mice are to be polled at. |
1911 | 1884 | ||
1912 | vdso= [IA-32,SH] | 1885 | vdso= [IA-32,SH,x86-64] |
1913 | vdso=2: enable compat VDSO (default with COMPAT_VDSO) | 1886 | vdso=2: enable compat VDSO (default with COMPAT_VDSO) |
1914 | vdso=1: enable VDSO (default) | 1887 | vdso=1: enable VDSO (default) |
1915 | vdso=0: disable VDSO mapping | 1888 | vdso=0: disable VDSO mapping |
1916 | 1889 | ||
1890 | vector= [IA-64,SMP] | ||
1891 | vector=percpu: enable percpu vector domain | ||
1892 | |||
1917 | video= [FB] Frame buffer configuration | 1893 | video= [FB] Frame buffer configuration |
1918 | See Documentation/fb/modedb.txt. | 1894 | See Documentation/fb/modedb.txt. |
1919 | 1895 | ||
diff --git a/Documentation/kprobes.txt b/Documentation/kprobes.txt index da5404ab7569..cb12ae175aa2 100644 --- a/Documentation/kprobes.txt +++ b/Documentation/kprobes.txt | |||
@@ -247,12 +247,6 @@ control to Kprobes.) If the probed function is declared asmlinkage, | |||
247 | fastcall, or anything else that affects how args are passed, the | 247 | fastcall, or anything else that affects how args are passed, the |
248 | handler's declaration must match. | 248 | handler's declaration must match. |
249 | 249 | ||
250 | NOTE: A macro JPROBE_ENTRY is provided to handle architecture-specific | ||
251 | aliasing of jp->entry. In the interest of portability, it is advised | ||
252 | to use: | ||
253 | |||
254 | jp->entry = JPROBE_ENTRY(handler); | ||
255 | |||
256 | register_jprobe() returns 0 on success, or a negative errno otherwise. | 250 | register_jprobe() returns 0 on success, or a negative errno otherwise. |
257 | 251 | ||
258 | 4.3 register_kretprobe | 252 | 4.3 register_kretprobe |
@@ -518,7 +512,7 @@ long jdo_fork(unsigned long clone_flags, unsigned long stack_start, | |||
518 | } | 512 | } |
519 | 513 | ||
520 | static struct jprobe my_jprobe = { | 514 | static struct jprobe my_jprobe = { |
521 | .entry = JPROBE_ENTRY(jdo_fork) | 515 | .entry = jdo_fork |
522 | }; | 516 | }; |
523 | 517 | ||
524 | static int __init jprobe_init(void) | 518 | static int __init jprobe_init(void) |
diff --git a/Documentation/lguest/Makefile b/Documentation/lguest/Makefile new file mode 100644 index 000000000000..b9b9427376e9 --- /dev/null +++ b/Documentation/lguest/Makefile | |||
@@ -0,0 +1,27 @@ | |||
1 | # This creates the demonstration utility "lguest" which runs a Linux guest. | ||
2 | |||
3 | # For those people that have a separate object dir, look there for .config | ||
4 | KBUILD_OUTPUT := ../.. | ||
5 | ifdef O | ||
6 | ifeq ("$(origin O)", "command line") | ||
7 | KBUILD_OUTPUT := $(O) | ||
8 | endif | ||
9 | endif | ||
10 | # We rely on CONFIG_PAGE_OFFSET to know where to put lguest binary. | ||
11 | include $(KBUILD_OUTPUT)/.config | ||
12 | LGUEST_GUEST_TOP := ($(CONFIG_PAGE_OFFSET) - 0x08000000) | ||
13 | |||
14 | CFLAGS:=-Wall -Wmissing-declarations -Wmissing-prototypes -O3 \ | ||
15 | -static -DLGUEST_GUEST_TOP="$(LGUEST_GUEST_TOP)" -Wl,-T,lguest.lds | ||
16 | LDLIBS:=-lz | ||
17 | |||
18 | all: lguest.lds lguest | ||
19 | |||
20 | # The linker script on x86 is so complex the only way of creating one | ||
21 | # which will link our binary in the right place is to mangle the | ||
22 | # default one. | ||
23 | lguest.lds: | ||
24 | $(LD) --verbose | awk '/^==========/ { PRINT=1; next; } /SIZEOF_HEADERS/ { gsub(/0x[0-9A-F]*/, "$(LGUEST_GUEST_TOP)") } { if (PRINT) print $$0; }' > $@ | ||
25 | |||
26 | clean: | ||
27 | rm -f lguest.lds lguest | ||
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c new file mode 100644 index 000000000000..1432b502a2d9 --- /dev/null +++ b/Documentation/lguest/lguest.c | |||
@@ -0,0 +1,1012 @@ | |||
1 | /* Simple program to layout "physical" memory for new lguest guest. | ||
2 | * Linked high to avoid likely physical memory. */ | ||
3 | #define _LARGEFILE64_SOURCE | ||
4 | #define _GNU_SOURCE | ||
5 | #include <stdio.h> | ||
6 | #include <string.h> | ||
7 | #include <unistd.h> | ||
8 | #include <err.h> | ||
9 | #include <stdint.h> | ||
10 | #include <stdlib.h> | ||
11 | #include <elf.h> | ||
12 | #include <sys/mman.h> | ||
13 | #include <sys/types.h> | ||
14 | #include <sys/stat.h> | ||
15 | #include <sys/wait.h> | ||
16 | #include <fcntl.h> | ||
17 | #include <stdbool.h> | ||
18 | #include <errno.h> | ||
19 | #include <ctype.h> | ||
20 | #include <sys/socket.h> | ||
21 | #include <sys/ioctl.h> | ||
22 | #include <sys/time.h> | ||
23 | #include <time.h> | ||
24 | #include <netinet/in.h> | ||
25 | #include <net/if.h> | ||
26 | #include <linux/sockios.h> | ||
27 | #include <linux/if_tun.h> | ||
28 | #include <sys/uio.h> | ||
29 | #include <termios.h> | ||
30 | #include <getopt.h> | ||
31 | #include <zlib.h> | ||
32 | typedef unsigned long long u64; | ||
33 | typedef uint32_t u32; | ||
34 | typedef uint16_t u16; | ||
35 | typedef uint8_t u8; | ||
36 | #include "../../include/linux/lguest_launcher.h" | ||
37 | #include "../../include/asm-i386/e820.h" | ||
38 | |||
39 | #define PAGE_PRESENT 0x7 /* Present, RW, Execute */ | ||
40 | #define NET_PEERNUM 1 | ||
41 | #define BRIDGE_PFX "bridge:" | ||
42 | #ifndef SIOCBRADDIF | ||
43 | #define SIOCBRADDIF 0x89a2 /* add interface to bridge */ | ||
44 | #endif | ||
45 | |||
46 | static bool verbose; | ||
47 | #define verbose(args...) \ | ||
48 | do { if (verbose) printf(args); } while(0) | ||
49 | static int waker_fd; | ||
50 | |||
51 | struct device_list | ||
52 | { | ||
53 | fd_set infds; | ||
54 | int max_infd; | ||
55 | |||
56 | struct device *dev; | ||
57 | struct device **lastdev; | ||
58 | }; | ||
59 | |||
60 | struct device | ||
61 | { | ||
62 | struct device *next; | ||
63 | struct lguest_device_desc *desc; | ||
64 | void *mem; | ||
65 | |||
66 | /* Watch this fd if handle_input non-NULL. */ | ||
67 | int fd; | ||
68 | bool (*handle_input)(int fd, struct device *me); | ||
69 | |||
70 | /* Watch DMA to this key if handle_input non-NULL. */ | ||
71 | unsigned long watch_key; | ||
72 | u32 (*handle_output)(int fd, const struct iovec *iov, | ||
73 | unsigned int num, struct device *me); | ||
74 | |||
75 | /* Device-specific data. */ | ||
76 | void *priv; | ||
77 | }; | ||
78 | |||
79 | static int open_or_die(const char *name, int flags) | ||
80 | { | ||
81 | int fd = open(name, flags); | ||
82 | if (fd < 0) | ||
83 | err(1, "Failed to open %s", name); | ||
84 | return fd; | ||
85 | } | ||
86 | |||
87 | static void *map_zeroed_pages(unsigned long addr, unsigned int num) | ||
88 | { | ||
89 | static int fd = -1; | ||
90 | |||
91 | if (fd == -1) | ||
92 | fd = open_or_die("/dev/zero", O_RDONLY); | ||
93 | |||
94 | if (mmap((void *)addr, getpagesize() * num, | ||
95 | PROT_READ|PROT_WRITE|PROT_EXEC, MAP_FIXED|MAP_PRIVATE, fd, 0) | ||
96 | != (void *)addr) | ||
97 | err(1, "Mmaping %u pages of /dev/zero @%p", num, (void *)addr); | ||
98 | return (void *)addr; | ||
99 | } | ||
100 | |||
101 | /* Find magic string marking entry point, return entry point. */ | ||
102 | static unsigned long entry_point(void *start, void *end, | ||
103 | unsigned long page_offset) | ||
104 | { | ||
105 | void *p; | ||
106 | |||
107 | for (p = start; p < end; p++) | ||
108 | if (memcmp(p, "GenuineLguest", strlen("GenuineLguest")) == 0) | ||
109 | return (long)p + strlen("GenuineLguest") + page_offset; | ||
110 | |||
111 | err(1, "Is this image a genuine lguest?"); | ||
112 | } | ||
113 | |||
114 | /* Returns the entry point */ | ||
115 | static unsigned long map_elf(int elf_fd, const Elf32_Ehdr *ehdr, | ||
116 | unsigned long *page_offset) | ||
117 | { | ||
118 | void *addr; | ||
119 | Elf32_Phdr phdr[ehdr->e_phnum]; | ||
120 | unsigned int i; | ||
121 | unsigned long start = -1UL, end = 0; | ||
122 | |||
123 | /* Sanity checks. */ | ||
124 | if (ehdr->e_type != ET_EXEC | ||
125 | || ehdr->e_machine != EM_386 | ||
126 | || ehdr->e_phentsize != sizeof(Elf32_Phdr) | ||
127 | || ehdr->e_phnum < 1 || ehdr->e_phnum > 65536U/sizeof(Elf32_Phdr)) | ||
128 | errx(1, "Malformed elf header"); | ||
129 | |||
130 | if (lseek(elf_fd, ehdr->e_phoff, SEEK_SET) < 0) | ||
131 | err(1, "Seeking to program headers"); | ||
132 | if (read(elf_fd, phdr, sizeof(phdr)) != sizeof(phdr)) | ||
133 | err(1, "Reading program headers"); | ||
134 | |||
135 | *page_offset = 0; | ||
136 | /* We map the loadable segments at virtual addresses corresponding | ||
137 | * to their physical addresses (our virtual == guest physical). */ | ||
138 | for (i = 0; i < ehdr->e_phnum; i++) { | ||
139 | if (phdr[i].p_type != PT_LOAD) | ||
140 | continue; | ||
141 | |||
142 | verbose("Section %i: size %i addr %p\n", | ||
143 | i, phdr[i].p_memsz, (void *)phdr[i].p_paddr); | ||
144 | |||
145 | /* We expect linear address space. */ | ||
146 | if (!*page_offset) | ||
147 | *page_offset = phdr[i].p_vaddr - phdr[i].p_paddr; | ||
148 | else if (*page_offset != phdr[i].p_vaddr - phdr[i].p_paddr) | ||
149 | errx(1, "Page offset of section %i different", i); | ||
150 | |||
151 | if (phdr[i].p_paddr < start) | ||
152 | start = phdr[i].p_paddr; | ||
153 | if (phdr[i].p_paddr + phdr[i].p_filesz > end) | ||
154 | end = phdr[i].p_paddr + phdr[i].p_filesz; | ||
155 | |||
156 | /* We map everything private, writable. */ | ||
157 | addr = mmap((void *)phdr[i].p_paddr, | ||
158 | phdr[i].p_filesz, | ||
159 | PROT_READ|PROT_WRITE|PROT_EXEC, | ||
160 | MAP_FIXED|MAP_PRIVATE, | ||
161 | elf_fd, phdr[i].p_offset); | ||
162 | if (addr != (void *)phdr[i].p_paddr) | ||
163 | err(1, "Mmaping vmlinux seg %i gave %p not %p", | ||
164 | i, addr, (void *)phdr[i].p_paddr); | ||
165 | } | ||
166 | |||
167 | return entry_point((void *)start, (void *)end, *page_offset); | ||
168 | } | ||
169 | |||
170 | /* This is amazingly reliable. */ | ||
171 | static unsigned long intuit_page_offset(unsigned char *img, unsigned long len) | ||
172 | { | ||
173 | unsigned int i, possibilities[256] = { 0 }; | ||
174 | |||
175 | for (i = 0; i + 4 < len; i++) { | ||
176 | /* mov 0xXXXXXXXX,%eax */ | ||
177 | if (img[i] == 0xA1 && ++possibilities[img[i+4]] > 3) | ||
178 | return (unsigned long)img[i+4] << 24; | ||
179 | } | ||
180 | errx(1, "could not determine page offset"); | ||
181 | } | ||
182 | |||
183 | static unsigned long unpack_bzimage(int fd, unsigned long *page_offset) | ||
184 | { | ||
185 | gzFile f; | ||
186 | int ret, len = 0; | ||
187 | void *img = (void *)0x100000; | ||
188 | |||
189 | f = gzdopen(fd, "rb"); | ||
190 | while ((ret = gzread(f, img + len, 65536)) > 0) | ||
191 | len += ret; | ||
192 | if (ret < 0) | ||
193 | err(1, "reading image from bzImage"); | ||
194 | |||
195 | verbose("Unpacked size %i addr %p\n", len, img); | ||
196 | *page_offset = intuit_page_offset(img, len); | ||
197 | |||
198 | return entry_point(img, img + len, *page_offset); | ||
199 | } | ||
200 | |||
201 | static unsigned long load_bzimage(int fd, unsigned long *page_offset) | ||
202 | { | ||
203 | unsigned char c; | ||
204 | int state = 0; | ||
205 | |||
206 | /* Ugly brute force search for gzip header. */ | ||
207 | while (read(fd, &c, 1) == 1) { | ||
208 | switch (state) { | ||
209 | case 0: | ||
210 | if (c == 0x1F) | ||
211 | state++; | ||
212 | break; | ||
213 | case 1: | ||
214 | if (c == 0x8B) | ||
215 | state++; | ||
216 | else | ||
217 | state = 0; | ||
218 | break; | ||
219 | case 2 ... 8: | ||
220 | state++; | ||
221 | break; | ||
222 | case 9: | ||
223 | lseek(fd, -10, SEEK_CUR); | ||
224 | if (c != 0x03) /* Compressed under UNIX. */ | ||
225 | state = -1; | ||
226 | else | ||
227 | return unpack_bzimage(fd, page_offset); | ||
228 | } | ||
229 | } | ||
230 | errx(1, "Could not find kernel in bzImage"); | ||
231 | } | ||
232 | |||
233 | static unsigned long load_kernel(int fd, unsigned long *page_offset) | ||
234 | { | ||
235 | Elf32_Ehdr hdr; | ||
236 | |||
237 | if (read(fd, &hdr, sizeof(hdr)) != sizeof(hdr)) | ||
238 | err(1, "Reading kernel"); | ||
239 | |||
240 | if (memcmp(hdr.e_ident, ELFMAG, SELFMAG) == 0) | ||
241 | return map_elf(fd, &hdr, page_offset); | ||
242 | |||
243 | return load_bzimage(fd, page_offset); | ||
244 | } | ||
245 | |||
246 | static inline unsigned long page_align(unsigned long addr) | ||
247 | { | ||
248 | return ((addr + getpagesize()-1) & ~(getpagesize()-1)); | ||
249 | } | ||
250 | |||
251 | /* initrd gets loaded at top of memory: return length. */ | ||
252 | static unsigned long load_initrd(const char *name, unsigned long mem) | ||
253 | { | ||
254 | int ifd; | ||
255 | struct stat st; | ||
256 | unsigned long len; | ||
257 | void *iaddr; | ||
258 | |||
259 | ifd = open_or_die(name, O_RDONLY); | ||
260 | if (fstat(ifd, &st) < 0) | ||
261 | err(1, "fstat() on initrd '%s'", name); | ||
262 | |||
263 | len = page_align(st.st_size); | ||
264 | iaddr = mmap((void *)mem - len, st.st_size, | ||
265 | PROT_READ|PROT_EXEC|PROT_WRITE, | ||
266 | MAP_FIXED|MAP_PRIVATE, ifd, 0); | ||
267 | if (iaddr != (void *)mem - len) | ||
268 | err(1, "Mmaping initrd '%s' returned %p not %p", | ||
269 | name, iaddr, (void *)mem - len); | ||
270 | close(ifd); | ||
271 | verbose("mapped initrd %s size=%lu @ %p\n", name, st.st_size, iaddr); | ||
272 | return len; | ||
273 | } | ||
274 | |||
275 | static unsigned long setup_pagetables(unsigned long mem, | ||
276 | unsigned long initrd_size, | ||
277 | unsigned long page_offset) | ||
278 | { | ||
279 | u32 *pgdir, *linear; | ||
280 | unsigned int mapped_pages, i, linear_pages; | ||
281 | unsigned int ptes_per_page = getpagesize()/sizeof(u32); | ||
282 | |||
283 | /* If we can map all of memory above page_offset, we do so. */ | ||
284 | if (mem <= -page_offset) | ||
285 | mapped_pages = mem/getpagesize(); | ||
286 | else | ||
287 | mapped_pages = -page_offset/getpagesize(); | ||
288 | |||
289 | /* Each linear PTE page can map ptes_per_page pages. */ | ||
290 | linear_pages = (mapped_pages + ptes_per_page-1)/ptes_per_page; | ||
291 | |||
292 | /* We lay out top-level then linear mapping immediately below initrd */ | ||
293 | pgdir = (void *)mem - initrd_size - getpagesize(); | ||
294 | linear = (void *)pgdir - linear_pages*getpagesize(); | ||
295 | |||
296 | for (i = 0; i < mapped_pages; i++) | ||
297 | linear[i] = ((i * getpagesize()) | PAGE_PRESENT); | ||
298 | |||
299 | /* Now set up pgd so that this memory is at page_offset */ | ||
300 | for (i = 0; i < mapped_pages; i += ptes_per_page) { | ||
301 | pgdir[(i + page_offset/getpagesize())/ptes_per_page] | ||
302 | = (((u32)linear + i*sizeof(u32)) | PAGE_PRESENT); | ||
303 | } | ||
304 | |||
305 | verbose("Linear mapping of %u pages in %u pte pages at %p\n", | ||
306 | mapped_pages, linear_pages, linear); | ||
307 | |||
308 | return (unsigned long)pgdir; | ||
309 | } | ||
310 | |||
311 | static void concat(char *dst, char *args[]) | ||
312 | { | ||
313 | unsigned int i, len = 0; | ||
314 | |||
315 | for (i = 0; args[i]; i++) { | ||
316 | strcpy(dst+len, args[i]); | ||
317 | strcat(dst+len, " "); | ||
318 | len += strlen(args[i]) + 1; | ||
319 | } | ||
320 | /* In case it's empty. */ | ||
321 | dst[len] = '\0'; | ||
322 | } | ||
323 | |||
324 | static int tell_kernel(u32 pgdir, u32 start, u32 page_offset) | ||
325 | { | ||
326 | u32 args[] = { LHREQ_INITIALIZE, | ||
327 | LGUEST_GUEST_TOP/getpagesize(), /* Just below us */ | ||
328 | pgdir, start, page_offset }; | ||
329 | int fd; | ||
330 | |||
331 | fd = open_or_die("/dev/lguest", O_RDWR); | ||
332 | if (write(fd, args, sizeof(args)) < 0) | ||
333 | err(1, "Writing to /dev/lguest"); | ||
334 | return fd; | ||
335 | } | ||
336 | |||
337 | static void set_fd(int fd, struct device_list *devices) | ||
338 | { | ||
339 | FD_SET(fd, &devices->infds); | ||
340 | if (fd > devices->max_infd) | ||
341 | devices->max_infd = fd; | ||
342 | } | ||
343 | |||
344 | /* When input arrives, we tell the kernel to kick lguest out with -EAGAIN. */ | ||
345 | static void wake_parent(int pipefd, int lguest_fd, struct device_list *devices) | ||
346 | { | ||
347 | set_fd(pipefd, devices); | ||
348 | |||
349 | for (;;) { | ||
350 | fd_set rfds = devices->infds; | ||
351 | u32 args[] = { LHREQ_BREAK, 1 }; | ||
352 | |||
353 | select(devices->max_infd+1, &rfds, NULL, NULL, NULL); | ||
354 | if (FD_ISSET(pipefd, &rfds)) { | ||
355 | int ignorefd; | ||
356 | if (read(pipefd, &ignorefd, sizeof(ignorefd)) == 0) | ||
357 | exit(0); | ||
358 | FD_CLR(ignorefd, &devices->infds); | ||
359 | } else | ||
360 | write(lguest_fd, args, sizeof(args)); | ||
361 | } | ||
362 | } | ||
363 | |||
364 | static int setup_waker(int lguest_fd, struct device_list *device_list) | ||
365 | { | ||
366 | int pipefd[2], child; | ||
367 | |||
368 | pipe(pipefd); | ||
369 | child = fork(); | ||
370 | if (child == -1) | ||
371 | err(1, "forking"); | ||
372 | |||
373 | if (child == 0) { | ||
374 | close(pipefd[1]); | ||
375 | wake_parent(pipefd[0], lguest_fd, device_list); | ||
376 | } | ||
377 | close(pipefd[0]); | ||
378 | |||
379 | return pipefd[1]; | ||
380 | } | ||
381 | |||
382 | static void *_check_pointer(unsigned long addr, unsigned int size, | ||
383 | unsigned int line) | ||
384 | { | ||
385 | if (addr >= LGUEST_GUEST_TOP || addr + size >= LGUEST_GUEST_TOP) | ||
386 | errx(1, "%s:%i: Invalid address %li", __FILE__, line, addr); | ||
387 | return (void *)addr; | ||
388 | } | ||
389 | #define check_pointer(addr,size) _check_pointer(addr, size, __LINE__) | ||
390 | |||
391 | /* Returns pointer to dma->used_len */ | ||
392 | static u32 *dma2iov(unsigned long dma, struct iovec iov[], unsigned *num) | ||
393 | { | ||
394 | unsigned int i; | ||
395 | struct lguest_dma *udma; | ||
396 | |||
397 | udma = check_pointer(dma, sizeof(*udma)); | ||
398 | for (i = 0; i < LGUEST_MAX_DMA_SECTIONS; i++) { | ||
399 | if (!udma->len[i]) | ||
400 | break; | ||
401 | |||
402 | iov[i].iov_base = check_pointer(udma->addr[i], udma->len[i]); | ||
403 | iov[i].iov_len = udma->len[i]; | ||
404 | } | ||
405 | *num = i; | ||
406 | return &udma->used_len; | ||
407 | } | ||
408 | |||
409 | static u32 *get_dma_buffer(int fd, void *key, | ||
410 | struct iovec iov[], unsigned int *num, u32 *irq) | ||
411 | { | ||
412 | u32 buf[] = { LHREQ_GETDMA, (u32)key }; | ||
413 | unsigned long udma; | ||
414 | u32 *res; | ||
415 | |||
416 | udma = write(fd, buf, sizeof(buf)); | ||
417 | if (udma == (unsigned long)-1) | ||
418 | return NULL; | ||
419 | |||
420 | /* Kernel stashes irq in ->used_len. */ | ||
421 | res = dma2iov(udma, iov, num); | ||
422 | *irq = *res; | ||
423 | return res; | ||
424 | } | ||
425 | |||
426 | static void trigger_irq(int fd, u32 irq) | ||
427 | { | ||
428 | u32 buf[] = { LHREQ_IRQ, irq }; | ||
429 | if (write(fd, buf, sizeof(buf)) != 0) | ||
430 | err(1, "Triggering irq %i", irq); | ||
431 | } | ||
432 | |||
433 | static void discard_iovec(struct iovec *iov, unsigned int *num) | ||
434 | { | ||
435 | static char discard_buf[1024]; | ||
436 | *num = 1; | ||
437 | iov->iov_base = discard_buf; | ||
438 | iov->iov_len = sizeof(discard_buf); | ||
439 | } | ||
440 | |||
441 | static struct termios orig_term; | ||
442 | static void restore_term(void) | ||
443 | { | ||
444 | tcsetattr(STDIN_FILENO, TCSANOW, &orig_term); | ||
445 | } | ||
446 | |||
447 | struct console_abort | ||
448 | { | ||
449 | int count; | ||
450 | struct timeval start; | ||
451 | }; | ||
452 | |||
453 | /* We DMA input to buffer bound at start of console page. */ | ||
454 | static bool handle_console_input(int fd, struct device *dev) | ||
455 | { | ||
456 | u32 irq = 0, *lenp; | ||
457 | int len; | ||
458 | unsigned int num; | ||
459 | struct iovec iov[LGUEST_MAX_DMA_SECTIONS]; | ||
460 | struct console_abort *abort = dev->priv; | ||
461 | |||
462 | lenp = get_dma_buffer(fd, dev->mem, iov, &num, &irq); | ||
463 | if (!lenp) { | ||
464 | warn("console: no dma buffer!"); | ||
465 | discard_iovec(iov, &num); | ||
466 | } | ||
467 | |||
468 | len = readv(dev->fd, iov, num); | ||
469 | if (len <= 0) { | ||
470 | warnx("Failed to get console input, ignoring console."); | ||
471 | len = 0; | ||
472 | } | ||
473 | |||
474 | if (lenp) { | ||
475 | *lenp = len; | ||
476 | trigger_irq(fd, irq); | ||
477 | } | ||
478 | |||
479 | /* Three ^C within one second? Exit. */ | ||
480 | if (len == 1 && ((char *)iov[0].iov_base)[0] == 3) { | ||
481 | if (!abort->count++) | ||
482 | gettimeofday(&abort->start, NULL); | ||
483 | else if (abort->count == 3) { | ||
484 | struct timeval now; | ||
485 | gettimeofday(&now, NULL); | ||
486 | if (now.tv_sec <= abort->start.tv_sec+1) { | ||
487 | /* Make sure waker is not blocked in BREAK */ | ||
488 | u32 args[] = { LHREQ_BREAK, 0 }; | ||
489 | close(waker_fd); | ||
490 | write(fd, args, sizeof(args)); | ||
491 | exit(2); | ||
492 | } | ||
493 | abort->count = 0; | ||
494 | } | ||
495 | } else | ||
496 | abort->count = 0; | ||
497 | |||
498 | if (!len) { | ||
499 | restore_term(); | ||
500 | return false; | ||
501 | } | ||
502 | return true; | ||
503 | } | ||
504 | |||
505 | static u32 handle_console_output(int fd, const struct iovec *iov, | ||
506 | unsigned num, struct device*dev) | ||
507 | { | ||
508 | return writev(STDOUT_FILENO, iov, num); | ||
509 | } | ||
510 | |||
511 | static u32 handle_tun_output(int fd, const struct iovec *iov, | ||
512 | unsigned num, struct device *dev) | ||
513 | { | ||
514 | /* Now we've seen output, we should warn if we can't get buffers. */ | ||
515 | *(bool *)dev->priv = true; | ||
516 | return writev(dev->fd, iov, num); | ||
517 | } | ||
518 | |||
519 | static unsigned long peer_offset(unsigned int peernum) | ||
520 | { | ||
521 | return 4 * peernum; | ||
522 | } | ||
523 | |||
524 | static bool handle_tun_input(int fd, struct device *dev) | ||
525 | { | ||
526 | u32 irq = 0, *lenp; | ||
527 | int len; | ||
528 | unsigned num; | ||
529 | struct iovec iov[LGUEST_MAX_DMA_SECTIONS]; | ||
530 | |||
531 | lenp = get_dma_buffer(fd, dev->mem+peer_offset(NET_PEERNUM), iov, &num, | ||
532 | &irq); | ||
533 | if (!lenp) { | ||
534 | if (*(bool *)dev->priv) | ||
535 | warn("network: no dma buffer!"); | ||
536 | discard_iovec(iov, &num); | ||
537 | } | ||
538 | |||
539 | len = readv(dev->fd, iov, num); | ||
540 | if (len <= 0) | ||
541 | err(1, "reading network"); | ||
542 | if (lenp) { | ||
543 | *lenp = len; | ||
544 | trigger_irq(fd, irq); | ||
545 | } | ||
546 | verbose("tun input packet len %i [%02x %02x] (%s)\n", len, | ||
547 | ((u8 *)iov[0].iov_base)[0], ((u8 *)iov[0].iov_base)[1], | ||
548 | lenp ? "sent" : "discarded"); | ||
549 | return true; | ||
550 | } | ||
551 | |||
552 | static u32 handle_block_output(int fd, const struct iovec *iov, | ||
553 | unsigned num, struct device *dev) | ||
554 | { | ||
555 | struct lguest_block_page *p = dev->mem; | ||
556 | u32 irq, *lenp; | ||
557 | unsigned int len, reply_num; | ||
558 | struct iovec reply[LGUEST_MAX_DMA_SECTIONS]; | ||
559 | off64_t device_len, off = (off64_t)p->sector * 512; | ||
560 | |||
561 | device_len = *(off64_t *)dev->priv; | ||
562 | |||
563 | if (off >= device_len) | ||
564 | err(1, "Bad offset %llu vs %llu", off, device_len); | ||
565 | if (lseek64(dev->fd, off, SEEK_SET) != off) | ||
566 | err(1, "Bad seek to sector %i", p->sector); | ||
567 | |||
568 | verbose("Block: %s at offset %llu\n", p->type ? "WRITE" : "READ", off); | ||
569 | |||
570 | lenp = get_dma_buffer(fd, dev->mem, reply, &reply_num, &irq); | ||
571 | if (!lenp) | ||
572 | err(1, "Block request didn't give us a dma buffer"); | ||
573 | |||
574 | if (p->type) { | ||
575 | len = writev(dev->fd, iov, num); | ||
576 | if (off + len > device_len) { | ||
577 | ftruncate(dev->fd, device_len); | ||
578 | errx(1, "Write past end %llu+%u", off, len); | ||
579 | } | ||
580 | *lenp = 0; | ||
581 | } else { | ||
582 | len = readv(dev->fd, reply, reply_num); | ||
583 | *lenp = len; | ||
584 | } | ||
585 | |||
586 | p->result = 1 + (p->bytes != len); | ||
587 | trigger_irq(fd, irq); | ||
588 | return 0; | ||
589 | } | ||
590 | |||
591 | static void handle_output(int fd, unsigned long dma, unsigned long key, | ||
592 | struct device_list *devices) | ||
593 | { | ||
594 | struct device *i; | ||
595 | u32 *lenp; | ||
596 | struct iovec iov[LGUEST_MAX_DMA_SECTIONS]; | ||
597 | unsigned num = 0; | ||
598 | |||
599 | lenp = dma2iov(dma, iov, &num); | ||
600 | for (i = devices->dev; i; i = i->next) { | ||
601 | if (i->handle_output && key == i->watch_key) { | ||
602 | *lenp = i->handle_output(fd, iov, num, i); | ||
603 | return; | ||
604 | } | ||
605 | } | ||
606 | warnx("Pending dma %p, key %p", (void *)dma, (void *)key); | ||
607 | } | ||
608 | |||
609 | static void handle_input(int fd, struct device_list *devices) | ||
610 | { | ||
611 | struct timeval poll = { .tv_sec = 0, .tv_usec = 0 }; | ||
612 | |||
613 | for (;;) { | ||
614 | struct device *i; | ||
615 | fd_set fds = devices->infds; | ||
616 | |||
617 | if (select(devices->max_infd+1, &fds, NULL, NULL, &poll) == 0) | ||
618 | break; | ||
619 | |||
620 | for (i = devices->dev; i; i = i->next) { | ||
621 | if (i->handle_input && FD_ISSET(i->fd, &fds)) { | ||
622 | if (!i->handle_input(fd, i)) { | ||
623 | FD_CLR(i->fd, &devices->infds); | ||
624 | /* Tell waker to ignore it too... */ | ||
625 | write(waker_fd, &i->fd, sizeof(i->fd)); | ||
626 | } | ||
627 | } | ||
628 | } | ||
629 | } | ||
630 | } | ||
631 | |||
632 | static struct lguest_device_desc *new_dev_desc(u16 type, u16 features, | ||
633 | u16 num_pages) | ||
634 | { | ||
635 | static unsigned long top = LGUEST_GUEST_TOP; | ||
636 | struct lguest_device_desc *desc; | ||
637 | |||
638 | desc = malloc(sizeof(*desc)); | ||
639 | desc->type = type; | ||
640 | desc->num_pages = num_pages; | ||
641 | desc->features = features; | ||
642 | desc->status = 0; | ||
643 | if (num_pages) { | ||
644 | top -= num_pages*getpagesize(); | ||
645 | map_zeroed_pages(top, num_pages); | ||
646 | desc->pfn = top / getpagesize(); | ||
647 | } else | ||
648 | desc->pfn = 0; | ||
649 | return desc; | ||
650 | } | ||
651 | |||
652 | static struct device *new_device(struct device_list *devices, | ||
653 | u16 type, u16 num_pages, u16 features, | ||
654 | int fd, | ||
655 | bool (*handle_input)(int, struct device *), | ||
656 | unsigned long watch_off, | ||
657 | u32 (*handle_output)(int, | ||
658 | const struct iovec *, | ||
659 | unsigned, | ||
660 | struct device *)) | ||
661 | { | ||
662 | struct device *dev = malloc(sizeof(*dev)); | ||
663 | |||
664 | /* Append to device list. */ | ||
665 | *devices->lastdev = dev; | ||
666 | dev->next = NULL; | ||
667 | devices->lastdev = &dev->next; | ||
668 | |||
669 | dev->fd = fd; | ||
670 | if (handle_input) | ||
671 | set_fd(dev->fd, devices); | ||
672 | dev->desc = new_dev_desc(type, features, num_pages); | ||
673 | dev->mem = (void *)(dev->desc->pfn * getpagesize()); | ||
674 | dev->handle_input = handle_input; | ||
675 | dev->watch_key = (unsigned long)dev->mem + watch_off; | ||
676 | dev->handle_output = handle_output; | ||
677 | return dev; | ||
678 | } | ||
679 | |||
680 | static void setup_console(struct device_list *devices) | ||
681 | { | ||
682 | struct device *dev; | ||
683 | |||
684 | if (tcgetattr(STDIN_FILENO, &orig_term) == 0) { | ||
685 | struct termios term = orig_term; | ||
686 | term.c_lflag &= ~(ISIG|ICANON|ECHO); | ||
687 | tcsetattr(STDIN_FILENO, TCSANOW, &term); | ||
688 | atexit(restore_term); | ||
689 | } | ||
690 | |||
691 | /* We don't currently require a page for the console. */ | ||
692 | dev = new_device(devices, LGUEST_DEVICE_T_CONSOLE, 0, 0, | ||
693 | STDIN_FILENO, handle_console_input, | ||
694 | LGUEST_CONSOLE_DMA_KEY, handle_console_output); | ||
695 | dev->priv = malloc(sizeof(struct console_abort)); | ||
696 | ((struct console_abort *)dev->priv)->count = 0; | ||
697 | verbose("device %p: console\n", | ||
698 | (void *)(dev->desc->pfn * getpagesize())); | ||
699 | } | ||
700 | |||
701 | static void setup_block_file(const char *filename, struct device_list *devices) | ||
702 | { | ||
703 | int fd; | ||
704 | struct device *dev; | ||
705 | off64_t *device_len; | ||
706 | struct lguest_block_page *p; | ||
707 | |||
708 | fd = open_or_die(filename, O_RDWR|O_LARGEFILE|O_DIRECT); | ||
709 | dev = new_device(devices, LGUEST_DEVICE_T_BLOCK, 1, | ||
710 | LGUEST_DEVICE_F_RANDOMNESS, | ||
711 | fd, NULL, 0, handle_block_output); | ||
712 | device_len = dev->priv = malloc(sizeof(*device_len)); | ||
713 | *device_len = lseek64(fd, 0, SEEK_END); | ||
714 | p = dev->mem; | ||
715 | |||
716 | p->num_sectors = *device_len/512; | ||
717 | verbose("device %p: block %i sectors\n", | ||
718 | (void *)(dev->desc->pfn * getpagesize()), p->num_sectors); | ||
719 | } | ||
720 | |||
721 | /* We use fnctl locks to reserve network slots (autocleanup!) */ | ||
722 | static unsigned int find_slot(int netfd, const char *filename) | ||
723 | { | ||
724 | struct flock fl; | ||
725 | |||
726 | fl.l_type = F_WRLCK; | ||
727 | fl.l_whence = SEEK_SET; | ||
728 | fl.l_len = 1; | ||
729 | for (fl.l_start = 0; | ||
730 | fl.l_start < getpagesize()/sizeof(struct lguest_net); | ||
731 | fl.l_start++) { | ||
732 | if (fcntl(netfd, F_SETLK, &fl) == 0) | ||
733 | return fl.l_start; | ||
734 | } | ||
735 | errx(1, "No free slots in network file %s", filename); | ||
736 | } | ||
737 | |||
738 | static void setup_net_file(const char *filename, | ||
739 | struct device_list *devices) | ||
740 | { | ||
741 | int netfd; | ||
742 | struct device *dev; | ||
743 | |||
744 | netfd = open(filename, O_RDWR, 0); | ||
745 | if (netfd < 0) { | ||
746 | if (errno == ENOENT) { | ||
747 | netfd = open(filename, O_RDWR|O_CREAT, 0600); | ||
748 | if (netfd >= 0) { | ||
749 | char page[getpagesize()]; | ||
750 | memset(page, 0, sizeof(page)); | ||
751 | write(netfd, page, sizeof(page)); | ||
752 | } | ||
753 | } | ||
754 | if (netfd < 0) | ||
755 | err(1, "cannot open net file '%s'", filename); | ||
756 | } | ||
757 | |||
758 | dev = new_device(devices, LGUEST_DEVICE_T_NET, 1, | ||
759 | find_slot(netfd, filename)|LGUEST_NET_F_NOCSUM, | ||
760 | -1, NULL, 0, NULL); | ||
761 | |||
762 | /* We overwrite the /dev/zero mapping with the actual file. */ | ||
763 | if (mmap(dev->mem, getpagesize(), PROT_READ|PROT_WRITE, | ||
764 | MAP_FIXED|MAP_SHARED, netfd, 0) != dev->mem) | ||
765 | err(1, "could not mmap '%s'", filename); | ||
766 | verbose("device %p: shared net %s, peer %i\n", | ||
767 | (void *)(dev->desc->pfn * getpagesize()), filename, | ||
768 | dev->desc->features & ~LGUEST_NET_F_NOCSUM); | ||
769 | } | ||
770 | |||
771 | static u32 str2ip(const char *ipaddr) | ||
772 | { | ||
773 | unsigned int byte[4]; | ||
774 | |||
775 | sscanf(ipaddr, "%u.%u.%u.%u", &byte[0], &byte[1], &byte[2], &byte[3]); | ||
776 | return (byte[0] << 24) | (byte[1] << 16) | (byte[2] << 8) | byte[3]; | ||
777 | } | ||
778 | |||
779 | /* adapted from libbridge */ | ||
780 | static void add_to_bridge(int fd, const char *if_name, const char *br_name) | ||
781 | { | ||
782 | int ifidx; | ||
783 | struct ifreq ifr; | ||
784 | |||
785 | if (!*br_name) | ||
786 | errx(1, "must specify bridge name"); | ||
787 | |||
788 | ifidx = if_nametoindex(if_name); | ||
789 | if (!ifidx) | ||
790 | errx(1, "interface %s does not exist!", if_name); | ||
791 | |||
792 | strncpy(ifr.ifr_name, br_name, IFNAMSIZ); | ||
793 | ifr.ifr_ifindex = ifidx; | ||
794 | if (ioctl(fd, SIOCBRADDIF, &ifr) < 0) | ||
795 | err(1, "can't add %s to bridge %s", if_name, br_name); | ||
796 | } | ||
797 | |||
798 | static void configure_device(int fd, const char *devname, u32 ipaddr, | ||
799 | unsigned char hwaddr[6]) | ||
800 | { | ||
801 | struct ifreq ifr; | ||
802 | struct sockaddr_in *sin = (struct sockaddr_in *)&ifr.ifr_addr; | ||
803 | |||
804 | memset(&ifr, 0, sizeof(ifr)); | ||
805 | strcpy(ifr.ifr_name, devname); | ||
806 | sin->sin_family = AF_INET; | ||
807 | sin->sin_addr.s_addr = htonl(ipaddr); | ||
808 | if (ioctl(fd, SIOCSIFADDR, &ifr) != 0) | ||
809 | err(1, "Setting %s interface address", devname); | ||
810 | ifr.ifr_flags = IFF_UP; | ||
811 | if (ioctl(fd, SIOCSIFFLAGS, &ifr) != 0) | ||
812 | err(1, "Bringing interface %s up", devname); | ||
813 | |||
814 | if (ioctl(fd, SIOCGIFHWADDR, &ifr) != 0) | ||
815 | err(1, "getting hw address for %s", devname); | ||
816 | |||
817 | memcpy(hwaddr, ifr.ifr_hwaddr.sa_data, 6); | ||
818 | } | ||
819 | |||
820 | static void setup_tun_net(const char *arg, struct device_list *devices) | ||
821 | { | ||
822 | struct device *dev; | ||
823 | struct ifreq ifr; | ||
824 | int netfd, ipfd; | ||
825 | u32 ip; | ||
826 | const char *br_name = NULL; | ||
827 | |||
828 | netfd = open_or_die("/dev/net/tun", O_RDWR); | ||
829 | memset(&ifr, 0, sizeof(ifr)); | ||
830 | ifr.ifr_flags = IFF_TAP | IFF_NO_PI; | ||
831 | strcpy(ifr.ifr_name, "tap%d"); | ||
832 | if (ioctl(netfd, TUNSETIFF, &ifr) != 0) | ||
833 | err(1, "configuring /dev/net/tun"); | ||
834 | ioctl(netfd, TUNSETNOCSUM, 1); | ||
835 | |||
836 | /* You will be peer 1: we should create enough jitter to randomize */ | ||
837 | dev = new_device(devices, LGUEST_DEVICE_T_NET, 1, | ||
838 | NET_PEERNUM|LGUEST_DEVICE_F_RANDOMNESS, netfd, | ||
839 | handle_tun_input, peer_offset(0), handle_tun_output); | ||
840 | dev->priv = malloc(sizeof(bool)); | ||
841 | *(bool *)dev->priv = false; | ||
842 | |||
843 | ipfd = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP); | ||
844 | if (ipfd < 0) | ||
845 | err(1, "opening IP socket"); | ||
846 | |||
847 | if (!strncmp(BRIDGE_PFX, arg, strlen(BRIDGE_PFX))) { | ||
848 | ip = INADDR_ANY; | ||
849 | br_name = arg + strlen(BRIDGE_PFX); | ||
850 | add_to_bridge(ipfd, ifr.ifr_name, br_name); | ||
851 | } else | ||
852 | ip = str2ip(arg); | ||
853 | |||
854 | /* We are peer 0, ie. first slot. */ | ||
855 | configure_device(ipfd, ifr.ifr_name, ip, dev->mem); | ||
856 | |||
857 | /* Set "promisc" bit: we want every single packet. */ | ||
858 | *((u8 *)dev->mem) |= 0x1; | ||
859 | |||
860 | close(ipfd); | ||
861 | |||
862 | verbose("device %p: tun net %u.%u.%u.%u\n", | ||
863 | (void *)(dev->desc->pfn * getpagesize()), | ||
864 | (u8)(ip>>24), (u8)(ip>>16), (u8)(ip>>8), (u8)ip); | ||
865 | if (br_name) | ||
866 | verbose("attached to bridge: %s\n", br_name); | ||
867 | } | ||
868 | |||
869 | /* Now we know how much memory we have, we copy in device descriptors */ | ||
870 | static void map_device_descriptors(struct device_list *devs, unsigned long mem) | ||
871 | { | ||
872 | struct device *i; | ||
873 | unsigned int num; | ||
874 | struct lguest_device_desc *descs; | ||
875 | |||
876 | /* Device descriptor array sits just above top of normal memory */ | ||
877 | descs = map_zeroed_pages(mem, 1); | ||
878 | |||
879 | for (i = devs->dev, num = 0; i; i = i->next, num++) { | ||
880 | if (num == LGUEST_MAX_DEVICES) | ||
881 | errx(1, "too many devices"); | ||
882 | verbose("Device %i: %s\n", num, | ||
883 | i->desc->type == LGUEST_DEVICE_T_NET ? "net" | ||
884 | : i->desc->type == LGUEST_DEVICE_T_CONSOLE ? "console" | ||
885 | : i->desc->type == LGUEST_DEVICE_T_BLOCK ? "block" | ||
886 | : "unknown"); | ||
887 | descs[num] = *i->desc; | ||
888 | free(i->desc); | ||
889 | i->desc = &descs[num]; | ||
890 | } | ||
891 | } | ||
892 | |||
893 | static void __attribute__((noreturn)) | ||
894 | run_guest(int lguest_fd, struct device_list *device_list) | ||
895 | { | ||
896 | for (;;) { | ||
897 | u32 args[] = { LHREQ_BREAK, 0 }; | ||
898 | unsigned long arr[2]; | ||
899 | int readval; | ||
900 | |||
901 | /* We read from the /dev/lguest device to run the Guest. */ | ||
902 | readval = read(lguest_fd, arr, sizeof(arr)); | ||
903 | |||
904 | if (readval == sizeof(arr)) { | ||
905 | handle_output(lguest_fd, arr[0], arr[1], device_list); | ||
906 | continue; | ||
907 | } else if (errno == ENOENT) { | ||
908 | char reason[1024] = { 0 }; | ||
909 | read(lguest_fd, reason, sizeof(reason)-1); | ||
910 | errx(1, "%s", reason); | ||
911 | } else if (errno != EAGAIN) | ||
912 | err(1, "Running guest failed"); | ||
913 | handle_input(lguest_fd, device_list); | ||
914 | if (write(lguest_fd, args, sizeof(args)) < 0) | ||
915 | err(1, "Resetting break"); | ||
916 | } | ||
917 | } | ||
918 | |||
919 | static struct option opts[] = { | ||
920 | { "verbose", 0, NULL, 'v' }, | ||
921 | { "sharenet", 1, NULL, 's' }, | ||
922 | { "tunnet", 1, NULL, 't' }, | ||
923 | { "block", 1, NULL, 'b' }, | ||
924 | { "initrd", 1, NULL, 'i' }, | ||
925 | { NULL }, | ||
926 | }; | ||
927 | static void usage(void) | ||
928 | { | ||
929 | errx(1, "Usage: lguest [--verbose] " | ||
930 | "[--sharenet=<filename>|--tunnet=(<ipaddr>|bridge:<bridgename>)\n" | ||
931 | "|--block=<filename>|--initrd=<filename>]...\n" | ||
932 | "<mem-in-mb> vmlinux [args...]"); | ||
933 | } | ||
934 | |||
935 | int main(int argc, char *argv[]) | ||
936 | { | ||
937 | unsigned long mem, pgdir, start, page_offset, initrd_size = 0; | ||
938 | int c, lguest_fd; | ||
939 | struct device_list device_list; | ||
940 | void *boot = (void *)0; | ||
941 | const char *initrd_name = NULL; | ||
942 | |||
943 | device_list.max_infd = -1; | ||
944 | device_list.dev = NULL; | ||
945 | device_list.lastdev = &device_list.dev; | ||
946 | FD_ZERO(&device_list.infds); | ||
947 | |||
948 | while ((c = getopt_long(argc, argv, "v", opts, NULL)) != EOF) { | ||
949 | switch (c) { | ||
950 | case 'v': | ||
951 | verbose = true; | ||
952 | break; | ||
953 | case 's': | ||
954 | setup_net_file(optarg, &device_list); | ||
955 | break; | ||
956 | case 't': | ||
957 | setup_tun_net(optarg, &device_list); | ||
958 | break; | ||
959 | case 'b': | ||
960 | setup_block_file(optarg, &device_list); | ||
961 | break; | ||
962 | case 'i': | ||
963 | initrd_name = optarg; | ||
964 | break; | ||
965 | default: | ||
966 | warnx("Unknown argument %s", argv[optind]); | ||
967 | usage(); | ||
968 | } | ||
969 | } | ||
970 | if (optind + 2 > argc) | ||
971 | usage(); | ||
972 | |||
973 | /* We need a console device */ | ||
974 | setup_console(&device_list); | ||
975 | |||
976 | /* First we map /dev/zero over all of guest-physical memory. */ | ||
977 | mem = atoi(argv[optind]) * 1024 * 1024; | ||
978 | map_zeroed_pages(0, mem / getpagesize()); | ||
979 | |||
980 | /* Now we load the kernel */ | ||
981 | start = load_kernel(open_or_die(argv[optind+1], O_RDONLY), | ||
982 | &page_offset); | ||
983 | |||
984 | /* Write the device descriptors into memory. */ | ||
985 | map_device_descriptors(&device_list, mem); | ||
986 | |||
987 | /* Map the initrd image if requested */ | ||
988 | if (initrd_name) { | ||
989 | initrd_size = load_initrd(initrd_name, mem); | ||
990 | *(unsigned long *)(boot+0x218) = mem - initrd_size; | ||
991 | *(unsigned long *)(boot+0x21c) = initrd_size; | ||
992 | *(unsigned char *)(boot+0x210) = 0xFF; | ||
993 | } | ||
994 | |||
995 | /* Set up the initial linar pagetables. */ | ||
996 | pgdir = setup_pagetables(mem, initrd_size, page_offset); | ||
997 | |||
998 | /* E820 memory map: ours is a simple, single region. */ | ||
999 | *(char*)(boot+E820NR) = 1; | ||
1000 | *((struct e820entry *)(boot+E820MAP)) | ||
1001 | = ((struct e820entry) { 0, mem, E820_RAM }); | ||
1002 | /* Command line pointer and command line (at 4096) */ | ||
1003 | *(void **)(boot + 0x228) = boot + 4096; | ||
1004 | concat(boot + 4096, argv+optind+2); | ||
1005 | /* Paravirt type: 1 == lguest */ | ||
1006 | *(int *)(boot + 0x23c) = 1; | ||
1007 | |||
1008 | lguest_fd = tell_kernel(pgdir, start, page_offset); | ||
1009 | waker_fd = setup_waker(lguest_fd, &device_list); | ||
1010 | |||
1011 | run_guest(lguest_fd, &device_list); | ||
1012 | } | ||
diff --git a/Documentation/lguest/lguest.txt b/Documentation/lguest/lguest.txt new file mode 100644 index 000000000000..821617bd6c04 --- /dev/null +++ b/Documentation/lguest/lguest.txt | |||
@@ -0,0 +1,129 @@ | |||
1 | Rusty's Remarkably Unreliable Guide to Lguest | ||
2 | - or, A Young Coder's Illustrated Hypervisor | ||
3 | http://lguest.ozlabs.org | ||
4 | |||
5 | Lguest is designed to be a minimal hypervisor for the Linux kernel, for | ||
6 | Linux developers and users to experiment with virtualization with the | ||
7 | minimum of complexity. Nonetheless, it should have sufficient | ||
8 | features to make it useful for specific tasks, and, of course, you are | ||
9 | encouraged to fork and enhance it. | ||
10 | |||
11 | Features: | ||
12 | |||
13 | - Kernel module which runs in a normal kernel. | ||
14 | - Simple I/O model for communication. | ||
15 | - Simple program to create new guests. | ||
16 | - Logo contains cute puppies: http://lguest.ozlabs.org | ||
17 | |||
18 | Developer features: | ||
19 | |||
20 | - Fun to hack on. | ||
21 | - No ABI: being tied to a specific kernel anyway, you can change anything. | ||
22 | - Many opportunities for improvement or feature implementation. | ||
23 | |||
24 | Running Lguest: | ||
25 | |||
26 | - Lguest runs the same kernel as guest and host. You can configure | ||
27 | them differently, but usually it's easiest not to. | ||
28 | |||
29 | You will need to configure your kernel with the following options: | ||
30 | |||
31 | CONFIG_HIGHMEM64G=n ("High Memory Support" "64GB")[1] | ||
32 | CONFIG_TUN=y/m ("Universal TUN/TAP device driver support") | ||
33 | CONFIG_EXPERIMENTAL=y ("Prompt for development and/or incomplete code/drivers") | ||
34 | CONFIG_PARAVIRT=y ("Paravirtualization support (EXPERIMENTAL)") | ||
35 | CONFIG_LGUEST=y/m ("Linux hypervisor example code") | ||
36 | |||
37 | and I recommend: | ||
38 | CONFIG_HZ=100 ("Timer frequency")[2] | ||
39 | |||
40 | - A tool called "lguest" is available in this directory: type "make" | ||
41 | to build it. If you didn't build your kernel in-tree, use "make | ||
42 | O=<builddir>". | ||
43 | |||
44 | - Create or find a root disk image. There are several useful ones | ||
45 | around, such as the xm-test tiny root image at | ||
46 | http://xm-test.xensource.com/ramdisks/initrd-1.1-i386.img | ||
47 | |||
48 | For more serious work, I usually use a distribution ISO image and | ||
49 | install it under qemu, then make multiple copies: | ||
50 | |||
51 | dd if=/dev/zero of=rootfile bs=1M count=2048 | ||
52 | qemu -cdrom image.iso -hda rootfile -net user -net nic -boot d | ||
53 | |||
54 | - "modprobe lg" if you built it as a module. | ||
55 | |||
56 | - Run an lguest as root: | ||
57 | |||
58 | Documentation/lguest/lguest 64m vmlinux --tunnet=192.168.19.1 --block=rootfile root=/dev/lgba | ||
59 | |||
60 | Explanation: | ||
61 | 64m: the amount of memory to use. | ||
62 | |||
63 | vmlinux: the kernel image found in the top of your build directory. You | ||
64 | can also use a standard bzImage. | ||
65 | |||
66 | --tunnet=192.168.19.1: configures a "tap" device for networking with this | ||
67 | IP address. | ||
68 | |||
69 | --block=rootfile: a file or block device which becomes /dev/lgba | ||
70 | inside the guest. | ||
71 | |||
72 | root=/dev/lgba: this (and anything else on the command line) are | ||
73 | kernel boot parameters. | ||
74 | |||
75 | - Configuring networking. I usually have the host masquerade, using | ||
76 | "iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE" and "echo 1 > | ||
77 | /proc/sys/net/ipv4/ip_forward". In this example, I would configure | ||
78 | eth0 inside the guest at 192.168.19.2. | ||
79 | |||
80 | Another method is to bridge the tap device to an external interface | ||
81 | using --tunnet=bridge:<bridgename>, and perhaps run dhcp on the guest | ||
82 | to obtain an IP address. The bridge needs to be configured first: | ||
83 | this option simply adds the tap interface to it. | ||
84 | |||
85 | A simple example on my system: | ||
86 | |||
87 | ifconfig eth0 0.0.0.0 | ||
88 | brctl addbr lg0 | ||
89 | ifconfig lg0 up | ||
90 | brctl addif lg0 eth0 | ||
91 | dhclient lg0 | ||
92 | |||
93 | Then use --tunnet=bridge:lg0 when launching the guest. | ||
94 | |||
95 | See http://linux-net.osdl.org/index.php/Bridge for general information | ||
96 | on how to get bridging working. | ||
97 | |||
98 | - You can also create an inter-guest network using | ||
99 | "--sharenet=<filename>": any two guests using the same file are on | ||
100 | the same network. This file is created if it does not exist. | ||
101 | |||
102 | Lguest I/O model: | ||
103 | |||
104 | Lguest uses a simplified DMA model plus shared memory for I/O. Guests | ||
105 | can communicate with each other if they share underlying memory | ||
106 | (usually by the lguest program mmaping the same file), but they can | ||
107 | use any non-shared memory to communicate with the lguest process. | ||
108 | |||
109 | Guests can register DMA buffers at any key (must be a valid physical | ||
110 | address) using the LHCALL_BIND_DMA(key, dmabufs, num<<8|irq) | ||
111 | hypercall. "dmabufs" is the physical address of an array of "num" | ||
112 | "struct lguest_dma": each contains a used_len, and an array of | ||
113 | physical addresses and lengths. When a transfer occurs, the | ||
114 | "used_len" field of one of the buffers which has used_len 0 will be | ||
115 | set to the length transferred and the irq will fire. | ||
116 | |||
117 | Using an irq value of 0 unbinds the dma buffers. | ||
118 | |||
119 | To send DMA, the LHCALL_SEND_DMA(key, dma_physaddr) hypercall is used, | ||
120 | and the bytes used is written to the used_len field. This can be 0 if | ||
121 | noone else has bound a DMA buffer to that key or some other error. | ||
122 | DMA buffers bound by the same guest are ignored. | ||
123 | |||
124 | Cheers! | ||
125 | Rusty Russell rusty@rustcorp.com.au. | ||
126 | |||
127 | [1] These are on various places on the TODO list, waiting for you to | ||
128 | get annoyed enough at the limitation to fix it. | ||
129 | [2] Lguest is not yet tickless when idle. See [1]. | ||
diff --git a/Documentation/m68k/kernel-options.txt b/Documentation/m68k/kernel-options.txt index 1c41db21d3c1..59108cebe163 100644 --- a/Documentation/m68k/kernel-options.txt +++ b/Documentation/m68k/kernel-options.txt | |||
@@ -82,13 +82,6 @@ Valid names are: | |||
82 | /dev/fd : -> 0x0200 (floppy disk) | 82 | /dev/fd : -> 0x0200 (floppy disk) |
83 | /dev/xda: -> 0x0c00 (first XT disk, unused in Linux/m68k) | 83 | /dev/xda: -> 0x0c00 (first XT disk, unused in Linux/m68k) |
84 | /dev/xdb: -> 0x0c40 (second XT disk, unused in Linux/m68k) | 84 | /dev/xdb: -> 0x0c40 (second XT disk, unused in Linux/m68k) |
85 | /dev/ada: -> 0x1c00 (first ACSI device) | ||
86 | /dev/adb: -> 0x1c10 (second ACSI device) | ||
87 | /dev/adc: -> 0x1c20 (third ACSI device) | ||
88 | /dev/add: -> 0x1c30 (forth ACSI device) | ||
89 | |||
90 | The last four names are available only if the kernel has been compiled | ||
91 | with Atari and ACSI support. | ||
92 | 85 | ||
93 | The name must be followed by a decimal number, that stands for the | 86 | The name must be followed by a decimal number, that stands for the |
94 | partition number. Internally, the value of the number is just | 87 | partition number. Internally, the value of the number is just |
diff --git a/Documentation/networking/00-INDEX b/Documentation/networking/00-INDEX index e06b6e3c1db5..d63f480afb74 100644 --- a/Documentation/networking/00-INDEX +++ b/Documentation/networking/00-INDEX | |||
@@ -32,6 +32,8 @@ cops.txt | |||
32 | - info on the COPS LocalTalk Linux driver | 32 | - info on the COPS LocalTalk Linux driver |
33 | cs89x0.txt | 33 | cs89x0.txt |
34 | - the Crystal LAN (CS8900/20-based) Ethernet ISA adapter driver | 34 | - the Crystal LAN (CS8900/20-based) Ethernet ISA adapter driver |
35 | cxacru.txt | ||
36 | - Conexant AccessRunner USB ADSL Modem | ||
35 | de4x5.txt | 37 | de4x5.txt |
36 | - the Digital EtherWORKS DE4?? and DE5?? PCI Ethernet driver | 38 | - the Digital EtherWORKS DE4?? and DE5?? PCI Ethernet driver |
37 | decnet.txt | 39 | decnet.txt |
@@ -94,9 +96,6 @@ routing.txt | |||
94 | - the new routing mechanism | 96 | - the new routing mechanism |
95 | shaper.txt | 97 | shaper.txt |
96 | - info on the module that can shape/limit transmitted traffic. | 98 | - info on the module that can shape/limit transmitted traffic. |
97 | sk98lin.txt | ||
98 | - Marvell Yukon Chipset / SysKonnect SK-98xx compliant Gigabit | ||
99 | Ethernet Adapter family driver info | ||
100 | skfp.txt | 99 | skfp.txt |
101 | - SysKonnect FDDI (SK-5xxx, Compaq Netelligent) driver info. | 100 | - SysKonnect FDDI (SK-5xxx, Compaq Netelligent) driver info. |
102 | smc9.txt | 101 | smc9.txt |
diff --git a/Documentation/networking/cxacru.txt b/Documentation/networking/cxacru.txt new file mode 100644 index 000000000000..b074681a963e --- /dev/null +++ b/Documentation/networking/cxacru.txt | |||
@@ -0,0 +1,84 @@ | |||
1 | Firmware is required for this device: http://accessrunner.sourceforge.net/ | ||
2 | |||
3 | While it is capable of managing/maintaining the ADSL connection without the | ||
4 | module loaded, the device will sometimes stop responding after unloading the | ||
5 | driver and it is necessary to unplug/remove power to the device to fix this. | ||
6 | |||
7 | Detected devices will appear as ATM devices named "cxacru". In /sys/class/atm/ | ||
8 | these are directories named cxacruN where N is the device number. A symlink | ||
9 | named device points to the USB interface device's directory which contains | ||
10 | several sysfs attribute files for retrieving device statistics: | ||
11 | |||
12 | * adsl_controller_version | ||
13 | |||
14 | * adsl_headend | ||
15 | * adsl_headend_environment | ||
16 | Information about the remote headend. | ||
17 | |||
18 | * downstream_attenuation (dB) | ||
19 | * downstream_bits_per_frame | ||
20 | * downstream_rate (kbps) | ||
21 | * downstream_snr_margin (dB) | ||
22 | Downstream stats. | ||
23 | |||
24 | * upstream_attenuation (dB) | ||
25 | * upstream_bits_per_frame | ||
26 | * upstream_rate (kbps) | ||
27 | * upstream_snr_margin (dB) | ||
28 | * transmitter_power (dBm/Hz) | ||
29 | Upstream stats. | ||
30 | |||
31 | * downstream_crc_errors | ||
32 | * downstream_fec_errors | ||
33 | * downstream_hec_errors | ||
34 | * upstream_crc_errors | ||
35 | * upstream_fec_errors | ||
36 | * upstream_hec_errors | ||
37 | Error counts. | ||
38 | |||
39 | * line_startable | ||
40 | Indicates that ADSL support on the device | ||
41 | is/can be enabled, see adsl_start. | ||
42 | |||
43 | * line_status | ||
44 | "initialising" | ||
45 | "down" | ||
46 | "attempting to activate" | ||
47 | "training" | ||
48 | "channel analysis" | ||
49 | "exchange" | ||
50 | "waiting" | ||
51 | "up" | ||
52 | |||
53 | Changes between "down" and "attempting to activate" | ||
54 | if there is no signal. | ||
55 | |||
56 | * link_status | ||
57 | "not connected" | ||
58 | "connected" | ||
59 | "lost" | ||
60 | |||
61 | * mac_address | ||
62 | |||
63 | * modulation | ||
64 | "ANSI T1.413" | ||
65 | "ITU-T G.992.1 (G.DMT)" | ||
66 | "ITU-T G.992.2 (G.LITE)" | ||
67 | |||
68 | * startup_attempts | ||
69 | Count of total attempts to initialise ADSL. | ||
70 | |||
71 | To enable/disable ADSL, the following can be written to the adsl_state file: | ||
72 | "start" | ||
73 | "stop | ||
74 | "restart" (stops, waits 1.5s, then starts) | ||
75 | "poll" (used to resume status polling if it was disabled due to failure) | ||
76 | |||
77 | Changes in adsl/line state are reported via kernel log messages: | ||
78 | [4942145.150704] ATM dev 0: ADSL state: running | ||
79 | [4942243.663766] ATM dev 0: ADSL line: down | ||
80 | [4942249.665075] ATM dev 0: ADSL line: attempting to activate | ||
81 | [4942253.654954] ATM dev 0: ADSL line: training | ||
82 | [4942255.666387] ATM dev 0: ADSL line: channel analysis | ||
83 | [4942259.656262] ATM dev 0: ADSL line: exchange | ||
84 | [2635357.696901] ATM dev 0: ADSL line: up (8128 kb/s down | 832 kb/s up) | ||
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt index af6a63ab9026..32c2e9da5f3a 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt | |||
@@ -433,6 +433,12 @@ tcp_workaround_signed_windows - BOOLEAN | |||
433 | not receive a window scaling option from them. | 433 | not receive a window scaling option from them. |
434 | Default: 0 | 434 | Default: 0 |
435 | 435 | ||
436 | tcp_dma_copybreak - INTEGER | ||
437 | Lower limit, in bytes, of the size of socket reads that will be | ||
438 | offloaded to a DMA copy engine, if one is present in the system | ||
439 | and CONFIG_NET_DMA is enabled. | ||
440 | Default: 4096 | ||
441 | |||
436 | CIPSOv4 Variables: | 442 | CIPSOv4 Variables: |
437 | 443 | ||
438 | cipso_cache_enable - BOOLEAN | 444 | cipso_cache_enable - BOOLEAN |
@@ -874,8 +880,7 @@ accept_redirects - BOOLEAN | |||
874 | accept_source_route - INTEGER | 880 | accept_source_route - INTEGER |
875 | Accept source routing (routing extension header). | 881 | Accept source routing (routing extension header). |
876 | 882 | ||
877 | > 0: Accept routing header. | 883 | >= 0: Accept only routing header type 2. |
878 | = 0: Accept only routing header type 2. | ||
879 | < 0: Do not accept routing header. | 884 | < 0: Do not accept routing header. |
880 | 885 | ||
881 | Default: 0 | 886 | Default: 0 |
diff --git a/Documentation/networking/l2tp.txt b/Documentation/networking/l2tp.txt new file mode 100644 index 000000000000..2451f551c505 --- /dev/null +++ b/Documentation/networking/l2tp.txt | |||
@@ -0,0 +1,169 @@ | |||
1 | This brief document describes how to use the kernel's PPPoL2TP driver | ||
2 | to provide L2TP functionality. L2TP is a protocol that tunnels one or | ||
3 | more PPP sessions over a UDP tunnel. It is commonly used for VPNs | ||
4 | (L2TP/IPSec) and by ISPs to tunnel subscriber PPP sessions over an IP | ||
5 | network infrastructure. | ||
6 | |||
7 | Design | ||
8 | ====== | ||
9 | |||
10 | The PPPoL2TP driver, drivers/net/pppol2tp.c, provides a mechanism by | ||
11 | which PPP frames carried through an L2TP session are passed through | ||
12 | the kernel's PPP subsystem. The standard PPP daemon, pppd, handles all | ||
13 | PPP interaction with the peer. PPP network interfaces are created for | ||
14 | each local PPP endpoint. | ||
15 | |||
16 | The L2TP protocol http://www.faqs.org/rfcs/rfc2661.html defines L2TP | ||
17 | control and data frames. L2TP control frames carry messages between | ||
18 | L2TP clients/servers and are used to setup / teardown tunnels and | ||
19 | sessions. An L2TP client or server is implemented in userspace and | ||
20 | will use a regular UDP socket per tunnel. L2TP data frames carry PPP | ||
21 | frames, which may be PPP control or PPP data. The kernel's PPP | ||
22 | subsystem arranges for PPP control frames to be delivered to pppd, | ||
23 | while data frames are forwarded as usual. | ||
24 | |||
25 | Each tunnel and session within a tunnel is assigned a unique tunnel_id | ||
26 | and session_id. These ids are carried in the L2TP header of every | ||
27 | control and data packet. The pppol2tp driver uses them to lookup | ||
28 | internal tunnel and/or session contexts. Zero tunnel / session ids are | ||
29 | treated specially - zero ids are never assigned to tunnels or sessions | ||
30 | in the network. In the driver, the tunnel context keeps a pointer to | ||
31 | the tunnel UDP socket. The session context keeps a pointer to the | ||
32 | PPPoL2TP socket, as well as other data that lets the driver interface | ||
33 | to the kernel PPP subsystem. | ||
34 | |||
35 | Note that the pppol2tp kernel driver handles only L2TP data frames; | ||
36 | L2TP control frames are simply passed up to userspace in the UDP | ||
37 | tunnel socket. The kernel handles all datapath aspects of the | ||
38 | protocol, including data packet resequencing (if enabled). | ||
39 | |||
40 | There are a number of requirements on the userspace L2TP daemon in | ||
41 | order to use the pppol2tp driver. | ||
42 | |||
43 | 1. Use a UDP socket per tunnel. | ||
44 | |||
45 | 2. Create a single PPPoL2TP socket per tunnel bound to a special null | ||
46 | session id. This is used only for communicating with the driver but | ||
47 | must remain open while the tunnel is active. Opening this tunnel | ||
48 | management socket causes the driver to mark the tunnel socket as an | ||
49 | L2TP UDP encapsulation socket and flags it for use by the | ||
50 | referenced tunnel id. This hooks up the UDP receive path via | ||
51 | udp_encap_rcv() in net/ipv4/udp.c. PPP data frames are never passed | ||
52 | in this special PPPoX socket. | ||
53 | |||
54 | 3. Create a PPPoL2TP socket per L2TP session. This is typically done | ||
55 | by starting pppd with the pppol2tp plugin and appropriate | ||
56 | arguments. A PPPoL2TP tunnel management socket (Step 2) must be | ||
57 | created before the first PPPoL2TP session socket is created. | ||
58 | |||
59 | When creating PPPoL2TP sockets, the application provides information | ||
60 | to the driver about the socket in a socket connect() call. Source and | ||
61 | destination tunnel and session ids are provided, as well as the file | ||
62 | descriptor of a UDP socket. See struct pppol2tp_addr in | ||
63 | include/linux/if_ppp.h. Note that zero tunnel / session ids are | ||
64 | treated specially. When creating the per-tunnel PPPoL2TP management | ||
65 | socket in Step 2 above, zero source and destination session ids are | ||
66 | specified, which tells the driver to prepare the supplied UDP file | ||
67 | descriptor for use as an L2TP tunnel socket. | ||
68 | |||
69 | Userspace may control behavior of the tunnel or session using | ||
70 | setsockopt and ioctl on the PPPoX socket. The following socket | ||
71 | options are supported:- | ||
72 | |||
73 | DEBUG - bitmask of debug message categories. See below. | ||
74 | SENDSEQ - 0 => don't send packets with sequence numbers | ||
75 | 1 => send packets with sequence numbers | ||
76 | RECVSEQ - 0 => receive packet sequence numbers are optional | ||
77 | 1 => drop receive packets without sequence numbers | ||
78 | LNSMODE - 0 => act as LAC. | ||
79 | 1 => act as LNS. | ||
80 | REORDERTO - reorder timeout (in millisecs). If 0, don't try to reorder. | ||
81 | |||
82 | Only the DEBUG option is supported by the special tunnel management | ||
83 | PPPoX socket. | ||
84 | |||
85 | In addition to the standard PPP ioctls, a PPPIOCGL2TPSTATS is provided | ||
86 | to retrieve tunnel and session statistics from the kernel using the | ||
87 | PPPoX socket of the appropriate tunnel or session. | ||
88 | |||
89 | Debugging | ||
90 | ========= | ||
91 | |||
92 | The driver supports a flexible debug scheme where kernel trace | ||
93 | messages may be optionally enabled per tunnel and per session. Care is | ||
94 | needed when debugging a live system since the messages are not | ||
95 | rate-limited and a busy system could be swamped. Userspace uses | ||
96 | setsockopt on the PPPoX socket to set a debug mask. | ||
97 | |||
98 | The following debug mask bits are available: | ||
99 | |||
100 | PPPOL2TP_MSG_DEBUG verbose debug (if compiled in) | ||
101 | PPPOL2TP_MSG_CONTROL userspace - kernel interface | ||
102 | PPPOL2TP_MSG_SEQ sequence numbers handling | ||
103 | PPPOL2TP_MSG_DATA data packets | ||
104 | |||
105 | Sample Userspace Code | ||
106 | ===================== | ||
107 | |||
108 | 1. Create tunnel management PPPoX socket | ||
109 | |||
110 | kernel_fd = socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OL2TP); | ||
111 | if (kernel_fd >= 0) { | ||
112 | struct sockaddr_pppol2tp sax; | ||
113 | struct sockaddr_in const *peer_addr; | ||
114 | |||
115 | peer_addr = l2tp_tunnel_get_peer_addr(tunnel); | ||
116 | memset(&sax, 0, sizeof(sax)); | ||
117 | sax.sa_family = AF_PPPOX; | ||
118 | sax.sa_protocol = PX_PROTO_OL2TP; | ||
119 | sax.pppol2tp.fd = udp_fd; /* fd of tunnel UDP socket */ | ||
120 | sax.pppol2tp.addr.sin_addr.s_addr = peer_addr->sin_addr.s_addr; | ||
121 | sax.pppol2tp.addr.sin_port = peer_addr->sin_port; | ||
122 | sax.pppol2tp.addr.sin_family = AF_INET; | ||
123 | sax.pppol2tp.s_tunnel = tunnel_id; | ||
124 | sax.pppol2tp.s_session = 0; /* special case: mgmt socket */ | ||
125 | sax.pppol2tp.d_tunnel = 0; | ||
126 | sax.pppol2tp.d_session = 0; /* special case: mgmt socket */ | ||
127 | |||
128 | if(connect(kernel_fd, (struct sockaddr *)&sax, sizeof(sax) ) < 0 ) { | ||
129 | perror("connect failed"); | ||
130 | result = -errno; | ||
131 | goto err; | ||
132 | } | ||
133 | } | ||
134 | |||
135 | 2. Create session PPPoX data socket | ||
136 | |||
137 | struct sockaddr_pppol2tp sax; | ||
138 | int fd; | ||
139 | |||
140 | /* Note, the target socket must be bound already, else it will not be ready */ | ||
141 | sax.sa_family = AF_PPPOX; | ||
142 | sax.sa_protocol = PX_PROTO_OL2TP; | ||
143 | sax.pppol2tp.fd = tunnel_fd; | ||
144 | sax.pppol2tp.addr.sin_addr.s_addr = addr->sin_addr.s_addr; | ||
145 | sax.pppol2tp.addr.sin_port = addr->sin_port; | ||
146 | sax.pppol2tp.addr.sin_family = AF_INET; | ||
147 | sax.pppol2tp.s_tunnel = tunnel_id; | ||
148 | sax.pppol2tp.s_session = session_id; | ||
149 | sax.pppol2tp.d_tunnel = peer_tunnel_id; | ||
150 | sax.pppol2tp.d_session = peer_session_id; | ||
151 | |||
152 | /* session_fd is the fd of the session's PPPoL2TP socket. | ||
153 | * tunnel_fd is the fd of the tunnel UDP socket. | ||
154 | */ | ||
155 | fd = connect(session_fd, (struct sockaddr *)&sax, sizeof(sax)); | ||
156 | if (fd < 0 ) { | ||
157 | return -errno; | ||
158 | } | ||
159 | return 0; | ||
160 | |||
161 | Miscellanous | ||
162 | ============ | ||
163 | |||
164 | The PPPoL2TP driver was developed as part of the OpenL2TP project by | ||
165 | Katalix Systems Ltd. OpenL2TP is a full-featured L2TP client / server, | ||
166 | designed from the ground up to have the L2TP datapath in the | ||
167 | kernel. The project also implemented the pppol2tp plugin for pppd | ||
168 | which allows pppd to use the kernel driver. Details can be found at | ||
169 | http://openl2tp.sourceforge.net. | ||
diff --git a/Documentation/networking/mac80211-injection.txt b/Documentation/networking/mac80211-injection.txt new file mode 100644 index 000000000000..53ef7a06f49c --- /dev/null +++ b/Documentation/networking/mac80211-injection.txt | |||
@@ -0,0 +1,59 @@ | |||
1 | How to use packet injection with mac80211 | ||
2 | ========================================= | ||
3 | |||
4 | mac80211 now allows arbitrary packets to be injected down any Monitor Mode | ||
5 | interface from userland. The packet you inject needs to be composed in the | ||
6 | following format: | ||
7 | |||
8 | [ radiotap header ] | ||
9 | [ ieee80211 header ] | ||
10 | [ payload ] | ||
11 | |||
12 | The radiotap format is discussed in | ||
13 | ./Documentation/networking/radiotap-headers.txt. | ||
14 | |||
15 | Despite 13 radiotap argument types are currently defined, most only make sense | ||
16 | to appear on received packets. Currently three kinds of argument are used by | ||
17 | the injection code, although it knows to skip any other arguments that are | ||
18 | present (facilitating replay of captured radiotap headers directly): | ||
19 | |||
20 | - IEEE80211_RADIOTAP_RATE - u8 arg in 500kbps units (0x02 --> 1Mbps) | ||
21 | |||
22 | - IEEE80211_RADIOTAP_ANTENNA - u8 arg, 0x00 = ant1, 0x01 = ant2 | ||
23 | |||
24 | - IEEE80211_RADIOTAP_DBM_TX_POWER - u8 arg, dBm | ||
25 | |||
26 | Here is an example valid radiotap header defining these three parameters | ||
27 | |||
28 | 0x00, 0x00, // <-- radiotap version | ||
29 | 0x0b, 0x00, // <- radiotap header length | ||
30 | 0x04, 0x0c, 0x00, 0x00, // <-- bitmap | ||
31 | 0x6c, // <-- rate | ||
32 | 0x0c, //<-- tx power | ||
33 | 0x01 //<-- antenna | ||
34 | |||
35 | The ieee80211 header follows immediately afterwards, looking for example like | ||
36 | this: | ||
37 | |||
38 | 0x08, 0x01, 0x00, 0x00, | ||
39 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | ||
40 | 0x13, 0x22, 0x33, 0x44, 0x55, 0x66, | ||
41 | 0x13, 0x22, 0x33, 0x44, 0x55, 0x66, | ||
42 | 0x10, 0x86 | ||
43 | |||
44 | Then lastly there is the payload. | ||
45 | |||
46 | After composing the packet contents, it is sent by send()-ing it to a logical | ||
47 | mac80211 interface that is in Monitor mode. Libpcap can also be used, | ||
48 | (which is easier than doing the work to bind the socket to the right | ||
49 | interface), along the following lines: | ||
50 | |||
51 | ppcap = pcap_open_live(szInterfaceName, 800, 1, 20, szErrbuf); | ||
52 | ... | ||
53 | r = pcap_inject(ppcap, u8aSendBuffer, nLength); | ||
54 | |||
55 | You can also find sources for a complete inject test applet here: | ||
56 | |||
57 | http://penumbra.warmcat.com/_twk/tiki-index.php?page=packetspammer | ||
58 | |||
59 | Andy Green <andy@warmcat.com> | ||
diff --git a/Documentation/networking/multiqueue.txt b/Documentation/networking/multiqueue.txt new file mode 100644 index 000000000000..00b60cce2224 --- /dev/null +++ b/Documentation/networking/multiqueue.txt | |||
@@ -0,0 +1,111 @@ | |||
1 | |||
2 | HOWTO for multiqueue network device support | ||
3 | =========================================== | ||
4 | |||
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 | |||
10 | Intro: Kernel support for multiqueue devices | ||
11 | --------------------------------------------------------- | ||
12 | |||
13 | Kernel support for multiqueue devices is only an API that is presented to the | ||
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 | |||
20 | Section 1: Base driver requirements for implementing multiqueue support | ||
21 | ----------------------------------------------------------------------- | ||
22 | |||
23 | Base drivers are required to use the new alloc_etherdev_mq() or | ||
24 | alloc_netdev_mq() functions to allocate the subqueues for the device. The | ||
25 | underlying kernel API will take care of the allocation and deallocation of | ||
26 | the subqueue memory, as well as netdev configuration of where the queues | ||
27 | exist in memory. | ||
28 | |||
29 | The base driver will also need to manage the queues as it does the global | ||
30 | netdev->queue_lock today. Therefore base drivers should use the | ||
31 | 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 | ||
33 | comes online or when it's completely shut down (unregister_netdev(), etc.). | ||
34 | |||
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 | |||
47 | Section 2: Qdisc support for multiqueue devices | ||
48 | ----------------------------------------------- | ||
49 | |||
50 | Currently two qdiscs support multiqueue devices. A new round-robin qdisc, | ||
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 | |||
56 | sch_rr has been added for hardware that doesn't want scheduling policies from | ||
57 | software, so it's a straight round-robin qdisc. It uses the same syntax and | ||
58 | classification priomap that sch_prio uses, so it should be intuitive to | ||
59 | configure for people who've used sch_prio. | ||
60 | |||
61 | The PRIO qdisc naturally plugs into a multiqueue device. If PRIO has been | ||
62 | built with NET_SCH_PRIO_MQ, then upon load, it will make sure the number of | ||
63 | bands requested is equal to the number of queues on the hardware. If they | ||
64 | are equal, it sets a one-to-one mapping up between the queues and bands. If | ||
65 | they're not equal, it will not load the qdisc. This is the same behavior | ||
66 | for RR. Once the association is made, any skb that is classified will have | ||
67 | skb->queue_mapping set, which will allow the driver to properly queue skb's | ||
68 | to multiple queues. | ||
69 | |||
70 | |||
71 | Section 3: Brief howto using PRIO and RR for multiqueue devices | ||
72 | --------------------------------------------------------------- | ||
73 | |||
74 | The userspace command 'tc,' part of the iproute2 package, is used to configure | ||
75 | qdiscs. To add the PRIO qdisc to your network device, assuming the device is | ||
76 | called eth0, run the following command: | ||
77 | |||
78 | # tc qdisc add dev eth0 root handle 1: prio bands 4 multiqueue | ||
79 | |||
80 | This will create 4 bands, 0 being highest priority, and associate those bands | ||
81 | to the queues on your NIC. Assuming eth0 has 4 Tx queues, the band mapping | ||
82 | would look like: | ||
83 | |||
84 | band 0 => queue 0 | ||
85 | band 1 => queue 1 | ||
86 | band 2 => queue 2 | ||
87 | band 3 => queue 3 | ||
88 | |||
89 | Traffic will begin flowing through each queue if your TOS values are assigning | ||
90 | traffic across the various bands. For example, ssh traffic will always try to | ||
91 | go out band 0 based on TOS -> Linux priority conversion (realtime traffic), | ||
92 | so it will be sent out queue 0. ICMP traffic (pings) fall into the "normal" | ||
93 | traffic classification, which is band 1. Therefore pings will be send out | ||
94 | queue 1 on the NIC. | ||
95 | |||
96 | Note the use of the multiqueue keyword. This is only in versions of iproute2 | ||
97 | that support multiqueue networking devices; if this is omitted when loading | ||
98 | a qdisc onto a multiqueue device, the qdisc will load and operate the same | ||
99 | if it were loaded onto a single-queue device (i.e. - sends all traffic to | ||
100 | queue 0). | ||
101 | |||
102 | Another alternative to multiqueue band allocation can be done by using the | ||
103 | multiqueue option and specify 0 bands. If this is the case, the qdisc will | ||
104 | allocate the number of bands to equal the number of queues that the device | ||
105 | reports, and bring the qdisc online. | ||
106 | |||
107 | The behavior of tc filters remains the same, where it will override TOS priority | ||
108 | classification. | ||
109 | |||
110 | |||
111 | Author: Peter P. Waskiewicz Jr. <peter.p.waskiewicz.jr@intel.com> | ||
diff --git a/Documentation/networking/net-modules.txt b/Documentation/networking/net-modules.txt index 0b27863f155c..98c4392dd0fd 100644 --- a/Documentation/networking/net-modules.txt +++ b/Documentation/networking/net-modules.txt | |||
@@ -146,12 +146,6 @@ at1700.c: | |||
146 | irq = 0 | 146 | irq = 0 |
147 | (Probes ports: 0x260, 0x280, 0x2A0, 0x240, 0x340, 0x320, 0x380, 0x300) | 147 | (Probes ports: 0x260, 0x280, 0x2A0, 0x240, 0x340, 0x320, 0x380, 0x300) |
148 | 148 | ||
149 | atari_bionet.c: | ||
150 | Supports full autoprobing. (m68k/Atari) | ||
151 | |||
152 | atari_pamsnet.c: | ||
153 | Supports full autoprobing. (m68k/Atari) | ||
154 | |||
155 | atarilance.c: | 149 | atarilance.c: |
156 | Supports full autoprobing. (m68k/Atari) | 150 | Supports full autoprobing. (m68k/Atari) |
157 | 151 | ||
diff --git a/Documentation/networking/netdevices.txt b/Documentation/networking/netdevices.txt index ce1361f95243..37869295fc70 100644 --- a/Documentation/networking/netdevices.txt +++ b/Documentation/networking/netdevices.txt | |||
@@ -20,6 +20,30 @@ private data which gets freed when the network device is freed. If | |||
20 | separately allocated data is attached to the network device | 20 | separately allocated data is attached to the network device |
21 | (dev->priv) then it is up to the module exit handler to free that. | 21 | (dev->priv) then it is up to the module exit handler to free that. |
22 | 22 | ||
23 | MTU | ||
24 | === | ||
25 | Each network device has a Maximum Transfer Unit. The MTU does not | ||
26 | include any link layer protocol overhead. Upper layer protocols must | ||
27 | not pass a socket buffer (skb) to a device to transmit with more data | ||
28 | than the mtu. The MTU does not include link layer header overhead, so | ||
29 | for example on Ethernet if the standard MTU is 1500 bytes used, the | ||
30 | actual skb will contain up to 1514 bytes because of the Ethernet | ||
31 | header. Devices should allow for the 4 byte VLAN header as well. | ||
32 | |||
33 | Segmentation Offload (GSO, TSO) is an exception to this rule. The | ||
34 | upper layer protocol may pass a large socket buffer to the device | ||
35 | transmit routine, and the device will break that up into separate | ||
36 | packets based on the current MTU. | ||
37 | |||
38 | MTU is symmetrical and applies both to receive and transmit. A device | ||
39 | must be able to receive at least the maximum size packet allowed by | ||
40 | the MTU. A network device may use the MTU as mechanism to size receive | ||
41 | buffers, but the device should allow packets with VLAN header. With | ||
42 | standard Ethernet mtu of 1500 bytes, the device should allow up to | ||
43 | 1518 byte packets (1500 + 14 header + 4 tag). The device may either: | ||
44 | drop, truncate, or pass up oversize packets, but dropping oversize | ||
45 | packets is preferred. | ||
46 | |||
23 | 47 | ||
24 | struct net_device synchronization rules | 48 | struct net_device synchronization rules |
25 | ======================================= | 49 | ======================================= |
@@ -43,16 +67,17 @@ dev->get_stats: | |||
43 | 67 | ||
44 | dev->hard_start_xmit: | 68 | dev->hard_start_xmit: |
45 | Synchronization: netif_tx_lock spinlock. | 69 | Synchronization: netif_tx_lock spinlock. |
70 | |||
46 | When the driver sets NETIF_F_LLTX in dev->features this will be | 71 | When the driver sets NETIF_F_LLTX in dev->features this will be |
47 | called without holding netif_tx_lock. In this case the driver | 72 | called without holding netif_tx_lock. In this case the driver |
48 | has to lock by itself when needed. It is recommended to use a try lock | 73 | has to lock by itself when needed. It is recommended to use a try lock |
49 | for this and return -1 when the spin lock fails. | 74 | for this and return NETDEV_TX_LOCKED when the spin lock fails. |
50 | The locking there should also properly protect against | 75 | The locking there should also properly protect against |
51 | set_multicast_list | 76 | set_multicast_list. |
52 | Context: Process with BHs disabled or BH (timer). | 77 | |
53 | Notes: netif_queue_stopped() is guaranteed false | 78 | Context: Process with BHs disabled or BH (timer), |
54 | Interrupts must be enabled when calling hard_start_xmit. | 79 | will be called with interrupts disabled by netconsole. |
55 | (Interrupts must also be enabled when enabling the BH handler.) | 80 | |
56 | Return codes: | 81 | Return codes: |
57 | o NETDEV_TX_OK everything ok. | 82 | o NETDEV_TX_OK everything ok. |
58 | o NETDEV_TX_BUSY Cannot transmit packet, try later | 83 | o NETDEV_TX_BUSY Cannot transmit packet, try later |
@@ -74,4 +99,5 @@ dev->poll: | |||
74 | Synchronization: __LINK_STATE_RX_SCHED bit in dev->state. See | 99 | Synchronization: __LINK_STATE_RX_SCHED bit in dev->state. See |
75 | dev_close code and comments in net/core/dev.c for more info. | 100 | dev_close code and comments in net/core/dev.c for more info. |
76 | Context: softirq | 101 | Context: softirq |
102 | will be called with interrupts disabled by netconsole. | ||
77 | 103 | ||
diff --git a/Documentation/networking/radiotap-headers.txt b/Documentation/networking/radiotap-headers.txt new file mode 100644 index 000000000000..953331c7984f --- /dev/null +++ b/Documentation/networking/radiotap-headers.txt | |||
@@ -0,0 +1,152 @@ | |||
1 | How to use radiotap headers | ||
2 | =========================== | ||
3 | |||
4 | Pointer to the radiotap include file | ||
5 | ------------------------------------ | ||
6 | |||
7 | Radiotap headers are variable-length and extensible, you can get most of the | ||
8 | information you need to know on them from: | ||
9 | |||
10 | ./include/net/ieee80211_radiotap.h | ||
11 | |||
12 | This document gives an overview and warns on some corner cases. | ||
13 | |||
14 | |||
15 | Structure of the header | ||
16 | ----------------------- | ||
17 | |||
18 | There is a fixed portion at the start which contains a u32 bitmap that defines | ||
19 | if the possible argument associated with that bit is present or not. So if b0 | ||
20 | of the it_present member of ieee80211_radiotap_header is set, it means that | ||
21 | the header for argument index 0 (IEEE80211_RADIOTAP_TSFT) is present in the | ||
22 | argument area. | ||
23 | |||
24 | < 8-byte ieee80211_radiotap_header > | ||
25 | [ <possible argument bitmap extensions ... > ] | ||
26 | [ <argument> ... ] | ||
27 | |||
28 | At the moment there are only 13 possible argument indexes defined, but in case | ||
29 | we run out of space in the u32 it_present member, it is defined that b31 set | ||
30 | indicates that there is another u32 bitmap following (shown as "possible | ||
31 | argument bitmap extensions..." above), and the start of the arguments is moved | ||
32 | forward 4 bytes each time. | ||
33 | |||
34 | Note also that the it_len member __le16 is set to the total number of bytes | ||
35 | covered by the ieee80211_radiotap_header and any arguments following. | ||
36 | |||
37 | |||
38 | Requirements for arguments | ||
39 | -------------------------- | ||
40 | |||
41 | After the fixed part of the header, the arguments follow for each argument | ||
42 | index whose matching bit is set in the it_present member of | ||
43 | ieee80211_radiotap_header. | ||
44 | |||
45 | - the arguments are all stored little-endian! | ||
46 | |||
47 | - the argument payload for a given argument index has a fixed size. So | ||
48 | IEEE80211_RADIOTAP_TSFT being present always indicates an 8-byte argument is | ||
49 | present. See the comments in ./include/net/ieee80211_radiotap.h for a nice | ||
50 | breakdown of all the argument sizes | ||
51 | |||
52 | - the arguments must be aligned to a boundary of the argument size using | ||
53 | padding. So a u16 argument must start on the next u16 boundary if it isn't | ||
54 | already on one, a u32 must start on the next u32 boundary and so on. | ||
55 | |||
56 | - "alignment" is relative to the start of the ieee80211_radiotap_header, ie, | ||
57 | the first byte of the radiotap header. The absolute alignment of that first | ||
58 | byte isn't defined. So even if the whole radiotap header is starting at, eg, | ||
59 | address 0x00000003, still the first byte of the radiotap header is treated as | ||
60 | 0 for alignment purposes. | ||
61 | |||
62 | - the above point that there may be no absolute alignment for multibyte | ||
63 | entities in the fixed radiotap header or the argument region means that you | ||
64 | have to take special evasive action when trying to access these multibyte | ||
65 | entities. Some arches like Blackfin cannot deal with an attempt to | ||
66 | dereference, eg, a u16 pointer that is pointing to an odd address. Instead | ||
67 | you have to use a kernel API get_unaligned() to dereference the pointer, | ||
68 | which will do it bytewise on the arches that require that. | ||
69 | |||
70 | - The arguments for a given argument index can be a compound of multiple types | ||
71 | together. For example IEEE80211_RADIOTAP_CHANNEL has an argument payload | ||
72 | consisting of two u16s of total length 4. When this happens, the padding | ||
73 | rule is applied dealing with a u16, NOT dealing with a 4-byte single entity. | ||
74 | |||
75 | |||
76 | Example valid radiotap header | ||
77 | ----------------------------- | ||
78 | |||
79 | 0x00, 0x00, // <-- radiotap version + pad byte | ||
80 | 0x0b, 0x00, // <- radiotap header length | ||
81 | 0x04, 0x0c, 0x00, 0x00, // <-- bitmap | ||
82 | 0x6c, // <-- rate (in 500kHz units) | ||
83 | 0x0c, //<-- tx power | ||
84 | 0x01 //<-- antenna | ||
85 | |||
86 | |||
87 | Using the Radiotap Parser | ||
88 | ------------------------- | ||
89 | |||
90 | If you are having to parse a radiotap struct, you can radically simplify the | ||
91 | job by using the radiotap parser that lives in net/wireless/radiotap.c and has | ||
92 | its prototypes available in include/net/cfg80211.h. You use it like this: | ||
93 | |||
94 | #include <net/cfg80211.h> | ||
95 | |||
96 | /* buf points to the start of the radiotap header part */ | ||
97 | |||
98 | int MyFunction(u8 * buf, int buflen) | ||
99 | { | ||
100 | int pkt_rate_100kHz = 0, antenna = 0, pwr = 0; | ||
101 | struct ieee80211_radiotap_iterator iterator; | ||
102 | int ret = ieee80211_radiotap_iterator_init(&iterator, buf, buflen); | ||
103 | |||
104 | while (!ret) { | ||
105 | |||
106 | ret = ieee80211_radiotap_iterator_next(&iterator); | ||
107 | |||
108 | if (ret) | ||
109 | continue; | ||
110 | |||
111 | /* see if this argument is something we can use */ | ||
112 | |||
113 | switch (iterator.this_arg_index) { | ||
114 | /* | ||
115 | * You must take care when dereferencing iterator.this_arg | ||
116 | * for multibyte types... the pointer is not aligned. Use | ||
117 | * get_unaligned((type *)iterator.this_arg) to dereference | ||
118 | * iterator.this_arg for type "type" safely on all arches. | ||
119 | */ | ||
120 | case IEEE80211_RADIOTAP_RATE: | ||
121 | /* radiotap "rate" u8 is in | ||
122 | * 500kbps units, eg, 0x02=1Mbps | ||
123 | */ | ||
124 | pkt_rate_100kHz = (*iterator.this_arg) * 5; | ||
125 | break; | ||
126 | |||
127 | case IEEE80211_RADIOTAP_ANTENNA: | ||
128 | /* radiotap uses 0 for 1st ant */ | ||
129 | antenna = *iterator.this_arg); | ||
130 | break; | ||
131 | |||
132 | case IEEE80211_RADIOTAP_DBM_TX_POWER: | ||
133 | pwr = *iterator.this_arg; | ||
134 | break; | ||
135 | |||
136 | default: | ||
137 | break; | ||
138 | } | ||
139 | } /* while more rt headers */ | ||
140 | |||
141 | if (ret != -ENOENT) | ||
142 | return TXRX_DROP; | ||
143 | |||
144 | /* discard the radiotap header part */ | ||
145 | buf += iterator.max_length; | ||
146 | buflen -= iterator.max_length; | ||
147 | |||
148 | ... | ||
149 | |||
150 | } | ||
151 | |||
152 | Andy Green <andy@warmcat.com> | ||
diff --git a/Documentation/networking/sk98lin.txt b/Documentation/networking/sk98lin.txt deleted file mode 100644 index 8590a954df1d..000000000000 --- a/Documentation/networking/sk98lin.txt +++ /dev/null | |||
@@ -1,568 +0,0 @@ | |||
1 | (C)Copyright 1999-2004 Marvell(R). | ||
2 | All rights reserved | ||
3 | =========================================================================== | ||
4 | |||
5 | sk98lin.txt created 13-Feb-2004 | ||
6 | |||
7 | Readme File for sk98lin v6.23 | ||
8 | Marvell Yukon/SysKonnect SK-98xx Gigabit Ethernet Adapter family driver for LINUX | ||
9 | |||
10 | This file contains | ||
11 | 1 Overview | ||
12 | 2 Required Files | ||
13 | 3 Installation | ||
14 | 3.1 Driver Installation | ||
15 | 3.2 Inclusion of adapter at system start | ||
16 | 4 Driver Parameters | ||
17 | 4.1 Per-Port Parameters | ||
18 | 4.2 Adapter Parameters | ||
19 | 5 Large Frame Support | ||
20 | 6 VLAN and Link Aggregation Support (IEEE 802.1, 802.1q, 802.3ad) | ||
21 | 7 Troubleshooting | ||
22 | |||
23 | =========================================================================== | ||
24 | |||
25 | |||
26 | 1 Overview | ||
27 | =========== | ||
28 | |||
29 | The sk98lin driver supports the Marvell Yukon and SysKonnect | ||
30 | SK-98xx/SK-95xx compliant Gigabit Ethernet Adapter on Linux. It has | ||
31 | been tested with Linux on Intel/x86 machines. | ||
32 | *** | ||
33 | |||
34 | |||
35 | 2 Required Files | ||
36 | ================= | ||
37 | |||
38 | The linux kernel source. | ||
39 | No additional files required. | ||
40 | *** | ||
41 | |||
42 | |||
43 | 3 Installation | ||
44 | =============== | ||
45 | |||
46 | It is recommended to download the latest version of the driver from the | ||
47 | SysKonnect web site www.syskonnect.com. If you have downloaded the latest | ||
48 | driver, the Linux kernel has to be patched before the driver can be | ||
49 | installed. For details on how to patch a Linux kernel, refer to the | ||
50 | patch.txt file. | ||
51 | |||
52 | 3.1 Driver Installation | ||
53 | ------------------------ | ||
54 | |||
55 | The following steps describe the actions that are required to install | ||
56 | the driver and to start it manually. These steps should be carried | ||
57 | out for the initial driver setup. Once confirmed to be ok, they can | ||
58 | be included in the system start. | ||
59 | |||
60 | NOTE 1: To perform the following tasks you need 'root' access. | ||
61 | |||
62 | NOTE 2: In case of problems, please read the section "Troubleshooting" | ||
63 | below. | ||
64 | |||
65 | The driver can either be integrated into the kernel or it can be compiled | ||
66 | as a module. Select the appropriate option during the kernel | ||
67 | configuration. | ||
68 | |||
69 | Compile/use the driver as a module | ||
70 | ---------------------------------- | ||
71 | To compile the driver, go to the directory /usr/src/linux and | ||
72 | execute the command "make menuconfig" or "make xconfig" and proceed as | ||
73 | follows: | ||
74 | |||
75 | To integrate the driver permanently into the kernel, proceed as follows: | ||
76 | |||
77 | 1. Select the menu "Network device support" and then "Ethernet(1000Mbit)" | ||
78 | 2. Mark "Marvell Yukon Chipset / SysKonnect SK-98xx family support" | ||
79 | with (*) | ||
80 | 3. Build a new kernel when the configuration of the above options is | ||
81 | finished. | ||
82 | 4. Install the new kernel. | ||
83 | 5. Reboot your system. | ||
84 | |||
85 | To use the driver as a module, proceed as follows: | ||
86 | |||
87 | 1. Enable 'loadable module support' in the kernel. | ||
88 | 2. For automatic driver start, enable the 'Kernel module loader'. | ||
89 | 3. Select the menu "Network device support" and then "Ethernet(1000Mbit)" | ||
90 | 4. Mark "Marvell Yukon Chipset / SysKonnect SK-98xx family support" | ||
91 | with (M) | ||
92 | 5. Execute the command "make modules". | ||
93 | 6. Execute the command "make modules_install". | ||
94 | The appropriate modules will be installed. | ||
95 | 7. Reboot your system. | ||
96 | |||
97 | |||
98 | Load the module manually | ||
99 | ------------------------ | ||
100 | To load the module manually, proceed as follows: | ||
101 | |||
102 | 1. Enter "modprobe sk98lin". | ||
103 | 2. If a Marvell Yukon or SysKonnect SK-98xx adapter is installed in | ||
104 | your computer and you have a /proc file system, execute the command: | ||
105 | "ls /proc/net/sk98lin/" | ||
106 | This should produce an output containing a line with the following | ||
107 | format: | ||
108 | eth0 eth1 ... | ||
109 | which indicates that your adapter has been found and initialized. | ||
110 | |||
111 | NOTE 1: If you have more than one Marvell Yukon or SysKonnect SK-98xx | ||
112 | adapter installed, the adapters will be listed as 'eth0', | ||
113 | 'eth1', 'eth2', etc. | ||
114 | For each adapter, repeat steps 3 and 4 below. | ||
115 | |||
116 | NOTE 2: If you have other Ethernet adapters installed, your Marvell | ||
117 | Yukon or SysKonnect SK-98xx adapter will be mapped to the | ||
118 | next available number, e.g. 'eth1'. The mapping is executed | ||
119 | automatically. | ||
120 | The module installation message (displayed either in a system | ||
121 | log file or on the console) prints a line for each adapter | ||
122 | found containing the corresponding 'ethX'. | ||
123 | |||
124 | 3. Select an IP address and assign it to the respective adapter by | ||
125 | entering: | ||
126 | ifconfig eth0 <ip-address> | ||
127 | With this command, the adapter is connected to the Ethernet. | ||
128 | |||
129 | SK-98xx Gigabit Ethernet Server Adapters: The yellow LED on the adapter | ||
130 | is now active, the link status LED of the primary port is active and | ||
131 | the link status LED of the secondary port (on dual port adapters) is | ||
132 | blinking (if the ports are connected to a switch or hub). | ||
133 | SK-98xx V2.0 Gigabit Ethernet Adapters: The link status LED is active. | ||
134 | In addition, you will receive a status message on the console stating | ||
135 | "ethX: network connection up using port Y" and showing the selected | ||
136 | connection parameters (x stands for the ethernet device number | ||
137 | (0,1,2, etc), y stands for the port name (A or B)). | ||
138 | |||
139 | NOTE: If you are in doubt about IP addresses, ask your network | ||
140 | administrator for assistance. | ||
141 | |||
142 | 4. Your adapter should now be fully operational. | ||
143 | Use 'ping <otherstation>' to verify the connection to other computers | ||
144 | on your network. | ||
145 | 5. To check the adapter configuration view /proc/net/sk98lin/[devicename]. | ||
146 | For example by executing: | ||
147 | "cat /proc/net/sk98lin/eth0" | ||
148 | |||
149 | Unload the module | ||
150 | ----------------- | ||
151 | To stop and unload the driver modules, proceed as follows: | ||
152 | |||
153 | 1. Execute the command "ifconfig eth0 down". | ||
154 | 2. Execute the command "rmmod sk98lin". | ||
155 | |||
156 | 3.2 Inclusion of adapter at system start | ||
157 | ----------------------------------------- | ||
158 | |||
159 | Since a large number of different Linux distributions are | ||
160 | available, we are unable to describe a general installation procedure | ||
161 | for the driver module. | ||
162 | Because the driver is now integrated in the kernel, installation should | ||
163 | be easy, using the standard mechanism of your distribution. | ||
164 | Refer to the distribution's manual for installation of ethernet adapters. | ||
165 | |||
166 | *** | ||
167 | |||
168 | 4 Driver Parameters | ||
169 | ==================== | ||
170 | |||
171 | Parameters can be set at the command line after the module has been | ||
172 | loaded with the command 'modprobe'. | ||
173 | In some distributions, the configuration tools are able to pass parameters | ||
174 | to the driver module. | ||
175 | |||
176 | If you use the kernel module loader, you can set driver parameters | ||
177 | in the file /etc/modprobe.conf (or /etc/modules.conf in 2.4 or earlier). | ||
178 | To set the driver parameters in this file, proceed as follows: | ||
179 | |||
180 | 1. Insert a line of the form : | ||
181 | options sk98lin ... | ||
182 | For "...", the same syntax is required as described for the command | ||
183 | line parameters of modprobe below. | ||
184 | 2. To activate the new parameters, either reboot your computer | ||
185 | or | ||
186 | unload and reload the driver. | ||
187 | The syntax of the driver parameters is: | ||
188 | |||
189 | modprobe sk98lin parameter=value1[,value2[,value3...]] | ||
190 | |||
191 | where value1 refers to the first adapter, value2 to the second etc. | ||
192 | |||
193 | NOTE: All parameters are case sensitive. Write them exactly as shown | ||
194 | below. | ||
195 | |||
196 | Example: | ||
197 | Suppose you have two adapters. You want to set auto-negotiation | ||
198 | on the first adapter to ON and on the second adapter to OFF. | ||
199 | You also want to set DuplexCapabilities on the first adapter | ||
200 | to FULL, and on the second adapter to HALF. | ||
201 | Then, you must enter: | ||
202 | |||
203 | modprobe sk98lin AutoNeg_A=On,Off DupCap_A=Full,Half | ||
204 | |||
205 | NOTE: The number of adapters that can be configured this way is | ||
206 | limited in the driver (file skge.c, constant SK_MAX_CARD_PARAM). | ||
207 | The current limit is 16. If you happen to install | ||
208 | more adapters, adjust this and recompile. | ||
209 | |||
210 | |||
211 | 4.1 Per-Port Parameters | ||
212 | ------------------------ | ||
213 | |||
214 | These settings are available for each port on the adapter. | ||
215 | In the following description, '?' stands for the port for | ||
216 | which you set the parameter (A or B). | ||
217 | |||
218 | Speed | ||
219 | ----- | ||
220 | Parameter: Speed_? | ||
221 | Values: 10, 100, 1000, Auto | ||
222 | Default: Auto | ||
223 | |||
224 | This parameter is used to set the speed capabilities. It is only valid | ||
225 | for the SK-98xx V2.0 copper adapters. | ||
226 | Usually, the speed is negotiated between the two ports during link | ||
227 | establishment. If this fails, a port can be forced to a specific setting | ||
228 | with this parameter. | ||
229 | |||
230 | Auto-Negotiation | ||
231 | ---------------- | ||
232 | Parameter: AutoNeg_? | ||
233 | Values: On, Off, Sense | ||
234 | Default: On | ||
235 | |||
236 | The "Sense"-mode automatically detects whether the link partner supports | ||
237 | auto-negotiation or not. | ||
238 | |||
239 | Duplex Capabilities | ||
240 | ------------------- | ||
241 | Parameter: DupCap_? | ||
242 | Values: Half, Full, Both | ||
243 | Default: Both | ||
244 | |||
245 | This parameters is only relevant if auto-negotiation for this port is | ||
246 | not set to "Sense". If auto-negotiation is set to "On", all three values | ||
247 | are possible. If it is set to "Off", only "Full" and "Half" are allowed. | ||
248 | This parameter is useful if your link partner does not support all | ||
249 | possible combinations. | ||
250 | |||
251 | Flow Control | ||
252 | ------------ | ||
253 | Parameter: FlowCtrl_? | ||
254 | Values: Sym, SymOrRem, LocSend, None | ||
255 | Default: SymOrRem | ||
256 | |||
257 | This parameter can be used to set the flow control capabilities the | ||
258 | port reports during auto-negotiation. It can be set for each port | ||
259 | individually. | ||
260 | Possible modes: | ||
261 | -- Sym = Symmetric: both link partners are allowed to send | ||
262 | PAUSE frames | ||
263 | -- SymOrRem = SymmetricOrRemote: both or only remote partner | ||
264 | are allowed to send PAUSE frames | ||
265 | -- LocSend = LocalSend: only local link partner is allowed | ||
266 | to send PAUSE frames | ||
267 | -- None = no link partner is allowed to send PAUSE frames | ||
268 | |||
269 | NOTE: This parameter is ignored if auto-negotiation is set to "Off". | ||
270 | |||
271 | Role in Master-Slave-Negotiation (1000Base-T only) | ||
272 | -------------------------------------------------- | ||
273 | Parameter: Role_? | ||
274 | Values: Auto, Master, Slave | ||
275 | Default: Auto | ||
276 | |||
277 | This parameter is only valid for the SK-9821 and SK-9822 adapters. | ||
278 | For two 1000Base-T ports to communicate, one must take the role of the | ||
279 | master (providing timing information), while the other must be the | ||
280 | slave. Usually, this is negotiated between the two ports during link | ||
281 | establishment. If this fails, a port can be forced to a specific setting | ||
282 | with this parameter. | ||
283 | |||
284 | |||
285 | 4.2 Adapter Parameters | ||
286 | ----------------------- | ||
287 | |||
288 | Connection Type (SK-98xx V2.0 copper adapters only) | ||
289 | --------------- | ||
290 | Parameter: ConType | ||
291 | Values: Auto, 100FD, 100HD, 10FD, 10HD | ||
292 | Default: Auto | ||
293 | |||
294 | The parameter 'ConType' is a combination of all five per-port parameters | ||
295 | within one single parameter. This simplifies the configuration of both ports | ||
296 | of an adapter card! The different values of this variable reflect the most | ||
297 | meaningful combinations of port parameters. | ||
298 | |||
299 | The following table shows the values of 'ConType' and the corresponding | ||
300 | combinations of the per-port parameters: | ||
301 | |||
302 | ConType | DupCap AutoNeg FlowCtrl Role Speed | ||
303 | ----------+------------------------------------------------------ | ||
304 | Auto | Both On SymOrRem Auto Auto | ||
305 | 100FD | Full Off None Auto (ignored) 100 | ||
306 | 100HD | Half Off None Auto (ignored) 100 | ||
307 | 10FD | Full Off None Auto (ignored) 10 | ||
308 | 10HD | Half Off None Auto (ignored) 10 | ||
309 | |||
310 | Stating any other port parameter together with this 'ConType' variable | ||
311 | will result in a merged configuration of those settings. This due to | ||
312 | the fact, that the per-port parameters (e.g. Speed_? ) have a higher | ||
313 | priority than the combined variable 'ConType'. | ||
314 | |||
315 | NOTE: This parameter is always used on both ports of the adapter card. | ||
316 | |||
317 | Interrupt Moderation | ||
318 | -------------------- | ||
319 | Parameter: Moderation | ||
320 | Values: None, Static, Dynamic | ||
321 | Default: None | ||
322 | |||
323 | Interrupt moderation is employed to limit the maximum number of interrupts | ||
324 | the driver has to serve. That is, one or more interrupts (which indicate any | ||
325 | transmit or receive packet to be processed) are queued until the driver | ||
326 | processes them. When queued interrupts are to be served, is determined by the | ||
327 | 'IntsPerSec' parameter, which is explained later below. | ||
328 | |||
329 | Possible modes: | ||
330 | |||
331 | -- None - No interrupt moderation is applied on the adapter card. | ||
332 | Therefore, each transmit or receive interrupt is served immediately | ||
333 | as soon as it appears on the interrupt line of the adapter card. | ||
334 | |||
335 | -- Static - Interrupt moderation is applied on the adapter card. | ||
336 | All transmit and receive interrupts are queued until a complete | ||
337 | moderation interval ends. If such a moderation interval ends, all | ||
338 | queued interrupts are processed in one big bunch without any delay. | ||
339 | The term 'static' reflects the fact, that interrupt moderation is | ||
340 | always enabled, regardless how much network load is currently | ||
341 | passing via a particular interface. In addition, the duration of | ||
342 | the moderation interval has a fixed length that never changes while | ||
343 | the driver is operational. | ||
344 | |||
345 | -- Dynamic - Interrupt moderation might be applied on the adapter card, | ||
346 | depending on the load of the system. If the driver detects that the | ||
347 | system load is too high, the driver tries to shield the system against | ||
348 | too much network load by enabling interrupt moderation. If - at a later | ||
349 | time - the CPU utilization decreases again (or if the network load is | ||
350 | negligible) the interrupt moderation will automatically be disabled. | ||
351 | |||
352 | Interrupt moderation should be used when the driver has to handle one or more | ||
353 | interfaces with a high network load, which - as a consequence - leads also to a | ||
354 | high CPU utilization. When moderation is applied in such high network load | ||
355 | situations, CPU load might be reduced by 20-30%. | ||
356 | |||
357 | NOTE: The drawback of using interrupt moderation is an increase of the round- | ||
358 | trip-time (RTT), due to the queueing and serving of interrupts at dedicated | ||
359 | moderation times. | ||
360 | |||
361 | Interrupts per second | ||
362 | --------------------- | ||
363 | Parameter: IntsPerSec | ||
364 | Values: 30...40000 (interrupts per second) | ||
365 | Default: 2000 | ||
366 | |||
367 | This parameter is only used if either static or dynamic interrupt moderation | ||
368 | is used on a network adapter card. Using this parameter if no moderation is | ||
369 | applied will lead to no action performed. | ||
370 | |||
371 | This parameter determines the length of any interrupt moderation interval. | ||
372 | Assuming that static interrupt moderation is to be used, an 'IntsPerSec' | ||
373 | parameter value of 2000 will lead to an interrupt moderation interval of | ||
374 | 500 microseconds. | ||
375 | |||
376 | NOTE: The duration of the moderation interval is to be chosen with care. | ||
377 | At first glance, selecting a very long duration (e.g. only 100 interrupts per | ||
378 | second) seems to be meaningful, but the increase of packet-processing delay | ||
379 | is tremendous. On the other hand, selecting a very short moderation time might | ||
380 | compensate the use of any moderation being applied. | ||
381 | |||
382 | |||
383 | Preferred Port | ||
384 | -------------- | ||
385 | Parameter: PrefPort | ||
386 | Values: A, B | ||
387 | Default: A | ||
388 | |||
389 | This is used to force the preferred port to A or B (on dual-port network | ||
390 | adapters). The preferred port is the one that is used if both are detected | ||
391 | as fully functional. | ||
392 | |||
393 | RLMT Mode (Redundant Link Management Technology) | ||
394 | ------------------------------------------------ | ||
395 | Parameter: RlmtMode | ||
396 | Values: CheckLinkState,CheckLocalPort, CheckSeg, DualNet | ||
397 | Default: CheckLinkState | ||
398 | |||
399 | RLMT monitors the status of the port. If the link of the active port | ||
400 | fails, RLMT switches immediately to the standby link. The virtual link is | ||
401 | maintained as long as at least one 'physical' link is up. | ||
402 | |||
403 | Possible modes: | ||
404 | |||
405 | -- CheckLinkState - Check link state only: RLMT uses the link state | ||
406 | reported by the adapter hardware for each individual port to | ||
407 | determine whether a port can be used for all network traffic or | ||
408 | not. | ||
409 | |||
410 | -- CheckLocalPort - In this mode, RLMT monitors the network path | ||
411 | between the two ports of an adapter by regularly exchanging packets | ||
412 | between them. This mode requires a network configuration in which | ||
413 | the two ports are able to "see" each other (i.e. there must not be | ||
414 | any router between the ports). | ||
415 | |||
416 | -- CheckSeg - Check local port and segmentation: This mode supports the | ||
417 | same functions as the CheckLocalPort mode and additionally checks | ||
418 | network segmentation between the ports. Therefore, this mode is only | ||
419 | to be used if Gigabit Ethernet switches are installed on the network | ||
420 | that have been configured to use the Spanning Tree protocol. | ||
421 | |||
422 | -- DualNet - In this mode, ports A and B are used as separate devices. | ||
423 | If you have a dual port adapter, port A will be configured as eth0 | ||
424 | and port B as eth1. Both ports can be used independently with | ||
425 | distinct IP addresses. The preferred port setting is not used. | ||
426 | RLMT is turned off. | ||
427 | |||
428 | NOTE: RLMT modes CLP and CLPSS are designed to operate in configurations | ||
429 | where a network path between the ports on one adapter exists. | ||
430 | Moreover, they are not designed to work where adapters are connected | ||
431 | back-to-back. | ||
432 | *** | ||
433 | |||
434 | |||
435 | 5 Large Frame Support | ||
436 | ====================== | ||
437 | |||
438 | The driver supports large frames (also called jumbo frames). Using large | ||
439 | frames can result in an improved throughput if transferring large amounts | ||
440 | of data. | ||
441 | To enable large frames, set the MTU (maximum transfer unit) of the | ||
442 | interface to the desired value (up to 9000), execute the following | ||
443 | command: | ||
444 | ifconfig eth0 mtu 9000 | ||
445 | This will only work if you have two adapters connected back-to-back | ||
446 | or if you use a switch that supports large frames. When using a switch, | ||
447 | it should be configured to allow large frames and auto-negotiation should | ||
448 | be set to OFF. The setting must be configured on all adapters that can be | ||
449 | reached by the large frames. If one adapter is not set to receive large | ||
450 | frames, it will simply drop them. | ||
451 | |||
452 | You can switch back to the standard ethernet frame size by executing the | ||
453 | following command: | ||
454 | ifconfig eth0 mtu 1500 | ||
455 | |||
456 | To permanently configure this setting, add a script with the 'ifconfig' | ||
457 | line to the system startup sequence (named something like "S99sk98lin" | ||
458 | in /etc/rc.d/rc2.d). | ||
459 | *** | ||
460 | |||
461 | |||
462 | 6 VLAN and Link Aggregation Support (IEEE 802.1, 802.1q, 802.3ad) | ||
463 | ================================================================== | ||
464 | |||
465 | The Marvell Yukon/SysKonnect Linux drivers are able to support VLAN and | ||
466 | Link Aggregation according to IEEE standards 802.1, 802.1q, and 802.3ad. | ||
467 | These features are only available after installation of open source | ||
468 | modules available on the Internet: | ||
469 | For VLAN go to: http://www.candelatech.com/~greear/vlan.html | ||
470 | For Link Aggregation go to: http://www.st.rim.or.jp/~yumo | ||
471 | |||
472 | NOTE: SysKonnect GmbH does not offer any support for these open source | ||
473 | modules and does not take the responsibility for any kind of | ||
474 | failures or problems arising in connection with these modules. | ||
475 | |||
476 | NOTE: Configuring Link Aggregation on a SysKonnect dual link adapter may | ||
477 | cause problems when unloading the driver. | ||
478 | |||
479 | |||
480 | 7 Troubleshooting | ||
481 | ================== | ||
482 | |||
483 | If any problems occur during the installation process, check the | ||
484 | following list: | ||
485 | |||
486 | |||
487 | Problem: The SK-98xx adapter cannot be found by the driver. | ||
488 | Solution: In /proc/pci search for the following entry: | ||
489 | 'Ethernet controller: SysKonnect SK-98xx ...' | ||
490 | If this entry exists, the SK-98xx or SK-98xx V2.0 adapter has | ||
491 | been found by the system and should be operational. | ||
492 | If this entry does not exist or if the file '/proc/pci' is not | ||
493 | found, there may be a hardware problem or the PCI support may | ||
494 | not be enabled in your kernel. | ||
495 | The adapter can be checked using the diagnostics program which | ||
496 | is available on the SysKonnect web site: | ||
497 | www.syskonnect.com | ||
498 | |||
499 | Some COMPAQ machines have problems dealing with PCI under Linux. | ||
500 | This problem is described in the 'PCI howto' document | ||
501 | (included in some distributions or available from the | ||
502 | web, e.g. at 'www.linux.org'). | ||
503 | |||
504 | |||
505 | Problem: Programs such as 'ifconfig' or 'route' cannot be found or the | ||
506 | error message 'Operation not permitted' is displayed. | ||
507 | Reason: You are not logged in as user 'root'. | ||
508 | Solution: Logout and login as 'root' or change to 'root' via 'su'. | ||
509 | |||
510 | |||
511 | Problem: Upon use of the command 'ping <address>' the message | ||
512 | "ping: sendto: Network is unreachable" is displayed. | ||
513 | Reason: Your route is not set correctly. | ||
514 | Solution: If you are using RedHat, you probably forgot to set up the | ||
515 | route in the 'network configuration'. | ||
516 | Check the existing routes with the 'route' command and check | ||
517 | if an entry for 'eth0' exists, and if so, if it is set correctly. | ||
518 | |||
519 | |||
520 | Problem: The driver can be started, the adapter is connected to the | ||
521 | network, but you cannot receive or transmit any packets; | ||
522 | e.g. 'ping' does not work. | ||
523 | Reason: There is an incorrect route in your routing table. | ||
524 | Solution: Check the routing table with the command 'route' and read the | ||
525 | manual help pages dealing with routes (enter 'man route'). | ||
526 | |||
527 | NOTE: Although the 2.2.x kernel versions generate the routing entry | ||
528 | automatically, problems of this kind may occur here as well. We've | ||
529 | come across a situation in which the driver started correctly at | ||
530 | system start, but after the driver has been removed and reloaded, | ||
531 | the route of the adapter's network pointed to the 'dummy0'device | ||
532 | and had to be corrected manually. | ||
533 | |||
534 | |||
535 | Problem: Your computer should act as a router between multiple | ||
536 | IP subnetworks (using multiple adapters), but computers in | ||
537 | other subnetworks cannot be reached. | ||
538 | Reason: Either the router's kernel is not configured for IP forwarding | ||
539 | or the routing table and gateway configuration of at least one | ||
540 | computer is not working. | ||
541 | |||
542 | Problem: Upon driver start, the following error message is displayed: | ||
543 | "eth0: -- ERROR -- | ||
544 | Class: internal Software error | ||
545 | Nr: 0xcc | ||
546 | Msg: SkGeInitPort() cannot init running ports" | ||
547 | Reason: You are using a driver compiled for single processor machines | ||
548 | on a multiprocessor machine with SMP (Symmetric MultiProcessor) | ||
549 | kernel. | ||
550 | Solution: Configure your kernel appropriately and recompile the kernel or | ||
551 | the modules. | ||
552 | |||
553 | |||
554 | |||
555 | If your problem is not listed here, please contact SysKonnect's technical | ||
556 | support for help (linux@syskonnect.de). | ||
557 | When contacting our technical support, please ensure that the following | ||
558 | information is available: | ||
559 | - System Manufacturer and HW Informations (CPU, Memory... ) | ||
560 | - PCI-Boards in your system | ||
561 | - Distribution | ||
562 | - Kernel version | ||
563 | - Driver version | ||
564 | *** | ||
565 | |||
566 | |||
567 | |||
568 | ***End of Readme File*** | ||
diff --git a/Documentation/networking/spider_net.txt b/Documentation/networking/spider_net.txt new file mode 100644 index 000000000000..4b4adb8eb14f --- /dev/null +++ b/Documentation/networking/spider_net.txt | |||
@@ -0,0 +1,204 @@ | |||
1 | |||
2 | The Spidernet Device Driver | ||
3 | =========================== | ||
4 | |||
5 | Written by Linas Vepstas <linas@austin.ibm.com> | ||
6 | |||
7 | Version of 7 June 2007 | ||
8 | |||
9 | Abstract | ||
10 | ======== | ||
11 | This document sketches the structure of portions of the spidernet | ||
12 | device driver in the Linux kernel tree. The spidernet is a gigabit | ||
13 | ethernet device built into the Toshiba southbridge commonly used | ||
14 | in the SONY Playstation 3 and the IBM QS20 Cell blade. | ||
15 | |||
16 | The Structure of the RX Ring. | ||
17 | ============================= | ||
18 | The receive (RX) ring is a circular linked list of RX descriptors, | ||
19 | together with three pointers into the ring that are used to manage its | ||
20 | contents. | ||
21 | |||
22 | The elements of the ring are called "descriptors" or "descrs"; they | ||
23 | describe the received data. This includes a pointer to a buffer | ||
24 | containing the received data, the buffer size, and various status bits. | ||
25 | |||
26 | There are three primary states that a descriptor can be in: "empty", | ||
27 | "full" and "not-in-use". An "empty" or "ready" descriptor is ready | ||
28 | to receive data from the hardware. A "full" descriptor has data in it, | ||
29 | and is waiting to be emptied and processed by the OS. A "not-in-use" | ||
30 | descriptor is neither empty or full; it is simply not ready. It may | ||
31 | not even have a data buffer in it, or is otherwise unusable. | ||
32 | |||
33 | During normal operation, on device startup, the OS (specifically, the | ||
34 | spidernet device driver) allocates a set of RX descriptors and RX | ||
35 | buffers. These are all marked "empty", ready to receive data. This | ||
36 | ring is handed off to the hardware, which sequentially fills in the | ||
37 | buffers, and marks them "full". The OS follows up, taking the full | ||
38 | buffers, processing them, and re-marking them empty. | ||
39 | |||
40 | This filling and emptying is managed by three pointers, the "head" | ||
41 | and "tail" pointers, managed by the OS, and a hardware current | ||
42 | descriptor pointer (GDACTDPA). The GDACTDPA points at the descr | ||
43 | currently being filled. When this descr is filled, the hardware | ||
44 | marks it full, and advances the GDACTDPA by one. Thus, when there is | ||
45 | flowing RX traffic, every descr behind it should be marked "full", | ||
46 | and everything in front of it should be "empty". If the hardware | ||
47 | discovers that the current descr is not empty, it will signal an | ||
48 | interrupt, and halt processing. | ||
49 | |||
50 | The tail pointer tails or trails the hardware pointer. When the | ||
51 | hardware is ahead, the tail pointer will be pointing at a "full" | ||
52 | descr. The OS will process this descr, and then mark it "not-in-use", | ||
53 | and advance the tail pointer. Thus, when there is flowing RX traffic, | ||
54 | all of the descrs in front of the tail pointer should be "full", and | ||
55 | all of those behind it should be "not-in-use". When RX traffic is not | ||
56 | flowing, then the tail pointer can catch up to the hardware pointer. | ||
57 | The OS will then note that the current tail is "empty", and halt | ||
58 | processing. | ||
59 | |||
60 | The head pointer (somewhat mis-named) follows after the tail pointer. | ||
61 | When traffic is flowing, then the head pointer will be pointing at | ||
62 | a "not-in-use" descr. The OS will perform various housekeeping duties | ||
63 | on this descr. This includes allocating a new data buffer and | ||
64 | dma-mapping it so as to make it visible to the hardware. The OS will | ||
65 | then mark the descr as "empty", ready to receive data. Thus, when there | ||
66 | is flowing RX traffic, everything in front of the head pointer should | ||
67 | be "not-in-use", and everything behind it should be "empty". If no | ||
68 | RX traffic is flowing, then the head pointer can catch up to the tail | ||
69 | pointer, at which point the OS will notice that the head descr is | ||
70 | "empty", and it will halt processing. | ||
71 | |||
72 | Thus, in an idle system, the GDACTDPA, tail and head pointers will | ||
73 | all be pointing at the same descr, which should be "empty". All of the | ||
74 | other descrs in the ring should be "empty" as well. | ||
75 | |||
76 | The show_rx_chain() routine will print out the the locations of the | ||
77 | GDACTDPA, tail and head pointers. It will also summarize the contents | ||
78 | of the ring, starting at the tail pointer, and listing the status | ||
79 | of the descrs that follow. | ||
80 | |||
81 | A typical example of the output, for a nearly idle system, might be | ||
82 | |||
83 | net eth1: Total number of descrs=256 | ||
84 | net eth1: Chain tail located at descr=20 | ||
85 | net eth1: Chain head is at 20 | ||
86 | net eth1: HW curr desc (GDACTDPA) is at 21 | ||
87 | net eth1: Have 1 descrs with stat=x40800101 | ||
88 | net eth1: HW next desc (GDACNEXTDA) is at 22 | ||
89 | net eth1: Last 255 descrs with stat=xa0800000 | ||
90 | |||
91 | In the above, the hardware has filled in one descr, number 20. Both | ||
92 | head and tail are pointing at 20, because it has not yet been emptied. | ||
93 | Meanwhile, hw is pointing at 21, which is free. | ||
94 | |||
95 | The "Have nnn decrs" refers to the descr starting at the tail: in this | ||
96 | case, nnn=1 descr, starting at descr 20. The "Last nnn descrs" refers | ||
97 | to all of the rest of the descrs, from the last status change. The "nnn" | ||
98 | is a count of how many descrs have exactly the same status. | ||
99 | |||
100 | The status x4... corresponds to "full" and status xa... corresponds | ||
101 | to "empty". The actual value printed is RXCOMST_A. | ||
102 | |||
103 | In the device driver source code, a different set of names are | ||
104 | used for these same concepts, so that | ||
105 | |||
106 | "empty" == SPIDER_NET_DESCR_CARDOWNED == 0xa | ||
107 | "full" == SPIDER_NET_DESCR_FRAME_END == 0x4 | ||
108 | "not in use" == SPIDER_NET_DESCR_NOT_IN_USE == 0xf | ||
109 | |||
110 | |||
111 | The RX RAM full bug/feature | ||
112 | =========================== | ||
113 | |||
114 | As long as the OS can empty out the RX buffers at a rate faster than | ||
115 | the hardware can fill them, there is no problem. If, for some reason, | ||
116 | the OS fails to empty the RX ring fast enough, the hardware GDACTDPA | ||
117 | pointer will catch up to the head, notice the not-empty condition, | ||
118 | ad stop. However, RX packets may still continue arriving on the wire. | ||
119 | The spidernet chip can save some limited number of these in local RAM. | ||
120 | When this local ram fills up, the spider chip will issue an interrupt | ||
121 | indicating this (GHIINT0STS will show ERRINT, and the GRMFLLINT bit | ||
122 | will be set in GHIINT1STS). When the RX ram full condition occurs, | ||
123 | a certain bug/feature is triggered that has to be specially handled. | ||
124 | This section describes the special handling for this condition. | ||
125 | |||
126 | When the OS finally has a chance to run, it will empty out the RX ring. | ||
127 | In particular, it will clear the descriptor on which the hardware had | ||
128 | stopped. However, once the hardware has decided that a certain | ||
129 | descriptor is invalid, it will not restart at that descriptor; instead | ||
130 | it will restart at the next descr. This potentially will lead to a | ||
131 | deadlock condition, as the tail pointer will be pointing at this descr, | ||
132 | which, from the OS point of view, is empty; the OS will be waiting for | ||
133 | this descr to be filled. However, the hardware has skipped this descr, | ||
134 | and is filling the next descrs. Since the OS doesn't see this, there | ||
135 | is a potential deadlock, with the OS waiting for one descr to fill, | ||
136 | while the hardware is waiting for a different set of descrs to become | ||
137 | empty. | ||
138 | |||
139 | A call to show_rx_chain() at this point indicates the nature of the | ||
140 | problem. A typical print when the network is hung shows the following: | ||
141 | |||
142 | net eth1: Spider RX RAM full, incoming packets might be discarded! | ||
143 | net eth1: Total number of descrs=256 | ||
144 | net eth1: Chain tail located at descr=255 | ||
145 | net eth1: Chain head is at 255 | ||
146 | net eth1: HW curr desc (GDACTDPA) is at 0 | ||
147 | net eth1: Have 1 descrs with stat=xa0800000 | ||
148 | net eth1: HW next desc (GDACNEXTDA) is at 1 | ||
149 | net eth1: Have 127 descrs with stat=x40800101 | ||
150 | net eth1: Have 1 descrs with stat=x40800001 | ||
151 | net eth1: Have 126 descrs with stat=x40800101 | ||
152 | net eth1: Last 1 descrs with stat=xa0800000 | ||
153 | |||
154 | Both the tail and head pointers are pointing at descr 255, which is | ||
155 | marked xa... which is "empty". Thus, from the OS point of view, there | ||
156 | is nothing to be done. In particular, there is the implicit assumption | ||
157 | that everything in front of the "empty" descr must surely also be empty, | ||
158 | as explained in the last section. The OS is waiting for descr 255 to | ||
159 | become non-empty, which, in this case, will never happen. | ||
160 | |||
161 | The HW pointer is at descr 0. This descr is marked 0x4.. or "full". | ||
162 | Since its already full, the hardware can do nothing more, and thus has | ||
163 | halted processing. Notice that descrs 0 through 254 are all marked | ||
164 | "full", while descr 254 and 255 are empty. (The "Last 1 descrs" is | ||
165 | descr 254, since tail was at 255.) Thus, the system is deadlocked, | ||
166 | and there can be no forward progress; the OS thinks there's nothing | ||
167 | to do, and the hardware has nowhere to put incoming data. | ||
168 | |||
169 | This bug/feature is worked around with the spider_net_resync_head_ptr() | ||
170 | routine. When the driver receives RX interrupts, but an examination | ||
171 | of the RX chain seems to show it is empty, then it is probable that | ||
172 | the hardware has skipped a descr or two (sometimes dozens under heavy | ||
173 | network conditions). The spider_net_resync_head_ptr() subroutine will | ||
174 | search the ring for the next full descr, and the driver will resume | ||
175 | operations there. Since this will leave "holes" in the ring, there | ||
176 | is also a spider_net_resync_tail_ptr() that will skip over such holes. | ||
177 | |||
178 | As of this writing, the spider_net_resync() strategy seems to work very | ||
179 | well, even under heavy network loads. | ||
180 | |||
181 | |||
182 | The TX ring | ||
183 | =========== | ||
184 | The TX ring uses a low-watermark interrupt scheme to make sure that | ||
185 | the TX queue is appropriately serviced for large packet sizes. | ||
186 | |||
187 | For packet sizes greater than about 1KBytes, the kernel can fill | ||
188 | the TX ring quicker than the device can drain it. Once the ring | ||
189 | is full, the netdev is stopped. When there is room in the ring, | ||
190 | the netdev needs to be reawakened, so that more TX packets are placed | ||
191 | in the ring. The hardware can empty the ring about four times per jiffy, | ||
192 | so its not appropriate to wait for the poll routine to refill, since | ||
193 | the poll routine runs only once per jiffy. The low-watermark mechanism | ||
194 | marks a descr about 1/4th of the way from the bottom of the queue, so | ||
195 | that an interrupt is generated when the descr is processed. This | ||
196 | interrupt wakes up the netdev, which can then refill the queue. | ||
197 | For large packets, this mechanism generates a relatively small number | ||
198 | of interrupts, about 1K/sec. For smaller packets, this will drop to zero | ||
199 | interrupts, as the hardware can empty the queue faster than the kernel | ||
200 | can fill it. | ||
201 | |||
202 | |||
203 | ======= END OF DOCUMENT ======== | ||
204 | |||
diff --git a/Documentation/oops-tracing.txt b/Documentation/oops-tracing.txt index 7d5b60dea551..7f60dfe642ca 100644 --- a/Documentation/oops-tracing.txt +++ b/Documentation/oops-tracing.txt | |||
@@ -86,6 +86,20 @@ stuff are the values reported by the Oops - you can just cut-and-paste | |||
86 | and do a replace of spaces to "\x" - that's what I do, as I'm too lazy | 86 | and do a replace of spaces to "\x" - that's what I do, as I'm too lazy |
87 | to write a program to automate this all). | 87 | to write a program to automate this all). |
88 | 88 | ||
89 | Alternatively, you can use the shell script in scripts/decodecode. | ||
90 | Its usage is: decodecode < oops.txt | ||
91 | |||
92 | The hex bytes that follow "Code:" may (in some architectures) have a series | ||
93 | of bytes that precede the current instruction pointer as well as bytes at and | ||
94 | following the current instruction pointer. In some cases, one instruction | ||
95 | byte or word is surrounded by <> or (), as in "<86>" or "(f00d)". These | ||
96 | <> or () markings indicate the current instruction pointer. Example from | ||
97 | i386, split into multiple lines for readability: | ||
98 | |||
99 | Code: f9 0f 8d f9 00 00 00 8d 42 0c e8 dd 26 11 c7 a1 60 ea 2b f9 8b 50 08 a1 | ||
100 | 64 ea 2b f9 8d 34 82 8b 1e 85 db 74 6d 8b 15 60 ea 2b f9 <8b> 43 04 39 42 54 | ||
101 | 7e 04 40 89 42 54 8b 43 04 3b 05 00 f6 52 c0 | ||
102 | |||
89 | Finally, if you want to see where the code comes from, you can do | 103 | Finally, if you want to see where the code comes from, you can do |
90 | 104 | ||
91 | cd /usr/src/linux | 105 | cd /usr/src/linux |
@@ -237,6 +251,8 @@ characters, each representing a particular tainted value. | |||
237 | 7: 'U' if a user or user application specifically requested that the | 251 | 7: 'U' if a user or user application specifically requested that the |
238 | Tainted flag be set, ' ' otherwise. | 252 | Tainted flag be set, ' ' otherwise. |
239 | 253 | ||
254 | 8: 'D' if the kernel has died recently, i.e. there was an OOPS or BUG. | ||
255 | |||
240 | The primary reason for the 'Tainted: ' string is to tell kernel | 256 | The primary reason for the 'Tainted: ' string is to tell kernel |
241 | debuggers if this is a clean kernel or if anything unusual has | 257 | debuggers if this is a clean kernel or if anything unusual has |
242 | occurred. Tainting is permanent: even if an offending module is | 258 | occurred. Tainting is permanent: even if an offending module is |
diff --git a/Documentation/pci.txt b/Documentation/pci.txt index d38261b67905..7754f5aea4e9 100644 --- a/Documentation/pci.txt +++ b/Documentation/pci.txt | |||
@@ -113,9 +113,6 @@ initialization with a pointer to a structure describing the driver | |||
113 | (Please see Documentation/power/pci.txt for descriptions | 113 | (Please see Documentation/power/pci.txt for descriptions |
114 | of PCI Power Management and the related functions.) | 114 | of PCI Power Management and the related functions.) |
115 | 115 | ||
116 | enable_wake Enable device to generate wake events from a low power | ||
117 | state. | ||
118 | |||
119 | shutdown Hook into reboot_notifier_list (kernel/sys.c). | 116 | shutdown Hook into reboot_notifier_list (kernel/sys.c). |
120 | Intended to stop any idling DMA operations. | 117 | Intended to stop any idling DMA operations. |
121 | Useful for enabling wake-on-lan (NIC) or changing | 118 | Useful for enabling wake-on-lan (NIC) or changing |
@@ -299,7 +296,10 @@ If the PCI device can use the PCI Memory-Write-Invalidate transaction, | |||
299 | call pci_set_mwi(). This enables the PCI_COMMAND bit for Mem-Wr-Inval | 296 | call pci_set_mwi(). This enables the PCI_COMMAND bit for Mem-Wr-Inval |
300 | and also ensures that the cache line size register is set correctly. | 297 | and also ensures that the cache line size register is set correctly. |
301 | Check the return value of pci_set_mwi() as not all architectures | 298 | Check the return value of pci_set_mwi() as not all architectures |
302 | or chip-sets may support Memory-Write-Invalidate. | 299 | or chip-sets may support Memory-Write-Invalidate. Alternatively, |
300 | if Mem-Wr-Inval would be nice to have but is not required, call | ||
301 | pci_try_set_mwi() to have the system do its best effort at enabling | ||
302 | Mem-Wr-Inval. | ||
303 | 303 | ||
304 | 304 | ||
305 | 3.2 Request MMIO/IOP resources | 305 | 3.2 Request MMIO/IOP resources |
diff --git a/Documentation/power/freezing-of-tasks.txt b/Documentation/power/freezing-of-tasks.txt new file mode 100644 index 000000000000..04dc1cf9d215 --- /dev/null +++ b/Documentation/power/freezing-of-tasks.txt | |||
@@ -0,0 +1,162 @@ | |||
1 | Freezing of tasks | ||
2 | (C) 2007 Rafael J. Wysocki <rjw@sisk.pl>, GPL | ||
3 | |||
4 | I. What is the freezing of tasks? | ||
5 | |||
6 | The freezing of tasks is a mechanism by which user space processes and some | ||
7 | kernel threads are controlled during hibernation or system-wide suspend (on some | ||
8 | architectures). | ||
9 | |||
10 | II. How does it work? | ||
11 | |||
12 | There are four per-task flags used for that, PF_NOFREEZE, PF_FROZEN, TIF_FREEZE | ||
13 | and PF_FREEZER_SKIP (the last one is auxiliary). The tasks that have | ||
14 | PF_NOFREEZE unset (all user space processes and some kernel threads) are | ||
15 | regarded as 'freezable' and treated in a special way before the system enters a | ||
16 | suspend state as well as before a hibernation image is created (in what follows | ||
17 | we only consider hibernation, but the description also applies to suspend). | ||
18 | |||
19 | Namely, as the first step of the hibernation procedure the function | ||
20 | freeze_processes() (defined in kernel/power/process.c) is called. It executes | ||
21 | try_to_freeze_tasks() that sets TIF_FREEZE for all of the freezable tasks and | ||
22 | sends a fake signal to each of them. A task that receives such a signal and has | ||
23 | TIF_FREEZE set, should react to it by calling the refrigerator() function | ||
24 | (defined in kernel/power/process.c), which sets the task's PF_FROZEN flag, | ||
25 | changes its state to TASK_UNINTERRUPTIBLE and makes it loop until PF_FROZEN is | ||
26 | cleared for it. Then, we say that the task is 'frozen' and therefore the set of | ||
27 | functions handling this mechanism is called 'the freezer' (these functions are | ||
28 | defined in kernel/power/process.c and include/linux/freezer.h). User space | ||
29 | processes are generally frozen before kernel threads. | ||
30 | |||
31 | It is not recommended to call refrigerator() directly. Instead, it is | ||
32 | recommended to use the try_to_freeze() function (defined in | ||
33 | include/linux/freezer.h), that checks the task's TIF_FREEZE flag and makes the | ||
34 | task enter refrigerator() if the flag is set. | ||
35 | |||
36 | For user space processes try_to_freeze() is called automatically from the | ||
37 | signal-handling code, but the freezable kernel threads need to call it | ||
38 | explicitly in suitable places. The code to do this may look like the following: | ||
39 | |||
40 | do { | ||
41 | hub_events(); | ||
42 | wait_event_interruptible(khubd_wait, | ||
43 | !list_empty(&hub_event_list)); | ||
44 | try_to_freeze(); | ||
45 | } while (!signal_pending(current)); | ||
46 | |||
47 | (from drivers/usb/core/hub.c::hub_thread()). | ||
48 | |||
49 | If a freezable kernel thread fails to call try_to_freeze() after the freezer has | ||
50 | set TIF_FREEZE for it, the freezing of tasks will fail and the entire | ||
51 | hibernation operation will be cancelled. For this reason, freezable kernel | ||
52 | threads must call try_to_freeze() somewhere. | ||
53 | |||
54 | After the system memory state has been restored from a hibernation image and | ||
55 | devices have been reinitialized, the function thaw_processes() is called in | ||
56 | order to clear the PF_FROZEN flag for each frozen task. Then, the tasks that | ||
57 | have been frozen leave refrigerator() and continue running. | ||
58 | |||
59 | III. Which kernel threads are freezable? | ||
60 | |||
61 | Kernel threads are not freezable by default. However, a kernel thread may clear | ||
62 | PF_NOFREEZE for itself by calling set_freezable() (the resetting of PF_NOFREEZE | ||
63 | directly is strongly discouraged). From this point it is regarded as freezable | ||
64 | and must call try_to_freeze() in a suitable place. | ||
65 | |||
66 | IV. Why do we do that? | ||
67 | |||
68 | Generally speaking, there is a couple of reasons to use the freezing of tasks: | ||
69 | |||
70 | 1. The principal reason is to prevent filesystems from being damaged after | ||
71 | hibernation. At the moment we have no simple means of checkpointing | ||
72 | filesystems, so if there are any modifications made to filesystem data and/or | ||
73 | metadata on disks, we cannot bring them back to the state from before the | ||
74 | modifications. At the same time each hibernation image contains some | ||
75 | filesystem-related information that must be consistent with the state of the | ||
76 | on-disk data and metadata after the system memory state has been restored from | ||
77 | the image (otherwise the filesystems will be damaged in a nasty way, usually | ||
78 | making them almost impossible to repair). We therefore freeze tasks that might | ||
79 | cause the on-disk filesystems' data and metadata to be modified after the | ||
80 | hibernation image has been created and before the system is finally powered off. | ||
81 | The majority of these are user space processes, but if any of the kernel threads | ||
82 | may cause something like this to happen, they have to be freezable. | ||
83 | |||
84 | 2. The second reason is to prevent user space processes and some kernel threads | ||
85 | from interfering with the suspending and resuming of devices. A user space | ||
86 | process running on a second CPU while we are suspending devices may, for | ||
87 | example, be troublesome and without the freezing of tasks we would need some | ||
88 | safeguards against race conditions that might occur in such a case. | ||
89 | |||
90 | Although Linus Torvalds doesn't like the freezing of tasks, he said this in one | ||
91 | of the discussions on LKML (http://lkml.org/lkml/2007/4/27/608): | ||
92 | |||
93 | "RJW:> Why we freeze tasks at all or why we freeze kernel threads? | ||
94 | |||
95 | Linus: In many ways, 'at all'. | ||
96 | |||
97 | I _do_ realize the IO request queue issues, and that we cannot actually do | ||
98 | s2ram with some devices in the middle of a DMA. So we want to be able to | ||
99 | avoid *that*, there's no question about that. And I suspect that stopping | ||
100 | user threads and then waiting for a sync is practically one of the easier | ||
101 | ways to do so. | ||
102 | |||
103 | So in practice, the 'at all' may become a 'why freeze kernel threads?' and | ||
104 | freezing user threads I don't find really objectionable." | ||
105 | |||
106 | Still, there are kernel threads that may want to be freezable. For example, if | ||
107 | a kernel that belongs to a device driver accesses the device directly, it in | ||
108 | principle needs to know when the device is suspended, so that it doesn't try to | ||
109 | access it at that time. However, if the kernel thread is freezable, it will be | ||
110 | frozen before the driver's .suspend() callback is executed and it will be | ||
111 | thawed after the driver's .resume() callback has run, so it won't be accessing | ||
112 | the device while it's suspended. | ||
113 | |||
114 | 3. Another reason for freezing tasks is to prevent user space processes from | ||
115 | realizing that hibernation (or suspend) operation takes place. Ideally, user | ||
116 | space processes should not notice that such a system-wide operation has occurred | ||
117 | and should continue running without any problems after the restore (or resume | ||
118 | from suspend). Unfortunately, in the most general case this is quite difficult | ||
119 | to achieve without the freezing of tasks. Consider, for example, a process | ||
120 | that depends on all CPUs being online while it's running. Since we need to | ||
121 | disable nonboot CPUs during the hibernation, if this process is not frozen, it | ||
122 | may notice that the number of CPUs has changed and may start to work incorrectly | ||
123 | because of that. | ||
124 | |||
125 | V. Are there any problems related to the freezing of tasks? | ||
126 | |||
127 | Yes, there are. | ||
128 | |||
129 | First of all, the freezing of kernel threads may be tricky if they depend one | ||
130 | on another. For example, if kernel thread A waits for a completion (in the | ||
131 | TASK_UNINTERRUPTIBLE state) that needs to be done by freezable kernel thread B | ||
132 | and B is frozen in the meantime, then A will be blocked until B is thawed, which | ||
133 | may be undesirable. That's why kernel threads are not freezable by default. | ||
134 | |||
135 | Second, there are the following two problems related to the freezing of user | ||
136 | space processes: | ||
137 | 1. Putting processes into an uninterruptible sleep distorts the load average. | ||
138 | 2. Now that we have FUSE, plus the framework for doing device drivers in | ||
139 | userspace, it gets even more complicated because some userspace processes are | ||
140 | now doing the sorts of things that kernel threads do | ||
141 | (https://lists.linux-foundation.org/pipermail/linux-pm/2007-May/012309.html). | ||
142 | |||
143 | The problem 1. seems to be fixable, although it hasn't been fixed so far. The | ||
144 | other one is more serious, but it seems that we can work around it by using | ||
145 | hibernation (and suspend) notifiers (in that case, though, we won't be able to | ||
146 | avoid the realization by the user space processes that the hibernation is taking | ||
147 | place). | ||
148 | |||
149 | There are also problems that the freezing of tasks tends to expose, although | ||
150 | they are not directly related to it. For example, if request_firmware() is | ||
151 | called from a device driver's .resume() routine, it will timeout and eventually | ||
152 | fail, because the user land process that should respond to the request is frozen | ||
153 | at this point. So, seemingly, the failure is due to the freezing of tasks. | ||
154 | Suppose, however, that the firmware file is located on a filesystem accessible | ||
155 | only through another device that hasn't been resumed yet. In that case, | ||
156 | request_firmware() will fail regardless of whether or not the freezing of tasks | ||
157 | is used. Consequently, the problem is not really related to the freezing of | ||
158 | tasks, since it generally exists anyway. | ||
159 | |||
160 | A driver must have all firmwares it may need in RAM before suspend() is called. | ||
161 | If keeping them is not practical, for example due to their size, they must be | ||
162 | requested early enough using the suspend notifier API described in notifiers.txt. | ||
diff --git a/Documentation/power/kernel_threads.txt b/Documentation/power/kernel_threads.txt deleted file mode 100644 index fb57784986b1..000000000000 --- a/Documentation/power/kernel_threads.txt +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | KERNEL THREADS | ||
2 | |||
3 | |||
4 | Freezer | ||
5 | |||
6 | Upon entering a suspended state the system will freeze all | ||
7 | tasks. This is done by delivering pseudosignals. This affects | ||
8 | kernel threads, too. To successfully freeze a kernel thread | ||
9 | the thread has to check for the pseudosignal and enter the | ||
10 | refrigerator. Code to do this looks like this: | ||
11 | |||
12 | do { | ||
13 | hub_events(); | ||
14 | wait_event_interruptible(khubd_wait, !list_empty(&hub_event_list)); | ||
15 | try_to_freeze(); | ||
16 | } while (!signal_pending(current)); | ||
17 | |||
18 | from drivers/usb/core/hub.c::hub_thread() | ||
19 | |||
20 | |||
21 | The Unfreezable | ||
22 | |||
23 | Some kernel threads however, must not be frozen. The kernel must | ||
24 | be able to finish pending IO operations and later on be able to | ||
25 | write the memory image to disk. Kernel threads needed to do IO | ||
26 | must stay awake. Such threads must mark themselves unfreezable | ||
27 | like this: | ||
28 | |||
29 | /* | ||
30 | * This thread doesn't need any user-level access, | ||
31 | * so get rid of all our resources. | ||
32 | */ | ||
33 | daemonize("usb-storage"); | ||
34 | |||
35 | current->flags |= PF_NOFREEZE; | ||
36 | |||
37 | from drivers/usb/storage/usb.c::usb_stor_control_thread() | ||
38 | |||
39 | Such drivers are themselves responsible for staying quiet during | ||
40 | the actual snapshotting. | ||
diff --git a/Documentation/power/notifiers.txt b/Documentation/power/notifiers.txt new file mode 100644 index 000000000000..9293e4bc857c --- /dev/null +++ b/Documentation/power/notifiers.txt | |||
@@ -0,0 +1,50 @@ | |||
1 | Suspend notifiers | ||
2 | (C) 2007 Rafael J. Wysocki <rjw@sisk.pl>, GPL | ||
3 | |||
4 | There are some operations that device drivers may want to carry out in their | ||
5 | .suspend() routines, but shouldn't, because they can cause the hibernation or | ||
6 | suspend to fail. For example, a driver may want to allocate a substantial amount | ||
7 | of memory (like 50 MB) in .suspend(), but that shouldn't be done after the | ||
8 | swsusp's memory shrinker has run. | ||
9 | |||
10 | Also, there may be some operations, that subsystems want to carry out before a | ||
11 | hibernation/suspend or after a restore/resume, requiring the system to be fully | ||
12 | functional, so the drivers' .suspend() and .resume() routines are not suitable | ||
13 | for this purpose. For example, device drivers may want to upload firmware to | ||
14 | their devices after a restore from a hibernation image, but they cannot do it by | ||
15 | calling request_firmware() from their .resume() routines (user land processes | ||
16 | are frozen at this point). The solution may be to load the firmware into | ||
17 | memory before processes are frozen and upload it from there in the .resume() | ||
18 | routine. Of course, a hibernation notifier may be used for this purpose. | ||
19 | |||
20 | The subsystems that have such needs can register suspend notifiers that will be | ||
21 | called upon the following events by the suspend core: | ||
22 | |||
23 | PM_HIBERNATION_PREPARE The system is going to hibernate or suspend, tasks will | ||
24 | be frozen immediately. | ||
25 | |||
26 | PM_POST_HIBERNATION The system memory state has been restored from a | ||
27 | hibernation image or an error occured during the | ||
28 | hibernation. Device drivers' .resume() callbacks have | ||
29 | been executed and tasks have been thawed. | ||
30 | |||
31 | PM_SUSPEND_PREPARE The system is preparing for a suspend. | ||
32 | |||
33 | PM_POST_SUSPEND The system has just resumed or an error occured during | ||
34 | the suspend. Device drivers' .resume() callbacks have | ||
35 | been executed and tasks have been thawed. | ||
36 | |||
37 | It is generally assumed that whatever the notifiers do for | ||
38 | PM_HIBERNATION_PREPARE, should be undone for PM_POST_HIBERNATION. Analogously, | ||
39 | operations performed for PM_SUSPEND_PREPARE should be reversed for | ||
40 | PM_POST_SUSPEND. Additionally, all of the notifiers are called for | ||
41 | PM_POST_HIBERNATION if one of them fails for PM_HIBERNATION_PREPARE, and | ||
42 | all of the notifiers are called for PM_POST_SUSPEND if one of them fails for | ||
43 | PM_SUSPEND_PREPARE. | ||
44 | |||
45 | The hibernation and suspend notifiers are called with pm_mutex held. They are | ||
46 | defined in the usual way, but their last argument is meaningless (it is always | ||
47 | NULL). To register and/or unregister a suspend notifier use the functions | ||
48 | register_pm_notifier() and unregister_pm_notifier(), respectively, defined in | ||
49 | include/linux/suspend.h . If you don't need to unregister the notifier, you can | ||
50 | also use the pm_notifier() macro defined in include/linux/suspend.h . | ||
diff --git a/Documentation/power/pci.txt b/Documentation/power/pci.txt index e00b099a4b86..dd8fe43888d3 100644 --- a/Documentation/power/pci.txt +++ b/Documentation/power/pci.txt | |||
@@ -164,7 +164,6 @@ struct pci_driver: | |||
164 | 164 | ||
165 | int (*suspend) (struct pci_dev *dev, pm_message_t state); | 165 | int (*suspend) (struct pci_dev *dev, pm_message_t state); |
166 | int (*resume) (struct pci_dev *dev); | 166 | int (*resume) (struct pci_dev *dev); |
167 | int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); | ||
168 | 167 | ||
169 | 168 | ||
170 | suspend | 169 | suspend |
@@ -251,42 +250,6 @@ The driver should update the current_state field in its pci_dev structure in | |||
251 | this function, except for PM-capable devices when pci_set_power_state is used. | 250 | this function, except for PM-capable devices when pci_set_power_state is used. |
252 | 251 | ||
253 | 252 | ||
254 | enable_wake | ||
255 | ----------- | ||
256 | |||
257 | Usage: | ||
258 | |||
259 | if (dev->driver && dev->driver->enable_wake) | ||
260 | dev->driver->enable_wake(dev,state,enable); | ||
261 | |||
262 | This callback is generally only relevant for devices that support the PCI PM | ||
263 | spec and have the ability to generate a PME# (Power Management Event Signal) | ||
264 | to wake the system up. (However, it is possible that a device may support | ||
265 | some non-standard way of generating a wake event on sleep.) | ||
266 | |||
267 | Bits 15:11 of the PMC (Power Mgmt Capabilities) Register in a device's | ||
268 | PM Capabilities describe what power states the device supports generating a | ||
269 | wake event from: | ||
270 | |||
271 | +------------------+ | ||
272 | | Bit | State | | ||
273 | +------------------+ | ||
274 | | 11 | D0 | | ||
275 | | 12 | D1 | | ||
276 | | 13 | D2 | | ||
277 | | 14 | D3hot | | ||
278 | | 15 | D3cold | | ||
279 | +------------------+ | ||
280 | |||
281 | A device can use this to enable wake events: | ||
282 | |||
283 | pci_enable_wake(dev,state,enable); | ||
284 | |||
285 | Note that to enable PME# from D3cold, a value of 4 should be passed to | ||
286 | pci_enable_wake (since it uses an index into a bitmask). If a driver gets | ||
287 | a request to enable wake events from D3, two calls should be made to | ||
288 | pci_enable_wake (one for both D3hot and D3cold). | ||
289 | |||
290 | 253 | ||
291 | A reference implementation | 254 | A reference implementation |
292 | ------------------------- | 255 | ------------------------- |
diff --git a/Documentation/power/swsusp.txt b/Documentation/power/swsusp.txt index 5b8d6953f05e..aea7e9209667 100644 --- a/Documentation/power/swsusp.txt +++ b/Documentation/power/swsusp.txt | |||
@@ -140,21 +140,11 @@ should be sent to the mailing list available through the suspend2 | |||
140 | website, and not to the Linux Kernel Mailing List. We are working | 140 | website, and not to the Linux Kernel Mailing List. We are working |
141 | toward merging suspend2 into the mainline kernel. | 141 | toward merging suspend2 into the mainline kernel. |
142 | 142 | ||
143 | Q: A kernel thread must voluntarily freeze itself (call 'refrigerator'). | 143 | Q: What is the freezing of tasks and why are we using it? |
144 | I found some kernel threads that don't do it, and they don't freeze | ||
145 | so the system can't sleep. Is this a known behavior? | ||
146 | |||
147 | A: All such kernel threads need to be fixed, one by one. Select the | ||
148 | place where the thread is safe to be frozen (no kernel semaphores | ||
149 | should be held at that point and it must be safe to sleep there), and | ||
150 | add: | ||
151 | |||
152 | try_to_freeze(); | ||
153 | |||
154 | If the thread is needed for writing the image to storage, you should | ||
155 | instead set the PF_NOFREEZE process flag when creating the thread (and | ||
156 | be very careful). | ||
157 | 144 | ||
145 | A: The freezing of tasks is a mechanism by which user space processes and some | ||
146 | kernel threads are controlled during hibernation or system-wide suspend (on some | ||
147 | architectures). See freezing-of-tasks.txt for details. | ||
158 | 148 | ||
159 | Q: What is the difference between "platform" and "shutdown"? | 149 | Q: What is the difference between "platform" and "shutdown"? |
160 | 150 | ||
@@ -393,6 +383,9 @@ safest thing is to unmount all filesystems on removable media (such USB, | |||
393 | Firewire, CompactFlash, MMC, external SATA, or even IDE hotplug bays) | 383 | Firewire, CompactFlash, MMC, external SATA, or even IDE hotplug bays) |
394 | before suspending; then remount them after resuming. | 384 | before suspending; then remount them after resuming. |
395 | 385 | ||
386 | There is a work-around for this problem. For more information, see | ||
387 | Documentation/usb/persist.txt. | ||
388 | |||
396 | Q: I upgraded the kernel from 2.6.15 to 2.6.16. Both kernels were | 389 | Q: I upgraded the kernel from 2.6.15 to 2.6.16. Both kernels were |
397 | compiled with the similar configuration files. Anyway I found that | 390 | compiled with the similar configuration files. Anyway I found that |
398 | suspend to disk (and resume) is much slower on 2.6.16 compared to | 391 | suspend to disk (and resume) is much slower on 2.6.16 compared to |
diff --git a/Documentation/power_supply_class.txt b/Documentation/power_supply_class.txt new file mode 100644 index 000000000000..9758cf433c06 --- /dev/null +++ b/Documentation/power_supply_class.txt | |||
@@ -0,0 +1,167 @@ | |||
1 | Linux power supply class | ||
2 | ======================== | ||
3 | |||
4 | Synopsis | ||
5 | ~~~~~~~~ | ||
6 | Power supply class used to represent battery, UPS, AC or DC power supply | ||
7 | properties to user-space. | ||
8 | |||
9 | It defines core set of attributes, which should be applicable to (almost) | ||
10 | every power supply out there. Attributes are available via sysfs and uevent | ||
11 | interfaces. | ||
12 | |||
13 | Each attribute has well defined meaning, up to unit of measure used. While | ||
14 | the attributes provided are believed to be universally applicable to any | ||
15 | power supply, specific monitoring hardware may not be able to provide them | ||
16 | all, so any of them may be skipped. | ||
17 | |||
18 | Power supply class is extensible, and allows to define drivers own attributes. | ||
19 | The core attribute set is subject to the standard Linux evolution (i.e. | ||
20 | if it will be found that some attribute is applicable to many power supply | ||
21 | types or their drivers, it can be added to the core set). | ||
22 | |||
23 | It also integrates with LED framework, for the purpose of providing | ||
24 | typically expected feedback of battery charging/fully charged status and | ||
25 | AC/USB power supply online status. (Note that specific details of the | ||
26 | indication (including whether to use it at all) are fully controllable by | ||
27 | user and/or specific machine defaults, per design principles of LED | ||
28 | framework). | ||
29 | |||
30 | |||
31 | Attributes/properties | ||
32 | ~~~~~~~~~~~~~~~~~~~~~ | ||
33 | Power supply class has predefined set of attributes, this eliminates code | ||
34 | duplication across drivers. Power supply class insist on reusing its | ||
35 | predefined attributes *and* their units. | ||
36 | |||
37 | So, userspace gets predictable set of attributes and their units for any | ||
38 | kind of power supply, and can process/present them to a user in consistent | ||
39 | manner. Results for different power supplies and machines are also directly | ||
40 | comparable. | ||
41 | |||
42 | See drivers/power/ds2760_battery.c and drivers/power/pda_power.c for the | ||
43 | example how to declare and handle attributes. | ||
44 | |||
45 | |||
46 | Units | ||
47 | ~~~~~ | ||
48 | Quoting include/linux/power_supply.h: | ||
49 | |||
50 | All voltages, currents, charges, energies, time and temperatures in µV, | ||
51 | µA, µAh, µWh, seconds and tenths of degree Celsius unless otherwise | ||
52 | stated. It's driver's job to convert its raw values to units in which | ||
53 | this class operates. | ||
54 | |||
55 | |||
56 | Attributes/properties detailed | ||
57 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
58 | |||
59 | ~ ~ ~ ~ ~ ~ ~ Charge/Energy/Capacity - how to not confuse ~ ~ ~ ~ ~ ~ ~ | ||
60 | ~ ~ | ||
61 | ~ Because both "charge" (µAh) and "energy" (µWh) represents "capacity" ~ | ||
62 | ~ of battery, this class distinguish these terms. Don't mix them! ~ | ||
63 | ~ ~ | ||
64 | ~ CHARGE_* attributes represents capacity in µAh only. ~ | ||
65 | ~ ENERGY_* attributes represents capacity in µWh only. ~ | ||
66 | ~ CAPACITY attribute represents capacity in *percents*, from 0 to 100. ~ | ||
67 | ~ ~ | ||
68 | ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | ||
69 | |||
70 | Postfixes: | ||
71 | _AVG - *hardware* averaged value, use it if your hardware is really able to | ||
72 | report averaged values. | ||
73 | _NOW - momentary/instantaneous values. | ||
74 | |||
75 | STATUS - this attribute represents operating status (charging, full, | ||
76 | discharging (i.e. powering a load), etc.). This corresponds to | ||
77 | BATTERY_STATUS_* values, as defined in battery.h. | ||
78 | |||
79 | HEALTH - represents health of the battery, values corresponds to | ||
80 | POWER_SUPPLY_HEALTH_*, defined in battery.h. | ||
81 | |||
82 | VOLTAGE_MAX_DESIGN, VOLTAGE_MIN_DESIGN - design values for maximal and | ||
83 | minimal power supply voltages. Maximal/minimal means values of voltages | ||
84 | when battery considered "full"/"empty" at normal conditions. Yes, there is | ||
85 | no direct relation between voltage and battery capacity, but some dumb | ||
86 | batteries use voltage for very approximated calculation of capacity. | ||
87 | Battery driver also can use this attribute just to inform userspace | ||
88 | about maximal and minimal voltage thresholds of a given battery. | ||
89 | |||
90 | CHARGE_FULL_DESIGN, CHARGE_EMPTY_DESIGN - design charge values, when | ||
91 | battery considered full/empty. | ||
92 | |||
93 | ENERGY_FULL_DESIGN, ENERGY_EMPTY_DESIGN - same as above but for energy. | ||
94 | |||
95 | CHARGE_FULL, CHARGE_EMPTY - These attributes means "last remembered value | ||
96 | of charge when battery became full/empty". It also could mean "value of | ||
97 | charge when battery considered full/empty at given conditions (temperature, | ||
98 | age)". I.e. these attributes represents real thresholds, not design values. | ||
99 | |||
100 | ENERGY_FULL, ENERGY_EMPTY - same as above but for energy. | ||
101 | |||
102 | CAPACITY - capacity in percents. | ||
103 | CAPACITY_LEVEL - capacity level. This corresponds to | ||
104 | POWER_SUPPLY_CAPACITY_LEVEL_*. | ||
105 | |||
106 | TEMP - temperature of the power supply. | ||
107 | TEMP_AMBIENT - ambient temperature. | ||
108 | |||
109 | TIME_TO_EMPTY - seconds left for battery to be considered empty (i.e. | ||
110 | while battery powers a load) | ||
111 | TIME_TO_FULL - seconds left for battery to be considered full (i.e. | ||
112 | while battery is charging) | ||
113 | |||
114 | |||
115 | Battery <-> external power supply interaction | ||
116 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
117 | Often power supplies are acting as supplies and supplicants at the same | ||
118 | time. Batteries are good example. So, batteries usually care if they're | ||
119 | externally powered or not. | ||
120 | |||
121 | For that case, power supply class implements notification mechanism for | ||
122 | batteries. | ||
123 | |||
124 | External power supply (AC) lists supplicants (batteries) names in | ||
125 | "supplied_to" struct member, and each power_supply_changed() call | ||
126 | issued by external power supply will notify supplicants via | ||
127 | external_power_changed callback. | ||
128 | |||
129 | |||
130 | QA | ||
131 | ~~ | ||
132 | Q: Where is POWER_SUPPLY_PROP_XYZ attribute? | ||
133 | A: If you cannot find attribute suitable for your driver needs, feel free | ||
134 | to add it and send patch along with your driver. | ||
135 | |||
136 | The attributes available currently are the ones currently provided by the | ||
137 | drivers written. | ||
138 | |||
139 | Good candidates to add in future: model/part#, cycle_time, manufacturer, | ||
140 | etc. | ||
141 | |||
142 | |||
143 | Q: I have some very specific attribute (e.g. battery color), should I add | ||
144 | this attribute to standard ones? | ||
145 | A: Most likely, no. Such attribute can be placed in the driver itself, if | ||
146 | it is useful. Of course, if the attribute in question applicable to | ||
147 | large set of batteries, provided by many drivers, and/or comes from | ||
148 | some general battery specification/standard, it may be a candidate to | ||
149 | be added to the core attribute set. | ||
150 | |||
151 | |||
152 | Q: Suppose, my battery monitoring chip/firmware does not provides capacity | ||
153 | in percents, but provides charge_{now,full,empty}. Should I calculate | ||
154 | percentage capacity manually, inside the driver, and register CAPACITY | ||
155 | attribute? The same question about time_to_empty/time_to_full. | ||
156 | A: Most likely, no. This class is designed to export properties which are | ||
157 | directly measurable by the specific hardware available. | ||
158 | |||
159 | Inferring not available properties using some heuristics or mathematical | ||
160 | model is not subject of work for a battery driver. Such functionality | ||
161 | should be factored out, and in fact, apm_power, the driver to serve | ||
162 | legacy APM API on top of power supply class, uses a simple heuristic of | ||
163 | approximating remaining battery capacity based on its charge, current, | ||
164 | voltage and so on. But full-fledged battery model is likely not subject | ||
165 | for kernel at all, as it would require floating point calculation to deal | ||
166 | with things like differential equations and Kalman filters. This is | ||
167 | better be handled by batteryd/libbattery, yet to be written. | ||
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt index b49ce169a63a..76733a3962f0 100644 --- a/Documentation/powerpc/booting-without-of.txt +++ b/Documentation/powerpc/booting-without-of.txt | |||
@@ -1,7 +1,6 @@ | |||
1 | Booting the Linux/ppc kernel without Open Firmware | 1 | Booting the Linux/ppc kernel without Open Firmware |
2 | -------------------------------------------------- | 2 | -------------------------------------------------- |
3 | 3 | ||
4 | |||
5 | (c) 2005 Benjamin Herrenschmidt <benh at kernel.crashing.org>, | 4 | (c) 2005 Benjamin Herrenschmidt <benh at kernel.crashing.org>, |
6 | IBM Corp. | 5 | IBM Corp. |
7 | (c) 2005 Becky Bruce <becky.bruce at freescale.com>, | 6 | (c) 2005 Becky Bruce <becky.bruce at freescale.com>, |
@@ -9,6 +8,63 @@ | |||
9 | (c) 2006 MontaVista Software, Inc. | 8 | (c) 2006 MontaVista Software, Inc. |
10 | Flash chip node definition | 9 | Flash chip node definition |
11 | 10 | ||
11 | Table of Contents | ||
12 | ================= | ||
13 | |||
14 | I - Introduction | ||
15 | 1) Entry point for arch/powerpc | ||
16 | 2) Board support | ||
17 | |||
18 | II - The DT block format | ||
19 | 1) Header | ||
20 | 2) Device tree generalities | ||
21 | 3) Device tree "structure" block | ||
22 | 4) Device tree "strings" block | ||
23 | |||
24 | III - Required content of the device tree | ||
25 | 1) Note about cells and address representation | ||
26 | 2) Note about "compatible" properties | ||
27 | 3) Note about "name" properties | ||
28 | 4) Note about node and property names and character set | ||
29 | 5) Required nodes and properties | ||
30 | a) The root node | ||
31 | b) The /cpus node | ||
32 | c) The /cpus/* nodes | ||
33 | d) the /memory node(s) | ||
34 | e) The /chosen node | ||
35 | f) the /soc<SOCname> node | ||
36 | |||
37 | IV - "dtc", the device tree compiler | ||
38 | |||
39 | V - Recommendations for a bootloader | ||
40 | |||
41 | VI - System-on-a-chip devices and nodes | ||
42 | 1) Defining child nodes of an SOC | ||
43 | 2) Representing devices without a current OF specification | ||
44 | a) MDIO IO device | ||
45 | b) Gianfar-compatible ethernet nodes | ||
46 | c) PHY nodes | ||
47 | d) Interrupt controllers | ||
48 | e) I2C | ||
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) Flash chip nodes | ||
54 | k) Global Utilities Block | ||
55 | |||
56 | VII - Specifying interrupt information for devices | ||
57 | 1) interrupts property | ||
58 | 2) interrupt-parent property | ||
59 | 3) OpenPIC Interrupt Controllers | ||
60 | 4) ISA Interrupt Controllers | ||
61 | |||
62 | Appendix A - Sample SOC node for MPC8540 | ||
63 | |||
64 | |||
65 | Revision Information | ||
66 | ==================== | ||
67 | |||
12 | May 18, 2005: Rev 0.1 - Initial draft, no chapter III yet. | 68 | May 18, 2005: Rev 0.1 - Initial draft, no chapter III yet. |
13 | 69 | ||
14 | May 19, 2005: Rev 0.2 - Add chapter III and bits & pieces here or | 70 | May 19, 2005: Rev 0.2 - Add chapter III and bits & pieces here or |
@@ -571,6 +627,14 @@ So the node content can be summarized as a start token, a full path, | |||
571 | a list of properties, a list of child nodes, and an end token. Every | 627 | a list of properties, a list of child nodes, and an end token. Every |
572 | child node is a full node structure itself as defined above. | 628 | child node is a full node structure itself as defined above. |
573 | 629 | ||
630 | NOTE: The above definition requires that all property definitions for | ||
631 | a particular node MUST precede any subnode definitions for that node. | ||
632 | Although the structure would not be ambiguous if properties and | ||
633 | subnodes were intermingled, the kernel parser requires that the | ||
634 | properties come first (up until at least 2.6.22). Any tools | ||
635 | manipulating a flattened tree must take care to preserve this | ||
636 | constraint. | ||
637 | |||
574 | 4) Device tree "strings" block | 638 | 4) Device tree "strings" block |
575 | 639 | ||
576 | In order to save space, property names, which are generally redundant, | 640 | In order to save space, property names, which are generally redundant, |
@@ -1186,6 +1250,12 @@ platforms are moved over to use the flattened-device-tree model. | |||
1186 | network device. This is used by the bootwrapper to interpret | 1250 | network device. This is used by the bootwrapper to interpret |
1187 | MAC addresses passed by the firmware when no information other | 1251 | MAC addresses passed by the firmware when no information other |
1188 | than indices is available to associate an address with a device. | 1252 | than indices is available to associate an address with a device. |
1253 | - phy-connection-type : a string naming the controller/PHY interface type, | ||
1254 | i.e., "mii" (default), "rmii", "gmii", "rgmii", "rgmii-id", "sgmii", | ||
1255 | "tbi", or "rtbi". This property is only really needed if the connection | ||
1256 | is of type "rgmii-id", as all other connection types are detected by | ||
1257 | hardware. | ||
1258 | |||
1189 | 1259 | ||
1190 | Example: | 1260 | Example: |
1191 | 1261 | ||
@@ -1687,7 +1757,7 @@ platforms are moved over to use the flattened-device-tree model. | |||
1687 | }; | 1757 | }; |
1688 | }; | 1758 | }; |
1689 | 1759 | ||
1690 | g) Flash chip nodes | 1760 | j) Flash chip nodes |
1691 | 1761 | ||
1692 | Flash chips (Memory Technology Devices) are often used for solid state | 1762 | Flash chips (Memory Technology Devices) are often used for solid state |
1693 | file systems on embedded devices. | 1763 | file systems on embedded devices. |
@@ -1727,6 +1797,33 @@ platforms are moved over to use the flattened-device-tree model. | |||
1727 | partition-names = "fs\0firmware"; | 1797 | partition-names = "fs\0firmware"; |
1728 | }; | 1798 | }; |
1729 | 1799 | ||
1800 | k) Global Utilities Block | ||
1801 | |||
1802 | The global utilities block controls power management, I/O device | ||
1803 | enabling, power-on-reset configuration monitoring, general-purpose | ||
1804 | I/O signal configuration, alternate function selection for multiplexed | ||
1805 | signals, and clock control. | ||
1806 | |||
1807 | Required properties: | ||
1808 | |||
1809 | - compatible : Should define the compatible device type for | ||
1810 | global-utilities. | ||
1811 | - reg : Offset and length of the register set for the device. | ||
1812 | |||
1813 | Recommended properties: | ||
1814 | |||
1815 | - fsl,has-rstcr : Indicates that the global utilities register set | ||
1816 | contains a functioning "reset control register" (i.e. the board | ||
1817 | is wired to reset upon setting the HRESET_REQ bit in this register). | ||
1818 | |||
1819 | Example: | ||
1820 | |||
1821 | global-utilities@e0000 { /* global utilities block */ | ||
1822 | compatible = "fsl,mpc8548-guts"; | ||
1823 | reg = <e0000 1000>; | ||
1824 | fsl,has-rstcr; | ||
1825 | }; | ||
1826 | |||
1730 | More devices will be defined as this spec matures. | 1827 | More devices will be defined as this spec matures. |
1731 | 1828 | ||
1732 | VII - Specifying interrupt information for devices | 1829 | VII - Specifying interrupt information for devices |
diff --git a/Documentation/rtc.txt b/Documentation/rtc.txt index 7c701b88d6d5..c931d613f641 100644 --- a/Documentation/rtc.txt +++ b/Documentation/rtc.txt | |||
@@ -385,7 +385,7 @@ test_PIE: | |||
385 | /* not all RTCs support periodic IRQs */ | 385 | /* not all RTCs support periodic IRQs */ |
386 | if (errno == ENOTTY) { | 386 | if (errno == ENOTTY) { |
387 | fprintf(stderr, "\nNo periodic IRQ support\n"); | 387 | fprintf(stderr, "\nNo periodic IRQ support\n"); |
388 | return 0; | 388 | goto done; |
389 | } | 389 | } |
390 | perror("RTC_IRQP_READ ioctl"); | 390 | perror("RTC_IRQP_READ ioctl"); |
391 | exit(errno); | 391 | exit(errno); |
diff --git a/Documentation/sched-design-CFS.txt b/Documentation/sched-design-CFS.txt new file mode 100644 index 000000000000..16feebb7bdc0 --- /dev/null +++ b/Documentation/sched-design-CFS.txt | |||
@@ -0,0 +1,119 @@ | |||
1 | |||
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: | ||
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 | |||
diff --git a/Documentation/scsi/aacraid.txt b/Documentation/scsi/aacraid.txt index ce3cb42507bd..cc12b55d4b3d 100644 --- a/Documentation/scsi/aacraid.txt +++ b/Documentation/scsi/aacraid.txt | |||
@@ -50,6 +50,9 @@ Supported Cards/Chipsets | |||
50 | 9005:0285:9005:02be Adaptec 31605 (Marauder160) | 50 | 9005:0285:9005:02be Adaptec 31605 (Marauder160) |
51 | 9005:0285:9005:02c3 Adaptec 51205 (Voodoo120) | 51 | 9005:0285:9005:02c3 Adaptec 51205 (Voodoo120) |
52 | 9005:0285:9005:02c4 Adaptec 51605 (Voodoo160) | 52 | 9005:0285:9005:02c4 Adaptec 51605 (Voodoo160) |
53 | 9005:0285:9005:02ce Adaptec 51245 (Voodoo124) | ||
54 | 9005:0285:9005:02cf Adaptec 51645 (Voodoo164) | ||
55 | 9005:0285:9005:02d0 Adaptec 52445 (Voodoo244) | ||
53 | 1011:0046:9005:0364 Adaptec 5400S (Mustang) | 56 | 1011:0046:9005:0364 Adaptec 5400S (Mustang) |
54 | 9005:0287:9005:0800 Adaptec Themisto (Jupiter) | 57 | 9005:0287:9005:0800 Adaptec Themisto (Jupiter) |
55 | 9005:0200:9005:0200 Adaptec Themisto (Jupiter) | 58 | 9005:0200:9005:0200 Adaptec Themisto (Jupiter) |
diff --git a/Documentation/scsi/scsi_fc_transport.txt b/Documentation/scsi/scsi_fc_transport.txt new file mode 100644 index 000000000000..d403e46d8463 --- /dev/null +++ b/Documentation/scsi/scsi_fc_transport.txt | |||
@@ -0,0 +1,450 @@ | |||
1 | SCSI FC Tansport | ||
2 | ============================================= | ||
3 | |||
4 | Date: 4/12/2007 | ||
5 | Kernel Revisions for features: | ||
6 | rports : <<TBS>> | ||
7 | vports : 2.6.22 (? TBD) | ||
8 | |||
9 | |||
10 | Introduction | ||
11 | ============ | ||
12 | This file documents the features and components of the SCSI FC Transport. | ||
13 | It also provides documents the API between the transport and FC LLDDs. | ||
14 | The FC transport can be found at: | ||
15 | drivers/scsi/scsi_transport_fc.c | ||
16 | include/scsi/scsi_transport_fc.h | ||
17 | include/scsi/scsi_netlink_fc.h | ||
18 | |||
19 | This file is found at Documentation/scsi/scsi_fc_transport.txt | ||
20 | |||
21 | |||
22 | FC Remote Ports (rports) | ||
23 | ======================================================================== | ||
24 | << To Be Supplied >> | ||
25 | |||
26 | |||
27 | FC Virtual Ports (vports) | ||
28 | ======================================================================== | ||
29 | |||
30 | Overview: | ||
31 | ------------------------------- | ||
32 | |||
33 | New FC standards have defined mechanisms which allows for a single physical | ||
34 | port to appear on as multiple communication ports. Using the N_Port Id | ||
35 | Virtualization (NPIV) mechanism, a point-to-point connection to a Fabric | ||
36 | can be assigned more than 1 N_Port_ID. Each N_Port_ID appears as a | ||
37 | separate port to other endpoints on the fabric, even though it shares one | ||
38 | physical link to the switch for communication. Each N_Port_ID can have a | ||
39 | unique view of the fabric based on fabric zoning and array lun-masking | ||
40 | (just like a normal non-NPIV adapter). Using the Virtual Fabric (VF) | ||
41 | mechanism, adding a fabric header to each frame allows the port to | ||
42 | interact with the Fabric Port to join multiple fabrics. The port will | ||
43 | obtain an N_Port_ID on each fabric it joins. Each fabric will have its | ||
44 | own unique view of endpoints and configuration parameters. NPIV may be | ||
45 | used together with VF so that the port can obtain multiple N_Port_IDs | ||
46 | on each virtual fabric. | ||
47 | |||
48 | The FC transport is now recognizing a new object - a vport. A vport is | ||
49 | an entity that has a world-wide unique World Wide Port Name (wwpn) and | ||
50 | World Wide Node Name (wwnn). The transport also allows for the FC4's to | ||
51 | be specified for the vport, with FCP_Initiator being the primary role | ||
52 | expected. Once instantiated by one of the above methods, it will have a | ||
53 | distinct N_Port_ID and view of fabric endpoints and storage entities. | ||
54 | The fc_host associated with the physical adapter will export the ability | ||
55 | to create vports. The transport will create the vport object within the | ||
56 | Linux device tree, and instruct the fc_host's driver to instantiate the | ||
57 | virtual port. Typically, the driver will create a new scsi_host instance | ||
58 | on the vport, resulting in a unique <H,C,T,L> namespace for the vport. | ||
59 | Thus, whether a FC port is based on a physical port or on a virtual port, | ||
60 | each will appear as a unique scsi_host with its own target and lun space. | ||
61 | |||
62 | Note: At this time, the transport is written to create only NPIV-based | ||
63 | vports. However, consideration was given to VF-based vports and it | ||
64 | should be a minor change to add support if needed. The remaining | ||
65 | discussion will concentrate on NPIV. | ||
66 | |||
67 | Note: World Wide Name assignment (and uniqueness guarantees) are left | ||
68 | up to an administrative entity controling the vport. For example, | ||
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, | ||
71 | using it's own naming authority and OUI. (Note: it already does this | ||
72 | for virtual MAC addresses). | ||
73 | |||
74 | |||
75 | Device Trees and Vport Objects: | ||
76 | ------------------------------- | ||
77 | |||
78 | Today, the device tree typically contains the scsi_host object, | ||
79 | with rports and scsi target objects underneath it. Currently the FC | ||
80 | transport creates the vport object and places it under the scsi_host | ||
81 | object corresponding to the physical adapter. The LLDD will allocate | ||
82 | a new scsi_host for the vport and link it's object under the vport. | ||
83 | The remainder of the tree under the vports scsi_host is the same | ||
84 | as the non-NPIV case. The transport is written currently to easily | ||
85 | allow the parent of the vport to be something other than the scsi_host. | ||
86 | This could be used in the future to link the object onto a vm-specific | ||
87 | device tree. If the vport's parent is not the physical port's scsi_host, | ||
88 | a symbolic link to the vport object will be placed in the physical | ||
89 | port's scsi_host. | ||
90 | |||
91 | Here's what to expect in the device tree : | ||
92 | The typical Physical Port's Scsi_Host: | ||
93 | /sys/devices/.../host17/ | ||
94 | and it has the typical decendent tree: | ||
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: | ||
97 | /sys/devices/.../host17/vport-17:0-0 | ||
98 | and the vport's Scsi_Host is then created: | ||
99 | /sys/devices/.../host17/vport-17:0-0/host18 | ||
100 | and then the rest of the tree progresses, such as: | ||
101 | /sys/devices/.../host17/vport-17:0-0/host18/rport-18:0-0/target18:0:0/18:0:0:0: | ||
102 | |||
103 | Here's what to expect in the sysfs tree : | ||
104 | scsi_hosts: | ||
105 | /sys/class/scsi_host/host17 physical port's scsi_host | ||
106 | /sys/class/scsi_host/host18 vport's scsi_host | ||
107 | fc_hosts: | ||
108 | /sys/class/fc_host/host17 physical port's fc_host | ||
109 | /sys/class/fc_host/host18 vport's fc_host | ||
110 | fc_vports: | ||
111 | /sys/class/fc_vports/vport-17:0-0 the vport's fc_vport | ||
112 | fc_rports: | ||
113 | /sys/class/fc_remote_ports/rport-17:0-0 rport on the physical port | ||
114 | /sys/class/fc_remote_ports/rport-18:0-0 rport on the vport | ||
115 | |||
116 | |||
117 | Vport Attributes: | ||
118 | ------------------------------- | ||
119 | |||
120 | The new fc_vport class object has the following attributes | ||
121 | |||
122 | node_name: Read_Only | ||
123 | The WWNN of the vport | ||
124 | |||
125 | port_name: Read_Only | ||
126 | The WWPN of the vport | ||
127 | |||
128 | roles: Read_Only | ||
129 | Indicates the FC4 roles enabled on the vport. | ||
130 | |||
131 | symbolic_name: Read_Write | ||
132 | A string, appended to the driver's symbolic port name string, which | ||
133 | is registered with the switch to identify the vport. For example, | ||
134 | a hypervisor could set this string to "Xen Domain 2 VM 5 Vport 2", | ||
135 | and this set of identifiers can be seen on switch management screens | ||
136 | to identify the port. | ||
137 | |||
138 | vport_delete: Write_Only | ||
139 | When written with a "1", will tear down the vport. | ||
140 | |||
141 | vport_disable: Write_Only | ||
142 | When written with a "1", will transition the vport to a disabled. | ||
143 | state. The vport will still be instantiated with the Linux kernel, | ||
144 | but it will not be active on the FC link. | ||
145 | When written with a "0", will enable the vport. | ||
146 | |||
147 | vport_last_state: Read_Only | ||
148 | Indicates the previous state of the vport. See the section below on | ||
149 | "Vport States". | ||
150 | |||
151 | vport_state: Read_Only | ||
152 | Indicates the state of the vport. See the section below on | ||
153 | "Vport States". | ||
154 | |||
155 | vport_type: Read_Only | ||
156 | Reflects the FC mechanism used to create the virtual port. | ||
157 | Only NPIV is supported currently. | ||
158 | |||
159 | |||
160 | For the fc_host class object, the following attributes are added for vports: | ||
161 | |||
162 | max_npiv_vports: Read_Only | ||
163 | Indicates the maximum number of NPIV-based vports that the | ||
164 | driver/adapter can support on the fc_host. | ||
165 | |||
166 | npiv_vports_inuse: Read_Only | ||
167 | Indicates how many NPIV-based vports have been instantiated on the | ||
168 | fc_host. | ||
169 | |||
170 | vport_create: Write_Only | ||
171 | A "simple" create interface to instantiate a vport on an fc_host. | ||
172 | A "<WWPN>:<WWNN>" string is written to the attribute. The transport | ||
173 | then instantiates the vport object and calls the LLDD to create the | ||
174 | vport with the role of FCP_Initiator. Each WWN is specified as 16 | ||
175 | hex characters and may *not* contain any prefixes (e.g. 0x, x, etc). | ||
176 | |||
177 | vport_delete: Write_Only | ||
178 | A "simple" delete interface to teardown a vport. A "<WWPN>:<WWNN>" | ||
179 | string is written to the attribute. The transport will locate the | ||
180 | vport on the fc_host with the same WWNs and tear it down. Each WWN | ||
181 | is specified as 16 hex characters and may *not* contain any prefixes | ||
182 | (e.g. 0x, x, etc). | ||
183 | |||
184 | |||
185 | Vport States: | ||
186 | ------------------------------- | ||
187 | |||
188 | Vport instantiation consists of two parts: | ||
189 | - Creation with the kernel and LLDD. This means all transport and | ||
190 | driver data structures are built up, and device objects created. | ||
191 | This is equivalent to a driver "attach" on an adapter, which is | ||
192 | independent of the adapter's link state. | ||
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. | ||
195 | Futher information can be found in the interfaces section below for | ||
196 | Vport Creation. | ||
197 | |||
198 | Once a vport has been instantiated with the kernel/LLDD, a vport state | ||
199 | can be reported via the sysfs attribute. The following states exist: | ||
200 | |||
201 | FC_VPORT_UNKNOWN - Unknown | ||
202 | An temporary state, typically set only while the vport is being | ||
203 | instantiated with the kernel and LLDD. | ||
204 | |||
205 | FC_VPORT_ACTIVE - Active | ||
206 | The vport has been successfully been created on the FC link. | ||
207 | It is fully functional. | ||
208 | |||
209 | FC_VPORT_DISABLED - Disabled | ||
210 | The vport instantiated, but "disabled". The vport is not instantiated | ||
211 | on the FC link. This is equivalent to a physical port with the | ||
212 | link "down". | ||
213 | |||
214 | FC_VPORT_LINKDOWN - Linkdown | ||
215 | The vport is not operational as the physical link is not operational. | ||
216 | |||
217 | FC_VPORT_INITIALIZING - Initializing | ||
218 | The vport is in the process of instantiating on the FC link. | ||
219 | The LLDD will set this state just prior to starting the ELS traffic | ||
220 | to create the vport. This state will persist until the vport is | ||
221 | successfully created (state becomes FC_VPORT_ACTIVE) or it fails | ||
222 | (state is one of the values below). As this state is transitory, | ||
223 | it will not be preserved in the "vport_last_state". | ||
224 | |||
225 | FC_VPORT_NO_FABRIC_SUPP - No Fabric Support | ||
226 | The vport is not operational. One of the following conditions were | ||
227 | encountered: | ||
228 | - The FC topology is not Point-to-Point | ||
229 | - The FC port is not connected to an F_Port | ||
230 | - The F_Port has indicated that NPIV is not supported. | ||
231 | |||
232 | FC_VPORT_NO_FABRIC_RSCS - No Fabric Resources | ||
233 | The vport is not operational. The Fabric failed FDISC with a status | ||
234 | indicating that it does not have sufficient resources to complete | ||
235 | the operation. | ||
236 | |||
237 | FC_VPORT_FABRIC_LOGOUT - Fabric Logout | ||
238 | The vport is not operational. The Fabric has LOGO'd the N_Port_ID | ||
239 | associated with the vport. | ||
240 | |||
241 | FC_VPORT_FABRIC_REJ_WWN - Fabric Rejected WWN | ||
242 | The vport is not operational. The Fabric failed FDISC with a status | ||
243 | indicating that the WWN's are not valid. | ||
244 | |||
245 | FC_VPORT_FAILED - VPort Failed | ||
246 | The vport is not operational. This is a catchall for all other | ||
247 | error conditions. | ||
248 | |||
249 | |||
250 | The following state table indicates the different state transitions: | ||
251 | |||
252 | State Event New State | ||
253 | -------------------------------------------------------------------- | ||
254 | n/a Initialization Unknown | ||
255 | Unknown: Link Down Linkdown | ||
256 | Link Up & Loop No Fabric Support | ||
257 | Link Up & no Fabric No Fabric Support | ||
258 | Link Up & FLOGI response No Fabric Support | ||
259 | indicates no NPIV support | ||
260 | Link Up & FDISC being sent Initializing | ||
261 | Disable request Disable | ||
262 | Linkdown: Link Up Unknown | ||
263 | Initializing: FDISC ACC Active | ||
264 | FDISC LS_RJT w/ no resources No Fabric Resources | ||
265 | FDISC LS_RJT w/ invalid Fabric Rejected WWN | ||
266 | pname or invalid nport_id | ||
267 | FDISC LS_RJT failed for Vport Failed | ||
268 | other reasons | ||
269 | Link Down Linkdown | ||
270 | Disable request Disable | ||
271 | Disable: Enable request Unknown | ||
272 | Active: LOGO received from fabric Fabric Logout | ||
273 | Link Down Linkdown | ||
274 | Disable request Disable | ||
275 | Fabric Logout: Link still up Unknown | ||
276 | |||
277 | The following 4 error states all have the same transitions: | ||
278 | No Fabric Support: | ||
279 | No Fabric Resources: | ||
280 | Fabric Rejected WWN: | ||
281 | Vport Failed: | ||
282 | Disable request Disable | ||
283 | Link goes down Linkdown | ||
284 | |||
285 | |||
286 | Transport <-> LLDD Interfaces : | ||
287 | ------------------------------- | ||
288 | |||
289 | Vport support by LLDD: | ||
290 | |||
291 | The LLDD indicates support for vports by supplying a vport_create() | ||
292 | function in the transport template. The presense of this function will | ||
293 | cause the creation of the new attributes on the fc_host. As part of | ||
294 | the physical port completing its initialization relative to the | ||
295 | transport, it should set the max_npiv_vports attribute to indicate the | ||
296 | maximum number of vports the driver and/or adapter supports. | ||
297 | |||
298 | |||
299 | Vport Creation: | ||
300 | |||
301 | The LLDD vport_create() syntax is: | ||
302 | |||
303 | int vport_create(struct fc_vport *vport, bool disable) | ||
304 | |||
305 | where: | ||
306 | vport: Is the newly allocated vport object | ||
307 | disable: If "true", the vport is to be created in a disabled stated. | ||
308 | If "false", the vport is to be enabled upon creation. | ||
309 | |||
310 | When a request is made to create a new vport (via sgio/netlink, or the | ||
311 | vport_create fc_host attribute), the transport will validate that the LLDD | ||
312 | can support another vport (e.g. max_npiv_vports > npiv_vports_inuse). | ||
313 | If not, the create request will be failed. If space remains, the transport | ||
314 | will increment the vport count, create the vport object, and then call the | ||
315 | LLDD's vport_create() function with the newly allocated vport object. | ||
316 | |||
317 | As mentioned above, vport creation is divided into two parts: | ||
318 | - Creation with the kernel and LLDD. This means all transport and | ||
319 | driver data structures are built up, and device objects created. | ||
320 | This is equivalent to a driver "attach" on an adapter, which is | ||
321 | independent of the adapter's link state. | ||
322 | - Instantiation of the vport on the FC link via ELS traffic, etc. | ||
323 | This is equivalent to a "link up" and successfull link initialization. | ||
324 | |||
325 | The LLDD's vport_create() function will not synchronously wait for both | ||
326 | parts to be fully completed before returning. It must validate that the | ||
327 | infrastructure exists to support NPIV, and complete the first part of | ||
328 | vport creation (data structure build up) before returning. We do not | ||
329 | hinge vport_create() on the link-side operation mainly because: | ||
330 | - The link may be down. It is not a failure if it is. It simply | ||
331 | means the vport is in an inoperable state until the link comes up. | ||
332 | This is consistent with the link bouncing post vport creation. | ||
333 | - The vport may be created in a disabled state. | ||
334 | - This is consistent with a model where: the vport equates to a | ||
335 | FC adapter. The vport_create is synonymous with driver attachment | ||
336 | to the adapter, which is independent of link state. | ||
337 | |||
338 | Note: special error codes have been defined to delineate infrastructure | ||
339 | failure cases for quicker resolution. | ||
340 | |||
341 | The expected behavior for the LLDD's vport_create() function is: | ||
342 | - Validate Infrastructure: | ||
343 | - If the driver or adapter cannot support another vport, whether | ||
344 | due to improper firmware, (a lie about) max_npiv, or a lack of | ||
345 | some other resource - return VPCERR_UNSUPPORTED. | ||
346 | - If the driver validates the WWN's against those already active on | ||
347 | the adapter and detects an overlap - return VPCERR_BAD_WWN. | ||
348 | - If the driver detects the topology is loop, non-fabric, or the | ||
349 | FLOGI did not support NPIV - return VPCERR_NO_FABRIC_SUPP. | ||
350 | - Allocate data structures. If errors are encountered, such as out | ||
351 | of memory conditions, return the respective negative Exxx error code. | ||
352 | - If the role is FCP Initiator, the LLDD is to : | ||
353 | - Call scsi_host_alloc() to allocate a scsi_host for the vport. | ||
354 | - Call scsi_add_host(new_shost, &vport->dev) to start the scsi_host | ||
355 | and bind it as a child of the vport device. | ||
356 | - Initializes the fc_host attribute values. | ||
357 | - Kick of further vport state transitions based on the disable flag and | ||
358 | link state - and return success (zero). | ||
359 | |||
360 | LLDD Implementers Notes: | ||
361 | - It is suggested that there be a different fc_function_templates for | ||
362 | the physical port and the virtual port. The physical port's template | ||
363 | would have the vport_create, vport_delete, and vport_disable functions, | ||
364 | while the vports would not. | ||
365 | - It is suggested that there be different scsi_host_templates | ||
366 | for the physical port and virtual port. Likely, there are driver | ||
367 | attributes, embedded into the scsi_host_template, that are applicable | ||
368 | for the physical port only (link speed, topology setting, etc). This | ||
369 | ensures that the attributes are applicable to the respective scsi_host. | ||
370 | |||
371 | |||
372 | Vport Disable/Enable: | ||
373 | |||
374 | The LLDD vport_disable() syntax is: | ||
375 | |||
376 | int vport_disable(struct fc_vport *vport, bool disable) | ||
377 | |||
378 | where: | ||
379 | vport: Is vport to to be enabled or disabled | ||
380 | disable: If "true", the vport is to be disabled. | ||
381 | If "false", the vport is to be enabled. | ||
382 | |||
383 | When a request is made to change the disabled state on a vport, the | ||
384 | transport will validate the request against the existing vport state. | ||
385 | If the request is to disable and the vport is already disabled, the | ||
386 | request will fail. Similarly, if the request is to enable, and the | ||
387 | vport is not in a disabled state, the request will fail. If the request | ||
388 | is valid for the vport state, the transport will call the LLDD to | ||
389 | change the vport's state. | ||
390 | |||
391 | Within the LLDD, if a vport is disabled, it remains instantiated with | ||
392 | the kernel and LLDD, but it is not active or visible on the FC link in | ||
393 | any way. (see Vport Creation and the 2 part instantiation discussion). | ||
394 | The vport will remain in this state until it is deleted or re-enabled. | ||
395 | When enabling a vport, the LLDD reinstantiates the vport on the FC | ||
396 | link - essentially restarting the LLDD statemachine (see Vport States | ||
397 | above). | ||
398 | |||
399 | |||
400 | Vport Deletion: | ||
401 | |||
402 | The LLDD vport_delete() syntax is: | ||
403 | |||
404 | int vport_delete(struct fc_vport *vport) | ||
405 | |||
406 | where: | ||
407 | vport: Is vport to delete | ||
408 | |||
409 | When a request is made to delete a vport (via sgio/netlink, or via the | ||
410 | fc_host or fc_vport vport_delete attributes), the transport will call | ||
411 | the LLDD to terminate the vport on the FC link, and teardown all other | ||
412 | datastructures and references. If the LLDD completes successfully, | ||
413 | the transport will teardown the vport objects and complete the vport | ||
414 | removal. If the LLDD delete request fails, the vport object will remain, | ||
415 | but will be in an indeterminate state. | ||
416 | |||
417 | Within the LLDD, the normal code paths for a scsi_host teardown should | ||
418 | be followed. E.g. If the vport has a FCP Initiator role, the LLDD | ||
419 | will call fc_remove_host() for the vports scsi_host, followed by | ||
420 | scsi_remove_host() and scsi_host_put() for the vports scsi_host. | ||
421 | |||
422 | |||
423 | Other: | ||
424 | fc_host port_type attribute: | ||
425 | There is a new fc_host port_type value - FC_PORTTYPE_NPIV. This value | ||
426 | must be set on all vport-based fc_hosts. Normally, on a physical port, | ||
427 | the port_type attribute would be set to NPORT, NLPORT, etc based on the | ||
428 | topology type and existence of the fabric. As this is not applicable to | ||
429 | a vport, it makes more sense to report the FC mechanism used to create | ||
430 | the vport. | ||
431 | |||
432 | Driver unload: | ||
433 | FC drivers are required to call fc_remove_host() prior to calling | ||
434 | scsi_remove_host(). This allows the fc_host to tear down all remote | ||
435 | ports prior the scsi_host being torn down. The fc_remove_host() call | ||
436 | was updated to remove all vports for the fc_host as well. | ||
437 | |||
438 | |||
439 | Credits | ||
440 | ======= | ||
441 | The following people have contributed to this document: | ||
442 | |||
443 | |||
444 | |||
445 | |||
446 | |||
447 | |||
448 | James Smart | ||
449 | james.smart@emulex.com | ||
450 | |||
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt index 355ff0a2bb7c..241e26c4ff92 100644 --- a/Documentation/sound/alsa/ALSA-Configuration.txt +++ b/Documentation/sound/alsa/ALSA-Configuration.txt | |||
@@ -467,7 +467,12 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
467 | above explicitly. | 467 | above explicitly. |
468 | 468 | ||
469 | The power-management is supported. | 469 | The power-management is supported. |
470 | 470 | ||
471 | Module snd-cs5530 | ||
472 | _________________ | ||
473 | |||
474 | Module for Cyrix/NatSemi Geode 5530 chip. | ||
475 | |||
471 | Module snd-cs5535audio | 476 | Module snd-cs5535audio |
472 | ---------------------- | 477 | ---------------------- |
473 | 478 | ||
@@ -759,6 +764,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
759 | 764 | ||
760 | model - force the model name | 765 | model - force the model name |
761 | position_fix - Fix DMA pointer (0 = auto, 1 = none, 2 = POSBUF, 3 = FIFO size) | 766 | position_fix - Fix DMA pointer (0 = auto, 1 = none, 2 = POSBUF, 3 = FIFO size) |
767 | probe_mask - Bitmask to probe codecs (default = -1, meaning all slots) | ||
762 | single_cmd - Use single immediate commands to communicate with | 768 | single_cmd - Use single immediate commands to communicate with |
763 | codecs (for debugging only) | 769 | codecs (for debugging only) |
764 | enable_msi - Enable Message Signaled Interrupt (MSI) (default = off) | 770 | enable_msi - Enable Message Signaled Interrupt (MSI) (default = off) |
@@ -803,6 +809,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
803 | hp-3013 HP machines (3013-variant) | 809 | hp-3013 HP machines (3013-variant) |
804 | fujitsu Fujitsu S7020 | 810 | fujitsu Fujitsu S7020 |
805 | acer Acer TravelMate | 811 | acer Acer TravelMate |
812 | will Will laptops (PB V7900) | ||
813 | replacer Replacer 672V | ||
806 | basic fixed pin assignment (old default model) | 814 | basic fixed pin assignment (old default model) |
807 | auto auto-config reading BIOS (default) | 815 | auto auto-config reading BIOS (default) |
808 | 816 | ||
@@ -811,16 +819,31 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
811 | hp-bpc HP xw4400/6400/8400/9400 laptops | 819 | hp-bpc HP xw4400/6400/8400/9400 laptops |
812 | hp-bpc-d7000 HP BPC D7000 | 820 | hp-bpc-d7000 HP BPC D7000 |
813 | benq Benq ED8 | 821 | benq Benq ED8 |
822 | benq-t31 Benq T31 | ||
814 | hippo Hippo (ATI) with jack detection, Sony UX-90s | 823 | hippo Hippo (ATI) with jack detection, Sony UX-90s |
815 | hippo_1 Hippo (Benq) with jack detection | 824 | hippo_1 Hippo (Benq) with jack detection |
825 | sony-assamd Sony ASSAMD | ||
816 | basic fixed pin assignment w/o SPDIF | 826 | basic fixed pin assignment w/o SPDIF |
817 | auto auto-config reading BIOS (default) | 827 | auto auto-config reading BIOS (default) |
818 | 828 | ||
829 | ALC268 | ||
830 | 3stack 3-stack model | ||
831 | auto auto-config reading BIOS (default) | ||
832 | |||
833 | ALC662 | ||
834 | 3stack-dig 3-stack (2-channel) with SPDIF | ||
835 | 3stack-6ch 3-stack (6-channel) | ||
836 | 3stack-6ch-dig 3-stack (6-channel) with SPDIF | ||
837 | 6stack-dig 6-stack with SPDIF | ||
838 | lenovo-101e Lenovo laptop | ||
839 | auto auto-config reading BIOS (default) | ||
840 | |||
819 | ALC882/885 | 841 | ALC882/885 |
820 | 3stack-dig 3-jack with SPDIF I/O | 842 | 3stack-dig 3-jack with SPDIF I/O |
821 | 6stack-dig 6-jack digital with SPDIF I/O | 843 | 6stack-dig 6-jack digital with SPDIF I/O |
822 | arima Arima W820Di1 | 844 | arima Arima W820Di1 |
823 | macpro MacPro support | 845 | macpro MacPro support |
846 | imac24 iMac 24'' with jack detection | ||
824 | w2jc ASUS W2JC | 847 | w2jc ASUS W2JC |
825 | auto auto-config reading BIOS (default) | 848 | auto auto-config reading BIOS (default) |
826 | 849 | ||
@@ -832,9 +855,15 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
832 | 6stack-dig-demo 6-jack digital for Intel demo board | 855 | 6stack-dig-demo 6-jack digital for Intel demo board |
833 | acer Acer laptops (Travelmate 3012WTMi, Aspire 5600, etc) | 856 | acer Acer laptops (Travelmate 3012WTMi, Aspire 5600, etc) |
834 | medion Medion Laptops | 857 | medion Medion Laptops |
858 | medion-md2 Medion MD2 | ||
835 | targa-dig Targa/MSI | 859 | targa-dig Targa/MSI |
836 | targa-2ch-dig Targs/MSI with 2-channel | 860 | targa-2ch-dig Targs/MSI with 2-channel |
837 | laptop-eapd 3-jack with SPDIF I/O and EAPD (Clevo M540JE, M550JE) | 861 | laptop-eapd 3-jack with SPDIF I/O and EAPD (Clevo M540JE, M550JE) |
862 | lenovo-101e Lenovo 101E | ||
863 | lenovo-nb0763 Lenovo NB0763 | ||
864 | lenovo-ms7195-dig Lenovo MS7195 | ||
865 | 6stack-hp HP machines with 6stack (Nettle boards) | ||
866 | 3stack-hp HP machines with 3stack (Lucknow, Samba boards) | ||
838 | auto auto-config reading BIOS (default) | 867 | auto auto-config reading BIOS (default) |
839 | 868 | ||
840 | ALC861/660 | 869 | ALC861/660 |
@@ -853,7 +882,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
853 | 3stack-dig 3-jack with SPDIF OUT | 882 | 3stack-dig 3-jack with SPDIF OUT |
854 | 6stack-dig 6-jack with SPDIF OUT | 883 | 6stack-dig 6-jack with SPDIF OUT |
855 | 3stack-660 3-jack (for ALC660VD) | 884 | 3stack-660 3-jack (for ALC660VD) |
885 | 3stack-660-digout 3-jack with SPDIF OUT (for ALC660VD) | ||
856 | lenovo Lenovo 3000 C200 | 886 | lenovo Lenovo 3000 C200 |
887 | dallas Dallas laptops | ||
857 | auto auto-config reading BIOS (default) | 888 | auto auto-config reading BIOS (default) |
858 | 889 | ||
859 | CMI9880 | 890 | CMI9880 |
@@ -864,12 +895,26 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
864 | allout 5-jack in back, 2-jack in front, SPDIF out | 895 | allout 5-jack in back, 2-jack in front, SPDIF out |
865 | auto auto-config reading BIOS (default) | 896 | auto auto-config reading BIOS (default) |
866 | 897 | ||
898 | AD1882 | ||
899 | 3stack 3-stack mode (default) | ||
900 | 6stack 6-stack mode | ||
901 | |||
902 | AD1884 | ||
903 | N/A | ||
904 | |||
867 | AD1981 | 905 | AD1981 |
868 | basic 3-jack (default) | 906 | basic 3-jack (default) |
869 | hp HP nx6320 | 907 | hp HP nx6320 |
870 | thinkpad Lenovo Thinkpad T60/X60/Z60 | 908 | thinkpad Lenovo Thinkpad T60/X60/Z60 |
871 | toshiba Toshiba U205 | 909 | toshiba Toshiba U205 |
872 | 910 | ||
911 | AD1983 | ||
912 | N/A | ||
913 | |||
914 | AD1984 | ||
915 | basic default configuration | ||
916 | thinkpad Lenovo Thinkpad T61/X61 | ||
917 | |||
873 | AD1986A | 918 | AD1986A |
874 | 6stack 6-jack, separate surrounds (default) | 919 | 6stack 6-jack, separate surrounds (default) |
875 | 3stack 3-stack, shared surrounds | 920 | 3stack 3-stack, shared surrounds |
@@ -907,11 +952,18 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
907 | ref Reference board | 952 | ref Reference board |
908 | 3stack D945 3stack | 953 | 3stack D945 3stack |
909 | 5stack D945 5stack + SPDIF | 954 | 5stack D945 5stack + SPDIF |
910 | macmini Intel Mac Mini | 955 | dell Dell XPS M1210 |
911 | macbook Intel Mac Book | 956 | intel-mac-v1 Intel Mac Type 1 |
912 | macbook-pro-v1 Intel Mac Book Pro 1st generation | 957 | intel-mac-v2 Intel Mac Type 2 |
913 | macbook-pro Intel Mac Book Pro 2nd generation | 958 | intel-mac-v3 Intel Mac Type 3 |
914 | imac-intel Intel iMac | 959 | intel-mac-v4 Intel Mac Type 4 |
960 | intel-mac-v5 Intel Mac Type 5 | ||
961 | macmini Intel Mac Mini (equivalent with type 3) | ||
962 | macbook Intel Mac Book (eq. type 5) | ||
963 | macbook-pro-v1 Intel Mac Book Pro 1st generation (eq. type 3) | ||
964 | macbook-pro Intel Mac Book Pro 2nd generation (eq. type 3) | ||
965 | imac-intel Intel iMac (eq. type 2) | ||
966 | imac-intel-20 Intel iMac (newer version) (eq. type 3) | ||
915 | 967 | ||
916 | STAC9202/9250/9251 | 968 | STAC9202/9250/9251 |
917 | ref Reference board, base config | 969 | ref Reference board, base config |
@@ -956,6 +1008,17 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
956 | from the irq. Remember this is a last resort, and should be | 1008 | from the irq. Remember this is a last resort, and should be |
957 | avoided as much as possible... | 1009 | avoided as much as possible... |
958 | 1010 | ||
1011 | MORE NOTES ON "azx_get_response timeout" PROBLEMS: | ||
1012 | On some hardwares, you may need to add a proper probe_mask option | ||
1013 | to avoid the "azx_get_response timeout" problem above, instead. | ||
1014 | This occurs when the access to non-existing or non-working codec slot | ||
1015 | (likely a modem one) causes a stall of the communication via HD-audio | ||
1016 | bus. You can see which codec slots are probed by enabling | ||
1017 | CONFIG_SND_DEBUG_DETECT, or simply from the file name of the codec | ||
1018 | proc files. Then limit the slots to probe by probe_mask option. | ||
1019 | For example, probe_mask=1 means to probe only the first slot, and | ||
1020 | probe_mask=4 means only the third slot. | ||
1021 | |||
959 | The power-management is supported. | 1022 | The power-management is supported. |
960 | 1023 | ||
961 | Module snd-hdsp | 1024 | Module snd-hdsp |
diff --git a/Documentation/sound/alsa/Audiophile-Usb.txt b/Documentation/sound/alsa/Audiophile-Usb.txt index e40cce83327c..2ad5e6306c44 100644 --- a/Documentation/sound/alsa/Audiophile-Usb.txt +++ b/Documentation/sound/alsa/Audiophile-Usb.txt | |||
@@ -1,4 +1,4 @@ | |||
1 | Guide to using M-Audio Audiophile USB with ALSA and Jack v1.3 | 1 | Guide to using M-Audio Audiophile USB with ALSA and Jack v1.5 |
2 | ======================================================== | 2 | ======================================================== |
3 | 3 | ||
4 | Thibault Le Meur <Thibault.LeMeur@supelec.fr> | 4 | Thibault Le Meur <Thibault.LeMeur@supelec.fr> |
@@ -6,8 +6,19 @@ | |||
6 | This document is a guide to using the M-Audio Audiophile USB (tm) device with | 6 | This document is a guide to using the M-Audio Audiophile USB (tm) device with |
7 | ALSA and JACK. | 7 | ALSA and JACK. |
8 | 8 | ||
9 | History | ||
10 | ======= | ||
11 | * v1.4 - Thibault Le Meur (2007-07-11) | ||
12 | - Added Low Endianness nature of 16bits-modes | ||
13 | found by Hakan Lennestal <Hakan.Lennestal@brfsodrahamn.se> | ||
14 | - Modifying document structure | ||
15 | * v1.5 - Thibault Le Meur (2007-07-12) | ||
16 | - Added AC3/DTS passthru info | ||
17 | |||
18 | |||
9 | 1 - Audiophile USB Specs and correct usage | 19 | 1 - Audiophile USB Specs and correct usage |
10 | ========================================== | 20 | ========================================== |
21 | |||
11 | This part is a reminder of important facts about the functions and limitations | 22 | This part is a reminder of important facts about the functions and limitations |
12 | of the device. | 23 | of the device. |
13 | 24 | ||
@@ -25,18 +36,18 @@ The device has 4 audio interfaces, and 2 MIDI ports: | |||
25 | The internal DAC/ADC has the following characteristics: | 36 | The internal DAC/ADC has the following characteristics: |
26 | * sample depth of 16 or 24 bits | 37 | * sample depth of 16 or 24 bits |
27 | * sample rate from 8kHz to 96kHz | 38 | * sample rate from 8kHz to 96kHz |
28 | * Two ports can't use different sample depths at the same time. Moreover, the | 39 | * Two interfaces can't use different sample depths at the same time. |
29 | Audiophile USB documentation gives the following Warning: "Please exit any | 40 | Moreover, the Audiophile USB documentation gives the following Warning: |
30 | audio application running before switching between bit depths" | 41 | "Please exit any audio application running before switching between bit depths" |
31 | 42 | ||
32 | Due to the USB 1.1 bandwidth limitation, a limited number of interfaces can be | 43 | Due to the USB 1.1 bandwidth limitation, a limited number of interfaces can be |
33 | activated at the same time depending on the audio mode selected: | 44 | activated at the same time depending on the audio mode selected: |
34 | * 16-bit/48kHz ==> 4 channels in/4 channels out | 45 | * 16-bit/48kHz ==> 4 channels in + 4 channels out |
35 | - Ai+Ao+Di+Do | 46 | - Ai+Ao+Di+Do |
36 | * 24-bit/48kHz ==> 4 channels in/2 channels out, | 47 | * 24-bit/48kHz ==> 4 channels in + 2 channels out, |
37 | or 2 channels in/4 channels out | 48 | or 2 channels in + 4 channels out |
38 | - Ai+Ao+Do or Ai+Di+Ao or Ai+Di+Do or Di+Ao+Do | 49 | - Ai+Ao+Do or Ai+Di+Ao or Ai+Di+Do or Di+Ao+Do |
39 | * 24-bit/96kHz ==> 2 channels in, or 2 channels out (half duplex only) | 50 | * 24-bit/96kHz ==> 2 channels in _or_ 2 channels out (half duplex only) |
40 | - Ai or Ao or Di or Do | 51 | - Ai or Ao or Di or Do |
41 | 52 | ||
42 | Important facts about the Digital interface: | 53 | Important facts about the Digital interface: |
@@ -52,44 +63,56 @@ source is connected | |||
52 | synchronization error (for instance sound played at an odd sample rate) | 63 | synchronization error (for instance sound played at an odd sample rate) |
53 | 64 | ||
54 | 65 | ||
55 | 2 - Audiophile USB support in ALSA | 66 | 2 - Audiophile USB MIDI support in ALSA |
56 | ================================== | 67 | ======================================= |
57 | 68 | ||
58 | 2.1 - MIDI ports | 69 | The Audiophile USB MIDI ports will be automatically supported once the |
59 | ---------------- | ||
60 | The Audiophile USB MIDI ports will be automatically supported once the | ||
61 | following modules have been loaded: | 70 | following modules have been loaded: |
62 | * snd-usb-audio | 71 | * snd-usb-audio |
63 | * snd-seq-midi | 72 | * snd-seq-midi |
64 | 73 | ||
65 | No additional setting is required. | 74 | No additional setting is required. |
66 | 75 | ||
67 | 2.2 - Audio ports | 76 | |
68 | ----------------- | 77 | 3 - Audiophile USB Audio support in ALSA |
78 | ======================================== | ||
69 | 79 | ||
70 | Audio functions of the Audiophile USB device are handled by the snd-usb-audio | 80 | Audio functions of the Audiophile USB device are handled by the snd-usb-audio |
71 | module. This module can work in a default mode (without any device-specific | 81 | module. This module can work in a default mode (without any device-specific |
72 | parameter), or in an "advanced" mode with the device-specific parameter called | 82 | parameter), or in an "advanced" mode with the device-specific parameter called |
73 | "device_setup". | 83 | "device_setup". |
74 | 84 | ||
75 | 2.2.1 - Default Alsa driver mode | 85 | 3.1 - Default Alsa driver mode |
76 | 86 | ------------------------------ | |
77 | The default behavior of the snd-usb-audio driver is to parse the device | 87 | |
78 | capabilities at startup and enable all functions inside the device (including | 88 | The default behavior of the snd-usb-audio driver is to list the device |
79 | all ports at any supported sample rates and sample depths). This approach | 89 | capabilities at startup and activate the required mode when required |
80 | has the advantage to let the driver easily switch from sample rates/depths | 90 | by the applications: for instance if the user is recording in a |
81 | automatically according to the need of the application claiming the device. | 91 | 24bit-depth-mode and immediately after wants to switch to a 16bit-depth mode, |
82 | 92 | the snd-usb-audio module will reconfigure the device on the fly. | |
83 | In this case the Audiophile ports are mapped to alsa pcm devices in the | 93 | |
84 | following way (I suppose the device's index is 1): | 94 | This approach has the advantage to let the driver automatically switch from sample |
95 | rates/depths automatically according to the user's needs. However, those who | ||
96 | are using the device under windows know that this is not how the device is meant to | ||
97 | work: under windows applications must be closed before using the m-audio control | ||
98 | panel to switch the device working mode. Thus as we'll see in next section, this | ||
99 | Default Alsa driver mode can lead to device misconfigurations. | ||
100 | |||
101 | Let's get back to the Default Alsa driver mode for now. In this case the | ||
102 | Audiophile interfaces are mapped to alsa pcm devices in the following | ||
103 | way (I suppose the device's index is 1): | ||
85 | * hw:1,0 is Ao in playback and Di in capture | 104 | * hw:1,0 is Ao in playback and Di in capture |
86 | * hw:1,1 is Do in playback and Ai in capture | 105 | * hw:1,1 is Do in playback and Ai in capture |
87 | * hw:1,2 is Do in AC3/DTS passthrough mode | 106 | * hw:1,2 is Do in AC3/DTS passthrough mode |
88 | 107 | ||
89 | You must note as well that the device uses Big Endian byte encoding so that | 108 | In this mode, the device uses Big Endian byte-encoding so that |
90 | supported audio format are S16_BE for 16-bit depth modes and S24_3BE for | 109 | supported audio format are S16_BE for 16-bit depth modes and S24_3BE for |
91 | 24-bits depth mode. One exception is the hw:1,2 port which is Little Endian | 110 | 24-bits depth mode. |
92 | compliant and thus uses S16_LE. | 111 | |
112 | One exception is the hw:1,2 port which was reported to be Little Endian | ||
113 | compliant (supposedly supporting S16_LE) but processes in fact only S16_BE streams. | ||
114 | This has been fixed in kernel 2.6.23 and above and now the hw:1,2 interface | ||
115 | is reported to be big endian in this default driver mode. | ||
93 | 116 | ||
94 | Examples: | 117 | Examples: |
95 | * playing a S24_3BE encoded raw file to the Ao port | 118 | * playing a S24_3BE encoded raw file to the Ao port |
@@ -98,22 +121,26 @@ Examples: | |||
98 | % arecord -D hw:1,1 -c2 -t raw -r48000 -fS24_3BE test.raw | 121 | % arecord -D hw:1,1 -c2 -t raw -r48000 -fS24_3BE test.raw |
99 | * playing a S16_BE encoded raw file to the Do port | 122 | * playing a S16_BE encoded raw file to the Do port |
100 | % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_BE test.raw | 123 | % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_BE test.raw |
124 | * playing an ac3 sample file to the Do port | ||
125 | % aplay -D hw:1,2 --channels=6 ac3_S16_BE_encoded_file.raw | ||
101 | 126 | ||
102 | If you're happy with the default Alsa driver setup and don't experience any | 127 | If you're happy with the default Alsa driver mode and don't experience any |
103 | issue with this mode, then you can skip the following chapter. | 128 | issue with this mode, then you can skip the following chapter. |
104 | 129 | ||
105 | 2.2.2 - Advanced module setup | 130 | 3.2 - Advanced module setup |
131 | --------------------------- | ||
106 | 132 | ||
107 | Due to the hardware constraints described above, the device initialization made | 133 | Due to the hardware constraints described above, the device initialization made |
108 | by the Alsa driver in default mode may result in a corrupted state of the | 134 | by the Alsa driver in default mode may result in a corrupted state of the |
109 | device. For instance, a particularly annoying issue is that the sound captured | 135 | device. For instance, a particularly annoying issue is that the sound captured |
110 | from the Ai port sounds distorted (as if boosted with an excessive high volume | 136 | from the Ai interface sounds distorted (as if boosted with an excessive high |
111 | gain). | 137 | volume gain). |
112 | 138 | ||
113 | For people having this problem, the snd-usb-audio module has a new module | 139 | For people having this problem, the snd-usb-audio module has a new module |
114 | parameter called "device_setup". | 140 | parameter called "device_setup" (this parameter was introduced in kernel |
141 | release 2.6.17) | ||
115 | 142 | ||
116 | 2.2.2.1 - Initializing the working mode of the Audiophile USB | 143 | 3.2.1 - Initializing the working mode of the Audiophile USB |
117 | 144 | ||
118 | As far as the Audiophile USB device is concerned, this value let the user | 145 | As far as the Audiophile USB device is concerned, this value let the user |
119 | specify: | 146 | specify: |
@@ -121,33 +148,57 @@ specify: | |||
121 | * the sample rate | 148 | * the sample rate |
122 | * whether the Di port is used or not | 149 | * whether the Di port is used or not |
123 | 150 | ||
124 | Here is a list of supported device_setup values for this device: | 151 | When initialized with "device_setup=0x00", the snd-usb-audio module has |
125 | * device_setup=0x00 (or omitted) | 152 | the same behaviour as when the parameter is omitted (see paragraph "Default |
126 | - Alsa driver default mode | 153 | Alsa driver mode" above) |
127 | - maintains backward compatibility with setups that do not use this | 154 | |
128 | parameter by not introducing any change | 155 | Others modes are described in the following subsections. |
129 | - results sometimes in corrupted sound as described earlier | 156 | |
157 | 3.2.1.1 - 16-bit modes | ||
158 | |||
159 | The two supported modes are: | ||
160 | |||
130 | * device_setup=0x01 | 161 | * device_setup=0x01 |
131 | - 16bits 48kHz mode with Di disabled | 162 | - 16bits 48kHz mode with Di disabled |
132 | - Ai,Ao,Do can be used at the same time | 163 | - Ai,Ao,Do can be used at the same time |
133 | - hw:1,0 is not available in capture mode | 164 | - hw:1,0 is not available in capture mode |
134 | - hw:1,2 is not available | 165 | - hw:1,2 is not available |
166 | |||
135 | * device_setup=0x11 | 167 | * device_setup=0x11 |
136 | - 16bits 48kHz mode with Di enabled | 168 | - 16bits 48kHz mode with Di enabled |
137 | - Ai,Ao,Di,Do can be used at the same time | 169 | - Ai,Ao,Di,Do can be used at the same time |
138 | - hw:1,0 is available in capture mode | 170 | - hw:1,0 is available in capture mode |
139 | - hw:1,2 is not available | 171 | - hw:1,2 is not available |
172 | |||
173 | In this modes the device operates only at 16bits-modes. Before kernel 2.6.23, | ||
174 | the devices where reported to be Big-Endian when in fact they were Little-Endian | ||
175 | so that playing a file was a matter of using: | ||
176 | % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_BE test_S16_LE.raw | ||
177 | where "test_S16_LE.raw" was in fact a little-endian sample file. | ||
178 | |||
179 | Thanks to Hakan Lennestal (who discovered the Little-Endiannes of the device in | ||
180 | these modes) a fix has been committed (expected in kernel 2.6.23) and | ||
181 | Alsa now reports Little-Endian interfaces. Thus playing a file now is as simple as | ||
182 | using: | ||
183 | % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_LE test_S16_LE.raw | ||
184 | |||
185 | 3.2.1.2 - 24-bit modes | ||
186 | |||
187 | The three supported modes are: | ||
188 | |||
140 | * device_setup=0x09 | 189 | * device_setup=0x09 |
141 | - 24bits 48kHz mode with Di disabled | 190 | - 24bits 48kHz mode with Di disabled |
142 | - Ai,Ao,Do can be used at the same time | 191 | - Ai,Ao,Do can be used at the same time |
143 | - hw:1,0 is not available in capture mode | 192 | - hw:1,0 is not available in capture mode |
144 | - hw:1,2 is not available | 193 | - hw:1,2 is not available |
194 | |||
145 | * device_setup=0x19 | 195 | * device_setup=0x19 |
146 | - 24bits 48kHz mode with Di enabled | 196 | - 24bits 48kHz mode with Di enabled |
147 | - 3 ports from {Ai,Ao,Di,Do} can be used at the same time | 197 | - 3 ports from {Ai,Ao,Di,Do} can be used at the same time |
148 | - hw:1,0 is available in capture mode and an active digital source must be | 198 | - hw:1,0 is available in capture mode and an active digital source must be |
149 | connected to Di | 199 | connected to Di |
150 | - hw:1,2 is not available | 200 | - hw:1,2 is not available |
201 | |||
151 | * device_setup=0x0D or 0x10 | 202 | * device_setup=0x0D or 0x10 |
152 | - 24bits 96kHz mode | 203 | - 24bits 96kHz mode |
153 | - Di is enabled by default for this mode but does not need to be connected | 204 | - Di is enabled by default for this mode but does not need to be connected |
@@ -155,34 +206,64 @@ Here is a list of supported device_setup values for this device: | |||
155 | - Only 1 port from {Ai,Ao,Di,Do} can be used at the same time | 206 | - Only 1 port from {Ai,Ao,Di,Do} can be used at the same time |
156 | - hw:1,0 is available in captured mode | 207 | - hw:1,0 is available in captured mode |
157 | - hw:1,2 is not available | 208 | - hw:1,2 is not available |
209 | |||
210 | In these modes the device is only Big-Endian compliant (see "Default Alsa driver | ||
211 | mode" above for an aplay command example) | ||
212 | |||
213 | 3.2.1.3 - AC3 w/ DTS passthru mode | ||
214 | |||
215 | Thanks to Hakan Lennestal, I now have a report saying that this mode works. | ||
216 | |||
158 | * device_setup=0x03 | 217 | * device_setup=0x03 |
159 | - 16bits 48kHz mode with only the Do port enabled | 218 | - 16bits 48kHz mode with only the Do port enabled |
160 | - AC3 with DTS passthru (not tested) | 219 | - AC3 with DTS passthru |
161 | - Caution with this setup the Do port is mapped to the pcm device hw:1,0 | 220 | - Caution with this setup the Do port is mapped to the pcm device hw:1,0 |
162 | 221 | ||
163 | 2.2.2.2 - Setting and switching configurations with the device_setup parameter | 222 | The command line used to playback the AC3/DTS encoded .wav-files in this mode: |
223 | % aplay -D hw:1,0 --channels=6 ac3_S16_LE_encoded_file.raw | ||
224 | |||
225 | 3.2.2 - How to use the device_setup parameter | ||
226 | ---------------------------------------------- | ||
164 | 227 | ||
165 | The parameter can be given: | 228 | The parameter can be given: |
229 | |||
166 | * By manually probing the device (as root): | 230 | * By manually probing the device (as root): |
167 | # modprobe -r snd-usb-audio | 231 | # modprobe -r snd-usb-audio |
168 | # modprobe snd-usb-audio index=1 device_setup=0x09 | 232 | # modprobe snd-usb-audio index=1 device_setup=0x09 |
233 | |||
169 | * Or while configuring the modules options in your modules configuration file | 234 | * Or while configuring the modules options in your modules configuration file |
170 | - For Fedora distributions, edit the /etc/modprobe.conf file: | 235 | - For Fedora distributions, edit the /etc/modprobe.conf file: |
171 | alias snd-card-1 snd-usb-audio | 236 | alias snd-card-1 snd-usb-audio |
172 | options snd-usb-audio index=1 device_setup=0x09 | 237 | options snd-usb-audio index=1 device_setup=0x09 |
173 | 238 | ||
174 | IMPORTANT NOTE WHEN SWITCHING CONFIGURATION: | 239 | CAUTION when initializaing the device |
175 | ------------------------------------------- | 240 | ------------------------------------- |
176 | * You may need to _first_ initialize the module with the correct device_setup | 241 | |
177 | parameter and _only_after_ turn on the Audiophile USB device | 242 | * Correct initialization on the device requires that device_setup is given to |
178 | * This is especially true when switching the sample depth: | 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. | ||
245 | |||
246 | * Failing to respect this will lead in a misconfiguration of the device. In this case | ||
247 | turn off the device, unproble 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. | ||
249 | |||
250 | * If you've correctly initialized the device in a valid mode and then want to switch | ||
251 | to another mode (possibly with another sample-depth), please use also the following | ||
252 | procedure: | ||
179 | - first turn off the device | 253 | - first turn off the device |
180 | - de-register the snd-usb-audio module (modprobe -r) | 254 | - de-register the snd-usb-audio module (modprobe -r) |
181 | - change the device_setup parameter by changing the device_setup | 255 | - change the device_setup parameter by changing the device_setup |
182 | option in /etc/modprobe.conf | 256 | option in /etc/modprobe.conf |
183 | - turn on the device | 257 | - turn on the device |
258 | * A workaround for this last issue has been applied to kernel 2.6.23, but it may not | ||
259 | be enough to ensure the 'stability' of the device initialization. | ||
184 | 260 | ||
185 | 2.2.2.3 - Audiophile USB's device_setup structure | 261 | 3.2.3 - Technical details for hackers |
262 | ------------------------------------- | ||
263 | This section is for hackers, wanting to understand details about the device | ||
264 | internals and how Alsa supports it. | ||
265 | |||
266 | 3.2.3.1 - Audiophile USB's device_setup structure | ||
186 | 267 | ||
187 | If you want to understand the device_setup magic numbers for the Audiophile | 268 | If you want to understand the device_setup magic numbers for the Audiophile |
188 | USB, you need some very basic understanding of binary computation. However, | 269 | USB, you need some very basic understanding of binary computation. However, |
@@ -228,12 +309,12 @@ Caution: | |||
228 | - choosing b2 will prepare all interfaces for 24bits/96kHz but you'll | 309 | - choosing b2 will prepare all interfaces for 24bits/96kHz but you'll |
229 | only be able to use one at the same time | 310 | only be able to use one at the same time |
230 | 311 | ||
231 | 2.2.3 - USB implementation details for this device | 312 | 3.2.3.2 - USB implementation details for this device |
232 | 313 | ||
233 | You may safely skip this section if you're not interested in driver | 314 | You may safely skip this section if you're not interested in driver |
234 | development. | 315 | hacking. |
235 | 316 | ||
236 | This section describes some internal aspects of the device and summarize the | 317 | This section describes some internal aspects of the device and summarizes the |
237 | data I got by usb-snooping the windows and Linux drivers. | 318 | data I got by usb-snooping the windows and Linux drivers. |
238 | 319 | ||
239 | The M-Audio Audiophile USB has 7 USB Interfaces: | 320 | The M-Audio Audiophile USB has 7 USB Interfaces: |
@@ -293,43 +374,45 @@ parse_audio_endpoints function uses a quirk called | |||
293 | "audiophile_skip_setting_quirk" in order to prevent AltSettings not | 374 | "audiophile_skip_setting_quirk" in order to prevent AltSettings not |
294 | corresponding to device_setup from being registered in the driver. | 375 | corresponding to device_setup from being registered in the driver. |
295 | 376 | ||
296 | 3 - Audiophile USB and Jack support | 377 | 4 - Audiophile USB and Jack support |
297 | =================================== | 378 | =================================== |
298 | 379 | ||
299 | This section deals with support of the Audiophile USB device in Jack. | 380 | This section deals with support of the Audiophile USB device in Jack. |
300 | The main issue regarding this support is that the device is Big Endian | ||
301 | compliant. | ||
302 | 381 | ||
303 | 3.1 - Using the plug alsa plugin | 382 | There are 2 main potential issues when using Jackd with the device: |
304 | -------------------------------- | 383 | * support for Big-Endian devices in 24-bit modes |
384 | * support for 4-in / 4-out channels | ||
385 | |||
386 | 4.1 - Direct support in Jackd | ||
387 | ----------------------------- | ||
305 | 388 | ||
306 | Jack doesn't directly support big endian devices. Thus, one way to have support | 389 | Jack supports big endian devices only in recent versions (thanks to |
307 | for this device with Alsa is to use the Alsa "plug" converter. | 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 | ||
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 | ||
394 | paragraphs, you're now using kernel >= 2.6.23 and your 16bits devices | ||
395 | are now Little Endians ;-) ). | ||
396 | |||
397 | You can run jackd with the following command for playback with Ao and | ||
398 | record with Ai: | ||
399 | % jackd -R -dalsa -Phw:1,0 -r48000 -p128 -n2 -D -Chw:1,1 | ||
400 | |||
401 | 4.2 - Using Alsa plughw | ||
402 | ----------------------- | ||
403 | If you don't have a recent Jackd installed, you can downgrade to using | ||
404 | the Alsa "plug" converter. | ||
308 | 405 | ||
309 | For instance here is one way to run Jack with 2 playback channels on Ao and 2 | 406 | For instance here is one way to run Jack with 2 playback channels on Ao and 2 |
310 | capture channels from Ai: | 407 | capture channels from Ai: |
311 | % jackd -R -dalsa -dplughw:1 -r48000 -p256 -n2 -D -Cplughw:1,1 | 408 | % jackd -R -dalsa -dplughw:1 -r48000 -p256 -n2 -D -Cplughw:1,1 |
312 | 409 | ||
313 | |||
314 | However you may see the following warning message: | 410 | However you may see the following warning message: |
315 | "You appear to be using the ALSA software "plug" layer, probably a result of | 411 | "You appear to be using the ALSA software "plug" layer, probably a result of |
316 | using the "default" ALSA device. This is less efficient than it could be. | 412 | using the "default" ALSA device. This is less efficient than it could be. |
317 | Consider using a hardware device instead rather than using the plug layer." | 413 | Consider using a hardware device instead rather than using the plug layer." |
318 | 414 | ||
319 | 3.2 - Patching alsa to use direct pcm device | 415 | 4.3 - Getting 2 input and/or output interfaces in Jack |
320 | -------------------------------------------- | ||
321 | A patch for Jack by Andreas Steinmetz adds support for Big Endian devices. | ||
322 | However it has not been included in the CVS tree. | ||
323 | |||
324 | You can find it at the following URL: | ||
325 | http://sourceforge.net/tracker/index.php?func=detail&aid=1289682&group_id=39687& | ||
326 | atid=425939 | ||
327 | |||
328 | After having applied the patch you can run jackd with the following command | ||
329 | line: | ||
330 | % jackd -R -dalsa -Phw:1,0 -r48000 -p128 -n2 -D -Chw:1,1 | ||
331 | |||
332 | 3.2 - Getting 2 input and/or output interfaces in Jack | ||
333 | ------------------------------------------------------ | 416 | ------------------------------------------------------ |
334 | 417 | ||
335 | As you can see, starting the Jack server this way will only enable 1 stereo | 418 | As you can see, starting the Jack server this way will only enable 1 stereo |
@@ -339,6 +422,7 @@ This is due to the following restrictions: | |||
339 | * Jack can only open one capture device and one playback device at a time | 422 | * Jack can only open one capture device and one playback device at a time |
340 | * The Audiophile USB is seen as 2 (or three) Alsa devices: hw:1,0, hw:1,1 | 423 | * The Audiophile USB is seen as 2 (or three) Alsa devices: hw:1,0, hw:1,1 |
341 | (and optionally hw:1,2) | 424 | (and optionally hw:1,2) |
425 | |||
342 | If you want to get Ai+Di and/or Ao+Do support with Jack, you would need to | 426 | If you want to get Ai+Di and/or Ao+Do support with Jack, you would need to |
343 | combine the Alsa devices into one logical "complex" device. | 427 | combine the Alsa devices into one logical "complex" device. |
344 | 428 | ||
@@ -348,13 +432,11 @@ It is related to another device (ice1712) but can be adapted to suit | |||
348 | the Audiophile USB. | 432 | the Audiophile USB. |
349 | 433 | ||
350 | Enabling multiple Audiophile USB interfaces for Jackd will certainly require: | 434 | Enabling multiple Audiophile USB interfaces for Jackd will certainly require: |
351 | * patching Jack with the previously mentioned "Big Endian" patch | 435 | * Making sure your Jackd version has the MMAP_COMPLEX patch (see the ice1712 page) |
352 | * patching Jackd with the MMAP_COMPLEX patch (see the ice1712 page) | 436 | * (maybe) patching the alsa-lib/src/pcm/pcm_multi.c file (see the ice1712 page) |
353 | * patching the alsa-lib/src/pcm/pcm_multi.c file (see the ice1712 page) | ||
354 | * define a multi device (combination of hw:1,0 and hw:1,1) in your .asoundrc | 437 | * define a multi device (combination of hw:1,0 and hw:1,1) in your .asoundrc |
355 | file | 438 | file |
356 | * start jackd with this device | 439 | * start jackd with this device |
357 | 440 | ||
358 | I had no success in testing this for now, but this may be due to my OS | 441 | I had no success in testing this for now, if you have any success with this kind |
359 | configuration. If you have any success with this kind of setup, please | 442 | of setup, please drop me an email. |
360 | drop me an email. | ||
diff --git a/Documentation/sound/alsa/OSS-Emulation.txt b/Documentation/sound/alsa/OSS-Emulation.txt index ec2a02541d5b..bfa0c9aacb4b 100644 --- a/Documentation/sound/alsa/OSS-Emulation.txt +++ b/Documentation/sound/alsa/OSS-Emulation.txt | |||
@@ -278,6 +278,21 @@ current mixer configuration by reading and writing the whole file | |||
278 | image. | 278 | image. |
279 | 279 | ||
280 | 280 | ||
281 | Duplex Streams | ||
282 | ============== | ||
283 | |||
284 | Note that when attempting to use a single device file for playback and | ||
285 | capture, the OSS API provides no way to set the format, sample rate or | ||
286 | number of channels different in each direction. Thus | ||
287 | io_handle = open("device", O_RDWR) | ||
288 | will only function correctly if the values are the same in each direction. | ||
289 | |||
290 | To use different values in the two directions, use both | ||
291 | input_handle = open("device", O_RDONLY) | ||
292 | output_handle = open("device", O_WRONLY) | ||
293 | and set the values for the corresponding handle. | ||
294 | |||
295 | |||
281 | Unsupported Features | 296 | Unsupported Features |
282 | ==================== | 297 | ==================== |
283 | 298 | ||
diff --git a/Documentation/sound/oss/AD1816 b/Documentation/sound/oss/AD1816 deleted file mode 100644 index 14bd8f25d523..000000000000 --- a/Documentation/sound/oss/AD1816 +++ /dev/null | |||
@@ -1,84 +0,0 @@ | |||
1 | Documentation for the AD1816(A) sound driver | ||
2 | ============================================ | ||
3 | |||
4 | Installation: | ||
5 | ------------- | ||
6 | |||
7 | To get your AD1816(A) based sound card work, you'll have to enable support for | ||
8 | experimental code ("Prompt for development and/or incomplete code/drivers") | ||
9 | and isapnp ("Plug and Play support", "ISA Plug and Play support"). Enable | ||
10 | "Sound card support", "OSS modules support" and "Support for AD1816(A) based | ||
11 | cards (EXPERIMENTAL)" in the sound configuration menu, too. Now build, install | ||
12 | and reboot the new kernel as usual. | ||
13 | |||
14 | Features: | ||
15 | --------- | ||
16 | |||
17 | List of features supported by this driver: | ||
18 | - full-duplex support | ||
19 | - supported audio formats: unsigned 8bit, signed 16bit little endian, | ||
20 | signed 16bit big endian, -law, A-law | ||
21 | - supported channels: mono and stereo | ||
22 | - supported recording sources: Master, CD, Line, Line1, Line2, Mic | ||
23 | - supports phat 3d stereo circuit (Line 3) | ||
24 | |||
25 | |||
26 | Supported cards: | ||
27 | ---------------- | ||
28 | |||
29 | The following cards are known to work with this driver: | ||
30 | - Terratec Base 1 | ||
31 | - Terratec Base 64 | ||
32 | - HP Kayak | ||
33 | - Acer FX-3D | ||
34 | - SY-1816 | ||
35 | - Highscreen Sound-Boostar 32 Wave 3D | ||
36 | - Highscreen Sound-Boostar 16 | ||
37 | - AVM Apex Pro card | ||
38 | - (Aztech SC-16 3D) | ||
39 | - (Newcom SC-16 3D) | ||
40 | - (Terratec EWS64S) | ||
41 | |||
42 | Cards listed in brackets are not supported reliable. If you have such a card | ||
43 | you should add the extra parameter: | ||
44 | options=1 | ||
45 | when loading the ad1816 module via modprobe. | ||
46 | |||
47 | |||
48 | Troubleshooting: | ||
49 | ---------------- | ||
50 | |||
51 | First of all you should check, if the driver has been loaded | ||
52 | properly. | ||
53 | |||
54 | If loading of the driver succeeds, but playback/capture fails, check | ||
55 | if you used the correct values for irq, dma and dma2 when loading the module. | ||
56 | If one of them is wrong you usually get the following error message: | ||
57 | |||
58 | Nov 6 17:06:13 tek01 kernel: Sound: DMA (output) timed out - IRQ/DRQ config error? | ||
59 | |||
60 | If playback/capture is too fast or to slow, you should have a look at | ||
61 | the clock chip of your sound card. The AD1816 was designed for a 33MHz | ||
62 | oscillator, however most sound card manufacturer use slightly | ||
63 | different oscillators as they are cheaper than 33MHz oscillators. If | ||
64 | you have such a card you have to adjust the ad1816_clockfreq parameter | ||
65 | above. For example: For a card using a 32.875MHz oscillator use | ||
66 | ad1816_clockfreq=32875 instead of ad1816_clockfreq=33000. | ||
67 | |||
68 | |||
69 | Updates, bugfixes and bugreports: | ||
70 | -------------------------------- | ||
71 | |||
72 | As the driver is still experimental and under development, you should | ||
73 | watch out for updates. Updates of the driver are available on the | ||
74 | Internet from one of my home pages: | ||
75 | http://www.student.informatik.tu-darmstadt.de/~tek/projects/linux.html | ||
76 | or: | ||
77 | http://www.tu-darmstadt.de/~tek01/projects/linux.html | ||
78 | |||
79 | Bugreports, bugfixes and related questions should be sent via E-Mail to: | ||
80 | tek@rbg.informatik.tu-darmstadt.de | ||
81 | |||
82 | Thorsten Knabe <tek@rbg.informatik.tu-darmstadt.de> | ||
83 | Christoph Hellwig <hch@infradead.org> | ||
84 | Last modified: 2000/09/20 | ||
diff --git a/Documentation/sound/oss/NM256 b/Documentation/sound/oss/NM256 deleted file mode 100644 index b503217488b3..000000000000 --- a/Documentation/sound/oss/NM256 +++ /dev/null | |||
@@ -1,280 +0,0 @@ | |||
1 | ======================================================= | ||
2 | Documentation for the NeoMagic 256AV/256ZX sound driver | ||
3 | ======================================================= | ||
4 | |||
5 | You're looking at version 1.1 of the driver. (Woohoo!) It has been | ||
6 | successfully tested against the following laptop models: | ||
7 | |||
8 | Sony Z505S/Z505SX/Z505DX/Z505RX | ||
9 | Sony F150, F160, F180, F250, F270, F280, PCG-F26 | ||
10 | Dell Latitude CPi, CPt (various submodels) | ||
11 | |||
12 | There are a few caveats, which is why you should read the entirety of | ||
13 | this document first. | ||
14 | |||
15 | This driver was developed without any support or assistance from | ||
16 | NeoMagic. There is no warranty, expressed, implied, or otherwise. It | ||
17 | is free software in the public domain; feel free to use it, sell it, | ||
18 | give it to your best friends, even claim that you wrote it (but why?!) | ||
19 | but don't go whining to me, NeoMagic, Sony, Dell, or anyone else | ||
20 | when it blows up your computer. | ||
21 | |||
22 | Version 1.1 contains a change to try and detect non-AC97 versions of | ||
23 | the hardware, and not install itself appropriately. It should also | ||
24 | reinitialize the hardware on an APM resume event, assuming that APM | ||
25 | was configured into your kernel. | ||
26 | |||
27 | ============ | ||
28 | Installation | ||
29 | ============ | ||
30 | |||
31 | Enable the sound drivers, the OSS sound drivers, and then the NM256 | ||
32 | driver. The NM256 driver *must* be configured as a module (it won't | ||
33 | give you any other choice). | ||
34 | |||
35 | Next, do the usual "make modules" and "make modules_install". | ||
36 | Finally, insmod the soundcore, sound and nm256 modules. | ||
37 | |||
38 | When the nm256 driver module is loaded, you should see a couple of | ||
39 | confirmation messages in the kernel logfile indicating that it found | ||
40 | the device (the device does *not* use any I/O ports or DMA channels). | ||
41 | Now try playing a wav file, futz with the CD-ROM if you have one, etc. | ||
42 | |||
43 | The NM256 is entirely a PCI-based device, and all the necessary | ||
44 | information is automatically obtained from the card. It can only be | ||
45 | configured as a module in a vain attempt to prevent people from | ||
46 | hurting themselves. It works correctly if it shares an IRQ with | ||
47 | another device (it normally shares IRQ 9 with the builtin eepro100 | ||
48 | ethernet on the Sony Z505 laptops). | ||
49 | |||
50 | It does not run the card in any sort of compatibility mode. It will | ||
51 | not work on laptops that have the SB16-compatible, AD1848-compatible | ||
52 | or CS4232-compatible codec/mixer; you will want to use the appropriate | ||
53 | compatible OSS driver with these chipsets. I cannot provide any | ||
54 | assistance with machines using the SB16, AD1848 or CS4232 compatible | ||
55 | versions. (The driver now attempts to detect the mixer version, and | ||
56 | will refuse to load if it believes the hardware is not | ||
57 | AC97-compatible.) | ||
58 | |||
59 | The sound support is very basic, but it does include simultaneous | ||
60 | playback and record capability. The mixer support is also quite | ||
61 | simple, although this is in keeping with the rather limited | ||
62 | functionality of the chipset. | ||
63 | |||
64 | There is no hardware synthesizer available, as the Losedows OPL-3 and | ||
65 | MIDI support is done via hardware emulation. | ||
66 | |||
67 | Only three recording devices are available on the Sony: the | ||
68 | microphone, the CD-ROM input, and the volume device (which corresponds | ||
69 | to the stereo output). (Other devices may be available on other | ||
70 | models of laptops.) The Z505 series does not have a builtin CD-ROM, | ||
71 | so of course the CD-ROM input doesn't work. It does work on laptops | ||
72 | with a builtin CD-ROM drive. | ||
73 | |||
74 | The mixer device does not appear to have any tone controls, at least | ||
75 | on the Z505 series. The mixer module checks for tone controls in the | ||
76 | AC97 mixer, and will enable them if they are available. | ||
77 | |||
78 | ============== | ||
79 | Known problems | ||
80 | ============== | ||
81 | |||
82 | * There are known problems with PCMCIA cards and the eepro100 ethernet | ||
83 | driver on the Z505S/Z505SX/Z505DX. Keep reading. | ||
84 | |||
85 | * There are also potential problems with using a virtual X display, and | ||
86 | also problems loading the module after the X server has been started. | ||
87 | Keep reading. | ||
88 | |||
89 | * The volume control isn't anywhere near linear. Sorry. This will be | ||
90 | fixed eventually, when I get sufficiently annoyed with it. (I doubt | ||
91 | it will ever be fixed now, since I've never gotten sufficiently | ||
92 | annoyed with it and nobody else seems to care.) | ||
93 | |||
94 | * There are reports that the CD-ROM volume is very low. Since I do not | ||
95 | have a CD-ROM equipped laptop, I cannot test this (it's kinda hard to | ||
96 | do remotely). | ||
97 | |||
98 | * Only 8 fixed-rate speeds are supported. This is mainly a chipset | ||
99 | limitation. It may be possible to support other speeds in the future. | ||
100 | |||
101 | * There is no support for the telephone mixer/codec. There is support | ||
102 | for a phonein/phoneout device in the mixer driver; whether or not | ||
103 | it does anything is anyone's guess. (Reports on this would be | ||
104 | appreciated. You'll have to figure out how to get the phone to | ||
105 | go off-hook before it'll work, tho.) | ||
106 | |||
107 | * This driver was not written with any cooperation or support from | ||
108 | NeoMagic. If you have any questions about this, see their website | ||
109 | for their official stance on supporting open source drivers. | ||
110 | |||
111 | ============ | ||
112 | Video memory | ||
113 | ============ | ||
114 | |||
115 | The NeoMagic sound engine uses a portion of the display memory to hold | ||
116 | the sound buffer. (Crazy, eh?) The NeoMagic video BIOS sets up a | ||
117 | special pointer at the top of video RAM to indicate where the top of | ||
118 | the audio buffer should be placed. | ||
119 | |||
120 | At the present time XFree86 is apparently not aware of this. It will | ||
121 | thus write over either the pointer or the sound buffer with abandon. | ||
122 | (Accelerated-X seems to do a better job here.) | ||
123 | |||
124 | This implies a few things: | ||
125 | |||
126 | * Sometimes the NM256 driver has to guess at where the buffer | ||
127 | should be placed, especially if the module is loaded after the | ||
128 | X server is started. It's usually correct, but it will consistently | ||
129 | fail on the Sony F250. | ||
130 | |||
131 | * Virtual screens greater than 1024x768x16 under XFree86 are | ||
132 | problematic on laptops with only 2.5MB of screen RAM. This | ||
133 | includes all of the 256AV-equipped laptops. (Virtual displays | ||
134 | may or may not work on the 256ZX, which has at least 4MB of | ||
135 | video RAM.) | ||
136 | |||
137 | If you start having problems with random noise being output either | ||
138 | constantly (this is the usual symptom on the F250), or when windows | ||
139 | are moved around (this is the usual symptom when using a virtual | ||
140 | screen), the best fix is to | ||
141 | |||
142 | * Don't use a virtual frame buffer. | ||
143 | * Make sure you load the NM256 module before the X server is | ||
144 | started. | ||
145 | |||
146 | On the F250, it is possible to force the driver to load properly even | ||
147 | after the XFree86 server is started by doing: | ||
148 | |||
149 | insmod nm256 buffertop=0x25a800 | ||
150 | |||
151 | This forces the audio buffers to the correct offset in screen RAM. | ||
152 | |||
153 | One user has reported a similar problem on the Sony F270, although | ||
154 | others apparently aren't seeing any problems. His suggested command | ||
155 | is | ||
156 | |||
157 | insmod nm256 buffertop=0x272800 | ||
158 | |||
159 | ================= | ||
160 | Official WWW site | ||
161 | ================= | ||
162 | |||
163 | The official site for the NM256 driver is: | ||
164 | |||
165 | http://www.uglx.org/sony.html | ||
166 | |||
167 | You should always be able to get the latest version of the driver there, | ||
168 | and the driver will be supported for the foreseeable future. | ||
169 | |||
170 | ============== | ||
171 | Z505RX and IDE | ||
172 | ============== | ||
173 | |||
174 | There appears to be a problem with the IDE chipset on the Z505RX; one | ||
175 | of the symptoms is that sound playback periodically hangs (when the | ||
176 | disk is accessed). The user reporting the problem also reported that | ||
177 | enabling all of the IDE chipset workarounds in the kernel solved the | ||
178 | problem, tho obviously only one of them should be needed--if someone | ||
179 | can give me more details I would appreciate it. | ||
180 | |||
181 | ============================== | ||
182 | Z505S/Z505SX on-board Ethernet | ||
183 | ============================== | ||
184 | |||
185 | If you're using the on-board Ethernet Pro/100 ethernet support on the Z505 | ||
186 | series, I strongly encourage you to download the latest eepro100 driver from | ||
187 | Donald Becker's site: | ||
188 | |||
189 | ftp://cesdis.gsfc.nasa.gov/pub/linux/drivers/test/eepro100.c | ||
190 | |||
191 | There was a reported problem on the Z505SX that if the ethernet | ||
192 | interface is disabled and reenabled while the sound driver is loaded, | ||
193 | the machine would lock up. I have included a workaround that is | ||
194 | working satisfactorily. However, you may occasionally see a message | ||
195 | about "Releasing interrupts, over 1000 bad interrupts" which indicates | ||
196 | that the workaround is doing its job. | ||
197 | |||
198 | ================================== | ||
199 | PCMCIA and the Z505S/Z505SX/Z505DX | ||
200 | ================================== | ||
201 | |||
202 | There is also a known problem with the Sony Z505S and Z505SX hanging | ||
203 | if a PCMCIA card is inserted while the ethernet driver is loaded, or | ||
204 | in some cases if the laptop is suspended. This is caused by tons of | ||
205 | spurious IRQ 9s, probably generated from the PCMCIA or ACPI bridges. | ||
206 | |||
207 | There is currently no fix for the problem that works in every case. | ||
208 | The only known workarounds are to disable the ethernet interface | ||
209 | before inserting or removing a PCMCIA card, or with some cards | ||
210 | disabling the PCMCIA card before ejecting it will also help the | ||
211 | problem with the laptop hanging when the card is ejected. | ||
212 | |||
213 | One user has reported that setting the tcic's cs_irq to some value | ||
214 | other than 9 (like 11) fixed the problem. This doesn't work on my | ||
215 | Z505S, however--changing the value causes the cardmgr to stop seeing | ||
216 | card insertions and removals, cards don't seem to work correctly, and | ||
217 | I still get hangs if a card is inserted when the kernel is booted. | ||
218 | |||
219 | Using the latest ethernet driver and pcmcia package allows me to | ||
220 | insert an Adaptec 1480A SlimScsi card without the laptop hanging, | ||
221 | although I still have to shut down the card before ejecting or | ||
222 | powering down the laptop. However, similar experiments with a DE-660 | ||
223 | ethernet card still result in hangs when the card is inserted. I am | ||
224 | beginning to think that the interrupts are CardBus-related, since the | ||
225 | Adaptec card is a CardBus card, and the DE-660 is not; however, I | ||
226 | don't have any other CardBus cards to test with. | ||
227 | |||
228 | ====== | ||
229 | Thanks | ||
230 | ====== | ||
231 | |||
232 | First, I want to thank everyone (except NeoMagic of course) for their | ||
233 | generous support and encouragement. I'd like to list everyone's name | ||
234 | here that replied during the development phase, but the list is | ||
235 | amazingly long. | ||
236 | |||
237 | I will be rather unfair and single out a few people, however: | ||
238 | |||
239 | Justin Maurer, for being the first random net.person to try it, | ||
240 | and for letting me login to his Z505SX to get it working there | ||
241 | |||
242 | Edi Weitz for trying out several different versions, and giving | ||
243 | me a lot of useful feedback | ||
244 | |||
245 | Greg Rumple for letting me login remotely to get the driver | ||
246 | functional on the 256ZX, for his assistance on tracking | ||
247 | down all sorts of random stuff, and for trying out Accel-X | ||
248 | |||
249 | Zach Brown, for the initial AC97 mixer interface design | ||
250 | |||
251 | Jeff Garzik, for various helpful suggestions on the AC97 | ||
252 | interface | ||
253 | |||
254 | "Mr. Bumpy" for feedback on the Z505RX | ||
255 | |||
256 | Bill Nottingham, for generous assistance in getting the mixer ID | ||
257 | code working | ||
258 | |||
259 | ================= | ||
260 | Previous versions | ||
261 | ================= | ||
262 | |||
263 | Versions prior to 0.3 (aka `noname') had problems with weird artifacts | ||
264 | in the output and failed to set the recording rate properly. These | ||
265 | problems have long since been fixed. | ||
266 | |||
267 | Versions prior to 0.5 had problems with clicks in the output when | ||
268 | anything other than 16-bit stereo sound was being played, and also had | ||
269 | periodic clicks when recording. | ||
270 | |||
271 | Version 0.7 first incorporated support for the NM256ZX chipset, which | ||
272 | is found on some Dell Latitude laptops (the CPt, and apparently | ||
273 | some CPi models as well). It also included the generic AC97 | ||
274 | mixer module. | ||
275 | |||
276 | Version 0.75 renamed all the functions and files with slightly more | ||
277 | generic names. | ||
278 | |||
279 | Note that previous versions of this document claimed that recording was | ||
280 | 8-bit only; it actually has been working for 16-bits all along. | ||
diff --git a/Documentation/sound/oss/OPL3-SA2 b/Documentation/sound/oss/OPL3-SA2 deleted file mode 100644 index d8b6d2bbada6..000000000000 --- a/Documentation/sound/oss/OPL3-SA2 +++ /dev/null | |||
@@ -1,210 +0,0 @@ | |||
1 | Documentation for the OPL3-SA2, SA3, and SAx driver (opl3sa2.o) | ||
2 | --------------------------------------------------------------- | ||
3 | |||
4 | Scott Murray, scott@spiteful.org | ||
5 | January 7, 2001 | ||
6 | |||
7 | NOTE: All trade-marked terms mentioned below are properties of their | ||
8 | respective owners. | ||
9 | |||
10 | |||
11 | Supported Devices | ||
12 | ----------------- | ||
13 | |||
14 | This driver is for PnP soundcards based on the following Yamaha audio | ||
15 | controller chipsets: | ||
16 | |||
17 | YMF711 aka OPL3-SA2 | ||
18 | YMF715 and YMF719 aka OPL3-SA3 | ||
19 | |||
20 | Up until recently (December 2000), I'd thought the 719 to be a | ||
21 | different chipset, the OPL3-SAx. After an email exhange with | ||
22 | Yamaha, however, it turns out that the 719 is just a re-badged | ||
23 | 715, and the chipsets are identical. The chipset detection code | ||
24 | has been updated to reflect this. | ||
25 | |||
26 | Anyways, all of these chipsets implement the following devices: | ||
27 | |||
28 | OPL3 FM synthesizer | ||
29 | Soundblaster Pro | ||
30 | Microsoft/Windows Sound System | ||
31 | MPU401 MIDI interface | ||
32 | |||
33 | Note that this driver uses the MSS device, and to my knowledge these | ||
34 | chipsets enforce an either/or situation with the Soundblaster Pro | ||
35 | device and the MSS device. Since the MSS device has better | ||
36 | capabilities, I have implemented the driver to use it. | ||
37 | |||
38 | |||
39 | Mixer Channels | ||
40 | -------------- | ||
41 | |||
42 | Older versions of this driver (pre-December 2000) had two mixers, | ||
43 | an OPL3-SA2 or SA3 mixer and a MSS mixer. The OPL3-SA[23] mixer | ||
44 | device contained a superset of mixer channels consisting of its own | ||
45 | channels and all of the MSS mixer channels. To simplify the driver | ||
46 | considerably, and to partition functionality better, the OPL3-SA[23] | ||
47 | mixer device now contains has its own specific mixer channels. They | ||
48 | are: | ||
49 | |||
50 | Volume - Hardware master volume control | ||
51 | Bass - SA3 only, now supports left and right channels | ||
52 | Treble - SA3 only, now supports left and right channels | ||
53 | Microphone - Hardware microphone input volume control | ||
54 | Digital1 - Yamaha 3D enhancement "Wide" mixer | ||
55 | |||
56 | All other mixer channels (e.g. "PCM", "CD", etc.) now have to be | ||
57 | controlled via the "MS Sound System (CS4231)" mixer. To facilitate | ||
58 | this, the mixer device creation order has been switched so that | ||
59 | the MSS mixer is created first. This allows accessing the majority | ||
60 | of the useful mixer channels even via single mixer-aware tools | ||
61 | such as "aumix". | ||
62 | |||
63 | |||
64 | Plug 'n Play | ||
65 | ------------ | ||
66 | |||
67 | In previous kernels (2.2.x), some configuration was required to | ||
68 | get the driver to talk to the card. Being the new millennium and | ||
69 | all, the 2.4.x kernels now support auto-configuration if ISA PnP | ||
70 | support is configured in. Theoretically, the driver even supports | ||
71 | having more than one card in this case. | ||
72 | |||
73 | With the addition of PnP support to the driver, two new parameters | ||
74 | have been added to control it: | ||
75 | |||
76 | isapnp - set to 0 to disable ISA PnP card detection | ||
77 | |||
78 | multiple - set to 0 to disable multiple PnP card detection | ||
79 | |||
80 | |||
81 | Optional Parameters | ||
82 | ------------------- | ||
83 | |||
84 | Recent (December 2000) additions to the driver (based on a patch | ||
85 | provided by Peter Englmaier) are two new parameters: | ||
86 | |||
87 | ymode - Set Yamaha 3D enhancement mode: | ||
88 | 0 = Desktop/Normal 5-12 cm speakers | ||
89 | 1 = Notebook PC (1) 3 cm speakers | ||
90 | 2 = Notebook PC (2) 1.5 cm speakers | ||
91 | 3 = Hi-Fi 16-38 cm speakers | ||
92 | |||
93 | loopback - Set A/D input source. Useful for echo cancellation: | ||
94 | 0 = Mic Right channel (default) | ||
95 | 1 = Mono output loopback | ||
96 | |||
97 | The ymode parameter has been tested and does work. The loopback | ||
98 | parameter, however, is untested. Any feedback on its usefulness | ||
99 | would be appreciated. | ||
100 | |||
101 | |||
102 | Manual Configuration | ||
103 | -------------------- | ||
104 | |||
105 | If for some reason you decide not to compile ISA PnP support into | ||
106 | your kernel, or disabled the driver's usage of it by setting the | ||
107 | isapnp parameter as discussed above, then you will need to do some | ||
108 | manual configuration. There are two ways of doing this. The most | ||
109 | common is to use the isapnptools package to initialize the card, and | ||
110 | use the kernel module form of the sound subsystem and sound drivers. | ||
111 | Alternatively, some BIOS's allow manual configuration of installed | ||
112 | PnP devices in a BIOS menu, which should allow using the non-modular | ||
113 | sound drivers, i.e. built into the kernel. | ||
114 | |||
115 | I personally use isapnp and modules, and do not have access to a PnP | ||
116 | BIOS machine to test. If you have such a beast, configuring the | ||
117 | driver to be built into the kernel should just work (thanks to work | ||
118 | done by David Luyer <luyer@ucs.uwa.edu.au>). You will still need | ||
119 | to specify settings, which can be done by adding: | ||
120 | |||
121 | opl3sa2=<io>,<irq>,<dma>,<dma2>,<mssio>,<mpuio> | ||
122 | |||
123 | to the kernel command line. For example: | ||
124 | |||
125 | opl3sa2=0x370,5,0,1,0x530,0x330 | ||
126 | |||
127 | If you are instead using the isapnp tools (as most people have been | ||
128 | before Linux 2.4.x), follow the directions in their documentation to | ||
129 | produce a configuration file. Here is the relevant excerpt I used to | ||
130 | use for my SA3 card from my isapnp.conf: | ||
131 | |||
132 | (CONFIGURE YMH0800/-1 (LD 0 | ||
133 | |||
134 | # NOTE: IO 0 is for the unused SoundBlaster part of the chipset. | ||
135 | (IO 0 (BASE 0x0220)) | ||
136 | (IO 1 (BASE 0x0530)) | ||
137 | (IO 2 (BASE 0x0388)) | ||
138 | (IO 3 (BASE 0x0330)) | ||
139 | (IO 4 (BASE 0x0370)) | ||
140 | (INT 0 (IRQ 5 (MODE +E))) | ||
141 | (DMA 0 (CHANNEL 0)) | ||
142 | (DMA 1 (CHANNEL 1)) | ||
143 | |||
144 | Here, note that: | ||
145 | |||
146 | Port Acceptable Range Purpose | ||
147 | ---- ---------------- ------- | ||
148 | IO 0 0x0220 - 0x0280 SB base address, unused. | ||
149 | IO 1 0x0530 - 0x0F48 MSS base address | ||
150 | IO 2 0x0388 - 0x03F8 OPL3 base address | ||
151 | IO 3 0x0300 - 0x0334 MPU base address | ||
152 | IO 4 0x0100 - 0x0FFE card's own base address for its control I/O ports | ||
153 | |||
154 | The IRQ and DMA values can be any that are considered acceptable for a | ||
155 | MSS. Assuming you've got isapnp all happy, then you should be able to | ||
156 | do something like the following (which matches up with the isapnp | ||
157 | configuration above): | ||
158 | |||
159 | modprobe mpu401 | ||
160 | modprobe ad1848 | ||
161 | modprobe opl3sa2 io=0x370 mss_io=0x530 mpu_io=0x330 irq=5 dma=0 dma2=1 | ||
162 | modprobe opl3 io=0x388 | ||
163 | |||
164 | See the section "Automatic Module Loading" below for how to set up | ||
165 | /etc/modprobe.conf to automate this. | ||
166 | |||
167 | An important thing to remember that the opl3sa2 module's io argument is | ||
168 | for it's own control port, which handles the card's master mixer for | ||
169 | volume (on all cards), and bass and treble (on SA3 cards). | ||
170 | |||
171 | |||
172 | Troubleshooting | ||
173 | --------------- | ||
174 | |||
175 | If all goes well and you see no error messages, you should be able to | ||
176 | start using the sound capabilities of your system. If you get an | ||
177 | error message while trying to insert the opl3sa2 module, then make | ||
178 | sure that the values of the various arguments match what you specified | ||
179 | in your isapnp configuration file, and that there is no conflict with | ||
180 | another device for an I/O port or interrupt. Checking the contents of | ||
181 | /proc/ioports and /proc/interrupts can be useful to see if you're | ||
182 | butting heads with another device. | ||
183 | |||
184 | If you still cannot get the module to load, look at the contents of | ||
185 | your system log file, usually /var/log/messages. If you see the | ||
186 | message "opl3sa2: Unknown Yamaha audio controller version", then you | ||
187 | have a different chipset version than I've encountered so far. Look | ||
188 | for all messages in the log file that start with "opl3sa2: " and see | ||
189 | if they provide any clues. If you do not see the chipset version | ||
190 | message, and none of the other messages present in the system log are | ||
191 | helpful, email me some details and I'll try my best to help. | ||
192 | |||
193 | |||
194 | Automatic Module Loading | ||
195 | ------------------------ | ||
196 | |||
197 | Lastly, if you're using modules and want to set up automatic module | ||
198 | loading with kmod, the kernel module loader, here is the section I | ||
199 | currently use in my modprobe.conf file: | ||
200 | |||
201 | # Sound | ||
202 | alias sound-slot-0 opl3sa2 | ||
203 | options opl3sa2 io=0x370 mss_io=0x530 mpu_io=0x330 irq=7 dma=0 dma2=3 | ||
204 | options opl3 io=0x388 | ||
205 | |||
206 | That's all it currently takes to get an OPL3-SA3 card working on my | ||
207 | system. Once again, if you have any other problems, email me at the | ||
208 | address listed above. | ||
209 | |||
210 | Scott | ||
diff --git a/Documentation/sound/oss/VIA-chipset b/Documentation/sound/oss/VIA-chipset deleted file mode 100644 index 37865234e54d..000000000000 --- a/Documentation/sound/oss/VIA-chipset +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | Running sound cards on VIA chipsets | ||
2 | |||
3 | o There are problems with VIA chipsets and sound cards that appear to | ||
4 | lock the hardware solidly. Test programs under DOS have verified the | ||
5 | problem exists on at least some (but apparently not all) VIA boards | ||
6 | |||
7 | o VIA have so far failed to bother to answer support mail on the subject | ||
8 | so if you are a VIA engineer feeling aggrieved as you read this | ||
9 | document go chase your own people. If there is a workaround please | ||
10 | let us know so we can implement it. | ||
11 | |||
12 | |||
13 | Certain patterns of ISA DMA access used for most PC sound cards cause the | ||
14 | VIA chipsets to lock up. From the collected reports this appears to cover a | ||
15 | wide range of boards. Some also lock up with sound cards under Win* as well. | ||
16 | |||
17 | Linux implements a workaround providing your chipset is PCI and you compiled | ||
18 | with PCI Quirks enabled. If so you will see a message | ||
19 | "Activating ISA DMA bug workarounds" | ||
20 | |||
21 | during booting. If you have a VIA PCI chipset that hangs when you use the | ||
22 | sound and is not generating this message even with PCI quirks enabled | ||
23 | please report the information to the linux-kernel list (see REPORTING-BUGS). | ||
24 | |||
25 | If you are one of the tiny number of unfortunates with a 486 ISA/VLB VIA | ||
26 | chipset board you need to do the following to build a special kernel for | ||
27 | your board | ||
28 | |||
29 | edit linux/include/asm-i386/dma.h | ||
30 | |||
31 | change | ||
32 | |||
33 | #define isa_dma_bridge_buggy (0) | ||
34 | |||
35 | to | ||
36 | |||
37 | #define isa_dma_bridge_buggy (1) | ||
38 | |||
39 | and rebuild a kernel without PCI quirk support. | ||
40 | |||
41 | |||
42 | Other than this particular glitch the VIA [M]VP* chipsets appear to work | ||
43 | perfectly with Linux. | ||
diff --git a/Documentation/sound/oss/cs46xx b/Documentation/sound/oss/cs46xx deleted file mode 100644 index b54432709863..000000000000 --- a/Documentation/sound/oss/cs46xx +++ /dev/null | |||
@@ -1,138 +0,0 @@ | |||
1 | |||
2 | Documentation for the Cirrus Logic/Crystal SoundFusion cs46xx/cs4280 audio | ||
3 | controller chips (2001/05/11) | ||
4 | |||
5 | The cs46xx audio driver supports the DSP line of Cirrus controllers. | ||
6 | Specifically, the cs4610, cs4612, cs4614, cs4622, cs4624, cs4630 and the cs4280 | ||
7 | products. This driver uses the generic ac97_codec driver for AC97 codec | ||
8 | support. | ||
9 | |||
10 | |||
11 | Features: | ||
12 | |||
13 | Full Duplex Playback/Capture supported from 8k-48k. | ||
14 | 16Bit Signed LE & 8Bit Unsigned, with Mono or Stereo supported. | ||
15 | |||
16 | APM/PM - 2.2.x PM is enabled and functional. APM can also | ||
17 | be enabled for 2.4.x by modifying the CS46XX_ACPI_SUPPORT macro | ||
18 | definition. | ||
19 | |||
20 | DMA playback buffer size is configurable from 16k (defaultorder=2) up to 2Meg | ||
21 | (defaultorder=11). DMA capture buffer size is fixed at a single 4k page as | ||
22 | two 2k fragments. | ||
23 | |||
24 | MMAP seems to work well with QuakeIII, and test XMMS plugin. | ||
25 | |||
26 | Myth2 works, but the polling logic is not fully correct, but is functional. | ||
27 | |||
28 | The 2.4.4-ac6 gameport code in the cs461x joystick driver has been tested | ||
29 | with a Microsoft Sidewinder joystick (cs461x.o and sidewinder.o). This | ||
30 | audio driver must be loaded prior to the joystick driver to enable the | ||
31 | DSP task image supporting the joystick device. | ||
32 | |||
33 | |||
34 | Limitations: | ||
35 | |||
36 | SPDIF is currently not supported. | ||
37 | |||
38 | Primary codec support only. No secondary codec support is implemented. | ||
39 | |||
40 | |||
41 | |||
42 | NOTES: | ||
43 | |||
44 | Hercules Game Theatre XP - the EGPIO2 pin controls the external Amp, | ||
45 | and has been tested. | ||
46 | Module parameter hercules_egpio_disable set to 1, will force a 0 to EGPIODR | ||
47 | to disable the external amplifier. | ||
48 | |||
49 | VTB Santa Cruz - the GPIO7/GPIO8 on the Secondary Codec control | ||
50 | the external amplifier for the "back" speakers, since we do not | ||
51 | support the secondary codec then this external amp is not | ||
52 | turned on. The primary codec external amplifier is supported but | ||
53 | note that the AC97 EAPD bit is inverted logic (amp_voyetra()). | ||
54 | |||
55 | DMA buffer size - there are issues with many of the Linux applications | ||
56 | concerning the optimal buffer size. Several applications request a | ||
57 | certain fragment size and number and then do not verify that the driver | ||
58 | has the ability to support the requested configuration. | ||
59 | SNDCTL_DSP_SETFRAGMENT ioctl is used to request a fragment size and | ||
60 | number of fragments. Some applications exit if an error is returned | ||
61 | on this particular ioctl. Therefore, in alignment with the other OSS audio | ||
62 | drivers, no error is returned when a SETFRAGs IOCTL is received, but the | ||
63 | values passed from the app are not used in any buffer calculation | ||
64 | (ossfragshift/ossmaxfrags are not used). | ||
65 | Use the "defaultorder=N" module parameter to change the buffer size if | ||
66 | you have an application that requires a specific number of fragments | ||
67 | or a specific buffer size (see below). | ||
68 | |||
69 | Debug Interface | ||
70 | --------------- | ||
71 | There is an ioctl debug interface to allow runtime modification of the | ||
72 | debug print levels. This debug interface code can be disabled from the | ||
73 | compilation process with commenting the following define: | ||
74 | #define CSDEBUG_INTERFACE 1 | ||
75 | There is also a debug print methodolgy to select printf statements from | ||
76 | different areas of the driver. A debug print level is also used to allow | ||
77 | additional printfs to be active. Comment out the following line in the | ||
78 | driver to disable compilation of the CS_DBGOUT print statements: | ||
79 | #define CSDEBUG 1 | ||
80 | |||
81 | Please see the definitions for cs_debuglevel and cs_debugmask for additional | ||
82 | information on the debug levels and sections. | ||
83 | |||
84 | There is also a csdbg executable to allow runtime manipulation of these | ||
85 | parameters. for a copy email: twoller@crystal.cirrus.com | ||
86 | |||
87 | |||
88 | |||
89 | MODULE_PARMS definitions | ||
90 | ------------------------ | ||
91 | module_param(defaultorder, ulong, 0); | ||
92 | defaultorder=N | ||
93 | where N is a value from 1 to 12 | ||
94 | The buffer order determines the size of the dma buffer for the driver. | ||
95 | under Linux, a smaller buffer allows more responsiveness from many of the | ||
96 | applications (e.g. games). A larger buffer allows some of the apps (esound) | ||
97 | to not underrun the dma buffer as easily. As default, use 32k (order=3) | ||
98 | rather than 64k as some of the games work more responsively. | ||
99 | (2^N) * PAGE_SIZE = allocated buffer size | ||
100 | |||
101 | module_param(cs_debuglevel, ulong, 0644); | ||
102 | module_param(cs_debugmask, ulong, 0644); | ||
103 | cs_debuglevel=N | ||
104 | cs_debugmask=0xMMMMMMMM | ||
105 | where N is a value from 0 (no debug printfs), to 9 (maximum) | ||
106 | 0xMMMMMMMM is a debug mask corresponding to the CS_xxx bits (see driver source). | ||
107 | |||
108 | module_param(hercules_egpio_disable, ulong, 0); | ||
109 | hercules_egpio_disable=N | ||
110 | where N is a 0 (enable egpio), or a 1 (disable egpio support) | ||
111 | |||
112 | module_param(initdelay, ulong, 0); | ||
113 | initdelay=N | ||
114 | This value is used to determine the millescond delay during the initialization | ||
115 | code prior to powering up the PLL. On laptops this value can be used to | ||
116 | assist with errors on resume, mostly with IBM laptops. Basically, if the | ||
117 | system is booted under battery power then the mdelay()/udelay() functions fail to | ||
118 | properly delay the required time. Also, if the system is booted under AC power | ||
119 | and then the power removed, the mdelay()/udelay() functions will not delay properly. | ||
120 | |||
121 | module_param(powerdown, ulong, 0); | ||
122 | powerdown=N | ||
123 | where N is 0 (disable any powerdown of the internal blocks) or 1 (enable powerdown) | ||
124 | |||
125 | |||
126 | module_param(external_amp, bool, 0); | ||
127 | external_amp=1 | ||
128 | if N is set to 1, then force enabling the EAPD support in the primary AC97 codec. | ||
129 | override the detection logic and force the external amp bit in the AC97 0x26 register | ||
130 | to be reset (0). EAPD should be 0 for powerup, and 1 for powerdown. The VTB Santa Cruz | ||
131 | card has inverted logic, so there is a special function for these cards. | ||
132 | |||
133 | module_param(thinkpad, bool, 0); | ||
134 | thinkpad=1 | ||
135 | if N is set to 1, then force enabling the clkrun functionality. | ||
136 | Currently, when the part is being used, then clkrun is disabled for the entire system, | ||
137 | but re-enabled when the driver is released or there is no outstanding open count. | ||
138 | |||
diff --git a/Documentation/spi/spi-lm70llp b/Documentation/spi/spi-lm70llp new file mode 100644 index 000000000000..154bd02220b9 --- /dev/null +++ b/Documentation/spi/spi-lm70llp | |||
@@ -0,0 +1,69 @@ | |||
1 | spi_lm70llp : LM70-LLP parport-to-SPI adapter | ||
2 | ============================================== | ||
3 | |||
4 | Supported board/chip: | ||
5 | * National Semiconductor LM70 LLP evaluation board | ||
6 | Datasheet: http://www.national.com/pf/LM/LM70.html | ||
7 | |||
8 | Author: | ||
9 | Kaiwan N Billimoria <kaiwan@designergraphix.com> | ||
10 | |||
11 | Description | ||
12 | ----------- | ||
13 | This driver provides glue code connecting a National Semiconductor LM70 LLP | ||
14 | temperature sensor evaluation board to the kernel's SPI core subsystem. | ||
15 | |||
16 | In effect, this driver turns the parallel port interface on the eval board | ||
17 | into a SPI bus with a single device, which will be driven by the generic | ||
18 | LM70 driver (drivers/hwmon/lm70.c). | ||
19 | |||
20 | The hardware interfacing on the LM70 LLP eval board is as follows: | ||
21 | |||
22 | Parallel LM70 LLP | ||
23 | Port Direction JP2 Header | ||
24 | ----------- --------- ---------------- | ||
25 | D0 2 - - | ||
26 | D1 3 --> V+ 5 | ||
27 | D2 4 --> V+ 5 | ||
28 | D3 5 --> V+ 5 | ||
29 | D4 6 --> V+ 5 | ||
30 | D5 7 --> nCS 8 | ||
31 | D6 8 --> SCLK 3 | ||
32 | D7 9 --> SI/O 5 | ||
33 | GND 25 - GND 7 | ||
34 | Select 13 <-- SI/O 1 | ||
35 | ----------- --------- ---------------- | ||
36 | |||
37 | Note that since the LM70 uses a "3-wire" variant of SPI, the SI/SO pin | ||
38 | is connected to both pin D7 (as Master Out) and Select (as Master In) | ||
39 | using an arrangment that lets either the parport or the LM70 pull the | ||
40 | pin low. This can't be shared with true SPI devices, but other 3-wire | ||
41 | devices might share the same SI/SO pin. | ||
42 | |||
43 | The bitbanger routine in this driver (lm70_txrx) is called back from | ||
44 | the bound "hwmon/lm70" protocol driver through its sysfs hook, using a | ||
45 | spi_write_then_read() call. It performs Mode 0 (SPI/Microwire) bitbanging. | ||
46 | The lm70 driver then inteprets the resulting digital temperature value | ||
47 | and exports it through sysfs. | ||
48 | |||
49 | A "gotcha": National Semiconductor's LM70 LLP eval board circuit schematic | ||
50 | shows that the SI/O line from the LM70 chip is connected to the base of a | ||
51 | transistor Q1 (and also a pullup, and a zener diode to D7); while the | ||
52 | collector is tied to VCC. | ||
53 | |||
54 | Interpreting this circuit, when the LM70 SI/O line is High (or tristate | ||
55 | and not grounded by the host via D7), the transistor conducts and switches | ||
56 | the collector to zero, which is reflected on pin 13 of the DB25 parport | ||
57 | connector. When SI/O is Low (driven by the LM70 or the host) on the other | ||
58 | hand, the transistor is cut off and the voltage tied to it's collector is | ||
59 | reflected on pin 13 as a High level. | ||
60 | |||
61 | So: the getmiso inline routine in this driver takes this fact into account, | ||
62 | inverting the value read at pin 13. | ||
63 | |||
64 | |||
65 | Thanks to | ||
66 | --------- | ||
67 | o David Brownell for mentoring the SPI-side driver development. | ||
68 | o Dr.Craig Hollabaugh for the (early) "manual" bitbanging driver version. | ||
69 | o Nadir Billimoria for help interpreting the circuit schematic. | ||
diff --git a/Documentation/spinlocks.txt b/Documentation/spinlocks.txt index a661d684768e..471e75389778 100644 --- a/Documentation/spinlocks.txt +++ b/Documentation/spinlocks.txt | |||
@@ -1,7 +1,12 @@ | |||
1 | UPDATE March 21 2005 Amit Gud <gud@eth.net> | 1 | SPIN_LOCK_UNLOCKED and RW_LOCK_UNLOCKED defeat lockdep state tracking and |
2 | are hence deprecated. | ||
2 | 3 | ||
3 | Macros SPIN_LOCK_UNLOCKED and RW_LOCK_UNLOCKED are deprecated and will be | 4 | Please use DEFINE_SPINLOCK()/DEFINE_RWLOCK() or |
4 | removed soon. So for any new code dynamic initialization should be used: | 5 | __SPIN_LOCK_UNLOCKED()/__RW_LOCK_UNLOCKED() as appropriate for static |
6 | initialization. | ||
7 | |||
8 | Dynamic initialization, when necessary, may be performed as | ||
9 | demonstrated below. | ||
5 | 10 | ||
6 | spinlock_t xxx_lock; | 11 | spinlock_t xxx_lock; |
7 | rwlock_t xxx_rw_lock; | 12 | rwlock_t xxx_rw_lock; |
@@ -15,12 +20,9 @@ removed soon. So for any new code dynamic initialization should be used: | |||
15 | 20 | ||
16 | module_init(xxx_init); | 21 | module_init(xxx_init); |
17 | 22 | ||
18 | Reasons for deprecation | 23 | The following discussion is still valid, however, with the dynamic |
19 | - it hurts automatic lock validators | 24 | initialization of spinlocks or with DEFINE_SPINLOCK, etc., used |
20 | - it becomes intrusive for the realtime preemption patches | 25 | instead of SPIN_LOCK_UNLOCKED. |
21 | |||
22 | Following discussion is still valid, however, with the dynamic initialization | ||
23 | of spinlocks instead of static. | ||
24 | 26 | ||
25 | ----------------------- | 27 | ----------------------- |
26 | 28 | ||
diff --git a/Documentation/sysctl/ctl_unnumbered.txt b/Documentation/sysctl/ctl_unnumbered.txt new file mode 100644 index 000000000000..23003a8ea3e7 --- /dev/null +++ b/Documentation/sysctl/ctl_unnumbered.txt | |||
@@ -0,0 +1,22 @@ | |||
1 | |||
2 | Except for a few extremely rare exceptions user space applications do not use | ||
3 | the binary sysctl interface. Instead everyone uses /proc/sys/... with | ||
4 | readable ascii names. | ||
5 | |||
6 | Recently the kernel has started supporting setting the binary sysctl value to | ||
7 | CTL_UNNUMBERED so we no longer need to assign a binary sysctl path to allow | ||
8 | sysctls to show up in /proc/sys. | ||
9 | |||
10 | Assigning binary sysctl numbers is an endless source of conflicts in sysctl.h, | ||
11 | breaking of the user space ABI (because of those conflicts), and maintenance | ||
12 | problems. A complete pass through all of the sysctl users revealed multiple | ||
13 | instances where the sysctl binary interface was broken and had gone undetected | ||
14 | for years. | ||
15 | |||
16 | So please do not add new binary sysctl numbers. They are unneeded and | ||
17 | problematic. | ||
18 | |||
19 | If you really need a new binary sysctl number please first merge your sysctl | ||
20 | into the kernel and then as a separate patch allocate a binary sysctl number. | ||
21 | |||
22 | (ebiederm@xmission.com, June 2007) | ||
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt index 1d192565e182..a0ccc5b60260 100644 --- a/Documentation/sysctl/vm.txt +++ b/Documentation/sysctl/vm.txt | |||
@@ -31,12 +31,15 @@ Currently, these files are in /proc/sys/vm: | |||
31 | - min_unmapped_ratio | 31 | - min_unmapped_ratio |
32 | - min_slab_ratio | 32 | - min_slab_ratio |
33 | - panic_on_oom | 33 | - panic_on_oom |
34 | - mmap_min_address | ||
35 | - numa_zonelist_order | ||
34 | 36 | ||
35 | ============================================================== | 37 | ============================================================== |
36 | 38 | ||
37 | dirty_ratio, dirty_background_ratio, dirty_expire_centisecs, | 39 | dirty_ratio, dirty_background_ratio, dirty_expire_centisecs, |
38 | dirty_writeback_centisecs, vfs_cache_pressure, laptop_mode, | 40 | dirty_writeback_centisecs, vfs_cache_pressure, laptop_mode, |
39 | block_dump, swap_token_timeout, drop-caches: | 41 | block_dump, swap_token_timeout, drop-caches, |
42 | hugepages_treat_as_movable: | ||
40 | 43 | ||
41 | See Documentation/filesystems/proc.txt | 44 | See Documentation/filesystems/proc.txt |
42 | 45 | ||
@@ -216,3 +219,61 @@ above-mentioned. | |||
216 | The default value is 0. | 219 | The default value is 0. |
217 | 1 and 2 are for failover of clustering. Please select either | 220 | 1 and 2 are for failover of clustering. Please select either |
218 | according to your policy of failover. | 221 | according to your policy of failover. |
222 | |||
223 | ============================================================== | ||
224 | |||
225 | mmap_min_addr | ||
226 | |||
227 | This file indicates the amount of address space which a user process will | ||
228 | be restricted from mmaping. Since kernel null dereference bugs could | ||
229 | accidentally operate based on the information in the first couple of pages | ||
230 | of memory userspace processes should not be allowed to write to them. By | ||
231 | default this value is set to 0 and no protections will be enforced by the | ||
232 | security module. Setting this value to something like 64k will allow the | ||
233 | vast majority of applications to work correctly and provide defense in depth | ||
234 | against future potential kernel bugs. | ||
235 | |||
236 | ============================================================== | ||
237 | |||
238 | numa_zonelist_order | ||
239 | |||
240 | This sysctl is only for NUMA. | ||
241 | 'where the memory is allocated from' is controlled by zonelists. | ||
242 | (This documentation ignores ZONE_HIGHMEM/ZONE_DMA32 for simple explanation. | ||
243 | you may be able to read ZONE_DMA as ZONE_DMA32...) | ||
244 | |||
245 | In non-NUMA case, a zonelist for GFP_KERNEL is ordered as following. | ||
246 | ZONE_NORMAL -> ZONE_DMA | ||
247 | This means that a memory allocation request for GFP_KERNEL will | ||
248 | get memory from ZONE_DMA only when ZONE_NORMAL is not available. | ||
249 | |||
250 | In NUMA case, you can think of following 2 types of order. | ||
251 | Assume 2 node NUMA and below is zonelist of Node(0)'s GFP_KERNEL | ||
252 | |||
253 | (A) Node(0) ZONE_NORMAL -> Node(0) ZONE_DMA -> Node(1) ZONE_NORMAL | ||
254 | (B) Node(0) ZONE_NORMAL -> Node(1) ZONE_NORMAL -> Node(0) ZONE_DMA. | ||
255 | |||
256 | Type(A) offers the best locality for processes on Node(0), but ZONE_DMA | ||
257 | will be used before ZONE_NORMAL exhaustion. This increases possibility of | ||
258 | out-of-memory(OOM) of ZONE_DMA because ZONE_DMA is tend to be small. | ||
259 | |||
260 | Type(B) cannot offer the best locality but is more robust against OOM of | ||
261 | the DMA zone. | ||
262 | |||
263 | Type(A) is called as "Node" order. Type (B) is "Zone" order. | ||
264 | |||
265 | "Node order" orders the zonelists by node, then by zone within each node. | ||
266 | Specify "[Nn]ode" for zone order | ||
267 | |||
268 | "Zone Order" orders the zonelists by zone type, then by node within each | ||
269 | zone. Specify "[Zz]one"for zode order. | ||
270 | |||
271 | Specify "[Dd]efault" to request automatic configuration. Autoconfiguration | ||
272 | will select "node" order in following case. | ||
273 | (1) if the DMA zone does not exist or | ||
274 | (2) if the DMA zone comprises greater than 50% of the available memory or | ||
275 | (3) if any node's DMA zone comprises greater than 60% of its local memory and | ||
276 | the amount of local memory is big enough. | ||
277 | |||
278 | Otherwise, "zone" order will be selected. Default order is recommended unless | ||
279 | this is causing problems for your system/application. | ||
diff --git a/Documentation/sysfs-rules.txt b/Documentation/sysfs-rules.txt new file mode 100644 index 000000000000..42861bb0bc9b --- /dev/null +++ b/Documentation/sysfs-rules.txt | |||
@@ -0,0 +1,166 @@ | |||
1 | Rules on how to access information in the Linux kernel sysfs | ||
2 | |||
3 | The kernel exported sysfs exports internal kernel implementation-details | ||
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 | ||
6 | internal API. As sysfs is a direct export of kernel internal | ||
7 | structures, the sysfs interface can not provide a stable interface eighter, | ||
8 | it may always change along with internal kernel changes. | ||
9 | |||
10 | 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 | ||
12 | of sysfs must follow some rules to use an as abstract-as-possible way to | ||
13 | access this filesystem. The current udev and HAL programs already | ||
14 | implement this and users are encouraged to plug, if possible, into the | ||
15 | abstractions these programs provide instead of accessing sysfs | ||
16 | directly. | ||
17 | |||
18 | But if you really do want or need to access sysfs directly, please follow | ||
19 | the following rules and then your programs should work with future | ||
20 | versions of the sysfs interface. | ||
21 | |||
22 | - Do not use libsysfs | ||
23 | It makes assumptions about sysfs which are not true. Its API does not | ||
24 | offer any abstraction, it exposes all the kernel driver-core | ||
25 | implementation details in its own API. Therefore it is not better than | ||
26 | reading directories and opening the files yourself. | ||
27 | Also, it is not actively maintained, in the sense of reflecting the | ||
28 | current kernel-development. The goal of providing a stable interface | ||
29 | to sysfs has failed, it causes more problems, than it solves. It | ||
30 | violates many of the rules in this document. | ||
31 | |||
32 | - sysfs is always at /sys | ||
33 | Parsing /proc/mounts is a waste of time. Other mount points are a | ||
34 | system configuration bug you should not try to solve. For test cases, | ||
35 | possibly support a SYSFS_PATH environment variable to overwrite the | ||
36 | applications behavior, but never try to search for sysfs. Never try | ||
37 | to mount it, if you are not an early boot script. | ||
38 | |||
39 | - devices are only "devices" | ||
40 | There is no such thing like class-, bus-, physical devices, | ||
41 | interfaces, and such that you can rely on in userspace. Everything is | ||
42 | just simply a "device". Class-, bus-, physical, ... types are just | ||
43 | kernel implementation details, which should not be expected by | ||
44 | applications that look for devices in sysfs. | ||
45 | |||
46 | The properties of a device are: | ||
47 | o devpath (/devices/pci0000:00/0000:00:1d.1/usb2/2-2/2-2:1.0) | ||
48 | - identical to the DEVPATH value in the event sent from the kernel | ||
49 | at device creation and removal | ||
50 | - the unique key to the device at that point in time | ||
51 | - the kernels path to the device-directory without the leading | ||
52 | /sys, and always starting with with a slash | ||
53 | - all elements of a devpath must be real directories. Symlinks | ||
54 | pointing to /sys/devices must always be resolved to their real | ||
55 | target, and the target path must be used to access the device. | ||
56 | That way the devpath to the device matches the devpath of the | ||
57 | kernel used at event time. | ||
58 | - using or exposing symlink values as elements in a devpath string | ||
59 | is a bug in the application | ||
60 | |||
61 | o kernel name (sda, tty, 0000:00:1f.2, ...) | ||
62 | - a directory name, identical to the last element of the devpath | ||
63 | - applications need to handle spaces and characters like '!' in | ||
64 | the name | ||
65 | |||
66 | o subsystem (block, tty, pci, ...) | ||
67 | - simple string, never a path or a link | ||
68 | - retrieved by reading the "subsystem"-link and using only the | ||
69 | last element of the target path | ||
70 | |||
71 | o driver (tg3, ata_piix, uhci_hcd) | ||
72 | - a simple string, which may contain spaces, never a path or a | ||
73 | link | ||
74 | - it is retrieved by reading the "driver"-link and using only the | ||
75 | last element of the target path | ||
76 | - devices which do not have "driver"-link, just do not have a | ||
77 | driver; copying the driver value in a child device context, is a | ||
78 | bug in the application | ||
79 | |||
80 | o attributes | ||
81 | - the files in the device directory or files below a subdirectories | ||
82 | of the same device directory | ||
83 | - accessing attributes reached by a symlink pointing to another device, | ||
84 | like the "device"-link, is a bug in the application | ||
85 | |||
86 | Everything else is just a kernel driver-core implementation detail, | ||
87 | that should not be assumed to be stable across kernel releases. | ||
88 | |||
89 | - Properties of parent devices never belong into a child device. | ||
90 | Always look at the parent devices themselves for determining device | ||
91 | context properties. If the device 'eth0' or 'sda' does not have a | ||
92 | "driver"-link, then this device does not have a driver. Its value is empty. | ||
93 | Never copy any property of the parent-device into a child-device. Parent | ||
94 | device-properties may change dynamically without any notice to the | ||
95 | child device. | ||
96 | |||
97 | - Hierarchy in a single device-tree | ||
98 | There is only one valid place in sysfs where hierarchy can be examined | ||
99 | and this is below: /sys/devices. | ||
100 | It is planned, that all device directories will end up in the tree | ||
101 | below this directory. | ||
102 | |||
103 | - Classification by subsystem | ||
104 | There are currently three places for classification of devices: | ||
105 | /sys/block, /sys/class and /sys/bus. It is planned that these will | ||
106 | not contain any device-directories themselves, but only flat lists of | ||
107 | symlinks pointing to the unified /sys/devices tree. | ||
108 | All three places have completely different rules on how to access | ||
109 | device information. It is planned to merge all three | ||
110 | classification-directories into one place at /sys/subsystem, | ||
111 | following the layout of the bus-directories. All buses and | ||
112 | classes, including the converted block-subsystem, will show up | ||
113 | there. | ||
114 | The devices belonging to a subsystem will create a symlink in the | ||
115 | "devices" directory at /sys/subsystem/<name>/devices. | ||
116 | |||
117 | If /sys/subsystem exists, /sys/bus, /sys/class and /sys/block can be | ||
118 | ignored. If it does not exist, you have always to scan all three | ||
119 | places, as the kernel is free to move a subsystem from one place to | ||
120 | the other, as long as the devices are still reachable by the same | ||
121 | subsystem name. | ||
122 | |||
123 | Assuming /sys/class/<subsystem> and /sys/bus/<subsystem>, or | ||
124 | /sys/block and /sys/class/block are not interchangeable, is a bug in | ||
125 | the application. | ||
126 | |||
127 | - Block | ||
128 | The converted block-subsystem at /sys/class/block, or | ||
129 | /sys/subsystem/block will contain the links for disks and partitions | ||
130 | at the same level, never in a hierarchy. Assuming the block-subsytem to | ||
131 | contain only disks and not partition-devices in the same flat list is | ||
132 | a bug in the application. | ||
133 | |||
134 | - "device"-link and <subsystem>:<kernel name>-links | ||
135 | Never depend on the "device"-link. The "device"-link is a workaround | ||
136 | for the old layout, where class-devices are not created in | ||
137 | /sys/devices/ like the bus-devices. If the link-resolving of a | ||
138 | device-directory does not end in /sys/devices/, you can use the | ||
139 | "device"-link to find the parent devices in /sys/devices/. That is the | ||
140 | single valid use of the "device"-link, it must never appear in any | ||
141 | path as an element. Assuming the existence of the "device"-link for | ||
142 | a device in /sys/devices/ is a bug in the application. | ||
143 | Accessing /sys/class/net/eth0/device is a bug in the application. | ||
144 | |||
145 | Never depend on the class-specific links back to the /sys/class | ||
146 | directory. These links are also a workaround for the design mistake | ||
147 | that class-devices are not created in /sys/devices. If a device | ||
148 | directory does not contain directories for child devices, these links | ||
149 | may be used to find the child devices in /sys/class. That is the single | ||
150 | valid use of these links, they must never appear in any path as an | ||
151 | element. Assuming the existence of these links for devices which are | ||
152 | real child device directories in the /sys/devices tree, is a bug in | ||
153 | the application. | ||
154 | |||
155 | It is planned to remove all these links when when all class-device | ||
156 | directories live in /sys/devices. | ||
157 | |||
158 | - Position of devices along device chain can change. | ||
159 | Never depend on a specific parent device position in the devpath, | ||
160 | or the chain of parent devices. The kernel is free to insert devices into | ||
161 | the chain. You must always request the parent device you are looking for | ||
162 | by its subsystem value. You need to walk up the chain until you find | ||
163 | the device that matches the expected subsystem. Depending on a specific | ||
164 | position of a parent device, or exposing relative paths, using "../" to | ||
165 | access the chain of parents, is a bug in the application. | ||
166 | |||
diff --git a/Documentation/thinkpad-acpi.txt b/Documentation/thinkpad-acpi.txt index 2d4803359a04..9e6b94face4b 100644 --- a/Documentation/thinkpad-acpi.txt +++ b/Documentation/thinkpad-acpi.txt | |||
@@ -138,7 +138,7 @@ Hot keys | |||
138 | -------- | 138 | -------- |
139 | 139 | ||
140 | procfs: /proc/acpi/ibm/hotkey | 140 | procfs: /proc/acpi/ibm/hotkey |
141 | sysfs device attribute: hotkey/* | 141 | sysfs device attribute: hotkey_* |
142 | 142 | ||
143 | Without this driver, only the Fn-F4 key (sleep button) generates an | 143 | Without this driver, only the Fn-F4 key (sleep button) generates an |
144 | ACPI event. With the driver loaded, the hotkey feature enabled and the | 144 | ACPI event. With the driver loaded, the hotkey feature enabled and the |
@@ -196,10 +196,7 @@ The following commands can be written to the /proc/acpi/ibm/hotkey file: | |||
196 | 196 | ||
197 | sysfs notes: | 197 | sysfs notes: |
198 | 198 | ||
199 | The hot keys attributes are in a hotkey/ subdirectory off the | 199 | hotkey_bios_enabled: |
200 | thinkpad device. | ||
201 | |||
202 | bios_enabled: | ||
203 | Returns the status of the hot keys feature when | 200 | Returns the status of the hot keys feature when |
204 | thinkpad-acpi was loaded. Upon module unload, the hot | 201 | thinkpad-acpi was loaded. Upon module unload, the hot |
205 | key feature status will be restored to this value. | 202 | key feature status will be restored to this value. |
@@ -207,19 +204,19 @@ sysfs notes: | |||
207 | 0: hot keys were disabled | 204 | 0: hot keys were disabled |
208 | 1: hot keys were enabled | 205 | 1: hot keys were enabled |
209 | 206 | ||
210 | bios_mask: | 207 | hotkey_bios_mask: |
211 | Returns the hot keys mask when thinkpad-acpi was loaded. | 208 | Returns the hot keys mask when thinkpad-acpi was loaded. |
212 | Upon module unload, the hot keys mask will be restored | 209 | Upon module unload, the hot keys mask will be restored |
213 | to this value. | 210 | to this value. |
214 | 211 | ||
215 | enable: | 212 | hotkey_enable: |
216 | Enables/disables the hot keys feature, and reports | 213 | Enables/disables the hot keys feature, and reports |
217 | current status of the hot keys feature. | 214 | current status of the hot keys feature. |
218 | 215 | ||
219 | 0: disables the hot keys feature / feature disabled | 216 | 0: disables the hot keys feature / feature disabled |
220 | 1: enables the hot keys feature / feature enabled | 217 | 1: enables the hot keys feature / feature enabled |
221 | 218 | ||
222 | mask: | 219 | hotkey_mask: |
223 | bit mask to enable ACPI event generation for each hot | 220 | bit mask to enable ACPI event generation for each hot |
224 | key (see above). Returns the current status of the hot | 221 | key (see above). Returns the current status of the hot |
225 | keys mask, and allows one to modify it. | 222 | keys mask, and allows one to modify it. |
@@ -229,7 +226,7 @@ Bluetooth | |||
229 | --------- | 226 | --------- |
230 | 227 | ||
231 | procfs: /proc/acpi/ibm/bluetooth | 228 | procfs: /proc/acpi/ibm/bluetooth |
232 | sysfs device attribute: bluetooth/enable | 229 | sysfs device attribute: bluetooth_enable |
233 | 230 | ||
234 | This feature shows the presence and current state of a ThinkPad | 231 | This feature shows the presence and current state of a ThinkPad |
235 | Bluetooth device in the internal ThinkPad CDC slot. | 232 | Bluetooth device in the internal ThinkPad CDC slot. |
@@ -244,7 +241,7 @@ If Bluetooth is installed, the following commands can be used: | |||
244 | Sysfs notes: | 241 | Sysfs notes: |
245 | 242 | ||
246 | If the Bluetooth CDC card is installed, it can be enabled / | 243 | If the Bluetooth CDC card is installed, it can be enabled / |
247 | disabled through the "bluetooth/enable" thinkpad-acpi device | 244 | disabled through the "bluetooth_enable" thinkpad-acpi device |
248 | attribute, and its current status can also be queried. | 245 | attribute, and its current status can also be queried. |
249 | 246 | ||
250 | enable: | 247 | enable: |
@@ -252,7 +249,7 @@ Sysfs notes: | |||
252 | 1: enables Bluetooth / Bluetooth is enabled. | 249 | 1: enables Bluetooth / Bluetooth is enabled. |
253 | 250 | ||
254 | Note: this interface will be probably be superseeded by the | 251 | Note: this interface will be probably be superseeded by the |
255 | generic rfkill class. | 252 | generic rfkill class, so it is NOT to be considered stable yet. |
256 | 253 | ||
257 | Video output control -- /proc/acpi/ibm/video | 254 | Video output control -- /proc/acpi/ibm/video |
258 | -------------------------------------------- | 255 | -------------------------------------------- |
@@ -898,7 +895,7 @@ EXPERIMENTAL: WAN | |||
898 | ----------------- | 895 | ----------------- |
899 | 896 | ||
900 | procfs: /proc/acpi/ibm/wan | 897 | procfs: /proc/acpi/ibm/wan |
901 | sysfs device attribute: wwan/enable | 898 | sysfs device attribute: wwan_enable |
902 | 899 | ||
903 | This feature is marked EXPERIMENTAL because the implementation | 900 | This feature is marked EXPERIMENTAL because the implementation |
904 | directly accesses hardware registers and may not work as expected. USE | 901 | directly accesses hardware registers and may not work as expected. USE |
@@ -921,7 +918,7 @@ If the W-WAN card is installed, the following commands can be used: | |||
921 | Sysfs notes: | 918 | Sysfs notes: |
922 | 919 | ||
923 | If the W-WAN card is installed, it can be enabled / | 920 | If the W-WAN card is installed, it can be enabled / |
924 | disabled through the "wwan/enable" thinkpad-acpi device | 921 | disabled through the "wwan_enable" thinkpad-acpi device |
925 | attribute, and its current status can also be queried. | 922 | attribute, and its current status can also be queried. |
926 | 923 | ||
927 | enable: | 924 | enable: |
@@ -929,7 +926,7 @@ Sysfs notes: | |||
929 | 1: enables WWAN card / WWAN card is enabled. | 926 | 1: enables WWAN card / WWAN card is enabled. |
930 | 927 | ||
931 | Note: this interface will be probably be superseeded by the | 928 | Note: this interface will be probably be superseeded by the |
932 | generic rfkill class. | 929 | generic rfkill class, so it is NOT to be considered stable yet. |
933 | 930 | ||
934 | Multiple Commands, Module Parameters | 931 | Multiple Commands, Module Parameters |
935 | ------------------------------------ | 932 | ------------------------------------ |
diff --git a/Documentation/time_interpolators.txt b/Documentation/time_interpolators.txt deleted file mode 100644 index e3b60854fbc2..000000000000 --- a/Documentation/time_interpolators.txt +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | Time Interpolators | ||
2 | ------------------ | ||
3 | |||
4 | Time interpolators are a base of time calculation between timer ticks and | ||
5 | allow an accurate determination of time down to the accuracy of the time | ||
6 | source in nanoseconds. | ||
7 | |||
8 | The architecture specific code typically provides gettimeofday and | ||
9 | settimeofday under Linux. The time interpolator provides both if an arch | ||
10 | defines CONFIG_TIME_INTERPOLATION. The arch still must set up timer tick | ||
11 | operations and call the necessary functions to advance the clock. | ||
12 | |||
13 | With the time interpolator a standardized interface exists for time | ||
14 | interpolation between ticks. The provided logic is highly scalable | ||
15 | and has been tested in SMP situations of up to 512 CPUs. | ||
16 | |||
17 | If CONFIG_TIME_INTERPOLATION is defined then the architecture specific code | ||
18 | (or the device drivers - like HPET) may register time interpolators. | ||
19 | These are typically defined in the following way: | ||
20 | |||
21 | static struct time_interpolator my_interpolator { | ||
22 | .frequency = MY_FREQUENCY, | ||
23 | .source = TIME_SOURCE_MMIO32, | ||
24 | .shift = 8, /* scaling for higher accuracy */ | ||
25 | .drift = -1, /* Unknown drift */ | ||
26 | .jitter = 0 /* time source is stable */ | ||
27 | }; | ||
28 | |||
29 | void time_init(void) | ||
30 | { | ||
31 | .... | ||
32 | /* Initialization of the timer *. | ||
33 | my_interpolator.address = &my_timer; | ||
34 | register_time_interpolator(&my_interpolator); | ||
35 | .... | ||
36 | } | ||
37 | |||
38 | For more details see include/linux/timex.h and kernel/timer.c. | ||
39 | |||
40 | Christoph Lameter <christoph@lameter.com>, October 31, 2004 | ||
41 | |||
diff --git a/Documentation/usb/dma.txt b/Documentation/usb/dma.txt index 62844aeba69c..e8b50b7de9d9 100644 --- a/Documentation/usb/dma.txt +++ b/Documentation/usb/dma.txt | |||
@@ -32,12 +32,15 @@ ELIMINATING COPIES | |||
32 | It's good to avoid making CPUs copy data needlessly. The costs can add up, | 32 | It's good to avoid making CPUs copy data needlessly. The costs can add up, |
33 | and effects like cache-trashing can impose subtle penalties. | 33 | and effects like cache-trashing can impose subtle penalties. |
34 | 34 | ||
35 | - When you're allocating a buffer for DMA purposes anyway, use the buffer | 35 | - If you're doing lots of small data transfers from the same buffer all |
36 | primitives. Think of them as kmalloc and kfree that give you the right | 36 | the time, that can really burn up resources on systems which use an |
37 | kind of addresses to store in urb->transfer_buffer and urb->transfer_dma, | 37 | IOMMU to manage the DMA mappings. It can cost MUCH more to set up and |
38 | while guaranteeing that no hidden copies through DMA "bounce" buffers will | 38 | tear down the IOMMU mappings with each request than perform the I/O! |
39 | slow things down. You'd also set URB_NO_TRANSFER_DMA_MAP in | 39 | |
40 | urb->transfer_flags: | 40 | For those specific cases, USB has primitives to allocate less expensive |
41 | memory. They work like kmalloc and kfree versions that give you the right | ||
42 | kind of addresses to store in urb->transfer_buffer and urb->transfer_dma. | ||
43 | You'd also set URB_NO_TRANSFER_DMA_MAP in urb->transfer_flags: | ||
41 | 44 | ||
42 | void *usb_buffer_alloc (struct usb_device *dev, size_t size, | 45 | void *usb_buffer_alloc (struct usb_device *dev, size_t size, |
43 | int mem_flags, dma_addr_t *dma); | 46 | int mem_flags, dma_addr_t *dma); |
@@ -45,6 +48,10 @@ and effects like cache-trashing can impose subtle penalties. | |||
45 | void usb_buffer_free (struct usb_device *dev, size_t size, | 48 | void usb_buffer_free (struct usb_device *dev, size_t size, |
46 | void *addr, dma_addr_t dma); | 49 | void *addr, dma_addr_t dma); |
47 | 50 | ||
51 | Most drivers should *NOT* be using these primitives; they don't need | ||
52 | to use this type of memory ("dma-coherent"), and memory returned from | ||
53 | kmalloc() will work just fine. | ||
54 | |||
48 | For control transfers you can use the buffer primitives or not for each | 55 | For control transfers you can use the buffer primitives or not for each |
49 | of the transfer buffer and setup buffer independently. Set the flag bits | 56 | of the transfer buffer and setup buffer independently. Set the flag bits |
50 | URB_NO_TRANSFER_DMA_MAP and URB_NO_SETUP_DMA_MAP to indicate which | 57 | URB_NO_TRANSFER_DMA_MAP and URB_NO_SETUP_DMA_MAP to indicate which |
@@ -54,29 +61,39 @@ and effects like cache-trashing can impose subtle penalties. | |||
54 | The memory buffer returned is "dma-coherent"; sometimes you might need to | 61 | The memory buffer returned is "dma-coherent"; sometimes you might need to |
55 | force a consistent memory access ordering by using memory barriers. It's | 62 | force a consistent memory access ordering by using memory barriers. It's |
56 | not using a streaming DMA mapping, so it's good for small transfers on | 63 | not using a streaming DMA mapping, so it's good for small transfers on |
57 | systems where the I/O would otherwise tie up an IOMMU mapping. (See | 64 | systems where the I/O would otherwise thrash an IOMMU mapping. (See |
58 | Documentation/DMA-mapping.txt for definitions of "coherent" and "streaming" | 65 | Documentation/DMA-mapping.txt for definitions of "coherent" and "streaming" |
59 | DMA mappings.) | 66 | DMA mappings.) |
60 | 67 | ||
61 | Asking for 1/Nth of a page (as well as asking for N pages) is reasonably | 68 | Asking for 1/Nth of a page (as well as asking for N pages) is reasonably |
62 | space-efficient. | 69 | space-efficient. |
63 | 70 | ||
71 | On most systems the memory returned will be uncached, because the | ||
72 | semantics of dma-coherent memory require either bypassing CPU caches | ||
73 | or using cache hardware with bus-snooping support. While x86 hardware | ||
74 | has such bus-snooping, many other systems use software to flush cache | ||
75 | lines to prevent DMA conflicts. | ||
76 | |||
64 | - Devices on some EHCI controllers could handle DMA to/from high memory. | 77 | - Devices on some EHCI controllers could handle DMA to/from high memory. |
65 | Driver probe() routines can notice this using a generic DMA call, then | ||
66 | tell higher level code (network, scsi, etc) about it like this: | ||
67 | 78 | ||
68 | if (dma_supported (&intf->dev, 0xffffffffffffffffULL)) | 79 | Unfortunately, the current Linux DMA infrastructure doesn't have a sane |
69 | net->features |= NETIF_F_HIGHDMA; | 80 | way to expose these capabilities ... and in any case, HIGHMEM is mostly a |
81 | design wart specific to x86_32. So your best bet is to ensure you never | ||
82 | pass a highmem buffer into a USB driver. That's easy; it's the default | ||
83 | behavior. Just don't override it; e.g. with NETIF_F_HIGHDMA. | ||
70 | 84 | ||
71 | That can eliminate dma bounce buffering of requests that originate (or | 85 | This may force your callers to do some bounce buffering, copying from |
72 | terminate) in high memory, in cases where the buffers aren't allocated | 86 | high memory to "normal" DMA memory. If you can come up with a good way |
73 | with usb_buffer_alloc() but instead are dma-mapped. | 87 | to fix this issue (for x86_32 machines with over 1 GByte of memory), |
88 | feel free to submit patches. | ||
74 | 89 | ||
75 | 90 | ||
76 | WORKING WITH EXISTING BUFFERS | 91 | WORKING WITH EXISTING BUFFERS |
77 | 92 | ||
78 | Existing buffers aren't usable for DMA without first being mapped into the | 93 | Existing buffers aren't usable for DMA without first being mapped into the |
79 | DMA address space of the device. | 94 | DMA address space of the device. However, most buffers passed to your |
95 | driver can safely be used with such DMA mapping. (See the first section | ||
96 | of DMA-mapping.txt, titled "What memory is DMA-able?") | ||
80 | 97 | ||
81 | - When you're using scatterlists, you can map everything at once. On some | 98 | - When you're using scatterlists, you can map everything at once. On some |
82 | systems, this kicks in an IOMMU and turns the scatterlists into single | 99 | systems, this kicks in an IOMMU and turns the scatterlists into single |
@@ -114,3 +131,8 @@ DMA address space of the device. | |||
114 | The calls manage urb->transfer_dma for you, and set URB_NO_TRANSFER_DMA_MAP | 131 | The calls manage urb->transfer_dma for you, and set URB_NO_TRANSFER_DMA_MAP |
115 | so that usbcore won't map or unmap the buffer. The same goes for | 132 | so that usbcore won't map or unmap the buffer. The same goes for |
116 | urb->setup_dma and URB_NO_SETUP_DMA_MAP for control requests. | 133 | urb->setup_dma and URB_NO_SETUP_DMA_MAP for control requests. |
134 | |||
135 | Note that several of those interfaces are currently commented out, since | ||
136 | they don't have current users. See the source code. Other than the dmasync | ||
137 | calls (where the underlying DMA primitives have changed), most of them can | ||
138 | easily be commented back in if you want to use them. | ||
diff --git a/Documentation/usb/persist.txt b/Documentation/usb/persist.txt new file mode 100644 index 000000000000..df54d645cbb5 --- /dev/null +++ b/Documentation/usb/persist.txt | |||
@@ -0,0 +1,156 @@ | |||
1 | USB device persistence during system suspend | ||
2 | |||
3 | Alan Stern <stern@rowland.harvard.edu> | ||
4 | |||
5 | September 2, 2006 (Updated May 29, 2007) | ||
6 | |||
7 | |||
8 | What is the problem? | ||
9 | |||
10 | According to the USB specification, when a USB bus is suspended the | ||
11 | bus must continue to supply suspend current (around 1-5 mA). This | ||
12 | is so that devices can maintain their internal state and hubs can | ||
13 | detect connect-change events (devices being plugged in or unplugged). | ||
14 | The technical term is "power session". | ||
15 | |||
16 | If a USB device's power session is interrupted then the system is | ||
17 | required to behave as though the device has been unplugged. It's a | ||
18 | conservative approach; in the absence of suspend current the computer | ||
19 | has no way to know what has actually happened. Perhaps the same | ||
20 | device is still attached or perhaps it was removed and a different | ||
21 | device plugged into the port. The system must assume the worst. | ||
22 | |||
23 | By default, Linux behaves according to the spec. If a USB host | ||
24 | controller loses power during a system suspend, then when the system | ||
25 | wakes up all the devices attached to that controller are treated as | ||
26 | though they had disconnected. This is always safe and it is the | ||
27 | "officially correct" thing to do. | ||
28 | |||
29 | For many sorts of devices this behavior doesn't matter in the least. | ||
30 | If the kernel wants to believe that your USB keyboard was unplugged | ||
31 | while the system was asleep and a new keyboard was plugged in when the | ||
32 | system woke up, who cares? It'll still work the same when you type on | ||
33 | it. | ||
34 | |||
35 | Unfortunately problems _can_ arise, particularly with mass-storage | ||
36 | devices. The effect is exactly the same as if the device really had | ||
37 | been unplugged while the system was suspended. If you had a mounted | ||
38 | filesystem on the device, you're out of luck -- everything in that | ||
39 | filesystem is now inaccessible. This is especially annoying if your | ||
40 | root filesystem was located on the device, since your system will | ||
41 | instantly crash. | ||
42 | |||
43 | Loss of power isn't the only mechanism to worry about. Anything that | ||
44 | interrupts a power session will have the same effect. For example, | ||
45 | even though suspend current may have been maintained while the system | ||
46 | was asleep, on many systems during the initial stages of wakeup the | ||
47 | firmware (i.e., the BIOS) resets the motherboard's USB host | ||
48 | controllers. Result: all the power sessions are destroyed and again | ||
49 | it's as though you had unplugged all the USB devices. Yes, it's | ||
50 | entirely the BIOS's fault, but that doesn't do _you_ any good unless | ||
51 | you can convince the BIOS supplier to fix the problem (lots of luck!). | ||
52 | |||
53 | On many systems the USB host controllers will get reset after a | ||
54 | suspend-to-RAM. On almost all systems, no suspend current is | ||
55 | available during hibernation (also known as swsusp or suspend-to-disk). | ||
56 | You can check the kernel log after resuming to see if either of these | ||
57 | has happened; look for lines saying "root hub lost power or was reset". | ||
58 | |||
59 | In practice, people are forced to unmount any filesystems on a USB | ||
60 | device before suspending. If the root filesystem is on a USB device, | ||
61 | the system can't be suspended at all. (All right, it _can_ be | ||
62 | suspended -- but it will crash as soon as it wakes up, which isn't | ||
63 | much better.) | ||
64 | |||
65 | |||
66 | What is the solution? | ||
67 | |||
68 | Setting CONFIG_USB_PERSIST will cause the kernel to work around these | ||
69 | issues. It enables a mode in which the core USB device data | ||
70 | structures are allowed to persist across a power-session disruption. | ||
71 | It works like this. If the kernel sees that a USB host controller is | ||
72 | not in the expected state during resume (i.e., if the controller was | ||
73 | reset or otherwise had lost power) then it applies a persistence check | ||
74 | to each of the USB devices below that controller for which the | ||
75 | "persist" attribute is set. It doesn't try to resume the device; that | ||
76 | can't work once the power session is gone. Instead it issues a USB | ||
77 | port reset and then re-enumerates the device. (This is exactly the | ||
78 | same thing that happens whenever a USB device is reset.) If the | ||
79 | re-enumeration shows that the device now attached to that port has the | ||
80 | same descriptors as before, including the Vendor and Product IDs, then | ||
81 | the kernel continues to use the same device structure. In effect, the | ||
82 | kernel treats the device as though it had merely been reset instead of | ||
83 | unplugged. | ||
84 | |||
85 | If no device is now attached to the port, or if the descriptors are | ||
86 | different from what the kernel remembers, then the treatment is what | ||
87 | you would expect. The kernel destroys the old device structure and | ||
88 | behaves as though the old device had been unplugged and a new device | ||
89 | plugged in, just as it would without the CONFIG_USB_PERSIST option. | ||
90 | |||
91 | The end result is that the USB device remains available and usable. | ||
92 | Filesystem mounts and memory mappings are unaffected, and the world is | ||
93 | now a good and happy place. | ||
94 | |||
95 | Note that even when CONFIG_USB_PERSIST is set, the "persist" feature | ||
96 | will be applied only to those devices for which it is enabled. You | ||
97 | can enable the feature by doing (as root): | ||
98 | |||
99 | echo 1 >/sys/bus/usb/devices/.../power/persist | ||
100 | |||
101 | where the "..." should be filled in the with the device's ID. Disable | ||
102 | the feature by writing 0 instead of 1. For hubs the feature is | ||
103 | automatically and permanently enabled, so you only have to worry about | ||
104 | setting it for devices where it really matters. | ||
105 | |||
106 | |||
107 | Is this the best solution? | ||
108 | |||
109 | Perhaps not. Arguably, keeping track of mounted filesystems and | ||
110 | memory mappings across device disconnects should be handled by a | ||
111 | centralized Logical Volume Manager. Such a solution would allow you | ||
112 | to plug in a USB flash device, create a persistent volume associated | ||
113 | with it, unplug the flash device, plug it back in later, and still | ||
114 | have the same persistent volume associated with the device. As such | ||
115 | it would be more far-reaching than CONFIG_USB_PERSIST. | ||
116 | |||
117 | On the other hand, writing a persistent volume manager would be a big | ||
118 | job and using it would require significant input from the user. This | ||
119 | solution is much quicker and easier -- and it exists now, a giant | ||
120 | point in its favor! | ||
121 | |||
122 | Furthermore, the USB_PERSIST option applies to _all_ USB devices, not | ||
123 | just mass-storage devices. It might turn out to be equally useful for | ||
124 | other device types, such as network interfaces. | ||
125 | |||
126 | |||
127 | WARNING: Using CONFIG_USB_PERSIST can be dangerous!! | ||
128 | |||
129 | When recovering an interrupted power session the kernel does its best | ||
130 | to make sure the USB device hasn't been changed; that is, the same | ||
131 | device is still plugged into the port as before. But the checks | ||
132 | aren't guaranteed to be 100% accurate. | ||
133 | |||
134 | If you replace one USB device with another of the same type (same | ||
135 | manufacturer, same IDs, and so on) there's an excellent chance the | ||
136 | kernel won't detect the change. Serial numbers and other strings are | ||
137 | not compared. In many cases it wouldn't help if they were, because | ||
138 | manufacturers frequently omit serial numbers entirely in their | ||
139 | devices. | ||
140 | |||
141 | Furthermore it's quite possible to leave a USB device exactly the same | ||
142 | while changing its media. If you replace the flash memory card in a | ||
143 | USB card reader while the system is asleep, the kernel will have no | ||
144 | way to know you did it. The kernel will assume that nothing has | ||
145 | happened and will continue to use the partition tables, inodes, and | ||
146 | memory mappings for the old card. | ||
147 | |||
148 | If the kernel gets fooled in this way, it's almost certain to cause | ||
149 | data corruption and to crash your system. You'll have no one to blame | ||
150 | but yourself. | ||
151 | |||
152 | YOU HAVE BEEN WARNED! USE AT YOUR OWN RISK! | ||
153 | |||
154 | That having been said, most of the time there shouldn't be any trouble | ||
155 | at all. The "persist" feature can be extremely useful. Make the most | ||
156 | of it. | ||
diff --git a/Documentation/video4linux/CARDLIST.bttv b/Documentation/video4linux/CARDLIST.bttv index b60639130a51..177159c5f4c4 100644 --- a/Documentation/video4linux/CARDLIST.bttv +++ b/Documentation/video4linux/CARDLIST.bttv | |||
@@ -66,7 +66,7 @@ | |||
66 | 65 -> Lifeview FlyVideo 2000S LR90 | 66 | 65 -> Lifeview FlyVideo 2000S LR90 |
67 | 66 -> Terratec TValueRadio [153b:1135,153b:ff3b] | 67 | 66 -> Terratec TValueRadio [153b:1135,153b:ff3b] |
68 | 67 -> IODATA GV-BCTV4/PCI [10fc:4050] | 68 | 67 -> IODATA GV-BCTV4/PCI [10fc:4050] |
69 | 68 -> 3Dfx VoodooTV FM (Euro), VoodooTV 200 (USA) [121a:3000,10b4:2637] | 69 | 68 -> 3Dfx VoodooTV FM (Euro) [10b4:2637] |
70 | 69 -> Active Imaging AIMMS | 70 | 69 -> Active Imaging AIMMS |
71 | 70 -> Prolink Pixelview PV-BT878P+ (Rev.4C,8E) | 71 | 70 -> Prolink Pixelview PV-BT878P+ (Rev.4C,8E) |
72 | 71 -> Lifeview FlyVideo 98EZ (capture only) LR51 [1851:1851] | 72 | 71 -> Lifeview FlyVideo 98EZ (capture only) LR51 [1851:1851] |
@@ -145,3 +145,5 @@ | |||
145 | 144 -> MagicTV | 145 | 144 -> MagicTV |
146 | 145 -> SSAI Security Video Interface [4149:5353] | 146 | 145 -> SSAI Security Video Interface [4149:5353] |
147 | 146 -> SSAI Ultrasound Video Interface [414a:5353] | 147 | 146 -> SSAI Ultrasound Video Interface [414a:5353] |
148 | 147 -> VoodooTV 200 (USA) [121a:3000] | ||
149 | 148 -> DViCO FusionHDTV 2 [dbc0:d200] | ||
diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88 index 60f838beb9c8..82ac8250e978 100644 --- a/Documentation/video4linux/CARDLIST.cx88 +++ b/Documentation/video4linux/CARDLIST.cx88 | |||
@@ -55,3 +55,4 @@ | |||
55 | 54 -> Norwood Micro TV Tuner | 55 | 54 -> Norwood Micro TV Tuner |
56 | 55 -> Shenzhen Tungsten Ages Tech TE-DTV-250 / Swann OEM [c180:c980] | 56 | 55 -> Shenzhen Tungsten Ages Tech TE-DTV-250 / Swann OEM [c180:c980] |
57 | 56 -> Hauppauge WinTV-HVR1300 DVB-T/Hybrid MPEG Encoder [0070:9600,0070:9601,0070:9602] | 57 | 56 -> Hauppauge WinTV-HVR1300 DVB-T/Hybrid MPEG Encoder [0070:9600,0070:9601,0070:9602] |
58 | 57 -> ADS Tech Instant Video PCI [1421:0390] | ||
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134 index 712e8c8333cc..3f8aeab50a10 100644 --- a/Documentation/video4linux/CARDLIST.saa7134 +++ b/Documentation/video4linux/CARDLIST.saa7134 | |||
@@ -114,3 +114,4 @@ | |||
114 | 113 -> Elitegroup ECS TVP3XP FM1246 Tuner Card (PAL,FM) [1019:4cb6] | 114 | 113 -> Elitegroup ECS TVP3XP FM1246 Tuner Card (PAL,FM) [1019:4cb6] |
115 | 114 -> KWorld DVB-T 210 [17de:7250] | 115 | 114 -> KWorld DVB-T 210 [17de:7250] |
116 | 115 -> Sabrent PCMCIA TV-PCB05 [0919:2003] | 116 | 115 -> Sabrent PCMCIA TV-PCB05 [0919:2003] |
117 | 116 -> 10MOONS TM300 TV Card [1131:2304] | ||
diff --git a/Documentation/video4linux/CARDLIST.tuner b/Documentation/video4linux/CARDLIST.tuner index 44134f04b82a..a88c02d23805 100644 --- a/Documentation/video4linux/CARDLIST.tuner +++ b/Documentation/video4linux/CARDLIST.tuner | |||
@@ -40,7 +40,7 @@ tuner=38 - Philips PAL/SECAM multi (FM1216ME MK3) | |||
40 | tuner=39 - LG NTSC (newer TAPC series) | 40 | tuner=39 - LG NTSC (newer TAPC series) |
41 | tuner=40 - HITACHI V7-J180AT | 41 | tuner=40 - HITACHI V7-J180AT |
42 | tuner=41 - Philips PAL_MK (FI1216 MK) | 42 | tuner=41 - Philips PAL_MK (FI1216 MK) |
43 | tuner=42 - Philips 1236D ATSC/NTSC dual in | 43 | tuner=42 - Philips FCV1236D ATSC/NTSC dual in |
44 | tuner=43 - Philips NTSC MK3 (FM1236MK3 or FM1236/F) | 44 | tuner=43 - Philips NTSC MK3 (FM1236MK3 or FM1236/F) |
45 | tuner=44 - Philips 4 in 1 (ATI TV Wonder Pro/Conexant) | 45 | tuner=44 - Philips 4 in 1 (ATI TV Wonder Pro/Conexant) |
46 | tuner=45 - Microtune 4049 FM5 | 46 | tuner=45 - Microtune 4049 FM5 |
@@ -72,3 +72,4 @@ tuner=70 - Samsung TCPN 2121P30A | |||
72 | tuner=71 - Xceive xc3028 | 72 | tuner=71 - Xceive xc3028 |
73 | tuner=72 - Thomson FE6600 | 73 | tuner=72 - Thomson FE6600 |
74 | tuner=73 - Samsung TCPG 6121P30A | 74 | tuner=73 - Samsung TCPG 6121P30A |
75 | tuner=75 - Philips TEA5761 FM Radio | ||
diff --git a/Documentation/video4linux/sn9c102.txt b/Documentation/video4linux/sn9c102.txt index 279717c96f63..1ffad19ce891 100644 --- a/Documentation/video4linux/sn9c102.txt +++ b/Documentation/video4linux/sn9c102.txt | |||
@@ -436,7 +436,7 @@ HV7131D Hynix Semiconductor | Yes No No No | |||
436 | HV7131R Hynix Semiconductor | No Yes Yes Yes | 436 | HV7131R Hynix Semiconductor | No Yes Yes Yes |
437 | MI-0343 Micron Technology | Yes No No No | 437 | MI-0343 Micron Technology | Yes No No No |
438 | MI-0360 Micron Technology | No Yes Yes Yes | 438 | MI-0360 Micron Technology | No Yes Yes Yes |
439 | OV7630 OmniVision Technologies | Yes Yes No No | 439 | OV7630 OmniVision Technologies | Yes Yes Yes Yes |
440 | OV7660 OmniVision Technologies | No No Yes Yes | 440 | OV7660 OmniVision Technologies | No No Yes Yes |
441 | PAS106B PixArt Imaging | Yes No No No | 441 | PAS106B PixArt Imaging | Yes No No No |
442 | PAS202B PixArt Imaging | Yes Yes No No | 442 | PAS202B PixArt Imaging | Yes Yes No No |
@@ -583,6 +583,7 @@ order): | |||
583 | - Bertrik Sikken, who reverse-engineered and documented the Huffman compression | 583 | - Bertrik Sikken, who reverse-engineered and documented the Huffman compression |
584 | algorithm used in the SN9C101, SN9C102 and SN9C103 controllers and | 584 | algorithm used in the SN9C101, SN9C102 and SN9C103 controllers and |
585 | implemented the first decoder; | 585 | implemented the first decoder; |
586 | - Ronny Standke for the donation of a webcam; | ||
586 | - Mizuno Takafumi for the donation of a webcam; | 587 | - Mizuno Takafumi for the donation of a webcam; |
587 | - an "anonymous" donator (who didn't want his name to be revealed) for the | 588 | - an "anonymous" donator (who didn't want his name to be revealed) for the |
588 | donation of a webcam. | 589 | donation of a webcam. |
diff --git a/Documentation/video4linux/zr364xx.txt b/Documentation/video4linux/zr364xx.txt index c76992d0ff4d..4d9a0c33f2fd 100644 --- a/Documentation/video4linux/zr364xx.txt +++ b/Documentation/video4linux/zr364xx.txt | |||
@@ -62,4 +62,4 @@ Vendor Product Distributor Model | |||
62 | 0x0784 0x0040 Traveler Slimline X5 | 62 | 0x0784 0x0040 Traveler Slimline X5 |
63 | 0x06d6 0x0034 Trust Powerc@m 750 | 63 | 0x06d6 0x0034 Trust Powerc@m 750 |
64 | 0x0a17 0x0062 Pentax Optio 50L | 64 | 0x0a17 0x0062 Pentax Optio 50L |
65 | 65 | 0x06d6 0x003b Trust Powerc@m 970Z | |
diff --git a/Documentation/vm/hugetlbpage.txt b/Documentation/vm/hugetlbpage.txt index 687104bfd09a..51ccc48aa763 100644 --- a/Documentation/vm/hugetlbpage.txt +++ b/Documentation/vm/hugetlbpage.txt | |||
@@ -77,8 +77,9 @@ If the user applications are going to request hugepages using mmap system | |||
77 | call, then it is required that system administrator mount a file system of | 77 | call, then it is required that system administrator mount a file system of |
78 | type hugetlbfs: | 78 | type hugetlbfs: |
79 | 79 | ||
80 | mount none /mnt/huge -t hugetlbfs <uid=value> <gid=value> <mode=value> | 80 | mount -t hugetlbfs \ |
81 | <size=value> <nr_inodes=value> | 81 | -o uid=<value>,gid=<value>,mode=<value>,size=<value>,nr_inodes=<value> \ |
82 | none /mnt/huge | ||
82 | 83 | ||
83 | This command mounts a (pseudo) filesystem of type hugetlbfs on the directory | 84 | This command mounts a (pseudo) filesystem of type hugetlbfs on the directory |
84 | /mnt/huge. Any files created on /mnt/huge uses hugepages. The uid and gid | 85 | /mnt/huge. Any files created on /mnt/huge uses hugepages. The uid and gid |
@@ -88,11 +89,10 @@ mode of root of file system to value & 0777. This value is given in octal. | |||
88 | By default the value 0755 is picked. The size option sets the maximum value of | 89 | By default the value 0755 is picked. The size option sets the maximum value of |
89 | memory (huge pages) allowed for that filesystem (/mnt/huge). The size is | 90 | memory (huge pages) allowed for that filesystem (/mnt/huge). The size is |
90 | rounded down to HPAGE_SIZE. The option nr_inodes sets the maximum number of | 91 | rounded down to HPAGE_SIZE. The option nr_inodes sets the maximum number of |
91 | inodes that /mnt/huge can use. If the size or nr_inodes options are not | 92 | inodes that /mnt/huge can use. If the size or nr_inodes option is not |
92 | provided on command line then no limits are set. For size and nr_inodes | 93 | provided on command line then no limits are set. For size and nr_inodes |
93 | options, you can use [G|g]/[M|m]/[K|k] to represent giga/mega/kilo. For | 94 | options, you can use [G|g]/[M|m]/[K|k] to represent giga/mega/kilo. For |
94 | example, size=2K has the same meaning as size=2048. An example is given at | 95 | example, size=2K has the same meaning as size=2048. |
95 | the end of this document. | ||
96 | 96 | ||
97 | read and write system calls are not supported on files that reside on hugetlb | 97 | read and write system calls are not supported on files that reside on hugetlb |
98 | file systems. | 98 | file systems. |
diff --git a/Documentation/vm/slub.txt b/Documentation/vm/slub.txt index 1523320abd87..d17f324db9f5 100644 --- a/Documentation/vm/slub.txt +++ b/Documentation/vm/slub.txt | |||
@@ -41,6 +41,8 @@ Possible debug options are | |||
41 | P Poisoning (object and padding) | 41 | P Poisoning (object and padding) |
42 | U User tracking (free and alloc) | 42 | U User tracking (free and alloc) |
43 | T Trace (please only use on single slabs) | 43 | T Trace (please only use on single slabs) |
44 | - Switch all debugging off (useful if the kernel is | ||
45 | configured with CONFIG_SLUB_DEBUG_ON) | ||
44 | 46 | ||
45 | F.e. in order to boot just with sanity checks and red zoning one would specify: | 47 | F.e. in order to boot just with sanity checks and red zoning one would specify: |
46 | 48 | ||
@@ -125,13 +127,20 @@ SLUB Debug output | |||
125 | 127 | ||
126 | Here is a sample of slub debug output: | 128 | Here is a sample of slub debug output: |
127 | 129 | ||
128 | *** SLUB kmalloc-8: Redzone Active@0xc90f6d20 slab 0xc528c530 offset=3360 flags=0x400000c3 inuse=61 freelist=0xc90f6d58 | 130 | ==================================================================== |
129 | Bytes b4 0xc90f6d10: 00 00 00 00 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a ........ZZZZZZZZ | 131 | BUG kmalloc-8: Redzone overwritten |
130 | Object 0xc90f6d20: 31 30 31 39 2e 30 30 35 1019.005 | 132 | -------------------------------------------------------------------- |
131 | Redzone 0xc90f6d28: 00 cc cc cc . | 133 | |
132 | FreePointer 0xc90f6d2c -> 0xc90f6d58 | 134 | INFO: 0xc90f6d28-0xc90f6d2b. First byte 0x00 instead of 0xcc |
133 | Last alloc: get_modalias+0x61/0xf5 jiffies_ago=53 cpu=1 pid=554 | 135 | INFO: Slab 0xc528c530 flags=0x400000c3 inuse=61 fp=0xc90f6d58 |
134 | Filler 0xc90f6d50: 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ | 136 | INFO: Object 0xc90f6d20 @offset=3360 fp=0xc90f6d58 |
137 | INFO: Allocated in get_modalias+0x61/0xf5 age=53 cpu=1 pid=554 | ||
138 | |||
139 | Bytes b4 0xc90f6d10: 00 00 00 00 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a ........ZZZZZZZZ | ||
140 | Object 0xc90f6d20: 31 30 31 39 2e 30 30 35 1019.005 | ||
141 | Redzone 0xc90f6d28: 00 cc cc cc . | ||
142 | Padding 0xc90f6d50: 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ | ||
143 | |||
135 | [<c010523d>] dump_trace+0x63/0x1eb | 144 | [<c010523d>] dump_trace+0x63/0x1eb |
136 | [<c01053df>] show_trace_log_lvl+0x1a/0x2f | 145 | [<c01053df>] show_trace_log_lvl+0x1a/0x2f |
137 | [<c010601d>] show_trace+0x12/0x14 | 146 | [<c010601d>] show_trace+0x12/0x14 |
@@ -153,74 +162,108 @@ Filler 0xc90f6d50: 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ | |||
153 | [<c0104112>] sysenter_past_esp+0x5f/0x99 | 162 | [<c0104112>] sysenter_past_esp+0x5f/0x99 |
154 | [<b7f7b410>] 0xb7f7b410 | 163 | [<b7f7b410>] 0xb7f7b410 |
155 | ======================= | 164 | ======================= |
156 | @@@ SLUB kmalloc-8: Restoring redzone (0xcc) from 0xc90f6d28-0xc90f6d2b | ||
157 | 165 | ||
166 | FIX kmalloc-8: Restoring Redzone 0xc90f6d28-0xc90f6d2b=0xcc | ||
158 | 167 | ||
168 | If SLUB encounters a corrupted object (full detection requires the kernel | ||
169 | to be booted with slub_debug) then the following output will be dumped | ||
170 | into the syslog: | ||
159 | 171 | ||
160 | If SLUB encounters a corrupted object then it will perform the following | 172 | 1. Description of the problem encountered |
161 | actions: | ||
162 | |||
163 | 1. Isolation and report of the issue | ||
164 | 173 | ||
165 | This will be a message in the system log starting with | 174 | This will be a message in the system log starting with |
166 | 175 | ||
167 | *** SLUB <slab cache affected>: <What went wrong>@<object address> | 176 | =============================================== |
168 | offset=<offset of object into slab> flags=<slabflags> | 177 | BUG <slab cache affected>: <What went wrong> |
169 | inuse=<objects in use in this slab> freelist=<first free object in slab> | 178 | ----------------------------------------------- |
170 | 179 | ||
171 | 2. Report on how the problem was dealt with in order to ensure the continued | 180 | INFO: <corruption start>-<corruption_end> <more info> |
172 | operation of the system. | 181 | INFO: Slab <address> <slab information> |
182 | INFO: Object <address> <object information> | ||
183 | INFO: Allocated in <kernel function> age=<jiffies since alloc> cpu=<allocated by | ||
184 | cpu> pid=<pid of the process> | ||
185 | INFO: Freed in <kernel function> age=<jiffies since free> cpu=<freed by cpu> | ||
186 | pid=<pid of the process> | ||
173 | 187 | ||
174 | These are messages in the system log beginning with | 188 | (Object allocation / free information is only available if SLAB_STORE_USER is |
175 | 189 | set for the slab. slub_debug sets that option) | |
176 | @@@ SLUB <slab cache affected>: <corrective action taken> | ||
177 | 190 | ||
191 | 2. The object contents if an object was involved. | ||
178 | 192 | ||
179 | In the above sample SLUB found that the Redzone of an active object has | 193 | Various types of lines can follow the BUG SLUB line: |
180 | been overwritten. Here a string of 8 characters was written into a slab that | ||
181 | has the length of 8 characters. However, a 8 character string needs a | ||
182 | terminating 0. That zero has overwritten the first byte of the Redzone field. | ||
183 | After reporting the details of the issue encountered the @@@ SLUB message | ||
184 | tell us that SLUB has restored the redzone to its proper value and then | ||
185 | system operations continue. | ||
186 | |||
187 | Various types of lines can follow the @@@ SLUB line: | ||
188 | 194 | ||
189 | Bytes b4 <address> : <bytes> | 195 | Bytes b4 <address> : <bytes> |
190 | Show a few bytes before the object where the problem was detected. | 196 | Shows a few bytes before the object where the problem was detected. |
191 | Can be useful if the corruption does not stop with the start of the | 197 | Can be useful if the corruption does not stop with the start of the |
192 | object. | 198 | object. |
193 | 199 | ||
194 | Object <address> : <bytes> | 200 | Object <address> : <bytes> |
195 | The bytes of the object. If the object is inactive then the bytes | 201 | The bytes of the object. If the object is inactive then the bytes |
196 | typically contain poisoning values. Any non-poison value shows a | 202 | typically contain poison values. Any non-poison value shows a |
197 | corruption by a write after free. | 203 | corruption by a write after free. |
198 | 204 | ||
199 | Redzone <address> : <bytes> | 205 | Redzone <address> : <bytes> |
200 | The redzone following the object. The redzone is used to detect | 206 | The Redzone following the object. The Redzone is used to detect |
201 | writes after the object. All bytes should always have the same | 207 | writes after the object. All bytes should always have the same |
202 | value. If there is any deviation then it is due to a write after | 208 | value. If there is any deviation then it is due to a write after |
203 | the object boundary. | 209 | the object boundary. |
204 | 210 | ||
205 | Freepointer | 211 | (Redzone information is only available if SLAB_RED_ZONE is set. |
206 | The pointer to the next free object in the slab. May become | 212 | slub_debug sets that option) |
207 | corrupted if overwriting continues after the red zone. | ||
208 | |||
209 | Last alloc: | ||
210 | Last free: | ||
211 | Shows the address from which the object was allocated/freed last. | ||
212 | We note the pid, the time and the CPU that did so. This is usually | ||
213 | the most useful information to figure out where things went wrong. | ||
214 | Here get_modalias() did an kmalloc(8) instead of a kmalloc(9). | ||
215 | 213 | ||
216 | Filler <address> : <bytes> | 214 | Padding <address> : <bytes> |
217 | Unused data to fill up the space in order to get the next object | 215 | Unused data to fill up the space in order to get the next object |
218 | properly aligned. In the debug case we make sure that there are | 216 | properly aligned. In the debug case we make sure that there are |
219 | at least 4 bytes of filler. This allow for the detection of writes | 217 | at least 4 bytes of padding. This allows the detection of writes |
220 | before the object. | 218 | before the object. |
221 | 219 | ||
222 | Following the filler will be a stackdump. That stackdump describes the | 220 | 3. A stackdump |
223 | location where the error was detected. The cause of the corruption is more | 221 | |
224 | likely to be found by looking at the information about the last alloc / free. | 222 | The stackdump describes the location where the error was detected. The cause |
223 | of the corruption is may be more likely found by looking at the function that | ||
224 | allocated or freed the object. | ||
225 | |||
226 | 4. Report on how the problem was dealt with in order to ensure the continued | ||
227 | operation of the system. | ||
228 | |||
229 | These are messages in the system log beginning with | ||
230 | |||
231 | FIX <slab cache affected>: <corrective action taken> | ||
232 | |||
233 | In the above sample SLUB found that the Redzone of an active object has | ||
234 | been overwritten. Here a string of 8 characters was written into a slab that | ||
235 | has the length of 8 characters. However, a 8 character string needs a | ||
236 | terminating 0. That zero has overwritten the first byte of the Redzone field. | ||
237 | After reporting the details of the issue encountered the FIX SLUB message | ||
238 | tell us that SLUB has restored the Redzone to its proper value and then | ||
239 | system operations continue. | ||
240 | |||
241 | Emergency operations: | ||
242 | --------------------- | ||
243 | |||
244 | Minimal debugging (sanity checks alone) can be enabled by booting with | ||
245 | |||
246 | slub_debug=F | ||
247 | |||
248 | This will be generally be enough to enable the resiliency features of slub | ||
249 | which will keep the system running even if a bad kernel component will | ||
250 | keep corrupting objects. This may be important for production systems. | ||
251 | Performance will be impacted by the sanity checks and there will be a | ||
252 | continual stream of error messages to the syslog but no additional memory | ||
253 | will be used (unlike full debugging). | ||
254 | |||
255 | No guarantees. The kernel component still needs to be fixed. Performance | ||
256 | may be optimized further by locating the slab that experiences corruption | ||
257 | and enabling debugging only for that cache | ||
258 | |||
259 | I.e. | ||
260 | |||
261 | slub_debug=F,dentry | ||
262 | |||
263 | If the corruption occurs by writing after the end of the object then it | ||
264 | may be advisable to enable a Redzone to avoid corrupting the beginning | ||
265 | of other objects. | ||
266 | |||
267 | slub_debug=FZ,dentry | ||
225 | 268 | ||
226 | Christoph Lameter, <clameter@sgi.com>, May 23, 2007 | 269 | Christoph Lameter, <clameter@sgi.com>, May 30, 2007 |
diff --git a/Documentation/volatile-considered-harmful.txt b/Documentation/volatile-considered-harmful.txt new file mode 100644 index 000000000000..10c2e411cca8 --- /dev/null +++ b/Documentation/volatile-considered-harmful.txt | |||
@@ -0,0 +1,119 @@ | |||
1 | Why the "volatile" type class should not be used | ||
2 | ------------------------------------------------ | ||
3 | |||
4 | C programmers have often taken volatile to mean that the variable could be | ||
5 | changed outside of the current thread of execution; as a result, they are | ||
6 | sometimes tempted to use it in kernel code when shared data structures are | ||
7 | being used. In other words, they have been known to treat volatile types | ||
8 | as a sort of easy atomic variable, which they are not. The use of volatile in | ||
9 | kernel code is almost never correct; this document describes why. | ||
10 | |||
11 | The key point to understand with regard to volatile is that its purpose is | ||
12 | to suppress optimization, which is almost never what one really wants to | ||
13 | do. In the kernel, one must protect shared data structures against | ||
14 | unwanted concurrent access, which is very much a different task. The | ||
15 | process of protecting against unwanted concurrency will also avoid almost | ||
16 | all optimization-related problems in a more efficient way. | ||
17 | |||
18 | Like volatile, the kernel primitives which make concurrent access to data | ||
19 | safe (spinlocks, mutexes, memory barriers, etc.) are designed to prevent | ||
20 | unwanted optimization. If they are being used properly, there will be no | ||
21 | need to use volatile as well. If volatile is still necessary, there is | ||
22 | almost certainly a bug in the code somewhere. In properly-written kernel | ||
23 | code, volatile can only serve to slow things down. | ||
24 | |||
25 | Consider a typical block of kernel code: | ||
26 | |||
27 | spin_lock(&the_lock); | ||
28 | do_something_on(&shared_data); | ||
29 | do_something_else_with(&shared_data); | ||
30 | spin_unlock(&the_lock); | ||
31 | |||
32 | If all the code follows the locking rules, the value of shared_data cannot | ||
33 | change unexpectedly while the_lock is held. Any other code which might | ||
34 | want to play with that data will be waiting on the lock. The spinlock | ||
35 | primitives act as memory barriers - they are explicitly written to do so - | ||
36 | meaning that data accesses will not be optimized across them. So the | ||
37 | compiler might think it knows what will be in shared_data, but the | ||
38 | spin_lock() call, since it acts as a memory barrier, will force it to | ||
39 | forget anything it knows. There will be no optimization problems with | ||
40 | accesses to that data. | ||
41 | |||
42 | If shared_data were declared volatile, the locking would still be | ||
43 | necessary. But the compiler would also be prevented from optimizing access | ||
44 | to shared_data _within_ the critical section, when we know that nobody else | ||
45 | can be working with it. While the lock is held, shared_data is not | ||
46 | volatile. When dealing with shared data, proper locking makes volatile | ||
47 | unnecessary - and potentially harmful. | ||
48 | |||
49 | The volatile storage class was originally meant for memory-mapped I/O | ||
50 | registers. Within the kernel, register accesses, too, should be protected | ||
51 | by locks, but one also does not want the compiler "optimizing" register | ||
52 | accesses within a critical section. But, within the kernel, I/O memory | ||
53 | accesses are always done through accessor functions; accessing I/O memory | ||
54 | directly through pointers is frowned upon and does not work on all | ||
55 | architectures. Those accessors are written to prevent unwanted | ||
56 | optimization, so, once again, volatile is unnecessary. | ||
57 | |||
58 | Another situation where one might be tempted to use volatile is | ||
59 | when the processor is busy-waiting on the value of a variable. The right | ||
60 | way to perform a busy wait is: | ||
61 | |||
62 | while (my_variable != what_i_want) | ||
63 | cpu_relax(); | ||
64 | |||
65 | The cpu_relax() call can lower CPU power consumption or yield to a | ||
66 | hyperthreaded twin processor; it also happens to serve as a memory barrier, | ||
67 | so, once again, volatile is unnecessary. Of course, busy-waiting is | ||
68 | generally an anti-social act to begin with. | ||
69 | |||
70 | There are still a few rare situations where volatile makes sense in the | ||
71 | kernel: | ||
72 | |||
73 | - The above-mentioned accessor functions might use volatile on | ||
74 | architectures where direct I/O memory access does work. Essentially, | ||
75 | each accessor call becomes a little critical section on its own and | ||
76 | ensures that the access happens as expected by the programmer. | ||
77 | |||
78 | - Inline assembly code which changes memory, but which has no other | ||
79 | visible side effects, risks being deleted by GCC. Adding the volatile | ||
80 | keyword to asm statements will prevent this removal. | ||
81 | |||
82 | - The jiffies variable is special in that it can have a different value | ||
83 | every time it is referenced, but it can be read without any special | ||
84 | locking. So jiffies can be volatile, but the addition of other | ||
85 | variables of this type is strongly frowned upon. Jiffies is considered | ||
86 | to be a "stupid legacy" issue (Linus's words) in this regard; fixing it | ||
87 | would be more trouble than it is worth. | ||
88 | |||
89 | - Pointers to data structures in coherent memory which might be modified | ||
90 | by I/O devices can, sometimes, legitimately be volatile. A ring buffer | ||
91 | used by a network adapter, where that adapter changes pointers to | ||
92 | indicate which descriptors have been processed, is an example of this | ||
93 | type of situation. | ||
94 | |||
95 | For most code, none of the above justifications for volatile apply. As a | ||
96 | result, the use of volatile is likely to be seen as a bug and will bring | ||
97 | additional scrutiny to the code. Developers who are tempted to use | ||
98 | volatile should take a step back and think about what they are truly trying | ||
99 | to accomplish. | ||
100 | |||
101 | Patches to remove volatile variables are generally welcome - as long as | ||
102 | they come with a justification which shows that the concurrency issues have | ||
103 | been properly thought through. | ||
104 | |||
105 | |||
106 | NOTES | ||
107 | ----- | ||
108 | |||
109 | [1] http://lwn.net/Articles/233481/ | ||
110 | [2] http://lwn.net/Articles/233482/ | ||
111 | |||
112 | CREDITS | ||
113 | ------- | ||
114 | |||
115 | Original impetus and research by Randy Dunlap | ||
116 | Written by Jonathan Corbet | ||
117 | Improvements via coments from Satyam Sharma, Johannes Stezenbach, Jesper | ||
118 | Juhl, Heikki Orsila, H. Peter Anvin, Philipp Hahn, and Stefan | ||
119 | Richter. | ||
diff --git a/Documentation/watchdog/pcwd-watchdog.txt b/Documentation/watchdog/pcwd-watchdog.txt index d9ee6336c1d4..4f68052395c0 100644 --- a/Documentation/watchdog/pcwd-watchdog.txt +++ b/Documentation/watchdog/pcwd-watchdog.txt | |||
@@ -1,3 +1,5 @@ | |||
1 | Last reviewed: 10/05/2007 | ||
2 | |||
1 | Berkshire Products PC Watchdog Card | 3 | Berkshire Products PC Watchdog Card |
2 | Support for ISA Cards Revision A and C | 4 | Support for ISA Cards Revision A and C |
3 | Documentation and Driver by Ken Hollis <kenji@bitgate.com> | 5 | Documentation and Driver by Ken Hollis <kenji@bitgate.com> |
@@ -14,8 +16,8 @@ | |||
14 | 16 | ||
15 | The Watchdog Driver will automatically find your watchdog card, and will | 17 | The Watchdog Driver will automatically find your watchdog card, and will |
16 | attach a running driver for use with that card. After the watchdog | 18 | attach a running driver for use with that card. After the watchdog |
17 | drivers have initialized, you can then talk to the card using the PC | 19 | drivers have initialized, you can then talk to the card using a PC |
18 | Watchdog program, available from http://ftp.bitgate.com/pcwd/. | 20 | Watchdog program. |
19 | 21 | ||
20 | I suggest putting a "watchdog -d" before the beginning of an fsck, and | 22 | I suggest putting a "watchdog -d" before the beginning of an fsck, and |
21 | a "watchdog -e -t 1" immediately after the end of an fsck. (Remember | 23 | a "watchdog -e -t 1" immediately after the end of an fsck. (Remember |
@@ -62,5 +64,3 @@ | |||
62 | -- Ken Hollis | 64 | -- Ken Hollis |
63 | (kenji@bitgate.com) | 65 | (kenji@bitgate.com) |
64 | 66 | ||
65 | (This documentation may be out of date. Check | ||
66 | http://ftp.bitgate.com/pcwd/ for the absolute latest additions.) | ||
diff --git a/Documentation/watchdog/watchdog-api.txt b/Documentation/watchdog/watchdog-api.txt index 8d16f6f3c4ec..bb7cb1d31ec7 100644 --- a/Documentation/watchdog/watchdog-api.txt +++ b/Documentation/watchdog/watchdog-api.txt | |||
@@ -1,3 +1,6 @@ | |||
1 | Last reviewed: 10/05/2007 | ||
2 | |||
3 | |||
1 | The Linux Watchdog driver API. | 4 | The Linux Watchdog driver API. |
2 | 5 | ||
3 | Copyright 2002 Christer Weingel <wingel@nano-system.com> | 6 | Copyright 2002 Christer Weingel <wingel@nano-system.com> |
@@ -22,7 +25,7 @@ the system. If userspace fails (RAM error, kernel bug, whatever), the | |||
22 | notifications cease to occur, and the hardware watchdog will reset the | 25 | notifications cease to occur, and the hardware watchdog will reset the |
23 | system (causing a reboot) after the timeout occurs. | 26 | system (causing a reboot) after the timeout occurs. |
24 | 27 | ||
25 | The Linux watchdog API is a rather AD hoc construction and different | 28 | The Linux watchdog API is a rather ad-hoc construction and different |
26 | drivers implement different, and sometimes incompatible, parts of it. | 29 | drivers implement different, and sometimes incompatible, parts of it. |
27 | This file is an attempt to document the existing usage and allow | 30 | This file is an attempt to document the existing usage and allow |
28 | future driver writers to use it as a reference. | 31 | future driver writers to use it as a reference. |
@@ -46,14 +49,16 @@ some of the drivers support the configuration option "Disable watchdog | |||
46 | shutdown on close", CONFIG_WATCHDOG_NOWAYOUT. If it is set to Y when | 49 | shutdown on close", CONFIG_WATCHDOG_NOWAYOUT. If it is set to Y when |
47 | compiling the kernel, there is no way of disabling the watchdog once | 50 | compiling the kernel, there is no way of disabling the watchdog once |
48 | it has been started. So, if the watchdog daemon crashes, the system | 51 | it has been started. So, if the watchdog daemon crashes, the system |
49 | will reboot after the timeout has passed. | 52 | will reboot after the timeout has passed. Watchdog devices also usually |
53 | support the nowayout module parameter so that this option can be controlled | ||
54 | at runtime. | ||
50 | 55 | ||
51 | Some other drivers will not disable the watchdog, unless a specific | 56 | Drivers will not disable the watchdog, unless a specific magic character 'V' |
52 | magic character 'V' has been sent /dev/watchdog just before closing | 57 | has been sent /dev/watchdog just before closing the file. If the userspace |
53 | the file. If the userspace daemon closes the file without sending | 58 | daemon closes the file without sending this special character, the driver |
54 | this special character, the driver will assume that the daemon (and | 59 | will assume that the daemon (and userspace in general) died, and will stop |
55 | userspace in general) died, and will stop pinging the watchdog without | 60 | pinging the watchdog without disabling it first. This will then cause a |
56 | disabling it first. This will then cause a reboot. | 61 | reboot if the watchdog is not re-opened in sufficient time. |
57 | 62 | ||
58 | The ioctl API: | 63 | The ioctl API: |
59 | 64 | ||
@@ -227,218 +232,3 @@ The following options are available: | |||
227 | 232 | ||
228 | [FIXME -- better explanations] | 233 | [FIXME -- better explanations] |
229 | 234 | ||
230 | Implementations in the current drivers in the kernel tree: | ||
231 | |||
232 | Here I have tried to summarize what the different drivers support and | ||
233 | where they do strange things compared to the other drivers. | ||
234 | |||
235 | acquirewdt.c -- Acquire Single Board Computer | ||
236 | |||
237 | This driver has a hardcoded timeout of 1 minute | ||
238 | |||
239 | Supports CONFIG_WATCHDOG_NOWAYOUT | ||
240 | |||
241 | GETSUPPORT returns KEEPALIVEPING. GETSTATUS will return 1 if | ||
242 | the device is open, 0 if not. [FIXME -- isn't this rather | ||
243 | silly? To be able to use the ioctl, the device must be open | ||
244 | and so GETSTATUS will always return 1]. | ||
245 | |||
246 | advantechwdt.c -- Advantech Single Board Computer | ||
247 | |||
248 | Timeout that defaults to 60 seconds, supports SETTIMEOUT. | ||
249 | |||
250 | Supports CONFIG_WATCHDOG_NOWAYOUT | ||
251 | |||
252 | GETSUPPORT returns WDIOF_KEEPALIVEPING and WDIOF_SETTIMEOUT. | ||
253 | The GETSTATUS call returns if the device is open or not. | ||
254 | [FIXME -- silliness again?] | ||
255 | |||
256 | booke_wdt.c -- PowerPC BookE Watchdog Timer | ||
257 | |||
258 | Timeout default varies according to frequency, supports | ||
259 | SETTIMEOUT | ||
260 | |||
261 | Watchdog cannot be turned off, CONFIG_WATCHDOG_NOWAYOUT | ||
262 | does not make sense | ||
263 | |||
264 | GETSUPPORT returns the watchdog_info struct, and | ||
265 | GETSTATUS returns the supported options. GETBOOTSTATUS | ||
266 | returns a 1 if the last reset was caused by the | ||
267 | watchdog and a 0 otherwise. This watchdog cannot be | ||
268 | disabled once it has been started. The wdt_period kernel | ||
269 | parameter selects which bit of the time base changing | ||
270 | from 0->1 will trigger the watchdog exception. Changing | ||
271 | the timeout from the ioctl calls will change the | ||
272 | wdt_period as defined above. Finally if you would like to | ||
273 | replace the default Watchdog Handler you can implement the | ||
274 | WatchdogHandler() function in your own code. | ||
275 | |||
276 | eurotechwdt.c -- Eurotech CPU-1220/1410 | ||
277 | |||
278 | The timeout can be set using the SETTIMEOUT ioctl and defaults | ||
279 | to 60 seconds. | ||
280 | |||
281 | Also has a module parameter "ev", event type which controls | ||
282 | what should happen on a timeout, the string "int" or anything | ||
283 | else that causes a reboot. [FIXME -- better description] | ||
284 | |||
285 | Supports CONFIG_WATCHDOG_NOWAYOUT | ||
286 | |||
287 | GETSUPPORT returns CARDRESET and WDIOF_SETTIMEOUT but | ||
288 | GETSTATUS is not supported and GETBOOTSTATUS just returns 0. | ||
289 | |||
290 | i810-tco.c -- Intel 810 chipset | ||
291 | |||
292 | Also has support for a lot of other i8x0 stuff, but the | ||
293 | watchdog is one of the things. | ||
294 | |||
295 | The timeout is set using the module parameter "i810_margin", | ||
296 | which is in steps of 0.6 seconds where 2<i810_margin<64. The | ||
297 | driver supports the SETTIMEOUT ioctl. | ||
298 | |||
299 | Supports CONFIG_WATCHDOG_NOWAYOUT. | ||
300 | |||
301 | GETSUPPORT returns WDIOF_SETTIMEOUT. The GETSTATUS call | ||
302 | returns some kind of timer value which ist not compatible with | ||
303 | the other drivers. GETBOOT status returns some kind of | ||
304 | hardware specific boot status. [FIXME -- describe this] | ||
305 | |||
306 | ib700wdt.c -- IB700 Single Board Computer | ||
307 | |||
308 | Default timeout of 30 seconds and the timeout is settable | ||
309 | using the SETTIMEOUT ioctl. Note that only a few timeout | ||
310 | values are supported. | ||
311 | |||
312 | Supports CONFIG_WATCHDOG_NOWAYOUT | ||
313 | |||
314 | GETSUPPORT returns WDIOF_KEEPALIVEPING and WDIOF_SETTIMEOUT. | ||
315 | The GETSTATUS call returns if the device is open or not. | ||
316 | [FIXME -- silliness again?] | ||
317 | |||
318 | machzwd.c -- MachZ ZF-Logic | ||
319 | |||
320 | Hardcoded timeout of 10 seconds | ||
321 | |||
322 | Has a module parameter "action" that controls what happens | ||
323 | when the timeout runs out which can be 0 = RESET (default), | ||
324 | 1 = SMI, 2 = NMI, 3 = SCI. | ||
325 | |||
326 | Supports CONFIG_WATCHDOG_NOWAYOUT and the magic character | ||
327 | 'V' close handling. | ||
328 | |||
329 | GETSUPPORT returns WDIOF_KEEPALIVEPING, and the GETSTATUS call | ||
330 | returns if the device is open or not. [FIXME -- silliness | ||
331 | again?] | ||
332 | |||
333 | mixcomwd.c -- MixCom Watchdog | ||
334 | |||
335 | [FIXME -- I'm unable to tell what the timeout is] | ||
336 | |||
337 | Supports CONFIG_WATCHDOG_NOWAYOUT | ||
338 | |||
339 | GETSUPPORT returns WDIOF_KEEPALIVEPING, GETSTATUS returns if | ||
340 | the device is opened or not [FIXME -- I'm not really sure how | ||
341 | this works, there seems to be some magic connected to | ||
342 | CONFIG_WATCHDOG_NOWAYOUT] | ||
343 | |||
344 | pcwd.c -- Berkshire PC Watchdog | ||
345 | |||
346 | Hardcoded timeout of 1.5 seconds | ||
347 | |||
348 | Supports CONFIG_WATCHDOG_NOWAYOUT | ||
349 | |||
350 | GETSUPPORT returns WDIOF_OVERHEAT|WDIOF_CARDRESET and both | ||
351 | GETSTATUS and GETBOOTSTATUS return something useful. | ||
352 | |||
353 | The SETOPTIONS call can be used to enable and disable the card | ||
354 | and to ask the driver to call panic if the system overheats. | ||
355 | |||
356 | sbc60xxwdt.c -- 60xx Single Board Computer | ||
357 | |||
358 | Hardcoded timeout of 10 seconds | ||
359 | |||
360 | Does not support CONFIG_WATCHDOG_NOWAYOUT, but has the magic | ||
361 | character 'V' close handling. | ||
362 | |||
363 | No bits set in GETSUPPORT | ||
364 | |||
365 | scx200.c -- National SCx200 CPUs | ||
366 | |||
367 | Not in the kernel yet. | ||
368 | |||
369 | The timeout is set using a module parameter "margin" which | ||
370 | defaults to 60 seconds. The timeout can also be set using | ||
371 | SETTIMEOUT and read using GETTIMEOUT. | ||
372 | |||
373 | Supports a module parameter "nowayout" that is initialized | ||
374 | with the value of CONFIG_WATCHDOG_NOWAYOUT. Also supports the | ||
375 | magic character 'V' handling. | ||
376 | |||
377 | shwdt.c -- SuperH 3/4 processors | ||
378 | |||
379 | [FIXME -- I'm unable to tell what the timeout is] | ||
380 | |||
381 | Supports CONFIG_WATCHDOG_NOWAYOUT | ||
382 | |||
383 | GETSUPPORT returns WDIOF_KEEPALIVEPING, and the GETSTATUS call | ||
384 | returns if the device is open or not. [FIXME -- silliness | ||
385 | again?] | ||
386 | |||
387 | softdog.c -- Software watchdog | ||
388 | |||
389 | The timeout is set with the module parameter "soft_margin" | ||
390 | which defaults to 60 seconds, the timeout is also settable | ||
391 | using the SETTIMEOUT ioctl. | ||
392 | |||
393 | Supports CONFIG_WATCHDOG_NOWAYOUT | ||
394 | |||
395 | WDIOF_SETTIMEOUT bit set in GETSUPPORT | ||
396 | |||
397 | w83877f_wdt.c -- W83877F Computer | ||
398 | |||
399 | Hardcoded timeout of 30 seconds | ||
400 | |||
401 | Does not support CONFIG_WATCHDOG_NOWAYOUT, but has the magic | ||
402 | character 'V' close handling. | ||
403 | |||
404 | No bits set in GETSUPPORT | ||
405 | |||
406 | w83627hf_wdt.c -- w83627hf watchdog | ||
407 | |||
408 | Timeout that defaults to 60 seconds, supports SETTIMEOUT. | ||
409 | |||
410 | Supports CONFIG_WATCHDOG_NOWAYOUT | ||
411 | |||
412 | GETSUPPORT returns WDIOF_KEEPALIVEPING and WDIOF_SETTIMEOUT. | ||
413 | The GETSTATUS call returns if the device is open or not. | ||
414 | |||
415 | wdt.c -- ICS WDT500/501 ISA and | ||
416 | wdt_pci.c -- ICS WDT500/501 PCI | ||
417 | |||
418 | Default timeout of 60 seconds. The timeout is also settable | ||
419 | using the SETTIMEOUT ioctl. | ||
420 | |||
421 | Supports CONFIG_WATCHDOG_NOWAYOUT | ||
422 | |||
423 | GETSUPPORT returns with bits set depending on the actual | ||
424 | card. The WDT501 supports a lot of external monitoring, the | ||
425 | WDT500 much less. | ||
426 | |||
427 | wdt285.c -- Footbridge watchdog | ||
428 | |||
429 | The timeout is set with the module parameter "soft_margin" | ||
430 | which defaults to 60 seconds. The timeout is also settable | ||
431 | using the SETTIMEOUT ioctl. | ||
432 | |||
433 | Does not support CONFIG_WATCHDOG_NOWAYOUT | ||
434 | |||
435 | WDIOF_SETTIMEOUT bit set in GETSUPPORT | ||
436 | |||
437 | wdt977.c -- Netwinder W83977AF chip | ||
438 | |||
439 | Hardcoded timeout of 3 minutes | ||
440 | |||
441 | Supports CONFIG_WATCHDOG_NOWAYOUT | ||
442 | |||
443 | Does not support any ioctls at all. | ||
444 | |||
diff --git a/Documentation/watchdog/watchdog.txt b/Documentation/watchdog/watchdog.txt deleted file mode 100644 index 4b1ff69cc19a..000000000000 --- a/Documentation/watchdog/watchdog.txt +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | Watchdog Timer Interfaces For The Linux Operating System | ||
2 | |||
3 | Alan Cox <alan@lxorguk.ukuu.org.uk> | ||
4 | |||
5 | Custom Linux Driver And Program Development | ||
6 | |||
7 | |||
8 | The following watchdog drivers are currently implemented: | ||
9 | |||
10 | ICS WDT501-P | ||
11 | ICS WDT501-P (no fan tachometer) | ||
12 | ICS WDT500-P | ||
13 | Software Only | ||
14 | SA1100 Internal Watchdog | ||
15 | Berkshire Products PC Watchdog Revision A & C (by Ken Hollis) | ||
16 | |||
17 | |||
18 | All six interfaces provide /dev/watchdog, which when open must be written | ||
19 | to within a timeout or the machine will reboot. Each write delays the reboot | ||
20 | time another timeout. In the case of the software watchdog the ability to | ||
21 | reboot will depend on the state of the machines and interrupts. The hardware | ||
22 | boards physically pull the machine down off their own onboard timers and | ||
23 | will reboot from almost anything. | ||
24 | |||
25 | A second temperature monitoring interface is available on the WDT501P cards | ||
26 | and some Berkshire cards. This provides /dev/temperature. This is the machine | ||
27 | internal temperature in degrees Fahrenheit. Each read returns a single byte | ||
28 | giving the temperature. | ||
29 | |||
30 | The third interface logs kernel messages on additional alert events. | ||
31 | |||
32 | Both software and hardware watchdog drivers are available in the standard | ||
33 | kernel. If you are using the software watchdog, you probably also want | ||
34 | to use "panic=60" as a boot argument as well. | ||
35 | |||
36 | The wdt card cannot be safely probed for. Instead you need to pass | ||
37 | wdt=ioaddr,irq as a boot parameter - eg "wdt=0x240,11". | ||
38 | |||
39 | The SA1100 watchdog module can be configured with the "sa1100_margin" | ||
40 | commandline argument which specifies timeout value in seconds. | ||
41 | |||
42 | The i810 TCO watchdog modules can be configured with the "i810_margin" | ||
43 | commandline argument which specifies the counter initial value. The counter | ||
44 | is decremented every 0.6 seconds and default to 50 (30 seconds). Values can | ||
45 | range between 3 and 63. | ||
46 | |||
47 | The i810 TCO watchdog driver also implements the WDIOC_GETSTATUS and | ||
48 | WDIOC_GETBOOTSTATUS ioctl()s. WDIOC_GETSTATUS returns the actual counter value | ||
49 | and WDIOC_GETBOOTSTATUS returns the value of TCO2 Status Register (see Intel's | ||
50 | documentation for the 82801AA and 82801AB datasheet). | ||
51 | |||
52 | Features | ||
53 | -------- | ||
54 | WDT501P WDT500P Software Berkshire i810 TCO SA1100WD | ||
55 | Reboot Timer X X X X X X | ||
56 | External Reboot X X o o o X | ||
57 | I/O Port Monitor o o o X o o | ||
58 | Temperature X o o X o o | ||
59 | Fan Speed X o o o o o | ||
60 | Power Under X o o o o o | ||
61 | Power Over X o o o o o | ||
62 | Overheat X o o o o o | ||
63 | |||
64 | The external event interfaces on the WDT boards are not currently supported. | ||
65 | Minor numbers are however allocated for it. | ||
66 | |||
67 | |||
68 | Example Watchdog Driver: see Documentation/watchdog/src/watchdog-simple.c | ||
69 | |||
70 | |||
71 | Contact Information | ||
72 | |||
73 | People keep asking about the WDT watchdog timer hardware: The phone contacts | ||
74 | for Industrial Computer Source are: | ||
75 | |||
76 | Industrial Computer Source | ||
77 | http://www.indcompsrc.com | ||
78 | ICS Advent, San Diego | ||
79 | 6260 Sequence Dr. | ||
80 | San Diego, CA 92121-4371 | ||
81 | Phone (858) 677-0877 | ||
82 | FAX: (858) 677-0895 | ||
83 | > | ||
84 | ICS Advent Europe, UK | ||
85 | Oving Road | ||
86 | Chichester, | ||
87 | West Sussex, | ||
88 | PO19 4ET, UK | ||
89 | Phone: 00.44.1243.533900 | ||
90 | |||
91 | |||
92 | and please mention Linux when enquiring. | ||
93 | |||
94 | For full information about the PCWD cards see the pcwd-watchdog.txt document. | ||
diff --git a/Documentation/watchdog/wdt.txt b/Documentation/watchdog/wdt.txt new file mode 100644 index 000000000000..03fd756d976d --- /dev/null +++ b/Documentation/watchdog/wdt.txt | |||
@@ -0,0 +1,43 @@ | |||
1 | Last Reviewed: 10/05/2007 | ||
2 | |||
3 | WDT Watchdog Timer Interfaces For The Linux Operating System | ||
4 | Alan Cox <alan@lxorguk.ukuu.org.uk> | ||
5 | |||
6 | ICS WDT501-P | ||
7 | ICS WDT501-P (no fan tachometer) | ||
8 | ICS WDT500-P | ||
9 | |||
10 | All the interfaces provide /dev/watchdog, which when open must be written | ||
11 | to within a timeout or the machine will reboot. Each write delays the reboot | ||
12 | time another timeout. In the case of the software watchdog the ability to | ||
13 | reboot will depend on the state of the machines and interrupts. The hardware | ||
14 | boards physically pull the machine down off their own onboard timers and | ||
15 | will reboot from almost anything. | ||
16 | |||
17 | A second temperature monitoring interface is available on the WDT501P cards | ||
18 | This provides /dev/temperature. This is the machine internal temperature in | ||
19 | degrees Fahrenheit. Each read returns a single byte giving the temperature. | ||
20 | |||
21 | The third interface logs kernel messages on additional alert events. | ||
22 | |||
23 | The wdt card cannot be safely probed for. Instead you need to pass | ||
24 | wdt=ioaddr,irq as a boot parameter - eg "wdt=0x240,11". | ||
25 | |||
26 | Features | ||
27 | -------- | ||
28 | WDT501P WDT500P | ||
29 | Reboot Timer X X | ||
30 | External Reboot X X | ||
31 | I/O Port Monitor o o | ||
32 | Temperature X o | ||
33 | Fan Speed X o | ||
34 | Power Under X o | ||
35 | Power Over X o | ||
36 | Overheat X o | ||
37 | |||
38 | The external event interfaces on the WDT boards are not currently supported. | ||
39 | Minor numbers are however allocated for it. | ||
40 | |||
41 | |||
42 | Example Watchdog Driver: see Documentation/watchdog/src/watchdog-simple.c | ||
43 | |||
diff --git a/Documentation/x86_64/boot-options.txt b/Documentation/x86_64/boot-options.txt index 6177d881983f..945311840a10 100644 --- a/Documentation/x86_64/boot-options.txt +++ b/Documentation/x86_64/boot-options.txt | |||
@@ -14,9 +14,11 @@ Machine check | |||
14 | mce=nobootlog | 14 | mce=nobootlog |
15 | Disable boot machine check logging. | 15 | Disable boot machine check logging. |
16 | mce=tolerancelevel (number) | 16 | mce=tolerancelevel (number) |
17 | 0: always panic, 1: panic if deadlock possible, | 17 | 0: always panic on uncorrected errors, log corrected errors |
18 | 2: try to avoid panic, 3: never panic or exit (for testing) | 18 | 1: panic or SIGBUS on uncorrected errors, log corrected errors |
19 | default is 1 | 19 | 2: SIGBUS or log uncorrected errors, log corrected errors |
20 | 3: never panic or SIGBUS, log all errors (for testing only) | ||
21 | Default is 1 | ||
20 | Can be also set using sysfs which is preferable. | 22 | Can be also set using sysfs which is preferable. |
21 | 23 | ||
22 | nomce (for compatibility with i386): same as mce=off | 24 | nomce (for compatibility with i386): same as mce=off |
@@ -134,12 +136,6 @@ Non Executable Mappings | |||
134 | 136 | ||
135 | SMP | 137 | SMP |
136 | 138 | ||
137 | nosmp Only use a single CPU | ||
138 | |||
139 | maxcpus=NUMBER only use upto NUMBER CPUs | ||
140 | |||
141 | cpumask=MASK only use cpus with bits set in mask | ||
142 | |||
143 | additional_cpus=NUM Allow NUM more CPUs for hotplug | 139 | additional_cpus=NUM Allow NUM more CPUs for hotplug |
144 | (defaults are specified by the BIOS, see Documentation/x86_64/cpu-hotplug-spec) | 140 | (defaults are specified by the BIOS, see Documentation/x86_64/cpu-hotplug-spec) |
145 | 141 | ||
diff --git a/Documentation/x86_64/machinecheck b/Documentation/x86_64/machinecheck index feaeaf6f6e4d..a05e58e7b159 100644 --- a/Documentation/x86_64/machinecheck +++ b/Documentation/x86_64/machinecheck | |||
@@ -49,12 +49,14 @@ tolerant | |||
49 | Since machine check exceptions can happen any time it is sometimes | 49 | Since machine check exceptions can happen any time it is sometimes |
50 | risky for the kernel to kill a process because it defies | 50 | risky for the kernel to kill a process because it defies |
51 | normal kernel locking rules. The tolerance level configures | 51 | normal kernel locking rules. The tolerance level configures |
52 | how hard the kernel tries to recover even at some risk of deadlock. | 52 | how hard the kernel tries to recover even at some risk of |
53 | 53 | deadlock. Higher tolerant values trade potentially better uptime | |
54 | 0: always panic, | 54 | with the risk of a crash or even corruption (for tolerant >= 3). |
55 | 1: panic if deadlock possible, | 55 | |
56 | 2: try to avoid panic, | 56 | 0: always panic on uncorrected errors, log corrected errors |
57 | 3: never panic or exit (for testing only) | 57 | 1: panic or SIGBUS on uncorrected errors, log corrected errors |
58 | 2: SIGBUS or log uncorrected errors, log corrected errors | ||
59 | 3: never panic or SIGBUS, log all errors (for testing only) | ||
58 | 60 | ||
59 | Default: 1 | 61 | Default: 1 |
60 | 62 | ||
diff --git a/Documentation/zh_CN/HOWTO b/Documentation/zh_CN/HOWTO new file mode 100644 index 000000000000..48fc67bfbe3d --- /dev/null +++ b/Documentation/zh_CN/HOWTO | |||
@@ -0,0 +1,536 @@ | |||
1 | Chinese translated version of Documentation/HOWTO | ||
2 | |||
3 | If you have any comment or update to the content, please contact the | ||
4 | original document maintainer directly. However, if you have problem | ||
5 | communicating in English you can also ask the Chinese maintainer for | ||
6 | help. Contact the Chinese maintainer, if this translation is outdated | ||
7 | or there is problem with translation. | ||
8 | |||
9 | Maintainer: Greg Kroah-Hartman <greg@kroah.com> | ||
10 | Chinese maintainer: Li Yang <leoli@freescale.com> | ||
11 | --------------------------------------------------------------------- | ||
12 | Documentation/HOWTO 的中文翻译 | ||
13 | |||
14 | 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 | ||
15 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 | ||
16 | 译存在问题,请联系中文版维护者。 | ||
17 | |||
18 | 英文版维护者: Greg Kroah-Hartman <greg@kroah.com> | ||
19 | 中文版维护者: 李阳 Li Yang <leoli@freescale.com> | ||
20 | 中文版翻译者: 李阳 Li Yang <leoli@freescale.com> | ||
21 | 中文版校译者: 钟宇 TripleX Chung <xxx.phy@gmail.com> | ||
22 | 陈琦 Maggie Chen <chenqi@beyondsoft.com> | ||
23 | 王聪 Wang Cong <xiyou.wangcong@gmail.com> | ||
24 | |||
25 | 以下为正文 | ||
26 | --------------------------------------------------------------------- | ||
27 | |||
28 | 如何参与Linux内核开发 | ||
29 | --------------------- | ||
30 | |||
31 | 这是一篇将如何参与Linux内核开发的相关问题一网打尽的终极秘笈。它将指导你 | ||
32 | 成为一名Linux内核开发者,并且学会如何同Linux内核开发社区合作。它尽可能不 | ||
33 | 包括任何关于内核编程的技术细节,但会给你指引一条获得这些知识的正确途径。 | ||
34 | |||
35 | 如果这篇文章中的任何内容不再适用,请给文末列出的文件维护者发送补丁。 | ||
36 | |||
37 | |||
38 | 入门 | ||
39 | ---- | ||
40 | |||
41 | 你想了解如何成为一名Linux内核开发者?或者老板吩咐你“给这个设备写个Linux | ||
42 | 驱动程序”?这篇文章的目的就是教会你达成这些目标的全部诀窍,它将描述你需 | ||
43 | 要经过的流程以及给出如何同内核社区合作的一些提示。它还将试图解释内核社区 | ||
44 | 为何这样运作。 | ||
45 | |||
46 | Linux内核大部分是由C语言写成的,一些体系结构相关的代码用到了汇编语言。要 | ||
47 | 参与内核开发,你必须精通C语言。除非你想为某个架构开发底层代码,否则你并 | ||
48 | 不需要了解(任何体系结构的)汇编语言。下面列举的书籍虽然不能替代扎实的C | ||
49 | 语言教育和多年的开发经验,但如果需要的话,做为参考还是不错的: | ||
50 | - "The C Programming Language" by Kernighan and Ritchie [Prentice Hall] | ||
51 | 《C程序设计语言(第2版·新版)》(徐宝文 李志 译)[机械工业出版社] | ||
52 | - "Practical C Programming" by Steve Oualline [O'Reilly] | ||
53 | 《实用C语言编程(第三版)》(郭大海 译)[中国电力出版社] | ||
54 | - "C: A Reference Manual" by Harbison and Steele [Prentice Hall] | ||
55 | 《C语言参考手册(原书第5版)》(邱仲潘 等译)[机械工业出版社] | ||
56 | |||
57 | Linux内核使用GNU C和GNU工具链开发。虽然它遵循ISO C89标准,但也用到了一些 | ||
58 | 标准中没有定义的扩展。内核是自给自足的C环境,不依赖于标准C库的支持,所以 | ||
59 | 并不支持C标准中的部分定义。比如long long类型的大数除法和浮点运算就不允许 | ||
60 | 使用。有时候确实很难弄清楚内核对工具链的要求和它所使用的扩展,不幸的是目 | ||
61 | 前还没有明确的参考资料可以解释它们。请查阅gcc信息页(使用“info gcc”命令 | ||
62 | 显示)获得一些这方面信息。 | ||
63 | |||
64 | 请记住你是在学习怎么和已经存在的开发社区打交道。它由一群形形色色的人组成, | ||
65 | 他们对代码、风格和过程有着很高的标准。这些标准是在长期实践中总结出来的, | ||
66 | 适应于地理上分散的大型开发团队。它们已经被很好得整理成档,建议你在开发 | ||
67 | 之前尽可能多的学习这些标准,而不要期望别人来适应你或者你公司的行为方式。 | ||
68 | |||
69 | |||
70 | 法律问题 | ||
71 | -------- | ||
72 | |||
73 | Linux内核源代码都是在GPL(通用公共许可证)的保护下发布的。要了解这种许可 | ||
74 | 的细节请查看源代码主目录下的COPYING文件。如果你对它还有更深入问题请联系 | ||
75 | 律师,而不要在Linux内核邮件组上提问。因为邮件组里的人并不是律师,不要期 | ||
76 | 望他们的话有法律效力。 | ||
77 | |||
78 | 对于GPL的常见问题和解答,请访问以下链接: | ||
79 | http://www.gnu.org/licenses/gpl-faq.html | ||
80 | |||
81 | |||
82 | 文档 | ||
83 | ---- | ||
84 | |||
85 | Linux内核代码中包含有大量的文档。这些文档对于学习如何与内核社区互动有着 | ||
86 | 不可估量的价值。当一个新的功能被加入内核,最好把解释如何使用这个功能的文 | ||
87 | 档也放进内核。当内核的改动导致面向用户空间的接口发生变化时,最好将相关信 | ||
88 | 息或手册页(manpages)的补丁发到mtk-manpages@gmx.net,以向手册页(manpages) | ||
89 | 的维护者解释这些变化。 | ||
90 | |||
91 | 以下是内核代码中需要阅读的文档: | ||
92 | README | ||
93 | 文件简要介绍了Linux内核的背景,并且描述了如何配置和编译内核。内核的 | ||
94 | 新用户应该从这里开始。 | ||
95 | |||
96 | Documentation/Changes | ||
97 | 文件给出了用来编译和使用内核所需要的最小软件包列表。 | ||
98 | |||
99 | Documentation/CodingStyle | ||
100 | 描述Linux内核的代码风格和理由。所有新代码需要遵守这篇文档中定义的规 | ||
101 | 范。大多数维护者只会接收符合规定的补丁,很多人也只会帮忙检查符合风格 | ||
102 | 的代码。 | ||
103 | |||
104 | Documentation/SubmittingPatches | ||
105 | Documentation/SubmittingDrivers | ||
106 | 这两份文档明确描述如何创建和发送补丁,其中包括(但不仅限于): | ||
107 | - 邮件内容 | ||
108 | - 邮件格式 | ||
109 | - 选择收件人 | ||
110 | 遵守这些规定并不能保证提交成功(因为所有补丁需要通过严格的内容和风格 | ||
111 | 审查),但是忽视他们几乎就意味着失败。 | ||
112 | |||
113 | 其他关于如何正确地生成补丁的优秀文档包括: | ||
114 | "The Perfect Patch" | ||
115 | http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt | ||
116 | "Linux kernel patch submission format" | ||
117 | http://linux.yyz.us/patch-format.html | ||
118 | |||
119 | Documentation/stable_api_nonsense.txt | ||
120 | 论证内核为什么特意不包括稳定的内核内部API,也就是说不包括像这样的特 | ||
121 | 性: | ||
122 | - 子系统中间层(为了兼容性?) | ||
123 | - 在不同操作系统间易于移植的驱动程序 | ||
124 | - 减缓(甚至阻止)内核代码的快速变化 | ||
125 | 这篇文档对于理解Linux的开发哲学至关重要。对于将开发平台从其他操作系 | ||
126 | 统转移到Linux的人来说也很重要。 | ||
127 | |||
128 | Documentation/SecurityBugs | ||
129 | 如果你认为自己发现了Linux内核的安全性问题,请根据这篇文档中的步骤来 | ||
130 | 提醒其他内核开发者并帮助解决这个问题。 | ||
131 | |||
132 | Documentation/ManagementStyle | ||
133 | 描述内核维护者的工作方法及其共有特点。这对于刚刚接触内核开发(或者对 | ||
134 | 它感到好奇)的人来说很重要,因为它解释了很多对于内核维护者独特行为的 | ||
135 | 普遍误解与迷惑。 | ||
136 | |||
137 | Documentation/stable_kernel_rules.txt | ||
138 | 解释了稳定版内核发布的规则,以及如何将改动放入这些版本的步骤。 | ||
139 | |||
140 | Documentation/kernel-docs.txt | ||
141 | 有助于内核开发的外部文档列表。如果你在内核自带的文档中没有找到你想找 | ||
142 | 的内容,可以查看这些文档。 | ||
143 | |||
144 | Documentation/applying-patches.txt | ||
145 | 关于补丁是什么以及如何将它打在不同内核开发分支上的好介绍 | ||
146 | |||
147 | 内核还拥有大量从代码自动生成的文档。它包含内核内部API的全面介绍以及如何 | ||
148 | 妥善处理加锁的规则。生成的文档会放在 Documentation/DocBook/目录下。在内 | ||
149 | 核源码的主目录中使用以下不同命令将会分别生成PDF、Postscript、HTML和手册 | ||
150 | 页等不同格式的文档: | ||
151 | make pdfdocs | ||
152 | make psdocs | ||
153 | make htmldocs | ||
154 | make mandocs | ||
155 | |||
156 | |||
157 | 如何成为内核开发者 | ||
158 | ------------------ | ||
159 | 如果你对Linux内核开发一无所知,你应该访问“Linux内核新手”计划: | ||
160 | http://kernelnewbies.org | ||
161 | 它拥有一个可以问各种最基本的内核开发问题的邮件列表(在提问之前一定要记得 | ||
162 | 查找已往的邮件,确认是否有人已经回答过相同的问题)。它还拥有一个可以获得 | ||
163 | 实时反馈的IRC聊天频道,以及大量对于学习Linux内核开发相当有帮助的文档。 | ||
164 | |||
165 | 网站简要介绍了源代码组织结构、子系统划分以及目前正在进行的项目(包括内核 | ||
166 | 中的和单独维护的)。它还提供了一些基本的帮助信息,比如如何编译内核和打补 | ||
167 | 丁。 | ||
168 | |||
169 | 如果你想加入内核开发社区并协助完成一些任务,却找不到从哪里开始,可以访问 | ||
170 | “Linux内核房管员”计划: | ||
171 | http://janitor.kernelnewbies.org/ | ||
172 | 这是极佳的起点。它提供一个相对简单的任务列表,列出内核代码中需要被重新 | ||
173 | 整理或者改正的地方。通过和负责这个计划的开发者们一同工作,你会学到将补丁 | ||
174 | 集成进内核的基本原理。如果还没有决定下一步要做什么的话,你还可能会得到方 | ||
175 | 向性的指点。 | ||
176 | |||
177 | 如果你已经有一些现成的代码想要放到内核中,但是需要一些帮助来使它们拥有正 | ||
178 | 确的格式。请访问“内核导师”计划。这个计划就是用来帮助你完成这个目标的。它 | ||
179 | 是一个邮件列表,地址如下: | ||
180 | http://selenic.com/mailman/listinfo/kernel-mentors | ||
181 | |||
182 | 在真正动手修改内核代码之前,理解要修改的代码如何运作是必需的。要达到这个 | ||
183 | 目的,没什么办法比直接读代码更有效了(大多数花招都会有相应的注释),而且 | ||
184 | 一些特制的工具还可以提供帮助。例如,“Linux代码交叉引用”项目就是一个值得 | ||
185 | 特别推荐的帮助工具,它将源代码显示在有编目和索引的网页上。其中一个更新及 | ||
186 | 时的内核源码库,可以通过以下地址访问: | ||
187 | http://sosdg.org/~coywolf/lxr/ | ||
188 | |||
189 | |||
190 | 开发流程 | ||
191 | -------- | ||
192 | |||
193 | 目前Linux内核开发流程包括几个“主内核分支”和很多子系统相关的内核分支。这 | ||
194 | 些分支包括: | ||
195 | - 2.6.x主内核源码树 | ||
196 | - 2.6.x.y -stable内核源码树 | ||
197 | - 2.6.x -git内核补丁集 | ||
198 | - 2.6.x -mm内核补丁集 | ||
199 | - 子系统相关的内核源码树和补丁集 | ||
200 | |||
201 | |||
202 | 2.6.x内核主源码树 | ||
203 | ----------------- | ||
204 | 2.6.x内核是由Linus Torvalds(Linux的创造者)亲自维护的。你可以在 | ||
205 | kernel.org网站的pub/linux/kernel/v2.6/目录下找到它。它的开发遵循以下步 | ||
206 | 骤: | ||
207 | - 每当一个新版本的内核被发布,为期两周的集成窗口将被打开。在这段时间里 | ||
208 | 维护者可以向Linus提交大段的修改,通常这些修改已经被放到-mm内核中几个 | ||
209 | 星期了。提交大量修改的首选方式是使用git工具(内核的代码版本管理工具 | ||
210 | ,更多的信息可以在http://git.or.cz/获取),不过使用普通补丁也是可以 | ||
211 | 的。 | ||
212 | - 两个星期以后-rc1版本内核发布。之后只有不包含可能影响整个内核稳定性的 | ||
213 | 新功能的补丁才可能被接受。请注意一个全新的驱动程序(或者文件系统)有 | ||
214 | 可能在-rc1后被接受是因为这样的修改完全独立,不会影响其他的代码,所以 | ||
215 | 没有造成内核退步的风险。在-rc1以后也可以用git向Linus提交补丁,不过所 | ||
216 | 有的补丁需要同时被发送到相应的公众邮件列表以征询意见。 | ||
217 | - 当Linus认为当前的git源码树已经达到一个合理健全的状态足以发布供人测试 | ||
218 | 时,一个新的-rc版本就会被发布。计划是每周都发布新的-rc版本。 | ||
219 | - 这个过程一直持续下去直到内核被认为达到足够稳定的状态,持续时间大概是 | ||
220 | 6个星期。 | ||
221 | |||
222 | 关于内核发布,值得一提的是Andrew Morton在linux-kernel邮件列表中如是说: | ||
223 | “没有人知道新内核何时会被发布,因为发布是根据已知bug的情况来决定 | ||
224 | 的,而不是根据一个事先制定好的时间表。” | ||
225 | |||
226 | |||
227 | 2.6.x.y -stable(稳定版)内核源码树 | ||
228 | ----------------------------------- | ||
229 | 由4个数字组成的内核版本号说明此内核是-stable版本。它们包含基于2.6.x版本 | ||
230 | 内核的相对较小且至关重要的修补,这些修补针对安全性问题或者严重的内核退步。 | ||
231 | |||
232 | 这种版本的内核适用于那些期望获得最新的稳定版内核并且不想参与测试开发版或 | ||
233 | 者实验版的用户。 | ||
234 | |||
235 | 如果没有2.6.x.y版本内核存在,那么最新的2.6.x版本内核就相当于是当前的稳定 | ||
236 | 版内核。 | ||
237 | |||
238 | 2.6.x.y版本由“稳定版”小组(邮件地址<stable@kernel.org>)维护,一般隔周发 | ||
239 | 布新版本。 | ||
240 | |||
241 | 内核源码中的Documentation/stable_kernel_rules.txt文件具体描述了可被稳定 | ||
242 | 版内核接受的修改类型以及发布的流程。 | ||
243 | |||
244 | |||
245 | 2.6.x -git补丁集 | ||
246 | ---------------- | ||
247 | Linus的内核源码树的每日快照,这个源码树是由git工具管理的(由此得名)。这 | ||
248 | 些补丁通常每天更新以反映Linus的源码树的最新状态。它们比-rc版本的内核源码 | ||
249 | 树更具试验性质,因为这个补丁集是全自动生成的,没有任何人来确认其是否真正 | ||
250 | 健全。 | ||
251 | |||
252 | |||
253 | 2.6.x -mm补丁集 | ||
254 | --------------- | ||
255 | 这是由Andrew Morton维护的试验性内核补丁集。Andrew将所有子系统的内核源码 | ||
256 | 和补丁拼凑到一起,并且加入了大量从linux-kernel邮件列表中采集的补丁。这个 | ||
257 | 源码树是新功能和补丁的试炼场。当补丁在-mm补丁集里证明了其价值以后Andrew | ||
258 | 或者相应子系统的维护者会将补丁发给Linus以便集成进主内核源码树。 | ||
259 | |||
260 | 在将所有新补丁发给Linus以集成到主内核源码树之前,我们非常鼓励先把这些补 | ||
261 | 丁放在-mm版内核源码树中进行测试。 | ||
262 | |||
263 | 这些内核版本不适合在需要稳定运行的系统上运行,因为运行它们比运行任何其他 | ||
264 | 内核分支都更具有风险。 | ||
265 | |||
266 | 如果你想为内核开发进程提供帮助,请尝试并使用这些内核版本,并在 | ||
267 | linux-kernel邮件列表中提供反馈,告诉大家你遇到了问题还是一切正常。 | ||
268 | |||
269 | 通常-mm版补丁集不光包括这些额外的试验性补丁,还包括发布时-git版主源码树 | ||
270 | 中的改动。 | ||
271 | |||
272 | -mm版内核没有固定的发布周期,但是通常在每两个-rc版内核发布之间都会有若干 | ||
273 | 个-mm版内核发布(一般是1至3个)。 | ||
274 | |||
275 | |||
276 | 子系统相关内核源码树和补丁集 | ||
277 | ---------------------------- | ||
278 | 相当一部分内核子系统开发者会公开他们自己的开发源码树,以便其他人能了解内 | ||
279 | 核的不同领域正在发生的事情。如上所述,这些源码树会被集成到-mm版本内核中。 | ||
280 | |||
281 | 下面是目前可用的一些内核源码树的列表: | ||
282 | 通过git管理的源码树: | ||
283 | - Kbuild开发源码树, Sam Ravnborg <sam@ravnborg.org> | ||
284 | git.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git | ||
285 | |||
286 | - ACPI开发源码树, Len Brown <len.brown@intel.com> | ||
287 | git.kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git | ||
288 | |||
289 | - 块设备开发源码树, Jens Axboe <axboe@suse.de> | ||
290 | git.kernel.org:/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git | ||
291 | |||
292 | - DRM开发源码树, Dave Airlie <airlied@linux.ie> | ||
293 | git.kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git | ||
294 | |||
295 | - ia64开发源码树, Tony Luck <tony.luck@intel.com> | ||
296 | git.kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git | ||
297 | |||
298 | - ieee1394开发源码树, Jody McIntyre <scjody@modernduck.com> | ||
299 | git.kernel.org:/pub/scm/linux/kernel/git/scjody/ieee1394.git | ||
300 | |||
301 | - infiniband开发源码树, Roland Dreier <rolandd@cisco.com> | ||
302 | git.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git | ||
303 | |||
304 | - libata开发源码树, Jeff Garzik <jgarzik@pobox.com> | ||
305 | git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git | ||
306 | |||
307 | - 网络驱动程序开发源码树, Jeff Garzik <jgarzik@pobox.com> | ||
308 | git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git | ||
309 | |||
310 | - pcmcia开发源码树, Dominik Brodowski <linux@dominikbrodowski.net> | ||
311 | git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git | ||
312 | |||
313 | - SCSI开发源码树, James Bottomley <James.Bottomley@SteelEye.com> | ||
314 | git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git | ||
315 | |||
316 | 使用quilt管理的补丁集: | ||
317 | - USB, PCI, 驱动程序核心和I2C, Greg Kroah-Hartman <gregkh@suse.de> | ||
318 | kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ | ||
319 | - x86-64, 部分i386, Andi Kleen <ak@suse.de> | ||
320 | ftp.firstfloor.org:/pub/ak/x86_64/quilt/ | ||
321 | |||
322 | 其他内核源码树可以在http://git.kernel.org的列表中和MAINTAINERS文件里 | ||
323 | 找到。 | ||
324 | |||
325 | 报告bug | ||
326 | ------- | ||
327 | |||
328 | bugzilla.kernel.org是Linux内核开发者们用来跟踪内核Bug的网站。我们鼓励用 | ||
329 | 户在这个工具中报告找到的所有bug。如何使用内核bugzilla的细节请访问: | ||
330 | http://test.kernel.org/bugzilla/faq.html | ||
331 | |||
332 | 内核源码主目录中的REPORTING-BUGS文件里有一个很好的模板。它指导用户如何报 | ||
333 | 告可能的内核bug以及需要提供哪些信息来帮助内核开发者们找到问题的根源。 | ||
334 | |||
335 | |||
336 | 利用bug报告 | ||
337 | ----------- | ||
338 | |||
339 | 练习内核开发技能的最好办法就是修改其他人报告的bug。你不光可以帮助内核变 | ||
340 | 得更加稳定,还可以学会如何解决实际问题从而提高自己的技能,并且让其他开发 | ||
341 | 者感受到你的存在。修改bug是赢得其他开发者赞誉的最好办法,因为并不是很多 | ||
342 | 人都喜欢浪费时间去修改别人报告的bug。 | ||
343 | |||
344 | 要尝试修改已知的bug,请访问http://bugzilla.kernel.org网址。如果你想获得 | ||
345 | 最新bug的通知,可以订阅bugme-new邮件列表(只有新的bug报告会被寄到这里) | ||
346 | 或者订阅bugme-janitor邮件列表(所有bugzilla的变动都会被寄到这里)。 | ||
347 | |||
348 | http://lists.osdl.org/mailman/listinfo/bugme-new | ||
349 | http://lists.osdl.org/mailman/listinfo/bugme-janitors | ||
350 | |||
351 | |||
352 | 邮件列表 | ||
353 | -------- | ||
354 | |||
355 | 正如上面的文档所描述,大多数的骨干内核开发者都加入了Linux Kernel邮件列 | ||
356 | 表。如何订阅和退订列表的细节可以在这里找到: | ||
357 | http://vger.kernel.org/vger-lists.html#linux-kernel | ||
358 | 网上很多地方都有这个邮件列表的存档(archive)。可以使用搜索引擎来找到这些 | ||
359 | 存档。比如: | ||
360 | http://dir.gmane.org/gmane.linux.kernel | ||
361 | 在发信之前,我们强烈建议你先在存档中搜索你想要讨论的问题。很多已经被详细 | ||
362 | 讨论过的问题只在邮件列表的存档中可以找到。 | ||
363 | |||
364 | 大多数内核子系统也有自己独立的邮件列表来协调各自的开发工作。从 | ||
365 | MAINTAINERS文件中可以找到不同话题对应的邮件列表。 | ||
366 | |||
367 | 很多邮件列表架设在kernel.org服务器上。这些列表的信息可以在这里找到: | ||
368 | http://vger.kernel.org/vger-lists.html | ||
369 | |||
370 | 在使用这些邮件列表时,请记住保持良好的行为习惯。下面的链接提供了与这些列 | ||
371 | 表(或任何其它邮件列表)交流的一些简单规则,虽然内容有点滥竽充数。 | ||
372 | http://www.albion.com/netiquette/ | ||
373 | |||
374 | 当有很多人回复你的邮件时,邮件的抄送列表会变得很长。请不要将任何人从抄送 | ||
375 | 列表中删除,除非你有足够的理由这么做。也不要只回复到邮件列表。请习惯于同 | ||
376 | 一封邮件接收两次(一封来自发送者一封来自邮件列表),而不要试图通过添加一 | ||
377 | 些奇特的邮件头来解决这个问题,人们不会喜欢的。 | ||
378 | |||
379 | 记住保留你所回复内容的上下文和源头。在你回复邮件的顶部保留“某某某说到……” | ||
380 | 这几行。将你的评论加在被引用的段落之间而不要放在邮件的顶部。 | ||
381 | |||
382 | 如果你在邮件中附带补丁,请确认它们是可以直接阅读的纯文本(如 | ||
383 | Documentation/SubmittingPatches文档中所述)。内核开发者们不希望遇到附件 | ||
384 | 或者被压缩了的补丁。只有这样才能保证他们可以直接评论你的每行代码。请确保 | ||
385 | 你使用的邮件发送程序不会修改空格和制表符。一个防范性的测试方法是先将邮件 | ||
386 | 发送给自己,然后自己尝试是否可以顺利地打上收到的补丁。如果测试不成功,请 | ||
387 | 调整或者更换你的邮件发送程序直到它正确工作为止。 | ||
388 | |||
389 | 总而言之,请尊重其他的邮件列表订阅者。 | ||
390 | |||
391 | |||
392 | 同内核社区合作 | ||
393 | ---------------- | ||
394 | |||
395 | 内核社区的目标就是提供尽善尽美的内核。所以当你提交补丁期望被接受进内核的 | ||
396 | 时候,它的技术价值以及其他方面都将被评审。那么你可能会得到什么呢? | ||
397 | - 批评 | ||
398 | - 评论 | ||
399 | - 要求修改 | ||
400 | - 要求证明修改的必要性 | ||
401 | - 沉默 | ||
402 | |||
403 | 要记住,这些是把补丁放进内核的正常情况。你必须学会听取对补丁的批评和评论, | ||
404 | 从技术层面评估它们,然后要么重写你的补丁要么简明扼要地论证修改是不必要 | ||
405 | 的。如果你发的邮件没有得到任何回应,请过几天后再试一次,因为有时信件会湮 | ||
406 | 没在茫茫信海中。 | ||
407 | |||
408 | 你不应该做的事情: | ||
409 | - 期望自己的补丁不受任何质疑就直接被接受 | ||
410 | - 翻脸 | ||
411 | - 忽略别人的评论 | ||
412 | - 没有按照别人的要求做任何修改就重新提交 | ||
413 | |||
414 | 在一个努力追寻最好技术方案的社区里,对于一个补丁有多少好处总会有不同的见 | ||
415 | 解。你必须要抱着合作的态度,愿意改变自己的观点来适应内核的风格。或者至少 | ||
416 | 愿意去证明你的想法是有价值的。记住,犯错误是允许的,只要你愿意朝着正确的 | ||
417 | 方案去努力。 | ||
418 | |||
419 | 如果你的第一个补丁换来的是一堆修改建议,这是很正常的。这并不代表你的补丁 | ||
420 | 不会被接受,也不意味着有人和你作对。你只需要改正所有提出的问题然后重新发 | ||
421 | 送你的补丁。 | ||
422 | |||
423 | 内核社区和公司文化的差异 | ||
424 | ------------------------ | ||
425 | |||
426 | 内核社区的工作模式同大多数传统公司开发队伍的工作模式并不相同。下面这些例 | ||
427 | 子,可以帮助你避免某些可能发生问题: | ||
428 | 用这些话介绍你的修改提案会有好处: | ||
429 | - 它同时解决了多个问题 | ||
430 | - 它删除了2000行代码 | ||
431 | - 这是补丁,它已经解释了我想要说明的 | ||
432 | - 我在5种不同的体系结构上测试过它…… | ||
433 | - 这是一系列小补丁用来…… | ||
434 | - 这个修改提高了普通机器的性能…… | ||
435 | |||
436 | 应该避免如下的说法: | ||
437 | - 我们在AIX/ptx/Solaris就是这么做的,所以这么做肯定是好的…… | ||
438 | - 我做这行已经20年了,所以…… | ||
439 | - 为了我们公司赚钱考虑必须这么做 | ||
440 | - 这是我们的企业产品线所需要的 | ||
441 | - 这里是描述我观点的1000页设计文档 | ||
442 | - 这是一个5000行的补丁用来…… | ||
443 | - 我重写了现在乱七八糟的代码,这就是…… | ||
444 | - 我被规定了最后期限,所以这个补丁需要立刻被接受 | ||
445 | |||
446 | 另外一个内核社区与大部分传统公司的软件开发队伍不同的地方是无法面对面地交 | ||
447 | 流。使用电子邮件和IRC聊天工具做为主要沟通工具的一个好处是性别和种族歧视 | ||
448 | 将会更少。Linux内核的工作环境更能接受妇女和少数族群,因为每个人在别人眼 | ||
449 | 里只是一个邮件地址。国际化也帮助了公平的实现,因为你无法通过姓名来判断人 | ||
450 | 的性别。男人有可能叫李丽,女人也有可能叫王刚。大多数在Linux内核上工作过 | ||
451 | 并表达过看法的女性对在linux上工作的经历都给出了正面的评价。 | ||
452 | |||
453 | 对于一些不习惯使用英语的人来说,语言可能是一个引起问题的障碍。在邮件列表 | ||
454 | 中要正确地表达想法必需良好地掌握语言,所以建议你在发送邮件之前最好检查一 | ||
455 | 下英文写得是否正确。 | ||
456 | |||
457 | |||
458 | 拆分修改 | ||
459 | -------- | ||
460 | |||
461 | Linux内核社区并不喜欢一下接收大段的代码。修改需要被恰当地介绍、讨论并且 | ||
462 | 拆分成独立的小段。这几乎完全和公司中的习惯背道而驰。你的想法应该在开发最 | ||
463 | 开始的阶段就让大家知道,这样你就可以及时获得对你正在进行的开发的反馈。这 | ||
464 | 样也会让社区觉得你是在和他们协作,而不是仅仅把他们当作倾销新功能的对象。 | ||
465 | 无论如何,你不要一次性地向邮件列表发送50封信,你的补丁序列应该永远用不到 | ||
466 | 这么多。 | ||
467 | |||
468 | 将补丁拆开的原因如下: | ||
469 | |||
470 | 1) 小的补丁更有可能被接受,因为它们不需要太多的时间和精力去验证其正确性。 | ||
471 | 一个5行的补丁,可能在维护者看了一眼以后就会被接受。而500行的补丁则 | ||
472 | 需要数个小时来审查其正确性(所需时间随补丁大小增加大约呈指数级增长)。 | ||
473 | |||
474 | 当出了问题的时候,小的补丁也会让调试变得非常容易。一个一个补丁地回溯 | ||
475 | 将会比仔细剖析一个被打上的大补丁(这个补丁破坏了其他东西)容易得多。 | ||
476 | |||
477 | 2)不光发送小的补丁很重要,在提交之前重新编排、化简(或者仅仅重新排列) | ||
478 | 补丁也是很重要的。 | ||
479 | |||
480 | 这里有内核开发者Al Viro打的一个比方: | ||
481 | “想象一个老师正在给学生批改数学作业。老师并不希望看到学生为了得 | ||
482 | 到正确解法所进行的尝试和产生的错误。他希望看到的是最干净最优雅的 | ||
483 | 解答。好学生了解这点,绝不会把最终解决之前的中间方案提交上去。” | ||
484 | |||
485 | 内核开发也是这样。维护者和评审者不希望看到一个人在解决问题时的思 | ||
486 | 考过程。他们只希望看到简单和优雅的解决方案。 | ||
487 | |||
488 | 直接给出一流的解决方案,和社区一起协作讨论尚未完成的工作,这两者之间似乎 | ||
489 | 很难找到一个平衡点。所以最好尽早开始收集有利于你进行改进的反馈;同时也要 | ||
490 | 保证修改分成很多小块,这样在整个项目都准备好被包含进内核之前,其中的一部 | ||
491 | 分可能会先被接收。 | ||
492 | |||
493 | 必须了解这样做是不可接受的:试图将未完成的工作提交进内核,然后再找时间修 | ||
494 | 复。 | ||
495 | |||
496 | |||
497 | 证明修改的必要性 | ||
498 | ---------------- | ||
499 | 除了将补丁拆成小块,很重要的一点是让Linux社区了解他们为什么需要这样修改。 | ||
500 | 你必须证明新功能是有人需要的并且是有用的。 | ||
501 | |||
502 | |||
503 | 记录修改 | ||
504 | -------- | ||
505 | |||
506 | 当你发送补丁的时候,需要特别留意邮件正文的内容。因为这里的信息将会做为补 | ||
507 | 丁的修改记录(ChangeLog),会被一直保留以备大家查阅。它需要完全地描述补丁, | ||
508 | 包括: | ||
509 | - 为什么需要这个修改 | ||
510 | - 补丁的总体设计 | ||
511 | - 实现细节 | ||
512 | - 测试结果 | ||
513 | |||
514 | 想了解它具体应该看起来像什么,请查阅以下文档中的“ChangeLog”章节: | ||
515 | “The Perfect Patch” | ||
516 | http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt | ||
517 | |||
518 | |||
519 | 这些事情有时候做起来很难。要在任何方面都做到完美可能需要好几年时间。这是 | ||
520 | 一个持续提高的过程,它需要大量的耐心和决心。只要不放弃,你一定可以做到。 | ||
521 | 很多人已经做到了,而他们都曾经和现在的你站在同样的起点上。 | ||
522 | |||
523 | |||
524 | --------------- | ||
525 | 感谢Paolo Ciarrocchi允许“开发流程”部分基于他所写的文章 | ||
526 | (http://linux.tar.bz/articles/2.6-development_process),感谢Randy | ||
527 | Dunlap和Gerrit Huizenga完善了应该说和不该说的列表。感谢Pat Mochel, Hanna | ||
528 | Linder, Randy Dunlap, Kay Sievers, Vojtech Pavlik, Jan Kara, Josh Boyer, | ||
529 | Kees Cook, Andrew Morton, Andi Kleen, Vadim Lobanov, Jesper Juhl, Adrian | ||
530 | Bunk, Keri Harris, Frans Pop, David A. Wheeler, Junio Hamano, Michael | ||
531 | Kerrisk和Alex Shepard的评审、建议和贡献。没有他们的帮助,这篇文档是不可 | ||
532 | 能完成的。 | ||
533 | |||
534 | |||
535 | |||
536 | 英文版维护者: Greg Kroah-Hartman <greg@kroah.com> | ||
diff --git a/Documentation/zh_CN/stable_api_nonsense.txt b/Documentation/zh_CN/stable_api_nonsense.txt new file mode 100644 index 000000000000..c26a27d1ee7d --- /dev/null +++ b/Documentation/zh_CN/stable_api_nonsense.txt | |||
@@ -0,0 +1,157 @@ | |||
1 | Chinese translated version of Documentation/stable_api_nonsense.txt | ||
2 | |||
3 | If you have any comment or update to the content, please contact the | ||
4 | original document maintainer directly. However, if you have problem | ||
5 | communicating in English you can also ask the Chinese maintainer for help. | ||
6 | Contact the Chinese maintainer, if this translation is outdated or there | ||
7 | is problem with translation. | ||
8 | |||
9 | Maintainer: Greg Kroah-Hartman <greg@kroah.com> | ||
10 | Chinese maintainer: TripleX Chung <zhongyu@18mail.cn> | ||
11 | --------------------------------------------------------------------- | ||
12 | Documentation/stable_api_nonsense.txt 的中文翻译 | ||
13 | |||
14 | 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 | ||
15 | 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 | ||
16 | 译存在问题,请联系中文版维护者。 | ||
17 | |||
18 | 英文版维护者: Greg Kroah-Hartman <greg@kroah.com> | ||
19 | 中文版维护者: 钟宇 TripleX Chung <zhongyu@18mail.cn> | ||
20 | 中文版翻译者: 钟宇 TripleX Chung <zhongyu@18mail.cn> | ||
21 | 中文版校译者: 李阳 Li Yang <leoli@freescale.com> | ||
22 | 以下为正文 | ||
23 | --------------------------------------------------------------------- | ||
24 | |||
25 | 写作本文档的目的,是为了解释为什么Linux既没有二进制内核接口,也没有稳定 | ||
26 | 的内核接口。这里所说的内核接口,是指内核里的接口,而不是内核和用户空间 | ||
27 | 的接口。内核到用户空间的接口,是提供给应用程序使用的系统调用,系统调用 | ||
28 | 在历史上几乎没有过变化,将来也不会有变化。我有一些老应用程序是在0.9版本 | ||
29 | 或者更早版本的内核上编译的,在使用2.6版本内核的Linux发布上依然用得很好 | ||
30 | 。用户和应用程序作者可以将这个接口看成是稳定的。 | ||
31 | |||
32 | |||
33 | 执行纲要 | ||
34 | -------- | ||
35 | |||
36 | 你也许以为自己想要稳定的内核接口,但是你不清楚你要的实际上不是它。你需 | ||
37 | 要的其实是稳定的驱动程序,而你只有将驱动程序放到公版内核的源代码树里, | ||
38 | 才有可能达到这个目的。而且这样做还有很多其它好处,正是因为这些好处使得 | ||
39 | Linux能成为强壮,稳定,成熟的操作系统,这也是你最开始选择Linux的原因。 | ||
40 | |||
41 | |||
42 | 入门 | ||
43 | ----- | ||
44 | |||
45 | 只有那些写驱动程序的“怪人”才会担心内核接口的改变,对广大用户来说,既 | ||
46 | 看不到内核接口,也不需要去关心它。 | ||
47 | |||
48 | 首先,我不打算讨论关于任何非GPL许可的内核驱动的法律问题,这些非GPL许可 | ||
49 | 的驱动程序包括不公开源代码,隐藏源代码,二进制或者是用源代码包装,或者 | ||
50 | 是其它任何形式的不能以GPL许可公开源代码的驱动程序。如果有法律问题,请咨 | ||
51 | 询律师,我只是一个程序员,所以我只打算探讨技术问题(不是小看法律问题, | ||
52 | 法律问题很实际,并且需要一直关注)。 | ||
53 | |||
54 | 既然只谈技术问题,我们就有了下面两个主题:二进制内核接口和稳定的内核源 | ||
55 | 代码接口。这两个问题是互相关联的,让我们先解决掉二进制接口的问题。 | ||
56 | |||
57 | |||
58 | 二进制内核接口 | ||
59 | -------------- | ||
60 | 假如我们有一个稳定的内核源代码接口,那么自然而然的,我们就拥有了稳定的 | ||
61 | 二进制接口,是这样的吗?错。让我们看看关于Linux内核的几点事实: | ||
62 | - 取决于所用的C编译器的版本,不同的内核数据结构里的结构体的对齐方 | ||
63 | 式会有差别,代码中不同函数的表现形式也不一样(函数是不是被inline编译取 | ||
64 | 决于编译器行为)。不同的函数的表现形式并不重要,但是数据结构内部的对齐 | ||
65 | 方式很关键。 | ||
66 | - 取决于内核的配置选项,不同的选项会让内核的很多东西发生改变: | ||
67 | - 同一个结构体可能包含不同的成员变量 | ||
68 | - 有的函数可能根本不会被实现(比如编译的时候没有选择SMP支持 | ||
69 | ,一些锁函数就会被定义成空函数)。 | ||
70 | - 内核使用的内存会以不同的方式对齐,这取决于不同的内核配置选 | ||
71 | 项。 | ||
72 | - Linux可以在很多的不同体系结构的处理器上运行。在某个体系结构上编 | ||
73 | 译好的二进制驱动程序,不可能在另外一个体系结构上正确的运行。 | ||
74 | |||
75 | 对于一个特定的内核,满足这些条件并不难,使用同一个C编译器和同样的内核配 | ||
76 | 置选项来编译驱动程序模块就可以了。这对于给一个特定Linux发布的特定版本提 | ||
77 | 供驱动程序,是完全可以满足需求的。但是如果你要给不同发布的不同版本都发 | ||
78 | 布一个驱动程序,就需要在每个发布上用不同的内核设置参数都编译一次内核, | ||
79 | 这简直跟噩梦一样。而且还要注意到,每个Linux发布还提供不同的Linux内核, | ||
80 | 这些内核都针对不同的硬件类型进行了优化(有很多种不同的处理器,还有不同 | ||
81 | 的内核设置选项)。所以每发布一次驱动程序,都需要提供很多不同版本的内核 | ||
82 | 模块。 | ||
83 | |||
84 | 相信我,如果你真的要采取这种发布方式,一定会慢慢疯掉,我很久以前就有过 | ||
85 | 深刻的教训... | ||
86 | |||
87 | |||
88 | 稳定的内核源代码接口 | ||
89 | -------------------- | ||
90 | |||
91 | 如果有人不将他的内核驱动程序,放入公版内核的源代码树,而又想让驱动程序 | ||
92 | 一直保持在最新的内核中可用,那么这个话题将会变得没完没了。 | ||
93 | 内核开发是持续而且快节奏的,从来都不会慢下来。内核开发人员在当前接口中 | ||
94 | 找到bug,或者找到更好的实现方式。一旦发现这些,他们就很快会去修改当前的 | ||
95 | 接口。修改接口意味着,函数名可能会改变,结构体可能被扩充或者删减,函数 | ||
96 | 的参数也可能发生改变。一旦接口被修改,内核中使用这些接口的地方需要同时 | ||
97 | 修正,这样才能保证所有的东西继续工作。 | ||
98 | |||
99 | 举一个例子,内核的USB驱动程序接口在USB子系统的整个生命周期中,至少经历 | ||
100 | 了三次重写。这些重写解决以下问题: | ||
101 | - 把数据流从同步模式改成非同步模式,这个改动减少了一些驱动程序的 | ||
102 | 复杂度,提高了所有USB驱动程序的吞吐率,这样几乎所有的USB设备都能以最大 | ||
103 | 速率工作了。 | ||
104 | - 修改了USB核心代码中为USB驱动分配数据包内存的方式,所有的驱动都 | ||
105 | 需要提供更多的参数给USB核心,以修正了很多已经被记录在案的死锁。 | ||
106 | |||
107 | 这和一些封闭源代码的操作系统形成鲜明的对比,在那些操作系统上,不得不额 | ||
108 | 外的维护旧的USB接口。这导致了一个可能性,新的开发者依然会不小心使用旧的 | ||
109 | 接口,以不恰当的方式编写代码,进而影响到操作系统的稳定性。 | ||
110 | 在上面的例子中,所有的开发者都同意这些重要的改动,在这样的情况下修改代 | ||
111 | 价很低。如果Linux保持一个稳定的内核源代码接口,那么就得创建一个新的接口 | ||
112 | ;旧的,有问题的接口必须一直维护,给Linux USB开发者带来额外的工作。既然 | ||
113 | 所有的Linux USB驱动的作者都是利用自己的时间工作,那么要求他们去做毫无意 | ||
114 | 义的免费额外工作,是不可能的。 | ||
115 | 安全问题对Linux来说十分重要。一个安全问题被发现,就会在短时间内得到修 | ||
116 | 正。在很多情况下,这将导致Linux内核中的一些接口被重写,以从根本上避免安 | ||
117 | 全问题。一旦接口被重写,所有使用这些接口的驱动程序,必须同时得到修正, | ||
118 | 以确定安全问题已经得到修复并且不可能在未来还有同样的安全问题。如果内核 | ||
119 | 内部接口不允许改变,那么就不可能修复这样的安全问题,也不可能确认这样的 | ||
120 | 安全问题以后不会发生。 | ||
121 | 开发者一直在清理内核接口。如果一个接口没有人在使用了,它就会被删除。这 | ||
122 | 样可以确保内核尽可能的小,而且所有潜在的接口都会得到尽可能完整的测试 | ||
123 | (没有人使用的接口是不可能得到良好的测试的)。 | ||
124 | |||
125 | |||
126 | 要做什么 | ||
127 | ------- | ||
128 | |||
129 | 如果你写了一个Linux内核驱动,但是它还不在Linux源代码树里,作为一个开发 | ||
130 | 者,你应该怎么做?为每个发布的每个版本提供一个二进制驱动,那简直是一个 | ||
131 | 噩梦,要跟上永远处于变化之中的内核接口,也是一件辛苦活。 | ||
132 | 很简单,让你的驱动进入内核源代码树(要记得我们在谈论的是以GPL许可发行 | ||
133 | 的驱动,如果你的代码不符合GPL,那么祝你好运,你只能自己解决这个问题了, | ||
134 | 你这个吸血鬼<把Andrew和Linus对吸血鬼的定义链接到这里>)。当你的代码加入 | ||
135 | 公版内核源代码树之后,如果一个内核接口改变,你的驱动会直接被修改接口的 | ||
136 | 那个人修改。保证你的驱动永远都可以编译通过,并且一直工作,你几乎不需要 | ||
137 | 做什么事情。 | ||
138 | |||
139 | 把驱动放到内核源代码树里会有很多的好处: | ||
140 | - 驱动的质量会提升,而维护成本(对原始作者来说)会下降。 | ||
141 | - 其他人会给驱动添加新特性。 | ||
142 | - 其他人会找到驱动中的bug并修复。 | ||
143 | - 其他人会在驱动中找到性能优化的机会。 | ||
144 | - 当外部的接口的改变需要修改驱动程序的时候,其他人会修改驱动程序 | ||
145 | 。 | ||
146 | - 不需要联系任何发行商,这个驱动会自动的随着所有的Linux发布一起发 | ||
147 | 布。 | ||
148 | |||
149 | 和别的操作系统相比,Linux为更多不同的设备提供现成的驱动,而且能在更多不 | ||
150 | 同体系结构的处理器上支持这些设备。这个经过考验的开发模式,必然是错不了 | ||
151 | 的 :) | ||
152 | |||
153 | ------------- | ||
154 | 感谢 Randy Dunlap, Andrew Morton, David Brownell, Hanna Linder, | ||
155 | Robert Love, and Nishanth Aravamudan 对于本文档早期版本的评审和建议。 | ||
156 | |||
157 | 英文版维护者: Greg Kroah-Hartman <greg@kroah.com> | ||