scsi_5380.h revision 1.1.1.1 1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie the
24 * rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: scsi_5380.h,v $
29 * Revision 1.1.1.1 1993/09/29 06:09:20 briggs
30 * The current MacBSD architecture sub-directory for NetBSD-0.9--more or
31 * less. It needs some help to get to be -current. Support for minimal
32 * hardware on the SE/30, II, IIx, and IIcx exists.
33 *
34 * Revision 2.3 91/08/24 12:25:10 af
35 * Moved padding of regmap in impl file.
36 * [91/08/02 04:22:39 af]
37 *
38 * Revision 2.2 91/06/19 16:28:35 rvb
39 * From the NCR data sheets
40 * "NCR 5380 Family, SCSI Protocol Controller Data Manual"
41 * NCR Microelectronics Division, Colorado Spring, 6/98 T01891L
42 * [91/04/21 af]
43 *
44 */
45 /*
46 * File: scsi_5380.h
47 * Author: Alessandro Forin, Carnegie Mellon University
48 * Date: 5/91
49 *
50 * Defines for the NCR 5380 (SCSI chip), aka Am5380
51 */
52 #ident "$Id: scsi_5380.h,v 1.1.1.1 1993/09/29 06:09:20 briggs Exp $"
53
54 /*
55 * Register map
56 */
57
58 typedef struct {
59 volatile unsigned char sci_data; /* r: Current data */
60 #define sci_odata sci_data /* w: Out data */
61 PAD(pad0);
62
63 volatile unsigned char sci_icmd; /* rw: Initiator command */
64 PAD(pad1);
65
66 volatile unsigned char sci_mode; /* rw: Mode */
67 PAD(pad2);
68
69 volatile unsigned char sci_tcmd; /* rw: Target command */
70 PAD(pad3);
71
72 volatile unsigned char sci_bus_csr; /* r: Bus Status */
73 #define sci_sel_enb sci_bus_csr /* w: Select enable */
74 PAD(pad4);
75
76 volatile unsigned char sci_csr; /* r: Status */
77 #define sci_dma_send sci_csr /* w: Start dma send data */
78 PAD(pad5);
79
80 volatile unsigned char sci_idata; /* r: Input data */
81 #define sci_trecv sci_idata /* w: Start dma receive, target */
82 PAD(pad6);
83
84 volatile unsigned char sci_iack; /* r: Interrupt Acknowledge */
85 #define sci_irecv sci_iack /* w: Start dma receive, initiator */
86 } sci_regmap_t;
87
88
89 /*
90 * Initiator command register
91 */
92
93 #define SCI_ICMD_DATA 0x01 /* rw: Assert data bus */
94 #define SCI_ICMD_ATN 0x02 /* rw: Assert ATN signal */
95 #define SCI_ICMD_SEL 0x04 /* rw: Assert SEL signal */
96 #define SCI_ICMD_BSY 0x08 /* rw: Assert BSY signal */
97 #define SCI_ICMD_ACK 0x10 /* rw: Assert ACK signal */
98 #define SCI_ICMD_LST 0x20 /* r: Lost arbitration */
99 #define SCI_ICMD_DIFF SCI_ICMD_LST /* w: Differential cable */
100 #define SCI_ICMD_AIP 0x40 /* r: Arbitration in progress */
101 #define SCI_ICMD_TEST SCI_ICMD_AIP /* w: Test mode */
102 #define SCI_ICMD_RST 0x80 /* rw: Assert RST signal */
103
104
105 /*
106 * Mode register
107 */
108
109 #define SCI_MODE_ARB 0x01 /* rw: Start arbitration */
110 #define SCI_MODE_DMA 0x02 /* rw: Enable DMA xfers */
111 #define SCI_MODE_MONBSY 0x04 /* rw: Monitor BSY signal */
112 #define SCI_MODE_DMA_IE 0x08 /* rw: Enable DMA complete interrupt */
113 #define SCI_MODE_PERR_IE 0x10 /* rw: Interrupt on parity errors */
114 #define SCI_MODE_PAR_CHK 0x20 /* rw: Check parity */
115 #define SCI_MODE_TARGET 0x40 /* rw: Target mode (Initiator if 0) */
116 #define SCI_MODE_BLOCKDMA 0x80 /* rw: Block-mode DMA handshake (MBZ) */
117
118
119 /*
120 * Target command register
121 */
122
123 #define SCI_TCMD_IO 0x01 /* rw: Assert I/O signal */
124 #define SCI_TCMD_CD 0x02 /* rw: Assert C/D signal */
125 #define SCI_TCMD_MSG 0x04 /* rw: Assert MSG signal */
126 #define SCI_TCMD_PHASE_MASK 0x07 /* r: Mask for current bus phase */
127 #define SCI_TCMD_REQ 0x08 /* rw: Assert REQ signal */
128 #define SCI_TCMD_LAST_SENT 0x80 /* ro: Last byte was xferred
129 * (not on 5380/1) */
130
131 #define SCI_PHASE(x) SCSI_PHASE(x)
132
133 /*
134 * Current (SCSI) Bus status
135 */
136
137 #define SCI_BUS_DBP 0x01 /* r: Data Bus parity */
138 #define SCI_BUS_SEL 0x02 /* r: SEL signal */
139 #define SCI_BUS_IO 0x04 /* r: I/O signal */
140 #define SCI_BUS_CD 0x08 /* r: C/D signal */
141 #define SCI_BUS_MSG 0x10 /* r: MSG signal */
142 #define SCI_BUS_REQ 0x20 /* r: REQ signal */
143 #define SCI_BUS_BSY 0x40 /* r: BSY signal */
144 #define SCI_BUS_RST 0x80 /* r: RST signal */
145
146 #define SCI_CUR_PHASE(x) SCSI_PHASE((x)>>2)
147
148 /*
149 * Bus and Status register
150 */
151
152 #define SCI_CSR_ACK 0x01 /* r: ACK signal */
153 #define SCI_CSR_ATN 0x02 /* r: ATN signal */
154 #define SCI_CSR_DISC 0x04 /* r: Disconnected (BSY==0) */
155 #define SCI_CSR_PHASE_MATCH 0x08 /* r: Bus and SCI_TCMD match */
156 #define SCI_CSR_INT 0x10 /* r: Interrupt request */
157 #define SCI_CSR_PERR 0x20 /* r: Parity error */
158 #define SCI_CSR_DREQ 0x40 /* r: DMA request */
159 #define SCI_CSR_DONE 0x80 /* r: DMA count is zero */
160
161