1#ifndef _AHA1740_H
2
3
4
5
6
7
8
9
10
11
12
13#include <linux/types.h>
14
15#define SLOTSIZE 0x5c
16
17
18#define HID0(base) (base + 0x0)
19#define HID1(base) (base + 0x1)
20#define HID2(base) (base + 0x2)
21#define HID3(base) (base + 0x3)
22#define EBCNTRL(base) (base + 0x4)
23#define PORTADR(base) (base + 0x40)
24#define BIOSADR(base) (base + 0x41)
25#define INTDEF(base) (base + 0x42)
26#define SCSIDEF(base) (base + 0x43)
27#define BUSDEF(base) (base + 0x44)
28#define RESV0(base) (base + 0x45)
29#define RESV1(base) (base + 0x46)
30#define RESV2(base) (base + 0x47)
31
32#define HID_MFG "ADP"
33#define HID_PRD 0
34#define HID_REV 2
35#define EBCNTRL_VALUE 1
36#define PORTADDR_ENH 0x80
37
38#define G2INTST(base) (base + 0x56)
39#define G2STAT(base) (base + 0x57)
40#define MBOXIN0(base) (base + 0x58)
41#define MBOXIN1(base) (base + 0x59)
42#define MBOXIN2(base) (base + 0x5a)
43#define MBOXIN3(base) (base + 0x5b)
44#define G2STAT2(base) (base + 0x5c)
45
46#define G2INTST_MASK 0xf0
47#define G2INTST_CCBGOOD 0x10
48#define G2INTST_CCBRETRY 0x50
49#define G2INTST_HARDFAIL 0x70
50#define G2INTST_CMDGOOD 0xa0
51#define G2INTST_CCBERROR 0xc0
52#define G2INTST_ASNEVENT 0xd0
53#define G2INTST_CMDERROR 0xe0
54
55#define G2STAT_MBXOUT 4
56#define G2STAT_INTPEND 2
57#define G2STAT_BUSY 1
58
59#define G2STAT2_READY 0
60
61
62#define MBOXOUT0(base) (base + 0x50)
63#define MBOXOUT1(base) (base + 0x51)
64#define MBOXOUT2(base) (base + 0x52)
65#define MBOXOUT3(base) (base + 0x53)
66#define ATTN(base) (base + 0x54)
67#define G2CNTRL(base) (base + 0x55)
68
69#define ATTN_IMMED 0x10
70#define ATTN_START 0x40
71#define ATTN_ABORT 0x50
72
73#define G2CNTRL_HRST 0x80
74#define G2CNTRL_IRST 0x40
75#define G2CNTRL_HRDY 0x20
76
77
78struct aha1740_chain {
79 u32 dataptr;
80 u32 datalen;
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#define MAX_STATUS 32
103
104struct ecb {
105 u16 cmdw;
106
107 u16 cne:1,
108 :6, di:1,
109 :2, ses:1,
110 :1, sg:1,
111 :1, dsb:1,
112 ars:1;
113
114 u16 lun:3,
115 tag:1,
116 tt:2,
117 nd:1,
118 :1, dat:1,
119 dir:1,
120 st:1,
121 chk:1,
122 :2, rec:1,:1;
123 u16 nil0;
124 u32 dataptr;
125 u32 datalen;
126 u32 statusptr;
127 u32 linkptr;
128 u32 nil1;
129 u32 senseptr;
130 u8 senselen;
131 u8 cdblen;
132 u16 datacheck;
133 u8 cdb[MAX_CDB];
134
135 u8 sense[MAX_SENSE];
136 u8 status[MAX_STATUS];
137 Scsi_Cmnd *SCpnt;
138 void (*done) (Scsi_Cmnd *);
139};
140
141#define AHA1740CMD_NOP 0x00
142#define AHA1740CMD_INIT 0x01
143#define AHA1740CMD_DIAG 0x05
144#define AHA1740CMD_SCSI 0x06
145#define AHA1740CMD_SENSE 0x08
146#define AHA1740CMD_DOWN 0x09
147#define AHA1740CMD_RINQ 0x0a
148#define AHA1740CMD_TARG 0x10
149
150#define AHA1740_ECBS 32
151#define AHA1740_SCATTER 16
152
153#endif
154