hdreg.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717
  1. #ifndef _LINUX_HDREG_H
  2. #define _LINUX_HDREG_H
  3. #ifdef __KERNEL__
  4. #include <linux/ata.h>
  5. /*
  6. * This file contains some defines for the AT-hd-controller.
  7. * Various sources.
  8. */
  9. /* ide.c has its own port definitions in "ide.h" */
  10. #define HD_IRQ 14
  11. /* Hd controller regs. Ref: IBM AT Bios-listing */
  12. #define HD_DATA 0x1f0 /* _CTL when writing */
  13. #define HD_ERROR 0x1f1 /* see err-bits */
  14. #define HD_NSECTOR 0x1f2 /* nr of sectors to read/write */
  15. #define HD_SECTOR 0x1f3 /* starting sector */
  16. #define HD_LCYL 0x1f4 /* starting cylinder */
  17. #define HD_HCYL 0x1f5 /* high byte of starting cyl */
  18. #define HD_CURRENT 0x1f6 /* 101dhhhh , d=drive, hhhh=head */
  19. #define HD_STATUS 0x1f7 /* see status-bits */
  20. #define HD_FEATURE HD_ERROR /* same io address, read=error, write=feature */
  21. #define HD_PRECOMP HD_FEATURE /* obsolete use of this port - predates IDE */
  22. #define HD_COMMAND HD_STATUS /* same io address, read=status, write=cmd */
  23. #define HD_CMD 0x3f6 /* used for resets */
  24. #define HD_ALTSTATUS 0x3f6 /* same as HD_STATUS but doesn't clear irq */
  25. /* remainder is shared between hd.c, ide.c, ide-cd.c, and the hdparm utility */
  26. /* Bits of HD_STATUS */
  27. #define ERR_STAT 0x01
  28. #define INDEX_STAT 0x02
  29. #define ECC_STAT 0x04 /* Corrected error */
  30. #define DRQ_STAT 0x08
  31. #define SEEK_STAT 0x10
  32. #define SRV_STAT 0x10
  33. #define WRERR_STAT 0x20
  34. #define READY_STAT 0x40
  35. #define BUSY_STAT 0x80
  36. /* Bits for HD_ERROR */
  37. #define MARK_ERR 0x01 /* Bad address mark */
  38. #define ILI_ERR 0x01 /* Illegal Length Indication (ATAPI) */
  39. #define TRK0_ERR 0x02 /* couldn't find track 0 */
  40. #define EOM_ERR 0x02 /* End Of Media (ATAPI) */
  41. #define ABRT_ERR 0x04 /* Command aborted */
  42. #define MCR_ERR 0x08 /* media change request */
  43. #define ID_ERR 0x10 /* ID field not found */
  44. #define MC_ERR 0x20 /* media changed */
  45. #define ECC_ERR 0x40 /* Uncorrectable ECC error */
  46. #define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */
  47. #define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */
  48. #define LFS_ERR 0xf0 /* Last Failed Sense (ATAPI) */
  49. /* Bits of HD_NSECTOR */
  50. #define CD 0x01
  51. #define IO 0x02
  52. #define REL 0x04
  53. #define TAG_MASK 0xf8
  54. #endif /* __KERNEL__ */
  55. #include <linux/types.h>
  56. /*
  57. * Command Header sizes for IOCTL commands
  58. */
  59. #define HDIO_DRIVE_CMD_HDR_SIZE (4 * sizeof(__u8))
  60. #define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(__u8))
  61. #define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(__u8))
  62. #define IDE_DRIVE_TASK_NO_DATA 0
  63. #ifndef __KERNEL__
  64. #define IDE_DRIVE_TASK_INVALID -1
  65. #define IDE_DRIVE_TASK_SET_XFER 1
  66. #define IDE_DRIVE_TASK_IN 2
  67. #define IDE_DRIVE_TASK_OUT 3
  68. #endif
  69. #define IDE_DRIVE_TASK_RAW_WRITE 4
  70. /*
  71. * Define standard taskfile in/out register
  72. */
  73. #define IDE_TASKFILE_STD_IN_FLAGS 0xFE
  74. #define IDE_HOB_STD_IN_FLAGS 0x3C
  75. #ifndef __KERNEL__
  76. #define IDE_TASKFILE_STD_OUT_FLAGS 0xFE
  77. #define IDE_HOB_STD_OUT_FLAGS 0x3C
  78. typedef unsigned char task_ioreg_t;
  79. typedef unsigned long sata_ioreg_t;
  80. #endif
  81. typedef union ide_reg_valid_s {
  82. unsigned all : 16;
  83. struct {
  84. unsigned data : 1;
  85. unsigned error_feature : 1;
  86. unsigned sector : 1;
  87. unsigned nsector : 1;
  88. unsigned lcyl : 1;
  89. unsigned hcyl : 1;
  90. unsigned select : 1;
  91. unsigned status_command : 1;
  92. unsigned data_hob : 1;
  93. unsigned error_feature_hob : 1;
  94. unsigned sector_hob : 1;
  95. unsigned nsector_hob : 1;
  96. unsigned lcyl_hob : 1;
  97. unsigned hcyl_hob : 1;
  98. unsigned select_hob : 1;
  99. unsigned control_hob : 1;
  100. } b;
  101. } ide_reg_valid_t;
  102. typedef struct ide_task_request_s {
  103. __u8 io_ports[8];
  104. __u8 hob_ports[8]; /* bytes 6 and 7 are unused */
  105. ide_reg_valid_t out_flags;
  106. ide_reg_valid_t in_flags;
  107. int data_phase;
  108. int req_cmd;
  109. unsigned long out_size;
  110. unsigned long in_size;
  111. } ide_task_request_t;
  112. typedef struct ide_ioctl_request_s {
  113. ide_task_request_t *task_request;
  114. unsigned char *out_buffer;
  115. unsigned char *in_buffer;
  116. } ide_ioctl_request_t;
  117. struct hd_drive_cmd_hdr {
  118. __u8 command;
  119. __u8 sector_number;
  120. __u8 feature;
  121. __u8 sector_count;
  122. };
  123. #ifndef __KERNEL__
  124. typedef struct hd_drive_task_hdr {
  125. __u8 data;
  126. __u8 feature;
  127. __u8 sector_count;
  128. __u8 sector_number;
  129. __u8 low_cylinder;
  130. __u8 high_cylinder;
  131. __u8 device_head;
  132. __u8 command;
  133. } task_struct_t;
  134. typedef struct hd_drive_hob_hdr {
  135. __u8 data;
  136. __u8 feature;
  137. __u8 sector_count;
  138. __u8 sector_number;
  139. __u8 low_cylinder;
  140. __u8 high_cylinder;
  141. __u8 device_head;
  142. __u8 control;
  143. } hob_struct_t;
  144. #endif
  145. #define TASKFILE_NO_DATA 0x0000
  146. #define TASKFILE_IN 0x0001
  147. #define TASKFILE_MULTI_IN 0x0002
  148. #define TASKFILE_OUT 0x0004
  149. #define TASKFILE_MULTI_OUT 0x0008
  150. #define TASKFILE_IN_OUT 0x0010
  151. #define TASKFILE_IN_DMA 0x0020
  152. #define TASKFILE_OUT_DMA 0x0040
  153. #define TASKFILE_IN_DMAQ 0x0080
  154. #define TASKFILE_OUT_DMAQ 0x0100
  155. #ifndef __KERNEL__
  156. #define TASKFILE_P_IN 0x0200
  157. #define TASKFILE_P_OUT 0x0400
  158. #define TASKFILE_P_IN_DMA 0x0800
  159. #define TASKFILE_P_OUT_DMA 0x1000
  160. #define TASKFILE_P_IN_DMAQ 0x2000
  161. #define TASKFILE_P_OUT_DMAQ 0x4000
  162. #define TASKFILE_48 0x8000
  163. #define TASKFILE_INVALID 0x7fff
  164. #endif
  165. /* ATA/ATAPI Commands pre T13 Spec */
  166. #define WIN_NOP 0x00
  167. /*
  168. * 0x01->0x02 Reserved
  169. */
  170. #define CFA_REQ_EXT_ERROR_CODE 0x03 /* CFA Request Extended Error Code */
  171. /*
  172. * 0x04->0x07 Reserved
  173. */
  174. #define WIN_SRST 0x08 /* ATAPI soft reset command */
  175. #define WIN_DEVICE_RESET 0x08
  176. /*
  177. * 0x09->0x0F Reserved
  178. */
  179. #define WIN_RECAL 0x10
  180. #define WIN_RESTORE WIN_RECAL
  181. /*
  182. * 0x10->0x1F Reserved
  183. */
  184. #define WIN_READ 0x20 /* 28-Bit */
  185. #define WIN_READ_ONCE 0x21 /* 28-Bit without retries */
  186. #define WIN_READ_LONG 0x22 /* 28-Bit */
  187. #define WIN_READ_LONG_ONCE 0x23 /* 28-Bit without retries */
  188. #define WIN_READ_EXT 0x24 /* 48-Bit */
  189. #define WIN_READDMA_EXT 0x25 /* 48-Bit */
  190. #define WIN_READDMA_QUEUED_EXT 0x26 /* 48-Bit */
  191. #define WIN_READ_NATIVE_MAX_EXT 0x27 /* 48-Bit */
  192. /*
  193. * 0x28
  194. */
  195. #define WIN_MULTREAD_EXT 0x29 /* 48-Bit */
  196. /*
  197. * 0x2A->0x2F Reserved
  198. */
  199. #define WIN_WRITE 0x30 /* 28-Bit */
  200. #define WIN_WRITE_ONCE 0x31 /* 28-Bit without retries */
  201. #define WIN_WRITE_LONG 0x32 /* 28-Bit */
  202. #define WIN_WRITE_LONG_ONCE 0x33 /* 28-Bit without retries */
  203. #define WIN_WRITE_EXT 0x34 /* 48-Bit */
  204. #define WIN_WRITEDMA_EXT 0x35 /* 48-Bit */
  205. #define WIN_WRITEDMA_QUEUED_EXT 0x36 /* 48-Bit */
  206. #define WIN_SET_MAX_EXT 0x37 /* 48-Bit */
  207. #define CFA_WRITE_SECT_WO_ERASE 0x38 /* CFA Write Sectors without erase */
  208. #define WIN_MULTWRITE_EXT 0x39 /* 48-Bit */
  209. /*
  210. * 0x3A->0x3B Reserved
  211. */
  212. #define WIN_WRITE_VERIFY 0x3C /* 28-Bit */
  213. /*
  214. * 0x3D->0x3F Reserved
  215. */
  216. #define WIN_VERIFY 0x40 /* 28-Bit - Read Verify Sectors */
  217. #define WIN_VERIFY_ONCE 0x41 /* 28-Bit - without retries */
  218. #define WIN_VERIFY_EXT 0x42 /* 48-Bit */
  219. /*
  220. * 0x43->0x4F Reserved
  221. */
  222. #define WIN_FORMAT 0x50
  223. /*
  224. * 0x51->0x5F Reserved
  225. */
  226. #define WIN_INIT 0x60
  227. /*
  228. * 0x61->0x5F Reserved
  229. */
  230. #define WIN_SEEK 0x70 /* 0x70-0x7F Reserved */
  231. #define CFA_TRANSLATE_SECTOR 0x87 /* CFA Translate Sector */
  232. #define WIN_DIAGNOSE 0x90
  233. #define WIN_SPECIFY 0x91 /* set drive geometry translation */
  234. #define WIN_DOWNLOAD_MICROCODE 0x92
  235. #define WIN_STANDBYNOW2 0x94
  236. #define WIN_STANDBY2 0x96
  237. #define WIN_SETIDLE2 0x97
  238. #define WIN_CHECKPOWERMODE2 0x98
  239. #define WIN_SLEEPNOW2 0x99
  240. /*
  241. * 0x9A VENDOR
  242. */
  243. #define WIN_PACKETCMD 0xA0 /* Send a packet command. */
  244. #define WIN_PIDENTIFY 0xA1 /* identify ATAPI device */
  245. #define WIN_QUEUED_SERVICE 0xA2
  246. #define WIN_SMART 0xB0 /* self-monitoring and reporting */
  247. #define CFA_ERASE_SECTORS 0xC0
  248. #define WIN_MULTREAD 0xC4 /* read sectors using multiple mode*/
  249. #define WIN_MULTWRITE 0xC5 /* write sectors using multiple mode */
  250. #define WIN_SETMULT 0xC6 /* enable/disable multiple mode */
  251. #define WIN_READDMA_QUEUED 0xC7 /* read sectors using Queued DMA transfers */
  252. #define WIN_READDMA 0xC8 /* read sectors using DMA transfers */
  253. #define WIN_READDMA_ONCE 0xC9 /* 28-Bit - without retries */
  254. #define WIN_WRITEDMA 0xCA /* write sectors using DMA transfers */
  255. #define WIN_WRITEDMA_ONCE 0xCB /* 28-Bit - without retries */
  256. #define WIN_WRITEDMA_QUEUED 0xCC /* write sectors using Queued DMA transfers */
  257. #define CFA_WRITE_MULTI_WO_ERASE 0xCD /* CFA Write multiple without erase */
  258. #define WIN_GETMEDIASTATUS 0xDA
  259. #define WIN_ACKMEDIACHANGE 0xDB /* ATA-1, ATA-2 vendor */
  260. #define WIN_POSTBOOT 0xDC
  261. #define WIN_PREBOOT 0xDD
  262. #define WIN_DOORLOCK 0xDE /* lock door on removable drives */
  263. #define WIN_DOORUNLOCK 0xDF /* unlock door on removable drives */
  264. #define WIN_STANDBYNOW1 0xE0
  265. #define WIN_IDLEIMMEDIATE 0xE1 /* force drive to become "ready" */
  266. #define WIN_STANDBY 0xE2 /* Set device in Standby Mode */
  267. #define WIN_SETIDLE1 0xE3
  268. #define WIN_READ_BUFFER 0xE4 /* force read only 1 sector */
  269. #define WIN_CHECKPOWERMODE1 0xE5
  270. #define WIN_SLEEPNOW1 0xE6
  271. #define WIN_FLUSH_CACHE 0xE7
  272. #define WIN_WRITE_BUFFER 0xE8 /* force write only 1 sector */
  273. #define WIN_WRITE_SAME 0xE9 /* read ata-2 to use */
  274. /* SET_FEATURES 0x22 or 0xDD */
  275. #define WIN_FLUSH_CACHE_EXT 0xEA /* 48-Bit */
  276. #define WIN_IDENTIFY 0xEC /* ask drive to identify itself */
  277. #define WIN_MEDIAEJECT 0xED
  278. #define WIN_IDENTIFY_DMA 0xEE /* same as WIN_IDENTIFY, but DMA */
  279. #define WIN_SETFEATURES 0xEF /* set special drive features */
  280. #define EXABYTE_ENABLE_NEST 0xF0
  281. #define WIN_SECURITY_SET_PASS 0xF1
  282. #define WIN_SECURITY_UNLOCK 0xF2
  283. #define WIN_SECURITY_ERASE_PREPARE 0xF3
  284. #define WIN_SECURITY_ERASE_UNIT 0xF4
  285. #define WIN_SECURITY_FREEZE_LOCK 0xF5
  286. #define WIN_SECURITY_DISABLE 0xF6
  287. #define WIN_READ_NATIVE_MAX 0xF8 /* return the native maximum address */
  288. #define WIN_SET_MAX 0xF9
  289. #define DISABLE_SEAGATE 0xFB
  290. /* WIN_SMART sub-commands */
  291. #define SMART_READ_VALUES 0xD0
  292. #define SMART_READ_THRESHOLDS 0xD1
  293. #define SMART_AUTOSAVE 0xD2
  294. #define SMART_SAVE 0xD3
  295. #define SMART_IMMEDIATE_OFFLINE 0xD4
  296. #define SMART_READ_LOG_SECTOR 0xD5
  297. #define SMART_WRITE_LOG_SECTOR 0xD6
  298. #define SMART_WRITE_THRESHOLDS 0xD7
  299. #define SMART_ENABLE 0xD8
  300. #define SMART_DISABLE 0xD9
  301. #define SMART_STATUS 0xDA
  302. #define SMART_AUTO_OFFLINE 0xDB
  303. /* Password used in TF4 & TF5 executing SMART commands */
  304. #define SMART_LCYL_PASS 0x4F
  305. #define SMART_HCYL_PASS 0xC2
  306. /* WIN_SETFEATURES sub-commands */
  307. #define SETFEATURES_EN_8BIT 0x01 /* Enable 8-Bit Transfers */
  308. #define SETFEATURES_EN_WCACHE 0x02 /* Enable write cache */
  309. #define SETFEATURES_DIS_DEFECT 0x04 /* Disable Defect Management */
  310. #define SETFEATURES_EN_APM 0x05 /* Enable advanced power management */
  311. #define SETFEATURES_EN_SAME_R 0x22 /* for a region ATA-1 */
  312. #define SETFEATURES_DIS_MSN 0x31 /* Disable Media Status Notification */
  313. #define SETFEATURES_DIS_RETRY 0x33 /* Disable Retry */
  314. #define SETFEATURES_EN_AAM 0x42 /* Enable Automatic Acoustic Management */
  315. #define SETFEATURES_RW_LONG 0x44 /* Set Length of VS bytes */
  316. #define SETFEATURES_SET_CACHE 0x54 /* Set Cache segments to SC Reg. Val */
  317. #define SETFEATURES_DIS_RLA 0x55 /* Disable read look-ahead feature */
  318. #define SETFEATURES_EN_RI 0x5D /* Enable release interrupt */
  319. #define SETFEATURES_EN_SI 0x5E /* Enable SERVICE interrupt */
  320. #define SETFEATURES_DIS_RPOD 0x66 /* Disable reverting to power on defaults */
  321. #define SETFEATURES_DIS_ECC 0x77 /* Disable ECC byte count */
  322. #define SETFEATURES_DIS_8BIT 0x81 /* Disable 8-Bit Transfers */
  323. #define SETFEATURES_DIS_WCACHE 0x82 /* Disable write cache */
  324. #define SETFEATURES_EN_DEFECT 0x84 /* Enable Defect Management */
  325. #define SETFEATURES_DIS_APM 0x85 /* Disable advanced power management */
  326. #define SETFEATURES_EN_ECC 0x88 /* Enable ECC byte count */
  327. #define SETFEATURES_EN_MSN 0x95 /* Enable Media Status Notification */
  328. #define SETFEATURES_EN_RETRY 0x99 /* Enable Retry */
  329. #define SETFEATURES_EN_RLA 0xAA /* Enable read look-ahead feature */
  330. #define SETFEATURES_PREFETCH 0xAB /* Sets drive prefetch value */
  331. #define SETFEATURES_EN_REST 0xAC /* ATA-1 */
  332. #define SETFEATURES_4B_RW_LONG 0xBB /* Set Length of 4 bytes */
  333. #define SETFEATURES_DIS_AAM 0xC2 /* Disable Automatic Acoustic Management */
  334. #define SETFEATURES_EN_RPOD 0xCC /* Enable reverting to power on defaults */
  335. #define SETFEATURES_DIS_RI 0xDD /* Disable release interrupt ATAPI */
  336. #define SETFEATURES_EN_SAME_M 0xDD /* for a entire device ATA-1 */
  337. #define SETFEATURES_DIS_SI 0xDE /* Disable SERVICE interrupt ATAPI */
  338. /* WIN_SECURITY sub-commands */
  339. #define SECURITY_SET_PASSWORD 0xBA
  340. #define SECURITY_UNLOCK 0xBB
  341. #define SECURITY_ERASE_PREPARE 0xBC
  342. #define SECURITY_ERASE_UNIT 0xBD
  343. #define SECURITY_FREEZE_LOCK 0xBE
  344. #define SECURITY_DISABLE_PASSWORD 0xBF
  345. struct hd_geometry {
  346. unsigned char heads;
  347. unsigned char sectors;
  348. unsigned short cylinders;
  349. unsigned long start;
  350. };
  351. /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
  352. #define HDIO_GETGEO 0x0301 /* get device geometry */
  353. #define HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */
  354. #define HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */
  355. #define HDIO_GET_QDMA 0x0305 /* get use-qdma flag */
  356. #define HDIO_SET_XFER 0x0306 /* set transfer rate via proc */
  357. #define HDIO_OBSOLETE_IDENTITY 0x0307 /* OBSOLETE, DO NOT USE: returns 142 bytes */
  358. #define HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */
  359. #define HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */
  360. #define HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */
  361. #define HDIO_GET_DMA 0x030b /* get use-dma flag */
  362. #define HDIO_GET_NICE 0x030c /* get nice flags */
  363. #define HDIO_GET_IDENTITY 0x030d /* get IDE identification info */
  364. #define HDIO_GET_WCACHE 0x030e /* get write cache mode on|off */
  365. #define HDIO_GET_ACOUSTIC 0x030f /* get acoustic value */
  366. #define HDIO_GET_ADDRESS 0x0310 /* */
  367. #define HDIO_GET_BUSSTATE 0x031a /* get the bus state of the hwif */
  368. #define HDIO_TRISTATE_HWIF 0x031b /* execute a channel tristate */
  369. #define HDIO_DRIVE_RESET 0x031c /* execute a device reset */
  370. #define HDIO_DRIVE_TASKFILE 0x031d /* execute raw taskfile */
  371. #define HDIO_DRIVE_TASK 0x031e /* execute task and special drive command */
  372. #define HDIO_DRIVE_CMD 0x031f /* execute a special drive command */
  373. #define HDIO_DRIVE_CMD_AEB HDIO_DRIVE_TASK
  374. /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
  375. #define HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */
  376. #define HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */
  377. #define HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */
  378. #define HDIO_SET_32BIT 0x0324 /* change io_32bit flags */
  379. #define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */
  380. #define HDIO_SET_DMA 0x0326 /* change use-dma flag */
  381. #define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */
  382. #ifndef __KERNEL__
  383. #define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */
  384. #define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */
  385. #endif
  386. #define HDIO_SET_NICE 0x0329 /* set nice flags */
  387. #define HDIO_SET_WCACHE 0x032b /* change write cache enable-disable */
  388. #define HDIO_SET_ACOUSTIC 0x032c /* change acoustic behavior */
  389. #define HDIO_SET_BUSSTATE 0x032d /* set the bus state of the hwif */
  390. #define HDIO_SET_QDMA 0x032e /* change use-qdma flag */
  391. #define HDIO_SET_ADDRESS 0x032f /* change lba addressing modes */
  392. /* bus states */
  393. enum {
  394. BUSSTATE_OFF = 0,
  395. BUSSTATE_ON,
  396. BUSSTATE_TRISTATE
  397. };
  398. /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x033n/0x033n */
  399. /* 0x330 is reserved - used to be HDIO_GETGEO_BIG */
  400. /* 0x331 is reserved - used to be HDIO_GETGEO_BIG_RAW */
  401. /* 0x338 is reserved - used to be HDIO_SET_IDE_SCSI */
  402. /* 0x339 is reserved - used to be HDIO_SET_SCSI_IDE */
  403. #define __NEW_HD_DRIVE_ID
  404. /*
  405. * Structure returned by HDIO_GET_IDENTITY, as per ANSI NCITS ATA6 rev.1b spec.
  406. *
  407. * If you change something here, please remember to update fix_driveid() in
  408. * ide/probe.c.
  409. */
  410. struct hd_driveid {
  411. unsigned short config; /* lots of obsolete bit flags */
  412. unsigned short cyls; /* Obsolete, "physical" cyls */
  413. unsigned short reserved2; /* reserved (word 2) */
  414. unsigned short heads; /* Obsolete, "physical" heads */
  415. unsigned short track_bytes; /* unformatted bytes per track */
  416. unsigned short sector_bytes; /* unformatted bytes per sector */
  417. unsigned short sectors; /* Obsolete, "physical" sectors per track */
  418. unsigned short vendor0; /* vendor unique */
  419. unsigned short vendor1; /* vendor unique */
  420. unsigned short vendor2; /* Retired vendor unique */
  421. unsigned char serial_no[20]; /* 0 = not_specified */
  422. unsigned short buf_type; /* Retired */
  423. unsigned short buf_size; /* Retired, 512 byte increments
  424. * 0 = not_specified
  425. */
  426. unsigned short ecc_bytes; /* for r/w long cmds; 0 = not_specified */
  427. unsigned char fw_rev[8]; /* 0 = not_specified */
  428. unsigned char model[40]; /* 0 = not_specified */
  429. unsigned char max_multsect; /* 0=not_implemented */
  430. unsigned char vendor3; /* vendor unique */
  431. unsigned short dword_io; /* 0=not_implemented; 1=implemented */
  432. unsigned char vendor4; /* vendor unique */
  433. unsigned char capability; /* (upper byte of word 49)
  434. * 3: IORDYsup
  435. * 2: IORDYsw
  436. * 1: LBA
  437. * 0: DMA
  438. */
  439. unsigned short reserved50; /* reserved (word 50) */
  440. unsigned char vendor5; /* Obsolete, vendor unique */
  441. unsigned char tPIO; /* Obsolete, 0=slow, 1=medium, 2=fast */
  442. unsigned char vendor6; /* Obsolete, vendor unique */
  443. unsigned char tDMA; /* Obsolete, 0=slow, 1=medium, 2=fast */
  444. unsigned short field_valid; /* (word 53)
  445. * 2: ultra_ok word 88
  446. * 1: eide_ok words 64-70
  447. * 0: cur_ok words 54-58
  448. */
  449. unsigned short cur_cyls; /* Obsolete, logical cylinders */
  450. unsigned short cur_heads; /* Obsolete, l heads */
  451. unsigned short cur_sectors; /* Obsolete, l sectors per track */
  452. unsigned short cur_capacity0; /* Obsolete, l total sectors on drive */
  453. unsigned short cur_capacity1; /* Obsolete, (2 words, misaligned int) */
  454. unsigned char multsect; /* current multiple sector count */
  455. unsigned char multsect_valid; /* when (bit0==1) multsect is ok */
  456. unsigned int lba_capacity; /* Obsolete, total number of sectors */
  457. unsigned short dma_1word; /* Obsolete, single-word dma info */
  458. unsigned short dma_mword; /* multiple-word dma info */
  459. unsigned short eide_pio_modes; /* bits 0:mode3 1:mode4 */
  460. unsigned short eide_dma_min; /* min mword dma cycle time (ns) */
  461. unsigned short eide_dma_time; /* recommended mword dma cycle time (ns) */
  462. unsigned short eide_pio; /* min cycle time (ns), no IORDY */
  463. unsigned short eide_pio_iordy; /* min cycle time (ns), with IORDY */
  464. unsigned short words69_70[2]; /* reserved words 69-70
  465. * future command overlap and queuing
  466. */
  467. /* HDIO_GET_IDENTITY currently returns only words 0 through 70 */
  468. unsigned short words71_74[4]; /* reserved words 71-74
  469. * for IDENTIFY PACKET DEVICE command
  470. */
  471. unsigned short queue_depth; /* (word 75)
  472. * 15:5 reserved
  473. * 4:0 Maximum queue depth -1
  474. */
  475. unsigned short words76_79[4]; /* reserved words 76-79 */
  476. unsigned short major_rev_num; /* (word 80) */
  477. unsigned short minor_rev_num; /* (word 81) */
  478. unsigned short command_set_1; /* (word 82) supported
  479. * 15: Obsolete
  480. * 14: NOP command
  481. * 13: READ_BUFFER
  482. * 12: WRITE_BUFFER
  483. * 11: Obsolete
  484. * 10: Host Protected Area
  485. * 9: DEVICE Reset
  486. * 8: SERVICE Interrupt
  487. * 7: Release Interrupt
  488. * 6: look-ahead
  489. * 5: write cache
  490. * 4: PACKET Command
  491. * 3: Power Management Feature Set
  492. * 2: Removable Feature Set
  493. * 1: Security Feature Set
  494. * 0: SMART Feature Set
  495. */
  496. unsigned short command_set_2; /* (word 83)
  497. * 15: Shall be ZERO
  498. * 14: Shall be ONE
  499. * 13: FLUSH CACHE EXT
  500. * 12: FLUSH CACHE
  501. * 11: Device Configuration Overlay
  502. * 10: 48-bit Address Feature Set
  503. * 9: Automatic Acoustic Management
  504. * 8: SET MAX security
  505. * 7: reserved 1407DT PARTIES
  506. * 6: SetF sub-command Power-Up
  507. * 5: Power-Up in Standby Feature Set
  508. * 4: Removable Media Notification
  509. * 3: APM Feature Set
  510. * 2: CFA Feature Set
  511. * 1: READ/WRITE DMA QUEUED
  512. * 0: Download MicroCode
  513. */
  514. unsigned short cfsse; /* (word 84)
  515. * cmd set-feature supported extensions
  516. * 15: Shall be ZERO
  517. * 14: Shall be ONE
  518. * 13:6 reserved
  519. * 5: General Purpose Logging
  520. * 4: Streaming Feature Set
  521. * 3: Media Card Pass Through
  522. * 2: Media Serial Number Valid
  523. * 1: SMART selt-test supported
  524. * 0: SMART error logging
  525. */
  526. unsigned short cfs_enable_1; /* (word 85)
  527. * command set-feature enabled
  528. * 15: Obsolete
  529. * 14: NOP command
  530. * 13: READ_BUFFER
  531. * 12: WRITE_BUFFER
  532. * 11: Obsolete
  533. * 10: Host Protected Area
  534. * 9: DEVICE Reset
  535. * 8: SERVICE Interrupt
  536. * 7: Release Interrupt
  537. * 6: look-ahead
  538. * 5: write cache
  539. * 4: PACKET Command
  540. * 3: Power Management Feature Set
  541. * 2: Removable Feature Set
  542. * 1: Security Feature Set
  543. * 0: SMART Feature Set
  544. */
  545. unsigned short cfs_enable_2; /* (word 86)
  546. * command set-feature enabled
  547. * 15: Shall be ZERO
  548. * 14: Shall be ONE
  549. * 13: FLUSH CACHE EXT
  550. * 12: FLUSH CACHE
  551. * 11: Device Configuration Overlay
  552. * 10: 48-bit Address Feature Set
  553. * 9: Automatic Acoustic Management
  554. * 8: SET MAX security
  555. * 7: reserved 1407DT PARTIES
  556. * 6: SetF sub-command Power-Up
  557. * 5: Power-Up in Standby Feature Set
  558. * 4: Removable Media Notification
  559. * 3: APM Feature Set
  560. * 2: CFA Feature Set
  561. * 1: READ/WRITE DMA QUEUED
  562. * 0: Download MicroCode
  563. */
  564. unsigned short csf_default; /* (word 87)
  565. * command set-feature default
  566. * 15: Shall be ZERO
  567. * 14: Shall be ONE
  568. * 13:6 reserved
  569. * 5: General Purpose Logging enabled
  570. * 4: Valid CONFIGURE STREAM executed
  571. * 3: Media Card Pass Through enabled
  572. * 2: Media Serial Number Valid
  573. * 1: SMART selt-test supported
  574. * 0: SMART error logging
  575. */
  576. unsigned short dma_ultra; /* (word 88) */
  577. unsigned short trseuc; /* time required for security erase */
  578. unsigned short trsEuc; /* time required for enhanced erase */
  579. unsigned short CurAPMvalues; /* current APM values */
  580. unsigned short mprc; /* master password revision code */
  581. unsigned short hw_config; /* hardware config (word 93)
  582. * 15: Shall be ZERO
  583. * 14: Shall be ONE
  584. * 13:
  585. * 12:
  586. * 11:
  587. * 10:
  588. * 9:
  589. * 8:
  590. * 7:
  591. * 6:
  592. * 5:
  593. * 4:
  594. * 3:
  595. * 2:
  596. * 1:
  597. * 0: Shall be ONE
  598. */
  599. unsigned short acoustic; /* (word 94)
  600. * 15:8 Vendor's recommended value
  601. * 7:0 current value
  602. */
  603. unsigned short msrqs; /* min stream request size */
  604. unsigned short sxfert; /* stream transfer time */
  605. unsigned short sal; /* stream access latency */
  606. unsigned int spg; /* stream performance granularity */
  607. unsigned long long lba_capacity_2;/* 48-bit total number of sectors */
  608. unsigned short words104_125[22];/* reserved words 104-125 */
  609. unsigned short last_lun; /* (word 126) */
  610. unsigned short word127; /* (word 127) Feature Set
  611. * Removable Media Notification
  612. * 15:2 reserved
  613. * 1:0 00 = not supported
  614. * 01 = supported
  615. * 10 = reserved
  616. * 11 = reserved
  617. */
  618. unsigned short dlf; /* (word 128)
  619. * device lock function
  620. * 15:9 reserved
  621. * 8 security level 1:max 0:high
  622. * 7:6 reserved
  623. * 5 enhanced erase
  624. * 4 expire
  625. * 3 frozen
  626. * 2 locked
  627. * 1 en/disabled
  628. * 0 capability
  629. */
  630. unsigned short csfo; /* (word 129)
  631. * current set features options
  632. * 15:4 reserved
  633. * 3: auto reassign
  634. * 2: reverting
  635. * 1: read-look-ahead
  636. * 0: write cache
  637. */
  638. unsigned short words130_155[26];/* reserved vendor words 130-155 */
  639. unsigned short word156; /* reserved vendor word 156 */
  640. unsigned short words157_159[3];/* reserved vendor words 157-159 */
  641. unsigned short cfa_power; /* (word 160) CFA Power Mode
  642. * 15 word 160 supported
  643. * 14 reserved
  644. * 13
  645. * 12
  646. * 11:0
  647. */
  648. unsigned short words161_175[15];/* Reserved for CFA */
  649. unsigned short words176_205[30];/* Current Media Serial Number */
  650. unsigned short words206_254[49];/* reserved words 206-254 */
  651. unsigned short integrity_word; /* (word 255)
  652. * 15:8 Checksum
  653. * 7:0 Signature
  654. */
  655. };
  656. /*
  657. * IDE "nice" flags. These are used on a per drive basis to determine
  658. * when to be nice and give more bandwidth to the other devices which
  659. * share the same IDE bus.
  660. */
  661. #define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */
  662. #define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */
  663. #define IDE_NICE_1 (3) /* when probably won't affect us much */
  664. #ifndef __KERNEL__
  665. #define IDE_NICE_0 (2) /* when sure that it won't affect us */
  666. #define IDE_NICE_2 (4) /* when we know it's on our expense */
  667. #endif
  668. #endif /* _LINUX_HDREG_H */