1 /* $NetBSD: ahbreg.h,v 1.15 2005/12/11 12:21:20 christos Exp $ */
4 * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Charles M. Hannum and by Jason R. Thorpe of the Numerical Aerospace
9 * Simulation Facility, NASA Ames Research Center.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
34 * Originally written by Julian Elischer (julian@tfs.com)
35 * for TRW Financial Systems for use under the MACH(2.5) operating system.
37 * TRW Financial Systems, in accordance with their agreement with Carnegie
38 * Mellon University, makes this software available to CMU to distribute
39 * or use in any manner that they see fit as long as this message is kept with
40 * the software. For this reason TFS also grants any other persons or
41 * organisations permission to use or modify this software.
43 * TFS supplies this software to be publicly redistributed
44 * on the understanding that TFS is not responsible for the correct
45 * functioning of this software in any circumstances.
48 typedef u_int32_t physaddr
;
49 typedef u_int32_t physlen
;
52 * Offset of AHA1740 registers, relative from slot base.
54 #define AHB_EISA_SLOT_OFFSET 0x0c80
55 #define AHB_EISA_IOSIZE 0x0080
58 * AHA1740 EISA board mode registers (relative to port offset)
61 #define PORTADDR_ENHANCED 0x80
66 /**** bit definitions for INTDEF ****/
73 #define INTHIGH 0x08 /* int high=ACTIVE (else edge) */
75 /**** bit definitions for SCSIDEF ****/
76 #define HSCSIID 0x0F /* our SCSI ID */
77 #define RSTPWR 0x10 /* reset scsi bus on power up or reset */
78 /**** bit definitions for BUSDEF ****/
79 #define B0uS 0x00 /* give up bus immediatly */
80 #define B4uS 0x01 /* delay 4uSec. */
84 * AHA1740 ENHANCED mode mailbox control regs (relative to port offset)
104 * Bit definitions for the 5 control/status registers
106 #define ATTN_TARGET 0x0F
107 #define ATTN_OPCODE 0xF0
108 #define OP_IMMED 0x10
109 #define AHB_TARG_RESET 0x80
110 #define OP_START_ECB 0x40
111 #define OP_ABORT_ECB 0x50
113 #define G2CNTRL_SET_HOST_READY 0x20
114 #define G2CNTRL_CLEAR_EISA_INT 0x40
115 #define G2CNTRL_HARD_RESET 0x80
117 #define G2INTST_TARGET 0x0F
118 #define G2INTST_INT_STAT 0xF0
119 #define AHB_ECB_OK 0x10
120 #define AHB_ECB_RECOVERED 0x50
121 #define AHB_HW_ERR 0x70
122 #define AHB_IMMED_OK 0xA0
123 #define AHB_ECB_ERR 0xC0
124 #define AHB_ASN 0xD0 /* for target mode */
125 #define AHB_IMMED_ERR 0xE0
127 #define G2STAT_BUSY 0x01
128 #define G2STAT_INT_PEND 0x02
129 #define G2STAT_MBOX_EMPTY 0x04
131 #define G2STAT2_HOST_READY 0x01
133 #define AHB_NSEG 33 /* number of DMA segments supported */
140 struct ahb_ecb_status
{
142 #define ST_DON 0x0001
148 #define ST_INT 0x0080
149 #define ST_ASA 0x0100
150 #define ST_SNS 0x0200
151 #define ST_INI 0x0800
153 #define ST_ECA 0x4000
156 #define HS_CMD_ABORTED_HOST 0x04
157 #define HS_CMD_ABORTED_ADAPTER 0x05
158 #define HS_TIMED_OUT 0x11
159 #define HS_HARDWARE_ERR 0x20
160 #define HS_SCSI_RESET_ADAPTER 0x22
161 #define HS_SCSI_RESET_INCOMING 0x23
163 u_int32_t resid_count
;
164 u_int32_t resid_addr
;
165 u_short addit_status
;
173 #define ECB_SCSI_OP 0x01
178 #define ECB_CNE 0x0001
179 #define ECB_DI 0x0080
180 #define ECB_SES 0x0400
181 #define ECB_S_G 0x1000
182 #define ECB_DSB 0x4000
183 #define ECB_ARS 0x8000
185 #define ECB_LUN 0x0007
186 #define ECB_TAG 0x0008
187 #define ECB_TT 0x0030
188 #define ECB_ND 0x0040
189 #define ECB_DAT 0x0100
190 #define ECB_DIR 0x0200
191 #define ECB_ST 0x0400
192 #define ECB_CHK 0x0800
193 #define ECB_REC 0x4000
194 #define ECB_NRB 0x8000
203 u_char req_sense_length
;
204 u_char scsi_cmd_length
;
208 /*-----------------end of hardware supported fields----------------*/
210 struct ahb_dma_seg ahb_dma
[AHB_NSEG
];
211 struct ahb_ecb_status ecb_status
;
212 struct scsi_sense_data ecb_sense
;
214 TAILQ_ENTRY(ahb_ecb
) chain
;
215 struct ahb_ecb
*nexthash
;
217 struct scsipi_xfer
*xs
; /* the scsipi_xfer for this cmd */
219 #define ECB_ALLOC 0x01
220 #define ECB_ABORT 0x02
221 #define ECB_IMMED 0x04
222 #define ECB_IMMED_FAIL 0x08
226 * This DMA map maps the buffer involved in the transfer.
227 * Its contents are loaded into "ahb_dma" above.
229 bus_dmamap_t dmamap_xfer
;