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
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 STATUS+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 STATUS
58 #define HRST 0x80
59 #define SRST 0x40
60 #define IRST 0x20
61 #define SCRST 0x10
62
63
64 #define DATA STATUS+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
78 struct mailbox {
79 unchar status;
80 unchar ccbptr[3];
81 };
82
83
84 #define any2scsi(up, p) \
85 (up)[0] = (((unsigned long)(p)) >> 16) ; \
86 (up)[1] = (((unsigned long)(p)) >> 8); \
87 (up)[2] = ((unsigned long)(p));
88
89 #define scsi2int(up) ( (((long)*(up)) << 16) + (((long)(up)[1]) << 8) + ((long)(up)[2]) )
90
91 #define xany2scsi(up, p) \
92 (up)[0] = ((long)(p)) >> 24; \
93 (up)[1] = ((long)(p)) >> 16; \
94 (up)[2] = ((long)(p)) >> 8; \
95 (up)[3] = ((long)(p));
96
97 #define xscsi2int(up) ( (((long)(up)[0]) << 24) + (((long)(up)[1]) << 16) \
98 + (((long)(up)[2]) << 8) + ((long)(up)[3]) )
99
100 #define MAX_CDB 12
101 #define MAX_SENSE 14
102
103 struct ccb {
104 unchar op;
105 unchar idlun;
106
107
108
109 unchar cdblen;
110 unchar rsalen;
111 unchar datalen[3];
112 unchar dataptr[3];
113 unchar linkptr[3];
114 unchar commlinkid;
115 unchar hastat;
116 unchar tarstat;
117 unchar reserved[2];
118 unchar cdb[MAX_CDB+MAX_SENSE];
119
120 };
121
122 int aha1542_detect(int);
123 int aha1542_command(unsigned char target, const void *cmnd, void *buff, int bufflen);
124 int aha1542_queuecommand(unchar target, const void *cmnd, void *buff, int bufflen, void (*done)(int, int));
125 int aha1542_abort(int);
126 char *aha1542_info(void);
127 int aha1542_reset(void);
128
129 #ifndef NULL
130 #define NULL 0
131 #endif
132
133 #define AHA1542 {"Adaptec 1542", aha1542_detect, \
134 aha1542_info, aha1542_command, \
135 aha1542_queuecommand, \
136 aha1542_abort, \
137 aha1542_reset, \
138 1, 7, 0}
139 #endif