1 #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. Check out some definitions (see comments with
7 * a ques).
8 */
9
10 /* Hd controller regs. Ref: IBM AT Bios-listing */
11 #define HD_DATA 0x1f0 /* _CTL when writing */
12 #define HD_ERROR 0x1f1 /* see err-bits */
13 #define HD_NSECTOR 0x1f2 /* nr of sectors to read/write */
14 #define HD_SECTOR 0x1f3 /* starting sector */
15 #define HD_LCYL 0x1f4 /* starting cylinder */
16 #define HD_HCYL 0x1f5 /* high byte of starting cyl */
17 #define HD_CURRENT 0x1f6 /* 101dhhhh , d=drive, hhhh=head */
18 #define HD_STATUS 0x1f7 /* see status-bits */
19 #define HD_PRECOMP HD_ERROR /* same io address, read=error, write=precomp */
20 #define HD_COMMAND HD_STATUS /* same io address, read=status, write=cmd */
21
22 #define HD_CMD 0x3f6
23
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
34 /* Values for HD_COMMAND */
35 #define WIN_RESTORE 0x10
36 #define WIN_READ 0x20
37 #define WIN_WRITE 0x30
38 #define WIN_VERIFY 0x40
39 #define WIN_FORMAT 0x50
40 #define WIN_INIT 0x60
41 #define WIN_SEEK 0x70
42 #define WIN_DIAGNOSE 0x90
43 #define WIN_SPECIFY 0x91
44
45 /* Bits for HD_ERROR */
46 #define MARK_ERR 0x01 /* Bad address mark ? */
47 #define TRK0_ERR 0x02 /* couldn't find track 0 */
48 #define ABRT_ERR 0x04 /* ? */
49 #define ID_ERR 0x10 /* ? */
50 #define ECC_ERR 0x40 /* ? */
51 #define BBD_ERR 0x80 /* ? */
52
53
54 #define HDIO_REQ 0x301
55 struct hd_geometry {
56 unsigned char heads;
57 unsigned char sectors;
58 unsigned short cylinders;
59 unsigned long start;
60 };
61 #endif