1 #ifndef _LINUX_HDREG_H
2 #define _LINUX_HDREG_H
3
4
5
6
7
8
9 #define HD_IRQ 14
10
11
12
13
14 #define HD_DATA 0x1f0
15 #define HD_ERROR 0x1f1
16 #define HD_NSECTOR 0x1f2
17 #define HD_SECTOR 0x1f3
18 #define HD_LCYL 0x1f4
19 #define HD_HCYL 0x1f5
20 #define HD_CURRENT 0x1f6
21 #define HD_STATUS 0x1f7
22 #define HD_FEATURE HD_ERROR
23 #define HD_PRECOMP HD_FEATURE
24 #define HD_COMMAND HD_STATUS
25
26 #define HD_CMD 0x3f6
27 #define HD_ALTSTATUS 0x3f6
28
29
30
31
32 #define ERR_STAT 0x01
33 #define INDEX_STAT 0x02
34 #define ECC_STAT 0x04
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
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
51 #define WIN_SETIDLE1 0xE3
52 #define WIN_SETIDLE2 0x97
53
54 #define WIN_DOORLOCK 0xde
55 #define WIN_DOORUNLOCK 0xdf
56
57 #define WIN_MULTREAD 0xC4
58 #define WIN_MULTWRITE 0xC5
59 #define WIN_SETMULT 0xC6
60 #define WIN_IDENTIFY 0xEC
61 #define WIN_SETFEATURES 0xEF
62 #define WIN_READDMA 0xc8
63 #define WIN_WRITEDMA 0xca
64
65
66 #define WIN_PIDENTIFY 0xA1
67 #define WIN_SRST 0x08
68 #define WIN_PACKETCMD 0xa0
69
70
71 #define MARK_ERR 0x01
72 #define TRK0_ERR 0x02
73 #define ABRT_ERR 0x04
74 #define ID_ERR 0x10
75 #define ECC_ERR 0x40
76 #define BBD_ERR 0x80
77
78 struct hd_geometry {
79 unsigned char heads;
80 unsigned char sectors;
81 unsigned short cylinders;
82 unsigned long start;
83 };
84
85
86 #define HDIO_GETGEO 0x0301
87 #define HDIO_GET_UNMASKINTR 0x0302
88 #define HDIO_GET_MULTCOUNT 0x0304
89 #define HDIO_GET_IDENTITY 0x0307
90 #define HDIO_GET_KEEPSETTINGS 0x0308
91 #define HDIO_GET_32BIT 0x0309
92 #define HDIO_GET_NOWERR 0x030a
93 #define HDIO_GET_DMA 0x030b
94 #define HDIO_DRIVE_CMD 0x031f
95
96
97 #define HDIO_SET_MULTCOUNT 0x0321
98 #define HDIO_SET_UNMASKINTR 0x0322
99 #define HDIO_SET_KEEPSETTINGS 0x0323
100 #define HDIO_SET_32BIT 0x0324
101 #define HDIO_SET_NOWERR 0x0325
102 #define HDIO_SET_DMA 0x0326
103 #define HDIO_SET_PIO_MODE 0x0327
104
105
106 struct hd_driveid {
107 unsigned short config;
108 unsigned short cyls;
109 unsigned short reserved2;
110 unsigned short heads;
111 unsigned short track_bytes;
112 unsigned short sector_bytes;
113 unsigned short sectors;
114 unsigned short vendor0;
115 unsigned short vendor1;
116 unsigned short vendor2;
117 unsigned char serial_no[20];
118 unsigned short buf_type;
119 unsigned short buf_size;
120 unsigned short ecc_bytes;
121 unsigned char fw_rev[8];
122 unsigned char model[40];
123 unsigned char max_multsect;
124 unsigned char vendor3;
125 unsigned short dword_io;
126 unsigned char vendor4;
127 unsigned char capability;
128 unsigned short reserved50;
129 unsigned char vendor5;
130 unsigned char tPIO;
131 unsigned char vendor6;
132 unsigned char tDMA;
133 unsigned short field_valid;
134 unsigned short cur_cyls;
135 unsigned short cur_heads;
136 unsigned short cur_sectors;
137 unsigned short cur_capacity0;
138 unsigned short cur_capacity1;
139 unsigned char multsect;
140 unsigned char multsect_valid;
141 unsigned int lba_capacity;
142 unsigned short dma_1word;
143 unsigned short dma_mword;
144 unsigned short eide_pio_modes;
145 unsigned short eide_dma_min;
146 unsigned short eide_dma_time;
147 unsigned short eide_pio;
148 unsigned short eide_pio_iordy;
149 unsigned short reserved69;
150 unsigned short reserved70;
151
152
153
154 };
155
156 #ifdef __KERNEL__
157
158
159
160 #include <linux/config.h>
161
162 #ifdef CONFIG_BLK_DEV_HD
163 void hd_setup(char *, int *);
164 #endif
165 #ifdef CONFIG_BLK_DEV_IDE
166 void ide_setup(char *);
167
168 #ifdef CONFIG_BLK_DEV_IDE_PCMCIA
169 int ide_register(int io_port, int ctl_port, int irq);
170 void ide_unregister(unsigned int);
171 #endif
172
173 #endif
174
175 #endif
176
177 #endif