1 #ifndef _AHA1542_H
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 #include <linux/types.h>
35
36
37
38 #define STATUS(base) base
39 #define STST 0x80
40 #define DIAGF 0x40
41 #define INIT 0x20
42 #define IDLE 0x10
43 #define CDF 0x08
44 #define DF 0x04
45 #define INVDCMD 0x01
46 #define STATMASK 0xfd
47
48 #define INTRFLAGS(base) (STATUS(base)+2)
49 #define ANYINTR 0x80
50 #define SCRD 0x08
51 #define HACC 0x04
52 #define MBOA 0x02
53 #define MBIF 0x01
54 #define INTRMASK 0x8f
55
56
57 #define CONTROL(base) STATUS(base)
58 #define HRST 0x80
59 #define SRST 0x40
60 #define IRST 0x20
61 #define SCRST 0x10
62
63
64 #define DATA(base) (STATUS(base)+1)
65 #define CMD_NOP 0x00
66 #define CMD_MBINIT 0x01
67 #define CMD_START_SCSI 0x02
68 #define CMD_INQUIRY 0x04
69 #define CMD_EMBOI 0x05
70 #define CMD_BUSON_TIME 0x07
71 #define CMD_BUSOFF_TIME 0x08
72 #define CMD_RETDEVS 0x0a
73 #define CMD_RETCONF 0x0b
74 #define CMD_RETSETUP 0x0d
75 #define CMD_ECHO 0x1f
76
77 #define CMD_EXTBIOS 0x28
78 #define CMD_MBENABLE 0x29
79
80
81 struct mailbox {
82 unchar status;
83 unchar ccbptr[3];
84 };
85
86
87 struct chain {
88 unchar datalen[3];
89 unchar dataptr[3];
90 };
91
92
93 #define any2scsi(up, p) \
94 (up)[0] = (((unsigned long)(p)) >> 16) ; \
95 (up)[1] = (((unsigned long)(p)) >> 8); \
96 (up)[2] = ((unsigned long)(p));
97
98 #define scsi2int(up) ( (((long)*(up)) << 16) + (((long)(up)[1]) << 8) + ((long)(up)[2]) )
99
100 #define xany2scsi(up, p) \
101 (up)[0] = ((long)(p)) >> 24; \
102 (up)[1] = ((long)(p)) >> 16; \
103 (up)[2] = ((long)(p)) >> 8; \
104 (up)[3] = ((long)(p));
105
106 #define xscsi2int(up) ( (((long)(up)[0]) << 24) + (((long)(up)[1]) << 16) \
107 + (((long)(up)[2]) << 8) + ((long)(up)[3]) )
108
109 #define MAX_CDB 12
110 #define MAX_SENSE 14
111
112 struct ccb {
113 unchar op;
114 unchar idlun;
115
116
117
118 unchar cdblen;
119 unchar rsalen;
120 unchar datalen[3];
121 unchar dataptr[3];
122 unchar linkptr[3];
123 unchar commlinkid;
124 unchar hastat;
125 unchar tarstat;
126 unchar reserved[2];
127 unchar cdb[MAX_CDB+MAX_SENSE];
128
129 };
130
131 int aha1542_detect(int);
132 int aha1542_command(Scsi_Cmnd *);
133 int aha1542_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
134 int aha1542_abort(Scsi_Cmnd *, int);
135 const char *aha1542_info(void);
136 int aha1542_reset(Scsi_Cmnd *);
137 int aha1542_biosparam(int, int, int*);
138
139 #define AHA1542_MAILBOXES 8
140 #define AHA1542_SCATTER 16
141 #define AHA1542_CMDLUN 1
142
143 #ifndef NULL
144 #define NULL 0
145 #endif
146
147 #define AHA1542 {"Adaptec 1542", aha1542_detect, \
148 aha1542_info, aha1542_command, \
149 aha1542_queuecommand, \
150 aha1542_abort, \
151 aha1542_reset, \
152 NULL, \
153 aha1542_biosparam, \
154 AHA1542_MAILBOXES, 7, AHA1542_SCATTER, AHA1542_CMDLUN \
155 , 0, 1}
156
157 #endif