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