1
2
3
4
5
6
7
8
9 #ifndef _SEAGATE_H
10 #define SEAGATE_H
11
12
13
14 #ifndef ASM
15 int seagate_st0x_detect(int);
16 int seagate_st0x_command(unsigned char target, const void *cmnd, void *buff,
17 int bufflen);
18 int seagate_st0x_queue_command(unsigned char target, const void *cmnd,
19 void *buff, int bufflen, void (*done)(int, int));
20
21 int seagate_st0x_abort(int);
22 char *seagate_st0x_info(void);
23 int seagate_st0x_reset(void);
24
25 #ifndef NULL
26 #define NULL 0
27 #endif
28
29 #define SEAGATE_ST0X {"Seagate ST-01/ST-02", seagate_st0x_detect, \
30 seagate_st0x_info, seagate_st0x_command, \
31 seagate_st0x_queue_command, seagate_st0x_abort, \
32 seagate_st0x_reset, 1, 7, 0}
33 #endif
34
35
36
37
38
39
40 #define PARITY
41
42
43
44
45
46
47 #undef ARBITRATE
48
49
50
51
52
53
54
55
56
57
58
59
60 #define CMD_RST 0x01
61 #define CMD_SEL 0x02
62 #define CMD_BSY 0x04
63 #define CMD_ATTN 0x08
64 #define CMD_START_ARB 0x10
65 #define CMD_EN_PARITY 0x20
66 #define CMD_INTR 0x40
67 #define CMD_DRVR_ENABLE 0x80
68
69
70
71
72
73 #define STAT_BSY 0x01
74 #define STAT_MSG 0x02
75 #define STAT_IO 0x04
76 #define STAT_CD 0x08
77 #define STAT_REQ 0x10
78 #define STAT_SEL 0x20
79 #define STAT_PARITY 0x40
80 #define STAT_ARB_CMPL 0x80
81
82
83
84
85
86 #define REQ_MASK (STAT_CD | STAT_IO | STAT_MSG)
87 #define REQ_DATAOUT 0
88 #define REQ_DATAIN STAT_IO
89 #define REQ_CMDOUT STAT_CD
90 #define REQ_STATIN (STAT_CD | STAT_IO)
91 #define REQ_MSGOUT (STAT_MSG | STAT_CD)
92 #define REQ_MSGIN (STAT_MSG | STAT_CD | STAT_IO)
93
94 extern volatile int seagate_st0x_timeout;
95
96 #ifdef PARITY
97 #define BASE_CMD CMD_EN_PARITY
98 #else
99 #define BASE_CMD 0
100 #endif
101
102
103
104
105
106 #define PHASE_BUS_FREE 1
107 #define PHASE_ARBITRATION 2
108 #define PHASE_SELECTION 4
109 #define PHASE_DATAIN 8
110 #define PHASE_DATAOUT 0x10
111 #define PHASE_CMDOUT 0x20
112 #define PHASE_MSGIN 0x40
113 #define PHASE_MSGOUT 0x80
114 #define PHASE_STATUSIN 0x100
115 #define PHASE_ETC (PHASE_DATAIN | PHASE_DATA_OUT | PHASE_CMDOUT | PHASE_MSGIN | PHASE_MSGOUT | PHASE_STATUSIN)
116 #define PRINT_COMMAND 0x200
117 #define PHASE_EXIT 0x400
118 #define PHASE_RESELECT 0x800
119
120
121
122
123
124 #define ST0X_BUS_FREE_DELAY 25
125 #define ST0X_SELECTION_DELAY 3
126
127 #define eoi() __asm__("push %%eax\nmovb $0x20, %%al\noutb %%al, $0x20\npop %%eax"::)
128
129
130 #endif
131