ahbreg.h revision 1.2 1 1.2 mycroft /* $NetBSD: ahbreg.h,v 1.2 1996/09/01 00:54:34 mycroft Exp $ */
2 1.2 mycroft
3 1.2 mycroft /*
4 1.2 mycroft * Copyright (c) 1994, 1996 Charles M. Hannum. All rights reserved.
5 1.2 mycroft *
6 1.2 mycroft * Redistribution and use in source and binary forms, with or without
7 1.2 mycroft * modification, are permitted provided that the following conditions
8 1.2 mycroft * are met:
9 1.2 mycroft * 1. Redistributions of source code must retain the above copyright
10 1.2 mycroft * notice, this list of conditions and the following disclaimer.
11 1.2 mycroft * 2. Redistributions in binary form must reproduce the above copyright
12 1.2 mycroft * notice, this list of conditions and the following disclaimer in the
13 1.2 mycroft * documentation and/or other materials provided with the distribution.
14 1.2 mycroft * 3. All advertising materials mentioning features or use of this software
15 1.2 mycroft * must display the following acknowledgement:
16 1.2 mycroft * This product includes software developed by Charles M. Hannum.
17 1.2 mycroft * 4. The name of the author may not be used to endorse or promote products
18 1.2 mycroft * derived from this software without specific prior written permission.
19 1.2 mycroft *
20 1.2 mycroft * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 1.2 mycroft * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 1.2 mycroft * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 1.2 mycroft * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 1.2 mycroft * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 1.2 mycroft * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 1.2 mycroft * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 1.2 mycroft * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 1.2 mycroft * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 1.2 mycroft * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 1.2 mycroft */
31 1.2 mycroft
32 1.2 mycroft /*
33 1.2 mycroft * Originally written by Julian Elischer (julian (at) tfs.com)
34 1.2 mycroft * for TRW Financial Systems for use under the MACH(2.5) operating system.
35 1.2 mycroft *
36 1.2 mycroft * TRW Financial Systems, in accordance with their agreement with Carnegie
37 1.2 mycroft * Mellon University, makes this software available to CMU to distribute
38 1.2 mycroft * or use in any manner that they see fit as long as this message is kept with
39 1.2 mycroft * the software. For this reason TFS also grants any other persons or
40 1.2 mycroft * organisations permission to use or modify this software.
41 1.2 mycroft *
42 1.2 mycroft * TFS supplies this software to be publicly redistributed
43 1.2 mycroft * on the understanding that TFS is not responsible for the correct
44 1.2 mycroft * functioning of this software in any circumstances.
45 1.2 mycroft */
46 1.2 mycroft
47 1.1 mycroft typedef u_long physaddr;
48 1.1 mycroft typedef u_long physlen;
49 1.1 mycroft
50 1.1 mycroft /*
51 1.1 mycroft * AHA1740 EISA board mode registers (Offset from slot base)
52 1.1 mycroft */
53 1.1 mycroft #define PORTADDR 0xCC0
54 1.1 mycroft #define PORTADDR_ENHANCED 0x80
55 1.1 mycroft #define BIOSADDR 0xCC1
56 1.1 mycroft #define INTDEF 0xCC2
57 1.1 mycroft #define SCSIDEF 0xCC3
58 1.1 mycroft #define BUSDEF 0xCC4
59 1.1 mycroft #define RESV0 0xCC5
60 1.1 mycroft #define RESV1 0xCC6
61 1.1 mycroft #define RESV2 0xCC7
62 1.1 mycroft /**** bit definitions for INTDEF ****/
63 1.1 mycroft #define INT9 0x00
64 1.1 mycroft #define INT10 0x01
65 1.1 mycroft #define INT11 0x02
66 1.1 mycroft #define INT12 0x03
67 1.1 mycroft #define INT14 0x05
68 1.1 mycroft #define INT15 0x06
69 1.1 mycroft #define INTHIGH 0x08 /* int high=ACTIVE (else edge) */
70 1.1 mycroft #define INTEN 0x10
71 1.1 mycroft /**** bit definitions for SCSIDEF ****/
72 1.1 mycroft #define HSCSIID 0x0F /* our SCSI ID */
73 1.1 mycroft #define RSTPWR 0x10 /* reset scsi bus on power up or reset */
74 1.1 mycroft /**** bit definitions for BUSDEF ****/
75 1.1 mycroft #define B0uS 0x00 /* give up bus immediatly */
76 1.1 mycroft #define B4uS 0x01 /* delay 4uSec. */
77 1.1 mycroft #define B8uS 0x02
78 1.1 mycroft
79 1.1 mycroft /*
80 1.1 mycroft * AHA1740 ENHANCED mode mailbox control regs (Offset from slot base)
81 1.1 mycroft */
82 1.1 mycroft #define MBOXOUT0 0xCD0
83 1.1 mycroft #define MBOXOUT1 0xCD1
84 1.1 mycroft #define MBOXOUT2 0xCD2
85 1.1 mycroft #define MBOXOUT3 0xCD3
86 1.1 mycroft
87 1.1 mycroft #define ATTN 0xCD4
88 1.1 mycroft #define G2CNTRL 0xCD5
89 1.1 mycroft #define G2INTST 0xCD6
90 1.1 mycroft #define G2STAT 0xCD7
91 1.1 mycroft
92 1.1 mycroft #define MBOXIN0 0xCD8
93 1.1 mycroft #define MBOXIN1 0xCD9
94 1.1 mycroft #define MBOXIN2 0xCDA
95 1.1 mycroft #define MBOXIN3 0xCDB
96 1.1 mycroft
97 1.1 mycroft #define G2STAT2 0xCDC
98 1.1 mycroft
99 1.1 mycroft /*
100 1.1 mycroft * Bit definitions for the 5 control/status registers
101 1.1 mycroft */
102 1.1 mycroft #define ATTN_TARGET 0x0F
103 1.1 mycroft #define ATTN_OPCODE 0xF0
104 1.1 mycroft #define OP_IMMED 0x10
105 1.1 mycroft #define AHB_TARG_RESET 0x80
106 1.1 mycroft #define OP_START_ECB 0x40
107 1.1 mycroft #define OP_ABORT_ECB 0x50
108 1.1 mycroft
109 1.1 mycroft #define G2CNTRL_SET_HOST_READY 0x20
110 1.1 mycroft #define G2CNTRL_CLEAR_EISA_INT 0x40
111 1.1 mycroft #define G2CNTRL_HARD_RESET 0x80
112 1.1 mycroft
113 1.1 mycroft #define G2INTST_TARGET 0x0F
114 1.1 mycroft #define G2INTST_INT_STAT 0xF0
115 1.1 mycroft #define AHB_ECB_OK 0x10
116 1.1 mycroft #define AHB_ECB_RECOVERED 0x50
117 1.1 mycroft #define AHB_HW_ERR 0x70
118 1.1 mycroft #define AHB_IMMED_OK 0xA0
119 1.1 mycroft #define AHB_ECB_ERR 0xC0
120 1.1 mycroft #define AHB_ASN 0xD0 /* for target mode */
121 1.1 mycroft #define AHB_IMMED_ERR 0xE0
122 1.1 mycroft
123 1.1 mycroft #define G2STAT_BUSY 0x01
124 1.1 mycroft #define G2STAT_INT_PEND 0x02
125 1.1 mycroft #define G2STAT_MBOX_EMPTY 0x04
126 1.1 mycroft
127 1.1 mycroft #define G2STAT2_HOST_READY 0x01
128 1.1 mycroft
129 1.1 mycroft #define AHB_NSEG 33 /* number of dma segments supported */
130 1.1 mycroft
131 1.1 mycroft struct ahb_dma_seg {
132 1.1 mycroft physaddr seg_addr;
133 1.1 mycroft physlen seg_len;
134 1.1 mycroft };
135 1.1 mycroft
136 1.1 mycroft struct ahb_ecb_status {
137 1.1 mycroft u_short status;
138 1.1 mycroft #define ST_DON 0x0001
139 1.1 mycroft #define ST_DU 0x0002
140 1.1 mycroft #define ST_QF 0x0008
141 1.1 mycroft #define ST_SC 0x0010
142 1.1 mycroft #define ST_DO 0x0020
143 1.1 mycroft #define ST_CH 0x0040
144 1.1 mycroft #define ST_INT 0x0080
145 1.1 mycroft #define ST_ASA 0x0100
146 1.1 mycroft #define ST_SNS 0x0200
147 1.1 mycroft #define ST_INI 0x0800
148 1.1 mycroft #define ST_ME 0x1000
149 1.1 mycroft #define ST_ECA 0x4000
150 1.1 mycroft u_char host_stat;
151 1.1 mycroft #define HS_OK 0x00
152 1.1 mycroft #define HS_CMD_ABORTED_HOST 0x04
153 1.1 mycroft #define HS_CMD_ABORTED_ADAPTER 0x05
154 1.1 mycroft #define HS_TIMED_OUT 0x11
155 1.1 mycroft #define HS_HARDWARE_ERR 0x20
156 1.1 mycroft #define HS_SCSI_RESET_ADAPTER 0x22
157 1.1 mycroft #define HS_SCSI_RESET_INCOMING 0x23
158 1.1 mycroft u_char target_stat;
159 1.1 mycroft u_long resid_count;
160 1.1 mycroft u_long resid_addr;
161 1.1 mycroft u_short addit_status;
162 1.1 mycroft u_char sense_len;
163 1.1 mycroft u_char unused[9];
164 1.1 mycroft u_char cdb[6];
165 1.1 mycroft };
166 1.1 mycroft
167 1.1 mycroft struct ahb_ecb {
168 1.1 mycroft u_char opcode;
169 1.1 mycroft #define ECB_SCSI_OP 0x01
170 1.1 mycroft u_char:4;
171 1.1 mycroft u_char options:3;
172 1.1 mycroft u_char:1;
173 1.1 mycroft short opt1;
174 1.1 mycroft #define ECB_CNE 0x0001
175 1.1 mycroft #define ECB_DI 0x0080
176 1.1 mycroft #define ECB_SES 0x0400
177 1.1 mycroft #define ECB_S_G 0x1000
178 1.1 mycroft #define ECB_DSB 0x4000
179 1.1 mycroft #define ECB_ARS 0x8000
180 1.1 mycroft short opt2;
181 1.1 mycroft #define ECB_LUN 0x0007
182 1.1 mycroft #define ECB_TAG 0x0008
183 1.1 mycroft #define ECB_TT 0x0030
184 1.1 mycroft #define ECB_ND 0x0040
185 1.1 mycroft #define ECB_DAT 0x0100
186 1.1 mycroft #define ECB_DIR 0x0200
187 1.1 mycroft #define ECB_ST 0x0400
188 1.1 mycroft #define ECB_CHK 0x0800
189 1.1 mycroft #define ECB_REC 0x4000
190 1.1 mycroft #define ECB_NRB 0x8000
191 1.1 mycroft u_short unused1;
192 1.1 mycroft physaddr data_addr;
193 1.1 mycroft physlen data_length;
194 1.1 mycroft physaddr status;
195 1.1 mycroft physaddr link_addr;
196 1.1 mycroft short unused2;
197 1.1 mycroft short unused3;
198 1.1 mycroft physaddr sense_ptr;
199 1.1 mycroft u_char req_sense_length;
200 1.1 mycroft u_char scsi_cmd_length;
201 1.1 mycroft short cksum;
202 1.1 mycroft struct scsi_generic scsi_cmd;
203 1.1 mycroft
204 1.1 mycroft struct ahb_dma_seg ahb_dma[AHB_NSEG];
205 1.1 mycroft struct ahb_ecb_status ecb_status;
206 1.1 mycroft struct scsi_sense_data ecb_sense;
207 1.1 mycroft /*-----------------end of hardware supported fields----------------*/
208 1.1 mycroft TAILQ_ENTRY(ahb_ecb) chain;
209 1.1 mycroft struct ahb_ecb *nexthash;
210 1.1 mycroft long hashkey;
211 1.1 mycroft struct scsi_xfer *xs; /* the scsi_xfer for this cmd */
212 1.1 mycroft int flags;
213 1.1 mycroft #define ECB_ALLOC 0x01
214 1.1 mycroft #define ECB_ABORT 0x02
215 1.1 mycroft #define ECB_IMMED 0x04
216 1.1 mycroft #define ECB_IMMED_FAIL 0x08
217 1.1 mycroft int timeout;
218 1.1 mycroft };
219