~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/userspace-api/ioctl/hdio.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/userspace-api/ioctl/hdio.rst (Version linux-6.12-rc7) and /Documentation/userspace-api/ioctl/hdio.rst (Version linux-6.10.14)


  1 ==============================                      1 ==============================
  2 Summary of `HDIO_` ioctl calls                      2 Summary of `HDIO_` ioctl calls
  3 ==============================                      3 ==============================
  4                                                     4 
  5 - Edward A. Falk <efalk@google.com>                  5 - Edward A. Falk <efalk@google.com>
  6                                                     6 
  7 November, 2004                                      7 November, 2004
  8                                                     8 
  9 This document attempts to describe the ioctl(2      9 This document attempts to describe the ioctl(2) calls supported by
 10 the HD/IDE layer.  These are by-and-large impl     10 the HD/IDE layer.  These are by-and-large implemented (as of Linux 5.11)
 11 drivers/ata/libata-scsi.c.                         11 drivers/ata/libata-scsi.c.
 12                                                    12 
 13 ioctl values are listed in <linux/hdreg.h>.  A     13 ioctl values are listed in <linux/hdreg.h>.  As of this writing, they
 14 are as follows:                                    14 are as follows:
 15                                                    15 
 16     ioctls that pass argument pointers to user     16     ioctls that pass argument pointers to user space:
 17                                                    17 
 18         ======================= ==============     18         ======================= =======================================
 19         HDIO_GETGEO             get device geo     19         HDIO_GETGEO             get device geometry
 20         HDIO_GET_32BIT          get current io     20         HDIO_GET_32BIT          get current io_32bit setting
 21         HDIO_GET_IDENTITY       get IDE identi     21         HDIO_GET_IDENTITY       get IDE identification info
 22         HDIO_DRIVE_TASKFILE     execute raw ta     22         HDIO_DRIVE_TASKFILE     execute raw taskfile
 23         HDIO_DRIVE_TASK         execute task a     23         HDIO_DRIVE_TASK         execute task and special drive command
 24         HDIO_DRIVE_CMD          execute a spec     24         HDIO_DRIVE_CMD          execute a special drive command
 25         ======================= ==============     25         ======================= =======================================
 26                                                    26 
 27     ioctls that pass non-pointer values:           27     ioctls that pass non-pointer values:
 28                                                    28 
 29         ======================= ==============     29         ======================= =======================================
 30         HDIO_SET_32BIT          change io_32bi     30         HDIO_SET_32BIT          change io_32bit flags
 31         ======================= ==============     31         ======================= =======================================
 32                                                    32 
 33                                                    33 
 34 The information that follows was determined fr     34 The information that follows was determined from reading kernel source
 35 code.  It is likely that some corrections will     35 code.  It is likely that some corrections will be made over time.
 36                                                    36 
 37 ----------------------------------------------     37 ------------------------------------------------------------------------------
 38                                                    38 
 39 General:                                           39 General:
 40                                                    40 
 41         Unless otherwise specified, all ioctl      41         Unless otherwise specified, all ioctl calls return 0 on success
 42         and -1 with errno set to an appropriat     42         and -1 with errno set to an appropriate value on error.
 43                                                    43 
 44         Unless otherwise specified, all ioctl      44         Unless otherwise specified, all ioctl calls return -1 and set
 45         errno to EFAULT on a failed attempt to     45         errno to EFAULT on a failed attempt to copy data to or from user
 46         address space.                             46         address space.
 47                                                    47 
 48         Unless otherwise specified, all data s     48         Unless otherwise specified, all data structures and constants
 49         are defined in <linux/hdreg.h>             49         are defined in <linux/hdreg.h>
 50                                                    50 
 51 ----------------------------------------------     51 ------------------------------------------------------------------------------
 52                                                    52 
 53 HDIO_GETGEO                                        53 HDIO_GETGEO
 54         get device geometry                        54         get device geometry
 55                                                    55 
 56                                                    56 
 57         usage::                                    57         usage::
 58                                                    58 
 59           struct hd_geometry geom;                 59           struct hd_geometry geom;
 60                                                    60 
 61           ioctl(fd, HDIO_GETGEO, &geom);           61           ioctl(fd, HDIO_GETGEO, &geom);
 62                                                    62 
 63                                                    63 
 64         inputs:                                    64         inputs:
 65                 none                               65                 none
 66                                                    66 
 67                                                    67 
 68                                                    68 
 69         outputs:                                   69         outputs:
 70                 hd_geometry structure containi     70                 hd_geometry structure containing:
 71                                                    71 
 72                                                    72 
 73             =========   ======================     73             =========   ==================================
 74             heads       number of heads            74             heads       number of heads
 75             sectors     number of sectors/trac     75             sectors     number of sectors/track
 76             cylinders   number of cylinders, m     76             cylinders   number of cylinders, mod 65536
 77             start       starting sector of thi     77             start       starting sector of this partition.
 78             =========   ======================     78             =========   ==================================
 79                                                    79 
 80                                                    80 
 81         error returns:                             81         error returns:
 82           - EINVAL                                 82           - EINVAL
 83                                                    83 
 84                         if the device is not a     84                         if the device is not a disk drive or floppy drive,
 85                         or if the user passes      85                         or if the user passes a null pointer
 86                                                    86 
 87                                                    87 
 88         notes:                                     88         notes:
 89                 Not particularly useful with m     89                 Not particularly useful with modern disk drives, whose geometry
 90                 is a polite fiction anyway.  M     90                 is a polite fiction anyway.  Modern drives are addressed
 91                 purely by sector number nowada     91                 purely by sector number nowadays (lba addressing), and the
 92                 drive geometry is an abstracti     92                 drive geometry is an abstraction which is actually subject
 93                 to change.  Currently (as of N     93                 to change.  Currently (as of Nov 2004), the geometry values
 94                 are the "bios" values -- presu     94                 are the "bios" values -- presumably the values the drive had
 95                 when Linux first booted.           95                 when Linux first booted.
 96                                                    96 
 97                 In addition, the cylinders fie     97                 In addition, the cylinders field of the hd_geometry is an
 98                 unsigned short, meaning that o     98                 unsigned short, meaning that on most architectures, this
 99                 ioctl will not return a meanin     99                 ioctl will not return a meaningful value on drives with more
100                 than 65535 tracks.                100                 than 65535 tracks.
101                                                   101 
102                 The start field is unsigned lo    102                 The start field is unsigned long, meaning that it will not
103                 contain a meaningful value for    103                 contain a meaningful value for disks over 219 Gb in size.
104                                                   104 
105                                                   105 
106                                                   106 
107 HDIO_GET_IDENTITY                                 107 HDIO_GET_IDENTITY
108         get IDE identification info               108         get IDE identification info
109                                                   109 
110                                                   110 
111         usage::                                   111         usage::
112                                                   112 
113           unsigned char identity[512];            113           unsigned char identity[512];
114                                                   114 
115           ioctl(fd, HDIO_GET_IDENTITY, identit    115           ioctl(fd, HDIO_GET_IDENTITY, identity);
116                                                   116 
117         inputs:                                   117         inputs:
118                 none                              118                 none
119                                                   119 
120                                                   120 
121                                                   121 
122         outputs:                                  122         outputs:
123                 ATA drive identity information    123                 ATA drive identity information.  For full description, see
124                 the IDENTIFY DEVICE and IDENTI    124                 the IDENTIFY DEVICE and IDENTIFY PACKET DEVICE commands in
125                 the ATA specification.            125                 the ATA specification.
126                                                   126 
127         error returns:                            127         error returns:
128           - EINVAL      Called on a partition     128           - EINVAL      Called on a partition instead of the whole disk device
129           - ENOMSG      IDENTIFY DEVICE inform    129           - ENOMSG      IDENTIFY DEVICE information not available
130                                                   130 
131         notes:                                    131         notes:
132                 Returns information that was o    132                 Returns information that was obtained when the drive was
133                 probed.  Some of this informat    133                 probed.  Some of this information is subject to change, and
134                 this ioctl does not re-probe t    134                 this ioctl does not re-probe the drive to update the
135                 information.                      135                 information.
136                                                   136 
137                 This information is also avail    137                 This information is also available from /proc/ide/hdX/identify
138                                                   138 
139                                                   139 
140                                                   140 
141 HDIO_GET_32BIT                                    141 HDIO_GET_32BIT
142         get current io_32bit setting              142         get current io_32bit setting
143                                                   143 
144                                                   144 
145         usage::                                   145         usage::
146                                                   146 
147           long val;                               147           long val;
148                                                   148 
149           ioctl(fd, HDIO_GET_32BIT, &val);        149           ioctl(fd, HDIO_GET_32BIT, &val);
150                                                   150 
151         inputs:                                   151         inputs:
152                 none                              152                 none
153                                                   153 
154                                                   154 
155                                                   155 
156         outputs:                                  156         outputs:
157                 The value of the current io_32    157                 The value of the current io_32bit setting
158                                                   158 
159                                                   159 
160                                                   160 
161         notes:                                    161         notes:
162                 0=16-bit, 1=32-bit, 2,3 = 32bi    162                 0=16-bit, 1=32-bit, 2,3 = 32bit+sync
163                                                   163 
164                                                   164 
165                                                   165 
166 HDIO_DRIVE_TASKFILE                               166 HDIO_DRIVE_TASKFILE
167         execute raw taskfile                      167         execute raw taskfile
168                                                   168 
169                                                   169 
170         Note:                                     170         Note:
171                 If you don't have a copy of th    171                 If you don't have a copy of the ANSI ATA specification
172                 handy, you should probably ign    172                 handy, you should probably ignore this ioctl.
173                                                   173 
174         - Execute an ATA disk command directly    174         - Execute an ATA disk command directly by writing the "taskfile"
175           registers of the drive.  Requires AD    175           registers of the drive.  Requires ADMIN and RAWIO access
176           privileges.                             176           privileges.
177                                                   177 
178         usage::                                   178         usage::
179                                                   179 
180           struct {                                180           struct {
181                                                   181 
182             ide_task_request_t req_task;          182             ide_task_request_t req_task;
183             u8 outbuf[OUTPUT_SIZE];               183             u8 outbuf[OUTPUT_SIZE];
184             u8 inbuf[INPUT_SIZE];                 184             u8 inbuf[INPUT_SIZE];
185           } task;                                 185           } task;
186           memset(&task.req_task, 0, sizeof(tas    186           memset(&task.req_task, 0, sizeof(task.req_task));
187           task.req_task.out_size = sizeof(task    187           task.req_task.out_size = sizeof(task.outbuf);
188           task.req_task.in_size = sizeof(task.    188           task.req_task.in_size = sizeof(task.inbuf);
189           ...                                     189           ...
190           ioctl(fd, HDIO_DRIVE_TASKFILE, &task    190           ioctl(fd, HDIO_DRIVE_TASKFILE, &task);
191           ...                                     191           ...
192                                                   192 
193         inputs:                                   193         inputs:
194                                                   194 
195           (See below for details on memory are    195           (See below for details on memory area passed to ioctl.)
196                                                   196 
197           ============  ======================    197           ============  ===================================================
198           io_ports[8]   values to be written t    198           io_ports[8]   values to be written to taskfile registers
199           hob_ports[8]  high-order bytes, for     199           hob_ports[8]  high-order bytes, for extended commands.
200           out_flags     flags indicating which    200           out_flags     flags indicating which registers are valid
201           in_flags      flags indicating which    201           in_flags      flags indicating which registers should be returned
202           data_phase    see below                 202           data_phase    see below
203           req_cmd       command type to be exe    203           req_cmd       command type to be executed
204           out_size      size of output buffer     204           out_size      size of output buffer
205           outbuf        buffer of data to be t    205           outbuf        buffer of data to be transmitted to disk
206           inbuf         buffer of data to be r    206           inbuf         buffer of data to be received from disk (see [1])
207           ============  ======================    207           ============  ===================================================
208                                                   208 
209         outputs:                                  209         outputs:
210                                                   210 
211           ===========   ======================    211           ===========   ====================================================
212           io_ports[]    values returned in the    212           io_ports[]    values returned in the taskfile registers
213           hob_ports[]   high-order bytes, for     213           hob_ports[]   high-order bytes, for extended commands.
214           out_flags     flags indicating which    214           out_flags     flags indicating which registers are valid (see [2])
215           in_flags      flags indicating which    215           in_flags      flags indicating which registers should be returned
216           outbuf        buffer of data to be t    216           outbuf        buffer of data to be transmitted to disk (see [1])
217           inbuf         buffer of data to be r    217           inbuf         buffer of data to be received from disk
218           ===========   ======================    218           ===========   ====================================================
219                                                   219 
220         error returns:                            220         error returns:
221           - EACCES      CAP_SYS_ADMIN or CAP_S    221           - EACCES      CAP_SYS_ADMIN or CAP_SYS_RAWIO privilege not set.
222           - ENOMSG      Device is not a disk d    222           - ENOMSG      Device is not a disk drive.
223           - ENOMEM      Unable to allocate mem    223           - ENOMEM      Unable to allocate memory for task
224           - EFAULT      req_cmd == TASKFILE_IN    224           - EFAULT      req_cmd == TASKFILE_IN_OUT (not implemented as of 2.6.8)
225           - EPERM                                 225           - EPERM
226                                                   226 
227                         req_cmd == TASKFILE_MU    227                         req_cmd == TASKFILE_MULTI_OUT and drive
228                         multi-count not yet se    228                         multi-count not yet set.
229           - EIO         Drive failed the comma    229           - EIO         Drive failed the command.
230                                                   230 
231         notes:                                    231         notes:
232                                                   232 
233           [1] READ THE FOLLOWING NOTES *CAREFU    233           [1] READ THE FOLLOWING NOTES *CAREFULLY*.  THIS IOCTL IS
234           FULL OF GOTCHAS.  Extreme caution sh    234           FULL OF GOTCHAS.  Extreme caution should be used with using
235           this ioctl.  A mistake can easily co    235           this ioctl.  A mistake can easily corrupt data or hang the
236           system.                                 236           system.
237                                                   237 
238           [2] Both the input and output buffer    238           [2] Both the input and output buffers are copied from the
239           user and written back to the user, e    239           user and written back to the user, even when not used.
240                                                   240 
241           [3] If one or more bits are set in o    241           [3] If one or more bits are set in out_flags and in_flags is
242           zero, the following values are used     242           zero, the following values are used for in_flags.all and
243           written back into in_flags on comple    243           written back into in_flags on completion.
244                                                   244 
245            * IDE_TASKFILE_STD_IN_FLAGS | (IDE_    245            * IDE_TASKFILE_STD_IN_FLAGS | (IDE_HOB_STD_IN_FLAGS << 8)
246              if LBA48 addressing is enabled fo    246              if LBA48 addressing is enabled for the drive
247            * IDE_TASKFILE_STD_IN_FLAGS            247            * IDE_TASKFILE_STD_IN_FLAGS
248              if CHS/LBA28                         248              if CHS/LBA28
249                                                   249 
250           The association between in_flags.all    250           The association between in_flags.all and each enable
251           bitfield flips depending on endianne    251           bitfield flips depending on endianness; fortunately, TASKFILE
252           only uses inflags.b.data bit and ign    252           only uses inflags.b.data bit and ignores all other bits.
253           The end result is that, on any endia    253           The end result is that, on any endian machines, it has no
254           effect other than modifying in_flags    254           effect other than modifying in_flags on completion.
255                                                   255 
256           [4] The default value of SELECT is (    256           [4] The default value of SELECT is (0xa0|DEV_bit|LBA_bit)
257           except for four drives per port chip    257           except for four drives per port chipsets.  For four drives
258           per port chipsets, it's (0xa0|DEV_bi    258           per port chipsets, it's (0xa0|DEV_bit|LBA_bit) for the first
259           pair and (0x80|DEV_bit|LBA_bit) for     259           pair and (0x80|DEV_bit|LBA_bit) for the second pair.
260                                                   260 
261           [5] The argument to the ioctl is a p    261           [5] The argument to the ioctl is a pointer to a region of
262           memory containing a ide_task_request    262           memory containing a ide_task_request_t structure, followed
263           by an optional buffer of data to be     263           by an optional buffer of data to be transmitted to the
264           drive, followed by an optional buffe    264           drive, followed by an optional buffer to receive data from
265           the drive.                              265           the drive.
266                                                   266 
267           Command is passed to the disk drive     267           Command is passed to the disk drive via the ide_task_request_t
268           structure, which contains these fiel    268           structure, which contains these fields:
269                                                   269 
270             ============        ==============    270             ============        ===============================================
271             io_ports[8]         values for the    271             io_ports[8]         values for the taskfile registers
272             hob_ports[8]        high-order byt    272             hob_ports[8]        high-order bytes, for extended commands
273             out_flags           flags indicati    273             out_flags           flags indicating which entries in the
274                                 io_ports[] and    274                                 io_ports[] and hob_ports[] arrays
275                                 contain valid     275                                 contain valid values.  Type ide_reg_valid_t.
276             in_flags            flags indicati    276             in_flags            flags indicating which entries in the
277                                 io_ports[] and    277                                 io_ports[] and hob_ports[] arrays
278                                 are expected t    278                                 are expected to contain valid values
279                                 on return.        279                                 on return.
280             data_phase          See below         280             data_phase          See below
281             req_cmd             Command type,     281             req_cmd             Command type, see below
282             out_size            output (user->    282             out_size            output (user->drive) buffer size, bytes
283             in_size             input (drive->    283             in_size             input (drive->user) buffer size, bytes
284             ============        ==============    284             ============        ===============================================
285                                                   285 
286           When out_flags is zero, the followin    286           When out_flags is zero, the following registers are loaded.
287                                                   287 
288             ============        ==============    288             ============        ===============================================
289             HOB_FEATURE         If the drive s    289             HOB_FEATURE         If the drive supports LBA48
290             HOB_NSECTOR         If the drive s    290             HOB_NSECTOR         If the drive supports LBA48
291             HOB_SECTOR          If the drive s    291             HOB_SECTOR          If the drive supports LBA48
292             HOB_LCYL            If the drive s    292             HOB_LCYL            If the drive supports LBA48
293             HOB_HCYL            If the drive s    293             HOB_HCYL            If the drive supports LBA48
294             FEATURE                               294             FEATURE
295             NSECTOR                               295             NSECTOR
296             SECTOR                                296             SECTOR
297             LCYL                                  297             LCYL
298             HCYL                                  298             HCYL
299             SELECT              First, masked     299             SELECT              First, masked with 0xE0 if LBA48, 0xEF
300                                 otherwise; the    300                                 otherwise; then, or'ed with the default
301                                 value of SELEC    301                                 value of SELECT.
302             ============        ==============    302             ============        ===============================================
303                                                   303 
304           If any bit in out_flags is set, the     304           If any bit in out_flags is set, the following registers are loaded.
305                                                   305 
306             ============        ==============    306             ============        ===============================================
307             HOB_DATA            If out_flags.b    307             HOB_DATA            If out_flags.b.data is set.  HOB_DATA will
308                                 travel on DD8-    308                                 travel on DD8-DD15 on little endian machines
309                                 and on DD0-DD7    309                                 and on DD0-DD7 on big endian machines.
310             DATA                If out_flags.b    310             DATA                If out_flags.b.data is set.  DATA will
311                                 travel on DD0-    311                                 travel on DD0-DD7 on little endian machines
312                                 and on DD8-DD1    312                                 and on DD8-DD15 on big endian machines.
313             HOB_NSECTOR         If out_flags.b    313             HOB_NSECTOR         If out_flags.b.nsector_hob is set
314             HOB_SECTOR          If out_flags.b    314             HOB_SECTOR          If out_flags.b.sector_hob is set
315             HOB_LCYL            If out_flags.b    315             HOB_LCYL            If out_flags.b.lcyl_hob is set
316             HOB_HCYL            If out_flags.b    316             HOB_HCYL            If out_flags.b.hcyl_hob is set
317             FEATURE             If out_flags.b    317             FEATURE             If out_flags.b.feature is set
318             NSECTOR             If out_flags.b    318             NSECTOR             If out_flags.b.nsector is set
319             SECTOR              If out_flags.b    319             SECTOR              If out_flags.b.sector is set
320             LCYL                If out_flags.b    320             LCYL                If out_flags.b.lcyl is set
321             HCYL                If out_flags.b    321             HCYL                If out_flags.b.hcyl is set
322             SELECT              Or'ed with the    322             SELECT              Or'ed with the default value of SELECT and
323                                 loaded regardl    323                                 loaded regardless of out_flags.b.select.
324             ============        ==============    324             ============        ===============================================
325                                                   325 
326           Taskfile registers are read back fro    326           Taskfile registers are read back from the drive into
327           {io|hob}_ports[] after the command c    327           {io|hob}_ports[] after the command completes iff one of the
328           following conditions is met; otherwi    328           following conditions is met; otherwise, the original values
329           will be written back, unchanged.        329           will be written back, unchanged.
330                                                   330 
331             1. The drive fails the command (EI    331             1. The drive fails the command (EIO).
332             2. One or more than one bits are s    332             2. One or more than one bits are set in out_flags.
333             3. The requested data_phase is TAS    333             3. The requested data_phase is TASKFILE_NO_DATA.
334                                                   334 
335             ============        ==============    335             ============        ===============================================
336             HOB_DATA            If in_flags.b.    336             HOB_DATA            If in_flags.b.data is set.  It will contain
337                                 DD8-DD15 on li    337                                 DD8-DD15 on little endian machines and
338                                 DD0-DD7 on big    338                                 DD0-DD7 on big endian machines.
339             DATA                If in_flags.b.    339             DATA                If in_flags.b.data is set.  It will contain
340                                 DD0-DD7 on lit    340                                 DD0-DD7 on little endian machines and
341                                 DD8-DD15 on bi    341                                 DD8-DD15 on big endian machines.
342             HOB_FEATURE         If the drive s    342             HOB_FEATURE         If the drive supports LBA48
343             HOB_NSECTOR         If the drive s    343             HOB_NSECTOR         If the drive supports LBA48
344             HOB_SECTOR          If the drive s    344             HOB_SECTOR          If the drive supports LBA48
345             HOB_LCYL            If the drive s    345             HOB_LCYL            If the drive supports LBA48
346             HOB_HCYL            If the drive s    346             HOB_HCYL            If the drive supports LBA48
347             NSECTOR                               347             NSECTOR
348             SECTOR                                348             SECTOR
349             LCYL                                  349             LCYL
350             HCYL                                  350             HCYL
351             ============        ==============    351             ============        ===============================================
352                                                   352 
353           The data_phase field describes the d    353           The data_phase field describes the data transfer to be
354           performed.  Value is one of:            354           performed.  Value is one of:
355                                                   355 
356             ===================        =======    356             ===================        ========================================
357             TASKFILE_IN                           357             TASKFILE_IN
358             TASKFILE_MULTI_IN                     358             TASKFILE_MULTI_IN
359             TASKFILE_OUT                          359             TASKFILE_OUT
360             TASKFILE_MULTI_OUT                    360             TASKFILE_MULTI_OUT
361             TASKFILE_IN_OUT                       361             TASKFILE_IN_OUT
362             TASKFILE_IN_DMA                       362             TASKFILE_IN_DMA
363             TASKFILE_IN_DMAQ            == IN_    363             TASKFILE_IN_DMAQ            == IN_DMA (queueing not supported)
364             TASKFILE_OUT_DMA                      364             TASKFILE_OUT_DMA
365             TASKFILE_OUT_DMAQ           == OUT    365             TASKFILE_OUT_DMAQ           == OUT_DMA (queueing not supported)
366             TASKFILE_P_IN               unimpl    366             TASKFILE_P_IN               unimplemented
367             TASKFILE_P_IN_DMA           unimpl    367             TASKFILE_P_IN_DMA           unimplemented
368             TASKFILE_P_IN_DMAQ          unimpl    368             TASKFILE_P_IN_DMAQ          unimplemented
369             TASKFILE_P_OUT              unimpl    369             TASKFILE_P_OUT              unimplemented
370             TASKFILE_P_OUT_DMA          unimpl    370             TASKFILE_P_OUT_DMA          unimplemented
371             TASKFILE_P_OUT_DMAQ         unimpl    371             TASKFILE_P_OUT_DMAQ         unimplemented
372             ===================        =======    372             ===================        ========================================
373                                                   373 
374           The req_cmd field classifies the com    374           The req_cmd field classifies the command type.  It may be
375           one of:                                 375           one of:
376                                                   376 
377             ========================    ======    377             ========================    =======================================
378             IDE_DRIVE_TASK_NO_DATA                378             IDE_DRIVE_TASK_NO_DATA
379             IDE_DRIVE_TASK_SET_XFER     unimpl    379             IDE_DRIVE_TASK_SET_XFER     unimplemented
380             IDE_DRIVE_TASK_IN                     380             IDE_DRIVE_TASK_IN
381             IDE_DRIVE_TASK_OUT          unimpl    381             IDE_DRIVE_TASK_OUT          unimplemented
382             IDE_DRIVE_TASK_RAW_WRITE              382             IDE_DRIVE_TASK_RAW_WRITE
383             ========================    ======    383             ========================    =======================================
384                                                   384 
385           [6] Do not access {in|out}_flags->al    385           [6] Do not access {in|out}_flags->all except for resetting
386           all the bits.  Always access individ    386           all the bits.  Always access individual bit fields.  ->all
387           value will flip depending on endiann    387           value will flip depending on endianness.  For the same
388           reason, do not use IDE_{TASKFILE|HOB    388           reason, do not use IDE_{TASKFILE|HOB}_STD_{OUT|IN}_FLAGS
389           constants defined in hdreg.h.           389           constants defined in hdreg.h.
390                                                   390 
391                                                   391 
392                                                   392 
393 HDIO_DRIVE_CMD                                    393 HDIO_DRIVE_CMD
394         execute a special drive command           394         execute a special drive command
395                                                   395 
396                                                   396 
397         Note:  If you don't have a copy of the    397         Note:  If you don't have a copy of the ANSI ATA specification
398         handy, you should probably ignore this    398         handy, you should probably ignore this ioctl.
399                                                   399 
400         usage::                                   400         usage::
401                                                   401 
402           u8 args[4+XFER_SIZE];                   402           u8 args[4+XFER_SIZE];
403                                                   403 
404           ...                                     404           ...
405           ioctl(fd, HDIO_DRIVE_CMD, args);        405           ioctl(fd, HDIO_DRIVE_CMD, args);
406                                                   406 
407         inputs:                                   407         inputs:
408             Commands other than WIN_SMART:        408             Commands other than WIN_SMART:
409                                                   409 
410             =======     =======                   410             =======     =======
411             args[0]     COMMAND                   411             args[0]     COMMAND
412             args[1]     NSECTOR                   412             args[1]     NSECTOR
413             args[2]     FEATURE                   413             args[2]     FEATURE
414             args[3]     NSECTOR                   414             args[3]     NSECTOR
415             =======     =======                   415             =======     =======
416                                                   416 
417             WIN_SMART:                            417             WIN_SMART:
418                                                   418 
419             =======     =======                   419             =======     =======
420             args[0]     COMMAND                   420             args[0]     COMMAND
421             args[1]     SECTOR                    421             args[1]     SECTOR
422             args[2]     FEATURE                   422             args[2]     FEATURE
423             args[3]     NSECTOR                   423             args[3]     NSECTOR
424             =======     =======                   424             =======     =======
425                                                   425 
426         outputs:                                  426         outputs:
427                 args[] buffer is filled with r    427                 args[] buffer is filled with register values followed by any
428                                                   428 
429                                                   429 
430           data returned by the disk.              430           data returned by the disk.
431                                                   431 
432             ========    ======================    432             ========    ====================================================
433             args[0]     status                    433             args[0]     status
434             args[1]     error                     434             args[1]     error
435             args[2]     NSECTOR                   435             args[2]     NSECTOR
436             args[3]     undefined                 436             args[3]     undefined
437             args[4+]    NSECTOR * 512 bytes of    437             args[4+]    NSECTOR * 512 bytes of data returned by the command.
438             ========    ======================    438             ========    ====================================================
439                                                   439 
440         error returns:                            440         error returns:
441           - EACCES      Access denied:  requir    441           - EACCES      Access denied:  requires CAP_SYS_RAWIO
442           - ENOMEM      Unable to allocate mem    442           - ENOMEM      Unable to allocate memory for task
443           - EIO         Drive reports error       443           - EIO         Drive reports error
444                                                   444 
445         notes:                                    445         notes:
446                                                   446 
447           [1] For commands other than WIN_SMAR    447           [1] For commands other than WIN_SMART, args[1] should equal
448           args[3].  SECTOR, LCYL and HCYL are     448           args[3].  SECTOR, LCYL and HCYL are undefined.  For
449           WIN_SMART, 0x4f and 0xc2 are loaded     449           WIN_SMART, 0x4f and 0xc2 are loaded into LCYL and HCYL
450           respectively.  In both cases SELECT     450           respectively.  In both cases SELECT will contain the default
451           value for the drive.  Please refer t    451           value for the drive.  Please refer to HDIO_DRIVE_TASKFILE
452           notes for the default value of SELEC    452           notes for the default value of SELECT.
453                                                   453 
454           [2] If NSECTOR value is greater than    454           [2] If NSECTOR value is greater than zero and the drive sets
455           DRQ when interrupting for the comman    455           DRQ when interrupting for the command, NSECTOR * 512 bytes
456           are read from the device into the ar    456           are read from the device into the area following NSECTOR.
457           In the above example, the area would    457           In the above example, the area would be
458           args[4..4+XFER_SIZE].  16bit PIO is     458           args[4..4+XFER_SIZE].  16bit PIO is used regardless of
459           HDIO_SET_32BIT setting.                 459           HDIO_SET_32BIT setting.
460                                                   460 
461           [3] If COMMAND == WIN_SETFEATURES &&    461           [3] If COMMAND == WIN_SETFEATURES && FEATURE == SETFEATURES_XFER
462           && NSECTOR >= XFER_SW_DMA_0 && the d    462           && NSECTOR >= XFER_SW_DMA_0 && the drive supports any DMA
463           mode, IDE driver will try to tune th    463           mode, IDE driver will try to tune the transfer mode of the
464           drive accordingly.                      464           drive accordingly.
465                                                   465 
466                                                   466 
467                                                   467 
468 HDIO_DRIVE_TASK                                   468 HDIO_DRIVE_TASK
469         execute task and special drive command    469         execute task and special drive command
470                                                   470 
471                                                   471 
472         Note:  If you don't have a copy of the    472         Note:  If you don't have a copy of the ANSI ATA specification
473         handy, you should probably ignore this    473         handy, you should probably ignore this ioctl.
474                                                   474 
475         usage::                                   475         usage::
476                                                   476 
477           u8 args[7];                             477           u8 args[7];
478                                                   478 
479           ...                                     479           ...
480           ioctl(fd, HDIO_DRIVE_TASK, args);       480           ioctl(fd, HDIO_DRIVE_TASK, args);
481                                                   481 
482         inputs:                                   482         inputs:
483             Taskfile register values:             483             Taskfile register values:
484                                                   484 
485             =======     =======                   485             =======     =======
486             args[0]     COMMAND                   486             args[0]     COMMAND
487             args[1]     FEATURE                   487             args[1]     FEATURE
488             args[2]     NSECTOR                   488             args[2]     NSECTOR
489             args[3]     SECTOR                    489             args[3]     SECTOR
490             args[4]     LCYL                      490             args[4]     LCYL
491             args[5]     HCYL                      491             args[5]     HCYL
492             args[6]     SELECT                    492             args[6]     SELECT
493             =======     =======                   493             =======     =======
494                                                   494 
495         outputs:                                  495         outputs:
496             Taskfile register values:             496             Taskfile register values:
497                                                   497 
498                                                   498 
499             =======     =======                   499             =======     =======
500             args[0]     status                    500             args[0]     status
501             args[1]     error                     501             args[1]     error
502             args[2]     NSECTOR                   502             args[2]     NSECTOR
503             args[3]     SECTOR                    503             args[3]     SECTOR
504             args[4]     LCYL                      504             args[4]     LCYL
505             args[5]     HCYL                      505             args[5]     HCYL
506             args[6]     SELECT                    506             args[6]     SELECT
507             =======     =======                   507             =======     =======
508                                                   508 
509         error returns:                            509         error returns:
510           - EACCES      Access denied:  requir    510           - EACCES      Access denied:  requires CAP_SYS_RAWIO
511           - ENOMEM      Unable to allocate mem    511           - ENOMEM      Unable to allocate memory for task
512           - ENOMSG      Device is not a disk d    512           - ENOMSG      Device is not a disk drive.
513           - EIO         Drive failed the comma    513           - EIO         Drive failed the command.
514                                                   514 
515         notes:                                    515         notes:
516                                                   516 
517           [1] DEV bit (0x10) of SELECT registe    517           [1] DEV bit (0x10) of SELECT register is ignored and the
518           appropriate value for the drive is u    518           appropriate value for the drive is used.  All other bits
519           are used unaltered.                     519           are used unaltered.
520                                                   520 
521                                                   521 
522                                                   522 
523 HDIO_SET_32BIT                                    523 HDIO_SET_32BIT
524         change io_32bit flags                     524         change io_32bit flags
525                                                   525 
526                                                   526 
527         usage::                                   527         usage::
528                                                   528 
529           int val;                                529           int val;
530                                                   530 
531           ioctl(fd, HDIO_SET_32BIT, val);         531           ioctl(fd, HDIO_SET_32BIT, val);
532                                                   532 
533         inputs:                                   533         inputs:
534                 New value for io_32bit flag       534                 New value for io_32bit flag
535                                                   535 
536                                                   536 
537                                                   537 
538         outputs:                                  538         outputs:
539                 none                              539                 none
540                                                   540 
541                                                   541 
542                                                   542 
543         error return:                             543         error return:
544           - EINVAL      Called on a partition     544           - EINVAL      Called on a partition instead of the whole disk device
545           - EACCES      Access denied:  requir    545           - EACCES      Access denied:  requires CAP_SYS_ADMIN
546           - EINVAL      value out of range [0     546           - EINVAL      value out of range [0 3]
547           - EBUSY       Controller busy           547           - EBUSY       Controller busy
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php