diff options
27 files changed, 9 insertions, 5517 deletions
diff --git a/Documentation/cdrom/00-INDEX b/Documentation/cdrom/00-INDEX index 916dafe29d3f..433edf23dc49 100644 --- a/Documentation/cdrom/00-INDEX +++ b/Documentation/cdrom/00-INDEX | |||
@@ -2,32 +2,10 @@ | |||
2 | - this file (info on CD-ROMs and Linux) | 2 | - this file (info on CD-ROMs and Linux) |
3 | Makefile | 3 | Makefile |
4 | - only used to generate TeX output from the documentation. | 4 | - only used to generate TeX output from the documentation. |
5 | aztcd | ||
6 | - info on Aztech/Orchid/Okano/Wearnes/Conrad/CyCDROM driver. | ||
7 | cdrom-standard.tex | 5 | cdrom-standard.tex |
8 | - LaTeX document on standardizing the CD-ROM programming interface. | 6 | - LaTeX document on standardizing the CD-ROM programming interface. |
9 | cdu31a | ||
10 | - info on the Sony CDU31A/CDU33A CD-ROM driver. | ||
11 | cm206 | ||
12 | - info on the Philips/LMS cm206/cm260 CD-ROM driver. | ||
13 | gscd | ||
14 | - info on the Goldstar R420 CD-ROM driver. | ||
15 | ide-cd | 7 | ide-cd |
16 | - info on setting up and using ATAPI (aka IDE) CD-ROMs. | 8 | - info on setting up and using ATAPI (aka IDE) CD-ROMs. |
17 | isp16 | ||
18 | - info on the CD-ROM interface on ISP16, MAD16 or Mozart sound card. | ||
19 | mcd | ||
20 | - info on limitations of standard Mitsumi CD-ROM driver. | ||
21 | mcdx | ||
22 | - info on improved Mitsumi CD-ROM driver. | ||
23 | optcd | ||
24 | - info on the Optics Storage 8000 AT CD-ROM driver | ||
25 | packet-writing.txt | 9 | packet-writing.txt |
26 | - Info on the CDRW packet writing module | 10 | - Info on the CDRW packet writing module |
27 | sbpcd | ||
28 | - info on the SoundBlaster/Panasonic CD-ROM interface driver. | ||
29 | sjcd | ||
30 | - info on the SANYO CDR-H94A CD-ROM interface driver. | ||
31 | sonycd535 | ||
32 | - info on the Sony CDU-535 (and 531) CD-ROM driver. | ||
33 | 11 | ||
diff --git a/Documentation/cdrom/aztcd b/Documentation/cdrom/aztcd deleted file mode 100644 index 6bf0290ef7ce..000000000000 --- a/Documentation/cdrom/aztcd +++ /dev/null | |||
@@ -1,822 +0,0 @@ | |||
1 | $Id: README.aztcd,v 2.60 1997/11/29 09:51:25 root Exp root $ | ||
2 | Readme-File Documentation/cdrom/aztcd | ||
3 | for | ||
4 | AZTECH CD-ROM CDA268-01A, ORCHID CD-3110, | ||
5 | OKANO/WEARNES CDD110, CONRAD TXC, CyCDROM CR520, CR540 | ||
6 | CD-ROM Drives | ||
7 | Version 2.6 and newer | ||
8 | (for other drives see 6.-8.) | ||
9 | |||
10 | NOTE: THIS DRIVER WILL WORK WITH THE CD-ROM DRIVES LISTED, WHICH HAVE | ||
11 | A PROPRIETARY INTERFACE (implemented on a sound card or on an | ||
12 | ISA-AT-bus card). | ||
13 | IT WILL DEFINITELY NOT WORK WITH CD-ROM DRIVES WITH *IDE*-INTERFACE, | ||
14 | such as the Aztech CDA269-031SE !!! (The only known exceptions are | ||
15 | 'faked' IDE drives like the CyCDROM CR520ie which work with aztcd | ||
16 | under certain conditions, see 7.). IF YOU'RE USING A CD-ROM DRIVE | ||
17 | WITH IDE-INTERFACE, SOMETIMES ALSO CALLED ATAPI-COMPATIBLE, PLEASE | ||
18 | USE THE ide-cd.c DRIVER, WRITTEN BY MARK LORD AND SCOTT SNYDER ! | ||
19 | THE STANDARD-KERNEL 1.2.x NOW ALSO SUPPORTS IDE-CDROM-DRIVES, SEE THE | ||
20 | HARDDISK (!) SECTION OF make config, WHEN COMPILING A NEW KERNEL!!! | ||
21 | ---------------------------------------------------------------------------- | ||
22 | |||
23 | Contents of this file: | ||
24 | 1. NOTE | ||
25 | 2. INSTALLATION | ||
26 | 3. CONFIGURING YOUR KERNEL | ||
27 | 4. RECOMPILING YOUR KERNEL | ||
28 | 4.1 AZTCD AS A RUN-TIME LOADABLE MODULE | ||
29 | 4.2 CDROM CONNECTED TO A SOUNDCARD | ||
30 | 5. KNOWN PROBLEMS, FUTURE DEVELOPMENTS | ||
31 | 5.1 MULTISESSION SUPPORT | ||
32 | 5.2 STATUS RECOGNITION | ||
33 | 5.3 DOSEMU's CDROM SUPPORT | ||
34 | 6. BUG REPORTS | ||
35 | 7. OTHER DRIVES | ||
36 | 8. IF YOU DON'T SUCCEED ... DEBUGGING | ||
37 | 9. TECHNICAL HISTORY OF THE DRIVER | ||
38 | 10. ACKNOWLEDGMENTS | ||
39 | 11. PROGRAMMING ADD ONS: CDPLAY.C | ||
40 | APPENDIX: Source code of cdplay.c | ||
41 | ---------------------------------------------------------------------------- | ||
42 | |||
43 | 1. NOTE | ||
44 | This software has been successfully in alpha and beta test and is part of | ||
45 | the standard kernel since kernel 1.1.8x since December 1994. It works with | ||
46 | AZTECH CDA268-01A, ORCHID CDS-3110, ORCHID/WEARNES CDD110 and CONRAD TXC | ||
47 | (Nr.99 31 23 -series 04) and has proven to be stable with kernel | ||
48 | versions 1.0.9 and newer. But with any software there still may be bugs in it. | ||
49 | So if you encounter problems, you are invited to help us improve this software. | ||
50 | Please send me a detailed bug report (see chapter BUG REPORTS). You are also | ||
51 | invited in helping us to increase the number of drives, which are supported. | ||
52 | |||
53 | Please read the README-files carefully and always keep a backup copy of your | ||
54 | old kernel, in order to reboot if something goes wrong! | ||
55 | |||
56 | 2. INSTALLATION | ||
57 | The driver consists of a header file 'aztcd.h', which normally should reside | ||
58 | in /usr/src/linux/drivers/cdrom and the source code 'aztcd.c', which normally | ||
59 | resides in the same place. It uses /dev/aztcd (/dev/aztcd0 in some distri- | ||
60 | butions), which must be a valid block device with major number 29 and reside | ||
61 | in directory /dev. To mount a CD-ROM, your kernel needs to have the ISO9660- | ||
62 | filesystem support included. | ||
63 | |||
64 | PLEASE NOTE: aztcd.c has been developed in parallel to the linux kernel, | ||
65 | which had and is having many major and minor changes which are not backward | ||
66 | compatible. Quite definitely aztcd.c version 1.80 and newer will NOT work | ||
67 | in kernels older than 1.3.33. So please always use the most recent version | ||
68 | of aztcd.c with the appropriate linux-kernel. | ||
69 | |||
70 | 3. CONFIGURING YOUR KERNEL | ||
71 | If your kernel is already configured for using the AZTECH driver you will | ||
72 | see the following message while Linux boots: | ||
73 | Aztech CD-ROM Init: DriverVersion=<version number> BaseAddress=<baseaddress> | ||
74 | Aztech CD-ROM Init: FirmwareVersion=<firmware version id of your I/O-card>>> | ||
75 | Aztech CD-ROM Init: <drive type> detected | ||
76 | Aztech CD-ROM Init: End | ||
77 | If the message looks different and you are sure to have a supported drive, | ||
78 | it may have a different base address. The Aztech driver does look for the | ||
79 | CD-ROM drive at the base address specified in aztcd.h at compile time. This | ||
80 | address can be overwritten by boot parameter aztcd=....You should reboot and | ||
81 | start Linux with boot parameter aztcd=<base address>, e.g. aztcd=0x320. If | ||
82 | you do not know the base address, start your PC with DOS and look at the boot | ||
83 | message of your CD-ROM's DOS driver. If that still does not help, use boot | ||
84 | parameter aztcd=<base address>,0x79 , this tells aztcd to try a little harder. | ||
85 | aztcd may be configured to use autoprobing the base address by recompiling | ||
86 | it (see chapter 4.). | ||
87 | |||
88 | If the message looks correct, as user 'root' you should be able to mount the | ||
89 | drive by | ||
90 | mount -t iso9660 -r /dev/aztcd0 /mnt | ||
91 | and use it as any other filesystem. (If this does not work, check if | ||
92 | /dev/aztcd0 and /mnt do exist and create them, if necessary by doing | ||
93 | mknod /dev/aztcd0 b 29 0 | ||
94 | mkdir /mnt | ||
95 | |||
96 | If you still get a different message while Linux boots or when you get the | ||
97 | message, that the ISO9660-filesystem is not supported by your kernel, when | ||
98 | you try to mount the CD-ROM drive, you have to recompile your kernel. | ||
99 | |||
100 | If you do *not* have an Aztech/Orchid/Okano/Wearnes/TXC drive and want to | ||
101 | bypass drive detection during Linux boot up, start with boot parameter aztcd=0. | ||
102 | |||
103 | Most distributions nowadays do contain a boot disk image containing aztcd. | ||
104 | Please note, that this driver will not work with IDE/ATAPI drives! With these | ||
105 | you must use ide-cd.c instead. | ||
106 | |||
107 | 4. RECOMPILING YOUR KERNEL | ||
108 | If your kernel is not yet configured for the AZTECH driver and the ISO9660- | ||
109 | filesystem, you have to recompile your kernel: | ||
110 | |||
111 | - Edit aztcd.h to set the I/O-address to your I/O-Base address (AZT_BASE_ADDR), | ||
112 | the driver does not use interrupts or DMA, so if you are using an AZTECH | ||
113 | CD268, an ORCHID CD-3110 or ORCHID/WEARNES CDD110 that's the only item you | ||
114 | have to set up. If you have a soundcard, read chapter 4.2. | ||
115 | Users of other drives should read chapter OTHER DRIVES of this file. | ||
116 | You also can configure that address by kernel boot parameter aztcd=... | ||
117 | - aztcd may be configured to use autoprobing the base address by setting | ||
118 | AZT_BASE_ADDR to '-1'. In that case aztcd probes the addresses listed | ||
119 | under AZT_BASE_AUTO. But please remember, that autoprobing always may | ||
120 | incorrectly influence other hardware components too! | ||
121 | - There are some other points, which may be configured, e.g. auto-eject the | ||
122 | CD when unmounting a drive, tray locking etc., see aztcd.h for details. | ||
123 | - If you're using a linux kernel version prior to 2.1.0, in aztcd.h | ||
124 | uncomment the line '#define AZT_KERNEL_PRIOR_2_1' | ||
125 | - Build a new kernel, configure it for 'Aztech/Orchid/Okano/Wearnes support' | ||
126 | (if you want aztcd to be part of the kernel). Do not configure it for | ||
127 | 'Aztech... support', if you want to use aztcd as a run time loadable module. | ||
128 | But in any case you must have the ISO9660-filesystem included in your | ||
129 | kernel. | ||
130 | - Activate the new kernel, normally this is done by running LILO (don't for- | ||
131 | get to configure it before and to keep a copy of your old kernel in case | ||
132 | something goes wrong!). | ||
133 | - Reboot | ||
134 | - If you've included aztcd in your kernel, you now should see during boot | ||
135 | some messages like | ||
136 | Aztech CD-ROM Init: DriverVersion=<version number> BaseAddress=<baseaddress> | ||
137 | Aztech CD-ROM Init: FirmwareVersion=<firmware version id of your I/O-card> | ||
138 | Aztech CD-ROM Init: <drive type> detected | ||
139 | Aztech CD-ROM Init: End | ||
140 | - If you have not included aztcd in your kernel, but want to load aztcd as a | ||
141 | run time loadable module see 4.1. | ||
142 | - If the message looks correct, as user 'root' you should be able to mount | ||
143 | the drive by | ||
144 | mount -t iso9660 -r /dev/aztcd0 /mnt | ||
145 | and use it as any other filesystem. (If this does not work, check if | ||
146 | /dev/aztcd0 and /mnt do exist and create them, if necessary by doing | ||
147 | mknod /dev/aztcd0 b 29 0 | ||
148 | mkdir /mnt | ||
149 | - If this still does not help, see chapters OTHER DRIVES and DEBUGGING. | ||
150 | |||
151 | 4.1 AZTCD AS A RUN-TIME LOADABLE MODULE | ||
152 | If you do not need aztcd permanently, you can also load and remove the driver | ||
153 | during runtime via insmod and rmmod. To build aztcd as a loadable module you | ||
154 | must configure your kernel for AZTECH module support (answer 'm' when con- | ||
155 | figuring the kernel). Anyhow, you may run into problems, if the version of | ||
156 | your boot kernel is not the same than the source kernel version, from which | ||
157 | you create the modules. So rebuild your kernel, if necessary. | ||
158 | |||
159 | Now edit the base address of your AZTECH interface card in | ||
160 | /usr/src/linux/drivers/cdrom/aztcd.h to the appropriate value. | ||
161 | aztcd may be configured to use autoprobing the base address by setting | ||
162 | AZT_BASE_ADDR to '-1'. In that case aztcd probes the addresses listed | ||
163 | under AZT_BASE_AUTO. But please remember, that autoprobing always may | ||
164 | incorrectly influence other hardware components too! | ||
165 | There are also some special features which may be configured, e.g. | ||
166 | auto-eject a CD when unmounting the drive etc; see aztcd.h for details. | ||
167 | Then change to /usr/src/linux and do a | ||
168 | make modules | ||
169 | make modules_install | ||
170 | After that you can run-time load the driver via | ||
171 | insmod /lib/modules/X.X.X/misc/aztcd.o | ||
172 | and remove it via rmmod aztcd. | ||
173 | If you did not set the correct base address in aztcd.h, you can also supply the | ||
174 | base address when loading the driver via | ||
175 | insmod /lib/modules/X.X.X/misc/aztcd.o aztcd=<base address> | ||
176 | Again specifying aztcd=-1 will cause autoprobing. | ||
177 | If you do not have the iso9660-filesystem in your boot kernel, you also have | ||
178 | to load it before you can mount the CDROM: | ||
179 | insmod /lib/modules/X.X.X/fs/isofs.o | ||
180 | The mount procedure works as described in 4. above. | ||
181 | (In all commands 'X.X.X' is the current linux kernel version number) | ||
182 | |||
183 | 4.2 CDROM CONNECTED TO A SOUNDCARD | ||
184 | Most soundcards do have a bus interface to the CDROM-drive. In many cases | ||
185 | this soundcard needs to be configured, before the CDROM can be used. This | ||
186 | configuration procedure consists of writing some kind of initialization | ||
187 | data to the soundcard registers. The AZTECH-CDROM driver in the moment does | ||
188 | only support one type of soundcard (SoundWave32). Users of other soundcards | ||
189 | should try to boot DOS first and let their DOS drivers initialize the | ||
190 | soundcard and CDROM, then warm boot (or use loadlin) their PC to start | ||
191 | Linux. | ||
192 | Support for the CDROM-interface of SoundWave32-soundcards is directly | ||
193 | implemented in the AZTECH driver. Please edit linux/drivers/cdrom/aztdc.h, | ||
194 | uncomment line '#define AZT_SW32' and set the appropriate value for | ||
195 | AZT_BASE_ADDR and AZT_SW32_BASE_ADDR. This support was tested with an Orchid | ||
196 | CDS-3110 connected to a SoundWave32. | ||
197 | If you want your soundcard to be supported, find out, how it needs to be | ||
198 | configured and mail me (see 6.) the appropriate information. | ||
199 | |||
200 | 5. KNOWN PROBLEMS, FUTURE DEVELOPMENTS | ||
201 | 5.1 MULTISESSION SUPPORT | ||
202 | Multisession support for CD's still is a myth. I implemented and tested a basic | ||
203 | support for multisession and XA CDs, but I still have not enough CDs and appli- | ||
204 | cations to test it rigorously. So if you'd like to help me, please contact me | ||
205 | (Email address see below). As of version 1.4 and newer you can enable the | ||
206 | multisession support in aztcd.h by setting AZT_MULTISESSION to 1. Doing so | ||
207 | will cause the ISO9660-filesystem to deal with multisession CDs, ie. redirect | ||
208 | requests to the Table of Contents (TOC) information from the last session, | ||
209 | which contains the info of all previous sessions etc.. If you do set | ||
210 | AZT_MULTISESSION to 0, you can use multisession CDs anyway. In that case the | ||
211 | drive's firmware will do automatic redirection. For the ISO9660-filesystem any | ||
212 | multisession CD will then look like a 'normal' single session CD. But never- | ||
213 | theless the data of all sessions are viewable and accessible. So with practical- | ||
214 | ly all real world applications you won't notice the difference. But as future | ||
215 | applications may make use of advanced multisession features, I've started to | ||
216 | implement the interface for the ISO9660 multisession interface via ioctl | ||
217 | CDROMMULTISESSION. | ||
218 | |||
219 | 5.2 STATUS RECOGNITION | ||
220 | The drive status recognition does not work correctly in all cases. Changing | ||
221 | a disk or having the door open, when a drive is already mounted, is detected | ||
222 | by the Aztech driver itself, but nevertheless causes multiple read attempts | ||
223 | by the different layers of the ISO9660-filesystem driver, which finally timeout, | ||
224 | so you have to wait quite a little... But isn't it bad style to change a disk | ||
225 | in a mounted drive, anyhow ?! | ||
226 | |||
227 | The driver uses busy wait in most cases for the drive handshake (macros | ||
228 | STEN_LOW and DTEN_LOW). I tested with a 486/DX2 at 66MHz and a Pentium at | ||
229 | 60MHz and 90MHz. Whenever you use a much faster machine you are likely to get | ||
230 | timeout messages. In that case edit aztcd.h and increase the timeout value | ||
231 | AZT_TIMEOUT. | ||
232 | |||
233 | For some 'slow' drive commands I implemented waiting with a timer waitqueue | ||
234 | (macro STEN_LOW_WAIT). If you get this timeout message, you may also edit | ||
235 | aztcd.h and increase the timeout value AZT_STATUS_DELAY. The waitqueue has | ||
236 | shown to be a little critical. If you get kernel panic messages, edit aztcd.c | ||
237 | and substitute STEN_LOW_WAIT by STEN_LOW. Busy waiting with STEN_LOW is more | ||
238 | stable, but also causes CPU overhead. | ||
239 | |||
240 | 5.3 DOSEMU's CD-ROM SUPPORT | ||
241 | With release 1.20 aztcd was modified to allow access to CD-ROMS when running | ||
242 | under dosemu-0.60.0 aztcd-versions before 1.20 are most likely to crash | ||
243 | Linux, when a CD-ROM is accessed under dosemu. This problem has partly been | ||
244 | fixed, but still when accessing a directory for the first time the system | ||
245 | might hang for some 30sec. So be patient, when using dosemu's CD-ROM support | ||
246 | in combination with aztcd :-) ! | ||
247 | This problem has now (July 1995) been fixed by a modification to dosemu's | ||
248 | CD-ROM driver. The new version came with dosemu-0.60.2, see dosemu's | ||
249 | README.CDROM. | ||
250 | |||
251 | 6. BUG REPORTS | ||
252 | Please send detailed bug reports and bug fixes via EMail to | ||
253 | |||
254 | Werner.Zimmermann@fht-esslingen.de | ||
255 | |||
256 | Please include a description of your CD-ROM drive type and interface card, | ||
257 | the exact firmware message during Linux bootup, the version number of the | ||
258 | AZTECH-CDROM-driver and the Linux kernel version. Also a description of your | ||
259 | system's other hardware could be of interest, especially microprocessor type, | ||
260 | clock frequency, other interface cards such as soundcards, ethernet adapter, | ||
261 | game cards etc.. | ||
262 | |||
263 | I will try to collect the reports and make the necessary modifications from | ||
264 | time to time. I may also come back to you directly with some bug fixes and | ||
265 | ask you to do further testing and debugging. | ||
266 | |||
267 | Editors of CD-ROMs are invited to send a 'cooperation' copy of their | ||
268 | CD-ROMs to the volunteers, who provided the CD-ROM support for Linux. My | ||
269 | snail mail address for such 'stuff' is | ||
270 | Prof. Dr. W. Zimmermann | ||
271 | Fachhochschule fuer Technik Esslingen | ||
272 | Fachbereich IT | ||
273 | Flandernstrasse 101 | ||
274 | D-73732 Esslingen | ||
275 | Germany | ||
276 | |||
277 | |||
278 | 7. OTHER DRIVES | ||
279 | The following drives ORCHID CDS3110, OKANO CDD110, WEARNES CDD110 and Conrad | ||
280 | TXC Nr. 993123-series 04 nearly look the same as AZTECH CDA268-01A, especially | ||
281 | they seem to use the same command codes. So it was quite simple to make the | ||
282 | AZTECH driver work with these drives. | ||
283 | |||
284 | Unfortunately I do not have any of these drives available, so I couldn't test | ||
285 | it myself. In some installations, it seems necessary to initialize the drive | ||
286 | with the DOS driver before (especially if combined with a sound card) and then | ||
287 | do a warm boot (CTRL-ALT-RESET) or start Linux from DOS, e.g. with 'loadlin'. | ||
288 | |||
289 | If you do not succeed, read chapter DEBUGGING. Thanks in advance! | ||
290 | |||
291 | Sorry for the inconvenience, but it is difficult to develop for hardware, | ||
292 | which you don't have available for testing. So if you like, please help us. | ||
293 | |||
294 | If you do have a CyCDROM CR520ie thanks to Hilmar Berger's help your chances | ||
295 | are good, that it will work with aztcd. The CR520ie is sold as an IDE-drive | ||
296 | and really is connected to the IDE interface (primary at 0x1F0 or secondary | ||
297 | at 0x170, configured as slave, not as master). Nevertheless it is not ATAPI | ||
298 | compatible but still uses Aztech's command codes. | ||
299 | |||
300 | |||
301 | 8. DEBUGGING : IF YOU DON'T SUCCEED, TRY THE FOLLOWING | ||
302 | -reread the complete README file | ||
303 | -make sure, that your drive is hardware configured for | ||
304 | transfer mode: polled | ||
305 | IRQ: not used | ||
306 | DMA: not used | ||
307 | Base Address: something like 300, 320 ... | ||
308 | You can check this, when you start the DOS driver, which came with your | ||
309 | drive. By appropriately configuring the drive and the DOS driver you can | ||
310 | check, whether your drive does operate in this mode correctly under DOS. If | ||
311 | it does not operate under DOS, it won't under Linux. | ||
312 | If your drive's base address is something like 0x170 or 0x1F0 (and it is | ||
313 | not a CyCDROM CR520ie or CR 940ie) you most likely are having an IDE/ATAPI- | ||
314 | compatible drive, which is not supported by aztcd.c, use ide-cd.c instead. | ||
315 | Make sure the Base Address is configured correctly in aztcd.h, also make | ||
316 | sure, that /dev/aztcd0 exists with the correct major number (compare it with | ||
317 | the entry in file /usr/include/linux/major.h for the Aztech drive). | ||
318 | -insert a CD-ROM and close the tray | ||
319 | -cold boot your PC (i.e. via the power on switch or the reset button) | ||
320 | -if you start Linux via DOS, e.g. using loadlin, make sure, that the DOS | ||
321 | driver for the CD-ROM drive is not loaded (comment out the calling lines | ||
322 | in DOS' config.sys!) | ||
323 | -look for the aztcd: init message during Linux init and note them exactly | ||
324 | -log in as root and do a mount -t iso9660 /dev/aztcd0 /mnt | ||
325 | -if you don't succeed in the first time, try several times. Try also to open | ||
326 | and close the tray, then mount again. Please note carefully all commands | ||
327 | you typed in and the aztcd-messages, which you get. | ||
328 | -if you get an 'Aztech CD-ROM init: aborted' message, read the remarks about | ||
329 | the version string below. | ||
330 | |||
331 | If this does not help, do the same with the following differences | ||
332 | -start DOS before; make now sure, that the DOS driver for the CD-ROM is | ||
333 | loaded under DOS (i.e. uncomment it again in config.sys) | ||
334 | -warm boot your PC (i.e. via CTRL-ALT-DEL) | ||
335 | if you have it, you can also start via loadlin (try both). | ||
336 | ... | ||
337 | Again note all commands and the aztcd-messages. | ||
338 | |||
339 | If you see STEN_LOW or STEN_LOW_WAIT error messages, increase the timeout | ||
340 | values. | ||
341 | |||
342 | If this still does not help, | ||
343 | -look in aztcd.c for the lines #if 0 | ||
344 | #define AZT_TEST1 | ||
345 | ... | ||
346 | #endif | ||
347 | and substitute '#if 0' by '#if 1'. | ||
348 | -recompile your kernel and repeat the above two procedures. You will now get | ||
349 | a bundle of debugging messages from the driver. Again note your commands | ||
350 | and the appropriate messages. If you have syslogd running, these messages | ||
351 | may also be found in syslogd's kernel log file. Nevertheless in some | ||
352 | installations syslogd does not yet run, when init() is called, thus look for | ||
353 | the aztcd-messages during init, before the login-prompt appears. | ||
354 | Then look in aztcd.c, to find out, what happened. The normal calling sequence | ||
355 | is: aztcd_init() during Linux bootup procedure init() | ||
356 | after doing a 'mount -t iso9660 /dev/aztcd0 /mnt' the normal calling sequence is | ||
357 | aztcd_open() -> Status 2c after cold reboot with CDROM or audio CD inserted | ||
358 | -> Status 8 after warm reboot with CDROM inserted | ||
359 | -> Status 2e after cold reboot with no disk, closed tray | ||
360 | -> Status 6e after cold reboot, mount with door open | ||
361 | aztUpdateToc() | ||
362 | aztGetDiskInfo() | ||
363 | aztGetQChannelInfo() repeated several times | ||
364 | aztGetToc() | ||
365 | aztGetQChannelInfo() repeated several times | ||
366 | a list of track information | ||
367 | do_aztcd_request() } | ||
368 | azt_transfer() } repeated several times | ||
369 | azt_poll } | ||
370 | Check, if there is a difference in the calling sequence or the status flags! | ||
371 | |||
372 | There are a lot of other messages, eg. the ACMD-command code (defined in | ||
373 | aztcd.h), status info from the getAztStatus-command and the state sequence of | ||
374 | the finite state machine in azt_poll(). The most important are the status | ||
375 | messages, look how they are defined and try to understand, if they make | ||
376 | sense in the context where they appear. With a CD-ROM inserted the status | ||
377 | should always be 8, except in aztcd_open(). Try to open the tray, insert an | ||
378 | audio disk, insert no disk or reinsert the CD-ROM and check, if the status | ||
379 | bits change accordingly. The status bits are the most likely point, where | ||
380 | the drive manufacturers may implement changes. | ||
381 | |||
382 | If you still don't succeed, a good point to start is to look in aztcd.c in | ||
383 | function aztcd_init, where the drive should be detected during init. Do the | ||
384 | following: | ||
385 | -reboot the system with boot parameter 'aztcd=<your base address>,0x79'. With | ||
386 | parameter 0x79 most of the drive version detection is bypassed. After that | ||
387 | you should see the complete version string including leading and trailing | ||
388 | blanks during init. | ||
389 | Now adapt the statement | ||
390 | if ((result[1]=='A')&&(result[2]=='Z' ...) | ||
391 | in aztcd_init() to exactly match the first 3 or 4 letters you have seen. | ||
392 | -Another point is the 'smart' card detection feature in aztcd_init(). Normally | ||
393 | the CD-ROM drive is ready, when aztcd_init is trying to read the version | ||
394 | string and a time consuming ACMD_SOFT_RESET command can be avoided. This is | ||
395 | detected by looking, if AFL_OP_OK can be read correctly. If the CD-ROM drive | ||
396 | hangs in some unknown state, e.g. because of an error before a warm start or | ||
397 | because you first operated under DOS, even the version string may be correct, | ||
398 | but the following commands will not. Then change the code in such a way, | ||
399 | that the ACMD_SOFT_RESET is issued in any case, by substituting the | ||
400 | if-statement 'if ( ...=AFL_OP_OK)' by 'if (1)'. | ||
401 | |||
402 | If you succeed, please mail me the exact version string of your drive and | ||
403 | the code modifications, you have made together with a short explanation. | ||
404 | If you don't succeed, you may mail me the output of the debugging messages. | ||
405 | But remember, they are only useful, if they are exact and complete and you | ||
406 | describe in detail your hardware setup and what you did (cold/warm reboot, | ||
407 | with/without DOS, DOS-driver started/not started, which Linux-commands etc.) | ||
408 | |||
409 | |||
410 | 9. TECHNICAL HISTORY OF THE DRIVER | ||
411 | The AZTECH-Driver is a rework of the Mitsumi-Driver. Four major items had to | ||
412 | be reworked: | ||
413 | |||
414 | a) The Mitsumi drive does issue complete status information acknowledging | ||
415 | each command, the Aztech drive does only signal that the command was | ||
416 | processed. So whenever the complete status information is needed, an extra | ||
417 | ACMD_GET_STATUS command is issued. The handshake procedure for the drive | ||
418 | can be found in the functions aztSendCmd(), sendAztCmd() and getAztStatus(). | ||
419 | |||
420 | b) The Aztech Drive does not have a ACMD_GET_DISK_INFO command, so the | ||
421 | necessary info about the number of tracks (firstTrack, lastTrack), disk | ||
422 | length etc. has to be read from the TOC in the lead in track (see function | ||
423 | aztGetDiskInfo()). | ||
424 | |||
425 | c) Whenever data is read from the drive, the Mitsumi drive is started with a | ||
426 | command to read an indefinite (0xffffff) number of sectors. When the appropriate | ||
427 | number of sectors is read, the drive is stopped by a ACDM_STOP command. This | ||
428 | does not work with the Aztech drive. I did not find a way to stop it. The | ||
429 | stop and pause commands do only work in AUDIO mode but not in DATA mode. | ||
430 | Therefore I had to modify the 'finite state machine' in function azt_poll to | ||
431 | only read a certain number of sectors and then start a new read on demand. As I | ||
432 | have not completely understood, how the buffer/caching scheme of the Mitsumi | ||
433 | driver was implemented, I am not sure, if I have covered all cases correctly, | ||
434 | whenever you get timeout messages, the bug is most likely to be in that | ||
435 | function azt_poll() around switch(cmd) .... case ACD_S_DATA. | ||
436 | |||
437 | d) I did not get information about changing drive mode. So I doubt, that the | ||
438 | code around function azt_poll() case AZT_S_MODE does work. In my test I have | ||
439 | not been able to switch to reading in raw mode. For reading raw mode, Aztech | ||
440 | uses a different command than for cooked mode, which I only have implemen- | ||
441 | ted in the ioctl-section but not in the section which is used by the ISO9660. | ||
442 | |||
443 | The driver was developed on an AST PC with Intel 486/DX2, 8MB RAM, 340MB IDE | ||
444 | hard disk and on an AST PC with Intel Pentium 60MHz, 16MB RAM, 520MB IDE | ||
445 | running Linux kernel version 1.0.9 from the LST 1.8 Distribution. The kernel | ||
446 | was compiled with gcc.2.5.8. My CD-ROM drive is an Aztech CDA268-01A. My | ||
447 | drive says, that it has Firmware Version AZT26801A1.3. It came with an ISA-bus | ||
448 | interface card and works with polled I/O without DMA and without interrupts. | ||
449 | The code for all other drives was 'remote' tested and debugged by a number of | ||
450 | volunteers on the Internet. | ||
451 | |||
452 | Points, where I feel that possible problems might be and all points where I | ||
453 | did not completely understand the drive's behaviour or trust my own code are | ||
454 | marked with /*???*/ in the source code. There are also some parts in the | ||
455 | Mitsumi driver, where I did not completely understand their code. | ||
456 | |||
457 | |||
458 | 10. ACKNOWLEDGMENTS | ||
459 | Without the help of P.Bush, Aztech, who delivered technical information | ||
460 | about the Aztech Drive and without the help of E.Moenkeberg, GWDG, who did a | ||
461 | great job in analyzing the command structure of various CD-ROM drives, this | ||
462 | work would not have been possible. E.Moenkeberg was also a great help in | ||
463 | making the software 'kernel ready' and in answering many of the CDROM-related | ||
464 | questions in the newsgroups. He really is *the* Linux CD-ROM guru. Thanks | ||
465 | also to all the guys on the Internet, who collected valuable technical | ||
466 | information about CDROMs. | ||
467 | |||
468 | Joe Nardone (joe@access.digex.net) was a patient tester even for my first | ||
469 | trial, which was more than slow, and made suggestions for code improvement. | ||
470 | Especially the 'finite state machine' azt_poll() was rewritten by Joe to get | ||
471 | clean C code and avoid the ugly 'gotos', which I copied from mcd.c. | ||
472 | |||
473 | Robby Schirmer (schirmer@fmi.uni-passau.de) tested the audio stuff (ioctls) | ||
474 | and suggested a lot of patches for them. | ||
475 | |||
476 | Joseph Piskor and Peter Nugent were the first users with the ORCHID CD3110 | ||
477 | and also were very patient with the problems which occurred. | ||
478 | |||
479 | Reinhard Max delivered the information for the CDROM-interface of the | ||
480 | SoundWave32 soundcards. | ||
481 | |||
482 | Jochen Kunz and Olaf Kaluza delivered the information for supporting Conrad's | ||
483 | TXC drive. | ||
484 | |||
485 | Hilmar Berger delivered the patches for supporting CyCDROM CR520ie. | ||
486 | |||
487 | Anybody, who is interested in these items should have a look at 'ftp.gwdg.de', | ||
488 | directory 'pub/linux/cdrom' and at 'ftp.cdrom.com', directory 'pub/cdrom'. | ||
489 | |||
490 | 11. PROGRAMMING ADD ONs: cdplay.c | ||
491 | You can use the ioctl-functions included in aztcd.c in your own programs. As | ||
492 | an example on how to do this, you will find a tiny CD Player for audio CDs | ||
493 | named 'cdplay.c'. It allows you to play audio CDs. You can play a specified | ||
494 | track, pause and resume or skip tracks forward and backwards. If you quit the | ||
495 | program without stopping the drive, playing is continued. You can also | ||
496 | (mis)use cdplay to read and hexdump data disks. You can find the code in the | ||
497 | APPENDIX of this file, which you should cut out with an editor and store in a | ||
498 | separate file 'cdplay.c'. To compile it and make it executable, do | ||
499 | gcc -s -Wall -O2 -L/usr/lib cdplay.c -o /usr/local/bin/cdplay # compiles it | ||
500 | chmod +755 /usr/local/bin/cdplay # makes it executable | ||
501 | ln -s /dev/aztcd0 /dev/cdrom # creates a link | ||
502 | (for /usr/lib substitute the top level directory, where your include files | ||
503 | reside, and for /usr/local/bin the directory, where you want the executable | ||
504 | binary to reside ) | ||
505 | |||
506 | You have to set the correct permissions for cdplay *and* for /dev/mcd0 or | ||
507 | /dev/aztcd0 in order to use it. Remember, that you should not have /dev/cdrom | ||
508 | mounted, when you're playing audio CDs. | ||
509 | |||
510 | This program is just a hack for testing the ioctl-functions in aztcd.c. I will | ||
511 | not maintain it, so if you run into problems, discard it or have a look into | ||
512 | the source code 'cdplay.c'. The program does only contain a minimum of user | ||
513 | protection and input error detection. If you use the commands in the wrong | ||
514 | order or if you try to read a CD at wrong addresses, you may get error messages | ||
515 | or even hang your machine. If you get STEN_LOW, STEN_LOW_WAIT or segment violation | ||
516 | error messages when using cdplay, after that, the system might not be stable | ||
517 | any more, so you'd better reboot. As the ioctl-functions run in kernel mode, | ||
518 | most normal Linux-multitasking protection features do not work. By using | ||
519 | uninitialized 'wild' pointers etc., it is easy to write to other users' data | ||
520 | and program areas, destroy kernel tables etc.. So if you experiment with ioctls | ||
521 | as always when you are doing systems programming and kernel hacking, you | ||
522 | should have a backup copy of your system in a safe place (and you also | ||
523 | should try restoring from a backup copy first)! | ||
524 | |||
525 | A reworked and improved version called 'cdtester.c', which has yet more | ||
526 | features for testing CDROM-drives can be found in | ||
527 | Documentation/cdrom/sbpcd, written by E.Moenkeberg. | ||
528 | |||
529 | Werner Zimmermann | ||
530 | Fachhochschule fuer Technik Esslingen | ||
531 | (EMail: Werner.Zimmermann@fht-esslingen.de) | ||
532 | October, 1997 | ||
533 | |||
534 | --------------------------------------------------------------------------- | ||
535 | APPENDIX: Source code of cdplay.c | ||
536 | |||
537 | /* Tiny Audio CD Player | ||
538 | |||
539 | Copyright 1994, 1995, 1996 Werner Zimmermann (Werner.Zimmermann@fht-esslingen.de) | ||
540 | |||
541 | This program originally was written to test the audio functions of the | ||
542 | AZTECH.CDROM-driver, but it should work with every CD-ROM drive. Before | ||
543 | using it, you should set a symlink from /dev/cdrom to your real CDROM | ||
544 | device. | ||
545 | |||
546 | The GNU General Public License applies to this program. | ||
547 | |||
548 | History: V0.1 W.Zimmermann: First release. Nov. 8, 1994 | ||
549 | V0.2 W.Zimmermann: Enhanced functionality. Nov. 9, 1994 | ||
550 | V0.3 W.Zimmermann: Additional functions. Nov. 28, 1994 | ||
551 | V0.4 W.Zimmermann: fixed some bugs. Dec. 17, 1994 | ||
552 | V0.5 W.Zimmermann: clean 'scanf' commands without compiler warnings | ||
553 | Jan. 6, 1995 | ||
554 | V0.6 W.Zimmermann: volume control (still experimental). Jan. 24, 1995 | ||
555 | V0.7 W.Zimmermann: read raw modified. July 26, 95 | ||
556 | */ | ||
557 | |||
558 | #include <stdio.h> | ||
559 | #include <ctype.h> | ||
560 | #include <sys/ioctl.h> | ||
561 | #include <sys/types.h> | ||
562 | #include <fcntl.h> | ||
563 | #include <unistd.h> | ||
564 | #include <linux/cdrom.h> | ||
565 | #include <linux/../../drivers/cdrom/aztcd.h> | ||
566 | |||
567 | void help(void) | ||
568 | { printf("Available Commands: STOP s EJECT/CLOSE e QUIT q\n"); | ||
569 | printf(" PLAY TRACK t PAUSE p RESUME r\n"); | ||
570 | printf(" NEXT TRACK n REPEAT LAST l HELP h\n"); | ||
571 | printf(" SUB CHANNEL c TRACK INFO i PLAY AT a\n"); | ||
572 | printf(" READ d READ RAW w VOLUME v\n"); | ||
573 | } | ||
574 | |||
575 | int main(void) | ||
576 | { int handle; | ||
577 | unsigned char command=' ', ini=0, first=1, last=1; | ||
578 | unsigned int cmd, i,j,k, arg1,arg2,arg3; | ||
579 | struct cdrom_ti ti; | ||
580 | struct cdrom_tochdr tocHdr; | ||
581 | struct cdrom_subchnl subchnl; | ||
582 | struct cdrom_tocentry entry; | ||
583 | struct cdrom_msf msf; | ||
584 | union { struct cdrom_msf msf; | ||
585 | unsigned char buf[CD_FRAMESIZE_RAW]; | ||
586 | } azt; | ||
587 | struct cdrom_volctrl volctrl; | ||
588 | |||
589 | printf("\nMini-Audio CD-Player V0.72 (C) 1994,1995,1996 W.Zimmermann\n"); | ||
590 | handle=open("/dev/cdrom",O_RDWR); | ||
591 | ioctl(handle,CDROMRESUME); | ||
592 | |||
593 | if (handle<=0) | ||
594 | { printf("Drive Error: already playing, no audio disk, door open\n"); | ||
595 | printf(" or no permission (you must be ROOT in order to use this program)\n"); | ||
596 | } | ||
597 | else | ||
598 | { help(); | ||
599 | while (1) | ||
600 | { printf("Type command (h = help): "); | ||
601 | scanf("%s",&command); | ||
602 | switch (command) | ||
603 | { case 'e': cmd=CDROMEJECT; | ||
604 | ioctl(handle,cmd); | ||
605 | break; | ||
606 | case 'p': if (!ini) | ||
607 | { printf("Command not allowed - play track first\n"); | ||
608 | } | ||
609 | else | ||
610 | { cmd=CDROMPAUSE; | ||
611 | if (ioctl(handle,cmd)) printf("Drive Error\n"); | ||
612 | } | ||
613 | break; | ||
614 | case 'r': if (!ini) | ||
615 | { printf("Command not allowed - play track first\n"); | ||
616 | } | ||
617 | else | ||
618 | { cmd=CDROMRESUME; | ||
619 | if (ioctl(handle,cmd)) printf("Drive Error\n"); | ||
620 | } | ||
621 | break; | ||
622 | case 's': cmd=CDROMPAUSE; | ||
623 | if (ioctl(handle,cmd)) printf("Drive error or already stopped\n"); | ||
624 | cmd=CDROMSTOP; | ||
625 | if (ioctl(handle,cmd)) printf("Drive error\n"); | ||
626 | break; | ||
627 | case 't': cmd=CDROMREADTOCHDR; | ||
628 | if (ioctl(handle,cmd,&tocHdr)) printf("Drive Error\n"); | ||
629 | first=tocHdr.cdth_trk0; | ||
630 | last= tocHdr.cdth_trk1; | ||
631 | if ((first==0)||(first>last)) | ||
632 | { printf ("--could not read TOC\n"); | ||
633 | } | ||
634 | else | ||
635 | { printf("--first track: %d --last track: %d --enter track number: ",first,last); | ||
636 | cmd=CDROMPLAYTRKIND; | ||
637 | scanf("%i",&arg1); | ||
638 | ti.cdti_trk0=arg1; | ||
639 | if (ti.cdti_trk0<first) ti.cdti_trk0=first; | ||
640 | if (ti.cdti_trk0>last) ti.cdti_trk0=last; | ||
641 | ti.cdti_ind0=0; | ||
642 | ti.cdti_trk1=last; | ||
643 | ti.cdti_ind1=0; | ||
644 | if (ioctl(handle,cmd,&ti)) printf("Drive Error\n"); | ||
645 | ini=1; | ||
646 | } | ||
647 | break; | ||
648 | case 'n': if (!ini++) | ||
649 | { if (ioctl(handle,CDROMREADTOCHDR,&tocHdr)) printf("Drive Error\n"); | ||
650 | first=tocHdr.cdth_trk0; | ||
651 | last= tocHdr.cdth_trk1; | ||
652 | ti.cdti_trk0=first-1; | ||
653 | } | ||
654 | if ((first==0)||(first>last)) | ||
655 | { printf ("--could not read TOC\n"); | ||
656 | } | ||
657 | else | ||
658 | { cmd=CDROMPLAYTRKIND; | ||
659 | if (++ti.cdti_trk0 > last) ti.cdti_trk0=last; | ||
660 | ti.cdti_ind0=0; | ||
661 | ti.cdti_trk1=last; | ||
662 | ti.cdti_ind1=0; | ||
663 | if (ioctl(handle,cmd,&ti)) printf("Drive Error\n"); | ||
664 | ini=1; | ||
665 | } | ||
666 | break; | ||
667 | case 'l': if (!ini++) | ||
668 | { if (ioctl(handle,CDROMREADTOCHDR,&tocHdr)) printf("Drive Error\n"); | ||
669 | first=tocHdr.cdth_trk0; | ||
670 | last= tocHdr.cdth_trk1; | ||
671 | ti.cdti_trk0=first+1; | ||
672 | } | ||
673 | if ((first==0)||(first>last)) | ||
674 | { printf ("--could not read TOC\n"); | ||
675 | } | ||
676 | else | ||
677 | { cmd=CDROMPLAYTRKIND; | ||
678 | if (--ti.cdti_trk0 < first) ti.cdti_trk0=first; | ||
679 | ti.cdti_ind0=0; | ||
680 | ti.cdti_trk1=last; | ||
681 | ti.cdti_ind1=0; | ||
682 | if (ioctl(handle,cmd,&ti)) printf("Drive Error\n"); | ||
683 | ini=1; | ||
684 | } | ||
685 | break; | ||
686 | case 'c': subchnl.cdsc_format=CDROM_MSF; | ||
687 | if (ioctl(handle,CDROMSUBCHNL,&subchnl)) | ||
688 | printf("Drive Error\n"); | ||
689 | else | ||
690 | { printf("AudioStatus:%s Track:%d Mode:%d MSF=%d:%d:%d\n", \ | ||
691 | subchnl.cdsc_audiostatus==CDROM_AUDIO_PLAY ? "PLAYING":"NOT PLAYING",\ | ||
692 | subchnl.cdsc_trk,subchnl.cdsc_adr, \ | ||
693 | subchnl.cdsc_absaddr.msf.minute, subchnl.cdsc_absaddr.msf.second, \ | ||
694 | subchnl.cdsc_absaddr.msf.frame); | ||
695 | } | ||
696 | break; | ||
697 | case 'i': if (!ini) | ||
698 | { printf("Command not allowed - play track first\n"); | ||
699 | } | ||
700 | else | ||
701 | { cmd=CDROMREADTOCENTRY; | ||
702 | printf("Track No.: "); | ||
703 | scanf("%d",&arg1); | ||
704 | entry.cdte_track=arg1; | ||
705 | if (entry.cdte_track<first) entry.cdte_track=first; | ||
706 | if (entry.cdte_track>last) entry.cdte_track=last; | ||
707 | entry.cdte_format=CDROM_MSF; | ||
708 | if (ioctl(handle,cmd,&entry)) | ||
709 | { printf("Drive error or invalid track no.\n"); | ||
710 | } | ||
711 | else | ||
712 | { printf("Mode %d Track, starts at %d:%d:%d\n", \ | ||
713 | entry.cdte_adr,entry.cdte_addr.msf.minute, \ | ||
714 | entry.cdte_addr.msf.second,entry.cdte_addr.msf.frame); | ||
715 | } | ||
716 | } | ||
717 | break; | ||
718 | case 'a': cmd=CDROMPLAYMSF; | ||
719 | printf("Address (min:sec:frame) "); | ||
720 | scanf("%d:%d:%d",&arg1,&arg2,&arg3); | ||
721 | msf.cdmsf_min0 =arg1; | ||
722 | msf.cdmsf_sec0 =arg2; | ||
723 | msf.cdmsf_frame0=arg3; | ||
724 | if (msf.cdmsf_sec0 > 59) msf.cdmsf_sec0 =59; | ||
725 | if (msf.cdmsf_frame0> 74) msf.cdmsf_frame0=74; | ||
726 | msf.cdmsf_min1=60; | ||
727 | msf.cdmsf_sec1=00; | ||
728 | msf.cdmsf_frame1=00; | ||
729 | if (ioctl(handle,cmd,&msf)) | ||
730 | { printf("Drive error or invalid address\n"); | ||
731 | } | ||
732 | break; | ||
733 | #ifdef AZT_PRIVATE_IOCTLS /*not supported by every CDROM driver*/ | ||
734 | case 'd': cmd=CDROMREADCOOKED; | ||
735 | printf("Address (min:sec:frame) "); | ||
736 | scanf("%d:%d:%d",&arg1,&arg2,&arg3); | ||
737 | azt.msf.cdmsf_min0 =arg1; | ||
738 | azt.msf.cdmsf_sec0 =arg2; | ||
739 | azt.msf.cdmsf_frame0=arg3; | ||
740 | if (azt.msf.cdmsf_sec0 > 59) azt.msf.cdmsf_sec0 =59; | ||
741 | if (azt.msf.cdmsf_frame0> 74) azt.msf.cdmsf_frame0=74; | ||
742 | if (ioctl(handle,cmd,&azt.msf)) | ||
743 | { printf("Drive error, invalid address or unsupported command\n"); | ||
744 | } | ||
745 | k=0; | ||
746 | getchar(); | ||
747 | for (i=0;i<128;i++) | ||
748 | { printf("%4d:",i*16); | ||
749 | for (j=0;j<16;j++) | ||
750 | { printf("%2x ",azt.buf[i*16+j]); | ||
751 | } | ||
752 | for (j=0;j<16;j++) | ||
753 | { if (isalnum(azt.buf[i*16+j])) | ||
754 | printf("%c",azt.buf[i*16+j]); | ||
755 | else | ||
756 | printf("."); | ||
757 | } | ||
758 | printf("\n"); | ||
759 | k++; | ||
760 | if (k>=20) | ||
761 | { printf("press ENTER to continue\n"); | ||
762 | getchar(); | ||
763 | k=0; | ||
764 | } | ||
765 | } | ||
766 | break; | ||
767 | case 'w': cmd=CDROMREADRAW; | ||
768 | printf("Address (min:sec:frame) "); | ||
769 | scanf("%d:%d:%d",&arg1,&arg2,&arg3); | ||
770 | azt.msf.cdmsf_min0 =arg1; | ||
771 | azt.msf.cdmsf_sec0 =arg2; | ||
772 | azt.msf.cdmsf_frame0=arg3; | ||
773 | if (azt.msf.cdmsf_sec0 > 59) azt.msf.cdmsf_sec0 =59; | ||
774 | if (azt.msf.cdmsf_frame0> 74) azt.msf.cdmsf_frame0=74; | ||
775 | if (ioctl(handle,cmd,&azt)) | ||
776 | { printf("Drive error, invalid address or unsupported command\n"); | ||
777 | } | ||
778 | k=0; | ||
779 | for (i=0;i<147;i++) | ||
780 | { printf("%4d:",i*16); | ||
781 | for (j=0;j<16;j++) | ||
782 | { printf("%2x ",azt.buf[i*16+j]); | ||
783 | } | ||
784 | for (j=0;j<16;j++) | ||
785 | { if (isalnum(azt.buf[i*16+j])) | ||
786 | printf("%c",azt.buf[i*16+j]); | ||
787 | else | ||
788 | printf("."); | ||
789 | } | ||
790 | printf("\n"); | ||
791 | k++; | ||
792 | if (k>=20) | ||
793 | { getchar(); | ||
794 | k=0; | ||
795 | } | ||
796 | } | ||
797 | break; | ||
798 | #endif | ||
799 | case 'v': cmd=CDROMVOLCTRL; | ||
800 | printf("--Channel 0 Left (0-255): "); | ||
801 | scanf("%d",&arg1); | ||
802 | printf("--Channel 1 Right (0-255): "); | ||
803 | scanf("%d",&arg2); | ||
804 | volctrl.channel0=arg1; | ||
805 | volctrl.channel1=arg2; | ||
806 | volctrl.channel2=0; | ||
807 | volctrl.channel3=0; | ||
808 | if (ioctl(handle,cmd,&volctrl)) | ||
809 | { printf("Drive error or unsupported command\n"); | ||
810 | } | ||
811 | break; | ||
812 | case 'q': if (close(handle)) printf("Drive Error: CLOSE\n"); | ||
813 | exit(0); | ||
814 | case 'h': help(); | ||
815 | break; | ||
816 | default: printf("unknown command\n"); | ||
817 | break; | ||
818 | } | ||
819 | } | ||
820 | } | ||
821 | return 0; | ||
822 | } | ||
diff --git a/Documentation/cdrom/cdu31a b/Documentation/cdrom/cdu31a deleted file mode 100644 index c0667da09c00..000000000000 --- a/Documentation/cdrom/cdu31a +++ /dev/null | |||
@@ -1,196 +0,0 @@ | |||
1 | |||
2 | CDU31A/CDU33A Driver Info | ||
3 | ------------------------- | ||
4 | |||
5 | Information on the Sony CDU31A/CDU33A CDROM driver for the Linux | ||
6 | kernel. | ||
7 | |||
8 | Corey Minyard (minyard@metronet.com) | ||
9 | |||
10 | Colossians 3:17 | ||
11 | |||
12 | Crude Table of Contents | ||
13 | ----------------------- | ||
14 | |||
15 | Setting Up the Hardware | ||
16 | Configuring the Kernel | ||
17 | Configuring as a Module | ||
18 | Driver Special Features | ||
19 | |||
20 | |||
21 | This device driver handles Sony CDU31A/CDU33A CDROM drives and | ||
22 | provides a complete block-level interface as well as an ioctl() | ||
23 | interface as specified in include/linux/cdrom.h). With this | ||
24 | interface, CDROMs can be accessed, standard audio CDs can be played | ||
25 | back normally, and CD audio information can be read off the drive. | ||
26 | |||
27 | Note that this will only work for CDU31A/CDU33A drives. Some vendors | ||
28 | market their drives as CDU31A compatible. They lie. Their drives are | ||
29 | really CDU31A hardware interface compatible (they can plug into the | ||
30 | same card). They are not software compatible. | ||
31 | |||
32 | Setting Up the Hardware | ||
33 | ----------------------- | ||
34 | |||
35 | The CDU31A driver is unable to safely tell if an interface card is | ||
36 | present that it can use because the interface card does not announce | ||
37 | its presence in any way besides placing 4 I/O locations in memory. It | ||
38 | used to just probe memory and attempt commands, but Linus wisely asked | ||
39 | me to remove that because it could really screw up other hardware in | ||
40 | the system. | ||
41 | |||
42 | Because of this, you must tell the kernel where the drive interface | ||
43 | is, what interrupts are used, and possibly if you are on a PAS-16 | ||
44 | soundcard. | ||
45 | |||
46 | If you have the Sony CDU31A/CDU33A drive interface card, the following | ||
47 | diagram will help you set it up. If you have another card, you are on | ||
48 | your own. You need to make sure that the I/O address and interrupt is | ||
49 | not used by another card in the system. You will need to know the I/O | ||
50 | address and interrupt you have set. Note that use of interrupts is | ||
51 | highly recommended, if possible, it really cuts down on CPU used. | ||
52 | Unfortunately, most soundcards do not support interrupts for their | ||
53 | CDROM interfaces. By default, the Sony interface card comes with | ||
54 | interrupts disabled. | ||
55 | |||
56 | +----------+-----------------+----------------------+ | ||
57 | | JP1 | 34 Pin Conn | | | ||
58 | | JP2 +-----------------+ | | ||
59 | | JP3 | | ||
60 | | JP4 | | ||
61 | | +--+ | ||
62 | | | +-+ | ||
63 | | | | | External | ||
64 | | | | | Connector | ||
65 | | | | | | ||
66 | | | +-+ | ||
67 | | +--+ | ||
68 | | | | ||
69 | | +--------+ | ||
70 | | | | ||
71 | +------------------------------------------+ | ||
72 | |||
73 | JP1 sets the Base Address, using the following settings: | ||
74 | |||
75 | Address Pin 1 Pin 2 | ||
76 | ------- ----- ----- | ||
77 | 0x320 Short Short | ||
78 | 0x330 Short Open | ||
79 | 0x340 Open Short | ||
80 | 0x360 Open Open | ||
81 | |||
82 | JP2 and JP3 configure the DMA channel; they must be set the same. | ||
83 | |||
84 | DMA Pin 1 Pin 2 Pin 3 | ||
85 | --- ----- ----- ----- | ||
86 | 1 On Off On | ||
87 | 2 Off On Off | ||
88 | 3 Off Off On | ||
89 | |||
90 | JP4 Configures the IRQ: | ||
91 | |||
92 | IRQ Pin 1 Pin 2 Pin 3 Pin 4 | ||
93 | --- ----- ----- ----- ----- | ||
94 | 3 Off Off On Off | ||
95 | 4 Off Off* Off On | ||
96 | 5 On Off Off Off | ||
97 | 6 Off On Off Off | ||
98 | |||
99 | The documentation states to set this for interrupt | ||
100 | 4, but I think that is a mistake. | ||
101 | |||
102 | Note that if you have another interface card, you will need to look at | ||
103 | the documentation to find the I/O base address. This is specified to | ||
104 | the SLCD.SYS driver for DOS with the /B: parameter, so you can look at | ||
105 | you DOS driver setup to find the address, if necessary. | ||
106 | |||
107 | Configuring the Kernel | ||
108 | ---------------------- | ||
109 | |||
110 | You must tell the kernel where the drive is at boot time. This can be | ||
111 | done at the Linux boot prompt, by using LILO, or by using Bootlin. | ||
112 | Note that this is no substitute for HOWTOs and LILO documentation, if | ||
113 | you are confused please read those for info on bootline configuration | ||
114 | and LILO. | ||
115 | |||
116 | At the linux boot prompt, press the ALT key and add the following line | ||
117 | after the boot name (you can let the kernel boot, it will tell you the | ||
118 | default boot name while booting): | ||
119 | |||
120 | cdu31a=<base address>,<interrupt>[,PAS] | ||
121 | |||
122 | The base address needs to have "0x" in front of it, since it is in | ||
123 | hex. For instance, to configure a drive at address 320 on interrupt 5, | ||
124 | use the following: | ||
125 | |||
126 | cdu31a=0x320,5 | ||
127 | |||
128 | I use the following boot line: | ||
129 | |||
130 | cdu31a=0x1f88,0,PAS | ||
131 | |||
132 | because I have a PAS-16 which does not support interrupt for the | ||
133 | CDU31A interface. | ||
134 | |||
135 | Adding this as an append line at the beginning of the /etc/lilo.conf | ||
136 | file will set it for lilo configurations. I have the following as the | ||
137 | first line in my lilo.conf file: | ||
138 | |||
139 | append="cdu31a=0x1f88,0" | ||
140 | |||
141 | I'm not sure how to set up Bootlin (I have never used it), if someone | ||
142 | would like to fill in this section please do. | ||
143 | |||
144 | |||
145 | Configuring as a Module | ||
146 | ----------------------- | ||
147 | |||
148 | The driver supports loading as a module. However, you must specify | ||
149 | the boot address and interrupt on the boot line to insmod. You can't | ||
150 | use modprobe to load it, since modprobe doesn't support setting | ||
151 | variables. | ||
152 | |||
153 | Anyway, I use the following line to load my driver as a module | ||
154 | |||
155 | /sbin/insmod /lib/modules/`uname -r`/misc/cdu31a.o cdu31a_port=0x1f88 | ||
156 | |||
157 | You can set the following variables in the driver: | ||
158 | |||
159 | cdu31a_port=<I/O address> - sets the base I/O. If hex, put 0x in | ||
160 | front of it. This must be specified. | ||
161 | |||
162 | cdu31a_irq=<interrupt> - Sets the interrupt number. Leaving this | ||
163 | off will turn interrupts off. | ||
164 | |||
165 | |||
166 | Driver Special Features | ||
167 | ----------------------- | ||
168 | |||
169 | This section describes features beyond the normal audio and CD-ROM | ||
170 | functions of the drive. | ||
171 | |||
172 | 2048 byte buffer mode | ||
173 | |||
174 | If a disk is mounted with -o block=2048, data is copied straight from | ||
175 | the drive data port to the buffer. Otherwise, the readahead buffer | ||
176 | must be involved to hold the other 1K of data when a 1K block | ||
177 | operation is done. Note that with 2048 byte blocks you cannot execute | ||
178 | files from the CD. | ||
179 | |||
180 | XA compatibility | ||
181 | |||
182 | The driver should support XA disks for both the CDU31A and CDU33A. It | ||
183 | does this transparently, the using program doesn't need to set it. | ||
184 | |||
185 | Multi-Session | ||
186 | |||
187 | A multi-session disk looks just like a normal disk to the user. Just | ||
188 | mount one normally, and all the data should be there. A special | ||
189 | thanks to Koen for help with this! | ||
190 | |||
191 | Raw sector I/O | ||
192 | |||
193 | Using the CDROMREADAUDIO it is possible to read raw audio and data | ||
194 | tracks. Both operations return 2352 bytes per sector. On the data | ||
195 | tracks, the first 12 bytes is not returned by the drive and the value | ||
196 | of that data is indeterminate. | ||
diff --git a/Documentation/cdrom/cm206 b/Documentation/cdrom/cm206 deleted file mode 100644 index 810368f4f7c4..000000000000 --- a/Documentation/cdrom/cm206 +++ /dev/null | |||
@@ -1,185 +0,0 @@ | |||
1 | This is the readme file for the driver for the Philips/LMS cdrom drive | ||
2 | cm206 in combination with the cm260 host adapter card. | ||
3 | |||
4 | (c) 1995 David A. van Leeuwen | ||
5 | |||
6 | Changes since version 0.99 | ||
7 | -------------------------- | ||
8 | - Interfacing to the kernel is routed though an extra interface layer, | ||
9 | cdrom.c. This allows runtime-configurable `behavior' of the cdrom-drive, | ||
10 | independent of the driver. | ||
11 | |||
12 | Features since version 0.33 | ||
13 | --------------------------- | ||
14 | - Full audio support, that is, both workman, workbone and cdp work | ||
15 | now reasonably. Reading TOC still takes some time. xmcd has been | ||
16 | reported to run successfully. | ||
17 | - Made auto-probe code a little better, I hope | ||
18 | |||
19 | Features since version 0.28 | ||
20 | --------------------------- | ||
21 | - Full speed transfer rate (300 kB/s). | ||
22 | - Minimum kernel memory usage for buffering (less than 3 kB). | ||
23 | - Multisession support. | ||
24 | - Tray locking. | ||
25 | - Statistics of driver accessible to the user. | ||
26 | - Module support. | ||
27 | - Auto-probing of adapter card's base port and irq line, | ||
28 | also configurable at boot time or module load time. | ||
29 | |||
30 | |||
31 | Decide how you are going to use the driver. There are two | ||
32 | options: | ||
33 | |||
34 | (a) installing the driver as a resident part of the kernel | ||
35 | (b) compiling the driver as a loadable module | ||
36 | |||
37 | Further, you must decide if you are going to specify the base port | ||
38 | address and the interrupt request line of the adapter card cm260 as | ||
39 | boot options for (a), module parameters for (b), use automatic | ||
40 | probing of these values, or hard-wire your adaptor card's settings | ||
41 | into the source code. If you don't care, you can choose | ||
42 | autoprobing, which is the default. In that case you can move on to | ||
43 | the next step. | ||
44 | |||
45 | Compiling the kernel | ||
46 | -------------------- | ||
47 | 1) move to /usr/src/linux and do a | ||
48 | |||
49 | make config | ||
50 | |||
51 | If you have chosen option (a), answer yes to CONFIG_CM206 and | ||
52 | CONFIG_ISO9660_FS. | ||
53 | |||
54 | If you have chosen option (b), answer yes to CONFIG_MODVERSIONS | ||
55 | and no (!) to CONFIG_CM206 and CONFIG_ISO9660_FS. | ||
56 | |||
57 | 2) then do a | ||
58 | |||
59 | make clean; make zImage; make modules | ||
60 | |||
61 | 3) do the usual things to install a new image (backup the old one, run | ||
62 | `rdev -R zImage 1', copy the new image in place, run lilo). Might | ||
63 | be `make zlilo'. | ||
64 | |||
65 | Using the driver as a module | ||
66 | ---------------------------- | ||
67 | If you will only occasionally use the cd-rom driver, you can choose | ||
68 | option (b), install as a loadable module. You may have to re-compile | ||
69 | the module when you upgrade the kernel to a new version. | ||
70 | |||
71 | Since version 0.96, much of the functionality has been transferred to | ||
72 | a generic cdrom interface in the file cdrom.c. The module cm206.o | ||
73 | depends on cdrom.o. If the latter is not compiled into the kernel, | ||
74 | you must explicitly load it before cm206.o: | ||
75 | |||
76 | insmod /usr/src/linux/modules/cdrom.o | ||
77 | |||
78 | To install the module, you use the command, as root | ||
79 | |||
80 | insmod /usr/src/linux/modules/cm206.o | ||
81 | |||
82 | You can specify the base address on the command line as well as the irq | ||
83 | line to be used, e.g. | ||
84 | |||
85 | insmod /usr/src/linux/modules/cm206.o cm206=0x300,11 | ||
86 | |||
87 | The order of base port and irq line doesn't matter; if you specify only | ||
88 | one, the other will have the value of the compiled-in default. You | ||
89 | may also have to install the file-system module `iso9660.o', if you | ||
90 | didn't compile that into the kernel. | ||
91 | |||
92 | |||
93 | Using the driver as part of the kernel | ||
94 | -------------------------------------- | ||
95 | If you have chosen option (a), you can specify the base-port | ||
96 | address and irq on the lilo boot command line, e.g.: | ||
97 | |||
98 | LILO: linux cm206=0x340,11 | ||
99 | |||
100 | This assumes that your linux kernel image keyword is `linux'. | ||
101 | If you specify either IRQ (3--11) or base port (0x300--0x370), | ||
102 | auto probing is turned off for both settings, thus setting the | ||
103 | other value to the compiled-in default. | ||
104 | |||
105 | Note that you can also put these parameters in the lilo configuration file: | ||
106 | |||
107 | # linux config | ||
108 | image = /vmlinuz | ||
109 | root = /dev/hda1 | ||
110 | label = Linux | ||
111 | append = "cm206=0x340,11" | ||
112 | read-only | ||
113 | |||
114 | |||
115 | If module parameters and LILO config options don't work | ||
116 | ------------------------------------------------------- | ||
117 | If autoprobing does not work, you can hard-wire the default values | ||
118 | of the base port address (CM206_BASE) and interrupt request line | ||
119 | (CM206_IRQ) into the file /usr/src/linux/drivers/cdrom/cm206.h. Change | ||
120 | the defines of CM206_IRQ and CM206_BASE. | ||
121 | |||
122 | |||
123 | Mounting the cdrom | ||
124 | ------------------ | ||
125 | 1) Make sure that the right device is installed in /dev. | ||
126 | |||
127 | mknod /dev/cm206cd b 32 0 | ||
128 | |||
129 | 2) Make sure there is a mount point, e.g., /cdrom | ||
130 | |||
131 | mkdir /cdrom | ||
132 | |||
133 | 3) mount using a command like this (run as root): | ||
134 | |||
135 | mount -rt iso9660 /dev/cm206cd /cdrom | ||
136 | |||
137 | 4) For user-mounts, add a line in /etc/fstab | ||
138 | |||
139 | /dev/cm206cd /cdrom iso9660 ro,noauto,user | ||
140 | |||
141 | This will allow users to give the commands | ||
142 | |||
143 | mount /cdrom | ||
144 | umount /cdrom | ||
145 | |||
146 | If things don't work | ||
147 | -------------------- | ||
148 | |||
149 | - Try to do a `dmesg' to find out if the driver said anything about | ||
150 | what is going wrong during the initialization. | ||
151 | |||
152 | - Try to do a `dd if=/dev/cm206cd | od -tc | less' to read from the | ||
153 | CD. | ||
154 | |||
155 | - Look in the /proc directory to see if `cm206' shows up under one of | ||
156 | `interrupts', `ioports', `devices' or `modules' (if applicable). | ||
157 | |||
158 | |||
159 | DISCLAIMER | ||
160 | ---------- | ||
161 | I cannot guarantee that this driver works, or that the hardware will | ||
162 | not be harmed, although I consider it most unlikely. | ||
163 | |||
164 | I hope that you'll find this driver in some way useful. | ||
165 | |||
166 | David van Leeuwen | ||
167 | david@tm.tno.nl | ||
168 | |||
169 | Note for Linux CDROM vendors | ||
170 | ----------------------------- | ||
171 | You are encouraged to include this driver on your Linux CDROM. If | ||
172 | you do, you might consider sending me a free copy of that cd-rom. | ||
173 | You can contact me through my e-mail address, david@tm.tno.nl. | ||
174 | If this driver is compiled into a kernel to boot off a cdrom, | ||
175 | you should actually send me a free copy of that cd-rom. | ||
176 | |||
177 | Copyright | ||
178 | --------- | ||
179 | The copyright of the cm206 driver for Linux is | ||
180 | |||
181 | (c) 1995 David A. van Leeuwen | ||
182 | |||
183 | The driver is released under the conditions of the GNU general public | ||
184 | license, which can be found in the file COPYING in the root of this | ||
185 | source tree. | ||
diff --git a/Documentation/cdrom/gscd b/Documentation/cdrom/gscd deleted file mode 100644 index d01ca36b5c43..000000000000 --- a/Documentation/cdrom/gscd +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | Goldstar R420 CD-Rom device driver README | ||
2 | |||
3 | For all kind of other information about the GoldStar R420 CDROM | ||
4 | and this Linux device driver see the WWW page: | ||
5 | |||
6 | http://linux.rz.fh-hannover.de/~raupach | ||
7 | |||
8 | |||
9 | If you are the editor of a Linux CD, you should | ||
10 | enable gscd.c within your boot floppy kernel. Please, | ||
11 | send me one of your CDs for free. | ||
12 | |||
13 | |||
14 | This current driver version 0.4a only supports reading data from the disk. | ||
15 | Currently we have no audio and no multisession or XA support. | ||
16 | The polling interface is used, no DMA. | ||
17 | |||
18 | |||
19 | Sometimes the GoldStar R420 is sold in a 'Reveal Multimedia Kit'. This kit's | ||
20 | drive interface is compatible, too. | ||
21 | |||
22 | |||
23 | Installation | ||
24 | ------------ | ||
25 | |||
26 | Change to '/usr/src/linux/drivers/cdrom' and edit the file 'gscd.h'. Insert | ||
27 | the i/o address of your interface card. | ||
28 | |||
29 | The default base address is 0x340. This will work for most applications. | ||
30 | Address selection is accomplished by jumpers PN801-1 to PN801-4 on the | ||
31 | GoldStar Interface Card. | ||
32 | Appropriate settings are: 0x300, 0x310, 0x320, 0x330, 0x340, 0x350, 0x360 | ||
33 | 0x370, 0x380, 0x390, 0x3A0, 0x3B0, 0x3C0, 0x3D0, 0x3E0, 0x3F0 | ||
34 | |||
35 | Then go back to '/usr/src/linux/' and 'make config' to build the new | ||
36 | configuration for your kernel. If you want to use the GoldStar driver | ||
37 | like a module, don't select 'GoldStar CDROM support'. By the way, you | ||
38 | have to include the iso9660 filesystem. | ||
39 | |||
40 | Now start compiling the kernel with 'make zImage'. | ||
41 | If you want to use the driver as a module, you have to do 'make modules' | ||
42 | and 'make modules_install', additionally. | ||
43 | Install your new kernel as usual - maybe you do it with 'make zlilo'. | ||
44 | |||
45 | Before you can use the driver, you have to | ||
46 | mknod /dev/gscd0 b 16 0 | ||
47 | to create the appropriate device file (you only need to do this once). | ||
48 | |||
49 | If you use modules, you can try to insert the driver. | ||
50 | Say: 'insmod /usr/src/linux/modules/gscd.o' | ||
51 | or: 'insmod /usr/src/linux/modules/gscd.o gscd=<address>' | ||
52 | The driver should report its results. | ||
53 | |||
54 | That's it! Mount a disk, i.e. 'mount -rt iso9660 /dev/gscd0 /cdrom' | ||
55 | |||
56 | Feel free to report errors and suggestions to the following address. | ||
57 | Be sure, I'm very happy to receive your comments! | ||
58 | |||
59 | Oliver Raupach Hannover, Juni 1995 | ||
60 | (raupach@nwfs1.rz.fh-hannover.de) | ||
diff --git a/Documentation/cdrom/isp16 b/Documentation/cdrom/isp16 deleted file mode 100644 index cc86533ac9f3..000000000000 --- a/Documentation/cdrom/isp16 +++ /dev/null | |||
@@ -1,100 +0,0 @@ | |||
1 | -- Documentation/cdrom/isp16 | ||
2 | |||
3 | Docs by Eric van der Maarel <H.T.M.v.d.Maarel@marin.nl> | ||
4 | |||
5 | This is the README for version 0.6 of the cdrom interface on an | ||
6 | ISP16, MAD16 or Mozart sound card. | ||
7 | |||
8 | The detection and configuration of this interface used to be included | ||
9 | in both the sjcd and optcd cdrom driver. Drives supported by these | ||
10 | drivers came packed with Media Magic's multi media kit, which also | ||
11 | included the ISP16 card. The idea (thanks Leo Spiekman) | ||
12 | to move it from these drivers into a separate module and moreover, not to | ||
13 | rely on the MAD16 sound driver, are as follows: | ||
14 | -duplication of code in the kernel is a waste of resources and should | ||
15 | be avoided; | ||
16 | -however, kernels and notably those included with Linux distributions | ||
17 | (cf Slackware 3.0 included version 0.5 of the isp16 configuration | ||
18 | code included in the drivers) don't always come with sound support | ||
19 | included. Especially when they already include a bunch of cdrom drivers. | ||
20 | Hence, the cdrom interface should be configurable _independently_ of | ||
21 | sound support. | ||
22 | |||
23 | The ISP16, MAD16 and Mozart sound cards have an OPTi 82C928 or an | ||
24 | OPTi 82C929 chip. The interface on these cards should work with | ||
25 | any cdrom attached to the card, which is 'electrically' compatible | ||
26 | with Sanyo/Panasonic, Sony or Mitsumi non-ide drives. However, the | ||
27 | command sets for any proprietary drives may differ | ||
28 | (and hence may not be supported in the kernel) from these four types. | ||
29 | For a fact I know the interface works and the way of configuration | ||
30 | as described in this documentation works in combination with the | ||
31 | sjcd (in Sanyo/Panasonic compatibility mode) cdrom drivers | ||
32 | (probably with the optcd (in Sony compatibility mode) as well). | ||
33 | If you have such an OPTi based sound card and you want to use the | ||
34 | cdrom interface with a cdrom drive supported by any of the other cdrom | ||
35 | drivers, it will probably work. Please let me know any experience you | ||
36 | might have). | ||
37 | I understand that cards based on the OPTi 82C929 chips may be configured | ||
38 | (hardware jumpers that is) as an IDE interface. Initialisation of such a | ||
39 | card in this mode is not supported (yet?). | ||
40 | |||
41 | The suggestion to configure the ISP16 etc. sound card by booting DOS and | ||
42 | do a warm reboot to boot Linux somehow doesn't work, at least not | ||
43 | on my machine (IPC P90), with the OPTi 82C928 based card. | ||
44 | |||
45 | Booting the kernel through the boot manager LILO allows the use | ||
46 | of some command line options on the 'LILO boot:' prompt. At boot time | ||
47 | press Alt or Shift while the LILO prompt is written on the screen and enter | ||
48 | any kernel options. Alternatively these options may be used in | ||
49 | the appropriate section in /etc/lilo.conf. Adding 'append="<cmd_line_options>"' | ||
50 | will do the trick as well. | ||
51 | The syntax of 'cmd_line_options' is | ||
52 | |||
53 | isp16=[<port>[,<irq>[,<dma>]]][[,]<drive_type>] | ||
54 | |||
55 | If there is no ISP16 or compatibles detected, there's probably no harm done. | ||
56 | These options indicate the values that your cdrom drive has been (or will be) | ||
57 | configured to use. | ||
58 | Valid values for the base i/o address are: | ||
59 | port=0x340,0x320,0x330,0x360 | ||
60 | for the interrupt request number | ||
61 | irq=0,3,5,7,9,10,11 | ||
62 | for the direct memory access line | ||
63 | dma=0,3,5,6,7 | ||
64 | and for the type of drive | ||
65 | drive_type=noisp16,Sanyo,Panasonic,Sony,Mitsumi. | ||
66 | Note that these options are case sensitive. | ||
67 | The values 0 for irq and dma indicate that they are not used, and | ||
68 | the drive will be used in 'polling' mode. The values 5 and 7 for irq | ||
69 | should be avoided in order to avoid any conflicts with optional | ||
70 | sound card configuration. | ||
71 | The syntax of the command line does not allow the specification of | ||
72 | irq when there's nothing specified for the base address and no | ||
73 | specification of dma when there is no specification of irq. | ||
74 | The value 'noisp16' for drive_type, which may be used as the first | ||
75 | non-integer option value (e.g. 'isp16=noisp16'), makes sure that probing | ||
76 | for and subsequent configuration of an ISP16-compatible card is skipped | ||
77 | all together. This can be useful to overcome possible conflicts which | ||
78 | may arise while the kernel is probing your hardware. | ||
79 | The default values are | ||
80 | port=0x340 | ||
81 | irq=0 | ||
82 | dma=0 | ||
83 | drive_type=Sanyo | ||
84 | reflecting my own configuration. The defaults can be changed in | ||
85 | the file linux/drivers/cdrom/ips16.h. | ||
86 | |||
87 | The cdrom interface can be configured at run time by loading the | ||
88 | initialisation driver as a module. In that case, the interface | ||
89 | parameters can be set by giving appropriate values on the command | ||
90 | line. Configuring the driver can then be done by the following | ||
91 | command (assuming you have iso16.o installed in a proper place): | ||
92 | |||
93 | insmod isp16.o isp16_cdrom_base=<port> isp16_cdrom_irq=<irq> \ | ||
94 | isp16_cdrom_dma=<dma> isp16_cdrom_type=<drive_type> | ||
95 | |||
96 | where port, irq, dma and drive_type can have any of the values mentioned | ||
97 | above. | ||
98 | |||
99 | |||
100 | Have fun! | ||
diff --git a/Documentation/cdrom/mcdx b/Documentation/cdrom/mcdx deleted file mode 100644 index 2bac4b7ff6da..000000000000 --- a/Documentation/cdrom/mcdx +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | If you are using the driver as a module, you can specify your ports and IRQs | ||
2 | like | ||
3 | |||
4 | # insmod mcdx.o mcdx=0x300,11,0x304,5 | ||
5 | |||
6 | and so on ("address,IRQ" pairs). | ||
7 | This will override the configuration in mcdx.h. | ||
8 | |||
9 | This driver: | ||
10 | |||
11 | o handles XA and (hopefully) multi session CDs as well as | ||
12 | ordinary CDs; | ||
13 | o supports up to 5 drives (of course, you'll need free | ||
14 | IRQs, i/o ports and slots); | ||
15 | o plays audio | ||
16 | |||
17 | This version doesn't support yet: | ||
18 | |||
19 | o shared IRQs (but it seems to be possible - I've successfully | ||
20 | connected two drives to the same irq. So it's `only' a | ||
21 | problem of the driver.) | ||
22 | |||
23 | This driver never will: | ||
24 | |||
25 | o Read digital audio (i.e. copy directly), due to missing | ||
26 | hardware features. | ||
27 | |||
28 | |||
29 | heiko@lotte.sax.de | ||
diff --git a/Documentation/cdrom/optcd b/Documentation/cdrom/optcd deleted file mode 100644 index 6f46c7adb243..000000000000 --- a/Documentation/cdrom/optcd +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | This is the README file for the Optics Storage 8000 AT CDROM device driver. | ||
2 | |||
3 | This is the driver for the so-called 'DOLPHIN' drive, with the 34-pin | ||
4 | Sony-compatible interface. For the IDE-compatible Optics Storage 8001 | ||
5 | drive, you will want the ATAPI CDROM driver. The driver also seems to | ||
6 | work with the Lasermate CR328A. If you have a drive that works with | ||
7 | this driver, and that doesn't report itself as DOLPHIN, please drop me | ||
8 | a mail. | ||
9 | |||
10 | The support for multisession CDs is in ALPHA stage. If you use it, | ||
11 | please mail me your experiences. Multisession support can be disabled | ||
12 | at compile time. | ||
13 | |||
14 | You can find some older versions of the driver at | ||
15 | dutette.et.tudelft.nl:/pub/linux/ | ||
16 | and at Eberhard's mirror | ||
17 | ftp.gwdg.de:/pub/linux/cdrom/drivers/optics/ | ||
18 | |||
19 | Before you can use the driver, you have to create the device file once: | ||
20 | # mknod /dev/optcd0 b 17 0 | ||
21 | |||
22 | To specify the base address if the driver is "compiled-in" to your kernel, | ||
23 | you can use the kernel command line item (LILO option) | ||
24 | optcd=0x340 | ||
25 | with the right address. | ||
26 | |||
27 | If you have compiled optcd as a module, you can load it with | ||
28 | # insmod /usr/src/linux/modules/optcd.o | ||
29 | or | ||
30 | # insmod /usr/src/linux/modules/optcd.o optcd=0x340 | ||
31 | with the matching address value of your interface card. | ||
32 | |||
33 | The driver employs a number of buffers to do read-ahead and block size | ||
34 | conversion. The number of buffers is configurable in optcd.h, and has | ||
35 | influence on the driver performance. For my machine (a P75), 6 buffers | ||
36 | seems optimal, as can be seen from this table: | ||
37 | |||
38 | #bufs kb/s %cpu | ||
39 | 1 97 0.1 | ||
40 | 2 191 0.3 | ||
41 | 3 188 0.2 | ||
42 | 4 246 0.3 | ||
43 | 5 189 19 | ||
44 | 6 280 0.4 | ||
45 | 7 281 7.0 | ||
46 | 8 246 2.8 | ||
47 | 16 281 3.4 | ||
48 | |||
49 | If you get a throughput significantly below 300 kb/s, try tweaking | ||
50 | N_BUFS, and don't forget to mail me your results! | ||
51 | |||
52 | I'd appreciate success/failure reports. If you find a bug, try | ||
53 | recompiling the driver with some strategically chosen debug options | ||
54 | (these can be found in optcd.h) and include the messages generated in | ||
55 | your bug report. Good luck. | ||
56 | |||
57 | Leo Spiekman (spiekman@dutette.et.tudelft.nl) | ||
diff --git a/Documentation/cdrom/sbpcd b/Documentation/cdrom/sbpcd deleted file mode 100644 index b3ba63f4ce3e..000000000000 --- a/Documentation/cdrom/sbpcd +++ /dev/null | |||
@@ -1,1061 +0,0 @@ | |||
1 | This README belongs to release 4.2 or newer of the SoundBlaster Pro | ||
2 | (Matsushita, Kotobuki, Panasonic, CreativeLabs, Longshine and Teac) | ||
3 | CD-ROM driver for Linux. | ||
4 | |||
5 | sbpcd really, really is NOT for ANY IDE/ATAPI drive! | ||
6 | Not even if you have an "original" SoundBlaster card with an IDE interface! | ||
7 | So, you'd better have a look into README.ide if your port address is 0x1F0, | ||
8 | 0x170, 0x1E8, 0x168 or similar. | ||
9 | I get tons of mails from IDE/ATAPI drive users - I really can't continue | ||
10 | any more to answer them all. So, if your drive/interface information sheets | ||
11 | mention "IDE" (primary, secondary, tertiary, quaternary) and the DOS driver | ||
12 | invoking line within your CONFIG.SYS is using an address below 0x230: | ||
13 | DON'T ROB MY LAST NERVE - jumper your interface to address 0x170 and IRQ 15 | ||
14 | (that is the "secondary IDE" configuration), set your drive to "master" and | ||
15 | use ide-cd as your driver. If you do not have a second IDE hard disk, use the | ||
16 | LILO commands | ||
17 | hdb=noprobe hdc=cdrom | ||
18 | and get lucky. | ||
19 | To make it fully clear to you: if you mail me about IDE/ATAPI drive problems, | ||
20 | my answer is above, and I simply will discard your mail, hoping to stop the | ||
21 | flood and to find time to lead my 12-year old son towards happy computing. | ||
22 | |||
23 | The driver is able to drive the whole family of "traditional" AT-style (that | ||
24 | is NOT the new "Enhanced IDE" or "ATAPI" drive standard) Matsushita, | ||
25 | Kotobuki, Panasonic drives, sometimes labelled as "CreativeLabs". The | ||
26 | well-known drives are CR-521, CR-522, CR-523, CR-562, CR-563. | ||
27 | CR-574 is an IDE/ATAPI drive. | ||
28 | |||
29 | The Longshine LCS-7260 is a double-speed drive which uses the "old" | ||
30 | Matsushita command set. It is supported - with help by Serge Robyns. | ||
31 | Vertos ("Elitegroup Computer Systems", ECS) has a similar drive - support | ||
32 | has started; get in contact if you have such a "Vertos 100" or "ECS-AT" | ||
33 | drive. | ||
34 | |||
35 | There exists an "IBM External ISA CD-ROM Drive" which in fact is a CR-563 | ||
36 | with a special controller board. This drive is supported (the interface is | ||
37 | of the "LaserMate" type), and it is possibly the best buy today (cheaper than | ||
38 | an internal drive, and you can use it as an internal, too - e.g. plug it into | ||
39 | a soundcard). | ||
40 | |||
41 | CreativeLabs has a new drive "CD200" and a similar drive "CD200F". The latter | ||
42 | is made by Funai and sometimes named "E2550UA", newer models may be named | ||
43 | "MK4015". The CD200F drives should fully work. | ||
44 | CD200 drives without "F" are still giving problems: drive detection and | ||
45 | playing audio should work, data access will result in errors. I need qualified | ||
46 | feedback about the bugs within the data functions or a drive (I never saw a | ||
47 | CD200). | ||
48 | |||
49 | The quad-speed Teac CD-55A drive is supported, but still does not reach "full | ||
50 | speed". The data rate already reaches 500 kB/sec if you set SBP_BUFFER_FRAMES | ||
51 | to 64 (it is not recommended to do that for normal "file access" usage, but it | ||
52 | can speed up things a lot if you use something like "dd" to read from the | ||
53 | drive; I use it for verifying self-written CDs this way). | ||
54 | The drive itself is able to deliver 600 kB/sec, so this needs | ||
55 | work; with the normal setup, the performance currently is not even as good as | ||
56 | double-speed. | ||
57 | |||
58 | This driver is NOT for Mitsumi or Sony or Aztech or Philips or XXX drives, | ||
59 | and again: this driver is in no way usable for any IDE/ATAPI drive. If you | ||
60 | think your drive should work and it doesn't: send me the DOS driver for your | ||
61 | beast (gzipped + uuencoded) and your CONFIG.SYS if you want to ask me for help, | ||
62 | and include an original log message excerpt, and try to give all information | ||
63 | a complete idiot needs to understand your hassle already with your first | ||
64 | mail. And if you want to say "as I have mailed you before", be sure that I | ||
65 | don't remember your "case" by such remarks; at the moment, I have some | ||
66 | hundreds of open correspondences about Linux CDROM questions (hope to reduce if | ||
67 | the IDE/ATAPI user questions disappear). | ||
68 | |||
69 | |||
70 | This driver will work with the soundcard interfaces (SB Pro, SB 16, Galaxy, | ||
71 | SoundFX, Mozart, MAD16 ...) and with the "no-sound" cards (Panasonic CI-101P, | ||
72 | LaserMate, WDH-7001C, Longshine LCS-6853, Teac ...). | ||
73 | |||
74 | It works with the "configurable" interface "Sequoia S-1000", too, which is | ||
75 | used on the Spea Media FX and Ensonic Soundscape sound cards. You have to | ||
76 | specify the type "SBPRO 2" and the true CDROM port address with it, not the | ||
77 | "configuration port" address. | ||
78 | |||
79 | If you have a sound card which needs a "configuration driver" instead of | ||
80 | jumpers for interface types and addresses (like Mozart cards) - those | ||
81 | drivers get invoked before the DOS CDROM driver in your CONFIG.SYS, typical | ||
82 | names are "cdsetup.sys" and "mztinit.sys" - let the sound driver do the | ||
83 | CDROM port configuration (the leading comments in linux/drivers/sound/mad16.c | ||
84 | are just for you!). Hannu Savolainen's mad16.c code is able to set up my | ||
85 | Mozart card - I simply had to add | ||
86 | #define MAD16_CONF 0x06 | ||
87 | #define MAD16_CDSEL 0x03 | ||
88 | to configure the CDROM interface for type "Panasonic" (LaserMate) and address | ||
89 | 0x340. | ||
90 | |||
91 | The interface type has to get configured in linux/drivers/cdrom/sbpcd.h, | ||
92 | because the register layout is different between the "SoundBlaster" and the | ||
93 | "LaserMate" type. | ||
94 | |||
95 | I got a report that the Teac interface card "I/F E117098" is of type | ||
96 | "SoundBlaster" (i.e. you have to set SBPRO to 1) even with the addresses | ||
97 | 0x300 and above. This is unusual, and it can't get covered by the auto | ||
98 | probing scheme. | ||
99 | The Teac 16-bit interface cards (like P/N E950228-00A, default address 0x2C0) | ||
100 | need the SBPRO 3 setup. | ||
101 | |||
102 | If auto-probing found the drive, the address is correct. The reported type | ||
103 | may be wrong. A "mount" will give success only if the interface type is set | ||
104 | right. Playing audio should work with a wrong set interface type, too. | ||
105 | |||
106 | With some Teac and some CD200 drives I have seen interface cards which seem | ||
107 | to lack the "drive select" lines; always drive 0 gets addressed. To avoid | ||
108 | "mirror drives" (four drives detected where you only have one) with such | ||
109 | interface cards, set MAX_DRIVES to 1 and jumper your drive to ID 0 (if | ||
110 | possible). | ||
111 | |||
112 | |||
113 | Up to 4 drives per interface card, and up to 4 interface cards are supported. | ||
114 | All supported drive families can be mixed, but the CR-521 drives are | ||
115 | hard-wired to drive ID 0. The drives have to use different drive IDs, and each | ||
116 | drive has to get a unique minor number (0...3), corresponding indirectly to | ||
117 | its drive ID. | ||
118 | The drive IDs may be selected freely from 0 to 3 - they do not have to be in | ||
119 | consecutive order. | ||
120 | |||
121 | As Don Carroll, don@ds9.us.dell.com or FIDO 1:382/14, told me, it is possible | ||
122 | to change old drives to any ID, too. He writes in this sense: | ||
123 | "In order to be able to use more than one single speed drive | ||
124 | (they do not have the ID jumpers) you must add a DIP switch | ||
125 | and two resistors. The pads are already on the board next to | ||
126 | the power connector. You will see the silkscreen for the | ||
127 | switch if you remove the top cover. | ||
128 | 1 2 3 4 | ||
129 | ID 0 = x F F x O = "on" | ||
130 | ID 1 = x O F x F = "off" | ||
131 | ID 2 = x F O x x = "don't care" | ||
132 | ID 3 = x O O x | ||
133 | Next to the switch are the positions for R76 (7k) and R78 | ||
134 | (12k). I had to play around with the resistor values - ID 3 | ||
135 | did not work with other values. If the values are not good, | ||
136 | ID 3 behaves like ID 0." | ||
137 | |||
138 | To use more than 4 drives, you simply need a second controller card at a | ||
139 | different address and a second cable. | ||
140 | |||
141 | The driver supports reading of data from the CD and playing of audio tracks. | ||
142 | The audio part should run with WorkMan, xcdplayer, with the "non-X11" products | ||
143 | CDplayer and WorkBone - tell me if it is not compatible with other software. | ||
144 | The only accepted measure for correctness with the audio functions is the | ||
145 | "cdtester" utility (appended) - most audio player programmers seem to be | ||
146 | better musicians than programmers. ;-) | ||
147 | |||
148 | With the CR-56x and the CD200 drives, the reading of audio frames is possible. | ||
149 | This is implemented by an IOCTL function which reads READ_AUDIO frames of | ||
150 | 2352 bytes at once (configurable with the "READ_AUDIO" define, default is 0). | ||
151 | Reading the same frame a second time gives different data; the frame data | ||
152 | start at a different position, but all read bytes are valid, and we always | ||
153 | read 98 consecutive chunks (of 24 Bytes) as a frame. Reading more than 1 frame | ||
154 | at once possibly misses some chunks at each frame boundary. This lack has to | ||
155 | get corrected by external, "higher level" software which reads the same frame | ||
156 | again and tries to find and eliminate overlapping chunks (24-byte-pieces). | ||
157 | |||
158 | The transfer rate with reading audio (1-frame-pieces) currently is very slow. | ||
159 | This can be better reading bigger chunks, but the "missing" chunks possibly | ||
160 | occur at the beginning of each single frame. | ||
161 | The software interface possibly may change a bit the day the SCSI driver | ||
162 | supports it too. | ||
163 | |||
164 | With all but the CR-52x drives, MultiSession is supported. | ||
165 | Photo CDs work (the "old" drives like CR-521 can access only the first | ||
166 | session of a photoCD). | ||
167 | At ftp.gwdg.de:/pub/linux/hpcdtoppm/ you will find Hadmut Danisch's package to | ||
168 | convert photo CD image files and Gerd Knorr's viewing utility. | ||
169 | |||
170 | The transfer rate will reach 150 kB/sec with CR-52x drives, 300 kB/sec with | ||
171 | CR-56x drives, and currently not more than 500 kB/sec (usually less than | ||
172 | 250 kB/sec) with the Teac quad speed drives. | ||
173 | XA (PhotoCD) disks with "old" drives give only 50 kB/sec. | ||
174 | |||
175 | This release consists of | ||
176 | - this README file | ||
177 | - the driver file linux/drivers/cdrom/sbpcd.c | ||
178 | - the stub files linux/drivers/cdrom/sbpcd[234].c | ||
179 | - the header file linux/drivers/cdrom/sbpcd.h. | ||
180 | |||
181 | |||
182 | To install: | ||
183 | ----------- | ||
184 | |||
185 | 1. Setup your hardware parameters. Though the driver does "auto-probing" at a | ||
186 | lot of (not all possible!) addresses, this step is recommended for | ||
187 | everyday use. You should let sbpcd auto-probe once and use the reported | ||
188 | address if a drive got found. The reported type may be incorrect; it is | ||
189 | correct if you can mount a data CD. There is no choice for you with the | ||
190 | type; only one is right, the others are deadly wrong. | ||
191 | |||
192 | a. Go into /usr/src/linux/drivers/cdrom/sbpcd.h and configure it for your | ||
193 | hardware (near the beginning): | ||
194 | a1. Set it up for the appropriate type of interface board. | ||
195 | "Original" CreativeLabs sound cards need "SBPRO 1". | ||
196 | Most "compatible" sound cards (almost all "non-CreativeLabs" cards) | ||
197 | need "SBPRO 0". | ||
198 | The "no-sound" board from OmniCd needs the "SBPRO 1" setup. | ||
199 | The Teac 8-bit "no-sound" boards need the "SBPRO 1" setup. | ||
200 | The Teac 16-bit "no-sound" boards need the "SBPRO 3" setup. | ||
201 | All other "no-sound" boards need the "SBPRO 0" setup. | ||
202 | The Spea Media FX and Ensoniq SoundScape cards need "SBPRO 2". | ||
203 | sbpcd.c holds some examples in its auto-probe list. | ||
204 | If you configure "SBPRO" wrong, the playing of audio CDs will work, | ||
205 | but you will not be able to mount a data CD. | ||
206 | a2. Tell the address of your CDROM_PORT (not of the sound port). | ||
207 | a3. If 4 drives get found, but you have only one, set MAX_DRIVES to 1. | ||
208 | a4. Set DISTRIBUTION to 0. | ||
209 | b. Additionally for 2.a1 and 2.a2, the setup may be done during | ||
210 | boot time (via the "kernel command line" or "LILO option"): | ||
211 | sbpcd=0x320,LaserMate | ||
212 | or | ||
213 | sbpcd=0x230,SoundBlaster | ||
214 | or | ||
215 | sbpcd=0x338,SoundScape | ||
216 | or | ||
217 | sbpcd=0x2C0,Teac16bit | ||
218 | This is especially useful if you install a fresh distribution. | ||
219 | If the second parameter is a number, it gets taken as the type | ||
220 | setting; 0 is "LaserMate", 1 is "SoundBlaster", 2 is "SoundScape", | ||
221 | 3 is "Teac16bit". | ||
222 | So, for example | ||
223 | sbpcd=0x230,1 | ||
224 | is equivalent to | ||
225 | sbpcd=0x230,SoundBlaster | ||
226 | |||
227 | 2. "cd /usr/src/linux" and do a "make config" and select "y" for Matsushita | ||
228 | CD-ROM support and for ISO9660 FileSystem support. If you do not have a | ||
229 | second, third, or fourth controller installed, do not say "y" to the | ||
230 | secondary Matsushita CD-ROM questions. | ||
231 | |||
232 | 3. Then make the kernel image ("make zlilo" or similar). | ||
233 | |||
234 | 4. Make the device file(s). This step usually already has been done by the | ||
235 | MAKEDEV script. | ||
236 | The driver uses MAJOR 25, so, if necessary, do | ||
237 | mknod /dev/sbpcd b 25 0 (if you have only one drive) | ||
238 | and/or | ||
239 | mknod /dev/sbpcd0 b 25 0 | ||
240 | mknod /dev/sbpcd1 b 25 1 | ||
241 | mknod /dev/sbpcd2 b 25 2 | ||
242 | mknod /dev/sbpcd3 b 25 3 | ||
243 | to make the node(s). | ||
244 | |||
245 | The "first found" drive gets MINOR 0 (regardless of its jumpered ID), the | ||
246 | "next found" (at the same cable) gets MINOR 1, ... | ||
247 | |||
248 | For a second interface board, you have to make nodes like | ||
249 | mknod /dev/sbpcd4 b 26 0 | ||
250 | mknod /dev/sbpcd5 b 26 1 | ||
251 | and so on. Use the MAJORs 26, 27, 28. | ||
252 | |||
253 | If you further make a link like | ||
254 | ln -s sbpcd /dev/cdrom | ||
255 | you can use the name /dev/cdrom, too. | ||
256 | |||
257 | 5. Reboot with the new kernel. | ||
258 | |||
259 | You should now be able to do | ||
260 | mkdir /CD | ||
261 | and | ||
262 | mount -rt iso9660 /dev/sbpcd /CD | ||
263 | or | ||
264 | mount -rt iso9660 -o block=2048 /dev/sbpcd /CD | ||
265 | and see the contents of your CD in the /CD directory. | ||
266 | To use audio CDs, a mounting is not recommended (and it would fail if the | ||
267 | first track is not a data track). | ||
268 | |||
269 | |||
270 | Using sbpcd as a "loadable module": | ||
271 | ----------------------------------- | ||
272 | |||
273 | If you do NOT select "Matsushita/Panasonic CDROM driver support" during the | ||
274 | "make config" of your kernel, you can build the "loadable module" sbpcd.o. | ||
275 | |||
276 | If sbpcd gets used as a module, the support of more than one interface | ||
277 | card (i.e. drives 4...15) is disabled. | ||
278 | |||
279 | You can specify interface address and type with the "insmod" command like: | ||
280 | # insmod /usr/src/linux/modules/sbpcd.o sbpcd=0x340,0 | ||
281 | or | ||
282 | # insmod /usr/src/linux/modules/sbpcd.o sbpcd=0x230,1 | ||
283 | or | ||
284 | # insmod /usr/src/linux/modules/sbpcd.o sbpcd=0x338,2 | ||
285 | where the last number represents the SBPRO setting (no strings allowed here). | ||
286 | |||
287 | |||
288 | Things of interest: | ||
289 | ------------------- | ||
290 | |||
291 | The driver is configured to try the LaserMate type of interface at I/O port | ||
292 | 0x0340 first. If this is not appropriate, sbpcd.h should get changed | ||
293 | (you will find the right place - just at the beginning). | ||
294 | |||
295 | No DMA and no IRQ is used. | ||
296 | |||
297 | To reduce or increase the amount of kernel messages, edit sbpcd.c and play | ||
298 | with the "DBG_xxx" switches (initialization of the variable "sbpcd_debug"). | ||
299 | Don't forget to reflect on what you do; enabling all DBG_xxx switches at once | ||
300 | may crash your system, and each message line is accompanied by a delay. | ||
301 | |||
302 | The driver uses the "variable BLOCK_SIZE" feature. To use it, you have to | ||
303 | specify "block=2048" as a mount option. Doing this will disable the direct | ||
304 | execution of a binary from the CD; you have to copy it to a device with the | ||
305 | standard BLOCK_SIZE (1024) first. So, do not use this if your system is | ||
306 | directly "running from the CDROM" (like some of Yggdrasil's installation | ||
307 | variants). There are CDs on the market (like the German "unifix" Linux | ||
308 | distribution) which MUST get handled with a block_size of 1024. Generally, | ||
309 | one can say all the CDs which hold files of the name YMTRANS.TBL are defective; | ||
310 | do not use block=2048 with those. | ||
311 | |||
312 | Within sbpcd.h, you will find some "#define"s (e.g. EJECT and JUKEBOX). With | ||
313 | these, you can configure the driver for some special things. | ||
314 | You can use the appended program "cdtester" to set the auto-eject feature | ||
315 | during runtime. Jeff Tranter's "eject" utility can do this, too (and more) | ||
316 | for you. | ||
317 | |||
318 | There is an ioctl CDROMMULTISESSION to obtain with a user program if | ||
319 | the CD is an XA disk and - if it is - where the last session starts. The | ||
320 | "cdtester" program illustrates how to call it. | ||
321 | |||
322 | |||
323 | Auto-probing at boot time: | ||
324 | -------------------------- | ||
325 | |||
326 | The driver does auto-probing at many well-known interface card addresses, | ||
327 | but not all: | ||
328 | Some probings can cause a hang if an NE2000 ethernet card gets touched, because | ||
329 | SBPCD's auto-probing happens before the initialization of the net drivers. | ||
330 | Those "hazardous" addresses are excluded from auto-probing; the "kernel | ||
331 | command line" feature has to be used during installation if you have your | ||
332 | drive at those addresses. The "module" version is allowed to probe at those | ||
333 | addresses, too. | ||
334 | |||
335 | The auto-probing looks first at the configured address resp. the address | ||
336 | submitted by the kernel command line. With this, it is possible to use this | ||
337 | driver within installation boot floppies, and for any non-standard address, | ||
338 | too. | ||
339 | |||
340 | Auto-probing will make an assumption about the interface type ("SBPRO" or not), | ||
341 | based upon the address. That assumption may be wrong (initialization will be | ||
342 | o.k., but you will get I/O errors during mount). In that case, use the "kernel | ||
343 | command line" feature and specify address & type at boot time to find out the | ||
344 | right setup. | ||
345 | |||
346 | For everyday use, address and type should get configured within sbpcd.h. That | ||
347 | will stop the auto-probing due to success with the first try. | ||
348 | |||
349 | The kernel command "sbpcd=0" suppresses each auto-probing and causes | ||
350 | the driver not to find any drive; it is meant for people who love sbpcd | ||
351 | so much that they do not want to miss it, even if they miss the drives. ;-) | ||
352 | |||
353 | If you configure "#define CDROM_PORT 0" in sbpcd.h, the auto-probing is | ||
354 | initially disabled and needs an explicit kernel command to get activated. | ||
355 | Once activated, it does not stop before success or end-of-list. This may be | ||
356 | useful within "universal" CDROM installation boot floppies (but using the | ||
357 | loadable module would be better because it allows an "extended" auto-probing | ||
358 | without fearing NE2000 cards). | ||
359 | |||
360 | To shorten the auto-probing list to a single entry, set DISTRIBUTION 0 within | ||
361 | sbpcd.h. | ||
362 | |||
363 | |||
364 | Setting up address and interface type: | ||
365 | -------------------------------------- | ||
366 | |||
367 | If your I/O port address is not 0x340, you have to look for the #defines near | ||
368 | the beginning of sbpcd.h and configure them: set SBPRO to 0 or 1 or 2, and | ||
369 | change CDROM_PORT to the address of your CDROM I/O port. | ||
370 | |||
371 | Almost all of the "SoundBlaster compatible" cards behave like the no-sound | ||
372 | interfaces, i.e. need SBPRO 0! | ||
373 | |||
374 | With "original" SB Pro cards, an initial setting of CD_volume through the | ||
375 | sound card's MIXER register gets done. | ||
376 | If you are using a "compatible" sound card of types "LaserMate" or "SPEA", | ||
377 | you can set SOUND_BASE (in sbpcd.h) to get it done with your card, too... | ||
378 | |||
379 | |||
380 | Using audio CDs: | ||
381 | ---------------- | ||
382 | |||
383 | Workman, WorkBone, xcdplayer, cdplayer and the nice little tool "cdplay" (see | ||
384 | README.aztcd from the Aztech driver package) should work. | ||
385 | |||
386 | The program CDplayer likes to talk to "/dev/mcd" only, xcdplayer wants | ||
387 | "/dev/rsr0", workman loves "/dev/sr0" or "/dev/cdrom" - so, make the | ||
388 | appropriate links to use them without the need to supply parameters. | ||
389 | |||
390 | |||
391 | Copying audio tracks: | ||
392 | --------------------- | ||
393 | |||
394 | The following program will copy track 1 (or a piece of it) from an audio CD | ||
395 | into the file "track01": | ||
396 | |||
397 | /*=================== begin program ========================================*/ | ||
398 | /* | ||
399 | * read an audio track from a CD | ||
400 | * | ||
401 | * (c) 1994 Eberhard Moenkeberg <emoenke@gwdg.de> | ||
402 | * may be used & enhanced freely | ||
403 | * | ||
404 | * Due to non-existent sync bytes at the beginning of each audio frame (or due | ||
405 | * to a firmware bug within all known drives?), it is currently a kind of | ||
406 | * fortune if two consecutive frames fit together. | ||
407 | * Usually, they overlap, or a little piece is missing. This happens in units | ||
408 | * of 24-byte chunks. It has to get fixed by higher-level software (reading | ||
409 | * until an overlap occurs, and then eliminate the overlapping chunks). | ||
410 | * ftp.gwdg.de:/pub/linux/misc/cdda2wav-sbpcd.*.tar.gz holds an example of | ||
411 | * such an algorithm. | ||
412 | * This example program further is missing to obtain the SubChannel data | ||
413 | * which belong to each frame. | ||
414 | * | ||
415 | * This is only an example of the low-level access routine. The read data are | ||
416 | * pure 16-bit CDDA values; they have to get converted to make sound out of | ||
417 | * them. | ||
418 | * It is no fun to listen to it without prior overlap/underlap correction! | ||
419 | */ | ||
420 | #include <stdio.h> | ||
421 | #include <sys/ioctl.h> | ||
422 | #include <sys/types.h> | ||
423 | #include <linux/cdrom.h> | ||
424 | |||
425 | static struct cdrom_tochdr hdr; | ||
426 | static struct cdrom_tocentry entry[101]; | ||
427 | static struct cdrom_read_audio arg; | ||
428 | static u_char buffer[CD_FRAMESIZE_RAW]; | ||
429 | static int datafile, drive; | ||
430 | static int i, j, limit, track, err; | ||
431 | static char filename[32]; | ||
432 | |||
433 | int main(int argc, char *argv[]) | ||
434 | { | ||
435 | /* | ||
436 | * open /dev/cdrom | ||
437 | */ | ||
438 | drive=open("/dev/cdrom", 0); | ||
439 | if (drive<0) | ||
440 | { | ||
441 | fprintf(stderr, "can't open drive.\n"); | ||
442 | exit (-1); | ||
443 | } | ||
444 | /* | ||
445 | * get TocHeader | ||
446 | */ | ||
447 | fprintf(stdout, "getting TocHeader...\n"); | ||
448 | err=ioctl(drive, CDROMREADTOCHDR, &hdr); | ||
449 | if (err!=0) | ||
450 | { | ||
451 | fprintf(stderr, "can't get TocHeader (error %d).\n", err); | ||
452 | exit (-1); | ||
453 | } | ||
454 | else | ||
455 | fprintf(stdout, "TocHeader: %d %d\n", hdr.cdth_trk0, hdr.cdth_trk1); | ||
456 | /* | ||
457 | * get and display all TocEntries | ||
458 | */ | ||
459 | fprintf(stdout, "getting TocEntries...\n"); | ||
460 | for (i=1;i<=hdr.cdth_trk1+1;i++) | ||
461 | { | ||
462 | if (i!=hdr.cdth_trk1+1) entry[i].cdte_track = i; | ||
463 | else entry[i].cdte_track = CDROM_LEADOUT; | ||
464 | entry[i].cdte_format = CDROM_LBA; | ||
465 | err=ioctl(drive, CDROMREADTOCENTRY, &entry[i]); | ||
466 | if (err!=0) | ||
467 | { | ||
468 | fprintf(stderr, "can't get TocEntry #%d (error %d).\n", i, err); | ||
469 | exit (-1); | ||
470 | } | ||
471 | else | ||
472 | { | ||
473 | fprintf(stdout, "TocEntry #%d: %1X %1X %06X %02X\n", | ||
474 | entry[i].cdte_track, | ||
475 | entry[i].cdte_adr, | ||
476 | entry[i].cdte_ctrl, | ||
477 | entry[i].cdte_addr.lba, | ||
478 | entry[i].cdte_datamode); | ||
479 | } | ||
480 | } | ||
481 | fprintf(stdout, "got all TocEntries.\n"); | ||
482 | /* | ||
483 | * ask for track number (not implemented here) | ||
484 | */ | ||
485 | track=1; | ||
486 | #if 0 /* just read a little piece (4 seconds) */ | ||
487 | entry[track+1].cdte_addr.lba=entry[track].cdte_addr.lba+300; | ||
488 | #endif | ||
489 | /* | ||
490 | * read track into file | ||
491 | */ | ||
492 | sprintf(filename, "track%02d\0", track); | ||
493 | datafile=creat(filename, 0755); | ||
494 | if (datafile<0) | ||
495 | { | ||
496 | fprintf(stderr, "can't open datafile %s.\n", filename); | ||
497 | exit (-1); | ||
498 | } | ||
499 | arg.addr.lba=entry[track].cdte_addr.lba; | ||
500 | arg.addr_format=CDROM_LBA; /* CDROM_MSF would be possible here, too. */ | ||
501 | arg.nframes=1; | ||
502 | arg.buf=&buffer[0]; | ||
503 | limit=entry[track+1].cdte_addr.lba; | ||
504 | for (;arg.addr.lba<limit;arg.addr.lba++) | ||
505 | { | ||
506 | err=ioctl(drive, CDROMREADAUDIO, &arg); | ||
507 | if (err!=0) | ||
508 | { | ||
509 | fprintf(stderr, "can't read abs. frame #%d (error %d).\n", | ||
510 | arg.addr.lba, err); | ||
511 | } | ||
512 | j=write(datafile, &buffer[0], CD_FRAMESIZE_RAW); | ||
513 | if (j!=CD_FRAMESIZE_RAW) | ||
514 | { | ||
515 | fprintf(stderr,"I/O error (datafile) at rel. frame %d\n", | ||
516 | arg.addr.lba-entry[track].cdte_addr.lba); | ||
517 | } | ||
518 | arg.addr.lba++; | ||
519 | } | ||
520 | return 0; | ||
521 | } | ||
522 | /*===================== end program ========================================*/ | ||
523 | |||
524 | At ftp.gwdg.de:/pub/linux/misc/cdda2wav-sbpcd.*.tar.gz is an adapted version of | ||
525 | Heiko Eissfeldt's digital-audio to .WAV converter (the original is there, too). | ||
526 | This is preliminary, as Heiko himself will care about it. | ||
527 | |||
528 | |||
529 | Known problems: | ||
530 | --------------- | ||
531 | |||
532 | Currently, the detection of disk change or removal is actively disabled. | ||
533 | |||
534 | Most attempts to read the UPC/EAN code result in a stream of zeroes. All my | ||
535 | drives are mostly telling there is no UPC/EAN code on disk or there is, but it | ||
536 | is an all-zero number. I guess now almost no CD holds such a number. | ||
537 | |||
538 | Bug reports, comments, wishes, donations (technical information is a donation, | ||
539 | too :-) etc. to emoenke@gwdg.de. | ||
540 | |||
541 | SnailMail address, preferable for CD editors if they want to submit a free | ||
542 | "cooperation" copy: | ||
543 | Eberhard Moenkeberg | ||
544 | Reinholdstr. 14 | ||
545 | D-37083 Goettingen | ||
546 | Germany | ||
547 | --- | ||
548 | |||
549 | |||
550 | Appendix -- the "cdtester" utility: | ||
551 | |||
552 | /* | ||
553 | * cdtester.c -- test the audio functions of a CD driver | ||
554 | * | ||
555 | * (c) 1995 Eberhard Moenkeberg <emoenke@gwdg.de> | ||
556 | * published under the GPL | ||
557 | * | ||
558 | * made under heavy use of the "Tiny Audio CD Player" | ||
559 | * from Werner Zimmermann <zimmerma@rz.fht-esslingen.de> | ||
560 | * (see linux/drivers/block/README.aztcd) | ||
561 | */ | ||
562 | #undef AZT_PRIVATE_IOCTLS /* not supported by every CDROM driver */ | ||
563 | #define SBP_PRIVATE_IOCTLS /* not supported by every CDROM driver */ | ||
564 | |||
565 | #include <stdio.h> | ||
566 | #include <stdio.h> | ||
567 | #include <malloc.h> | ||
568 | #include <sys/ioctl.h> | ||
569 | #include <sys/types.h> | ||
570 | #include <linux/cdrom.h> | ||
571 | |||
572 | #ifdef AZT_PRIVATE_IOCTLS | ||
573 | #include <linux/../../drivers/cdrom/aztcd.h> | ||
574 | #endif /* AZT_PRIVATE_IOCTLS */ | ||
575 | #ifdef SBP_PRIVATE_IOCTLS | ||
576 | #include <linux/../../drivers/cdrom/sbpcd.h> | ||
577 | #include <linux/fs.h> | ||
578 | #endif /* SBP_PRIVATE_IOCTLS */ | ||
579 | |||
580 | struct cdrom_tochdr hdr; | ||
581 | struct cdrom_tochdr tocHdr; | ||
582 | struct cdrom_tocentry TocEntry[101]; | ||
583 | struct cdrom_tocentry entry; | ||
584 | struct cdrom_multisession ms_info; | ||
585 | struct cdrom_read_audio read_audio; | ||
586 | struct cdrom_ti ti; | ||
587 | struct cdrom_subchnl subchnl; | ||
588 | struct cdrom_msf msf; | ||
589 | struct cdrom_volctrl volctrl; | ||
590 | #ifdef AZT_PRIVATE_IOCTLS | ||
591 | union | ||
592 | { | ||
593 | struct cdrom_msf msf; | ||
594 | unsigned char buf[CD_FRAMESIZE_RAW]; | ||
595 | } azt; | ||
596 | #endif /* AZT_PRIVATE_IOCTLS */ | ||
597 | int i, i1, i2, i3, j, k; | ||
598 | unsigned char sequence=0; | ||
599 | unsigned char command[80]; | ||
600 | unsigned char first=1, last=1; | ||
601 | char *default_device="/dev/cdrom"; | ||
602 | char dev[20]; | ||
603 | char filename[20]; | ||
604 | int drive; | ||
605 | int datafile; | ||
606 | int rc; | ||
607 | |||
608 | void help(void) | ||
609 | { | ||
610 | printf("Available Commands:\n"); | ||
611 | printf("STOP s EJECT e QUIT q\n"); | ||
612 | printf("PLAY TRACK t PAUSE p RESUME r\n"); | ||
613 | printf("NEXT TRACK n REPEAT LAST l HELP h\n"); | ||
614 | printf("SUBCHANNEL_Q c TRACK INFO i PLAY AT a\n"); | ||
615 | printf("READ d READ RAW w READ AUDIO A\n"); | ||
616 | printf("MS-INFO M TOC T START S\n"); | ||
617 | printf("SET EJECTSW X DEVICE D DEBUG Y\n"); | ||
618 | printf("AUDIO_BUFSIZ Z RESET R SET VOLUME v\n"); | ||
619 | printf("GET VOLUME V\n"); | ||
620 | } | ||
621 | |||
622 | /* | ||
623 | * convert MSF number (3 bytes only) to Logical_Block_Address | ||
624 | */ | ||
625 | int msf2lba(u_char *msf) | ||
626 | { | ||
627 | int i; | ||
628 | |||
629 | i=(msf[0] * CD_SECS + msf[1]) * CD_FRAMES + msf[2] - CD_BLOCK_OFFSET; | ||
630 | if (i<0) return (0); | ||
631 | return (i); | ||
632 | } | ||
633 | /* | ||
634 | * convert logical_block_address to m-s-f_number (3 bytes only) | ||
635 | */ | ||
636 | void lba2msf(int lba, unsigned char *msf) | ||
637 | { | ||
638 | lba += CD_BLOCK_OFFSET; | ||
639 | msf[0] = lba / (CD_SECS*CD_FRAMES); | ||
640 | lba %= CD_SECS*CD_FRAMES; | ||
641 | msf[1] = lba / CD_FRAMES; | ||
642 | msf[2] = lba % CD_FRAMES; | ||
643 | } | ||
644 | |||
645 | int init_drive(char *dev) | ||
646 | { | ||
647 | unsigned char msf_ent[3]; | ||
648 | |||
649 | /* | ||
650 | * open the device | ||
651 | */ | ||
652 | drive=open(dev,0); | ||
653 | if (drive<0) return (-1); | ||
654 | /* | ||
655 | * get TocHeader | ||
656 | */ | ||
657 | printf("getting TocHeader...\n"); | ||
658 | rc=ioctl(drive,CDROMREADTOCHDR,&hdr); | ||
659 | if (rc!=0) | ||
660 | { | ||
661 | printf("can't get TocHeader (error %d).\n",rc); | ||
662 | return (-2); | ||
663 | } | ||
664 | else | ||
665 | first=hdr.cdth_trk0; | ||
666 | last=hdr.cdth_trk1; | ||
667 | printf("TocHeader: %d %d\n",hdr.cdth_trk0,hdr.cdth_trk1); | ||
668 | /* | ||
669 | * get and display all TocEntries | ||
670 | */ | ||
671 | printf("getting TocEntries...\n"); | ||
672 | for (i=1;i<=hdr.cdth_trk1+1;i++) | ||
673 | { | ||
674 | if (i!=hdr.cdth_trk1+1) TocEntry[i].cdte_track = i; | ||
675 | else TocEntry[i].cdte_track = CDROM_LEADOUT; | ||
676 | TocEntry[i].cdte_format = CDROM_LBA; | ||
677 | rc=ioctl(drive,CDROMREADTOCENTRY,&TocEntry[i]); | ||
678 | if (rc!=0) | ||
679 | { | ||
680 | printf("can't get TocEntry #%d (error %d).\n",i,rc); | ||
681 | } | ||
682 | else | ||
683 | { | ||
684 | lba2msf(TocEntry[i].cdte_addr.lba,&msf_ent[0]); | ||
685 | if (TocEntry[i].cdte_track==CDROM_LEADOUT) | ||
686 | { | ||
687 | printf("TocEntry #%02X: %1X %1X %02d:%02d:%02d (lba: 0x%06X) %02X\n", | ||
688 | TocEntry[i].cdte_track, | ||
689 | TocEntry[i].cdte_adr, | ||
690 | TocEntry[i].cdte_ctrl, | ||
691 | msf_ent[0], | ||
692 | msf_ent[1], | ||
693 | msf_ent[2], | ||
694 | TocEntry[i].cdte_addr.lba, | ||
695 | TocEntry[i].cdte_datamode); | ||
696 | } | ||
697 | else | ||
698 | { | ||
699 | printf("TocEntry #%02d: %1X %1X %02d:%02d:%02d (lba: 0x%06X) %02X\n", | ||
700 | TocEntry[i].cdte_track, | ||
701 | TocEntry[i].cdte_adr, | ||
702 | TocEntry[i].cdte_ctrl, | ||
703 | msf_ent[0], | ||
704 | msf_ent[1], | ||
705 | msf_ent[2], | ||
706 | TocEntry[i].cdte_addr.lba, | ||
707 | TocEntry[i].cdte_datamode); | ||
708 | } | ||
709 | } | ||
710 | } | ||
711 | return (hdr.cdth_trk1); /* number of tracks */ | ||
712 | } | ||
713 | |||
714 | void display(int size,unsigned char *buffer) | ||
715 | { | ||
716 | k=0; | ||
717 | getchar(); | ||
718 | for (i=0;i<(size+1)/16;i++) | ||
719 | { | ||
720 | printf("%4d:",i*16); | ||
721 | for (j=0;j<16;j++) | ||
722 | { | ||
723 | printf(" %02X",buffer[i*16+j]); | ||
724 | } | ||
725 | printf(" "); | ||
726 | for (j=0;j<16;j++) | ||
727 | { | ||
728 | if (isalnum(buffer[i*16+j])) | ||
729 | printf("%c",buffer[i*16+j]); | ||
730 | else | ||
731 | printf("."); | ||
732 | } | ||
733 | printf("\n"); | ||
734 | k++; | ||
735 | if (k>=20) | ||
736 | { | ||
737 | printf("press ENTER to continue\n"); | ||
738 | getchar(); | ||
739 | k=0; | ||
740 | } | ||
741 | } | ||
742 | } | ||
743 | |||
744 | int main(int argc, char *argv[]) | ||
745 | { | ||
746 | printf("\nTesting tool for a CDROM driver's audio functions V0.1\n"); | ||
747 | printf("(C) 1995 Eberhard Moenkeberg <emoenke@gwdg.de>\n"); | ||
748 | printf("initializing...\n"); | ||
749 | |||
750 | rc=init_drive(default_device); | ||
751 | if (rc<0) printf("could not open %s (rc=%d).\n",default_device,rc); | ||
752 | help(); | ||
753 | while (1) | ||
754 | { | ||
755 | printf("Give a one-letter command (h = help): "); | ||
756 | scanf("%s",command); | ||
757 | command[1]=0; | ||
758 | switch (command[0]) | ||
759 | { | ||
760 | case 'D': | ||
761 | printf("device name (f.e. /dev/sbpcd3): ? "); | ||
762 | scanf("%s",&dev); | ||
763 | close(drive); | ||
764 | rc=init_drive(dev); | ||
765 | if (rc<0) printf("could not open %s (rc %d).\n",dev,rc); | ||
766 | break; | ||
767 | case 'e': | ||
768 | rc=ioctl(drive,CDROMEJECT); | ||
769 | if (rc<0) printf("CDROMEJECT: rc=%d.\n",rc); | ||
770 | break; | ||
771 | case 'p': | ||
772 | rc=ioctl(drive,CDROMPAUSE); | ||
773 | if (rc<0) printf("CDROMPAUSE: rc=%d.\n",rc); | ||
774 | break; | ||
775 | case 'r': | ||
776 | rc=ioctl(drive,CDROMRESUME); | ||
777 | if (rc<0) printf("CDROMRESUME: rc=%d.\n",rc); | ||
778 | break; | ||
779 | case 's': | ||
780 | rc=ioctl(drive,CDROMSTOP); | ||
781 | if (rc<0) printf("CDROMSTOP: rc=%d.\n",rc); | ||
782 | break; | ||
783 | case 'S': | ||
784 | rc=ioctl(drive,CDROMSTART); | ||
785 | if (rc<0) printf("CDROMSTART: rc=%d.\n",rc); | ||
786 | break; | ||
787 | case 't': | ||
788 | rc=ioctl(drive,CDROMREADTOCHDR,&tocHdr); | ||
789 | if (rc<0) | ||
790 | { | ||
791 | printf("CDROMREADTOCHDR: rc=%d.\n",rc); | ||
792 | break; | ||
793 | } | ||
794 | first=tocHdr.cdth_trk0; | ||
795 | last= tocHdr.cdth_trk1; | ||
796 | if ((first==0)||(first>last)) | ||
797 | { | ||
798 | printf ("--got invalid TOC data.\n"); | ||
799 | } | ||
800 | else | ||
801 | { | ||
802 | printf("--enter track number(first=%d, last=%d): ",first,last); | ||
803 | scanf("%d",&i1); | ||
804 | ti.cdti_trk0=i1; | ||
805 | if (ti.cdti_trk0<first) ti.cdti_trk0=first; | ||
806 | if (ti.cdti_trk0>last) ti.cdti_trk0=last; | ||
807 | ti.cdti_ind0=0; | ||
808 | ti.cdti_trk1=last; | ||
809 | ti.cdti_ind1=0; | ||
810 | rc=ioctl(drive,CDROMSTOP); | ||
811 | rc=ioctl(drive,CDROMPLAYTRKIND,&ti); | ||
812 | if (rc<0) printf("CDROMPLAYTRKIND: rc=%d.\n",rc); | ||
813 | } | ||
814 | break; | ||
815 | case 'n': | ||
816 | rc=ioctl(drive,CDROMSTOP); | ||
817 | if (++ti.cdti_trk0>last) ti.cdti_trk0=last; | ||
818 | ti.cdti_ind0=0; | ||
819 | ti.cdti_trk1=last; | ||
820 | ti.cdti_ind1=0; | ||
821 | rc=ioctl(drive,CDROMPLAYTRKIND,&ti); | ||
822 | if (rc<0) printf("CDROMPLAYTRKIND: rc=%d.\n",rc); | ||
823 | break; | ||
824 | case 'l': | ||
825 | rc=ioctl(drive,CDROMSTOP); | ||
826 | if (--ti.cdti_trk0<first) ti.cdti_trk0=first; | ||
827 | ti.cdti_ind0=0; | ||
828 | ti.cdti_trk1=last; | ||
829 | ti.cdti_ind1=0; | ||
830 | rc=ioctl(drive,CDROMPLAYTRKIND,&ti); | ||
831 | if (rc<0) printf("CDROMPLAYTRKIND: rc=%d.\n",rc); | ||
832 | break; | ||
833 | case 'c': | ||
834 | subchnl.cdsc_format=CDROM_MSF; | ||
835 | rc=ioctl(drive,CDROMSUBCHNL,&subchnl); | ||
836 | if (rc<0) printf("CDROMSUBCHNL: rc=%d.\n",rc); | ||
837 | else | ||
838 | { | ||
839 | printf("AudioStatus:%s Track:%d Mode:%d MSF=%02d:%02d:%02d\n", | ||
840 | subchnl.cdsc_audiostatus==CDROM_AUDIO_PLAY ? "PLAYING":"NOT PLAYING", | ||
841 | subchnl.cdsc_trk,subchnl.cdsc_adr, | ||
842 | subchnl.cdsc_absaddr.msf.minute, | ||
843 | subchnl.cdsc_absaddr.msf.second, | ||
844 | subchnl.cdsc_absaddr.msf.frame); | ||
845 | } | ||
846 | break; | ||
847 | case 'i': | ||
848 | printf("Track No.: "); | ||
849 | scanf("%d",&i1); | ||
850 | entry.cdte_track=i1; | ||
851 | if (entry.cdte_track<first) entry.cdte_track=first; | ||
852 | if (entry.cdte_track>last) entry.cdte_track=last; | ||
853 | entry.cdte_format=CDROM_MSF; | ||
854 | rc=ioctl(drive,CDROMREADTOCENTRY,&entry); | ||
855 | if (rc<0) printf("CDROMREADTOCENTRY: rc=%d.\n",rc); | ||
856 | else | ||
857 | { | ||
858 | printf("Mode %d Track, starts at %02d:%02d:%02d\n", | ||
859 | entry.cdte_adr, | ||
860 | entry.cdte_addr.msf.minute, | ||
861 | entry.cdte_addr.msf.second, | ||
862 | entry.cdte_addr.msf.frame); | ||
863 | } | ||
864 | break; | ||
865 | case 'a': | ||
866 | printf("Address (min:sec:frm) "); | ||
867 | scanf("%d:%d:%d",&i1,&i2,&i3); | ||
868 | msf.cdmsf_min0=i1; | ||
869 | msf.cdmsf_sec0=i2; | ||
870 | msf.cdmsf_frame0=i3; | ||
871 | if (msf.cdmsf_sec0>59) msf.cdmsf_sec0=59; | ||
872 | if (msf.cdmsf_frame0>74) msf.cdmsf_frame0=74; | ||
873 | lba2msf(TocEntry[last+1].cdte_addr.lba-1,&msf.cdmsf_min1); | ||
874 | rc=ioctl(drive,CDROMSTOP); | ||
875 | rc=ioctl(drive,CDROMPLAYMSF,&msf); | ||
876 | if (rc<0) printf("CDROMPLAYMSF: rc=%d.\n",rc); | ||
877 | break; | ||
878 | case 'V': | ||
879 | rc=ioctl(drive,CDROMVOLREAD,&volctrl); | ||
880 | if (rc<0) printf("CDROMVOLCTRL: rc=%d.\n",rc); | ||
881 | printf("Volume: channel 0 (left) %d, channel 1 (right) %d\n",volctrl.channel0,volctrl.channel1); | ||
882 | break; | ||
883 | case 'R': | ||
884 | rc=ioctl(drive,CDROMRESET); | ||
885 | if (rc<0) printf("CDROMRESET: rc=%d.\n",rc); | ||
886 | break; | ||
887 | #ifdef AZT_PRIVATE_IOCTLS /*not supported by every CDROM driver*/ | ||
888 | case 'd': | ||
889 | printf("Address (min:sec:frm) "); | ||
890 | scanf("%d:%d:%d",&i1,&i2,&i3); | ||
891 | azt.msf.cdmsf_min0=i1; | ||
892 | azt.msf.cdmsf_sec0=i2; | ||
893 | azt.msf.cdmsf_frame0=i3; | ||
894 | if (azt.msf.cdmsf_sec0>59) azt.msf.cdmsf_sec0=59; | ||
895 | if (azt.msf.cdmsf_frame0>74) azt.msf.cdmsf_frame0=74; | ||
896 | rc=ioctl(drive,CDROMREADMODE1,&azt.msf); | ||
897 | if (rc<0) printf("CDROMREADMODE1: rc=%d.\n",rc); | ||
898 | else display(CD_FRAMESIZE,azt.buf); | ||
899 | break; | ||
900 | case 'w': | ||
901 | printf("Address (min:sec:frame) "); | ||
902 | scanf("%d:%d:%d",&i1,&i2,&i3); | ||
903 | azt.msf.cdmsf_min0=i1; | ||
904 | azt.msf.cdmsf_sec0=i2; | ||
905 | azt.msf.cdmsf_frame0=i3; | ||
906 | if (azt.msf.cdmsf_sec0>59) azt.msf.cdmsf_sec0=59; | ||
907 | if (azt.msf.cdmsf_frame0>74) azt.msf.cdmsf_frame0=74; | ||
908 | rc=ioctl(drive,CDROMREADMODE2,&azt.msf); | ||
909 | if (rc<0) printf("CDROMREADMODE2: rc=%d.\n",rc); | ||
910 | else display(CD_FRAMESIZE_RAW,azt.buf); /* currently only 2336 */ | ||
911 | break; | ||
912 | #endif | ||
913 | case 'v': | ||
914 | printf("--Channel 0 (Left) (0-255): "); | ||
915 | scanf("%d",&i1); | ||
916 | volctrl.channel0=i1; | ||
917 | printf("--Channel 1 (Right) (0-255): "); | ||
918 | scanf("%d",&i1); | ||
919 | volctrl.channel1=i1; | ||
920 | volctrl.channel2=0; | ||
921 | volctrl.channel3=0; | ||
922 | rc=ioctl(drive,CDROMVOLCTRL,&volctrl); | ||
923 | if (rc<0) printf("CDROMVOLCTRL: rc=%d.\n",rc); | ||
924 | break; | ||
925 | case 'q': | ||
926 | close(drive); | ||
927 | exit(0); | ||
928 | case 'h': | ||
929 | help(); | ||
930 | break; | ||
931 | case 'T': /* display TOC entry - without involving the driver */ | ||
932 | scanf("%d",&i); | ||
933 | if ((i<hdr.cdth_trk0)||(i>hdr.cdth_trk1)) | ||
934 | printf("invalid track number.\n"); | ||
935 | else | ||
936 | printf("TocEntry %02d: adr=%01X ctrl=%01X msf=%02d:%02d:%02d mode=%02X\n", | ||
937 | TocEntry[i].cdte_track, | ||
938 | TocEntry[i].cdte_adr, | ||
939 | TocEntry[i].cdte_ctrl, | ||
940 | TocEntry[i].cdte_addr.msf.minute, | ||
941 | TocEntry[i].cdte_addr.msf.second, | ||
942 | TocEntry[i].cdte_addr.msf.frame, | ||
943 | TocEntry[i].cdte_datamode); | ||
944 | break; | ||
945 | case 'A': /* read audio data into file */ | ||
946 | printf("Address (min:sec:frm) ? "); | ||
947 | scanf("%d:%d:%d",&i1,&i2,&i3); | ||
948 | read_audio.addr.msf.minute=i1; | ||
949 | read_audio.addr.msf.second=i2; | ||
950 | read_audio.addr.msf.frame=i3; | ||
951 | read_audio.addr_format=CDROM_MSF; | ||
952 | printf("# of frames ? "); | ||
953 | scanf("%d",&i1); | ||
954 | read_audio.nframes=i1; | ||
955 | k=read_audio.nframes*CD_FRAMESIZE_RAW; | ||
956 | read_audio.buf=malloc(k); | ||
957 | if (read_audio.buf==NULL) | ||
958 | { | ||
959 | printf("can't malloc %d bytes.\n",k); | ||
960 | break; | ||
961 | } | ||
962 | sprintf(filename,"audio_%02d%02d%02d_%02d.%02d\0", | ||
963 | read_audio.addr.msf.minute, | ||
964 | read_audio.addr.msf.second, | ||
965 | read_audio.addr.msf.frame, | ||
966 | read_audio.nframes, | ||
967 | ++sequence); | ||
968 | datafile=creat(filename, 0755); | ||
969 | if (datafile<0) | ||
970 | { | ||
971 | printf("can't open datafile %s.\n",filename); | ||
972 | break; | ||
973 | } | ||
974 | rc=ioctl(drive,CDROMREADAUDIO,&read_audio); | ||
975 | if (rc!=0) | ||
976 | { | ||
977 | printf("CDROMREADAUDIO: rc=%d.\n",rc); | ||
978 | } | ||
979 | else | ||
980 | { | ||
981 | rc=write(datafile,&read_audio.buf,k); | ||
982 | if (rc!=k) printf("datafile I/O error (%d).\n",rc); | ||
983 | } | ||
984 | close(datafile); | ||
985 | break; | ||
986 | case 'X': /* set EJECT_SW (0: disable, 1: enable auto-ejecting) */ | ||
987 | scanf("%d",&i); | ||
988 | rc=ioctl(drive,CDROMEJECT_SW,i); | ||
989 | if (rc!=0) | ||
990 | printf("CDROMEJECT_SW: rc=%d.\n",rc); | ||
991 | else | ||
992 | printf("EJECT_SW set to %d\n",i); | ||
993 | break; | ||
994 | case 'M': /* get the multisession redirection info */ | ||
995 | ms_info.addr_format=CDROM_LBA; | ||
996 | rc=ioctl(drive,CDROMMULTISESSION,&ms_info); | ||
997 | if (rc!=0) | ||
998 | { | ||
999 | printf("CDROMMULTISESSION(lba): rc=%d.\n",rc); | ||
1000 | } | ||
1001 | else | ||
1002 | { | ||
1003 | if (ms_info.xa_flag) printf("MultiSession offset (lba): %d (0x%06X)\n",ms_info.addr.lba,ms_info.addr.lba); | ||
1004 | else | ||
1005 | { | ||
1006 | printf("this CD is not an XA disk.\n"); | ||
1007 | break; | ||
1008 | } | ||
1009 | } | ||
1010 | ms_info.addr_format=CDROM_MSF; | ||
1011 | rc=ioctl(drive,CDROMMULTISESSION,&ms_info); | ||
1012 | if (rc!=0) | ||
1013 | { | ||
1014 | printf("CDROMMULTISESSION(msf): rc=%d.\n",rc); | ||
1015 | } | ||
1016 | else | ||
1017 | { | ||
1018 | if (ms_info.xa_flag) | ||
1019 | printf("MultiSession offset (msf): %02d:%02d:%02d (0x%02X%02X%02X)\n", | ||
1020 | ms_info.addr.msf.minute, | ||
1021 | ms_info.addr.msf.second, | ||
1022 | ms_info.addr.msf.frame, | ||
1023 | ms_info.addr.msf.minute, | ||
1024 | ms_info.addr.msf.second, | ||
1025 | ms_info.addr.msf.frame); | ||
1026 | else printf("this CD is not an XA disk.\n"); | ||
1027 | } | ||
1028 | break; | ||
1029 | #ifdef SBP_PRIVATE_IOCTLS | ||
1030 | case 'Y': /* set the driver's message level */ | ||
1031 | #if 0 /* not implemented yet */ | ||
1032 | printf("enter switch name (f.e. DBG_CMD): "); | ||
1033 | scanf("%s",&dbg_switch); | ||
1034 | j=get_dbg_num(dbg_switch); | ||
1035 | #else | ||
1036 | printf("enter DDIOCSDBG switch number: "); | ||
1037 | scanf("%d",&j); | ||
1038 | #endif | ||
1039 | printf("enter 0 for \"off\", 1 for \"on\": "); | ||
1040 | scanf("%d",&i); | ||
1041 | if (i==0) j|=0x80; | ||
1042 | printf("calling \"ioctl(drive,DDIOCSDBG,%d)\"\n",j); | ||
1043 | rc=ioctl(drive,DDIOCSDBG,j); | ||
1044 | printf("DDIOCSDBG: rc=%d.\n",rc); | ||
1045 | break; | ||
1046 | case 'Z': /* set the audio buffer size */ | ||
1047 | printf("# frames wanted: ? "); | ||
1048 | scanf("%d",&j); | ||
1049 | rc=ioctl(drive,CDROMAUDIOBUFSIZ,j); | ||
1050 | printf("%d frames granted.\n",rc); | ||
1051 | break; | ||
1052 | #endif /* SBP_PRIVATE_IOCTLS */ | ||
1053 | default: | ||
1054 | printf("unknown command: \"%s\".\n",command); | ||
1055 | break; | ||
1056 | } | ||
1057 | } | ||
1058 | return 0; | ||
1059 | } | ||
1060 | /*==========================================================================*/ | ||
1061 | |||
diff --git a/Documentation/cdrom/sjcd b/Documentation/cdrom/sjcd deleted file mode 100644 index 74a14847b93a..000000000000 --- a/Documentation/cdrom/sjcd +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | -- Documentation/cdrom/sjcd | ||
2 | 80% of the work takes 20% of the time, | ||
3 | 20% of the work takes 80% of the time... | ||
4 | (Murphy's law) | ||
5 | |||
6 | Once started, training can not be stopped... | ||
7 | (Star Wars) | ||
8 | |||
9 | This is the README for the sjcd cdrom driver, version 1.6. | ||
10 | |||
11 | This file is meant as a tips & tricks edge for the usage of the SANYO CDR-H94A | ||
12 | cdrom drive. It will grow as the questions arise. ;-) | ||
13 | For info on configuring the ISP16 sound card look at Documentation/cdrom/isp16. | ||
14 | |||
15 | The driver should work with any of the Panasonic, Sony or Mitsumi style | ||
16 | CDROM interfaces. | ||
17 | The cdrom interface on Media Magic's soft configurable sound card ISP16, | ||
18 | which used to be included in the driver, is now supported in a separate module. | ||
19 | This initialisation module will probably also work with other interfaces | ||
20 | based on an OPTi 82C928 or 82C929 chip (like MAD16 and Mozart): see the | ||
21 | documentation Documentation/cdrom/isp16. | ||
22 | |||
23 | The device major for sjcd is 18, and minor is 0. Create a block special | ||
24 | file in your /dev directory (e.g., /dev/sjcd) with these numbers. | ||
25 | (For those who don't know, being root and doing the following should do | ||
26 | the trick: | ||
27 | mknod -m 644 /dev/sjcd b 18 0 | ||
28 | and mount the cdrom by /dev/sjcd). | ||
29 | |||
30 | The default configuration parameters are: | ||
31 | base address 0x340 | ||
32 | no irq | ||
33 | no dma | ||
34 | (Actually the CDR-H94A doesn't know how to use irq and dma.) | ||
35 | As of version 1.2, setting base address at boot time is supported | ||
36 | through the use of command line options: type at the "boot:" prompt: | ||
37 | linux sjcd=<base_address> | ||
38 | (where you would use the kernel labeled "linux" in lilo's configuration | ||
39 | file /etc/lilo.conf). You could also use 'append="sjcd=<configuration_info>"' | ||
40 | in the appropriate section of /etc/lilo.conf | ||
41 | If you're building a kernel yourself you can set your default base | ||
42 | i/o address with SJCD_BASE_ADDR in /usr/src/linux/drivers/cdrom/sjcd.h. | ||
43 | |||
44 | The sjcd driver supports being loaded as a module. The following | ||
45 | command will set the base i/o address on the fly (assuming you | ||
46 | have installed the module in an appropriate place). | ||
47 | insmod sjcd.o sjcd_base=<base_address> | ||
48 | |||
49 | |||
50 | Have fun! | ||
51 | |||
52 | If something is wrong, please email to vadim@rbrf.ru | ||
53 | or vadim@ipsun.ras.ru | ||
54 | or model@cecmow.enet.dec.com | ||
55 | or H.T.M.v.d.Maarel@marin.nl | ||
56 | |||
57 | It happens sometimes that Vadim is not reachable by mail. For these | ||
58 | instances, Eric van der Maarel will help too. | ||
59 | |||
60 | Vadim V. Model, Eric van der Maarel, Eberhard Moenkeberg | ||
diff --git a/Documentation/cdrom/sonycd535 b/Documentation/cdrom/sonycd535 deleted file mode 100644 index b81e109970aa..000000000000 --- a/Documentation/cdrom/sonycd535 +++ /dev/null | |||
@@ -1,122 +0,0 @@ | |||
1 | README FOR LINUX SONY CDU-535/531 DRIVER | ||
2 | ======================================== | ||
3 | |||
4 | This is the Sony CDU-535 (and 531) driver version 0.7 for Linux. | ||
5 | I do not think I have the documentation to add features like DMA support | ||
6 | so if anyone else wants to pursue it or help me with it, please do. | ||
7 | (I need to see what was done for the CDU-31A driver -- perhaps I can | ||
8 | steal some of that code.) | ||
9 | |||
10 | This is a Linux device driver for the Sony CDU-535 CDROM drive. This is | ||
11 | one of the older Sony drives with its own interface card (Sony bus). | ||
12 | The DOS driver for this drive is named SONY_CDU.SYS - when you boot DOS | ||
13 | your drive should be identified as a SONY CDU-535. The driver works | ||
14 | with a CDU-531 also. One user reported that the driver worked on drives | ||
15 | OEM'ed by Procomm, drive and interface board were labelled Procomm. | ||
16 | |||
17 | The Linux driver is based on Corey Minyard's sonycd 0.3 driver for | ||
18 | the CDU-31A. Ron Jeppesen just changed the commands that were sent | ||
19 | to the drive to correspond to the CDU-535 commands and registers. | ||
20 | There were enough changes to let bugs creep in but it seems to be stable. | ||
21 | Ron was able to tar an entire CDROM (should read all blocks) and built | ||
22 | ghostview and xfig off Walnut Creek's X11R5/GNU CDROM. xcdplayer and | ||
23 | workman work with the driver. Others have used the driver without | ||
24 | problems except those dealing with wait loops (fixed in third release). | ||
25 | Like Minyard's original driver this one uses a polled interface (this | ||
26 | is also the default setup for the DOS driver). It has not been tried | ||
27 | with interrupts or DMA enabled on the board. | ||
28 | |||
29 | REQUIREMENTS | ||
30 | ============ | ||
31 | |||
32 | - Sony CDU-535 drive, preferably without interrupts and DMA | ||
33 | enabled on the card. | ||
34 | |||
35 | - Drive must be set up as unit 1. Only the first unit will be | ||
36 | recognized | ||
37 | |||
38 | - You must enter your interface address into | ||
39 | /usr/src/linux/drivers/cdrom/sonycd535.h and build the | ||
40 | appropriate kernel or use the "kernel command line" parameter | ||
41 | sonycd535=0x320 | ||
42 | with the correct interface address. | ||
43 | |||
44 | NOTES: | ||
45 | ====== | ||
46 | |||
47 | 1) The drive MUST be turned on when booting or it will not be recognized! | ||
48 | (but see comments on modularized version below) | ||
49 | |||
50 | 2) when the cdrom device is opened the eject button is disabled to keep the | ||
51 | user from ejecting a mounted disk and replacing it with another. | ||
52 | Unfortunately xcdplayer and workman also open the cdrom device so you | ||
53 | have to use the eject button in the software. Keep this in mind if your | ||
54 | cdrom player refuses to give up its disk -- exit workman or xcdplayer, or | ||
55 | umount the drive if it has been mounted. | ||
56 | |||
57 | THANKS | ||
58 | ====== | ||
59 | |||
60 | Many thanks to Ron Jeppesen (ronj.an@site007.saic.com) for getting | ||
61 | this project off the ground. He wrote the initial release | ||
62 | and the first two patches to this driver (0.1, 0.2, and 0.3). | ||
63 | Thanks also to Eberhard Moenkeberg (emoenke@gwdg.de) for prodding | ||
64 | me to place this code into the mainstream Linux source tree | ||
65 | (as of Linux version 1.1.91), as well as some patches to make | ||
66 | it a better device citizen. Further thanks to Joel Katz | ||
67 | <joelkatz@webchat.org> for his MODULE patches (see details below), | ||
68 | Porfiri Claudio <C.Porfiri@nisms.tei.ericsson.se> for patches | ||
69 | to make the driver work with the older CDU-510/515 series, and | ||
70 | Heiko Eissfeldt <heiko@colossus.escape.de> for pointing out that | ||
71 | the verify_area() checks were ignoring the results of said checks | ||
72 | (note: verify_area() has since been replaced by access_ok()). | ||
73 | |||
74 | (Acknowledgments from Ron Jeppesen in the 0.3 release:) | ||
75 | Thanks to Corey Minyard who wrote the original CDU-31A driver on which | ||
76 | this driver is based. Thanks to Ken Pizzini and Bob Blair who provided | ||
77 | patches and feedback on the first release of this driver. | ||
78 | |||
79 | Ken Pizzini | ||
80 | ken@halcyon.com | ||
81 | |||
82 | ------------------------------------------------------------------------------ | ||
83 | (The following is from Joel Katz <joelkatz@webchat.org>.) | ||
84 | |||
85 | To build a version of sony535.o that can be installed as a module, | ||
86 | use the following command: | ||
87 | |||
88 | gcc -c -D__KERNEL__ -DMODULE -O2 sonycd535.c -o sonycd535.o | ||
89 | |||
90 | To install the module, simply type: | ||
91 | |||
92 | insmod sony535.o | ||
93 | or | ||
94 | insmod sony535.o sonycd535=<address> | ||
95 | |||
96 | And to remove it: | ||
97 | |||
98 | rmmod sony535 | ||
99 | |||
100 | The code checks to see if MODULE is defined and behaves as it used | ||
101 | to if MODULE is not defined. That means your patched file should behave | ||
102 | exactly as it used to if compiled into the kernel. | ||
103 | |||
104 | I have an external drive, and I usually leave it powered off. I used | ||
105 | to have to reboot if I needed to use the CDROM drive. Now I don't. | ||
106 | |||
107 | Even if you have an internal drive, why waste the 96K of memory | ||
108 | (unswappable) that the driver uses if you use your CD-ROM drive infrequently? | ||
109 | |||
110 | This driver will not install (whether compiled in or loaded as a | ||
111 | module) if the CDROM drive is not available during its initialization. This | ||
112 | means that you can have the driver compiled into the kernel and still load | ||
113 | the module later (assuming the driver doesn't install itself during | ||
114 | power-on). This only wastes 12K when you boot with the CDROM drive off. | ||
115 | |||
116 | This is what I usually do; I leave the driver compiled into the | ||
117 | kernel, but load it as a module if I powered the system up with the drive | ||
118 | off and then later decided to use the CDROM drive. | ||
119 | |||
120 | Since the driver only uses a single page to point to the chunks, | ||
121 | attempting to set the buffer cache to more than 2 Megabytes would be very | ||
122 | bad; don't do that. | ||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 789f97ac22bf..8363ad3ba018 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -34,7 +34,6 @@ parameter is applicable: | |||
34 | APIC APIC support is enabled. | 34 | APIC APIC support is enabled. |
35 | APM Advanced Power Management support is enabled. | 35 | APM Advanced Power Management support is enabled. |
36 | AX25 Appropriate AX.25 support is enabled. | 36 | AX25 Appropriate AX.25 support is enabled. |
37 | CD Appropriate CD support is enabled. | ||
38 | DRM Direct Rendering Management support is enabled. | 37 | DRM Direct Rendering Management support is enabled. |
39 | EDD BIOS Enhanced Disk Drive Services (EDD) is enabled | 38 | EDD BIOS Enhanced Disk Drive Services (EDD) is enabled |
40 | EFI EFI Partitioning (GPT) is enabled | 39 | EFI EFI Partitioning (GPT) is enabled |
@@ -319,9 +318,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
319 | 318 | ||
320 | autotest [IA64] | 319 | autotest [IA64] |
321 | 320 | ||
322 | aztcd= [HW,CD] Aztech CD268 CDROM driver | ||
323 | Format: <io>,0x79 (?) | ||
324 | |||
325 | baycom_epp= [HW,AX25] | 321 | baycom_epp= [HW,AX25] |
326 | Format: <io>,<mode> | 322 | Format: <io>,<mode> |
327 | 323 | ||
@@ -364,10 +360,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
364 | possible to determine what the correct size should be. | 360 | possible to determine what the correct size should be. |
365 | This option provides an override for these situations. | 361 | This option provides an override for these situations. |
366 | 362 | ||
367 | cdu31a= [HW,CD] | ||
368 | Format: <io>,<irq>[,PAS] | ||
369 | See header of drivers/cdrom/cdu31a.c. | ||
370 | |||
371 | chandev= [HW,NET] Generic channel device initialisation | 363 | chandev= [HW,NET] Generic channel device initialisation |
372 | 364 | ||
373 | checkreqprot [SELINUX] Set initial checkreqprot flag value. | 365 | checkreqprot [SELINUX] Set initial checkreqprot flag value. |
@@ -421,9 +413,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
421 | hpet= [IA-32,HPET] option to disable HPET and use PIT. | 413 | hpet= [IA-32,HPET] option to disable HPET and use PIT. |
422 | Format: disable | 414 | Format: disable |
423 | 415 | ||
424 | cm206= [HW,CD] | ||
425 | Format: { auto | [<io>,][<irq>] } | ||
426 | |||
427 | com20020= [HW,NET] ARCnet - COM20020 chipset | 416 | com20020= [HW,NET] ARCnet - COM20020 chipset |
428 | Format: | 417 | Format: |
429 | <io>[,<irq>[,<nodeID>[,<backplane>[,<ckp>[,<timeout>]]]]] | 418 | <io>[,<irq>[,<nodeID>[,<backplane>[,<ckp>[,<timeout>]]]]] |
@@ -660,9 +649,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
660 | gpt [EFI] Forces disk with valid GPT signature but | 649 | gpt [EFI] Forces disk with valid GPT signature but |
661 | invalid Protective MBR to be treated as GPT. | 650 | invalid Protective MBR to be treated as GPT. |
662 | 651 | ||
663 | gscd= [HW,CD] | ||
664 | Format: <io> | ||
665 | |||
666 | gvp11= [HW,SCSI] | 652 | gvp11= [HW,SCSI] |
667 | 653 | ||
668 | hashdist= [KNL,NUMA] Large hashes allocated during boot | 654 | hashdist= [KNL,NUMA] Large hashes allocated during boot |
@@ -826,9 +812,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
826 | tasks in the system -- can cause problems and | 812 | tasks in the system -- can cause problems and |
827 | suboptimal load balancer performance. | 813 | suboptimal load balancer performance. |
828 | 814 | ||
829 | isp16= [HW,CD] | ||
830 | Format: <io>,<irq>,<dma>,<setup> | ||
831 | |||
832 | iucv= [HW,NET] | 815 | iucv= [HW,NET] |
833 | 816 | ||
834 | js= [HW,JOY] Analog joystick | 817 | js= [HW,JOY] Analog joystick |
@@ -967,11 +950,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
967 | 950 | ||
968 | mcatest= [IA-64] | 951 | mcatest= [IA-64] |
969 | 952 | ||
970 | mcd= [HW,CD] | ||
971 | Format: <port>,<irq>,<mitsumi_bug_93_wait> | ||
972 | |||
973 | mcdx= [HW,CD] | ||
974 | |||
975 | mce [IA-32] Machine Check Exception | 953 | mce [IA-32] Machine Check Exception |
976 | 954 | ||
977 | md= [HW] RAID subsystems devices and level | 955 | md= [HW] RAID subsystems devices and level |
@@ -1204,9 +1182,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1204 | oprofile.timer= [HW] | 1182 | oprofile.timer= [HW] |
1205 | Use timer interrupt instead of performance counters | 1183 | Use timer interrupt instead of performance counters |
1206 | 1184 | ||
1207 | optcd= [HW,CD] | ||
1208 | Format: <io> | ||
1209 | |||
1210 | osst= [HW,SCSI] SCSI Tape Driver | 1185 | osst= [HW,SCSI] SCSI Tape Driver |
1211 | Format: <buffer_size>,<write_threshold> | 1186 | Format: <buffer_size>,<write_threshold> |
1212 | See also Documentation/scsi/st.txt. | 1187 | See also Documentation/scsi/st.txt. |
@@ -1522,11 +1497,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1522 | 1497 | ||
1523 | sbni= [NET] Granch SBNI12 leased line adapter | 1498 | sbni= [NET] Granch SBNI12 leased line adapter |
1524 | 1499 | ||
1525 | sbpcd= [HW,CD] Soundblaster CD adapter | ||
1526 | Format: <io>,<type> | ||
1527 | See a comment before function sbpcd_setup() in | ||
1528 | drivers/cdrom/sbpcd.c. | ||
1529 | |||
1530 | sc1200wdt= [HW,WDT] SC1200 WDT (watchdog) driver | 1500 | sc1200wdt= [HW,WDT] SC1200 WDT (watchdog) driver |
1531 | Format: <io>[,<timeout>[,<isapnp>]] | 1501 | Format: <io>[,<timeout>[,<isapnp>]] |
1532 | 1502 | ||
@@ -1579,10 +1549,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1579 | simeth= [IA-64] | 1549 | simeth= [IA-64] |
1580 | simscsi= | 1550 | simscsi= |
1581 | 1551 | ||
1582 | sjcd= [HW,CD] | ||
1583 | Format: <io>,<irq>,<dma> | ||
1584 | See header of drivers/cdrom/sjcd.c. | ||
1585 | |||
1586 | slram= [HW,MTD] | 1552 | slram= [HW,MTD] |
1587 | 1553 | ||
1588 | slub_debug[=options[,slabs]] [MM, SLUB] | 1554 | slub_debug[=options[,slabs]] [MM, SLUB] |
@@ -1759,9 +1725,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1759 | 1725 | ||
1760 | snd-ymfpci= [HW,ALSA] | 1726 | snd-ymfpci= [HW,ALSA] |
1761 | 1727 | ||
1762 | sonycd535= [HW,CD] | ||
1763 | Format: <io>[,<irq>] | ||
1764 | |||
1765 | sonypi.*= [HW] Sony Programmable I/O Control Device driver | 1728 | sonypi.*= [HW] Sony Programmable I/O Control Device driver |
1766 | See Documentation/sonypi.txt | 1729 | See Documentation/sonypi.txt |
1767 | 1730 | ||
diff --git a/Documentation/m68k/kernel-options.txt b/Documentation/m68k/kernel-options.txt index 1c41db21d3c1..59108cebe163 100644 --- a/Documentation/m68k/kernel-options.txt +++ b/Documentation/m68k/kernel-options.txt | |||
@@ -82,13 +82,6 @@ Valid names are: | |||
82 | /dev/fd : -> 0x0200 (floppy disk) | 82 | /dev/fd : -> 0x0200 (floppy disk) |
83 | /dev/xda: -> 0x0c00 (first XT disk, unused in Linux/m68k) | 83 | /dev/xda: -> 0x0c00 (first XT disk, unused in Linux/m68k) |
84 | /dev/xdb: -> 0x0c40 (second XT disk, unused in Linux/m68k) | 84 | /dev/xdb: -> 0x0c40 (second XT disk, unused in Linux/m68k) |
85 | /dev/ada: -> 0x1c00 (first ACSI device) | ||
86 | /dev/adb: -> 0x1c10 (second ACSI device) | ||
87 | /dev/adc: -> 0x1c20 (third ACSI device) | ||
88 | /dev/add: -> 0x1c30 (forth ACSI device) | ||
89 | |||
90 | The last four names are available only if the kernel has been compiled | ||
91 | with Atari and ACSI support. | ||
92 | 85 | ||
93 | The name must be followed by a decimal number, that stands for the | 86 | The name must be followed by a decimal number, that stands for the |
94 | partition number. Internally, the value of the number is just | 87 | partition number. Internally, the value of the number is just |
diff --git a/Documentation/networking/net-modules.txt b/Documentation/networking/net-modules.txt index 0b27863f155c..98c4392dd0fd 100644 --- a/Documentation/networking/net-modules.txt +++ b/Documentation/networking/net-modules.txt | |||
@@ -146,12 +146,6 @@ at1700.c: | |||
146 | irq = 0 | 146 | irq = 0 |
147 | (Probes ports: 0x260, 0x280, 0x2A0, 0x240, 0x340, 0x320, 0x380, 0x300) | 147 | (Probes ports: 0x260, 0x280, 0x2A0, 0x240, 0x340, 0x320, 0x380, 0x300) |
148 | 148 | ||
149 | atari_bionet.c: | ||
150 | Supports full autoprobing. (m68k/Atari) | ||
151 | |||
152 | atari_pamsnet.c: | ||
153 | Supports full autoprobing. (m68k/Atari) | ||
154 | |||
155 | atarilance.c: | 149 | atarilance.c: |
156 | Supports full autoprobing. (m68k/Atari) | 150 | Supports full autoprobing. (m68k/Atari) |
157 | 151 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index da9e60a71e3a..5abec1435ad8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -2613,12 +2613,6 @@ M: yokota@netlab.is.tsukuba.ac.jp | |||
2613 | W: http://www.netlab.is.tsukuba.ac.jp/~yokota/izumi/ninja/ | 2613 | W: http://www.netlab.is.tsukuba.ac.jp/~yokota/izumi/ninja/ |
2614 | S: Maintained | 2614 | S: Maintained |
2615 | 2615 | ||
2616 | NON-IDE/NON-SCSI CDROM DRIVERS [GENERAL] (come on, crew - mark your responsibility) | ||
2617 | P: Eberhard Moenkeberg | ||
2618 | M: emoenke@gwdg.de | ||
2619 | L: linux-kernel@vger.kernel.org | ||
2620 | S: Maintained | ||
2621 | |||
2622 | NTFS FILESYSTEM | 2616 | NTFS FILESYSTEM |
2623 | P: Anton Altaparmakov | 2617 | P: Anton Altaparmakov |
2624 | M: aia21@cantab.net | 2618 | M: aia21@cantab.net |
@@ -3105,12 +3099,6 @@ M: michael@mihu.de | |||
3105 | W: http://www.mihu.de/linux/saa7146 | 3099 | W: http://www.mihu.de/linux/saa7146 |
3106 | S: Maintained | 3100 | S: Maintained |
3107 | 3101 | ||
3108 | SBPCD CDROM DRIVER | ||
3109 | P: Eberhard Moenkeberg | ||
3110 | M: emoenke@gwdg.de | ||
3111 | L: linux-kernel@vger.kernel.org | ||
3112 | S: Maintained | ||
3113 | |||
3114 | SC1200 WDT DRIVER | 3102 | SC1200 WDT DRIVER |
3115 | P: Zwane Mwaikambo | 3103 | P: Zwane Mwaikambo |
3116 | M: zwane@arm.linux.org.uk | 3104 | M: zwane@arm.linux.org.uk |
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index e49162b15578..c5a61571a076 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig | |||
@@ -59,17 +59,6 @@ config AMIGA_Z2RAM | |||
59 | To compile this driver as a module, choose M here: the | 59 | To compile this driver as a module, choose M here: the |
60 | module will be called z2ram. | 60 | module will be called z2ram. |
61 | 61 | ||
62 | config ATARI_SLM | ||
63 | tristate "Atari SLM laser printer support" | ||
64 | depends on ATARI | ||
65 | help | ||
66 | If you have an Atari SLM laser printer, say Y to include support for | ||
67 | it in the kernel. Otherwise, say N. This driver is also available as | ||
68 | a module ( = code which can be inserted in and removed from the | ||
69 | running kernel whenever you want). The module will be called | ||
70 | acsi_slm. Be warned: the driver needs much ST-RAM and can cause | ||
71 | problems due to that fact! | ||
72 | |||
73 | config BLK_DEV_XD | 62 | config BLK_DEV_XD |
74 | tristate "XT hard disk support" | 63 | tristate "XT hard disk support" |
75 | depends on ISA && ISA_DMA_API | 64 | depends on ISA && ISA_DMA_API |
diff --git a/drivers/block/Makefile b/drivers/block/Makefile index 43371c59623e..7926be8c9fb7 100644 --- a/drivers/block/Makefile +++ b/drivers/block/Makefile | |||
@@ -9,7 +9,6 @@ obj-$(CONFIG_MAC_FLOPPY) += swim3.o | |||
9 | obj-$(CONFIG_BLK_DEV_FD) += floppy.o | 9 | obj-$(CONFIG_BLK_DEV_FD) += floppy.o |
10 | obj-$(CONFIG_AMIGA_FLOPPY) += amiflop.o | 10 | obj-$(CONFIG_AMIGA_FLOPPY) += amiflop.o |
11 | obj-$(CONFIG_ATARI_FLOPPY) += ataflop.o | 11 | obj-$(CONFIG_ATARI_FLOPPY) += ataflop.o |
12 | obj-$(CONFIG_ATARI_SLM) += acsi_slm.o | ||
13 | obj-$(CONFIG_AMIGA_Z2RAM) += z2ram.o | 12 | obj-$(CONFIG_AMIGA_Z2RAM) += z2ram.o |
14 | obj-$(CONFIG_BLK_DEV_RAM) += rd.o | 13 | obj-$(CONFIG_BLK_DEV_RAM) += rd.o |
15 | obj-$(CONFIG_BLK_DEV_LOOP) += loop.o | 14 | obj-$(CONFIG_BLK_DEV_LOOP) += loop.o |
diff --git a/drivers/block/acsi_slm.c b/drivers/block/acsi_slm.c deleted file mode 100644 index 1d9d9b4f48cc..000000000000 --- a/drivers/block/acsi_slm.c +++ /dev/null | |||
@@ -1,1032 +0,0 @@ | |||
1 | /* | ||
2 | * acsi_slm.c -- Device driver for the Atari SLM laser printer | ||
3 | * | ||
4 | * Copyright 1995 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de> | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file COPYING in the main directory of this archive for | ||
8 | * more details. | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | /* | ||
13 | |||
14 | Notes: | ||
15 | |||
16 | The major number for SLM printers is 28 (like ACSI), but as a character | ||
17 | device, not block device. The minor number is the number of the printer (if | ||
18 | you have more than one SLM; currently max. 2 (#define-constant) SLMs are | ||
19 | supported). The device can be opened for reading and writing. If reading it, | ||
20 | you get some status infos (MODE SENSE data). Writing mode is used for the data | ||
21 | to be printed. Some ioctls allow to get the printer status and to tune printer | ||
22 | modes and some internal variables. | ||
23 | |||
24 | A special problem of the SLM driver is the timing and thus the buffering of | ||
25 | the print data. The problem is that all the data for one page must be present | ||
26 | in memory when printing starts, else --when swapping occurs-- the timing could | ||
27 | not be guaranteed. There are several ways to assure this: | ||
28 | |||
29 | 1) Reserve a buffer of 1196k (maximum page size) statically by | ||
30 | atari_stram_alloc(). The data are collected there until they're complete, | ||
31 | and then printing starts. Since the buffer is reserved, no further | ||
32 | considerations about memory and swapping are needed. So this is the | ||
33 | simplest method, but it needs a lot of memory for just the SLM. | ||
34 | |||
35 | An striking advantage of this method is (supposed the SLM_CONT_CNT_REPROG | ||
36 | method works, see there), that there are no timing problems with the DMA | ||
37 | anymore. | ||
38 | |||
39 | 2) The other method would be to reserve the buffer dynamically each time | ||
40 | printing is required. I could think of looking at mem_map where the | ||
41 | largest unallocted ST-RAM area is, taking the area, and then extending it | ||
42 | by swapping out the neighbored pages, until the needed size is reached. | ||
43 | This requires some mm hacking, but seems possible. The only obstacle could | ||
44 | be pages that cannot be swapped out (reserved pages)... | ||
45 | |||
46 | 3) Another possibility would be to leave the real data in user space and to | ||
47 | work with two dribble buffers of about 32k in the driver: While the one | ||
48 | buffer is DMAed to the SLM, the other can be filled with new data. But | ||
49 | to keep the timing, that requires that the user data remain in memory and | ||
50 | are not swapped out. Requires mm hacking, too, but maybe not so bad as | ||
51 | method 2). | ||
52 | |||
53 | */ | ||
54 | |||
55 | #include <linux/module.h> | ||
56 | |||
57 | #include <linux/errno.h> | ||
58 | #include <linux/sched.h> | ||
59 | #include <linux/timer.h> | ||
60 | #include <linux/fs.h> | ||
61 | #include <linux/major.h> | ||
62 | #include <linux/kernel.h> | ||
63 | #include <linux/delay.h> | ||
64 | #include <linux/interrupt.h> | ||
65 | #include <linux/time.h> | ||
66 | #include <linux/mm.h> | ||
67 | #include <linux/slab.h> | ||
68 | |||
69 | #include <asm/pgtable.h> | ||
70 | #include <asm/system.h> | ||
71 | #include <asm/uaccess.h> | ||
72 | #include <asm/atarihw.h> | ||
73 | #include <asm/atariints.h> | ||
74 | #include <asm/atari_acsi.h> | ||
75 | #include <asm/atari_stdma.h> | ||
76 | #include <asm/atari_stram.h> | ||
77 | #include <asm/atari_SLM.h> | ||
78 | |||
79 | |||
80 | #undef DEBUG | ||
81 | |||
82 | /* Define this if the page data are continuous in physical memory. That | ||
83 | * requires less reprogramming of the ST-DMA */ | ||
84 | #define SLM_CONTINUOUS_DMA | ||
85 | |||
86 | /* Use continuous reprogramming of the ST-DMA counter register. This is | ||
87 | * --strictly speaking-- not allowed, Atari recommends not to look at the | ||
88 | * counter register while a DMA is going on. But I don't know if that applies | ||
89 | * only for reading the register, or also writing to it. Writing only works | ||
90 | * fine for me... The advantage is that the timing becomes absolutely | ||
91 | * uncritical: Just update each, say 200ms, the counter reg to its maximum, | ||
92 | * and the DMA will work until the status byte interrupt occurs. | ||
93 | */ | ||
94 | #define SLM_CONT_CNT_REPROG | ||
95 | |||
96 | #define CMDSET_TARG_LUN(cmd,targ,lun) \ | ||
97 | do { \ | ||
98 | cmd[0] = (cmd[0] & ~0xe0) | (targ)<<5; \ | ||
99 | cmd[1] = (cmd[1] & ~0xe0) | (lun)<<5; \ | ||
100 | } while(0) | ||
101 | |||
102 | #define START_TIMER(to) mod_timer(&slm_timer, jiffies + (to)) | ||
103 | #define STOP_TIMER() del_timer(&slm_timer) | ||
104 | |||
105 | |||
106 | static char slmreqsense_cmd[6] = { 0x03, 0, 0, 0, 0, 0 }; | ||
107 | static char slmprint_cmd[6] = { 0x0a, 0, 0, 0, 0, 0 }; | ||
108 | static char slminquiry_cmd[6] = { 0x12, 0, 0, 0, 0, 0x80 }; | ||
109 | static char slmmsense_cmd[6] = { 0x1a, 0, 0, 0, 255, 0 }; | ||
110 | #if 0 | ||
111 | static char slmmselect_cmd[6] = { 0x15, 0, 0, 0, 0, 0 }; | ||
112 | #endif | ||
113 | |||
114 | |||
115 | #define MAX_SLM 2 | ||
116 | |||
117 | static struct slm { | ||
118 | unsigned target; /* target number */ | ||
119 | unsigned lun; /* LUN in target controller */ | ||
120 | atomic_t wr_ok; /* set to 0 if output part busy */ | ||
121 | atomic_t rd_ok; /* set to 0 if status part busy */ | ||
122 | } slm_info[MAX_SLM]; | ||
123 | |||
124 | int N_SLM_Printers = 0; | ||
125 | |||
126 | /* printer buffer */ | ||
127 | static unsigned char *SLMBuffer; /* start of buffer */ | ||
128 | static unsigned char *BufferP; /* current position in buffer */ | ||
129 | static int BufferSize; /* length of buffer for page size */ | ||
130 | |||
131 | typedef enum { IDLE, FILLING, PRINTING } SLMSTATE; | ||
132 | static SLMSTATE SLMState; | ||
133 | static int SLMBufOwner; /* SLM# currently using the buffer */ | ||
134 | |||
135 | /* DMA variables */ | ||
136 | #ifndef SLM_CONT_CNT_REPROG | ||
137 | static unsigned long SLMCurAddr; /* current base addr of DMA chunk */ | ||
138 | static unsigned long SLMEndAddr; /* expected end addr */ | ||
139 | static unsigned long SLMSliceSize; /* size of one DMA chunk */ | ||
140 | #endif | ||
141 | static int SLMError; | ||
142 | |||
143 | /* wait queues */ | ||
144 | static DECLARE_WAIT_QUEUE_HEAD(slm_wait); /* waiting for buffer */ | ||
145 | static DECLARE_WAIT_QUEUE_HEAD(print_wait); /* waiting for printing finished */ | ||
146 | |||
147 | /* status codes */ | ||
148 | #define SLMSTAT_OK 0x00 | ||
149 | #define SLMSTAT_ORNERY 0x02 | ||
150 | #define SLMSTAT_TONER 0x03 | ||
151 | #define SLMSTAT_WARMUP 0x04 | ||
152 | #define SLMSTAT_PAPER 0x05 | ||
153 | #define SLMSTAT_DRUM 0x06 | ||
154 | #define SLMSTAT_INJAM 0x07 | ||
155 | #define SLMSTAT_THRJAM 0x08 | ||
156 | #define SLMSTAT_OUTJAM 0x09 | ||
157 | #define SLMSTAT_COVER 0x0a | ||
158 | #define SLMSTAT_FUSER 0x0b | ||
159 | #define SLMSTAT_IMAGER 0x0c | ||
160 | #define SLMSTAT_MOTOR 0x0d | ||
161 | #define SLMSTAT_VIDEO 0x0e | ||
162 | #define SLMSTAT_SYSTO 0x10 | ||
163 | #define SLMSTAT_OPCODE 0x12 | ||
164 | #define SLMSTAT_DEVNUM 0x15 | ||
165 | #define SLMSTAT_PARAM 0x1a | ||
166 | #define SLMSTAT_ACSITO 0x1b /* driver defined */ | ||
167 | #define SLMSTAT_NOTALL 0x1c /* driver defined */ | ||
168 | |||
169 | static char *SLMErrors[] = { | ||
170 | /* 0x00 */ "OK and ready", | ||
171 | /* 0x01 */ NULL, | ||
172 | /* 0x02 */ "ornery printer", | ||
173 | /* 0x03 */ "toner empty", | ||
174 | /* 0x04 */ "warming up", | ||
175 | /* 0x05 */ "paper empty", | ||
176 | /* 0x06 */ "drum empty", | ||
177 | /* 0x07 */ "input jam", | ||
178 | /* 0x08 */ "through jam", | ||
179 | /* 0x09 */ "output jam", | ||
180 | /* 0x0a */ "cover open", | ||
181 | /* 0x0b */ "fuser malfunction", | ||
182 | /* 0x0c */ "imager malfunction", | ||
183 | /* 0x0d */ "motor malfunction", | ||
184 | /* 0x0e */ "video malfunction", | ||
185 | /* 0x0f */ NULL, | ||
186 | /* 0x10 */ "printer system timeout", | ||
187 | /* 0x11 */ NULL, | ||
188 | /* 0x12 */ "invalid operation code", | ||
189 | /* 0x13 */ NULL, | ||
190 | /* 0x14 */ NULL, | ||
191 | /* 0x15 */ "invalid device number", | ||
192 | /* 0x16 */ NULL, | ||
193 | /* 0x17 */ NULL, | ||
194 | /* 0x18 */ NULL, | ||
195 | /* 0x19 */ NULL, | ||
196 | /* 0x1a */ "invalid parameter list", | ||
197 | /* 0x1b */ "ACSI timeout", | ||
198 | /* 0x1c */ "not all printed" | ||
199 | }; | ||
200 | |||
201 | #define N_ERRORS (sizeof(SLMErrors)/sizeof(*SLMErrors)) | ||
202 | |||
203 | /* real (driver caused) error? */ | ||
204 | #define IS_REAL_ERROR(x) (x > 0x10) | ||
205 | |||
206 | |||
207 | static struct { | ||
208 | char *name; | ||
209 | int w, h; | ||
210 | } StdPageSize[] = { | ||
211 | { "Letter", 2400, 3180 }, | ||
212 | { "Legal", 2400, 4080 }, | ||
213 | { "A4", 2336, 3386 }, | ||
214 | { "B5", 2016, 2914 } | ||
215 | }; | ||
216 | |||
217 | #define N_STD_SIZES (sizeof(StdPageSize)/sizeof(*StdPageSize)) | ||
218 | |||
219 | #define SLM_BUFFER_SIZE (2336*3386/8) /* A4 for now */ | ||
220 | #define SLM_DMA_AMOUNT 255 /* #sectors to program the DMA for */ | ||
221 | |||
222 | #ifdef SLM_CONTINUOUS_DMA | ||
223 | # define SLM_DMA_INT_OFFSET 0 /* DMA goes until seccnt 0, no offs */ | ||
224 | # define SLM_DMA_END_OFFSET 32 /* 32 Byte ST-DMA FIFO */ | ||
225 | # define SLM_SLICE_SIZE(w) (255*512) | ||
226 | #else | ||
227 | # define SLM_DMA_INT_OFFSET 32 /* 32 Byte ST-DMA FIFO */ | ||
228 | # define SLM_DMA_END_OFFSET 32 /* 32 Byte ST-DMA FIFO */ | ||
229 | # define SLM_SLICE_SIZE(w) ((254*512)/(w/8)*(w/8)) | ||
230 | #endif | ||
231 | |||
232 | /* calculate the number of jiffies to wait for 'n' bytes */ | ||
233 | #ifdef SLM_CONT_CNT_REPROG | ||
234 | #define DMA_TIME_FOR(n) 50 | ||
235 | #define DMA_STARTUP_TIME 0 | ||
236 | #else | ||
237 | #define DMA_TIME_FOR(n) (n/1400-1) | ||
238 | #define DMA_STARTUP_TIME 650 | ||
239 | #endif | ||
240 | |||
241 | /***************************** Prototypes *****************************/ | ||
242 | |||
243 | static char *slm_errstr( int stat ); | ||
244 | static int slm_getstats( char *buffer, int device ); | ||
245 | static ssize_t slm_read( struct file* file, char *buf, size_t count, loff_t | ||
246 | *ppos ); | ||
247 | static void start_print( int device ); | ||
248 | static irqreturn_t slm_interrupt(int irc, void *data); | ||
249 | static void slm_test_ready( unsigned long dummy ); | ||
250 | static void set_dma_addr( unsigned long paddr ); | ||
251 | static unsigned long get_dma_addr( void ); | ||
252 | static ssize_t slm_write( struct file *file, const char *buf, size_t count, | ||
253 | loff_t *ppos ); | ||
254 | static int slm_ioctl( struct inode *inode, struct file *file, unsigned int | ||
255 | cmd, unsigned long arg ); | ||
256 | static int slm_open( struct inode *inode, struct file *file ); | ||
257 | static int slm_release( struct inode *inode, struct file *file ); | ||
258 | static int slm_req_sense( int device ); | ||
259 | static int slm_mode_sense( int device, char *buffer, int abs_flag ); | ||
260 | #if 0 | ||
261 | static int slm_mode_select( int device, char *buffer, int len, int | ||
262 | default_flag ); | ||
263 | #endif | ||
264 | static int slm_get_pagesize( int device, int *w, int *h ); | ||
265 | |||
266 | /************************* End of Prototypes **************************/ | ||
267 | |||
268 | |||
269 | static DEFINE_TIMER(slm_timer, slm_test_ready, 0, 0); | ||
270 | |||
271 | static const struct file_operations slm_fops = { | ||
272 | .owner = THIS_MODULE, | ||
273 | .read = slm_read, | ||
274 | .write = slm_write, | ||
275 | .ioctl = slm_ioctl, | ||
276 | .open = slm_open, | ||
277 | .release = slm_release, | ||
278 | }; | ||
279 | |||
280 | |||
281 | /* ---------------------------------------------------------------------- */ | ||
282 | /* Status Functions */ | ||
283 | |||
284 | |||
285 | static char *slm_errstr( int stat ) | ||
286 | |||
287 | { char *p; | ||
288 | static char str[22]; | ||
289 | |||
290 | stat &= 0x1f; | ||
291 | if (stat >= 0 && stat < N_ERRORS && (p = SLMErrors[stat])) | ||
292 | return( p ); | ||
293 | sprintf( str, "unknown status 0x%02x", stat ); | ||
294 | return( str ); | ||
295 | } | ||
296 | |||
297 | |||
298 | static int slm_getstats( char *buffer, int device ) | ||
299 | |||
300 | { int len = 0, stat, i, w, h; | ||
301 | unsigned char buf[256]; | ||
302 | |||
303 | stat = slm_mode_sense( device, buf, 0 ); | ||
304 | if (IS_REAL_ERROR(stat)) | ||
305 | return( -EIO ); | ||
306 | |||
307 | #define SHORTDATA(i) ((buf[i] << 8) | buf[i+1]) | ||
308 | #define BOOLDATA(i,mask) ((buf[i] & mask) ? "on" : "off") | ||
309 | |||
310 | w = SHORTDATA( 3 ); | ||
311 | h = SHORTDATA( 1 ); | ||
312 | |||
313 | len += sprintf( buffer+len, "Status\t\t%s\n", | ||
314 | slm_errstr( stat ) ); | ||
315 | len += sprintf( buffer+len, "Page Size\t%dx%d", | ||
316 | w, h ); | ||
317 | |||
318 | for( i = 0; i < N_STD_SIZES; ++i ) { | ||
319 | if (w == StdPageSize[i].w && h == StdPageSize[i].h) | ||
320 | break; | ||
321 | } | ||
322 | if (i < N_STD_SIZES) | ||
323 | len += sprintf( buffer+len, " (%s)", StdPageSize[i].name ); | ||
324 | buffer[len++] = '\n'; | ||
325 | |||
326 | len += sprintf( buffer+len, "Top/Left Margin\t%d/%d\n", | ||
327 | SHORTDATA( 5 ), SHORTDATA( 7 ) ); | ||
328 | len += sprintf( buffer+len, "Manual Feed\t%s\n", | ||
329 | BOOLDATA( 9, 0x01 ) ); | ||
330 | len += sprintf( buffer+len, "Input Select\t%d\n", | ||
331 | (buf[9] >> 1) & 7 ); | ||
332 | len += sprintf( buffer+len, "Auto Select\t%s\n", | ||
333 | BOOLDATA( 9, 0x10 ) ); | ||
334 | len += sprintf( buffer+len, "Prefeed Paper\t%s\n", | ||
335 | BOOLDATA( 9, 0x20 ) ); | ||
336 | len += sprintf( buffer+len, "Thick Pixels\t%s\n", | ||
337 | BOOLDATA( 9, 0x40 ) ); | ||
338 | len += sprintf( buffer+len, "H/V Resol.\t%d/%d dpi\n", | ||
339 | SHORTDATA( 12 ), SHORTDATA( 10 ) ); | ||
340 | len += sprintf( buffer+len, "System Timeout\t%d\n", | ||
341 | buf[14] ); | ||
342 | len += sprintf( buffer+len, "Scan Time\t%d\n", | ||
343 | SHORTDATA( 15 ) ); | ||
344 | len += sprintf( buffer+len, "Page Count\t%d\n", | ||
345 | SHORTDATA( 17 ) ); | ||
346 | len += sprintf( buffer+len, "In/Out Cap.\t%d/%d\n", | ||
347 | SHORTDATA( 19 ), SHORTDATA( 21 ) ); | ||
348 | len += sprintf( buffer+len, "Stagger Output\t%s\n", | ||
349 | BOOLDATA( 23, 0x01 ) ); | ||
350 | len += sprintf( buffer+len, "Output Select\t%d\n", | ||
351 | (buf[23] >> 1) & 7 ); | ||
352 | len += sprintf( buffer+len, "Duplex Print\t%s\n", | ||
353 | BOOLDATA( 23, 0x10 ) ); | ||
354 | len += sprintf( buffer+len, "Color Sep.\t%s\n", | ||
355 | BOOLDATA( 23, 0x20 ) ); | ||
356 | |||
357 | return( len ); | ||
358 | } | ||
359 | |||
360 | |||
361 | static ssize_t slm_read( struct file *file, char *buf, size_t count, | ||
362 | loff_t *ppos ) | ||
363 | |||
364 | { | ||
365 | struct inode *node = file->f_path.dentry->d_inode; | ||
366 | unsigned long page; | ||
367 | int length; | ||
368 | int end; | ||
369 | |||
370 | if (!(page = __get_free_page( GFP_KERNEL ))) | ||
371 | return( -ENOMEM ); | ||
372 | |||
373 | length = slm_getstats( (char *)page, iminor(node) ); | ||
374 | if (length < 0) { | ||
375 | count = length; | ||
376 | goto out; | ||
377 | } | ||
378 | if (file->f_pos >= length) { | ||
379 | count = 0; | ||
380 | goto out; | ||
381 | } | ||
382 | if (count + file->f_pos > length) | ||
383 | count = length - file->f_pos; | ||
384 | end = count + file->f_pos; | ||
385 | if (copy_to_user(buf, (char *)page + file->f_pos, count)) { | ||
386 | count = -EFAULT; | ||
387 | goto out; | ||
388 | } | ||
389 | file->f_pos = end; | ||
390 | out: free_page( page ); | ||
391 | return( count ); | ||
392 | } | ||
393 | |||
394 | |||
395 | /* ---------------------------------------------------------------------- */ | ||
396 | /* Printing */ | ||
397 | |||
398 | |||
399 | static void start_print( int device ) | ||
400 | |||
401 | { struct slm *sip = &slm_info[device]; | ||
402 | unsigned char *cmd; | ||
403 | unsigned long paddr; | ||
404 | int i; | ||
405 | |||
406 | stdma_lock( slm_interrupt, NULL ); | ||
407 | |||
408 | CMDSET_TARG_LUN( slmprint_cmd, sip->target, sip->lun ); | ||
409 | cmd = slmprint_cmd; | ||
410 | paddr = virt_to_phys( SLMBuffer ); | ||
411 | dma_cache_maintenance( paddr, virt_to_phys(BufferP)-paddr, 1 ); | ||
412 | DISABLE_IRQ(); | ||
413 | |||
414 | /* Low on A1 */ | ||
415 | dma_wd.dma_mode_status = 0x88; | ||
416 | MFPDELAY(); | ||
417 | |||
418 | /* send the command bytes except the last */ | ||
419 | for( i = 0; i < 5; ++i ) { | ||
420 | DMA_LONG_WRITE( *cmd++, 0x8a ); | ||
421 | udelay(20); | ||
422 | if (!acsi_wait_for_IRQ( HZ/2 )) { | ||
423 | SLMError = 1; | ||
424 | return; /* timeout */ | ||
425 | } | ||
426 | } | ||
427 | /* last command byte */ | ||
428 | DMA_LONG_WRITE( *cmd++, 0x82 ); | ||
429 | MFPDELAY(); | ||
430 | /* set DMA address */ | ||
431 | set_dma_addr( paddr ); | ||
432 | /* program DMA for write and select sector counter reg */ | ||
433 | dma_wd.dma_mode_status = 0x192; | ||
434 | MFPDELAY(); | ||
435 | /* program for 255*512 bytes and start DMA */ | ||
436 | DMA_LONG_WRITE( SLM_DMA_AMOUNT, 0x112 ); | ||
437 | |||
438 | #ifndef SLM_CONT_CNT_REPROG | ||
439 | SLMCurAddr = paddr; | ||
440 | SLMEndAddr = paddr + SLMSliceSize + SLM_DMA_INT_OFFSET; | ||
441 | #endif | ||
442 | START_TIMER( DMA_STARTUP_TIME + DMA_TIME_FOR( SLMSliceSize )); | ||
443 | #if !defined(SLM_CONT_CNT_REPROG) && defined(DEBUG) | ||
444 | printk( "SLM: CurAddr=%#lx EndAddr=%#lx timer=%ld\n", | ||
445 | SLMCurAddr, SLMEndAddr, DMA_TIME_FOR( SLMSliceSize ) ); | ||
446 | #endif | ||
447 | |||
448 | ENABLE_IRQ(); | ||
449 | } | ||
450 | |||
451 | |||
452 | /* Only called when an error happened or at the end of a page */ | ||
453 | |||
454 | static irqreturn_t slm_interrupt(int irc, void *data) | ||
455 | |||
456 | { unsigned long addr; | ||
457 | int stat; | ||
458 | |||
459 | STOP_TIMER(); | ||
460 | addr = get_dma_addr(); | ||
461 | stat = acsi_getstatus(); | ||
462 | SLMError = (stat < 0) ? SLMSTAT_ACSITO : | ||
463 | (addr < virt_to_phys(BufferP)) ? SLMSTAT_NOTALL : | ||
464 | stat; | ||
465 | |||
466 | dma_wd.dma_mode_status = 0x80; | ||
467 | MFPDELAY(); | ||
468 | #ifdef DEBUG | ||
469 | printk( "SLM: interrupt, addr=%#lx, error=%d\n", addr, SLMError ); | ||
470 | #endif | ||
471 | |||
472 | wake_up( &print_wait ); | ||
473 | stdma_release(); | ||
474 | ENABLE_IRQ(); | ||
475 | return IRQ_HANDLED; | ||
476 | } | ||
477 | |||
478 | |||
479 | static void slm_test_ready( unsigned long dummy ) | ||
480 | |||
481 | { | ||
482 | #ifdef SLM_CONT_CNT_REPROG | ||
483 | /* program for 255*512 bytes again */ | ||
484 | dma_wd.fdc_acces_seccount = SLM_DMA_AMOUNT; | ||
485 | START_TIMER( DMA_TIME_FOR(0) ); | ||
486 | #ifdef DEBUG | ||
487 | printk( "SLM: reprogramming timer for %d jiffies, addr=%#lx\n", | ||
488 | DMA_TIME_FOR(0), get_dma_addr() ); | ||
489 | #endif | ||
490 | |||
491 | #else /* !SLM_CONT_CNT_REPROG */ | ||
492 | |||
493 | unsigned long flags, addr; | ||
494 | int d, ti; | ||
495 | #ifdef DEBUG | ||
496 | struct timeval start_tm, end_tm; | ||
497 | int did_wait = 0; | ||
498 | #endif | ||
499 | |||
500 | local_irq_save(flags); | ||
501 | |||
502 | addr = get_dma_addr(); | ||
503 | if ((d = SLMEndAddr - addr) > 0) { | ||
504 | local_irq_restore(flags); | ||
505 | |||
506 | /* slice not yet finished, decide whether to start another timer or to | ||
507 | * busy-wait */ | ||
508 | ti = DMA_TIME_FOR( d ); | ||
509 | if (ti > 0) { | ||
510 | #ifdef DEBUG | ||
511 | printk( "SLM: reprogramming timer for %d jiffies, rest %d bytes\n", | ||
512 | ti, d ); | ||
513 | #endif | ||
514 | START_TIMER( ti ); | ||
515 | return; | ||
516 | } | ||
517 | /* wait for desired end address to be reached */ | ||
518 | #ifdef DEBUG | ||
519 | do_gettimeofday( &start_tm ); | ||
520 | did_wait = 1; | ||
521 | #endif | ||
522 | local_irq_disable(); | ||
523 | while( get_dma_addr() < SLMEndAddr ) | ||
524 | barrier(); | ||
525 | } | ||
526 | |||
527 | /* slice finished, start next one */ | ||
528 | SLMCurAddr += SLMSliceSize; | ||
529 | |||
530 | #ifdef SLM_CONTINUOUS_DMA | ||
531 | /* program for 255*512 bytes again */ | ||
532 | dma_wd.fdc_acces_seccount = SLM_DMA_AMOUNT; | ||
533 | #else | ||
534 | /* set DMA address; | ||
535 | * add 2 bytes for the ones in the SLM controller FIFO! */ | ||
536 | set_dma_addr( SLMCurAddr + 2 ); | ||
537 | /* toggle DMA to write and select sector counter reg */ | ||
538 | dma_wd.dma_mode_status = 0x92; | ||
539 | MFPDELAY(); | ||
540 | dma_wd.dma_mode_status = 0x192; | ||
541 | MFPDELAY(); | ||
542 | /* program for 255*512 bytes and start DMA */ | ||
543 | DMA_LONG_WRITE( SLM_DMA_AMOUNT, 0x112 ); | ||
544 | #endif | ||
545 | |||
546 | local_irq_restore(flags); | ||
547 | |||
548 | #ifdef DEBUG | ||
549 | if (did_wait) { | ||
550 | int ms; | ||
551 | do_gettimeofday( &end_tm ); | ||
552 | ms = (end_tm.tv_sec*1000000+end_tm.tv_usec) - | ||
553 | (start_tm.tv_sec*1000000+start_tm.tv_usec); | ||
554 | printk( "SLM: did %ld.%ld ms busy waiting for %d bytes\n", | ||
555 | ms/1000, ms%1000, d ); | ||
556 | } | ||
557 | else | ||
558 | printk( "SLM: didn't wait (!)\n" ); | ||
559 | #endif | ||
560 | |||
561 | if ((unsigned char *)PTOV( SLMCurAddr + SLMSliceSize ) >= BufferP) { | ||
562 | /* will be last slice, no timer necessary */ | ||
563 | #ifdef DEBUG | ||
564 | printk( "SLM: CurAddr=%#lx EndAddr=%#lx last slice -> no timer\n", | ||
565 | SLMCurAddr, SLMEndAddr ); | ||
566 | #endif | ||
567 | } | ||
568 | else { | ||
569 | /* not last slice */ | ||
570 | SLMEndAddr = SLMCurAddr + SLMSliceSize + SLM_DMA_INT_OFFSET; | ||
571 | START_TIMER( DMA_TIME_FOR( SLMSliceSize )); | ||
572 | #ifdef DEBUG | ||
573 | printk( "SLM: CurAddr=%#lx EndAddr=%#lx timer=%ld\n", | ||
574 | SLMCurAddr, SLMEndAddr, DMA_TIME_FOR( SLMSliceSize ) ); | ||
575 | #endif | ||
576 | } | ||
577 | #endif /* SLM_CONT_CNT_REPROG */ | ||
578 | } | ||
579 | |||
580 | |||
581 | static void set_dma_addr( unsigned long paddr ) | ||
582 | |||
583 | { unsigned long flags; | ||
584 | |||
585 | local_irq_save(flags); | ||
586 | dma_wd.dma_lo = (unsigned char)paddr; | ||
587 | paddr >>= 8; | ||
588 | MFPDELAY(); | ||
589 | dma_wd.dma_md = (unsigned char)paddr; | ||
590 | paddr >>= 8; | ||
591 | MFPDELAY(); | ||
592 | if (ATARIHW_PRESENT( EXTD_DMA )) | ||
593 | st_dma_ext_dmahi = (unsigned short)paddr; | ||
594 | else | ||
595 | dma_wd.dma_hi = (unsigned char)paddr; | ||
596 | MFPDELAY(); | ||
597 | local_irq_restore(flags); | ||
598 | } | ||
599 | |||
600 | |||
601 | static unsigned long get_dma_addr( void ) | ||
602 | |||
603 | { unsigned long addr; | ||
604 | |||
605 | addr = dma_wd.dma_lo & 0xff; | ||
606 | MFPDELAY(); | ||
607 | addr |= (dma_wd.dma_md & 0xff) << 8; | ||
608 | MFPDELAY(); | ||
609 | addr |= (dma_wd.dma_hi & 0xff) << 16; | ||
610 | MFPDELAY(); | ||
611 | |||
612 | return( addr ); | ||
613 | } | ||
614 | |||
615 | |||
616 | static ssize_t slm_write( struct file *file, const char *buf, size_t count, | ||
617 | loff_t *ppos ) | ||
618 | |||
619 | { | ||
620 | struct inode *node = file->f_path.dentry->d_inode; | ||
621 | int device = iminor(node); | ||
622 | int n, filled, w, h; | ||
623 | |||
624 | while( SLMState == PRINTING || | ||
625 | (SLMState == FILLING && SLMBufOwner != device) ) { | ||
626 | interruptible_sleep_on( &slm_wait ); | ||
627 | if (signal_pending(current)) | ||
628 | return( -ERESTARTSYS ); | ||
629 | } | ||
630 | if (SLMState == IDLE) { | ||
631 | /* first data of page: get current page size */ | ||
632 | if (slm_get_pagesize( device, &w, &h )) | ||
633 | return( -EIO ); | ||
634 | BufferSize = w*h/8; | ||
635 | if (BufferSize > SLM_BUFFER_SIZE) | ||
636 | return( -ENOMEM ); | ||
637 | |||
638 | SLMState = FILLING; | ||
639 | SLMBufOwner = device; | ||
640 | } | ||
641 | |||
642 | n = count; | ||
643 | filled = BufferP - SLMBuffer; | ||
644 | if (filled + n > BufferSize) | ||
645 | n = BufferSize - filled; | ||
646 | |||
647 | if (copy_from_user(BufferP, buf, n)) | ||
648 | return -EFAULT; | ||
649 | BufferP += n; | ||
650 | filled += n; | ||
651 | |||
652 | if (filled == BufferSize) { | ||
653 | /* Check the paper size again! The user may have switched it in the | ||
654 | * time between starting the data and finishing them. Would end up in | ||
655 | * a trashy page... */ | ||
656 | if (slm_get_pagesize( device, &w, &h )) | ||
657 | return( -EIO ); | ||
658 | if (BufferSize != w*h/8) { | ||
659 | printk( KERN_NOTICE "slm%d: page size changed while printing\n", | ||
660 | device ); | ||
661 | return( -EAGAIN ); | ||
662 | } | ||
663 | |||
664 | SLMState = PRINTING; | ||
665 | /* choose a slice size that is a multiple of the line size */ | ||
666 | #ifndef SLM_CONT_CNT_REPROG | ||
667 | SLMSliceSize = SLM_SLICE_SIZE(w); | ||
668 | #endif | ||
669 | |||
670 | start_print( device ); | ||
671 | sleep_on( &print_wait ); | ||
672 | if (SLMError && IS_REAL_ERROR(SLMError)) { | ||
673 | printk( KERN_ERR "slm%d: %s\n", device, slm_errstr(SLMError) ); | ||
674 | n = -EIO; | ||
675 | } | ||
676 | |||
677 | SLMState = IDLE; | ||
678 | BufferP = SLMBuffer; | ||
679 | wake_up_interruptible( &slm_wait ); | ||
680 | } | ||
681 | |||
682 | return( n ); | ||
683 | } | ||
684 | |||
685 | |||
686 | /* ---------------------------------------------------------------------- */ | ||
687 | /* ioctl Functions */ | ||
688 | |||
689 | |||
690 | static int slm_ioctl( struct inode *inode, struct file *file, | ||
691 | unsigned int cmd, unsigned long arg ) | ||
692 | |||
693 | { int device = iminor(inode), err; | ||
694 | |||
695 | /* I can think of setting: | ||
696 | * - manual feed | ||
697 | * - paper format | ||
698 | * - copy count | ||
699 | * - ... | ||
700 | * but haven't implemented that yet :-) | ||
701 | * BTW, has anybody better docs about the MODE SENSE/MODE SELECT data? | ||
702 | */ | ||
703 | switch( cmd ) { | ||
704 | |||
705 | case SLMIORESET: /* reset buffer, i.e. empty the buffer */ | ||
706 | if (!(file->f_mode & 2)) | ||
707 | return( -EINVAL ); | ||
708 | if (SLMState == PRINTING) | ||
709 | return( -EBUSY ); | ||
710 | SLMState = IDLE; | ||
711 | BufferP = SLMBuffer; | ||
712 | wake_up_interruptible( &slm_wait ); | ||
713 | return( 0 ); | ||
714 | |||
715 | case SLMIOGSTAT: { /* get status */ | ||
716 | int stat; | ||
717 | char *str; | ||
718 | |||
719 | stat = slm_req_sense( device ); | ||
720 | if (arg) { | ||
721 | str = slm_errstr( stat ); | ||
722 | if (put_user(stat, | ||
723 | (long *)&((struct SLM_status *)arg)->stat)) | ||
724 | return -EFAULT; | ||
725 | if (copy_to_user( ((struct SLM_status *)arg)->str, str, | ||
726 | strlen(str) + 1)) | ||
727 | return -EFAULT; | ||
728 | } | ||
729 | return( stat ); | ||
730 | } | ||
731 | |||
732 | case SLMIOGPSIZE: { /* get paper size */ | ||
733 | int w, h; | ||
734 | |||
735 | if ((err = slm_get_pagesize( device, &w, &h ))) return( err ); | ||
736 | |||
737 | if (put_user(w, (long *)&((struct SLM_paper_size *)arg)->width)) | ||
738 | return -EFAULT; | ||
739 | if (put_user(h, (long *)&((struct SLM_paper_size *)arg)->height)) | ||
740 | return -EFAULT; | ||
741 | return( 0 ); | ||
742 | } | ||
743 | |||
744 | case SLMIOGMFEED: /* get manual feed */ | ||
745 | return( -EINVAL ); | ||
746 | |||
747 | case SLMIOSPSIZE: /* set paper size */ | ||
748 | return( -EINVAL ); | ||
749 | |||
750 | case SLMIOSMFEED: /* set manual feed */ | ||
751 | return( -EINVAL ); | ||
752 | |||
753 | } | ||
754 | return( -EINVAL ); | ||
755 | } | ||
756 | |||
757 | |||
758 | /* ---------------------------------------------------------------------- */ | ||
759 | /* Opening and Closing */ | ||
760 | |||
761 | |||
762 | static int slm_open( struct inode *inode, struct file *file ) | ||
763 | |||
764 | { int device; | ||
765 | struct slm *sip; | ||
766 | |||
767 | device = iminor(inode); | ||
768 | if (device >= N_SLM_Printers) | ||
769 | return( -ENXIO ); | ||
770 | sip = &slm_info[device]; | ||
771 | |||
772 | if (file->f_mode & 2) { | ||
773 | /* open for writing is exclusive */ | ||
774 | if ( !atomic_dec_and_test(&sip->wr_ok) ) { | ||
775 | atomic_inc(&sip->wr_ok); | ||
776 | return( -EBUSY ); | ||
777 | } | ||
778 | } | ||
779 | if (file->f_mode & 1) { | ||
780 | /* open for reading is exclusive */ | ||
781 | if ( !atomic_dec_and_test(&sip->rd_ok) ) { | ||
782 | atomic_inc(&sip->rd_ok); | ||
783 | return( -EBUSY ); | ||
784 | } | ||
785 | } | ||
786 | |||
787 | return( 0 ); | ||
788 | } | ||
789 | |||
790 | |||
791 | static int slm_release( struct inode *inode, struct file *file ) | ||
792 | |||
793 | { int device; | ||
794 | struct slm *sip; | ||
795 | |||
796 | device = iminor(inode); | ||
797 | sip = &slm_info[device]; | ||
798 | |||
799 | if (file->f_mode & 2) | ||
800 | atomic_inc( &sip->wr_ok ); | ||
801 | if (file->f_mode & 1) | ||
802 | atomic_inc( &sip->rd_ok ); | ||
803 | |||
804 | return( 0 ); | ||
805 | } | ||
806 | |||
807 | |||
808 | /* ---------------------------------------------------------------------- */ | ||
809 | /* ACSI Primitives for the SLM */ | ||
810 | |||
811 | |||
812 | static int slm_req_sense( int device ) | ||
813 | |||
814 | { int stat, rv; | ||
815 | struct slm *sip = &slm_info[device]; | ||
816 | |||
817 | stdma_lock( NULL, NULL ); | ||
818 | |||
819 | CMDSET_TARG_LUN( slmreqsense_cmd, sip->target, sip->lun ); | ||
820 | if (!acsicmd_nodma( slmreqsense_cmd, 0 ) || | ||
821 | (stat = acsi_getstatus()) < 0) | ||
822 | rv = SLMSTAT_ACSITO; | ||
823 | else | ||
824 | rv = stat & 0x1f; | ||
825 | |||
826 | ENABLE_IRQ(); | ||
827 | stdma_release(); | ||
828 | return( rv ); | ||
829 | } | ||
830 | |||
831 | |||
832 | static int slm_mode_sense( int device, char *buffer, int abs_flag ) | ||
833 | |||
834 | { unsigned char stat, len; | ||
835 | int rv = 0; | ||
836 | struct slm *sip = &slm_info[device]; | ||
837 | |||
838 | stdma_lock( NULL, NULL ); | ||
839 | |||
840 | CMDSET_TARG_LUN( slmmsense_cmd, sip->target, sip->lun ); | ||
841 | slmmsense_cmd[5] = abs_flag ? 0x80 : 0; | ||
842 | if (!acsicmd_nodma( slmmsense_cmd, 0 )) { | ||
843 | rv = SLMSTAT_ACSITO; | ||
844 | goto the_end; | ||
845 | } | ||
846 | |||
847 | if (!acsi_extstatus( &stat, 1 )) { | ||
848 | acsi_end_extstatus(); | ||
849 | rv = SLMSTAT_ACSITO; | ||
850 | goto the_end; | ||
851 | } | ||
852 | |||
853 | if (!acsi_extstatus( &len, 1 )) { | ||
854 | acsi_end_extstatus(); | ||
855 | rv = SLMSTAT_ACSITO; | ||
856 | goto the_end; | ||
857 | } | ||
858 | buffer[0] = len; | ||
859 | if (!acsi_extstatus( buffer+1, len )) { | ||
860 | acsi_end_extstatus(); | ||
861 | rv = SLMSTAT_ACSITO; | ||
862 | goto the_end; | ||
863 | } | ||
864 | |||
865 | acsi_end_extstatus(); | ||
866 | rv = stat & 0x1f; | ||
867 | |||
868 | the_end: | ||
869 | ENABLE_IRQ(); | ||
870 | stdma_release(); | ||
871 | return( rv ); | ||
872 | } | ||
873 | |||
874 | |||
875 | #if 0 | ||
876 | /* currently unused */ | ||
877 | static int slm_mode_select( int device, char *buffer, int len, | ||
878 | int default_flag ) | ||
879 | |||
880 | { int stat, rv; | ||
881 | struct slm *sip = &slm_info[device]; | ||
882 | |||
883 | stdma_lock( NULL, NULL ); | ||
884 | |||
885 | CMDSET_TARG_LUN( slmmselect_cmd, sip->target, sip->lun ); | ||
886 | slmmselect_cmd[5] = default_flag ? 0x80 : 0; | ||
887 | if (!acsicmd_nodma( slmmselect_cmd, 0 )) { | ||
888 | rv = SLMSTAT_ACSITO; | ||
889 | goto the_end; | ||
890 | } | ||
891 | |||
892 | if (!default_flag) { | ||
893 | unsigned char c = len; | ||
894 | if (!acsi_extcmd( &c, 1 )) { | ||
895 | rv = SLMSTAT_ACSITO; | ||
896 | goto the_end; | ||
897 | } | ||
898 | if (!acsi_extcmd( buffer, len )) { | ||
899 | rv = SLMSTAT_ACSITO; | ||
900 | goto the_end; | ||
901 | } | ||
902 | } | ||
903 | |||
904 | stat = acsi_getstatus(); | ||
905 | rv = (stat < 0 ? SLMSTAT_ACSITO : stat); | ||
906 | |||
907 | the_end: | ||
908 | ENABLE_IRQ(); | ||
909 | stdma_release(); | ||
910 | return( rv ); | ||
911 | } | ||
912 | #endif | ||
913 | |||
914 | |||
915 | static int slm_get_pagesize( int device, int *w, int *h ) | ||
916 | |||
917 | { char buf[256]; | ||
918 | int stat; | ||
919 | |||
920 | stat = slm_mode_sense( device, buf, 0 ); | ||
921 | ENABLE_IRQ(); | ||
922 | stdma_release(); | ||
923 | |||
924 | if (stat != SLMSTAT_OK) | ||
925 | return( -EIO ); | ||
926 | |||
927 | *w = (buf[3] << 8) | buf[4]; | ||
928 | *h = (buf[1] << 8) | buf[2]; | ||
929 | return( 0 ); | ||
930 | } | ||
931 | |||
932 | |||
933 | /* ---------------------------------------------------------------------- */ | ||
934 | /* Initialization */ | ||
935 | |||
936 | |||
937 | int attach_slm( int target, int lun ) | ||
938 | |||
939 | { static int did_register; | ||
940 | int len; | ||
941 | |||
942 | if (N_SLM_Printers >= MAX_SLM) { | ||
943 | printk( KERN_WARNING "Too much SLMs\n" ); | ||
944 | return( 0 ); | ||
945 | } | ||
946 | |||
947 | /* do an INQUIRY */ | ||
948 | udelay(100); | ||
949 | CMDSET_TARG_LUN( slminquiry_cmd, target, lun ); | ||
950 | if (!acsicmd_nodma( slminquiry_cmd, 0 )) { | ||
951 | inq_timeout: | ||
952 | printk( KERN_ERR "SLM inquiry command timed out.\n" ); | ||
953 | inq_fail: | ||
954 | acsi_end_extstatus(); | ||
955 | return( 0 ); | ||
956 | } | ||
957 | /* read status and header of return data */ | ||
958 | if (!acsi_extstatus( SLMBuffer, 6 )) | ||
959 | goto inq_timeout; | ||
960 | |||
961 | if (SLMBuffer[1] != 2) { /* device type == printer? */ | ||
962 | printk( KERN_ERR "SLM inquiry returned device type != printer\n" ); | ||
963 | goto inq_fail; | ||
964 | } | ||
965 | len = SLMBuffer[5]; | ||
966 | |||
967 | /* read id string */ | ||
968 | if (!acsi_extstatus( SLMBuffer, len )) | ||
969 | goto inq_timeout; | ||
970 | acsi_end_extstatus(); | ||
971 | SLMBuffer[len] = 0; | ||
972 | |||
973 | if (!did_register) { | ||
974 | did_register = 1; | ||
975 | } | ||
976 | |||
977 | slm_info[N_SLM_Printers].target = target; | ||
978 | slm_info[N_SLM_Printers].lun = lun; | ||
979 | atomic_set(&slm_info[N_SLM_Printers].wr_ok, 1 ); | ||
980 | atomic_set(&slm_info[N_SLM_Printers].rd_ok, 1 ); | ||
981 | |||
982 | printk( KERN_INFO " Printer: %s\n", SLMBuffer ); | ||
983 | printk( KERN_INFO "Detected slm%d at id %d lun %d\n", | ||
984 | N_SLM_Printers, target, lun ); | ||
985 | N_SLM_Printers++; | ||
986 | return( 1 ); | ||
987 | } | ||
988 | |||
989 | int slm_init( void ) | ||
990 | |||
991 | { | ||
992 | int i; | ||
993 | if (register_chrdev( ACSI_MAJOR, "slm", &slm_fops )) { | ||
994 | printk( KERN_ERR "Unable to get major %d for ACSI SLM\n", ACSI_MAJOR ); | ||
995 | return -EBUSY; | ||
996 | } | ||
997 | |||
998 | if (!(SLMBuffer = atari_stram_alloc( SLM_BUFFER_SIZE, "SLM" ))) { | ||
999 | printk( KERN_ERR "Unable to get SLM ST-Ram buffer.\n" ); | ||
1000 | unregister_chrdev( ACSI_MAJOR, "slm" ); | ||
1001 | return -ENOMEM; | ||
1002 | } | ||
1003 | BufferP = SLMBuffer; | ||
1004 | SLMState = IDLE; | ||
1005 | |||
1006 | return 0; | ||
1007 | } | ||
1008 | |||
1009 | #ifdef MODULE | ||
1010 | |||
1011 | /* from acsi.c */ | ||
1012 | void acsi_attach_SLMs( int (*attach_func)( int, int ) ); | ||
1013 | |||
1014 | int init_module(void) | ||
1015 | { | ||
1016 | int err; | ||
1017 | |||
1018 | if ((err = slm_init())) | ||
1019 | return( err ); | ||
1020 | /* This calls attach_slm() for every target/lun where acsi.c detected a | ||
1021 | * printer */ | ||
1022 | acsi_attach_SLMs( attach_slm ); | ||
1023 | return( 0 ); | ||
1024 | } | ||
1025 | |||
1026 | void cleanup_module(void) | ||
1027 | { | ||
1028 | if (unregister_chrdev( ACSI_MAJOR, "slm" ) != 0) | ||
1029 | printk( KERN_ERR "acsi_slm: cleanup_module failed\n"); | ||
1030 | atari_stram_free( SLMBuffer ); | ||
1031 | } | ||
1032 | #endif | ||
diff --git a/drivers/block/umem.c b/drivers/block/umem.c index 6f5d6203d725..dec74bd23496 100644 --- a/drivers/block/umem.c +++ b/drivers/block/umem.c | |||
@@ -105,12 +105,6 @@ struct cardinfo { | |||
105 | unsigned long csr_base; | 105 | unsigned long csr_base; |
106 | unsigned char __iomem *csr_remap; | 106 | unsigned char __iomem *csr_remap; |
107 | unsigned long csr_len; | 107 | unsigned long csr_len; |
108 | #ifdef CONFIG_MM_MAP_MEMORY | ||
109 | unsigned long mem_base; | ||
110 | unsigned char __iomem *mem_remap; | ||
111 | unsigned long mem_len; | ||
112 | #endif | ||
113 | |||
114 | unsigned int win_size; /* PCI window size */ | 108 | unsigned int win_size; /* PCI window size */ |
115 | unsigned int mm_size; /* size in kbytes */ | 109 | unsigned int mm_size; /* size in kbytes */ |
116 | 110 | ||
@@ -872,10 +866,6 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i | |||
872 | 866 | ||
873 | card->csr_base = pci_resource_start(dev, 0); | 867 | card->csr_base = pci_resource_start(dev, 0); |
874 | card->csr_len = pci_resource_len(dev, 0); | 868 | card->csr_len = pci_resource_len(dev, 0); |
875 | #ifdef CONFIG_MM_MAP_MEMORY | ||
876 | card->mem_base = pci_resource_start(dev, 1); | ||
877 | card->mem_len = pci_resource_len(dev, 1); | ||
878 | #endif | ||
879 | 869 | ||
880 | printk(KERN_INFO "Micro Memory(tm) controller #%d found at %02x:%02x (PCI Mem Module (Battery Backup))\n", | 870 | printk(KERN_INFO "Micro Memory(tm) controller #%d found at %02x:%02x (PCI Mem Module (Battery Backup))\n", |
881 | card->card_number, dev->bus->number, dev->devfn); | 871 | card->card_number, dev->bus->number, dev->devfn); |
@@ -903,27 +893,6 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i | |||
903 | printk(KERN_INFO "MM%d: CSR 0x%08lx -> 0x%p (0x%lx)\n", card->card_number, | 893 | printk(KERN_INFO "MM%d: CSR 0x%08lx -> 0x%p (0x%lx)\n", card->card_number, |
904 | card->csr_base, card->csr_remap, card->csr_len); | 894 | card->csr_base, card->csr_remap, card->csr_len); |
905 | 895 | ||
906 | #ifdef CONFIG_MM_MAP_MEMORY | ||
907 | if (!request_mem_region(card->mem_base, card->mem_len, "Micro Memory")) { | ||
908 | printk(KERN_ERR "MM%d: Unable to request memory region\n", card->card_number); | ||
909 | ret = -ENOMEM; | ||
910 | |||
911 | goto failed_req_mem; | ||
912 | } | ||
913 | |||
914 | if (!(card->mem_remap = ioremap(card->mem_base, cards->mem_len))) { | ||
915 | printk(KERN_ERR "MM%d: Unable to remap memory region\n", card->card_number); | ||
916 | ret = -ENOMEM; | ||
917 | |||
918 | goto failed_remap_mem; | ||
919 | } | ||
920 | |||
921 | printk(KERN_INFO "MM%d: MEM 0x%8lx -> 0x%8lx (0x%lx)\n", card->card_number, | ||
922 | card->mem_base, card->mem_remap, card->mem_len); | ||
923 | #else | ||
924 | printk(KERN_INFO "MM%d: MEM area not remapped (CONFIG_MM_MAP_MEMORY not set)\n", | ||
925 | card->card_number); | ||
926 | #endif | ||
927 | switch(card->dev->device) { | 896 | switch(card->dev->device) { |
928 | case 0x5415: | 897 | case 0x5415: |
929 | card->flags |= UM_FLAG_NO_BYTE_STATUS | UM_FLAG_NO_BATTREG; | 898 | card->flags |= UM_FLAG_NO_BYTE_STATUS | UM_FLAG_NO_BATTREG; |
@@ -1091,12 +1060,6 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i | |||
1091 | card->mm_pages[1].desc, | 1060 | card->mm_pages[1].desc, |
1092 | card->mm_pages[1].page_dma); | 1061 | card->mm_pages[1].page_dma); |
1093 | failed_magic: | 1062 | failed_magic: |
1094 | #ifdef CONFIG_MM_MAP_MEMORY | ||
1095 | iounmap(card->mem_remap); | ||
1096 | failed_remap_mem: | ||
1097 | release_mem_region(card->mem_base, card->mem_len); | ||
1098 | failed_req_mem: | ||
1099 | #endif | ||
1100 | iounmap(card->csr_remap); | 1063 | iounmap(card->csr_remap); |
1101 | failed_remap_csr: | 1064 | failed_remap_csr: |
1102 | release_mem_region(card->csr_base, card->csr_len); | 1065 | release_mem_region(card->csr_base, card->csr_len); |
@@ -1116,10 +1079,6 @@ static void mm_pci_remove(struct pci_dev *dev) | |||
1116 | tasklet_kill(&card->tasklet); | 1079 | tasklet_kill(&card->tasklet); |
1117 | iounmap(card->csr_remap); | 1080 | iounmap(card->csr_remap); |
1118 | release_mem_region(card->csr_base, card->csr_len); | 1081 | release_mem_region(card->csr_base, card->csr_len); |
1119 | #ifdef CONFIG_MM_MAP_MEMORY | ||
1120 | iounmap(card->mem_remap); | ||
1121 | release_mem_region(card->mem_base, card->mem_len); | ||
1122 | #endif | ||
1123 | free_irq(card->irq, card); | 1082 | free_irq(card->irq, card); |
1124 | 1083 | ||
1125 | if (card->mm_pages[0].desc) | 1084 | if (card->mm_pages[0].desc) |
@@ -1133,23 +1092,18 @@ static void mm_pci_remove(struct pci_dev *dev) | |||
1133 | blk_cleanup_queue(card->queue); | 1092 | blk_cleanup_queue(card->queue); |
1134 | } | 1093 | } |
1135 | 1094 | ||
1136 | static const struct pci_device_id mm_pci_ids[] = { { | 1095 | static const struct pci_device_id mm_pci_ids[] = { |
1137 | .vendor = PCI_VENDOR_ID_MICRO_MEMORY, | 1096 | {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY,PCI_DEVICE_ID_MICRO_MEMORY_5415CN)}, |
1138 | .device = PCI_DEVICE_ID_MICRO_MEMORY_5415CN, | 1097 | {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY,PCI_DEVICE_ID_MICRO_MEMORY_5425CN)}, |
1139 | }, { | 1098 | {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY,PCI_DEVICE_ID_MICRO_MEMORY_6155)}, |
1140 | .vendor = PCI_VENDOR_ID_MICRO_MEMORY, | 1099 | { |
1141 | .device = PCI_DEVICE_ID_MICRO_MEMORY_5425CN, | ||
1142 | }, { | ||
1143 | .vendor = PCI_VENDOR_ID_MICRO_MEMORY, | ||
1144 | .device = PCI_DEVICE_ID_MICRO_MEMORY_6155, | ||
1145 | }, { | ||
1146 | .vendor = 0x8086, | 1100 | .vendor = 0x8086, |
1147 | .device = 0xB555, | 1101 | .device = 0xB555, |
1148 | .subvendor= 0x1332, | 1102 | .subvendor= 0x1332, |
1149 | .subdevice= 0x5460, | 1103 | .subdevice= 0x5460, |
1150 | .class = 0x050000, | 1104 | .class = 0x050000, |
1151 | .class_mask= 0, | 1105 | .class_mask= 0, |
1152 | }, { /* end: all zeroes */ } | 1106 | }, { /* end: all zeroes */ } |
1153 | }; | 1107 | }; |
1154 | 1108 | ||
1155 | MODULE_DEVICE_TABLE(pci, mm_pci_ids); | 1109 | MODULE_DEVICE_TABLE(pci, mm_pci_ids); |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 7903f9c7839e..713ab05a87c0 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -405,22 +405,6 @@ config ATARILANCE | |||
405 | on the AMD Lance chipset: RieblCard (with or without battery), or | 405 | on the AMD Lance chipset: RieblCard (with or without battery), or |
406 | PAMCard VME (also the version by Rhotron, with different addresses). | 406 | PAMCard VME (also the version by Rhotron, with different addresses). |
407 | 407 | ||
408 | config ATARI_BIONET | ||
409 | tristate "BioNet-100 support" | ||
410 | depends on ATARI && ATARI_ACSI && BROKEN | ||
411 | help | ||
412 | Say Y to include support for BioData's BioNet-100 Ethernet adapter | ||
413 | for the ACSI port. The driver works (has to work...) with a polled | ||
414 | I/O scheme, so it's rather slow :-( | ||
415 | |||
416 | config ATARI_PAMSNET | ||
417 | tristate "PAMsNet support" | ||
418 | depends on ATARI && ATARI_ACSI && BROKEN | ||
419 | help | ||
420 | Say Y to include support for the PAMsNet Ethernet adapter for the | ||
421 | ACSI port ("ACSI node"). The driver works (has to work...) with a | ||
422 | polled I/O scheme, so it's rather slow :-( | ||
423 | |||
424 | config SUN3LANCE | 408 | config SUN3LANCE |
425 | tristate "Sun3/Sun3x on-board LANCE support" | 409 | tristate "Sun3/Sun3x on-board LANCE support" |
426 | depends on SUN3 || SUN3X | 410 | depends on SUN3 || SUN3X |
diff --git a/drivers/net/Makefile b/drivers/net/Makefile index b95b1b237a26..eb4167622a6a 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile | |||
@@ -181,8 +181,6 @@ obj-$(CONFIG_MIPS_SIM_NET) += mipsnet.o | |||
181 | obj-$(CONFIG_SGI_IOC3_ETH) += ioc3-eth.o | 181 | obj-$(CONFIG_SGI_IOC3_ETH) += ioc3-eth.o |
182 | obj-$(CONFIG_DECLANCE) += declance.o | 182 | obj-$(CONFIG_DECLANCE) += declance.o |
183 | obj-$(CONFIG_ATARILANCE) += atarilance.o | 183 | obj-$(CONFIG_ATARILANCE) += atarilance.o |
184 | obj-$(CONFIG_ATARI_BIONET) += atari_bionet.o | ||
185 | obj-$(CONFIG_ATARI_PAMSNET) += atari_pamsnet.o | ||
186 | obj-$(CONFIG_A2065) += a2065.o | 184 | obj-$(CONFIG_A2065) += a2065.o |
187 | obj-$(CONFIG_HYDRA) += hydra.o | 185 | obj-$(CONFIG_HYDRA) += hydra.o |
188 | obj-$(CONFIG_ARIADNE) += ariadne.o | 186 | obj-$(CONFIG_ARIADNE) += ariadne.o |
diff --git a/drivers/net/Space.c b/drivers/net/Space.c index 1c3e293fbaf7..3b79c6cf21a3 100644 --- a/drivers/net/Space.c +++ b/drivers/net/Space.c | |||
@@ -75,8 +75,6 @@ extern struct net_device *atarilance_probe(int unit); | |||
75 | extern struct net_device *sun3lance_probe(int unit); | 75 | extern struct net_device *sun3lance_probe(int unit); |
76 | extern struct net_device *sun3_82586_probe(int unit); | 76 | extern struct net_device *sun3_82586_probe(int unit); |
77 | extern struct net_device *apne_probe(int unit); | 77 | extern struct net_device *apne_probe(int unit); |
78 | extern struct net_device *bionet_probe(int unit); | ||
79 | extern struct net_device *pamsnet_probe(int unit); | ||
80 | extern struct net_device *cs89x0_probe(int unit); | 78 | extern struct net_device *cs89x0_probe(int unit); |
81 | extern struct net_device *hplance_probe(int unit); | 79 | extern struct net_device *hplance_probe(int unit); |
82 | extern struct net_device *bagetlance_probe(int unit); | 80 | extern struct net_device *bagetlance_probe(int unit); |
@@ -264,12 +262,6 @@ static struct devprobe2 m68k_probes[] __initdata = { | |||
264 | #ifdef CONFIG_APNE /* A1200 PCMCIA NE2000 */ | 262 | #ifdef CONFIG_APNE /* A1200 PCMCIA NE2000 */ |
265 | {apne_probe, 0}, | 263 | {apne_probe, 0}, |
266 | #endif | 264 | #endif |
267 | #ifdef CONFIG_ATARI_BIONET /* Atari Bionet Ethernet board */ | ||
268 | {bionet_probe, 0}, | ||
269 | #endif | ||
270 | #ifdef CONFIG_ATARI_PAMSNET /* Atari PAMsNet Ethernet board */ | ||
271 | {pamsnet_probe, 0}, | ||
272 | #endif | ||
273 | #ifdef CONFIG_MVME147_NET /* MVME147 internal Ethernet */ | 265 | #ifdef CONFIG_MVME147_NET /* MVME147 internal Ethernet */ |
274 | {mvme147lance_probe, 0}, | 266 | {mvme147lance_probe, 0}, |
275 | #endif | 267 | #endif |
diff --git a/drivers/net/atari_bionet.c b/drivers/net/atari_bionet.c deleted file mode 100644 index 3d87bd2b4194..000000000000 --- a/drivers/net/atari_bionet.c +++ /dev/null | |||
@@ -1,675 +0,0 @@ | |||
1 | /* bionet.c BioNet-100 device driver for linux68k. | ||
2 | * | ||
3 | * Version: @(#)bionet.c 1.0 02/06/96 | ||
4 | * | ||
5 | * Author: Hartmut Laue <laue@ifk-mp.uni-kiel.de> | ||
6 | * and Torsten Narjes <narjes@ifk-mp.uni-kiel.de> | ||
7 | * | ||
8 | * Little adaptions for integration into pl7 by Roman Hodek | ||
9 | * | ||
10 | * Some changes in bionet_poll_rx by Karl-Heinz Lohner | ||
11 | * | ||
12 | What is it ? | ||
13 | ------------ | ||
14 | This driver controls the BIONET-100 LAN-Adapter which connects | ||
15 | an ATARI ST/TT via the ACSI-port to an Ethernet-based network. | ||
16 | |||
17 | This version can be compiled as a loadable module (See the | ||
18 | compile command at the bottom of this file). | ||
19 | At load time, you can optionally set the debugging level and the | ||
20 | fastest response time on the command line of 'insmod'. | ||
21 | |||
22 | 'bionet_debug' | ||
23 | controls the amount of diagnostic messages: | ||
24 | 0 : no messages | ||
25 | >0 : see code for meaning of printed messages | ||
26 | |||
27 | 'bionet_min_poll_time' (always >=1) | ||
28 | gives the time (in jiffies) between polls. Low values | ||
29 | increase the system load (beware!) | ||
30 | |||
31 | When loaded, a net device with the name 'bio0' becomes available, | ||
32 | which can be controlled with the usual 'ifconfig' command. | ||
33 | |||
34 | It is possible to compile this driver into the kernel like other | ||
35 | (net) drivers. For this purpose, some source files (e.g. config-files | ||
36 | makefiles, Space.c) must be changed accordingly. (You may refer to | ||
37 | other drivers how to do it.) In this case, the device will be detected | ||
38 | at boot time and (probably) appear as 'eth0'. | ||
39 | |||
40 | This code is based on several sources: | ||
41 | - The driver code for a parallel port ethernet adapter by | ||
42 | Donald Becker (see file 'atp.c' from the PC linux distribution) | ||
43 | - The ACSI code by Roman Hodek for the ATARI-ACSI harddisk support | ||
44 | and DMA handling. | ||
45 | - Very limited information about moving packets in and out of the | ||
46 | BIONET-adapter from the TCP package for TOS by BioData GmbH. | ||
47 | |||
48 | Theory of Operation | ||
49 | ------------------- | ||
50 | Because the ATARI DMA port is usually shared between several | ||
51 | devices (eg. harddisk, floppy) we cannot block the ACSI bus | ||
52 | while waiting for interrupts. Therefore we use a polling mechanism | ||
53 | to fetch packets from the adapter. For the same reason, we send | ||
54 | packets without checking that the previous packet has been sent to | ||
55 | the LAN. We rely on the higher levels of the networking code to detect | ||
56 | missing packets and resend them. | ||
57 | |||
58 | Before we access the ATARI DMA controller, we check if another | ||
59 | process is using the DMA. If not, we lock the DMA, perform one or | ||
60 | more packet transfers and unlock the DMA before returning. | ||
61 | We do not use 'stdma_lock' unconditionally because it is unclear | ||
62 | if the networking code can be set to sleep, which will happen if | ||
63 | another (possibly slow) device is using the DMA controller. | ||
64 | |||
65 | The polling is done via timer interrupts which periodically | ||
66 | 'simulate' an interrupt from the Ethernet adapter. The time (in jiffies) | ||
67 | between polls varies depending on an estimate of the net activity. | ||
68 | The allowed range is given by the variable 'bionet_min_poll_time' | ||
69 | for the lower (fastest) limit and the constant 'MAX_POLL_TIME' | ||
70 | for the higher (slowest) limit. | ||
71 | |||
72 | Whenever a packet arrives, we switch to fastest response by setting | ||
73 | the polling time to its lowest limit. If the following poll fails, | ||
74 | because no packets have arrived, we increase the time for the next | ||
75 | poll. When the net activity is low, the polling time effectively | ||
76 | stays at its maximum value, resulting in the lowest load for the | ||
77 | machine. | ||
78 | */ | ||
79 | |||
80 | #define MAX_POLL_TIME 10 | ||
81 | |||
82 | static char version[] = | ||
83 | "bionet.c:v1.0 06-feb-96 (c) Hartmut Laue.\n"; | ||
84 | |||
85 | #include <linux/module.h> | ||
86 | |||
87 | #include <linux/errno.h> | ||
88 | #include <linux/kernel.h> | ||
89 | #include <linux/jiffies.h> | ||
90 | #include <linux/types.h> | ||
91 | #include <linux/fcntl.h> | ||
92 | #include <linux/interrupt.h> | ||
93 | #include <linux/ioport.h> | ||
94 | #include <linux/in.h> | ||
95 | #include <linux/slab.h> | ||
96 | #include <linux/string.h> | ||
97 | #include <linux/delay.h> | ||
98 | #include <linux/timer.h> | ||
99 | #include <linux/init.h> | ||
100 | #include <linux/bitops.h> | ||
101 | |||
102 | #include <linux/netdevice.h> | ||
103 | #include <linux/etherdevice.h> | ||
104 | #include <linux/skbuff.h> | ||
105 | |||
106 | #include <asm/setup.h> | ||
107 | #include <asm/pgtable.h> | ||
108 | #include <asm/system.h> | ||
109 | #include <asm/io.h> | ||
110 | #include <asm/dma.h> | ||
111 | #include <asm/atarihw.h> | ||
112 | #include <asm/atariints.h> | ||
113 | #include <asm/atari_acsi.h> | ||
114 | #include <asm/atari_stdma.h> | ||
115 | |||
116 | |||
117 | /* use 0 for production, 1 for verification, >2 for debug | ||
118 | */ | ||
119 | #ifndef NET_DEBUG | ||
120 | #define NET_DEBUG 0 | ||
121 | #endif | ||
122 | /* | ||
123 | * Global variable 'bionet_debug'. Can be set at load time by 'insmod' | ||
124 | */ | ||
125 | unsigned int bionet_debug = NET_DEBUG; | ||
126 | module_param(bionet_debug, int, 0); | ||
127 | MODULE_PARM_DESC(bionet_debug, "bionet debug level (0-2)"); | ||
128 | MODULE_LICENSE("GPL"); | ||
129 | |||
130 | static unsigned int bionet_min_poll_time = 2; | ||
131 | |||
132 | |||
133 | /* Information that need to be kept for each board. | ||
134 | */ | ||
135 | struct net_local { | ||
136 | struct net_device_stats stats; | ||
137 | long open_time; /* for debugging */ | ||
138 | int poll_time; /* polling time varies with net load */ | ||
139 | }; | ||
140 | |||
141 | static struct nic_pkt_s { /* packet format */ | ||
142 | unsigned char status; | ||
143 | unsigned char dummy; | ||
144 | unsigned char l_lo, l_hi; | ||
145 | unsigned char buffer[3000]; | ||
146 | } *nic_packet; | ||
147 | unsigned char *phys_nic_packet; | ||
148 | |||
149 | /* Index to functions, as function prototypes. | ||
150 | */ | ||
151 | static int bionet_open(struct net_device *dev); | ||
152 | static int bionet_send_packet(struct sk_buff *skb, struct net_device *dev); | ||
153 | static void bionet_poll_rx(struct net_device *); | ||
154 | static int bionet_close(struct net_device *dev); | ||
155 | static struct net_device_stats *net_get_stats(struct net_device *dev); | ||
156 | static void bionet_tick(unsigned long); | ||
157 | |||
158 | static DEFINE_TIMER(bionet_timer, bionet_tick, 0, 0); | ||
159 | |||
160 | #define STRAM_ADDR(a) (((a) & 0xff000000) == 0) | ||
161 | |||
162 | /* The following routines access the ethernet board connected to the | ||
163 | * ACSI port via the st_dma chip. | ||
164 | */ | ||
165 | #define NODE_ADR 0x60 | ||
166 | |||
167 | #define C_READ 8 | ||
168 | #define C_WRITE 0x0a | ||
169 | #define C_GETEA 0x0f | ||
170 | #define C_SETCR 0x0e | ||
171 | |||
172 | static int | ||
173 | sendcmd(unsigned int a0, unsigned int mod, unsigned int cmd) { | ||
174 | unsigned int c; | ||
175 | |||
176 | dma_wd.dma_mode_status = (mod | ((a0) ? 2 : 0) | 0x88); | ||
177 | dma_wd.fdc_acces_seccount = cmd; | ||
178 | dma_wd.dma_mode_status = (mod | 0x8a); | ||
179 | |||
180 | if( !acsi_wait_for_IRQ(HZ/2) ) /* wait for cmd ack */ | ||
181 | return -1; /* timeout */ | ||
182 | |||
183 | c = dma_wd.fdc_acces_seccount; | ||
184 | return (c & 0xff); | ||
185 | } | ||
186 | |||
187 | |||
188 | static void | ||
189 | set_status(int cr) { | ||
190 | sendcmd(0,0x100,NODE_ADR | C_SETCR); /* CMD: SET CR */ | ||
191 | sendcmd(1,0x100,cr); | ||
192 | |||
193 | dma_wd.dma_mode_status = 0x80; | ||
194 | } | ||
195 | |||
196 | static int | ||
197 | get_status(unsigned char *adr) { | ||
198 | int i,c; | ||
199 | |||
200 | DISABLE_IRQ(); | ||
201 | c = sendcmd(0,0x00,NODE_ADR | C_GETEA); /* CMD: GET ETH ADR*/ | ||
202 | if( c < 0 ) goto gsend; | ||
203 | |||
204 | /* now read status bytes */ | ||
205 | |||
206 | for (i=0; i<6; i++) { | ||
207 | dma_wd.fdc_acces_seccount = 0; /* request next byte */ | ||
208 | |||
209 | if( !acsi_wait_for_IRQ(HZ/2) ) { /* wait for cmd ack */ | ||
210 | c = -1; | ||
211 | goto gsend; /* timeout */ | ||
212 | } | ||
213 | c = dma_wd.fdc_acces_seccount; | ||
214 | *adr++ = (unsigned char)c; | ||
215 | } | ||
216 | c = 1; | ||
217 | gsend: | ||
218 | dma_wd.dma_mode_status = 0x80; | ||
219 | return c; | ||
220 | } | ||
221 | |||
222 | static irqreturn_t | ||
223 | bionet_intr(int irq, void *data) { | ||
224 | return IRQ_HANDLED; | ||
225 | } | ||
226 | |||
227 | |||
228 | static int | ||
229 | get_frame(unsigned long paddr, int odd) { | ||
230 | int c; | ||
231 | unsigned long flags; | ||
232 | |||
233 | DISABLE_IRQ(); | ||
234 | local_irq_save(flags); | ||
235 | |||
236 | dma_wd.dma_mode_status = 0x9a; | ||
237 | dma_wd.dma_mode_status = 0x19a; | ||
238 | dma_wd.dma_mode_status = 0x9a; | ||
239 | dma_wd.fdc_acces_seccount = 0x04; /* sector count (was 5) */ | ||
240 | dma_wd.dma_lo = (unsigned char)paddr; | ||
241 | paddr >>= 8; | ||
242 | dma_wd.dma_md = (unsigned char)paddr; | ||
243 | paddr >>= 8; | ||
244 | dma_wd.dma_hi = (unsigned char)paddr; | ||
245 | local_irq_restore(flags); | ||
246 | |||
247 | c = sendcmd(0,0x00,NODE_ADR | C_READ); /* CMD: READ */ | ||
248 | if( c < 128 ) goto rend; | ||
249 | |||
250 | /* now read block */ | ||
251 | |||
252 | c = sendcmd(1,0x00,odd); /* odd flag for address shift */ | ||
253 | dma_wd.dma_mode_status = 0x0a; | ||
254 | |||
255 | if( !acsi_wait_for_IRQ(100) ) { /* wait for DMA to complete */ | ||
256 | c = -1; | ||
257 | goto rend; | ||
258 | } | ||
259 | dma_wd.dma_mode_status = 0x8a; | ||
260 | dma_wd.dma_mode_status = 0x18a; | ||
261 | dma_wd.dma_mode_status = 0x8a; | ||
262 | c = dma_wd.fdc_acces_seccount; | ||
263 | |||
264 | dma_wd.dma_mode_status = 0x88; | ||
265 | c = dma_wd.fdc_acces_seccount; | ||
266 | c = 1; | ||
267 | |||
268 | rend: | ||
269 | dma_wd.dma_mode_status = 0x80; | ||
270 | udelay(40); | ||
271 | acsi_wait_for_noIRQ(20); | ||
272 | return c; | ||
273 | } | ||
274 | |||
275 | |||
276 | static int | ||
277 | hardware_send_packet(unsigned long paddr, int cnt) { | ||
278 | unsigned int c; | ||
279 | unsigned long flags; | ||
280 | |||
281 | DISABLE_IRQ(); | ||
282 | local_irq_save(flags); | ||
283 | |||
284 | dma_wd.dma_mode_status = 0x19a; | ||
285 | dma_wd.dma_mode_status = 0x9a; | ||
286 | dma_wd.dma_mode_status = 0x19a; | ||
287 | dma_wd.dma_lo = (unsigned char)paddr; | ||
288 | paddr >>= 8; | ||
289 | dma_wd.dma_md = (unsigned char)paddr; | ||
290 | paddr >>= 8; | ||
291 | dma_wd.dma_hi = (unsigned char)paddr; | ||
292 | |||
293 | dma_wd.fdc_acces_seccount = 0x4; /* sector count */ | ||
294 | local_irq_restore(flags); | ||
295 | |||
296 | c = sendcmd(0,0x100,NODE_ADR | C_WRITE); /* CMD: WRITE */ | ||
297 | c = sendcmd(1,0x100,cnt&0xff); | ||
298 | c = sendcmd(1,0x100,cnt>>8); | ||
299 | |||
300 | /* now write block */ | ||
301 | |||
302 | dma_wd.dma_mode_status = 0x10a; /* DMA enable */ | ||
303 | if( !acsi_wait_for_IRQ(100) ) /* wait for DMA to complete */ | ||
304 | goto end; | ||
305 | |||
306 | dma_wd.dma_mode_status = 0x19a; /* DMA disable ! */ | ||
307 | c = dma_wd.fdc_acces_seccount; | ||
308 | |||
309 | end: | ||
310 | c = sendcmd(1,0x100,0); | ||
311 | c = sendcmd(1,0x100,0); | ||
312 | |||
313 | dma_wd.dma_mode_status = 0x180; | ||
314 | udelay(40); | ||
315 | acsi_wait_for_noIRQ(20); | ||
316 | return( c & 0x02); | ||
317 | } | ||
318 | |||
319 | |||
320 | /* Check for a network adaptor of this type, and return '0' if one exists. | ||
321 | */ | ||
322 | struct net_device * __init bionet_probe(int unit) | ||
323 | { | ||
324 | struct net_device *dev; | ||
325 | unsigned char station_addr[6]; | ||
326 | static unsigned version_printed; | ||
327 | static int no_more_found; /* avoid "Probing for..." printed 4 times */ | ||
328 | int i; | ||
329 | int err; | ||
330 | |||
331 | if (!MACH_IS_ATARI || no_more_found) | ||
332 | return ERR_PTR(-ENODEV); | ||
333 | |||
334 | dev = alloc_etherdev(sizeof(struct net_local)); | ||
335 | if (!dev) | ||
336 | return ERR_PTR(-ENOMEM); | ||
337 | if (unit >= 0) { | ||
338 | sprintf(dev->name, "eth%d", unit); | ||
339 | netdev_boot_setup_check(dev); | ||
340 | } | ||
341 | SET_MODULE_OWNER(dev); | ||
342 | |||
343 | printk("Probing for BioNet 100 Adapter...\n"); | ||
344 | |||
345 | stdma_lock(bionet_intr, NULL); | ||
346 | i = get_status(station_addr); /* Read the station address PROM. */ | ||
347 | ENABLE_IRQ(); | ||
348 | stdma_release(); | ||
349 | |||
350 | /* Check the first three octets of the S.A. for the manufactor's code. | ||
351 | */ | ||
352 | |||
353 | if( i < 0 | ||
354 | || station_addr[0] != 'B' | ||
355 | || station_addr[1] != 'I' | ||
356 | || station_addr[2] != 'O' ) { | ||
357 | no_more_found = 1; | ||
358 | printk( "No BioNet 100 found.\n" ); | ||
359 | free_netdev(dev); | ||
360 | return ERR_PTR(-ENODEV); | ||
361 | } | ||
362 | |||
363 | if (bionet_debug > 0 && version_printed++ == 0) | ||
364 | printk(version); | ||
365 | |||
366 | printk("%s: %s found, eth-addr: %02x-%02x-%02x:%02x-%02x-%02x.\n", | ||
367 | dev->name, "BioNet 100", | ||
368 | station_addr[0], station_addr[1], station_addr[2], | ||
369 | station_addr[3], station_addr[4], station_addr[5]); | ||
370 | |||
371 | /* Initialize the device structure. */ | ||
372 | |||
373 | nic_packet = (struct nic_pkt_s *)acsi_buffer; | ||
374 | phys_nic_packet = (unsigned char *)phys_acsi_buffer; | ||
375 | if (bionet_debug > 0) { | ||
376 | printk("nic_packet at 0x%p, phys at 0x%p\n", | ||
377 | nic_packet, phys_nic_packet ); | ||
378 | } | ||
379 | |||
380 | dev->open = bionet_open; | ||
381 | dev->stop = bionet_close; | ||
382 | dev->hard_start_xmit = bionet_send_packet; | ||
383 | dev->get_stats = net_get_stats; | ||
384 | |||
385 | /* Fill in the fields of the device structure with ethernet-generic | ||
386 | * values. This should be in a common file instead of per-driver. | ||
387 | */ | ||
388 | |||
389 | for (i = 0; i < ETH_ALEN; i++) { | ||
390 | #if 0 | ||
391 | dev->broadcast[i] = 0xff; | ||
392 | #endif | ||
393 | dev->dev_addr[i] = station_addr[i]; | ||
394 | } | ||
395 | err = register_netdev(dev); | ||
396 | if (!err) | ||
397 | return dev; | ||
398 | free_netdev(dev); | ||
399 | return ERR_PTR(err); | ||
400 | } | ||
401 | |||
402 | /* Open/initialize the board. This is called (in the current kernel) | ||
403 | sometime after booting when the 'ifconfig' program is run. | ||
404 | |||
405 | This routine should set everything up anew at each open, even | ||
406 | registers that "should" only need to be set once at boot, so that | ||
407 | there is non-reboot way to recover if something goes wrong. | ||
408 | */ | ||
409 | static int | ||
410 | bionet_open(struct net_device *dev) { | ||
411 | struct net_local *lp = netdev_priv(dev); | ||
412 | |||
413 | if (bionet_debug > 0) | ||
414 | printk("bionet_open\n"); | ||
415 | stdma_lock(bionet_intr, NULL); | ||
416 | |||
417 | /* Reset the hardware here. | ||
418 | */ | ||
419 | set_status(4); | ||
420 | lp->open_time = 0; /*jiffies*/ | ||
421 | lp->poll_time = MAX_POLL_TIME; | ||
422 | |||
423 | dev->tbusy = 0; | ||
424 | dev->interrupt = 0; | ||
425 | dev->start = 1; | ||
426 | |||
427 | stdma_release(); | ||
428 | bionet_timer.data = (long)dev; | ||
429 | bionet_timer.expires = jiffies + lp->poll_time; | ||
430 | add_timer(&bionet_timer); | ||
431 | return 0; | ||
432 | } | ||
433 | |||
434 | static int | ||
435 | bionet_send_packet(struct sk_buff *skb, struct net_device *dev) { | ||
436 | struct net_local *lp = netdev_priv(dev); | ||
437 | unsigned long flags; | ||
438 | |||
439 | /* Block a timer-based transmit from overlapping. This could better be | ||
440 | * done with atomic_swap(1, dev->tbusy), but set_bit() works as well. | ||
441 | */ | ||
442 | local_irq_save(flags); | ||
443 | |||
444 | if (stdma_islocked()) { | ||
445 | local_irq_restore(flags); | ||
446 | lp->stats.tx_errors++; | ||
447 | } | ||
448 | else { | ||
449 | int length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN; | ||
450 | unsigned long buf = virt_to_phys(skb->data); | ||
451 | int stat; | ||
452 | |||
453 | stdma_lock(bionet_intr, NULL); | ||
454 | local_irq_restore(flags); | ||
455 | if( !STRAM_ADDR(buf+length-1) ) { | ||
456 | skb_copy_from_linear_data(skb, nic_packet->buffer, | ||
457 | length); | ||
458 | buf = (unsigned long)&((struct nic_pkt_s *)phys_nic_packet)->buffer; | ||
459 | } | ||
460 | |||
461 | if (bionet_debug >1) { | ||
462 | u_char *data = nic_packet->buffer, *p; | ||
463 | int i; | ||
464 | |||
465 | printk( "%s: TX pkt type 0x%4x from ", dev->name, | ||
466 | ((u_short *)data)[6]); | ||
467 | |||
468 | for( p = &data[6], i = 0; i < 6; i++ ) | ||
469 | printk("%02x%s", *p++,i != 5 ? ":" : "" ); | ||
470 | printk(" to "); | ||
471 | |||
472 | for( p = data, i = 0; i < 6; i++ ) | ||
473 | printk("%02x%s", *p++,i != 5 ? ":" : "" "\n" ); | ||
474 | |||
475 | printk( "%s: ", dev->name ); | ||
476 | printk(" data %02x%02x %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x" | ||
477 | " %02x%02x%02x%02x len %d\n", | ||
478 | data[12], data[13], data[14], data[15], data[16], data[17], data[18], data[19], | ||
479 | data[20], data[21], data[22], data[23], data[24], data[25], data[26], data[27], | ||
480 | data[28], data[29], data[30], data[31], data[32], data[33], | ||
481 | length ); | ||
482 | } | ||
483 | dma_cache_maintenance(buf, length, 1); | ||
484 | |||
485 | stat = hardware_send_packet(buf, length); | ||
486 | ENABLE_IRQ(); | ||
487 | stdma_release(); | ||
488 | |||
489 | dev->trans_start = jiffies; | ||
490 | dev->tbusy = 0; | ||
491 | lp->stats.tx_packets++; | ||
492 | lp->stats.tx_bytes+=length; | ||
493 | } | ||
494 | dev_kfree_skb(skb); | ||
495 | |||
496 | return 0; | ||
497 | } | ||
498 | |||
499 | /* We have a good packet(s), get it/them out of the buffers. | ||
500 | */ | ||
501 | static void | ||
502 | bionet_poll_rx(struct net_device *dev) { | ||
503 | struct net_local *lp = netdev_priv(dev); | ||
504 | int boguscount = 10; | ||
505 | int pkt_len, status; | ||
506 | unsigned long flags; | ||
507 | |||
508 | local_irq_save(flags); | ||
509 | /* ++roman: Take care at locking the ST-DMA... This must be done with ints | ||
510 | * off, since otherwise an int could slip in between the question and the | ||
511 | * locking itself, and then we'd go to sleep... And locking itself is | ||
512 | * necessary to keep the floppy_change timer from working with ST-DMA | ||
513 | * registers. */ | ||
514 | if (stdma_islocked()) { | ||
515 | local_irq_restore(flags); | ||
516 | return; | ||
517 | } | ||
518 | stdma_lock(bionet_intr, NULL); | ||
519 | DISABLE_IRQ(); | ||
520 | local_irq_restore(flags); | ||
521 | |||
522 | if( lp->poll_time < MAX_POLL_TIME ) lp->poll_time++; | ||
523 | |||
524 | while(boguscount--) { | ||
525 | status = get_frame((unsigned long)phys_nic_packet, 0); | ||
526 | |||
527 | if( status == 0 ) break; | ||
528 | |||
529 | /* Good packet... */ | ||
530 | |||
531 | dma_cache_maintenance((unsigned long)phys_nic_packet, 1520, 0); | ||
532 | |||
533 | pkt_len = (nic_packet->l_hi << 8) | nic_packet->l_lo; | ||
534 | |||
535 | lp->poll_time = bionet_min_poll_time; /* fast poll */ | ||
536 | if( pkt_len >= 60 && pkt_len <= 1520 ) { | ||
537 | /* ^^^^ war 1514 KHL */ | ||
538 | /* Malloc up new buffer. | ||
539 | */ | ||
540 | struct sk_buff *skb = dev_alloc_skb( pkt_len + 2 ); | ||
541 | if (skb == NULL) { | ||
542 | printk("%s: Memory squeeze, dropping packet.\n", | ||
543 | dev->name); | ||
544 | lp->stats.rx_dropped++; | ||
545 | break; | ||
546 | } | ||
547 | |||
548 | skb_reserve( skb, 2 ); /* 16 Byte align */ | ||
549 | skb_put( skb, pkt_len ); /* make room */ | ||
550 | |||
551 | /* 'skb->data' points to the start of sk_buff data area. | ||
552 | */ | ||
553 | skb_copy_to_linear_data(skb, nic_packet->buffer, | ||
554 | pkt_len); | ||
555 | skb->protocol = eth_type_trans( skb, dev ); | ||
556 | netif_rx(skb); | ||
557 | dev->last_rx = jiffies; | ||
558 | lp->stats.rx_packets++; | ||
559 | lp->stats.rx_bytes+=pkt_len; | ||
560 | |||
561 | /* If any worth-while packets have been received, dev_rint() | ||
562 | has done a mark_bh(INET_BH) for us and will work on them | ||
563 | when we get to the bottom-half routine. | ||
564 | */ | ||
565 | |||
566 | if (bionet_debug >1) { | ||
567 | u_char *data = nic_packet->buffer, *p; | ||
568 | int i; | ||
569 | |||
570 | printk( "%s: RX pkt type 0x%4x from ", dev->name, | ||
571 | ((u_short *)data)[6]); | ||
572 | |||
573 | |||
574 | for( p = &data[6], i = 0; i < 6; i++ ) | ||
575 | printk("%02x%s", *p++,i != 5 ? ":" : "" ); | ||
576 | printk(" to "); | ||
577 | for( p = data, i = 0; i < 6; i++ ) | ||
578 | printk("%02x%s", *p++,i != 5 ? ":" : "" "\n" ); | ||
579 | |||
580 | printk( "%s: ", dev->name ); | ||
581 | printk(" data %02x%02x %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x" | ||
582 | " %02x%02x%02x%02x len %d\n", | ||
583 | data[12], data[13], data[14], data[15], data[16], data[17], data[18], data[19], | ||
584 | data[20], data[21], data[22], data[23], data[24], data[25], data[26], data[27], | ||
585 | data[28], data[29], data[30], data[31], data[32], data[33], | ||
586 | pkt_len ); | ||
587 | } | ||
588 | } | ||
589 | else { | ||
590 | printk(" Packet has wrong length: %04d bytes\n", pkt_len); | ||
591 | lp->stats.rx_errors++; | ||
592 | } | ||
593 | } | ||
594 | stdma_release(); | ||
595 | ENABLE_IRQ(); | ||
596 | return; | ||
597 | } | ||
598 | |||
599 | /* bionet_tick: called by bionet_timer. Reads packets from the adapter, | ||
600 | * passes them to the higher layers and restarts the timer. | ||
601 | */ | ||
602 | static void | ||
603 | bionet_tick(unsigned long data) { | ||
604 | struct net_device *dev = (struct net_device *)data; | ||
605 | struct net_local *lp = netdev_priv(dev); | ||
606 | |||
607 | if( bionet_debug > 0 && (lp->open_time++ & 7) == 8 ) | ||
608 | printk("bionet_tick: %ld\n", lp->open_time); | ||
609 | |||
610 | if( !stdma_islocked() ) bionet_poll_rx(dev); | ||
611 | |||
612 | bionet_timer.expires = jiffies + lp->poll_time; | ||
613 | add_timer(&bionet_timer); | ||
614 | } | ||
615 | |||
616 | /* The inverse routine to bionet_open(). | ||
617 | */ | ||
618 | static int | ||
619 | bionet_close(struct net_device *dev) { | ||
620 | struct net_local *lp = netdev_priv(dev); | ||
621 | |||
622 | if (bionet_debug > 0) | ||
623 | printk("bionet_close, open_time=%ld\n", lp->open_time); | ||
624 | del_timer(&bionet_timer); | ||
625 | stdma_lock(bionet_intr, NULL); | ||
626 | |||
627 | set_status(0); | ||
628 | lp->open_time = 0; | ||
629 | |||
630 | dev->tbusy = 1; | ||
631 | dev->start = 0; | ||
632 | |||
633 | stdma_release(); | ||
634 | return 0; | ||
635 | } | ||
636 | |||
637 | /* Get the current statistics. | ||
638 | This may be called with the card open or closed. | ||
639 | */ | ||
640 | static struct net_device_stats *net_get_stats(struct net_device *dev) | ||
641 | { | ||
642 | struct net_local *lp = netdev_priv(dev); | ||
643 | return &lp->stats; | ||
644 | } | ||
645 | |||
646 | |||
647 | #ifdef MODULE | ||
648 | |||
649 | static struct net_device *bio_dev; | ||
650 | |||
651 | int init_module(void) | ||
652 | { | ||
653 | bio_dev = bionet_probe(-1); | ||
654 | if (IS_ERR(bio_dev)) | ||
655 | return PTR_ERR(bio_dev); | ||
656 | return 0; | ||
657 | } | ||
658 | |||
659 | void cleanup_module(void) | ||
660 | { | ||
661 | unregister_netdev(bio_dev); | ||
662 | free_netdev(bio_dev); | ||
663 | } | ||
664 | |||
665 | #endif /* MODULE */ | ||
666 | |||
667 | /* Local variables: | ||
668 | * compile-command: "gcc -D__KERNEL__ -I/usr/src/linux/include | ||
669 | -b m68k-linuxaout -Wall -Wstrict-prototypes -O2 | ||
670 | -fomit-frame-pointer -pipe -DMODULE -I../../net/inet -c bionet.c" | ||
671 | * version-control: t | ||
672 | * kept-new-versions: 5 | ||
673 | * tab-width: 8 | ||
674 | * End: | ||
675 | */ | ||
diff --git a/drivers/net/atari_pamsnet.c b/drivers/net/atari_pamsnet.c deleted file mode 100644 index f7356374a2e7..000000000000 --- a/drivers/net/atari_pamsnet.c +++ /dev/null | |||
@@ -1,878 +0,0 @@ | |||
1 | /* atari_pamsnet.c PAMsNet device driver for linux68k. | ||
2 | * | ||
3 | * Version: @(#)PAMsNet.c 0.2ß 03/31/96 | ||
4 | * | ||
5 | * Author: Torsten Lang <Torsten.Lang@ap.physik.uni-giessen.de> | ||
6 | * <Torsten.Lang@jung.de> | ||
7 | * | ||
8 | * This driver is based on my driver PAMSDMA.c for MiNT-Net and | ||
9 | * on the driver bionet.c written by | ||
10 | * Hartmut Laue <laue@ifk-mp.uni-kiel.de> | ||
11 | * and Torsten Narjes <narjes@ifk-mp.uni-kiel.de> | ||
12 | * | ||
13 | * Little adaptions for integration into pl7 by Roman Hodek | ||
14 | * | ||
15 | What is it ? | ||
16 | ------------ | ||
17 | This driver controls the PAMsNet LAN-Adapter which connects | ||
18 | an ATARI ST/TT via the ACSI-port to an Ethernet-based network. | ||
19 | |||
20 | This version can be compiled as a loadable module (See the | ||
21 | compile command at the bottom of this file). | ||
22 | At load time, you can optionally set the debugging level and the | ||
23 | fastest response time on the command line of 'insmod'. | ||
24 | |||
25 | 'pamsnet_debug' | ||
26 | controls the amount of diagnostic messages: | ||
27 | 0 : no messages | ||
28 | >0 : see code for meaning of printed messages | ||
29 | |||
30 | 'pamsnet_min_poll_time' (always >=1) | ||
31 | gives the time (in jiffies) between polls. Low values | ||
32 | increase the system load (beware!) | ||
33 | |||
34 | When loaded, a net device with the name 'eth?' becomes available, | ||
35 | which can be controlled with the usual 'ifconfig' command. | ||
36 | |||
37 | It is possible to compile this driver into the kernel like other | ||
38 | (net) drivers. For this purpose, some source files (e.g. config-files | ||
39 | makefiles, Space.c) must be changed accordingly. (You may refer to | ||
40 | other drivers how to do it.) In this case, the device will be detected | ||
41 | at boot time and (probably) appear as 'eth0'. | ||
42 | |||
43 | Theory of Operation | ||
44 | ------------------- | ||
45 | Because the ATARI DMA port is usually shared between several | ||
46 | devices (eg. harddisk, floppy) we cannot block the ACSI bus | ||
47 | while waiting for interrupts. Therefore we use a polling mechanism | ||
48 | to fetch packets from the adapter. For the same reason, we send | ||
49 | packets without checking that the previous packet has been sent to | ||
50 | the LAN. We rely on the higher levels of the networking code to detect | ||
51 | missing packets and resend them. | ||
52 | |||
53 | Before we access the ATARI DMA controller, we check if another | ||
54 | process is using the DMA. If not, we lock the DMA, perform one or | ||
55 | more packet transfers and unlock the DMA before returning. | ||
56 | We do not use 'stdma_lock' unconditionally because it is unclear | ||
57 | if the networking code can be set to sleep, which will happen if | ||
58 | another (possibly slow) device is using the DMA controller. | ||
59 | |||
60 | The polling is done via timer interrupts which periodically | ||
61 | 'simulate' an interrupt from the Ethernet adapter. The time (in jiffies) | ||
62 | between polls varies depending on an estimate of the net activity. | ||
63 | The allowed range is given by the variable 'bionet_min_poll_time' | ||
64 | for the lower (fastest) limit and the constant 'MAX_POLL_TIME' | ||
65 | for the higher (slowest) limit. | ||
66 | |||
67 | Whenever a packet arrives, we switch to fastest response by setting | ||
68 | the polling time to its lowest limit. If the following poll fails, | ||
69 | because no packets have arrived, we increase the time for the next | ||
70 | poll. When the net activity is low, the polling time effectively | ||
71 | stays at its maximum value, resulting in the lowest load for the | ||
72 | machine. | ||
73 | */ | ||
74 | |||
75 | #define MAX_POLL_TIME 10 | ||
76 | |||
77 | static char *version = | ||
78 | "pamsnet.c:v0.2beta 30-mar-96 (c) Torsten Lang.\n"; | ||
79 | |||
80 | #include <linux/module.h> | ||
81 | |||
82 | #include <linux/kernel.h> | ||
83 | #include <linux/jiffies.h> | ||
84 | #include <linux/types.h> | ||
85 | #include <linux/fcntl.h> | ||
86 | #include <linux/interrupt.h> | ||
87 | #include <linux/ioport.h> | ||
88 | #include <linux/in.h> | ||
89 | #include <linux/slab.h> | ||
90 | #include <linux/string.h> | ||
91 | #include <linux/bitops.h> | ||
92 | #include <asm/system.h> | ||
93 | #include <asm/pgtable.h> | ||
94 | #include <asm/io.h> | ||
95 | #include <asm/dma.h> | ||
96 | #include <linux/errno.h> | ||
97 | #include <asm/atarihw.h> | ||
98 | #include <asm/atariints.h> | ||
99 | #include <asm/atari_stdma.h> | ||
100 | #include <asm/atari_acsi.h> | ||
101 | |||
102 | #include <linux/delay.h> | ||
103 | #include <linux/timer.h> | ||
104 | #include <linux/init.h> | ||
105 | |||
106 | #include <linux/netdevice.h> | ||
107 | #include <linux/etherdevice.h> | ||
108 | #include <linux/skbuff.h> | ||
109 | |||
110 | #undef READ | ||
111 | #undef WRITE | ||
112 | |||
113 | /* use 0 for production, 1 for verification, >2 for debug | ||
114 | */ | ||
115 | #ifndef NET_DEBUG | ||
116 | #define NET_DEBUG 0 | ||
117 | #endif | ||
118 | /* | ||
119 | * Global variable 'pamsnet_debug'. Can be set at load time by 'insmod' | ||
120 | */ | ||
121 | unsigned int pamsnet_debug = NET_DEBUG; | ||
122 | module_param(pamsnet_debug, int, 0); | ||
123 | MODULE_PARM_DESC(pamsnet_debug, "pamsnet debug enable (0-1)"); | ||
124 | MODULE_LICENSE("GPL"); | ||
125 | |||
126 | static unsigned int pamsnet_min_poll_time = 2; | ||
127 | |||
128 | |||
129 | /* Information that need to be kept for each board. | ||
130 | */ | ||
131 | struct net_local { | ||
132 | struct net_device_stats stats; | ||
133 | long open_time; /* for debugging */ | ||
134 | int poll_time; /* polling time varies with net load */ | ||
135 | }; | ||
136 | |||
137 | static struct nic_pkt_s { /* packet format */ | ||
138 | unsigned char buffer[2048]; | ||
139 | } *nic_packet = 0; | ||
140 | unsigned char *phys_nic_packet; | ||
141 | |||
142 | typedef unsigned char HADDR[6]; /* 6-byte hardware address of lance */ | ||
143 | |||
144 | /* Index to functions, as function prototypes. | ||
145 | */ | ||
146 | static void start (int target); | ||
147 | static int stop (int target); | ||
148 | static int testpkt (int target); | ||
149 | static int sendpkt (int target, unsigned char *buffer, int length); | ||
150 | static int receivepkt (int target, unsigned char *buffer); | ||
151 | static int inquiry (int target, unsigned char *buffer); | ||
152 | static HADDR *read_hw_addr(int target, unsigned char *buffer); | ||
153 | static void setup_dma (void *address, unsigned rw_flag, int num_blocks); | ||
154 | static int send_first (int target, unsigned char byte); | ||
155 | static int send_1_5 (int lun, unsigned char *command, int dma); | ||
156 | static int get_status (void); | ||
157 | static int calc_received (void *start_address); | ||
158 | |||
159 | static int pamsnet_open(struct net_device *dev); | ||
160 | static int pamsnet_send_packet(struct sk_buff *skb, struct net_device *dev); | ||
161 | static void pamsnet_poll_rx(struct net_device *); | ||
162 | static int pamsnet_close(struct net_device *dev); | ||
163 | static struct net_device_stats *net_get_stats(struct net_device *dev); | ||
164 | static void pamsnet_tick(unsigned long); | ||
165 | |||
166 | static irqreturn_t pamsnet_intr(int irq, void *data); | ||
167 | |||
168 | static DEFINE_TIMER(pamsnet_timer, pamsnet_tick, 0, 0); | ||
169 | |||
170 | #define STRAM_ADDR(a) (((a) & 0xff000000) == 0) | ||
171 | |||
172 | typedef struct | ||
173 | { | ||
174 | unsigned char reserved1[0x38]; | ||
175 | HADDR hwaddr; | ||
176 | unsigned char reserved2[0x1c2]; | ||
177 | } DMAHWADDR; | ||
178 | |||
179 | /* | ||
180 | * Definitions of commands understood by the PAMs DMA adaptor. | ||
181 | * | ||
182 | * In general the DMA adaptor uses LUN 0, 5, 6 and 7 on one ID changeable | ||
183 | * by the PAM's Net software. | ||
184 | * | ||
185 | * LUN 0 works as a harddisk. You can boot the PAM's Net driver there. | ||
186 | * LUN 5 works as a harddisk and lets you access the RAM and some I/O HW | ||
187 | * area. In sector 0, bytes 0x38-0x3d you find the ethernet HW address | ||
188 | * of the adaptor. | ||
189 | * LUN 6 works as a harddisk and lets you access the firmware ROM. | ||
190 | * LUN 7 lets you send and receive packets. | ||
191 | * | ||
192 | * Some commands like the INQUIRY command work identical on all used LUNs. | ||
193 | * | ||
194 | * UNKNOWN1 seems to read some data. | ||
195 | * Command length is 6 bytes. | ||
196 | * UNKNOWN2 seems to read some data (command byte 1 must be !=0). The | ||
197 | * following bytes seem to be something like an allocation length. | ||
198 | * Command length is 6 bytes. | ||
199 | * READPKT reads a packet received by the DMA adaptor. | ||
200 | * Command length is 6 bytes. | ||
201 | * WRITEPKT sends a packet transferred by the following DMA phase. The length | ||
202 | * of the packet is transferred in command bytes 3 and 4. | ||
203 | * The adaptor automatically replaces the src hw address in an ethernet | ||
204 | * packet by its own hw address. | ||
205 | * Command length is 6 bytes. | ||
206 | * INQUIRY has the same function as the INQUIRY command supported by harddisks | ||
207 | * and other SCSI devices. It lets you detect which device you found | ||
208 | * at a given address. | ||
209 | * Command length is 6 bytes. | ||
210 | * START initializes the DMA adaptor. After this command it is able to send | ||
211 | * and receive packets. There is no status byte returned! | ||
212 | * Command length is 1 byte. | ||
213 | * NUMPKTS gives back the number of received packets waiting in the queue in | ||
214 | * the status byte. | ||
215 | * Command length is 1 byte. | ||
216 | * UNKNOWN3 | ||
217 | * UNKNOWN4 Function of these three commands is unknown. | ||
218 | * UNKNOWN5 The command length of these three commands is 1 byte. | ||
219 | * DESELECT immediately deselects the DMA adaptor. May important with interrupt | ||
220 | * driven operation. | ||
221 | * Command length is 1 byte. | ||
222 | * STOP resets the DMA adaptor. After this command packets can no longer | ||
223 | * be received or transferred. | ||
224 | * Command length is 6 byte. | ||
225 | */ | ||
226 | |||
227 | enum {UNKNOWN1=3, READPKT=8, UNKNOWN2, WRITEPKT=10, INQUIRY=18, START, | ||
228 | NUMPKTS=22, UNKNOWN3, UNKNOWN4, UNKNOWN5, DESELECT, STOP}; | ||
229 | |||
230 | #define READSECTOR READPKT | ||
231 | #define WRITESECTOR WRITEPKT | ||
232 | |||
233 | u_char *inquire8="MV PAM's NET/GK"; | ||
234 | |||
235 | #define DMALOW dma_wd.dma_lo | ||
236 | #define DMAMID dma_wd.dma_md | ||
237 | #define DMAHIGH dma_wd.dma_hi | ||
238 | #define DACCESS dma_wd.fdc_acces_seccount | ||
239 | |||
240 | #define MFP_GPIP mfp.par_dt_reg | ||
241 | |||
242 | /* Some useful functions */ | ||
243 | |||
244 | #define INT (!(MFP_GPIP & 0x20)) | ||
245 | #define DELAY ({MFP_GPIP; MFP_GPIP; MFP_GPIP;}) | ||
246 | #define WRITEMODE(value) \ | ||
247 | ({ u_short dummy = value; \ | ||
248 | __asm__ volatile("movew %0, 0xFFFF8606" : : "d"(dummy)); \ | ||
249 | DELAY; \ | ||
250 | }) | ||
251 | #define WRITEBOTH(value1, value2) \ | ||
252 | ({ u_long dummy = (u_long)(value1)<<16 | (u_short)(value2); \ | ||
253 | __asm__ volatile("movel %0, 0xFFFF8604" : : "d"(dummy)); \ | ||
254 | DELAY; \ | ||
255 | }) | ||
256 | |||
257 | /* Definitions for DMODE */ | ||
258 | |||
259 | #define READ 0x000 | ||
260 | #define WRITE 0x100 | ||
261 | |||
262 | #define DMA_FDC 0x080 | ||
263 | #define DMA_ACSI 0x000 | ||
264 | |||
265 | #define DMA_DISABLE 0x040 | ||
266 | |||
267 | #define SEC_COUNT 0x010 | ||
268 | #define DMA_WINDOW 0x000 | ||
269 | |||
270 | #define REG_ACSI 0x008 | ||
271 | #define REG_FDC 0x000 | ||
272 | |||
273 | #define A1 0x002 | ||
274 | |||
275 | /* Timeout constants */ | ||
276 | |||
277 | #define TIMEOUTCMD HZ/2 /* ca. 500ms */ | ||
278 | #define TIMEOUTDMA HZ /* ca. 1s */ | ||
279 | #define COMMAND_DELAY 500 /* ca. 0.5ms */ | ||
280 | |||
281 | unsigned rw; | ||
282 | int lance_target = -1; | ||
283 | int if_up = 0; | ||
284 | |||
285 | /* The following routines access the ethernet board connected to the | ||
286 | * ACSI port via the st_dma chip. | ||
287 | */ | ||
288 | |||
289 | /* The following lowlevel routines work on physical addresses only and assume | ||
290 | * that eventually needed buffers are | ||
291 | * - completely located in ST RAM | ||
292 | * - are contigous in the physical address space | ||
293 | */ | ||
294 | |||
295 | /* Setup the DMA counter */ | ||
296 | |||
297 | static void | ||
298 | setup_dma (void *address, unsigned rw_flag, int num_blocks) | ||
299 | { | ||
300 | WRITEMODE((unsigned) rw_flag | DMA_FDC | SEC_COUNT | REG_ACSI | | ||
301 | A1); | ||
302 | WRITEMODE((unsigned)(rw_flag ^ WRITE) | DMA_FDC | SEC_COUNT | REG_ACSI | | ||
303 | A1); | ||
304 | WRITEMODE((unsigned) rw_flag | DMA_FDC | SEC_COUNT | REG_ACSI | | ||
305 | A1); | ||
306 | DMALOW = (unsigned char)((unsigned long)address & 0xFF); | ||
307 | DMAMID = (unsigned char)(((unsigned long)address >> 8) & 0xFF); | ||
308 | DMAHIGH = (unsigned char)(((unsigned long)address >> 16) & 0xFF); | ||
309 | WRITEBOTH((unsigned)num_blocks & 0xFF, | ||
310 | rw_flag | DMA_FDC | DMA_WINDOW | REG_ACSI | A1); | ||
311 | rw = rw_flag; | ||
312 | } | ||
313 | |||
314 | /* Send the first byte of an command block */ | ||
315 | |||
316 | static int | ||
317 | send_first (int target, unsigned char byte) | ||
318 | { | ||
319 | rw = READ; | ||
320 | acsi_delay_end(COMMAND_DELAY); | ||
321 | /* | ||
322 | * wake up ACSI | ||
323 | */ | ||
324 | WRITEMODE(DMA_FDC | DMA_WINDOW | REG_ACSI); | ||
325 | /* | ||
326 | * write command byte | ||
327 | */ | ||
328 | WRITEBOTH((target << 5) | (byte & 0x1F), DMA_FDC | | ||
329 | DMA_WINDOW | REG_ACSI | A1); | ||
330 | return (!acsi_wait_for_IRQ(TIMEOUTCMD)); | ||
331 | } | ||
332 | |||
333 | /* Send the rest of an command block */ | ||
334 | |||
335 | static int | ||
336 | send_1_5 (int lun, unsigned char *command, int dma) | ||
337 | { | ||
338 | int i, j; | ||
339 | |||
340 | for (i=0; i<5; i++) { | ||
341 | WRITEBOTH((!i ? (((lun & 0x7) << 5) | (command[i] & 0x1F)) | ||
342 | : command[i]), | ||
343 | rw | REG_ACSI | DMA_WINDOW | | ||
344 | ((i < 4) ? DMA_FDC | ||
345 | : (dma ? DMA_ACSI | ||
346 | : DMA_FDC)) | A1); | ||
347 | if (i < 4 && (j = !acsi_wait_for_IRQ(TIMEOUTCMD))) | ||
348 | return (j); | ||
349 | } | ||
350 | return (0); | ||
351 | } | ||
352 | |||
353 | /* Read a status byte */ | ||
354 | |||
355 | static int | ||
356 | get_status (void) | ||
357 | { | ||
358 | WRITEMODE(DMA_FDC | DMA_WINDOW | REG_ACSI | A1); | ||
359 | acsi_delay_start(); | ||
360 | return ((int)(DACCESS & 0xFF)); | ||
361 | } | ||
362 | |||
363 | /* Calculate the number of received bytes */ | ||
364 | |||
365 | static int | ||
366 | calc_received (void *start_address) | ||
367 | { | ||
368 | return (int)( | ||
369 | (((unsigned long)DMAHIGH << 16) | ((unsigned)DMAMID << 8) | DMALOW) | ||
370 | - (unsigned long)start_address); | ||
371 | } | ||
372 | |||
373 | /* The following midlevel routines still work on physical addresses ... */ | ||
374 | |||
375 | /* start() starts the PAM's DMA adaptor */ | ||
376 | |||
377 | static void | ||
378 | start (int target) | ||
379 | { | ||
380 | send_first(target, START); | ||
381 | } | ||
382 | |||
383 | /* stop() stops the PAM's DMA adaptor and returns a value of zero in case of success */ | ||
384 | |||
385 | static int | ||
386 | stop (int target) | ||
387 | { | ||
388 | int ret = -1; | ||
389 | unsigned char cmd_buffer[5]; | ||
390 | |||
391 | if (send_first(target, STOP)) | ||
392 | goto bad; | ||
393 | cmd_buffer[0] = cmd_buffer[1] = cmd_buffer[2] = | ||
394 | cmd_buffer[3] = cmd_buffer[4] = 0; | ||
395 | if (send_1_5(7, cmd_buffer, 0) || | ||
396 | !acsi_wait_for_IRQ(TIMEOUTDMA) || | ||
397 | get_status()) | ||
398 | goto bad; | ||
399 | ret = 0; | ||
400 | bad: | ||
401 | return (ret); | ||
402 | } | ||
403 | |||
404 | /* testpkt() returns the number of received packets waiting in the queue */ | ||
405 | |||
406 | static int | ||
407 | testpkt(int target) | ||
408 | { | ||
409 | int ret = -1; | ||
410 | |||
411 | if (send_first(target, NUMPKTS)) | ||
412 | goto bad; | ||
413 | ret = get_status(); | ||
414 | bad: | ||
415 | return (ret); | ||
416 | } | ||
417 | |||
418 | /* inquiry() returns 0 when PAM's DMA found, -1 when timeout, -2 otherwise */ | ||
419 | /* Please note: The buffer is for internal use only but must be defined! */ | ||
420 | |||
421 | static int | ||
422 | inquiry (int target, unsigned char *buffer) | ||
423 | { | ||
424 | int ret = -1; | ||
425 | unsigned char *vbuffer = phys_to_virt((unsigned long)buffer); | ||
426 | unsigned char cmd_buffer[5]; | ||
427 | |||
428 | if (send_first(target, INQUIRY)) | ||
429 | goto bad; | ||
430 | setup_dma(buffer, READ, 1); | ||
431 | vbuffer[8] = vbuffer[27] = 0; /* Avoid confusion with previous read data */ | ||
432 | cmd_buffer[0] = cmd_buffer[1] = cmd_buffer[2] = cmd_buffer[4] = 0; | ||
433 | cmd_buffer[3] = 48; | ||
434 | if (send_1_5(5, cmd_buffer, 1) || | ||
435 | !acsi_wait_for_IRQ(TIMEOUTDMA) || | ||
436 | get_status() || | ||
437 | (calc_received(buffer) < 32)) | ||
438 | goto bad; | ||
439 | dma_cache_maintenance((unsigned long)(buffer+8), 20, 0); | ||
440 | if (memcmp(inquire8, vbuffer+8, 20)) | ||
441 | goto bad; | ||
442 | ret = 0; | ||
443 | bad: | ||
444 | if (!!NET_DEBUG) { | ||
445 | vbuffer[8+20]=0; | ||
446 | printk("inquiry of target %d: %s\n", target, vbuffer+8); | ||
447 | } | ||
448 | return (ret); | ||
449 | } | ||
450 | |||
451 | /* | ||
452 | * read_hw_addr() reads the sector containing the hwaddr and returns | ||
453 | * a pointer to it (virtual address!) or 0 in case of an error | ||
454 | */ | ||
455 | |||
456 | static HADDR | ||
457 | *read_hw_addr(int target, unsigned char *buffer) | ||
458 | { | ||
459 | HADDR *ret = 0; | ||
460 | unsigned char cmd_buffer[5]; | ||
461 | |||
462 | if (send_first(target, READSECTOR)) | ||
463 | goto bad; | ||
464 | setup_dma(buffer, READ, 1); | ||
465 | cmd_buffer[0] = cmd_buffer[1] = cmd_buffer[2] = cmd_buffer[4] = 0; | ||
466 | cmd_buffer[3] = 1; | ||
467 | if (send_1_5(5, cmd_buffer, 1) || | ||
468 | !acsi_wait_for_IRQ(TIMEOUTDMA) || | ||
469 | get_status()) | ||
470 | goto bad; | ||
471 | ret = phys_to_virt((unsigned long)&(((DMAHWADDR *)buffer)->hwaddr)); | ||
472 | dma_cache_maintenance((unsigned long)buffer, 512, 0); | ||
473 | bad: | ||
474 | return (ret); | ||
475 | } | ||
476 | |||
477 | static irqreturn_t | ||
478 | pamsnet_intr(int irq, void *data) | ||
479 | { | ||
480 | return IRQ_HANDLED; | ||
481 | } | ||
482 | |||
483 | /* receivepkt() loads a packet to a given buffer and returns its length */ | ||
484 | |||
485 | static int | ||
486 | receivepkt (int target, unsigned char *buffer) | ||
487 | { | ||
488 | int ret = -1; | ||
489 | unsigned char cmd_buffer[5]; | ||
490 | |||
491 | if (send_first(target, READPKT)) | ||
492 | goto bad; | ||
493 | setup_dma(buffer, READ, 3); | ||
494 | cmd_buffer[0] = cmd_buffer[1] = cmd_buffer[2] = cmd_buffer[4] = 0; | ||
495 | cmd_buffer[3] = 3; | ||
496 | if (send_1_5(7, cmd_buffer, 1) || | ||
497 | !acsi_wait_for_IRQ(TIMEOUTDMA) || | ||
498 | get_status()) | ||
499 | goto bad; | ||
500 | ret = calc_received(buffer); | ||
501 | bad: | ||
502 | return (ret); | ||
503 | } | ||
504 | |||
505 | /* sendpkt() sends a packet and returns a value of zero when the packet was sent | ||
506 | successfully */ | ||
507 | |||
508 | static int | ||
509 | sendpkt (int target, unsigned char *buffer, int length) | ||
510 | { | ||
511 | int ret = -1; | ||
512 | unsigned char cmd_buffer[5]; | ||
513 | |||
514 | if (send_first(target, WRITEPKT)) | ||
515 | goto bad; | ||
516 | setup_dma(buffer, WRITE, 3); | ||
517 | cmd_buffer[0] = cmd_buffer[1] = cmd_buffer[4] = 0; | ||
518 | cmd_buffer[2] = length >> 8; | ||
519 | cmd_buffer[3] = length & 0xFF; | ||
520 | if (send_1_5(7, cmd_buffer, 1) || | ||
521 | !acsi_wait_for_IRQ(TIMEOUTDMA) || | ||
522 | get_status()) | ||
523 | goto bad; | ||
524 | ret = 0; | ||
525 | bad: | ||
526 | return (ret); | ||
527 | } | ||
528 | |||
529 | /* The following higher level routines work on virtual addresses and convert them to | ||
530 | * physical addresses when passed to the lowlevel routines. It's up to the higher level | ||
531 | * routines to copy data from Alternate RAM to ST RAM if neccesary! | ||
532 | */ | ||
533 | |||
534 | /* Check for a network adaptor of this type, and return '0' if one exists. | ||
535 | */ | ||
536 | |||
537 | struct net_device * __init pamsnet_probe (int unit) | ||
538 | { | ||
539 | struct net_device *dev; | ||
540 | int i; | ||
541 | HADDR *hwaddr; | ||
542 | int err; | ||
543 | |||
544 | unsigned char station_addr[6]; | ||
545 | static unsigned version_printed; | ||
546 | /* avoid "Probing for..." printed 4 times - the driver is supporting only one adapter now! */ | ||
547 | static int no_more_found; | ||
548 | |||
549 | if (no_more_found) | ||
550 | return ERR_PTR(-ENODEV); | ||
551 | no_more_found = 1; | ||
552 | |||
553 | dev = alloc_etherdev(sizeof(struct net_local)); | ||
554 | if (!dev) | ||
555 | return ERR_PTR(-ENOMEM); | ||
556 | if (unit >= 0) { | ||
557 | sprintf(dev->name, "eth%d", unit); | ||
558 | netdev_boot_setup_check(dev); | ||
559 | } | ||
560 | SET_MODULE_OWNER(dev); | ||
561 | |||
562 | printk("Probing for PAM's Net/GK Adapter...\n"); | ||
563 | |||
564 | /* Allocate the DMA buffer here since we need it for probing! */ | ||
565 | |||
566 | nic_packet = (struct nic_pkt_s *)acsi_buffer; | ||
567 | phys_nic_packet = (unsigned char *)phys_acsi_buffer; | ||
568 | if (pamsnet_debug > 0) { | ||
569 | printk("nic_packet at 0x%p, phys at 0x%p\n", | ||
570 | nic_packet, phys_nic_packet ); | ||
571 | } | ||
572 | |||
573 | stdma_lock(pamsnet_intr, NULL); | ||
574 | DISABLE_IRQ(); | ||
575 | |||
576 | for (i=0; i<8; i++) { | ||
577 | /* Do two inquiries to cover cases with strange equipment on previous ID */ | ||
578 | /* blocking the ACSI bus (like the SLMC804 laser printer controller... */ | ||
579 | inquiry(i, phys_nic_packet); | ||
580 | if (!inquiry(i, phys_nic_packet)) { | ||
581 | lance_target = i; | ||
582 | break; | ||
583 | } | ||
584 | } | ||
585 | |||
586 | if (!!NET_DEBUG) | ||
587 | printk("ID: %d\n",i); | ||
588 | |||
589 | if (lance_target >= 0) { | ||
590 | if (!(hwaddr = read_hw_addr(lance_target, phys_nic_packet))) | ||
591 | lance_target = -1; | ||
592 | else | ||
593 | memcpy (station_addr, hwaddr, ETH_ALEN); | ||
594 | } | ||
595 | |||
596 | ENABLE_IRQ(); | ||
597 | stdma_release(); | ||
598 | |||
599 | if (lance_target < 0) { | ||
600 | printk("No PAM's Net/GK found.\n"); | ||
601 | free_netdev(dev); | ||
602 | return ERR_PTR(-ENODEV); | ||
603 | } | ||
604 | |||
605 | if (pamsnet_debug > 0 && version_printed++ == 0) | ||
606 | printk(version); | ||
607 | |||
608 | printk("%s: %s found on target %01d, eth-addr: %02x:%02x:%02x:%02x:%02x:%02x.\n", | ||
609 | dev->name, "PAM's Net/GK", lance_target, | ||
610 | station_addr[0], station_addr[1], station_addr[2], | ||
611 | station_addr[3], station_addr[4], station_addr[5]); | ||
612 | |||
613 | /* Initialize the device structure. */ | ||
614 | dev->open = pamsnet_open; | ||
615 | dev->stop = pamsnet_close; | ||
616 | dev->hard_start_xmit = pamsnet_send_packet; | ||
617 | dev->get_stats = net_get_stats; | ||
618 | |||
619 | /* Fill in the fields of the device structure with ethernet-generic | ||
620 | * values. This should be in a common file instead of per-driver. | ||
621 | */ | ||
622 | |||
623 | for (i = 0; i < ETH_ALEN; i++) { | ||
624 | #if 0 | ||
625 | dev->broadcast[i] = 0xff; | ||
626 | #endif | ||
627 | dev->dev_addr[i] = station_addr[i]; | ||
628 | } | ||
629 | err = register_netdev(dev); | ||
630 | if (!err) | ||
631 | return dev; | ||
632 | |||
633 | free_netdev(dev); | ||
634 | return ERR_PTR(err); | ||
635 | } | ||
636 | |||
637 | /* Open/initialize the board. This is called (in the current kernel) | ||
638 | sometime after booting when the 'ifconfig' program is run. | ||
639 | |||
640 | This routine should set everything up anew at each open, even | ||
641 | registers that "should" only need to be set once at boot, so that | ||
642 | there is non-reboot way to recover if something goes wrong. | ||
643 | */ | ||
644 | static int | ||
645 | pamsnet_open(struct net_device *dev) | ||
646 | { | ||
647 | struct net_local *lp = netdev_priv(dev); | ||
648 | |||
649 | if (pamsnet_debug > 0) | ||
650 | printk("pamsnet_open\n"); | ||
651 | stdma_lock(pamsnet_intr, NULL); | ||
652 | DISABLE_IRQ(); | ||
653 | |||
654 | /* Reset the hardware here. | ||
655 | */ | ||
656 | if (!if_up) | ||
657 | start(lance_target); | ||
658 | if_up = 1; | ||
659 | lp->open_time = 0; /*jiffies*/ | ||
660 | lp->poll_time = MAX_POLL_TIME; | ||
661 | |||
662 | dev->tbusy = 0; | ||
663 | dev->interrupt = 0; | ||
664 | dev->start = 1; | ||
665 | |||
666 | ENABLE_IRQ(); | ||
667 | stdma_release(); | ||
668 | pamsnet_timer.data = (long)dev; | ||
669 | pamsnet_timer.expires = jiffies + lp->poll_time; | ||
670 | add_timer(&pamsnet_timer); | ||
671 | return 0; | ||
672 | } | ||
673 | |||
674 | static int | ||
675 | pamsnet_send_packet(struct sk_buff *skb, struct net_device *dev) | ||
676 | { | ||
677 | struct net_local *lp = netdev_priv(dev); | ||
678 | unsigned long flags; | ||
679 | |||
680 | /* Block a timer-based transmit from overlapping. This could better be | ||
681 | * done with atomic_swap(1, dev->tbusy), but set_bit() works as well. | ||
682 | */ | ||
683 | local_irq_save(flags); | ||
684 | |||
685 | if (stdma_islocked()) { | ||
686 | local_irq_restore(flags); | ||
687 | lp->stats.tx_errors++; | ||
688 | } | ||
689 | else { | ||
690 | int length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN; | ||
691 | unsigned long buf = virt_to_phys(skb->data); | ||
692 | int stat; | ||
693 | |||
694 | stdma_lock(pamsnet_intr, NULL); | ||
695 | DISABLE_IRQ(); | ||
696 | |||
697 | local_irq_restore(flags); | ||
698 | if( !STRAM_ADDR(buf+length-1) ) { | ||
699 | skb_copy_from_linear_data(skb, nic_packet->buffer, | ||
700 | length); | ||
701 | buf = (unsigned long)phys_nic_packet; | ||
702 | } | ||
703 | |||
704 | dma_cache_maintenance(buf, length, 1); | ||
705 | |||
706 | stat = sendpkt(lance_target, (unsigned char *)buf, length); | ||
707 | ENABLE_IRQ(); | ||
708 | stdma_release(); | ||
709 | |||
710 | dev->trans_start = jiffies; | ||
711 | dev->tbusy = 0; | ||
712 | lp->stats.tx_packets++; | ||
713 | lp->stats.tx_bytes+=length; | ||
714 | } | ||
715 | dev_kfree_skb(skb); | ||
716 | |||
717 | return 0; | ||
718 | } | ||
719 | |||
720 | /* We have a good packet(s), get it/them out of the buffers. | ||
721 | */ | ||
722 | static void | ||
723 | pamsnet_poll_rx(struct net_device *dev) | ||
724 | { | ||
725 | struct net_local *lp = netdev_priv(dev); | ||
726 | int boguscount; | ||
727 | int pkt_len; | ||
728 | struct sk_buff *skb; | ||
729 | unsigned long flags; | ||
730 | |||
731 | local_irq_save(flags); | ||
732 | /* ++roman: Take care at locking the ST-DMA... This must be done with ints | ||
733 | * off, since otherwise an int could slip in between the question and the | ||
734 | * locking itself, and then we'd go to sleep... And locking itself is | ||
735 | * necessary to keep the floppy_change timer from working with ST-DMA | ||
736 | * registers. */ | ||
737 | if (stdma_islocked()) { | ||
738 | local_irq_restore(flags); | ||
739 | return; | ||
740 | } | ||
741 | stdma_lock(pamsnet_intr, NULL); | ||
742 | DISABLE_IRQ(); | ||
743 | local_irq_restore(flags); | ||
744 | |||
745 | boguscount = testpkt(lance_target); | ||
746 | if( lp->poll_time < MAX_POLL_TIME ) lp->poll_time++; | ||
747 | |||
748 | while(boguscount--) { | ||
749 | pkt_len = receivepkt(lance_target, phys_nic_packet); | ||
750 | |||
751 | if( pkt_len < 60 ) break; | ||
752 | |||
753 | /* Good packet... */ | ||
754 | |||
755 | dma_cache_maintenance((unsigned long)phys_nic_packet, pkt_len, 0); | ||
756 | |||
757 | lp->poll_time = pamsnet_min_poll_time; /* fast poll */ | ||
758 | if( pkt_len >= 60 && pkt_len <= 2048 ) { | ||
759 | if (pkt_len > 1514) | ||
760 | pkt_len = 1514; | ||
761 | |||
762 | /* Malloc up new buffer. | ||
763 | */ | ||
764 | skb = alloc_skb(pkt_len, GFP_ATOMIC); | ||
765 | if (skb == NULL) { | ||
766 | printk("%s: Memory squeeze, dropping packet.\n", | ||
767 | dev->name); | ||
768 | lp->stats.rx_dropped++; | ||
769 | break; | ||
770 | } | ||
771 | skb->len = pkt_len; | ||
772 | skb->dev = dev; | ||
773 | |||
774 | /* 'skb->data' points to the start of sk_buff data area. | ||
775 | */ | ||
776 | skb_copy_to_linear_data(skb, nic_packet->buffer, | ||
777 | pkt_len); | ||
778 | netif_rx(skb); | ||
779 | dev->last_rx = jiffies; | ||
780 | lp->stats.rx_packets++; | ||
781 | lp->stats.rx_bytes+=pkt_len; | ||
782 | } | ||
783 | } | ||
784 | |||
785 | /* If any worth-while packets have been received, dev_rint() | ||
786 | has done a mark_bh(INET_BH) for us and will work on them | ||
787 | when we get to the bottom-half routine. | ||
788 | */ | ||
789 | |||
790 | ENABLE_IRQ(); | ||
791 | stdma_release(); | ||
792 | return; | ||
793 | } | ||
794 | |||
795 | /* pamsnet_tick: called by pamsnet_timer. Reads packets from the adapter, | ||
796 | * passes them to the higher layers and restarts the timer. | ||
797 | */ | ||
798 | static void | ||
799 | pamsnet_tick(unsigned long data) | ||
800 | { | ||
801 | struct net_device *dev = (struct net_device *)data; | ||
802 | struct net_local *lp = netdev_priv(dev); | ||
803 | |||
804 | if( pamsnet_debug > 0 && (lp->open_time++ & 7) == 8 ) | ||
805 | printk("pamsnet_tick: %ld\n", lp->open_time); | ||
806 | |||
807 | pamsnet_poll_rx(dev); | ||
808 | |||
809 | pamsnet_timer.expires = jiffies + lp->poll_time; | ||
810 | add_timer(&pamsnet_timer); | ||
811 | } | ||
812 | |||
813 | /* The inverse routine to pamsnet_open(). | ||
814 | */ | ||
815 | static int | ||
816 | pamsnet_close(struct net_device *dev) | ||
817 | { | ||
818 | struct net_local *lp = netdev_priv(dev); | ||
819 | |||
820 | if (pamsnet_debug > 0) | ||
821 | printk("pamsnet_close, open_time=%ld\n", lp->open_time); | ||
822 | del_timer(&pamsnet_timer); | ||
823 | stdma_lock(pamsnet_intr, NULL); | ||
824 | DISABLE_IRQ(); | ||
825 | |||
826 | if (if_up) | ||
827 | stop(lance_target); | ||
828 | if_up = 0; | ||
829 | |||
830 | lp->open_time = 0; | ||
831 | |||
832 | dev->tbusy = 1; | ||
833 | dev->start = 0; | ||
834 | |||
835 | ENABLE_IRQ(); | ||
836 | stdma_release(); | ||
837 | return 0; | ||
838 | } | ||
839 | |||
840 | /* Get the current statistics. | ||
841 | This may be called with the card open or closed. | ||
842 | */ | ||
843 | static struct net_device_stats *net_get_stats(struct net_device *dev) | ||
844 | { | ||
845 | struct net_local *lp = netdev_priv(dev); | ||
846 | return &lp->stats; | ||
847 | } | ||
848 | |||
849 | |||
850 | #ifdef MODULE | ||
851 | |||
852 | static struct net_device *pam_dev; | ||
853 | |||
854 | int init_module(void) | ||
855 | { | ||
856 | pam_dev = pamsnet_probe(-1); | ||
857 | if (IS_ERR(pam_dev)) | ||
858 | return PTR_ERR(pam_dev); | ||
859 | return 0; | ||
860 | } | ||
861 | |||
862 | void cleanup_module(void) | ||
863 | { | ||
864 | unregister_netdev(pam_dev); | ||
865 | free_netdev(pam_dev); | ||
866 | } | ||
867 | |||
868 | #endif /* MODULE */ | ||
869 | |||
870 | /* Local variables: | ||
871 | * compile-command: "gcc -D__KERNEL__ -I/usr/src/linux/include | ||
872 | -b m68k-linuxaout -Wall -Wstrict-prototypes -O2 | ||
873 | -fomit-frame-pointer -pipe -DMODULE -I../../net/inet -c atari_pamsnet.c" | ||
874 | * version-control: t | ||
875 | * kept-new-versions: 5 | ||
876 | * tab-width: 8 | ||
877 | * End: | ||
878 | */ | ||
diff --git a/fs/splice.c b/fs/splice.c index 6c9828651e6f..53fc2082a468 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -1061,8 +1061,9 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd, | |||
1061 | 1061 | ||
1062 | while (len) { | 1062 | while (len) { |
1063 | size_t read_len; | 1063 | size_t read_len; |
1064 | loff_t pos = sd->pos; | ||
1064 | 1065 | ||
1065 | ret = do_splice_to(in, &sd->pos, pipe, len, flags); | 1066 | ret = do_splice_to(in, &pos, pipe, len, flags); |
1066 | if (unlikely(ret <= 0)) | 1067 | if (unlikely(ret <= 0)) |
1067 | goto out_release; | 1068 | goto out_release; |
1068 | 1069 | ||
@@ -1080,6 +1081,7 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd, | |||
1080 | 1081 | ||
1081 | bytes += ret; | 1082 | bytes += ret; |
1082 | len -= ret; | 1083 | len -= ret; |
1084 | sd->pos = pos; | ||
1083 | 1085 | ||
1084 | if (ret < read_len) | 1086 | if (ret < read_len) |
1085 | goto out_release; | 1087 | goto out_release; |
diff --git a/include/asm-m68k/atari_SLM.h b/include/asm-m68k/atari_SLM.h deleted file mode 100644 index 42f4fcdd8bc7..000000000000 --- a/include/asm-m68k/atari_SLM.h +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | |||
2 | #ifndef _ATARI_SLM_H | ||
3 | #define _ATARI_SLM_H | ||
4 | |||
5 | /* Atari SLM laser printer specific ioctls */ | ||
6 | |||
7 | #define SLMIOGSTAT 0xa100 | ||
8 | #define SLMIOGPSIZE 0xa101 | ||
9 | #define SLMIOGMFEED 0xa102 | ||
10 | |||
11 | #define SLMIORESET 0xa140 | ||
12 | |||
13 | #define SLMIOSPSIZE 0xa181 | ||
14 | #define SLMIOSMFEED 0xa182 | ||
15 | |||
16 | /* Status returning structure (SLMIOGSTAT) */ | ||
17 | struct SLM_status { | ||
18 | int stat; /* numeric status code */ | ||
19 | char str[40]; /* status string */ | ||
20 | }; | ||
21 | |||
22 | /* Paper size structure (SLMIO[GS]PSIZE) */ | ||
23 | struct SLM_paper_size { | ||
24 | int width; | ||
25 | int height; | ||
26 | }; | ||
27 | |||
28 | #endif /* _ATARI_SLM_H */ | ||
diff --git a/include/asm-m68k/atari_acsi.h b/include/asm-m68k/atari_acsi.h deleted file mode 100644 index 10fea68f191a..000000000000 --- a/include/asm-m68k/atari_acsi.h +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | #ifndef _ASM_ATARI_ACSI_H | ||
2 | #define _ASM_ATARI_ACSI_H | ||
3 | |||
4 | /* Functions exported by drivers/block/acsi.c */ | ||
5 | |||
6 | void acsi_delay_start( void ); | ||
7 | void acsi_delay_end( long usec ); | ||
8 | int acsi_wait_for_IRQ( unsigned timeout ); | ||
9 | int acsi_wait_for_noIRQ( unsigned timeout ); | ||
10 | int acsicmd_nodma( const char *cmd, int enable); | ||
11 | int acsi_getstatus( void ); | ||
12 | int acsi_extstatus( char *buffer, int cnt ); | ||
13 | void acsi_end_extstatus( void ); | ||
14 | int acsi_extcmd( unsigned char *buffer, int cnt ); | ||
15 | |||
16 | /* The ACSI buffer is guarantueed to reside in ST-RAM and may be used by other | ||
17 | * drivers that work on the ACSI bus, too. It's data are valid only as long as | ||
18 | * the ST-DMA is locked. */ | ||
19 | extern char *acsi_buffer; | ||
20 | extern unsigned long phys_acsi_buffer; | ||
21 | |||
22 | /* Utility macros */ | ||
23 | |||
24 | /* Send one data byte over the bus and set mode for next operation | ||
25 | * with one move.l -- Atari recommends this... | ||
26 | */ | ||
27 | |||
28 | #define DMA_LONG_WRITE(data,mode) \ | ||
29 | do { \ | ||
30 | *((unsigned long *)&dma_wd.fdc_acces_seccount) = \ | ||
31 | ((data)<<16) | (mode); \ | ||
32 | } while(0) | ||
33 | |||
34 | #define ENABLE_IRQ() atari_turnon_irq( IRQ_MFP_ACSI ) | ||
35 | #define DISABLE_IRQ() atari_turnoff_irq( IRQ_MFP_ACSI ) | ||
36 | |||
37 | #endif /* _ASM_ATARI_ACSI_H */ | ||