FreeBSD/Linux Kernel Cross Reference
sys/i386ipsc/scsi.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991 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 "AS IS"
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@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 Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * Copyright 1988, 1989, 1990, 1991 by Intel Corporation,
28 * Santa Clara, California.
29 *
30 * All Rights Reserved
31 *
32 * Permission to use, copy, modify, and distribute this software and its
33 * documentation for any purpose and without fee is hereby granted,
34 * provided that the above copyright notice appears in all copies and that
35 * both the copyright notice and this permission notice appear in
36 * supporting documentation, and that the name of Intel not be used in
37 * advertising or publicity pertaining to distribution of the software
38 * without specific, written prior permission.
39 *
40 * INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING
41 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
42 * SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
43 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
44 * PROFITS, WHETHER IN ACTION OF CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS
45 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
46 * THIS SOFTWARE.
47 */
48 /*
49 * HISTORY
50 * $Log: scsi.h,v $
51 * Revision 2.3 91/06/18 20:50:30 jsb
52 * New copyright from Intel.
53 * [91/06/18 20:07:32 jsb]
54 *
55 * Revision 2.2 90/12/04 14:47:38 jsb
56 * First checkin.
57 * [90/12/04 10:57:57 jsb]
58 *
59 */
60 /*
61 * This module contains constants for the SCSI interface it is derived
62 * from NX's scsi.h.
63 */
64
65 #define SCSIPHYS0 0xD0000000
66 #define SCSIPHYS1 0xD4000000
67 #define SCSIPHYS2 0xD8000000
68 #define SCSIPHYS3 0xDC000000
69
70 #define SCSIPHYS0_LEN 0x10000
71 #define SCSIPHYS1_LEN 0x100
72 #define SCSIPHYS2_LEN 0x100
73 #define SCSIPHYS3_LEN 0x100
74
75 #define SCSI_FIFO scsiphys0
76 #define SCSI_ESP_BASE scsiphys1
77 #define SCSI_AUX_BASE scsiphys2
78 #define SCSI_LOOP_BASE scsiphys3
79
80 #define SCSI_CLEAR_CNT *(volatile long *)(SCSI_AUX_BASE + 0x00)
81 #define SCSI_RESET_ESP *(volatile long *)(SCSI_AUX_BASE + 0x40)
82 #define SCSI_RESET_FIFO *(volatile long *)(SCSI_AUX_BASE + 0x80)
83
84 #define SCSI_READ_MODE *(volatile long *)(SCSI_AUX_BASE + 0x00)
85 #define SCSI_WRITE_MODE *(volatile long *)(SCSI_AUX_BASE + 0x40)
86 #define SCSI_ENABLE_HF *(volatile long *)(SCSI_AUX_BASE + 0x80)
87 #define SCSI_DISABLE_HF *(volatile long *)(SCSI_AUX_BASE + 0xC0)
88
89 #define SCSI_COUNT_LO (*(volatile unsigned char *)(SCSI_ESP_BASE + 0x0000))
90 #define SCSI_COUNT_HI (*(volatile unsigned char *)(SCSI_ESP_BASE + 0x0004))
91 #define SCSI_ESP_FIFO (*(volatile unsigned char *)(SCSI_ESP_BASE + 0x0008))
92 #define SCSI_COMMAND (*(volatile unsigned char *)(SCSI_ESP_BASE + 0x000C))
93 #define SCSI_STATUS (*(volatile unsigned short *)(SCSI_ESP_BASE + 0x0010))
94 #define SCSI_ID (*(volatile unsigned char *)(SCSI_ESP_BASE + 0x0010))
95 #define SCSI_INT_STATUS (*(volatile unsigned char *)(SCSI_ESP_BASE + 0x0014))
96 #define SCSI_TIMEOUT (*(volatile unsigned char *)(SCSI_ESP_BASE + 0x0014))
97 #define SCSI_SEQUENCE (*(volatile unsigned char *)(SCSI_ESP_BASE + 0x0018))
98 #define SCSI_SYNC_PER (*(volatile unsigned char *)(SCSI_ESP_BASE + 0x0018))
99 #define SCSI_FIFO_FLAGS (*(volatile unsigned char *)(SCSI_ESP_BASE + 0x001C))
100 #define SCSI_SYNC_OFF (*(volatile unsigned char *)(SCSI_ESP_BASE + 0x001C))
101 #define SCSI_CONFIG (*(volatile unsigned char *)(SCSI_ESP_BASE + 0x0020))
102 #define SCSI_CLOCK (*(volatile unsigned char *)(SCSI_ESP_BASE + 0x0024))
103
104 #define ESP_NOP 0x00
105 #define ESP_FLUSH_FIFO 0x01
106 #define ESP_RESET_CHIP 0x02
107 #define ESP_RESET_BUS 0x03
108 #define ESP_SELECT 0x41
109 #define ESP_SELATN 0x42
110 #define ESP_SELATNSTOP 0x43
111 #define ESP_ENABLE_SEL 0x44
112 #define ESP_DISABLE_SEL 0x45
113 #define ESP_TRANSFER 0x10
114 #define ESP_COMPLETE 0x11
115 #define ESP_MSGACCEPT 0x12
116 #define ESP_PAD 0x18
117 #define ESP_ATN 0x1A
118 #define ESP_DMA 0x80
119
120 #define ESP_SELECT_INT 0x01
121 #define ESP_SELATN_INT 0x02
122 #define ESP_RESEL_INT 0x04
123 #define ESP_COMP_INT 0x08
124 #define ESP_BUS_INT 0x10
125 #define ESP_DISC_INT 0x20
126 #define ESP_ILLCMD_INT 0x40
127 #define ESP_RESET_INT 0x80
128
129 #define ESP_PHASE_STAT 0x07
130 #define ESP_XFER_STAT 0x08
131 #define ESP_COUNT_STAT 0x10
132 #define ESP_PARITY_STAT 0x20
133 #define ESP_GROSS_STAT 0x40
134
135 #define SCSI_WEF_STAT 0x0100
136 #define SCSI_WHF_STAT 0x0200
137 #define SCSI_WFF_STAT 0x0400
138 #define SCSI_EINT_STAT 0x0800
139 #define SCSI_MODE_STAT 0x1000
140 #define SCSI_REF_STAT 0x2000
141 #define SCSI_RHF_STAT 0x4000
142 #define SCSI_RFF_STAT 0x8000
143
144 #define ESP_DATAOUT_PH 0x00
145 #define ESP_DATAIN_PH 0x01
146 #define ESP_COMMAND_PH 0x02
147 #define ESP_STATUS_PH 0x03
148 #define ESP_MSGOUT_PH 0x06
149 #define ESP_MSGIN_PH 0x07
150
151 #define ESP_CLK_NS (1000/24)
152
153 #define CMD_ST_GOOD 0x00
154 #define CMD_ST_CHECK 0x02
155 #define CMD_ST_BUSY 0x08
156 #define CMD_ST_INTER 0x10
157 #define CMD_ST_RUNNING 0x60
158 #define CMD_ST_TIMEOUT 0x62
159
160 #define MSG_CMD_DONE 0x00
161 #define MSG_SAVE_DP 0x02
162 #define MSG_REST_DP 0x03
163 #define MSG_DISCONNECT 0x04
164 #define MSG_INITIAT_ERR 0x05
165 #define MSG_ABORT 0x06
166 #define MSG_REJECT 0x07
167 #define MSG_NOP 0x08
168 #define MSG_PARITY 0x09
169 #define MSG_LINK_DONE 0x0A
170 #define MSG_LINK_FLAG 0x0B
171 #define MSG_RESET 0x0C
172 #define MSG_IDENTIFY 0xC0
173
174 #define SCSI_INQUIRY_CMD 0x12
175 typedef
176 struct scsi_inquiry {
177 unsigned long dev_type :8;
178 unsigned long qualifier :7;
179 unsigned long rmb :1;
180 unsigned long version :8;
181 unsigned long format :4;
182 unsigned long not_used :4;
183 unsigned char added;
184 unsigned char reserved[3];
185 unsigned char extra[28];
186 } SCSI_INQUIRY;
187
188 #define SCSI_SENSE_CMD 0x03
189 typedef
190 struct scsi_sense {
191 unsigned char class;
192 unsigned char segment;
193 unsigned char key;
194 unsigned char info[4];
195 unsigned char added;
196 unsigned char reserved[4];
197 unsigned char code;
198 unsigned char fill1;
199 unsigned char fru;
200 unsigned char bit;
201 unsigned short field;
202 } SCSI_SENSE;
203
204 #define SCSI_CAPACITY_CMD 0x25
205 typedef
206 struct scsi_capacity {
207 unsigned long lba;
208 unsigned long blen;
209 } SCSI_CAPACITY;
210
211 #define SCSI_READ_CMD 0x28
212 #define SCSI_WRITE_CMD 0x2A
Cache object: cfe9396f2dbc7b96db23022b9665d683
|