diff options
Diffstat (limited to 'Documentation/ioctl')
-rw-r--r-- | Documentation/ioctl/cdrom.txt | 966 | ||||
-rw-r--r-- | Documentation/ioctl/hdio.txt | 1070 |
2 files changed, 2036 insertions, 0 deletions
diff --git a/Documentation/ioctl/cdrom.txt b/Documentation/ioctl/cdrom.txt new file mode 100644 index 000000000000..4ccdcc6fe364 --- /dev/null +++ b/Documentation/ioctl/cdrom.txt | |||
@@ -0,0 +1,966 @@ | |||
1 | Summary of CDROM ioctl calls. | ||
2 | ============================ | ||
3 | |||
4 | Edward A. Falk <efalk@google.com> | ||
5 | |||
6 | November, 2004 | ||
7 | |||
8 | This document attempts to describe the ioctl(2) calls supported by | ||
9 | the CDROM layer. These are by-and-large implemented (as of Linux 2.6) | ||
10 | in drivers/cdrom/cdrom.c and drivers/block/scsi_ioctl.c | ||
11 | |||
12 | ioctl values are listed in <linux/cdrom.h>. As of this writing, they | ||
13 | are as follows: | ||
14 | |||
15 | CDROMPAUSE Pause Audio Operation | ||
16 | CDROMRESUME Resume paused Audio Operation | ||
17 | CDROMPLAYMSF Play Audio MSF (struct cdrom_msf) | ||
18 | CDROMPLAYTRKIND Play Audio Track/index (struct cdrom_ti) | ||
19 | CDROMREADTOCHDR Read TOC header (struct cdrom_tochdr) | ||
20 | CDROMREADTOCENTRY Read TOC entry (struct cdrom_tocentry) | ||
21 | CDROMSTOP Stop the cdrom drive | ||
22 | CDROMSTART Start the cdrom drive | ||
23 | CDROMEJECT Ejects the cdrom media | ||
24 | CDROMVOLCTRL Control output volume (struct cdrom_volctrl) | ||
25 | CDROMSUBCHNL Read subchannel data (struct cdrom_subchnl) | ||
26 | CDROMREADMODE2 Read CDROM mode 2 data (2336 Bytes) | ||
27 | (struct cdrom_read) | ||
28 | CDROMREADMODE1 Read CDROM mode 1 data (2048 Bytes) | ||
29 | (struct cdrom_read) | ||
30 | CDROMREADAUDIO (struct cdrom_read_audio) | ||
31 | CDROMEJECT_SW enable(1)/disable(0) auto-ejecting | ||
32 | CDROMMULTISESSION Obtain the start-of-last-session | ||
33 | address of multi session disks | ||
34 | (struct cdrom_multisession) | ||
35 | CDROM_GET_MCN Obtain the "Universal Product Code" | ||
36 | if available (struct cdrom_mcn) | ||
37 | CDROM_GET_UPC Deprecated, use CDROM_GET_MCN instead. | ||
38 | CDROMRESET hard-reset the drive | ||
39 | CDROMVOLREAD Get the drive's volume setting | ||
40 | (struct cdrom_volctrl) | ||
41 | CDROMREADRAW read data in raw mode (2352 Bytes) | ||
42 | (struct cdrom_read) | ||
43 | CDROMREADCOOKED read data in cooked mode | ||
44 | CDROMSEEK seek msf address | ||
45 | CDROMPLAYBLK scsi-cd only, (struct cdrom_blk) | ||
46 | CDROMREADALL read all 2646 bytes | ||
47 | CDROMGETSPINDOWN return 4-bit spindown value | ||
48 | CDROMSETSPINDOWN set 4-bit spindown value | ||
49 | CDROMCLOSETRAY pendant of CDROMEJECT | ||
50 | CDROM_SET_OPTIONS Set behavior options | ||
51 | CDROM_CLEAR_OPTIONS Clear behavior options | ||
52 | CDROM_SELECT_SPEED Set the CD-ROM speed | ||
53 | CDROM_SELECT_DISC Select disc (for juke-boxes) | ||
54 | CDROM_MEDIA_CHANGED Check is media changed | ||
55 | CDROM_DRIVE_STATUS Get tray position, etc. | ||
56 | CDROM_DISC_STATUS Get disc type, etc. | ||
57 | CDROM_CHANGER_NSLOTS Get number of slots | ||
58 | CDROM_LOCKDOOR lock or unlock door | ||
59 | CDROM_DEBUG Turn debug messages on/off | ||
60 | CDROM_GET_CAPABILITY get capabilities | ||
61 | CDROMAUDIOBUFSIZ set the audio buffer size | ||
62 | DVD_READ_STRUCT Read structure | ||
63 | DVD_WRITE_STRUCT Write structure | ||
64 | DVD_AUTH Authentication | ||
65 | CDROM_SEND_PACKET send a packet to the drive | ||
66 | CDROM_NEXT_WRITABLE get next writable block | ||
67 | CDROM_LAST_WRITTEN get last block written on disc | ||
68 | |||
69 | |||
70 | The information that follows was determined from reading kernel source | ||
71 | code. It is likely that some corrections will be made over time. | ||
72 | |||
73 | |||
74 | |||
75 | |||
76 | |||
77 | |||
78 | |||
79 | General: | ||
80 | |||
81 | Unless otherwise specified, all ioctl calls return 0 on success | ||
82 | and -1 with errno set to an appropriate value on error. (Some | ||
83 | ioctls return non-negative data values.) | ||
84 | |||
85 | Unless otherwise specified, all ioctl calls return -1 and set | ||
86 | errno to EFAULT on a failed attempt to copy data to or from user | ||
87 | address space. | ||
88 | |||
89 | Individual drivers may return error codes not listed here. | ||
90 | |||
91 | Unless otherwise specified, all data structures and constants | ||
92 | are defined in <linux/cdrom.h> | ||
93 | |||
94 | |||
95 | |||
96 | |||
97 | CDROMPAUSE Pause Audio Operation | ||
98 | |||
99 | usage: | ||
100 | |||
101 | ioctl(fd, CDROMPAUSE, 0); | ||
102 | |||
103 | inputs: none | ||
104 | |||
105 | outputs: none | ||
106 | |||
107 | error return: | ||
108 | ENOSYS cd drive not audio-capable. | ||
109 | |||
110 | |||
111 | CDROMRESUME Resume paused Audio Operation | ||
112 | |||
113 | usage: | ||
114 | |||
115 | ioctl(fd, CDROMRESUME, 0); | ||
116 | |||
117 | inputs: none | ||
118 | |||
119 | outputs: none | ||
120 | |||
121 | error return: | ||
122 | ENOSYS cd drive not audio-capable. | ||
123 | |||
124 | |||
125 | CDROMPLAYMSF Play Audio MSF (struct cdrom_msf) | ||
126 | |||
127 | usage: | ||
128 | |||
129 | struct cdrom_msf msf; | ||
130 | ioctl(fd, CDROMPLAYMSF, &msf); | ||
131 | |||
132 | inputs: | ||
133 | cdrom_msf structure, describing a segment of music to play | ||
134 | |||
135 | outputs: none | ||
136 | |||
137 | error return: | ||
138 | ENOSYS cd drive not audio-capable. | ||
139 | |||
140 | notes: | ||
141 | MSF stands for minutes-seconds-frames | ||
142 | LBA stands for logical block address | ||
143 | |||
144 | Segment is described as start and end times, where each time | ||
145 | is described as minutes:seconds:frames. A frame is 1/75 of | ||
146 | a second. | ||
147 | |||
148 | |||
149 | CDROMPLAYTRKIND Play Audio Track/index (struct cdrom_ti) | ||
150 | |||
151 | usage: | ||
152 | |||
153 | struct cdrom_ti ti; | ||
154 | ioctl(fd, CDROMPLAYTRKIND, &ti); | ||
155 | |||
156 | inputs: | ||
157 | cdrom_ti structure, describing a segment of music to play | ||
158 | |||
159 | outputs: none | ||
160 | |||
161 | error return: | ||
162 | ENOSYS cd drive not audio-capable. | ||
163 | |||
164 | notes: | ||
165 | Segment is described as start and end times, where each time | ||
166 | is described as a track and an index. | ||
167 | |||
168 | |||
169 | |||
170 | CDROMREADTOCHDR Read TOC header (struct cdrom_tochdr) | ||
171 | |||
172 | usage: | ||
173 | |||
174 | cdrom_tochdr header; | ||
175 | ioctl(fd, CDROMREADTOCHDR, &header); | ||
176 | |||
177 | inputs: | ||
178 | cdrom_tochdr structure | ||
179 | |||
180 | outputs: | ||
181 | cdrom_tochdr structure | ||
182 | |||
183 | error return: | ||
184 | ENOSYS cd drive not audio-capable. | ||
185 | |||
186 | |||
187 | |||
188 | CDROMREADTOCENTRY Read TOC entry (struct cdrom_tocentry) | ||
189 | |||
190 | usage: | ||
191 | |||
192 | struct cdrom_tocentry entry; | ||
193 | ioctl(fd, CDROMREADTOCENTRY, &entry); | ||
194 | |||
195 | inputs: | ||
196 | cdrom_tocentry structure | ||
197 | |||
198 | outputs: | ||
199 | cdrom_tocentry structure | ||
200 | |||
201 | error return: | ||
202 | ENOSYS cd drive not audio-capable. | ||
203 | EINVAL entry.cdte_format not CDROM_MSF or CDROM_LBA | ||
204 | EINVAL requested track out of bounds | ||
205 | EIO I/O error reading TOC | ||
206 | |||
207 | notes: | ||
208 | TOC stands for Table Of Contents | ||
209 | MSF stands for minutes-seconds-frames | ||
210 | LBA stands for logical block address | ||
211 | |||
212 | |||
213 | |||
214 | CDROMSTOP Stop the cdrom drive | ||
215 | |||
216 | usage: | ||
217 | |||
218 | ioctl(fd, CDROMSTOP, 0); | ||
219 | |||
220 | inputs: none | ||
221 | |||
222 | outputs: none | ||
223 | |||
224 | error return: | ||
225 | ENOSYS cd drive not audio-capable. | ||
226 | |||
227 | notes: | ||
228 | Exact interpretation of this ioctl depends on the device, | ||
229 | but most seem to spin the drive down. | ||
230 | |||
231 | |||
232 | CDROMSTART Start the cdrom drive | ||
233 | |||
234 | usage: | ||
235 | |||
236 | ioctl(fd, CDROMSTART, 0); | ||
237 | |||
238 | inputs: none | ||
239 | |||
240 | outputs: none | ||
241 | |||
242 | error return: | ||
243 | ENOSYS cd drive not audio-capable. | ||
244 | |||
245 | notes: | ||
246 | Exact interpretation of this ioctl depends on the device, | ||
247 | but most seem to spin the drive up and/or close the tray. | ||
248 | Other devices ignore the ioctl completely. | ||
249 | |||
250 | |||
251 | CDROMEJECT Ejects the cdrom media | ||
252 | |||
253 | usage: | ||
254 | |||
255 | ioctl(fd, CDROMEJECT, 0); | ||
256 | |||
257 | inputs: none | ||
258 | |||
259 | outputs: none | ||
260 | |||
261 | error returns: | ||
262 | ENOSYS cd drive not capable of ejecting | ||
263 | EBUSY other processes are accessing drive, or door is locked | ||
264 | |||
265 | notes: | ||
266 | See CDROM_LOCKDOOR, below. | ||
267 | |||
268 | |||
269 | |||
270 | CDROMCLOSETRAY pendant of CDROMEJECT | ||
271 | |||
272 | usage: | ||
273 | |||
274 | ioctl(fd, CDROMEJECT, 0); | ||
275 | |||
276 | inputs: none | ||
277 | |||
278 | outputs: none | ||
279 | |||
280 | error returns: | ||
281 | ENOSYS cd drive not capable of ejecting | ||
282 | EBUSY other processes are accessing drive, or door is locked | ||
283 | |||
284 | notes: | ||
285 | See CDROM_LOCKDOOR, below. | ||
286 | |||
287 | |||
288 | |||
289 | CDROMVOLCTRL Control output volume (struct cdrom_volctrl) | ||
290 | |||
291 | usage: | ||
292 | |||
293 | struct cdrom_volctrl volume; | ||
294 | ioctl(fd, CDROMVOLCTRL, &volume); | ||
295 | |||
296 | inputs: | ||
297 | cdrom_volctrl structure containing volumes for up to 4 | ||
298 | channels. | ||
299 | |||
300 | outputs: none | ||
301 | |||
302 | error return: | ||
303 | ENOSYS cd drive not audio-capable. | ||
304 | |||
305 | |||
306 | |||
307 | CDROMVOLREAD Get the drive's volume setting | ||
308 | (struct cdrom_volctrl) | ||
309 | |||
310 | usage: | ||
311 | |||
312 | struct cdrom_volctrl volume; | ||
313 | ioctl(fd, CDROMVOLREAD, &volume); | ||
314 | |||
315 | inputs: none | ||
316 | |||
317 | outputs: | ||
318 | The current volume settings. | ||
319 | |||
320 | error return: | ||
321 | ENOSYS cd drive not audio-capable. | ||
322 | |||
323 | |||
324 | |||
325 | CDROMSUBCHNL Read subchannel data (struct cdrom_subchnl) | ||
326 | |||
327 | usage: | ||
328 | |||
329 | struct cdrom_subchnl q; | ||
330 | ioctl(fd, CDROMSUBCHNL, &q); | ||
331 | |||
332 | inputs: | ||
333 | cdrom_subchnl structure | ||
334 | |||
335 | outputs: | ||
336 | cdrom_subchnl structure | ||
337 | |||
338 | error return: | ||
339 | ENOSYS cd drive not audio-capable. | ||
340 | EINVAL format not CDROM_MSF or CDROM_LBA | ||
341 | |||
342 | notes: | ||
343 | Format is converted to CDROM_MSF on return | ||
344 | |||
345 | |||
346 | |||
347 | CDROMREADRAW read data in raw mode (2352 Bytes) | ||
348 | (struct cdrom_read) | ||
349 | |||
350 | usage: | ||
351 | |||
352 | union { | ||
353 | struct cdrom_msf msf; /* input */ | ||
354 | char buffer[CD_FRAMESIZE_RAW]; /* return */ | ||
355 | } arg; | ||
356 | ioctl(fd, CDROMREADRAW, &arg); | ||
357 | |||
358 | inputs: | ||
359 | cdrom_msf structure indicating an address to read. | ||
360 | Only the start values are significant. | ||
361 | |||
362 | outputs: | ||
363 | Data written to address provided by user. | ||
364 | |||
365 | error return: | ||
366 | EINVAL address less than 0, or msf less than 0:2:0 | ||
367 | ENOMEM out of memory | ||
368 | |||
369 | notes: | ||
370 | As of 2.6.8.1, comments in <linux/cdrom.h> indicate that this | ||
371 | ioctl accepts a cdrom_read structure, but actual source code | ||
372 | reads a cdrom_msf structure and writes a buffer of data to | ||
373 | the same address. | ||
374 | |||
375 | MSF values are converted to LBA values via this formula: | ||
376 | |||
377 | lba = (((m * CD_SECS) + s) * CD_FRAMES + f) - CD_MSF_OFFSET; | ||
378 | |||
379 | |||
380 | |||
381 | |||
382 | CDROMREADMODE1 Read CDROM mode 1 data (2048 Bytes) | ||
383 | (struct cdrom_read) | ||
384 | |||
385 | notes: | ||
386 | Identical to CDROMREADRAW except that block size is | ||
387 | CD_FRAMESIZE (2048) bytes | ||
388 | |||
389 | |||
390 | |||
391 | CDROMREADMODE2 Read CDROM mode 2 data (2336 Bytes) | ||
392 | (struct cdrom_read) | ||
393 | |||
394 | notes: | ||
395 | Identical to CDROMREADRAW except that block size is | ||
396 | CD_FRAMESIZE_RAW0 (2336) bytes | ||
397 | |||
398 | |||
399 | |||
400 | CDROMREADAUDIO (struct cdrom_read_audio) | ||
401 | |||
402 | usage: | ||
403 | |||
404 | struct cdrom_read_audio ra; | ||
405 | ioctl(fd, CDROMREADAUDIO, &ra); | ||
406 | |||
407 | inputs: | ||
408 | cdrom_read_audio structure containing read start | ||
409 | point and length | ||
410 | |||
411 | outputs: | ||
412 | audio data, returned to buffer indicated by ra | ||
413 | |||
414 | error return: | ||
415 | EINVAL format not CDROM_MSF or CDROM_LBA | ||
416 | EINVAL nframes not in range [1 75] | ||
417 | ENXIO drive has no queue (probably means invalid fd) | ||
418 | ENOMEM out of memory | ||
419 | |||
420 | |||
421 | CDROMEJECT_SW enable(1)/disable(0) auto-ejecting | ||
422 | |||
423 | usage: | ||
424 | |||
425 | int val; | ||
426 | ioctl(fd, CDROMEJECT_SW, val); | ||
427 | |||
428 | inputs: | ||
429 | Flag specifying auto-eject flag. | ||
430 | |||
431 | outputs: none | ||
432 | |||
433 | error return: | ||
434 | ENOSYS Drive is not capable of ejecting. | ||
435 | EBUSY Door is locked | ||
436 | |||
437 | |||
438 | |||
439 | |||
440 | CDROMMULTISESSION Obtain the start-of-last-session | ||
441 | address of multi session disks | ||
442 | (struct cdrom_multisession) | ||
443 | usage: | ||
444 | |||
445 | struct cdrom_multisession ms_info; | ||
446 | ioctl(fd, CDROMMULTISESSION, &ms_info); | ||
447 | |||
448 | inputs: | ||
449 | cdrom_multisession structure containing desired | ||
450 | format. | ||
451 | |||
452 | outputs: | ||
453 | cdrom_multisession structure is filled with last_session | ||
454 | information. | ||
455 | |||
456 | error return: | ||
457 | EINVAL format not CDROM_MSF or CDROM_LBA | ||
458 | |||
459 | |||
460 | CDROM_GET_MCN Obtain the "Universal Product Code" | ||
461 | if available (struct cdrom_mcn) | ||
462 | |||
463 | usage: | ||
464 | |||
465 | struct cdrom_mcn mcn; | ||
466 | ioctl(fd, CDROM_GET_MCN, &mcn); | ||
467 | |||
468 | inputs: none | ||
469 | |||
470 | outputs: | ||
471 | Universal Product Code | ||
472 | |||
473 | error return: | ||
474 | ENOSYS Drive is not capable of reading MCN data. | ||
475 | |||
476 | notes: | ||
477 | Source code comments state: | ||
478 | |||
479 | The following function is implemented, although very few | ||
480 | audio discs give Universal Product Code information, which | ||
481 | should just be the Medium Catalog Number on the box. Note, | ||
482 | that the way the code is written on the CD is /not/ uniform | ||
483 | across all discs! | ||
484 | |||
485 | |||
486 | |||
487 | |||
488 | CDROM_GET_UPC CDROM_GET_MCN (deprecated) | ||
489 | |||
490 | Not implemented, as of 2.6.8.1 | ||
491 | |||
492 | |||
493 | |||
494 | CDROMRESET hard-reset the drive | ||
495 | |||
496 | usage: | ||
497 | |||
498 | ioctl(fd, CDROMRESET, 0); | ||
499 | |||
500 | inputs: none | ||
501 | |||
502 | outputs: none | ||
503 | |||
504 | error return: | ||
505 | EACCES Access denied: requires CAP_SYS_ADMIN | ||
506 | ENOSYS Drive is not capable of resetting. | ||
507 | |||
508 | |||
509 | |||
510 | |||
511 | CDROMREADCOOKED read data in cooked mode | ||
512 | |||
513 | usage: | ||
514 | |||
515 | u8 buffer[CD_FRAMESIZE] | ||
516 | ioctl(fd, CDROMREADCOOKED, buffer); | ||
517 | |||
518 | inputs: none | ||
519 | |||
520 | outputs: | ||
521 | 2048 bytes of data, "cooked" mode. | ||
522 | |||
523 | notes: | ||
524 | Not implemented on all drives. | ||
525 | |||
526 | |||
527 | |||
528 | |||
529 | CDROMREADALL read all 2646 bytes | ||
530 | |||
531 | Same as CDROMREADCOOKED, but reads 2646 bytes. | ||
532 | |||
533 | |||
534 | |||
535 | CDROMSEEK seek msf address | ||
536 | |||
537 | usage: | ||
538 | |||
539 | struct cdrom_msf msf; | ||
540 | ioctl(fd, CDROMSEEK, &msf); | ||
541 | |||
542 | inputs: | ||
543 | MSF address to seek to. | ||
544 | |||
545 | outputs: none | ||
546 | |||
547 | |||
548 | |||
549 | CDROMPLAYBLK scsi-cd only, (struct cdrom_blk) | ||
550 | |||
551 | usage: | ||
552 | |||
553 | struct cdrom_blk blk; | ||
554 | ioctl(fd, CDROMPLAYBLK, &blk); | ||
555 | |||
556 | inputs: | ||
557 | Region to play | ||
558 | |||
559 | outputs: none | ||
560 | |||
561 | |||
562 | |||
563 | CDROMGETSPINDOWN | ||
564 | |||
565 | usage: | ||
566 | |||
567 | char spindown; | ||
568 | ioctl(fd, CDROMGETSPINDOWN, &spindown); | ||
569 | |||
570 | inputs: none | ||
571 | |||
572 | outputs: | ||
573 | The value of the current 4-bit spindown value. | ||
574 | |||
575 | |||
576 | |||
577 | |||
578 | CDROMSETSPINDOWN | ||
579 | |||
580 | usage: | ||
581 | |||
582 | char spindown | ||
583 | ioctl(fd, CDROMSETSPINDOWN, &spindown); | ||
584 | |||
585 | inputs: | ||
586 | 4-bit value used to control spindown (TODO: more detail here) | ||
587 | |||
588 | outputs: none | ||
589 | |||
590 | |||
591 | |||
592 | |||
593 | |||
594 | CDROM_SET_OPTIONS Set behavior options | ||
595 | |||
596 | usage: | ||
597 | |||
598 | int options; | ||
599 | ioctl(fd, CDROM_SET_OPTIONS, options); | ||
600 | |||
601 | inputs: | ||
602 | New values for drive options. The logical 'or' of: | ||
603 | CDO_AUTO_CLOSE close tray on first open(2) | ||
604 | CDO_AUTO_EJECT open tray on last release | ||
605 | CDO_USE_FFLAGS use O_NONBLOCK information on open | ||
606 | CDO_LOCK lock tray on open files | ||
607 | CDO_CHECK_TYPE check type on open for data | ||
608 | |||
609 | outputs: | ||
610 | Returns the resulting options settings in the | ||
611 | ioctl return value. Returns -1 on error. | ||
612 | |||
613 | error return: | ||
614 | ENOSYS selected option(s) not supported by drive. | ||
615 | |||
616 | |||
617 | |||
618 | |||
619 | CDROM_CLEAR_OPTIONS Clear behavior options | ||
620 | |||
621 | Same as CDROM_SET_OPTIONS, except that selected options are | ||
622 | turned off. | ||
623 | |||
624 | |||
625 | |||
626 | CDROM_SELECT_SPEED Set the CD-ROM speed | ||
627 | |||
628 | usage: | ||
629 | |||
630 | int speed; | ||
631 | ioctl(fd, CDROM_SELECT_SPEED, speed); | ||
632 | |||
633 | inputs: | ||
634 | New drive speed. | ||
635 | |||
636 | outputs: none | ||
637 | |||
638 | error return: | ||
639 | ENOSYS speed selection not supported by drive. | ||
640 | |||
641 | |||
642 | |||
643 | CDROM_SELECT_DISC Select disc (for juke-boxes) | ||
644 | |||
645 | usage: | ||
646 | |||
647 | int disk; | ||
648 | ioctl(fd, CDROM_SELECT_DISC, disk); | ||
649 | |||
650 | inputs: | ||
651 | Disk to load into drive. | ||
652 | |||
653 | outputs: none | ||
654 | |||
655 | error return: | ||
656 | EINVAL Disk number beyond capacity of drive | ||
657 | |||
658 | |||
659 | |||
660 | CDROM_MEDIA_CHANGED Check is media changed | ||
661 | |||
662 | usage: | ||
663 | |||
664 | int slot; | ||
665 | ioctl(fd, CDROM_MEDIA_CHANGED, slot); | ||
666 | |||
667 | inputs: | ||
668 | Slot number to be tested, always zero except for jukeboxes. | ||
669 | May also be special values CDSL_NONE or CDSL_CURRENT | ||
670 | |||
671 | outputs: | ||
672 | Ioctl return value is 0 or 1 depending on whether the media | ||
673 | has been changed, or -1 on error. | ||
674 | |||
675 | error returns: | ||
676 | ENOSYS Drive can't detect media change | ||
677 | EINVAL Slot number beyond capacity of drive | ||
678 | ENOMEM Out of memory | ||
679 | |||
680 | |||
681 | |||
682 | CDROM_DRIVE_STATUS Get tray position, etc. | ||
683 | |||
684 | usage: | ||
685 | |||
686 | int slot; | ||
687 | ioctl(fd, CDROM_DRIVE_STATUS, slot); | ||
688 | |||
689 | inputs: | ||
690 | Slot number to be tested, always zero except for jukeboxes. | ||
691 | May also be special values CDSL_NONE or CDSL_CURRENT | ||
692 | |||
693 | outputs: | ||
694 | Ioctl return value will be one of the following values | ||
695 | from <linux/cdrom.h>: | ||
696 | |||
697 | CDS_NO_INFO Information not available. | ||
698 | CDS_NO_DISC | ||
699 | CDS_TRAY_OPEN | ||
700 | CDS_DRIVE_NOT_READY | ||
701 | CDS_DISC_OK | ||
702 | -1 error | ||
703 | |||
704 | error returns: | ||
705 | ENOSYS Drive can't detect drive status | ||
706 | EINVAL Slot number beyond capacity of drive | ||
707 | ENOMEM Out of memory | ||
708 | |||
709 | |||
710 | |||
711 | |||
712 | CDROM_DISC_STATUS Get disc type, etc. | ||
713 | |||
714 | usage: | ||
715 | |||
716 | ioctl(fd, CDROM_DISC_STATUS, 0); | ||
717 | |||
718 | inputs: none | ||
719 | |||
720 | outputs: | ||
721 | Ioctl return value will be one of the following values | ||
722 | from <linux/cdrom.h>: | ||
723 | CDS_NO_INFO | ||
724 | CDS_AUDIO | ||
725 | CDS_MIXED | ||
726 | CDS_XA_2_2 | ||
727 | CDS_XA_2_1 | ||
728 | CDS_DATA_1 | ||
729 | |||
730 | error returns: none at present | ||
731 | |||
732 | notes: | ||
733 | Source code comments state: | ||
734 | |||
735 | Ok, this is where problems start. The current interface for | ||
736 | the CDROM_DISC_STATUS ioctl is flawed. It makes the false | ||
737 | assumption that CDs are all CDS_DATA_1 or all CDS_AUDIO, etc. | ||
738 | Unfortunatly, while this is often the case, it is also | ||
739 | very common for CDs to have some tracks with data, and some | ||
740 | tracks with audio. Just because I feel like it, I declare | ||
741 | the following to be the best way to cope. If the CD has | ||
742 | ANY data tracks on it, it will be returned as a data CD. | ||
743 | If it has any XA tracks, I will return it as that. Now I | ||
744 | could simplify this interface by combining these returns with | ||
745 | the above, but this more clearly demonstrates the problem | ||
746 | with the current interface. Too bad this wasn't designed | ||
747 | to use bitmasks... -Erik | ||
748 | |||
749 | Well, now we have the option CDS_MIXED: a mixed-type CD. | ||
750 | User level programmers might feel the ioctl is not very | ||
751 | useful. | ||
752 | ---david | ||
753 | |||
754 | |||
755 | |||
756 | |||
757 | CDROM_CHANGER_NSLOTS Get number of slots | ||
758 | |||
759 | usage: | ||
760 | |||
761 | ioctl(fd, CDROM_CHANGER_NSLOTS, 0); | ||
762 | |||
763 | inputs: none | ||
764 | |||
765 | outputs: | ||
766 | The ioctl return value will be the number of slots in a | ||
767 | CD changer. Typically 1 for non-multi-disk devices. | ||
768 | |||
769 | error returns: none | ||
770 | |||
771 | |||
772 | |||
773 | CDROM_LOCKDOOR lock or unlock door | ||
774 | |||
775 | usage: | ||
776 | |||
777 | int lock; | ||
778 | ioctl(fd, CDROM_LOCKDOOR, lock); | ||
779 | |||
780 | inputs: | ||
781 | Door lock flag, 1=lock, 0=unlock | ||
782 | |||
783 | outputs: none | ||
784 | |||
785 | error returns: | ||
786 | EDRIVE_CANT_DO_THIS Door lock function not supported. | ||
787 | EBUSY Attempt to unlock when multiple users | ||
788 | have the drive open and not CAP_SYS_ADMIN | ||
789 | |||
790 | notes: | ||
791 | As of 2.6.8.1, the lock flag is a global lock, meaning that | ||
792 | all CD drives will be locked or unlocked together. This is | ||
793 | probably a bug. | ||
794 | |||
795 | The EDRIVE_CANT_DO_THIS value is defined in <linux/cdrom.h> | ||
796 | and is currently (2.6.8.1) the same as EOPNOTSUPP | ||
797 | |||
798 | |||
799 | |||
800 | CDROM_DEBUG Turn debug messages on/off | ||
801 | |||
802 | usage: | ||
803 | |||
804 | int debug; | ||
805 | ioctl(fd, CDROM_DEBUG, debug); | ||
806 | |||
807 | inputs: | ||
808 | Cdrom debug flag, 0=disable, 1=enable | ||
809 | |||
810 | outputs: | ||
811 | The ioctl return value will be the new debug flag. | ||
812 | |||
813 | error return: | ||
814 | EACCES Access denied: requires CAP_SYS_ADMIN | ||
815 | |||
816 | |||
817 | |||
818 | CDROM_GET_CAPABILITY get capabilities | ||
819 | |||
820 | usage: | ||
821 | |||
822 | ioctl(fd, CDROM_GET_CAPABILITY, 0); | ||
823 | |||
824 | inputs: none | ||
825 | |||
826 | outputs: | ||
827 | The ioctl return value is the current device capability | ||
828 | flags. See CDC_CLOSE_TRAY, CDC_OPEN_TRAY, etc. | ||
829 | |||
830 | |||
831 | |||
832 | CDROMAUDIOBUFSIZ set the audio buffer size | ||
833 | |||
834 | usage: | ||
835 | |||
836 | int arg; | ||
837 | ioctl(fd, CDROMAUDIOBUFSIZ, val); | ||
838 | |||
839 | inputs: | ||
840 | New audio buffer size | ||
841 | |||
842 | outputs: | ||
843 | The ioctl return value is the new audio buffer size, or -1 | ||
844 | on error. | ||
845 | |||
846 | error return: | ||
847 | ENOSYS Not supported by this driver. | ||
848 | |||
849 | notes: | ||
850 | Not supported by all drivers. | ||
851 | |||
852 | |||
853 | |||
854 | DVD_READ_STRUCT Read structure | ||
855 | |||
856 | usage: | ||
857 | |||
858 | dvd_struct s; | ||
859 | ioctl(fd, DVD_READ_STRUCT, &s); | ||
860 | |||
861 | inputs: | ||
862 | dvd_struct structure, containing: | ||
863 | type specifies the information desired, one of | ||
864 | DVD_STRUCT_PHYSICAL, DVD_STRUCT_COPYRIGHT, | ||
865 | DVD_STRUCT_DISCKEY, DVD_STRUCT_BCA, | ||
866 | DVD_STRUCT_MANUFACT | ||
867 | physical.layer_num desired layer, indexed from 0 | ||
868 | copyright.layer_num desired layer, indexed from 0 | ||
869 | disckey.agid | ||
870 | |||
871 | outputs: | ||
872 | dvd_struct structure, containing: | ||
873 | physical for type == DVD_STRUCT_PHYSICAL | ||
874 | copyright for type == DVD_STRUCT_COPYRIGHT | ||
875 | disckey.value for type == DVD_STRUCT_DISCKEY | ||
876 | bca.{len,value} for type == DVD_STRUCT_BCA | ||
877 | manufact.{len,valu} for type == DVD_STRUCT_MANUFACT | ||
878 | |||
879 | error returns: | ||
880 | EINVAL physical.layer_num exceeds number of layers | ||
881 | EIO Recieved invalid response from drive | ||
882 | |||
883 | |||
884 | |||
885 | DVD_WRITE_STRUCT Write structure | ||
886 | |||
887 | Not implemented, as of 2.6.8.1 | ||
888 | |||
889 | |||
890 | |||
891 | DVD_AUTH Authentication | ||
892 | |||
893 | usage: | ||
894 | |||
895 | dvd_authinfo ai; | ||
896 | ioctl(fd, DVD_AUTH, &ai); | ||
897 | |||
898 | inputs: | ||
899 | dvd_authinfo structure. See <linux/cdrom.h> | ||
900 | |||
901 | outputs: | ||
902 | dvd_authinfo structure. | ||
903 | |||
904 | error return: | ||
905 | ENOTTY ai.type not recognized. | ||
906 | |||
907 | |||
908 | |||
909 | CDROM_SEND_PACKET send a packet to the drive | ||
910 | |||
911 | usage: | ||
912 | |||
913 | struct cdrom_generic_command cgc; | ||
914 | ioctl(fd, CDROM_SEND_PACKET, &cgc); | ||
915 | |||
916 | inputs: | ||
917 | cdrom_generic_command structure containing the packet to send. | ||
918 | |||
919 | outputs: none | ||
920 | cdrom_generic_command structure containing results. | ||
921 | |||
922 | error return: | ||
923 | EIO command failed. | ||
924 | EPERM Operation not permitted, either because a | ||
925 | write command was attempted on a drive which | ||
926 | is opened read-only, or because the command | ||
927 | requires CAP_SYS_RAWIO | ||
928 | EINVAL cgc.data_direction not set | ||
929 | |||
930 | |||
931 | |||
932 | CDROM_NEXT_WRITABLE get next writable block | ||
933 | |||
934 | usage: | ||
935 | |||
936 | long next; | ||
937 | ioctl(fd, CDROM_NEXT_WRITABLE, &next); | ||
938 | |||
939 | inputs: none | ||
940 | |||
941 | outputs: | ||
942 | The next writable block. | ||
943 | |||
944 | notes: | ||
945 | If the device does not support this ioctl directly, the | ||
946 | ioctl will return CDROM_LAST_WRITTEN + 7. | ||
947 | |||
948 | |||
949 | |||
950 | CDROM_LAST_WRITTEN get last block written on disc | ||
951 | |||
952 | usage: | ||
953 | |||
954 | long last; | ||
955 | ioctl(fd, CDROM_LAST_WRITTEN, &last); | ||
956 | |||
957 | inputs: none | ||
958 | |||
959 | outputs: | ||
960 | The last block written on disc | ||
961 | |||
962 | notes: | ||
963 | If the device does not support this ioctl directly, the | ||
964 | result is derived from the disc's table of contents. If the | ||
965 | table of contents can't be read, this ioctl returns an | ||
966 | error. | ||
diff --git a/Documentation/ioctl/hdio.txt b/Documentation/ioctl/hdio.txt new file mode 100644 index 000000000000..9a7aea0636a5 --- /dev/null +++ b/Documentation/ioctl/hdio.txt | |||
@@ -0,0 +1,1070 @@ | |||
1 | Summary of HDIO_ ioctl calls. | ||
2 | ============================ | ||
3 | |||
4 | Edward A. Falk <efalk@google.com> | ||
5 | |||
6 | November, 2004 | ||
7 | |||
8 | This document attempts to describe the ioctl(2) calls supported by | ||
9 | the HD/IDE layer. These are by-and-large implemented (as of Linux 2.6) | ||
10 | in drivers/ide/ide.c and drivers/block/scsi_ioctl.c | ||
11 | |||
12 | ioctl values are listed in <linux/hdreg.h>. As of this writing, they | ||
13 | are as follows: | ||
14 | |||
15 | ioctls that pass argument pointers to user space: | ||
16 | |||
17 | HDIO_GETGEO get device geometry | ||
18 | HDIO_GET_UNMASKINTR get current unmask setting | ||
19 | HDIO_GET_MULTCOUNT get current IDE blockmode setting | ||
20 | HDIO_GET_QDMA get use-qdma flag | ||
21 | HDIO_SET_XFER set transfer rate via proc | ||
22 | HDIO_OBSOLETE_IDENTITY OBSOLETE, DO NOT USE | ||
23 | HDIO_GET_KEEPSETTINGS get keep-settings-on-reset flag | ||
24 | HDIO_GET_32BIT get current io_32bit setting | ||
25 | HDIO_GET_NOWERR get ignore-write-error flag | ||
26 | HDIO_GET_DMA get use-dma flag | ||
27 | HDIO_GET_NICE get nice flags | ||
28 | HDIO_GET_IDENTITY get IDE identification info | ||
29 | HDIO_GET_WCACHE get write cache mode on|off | ||
30 | HDIO_GET_ACOUSTIC get acoustic value | ||
31 | HDIO_GET_ADDRESS get sector addressing mode | ||
32 | HDIO_GET_BUSSTATE get the bus state of the hwif | ||
33 | HDIO_TRISTATE_HWIF execute a channel tristate | ||
34 | HDIO_DRIVE_RESET execute a device reset | ||
35 | HDIO_DRIVE_TASKFILE execute raw taskfile | ||
36 | HDIO_DRIVE_TASK execute task and special drive command | ||
37 | HDIO_DRIVE_CMD execute a special drive command | ||
38 | HDIO_DRIVE_CMD_AEB HDIO_DRIVE_TASK | ||
39 | |||
40 | ioctls that pass non-pointer values: | ||
41 | |||
42 | HDIO_SET_MULTCOUNT change IDE blockmode | ||
43 | HDIO_SET_UNMASKINTR permit other irqs during I/O | ||
44 | HDIO_SET_KEEPSETTINGS keep ioctl settings on reset | ||
45 | HDIO_SET_32BIT change io_32bit flags | ||
46 | HDIO_SET_NOWERR change ignore-write-error flag | ||
47 | HDIO_SET_DMA change use-dma flag | ||
48 | HDIO_SET_PIO_MODE reconfig interface to new speed | ||
49 | HDIO_SCAN_HWIF register and (re)scan interface | ||
50 | HDIO_SET_NICE set nice flags | ||
51 | HDIO_UNREGISTER_HWIF unregister interface | ||
52 | HDIO_SET_WCACHE change write cache enable-disable | ||
53 | HDIO_SET_ACOUSTIC change acoustic behavior | ||
54 | HDIO_SET_BUSSTATE set the bus state of the hwif | ||
55 | HDIO_SET_QDMA change use-qdma flag | ||
56 | HDIO_SET_ADDRESS change lba addressing modes | ||
57 | |||
58 | HDIO_SET_IDE_SCSI Set scsi emulation mode on/off | ||
59 | HDIO_SET_SCSI_IDE not implemented yet | ||
60 | |||
61 | |||
62 | The information that follows was determined from reading kernel source | ||
63 | code. It is likely that some corrections will be made over time. | ||
64 | |||
65 | |||
66 | |||
67 | |||
68 | |||
69 | |||
70 | |||
71 | General: | ||
72 | |||
73 | Unless otherwise specified, all ioctl calls return 0 on success | ||
74 | and -1 with errno set to an appropriate value on error. | ||
75 | |||
76 | Unless otherwise specified, all ioctl calls return -1 and set | ||
77 | errno to EFAULT on a failed attempt to copy data to or from user | ||
78 | address space. | ||
79 | |||
80 | Unless otherwise specified, all data structures and constants | ||
81 | are defined in <linux/hdreg.h> | ||
82 | |||
83 | |||
84 | |||
85 | HDIO_GETGEO get device geometry | ||
86 | |||
87 | usage: | ||
88 | |||
89 | struct hd_geometry geom; | ||
90 | ioctl(fd, HDIO_GETGEO, &geom); | ||
91 | |||
92 | |||
93 | inputs: none | ||
94 | |||
95 | outputs: | ||
96 | |||
97 | hd_geometry structure containing: | ||
98 | |||
99 | heads number of heads | ||
100 | sectors number of sectors/track | ||
101 | cylinders number of cylinders, mod 65536 | ||
102 | start starting sector of this partition. | ||
103 | |||
104 | |||
105 | error returns: | ||
106 | EINVAL if the device is not a disk drive or floppy drive, | ||
107 | or if the user passes a null pointer | ||
108 | |||
109 | |||
110 | notes: | ||
111 | |||
112 | Not particularly useful with modern disk drives, whose geometry | ||
113 | is a polite fiction anyway. Modern drives are addressed | ||
114 | purely by sector number nowadays (lba addressing), and the | ||
115 | drive geometry is an abstraction which is actually subject | ||
116 | to change. Currently (as of Nov 2004), the geometry values | ||
117 | are the "bios" values -- presumably the values the drive had | ||
118 | when Linux first booted. | ||
119 | |||
120 | In addition, the cylinders field of the hd_geometry is an | ||
121 | unsigned short, meaning that on most architectures, this | ||
122 | ioctl will not return a meaningful value on drives with more | ||
123 | than 65535 tracks. | ||
124 | |||
125 | The start field is unsigned long, meaning that it will not | ||
126 | contain a meaningful value for disks over 219 Gb in size. | ||
127 | |||
128 | |||
129 | |||
130 | |||
131 | HDIO_GET_UNMASKINTR get current unmask setting | ||
132 | |||
133 | usage: | ||
134 | |||
135 | long val; | ||
136 | ioctl(fd, HDIO_GET_UNMASKINTR, &val); | ||
137 | |||
138 | inputs: none | ||
139 | |||
140 | outputs: | ||
141 | The value of the drive's current unmask setting | ||
142 | |||
143 | |||
144 | |||
145 | HDIO_SET_UNMASKINTR permit other irqs during I/O | ||
146 | |||
147 | usage: | ||
148 | |||
149 | unsigned long val; | ||
150 | ioctl(fd, HDIO_SET_UNMASKINTR, val); | ||
151 | |||
152 | inputs: | ||
153 | New value for unmask flag | ||
154 | |||
155 | outputs: none | ||
156 | |||
157 | error return: | ||
158 | EINVAL (bdev != bdev->bd_contains) (not sure what this means) | ||
159 | EACCES Access denied: requires CAP_SYS_ADMIN | ||
160 | EINVAL value out of range [0 1] | ||
161 | EBUSY Controller busy | ||
162 | |||
163 | |||
164 | |||
165 | |||
166 | HDIO_GET_MULTCOUNT get current IDE blockmode setting | ||
167 | |||
168 | usage: | ||
169 | |||
170 | long val; | ||
171 | ioctl(fd, HDIO_GET_MULTCOUNT, &val); | ||
172 | |||
173 | inputs: none | ||
174 | |||
175 | outputs: | ||
176 | The value of the current IDE block mode setting. This | ||
177 | controls how many sectors the drive will transfer per | ||
178 | interrupt. | ||
179 | |||
180 | |||
181 | |||
182 | HDIO_SET_MULTCOUNT change IDE blockmode | ||
183 | |||
184 | usage: | ||
185 | |||
186 | int val; | ||
187 | ioctl(fd, HDIO_SET_MULTCOUNT, val); | ||
188 | |||
189 | inputs: | ||
190 | New value for IDE block mode setting. This controls how many | ||
191 | sectors the drive will transfer per interrupt. | ||
192 | |||
193 | outputs: none | ||
194 | |||
195 | error return: | ||
196 | EINVAL (bdev != bdev->bd_contains) (not sure what this means) | ||
197 | EACCES Access denied: requires CAP_SYS_ADMIN | ||
198 | EINVAL value out of range supported by disk. | ||
199 | EBUSY Controller busy or blockmode already set. | ||
200 | EIO Drive did not accept new block mode. | ||
201 | |||
202 | notes: | ||
203 | |||
204 | Source code comments read: | ||
205 | |||
206 | This is tightly woven into the driver->do_special can not | ||
207 | touch. DON'T do it again until a total personality rewrite | ||
208 | is committed. | ||
209 | |||
210 | If blockmode has already been set, this ioctl will fail with | ||
211 | EBUSY | ||
212 | |||
213 | |||
214 | |||
215 | HDIO_GET_QDMA get use-qdma flag | ||
216 | |||
217 | Not implemented, as of 2.6.8.1 | ||
218 | |||
219 | |||
220 | |||
221 | HDIO_SET_XFER set transfer rate via proc | ||
222 | |||
223 | Not implemented, as of 2.6.8.1 | ||
224 | |||
225 | |||
226 | |||
227 | HDIO_OBSOLETE_IDENTITY OBSOLETE, DO NOT USE | ||
228 | |||
229 | Same as HDIO_GET_IDENTITY (see below), except that it only | ||
230 | returns the first 142 bytes of drive identity information. | ||
231 | |||
232 | |||
233 | |||
234 | HDIO_GET_IDENTITY get IDE identification info | ||
235 | |||
236 | usage: | ||
237 | |||
238 | unsigned char identity[512]; | ||
239 | ioctl(fd, HDIO_GET_IDENTITY, identity); | ||
240 | |||
241 | inputs: none | ||
242 | |||
243 | outputs: | ||
244 | |||
245 | ATA drive identity information. For full description, see | ||
246 | the IDENTIFY DEVICE and IDENTIFY PACKET DEVICE commands in | ||
247 | the ATA specification. | ||
248 | |||
249 | error returns: | ||
250 | EINVAL (bdev != bdev->bd_contains) (not sure what this means) | ||
251 | ENOMSG IDENTIFY DEVICE information not available | ||
252 | |||
253 | notes: | ||
254 | |||
255 | Returns information that was obtained when the drive was | ||
256 | probed. Some of this information is subject to change, and | ||
257 | this ioctl does not re-probe the drive to update the | ||
258 | information. | ||
259 | |||
260 | This information is also available from /proc/ide/hdX/identify | ||
261 | |||
262 | |||
263 | |||
264 | HDIO_GET_KEEPSETTINGS get keep-settings-on-reset flag | ||
265 | |||
266 | usage: | ||
267 | |||
268 | long val; | ||
269 | ioctl(fd, HDIO_GET_KEEPSETTINGS, &val); | ||
270 | |||
271 | inputs: none | ||
272 | |||
273 | outputs: | ||
274 | The value of the current "keep settings" flag | ||
275 | |||
276 | notes: | ||
277 | |||
278 | When set, indicates that kernel should restore settings | ||
279 | after a drive reset. | ||
280 | |||
281 | |||
282 | |||
283 | HDIO_SET_KEEPSETTINGS keep ioctl settings on reset | ||
284 | |||
285 | usage: | ||
286 | |||
287 | long val; | ||
288 | ioctl(fd, HDIO_SET_KEEPSETTINGS, val); | ||
289 | |||
290 | inputs: | ||
291 | New value for keep_settings flag | ||
292 | |||
293 | outputs: none | ||
294 | |||
295 | error return: | ||
296 | EINVAL (bdev != bdev->bd_contains) (not sure what this means) | ||
297 | EACCES Access denied: requires CAP_SYS_ADMIN | ||
298 | EINVAL value out of range [0 1] | ||
299 | EBUSY Controller busy | ||
300 | |||
301 | |||
302 | |||
303 | HDIO_GET_32BIT get current io_32bit setting | ||
304 | |||
305 | usage: | ||
306 | |||
307 | long val; | ||
308 | ioctl(fd, HDIO_GET_32BIT, &val); | ||
309 | |||
310 | inputs: none | ||
311 | |||
312 | outputs: | ||
313 | The value of the current io_32bit setting | ||
314 | |||
315 | notes: | ||
316 | |||
317 | 0=16-bit, 1=32-bit, 2,3 = 32bit+sync | ||
318 | |||
319 | |||
320 | |||
321 | HDIO_GET_NOWERR get ignore-write-error flag | ||
322 | |||
323 | usage: | ||
324 | |||
325 | long val; | ||
326 | ioctl(fd, HDIO_GET_NOWERR, &val); | ||
327 | |||
328 | inputs: none | ||
329 | |||
330 | outputs: | ||
331 | The value of the current ignore-write-error flag | ||
332 | |||
333 | |||
334 | |||
335 | HDIO_GET_DMA get use-dma flag | ||
336 | |||
337 | usage: | ||
338 | |||
339 | long val; | ||
340 | ioctl(fd, HDIO_GET_DMA, &val); | ||
341 | |||
342 | inputs: none | ||
343 | |||
344 | outputs: | ||
345 | The value of the current use-dma flag | ||
346 | |||
347 | |||
348 | |||
349 | HDIO_GET_NICE get nice flags | ||
350 | |||
351 | usage: | ||
352 | |||
353 | long nice; | ||
354 | ioctl(fd, HDIO_GET_NICE, &nice); | ||
355 | |||
356 | inputs: none | ||
357 | |||
358 | outputs: | ||
359 | |||
360 | The drive's "nice" values. | ||
361 | |||
362 | notes: | ||
363 | |||
364 | Per-drive flags which determine when the system will give more | ||
365 | bandwidth to other devices sharing the same IDE bus. | ||
366 | See <linux/hdreg.h>, near symbol IDE_NICE_DSC_OVERLAP. | ||
367 | |||
368 | |||
369 | |||
370 | |||
371 | HDIO_SET_NICE set nice flags | ||
372 | |||
373 | usage: | ||
374 | |||
375 | unsigned long nice; | ||
376 | ... | ||
377 | ioctl(fd, HDIO_SET_NICE, nice); | ||
378 | |||
379 | inputs: | ||
380 | bitmask of nice flags. | ||
381 | |||
382 | outputs: none | ||
383 | |||
384 | error returns: | ||
385 | EACCES Access denied: requires CAP_SYS_ADMIN | ||
386 | EPERM Flags other than DSC_OVERLAP and NICE_1 set. | ||
387 | EPERM DSC_OVERLAP specified but not supported by drive | ||
388 | |||
389 | notes: | ||
390 | |||
391 | This ioctl sets the DSC_OVERLAP and NICE_1 flags from values | ||
392 | provided by the user. | ||
393 | |||
394 | Nice flags are listed in <linux/hdreg.h>, starting with | ||
395 | IDE_NICE_DSC_OVERLAP. These values represent shifts. | ||
396 | |||
397 | |||
398 | |||
399 | |||
400 | |||
401 | HDIO_GET_WCACHE get write cache mode on|off | ||
402 | |||
403 | usage: | ||
404 | |||
405 | long val; | ||
406 | ioctl(fd, HDIO_GET_WCACHE, &val); | ||
407 | |||
408 | inputs: none | ||
409 | |||
410 | outputs: | ||
411 | The value of the current write cache mode | ||
412 | |||
413 | |||
414 | |||
415 | HDIO_GET_ACOUSTIC get acoustic value | ||
416 | |||
417 | usage: | ||
418 | |||
419 | long val; | ||
420 | ioctl(fd, HDIO_GET_ACOUSTIC, &val); | ||
421 | |||
422 | inputs: none | ||
423 | |||
424 | outputs: | ||
425 | The value of the current acoustic settings | ||
426 | |||
427 | notes: | ||
428 | |||
429 | See HDIO_SET_ACOUSTIC | ||
430 | |||
431 | |||
432 | |||
433 | HDIO_GET_ADDRESS | ||
434 | |||
435 | usage: | ||
436 | |||
437 | long val; | ||
438 | ioctl(fd, HDIO_GET_ADDRESS, &val); | ||
439 | |||
440 | inputs: none | ||
441 | |||
442 | outputs: | ||
443 | The value of the current addressing mode: | ||
444 | 0 = 28-bit | ||
445 | 1 = 48-bit | ||
446 | 2 = 48-bit doing 28-bit | ||
447 | 3 = 64-bit | ||
448 | |||
449 | |||
450 | |||
451 | HDIO_GET_BUSSTATE get the bus state of the hwif | ||
452 | |||
453 | usage: | ||
454 | |||
455 | long state; | ||
456 | ioctl(fd, HDIO_SCAN_HWIF, &state); | ||
457 | |||
458 | inputs: none | ||
459 | |||
460 | outputs: | ||
461 | Current power state of the IDE bus. One of BUSSTATE_OFF, | ||
462 | BUSSTATE_ON, or BUSSTATE_TRISTATE | ||
463 | |||
464 | error returns: | ||
465 | EACCES Access denied: requires CAP_SYS_ADMIN | ||
466 | |||
467 | |||
468 | |||
469 | |||
470 | HDIO_SET_BUSSTATE set the bus state of the hwif | ||
471 | |||
472 | usage: | ||
473 | |||
474 | int state; | ||
475 | ... | ||
476 | ioctl(fd, HDIO_SCAN_HWIF, state); | ||
477 | |||
478 | inputs: | ||
479 | Desired IDE power state. One of BUSSTATE_OFF, BUSSTATE_ON, | ||
480 | or BUSSTATE_TRISTATE | ||
481 | |||
482 | outputs: none | ||
483 | |||
484 | error returns: | ||
485 | EACCES Access denied: requires CAP_SYS_RAWIO | ||
486 | EOPNOTSUPP Hardware interface does not support bus power control | ||
487 | |||
488 | |||
489 | |||
490 | |||
491 | HDIO_TRISTATE_HWIF execute a channel tristate | ||
492 | |||
493 | Not implemented, as of 2.6.8.1. See HDIO_SET_BUSSTATE | ||
494 | |||
495 | |||
496 | |||
497 | HDIO_DRIVE_RESET execute a device reset | ||
498 | |||
499 | usage: | ||
500 | |||
501 | int args[3] | ||
502 | ... | ||
503 | ioctl(fd, HDIO_DRIVE_RESET, args); | ||
504 | |||
505 | inputs: none | ||
506 | |||
507 | outputs: none | ||
508 | |||
509 | error returns: | ||
510 | EACCES Access denied: requires CAP_SYS_ADMIN | ||
511 | |||
512 | notes: | ||
513 | |||
514 | Abort any current command, prevent anything else from being | ||
515 | queued, execute a reset on the device, and issue BLKRRPART | ||
516 | ioctl on the block device. | ||
517 | |||
518 | Executes an ATAPI soft reset if applicable, otherwise | ||
519 | executes an ATA soft reset on the controller. | ||
520 | |||
521 | |||
522 | |||
523 | HDIO_DRIVE_TASKFILE execute raw taskfile | ||
524 | |||
525 | Note: If you don't have a copy of the ANSI ATA specification | ||
526 | handy, you should probably ignore this ioctl. | ||
527 | |||
528 | Execute an ATA disk command directly by writing the "taskfile" | ||
529 | registers of the drive. Requires ADMIN and RAWIO access | ||
530 | privileges. | ||
531 | |||
532 | usage: | ||
533 | |||
534 | struct { | ||
535 | ide_task_request_t req_task; | ||
536 | u8 outbuf[OUTPUT_SIZE]; | ||
537 | u8 inbuf[INPUT_SIZE]; | ||
538 | } task; | ||
539 | memset(&task.req_task, 0, sizeof(task.req_task)); | ||
540 | task.req_task.out_size = sizeof(task.outbuf); | ||
541 | task.req_task.in_size = sizeof(task.inbuf); | ||
542 | ... | ||
543 | ioctl(fd, HDIO_DRIVE_TASKFILE, &task); | ||
544 | ... | ||
545 | |||
546 | inputs: | ||
547 | |||
548 | (See below for details on memory area passed to ioctl.) | ||
549 | |||
550 | io_ports[8] values to be written to taskfile registers | ||
551 | hob_ports[8] high-order bytes, for extended commands. | ||
552 | out_flags flags indicating which registers are valid | ||
553 | in_flags flags indicating which registers should be returned | ||
554 | data_phase see below | ||
555 | req_cmd command type to be executed | ||
556 | out_size size of output buffer | ||
557 | outbuf buffer of data to be transmitted to disk | ||
558 | inbuf buffer of data to be received from disk (see [1]) | ||
559 | |||
560 | outputs: | ||
561 | |||
562 | io_ports[] values returned in the taskfile registers | ||
563 | hob_ports[] high-order bytes, for extended commands. | ||
564 | out_flags flags indicating which registers are valid (see [2]) | ||
565 | in_flags flags indicating which registers should be returned | ||
566 | outbuf buffer of data to be transmitted to disk (see [1]) | ||
567 | inbuf buffer of data to be received from disk | ||
568 | |||
569 | error returns: | ||
570 | EACCES CAP_SYS_ADMIN or CAP_SYS_RAWIO privilege not set. | ||
571 | ENOMSG Device is not a disk drive. | ||
572 | ENOMEM Unable to allocate memory for task | ||
573 | EFAULT req_cmd == TASKFILE_IN_OUT (not implemented as of 2.6.8) | ||
574 | EPERM req_cmd == TASKFILE_MULTI_OUT and drive | ||
575 | multi-count not yet set. | ||
576 | EIO Drive failed the command. | ||
577 | |||
578 | notes: | ||
579 | |||
580 | [1] READ THE FOLLOWING NOTES *CAREFULLY*. THIS IOCTL IS | ||
581 | FULL OF GOTCHAS. Extreme caution should be used with using | ||
582 | this ioctl. A mistake can easily corrupt data or hang the | ||
583 | system. | ||
584 | |||
585 | [2] Both the input and output buffers are copied from the | ||
586 | user and written back to the user, even when not used. | ||
587 | |||
588 | [3] If one or more bits are set in out_flags and in_flags is | ||
589 | zero, the following values are used for in_flags.all and | ||
590 | written back into in_flags on completion. | ||
591 | |||
592 | * IDE_TASKFILE_STD_IN_FLAGS | (IDE_HOB_STD_IN_FLAGS << 8) | ||
593 | if LBA48 addressing is enabled for the drive | ||
594 | * IDE_TASKFILE_STD_IN_FLAGS | ||
595 | if CHS/LBA28 | ||
596 | |||
597 | The association between in_flags.all and each enable | ||
598 | bitfield flips depending on endianess; fortunately, TASKFILE | ||
599 | only uses inflags.b.data bit and ignores all other bits. | ||
600 | The end result is that, on any endian machines, it has no | ||
601 | effect other than modifying in_flags on completion. | ||
602 | |||
603 | [4] The default value of SELECT is (0xa0|DEV_bit|LBA_bit) | ||
604 | except for four drives per port chipsets. For four drives | ||
605 | per port chipsets, it's (0xa0|DEV_bit|LBA_bit) for the first | ||
606 | pair and (0x80|DEV_bit|LBA_bit) for the second pair. | ||
607 | |||
608 | [5] The argument to the ioctl is a pointer to a region of | ||
609 | memory containing a ide_task_request_t structure, followed | ||
610 | by an optional buffer of data to be transmitted to the | ||
611 | drive, followed by an optional buffer to receive data from | ||
612 | the drive. | ||
613 | |||
614 | Command is passed to the disk drive via the ide_task_request_t | ||
615 | structure, which contains these fields: | ||
616 | |||
617 | io_ports[8] values for the taskfile registers | ||
618 | hob_ports[8] high-order bytes, for extended commands | ||
619 | out_flags flags indicating which entries in the | ||
620 | io_ports[] and hob_ports[] arrays | ||
621 | contain valid values. Type ide_reg_valid_t. | ||
622 | in_flags flags indicating which entries in the | ||
623 | io_ports[] and hob_ports[] arrays | ||
624 | are expected to contain valid values | ||
625 | on return. | ||
626 | data_phase See below | ||
627 | req_cmd Command type, see below | ||
628 | out_size output (user->drive) buffer size, bytes | ||
629 | in_size input (drive->user) buffer size, bytes | ||
630 | |||
631 | When out_flags is zero, the following registers are loaded. | ||
632 | |||
633 | HOB_FEATURE If the drive supports LBA48 | ||
634 | HOB_NSECTOR If the drive supports LBA48 | ||
635 | HOB_SECTOR If the drive supports LBA48 | ||
636 | HOB_LCYL If the drive supports LBA48 | ||
637 | HOB_HCYL If the drive supports LBA48 | ||
638 | FEATURE | ||
639 | NSECTOR | ||
640 | SECTOR | ||
641 | LCYL | ||
642 | HCYL | ||
643 | SELECT First, masked with 0xE0 if LBA48, 0xEF | ||
644 | otherwise; then, or'ed with the default | ||
645 | value of SELECT. | ||
646 | |||
647 | If any bit in out_flags is set, the following registers are loaded. | ||
648 | |||
649 | HOB_DATA If out_flags.b.data is set. HOB_DATA will | ||
650 | travel on DD8-DD15 on little endian machines | ||
651 | and on DD0-DD7 on big endian machines. | ||
652 | DATA If out_flags.b.data is set. DATA will | ||
653 | travel on DD0-DD7 on little endian machines | ||
654 | and on DD8-DD15 on big endian machines. | ||
655 | HOB_NSECTOR If out_flags.b.nsector_hob is set | ||
656 | HOB_SECTOR If out_flags.b.sector_hob is set | ||
657 | HOB_LCYL If out_flags.b.lcyl_hob is set | ||
658 | HOB_HCYL If out_flags.b.hcyl_hob is set | ||
659 | FEATURE If out_flags.b.feature is set | ||
660 | NSECTOR If out_flags.b.nsector is set | ||
661 | SECTOR If out_flags.b.sector is set | ||
662 | LCYL If out_flags.b.lcyl is set | ||
663 | HCYL If out_flags.b.hcyl is set | ||
664 | SELECT Or'ed with the default value of SELECT and | ||
665 | loaded regardless of out_flags.b.select. | ||
666 | |||
667 | Taskfile registers are read back from the drive into | ||
668 | {io|hob}_ports[] after the command completes iff one of the | ||
669 | following conditions is met; otherwise, the original values | ||
670 | will be written back, unchanged. | ||
671 | |||
672 | 1. The drive fails the command (EIO). | ||
673 | 2. One or more than one bits are set in out_flags. | ||
674 | 3. The requested data_phase is TASKFILE_NO_DATA. | ||
675 | |||
676 | HOB_DATA If in_flags.b.data is set. It will contain | ||
677 | DD8-DD15 on little endian machines and | ||
678 | DD0-DD7 on big endian machines. | ||
679 | DATA If in_flags.b.data is set. It will contain | ||
680 | DD0-DD7 on little endian machines and | ||
681 | DD8-DD15 on big endian machines. | ||
682 | HOB_FEATURE If the drive supports LBA48 | ||
683 | HOB_NSECTOR If the drive supports LBA48 | ||
684 | HOB_SECTOR If the drive supports LBA48 | ||
685 | HOB_LCYL If the drive supports LBA48 | ||
686 | HOB_HCYL If the drive supports LBA48 | ||
687 | NSECTOR | ||
688 | SECTOR | ||
689 | LCYL | ||
690 | HCYL | ||
691 | |||
692 | The data_phase field describes the data transfer to be | ||
693 | performed. Value is one of: | ||
694 | |||
695 | TASKFILE_IN | ||
696 | TASKFILE_MULTI_IN | ||
697 | TASKFILE_OUT | ||
698 | TASKFILE_MULTI_OUT | ||
699 | TASKFILE_IN_OUT | ||
700 | TASKFILE_IN_DMA | ||
701 | TASKFILE_IN_DMAQ == IN_DMA (queueing not supported) | ||
702 | TASKFILE_OUT_DMA | ||
703 | TASKFILE_OUT_DMAQ == OUT_DMA (queueing not supported) | ||
704 | TASKFILE_P_IN unimplemented | ||
705 | TASKFILE_P_IN_DMA unimplemented | ||
706 | TASKFILE_P_IN_DMAQ unimplemented | ||
707 | TASKFILE_P_OUT unimplemented | ||
708 | TASKFILE_P_OUT_DMA unimplemented | ||
709 | TASKFILE_P_OUT_DMAQ unimplemented | ||
710 | |||
711 | The req_cmd field classifies the command type. It may be | ||
712 | one of: | ||
713 | |||
714 | IDE_DRIVE_TASK_NO_DATA | ||
715 | IDE_DRIVE_TASK_SET_XFER unimplemented | ||
716 | IDE_DRIVE_TASK_IN | ||
717 | IDE_DRIVE_TASK_OUT unimplemented | ||
718 | IDE_DRIVE_TASK_RAW_WRITE | ||
719 | |||
720 | [6] Do not access {in|out}_flags->all except for resetting | ||
721 | all the bits. Always access individual bit fields. ->all | ||
722 | value will flip depending on endianess. For the same | ||
723 | reason, do not use IDE_{TASKFILE|HOB}_STD_{OUT|IN}_FLAGS | ||
724 | constants defined in hdreg.h. | ||
725 | |||
726 | |||
727 | |||
728 | HDIO_DRIVE_CMD execute a special drive command | ||
729 | |||
730 | Note: If you don't have a copy of the ANSI ATA specification | ||
731 | handy, you should probably ignore this ioctl. | ||
732 | |||
733 | usage: | ||
734 | |||
735 | u8 args[4+XFER_SIZE]; | ||
736 | ... | ||
737 | ioctl(fd, HDIO_DRIVE_CMD, args); | ||
738 | |||
739 | inputs: | ||
740 | |||
741 | Commands other than WIN_SMART | ||
742 | args[0] COMMAND | ||
743 | args[1] NSECTOR | ||
744 | args[2] FEATURE | ||
745 | args[3] NSECTOR | ||
746 | |||
747 | WIN_SMART | ||
748 | args[0] COMMAND | ||
749 | args[1] SECTOR | ||
750 | args[2] FEATURE | ||
751 | args[3] NSECTOR | ||
752 | |||
753 | outputs: | ||
754 | |||
755 | args[] buffer is filled with register values followed by any | ||
756 | data returned by the disk. | ||
757 | args[0] status | ||
758 | args[1] error | ||
759 | args[2] NSECTOR | ||
760 | args[3] undefined | ||
761 | args[4+] NSECTOR * 512 bytes of data returned by the command. | ||
762 | |||
763 | error returns: | ||
764 | EACCES Access denied: requires CAP_SYS_RAWIO | ||
765 | ENOMEM Unable to allocate memory for task | ||
766 | EIO Drive reports error | ||
767 | |||
768 | notes: | ||
769 | |||
770 | [1] For commands other than WIN_SMART, args[1] should equal | ||
771 | args[3]. SECTOR, LCYL and HCYL are undefined. For | ||
772 | WIN_SMART, 0x4f and 0xc2 are loaded into LCYL and HCYL | ||
773 | respectively. In both cases SELECT will contain the default | ||
774 | value for the drive. Please refer to HDIO_DRIVE_TASKFILE | ||
775 | notes for the default value of SELECT. | ||
776 | |||
777 | [2] If NSECTOR value is greater than zero and the drive sets | ||
778 | DRQ when interrupting for the command, NSECTOR * 512 bytes | ||
779 | are read from the device into the area following NSECTOR. | ||
780 | In the above example, the area would be | ||
781 | args[4..4+XFER_SIZE]. 16bit PIO is used regardless of | ||
782 | HDIO_SET_32BIT setting. | ||
783 | |||
784 | [3] If COMMAND == WIN_SETFEATURES && FEATURE == SETFEATURES_XFER | ||
785 | && NSECTOR >= XFER_SW_DMA_0 && the drive supports any DMA | ||
786 | mode, IDE driver will try to tune the transfer mode of the | ||
787 | drive accordingly. | ||
788 | |||
789 | |||
790 | |||
791 | HDIO_DRIVE_TASK execute task and special drive command | ||
792 | |||
793 | Note: If you don't have a copy of the ANSI ATA specification | ||
794 | handy, you should probably ignore this ioctl. | ||
795 | |||
796 | usage: | ||
797 | |||
798 | u8 args[7]; | ||
799 | ... | ||
800 | ioctl(fd, HDIO_DRIVE_TASK, args); | ||
801 | |||
802 | inputs: | ||
803 | |||
804 | Taskfile register values: | ||
805 | args[0] COMMAND | ||
806 | args[1] FEATURE | ||
807 | args[2] NSECTOR | ||
808 | args[3] SECTOR | ||
809 | args[4] LCYL | ||
810 | args[5] HCYL | ||
811 | args[6] SELECT | ||
812 | |||
813 | outputs: | ||
814 | |||
815 | Taskfile register values: | ||
816 | args[0] status | ||
817 | args[1] error | ||
818 | args[2] NSECTOR | ||
819 | args[3] SECTOR | ||
820 | args[4] LCYL | ||
821 | args[5] HCYL | ||
822 | args[6] SELECT | ||
823 | |||
824 | error returns: | ||
825 | EACCES Access denied: requires CAP_SYS_RAWIO | ||
826 | ENOMEM Unable to allocate memory for task | ||
827 | ENOMSG Device is not a disk drive. | ||
828 | EIO Drive failed the command. | ||
829 | |||
830 | notes: | ||
831 | |||
832 | [1] DEV bit (0x10) of SELECT register is ignored and the | ||
833 | appropriate value for the drive is used. All other bits | ||
834 | are used unaltered. | ||
835 | |||
836 | |||
837 | |||
838 | HDIO_DRIVE_CMD_AEB HDIO_DRIVE_TASK | ||
839 | |||
840 | Not implemented, as of 2.6.8.1 | ||
841 | |||
842 | |||
843 | |||
844 | HDIO_SET_32BIT change io_32bit flags | ||
845 | |||
846 | usage: | ||
847 | |||
848 | int val; | ||
849 | ioctl(fd, HDIO_SET_32BIT, val); | ||
850 | |||
851 | inputs: | ||
852 | New value for io_32bit flag | ||
853 | |||
854 | outputs: none | ||
855 | |||
856 | error return: | ||
857 | EINVAL (bdev != bdev->bd_contains) (not sure what this means) | ||
858 | EACCES Access denied: requires CAP_SYS_ADMIN | ||
859 | EINVAL value out of range [0 3] | ||
860 | EBUSY Controller busy | ||
861 | |||
862 | |||
863 | |||
864 | |||
865 | HDIO_SET_NOWERR change ignore-write-error flag | ||
866 | |||
867 | usage: | ||
868 | |||
869 | int val; | ||
870 | ioctl(fd, HDIO_SET_NOWERR, val); | ||
871 | |||
872 | inputs: | ||
873 | New value for ignore-write-error flag. Used for ignoring | ||
874 | WRERR_STAT | ||
875 | |||
876 | outputs: none | ||
877 | |||
878 | error return: | ||
879 | EINVAL (bdev != bdev->bd_contains) (not sure what this means) | ||
880 | EACCES Access denied: requires CAP_SYS_ADMIN | ||
881 | EINVAL value out of range [0 1] | ||
882 | EBUSY Controller busy | ||
883 | |||
884 | |||
885 | |||
886 | HDIO_SET_DMA change use-dma flag | ||
887 | |||
888 | usage: | ||
889 | |||
890 | long val; | ||
891 | ioctl(fd, HDIO_SET_DMA, val); | ||
892 | |||
893 | inputs: | ||
894 | New value for use-dma flag | ||
895 | |||
896 | outputs: none | ||
897 | |||
898 | error return: | ||
899 | EINVAL (bdev != bdev->bd_contains) (not sure what this means) | ||
900 | EACCES Access denied: requires CAP_SYS_ADMIN | ||
901 | EINVAL value out of range [0 1] | ||
902 | EBUSY Controller busy | ||
903 | |||
904 | |||
905 | |||
906 | HDIO_SET_PIO_MODE reconfig interface to new speed | ||
907 | |||
908 | usage: | ||
909 | |||
910 | long val; | ||
911 | ioctl(fd, HDIO_SET_PIO_MODE, val); | ||
912 | |||
913 | inputs: | ||
914 | New interface speed. | ||
915 | |||
916 | outputs: none | ||
917 | |||
918 | error return: | ||
919 | EINVAL (bdev != bdev->bd_contains) (not sure what this means) | ||
920 | EACCES Access denied: requires CAP_SYS_ADMIN | ||
921 | EINVAL value out of range [0 255] | ||
922 | EBUSY Controller busy | ||
923 | |||
924 | |||
925 | |||
926 | HDIO_SCAN_HWIF register and (re)scan interface | ||
927 | |||
928 | usage: | ||
929 | |||
930 | int args[3] | ||
931 | ... | ||
932 | ioctl(fd, HDIO_SCAN_HWIF, args); | ||
933 | |||
934 | inputs: | ||
935 | args[0] io address to probe | ||
936 | args[1] control address to probe | ||
937 | args[2] irq number | ||
938 | |||
939 | outputs: none | ||
940 | |||
941 | error returns: | ||
942 | EACCES Access denied: requires CAP_SYS_RAWIO | ||
943 | EIO Probe failed. | ||
944 | |||
945 | notes: | ||
946 | |||
947 | This ioctl initializes the addresses and irq for a disk | ||
948 | controller, probes for drives, and creates /proc/ide | ||
949 | interfaces as appropiate. | ||
950 | |||
951 | |||
952 | |||
953 | HDIO_UNREGISTER_HWIF unregister interface | ||
954 | |||
955 | usage: | ||
956 | |||
957 | int index; | ||
958 | ioctl(fd, HDIO_UNREGISTER_HWIF, index); | ||
959 | |||
960 | inputs: | ||
961 | index index of hardware interface to unregister | ||
962 | |||
963 | outputs: none | ||
964 | |||
965 | error returns: | ||
966 | EACCES Access denied: requires CAP_SYS_RAWIO | ||
967 | |||
968 | notes: | ||
969 | |||
970 | This ioctl removes a hardware interface from the kernel. | ||
971 | |||
972 | Currently (2.6.8) this ioctl silently fails if any drive on | ||
973 | the interface is busy. | ||
974 | |||
975 | |||
976 | |||
977 | HDIO_SET_WCACHE change write cache enable-disable | ||
978 | |||
979 | usage: | ||
980 | |||
981 | int val; | ||
982 | ioctl(fd, HDIO_SET_WCACHE, val); | ||
983 | |||
984 | inputs: | ||
985 | New value for write cache enable | ||
986 | |||
987 | outputs: none | ||
988 | |||
989 | error return: | ||
990 | EINVAL (bdev != bdev->bd_contains) (not sure what this means) | ||
991 | EACCES Access denied: requires CAP_SYS_ADMIN | ||
992 | EINVAL value out of range [0 1] | ||
993 | EBUSY Controller busy | ||
994 | |||
995 | |||
996 | |||
997 | HDIO_SET_ACOUSTIC change acoustic behavior | ||
998 | |||
999 | usage: | ||
1000 | |||
1001 | int val; | ||
1002 | ioctl(fd, HDIO_SET_ACOUSTIC, val); | ||
1003 | |||
1004 | inputs: | ||
1005 | New value for drive acoustic settings | ||
1006 | |||
1007 | outputs: none | ||
1008 | |||
1009 | error return: | ||
1010 | EINVAL (bdev != bdev->bd_contains) (not sure what this means) | ||
1011 | EACCES Access denied: requires CAP_SYS_ADMIN | ||
1012 | EINVAL value out of range [0 254] | ||
1013 | EBUSY Controller busy | ||
1014 | |||
1015 | |||
1016 | |||
1017 | HDIO_SET_QDMA change use-qdma flag | ||
1018 | |||
1019 | Not implemented, as of 2.6.8.1 | ||
1020 | |||
1021 | |||
1022 | |||
1023 | HDIO_SET_ADDRESS change lba addressing modes | ||
1024 | |||
1025 | usage: | ||
1026 | |||
1027 | int val; | ||
1028 | ioctl(fd, HDIO_SET_ADDRESS, val); | ||
1029 | |||
1030 | inputs: | ||
1031 | New value for addressing mode | ||
1032 | 0 = 28-bit | ||
1033 | 1 = 48-bit | ||
1034 | 2 = 48-bit doing 28-bit | ||
1035 | |||
1036 | outputs: none | ||
1037 | |||
1038 | error return: | ||
1039 | EINVAL (bdev != bdev->bd_contains) (not sure what this means) | ||
1040 | EACCES Access denied: requires CAP_SYS_ADMIN | ||
1041 | EINVAL value out of range [0 2] | ||
1042 | EBUSY Controller busy | ||
1043 | EIO Drive does not support lba48 mode. | ||
1044 | |||
1045 | |||
1046 | HDIO_SET_IDE_SCSI | ||
1047 | |||
1048 | usage: | ||
1049 | |||
1050 | long val; | ||
1051 | ioctl(fd, HDIO_SET_IDE_SCSI, val); | ||
1052 | |||
1053 | inputs: | ||
1054 | New value for scsi emulation mode (?) | ||
1055 | |||
1056 | outputs: none | ||
1057 | |||
1058 | error return: | ||
1059 | EINVAL (bdev != bdev->bd_contains) (not sure what this means) | ||
1060 | EACCES Access denied: requires CAP_SYS_ADMIN | ||
1061 | EINVAL value out of range [0 1] | ||
1062 | EBUSY Controller busy | ||
1063 | |||
1064 | |||
1065 | |||
1066 | HDIO_SET_SCSI_IDE | ||
1067 | |||
1068 | Not implemented, as of 2.6.8.1 | ||
1069 | |||
1070 | |||