added 2.6.29.6 aldebaran kernel
[nao-ulib.git] / kernel / 2.6.29.6-aldebaran-rt / Documentation / ioctl / hdio.txt
blob91a6ecbae0bb9601b7d50e084af1eeb96869f730
1                 Summary of HDIO_ ioctl calls.
2                 ============================
4                 Edward A. Falk <efalk@google.com>
6                 November, 2004
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
12 ioctl values are listed in <linux/hdreg.h>.  As of this writing, they
13 are as follows:
15     ioctls that pass argument pointers to user space:
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
40     ioctls that pass non-pointer values:
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
58         HDIO_SET_IDE_SCSI       Set scsi emulation mode on/off
59         HDIO_SET_SCSI_IDE       not implemented yet
62 The information that follows was determined from reading kernel source
63 code.  It is likely that some corrections will be made over time.
71 General:
73         Unless otherwise specified, all ioctl calls return 0 on success
74         and -1 with errno set to an appropriate value on error.
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.
80         Unless otherwise specified, all data structures and constants
81         are defined in <linux/hdreg.h>
85 HDIO_GETGEO                     get device geometry
87         usage:
89           struct hd_geometry geom;
90           ioctl(fd, HDIO_GETGEO, &geom);
93         inputs:         none
95         outputs:
97           hd_geometry structure containing:
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.
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
110         notes:
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.
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.
125           The start field is unsigned long, meaning that it will not
126           contain a meaningful value for disks over 219 Gb in size.
131 HDIO_GET_UNMASKINTR             get current unmask setting
133         usage:
135           long val;
136           ioctl(fd, HDIO_GET_UNMASKINTR, &val);
138         inputs:         none
140         outputs:
141           The value of the drive's current unmask setting
145 HDIO_SET_UNMASKINTR             permit other irqs during I/O
147         usage:
149           unsigned long val;
150           ioctl(fd, HDIO_SET_UNMASKINTR, val);
152         inputs:
153           New value for unmask flag
155         outputs:        none
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
166 HDIO_GET_MULTCOUNT              get current IDE blockmode setting
168         usage:
170           long val;
171           ioctl(fd, HDIO_GET_MULTCOUNT, &val);
173         inputs:         none
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.
182 HDIO_SET_MULTCOUNT              change IDE blockmode
184         usage:
186           int val;
187           ioctl(fd, HDIO_SET_MULTCOUNT, val);
189         inputs:
190           New value for IDE block mode setting.  This controls how many
191           sectors the drive will transfer per interrupt.
193         outputs:        none
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.
202         notes:
204           Source code comments read:
206             This is tightly woven into the driver->do_special cannot
207             touch.  DON'T do it again until a total personality rewrite
208             is committed.
210           If blockmode has already been set, this ioctl will fail with
211           EBUSY
215 HDIO_GET_QDMA                   get use-qdma flag
217         Not implemented, as of 2.6.8.1
221 HDIO_SET_XFER                   set transfer rate via proc
223         Not implemented, as of 2.6.8.1
227 HDIO_OBSOLETE_IDENTITY          OBSOLETE, DO NOT USE
229         Same as HDIO_GET_IDENTITY (see below), except that it only
230         returns the first 142 bytes of drive identity information.
234 HDIO_GET_IDENTITY               get IDE identification info
236         usage:
238           unsigned char identity[512];
239           ioctl(fd, HDIO_GET_IDENTITY, identity);
241         inputs:         none
243         outputs:
245           ATA drive identity information.  For full description, see
246           the IDENTIFY DEVICE and IDENTIFY PACKET DEVICE commands in
247           the ATA specification.
249         error returns:
250           EINVAL        (bdev != bdev->bd_contains) (not sure what this means)
251           ENOMSG        IDENTIFY DEVICE information not available
253         notes:
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.
260           This information is also available from /proc/ide/hdX/identify
264 HDIO_GET_KEEPSETTINGS           get keep-settings-on-reset flag
266         usage:
268           long val;
269           ioctl(fd, HDIO_GET_KEEPSETTINGS, &val);
271         inputs:         none
273         outputs:
274           The value of the current "keep settings" flag
276         notes:
278           When set, indicates that kernel should restore settings
279           after a drive reset.
283 HDIO_SET_KEEPSETTINGS           keep ioctl settings on reset
285         usage:
287           long val;
288           ioctl(fd, HDIO_SET_KEEPSETTINGS, val);
290         inputs:
291           New value for keep_settings flag
293         outputs:        none
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
303 HDIO_GET_32BIT                  get current io_32bit setting
305         usage:
307           long val;
308           ioctl(fd, HDIO_GET_32BIT, &val);
310         inputs:         none
312         outputs:
313           The value of the current io_32bit setting
315         notes:
317           0=16-bit, 1=32-bit, 2,3 = 32bit+sync
321 HDIO_GET_NOWERR                 get ignore-write-error flag
323         usage:
325           long val;
326           ioctl(fd, HDIO_GET_NOWERR, &val);
328         inputs:         none
330         outputs:
331           The value of the current ignore-write-error flag
335 HDIO_GET_DMA                    get use-dma flag
337         usage:
339           long val;
340           ioctl(fd, HDIO_GET_DMA, &val);
342         inputs:         none
344         outputs:
345           The value of the current use-dma flag
349 HDIO_GET_NICE                   get nice flags
351         usage:
353           long nice;
354           ioctl(fd, HDIO_GET_NICE, &nice);
356         inputs:         none
358         outputs:
360           The drive's "nice" values.
362         notes:
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.
371 HDIO_SET_NICE                   set nice flags
373         usage:
375           unsigned long nice;
376           ...
377           ioctl(fd, HDIO_SET_NICE, nice);
379         inputs:
380           bitmask of nice flags.
382         outputs:        none
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
389         notes:
391           This ioctl sets the DSC_OVERLAP and NICE_1 flags from values
392           provided by the user.
394           Nice flags are listed in <linux/hdreg.h>, starting with
395           IDE_NICE_DSC_OVERLAP.  These values represent shifts.
401 HDIO_GET_WCACHE                 get write cache mode on|off
403         usage:
405           long val;
406           ioctl(fd, HDIO_GET_WCACHE, &val);
408         inputs:         none
410         outputs:
411           The value of the current write cache mode
415 HDIO_GET_ACOUSTIC               get acoustic value
417         usage:
419           long val;
420           ioctl(fd, HDIO_GET_ACOUSTIC, &val);
422         inputs:         none
424         outputs:
425           The value of the current acoustic settings
427         notes:
429           See HDIO_SET_ACOUSTIC
433 HDIO_GET_ADDRESS
435         usage:
437           long val;
438           ioctl(fd, HDIO_GET_ADDRESS, &val);
440         inputs:         none
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
451 HDIO_GET_BUSSTATE               get the bus state of the hwif
453         usage:
455           long state;
456           ioctl(fd, HDIO_SCAN_HWIF, &state);
458         inputs:         none
460         outputs:
461           Current power state of the IDE bus.  One of BUSSTATE_OFF,
462           BUSSTATE_ON, or BUSSTATE_TRISTATE
464         error returns:
465           EACCES        Access denied:  requires CAP_SYS_ADMIN
470 HDIO_SET_BUSSTATE               set the bus state of the hwif
472         usage:
474           int state;
475           ...
476           ioctl(fd, HDIO_SCAN_HWIF, state);
478         inputs:
479           Desired IDE power state.  One of BUSSTATE_OFF, BUSSTATE_ON,
480           or BUSSTATE_TRISTATE
482         outputs:        none
484         error returns:
485           EACCES        Access denied:  requires CAP_SYS_RAWIO
486           EOPNOTSUPP    Hardware interface does not support bus power control
491 HDIO_TRISTATE_HWIF              execute a channel tristate
493         Not implemented, as of 2.6.8.1.  See HDIO_SET_BUSSTATE
497 HDIO_DRIVE_RESET                execute a device reset
499         usage:
501           int args[3]
502           ...
503           ioctl(fd, HDIO_DRIVE_RESET, args);
505         inputs:         none
507         outputs:        none
509         error returns:
510           EACCES        Access denied:  requires CAP_SYS_ADMIN
511           ENXIO         No such device: phy dead or ctl_addr == 0
512           EIO           I/O error:      reset timed out or hardware error
514         notes:
516           Execute a reset on the device as soon as the current IO
517           operation has completed.
519           Executes an ATAPI soft reset if applicable, otherwise
520           executes an ATA soft reset on the controller.
524 HDIO_DRIVE_TASKFILE             execute raw taskfile
526         Note:  If you don't have a copy of the ANSI ATA specification
527         handy, you should probably ignore this ioctl.
529         Execute an ATA disk command directly by writing the "taskfile"
530         registers of the drive.  Requires ADMIN and RAWIO access
531         privileges.
533         usage:
535           struct {
536             ide_task_request_t req_task;
537             u8 outbuf[OUTPUT_SIZE];
538             u8 inbuf[INPUT_SIZE];
539           } task;
540           memset(&task.req_task, 0, sizeof(task.req_task));
541           task.req_task.out_size = sizeof(task.outbuf);
542           task.req_task.in_size = sizeof(task.inbuf);
543           ...
544           ioctl(fd, HDIO_DRIVE_TASKFILE, &task);
545           ...
547         inputs:
549           (See below for details on memory area passed to ioctl.)
551           io_ports[8]   values to be written to taskfile registers
552           hob_ports[8]  high-order bytes, for extended commands.
553           out_flags     flags indicating which registers are valid
554           in_flags      flags indicating which registers should be returned
555           data_phase    see below
556           req_cmd       command type to be executed
557           out_size      size of output buffer
558           outbuf        buffer of data to be transmitted to disk
559           inbuf         buffer of data to be received from disk (see [1])
561         outputs:
563           io_ports[]    values returned in the taskfile registers
564           hob_ports[]   high-order bytes, for extended commands.
565           out_flags     flags indicating which registers are valid (see [2])
566           in_flags      flags indicating which registers should be returned
567           outbuf        buffer of data to be transmitted to disk (see [1])
568           inbuf         buffer of data to be received from disk
570         error returns:
571           EACCES        CAP_SYS_ADMIN or CAP_SYS_RAWIO privilege not set.
572           ENOMSG        Device is not a disk drive.
573           ENOMEM        Unable to allocate memory for task
574           EFAULT        req_cmd == TASKFILE_IN_OUT (not implemented as of 2.6.8)
575           EPERM         req_cmd == TASKFILE_MULTI_OUT and drive
576                         multi-count not yet set.
577           EIO           Drive failed the command.
579         notes:
581           [1] READ THE FOLLOWING NOTES *CAREFULLY*.  THIS IOCTL IS
582           FULL OF GOTCHAS.  Extreme caution should be used with using
583           this ioctl.  A mistake can easily corrupt data or hang the
584           system.
586           [2] Both the input and output buffers are copied from the
587           user and written back to the user, even when not used.
589           [3] If one or more bits are set in out_flags and in_flags is
590           zero, the following values are used for in_flags.all and
591           written back into in_flags on completion.
593            * IDE_TASKFILE_STD_IN_FLAGS | (IDE_HOB_STD_IN_FLAGS << 8)
594              if LBA48 addressing is enabled for the drive
595            * IDE_TASKFILE_STD_IN_FLAGS
596              if CHS/LBA28
598           The association between in_flags.all and each enable
599           bitfield flips depending on endianess; fortunately, TASKFILE
600           only uses inflags.b.data bit and ignores all other bits.
601           The end result is that, on any endian machines, it has no
602           effect other than modifying in_flags on completion.
604           [4] The default value of SELECT is (0xa0|DEV_bit|LBA_bit)
605           except for four drives per port chipsets.  For four drives
606           per port chipsets, it's (0xa0|DEV_bit|LBA_bit) for the first
607           pair and (0x80|DEV_bit|LBA_bit) for the second pair.
609           [5] The argument to the ioctl is a pointer to a region of
610           memory containing a ide_task_request_t structure, followed
611           by an optional buffer of data to be transmitted to the
612           drive, followed by an optional buffer to receive data from
613           the drive.
615           Command is passed to the disk drive via the ide_task_request_t
616           structure, which contains these fields:
618             io_ports[8]         values for the taskfile registers
619             hob_ports[8]        high-order bytes, for extended commands
620             out_flags           flags indicating which entries in the
621                                 io_ports[] and hob_ports[] arrays
622                                 contain valid values.  Type ide_reg_valid_t.
623             in_flags            flags indicating which entries in the
624                                 io_ports[] and hob_ports[] arrays
625                                 are expected to contain valid values
626                                 on return.
627             data_phase          See below
628             req_cmd             Command type, see below
629             out_size            output (user->drive) buffer size, bytes
630             in_size             input (drive->user) buffer size, bytes
632           When out_flags is zero, the following registers are loaded.
634             HOB_FEATURE         If the drive supports LBA48
635             HOB_NSECTOR         If the drive supports LBA48
636             HOB_SECTOR          If the drive supports LBA48
637             HOB_LCYL            If the drive supports LBA48
638             HOB_HCYL            If the drive supports LBA48
639             FEATURE
640             NSECTOR
641             SECTOR
642             LCYL
643             HCYL
644             SELECT              First, masked with 0xE0 if LBA48, 0xEF
645                                 otherwise; then, or'ed with the default
646                                 value of SELECT.
648           If any bit in out_flags is set, the following registers are loaded.
650             HOB_DATA            If out_flags.b.data is set.  HOB_DATA will
651                                 travel on DD8-DD15 on little endian machines
652                                 and on DD0-DD7 on big endian machines.
653             DATA                If out_flags.b.data is set.  DATA will
654                                 travel on DD0-DD7 on little endian machines
655                                 and on DD8-DD15 on big endian machines.
656             HOB_NSECTOR         If out_flags.b.nsector_hob is set
657             HOB_SECTOR          If out_flags.b.sector_hob is set
658             HOB_LCYL            If out_flags.b.lcyl_hob is set
659             HOB_HCYL            If out_flags.b.hcyl_hob is set
660             FEATURE             If out_flags.b.feature is set
661             NSECTOR             If out_flags.b.nsector is set
662             SECTOR              If out_flags.b.sector is set
663             LCYL                If out_flags.b.lcyl is set
664             HCYL                If out_flags.b.hcyl is set
665             SELECT              Or'ed with the default value of SELECT and
666                                 loaded regardless of out_flags.b.select.
668           Taskfile registers are read back from the drive into
669           {io|hob}_ports[] after the command completes iff one of the
670           following conditions is met; otherwise, the original values
671           will be written back, unchanged.
673             1. The drive fails the command (EIO).
674             2. One or more than one bits are set in out_flags.
675             3. The requested data_phase is TASKFILE_NO_DATA.
677             HOB_DATA            If in_flags.b.data is set.  It will contain
678                                 DD8-DD15 on little endian machines and
679                                 DD0-DD7 on big endian machines.
680             DATA                If in_flags.b.data is set.  It will contain
681                                 DD0-DD7 on little endian machines and
682                                 DD8-DD15 on big endian machines.
683             HOB_FEATURE         If the drive supports LBA48
684             HOB_NSECTOR         If the drive supports LBA48
685             HOB_SECTOR          If the drive supports LBA48
686             HOB_LCYL            If the drive supports LBA48
687             HOB_HCYL            If the drive supports LBA48
688             NSECTOR
689             SECTOR
690             LCYL
691             HCYL
693           The data_phase field describes the data transfer to be
694           performed.  Value is one of:
696             TASKFILE_IN
697             TASKFILE_MULTI_IN
698             TASKFILE_OUT
699             TASKFILE_MULTI_OUT
700             TASKFILE_IN_OUT
701             TASKFILE_IN_DMA
702             TASKFILE_IN_DMAQ            == IN_DMA (queueing not supported)
703             TASKFILE_OUT_DMA
704             TASKFILE_OUT_DMAQ           == OUT_DMA (queueing not supported)
705             TASKFILE_P_IN               unimplemented
706             TASKFILE_P_IN_DMA           unimplemented
707             TASKFILE_P_IN_DMAQ          unimplemented
708             TASKFILE_P_OUT              unimplemented
709             TASKFILE_P_OUT_DMA          unimplemented
710             TASKFILE_P_OUT_DMAQ         unimplemented
712           The req_cmd field classifies the command type.  It may be
713           one of:
715             IDE_DRIVE_TASK_NO_DATA
716             IDE_DRIVE_TASK_SET_XFER     unimplemented
717             IDE_DRIVE_TASK_IN
718             IDE_DRIVE_TASK_OUT          unimplemented
719             IDE_DRIVE_TASK_RAW_WRITE
721           [6] Do not access {in|out}_flags->all except for resetting
722           all the bits.  Always access individual bit fields.  ->all
723           value will flip depending on endianess.  For the same
724           reason, do not use IDE_{TASKFILE|HOB}_STD_{OUT|IN}_FLAGS
725           constants defined in hdreg.h.
729 HDIO_DRIVE_CMD                  execute a special drive command
731         Note:  If you don't have a copy of the ANSI ATA specification
732         handy, you should probably ignore this ioctl.
734         usage:
736           u8 args[4+XFER_SIZE];
737           ...
738           ioctl(fd, HDIO_DRIVE_CMD, args);
740         inputs:
742           Commands other than WIN_SMART
743             args[0]     COMMAND
744             args[1]     NSECTOR
745             args[2]     FEATURE
746             args[3]     NSECTOR
748           WIN_SMART
749             args[0]     COMMAND
750             args[1]     SECTOR
751             args[2]     FEATURE
752             args[3]     NSECTOR
754         outputs:
756           args[] buffer is filled with register values followed by any
757           data returned by the disk.
758             args[0]     status
759             args[1]     error
760             args[2]     NSECTOR
761             args[3]     undefined
762             args[4+]    NSECTOR * 512 bytes of data returned by the command.
764         error returns:
765           EACCES        Access denied:  requires CAP_SYS_RAWIO
766           ENOMEM        Unable to allocate memory for task
767           EIO           Drive reports error
769         notes:
771           [1] For commands other than WIN_SMART, args[1] should equal
772           args[3].  SECTOR, LCYL and HCYL are undefined.  For
773           WIN_SMART, 0x4f and 0xc2 are loaded into LCYL and HCYL
774           respectively.  In both cases SELECT will contain the default
775           value for the drive.  Please refer to HDIO_DRIVE_TASKFILE
776           notes for the default value of SELECT.
778           [2] If NSECTOR value is greater than zero and the drive sets
779           DRQ when interrupting for the command, NSECTOR * 512 bytes
780           are read from the device into the area following NSECTOR.
781           In the above example, the area would be
782           args[4..4+XFER_SIZE].  16bit PIO is used regardless of
783           HDIO_SET_32BIT setting.
785           [3] If COMMAND == WIN_SETFEATURES && FEATURE == SETFEATURES_XFER
786           && NSECTOR >= XFER_SW_DMA_0 && the drive supports any DMA
787           mode, IDE driver will try to tune the transfer mode of the
788           drive accordingly.
792 HDIO_DRIVE_TASK                 execute task and special drive command
794         Note:  If you don't have a copy of the ANSI ATA specification
795         handy, you should probably ignore this ioctl.
797         usage:
799           u8 args[7];
800           ...
801           ioctl(fd, HDIO_DRIVE_TASK, args);
803         inputs:
805           Taskfile register values:
806             args[0]     COMMAND
807             args[1]     FEATURE
808             args[2]     NSECTOR
809             args[3]     SECTOR
810             args[4]     LCYL
811             args[5]     HCYL
812             args[6]     SELECT
814         outputs:
816           Taskfile register values:
817             args[0]     status
818             args[1]     error
819             args[2]     NSECTOR
820             args[3]     SECTOR
821             args[4]     LCYL
822             args[5]     HCYL
823             args[6]     SELECT
825         error returns:
826           EACCES        Access denied:  requires CAP_SYS_RAWIO
827           ENOMEM        Unable to allocate memory for task
828           ENOMSG        Device is not a disk drive.
829           EIO           Drive failed the command.
831         notes:
833           [1] DEV bit (0x10) of SELECT register is ignored and the
834           appropriate value for the drive is used.  All other bits
835           are used unaltered.
839 HDIO_DRIVE_CMD_AEB              HDIO_DRIVE_TASK
841         Not implemented, as of 2.6.8.1
845 HDIO_SET_32BIT                  change io_32bit flags
847         usage:
849           int val;
850           ioctl(fd, HDIO_SET_32BIT, val);
852         inputs:
853           New value for io_32bit flag
855         outputs:        none
857         error return:
858           EINVAL        (bdev != bdev->bd_contains) (not sure what this means)
859           EACCES        Access denied:  requires CAP_SYS_ADMIN
860           EINVAL        value out of range [0 3]
861           EBUSY         Controller busy
866 HDIO_SET_NOWERR                 change ignore-write-error flag
868         usage:
870           int val;
871           ioctl(fd, HDIO_SET_NOWERR, val);
873         inputs:
874           New value for ignore-write-error flag.  Used for ignoring
875           WRERR_STAT
877         outputs:        none
879         error return:
880           EINVAL        (bdev != bdev->bd_contains) (not sure what this means)
881           EACCES        Access denied:  requires CAP_SYS_ADMIN
882           EINVAL        value out of range [0 1]
883           EBUSY         Controller busy
887 HDIO_SET_DMA                    change use-dma flag
889         usage:
891           long val;
892           ioctl(fd, HDIO_SET_DMA, val);
894         inputs:
895           New value for use-dma flag
897         outputs:        none
899         error return:
900           EINVAL        (bdev != bdev->bd_contains) (not sure what this means)
901           EACCES        Access denied:  requires CAP_SYS_ADMIN
902           EINVAL        value out of range [0 1]
903           EBUSY         Controller busy
907 HDIO_SET_PIO_MODE               reconfig interface to new speed
909         usage:
911           long val;
912           ioctl(fd, HDIO_SET_PIO_MODE, val);
914         inputs:
915           New interface speed.
917         outputs:        none
919         error return:
920           EINVAL        (bdev != bdev->bd_contains) (not sure what this means)
921           EACCES        Access denied:  requires CAP_SYS_ADMIN
922           EINVAL        value out of range [0 255]
923           EBUSY         Controller busy
927 HDIO_SCAN_HWIF                  register and (re)scan interface
929         usage:
931           int args[3]
932           ...
933           ioctl(fd, HDIO_SCAN_HWIF, args);
935         inputs:
936           args[0]       io address to probe
937           args[1]       control address to probe
938           args[2]       irq number
940         outputs:        none
942         error returns:
943           EACCES        Access denied:  requires CAP_SYS_RAWIO
944           EIO           Probe failed.
946         notes:
948           This ioctl initializes the addresses and irq for a disk
949           controller, probes for drives, and creates /proc/ide
950           interfaces as appropriate.
954 HDIO_UNREGISTER_HWIF            unregister interface
956         usage:
958           int index;
959           ioctl(fd, HDIO_UNREGISTER_HWIF, index);
961         inputs:
962           index         index of hardware interface to unregister
964         outputs:        none
966         error returns:
967           EACCES        Access denied:  requires CAP_SYS_RAWIO
969         notes:
971           This ioctl removes a hardware interface from the kernel.
973           Currently (2.6.8) this ioctl silently fails if any drive on
974           the interface is busy.
978 HDIO_SET_WCACHE                 change write cache enable-disable
980         usage:
982           int val;
983           ioctl(fd, HDIO_SET_WCACHE, val);
985         inputs:
986           New value for write cache enable
988         outputs:        none
990         error return:
991           EINVAL        (bdev != bdev->bd_contains) (not sure what this means)
992           EACCES        Access denied:  requires CAP_SYS_ADMIN
993           EINVAL        value out of range [0 1]
994           EBUSY         Controller busy
998 HDIO_SET_ACOUSTIC               change acoustic behavior
1000         usage:
1002           int val;
1003           ioctl(fd, HDIO_SET_ACOUSTIC, val);
1005         inputs:
1006           New value for drive acoustic settings
1008         outputs:        none
1010         error return:
1011           EINVAL        (bdev != bdev->bd_contains) (not sure what this means)
1012           EACCES        Access denied:  requires CAP_SYS_ADMIN
1013           EINVAL        value out of range [0 254]
1014           EBUSY         Controller busy
1018 HDIO_SET_QDMA                   change use-qdma flag
1020         Not implemented, as of 2.6.8.1
1024 HDIO_SET_ADDRESS                change lba addressing modes
1026         usage:
1028           int val;
1029           ioctl(fd, HDIO_SET_ADDRESS, val);
1031         inputs:
1032           New value for addressing mode
1033             0 = 28-bit
1034             1 = 48-bit
1035             2 = 48-bit doing 28-bit
1037         outputs:        none
1039         error return:
1040           EINVAL        (bdev != bdev->bd_contains) (not sure what this means)
1041           EACCES        Access denied:  requires CAP_SYS_ADMIN
1042           EINVAL        value out of range [0 2]
1043           EBUSY         Controller busy
1044           EIO           Drive does not support lba48 mode.
1047 HDIO_SET_IDE_SCSI
1049         usage:
1051           long val;
1052           ioctl(fd, HDIO_SET_IDE_SCSI, val);
1054         inputs:
1055           New value for scsi emulation mode (?)
1057         outputs:        none
1059         error return:
1060           EINVAL        (bdev != bdev->bd_contains) (not sure what this means)
1061           EACCES        Access denied:  requires CAP_SYS_ADMIN
1062           EINVAL        value out of range [0 1]
1063           EBUSY         Controller busy
1067 HDIO_SET_SCSI_IDE
1069         Not implemented, as of 2.6.8.1