mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

377 lines
16 KiB

  1. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  2. #
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. # Please add additional copyright information _after_ the line containing
  5. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  6. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  7. #
  8. # ROCK Linux: rock-src/package/base/dietlibc/hdreg_h.patch
  9. # ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; either version 2 of the License, or
  14. # (at your option) any later version. A copy of the GNU General Public
  15. # License can be found at Documentation/COPYING.
  16. #
  17. # Many people helped and are helping developing ROCK Linux. Please
  18. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  19. # file for details.
  20. #
  21. # --- ROCK-COPYRIGHT-NOTE-END ---
  22. needed by sysvinit
  23. --- ./include/linux/hdreg.h.orig Wed Jul 31 00:08:03 2002
  24. +++ ./include/linux/hdreg.h Wed Jul 31 00:07:49 2002
  25. @@ -0,0 +1,349 @@
  26. +#ifndef _LINUX_HDREG_H
  27. +#define _LINUX_HDREG_H
  28. +
  29. +/*
  30. + * This file contains some defines for the AT-hd-controller.
  31. + * Various sources.
  32. + */
  33. +
  34. +#define HD_IRQ 14 /* the standard disk interrupt */
  35. +
  36. +/* ide.c has its own port definitions in "ide.h" */
  37. +
  38. +/* Hd controller regs. Ref: IBM AT Bios-listing */
  39. +#define HD_DATA 0x1f0 /* _CTL when writing */
  40. +#define HD_ERROR 0x1f1 /* see err-bits */
  41. +#define HD_NSECTOR 0x1f2 /* nr of sectors to read/write */
  42. +#define HD_SECTOR 0x1f3 /* starting sector */
  43. +#define HD_LCYL 0x1f4 /* starting cylinder */
  44. +#define HD_HCYL 0x1f5 /* high byte of starting cyl */
  45. +#define HD_CURRENT 0x1f6 /* 101dhhhh , d=drive, hhhh=head */
  46. +#define HD_STATUS 0x1f7 /* see status-bits */
  47. +#define HD_FEATURE HD_ERROR /* same io address, read=error, write=feature */
  48. +#define HD_PRECOMP HD_FEATURE /* obsolete use of this port - predates IDE */
  49. +#define HD_COMMAND HD_STATUS /* same io address, read=status, write=cmd */
  50. +
  51. +#define HD_CMD 0x3f6 /* used for resets */
  52. +#define HD_ALTSTATUS 0x3f6 /* same as HD_STATUS but doesn't clear irq */
  53. +
  54. +/* remainder is shared between hd.c, ide.c, ide-cd.c, and the hdparm utility */
  55. +
  56. +/* Bits of HD_STATUS */
  57. +#define ERR_STAT 0x01
  58. +#define INDEX_STAT 0x02
  59. +#define ECC_STAT 0x04 /* Corrected error */
  60. +#define DRQ_STAT 0x08
  61. +#define SEEK_STAT 0x10
  62. +#define WRERR_STAT 0x20
  63. +#define READY_STAT 0x40
  64. +#define BUSY_STAT 0x80
  65. +
  66. +/* Values for HD_COMMAND */
  67. +#define WIN_RESTORE 0x10
  68. +#define WIN_READ 0x20
  69. +#define WIN_WRITE 0x30
  70. +#define WIN_WRITE_VERIFY 0x3C
  71. +#define WIN_VERIFY 0x40
  72. +#define WIN_FORMAT 0x50
  73. +#define WIN_INIT 0x60
  74. +#define WIN_SEEK 0x70
  75. +#define WIN_DIAGNOSE 0x90
  76. +#define WIN_SPECIFY 0x91 /* set drive geometry translation */
  77. +#define WIN_IDLEIMMEDIATE 0xE1 /* force drive to become "ready" */
  78. +#define WIN_SETIDLE1 0xE3
  79. +#define WIN_SETIDLE2 0x97
  80. +
  81. +#define WIN_STANDBYNOW1 0xE0
  82. +#define WIN_STANDBYNOW2 0x94
  83. +#define WIN_SLEEPNOW1 0xE6
  84. +#define WIN_SLEEPNOW2 0x99
  85. +#define WIN_CHECKPOWERMODE1 0xE5
  86. +#define WIN_CHECKPOWERMODE2 0x98
  87. +
  88. +#define WIN_DOORLOCK 0xDE /* lock door on removable drives */
  89. +#define WIN_DOORUNLOCK 0xDF /* unlock door on removable drives */
  90. +
  91. +#define WIN_MULTREAD 0xC4 /* read sectors using multiple mode */
  92. +#define WIN_MULTWRITE 0xC5 /* write sectors using multiple mode */
  93. +#define WIN_SETMULT 0xC6 /* enable/disable multiple mode */
  94. +#define WIN_IDENTIFY 0xEC /* ask drive to identify itself */
  95. +#define WIN_IDENTIFY_DMA 0xEE /* same as WIN_IDENTIFY, but DMA */
  96. +#define WIN_SETFEATURES 0xEF /* set special drive features */
  97. +#define WIN_READDMA 0xC8 /* read sectors using DMA transfers */
  98. +#define WIN_WRITEDMA 0xCA /* write sectors using DMA transfers */
  99. +
  100. +#define WIN_QUEUED_SERVICE 0xA2 /* */
  101. +#define WIN_READDMA_QUEUED 0xC7 /* read sectors using Queued DMA transfers */
  102. +#define WIN_WRITEDMA_QUEUED 0xCC /* write sectors using Queued DMA transfers */
  103. +
  104. +#define WIN_READ_BUFFER 0xE4 /* force read only 1 sector */
  105. +#define WIN_WRITE_BUFFER 0xE8 /* force write only 1 sector */
  106. +
  107. +#define WIN_SMART 0xB0 /* self-monitoring and reporting */
  108. +
  109. +/* Additional drive command codes used by ATAPI devices. */
  110. +#define WIN_PIDENTIFY 0xA1 /* identify ATAPI device */
  111. +#define WIN_SRST 0x08 /* ATAPI soft reset command */
  112. +#define WIN_PACKETCMD 0xA0 /* Send a packet command. */
  113. +
  114. +#define DISABLE_SEAGATE 0xFB
  115. +#define EXABYTE_ENABLE_NEST 0xF0
  116. +
  117. +/* WIN_SMART sub-commands */
  118. +
  119. +#define SMART_READ_VALUES 0xd0
  120. +#define SMART_READ_THRESHOLDS 0xd1
  121. +#define SMART_AUTOSAVE 0xd2
  122. +#define SMART_SAVE 0xd3
  123. +#define SMART_IMMEDIATE_OFFLINE 0xd4
  124. +#define SMART_READ_LOG_SECTOR 0xd5
  125. +#define SMART_WRITE_LOG_SECTOR 0xd6
  126. +#define SMART_WRITE_THRESHOLDS 0xd7
  127. +#define SMART_ENABLE 0xd8
  128. +#define SMART_DISABLE 0xd9
  129. +#define SMART_STATUS 0xda
  130. +#define SMART_AUTO_OFFLINE 0xdb
  131. +
  132. +/* WIN_SETFEATURES sub-commands */
  133. +
  134. +#define SETFEATURES_EN_WCACHE 0x02 /* Enable write cache */
  135. +#define SETFEATURES_XFER 0x03 /* Set transfer mode */
  136. +# define XFER_UDMA_7 0x47 /* 0100|0111 */
  137. +# define XFER_UDMA_6 0x46 /* 0100|0110 */
  138. +# define XFER_UDMA_5 0x45 /* 0100|0101 */
  139. +# define XFER_UDMA_4 0x44 /* 0100|0100 */
  140. +# define XFER_UDMA_3 0x43 /* 0100|0011 */
  141. +# define XFER_UDMA_2 0x42 /* 0100|0010 */
  142. +# define XFER_UDMA_1 0x41 /* 0100|0001 */
  143. +# define XFER_UDMA_0 0x40 /* 0100|0000 */
  144. +# define XFER_MW_DMA_2 0x22 /* 0010|0010 */
  145. +# define XFER_MW_DMA_1 0x21 /* 0010|0001 */
  146. +# define XFER_MW_DMA_0 0x20 /* 0010|0000 */
  147. +# define XFER_SW_DMA_2 0x12 /* 0001|0010 */
  148. +# define XFER_SW_DMA_1 0x11 /* 0001|0001 */
  149. +# define XFER_SW_DMA_0 0x10 /* 0001|0000 */
  150. +# define XFER_PIO_4 0x0C /* 0000|1100 */
  151. +# define XFER_PIO_3 0x0B /* 0000|1011 */
  152. +# define XFER_PIO_2 0x0A /* 0000|1010 */
  153. +# define XFER_PIO_1 0x09 /* 0000|1001 */
  154. +# define XFER_PIO_0 0x08 /* 0000|1000 */
  155. +# define XFER_PIO_SLOW 0x00 /* 0000|0000 */
  156. +#define SETFEATURES_DIS_DEFECT 0x04 /* Disable Defect Management */
  157. +#define SETFEATURES_EN_APM 0x05 /* Enable advanced power management */
  158. +#define SETFEATURES_DIS_MSN 0x31 /* Disable Media Status Notification */
  159. +#define SETFEATURES_DIS_RLA 0x55 /* Disable read look-ahead feature */
  160. +#define SETFEATURES_EN_RI 0x5D /* Enable release interrupt */
  161. +#define SETFEATURES_EN_SI 0x5E /* Enable SERVICE interrupt */
  162. +#define SETFEATURES_DIS_RPOD 0x66 /* Disable reverting to power on defaults */
  163. +#define SETFEATURES_DIS_WCACHE 0x82 /* Disable write cache */
  164. +#define SETFEATURES_EN_DEFECT 0x84 /* Enable Defect Management */
  165. +#define SETFEATURES_DIS_APM 0x85 /* Disable advanced power management */
  166. +#define SETFEATURES_EN_MSN 0x95 /* Enable Media Status Notification */
  167. +#define SETFEATURES_EN_RLA 0xAA /* Enable read look-ahead feature */
  168. +#define SETFEATURES_PREFETCH 0xAB /* Sets drive prefetch value */
  169. +#define SETFEATURES_EN_RPOD 0xCC /* Enable reverting to power on defaults */
  170. +#define SETFEATURES_DIS_RI 0xDD /* Disable release interrupt */
  171. +#define SETFEATURES_DIS_SI 0xDE /* Disable SERVICE interrupt */
  172. +
  173. +/* WIN_SECURITY sub-commands */
  174. +
  175. +#define SECURITY_SET_PASSWORD 0xBA /* 0xF1 */
  176. +#define SECURITY_UNLOCK 0xBB /* 0xF2 */
  177. +#define SECURITY_ERASE_PREPARE 0xBC /* 0xF3 */
  178. +#define SECURITY_ERASE_UNIT 0xBD /* 0xF4 */
  179. +#define SECURITY_FREEZE_LOCK 0xBE /* 0xF5 */
  180. +#define SECURITY_DISABLE_PASSWORD 0xBF /* 0xF6 */
  181. +
  182. +/* Bits for HD_ERROR */
  183. +#define MARK_ERR 0x01 /* Bad address mark */
  184. +#define TRK0_ERR 0x02 /* couldn't find track 0 */
  185. +#define ABRT_ERR 0x04 /* Command aborted */
  186. +#define MCR_ERR 0x08 /* media change request */
  187. +#define ID_ERR 0x10 /* ID field not found */
  188. +#define MC_ERR 0x20 /* media changed */
  189. +#define ECC_ERR 0x40 /* Uncorrectable ECC error */
  190. +#define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */
  191. +#define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */
  192. +
  193. +struct hd_geometry {
  194. + unsigned char heads;
  195. + unsigned char sectors;
  196. + unsigned short cylinders;
  197. + unsigned long start;
  198. +};
  199. +
  200. +/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
  201. +#define HDIO_GETGEO 0x0301 /* get device geometry */
  202. +#define HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */
  203. +#define HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */
  204. +#define HDIO_GET_QDMA 0x0305 /* get use-qdma flag */
  205. +#define HDIO_OBSOLETE_IDENTITY 0x0307 /* OBSOLETE, DO NOT USE: returns 142 bytes */
  206. +#define HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */
  207. +#define HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */
  208. +#define HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */
  209. +#define HDIO_GET_DMA 0x030b /* get use-dma flag */
  210. +#define HDIO_GET_NICE 0x030c /* get nice flags */
  211. +#define HDIO_GET_IDENTITY 0x030d /* get IDE identification info */
  212. +#define HDIO_GET_WCACHE 0x030e /* get write cache mode on|off */
  213. +#define HDIO_GET_ACOUSTIC 0x030f /* get acoustic value */
  214. +
  215. +#define HDIO_GET_BUSSTATE 0x031a /* get the bus state of the hwif */
  216. +#define HDIO_TRISTATE_HWIF 0x031b /* OBSOLETE - use SET_BUSSTATE */
  217. +#define HDIO_DRIVE_RESET 0x031c /* execute a device reset */
  218. +#define HDIO_DRIVE_TASKFILE 0x031d /* execute raw taskfile */
  219. +#define HDIO_DRIVE_TASK 0x031e /* execute task and special drive command */
  220. +#define HDIO_DRIVE_CMD 0x031f /* execute a special drive command */
  221. +
  222. +#define HDIO_DRIVE_CMD_AEB HDIO_DRIVE_TASK
  223. +
  224. +/* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
  225. +#define HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */
  226. +#define HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */
  227. +#define HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */
  228. +#define HDIO_SET_32BIT 0x0324 /* change io_32bit flags */
  229. +#define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */
  230. +#define HDIO_SET_DMA 0x0326 /* change use-dma flag */
  231. +#define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */
  232. +#define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */
  233. +#define HDIO_SET_NICE 0x0329 /* set nice flags */
  234. +#define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */
  235. +#define HDIO_SET_WCACHE 0x032b /* change write cache enable-disable */
  236. +#define HDIO_SET_ACOUSTIC 0x032c /* change acoustic behavior */
  237. +#define HDIO_SET_BUSSTATE 0x032d /* set the bus state of the hwif */
  238. +#define HDIO_SET_QDMA 0x032e /* change use-qdma flag */
  239. +
  240. +/* bus states */
  241. +enum {
  242. + BUSSTATE_OFF = 0,
  243. + BUSSTATE_ON,
  244. + BUSSTATE_TRISTATE
  245. +};
  246. +
  247. +/* BIG GEOMETRY */
  248. +struct hd_big_geometry {
  249. + unsigned char heads;
  250. + unsigned char sectors;
  251. + unsigned int cylinders;
  252. + unsigned long start;
  253. +};
  254. +
  255. +/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x033n/0x033n */
  256. +#define HDIO_GETGEO_BIG 0x0330 /* */
  257. +#define HDIO_GETGEO_BIG_RAW 0x0331 /* */
  258. +
  259. +#define __NEW_HD_DRIVE_ID
  260. +/* structure returned by HDIO_GET_IDENTITY, as per ANSI ATA2 rev.2f spec */
  261. +struct hd_driveid {
  262. + unsigned short config; /* lots of obsolete bit flags */
  263. + unsigned short cyls; /* "physical" cyls */
  264. + unsigned short reserved2; /* reserved (word 2) */
  265. + unsigned short heads; /* "physical" heads */
  266. + unsigned short track_bytes; /* unformatted bytes per track */
  267. + unsigned short sector_bytes; /* unformatted bytes per sector */
  268. + unsigned short sectors; /* "physical" sectors per track */
  269. + unsigned short vendor0; /* vendor unique */
  270. + unsigned short vendor1; /* vendor unique */
  271. + unsigned short vendor2; /* vendor unique */
  272. + unsigned char serial_no[20]; /* 0 = not_specified */
  273. + unsigned short buf_type;
  274. + unsigned short buf_size; /* 512 byte increments; 0 = not_specified */
  275. + unsigned short ecc_bytes; /* for r/w long cmds; 0 = not_specified */
  276. + unsigned char fw_rev[8]; /* 0 = not_specified */
  277. + unsigned char model[40]; /* 0 = not_specified */
  278. + unsigned char max_multsect; /* 0=not_implemented */
  279. + unsigned char vendor3; /* vendor unique */
  280. + unsigned short dword_io; /* 0=not_implemented; 1=implemented */
  281. + unsigned char vendor4; /* vendor unique */
  282. + unsigned char capability; /* bits 0:DMA 1:LBA 2:IORDYsw 3:IORDYsup*/
  283. + unsigned short reserved50; /* reserved (word 50) */
  284. + unsigned char vendor5; /* vendor unique */
  285. + unsigned char tPIO; /* 0=slow, 1=medium, 2=fast */
  286. + unsigned char vendor6; /* vendor unique */
  287. + unsigned char tDMA; /* 0=slow, 1=medium, 2=fast */
  288. + unsigned short field_valid; /* bits 0:cur_ok 1:eide_ok */
  289. + unsigned short cur_cyls; /* logical cylinders */
  290. + unsigned short cur_heads; /* logical heads */
  291. + unsigned short cur_sectors; /* logical sectors per track */
  292. + unsigned short cur_capacity0; /* logical total sectors on drive */
  293. + unsigned short cur_capacity1; /* (2 words, misaligned int) */
  294. + unsigned char multsect; /* current multiple sector count */
  295. + unsigned char multsect_valid; /* when (bit0==1) multsect is ok */
  296. + unsigned int lba_capacity; /* total number of sectors */
  297. + unsigned short dma_1word; /* single-word dma info */
  298. + unsigned short dma_mword; /* multiple-word dma info */
  299. + unsigned short eide_pio_modes; /* bits 0:mode3 1:mode4 */
  300. + unsigned short eide_dma_min; /* min mword dma cycle time (ns) */
  301. + unsigned short eide_dma_time; /* recommended mword dma cycle time (ns) */
  302. + unsigned short eide_pio; /* min cycle time (ns), no IORDY */
  303. + unsigned short eide_pio_iordy; /* min cycle time (ns), with IORDY */
  304. + unsigned short words69_70[2]; /* reserved words 69-70 */
  305. + /* HDIO_GET_IDENTITY currently returns only words 0 through 70 */
  306. + unsigned short words71_74[4]; /* reserved words 71-74 */
  307. + unsigned short queue_depth; /* */
  308. + unsigned short words76_79[4]; /* reserved words 76-79 */
  309. + unsigned short major_rev_num; /* */
  310. + unsigned short minor_rev_num; /* */
  311. + unsigned short command_set_1; /* bits 0:Smart 1:Security 2:Removable 3:PM */
  312. + unsigned short command_set_2; /* bits 14:Smart Enabled 13:0 zero */
  313. + unsigned short cfsse; /* command set-feature supported extensions */
  314. + unsigned short cfs_enable_1; /* command set-feature enabled */
  315. + unsigned short cfs_enable_2; /* command set-feature enabled */
  316. + unsigned short csf_default; /* command set-feature default */
  317. + unsigned short dma_ultra; /* */
  318. + unsigned short word89; /* reserved (word 89) */
  319. + unsigned short word90; /* reserved (word 90) */
  320. + unsigned short CurAPMvalues; /* current APM values */
  321. + unsigned short word92; /* reserved (word 92) */
  322. + unsigned short hw_config; /* hardware config */
  323. + unsigned short words94_125[32];/* reserved words 94-125 */
  324. + unsigned short last_lun; /* reserved (word 126) */
  325. + unsigned short word127; /* reserved (word 127) */
  326. + unsigned short dlf; /* device lock function
  327. + * 15:9 reserved
  328. + * 8 security level 1:max 0:high
  329. + * 7:6 reserved
  330. + * 5 enhanced erase
  331. + * 4 expire
  332. + * 3 frozen
  333. + * 2 locked
  334. + * 1 en/disabled
  335. + * 0 capability
  336. + */
  337. + unsigned short csfo; /* current set features options
  338. + * 15:4 reserved
  339. + * 3 auto reassign
  340. + * 2 reverting
  341. + * 1 read-look-ahead
  342. + * 0 write cache
  343. + */
  344. + unsigned short words130_155[26];/* reserved vendor words 130-155 */
  345. + unsigned short word156;
  346. + unsigned short words157_159[3];/* reserved vendor words 157-159 */
  347. + unsigned short words160_255[95];/* reserved words 160-255 */
  348. +};
  349. +
  350. +/*
  351. + * IDE "nice" flags. These are used on a per drive basis to determine
  352. + * when to be nice and give more bandwidth to the other devices which
  353. + * share the same IDE bus.
  354. + */
  355. +#define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */
  356. +#define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */
  357. +#define IDE_NICE_0 (2) /* when sure that it won't affect us */
  358. +#define IDE_NICE_1 (3) /* when probably won't affect us much */
  359. +#define IDE_NICE_2 (4) /* when we know it's on our expense */
  360. +
  361. +#ifdef __KERNEL__
  362. +/*
  363. + * These routines are used for kernel command line parameters from main.c:
  364. + */
  365. +#include <linux/config.h>
  366. +
  367. +#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
  368. +int ide_register(int io_port, int ctl_port, int irq);
  369. +void ide_unregister(unsigned int);
  370. +#endif /* CONFIG_BLK_DEV_IDE || CONFIG_BLK_DEV_IDE_MODULE */
  371. +
  372. +#endif /* __KERNEL__ */
  373. +
  374. +#endif /* _LINUX_HDREG_H */