1 #ifndef _WD7000FASST_H
2
3 /* $Id: 7000fasst.h,v 1.1 1992/07/24 06:27:38 root Exp root $
4 *
5 * Header file for the WD 7000-FASST driver for Linux
6 *
7 * $Log: 7000fasst.h,v $
8 * Revision 1.1 1992/07/24 06:27:38 root
9 * Initial revision
10 *
11 * Revision 1.1 1992/07/05 08:32:32 root
12 * Initial revision
13 *
14 * Revision 1.1 1992/05/15 18:38:05 root
15 * Initial revision
16 *
17 * Revision 1.1 1992/04/02 03:23:13 drew
18 * Initial revision
19 *
20 * Revision 1.3 1992/01/27 14:46:29 tthorn
21 * *** empty log message ***
22 *
23 */
24
25 #include <linux/types.h>
26
27 #undef STATMASK
28 #undef CONTROL
29
30 #define io_base 0x350
31 #define intr_chan 15
32 #define dma_chan 6
33 #define OGMB_CNT 8
34 #define ICMB_CNT 8
35
36 /* I/O Port interface 4.2 */
37 /* READ */
38 #define ASC_STAT io_base
39 #define INT_IM 0x80 /* Interrupt Image Flag */
40 #define CMD_RDY 0x40 /* Command Port Ready */
41 #define CMD_REJ 0x20 /* Command Port Byte Rejected */
42 #define ASC_INI 0x10 /* ASC Initialized Flag */
43 #define STATMASK 0xf0 /* The lower 4 Bytes are reserved */
44
45 /* This register saves two purposes
46 * Diagnostics error
47 * Interrupt Status
48 */
49 #define INTR_STAT ASC_STAT+1
50 #define ANYINTR 0x80 /* Mailbox Service possible/required */
51 #define IMB 0x40 /* 1 Incoming / 0 Outgoing */
52 #define MBMASK 0x3f
53 /* if MSB is zero, the content of the lower ones keeps Diagnostic State *
54 * 00 Power-on, no diagnostics executed
55 * 01 No diagnostic Error Occured
56 * 02 RAM Failed
57 * 03 FIFO R/W Failed
58 * ...
59 */
60
61 /* WRITE */
62 #define COMMAND ASC_STAT
63
64 #define INTR_ACK ASC_STAT+1
65
66
67 #define CONTROL ASC_STAT+2
68 #define INT_EN 0x08 /* Interrupt Enable */
69 #define DMA_EN 0x04 /* DMA Enable */
70 #define SCSI_RES 0x02 /* SCSI Reset */
71 #define ASC_RES 0x01 /* ASC Reset */
72
73 /* The DMA-Controller */
74 #define DMA_MODE_REG 0xd6
75 #define DMA_MASK_REG 0xd4
76 #define S_DMA_MSK 0x04
77 #define DMA_CH 0x02
78 #define CASCADE 0xc0
79
80 /* Mailbox Definition 5.3 */
81
82 /* These belong in scsi.h also */
83 #undef any2scsi
84 #define any2scsi(up, p) \
85 (up)[0] = (((long)(p)) >> 16); \
86 (up)[1] = ((long)(p)) >> 8; \
87 (up)[2] = ((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
103 struct scb { /* Command Control Block 5.4.1 */
104 unchar op; /* Command Control Block Operation Code */
105 unchar idlun; /* op=0,2:Target Id, op=1:Initiator Id */
106 /* Outbound data transfer, length is checked*/
107 /* Inbound data transfer, length is checked */
108 /* Logical Unit Number */
109 unchar scbdata[12]; /* SCSI Command Block */
110 unchar sretstat; /* SCSI Return Status */
111 unchar vue; /* Vendor Unique Error Code */
112 unchar maxdata[3]; /* Maximum Data Transfer Length */
113 unchar dataptr[3]; /* SCSI Data Block Pointer */
114 unchar linkptr[3]; /* Next Command Link Pointer */
115 unchar direc; /* Transfer Direction */
116 unchar reserved2[6]; /* SCSI Command Descriptor Block */
117 /* REQUEST SENSE */
118 };
119
120 int wd7000fasst_detect(int);
121 int wd7000fasst_command(unsigned char target, const void *cmnd, void *buff, int bufflen);
122 int wd7000fasst_queuecommand(unchar target, const void *cmnd, void *buff, int bufflen, void (*done)(int,int));
123 int wd7000fasst_abort(int);
124 char *wd7000fasst_info(void);
125 int wd7000fasst_reset(void);
126
127 #ifndef NULL
128 #define NULL 0
129 #endif
130
131 #define WD7000FASST {"Western Digital 7000FASST", wd7000fasst_detect, \
132 wd7000fasst_info, wd7000fasst_command, \
133 wd7000fasst_queuecommand, \
134 wd7000fasst_abort, \
135 wd7000fasst_reset, \
136 1, 7, 0}
137 #endif