3 /* $Id: aha1542.h,v 1.1 1992/07/24 06:27:38 root Exp root $
5 * Header file for the adaptec 1542 driver for Linux
8 * Revision 1.1 1992/07/24 06:27:38 root
11 * Revision 1.2 1992/07/04 18:41:49 root
12 * Replaced distribution with current drivers
14 * Revision 1.3 1992/06/23 23:58:20 root
17 * Revision 1.2 1992/05/26 22:13:23 root
18 * Changed bug that prevented DMA above first 2 mbytes.
20 * Revision 1.1 1992/05/22 21:00:29 root
23 * Revision 1.1 1992/04/24 18:01:50 root
26 * Revision 1.1 1992/04/02 03:23:13 drew
29 * Revision 1.3 1992/01/27 14:46:29 tthorn
30 * *** empty log message ***
34 #include <linux/types.h>
35 #include <linux/kdev_t.h>
37 /* I/O Port interface 4.2 */
39 #define STATUS(base) base
40 #define STST 0x80 /* Self Test in Progress */
41 #define DIAGF 0x40 /* Internal Diagnostic Failure */
42 #define INIT 0x20 /* Mailbox Initialization Required */
43 #define IDLE 0x10 /* SCSI Host Adapter Idle */
44 #define CDF 0x08 /* Command/Data Out Port Full */
45 #define DF 0x04 /* Data In Port Full */
46 #define INVDCMD 0x01 /* Invalid H A Command */
47 #define STATMASK 0xfd /* 0x02 is reserved */
49 #define INTRFLAGS(base) (STATUS(base)+2)
50 #define ANYINTR 0x80 /* Any Interrupt */
51 #define SCRD 0x08 /* SCSI Reset Detected */
52 #define HACC 0x04 /* HA Command Complete */
53 #define MBOA 0x02 /* MBO Empty */
54 #define MBIF 0x01 /* MBI Full */
58 #define CONTROL(base) STATUS(base)
59 #define HRST 0x80 /* Hard Reset */
60 #define SRST 0x40 /* Soft Reset */
61 #define IRST 0x20 /* Interrupt Reset */
62 #define SCRST 0x10 /* SCSI Bus Reset */
65 #define DATA(base) (STATUS(base)+1)
66 #define CMD_NOP 0x00 /* No Operation */
67 #define CMD_MBINIT 0x01 /* Mailbox Initialization */
68 #define CMD_START_SCSI 0x02 /* Start SCSI Command */
69 #define CMD_INQUIRY 0x04 /* Adapter Inquiry */
70 #define CMD_EMBOI 0x05 /* Enable MailBox Out Interrupt */
71 #define CMD_BUSON_TIME 0x07 /* Set Bus-On Time */
72 #define CMD_BUSOFF_TIME 0x08 /* Set Bus-Off Time */
73 #define CMD_DMASPEED 0x09 /* Set AT Bus Transfer Speed */
74 #define CMD_RETDEVS 0x0a /* Return Installed Devices */
75 #define CMD_RETCONF 0x0b /* Return Configuration Data */
76 #define CMD_RETSETUP 0x0d /* Return Setup Data */
77 #define CMD_ECHO 0x1f /* ECHO Command Data */
79 #define CMD_EXTBIOS 0x28 /* Return extend bios information only 1542C */
80 #define CMD_MBENABLE 0x29 /* Set Mailbox Interface enable only 1542C */
82 /* Mailbox Definition 5.2.1 and 5.2.2 */
84 unchar status
; /* Command/Status */
85 unchar ccbptr
[3]; /* msb, .., lsb */
88 /* This is used with scatter-gather */
90 unchar datalen
[3]; /* Size of this part of chain */
91 unchar dataptr
[3]; /* Location of data */
94 /* These belong in scsi.h also */
95 #define any2scsi(up, p) \
96 (up)[0] = (((unsigned long)(p)) >> 16) ; \
97 (up)[1] = (((unsigned long)(p)) >> 8); \
98 (up)[2] = ((unsigned long)(p));
100 #define scsi2int(up) ( (((long)*(up)) << 16) + (((long)(up)[1]) << 8) + ((long)(up)[2]) )
102 #define xany2scsi(up, p) \
103 (up)[0] = ((long)(p)) >> 24; \
104 (up)[1] = ((long)(p)) >> 16; \
105 (up)[2] = ((long)(p)) >> 8; \
106 (up)[3] = ((long)(p));
108 #define xscsi2int(up) ( (((long)(up)[0]) << 24) + (((long)(up)[1]) << 16) \
109 + (((long)(up)[2]) << 8) + ((long)(up)[3]) )
114 struct ccb
{ /* Command Control Block 5.3 */
115 unchar op
; /* Command Control Block Operation Code */
116 unchar idlun
; /* op=0,2:Target Id, op=1:Initiator Id */
117 /* Outbound data transfer, length is checked*/
118 /* Inbound data transfer, length is checked */
119 /* Logical Unit Number */
120 unchar cdblen
; /* SCSI Command Length */
121 unchar rsalen
; /* Request Sense Allocation Length/Disable */
122 unchar datalen
[3]; /* Data Length (msb, .., lsb) */
123 unchar dataptr
[3]; /* Data Pointer */
124 unchar linkptr
[3]; /* Link Pointer */
125 unchar commlinkid
; /* Command Linking Identifier */
126 unchar hastat
; /* Host Adapter Status (HASTAT) */
127 unchar tarstat
; /* Target Device Status */
129 unchar cdb
[MAX_CDB
+MAX_SENSE
];/* SCSI Command Descriptor Block */
133 int aha1542_detect(Scsi_Host_Template
*);
134 int aha1542_command(Scsi_Cmnd
*);
135 int aha1542_queuecommand(Scsi_Cmnd
*, void (*done
)(Scsi_Cmnd
*));
136 int aha1542_abort(Scsi_Cmnd
* SCpnt
);
137 int aha1542_bus_reset(Scsi_Cmnd
* SCpnt
);
138 int aha1542_dev_reset(Scsi_Cmnd
* SCpnt
);
139 int aha1542_host_reset(Scsi_Cmnd
* SCpnt
);
140 extern int aha1542_old_abort(Scsi_Cmnd
* SCpnt
);
141 int aha1542_old_reset(Scsi_Cmnd
*, unsigned int);
142 int aha1542_biosparam(Disk
*, kdev_t
, int*);
144 #define AHA1542_MAILBOXES 8
145 #define AHA1542_SCATTER 16
146 #define AHA1542_CMDLUN 1
152 extern struct proc_dir_entry proc_scsi_aha1542
;
154 #define AHA1542 { proc_dir: &proc_scsi_aha1542, \
155 name: "Adaptec 1542", \
156 detect: aha1542_detect, \
157 command: aha1542_command, \
158 queuecommand: aha1542_queuecommand, \
159 abort: aha1542_old_abort, \
160 reset: aha1542_old_reset, \
161 eh_abort_handler: aha1542_abort, \
162 eh_device_reset_handler: aha1542_dev_reset, \
163 eh_bus_reset_handler: aha1542_bus_reset, \
164 eh_host_reset_handler: aha1542_host_reset, \
165 bios_param: aha1542_biosparam, \
166 can_queue: AHA1542_MAILBOXES, \
168 sg_tablesize: AHA1542_SCATTER, \
169 cmd_per_lun: AHA1542_CMDLUN, \
170 unchecked_isa_dma: 1, \
171 use_clustering: ENABLE_CLUSTERING, \