diff options
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/ABI/testing/sysfs-bus-usb | 33 | ||||
-rw-r--r-- | Documentation/feature-removal-schedule.txt | 16 | ||||
-rw-r--r-- | Documentation/filesystems/proc.txt | 7 | ||||
-rw-r--r-- | Documentation/ide/ChangeLog.ide-cd.1994-2004 | 268 | ||||
-rw-r--r-- | Documentation/ide/ChangeLog.ide-floppy.1996-2002 | 63 | ||||
-rw-r--r-- | Documentation/ide/ChangeLog.ide-tape.1995-2002 | 257 | ||||
-rw-r--r-- | Documentation/ide/ide-tape.txt | 146 | ||||
-rw-r--r-- | Documentation/kernel-parameters.txt | 5 | ||||
-rw-r--r-- | Documentation/pci.txt | 37 | ||||
-rw-r--r-- | Documentation/power/basic-pm-debugging.txt | 216 | ||||
-rw-r--r-- | Documentation/power/devices.txt | 49 | ||||
-rw-r--r-- | Documentation/power/drivers-testing.txt | 30 | ||||
-rw-r--r-- | Documentation/power/notifiers.txt | 8 | ||||
-rw-r--r-- | Documentation/power/userland-swsusp.txt | 82 | ||||
-rw-r--r-- | Documentation/power_supply_class.txt | 6 | ||||
-rw-r--r-- | Documentation/usb/gadget_printer.txt | 510 | ||||
-rw-r--r-- | Documentation/usb/iuu_phoenix.txt | 84 |
17 files changed, 1582 insertions, 235 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-usb b/Documentation/ABI/testing/sysfs-bus-usb index 9734577d1711..11a3c1682cec 100644 --- a/Documentation/ABI/testing/sysfs-bus-usb +++ b/Documentation/ABI/testing/sysfs-bus-usb | |||
@@ -52,3 +52,36 @@ Description: | |||
52 | facility is inherently dangerous, it is disabled by default | 52 | facility is inherently dangerous, it is disabled by default |
53 | for all devices except hubs. For more information, see | 53 | for all devices except hubs. For more information, see |
54 | Documentation/usb/persist.txt. | 54 | Documentation/usb/persist.txt. |
55 | |||
56 | What: /sys/bus/usb/device/.../power/connected_duration | ||
57 | Date: January 2008 | ||
58 | KernelVersion: 2.6.25 | ||
59 | Contact: Sarah Sharp <sarah.a.sharp@intel.com> | ||
60 | Description: | ||
61 | If CONFIG_PM and CONFIG_USB_SUSPEND are enabled, then this file | ||
62 | is present. When read, it returns the total time (in msec) | ||
63 | that the USB device has been connected to the machine. This | ||
64 | file is read-only. | ||
65 | Users: | ||
66 | PowerTOP <power@bughost.org> | ||
67 | http://www.lesswatts.org/projects/powertop/ | ||
68 | |||
69 | What: /sys/bus/usb/device/.../power/active_duration | ||
70 | Date: January 2008 | ||
71 | KernelVersion: 2.6.25 | ||
72 | Contact: Sarah Sharp <sarah.a.sharp@intel.com> | ||
73 | Description: | ||
74 | If CONFIG_PM and CONFIG_USB_SUSPEND are enabled, then this file | ||
75 | is present. When read, it returns the total time (in msec) | ||
76 | that the USB device has been active, i.e. not in a suspended | ||
77 | state. This file is read-only. | ||
78 | |||
79 | Tools can use this file and the connected_duration file to | ||
80 | compute the percentage of time that a device has been active. | ||
81 | For example, | ||
82 | echo $((100 * `cat active_duration` / `cat connected_duration`)) | ||
83 | will give an integer percentage. Note that this does not | ||
84 | account for counter wrap. | ||
85 | Users: | ||
86 | PowerTOP <power@bughost.org> | ||
87 | http://www.lesswatts.org/projects/powertop/ | ||
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 181bff005167..a7d9d179131a 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -156,22 +156,6 @@ Who: Arjan van de Ven <arjan@linux.intel.com> | |||
156 | 156 | ||
157 | --------------------------- | 157 | --------------------------- |
158 | 158 | ||
159 | What: USB driver API moves to EXPORT_SYMBOL_GPL | ||
160 | When: February 2008 | ||
161 | Files: include/linux/usb.h, drivers/usb/core/driver.c | ||
162 | Why: The USB subsystem has changed a lot over time, and it has been | ||
163 | possible to create userspace USB drivers using usbfs/libusb/gadgetfs | ||
164 | that operate as fast as the USB bus allows. Because of this, the USB | ||
165 | subsystem will not be allowing closed source kernel drivers to | ||
166 | register with it, after this grace period is over. If anyone needs | ||
167 | any help in converting their closed source drivers over to use the | ||
168 | userspace filesystems, please contact the | ||
169 | linux-usb-devel@lists.sourceforge.net mailing list, and the developers | ||
170 | there will be glad to help you out. | ||
171 | Who: Greg Kroah-Hartman <gregkh@suse.de> | ||
172 | |||
173 | --------------------------- | ||
174 | |||
175 | What: vm_ops.nopage | 159 | What: vm_ops.nopage |
176 | When: Soon, provided in-kernel callers have been converted | 160 | When: Soon, provided in-kernel callers have been converted |
177 | Why: This interface is replaced by vm_ops.fault, but it has been around | 161 | Why: This interface is replaced by vm_ops.fault, but it has been around |
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt index 11fe51c036bf..194c8f351320 100644 --- a/Documentation/filesystems/proc.txt +++ b/Documentation/filesystems/proc.txt | |||
@@ -1134,13 +1134,6 @@ check the amount of free space (value is in seconds). Default settings are: 4, | |||
1134 | resume it if we have a value of 3 or more percent; consider information about | 1134 | resume it if we have a value of 3 or more percent; consider information about |
1135 | the amount of free space valid for 30 seconds | 1135 | the amount of free space valid for 30 seconds |
1136 | 1136 | ||
1137 | audit_argv_kb | ||
1138 | ------------- | ||
1139 | |||
1140 | The file contains a single value denoting the limit on the argv array size | ||
1141 | for execve (in KiB). This limit is only applied when system call auditing for | ||
1142 | execve is enabled, otherwise the value is ignored. | ||
1143 | |||
1144 | ctrl-alt-del | 1137 | ctrl-alt-del |
1145 | ------------ | 1138 | ------------ |
1146 | 1139 | ||
diff --git a/Documentation/ide/ChangeLog.ide-cd.1994-2004 b/Documentation/ide/ChangeLog.ide-cd.1994-2004 new file mode 100644 index 000000000000..190d17bfff62 --- /dev/null +++ b/Documentation/ide/ChangeLog.ide-cd.1994-2004 | |||
@@ -0,0 +1,268 @@ | |||
1 | /* | ||
2 | * 1.00 Oct 31, 1994 -- Initial version. | ||
3 | * 1.01 Nov 2, 1994 -- Fixed problem with starting request in | ||
4 | * cdrom_check_status. | ||
5 | * 1.03 Nov 25, 1994 -- leaving unmask_intr[] as a user-setting (as for disks) | ||
6 | * (from mlord) -- minor changes to cdrom_setup() | ||
7 | * -- renamed ide_dev_s to ide_drive_t, enable irq on command | ||
8 | * 2.00 Nov 27, 1994 -- Generalize packet command interface; | ||
9 | * add audio ioctls. | ||
10 | * 2.01 Dec 3, 1994 -- Rework packet command interface to handle devices | ||
11 | * which send an interrupt when ready for a command. | ||
12 | * 2.02 Dec 11, 1994 -- Cache the TOC in the driver. | ||
13 | * Don't use SCMD_PLAYAUDIO_TI; it's not included | ||
14 | * in the current version of ATAPI. | ||
15 | * Try to use LBA instead of track or MSF addressing | ||
16 | * when possible. | ||
17 | * Don't wait for READY_STAT. | ||
18 | * 2.03 Jan 10, 1995 -- Rewrite block read routines to handle block sizes | ||
19 | * other than 2k and to move multiple sectors in a | ||
20 | * single transaction. | ||
21 | * 2.04 Apr 21, 1995 -- Add work-around for Creative Labs CD220E drives. | ||
22 | * Thanks to Nick Saw <cwsaw@pts7.pts.mot.com> for | ||
23 | * help in figuring this out. Ditto for Acer and | ||
24 | * Aztech drives, which seem to have the same problem. | ||
25 | * 2.04b May 30, 1995 -- Fix to match changes in ide.c version 3.16 -ml | ||
26 | * 2.05 Jun 8, 1995 -- Don't attempt to retry after an illegal request | ||
27 | * or data protect error. | ||
28 | * Use HWIF and DEV_HWIF macros as in ide.c. | ||
29 | * Always try to do a request_sense after | ||
30 | * a failed command. | ||
31 | * Include an option to give textual descriptions | ||
32 | * of ATAPI errors. | ||
33 | * Fix a bug in handling the sector cache which | ||
34 | * showed up if the drive returned data in 512 byte | ||
35 | * blocks (like Pioneer drives). Thanks to | ||
36 | * Richard Hirst <srh@gpt.co.uk> for diagnosing this. | ||
37 | * Properly supply the page number field in the | ||
38 | * MODE_SELECT command. | ||
39 | * PLAYAUDIO12 is broken on the Aztech; work around it. | ||
40 | * 2.05x Aug 11, 1995 -- lots of data structure renaming/restructuring in ide.c | ||
41 | * (my apologies to Scott, but now ide-cd.c is independent) | ||
42 | * 3.00 Aug 22, 1995 -- Implement CDROMMULTISESSION ioctl. | ||
43 | * Implement CDROMREADAUDIO ioctl (UNTESTED). | ||
44 | * Use input_ide_data() and output_ide_data(). | ||
45 | * Add door locking. | ||
46 | * Fix usage count leak in cdrom_open, which happened | ||
47 | * when a read-write mount was attempted. | ||
48 | * Try to load the disk on open. | ||
49 | * Implement CDROMEJECT_SW ioctl (off by default). | ||
50 | * Read total cdrom capacity during open. | ||
51 | * Rearrange logic in cdrom_decode_status. Issue | ||
52 | * request sense commands for failed packet commands | ||
53 | * from here instead of from cdrom_queue_packet_command. | ||
54 | * Fix a race condition in retrieving error information. | ||
55 | * Suppress printing normal unit attention errors and | ||
56 | * some drive not ready errors. | ||
57 | * Implement CDROMVOLREAD ioctl. | ||
58 | * Implement CDROMREADMODE1/2 ioctls. | ||
59 | * Fix race condition in setting up interrupt handlers | ||
60 | * when the `serialize' option is used. | ||
61 | * 3.01 Sep 2, 1995 -- Fix ordering of reenabling interrupts in | ||
62 | * cdrom_queue_request. | ||
63 | * Another try at using ide_[input,output]_data. | ||
64 | * 3.02 Sep 16, 1995 -- Stick total disk capacity in partition table as well. | ||
65 | * Make VERBOSE_IDE_CD_ERRORS dump failed command again. | ||
66 | * Dump out more information for ILLEGAL REQUEST errs. | ||
67 | * Fix handling of errors occurring before the | ||
68 | * packet command is transferred. | ||
69 | * Fix transfers with odd bytelengths. | ||
70 | * 3.03 Oct 27, 1995 -- Some Creative drives have an id of just `CD'. | ||
71 | * `DCI-2S10' drives are broken too. | ||
72 | * 3.04 Nov 20, 1995 -- So are Vertos drives. | ||
73 | * 3.05 Dec 1, 1995 -- Changes to go with overhaul of ide.c and ide-tape.c | ||
74 | * 3.06 Dec 16, 1995 -- Add support needed for partitions. | ||
75 | * More workarounds for Vertos bugs (based on patches | ||
76 | * from Holger Dietze <dietze@aix520.informatik.uni-leipzig.de>). | ||
77 | * Try to eliminate byteorder assumptions. | ||
78 | * Use atapi_cdrom_subchnl struct definition. | ||
79 | * Add STANDARD_ATAPI compilation option. | ||
80 | * 3.07 Jan 29, 1996 -- More twiddling for broken drives: Sony 55D, | ||
81 | * Vertos 300. | ||
82 | * Add NO_DOOR_LOCKING configuration option. | ||
83 | * Handle drive_cmd requests w/NULL args (for hdparm -t). | ||
84 | * Work around sporadic Sony55e audio play problem. | ||
85 | * 3.07a Feb 11, 1996 -- check drive->id for NULL before dereferencing, to fix | ||
86 | * problem with "hde=cdrom" with no drive present. -ml | ||
87 | * 3.08 Mar 6, 1996 -- More Vertos workarounds. | ||
88 | * 3.09 Apr 5, 1996 -- Add CDROMCLOSETRAY ioctl. | ||
89 | * Switch to using MSF addressing for audio commands. | ||
90 | * Reformat to match kernel tabbing style. | ||
91 | * Add CDROM_GET_UPC ioctl. | ||
92 | * 3.10 Apr 10, 1996 -- Fix compilation error with STANDARD_ATAPI. | ||
93 | * 3.11 Apr 29, 1996 -- Patch from Heiko Eißfeldt <heiko@colossus.escape.de> | ||
94 | * to remove redundant verify_area calls. | ||
95 | * 3.12 May 7, 1996 -- Rudimentary changer support. Based on patches | ||
96 | * from Gerhard Zuber <zuber@berlin.snafu.de>. | ||
97 | * Let open succeed even if there's no loaded disc. | ||
98 | * 3.13 May 19, 1996 -- Fixes for changer code. | ||
99 | * 3.14 May 29, 1996 -- Add work-around for Vertos 600. | ||
100 | * (From Hennus Bergman <hennus@sky.ow.nl>.) | ||
101 | * 3.15 July 2, 1996 -- Added support for Sanyo 3 CD changers | ||
102 | * from Ben Galliart <bgallia@luc.edu> with | ||
103 | * special help from Jeff Lightfoot | ||
104 | * <jeffml@pobox.com> | ||
105 | * 3.15a July 9, 1996 -- Improved Sanyo 3 CD changer identification | ||
106 | * 3.16 Jul 28, 1996 -- Fix from Gadi to reduce kernel stack usage for ioctl. | ||
107 | * 3.17 Sep 17, 1996 -- Tweak audio reads for some drives. | ||
108 | * Start changing CDROMLOADFROMSLOT to CDROM_SELECT_DISC. | ||
109 | * 3.18 Oct 31, 1996 -- Added module and DMA support. | ||
110 | * | ||
111 | * 4.00 Nov 5, 1996 -- New ide-cd maintainer, | ||
112 | * Erik B. Andersen <andersee@debian.org> | ||
113 | * -- Newer Creative drives don't always set the error | ||
114 | * register correctly. Make sure we see media changes | ||
115 | * regardless. | ||
116 | * -- Integrate with generic cdrom driver. | ||
117 | * -- CDROMGETSPINDOWN and CDROMSETSPINDOWN ioctls, based on | ||
118 | * a patch from Ciro Cattuto <>. | ||
119 | * -- Call set_device_ro. | ||
120 | * -- Implement CDROMMECHANISMSTATUS and CDROMSLOTTABLE | ||
121 | * ioctls, based on patch by Erik Andersen | ||
122 | * -- Add some probes of drive capability during setup. | ||
123 | * | ||
124 | * 4.01 Nov 11, 1996 -- Split into ide-cd.c and ide-cd.h | ||
125 | * -- Removed CDROMMECHANISMSTATUS and CDROMSLOTTABLE | ||
126 | * ioctls in favor of a generalized approach | ||
127 | * using the generic cdrom driver. | ||
128 | * -- Fully integrated with the 2.1.X kernel. | ||
129 | * -- Other stuff that I forgot (lots of changes) | ||
130 | * | ||
131 | * 4.02 Dec 01, 1996 -- Applied patch from Gadi Oxman <gadio@netvision.net.il> | ||
132 | * to fix the drive door locking problems. | ||
133 | * | ||
134 | * 4.03 Dec 04, 1996 -- Added DSC overlap support. | ||
135 | * 4.04 Dec 29, 1996 -- Added CDROMREADRAW ioclt based on patch | ||
136 | * by Ales Makarov (xmakarov@sun.felk.cvut.cz) | ||
137 | * | ||
138 | * 4.05 Nov 20, 1997 -- Modified to print more drive info on init | ||
139 | * Minor other changes | ||
140 | * Fix errors on CDROMSTOP (If you have a "Dolphin", | ||
141 | * you must define IHAVEADOLPHIN) | ||
142 | * Added identifier so new Sanyo CD-changer works | ||
143 | * Better detection if door locking isn't supported | ||
144 | * | ||
145 | * 4.06 Dec 17, 1997 -- fixed endless "tray open" messages -ml | ||
146 | * 4.07 Dec 17, 1997 -- fallback to set pc->stat on "tray open" | ||
147 | * 4.08 Dec 18, 1997 -- spew less noise when tray is empty | ||
148 | * -- fix speed display for ACER 24X, 18X | ||
149 | * 4.09 Jan 04, 1998 -- fix handling of the last block so we return | ||
150 | * an end of file instead of an I/O error (Gadi) | ||
151 | * 4.10 Jan 24, 1998 -- fixed a bug so now changers can change to a new | ||
152 | * slot when there is no disc in the current slot. | ||
153 | * -- Fixed a memory leak where info->changer_info was | ||
154 | * malloc'ed but never free'd when closing the device. | ||
155 | * -- Cleaned up the global namespace a bit by making more | ||
156 | * functions static that should already have been. | ||
157 | * 4.11 Mar 12, 1998 -- Added support for the CDROM_SELECT_SPEED ioctl | ||
158 | * based on a patch for 2.0.33 by Jelle Foks | ||
159 | * <jelle@scintilla.utwente.nl>, a patch for 2.0.33 | ||
160 | * by Toni Giorgino <toni@pcape2.pi.infn.it>, the SCSI | ||
161 | * version, and my own efforts. -erik | ||
162 | * -- Fixed a stupid bug which egcs was kind enough to | ||
163 | * inform me of where "Illegal mode for this track" | ||
164 | * was never returned due to a comparison on data | ||
165 | * types of limited range. | ||
166 | * 4.12 Mar 29, 1998 -- Fixed bug in CDROM_SELECT_SPEED so write speed is | ||
167 | * now set ionly for CD-R and CD-RW drives. I had | ||
168 | * removed this support because it produced errors. | ||
169 | * It produced errors _only_ for non-writers. duh. | ||
170 | * 4.13 May 05, 1998 -- Suppress useless "in progress of becoming ready" | ||
171 | * messages, since this is not an error. | ||
172 | * -- Change error messages to be const | ||
173 | * -- Remove a "\t" which looks ugly in the syslogs | ||
174 | * 4.14 July 17, 1998 -- Change to pointing to .ps version of ATAPI spec | ||
175 | * since the .pdf version doesn't seem to work... | ||
176 | * -- Updated the TODO list to something more current. | ||
177 | * | ||
178 | * 4.15 Aug 25, 1998 -- Updated ide-cd.h to respect mechine endianess, | ||
179 | * patch thanks to "Eddie C. Dost" <ecd@skynet.be> | ||
180 | * | ||
181 | * 4.50 Oct 19, 1998 -- New maintainers! | ||
182 | * Jens Axboe <axboe@image.dk> | ||
183 | * Chris Zwilling <chris@cloudnet.com> | ||
184 | * | ||
185 | * 4.51 Dec 23, 1998 -- Jens Axboe <axboe@image.dk> | ||
186 | * - ide_cdrom_reset enabled since the ide subsystem | ||
187 | * handles resets fine now. <axboe@image.dk> | ||
188 | * - Transfer size fix for Samsung CD-ROMs, thanks to | ||
189 | * "Ville Hallik" <ville.hallik@mail.ee>. | ||
190 | * - other minor stuff. | ||
191 | * | ||
192 | * 4.52 Jan 19, 1999 -- Jens Axboe <axboe@image.dk> | ||
193 | * - Detect DVD-ROM/RAM drives | ||
194 | * | ||
195 | * 4.53 Feb 22, 1999 - Include other model Samsung and one Goldstar | ||
196 | * drive in transfer size limit. | ||
197 | * - Fix the I/O error when doing eject without a medium | ||
198 | * loaded on some drives. | ||
199 | * - CDROMREADMODE2 is now implemented through | ||
200 | * CDROMREADRAW, since many drives don't support | ||
201 | * MODE2 (even though ATAPI 2.6 says they must). | ||
202 | * - Added ignore parameter to ide-cd (as a module), eg | ||
203 | * insmod ide-cd ignore='hda hdb' | ||
204 | * Useful when using ide-cd in conjunction with | ||
205 | * ide-scsi. TODO: non-modular way of doing the | ||
206 | * same. | ||
207 | * | ||
208 | * 4.54 Aug 5, 1999 - Support for MMC2 class commands through the generic | ||
209 | * packet interface to cdrom.c. | ||
210 | * - Unified audio ioctl support, most of it. | ||
211 | * - cleaned up various deprecated verify_area(). | ||
212 | * - Added ide_cdrom_packet() as the interface for | ||
213 | * the Uniform generic_packet(). | ||
214 | * - bunch of other stuff, will fill in logs later. | ||
215 | * - report 1 slot for non-changers, like the other | ||
216 | * cd-rom drivers. don't report select disc for | ||
217 | * non-changers as well. | ||
218 | * - mask out audio playing, if the device can't do it. | ||
219 | * | ||
220 | * 4.55 Sep 1, 1999 - Eliminated the rest of the audio ioctls, except | ||
221 | * for CDROMREADTOC[ENTRY|HEADER]. Some of the drivers | ||
222 | * use this independently of the actual audio handling. | ||
223 | * They will disappear later when I get the time to | ||
224 | * do it cleanly. | ||
225 | * - Minimize the TOC reading - only do it when we | ||
226 | * know a media change has occurred. | ||
227 | * - Moved all the CDROMREADx ioctls to the Uniform layer. | ||
228 | * - Heiko Eißfeldt <heiko@colossus.escape.de> supplied | ||
229 | * some fixes for CDI. | ||
230 | * - CD-ROM leaving door locked fix from Andries | ||
231 | * Brouwer <Andries.Brouwer@cwi.nl> | ||
232 | * - Erik Andersen <andersen@xmission.com> unified | ||
233 | * commands across the various drivers and how | ||
234 | * sense errors are handled. | ||
235 | * | ||
236 | * 4.56 Sep 12, 1999 - Removed changer support - it is now in the | ||
237 | * Uniform layer. | ||
238 | * - Added partition based multisession handling. | ||
239 | * - Mode sense and mode select moved to the | ||
240 | * Uniform layer. | ||
241 | * - Fixed a problem with WPI CDS-32X drive - it | ||
242 | * failed the capabilities | ||
243 | * | ||
244 | * 4.57 Apr 7, 2000 - Fixed sense reporting. | ||
245 | * - Fixed possible oops in ide_cdrom_get_last_session() | ||
246 | * - Fix locking mania and make ide_cdrom_reset relock | ||
247 | * - Stop spewing errors to log when magicdev polls with | ||
248 | * TEST_UNIT_READY on some drives. | ||
249 | * - Various fixes from Tobias Ringstrom: | ||
250 | * tray if it was locked prior to the reset. | ||
251 | * - cdrom_read_capacity returns one frame too little. | ||
252 | * - Fix real capacity reporting. | ||
253 | * | ||
254 | * 4.58 May 1, 2000 - Clean up ACER50 stuff. | ||
255 | * - Fix small problem with ide_cdrom_capacity | ||
256 | * | ||
257 | * 4.59 Aug 11, 2000 - Fix changer problem in cdrom_read_toc, we weren't | ||
258 | * correctly sensing a disc change. | ||
259 | * - Rearranged some code | ||
260 | * - Use extended sense on drives that support it for | ||
261 | * correctly reporting tray status -- from | ||
262 | * Michael D Johnson <johnsom@orst.edu> | ||
263 | * 4.60 Dec 17, 2003 - Add mt rainier support | ||
264 | * - Bump timeout for packet commands, matches sr | ||
265 | * - Odd stuff | ||
266 | * 4.61 Jan 22, 2004 - support hardware sector sizes other than 2kB, | ||
267 | * Pascal Schmidt <der.eremit@email.de> | ||
268 | */ | ||
diff --git a/Documentation/ide/ChangeLog.ide-floppy.1996-2002 b/Documentation/ide/ChangeLog.ide-floppy.1996-2002 new file mode 100644 index 000000000000..46c19ef32a9e --- /dev/null +++ b/Documentation/ide/ChangeLog.ide-floppy.1996-2002 | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | * Many thanks to Lode Leroy <Lode.Leroy@www.ibase.be>, who tested so many | ||
3 | * ALPHA patches to this driver on an EASYSTOR LS-120 ATAPI floppy drive. | ||
4 | * | ||
5 | * Ver 0.1 Oct 17 96 Initial test version, mostly based on ide-tape.c. | ||
6 | * Ver 0.2 Oct 31 96 Minor changes. | ||
7 | * Ver 0.3 Dec 2 96 Fixed error recovery bug. | ||
8 | * Ver 0.4 Jan 26 97 Add support for the HDIO_GETGEO ioctl. | ||
9 | * Ver 0.5 Feb 21 97 Add partitions support. | ||
10 | * Use the minimum of the LBA and CHS capacities. | ||
11 | * Avoid hwgroup->rq == NULL on the last irq. | ||
12 | * Fix potential null dereferencing with DEBUG_LOG. | ||
13 | * Ver 0.8 Dec 7 97 Increase irq timeout from 10 to 50 seconds. | ||
14 | * Add media write-protect detection. | ||
15 | * Issue START command only if TEST UNIT READY fails. | ||
16 | * Add work-around for IOMEGA ZIP revision 21.D. | ||
17 | * Remove idefloppy_get_capabilities(). | ||
18 | * Ver 0.9 Jul 4 99 Fix a bug which might have caused the number of | ||
19 | * bytes requested on each interrupt to be zero. | ||
20 | * Thanks to <shanos@es.co.nz> for pointing this out. | ||
21 | * Ver 0.9.sv Jan 6 01 Sam Varshavchik <mrsam@courier-mta.com> | ||
22 | * Implement low level formatting. Reimplemented | ||
23 | * IDEFLOPPY_CAPABILITIES_PAGE, since we need the srfp | ||
24 | * bit. My LS-120 drive barfs on | ||
25 | * IDEFLOPPY_CAPABILITIES_PAGE, but maybe it's just me. | ||
26 | * Compromise by not reporting a failure to get this | ||
27 | * mode page. Implemented four IOCTLs in order to | ||
28 | * implement formatting. IOCTls begin with 0x4600, | ||
29 | * 0x46 is 'F' as in Format. | ||
30 | * Jan 9 01 Userland option to select format verify. | ||
31 | * Added PC_SUPPRESS_ERROR flag - some idefloppy drives | ||
32 | * do not implement IDEFLOPPY_CAPABILITIES_PAGE, and | ||
33 | * return a sense error. Suppress error reporting in | ||
34 | * this particular case in order to avoid spurious | ||
35 | * errors in syslog. The culprit is | ||
36 | * idefloppy_get_capability_page(), so move it to | ||
37 | * idefloppy_begin_format() so that it's not used | ||
38 | * unless absolutely necessary. | ||
39 | * If drive does not support format progress indication | ||
40 | * monitor the dsc bit in the status register. | ||
41 | * Also, O_NDELAY on open will allow the device to be | ||
42 | * opened without a disk available. This can be used to | ||
43 | * open an unformatted disk, or get the device capacity. | ||
44 | * Ver 0.91 Dec 11 99 Added IOMEGA Clik! drive support by | ||
45 | * <paul@paulbristow.net> | ||
46 | * Ver 0.92 Oct 22 00 Paul Bristow became official maintainer for this | ||
47 | * driver. Included Powerbook internal zip kludge. | ||
48 | * Ver 0.93 Oct 24 00 Fixed bugs for Clik! drive | ||
49 | * no disk on insert and disk change now works | ||
50 | * Ver 0.94 Oct 27 00 Tidied up to remove strstr(Clik) everywhere | ||
51 | * Ver 0.95 Nov 7 00 Brought across to kernel 2.4 | ||
52 | * Ver 0.96 Jan 7 01 Actually in line with release version of 2.4.0 | ||
53 | * including set_bit patch from Rusty Russell | ||
54 | * Ver 0.97 Jul 22 01 Merge 0.91-0.96 onto 0.9.sv for ac series | ||
55 | * Ver 0.97.sv Aug 3 01 Backported from 2.4.7-ac3 | ||
56 | * Ver 0.98 Oct 26 01 Split idefloppy_transfer_pc into two pieces to | ||
57 | * fix a lost interrupt problem. It appears the busy | ||
58 | * bit was being deasserted by my IOMEGA ATAPI ZIP 100 | ||
59 | * drive before the drive was actually ready. | ||
60 | * Ver 0.98a Oct 29 01 Expose delay value so we can play. | ||
61 | * Ver 0.99 Feb 24 02 Remove duplicate code, modify clik! detection code | ||
62 | * to support new PocketZip drives | ||
63 | */ | ||
diff --git a/Documentation/ide/ChangeLog.ide-tape.1995-2002 b/Documentation/ide/ChangeLog.ide-tape.1995-2002 new file mode 100644 index 000000000000..877fac8770b3 --- /dev/null +++ b/Documentation/ide/ChangeLog.ide-tape.1995-2002 | |||
@@ -0,0 +1,257 @@ | |||
1 | /* | ||
2 | * Ver 0.1 Nov 1 95 Pre-working code :-) | ||
3 | * Ver 0.2 Nov 23 95 A short backup (few megabytes) and restore procedure | ||
4 | * was successful ! (Using tar cvf ... on the block | ||
5 | * device interface). | ||
6 | * A longer backup resulted in major swapping, bad | ||
7 | * overall Linux performance and eventually failed as | ||
8 | * we received non serial read-ahead requests from the | ||
9 | * buffer cache. | ||
10 | * Ver 0.3 Nov 28 95 Long backups are now possible, thanks to the | ||
11 | * character device interface. Linux's responsiveness | ||
12 | * and performance doesn't seem to be much affected | ||
13 | * from the background backup procedure. | ||
14 | * Some general mtio.h magnetic tape operations are | ||
15 | * now supported by our character device. As a result, | ||
16 | * popular tape utilities are starting to work with | ||
17 | * ide tapes :-) | ||
18 | * The following configurations were tested: | ||
19 | * 1. An IDE ATAPI TAPE shares the same interface | ||
20 | * and irq with an IDE ATAPI CDROM. | ||
21 | * 2. An IDE ATAPI TAPE shares the same interface | ||
22 | * and irq with a normal IDE disk. | ||
23 | * Both configurations seemed to work just fine ! | ||
24 | * However, to be on the safe side, it is meanwhile | ||
25 | * recommended to give the IDE TAPE its own interface | ||
26 | * and irq. | ||
27 | * The one thing which needs to be done here is to | ||
28 | * add a "request postpone" feature to ide.c, | ||
29 | * so that we won't have to wait for the tape to finish | ||
30 | * performing a long media access (DSC) request (such | ||
31 | * as a rewind) before we can access the other device | ||
32 | * on the same interface. This effect doesn't disturb | ||
33 | * normal operation most of the time because read/write | ||
34 | * requests are relatively fast, and once we are | ||
35 | * performing one tape r/w request, a lot of requests | ||
36 | * from the other device can be queued and ide.c will | ||
37 | * service all of them after this single tape request. | ||
38 | * Ver 1.0 Dec 11 95 Integrated into Linux 1.3.46 development tree. | ||
39 | * On each read / write request, we now ask the drive | ||
40 | * if we can transfer a constant number of bytes | ||
41 | * (a parameter of the drive) only to its buffers, | ||
42 | * without causing actual media access. If we can't, | ||
43 | * we just wait until we can by polling the DSC bit. | ||
44 | * This ensures that while we are not transferring | ||
45 | * more bytes than the constant referred to above, the | ||
46 | * interrupt latency will not become too high and | ||
47 | * we won't cause an interrupt timeout, as happened | ||
48 | * occasionally in the previous version. | ||
49 | * While polling for DSC, the current request is | ||
50 | * postponed and ide.c is free to handle requests from | ||
51 | * the other device. This is handled transparently to | ||
52 | * ide.c. The hwgroup locking method which was used | ||
53 | * in the previous version was removed. | ||
54 | * Use of new general features which are provided by | ||
55 | * ide.c for use with atapi devices. | ||
56 | * (Programming done by Mark Lord) | ||
57 | * Few potential bug fixes (Again, suggested by Mark) | ||
58 | * Single character device data transfers are now | ||
59 | * not limited in size, as they were before. | ||
60 | * We are asking the tape about its recommended | ||
61 | * transfer unit and send a larger data transfer | ||
62 | * as several transfers of the above size. | ||
63 | * For best results, use an integral number of this | ||
64 | * basic unit (which is shown during driver | ||
65 | * initialization). I will soon add an ioctl to get | ||
66 | * this important parameter. | ||
67 | * Our data transfer buffer is allocated on startup, | ||
68 | * rather than before each data transfer. This should | ||
69 | * ensure that we will indeed have a data buffer. | ||
70 | * Ver 1.1 Dec 14 95 Fixed random problems which occurred when the tape | ||
71 | * shared an interface with another device. | ||
72 | * (poll_for_dsc was a complete mess). | ||
73 | * Removed some old (non-active) code which had | ||
74 | * to do with supporting buffer cache originated | ||
75 | * requests. | ||
76 | * The block device interface can now be opened, so | ||
77 | * that general ide driver features like the unmask | ||
78 | * interrupts flag can be selected with an ioctl. | ||
79 | * This is the only use of the block device interface. | ||
80 | * New fast pipelined operation mode (currently only on | ||
81 | * writes). When using the pipelined mode, the | ||
82 | * throughput can potentially reach the maximum | ||
83 | * tape supported throughput, regardless of the | ||
84 | * user backup program. On my tape drive, it sometimes | ||
85 | * boosted performance by a factor of 2. Pipelined | ||
86 | * mode is enabled by default, but since it has a few | ||
87 | * downfalls as well, you may want to disable it. | ||
88 | * A short explanation of the pipelined operation mode | ||
89 | * is available below. | ||
90 | * Ver 1.2 Jan 1 96 Eliminated pipelined mode race condition. | ||
91 | * Added pipeline read mode. As a result, restores | ||
92 | * are now as fast as backups. | ||
93 | * Optimized shared interface behavior. The new behavior | ||
94 | * typically results in better IDE bus efficiency and | ||
95 | * higher tape throughput. | ||
96 | * Pre-calculation of the expected read/write request | ||
97 | * service time, based on the tape's parameters. In | ||
98 | * the pipelined operation mode, this allows us to | ||
99 | * adjust our polling frequency to a much lower value, | ||
100 | * and thus to dramatically reduce our load on Linux, | ||
101 | * without any decrease in performance. | ||
102 | * Implemented additional mtio.h operations. | ||
103 | * The recommended user block size is returned by | ||
104 | * the MTIOCGET ioctl. | ||
105 | * Additional minor changes. | ||
106 | * Ver 1.3 Feb 9 96 Fixed pipelined read mode bug which prevented the | ||
107 | * use of some block sizes during a restore procedure. | ||
108 | * The character device interface will now present a | ||
109 | * continuous view of the media - any mix of block sizes | ||
110 | * during a backup/restore procedure is supported. The | ||
111 | * driver will buffer the requests internally and | ||
112 | * convert them to the tape's recommended transfer | ||
113 | * unit, making performance almost independent of the | ||
114 | * chosen user block size. | ||
115 | * Some improvements in error recovery. | ||
116 | * By cooperating with ide-dma.c, bus mastering DMA can | ||
117 | * now sometimes be used with IDE tape drives as well. | ||
118 | * Bus mastering DMA has the potential to dramatically | ||
119 | * reduce the CPU's overhead when accessing the device, | ||
120 | * and can be enabled by using hdparm -d1 on the tape's | ||
121 | * block device interface. For more info, read the | ||
122 | * comments in ide-dma.c. | ||
123 | * Ver 1.4 Mar 13 96 Fixed serialize support. | ||
124 | * Ver 1.5 Apr 12 96 Fixed shared interface operation, broken in 1.3.85. | ||
125 | * Fixed pipelined read mode inefficiency. | ||
126 | * Fixed nasty null dereferencing bug. | ||
127 | * Ver 1.6 Aug 16 96 Fixed FPU usage in the driver. | ||
128 | * Fixed end of media bug. | ||
129 | * Ver 1.7 Sep 10 96 Minor changes for the CONNER CTT8000-A model. | ||
130 | * Ver 1.8 Sep 26 96 Attempt to find a better balance between good | ||
131 | * interactive response and high system throughput. | ||
132 | * Ver 1.9 Nov 5 96 Automatically cross encountered filemarks rather | ||
133 | * than requiring an explicit FSF command. | ||
134 | * Abort pending requests at end of media. | ||
135 | * MTTELL was sometimes returning incorrect results. | ||
136 | * Return the real block size in the MTIOCGET ioctl. | ||
137 | * Some error recovery bug fixes. | ||
138 | * Ver 1.10 Nov 5 96 Major reorganization. | ||
139 | * Reduced CPU overhead a bit by eliminating internal | ||
140 | * bounce buffers. | ||
141 | * Added module support. | ||
142 | * Added multiple tape drives support. | ||
143 | * Added partition support. | ||
144 | * Rewrote DSC handling. | ||
145 | * Some portability fixes. | ||
146 | * Removed ide-tape.h. | ||
147 | * Additional minor changes. | ||
148 | * Ver 1.11 Dec 2 96 Bug fix in previous DSC timeout handling. | ||
149 | * Use ide_stall_queue() for DSC overlap. | ||
150 | * Use the maximum speed rather than the current speed | ||
151 | * to compute the request service time. | ||
152 | * Ver 1.12 Dec 7 97 Fix random memory overwriting and/or last block data | ||
153 | * corruption, which could occur if the total number | ||
154 | * of bytes written to the tape was not an integral | ||
155 | * number of tape blocks. | ||
156 | * Add support for INTERRUPT DRQ devices. | ||
157 | * Ver 1.13 Jan 2 98 Add "speed == 0" work-around for HP COLORADO 5GB | ||
158 | * Ver 1.14 Dec 30 98 Partial fixes for the Sony/AIWA tape drives. | ||
159 | * Replace cli()/sti() with hwgroup spinlocks. | ||
160 | * Ver 1.15 Mar 25 99 Fix SMP race condition by replacing hwgroup | ||
161 | * spinlock with private per-tape spinlock. | ||
162 | * Ver 1.16 Sep 1 99 Add OnStream tape support. | ||
163 | * Abort read pipeline on EOD. | ||
164 | * Wait for the tape to become ready in case it returns | ||
165 | * "in the process of becoming ready" on open(). | ||
166 | * Fix zero padding of the last written block in | ||
167 | * case the tape block size is larger than PAGE_SIZE. | ||
168 | * Decrease the default disconnection time to tn. | ||
169 | * Ver 1.16e Oct 3 99 Minor fixes. | ||
170 | * Ver 1.16e1 Oct 13 99 Patches by Arnold Niessen, | ||
171 | * niessen@iae.nl / arnold.niessen@philips.com | ||
172 | * GO-1) Undefined code in idetape_read_position | ||
173 | * according to Gadi's email | ||
174 | * AJN-1) Minor fix asc == 11 should be asc == 0x11 | ||
175 | * in idetape_issue_packet_command (did effect | ||
176 | * debugging output only) | ||
177 | * AJN-2) Added more debugging output, and | ||
178 | * added ide-tape: where missing. I would also | ||
179 | * like to add tape->name where possible | ||
180 | * AJN-3) Added different debug_level's | ||
181 | * via /proc/ide/hdc/settings | ||
182 | * "debug_level" determines amount of debugging output; | ||
183 | * can be changed using /proc/ide/hdx/settings | ||
184 | * 0 : almost no debugging output | ||
185 | * 1 : 0+output errors only | ||
186 | * 2 : 1+output all sensekey/asc | ||
187 | * 3 : 2+follow all chrdev related procedures | ||
188 | * 4 : 3+follow all procedures | ||
189 | * 5 : 4+include pc_stack rq_stack info | ||
190 | * 6 : 5+USE_COUNT updates | ||
191 | * AJN-4) Fixed timeout for retension in idetape_queue_pc_tail | ||
192 | * from 5 to 10 minutes | ||
193 | * AJN-5) Changed maximum number of blocks to skip when | ||
194 | * reading tapes with multiple consecutive write | ||
195 | * errors from 100 to 1000 in idetape_get_logical_blk | ||
196 | * Proposed changes to code: | ||
197 | * 1) output "logical_blk_num" via /proc | ||
198 | * 2) output "current_operation" via /proc | ||
199 | * 3) Either solve or document the fact that `mt rewind' is | ||
200 | * required after reading from /dev/nhtx to be | ||
201 | * able to rmmod the idetape module; | ||
202 | * Also, sometimes an application finishes but the | ||
203 | * device remains `busy' for some time. Same cause ? | ||
204 | * Proposed changes to release-notes: | ||
205 | * 4) write a simple `quickstart' section in the | ||
206 | * release notes; I volunteer if you don't want to | ||
207 | * 5) include a pointer to video4linux in the doc | ||
208 | * to stimulate video applications | ||
209 | * 6) release notes lines 331 and 362: explain what happens | ||
210 | * if the application data rate is higher than 1100 KB/s; | ||
211 | * similar approach to lower-than-500 kB/s ? | ||
212 | * 7) 6.6 Comparison; wouldn't it be better to allow different | ||
213 | * strategies for read and write ? | ||
214 | * Wouldn't it be better to control the tape buffer | ||
215 | * contents instead of the bandwidth ? | ||
216 | * 8) line 536: replace will by would (if I understand | ||
217 | * this section correctly, a hypothetical and unwanted situation | ||
218 | * is being described) | ||
219 | * Ver 1.16f Dec 15 99 Change place of the secondary OnStream header frames. | ||
220 | * Ver 1.17 Nov 2000 / Jan 2001 Marcel Mol, marcel@mesa.nl | ||
221 | * - Add idetape_onstream_mode_sense_tape_parameter_page | ||
222 | * function to get tape capacity in frames: tape->capacity. | ||
223 | * - Add support for DI-50 drives( or any DI- drive). | ||
224 | * - 'workaround' for read error/blank block around block 3000. | ||
225 | * - Implement Early warning for end of media for Onstream. | ||
226 | * - Cosmetic code changes for readability. | ||
227 | * - Idetape_position_tape should not use SKIP bit during | ||
228 | * Onstream read recovery. | ||
229 | * - Add capacity, logical_blk_num and first/last_frame_position | ||
230 | * to /proc/ide/hd?/settings. | ||
231 | * - Module use count was gone in the Linux 2.4 driver. | ||
232 | * Ver 1.17a Apr 2001 Willem Riede osst@riede.org | ||
233 | * - Get drive's actual block size from mode sense block descriptor | ||
234 | * - Limit size of pipeline | ||
235 | * Ver 1.17b Oct 2002 Alan Stern <stern@rowland.harvard.edu> | ||
236 | * Changed IDETAPE_MIN_PIPELINE_STAGES to 1 and actually used | ||
237 | * it in the code! | ||
238 | * Actually removed aborted stages in idetape_abort_pipeline | ||
239 | * instead of just changing the command code. | ||
240 | * Made the transfer byte count for Request Sense equal to the | ||
241 | * actual length of the data transfer. | ||
242 | * Changed handling of partial data transfers: they do not | ||
243 | * cause DMA errors. | ||
244 | * Moved initiation of DMA transfers to the correct place. | ||
245 | * Removed reference to unallocated memory. | ||
246 | * Made __idetape_discard_read_pipeline return the number of | ||
247 | * sectors skipped, not the number of stages. | ||
248 | * Replaced errant kfree() calls with __idetape_kfree_stage(). | ||
249 | * Fixed off-by-one error in testing the pipeline length. | ||
250 | * Fixed handling of filemarks in the read pipeline. | ||
251 | * Small code optimization for MTBSF and MTBSFM ioctls. | ||
252 | * Don't try to unlock the door during device close if is | ||
253 | * already unlocked! | ||
254 | * Cosmetic fixes to miscellaneous debugging output messages. | ||
255 | * Set the minimum /proc/ide/hd?/settings values for "pipeline", | ||
256 | * "pipeline_min", and "pipeline_max" to 1. | ||
257 | */ | ||
diff --git a/Documentation/ide/ide-tape.txt b/Documentation/ide/ide-tape.txt new file mode 100644 index 000000000000..658f271a373f --- /dev/null +++ b/Documentation/ide/ide-tape.txt | |||
@@ -0,0 +1,146 @@ | |||
1 | /* | ||
2 | * IDE ATAPI streaming tape driver. | ||
3 | * | ||
4 | * This driver is a part of the Linux ide driver. | ||
5 | * | ||
6 | * The driver, in co-operation with ide.c, basically traverses the | ||
7 | * request-list for the block device interface. The character device | ||
8 | * interface, on the other hand, creates new requests, adds them | ||
9 | * to the request-list of the block device, and waits for their completion. | ||
10 | * | ||
11 | * Pipelined operation mode is now supported on both reads and writes. | ||
12 | * | ||
13 | * The block device major and minor numbers are determined from the | ||
14 | * tape's relative position in the ide interfaces, as explained in ide.c. | ||
15 | * | ||
16 | * The character device interface consists of the following devices: | ||
17 | * | ||
18 | * ht0 major 37, minor 0 first IDE tape, rewind on close. | ||
19 | * ht1 major 37, minor 1 second IDE tape, rewind on close. | ||
20 | * ... | ||
21 | * nht0 major 37, minor 128 first IDE tape, no rewind on close. | ||
22 | * nht1 major 37, minor 129 second IDE tape, no rewind on close. | ||
23 | * ... | ||
24 | * | ||
25 | * The general magnetic tape commands compatible interface, as defined by | ||
26 | * include/linux/mtio.h, is accessible through the character device. | ||
27 | * | ||
28 | * General ide driver configuration options, such as the interrupt-unmask | ||
29 | * flag, can be configured by issuing an ioctl to the block device interface, | ||
30 | * as any other ide device. | ||
31 | * | ||
32 | * Our own ide-tape ioctl's can be issued to either the block device or | ||
33 | * the character device interface. | ||
34 | * | ||
35 | * Maximal throughput with minimal bus load will usually be achieved in the | ||
36 | * following scenario: | ||
37 | * | ||
38 | * 1. ide-tape is operating in the pipelined operation mode. | ||
39 | * 2. No buffering is performed by the user backup program. | ||
40 | * | ||
41 | * Testing was done with a 2 GB CONNER CTMA 4000 IDE ATAPI Streaming Tape Drive. | ||
42 | * | ||
43 | * Here are some words from the first releases of hd.c, which are quoted | ||
44 | * in ide.c and apply here as well: | ||
45 | * | ||
46 | * | Special care is recommended. Have Fun! | ||
47 | * | ||
48 | * | ||
49 | * An overview of the pipelined operation mode. | ||
50 | * | ||
51 | * In the pipelined write mode, we will usually just add requests to our | ||
52 | * pipeline and return immediately, before we even start to service them. The | ||
53 | * user program will then have enough time to prepare the next request while | ||
54 | * we are still busy servicing previous requests. In the pipelined read mode, | ||
55 | * the situation is similar - we add read-ahead requests into the pipeline, | ||
56 | * before the user even requested them. | ||
57 | * | ||
58 | * The pipeline can be viewed as a "safety net" which will be activated when | ||
59 | * the system load is high and prevents the user backup program from keeping up | ||
60 | * with the current tape speed. At this point, the pipeline will get | ||
61 | * shorter and shorter but the tape will still be streaming at the same speed. | ||
62 | * Assuming we have enough pipeline stages, the system load will hopefully | ||
63 | * decrease before the pipeline is completely empty, and the backup program | ||
64 | * will be able to "catch up" and refill the pipeline again. | ||
65 | * | ||
66 | * When using the pipelined mode, it would be best to disable any type of | ||
67 | * buffering done by the user program, as ide-tape already provides all the | ||
68 | * benefits in the kernel, where it can be done in a more efficient way. | ||
69 | * As we will usually not block the user program on a request, the most | ||
70 | * efficient user code will then be a simple read-write-read-... cycle. | ||
71 | * Any additional logic will usually just slow down the backup process. | ||
72 | * | ||
73 | * Using the pipelined mode, I get a constant over 400 KBps throughput, | ||
74 | * which seems to be the maximum throughput supported by my tape. | ||
75 | * | ||
76 | * However, there are some downfalls: | ||
77 | * | ||
78 | * 1. We use memory (for data buffers) in proportional to the number | ||
79 | * of pipeline stages (each stage is about 26 KB with my tape). | ||
80 | * 2. In the pipelined write mode, we cheat and postpone error codes | ||
81 | * to the user task. In read mode, the actual tape position | ||
82 | * will be a bit further than the last requested block. | ||
83 | * | ||
84 | * Concerning (1): | ||
85 | * | ||
86 | * 1. We allocate stages dynamically only when we need them. When | ||
87 | * we don't need them, we don't consume additional memory. In | ||
88 | * case we can't allocate stages, we just manage without them | ||
89 | * (at the expense of decreased throughput) so when Linux is | ||
90 | * tight in memory, we will not pose additional difficulties. | ||
91 | * | ||
92 | * 2. The maximum number of stages (which is, in fact, the maximum | ||
93 | * amount of memory) which we allocate is limited by the compile | ||
94 | * time parameter IDETAPE_MAX_PIPELINE_STAGES. | ||
95 | * | ||
96 | * 3. The maximum number of stages is a controlled parameter - We | ||
97 | * don't start from the user defined maximum number of stages | ||
98 | * but from the lower IDETAPE_MIN_PIPELINE_STAGES (again, we | ||
99 | * will not even allocate this amount of stages if the user | ||
100 | * program can't handle the speed). We then implement a feedback | ||
101 | * loop which checks if the pipeline is empty, and if it is, we | ||
102 | * increase the maximum number of stages as necessary until we | ||
103 | * reach the optimum value which just manages to keep the tape | ||
104 | * busy with minimum allocated memory or until we reach | ||
105 | * IDETAPE_MAX_PIPELINE_STAGES. | ||
106 | * | ||
107 | * Concerning (2): | ||
108 | * | ||
109 | * In pipelined write mode, ide-tape can not return accurate error codes | ||
110 | * to the user program since we usually just add the request to the | ||
111 | * pipeline without waiting for it to be serviced. In case an error | ||
112 | * occurs, I will report it on the next user request. | ||
113 | * | ||
114 | * In the pipelined read mode, subsequent read requests or forward | ||
115 | * filemark spacing will perform correctly, as we preserve all blocks | ||
116 | * and filemarks which we encountered during our excess read-ahead. | ||
117 | * | ||
118 | * For accurate tape positioning and error reporting, disabling | ||
119 | * pipelined mode might be the best option. | ||
120 | * | ||
121 | * You can enable/disable/tune the pipelined operation mode by adjusting | ||
122 | * the compile time parameters below. | ||
123 | * | ||
124 | * | ||
125 | * Possible improvements. | ||
126 | * | ||
127 | * 1. Support for the ATAPI overlap protocol. | ||
128 | * | ||
129 | * In order to maximize bus throughput, we currently use the DSC | ||
130 | * overlap method which enables ide.c to service requests from the | ||
131 | * other device while the tape is busy executing a command. The | ||
132 | * DSC overlap method involves polling the tape's status register | ||
133 | * for the DSC bit, and servicing the other device while the tape | ||
134 | * isn't ready. | ||
135 | * | ||
136 | * In the current QIC development standard (December 1995), | ||
137 | * it is recommended that new tape drives will *in addition* | ||
138 | * implement the ATAPI overlap protocol, which is used for the | ||
139 | * same purpose - efficient use of the IDE bus, but is interrupt | ||
140 | * driven and thus has much less CPU overhead. | ||
141 | * | ||
142 | * ATAPI overlap is likely to be supported in most new ATAPI | ||
143 | * devices, including new ATAPI cdroms, and thus provides us | ||
144 | * a method by which we can achieve higher throughput when | ||
145 | * sharing a (fast) ATA-2 disk with any (slow) new ATAPI device. | ||
146 | */ | ||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 92c40d174355..cf3868956f1e 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -168,6 +168,11 @@ and is between 256 and 4096 characters. It is defined in the file | |||
168 | acpi_irq_isa= [HW,ACPI] If irq_balance, mark listed IRQs used by ISA | 168 | acpi_irq_isa= [HW,ACPI] If irq_balance, mark listed IRQs used by ISA |
169 | Format: <irq>,<irq>... | 169 | Format: <irq>,<irq>... |
170 | 170 | ||
171 | acpi_new_pts_ordering [HW,ACPI] | ||
172 | Enforce the ACPI 2.0 ordering of the _PTS control | ||
173 | method wrt putting devices into low power states | ||
174 | default: pre ACPI 2.0 ordering of _PTS | ||
175 | |||
171 | acpi_no_auto_ssdt [HW,ACPI] Disable automatic loading of SSDT | 176 | acpi_no_auto_ssdt [HW,ACPI] Disable automatic loading of SSDT |
172 | 177 | ||
173 | acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS | 178 | acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS |
diff --git a/Documentation/pci.txt b/Documentation/pci.txt index 7754f5aea4e9..72b20c639596 100644 --- a/Documentation/pci.txt +++ b/Documentation/pci.txt | |||
@@ -274,8 +274,6 @@ the PCI device by calling pci_enable_device(). This will: | |||
274 | o allocate an IRQ (if BIOS did not). | 274 | o allocate an IRQ (if BIOS did not). |
275 | 275 | ||
276 | NOTE: pci_enable_device() can fail! Check the return value. | 276 | NOTE: pci_enable_device() can fail! Check the return value. |
277 | NOTE2: Also see pci_enable_device_bars() below. Drivers can | ||
278 | attempt to enable only a subset of BARs they need. | ||
279 | 277 | ||
280 | [ OS BUG: we don't check resource allocations before enabling those | 278 | [ OS BUG: we don't check resource allocations before enabling those |
281 | resources. The sequence would make more sense if we called | 279 | resources. The sequence would make more sense if we called |
@@ -605,40 +603,7 @@ device lists. This is still possible but discouraged. | |||
605 | 603 | ||
606 | 604 | ||
607 | 605 | ||
608 | 10. pci_enable_device_bars() and Legacy I/O Port space | 606 | 10. MMIO Space and "Write Posting" |
609 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
610 | |||
611 | Large servers may not be able to provide I/O port resources to all PCI | ||
612 | devices. I/O Port space is only 64KB on Intel Architecture[1] and is | ||
613 | likely also fragmented since the I/O base register of PCI-to-PCI | ||
614 | bridge will usually be aligned to a 4KB boundary[2]. On such systems, | ||
615 | pci_enable_device() and pci_request_region() will fail when | ||
616 | attempting to enable I/O Port regions that don't have I/O Port | ||
617 | resources assigned. | ||
618 | |||
619 | Fortunately, many PCI devices which request I/O Port resources also | ||
620 | provide access to the same registers via MMIO BARs. These devices can | ||
621 | be handled without using I/O port space and the drivers typically | ||
622 | offer a CONFIG_ option to only use MMIO regions | ||
623 | (e.g. CONFIG_TULIP_MMIO). PCI devices typically provide I/O port | ||
624 | interface for legacy OSes and will work when I/O port resources are not | ||
625 | assigned. The "PCI Local Bus Specification Revision 3.0" discusses | ||
626 | this on p.44, "IMPLEMENTATION NOTE". | ||
627 | |||
628 | If your PCI device driver doesn't need I/O port resources assigned to | ||
629 | I/O Port BARs, you should use pci_enable_device_bars() instead of | ||
630 | pci_enable_device() in order not to enable I/O port regions for the | ||
631 | corresponding devices. In addition, you should use | ||
632 | pci_request_selected_regions() and pci_release_selected_regions() | ||
633 | instead of pci_request_regions()/pci_release_regions() in order not to | ||
634 | request/release I/O port regions for the corresponding devices. | ||
635 | |||
636 | [1] Some systems support 64KB I/O port space per PCI segment. | ||
637 | [2] Some PCI-to-PCI bridges support optional 1KB aligned I/O base. | ||
638 | |||
639 | |||
640 | |||
641 | 11. MMIO Space and "Write Posting" | ||
642 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 607 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
643 | 608 | ||
644 | Converting a driver from using I/O Port space to using MMIO space | 609 | Converting a driver from using I/O Port space to using MMIO space |
diff --git a/Documentation/power/basic-pm-debugging.txt b/Documentation/power/basic-pm-debugging.txt index 57aef2f6e0de..1555001bc733 100644 --- a/Documentation/power/basic-pm-debugging.txt +++ b/Documentation/power/basic-pm-debugging.txt | |||
@@ -1,45 +1,111 @@ | |||
1 | Debugging suspend and resume | 1 | Debugging hibernation and suspend |
2 | (C) 2007 Rafael J. Wysocki <rjw@sisk.pl>, GPL | 2 | (C) 2007 Rafael J. Wysocki <rjw@sisk.pl>, GPL |
3 | 3 | ||
4 | 1. Testing suspend to disk (STD) | 4 | 1. Testing hibernation (aka suspend to disk or STD) |
5 | 5 | ||
6 | To verify that the STD works, you can try to suspend in the "reboot" mode: | 6 | To check if hibernation works, you can try to hibernate in the "reboot" mode: |
7 | 7 | ||
8 | # echo reboot > /sys/power/disk | 8 | # echo reboot > /sys/power/disk |
9 | # echo disk > /sys/power/state | 9 | # echo disk > /sys/power/state |
10 | 10 | ||
11 | and the system should suspend, reboot, resume and get back to the command prompt | 11 | and the system should create a hibernation image, reboot, resume and get back to |
12 | where you have started the transition. If that happens, the STD is most likely | 12 | the command prompt where you have started the transition. If that happens, |
13 | to work correctly, but you need to repeat the test at least a couple of times in | 13 | hibernation is most likely to work correctly. Still, you need to repeat the |
14 | a row for confidence. This is necessary, because some problems only show up on | 14 | test at least a couple of times in a row for confidence. [This is necessary, |
15 | a second attempt at suspending and resuming the system. You should also test | 15 | because some problems only show up on a second attempt at suspending and |
16 | the "platform" and "shutdown" modes of suspend: | 16 | resuming the system.] Moreover, hibernating in the "reboot" and "shutdown" |
17 | modes causes the PM core to skip some platform-related callbacks which on ACPI | ||
18 | systems might be necessary to make hibernation work. Thus, if you machine fails | ||
19 | to hibernate or resume in the "reboot" mode, you should try the "platform" mode: | ||
17 | 20 | ||
18 | # echo platform > /sys/power/disk | 21 | # echo platform > /sys/power/disk |
19 | # echo disk > /sys/power/state | 22 | # echo disk > /sys/power/state |
20 | 23 | ||
21 | or | 24 | which is the default and recommended mode of hibernation. |
25 | |||
26 | Unfortunately, the "platform" mode of hibernation does not work on some systems | ||
27 | with broken BIOSes. In such cases the "shutdown" mode of hibernation might | ||
28 | work: | ||
22 | 29 | ||
23 | # echo shutdown > /sys/power/disk | 30 | # echo shutdown > /sys/power/disk |
24 | # echo disk > /sys/power/state | 31 | # echo disk > /sys/power/state |
25 | 32 | ||
26 | in which cases you will have to press the power button to make the system | 33 | (it is similar to the "reboot" mode, but it requires you to press the power |
27 | resume. If that does not work, you will need to identify what goes wrong. | 34 | button to make the system resume). |
35 | |||
36 | If neither "platform" nor "shutdown" hibernation mode works, you will need to | ||
37 | identify what goes wrong. | ||
38 | |||
39 | a) Test modes of hibernation | ||
40 | |||
41 | To find out why hibernation fails on your system, you can use a special testing | ||
42 | facility available if the kernel is compiled with CONFIG_PM_DEBUG set. Then, | ||
43 | there is the file /sys/power/pm_test that can be used to make the hibernation | ||
44 | core run in a test mode. There are 5 test modes available: | ||
45 | |||
46 | freezer | ||
47 | - test the freezing of processes | ||
48 | |||
49 | devices | ||
50 | - test the freezing of processes and suspending of devices | ||
28 | 51 | ||
29 | a) Test mode of STD | 52 | platform |
53 | - test the freezing of processes, suspending of devices and platform | ||
54 | global control methods(*) | ||
30 | 55 | ||
31 | To verify if there are any drivers that cause problems you can run the STD | 56 | processors |
32 | in the test mode: | 57 | - test the freezing of processes, suspending of devices, platform |
58 | global control methods(*) and the disabling of nonboot CPUs | ||
33 | 59 | ||
34 | # echo test > /sys/power/disk | 60 | core |
61 | - test the freezing of processes, suspending of devices, platform global | ||
62 | control methods(*), the disabling of nonboot CPUs and suspending of | ||
63 | platform/system devices | ||
64 | |||
65 | (*) the platform global control methods are only available on ACPI systems | ||
66 | and are only tested if the hibernation mode is set to "platform" | ||
67 | |||
68 | To use one of them it is necessary to write the corresponding string to | ||
69 | /sys/power/pm_test (eg. "devices" to test the freezing of processes and | ||
70 | suspending devices) and issue the standard hibernation commands. For example, | ||
71 | to use the "devices" test mode along with the "platform" mode of hibernation, | ||
72 | you should do the following: | ||
73 | |||
74 | # echo devices > /sys/power/pm_test | ||
75 | # echo platform > /sys/power/disk | ||
35 | # echo disk > /sys/power/state | 76 | # echo disk > /sys/power/state |
36 | 77 | ||
37 | in which case the system should freeze tasks, suspend devices, disable nonboot | 78 | Then, the kernel will try to freeze processes, suspend devices, wait 5 seconds, |
38 | CPUs (if any), wait for 5 seconds, enable nonboot CPUs, resume devices, thaw | 79 | resume devices and thaw processes. If "platform" is written to |
39 | tasks and return to your command prompt. If that fails, most likely there is | 80 | /sys/power/pm_test , then after suspending devices the kernel will additionally |
40 | a driver that fails to either suspend or resume (in the latter case the system | 81 | invoke the global control methods (eg. ACPI global control methods) used to |
41 | may hang or be unstable after the test, so please take that into consideration). | 82 | prepare the platform firmware for hibernation. Next, it will wait 5 seconds and |
42 | To find this driver, you can carry out a binary search according to the rules: | 83 | invoke the platform (eg. ACPI) global methods used to cancel hibernation etc. |
84 | |||
85 | Writing "none" to /sys/power/pm_test causes the kernel to switch to the normal | ||
86 | hibernation/suspend operations. Also, when open for reading, /sys/power/pm_test | ||
87 | contains a space-separated list of all available tests (including "none" that | ||
88 | represents the normal functionality) in which the current test level is | ||
89 | indicated by square brackets. | ||
90 | |||
91 | Generally, as you can see, each test level is more "invasive" than the previous | ||
92 | one and the "core" level tests the hardware and drivers as deeply as possible | ||
93 | without creating a hibernation image. Obviously, if the "devices" test fails, | ||
94 | the "platform" test will fail as well and so on. Thus, as a rule of thumb, you | ||
95 | should try the test modes starting from "freezer", through "devices", "platform" | ||
96 | and "processors" up to "core" (repeat the test on each level a couple of times | ||
97 | to make sure that any random factors are avoided). | ||
98 | |||
99 | If the "freezer" test fails, there is a task that cannot be frozen (in that case | ||
100 | it usually is possible to identify the offending task by analysing the output of | ||
101 | dmesg obtained after the failing test). Failure at this level usually means | ||
102 | that there is a problem with the tasks freezer subsystem that should be | ||
103 | reported. | ||
104 | |||
105 | If the "devices" test fails, most likely there is a driver that cannot suspend | ||
106 | or resume its device (in the latter case the system may hang or become unstable | ||
107 | after the test, so please take that into consideration). To find this driver, | ||
108 | you can carry out a binary search according to the rules: | ||
43 | - if the test fails, unload a half of the drivers currently loaded and repeat | 109 | - if the test fails, unload a half of the drivers currently loaded and repeat |
44 | (that would probably involve rebooting the system, so always note what drivers | 110 | (that would probably involve rebooting the system, so always note what drivers |
45 | have been loaded before the test), | 111 | have been loaded before the test), |
@@ -47,23 +113,46 @@ have been loaded before the test), | |||
47 | recently and repeat. | 113 | recently and repeat. |
48 | 114 | ||
49 | Once you have found the failing driver (there can be more than just one of | 115 | Once you have found the failing driver (there can be more than just one of |
50 | them), you have to unload it every time before the STD transition. In that case | 116 | them), you have to unload it every time before hibernation. In that case please |
51 | please make sure to report the problem with the driver. | 117 | make sure to report the problem with the driver. |
52 | 118 | ||
53 | It is also possible that a cycle can still fail after you have unloaded | 119 | It is also possible that the "devices" test will still fail after you have |
54 | all modules. In that case, you would want to look in your kernel configuration | 120 | unloaded all modules. In that case, you may want to look in your kernel |
55 | for the drivers that can be compiled as modules (testing again with them as | 121 | configuration for the drivers that can be compiled as modules (and test again |
56 | modules), and possibly also try boot time options such as "noapic" or "noacpi". | 122 | with these drivers compiled as modules). You may also try to use some special |
123 | kernel command line options such as "noapic", "noacpi" or even "acpi=off". | ||
124 | |||
125 | If the "platform" test fails, there is a problem with the handling of the | ||
126 | platform (eg. ACPI) firmware on your system. In that case the "platform" mode | ||
127 | of hibernation is not likely to work. You can try the "shutdown" mode, but that | ||
128 | is rather a poor man's workaround. | ||
129 | |||
130 | If the "processors" test fails, the disabling/enabling of nonboot CPUs does not | ||
131 | work (of course, this only may be an issue on SMP systems) and the problem | ||
132 | should be reported. In that case you can also try to switch the nonboot CPUs | ||
133 | off and on using the /sys/devices/system/cpu/cpu*/online sysfs attributes and | ||
134 | see if that works. | ||
135 | |||
136 | If the "core" test fails, which means that suspending of the system/platform | ||
137 | devices has failed (these devices are suspended on one CPU with interrupts off), | ||
138 | the problem is most probably hardware-related and serious, so it should be | ||
139 | reported. | ||
140 | |||
141 | A failure of any of the "platform", "processors" or "core" tests may cause your | ||
142 | system to hang or become unstable, so please beware. Such a failure usually | ||
143 | indicates a serious problem that very well may be related to the hardware, but | ||
144 | please report it anyway. | ||
57 | 145 | ||
58 | b) Testing minimal configuration | 146 | b) Testing minimal configuration |
59 | 147 | ||
60 | If the test mode of STD works, you can boot the system with "init=/bin/bash" | 148 | If all of the hibernation test modes work, you can boot the system with the |
61 | and attempt to suspend in the "reboot", "shutdown" and "platform" modes. If | 149 | "init=/bin/bash" command line parameter and attempt to hibernate in the |
62 | that does not work, there probably is a problem with a driver statically | 150 | "reboot", "shutdown" and "platform" modes. If that does not work, there |
63 | compiled into the kernel and you can try to compile more drivers as modules, | 151 | probably is a problem with a driver statically compiled into the kernel and you |
64 | so that they can be tested individually. Otherwise, there is a problem with a | 152 | can try to compile more drivers as modules, so that they can be tested |
65 | modular driver and you can find it by loading a half of the modules you normally | 153 | individually. Otherwise, there is a problem with a modular driver and you can |
66 | use and binary searching in accordance with the algorithm: | 154 | find it by loading a half of the modules you normally use and binary searching |
155 | in accordance with the algorithm: | ||
67 | - if there are n modules loaded and the attempt to suspend and resume fails, | 156 | - if there are n modules loaded and the attempt to suspend and resume fails, |
68 | unload n/2 of the modules and try again (that would probably involve rebooting | 157 | unload n/2 of the modules and try again (that would probably involve rebooting |
69 | the system), | 158 | the system), |
@@ -71,19 +160,19 @@ the system), | |||
71 | load n/2 modules more and try again. | 160 | load n/2 modules more and try again. |
72 | 161 | ||
73 | Again, if you find the offending module(s), it(they) must be unloaded every time | 162 | Again, if you find the offending module(s), it(they) must be unloaded every time |
74 | before the STD transition, and please report the problem with it(them). | 163 | before hibernation, and please report the problem with it(them). |
75 | 164 | ||
76 | c) Advanced debugging | 165 | c) Advanced debugging |
77 | 166 | ||
78 | In case the STD does not work on your system even in the minimal configuration | 167 | In case that hibernation does not work on your system even in the minimal |
79 | and compiling more drivers as modules is not practical or some modules cannot | 168 | configuration and compiling more drivers as modules is not practical or some |
80 | be unloaded, you can use one of the more advanced debugging techniques to find | 169 | modules cannot be unloaded, you can use one of the more advanced debugging |
81 | the problem. First, if there is a serial port in your box, you can boot the | 170 | techniques to find the problem. First, if there is a serial port in your box, |
82 | kernel with the 'no_console_suspend' parameter and try to log kernel | 171 | you can boot the kernel with the 'no_console_suspend' parameter and try to log |
83 | messages using the serial console. This may provide you with some information | 172 | kernel messages using the serial console. This may provide you with some |
84 | about the reasons of the suspend (resume) failure. Alternatively, it may be | 173 | information about the reasons of the suspend (resume) failure. Alternatively, |
85 | possible to use a FireWire port for debugging with firescope | 174 | it may be possible to use a FireWire port for debugging with firescope |
86 | (ftp://ftp.firstfloor.org/pub/ak/firescope/). On i386 it is also possible to | 175 | (ftp://ftp.firstfloor.org/pub/ak/firescope/). On x86 it is also possible to |
87 | use the PM_TRACE mechanism documented in Documentation/s2ram.txt . | 176 | use the PM_TRACE mechanism documented in Documentation/s2ram.txt . |
88 | 177 | ||
89 | 2. Testing suspend to RAM (STR) | 178 | 2. Testing suspend to RAM (STR) |
@@ -91,16 +180,25 @@ use the PM_TRACE mechanism documented in Documentation/s2ram.txt . | |||
91 | To verify that the STR works, it is generally more convenient to use the s2ram | 180 | To verify that the STR works, it is generally more convenient to use the s2ram |
92 | tool available from http://suspend.sf.net and documented at | 181 | tool available from http://suspend.sf.net and documented at |
93 | http://en.opensuse.org/s2ram . However, before doing that it is recommended to | 182 | http://en.opensuse.org/s2ram . However, before doing that it is recommended to |
94 | carry out the procedure described in section 1. | 183 | carry out STR testing using the facility described in section 1. |
95 | 184 | ||
96 | Assume you have resolved the problems with the STD and you have found some | 185 | Namely, after writing "freezer", "devices", "platform", "processors", or "core" |
97 | failing drivers. These drivers are also likely to fail during the STR or | 186 | into /sys/power/pm_test (available if the kernel is compiled with |
98 | during the resume, so it is better to unload them every time before the STR | 187 | CONFIG_PM_DEBUG set) the suspend code will work in the test mode corresponding |
99 | transition. Now, you can follow the instructions at | 188 | to given string. The STR test modes are defined in the same way as for |
100 | http://en.opensuse.org/s2ram to test the system, but if it does not work | 189 | hibernation, so please refer to Section 1 for more information about them. In |
101 | "out of the box", you may need to boot it with "init=/bin/bash" and test | 190 | particular, the "core" test allows you to test everything except for the actual |
102 | s2ram in the minimal configuration. In that case, you may be able to search | 191 | invocation of the platform firmware in order to put the system into the sleep |
103 | for failing drivers by following the procedure analogous to the one described in | 192 | state. |
104 | 1b). If you find some failing drivers, you will have to unload them every time | 193 | |
105 | before the STR transition (ie. before you run s2ram), and please report the | 194 | Among other things, the testing with the help of /sys/power/pm_test may allow |
106 | problems with them. | 195 | you to identify drivers that fail to suspend or resume their devices. They |
196 | should be unloaded every time before an STR transition. | ||
197 | |||
198 | Next, you can follow the instructions at http://en.opensuse.org/s2ram to test | ||
199 | the system, but if it does not work "out of the box", you may need to boot it | ||
200 | with "init=/bin/bash" and test s2ram in the minimal configuration. In that | ||
201 | case, you may be able to search for failing drivers by following the procedure | ||
202 | analogous to the one described in section 1. If you find some failing drivers, | ||
203 | you will have to unload them every time before an STR transition (ie. before | ||
204 | you run s2ram), and please report the problems with them. | ||
diff --git a/Documentation/power/devices.txt b/Documentation/power/devices.txt index d0e79d5820a5..c53d26361919 100644 --- a/Documentation/power/devices.txt +++ b/Documentation/power/devices.txt | |||
@@ -502,52 +502,3 @@ If the CPU can have a "cpufreq" driver, there also may be opportunities | |||
502 | to shift to lower voltage settings and reduce the power cost of executing | 502 | to shift to lower voltage settings and reduce the power cost of executing |
503 | a given number of instructions. (Without voltage adjustment, it's rare | 503 | a given number of instructions. (Without voltage adjustment, it's rare |
504 | for cpufreq to save much power; the cost-per-instruction must go down.) | 504 | for cpufreq to save much power; the cost-per-instruction must go down.) |
505 | |||
506 | |||
507 | /sys/devices/.../power/state files | ||
508 | ================================== | ||
509 | For now you can also test some of this functionality using sysfs. | ||
510 | |||
511 | DEPRECATED: USE "power/state" ONLY FOR DRIVER TESTING, AND | ||
512 | AVOID USING dev->power.power_state IN DRIVERS. | ||
513 | |||
514 | THESE WILL BE REMOVED. IF THE "power/state" FILE GETS REPLACED, | ||
515 | IT WILL BECOME SOMETHING COUPLED TO THE BUS OR DRIVER. | ||
516 | |||
517 | In each device's directory, there is a 'power' directory, which contains | ||
518 | at least a 'state' file. The value of this field is effectively boolean, | ||
519 | PM_EVENT_ON or PM_EVENT_SUSPEND. | ||
520 | |||
521 | * Reading from this file displays a value corresponding to | ||
522 | the power.power_state.event field. All nonzero values are | ||
523 | displayed as "2", corresponding to a low power state; zero | ||
524 | is displayed as "0", corresponding to normal operation. | ||
525 | |||
526 | * Writing to this file initiates a transition using the | ||
527 | specified event code number; only '0', '2', and '3' are | ||
528 | accepted (without a newline); '2' and '3' are both | ||
529 | mapped to PM_EVENT_SUSPEND. | ||
530 | |||
531 | On writes, the PM core relies on that recorded event code and the device/bus | ||
532 | capabilities to determine whether it uses a partial suspend() or resume() | ||
533 | sequence to change things so that the recorded event corresponds to the | ||
534 | numeric parameter. | ||
535 | |||
536 | - If the bus requires the irqs-disabled suspend_late()/resume_early() | ||
537 | phases, writes fail because those operations are not supported here. | ||
538 | |||
539 | - If the recorded value is the expected value, nothing is done. | ||
540 | |||
541 | - If the recorded value is nonzero, the device is partially resumed, | ||
542 | using the bus.resume() and/or class.resume() methods. | ||
543 | |||
544 | - If the target value is nonzero, the device is partially suspended, | ||
545 | using the class.suspend() and/or bus.suspend() methods and the | ||
546 | PM_EVENT_SUSPEND message. | ||
547 | |||
548 | Drivers have no way to tell whether their suspend() and resume() calls | ||
549 | have come through the sysfs power/state file or as part of entering a | ||
550 | system sleep state, except that when accessed through sysfs the normal | ||
551 | parent/child sequencing rules are ignored. Drivers (such as bus, bridge, | ||
552 | or hub drivers) which expose child devices may need to enforce those rules | ||
553 | on their own. | ||
diff --git a/Documentation/power/drivers-testing.txt b/Documentation/power/drivers-testing.txt index e4bdcaee24e4..7f7a737f7f9f 100644 --- a/Documentation/power/drivers-testing.txt +++ b/Documentation/power/drivers-testing.txt | |||
@@ -6,9 +6,9 @@ Testing suspend and resume support in device drivers | |||
6 | Unfortunately, to effectively test the support for the system-wide suspend and | 6 | Unfortunately, to effectively test the support for the system-wide suspend and |
7 | resume transitions in a driver, it is necessary to suspend and resume a fully | 7 | resume transitions in a driver, it is necessary to suspend and resume a fully |
8 | functional system with this driver loaded. Moreover, that should be done | 8 | functional system with this driver loaded. Moreover, that should be done |
9 | several times, preferably several times in a row, and separately for the suspend | 9 | several times, preferably several times in a row, and separately for hibernation |
10 | to disk (STD) and the suspend to RAM (STR) transitions, because each of these | 10 | (aka suspend to disk or STD) and suspend to RAM (STR), because each of these |
11 | cases involves different ordering of operations and different interactions with | 11 | cases involves slightly different operations and different interactions with |
12 | the machine's BIOS. | 12 | the machine's BIOS. |
13 | 13 | ||
14 | Of course, for this purpose the test system has to be known to suspend and | 14 | Of course, for this purpose the test system has to be known to suspend and |
@@ -22,20 +22,24 @@ for more information about the debugging of suspend/resume functionality. | |||
22 | Once you have resolved the suspend/resume-related problems with your test system | 22 | Once you have resolved the suspend/resume-related problems with your test system |
23 | without the new driver, you are ready to test it: | 23 | without the new driver, you are ready to test it: |
24 | 24 | ||
25 | a) Build the driver as a module, load it and try the STD in the test mode (see: | 25 | a) Build the driver as a module, load it and try the test modes of hibernation |
26 | Documents/power/basic-pm-debugging.txt, 1a)). | 26 | (see: Documents/power/basic-pm-debugging.txt, 1). |
27 | 27 | ||
28 | b) Load the driver and attempt to suspend to disk in the "reboot", "shutdown" | 28 | b) Load the driver and attempt to hibernate in the "reboot", "shutdown" and |
29 | and "platform" modes (see: Documents/power/basic-pm-debugging.txt, 1). | 29 | "platform" modes (see: Documents/power/basic-pm-debugging.txt, 1). |
30 | 30 | ||
31 | c) Compile the driver directly into the kernel and try the STD in the test mode. | 31 | c) Compile the driver directly into the kernel and try the test modes of |
32 | hibernation. | ||
32 | 33 | ||
33 | d) Attempt to suspend to disk with the driver compiled directly into the kernel | 34 | d) Attempt to hibernate with the driver compiled directly into the kernel |
34 | in the "reboot", "shutdown" and "platform" modes. | 35 | in the "reboot", "shutdown" and "platform" modes. |
35 | 36 | ||
36 | e) Attempt to suspend to RAM using the s2ram tool with the driver loaded (see: | 37 | e) Try the test modes of suspend (see: Documents/power/basic-pm-debugging.txt, |
37 | Documents/power/basic-pm-debugging.txt, 2). As far as the STR tests are | 38 | 2). [As far as the STR tests are concerned, it should not matter whether or |
38 | concerned, it should not matter whether or not the driver is built as a module. | 39 | not the driver is built as a module.] |
40 | |||
41 | f) Attempt to suspend to RAM using the s2ram tool with the driver loaded | ||
42 | (see: Documents/power/basic-pm-debugging.txt, 2). | ||
39 | 43 | ||
40 | Each of the above tests should be repeated several times and the STD tests | 44 | Each of the above tests should be repeated several times and the STD tests |
41 | should be mixed with the STR tests. If any of them fails, the driver cannot be | 45 | should be mixed with the STR tests. If any of them fails, the driver cannot be |
diff --git a/Documentation/power/notifiers.txt b/Documentation/power/notifiers.txt index 9293e4bc857c..ae1b7ec07684 100644 --- a/Documentation/power/notifiers.txt +++ b/Documentation/power/notifiers.txt | |||
@@ -28,6 +28,14 @@ PM_POST_HIBERNATION The system memory state has been restored from a | |||
28 | hibernation. Device drivers' .resume() callbacks have | 28 | hibernation. Device drivers' .resume() callbacks have |
29 | been executed and tasks have been thawed. | 29 | been executed and tasks have been thawed. |
30 | 30 | ||
31 | PM_RESTORE_PREPARE The system is going to restore a hibernation image. | ||
32 | If all goes well the restored kernel will issue a | ||
33 | PM_POST_HIBERNATION notification. | ||
34 | |||
35 | PM_POST_RESTORE An error occurred during the hibernation restore. | ||
36 | Device drivers' .resume() callbacks have been executed | ||
37 | and tasks have been thawed. | ||
38 | |||
31 | PM_SUSPEND_PREPARE The system is preparing for a suspend. | 39 | PM_SUSPEND_PREPARE The system is preparing for a suspend. |
32 | 40 | ||
33 | PM_POST_SUSPEND The system has just resumed or an error occured during | 41 | PM_POST_SUSPEND The system has just resumed or an error occured during |
diff --git a/Documentation/power/userland-swsusp.txt b/Documentation/power/userland-swsusp.txt index e00c6cf09e85..7b99636564c8 100644 --- a/Documentation/power/userland-swsusp.txt +++ b/Documentation/power/userland-swsusp.txt | |||
@@ -14,7 +14,7 @@ are going to develop your own suspend/resume utilities. | |||
14 | 14 | ||
15 | The interface consists of a character device providing the open(), | 15 | The interface consists of a character device providing the open(), |
16 | release(), read(), and write() operations as well as several ioctl() | 16 | release(), read(), and write() operations as well as several ioctl() |
17 | commands defined in kernel/power/power.h. The major and minor | 17 | commands defined in include/linux/suspend_ioctls.h . The major and minor |
18 | numbers of the device are, respectively, 10 and 231, and they can | 18 | numbers of the device are, respectively, 10 and 231, and they can |
19 | be read from /sys/class/misc/snapshot/dev. | 19 | be read from /sys/class/misc/snapshot/dev. |
20 | 20 | ||
@@ -27,17 +27,17 @@ once at a time. | |||
27 | The ioctl() commands recognized by the device are: | 27 | The ioctl() commands recognized by the device are: |
28 | 28 | ||
29 | SNAPSHOT_FREEZE - freeze user space processes (the current process is | 29 | SNAPSHOT_FREEZE - freeze user space processes (the current process is |
30 | not frozen); this is required for SNAPSHOT_ATOMIC_SNAPSHOT | 30 | not frozen); this is required for SNAPSHOT_CREATE_IMAGE |
31 | and SNAPSHOT_ATOMIC_RESTORE to succeed | 31 | and SNAPSHOT_ATOMIC_RESTORE to succeed |
32 | 32 | ||
33 | SNAPSHOT_UNFREEZE - thaw user space processes frozen by SNAPSHOT_FREEZE | 33 | SNAPSHOT_UNFREEZE - thaw user space processes frozen by SNAPSHOT_FREEZE |
34 | 34 | ||
35 | SNAPSHOT_ATOMIC_SNAPSHOT - create a snapshot of the system memory; the | 35 | SNAPSHOT_CREATE_IMAGE - create a snapshot of the system memory; the |
36 | last argument of ioctl() should be a pointer to an int variable, | 36 | last argument of ioctl() should be a pointer to an int variable, |
37 | the value of which will indicate whether the call returned after | 37 | the value of which will indicate whether the call returned after |
38 | creating the snapshot (1) or after restoring the system memory state | 38 | creating the snapshot (1) or after restoring the system memory state |
39 | from it (0) (after resume the system finds itself finishing the | 39 | from it (0) (after resume the system finds itself finishing the |
40 | SNAPSHOT_ATOMIC_SNAPSHOT ioctl() again); after the snapshot | 40 | SNAPSHOT_CREATE_IMAGE ioctl() again); after the snapshot |
41 | has been created the read() operation can be used to transfer | 41 | has been created the read() operation can be used to transfer |
42 | it out of the kernel | 42 | it out of the kernel |
43 | 43 | ||
@@ -49,39 +49,37 @@ SNAPSHOT_ATOMIC_RESTORE - restore the system memory state from the | |||
49 | 49 | ||
50 | SNAPSHOT_FREE - free memory allocated for the snapshot image | 50 | SNAPSHOT_FREE - free memory allocated for the snapshot image |
51 | 51 | ||
52 | SNAPSHOT_SET_IMAGE_SIZE - set the preferred maximum size of the image | 52 | SNAPSHOT_PREF_IMAGE_SIZE - set the preferred maximum size of the image |
53 | (the kernel will do its best to ensure the image size will not exceed | 53 | (the kernel will do its best to ensure the image size will not exceed |
54 | this number, but if it turns out to be impossible, the kernel will | 54 | this number, but if it turns out to be impossible, the kernel will |
55 | create the smallest image possible) | 55 | create the smallest image possible) |
56 | 56 | ||
57 | SNAPSHOT_AVAIL_SWAP - return the amount of available swap in bytes (the last | 57 | SNAPSHOT_GET_IMAGE_SIZE - return the actual size of the hibernation image |
58 | argument should be a pointer to an unsigned int variable that will | 58 | |
59 | SNAPSHOT_AVAIL_SWAP_SIZE - return the amount of available swap in bytes (the | ||
60 | last argument should be a pointer to an unsigned int variable that will | ||
59 | contain the result if the call is successful). | 61 | contain the result if the call is successful). |
60 | 62 | ||
61 | SNAPSHOT_GET_SWAP_PAGE - allocate a swap page from the resume partition | 63 | SNAPSHOT_ALLOC_SWAP_PAGE - allocate a swap page from the resume partition |
62 | (the last argument should be a pointer to a loff_t variable that | 64 | (the last argument should be a pointer to a loff_t variable that |
63 | will contain the swap page offset if the call is successful) | 65 | will contain the swap page offset if the call is successful) |
64 | 66 | ||
65 | SNAPSHOT_FREE_SWAP_PAGES - free all swap pages allocated with | 67 | SNAPSHOT_FREE_SWAP_PAGES - free all swap pages allocated by |
66 | SNAPSHOT_GET_SWAP_PAGE | 68 | SNAPSHOT_ALLOC_SWAP_PAGE |
67 | |||
68 | SNAPSHOT_SET_SWAP_FILE - set the resume partition (the last ioctl() argument | ||
69 | should specify the device's major and minor numbers in the old | ||
70 | two-byte format, as returned by the stat() function in the .st_rdev | ||
71 | member of the stat structure) | ||
72 | 69 | ||
73 | SNAPSHOT_SET_SWAP_AREA - set the resume partition and the offset (in <PAGE_SIZE> | 70 | SNAPSHOT_SET_SWAP_AREA - set the resume partition and the offset (in <PAGE_SIZE> |
74 | units) from the beginning of the partition at which the swap header is | 71 | units) from the beginning of the partition at which the swap header is |
75 | located (the last ioctl() argument should point to a struct | 72 | located (the last ioctl() argument should point to a struct |
76 | resume_swap_area, as defined in kernel/power/power.h, containing the | 73 | resume_swap_area, as defined in kernel/power/suspend_ioctls.h, |
77 | resume device specification, as for the SNAPSHOT_SET_SWAP_FILE ioctl(), | 74 | containing the resume device specification and the offset); for swap |
78 | and the offset); for swap partitions the offset is always 0, but it is | 75 | partitions the offset is always 0, but it is different from zero for |
79 | different to zero for swap files (please see | 76 | swap files (see Documentation/swsusp-and-swap-files.txt for details). |
80 | Documentation/swsusp-and-swap-files.txt for details). | 77 | |
81 | The SNAPSHOT_SET_SWAP_AREA ioctl() is considered as a replacement for | 78 | SNAPSHOT_PLATFORM_SUPPORT - enable/disable the hibernation platform support, |
82 | SNAPSHOT_SET_SWAP_FILE which is regarded as obsolete. It is | 79 | depending on the argument value (enable, if the argument is nonzero) |
83 | recommended to always use this call, because the code to set the resume | 80 | |
84 | partition may be removed from future kernels | 81 | SNAPSHOT_POWER_OFF - make the kernel transition the system to the hibernation |
82 | state (eg. ACPI S4) using the platform (eg. ACPI) driver | ||
85 | 83 | ||
86 | SNAPSHOT_S2RAM - suspend to RAM; using this call causes the kernel to | 84 | SNAPSHOT_S2RAM - suspend to RAM; using this call causes the kernel to |
87 | immediately enter the suspend-to-RAM state, so this call must always | 85 | immediately enter the suspend-to-RAM state, so this call must always |
@@ -93,24 +91,6 @@ SNAPSHOT_S2RAM - suspend to RAM; using this call causes the kernel to | |||
93 | to resume the system from RAM if there's enough battery power or restore | 91 | to resume the system from RAM if there's enough battery power or restore |
94 | its state on the basis of the saved suspend image otherwise) | 92 | its state on the basis of the saved suspend image otherwise) |
95 | 93 | ||
96 | SNAPSHOT_PMOPS - enable the usage of the hibernation_ops->prepare, | ||
97 | hibernate_ops->enter and hibernation_ops->finish methods (the in-kernel | ||
98 | swsusp knows these as the "platform method") which are needed on many | ||
99 | machines to (among others) speed up the resume by letting the BIOS skip | ||
100 | some steps or to let the system recognise the correct state of the | ||
101 | hardware after the resume (in particular on many machines this ensures | ||
102 | that unplugged AC adapters get correctly detected and that kacpid does | ||
103 | not run wild after the resume). The last ioctl() argument can take one | ||
104 | of the three values, defined in kernel/power/power.h: | ||
105 | PMOPS_PREPARE - make the kernel carry out the | ||
106 | hibernation_ops->prepare() operation | ||
107 | PMOPS_ENTER - make the kernel power off the system by calling | ||
108 | hibernation_ops->enter() | ||
109 | PMOPS_FINISH - make the kernel carry out the | ||
110 | hibernation_ops->finish() operation | ||
111 | Note that the actual constants are misnamed because they surface | ||
112 | internal kernel implementation details that have changed. | ||
113 | |||
114 | The device's read() operation can be used to transfer the snapshot image from | 94 | The device's read() operation can be used to transfer the snapshot image from |
115 | the kernel. It has the following limitations: | 95 | the kernel. It has the following limitations: |
116 | - you cannot read() more than one virtual memory page at a time | 96 | - you cannot read() more than one virtual memory page at a time |
@@ -122,7 +102,7 @@ The device's write() operation is used for uploading the system memory snapshot | |||
122 | into the kernel. It has the same limitations as the read() operation. | 102 | into the kernel. It has the same limitations as the read() operation. |
123 | 103 | ||
124 | The release() operation frees all memory allocated for the snapshot image | 104 | The release() operation frees all memory allocated for the snapshot image |
125 | and all swap pages allocated with SNAPSHOT_GET_SWAP_PAGE (if any). | 105 | and all swap pages allocated with SNAPSHOT_ALLOC_SWAP_PAGE (if any). |
126 | Thus it is not necessary to use either SNAPSHOT_FREE or | 106 | Thus it is not necessary to use either SNAPSHOT_FREE or |
127 | SNAPSHOT_FREE_SWAP_PAGES before closing the device (in fact it will also | 107 | SNAPSHOT_FREE_SWAP_PAGES before closing the device (in fact it will also |
128 | unfreeze user space processes frozen by SNAPSHOT_UNFREEZE if they are | 108 | unfreeze user space processes frozen by SNAPSHOT_UNFREEZE if they are |
@@ -133,16 +113,12 @@ snapshot image from/to the kernel will use a swap parition, called the resume | |||
133 | partition, or a swap file as storage space (if a swap file is used, the resume | 113 | partition, or a swap file as storage space (if a swap file is used, the resume |
134 | partition is the partition that holds this file). However, this is not really | 114 | partition is the partition that holds this file). However, this is not really |
135 | required, as they can use, for example, a special (blank) suspend partition or | 115 | required, as they can use, for example, a special (blank) suspend partition or |
136 | a file on a partition that is unmounted before SNAPSHOT_ATOMIC_SNAPSHOT and | 116 | a file on a partition that is unmounted before SNAPSHOT_CREATE_IMAGE and |
137 | mounted afterwards. | 117 | mounted afterwards. |
138 | 118 | ||
139 | These utilities SHOULD NOT make any assumptions regarding the ordering of | 119 | These utilities MUST NOT make any assumptions regarding the ordering of |
140 | data within the snapshot image, except for the image header that MAY be | 120 | data within the snapshot image. The contents of the image are entirely owned |
141 | assumed to start with an swsusp_info structure, as specified in | 121 | by the kernel and its structure may be changed in future kernel releases. |
142 | kernel/power/power.h. This structure MAY be used by the userland utilities | ||
143 | to obtain some information about the snapshot image, such as the size | ||
144 | of the snapshot image, including the metadata and the header itself, | ||
145 | contained in the .size member of swsusp_info. | ||
146 | 122 | ||
147 | The snapshot image MUST be written to the kernel unaltered (ie. all of the image | 123 | The snapshot image MUST be written to the kernel unaltered (ie. all of the image |
148 | data, metadata and header MUST be written in _exactly_ the same amount, form | 124 | data, metadata and header MUST be written in _exactly_ the same amount, form |
@@ -159,7 +135,7 @@ means, such as checksums, to ensure the integrity of the snapshot image. | |||
159 | The suspending and resuming utilities MUST lock themselves in memory, | 135 | The suspending and resuming utilities MUST lock themselves in memory, |
160 | preferrably using mlockall(), before calling SNAPSHOT_FREEZE. | 136 | preferrably using mlockall(), before calling SNAPSHOT_FREEZE. |
161 | 137 | ||
162 | The suspending utility MUST check the value stored by SNAPSHOT_ATOMIC_SNAPSHOT | 138 | The suspending utility MUST check the value stored by SNAPSHOT_CREATE_IMAGE |
163 | in the memory location pointed to by the last argument of ioctl() and proceed | 139 | in the memory location pointed to by the last argument of ioctl() and proceed |
164 | in accordance with it: | 140 | in accordance with it: |
165 | 1. If the value is 1 (ie. the system memory snapshot has just been | 141 | 1. If the value is 1 (ie. the system memory snapshot has just been |
@@ -173,7 +149,7 @@ in accordance with it: | |||
173 | image has been saved. | 149 | image has been saved. |
174 | (b) The suspending utility SHOULD NOT attempt to perform any | 150 | (b) The suspending utility SHOULD NOT attempt to perform any |
175 | file system operations (including reads) on the file systems | 151 | file system operations (including reads) on the file systems |
176 | that were mounted before SNAPSHOT_ATOMIC_SNAPSHOT has been | 152 | that were mounted before SNAPSHOT_CREATE_IMAGE has been |
177 | called. However, it MAY mount a file system that was not | 153 | called. However, it MAY mount a file system that was not |
178 | mounted at that time and perform some operations on it (eg. | 154 | mounted at that time and perform some operations on it (eg. |
179 | use it for saving the image). | 155 | use it for saving the image). |
diff --git a/Documentation/power_supply_class.txt b/Documentation/power_supply_class.txt index 9758cf433c06..a8686e5a6857 100644 --- a/Documentation/power_supply_class.txt +++ b/Documentation/power_supply_class.txt | |||
@@ -87,6 +87,10 @@ batteries use voltage for very approximated calculation of capacity. | |||
87 | Battery driver also can use this attribute just to inform userspace | 87 | Battery driver also can use this attribute just to inform userspace |
88 | about maximal and minimal voltage thresholds of a given battery. | 88 | about maximal and minimal voltage thresholds of a given battery. |
89 | 89 | ||
90 | VOLTAGE_MAX, VOLTAGE_MIN - same as _DESIGN voltage values except that | ||
91 | these ones should be used if hardware could only guess (measure and | ||
92 | retain) the thresholds of a given power supply. | ||
93 | |||
90 | CHARGE_FULL_DESIGN, CHARGE_EMPTY_DESIGN - design charge values, when | 94 | CHARGE_FULL_DESIGN, CHARGE_EMPTY_DESIGN - design charge values, when |
91 | battery considered full/empty. | 95 | battery considered full/empty. |
92 | 96 | ||
@@ -100,8 +104,6 @@ age)". I.e. these attributes represents real thresholds, not design values. | |||
100 | ENERGY_FULL, ENERGY_EMPTY - same as above but for energy. | 104 | ENERGY_FULL, ENERGY_EMPTY - same as above but for energy. |
101 | 105 | ||
102 | CAPACITY - capacity in percents. | 106 | CAPACITY - capacity in percents. |
103 | CAPACITY_LEVEL - capacity level. This corresponds to | ||
104 | POWER_SUPPLY_CAPACITY_LEVEL_*. | ||
105 | 107 | ||
106 | TEMP - temperature of the power supply. | 108 | TEMP - temperature of the power supply. |
107 | TEMP_AMBIENT - ambient temperature. | 109 | TEMP_AMBIENT - ambient temperature. |
diff --git a/Documentation/usb/gadget_printer.txt b/Documentation/usb/gadget_printer.txt new file mode 100644 index 000000000000..ad995bf0db41 --- /dev/null +++ b/Documentation/usb/gadget_printer.txt | |||
@@ -0,0 +1,510 @@ | |||
1 | |||
2 | Linux USB Printer Gadget Driver | ||
3 | 06/04/2007 | ||
4 | |||
5 | Copyright (C) 2007 Craig W. Nadler <craig@nadler.us> | ||
6 | |||
7 | |||
8 | |||
9 | GENERAL | ||
10 | ======= | ||
11 | |||
12 | This driver may be used if you are writing printer firmware using Linux as | ||
13 | the embedded OS. This driver has nothing to do with using a printer with | ||
14 | your Linux host system. | ||
15 | |||
16 | You will need a USB device controller and a Linux driver for it that accepts | ||
17 | a gadget / "device class" driver using the Linux USB Gadget API. After the | ||
18 | USB device controller driver is loaded then load the printer gadget driver. | ||
19 | This will present a printer interface to the USB Host that your USB Device | ||
20 | port is connected to. | ||
21 | |||
22 | This driver is structured for printer firmware that runs in user mode. The | ||
23 | user mode printer firmware will read and write data from the kernel mode | ||
24 | printer gadget driver using a device file. The printer returns a printer status | ||
25 | byte when the USB HOST sends a device request to get the printer status. The | ||
26 | user space firmware can read or write this status byte using a device file | ||
27 | /dev/g_printer . Both blocking and non-blocking read/write calls are supported. | ||
28 | |||
29 | |||
30 | |||
31 | |||
32 | HOWTO USE THIS DRIVER | ||
33 | ===================== | ||
34 | |||
35 | To load the USB device controller driver and the printer gadget driver. The | ||
36 | following example uses the Netchip 2280 USB device controller driver: | ||
37 | |||
38 | modprobe net2280 | ||
39 | modprobe g_printer | ||
40 | |||
41 | |||
42 | The follow command line parameter can be used when loading the printer gadget | ||
43 | (ex: modprobe g_printer idVendor=0x0525 idProduct=0xa4a8 ): | ||
44 | |||
45 | idVendor - This is the Vendor ID used in the device descriptor. The default is | ||
46 | the Netchip vendor id 0x0525. YOU MUST CHANGE TO YOUR OWN VENDOR ID | ||
47 | BEFORE RELEASING A PRODUCT. If you plan to release a product and don't | ||
48 | already have a Vendor ID please see www.usb.org for details on how to | ||
49 | get one. | ||
50 | |||
51 | idProduct - This is the Product ID used in the device descriptor. The default | ||
52 | is 0xa4a8, you should change this to an ID that's not used by any of | ||
53 | your other USB products if you have any. It would be a good idea to | ||
54 | start numbering your products starting with say 0x0001. | ||
55 | |||
56 | bcdDevice - This is the version number of your product. It would be a good idea | ||
57 | to put your firmware version here. | ||
58 | |||
59 | iManufacturer - A string containing the name of the Vendor. | ||
60 | |||
61 | iProduct - A string containing the Product Name. | ||
62 | |||
63 | iSerialNum - A string containing the Serial Number. This should be changed for | ||
64 | each unit of your product. | ||
65 | |||
66 | iPNPstring - The PNP ID string used for this printer. You will want to set | ||
67 | either on the command line or hard code the PNP ID string used for | ||
68 | your printer product. | ||
69 | |||
70 | qlen - The number of 8k buffers to use per endpoint. The default is 10, you | ||
71 | should tune this for your product. You may also want to tune the | ||
72 | size of each buffer for your product. | ||
73 | |||
74 | |||
75 | |||
76 | |||
77 | USING THE EXAMPLE CODE | ||
78 | ====================== | ||
79 | |||
80 | This example code talks to stdout, instead of a print engine. | ||
81 | |||
82 | To compile the test code below: | ||
83 | |||
84 | 1) save it to a file called prn_example.c | ||
85 | 2) compile the code with the follow command: | ||
86 | gcc prn_example.c -o prn_example | ||
87 | |||
88 | |||
89 | |||
90 | To read printer data from the host to stdout: | ||
91 | |||
92 | # prn_example -read_data | ||
93 | |||
94 | |||
95 | To write printer data from a file (data_file) to the host: | ||
96 | |||
97 | # cat data_file | prn_example -write_data | ||
98 | |||
99 | |||
100 | To get the current printer status for the gadget driver: | ||
101 | |||
102 | # prn_example -get_status | ||
103 | |||
104 | Printer status is: | ||
105 | Printer is NOT Selected | ||
106 | Paper is Out | ||
107 | Printer OK | ||
108 | |||
109 | |||
110 | To set printer to Selected/On-line: | ||
111 | |||
112 | # prn_example -selected | ||
113 | |||
114 | |||
115 | To set printer to Not Selected/Off-line: | ||
116 | |||
117 | # prn_example -not_selected | ||
118 | |||
119 | |||
120 | To set paper status to paper out: | ||
121 | |||
122 | # prn_example -paper_out | ||
123 | |||
124 | |||
125 | To set paper status to paper loaded: | ||
126 | |||
127 | # prn_example -paper_loaded | ||
128 | |||
129 | |||
130 | To set error status to printer OK: | ||
131 | |||
132 | # prn_example -no_error | ||
133 | |||
134 | |||
135 | To set error status to ERROR: | ||
136 | |||
137 | # prn_example -error | ||
138 | |||
139 | |||
140 | |||
141 | |||
142 | EXAMPLE CODE | ||
143 | ============ | ||
144 | |||
145 | |||
146 | #include <stdio.h> | ||
147 | #include <stdlib.h> | ||
148 | #include <fcntl.h> | ||
149 | #include <linux/poll.h> | ||
150 | #include <sys/ioctl.h> | ||
151 | #include <linux/usb/g_printer.h> | ||
152 | |||
153 | #define PRINTER_FILE "/dev/g_printer" | ||
154 | #define BUF_SIZE 512 | ||
155 | |||
156 | |||
157 | /* | ||
158 | * 'usage()' - Show program usage. | ||
159 | */ | ||
160 | |||
161 | static void | ||
162 | usage(const char *option) /* I - Option string or NULL */ | ||
163 | { | ||
164 | if (option) { | ||
165 | fprintf(stderr,"prn_example: Unknown option \"%s\"!\n", | ||
166 | option); | ||
167 | } | ||
168 | |||
169 | fputs("\n", stderr); | ||
170 | fputs("Usage: prn_example -[options]\n", stderr); | ||
171 | fputs("Options:\n", stderr); | ||
172 | fputs("\n", stderr); | ||
173 | fputs("-get_status Get the current printer status.\n", stderr); | ||
174 | fputs("-selected Set the selected status to selected.\n", stderr); | ||
175 | fputs("-not_selected Set the selected status to NOT selected.\n", | ||
176 | stderr); | ||
177 | fputs("-error Set the error status to error.\n", stderr); | ||
178 | fputs("-no_error Set the error status to NO error.\n", stderr); | ||
179 | fputs("-paper_out Set the paper status to paper out.\n", stderr); | ||
180 | fputs("-paper_loaded Set the paper status to paper loaded.\n", | ||
181 | stderr); | ||
182 | fputs("-read_data Read printer data from driver.\n", stderr); | ||
183 | fputs("-write_data Write printer sata to driver.\n", stderr); | ||
184 | fputs("-NB_read_data (Non-Blocking) Read printer data from driver.\n", | ||
185 | stderr); | ||
186 | fputs("\n\n", stderr); | ||
187 | |||
188 | exit(1); | ||
189 | } | ||
190 | |||
191 | |||
192 | static int | ||
193 | read_printer_data() | ||
194 | { | ||
195 | struct pollfd fd[1]; | ||
196 | |||
197 | /* Open device file for printer gadget. */ | ||
198 | fd[0].fd = open(PRINTER_FILE, O_RDWR); | ||
199 | if (fd[0].fd < 0) { | ||
200 | printf("Error %d opening %s\n", fd[0].fd, PRINTER_FILE); | ||
201 | close(fd[0].fd); | ||
202 | return(-1); | ||
203 | } | ||
204 | |||
205 | fd[0].events = POLLIN | POLLRDNORM; | ||
206 | |||
207 | while (1) { | ||
208 | static char buf[BUF_SIZE]; | ||
209 | int bytes_read; | ||
210 | int retval; | ||
211 | |||
212 | /* Wait for up to 1 second for data. */ | ||
213 | retval = poll(fd, 1, 1000); | ||
214 | |||
215 | if (retval && (fd[0].revents & POLLRDNORM)) { | ||
216 | |||
217 | /* Read data from printer gadget driver. */ | ||
218 | bytes_read = read(fd[0].fd, buf, BUF_SIZE); | ||
219 | |||
220 | if (bytes_read < 0) { | ||
221 | printf("Error %d reading from %s\n", | ||
222 | fd[0].fd, PRINTER_FILE); | ||
223 | close(fd[0].fd); | ||
224 | return(-1); | ||
225 | } else if (bytes_read > 0) { | ||
226 | /* Write data to standard OUTPUT (stdout). */ | ||
227 | fwrite(buf, 1, bytes_read, stdout); | ||
228 | fflush(stdout); | ||
229 | } | ||
230 | |||
231 | } | ||
232 | |||
233 | } | ||
234 | |||
235 | /* Close the device file. */ | ||
236 | close(fd[0].fd); | ||
237 | |||
238 | return 0; | ||
239 | } | ||
240 | |||
241 | |||
242 | static int | ||
243 | write_printer_data() | ||
244 | { | ||
245 | struct pollfd fd[1]; | ||
246 | |||
247 | /* Open device file for printer gadget. */ | ||
248 | fd[0].fd = open (PRINTER_FILE, O_RDWR); | ||
249 | if (fd[0].fd < 0) { | ||
250 | printf("Error %d opening %s\n", fd[0].fd, PRINTER_FILE); | ||
251 | close(fd[0].fd); | ||
252 | return(-1); | ||
253 | } | ||
254 | |||
255 | fd[0].events = POLLOUT | POLLWRNORM; | ||
256 | |||
257 | while (1) { | ||
258 | int retval; | ||
259 | static char buf[BUF_SIZE]; | ||
260 | /* Read data from standard INPUT (stdin). */ | ||
261 | int bytes_read = fread(buf, 1, BUF_SIZE, stdin); | ||
262 | |||
263 | if (!bytes_read) { | ||
264 | break; | ||
265 | } | ||
266 | |||
267 | while (bytes_read) { | ||
268 | |||
269 | /* Wait for up to 1 second to sent data. */ | ||
270 | retval = poll(fd, 1, 1000); | ||
271 | |||
272 | /* Write data to printer gadget driver. */ | ||
273 | if (retval && (fd[0].revents & POLLWRNORM)) { | ||
274 | retval = write(fd[0].fd, buf, bytes_read); | ||
275 | if (retval < 0) { | ||
276 | printf("Error %d writing to %s\n", | ||
277 | fd[0].fd, | ||
278 | PRINTER_FILE); | ||
279 | close(fd[0].fd); | ||
280 | return(-1); | ||
281 | } else { | ||
282 | bytes_read -= retval; | ||
283 | } | ||
284 | |||
285 | } | ||
286 | |||
287 | } | ||
288 | |||
289 | } | ||
290 | |||
291 | /* Wait until the data has been sent. */ | ||
292 | fsync(fd[0].fd); | ||
293 | |||
294 | /* Close the device file. */ | ||
295 | close(fd[0].fd); | ||
296 | |||
297 | return 0; | ||
298 | } | ||
299 | |||
300 | |||
301 | static int | ||
302 | read_NB_printer_data() | ||
303 | { | ||
304 | int fd; | ||
305 | static char buf[BUF_SIZE]; | ||
306 | int bytes_read; | ||
307 | |||
308 | /* Open device file for printer gadget. */ | ||
309 | fd = open(PRINTER_FILE, O_RDWR|O_NONBLOCK); | ||
310 | if (fd < 0) { | ||
311 | printf("Error %d opening %s\n", fd, PRINTER_FILE); | ||
312 | close(fd); | ||
313 | return(-1); | ||
314 | } | ||
315 | |||
316 | while (1) { | ||
317 | /* Read data from printer gadget driver. */ | ||
318 | bytes_read = read(fd, buf, BUF_SIZE); | ||
319 | if (bytes_read <= 0) { | ||
320 | break; | ||
321 | } | ||
322 | |||
323 | /* Write data to standard OUTPUT (stdout). */ | ||
324 | fwrite(buf, 1, bytes_read, stdout); | ||
325 | fflush(stdout); | ||
326 | } | ||
327 | |||
328 | /* Close the device file. */ | ||
329 | close(fd); | ||
330 | |||
331 | return 0; | ||
332 | } | ||
333 | |||
334 | |||
335 | static int | ||
336 | get_printer_status() | ||
337 | { | ||
338 | int retval; | ||
339 | int fd; | ||
340 | |||
341 | /* Open device file for printer gadget. */ | ||
342 | fd = open(PRINTER_FILE, O_RDWR); | ||
343 | if (fd < 0) { | ||
344 | printf("Error %d opening %s\n", fd, PRINTER_FILE); | ||
345 | close(fd); | ||
346 | return(-1); | ||
347 | } | ||
348 | |||
349 | /* Make the IOCTL call. */ | ||
350 | retval = ioctl(fd, GADGET_GET_PRINTER_STATUS); | ||
351 | if (retval < 0) { | ||
352 | fprintf(stderr, "ERROR: Failed to set printer status\n"); | ||
353 | return(-1); | ||
354 | } | ||
355 | |||
356 | /* Close the device file. */ | ||
357 | close(fd); | ||
358 | |||
359 | return(retval); | ||
360 | } | ||
361 | |||
362 | |||
363 | static int | ||
364 | set_printer_status(unsigned char buf, int clear_printer_status_bit) | ||
365 | { | ||
366 | int retval; | ||
367 | int fd; | ||
368 | |||
369 | retval = get_printer_status(); | ||
370 | if (retval < 0) { | ||
371 | fprintf(stderr, "ERROR: Failed to get printer status\n"); | ||
372 | return(-1); | ||
373 | } | ||
374 | |||
375 | /* Open device file for printer gadget. */ | ||
376 | fd = open(PRINTER_FILE, O_RDWR); | ||
377 | |||
378 | if (fd < 0) { | ||
379 | printf("Error %d opening %s\n", fd, PRINTER_FILE); | ||
380 | close(fd); | ||
381 | return(-1); | ||
382 | } | ||
383 | |||
384 | if (clear_printer_status_bit) { | ||
385 | retval &= ~buf; | ||
386 | } else { | ||
387 | retval |= buf; | ||
388 | } | ||
389 | |||
390 | /* Make the IOCTL call. */ | ||
391 | if (ioctl(fd, GADGET_SET_PRINTER_STATUS, (unsigned char)retval)) { | ||
392 | fprintf(stderr, "ERROR: Failed to set printer status\n"); | ||
393 | return(-1); | ||
394 | } | ||
395 | |||
396 | /* Close the device file. */ | ||
397 | close(fd); | ||
398 | |||
399 | return 0; | ||
400 | } | ||
401 | |||
402 | |||
403 | static int | ||
404 | display_printer_status() | ||
405 | { | ||
406 | char printer_status; | ||
407 | |||
408 | printer_status = get_printer_status(); | ||
409 | if (printer_status < 0) { | ||
410 | fprintf(stderr, "ERROR: Failed to get printer status\n"); | ||
411 | return(-1); | ||
412 | } | ||
413 | |||
414 | printf("Printer status is:\n"); | ||
415 | if (printer_status & PRINTER_SELECTED) { | ||
416 | printf(" Printer is Selected\n"); | ||
417 | } else { | ||
418 | printf(" Printer is NOT Selected\n"); | ||
419 | } | ||
420 | if (printer_status & PRINTER_PAPER_EMPTY) { | ||
421 | printf(" Paper is Out\n"); | ||
422 | } else { | ||
423 | printf(" Paper is Loaded\n"); | ||
424 | } | ||
425 | if (printer_status & PRINTER_NOT_ERROR) { | ||
426 | printf(" Printer OK\n"); | ||
427 | } else { | ||
428 | printf(" Printer ERROR\n"); | ||
429 | } | ||
430 | |||
431 | return(0); | ||
432 | } | ||
433 | |||
434 | |||
435 | int | ||
436 | main(int argc, char *argv[]) | ||
437 | { | ||
438 | int i; /* Looping var */ | ||
439 | int retval = 0; | ||
440 | |||
441 | /* No Args */ | ||
442 | if (argc == 1) { | ||
443 | usage(0); | ||
444 | exit(0); | ||
445 | } | ||
446 | |||
447 | for (i = 1; i < argc && !retval; i ++) { | ||
448 | |||
449 | if (argv[i][0] != '-') { | ||
450 | continue; | ||
451 | } | ||
452 | |||
453 | if (!strcmp(argv[i], "-get_status")) { | ||
454 | if (display_printer_status()) { | ||
455 | retval = 1; | ||
456 | } | ||
457 | |||
458 | } else if (!strcmp(argv[i], "-paper_loaded")) { | ||
459 | if (set_printer_status(PRINTER_PAPER_EMPTY, 1)) { | ||
460 | retval = 1; | ||
461 | } | ||
462 | |||
463 | } else if (!strcmp(argv[i], "-paper_out")) { | ||
464 | if (set_printer_status(PRINTER_PAPER_EMPTY, 0)) { | ||
465 | retval = 1; | ||
466 | } | ||
467 | |||
468 | } else if (!strcmp(argv[i], "-selected")) { | ||
469 | if (set_printer_status(PRINTER_SELECTED, 0)) { | ||
470 | retval = 1; | ||
471 | } | ||
472 | |||
473 | } else if (!strcmp(argv[i], "-not_selected")) { | ||
474 | if (set_printer_status(PRINTER_SELECTED, 1)) { | ||
475 | retval = 1; | ||
476 | } | ||
477 | |||
478 | } else if (!strcmp(argv[i], "-error")) { | ||
479 | if (set_printer_status(PRINTER_NOT_ERROR, 1)) { | ||
480 | retval = 1; | ||
481 | } | ||
482 | |||
483 | } else if (!strcmp(argv[i], "-no_error")) { | ||
484 | if (set_printer_status(PRINTER_NOT_ERROR, 0)) { | ||
485 | retval = 1; | ||
486 | } | ||
487 | |||
488 | } else if (!strcmp(argv[i], "-read_data")) { | ||
489 | if (read_printer_data()) { | ||
490 | retval = 1; | ||
491 | } | ||
492 | |||
493 | } else if (!strcmp(argv[i], "-write_data")) { | ||
494 | if (write_printer_data()) { | ||
495 | retval = 1; | ||
496 | } | ||
497 | |||
498 | } else if (!strcmp(argv[i], "-NB_read_data")) { | ||
499 | if (read_NB_printer_data()) { | ||
500 | retval = 1; | ||
501 | } | ||
502 | |||
503 | } else { | ||
504 | usage(argv[i]); | ||
505 | retval = 1; | ||
506 | } | ||
507 | } | ||
508 | |||
509 | exit(retval); | ||
510 | } | ||
diff --git a/Documentation/usb/iuu_phoenix.txt b/Documentation/usb/iuu_phoenix.txt new file mode 100644 index 000000000000..e5f048067da4 --- /dev/null +++ b/Documentation/usb/iuu_phoenix.txt | |||
@@ -0,0 +1,84 @@ | |||
1 | Infinity Usb Unlimited Readme | ||
2 | ----------------------------- | ||
3 | |||
4 | Hi all, | ||
5 | |||
6 | |||
7 | This module provide a serial interface to use your | ||
8 | IUU unit in phoenix mode. Loading this module will | ||
9 | bring a ttyUSB[0-x] interface. This driver must be | ||
10 | used by your favorite application to pilot the IUU | ||
11 | |||
12 | This driver is still in beta stage, so bugs can | ||
13 | occur and your system may freeze. As far I now, | ||
14 | I never had any problem with it, but I'm not a real | ||
15 | guru, so don't blame me if your system is unstable | ||
16 | |||
17 | You can plug more than one IUU. Every unit will | ||
18 | have his own device file(/dev/ttyUSB0,/dev/ttyUSB1,...) | ||
19 | |||
20 | |||
21 | |||
22 | How to tune the reader speed ? | ||
23 | |||
24 | A few parameters can be used at load time | ||
25 | To use parameters, just unload the module if it is | ||
26 | already loaded and use modprobe iuu_phoenix param=value. | ||
27 | In case of prebuilt module, use the command | ||
28 | insmod iuu_phoenix param=value. | ||
29 | |||
30 | Example: | ||
31 | |||
32 | modprobe iuu_phoenix clockmode=3 | ||
33 | |||
34 | The parameters are: | ||
35 | |||
36 | parm: clockmode:1=3Mhz579,2=3Mhz680,3=6Mhz (int) | ||
37 | parm: boost:overclock boost percent 100 to 500 (int) | ||
38 | parm: cdmode:Card detect mode 0=none, 1=CD, 2=!CD, 3=DSR, 4=!DSR, 5=CTS, 6=!CTS, 7=RING, 8=!RING (int) | ||
39 | parm: xmas:xmas color enabled or not (bool) | ||
40 | parm: debug:Debug enabled or not (bool) | ||
41 | |||
42 | - clockmode will provide 3 different base settings commonly adopted by | ||
43 | different software: | ||
44 | 1. 3Mhz579 | ||
45 | 2. 3Mhz680 | ||
46 | 3. 6Mhz | ||
47 | |||
48 | - boost provide a way to overclock the reader ( my favorite :-) ) | ||
49 | For example to have best performance than a simple clockmode=3, try this: | ||
50 | |||
51 | modprobe boost=195 | ||
52 | |||
53 | This will put the reader in a base of 3Mhz579 but boosted a 195 % ! | ||
54 | the real clock will be now : 6979050 Hz ( 6Mhz979 ) and will increase | ||
55 | the speed to a score 10 to 20% better than the simple clockmode=3 !!! | ||
56 | |||
57 | |||
58 | - cdmode permit to setup the signal used to inform the userland ( ioctl answer ) | ||
59 | if the card is present or not. Eight signals are possible. | ||
60 | |||
61 | - xmas is completely useless except for your eyes. This is one of my friend who was | ||
62 | so sad to have a nice device like the iuu without seeing all color range available. | ||
63 | So I have added this option to permit him to see a lot of color ( each activity change the color | ||
64 | and the frequency randomly ) | ||
65 | |||
66 | - debug will produce a lot of debugging messages... | ||
67 | |||
68 | |||
69 | Last notes: | ||
70 | |||
71 | Don't worry about the serial settings, the serial emulation | ||
72 | is an abstraction, so use any speed or parity setting will | ||
73 | work. ( This will not change anything ).Later I will perhaps | ||
74 | use this settings to deduce de boost but is that feature | ||
75 | really necessary ? | ||
76 | The autodetect feature used is the serial CD. If that doesn't | ||
77 | work for your software, disable detection mechanism in it. | ||
78 | |||
79 | |||
80 | Have fun ! | ||
81 | |||
82 | Alain Degreffe | ||
83 | |||
84 | eczema(at)ecze.com | ||