1 |
199 |
simons |
#ifndef _LINUX_HDREG_H
|
2 |
|
|
#define _LINUX_HDREG_H
|
3 |
|
|
|
4 |
|
|
/*
|
5 |
|
|
* This file contains some defines for the AT-hd-controller.
|
6 |
|
|
* Various sources.
|
7 |
|
|
*/
|
8 |
|
|
|
9 |
|
|
#define HD_IRQ 14 /* the standard disk interrupt */
|
10 |
|
|
|
11 |
|
|
/* ide.c has its own port definitions in "ide.h" */
|
12 |
|
|
|
13 |
|
|
/* Hd controller regs. Ref: IBM AT Bios-listing */
|
14 |
|
|
#define HD_DATA 0x1f0 /* _CTL when writing */
|
15 |
|
|
#define HD_ERROR 0x1f1 /* see err-bits */
|
16 |
|
|
#define HD_NSECTOR 0x1f2 /* nr of sectors to read/write */
|
17 |
|
|
#define HD_SECTOR 0x1f3 /* starting sector */
|
18 |
|
|
#define HD_LCYL 0x1f4 /* starting cylinder */
|
19 |
|
|
#define HD_HCYL 0x1f5 /* high byte of starting cyl */
|
20 |
|
|
#define HD_CURRENT 0x1f6 /* 101dhhhh , d=drive, hhhh=head */
|
21 |
|
|
#define HD_STATUS 0x1f7 /* see status-bits */
|
22 |
|
|
#define HD_FEATURE HD_ERROR /* same io address, read=error, write=feature */
|
23 |
|
|
#define HD_PRECOMP HD_FEATURE /* obsolete use of this port - predates IDE */
|
24 |
|
|
#define HD_COMMAND HD_STATUS /* same io address, read=status, write=cmd */
|
25 |
|
|
|
26 |
|
|
#define HD_CMD 0x3f6 /* used for resets */
|
27 |
|
|
#define HD_ALTSTATUS 0x3f6 /* same as HD_STATUS but doesn't clear irq */
|
28 |
|
|
|
29 |
|
|
/* remainder is shared between hd.c, ide.c, ide-cd.c, and the hdparm utility */
|
30 |
|
|
|
31 |
|
|
/* Bits of HD_STATUS */
|
32 |
|
|
#define ERR_STAT 0x01
|
33 |
|
|
#define INDEX_STAT 0x02
|
34 |
|
|
#define ECC_STAT 0x04 /* Corrected error */
|
35 |
|
|
#define DRQ_STAT 0x08
|
36 |
|
|
#define SEEK_STAT 0x10
|
37 |
|
|
#define WRERR_STAT 0x20
|
38 |
|
|
#define READY_STAT 0x40
|
39 |
|
|
#define BUSY_STAT 0x80
|
40 |
|
|
|
41 |
|
|
/* Values for HD_COMMAND */
|
42 |
|
|
#define WIN_RESTORE 0x10
|
43 |
|
|
#define WIN_READ 0x20
|
44 |
|
|
#define WIN_WRITE 0x30
|
45 |
|
|
#define WIN_VERIFY 0x40
|
46 |
|
|
#define WIN_FORMAT 0x50
|
47 |
|
|
#define WIN_INIT 0x60
|
48 |
|
|
#define WIN_SEEK 0x70
|
49 |
|
|
#define WIN_DIAGNOSE 0x90
|
50 |
|
|
#define WIN_SPECIFY 0x91 /* set drive geometry translation */
|
51 |
|
|
#define WIN_SETIDLE1 0xE3
|
52 |
|
|
#define WIN_SETIDLE2 0x97
|
53 |
|
|
|
54 |
|
|
#define WIN_DOORLOCK 0xde /* lock door on removable drives */
|
55 |
|
|
#define WIN_DOORUNLOCK 0xdf /* unlock door on removable drives */
|
56 |
|
|
#define WIN_ACKMC 0xdb /* acknowledge media change */
|
57 |
|
|
|
58 |
|
|
#define WIN_MULTREAD 0xC4 /* read sectors using multiple mode */
|
59 |
|
|
#define WIN_MULTWRITE 0xC5 /* write sectors using multiple mode */
|
60 |
|
|
#define WIN_SETMULT 0xC6 /* enable/disable multiple mode */
|
61 |
|
|
#define WIN_IDENTIFY 0xEC /* ask drive to identify itself */
|
62 |
|
|
#define WIN_SETFEATURES 0xEF /* set special drive features */
|
63 |
|
|
#define WIN_READDMA 0xc8 /* read sectors using DMA transfers */
|
64 |
|
|
#define WIN_WRITEDMA 0xca /* write sectors using DMA transfers */
|
65 |
|
|
|
66 |
|
|
/* Additional drive command codes used by ATAPI devices. */
|
67 |
|
|
#define WIN_PIDENTIFY 0xA1 /* identify ATAPI device */
|
68 |
|
|
#define WIN_SRST 0x08 /* ATAPI soft reset command */
|
69 |
|
|
#define WIN_PACKETCMD 0xa0 /* Send a packet command. */
|
70 |
|
|
|
71 |
|
|
/* Non-standard commands */
|
72 |
|
|
#define EXABYTE_ENABLE_NEST 0xf0
|
73 |
|
|
|
74 |
|
|
/* Bits for HD_ERROR */
|
75 |
|
|
#define MARK_ERR 0x01 /* Bad address mark */
|
76 |
|
|
#define TRK0_ERR 0x02 /* couldn't find track 0 */
|
77 |
|
|
#define ABRT_ERR 0x04 /* Command aborted */
|
78 |
|
|
#define ID_ERR 0x10 /* ID field not found */
|
79 |
|
|
#define MC_ERR 0x20 /* media changed */
|
80 |
|
|
#define ECC_ERR 0x40 /* Uncorrectable ECC error */
|
81 |
|
|
#define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */
|
82 |
|
|
#define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */
|
83 |
|
|
|
84 |
|
|
struct hd_geometry {
|
85 |
|
|
unsigned char heads;
|
86 |
|
|
unsigned char sectors;
|
87 |
|
|
unsigned short cylinders;
|
88 |
|
|
unsigned long start;
|
89 |
|
|
};
|
90 |
|
|
|
91 |
|
|
/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
|
92 |
|
|
#define HDIO_GETGEO 0x0301 /* get device geometry */
|
93 |
|
|
#define HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */
|
94 |
|
|
#define HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */
|
95 |
|
|
#define HDIO_OBSOLETE_IDENTITY 0x0307 /* OBSOLETE, DO NOT USE: returns 142 bytes */
|
96 |
|
|
#define HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */
|
97 |
|
|
#define HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */
|
98 |
|
|
#define HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */
|
99 |
|
|
#define HDIO_GET_DMA 0x030b /* get use-dma flag */
|
100 |
|
|
#define HDIO_GET_IDENTITY 0x030d /* get IDE identification info */
|
101 |
|
|
#define HDIO_DRIVE_CMD 0x031f /* execute a special drive command */
|
102 |
|
|
|
103 |
|
|
/* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
|
104 |
|
|
#define HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */
|
105 |
|
|
#define HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */
|
106 |
|
|
#define HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */
|
107 |
|
|
#define HDIO_SET_32BIT 0x0324 /* change io_32bit flags */
|
108 |
|
|
#define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */
|
109 |
|
|
#define HDIO_SET_DMA 0x0326 /* change use-dma flag */
|
110 |
|
|
#define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */
|
111 |
|
|
|
112 |
|
|
/* structure returned by HDIO_GET_IDENTITY, as per ANSI ATA2 rev.2f spec */
|
113 |
|
|
struct hd_driveid {
|
114 |
|
|
unsigned short config; /* lots of obsolete bit flags */
|
115 |
|
|
unsigned short cyls; /* "physical" cyls */
|
116 |
|
|
unsigned short reserved2; /* reserved (word 2) */
|
117 |
|
|
unsigned short heads; /* "physical" heads */
|
118 |
|
|
unsigned short track_bytes; /* unformatted bytes per track */
|
119 |
|
|
unsigned short sector_bytes; /* unformatted bytes per sector */
|
120 |
|
|
unsigned short sectors; /* "physical" sectors per track */
|
121 |
|
|
unsigned short vendor0; /* vendor unique */
|
122 |
|
|
unsigned short vendor1; /* vendor unique */
|
123 |
|
|
unsigned short vendor2; /* vendor unique */
|
124 |
|
|
unsigned char serial_no[20]; /* 0 = not_specified */
|
125 |
|
|
unsigned short buf_type;
|
126 |
|
|
unsigned short buf_size; /* 512 byte increments; 0 = not_specified */
|
127 |
|
|
unsigned short ecc_bytes; /* for r/w long cmds; 0 = not_specified */
|
128 |
|
|
unsigned char fw_rev[8]; /* 0 = not_specified */
|
129 |
|
|
unsigned char model[40]; /* 0 = not_specified */
|
130 |
|
|
unsigned char max_multsect; /* 0=not_implemented */
|
131 |
|
|
unsigned char vendor3; /* vendor unique */
|
132 |
|
|
unsigned short dword_io; /* 0=not_implemented; 1=implemented */
|
133 |
|
|
unsigned char vendor4; /* vendor unique */
|
134 |
|
|
unsigned char capability; /* bits 0:DMA 1:LBA 2:IORDYsw 3:IORDYsup*/
|
135 |
|
|
unsigned short reserved50; /* reserved (word 50) */
|
136 |
|
|
unsigned char vendor5; /* vendor unique */
|
137 |
|
|
unsigned char tPIO; /* 0=slow, 1=medium, 2=fast */
|
138 |
|
|
unsigned char vendor6; /* vendor unique */
|
139 |
|
|
unsigned char tDMA; /* 0=slow, 1=medium, 2=fast */
|
140 |
|
|
unsigned short field_valid; /* bits 0:cur_ok 1:eide_ok */
|
141 |
|
|
unsigned short cur_cyls; /* logical cylinders */
|
142 |
|
|
unsigned short cur_heads; /* logical heads */
|
143 |
|
|
unsigned short cur_sectors; /* logical sectors per track */
|
144 |
|
|
unsigned short cur_capacity0; /* logical total sectors on drive */
|
145 |
|
|
unsigned short cur_capacity1; /* (2 words, misaligned int) */
|
146 |
|
|
unsigned char multsect; /* current multiple sector count */
|
147 |
|
|
unsigned char multsect_valid; /* when (bit0==1) multsect is ok */
|
148 |
|
|
unsigned int lba_capacity; /* total number of sectors */
|
149 |
|
|
unsigned short dma_1word; /* single-word dma info */
|
150 |
|
|
unsigned short dma_mword; /* multiple-word dma info */
|
151 |
|
|
unsigned short eide_pio_modes; /* bits 0:mode3 1:mode4 */
|
152 |
|
|
unsigned short eide_dma_min; /* min mword dma cycle time (ns) */
|
153 |
|
|
unsigned short eide_dma_time; /* recommended mword dma cycle time (ns) */
|
154 |
|
|
unsigned short eide_pio; /* min cycle time (ns), no IORDY */
|
155 |
|
|
unsigned short eide_pio_iordy; /* min cycle time (ns), with IORDY */
|
156 |
|
|
unsigned short word69;
|
157 |
|
|
unsigned short word70;
|
158 |
|
|
/* HDIO_GET_IDENTITY currently returns only words 0 through 70 */
|
159 |
|
|
unsigned short word71;
|
160 |
|
|
unsigned short word72;
|
161 |
|
|
unsigned short word73;
|
162 |
|
|
unsigned short word74;
|
163 |
|
|
unsigned short word75;
|
164 |
|
|
unsigned short word76;
|
165 |
|
|
unsigned short word77;
|
166 |
|
|
unsigned short word78;
|
167 |
|
|
unsigned short word79;
|
168 |
|
|
unsigned short word80;
|
169 |
|
|
unsigned short word81;
|
170 |
|
|
unsigned short command_sets; /* bits 0:Smart 1:Security 2:Removable 3:PM */
|
171 |
|
|
unsigned short word83; /* bits 14:Smart Enabled 13:0 zero */
|
172 |
|
|
unsigned short word84;
|
173 |
|
|
unsigned short word85;
|
174 |
|
|
unsigned short word86;
|
175 |
|
|
unsigned short word87;
|
176 |
|
|
unsigned short dma_ultra;
|
177 |
|
|
unsigned short word89; /* reserved (word 89) */
|
178 |
|
|
unsigned short word90; /* reserved (word 90) */
|
179 |
|
|
unsigned short word91; /* reserved (word 91) */
|
180 |
|
|
unsigned short word92; /* reserved (word 92) */
|
181 |
|
|
unsigned short word93; /* reserved (word 93) */
|
182 |
|
|
unsigned short word94; /* reserved (word 94) */
|
183 |
|
|
unsigned short word95; /* reserved (word 95) */
|
184 |
|
|
unsigned short word96; /* reserved (word 96) */
|
185 |
|
|
unsigned short word97; /* reserved (word 97) */
|
186 |
|
|
unsigned short word98; /* reserved (word 98) */
|
187 |
|
|
unsigned short word99; /* reserved (word 99) */
|
188 |
|
|
unsigned short word100; /* reserved (word 100) */
|
189 |
|
|
unsigned short word101; /* reserved (word 101) */
|
190 |
|
|
unsigned short word102; /* reserved (word 102) */
|
191 |
|
|
unsigned short word103; /* reserved (word 103) */
|
192 |
|
|
unsigned short word104; /* reserved (word 104) */
|
193 |
|
|
unsigned short word105; /* reserved (word 105) */
|
194 |
|
|
unsigned short word106; /* reserved (word 106) */
|
195 |
|
|
unsigned short word107; /* reserved (word 107) */
|
196 |
|
|
unsigned short word108; /* reserved (word 108) */
|
197 |
|
|
unsigned short word109; /* reserved (word 109) */
|
198 |
|
|
unsigned short word110; /* reserved (word 110) */
|
199 |
|
|
unsigned short word111; /* reserved (word 111) */
|
200 |
|
|
unsigned short word112; /* reserved (word 112) */
|
201 |
|
|
unsigned short word113; /* reserved (word 113) */
|
202 |
|
|
unsigned short word114; /* reserved (word 114) */
|
203 |
|
|
unsigned short word115; /* reserved (word 115) */
|
204 |
|
|
unsigned short word116; /* reserved (word 116) */
|
205 |
|
|
unsigned short word117; /* reserved (word 117) */
|
206 |
|
|
unsigned short word118; /* reserved (word 118) */
|
207 |
|
|
unsigned short word119; /* reserved (word 119) */
|
208 |
|
|
unsigned short word120; /* reserved (word 120) */
|
209 |
|
|
unsigned short word121; /* reserved (word 121) */
|
210 |
|
|
unsigned short word122; /* reserved (word 122) */
|
211 |
|
|
unsigned short word123; /* reserved (word 123) */
|
212 |
|
|
unsigned short word124; /* reserved (word 124) */
|
213 |
|
|
unsigned short word125; /* reserved (word 125) */
|
214 |
|
|
unsigned short word126; /* reserved (word 126) */
|
215 |
|
|
unsigned short word127; /* reserved (word 127) */
|
216 |
|
|
unsigned short security; /* bits 0:suuport 1:enabled 2:locked 3:frozen */
|
217 |
|
|
unsigned short reserved[127];
|
218 |
|
|
};
|
219 |
|
|
|
220 |
|
|
#ifdef __KERNEL__
|
221 |
|
|
/*
|
222 |
|
|
* These routines are used for kernel command line parameters from main.c:
|
223 |
|
|
*/
|
224 |
|
|
#include <linux/config.h>
|
225 |
|
|
|
226 |
|
|
#ifdef CONFIG_BLK_DEV_HD
|
227 |
|
|
void hd_setup(char *, int *);
|
228 |
|
|
#endif /* CONFIG_BLK_DEV_HD */
|
229 |
|
|
#ifdef CONFIG_BLK_DEV_IDE
|
230 |
|
|
void ide_setup(char *);
|
231 |
|
|
|
232 |
|
|
#ifdef CONFIG_BLK_DEV_IDE_PCMCIA
|
233 |
|
|
int ide_register(int io_port, int ctl_port, int irq);
|
234 |
|
|
void ide_unregister(unsigned int);
|
235 |
|
|
#endif /* CONFIG_BLK_DEV_IDE_PCMCIA */
|
236 |
|
|
|
237 |
|
|
#endif /* CONFIG_BLK_DEV_IDE */
|
238 |
|
|
|
239 |
|
|
#endif /* __KERNEL__ */
|
240 |
|
|
|
241 |
|
|
#endif /* _LINUX_HDREG_H */
|