1
2#ifndef _AHA1542_H_
3#define _AHA1542_H_
4
5#include <linux/types.h>
6
7
8
9#define STATUS(base) base
10#define STST BIT(7)
11#define DIAGF BIT(6)
12#define INIT BIT(5)
13#define IDLE BIT(4)
14#define CDF BIT(3)
15#define DF BIT(2)
16
17#define INVDCMD BIT(0)
18#define STATMASK (STST | DIAGF | INIT | IDLE | CDF | DF | INVDCMD)
19
20#define INTRFLAGS(base) (STATUS(base)+2)
21#define ANYINTR BIT(7)
22#define SCRD BIT(3)
23#define HACC BIT(2)
24#define MBOA BIT(1)
25#define MBIF BIT(0)
26#define INTRMASK (ANYINTR | SCRD | HACC | MBOA | MBIF)
27
28
29#define CONTROL(base) STATUS(base)
30#define HRST BIT(7)
31#define SRST BIT(6)
32#define IRST BIT(5)
33#define SCRST BIT(4)
34
35
36#define DATA(base) (STATUS(base)+1)
37#define CMD_NOP 0x00
38#define CMD_MBINIT 0x01
39#define CMD_START_SCSI 0x02
40#define CMD_INQUIRY 0x04
41#define CMD_EMBOI 0x05
42#define CMD_BUSON_TIME 0x07
43#define CMD_BUSOFF_TIME 0x08
44#define CMD_DMASPEED 0x09
45#define CMD_RETDEVS 0x0a
46#define CMD_RETCONF 0x0b
47#define CMD_RETSETUP 0x0d
48#define CMD_ECHO 0x1f
49
50#define CMD_EXTBIOS 0x28
51#define CMD_MBENABLE 0x29
52
53
54struct mailbox {
55 u8 status;
56 u8 ccbptr[3];
57};
58
59
60struct chain {
61 u8 datalen[3];
62 u8 dataptr[3];
63};
64
65
66static inline void any2scsi(u8 *p, u32 v)
67{
68 p[0] = v >> 16;
69 p[1] = v >> 8;
70 p[2] = v;
71}
72
73#define scsi2int(up) ( (((long)*(up)) << 16) + (((long)(up)[1]) << 8) + ((long)(up)[2]) )
74
75#define xscsi2int(up) ( (((long)(up)[0]) << 24) + (((long)(up)[1]) << 16) \
76 + (((long)(up)[2]) << 8) + ((long)(up)[3]) )
77
78#define MAX_CDB 12
79#define MAX_SENSE 14
80
81struct ccb {
82 u8 op;
83 u8 idlun;
84
85
86
87 u8 cdblen;
88 u8 rsalen;
89 u8 datalen[3];
90 u8 dataptr[3];
91 u8 linkptr[3];
92 u8 commlinkid;
93 u8 hastat;
94 u8 tarstat;
95 u8 reserved[2];
96 u8 cdb[MAX_CDB+MAX_SENSE];
97
98};
99
100#define AHA1542_REGION_SIZE 4
101#define AHA1542_MAILBOXES 8
102
103#endif
104