hdreg.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:23k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

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