uhareg.h revision 1.7 1 1.7 mycroft /* $NetBSD: uhareg.h,v 1.7 1998/08/17 00:26:34 mycroft Exp $ */
2 1.3 thorpej
3 1.3 thorpej /*-
4 1.6 thorpej * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
5 1.3 thorpej * All rights reserved.
6 1.3 thorpej *
7 1.3 thorpej * This code is derived from software contributed to The NetBSD Foundation
8 1.7 mycroft * by Charles M. Hannum and by Jason R. Thorpe of the Numerical Aerospace
9 1.7 mycroft * Simulation Facility, NASA Ames Research Center.
10 1.3 thorpej *
11 1.3 thorpej * Redistribution and use in source and binary forms, with or without
12 1.3 thorpej * modification, are permitted provided that the following conditions
13 1.3 thorpej * are met:
14 1.3 thorpej * 1. Redistributions of source code must retain the above copyright
15 1.3 thorpej * notice, this list of conditions and the following disclaimer.
16 1.3 thorpej * 2. Redistributions in binary form must reproduce the above copyright
17 1.3 thorpej * notice, this list of conditions and the following disclaimer in the
18 1.3 thorpej * documentation and/or other materials provided with the distribution.
19 1.3 thorpej * 3. All advertising materials mentioning features or use of this software
20 1.3 thorpej * must display the following acknowledgement:
21 1.3 thorpej * This product includes software developed by the NetBSD
22 1.3 thorpej * Foundation, Inc. and its contributors.
23 1.3 thorpej * 4. Neither the name of The NetBSD Foundation nor the names of its
24 1.3 thorpej * contributors may be used to endorse or promote products derived
25 1.3 thorpej * from this software without specific prior written permission.
26 1.3 thorpej *
27 1.3 thorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28 1.3 thorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29 1.3 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 1.3 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
31 1.3 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 1.3 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 1.3 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 1.3 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 1.3 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 1.3 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 1.3 thorpej * POSSIBILITY OF SUCH DAMAGE.
38 1.2 mycroft */
39 1.2 mycroft
40 1.2 mycroft /*
41 1.2 mycroft * Ported for use with the UltraStor 14f by Gary Close (gclose (at) wvnvms.wvnet.edu)
42 1.2 mycroft * Slight fixes to timeouts to run with the 34F
43 1.2 mycroft * Thanks to Julian Elischer for advice and help with this port.
44 1.2 mycroft *
45 1.2 mycroft * Originally written by Julian Elischer (julian (at) tfs.com)
46 1.2 mycroft * for TRW Financial Systems for use under the MACH(2.5) operating system.
47 1.2 mycroft *
48 1.2 mycroft * TRW Financial Systems, in accordance with their agreement with Carnegie
49 1.2 mycroft * Mellon University, makes this software available to CMU to distribute
50 1.2 mycroft * or use in any manner that they see fit as long as this message is kept with
51 1.2 mycroft * the software. For this reason TFS also grants any other persons or
52 1.2 mycroft * organisations permission to use or modify this software.
53 1.2 mycroft *
54 1.2 mycroft * TFS supplies this software to be publicly redistributed
55 1.2 mycroft * on the understanding that TFS is not responsible for the correct
56 1.2 mycroft * functioning of this software in any circumstances.
57 1.2 mycroft *
58 1.2 mycroft * commenced: Sun Sep 27 18:14:01 PDT 1992
59 1.2 mycroft * slight mod to make work with 34F as well: Wed Jun 2 18:05:48 WST 1993
60 1.2 mycroft */
61 1.2 mycroft
62 1.1 mycroft typedef u_long physaddr;
63 1.1 mycroft typedef u_long physlen;
64 1.1 mycroft
65 1.1 mycroft /************************** board definitions *******************************/
66 1.1 mycroft /*
67 1.1 mycroft * I/O Port Interface
68 1.1 mycroft */
69 1.1 mycroft #define U14_LMASK 0x0000 /* local doorbell mask reg */
70 1.1 mycroft #define U14_LINT 0x0001 /* local doorbell int/stat reg */
71 1.1 mycroft #define U14_SMASK 0x0002 /* system doorbell mask reg */
72 1.1 mycroft #define U14_SINT 0x0003 /* system doorbell int/stat reg */
73 1.1 mycroft #define U14_ID 0x0004 /* product id reg (2 ports) */
74 1.1 mycroft #define U14_CONFIG 0x0006 /* config reg (2 ports) */
75 1.1 mycroft #define U14_OGMPTR 0x0008 /* outgoing mail ptr (4 ports) */
76 1.1 mycroft #define U14_ICMPTR 0x000c /* incoming mail ptr (4 ports) */
77 1.1 mycroft
78 1.1 mycroft #define U24_CONFIG 0x0005 /* config reg (3 ports) */
79 1.1 mycroft #define U24_LMASK 0x000c /* local doorbell mask reg */
80 1.1 mycroft #define U24_LINT 0x000d /* local doorbell int/stat reg */
81 1.1 mycroft #define U24_SMASK 0x000e /* system doorbell mask reg */
82 1.1 mycroft #define U24_SINT 0x000f /* system doorbell int/stat reg */
83 1.1 mycroft #define U24_OGMCMD 0x0016 /* outgoing commands */
84 1.1 mycroft #define U24_OGMPTR 0x0017 /* outgoing mail ptr (4 ports) */
85 1.1 mycroft #define U24_ICMCMD 0x001b /* incoming commands */
86 1.1 mycroft #define U24_ICMPTR 0x001c /* incoming mail ptr (4 ports) */
87 1.1 mycroft
88 1.1 mycroft /*
89 1.1 mycroft * UHA_LMASK bits (read only)
90 1.1 mycroft */
91 1.1 mycroft #define UHA_LDIE 0x80 /* local doorbell int enabled */
92 1.1 mycroft #define UHA_SRSTE 0x40 /* soft reset enabled */
93 1.1 mycroft #define UHA_ABORTEN 0x10 /* abort MSCP enabled */
94 1.1 mycroft #define UHA_OGMINTEN 0x01 /* outgoing mail interrupt enabled */
95 1.1 mycroft
96 1.1 mycroft /*
97 1.1 mycroft * UHA_LINT bits (read only)
98 1.1 mycroft */
99 1.1 mycroft #define U14_LDIP 0x80 /* local doorbell int pending */
100 1.1 mycroft #define U24_LDIP 0x02 /* local doorbell int pending */
101 1.1 mycroft
102 1.1 mycroft /*
103 1.1 mycroft * UHA_LINT bits (write only)
104 1.1 mycroft */
105 1.1 mycroft #define U14_OGMFULL 0x01 /* outgoing mailbox is full */
106 1.1 mycroft #define U14_ABORT 0x10 /* abort MSCP */
107 1.1 mycroft
108 1.1 mycroft #define U24_OGMFULL 0x02 /* outgoing mailbox is full */
109 1.1 mycroft
110 1.1 mycroft #define UHA_SBRST 0x40 /* scsi bus reset */
111 1.1 mycroft #define UHA_ADRST 0x80 /* adapter soft reset */
112 1.1 mycroft #define UHA_ASRST 0xc0 /* adapter and scsi reset */
113 1.1 mycroft
114 1.1 mycroft /*
115 1.1 mycroft * UHA_SMASK bits (read/write)
116 1.1 mycroft */
117 1.1 mycroft #define UHA_ENSINT 0x80 /* enable system doorbell interrupt */
118 1.1 mycroft #define UHA_EN_ABORT_COMPLETE 0x10 /* enable abort MSCP complete int */
119 1.1 mycroft #define UHA_ENICM 0x01 /* enable ICM interrupt */
120 1.1 mycroft
121 1.1 mycroft /*
122 1.1 mycroft * UHA_SINT bits (read)
123 1.1 mycroft */
124 1.1 mycroft #define U14_SDIP 0x80 /* system doorbell int pending */
125 1.1 mycroft #define U24_SDIP 0x02 /* system doorbell int pending */
126 1.1 mycroft
127 1.1 mycroft #define UHA_ABORT_SUCC 0x10 /* abort MSCP successful */
128 1.1 mycroft #define UHA_ABORT_FAIL 0x18 /* abort MSCP failed */
129 1.1 mycroft
130 1.1 mycroft /*
131 1.1 mycroft * UHA_SINT bits (write)
132 1.1 mycroft */
133 1.1 mycroft #define U14_ICM_ACK 0x01 /* acknowledge ICM and clear */
134 1.1 mycroft #define U24_ICM_ACK 0x02 /* acknowledge ICM and clear */
135 1.1 mycroft
136 1.1 mycroft #define UHA_ABORT_ACK 0x18 /* acknowledge status and clear */
137 1.1 mycroft
138 1.1 mycroft /*
139 1.1 mycroft * U14_CONFIG bits (read only)
140 1.1 mycroft */
141 1.1 mycroft #define U14_DMA_CH5 0x0000 /* DMA channel 5 */
142 1.1 mycroft #define U14_DMA_CH6 0x4000 /* 6 */
143 1.1 mycroft #define U14_DMA_CH7 0x8000 /* 7 */
144 1.1 mycroft #define U14_DMA_MASK 0xc000
145 1.1 mycroft #define U14_IRQ15 0x0000 /* IRQ 15 */
146 1.1 mycroft #define U14_IRQ14 0x1000 /* 14 */
147 1.1 mycroft #define U14_IRQ11 0x2000 /* 11 */
148 1.1 mycroft #define U14_IRQ10 0x3000 /* 10 */
149 1.1 mycroft #define U14_IRQ_MASK 0x3000
150 1.1 mycroft #define U14_HOSTID_MASK 0x0007
151 1.1 mycroft
152 1.1 mycroft /*
153 1.1 mycroft * U24_CONFIG bits (read only)
154 1.1 mycroft */
155 1.1 mycroft #define U24_MAGIC1 0x08
156 1.1 mycroft #define U24_IRQ15 0x10
157 1.1 mycroft #define U24_IRQ14 0x20
158 1.1 mycroft #define U24_IRQ11 0x40
159 1.1 mycroft #define U24_IRQ10 0x80
160 1.1 mycroft #define U24_IRQ_MASK 0xf0
161 1.1 mycroft
162 1.1 mycroft #define U24_MAGIC2 0x04
163 1.1 mycroft
164 1.1 mycroft #define U24_HOSTID_MASK 0x07
165 1.1 mycroft
166 1.1 mycroft /*
167 1.1 mycroft * EISA registers (offset from slot base)
168 1.1 mycroft */
169 1.1 mycroft #define EISA_VENDOR 0x0c80 /* vendor ID (2 ports) */
170 1.1 mycroft #define EISA_MODEL 0x0c82 /* model number (2 ports) */
171 1.1 mycroft #define EISA_CONTROL 0x0c84
172 1.1 mycroft #define EISA_RESET 0x04
173 1.1 mycroft #define EISA_ERROR 0x02
174 1.1 mycroft #define EISA_ENABLE 0x01
175 1.1 mycroft
176 1.1 mycroft /*
177 1.1 mycroft * host_stat error codes
178 1.1 mycroft */
179 1.1 mycroft #define UHA_NO_ERR 0x00 /* No error supposedly */
180 1.1 mycroft #define UHA_SBUS_ABORT_ERR 0x84 /* scsi bus abort error */
181 1.1 mycroft #define UHA_SBUS_TIMEOUT 0x91 /* scsi bus selection timeout */
182 1.1 mycroft #define UHA_SBUS_OVER_UNDER 0x92 /* scsi bus over/underrun */
183 1.1 mycroft #define UHA_BAD_SCSI_CMD 0x96 /* illegal scsi command */
184 1.1 mycroft #define UHA_AUTO_SENSE_ERR 0x9b /* auto request sense err */
185 1.1 mycroft #define UHA_SBUS_RES_ERR 0xa3 /* scsi bus reset error */
186 1.1 mycroft #define UHA_BAD_SG_LIST 0xff /* invalid scatter gath list */
187 1.1 mycroft
188 1.1 mycroft #define UHA_NSEG 33 /* number of dma segments supported */
189 1.1 mycroft
190 1.1 mycroft struct uha_dma_seg {
191 1.1 mycroft physaddr seg_addr;
192 1.1 mycroft physlen seg_len;
193 1.1 mycroft };
194 1.1 mycroft
195 1.1 mycroft #pragma pack(1)
196 1.1 mycroft struct uha_mscp {
197 1.1 mycroft u_char opcode:3;
198 1.1 mycroft #define UHA_HAC 0x01 /* host adapter command */
199 1.1 mycroft #define UHA_TSP 0x02 /* target scsi pass through command */
200 1.1 mycroft #define UHA_SDR 0x04 /* scsi device reset */
201 1.1 mycroft u_char xdir:2; /* xfer direction */
202 1.1 mycroft #define UHA_SDET 0x00 /* determined by scsi command */
203 1.1 mycroft #define UHA_SDIN 0x01 /* scsi data in */
204 1.1 mycroft #define UHA_SDOUT 0x02 /* scsi data out */
205 1.1 mycroft #define UHA_NODATA 0x03 /* no data xfer */
206 1.1 mycroft u_char dcn:1; /* disable disconnect for this command */
207 1.1 mycroft u_char ca:1; /* cache control */
208 1.1 mycroft u_char sgth:1; /* scatter gather flag */
209 1.1 mycroft u_char target:3;
210 1.1 mycroft u_char chan:2; /* scsi channel (always 0 for 14f) */
211 1.1 mycroft u_char lun:3;
212 1.1 mycroft physaddr data_addr;
213 1.1 mycroft physlen data_length;
214 1.1 mycroft physaddr link_addr;
215 1.1 mycroft u_char link_id;
216 1.1 mycroft u_char sg_num; /* number of scat gath segs */
217 1.1 mycroft /*in s-g list if sg flag is */
218 1.1 mycroft /*set. starts at 1, 8bytes per */
219 1.1 mycroft u_char req_sense_length;
220 1.1 mycroft u_char scsi_cmd_length;
221 1.1 mycroft struct scsi_generic scsi_cmd;
222 1.1 mycroft u_char host_stat;
223 1.1 mycroft u_char target_stat;
224 1.1 mycroft physaddr sense_ptr; /* if 0 no auto sense */
225 1.1 mycroft
226 1.1 mycroft struct uha_dma_seg uha_dma[UHA_NSEG];
227 1.4 bouyer struct scsipi_sense_data mscp_sense;
228 1.1 mycroft /*-----------------end of hardware supported fields----------------*/
229 1.1 mycroft TAILQ_ENTRY(uha_mscp) chain;
230 1.1 mycroft struct uha_mscp *nexthash;
231 1.5 mycroft u_long hashkey;
232 1.4 bouyer struct scsipi_xfer *xs; /* the scsipi_xfer for this cmd */
233 1.1 mycroft int flags;
234 1.1 mycroft #define MSCP_ALLOC 0x01
235 1.1 mycroft #define MSCP_ABORT 0x02
236 1.1 mycroft int timeout;
237 1.3 thorpej
238 1.3 thorpej /*
239 1.3 thorpej * This DMA map maps the buffer involved in the transfer.
240 1.3 thorpej * It's contents are loaded into "uha_dma" above.
241 1.3 thorpej */
242 1.3 thorpej bus_dmamap_t dmamap_xfer;
243 1.3 thorpej
244 1.1 mycroft };
245 1.1 mycroft #pragma pack(4)
246 1.1 mycroft
247