1 |
1626 |
jcastillo |
#ifndef _AHA1542_H
|
2 |
|
|
|
3 |
|
|
/* $Id: aha1542.h,v 1.1 2005-12-20 10:17:45 jcastillo Exp $
|
4 |
|
|
*
|
5 |
|
|
* Header file for the adaptec 1542 driver for Linux
|
6 |
|
|
*
|
7 |
|
|
* $Log: not supported by cvs2svn $
|
8 |
|
|
* Revision 1.1.1.1 2001/09/10 07:44:30 simons
|
9 |
|
|
* Initial import
|
10 |
|
|
*
|
11 |
|
|
* Revision 1.1.1.1 2001/07/02 17:58:27 simons
|
12 |
|
|
* Initial revision
|
13 |
|
|
*
|
14 |
|
|
* Revision 1.1 1992/07/24 06:27:38 root
|
15 |
|
|
* Initial revision
|
16 |
|
|
*
|
17 |
|
|
* Revision 1.2 1992/07/04 18:41:49 root
|
18 |
|
|
* Replaced distribution with current drivers
|
19 |
|
|
*
|
20 |
|
|
* Revision 1.3 1992/06/23 23:58:20 root
|
21 |
|
|
* Fixes.
|
22 |
|
|
*
|
23 |
|
|
* Revision 1.2 1992/05/26 22:13:23 root
|
24 |
|
|
* Changed bug that prevented DMA above first 2 mbytes.
|
25 |
|
|
*
|
26 |
|
|
* Revision 1.1 1992/05/22 21:00:29 root
|
27 |
|
|
* Initial revision
|
28 |
|
|
*
|
29 |
|
|
* Revision 1.1 1992/04/24 18:01:50 root
|
30 |
|
|
* Initial revision
|
31 |
|
|
*
|
32 |
|
|
* Revision 1.1 1992/04/02 03:23:13 drew
|
33 |
|
|
* Initial revision
|
34 |
|
|
*
|
35 |
|
|
* Revision 1.3 1992/01/27 14:46:29 tthorn
|
36 |
|
|
* *** empty log message ***
|
37 |
|
|
*
|
38 |
|
|
*/
|
39 |
|
|
|
40 |
|
|
#include <linux/types.h>
|
41 |
|
|
#include <linux/kdev_t.h>
|
42 |
|
|
|
43 |
|
|
/* I/O Port interface 4.2 */
|
44 |
|
|
/* READ */
|
45 |
|
|
#define STATUS(base) base
|
46 |
|
|
#define STST 0x80 /* Self Test in Progress */
|
47 |
|
|
#define DIAGF 0x40 /* Internal Diagnostic Failure */
|
48 |
|
|
#define INIT 0x20 /* Mailbox Initialization Required */
|
49 |
|
|
#define IDLE 0x10 /* SCSI Host Adapter Idle */
|
50 |
|
|
#define CDF 0x08 /* Command/Data Out Port Full */
|
51 |
|
|
#define DF 0x04 /* Data In Port Full */
|
52 |
|
|
#define INVDCMD 0x01 /* Invalid H A Command */
|
53 |
|
|
#define STATMASK 0xfd /* 0x02 is reserved */
|
54 |
|
|
|
55 |
|
|
#define INTRFLAGS(base) (STATUS(base)+2)
|
56 |
|
|
#define ANYINTR 0x80 /* Any Interrupt */
|
57 |
|
|
#define SCRD 0x08 /* SCSI Reset Detected */
|
58 |
|
|
#define HACC 0x04 /* HA Command Complete */
|
59 |
|
|
#define MBOA 0x02 /* MBO Empty */
|
60 |
|
|
#define MBIF 0x01 /* MBI Full */
|
61 |
|
|
#define INTRMASK 0x8f
|
62 |
|
|
|
63 |
|
|
/* WRITE */
|
64 |
|
|
#define CONTROL(base) STATUS(base)
|
65 |
|
|
#define HRST 0x80 /* Hard Reset */
|
66 |
|
|
#define SRST 0x40 /* Soft Reset */
|
67 |
|
|
#define IRST 0x20 /* Interrupt Reset */
|
68 |
|
|
#define SCRST 0x10 /* SCSI Bus Reset */
|
69 |
|
|
|
70 |
|
|
/* READ/WRITE */
|
71 |
|
|
#define DATA(base) (STATUS(base)+1)
|
72 |
|
|
#define CMD_NOP 0x00 /* No Operation */
|
73 |
|
|
#define CMD_MBINIT 0x01 /* Mailbox Initialization */
|
74 |
|
|
#define CMD_START_SCSI 0x02 /* Start SCSI Command */
|
75 |
|
|
#define CMD_INQUIRY 0x04 /* Adapter Inquiry */
|
76 |
|
|
#define CMD_EMBOI 0x05 /* Enable MailBox Out Interrupt */
|
77 |
|
|
#define CMD_BUSON_TIME 0x07 /* Set Bus-On Time */
|
78 |
|
|
#define CMD_BUSOFF_TIME 0x08 /* Set Bus-Off Time */
|
79 |
|
|
#define CMD_DMASPEED 0x09 /* Set AT Bus Transfer Speed */
|
80 |
|
|
#define CMD_RETDEVS 0x0a /* Return Installed Devices */
|
81 |
|
|
#define CMD_RETCONF 0x0b /* Return Configuration Data */
|
82 |
|
|
#define CMD_RETSETUP 0x0d /* Return Setup Data */
|
83 |
|
|
#define CMD_ECHO 0x1f /* ECHO Command Data */
|
84 |
|
|
|
85 |
|
|
#define CMD_EXTBIOS 0x28 /* Return extend bios information only 1542C */
|
86 |
|
|
#define CMD_MBENABLE 0x29 /* Set Mailbox Interface enable only 1542C */
|
87 |
|
|
|
88 |
|
|
/* Mailbox Definition 5.2.1 and 5.2.2 */
|
89 |
|
|
struct mailbox {
|
90 |
|
|
unchar status; /* Command/Status */
|
91 |
|
|
unchar ccbptr[3]; /* msb, .., lsb */
|
92 |
|
|
};
|
93 |
|
|
|
94 |
|
|
/* This is used with scatter-gather */
|
95 |
|
|
struct chain {
|
96 |
|
|
unchar datalen[3]; /* Size of this part of chain */
|
97 |
|
|
unchar dataptr[3]; /* Location of data */
|
98 |
|
|
};
|
99 |
|
|
|
100 |
|
|
/* These belong in scsi.h also */
|
101 |
|
|
#define any2scsi(up, p) \
|
102 |
|
|
(up)[0] = (((unsigned long)(p)) >> 16) ; \
|
103 |
|
|
(up)[1] = (((unsigned long)(p)) >> 8); \
|
104 |
|
|
(up)[2] = ((unsigned long)(p));
|
105 |
|
|
|
106 |
|
|
#define scsi2int(up) ( (((long)*(up)) << 16) + (((long)(up)[1]) << 8) + ((long)(up)[2]) )
|
107 |
|
|
|
108 |
|
|
#define xany2scsi(up, p) \
|
109 |
|
|
(up)[0] = ((long)(p)) >> 24; \
|
110 |
|
|
(up)[1] = ((long)(p)) >> 16; \
|
111 |
|
|
(up)[2] = ((long)(p)) >> 8; \
|
112 |
|
|
(up)[3] = ((long)(p));
|
113 |
|
|
|
114 |
|
|
#define xscsi2int(up) ( (((long)(up)[0]) << 24) + (((long)(up)[1]) << 16) \
|
115 |
|
|
+ (((long)(up)[2]) << 8) + ((long)(up)[3]) )
|
116 |
|
|
|
117 |
|
|
#define MAX_CDB 12
|
118 |
|
|
#define MAX_SENSE 14
|
119 |
|
|
|
120 |
|
|
struct ccb { /* Command Control Block 5.3 */
|
121 |
|
|
unchar op; /* Command Control Block Operation Code */
|
122 |
|
|
unchar idlun; /* op=0,2:Target Id, op=1:Initiator Id */
|
123 |
|
|
/* Outbound data transfer, length is checked*/
|
124 |
|
|
/* Inbound data transfer, length is checked */
|
125 |
|
|
/* Logical Unit Number */
|
126 |
|
|
unchar cdblen; /* SCSI Command Length */
|
127 |
|
|
unchar rsalen; /* Request Sense Allocation Length/Disable */
|
128 |
|
|
unchar datalen[3]; /* Data Length (msb, .., lsb) */
|
129 |
|
|
unchar dataptr[3]; /* Data Pointer */
|
130 |
|
|
unchar linkptr[3]; /* Link Pointer */
|
131 |
|
|
unchar commlinkid; /* Command Linking Identifier */
|
132 |
|
|
unchar hastat; /* Host Adapter Status (HASTAT) */
|
133 |
|
|
unchar tarstat; /* Target Device Status */
|
134 |
|
|
unchar reserved[2];
|
135 |
|
|
unchar cdb[MAX_CDB+MAX_SENSE];/* SCSI Command Descriptor Block */
|
136 |
|
|
/* REQUEST SENSE */
|
137 |
|
|
};
|
138 |
|
|
|
139 |
|
|
int aha1542_detect(Scsi_Host_Template *);
|
140 |
|
|
int aha1542_command(Scsi_Cmnd *);
|
141 |
|
|
int aha1542_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
|
142 |
|
|
int aha1542_abort(Scsi_Cmnd *);
|
143 |
|
|
int aha1542_reset(Scsi_Cmnd *, unsigned int);
|
144 |
|
|
int aha1542_biosparam(Disk *, kdev_t, int*);
|
145 |
|
|
|
146 |
|
|
#define AHA1542_MAILBOXES 8
|
147 |
|
|
#define AHA1542_SCATTER 16
|
148 |
|
|
#define AHA1542_CMDLUN 1
|
149 |
|
|
|
150 |
|
|
#ifndef NULL
|
151 |
|
|
#define NULL 0
|
152 |
|
|
#endif
|
153 |
|
|
|
154 |
|
|
extern struct proc_dir_entry proc_scsi_aha1542;
|
155 |
|
|
|
156 |
|
|
#define AHA1542 { NULL, NULL, \
|
157 |
|
|
&proc_scsi_aha1542,/* proc_dir_entry */ \
|
158 |
|
|
NULL, \
|
159 |
|
|
"Adaptec 1542", \
|
160 |
|
|
aha1542_detect, \
|
161 |
|
|
NULL, \
|
162 |
|
|
NULL, \
|
163 |
|
|
aha1542_command, \
|
164 |
|
|
aha1542_queuecommand, \
|
165 |
|
|
aha1542_abort, \
|
166 |
|
|
aha1542_reset, \
|
167 |
|
|
NULL, \
|
168 |
|
|
aha1542_biosparam, \
|
169 |
|
|
AHA1542_MAILBOXES, \
|
170 |
|
|
7, \
|
171 |
|
|
AHA1542_SCATTER, \
|
172 |
|
|
AHA1542_CMDLUN, \
|
173 |
|
|
0, \
|
174 |
|
|
1, \
|
175 |
|
|
ENABLE_CLUSTERING}
|
176 |
|
|
|
177 |
|
|
#endif
|