1 /* $NetBSD: scsireg.h,v 1.11 2007/03/04 06:00:26 christos Exp $ */
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
7 * This code is derived from software contributed to Berkeley by
8 * Sony Corp. and Kazumasa Utashiro of Software Research Associates, Inc.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * from: $Hdr: scsireg.h,v 4.300 91/06/09 06:38:12 root Rel41 $ SONY
36 * @(#)scsireg.h 8.1 (Berkeley) 6/11/93
47 * initiator status byte bit image
49 #define INST_EP 0x80 /* End of Process */
50 #define INST_WR 0x40 /* Waiting Reselection */
51 #define INST_IP 0x20 /* In Process */
52 #define INST_WAIT 0x10 /* Waiting Bus free */
53 #define INST_LB 0x8 /* Loss of BUSY */
54 #define INST_TO 0x4 /* Time Out */
55 #define INST_PRE 0x2 /* PaRameter Error */
56 #define INST_HE 0x1 /* Hard Error */
58 #define INSTERMASK 0x7
62 * target status byte bit image
66 #define TGST_RSVCFLCT 0x18
67 #define TGST_INTERMED 0x10
72 #define TS_MAPPED_PIO 0x01 /* program I/O with map */
73 #define TS_CONTR_ON 0x02 /* contiguous transfer on */
74 #define TS_CONTR_OFF 0x04 /* contiguous transfer off */
75 #define TS_BYTE_DMA 0x08 /* DMA transfer(byte access) */
76 #define TS_LONG_DMA 0x10 /* DMA transfer(long access) */
82 #define MSG_IDENT 0x80
83 #define MSG_RESELEN 0x40
90 /*#define MSG_ABORT 6*/
97 * message identify byte bit image
99 #define IDT_DISCON 0x40
100 #define IDT_DRMASK 0x7
104 * scsi command opcodes
106 #define SCOP_TST 0x00
107 #define SCOP_REZERO 0x01
108 #define SCOP_REWIND 0x01
109 #define SCOP_RSENSE 0x03
110 #define SCOP_FMT 0x04
111 #define SCOP_RBLIM 0x05
112 #define SCOP_SPARAM 0x06
113 #define SCOP_RASBLK 0x07
114 #define SCOP_READ 0x08
115 #define SCOP_MOERASE 0x09
116 #define SCOP_WRITE 0x0a
117 #define SCOP_SEEK 0x0b
118 #define SCOP_MERASE 0x0e
119 #define SCOP_WFMARK 0x10
120 #define SCOP_SPACE 0x11
121 #define SCOP_INQUIRY 0x12
122 #define SCOP_SVERIFY 0x13
123 #define SCOP_RBDATA 0x14
124 #define SCOP_MSELECT 0x15
125 #define SCOP_ERASE 0x19
126 #define SCOP_MSENSE 0x1a
127 #define SCOP_STST 0x1b
128 #define SCOP_LOAD 0x1b
129 #define SCOP_RECDIAG 0x1c
130 #define SCOP_SNDDIAG 0x1d
131 #define SCOP_MEDRMV 0x1e
132 #define SCOP_RCAP 0x25
133 #define SCOP_EREAD 0x28
134 #define SCOP_EWRITE 0x2a
135 #define SCOP_BSSRCH 0x2c
136 #define SCOP_WSSRCH 0x2d
137 #define SCOP_WRTVRFY 0x2e
138 #define SCOP_VERIFY 0x2f
139 #define SCOP_RDL 0x37
140 #define SCOP_WBUF 0x3b
141 #define SCOP_RBUF 0x3c
142 #define SCOP_EJECT 0xc0
143 #define SCOP_EESENSE 0xc1
144 #define SCOP_READTOC 0xc1
145 #define SCOP_READID 0xc2
146 #define SCOP_ADP 0xc2
147 #define SCOP_READQ 0xc2
148 #define SCOP_BLANKS 0xc3
149 #define SCOP_READHEAD 0xc3
150 #define SCOP_PBSTS 0xc4
151 #define SCOP_RCVDISK 0xc4
152 #define SCOP_PAUSE 0xc5
153 #define SCOP_PLAYTRACK 0xc6
154 #define SCOP_PLAYMSF 0xc7
155 #define SCOP_PLAYAUDIO 0xc8
156 #define SCOP_ERASED 0xe7
157 #define SCOP_RESET 0xff
162 # define ipc_phys(x) (void *)K0_TT0(x)
164 # define ipc_phys(x) (void *)((int)(x) & ~0x80000000)
168 # define splscon spl3
170 #endif /* CPU_DOUBLE */
173 # define ipc_phys(x) (void *)(x)
175 # define splsc splbio /* Lite2 used spl3 */
176 # define splscon spl2 XXX not used
179 # define splscon spl3
181 #endif /* CPU_SINGLE */
184 #define SCSI_INTDIS 0
195 * scsi map table format
197 #if defined(news3400)
201 #if defined(news3800)
206 volatile uint32_t mp_offset
;
207 volatile uint32_t mp_pages
;
208 volatile uint32_t mp_addr
[NSCMAP
]; /* page number */
211 struct sc_chan_stat
{
212 struct sc_chan_stat
*wb_next
; /* wait bus channel queue */
213 struct sc_scb
*scb
; /* scsi struct address */
214 u_int stcnt
; /* save transfer count */
215 uint8_t *spoint
; /* save transfer point */
216 u_int stag
; /* save tag register */
217 u_int soffset
; /* save offset register */
218 int chan_num
; /* channel NO. */
219 uint8_t comflg
; /* flag for save comand pointer */
220 uint8_t intr_flg
; /* interrupt flag. SCSI_INTEN/INTDIS */
224 TAILQ_ENTRY(sc_scb
) chain
;
225 struct scsipi_xfer
*xs
;
228 struct sc_softc
*scb_softc
;
229 struct sc_map
*sc_map
;
230 uint8_t *sc_cpoint
; /* pointer to buffer address */
231 u_int sc_ctrnscnt
; /* transfer count */
246 struct scsipi_channel sc_channel
;
247 struct scsipi_adapter sc_adapter
;
249 TAILQ_HEAD(scb_list
, sc_scb
) ready_list
, free_list
;
250 struct sc_scb sc_scb
[3 * NTARGET
];
253 struct sc_map sc_map
[NTARGET
];
254 struct sc_chan_stat chan_stat
[NTARGET
]; /* SCSI channel status */
255 int sel_stat
[NTARGET
]; /* target select status */
260 int wbc
; /* # of channel that is waiting for scsi bus free */
261 int wrc
; /* # of channel that is waiting for reselection */
262 struct sc_chan_stat
*ip
;
263 /* In progress channel. Same as ISTAT.IP */
264 int ipc
; /* number of in progress channel. */
265 int dma_stat
; /* OFF = DMAC is not used */
269 struct sc_chan_stat
*wbq_actf
; /* forword active pointer */
270 struct sc_chan_stat
*wbq_actl
; /* last active pointer */
272 uint8_t *act_cmd_pointer
;
273 uint8_t *min_point
[NTARGET
];
274 int pad_cnt
[NTARGET
];
275 int8_t min_cnt
[NTARGET
];
276 uint8_t sync_tr
[NTARGET
]; /* sync/async flag */
277 uint8_t mout_flag
[NTARGET
];
278 uint8_t perr_flag
[NTARGET
];
290 #define SEL_TIMEOUT 2
292 #define SEL_SUCCESS 4
294 #define SEL_RSL_WAIT 6
299 #define MOUT_IDENTIFY 1
300 #define MOUT_SYNC_TR 2
304 /*00*/ int (*sci_inthandler
)(int); /* pointer to interrupt handler */
305 /*04*/ int sci_ctlr
; /* controller number */
309 #endif /* !__SCSIREG__ */