1 |
199 |
simons |
/******************************************************************************
|
2 |
|
|
** Device driver for the PCI-SCSI NCR538XX controller family.
|
3 |
|
|
**
|
4 |
|
|
** Copyright (C) 1994 Wolfgang Stanglmeier
|
5 |
|
|
**
|
6 |
|
|
** This program is free software; you can redistribute it and/or modify
|
7 |
|
|
** it under the terms of the GNU General Public License as published by
|
8 |
|
|
** the Free Software Foundation; either version 2 of the License, or
|
9 |
|
|
** (at your option) any later version.
|
10 |
|
|
**
|
11 |
|
|
** This program is distributed in the hope that it will be useful,
|
12 |
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
|
|
** GNU General Public License for more details.
|
15 |
|
|
**
|
16 |
|
|
** You should have received a copy of the GNU General Public License
|
17 |
|
|
** along with this program; if not, write to the Free Software
|
18 |
|
|
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
19 |
|
|
**
|
20 |
|
|
**-----------------------------------------------------------------------------
|
21 |
|
|
**
|
22 |
|
|
** This driver has been ported to Linux from the FreeBSD NCR53C8XX driver
|
23 |
|
|
** and is currently maintained by
|
24 |
|
|
**
|
25 |
|
|
** Gerard Roudier <groudier@club-internet.fr>
|
26 |
|
|
**
|
27 |
|
|
** Being given that this driver originates from the FreeBSD version, and
|
28 |
|
|
** in order to keep synergy on both, any suggested enhancements and corrections
|
29 |
|
|
** received on Linux are automatically a potential candidate for the FreeBSD
|
30 |
|
|
** version.
|
31 |
|
|
**
|
32 |
|
|
** The original driver has been written for 386bsd and FreeBSD by
|
33 |
|
|
** Wolfgang Stanglmeier <wolf@cologne.de>
|
34 |
|
|
** Stefan Esser <se@mi.Uni-Koeln.de>
|
35 |
|
|
**
|
36 |
|
|
** And has been ported to NetBSD by
|
37 |
|
|
** Charles M. Hannum <mycroft@gnu.ai.mit.edu>
|
38 |
|
|
**
|
39 |
|
|
*******************************************************************************
|
40 |
|
|
*/
|
41 |
|
|
|
42 |
|
|
#ifndef NCR53C8XX_H
|
43 |
|
|
#define NCR53C8XX_H
|
44 |
|
|
|
45 |
|
|
/*
|
46 |
|
|
** Name and revision of the driver
|
47 |
|
|
*/
|
48 |
|
|
#define SCSI_NCR_DRIVER_NAME "ncr53c8xx - revision 3.1e"
|
49 |
|
|
|
50 |
|
|
/*
|
51 |
|
|
** Check supported Linux versions
|
52 |
|
|
*/
|
53 |
|
|
|
54 |
|
|
#if !defined(LINUX_VERSION_CODE)
|
55 |
|
|
#include <linux/version.h>
|
56 |
|
|
#endif
|
57 |
|
|
#include <linux/config.h>
|
58 |
|
|
|
59 |
|
|
#define LinuxVersionCode(v, p, s) (((v)<<16)+((p)<<8)+(s))
|
60 |
|
|
|
61 |
|
|
/*
|
62 |
|
|
* No more an option, enabled by default.
|
63 |
|
|
*/
|
64 |
|
|
#ifndef CONFIG_SCSI_NCR53C8XX_NVRAM_DETECT
|
65 |
|
|
#define CONFIG_SCSI_NCR53C8XX_NVRAM_DETECT
|
66 |
|
|
#endif
|
67 |
|
|
|
68 |
|
|
/*
|
69 |
|
|
** These options are not tunable from 'make config'
|
70 |
|
|
*/
|
71 |
|
|
#define SCSI_NCR_PROC_INFO_SUPPORT
|
72 |
|
|
#define SCSI_NCR_SHARE_IRQ
|
73 |
|
|
|
74 |
|
|
/*
|
75 |
|
|
** If you want a driver as small as possible, donnot define the
|
76 |
|
|
** following options.
|
77 |
|
|
*/
|
78 |
|
|
#define SCSI_NCR_BOOT_COMMAND_LINE_SUPPORT
|
79 |
|
|
#define SCSI_NCR_DEBUG_INFO_SUPPORT
|
80 |
|
|
#define SCSI_NCR_PCI_FIX_UP_SUPPORT
|
81 |
|
|
#ifdef SCSI_NCR_PROC_INFO_SUPPORT
|
82 |
|
|
# ifdef CONFIG_SCSI_NCR53C8XX_PROFILE
|
83 |
|
|
# define SCSI_NCR_PROFILE_SUPPORT
|
84 |
|
|
# endif
|
85 |
|
|
# define SCSI_NCR_USER_COMMAND_SUPPORT
|
86 |
|
|
# define SCSI_NCR_USER_INFO_SUPPORT
|
87 |
|
|
#endif
|
88 |
|
|
|
89 |
|
|
/*==========================================================
|
90 |
|
|
**
|
91 |
|
|
** nvram settings - #define SCSI_NCR_NVRAM_SUPPORT to enable
|
92 |
|
|
**
|
93 |
|
|
**==========================================================
|
94 |
|
|
*/
|
95 |
|
|
|
96 |
|
|
#ifdef CONFIG_SCSI_NCR53C8XX_NVRAM_DETECT
|
97 |
|
|
#define SCSI_NCR_NVRAM_SUPPORT
|
98 |
|
|
/* #define SCSI_NCR_DEBUG_NVRAM */
|
99 |
|
|
#endif
|
100 |
|
|
|
101 |
|
|
/* ---------------------------------------------------------------------
|
102 |
|
|
** Take into account kernel configured parameters.
|
103 |
|
|
** Most of these options can be overridden at startup by a command line.
|
104 |
|
|
** ---------------------------------------------------------------------
|
105 |
|
|
*/
|
106 |
|
|
|
107 |
|
|
/*
|
108 |
|
|
* For Ultra2 SCSI support option, use special features and allow 40Mhz
|
109 |
|
|
* synchronous data transfers.
|
110 |
|
|
*/
|
111 |
|
|
#define SCSI_NCR_SETUP_SPECIAL_FEATURES (3)
|
112 |
|
|
#define SCSI_NCR_SETUP_ULTRA_SCSI (2)
|
113 |
|
|
#define SCSI_NCR_MAX_SYNC (40)
|
114 |
|
|
|
115 |
|
|
/*
|
116 |
|
|
* Allow tags from 2 to 64, default 8
|
117 |
|
|
*/
|
118 |
|
|
#ifdef CONFIG_SCSI_NCR53C8XX_MAX_TAGS
|
119 |
|
|
#if CONFIG_SCSI_NCR53C8XX_MAX_TAGS < 2
|
120 |
|
|
#define SCSI_NCR_MAX_TAGS (2)
|
121 |
|
|
#elif CONFIG_SCSI_NCR53C8XX_MAX_TAGS > 64
|
122 |
|
|
#define SCSI_NCR_MAX_TAGS (64)
|
123 |
|
|
#else
|
124 |
|
|
#define SCSI_NCR_MAX_TAGS CONFIG_SCSI_NCR53C8XX_MAX_TAGS
|
125 |
|
|
#endif
|
126 |
|
|
#else
|
127 |
|
|
#define SCSI_NCR_MAX_TAGS (8)
|
128 |
|
|
#endif
|
129 |
|
|
|
130 |
|
|
/*
|
131 |
|
|
* Allow tagged command queuing support if configured with default number
|
132 |
|
|
* of tags set to max (see above).
|
133 |
|
|
*/
|
134 |
|
|
#ifdef CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS
|
135 |
|
|
#define SCSI_NCR_SETUP_DEFAULT_TAGS CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS
|
136 |
|
|
#elif defined CONFIG_SCSI_NCR53C8XX_TAGGED_QUEUE
|
137 |
|
|
#define SCSI_NCR_SETUP_DEFAULT_TAGS SCSI_NCR_MAX_TAGS
|
138 |
|
|
#else
|
139 |
|
|
#define SCSI_NCR_SETUP_DEFAULT_TAGS (0)
|
140 |
|
|
#endif
|
141 |
|
|
|
142 |
|
|
/*
|
143 |
|
|
* Use normal IO if configured. Forced for alpha and ppc.
|
144 |
|
|
*/
|
145 |
|
|
#if defined(CONFIG_SCSI_NCR53C8XX_IOMAPPED)
|
146 |
|
|
#define SCSI_NCR_IOMAPPED
|
147 |
|
|
#elif defined(__alpha__) || defined(__powerpc__)
|
148 |
|
|
#define SCSI_NCR_IOMAPPED
|
149 |
|
|
#elif defined(__sparc__)
|
150 |
|
|
#undef SCSI_NCR_IOMAPPED
|
151 |
|
|
#endif
|
152 |
|
|
|
153 |
|
|
/*
|
154 |
|
|
* Sync transfer frequency at startup.
|
155 |
|
|
* Allow from 5Mhz to 40Mhz default 20 Mhz.
|
156 |
|
|
*/
|
157 |
|
|
#ifndef CONFIG_SCSI_NCR53C8XX_SYNC
|
158 |
|
|
#define CONFIG_SCSI_NCR53C8XX_SYNC (20)
|
159 |
|
|
#elif CONFIG_SCSI_NCR53C8XX_SYNC > SCSI_NCR_MAX_SYNC
|
160 |
|
|
#undef CONFIG_SCSI_NCR53C8XX_SYNC
|
161 |
|
|
#define CONFIG_SCSI_NCR53C8XX_SYNC SCSI_NCR_MAX_SYNC
|
162 |
|
|
#endif
|
163 |
|
|
|
164 |
|
|
#if CONFIG_SCSI_NCR53C8XX_SYNC == 0
|
165 |
|
|
#define SCSI_NCR_SETUP_DEFAULT_SYNC (255)
|
166 |
|
|
#elif CONFIG_SCSI_NCR53C8XX_SYNC <= 5
|
167 |
|
|
#define SCSI_NCR_SETUP_DEFAULT_SYNC (50)
|
168 |
|
|
#elif CONFIG_SCSI_NCR53C8XX_SYNC <= 20
|
169 |
|
|
#define SCSI_NCR_SETUP_DEFAULT_SYNC (250/(CONFIG_SCSI_NCR53C8XX_SYNC))
|
170 |
|
|
#elif CONFIG_SCSI_NCR53C8XX_SYNC <= 33
|
171 |
|
|
#define SCSI_NCR_SETUP_DEFAULT_SYNC (11)
|
172 |
|
|
#else
|
173 |
|
|
#define SCSI_NCR_SETUP_DEFAULT_SYNC (10)
|
174 |
|
|
#endif
|
175 |
|
|
|
176 |
|
|
/*
|
177 |
|
|
* Disallow disconnections at boot-up
|
178 |
|
|
*/
|
179 |
|
|
#ifdef CONFIG_SCSI_NCR53C8XX_NO_DISCONNECT
|
180 |
|
|
#define SCSI_NCR_SETUP_DISCONNECTION (0)
|
181 |
|
|
#else
|
182 |
|
|
#define SCSI_NCR_SETUP_DISCONNECTION (1)
|
183 |
|
|
#endif
|
184 |
|
|
|
185 |
|
|
/*
|
186 |
|
|
* Force synchronous negotiation for all targets
|
187 |
|
|
*/
|
188 |
|
|
#ifdef CONFIG_SCSI_NCR53C8XX_FORCE_SYNC_NEGO
|
189 |
|
|
#define SCSI_NCR_SETUP_FORCE_SYNC_NEGO (1)
|
190 |
|
|
#else
|
191 |
|
|
#define SCSI_NCR_SETUP_FORCE_SYNC_NEGO (0)
|
192 |
|
|
#endif
|
193 |
|
|
|
194 |
|
|
/*
|
195 |
|
|
* Disable master parity checking (flawed hardwares need that)
|
196 |
|
|
*/
|
197 |
|
|
#ifdef CONFIG_SCSI_NCR53C8XX_DISABLE_MPARITY_CHECK
|
198 |
|
|
#define SCSI_NCR_SETUP_MASTER_PARITY (0)
|
199 |
|
|
#else
|
200 |
|
|
#define SCSI_NCR_SETUP_MASTER_PARITY (1)
|
201 |
|
|
#endif
|
202 |
|
|
|
203 |
|
|
/*
|
204 |
|
|
* Disable scsi parity checking (flawed devices may need that)
|
205 |
|
|
*/
|
206 |
|
|
#ifdef CONFIG_SCSI_NCR53C8XX_DISABLE_PARITY_CHECK
|
207 |
|
|
#define SCSI_NCR_SETUP_SCSI_PARITY (0)
|
208 |
|
|
#else
|
209 |
|
|
#define SCSI_NCR_SETUP_SCSI_PARITY (1)
|
210 |
|
|
#endif
|
211 |
|
|
|
212 |
|
|
/*
|
213 |
|
|
* Vendor specific stuff
|
214 |
|
|
*/
|
215 |
|
|
#ifdef CONFIG_SCSI_NCR53C8XX_SYMBIOS_COMPAT
|
216 |
|
|
#define SCSI_NCR_SETUP_LED_PIN (1)
|
217 |
|
|
#define SCSI_NCR_SETUP_DIFF_SUPPORT (3)
|
218 |
|
|
#else
|
219 |
|
|
#define SCSI_NCR_SETUP_LED_PIN (0)
|
220 |
|
|
#define SCSI_NCR_SETUP_DIFF_SUPPORT (0)
|
221 |
|
|
#endif
|
222 |
|
|
|
223 |
|
|
/*
|
224 |
|
|
* Settle time after reset at boot-up
|
225 |
|
|
*/
|
226 |
|
|
#define SCSI_NCR_SETUP_SETTLE_TIME (2)
|
227 |
|
|
|
228 |
|
|
/*
|
229 |
|
|
** Other parameters not configurable with "make config"
|
230 |
|
|
** Avoid to change these constants, unless you know what you are doing.
|
231 |
|
|
*/
|
232 |
|
|
|
233 |
|
|
#define SCSI_NCR_ALWAYS_SIMPLE_TAG
|
234 |
|
|
#define SCSI_NCR_MAX_SCATTER (127)
|
235 |
|
|
#define SCSI_NCR_MAX_TARGET (16)
|
236 |
|
|
|
237 |
|
|
/* No need to use a too large adapter queue */
|
238 |
|
|
#if SCSI_NCR_MAX_TAGS <= 32
|
239 |
|
|
#define SCSI_NCR_CAN_QUEUE (7*SCSI_NCR_MAX_TAGS)
|
240 |
|
|
#else
|
241 |
|
|
#define SCSI_NCR_CAN_QUEUE (250)
|
242 |
|
|
#endif
|
243 |
|
|
|
244 |
|
|
#define SCSI_NCR_CMD_PER_LUN (SCSI_NCR_MAX_TAGS)
|
245 |
|
|
#define SCSI_NCR_SG_TABLESIZE (SCSI_NCR_MAX_SCATTER)
|
246 |
|
|
|
247 |
|
|
#define SCSI_NCR_TIMER_INTERVAL (HZ)
|
248 |
|
|
|
249 |
|
|
#if 1 /* defined CONFIG_SCSI_MULTI_LUN */
|
250 |
|
|
#define SCSI_NCR_MAX_LUN (8)
|
251 |
|
|
#else
|
252 |
|
|
#define SCSI_NCR_MAX_LUN (1)
|
253 |
|
|
#endif
|
254 |
|
|
|
255 |
|
|
/*
|
256 |
|
|
** Define Scsi_Host_Template parameters
|
257 |
|
|
**
|
258 |
|
|
** Used by hosts.c and ncr53c8xx.c with module configuration.
|
259 |
|
|
*/
|
260 |
|
|
|
261 |
|
|
#if defined(HOSTS_C) || defined(MODULE)
|
262 |
|
|
|
263 |
|
|
#include <scsi/scsicam.h>
|
264 |
|
|
|
265 |
|
|
int ncr53c8xx_abort(Scsi_Cmnd *);
|
266 |
|
|
int ncr53c8xx_detect(Scsi_Host_Template *tpnt);
|
267 |
|
|
int ncr53c8xx_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
|
268 |
|
|
int ncr53c8xx_reset(Scsi_Cmnd *, unsigned int);
|
269 |
|
|
|
270 |
|
|
#ifdef MODULE
|
271 |
|
|
int ncr53c8xx_release(struct Scsi_Host *);
|
272 |
|
|
#else
|
273 |
|
|
#define ncr53c8xx_release NULL
|
274 |
|
|
#endif
|
275 |
|
|
|
276 |
|
|
#if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,75)
|
277 |
|
|
|
278 |
|
|
#define NCR53C8XX { name: SCSI_NCR_DRIVER_NAME, \
|
279 |
|
|
detect: ncr53c8xx_detect, \
|
280 |
|
|
release: ncr53c8xx_release, \
|
281 |
|
|
queuecommand: ncr53c8xx_queue_command,\
|
282 |
|
|
abort: ncr53c8xx_abort, \
|
283 |
|
|
reset: ncr53c8xx_reset, \
|
284 |
|
|
bios_param: scsicam_bios_param, \
|
285 |
|
|
can_queue: SCSI_NCR_CAN_QUEUE, \
|
286 |
|
|
this_id: 7, \
|
287 |
|
|
sg_tablesize: SCSI_NCR_SG_TABLESIZE, \
|
288 |
|
|
cmd_per_lun: SCSI_NCR_CMD_PER_LUN, \
|
289 |
|
|
use_clustering: DISABLE_CLUSTERING}
|
290 |
|
|
|
291 |
|
|
#else
|
292 |
|
|
|
293 |
|
|
#define NCR53C8XX { NULL, NULL, NULL, NULL, \
|
294 |
|
|
SCSI_NCR_DRIVER_NAME, ncr53c8xx_detect, \
|
295 |
|
|
ncr53c8xx_release, NULL, NULL, \
|
296 |
|
|
ncr53c8xx_queue_command,ncr53c8xx_abort, \
|
297 |
|
|
ncr53c8xx_reset, NULL, scsicam_bios_param, \
|
298 |
|
|
SCSI_NCR_CAN_QUEUE, 7, \
|
299 |
|
|
SCSI_NCR_SG_TABLESIZE, SCSI_NCR_CMD_PER_LUN, \
|
300 |
|
|
0, 0, DISABLE_CLUSTERING}
|
301 |
|
|
|
302 |
|
|
#endif /* LINUX_VERSION_CODE */
|
303 |
|
|
|
304 |
|
|
#endif /* defined(HOSTS_C) || defined(MODULE) */
|
305 |
|
|
|
306 |
|
|
#ifndef HOSTS_C
|
307 |
|
|
|
308 |
|
|
/*
|
309 |
|
|
** IO functions definition for big/little endian support.
|
310 |
|
|
** For now, the NCR is only supported in little endian addressing mode,
|
311 |
|
|
** and big endian byte ordering is only supported for the PPC.
|
312 |
|
|
** MMIO is not used on PPC.
|
313 |
|
|
*/
|
314 |
|
|
|
315 |
|
|
#ifdef __BIG_ENDIAN
|
316 |
|
|
|
317 |
|
|
#if LINUX_VERSION_CODE < LinuxVersionCode(2,1,0)
|
318 |
|
|
#error "BIG ENDIAN byte ordering needs kernel version >= 2.1.0"
|
319 |
|
|
#endif
|
320 |
|
|
|
321 |
|
|
#if defined(__powerpc__)
|
322 |
|
|
#define inw_l2b inw
|
323 |
|
|
#define inl_l2b inl
|
324 |
|
|
#define outw_b2l outw
|
325 |
|
|
#define outl_b2l outl
|
326 |
|
|
#elif defined(__sparc__)
|
327 |
|
|
#define readw_l2b readw
|
328 |
|
|
#define readl_l2b readl
|
329 |
|
|
#define writew_b2l writew
|
330 |
|
|
#define writel_b2l writel
|
331 |
|
|
#else
|
332 |
|
|
#error "Support for BIG ENDIAN is only available for PowerPC and SPARC"
|
333 |
|
|
#endif
|
334 |
|
|
|
335 |
|
|
#else /* Assumed x86 or alpha */
|
336 |
|
|
|
337 |
|
|
#define inw_raw inw
|
338 |
|
|
#define inl_raw inl
|
339 |
|
|
#define outw_raw outw
|
340 |
|
|
#define outl_raw outl
|
341 |
|
|
#define readw_raw readw
|
342 |
|
|
#define readl_raw readl
|
343 |
|
|
#define writew_raw writew
|
344 |
|
|
#define writel_raw writel
|
345 |
|
|
|
346 |
|
|
#endif
|
347 |
|
|
|
348 |
|
|
#ifdef SCSI_NCR_BIG_ENDIAN
|
349 |
|
|
#error "The NCR in BIG ENDIAN adressing mode is not (yet) supported"
|
350 |
|
|
#endif
|
351 |
|
|
|
352 |
|
|
/*
|
353 |
|
|
** NCR53C8XX Device Ids
|
354 |
|
|
*/
|
355 |
|
|
|
356 |
|
|
#ifndef PCI_DEVICE_ID_NCR_53C810
|
357 |
|
|
#define PCI_DEVICE_ID_NCR_53C810 1
|
358 |
|
|
#endif
|
359 |
|
|
|
360 |
|
|
#ifndef PCI_DEVICE_ID_NCR_53C810AP
|
361 |
|
|
#define PCI_DEVICE_ID_NCR_53C810AP 5
|
362 |
|
|
#endif
|
363 |
|
|
|
364 |
|
|
#ifndef PCI_DEVICE_ID_NCR_53C815
|
365 |
|
|
#define PCI_DEVICE_ID_NCR_53C815 4
|
366 |
|
|
#endif
|
367 |
|
|
|
368 |
|
|
#ifndef PCI_DEVICE_ID_NCR_53C820
|
369 |
|
|
#define PCI_DEVICE_ID_NCR_53C820 2
|
370 |
|
|
#endif
|
371 |
|
|
|
372 |
|
|
#ifndef PCI_DEVICE_ID_NCR_53C825
|
373 |
|
|
#define PCI_DEVICE_ID_NCR_53C825 3
|
374 |
|
|
#endif
|
375 |
|
|
|
376 |
|
|
#ifndef PCI_DEVICE_ID_NCR_53C860
|
377 |
|
|
#define PCI_DEVICE_ID_NCR_53C860 6
|
378 |
|
|
#endif
|
379 |
|
|
|
380 |
|
|
#ifndef PCI_DEVICE_ID_NCR_53C875
|
381 |
|
|
#define PCI_DEVICE_ID_NCR_53C875 0xf
|
382 |
|
|
#endif
|
383 |
|
|
|
384 |
|
|
#ifndef PCI_DEVICE_ID_NCR_53C875J
|
385 |
|
|
#define PCI_DEVICE_ID_NCR_53C875J 0x8f
|
386 |
|
|
#endif
|
387 |
|
|
|
388 |
|
|
#ifndef PCI_DEVICE_ID_NCR_53C885
|
389 |
|
|
#define PCI_DEVICE_ID_NCR_53C885 0xd
|
390 |
|
|
#endif
|
391 |
|
|
|
392 |
|
|
#ifndef PCI_DEVICE_ID_NCR_53C895
|
393 |
|
|
#define PCI_DEVICE_ID_NCR_53C895 0xc
|
394 |
|
|
#endif
|
395 |
|
|
|
396 |
|
|
#ifndef PCI_DEVICE_ID_NCR_53C896
|
397 |
|
|
#define PCI_DEVICE_ID_NCR_53C896 0xb
|
398 |
|
|
#endif
|
399 |
|
|
|
400 |
|
|
/*
|
401 |
|
|
** NCR53C8XX devices features table.
|
402 |
|
|
*/
|
403 |
|
|
typedef struct {
|
404 |
|
|
unsigned short device_id;
|
405 |
|
|
unsigned short revision_id;
|
406 |
|
|
char *name;
|
407 |
|
|
unsigned char burst_max;
|
408 |
|
|
unsigned char offset_max;
|
409 |
|
|
unsigned char nr_divisor;
|
410 |
|
|
unsigned int features;
|
411 |
|
|
#define FE_LED0 (1<<0)
|
412 |
|
|
#define FE_WIDE (1<<1)
|
413 |
|
|
#define FE_ULTRA (1<<2)
|
414 |
|
|
#define FE_ULTRA2 (1<<3)
|
415 |
|
|
#define FE_DBLR (1<<4)
|
416 |
|
|
#define FE_QUAD (1<<5)
|
417 |
|
|
#define FE_ERL (1<<6)
|
418 |
|
|
#define FE_CLSE (1<<7)
|
419 |
|
|
#define FE_WRIE (1<<8)
|
420 |
|
|
#define FE_ERMP (1<<9)
|
421 |
|
|
#define FE_BOF (1<<10)
|
422 |
|
|
#define FE_DFS (1<<11)
|
423 |
|
|
#define FE_PFEN (1<<12)
|
424 |
|
|
#define FE_LDSTR (1<<13)
|
425 |
|
|
#define FE_RAM (1<<14)
|
426 |
|
|
#define FE_CLK80 (1<<15)
|
427 |
|
|
#define FE_RAM8K (1<<16)
|
428 |
|
|
#define FE_64BIT (1<<17)
|
429 |
|
|
#define FE_IO256 (1<<18)
|
430 |
|
|
#define FE_NOPM (1<<19)
|
431 |
|
|
#define FE_CACHE_SET (FE_ERL|FE_CLSE|FE_WRIE|FE_ERMP)
|
432 |
|
|
#define FE_SCSI_SET (FE_WIDE|FE_ULTRA|FE_ULTRA2|FE_DBLR|FE_QUAD|F_CLK80)
|
433 |
|
|
#define FE_SPECIAL_SET (FE_CACHE_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM)
|
434 |
|
|
} ncr_chip;
|
435 |
|
|
|
436 |
|
|
/*
|
437 |
|
|
** DEL 397 - 53C875 Rev 3 - Part Number 609-0392410 - ITEM 3.
|
438 |
|
|
** Memory Read transaction terminated by a retry followed by
|
439 |
|
|
** Memory Read Line command.
|
440 |
|
|
*/
|
441 |
|
|
#define FE_CACHE0_SET (FE_CACHE_SET & ~FE_ERL)
|
442 |
|
|
|
443 |
|
|
/*
|
444 |
|
|
** DEL 397 - 53C875 Rev 3 - Part Number 609-0392410 - ITEM 5.
|
445 |
|
|
** On paper, this errata is harmless. But it is a good reason for
|
446 |
|
|
** using a shorter programmed burst length (64 DWORDS instead of 128).
|
447 |
|
|
*/
|
448 |
|
|
|
449 |
|
|
#define SCSI_NCR_CHIP_TABLE \
|
450 |
|
|
{ \
|
451 |
|
|
{PCI_DEVICE_ID_NCR_53C810, 0x0f, "810", 4, 8, 4, \
|
452 |
|
|
FE_ERL} \
|
453 |
|
|
, \
|
454 |
|
|
{PCI_DEVICE_ID_NCR_53C810, 0xff, "810a", 4, 8, 4, \
|
455 |
|
|
FE_CACHE_SET|FE_LDSTR|FE_PFEN|FE_BOF} \
|
456 |
|
|
, \
|
457 |
|
|
{PCI_DEVICE_ID_NCR_53C815, 0xff, "815", 4, 8, 4, \
|
458 |
|
|
FE_ERL|FE_BOF} \
|
459 |
|
|
, \
|
460 |
|
|
{PCI_DEVICE_ID_NCR_53C820, 0xff, "820", 4, 8, 4, \
|
461 |
|
|
FE_WIDE|FE_ERL} \
|
462 |
|
|
, \
|
463 |
|
|
{PCI_DEVICE_ID_NCR_53C825, 0x0f, "825", 4, 8, 4, \
|
464 |
|
|
FE_WIDE|FE_ERL|FE_BOF} \
|
465 |
|
|
, \
|
466 |
|
|
{PCI_DEVICE_ID_NCR_53C825, 0xff, "825a", 6, 8, 4, \
|
467 |
|
|
FE_WIDE|FE_CACHE0_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM} \
|
468 |
|
|
, \
|
469 |
|
|
{PCI_DEVICE_ID_NCR_53C860, 0xff, "860", 4, 8, 5, \
|
470 |
|
|
FE_ULTRA|FE_CLK80|FE_CACHE_SET|FE_BOF|FE_LDSTR|FE_PFEN} \
|
471 |
|
|
, \
|
472 |
|
|
{PCI_DEVICE_ID_NCR_53C875, 0x01, "875", 6, 16, 5, \
|
473 |
|
|
FE_WIDE|FE_ULTRA|FE_CLK80|FE_CACHE0_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM}\
|
474 |
|
|
, \
|
475 |
|
|
{PCI_DEVICE_ID_NCR_53C875, 0x0f, "875", 6, 16, 5, \
|
476 |
|
|
FE_WIDE|FE_ULTRA|FE_DBLR|FE_CACHE0_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM}\
|
477 |
|
|
, \
|
478 |
|
|
{PCI_DEVICE_ID_NCR_53C875, 0xff, "876", 6, 16, 5, \
|
479 |
|
|
FE_WIDE|FE_ULTRA|FE_DBLR|FE_CACHE0_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM}\
|
480 |
|
|
, \
|
481 |
|
|
{PCI_DEVICE_ID_NCR_53C875J,0xff, "875J", 6, 16, 5, \
|
482 |
|
|
FE_WIDE|FE_ULTRA|FE_DBLR|FE_CACHE0_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM}\
|
483 |
|
|
, \
|
484 |
|
|
{PCI_DEVICE_ID_NCR_53C885, 0xff, "885", 6, 16, 5, \
|
485 |
|
|
FE_WIDE|FE_ULTRA|FE_DBLR|FE_CACHE0_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM}\
|
486 |
|
|
, \
|
487 |
|
|
{PCI_DEVICE_ID_NCR_53C895, 0xff, "895", 7, 31, 7, \
|
488 |
|
|
FE_WIDE|FE_ULTRA2|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM}\
|
489 |
|
|
, \
|
490 |
|
|
{PCI_DEVICE_ID_NCR_53C896, 0xff, "896", 7, 31, 7, \
|
491 |
|
|
FE_WIDE|FE_ULTRA2|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM|\
|
492 |
|
|
FE_RAM8K|FE_64BIT|FE_IO256|FE_NOPM}\
|
493 |
|
|
}
|
494 |
|
|
|
495 |
|
|
/*
|
496 |
|
|
* List of supported NCR chip ids
|
497 |
|
|
*/
|
498 |
|
|
#define SCSI_NCR_CHIP_IDS \
|
499 |
|
|
{ \
|
500 |
|
|
PCI_DEVICE_ID_NCR_53C810, \
|
501 |
|
|
PCI_DEVICE_ID_NCR_53C815, \
|
502 |
|
|
PCI_DEVICE_ID_NCR_53C820, \
|
503 |
|
|
PCI_DEVICE_ID_NCR_53C825, \
|
504 |
|
|
PCI_DEVICE_ID_NCR_53C860, \
|
505 |
|
|
PCI_DEVICE_ID_NCR_53C875, \
|
506 |
|
|
PCI_DEVICE_ID_NCR_53C875J, \
|
507 |
|
|
PCI_DEVICE_ID_NCR_53C885, \
|
508 |
|
|
PCI_DEVICE_ID_NCR_53C895, \
|
509 |
|
|
PCI_DEVICE_ID_NCR_53C896 \
|
510 |
|
|
}
|
511 |
|
|
|
512 |
|
|
/*
|
513 |
|
|
** Initial setup.
|
514 |
|
|
** Can be overriden at startup by a command line.
|
515 |
|
|
*/
|
516 |
|
|
#define SCSI_NCR_DRIVER_SETUP \
|
517 |
|
|
{ \
|
518 |
|
|
SCSI_NCR_SETUP_MASTER_PARITY, \
|
519 |
|
|
SCSI_NCR_SETUP_SCSI_PARITY, \
|
520 |
|
|
SCSI_NCR_SETUP_DISCONNECTION, \
|
521 |
|
|
SCSI_NCR_SETUP_SPECIAL_FEATURES, \
|
522 |
|
|
SCSI_NCR_SETUP_ULTRA_SCSI, \
|
523 |
|
|
SCSI_NCR_SETUP_FORCE_SYNC_NEGO, \
|
524 |
|
|
0, \
|
525 |
|
|
0, \
|
526 |
|
|
1, \
|
527 |
|
|
1, \
|
528 |
|
|
SCSI_NCR_SETUP_DEFAULT_TAGS, \
|
529 |
|
|
SCSI_NCR_SETUP_DEFAULT_SYNC, \
|
530 |
|
|
0x00, \
|
531 |
|
|
7, \
|
532 |
|
|
SCSI_NCR_SETUP_LED_PIN, \
|
533 |
|
|
1, \
|
534 |
|
|
SCSI_NCR_SETUP_SETTLE_TIME, \
|
535 |
|
|
SCSI_NCR_SETUP_DIFF_SUPPORT, \
|
536 |
|
|
0, \
|
537 |
|
|
1 \
|
538 |
|
|
}
|
539 |
|
|
|
540 |
|
|
/*
|
541 |
|
|
** Boot fail safe setup.
|
542 |
|
|
** Override initial setup from boot command line:
|
543 |
|
|
** ncr53c8xx=safe:y
|
544 |
|
|
*/
|
545 |
|
|
#define SCSI_NCR_DRIVER_SAFE_SETUP \
|
546 |
|
|
{ \
|
547 |
|
|
0, \
|
548 |
|
|
1, \
|
549 |
|
|
0, \
|
550 |
|
|
0, \
|
551 |
|
|
0, \
|
552 |
|
|
0, \
|
553 |
|
|
0, \
|
554 |
|
|
0, \
|
555 |
|
|
1, \
|
556 |
|
|
2, \
|
557 |
|
|
0, \
|
558 |
|
|
255, \
|
559 |
|
|
0x00, \
|
560 |
|
|
255, \
|
561 |
|
|
0, \
|
562 |
|
|
0, \
|
563 |
|
|
10, \
|
564 |
|
|
1, \
|
565 |
|
|
1, \
|
566 |
|
|
1 \
|
567 |
|
|
}
|
568 |
|
|
|
569 |
|
|
/**************** ORIGINAL CONTENT of ncrreg.h from FreeBSD ******************/
|
570 |
|
|
|
571 |
|
|
/*-----------------------------------------------------------------
|
572 |
|
|
**
|
573 |
|
|
** The ncr 53c810 register structure.
|
574 |
|
|
**
|
575 |
|
|
**-----------------------------------------------------------------
|
576 |
|
|
*/
|
577 |
|
|
|
578 |
|
|
struct ncr_reg {
|
579 |
|
|
/*00*/ u_char nc_scntl0; /* full arb., ena parity, par->ATN */
|
580 |
|
|
|
581 |
|
|
/*01*/ u_char nc_scntl1; /* no reset */
|
582 |
|
|
#define ISCON 0x10 /* connected to scsi */
|
583 |
|
|
#define CRST 0x08 /* force reset */
|
584 |
|
|
|
585 |
|
|
/*02*/ u_char nc_scntl2; /* no disconnect expected */
|
586 |
|
|
#define SDU 0x80 /* cmd: disconnect will raise error */
|
587 |
|
|
#define CHM 0x40 /* sta: chained mode */
|
588 |
|
|
#define WSS 0x08 /* sta: wide scsi send [W]*/
|
589 |
|
|
#define WSR 0x01 /* sta: wide scsi received [W]*/
|
590 |
|
|
|
591 |
|
|
/*03*/ u_char nc_scntl3; /* cnf system clock dependent */
|
592 |
|
|
#define EWS 0x08 /* cmd: enable wide scsi [W]*/
|
593 |
|
|
#define ULTRA 0x80 /* cmd: ULTRA enable */
|
594 |
|
|
|
595 |
|
|
/*04*/ u_char nc_scid; /* cnf host adapter scsi address */
|
596 |
|
|
#define RRE 0x40 /* r/w:e enable response to resel. */
|
597 |
|
|
#define SRE 0x20 /* r/w:e enable response to select */
|
598 |
|
|
|
599 |
|
|
/*05*/ u_char nc_sxfer; /* ### Sync speed and count */
|
600 |
|
|
|
601 |
|
|
/*06*/ u_char nc_sdid; /* ### Destination-ID */
|
602 |
|
|
|
603 |
|
|
/*07*/ u_char nc_gpreg; /* ??? IO-Pins */
|
604 |
|
|
|
605 |
|
|
/*08*/ u_char nc_sfbr; /* ### First byte in phase */
|
606 |
|
|
|
607 |
|
|
/*09*/ u_char nc_socl;
|
608 |
|
|
#define CREQ 0x80 /* r/w: SCSI-REQ */
|
609 |
|
|
#define CACK 0x40 /* r/w: SCSI-ACK */
|
610 |
|
|
#define CBSY 0x20 /* r/w: SCSI-BSY */
|
611 |
|
|
#define CSEL 0x10 /* r/w: SCSI-SEL */
|
612 |
|
|
#define CATN 0x08 /* r/w: SCSI-ATN */
|
613 |
|
|
#define CMSG 0x04 /* r/w: SCSI-MSG */
|
614 |
|
|
#define CC_D 0x02 /* r/w: SCSI-C_D */
|
615 |
|
|
#define CI_O 0x01 /* r/w: SCSI-I_O */
|
616 |
|
|
|
617 |
|
|
/*0a*/ u_char nc_ssid;
|
618 |
|
|
|
619 |
|
|
/*0b*/ u_char nc_sbcl;
|
620 |
|
|
|
621 |
|
|
/*0c*/ u_char nc_dstat;
|
622 |
|
|
#define DFE 0x80 /* sta: dma fifo empty */
|
623 |
|
|
#define MDPE 0x40 /* int: master data parity error */
|
624 |
|
|
#define BF 0x20 /* int: script: bus fault */
|
625 |
|
|
#define ABRT 0x10 /* int: script: command aborted */
|
626 |
|
|
#define SSI 0x08 /* int: script: single step */
|
627 |
|
|
#define SIR 0x04 /* int: script: interrupt instruct. */
|
628 |
|
|
#define IID 0x01 /* int: script: illegal instruct. */
|
629 |
|
|
|
630 |
|
|
/*0d*/ u_char nc_sstat0;
|
631 |
|
|
#define ILF 0x80 /* sta: data in SIDL register lsb */
|
632 |
|
|
#define ORF 0x40 /* sta: data in SODR register lsb */
|
633 |
|
|
#define OLF 0x20 /* sta: data in SODL register lsb */
|
634 |
|
|
#define AIP 0x10 /* sta: arbitration in progress */
|
635 |
|
|
#define LOA 0x08 /* sta: arbitration lost */
|
636 |
|
|
#define WOA 0x04 /* sta: arbitration won */
|
637 |
|
|
#define IRST 0x02 /* sta: scsi reset signal */
|
638 |
|
|
#define SDP 0x01 /* sta: scsi parity signal */
|
639 |
|
|
|
640 |
|
|
/*0e*/ u_char nc_sstat1;
|
641 |
|
|
#define FF3210 0xf0 /* sta: bytes in the scsi fifo */
|
642 |
|
|
|
643 |
|
|
/*0f*/ u_char nc_sstat2;
|
644 |
|
|
#define ILF1 0x80 /* sta: data in SIDL register msb[W]*/
|
645 |
|
|
#define ORF1 0x40 /* sta: data in SODR register msb[W]*/
|
646 |
|
|
#define OLF1 0x20 /* sta: data in SODL register msb[W]*/
|
647 |
|
|
#define DM 0x04 /* sta: DIFFSENS mismatch (895/6 only) */
|
648 |
|
|
#define LDSC 0x02 /* sta: disconnect & reconnect */
|
649 |
|
|
|
650 |
|
|
/*10*/ u_int32 nc_dsa; /* --> Base page */
|
651 |
|
|
|
652 |
|
|
/*14*/ u_char nc_istat; /* --> Main Command and status */
|
653 |
|
|
#define CABRT 0x80 /* cmd: abort current operation */
|
654 |
|
|
#define SRST 0x40 /* mod: reset chip */
|
655 |
|
|
#define SIGP 0x20 /* r/w: message from host to ncr */
|
656 |
|
|
#define SEM 0x10 /* r/w: message between host + ncr */
|
657 |
|
|
#define CON 0x08 /* sta: connected to scsi */
|
658 |
|
|
#define INTF 0x04 /* sta: int on the fly (reset by wr)*/
|
659 |
|
|
#define SIP 0x02 /* sta: scsi-interrupt */
|
660 |
|
|
#define DIP 0x01 /* sta: host/script interrupt */
|
661 |
|
|
|
662 |
|
|
/*15*/ u_char nc_15_;
|
663 |
|
|
/*16*/ u_char nc_16_;
|
664 |
|
|
/*17*/ u_char nc_17_;
|
665 |
|
|
|
666 |
|
|
/*18*/ u_char nc_ctest0;
|
667 |
|
|
/*19*/ u_char nc_ctest1;
|
668 |
|
|
|
669 |
|
|
/*1a*/ u_char nc_ctest2;
|
670 |
|
|
#define CSIGP 0x40
|
671 |
|
|
|
672 |
|
|
/*1b*/ u_char nc_ctest3;
|
673 |
|
|
#define FLF 0x08 /* cmd: flush dma fifo */
|
674 |
|
|
#define CLF 0x04 /* cmd: clear dma fifo */
|
675 |
|
|
#define FM 0x02 /* mod: fetch pin mode */
|
676 |
|
|
#define WRIE 0x01 /* mod: write and invalidate enable */
|
677 |
|
|
|
678 |
|
|
/*1c*/ u_int32 nc_temp; /* ### Temporary stack */
|
679 |
|
|
|
680 |
|
|
/*20*/ u_char nc_dfifo;
|
681 |
|
|
/*21*/ u_char nc_ctest4;
|
682 |
|
|
#define BDIS 0x80 /* mod: burst disable */
|
683 |
|
|
#define MPEE 0x08 /* mod: master parity error enable */
|
684 |
|
|
|
685 |
|
|
/*22*/ u_char nc_ctest5;
|
686 |
|
|
#define DFS 0x20 /* mod: dma fifo size */
|
687 |
|
|
/*23*/ u_char nc_ctest6;
|
688 |
|
|
|
689 |
|
|
/*24*/ u_int32 nc_dbc; /* ### Byte count and command */
|
690 |
|
|
/*28*/ u_int32 nc_dnad; /* ### Next command register */
|
691 |
|
|
/*2c*/ u_int32 nc_dsp; /* --> Script Pointer */
|
692 |
|
|
/*30*/ u_int32 nc_dsps; /* --> Script pointer save/opcode#2 */
|
693 |
|
|
|
694 |
|
|
/*34*/ u_char nc_scratcha; /* Temporary register a */
|
695 |
|
|
/*35*/ u_char nc_scratcha1;
|
696 |
|
|
/*36*/ u_char nc_scratcha2;
|
697 |
|
|
/*37*/ u_char nc_scratcha3;
|
698 |
|
|
|
699 |
|
|
/*38*/ u_char nc_dmode;
|
700 |
|
|
#define BL_2 0x80 /* mod: burst length shift value +2 */
|
701 |
|
|
#define BL_1 0x40 /* mod: burst length shift value +1 */
|
702 |
|
|
#define ERL 0x08 /* mod: enable read line */
|
703 |
|
|
#define ERMP 0x04 /* mod: enable read multiple */
|
704 |
|
|
#define BOF 0x02 /* mod: burst op code fetch */
|
705 |
|
|
|
706 |
|
|
/*39*/ u_char nc_dien;
|
707 |
|
|
/*3a*/ u_char nc_dwt;
|
708 |
|
|
|
709 |
|
|
/*3b*/ u_char nc_dcntl; /* --> Script execution control */
|
710 |
|
|
|
711 |
|
|
#define CLSE 0x80 /* mod: cache line size enable */
|
712 |
|
|
#define PFF 0x40 /* cmd: pre-fetch flush */
|
713 |
|
|
#define PFEN 0x20 /* mod: pre-fetch enable */
|
714 |
|
|
#define SSM 0x10 /* mod: single step mode */
|
715 |
|
|
#define IRQM 0x08 /* mod: irq mode (1 = totem pole !) */
|
716 |
|
|
#define STD 0x04 /* cmd: start dma mode */
|
717 |
|
|
#define IRQD 0x02 /* mod: irq disable */
|
718 |
|
|
#define NOCOM 0x01 /* cmd: protect sfbr while reselect */
|
719 |
|
|
|
720 |
|
|
/*3c*/ u_int32 nc_adder;
|
721 |
|
|
|
722 |
|
|
/*40*/ u_short nc_sien; /* -->: interrupt enable */
|
723 |
|
|
/*42*/ u_short nc_sist; /* <--: interrupt status */
|
724 |
|
|
#define SBMC 0x1000/* sta: SCSI Bus Mode Change (895/6 only) */
|
725 |
|
|
#define STO 0x0400/* sta: timeout (select) */
|
726 |
|
|
#define GEN 0x0200/* sta: timeout (general) */
|
727 |
|
|
#define HTH 0x0100/* sta: timeout (handshake) */
|
728 |
|
|
#define MA 0x80 /* sta: phase mismatch */
|
729 |
|
|
#define CMP 0x40 /* sta: arbitration complete */
|
730 |
|
|
#define SEL 0x20 /* sta: selected by another device */
|
731 |
|
|
#define RSL 0x10 /* sta: reselected by another device*/
|
732 |
|
|
#define SGE 0x08 /* sta: gross error (over/underflow)*/
|
733 |
|
|
#define UDC 0x04 /* sta: unexpected disconnect */
|
734 |
|
|
#define RST 0x02 /* sta: scsi bus reset detected */
|
735 |
|
|
#define PAR 0x01 /* sta: scsi parity error */
|
736 |
|
|
|
737 |
|
|
/*44*/ u_char nc_slpar;
|
738 |
|
|
/*45*/ u_char nc_swide;
|
739 |
|
|
/*46*/ u_char nc_macntl;
|
740 |
|
|
/*47*/ u_char nc_gpcntl;
|
741 |
|
|
/*48*/ u_char nc_stime0; /* cmd: timeout for select&handshake*/
|
742 |
|
|
/*49*/ u_char nc_stime1; /* cmd: timeout user defined */
|
743 |
|
|
/*4a*/ u_short nc_respid; /* sta: Reselect-IDs */
|
744 |
|
|
|
745 |
|
|
/*4c*/ u_char nc_stest0;
|
746 |
|
|
|
747 |
|
|
/*4d*/ u_char nc_stest1;
|
748 |
|
|
#define DBLEN 0x08 /* clock doubler running */
|
749 |
|
|
#define DBLSEL 0x04 /* clock doubler selected */
|
750 |
|
|
|
751 |
|
|
|
752 |
|
|
/*4e*/ u_char nc_stest2;
|
753 |
|
|
#define ROF 0x40 /* reset scsi offset (after gross error!) */
|
754 |
|
|
#define EXT 0x02 /* extended filtering */
|
755 |
|
|
|
756 |
|
|
/*4f*/ u_char nc_stest3;
|
757 |
|
|
#define TE 0x80 /* c: tolerAnt enable */
|
758 |
|
|
#define HSC 0x20 /* c: Halt SCSI Clock */
|
759 |
|
|
#define CSF 0x02 /* c: clear scsi fifo */
|
760 |
|
|
|
761 |
|
|
/*50*/ u_short nc_sidl; /* Lowlevel: latched from scsi data */
|
762 |
|
|
/*52*/ u_char nc_stest4;
|
763 |
|
|
#define SMODE 0xc0 /* SCSI bus mode (895/6 only) */
|
764 |
|
|
#define SMODE_HVD 0x40 /* High Voltage Differential */
|
765 |
|
|
#define SMODE_SE 0x80 /* Single Ended */
|
766 |
|
|
#define SMODE_LVD 0xc0 /* Low Voltage Differential */
|
767 |
|
|
#define LCKFRQ 0x20 /* Frequency Lock (895/6 only) */
|
768 |
|
|
|
769 |
|
|
/*53*/ u_char nc_53_;
|
770 |
|
|
/*54*/ u_short nc_sodl; /* Lowlevel: data out to scsi data */
|
771 |
|
|
/*56*/ u_char nc_ccntl0; /* Chip Control 0 (896) */
|
772 |
|
|
#define ENPMJ 0x80 /* Enable Phase Mismatch Jump */
|
773 |
|
|
#define PMJCTL 0x40 /* Phase Mismatch Jump Control */
|
774 |
|
|
#define ENNDJ 0x20 /* Enable Non Data PM Jump */
|
775 |
|
|
#define DISFC 0x10 /* Disable Auto FIFO Clear */
|
776 |
|
|
#define DILS 0x02 /* Disable Internal Load/Store */
|
777 |
|
|
#define DPR 0x01 /* Disable Pipe Req */
|
778 |
|
|
|
779 |
|
|
/*57*/ u_char nc_ccntl1; /* Chip Control 1 (896) */
|
780 |
|
|
#define ZMOD 0x80 /* High Impedance Mode */
|
781 |
|
|
#define DDAC 0x08 /* Disable Dual Address Cycle */
|
782 |
|
|
#define XTIMOD 0x04 /* 64-bit Table Ind. Indexing Mode */
|
783 |
|
|
#define EXTIBMV 0x02 /* Enable 64-bit Table Ind. BMOV */
|
784 |
|
|
#define EXDBMV 0x01 /* Enable 64-bit Direct BMOV */
|
785 |
|
|
/*58*/ u_short nc_sbdl; /* Lowlevel: data from scsi data */
|
786 |
|
|
/*5a*/ u_short nc_5a_;
|
787 |
|
|
/*5c*/ u_char nc_scr0; /* Working register B */
|
788 |
|
|
/*5d*/ u_char nc_scr1; /* */
|
789 |
|
|
/*5e*/ u_char nc_scr2; /* */
|
790 |
|
|
/*5f*/ u_char nc_scr3; /* */
|
791 |
|
|
/*60*/
|
792 |
|
|
};
|
793 |
|
|
|
794 |
|
|
/*-----------------------------------------------------------
|
795 |
|
|
**
|
796 |
|
|
** Utility macros for the script.
|
797 |
|
|
**
|
798 |
|
|
**-----------------------------------------------------------
|
799 |
|
|
*/
|
800 |
|
|
|
801 |
|
|
#define REGJ(p,r) (offsetof(struct ncr_reg, p ## r))
|
802 |
|
|
#define REG(r) REGJ (nc_, r)
|
803 |
|
|
|
804 |
|
|
#ifndef TARGET_MODE
|
805 |
|
|
#define TARGET_MODE 0
|
806 |
|
|
#endif
|
807 |
|
|
|
808 |
|
|
typedef u_int32 ncrcmd;
|
809 |
|
|
|
810 |
|
|
/*-----------------------------------------------------------
|
811 |
|
|
**
|
812 |
|
|
** SCSI phases
|
813 |
|
|
**
|
814 |
|
|
**-----------------------------------------------------------
|
815 |
|
|
*/
|
816 |
|
|
|
817 |
|
|
#define SCR_DATA_OUT 0x00000000
|
818 |
|
|
#define SCR_DATA_IN 0x01000000
|
819 |
|
|
#define SCR_COMMAND 0x02000000
|
820 |
|
|
#define SCR_STATUS 0x03000000
|
821 |
|
|
#define SCR_ILG_OUT 0x04000000
|
822 |
|
|
#define SCR_ILG_IN 0x05000000
|
823 |
|
|
#define SCR_MSG_OUT 0x06000000
|
824 |
|
|
#define SCR_MSG_IN 0x07000000
|
825 |
|
|
|
826 |
|
|
/*-----------------------------------------------------------
|
827 |
|
|
**
|
828 |
|
|
** Data transfer via SCSI.
|
829 |
|
|
**
|
830 |
|
|
**-----------------------------------------------------------
|
831 |
|
|
**
|
832 |
|
|
** MOVE_ABS (LEN)
|
833 |
|
|
** <<start address>>
|
834 |
|
|
**
|
835 |
|
|
** MOVE_IND (LEN)
|
836 |
|
|
** <<dnad_offset>>
|
837 |
|
|
**
|
838 |
|
|
** MOVE_TBL
|
839 |
|
|
** <<dnad_offset>>
|
840 |
|
|
**
|
841 |
|
|
**-----------------------------------------------------------
|
842 |
|
|
*/
|
843 |
|
|
|
844 |
|
|
#define SCR_MOVE_ABS(l) ((0x08000000 ^ (TARGET_MODE << 1ul)) | (l))
|
845 |
|
|
#define SCR_MOVE_IND(l) ((0x28000000 ^ (TARGET_MODE << 1ul)) | (l))
|
846 |
|
|
#define SCR_MOVE_TBL (0x18000000 ^ (TARGET_MODE << 1ul))
|
847 |
|
|
|
848 |
|
|
struct scr_tblmove {
|
849 |
|
|
u_int32 size;
|
850 |
|
|
u_int32 addr;
|
851 |
|
|
};
|
852 |
|
|
|
853 |
|
|
/*-----------------------------------------------------------
|
854 |
|
|
**
|
855 |
|
|
** Selection
|
856 |
|
|
**
|
857 |
|
|
**-----------------------------------------------------------
|
858 |
|
|
**
|
859 |
|
|
** SEL_ABS | SCR_ID (0..7) [ | REL_JMP]
|
860 |
|
|
** <<alternate_address>>
|
861 |
|
|
**
|
862 |
|
|
** SEL_TBL | << dnad_offset>> [ | REL_JMP]
|
863 |
|
|
** <<alternate_address>>
|
864 |
|
|
**
|
865 |
|
|
**-----------------------------------------------------------
|
866 |
|
|
*/
|
867 |
|
|
|
868 |
|
|
#define SCR_SEL_ABS 0x40000000
|
869 |
|
|
#define SCR_SEL_ABS_ATN 0x41000000
|
870 |
|
|
#define SCR_SEL_TBL 0x42000000
|
871 |
|
|
#define SCR_SEL_TBL_ATN 0x43000000
|
872 |
|
|
|
873 |
|
|
struct scr_tblsel {
|
874 |
|
|
u_char sel_0;
|
875 |
|
|
u_char sel_sxfer;
|
876 |
|
|
u_char sel_id;
|
877 |
|
|
u_char sel_scntl3;
|
878 |
|
|
};
|
879 |
|
|
|
880 |
|
|
#define SCR_JMP_REL 0x04000000
|
881 |
|
|
#define SCR_ID(id) (((u_int32)(id)) << 16)
|
882 |
|
|
|
883 |
|
|
/*-----------------------------------------------------------
|
884 |
|
|
**
|
885 |
|
|
** Waiting for Disconnect or Reselect
|
886 |
|
|
**
|
887 |
|
|
**-----------------------------------------------------------
|
888 |
|
|
**
|
889 |
|
|
** WAIT_DISC
|
890 |
|
|
** dummy: <<alternate_address>>
|
891 |
|
|
**
|
892 |
|
|
** WAIT_RESEL
|
893 |
|
|
** <<alternate_address>>
|
894 |
|
|
**
|
895 |
|
|
**-----------------------------------------------------------
|
896 |
|
|
*/
|
897 |
|
|
|
898 |
|
|
#define SCR_WAIT_DISC 0x48000000
|
899 |
|
|
#define SCR_WAIT_RESEL 0x50000000
|
900 |
|
|
|
901 |
|
|
/*-----------------------------------------------------------
|
902 |
|
|
**
|
903 |
|
|
** Bit Set / Reset
|
904 |
|
|
**
|
905 |
|
|
**-----------------------------------------------------------
|
906 |
|
|
**
|
907 |
|
|
** SET (flags {|.. })
|
908 |
|
|
**
|
909 |
|
|
** CLR (flags {|.. })
|
910 |
|
|
**
|
911 |
|
|
**-----------------------------------------------------------
|
912 |
|
|
*/
|
913 |
|
|
|
914 |
|
|
#define SCR_SET(f) (0x58000000 | (f))
|
915 |
|
|
#define SCR_CLR(f) (0x60000000 | (f))
|
916 |
|
|
|
917 |
|
|
#define SCR_CARRY 0x00000400
|
918 |
|
|
#define SCR_TRG 0x00000200
|
919 |
|
|
#define SCR_ACK 0x00000040
|
920 |
|
|
#define SCR_ATN 0x00000008
|
921 |
|
|
|
922 |
|
|
|
923 |
|
|
|
924 |
|
|
|
925 |
|
|
/*-----------------------------------------------------------
|
926 |
|
|
**
|
927 |
|
|
** Memory to memory move
|
928 |
|
|
**
|
929 |
|
|
**-----------------------------------------------------------
|
930 |
|
|
**
|
931 |
|
|
** COPY (bytecount)
|
932 |
|
|
** << source_address >>
|
933 |
|
|
** << destination_address >>
|
934 |
|
|
**
|
935 |
|
|
** SCR_COPY sets the NO FLUSH option by default.
|
936 |
|
|
** SCR_COPY_F does not set this option.
|
937 |
|
|
**
|
938 |
|
|
** For chips which do not support this option,
|
939 |
|
|
** ncr_copy_and_bind() will remove this bit.
|
940 |
|
|
**-----------------------------------------------------------
|
941 |
|
|
*/
|
942 |
|
|
|
943 |
|
|
#define SCR_NO_FLUSH 0x01000000
|
944 |
|
|
|
945 |
|
|
#define SCR_COPY(n) (0xc0000000 | SCR_NO_FLUSH | (n))
|
946 |
|
|
#define SCR_COPY_F(n) (0xc0000000 | (n))
|
947 |
|
|
|
948 |
|
|
/*-----------------------------------------------------------
|
949 |
|
|
**
|
950 |
|
|
** Register move and binary operations
|
951 |
|
|
**
|
952 |
|
|
**-----------------------------------------------------------
|
953 |
|
|
**
|
954 |
|
|
** SFBR_REG (reg, op, data) reg = SFBR op data
|
955 |
|
|
** << 0 >>
|
956 |
|
|
**
|
957 |
|
|
** REG_SFBR (reg, op, data) SFBR = reg op data
|
958 |
|
|
** << 0 >>
|
959 |
|
|
**
|
960 |
|
|
** REG_REG (reg, op, data) reg = reg op data
|
961 |
|
|
** << 0 >>
|
962 |
|
|
**
|
963 |
|
|
**-----------------------------------------------------------
|
964 |
|
|
*/
|
965 |
|
|
|
966 |
|
|
#define SCR_REG_OFS(ofs) ((ofs) << 16ul)
|
967 |
|
|
|
968 |
|
|
#define SCR_SFBR_REG(reg,op,data) \
|
969 |
|
|
(0x68000000 | (SCR_REG_OFS(REG(reg))) | (op) | ((data)<<8ul))
|
970 |
|
|
|
971 |
|
|
#define SCR_REG_SFBR(reg,op,data) \
|
972 |
|
|
(0x70000000 | (SCR_REG_OFS(REG(reg))) | (op) | ((data)<<8ul))
|
973 |
|
|
|
974 |
|
|
#define SCR_REG_REG(reg,op,data) \
|
975 |
|
|
(0x78000000 | (SCR_REG_OFS(REG(reg))) | (op) | ((data)<<8ul))
|
976 |
|
|
|
977 |
|
|
|
978 |
|
|
#define SCR_LOAD 0x00000000
|
979 |
|
|
#define SCR_SHL 0x01000000
|
980 |
|
|
#define SCR_OR 0x02000000
|
981 |
|
|
#define SCR_XOR 0x03000000
|
982 |
|
|
#define SCR_AND 0x04000000
|
983 |
|
|
#define SCR_SHR 0x05000000
|
984 |
|
|
#define SCR_ADD 0x06000000
|
985 |
|
|
#define SCR_ADDC 0x07000000
|
986 |
|
|
|
987 |
|
|
/*-----------------------------------------------------------
|
988 |
|
|
**
|
989 |
|
|
** FROM_REG (reg) SFBR = reg
|
990 |
|
|
** << 0 >>
|
991 |
|
|
**
|
992 |
|
|
** TO_REG (reg) reg = SFBR
|
993 |
|
|
** << 0 >>
|
994 |
|
|
**
|
995 |
|
|
** LOAD_REG (reg, data) reg = <data>
|
996 |
|
|
** << 0 >>
|
997 |
|
|
**
|
998 |
|
|
** LOAD_SFBR(data) SFBR = <data>
|
999 |
|
|
** << 0 >>
|
1000 |
|
|
**
|
1001 |
|
|
**-----------------------------------------------------------
|
1002 |
|
|
*/
|
1003 |
|
|
|
1004 |
|
|
#define SCR_FROM_REG(reg) \
|
1005 |
|
|
SCR_REG_SFBR(reg,SCR_OR,0)
|
1006 |
|
|
|
1007 |
|
|
#define SCR_TO_REG(reg) \
|
1008 |
|
|
SCR_SFBR_REG(reg,SCR_OR,0)
|
1009 |
|
|
|
1010 |
|
|
#define SCR_LOAD_REG(reg,data) \
|
1011 |
|
|
SCR_REG_REG(reg,SCR_LOAD,data)
|
1012 |
|
|
|
1013 |
|
|
#define SCR_LOAD_SFBR(data) \
|
1014 |
|
|
(SCR_REG_SFBR (gpreg, SCR_LOAD, data))
|
1015 |
|
|
|
1016 |
|
|
/*-----------------------------------------------------------
|
1017 |
|
|
**
|
1018 |
|
|
** LOAD from memory to register.
|
1019 |
|
|
** STORE from register to memory.
|
1020 |
|
|
**
|
1021 |
|
|
**-----------------------------------------------------------
|
1022 |
|
|
**
|
1023 |
|
|
** LOAD_ABS (LEN)
|
1024 |
|
|
** <<start address>>
|
1025 |
|
|
**
|
1026 |
|
|
** LOAD_REL (LEN) (DSA relative)
|
1027 |
|
|
** <<dsa_offset>>
|
1028 |
|
|
**
|
1029 |
|
|
**-----------------------------------------------------------
|
1030 |
|
|
*/
|
1031 |
|
|
|
1032 |
|
|
#define SCR_NO_FLUSH2 0x02000000
|
1033 |
|
|
#define SCR_DSA_REL2 0x10000000
|
1034 |
|
|
|
1035 |
|
|
#define SCR_LOAD_R(reg, how, n) \
|
1036 |
|
|
(0xe1000000 | how | (SCR_REG_OFS(REG(reg))) | (n))
|
1037 |
|
|
|
1038 |
|
|
#define SCR_STORE_R(reg, how, n) \
|
1039 |
|
|
(0xe0000000 | how | (SCR_REG_OFS(REG(reg))) | (n))
|
1040 |
|
|
|
1041 |
|
|
#define SCR_LOAD_ABS(reg, n) SCR_LOAD_R(reg, SCR_NO_FLUSH2, n)
|
1042 |
|
|
#define SCR_LOAD_REL(reg, n) SCR_LOAD_R(reg, SCR_NO_FLUSH2|SCR_DSA_REL2, n)
|
1043 |
|
|
#define SCR_LOAD_ABS_F(reg, n) SCR_LOAD_R(reg, 0, n)
|
1044 |
|
|
#define SCR_LOAD_REL_F(reg, n) SCR_LOAD_R(reg, SCR_DSA_REL2, n)
|
1045 |
|
|
|
1046 |
|
|
#define SCR_STORE_ABS(reg, n) SCR_STORE_R(reg, SCR_NO_FLUSH2, n)
|
1047 |
|
|
#define SCR_STORE_REL(reg, n) SCR_STORE_R(reg, SCR_NO_FLUSH2|SCR_DSA_REL2,n)
|
1048 |
|
|
#define SCR_STORE_ABS_F(reg, n) SCR_STORE_R(reg, 0, n)
|
1049 |
|
|
#define SCR_STORE_REL_F(reg, n) SCR_STORE_R(reg, SCR_DSA_REL2, n)
|
1050 |
|
|
|
1051 |
|
|
|
1052 |
|
|
/*-----------------------------------------------------------
|
1053 |
|
|
**
|
1054 |
|
|
** Waiting for Disconnect or Reselect
|
1055 |
|
|
**
|
1056 |
|
|
**-----------------------------------------------------------
|
1057 |
|
|
**
|
1058 |
|
|
** JUMP [ | IFTRUE/IFFALSE ( ... ) ]
|
1059 |
|
|
** <<address>>
|
1060 |
|
|
**
|
1061 |
|
|
** JUMPR [ | IFTRUE/IFFALSE ( ... ) ]
|
1062 |
|
|
** <<distance>>
|
1063 |
|
|
**
|
1064 |
|
|
** CALL [ | IFTRUE/IFFALSE ( ... ) ]
|
1065 |
|
|
** <<address>>
|
1066 |
|
|
**
|
1067 |
|
|
** CALLR [ | IFTRUE/IFFALSE ( ... ) ]
|
1068 |
|
|
** <<distance>>
|
1069 |
|
|
**
|
1070 |
|
|
** RETURN [ | IFTRUE/IFFALSE ( ... ) ]
|
1071 |
|
|
** <<dummy>>
|
1072 |
|
|
**
|
1073 |
|
|
** INT [ | IFTRUE/IFFALSE ( ... ) ]
|
1074 |
|
|
** <<ident>>
|
1075 |
|
|
**
|
1076 |
|
|
** INT_FLY [ | IFTRUE/IFFALSE ( ... ) ]
|
1077 |
|
|
** <<ident>>
|
1078 |
|
|
**
|
1079 |
|
|
** Conditions:
|
1080 |
|
|
** WHEN (phase)
|
1081 |
|
|
** IF (phase)
|
1082 |
|
|
** CARRY
|
1083 |
|
|
** DATA (data, mask)
|
1084 |
|
|
**
|
1085 |
|
|
**-----------------------------------------------------------
|
1086 |
|
|
*/
|
1087 |
|
|
|
1088 |
|
|
#define SCR_NO_OP 0x80000000
|
1089 |
|
|
#define SCR_JUMP 0x80080000
|
1090 |
|
|
#define SCR_JUMPR 0x80880000
|
1091 |
|
|
#define SCR_CALL 0x88080000
|
1092 |
|
|
#define SCR_CALLR 0x88880000
|
1093 |
|
|
#define SCR_RETURN 0x90080000
|
1094 |
|
|
#define SCR_INT 0x98080000
|
1095 |
|
|
#define SCR_INT_FLY 0x98180000
|
1096 |
|
|
|
1097 |
|
|
#define IFFALSE(arg) (0x00080000 | (arg))
|
1098 |
|
|
#define IFTRUE(arg) (0x00000000 | (arg))
|
1099 |
|
|
|
1100 |
|
|
#define WHEN(phase) (0x00030000 | (phase))
|
1101 |
|
|
#define IF(phase) (0x00020000 | (phase))
|
1102 |
|
|
|
1103 |
|
|
#define DATA(D) (0x00040000 | ((D) & 0xff))
|
1104 |
|
|
#define MASK(D,M) (0x00040000 | (((M ^ 0xff) & 0xff) << 8ul)|((D) & 0xff))
|
1105 |
|
|
|
1106 |
|
|
#define CARRYSET (0x00200000)
|
1107 |
|
|
|
1108 |
|
|
/*-----------------------------------------------------------
|
1109 |
|
|
**
|
1110 |
|
|
** SCSI constants.
|
1111 |
|
|
**
|
1112 |
|
|
**-----------------------------------------------------------
|
1113 |
|
|
*/
|
1114 |
|
|
|
1115 |
|
|
/*
|
1116 |
|
|
** Messages
|
1117 |
|
|
*/
|
1118 |
|
|
|
1119 |
|
|
#define M_COMPLETE (0x00)
|
1120 |
|
|
#define M_EXTENDED (0x01)
|
1121 |
|
|
#define M_SAVE_DP (0x02)
|
1122 |
|
|
#define M_RESTORE_DP (0x03)
|
1123 |
|
|
#define M_DISCONNECT (0x04)
|
1124 |
|
|
#define M_ID_ERROR (0x05)
|
1125 |
|
|
#define M_ABORT (0x06)
|
1126 |
|
|
#define M_REJECT (0x07)
|
1127 |
|
|
#define M_NOOP (0x08)
|
1128 |
|
|
#define M_PARITY (0x09)
|
1129 |
|
|
#define M_LCOMPLETE (0x0a)
|
1130 |
|
|
#define M_FCOMPLETE (0x0b)
|
1131 |
|
|
#define M_RESET (0x0c)
|
1132 |
|
|
#define M_ABORT_TAG (0x0d)
|
1133 |
|
|
#define M_CLEAR_QUEUE (0x0e)
|
1134 |
|
|
#define M_INIT_REC (0x0f)
|
1135 |
|
|
#define M_REL_REC (0x10)
|
1136 |
|
|
#define M_TERMINATE (0x11)
|
1137 |
|
|
#define M_SIMPLE_TAG (0x20)
|
1138 |
|
|
#define M_HEAD_TAG (0x21)
|
1139 |
|
|
#define M_ORDERED_TAG (0x22)
|
1140 |
|
|
#define M_IGN_RESIDUE (0x23)
|
1141 |
|
|
#define M_IDENTIFY (0x80)
|
1142 |
|
|
|
1143 |
|
|
#define M_X_MODIFY_DP (0x00)
|
1144 |
|
|
#define M_X_SYNC_REQ (0x01)
|
1145 |
|
|
#define M_X_WIDE_REQ (0x03)
|
1146 |
|
|
|
1147 |
|
|
/*
|
1148 |
|
|
** Status
|
1149 |
|
|
*/
|
1150 |
|
|
|
1151 |
|
|
#define S_GOOD (0x00)
|
1152 |
|
|
#define S_CHECK_COND (0x02)
|
1153 |
|
|
#define S_COND_MET (0x04)
|
1154 |
|
|
#define S_BUSY (0x08)
|
1155 |
|
|
#define S_INT (0x10)
|
1156 |
|
|
#define S_INT_COND_MET (0x14)
|
1157 |
|
|
#define S_CONFLICT (0x18)
|
1158 |
|
|
#define S_TERMINATED (0x20)
|
1159 |
|
|
#define S_QUEUE_FULL (0x28)
|
1160 |
|
|
#define S_ILLEGAL (0xff)
|
1161 |
|
|
#define S_SENSE (0x80)
|
1162 |
|
|
|
1163 |
|
|
/*
|
1164 |
|
|
* End of ncrreg from FreeBSD
|
1165 |
|
|
*/
|
1166 |
|
|
|
1167 |
|
|
#endif /* !defined HOSTS_C */
|
1168 |
|
|
|
1169 |
|
|
#endif /* defined NCR53C8XX_H */
|