diff options
author | James Bottomley <jejb@mulgrave.(none)> | 2005-04-24 03:38:05 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-05-20 13:53:34 -0400 |
commit | 47b5d69c4aa753fcfc9b2b8d28c0660a1e25c129 (patch) | |
tree | fe7b76c571de6ce105fb0b8917e0fb94a6895f55 /drivers/scsi/FlashPoint.c | |
parent | 7dfaa5f40da87e85b3883b102bbf1bf3f3b42534 (diff) |
[SCSI] drivers/scsi/FlashPoint.c: cleanups
From: Adrian Bunk <bunk@stusta.de>
This patch contains cleanups including the following:
- remove #ifdef'ed code for other OS's
- remove other unused code
- make needlessly global code static
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/FlashPoint.c')
-rw-r--r-- | drivers/scsi/FlashPoint.c | 5676 |
1 files changed, 875 insertions, 4801 deletions
diff --git a/drivers/scsi/FlashPoint.c b/drivers/scsi/FlashPoint.c index 56a695c6ab52..5beed4f6d985 100644 --- a/drivers/scsi/FlashPoint.c +++ b/drivers/scsi/FlashPoint.c | |||
@@ -22,8 +22,6 @@ | |||
22 | #ifndef CONFIG_SCSI_OMIT_FLASHPOINT | 22 | #ifndef CONFIG_SCSI_OMIT_FLASHPOINT |
23 | 23 | ||
24 | 24 | ||
25 | #define UNIX | ||
26 | #define FW_TYPE _SCCB_MGR_ | ||
27 | #define MAX_CARDS 8 | 25 | #define MAX_CARDS 8 |
28 | #undef BUSTYPE_PCI | 26 | #undef BUSTYPE_PCI |
29 | 27 | ||
@@ -34,8 +32,6 @@ | |||
34 | #define OS_OutPortByte(port, value) outb(value, port) | 32 | #define OS_OutPortByte(port, value) outb(value, port) |
35 | #define OS_OutPortWord(port, value) outw(value, port) | 33 | #define OS_OutPortWord(port, value) outw(value, port) |
36 | #define OS_OutPortLong(port, value) outl(value, port) | 34 | #define OS_OutPortLong(port, value) outl(value, port) |
37 | #define OS_Lock(x) | ||
38 | #define OS_UnLock(x) | ||
39 | 35 | ||
40 | 36 | ||
41 | /* | 37 | /* |
@@ -51,164 +47,17 @@ | |||
51 | #define SccbMgr_isr FlashPoint_HandleInterrupt | 47 | #define SccbMgr_isr FlashPoint_HandleInterrupt |
52 | 48 | ||
53 | 49 | ||
54 | /* | ||
55 | Define name replacements to avoid kernel namespace pollution. | ||
56 | */ | ||
57 | |||
58 | #define BL_Card FPT_BL_Card | ||
59 | #define BusMasterInit FPT_BusMasterInit | ||
60 | #define CalcCrc16 FPT_CalcCrc16 | ||
61 | #define CalcLrc FPT_CalcLrc | ||
62 | #define ChkIfChipInitialized FPT_ChkIfChipInitialized | ||
63 | #define DiagBusMaster FPT_DiagBusMaster | ||
64 | #define DiagEEPROM FPT_DiagEEPROM | ||
65 | #define DiagXbow FPT_DiagXbow | ||
66 | #define GetTarLun FPT_GetTarLun | ||
67 | #define RNVRamData FPT_RNVRamData | ||
68 | #define RdStack FPT_RdStack | ||
69 | #define SccbMgrTableInitAll FPT_SccbMgrTableInitAll | ||
70 | #define SccbMgrTableInitCard FPT_SccbMgrTableInitCard | ||
71 | #define SccbMgrTableInitTarget FPT_SccbMgrTableInitTarget | ||
72 | #define SccbMgr_bad_isr FPT_SccbMgr_bad_isr | ||
73 | #define SccbMgr_scsi_reset FPT_SccbMgr_scsi_reset | ||
74 | #define SccbMgr_timer_expired FPT_SccbMgr_timer_expired | ||
75 | #define SendMsg FPT_SendMsg | ||
76 | #define Wait FPT_Wait | ||
77 | #define Wait1Second FPT_Wait1Second | ||
78 | #define WrStack FPT_WrStack | ||
79 | #define XbowInit FPT_XbowInit | ||
80 | #define autoCmdCmplt FPT_autoCmdCmplt | ||
81 | #define autoLoadDefaultMap FPT_autoLoadDefaultMap | ||
82 | #define busMstrDataXferStart FPT_busMstrDataXferStart | ||
83 | #define busMstrSGDataXferStart FPT_busMstrSGDataXferStart | ||
84 | #define busMstrTimeOut FPT_busMstrTimeOut | ||
85 | #define dataXferProcessor FPT_dataXferProcessor | ||
86 | #define default_intena FPT_default_intena | ||
87 | #define hostDataXferAbort FPT_hostDataXferAbort | ||
88 | #define hostDataXferRestart FPT_hostDataXferRestart | ||
89 | #define inisci FPT_inisci | ||
90 | #define mbCards FPT_mbCards | ||
91 | #define nvRamInfo FPT_nvRamInfo | ||
92 | #define phaseBusFree FPT_phaseBusFree | ||
93 | #define phaseChkFifo FPT_phaseChkFifo | ||
94 | #define phaseCommand FPT_phaseCommand | ||
95 | #define phaseDataIn FPT_phaseDataIn | ||
96 | #define phaseDataOut FPT_phaseDataOut | ||
97 | #define phaseDecode FPT_phaseDecode | ||
98 | #define phaseIllegal FPT_phaseIllegal | ||
99 | #define phaseMsgIn FPT_phaseMsgIn | ||
100 | #define phaseMsgOut FPT_phaseMsgOut | ||
101 | #define phaseStatus FPT_phaseStatus | ||
102 | #define queueAddSccb FPT_queueAddSccb | ||
103 | #define queueCmdComplete FPT_queueCmdComplete | ||
104 | #define queueDisconnect FPT_queueDisconnect | ||
105 | #define queueFindSccb FPT_queueFindSccb | ||
106 | #define queueFlushSccb FPT_queueFlushSccb | ||
107 | #define queueFlushTargSccb FPT_queueFlushTargSccb | ||
108 | #define queueSearchSelect FPT_queueSearchSelect | ||
109 | #define queueSelectFail FPT_queueSelectFail | ||
110 | #define s_PhaseTbl FPT_s_PhaseTbl | ||
111 | #define scamHAString FPT_scamHAString | ||
112 | #define scamInfo FPT_scamInfo | ||
113 | #define scarb FPT_scarb | ||
114 | #define scasid FPT_scasid | ||
115 | #define scbusf FPT_scbusf | ||
116 | #define sccbMgrTbl FPT_sccbMgrTbl | ||
117 | #define schkdd FPT_schkdd | ||
118 | #define scini FPT_scini | ||
119 | #define sciso FPT_sciso | ||
120 | #define scmachid FPT_scmachid | ||
121 | #define scsavdi FPT_scsavdi | ||
122 | #define scsel FPT_scsel | ||
123 | #define scsell FPT_scsell | ||
124 | #define scsendi FPT_scsendi | ||
125 | #define scvalq FPT_scvalq | ||
126 | #define scwirod FPT_scwirod | ||
127 | #define scwiros FPT_scwiros | ||
128 | #define scwtsel FPT_scwtsel | ||
129 | #define scxferc FPT_scxferc | ||
130 | #define sdecm FPT_sdecm | ||
131 | #define sfm FPT_sfm | ||
132 | #define shandem FPT_shandem | ||
133 | #define sinits FPT_sinits | ||
134 | #define sisyncn FPT_sisyncn | ||
135 | #define sisyncr FPT_sisyncr | ||
136 | #define siwidn FPT_siwidn | ||
137 | #define siwidr FPT_siwidr | ||
138 | #define sres FPT_sres | ||
139 | #define sresb FPT_sresb | ||
140 | #define ssel FPT_ssel | ||
141 | #define ssenss FPT_ssenss | ||
142 | #define sssyncv FPT_sssyncv | ||
143 | #define stsyncn FPT_stsyncn | ||
144 | #define stwidn FPT_stwidn | ||
145 | #define sxfrp FPT_sxfrp | ||
146 | #define utilEERead FPT_utilEERead | ||
147 | #define utilEEReadOrg FPT_utilEEReadOrg | ||
148 | #define utilEESendCmdAddr FPT_utilEESendCmdAddr | ||
149 | #define utilEEWrite FPT_utilEEWrite | ||
150 | #define utilEEWriteOnOff FPT_utilEEWriteOnOff | ||
151 | #define utilUpdateResidual FPT_utilUpdateResidual | ||
152 | |||
153 | |||
154 | /*---------------------------------------------------------------------- | ||
155 | * | ||
156 | * | ||
157 | * Copyright 1995-1996 by Mylex Corporation. All Rights Reserved | ||
158 | * | ||
159 | * This file is available under both the GNU General Public License | ||
160 | * and a BSD-style copyright; see LICENSE.FlashPoint for details. | ||
161 | * | ||
162 | * $Workfile: globals.h $ | ||
163 | * | ||
164 | * Description: Common shared global defines. | ||
165 | * | ||
166 | * $Date: 1996/09/04 01:26:13 $ | ||
167 | * | ||
168 | * $Revision: 1.11 $ | ||
169 | * | ||
170 | *----------------------------------------------------------------------*/ | ||
171 | #ifndef __GLOBALS_H__ | ||
172 | #define __GLOBALS_H__ | ||
173 | |||
174 | #define _UCB_MGR_ 1 | ||
175 | #define _SCCB_MGR_ 2 | ||
176 | |||
177 | /*#include <osflags.h>*/ | ||
178 | |||
179 | #define MAX_CDBLEN 12 | 50 | #define MAX_CDBLEN 12 |
180 | 51 | ||
181 | #define SCAM_LEV_2 1 | 52 | #define SCAM_LEV_2 1 |
182 | 53 | ||
183 | #define CRCMASK 0xA001 | 54 | #define CRCMASK 0xA001 |
184 | 55 | ||
185 | /* In your osflags.h file, please ENSURE that only ONE OS FLAG | ||
186 | is on at a time !!! Also, please make sure you turn set the | ||
187 | variable FW_TYPE to either _UCB_MGR_ or _SCCB_MGR_ !!! */ | ||
188 | |||
189 | #if defined(DOS) || defined(WIN95_16) || defined(OS2) || defined(OTHER_16) | ||
190 | #define COMPILER_16_BIT 1 | ||
191 | #elif defined(NETWARE) || defined(NT) || defined(WIN95_32) || defined(UNIX) || defined(OTHER_32) || defined(SOLARIS_REAL_MODE) | ||
192 | #define COMPILER_32_BIT 1 | ||
193 | #endif | ||
194 | |||
195 | |||
196 | #define BL_VENDOR_ID 0x104B | 56 | #define BL_VENDOR_ID 0x104B |
197 | #define FP_DEVICE_ID 0x8130 | 57 | #define FP_DEVICE_ID 0x8130 |
198 | #define MM_DEVICE_ID 0x1040 | 58 | #define MM_DEVICE_ID 0x1040 |
199 | 59 | ||
200 | 60 | ||
201 | #ifndef FALSE | ||
202 | #define FALSE 0 | ||
203 | #endif | ||
204 | #ifndef TRUE | ||
205 | #define TRUE (!(FALSE)) | ||
206 | #endif | ||
207 | |||
208 | #ifndef NULL | ||
209 | #define NULL 0 | ||
210 | #endif | ||
211 | |||
212 | #define FAILURE 0xFFFFFFFFL | 61 | #define FAILURE 0xFFFFFFFFL |
213 | 62 | ||
214 | 63 | ||
@@ -222,27 +71,11 @@ typedef unsigned long * PULONG; | |||
222 | typedef void * PVOID; | 71 | typedef void * PVOID; |
223 | 72 | ||
224 | 73 | ||
225 | #if defined(COMPILER_16_BIT) | ||
226 | typedef unsigned char far * uchar_ptr; | ||
227 | typedef unsigned short far * ushort_ptr; | ||
228 | typedef unsigned long far * ulong_ptr; | ||
229 | #endif /* 16_BIT_COMPILER */ | ||
230 | |||
231 | #if defined(COMPILER_32_BIT) | ||
232 | typedef unsigned char * uchar_ptr; | 74 | typedef unsigned char * uchar_ptr; |
233 | typedef unsigned short * ushort_ptr; | 75 | typedef unsigned short * ushort_ptr; |
234 | typedef unsigned long * ulong_ptr; | 76 | typedef unsigned long * ulong_ptr; |
235 | #endif /* 32_BIT_COMPILER */ | ||
236 | 77 | ||
237 | 78 | ||
238 | /* NEW TYPE DEFINITIONS (shared with Mylex North) | ||
239 | |||
240 | ** Use following type defines to avoid confusion in 16 and 32-bit | ||
241 | ** environments. Avoid using 'int' as it denotes 16 bits in 16-bit | ||
242 | ** environment and 32 in 32-bit environments. | ||
243 | |||
244 | */ | ||
245 | |||
246 | #define s08bits char | 79 | #define s08bits char |
247 | #define s16bits short | 80 | #define s16bits short |
248 | #define s32bits long | 81 | #define s32bits long |
@@ -251,195 +84,19 @@ typedef unsigned long * ulong_ptr; | |||
251 | #define u16bits unsigned s16bits | 84 | #define u16bits unsigned s16bits |
252 | #define u32bits unsigned s32bits | 85 | #define u32bits unsigned s32bits |
253 | 86 | ||
254 | #if defined(COMPILER_16_BIT) | ||
255 | |||
256 | typedef u08bits far * pu08bits; | ||
257 | typedef u16bits far * pu16bits; | ||
258 | typedef u32bits far * pu32bits; | ||
259 | |||
260 | #endif /* COMPILER_16_BIT */ | ||
261 | |||
262 | #if defined(COMPILER_32_BIT) | ||
263 | |||
264 | typedef u08bits * pu08bits; | 87 | typedef u08bits * pu08bits; |
265 | typedef u16bits * pu16bits; | 88 | typedef u16bits * pu16bits; |
266 | typedef u32bits * pu32bits; | 89 | typedef u32bits * pu32bits; |
267 | 90 | ||
268 | #endif /* COMPILER_32_BIT */ | ||
269 | |||
270 | 91 | ||
271 | #define BIT(x) ((UCHAR)(1<<(x))) /* single-bit mask in bit position x */ | 92 | #define BIT(x) ((UCHAR)(1<<(x))) /* single-bit mask in bit position x */ |
272 | #define BITW(x) ((USHORT)(1<<(x))) /* single-bit mask in bit position x */ | 93 | #define BITW(x) ((USHORT)(1<<(x))) /* single-bit mask in bit position x */ |
273 | 94 | ||
274 | 95 | ||
275 | 96 | ||
276 | #if defined(DOS) | ||
277 | /*#include <dos.h>*/ | ||
278 | #undef inportb /* undefine for Borland Lib */ | ||
279 | #undef inport /* they may have define I/O function in LIB */ | ||
280 | #undef outportb | ||
281 | #undef outport | ||
282 | |||
283 | #define OS_InPortByte(ioport) inportb(ioport) | ||
284 | #define OS_InPortWord(ioport) inport(ioport) | ||
285 | #define OS_InPortLong(ioport) inportq(ioport, val) | ||
286 | #define OS_OutPortByte(ioport, val) outportb(ioport, val) | ||
287 | #define OS_OutPortWord(ioport, val) outport(ioport, val) | ||
288 | #define OS_OutPortLong(ioport) outportq(ioport, val) | ||
289 | #endif /* DOS */ | ||
290 | |||
291 | #if defined(NETWARE) || defined(OTHER_32) || defined(OTHER_16) | ||
292 | extern u08bits OS_InPortByte(u32bits ioport); | ||
293 | extern u16bits OS_InPortWord(u32bits ioport); | ||
294 | extern u32bits OS_InPortLong(u32bits ioport); | ||
295 | |||
296 | extern OS_InPortByteBuffer(u32bits ioport, pu08bits buffer, u32bits count); | ||
297 | extern OS_InPortWordBuffer(u32bits ioport, pu16bits buffer, u32bits count); | ||
298 | extern OS_OutPortByte(u32bits ioport, u08bits val); | ||
299 | extern OS_OutPortWord(u32bits ioport, u16bits val); | ||
300 | extern OS_OutPortLong(u32bits ioport, u32bits val); | ||
301 | extern OS_OutPortByteBuffer(u32bits ioport, pu08bits buffer, u32bits count); | ||
302 | extern OS_OutPortWordBuffer(u32bits ioport, pu16bits buffer, u32bits count); | ||
303 | #endif /* NETWARE || OTHER_32 || OTHER_16 */ | ||
304 | |||
305 | #if defined (NT) || defined(WIN95_32) || defined(WIN95_16) | ||
306 | #if defined(NT) | ||
307 | |||
308 | extern __declspec(dllimport) u08bits ScsiPortReadPortUchar(pu08bits ioport); | ||
309 | extern __declspec(dllimport) u16bits ScsiPortReadPortUshort(pu16bits ioport); | ||
310 | extern __declspec(dllimport) u32bits ScsiPortReadPortUlong(pu32bits ioport); | ||
311 | extern __declspec(dllimport) void ScsiPortWritePortUchar(pu08bits ioport, u08bits val); | ||
312 | extern __declspec(dllimport) void ScsiPortWritePortUshort(pu16bits port, u16bits val); | ||
313 | extern __declspec(dllimport) void ScsiPortWritePortUlong(pu32bits port, u32bits val); | ||
314 | |||
315 | #else | ||
316 | |||
317 | extern u08bits ScsiPortReadPortUchar(pu08bits ioport); | ||
318 | extern u16bits ScsiPortReadPortUshort(pu16bits ioport); | ||
319 | extern u32bits ScsiPortReadPortUlong(pu32bits ioport); | ||
320 | extern void ScsiPortWritePortUchar(pu08bits ioport, u08bits val); | ||
321 | extern void ScsiPortWritePortUshort(pu16bits port, u16bits val); | ||
322 | extern void ScsiPortWritePortUlong(pu32bits port, u32bits val); | ||
323 | #endif | ||
324 | 97 | ||
325 | 98 | typedef struct _SCCB *PSCCB; | |
326 | #define OS_InPortByte(ioport) ScsiPortReadPortUchar((pu08bits) ioport) | 99 | typedef void (*CALL_BK_FN)(PSCCB); |
327 | #define OS_InPortWord(ioport) ScsiPortReadPortUshort((pu16bits) ioport) | ||
328 | #define OS_InPortLong(ioport) ScsiPortReadPortUlong((pu32bits) ioport) | ||
329 | |||
330 | #define OS_OutPortByte(ioport, val) ScsiPortWritePortUchar((pu08bits) ioport, (u08bits) val) | ||
331 | #define OS_OutPortWord(ioport, val) ScsiPortWritePortUshort((pu16bits) ioport, (u16bits) val) | ||
332 | #define OS_OutPortLong(ioport, val) ScsiPortWritePortUlong((pu32bits) ioport, (u32bits) val) | ||
333 | #define OS_OutPortByteBuffer(ioport, buffer, count) \ | ||
334 | ScsiPortWritePortBufferUchar((pu08bits)&port, (pu08bits) buffer, (u32bits) count) | ||
335 | #define OS_OutPortWordBuffer(ioport, buffer, count) \ | ||
336 | ScsiPortWritePortBufferUshort((pu16bits)&port, (pu16bits) buffer, (u32bits) count) | ||
337 | |||
338 | #define OS_Lock(x) | ||
339 | #define OS_UnLock(x) | ||
340 | #endif /* NT || WIN95_32 || WIN95_16 */ | ||
341 | |||
342 | #if defined (UNIX) && !defined(OS_InPortByte) | ||
343 | #define OS_InPortByte(ioport) inb((u16bits)ioport) | ||
344 | #define OS_InPortWord(ioport) inw((u16bits)ioport) | ||
345 | #define OS_InPortLong(ioport) inl((u16bits)ioport) | ||
346 | #define OS_OutPortByte(ioport,val) outb((u16bits)ioport, (u08bits)val) | ||
347 | #define OS_OutPortWord(ioport,val) outw((u16bits)ioport, (u16bits)val) | ||
348 | #define OS_OutPortLong(ioport,val) outl((u16bits)ioport, (u32bits)val) | ||
349 | |||
350 | #define OS_Lock(x) | ||
351 | #define OS_UnLock(x) | ||
352 | #endif /* UNIX */ | ||
353 | |||
354 | |||
355 | #if defined(OS2) | ||
356 | extern u08bits inb(u32bits ioport); | ||
357 | extern u16bits inw(u32bits ioport); | ||
358 | extern void outb(u32bits ioport, u08bits val); | ||
359 | extern void outw(u32bits ioport, u16bits val); | ||
360 | |||
361 | #define OS_InPortByte(ioport) inb(ioport) | ||
362 | #define OS_InPortWord(ioport) inw(ioport) | ||
363 | #define OS_OutPortByte(ioport, val) outb(ioport, val) | ||
364 | #define OS_OutPortWord(ioport, val) outw(ioport, val) | ||
365 | extern u32bits OS_InPortLong(u32bits ioport); | ||
366 | extern void OS_OutPortLong(u32bits ioport, u32bits val); | ||
367 | |||
368 | #define OS_Lock(x) | ||
369 | #define OS_UnLock(x) | ||
370 | #endif /* OS2 */ | ||
371 | |||
372 | #if defined(SOLARIS_REAL_MODE) | ||
373 | |||
374 | extern unsigned char inb(unsigned long ioport); | ||
375 | extern unsigned short inw(unsigned long ioport); | ||
376 | |||
377 | #define OS_InPortByte(ioport) inb(ioport) | ||
378 | #define OS_InPortWord(ioport) inw(ioport) | ||
379 | |||
380 | extern void OS_OutPortByte(unsigned long ioport, unsigned char val); | ||
381 | extern void OS_OutPortWord(unsigned long ioport, unsigned short val); | ||
382 | extern unsigned long OS_InPortLong(unsigned long ioport); | ||
383 | extern void OS_OutPortLong(unsigned long ioport, unsigned long val); | ||
384 | |||
385 | #define OS_Lock(x) | ||
386 | #define OS_UnLock(x) | ||
387 | |||
388 | #endif /* SOLARIS_REAL_MODE */ | ||
389 | |||
390 | #endif /* __GLOBALS_H__ */ | ||
391 | |||
392 | /*---------------------------------------------------------------------- | ||
393 | * | ||
394 | * | ||
395 | * Copyright 1995-1996 by Mylex Corporation. All Rights Reserved | ||
396 | * | ||
397 | * This file is available under both the GNU General Public License | ||
398 | * and a BSD-style copyright; see LICENSE.FlashPoint for details. | ||
399 | * | ||
400 | * $Workfile: sccbmgr.h $ | ||
401 | * | ||
402 | * Description: Common shared SCCB Interface defines and SCCB | ||
403 | * Manager specifics defines. | ||
404 | * | ||
405 | * $Date: 1996/10/24 23:09:33 $ | ||
406 | * | ||
407 | * $Revision: 1.14 $ | ||
408 | * | ||
409 | *----------------------------------------------------------------------*/ | ||
410 | |||
411 | #ifndef __SCCB_H__ | ||
412 | #define __SCCB_H__ | ||
413 | |||
414 | /*#include <osflags.h>*/ | ||
415 | /*#include <globals.h>*/ | ||
416 | |||
417 | #if defined(BUGBUG) | ||
418 | #define debug_size 32 | ||
419 | #endif | ||
420 | |||
421 | #if defined(DOS) | ||
422 | |||
423 | typedef struct _SCCB near *PSCCB; | ||
424 | #if (FW_TYPE == _SCCB_MGR_) | ||
425 | typedef void (*CALL_BK_FN)(PSCCB); | ||
426 | #endif | ||
427 | |||
428 | #elif defined(OS2) | ||
429 | |||
430 | typedef struct _SCCB far *PSCCB; | ||
431 | #if (FW_TYPE == _SCCB_MGR_) | ||
432 | typedef void (far *CALL_BK_FN)(PSCCB); | ||
433 | #endif | ||
434 | |||
435 | #else | ||
436 | |||
437 | typedef struct _SCCB *PSCCB; | ||
438 | #if (FW_TYPE == _SCCB_MGR_) | ||
439 | typedef void (*CALL_BK_FN)(PSCCB); | ||
440 | #endif | ||
441 | |||
442 | #endif | ||
443 | 100 | ||
444 | 101 | ||
445 | typedef struct SCCBMgr_info { | 102 | typedef struct SCCBMgr_info { |
@@ -466,25 +123,13 @@ typedef struct SCCBMgr_info { | |||
466 | ULONG si_secondary_range; | 123 | ULONG si_secondary_range; |
467 | } SCCBMGR_INFO; | 124 | } SCCBMGR_INFO; |
468 | 125 | ||
469 | #if defined(DOS) | 126 | typedef SCCBMGR_INFO * PSCCBMGR_INFO; |
470 | typedef SCCBMGR_INFO * PSCCBMGR_INFO; | ||
471 | #else | ||
472 | #if defined (COMPILER_16_BIT) | ||
473 | typedef SCCBMGR_INFO far * PSCCBMGR_INFO; | ||
474 | #else | ||
475 | typedef SCCBMGR_INFO * PSCCBMGR_INFO; | ||
476 | #endif | ||
477 | #endif // defined(DOS) | ||
478 | 127 | ||
479 | 128 | ||
480 | 129 | #define SCSI_PARITY_ENA 0x0001 | |
481 | 130 | #define LOW_BYTE_TERM 0x0010 | |
482 | #if (FW_TYPE==_SCCB_MGR_) | 131 | #define HIGH_BYTE_TERM 0x0020 |
483 | #define SCSI_PARITY_ENA 0x0001 | 132 | #define BUSTYPE_PCI 0x3 |
484 | #define LOW_BYTE_TERM 0x0010 | ||
485 | #define HIGH_BYTE_TERM 0x0020 | ||
486 | #define BUSTYPE_PCI 0x3 | ||
487 | #endif | ||
488 | 133 | ||
489 | #define SUPPORT_16TAR_32LUN 0x0002 | 134 | #define SUPPORT_16TAR_32LUN 0x0002 |
490 | #define SOFT_RESET 0x0004 | 135 | #define SOFT_RESET 0x0004 |
@@ -553,9 +198,6 @@ typedef struct _SCCB { | |||
553 | UCHAR Save_CdbLen; | 198 | UCHAR Save_CdbLen; |
554 | UCHAR Sccb_XferState; | 199 | UCHAR Sccb_XferState; |
555 | ULONG Sccb_SGoffset; | 200 | ULONG Sccb_SGoffset; |
556 | #if (FW_TYPE == _UCB_MGR_) | ||
557 | PUCB Sccb_ucb_ptr; | ||
558 | #endif | ||
559 | } SCCB; | 201 | } SCCB; |
560 | 202 | ||
561 | #define SCCB_SIZE sizeof(SCCB) | 203 | #define SCCB_SIZE sizeof(SCCB) |
@@ -626,25 +268,9 @@ typedef struct _SCCB { | |||
626 | 268 | ||
627 | 269 | ||
628 | 270 | ||
629 | #if (FW_TYPE==_UCB_MGR_) | 271 | #define SCCB_INVALID_DIRECTION 0x18 /* Invalid target direction */ |
630 | #define HBA_AUTO_SENSE_FAIL 0x1B | 272 | #define SCCB_DUPLICATE_SCCB 0x19 /* Duplicate SCCB */ |
631 | #define HBA_TQ_REJECTED 0x1C | 273 | #define SCCB_SCSI_RST 0x35 /* SCSI RESET detected. */ |
632 | #define HBA_UNSUPPORTED_MSG 0x1D | ||
633 | #define HBA_HW_ERROR 0x20 | ||
634 | #define HBA_ATN_NOT_RESPONDED 0x21 | ||
635 | #define HBA_SCSI_RESET_BY_ADAPTER 0x22 | ||
636 | #define HBA_SCSI_RESET_BY_TARGET 0x23 | ||
637 | #define HBA_WRONG_CONNECTION 0x24 | ||
638 | #define HBA_BUS_DEVICE_RESET 0x25 | ||
639 | #define HBA_ABORT_QUEUE 0x26 | ||
640 | |||
641 | #else // these are not defined in BUDI/UCB | ||
642 | |||
643 | #define SCCB_INVALID_DIRECTION 0x18 /* Invalid target direction */ | ||
644 | #define SCCB_DUPLICATE_SCCB 0x19 /* Duplicate SCCB */ | ||
645 | #define SCCB_SCSI_RST 0x35 /* SCSI RESET detected. */ | ||
646 | |||
647 | #endif // (FW_TYPE==_UCB_MGR_) | ||
648 | 274 | ||
649 | 275 | ||
650 | #define SCCB_IN_PROCESS 0x00 | 276 | #define SCCB_IN_PROCESS 0x00 |
@@ -657,115 +283,20 @@ typedef struct _SCCB { | |||
657 | #define SCCB_SIZE sizeof(SCCB) | 283 | #define SCCB_SIZE sizeof(SCCB) |
658 | 284 | ||
659 | 285 | ||
660 | |||
661 | |||
662 | #if (FW_TYPE == _UCB_MGR_) | ||
663 | void SccbMgr_start_sccb(CARD_HANDLE pCurrCard, PUCB p_ucb); | ||
664 | s32bits SccbMgr_abort_sccb(CARD_HANDLE pCurrCard, PUCB p_ucb); | ||
665 | u08bits SccbMgr_my_int(CARD_HANDLE pCurrCard); | ||
666 | s32bits SccbMgr_isr(CARD_HANDLE pCurrCard); | ||
667 | void SccbMgr_scsi_reset(CARD_HANDLE pCurrCard); | ||
668 | void SccbMgr_timer_expired(CARD_HANDLE pCurrCard); | ||
669 | void SccbMgr_unload_card(CARD_HANDLE pCurrCard); | ||
670 | void SccbMgr_restore_foreign_state(CARD_HANDLE pCurrCard); | ||
671 | void SccbMgr_restore_native_state(CARD_HANDLE pCurrCard); | ||
672 | void SccbMgr_save_foreign_state(PADAPTER_INFO pAdapterInfo); | ||
673 | |||
674 | #endif | ||
675 | |||
676 | |||
677 | #if (FW_TYPE == _SCCB_MGR_) | ||
678 | |||
679 | #if defined (DOS) | ||
680 | int SccbMgr_sense_adapter(PSCCBMGR_INFO pCardInfo); | ||
681 | USHORT SccbMgr_config_adapter(PSCCBMGR_INFO pCardInfo); | ||
682 | void SccbMgr_start_sccb(USHORT pCurrCard, PSCCB p_SCCB); | ||
683 | int SccbMgr_abort_sccb(USHORT pCurrCard, PSCCB p_SCCB); | ||
684 | UCHAR SccbMgr_my_int(USHORT pCurrCard); | ||
685 | int SccbMgr_isr(USHORT pCurrCard); | ||
686 | void SccbMgr_scsi_reset(USHORT pCurrCard); | ||
687 | void SccbMgr_timer_expired(USHORT pCurrCard); | ||
688 | USHORT SccbMgr_status(USHORT pCurrCard); | ||
689 | void SccbMgr_unload_card(USHORT pCurrCard); | ||
690 | |||
691 | #else //non-DOS | ||
692 | |||
693 | int SccbMgr_sense_adapter(PSCCBMGR_INFO pCardInfo); | ||
694 | ULONG SccbMgr_config_adapter(PSCCBMGR_INFO pCardInfo); | ||
695 | void SccbMgr_start_sccb(ULONG pCurrCard, PSCCB p_SCCB); | ||
696 | int SccbMgr_abort_sccb(ULONG pCurrCard, PSCCB p_SCCB); | ||
697 | UCHAR SccbMgr_my_int(ULONG pCurrCard); | ||
698 | int SccbMgr_isr(ULONG pCurrCard); | ||
699 | void SccbMgr_scsi_reset(ULONG pCurrCard); | ||
700 | void SccbMgr_enable_int(ULONG pCurrCard); | ||
701 | void SccbMgr_disable_int(ULONG pCurrCard); | ||
702 | void SccbMgr_timer_expired(ULONG pCurrCard); | ||
703 | void SccbMgr_unload_card(ULONG pCurrCard); | ||
704 | |||
705 | #endif | ||
706 | #endif // (FW_TYPE == _SCCB_MGR_) | ||
707 | |||
708 | #endif /* __SCCB_H__ */ | ||
709 | |||
710 | /*---------------------------------------------------------------------- | ||
711 | * | ||
712 | * | ||
713 | * Copyright 1995-1996 by Mylex Corporation. All Rights Reserved | ||
714 | * | ||
715 | * This file is available under both the GNU General Public License | ||
716 | * and a BSD-style copyright; see LICENSE.FlashPoint for details. | ||
717 | * | ||
718 | * $Workfile: blx30.h $ | ||
719 | * | ||
720 | * Description: This module contains SCCB/UCB Manager implementation | ||
721 | * specific stuff. | ||
722 | * | ||
723 | * $Date: 1996/11/13 18:34:22 $ | ||
724 | * | ||
725 | * $Revision: 1.10 $ | ||
726 | * | ||
727 | *----------------------------------------------------------------------*/ | ||
728 | |||
729 | |||
730 | #ifndef __blx30_H__ | ||
731 | #define __blx30_H__ | ||
732 | |||
733 | /*#include <globals.h>*/ | ||
734 | |||
735 | #define ORION_FW_REV 3110 | 286 | #define ORION_FW_REV 3110 |
736 | 287 | ||
737 | |||
738 | |||
739 | |||
740 | #define HARP_REVD 1 | 288 | #define HARP_REVD 1 |
741 | 289 | ||
742 | 290 | ||
743 | #if defined(DOS) | ||
744 | #define QUEUE_DEPTH 8+1 /*1 for Normal disconnect 0 for Q'ing. */ | ||
745 | #else | ||
746 | #define QUEUE_DEPTH 254+1 /*1 for Normal disconnect 32 for Q'ing. */ | 291 | #define QUEUE_DEPTH 254+1 /*1 for Normal disconnect 32 for Q'ing. */ |
747 | #endif // defined(DOS) | ||
748 | 292 | ||
749 | #define MAX_MB_CARDS 4 /* Max. no of cards suppoerted on Mother Board */ | 293 | #define MAX_MB_CARDS 4 /* Max. no of cards suppoerted on Mother Board */ |
750 | 294 | ||
751 | #define WIDE_SCSI 1 | 295 | #define WIDE_SCSI 1 |
752 | 296 | ||
753 | #if defined(WIDE_SCSI) | 297 | #define MAX_SCSI_TAR 16 |
754 | #if defined(DOS) | 298 | #define MAX_LUN 32 |
755 | #define MAX_SCSI_TAR 16 | 299 | #define LUN_MASK 0x1f |
756 | #define MAX_LUN 8 | ||
757 | #define LUN_MASK 0x07 | ||
758 | #else | ||
759 | #define MAX_SCSI_TAR 16 | ||
760 | #define MAX_LUN 32 | ||
761 | #define LUN_MASK 0x1f | ||
762 | |||
763 | #endif | ||
764 | #else | ||
765 | #define MAX_SCSI_TAR 8 | ||
766 | #define MAX_LUN 8 | ||
767 | #define LUN_MASK 0x07 | ||
768 | #endif | ||
769 | 300 | ||
770 | #if defined(HARP_REVA) | 301 | #if defined(HARP_REVA) |
771 | #define SG_BUF_CNT 15 /*Number of prefetched elements. */ | 302 | #define SG_BUF_CNT 15 /*Number of prefetched elements. */ |
@@ -778,116 +309,12 @@ typedef struct _SCCB { | |||
778 | #define SG_ELEMENT_MASK 0xFFFFFFFFL | 309 | #define SG_ELEMENT_MASK 0xFFFFFFFFL |
779 | 310 | ||
780 | 311 | ||
781 | #if (FW_TYPE == _UCB_MGR_) | 312 | #define RD_HARPOON(ioport) OS_InPortByte((u32bits)ioport) |
782 | #define OPC_DECODE_NORMAL 0x0f7f | 313 | #define RDW_HARPOON(ioport) OS_InPortWord((u32bits)ioport) |
783 | #endif // _UCB_MGR_ | 314 | #define RD_HARP32(ioport,offset,data) (data = OS_InPortLong((u32bits)(ioport + offset))) |
784 | 315 | #define WR_HARPOON(ioport,val) OS_OutPortByte((u32bits)ioport,(u08bits) val) | |
785 | 316 | #define WRW_HARPOON(ioport,val) OS_OutPortWord((u32bits)ioport,(u16bits)val) | |
786 | 317 | #define WR_HARP32(ioport,offset,data) OS_OutPortLong((u32bits)(ioport + offset), data) | |
787 | #if defined(DOS) | ||
788 | |||
789 | /*#include <dos.h>*/ | ||
790 | #define RD_HARPOON(ioport) (OS_InPortByte(ioport)) | ||
791 | #define RDW_HARPOON(ioport) (OS_InPortWord(ioport)) | ||
792 | #define WR_HARPOON(ioport,val) (OS_OutPortByte(ioport,val)) | ||
793 | #define WRW_HARPOON(ioport,val) (OS_OutPortWord(ioport,val)) | ||
794 | |||
795 | #define RD_HARP32(port,offset,data) asm{db 66h; \ | ||
796 | push ax; \ | ||
797 | mov dx,port; \ | ||
798 | add dx, offset; \ | ||
799 | db 66h; \ | ||
800 | in ax,dx; \ | ||
801 | db 66h; \ | ||
802 | mov word ptr data,ax;\ | ||
803 | db 66h; \ | ||
804 | pop ax} | ||
805 | |||
806 | #define WR_HARP32(port,offset,data) asm{db 66h; \ | ||
807 | push ax; \ | ||
808 | mov dx,port; \ | ||
809 | add dx, offset; \ | ||
810 | db 66h; \ | ||
811 | mov ax,word ptr data;\ | ||
812 | db 66h; \ | ||
813 | out dx,ax; \ | ||
814 | db 66h; \ | ||
815 | pop ax} | ||
816 | #endif /* DOS */ | ||
817 | |||
818 | #if defined(NETWARE) || defined(OTHER_32) || defined(OTHER_16) | ||
819 | #define RD_HARPOON(ioport) OS_InPortByte((unsigned long)ioport) | ||
820 | #define RDW_HARPOON(ioport) OS_InPortWord((unsigned long)ioport) | ||
821 | #define RD_HARP32(ioport,offset,data) (data = OS_InPortLong(ioport + offset)) | ||
822 | #define WR_HARPOON(ioport,val) OS_OutPortByte((ULONG)ioport,(UCHAR) val) | ||
823 | #define WRW_HARPOON(ioport,val) OS_OutPortWord((ULONG)ioport,(USHORT)val) | ||
824 | #define WR_HARP32(ioport,offset,data) OS_OutPortLong((ioport + offset), data) | ||
825 | #endif /* NETWARE || OTHER_32 || OTHER_16 */ | ||
826 | |||
827 | #if defined(NT) || defined(WIN95_32) || defined(WIN95_16) | ||
828 | #define RD_HARPOON(ioport) OS_InPortByte((ULONG)ioport) | ||
829 | #define RDW_HARPOON(ioport) OS_InPortWord((ULONG)ioport) | ||
830 | #define RD_HARP32(ioport,offset,data) (data = OS_InPortLong((ULONG)(ioport + offset))) | ||
831 | #define WR_HARPOON(ioport,val) OS_OutPortByte((ULONG)ioport,(UCHAR) val) | ||
832 | #define WRW_HARPOON(ioport,val) OS_OutPortWord((ULONG)ioport,(USHORT)val) | ||
833 | #define WR_HARP32(ioport,offset,data) OS_OutPortLong((ULONG)(ioport + offset), data) | ||
834 | #endif /* NT || WIN95_32 || WIN95_16 */ | ||
835 | |||
836 | #if defined (UNIX) | ||
837 | #define RD_HARPOON(ioport) OS_InPortByte((u32bits)ioport) | ||
838 | #define RDW_HARPOON(ioport) OS_InPortWord((u32bits)ioport) | ||
839 | #define RD_HARP32(ioport,offset,data) (data = OS_InPortLong((u32bits)(ioport + offset))) | ||
840 | #define WR_HARPOON(ioport,val) OS_OutPortByte((u32bits)ioport,(u08bits) val) | ||
841 | #define WRW_HARPOON(ioport,val) OS_OutPortWord((u32bits)ioport,(u16bits)val) | ||
842 | #define WR_HARP32(ioport,offset,data) OS_OutPortLong((u32bits)(ioport + offset), data) | ||
843 | #endif /* UNIX */ | ||
844 | |||
845 | #if defined(OS2) | ||
846 | #define RD_HARPOON(ioport) OS_InPortByte((unsigned long)ioport) | ||
847 | #define RDW_HARPOON(ioport) OS_InPortWord((unsigned long)ioport) | ||
848 | #define RD_HARP32(ioport,offset,data) (data = OS_InPortLong((ULONG)(ioport + offset))) | ||
849 | #define WR_HARPOON(ioport,val) OS_OutPortByte((ULONG)ioport,(UCHAR) val) | ||
850 | #define WRW_HARPOON(ioport,val) OS_OutPortWord((ULONG)ioport,(USHORT)val) | ||
851 | #define WR_HARP32(ioport,offset,data) OS_OutPortLong(((ULONG)(ioport + offset)), data) | ||
852 | #endif /* OS2 */ | ||
853 | |||
854 | #if defined(SOLARIS_REAL_MODE) | ||
855 | |||
856 | #define RD_HARPOON(ioport) OS_InPortByte((unsigned long)ioport) | ||
857 | #define RDW_HARPOON(ioport) OS_InPortWord((unsigned long)ioport) | ||
858 | #define RD_HARP32(ioport,offset,data) (data = OS_InPortLong((ULONG)(ioport + offset))) | ||
859 | #define WR_HARPOON(ioport,val) OS_OutPortByte((ULONG)ioport,(UCHAR) val) | ||
860 | #define WRW_HARPOON(ioport,val) OS_OutPortWord((ULONG)ioport,(USHORT)val) | ||
861 | #define WR_HARP32(ioport,offset,data) OS_OutPortLong((ULONG)(ioport + offset), (ULONG)data) | ||
862 | |||
863 | #endif /* SOLARIS_REAL_MODE */ | ||
864 | |||
865 | #endif /* __BLX30_H__ */ | ||
866 | |||
867 | |||
868 | /*---------------------------------------------------------------------- | ||
869 | * | ||
870 | * | ||
871 | * Copyright 1995-1996 by Mylex Corporation. All Rights Reserved | ||
872 | * | ||
873 | * This file is available under both the GNU General Public License | ||
874 | * and a BSD-style copyright; see LICENSE.FlashPoint for details. | ||
875 | * | ||
876 | * $Workfile: target.h $ | ||
877 | * | ||
878 | * Description: Definitions for Target related structures | ||
879 | * | ||
880 | * $Date: 1996/12/11 22:06:20 $ | ||
881 | * | ||
882 | * $Revision: 1.9 $ | ||
883 | * | ||
884 | *----------------------------------------------------------------------*/ | ||
885 | |||
886 | #ifndef __TARGET__ | ||
887 | #define __TARGET__ | ||
888 | |||
889 | /*#include <globals.h>*/ | ||
890 | /*#include <blx30.h>*/ | ||
891 | 318 | ||
892 | 319 | ||
893 | #define TAR_SYNC_MASK (BIT(7)+BIT(6)) | 320 | #define TAR_SYNC_MASK (BIT(7)+BIT(6)) |
@@ -919,16 +346,7 @@ typedef struct _SCCB { | |||
919 | #define EE_WIDE_SCSI BIT(7) | 346 | #define EE_WIDE_SCSI BIT(7) |
920 | 347 | ||
921 | 348 | ||
922 | #if defined(DOS) | 349 | typedef struct SCCBMgr_tar_info *PSCCBMgr_tar_info; |
923 | typedef struct SCCBMgr_tar_info near *PSCCBMgr_tar_info; | ||
924 | |||
925 | #elif defined(OS2) | ||
926 | typedef struct SCCBMgr_tar_info far *PSCCBMgr_tar_info; | ||
927 | |||
928 | #else | ||
929 | typedef struct SCCBMgr_tar_info *PSCCBMgr_tar_info; | ||
930 | |||
931 | #endif | ||
932 | 350 | ||
933 | 351 | ||
934 | typedef struct SCCBMgr_tar_info { | 352 | typedef struct SCCBMgr_tar_info { |
@@ -949,11 +367,7 @@ typedef struct SCCBMgr_tar_info { | |||
949 | typedef struct NVRAMInfo { | 367 | typedef struct NVRAMInfo { |
950 | UCHAR niModel; /* Model No. of card */ | 368 | UCHAR niModel; /* Model No. of card */ |
951 | UCHAR niCardNo; /* Card no. */ | 369 | UCHAR niCardNo; /* Card no. */ |
952 | #if defined(DOS) | ||
953 | USHORT niBaseAddr; /* Port Address of card */ | ||
954 | #else | ||
955 | ULONG niBaseAddr; /* Port Address of card */ | 370 | ULONG niBaseAddr; /* Port Address of card */ |
956 | #endif | ||
957 | UCHAR niSysConf; /* Adapter Configuration byte - Byte 16 of eeprom map */ | 371 | UCHAR niSysConf; /* Adapter Configuration byte - Byte 16 of eeprom map */ |
958 | UCHAR niScsiConf; /* SCSI Configuration byte - Byte 17 of eeprom map */ | 372 | UCHAR niScsiConf; /* SCSI Configuration byte - Byte 17 of eeprom map */ |
959 | UCHAR niScamConf; /* SCAM Configuration byte - Byte 20 of eeprom map */ | 373 | UCHAR niScamConf; /* SCAM Configuration byte - Byte 20 of eeprom map */ |
@@ -962,13 +376,7 @@ typedef struct NVRAMInfo { | |||
962 | UCHAR niScamTbl[MAX_SCSI_TAR][4]; /* Compressed Scam name string of Targets */ | 376 | UCHAR niScamTbl[MAX_SCSI_TAR][4]; /* Compressed Scam name string of Targets */ |
963 | }NVRAMINFO; | 377 | }NVRAMINFO; |
964 | 378 | ||
965 | #if defined(DOS) | ||
966 | typedef NVRAMINFO near *PNVRamInfo; | ||
967 | #elif defined (OS2) | ||
968 | typedef NVRAMINFO far *PNVRamInfo; | ||
969 | #else | ||
970 | typedef NVRAMINFO *PNVRamInfo; | 379 | typedef NVRAMINFO *PNVRamInfo; |
971 | #endif | ||
972 | 380 | ||
973 | #define MODEL_LT 1 | 381 | #define MODEL_LT 1 |
974 | #define MODEL_DL 2 | 382 | #define MODEL_DL 2 |
@@ -978,17 +386,9 @@ typedef NVRAMINFO *PNVRamInfo; | |||
978 | 386 | ||
979 | typedef struct SCCBcard { | 387 | typedef struct SCCBcard { |
980 | PSCCB currentSCCB; | 388 | PSCCB currentSCCB; |
981 | #if (FW_TYPE==_SCCB_MGR_) | ||
982 | PSCCBMGR_INFO cardInfo; | 389 | PSCCBMGR_INFO cardInfo; |
983 | #else | ||
984 | PADAPTER_INFO cardInfo; | ||
985 | #endif | ||
986 | 390 | ||
987 | #if defined(DOS) | ||
988 | USHORT ioPort; | ||
989 | #else | ||
990 | ULONG ioPort; | 391 | ULONG ioPort; |
991 | #endif | ||
992 | 392 | ||
993 | USHORT cmdCounter; | 393 | USHORT cmdCounter; |
994 | UCHAR discQCount; | 394 | UCHAR discQCount; |
@@ -1002,13 +402,7 @@ typedef struct SCCBcard { | |||
1002 | 402 | ||
1003 | }SCCBCARD; | 403 | }SCCBCARD; |
1004 | 404 | ||
1005 | #if defined(DOS) | ||
1006 | typedef struct SCCBcard near *PSCCBcard; | ||
1007 | #elif defined (OS2) | ||
1008 | typedef struct SCCBcard far *PSCCBcard; | ||
1009 | #else | ||
1010 | typedef struct SCCBcard *PSCCBcard; | 405 | typedef struct SCCBcard *PSCCBcard; |
1011 | #endif | ||
1012 | 406 | ||
1013 | 407 | ||
1014 | #define F_TAG_STARTED 0x01 | 408 | #define F_TAG_STARTED 0x01 |
@@ -1063,29 +457,6 @@ typedef struct SCCBscam_info { | |||
1063 | 457 | ||
1064 | } SCCBSCAM_INFO, *PSCCBSCAM_INFO; | 458 | } SCCBSCAM_INFO, *PSCCBSCAM_INFO; |
1065 | 459 | ||
1066 | #endif | ||
1067 | /*---------------------------------------------------------------------- | ||
1068 | * | ||
1069 | * | ||
1070 | * Copyright 1995-1996 by Mylex Corporation. All Rights Reserved | ||
1071 | * | ||
1072 | * This file is available under both the GNU General Public License | ||
1073 | * and a BSD-style copyright; see LICENSE.FlashPoint for details. | ||
1074 | * | ||
1075 | * $Workfile: scsi2.h $ | ||
1076 | * | ||
1077 | * Description: Register definitions for HARPOON ASIC. | ||
1078 | * | ||
1079 | * $Date: 1996/11/13 18:32:57 $ | ||
1080 | * | ||
1081 | * $Revision: 1.4 $ | ||
1082 | * | ||
1083 | *----------------------------------------------------------------------*/ | ||
1084 | |||
1085 | #ifndef __SCSI_H__ | ||
1086 | #define __SCSI_H__ | ||
1087 | |||
1088 | |||
1089 | 460 | ||
1090 | #define SCSI_TEST_UNIT_READY 0x00 | 461 | #define SCSI_TEST_UNIT_READY 0x00 |
1091 | #define SCSI_REZERO_UNIT 0x01 | 462 | #define SCSI_REZERO_UNIT 0x01 |
@@ -1195,29 +566,6 @@ typedef struct SCCBscam_info { | |||
1195 | #define SYNC5MBS 0x32 | 566 | #define SYNC5MBS 0x32 |
1196 | #define MAX_OFFSET 0x0F /* Maxbyteoffset for Sync Xfers */ | 567 | #define MAX_OFFSET 0x0F /* Maxbyteoffset for Sync Xfers */ |
1197 | 568 | ||
1198 | #endif | ||
1199 | /*---------------------------------------------------------------------- | ||
1200 | * | ||
1201 | * | ||
1202 | * Copyright 1995-1996 by Mylex Corporation. All Rights Reserved | ||
1203 | * | ||
1204 | * This file is available under both the GNU General Public License | ||
1205 | * and a BSD-style copyright; see LICENSE.FlashPoint for details. | ||
1206 | * | ||
1207 | * $Workfile: eeprom.h $ | ||
1208 | * | ||
1209 | * Description: Definitions for EEPROM related structures | ||
1210 | * | ||
1211 | * $Date: 1996/11/13 18:28:39 $ | ||
1212 | * | ||
1213 | * $Revision: 1.4 $ | ||
1214 | * | ||
1215 | *----------------------------------------------------------------------*/ | ||
1216 | |||
1217 | #ifndef __EEPROM__ | ||
1218 | #define __EEPROM__ | ||
1219 | |||
1220 | /*#include <globals.h>*/ | ||
1221 | 569 | ||
1222 | #define EEPROM_WD_CNT 256 | 570 | #define EEPROM_WD_CNT 256 |
1223 | 571 | ||
@@ -1280,31 +628,6 @@ typedef struct SCCBscam_info { | |||
1280 | #define DISC_ENABLE_BIT BIT(6) | 628 | #define DISC_ENABLE_BIT BIT(6) |
1281 | 629 | ||
1282 | 630 | ||
1283 | #endif | ||
1284 | /*---------------------------------------------------------------------- | ||
1285 | * | ||
1286 | * | ||
1287 | * Copyright 1995-1996 by Mylex Corporation. All Rights Reserved | ||
1288 | * | ||
1289 | * This file is available under both the GNU General Public License | ||
1290 | * and a BSD-style copyright; see LICENSE.FlashPoint for details. | ||
1291 | * | ||
1292 | * $Workfile: harpoon.h $ | ||
1293 | * | ||
1294 | * Description: Register definitions for HARPOON ASIC. | ||
1295 | * | ||
1296 | * $Date: 1997/07/09 21:44:36 $ | ||
1297 | * | ||
1298 | * $Revision: 1.9 $ | ||
1299 | * | ||
1300 | *----------------------------------------------------------------------*/ | ||
1301 | |||
1302 | |||
1303 | /*#include <globals.h>*/ | ||
1304 | |||
1305 | #ifndef __HARPOON__ | ||
1306 | #define __HARPOON__ | ||
1307 | |||
1308 | 631 | ||
1309 | #define hp_vendor_id_0 0x00 /* LSB */ | 632 | #define hp_vendor_id_0 0x00 /* LSB */ |
1310 | #define ORION_VEND_0 0x4B | 633 | #define ORION_VEND_0 0x4B |
@@ -1578,8 +901,6 @@ typedef struct SCCBscam_info { | |||
1578 | 901 | ||
1579 | 902 | ||
1580 | 903 | ||
1581 | extern USHORT default_intena; | ||
1582 | |||
1583 | #define hp_intena 0x40 | 904 | #define hp_intena 0x40 |
1584 | 905 | ||
1585 | #define RESET BITW(7) | 906 | #define RESET BITW(7) |
@@ -1972,15 +1293,6 @@ typedef struct SCCBscam_info { | |||
1972 | xfercnt <<= 16,\ | 1293 | xfercnt <<= 16,\ |
1973 | xfercnt |= RDW_HARPOON((USHORT)(port+hp_xfercnt_0))) | 1294 | xfercnt |= RDW_HARPOON((USHORT)(port+hp_xfercnt_0))) |
1974 | */ | 1295 | */ |
1975 | #if defined(DOS) | ||
1976 | #define HP_SETUP_ADDR_CNT(port,addr,count) (WRW_HARPOON((USHORT)(port+hp_host_addr_lo), (USHORT)(addr & 0x0000FFFFL)),\ | ||
1977 | addr >>= 16,\ | ||
1978 | WRW_HARPOON((USHORT)(port+hp_host_addr_hmi), (USHORT)(addr & 0x0000FFFFL)),\ | ||
1979 | WR_HARP32(port,hp_xfercnt_0,count),\ | ||
1980 | WRW_HARPOON((USHORT)(port+hp_xfer_cnt_lo), (USHORT)(count & 0x0000FFFFL)),\ | ||
1981 | count >>= 16,\ | ||
1982 | WR_HARPOON(port+hp_xfer_cnt_hi, (count & 0xFF))) | ||
1983 | #else | ||
1984 | #define HP_SETUP_ADDR_CNT(port,addr,count) (WRW_HARPOON((port+hp_host_addr_lo), (USHORT)(addr & 0x0000FFFFL)),\ | 1296 | #define HP_SETUP_ADDR_CNT(port,addr,count) (WRW_HARPOON((port+hp_host_addr_lo), (USHORT)(addr & 0x0000FFFFL)),\ |
1985 | addr >>= 16,\ | 1297 | addr >>= 16,\ |
1986 | WRW_HARPOON((port+hp_host_addr_hmi), (USHORT)(addr & 0x0000FFFFL)),\ | 1298 | WRW_HARPOON((port+hp_host_addr_hmi), (USHORT)(addr & 0x0000FFFFL)),\ |
@@ -1988,7 +1300,6 @@ typedef struct SCCBscam_info { | |||
1988 | WRW_HARPOON((port+hp_xfer_cnt_lo), (USHORT)(count & 0x0000FFFFL)),\ | 1300 | WRW_HARPOON((port+hp_xfer_cnt_lo), (USHORT)(count & 0x0000FFFFL)),\ |
1989 | count >>= 16,\ | 1301 | count >>= 16,\ |
1990 | WR_HARPOON(port+hp_xfer_cnt_hi, (count & 0xFF))) | 1302 | WR_HARPOON(port+hp_xfer_cnt_hi, (count & 0xFF))) |
1991 | #endif | ||
1992 | 1303 | ||
1993 | #define ACCEPT_MSG(port) {while(RD_HARPOON(port+hp_scsisig) & SCSI_REQ){}\ | 1304 | #define ACCEPT_MSG(port) {while(RD_HARPOON(port+hp_scsisig) & SCSI_REQ){}\ |
1994 | WR_HARPOON(port+hp_scsisig, S_ILL_PH);} | 1305 | WR_HARPOON(port+hp_scsisig, S_ILL_PH);} |
@@ -2020,383 +1331,145 @@ typedef struct SCCBscam_info { | |||
2020 | 1331 | ||
2021 | 1332 | ||
2022 | 1333 | ||
2023 | #endif | ||
2024 | |||
2025 | 1334 | ||
2026 | #if (FW_TYPE==_UCB_MGR_) | ||
2027 | void ReadNVRam(PSCCBcard pCurrCard,PUCB p_ucb); | ||
2028 | void WriteNVRam(PSCCBcard pCurrCard,PUCB p_ucb); | ||
2029 | void UpdateCheckSum(u32bits baseport); | ||
2030 | #endif // (FW_TYPE==_UCB_MGR_) | ||
2031 | |||
2032 | #if defined(DOS) | ||
2033 | UCHAR sfm(USHORT port, PSCCB pcurrSCCB); | ||
2034 | void scsiStartAuto(USHORT port); | ||
2035 | UCHAR sisyncn(USHORT port, UCHAR p_card, UCHAR syncFlag); | ||
2036 | void ssel(USHORT port, UCHAR p_card); | ||
2037 | void sres(USHORT port, UCHAR p_card, PSCCBcard pCurrCard); | ||
2038 | void sdecm(UCHAR message, USHORT port, UCHAR p_card); | ||
2039 | void shandem(USHORT port, UCHAR p_card,PSCCB pCurrSCCB); | ||
2040 | void stsyncn(USHORT port, UCHAR p_card); | ||
2041 | void sisyncr(USHORT port,UCHAR sync_pulse, UCHAR offset); | ||
2042 | void sssyncv(USHORT p_port, UCHAR p_id, UCHAR p_sync_value, PSCCBMgr_tar_info currTar_Info); | ||
2043 | void sresb(USHORT port, UCHAR p_card); | ||
2044 | void sxfrp(USHORT p_port, UCHAR p_card); | ||
2045 | void schkdd(USHORT port, UCHAR p_card); | ||
2046 | UCHAR RdStack(USHORT port, UCHAR index); | ||
2047 | void WrStack(USHORT portBase, UCHAR index, UCHAR data); | ||
2048 | UCHAR ChkIfChipInitialized(USHORT ioPort); | ||
2049 | |||
2050 | #if defined(V302) | ||
2051 | UCHAR GetTarLun(USHORT port, UCHAR p_card, UCHAR our_target, PSCCBcard pCurrCard, PUCHAR tag, PUCHAR lun); | ||
2052 | #endif | ||
2053 | |||
2054 | void SendMsg(USHORT port, UCHAR message); | ||
2055 | void queueFlushTargSccb(UCHAR p_card, UCHAR thisTarg, UCHAR error_code); | ||
2056 | UCHAR scsellDOS(USHORT p_port, UCHAR targ_id); | ||
2057 | #else | ||
2058 | UCHAR sfm(ULONG port, PSCCB pcurrSCCB); | ||
2059 | void scsiStartAuto(ULONG port); | 1335 | void scsiStartAuto(ULONG port); |
2060 | UCHAR sisyncn(ULONG port, UCHAR p_card, UCHAR syncFlag); | 1336 | static UCHAR FPT_sisyncn(ULONG port, UCHAR p_card, UCHAR syncFlag); |
2061 | void ssel(ULONG port, UCHAR p_card); | 1337 | static void FPT_ssel(ULONG port, UCHAR p_card); |
2062 | void sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard); | 1338 | static void FPT_sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard); |
2063 | void sdecm(UCHAR message, ULONG port, UCHAR p_card); | 1339 | static void FPT_shandem(ULONG port, UCHAR p_card,PSCCB pCurrSCCB); |
2064 | void shandem(ULONG port, UCHAR p_card,PSCCB pCurrSCCB); | 1340 | static void FPT_stsyncn(ULONG port, UCHAR p_card); |
2065 | void stsyncn(ULONG port, UCHAR p_card); | 1341 | static void FPT_sisyncr(ULONG port,UCHAR sync_pulse, UCHAR offset); |
2066 | void sisyncr(ULONG port,UCHAR sync_pulse, UCHAR offset); | 1342 | static void FPT_sssyncv(ULONG p_port, UCHAR p_id, UCHAR p_sync_value, |
2067 | void sssyncv(ULONG p_port, UCHAR p_id, UCHAR p_sync_value, PSCCBMgr_tar_info currTar_Info); | 1343 | PSCCBMgr_tar_info currTar_Info); |
2068 | void sresb(ULONG port, UCHAR p_card); | 1344 | static void FPT_sresb(ULONG port, UCHAR p_card); |
2069 | void sxfrp(ULONG p_port, UCHAR p_card); | 1345 | static void FPT_sxfrp(ULONG p_port, UCHAR p_card); |
2070 | void schkdd(ULONG port, UCHAR p_card); | 1346 | static void FPT_schkdd(ULONG port, UCHAR p_card); |
2071 | UCHAR RdStack(ULONG port, UCHAR index); | 1347 | static UCHAR FPT_RdStack(ULONG port, UCHAR index); |
2072 | void WrStack(ULONG portBase, UCHAR index, UCHAR data); | 1348 | static void FPT_WrStack(ULONG portBase, UCHAR index, UCHAR data); |
2073 | UCHAR ChkIfChipInitialized(ULONG ioPort); | 1349 | static UCHAR FPT_ChkIfChipInitialized(ULONG ioPort); |
2074 | |||
2075 | #if defined(V302) | ||
2076 | UCHAR GetTarLun(ULONG port, UCHAR p_card, UCHAR our_target, PSCCBcard pCurrCard, PUCHAR tar, PUCHAR lun); | ||
2077 | #endif | ||
2078 | 1350 | ||
2079 | void SendMsg(ULONG port, UCHAR message); | 1351 | static void FPT_SendMsg(ULONG port, UCHAR message); |
2080 | void queueFlushTargSccb(UCHAR p_card, UCHAR thisTarg, UCHAR error_code); | 1352 | static void FPT_queueFlushTargSccb(UCHAR p_card, UCHAR thisTarg, |
2081 | #endif | 1353 | UCHAR error_code); |
2082 | 1354 | ||
2083 | void ssenss(PSCCBcard pCurrCard); | 1355 | static void FPT_sinits(PSCCB p_sccb, UCHAR p_card); |
2084 | void sinits(PSCCB p_sccb, UCHAR p_card); | 1356 | static void FPT_RNVRamData(PNVRamInfo pNvRamInfo); |
2085 | void RNVRamData(PNVRamInfo pNvRamInfo); | ||
2086 | |||
2087 | #if defined(WIDE_SCSI) | ||
2088 | #if defined(DOS) | ||
2089 | UCHAR siwidn(USHORT port, UCHAR p_card); | ||
2090 | void stwidn(USHORT port, UCHAR p_card); | ||
2091 | void siwidr(USHORT port, UCHAR width); | ||
2092 | #else | ||
2093 | UCHAR siwidn(ULONG port, UCHAR p_card); | ||
2094 | void stwidn(ULONG port, UCHAR p_card); | ||
2095 | void siwidr(ULONG port, UCHAR width); | ||
2096 | #endif | ||
2097 | #endif | ||
2098 | 1357 | ||
1358 | static UCHAR FPT_siwidn(ULONG port, UCHAR p_card); | ||
1359 | static void FPT_stwidn(ULONG port, UCHAR p_card); | ||
1360 | static void FPT_siwidr(ULONG port, UCHAR width); | ||
2099 | 1361 | ||
2100 | void queueSelectFail(PSCCBcard pCurrCard, UCHAR p_card); | ||
2101 | void queueDisconnect(PSCCB p_SCCB, UCHAR p_card); | ||
2102 | void queueCmdComplete(PSCCBcard pCurrCard, PSCCB p_SCCB, UCHAR p_card); | ||
2103 | void queueSearchSelect(PSCCBcard pCurrCard, UCHAR p_card); | ||
2104 | void queueFlushSccb(UCHAR p_card, UCHAR error_code); | ||
2105 | void queueAddSccb(PSCCB p_SCCB, UCHAR card); | ||
2106 | UCHAR queueFindSccb(PSCCB p_SCCB, UCHAR p_card); | ||
2107 | void utilUpdateResidual(PSCCB p_SCCB); | ||
2108 | USHORT CalcCrc16(UCHAR buffer[]); | ||
2109 | UCHAR CalcLrc(UCHAR buffer[]); | ||
2110 | |||
2111 | |||
2112 | #if defined(DOS) | ||
2113 | void Wait1Second(USHORT p_port); | ||
2114 | void Wait(USHORT p_port, UCHAR p_delay); | ||
2115 | void utilEEWriteOnOff(USHORT p_port,UCHAR p_mode); | ||
2116 | void utilEEWrite(USHORT p_port, USHORT ee_data, USHORT ee_addr); | ||
2117 | USHORT utilEERead(USHORT p_port, USHORT ee_addr); | ||
2118 | USHORT utilEEReadOrg(USHORT p_port, USHORT ee_addr); | ||
2119 | void utilEESendCmdAddr(USHORT p_port, UCHAR ee_cmd, USHORT ee_addr); | ||
2120 | #else | ||
2121 | void Wait1Second(ULONG p_port); | ||
2122 | void Wait(ULONG p_port, UCHAR p_delay); | ||
2123 | void utilEEWriteOnOff(ULONG p_port,UCHAR p_mode); | ||
2124 | void utilEEWrite(ULONG p_port, USHORT ee_data, USHORT ee_addr); | ||
2125 | USHORT utilEERead(ULONG p_port, USHORT ee_addr); | ||
2126 | USHORT utilEEReadOrg(ULONG p_port, USHORT ee_addr); | ||
2127 | void utilEESendCmdAddr(ULONG p_port, UCHAR ee_cmd, USHORT ee_addr); | ||
2128 | #endif | ||
2129 | 1362 | ||
1363 | static void FPT_queueSelectFail(PSCCBcard pCurrCard, UCHAR p_card); | ||
1364 | static void FPT_queueDisconnect(PSCCB p_SCCB, UCHAR p_card); | ||
1365 | static void FPT_queueCmdComplete(PSCCBcard pCurrCard, PSCCB p_SCCB, | ||
1366 | UCHAR p_card); | ||
1367 | static void FPT_queueSearchSelect(PSCCBcard pCurrCard, UCHAR p_card); | ||
1368 | static void FPT_queueFlushSccb(UCHAR p_card, UCHAR error_code); | ||
1369 | static void FPT_queueAddSccb(PSCCB p_SCCB, UCHAR card); | ||
1370 | static UCHAR FPT_queueFindSccb(PSCCB p_SCCB, UCHAR p_card); | ||
1371 | static void FPT_utilUpdateResidual(PSCCB p_SCCB); | ||
1372 | static USHORT FPT_CalcCrc16(UCHAR buffer[]); | ||
1373 | static UCHAR FPT_CalcLrc(UCHAR buffer[]); | ||
2130 | 1374 | ||
2131 | 1375 | ||
2132 | #if defined(OS2) | 1376 | static void FPT_Wait1Second(ULONG p_port); |
2133 | void far phaseDataOut(ULONG port, UCHAR p_card); | 1377 | static void FPT_Wait(ULONG p_port, UCHAR p_delay); |
2134 | void far phaseDataIn(ULONG port, UCHAR p_card); | 1378 | static void FPT_utilEEWriteOnOff(ULONG p_port,UCHAR p_mode); |
2135 | void far phaseCommand(ULONG port, UCHAR p_card); | 1379 | static void FPT_utilEEWrite(ULONG p_port, USHORT ee_data, USHORT ee_addr); |
2136 | void far phaseStatus(ULONG port, UCHAR p_card); | 1380 | static USHORT FPT_utilEERead(ULONG p_port, USHORT ee_addr); |
2137 | void far phaseMsgOut(ULONG port, UCHAR p_card); | 1381 | static USHORT FPT_utilEEReadOrg(ULONG p_port, USHORT ee_addr); |
2138 | void far phaseMsgIn(ULONG port, UCHAR p_card); | 1382 | static void FPT_utilEESendCmdAddr(ULONG p_port, UCHAR ee_cmd, USHORT ee_addr); |
2139 | void far phaseIllegal(ULONG port, UCHAR p_card); | ||
2140 | #else | ||
2141 | #if defined(DOS) | ||
2142 | void phaseDataOut(USHORT port, UCHAR p_card); | ||
2143 | void phaseDataIn(USHORT port, UCHAR p_card); | ||
2144 | void phaseCommand(USHORT port, UCHAR p_card); | ||
2145 | void phaseStatus(USHORT port, UCHAR p_card); | ||
2146 | void phaseMsgOut(USHORT port, UCHAR p_card); | ||
2147 | void phaseMsgIn(USHORT port, UCHAR p_card); | ||
2148 | void phaseIllegal(USHORT port, UCHAR p_card); | ||
2149 | #else | ||
2150 | void phaseDataOut(ULONG port, UCHAR p_card); | ||
2151 | void phaseDataIn(ULONG port, UCHAR p_card); | ||
2152 | void phaseCommand(ULONG port, UCHAR p_card); | ||
2153 | void phaseStatus(ULONG port, UCHAR p_card); | ||
2154 | void phaseMsgOut(ULONG port, UCHAR p_card); | ||
2155 | void phaseMsgIn(ULONG port, UCHAR p_card); | ||
2156 | void phaseIllegal(ULONG port, UCHAR p_card); | ||
2157 | #endif | ||
2158 | #endif | ||
2159 | 1383 | ||
2160 | #if defined(DOS) | ||
2161 | void phaseDecode(USHORT port, UCHAR p_card); | ||
2162 | void phaseChkFifo(USHORT port, UCHAR p_card); | ||
2163 | void phaseBusFree(USHORT p_port, UCHAR p_card); | ||
2164 | #else | ||
2165 | void phaseDecode(ULONG port, UCHAR p_card); | ||
2166 | void phaseChkFifo(ULONG port, UCHAR p_card); | ||
2167 | void phaseBusFree(ULONG p_port, UCHAR p_card); | ||
2168 | #endif | ||
2169 | |||
2170 | |||
2171 | |||
2172 | |||
2173 | #if defined(DOS) | ||
2174 | void XbowInit(USHORT port, UCHAR scamFlg); | ||
2175 | void BusMasterInit(USHORT p_port); | ||
2176 | int DiagXbow(USHORT port); | ||
2177 | int DiagBusMaster(USHORT port); | ||
2178 | void DiagEEPROM(USHORT p_port); | ||
2179 | #else | ||
2180 | void XbowInit(ULONG port, UCHAR scamFlg); | ||
2181 | void BusMasterInit(ULONG p_port); | ||
2182 | int DiagXbow(ULONG port); | ||
2183 | int DiagBusMaster(ULONG port); | ||
2184 | void DiagEEPROM(ULONG p_port); | ||
2185 | #endif | ||
2186 | 1384 | ||
2187 | 1385 | ||
1386 | static void FPT_phaseDataOut(ULONG port, UCHAR p_card); | ||
1387 | static void FPT_phaseDataIn(ULONG port, UCHAR p_card); | ||
1388 | static void FPT_phaseCommand(ULONG port, UCHAR p_card); | ||
1389 | static void FPT_phaseStatus(ULONG port, UCHAR p_card); | ||
1390 | static void FPT_phaseMsgOut(ULONG port, UCHAR p_card); | ||
1391 | static void FPT_phaseMsgIn(ULONG port, UCHAR p_card); | ||
1392 | static void FPT_phaseIllegal(ULONG port, UCHAR p_card); | ||
2188 | 1393 | ||
1394 | static void FPT_phaseDecode(ULONG port, UCHAR p_card); | ||
1395 | static void FPT_phaseChkFifo(ULONG port, UCHAR p_card); | ||
1396 | static void FPT_phaseBusFree(ULONG p_port, UCHAR p_card); | ||
2189 | 1397 | ||
2190 | #if defined(DOS) | ||
2191 | void busMstrAbort(USHORT port); | ||
2192 | UCHAR busMstrTimeOut(USHORT port); | ||
2193 | void dataXferProcessor(USHORT port, PSCCBcard pCurrCard); | ||
2194 | void busMstrSGDataXferStart(USHORT port, PSCCB pCurrSCCB); | ||
2195 | void busMstrDataXferStart(USHORT port, PSCCB pCurrSCCB); | ||
2196 | void hostDataXferAbort(USHORT port, UCHAR p_card, PSCCB pCurrSCCB); | ||
2197 | #else | ||
2198 | void busMstrAbort(ULONG port); | ||
2199 | UCHAR busMstrTimeOut(ULONG port); | ||
2200 | void dataXferProcessor(ULONG port, PSCCBcard pCurrCard); | ||
2201 | void busMstrSGDataXferStart(ULONG port, PSCCB pCurrSCCB); | ||
2202 | void busMstrDataXferStart(ULONG port, PSCCB pCurrSCCB); | ||
2203 | void hostDataXferAbort(ULONG port, UCHAR p_card, PSCCB pCurrSCCB); | ||
2204 | #endif | ||
2205 | void hostDataXferRestart(PSCCB currSCCB); | ||
2206 | 1398 | ||
2207 | 1399 | ||
2208 | #if defined (DOS) | ||
2209 | UCHAR SccbMgr_bad_isr(USHORT p_port, UCHAR p_card, PSCCBcard pCurrCard, USHORT p_int); | ||
2210 | #else | ||
2211 | UCHAR SccbMgr_bad_isr(ULONG p_port, UCHAR p_card, PSCCBcard pCurrCard, USHORT p_int); | ||
2212 | 1400 | ||
2213 | #endif | 1401 | static void FPT_XbowInit(ULONG port, UCHAR scamFlg); |
1402 | static void FPT_BusMasterInit(ULONG p_port); | ||
1403 | static void FPT_DiagEEPROM(ULONG p_port); | ||
2214 | 1404 | ||
2215 | void SccbMgrTableInitAll(void); | ||
2216 | void SccbMgrTableInitCard(PSCCBcard pCurrCard, UCHAR p_card); | ||
2217 | void SccbMgrTableInitTarget(UCHAR p_card, UCHAR target); | ||
2218 | |||
2219 | |||
2220 | |||
2221 | void scini(UCHAR p_card, UCHAR p_our_id, UCHAR p_power_up); | ||
2222 | |||
2223 | #if defined(DOS) | ||
2224 | int scarb(USHORT p_port, UCHAR p_sel_type); | ||
2225 | void scbusf(USHORT p_port); | ||
2226 | void scsel(USHORT p_port); | ||
2227 | void scasid(UCHAR p_card, USHORT p_port); | ||
2228 | UCHAR scxferc(USHORT p_port, UCHAR p_data); | ||
2229 | UCHAR scsendi(USHORT p_port, UCHAR p_id_string[]); | ||
2230 | UCHAR sciso(USHORT p_port, UCHAR p_id_string[]); | ||
2231 | void scwirod(USHORT p_port, UCHAR p_data_bit); | ||
2232 | void scwiros(USHORT p_port, UCHAR p_data_bit); | ||
2233 | UCHAR scvalq(UCHAR p_quintet); | ||
2234 | UCHAR scsell(USHORT p_port, UCHAR targ_id); | ||
2235 | void scwtsel(USHORT p_port); | ||
2236 | void inisci(UCHAR p_card, USHORT p_port, UCHAR p_our_id); | ||
2237 | void scsavdi(UCHAR p_card, USHORT p_port); | ||
2238 | #else | ||
2239 | int scarb(ULONG p_port, UCHAR p_sel_type); | ||
2240 | void scbusf(ULONG p_port); | ||
2241 | void scsel(ULONG p_port); | ||
2242 | void scasid(UCHAR p_card, ULONG p_port); | ||
2243 | UCHAR scxferc(ULONG p_port, UCHAR p_data); | ||
2244 | UCHAR scsendi(ULONG p_port, UCHAR p_id_string[]); | ||
2245 | UCHAR sciso(ULONG p_port, UCHAR p_id_string[]); | ||
2246 | void scwirod(ULONG p_port, UCHAR p_data_bit); | ||
2247 | void scwiros(ULONG p_port, UCHAR p_data_bit); | ||
2248 | UCHAR scvalq(UCHAR p_quintet); | ||
2249 | UCHAR scsell(ULONG p_port, UCHAR targ_id); | ||
2250 | void scwtsel(ULONG p_port); | ||
2251 | void inisci(UCHAR p_card, ULONG p_port, UCHAR p_our_id); | ||
2252 | void scsavdi(UCHAR p_card, ULONG p_port); | ||
2253 | #endif | ||
2254 | UCHAR scmachid(UCHAR p_card, UCHAR p_id_string[]); | ||
2255 | |||
2256 | |||
2257 | #if defined(DOS) | ||
2258 | void autoCmdCmplt(USHORT p_port, UCHAR p_card); | ||
2259 | void autoLoadDefaultMap(USHORT p_port); | ||
2260 | #else | ||
2261 | void autoCmdCmplt(ULONG p_port, UCHAR p_card); | ||
2262 | void autoLoadDefaultMap(ULONG p_port); | ||
2263 | #endif | ||
2264 | |||
2265 | |||
2266 | |||
2267 | #if (FW_TYPE==_SCCB_MGR_) | ||
2268 | void OS_start_timer(unsigned long ioport, unsigned long timeout); | ||
2269 | void OS_stop_timer(unsigned long ioport, unsigned long timeout); | ||
2270 | void OS_disable_int(unsigned char intvec); | ||
2271 | void OS_enable_int(unsigned char intvec); | ||
2272 | void OS_delay(unsigned long count); | ||
2273 | int OS_VirtToPhys(u32bits CardHandle, u32bits *physaddr, u32bits *virtaddr); | ||
2274 | #if !(defined(UNIX) || defined(OS2) || defined(SOLARIS_REAL_MODE)) | ||
2275 | void OS_Lock(PSCCBMGR_INFO pCardInfo); | ||
2276 | void OS_UnLock(PSCCBMGR_INFO pCardInfo); | ||
2277 | #endif // if FW_TYPE == ... | ||
2278 | |||
2279 | #endif | ||
2280 | |||
2281 | extern SCCBCARD BL_Card[MAX_CARDS]; | ||
2282 | extern SCCBMGR_TAR_INFO sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR]; | ||
2283 | |||
2284 | |||
2285 | #if defined(OS2) | ||
2286 | extern void (far *s_PhaseTbl[8]) (ULONG, UCHAR); | ||
2287 | #else | ||
2288 | #if defined(DOS) | ||
2289 | extern void (*s_PhaseTbl[8]) (USHORT, UCHAR); | ||
2290 | #else | ||
2291 | extern void (*s_PhaseTbl[8]) (ULONG, UCHAR); | ||
2292 | #endif | ||
2293 | #endif | ||
2294 | 1405 | ||
2295 | extern SCCBSCAM_INFO scamInfo[MAX_SCSI_TAR]; | ||
2296 | extern NVRAMINFO nvRamInfo[MAX_MB_CARDS]; | ||
2297 | #if defined(DOS) || defined(OS2) | ||
2298 | extern UCHAR temp_id_string[ID_STRING_LENGTH]; | ||
2299 | #endif | ||
2300 | extern UCHAR scamHAString[]; | ||
2301 | 1406 | ||
2302 | 1407 | ||
2303 | extern UCHAR mbCards; | 1408 | void busMstrAbort(ULONG port); |
2304 | #if defined(BUGBUG) | 1409 | static void FPT_dataXferProcessor(ULONG port, PSCCBcard pCurrCard); |
2305 | extern UCHAR debug_int[MAX_CARDS][debug_size]; | 1410 | static void FPT_busMstrSGDataXferStart(ULONG port, PSCCB pCurrSCCB); |
2306 | extern UCHAR debug_index[MAX_CARDS]; | 1411 | static void FPT_busMstrDataXferStart(ULONG port, PSCCB pCurrSCCB); |
2307 | void Debug_Load(UCHAR p_card, UCHAR p_bug_data); | 1412 | static void FPT_hostDataXferAbort(ULONG port, UCHAR p_card, PSCCB pCurrSCCB); |
2308 | #endif | 1413 | static void FPT_hostDataXferRestart(PSCCB currSCCB); |
2309 | 1414 | ||
2310 | #if (FW_TYPE==_SCCB_MGR_) | ||
2311 | #if defined(DOS) | ||
2312 | extern UCHAR first_time; | ||
2313 | #endif | ||
2314 | #endif /* (FW_TYPE==_SCCB_MGR_) */ | ||
2315 | 1415 | ||
2316 | #if (FW_TYPE==_UCB_MGR_) | 1416 | static UCHAR FPT_SccbMgr_bad_isr(ULONG p_port, UCHAR p_card, |
2317 | #if defined(DOS) | 1417 | PSCCBcard pCurrCard, USHORT p_int); |
2318 | extern u08bits first_time; | ||
2319 | #endif | ||
2320 | #endif /* (FW_TYPE==_UCB_MGR_) */ | ||
2321 | 1418 | ||
2322 | #if defined(BUGBUG) | 1419 | static void FPT_SccbMgrTableInitAll(void); |
2323 | void Debug_Load(UCHAR p_card, UCHAR p_bug_data); | 1420 | static void FPT_SccbMgrTableInitCard(PSCCBcard pCurrCard, UCHAR p_card); |
2324 | #endif | 1421 | static void FPT_SccbMgrTableInitTarget(UCHAR p_card, UCHAR target); |
2325 | 1422 | ||
2326 | extern unsigned int SccbGlobalFlags; | ||
2327 | 1423 | ||
2328 | 1424 | ||
2329 | #ident "$Id: sccb.c 1.18 1997/06/10 16:47:04 mohan Exp $" | 1425 | static void FPT_scini(UCHAR p_card, UCHAR p_our_id, UCHAR p_power_up); |
2330 | /*---------------------------------------------------------------------- | ||
2331 | * | ||
2332 | * | ||
2333 | * Copyright 1995-1996 by Mylex Corporation. All Rights Reserved | ||
2334 | * | ||
2335 | * This file is available under both the GNU General Public License | ||
2336 | * and a BSD-style copyright; see LICENSE.FlashPoint for details. | ||
2337 | * | ||
2338 | * $Workfile: sccb.c $ | ||
2339 | * | ||
2340 | * Description: Functions relating to handling of the SCCB interface | ||
2341 | * between the device driver and the HARPOON. | ||
2342 | * | ||
2343 | * $Date: 1997/06/10 16:47:04 $ | ||
2344 | * | ||
2345 | * $Revision: 1.18 $ | ||
2346 | * | ||
2347 | *----------------------------------------------------------------------*/ | ||
2348 | 1426 | ||
2349 | /*#include <globals.h>*/ | 1427 | static int FPT_scarb(ULONG p_port, UCHAR p_sel_type); |
1428 | static void FPT_scbusf(ULONG p_port); | ||
1429 | static void FPT_scsel(ULONG p_port); | ||
1430 | static void FPT_scasid(UCHAR p_card, ULONG p_port); | ||
1431 | static UCHAR FPT_scxferc(ULONG p_port, UCHAR p_data); | ||
1432 | static UCHAR FPT_scsendi(ULONG p_port, UCHAR p_id_string[]); | ||
1433 | static UCHAR FPT_sciso(ULONG p_port, UCHAR p_id_string[]); | ||
1434 | static void FPT_scwirod(ULONG p_port, UCHAR p_data_bit); | ||
1435 | static void FPT_scwiros(ULONG p_port, UCHAR p_data_bit); | ||
1436 | static UCHAR FPT_scvalq(UCHAR p_quintet); | ||
1437 | static UCHAR FPT_scsell(ULONG p_port, UCHAR targ_id); | ||
1438 | static void FPT_scwtsel(ULONG p_port); | ||
1439 | static void FPT_inisci(UCHAR p_card, ULONG p_port, UCHAR p_our_id); | ||
1440 | static void FPT_scsavdi(UCHAR p_card, ULONG p_port); | ||
1441 | static UCHAR FPT_scmachid(UCHAR p_card, UCHAR p_id_string[]); | ||
2350 | 1442 | ||
2351 | #if (FW_TYPE==_UCB_MGR_) | ||
2352 | /*#include <budi.h>*/ | ||
2353 | /*#include <budioctl.h>*/ | ||
2354 | #endif | ||
2355 | 1443 | ||
2356 | /*#include <sccbmgr.h>*/ | 1444 | static void FPT_autoCmdCmplt(ULONG p_port, UCHAR p_card); |
2357 | /*#include <blx30.h>*/ | 1445 | static void FPT_autoLoadDefaultMap(ULONG p_port); |
2358 | /*#include <target.h>*/ | ||
2359 | /*#include <eeprom.h>*/ | ||
2360 | /*#include <scsi2.h>*/ | ||
2361 | /*#include <harpoon.h>*/ | ||
2362 | 1446 | ||
2363 | 1447 | ||
2364 | 1448 | ||
2365 | #if (FW_TYPE==_SCCB_MGR_) | 1449 | void OS_start_timer(unsigned long ioport, unsigned long timeout); |
2366 | #define mOS_Lock(card) OS_Lock((PSCCBMGR_INFO)(((PSCCBcard)card)->cardInfo)) | 1450 | void OS_stop_timer(unsigned long ioport, unsigned long timeout); |
2367 | #define mOS_UnLock(card) OS_UnLock((PSCCBMGR_INFO)(((PSCCBcard)card)->cardInfo)) | 1451 | void OS_disable_int(unsigned char intvec); |
2368 | #else /* FW_TYPE==_UCB_MGR_ */ | 1452 | void OS_enable_int(unsigned char intvec); |
2369 | #define mOS_Lock(card) OS_Lock((u32bits)(((PSCCBcard)card)->ioPort)) | 1453 | void OS_delay(unsigned long count); |
2370 | #define mOS_UnLock(card) OS_UnLock((u32bits)(((PSCCBcard)card)->ioPort)) | 1454 | int OS_VirtToPhys(u32bits CardHandle, u32bits *physaddr, u32bits *virtaddr); |
2371 | #endif | ||
2372 | 1455 | ||
1456 | static SCCBMGR_TAR_INFO FPT_sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR] = { { { 0 } } }; | ||
1457 | static SCCBCARD FPT_BL_Card[MAX_CARDS] = { { 0 } }; | ||
1458 | static SCCBSCAM_INFO FPT_scamInfo[MAX_SCSI_TAR] = { { { 0 } } }; | ||
1459 | static NVRAMINFO FPT_nvRamInfo[MAX_MB_CARDS] = { { 0 } }; | ||
2373 | 1460 | ||
2374 | /* | ||
2375 | extern SCCBMGR_TAR_INFO sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR]; | ||
2376 | extern SCCBCARD BL_Card[MAX_CARDS]; | ||
2377 | 1461 | ||
2378 | extern NVRAMINFO nvRamInfo[MAX_MB_CARDS]; | 1462 | static UCHAR FPT_mbCards = 0; |
2379 | extern UCHAR mbCards; | 1463 | static UCHAR FPT_scamHAString[] = {0x63, 0x07, 'B', 'U', 'S', 'L', 'O', 'G', 'I', 'C', \ |
1464 | ' ', 'B', 'T', '-', '9', '3', '0', \ | ||
1465 | 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \ | ||
1466 | 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}; | ||
2380 | 1467 | ||
2381 | #if defined (OS2) | 1468 | static USHORT FPT_default_intena = 0; |
2382 | extern void (far *s_PhaseTbl[8]) (ULONG, UCHAR); | ||
2383 | #else | ||
2384 | #if defined(DOS) | ||
2385 | extern void (*s_PhaseTbl[8]) (USHORT, UCHAR); | ||
2386 | #else | ||
2387 | extern void (*s_PhaseTbl[8]) (ULONG, UCHAR); | ||
2388 | #endif | ||
2389 | #endif | ||
2390 | 1469 | ||
2391 | 1470 | ||
2392 | #if defined(BUGBUG) | 1471 | static void (*FPT_s_PhaseTbl[8]) (ULONG, UCHAR)= { 0 }; |
2393 | extern UCHAR debug_int[MAX_CARDS][debug_size]; | ||
2394 | extern UCHAR debug_index[MAX_CARDS]; | ||
2395 | void Debug_Load(UCHAR p_card, UCHAR p_bug_data); | ||
2396 | #endif | ||
2397 | */ | ||
2398 | 1472 | ||
2399 | #if (FW_TYPE==_SCCB_MGR_) | ||
2400 | 1473 | ||
2401 | /*--------------------------------------------------------------------- | 1474 | /*--------------------------------------------------------------------- |
2402 | * | 1475 | * |
@@ -2406,27 +1479,16 @@ void Debug_Load(UCHAR p_card, UCHAR p_bug_data); | |||
2406 | * | 1479 | * |
2407 | *---------------------------------------------------------------------*/ | 1480 | *---------------------------------------------------------------------*/ |
2408 | 1481 | ||
2409 | int SccbMgr_sense_adapter(PSCCBMGR_INFO pCardInfo) | 1482 | static int SccbMgr_sense_adapter(PSCCBMGR_INFO pCardInfo) |
2410 | { | 1483 | { |
2411 | #if defined(DOS) | ||
2412 | #else | ||
2413 | static UCHAR first_time = 1; | 1484 | static UCHAR first_time = 1; |
2414 | #endif | ||
2415 | 1485 | ||
2416 | UCHAR i,j,id,ScamFlg; | 1486 | UCHAR i,j,id,ScamFlg; |
2417 | USHORT temp,temp2,temp3,temp4,temp5,temp6; | 1487 | USHORT temp,temp2,temp3,temp4,temp5,temp6; |
2418 | #if defined(DOS) | ||
2419 | USHORT ioport; | ||
2420 | #else | ||
2421 | ULONG ioport; | 1488 | ULONG ioport; |
2422 | #endif | ||
2423 | PNVRamInfo pCurrNvRam; | 1489 | PNVRamInfo pCurrNvRam; |
2424 | 1490 | ||
2425 | #if defined(DOS) | ||
2426 | ioport = (USHORT)pCardInfo->si_baseaddr; | ||
2427 | #else | ||
2428 | ioport = pCardInfo->si_baseaddr; | 1491 | ioport = pCardInfo->si_baseaddr; |
2429 | #endif | ||
2430 | 1492 | ||
2431 | 1493 | ||
2432 | if (RD_HARPOON(ioport+hp_vendor_id_0) != ORION_VEND_0) | 1494 | if (RD_HARPOON(ioport+hp_vendor_id_0) != ORION_VEND_0) |
@@ -2455,36 +1517,31 @@ int SccbMgr_sense_adapter(PSCCBMGR_INFO pCardInfo) | |||
2455 | 1517 | ||
2456 | if (first_time) | 1518 | if (first_time) |
2457 | { | 1519 | { |
2458 | SccbMgrTableInitAll(); | 1520 | FPT_SccbMgrTableInitAll(); |
2459 | first_time = 0; | 1521 | first_time = 0; |
2460 | mbCards = 0; | 1522 | FPT_mbCards = 0; |
2461 | } | 1523 | } |
2462 | 1524 | ||
2463 | if(RdStack(ioport, 0) != 0x00) { | 1525 | if(FPT_RdStack(ioport, 0) != 0x00) { |
2464 | if(ChkIfChipInitialized(ioport) == FALSE) | 1526 | if(FPT_ChkIfChipInitialized(ioport) == 0) |
2465 | { | 1527 | { |
2466 | pCurrNvRam = NULL; | 1528 | pCurrNvRam = NULL; |
2467 | WR_HARPOON(ioport+hp_semaphore, 0x00); | 1529 | WR_HARPOON(ioport+hp_semaphore, 0x00); |
2468 | XbowInit(ioport, 0); /*Must Init the SCSI before attempting */ | 1530 | FPT_XbowInit(ioport, 0); /*Must Init the SCSI before attempting */ |
2469 | DiagEEPROM(ioport); | 1531 | FPT_DiagEEPROM(ioport); |
2470 | } | 1532 | } |
2471 | else | 1533 | else |
2472 | { | 1534 | { |
2473 | if(mbCards < MAX_MB_CARDS) { | 1535 | if(FPT_mbCards < MAX_MB_CARDS) { |
2474 | pCurrNvRam = &nvRamInfo[mbCards]; | 1536 | pCurrNvRam = &FPT_nvRamInfo[FPT_mbCards]; |
2475 | mbCards++; | 1537 | FPT_mbCards++; |
2476 | pCurrNvRam->niBaseAddr = ioport; | 1538 | pCurrNvRam->niBaseAddr = ioport; |
2477 | RNVRamData(pCurrNvRam); | 1539 | FPT_RNVRamData(pCurrNvRam); |
2478 | }else | 1540 | }else |
2479 | return((int) FAILURE); | 1541 | return((int) FAILURE); |
2480 | } | 1542 | } |
2481 | }else | 1543 | }else |
2482 | pCurrNvRam = NULL; | 1544 | pCurrNvRam = NULL; |
2483 | #if defined (NO_BIOS_OPTION) | ||
2484 | pCurrNvRam = NULL; | ||
2485 | XbowInit(ioport, 0); /*Must Init the SCSI before attempting */ | ||
2486 | DiagEEPROM(ioport); | ||
2487 | #endif /* No BIOS Option */ | ||
2488 | 1545 | ||
2489 | WR_HARPOON(ioport+hp_clkctrl_0, CLKCTRL_DEFAULT); | 1546 | WR_HARPOON(ioport+hp_clkctrl_0, CLKCTRL_DEFAULT); |
2490 | WR_HARPOON(ioport+hp_sys_ctrl, 0x00); | 1547 | WR_HARPOON(ioport+hp_sys_ctrl, 0x00); |
@@ -2492,7 +1549,7 @@ int SccbMgr_sense_adapter(PSCCBMGR_INFO pCardInfo) | |||
2492 | if(pCurrNvRam) | 1549 | if(pCurrNvRam) |
2493 | pCardInfo->si_id = pCurrNvRam->niAdapId; | 1550 | pCardInfo->si_id = pCurrNvRam->niAdapId; |
2494 | else | 1551 | else |
2495 | pCardInfo->si_id = (UCHAR)(utilEERead(ioport, (ADAPTER_SCSI_ID/2)) & | 1552 | pCardInfo->si_id = (UCHAR)(FPT_utilEERead(ioport, (ADAPTER_SCSI_ID/2)) & |
2496 | (UCHAR)0x0FF); | 1553 | (UCHAR)0x0FF); |
2497 | 1554 | ||
2498 | pCardInfo->si_lun = 0x00; | 1555 | pCardInfo->si_lun = 0x00; |
@@ -2510,7 +1567,7 @@ int SccbMgr_sense_adapter(PSCCBMGR_INFO pCardInfo) | |||
2510 | temp = ((temp & 0x03) + ((temp << 4) & 0xc0)) + | 1567 | temp = ((temp & 0x03) + ((temp << 4) & 0xc0)) + |
2511 | (((temp << 4) & 0x0300) + ((temp << 8) & 0xc000)); | 1568 | (((temp << 4) & 0x0300) + ((temp << 8) & 0xc000)); |
2512 | }else | 1569 | }else |
2513 | temp = utilEERead(ioport, (USHORT)((SYNC_RATE_TBL/2)+id)); | 1570 | temp = FPT_utilEERead(ioport, (USHORT)((SYNC_RATE_TBL/2)+id)); |
2514 | 1571 | ||
2515 | for (i = 0; i < 2; temp >>=8,i++) { | 1572 | for (i = 0; i < 2; temp >>=8,i++) { |
2516 | 1573 | ||
@@ -2549,12 +1606,12 @@ int SccbMgr_sense_adapter(PSCCBMGR_INFO pCardInfo) | |||
2549 | if(pCurrNvRam) | 1606 | if(pCurrNvRam) |
2550 | i = pCurrNvRam->niSysConf; | 1607 | i = pCurrNvRam->niSysConf; |
2551 | else | 1608 | else |
2552 | i = (UCHAR)(utilEERead(ioport, (SYSTEM_CONFIG/2))); | 1609 | i = (UCHAR)(FPT_utilEERead(ioport, (SYSTEM_CONFIG/2))); |
2553 | 1610 | ||
2554 | if(pCurrNvRam) | 1611 | if(pCurrNvRam) |
2555 | ScamFlg = pCurrNvRam->niScamConf; | 1612 | ScamFlg = pCurrNvRam->niScamConf; |
2556 | else | 1613 | else |
2557 | ScamFlg = (UCHAR) utilEERead(ioport, SCAM_CONFIG/2); | 1614 | ScamFlg = (UCHAR) FPT_utilEERead(ioport, SCAM_CONFIG/2); |
2558 | 1615 | ||
2559 | pCardInfo->si_flags = 0x0000; | 1616 | pCardInfo->si_flags = 0x0000; |
2560 | 1617 | ||
@@ -2613,9 +1670,9 @@ int SccbMgr_sense_adapter(PSCCBMGR_INFO pCardInfo) | |||
2613 | break; | 1670 | break; |
2614 | } | 1671 | } |
2615 | }else{ | 1672 | }else{ |
2616 | temp = utilEERead(ioport, (MODEL_NUMB_0/2)); | 1673 | temp = FPT_utilEERead(ioport, (MODEL_NUMB_0/2)); |
2617 | pCardInfo->si_card_model[0] = (UCHAR)(temp >> 8); | 1674 | pCardInfo->si_card_model[0] = (UCHAR)(temp >> 8); |
2618 | temp = utilEERead(ioport, (MODEL_NUMB_2/2)); | 1675 | temp = FPT_utilEERead(ioport, (MODEL_NUMB_2/2)); |
2619 | 1676 | ||
2620 | pCardInfo->si_card_model[1] = (UCHAR)(temp & 0x00FF); | 1677 | pCardInfo->si_card_model[1] = (UCHAR)(temp & 0x00FF); |
2621 | pCardInfo->si_card_model[2] = (UCHAR)(temp >> 8); | 1678 | pCardInfo->si_card_model[2] = (UCHAR)(temp >> 8); |
@@ -2677,29 +1734,17 @@ int SccbMgr_sense_adapter(PSCCBMGR_INFO pCardInfo) | |||
2677 | 1734 | ||
2678 | SGRAM_ACCESS(ioport); | 1735 | SGRAM_ACCESS(ioport); |
2679 | 1736 | ||
2680 | s_PhaseTbl[0] = phaseDataOut; | 1737 | FPT_s_PhaseTbl[0] = FPT_phaseDataOut; |
2681 | s_PhaseTbl[1] = phaseDataIn; | 1738 | FPT_s_PhaseTbl[1] = FPT_phaseDataIn; |
2682 | s_PhaseTbl[2] = phaseIllegal; | 1739 | FPT_s_PhaseTbl[2] = FPT_phaseIllegal; |
2683 | s_PhaseTbl[3] = phaseIllegal; | 1740 | FPT_s_PhaseTbl[3] = FPT_phaseIllegal; |
2684 | s_PhaseTbl[4] = phaseCommand; | 1741 | FPT_s_PhaseTbl[4] = FPT_phaseCommand; |
2685 | s_PhaseTbl[5] = phaseStatus; | 1742 | FPT_s_PhaseTbl[5] = FPT_phaseStatus; |
2686 | s_PhaseTbl[6] = phaseMsgOut; | 1743 | FPT_s_PhaseTbl[6] = FPT_phaseMsgOut; |
2687 | s_PhaseTbl[7] = phaseMsgIn; | 1744 | FPT_s_PhaseTbl[7] = FPT_phaseMsgIn; |
2688 | 1745 | ||
2689 | pCardInfo->si_present = 0x01; | 1746 | pCardInfo->si_present = 0x01; |
2690 | 1747 | ||
2691 | #if defined(BUGBUG) | ||
2692 | |||
2693 | |||
2694 | for (i = 0; i < MAX_CARDS; i++) { | ||
2695 | |||
2696 | for (id=0; id<debug_size; id++) | ||
2697 | debug_int[i][id] = (UCHAR)0x00; | ||
2698 | debug_index[i] = 0; | ||
2699 | } | ||
2700 | |||
2701 | #endif | ||
2702 | |||
2703 | return(0); | 1748 | return(0); |
2704 | } | 1749 | } |
2705 | 1750 | ||
@@ -2712,27 +1757,15 @@ int SccbMgr_sense_adapter(PSCCBMGR_INFO pCardInfo) | |||
2712 | * | 1757 | * |
2713 | *---------------------------------------------------------------------*/ | 1758 | *---------------------------------------------------------------------*/ |
2714 | 1759 | ||
2715 | #if defined(DOS) | 1760 | static ULONG SccbMgr_config_adapter(PSCCBMGR_INFO pCardInfo) |
2716 | USHORT SccbMgr_config_adapter(PSCCBMGR_INFO pCardInfo) | ||
2717 | #else | ||
2718 | ULONG SccbMgr_config_adapter(PSCCBMGR_INFO pCardInfo) | ||
2719 | #endif | ||
2720 | { | 1761 | { |
2721 | PSCCBcard CurrCard = NULL; | 1762 | PSCCBcard CurrCard = NULL; |
2722 | PNVRamInfo pCurrNvRam; | 1763 | PNVRamInfo pCurrNvRam; |
2723 | UCHAR i,j,thisCard, ScamFlg; | 1764 | UCHAR i,j,thisCard, ScamFlg; |
2724 | USHORT temp,sync_bit_map,id; | 1765 | USHORT temp,sync_bit_map,id; |
2725 | #if defined(DOS) | ||
2726 | USHORT ioport; | ||
2727 | #else | ||
2728 | ULONG ioport; | 1766 | ULONG ioport; |
2729 | #endif | ||
2730 | 1767 | ||
2731 | #if defined(DOS) | ||
2732 | ioport = (USHORT)pCardInfo->si_baseaddr; | ||
2733 | #else | ||
2734 | ioport = pCardInfo->si_baseaddr; | 1768 | ioport = pCardInfo->si_baseaddr; |
2735 | #endif | ||
2736 | 1769 | ||
2737 | for(thisCard =0; thisCard <= MAX_CARDS; thisCard++) { | 1770 | for(thisCard =0; thisCard <= MAX_CARDS; thisCard++) { |
2738 | 1771 | ||
@@ -2741,24 +1774,24 @@ ULONG SccbMgr_config_adapter(PSCCBMGR_INFO pCardInfo) | |||
2741 | return(FAILURE); | 1774 | return(FAILURE); |
2742 | } | 1775 | } |
2743 | 1776 | ||
2744 | if (BL_Card[thisCard].ioPort == ioport) { | 1777 | if (FPT_BL_Card[thisCard].ioPort == ioport) { |
2745 | 1778 | ||
2746 | CurrCard = &BL_Card[thisCard]; | 1779 | CurrCard = &FPT_BL_Card[thisCard]; |
2747 | SccbMgrTableInitCard(CurrCard,thisCard); | 1780 | FPT_SccbMgrTableInitCard(CurrCard,thisCard); |
2748 | break; | 1781 | break; |
2749 | } | 1782 | } |
2750 | 1783 | ||
2751 | else if (BL_Card[thisCard].ioPort == 0x00) { | 1784 | else if (FPT_BL_Card[thisCard].ioPort == 0x00) { |
2752 | 1785 | ||
2753 | BL_Card[thisCard].ioPort = ioport; | 1786 | FPT_BL_Card[thisCard].ioPort = ioport; |
2754 | CurrCard = &BL_Card[thisCard]; | 1787 | CurrCard = &FPT_BL_Card[thisCard]; |
2755 | 1788 | ||
2756 | if(mbCards) | 1789 | if(FPT_mbCards) |
2757 | for(i = 0; i < mbCards; i++){ | 1790 | for(i = 0; i < FPT_mbCards; i++){ |
2758 | if(CurrCard->ioPort == nvRamInfo[i].niBaseAddr) | 1791 | if(CurrCard->ioPort == FPT_nvRamInfo[i].niBaseAddr) |
2759 | CurrCard->pNvRamInfo = &nvRamInfo[i]; | 1792 | CurrCard->pNvRamInfo = &FPT_nvRamInfo[i]; |
2760 | } | 1793 | } |
2761 | SccbMgrTableInitCard(CurrCard,thisCard); | 1794 | FPT_SccbMgrTableInitCard(CurrCard,thisCard); |
2762 | CurrCard->cardIndex = thisCard; | 1795 | CurrCard->cardIndex = thisCard; |
2763 | CurrCard->cardInfo = pCardInfo; | 1796 | CurrCard->cardInfo = pCardInfo; |
2764 | 1797 | ||
@@ -2772,22 +1805,14 @@ ULONG SccbMgr_config_adapter(PSCCBMGR_INFO pCardInfo) | |||
2772 | ScamFlg = pCurrNvRam->niScamConf; | 1805 | ScamFlg = pCurrNvRam->niScamConf; |
2773 | } | 1806 | } |
2774 | else{ | 1807 | else{ |
2775 | ScamFlg = (UCHAR) utilEERead(ioport, SCAM_CONFIG/2); | 1808 | ScamFlg = (UCHAR) FPT_utilEERead(ioport, SCAM_CONFIG/2); |
2776 | } | 1809 | } |
2777 | 1810 | ||
2778 | 1811 | ||
2779 | BusMasterInit(ioport); | 1812 | FPT_BusMasterInit(ioport); |
2780 | XbowInit(ioport, ScamFlg); | 1813 | FPT_XbowInit(ioport, ScamFlg); |
2781 | |||
2782 | #if defined (NO_BIOS_OPTION) | ||
2783 | 1814 | ||
2784 | 1815 | FPT_autoLoadDefaultMap(ioport); | |
2785 | if (DiagXbow(ioport)) return(FAILURE); | ||
2786 | if (DiagBusMaster(ioport)) return(FAILURE); | ||
2787 | |||
2788 | #endif /* No BIOS Option */ | ||
2789 | |||
2790 | autoLoadDefaultMap(ioport); | ||
2791 | 1816 | ||
2792 | 1817 | ||
2793 | for (i = 0,id = 0x01; i != pCardInfo->si_id; i++,id <<= 1){} | 1818 | for (i = 0,id = 0x01; i != pCardInfo->si_id; i++,id <<= 1){} |
@@ -2814,9 +1839,9 @@ ULONG SccbMgr_config_adapter(PSCCBMGR_INFO pCardInfo) | |||
2814 | 1839 | ||
2815 | if (!(pCardInfo->si_flags & SOFT_RESET)) { | 1840 | if (!(pCardInfo->si_flags & SOFT_RESET)) { |
2816 | 1841 | ||
2817 | sresb(ioport,thisCard); | 1842 | FPT_sresb(ioport,thisCard); |
2818 | 1843 | ||
2819 | scini(thisCard, pCardInfo->si_id, 0); | 1844 | FPT_scini(thisCard, pCardInfo->si_id, 0); |
2820 | } | 1845 | } |
2821 | 1846 | ||
2822 | 1847 | ||
@@ -2829,7 +1854,7 @@ ULONG SccbMgr_config_adapter(PSCCBMGR_INFO pCardInfo) | |||
2829 | CurrCard->globalFlags |= F_GREEN_PC; | 1854 | CurrCard->globalFlags |= F_GREEN_PC; |
2830 | } | 1855 | } |
2831 | else{ | 1856 | else{ |
2832 | if (utilEERead(ioport, (SYSTEM_CONFIG/2)) & GREEN_PC_ENA) | 1857 | if (FPT_utilEERead(ioport, (SYSTEM_CONFIG/2)) & GREEN_PC_ENA) |
2833 | CurrCard->globalFlags |= F_GREEN_PC; | 1858 | CurrCard->globalFlags |= F_GREEN_PC; |
2834 | } | 1859 | } |
2835 | 1860 | ||
@@ -2840,7 +1865,7 @@ ULONG SccbMgr_config_adapter(PSCCBMGR_INFO pCardInfo) | |||
2840 | CurrCard->globalFlags |= F_DO_RENEGO; | 1865 | CurrCard->globalFlags |= F_DO_RENEGO; |
2841 | } | 1866 | } |
2842 | else{ | 1867 | else{ |
2843 | if (utilEERead(ioport, (SCSI_CONFIG/2)) & RENEGO_ENA) | 1868 | if (FPT_utilEERead(ioport, (SCSI_CONFIG/2)) & RENEGO_ENA) |
2844 | CurrCard->globalFlags |= F_DO_RENEGO; | 1869 | CurrCard->globalFlags |= F_DO_RENEGO; |
2845 | } | 1870 | } |
2846 | 1871 | ||
@@ -2849,7 +1874,7 @@ ULONG SccbMgr_config_adapter(PSCCBMGR_INFO pCardInfo) | |||
2849 | CurrCard->globalFlags |= F_CONLUN_IO; | 1874 | CurrCard->globalFlags |= F_CONLUN_IO; |
2850 | } | 1875 | } |
2851 | else{ | 1876 | else{ |
2852 | if (utilEERead(ioport, (SCSI_CONFIG/2)) & CONNIO_ENA) | 1877 | if (FPT_utilEERead(ioport, (SCSI_CONFIG/2)) & CONNIO_ENA) |
2853 | CurrCard->globalFlags |= F_CONLUN_IO; | 1878 | CurrCard->globalFlags |= F_CONLUN_IO; |
2854 | } | 1879 | } |
2855 | 1880 | ||
@@ -2859,7 +1884,7 @@ ULONG SccbMgr_config_adapter(PSCCBMGR_INFO pCardInfo) | |||
2859 | for (i = 0,id = 1; i < MAX_SCSI_TAR; i++, id <<= 1) { | 1884 | for (i = 0,id = 1; i < MAX_SCSI_TAR; i++, id <<= 1) { |
2860 | 1885 | ||
2861 | if (temp & id) | 1886 | if (temp & id) |
2862 | sccbMgrTbl[thisCard][i].TarStatus |= TAR_ALLOW_DISC; | 1887 | FPT_sccbMgrTbl[thisCard][i].TarStatus |= TAR_ALLOW_DISC; |
2863 | } | 1888 | } |
2864 | 1889 | ||
2865 | sync_bit_map = 0x0001; | 1890 | sync_bit_map = 0x0001; |
@@ -2871,39 +1896,34 @@ ULONG SccbMgr_config_adapter(PSCCBMGR_INFO pCardInfo) | |||
2871 | temp = ((temp & 0x03) + ((temp << 4) & 0xc0)) + | 1896 | temp = ((temp & 0x03) + ((temp << 4) & 0xc0)) + |
2872 | (((temp << 4) & 0x0300) + ((temp << 8) & 0xc000)); | 1897 | (((temp << 4) & 0x0300) + ((temp << 8) & 0xc000)); |
2873 | }else | 1898 | }else |
2874 | temp = utilEERead(ioport, (USHORT)((SYNC_RATE_TBL/2)+id)); | 1899 | temp = FPT_utilEERead(ioport, (USHORT)((SYNC_RATE_TBL/2)+id)); |
2875 | 1900 | ||
2876 | for (i = 0; i < 2; temp >>=8,i++) { | 1901 | for (i = 0; i < 2; temp >>=8,i++) { |
2877 | 1902 | ||
2878 | if (pCardInfo->si_per_targ_init_sync & sync_bit_map) { | 1903 | if (pCardInfo->si_per_targ_init_sync & sync_bit_map) { |
2879 | 1904 | ||
2880 | sccbMgrTbl[thisCard][id*2+i].TarEEValue = (UCHAR)temp; | 1905 | FPT_sccbMgrTbl[thisCard][id*2+i].TarEEValue = (UCHAR)temp; |
2881 | } | 1906 | } |
2882 | 1907 | ||
2883 | else { | 1908 | else { |
2884 | sccbMgrTbl[thisCard][id*2+i].TarStatus |= SYNC_SUPPORTED; | 1909 | FPT_sccbMgrTbl[thisCard][id*2+i].TarStatus |= SYNC_SUPPORTED; |
2885 | sccbMgrTbl[thisCard][id*2+i].TarEEValue = | 1910 | FPT_sccbMgrTbl[thisCard][id*2+i].TarEEValue = |
2886 | (UCHAR)(temp & ~EE_SYNC_MASK); | 1911 | (UCHAR)(temp & ~EE_SYNC_MASK); |
2887 | } | 1912 | } |
2888 | 1913 | ||
2889 | #if defined(WIDE_SCSI) | ||
2890 | /* if ((pCardInfo->si_per_targ_wide_nego & sync_bit_map) || | 1914 | /* if ((pCardInfo->si_per_targ_wide_nego & sync_bit_map) || |
2891 | (id*2+i >= 8)){ | 1915 | (id*2+i >= 8)){ |
2892 | */ | 1916 | */ |
2893 | if (pCardInfo->si_per_targ_wide_nego & sync_bit_map){ | 1917 | if (pCardInfo->si_per_targ_wide_nego & sync_bit_map){ |
2894 | 1918 | ||
2895 | sccbMgrTbl[thisCard][id*2+i].TarEEValue |= EE_WIDE_SCSI; | 1919 | FPT_sccbMgrTbl[thisCard][id*2+i].TarEEValue |= EE_WIDE_SCSI; |
2896 | 1920 | ||
2897 | } | 1921 | } |
2898 | 1922 | ||
2899 | else { /* NARROW SCSI */ | 1923 | else { /* NARROW SCSI */ |
2900 | sccbMgrTbl[thisCard][id*2+i].TarStatus |= WIDE_NEGOCIATED; | 1924 | FPT_sccbMgrTbl[thisCard][id*2+i].TarStatus |= WIDE_NEGOCIATED; |
2901 | } | 1925 | } |
2902 | 1926 | ||
2903 | #else | ||
2904 | sccbMgrTbl[thisCard][id*2+i].TarStatus |= WIDE_NEGOCIATED; | ||
2905 | #endif | ||
2906 | |||
2907 | 1927 | ||
2908 | sync_bit_map <<= 1; | 1928 | sync_bit_map <<= 1; |
2909 | 1929 | ||
@@ -2915,1285 +1935,97 @@ ULONG SccbMgr_config_adapter(PSCCBMGR_INFO pCardInfo) | |||
2915 | WR_HARPOON((ioport+hp_semaphore), | 1935 | WR_HARPOON((ioport+hp_semaphore), |
2916 | (UCHAR)(RD_HARPOON((ioport+hp_semaphore)) | SCCB_MGR_PRESENT)); | 1936 | (UCHAR)(RD_HARPOON((ioport+hp_semaphore)) | SCCB_MGR_PRESENT)); |
2917 | 1937 | ||
2918 | #if defined(DOS) | ||
2919 | return((USHORT)CurrCard); | ||
2920 | #else | ||
2921 | return((ULONG)CurrCard); | 1938 | return((ULONG)CurrCard); |
2922 | #endif | ||
2923 | } | 1939 | } |
2924 | 1940 | ||
2925 | #else /* end (FW_TYPE==_SCCB_MGR_) */ | 1941 | static void SccbMgr_unload_card(ULONG pCurrCard) |
2926 | |||
2927 | |||
2928 | |||
2929 | STATIC s16bits FP_PresenceCheck(PMGR_INFO pMgrInfo) | ||
2930 | { | ||
2931 | PMGR_ENTRYPNTS pMgr_EntryPnts = &pMgrInfo->mi_Functions; | ||
2932 | |||
2933 | pMgr_EntryPnts->UCBMgr_probe_adapter = probe_adapter; | ||
2934 | pMgr_EntryPnts->UCBMgr_init_adapter = init_adapter; | ||
2935 | pMgr_EntryPnts->UCBMgr_start_UCB = SccbMgr_start_sccb; | ||
2936 | pMgr_EntryPnts->UCBMgr_build_UCB = build_UCB; | ||
2937 | pMgr_EntryPnts->UCBMgr_abort_UCB = SccbMgr_abort_sccb; | ||
2938 | pMgr_EntryPnts->UCBMgr_my_int = SccbMgr_my_int; | ||
2939 | pMgr_EntryPnts->UCBMgr_isr = SccbMgr_isr; | ||
2940 | pMgr_EntryPnts->UCBMgr_scsi_reset = SccbMgr_scsi_reset; | ||
2941 | pMgr_EntryPnts->UCBMgr_timer_expired = SccbMgr_timer_expired; | ||
2942 | #ifndef NO_IOCTLS | ||
2943 | pMgr_EntryPnts->UCBMgr_unload_card = SccbMgr_unload_card; | ||
2944 | pMgr_EntryPnts->UCBMgr_save_foreign_state = | ||
2945 | SccbMgr_save_foreign_state; | ||
2946 | pMgr_EntryPnts->UCBMgr_restore_foreign_state = | ||
2947 | SccbMgr_restore_foreign_state; | ||
2948 | pMgr_EntryPnts->UCBMgr_restore_native_state = | ||
2949 | SccbMgr_restore_native_state; | ||
2950 | #endif /*NO_IOCTLS*/ | ||
2951 | |||
2952 | pMgrInfo->mi_SGListFormat=0x01; | ||
2953 | pMgrInfo->mi_DataPtrFormat=0x01; | ||
2954 | pMgrInfo->mi_MaxSGElements= (u16bits) 0xffffffff; | ||
2955 | pMgrInfo->mi_MgrPrivateLen=sizeof(SCCB); | ||
2956 | pMgrInfo->mi_PCIVendorID=BL_VENDOR_ID; | ||
2957 | pMgrInfo->mi_PCIDeviceID=FP_DEVICE_ID; | ||
2958 | pMgrInfo->mi_MgrAttributes= ATTR_IO_MAPPED + | ||
2959 | ATTR_PHYSICAL_ADDRESS + | ||
2960 | ATTR_VIRTUAL_ADDRESS + | ||
2961 | ATTR_OVERLAPPED_IO_IOCTLS_OK; | ||
2962 | pMgrInfo->mi_IoRangeLen = 256; | ||
2963 | return(0); | ||
2964 | } | ||
2965 | |||
2966 | |||
2967 | |||
2968 | /*--------------------------------------------------------------------- | ||
2969 | * | ||
2970 | * Function: probe_adapter | ||
2971 | * | ||
2972 | * Description: Setup and/or Search for cards and return info to caller. | ||
2973 | * | ||
2974 | *---------------------------------------------------------------------*/ | ||
2975 | STATIC s32bits probe_adapter(PADAPTER_INFO pAdapterInfo) | ||
2976 | { | ||
2977 | u16bits temp,temp2,temp3,temp4; | ||
2978 | u08bits i,j,id; | ||
2979 | |||
2980 | #if defined(DOS) | ||
2981 | #else | ||
2982 | static u08bits first_time = 1; | ||
2983 | #endif | ||
2984 | BASE_PORT ioport; | ||
2985 | PNVRamInfo pCurrNvRam; | ||
2986 | |||
2987 | ioport = (BASE_PORT)pAdapterInfo->ai_baseaddr; | ||
2988 | |||
2989 | |||
2990 | |||
2991 | if (RD_HARPOON(ioport+hp_vendor_id_0) != ORION_VEND_0) | ||
2992 | return(1); | ||
2993 | |||
2994 | if ((RD_HARPOON(ioport+hp_vendor_id_1) != ORION_VEND_1)) | ||
2995 | return(2); | ||
2996 | |||
2997 | if ((RD_HARPOON(ioport+hp_device_id_0) != ORION_DEV_0)) | ||
2998 | return(3); | ||
2999 | |||
3000 | if ((RD_HARPOON(ioport+hp_device_id_1) != ORION_DEV_1)) | ||
3001 | return(4); | ||
3002 | |||
3003 | |||
3004 | if (RD_HARPOON(ioport+hp_rev_num) != 0x0f){ | ||
3005 | |||
3006 | |||
3007 | /* For new Harpoon then check for sub_device ID LSB | ||
3008 | the bits(0-3) must be all ZERO for compatible with | ||
3009 | current version of SCCBMgr, else skip this Harpoon | ||
3010 | device. */ | ||
3011 | |||
3012 | if (RD_HARPOON(ioport+hp_sub_device_id_0) & 0x0f) | ||
3013 | return(5); | ||
3014 | } | ||
3015 | |||
3016 | if (first_time) { | ||
3017 | |||
3018 | SccbMgrTableInitAll(); | ||
3019 | first_time = 0; | ||
3020 | mbCards = 0; | ||
3021 | } | ||
3022 | |||
3023 | if(RdStack(ioport, 0) != 0x00) { | ||
3024 | if(ChkIfChipInitialized(ioport) == FALSE) | ||
3025 | { | ||
3026 | pCurrNvRam = NULL; | ||
3027 | WR_HARPOON(ioport+hp_semaphore, 0x00); | ||
3028 | XbowInit(ioport, 0); /*Must Init the SCSI before attempting */ | ||
3029 | DiagEEPROM(ioport); | ||
3030 | } | ||
3031 | else | ||
3032 | { | ||
3033 | if(mbCards < MAX_MB_CARDS) { | ||
3034 | pCurrNvRam = &nvRamInfo[mbCards]; | ||
3035 | mbCards++; | ||
3036 | pCurrNvRam->niBaseAddr = ioport; | ||
3037 | RNVRamData(pCurrNvRam); | ||
3038 | }else | ||
3039 | return((int) FAILURE); | ||
3040 | } | ||
3041 | }else | ||
3042 | pCurrNvRam = NULL; | ||
3043 | |||
3044 | #if defined (NO_BIOS_OPTION) | ||
3045 | pCurrNvRam = NULL; | ||
3046 | XbowInit(ioport, 0); /*Must Init the SCSI before attempting */ | ||
3047 | DiagEEPROM(ioport); | ||
3048 | #endif /* No BIOS Option */ | ||
3049 | |||
3050 | WR_HARPOON(ioport+hp_clkctrl_0, CLKCTRL_DEFAULT); | ||
3051 | WR_HARPOON(ioport+hp_sys_ctrl, 0x00); | ||
3052 | |||
3053 | if(pCurrNvRam) | ||
3054 | pAdapterInfo->ai_id = pCurrNvRam->niAdapId; | ||
3055 | else | ||
3056 | pAdapterInfo->ai_id = (u08bits)(utilEERead(ioport, (ADAPTER_SCSI_ID/2)) & | ||
3057 | (u08bits)0x0FF); | ||
3058 | |||
3059 | pAdapterInfo->ai_lun = 0x00; | ||
3060 | pAdapterInfo->ai_fw_revision[0] = '3'; | ||
3061 | pAdapterInfo->ai_fw_revision[1] = '1'; | ||
3062 | pAdapterInfo->ai_fw_revision[2] = '1'; | ||
3063 | pAdapterInfo->ai_fw_revision[3] = ' '; | ||
3064 | pAdapterInfo->ai_NumChannels = 1; | ||
3065 | |||
3066 | temp2 = 0x0000; | ||
3067 | temp3 = 0x0000; | ||
3068 | temp4 = 0x0000; | ||
3069 | |||
3070 | for (id = 0; id < (16/2); id++) { | ||
3071 | |||
3072 | if(pCurrNvRam){ | ||
3073 | temp = (USHORT) pCurrNvRam->niSyncTbl[id]; | ||
3074 | temp = ((temp & 0x03) + ((temp << 4) & 0xc0)) + | ||
3075 | (((temp << 4) & 0x0300) + ((temp << 8) & 0xc000)); | ||
3076 | }else | ||
3077 | temp = utilEERead(ioport, (u16bits)((SYNC_RATE_TBL/2)+id)); | ||
3078 | |||
3079 | for (i = 0; i < 2; temp >>=8,i++) { | ||
3080 | |||
3081 | if ((temp & 0x03) != AUTO_RATE_00) { | ||
3082 | |||
3083 | temp2 >>= 0x01; | ||
3084 | temp2 |= 0x8000; | ||
3085 | } | ||
3086 | |||
3087 | else { | ||
3088 | temp2 >>= 0x01; | ||
3089 | } | ||
3090 | |||
3091 | if (temp & DISC_ENABLE_BIT) { | ||
3092 | |||
3093 | temp3 >>= 0x01; | ||
3094 | temp3 |= 0x8000; | ||
3095 | } | ||
3096 | |||
3097 | else { | ||
3098 | temp3 >>= 0x01; | ||
3099 | } | ||
3100 | |||
3101 | if (temp & WIDE_NEGO_BIT) { | ||
3102 | |||
3103 | temp4 >>= 0x01; | ||
3104 | temp4 |= 0x8000; | ||
3105 | } | ||
3106 | |||
3107 | else { | ||
3108 | temp4 >>= 0x01; | ||
3109 | } | ||
3110 | |||
3111 | } | ||
3112 | } | ||
3113 | |||
3114 | pAdapterInfo->ai_per_targ_init_sync = temp2; | ||
3115 | pAdapterInfo->ai_per_targ_no_disc = temp3; | ||
3116 | pAdapterInfo->ai_per_targ_wide_nego = temp4; | ||
3117 | if(pCurrNvRam) | ||
3118 | i = pCurrNvRam->niSysConf; | ||
3119 | else | ||
3120 | i = (u08bits)(utilEERead(ioport, (SYSTEM_CONFIG/2))); | ||
3121 | |||
3122 | /* | ||
3123 | ** interrupts always level-triggered for FlashPoint | ||
3124 | */ | ||
3125 | pAdapterInfo->ai_stateinfo |= LEVEL_TRIG; | ||
3126 | |||
3127 | if (i & 0x01) | ||
3128 | pAdapterInfo->ai_stateinfo |= SCSI_PARITY_ENA; | ||
3129 | |||
3130 | if (i & 0x02) /* SCSI Bus reset in AutoSCSI Set ? */ | ||
3131 | { | ||
3132 | if(pCurrNvRam) | ||
3133 | { | ||
3134 | j = pCurrNvRam->niScamConf; | ||
3135 | } | ||
3136 | else | ||
3137 | { | ||
3138 | j = (u08bits) utilEERead(ioport, SCAM_CONFIG/2); | ||
3139 | } | ||
3140 | if(j & SCAM_ENABLED) | ||
3141 | { | ||
3142 | if(j & SCAM_LEVEL2) | ||
3143 | { | ||
3144 | pAdapterInfo->ai_stateinfo |= SCAM2_ENA; | ||
3145 | } | ||
3146 | else | ||
3147 | { | ||
3148 | pAdapterInfo->ai_stateinfo |= SCAM1_ENA; | ||
3149 | } | ||
3150 | } | ||
3151 | } | ||
3152 | j = (RD_HARPOON(ioport+hp_bm_ctrl) & ~SCSI_TERM_ENA_L); | ||
3153 | if (i & 0x04) { | ||
3154 | j |= SCSI_TERM_ENA_L; | ||
3155 | pAdapterInfo->ai_stateinfo |= LOW_BYTE_TERM_ENA; | ||
3156 | } | ||
3157 | WR_HARPOON(ioport+hp_bm_ctrl, j ); | ||
3158 | |||
3159 | j = (RD_HARPOON(ioport+hp_ee_ctrl) & ~SCSI_TERM_ENA_H); | ||
3160 | if (i & 0x08) { | ||
3161 | j |= SCSI_TERM_ENA_H; | ||
3162 | pAdapterInfo->ai_stateinfo |= HIGH_BYTE_TERM_ENA; | ||
3163 | } | ||
3164 | WR_HARPOON(ioport+hp_ee_ctrl, j ); | ||
3165 | |||
3166 | if(RD_HARPOON(ioport + hp_page_ctrl) & BIOS_SHADOW) | ||
3167 | { | ||
3168 | pAdapterInfo->ai_FlashRomSize = 64 * 1024; /* 64k ROM */ | ||
3169 | } | ||
3170 | else | ||
3171 | { | ||
3172 | pAdapterInfo->ai_FlashRomSize = 32 * 1024; /* 32k ROM */ | ||
3173 | } | ||
3174 | |||
3175 | pAdapterInfo->ai_stateinfo |= (FAST20_ENA | TAG_QUEUE_ENA); | ||
3176 | if (!(RD_HARPOON(ioport+hp_page_ctrl) & NARROW_SCSI_CARD)) | ||
3177 | { | ||
3178 | pAdapterInfo->ai_attributes |= (WIDE_CAPABLE | FAST20_CAPABLE | ||
3179 | | SCAM2_CAPABLE | ||
3180 | | TAG_QUEUE_CAPABLE | ||
3181 | | SUPRESS_UNDERRRUNS_CAPABLE | ||
3182 | | SCSI_PARITY_CAPABLE); | ||
3183 | pAdapterInfo->ai_MaxTarg = 16; | ||
3184 | pAdapterInfo->ai_MaxLun = 32; | ||
3185 | } | ||
3186 | else | ||
3187 | { | ||
3188 | pAdapterInfo->ai_attributes |= (FAST20_CAPABLE | SCAM2_CAPABLE | ||
3189 | | TAG_QUEUE_CAPABLE | ||
3190 | | SUPRESS_UNDERRRUNS_CAPABLE | ||
3191 | | SCSI_PARITY_CAPABLE); | ||
3192 | pAdapterInfo->ai_MaxTarg = 8; | ||
3193 | pAdapterInfo->ai_MaxLun = 8; | ||
3194 | } | ||
3195 | |||
3196 | pAdapterInfo->ai_product_family = HARPOON_FAMILY; | ||
3197 | pAdapterInfo->ai_HBAbustype = BUSTYPE_PCI; | ||
3198 | |||
3199 | for (i=0;i<CARD_MODEL_NAMELEN;i++) | ||
3200 | { | ||
3201 | pAdapterInfo->ai_card_model[i]=' '; /* initialize the ai_card_model */ | ||
3202 | } | ||
3203 | |||
3204 | if(pCurrNvRam){ | ||
3205 | pAdapterInfo->ai_card_model[0] = '9'; | ||
3206 | switch(pCurrNvRam->niModel & 0x0f){ | ||
3207 | case MODEL_LT: | ||
3208 | pAdapterInfo->ai_card_model[1] = '3'; | ||
3209 | pAdapterInfo->ai_card_model[2] = '0'; | ||
3210 | break; | ||
3211 | case MODEL_LW: | ||
3212 | pAdapterInfo->ai_card_model[1] = '5'; | ||
3213 | pAdapterInfo->ai_card_model[2] = '0'; | ||
3214 | break; | ||
3215 | case MODEL_DL: | ||
3216 | pAdapterInfo->ai_card_model[1] = '3'; | ||
3217 | pAdapterInfo->ai_card_model[2] = '2'; | ||
3218 | break; | ||
3219 | case MODEL_DW: | ||
3220 | pAdapterInfo->ai_card_model[1] = '5'; | ||
3221 | pAdapterInfo->ai_card_model[2] = '2'; | ||
3222 | break; | ||
3223 | } | ||
3224 | }else{ | ||
3225 | temp = utilEERead(ioport, (MODEL_NUMB_0/2)); | ||
3226 | pAdapterInfo->ai_card_model[0] = (u08bits)(temp >> 8); | ||
3227 | temp = utilEERead(ioport, (MODEL_NUMB_2/2)); | ||
3228 | |||
3229 | pAdapterInfo->ai_card_model[1] = (u08bits)(temp & 0x00FF); | ||
3230 | pAdapterInfo->ai_card_model[2] = (u08bits)(temp >> 8); | ||
3231 | } | ||
3232 | |||
3233 | |||
3234 | |||
3235 | pAdapterInfo->ai_FiberProductType = 0; | ||
3236 | |||
3237 | pAdapterInfo->ai_secondary_range = 0; | ||
3238 | |||
3239 | for (i=0;i<WORLD_WIDE_NAMELEN;i++) | ||
3240 | { | ||
3241 | pAdapterInfo->ai_worldwidename[i]='\0'; | ||
3242 | } | ||
3243 | |||
3244 | for (i=0;i<VENDOR_NAMELEN;i++) | ||
3245 | { | ||
3246 | pAdapterInfo->ai_vendorstring[i]='\0'; | ||
3247 | } | ||
3248 | pAdapterInfo->ai_vendorstring[0]='B'; | ||
3249 | pAdapterInfo->ai_vendorstring[1]='U'; | ||
3250 | pAdapterInfo->ai_vendorstring[2]='S'; | ||
3251 | pAdapterInfo->ai_vendorstring[3]='L'; | ||
3252 | pAdapterInfo->ai_vendorstring[4]='O'; | ||
3253 | pAdapterInfo->ai_vendorstring[5]='G'; | ||
3254 | pAdapterInfo->ai_vendorstring[6]='I'; | ||
3255 | pAdapterInfo->ai_vendorstring[7]='C'; | ||
3256 | |||
3257 | for (i=0;i<FAMILY_NAMELEN;i++) | ||
3258 | { | ||
3259 | pAdapterInfo->ai_AdapterFamilyString[i]='\0'; | ||
3260 | } | ||
3261 | pAdapterInfo->ai_AdapterFamilyString[0]='F'; | ||
3262 | pAdapterInfo->ai_AdapterFamilyString[1]='L'; | ||
3263 | pAdapterInfo->ai_AdapterFamilyString[2]='A'; | ||
3264 | pAdapterInfo->ai_AdapterFamilyString[3]='S'; | ||
3265 | pAdapterInfo->ai_AdapterFamilyString[4]='H'; | ||
3266 | pAdapterInfo->ai_AdapterFamilyString[5]='P'; | ||
3267 | pAdapterInfo->ai_AdapterFamilyString[6]='O'; | ||
3268 | pAdapterInfo->ai_AdapterFamilyString[7]='I'; | ||
3269 | pAdapterInfo->ai_AdapterFamilyString[8]='N'; | ||
3270 | pAdapterInfo->ai_AdapterFamilyString[9]='T'; | ||
3271 | |||
3272 | ARAM_ACCESS(ioport); | ||
3273 | |||
3274 | for ( i = 0; i < 4; i++ ) { | ||
3275 | |||
3276 | pAdapterInfo->ai_XlatInfo[i] = | ||
3277 | RD_HARPOON(ioport+hp_aramBase+BIOS_DATA_OFFSET+i); | ||
3278 | } | ||
3279 | |||
3280 | /* return with -1 if no sort, else return with | ||
3281 | logical card number sorted by BIOS (zero-based) */ | ||
3282 | |||
3283 | |||
3284 | pAdapterInfo->ai_relative_cardnum = | ||
3285 | (u08bits)(RD_HARPOON(ioport+hp_aramBase+BIOS_RELATIVE_CARD)-1); | ||
3286 | |||
3287 | SGRAM_ACCESS(ioport); | ||
3288 | |||
3289 | s_PhaseTbl[0] = phaseDataOut; | ||
3290 | s_PhaseTbl[1] = phaseDataIn; | ||
3291 | s_PhaseTbl[2] = phaseIllegal; | ||
3292 | s_PhaseTbl[3] = phaseIllegal; | ||
3293 | s_PhaseTbl[4] = phaseCommand; | ||
3294 | s_PhaseTbl[5] = phaseStatus; | ||
3295 | s_PhaseTbl[6] = phaseMsgOut; | ||
3296 | s_PhaseTbl[7] = phaseMsgIn; | ||
3297 | |||
3298 | pAdapterInfo->ai_present = 0x01; | ||
3299 | |||
3300 | #if defined(BUGBUG) | ||
3301 | |||
3302 | |||
3303 | for (i = 0; i < MAX_CARDS; i++) { | ||
3304 | |||
3305 | for (id=0; id<debug_size; id++) | ||
3306 | debug_int[i][id] = (u08bits)0x00; | ||
3307 | debug_index[i] = 0; | ||
3308 | } | ||
3309 | |||
3310 | #endif | ||
3311 | |||
3312 | return(0); | ||
3313 | } | ||
3314 | |||
3315 | |||
3316 | |||
3317 | |||
3318 | |||
3319 | /*--------------------------------------------------------------------- | ||
3320 | * | ||
3321 | * Function: init_adapter, exported to BUDI via UCBMgr_init_adapter entry | ||
3322 | * | ||
3323 | * | ||
3324 | * Description: Setup adapter for normal operation (hard reset). | ||
3325 | * | ||
3326 | *---------------------------------------------------------------------*/ | ||
3327 | STATIC CARD_HANDLE init_adapter(PADAPTER_INFO pCardInfo) | ||
3328 | { | ||
3329 | PSCCBcard CurrCard; | ||
3330 | PNVRamInfo pCurrNvRam; | ||
3331 | u08bits i,j,thisCard, ScamFlg; | ||
3332 | u16bits temp,sync_bit_map,id; | ||
3333 | BASE_PORT ioport; | ||
3334 | |||
3335 | ioport = (BASE_PORT)pCardInfo->ai_baseaddr; | ||
3336 | |||
3337 | for(thisCard =0; thisCard <= MAX_CARDS; thisCard++) { | ||
3338 | |||
3339 | if (thisCard == MAX_CARDS) { | ||
3340 | |||
3341 | return(FAILURE); | ||
3342 | } | ||
3343 | |||
3344 | if (BL_Card[thisCard].ioPort == ioport) { | ||
3345 | |||
3346 | CurrCard = &BL_Card[thisCard]; | ||
3347 | SccbMgrTableInitCard(CurrCard,thisCard); | ||
3348 | break; | ||
3349 | } | ||
3350 | |||
3351 | else if (BL_Card[thisCard].ioPort == 0x00) { | ||
3352 | |||
3353 | BL_Card[thisCard].ioPort = ioport; | ||
3354 | CurrCard = &BL_Card[thisCard]; | ||
3355 | |||
3356 | if(mbCards) | ||
3357 | for(i = 0; i < mbCards; i++){ | ||
3358 | if(CurrCard->ioPort == nvRamInfo[i].niBaseAddr) | ||
3359 | CurrCard->pNvRamInfo = &nvRamInfo[i]; | ||
3360 | } | ||
3361 | SccbMgrTableInitCard(CurrCard,thisCard); | ||
3362 | CurrCard->cardIndex = thisCard; | ||
3363 | CurrCard->cardInfo = pCardInfo; | ||
3364 | |||
3365 | break; | ||
3366 | } | ||
3367 | } | ||
3368 | |||
3369 | pCurrNvRam = CurrCard->pNvRamInfo; | ||
3370 | |||
3371 | |||
3372 | if(pCurrNvRam){ | ||
3373 | ScamFlg = pCurrNvRam->niScamConf; | ||
3374 | } | ||
3375 | else{ | ||
3376 | ScamFlg = (UCHAR) utilEERead(ioport, SCAM_CONFIG/2); | ||
3377 | } | ||
3378 | |||
3379 | |||
3380 | BusMasterInit(ioport); | ||
3381 | XbowInit(ioport, ScamFlg); | ||
3382 | |||
3383 | #if defined (NO_BIOS_OPTION) | ||
3384 | |||
3385 | |||
3386 | if (DiagXbow(ioport)) return(FAILURE); | ||
3387 | if (DiagBusMaster(ioport)) return(FAILURE); | ||
3388 | |||
3389 | #endif /* No BIOS Option */ | ||
3390 | |||
3391 | autoLoadDefaultMap(ioport); | ||
3392 | |||
3393 | |||
3394 | for (i = 0,id = 0x01; i != pCardInfo->ai_id; i++,id <<= 1){} | ||
3395 | |||
3396 | WR_HARPOON(ioport+hp_selfid_0, id); | ||
3397 | WR_HARPOON(ioport+hp_selfid_1, 0x00); | ||
3398 | WR_HARPOON(ioport+hp_arb_id, pCardInfo->ai_id); | ||
3399 | CurrCard->ourId = (unsigned char) pCardInfo->ai_id; | ||
3400 | |||
3401 | i = (u08bits) pCardInfo->ai_stateinfo; | ||
3402 | if (i & SCSI_PARITY_ENA) | ||
3403 | WR_HARPOON(ioport+hp_portctrl_1,(HOST_MODE8 | CHK_SCSI_P)); | ||
3404 | |||
3405 | j = (RD_HARPOON(ioport+hp_bm_ctrl) & ~SCSI_TERM_ENA_L); | ||
3406 | if (i & LOW_BYTE_TERM_ENA) | ||
3407 | j |= SCSI_TERM_ENA_L; | ||
3408 | WR_HARPOON(ioport+hp_bm_ctrl, j); | ||
3409 | |||
3410 | j = (RD_HARPOON(ioport+hp_ee_ctrl) & ~SCSI_TERM_ENA_H); | ||
3411 | if (i & HIGH_BYTE_TERM_ENA) | ||
3412 | j |= SCSI_TERM_ENA_H; | ||
3413 | WR_HARPOON(ioport+hp_ee_ctrl, j ); | ||
3414 | |||
3415 | |||
3416 | if (!(pCardInfo->ai_stateinfo & NO_RESET_IN_INIT)) { | ||
3417 | |||
3418 | sresb(ioport,thisCard); | ||
3419 | |||
3420 | scini(thisCard, (u08bits) pCardInfo->ai_id, 0); | ||
3421 | } | ||
3422 | |||
3423 | |||
3424 | |||
3425 | if (pCardInfo->ai_stateinfo & SUPRESS_UNDERRRUNS_ENA) | ||
3426 | CurrCard->globalFlags |= F_NO_FILTER; | ||
3427 | |||
3428 | if(pCurrNvRam){ | ||
3429 | if(pCurrNvRam->niSysConf & 0x10) | ||
3430 | CurrCard->globalFlags |= F_GREEN_PC; | ||
3431 | } | ||
3432 | else{ | ||
3433 | if (utilEERead(ioport, (SYSTEM_CONFIG/2)) & GREEN_PC_ENA) | ||
3434 | CurrCard->globalFlags |= F_GREEN_PC; | ||
3435 | } | ||
3436 | |||
3437 | /* Set global flag to indicate Re-Negotiation to be done on all | ||
3438 | ckeck condition */ | ||
3439 | if(pCurrNvRam){ | ||
3440 | if(pCurrNvRam->niScsiConf & 0x04) | ||
3441 | CurrCard->globalFlags |= F_DO_RENEGO; | ||
3442 | } | ||
3443 | else{ | ||
3444 | if (utilEERead(ioport, (SCSI_CONFIG/2)) & RENEGO_ENA) | ||
3445 | CurrCard->globalFlags |= F_DO_RENEGO; | ||
3446 | } | ||
3447 | |||
3448 | if(pCurrNvRam){ | ||
3449 | if(pCurrNvRam->niScsiConf & 0x08) | ||
3450 | CurrCard->globalFlags |= F_CONLUN_IO; | ||
3451 | } | ||
3452 | else{ | ||
3453 | if (utilEERead(ioport, (SCSI_CONFIG/2)) & CONNIO_ENA) | ||
3454 | CurrCard->globalFlags |= F_CONLUN_IO; | ||
3455 | } | ||
3456 | |||
3457 | temp = pCardInfo->ai_per_targ_no_disc; | ||
3458 | |||
3459 | for (i = 0,id = 1; i < MAX_SCSI_TAR; i++, id <<= 1) { | ||
3460 | |||
3461 | if (temp & id) | ||
3462 | sccbMgrTbl[thisCard][i].TarStatus |= TAR_ALLOW_DISC; | ||
3463 | } | ||
3464 | |||
3465 | sync_bit_map = 0x0001; | ||
3466 | |||
3467 | for (id = 0; id < (MAX_SCSI_TAR/2); id++){ | ||
3468 | |||
3469 | if(pCurrNvRam){ | ||
3470 | temp = (USHORT) pCurrNvRam->niSyncTbl[id]; | ||
3471 | temp = ((temp & 0x03) + ((temp << 4) & 0xc0)) + | ||
3472 | (((temp << 4) & 0x0300) + ((temp << 8) & 0xc000)); | ||
3473 | }else | ||
3474 | temp = utilEERead(ioport, (u16bits)((SYNC_RATE_TBL/2)+id)); | ||
3475 | |||
3476 | for (i = 0; i < 2; temp >>=8,i++){ | ||
3477 | |||
3478 | if (pCardInfo->ai_per_targ_init_sync & sync_bit_map){ | ||
3479 | |||
3480 | sccbMgrTbl[thisCard][id*2+i].TarEEValue = (u08bits)temp; | ||
3481 | } | ||
3482 | |||
3483 | else { | ||
3484 | sccbMgrTbl[thisCard][id*2+i].TarStatus |= SYNC_SUPPORTED; | ||
3485 | sccbMgrTbl[thisCard][id*2+i].TarEEValue = | ||
3486 | (u08bits)(temp & ~EE_SYNC_MASK); | ||
3487 | } | ||
3488 | |||
3489 | #if defined(WIDE_SCSI) | ||
3490 | /* if ((pCardInfo->ai_per_targ_wide_nego & sync_bit_map) || | ||
3491 | (id*2+i >= 8)){ | ||
3492 | */ | ||
3493 | if (pCardInfo->ai_per_targ_wide_nego & sync_bit_map){ | ||
3494 | |||
3495 | sccbMgrTbl[thisCard][id*2+i].TarEEValue |= EE_WIDE_SCSI; | ||
3496 | |||
3497 | } | ||
3498 | |||
3499 | else { /* NARROW SCSI */ | ||
3500 | sccbMgrTbl[thisCard][id*2+i].TarStatus |= WIDE_NEGOCIATED; | ||
3501 | } | ||
3502 | |||
3503 | #else | ||
3504 | sccbMgrTbl[thisCard][id*2+i].TarStatus |= WIDE_NEGOCIATED; | ||
3505 | #endif | ||
3506 | |||
3507 | |||
3508 | sync_bit_map <<= 1; | ||
3509 | } | ||
3510 | } | ||
3511 | |||
3512 | |||
3513 | pCardInfo->ai_SGListFormat=0x01; | ||
3514 | pCardInfo->ai_DataPtrFormat=0x01; | ||
3515 | pCardInfo->ai_AEN_mask &= SCSI_RESET_COMPLETE; | ||
3516 | |||
3517 | WR_HARPOON((ioport+hp_semaphore), | ||
3518 | (u08bits)(RD_HARPOON((ioport+hp_semaphore)) | SCCB_MGR_PRESENT)); | ||
3519 | |||
3520 | return((u32bits)CurrCard); | ||
3521 | |||
3522 | } | ||
3523 | |||
3524 | |||
3525 | /*--------------------------------------------------------------------- | ||
3526 | * | ||
3527 | * Function: build_ucb, exported to BUDI via UCBMgr_build_ucb entry | ||
3528 | * | ||
3529 | * Description: prepare fw portion of ucb. do not start, resource not guaranteed | ||
3530 | * so don't manipulate anything that's derived from states which | ||
3531 | * may change | ||
3532 | * | ||
3533 | *---------------------------------------------------------------------*/ | ||
3534 | void build_UCB(CARD_HANDLE pCurrCard, PUCB p_ucb) | ||
3535 | { | ||
3536 | |||
3537 | u08bits thisCard; | ||
3538 | u08bits i,j; | ||
3539 | |||
3540 | PSCCB p_sccb; | ||
3541 | |||
3542 | |||
3543 | thisCard = ((PSCCBcard) pCurrCard)->cardIndex; | ||
3544 | |||
3545 | |||
3546 | p_sccb=(PSCCB)p_ucb->UCB_MgrPrivatePtr; | ||
3547 | |||
3548 | |||
3549 | p_sccb->Sccb_ucb_ptr=p_ucb; | ||
3550 | |||
3551 | switch (p_ucb->UCB_opcode & (OPC_DEVICE_RESET+OPC_XFER_SG+OPC_CHK_RESIDUAL)) | ||
3552 | { | ||
3553 | case OPC_DEVICE_RESET: | ||
3554 | p_sccb->OperationCode=RESET_COMMAND; | ||
3555 | break; | ||
3556 | case OPC_XFER_SG: | ||
3557 | p_sccb->OperationCode=SCATTER_GATHER_COMMAND; | ||
3558 | break; | ||
3559 | case OPC_XFER_SG+OPC_CHK_RESIDUAL: | ||
3560 | p_sccb->OperationCode=RESIDUAL_SG_COMMAND; | ||
3561 | break; | ||
3562 | case OPC_CHK_RESIDUAL: | ||
3563 | |||
3564 | p_sccb->OperationCode=RESIDUAL_COMMAND; | ||
3565 | break; | ||
3566 | default: | ||
3567 | p_sccb->OperationCode=SCSI_INITIATOR_COMMAND; | ||
3568 | break; | ||
3569 | } | ||
3570 | |||
3571 | if (p_ucb->UCB_opcode & OPC_TQ_ENABLE) | ||
3572 | { | ||
3573 | p_sccb->ControlByte = (u08bits)((p_ucb->UCB_opcode & OPC_TQ_MASK)>>2) | F_USE_CMD_Q; | ||
3574 | } | ||
3575 | else | ||
3576 | { | ||
3577 | p_sccb->ControlByte = 0; | ||
3578 | } | ||
3579 | |||
3580 | |||
3581 | p_sccb->CdbLength = (u08bits)p_ucb->UCB_cdblen; | ||
3582 | |||
3583 | if (p_ucb->UCB_opcode & OPC_NO_AUTO_SENSE) | ||
3584 | { | ||
3585 | p_sccb->RequestSenseLength = 0; | ||
3586 | } | ||
3587 | else | ||
3588 | { | ||
3589 | p_sccb->RequestSenseLength = (unsigned char) p_ucb->UCB_senselen; | ||
3590 | } | ||
3591 | |||
3592 | |||
3593 | if (p_ucb->UCB_opcode & OPC_XFER_SG) | ||
3594 | { | ||
3595 | p_sccb->DataPointer=p_ucb->UCB_virt_dataptr; | ||
3596 | p_sccb->DataLength = (((u32bits)p_ucb->UCB_NumSgElements)<<3); | ||
3597 | } | ||
3598 | else | ||
3599 | { | ||
3600 | p_sccb->DataPointer=p_ucb->UCB_phys_dataptr; | ||
3601 | p_sccb->DataLength=p_ucb->UCB_datalen; | ||
3602 | }; | ||
3603 | |||
3604 | p_sccb->HostStatus=0; | ||
3605 | p_sccb->TargetStatus=0; | ||
3606 | p_sccb->TargID=(unsigned char)p_ucb->UCB_targid; | ||
3607 | p_sccb->Lun=(unsigned char) p_ucb->UCB_lun; | ||
3608 | p_sccb->SccbIOPort=((PSCCBcard)pCurrCard)->ioPort; | ||
3609 | |||
3610 | j=p_ucb->UCB_cdblen; | ||
3611 | for (i=0;i<j;i++) | ||
3612 | { | ||
3613 | p_sccb->Cdb[i] = p_ucb->UCB_cdb[i]; | ||
3614 | } | ||
3615 | |||
3616 | p_sccb->SensePointer=p_ucb->UCB_phys_senseptr; | ||
3617 | |||
3618 | sinits(p_sccb,thisCard); | ||
3619 | |||
3620 | } | ||
3621 | #ifndef NO_IOCTLS | ||
3622 | |||
3623 | /*--------------------------------------------------------------------- | ||
3624 | * | ||
3625 | * Function: GetDevSyncRate | ||
3626 | * | ||
3627 | *---------------------------------------------------------------------*/ | ||
3628 | STATIC int GetDevSyncRate(PSCCBcard pCurrCard,PUCB p_ucb) | ||
3629 | { | ||
3630 | struct _SYNC_RATE_INFO * pSyncStr; | ||
3631 | PSCCBMgr_tar_info currTar_Info; | ||
3632 | BASE_PORT ioport; | ||
3633 | u08bits scsiID, j; | ||
3634 | |||
3635 | #if (FW_TYPE != _SCCB_MGR_) | ||
3636 | if( p_ucb->UCB_targid >= pCurrCard->cardInfo->ai_MaxTarg ) | ||
3637 | { | ||
3638 | return(1); | ||
3639 | } | ||
3640 | #endif | ||
3641 | |||
3642 | ioport = pCurrCard->ioPort; | ||
3643 | pSyncStr = (struct _SYNC_RATE_INFO *) p_ucb->UCB_virt_dataptr; | ||
3644 | scsiID = (u08bits) p_ucb->UCB_targid; | ||
3645 | currTar_Info = &sccbMgrTbl[pCurrCard->cardIndex][scsiID]; | ||
3646 | j = currTar_Info->TarSyncCtrl; | ||
3647 | |||
3648 | switch (currTar_Info->TarEEValue & EE_SYNC_MASK) | ||
3649 | { | ||
3650 | case EE_SYNC_ASYNC: | ||
3651 | pSyncStr->RequestMegaXferRate = 0x00; | ||
3652 | break; | ||
3653 | case EE_SYNC_5MB: | ||
3654 | pSyncStr->RequestMegaXferRate = (j & NARROW_SCSI) ? 50 : 100; | ||
3655 | break; | ||
3656 | case EE_SYNC_10MB: | ||
3657 | pSyncStr->RequestMegaXferRate = (j & NARROW_SCSI) ? 100 : 200; | ||
3658 | break; | ||
3659 | case EE_SYNC_20MB: | ||
3660 | pSyncStr->RequestMegaXferRate = (j & NARROW_SCSI) ? 200 : 400; | ||
3661 | break; | ||
3662 | } | ||
3663 | |||
3664 | switch ((j >> 5) & 0x07) | ||
3665 | { | ||
3666 | case 0x00: | ||
3667 | if((j & 0x07) == 0x00) | ||
3668 | { | ||
3669 | pSyncStr->ActualMegaXferRate = 0x00; /* Async Mode */ | ||
3670 | } | ||
3671 | else | ||
3672 | { | ||
3673 | pSyncStr->ActualMegaXferRate = (j & NARROW_SCSI) ? 200 : 400; | ||
3674 | } | ||
3675 | break; | ||
3676 | case 0x01: | ||
3677 | pSyncStr->ActualMegaXferRate = (j & NARROW_SCSI) ? 100 : 200; | ||
3678 | break; | ||
3679 | case 0x02: | ||
3680 | pSyncStr->ActualMegaXferRate = (j & NARROW_SCSI) ? 66 : 122; | ||
3681 | break; | ||
3682 | case 0x03: | ||
3683 | pSyncStr->ActualMegaXferRate = (j & NARROW_SCSI) ? 50 : 100; | ||
3684 | break; | ||
3685 | case 0x04: | ||
3686 | pSyncStr->ActualMegaXferRate = (j & NARROW_SCSI) ? 40 : 80; | ||
3687 | break; | ||
3688 | case 0x05: | ||
3689 | pSyncStr->ActualMegaXferRate = (j & NARROW_SCSI) ? 33 : 66; | ||
3690 | break; | ||
3691 | case 0x06: | ||
3692 | pSyncStr->ActualMegaXferRate = (j & NARROW_SCSI) ? 28 : 56; | ||
3693 | break; | ||
3694 | case 0x07: | ||
3695 | pSyncStr->ActualMegaXferRate = (j & NARROW_SCSI) ? 25 : 50; | ||
3696 | break; | ||
3697 | } | ||
3698 | pSyncStr->NegotiatedOffset = j & 0x0f; | ||
3699 | |||
3700 | return(0); | ||
3701 | } | ||
3702 | |||
3703 | /*--------------------------------------------------------------------- | ||
3704 | * | ||
3705 | * Function: SetDevSyncRate | ||
3706 | * | ||
3707 | *---------------------------------------------------------------------*/ | ||
3708 | STATIC int SetDevSyncRate(PSCCBcard pCurrCard, PUCB p_ucb) | ||
3709 | { | ||
3710 | struct _SYNC_RATE_INFO * pSyncStr; | ||
3711 | PSCCBMgr_tar_info currTar_Info; | ||
3712 | BASE_PORT ioPort; | ||
3713 | u08bits scsiID, i, j, syncVal; | ||
3714 | u16bits syncOffset, actualXferRate; | ||
3715 | union { | ||
3716 | u08bits tempb[2]; | ||
3717 | u16bits tempw; | ||
3718 | }temp2; | ||
3719 | |||
3720 | #if (FW_TYPE != _SCCB_MGR_) | ||
3721 | if( p_ucb->UCB_targid >= pCurrCard->cardInfo->ai_MaxTarg ) | ||
3722 | { | ||
3723 | return(1); | ||
3724 | } | ||
3725 | #endif | ||
3726 | |||
3727 | ioPort = pCurrCard->ioPort; | ||
3728 | pSyncStr = (struct _SYNC_RATE_INFO *) p_ucb->UCB_virt_dataptr; | ||
3729 | scsiID = (u08bits) p_ucb->UCB_targid; | ||
3730 | currTar_Info = &sccbMgrTbl[pCurrCard->cardIndex][scsiID]; | ||
3731 | i = RD_HARPOON(ioPort+hp_xfer_pad); /* Save current value */ | ||
3732 | WR_HARPOON(ioPort+hp_xfer_pad, (i | ID_UNLOCK)); | ||
3733 | WR_HARPOON(ioPort+hp_select_id, ((scsiID << 4) | scsiID)); | ||
3734 | j = RD_HARPOON(ioPort+hp_synctarg_0); | ||
3735 | WR_HARPOON(ioPort+hp_xfer_pad, i); /* restore value */ | ||
3736 | |||
3737 | actualXferRate = pSyncStr->ActualMegaXferRate; | ||
3738 | if(!(j & NARROW_SCSI)) | ||
3739 | { | ||
3740 | actualXferRate <<= 1; | ||
3741 | } | ||
3742 | if(actualXferRate == 0x00) | ||
3743 | { | ||
3744 | syncVal = EE_SYNC_ASYNC; /* Async Mode */ | ||
3745 | } | ||
3746 | if(actualXferRate == 0x0200) | ||
3747 | { | ||
3748 | syncVal = EE_SYNC_20MB; /* 20/40 MB Mode */ | ||
3749 | } | ||
3750 | if(actualXferRate > 0x0050 && actualXferRate < 0x0200 ) | ||
3751 | { | ||
3752 | syncVal = EE_SYNC_10MB; /* 10/20 MB Mode */ | ||
3753 | } | ||
3754 | else | ||
3755 | { | ||
3756 | syncVal = EE_SYNC_5MB; /* 5/10 MB Mode */ | ||
3757 | } | ||
3758 | if(currTar_Info->TarEEValue && EE_SYNC_MASK == syncVal) | ||
3759 | return(0); | ||
3760 | currTar_Info->TarEEValue = (currTar_Info->TarEEValue & !EE_SYNC_MASK) | ||
3761 | | syncVal; | ||
3762 | syncOffset = (SYNC_RATE_TBL + scsiID) / 2; | ||
3763 | temp2.tempw = utilEERead(ioPort, syncOffset); | ||
3764 | if(scsiID & 0x01) | ||
3765 | { | ||
3766 | temp2.tempb[0] = (temp2.tempb[0] & !EE_SYNC_MASK) | syncVal; | ||
3767 | } | ||
3768 | else | ||
3769 | { | ||
3770 | temp2.tempb[1] = (temp2.tempb[1] & !EE_SYNC_MASK) | syncVal; | ||
3771 | } | ||
3772 | utilEEWriteOnOff(ioPort, 1); | ||
3773 | utilEEWrite(ioPort, temp2.tempw, syncOffset); | ||
3774 | utilEEWriteOnOff(ioPort, 0); | ||
3775 | UpdateCheckSum(ioPort); | ||
3776 | |||
3777 | return(0); | ||
3778 | } | ||
3779 | /*--------------------------------------------------------------------- | ||
3780 | * | ||
3781 | * Function: GetDevWideMode | ||
3782 | * | ||
3783 | *---------------------------------------------------------------------*/ | ||
3784 | int GetDevWideMode(PSCCBcard pCurrCard,PUCB p_ucb) | ||
3785 | { | ||
3786 | u08bits *pData; | ||
3787 | |||
3788 | pData = (u08bits *)p_ucb->UCB_virt_dataptr; | ||
3789 | if(sccbMgrTbl[pCurrCard->cardIndex][p_ucb->UCB_targid].TarEEValue | ||
3790 | & EE_WIDE_SCSI) | ||
3791 | { | ||
3792 | *pData = 1; | ||
3793 | } | ||
3794 | else | ||
3795 | { | ||
3796 | *pData = 0; | ||
3797 | } | ||
3798 | |||
3799 | return(0); | ||
3800 | } | ||
3801 | |||
3802 | /*--------------------------------------------------------------------- | ||
3803 | * | ||
3804 | * Function: SetDevWideMode | ||
3805 | * | ||
3806 | *---------------------------------------------------------------------*/ | ||
3807 | int SetDevWideMode(PSCCBcard pCurrCard,PUCB p_ucb) | ||
3808 | { | ||
3809 | u08bits *pData; | ||
3810 | PSCCBMgr_tar_info currTar_Info; | ||
3811 | BASE_PORT ioPort; | ||
3812 | u08bits scsiID, scsiWideMode; | ||
3813 | u16bits syncOffset; | ||
3814 | union { | ||
3815 | u08bits tempb[2]; | ||
3816 | u16bits tempw; | ||
3817 | }temp2; | ||
3818 | |||
3819 | #if (FW_TYPE != _SCCB_MGR_) | ||
3820 | if( !(pCurrCard->cardInfo->ai_attributes & WIDE_CAPABLE) ) | ||
3821 | { | ||
3822 | return(1); | ||
3823 | } | ||
3824 | |||
3825 | if( p_ucb->UCB_targid >= pCurrCard->cardInfo->ai_MaxTarg ) | ||
3826 | { | ||
3827 | return(1); | ||
3828 | } | ||
3829 | #endif | ||
3830 | |||
3831 | ioPort = pCurrCard->ioPort; | ||
3832 | pData = (u08bits *)p_ucb->UCB_virt_dataptr; | ||
3833 | scsiID = (u08bits) p_ucb->UCB_targid; | ||
3834 | currTar_Info = &sccbMgrTbl[pCurrCard->cardIndex][scsiID]; | ||
3835 | |||
3836 | if(*pData) | ||
3837 | { | ||
3838 | if(currTar_Info->TarEEValue & EE_WIDE_SCSI) | ||
3839 | { | ||
3840 | return(0); | ||
3841 | } | ||
3842 | else | ||
3843 | { | ||
3844 | scsiWideMode = EE_WIDE_SCSI; | ||
3845 | } | ||
3846 | } | ||
3847 | else | ||
3848 | { | ||
3849 | if(!(currTar_Info->TarEEValue & EE_WIDE_SCSI)) | ||
3850 | { | ||
3851 | return(0); | ||
3852 | } | ||
3853 | else | ||
3854 | { | ||
3855 | scsiWideMode = 0; | ||
3856 | } | ||
3857 | } | ||
3858 | currTar_Info->TarEEValue = (currTar_Info->TarEEValue & !EE_WIDE_SCSI) | ||
3859 | | scsiWideMode; | ||
3860 | |||
3861 | syncOffset = (SYNC_RATE_TBL + scsiID) / 2; | ||
3862 | temp2.tempw = utilEERead(ioPort, syncOffset); | ||
3863 | if(scsiID & 0x01) | ||
3864 | { | ||
3865 | temp2.tempb[0] = (temp2.tempb[0] & !EE_WIDE_SCSI) | scsiWideMode; | ||
3866 | } | ||
3867 | else | ||
3868 | { | ||
3869 | temp2.tempb[1] = (temp2.tempb[1] & !EE_WIDE_SCSI) | scsiWideMode; | ||
3870 | } | ||
3871 | utilEEWriteOnOff(ioPort, 1); | ||
3872 | utilEEWrite(ioPort, temp2.tempw, syncOffset); | ||
3873 | utilEEWriteOnOff(ioPort, 0); | ||
3874 | UpdateCheckSum(ioPort); | ||
3875 | |||
3876 | return(0); | ||
3877 | } | ||
3878 | |||
3879 | /*--------------------------------------------------------------------- | ||
3880 | * | ||
3881 | * Function: ReadNVRam | ||
3882 | * | ||
3883 | *---------------------------------------------------------------------*/ | ||
3884 | void ReadNVRam(PSCCBcard pCurrCard,PUCB p_ucb) | ||
3885 | { | ||
3886 | u08bits *pdata; | ||
3887 | u16bits i,numwrds,numbytes,offset,temp; | ||
3888 | u08bits OneMore = FALSE; | ||
3889 | #if defined(DOS) | ||
3890 | u16bits ioport; | ||
3891 | #else | ||
3892 | u32bits ioport; | ||
3893 | #endif | ||
3894 | |||
3895 | numbytes = (u16bits) p_ucb->UCB_datalen; | ||
3896 | ioport = pCurrCard->ioPort; | ||
3897 | pdata = (u08bits *) p_ucb->UCB_virt_dataptr; | ||
3898 | offset = (u16bits) (p_ucb->UCB_IOCTLParams[0]); | ||
3899 | |||
3900 | |||
3901 | |||
3902 | if (offset & 0x1) | ||
3903 | { | ||
3904 | *((u16bits*) pdata) = utilEERead(ioport,(u16bits)((offset - 1) / 2)); /* 16 bit read */ | ||
3905 | *pdata = *(pdata + 1); | ||
3906 | ++offset; | ||
3907 | ++pdata; | ||
3908 | --numbytes; | ||
3909 | } | ||
3910 | |||
3911 | numwrds = numbytes / 2; | ||
3912 | if (numbytes & 1) | ||
3913 | OneMore = TRUE; | ||
3914 | |||
3915 | for (i = 0; i < numwrds; i++) | ||
3916 | { | ||
3917 | *((u16bits*) pdata) = utilEERead(ioport,(u16bits)(offset / 2)); | ||
3918 | pdata += 2; | ||
3919 | offset += 2; | ||
3920 | } | ||
3921 | if (OneMore) | ||
3922 | { | ||
3923 | --pdata; | ||
3924 | -- offset; | ||
3925 | temp = utilEERead(ioport,(u16bits)(offset / 2)); | ||
3926 | *pdata = (u08bits) (temp); | ||
3927 | } | ||
3928 | |||
3929 | } /* end proc ReadNVRam */ | ||
3930 | |||
3931 | |||
3932 | /*--------------------------------------------------------------------- | ||
3933 | * | ||
3934 | * Function: WriteNVRam | ||
3935 | * | ||
3936 | *---------------------------------------------------------------------*/ | ||
3937 | void WriteNVRam(PSCCBcard pCurrCard,PUCB p_ucb) | ||
3938 | { | ||
3939 | u08bits *pdata; | ||
3940 | u16bits i,numwrds,numbytes,offset, eeprom_end; | ||
3941 | u08bits OneMore = FALSE; | ||
3942 | union { | ||
3943 | u08bits tempb[2]; | ||
3944 | u16bits tempw; | ||
3945 | } temp2; | ||
3946 | |||
3947 | #if defined(DOS) | ||
3948 | u16bits ioport; | ||
3949 | #else | ||
3950 | u32bits ioport; | ||
3951 | #endif | ||
3952 | |||
3953 | numbytes = (u16bits) p_ucb->UCB_datalen; | ||
3954 | ioport = pCurrCard->ioPort; | ||
3955 | pdata = (u08bits *) p_ucb->UCB_virt_dataptr; | ||
3956 | offset = (u16bits) (p_ucb->UCB_IOCTLParams[0]); | ||
3957 | |||
3958 | if (RD_HARPOON(ioport+hp_page_ctrl) & NARROW_SCSI_CARD) | ||
3959 | eeprom_end = 512; | ||
3960 | else | ||
3961 | eeprom_end = 768; | ||
3962 | |||
3963 | if(offset > eeprom_end) | ||
3964 | return; | ||
3965 | |||
3966 | if((offset + numbytes) > eeprom_end) | ||
3967 | numbytes = eeprom_end - offset; | ||
3968 | |||
3969 | utilEEWriteOnOff(ioport,1); /* Enable write access to the EEPROM */ | ||
3970 | |||
3971 | |||
3972 | |||
3973 | if (offset & 0x1) | ||
3974 | { | ||
3975 | temp2.tempw = utilEERead(ioport,(u16bits)((offset - 1) / 2)); /* 16 bit read */ | ||
3976 | temp2.tempb[1] = *pdata; | ||
3977 | utilEEWrite(ioport, temp2.tempw, (u16bits)((offset -1) / 2)); | ||
3978 | *pdata = *(pdata + 1); | ||
3979 | ++offset; | ||
3980 | ++pdata; | ||
3981 | --numbytes; | ||
3982 | } | ||
3983 | |||
3984 | numwrds = numbytes / 2; | ||
3985 | if (numbytes & 1) | ||
3986 | OneMore = TRUE; | ||
3987 | |||
3988 | for (i = 0; i < numwrds; i++) | ||
3989 | { | ||
3990 | utilEEWrite(ioport, *((pu16bits)pdata),(u16bits)(offset / 2)); | ||
3991 | pdata += 2; | ||
3992 | offset += 2; | ||
3993 | } | ||
3994 | if (OneMore) | ||
3995 | { | ||
3996 | |||
3997 | temp2.tempw = utilEERead(ioport,(u16bits)(offset / 2)); | ||
3998 | temp2.tempb[0] = *pdata; | ||
3999 | utilEEWrite(ioport, temp2.tempw, (u16bits)(offset / 2)); | ||
4000 | } | ||
4001 | utilEEWriteOnOff(ioport,0); /* Turn off write access */ | ||
4002 | UpdateCheckSum((u32bits)ioport); | ||
4003 | |||
4004 | } /* end proc WriteNVRam */ | ||
4005 | |||
4006 | |||
4007 | |||
4008 | /*--------------------------------------------------------------------- | ||
4009 | * | ||
4010 | * Function: UpdateCheckSum | ||
4011 | * | ||
4012 | * Description: Update Check Sum in EEPROM | ||
4013 | * | ||
4014 | *---------------------------------------------------------------------*/ | ||
4015 | |||
4016 | |||
4017 | void UpdateCheckSum(u32bits baseport) | ||
4018 | { | ||
4019 | USHORT i,sum_data, eeprom_end; | ||
4020 | |||
4021 | sum_data = 0x0000; | ||
4022 | |||
4023 | |||
4024 | if (RD_HARPOON(baseport+hp_page_ctrl) & NARROW_SCSI_CARD) | ||
4025 | eeprom_end = 512; | ||
4026 | else | ||
4027 | eeprom_end = 768; | ||
4028 | |||
4029 | for (i = 1; i < eeprom_end/2; i++) | ||
4030 | { | ||
4031 | sum_data += utilEERead(baseport, i); | ||
4032 | } | ||
4033 | |||
4034 | utilEEWriteOnOff(baseport,1); /* Enable write access to the EEPROM */ | ||
4035 | |||
4036 | utilEEWrite(baseport, sum_data, EEPROM_CHECK_SUM/2); | ||
4037 | utilEEWriteOnOff(baseport,0); /* Turn off write access */ | ||
4038 | } | ||
4039 | |||
4040 | void SccbMgr_save_foreign_state(PADAPTER_INFO pAdapterInfo) | ||
4041 | { | ||
4042 | } | ||
4043 | |||
4044 | |||
4045 | void SccbMgr_restore_foreign_state(CARD_HANDLE pCurrCard) | ||
4046 | { | ||
4047 | } | ||
4048 | |||
4049 | void SccbMgr_restore_native_state(CARD_HANDLE pCurrCard) | ||
4050 | { | ||
4051 | } | ||
4052 | |||
4053 | #endif /* NO_IOCTLS */ | ||
4054 | |||
4055 | #endif /* (FW_TYPE==_UCB_MGR_) */ | ||
4056 | |||
4057 | #ifndef NO_IOCTLS | ||
4058 | #if (FW_TYPE==_UCB_MGR_) | ||
4059 | void SccbMgr_unload_card(CARD_HANDLE pCurrCard) | ||
4060 | #else | ||
4061 | #if defined(DOS) | ||
4062 | void SccbMgr_unload_card(USHORT pCurrCard) | ||
4063 | #else | ||
4064 | void SccbMgr_unload_card(ULONG pCurrCard) | ||
4065 | #endif | ||
4066 | #endif | ||
4067 | { | 1942 | { |
4068 | UCHAR i; | 1943 | UCHAR i; |
4069 | #if defined(DOS) | ||
4070 | USHORT portBase; | ||
4071 | USHORT regOffset; | ||
4072 | #else | ||
4073 | ULONG portBase; | 1944 | ULONG portBase; |
4074 | ULONG regOffset; | 1945 | ULONG regOffset; |
4075 | #endif | ||
4076 | ULONG scamData; | 1946 | ULONG scamData; |
4077 | #if defined(OS2) | ||
4078 | ULONG far *pScamTbl; | ||
4079 | #else | ||
4080 | ULONG *pScamTbl; | 1947 | ULONG *pScamTbl; |
4081 | #endif | ||
4082 | PNVRamInfo pCurrNvRam; | 1948 | PNVRamInfo pCurrNvRam; |
4083 | 1949 | ||
4084 | pCurrNvRam = ((PSCCBcard)pCurrCard)->pNvRamInfo; | 1950 | pCurrNvRam = ((PSCCBcard)pCurrCard)->pNvRamInfo; |
4085 | 1951 | ||
4086 | if(pCurrNvRam){ | 1952 | if(pCurrNvRam){ |
4087 | WrStack(pCurrNvRam->niBaseAddr, 0, pCurrNvRam->niModel); | 1953 | FPT_WrStack(pCurrNvRam->niBaseAddr, 0, pCurrNvRam->niModel); |
4088 | WrStack(pCurrNvRam->niBaseAddr, 1, pCurrNvRam->niSysConf); | 1954 | FPT_WrStack(pCurrNvRam->niBaseAddr, 1, pCurrNvRam->niSysConf); |
4089 | WrStack(pCurrNvRam->niBaseAddr, 2, pCurrNvRam->niScsiConf); | 1955 | FPT_WrStack(pCurrNvRam->niBaseAddr, 2, pCurrNvRam->niScsiConf); |
4090 | WrStack(pCurrNvRam->niBaseAddr, 3, pCurrNvRam->niScamConf); | 1956 | FPT_WrStack(pCurrNvRam->niBaseAddr, 3, pCurrNvRam->niScamConf); |
4091 | WrStack(pCurrNvRam->niBaseAddr, 4, pCurrNvRam->niAdapId); | 1957 | FPT_WrStack(pCurrNvRam->niBaseAddr, 4, pCurrNvRam->niAdapId); |
4092 | 1958 | ||
4093 | for(i = 0; i < MAX_SCSI_TAR / 2; i++) | 1959 | for(i = 0; i < MAX_SCSI_TAR / 2; i++) |
4094 | WrStack(pCurrNvRam->niBaseAddr, (UCHAR)(i+5), pCurrNvRam->niSyncTbl[i]); | 1960 | FPT_WrStack(pCurrNvRam->niBaseAddr, (UCHAR)(i+5), pCurrNvRam->niSyncTbl[i]); |
4095 | 1961 | ||
4096 | portBase = pCurrNvRam->niBaseAddr; | 1962 | portBase = pCurrNvRam->niBaseAddr; |
4097 | 1963 | ||
4098 | for(i = 0; i < MAX_SCSI_TAR; i++){ | 1964 | for(i = 0; i < MAX_SCSI_TAR; i++){ |
4099 | regOffset = hp_aramBase + 64 + i*4; | 1965 | regOffset = hp_aramBase + 64 + i*4; |
4100 | #if defined(OS2) | ||
4101 | pScamTbl = (ULONG far *) &pCurrNvRam->niScamTbl[i]; | ||
4102 | #else | ||
4103 | pScamTbl = (ULONG *) &pCurrNvRam->niScamTbl[i]; | 1966 | pScamTbl = (ULONG *) &pCurrNvRam->niScamTbl[i]; |
4104 | #endif | ||
4105 | scamData = *pScamTbl; | 1967 | scamData = *pScamTbl; |
4106 | WR_HARP32(portBase, regOffset, scamData); | 1968 | WR_HARP32(portBase, regOffset, scamData); |
4107 | } | 1969 | } |
4108 | 1970 | ||
4109 | }else{ | 1971 | }else{ |
4110 | WrStack(((PSCCBcard)pCurrCard)->ioPort, 0, 0); | 1972 | FPT_WrStack(((PSCCBcard)pCurrCard)->ioPort, 0, 0); |
4111 | } | 1973 | } |
4112 | } | 1974 | } |
4113 | #endif /* NO_IOCTLS */ | ||
4114 | 1975 | ||
4115 | 1976 | ||
4116 | void RNVRamData(PNVRamInfo pNvRamInfo) | 1977 | static void FPT_RNVRamData(PNVRamInfo pNvRamInfo) |
4117 | { | 1978 | { |
4118 | UCHAR i; | 1979 | UCHAR i; |
4119 | #if defined(DOS) | ||
4120 | USHORT portBase; | ||
4121 | USHORT regOffset; | ||
4122 | #else | ||
4123 | ULONG portBase; | 1980 | ULONG portBase; |
4124 | ULONG regOffset; | 1981 | ULONG regOffset; |
4125 | #endif | ||
4126 | ULONG scamData; | 1982 | ULONG scamData; |
4127 | #if defined (OS2) | ||
4128 | ULONG far *pScamTbl; | ||
4129 | #else | ||
4130 | ULONG *pScamTbl; | 1983 | ULONG *pScamTbl; |
4131 | #endif | ||
4132 | 1984 | ||
4133 | pNvRamInfo->niModel = RdStack(pNvRamInfo->niBaseAddr, 0); | 1985 | pNvRamInfo->niModel = FPT_RdStack(pNvRamInfo->niBaseAddr, 0); |
4134 | pNvRamInfo->niSysConf = RdStack(pNvRamInfo->niBaseAddr, 1); | 1986 | pNvRamInfo->niSysConf = FPT_RdStack(pNvRamInfo->niBaseAddr, 1); |
4135 | pNvRamInfo->niScsiConf = RdStack(pNvRamInfo->niBaseAddr, 2); | 1987 | pNvRamInfo->niScsiConf = FPT_RdStack(pNvRamInfo->niBaseAddr, 2); |
4136 | pNvRamInfo->niScamConf = RdStack(pNvRamInfo->niBaseAddr, 3); | 1988 | pNvRamInfo->niScamConf = FPT_RdStack(pNvRamInfo->niBaseAddr, 3); |
4137 | pNvRamInfo->niAdapId = RdStack(pNvRamInfo->niBaseAddr, 4); | 1989 | pNvRamInfo->niAdapId = FPT_RdStack(pNvRamInfo->niBaseAddr, 4); |
4138 | 1990 | ||
4139 | for(i = 0; i < MAX_SCSI_TAR / 2; i++) | 1991 | for(i = 0; i < MAX_SCSI_TAR / 2; i++) |
4140 | pNvRamInfo->niSyncTbl[i] = RdStack(pNvRamInfo->niBaseAddr, (UCHAR)(i+5)); | 1992 | pNvRamInfo->niSyncTbl[i] = FPT_RdStack(pNvRamInfo->niBaseAddr, (UCHAR)(i+5)); |
4141 | 1993 | ||
4142 | portBase = pNvRamInfo->niBaseAddr; | 1994 | portBase = pNvRamInfo->niBaseAddr; |
4143 | 1995 | ||
4144 | for(i = 0; i < MAX_SCSI_TAR; i++){ | 1996 | for(i = 0; i < MAX_SCSI_TAR; i++){ |
4145 | regOffset = hp_aramBase + 64 + i*4; | 1997 | regOffset = hp_aramBase + 64 + i*4; |
4146 | RD_HARP32(portBase, regOffset, scamData); | 1998 | RD_HARP32(portBase, regOffset, scamData); |
4147 | #if defined(OS2) | ||
4148 | pScamTbl = (ULONG far *) &pNvRamInfo->niScamTbl[i]; | ||
4149 | #else | ||
4150 | pScamTbl = (ULONG *) &pNvRamInfo->niScamTbl[i]; | 1999 | pScamTbl = (ULONG *) &pNvRamInfo->niScamTbl[i]; |
4151 | #endif | ||
4152 | *pScamTbl = scamData; | 2000 | *pScamTbl = scamData; |
4153 | } | 2001 | } |
4154 | 2002 | ||
4155 | } | 2003 | } |
4156 | 2004 | ||
4157 | #if defined(DOS) | 2005 | static UCHAR FPT_RdStack(ULONG portBase, UCHAR index) |
4158 | UCHAR RdStack(USHORT portBase, UCHAR index) | ||
4159 | #else | ||
4160 | UCHAR RdStack(ULONG portBase, UCHAR index) | ||
4161 | #endif | ||
4162 | { | 2006 | { |
4163 | WR_HARPOON(portBase + hp_stack_addr, index); | 2007 | WR_HARPOON(portBase + hp_stack_addr, index); |
4164 | return(RD_HARPOON(portBase + hp_stack_data)); | 2008 | return(RD_HARPOON(portBase + hp_stack_data)); |
4165 | } | 2009 | } |
4166 | 2010 | ||
4167 | #if defined(DOS) | 2011 | static void FPT_WrStack(ULONG portBase, UCHAR index, UCHAR data) |
4168 | void WrStack(USHORT portBase, UCHAR index, UCHAR data) | ||
4169 | #else | ||
4170 | void WrStack(ULONG portBase, UCHAR index, UCHAR data) | ||
4171 | #endif | ||
4172 | { | 2012 | { |
4173 | WR_HARPOON(portBase + hp_stack_addr, index); | 2013 | WR_HARPOON(portBase + hp_stack_addr, index); |
4174 | WR_HARPOON(portBase + hp_stack_data, data); | 2014 | WR_HARPOON(portBase + hp_stack_data, data); |
4175 | } | 2015 | } |
4176 | 2016 | ||
4177 | 2017 | ||
4178 | #if (FW_TYPE==_UCB_MGR_) | 2018 | static UCHAR FPT_ChkIfChipInitialized(ULONG ioPort) |
4179 | u08bits ChkIfChipInitialized(BASE_PORT ioPort) | ||
4180 | #else | ||
4181 | #if defined(DOS) | ||
4182 | UCHAR ChkIfChipInitialized(USHORT ioPort) | ||
4183 | #else | ||
4184 | UCHAR ChkIfChipInitialized(ULONG ioPort) | ||
4185 | #endif | ||
4186 | #endif | ||
4187 | { | 2019 | { |
4188 | if((RD_HARPOON(ioPort + hp_arb_id) & 0x0f) != RdStack(ioPort, 4)) | 2020 | if((RD_HARPOON(ioPort + hp_arb_id) & 0x0f) != FPT_RdStack(ioPort, 4)) |
4189 | return(FALSE); | 2021 | return(0); |
4190 | if((RD_HARPOON(ioPort + hp_clkctrl_0) & CLKCTRL_DEFAULT) | 2022 | if((RD_HARPOON(ioPort + hp_clkctrl_0) & CLKCTRL_DEFAULT) |
4191 | != CLKCTRL_DEFAULT) | 2023 | != CLKCTRL_DEFAULT) |
4192 | return(FALSE); | 2024 | return(0); |
4193 | if((RD_HARPOON(ioPort + hp_seltimeout) == TO_250ms) || | 2025 | if((RD_HARPOON(ioPort + hp_seltimeout) == TO_250ms) || |
4194 | (RD_HARPOON(ioPort + hp_seltimeout) == TO_290ms)) | 2026 | (RD_HARPOON(ioPort + hp_seltimeout) == TO_290ms)) |
4195 | return(TRUE); | 2027 | return(1); |
4196 | return(FALSE); | 2028 | return(0); |
4197 | 2029 | ||
4198 | } | 2030 | } |
4199 | /*--------------------------------------------------------------------- | 2031 | /*--------------------------------------------------------------------- |
@@ -4205,185 +2037,29 @@ UCHAR ChkIfChipInitialized(ULONG ioPort) | |||
4205 | * callback function. | 2037 | * callback function. |
4206 | * | 2038 | * |
4207 | *---------------------------------------------------------------------*/ | 2039 | *---------------------------------------------------------------------*/ |
4208 | #if (FW_TYPE==_UCB_MGR_) | 2040 | static void SccbMgr_start_sccb(ULONG pCurrCard, PSCCB p_Sccb) |
4209 | void SccbMgr_start_sccb(CARD_HANDLE pCurrCard, PUCB p_ucb) | ||
4210 | #else | ||
4211 | #if defined(DOS) | ||
4212 | void SccbMgr_start_sccb(USHORT pCurrCard, PSCCB p_Sccb) | ||
4213 | #else | ||
4214 | void SccbMgr_start_sccb(ULONG pCurrCard, PSCCB p_Sccb) | ||
4215 | #endif | ||
4216 | #endif | ||
4217 | { | 2041 | { |
4218 | #if defined(DOS) | ||
4219 | USHORT ioport; | ||
4220 | #else | ||
4221 | ULONG ioport; | 2042 | ULONG ioport; |
4222 | #endif | ||
4223 | UCHAR thisCard, lun; | 2043 | UCHAR thisCard, lun; |
4224 | PSCCB pSaveSccb; | 2044 | PSCCB pSaveSccb; |
4225 | CALL_BK_FN callback; | 2045 | CALL_BK_FN callback; |
4226 | 2046 | ||
4227 | #if (FW_TYPE==_UCB_MGR_) | ||
4228 | PSCCB p_Sccb; | ||
4229 | #endif | ||
4230 | |||
4231 | mOS_Lock((PSCCBcard)pCurrCard); | ||
4232 | thisCard = ((PSCCBcard) pCurrCard)->cardIndex; | 2047 | thisCard = ((PSCCBcard) pCurrCard)->cardIndex; |
4233 | ioport = ((PSCCBcard) pCurrCard)->ioPort; | 2048 | ioport = ((PSCCBcard) pCurrCard)->ioPort; |
4234 | 2049 | ||
4235 | #if (FW_TYPE==_UCB_MGR_) | ||
4236 | p_Sccb = (PSCCB)p_ucb->UCB_MgrPrivatePtr; | ||
4237 | #endif | ||
4238 | |||
4239 | if((p_Sccb->TargID > MAX_SCSI_TAR) || (p_Sccb->Lun > MAX_LUN)) | 2050 | if((p_Sccb->TargID > MAX_SCSI_TAR) || (p_Sccb->Lun > MAX_LUN)) |
4240 | { | 2051 | { |
4241 | 2052 | ||
4242 | #if (FW_TYPE==_UCB_MGR_) | ||
4243 | p_ucb->UCB_hbastat = SCCB_COMPLETE; | ||
4244 | p_ucb->UCB_status=SCCB_ERROR; | ||
4245 | callback = (CALL_BK_FN)p_ucb->UCB_callback; | ||
4246 | if (callback) | ||
4247 | callback(p_ucb); | ||
4248 | #endif | ||
4249 | |||
4250 | #if (FW_TYPE==_SCCB_MGR_) | ||
4251 | p_Sccb->HostStatus = SCCB_COMPLETE; | 2053 | p_Sccb->HostStatus = SCCB_COMPLETE; |
4252 | p_Sccb->SccbStatus = SCCB_ERROR; | 2054 | p_Sccb->SccbStatus = SCCB_ERROR; |
4253 | callback = (CALL_BK_FN)p_Sccb->SccbCallback; | 2055 | callback = (CALL_BK_FN)p_Sccb->SccbCallback; |
4254 | if (callback) | 2056 | if (callback) |
4255 | callback(p_Sccb); | 2057 | callback(p_Sccb); |
4256 | #endif | ||
4257 | 2058 | ||
4258 | mOS_UnLock((PSCCBcard)pCurrCard); | ||
4259 | return; | 2059 | return; |
4260 | } | 2060 | } |
4261 | 2061 | ||
4262 | #if (FW_TYPE==_SCCB_MGR_) | 2062 | FPT_sinits(p_Sccb,thisCard); |
4263 | sinits(p_Sccb,thisCard); | ||
4264 | #endif | ||
4265 | |||
4266 | |||
4267 | #if (FW_TYPE==_UCB_MGR_) | ||
4268 | #ifndef NO_IOCTLS | ||
4269 | |||
4270 | if (p_ucb->UCB_opcode & OPC_IOCTL) | ||
4271 | { | ||
4272 | |||
4273 | switch (p_ucb->UCB_IOCTLCommand) | ||
4274 | { | ||
4275 | case READ_NVRAM: | ||
4276 | ReadNVRam((PSCCBcard)pCurrCard,p_ucb); | ||
4277 | p_ucb->UCB_status=UCB_SUCCESS; | ||
4278 | callback = (CALL_BK_FN)p_ucb->UCB_callback; | ||
4279 | if (callback) | ||
4280 | callback(p_ucb); | ||
4281 | mOS_UnLock((PSCCBcard)pCurrCard); | ||
4282 | return; | ||
4283 | |||
4284 | case WRITE_NVRAM: | ||
4285 | WriteNVRam((PSCCBcard)pCurrCard,p_ucb); | ||
4286 | p_ucb->UCB_status=UCB_SUCCESS; | ||
4287 | callback = (CALL_BK_FN)p_ucb->UCB_callback; | ||
4288 | if (callback) | ||
4289 | callback(p_ucb); | ||
4290 | mOS_UnLock((PSCCBcard)pCurrCard); | ||
4291 | return; | ||
4292 | |||
4293 | case SEND_SCSI_PASSTHRU: | ||
4294 | #if (FW_TYPE != _SCCB_MGR_) | ||
4295 | if( p_ucb->UCB_targid >= | ||
4296 | ((PSCCBcard)pCurrCard)->cardInfo->ai_MaxTarg ) | ||
4297 | { | ||
4298 | p_ucb->UCB_status = UCB_ERROR; | ||
4299 | p_ucb->UCB_hbastat = HASTAT_HW_ERROR; | ||
4300 | callback = (CALL_BK_FN)p_ucb->UCB_callback; | ||
4301 | if (callback) | ||
4302 | callback(p_ucb); | ||
4303 | mOS_UnLock((PSCCBcard)pCurrCard); | ||
4304 | return; | ||
4305 | } | ||
4306 | #endif | ||
4307 | break; | ||
4308 | |||
4309 | case HARD_RESET: | ||
4310 | p_ucb->UCB_status = UCB_INVALID; | ||
4311 | callback = (CALL_BK_FN)p_ucb->UCB_callback; | ||
4312 | if (callback) | ||
4313 | callback(p_ucb); | ||
4314 | mOS_UnLock((PSCCBcard)pCurrCard); | ||
4315 | return; | ||
4316 | case GET_DEVICE_SYNCRATE: | ||
4317 | if( !GetDevSyncRate((PSCCBcard)pCurrCard,p_ucb) ) | ||
4318 | { | ||
4319 | p_ucb->UCB_status = UCB_SUCCESS; | ||
4320 | } | ||
4321 | else | ||
4322 | { | ||
4323 | p_ucb->UCB_status = UCB_ERROR; | ||
4324 | p_ucb->UCB_hbastat = HASTAT_HW_ERROR; | ||
4325 | } | ||
4326 | callback = (CALL_BK_FN)p_ucb->UCB_callback; | ||
4327 | if (callback) | ||
4328 | callback(p_ucb); | ||
4329 | mOS_UnLock((PSCCBcard)pCurrCard); | ||
4330 | return; | ||
4331 | case SET_DEVICE_SYNCRATE: | ||
4332 | if( !SetDevSyncRate((PSCCBcard)pCurrCard,p_ucb) ) | ||
4333 | { | ||
4334 | p_ucb->UCB_status = UCB_SUCCESS; | ||
4335 | } | ||
4336 | else | ||
4337 | { | ||
4338 | p_ucb->UCB_status = UCB_ERROR; | ||
4339 | p_ucb->UCB_hbastat = HASTAT_HW_ERROR; | ||
4340 | } | ||
4341 | callback = (CALL_BK_FN)p_ucb->UCB_callback; | ||
4342 | if (callback) | ||
4343 | callback(p_ucb); | ||
4344 | mOS_UnLock((PSCCBcard)pCurrCard); | ||
4345 | return; | ||
4346 | case GET_WIDE_MODE: | ||
4347 | if( !GetDevWideMode((PSCCBcard)pCurrCard,p_ucb) ) | ||
4348 | { | ||
4349 | p_ucb->UCB_status = UCB_SUCCESS; | ||
4350 | } | ||
4351 | else | ||
4352 | { | ||
4353 | p_ucb->UCB_status = UCB_ERROR; | ||
4354 | p_ucb->UCB_hbastat = HASTAT_HW_ERROR; | ||
4355 | } | ||
4356 | callback = (CALL_BK_FN)p_ucb->UCB_callback; | ||
4357 | if (callback) | ||
4358 | callback(p_ucb); | ||
4359 | mOS_UnLock((PSCCBcard)pCurrCard); | ||
4360 | return; | ||
4361 | case SET_WIDE_MODE: | ||
4362 | if( !SetDevWideMode((PSCCBcard)pCurrCard,p_ucb) ) | ||
4363 | { | ||
4364 | p_ucb->UCB_status = UCB_SUCCESS; | ||
4365 | } | ||
4366 | else | ||
4367 | { | ||
4368 | p_ucb->UCB_status = UCB_ERROR; | ||
4369 | p_ucb->UCB_hbastat = HASTAT_HW_ERROR; | ||
4370 | } | ||
4371 | callback = (CALL_BK_FN)p_ucb->UCB_callback; | ||
4372 | if (callback) | ||
4373 | callback(p_ucb); | ||
4374 | mOS_UnLock((PSCCBcard)pCurrCard); | ||
4375 | return; | ||
4376 | default: | ||
4377 | p_ucb->UCB_status=UCB_INVALID; | ||
4378 | callback = (CALL_BK_FN)p_ucb->UCB_callback; | ||
4379 | if (callback) | ||
4380 | callback(p_ucb); | ||
4381 | mOS_UnLock((PSCCBcard)pCurrCard); | ||
4382 | return; | ||
4383 | } | ||
4384 | } | ||
4385 | #endif /* NO_IOCTLS */ | ||
4386 | #endif /* (FW_TYPE==_UCB_MGR_) */ | ||
4387 | 2063 | ||
4388 | 2064 | ||
4389 | if (!((PSCCBcard) pCurrCard)->cmdCounter) | 2065 | if (!((PSCCBcard) pCurrCard)->cmdCounter) |
@@ -4408,12 +2084,12 @@ void SccbMgr_start_sccb(ULONG pCurrCard, PSCCB p_Sccb) | |||
4408 | { | 2084 | { |
4409 | pSaveSccb = ((PSCCBcard) pCurrCard)->currentSCCB; | 2085 | pSaveSccb = ((PSCCBcard) pCurrCard)->currentSCCB; |
4410 | ((PSCCBcard) pCurrCard)->currentSCCB = p_Sccb; | 2086 | ((PSCCBcard) pCurrCard)->currentSCCB = p_Sccb; |
4411 | queueSelectFail(&BL_Card[thisCard], thisCard); | 2087 | FPT_queueSelectFail(&FPT_BL_Card[thisCard], thisCard); |
4412 | ((PSCCBcard) pCurrCard)->currentSCCB = pSaveSccb; | 2088 | ((PSCCBcard) pCurrCard)->currentSCCB = pSaveSccb; |
4413 | } | 2089 | } |
4414 | else | 2090 | else |
4415 | { | 2091 | { |
4416 | queueAddSccb(p_Sccb,thisCard); | 2092 | FPT_queueAddSccb(p_Sccb,thisCard); |
4417 | } | 2093 | } |
4418 | } | 2094 | } |
4419 | 2095 | ||
@@ -4423,12 +2099,12 @@ void SccbMgr_start_sccb(ULONG pCurrCard, PSCCB p_Sccb) | |||
4423 | { | 2099 | { |
4424 | pSaveSccb = ((PSCCBcard) pCurrCard)->currentSCCB; | 2100 | pSaveSccb = ((PSCCBcard) pCurrCard)->currentSCCB; |
4425 | ((PSCCBcard) pCurrCard)->currentSCCB = p_Sccb; | 2101 | ((PSCCBcard) pCurrCard)->currentSCCB = p_Sccb; |
4426 | queueSelectFail(&BL_Card[thisCard], thisCard); | 2102 | FPT_queueSelectFail(&FPT_BL_Card[thisCard], thisCard); |
4427 | ((PSCCBcard) pCurrCard)->currentSCCB = pSaveSccb; | 2103 | ((PSCCBcard) pCurrCard)->currentSCCB = pSaveSccb; |
4428 | } | 2104 | } |
4429 | else | 2105 | else |
4430 | { | 2106 | { |
4431 | queueAddSccb(p_Sccb,thisCard); | 2107 | FPT_queueAddSccb(p_Sccb,thisCard); |
4432 | } | 2108 | } |
4433 | } | 2109 | } |
4434 | 2110 | ||
@@ -4437,23 +2113,17 @@ void SccbMgr_start_sccb(ULONG pCurrCard, PSCCB p_Sccb) | |||
4437 | MDISABLE_INT(ioport); | 2113 | MDISABLE_INT(ioport); |
4438 | 2114 | ||
4439 | if((((PSCCBcard) pCurrCard)->globalFlags & F_CONLUN_IO) && | 2115 | if((((PSCCBcard) pCurrCard)->globalFlags & F_CONLUN_IO) && |
4440 | ((sccbMgrTbl[thisCard][p_Sccb->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) | 2116 | ((FPT_sccbMgrTbl[thisCard][p_Sccb->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) |
4441 | lun = p_Sccb->Lun; | 2117 | lun = p_Sccb->Lun; |
4442 | else | 2118 | else |
4443 | lun = 0; | 2119 | lun = 0; |
4444 | if ((((PSCCBcard) pCurrCard)->currentSCCB == NULL) && | 2120 | if ((((PSCCBcard) pCurrCard)->currentSCCB == NULL) && |
4445 | (sccbMgrTbl[thisCard][p_Sccb->TargID].TarSelQ_Cnt == 0) && | 2121 | (FPT_sccbMgrTbl[thisCard][p_Sccb->TargID].TarSelQ_Cnt == 0) && |
4446 | (sccbMgrTbl[thisCard][p_Sccb->TargID].TarLUNBusy[lun] | 2122 | (FPT_sccbMgrTbl[thisCard][p_Sccb->TargID].TarLUNBusy[lun] |
4447 | == FALSE)) { | 2123 | == 0)) { |
4448 | 2124 | ||
4449 | ((PSCCBcard) pCurrCard)->currentSCCB = p_Sccb; | 2125 | ((PSCCBcard) pCurrCard)->currentSCCB = p_Sccb; |
4450 | mOS_UnLock((PSCCBcard)pCurrCard); | 2126 | FPT_ssel(p_Sccb->SccbIOPort,thisCard); |
4451 | #if defined(DOS) | ||
4452 | ssel((USHORT)p_Sccb->SccbIOPort,thisCard); | ||
4453 | #else | ||
4454 | ssel(p_Sccb->SccbIOPort,thisCard); | ||
4455 | #endif | ||
4456 | mOS_Lock((PSCCBcard)pCurrCard); | ||
4457 | } | 2127 | } |
4458 | 2128 | ||
4459 | else { | 2129 | else { |
@@ -4462,12 +2132,12 @@ void SccbMgr_start_sccb(ULONG pCurrCard, PSCCB p_Sccb) | |||
4462 | { | 2132 | { |
4463 | pSaveSccb = ((PSCCBcard) pCurrCard)->currentSCCB; | 2133 | pSaveSccb = ((PSCCBcard) pCurrCard)->currentSCCB; |
4464 | ((PSCCBcard) pCurrCard)->currentSCCB = p_Sccb; | 2134 | ((PSCCBcard) pCurrCard)->currentSCCB = p_Sccb; |
4465 | queueSelectFail(&BL_Card[thisCard], thisCard); | 2135 | FPT_queueSelectFail(&FPT_BL_Card[thisCard], thisCard); |
4466 | ((PSCCBcard) pCurrCard)->currentSCCB = pSaveSccb; | 2136 | ((PSCCBcard) pCurrCard)->currentSCCB = pSaveSccb; |
4467 | } | 2137 | } |
4468 | else | 2138 | else |
4469 | { | 2139 | { |
4470 | queueAddSccb(p_Sccb,thisCard); | 2140 | FPT_queueAddSccb(p_Sccb,thisCard); |
4471 | } | 2141 | } |
4472 | } | 2142 | } |
4473 | 2143 | ||
@@ -4475,7 +2145,6 @@ void SccbMgr_start_sccb(ULONG pCurrCard, PSCCB p_Sccb) | |||
4475 | MENABLE_INT(ioport); | 2145 | MENABLE_INT(ioport); |
4476 | } | 2146 | } |
4477 | 2147 | ||
4478 | mOS_UnLock((PSCCBcard)pCurrCard); | ||
4479 | } | 2148 | } |
4480 | 2149 | ||
4481 | 2150 | ||
@@ -4488,22 +2157,9 @@ void SccbMgr_start_sccb(ULONG pCurrCard, PSCCB p_Sccb) | |||
4488 | * callback function. | 2157 | * callback function. |
4489 | * | 2158 | * |
4490 | *---------------------------------------------------------------------*/ | 2159 | *---------------------------------------------------------------------*/ |
4491 | #if (FW_TYPE==_UCB_MGR_) | 2160 | static int SccbMgr_abort_sccb(ULONG pCurrCard, PSCCB p_Sccb) |
4492 | s32bits SccbMgr_abort_sccb(CARD_HANDLE pCurrCard, PUCB p_ucb) | ||
4493 | #else | ||
4494 | #if defined(DOS) | ||
4495 | int SccbMgr_abort_sccb(USHORT pCurrCard, PSCCB p_Sccb) | ||
4496 | #else | ||
4497 | int SccbMgr_abort_sccb(ULONG pCurrCard, PSCCB p_Sccb) | ||
4498 | #endif | ||
4499 | #endif | ||
4500 | |||
4501 | { | 2161 | { |
4502 | #if defined(DOS) | ||
4503 | USHORT ioport; | ||
4504 | #else | ||
4505 | ULONG ioport; | 2162 | ULONG ioport; |
4506 | #endif | ||
4507 | 2163 | ||
4508 | UCHAR thisCard; | 2164 | UCHAR thisCard; |
4509 | CALL_BK_FN callback; | 2165 | CALL_BK_FN callback; |
@@ -4512,53 +2168,31 @@ int SccbMgr_abort_sccb(ULONG pCurrCard, PSCCB p_Sccb) | |||
4512 | PSCCBMgr_tar_info currTar_Info; | 2168 | PSCCBMgr_tar_info currTar_Info; |
4513 | 2169 | ||
4514 | 2170 | ||
4515 | #if (FW_TYPE==_UCB_MGR_) | ||
4516 | PSCCB p_Sccb; | ||
4517 | p_Sccb=(PSCCB)p_ucb->UCB_MgrPrivatePtr; | ||
4518 | #endif | ||
4519 | |||
4520 | ioport = ((PSCCBcard) pCurrCard)->ioPort; | 2171 | ioport = ((PSCCBcard) pCurrCard)->ioPort; |
4521 | 2172 | ||
4522 | thisCard = ((PSCCBcard)pCurrCard)->cardIndex; | 2173 | thisCard = ((PSCCBcard)pCurrCard)->cardIndex; |
4523 | 2174 | ||
4524 | mOS_Lock((PSCCBcard)pCurrCard); | 2175 | if (!(RD_HARPOON(ioport+hp_page_ctrl) & G_INT_DISABLE)) |
4525 | |||
4526 | if (RD_HARPOON(ioport+hp_page_ctrl) & G_INT_DISABLE) | ||
4527 | { | 2176 | { |
4528 | mOS_UnLock((PSCCBcard)pCurrCard); | ||
4529 | } | ||
4530 | 2177 | ||
4531 | else | 2178 | if (FPT_queueFindSccb(p_Sccb,thisCard)) |
4532 | { | ||
4533 | |||
4534 | if (queueFindSccb(p_Sccb,thisCard)) | ||
4535 | { | 2179 | { |
4536 | 2180 | ||
4537 | mOS_UnLock((PSCCBcard)pCurrCard); | ||
4538 | |||
4539 | ((PSCCBcard)pCurrCard)->cmdCounter--; | 2181 | ((PSCCBcard)pCurrCard)->cmdCounter--; |
4540 | 2182 | ||
4541 | if (!((PSCCBcard)pCurrCard)->cmdCounter) | 2183 | if (!((PSCCBcard)pCurrCard)->cmdCounter) |
4542 | WR_HARPOON(ioport+hp_semaphore,(RD_HARPOON(ioport+hp_semaphore) | 2184 | WR_HARPOON(ioport+hp_semaphore,(RD_HARPOON(ioport+hp_semaphore) |
4543 | & (UCHAR)(~(SCCB_MGR_ACTIVE | TICKLE_ME)) )); | 2185 | & (UCHAR)(~(SCCB_MGR_ACTIVE | TICKLE_ME)) )); |
4544 | 2186 | ||
4545 | #if (FW_TYPE==_SCCB_MGR_) | ||
4546 | p_Sccb->SccbStatus = SCCB_ABORT; | 2187 | p_Sccb->SccbStatus = SCCB_ABORT; |
4547 | callback = p_Sccb->SccbCallback; | 2188 | callback = p_Sccb->SccbCallback; |
4548 | callback(p_Sccb); | 2189 | callback(p_Sccb); |
4549 | #else | ||
4550 | p_ucb->UCB_status=SCCB_ABORT; | ||
4551 | callback = (CALL_BK_FN)p_ucb->UCB_callback; | ||
4552 | callback(p_ucb); | ||
4553 | #endif | ||
4554 | 2190 | ||
4555 | return(0); | 2191 | return(0); |
4556 | } | 2192 | } |
4557 | 2193 | ||
4558 | else | 2194 | else |
4559 | { | 2195 | { |
4560 | mOS_UnLock((PSCCBcard)pCurrCard); | ||
4561 | |||
4562 | if (((PSCCBcard)pCurrCard)->currentSCCB == p_Sccb) | 2196 | if (((PSCCBcard)pCurrCard)->currentSCCB == p_Sccb) |
4563 | { | 2197 | { |
4564 | p_Sccb->SccbStatus = SCCB_ABORT; | 2198 | p_Sccb->SccbStatus = SCCB_ABORT; |
@@ -4579,21 +2213,18 @@ int SccbMgr_abort_sccb(ULONG pCurrCard, PSCCB p_Sccb) | |||
4579 | { | 2213 | { |
4580 | p_Sccb->SccbStatus = SCCB_ABORT; | 2214 | p_Sccb->SccbStatus = SCCB_ABORT; |
4581 | p_Sccb->Sccb_scsistat = ABORT_ST; | 2215 | p_Sccb->Sccb_scsistat = ABORT_ST; |
4582 | #if (FW_TYPE==_UCB_MGR_) | ||
4583 | p_ucb->UCB_status=SCCB_ABORT; | ||
4584 | #endif | ||
4585 | p_Sccb->Sccb_scsimsg = SMABORT_TAG; | 2216 | p_Sccb->Sccb_scsimsg = SMABORT_TAG; |
4586 | 2217 | ||
4587 | if(((PSCCBcard) pCurrCard)->currentSCCB == NULL) | 2218 | if(((PSCCBcard) pCurrCard)->currentSCCB == NULL) |
4588 | { | 2219 | { |
4589 | ((PSCCBcard) pCurrCard)->currentSCCB = p_Sccb; | 2220 | ((PSCCBcard) pCurrCard)->currentSCCB = p_Sccb; |
4590 | ssel(ioport, thisCard); | 2221 | FPT_ssel(ioport, thisCard); |
4591 | } | 2222 | } |
4592 | else | 2223 | else |
4593 | { | 2224 | { |
4594 | pSaveSCCB = ((PSCCBcard) pCurrCard)->currentSCCB; | 2225 | pSaveSCCB = ((PSCCBcard) pCurrCard)->currentSCCB; |
4595 | ((PSCCBcard) pCurrCard)->currentSCCB = p_Sccb; | 2226 | ((PSCCBcard) pCurrCard)->currentSCCB = p_Sccb; |
4596 | queueSelectFail((PSCCBcard) pCurrCard, thisCard); | 2227 | FPT_queueSelectFail((PSCCBcard) pCurrCard, thisCard); |
4597 | ((PSCCBcard) pCurrCard)->currentSCCB = pSaveSCCB; | 2228 | ((PSCCBcard) pCurrCard)->currentSCCB = pSaveSCCB; |
4598 | } | 2229 | } |
4599 | } | 2230 | } |
@@ -4602,9 +2233,9 @@ int SccbMgr_abort_sccb(ULONG pCurrCard, PSCCB p_Sccb) | |||
4602 | } | 2233 | } |
4603 | else | 2234 | else |
4604 | { | 2235 | { |
4605 | currTar_Info = &sccbMgrTbl[thisCard][p_Sccb->TargID]; | 2236 | currTar_Info = &FPT_sccbMgrTbl[thisCard][p_Sccb->TargID]; |
4606 | 2237 | ||
4607 | if(BL_Card[thisCard].discQ_Tbl[currTar_Info->LunDiscQ_Idx[p_Sccb->Lun]] | 2238 | if(FPT_BL_Card[thisCard].discQ_Tbl[currTar_Info->LunDiscQ_Idx[p_Sccb->Lun]] |
4608 | == p_Sccb) | 2239 | == p_Sccb) |
4609 | { | 2240 | { |
4610 | p_Sccb->SccbStatus = SCCB_ABORT; | 2241 | p_Sccb->SccbStatus = SCCB_ABORT; |
@@ -4626,37 +2257,20 @@ int SccbMgr_abort_sccb(ULONG pCurrCard, PSCCB p_Sccb) | |||
4626 | * interrupt for this card and disable the IRQ Pin if so. | 2257 | * interrupt for this card and disable the IRQ Pin if so. |
4627 | * | 2258 | * |
4628 | *---------------------------------------------------------------------*/ | 2259 | *---------------------------------------------------------------------*/ |
4629 | #if (FW_TYPE==_UCB_MGR_) | 2260 | static UCHAR SccbMgr_my_int(ULONG pCurrCard) |
4630 | u08bits SccbMgr_my_int(CARD_HANDLE pCurrCard) | ||
4631 | #else | ||
4632 | #if defined(DOS) | ||
4633 | UCHAR SccbMgr_my_int(USHORT pCurrCard) | ||
4634 | #else | ||
4635 | UCHAR SccbMgr_my_int(ULONG pCurrCard) | ||
4636 | #endif | ||
4637 | #endif | ||
4638 | { | 2261 | { |
4639 | #if defined(DOS) | ||
4640 | USHORT ioport; | ||
4641 | #else | ||
4642 | ULONG ioport; | 2262 | ULONG ioport; |
4643 | #endif | ||
4644 | 2263 | ||
4645 | ioport = ((PSCCBcard)pCurrCard)->ioPort; | 2264 | ioport = ((PSCCBcard)pCurrCard)->ioPort; |
4646 | 2265 | ||
4647 | if (RD_HARPOON(ioport+hp_int_status) & INT_ASSERTED) | 2266 | if (RD_HARPOON(ioport+hp_int_status) & INT_ASSERTED) |
4648 | { | 2267 | { |
4649 | 2268 | return(1); | |
4650 | #if defined(DOS) | ||
4651 | MDISABLE_INT(ioport); | ||
4652 | #endif | ||
4653 | |||
4654 | return(TRUE); | ||
4655 | } | 2269 | } |
4656 | 2270 | ||
4657 | else | 2271 | else |
4658 | 2272 | ||
4659 | return(FALSE); | 2273 | return(0); |
4660 | } | 2274 | } |
4661 | 2275 | ||
4662 | 2276 | ||
@@ -4670,37 +2284,19 @@ UCHAR SccbMgr_my_int(ULONG pCurrCard) | |||
4670 | * us. | 2284 | * us. |
4671 | * | 2285 | * |
4672 | *---------------------------------------------------------------------*/ | 2286 | *---------------------------------------------------------------------*/ |
4673 | #if (FW_TYPE==_UCB_MGR_) | 2287 | static int SccbMgr_isr(ULONG pCurrCard) |
4674 | s32bits SccbMgr_isr(CARD_HANDLE pCurrCard) | ||
4675 | #else | ||
4676 | #if defined(DOS) | ||
4677 | int SccbMgr_isr(USHORT pCurrCard) | ||
4678 | #else | ||
4679 | int SccbMgr_isr(ULONG pCurrCard) | ||
4680 | #endif | ||
4681 | #endif | ||
4682 | { | 2288 | { |
4683 | PSCCB currSCCB; | 2289 | PSCCB currSCCB; |
4684 | UCHAR thisCard,result,bm_status, bm_int_st; | 2290 | UCHAR thisCard,result,bm_status, bm_int_st; |
4685 | USHORT hp_int; | 2291 | USHORT hp_int; |
4686 | UCHAR i, target; | 2292 | UCHAR i, target; |
4687 | #if defined(DOS) | ||
4688 | USHORT ioport; | ||
4689 | #else | ||
4690 | ULONG ioport; | 2293 | ULONG ioport; |
4691 | #endif | ||
4692 | |||
4693 | mOS_Lock((PSCCBcard)pCurrCard); | ||
4694 | 2294 | ||
4695 | thisCard = ((PSCCBcard)pCurrCard)->cardIndex; | 2295 | thisCard = ((PSCCBcard)pCurrCard)->cardIndex; |
4696 | ioport = ((PSCCBcard)pCurrCard)->ioPort; | 2296 | ioport = ((PSCCBcard)pCurrCard)->ioPort; |
4697 | 2297 | ||
4698 | MDISABLE_INT(ioport); | 2298 | MDISABLE_INT(ioport); |
4699 | 2299 | ||
4700 | #if defined(BUGBUG) | ||
4701 | WR_HARPOON(ioport+hp_user_defined_D, RD_HARPOON(ioport+hp_int_status)); | ||
4702 | #endif | ||
4703 | |||
4704 | if ((bm_int_st=RD_HARPOON(ioport+hp_int_status)) & EXT_STATUS_ON) | 2300 | if ((bm_int_st=RD_HARPOON(ioport+hp_int_status)) & EXT_STATUS_ON) |
4705 | bm_status = RD_HARPOON(ioport+hp_ext_status) & (UCHAR)BAD_EXT_STATUS; | 2301 | bm_status = RD_HARPOON(ioport+hp_ext_status) & (UCHAR)BAD_EXT_STATUS; |
4706 | else | 2302 | else |
@@ -4708,33 +2304,20 @@ int SccbMgr_isr(ULONG pCurrCard) | |||
4708 | 2304 | ||
4709 | WR_HARPOON(ioport+hp_int_mask, (INT_CMD_COMPL | SCSI_INTERRUPT)); | 2305 | WR_HARPOON(ioport+hp_int_mask, (INT_CMD_COMPL | SCSI_INTERRUPT)); |
4710 | 2306 | ||
4711 | mOS_UnLock((PSCCBcard)pCurrCard); | 2307 | while ((hp_int = RDW_HARPOON((ioport+hp_intstat)) & FPT_default_intena) | |
4712 | |||
4713 | while ((hp_int = RDW_HARPOON((ioport+hp_intstat)) & default_intena) | | ||
4714 | bm_status) | 2308 | bm_status) |
4715 | { | 2309 | { |
4716 | 2310 | ||
4717 | currSCCB = ((PSCCBcard)pCurrCard)->currentSCCB; | 2311 | currSCCB = ((PSCCBcard)pCurrCard)->currentSCCB; |
4718 | 2312 | ||
4719 | #if defined(BUGBUG) | ||
4720 | Debug_Load(thisCard,(UCHAR) 0XFF); | ||
4721 | Debug_Load(thisCard,bm_int_st); | ||
4722 | |||
4723 | Debug_Load(thisCard,hp_int_0); | ||
4724 | Debug_Load(thisCard,hp_int_1); | ||
4725 | #endif | ||
4726 | |||
4727 | |||
4728 | if (hp_int & (FIFO | TIMEOUT | RESET | SCAM_SEL) || bm_status) { | 2313 | if (hp_int & (FIFO | TIMEOUT | RESET | SCAM_SEL) || bm_status) { |
4729 | result = SccbMgr_bad_isr(ioport,thisCard,((PSCCBcard)pCurrCard),hp_int); | 2314 | result = FPT_SccbMgr_bad_isr(ioport,thisCard,((PSCCBcard)pCurrCard),hp_int); |
4730 | WRW_HARPOON((ioport+hp_intstat), (FIFO | TIMEOUT | RESET | SCAM_SEL)); | 2315 | WRW_HARPOON((ioport+hp_intstat), (FIFO | TIMEOUT | RESET | SCAM_SEL)); |
4731 | bm_status = 0; | 2316 | bm_status = 0; |
4732 | 2317 | ||
4733 | if (result) { | 2318 | if (result) { |
4734 | 2319 | ||
4735 | mOS_Lock((PSCCBcard)pCurrCard); | ||
4736 | MENABLE_INT(ioport); | 2320 | MENABLE_INT(ioport); |
4737 | mOS_UnLock((PSCCBcard)pCurrCard); | ||
4738 | return(result); | 2321 | return(result); |
4739 | } | 2322 | } |
4740 | } | 2323 | } |
@@ -4753,7 +2336,7 @@ int SccbMgr_isr(ULONG pCurrCard) | |||
4753 | 2336 | ||
4754 | if (((PSCCBcard)pCurrCard)->globalFlags & F_HOST_XFER_ACT) | 2337 | if (((PSCCBcard)pCurrCard)->globalFlags & F_HOST_XFER_ACT) |
4755 | 2338 | ||
4756 | phaseChkFifo(ioport, thisCard); | 2339 | FPT_phaseChkFifo(ioport, thisCard); |
4757 | 2340 | ||
4758 | /* WRW_HARPOON((ioport+hp_intstat), | 2341 | /* WRW_HARPOON((ioport+hp_intstat), |
4759 | (BUS_FREE | ICMD_COMP | ITAR_DISC | XFER_CNT_0)); | 2342 | (BUS_FREE | ICMD_COMP | ITAR_DISC | XFER_CNT_0)); |
@@ -4761,7 +2344,7 @@ int SccbMgr_isr(ULONG pCurrCard) | |||
4761 | 2344 | ||
4762 | WRW_HARPOON((ioport+hp_intstat), CLR_ALL_INT_1); | 2345 | WRW_HARPOON((ioport+hp_intstat), CLR_ALL_INT_1); |
4763 | 2346 | ||
4764 | autoCmdCmplt(ioport,thisCard); | 2347 | FPT_autoCmdCmplt(ioport,thisCard); |
4765 | 2348 | ||
4766 | } | 2349 | } |
4767 | 2350 | ||
@@ -4771,7 +2354,7 @@ int SccbMgr_isr(ULONG pCurrCard) | |||
4771 | 2354 | ||
4772 | if (((PSCCBcard)pCurrCard)->globalFlags & F_HOST_XFER_ACT) { | 2355 | if (((PSCCBcard)pCurrCard)->globalFlags & F_HOST_XFER_ACT) { |
4773 | 2356 | ||
4774 | phaseChkFifo(ioport, thisCard); | 2357 | FPT_phaseChkFifo(ioport, thisCard); |
4775 | 2358 | ||
4776 | } | 2359 | } |
4777 | 2360 | ||
@@ -4784,7 +2367,7 @@ int SccbMgr_isr(ULONG pCurrCard) | |||
4784 | } | 2367 | } |
4785 | 2368 | ||
4786 | currSCCB->Sccb_scsistat = DISCONNECT_ST; | 2369 | currSCCB->Sccb_scsistat = DISCONNECT_ST; |
4787 | queueDisconnect(currSCCB,thisCard); | 2370 | FPT_queueDisconnect(currSCCB,thisCard); |
4788 | 2371 | ||
4789 | /* Wait for the BusFree before starting a new command. We | 2372 | /* Wait for the BusFree before starting a new command. We |
4790 | must also check for being reselected since the BusFree | 2373 | must also check for being reselected since the BusFree |
@@ -4803,9 +2386,7 @@ int SccbMgr_isr(ULONG pCurrCard) | |||
4803 | */ | 2386 | */ |
4804 | if (!(RDW_HARPOON((ioport+hp_intstat)) & (BUS_FREE | RSEL))) | 2387 | if (!(RDW_HARPOON((ioport+hp_intstat)) & (BUS_FREE | RSEL))) |
4805 | { | 2388 | { |
4806 | mOS_Lock((PSCCBcard)pCurrCard); | ||
4807 | MENABLE_INT(ioport); | 2389 | MENABLE_INT(ioport); |
4808 | mOS_UnLock((PSCCBcard)pCurrCard); | ||
4809 | return 0xFE; | 2390 | return 0xFE; |
4810 | } | 2391 | } |
4811 | 2392 | ||
@@ -4825,7 +2406,7 @@ int SccbMgr_isr(ULONG pCurrCard) | |||
4825 | { | 2406 | { |
4826 | if (((PSCCBcard)pCurrCard)->globalFlags & F_HOST_XFER_ACT) | 2407 | if (((PSCCBcard)pCurrCard)->globalFlags & F_HOST_XFER_ACT) |
4827 | { | 2408 | { |
4828 | phaseChkFifo(ioport, thisCard); | 2409 | FPT_phaseChkFifo(ioport, thisCard); |
4829 | } | 2410 | } |
4830 | 2411 | ||
4831 | if (RD_HARPOON(ioport+hp_gp_reg_1) == SMSAVE_DATA_PTR) | 2412 | if (RD_HARPOON(ioport+hp_gp_reg_1) == SMSAVE_DATA_PTR) |
@@ -4837,11 +2418,11 @@ int SccbMgr_isr(ULONG pCurrCard) | |||
4837 | 2418 | ||
4838 | WRW_HARPOON((ioport+hp_intstat), (BUS_FREE | ITAR_DISC)); | 2419 | WRW_HARPOON((ioport+hp_intstat), (BUS_FREE | ITAR_DISC)); |
4839 | currSCCB->Sccb_scsistat = DISCONNECT_ST; | 2420 | currSCCB->Sccb_scsistat = DISCONNECT_ST; |
4840 | queueDisconnect(currSCCB,thisCard); | 2421 | FPT_queueDisconnect(currSCCB,thisCard); |
4841 | } | 2422 | } |
4842 | 2423 | ||
4843 | sres(ioport,thisCard,((PSCCBcard)pCurrCard)); | 2424 | FPT_sres(ioport,thisCard,((PSCCBcard)pCurrCard)); |
4844 | phaseDecode(ioport,thisCard); | 2425 | FPT_phaseDecode(ioport,thisCard); |
4845 | 2426 | ||
4846 | } | 2427 | } |
4847 | 2428 | ||
@@ -4850,7 +2431,7 @@ int SccbMgr_isr(ULONG pCurrCard) | |||
4850 | { | 2431 | { |
4851 | 2432 | ||
4852 | WRW_HARPOON((ioport+hp_intstat), (IDO_STRT | XFER_CNT_0)); | 2433 | WRW_HARPOON((ioport+hp_intstat), (IDO_STRT | XFER_CNT_0)); |
4853 | phaseDecode(ioport,thisCard); | 2434 | FPT_phaseDecode(ioport,thisCard); |
4854 | 2435 | ||
4855 | } | 2436 | } |
4856 | 2437 | ||
@@ -4860,7 +2441,7 @@ int SccbMgr_isr(ULONG pCurrCard) | |||
4860 | WRW_HARPOON((ioport+hp_intstat), (PHASE | IUNKWN | PROG_HLT)); | 2441 | WRW_HARPOON((ioport+hp_intstat), (PHASE | IUNKWN | PROG_HLT)); |
4861 | if ((RD_HARPOON(ioport+hp_prgmcnt_0) & (UCHAR)0x3f)< (UCHAR)SELCHK) | 2442 | if ((RD_HARPOON(ioport+hp_prgmcnt_0) & (UCHAR)0x3f)< (UCHAR)SELCHK) |
4862 | { | 2443 | { |
4863 | phaseDecode(ioport,thisCard); | 2444 | FPT_phaseDecode(ioport,thisCard); |
4864 | } | 2445 | } |
4865 | else | 2446 | else |
4866 | { | 2447 | { |
@@ -4885,7 +2466,7 @@ int SccbMgr_isr(ULONG pCurrCard) | |||
4885 | 2466 | ||
4886 | WRW_HARPOON((ioport+hp_intstat), XFER_CNT_0); | 2467 | WRW_HARPOON((ioport+hp_intstat), XFER_CNT_0); |
4887 | 2468 | ||
4888 | schkdd(ioport,thisCard); | 2469 | FPT_schkdd(ioport,thisCard); |
4889 | 2470 | ||
4890 | } | 2471 | } |
4891 | 2472 | ||
@@ -4896,10 +2477,10 @@ int SccbMgr_isr(ULONG pCurrCard) | |||
4896 | 2477 | ||
4897 | if (((PSCCBcard)pCurrCard)->globalFlags & F_HOST_XFER_ACT) { | 2478 | if (((PSCCBcard)pCurrCard)->globalFlags & F_HOST_XFER_ACT) { |
4898 | 2479 | ||
4899 | hostDataXferAbort(ioport,thisCard,currSCCB); | 2480 | FPT_hostDataXferAbort(ioport,thisCard,currSCCB); |
4900 | } | 2481 | } |
4901 | 2482 | ||
4902 | phaseBusFree(ioport,thisCard); | 2483 | FPT_phaseBusFree(ioport,thisCard); |
4903 | } | 2484 | } |
4904 | 2485 | ||
4905 | 2486 | ||
@@ -4919,12 +2500,12 @@ int SccbMgr_isr(ULONG pCurrCard) | |||
4919 | 2500 | ||
4920 | if (((PSCCBcard)pCurrCard)->currentSCCB == NULL) { | 2501 | if (((PSCCBcard)pCurrCard)->currentSCCB == NULL) { |
4921 | 2502 | ||
4922 | queueSearchSelect(((PSCCBcard)pCurrCard),thisCard); | 2503 | FPT_queueSearchSelect(((PSCCBcard)pCurrCard),thisCard); |
4923 | } | 2504 | } |
4924 | 2505 | ||
4925 | if (((PSCCBcard)pCurrCard)->currentSCCB != NULL) { | 2506 | if (((PSCCBcard)pCurrCard)->currentSCCB != NULL) { |
4926 | ((PSCCBcard)pCurrCard)->globalFlags &= ~F_NEW_SCCB_CMD; | 2507 | ((PSCCBcard)pCurrCard)->globalFlags &= ~F_NEW_SCCB_CMD; |
4927 | ssel(ioport,thisCard); | 2508 | FPT_ssel(ioport,thisCard); |
4928 | } | 2509 | } |
4929 | 2510 | ||
4930 | break; | 2511 | break; |
@@ -4933,9 +2514,7 @@ int SccbMgr_isr(ULONG pCurrCard) | |||
4933 | 2514 | ||
4934 | } /*end while */ | 2515 | } /*end while */ |
4935 | 2516 | ||
4936 | mOS_Lock((PSCCBcard)pCurrCard); | ||
4937 | MENABLE_INT(ioport); | 2517 | MENABLE_INT(ioport); |
4938 | mOS_UnLock((PSCCBcard)pCurrCard); | ||
4939 | 2518 | ||
4940 | return(0); | 2519 | return(0); |
4941 | } | 2520 | } |
@@ -4950,18 +2529,12 @@ int SccbMgr_isr(ULONG pCurrCard) | |||
4950 | * processing time. | 2529 | * processing time. |
4951 | * | 2530 | * |
4952 | *---------------------------------------------------------------------*/ | 2531 | *---------------------------------------------------------------------*/ |
4953 | #if defined(DOS) | 2532 | static UCHAR FPT_SccbMgr_bad_isr(ULONG p_port, UCHAR p_card, |
4954 | UCHAR SccbMgr_bad_isr(USHORT p_port, UCHAR p_card, PSCCBcard pCurrCard, USHORT p_int) | 2533 | PSCCBcard pCurrCard, USHORT p_int) |
4955 | #else | ||
4956 | UCHAR SccbMgr_bad_isr(ULONG p_port, UCHAR p_card, PSCCBcard pCurrCard, USHORT p_int) | ||
4957 | #endif | ||
4958 | { | 2534 | { |
4959 | #if defined(HARP_REVX) | 2535 | UCHAR temp, ScamFlg; |
4960 | ULONG timer; | 2536 | PSCCBMgr_tar_info currTar_Info; |
4961 | #endif | 2537 | PNVRamInfo pCurrNvRam; |
4962 | UCHAR temp, ScamFlg; | ||
4963 | PSCCBMgr_tar_info currTar_Info; | ||
4964 | PNVRamInfo pCurrNvRam; | ||
4965 | 2538 | ||
4966 | 2539 | ||
4967 | if (RD_HARPOON(p_port+hp_ext_status) & | 2540 | if (RD_HARPOON(p_port+hp_ext_status) & |
@@ -4971,7 +2544,7 @@ PNVRamInfo pCurrNvRam; | |||
4971 | if (pCurrCard->globalFlags & F_HOST_XFER_ACT) | 2544 | if (pCurrCard->globalFlags & F_HOST_XFER_ACT) |
4972 | { | 2545 | { |
4973 | 2546 | ||
4974 | hostDataXferAbort(p_port,p_card, pCurrCard->currentSCCB); | 2547 | FPT_hostDataXferAbort(p_port,p_card, pCurrCard->currentSCCB); |
4975 | } | 2548 | } |
4976 | 2549 | ||
4977 | if (RD_HARPOON(p_port+hp_pci_stat_cfg) & REC_MASTER_ABORT) | 2550 | if (RD_HARPOON(p_port+hp_pci_stat_cfg) & REC_MASTER_ABORT) |
@@ -4990,7 +2563,7 @@ PNVRamInfo pCurrNvRam; | |||
4990 | if (!pCurrCard->currentSCCB->HostStatus) | 2563 | if (!pCurrCard->currentSCCB->HostStatus) |
4991 | pCurrCard->currentSCCB->HostStatus = SCCB_BM_ERR; | 2564 | pCurrCard->currentSCCB->HostStatus = SCCB_BM_ERR; |
4992 | 2565 | ||
4993 | sxfrp(p_port,p_card); | 2566 | FPT_sxfrp(p_port,p_card); |
4994 | 2567 | ||
4995 | temp = (UCHAR)(RD_HARPOON(p_port+hp_ee_ctrl) & | 2568 | temp = (UCHAR)(RD_HARPOON(p_port+hp_ee_ctrl) & |
4996 | (EXT_ARB_ACK | SCSI_TERM_ENA_H)); | 2569 | (EXT_ARB_ACK | SCSI_TERM_ENA_H)); |
@@ -4999,7 +2572,7 @@ PNVRamInfo pCurrNvRam; | |||
4999 | 2572 | ||
5000 | if (!(RDW_HARPOON((p_port+hp_intstat)) & (BUS_FREE | RESET))) | 2573 | if (!(RDW_HARPOON((p_port+hp_intstat)) & (BUS_FREE | RESET))) |
5001 | { | 2574 | { |
5002 | phaseDecode(p_port,p_card); | 2575 | FPT_phaseDecode(p_port,p_card); |
5003 | } | 2576 | } |
5004 | } | 2577 | } |
5005 | } | 2578 | } |
@@ -5014,13 +2587,13 @@ PNVRamInfo pCurrNvRam; | |||
5014 | 2587 | ||
5015 | if (pCurrCard->globalFlags & F_HOST_XFER_ACT) | 2588 | if (pCurrCard->globalFlags & F_HOST_XFER_ACT) |
5016 | 2589 | ||
5017 | hostDataXferAbort(p_port,p_card, pCurrCard->currentSCCB); | 2590 | FPT_hostDataXferAbort(p_port,p_card, pCurrCard->currentSCCB); |
5018 | } | 2591 | } |
5019 | 2592 | ||
5020 | 2593 | ||
5021 | DISABLE_AUTO(p_port); | 2594 | DISABLE_AUTO(p_port); |
5022 | 2595 | ||
5023 | sresb(p_port,p_card); | 2596 | FPT_sresb(p_port,p_card); |
5024 | 2597 | ||
5025 | while(RD_HARPOON(p_port+hp_scsictrl_0) & SCSI_RST) {} | 2598 | while(RD_HARPOON(p_port+hp_scsictrl_0) & SCSI_RST) {} |
5026 | 2599 | ||
@@ -5029,12 +2602,12 @@ PNVRamInfo pCurrNvRam; | |||
5029 | ScamFlg = pCurrNvRam->niScamConf; | 2602 | ScamFlg = pCurrNvRam->niScamConf; |
5030 | } | 2603 | } |
5031 | else{ | 2604 | else{ |
5032 | ScamFlg = (UCHAR) utilEERead(p_port, SCAM_CONFIG/2); | 2605 | ScamFlg = (UCHAR) FPT_utilEERead(p_port, SCAM_CONFIG/2); |
5033 | } | 2606 | } |
5034 | 2607 | ||
5035 | XbowInit(p_port, ScamFlg); | 2608 | FPT_XbowInit(p_port, ScamFlg); |
5036 | 2609 | ||
5037 | scini(p_card, pCurrCard->ourId, 0); | 2610 | FPT_scini(p_card, pCurrCard->ourId, 0); |
5038 | 2611 | ||
5039 | return(0xFF); | 2612 | return(0xFF); |
5040 | } | 2613 | } |
@@ -5044,34 +2617,8 @@ PNVRamInfo pCurrNvRam; | |||
5044 | 2617 | ||
5045 | WRW_HARPOON((p_port+hp_intstat), FIFO); | 2618 | WRW_HARPOON((p_port+hp_intstat), FIFO); |
5046 | 2619 | ||
5047 | #if defined(HARP_REVX) | ||
5048 | |||
5049 | for (timer=0x00FFFFFFL; timer != 0x00000000L; timer--) { | ||
5050 | |||
5051 | if (RD_HARPOON(p_port+hp_xferstat) & FIFO_EMPTY) | ||
5052 | break; | ||
5053 | |||
5054 | if (RDW_HARPOON((p_port+hp_intstat)) & BUS_FREE) | ||
5055 | break; | ||
5056 | } | ||
5057 | |||
5058 | |||
5059 | if ( (RD_HARPOON(p_port+hp_xferstat) & FIFO_EMPTY) && | ||
5060 | (RD_HARPOON(p_port+hp_fiforead) != | ||
5061 | RD_HARPOON(p_port+hp_fifowrite)) && | ||
5062 | (RD_HARPOON(p_port+hp_xfercnt_0)) | ||
5063 | ) | ||
5064 | |||
5065 | WR_HARPOON((p_port+hp_xferstat), 0x01); | ||
5066 | |||
5067 | /* else | ||
5068 | */ | ||
5069 | /* sxfrp(p_port,p_card); | ||
5070 | */ | ||
5071 | #else | ||
5072 | if (pCurrCard->currentSCCB != NULL) | 2620 | if (pCurrCard->currentSCCB != NULL) |
5073 | sxfrp(p_port,p_card); | 2621 | FPT_sxfrp(p_port,p_card); |
5074 | #endif | ||
5075 | } | 2622 | } |
5076 | 2623 | ||
5077 | else if (p_int & TIMEOUT) | 2624 | else if (p_int & TIMEOUT) |
@@ -5085,12 +2632,12 @@ PNVRamInfo pCurrNvRam; | |||
5085 | pCurrCard->currentSCCB->HostStatus = SCCB_SELECTION_TIMEOUT; | 2632 | pCurrCard->currentSCCB->HostStatus = SCCB_SELECTION_TIMEOUT; |
5086 | 2633 | ||
5087 | 2634 | ||
5088 | currTar_Info = &sccbMgrTbl[p_card][pCurrCard->currentSCCB->TargID]; | 2635 | currTar_Info = &FPT_sccbMgrTbl[p_card][pCurrCard->currentSCCB->TargID]; |
5089 | if((pCurrCard->globalFlags & F_CONLUN_IO) && | 2636 | if((pCurrCard->globalFlags & F_CONLUN_IO) && |
5090 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) | 2637 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) |
5091 | currTar_Info->TarLUNBusy[pCurrCard->currentSCCB->Lun] = FALSE; | 2638 | currTar_Info->TarLUNBusy[pCurrCard->currentSCCB->Lun] = 0; |
5092 | else | 2639 | else |
5093 | currTar_Info->TarLUNBusy[0] = FALSE; | 2640 | currTar_Info->TarLUNBusy[0] = 0; |
5094 | 2641 | ||
5095 | 2642 | ||
5096 | if (currTar_Info->TarEEValue & EE_SYNC_MASK) | 2643 | if (currTar_Info->TarEEValue & EE_SYNC_MASK) |
@@ -5104,26 +2651,23 @@ PNVRamInfo pCurrNvRam; | |||
5104 | currTar_Info->TarStatus &= ~TAR_WIDE_MASK; | 2651 | currTar_Info->TarStatus &= ~TAR_WIDE_MASK; |
5105 | } | 2652 | } |
5106 | 2653 | ||
5107 | sssyncv(p_port, pCurrCard->currentSCCB->TargID, NARROW_SCSI,currTar_Info); | 2654 | FPT_sssyncv(p_port, pCurrCard->currentSCCB->TargID, NARROW_SCSI,currTar_Info); |
5108 | 2655 | ||
5109 | queueCmdComplete(pCurrCard, pCurrCard->currentSCCB, p_card); | 2656 | FPT_queueCmdComplete(pCurrCard, pCurrCard->currentSCCB, p_card); |
5110 | 2657 | ||
5111 | } | 2658 | } |
5112 | 2659 | ||
5113 | #if defined(SCAM_LEV_2) | ||
5114 | |||
5115 | else if (p_int & SCAM_SEL) | 2660 | else if (p_int & SCAM_SEL) |
5116 | { | 2661 | { |
5117 | 2662 | ||
5118 | scarb(p_port,LEVEL2_TAR); | 2663 | FPT_scarb(p_port,LEVEL2_TAR); |
5119 | scsel(p_port); | 2664 | FPT_scsel(p_port); |
5120 | scasid(p_card, p_port); | 2665 | FPT_scasid(p_card, p_port); |
5121 | 2666 | ||
5122 | scbusf(p_port); | 2667 | FPT_scbusf(p_port); |
5123 | 2668 | ||
5124 | WRW_HARPOON((p_port+hp_intstat), SCAM_SEL); | 2669 | WRW_HARPOON((p_port+hp_intstat), SCAM_SEL); |
5125 | } | 2670 | } |
5126 | #endif | ||
5127 | 2671 | ||
5128 | return(0x00); | 2672 | return(0x00); |
5129 | } | 2673 | } |
@@ -5131,126 +2675,25 @@ PNVRamInfo pCurrNvRam; | |||
5131 | 2675 | ||
5132 | /*--------------------------------------------------------------------- | 2676 | /*--------------------------------------------------------------------- |
5133 | * | 2677 | * |
5134 | * Function: SccbMgr_scsi_reset | ||
5135 | * | ||
5136 | * Description: A SCSI bus reset will be generated and all outstanding | ||
5137 | * Sccbs will be returned via the callback. | ||
5138 | * | ||
5139 | *---------------------------------------------------------------------*/ | ||
5140 | #if (FW_TYPE==_UCB_MGR_) | ||
5141 | void SccbMgr_scsi_reset(CARD_HANDLE pCurrCard) | ||
5142 | #else | ||
5143 | #if defined(DOS) | ||
5144 | void SccbMgr_scsi_reset(USHORT pCurrCard) | ||
5145 | #else | ||
5146 | void SccbMgr_scsi_reset(ULONG pCurrCard) | ||
5147 | #endif | ||
5148 | #endif | ||
5149 | { | ||
5150 | UCHAR thisCard; | ||
5151 | |||
5152 | thisCard = ((PSCCBcard)pCurrCard)->cardIndex; | ||
5153 | |||
5154 | mOS_Lock((PSCCBcard)pCurrCard); | ||
5155 | |||
5156 | if (((PSCCBcard) pCurrCard)->globalFlags & F_GREEN_PC) | ||
5157 | { | ||
5158 | WR_HARPOON(((PSCCBcard) pCurrCard)->ioPort+hp_clkctrl_0, CLKCTRL_DEFAULT); | ||
5159 | WR_HARPOON(((PSCCBcard) pCurrCard)->ioPort+hp_sys_ctrl, 0x00); | ||
5160 | } | ||
5161 | |||
5162 | sresb(((PSCCBcard)pCurrCard)->ioPort,thisCard); | ||
5163 | |||
5164 | if (RD_HARPOON(((PSCCBcard)pCurrCard)->ioPort+hp_ext_status) & BM_CMD_BUSY) | ||
5165 | { | ||
5166 | WR_HARPOON(((PSCCBcard) pCurrCard)->ioPort+hp_page_ctrl, | ||
5167 | (RD_HARPOON(((PSCCBcard) pCurrCard)->ioPort+hp_page_ctrl) | ||
5168 | & ~SCATTER_EN)); | ||
5169 | |||
5170 | WR_HARPOON(((PSCCBcard) pCurrCard)->ioPort+hp_sg_addr,0x00); | ||
5171 | |||
5172 | ((PSCCBcard) pCurrCard)->globalFlags &= ~F_HOST_XFER_ACT; | ||
5173 | busMstrTimeOut(((PSCCBcard) pCurrCard)->ioPort); | ||
5174 | |||
5175 | WR_HARPOON(((PSCCBcard) pCurrCard)->ioPort+hp_int_mask, | ||
5176 | (INT_CMD_COMPL | SCSI_INTERRUPT)); | ||
5177 | } | ||
5178 | |||
5179 | /* | ||
5180 | if (utilEERead(((PSCCBcard)pCurrCard)->ioPort, (SCAM_CONFIG/2)) | ||
5181 | & SCAM_ENABLED) | ||
5182 | */ | ||
5183 | scini(thisCard, ((PSCCBcard)pCurrCard)->ourId, 0); | ||
5184 | |||
5185 | #if (FW_TYPE==_UCB_MGR_) | ||
5186 | ((PSCCBcard)pCurrCard)->cardInfo->ai_AEN_routine(0x01,pCurrCard,0,0,0,0); | ||
5187 | #endif | ||
5188 | |||
5189 | mOS_UnLock((PSCCBcard)pCurrCard); | ||
5190 | } | ||
5191 | |||
5192 | |||
5193 | /*--------------------------------------------------------------------- | ||
5194 | * | ||
5195 | * Function: SccbMgr_timer_expired | ||
5196 | * | ||
5197 | * Description: This function allow me to kill my own job that has not | ||
5198 | * yet completed, and has cause a timeout to occur. This | ||
5199 | * timeout has caused the upper level driver to call this | ||
5200 | * function. | ||
5201 | * | ||
5202 | *---------------------------------------------------------------------*/ | ||
5203 | |||
5204 | #if (FW_TYPE==_UCB_MGR_) | ||
5205 | void SccbMgr_timer_expired(CARD_HANDLE pCurrCard) | ||
5206 | #else | ||
5207 | #if defined(DOS) | ||
5208 | void SccbMgr_timer_expired(USHORT pCurrCard) | ||
5209 | #else | ||
5210 | void SccbMgr_timer_expired(ULONG pCurrCard) | ||
5211 | #endif | ||
5212 | #endif | ||
5213 | { | ||
5214 | } | ||
5215 | |||
5216 | #if defined(DOS) | ||
5217 | /*--------------------------------------------------------------------- | ||
5218 | * | ||
5219 | * Function: SccbMgr_status | ||
5220 | * | ||
5221 | * Description: This function returns the number of outstanding SCCB's. | ||
5222 | * This is specific to the DOS enviroment, which needs this | ||
5223 | * to help them keep protected and real mode commands staight. | ||
5224 | * | ||
5225 | *---------------------------------------------------------------------*/ | ||
5226 | |||
5227 | USHORT SccbMgr_status(USHORT pCurrCard) | ||
5228 | { | ||
5229 | return(BL_Card[pCurrCard].cmdCounter); | ||
5230 | } | ||
5231 | #endif | ||
5232 | |||
5233 | /*--------------------------------------------------------------------- | ||
5234 | * | ||
5235 | * Function: SccbMgrTableInit | 2678 | * Function: SccbMgrTableInit |
5236 | * | 2679 | * |
5237 | * Description: Initialize all Sccb manager data structures. | 2680 | * Description: Initialize all Sccb manager data structures. |
5238 | * | 2681 | * |
5239 | *---------------------------------------------------------------------*/ | 2682 | *---------------------------------------------------------------------*/ |
5240 | 2683 | ||
5241 | void SccbMgrTableInitAll() | 2684 | static void FPT_SccbMgrTableInitAll() |
5242 | { | 2685 | { |
5243 | UCHAR thisCard; | 2686 | UCHAR thisCard; |
5244 | 2687 | ||
5245 | for (thisCard = 0; thisCard < MAX_CARDS; thisCard++) | 2688 | for (thisCard = 0; thisCard < MAX_CARDS; thisCard++) |
5246 | { | 2689 | { |
5247 | SccbMgrTableInitCard(&BL_Card[thisCard],thisCard); | 2690 | FPT_SccbMgrTableInitCard(&FPT_BL_Card[thisCard],thisCard); |
5248 | 2691 | ||
5249 | BL_Card[thisCard].ioPort = 0x00; | 2692 | FPT_BL_Card[thisCard].ioPort = 0x00; |
5250 | BL_Card[thisCard].cardInfo = NULL; | 2693 | FPT_BL_Card[thisCard].cardInfo = NULL; |
5251 | BL_Card[thisCard].cardIndex = 0xFF; | 2694 | FPT_BL_Card[thisCard].cardIndex = 0xFF; |
5252 | BL_Card[thisCard].ourId = 0x00; | 2695 | FPT_BL_Card[thisCard].ourId = 0x00; |
5253 | BL_Card[thisCard].pNvRamInfo = NULL; | 2696 | FPT_BL_Card[thisCard].pNvRamInfo = NULL; |
5254 | } | 2697 | } |
5255 | } | 2698 | } |
5256 | 2699 | ||
@@ -5263,20 +2706,20 @@ void SccbMgrTableInitAll() | |||
5263 | * | 2706 | * |
5264 | *---------------------------------------------------------------------*/ | 2707 | *---------------------------------------------------------------------*/ |
5265 | 2708 | ||
5266 | void SccbMgrTableInitCard(PSCCBcard pCurrCard, UCHAR p_card) | 2709 | static void FPT_SccbMgrTableInitCard(PSCCBcard pCurrCard, UCHAR p_card) |
5267 | { | 2710 | { |
5268 | UCHAR scsiID, qtag; | 2711 | UCHAR scsiID, qtag; |
5269 | 2712 | ||
5270 | for (qtag = 0; qtag < QUEUE_DEPTH; qtag++) | 2713 | for (qtag = 0; qtag < QUEUE_DEPTH; qtag++) |
5271 | { | 2714 | { |
5272 | BL_Card[p_card].discQ_Tbl[qtag] = NULL; | 2715 | FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL; |
5273 | } | 2716 | } |
5274 | 2717 | ||
5275 | for (scsiID = 0; scsiID < MAX_SCSI_TAR; scsiID++) | 2718 | for (scsiID = 0; scsiID < MAX_SCSI_TAR; scsiID++) |
5276 | { | 2719 | { |
5277 | sccbMgrTbl[p_card][scsiID].TarStatus = 0; | 2720 | FPT_sccbMgrTbl[p_card][scsiID].TarStatus = 0; |
5278 | sccbMgrTbl[p_card][scsiID].TarEEValue = 0; | 2721 | FPT_sccbMgrTbl[p_card][scsiID].TarEEValue = 0; |
5279 | SccbMgrTableInitTarget(p_card, scsiID); | 2722 | FPT_SccbMgrTableInitTarget(p_card, scsiID); |
5280 | } | 2723 | } |
5281 | 2724 | ||
5282 | pCurrCard->scanIndex = 0x00; | 2725 | pCurrCard->scanIndex = 0x00; |
@@ -5298,13 +2741,13 @@ void SccbMgrTableInitCard(PSCCBcard pCurrCard, UCHAR p_card) | |||
5298 | * | 2741 | * |
5299 | *---------------------------------------------------------------------*/ | 2742 | *---------------------------------------------------------------------*/ |
5300 | 2743 | ||
5301 | void SccbMgrTableInitTarget(UCHAR p_card, UCHAR target) | 2744 | static void FPT_SccbMgrTableInitTarget(UCHAR p_card, UCHAR target) |
5302 | { | 2745 | { |
5303 | 2746 | ||
5304 | UCHAR lun, qtag; | 2747 | UCHAR lun, qtag; |
5305 | PSCCBMgr_tar_info currTar_Info; | 2748 | PSCCBMgr_tar_info currTar_Info; |
5306 | 2749 | ||
5307 | currTar_Info = &sccbMgrTbl[p_card][target]; | 2750 | currTar_Info = &FPT_sccbMgrTbl[p_card][target]; |
5308 | 2751 | ||
5309 | currTar_Info->TarSelQ_Cnt = 0; | 2752 | currTar_Info->TarSelQ_Cnt = 0; |
5310 | currTar_Info->TarSyncCtrl = 0; | 2753 | currTar_Info->TarSyncCtrl = 0; |
@@ -5312,160 +2755,28 @@ void SccbMgrTableInitTarget(UCHAR p_card, UCHAR target) | |||
5312 | currTar_Info->TarSelQ_Head = NULL; | 2755 | currTar_Info->TarSelQ_Head = NULL; |
5313 | currTar_Info->TarSelQ_Tail = NULL; | 2756 | currTar_Info->TarSelQ_Tail = NULL; |
5314 | currTar_Info->TarTagQ_Cnt = 0; | 2757 | currTar_Info->TarTagQ_Cnt = 0; |
5315 | currTar_Info->TarLUN_CA = FALSE; | 2758 | currTar_Info->TarLUN_CA = 0; |
5316 | 2759 | ||
5317 | 2760 | ||
5318 | for (lun = 0; lun < MAX_LUN; lun++) | 2761 | for (lun = 0; lun < MAX_LUN; lun++) |
5319 | { | 2762 | { |
5320 | currTar_Info->TarLUNBusy[lun] = FALSE; | 2763 | currTar_Info->TarLUNBusy[lun] = 0; |
5321 | currTar_Info->LunDiscQ_Idx[lun] = 0; | 2764 | currTar_Info->LunDiscQ_Idx[lun] = 0; |
5322 | } | 2765 | } |
5323 | 2766 | ||
5324 | for (qtag = 0; qtag < QUEUE_DEPTH; qtag++) | 2767 | for (qtag = 0; qtag < QUEUE_DEPTH; qtag++) |
5325 | { | 2768 | { |
5326 | if(BL_Card[p_card].discQ_Tbl[qtag] != NULL) | 2769 | if(FPT_BL_Card[p_card].discQ_Tbl[qtag] != NULL) |
5327 | { | 2770 | { |
5328 | if(BL_Card[p_card].discQ_Tbl[qtag]->TargID == target) | 2771 | if(FPT_BL_Card[p_card].discQ_Tbl[qtag]->TargID == target) |
5329 | { | 2772 | { |
5330 | BL_Card[p_card].discQ_Tbl[qtag] = NULL; | 2773 | FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL; |
5331 | BL_Card[p_card].discQCount--; | 2774 | FPT_BL_Card[p_card].discQCount--; |
5332 | } | 2775 | } |
5333 | } | 2776 | } |
5334 | } | 2777 | } |
5335 | } | 2778 | } |
5336 | 2779 | ||
5337 | #if defined(BUGBUG) | ||
5338 | |||
5339 | /***************************************************************** | ||
5340 | * Save the current byte in the debug array | ||
5341 | *****************************************************************/ | ||
5342 | |||
5343 | |||
5344 | void Debug_Load(UCHAR p_card, UCHAR p_bug_data) | ||
5345 | { | ||
5346 | debug_int[p_card][debug_index[p_card]] = p_bug_data; | ||
5347 | debug_index[p_card]++; | ||
5348 | |||
5349 | if (debug_index[p_card] == debug_size) | ||
5350 | |||
5351 | debug_index[p_card] = 0; | ||
5352 | } | ||
5353 | |||
5354 | #endif | ||
5355 | #ident "$Id: sccb_dat.c 1.10 1997/02/22 03:16:02 awin Exp $" | ||
5356 | /*---------------------------------------------------------------------- | ||
5357 | * | ||
5358 | * | ||
5359 | * Copyright 1995-1996 by Mylex Corporation. All Rights Reserved | ||
5360 | * | ||
5361 | * This file is available under both the GNU General Public License | ||
5362 | * and a BSD-style copyright; see LICENSE.FlashPoint for details. | ||
5363 | * | ||
5364 | * $Workfile: sccb_dat.c $ | ||
5365 | * | ||
5366 | * Description: Functions relating to handling of the SCCB interface | ||
5367 | * between the device driver and the HARPOON. | ||
5368 | * | ||
5369 | * $Date: 1997/02/22 03:16:02 $ | ||
5370 | * | ||
5371 | * $Revision: 1.10 $ | ||
5372 | * | ||
5373 | *----------------------------------------------------------------------*/ | ||
5374 | |||
5375 | /*#include <globals.h>*/ | ||
5376 | |||
5377 | #if (FW_TYPE==_UCB_MGR_) | ||
5378 | /*#include <budi.h>*/ | ||
5379 | #endif | ||
5380 | |||
5381 | /*#include <sccbmgr.h>*/ | ||
5382 | /*#include <blx30.h>*/ | ||
5383 | /*#include <target.h>*/ | ||
5384 | /*#include <harpoon.h>*/ | ||
5385 | |||
5386 | /* | ||
5387 | ** IMPORTANT NOTE!!! | ||
5388 | ** | ||
5389 | ** You MUST preassign all data to a valid value or zero. This is | ||
5390 | ** required due to the MS compiler bug under OS/2 and Solaris Real-Mode | ||
5391 | ** driver environment. | ||
5392 | */ | ||
5393 | |||
5394 | |||
5395 | SCCBMGR_TAR_INFO sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR] = { { { 0 } } }; | ||
5396 | SCCBCARD BL_Card[MAX_CARDS] = { { 0 } }; | ||
5397 | SCCBSCAM_INFO scamInfo[MAX_SCSI_TAR] = { { { 0 } } }; | ||
5398 | NVRAMINFO nvRamInfo[MAX_MB_CARDS] = { { 0 } }; | ||
5399 | |||
5400 | |||
5401 | #if defined(OS2) | ||
5402 | void (far *s_PhaseTbl[8]) (ULONG, UCHAR) = { 0 }; | ||
5403 | UCHAR temp_id_string[ID_STRING_LENGTH] = { 0 }; | ||
5404 | #elif defined(SOLARIS_REAL_MODE) || defined(__STDC__) | ||
5405 | void (*s_PhaseTbl[8]) (ULONG, UCHAR) = { 0 }; | ||
5406 | #else | ||
5407 | void (*s_PhaseTbl[8]) (); | ||
5408 | #endif | ||
5409 | |||
5410 | #if defined(DOS) | ||
5411 | UCHAR first_time = 0; | ||
5412 | #endif | ||
5413 | |||
5414 | UCHAR mbCards = 0; | ||
5415 | UCHAR scamHAString[] = {0x63, 0x07, 'B', 'U', 'S', 'L', 'O', 'G', 'I', 'C', \ | ||
5416 | ' ', 'B', 'T', '-', '9', '3', '0', \ | ||
5417 | 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \ | ||
5418 | 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}; | ||
5419 | |||
5420 | USHORT default_intena = 0; | ||
5421 | |||
5422 | #if defined(BUGBUG) | ||
5423 | UCHAR debug_int[MAX_CARDS][debug_size] = { 0 }; | ||
5424 | UCHAR debug_index[MAX_CARDS] = { 0 }; | ||
5425 | UCHAR reserved_1[3] = { 0 }; | ||
5426 | #endif | ||
5427 | #ident "$Id: scsi.c 1.23 1997/07/09 21:42:54 mohan Exp $" | ||
5428 | /*---------------------------------------------------------------------- | ||
5429 | * | ||
5430 | * | ||
5431 | * Copyright 1995-1996 by Mylex Corporation. All Rights Reserved | ||
5432 | * | ||
5433 | * This file is available under both the GNU General Public License | ||
5434 | * and a BSD-style copyright; see LICENSE.FlashPoint for details. | ||
5435 | * | ||
5436 | * $Workfile: scsi.c $ | ||
5437 | * | ||
5438 | * Description: Functions for handling SCSI bus functions such as | ||
5439 | * selection/reselection, sync negotiation, message-in | ||
5440 | * decoding. | ||
5441 | * | ||
5442 | * $Date: 1997/07/09 21:42:54 $ | ||
5443 | * | ||
5444 | * $Revision: 1.23 $ | ||
5445 | * | ||
5446 | *----------------------------------------------------------------------*/ | ||
5447 | |||
5448 | /*#include <globals.h>*/ | ||
5449 | |||
5450 | #if (FW_TYPE==_UCB_MGR_) | ||
5451 | /*#include <budi.h>*/ | ||
5452 | #endif | ||
5453 | |||
5454 | /*#include <sccbmgr.h>*/ | ||
5455 | /*#include <blx30.h>*/ | ||
5456 | /*#include <target.h>*/ | ||
5457 | /*#include <scsi2.h>*/ | ||
5458 | /*#include <eeprom.h>*/ | ||
5459 | /*#include <harpoon.h>*/ | ||
5460 | |||
5461 | |||
5462 | /* | ||
5463 | extern SCCBCARD BL_Card[MAX_CARDS]; | ||
5464 | extern SCCBMGR_TAR_INFO sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR]; | ||
5465 | #if defined(BUGBUG) | ||
5466 | void Debug_Load(UCHAR p_card, UCHAR p_bug_data); | ||
5467 | #endif | ||
5468 | */ | ||
5469 | 2780 | ||
5470 | /*--------------------------------------------------------------------- | 2781 | /*--------------------------------------------------------------------- |
5471 | * | 2782 | * |
@@ -5476,11 +2787,7 @@ void Debug_Load(UCHAR p_card, UCHAR p_bug_data); | |||
5476 | * | 2787 | * |
5477 | *---------------------------------------------------------------------*/ | 2788 | *---------------------------------------------------------------------*/ |
5478 | 2789 | ||
5479 | #if defined(DOS) | 2790 | static UCHAR FPT_sfm(ULONG port, PSCCB pCurrSCCB) |
5480 | UCHAR sfm(USHORT port, PSCCB pCurrSCCB) | ||
5481 | #else | ||
5482 | UCHAR sfm(ULONG port, PSCCB pCurrSCCB) | ||
5483 | #endif | ||
5484 | { | 2791 | { |
5485 | UCHAR message; | 2792 | UCHAR message; |
5486 | USHORT TimeOutLoop; | 2793 | USHORT TimeOutLoop; |
@@ -5547,42 +2854,27 @@ UCHAR sfm(ULONG port, PSCCB pCurrSCCB) | |||
5547 | 2854 | ||
5548 | /*--------------------------------------------------------------------- | 2855 | /*--------------------------------------------------------------------- |
5549 | * | 2856 | * |
5550 | * Function: ssel | 2857 | * Function: FPT_ssel |
5551 | * | 2858 | * |
5552 | * Description: Load up automation and select target device. | 2859 | * Description: Load up automation and select target device. |
5553 | * | 2860 | * |
5554 | *---------------------------------------------------------------------*/ | 2861 | *---------------------------------------------------------------------*/ |
5555 | 2862 | ||
5556 | #if defined(DOS) | 2863 | static void FPT_ssel(ULONG port, UCHAR p_card) |
5557 | void ssel(USHORT port, UCHAR p_card) | ||
5558 | #else | ||
5559 | void ssel(ULONG port, UCHAR p_card) | ||
5560 | #endif | ||
5561 | { | 2864 | { |
5562 | 2865 | ||
5563 | #if defined(DOS) | ||
5564 | UCHAR auto_loaded, i, target, *theCCB; | 2866 | UCHAR auto_loaded, i, target, *theCCB; |
5565 | #elif defined(OS2) | ||
5566 | UCHAR auto_loaded, i, target; | ||
5567 | UCHAR far *theCCB; | ||
5568 | #else | ||
5569 | UCHAR auto_loaded, i, target, *theCCB; | ||
5570 | #endif | ||
5571 | 2867 | ||
5572 | #if defined(DOS) | ||
5573 | USHORT cdb_reg; | ||
5574 | #else | ||
5575 | ULONG cdb_reg; | 2868 | ULONG cdb_reg; |
5576 | #endif | ||
5577 | PSCCBcard CurrCard; | 2869 | PSCCBcard CurrCard; |
5578 | PSCCB currSCCB; | 2870 | PSCCB currSCCB; |
5579 | PSCCBMgr_tar_info currTar_Info; | 2871 | PSCCBMgr_tar_info currTar_Info; |
5580 | UCHAR lastTag, lun; | 2872 | UCHAR lastTag, lun; |
5581 | 2873 | ||
5582 | CurrCard = &BL_Card[p_card]; | 2874 | CurrCard = &FPT_BL_Card[p_card]; |
5583 | currSCCB = CurrCard->currentSCCB; | 2875 | currSCCB = CurrCard->currentSCCB; |
5584 | target = currSCCB->TargID; | 2876 | target = currSCCB->TargID; |
5585 | currTar_Info = &sccbMgrTbl[p_card][target]; | 2877 | currTar_Info = &FPT_sccbMgrTbl[p_card][target]; |
5586 | lastTag = CurrCard->tagQ_Lst; | 2878 | lastTag = CurrCard->tagQ_Lst; |
5587 | 2879 | ||
5588 | ARAM_ACCESS(port); | 2880 | ARAM_ACCESS(port); |
@@ -5599,60 +2891,53 @@ void ssel(ULONG port, UCHAR p_card) | |||
5599 | lun = 0; | 2891 | lun = 0; |
5600 | 2892 | ||
5601 | 2893 | ||
5602 | #if defined(DOS) | ||
5603 | currTar_Info->TarLUNBusy[lun] = TRUE; | ||
5604 | |||
5605 | #else | ||
5606 | |||
5607 | if (CurrCard->globalFlags & F_TAG_STARTED) | 2894 | if (CurrCard->globalFlags & F_TAG_STARTED) |
5608 | { | 2895 | { |
5609 | if (!(currSCCB->ControlByte & F_USE_CMD_Q)) | 2896 | if (!(currSCCB->ControlByte & F_USE_CMD_Q)) |
5610 | { | 2897 | { |
5611 | if ((currTar_Info->TarLUN_CA == FALSE) | 2898 | if ((currTar_Info->TarLUN_CA == 0) |
5612 | && ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) | 2899 | && ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) |
5613 | == TAG_Q_TRYING)) | 2900 | == TAG_Q_TRYING)) |
5614 | { | 2901 | { |
5615 | 2902 | ||
5616 | if (currTar_Info->TarTagQ_Cnt !=0) | 2903 | if (currTar_Info->TarTagQ_Cnt !=0) |
5617 | { | 2904 | { |
5618 | currTar_Info->TarLUNBusy[lun] = TRUE; | 2905 | currTar_Info->TarLUNBusy[lun] = 1; |
5619 | queueSelectFail(CurrCard,p_card); | 2906 | FPT_queueSelectFail(CurrCard,p_card); |
5620 | SGRAM_ACCESS(port); | 2907 | SGRAM_ACCESS(port); |
5621 | return; | 2908 | return; |
5622 | } | 2909 | } |
5623 | 2910 | ||
5624 | else { | 2911 | else { |
5625 | currTar_Info->TarLUNBusy[lun] = TRUE; | 2912 | currTar_Info->TarLUNBusy[lun] = 1; |
5626 | } | 2913 | } |
5627 | 2914 | ||
5628 | } /*End non-tagged */ | 2915 | } /*End non-tagged */ |
5629 | 2916 | ||
5630 | else { | 2917 | else { |
5631 | currTar_Info->TarLUNBusy[lun] = TRUE; | 2918 | currTar_Info->TarLUNBusy[lun] = 1; |
5632 | } | 2919 | } |
5633 | 2920 | ||
5634 | } /*!Use cmd Q Tagged */ | 2921 | } /*!Use cmd Q Tagged */ |
5635 | 2922 | ||
5636 | else { | 2923 | else { |
5637 | if (currTar_Info->TarLUN_CA == TRUE) | 2924 | if (currTar_Info->TarLUN_CA == 1) |
5638 | { | 2925 | { |
5639 | queueSelectFail(CurrCard,p_card); | 2926 | FPT_queueSelectFail(CurrCard,p_card); |
5640 | SGRAM_ACCESS(port); | 2927 | SGRAM_ACCESS(port); |
5641 | return; | 2928 | return; |
5642 | } | 2929 | } |
5643 | 2930 | ||
5644 | currTar_Info->TarLUNBusy[lun] = TRUE; | 2931 | currTar_Info->TarLUNBusy[lun] = 1; |
5645 | 2932 | ||
5646 | } /*else use cmd Q tagged */ | 2933 | } /*else use cmd Q tagged */ |
5647 | 2934 | ||
5648 | } /*if glob tagged started */ | 2935 | } /*if glob tagged started */ |
5649 | 2936 | ||
5650 | else { | 2937 | else { |
5651 | currTar_Info->TarLUNBusy[lun] = TRUE; | 2938 | currTar_Info->TarLUNBusy[lun] = 1; |
5652 | } | 2939 | } |
5653 | 2940 | ||
5654 | #endif /* DOS */ | ||
5655 | |||
5656 | 2941 | ||
5657 | 2942 | ||
5658 | if((((CurrCard->globalFlags & F_CONLUN_IO) && | 2943 | if((((CurrCard->globalFlags & F_CONLUN_IO) && |
@@ -5661,8 +2946,8 @@ void ssel(ULONG port, UCHAR p_card) | |||
5661 | { | 2946 | { |
5662 | if(CurrCard->discQCount >= QUEUE_DEPTH) | 2947 | if(CurrCard->discQCount >= QUEUE_DEPTH) |
5663 | { | 2948 | { |
5664 | currTar_Info->TarLUNBusy[lun] = TRUE; | 2949 | currTar_Info->TarLUNBusy[lun] = 1; |
5665 | queueSelectFail(CurrCard,p_card); | 2950 | FPT_queueSelectFail(CurrCard,p_card); |
5666 | SGRAM_ACCESS(port); | 2951 | SGRAM_ACCESS(port); |
5667 | return; | 2952 | return; |
5668 | } | 2953 | } |
@@ -5680,8 +2965,8 @@ void ssel(ULONG port, UCHAR p_card) | |||
5680 | } | 2965 | } |
5681 | if(i == QUEUE_DEPTH) | 2966 | if(i == QUEUE_DEPTH) |
5682 | { | 2967 | { |
5683 | currTar_Info->TarLUNBusy[lun] = TRUE; | 2968 | currTar_Info->TarLUNBusy[lun] = 1; |
5684 | queueSelectFail(CurrCard,p_card); | 2969 | FPT_queueSelectFail(CurrCard,p_card); |
5685 | SGRAM_ACCESS(port); | 2970 | SGRAM_ACCESS(port); |
5686 | return; | 2971 | return; |
5687 | } | 2972 | } |
@@ -5689,7 +2974,7 @@ void ssel(ULONG port, UCHAR p_card) | |||
5689 | 2974 | ||
5690 | 2975 | ||
5691 | 2976 | ||
5692 | auto_loaded = FALSE; | 2977 | auto_loaded = 0; |
5693 | 2978 | ||
5694 | WR_HARPOON(port+hp_select_id, target); | 2979 | WR_HARPOON(port+hp_select_id, target); |
5695 | WR_HARPOON(port+hp_gp_reg_3, target); /* Use by new automation logic */ | 2980 | WR_HARPOON(port+hp_gp_reg_3, target); /* Use by new automation logic */ |
@@ -5703,7 +2988,7 @@ void ssel(ULONG port, UCHAR p_card) | |||
5703 | currSCCB->Sccb_scsimsg = SMDEV_RESET; | 2988 | currSCCB->Sccb_scsimsg = SMDEV_RESET; |
5704 | 2989 | ||
5705 | WR_HARPOON(port+hp_autostart_3, (SELECT+SELCHK_STRT)); | 2990 | WR_HARPOON(port+hp_autostart_3, (SELECT+SELCHK_STRT)); |
5706 | auto_loaded = TRUE; | 2991 | auto_loaded = 1; |
5707 | currSCCB->Sccb_scsistat = SELECT_BDR_ST; | 2992 | currSCCB->Sccb_scsistat = SELECT_BDR_ST; |
5708 | 2993 | ||
5709 | if (currTar_Info->TarEEValue & EE_SYNC_MASK) | 2994 | if (currTar_Info->TarEEValue & EE_SYNC_MASK) |
@@ -5712,16 +2997,13 @@ void ssel(ULONG port, UCHAR p_card) | |||
5712 | currTar_Info->TarStatus &= ~TAR_SYNC_MASK; | 2997 | currTar_Info->TarStatus &= ~TAR_SYNC_MASK; |
5713 | } | 2998 | } |
5714 | 2999 | ||
5715 | #if defined(WIDE_SCSI) | ||
5716 | |||
5717 | if (currTar_Info->TarEEValue & EE_WIDE_SCSI) | 3000 | if (currTar_Info->TarEEValue & EE_WIDE_SCSI) |
5718 | { | 3001 | { |
5719 | currTar_Info->TarStatus &= ~TAR_WIDE_MASK; | 3002 | currTar_Info->TarStatus &= ~TAR_WIDE_MASK; |
5720 | } | 3003 | } |
5721 | #endif | ||
5722 | 3004 | ||
5723 | sssyncv(port, target, NARROW_SCSI,currTar_Info); | 3005 | FPT_sssyncv(port, target, NARROW_SCSI,currTar_Info); |
5724 | SccbMgrTableInitTarget(p_card, target); | 3006 | FPT_SccbMgrTableInitTarget(p_card, target); |
5725 | 3007 | ||
5726 | } | 3008 | } |
5727 | 3009 | ||
@@ -5740,24 +3022,18 @@ void ssel(ULONG port, UCHAR p_card) | |||
5740 | WRW_HARPOON((port+SYNC_MSGS+4), (BRH_OP+ALWAYS+NP )); | 3022 | WRW_HARPOON((port+SYNC_MSGS+4), (BRH_OP+ALWAYS+NP )); |
5741 | 3023 | ||
5742 | WR_HARPOON(port+hp_autostart_3, (SELECT+SELCHK_STRT)); | 3024 | WR_HARPOON(port+hp_autostart_3, (SELECT+SELCHK_STRT)); |
5743 | auto_loaded = TRUE; | 3025 | auto_loaded = 1; |
5744 | 3026 | ||
5745 | } | 3027 | } |
5746 | 3028 | ||
5747 | #if defined(WIDE_SCSI) | ||
5748 | |||
5749 | |||
5750 | else if (!(currTar_Info->TarStatus & WIDE_NEGOCIATED)) { | 3029 | else if (!(currTar_Info->TarStatus & WIDE_NEGOCIATED)) { |
5751 | auto_loaded = siwidn(port,p_card); | 3030 | auto_loaded = FPT_siwidn(port,p_card); |
5752 | currSCCB->Sccb_scsistat = SELECT_WN_ST; | 3031 | currSCCB->Sccb_scsistat = SELECT_WN_ST; |
5753 | } | 3032 | } |
5754 | 3033 | ||
5755 | #endif | ||
5756 | |||
5757 | |||
5758 | else if (!((currTar_Info->TarStatus & TAR_SYNC_MASK) | 3034 | else if (!((currTar_Info->TarStatus & TAR_SYNC_MASK) |
5759 | == SYNC_SUPPORTED)) { | 3035 | == SYNC_SUPPORTED)) { |
5760 | auto_loaded = sisyncn(port,p_card, FALSE); | 3036 | auto_loaded = FPT_sisyncn(port,p_card, 0); |
5761 | currSCCB->Sccb_scsistat = SELECT_SN_ST; | 3037 | currSCCB->Sccb_scsistat = SELECT_SN_ST; |
5762 | } | 3038 | } |
5763 | 3039 | ||
@@ -5765,7 +3041,6 @@ void ssel(ULONG port, UCHAR p_card) | |||
5765 | if (!auto_loaded) | 3041 | if (!auto_loaded) |
5766 | { | 3042 | { |
5767 | 3043 | ||
5768 | #if !defined(DOS) | ||
5769 | if (currSCCB->ControlByte & F_USE_CMD_Q) | 3044 | if (currSCCB->ControlByte & F_USE_CMD_Q) |
5770 | { | 3045 | { |
5771 | 3046 | ||
@@ -5789,7 +3064,7 @@ void ssel(ULONG port, UCHAR p_card) | |||
5789 | the wheels fall off. */ | 3064 | the wheels fall off. */ |
5790 | currSCCB->Sccb_scsistat = SELECT_ST; | 3065 | currSCCB->Sccb_scsistat = SELECT_ST; |
5791 | 3066 | ||
5792 | currTar_Info->TarLUNBusy[lun] = TRUE; | 3067 | currTar_Info->TarLUNBusy[lun] = 1; |
5793 | } | 3068 | } |
5794 | 3069 | ||
5795 | else | 3070 | else |
@@ -5818,8 +3093,8 @@ void ssel(ULONG port, UCHAR p_card) | |||
5818 | 3093 | ||
5819 | if ( i == QUEUE_DEPTH ) | 3094 | if ( i == QUEUE_DEPTH ) |
5820 | { | 3095 | { |
5821 | currTar_Info->TarLUNBusy[lun] = TRUE; | 3096 | currTar_Info->TarLUNBusy[lun] = 1; |
5822 | queueSelectFail(CurrCard,p_card); | 3097 | FPT_queueSelectFail(CurrCard,p_card); |
5823 | SGRAM_ACCESS(port); | 3098 | SGRAM_ACCESS(port); |
5824 | return; | 3099 | return; |
5825 | } | 3100 | } |
@@ -5832,7 +3107,6 @@ void ssel(ULONG port, UCHAR p_card) | |||
5832 | 3107 | ||
5833 | else | 3108 | else |
5834 | { | 3109 | { |
5835 | #endif /* !DOS */ | ||
5836 | 3110 | ||
5837 | WRW_HARPOON((port+ID_MSG_STRT),BRH_OP+ALWAYS+NTCMD); | 3111 | WRW_HARPOON((port+ID_MSG_STRT),BRH_OP+ALWAYS+NTCMD); |
5838 | 3112 | ||
@@ -5842,16 +3116,10 @@ void ssel(ULONG port, UCHAR p_card) | |||
5842 | currSCCB->Sccb_scsistat = SELECT_ST; | 3116 | currSCCB->Sccb_scsistat = SELECT_ST; |
5843 | 3117 | ||
5844 | WR_HARPOON(port+hp_autostart_3, (SELECT+SELCHK_STRT)); | 3118 | WR_HARPOON(port+hp_autostart_3, (SELECT+SELCHK_STRT)); |
5845 | #if !defined(DOS) | ||
5846 | } | 3119 | } |
5847 | #endif | ||
5848 | 3120 | ||
5849 | 3121 | ||
5850 | #if defined(OS2) | ||
5851 | theCCB = (UCHAR far *)&currSCCB->Cdb[0]; | ||
5852 | #else | ||
5853 | theCCB = (UCHAR *)&currSCCB->Cdb[0]; | 3122 | theCCB = (UCHAR *)&currSCCB->Cdb[0]; |
5854 | #endif | ||
5855 | 3123 | ||
5856 | cdb_reg = port + CMD_STRT; | 3124 | cdb_reg = port + CMD_STRT; |
5857 | 3125 | ||
@@ -5867,10 +3135,8 @@ void ssel(ULONG port, UCHAR p_card) | |||
5867 | 3135 | ||
5868 | } /* auto_loaded */ | 3136 | } /* auto_loaded */ |
5869 | 3137 | ||
5870 | #if defined(WIDE_SCSI) | ||
5871 | WRW_HARPOON((port+hp_fiforead), (USHORT) 0x00); | 3138 | WRW_HARPOON((port+hp_fiforead), (USHORT) 0x00); |
5872 | WR_HARPOON(port+hp_xferstat, 0x00); | 3139 | WR_HARPOON(port+hp_xferstat, 0x00); |
5873 | #endif | ||
5874 | 3140 | ||
5875 | WRW_HARPOON((port+hp_intstat), (PROG_HLT | TIMEOUT | SEL | BUS_FREE)); | 3141 | WRW_HARPOON((port+hp_intstat), (PROG_HLT | TIMEOUT | SEL | BUS_FREE)); |
5876 | 3142 | ||
@@ -5899,30 +3165,16 @@ void ssel(ULONG port, UCHAR p_card) | |||
5899 | 3165 | ||
5900 | /*--------------------------------------------------------------------- | 3166 | /*--------------------------------------------------------------------- |
5901 | * | 3167 | * |
5902 | * Function: sres | 3168 | * Function: FPT_sres |
5903 | * | 3169 | * |
5904 | * Description: Hookup the correct CCB and handle the incoming messages. | 3170 | * Description: Hookup the correct CCB and handle the incoming messages. |
5905 | * | 3171 | * |
5906 | *---------------------------------------------------------------------*/ | 3172 | *---------------------------------------------------------------------*/ |
5907 | 3173 | ||
5908 | #if defined(DOS) | 3174 | static void FPT_sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard) |
5909 | void sres(USHORT port, UCHAR p_card, PSCCBcard pCurrCard) | ||
5910 | #else | ||
5911 | void sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard) | ||
5912 | #endif | ||
5913 | { | 3175 | { |
5914 | 3176 | ||
5915 | #if defined(V302) | ||
5916 | #ifdef DOS | ||
5917 | UCHAR our_target,message, msgRetryCount; | ||
5918 | extern UCHAR lun, tag; | ||
5919 | #else | ||
5920 | UCHAR our_target,message,lun,tag, msgRetryCount; | ||
5921 | #endif | ||
5922 | |||
5923 | #else /* V302 */ | ||
5924 | UCHAR our_target, message, lun = 0, tag, msgRetryCount; | 3177 | UCHAR our_target, message, lun = 0, tag, msgRetryCount; |
5925 | #endif /* V302 */ | ||
5926 | 3178 | ||
5927 | 3179 | ||
5928 | PSCCBMgr_tar_info currTar_Info; | 3180 | PSCCBMgr_tar_info currTar_Info; |
@@ -5933,7 +3185,7 @@ void sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard) | |||
5933 | 3185 | ||
5934 | if(pCurrCard->currentSCCB != NULL) | 3186 | if(pCurrCard->currentSCCB != NULL) |
5935 | { | 3187 | { |
5936 | currTar_Info = &sccbMgrTbl[p_card][pCurrCard->currentSCCB->TargID]; | 3188 | currTar_Info = &FPT_sccbMgrTbl[p_card][pCurrCard->currentSCCB->TargID]; |
5937 | DISABLE_AUTO(port); | 3189 | DISABLE_AUTO(port); |
5938 | 3190 | ||
5939 | 3191 | ||
@@ -5954,7 +3206,7 @@ void sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard) | |||
5954 | if(((pCurrCard->globalFlags & F_CONLUN_IO) && | 3206 | if(((pCurrCard->globalFlags & F_CONLUN_IO) && |
5955 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) | 3207 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) |
5956 | { | 3208 | { |
5957 | currTar_Info->TarLUNBusy[currSCCB->Lun] = FALSE; | 3209 | currTar_Info->TarLUNBusy[currSCCB->Lun] = 0; |
5958 | if(currSCCB->Sccb_scsistat != ABORT_ST) | 3210 | if(currSCCB->Sccb_scsistat != ABORT_ST) |
5959 | { | 3211 | { |
5960 | pCurrCard->discQCount--; | 3212 | pCurrCard->discQCount--; |
@@ -5964,7 +3216,7 @@ void sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard) | |||
5964 | } | 3216 | } |
5965 | else | 3217 | else |
5966 | { | 3218 | { |
5967 | currTar_Info->TarLUNBusy[0] = FALSE; | 3219 | currTar_Info->TarLUNBusy[0] = 0; |
5968 | if(currSCCB->Sccb_tag) | 3220 | if(currSCCB->Sccb_tag) |
5969 | { | 3221 | { |
5970 | if(currSCCB->Sccb_scsistat != ABORT_ST) | 3222 | if(currSCCB->Sccb_scsistat != ABORT_ST) |
@@ -5982,29 +3234,21 @@ void sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard) | |||
5982 | } | 3234 | } |
5983 | } | 3235 | } |
5984 | 3236 | ||
5985 | queueSelectFail(&BL_Card[p_card],p_card); | 3237 | FPT_queueSelectFail(&FPT_BL_Card[p_card],p_card); |
5986 | } | 3238 | } |
5987 | 3239 | ||
5988 | #if defined(WIDE_SCSI) | ||
5989 | WRW_HARPOON((port+hp_fiforead), (USHORT) 0x00); | 3240 | WRW_HARPOON((port+hp_fiforead), (USHORT) 0x00); |
5990 | #endif | ||
5991 | 3241 | ||
5992 | 3242 | ||
5993 | our_target = (UCHAR)(RD_HARPOON(port+hp_select_id) >> 4); | 3243 | our_target = (UCHAR)(RD_HARPOON(port+hp_select_id) >> 4); |
5994 | currTar_Info = &sccbMgrTbl[p_card][our_target]; | 3244 | currTar_Info = &FPT_sccbMgrTbl[p_card][our_target]; |
5995 | 3245 | ||
5996 | 3246 | ||
5997 | msgRetryCount = 0; | 3247 | msgRetryCount = 0; |
5998 | do | 3248 | do |
5999 | { | 3249 | { |
6000 | 3250 | ||
6001 | #if defined(V302) | 3251 | currTar_Info = &FPT_sccbMgrTbl[p_card][our_target]; |
6002 | |||
6003 | message = GetTarLun(port, p_card, our_target, pCurrCard, &tag, &lun); | ||
6004 | |||
6005 | #else /* V302 */ | ||
6006 | |||
6007 | currTar_Info = &sccbMgrTbl[p_card][our_target]; | ||
6008 | tag = 0; | 3252 | tag = 0; |
6009 | 3253 | ||
6010 | 3254 | ||
@@ -6022,7 +3266,7 @@ void sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard) | |||
6022 | if ((RD_HARPOON(port+hp_scsisig) & S_SCSI_PHZ) == S_MSGI_PH) | 3266 | if ((RD_HARPOON(port+hp_scsisig) & S_SCSI_PHZ) == S_MSGI_PH) |
6023 | { | 3267 | { |
6024 | 3268 | ||
6025 | message = sfm(port,pCurrCard->currentSCCB); | 3269 | message = FPT_sfm(port,pCurrCard->currentSCCB); |
6026 | if (message) | 3270 | if (message) |
6027 | { | 3271 | { |
6028 | 3272 | ||
@@ -6030,7 +3274,6 @@ void sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard) | |||
6030 | { | 3274 | { |
6031 | lun = message & (UCHAR)LUN_MASK; | 3275 | lun = message & (UCHAR)LUN_MASK; |
6032 | 3276 | ||
6033 | #if !defined(DOS) | ||
6034 | if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) == TAG_Q_TRYING) | 3277 | if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) == TAG_Q_TRYING) |
6035 | { | 3278 | { |
6036 | if (currTar_Info->TarTagQ_Cnt != 0) | 3279 | if (currTar_Info->TarTagQ_Cnt != 0) |
@@ -6041,21 +3284,21 @@ void sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard) | |||
6041 | ACCEPT_MSG(port); /*Release the ACK for ID msg. */ | 3284 | ACCEPT_MSG(port); /*Release the ACK for ID msg. */ |
6042 | 3285 | ||
6043 | 3286 | ||
6044 | message = sfm(port,pCurrCard->currentSCCB); | 3287 | message = FPT_sfm(port,pCurrCard->currentSCCB); |
6045 | if (message) | 3288 | if (message) |
6046 | { | 3289 | { |
6047 | ACCEPT_MSG(port); | 3290 | ACCEPT_MSG(port); |
6048 | } | 3291 | } |
6049 | 3292 | ||
6050 | else | 3293 | else |
6051 | message = FALSE; | 3294 | message = 0; |
6052 | 3295 | ||
6053 | if(message != FALSE) | 3296 | if(message != 0) |
6054 | { | 3297 | { |
6055 | tag = sfm(port,pCurrCard->currentSCCB); | 3298 | tag = FPT_sfm(port,pCurrCard->currentSCCB); |
6056 | 3299 | ||
6057 | if (!(tag)) | 3300 | if (!(tag)) |
6058 | message = FALSE; | 3301 | message = 0; |
6059 | } | 3302 | } |
6060 | 3303 | ||
6061 | } /*C.A. exists! */ | 3304 | } /*C.A. exists! */ |
@@ -6063,7 +3306,6 @@ void sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard) | |||
6063 | } /*End Q cnt != 0 */ | 3306 | } /*End Q cnt != 0 */ |
6064 | 3307 | ||
6065 | } /*End Tag cmds supported! */ | 3308 | } /*End Tag cmds supported! */ |
6066 | #endif /* !DOS */ | ||
6067 | 3309 | ||
6068 | } /*End valid ID message. */ | 3310 | } /*End valid ID message. */ |
6069 | 3311 | ||
@@ -6078,7 +3320,7 @@ void sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard) | |||
6078 | else | 3320 | else |
6079 | { | 3321 | { |
6080 | 3322 | ||
6081 | message = FALSE; | 3323 | message = 0; |
6082 | } | 3324 | } |
6083 | } | 3325 | } |
6084 | else | 3326 | else |
@@ -6091,49 +3333,47 @@ void sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard) | |||
6091 | 3333 | ||
6092 | return; | 3334 | return; |
6093 | } | 3335 | } |
6094 | |||
6095 | #endif /* V302 */ | ||
6096 | 3336 | ||
6097 | if(message == FALSE) | 3337 | if(message == 0) |
6098 | { | 3338 | { |
6099 | msgRetryCount++; | 3339 | msgRetryCount++; |
6100 | if(msgRetryCount == 1) | 3340 | if(msgRetryCount == 1) |
6101 | { | 3341 | { |
6102 | SendMsg(port, SMPARITY); | 3342 | FPT_SendMsg(port, SMPARITY); |
6103 | } | 3343 | } |
6104 | else | 3344 | else |
6105 | { | 3345 | { |
6106 | SendMsg(port, SMDEV_RESET); | 3346 | FPT_SendMsg(port, SMDEV_RESET); |
6107 | 3347 | ||
6108 | sssyncv(port, our_target, NARROW_SCSI,currTar_Info); | 3348 | FPT_sssyncv(port, our_target, NARROW_SCSI,currTar_Info); |
6109 | 3349 | ||
6110 | if (sccbMgrTbl[p_card][our_target].TarEEValue & EE_SYNC_MASK) | 3350 | if (FPT_sccbMgrTbl[p_card][our_target].TarEEValue & EE_SYNC_MASK) |
6111 | { | 3351 | { |
6112 | 3352 | ||
6113 | sccbMgrTbl[p_card][our_target].TarStatus &= ~TAR_SYNC_MASK; | 3353 | FPT_sccbMgrTbl[p_card][our_target].TarStatus &= ~TAR_SYNC_MASK; |
6114 | 3354 | ||
6115 | } | 3355 | } |
6116 | 3356 | ||
6117 | if (sccbMgrTbl[p_card][our_target].TarEEValue & EE_WIDE_SCSI) | 3357 | if (FPT_sccbMgrTbl[p_card][our_target].TarEEValue & EE_WIDE_SCSI) |
6118 | { | 3358 | { |
6119 | 3359 | ||
6120 | sccbMgrTbl[p_card][our_target].TarStatus &= ~TAR_WIDE_MASK; | 3360 | FPT_sccbMgrTbl[p_card][our_target].TarStatus &= ~TAR_WIDE_MASK; |
6121 | } | 3361 | } |
6122 | 3362 | ||
6123 | 3363 | ||
6124 | queueFlushTargSccb(p_card, our_target, SCCB_COMPLETE); | 3364 | FPT_queueFlushTargSccb(p_card, our_target, SCCB_COMPLETE); |
6125 | SccbMgrTableInitTarget(p_card,our_target); | 3365 | FPT_SccbMgrTableInitTarget(p_card,our_target); |
6126 | return; | 3366 | return; |
6127 | } | 3367 | } |
6128 | } | 3368 | } |
6129 | }while(message == FALSE); | 3369 | }while(message == 0); |
6130 | 3370 | ||
6131 | 3371 | ||
6132 | 3372 | ||
6133 | if(((pCurrCard->globalFlags & F_CONLUN_IO) && | 3373 | if(((pCurrCard->globalFlags & F_CONLUN_IO) && |
6134 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) | 3374 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) |
6135 | { | 3375 | { |
6136 | currTar_Info->TarLUNBusy[lun] = TRUE; | 3376 | currTar_Info->TarLUNBusy[lun] = 1; |
6137 | pCurrCard->currentSCCB = pCurrCard->discQ_Tbl[currTar_Info->LunDiscQ_Idx[lun]]; | 3377 | pCurrCard->currentSCCB = pCurrCard->discQ_Tbl[currTar_Info->LunDiscQ_Idx[lun]]; |
6138 | if(pCurrCard->currentSCCB != NULL) | 3378 | if(pCurrCard->currentSCCB != NULL) |
6139 | { | 3379 | { |
@@ -6146,7 +3386,7 @@ void sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard) | |||
6146 | } | 3386 | } |
6147 | else | 3387 | else |
6148 | { | 3388 | { |
6149 | currTar_Info->TarLUNBusy[0] = TRUE; | 3389 | currTar_Info->TarLUNBusy[0] = 1; |
6150 | 3390 | ||
6151 | 3391 | ||
6152 | if (tag) | 3392 | if (tag) |
@@ -6182,7 +3422,7 @@ void sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard) | |||
6182 | /* During Abort Tag command, the target could have got re-selected | 3422 | /* During Abort Tag command, the target could have got re-selected |
6183 | and completed the command. Check the select Q and remove the CCB | 3423 | and completed the command. Check the select Q and remove the CCB |
6184 | if it is in the Select Q */ | 3424 | if it is in the Select Q */ |
6185 | queueFindSccb(pCurrCard->currentSCCB, p_card); | 3425 | FPT_queueFindSccb(pCurrCard->currentSCCB, p_card); |
6186 | } | 3426 | } |
6187 | } | 3427 | } |
6188 | 3428 | ||
@@ -6192,106 +3432,7 @@ void sres(ULONG port, UCHAR p_card, PSCCBcard pCurrCard) | |||
6192 | (RD_HARPOON(port+hp_scsisig) & SCSI_BSY)) ; | 3432 | (RD_HARPOON(port+hp_scsisig) & SCSI_BSY)) ; |
6193 | } | 3433 | } |
6194 | 3434 | ||
6195 | #if defined(V302) | 3435 | static void FPT_SendMsg(ULONG port, UCHAR message) |
6196 | |||
6197 | #if defined(DOS) | ||
6198 | UCHAR GetTarLun(USHORT port, UCHAR p_card, UCHAR our_target, PSCCBcard pCurrCard, PUCHAR tag, PUCHAR lun) | ||
6199 | #else | ||
6200 | UCHAR GetTarLun(ULONG port, UCHAR p_card, UCHAR our_target, PSCCBcard pCurrCard, PUCHAR tag, PUCHAR lun) | ||
6201 | #endif | ||
6202 | { | ||
6203 | UCHAR message; | ||
6204 | PSCCBMgr_tar_info currTar_Info; | ||
6205 | |||
6206 | |||
6207 | currTar_Info = &sccbMgrTbl[p_card][our_target]; | ||
6208 | *tag = 0; | ||
6209 | |||
6210 | |||
6211 | while(!(RD_HARPOON(port+hp_scsisig) & SCSI_REQ)) | ||
6212 | { | ||
6213 | if (! (RD_HARPOON(port+hp_scsisig) & SCSI_BSY)) | ||
6214 | { | ||
6215 | |||
6216 | WRW_HARPOON((port+hp_intstat), PHASE); | ||
6217 | return(TRUE); | ||
6218 | } | ||
6219 | } | ||
6220 | |||
6221 | WRW_HARPOON((port+hp_intstat), PHASE); | ||
6222 | if ((RD_HARPOON(port+hp_scsisig) & S_SCSI_PHZ) == S_MSGI_PH) | ||
6223 | { | ||
6224 | |||
6225 | message = sfm(port,pCurrCard->currentSCCB); | ||
6226 | if (message) | ||
6227 | { | ||
6228 | |||
6229 | if (message <= (0x80 | LUN_MASK)) | ||
6230 | { | ||
6231 | *lun = message & (UCHAR)LUN_MASK; | ||
6232 | |||
6233 | #if !defined(DOS) | ||
6234 | if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) == TAG_Q_TRYING) | ||
6235 | { | ||
6236 | if (currTar_Info->TarTagQ_Cnt != 0) | ||
6237 | { | ||
6238 | |||
6239 | if (!(currTar_Info->TarLUN_CA)) | ||
6240 | { | ||
6241 | ACCEPT_MSG(port); /*Release the ACK for ID msg. */ | ||
6242 | |||
6243 | |||
6244 | message = sfm(port,pCurrCard->currentSCCB); | ||
6245 | if (message) | ||
6246 | { | ||
6247 | ACCEPT_MSG(port); | ||
6248 | } | ||
6249 | |||
6250 | else | ||
6251 | return(FALSE); | ||
6252 | |||
6253 | *tag = sfm(port,pCurrCard->currentSCCB); | ||
6254 | |||
6255 | if (!(*tag)) return(FALSE); | ||
6256 | |||
6257 | } /*C.A. exists! */ | ||
6258 | |||
6259 | } /*End Q cnt != 0 */ | ||
6260 | |||
6261 | } /*End Tag cmds supported! */ | ||
6262 | #endif /* !DOS */ | ||
6263 | |||
6264 | } /*End valid ID message. */ | ||
6265 | |||
6266 | else | ||
6267 | { | ||
6268 | |||
6269 | ACCEPT_MSG_ATN(port); | ||
6270 | } | ||
6271 | |||
6272 | } /* End good id message. */ | ||
6273 | |||
6274 | else | ||
6275 | { | ||
6276 | |||
6277 | return(FALSE); | ||
6278 | } | ||
6279 | } | ||
6280 | else | ||
6281 | { | ||
6282 | ACCEPT_MSG_ATN(port); | ||
6283 | return(TRUE); | ||
6284 | } | ||
6285 | return(TRUE); | ||
6286 | } | ||
6287 | |||
6288 | #endif /* V302 */ | ||
6289 | |||
6290 | #if defined(DOS) | ||
6291 | void SendMsg(USHORT port, UCHAR message) | ||
6292 | #else | ||
6293 | void SendMsg(ULONG port, UCHAR message) | ||
6294 | #endif | ||
6295 | { | 3436 | { |
6296 | while(!(RD_HARPOON(port+hp_scsisig) & SCSI_REQ)) | 3437 | while(!(RD_HARPOON(port+hp_scsisig) & SCSI_REQ)) |
6297 | { | 3438 | { |
@@ -6334,26 +3475,22 @@ void SendMsg(ULONG port, UCHAR message) | |||
6334 | 3475 | ||
6335 | /*--------------------------------------------------------------------- | 3476 | /*--------------------------------------------------------------------- |
6336 | * | 3477 | * |
6337 | * Function: sdecm | 3478 | * Function: FPT_sdecm |
6338 | * | 3479 | * |
6339 | * Description: Determine the proper responce to the message from the | 3480 | * Description: Determine the proper responce to the message from the |
6340 | * target device. | 3481 | * target device. |
6341 | * | 3482 | * |
6342 | *---------------------------------------------------------------------*/ | 3483 | *---------------------------------------------------------------------*/ |
6343 | #if defined(DOS) | 3484 | static void FPT_sdecm(UCHAR message, ULONG port, UCHAR p_card) |
6344 | void sdecm(UCHAR message, USHORT port, UCHAR p_card) | ||
6345 | #else | ||
6346 | void sdecm(UCHAR message, ULONG port, UCHAR p_card) | ||
6347 | #endif | ||
6348 | { | 3485 | { |
6349 | PSCCB currSCCB; | 3486 | PSCCB currSCCB; |
6350 | PSCCBcard CurrCard; | 3487 | PSCCBcard CurrCard; |
6351 | PSCCBMgr_tar_info currTar_Info; | 3488 | PSCCBMgr_tar_info currTar_Info; |
6352 | 3489 | ||
6353 | CurrCard = &BL_Card[p_card]; | 3490 | CurrCard = &FPT_BL_Card[p_card]; |
6354 | currSCCB = CurrCard->currentSCCB; | 3491 | currSCCB = CurrCard->currentSCCB; |
6355 | 3492 | ||
6356 | currTar_Info = &sccbMgrTbl[p_card][currSCCB->TargID]; | 3493 | currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID]; |
6357 | 3494 | ||
6358 | if (message == SMREST_DATA_PTR) | 3495 | if (message == SMREST_DATA_PTR) |
6359 | { | 3496 | { |
@@ -6361,7 +3498,7 @@ void sdecm(UCHAR message, ULONG port, UCHAR p_card) | |||
6361 | { | 3498 | { |
6362 | currSCCB->Sccb_ATC = currSCCB->Sccb_savedATC; | 3499 | currSCCB->Sccb_ATC = currSCCB->Sccb_savedATC; |
6363 | 3500 | ||
6364 | hostDataXferRestart(currSCCB); | 3501 | FPT_hostDataXferRestart(currSCCB); |
6365 | } | 3502 | } |
6366 | 3503 | ||
6367 | ACCEPT_MSG(port); | 3504 | ACCEPT_MSG(port); |
@@ -6417,7 +3554,6 @@ void sdecm(UCHAR message, ULONG port, UCHAR p_card) | |||
6417 | currTar_Info->TarEEValue &= ~EE_SYNC_MASK; | 3554 | currTar_Info->TarEEValue &= ~EE_SYNC_MASK; |
6418 | } | 3555 | } |
6419 | 3556 | ||
6420 | #if defined(WIDE_SCSI) | ||
6421 | else if ((currSCCB->Sccb_scsistat == SELECT_WN_ST)) | 3557 | else if ((currSCCB->Sccb_scsistat == SELECT_WN_ST)) |
6422 | { | 3558 | { |
6423 | 3559 | ||
@@ -6428,7 +3564,6 @@ void sdecm(UCHAR message, ULONG port, UCHAR p_card) | |||
6428 | currTar_Info->TarEEValue &= ~EE_WIDE_SCSI; | 3564 | currTar_Info->TarEEValue &= ~EE_WIDE_SCSI; |
6429 | 3565 | ||
6430 | } | 3566 | } |
6431 | #endif | ||
6432 | 3567 | ||
6433 | else if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) == TAG_Q_TRYING ) | 3568 | else if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) == TAG_Q_TRYING ) |
6434 | { | 3569 | { |
@@ -6460,9 +3595,9 @@ void sdecm(UCHAR message, ULONG port, UCHAR p_card) | |||
6460 | 3595 | ||
6461 | if((CurrCard->globalFlags & F_CONLUN_IO) && | 3596 | if((CurrCard->globalFlags & F_CONLUN_IO) && |
6462 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) | 3597 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) |
6463 | currTar_Info->TarLUNBusy[currSCCB->Lun] = TRUE; | 3598 | currTar_Info->TarLUNBusy[currSCCB->Lun] = 1; |
6464 | else | 3599 | else |
6465 | currTar_Info->TarLUNBusy[0] = TRUE; | 3600 | currTar_Info->TarLUNBusy[0] = 1; |
6466 | 3601 | ||
6467 | 3602 | ||
6468 | currSCCB->ControlByte &= ~(UCHAR)F_USE_CMD_Q; | 3603 | currSCCB->ControlByte &= ~(UCHAR)F_USE_CMD_Q; |
@@ -6490,7 +3625,7 @@ void sdecm(UCHAR message, ULONG port, UCHAR p_card) | |||
6490 | { | 3625 | { |
6491 | 3626 | ||
6492 | ACCEPT_MSG(port); | 3627 | ACCEPT_MSG(port); |
6493 | shandem(port,p_card,currSCCB); | 3628 | FPT_shandem(port,p_card,currSCCB); |
6494 | } | 3629 | } |
6495 | 3630 | ||
6496 | else if (message == SMIGNORWR) | 3631 | else if (message == SMIGNORWR) |
@@ -6498,7 +3633,7 @@ void sdecm(UCHAR message, ULONG port, UCHAR p_card) | |||
6498 | 3633 | ||
6499 | ACCEPT_MSG(port); /* ACK the RESIDUE MSG */ | 3634 | ACCEPT_MSG(port); /* ACK the RESIDUE MSG */ |
6500 | 3635 | ||
6501 | message = sfm(port,currSCCB); | 3636 | message = FPT_sfm(port,currSCCB); |
6502 | 3637 | ||
6503 | if(currSCCB->Sccb_scsimsg != SMPARITY) | 3638 | if(currSCCB->Sccb_scsimsg != SMPARITY) |
6504 | ACCEPT_MSG(port); | 3639 | ACCEPT_MSG(port); |
@@ -6520,25 +3655,21 @@ void sdecm(UCHAR message, ULONG port, UCHAR p_card) | |||
6520 | 3655 | ||
6521 | /*--------------------------------------------------------------------- | 3656 | /*--------------------------------------------------------------------- |
6522 | * | 3657 | * |
6523 | * Function: shandem | 3658 | * Function: FPT_shandem |
6524 | * | 3659 | * |
6525 | * Description: Decide what to do with the extended message. | 3660 | * Description: Decide what to do with the extended message. |
6526 | * | 3661 | * |
6527 | *---------------------------------------------------------------------*/ | 3662 | *---------------------------------------------------------------------*/ |
6528 | #if defined(DOS) | 3663 | static void FPT_shandem(ULONG port, UCHAR p_card, PSCCB pCurrSCCB) |
6529 | void shandem(USHORT port, UCHAR p_card, PSCCB pCurrSCCB) | ||
6530 | #else | ||
6531 | void shandem(ULONG port, UCHAR p_card, PSCCB pCurrSCCB) | ||
6532 | #endif | ||
6533 | { | 3664 | { |
6534 | UCHAR length,message; | 3665 | UCHAR length,message; |
6535 | 3666 | ||
6536 | length = sfm(port,pCurrSCCB); | 3667 | length = FPT_sfm(port,pCurrSCCB); |
6537 | if (length) | 3668 | if (length) |
6538 | { | 3669 | { |
6539 | 3670 | ||
6540 | ACCEPT_MSG(port); | 3671 | ACCEPT_MSG(port); |
6541 | message = sfm(port,pCurrSCCB); | 3672 | message = FPT_sfm(port,pCurrSCCB); |
6542 | if (message) | 3673 | if (message) |
6543 | { | 3674 | { |
6544 | 3675 | ||
@@ -6549,7 +3680,7 @@ void shandem(ULONG port, UCHAR p_card, PSCCB pCurrSCCB) | |||
6549 | { | 3680 | { |
6550 | 3681 | ||
6551 | ACCEPT_MSG(port); | 3682 | ACCEPT_MSG(port); |
6552 | stsyncn(port,p_card); | 3683 | FPT_stsyncn(port,p_card); |
6553 | } | 3684 | } |
6554 | else | 3685 | else |
6555 | { | 3686 | { |
@@ -6558,7 +3689,6 @@ void shandem(ULONG port, UCHAR p_card, PSCCB pCurrSCCB) | |||
6558 | ACCEPT_MSG_ATN(port); | 3689 | ACCEPT_MSG_ATN(port); |
6559 | } | 3690 | } |
6560 | } | 3691 | } |
6561 | #if defined(WIDE_SCSI) | ||
6562 | else if (message == SMWDTR) | 3692 | else if (message == SMWDTR) |
6563 | { | 3693 | { |
6564 | 3694 | ||
@@ -6566,7 +3696,7 @@ void shandem(ULONG port, UCHAR p_card, PSCCB pCurrSCCB) | |||
6566 | { | 3696 | { |
6567 | 3697 | ||
6568 | ACCEPT_MSG(port); | 3698 | ACCEPT_MSG(port); |
6569 | stwidn(port,p_card); | 3699 | FPT_stwidn(port,p_card); |
6570 | } | 3700 | } |
6571 | else | 3701 | else |
6572 | { | 3702 | { |
@@ -6577,7 +3707,6 @@ void shandem(ULONG port, UCHAR p_card, PSCCB pCurrSCCB) | |||
6577 | WR_HARPOON(port+hp_autostart_1, (AUTO_IMMED+DISCONNECT_START)); | 3707 | WR_HARPOON(port+hp_autostart_1, (AUTO_IMMED+DISCONNECT_START)); |
6578 | } | 3708 | } |
6579 | } | 3709 | } |
6580 | #endif | ||
6581 | else | 3710 | else |
6582 | { | 3711 | { |
6583 | 3712 | ||
@@ -6603,24 +3732,20 @@ void shandem(ULONG port, UCHAR p_card, PSCCB pCurrSCCB) | |||
6603 | 3732 | ||
6604 | /*--------------------------------------------------------------------- | 3733 | /*--------------------------------------------------------------------- |
6605 | * | 3734 | * |
6606 | * Function: sisyncn | 3735 | * Function: FPT_sisyncn |
6607 | * | 3736 | * |
6608 | * Description: Read in a message byte from the SCSI bus, and check | 3737 | * Description: Read in a message byte from the SCSI bus, and check |
6609 | * for a parity error. | 3738 | * for a parity error. |
6610 | * | 3739 | * |
6611 | *---------------------------------------------------------------------*/ | 3740 | *---------------------------------------------------------------------*/ |
6612 | 3741 | ||
6613 | #if defined(DOS) | 3742 | static UCHAR FPT_sisyncn(ULONG port, UCHAR p_card, UCHAR syncFlag) |
6614 | UCHAR sisyncn(USHORT port, UCHAR p_card, UCHAR syncFlag) | ||
6615 | #else | ||
6616 | UCHAR sisyncn(ULONG port, UCHAR p_card, UCHAR syncFlag) | ||
6617 | #endif | ||
6618 | { | 3743 | { |
6619 | PSCCB currSCCB; | 3744 | PSCCB currSCCB; |
6620 | PSCCBMgr_tar_info currTar_Info; | 3745 | PSCCBMgr_tar_info currTar_Info; |
6621 | 3746 | ||
6622 | currSCCB = BL_Card[p_card].currentSCCB; | 3747 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
6623 | currTar_Info = &sccbMgrTbl[p_card][currSCCB->TargID]; | 3748 | currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID]; |
6624 | 3749 | ||
6625 | if (!((currTar_Info->TarStatus & TAR_SYNC_MASK) == SYNC_TRYING)) { | 3750 | if (!((currTar_Info->TarStatus & TAR_SYNC_MASK) == SYNC_TRYING)) { |
6626 | 3751 | ||
@@ -6656,7 +3781,7 @@ UCHAR sisyncn(ULONG port, UCHAR p_card, UCHAR syncFlag) | |||
6656 | WRW_HARPOON((port+SYNC_MSGS+12),(BRH_OP+ALWAYS+NP )); | 3781 | WRW_HARPOON((port+SYNC_MSGS+12),(BRH_OP+ALWAYS+NP )); |
6657 | 3782 | ||
6658 | 3783 | ||
6659 | if(syncFlag == FALSE) | 3784 | if(syncFlag == 0) |
6660 | { | 3785 | { |
6661 | WR_HARPOON(port+hp_autostart_3, (SELECT+SELCHK_STRT)); | 3786 | WR_HARPOON(port+hp_autostart_3, (SELECT+SELCHK_STRT)); |
6662 | currTar_Info->TarStatus = ((currTar_Info->TarStatus & | 3787 | currTar_Info->TarStatus = ((currTar_Info->TarStatus & |
@@ -6668,14 +3793,14 @@ UCHAR sisyncn(ULONG port, UCHAR p_card, UCHAR syncFlag) | |||
6668 | } | 3793 | } |
6669 | 3794 | ||
6670 | 3795 | ||
6671 | return(TRUE); | 3796 | return(1); |
6672 | } | 3797 | } |
6673 | 3798 | ||
6674 | else { | 3799 | else { |
6675 | 3800 | ||
6676 | currTar_Info->TarStatus |= (UCHAR)SYNC_SUPPORTED; | 3801 | currTar_Info->TarStatus |= (UCHAR)SYNC_SUPPORTED; |
6677 | currTar_Info->TarEEValue &= ~EE_SYNC_MASK; | 3802 | currTar_Info->TarEEValue &= ~EE_SYNC_MASK; |
6678 | return(FALSE); | 3803 | return(0); |
6679 | } | 3804 | } |
6680 | } | 3805 | } |
6681 | 3806 | ||
@@ -6683,26 +3808,22 @@ UCHAR sisyncn(ULONG port, UCHAR p_card, UCHAR syncFlag) | |||
6683 | 3808 | ||
6684 | /*--------------------------------------------------------------------- | 3809 | /*--------------------------------------------------------------------- |
6685 | * | 3810 | * |
6686 | * Function: stsyncn | 3811 | * Function: FPT_stsyncn |
6687 | * | 3812 | * |
6688 | * Description: The has sent us a Sync Nego message so handle it as | 3813 | * Description: The has sent us a Sync Nego message so handle it as |
6689 | * necessary. | 3814 | * necessary. |
6690 | * | 3815 | * |
6691 | *---------------------------------------------------------------------*/ | 3816 | *---------------------------------------------------------------------*/ |
6692 | #if defined(DOS) | 3817 | static void FPT_stsyncn(ULONG port, UCHAR p_card) |
6693 | void stsyncn(USHORT port, UCHAR p_card) | ||
6694 | #else | ||
6695 | void stsyncn(ULONG port, UCHAR p_card) | ||
6696 | #endif | ||
6697 | { | 3818 | { |
6698 | UCHAR sync_msg,offset,sync_reg,our_sync_msg; | 3819 | UCHAR sync_msg,offset,sync_reg,our_sync_msg; |
6699 | PSCCB currSCCB; | 3820 | PSCCB currSCCB; |
6700 | PSCCBMgr_tar_info currTar_Info; | 3821 | PSCCBMgr_tar_info currTar_Info; |
6701 | 3822 | ||
6702 | currSCCB = BL_Card[p_card].currentSCCB; | 3823 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
6703 | currTar_Info = &sccbMgrTbl[p_card][currSCCB->TargID]; | 3824 | currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID]; |
6704 | 3825 | ||
6705 | sync_msg = sfm(port,currSCCB); | 3826 | sync_msg = FPT_sfm(port,currSCCB); |
6706 | 3827 | ||
6707 | if((sync_msg == 0x00) && (currSCCB->Sccb_scsimsg == SMPARITY)) | 3828 | if((sync_msg == 0x00) && (currSCCB->Sccb_scsimsg == SMPARITY)) |
6708 | { | 3829 | { |
@@ -6713,7 +3834,7 @@ void stsyncn(ULONG port, UCHAR p_card) | |||
6713 | ACCEPT_MSG(port); | 3834 | ACCEPT_MSG(port); |
6714 | 3835 | ||
6715 | 3836 | ||
6716 | offset = sfm(port,currSCCB); | 3837 | offset = FPT_sfm(port,currSCCB); |
6717 | 3838 | ||
6718 | if((offset == 0x00) && (currSCCB->Sccb_scsimsg == SMPARITY)) | 3839 | if((offset == 0x00) && (currSCCB->Sccb_scsimsg == SMPARITY)) |
6719 | { | 3840 | { |
@@ -6783,7 +3904,6 @@ void stsyncn(ULONG port, UCHAR p_card) | |||
6783 | } | 3904 | } |
6784 | 3905 | ||
6785 | 3906 | ||
6786 | #if defined(WIDE_SCSI) | ||
6787 | if (currTar_Info->TarStatus & WIDE_ENABLED) | 3907 | if (currTar_Info->TarStatus & WIDE_ENABLED) |
6788 | 3908 | ||
6789 | sync_reg |= offset; | 3909 | sync_reg |= offset; |
@@ -6792,11 +3912,7 @@ void stsyncn(ULONG port, UCHAR p_card) | |||
6792 | 3912 | ||
6793 | sync_reg |= (offset | NARROW_SCSI); | 3913 | sync_reg |= (offset | NARROW_SCSI); |
6794 | 3914 | ||
6795 | #else | 3915 | FPT_sssyncv(port,currSCCB->TargID,sync_reg,currTar_Info); |
6796 | sync_reg |= (offset | NARROW_SCSI); | ||
6797 | #endif | ||
6798 | |||
6799 | sssyncv(port,currSCCB->TargID,sync_reg,currTar_Info); | ||
6800 | 3916 | ||
6801 | 3917 | ||
6802 | if (currSCCB->Sccb_scsistat == SELECT_SN_ST) { | 3918 | if (currSCCB->Sccb_scsistat == SELECT_SN_ST) { |
@@ -6815,7 +3931,7 @@ void stsyncn(ULONG port, UCHAR p_card) | |||
6815 | 3931 | ||
6816 | ACCEPT_MSG_ATN(port); | 3932 | ACCEPT_MSG_ATN(port); |
6817 | 3933 | ||
6818 | sisyncr(port,sync_msg,offset); | 3934 | FPT_sisyncr(port,sync_msg,offset); |
6819 | 3935 | ||
6820 | currTar_Info->TarStatus = ((currTar_Info->TarStatus & | 3936 | currTar_Info->TarStatus = ((currTar_Info->TarStatus & |
6821 | ~(UCHAR)TAR_SYNC_MASK) | (UCHAR)SYNC_SUPPORTED); | 3937 | ~(UCHAR)TAR_SYNC_MASK) | (UCHAR)SYNC_SUPPORTED); |
@@ -6825,16 +3941,12 @@ void stsyncn(ULONG port, UCHAR p_card) | |||
6825 | 3941 | ||
6826 | /*--------------------------------------------------------------------- | 3942 | /*--------------------------------------------------------------------- |
6827 | * | 3943 | * |
6828 | * Function: sisyncr | 3944 | * Function: FPT_sisyncr |
6829 | * | 3945 | * |
6830 | * Description: Answer the targets sync message. | 3946 | * Description: Answer the targets sync message. |
6831 | * | 3947 | * |
6832 | *---------------------------------------------------------------------*/ | 3948 | *---------------------------------------------------------------------*/ |
6833 | #if defined(DOS) | 3949 | static void FPT_sisyncr(ULONG port,UCHAR sync_pulse, UCHAR offset) |
6834 | void sisyncr(USHORT port,UCHAR sync_pulse, UCHAR offset) | ||
6835 | #else | ||
6836 | void sisyncr(ULONG port,UCHAR sync_pulse, UCHAR offset) | ||
6837 | #endif | ||
6838 | { | 3950 | { |
6839 | ARAM_ACCESS(port); | 3951 | ARAM_ACCESS(port); |
6840 | WRW_HARPOON((port+SYNC_MSGS+0), (MPM_OP+AMSG_OUT+SMEXT )); | 3952 | WRW_HARPOON((port+SYNC_MSGS+0), (MPM_OP+AMSG_OUT+SMEXT )); |
@@ -6856,28 +3968,22 @@ void sisyncr(ULONG port,UCHAR sync_pulse, UCHAR offset) | |||
6856 | 3968 | ||
6857 | 3969 | ||
6858 | 3970 | ||
6859 | #if defined(WIDE_SCSI) | ||
6860 | |||
6861 | /*--------------------------------------------------------------------- | 3971 | /*--------------------------------------------------------------------- |
6862 | * | 3972 | * |
6863 | * Function: siwidn | 3973 | * Function: FPT_siwidn |
6864 | * | 3974 | * |
6865 | * Description: Read in a message byte from the SCSI bus, and check | 3975 | * Description: Read in a message byte from the SCSI bus, and check |
6866 | * for a parity error. | 3976 | * for a parity error. |
6867 | * | 3977 | * |
6868 | *---------------------------------------------------------------------*/ | 3978 | *---------------------------------------------------------------------*/ |
6869 | 3979 | ||
6870 | #if defined(DOS) | 3980 | static UCHAR FPT_siwidn(ULONG port, UCHAR p_card) |
6871 | UCHAR siwidn(USHORT port, UCHAR p_card) | ||
6872 | #else | ||
6873 | UCHAR siwidn(ULONG port, UCHAR p_card) | ||
6874 | #endif | ||
6875 | { | 3981 | { |
6876 | PSCCB currSCCB; | 3982 | PSCCB currSCCB; |
6877 | PSCCBMgr_tar_info currTar_Info; | 3983 | PSCCBMgr_tar_info currTar_Info; |
6878 | 3984 | ||
6879 | currSCCB = BL_Card[p_card].currentSCCB; | 3985 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
6880 | currTar_Info = &sccbMgrTbl[p_card][currSCCB->TargID]; | 3986 | currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID]; |
6881 | 3987 | ||
6882 | if (!((currTar_Info->TarStatus & TAR_WIDE_MASK) == WIDE_NEGOCIATED)) { | 3988 | if (!((currTar_Info->TarStatus & TAR_WIDE_MASK) == WIDE_NEGOCIATED)) { |
6883 | 3989 | ||
@@ -6900,7 +4006,7 @@ UCHAR siwidn(ULONG port, UCHAR p_card) | |||
6900 | currTar_Info->TarStatus = ((currTar_Info->TarStatus & | 4006 | currTar_Info->TarStatus = ((currTar_Info->TarStatus & |
6901 | ~(UCHAR)TAR_WIDE_MASK) | (UCHAR)WIDE_ENABLED); | 4007 | ~(UCHAR)TAR_WIDE_MASK) | (UCHAR)WIDE_ENABLED); |
6902 | 4008 | ||
6903 | return(TRUE); | 4009 | return(1); |
6904 | } | 4010 | } |
6905 | 4011 | ||
6906 | else { | 4012 | else { |
@@ -6909,7 +4015,7 @@ UCHAR siwidn(ULONG port, UCHAR p_card) | |||
6909 | ~(UCHAR)TAR_WIDE_MASK) | WIDE_NEGOCIATED); | 4015 | ~(UCHAR)TAR_WIDE_MASK) | WIDE_NEGOCIATED); |
6910 | 4016 | ||
6911 | currTar_Info->TarEEValue &= ~EE_WIDE_SCSI; | 4017 | currTar_Info->TarEEValue &= ~EE_WIDE_SCSI; |
6912 | return(FALSE); | 4018 | return(0); |
6913 | } | 4019 | } |
6914 | } | 4020 | } |
6915 | 4021 | ||
@@ -6917,26 +4023,22 @@ UCHAR siwidn(ULONG port, UCHAR p_card) | |||
6917 | 4023 | ||
6918 | /*--------------------------------------------------------------------- | 4024 | /*--------------------------------------------------------------------- |
6919 | * | 4025 | * |
6920 | * Function: stwidn | 4026 | * Function: FPT_stwidn |
6921 | * | 4027 | * |
6922 | * Description: The has sent us a Wide Nego message so handle it as | 4028 | * Description: The has sent us a Wide Nego message so handle it as |
6923 | * necessary. | 4029 | * necessary. |
6924 | * | 4030 | * |
6925 | *---------------------------------------------------------------------*/ | 4031 | *---------------------------------------------------------------------*/ |
6926 | #if defined(DOS) | 4032 | static void FPT_stwidn(ULONG port, UCHAR p_card) |
6927 | void stwidn(USHORT port, UCHAR p_card) | ||
6928 | #else | ||
6929 | void stwidn(ULONG port, UCHAR p_card) | ||
6930 | #endif | ||
6931 | { | 4033 | { |
6932 | UCHAR width; | 4034 | UCHAR width; |
6933 | PSCCB currSCCB; | 4035 | PSCCB currSCCB; |
6934 | PSCCBMgr_tar_info currTar_Info; | 4036 | PSCCBMgr_tar_info currTar_Info; |
6935 | 4037 | ||
6936 | currSCCB = BL_Card[p_card].currentSCCB; | 4038 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
6937 | currTar_Info = &sccbMgrTbl[p_card][currSCCB->TargID]; | 4039 | currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID]; |
6938 | 4040 | ||
6939 | width = sfm(port,currSCCB); | 4041 | width = FPT_sfm(port,currSCCB); |
6940 | 4042 | ||
6941 | if((width == 0x00) && (currSCCB->Sccb_scsimsg == SMPARITY)) | 4043 | if((width == 0x00) && (currSCCB->Sccb_scsimsg == SMPARITY)) |
6942 | { | 4044 | { |
@@ -6958,7 +4060,7 @@ void stwidn(ULONG port, UCHAR p_card) | |||
6958 | } | 4060 | } |
6959 | 4061 | ||
6960 | 4062 | ||
6961 | sssyncv(port,currSCCB->TargID,width,currTar_Info); | 4063 | FPT_sssyncv(port,currSCCB->TargID,width,currTar_Info); |
6962 | 4064 | ||
6963 | 4065 | ||
6964 | if (currSCCB->Sccb_scsistat == SELECT_WN_ST) | 4066 | if (currSCCB->Sccb_scsistat == SELECT_WN_ST) |
@@ -6972,7 +4074,7 @@ void stwidn(ULONG port, UCHAR p_card) | |||
6972 | { | 4074 | { |
6973 | ACCEPT_MSG_ATN(port); | 4075 | ACCEPT_MSG_ATN(port); |
6974 | ARAM_ACCESS(port); | 4076 | ARAM_ACCESS(port); |
6975 | sisyncn(port,p_card, TRUE); | 4077 | FPT_sisyncn(port,p_card, 1); |
6976 | currSCCB->Sccb_scsistat = SELECT_SN_ST; | 4078 | currSCCB->Sccb_scsistat = SELECT_SN_ST; |
6977 | SGRAM_ACCESS(port); | 4079 | SGRAM_ACCESS(port); |
6978 | } | 4080 | } |
@@ -6993,7 +4095,7 @@ void stwidn(ULONG port, UCHAR p_card) | |||
6993 | else | 4095 | else |
6994 | width = SM8BIT; | 4096 | width = SM8BIT; |
6995 | 4097 | ||
6996 | siwidr(port,width); | 4098 | FPT_siwidr(port,width); |
6997 | 4099 | ||
6998 | currTar_Info->TarStatus |= (WIDE_NEGOCIATED | WIDE_ENABLED); | 4100 | currTar_Info->TarStatus |= (WIDE_NEGOCIATED | WIDE_ENABLED); |
6999 | } | 4101 | } |
@@ -7002,16 +4104,12 @@ void stwidn(ULONG port, UCHAR p_card) | |||
7002 | 4104 | ||
7003 | /*--------------------------------------------------------------------- | 4105 | /*--------------------------------------------------------------------- |
7004 | * | 4106 | * |
7005 | * Function: siwidr | 4107 | * Function: FPT_siwidr |
7006 | * | 4108 | * |
7007 | * Description: Answer the targets Wide nego message. | 4109 | * Description: Answer the targets Wide nego message. |
7008 | * | 4110 | * |
7009 | *---------------------------------------------------------------------*/ | 4111 | *---------------------------------------------------------------------*/ |
7010 | #if defined(DOS) | 4112 | static void FPT_siwidr(ULONG port, UCHAR width) |
7011 | void siwidr(USHORT port, UCHAR width) | ||
7012 | #else | ||
7013 | void siwidr(ULONG port, UCHAR width) | ||
7014 | #endif | ||
7015 | { | 4113 | { |
7016 | ARAM_ACCESS(port); | 4114 | ARAM_ACCESS(port); |
7017 | WRW_HARPOON((port+SYNC_MSGS+0), (MPM_OP+AMSG_OUT+SMEXT )); | 4115 | WRW_HARPOON((port+SYNC_MSGS+0), (MPM_OP+AMSG_OUT+SMEXT )); |
@@ -7030,23 +4128,18 @@ void siwidr(ULONG port, UCHAR width) | |||
7030 | while (!(RDW_HARPOON((port+hp_intstat)) & (BUS_FREE | AUTO_INT))) {} | 4128 | while (!(RDW_HARPOON((port+hp_intstat)) & (BUS_FREE | AUTO_INT))) {} |
7031 | } | 4129 | } |
7032 | 4130 | ||
7033 | #endif | ||
7034 | |||
7035 | 4131 | ||
7036 | 4132 | ||
7037 | /*--------------------------------------------------------------------- | 4133 | /*--------------------------------------------------------------------- |
7038 | * | 4134 | * |
7039 | * Function: sssyncv | 4135 | * Function: FPT_sssyncv |
7040 | * | 4136 | * |
7041 | * Description: Write the desired value to the Sync Register for the | 4137 | * Description: Write the desired value to the Sync Register for the |
7042 | * ID specified. | 4138 | * ID specified. |
7043 | * | 4139 | * |
7044 | *---------------------------------------------------------------------*/ | 4140 | *---------------------------------------------------------------------*/ |
7045 | #if defined(DOS) | 4141 | static void FPT_sssyncv(ULONG p_port, UCHAR p_id, UCHAR p_sync_value, |
7046 | void sssyncv(USHORT p_port, UCHAR p_id, UCHAR p_sync_value,PSCCBMgr_tar_info currTar_Info) | 4142 | PSCCBMgr_tar_info currTar_Info) |
7047 | #else | ||
7048 | void sssyncv(ULONG p_port, UCHAR p_id, UCHAR p_sync_value,PSCCBMgr_tar_info currTar_Info) | ||
7049 | #endif | ||
7050 | { | 4143 | { |
7051 | UCHAR index; | 4144 | UCHAR index; |
7052 | 4145 | ||
@@ -7112,16 +4205,12 @@ void sssyncv(ULONG p_port, UCHAR p_id, UCHAR p_sync_value,PSCCBMgr_tar_info curr | |||
7112 | 4205 | ||
7113 | /*--------------------------------------------------------------------- | 4206 | /*--------------------------------------------------------------------- |
7114 | * | 4207 | * |
7115 | * Function: sresb | 4208 | * Function: FPT_sresb |
7116 | * | 4209 | * |
7117 | * Description: Reset the desired card's SCSI bus. | 4210 | * Description: Reset the desired card's SCSI bus. |
7118 | * | 4211 | * |
7119 | *---------------------------------------------------------------------*/ | 4212 | *---------------------------------------------------------------------*/ |
7120 | #if defined(DOS) | 4213 | static void FPT_sresb(ULONG port, UCHAR p_card) |
7121 | void sresb(USHORT port, UCHAR p_card) | ||
7122 | #else | ||
7123 | void sresb(ULONG port, UCHAR p_card) | ||
7124 | #endif | ||
7125 | { | 4214 | { |
7126 | UCHAR scsiID, i; | 4215 | UCHAR scsiID, i; |
7127 | 4216 | ||
@@ -7145,7 +4234,7 @@ void sresb(ULONG port, UCHAR p_card) | |||
7145 | 4234 | ||
7146 | WR_HARPOON(port+hp_scsictrl_0, ENA_SCAM_SEL); | 4235 | WR_HARPOON(port+hp_scsictrl_0, ENA_SCAM_SEL); |
7147 | 4236 | ||
7148 | Wait(port, TO_5ms); | 4237 | FPT_Wait(port, TO_5ms); |
7149 | 4238 | ||
7150 | WRW_HARPOON((port+hp_intstat), CLR_ALL_INT); | 4239 | WRW_HARPOON((port+hp_intstat), CLR_ALL_INT); |
7151 | 4240 | ||
@@ -7153,7 +4242,7 @@ void sresb(ULONG port, UCHAR p_card) | |||
7153 | 4242 | ||
7154 | for (scsiID = 0; scsiID < MAX_SCSI_TAR; scsiID++) | 4243 | for (scsiID = 0; scsiID < MAX_SCSI_TAR; scsiID++) |
7155 | { | 4244 | { |
7156 | currTar_Info = &sccbMgrTbl[p_card][scsiID]; | 4245 | currTar_Info = &FPT_sccbMgrTbl[p_card][scsiID]; |
7157 | 4246 | ||
7158 | if (currTar_Info->TarEEValue & EE_SYNC_MASK) | 4247 | if (currTar_Info->TarEEValue & EE_SYNC_MASK) |
7159 | { | 4248 | { |
@@ -7166,21 +4255,21 @@ void sresb(ULONG port, UCHAR p_card) | |||
7166 | currTar_Info->TarStatus &= ~TAR_WIDE_MASK; | 4255 | currTar_Info->TarStatus &= ~TAR_WIDE_MASK; |
7167 | } | 4256 | } |
7168 | 4257 | ||
7169 | sssyncv(port, scsiID, NARROW_SCSI,currTar_Info); | 4258 | FPT_sssyncv(port, scsiID, NARROW_SCSI,currTar_Info); |
7170 | 4259 | ||
7171 | SccbMgrTableInitTarget(p_card, scsiID); | 4260 | FPT_SccbMgrTableInitTarget(p_card, scsiID); |
7172 | } | 4261 | } |
7173 | 4262 | ||
7174 | BL_Card[p_card].scanIndex = 0x00; | 4263 | FPT_BL_Card[p_card].scanIndex = 0x00; |
7175 | BL_Card[p_card].currentSCCB = NULL; | 4264 | FPT_BL_Card[p_card].currentSCCB = NULL; |
7176 | BL_Card[p_card].globalFlags &= ~(F_TAG_STARTED | F_HOST_XFER_ACT | 4265 | FPT_BL_Card[p_card].globalFlags &= ~(F_TAG_STARTED | F_HOST_XFER_ACT |
7177 | | F_NEW_SCCB_CMD); | 4266 | | F_NEW_SCCB_CMD); |
7178 | BL_Card[p_card].cmdCounter = 0x00; | 4267 | FPT_BL_Card[p_card].cmdCounter = 0x00; |
7179 | BL_Card[p_card].discQCount = 0x00; | 4268 | FPT_BL_Card[p_card].discQCount = 0x00; |
7180 | BL_Card[p_card].tagQ_Lst = 0x01; | 4269 | FPT_BL_Card[p_card].tagQ_Lst = 0x01; |
7181 | 4270 | ||
7182 | for(i = 0; i < QUEUE_DEPTH; i++) | 4271 | for(i = 0; i < QUEUE_DEPTH; i++) |
7183 | BL_Card[p_card].discQ_Tbl[i] = NULL; | 4272 | FPT_BL_Card[p_card].discQ_Tbl[i] = NULL; |
7184 | 4273 | ||
7185 | WR_HARPOON(port+hp_page_ctrl, | 4274 | WR_HARPOON(port+hp_page_ctrl, |
7186 | (RD_HARPOON(port+hp_page_ctrl) & ~G_INT_DISABLE)); | 4275 | (RD_HARPOON(port+hp_page_ctrl) & ~G_INT_DISABLE)); |
@@ -7189,12 +4278,12 @@ void sresb(ULONG port, UCHAR p_card) | |||
7189 | 4278 | ||
7190 | /*--------------------------------------------------------------------- | 4279 | /*--------------------------------------------------------------------- |
7191 | * | 4280 | * |
7192 | * Function: ssenss | 4281 | * Function: FPT_ssenss |
7193 | * | 4282 | * |
7194 | * Description: Setup for the Auto Sense command. | 4283 | * Description: Setup for the Auto Sense command. |
7195 | * | 4284 | * |
7196 | *---------------------------------------------------------------------*/ | 4285 | *---------------------------------------------------------------------*/ |
7197 | void ssenss(PSCCBcard pCurrCard) | 4286 | static void FPT_ssenss(PSCCBcard pCurrCard) |
7198 | { | 4287 | { |
7199 | UCHAR i; | 4288 | UCHAR i; |
7200 | PSCCB currSCCB; | 4289 | PSCCB currSCCB; |
@@ -7236,27 +4325,23 @@ void ssenss(PSCCBcard pCurrCard) | |||
7236 | 4325 | ||
7237 | /*--------------------------------------------------------------------- | 4326 | /*--------------------------------------------------------------------- |
7238 | * | 4327 | * |
7239 | * Function: sxfrp | 4328 | * Function: FPT_sxfrp |
7240 | * | 4329 | * |
7241 | * Description: Transfer data into the bit bucket until the device | 4330 | * Description: Transfer data into the bit bucket until the device |
7242 | * decides to switch phase. | 4331 | * decides to switch phase. |
7243 | * | 4332 | * |
7244 | *---------------------------------------------------------------------*/ | 4333 | *---------------------------------------------------------------------*/ |
7245 | 4334 | ||
7246 | #if defined(DOS) | 4335 | static void FPT_sxfrp(ULONG p_port, UCHAR p_card) |
7247 | void sxfrp(USHORT p_port, UCHAR p_card) | ||
7248 | #else | ||
7249 | void sxfrp(ULONG p_port, UCHAR p_card) | ||
7250 | #endif | ||
7251 | { | 4336 | { |
7252 | UCHAR curr_phz; | 4337 | UCHAR curr_phz; |
7253 | 4338 | ||
7254 | 4339 | ||
7255 | DISABLE_AUTO(p_port); | 4340 | DISABLE_AUTO(p_port); |
7256 | 4341 | ||
7257 | if (BL_Card[p_card].globalFlags & F_HOST_XFER_ACT) { | 4342 | if (FPT_BL_Card[p_card].globalFlags & F_HOST_XFER_ACT) { |
7258 | 4343 | ||
7259 | hostDataXferAbort(p_port,p_card,BL_Card[p_card].currentSCCB); | 4344 | FPT_hostDataXferAbort(p_port,p_card,FPT_BL_Card[p_card].currentSCCB); |
7260 | 4345 | ||
7261 | } | 4346 | } |
7262 | 4347 | ||
@@ -7322,25 +4407,21 @@ void sxfrp(ULONG p_port, UCHAR p_card) | |||
7322 | 4407 | ||
7323 | /*--------------------------------------------------------------------- | 4408 | /*--------------------------------------------------------------------- |
7324 | * | 4409 | * |
7325 | * Function: schkdd | 4410 | * Function: FPT_schkdd |
7326 | * | 4411 | * |
7327 | * Description: Make sure data has been flushed from both FIFOs and abort | 4412 | * Description: Make sure data has been flushed from both FIFOs and abort |
7328 | * the operations if necessary. | 4413 | * the operations if necessary. |
7329 | * | 4414 | * |
7330 | *---------------------------------------------------------------------*/ | 4415 | *---------------------------------------------------------------------*/ |
7331 | 4416 | ||
7332 | #if defined(DOS) | 4417 | static void FPT_schkdd(ULONG port, UCHAR p_card) |
7333 | void schkdd(USHORT port, UCHAR p_card) | ||
7334 | #else | ||
7335 | void schkdd(ULONG port, UCHAR p_card) | ||
7336 | #endif | ||
7337 | { | 4418 | { |
7338 | USHORT TimeOutLoop; | 4419 | USHORT TimeOutLoop; |
7339 | UCHAR sPhase; | 4420 | UCHAR sPhase; |
7340 | 4421 | ||
7341 | PSCCB currSCCB; | 4422 | PSCCB currSCCB; |
7342 | 4423 | ||
7343 | currSCCB = BL_Card[p_card].currentSCCB; | 4424 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
7344 | 4425 | ||
7345 | 4426 | ||
7346 | if ((currSCCB->Sccb_scsistat != DATA_OUT_ST) && | 4427 | if ((currSCCB->Sccb_scsistat != DATA_OUT_ST) && |
@@ -7378,7 +4459,7 @@ void schkdd(ULONG port, UCHAR p_card) | |||
7378 | } | 4459 | } |
7379 | 4460 | ||
7380 | 4461 | ||
7381 | hostDataXferAbort(port,p_card,currSCCB); | 4462 | FPT_hostDataXferAbort(port,p_card,currSCCB); |
7382 | 4463 | ||
7383 | 4464 | ||
7384 | while (RD_HARPOON(port+hp_scsisig) & SCSI_ACK) {} | 4465 | while (RD_HARPOON(port+hp_scsisig) & SCSI_ACK) {} |
@@ -7412,21 +4493,21 @@ void schkdd(ULONG port, UCHAR p_card) | |||
7412 | if (!(currSCCB->Sccb_XferState & F_ALL_XFERRED)) | 4493 | if (!(currSCCB->Sccb_XferState & F_ALL_XFERRED)) |
7413 | { | 4494 | { |
7414 | if (currSCCB->Sccb_XferState & F_HOST_XFER_DIR) { | 4495 | if (currSCCB->Sccb_XferState & F_HOST_XFER_DIR) { |
7415 | phaseDataIn(port,p_card); | 4496 | FPT_phaseDataIn(port,p_card); |
7416 | } | 4497 | } |
7417 | 4498 | ||
7418 | else { | 4499 | else { |
7419 | phaseDataOut(port,p_card); | 4500 | FPT_phaseDataOut(port,p_card); |
7420 | } | 4501 | } |
7421 | } | 4502 | } |
7422 | else | 4503 | else |
7423 | { | 4504 | { |
7424 | sxfrp(port,p_card); | 4505 | FPT_sxfrp(port,p_card); |
7425 | if (!(RDW_HARPOON((port+hp_intstat)) & | 4506 | if (!(RDW_HARPOON((port+hp_intstat)) & |
7426 | (BUS_FREE | ICMD_COMP | ITAR_DISC | RESET))) | 4507 | (BUS_FREE | ICMD_COMP | ITAR_DISC | RESET))) |
7427 | { | 4508 | { |
7428 | WRW_HARPOON((port+hp_intstat), AUTO_INT); | 4509 | WRW_HARPOON((port+hp_intstat), AUTO_INT); |
7429 | phaseDecode(port,p_card); | 4510 | FPT_phaseDecode(port,p_card); |
7430 | } | 4511 | } |
7431 | } | 4512 | } |
7432 | 4513 | ||
@@ -7440,13 +4521,13 @@ void schkdd(ULONG port, UCHAR p_card) | |||
7440 | 4521 | ||
7441 | /*--------------------------------------------------------------------- | 4522 | /*--------------------------------------------------------------------- |
7442 | * | 4523 | * |
7443 | * Function: sinits | 4524 | * Function: FPT_sinits |
7444 | * | 4525 | * |
7445 | * Description: Setup SCCB manager fields in this SCCB. | 4526 | * Description: Setup SCCB manager fields in this SCCB. |
7446 | * | 4527 | * |
7447 | *---------------------------------------------------------------------*/ | 4528 | *---------------------------------------------------------------------*/ |
7448 | 4529 | ||
7449 | void sinits(PSCCB p_sccb, UCHAR p_card) | 4530 | static void FPT_sinits(PSCCB p_sccb, UCHAR p_card) |
7450 | { | 4531 | { |
7451 | PSCCBMgr_tar_info currTar_Info; | 4532 | PSCCBMgr_tar_info currTar_Info; |
7452 | 4533 | ||
@@ -7454,7 +4535,7 @@ void sinits(PSCCB p_sccb, UCHAR p_card) | |||
7454 | { | 4535 | { |
7455 | return; | 4536 | return; |
7456 | } | 4537 | } |
7457 | currTar_Info = &sccbMgrTbl[p_card][p_sccb->TargID]; | 4538 | currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID]; |
7458 | 4539 | ||
7459 | p_sccb->Sccb_XferState = 0x00; | 4540 | p_sccb->Sccb_XferState = 0x00; |
7460 | p_sccb->Sccb_XferCnt = p_sccb->DataLength; | 4541 | p_sccb->Sccb_XferCnt = p_sccb->DataLength; |
@@ -7485,7 +4566,7 @@ void sinits(PSCCB p_sccb, UCHAR p_card) | |||
7485 | else send Cmd with Disconnect Disable */ | 4566 | else send Cmd with Disconnect Disable */ |
7486 | 4567 | ||
7487 | /* | 4568 | /* |
7488 | if (((!(BL_Card[p_card].globalFlags & F_SINGLE_DEVICE)) && | 4569 | if (((!(FPT_BL_Card[p_card].globalFlags & F_SINGLE_DEVICE)) && |
7489 | (currTar_Info->TarStatus & TAR_ALLOW_DISC)) || | 4570 | (currTar_Info->TarStatus & TAR_ALLOW_DISC)) || |
7490 | (currTar_Info->TarStatus & TAG_Q_TRYING)) { | 4571 | (currTar_Info->TarStatus & TAG_Q_TRYING)) { |
7491 | */ | 4572 | */ |
@@ -7518,55 +4599,6 @@ void sinits(PSCCB p_sccb, UCHAR p_card) | |||
7518 | } | 4599 | } |
7519 | 4600 | ||
7520 | 4601 | ||
7521 | #ident "$Id: phase.c 1.11 1997/01/31 02:08:49 mohan Exp $" | ||
7522 | /*---------------------------------------------------------------------- | ||
7523 | * | ||
7524 | * | ||
7525 | * Copyright 1995-1996 by Mylex Corporation. All Rights Reserved | ||
7526 | * | ||
7527 | * This file is available under both the GNU General Public License | ||
7528 | * and a BSD-style copyright; see LICENSE.FlashPoint for details. | ||
7529 | * | ||
7530 | * $Workfile: phase.c $ | ||
7531 | * | ||
7532 | * Description: Functions to initially handle the SCSI bus phase when | ||
7533 | * the target asserts request (and the automation is not | ||
7534 | * enabled to handle the situation). | ||
7535 | * | ||
7536 | * $Date: 1997/01/31 02:08:49 $ | ||
7537 | * | ||
7538 | * $Revision: 1.11 $ | ||
7539 | * | ||
7540 | *----------------------------------------------------------------------*/ | ||
7541 | |||
7542 | /*#include <globals.h>*/ | ||
7543 | |||
7544 | #if (FW_TYPE==_UCB_MGR_) | ||
7545 | /*#include <budi.h>*/ | ||
7546 | #endif | ||
7547 | |||
7548 | /*#include <sccbmgr.h>*/ | ||
7549 | /*#include <blx30.h>*/ | ||
7550 | /*#include <target.h>*/ | ||
7551 | /*#include <scsi2.h>*/ | ||
7552 | /*#include <harpoon.h>*/ | ||
7553 | |||
7554 | |||
7555 | /* | ||
7556 | extern SCCBCARD BL_Card[MAX_CARDS]; | ||
7557 | extern SCCBMGR_TAR_INFO sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR]; | ||
7558 | |||
7559 | #if defined(OS2) | ||
7560 | extern void (far *s_PhaseTbl[8]) (ULONG, UCHAR); | ||
7561 | #else | ||
7562 | #if defined(DOS) | ||
7563 | extern void (*s_PhaseTbl[8]) (USHORT, UCHAR); | ||
7564 | #else | ||
7565 | extern void (*s_PhaseTbl[8]) (ULONG, UCHAR); | ||
7566 | #endif | ||
7567 | #endif | ||
7568 | */ | ||
7569 | |||
7570 | /*--------------------------------------------------------------------- | 4602 | /*--------------------------------------------------------------------- |
7571 | * | 4603 | * |
7572 | * Function: Phase Decode | 4604 | * Function: Phase Decode |
@@ -7575,29 +4607,17 @@ extern SCCBMGR_TAR_INFO sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR]; | |||
7575 | * | 4607 | * |
7576 | *---------------------------------------------------------------------*/ | 4608 | *---------------------------------------------------------------------*/ |
7577 | 4609 | ||
7578 | #if defined(DOS) | 4610 | static void FPT_phaseDecode(ULONG p_port, UCHAR p_card) |
7579 | void phaseDecode(USHORT p_port, UCHAR p_card) | ||
7580 | #else | ||
7581 | void phaseDecode(ULONG p_port, UCHAR p_card) | ||
7582 | #endif | ||
7583 | { | 4611 | { |
7584 | unsigned char phase_ref; | 4612 | unsigned char phase_ref; |
7585 | #if defined(OS2) | 4613 | void (*phase) (ULONG, UCHAR); |
7586 | void (far *phase) (ULONG, UCHAR); | ||
7587 | #else | ||
7588 | #if defined(DOS) | ||
7589 | void (*phase) (USHORT, UCHAR); | ||
7590 | #else | ||
7591 | void (*phase) (ULONG, UCHAR); | ||
7592 | #endif | ||
7593 | #endif | ||
7594 | 4614 | ||
7595 | 4615 | ||
7596 | DISABLE_AUTO(p_port); | 4616 | DISABLE_AUTO(p_port); |
7597 | 4617 | ||
7598 | phase_ref = (UCHAR) (RD_HARPOON(p_port+hp_scsisig) & S_SCSI_PHZ); | 4618 | phase_ref = (UCHAR) (RD_HARPOON(p_port+hp_scsisig) & S_SCSI_PHZ); |
7599 | 4619 | ||
7600 | phase = s_PhaseTbl[phase_ref]; | 4620 | phase = FPT_s_PhaseTbl[phase_ref]; |
7601 | 4621 | ||
7602 | (*phase)(p_port, p_card); /* Call the correct phase func */ | 4622 | (*phase)(p_port, p_card); /* Call the correct phase func */ |
7603 | } | 4623 | } |
@@ -7612,20 +4632,12 @@ void phaseDecode(ULONG p_port, UCHAR p_card) | |||
7612 | * | 4632 | * |
7613 | *---------------------------------------------------------------------*/ | 4633 | *---------------------------------------------------------------------*/ |
7614 | 4634 | ||
7615 | #if defined(OS2) | 4635 | static void FPT_phaseDataOut(ULONG port, UCHAR p_card) |
7616 | void far phaseDataOut(ULONG port, UCHAR p_card) | ||
7617 | #else | ||
7618 | #if defined(DOS) | ||
7619 | void phaseDataOut(USHORT port, UCHAR p_card) | ||
7620 | #else | ||
7621 | void phaseDataOut(ULONG port, UCHAR p_card) | ||
7622 | #endif | ||
7623 | #endif | ||
7624 | { | 4636 | { |
7625 | 4637 | ||
7626 | PSCCB currSCCB; | 4638 | PSCCB currSCCB; |
7627 | 4639 | ||
7628 | currSCCB = BL_Card[p_card].currentSCCB; | 4640 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
7629 | if (currSCCB == NULL) | 4641 | if (currSCCB == NULL) |
7630 | { | 4642 | { |
7631 | return; /* Exit if No SCCB record */ | 4643 | return; /* Exit if No SCCB record */ |
@@ -7640,14 +4652,7 @@ void phaseDataOut(ULONG port, UCHAR p_card) | |||
7640 | 4652 | ||
7641 | WR_HARPOON(port+hp_autostart_0, (END_DATA+END_DATA_START)); | 4653 | WR_HARPOON(port+hp_autostart_0, (END_DATA+END_DATA_START)); |
7642 | 4654 | ||
7643 | dataXferProcessor(port, &BL_Card[p_card]); | 4655 | FPT_dataXferProcessor(port, &FPT_BL_Card[p_card]); |
7644 | |||
7645 | #if defined(NOBUGBUG) | ||
7646 | if (RDW_HARPOON((port+hp_intstat)) & XFER_CNT_0) | ||
7647 | WRW_HARPOON((port+hp_intstat), XFER_CNT_0); | ||
7648 | |||
7649 | #endif | ||
7650 | |||
7651 | 4656 | ||
7652 | if (currSCCB->Sccb_XferCnt == 0) { | 4657 | if (currSCCB->Sccb_XferCnt == 0) { |
7653 | 4658 | ||
@@ -7656,9 +4661,9 @@ void phaseDataOut(ULONG port, UCHAR p_card) | |||
7656 | (currSCCB->HostStatus == SCCB_COMPLETE)) | 4661 | (currSCCB->HostStatus == SCCB_COMPLETE)) |
7657 | currSCCB->HostStatus = SCCB_DATA_OVER_RUN; | 4662 | currSCCB->HostStatus = SCCB_DATA_OVER_RUN; |
7658 | 4663 | ||
7659 | sxfrp(port,p_card); | 4664 | FPT_sxfrp(port,p_card); |
7660 | if (!(RDW_HARPOON((port+hp_intstat)) & (BUS_FREE | RESET))) | 4665 | if (!(RDW_HARPOON((port+hp_intstat)) & (BUS_FREE | RESET))) |
7661 | phaseDecode(port,p_card); | 4666 | FPT_phaseDecode(port,p_card); |
7662 | } | 4667 | } |
7663 | } | 4668 | } |
7664 | 4669 | ||
@@ -7671,20 +4676,12 @@ void phaseDataOut(ULONG port, UCHAR p_card) | |||
7671 | * | 4676 | * |
7672 | *---------------------------------------------------------------------*/ | 4677 | *---------------------------------------------------------------------*/ |
7673 | 4678 | ||
7674 | #if defined(OS2) | 4679 | static void FPT_phaseDataIn(ULONG port, UCHAR p_card) |
7675 | void far phaseDataIn(ULONG port, UCHAR p_card) | ||
7676 | #else | ||
7677 | #if defined(DOS) | ||
7678 | void phaseDataIn(USHORT port, UCHAR p_card) | ||
7679 | #else | ||
7680 | void phaseDataIn(ULONG port, UCHAR p_card) | ||
7681 | #endif | ||
7682 | #endif | ||
7683 | { | 4680 | { |
7684 | 4681 | ||
7685 | PSCCB currSCCB; | 4682 | PSCCB currSCCB; |
7686 | 4683 | ||
7687 | currSCCB = BL_Card[p_card].currentSCCB; | 4684 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
7688 | 4685 | ||
7689 | if (currSCCB == NULL) | 4686 | if (currSCCB == NULL) |
7690 | { | 4687 | { |
@@ -7702,7 +4699,7 @@ void phaseDataIn(ULONG port, UCHAR p_card) | |||
7702 | 4699 | ||
7703 | WR_HARPOON(port+hp_autostart_0, (END_DATA+END_DATA_START)); | 4700 | WR_HARPOON(port+hp_autostart_0, (END_DATA+END_DATA_START)); |
7704 | 4701 | ||
7705 | dataXferProcessor(port, &BL_Card[p_card]); | 4702 | FPT_dataXferProcessor(port, &FPT_BL_Card[p_card]); |
7706 | 4703 | ||
7707 | if (currSCCB->Sccb_XferCnt == 0) { | 4704 | if (currSCCB->Sccb_XferCnt == 0) { |
7708 | 4705 | ||
@@ -7711,9 +4708,9 @@ void phaseDataIn(ULONG port, UCHAR p_card) | |||
7711 | (currSCCB->HostStatus == SCCB_COMPLETE)) | 4708 | (currSCCB->HostStatus == SCCB_COMPLETE)) |
7712 | currSCCB->HostStatus = SCCB_DATA_OVER_RUN; | 4709 | currSCCB->HostStatus = SCCB_DATA_OVER_RUN; |
7713 | 4710 | ||
7714 | sxfrp(port,p_card); | 4711 | FPT_sxfrp(port,p_card); |
7715 | if (!(RDW_HARPOON((port+hp_intstat)) & (BUS_FREE | RESET))) | 4712 | if (!(RDW_HARPOON((port+hp_intstat)) & (BUS_FREE | RESET))) |
7716 | phaseDecode(port,p_card); | 4713 | FPT_phaseDecode(port,p_card); |
7717 | 4714 | ||
7718 | } | 4715 | } |
7719 | } | 4716 | } |
@@ -7726,25 +4723,13 @@ void phaseDataIn(ULONG port, UCHAR p_card) | |||
7726 | * | 4723 | * |
7727 | *---------------------------------------------------------------------*/ | 4724 | *---------------------------------------------------------------------*/ |
7728 | 4725 | ||
7729 | #if defined(OS2) | 4726 | static void FPT_phaseCommand(ULONG p_port, UCHAR p_card) |
7730 | void far phaseCommand(ULONG p_port, UCHAR p_card) | ||
7731 | #else | ||
7732 | #if defined(DOS) | ||
7733 | void phaseCommand(USHORT p_port, UCHAR p_card) | ||
7734 | #else | ||
7735 | void phaseCommand(ULONG p_port, UCHAR p_card) | ||
7736 | #endif | ||
7737 | #endif | ||
7738 | { | 4727 | { |
7739 | PSCCB currSCCB; | 4728 | PSCCB currSCCB; |
7740 | #if defined(DOS) | ||
7741 | USHORT cdb_reg; | ||
7742 | #else | ||
7743 | ULONG cdb_reg; | 4729 | ULONG cdb_reg; |
7744 | #endif | ||
7745 | UCHAR i; | 4730 | UCHAR i; |
7746 | 4731 | ||
7747 | currSCCB = BL_Card[p_card].currentSCCB; | 4732 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
7748 | 4733 | ||
7749 | if (currSCCB->OperationCode == RESET_COMMAND) { | 4734 | if (currSCCB->OperationCode == RESET_COMMAND) { |
7750 | 4735 | ||
@@ -7790,15 +4775,7 @@ void phaseCommand(ULONG p_port, UCHAR p_card) | |||
7790 | * | 4775 | * |
7791 | *---------------------------------------------------------------------*/ | 4776 | *---------------------------------------------------------------------*/ |
7792 | 4777 | ||
7793 | #if defined(OS2) | 4778 | static void FPT_phaseStatus(ULONG port, UCHAR p_card) |
7794 | void far phaseStatus(ULONG port, UCHAR p_card) | ||
7795 | #else | ||
7796 | #if defined(DOS) | ||
7797 | void phaseStatus(USHORT port, UCHAR p_card) | ||
7798 | #else | ||
7799 | void phaseStatus(ULONG port, UCHAR p_card) | ||
7800 | #endif | ||
7801 | #endif | ||
7802 | { | 4779 | { |
7803 | /* Start-up the automation to finish off this command and let the | 4780 | /* Start-up the automation to finish off this command and let the |
7804 | isr handle the interrupt for command complete when it comes in. | 4781 | isr handle the interrupt for command complete when it comes in. |
@@ -7820,21 +4797,13 @@ void phaseStatus(ULONG port, UCHAR p_card) | |||
7820 | * | 4797 | * |
7821 | *---------------------------------------------------------------------*/ | 4798 | *---------------------------------------------------------------------*/ |
7822 | 4799 | ||
7823 | #if defined(OS2) | 4800 | static void FPT_phaseMsgOut(ULONG port, UCHAR p_card) |
7824 | void far phaseMsgOut(ULONG port, UCHAR p_card) | ||
7825 | #else | ||
7826 | #if defined(DOS) | ||
7827 | void phaseMsgOut(USHORT port, UCHAR p_card) | ||
7828 | #else | ||
7829 | void phaseMsgOut(ULONG port, UCHAR p_card) | ||
7830 | #endif | ||
7831 | #endif | ||
7832 | { | 4801 | { |
7833 | UCHAR message,scsiID; | 4802 | UCHAR message,scsiID; |
7834 | PSCCB currSCCB; | 4803 | PSCCB currSCCB; |
7835 | PSCCBMgr_tar_info currTar_Info; | 4804 | PSCCBMgr_tar_info currTar_Info; |
7836 | 4805 | ||
7837 | currSCCB = BL_Card[p_card].currentSCCB; | 4806 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
7838 | 4807 | ||
7839 | if (currSCCB != NULL) { | 4808 | if (currSCCB != NULL) { |
7840 | 4809 | ||
@@ -7845,34 +4814,34 @@ void phaseMsgOut(ULONG port, UCHAR p_card) | |||
7845 | { | 4814 | { |
7846 | 4815 | ||
7847 | 4816 | ||
7848 | currTar_Info = &sccbMgrTbl[p_card][scsiID]; | 4817 | currTar_Info = &FPT_sccbMgrTbl[p_card][scsiID]; |
7849 | currTar_Info->TarSyncCtrl = 0; | 4818 | currTar_Info->TarSyncCtrl = 0; |
7850 | sssyncv(port, scsiID, NARROW_SCSI,currTar_Info); | 4819 | FPT_sssyncv(port, scsiID, NARROW_SCSI,currTar_Info); |
7851 | 4820 | ||
7852 | if (sccbMgrTbl[p_card][scsiID].TarEEValue & EE_SYNC_MASK) | 4821 | if (FPT_sccbMgrTbl[p_card][scsiID].TarEEValue & EE_SYNC_MASK) |
7853 | { | 4822 | { |
7854 | 4823 | ||
7855 | sccbMgrTbl[p_card][scsiID].TarStatus &= ~TAR_SYNC_MASK; | 4824 | FPT_sccbMgrTbl[p_card][scsiID].TarStatus &= ~TAR_SYNC_MASK; |
7856 | 4825 | ||
7857 | } | 4826 | } |
7858 | 4827 | ||
7859 | if (sccbMgrTbl[p_card][scsiID].TarEEValue & EE_WIDE_SCSI) | 4828 | if (FPT_sccbMgrTbl[p_card][scsiID].TarEEValue & EE_WIDE_SCSI) |
7860 | { | 4829 | { |
7861 | 4830 | ||
7862 | sccbMgrTbl[p_card][scsiID].TarStatus &= ~TAR_WIDE_MASK; | 4831 | FPT_sccbMgrTbl[p_card][scsiID].TarStatus &= ~TAR_WIDE_MASK; |
7863 | } | 4832 | } |
7864 | 4833 | ||
7865 | 4834 | ||
7866 | queueFlushSccb(p_card,SCCB_COMPLETE); | 4835 | FPT_queueFlushSccb(p_card,SCCB_COMPLETE); |
7867 | SccbMgrTableInitTarget(p_card,scsiID); | 4836 | FPT_SccbMgrTableInitTarget(p_card,scsiID); |
7868 | } | 4837 | } |
7869 | else if (currSCCB->Sccb_scsistat == ABORT_ST) | 4838 | else if (currSCCB->Sccb_scsistat == ABORT_ST) |
7870 | { | 4839 | { |
7871 | currSCCB->HostStatus = SCCB_COMPLETE; | 4840 | currSCCB->HostStatus = SCCB_COMPLETE; |
7872 | if(BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] != NULL) | 4841 | if(FPT_BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] != NULL) |
7873 | { | 4842 | { |
7874 | BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] = NULL; | 4843 | FPT_BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] = NULL; |
7875 | sccbMgrTbl[p_card][scsiID].TarTagQ_Cnt--; | 4844 | FPT_sccbMgrTbl[p_card][scsiID].TarTagQ_Cnt--; |
7876 | } | 4845 | } |
7877 | 4846 | ||
7878 | } | 4847 | } |
@@ -7885,7 +4854,7 @@ void phaseMsgOut(ULONG port, UCHAR p_card) | |||
7885 | { | 4854 | { |
7886 | currSCCB->Sccb_MGRFlags |= F_DEV_SELECTED; | 4855 | currSCCB->Sccb_MGRFlags |= F_DEV_SELECTED; |
7887 | 4856 | ||
7888 | ssel(port,p_card); | 4857 | FPT_ssel(port,p_card); |
7889 | return; | 4858 | return; |
7890 | } | 4859 | } |
7891 | } | 4860 | } |
@@ -7895,7 +4864,7 @@ void phaseMsgOut(ULONG port, UCHAR p_card) | |||
7895 | 4864 | ||
7896 | if (message == SMABORT) | 4865 | if (message == SMABORT) |
7897 | 4866 | ||
7898 | queueFlushSccb(p_card,SCCB_COMPLETE); | 4867 | FPT_queueFlushSccb(p_card,SCCB_COMPLETE); |
7899 | } | 4868 | } |
7900 | 4869 | ||
7901 | } | 4870 | } |
@@ -7930,25 +4899,25 @@ void phaseMsgOut(ULONG port, UCHAR p_card) | |||
7930 | if (currSCCB != NULL) | 4899 | if (currSCCB != NULL) |
7931 | { | 4900 | { |
7932 | 4901 | ||
7933 | if((BL_Card[p_card].globalFlags & F_CONLUN_IO) && | 4902 | if((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && |
7934 | ((sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) | 4903 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) |
7935 | sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = FALSE; | 4904 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = 0; |
7936 | else | 4905 | else |
7937 | sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = FALSE; | 4906 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = 0; |
7938 | 4907 | ||
7939 | queueCmdComplete(&BL_Card[p_card],currSCCB, p_card); | 4908 | FPT_queueCmdComplete(&FPT_BL_Card[p_card],currSCCB, p_card); |
7940 | } | 4909 | } |
7941 | 4910 | ||
7942 | else | 4911 | else |
7943 | { | 4912 | { |
7944 | BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD; | 4913 | FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD; |
7945 | } | 4914 | } |
7946 | } | 4915 | } |
7947 | 4916 | ||
7948 | else | 4917 | else |
7949 | { | 4918 | { |
7950 | 4919 | ||
7951 | sxfrp(port,p_card); | 4920 | FPT_sxfrp(port,p_card); |
7952 | } | 4921 | } |
7953 | } | 4922 | } |
7954 | 4923 | ||
@@ -7962,7 +4931,7 @@ void phaseMsgOut(ULONG port, UCHAR p_card) | |||
7962 | } | 4931 | } |
7963 | else | 4932 | else |
7964 | { | 4933 | { |
7965 | sxfrp(port,p_card); | 4934 | FPT_sxfrp(port,p_card); |
7966 | } | 4935 | } |
7967 | } | 4936 | } |
7968 | } | 4937 | } |
@@ -7976,25 +4945,17 @@ void phaseMsgOut(ULONG port, UCHAR p_card) | |||
7976 | * | 4945 | * |
7977 | *---------------------------------------------------------------------*/ | 4946 | *---------------------------------------------------------------------*/ |
7978 | 4947 | ||
7979 | #if defined(OS2) | 4948 | static void FPT_phaseMsgIn(ULONG port, UCHAR p_card) |
7980 | void far phaseMsgIn(ULONG port, UCHAR p_card) | ||
7981 | #else | ||
7982 | #if defined(DOS) | ||
7983 | void phaseMsgIn(USHORT port, UCHAR p_card) | ||
7984 | #else | ||
7985 | void phaseMsgIn(ULONG port, UCHAR p_card) | ||
7986 | #endif | ||
7987 | #endif | ||
7988 | { | 4949 | { |
7989 | UCHAR message; | 4950 | UCHAR message; |
7990 | PSCCB currSCCB; | 4951 | PSCCB currSCCB; |
7991 | 4952 | ||
7992 | currSCCB = BL_Card[p_card].currentSCCB; | 4953 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
7993 | 4954 | ||
7994 | if (BL_Card[p_card].globalFlags & F_HOST_XFER_ACT) | 4955 | if (FPT_BL_Card[p_card].globalFlags & F_HOST_XFER_ACT) |
7995 | { | 4956 | { |
7996 | 4957 | ||
7997 | phaseChkFifo(port, p_card); | 4958 | FPT_phaseChkFifo(port, p_card); |
7998 | } | 4959 | } |
7999 | 4960 | ||
8000 | message = RD_HARPOON(port+hp_scsidata_0); | 4961 | message = RD_HARPOON(port+hp_scsidata_0); |
@@ -8008,12 +4969,12 @@ void phaseMsgIn(ULONG port, UCHAR p_card) | |||
8008 | else | 4969 | else |
8009 | { | 4970 | { |
8010 | 4971 | ||
8011 | message = sfm(port,currSCCB); | 4972 | message = FPT_sfm(port,currSCCB); |
8012 | if (message) | 4973 | if (message) |
8013 | { | 4974 | { |
8014 | 4975 | ||
8015 | 4976 | ||
8016 | sdecm(message,port,p_card); | 4977 | FPT_sdecm(message,port,p_card); |
8017 | 4978 | ||
8018 | } | 4979 | } |
8019 | else | 4980 | else |
@@ -8037,19 +4998,11 @@ void phaseMsgIn(ULONG port, UCHAR p_card) | |||
8037 | * | 4998 | * |
8038 | *---------------------------------------------------------------------*/ | 4999 | *---------------------------------------------------------------------*/ |
8039 | 5000 | ||
8040 | #if defined(OS2) | 5001 | static void FPT_phaseIllegal(ULONG port, UCHAR p_card) |
8041 | void far phaseIllegal(ULONG port, UCHAR p_card) | ||
8042 | #else | ||
8043 | #if defined(DOS) | ||
8044 | void phaseIllegal(USHORT port, UCHAR p_card) | ||
8045 | #else | ||
8046 | void phaseIllegal(ULONG port, UCHAR p_card) | ||
8047 | #endif | ||
8048 | #endif | ||
8049 | { | 5002 | { |
8050 | PSCCB currSCCB; | 5003 | PSCCB currSCCB; |
8051 | 5004 | ||
8052 | currSCCB = BL_Card[p_card].currentSCCB; | 5005 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
8053 | 5006 | ||
8054 | WR_HARPOON(port+hp_scsisig, RD_HARPOON(port+hp_scsisig)); | 5007 | WR_HARPOON(port+hp_scsisig, RD_HARPOON(port+hp_scsisig)); |
8055 | if (currSCCB != NULL) { | 5008 | if (currSCCB != NULL) { |
@@ -8073,16 +5026,12 @@ void phaseIllegal(ULONG port, UCHAR p_card) | |||
8073 | * | 5026 | * |
8074 | *---------------------------------------------------------------------*/ | 5027 | *---------------------------------------------------------------------*/ |
8075 | 5028 | ||
8076 | #if defined(DOS) | 5029 | static void FPT_phaseChkFifo(ULONG port, UCHAR p_card) |
8077 | void phaseChkFifo(USHORT port, UCHAR p_card) | ||
8078 | #else | ||
8079 | void phaseChkFifo(ULONG port, UCHAR p_card) | ||
8080 | #endif | ||
8081 | { | 5030 | { |
8082 | ULONG xfercnt; | 5031 | ULONG xfercnt; |
8083 | PSCCB currSCCB; | 5032 | PSCCB currSCCB; |
8084 | 5033 | ||
8085 | currSCCB = BL_Card[p_card].currentSCCB; | 5034 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
8086 | 5035 | ||
8087 | if (currSCCB->Sccb_scsistat == DATA_IN_ST) | 5036 | if (currSCCB->Sccb_scsistat == DATA_IN_ST) |
8088 | { | 5037 | { |
@@ -8104,9 +5053,9 @@ void phaseChkFifo(ULONG port, UCHAR p_card) | |||
8104 | WRW_HARPOON((port+hp_intstat), PARITY); | 5053 | WRW_HARPOON((port+hp_intstat), PARITY); |
8105 | } | 5054 | } |
8106 | 5055 | ||
8107 | hostDataXferAbort(port,p_card,currSCCB); | 5056 | FPT_hostDataXferAbort(port,p_card,currSCCB); |
8108 | 5057 | ||
8109 | dataXferProcessor(port, &BL_Card[p_card]); | 5058 | FPT_dataXferProcessor(port, &FPT_BL_Card[p_card]); |
8110 | 5059 | ||
8111 | while((!(RD_HARPOON(port+hp_xferstat) & FIFO_EMPTY)) && | 5060 | while((!(RD_HARPOON(port+hp_xferstat) & FIFO_EMPTY)) && |
8112 | (RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY)) {} | 5061 | (RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY)) {} |
@@ -8116,22 +5065,7 @@ void phaseChkFifo(ULONG port, UCHAR p_card) | |||
8116 | 5065 | ||
8117 | 5066 | ||
8118 | 5067 | ||
8119 | #if defined(DOS) | ||
8120 | asm { mov dx,port; | ||
8121 | add dx,hp_xfercnt_2; | ||
8122 | in al,dx; | ||
8123 | dec dx; | ||
8124 | xor ah,ah; | ||
8125 | mov word ptr xfercnt+2,ax; | ||
8126 | in al,dx; | ||
8127 | dec dx; | ||
8128 | mov ah,al; | ||
8129 | in al,dx; | ||
8130 | mov word ptr xfercnt,ax; | ||
8131 | } | ||
8132 | #else | ||
8133 | GET_XFER_CNT(port,xfercnt); | 5068 | GET_XFER_CNT(port,xfercnt); |
8134 | #endif | ||
8135 | 5069 | ||
8136 | 5070 | ||
8137 | WR_HARPOON(port+hp_xfercnt_0, 0x00); | 5071 | WR_HARPOON(port+hp_xfercnt_0, 0x00); |
@@ -8151,7 +5085,7 @@ void phaseChkFifo(ULONG port, UCHAR p_card) | |||
8151 | } | 5085 | } |
8152 | 5086 | ||
8153 | 5087 | ||
8154 | hostDataXferAbort(port,p_card,currSCCB); | 5088 | FPT_hostDataXferAbort(port,p_card,currSCCB); |
8155 | 5089 | ||
8156 | 5090 | ||
8157 | WR_HARPOON(port+hp_fifowrite, 0x00); | 5091 | WR_HARPOON(port+hp_fifowrite, 0x00); |
@@ -8170,15 +5104,11 @@ void phaseChkFifo(ULONG port, UCHAR p_card) | |||
8170 | * because of command complete or from a disconnect. | 5104 | * because of command complete or from a disconnect. |
8171 | * | 5105 | * |
8172 | *---------------------------------------------------------------------*/ | 5106 | *---------------------------------------------------------------------*/ |
8173 | #if defined(DOS) | 5107 | static void FPT_phaseBusFree(ULONG port, UCHAR p_card) |
8174 | void phaseBusFree(USHORT port, UCHAR p_card) | ||
8175 | #else | ||
8176 | void phaseBusFree(ULONG port, UCHAR p_card) | ||
8177 | #endif | ||
8178 | { | 5108 | { |
8179 | PSCCB currSCCB; | 5109 | PSCCB currSCCB; |
8180 | 5110 | ||
8181 | currSCCB = BL_Card[p_card].currentSCCB; | 5111 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
8182 | 5112 | ||
8183 | if (currSCCB != NULL) | 5113 | if (currSCCB != NULL) |
8184 | { | 5114 | { |
@@ -8189,35 +5119,34 @@ void phaseBusFree(ULONG port, UCHAR p_card) | |||
8189 | if (currSCCB->OperationCode == RESET_COMMAND) | 5119 | if (currSCCB->OperationCode == RESET_COMMAND) |
8190 | { | 5120 | { |
8191 | 5121 | ||
8192 | if((BL_Card[p_card].globalFlags & F_CONLUN_IO) && | 5122 | if((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && |
8193 | ((sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) | 5123 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) |
8194 | sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = FALSE; | 5124 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = 0; |
8195 | else | 5125 | else |
8196 | sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = FALSE; | 5126 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = 0; |
8197 | 5127 | ||
8198 | queueCmdComplete(&BL_Card[p_card], currSCCB, p_card); | 5128 | FPT_queueCmdComplete(&FPT_BL_Card[p_card], currSCCB, p_card); |
8199 | 5129 | ||
8200 | queueSearchSelect(&BL_Card[p_card],p_card); | 5130 | FPT_queueSearchSelect(&FPT_BL_Card[p_card],p_card); |
8201 | 5131 | ||
8202 | } | 5132 | } |
8203 | 5133 | ||
8204 | else if(currSCCB->Sccb_scsistat == SELECT_SN_ST) | 5134 | else if(currSCCB->Sccb_scsistat == SELECT_SN_ST) |
8205 | { | 5135 | { |
8206 | sccbMgrTbl[p_card][currSCCB->TargID].TarStatus |= | 5136 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus |= |
8207 | (UCHAR)SYNC_SUPPORTED; | 5137 | (UCHAR)SYNC_SUPPORTED; |
8208 | sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &= ~EE_SYNC_MASK; | 5138 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &= ~EE_SYNC_MASK; |
8209 | } | 5139 | } |
8210 | 5140 | ||
8211 | else if(currSCCB->Sccb_scsistat == SELECT_WN_ST) | 5141 | else if(currSCCB->Sccb_scsistat == SELECT_WN_ST) |
8212 | { | 5142 | { |
8213 | sccbMgrTbl[p_card][currSCCB->TargID].TarStatus = | 5143 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus = |
8214 | (sccbMgrTbl[p_card][currSCCB->TargID]. | 5144 | (FPT_sccbMgrTbl[p_card][currSCCB->TargID]. |
8215 | TarStatus & ~WIDE_ENABLED) | WIDE_NEGOCIATED; | 5145 | TarStatus & ~WIDE_ENABLED) | WIDE_NEGOCIATED; |
8216 | 5146 | ||
8217 | sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &= ~EE_WIDE_SCSI; | 5147 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &= ~EE_WIDE_SCSI; |
8218 | } | 5148 | } |
8219 | 5149 | ||
8220 | #if !defined(DOS) | ||
8221 | else if(currSCCB->Sccb_scsistat == SELECT_Q_ST) | 5150 | else if(currSCCB->Sccb_scsistat == SELECT_Q_ST) |
8222 | { | 5151 | { |
8223 | /* Make sure this is not a phony BUS_FREE. If we were | 5152 | /* Make sure this is not a phony BUS_FREE. If we were |
@@ -8227,8 +5156,8 @@ void phaseBusFree(ULONG port, UCHAR p_card) | |||
8227 | if ((!(RD_HARPOON(port+hp_scsisig) & SCSI_BSY)) || | 5156 | if ((!(RD_HARPOON(port+hp_scsisig) & SCSI_BSY)) || |
8228 | (RDW_HARPOON((port+hp_intstat)) & RSEL)) | 5157 | (RDW_HARPOON((port+hp_intstat)) & RSEL)) |
8229 | { | 5158 | { |
8230 | sccbMgrTbl[p_card][currSCCB->TargID].TarStatus &= ~TAR_TAG_Q_MASK; | 5159 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus &= ~TAR_TAG_Q_MASK; |
8231 | sccbMgrTbl[p_card][currSCCB->TargID].TarStatus |= TAG_Q_REJECT; | 5160 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus |= TAG_Q_REJECT; |
8232 | } | 5161 | } |
8233 | 5162 | ||
8234 | else | 5163 | else |
@@ -8236,7 +5165,6 @@ void phaseBusFree(ULONG port, UCHAR p_card) | |||
8236 | return; | 5165 | return; |
8237 | } | 5166 | } |
8238 | } | 5167 | } |
8239 | #endif | ||
8240 | 5168 | ||
8241 | else | 5169 | else |
8242 | { | 5170 | { |
@@ -8248,18 +5176,18 @@ void phaseBusFree(ULONG port, UCHAR p_card) | |||
8248 | currSCCB->HostStatus = SCCB_PHASE_SEQUENCE_FAIL; | 5176 | currSCCB->HostStatus = SCCB_PHASE_SEQUENCE_FAIL; |
8249 | } | 5177 | } |
8250 | 5178 | ||
8251 | if((BL_Card[p_card].globalFlags & F_CONLUN_IO) && | 5179 | if((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && |
8252 | ((sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) | 5180 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) |
8253 | sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = FALSE; | 5181 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = 0; |
8254 | else | 5182 | else |
8255 | sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = FALSE; | 5183 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = 0; |
8256 | 5184 | ||
8257 | queueCmdComplete(&BL_Card[p_card], currSCCB, p_card); | 5185 | FPT_queueCmdComplete(&FPT_BL_Card[p_card], currSCCB, p_card); |
8258 | return; | 5186 | return; |
8259 | } | 5187 | } |
8260 | 5188 | ||
8261 | 5189 | ||
8262 | BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD; | 5190 | FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD; |
8263 | 5191 | ||
8264 | } /*end if !=null */ | 5192 | } /*end if !=null */ |
8265 | } | 5193 | } |
@@ -8267,44 +5195,6 @@ void phaseBusFree(ULONG port, UCHAR p_card) | |||
8267 | 5195 | ||
8268 | 5196 | ||
8269 | 5197 | ||
8270 | #ident "$Id: automate.c 1.14 1997/01/31 02:11:46 mohan Exp $" | ||
8271 | /*---------------------------------------------------------------------- | ||
8272 | * | ||
8273 | * | ||
8274 | * Copyright 1995-1996 by Mylex Corporation. All Rights Reserved | ||
8275 | * | ||
8276 | * This file is available under both the GNU General Public License | ||
8277 | * and a BSD-style copyright; see LICENSE.FlashPoint for details. | ||
8278 | * | ||
8279 | * $Workfile: automate.c $ | ||
8280 | * | ||
8281 | * Description: Functions relating to programming the automation of | ||
8282 | * the HARPOON. | ||
8283 | * | ||
8284 | * $Date: 1997/01/31 02:11:46 $ | ||
8285 | * | ||
8286 | * $Revision: 1.14 $ | ||
8287 | * | ||
8288 | *----------------------------------------------------------------------*/ | ||
8289 | |||
8290 | /*#include <globals.h>*/ | ||
8291 | |||
8292 | #if (FW_TYPE==_UCB_MGR_) | ||
8293 | /*#include <budi.h>*/ | ||
8294 | #endif | ||
8295 | |||
8296 | /*#include <sccbmgr.h>*/ | ||
8297 | /*#include <blx30.h>*/ | ||
8298 | /*#include <target.h>*/ | ||
8299 | /*#include <scsi2.h>*/ | ||
8300 | /*#include <harpoon.h>*/ | ||
8301 | |||
8302 | /* | ||
8303 | extern SCCBCARD BL_Card[MAX_CARDS]; | ||
8304 | extern SCCBMGR_TAR_INFO sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR]; | ||
8305 | extern SCCBCARD BL_Card[MAX_CARDS]; | ||
8306 | */ | ||
8307 | |||
8308 | /*--------------------------------------------------------------------- | 5198 | /*--------------------------------------------------------------------- |
8309 | * | 5199 | * |
8310 | * Function: Auto Load Default Map | 5200 | * Function: Auto Load Default Map |
@@ -8312,17 +5202,9 @@ extern SCCBCARD BL_Card[MAX_CARDS]; | |||
8312 | * Description: Load the Automation RAM with the defualt map values. | 5202 | * Description: Load the Automation RAM with the defualt map values. |
8313 | * | 5203 | * |
8314 | *---------------------------------------------------------------------*/ | 5204 | *---------------------------------------------------------------------*/ |
8315 | #if defined(DOS) | 5205 | static void FPT_autoLoadDefaultMap(ULONG p_port) |
8316 | void autoLoadDefaultMap(USHORT p_port) | ||
8317 | #else | ||
8318 | void autoLoadDefaultMap(ULONG p_port) | ||
8319 | #endif | ||
8320 | { | 5206 | { |
8321 | #if defined(DOS) | ||
8322 | USHORT map_addr; | ||
8323 | #else | ||
8324 | ULONG map_addr; | 5207 | ULONG map_addr; |
8325 | #endif | ||
8326 | 5208 | ||
8327 | ARAM_ACCESS(p_port); | 5209 | ARAM_ACCESS(p_port); |
8328 | map_addr = p_port + hp_aramBase; | 5210 | map_addr = p_port + hp_aramBase; |
@@ -8428,86 +5310,82 @@ void autoLoadDefaultMap(ULONG p_port) | |||
8428 | * | 5310 | * |
8429 | *---------------------------------------------------------------------*/ | 5311 | *---------------------------------------------------------------------*/ |
8430 | 5312 | ||
8431 | #if defined(DOS) | 5313 | static void FPT_autoCmdCmplt(ULONG p_port, UCHAR p_card) |
8432 | void autoCmdCmplt(USHORT p_port, UCHAR p_card) | ||
8433 | #else | ||
8434 | void autoCmdCmplt(ULONG p_port, UCHAR p_card) | ||
8435 | #endif | ||
8436 | { | 5314 | { |
8437 | PSCCB currSCCB; | 5315 | PSCCB currSCCB; |
8438 | UCHAR status_byte; | 5316 | UCHAR status_byte; |
8439 | 5317 | ||
8440 | currSCCB = BL_Card[p_card].currentSCCB; | 5318 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
8441 | 5319 | ||
8442 | status_byte = RD_HARPOON(p_port+hp_gp_reg_0); | 5320 | status_byte = RD_HARPOON(p_port+hp_gp_reg_0); |
8443 | 5321 | ||
8444 | sccbMgrTbl[p_card][currSCCB->TargID].TarLUN_CA = FALSE; | 5322 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUN_CA = 0; |
8445 | 5323 | ||
8446 | if (status_byte != SSGOOD) { | 5324 | if (status_byte != SSGOOD) { |
8447 | 5325 | ||
8448 | if (status_byte == SSQ_FULL) { | 5326 | if (status_byte == SSQ_FULL) { |
8449 | 5327 | ||
8450 | 5328 | ||
8451 | if(((BL_Card[p_card].globalFlags & F_CONLUN_IO) && | 5329 | if(((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && |
8452 | ((sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) | 5330 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) |
8453 | { | 5331 | { |
8454 | sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = TRUE; | 5332 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = 1; |
8455 | if(BL_Card[p_card].discQCount != 0) | 5333 | if(FPT_BL_Card[p_card].discQCount != 0) |
8456 | BL_Card[p_card].discQCount--; | 5334 | FPT_BL_Card[p_card].discQCount--; |
8457 | BL_Card[p_card].discQ_Tbl[sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[currSCCB->Lun]] = NULL; | 5335 | FPT_BL_Card[p_card].discQ_Tbl[FPT_sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[currSCCB->Lun]] = NULL; |
8458 | } | 5336 | } |
8459 | else | 5337 | else |
8460 | { | 5338 | { |
8461 | sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = TRUE; | 5339 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = 1; |
8462 | if(currSCCB->Sccb_tag) | 5340 | if(currSCCB->Sccb_tag) |
8463 | { | 5341 | { |
8464 | if(BL_Card[p_card].discQCount != 0) | 5342 | if(FPT_BL_Card[p_card].discQCount != 0) |
8465 | BL_Card[p_card].discQCount--; | 5343 | FPT_BL_Card[p_card].discQCount--; |
8466 | BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] = NULL; | 5344 | FPT_BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] = NULL; |
8467 | }else | 5345 | }else |
8468 | { | 5346 | { |
8469 | if(BL_Card[p_card].discQCount != 0) | 5347 | if(FPT_BL_Card[p_card].discQCount != 0) |
8470 | BL_Card[p_card].discQCount--; | 5348 | FPT_BL_Card[p_card].discQCount--; |
8471 | BL_Card[p_card].discQ_Tbl[sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[0]] = NULL; | 5349 | FPT_BL_Card[p_card].discQ_Tbl[FPT_sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[0]] = NULL; |
8472 | } | 5350 | } |
8473 | } | 5351 | } |
8474 | 5352 | ||
8475 | currSCCB->Sccb_MGRFlags |= F_STATUSLOADED; | 5353 | currSCCB->Sccb_MGRFlags |= F_STATUSLOADED; |
8476 | 5354 | ||
8477 | queueSelectFail(&BL_Card[p_card],p_card); | 5355 | FPT_queueSelectFail(&FPT_BL_Card[p_card],p_card); |
8478 | 5356 | ||
8479 | return; | 5357 | return; |
8480 | } | 5358 | } |
8481 | 5359 | ||
8482 | if(currSCCB->Sccb_scsistat == SELECT_SN_ST) | 5360 | if(currSCCB->Sccb_scsistat == SELECT_SN_ST) |
8483 | { | 5361 | { |
8484 | sccbMgrTbl[p_card][currSCCB->TargID].TarStatus |= | 5362 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus |= |
8485 | (UCHAR)SYNC_SUPPORTED; | 5363 | (UCHAR)SYNC_SUPPORTED; |
8486 | 5364 | ||
8487 | sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &= ~EE_SYNC_MASK; | 5365 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &= ~EE_SYNC_MASK; |
8488 | BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD; | 5366 | FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD; |
8489 | 5367 | ||
8490 | if(((BL_Card[p_card].globalFlags & F_CONLUN_IO) && | 5368 | if(((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && |
8491 | ((sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) | 5369 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) |
8492 | { | 5370 | { |
8493 | sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = TRUE; | 5371 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = 1; |
8494 | if(BL_Card[p_card].discQCount != 0) | 5372 | if(FPT_BL_Card[p_card].discQCount != 0) |
8495 | BL_Card[p_card].discQCount--; | 5373 | FPT_BL_Card[p_card].discQCount--; |
8496 | BL_Card[p_card].discQ_Tbl[sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[currSCCB->Lun]] = NULL; | 5374 | FPT_BL_Card[p_card].discQ_Tbl[FPT_sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[currSCCB->Lun]] = NULL; |
8497 | } | 5375 | } |
8498 | else | 5376 | else |
8499 | { | 5377 | { |
8500 | sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = TRUE; | 5378 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = 1; |
8501 | if(currSCCB->Sccb_tag) | 5379 | if(currSCCB->Sccb_tag) |
8502 | { | 5380 | { |
8503 | if(BL_Card[p_card].discQCount != 0) | 5381 | if(FPT_BL_Card[p_card].discQCount != 0) |
8504 | BL_Card[p_card].discQCount--; | 5382 | FPT_BL_Card[p_card].discQCount--; |
8505 | BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] = NULL; | 5383 | FPT_BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] = NULL; |
8506 | }else | 5384 | }else |
8507 | { | 5385 | { |
8508 | if(BL_Card[p_card].discQCount != 0) | 5386 | if(FPT_BL_Card[p_card].discQCount != 0) |
8509 | BL_Card[p_card].discQCount--; | 5387 | FPT_BL_Card[p_card].discQCount--; |
8510 | BL_Card[p_card].discQ_Tbl[sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[0]] = NULL; | 5388 | FPT_BL_Card[p_card].discQ_Tbl[FPT_sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[0]] = NULL; |
8511 | } | 5389 | } |
8512 | } | 5390 | } |
8513 | return; | 5391 | return; |
@@ -8517,34 +5395,34 @@ void autoCmdCmplt(ULONG p_port, UCHAR p_card) | |||
8517 | if(currSCCB->Sccb_scsistat == SELECT_WN_ST) | 5395 | if(currSCCB->Sccb_scsistat == SELECT_WN_ST) |
8518 | { | 5396 | { |
8519 | 5397 | ||
8520 | sccbMgrTbl[p_card][currSCCB->TargID].TarStatus = | 5398 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus = |
8521 | (sccbMgrTbl[p_card][currSCCB->TargID]. | 5399 | (FPT_sccbMgrTbl[p_card][currSCCB->TargID]. |
8522 | TarStatus & ~WIDE_ENABLED) | WIDE_NEGOCIATED; | 5400 | TarStatus & ~WIDE_ENABLED) | WIDE_NEGOCIATED; |
8523 | 5401 | ||
8524 | sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &= ~EE_WIDE_SCSI; | 5402 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &= ~EE_WIDE_SCSI; |
8525 | BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD; | 5403 | FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD; |
8526 | 5404 | ||
8527 | if(((BL_Card[p_card].globalFlags & F_CONLUN_IO) && | 5405 | if(((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && |
8528 | ((sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) | 5406 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) |
8529 | { | 5407 | { |
8530 | sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = TRUE; | 5408 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = 1; |
8531 | if(BL_Card[p_card].discQCount != 0) | 5409 | if(FPT_BL_Card[p_card].discQCount != 0) |
8532 | BL_Card[p_card].discQCount--; | 5410 | FPT_BL_Card[p_card].discQCount--; |
8533 | BL_Card[p_card].discQ_Tbl[sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[currSCCB->Lun]] = NULL; | 5411 | FPT_BL_Card[p_card].discQ_Tbl[FPT_sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[currSCCB->Lun]] = NULL; |
8534 | } | 5412 | } |
8535 | else | 5413 | else |
8536 | { | 5414 | { |
8537 | sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = TRUE; | 5415 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = 1; |
8538 | if(currSCCB->Sccb_tag) | 5416 | if(currSCCB->Sccb_tag) |
8539 | { | 5417 | { |
8540 | if(BL_Card[p_card].discQCount != 0) | 5418 | if(FPT_BL_Card[p_card].discQCount != 0) |
8541 | BL_Card[p_card].discQCount--; | 5419 | FPT_BL_Card[p_card].discQCount--; |
8542 | BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] = NULL; | 5420 | FPT_BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] = NULL; |
8543 | }else | 5421 | }else |
8544 | { | 5422 | { |
8545 | if(BL_Card[p_card].discQCount != 0) | 5423 | if(FPT_BL_Card[p_card].discQCount != 0) |
8546 | BL_Card[p_card].discQCount--; | 5424 | FPT_BL_Card[p_card].discQCount--; |
8547 | BL_Card[p_card].discQ_Tbl[sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[0]] = NULL; | 5425 | FPT_BL_Card[p_card].discQ_Tbl[FPT_sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[0]] = NULL; |
8548 | } | 5426 | } |
8549 | } | 5427 | } |
8550 | return; | 5428 | return; |
@@ -8553,15 +5431,15 @@ void autoCmdCmplt(ULONG p_port, UCHAR p_card) | |||
8553 | 5431 | ||
8554 | if (status_byte == SSCHECK) | 5432 | if (status_byte == SSCHECK) |
8555 | { | 5433 | { |
8556 | if(BL_Card[p_card].globalFlags & F_DO_RENEGO) | 5434 | if(FPT_BL_Card[p_card].globalFlags & F_DO_RENEGO) |
8557 | { | 5435 | { |
8558 | if (sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue & EE_SYNC_MASK) | 5436 | if (FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue & EE_SYNC_MASK) |
8559 | { | 5437 | { |
8560 | sccbMgrTbl[p_card][currSCCB->TargID].TarStatus &= ~TAR_SYNC_MASK; | 5438 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus &= ~TAR_SYNC_MASK; |
8561 | } | 5439 | } |
8562 | if (sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue & EE_WIDE_SCSI) | 5440 | if (FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue & EE_WIDE_SCSI) |
8563 | { | 5441 | { |
8564 | sccbMgrTbl[p_card][currSCCB->TargID].TarStatus &= ~TAR_WIDE_MASK; | 5442 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus &= ~TAR_WIDE_MASK; |
8565 | } | 5443 | } |
8566 | } | 5444 | } |
8567 | } | 5445 | } |
@@ -8573,135 +5451,61 @@ void autoCmdCmplt(ULONG p_port, UCHAR p_card) | |||
8573 | 5451 | ||
8574 | if (status_byte == SSCHECK) { | 5452 | if (status_byte == SSCHECK) { |
8575 | 5453 | ||
8576 | sccbMgrTbl[p_card][currSCCB->TargID].TarLUN_CA | 5454 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUN_CA |
8577 | = TRUE; | 5455 | = 1; |
8578 | 5456 | ||
8579 | 5457 | ||
8580 | #if (FW_TYPE==_SCCB_MGR_) | ||
8581 | if (currSCCB->RequestSenseLength != NO_AUTO_REQUEST_SENSE) { | 5458 | if (currSCCB->RequestSenseLength != NO_AUTO_REQUEST_SENSE) { |
8582 | 5459 | ||
8583 | if (currSCCB->RequestSenseLength == 0) | 5460 | if (currSCCB->RequestSenseLength == 0) |
8584 | currSCCB->RequestSenseLength = 14; | 5461 | currSCCB->RequestSenseLength = 14; |
8585 | 5462 | ||
8586 | ssenss(&BL_Card[p_card]); | 5463 | FPT_ssenss(&FPT_BL_Card[p_card]); |
8587 | BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD; | 5464 | FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD; |
8588 | 5465 | ||
8589 | if(((BL_Card[p_card].globalFlags & F_CONLUN_IO) && | 5466 | if(((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && |
8590 | ((sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) | 5467 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) |
8591 | { | 5468 | { |
8592 | sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = TRUE; | 5469 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = 1; |
8593 | if(BL_Card[p_card].discQCount != 0) | 5470 | if(FPT_BL_Card[p_card].discQCount != 0) |
8594 | BL_Card[p_card].discQCount--; | 5471 | FPT_BL_Card[p_card].discQCount--; |
8595 | BL_Card[p_card].discQ_Tbl[sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[currSCCB->Lun]] = NULL; | 5472 | FPT_BL_Card[p_card].discQ_Tbl[FPT_sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[currSCCB->Lun]] = NULL; |
8596 | } | 5473 | } |
8597 | else | 5474 | else |
8598 | { | 5475 | { |
8599 | sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = TRUE; | 5476 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = 1; |
8600 | if(currSCCB->Sccb_tag) | 5477 | if(currSCCB->Sccb_tag) |
8601 | { | 5478 | { |
8602 | if(BL_Card[p_card].discQCount != 0) | 5479 | if(FPT_BL_Card[p_card].discQCount != 0) |
8603 | BL_Card[p_card].discQCount--; | 5480 | FPT_BL_Card[p_card].discQCount--; |
8604 | BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] = NULL; | 5481 | FPT_BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] = NULL; |
8605 | }else | 5482 | }else |
8606 | { | 5483 | { |
8607 | if(BL_Card[p_card].discQCount != 0) | 5484 | if(FPT_BL_Card[p_card].discQCount != 0) |
8608 | BL_Card[p_card].discQCount--; | 5485 | FPT_BL_Card[p_card].discQCount--; |
8609 | BL_Card[p_card].discQ_Tbl[sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[0]] = NULL; | 5486 | FPT_BL_Card[p_card].discQ_Tbl[FPT_sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[0]] = NULL; |
8610 | } | 5487 | } |
8611 | } | 5488 | } |
8612 | return; | 5489 | return; |
8613 | } | 5490 | } |
8614 | #else | ||
8615 | if ((!(currSCCB->Sccb_ucb_ptr->UCB_opcode & OPC_NO_AUTO_SENSE)) && | ||
8616 | (currSCCB->RequestSenseLength)) | ||
8617 | { | ||
8618 | ssenss(&BL_Card[p_card]); | ||
8619 | BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD; | ||
8620 | |||
8621 | if(((BL_Card[p_card].globalFlags & F_CONLUN_IO) && | ||
8622 | ((sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) | ||
8623 | { | ||
8624 | sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = TRUE; | ||
8625 | if(BL_Card[p_card].discQCount != 0) | ||
8626 | BL_Card[p_card].discQCount--; | ||
8627 | BL_Card[p_card].discQ_Tbl[sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[currSCCB->Lun]] = NULL; | ||
8628 | } | ||
8629 | else | ||
8630 | { | ||
8631 | sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = TRUE; | ||
8632 | if(currSCCB->Sccb_tag) | ||
8633 | { | ||
8634 | if(BL_Card[p_card].discQCount != 0) | ||
8635 | BL_Card[p_card].discQCount--; | ||
8636 | BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] = NULL; | ||
8637 | }else | ||
8638 | { | ||
8639 | if(BL_Card[p_card].discQCount != 0) | ||
8640 | BL_Card[p_card].discQCount--; | ||
8641 | BL_Card[p_card].discQ_Tbl[sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[0]] = NULL; | ||
8642 | } | ||
8643 | } | ||
8644 | return; | ||
8645 | } | ||
8646 | |||
8647 | #endif | ||
8648 | } | 5491 | } |
8649 | } | 5492 | } |
8650 | } | 5493 | } |
8651 | 5494 | ||
8652 | 5495 | ||
8653 | if((BL_Card[p_card].globalFlags & F_CONLUN_IO) && | 5496 | if((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && |
8654 | ((sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) | 5497 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) |
8655 | sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = FALSE; | 5498 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = 0; |
8656 | else | 5499 | else |
8657 | sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = FALSE; | 5500 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = 0; |
8658 | 5501 | ||
8659 | 5502 | ||
8660 | queueCmdComplete(&BL_Card[p_card], currSCCB, p_card); | 5503 | FPT_queueCmdComplete(&FPT_BL_Card[p_card], currSCCB, p_card); |
8661 | } | 5504 | } |
8662 | #ident "$Id: busmstr.c 1.8 1997/01/31 02:10:27 mohan Exp $" | ||
8663 | /*---------------------------------------------------------------------- | ||
8664 | * | ||
8665 | * | ||
8666 | * Copyright 1995-1996 by Mylex Corporation. All Rights Reserved | ||
8667 | * | ||
8668 | * This file is available under both the GNU General Public License | ||
8669 | * and a BSD-style copyright; see LICENSE.FlashPoint for details. | ||
8670 | * | ||
8671 | * $Workfile: busmstr.c $ | ||
8672 | * | ||
8673 | * Description: Functions to start, stop, and abort BusMaster operations. | ||
8674 | * | ||
8675 | * $Date: 1997/01/31 02:10:27 $ | ||
8676 | * | ||
8677 | * $Revision: 1.8 $ | ||
8678 | * | ||
8679 | *----------------------------------------------------------------------*/ | ||
8680 | |||
8681 | /*#include <globals.h>*/ | ||
8682 | |||
8683 | #if (FW_TYPE==_UCB_MGR_) | ||
8684 | /*#include <budi.h>*/ | ||
8685 | #endif | ||
8686 | |||
8687 | /*#include <sccbmgr.h>*/ | ||
8688 | /*#include <blx30.h>*/ | ||
8689 | /*#include <target.h>*/ | ||
8690 | /*#include <scsi2.h>*/ | ||
8691 | /*#include <harpoon.h>*/ | ||
8692 | |||
8693 | |||
8694 | /* | ||
8695 | extern SCCBCARD BL_Card[MAX_CARDS]; | ||
8696 | extern SCCBMGR_TAR_INFO sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR]; | ||
8697 | */ | ||
8698 | 5505 | ||
8699 | #define SHORT_WAIT 0x0000000F | 5506 | #define SHORT_WAIT 0x0000000F |
8700 | #define LONG_WAIT 0x0000FFFFL | 5507 | #define LONG_WAIT 0x0000FFFFL |
8701 | 5508 | ||
8702 | #if defined(BUGBUG) | ||
8703 | void Debug_Load(UCHAR p_card, UCHAR p_bug_data); | ||
8704 | #endif | ||
8705 | 5509 | ||
8706 | /*--------------------------------------------------------------------- | 5510 | /*--------------------------------------------------------------------- |
8707 | * | 5511 | * |
@@ -8721,11 +5525,7 @@ void Debug_Load(UCHAR p_card, UCHAR p_bug_data); | |||
8721 | * | 5525 | * |
8722 | *---------------------------------------------------------------------*/ | 5526 | *---------------------------------------------------------------------*/ |
8723 | 5527 | ||
8724 | #if defined(DOS) | 5528 | static void FPT_dataXferProcessor(ULONG port, PSCCBcard pCurrCard) |
8725 | void dataXferProcessor(USHORT port, PSCCBcard pCurrCard) | ||
8726 | #else | ||
8727 | void dataXferProcessor(ULONG port, PSCCBcard pCurrCard) | ||
8728 | #endif | ||
8729 | { | 5529 | { |
8730 | PSCCB currSCCB; | 5530 | PSCCB currSCCB; |
8731 | 5531 | ||
@@ -8741,7 +5541,7 @@ void dataXferProcessor(ULONG port, PSCCBcard pCurrCard) | |||
8741 | } | 5541 | } |
8742 | pCurrCard->globalFlags |= F_HOST_XFER_ACT; | 5542 | pCurrCard->globalFlags |= F_HOST_XFER_ACT; |
8743 | 5543 | ||
8744 | busMstrSGDataXferStart(port, currSCCB); | 5544 | FPT_busMstrSGDataXferStart(port, currSCCB); |
8745 | } | 5545 | } |
8746 | 5546 | ||
8747 | else | 5547 | else |
@@ -8750,7 +5550,7 @@ void dataXferProcessor(ULONG port, PSCCBcard pCurrCard) | |||
8750 | { | 5550 | { |
8751 | pCurrCard->globalFlags |= F_HOST_XFER_ACT; | 5551 | pCurrCard->globalFlags |= F_HOST_XFER_ACT; |
8752 | 5552 | ||
8753 | busMstrDataXferStart(port, currSCCB); | 5553 | FPT_busMstrDataXferStart(port, currSCCB); |
8754 | } | 5554 | } |
8755 | } | 5555 | } |
8756 | } | 5556 | } |
@@ -8763,20 +5563,12 @@ void dataXferProcessor(ULONG port, PSCCBcard pCurrCard) | |||
8763 | * Description: | 5563 | * Description: |
8764 | * | 5564 | * |
8765 | *---------------------------------------------------------------------*/ | 5565 | *---------------------------------------------------------------------*/ |
8766 | #if defined(DOS) | 5566 | static void FPT_busMstrSGDataXferStart(ULONG p_port, PSCCB pcurrSCCB) |
8767 | void busMstrSGDataXferStart(USHORT p_port, PSCCB pcurrSCCB) | ||
8768 | #else | ||
8769 | void busMstrSGDataXferStart(ULONG p_port, PSCCB pcurrSCCB) | ||
8770 | #endif | ||
8771 | { | 5567 | { |
8772 | ULONG count,addr,tmpSGCnt; | 5568 | ULONG count,addr,tmpSGCnt; |
8773 | UINT sg_index; | 5569 | UINT sg_index; |
8774 | UCHAR sg_count, i; | 5570 | UCHAR sg_count, i; |
8775 | #if defined(DOS) | ||
8776 | USHORT reg_offset; | ||
8777 | #else | ||
8778 | ULONG reg_offset; | 5571 | ULONG reg_offset; |
8779 | #endif | ||
8780 | 5572 | ||
8781 | 5573 | ||
8782 | if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR) { | 5574 | if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR) { |
@@ -8802,17 +5594,6 @@ void busMstrSGDataXferStart(ULONG p_port, PSCCB pcurrSCCB) | |||
8802 | while ((sg_count < (UCHAR)SG_BUF_CNT) && | 5594 | while ((sg_count < (UCHAR)SG_BUF_CNT) && |
8803 | ((ULONG)(sg_index * (UINT)SG_ELEMENT_SIZE) < pcurrSCCB->DataLength) ) { | 5595 | ((ULONG)(sg_index * (UINT)SG_ELEMENT_SIZE) < pcurrSCCB->DataLength) ) { |
8804 | 5596 | ||
8805 | #if defined(COMPILER_16_BIT) && !defined(DOS) | ||
8806 | tmpSGCnt += *(((ULONG far *)pcurrSCCB->DataPointer)+ | ||
8807 | (sg_index * 2)); | ||
8808 | |||
8809 | count |= *(((ULONG far *)pcurrSCCB->DataPointer)+ | ||
8810 | (sg_index * 2)); | ||
8811 | |||
8812 | addr = *(((ULONG far *)pcurrSCCB->DataPointer)+ | ||
8813 | ((sg_index * 2) + 1)); | ||
8814 | |||
8815 | #else | ||
8816 | tmpSGCnt += *(((ULONG *)pcurrSCCB->DataPointer)+ | 5597 | tmpSGCnt += *(((ULONG *)pcurrSCCB->DataPointer)+ |
8817 | (sg_index * 2)); | 5598 | (sg_index * 2)); |
8818 | 5599 | ||
@@ -8821,7 +5602,6 @@ void busMstrSGDataXferStart(ULONG p_port, PSCCB pcurrSCCB) | |||
8821 | 5602 | ||
8822 | addr = *(((ULONG *)pcurrSCCB->DataPointer)+ | 5603 | addr = *(((ULONG *)pcurrSCCB->DataPointer)+ |
8823 | ((sg_index * 2) + 1)); | 5604 | ((sg_index * 2) + 1)); |
8824 | #endif | ||
8825 | 5605 | ||
8826 | 5606 | ||
8827 | if ((!sg_count) && (pcurrSCCB->Sccb_SGoffset)) { | 5607 | if ((!sg_count) && (pcurrSCCB->Sccb_SGoffset)) { |
@@ -8888,11 +5668,7 @@ void busMstrSGDataXferStart(ULONG p_port, PSCCB pcurrSCCB) | |||
8888 | * Description: | 5668 | * Description: |
8889 | * | 5669 | * |
8890 | *---------------------------------------------------------------------*/ | 5670 | *---------------------------------------------------------------------*/ |
8891 | #if defined(DOS) | 5671 | static void FPT_busMstrDataXferStart(ULONG p_port, PSCCB pcurrSCCB) |
8892 | void busMstrDataXferStart(USHORT p_port, PSCCB pcurrSCCB) | ||
8893 | #else | ||
8894 | void busMstrDataXferStart(ULONG p_port, PSCCB pcurrSCCB) | ||
8895 | #endif | ||
8896 | { | 5672 | { |
8897 | ULONG addr,count; | 5673 | ULONG addr,count; |
8898 | 5674 | ||
@@ -8909,37 +5685,7 @@ void busMstrDataXferStart(ULONG p_port, PSCCB pcurrSCCB) | |||
8909 | 5685 | ||
8910 | } | 5686 | } |
8911 | 5687 | ||
8912 | #if defined(DOS) | ||
8913 | asm { mov dx,p_port; | ||
8914 | mov ax,word ptr count; | ||
8915 | add dx,hp_xfer_cnt_lo; | ||
8916 | out dx,al; | ||
8917 | inc dx; | ||
8918 | xchg ah,al | ||
8919 | out dx,al; | ||
8920 | inc dx; | ||
8921 | mov ax,word ptr count+2; | ||
8922 | out dx,al; | ||
8923 | inc dx; | ||
8924 | inc dx; | ||
8925 | mov ax,word ptr addr; | ||
8926 | out dx,al; | ||
8927 | inc dx; | ||
8928 | xchg ah,al | ||
8929 | out dx,al; | ||
8930 | inc dx; | ||
8931 | mov ax,word ptr addr+2; | ||
8932 | out dx,al; | ||
8933 | inc dx; | ||
8934 | xchg ah,al | ||
8935 | out dx,al; | ||
8936 | } | ||
8937 | |||
8938 | WR_HARP32(p_port,hp_xfercnt_0,count); | ||
8939 | |||
8940 | #else | ||
8941 | HP_SETUP_ADDR_CNT(p_port,addr,count); | 5688 | HP_SETUP_ADDR_CNT(p_port,addr,count); |
8942 | #endif | ||
8943 | 5689 | ||
8944 | 5690 | ||
8945 | if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR) { | 5691 | if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR) { |
@@ -8975,11 +5721,7 @@ void busMstrDataXferStart(ULONG p_port, PSCCB pcurrSCCB) | |||
8975 | * command busy is also time out, it'll just give up. | 5721 | * command busy is also time out, it'll just give up. |
8976 | * | 5722 | * |
8977 | *---------------------------------------------------------------------*/ | 5723 | *---------------------------------------------------------------------*/ |
8978 | #if defined(DOS) | 5724 | static UCHAR FPT_busMstrTimeOut(ULONG p_port) |
8979 | UCHAR busMstrTimeOut(USHORT p_port) | ||
8980 | #else | ||
8981 | UCHAR busMstrTimeOut(ULONG p_port) | ||
8982 | #endif | ||
8983 | { | 5725 | { |
8984 | ULONG timeout; | 5726 | ULONG timeout; |
8985 | 5727 | ||
@@ -9001,11 +5743,11 @@ UCHAR busMstrTimeOut(ULONG p_port) | |||
9001 | RD_HARPOON(p_port+hp_int_status); /*Clear command complete */ | 5743 | RD_HARPOON(p_port+hp_int_status); /*Clear command complete */ |
9002 | 5744 | ||
9003 | if (RD_HARPOON(p_port+hp_ext_status) & BM_CMD_BUSY) { | 5745 | if (RD_HARPOON(p_port+hp_ext_status) & BM_CMD_BUSY) { |
9004 | return(TRUE); | 5746 | return(1); |
9005 | } | 5747 | } |
9006 | 5748 | ||
9007 | else { | 5749 | else { |
9008 | return(FALSE); | 5750 | return(0); |
9009 | } | 5751 | } |
9010 | } | 5752 | } |
9011 | 5753 | ||
@@ -9017,18 +5759,14 @@ UCHAR busMstrTimeOut(ULONG p_port) | |||
9017 | * Description: Abort any in progress transfer. | 5759 | * Description: Abort any in progress transfer. |
9018 | * | 5760 | * |
9019 | *---------------------------------------------------------------------*/ | 5761 | *---------------------------------------------------------------------*/ |
9020 | #if defined(DOS) | 5762 | static void FPT_hostDataXferAbort(ULONG port, UCHAR p_card, PSCCB pCurrSCCB) |
9021 | void hostDataXferAbort(USHORT port, UCHAR p_card, PSCCB pCurrSCCB) | ||
9022 | #else | ||
9023 | void hostDataXferAbort(ULONG port, UCHAR p_card, PSCCB pCurrSCCB) | ||
9024 | #endif | ||
9025 | { | 5763 | { |
9026 | 5764 | ||
9027 | ULONG timeout; | 5765 | ULONG timeout; |
9028 | ULONG remain_cnt; | 5766 | ULONG remain_cnt; |
9029 | UINT sg_ptr; | 5767 | UINT sg_ptr; |
9030 | 5768 | ||
9031 | BL_Card[p_card].globalFlags &= ~F_HOST_XFER_ACT; | 5769 | FPT_BL_Card[p_card].globalFlags &= ~F_HOST_XFER_ACT; |
9032 | 5770 | ||
9033 | if (pCurrSCCB->Sccb_XferState & F_AUTO_SENSE) { | 5771 | if (pCurrSCCB->Sccb_XferState & F_AUTO_SENSE) { |
9034 | 5772 | ||
@@ -9044,7 +5782,7 @@ void hostDataXferAbort(ULONG port, UCHAR p_card, PSCCB pCurrSCCB) | |||
9044 | 5782 | ||
9045 | if (RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) { | 5783 | if (RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) { |
9046 | 5784 | ||
9047 | if (busMstrTimeOut(port)) { | 5785 | if (FPT_busMstrTimeOut(port)) { |
9048 | 5786 | ||
9049 | if (pCurrSCCB->HostStatus == 0x00) | 5787 | if (pCurrSCCB->HostStatus == 0x00) |
9050 | 5788 | ||
@@ -9060,10 +5798,6 @@ void hostDataXferAbort(ULONG port, UCHAR p_card, PSCCB pCurrSCCB) | |||
9060 | 5798 | ||
9061 | { | 5799 | { |
9062 | pCurrSCCB->HostStatus = SCCB_BM_ERR; | 5800 | pCurrSCCB->HostStatus = SCCB_BM_ERR; |
9063 | #if defined(BUGBUG) | ||
9064 | WR_HARPOON(port+hp_dual_addr_lo, | ||
9065 | RD_HARPOON(port+hp_ext_status)); | ||
9066 | #endif | ||
9067 | } | 5801 | } |
9068 | } | 5802 | } |
9069 | } | 5803 | } |
@@ -9092,22 +5826,12 @@ void hostDataXferAbort(ULONG port, UCHAR p_card, PSCCB pCurrSCCB) | |||
9092 | 5826 | ||
9093 | sg_ptr--; | 5827 | sg_ptr--; |
9094 | 5828 | ||
9095 | #if defined(COMPILER_16_BIT) && !defined(DOS) | ||
9096 | if (remain_cnt > (ULONG)(*(((ULONG far *)pCurrSCCB-> | ||
9097 | DataPointer) + (sg_ptr * 2)))) { | ||
9098 | |||
9099 | remain_cnt -= (ULONG)(*(((ULONG far *)pCurrSCCB-> | ||
9100 | DataPointer) + (sg_ptr * 2))); | ||
9101 | } | ||
9102 | |||
9103 | #else | ||
9104 | if (remain_cnt > (ULONG)(*(((ULONG *)pCurrSCCB-> | 5829 | if (remain_cnt > (ULONG)(*(((ULONG *)pCurrSCCB-> |
9105 | DataPointer) + (sg_ptr * 2)))) { | 5830 | DataPointer) + (sg_ptr * 2)))) { |
9106 | 5831 | ||
9107 | remain_cnt -= (ULONG)(*(((ULONG *)pCurrSCCB-> | 5832 | remain_cnt -= (ULONG)(*(((ULONG *)pCurrSCCB-> |
9108 | DataPointer) + (sg_ptr * 2))); | 5833 | DataPointer) + (sg_ptr * 2))); |
9109 | } | 5834 | } |
9110 | #endif | ||
9111 | 5835 | ||
9112 | else { | 5836 | else { |
9113 | 5837 | ||
@@ -9147,7 +5871,7 @@ void hostDataXferAbort(ULONG port, UCHAR p_card, PSCCB pCurrSCCB) | |||
9147 | 5871 | ||
9148 | if (RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) { | 5872 | if (RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) { |
9149 | 5873 | ||
9150 | busMstrTimeOut(port); | 5874 | FPT_busMstrTimeOut(port); |
9151 | } | 5875 | } |
9152 | 5876 | ||
9153 | else { | 5877 | else { |
@@ -9159,10 +5883,6 @@ void hostDataXferAbort(ULONG port, UCHAR p_card, PSCCB pCurrSCCB) | |||
9159 | if (pCurrSCCB->HostStatus == 0x00) { | 5883 | if (pCurrSCCB->HostStatus == 0x00) { |
9160 | 5884 | ||
9161 | pCurrSCCB->HostStatus = SCCB_BM_ERR; | 5885 | pCurrSCCB->HostStatus = SCCB_BM_ERR; |
9162 | #if defined(BUGBUG) | ||
9163 | WR_HARPOON(port+hp_dual_addr_lo, | ||
9164 | RD_HARPOON(port+hp_ext_status)); | ||
9165 | #endif | ||
9166 | } | 5886 | } |
9167 | } | 5887 | } |
9168 | } | 5888 | } |
@@ -9203,7 +5923,7 @@ void hostDataXferAbort(ULONG port, UCHAR p_card, PSCCB pCurrSCCB) | |||
9203 | pCurrSCCB->HostStatus = SCCB_BM_ERR; | 5923 | pCurrSCCB->HostStatus = SCCB_BM_ERR; |
9204 | } | 5924 | } |
9205 | 5925 | ||
9206 | busMstrTimeOut(port); | 5926 | FPT_busMstrTimeOut(port); |
9207 | } | 5927 | } |
9208 | } | 5928 | } |
9209 | 5929 | ||
@@ -9214,10 +5934,6 @@ void hostDataXferAbort(ULONG port, UCHAR p_card, PSCCB pCurrSCCB) | |||
9214 | if (pCurrSCCB->HostStatus == 0x00) { | 5934 | if (pCurrSCCB->HostStatus == 0x00) { |
9215 | 5935 | ||
9216 | pCurrSCCB->HostStatus = SCCB_BM_ERR; | 5936 | pCurrSCCB->HostStatus = SCCB_BM_ERR; |
9217 | #if defined(BUGBUG) | ||
9218 | WR_HARPOON(port+hp_dual_addr_lo, | ||
9219 | RD_HARPOON(port+hp_ext_status)); | ||
9220 | #endif | ||
9221 | } | 5937 | } |
9222 | } | 5938 | } |
9223 | } | 5939 | } |
@@ -9241,7 +5957,7 @@ void hostDataXferAbort(ULONG port, UCHAR p_card, PSCCB pCurrSCCB) | |||
9241 | pCurrSCCB->HostStatus = SCCB_BM_ERR; | 5957 | pCurrSCCB->HostStatus = SCCB_BM_ERR; |
9242 | } | 5958 | } |
9243 | 5959 | ||
9244 | busMstrTimeOut(port); | 5960 | FPT_busMstrTimeOut(port); |
9245 | } | 5961 | } |
9246 | } | 5962 | } |
9247 | 5963 | ||
@@ -9253,10 +5969,6 @@ void hostDataXferAbort(ULONG port, UCHAR p_card, PSCCB pCurrSCCB) | |||
9253 | if (pCurrSCCB->HostStatus == 0x00) { | 5969 | if (pCurrSCCB->HostStatus == 0x00) { |
9254 | 5970 | ||
9255 | pCurrSCCB->HostStatus = SCCB_BM_ERR; | 5971 | pCurrSCCB->HostStatus = SCCB_BM_ERR; |
9256 | #if defined(BUGBUG) | ||
9257 | WR_HARPOON(port+hp_dual_addr_lo, | ||
9258 | RD_HARPOON(port+hp_ext_status)); | ||
9259 | #endif | ||
9260 | } | 5972 | } |
9261 | } | 5973 | } |
9262 | 5974 | ||
@@ -9305,15 +6017,11 @@ void hostDataXferAbort(ULONG port, UCHAR p_card, PSCCB pCurrSCCB) | |||
9305 | * pointers message. | 6017 | * pointers message. |
9306 | * | 6018 | * |
9307 | *---------------------------------------------------------------------*/ | 6019 | *---------------------------------------------------------------------*/ |
9308 | void hostDataXferRestart(PSCCB currSCCB) | 6020 | static void FPT_hostDataXferRestart(PSCCB currSCCB) |
9309 | { | 6021 | { |
9310 | ULONG data_count; | 6022 | ULONG data_count; |
9311 | UINT sg_index; | 6023 | UINT sg_index; |
9312 | #if defined(COMPILER_16_BIT) && !defined(DOS) | ||
9313 | ULONG far *sg_ptr; | ||
9314 | #else | ||
9315 | ULONG *sg_ptr; | 6024 | ULONG *sg_ptr; |
9316 | #endif | ||
9317 | 6025 | ||
9318 | if (currSCCB->Sccb_XferState & F_SG_XFER) { | 6026 | if (currSCCB->Sccb_XferState & F_SG_XFER) { |
9319 | 6027 | ||
@@ -9322,11 +6030,7 @@ void hostDataXferRestart(PSCCB currSCCB) | |||
9322 | sg_index = 0xffff; /*Index by long words into sg list. */ | 6030 | sg_index = 0xffff; /*Index by long words into sg list. */ |
9323 | data_count = 0; /*Running count of SG xfer counts. */ | 6031 | data_count = 0; /*Running count of SG xfer counts. */ |
9324 | 6032 | ||
9325 | #if defined(COMPILER_16_BIT) && !defined(DOS) | ||
9326 | sg_ptr = (ULONG far *)currSCCB->DataPointer; | ||
9327 | #else | ||
9328 | sg_ptr = (ULONG *)currSCCB->DataPointer; | 6033 | sg_ptr = (ULONG *)currSCCB->DataPointer; |
9329 | #endif | ||
9330 | 6034 | ||
9331 | while (data_count < currSCCB->Sccb_ATC) { | 6035 | while (data_count < currSCCB->Sccb_ATC) { |
9332 | 6036 | ||
@@ -9351,78 +6055,28 @@ void hostDataXferRestart(PSCCB currSCCB) | |||
9351 | currSCCB->Sccb_XferCnt = currSCCB->DataLength - currSCCB->Sccb_ATC; | 6055 | currSCCB->Sccb_XferCnt = currSCCB->DataLength - currSCCB->Sccb_ATC; |
9352 | } | 6056 | } |
9353 | } | 6057 | } |
9354 | #ident "$Id: scam.c 1.17 1997/03/20 23:49:37 mohan Exp $" | ||
9355 | /*---------------------------------------------------------------------- | ||
9356 | * | ||
9357 | * | ||
9358 | * Copyright 1995-1996 by Mylex Corporation. All Rights Reserved | ||
9359 | * | ||
9360 | * This file is available under both the GNU General Public License | ||
9361 | * and a BSD-style copyright; see LICENSE.FlashPoint for details. | ||
9362 | * | ||
9363 | * $Workfile: scam.c $ | ||
9364 | * | ||
9365 | * Description: Functions relating to handling of the SCAM selection | ||
9366 | * and the determination of the SCSI IDs to be assigned | ||
9367 | * to all perspective SCSI targets. | ||
9368 | * | ||
9369 | * $Date: 1997/03/20 23:49:37 $ | ||
9370 | * | ||
9371 | * $Revision: 1.17 $ | ||
9372 | * | ||
9373 | *----------------------------------------------------------------------*/ | ||
9374 | 6058 | ||
9375 | /*#include <globals.h>*/ | ||
9376 | |||
9377 | #if (FW_TYPE==_UCB_MGR_) | ||
9378 | /*#include <budi.h>*/ | ||
9379 | #endif | ||
9380 | 6059 | ||
9381 | /*#include <sccbmgr.h>*/ | ||
9382 | /*#include <blx30.h>*/ | ||
9383 | /*#include <target.h>*/ | ||
9384 | /*#include <scsi2.h>*/ | ||
9385 | /*#include <eeprom.h>*/ | ||
9386 | /*#include <harpoon.h>*/ | ||
9387 | 6060 | ||
9388 | |||
9389 | |||
9390 | /* | ||
9391 | extern SCCBMGR_TAR_INFO sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR]; | ||
9392 | extern SCCBCARD BL_Card[MAX_CARDS]; | ||
9393 | extern SCCBSCAM_INFO scamInfo[MAX_SCSI_TAR]; | ||
9394 | extern NVRAMINFO nvRamInfo[MAX_MB_CARDS]; | ||
9395 | #if defined(DOS) || defined(OS2) | ||
9396 | extern UCHAR temp_id_string[ID_STRING_LENGTH]; | ||
9397 | #endif | ||
9398 | extern UCHAR scamHAString[]; | ||
9399 | */ | ||
9400 | /*--------------------------------------------------------------------- | 6061 | /*--------------------------------------------------------------------- |
9401 | * | 6062 | * |
9402 | * Function: scini | 6063 | * Function: FPT_scini |
9403 | * | 6064 | * |
9404 | * Description: Setup all data structures necessary for SCAM selection. | 6065 | * Description: Setup all data structures necessary for SCAM selection. |
9405 | * | 6066 | * |
9406 | *---------------------------------------------------------------------*/ | 6067 | *---------------------------------------------------------------------*/ |
9407 | 6068 | ||
9408 | void scini(UCHAR p_card, UCHAR p_our_id, UCHAR p_power_up) | 6069 | static void FPT_scini(UCHAR p_card, UCHAR p_our_id, UCHAR p_power_up) |
9409 | { | 6070 | { |
9410 | 6071 | ||
9411 | #if defined(SCAM_LEV_2) | ||
9412 | UCHAR loser,assigned_id; | 6072 | UCHAR loser,assigned_id; |
9413 | #endif | ||
9414 | #if defined(DOS) | ||
9415 | |||
9416 | USHORT p_port; | ||
9417 | #else | ||
9418 | ULONG p_port; | 6073 | ULONG p_port; |
9419 | #endif | ||
9420 | 6074 | ||
9421 | UCHAR i,k,ScamFlg ; | 6075 | UCHAR i,k,ScamFlg ; |
9422 | PSCCBcard currCard; | 6076 | PSCCBcard currCard; |
9423 | PNVRamInfo pCurrNvRam; | 6077 | PNVRamInfo pCurrNvRam; |
9424 | 6078 | ||
9425 | currCard = &BL_Card[p_card]; | 6079 | currCard = &FPT_BL_Card[p_card]; |
9426 | p_port = currCard->ioPort; | 6080 | p_port = currCard->ioPort; |
9427 | pCurrNvRam = currCard->pNvRamInfo; | 6081 | pCurrNvRam = currCard->pNvRamInfo; |
9428 | 6082 | ||
@@ -9432,72 +6086,68 @@ void scini(UCHAR p_card, UCHAR p_our_id, UCHAR p_power_up) | |||
9432 | i = pCurrNvRam->niSysConf; | 6086 | i = pCurrNvRam->niSysConf; |
9433 | } | 6087 | } |
9434 | else{ | 6088 | else{ |
9435 | ScamFlg = (UCHAR) utilEERead(p_port, SCAM_CONFIG/2); | 6089 | ScamFlg = (UCHAR) FPT_utilEERead(p_port, SCAM_CONFIG/2); |
9436 | i = (UCHAR)(utilEERead(p_port, (SYSTEM_CONFIG/2))); | 6090 | i = (UCHAR)(FPT_utilEERead(p_port, (SYSTEM_CONFIG/2))); |
9437 | } | 6091 | } |
9438 | if(!(i & 0x02)) /* check if reset bus in AutoSCSI parameter set */ | 6092 | if(!(i & 0x02)) /* check if reset bus in AutoSCSI parameter set */ |
9439 | return; | 6093 | return; |
9440 | 6094 | ||
9441 | inisci(p_card,p_port, p_our_id); | 6095 | FPT_inisci(p_card,p_port, p_our_id); |
9442 | 6096 | ||
9443 | /* Force to wait 1 sec after SCSI bus reset. Some SCAM device FW | 6097 | /* Force to wait 1 sec after SCSI bus reset. Some SCAM device FW |
9444 | too slow to return to SCAM selection */ | 6098 | too slow to return to SCAM selection */ |
9445 | 6099 | ||
9446 | /* if (p_power_up) | 6100 | /* if (p_power_up) |
9447 | Wait1Second(p_port); | 6101 | FPT_Wait1Second(p_port); |
9448 | else | 6102 | else |
9449 | Wait(p_port, TO_250ms); */ | 6103 | FPT_Wait(p_port, TO_250ms); */ |
9450 | |||
9451 | Wait1Second(p_port); | ||
9452 | 6104 | ||
9453 | #if defined(SCAM_LEV_2) | 6105 | FPT_Wait1Second(p_port); |
9454 | 6106 | ||
9455 | if ((ScamFlg & SCAM_ENABLED) && (ScamFlg & SCAM_LEVEL2)) | 6107 | if ((ScamFlg & SCAM_ENABLED) && (ScamFlg & SCAM_LEVEL2)) |
9456 | { | 6108 | { |
9457 | while (!(scarb(p_port,INIT_SELTD))) {} | 6109 | while (!(FPT_scarb(p_port,INIT_SELTD))) {} |
9458 | 6110 | ||
9459 | scsel(p_port); | 6111 | FPT_scsel(p_port); |
9460 | 6112 | ||
9461 | do { | 6113 | do { |
9462 | scxferc(p_port,SYNC_PTRN); | 6114 | FPT_scxferc(p_port,SYNC_PTRN); |
9463 | scxferc(p_port,DOM_MSTR); | 6115 | FPT_scxferc(p_port,DOM_MSTR); |
9464 | loser = scsendi(p_port,&scamInfo[p_our_id].id_string[0]); | 6116 | loser = FPT_scsendi(p_port,&FPT_scamInfo[p_our_id].id_string[0]); |
9465 | } while ( loser == 0xFF ); | 6117 | } while ( loser == 0xFF ); |
9466 | 6118 | ||
9467 | scbusf(p_port); | 6119 | FPT_scbusf(p_port); |
9468 | 6120 | ||
9469 | if ((p_power_up) && (!loser)) | 6121 | if ((p_power_up) && (!loser)) |
9470 | { | 6122 | { |
9471 | sresb(p_port,p_card); | 6123 | FPT_sresb(p_port,p_card); |
9472 | Wait(p_port, TO_250ms); | 6124 | FPT_Wait(p_port, TO_250ms); |
9473 | 6125 | ||
9474 | while (!(scarb(p_port,INIT_SELTD))) {} | 6126 | while (!(FPT_scarb(p_port,INIT_SELTD))) {} |
9475 | 6127 | ||
9476 | scsel(p_port); | 6128 | FPT_scsel(p_port); |
9477 | 6129 | ||
9478 | do { | 6130 | do { |
9479 | scxferc(p_port, SYNC_PTRN); | 6131 | FPT_scxferc(p_port, SYNC_PTRN); |
9480 | scxferc(p_port, DOM_MSTR); | 6132 | FPT_scxferc(p_port, DOM_MSTR); |
9481 | loser = scsendi(p_port,&scamInfo[p_our_id]. | 6133 | loser = FPT_scsendi(p_port,&FPT_scamInfo[p_our_id]. |
9482 | id_string[0]); | 6134 | id_string[0]); |
9483 | } while ( loser == 0xFF ); | 6135 | } while ( loser == 0xFF ); |
9484 | 6136 | ||
9485 | scbusf(p_port); | 6137 | FPT_scbusf(p_port); |
9486 | } | 6138 | } |
9487 | } | 6139 | } |
9488 | 6140 | ||
9489 | else | 6141 | else |
9490 | { | 6142 | { |
9491 | loser = FALSE; | 6143 | loser = 0; |
9492 | } | 6144 | } |
9493 | 6145 | ||
9494 | 6146 | ||
9495 | if (!loser) | 6147 | if (!loser) |
9496 | { | 6148 | { |
9497 | 6149 | ||
9498 | #endif /* SCAM_LEV_2 */ | 6150 | FPT_scamInfo[p_our_id].state = ID_ASSIGNED; |
9499 | |||
9500 | scamInfo[p_our_id].state = ID_ASSIGNED; | ||
9501 | 6151 | ||
9502 | 6152 | ||
9503 | if (ScamFlg & SCAM_ENABLED) | 6153 | if (ScamFlg & SCAM_ENABLED) |
@@ -9505,18 +6155,18 @@ void scini(UCHAR p_card, UCHAR p_our_id, UCHAR p_power_up) | |||
9505 | 6155 | ||
9506 | for (i=0; i < MAX_SCSI_TAR; i++) | 6156 | for (i=0; i < MAX_SCSI_TAR; i++) |
9507 | { | 6157 | { |
9508 | if ((scamInfo[i].state == ID_UNASSIGNED) || | 6158 | if ((FPT_scamInfo[i].state == ID_UNASSIGNED) || |
9509 | (scamInfo[i].state == ID_UNUSED)) | 6159 | (FPT_scamInfo[i].state == ID_UNUSED)) |
9510 | { | 6160 | { |
9511 | if (scsell(p_port,i)) | 6161 | if (FPT_scsell(p_port,i)) |
9512 | { | 6162 | { |
9513 | scamInfo[i].state = LEGACY; | 6163 | FPT_scamInfo[i].state = LEGACY; |
9514 | if ((scamInfo[i].id_string[0] != 0xFF) || | 6164 | if ((FPT_scamInfo[i].id_string[0] != 0xFF) || |
9515 | (scamInfo[i].id_string[1] != 0xFA)) | 6165 | (FPT_scamInfo[i].id_string[1] != 0xFA)) |
9516 | { | 6166 | { |
9517 | 6167 | ||
9518 | scamInfo[i].id_string[0] = 0xFF; | 6168 | FPT_scamInfo[i].id_string[0] = 0xFF; |
9519 | scamInfo[i].id_string[1] = 0xFA; | 6169 | FPT_scamInfo[i].id_string[1] = 0xFA; |
9520 | if(pCurrNvRam == NULL) | 6170 | if(pCurrNvRam == NULL) |
9521 | currCard->globalFlags |= F_UPDATE_EEPROM; | 6171 | currCard->globalFlags |= F_UPDATE_EEPROM; |
9522 | } | 6172 | } |
@@ -9524,45 +6174,43 @@ void scini(UCHAR p_card, UCHAR p_our_id, UCHAR p_power_up) | |||
9524 | } | 6174 | } |
9525 | } | 6175 | } |
9526 | 6176 | ||
9527 | sresb(p_port,p_card); | 6177 | FPT_sresb(p_port,p_card); |
9528 | Wait1Second(p_port); | 6178 | FPT_Wait1Second(p_port); |
9529 | while (!(scarb(p_port,INIT_SELTD))) {} | 6179 | while (!(FPT_scarb(p_port,INIT_SELTD))) {} |
9530 | scsel(p_port); | 6180 | FPT_scsel(p_port); |
9531 | scasid(p_card, p_port); | 6181 | FPT_scasid(p_card, p_port); |
9532 | } | 6182 | } |
9533 | 6183 | ||
9534 | #if defined(SCAM_LEV_2) | ||
9535 | |||
9536 | } | 6184 | } |
9537 | 6185 | ||
9538 | else if ((loser) && (ScamFlg & SCAM_ENABLED)) | 6186 | else if ((loser) && (ScamFlg & SCAM_ENABLED)) |
9539 | { | 6187 | { |
9540 | scamInfo[p_our_id].id_string[0] = SLV_TYPE_CODE0; | 6188 | FPT_scamInfo[p_our_id].id_string[0] = SLV_TYPE_CODE0; |
9541 | assigned_id = FALSE; | 6189 | assigned_id = 0; |
9542 | scwtsel(p_port); | 6190 | FPT_scwtsel(p_port); |
9543 | 6191 | ||
9544 | do { | 6192 | do { |
9545 | while (scxferc(p_port,0x00) != SYNC_PTRN) {} | 6193 | while (FPT_scxferc(p_port,0x00) != SYNC_PTRN) {} |
9546 | 6194 | ||
9547 | i = scxferc(p_port,0x00); | 6195 | i = FPT_scxferc(p_port,0x00); |
9548 | if (i == ASSIGN_ID) | 6196 | if (i == ASSIGN_ID) |
9549 | { | 6197 | { |
9550 | if (!(scsendi(p_port,&scamInfo[p_our_id].id_string[0]))) | 6198 | if (!(FPT_scsendi(p_port,&FPT_scamInfo[p_our_id].id_string[0]))) |
9551 | { | 6199 | { |
9552 | i = scxferc(p_port,0x00); | 6200 | i = FPT_scxferc(p_port,0x00); |
9553 | if (scvalq(i)) | 6201 | if (FPT_scvalq(i)) |
9554 | { | 6202 | { |
9555 | k = scxferc(p_port,0x00); | 6203 | k = FPT_scxferc(p_port,0x00); |
9556 | 6204 | ||
9557 | if (scvalq(k)) | 6205 | if (FPT_scvalq(k)) |
9558 | { | 6206 | { |
9559 | currCard->ourId = | 6207 | currCard->ourId = |
9560 | ((UCHAR)(i<<3)+(k & (UCHAR)7)) & (UCHAR) 0x3F; | 6208 | ((UCHAR)(i<<3)+(k & (UCHAR)7)) & (UCHAR) 0x3F; |
9561 | inisci(p_card, p_port, p_our_id); | 6209 | FPT_inisci(p_card, p_port, p_our_id); |
9562 | scamInfo[currCard->ourId].state = ID_ASSIGNED; | 6210 | FPT_scamInfo[currCard->ourId].state = ID_ASSIGNED; |
9563 | scamInfo[currCard->ourId].id_string[0] | 6211 | FPT_scamInfo[currCard->ourId].id_string[0] |
9564 | = SLV_TYPE_CODE0; | 6212 | = SLV_TYPE_CODE0; |
9565 | assigned_id = TRUE; | 6213 | assigned_id = 1; |
9566 | } | 6214 | } |
9567 | } | 6215 | } |
9568 | } | 6216 | } |
@@ -9570,43 +6218,31 @@ void scini(UCHAR p_card, UCHAR p_our_id, UCHAR p_power_up) | |||
9570 | 6218 | ||
9571 | else if (i == SET_P_FLAG) | 6219 | else if (i == SET_P_FLAG) |
9572 | { | 6220 | { |
9573 | if (!(scsendi(p_port, | 6221 | if (!(FPT_scsendi(p_port, |
9574 | &scamInfo[p_our_id].id_string[0]))) | 6222 | &FPT_scamInfo[p_our_id].id_string[0]))) |
9575 | scamInfo[p_our_id].id_string[0] |= 0x80; | 6223 | FPT_scamInfo[p_our_id].id_string[0] |= 0x80; |
9576 | } | 6224 | } |
9577 | }while (!assigned_id); | 6225 | }while (!assigned_id); |
9578 | 6226 | ||
9579 | while (scxferc(p_port,0x00) != CFG_CMPLT) {} | 6227 | while (FPT_scxferc(p_port,0x00) != CFG_CMPLT) {} |
9580 | } | 6228 | } |
9581 | 6229 | ||
9582 | #endif /* SCAM_LEV_2 */ | ||
9583 | if (ScamFlg & SCAM_ENABLED) | 6230 | if (ScamFlg & SCAM_ENABLED) |
9584 | { | 6231 | { |
9585 | scbusf(p_port); | 6232 | FPT_scbusf(p_port); |
9586 | if (currCard->globalFlags & F_UPDATE_EEPROM) | 6233 | if (currCard->globalFlags & F_UPDATE_EEPROM) |
9587 | { | 6234 | { |
9588 | scsavdi(p_card, p_port); | 6235 | FPT_scsavdi(p_card, p_port); |
9589 | currCard->globalFlags &= ~F_UPDATE_EEPROM; | 6236 | currCard->globalFlags &= ~F_UPDATE_EEPROM; |
9590 | } | 6237 | } |
9591 | } | 6238 | } |
9592 | 6239 | ||
9593 | 6240 | ||
9594 | #if defined(DOS) | ||
9595 | for (i=0; i < MAX_SCSI_TAR; i++) | ||
9596 | { | ||
9597 | if (((ScamFlg & SCAM_ENABLED) && (scamInfo[i].state == LEGACY)) | ||
9598 | || (i != p_our_id)) | ||
9599 | { | ||
9600 | scsellDOS(p_port,i); | ||
9601 | } | ||
9602 | } | ||
9603 | #endif | ||
9604 | |||
9605 | /* | 6241 | /* |
9606 | for (i=0,k=0; i < MAX_SCSI_TAR; i++) | 6242 | for (i=0,k=0; i < MAX_SCSI_TAR; i++) |
9607 | { | 6243 | { |
9608 | if ((scamInfo[i].state == ID_ASSIGNED) || | 6244 | if ((FPT_scamInfo[i].state == ID_ASSIGNED) || |
9609 | (scamInfo[i].state == LEGACY)) | 6245 | (FPT_scamInfo[i].state == LEGACY)) |
9610 | k++; | 6246 | k++; |
9611 | } | 6247 | } |
9612 | 6248 | ||
@@ -9620,17 +6256,13 @@ void scini(UCHAR p_card, UCHAR p_our_id, UCHAR p_power_up) | |||
9620 | 6256 | ||
9621 | /*--------------------------------------------------------------------- | 6257 | /*--------------------------------------------------------------------- |
9622 | * | 6258 | * |
9623 | * Function: scarb | 6259 | * Function: FPT_scarb |
9624 | * | 6260 | * |
9625 | * Description: Gain control of the bus and wait SCAM select time (250ms) | 6261 | * Description: Gain control of the bus and wait SCAM select time (250ms) |
9626 | * | 6262 | * |
9627 | *---------------------------------------------------------------------*/ | 6263 | *---------------------------------------------------------------------*/ |
9628 | 6264 | ||
9629 | #if defined(DOS) | 6265 | static int FPT_scarb(ULONG p_port, UCHAR p_sel_type) |
9630 | int scarb(USHORT p_port, UCHAR p_sel_type) | ||
9631 | #else | ||
9632 | int scarb(ULONG p_port, UCHAR p_sel_type) | ||
9633 | #endif | ||
9634 | { | 6266 | { |
9635 | if (p_sel_type == INIT_SELTD) | 6267 | if (p_sel_type == INIT_SELTD) |
9636 | { | 6268 | { |
@@ -9639,10 +6271,10 @@ int scarb(ULONG p_port, UCHAR p_sel_type) | |||
9639 | 6271 | ||
9640 | 6272 | ||
9641 | if (RD_HARPOON(p_port+hp_scsisig) & SCSI_SEL) | 6273 | if (RD_HARPOON(p_port+hp_scsisig) & SCSI_SEL) |
9642 | return(FALSE); | 6274 | return(0); |
9643 | 6275 | ||
9644 | if (RD_HARPOON(p_port+hp_scsidata_0) != 00) | 6276 | if (RD_HARPOON(p_port+hp_scsidata_0) != 00) |
9645 | return(FALSE); | 6277 | return(0); |
9646 | 6278 | ||
9647 | WR_HARPOON(p_port+hp_scsisig, (RD_HARPOON(p_port+hp_scsisig) | SCSI_BSY)); | 6279 | WR_HARPOON(p_port+hp_scsisig, (RD_HARPOON(p_port+hp_scsisig) | SCSI_BSY)); |
9648 | 6280 | ||
@@ -9650,7 +6282,7 @@ int scarb(ULONG p_port, UCHAR p_sel_type) | |||
9650 | 6282 | ||
9651 | WR_HARPOON(p_port+hp_scsisig, (RD_HARPOON(p_port+hp_scsisig) & | 6283 | WR_HARPOON(p_port+hp_scsisig, (RD_HARPOON(p_port+hp_scsisig) & |
9652 | ~SCSI_BSY)); | 6284 | ~SCSI_BSY)); |
9653 | return(FALSE); | 6285 | return(0); |
9654 | } | 6286 | } |
9655 | 6287 | ||
9656 | 6288 | ||
@@ -9660,7 +6292,7 @@ int scarb(ULONG p_port, UCHAR p_sel_type) | |||
9660 | 6292 | ||
9661 | WR_HARPOON(p_port+hp_scsisig, (RD_HARPOON(p_port+hp_scsisig) & | 6293 | WR_HARPOON(p_port+hp_scsisig, (RD_HARPOON(p_port+hp_scsisig) & |
9662 | ~(SCSI_BSY | SCSI_SEL))); | 6294 | ~(SCSI_BSY | SCSI_SEL))); |
9663 | return(FALSE); | 6295 | return(0); |
9664 | } | 6296 | } |
9665 | } | 6297 | } |
9666 | 6298 | ||
@@ -9669,9 +6301,7 @@ int scarb(ULONG p_port, UCHAR p_sel_type) | |||
9669 | & ~ACTdeassert)); | 6301 | & ~ACTdeassert)); |
9670 | WR_HARPOON(p_port+hp_scsireset, SCAM_EN); | 6302 | WR_HARPOON(p_port+hp_scsireset, SCAM_EN); |
9671 | WR_HARPOON(p_port+hp_scsidata_0, 0x00); | 6303 | WR_HARPOON(p_port+hp_scsidata_0, 0x00); |
9672 | #if defined(WIDE_SCSI) | ||
9673 | WR_HARPOON(p_port+hp_scsidata_1, 0x00); | 6304 | WR_HARPOON(p_port+hp_scsidata_1, 0x00); |
9674 | #endif | ||
9675 | WR_HARPOON(p_port+hp_portctrl_0, SCSI_BUS_EN); | 6305 | WR_HARPOON(p_port+hp_portctrl_0, SCSI_BUS_EN); |
9676 | 6306 | ||
9677 | WR_HARPOON(p_port+hp_scsisig, (RD_HARPOON(p_port+hp_scsisig) | SCSI_MSG)); | 6307 | WR_HARPOON(p_port+hp_scsisig, (RD_HARPOON(p_port+hp_scsisig) | SCSI_MSG)); |
@@ -9679,25 +6309,21 @@ int scarb(ULONG p_port, UCHAR p_sel_type) | |||
9679 | WR_HARPOON(p_port+hp_scsisig, (RD_HARPOON(p_port+hp_scsisig) | 6309 | WR_HARPOON(p_port+hp_scsisig, (RD_HARPOON(p_port+hp_scsisig) |
9680 | & ~SCSI_BSY)); | 6310 | & ~SCSI_BSY)); |
9681 | 6311 | ||
9682 | Wait(p_port,TO_250ms); | 6312 | FPT_Wait(p_port,TO_250ms); |
9683 | 6313 | ||
9684 | return(TRUE); | 6314 | return(1); |
9685 | } | 6315 | } |
9686 | 6316 | ||
9687 | 6317 | ||
9688 | /*--------------------------------------------------------------------- | 6318 | /*--------------------------------------------------------------------- |
9689 | * | 6319 | * |
9690 | * Function: scbusf | 6320 | * Function: FPT_scbusf |
9691 | * | 6321 | * |
9692 | * Description: Release the SCSI bus and disable SCAM selection. | 6322 | * Description: Release the SCSI bus and disable SCAM selection. |
9693 | * | 6323 | * |
9694 | *---------------------------------------------------------------------*/ | 6324 | *---------------------------------------------------------------------*/ |
9695 | 6325 | ||
9696 | #if defined(DOS) | 6326 | static void FPT_scbusf(ULONG p_port) |
9697 | void scbusf(USHORT p_port) | ||
9698 | #else | ||
9699 | void scbusf(ULONG p_port) | ||
9700 | #endif | ||
9701 | { | 6327 | { |
9702 | WR_HARPOON(p_port+hp_page_ctrl, | 6328 | WR_HARPOON(p_port+hp_page_ctrl, |
9703 | (RD_HARPOON(p_port+hp_page_ctrl) | G_INT_DISABLE)); | 6329 | (RD_HARPOON(p_port+hp_page_ctrl) | G_INT_DISABLE)); |
@@ -9717,11 +6343,7 @@ void scbusf(ULONG p_port) | |||
9717 | WR_HARPOON(p_port+hp_clkctrl_0, (RD_HARPOON(p_port+hp_clkctrl_0) | 6343 | WR_HARPOON(p_port+hp_clkctrl_0, (RD_HARPOON(p_port+hp_clkctrl_0) |
9718 | | ACTdeassert)); | 6344 | | ACTdeassert)); |
9719 | 6345 | ||
9720 | #if defined(SCAM_LEV_2) | ||
9721 | WRW_HARPOON((p_port+hp_intstat), (BUS_FREE | AUTO_INT | SCAM_SEL)); | 6346 | WRW_HARPOON((p_port+hp_intstat), (BUS_FREE | AUTO_INT | SCAM_SEL)); |
9722 | #else | ||
9723 | WRW_HARPOON((p_port+hp_intstat), (BUS_FREE | AUTO_INT)); | ||
9724 | #endif | ||
9725 | 6347 | ||
9726 | WR_HARPOON(p_port+hp_page_ctrl, | 6348 | WR_HARPOON(p_port+hp_page_ctrl, |
9727 | (RD_HARPOON(p_port+hp_page_ctrl) & ~G_INT_DISABLE)); | 6349 | (RD_HARPOON(p_port+hp_page_ctrl) & ~G_INT_DISABLE)); |
@@ -9731,35 +6353,24 @@ void scbusf(ULONG p_port) | |||
9731 | 6353 | ||
9732 | /*--------------------------------------------------------------------- | 6354 | /*--------------------------------------------------------------------- |
9733 | * | 6355 | * |
9734 | * Function: scasid | 6356 | * Function: FPT_scasid |
9735 | * | 6357 | * |
9736 | * Description: Assign an ID to all the SCAM devices. | 6358 | * Description: Assign an ID to all the SCAM devices. |
9737 | * | 6359 | * |
9738 | *---------------------------------------------------------------------*/ | 6360 | *---------------------------------------------------------------------*/ |
9739 | 6361 | ||
9740 | #if defined(DOS) | 6362 | static void FPT_scasid(UCHAR p_card, ULONG p_port) |
9741 | void scasid(UCHAR p_card, USHORT p_port) | ||
9742 | #else | ||
9743 | void scasid(UCHAR p_card, ULONG p_port) | ||
9744 | #endif | ||
9745 | { | 6363 | { |
9746 | #if defined(DOS) || defined(OS2) | ||
9747 | /* Use external defined in global space area, instead of Stack | ||
9748 | space. WIN/95 DOS doesnot work TINY mode. The OS doesnot intialize | ||
9749 | SS equal to DS. Thus the array allocated on stack doesnot get | ||
9750 | access correctly */ | ||
9751 | #else | ||
9752 | UCHAR temp_id_string[ID_STRING_LENGTH]; | 6364 | UCHAR temp_id_string[ID_STRING_LENGTH]; |
9753 | #endif | ||
9754 | 6365 | ||
9755 | UCHAR i,k,scam_id; | 6366 | UCHAR i,k,scam_id; |
9756 | UCHAR crcBytes[3]; | 6367 | UCHAR crcBytes[3]; |
9757 | PNVRamInfo pCurrNvRam; | 6368 | PNVRamInfo pCurrNvRam; |
9758 | ushort_ptr pCrcBytes; | 6369 | ushort_ptr pCrcBytes; |
9759 | 6370 | ||
9760 | pCurrNvRam = BL_Card[p_card].pNvRamInfo; | 6371 | pCurrNvRam = FPT_BL_Card[p_card].pNvRamInfo; |
9761 | 6372 | ||
9762 | i=FALSE; | 6373 | i=0; |
9763 | 6374 | ||
9764 | while (!i) | 6375 | while (!i) |
9765 | { | 6376 | { |
@@ -9769,36 +6380,36 @@ void scasid(UCHAR p_card, ULONG p_port) | |||
9769 | temp_id_string[k] = (UCHAR) 0x00; | 6380 | temp_id_string[k] = (UCHAR) 0x00; |
9770 | } | 6381 | } |
9771 | 6382 | ||
9772 | scxferc(p_port,SYNC_PTRN); | 6383 | FPT_scxferc(p_port,SYNC_PTRN); |
9773 | scxferc(p_port,ASSIGN_ID); | 6384 | FPT_scxferc(p_port,ASSIGN_ID); |
9774 | 6385 | ||
9775 | if (!(sciso(p_port,&temp_id_string[0]))) | 6386 | if (!(FPT_sciso(p_port,&temp_id_string[0]))) |
9776 | { | 6387 | { |
9777 | if(pCurrNvRam){ | 6388 | if(pCurrNvRam){ |
9778 | pCrcBytes = (ushort_ptr)&crcBytes[0]; | 6389 | pCrcBytes = (ushort_ptr)&crcBytes[0]; |
9779 | *pCrcBytes = CalcCrc16(&temp_id_string[0]); | 6390 | *pCrcBytes = FPT_CalcCrc16(&temp_id_string[0]); |
9780 | crcBytes[2] = CalcLrc(&temp_id_string[0]); | 6391 | crcBytes[2] = FPT_CalcLrc(&temp_id_string[0]); |
9781 | temp_id_string[1] = crcBytes[2]; | 6392 | temp_id_string[1] = crcBytes[2]; |
9782 | temp_id_string[2] = crcBytes[0]; | 6393 | temp_id_string[2] = crcBytes[0]; |
9783 | temp_id_string[3] = crcBytes[1]; | 6394 | temp_id_string[3] = crcBytes[1]; |
9784 | for(k = 4; k < ID_STRING_LENGTH; k++) | 6395 | for(k = 4; k < ID_STRING_LENGTH; k++) |
9785 | temp_id_string[k] = (UCHAR) 0x00; | 6396 | temp_id_string[k] = (UCHAR) 0x00; |
9786 | } | 6397 | } |
9787 | i = scmachid(p_card,temp_id_string); | 6398 | i = FPT_scmachid(p_card,temp_id_string); |
9788 | 6399 | ||
9789 | if (i == CLR_PRIORITY) | 6400 | if (i == CLR_PRIORITY) |
9790 | { | 6401 | { |
9791 | scxferc(p_port,MISC_CODE); | 6402 | FPT_scxferc(p_port,MISC_CODE); |
9792 | scxferc(p_port,CLR_P_FLAG); | 6403 | FPT_scxferc(p_port,CLR_P_FLAG); |
9793 | i = FALSE; /*Not the last ID yet. */ | 6404 | i = 0; /*Not the last ID yet. */ |
9794 | } | 6405 | } |
9795 | 6406 | ||
9796 | else if (i != NO_ID_AVAIL) | 6407 | else if (i != NO_ID_AVAIL) |
9797 | { | 6408 | { |
9798 | if (i < 8 ) | 6409 | if (i < 8 ) |
9799 | scxferc(p_port,ID_0_7); | 6410 | FPT_scxferc(p_port,ID_0_7); |
9800 | else | 6411 | else |
9801 | scxferc(p_port,ID_8_F); | 6412 | FPT_scxferc(p_port,ID_8_F); |
9802 | 6413 | ||
9803 | scam_id = (i & (UCHAR) 0x07); | 6414 | scam_id = (i & (UCHAR) 0x07); |
9804 | 6415 | ||
@@ -9807,21 +6418,21 @@ void scasid(UCHAR p_card, ULONG p_port) | |||
9807 | if (!( k & i )) | 6418 | if (!( k & i )) |
9808 | scam_id += 0x08; /*Count number of zeros in DB0-3. */ | 6419 | scam_id += 0x08; /*Count number of zeros in DB0-3. */ |
9809 | 6420 | ||
9810 | scxferc(p_port,scam_id); | 6421 | FPT_scxferc(p_port,scam_id); |
9811 | 6422 | ||
9812 | i = FALSE; /*Not the last ID yet. */ | 6423 | i = 0; /*Not the last ID yet. */ |
9813 | } | 6424 | } |
9814 | } | 6425 | } |
9815 | 6426 | ||
9816 | else | 6427 | else |
9817 | { | 6428 | { |
9818 | i = TRUE; | 6429 | i = 1; |
9819 | } | 6430 | } |
9820 | 6431 | ||
9821 | } /*End while */ | 6432 | } /*End while */ |
9822 | 6433 | ||
9823 | scxferc(p_port,SYNC_PTRN); | 6434 | FPT_scxferc(p_port,SYNC_PTRN); |
9824 | scxferc(p_port,CFG_CMPLT); | 6435 | FPT_scxferc(p_port,CFG_CMPLT); |
9825 | } | 6436 | } |
9826 | 6437 | ||
9827 | 6438 | ||
@@ -9830,21 +6441,17 @@ void scasid(UCHAR p_card, ULONG p_port) | |||
9830 | 6441 | ||
9831 | /*--------------------------------------------------------------------- | 6442 | /*--------------------------------------------------------------------- |
9832 | * | 6443 | * |
9833 | * Function: scsel | 6444 | * Function: FPT_scsel |
9834 | * | 6445 | * |
9835 | * Description: Select all the SCAM devices. | 6446 | * Description: Select all the SCAM devices. |
9836 | * | 6447 | * |
9837 | *---------------------------------------------------------------------*/ | 6448 | *---------------------------------------------------------------------*/ |
9838 | 6449 | ||
9839 | #if defined(DOS) | 6450 | static void FPT_scsel(ULONG p_port) |
9840 | void scsel(USHORT p_port) | ||
9841 | #else | ||
9842 | void scsel(ULONG p_port) | ||
9843 | #endif | ||
9844 | { | 6451 | { |
9845 | 6452 | ||
9846 | WR_HARPOON(p_port+hp_scsisig, SCSI_SEL); | 6453 | WR_HARPOON(p_port+hp_scsisig, SCSI_SEL); |
9847 | scwiros(p_port, SCSI_MSG); | 6454 | FPT_scwiros(p_port, SCSI_MSG); |
9848 | 6455 | ||
9849 | WR_HARPOON(p_port+hp_scsisig, (SCSI_SEL | SCSI_BSY)); | 6456 | WR_HARPOON(p_port+hp_scsisig, (SCSI_SEL | SCSI_BSY)); |
9850 | 6457 | ||
@@ -9855,11 +6462,11 @@ void scsel(ULONG p_port) | |||
9855 | 6462 | ||
9856 | 6463 | ||
9857 | WR_HARPOON(p_port+hp_scsisig, (SCSI_BSY | SCSI_IOBIT | SCSI_CD)); | 6464 | WR_HARPOON(p_port+hp_scsisig, (SCSI_BSY | SCSI_IOBIT | SCSI_CD)); |
9858 | scwiros(p_port, SCSI_SEL); | 6465 | FPT_scwiros(p_port, SCSI_SEL); |
9859 | 6466 | ||
9860 | WR_HARPOON(p_port+hp_scsidata_0, (UCHAR)(RD_HARPOON(p_port+hp_scsidata_0) & | 6467 | WR_HARPOON(p_port+hp_scsidata_0, (UCHAR)(RD_HARPOON(p_port+hp_scsidata_0) & |
9861 | ~(UCHAR)BIT(6))); | 6468 | ~(UCHAR)BIT(6))); |
9862 | scwirod(p_port, BIT(6)); | 6469 | FPT_scwirod(p_port, BIT(6)); |
9863 | 6470 | ||
9864 | WR_HARPOON(p_port+hp_scsisig, (SCSI_SEL | SCSI_BSY | SCSI_IOBIT | SCSI_CD)); | 6471 | WR_HARPOON(p_port+hp_scsisig, (SCSI_SEL | SCSI_BSY | SCSI_IOBIT | SCSI_CD)); |
9865 | } | 6472 | } |
@@ -9868,17 +6475,13 @@ void scsel(ULONG p_port) | |||
9868 | 6475 | ||
9869 | /*--------------------------------------------------------------------- | 6476 | /*--------------------------------------------------------------------- |
9870 | * | 6477 | * |
9871 | * Function: scxferc | 6478 | * Function: FPT_scxferc |
9872 | * | 6479 | * |
9873 | * Description: Handshake the p_data (DB4-0) across the bus. | 6480 | * Description: Handshake the p_data (DB4-0) across the bus. |
9874 | * | 6481 | * |
9875 | *---------------------------------------------------------------------*/ | 6482 | *---------------------------------------------------------------------*/ |
9876 | 6483 | ||
9877 | #if defined(DOS) | 6484 | static UCHAR FPT_scxferc(ULONG p_port, UCHAR p_data) |
9878 | UCHAR scxferc(USHORT p_port, UCHAR p_data) | ||
9879 | #else | ||
9880 | UCHAR scxferc(ULONG p_port, UCHAR p_data) | ||
9881 | #endif | ||
9882 | { | 6485 | { |
9883 | UCHAR curr_data, ret_data; | 6486 | UCHAR curr_data, ret_data; |
9884 | 6487 | ||
@@ -9890,7 +6493,7 @@ UCHAR scxferc(ULONG p_port, UCHAR p_data) | |||
9890 | 6493 | ||
9891 | WR_HARPOON(p_port+hp_scsidata_0, curr_data); | 6494 | WR_HARPOON(p_port+hp_scsidata_0, curr_data); |
9892 | 6495 | ||
9893 | scwirod(p_port,BIT(7)); /*Wait for DB7 to be released. */ | 6496 | FPT_scwirod(p_port,BIT(7)); /*Wait for DB7 to be released. */ |
9894 | while (!(RD_HARPOON(p_port+hp_scsidata_0) & BIT(5))); | 6497 | while (!(RD_HARPOON(p_port+hp_scsidata_0) & BIT(5))); |
9895 | 6498 | ||
9896 | ret_data = (RD_HARPOON(p_port+hp_scsidata_0) & (UCHAR) 0x1F); | 6499 | ret_data = (RD_HARPOON(p_port+hp_scsidata_0) & (UCHAR) 0x1F); |
@@ -9903,7 +6506,7 @@ UCHAR scxferc(ULONG p_port, UCHAR p_data) | |||
9903 | 6506 | ||
9904 | WR_HARPOON(p_port+hp_scsidata_0, curr_data); | 6507 | WR_HARPOON(p_port+hp_scsidata_0, curr_data); |
9905 | 6508 | ||
9906 | scwirod(p_port,BIT(5)); /*Wait for DB5 to be released. */ | 6509 | FPT_scwirod(p_port,BIT(5)); /*Wait for DB5 to be released. */ |
9907 | 6510 | ||
9908 | curr_data &= ~(BIT(4)|BIT(3)|BIT(2)|BIT(1)|BIT(0)); /*Release data bits */ | 6511 | curr_data &= ~(BIT(4)|BIT(3)|BIT(2)|BIT(1)|BIT(0)); /*Release data bits */ |
9909 | curr_data |= BIT(7); | 6512 | curr_data |= BIT(7); |
@@ -9914,7 +6517,7 @@ UCHAR scxferc(ULONG p_port, UCHAR p_data) | |||
9914 | 6517 | ||
9915 | WR_HARPOON(p_port+hp_scsidata_0, curr_data); | 6518 | WR_HARPOON(p_port+hp_scsidata_0, curr_data); |
9916 | 6519 | ||
9917 | scwirod(p_port,BIT(6)); /*Wait for DB6 to be released. */ | 6520 | FPT_scwirod(p_port,BIT(6)); /*Wait for DB6 to be released. */ |
9918 | 6521 | ||
9919 | return(ret_data); | 6522 | return(ret_data); |
9920 | } | 6523 | } |
@@ -9922,39 +6525,35 @@ UCHAR scxferc(ULONG p_port, UCHAR p_data) | |||
9922 | 6525 | ||
9923 | /*--------------------------------------------------------------------- | 6526 | /*--------------------------------------------------------------------- |
9924 | * | 6527 | * |
9925 | * Function: scsendi | 6528 | * Function: FPT_scsendi |
9926 | * | 6529 | * |
9927 | * Description: Transfer our Identification string to determine if we | 6530 | * Description: Transfer our Identification string to determine if we |
9928 | * will be the dominant master. | 6531 | * will be the dominant master. |
9929 | * | 6532 | * |
9930 | *---------------------------------------------------------------------*/ | 6533 | *---------------------------------------------------------------------*/ |
9931 | 6534 | ||
9932 | #if defined(DOS) | 6535 | static UCHAR FPT_scsendi(ULONG p_port, UCHAR p_id_string[]) |
9933 | UCHAR scsendi(USHORT p_port, UCHAR p_id_string[]) | ||
9934 | #else | ||
9935 | UCHAR scsendi(ULONG p_port, UCHAR p_id_string[]) | ||
9936 | #endif | ||
9937 | { | 6536 | { |
9938 | UCHAR ret_data,byte_cnt,bit_cnt,defer; | 6537 | UCHAR ret_data,byte_cnt,bit_cnt,defer; |
9939 | 6538 | ||
9940 | defer = FALSE; | 6539 | defer = 0; |
9941 | 6540 | ||
9942 | for (byte_cnt = 0; byte_cnt < ID_STRING_LENGTH; byte_cnt++) { | 6541 | for (byte_cnt = 0; byte_cnt < ID_STRING_LENGTH; byte_cnt++) { |
9943 | 6542 | ||
9944 | for (bit_cnt = 0x80; bit_cnt != 0 ; bit_cnt >>= 1) { | 6543 | for (bit_cnt = 0x80; bit_cnt != 0 ; bit_cnt >>= 1) { |
9945 | 6544 | ||
9946 | if (defer) | 6545 | if (defer) |
9947 | ret_data = scxferc(p_port,00); | 6546 | ret_data = FPT_scxferc(p_port,00); |
9948 | 6547 | ||
9949 | else if (p_id_string[byte_cnt] & bit_cnt) | 6548 | else if (p_id_string[byte_cnt] & bit_cnt) |
9950 | 6549 | ||
9951 | ret_data = scxferc(p_port,02); | 6550 | ret_data = FPT_scxferc(p_port,02); |
9952 | 6551 | ||
9953 | else { | 6552 | else { |
9954 | 6553 | ||
9955 | ret_data = scxferc(p_port,01); | 6554 | ret_data = FPT_scxferc(p_port,01); |
9956 | if (ret_data & 02) | 6555 | if (ret_data & 02) |
9957 | defer = TRUE; | 6556 | defer = 1; |
9958 | } | 6557 | } |
9959 | 6558 | ||
9960 | if ((ret_data & 0x1C) == 0x10) | 6559 | if ((ret_data & 0x1C) == 0x10) |
@@ -9980,17 +6579,13 @@ UCHAR scsendi(ULONG p_port, UCHAR p_id_string[]) | |||
9980 | 6579 | ||
9981 | /*--------------------------------------------------------------------- | 6580 | /*--------------------------------------------------------------------- |
9982 | * | 6581 | * |
9983 | * Function: sciso | 6582 | * Function: FPT_sciso |
9984 | * | 6583 | * |
9985 | * Description: Transfer the Identification string. | 6584 | * Description: Transfer the Identification string. |
9986 | * | 6585 | * |
9987 | *---------------------------------------------------------------------*/ | 6586 | *---------------------------------------------------------------------*/ |
9988 | 6587 | ||
9989 | #if defined(DOS) | 6588 | static UCHAR FPT_sciso(ULONG p_port, UCHAR p_id_string[]) |
9990 | UCHAR sciso(USHORT p_port, UCHAR p_id_string[]) | ||
9991 | #else | ||
9992 | UCHAR sciso(ULONG p_port, UCHAR p_id_string[]) | ||
9993 | #endif | ||
9994 | { | 6589 | { |
9995 | UCHAR ret_data,the_data,byte_cnt,bit_cnt; | 6590 | UCHAR ret_data,the_data,byte_cnt,bit_cnt; |
9996 | 6591 | ||
@@ -10000,7 +6595,7 @@ UCHAR sciso(ULONG p_port, UCHAR p_id_string[]) | |||
10000 | 6595 | ||
10001 | for (bit_cnt = 0; bit_cnt < 8; bit_cnt++) { | 6596 | for (bit_cnt = 0; bit_cnt < 8; bit_cnt++) { |
10002 | 6597 | ||
10003 | ret_data = scxferc(p_port,0); | 6598 | ret_data = FPT_scxferc(p_port,0); |
10004 | 6599 | ||
10005 | if (ret_data & 0xFC) | 6600 | if (ret_data & 0xFC) |
10006 | return(0xFF); | 6601 | return(0xFF); |
@@ -10020,8 +6615,8 @@ UCHAR sciso(ULONG p_port, UCHAR p_id_string[]) | |||
10020 | { | 6615 | { |
10021 | byte_cnt = 0; | 6616 | byte_cnt = 0; |
10022 | bit_cnt = 0; | 6617 | bit_cnt = 0; |
10023 | scxferc(p_port, SYNC_PTRN); | 6618 | FPT_scxferc(p_port, SYNC_PTRN); |
10024 | scxferc(p_port, ASSIGN_ID); | 6619 | FPT_scxferc(p_port, ASSIGN_ID); |
10025 | continue; | 6620 | continue; |
10026 | } | 6621 | } |
10027 | */ | 6622 | */ |
@@ -10044,18 +6639,14 @@ UCHAR sciso(ULONG p_port, UCHAR p_id_string[]) | |||
10044 | 6639 | ||
10045 | /*--------------------------------------------------------------------- | 6640 | /*--------------------------------------------------------------------- |
10046 | * | 6641 | * |
10047 | * Function: scwirod | 6642 | * Function: FPT_scwirod |
10048 | * | 6643 | * |
10049 | * Description: Sample the SCSI data bus making sure the signal has been | 6644 | * Description: Sample the SCSI data bus making sure the signal has been |
10050 | * deasserted for the correct number of consecutive samples. | 6645 | * deasserted for the correct number of consecutive samples. |
10051 | * | 6646 | * |
10052 | *---------------------------------------------------------------------*/ | 6647 | *---------------------------------------------------------------------*/ |
10053 | 6648 | ||
10054 | #if defined(DOS) | 6649 | static void FPT_scwirod(ULONG p_port, UCHAR p_data_bit) |
10055 | void scwirod(USHORT p_port, UCHAR p_data_bit) | ||
10056 | #else | ||
10057 | void scwirod(ULONG p_port, UCHAR p_data_bit) | ||
10058 | #endif | ||
10059 | { | 6650 | { |
10060 | UCHAR i; | 6651 | UCHAR i; |
10061 | 6652 | ||
@@ -10077,18 +6668,14 @@ void scwirod(ULONG p_port, UCHAR p_data_bit) | |||
10077 | 6668 | ||
10078 | /*--------------------------------------------------------------------- | 6669 | /*--------------------------------------------------------------------- |
10079 | * | 6670 | * |
10080 | * Function: scwiros | 6671 | * Function: FPT_scwiros |
10081 | * | 6672 | * |
10082 | * Description: Sample the SCSI Signal lines making sure the signal has been | 6673 | * Description: Sample the SCSI Signal lines making sure the signal has been |
10083 | * deasserted for the correct number of consecutive samples. | 6674 | * deasserted for the correct number of consecutive samples. |
10084 | * | 6675 | * |
10085 | *---------------------------------------------------------------------*/ | 6676 | *---------------------------------------------------------------------*/ |
10086 | 6677 | ||
10087 | #if defined(DOS) | 6678 | static void FPT_scwiros(ULONG p_port, UCHAR p_data_bit) |
10088 | void scwiros(USHORT p_port, UCHAR p_data_bit) | ||
10089 | #else | ||
10090 | void scwiros(ULONG p_port, UCHAR p_data_bit) | ||
10091 | #endif | ||
10092 | { | 6679 | { |
10093 | UCHAR i; | 6680 | UCHAR i; |
10094 | 6681 | ||
@@ -10109,13 +6696,13 @@ void scwiros(ULONG p_port, UCHAR p_data_bit) | |||
10109 | 6696 | ||
10110 | /*--------------------------------------------------------------------- | 6697 | /*--------------------------------------------------------------------- |
10111 | * | 6698 | * |
10112 | * Function: scvalq | 6699 | * Function: FPT_scvalq |
10113 | * | 6700 | * |
10114 | * Description: Make sure we received a valid data byte. | 6701 | * Description: Make sure we received a valid data byte. |
10115 | * | 6702 | * |
10116 | *---------------------------------------------------------------------*/ | 6703 | *---------------------------------------------------------------------*/ |
10117 | 6704 | ||
10118 | UCHAR scvalq(UCHAR p_quintet) | 6705 | static UCHAR FPT_scvalq(UCHAR p_quintet) |
10119 | { | 6706 | { |
10120 | UCHAR count; | 6707 | UCHAR count; |
10121 | 6708 | ||
@@ -10125,16 +6712,16 @@ UCHAR scvalq(UCHAR p_quintet) | |||
10125 | } | 6712 | } |
10126 | 6713 | ||
10127 | if (p_quintet & 0x18) | 6714 | if (p_quintet & 0x18) |
10128 | return(FALSE); | 6715 | return(0); |
10129 | 6716 | ||
10130 | else | 6717 | else |
10131 | return(TRUE); | 6718 | return(1); |
10132 | } | 6719 | } |
10133 | 6720 | ||
10134 | 6721 | ||
10135 | /*--------------------------------------------------------------------- | 6722 | /*--------------------------------------------------------------------- |
10136 | * | 6723 | * |
10137 | * Function: scsell | 6724 | * Function: FPT_scsell |
10138 | * | 6725 | * |
10139 | * Description: Select the specified device ID using a selection timeout | 6726 | * Description: Select the specified device ID using a selection timeout |
10140 | * less than 4ms. If somebody responds then it is a legacy | 6727 | * less than 4ms. If somebody responds then it is a legacy |
@@ -10142,17 +6729,9 @@ UCHAR scvalq(UCHAR p_quintet) | |||
10142 | * | 6729 | * |
10143 | *---------------------------------------------------------------------*/ | 6730 | *---------------------------------------------------------------------*/ |
10144 | 6731 | ||
10145 | #if defined(DOS) | 6732 | static UCHAR FPT_scsell(ULONG p_port, UCHAR targ_id) |
10146 | UCHAR scsell(USHORT p_port, UCHAR targ_id) | ||
10147 | #else | ||
10148 | UCHAR scsell(ULONG p_port, UCHAR targ_id) | ||
10149 | #endif | ||
10150 | { | 6733 | { |
10151 | #if defined(DOS) | ||
10152 | USHORT i; | ||
10153 | #else | ||
10154 | ULONG i; | 6734 | ULONG i; |
10155 | #endif | ||
10156 | 6735 | ||
10157 | WR_HARPOON(p_port+hp_page_ctrl, | 6736 | WR_HARPOON(p_port+hp_page_ctrl, |
10158 | (RD_HARPOON(p_port+hp_page_ctrl) | G_INT_DISABLE)); | 6737 | (RD_HARPOON(p_port+hp_page_ctrl) | G_INT_DISABLE)); |
@@ -10182,7 +6761,7 @@ UCHAR scsell(ULONG p_port, UCHAR targ_id) | |||
10182 | (RESET | PROG_HLT | TIMEOUT | AUTO_INT))) {} | 6761 | (RESET | PROG_HLT | TIMEOUT | AUTO_INT))) {} |
10183 | 6762 | ||
10184 | if (RDW_HARPOON((p_port+hp_intstat)) & RESET) | 6763 | if (RDW_HARPOON((p_port+hp_intstat)) & RESET) |
10185 | Wait(p_port, TO_250ms); | 6764 | FPT_Wait(p_port, TO_250ms); |
10186 | 6765 | ||
10187 | DISABLE_AUTO(p_port); | 6766 | DISABLE_AUTO(p_port); |
10188 | 6767 | ||
@@ -10199,7 +6778,7 @@ UCHAR scsell(ULONG p_port, UCHAR targ_id) | |||
10199 | WR_HARPOON(p_port+hp_page_ctrl, | 6778 | WR_HARPOON(p_port+hp_page_ctrl, |
10200 | (RD_HARPOON(p_port+hp_page_ctrl) & ~G_INT_DISABLE)); | 6779 | (RD_HARPOON(p_port+hp_page_ctrl) & ~G_INT_DISABLE)); |
10201 | 6780 | ||
10202 | return(FALSE); /*No legacy device */ | 6781 | return(0); /*No legacy device */ |
10203 | } | 6782 | } |
10204 | 6783 | ||
10205 | else { | 6784 | else { |
@@ -10217,108 +6796,19 @@ UCHAR scsell(ULONG p_port, UCHAR targ_id) | |||
10217 | WR_HARPOON(p_port+hp_page_ctrl, | 6796 | WR_HARPOON(p_port+hp_page_ctrl, |
10218 | (RD_HARPOON(p_port+hp_page_ctrl) & ~G_INT_DISABLE)); | 6797 | (RD_HARPOON(p_port+hp_page_ctrl) & ~G_INT_DISABLE)); |
10219 | 6798 | ||
10220 | return(TRUE); /*Found one of them oldies! */ | 6799 | return(1); /*Found one of them oldies! */ |
10221 | } | 6800 | } |
10222 | } | 6801 | } |
10223 | 6802 | ||
10224 | #if defined(DOS) | ||
10225 | /*--------------------------------------------------------------------- | 6803 | /*--------------------------------------------------------------------- |
10226 | * | 6804 | * |
10227 | * Function: scsell for DOS | 6805 | * Function: FPT_scwtsel |
10228 | * | ||
10229 | * Description: Select the specified device ID using a selection timeout | ||
10230 | * less than 2ms. This was specially required to solve | ||
10231 | * the problem with Plextor 12X CD-ROM drive. This drive | ||
10232 | * was responding the Selection at the end of 4ms and | ||
10233 | * hanging the system. | ||
10234 | * | ||
10235 | *---------------------------------------------------------------------*/ | ||
10236 | |||
10237 | UCHAR scsellDOS(USHORT p_port, UCHAR targ_id) | ||
10238 | { | ||
10239 | USHORT i; | ||
10240 | |||
10241 | WR_HARPOON(p_port+hp_page_ctrl, | ||
10242 | (RD_HARPOON(p_port+hp_page_ctrl) | G_INT_DISABLE)); | ||
10243 | |||
10244 | ARAM_ACCESS(p_port); | ||
10245 | |||
10246 | WR_HARPOON(p_port+hp_addstat,(RD_HARPOON(p_port+hp_addstat) | SCAM_TIMER)); | ||
10247 | WR_HARPOON(p_port+hp_seltimeout,TO_2ms); | ||
10248 | |||
10249 | |||
10250 | for (i = p_port+CMD_STRT; i < p_port+CMD_STRT+12; i+=2) { | ||
10251 | WRW_HARPOON(i, (MPM_OP+ACOMMAND)); | ||
10252 | } | ||
10253 | WRW_HARPOON(i, (BRH_OP+ALWAYS+ NP)); | ||
10254 | |||
10255 | WRW_HARPOON((p_port+hp_intstat), | ||
10256 | (RESET | TIMEOUT | SEL | BUS_FREE | AUTO_INT)); | ||
10257 | |||
10258 | WR_HARPOON(p_port+hp_select_id, targ_id); | ||
10259 | |||
10260 | WR_HARPOON(p_port+hp_portctrl_0, SCSI_PORT); | ||
10261 | WR_HARPOON(p_port+hp_autostart_3, (SELECT | CMD_ONLY_STRT)); | ||
10262 | WR_HARPOON(p_port+hp_scsictrl_0, (SEL_TAR | ENA_RESEL)); | ||
10263 | |||
10264 | |||
10265 | while (!(RDW_HARPOON((p_port+hp_intstat)) & | ||
10266 | (RESET | PROG_HLT | TIMEOUT | AUTO_INT))) {} | ||
10267 | |||
10268 | if (RDW_HARPOON((p_port+hp_intstat)) & RESET) | ||
10269 | Wait(p_port, TO_250ms); | ||
10270 | |||
10271 | DISABLE_AUTO(p_port); | ||
10272 | |||
10273 | WR_HARPOON(p_port+hp_addstat,(RD_HARPOON(p_port+hp_addstat) & ~SCAM_TIMER)); | ||
10274 | WR_HARPOON(p_port+hp_seltimeout,TO_290ms); | ||
10275 | |||
10276 | SGRAM_ACCESS(p_port); | ||
10277 | |||
10278 | if (RDW_HARPOON((p_port+hp_intstat)) & (RESET | TIMEOUT) ) { | ||
10279 | |||
10280 | WRW_HARPOON((p_port+hp_intstat), | ||
10281 | (RESET | TIMEOUT | SEL | BUS_FREE | PHASE)); | ||
10282 | |||
10283 | WR_HARPOON(p_port+hp_page_ctrl, | ||
10284 | (RD_HARPOON(p_port+hp_page_ctrl) & ~G_INT_DISABLE)); | ||
10285 | |||
10286 | return(FALSE); /*No legacy device */ | ||
10287 | } | ||
10288 | |||
10289 | else { | ||
10290 | |||
10291 | while(!(RDW_HARPOON((p_port+hp_intstat)) & BUS_FREE)) { | ||
10292 | if (RD_HARPOON(p_port+hp_scsisig) & SCSI_REQ) | ||
10293 | { | ||
10294 | WR_HARPOON(p_port+hp_scsisig, (SCSI_ACK + S_ILL_PH)); | ||
10295 | ACCEPT_MSG(p_port); | ||
10296 | } | ||
10297 | } | ||
10298 | |||
10299 | WRW_HARPOON((p_port+hp_intstat), CLR_ALL_INT_1); | ||
10300 | |||
10301 | WR_HARPOON(p_port+hp_page_ctrl, | ||
10302 | (RD_HARPOON(p_port+hp_page_ctrl) & ~G_INT_DISABLE)); | ||
10303 | |||
10304 | return(TRUE); /*Found one of them oldies! */ | ||
10305 | } | ||
10306 | } | ||
10307 | #endif /* DOS */ | ||
10308 | |||
10309 | /*--------------------------------------------------------------------- | ||
10310 | * | ||
10311 | * Function: scwtsel | ||
10312 | * | 6806 | * |
10313 | * Description: Wait to be selected by another SCAM initiator. | 6807 | * Description: Wait to be selected by another SCAM initiator. |
10314 | * | 6808 | * |
10315 | *---------------------------------------------------------------------*/ | 6809 | *---------------------------------------------------------------------*/ |
10316 | 6810 | ||
10317 | #if defined(DOS) | 6811 | static void FPT_scwtsel(ULONG p_port) |
10318 | void scwtsel(USHORT p_port) | ||
10319 | #else | ||
10320 | void scwtsel(ULONG p_port) | ||
10321 | #endif | ||
10322 | { | 6812 | { |
10323 | while(!(RDW_HARPOON((p_port+hp_intstat)) & SCAM_SEL)) {} | 6813 | while(!(RDW_HARPOON((p_port+hp_intstat)) & SCAM_SEL)) {} |
10324 | } | 6814 | } |
@@ -10326,23 +6816,19 @@ void scwtsel(ULONG p_port) | |||
10326 | 6816 | ||
10327 | /*--------------------------------------------------------------------- | 6817 | /*--------------------------------------------------------------------- |
10328 | * | 6818 | * |
10329 | * Function: inisci | 6819 | * Function: FPT_inisci |
10330 | * | 6820 | * |
10331 | * Description: Setup the data Structure with the info from the EEPROM. | 6821 | * Description: Setup the data Structure with the info from the EEPROM. |
10332 | * | 6822 | * |
10333 | *---------------------------------------------------------------------*/ | 6823 | *---------------------------------------------------------------------*/ |
10334 | 6824 | ||
10335 | #if defined(DOS) | 6825 | static void FPT_inisci(UCHAR p_card, ULONG p_port, UCHAR p_our_id) |
10336 | void inisci(UCHAR p_card, USHORT p_port, UCHAR p_our_id) | ||
10337 | #else | ||
10338 | void inisci(UCHAR p_card, ULONG p_port, UCHAR p_our_id) | ||
10339 | #endif | ||
10340 | { | 6826 | { |
10341 | UCHAR i,k,max_id; | 6827 | UCHAR i,k,max_id; |
10342 | USHORT ee_data; | 6828 | USHORT ee_data; |
10343 | PNVRamInfo pCurrNvRam; | 6829 | PNVRamInfo pCurrNvRam; |
10344 | 6830 | ||
10345 | pCurrNvRam = BL_Card[p_card].pNvRamInfo; | 6831 | pCurrNvRam = FPT_BL_Card[p_card].pNvRamInfo; |
10346 | 6832 | ||
10347 | if (RD_HARPOON(p_port+hp_page_ctrl) & NARROW_SCSI_CARD) | 6833 | if (RD_HARPOON(p_port+hp_page_ctrl) & NARROW_SCSI_CARD) |
10348 | max_id = 0x08; | 6834 | max_id = 0x08; |
@@ -10354,14 +6840,14 @@ void inisci(UCHAR p_card, ULONG p_port, UCHAR p_our_id) | |||
10354 | for(i = 0; i < max_id; i++){ | 6840 | for(i = 0; i < max_id; i++){ |
10355 | 6841 | ||
10356 | for(k = 0; k < 4; k++) | 6842 | for(k = 0; k < 4; k++) |
10357 | scamInfo[i].id_string[k] = pCurrNvRam->niScamTbl[i][k]; | 6843 | FPT_scamInfo[i].id_string[k] = pCurrNvRam->niScamTbl[i][k]; |
10358 | for(k = 4; k < ID_STRING_LENGTH; k++) | 6844 | for(k = 4; k < ID_STRING_LENGTH; k++) |
10359 | scamInfo[i].id_string[k] = (UCHAR) 0x00; | 6845 | FPT_scamInfo[i].id_string[k] = (UCHAR) 0x00; |
10360 | 6846 | ||
10361 | if(scamInfo[i].id_string[0] == 0x00) | 6847 | if(FPT_scamInfo[i].id_string[0] == 0x00) |
10362 | scamInfo[i].state = ID_UNUSED; /*Default to unused ID. */ | 6848 | FPT_scamInfo[i].state = ID_UNUSED; /*Default to unused ID. */ |
10363 | else | 6849 | else |
10364 | scamInfo[i].state = ID_UNASSIGNED; /*Default to unassigned ID. */ | 6850 | FPT_scamInfo[i].state = ID_UNASSIGNED; /*Default to unassigned ID. */ |
10365 | 6851 | ||
10366 | } | 6852 | } |
10367 | }else { | 6853 | }else { |
@@ -10369,38 +6855,38 @@ void inisci(UCHAR p_card, ULONG p_port, UCHAR p_our_id) | |||
10369 | { | 6855 | { |
10370 | for (k=0; k < ID_STRING_LENGTH; k+=2) | 6856 | for (k=0; k < ID_STRING_LENGTH; k+=2) |
10371 | { | 6857 | { |
10372 | ee_data = utilEERead(p_port, (USHORT)((EE_SCAMBASE/2) + | 6858 | ee_data = FPT_utilEERead(p_port, (USHORT)((EE_SCAMBASE/2) + |
10373 | (USHORT) (i*((USHORT)ID_STRING_LENGTH/2)) + (USHORT)(k/2))); | 6859 | (USHORT) (i*((USHORT)ID_STRING_LENGTH/2)) + (USHORT)(k/2))); |
10374 | scamInfo[i].id_string[k] = (UCHAR) ee_data; | 6860 | FPT_scamInfo[i].id_string[k] = (UCHAR) ee_data; |
10375 | ee_data >>= 8; | 6861 | ee_data >>= 8; |
10376 | scamInfo[i].id_string[k+1] = (UCHAR) ee_data; | 6862 | FPT_scamInfo[i].id_string[k+1] = (UCHAR) ee_data; |
10377 | } | 6863 | } |
10378 | 6864 | ||
10379 | if ((scamInfo[i].id_string[0] == 0x00) || | 6865 | if ((FPT_scamInfo[i].id_string[0] == 0x00) || |
10380 | (scamInfo[i].id_string[0] == 0xFF)) | 6866 | (FPT_scamInfo[i].id_string[0] == 0xFF)) |
10381 | 6867 | ||
10382 | scamInfo[i].state = ID_UNUSED; /*Default to unused ID. */ | 6868 | FPT_scamInfo[i].state = ID_UNUSED; /*Default to unused ID. */ |
10383 | 6869 | ||
10384 | else | 6870 | else |
10385 | scamInfo[i].state = ID_UNASSIGNED; /*Default to unassigned ID. */ | 6871 | FPT_scamInfo[i].state = ID_UNASSIGNED; /*Default to unassigned ID. */ |
10386 | 6872 | ||
10387 | } | 6873 | } |
10388 | } | 6874 | } |
10389 | for(k = 0; k < ID_STRING_LENGTH; k++) | 6875 | for(k = 0; k < ID_STRING_LENGTH; k++) |
10390 | scamInfo[p_our_id].id_string[k] = scamHAString[k]; | 6876 | FPT_scamInfo[p_our_id].id_string[k] = FPT_scamHAString[k]; |
10391 | 6877 | ||
10392 | } | 6878 | } |
10393 | 6879 | ||
10394 | /*--------------------------------------------------------------------- | 6880 | /*--------------------------------------------------------------------- |
10395 | * | 6881 | * |
10396 | * Function: scmachid | 6882 | * Function: FPT_scmachid |
10397 | * | 6883 | * |
10398 | * Description: Match the Device ID string with our values stored in | 6884 | * Description: Match the Device ID string with our values stored in |
10399 | * the EEPROM. | 6885 | * the EEPROM. |
10400 | * | 6886 | * |
10401 | *---------------------------------------------------------------------*/ | 6887 | *---------------------------------------------------------------------*/ |
10402 | 6888 | ||
10403 | UCHAR scmachid(UCHAR p_card, UCHAR p_id_string[]) | 6889 | static UCHAR FPT_scmachid(UCHAR p_card, UCHAR p_id_string[]) |
10404 | { | 6890 | { |
10405 | 6891 | ||
10406 | UCHAR i,k,match; | 6892 | UCHAR i,k,match; |
@@ -10408,28 +6894,20 @@ UCHAR scmachid(UCHAR p_card, UCHAR p_id_string[]) | |||
10408 | 6894 | ||
10409 | for (i=0; i < MAX_SCSI_TAR; i++) { | 6895 | for (i=0; i < MAX_SCSI_TAR; i++) { |
10410 | 6896 | ||
10411 | #if !defined(SCAM_LEV_2) | 6897 | match = 1; |
10412 | if (scamInfo[i].state == ID_UNASSIGNED) | ||
10413 | { | ||
10414 | #endif | ||
10415 | match = TRUE; | ||
10416 | 6898 | ||
10417 | for (k=0; k < ID_STRING_LENGTH; k++) | 6899 | for (k=0; k < ID_STRING_LENGTH; k++) |
10418 | { | 6900 | { |
10419 | if (p_id_string[k] != scamInfo[i].id_string[k]) | 6901 | if (p_id_string[k] != FPT_scamInfo[i].id_string[k]) |
10420 | match = FALSE; | 6902 | match = 0; |
10421 | } | 6903 | } |
10422 | 6904 | ||
10423 | if (match) | 6905 | if (match) |
10424 | { | 6906 | { |
10425 | scamInfo[i].state = ID_ASSIGNED; | 6907 | FPT_scamInfo[i].state = ID_ASSIGNED; |
10426 | return(i); | 6908 | return(i); |
10427 | } | 6909 | } |
10428 | 6910 | ||
10429 | #if !defined(SCAM_LEV_2) | ||
10430 | } | ||
10431 | #endif | ||
10432 | |||
10433 | } | 6911 | } |
10434 | 6912 | ||
10435 | 6913 | ||
@@ -10448,17 +6926,17 @@ UCHAR scmachid(UCHAR p_card, UCHAR p_id_string[]) | |||
10448 | { | 6926 | { |
10449 | i--; | 6927 | i--; |
10450 | 6928 | ||
10451 | if (scamInfo[match].state == ID_UNUSED) | 6929 | if (FPT_scamInfo[match].state == ID_UNUSED) |
10452 | { | 6930 | { |
10453 | for (k=0; k < ID_STRING_LENGTH; k++) | 6931 | for (k=0; k < ID_STRING_LENGTH; k++) |
10454 | { | 6932 | { |
10455 | scamInfo[match].id_string[k] = p_id_string[k]; | 6933 | FPT_scamInfo[match].id_string[k] = p_id_string[k]; |
10456 | } | 6934 | } |
10457 | 6935 | ||
10458 | scamInfo[match].state = ID_ASSIGNED; | 6936 | FPT_scamInfo[match].state = ID_ASSIGNED; |
10459 | 6937 | ||
10460 | if(BL_Card[p_card].pNvRamInfo == NULL) | 6938 | if(FPT_BL_Card[p_card].pNvRamInfo == NULL) |
10461 | BL_Card[p_card].globalFlags |= F_UPDATE_EEPROM; | 6939 | FPT_BL_Card[p_card].globalFlags |= F_UPDATE_EEPROM; |
10462 | return(match); | 6940 | return(match); |
10463 | 6941 | ||
10464 | } | 6942 | } |
@@ -10498,17 +6976,17 @@ UCHAR scmachid(UCHAR p_card, UCHAR p_id_string[]) | |||
10498 | 6976 | ||
10499 | i--; | 6977 | i--; |
10500 | 6978 | ||
10501 | if (scamInfo[match].state == ID_UNASSIGNED) | 6979 | if (FPT_scamInfo[match].state == ID_UNASSIGNED) |
10502 | { | 6980 | { |
10503 | for (k=0; k < ID_STRING_LENGTH; k++) | 6981 | for (k=0; k < ID_STRING_LENGTH; k++) |
10504 | { | 6982 | { |
10505 | scamInfo[match].id_string[k] = p_id_string[k]; | 6983 | FPT_scamInfo[match].id_string[k] = p_id_string[k]; |
10506 | } | 6984 | } |
10507 | 6985 | ||
10508 | scamInfo[match].id_string[0] |= BIT(7); | 6986 | FPT_scamInfo[match].id_string[0] |= BIT(7); |
10509 | scamInfo[match].state = ID_ASSIGNED; | 6987 | FPT_scamInfo[match].state = ID_ASSIGNED; |
10510 | if(BL_Card[p_card].pNvRamInfo == NULL) | 6988 | if(FPT_BL_Card[p_card].pNvRamInfo == NULL) |
10511 | BL_Card[p_card].globalFlags |= F_UPDATE_EEPROM; | 6989 | FPT_BL_Card[p_card].globalFlags |= F_UPDATE_EEPROM; |
10512 | return(match); | 6990 | return(match); |
10513 | 6991 | ||
10514 | } | 6992 | } |
@@ -10531,17 +7009,13 @@ UCHAR scmachid(UCHAR p_card, UCHAR p_id_string[]) | |||
10531 | 7009 | ||
10532 | /*--------------------------------------------------------------------- | 7010 | /*--------------------------------------------------------------------- |
10533 | * | 7011 | * |
10534 | * Function: scsavdi | 7012 | * Function: FPT_scsavdi |
10535 | * | 7013 | * |
10536 | * Description: Save off the device SCAM ID strings. | 7014 | * Description: Save off the device SCAM ID strings. |
10537 | * | 7015 | * |
10538 | *---------------------------------------------------------------------*/ | 7016 | *---------------------------------------------------------------------*/ |
10539 | 7017 | ||
10540 | #if defined(DOS) | 7018 | static void FPT_scsavdi(UCHAR p_card, ULONG p_port) |
10541 | void scsavdi(UCHAR p_card, USHORT p_port) | ||
10542 | #else | ||
10543 | void scsavdi(UCHAR p_card, ULONG p_port) | ||
10544 | #endif | ||
10545 | { | 7019 | { |
10546 | UCHAR i,k,max_id; | 7020 | UCHAR i,k,max_id; |
10547 | USHORT ee_data,sum_data; | 7021 | USHORT ee_data,sum_data; |
@@ -10551,11 +7025,11 @@ void scsavdi(UCHAR p_card, ULONG p_port) | |||
10551 | 7025 | ||
10552 | for (i = 1; i < EE_SCAMBASE/2; i++) | 7026 | for (i = 1; i < EE_SCAMBASE/2; i++) |
10553 | { | 7027 | { |
10554 | sum_data += utilEERead(p_port, i); | 7028 | sum_data += FPT_utilEERead(p_port, i); |
10555 | } | 7029 | } |
10556 | 7030 | ||
10557 | 7031 | ||
10558 | utilEEWriteOnOff(p_port,1); /* Enable write access to the EEPROM */ | 7032 | FPT_utilEEWriteOnOff(p_port,1); /* Enable write access to the EEPROM */ |
10559 | 7033 | ||
10560 | if (RD_HARPOON(p_port+hp_page_ctrl) & NARROW_SCSI_CARD) | 7034 | if (RD_HARPOON(p_port+hp_page_ctrl) & NARROW_SCSI_CARD) |
10561 | max_id = 0x08; | 7035 | max_id = 0x08; |
@@ -10568,64 +7042,29 @@ void scsavdi(UCHAR p_card, ULONG p_port) | |||
10568 | 7042 | ||
10569 | for (k=0; k < ID_STRING_LENGTH; k+=2) | 7043 | for (k=0; k < ID_STRING_LENGTH; k+=2) |
10570 | { | 7044 | { |
10571 | ee_data = scamInfo[i].id_string[k+1]; | 7045 | ee_data = FPT_scamInfo[i].id_string[k+1]; |
10572 | ee_data <<= 8; | 7046 | ee_data <<= 8; |
10573 | ee_data |= scamInfo[i].id_string[k]; | 7047 | ee_data |= FPT_scamInfo[i].id_string[k]; |
10574 | sum_data += ee_data; | 7048 | sum_data += ee_data; |
10575 | utilEEWrite(p_port, ee_data, (USHORT)((EE_SCAMBASE/2) + | 7049 | FPT_utilEEWrite(p_port, ee_data, (USHORT)((EE_SCAMBASE/2) + |
10576 | (USHORT)(i*((USHORT)ID_STRING_LENGTH/2)) + (USHORT)(k/2))); | 7050 | (USHORT)(i*((USHORT)ID_STRING_LENGTH/2)) + (USHORT)(k/2))); |
10577 | } | 7051 | } |
10578 | } | 7052 | } |
10579 | 7053 | ||
10580 | 7054 | ||
10581 | utilEEWrite(p_port, sum_data, EEPROM_CHECK_SUM/2); | 7055 | FPT_utilEEWrite(p_port, sum_data, EEPROM_CHECK_SUM/2); |
10582 | utilEEWriteOnOff(p_port,0); /* Turn off write access */ | 7056 | FPT_utilEEWriteOnOff(p_port,0); /* Turn off write access */ |
10583 | } | 7057 | } |
10584 | #ident "$Id: diagnose.c 1.10 1997/06/10 16:51:47 mohan Exp $" | ||
10585 | /*---------------------------------------------------------------------- | ||
10586 | * | ||
10587 | * | ||
10588 | * Copyright 1995-1996 by Mylex Corporation. All Rights Reserved | ||
10589 | * | ||
10590 | * This file is available under both the GNU General Public License | ||
10591 | * and a BSD-style copyright; see LICENSE.FlashPoint for details. | ||
10592 | * | ||
10593 | * $Workfile: diagnose.c $ | ||
10594 | * | ||
10595 | * Description: Diagnostic funtions for testing the integrity of | ||
10596 | * the HARPOON. | ||
10597 | * | ||
10598 | * $Date: 1997/06/10 16:51:47 $ | ||
10599 | * | ||
10600 | * $Revision: 1.10 $ | ||
10601 | * | ||
10602 | *----------------------------------------------------------------------*/ | ||
10603 | |||
10604 | /*#include <globals.h>*/ | ||
10605 | |||
10606 | #if (FW_TYPE==_UCB_MGR_) | ||
10607 | /*#include <budi.h>*/ | ||
10608 | #endif | ||
10609 | |||
10610 | /*#include <sccbmgr.h>*/ | ||
10611 | /*#include <blx30.h>*/ | ||
10612 | /*#include <target.h>*/ | ||
10613 | /*#include <eeprom.h>*/ | ||
10614 | /*#include <harpoon.h>*/ | ||
10615 | 7058 | ||
10616 | /*--------------------------------------------------------------------- | 7059 | /*--------------------------------------------------------------------- |
10617 | * | 7060 | * |
10618 | * Function: XbowInit | 7061 | * Function: FPT_XbowInit |
10619 | * | 7062 | * |
10620 | * Description: Setup the Xbow for normal operation. | 7063 | * Description: Setup the Xbow for normal operation. |
10621 | * | 7064 | * |
10622 | *---------------------------------------------------------------------*/ | 7065 | *---------------------------------------------------------------------*/ |
10623 | 7066 | ||
10624 | #if defined(DOS) | 7067 | static void FPT_XbowInit(ULONG port, UCHAR ScamFlg) |
10625 | void XbowInit(USHORT port, UCHAR ScamFlg) | ||
10626 | #else | ||
10627 | void XbowInit(ULONG port, UCHAR ScamFlg) | ||
10628 | #endif | ||
10629 | { | 7068 | { |
10630 | UCHAR i; | 7069 | UCHAR i; |
10631 | 7070 | ||
@@ -10647,18 +7086,13 @@ UCHAR i; | |||
10647 | 7086 | ||
10648 | WRW_HARPOON((port+hp_intstat), CLR_ALL_INT); | 7087 | WRW_HARPOON((port+hp_intstat), CLR_ALL_INT); |
10649 | 7088 | ||
10650 | #if defined(SCAM_LEV_2) | 7089 | FPT_default_intena = RESET | RSEL | PROG_HLT | TIMEOUT | |
10651 | default_intena = RESET | RSEL | PROG_HLT | TIMEOUT | | ||
10652 | BUS_FREE | XFER_CNT_0 | AUTO_INT; | 7090 | BUS_FREE | XFER_CNT_0 | AUTO_INT; |
10653 | 7091 | ||
10654 | if ((ScamFlg & SCAM_ENABLED) && (ScamFlg & SCAM_LEVEL2)) | 7092 | if ((ScamFlg & SCAM_ENABLED) && (ScamFlg & SCAM_LEVEL2)) |
10655 | default_intena |= SCAM_SEL; | 7093 | FPT_default_intena |= SCAM_SEL; |
10656 | 7094 | ||
10657 | #else | 7095 | WRW_HARPOON((port+hp_intena), FPT_default_intena); |
10658 | default_intena = RESET | RSEL | PROG_HLT | TIMEOUT | | ||
10659 | BUS_FREE | XFER_CNT_0 | AUTO_INT; | ||
10660 | #endif | ||
10661 | WRW_HARPOON((port+hp_intena), default_intena); | ||
10662 | 7096 | ||
10663 | WR_HARPOON(port+hp_seltimeout,TO_290ms); | 7097 | WR_HARPOON(port+hp_seltimeout,TO_290ms); |
10664 | 7098 | ||
@@ -10667,26 +7101,6 @@ UCHAR i; | |||
10667 | if (RD_HARPOON(port+hp_page_ctrl) & NARROW_SCSI_CARD) | 7101 | if (RD_HARPOON(port+hp_page_ctrl) & NARROW_SCSI_CARD) |
10668 | WR_HARPOON(port+hp_addstat,SCSI_MODE8); | 7102 | WR_HARPOON(port+hp_addstat,SCSI_MODE8); |
10669 | 7103 | ||
10670 | #if defined(NO_BIOS_OPTION) | ||
10671 | |||
10672 | WR_HARPOON(port+hp_synctarg_0,NARROW_SCSI); | ||
10673 | WR_HARPOON(port+hp_synctarg_1,NARROW_SCSI); | ||
10674 | WR_HARPOON(port+hp_synctarg_2,NARROW_SCSI); | ||
10675 | WR_HARPOON(port+hp_synctarg_3,NARROW_SCSI); | ||
10676 | WR_HARPOON(port+hp_synctarg_4,NARROW_SCSI); | ||
10677 | WR_HARPOON(port+hp_synctarg_5,NARROW_SCSI); | ||
10678 | WR_HARPOON(port+hp_synctarg_6,NARROW_SCSI); | ||
10679 | WR_HARPOON(port+hp_synctarg_7,NARROW_SCSI); | ||
10680 | WR_HARPOON(port+hp_synctarg_8,NARROW_SCSI); | ||
10681 | WR_HARPOON(port+hp_synctarg_9,NARROW_SCSI); | ||
10682 | WR_HARPOON(port+hp_synctarg_10,NARROW_SCSI); | ||
10683 | WR_HARPOON(port+hp_synctarg_11,NARROW_SCSI); | ||
10684 | WR_HARPOON(port+hp_synctarg_12,NARROW_SCSI); | ||
10685 | WR_HARPOON(port+hp_synctarg_13,NARROW_SCSI); | ||
10686 | WR_HARPOON(port+hp_synctarg_14,NARROW_SCSI); | ||
10687 | WR_HARPOON(port+hp_synctarg_15,NARROW_SCSI); | ||
10688 | |||
10689 | #endif | ||
10690 | WR_HARPOON(port+hp_page_ctrl, i); | 7104 | WR_HARPOON(port+hp_page_ctrl, i); |
10691 | 7105 | ||
10692 | } | 7106 | } |
@@ -10694,17 +7108,13 @@ UCHAR i; | |||
10694 | 7108 | ||
10695 | /*--------------------------------------------------------------------- | 7109 | /*--------------------------------------------------------------------- |
10696 | * | 7110 | * |
10697 | * Function: BusMasterInit | 7111 | * Function: FPT_BusMasterInit |
10698 | * | 7112 | * |
10699 | * Description: Initialize the BusMaster for normal operations. | 7113 | * Description: Initialize the BusMaster for normal operations. |
10700 | * | 7114 | * |
10701 | *---------------------------------------------------------------------*/ | 7115 | *---------------------------------------------------------------------*/ |
10702 | 7116 | ||
10703 | #if defined(DOS) | 7117 | static void FPT_BusMasterInit(ULONG p_port) |
10704 | void BusMasterInit(USHORT p_port) | ||
10705 | #else | ||
10706 | void BusMasterInit(ULONG p_port) | ||
10707 | #endif | ||
10708 | { | 7118 | { |
10709 | 7119 | ||
10710 | 7120 | ||
@@ -10719,13 +7129,6 @@ void BusMasterInit(ULONG p_port) | |||
10719 | WR_HARPOON(p_port+hp_ee_ctrl, (SCSI_TERM_ENA_H)); | 7129 | WR_HARPOON(p_port+hp_ee_ctrl, (SCSI_TERM_ENA_H)); |
10720 | 7130 | ||
10721 | 7131 | ||
10722 | #if defined(NT) | ||
10723 | |||
10724 | WR_HARPOON(p_port+hp_pci_cmd_cfg, (RD_HARPOON(p_port+hp_pci_cmd_cfg) | ||
10725 | & ~MEM_SPACE_ENA)); | ||
10726 | |||
10727 | #endif | ||
10728 | |||
10729 | RD_HARPOON(p_port+hp_int_status); /*Clear interrupts. */ | 7132 | RD_HARPOON(p_port+hp_int_status); /*Clear interrupts. */ |
10730 | WR_HARPOON(p_port+hp_int_mask, (INT_CMD_COMPL | SCSI_INTERRUPT)); | 7133 | WR_HARPOON(p_port+hp_int_mask, (INT_CMD_COMPL | SCSI_INTERRUPT)); |
10731 | WR_HARPOON(p_port+hp_page_ctrl, (RD_HARPOON(p_port+hp_page_ctrl) & | 7134 | WR_HARPOON(p_port+hp_page_ctrl, (RD_HARPOON(p_port+hp_page_ctrl) & |
@@ -10735,147 +7138,14 @@ void BusMasterInit(ULONG p_port) | |||
10735 | 7138 | ||
10736 | /*--------------------------------------------------------------------- | 7139 | /*--------------------------------------------------------------------- |
10737 | * | 7140 | * |
10738 | * Function: DiagXbow | 7141 | * Function: FPT_DiagEEPROM |
10739 | * | ||
10740 | * Description: Test Xbow integrity. Non-zero return indicates an error. | ||
10741 | * | ||
10742 | *---------------------------------------------------------------------*/ | ||
10743 | |||
10744 | #if defined(DOS) | ||
10745 | int DiagXbow(USHORT port) | ||
10746 | #else | ||
10747 | int DiagXbow(ULONG port) | ||
10748 | #endif | ||
10749 | { | ||
10750 | unsigned char fifo_cnt,loop_cnt; | ||
10751 | |||
10752 | unsigned char fifodata[5]; | ||
10753 | fifodata[0] = 0x00; | ||
10754 | fifodata[1] = 0xFF; | ||
10755 | fifodata[2] = 0x55; | ||
10756 | fifodata[3] = 0xAA; | ||
10757 | fifodata[4] = 0x00; | ||
10758 | |||
10759 | |||
10760 | WRW_HARPOON((port+hp_intstat), CLR_ALL_INT); | ||
10761 | WRW_HARPOON((port+hp_intena), 0x0000); | ||
10762 | |||
10763 | WR_HARPOON(port+hp_seltimeout,TO_5ms); | ||
10764 | |||
10765 | WR_HARPOON(port+hp_portctrl_0,START_TO); | ||
10766 | |||
10767 | |||
10768 | for(fifodata[4] = 0x01; fifodata[4] != (UCHAR) 0; fifodata[4] = fifodata[4] << 1) { | ||
10769 | |||
10770 | WR_HARPOON(port+hp_selfid_0,fifodata[4]); | ||
10771 | WR_HARPOON(port+hp_selfid_1,fifodata[4]); | ||
10772 | |||
10773 | if ((RD_HARPOON(port+hp_selfid_0) != fifodata[4]) || | ||
10774 | (RD_HARPOON(port+hp_selfid_1) != fifodata[4])) | ||
10775 | return(1); | ||
10776 | } | ||
10777 | |||
10778 | |||
10779 | for(loop_cnt = 0; loop_cnt < 4; loop_cnt++) { | ||
10780 | |||
10781 | WR_HARPOON(port+hp_portctrl_0,(HOST_PORT | HOST_WRT | START_TO)); | ||
10782 | |||
10783 | |||
10784 | for (fifo_cnt = 0; fifo_cnt < FIFO_LEN; fifo_cnt++) { | ||
10785 | |||
10786 | WR_HARPOON(port+hp_fifodata_0, fifodata[loop_cnt]); | ||
10787 | } | ||
10788 | |||
10789 | |||
10790 | if (!(RD_HARPOON(port+hp_xferstat) & FIFO_FULL)) | ||
10791 | return(1); | ||
10792 | |||
10793 | |||
10794 | WR_HARPOON(port+hp_portctrl_0,(HOST_PORT | START_TO)); | ||
10795 | |||
10796 | for (fifo_cnt = 0; fifo_cnt < FIFO_LEN; fifo_cnt++) { | ||
10797 | |||
10798 | if (RD_HARPOON(port+hp_fifodata_0) != fifodata[loop_cnt]) | ||
10799 | return(1); | ||
10800 | } | ||
10801 | |||
10802 | |||
10803 | if (!(RD_HARPOON(port+hp_xferstat) & FIFO_EMPTY)) | ||
10804 | return(1); | ||
10805 | } | ||
10806 | |||
10807 | |||
10808 | while(!(RDW_HARPOON((port+hp_intstat)) & TIMEOUT)) {} | ||
10809 | |||
10810 | |||
10811 | WR_HARPOON(port+hp_seltimeout,TO_290ms); | ||
10812 | |||
10813 | WRW_HARPOON((port+hp_intstat), CLR_ALL_INT); | ||
10814 | |||
10815 | WRW_HARPOON((port+hp_intena), default_intena); | ||
10816 | |||
10817 | return(0); | ||
10818 | } | ||
10819 | |||
10820 | |||
10821 | /*--------------------------------------------------------------------- | ||
10822 | * | ||
10823 | * Function: DiagBusMaster | ||
10824 | * | ||
10825 | * Description: Test BusMaster integrity. Non-zero return indicates an | ||
10826 | * error. | ||
10827 | * | ||
10828 | *---------------------------------------------------------------------*/ | ||
10829 | |||
10830 | #if defined(DOS) | ||
10831 | int DiagBusMaster(USHORT port) | ||
10832 | #else | ||
10833 | int DiagBusMaster(ULONG port) | ||
10834 | #endif | ||
10835 | { | ||
10836 | UCHAR testdata; | ||
10837 | |||
10838 | for(testdata = (UCHAR) 1; testdata != (UCHAR)0; testdata = testdata << 1) { | ||
10839 | |||
10840 | WR_HARPOON(port+hp_xfer_cnt_lo,testdata); | ||
10841 | WR_HARPOON(port+hp_xfer_cnt_mi,testdata); | ||
10842 | WR_HARPOON(port+hp_xfer_cnt_hi,testdata); | ||
10843 | WR_HARPOON(port+hp_host_addr_lo,testdata); | ||
10844 | WR_HARPOON(port+hp_host_addr_lmi,testdata); | ||
10845 | WR_HARPOON(port+hp_host_addr_hmi,testdata); | ||
10846 | WR_HARPOON(port+hp_host_addr_hi,testdata); | ||
10847 | |||
10848 | if ((RD_HARPOON(port+hp_xfer_cnt_lo) != testdata) || | ||
10849 | (RD_HARPOON(port+hp_xfer_cnt_mi) != testdata) || | ||
10850 | (RD_HARPOON(port+hp_xfer_cnt_hi) != testdata) || | ||
10851 | (RD_HARPOON(port+hp_host_addr_lo) != testdata) || | ||
10852 | (RD_HARPOON(port+hp_host_addr_lmi) != testdata) || | ||
10853 | (RD_HARPOON(port+hp_host_addr_hmi) != testdata) || | ||
10854 | (RD_HARPOON(port+hp_host_addr_hi) != testdata)) | ||
10855 | |||
10856 | return(1); | ||
10857 | } | ||
10858 | RD_HARPOON(port+hp_int_status); /*Clear interrupts. */ | ||
10859 | return(0); | ||
10860 | } | ||
10861 | |||
10862 | |||
10863 | |||
10864 | /*--------------------------------------------------------------------- | ||
10865 | * | ||
10866 | * Function: DiagEEPROM | ||
10867 | * | 7142 | * |
10868 | * Description: Verfiy checksum and 'Key' and initialize the EEPROM if | 7143 | * Description: Verfiy checksum and 'Key' and initialize the EEPROM if |
10869 | * necessary. | 7144 | * necessary. |
10870 | * | 7145 | * |
10871 | *---------------------------------------------------------------------*/ | 7146 | *---------------------------------------------------------------------*/ |
10872 | 7147 | ||
10873 | #if defined(DOS) | 7148 | static void FPT_DiagEEPROM(ULONG p_port) |
10874 | void DiagEEPROM(USHORT p_port) | ||
10875 | #else | ||
10876 | void DiagEEPROM(ULONG p_port) | ||
10877 | #endif | ||
10878 | |||
10879 | { | 7149 | { |
10880 | USHORT index,temp,max_wd_cnt; | 7150 | USHORT index,temp,max_wd_cnt; |
10881 | 7151 | ||
@@ -10884,185 +7154,148 @@ void DiagEEPROM(ULONG p_port) | |||
10884 | else | 7154 | else |
10885 | max_wd_cnt = EEPROM_WD_CNT * 2; | 7155 | max_wd_cnt = EEPROM_WD_CNT * 2; |
10886 | 7156 | ||
10887 | temp = utilEERead(p_port, FW_SIGNATURE/2); | 7157 | temp = FPT_utilEERead(p_port, FW_SIGNATURE/2); |
10888 | 7158 | ||
10889 | if (temp == 0x4641) { | 7159 | if (temp == 0x4641) { |
10890 | 7160 | ||
10891 | for (index = 2; index < max_wd_cnt; index++) { | 7161 | for (index = 2; index < max_wd_cnt; index++) { |
10892 | 7162 | ||
10893 | temp += utilEERead(p_port, index); | 7163 | temp += FPT_utilEERead(p_port, index); |
10894 | 7164 | ||
10895 | } | 7165 | } |
10896 | 7166 | ||
10897 | if (temp == utilEERead(p_port, EEPROM_CHECK_SUM/2)) { | 7167 | if (temp == FPT_utilEERead(p_port, EEPROM_CHECK_SUM/2)) { |
10898 | 7168 | ||
10899 | return; /*EEPROM is Okay so return now! */ | 7169 | return; /*EEPROM is Okay so return now! */ |
10900 | } | 7170 | } |
10901 | } | 7171 | } |
10902 | 7172 | ||
10903 | 7173 | ||
10904 | utilEEWriteOnOff(p_port,(UCHAR)1); | 7174 | FPT_utilEEWriteOnOff(p_port,(UCHAR)1); |
10905 | 7175 | ||
10906 | for (index = 0; index < max_wd_cnt; index++) { | 7176 | for (index = 0; index < max_wd_cnt; index++) { |
10907 | 7177 | ||
10908 | utilEEWrite(p_port, 0x0000, index); | 7178 | FPT_utilEEWrite(p_port, 0x0000, index); |
10909 | } | 7179 | } |
10910 | 7180 | ||
10911 | temp = 0; | 7181 | temp = 0; |
10912 | 7182 | ||
10913 | utilEEWrite(p_port, 0x4641, FW_SIGNATURE/2); | 7183 | FPT_utilEEWrite(p_port, 0x4641, FW_SIGNATURE/2); |
10914 | temp += 0x4641; | 7184 | temp += 0x4641; |
10915 | utilEEWrite(p_port, 0x3920, MODEL_NUMB_0/2); | 7185 | FPT_utilEEWrite(p_port, 0x3920, MODEL_NUMB_0/2); |
10916 | temp += 0x3920; | 7186 | temp += 0x3920; |
10917 | utilEEWrite(p_port, 0x3033, MODEL_NUMB_2/2); | 7187 | FPT_utilEEWrite(p_port, 0x3033, MODEL_NUMB_2/2); |
10918 | temp += 0x3033; | 7188 | temp += 0x3033; |
10919 | utilEEWrite(p_port, 0x2020, MODEL_NUMB_4/2); | 7189 | FPT_utilEEWrite(p_port, 0x2020, MODEL_NUMB_4/2); |
10920 | temp += 0x2020; | 7190 | temp += 0x2020; |
10921 | utilEEWrite(p_port, 0x70D3, SYSTEM_CONFIG/2); | 7191 | FPT_utilEEWrite(p_port, 0x70D3, SYSTEM_CONFIG/2); |
10922 | temp += 0x70D3; | 7192 | temp += 0x70D3; |
10923 | utilEEWrite(p_port, 0x0010, BIOS_CONFIG/2); | 7193 | FPT_utilEEWrite(p_port, 0x0010, BIOS_CONFIG/2); |
10924 | temp += 0x0010; | 7194 | temp += 0x0010; |
10925 | utilEEWrite(p_port, 0x0003, SCAM_CONFIG/2); | 7195 | FPT_utilEEWrite(p_port, 0x0003, SCAM_CONFIG/2); |
10926 | temp += 0x0003; | 7196 | temp += 0x0003; |
10927 | utilEEWrite(p_port, 0x0007, ADAPTER_SCSI_ID/2); | 7197 | FPT_utilEEWrite(p_port, 0x0007, ADAPTER_SCSI_ID/2); |
10928 | temp += 0x0007; | 7198 | temp += 0x0007; |
10929 | 7199 | ||
10930 | utilEEWrite(p_port, 0x0000, IGNORE_B_SCAN/2); | 7200 | FPT_utilEEWrite(p_port, 0x0000, IGNORE_B_SCAN/2); |
10931 | temp += 0x0000; | 7201 | temp += 0x0000; |
10932 | utilEEWrite(p_port, 0x0000, SEND_START_ENA/2); | 7202 | FPT_utilEEWrite(p_port, 0x0000, SEND_START_ENA/2); |
10933 | temp += 0x0000; | 7203 | temp += 0x0000; |
10934 | utilEEWrite(p_port, 0x0000, DEVICE_ENABLE/2); | 7204 | FPT_utilEEWrite(p_port, 0x0000, DEVICE_ENABLE/2); |
10935 | temp += 0x0000; | 7205 | temp += 0x0000; |
10936 | 7206 | ||
10937 | utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL01/2); | 7207 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL01/2); |
10938 | temp += 0x4242; | 7208 | temp += 0x4242; |
10939 | utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL23/2); | 7209 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL23/2); |
10940 | temp += 0x4242; | 7210 | temp += 0x4242; |
10941 | utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL45/2); | 7211 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL45/2); |
10942 | temp += 0x4242; | 7212 | temp += 0x4242; |
10943 | utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL67/2); | 7213 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL67/2); |
10944 | temp += 0x4242; | 7214 | temp += 0x4242; |
10945 | utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL89/2); | 7215 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL89/2); |
10946 | temp += 0x4242; | 7216 | temp += 0x4242; |
10947 | utilEEWrite(p_port, 0x4242, SYNC_RATE_TBLab/2); | 7217 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBLab/2); |
10948 | temp += 0x4242; | 7218 | temp += 0x4242; |
10949 | utilEEWrite(p_port, 0x4242, SYNC_RATE_TBLcd/2); | 7219 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBLcd/2); |
10950 | temp += 0x4242; | 7220 | temp += 0x4242; |
10951 | utilEEWrite(p_port, 0x4242, SYNC_RATE_TBLef/2); | 7221 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBLef/2); |
10952 | temp += 0x4242; | 7222 | temp += 0x4242; |
10953 | 7223 | ||
10954 | 7224 | ||
10955 | utilEEWrite(p_port, 0x6C46, 64/2); /*PRODUCT ID */ | 7225 | FPT_utilEEWrite(p_port, 0x6C46, 64/2); /*PRODUCT ID */ |
10956 | temp += 0x6C46; | 7226 | temp += 0x6C46; |
10957 | utilEEWrite(p_port, 0x7361, 66/2); /* FlashPoint LT */ | 7227 | FPT_utilEEWrite(p_port, 0x7361, 66/2); /* FlashPoint LT */ |
10958 | temp += 0x7361; | 7228 | temp += 0x7361; |
10959 | utilEEWrite(p_port, 0x5068, 68/2); | 7229 | FPT_utilEEWrite(p_port, 0x5068, 68/2); |
10960 | temp += 0x5068; | 7230 | temp += 0x5068; |
10961 | utilEEWrite(p_port, 0x696F, 70/2); | 7231 | FPT_utilEEWrite(p_port, 0x696F, 70/2); |
10962 | temp += 0x696F; | 7232 | temp += 0x696F; |
10963 | utilEEWrite(p_port, 0x746E, 72/2); | 7233 | FPT_utilEEWrite(p_port, 0x746E, 72/2); |
10964 | temp += 0x746E; | 7234 | temp += 0x746E; |
10965 | utilEEWrite(p_port, 0x4C20, 74/2); | 7235 | FPT_utilEEWrite(p_port, 0x4C20, 74/2); |
10966 | temp += 0x4C20; | 7236 | temp += 0x4C20; |
10967 | utilEEWrite(p_port, 0x2054, 76/2); | 7237 | FPT_utilEEWrite(p_port, 0x2054, 76/2); |
10968 | temp += 0x2054; | 7238 | temp += 0x2054; |
10969 | utilEEWrite(p_port, 0x2020, 78/2); | 7239 | FPT_utilEEWrite(p_port, 0x2020, 78/2); |
10970 | temp += 0x2020; | 7240 | temp += 0x2020; |
10971 | 7241 | ||
10972 | index = ((EE_SCAMBASE/2)+(7*16)); | 7242 | index = ((EE_SCAMBASE/2)+(7*16)); |
10973 | utilEEWrite(p_port, (0x0700+TYPE_CODE0), index); | 7243 | FPT_utilEEWrite(p_port, (0x0700+TYPE_CODE0), index); |
10974 | temp += (0x0700+TYPE_CODE0); | 7244 | temp += (0x0700+TYPE_CODE0); |
10975 | index++; | 7245 | index++; |
10976 | utilEEWrite(p_port, 0x5542, index); /*Vendor ID code */ | 7246 | FPT_utilEEWrite(p_port, 0x5542, index); /*Vendor ID code */ |
10977 | temp += 0x5542; /* BUSLOGIC */ | 7247 | temp += 0x5542; /* BUSLOGIC */ |
10978 | index++; | 7248 | index++; |
10979 | utilEEWrite(p_port, 0x4C53, index); | 7249 | FPT_utilEEWrite(p_port, 0x4C53, index); |
10980 | temp += 0x4C53; | 7250 | temp += 0x4C53; |
10981 | index++; | 7251 | index++; |
10982 | utilEEWrite(p_port, 0x474F, index); | 7252 | FPT_utilEEWrite(p_port, 0x474F, index); |
10983 | temp += 0x474F; | 7253 | temp += 0x474F; |
10984 | index++; | 7254 | index++; |
10985 | utilEEWrite(p_port, 0x4349, index); | 7255 | FPT_utilEEWrite(p_port, 0x4349, index); |
10986 | temp += 0x4349; | 7256 | temp += 0x4349; |
10987 | index++; | 7257 | index++; |
10988 | utilEEWrite(p_port, 0x5442, index); /*Vendor unique code */ | 7258 | FPT_utilEEWrite(p_port, 0x5442, index); /*Vendor unique code */ |
10989 | temp += 0x5442; /* BT- 930 */ | 7259 | temp += 0x5442; /* BT- 930 */ |
10990 | index++; | 7260 | index++; |
10991 | utilEEWrite(p_port, 0x202D, index); | 7261 | FPT_utilEEWrite(p_port, 0x202D, index); |
10992 | temp += 0x202D; | 7262 | temp += 0x202D; |
10993 | index++; | 7263 | index++; |
10994 | utilEEWrite(p_port, 0x3339, index); | 7264 | FPT_utilEEWrite(p_port, 0x3339, index); |
10995 | temp += 0x3339; | 7265 | temp += 0x3339; |
10996 | index++; /*Serial # */ | 7266 | index++; /*Serial # */ |
10997 | utilEEWrite(p_port, 0x2030, index); /* 01234567 */ | 7267 | FPT_utilEEWrite(p_port, 0x2030, index); /* 01234567 */ |
10998 | temp += 0x2030; | 7268 | temp += 0x2030; |
10999 | index++; | 7269 | index++; |
11000 | utilEEWrite(p_port, 0x5453, index); | 7270 | FPT_utilEEWrite(p_port, 0x5453, index); |
11001 | temp += 0x5453; | 7271 | temp += 0x5453; |
11002 | index++; | 7272 | index++; |
11003 | utilEEWrite(p_port, 0x5645, index); | 7273 | FPT_utilEEWrite(p_port, 0x5645, index); |
11004 | temp += 0x5645; | 7274 | temp += 0x5645; |
11005 | index++; | 7275 | index++; |
11006 | utilEEWrite(p_port, 0x2045, index); | 7276 | FPT_utilEEWrite(p_port, 0x2045, index); |
11007 | temp += 0x2045; | 7277 | temp += 0x2045; |
11008 | index++; | 7278 | index++; |
11009 | utilEEWrite(p_port, 0x202F, index); | 7279 | FPT_utilEEWrite(p_port, 0x202F, index); |
11010 | temp += 0x202F; | 7280 | temp += 0x202F; |
11011 | index++; | 7281 | index++; |
11012 | utilEEWrite(p_port, 0x4F4A, index); | 7282 | FPT_utilEEWrite(p_port, 0x4F4A, index); |
11013 | temp += 0x4F4A; | 7283 | temp += 0x4F4A; |
11014 | index++; | 7284 | index++; |
11015 | utilEEWrite(p_port, 0x204E, index); | 7285 | FPT_utilEEWrite(p_port, 0x204E, index); |
11016 | temp += 0x204E; | 7286 | temp += 0x204E; |
11017 | index++; | 7287 | index++; |
11018 | utilEEWrite(p_port, 0x3539, index); | 7288 | FPT_utilEEWrite(p_port, 0x3539, index); |
11019 | temp += 0x3539; | 7289 | temp += 0x3539; |
11020 | 7290 | ||
11021 | 7291 | ||
11022 | 7292 | ||
11023 | utilEEWrite(p_port, temp, EEPROM_CHECK_SUM/2); | 7293 | FPT_utilEEWrite(p_port, temp, EEPROM_CHECK_SUM/2); |
11024 | 7294 | ||
11025 | utilEEWriteOnOff(p_port,(UCHAR)0); | 7295 | FPT_utilEEWriteOnOff(p_port,(UCHAR)0); |
11026 | 7296 | ||
11027 | } | 7297 | } |
11028 | 7298 | ||
11029 | #ident "$Id: utility.c 1.23 1997/06/10 16:55:06 mohan Exp $" | ||
11030 | /*---------------------------------------------------------------------- | ||
11031 | * | ||
11032 | * | ||
11033 | * Copyright 1995-1996 by Mylex Corporation. All Rights Reserved | ||
11034 | * | ||
11035 | * This file is available under both the GNU General Public License | ||
11036 | * and a BSD-style copyright; see LICENSE.FlashPoint for details. | ||
11037 | * | ||
11038 | * $Workfile: utility.c $ | ||
11039 | * | ||
11040 | * Description: Utility functions relating to queueing and EEPROM | ||
11041 | * manipulation and any other garbage functions. | ||
11042 | * | ||
11043 | * $Date: 1997/06/10 16:55:06 $ | ||
11044 | * | ||
11045 | * $Revision: 1.23 $ | ||
11046 | * | ||
11047 | *----------------------------------------------------------------------*/ | ||
11048 | /*#include <globals.h>*/ | ||
11049 | |||
11050 | #if (FW_TYPE==_UCB_MGR_) | ||
11051 | /*#include <budi.h>*/ | ||
11052 | #endif | ||
11053 | |||
11054 | /*#include <sccbmgr.h>*/ | ||
11055 | /*#include <blx30.h>*/ | ||
11056 | /*#include <target.h>*/ | ||
11057 | /*#include <scsi2.h>*/ | ||
11058 | /*#include <harpoon.h>*/ | ||
11059 | |||
11060 | |||
11061 | /* | ||
11062 | extern SCCBCARD BL_Card[MAX_CARDS]; | ||
11063 | extern SCCBMGR_TAR_INFO sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR]; | ||
11064 | extern unsigned int SccbGlobalFlags; | ||
11065 | */ | ||
11066 | 7299 | ||
11067 | /*--------------------------------------------------------------------- | 7300 | /*--------------------------------------------------------------------- |
11068 | * | 7301 | * |
@@ -11072,7 +7305,7 @@ extern unsigned int SccbGlobalFlags; | |||
11072 | * | 7305 | * |
11073 | *---------------------------------------------------------------------*/ | 7306 | *---------------------------------------------------------------------*/ |
11074 | 7307 | ||
11075 | void queueSearchSelect(PSCCBcard pCurrCard, UCHAR p_card) | 7308 | static void FPT_queueSearchSelect(PSCCBcard pCurrCard, UCHAR p_card) |
11076 | { | 7309 | { |
11077 | UCHAR scan_ptr, lun; | 7310 | UCHAR scan_ptr, lun; |
11078 | PSCCBMgr_tar_info currTar_Info; | 7311 | PSCCBMgr_tar_info currTar_Info; |
@@ -11081,7 +7314,7 @@ void queueSearchSelect(PSCCBcard pCurrCard, UCHAR p_card) | |||
11081 | scan_ptr = pCurrCard->scanIndex; | 7314 | scan_ptr = pCurrCard->scanIndex; |
11082 | do | 7315 | do |
11083 | { | 7316 | { |
11084 | currTar_Info = &sccbMgrTbl[p_card][scan_ptr]; | 7317 | currTar_Info = &FPT_sccbMgrTbl[p_card][scan_ptr]; |
11085 | if((pCurrCard->globalFlags & F_CONLUN_IO) && | 7318 | if((pCurrCard->globalFlags & F_CONLUN_IO) && |
11086 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) | 7319 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) |
11087 | { | 7320 | { |
@@ -11094,7 +7327,7 @@ void queueSearchSelect(PSCCBcard pCurrCard, UCHAR p_card) | |||
11094 | 7327 | ||
11095 | for(lun=0; lun < MAX_LUN; lun++) | 7328 | for(lun=0; lun < MAX_LUN; lun++) |
11096 | { | 7329 | { |
11097 | if(currTar_Info->TarLUNBusy[lun] == FALSE) | 7330 | if(currTar_Info->TarLUNBusy[lun] == 0) |
11098 | { | 7331 | { |
11099 | 7332 | ||
11100 | pCurrCard->currentSCCB = currTar_Info->TarSelQ_Head; | 7333 | pCurrCard->currentSCCB = currTar_Info->TarSelQ_Head; |
@@ -11153,7 +7386,7 @@ void queueSearchSelect(PSCCBcard pCurrCard, UCHAR p_card) | |||
11153 | else | 7386 | else |
11154 | { | 7387 | { |
11155 | if ((currTar_Info->TarSelQ_Cnt != 0) && | 7388 | if ((currTar_Info->TarSelQ_Cnt != 0) && |
11156 | (currTar_Info->TarLUNBusy[0] == FALSE)) | 7389 | (currTar_Info->TarLUNBusy[0] == 0)) |
11157 | { | 7390 | { |
11158 | 7391 | ||
11159 | pCurrCard->currentSCCB = currTar_Info->TarSelQ_Head; | 7392 | pCurrCard->currentSCCB = currTar_Info->TarSelQ_Head; |
@@ -11203,7 +7436,7 @@ void queueSearchSelect(PSCCBcard pCurrCard, UCHAR p_card) | |||
11203 | * | 7436 | * |
11204 | *---------------------------------------------------------------------*/ | 7437 | *---------------------------------------------------------------------*/ |
11205 | 7438 | ||
11206 | void queueSelectFail(PSCCBcard pCurrCard, UCHAR p_card) | 7439 | static void FPT_queueSelectFail(PSCCBcard pCurrCard, UCHAR p_card) |
11207 | { | 7440 | { |
11208 | UCHAR thisTarg; | 7441 | UCHAR thisTarg; |
11209 | PSCCBMgr_tar_info currTar_Info; | 7442 | PSCCBMgr_tar_info currTar_Info; |
@@ -11211,7 +7444,7 @@ void queueSelectFail(PSCCBcard pCurrCard, UCHAR p_card) | |||
11211 | if (pCurrCard->currentSCCB != NULL) | 7444 | if (pCurrCard->currentSCCB != NULL) |
11212 | { | 7445 | { |
11213 | thisTarg = (UCHAR)(((PSCCB)(pCurrCard->currentSCCB))->TargID); | 7446 | thisTarg = (UCHAR)(((PSCCB)(pCurrCard->currentSCCB))->TargID); |
11214 | currTar_Info = &sccbMgrTbl[p_card][thisTarg]; | 7447 | currTar_Info = &FPT_sccbMgrTbl[p_card][thisTarg]; |
11215 | 7448 | ||
11216 | pCurrCard->currentSCCB->Sccb_backlink = (PSCCB)NULL; | 7449 | pCurrCard->currentSCCB->Sccb_backlink = (PSCCB)NULL; |
11217 | 7450 | ||
@@ -11242,103 +7475,10 @@ void queueSelectFail(PSCCBcard pCurrCard, UCHAR p_card) | |||
11242 | * | 7475 | * |
11243 | *---------------------------------------------------------------------*/ | 7476 | *---------------------------------------------------------------------*/ |
11244 | 7477 | ||
11245 | void queueCmdComplete(PSCCBcard pCurrCard, PSCCB p_sccb, UCHAR p_card) | 7478 | static void FPT_queueCmdComplete(PSCCBcard pCurrCard, PSCCB p_sccb, |
7479 | UCHAR p_card) | ||
11246 | { | 7480 | { |
11247 | 7481 | ||
11248 | #if (FW_TYPE==_UCB_MGR_) | ||
11249 | |||
11250 | u08bits SCSIcmd; | ||
11251 | CALL_BK_FN callback; | ||
11252 | PSCCBMgr_tar_info currTar_Info; | ||
11253 | |||
11254 | PUCB p_ucb; | ||
11255 | p_ucb=p_sccb->Sccb_ucb_ptr; | ||
11256 | |||
11257 | SCSIcmd = p_sccb->Cdb[0]; | ||
11258 | |||
11259 | |||
11260 | if (!(p_sccb->Sccb_XferState & F_ALL_XFERRED)) | ||
11261 | { | ||
11262 | |||
11263 | if ((p_ucb->UCB_opcode & OPC_CHK_UNDER_OVER_RUN) && | ||
11264 | (p_sccb->HostStatus == SCCB_COMPLETE) && | ||
11265 | (p_sccb->TargetStatus != SSCHECK)) | ||
11266 | |||
11267 | if ((SCSIcmd == SCSI_READ) || | ||
11268 | (SCSIcmd == SCSI_WRITE) || | ||
11269 | (SCSIcmd == SCSI_READ_EXTENDED) || | ||
11270 | (SCSIcmd == SCSI_WRITE_EXTENDED) || | ||
11271 | (SCSIcmd == SCSI_WRITE_AND_VERIFY) || | ||
11272 | (SCSIcmd == SCSI_START_STOP_UNIT) || | ||
11273 | (pCurrCard->globalFlags & F_NO_FILTER) | ||
11274 | ) | ||
11275 | p_sccb->HostStatus = SCCB_DATA_UNDER_RUN; | ||
11276 | } | ||
11277 | |||
11278 | p_ucb->UCB_status=SCCB_SUCCESS; | ||
11279 | |||
11280 | if ((p_ucb->UCB_hbastat=p_sccb->HostStatus) || (p_ucb->UCB_scsistat=p_sccb->TargetStatus)) | ||
11281 | { | ||
11282 | p_ucb->UCB_status=SCCB_ERROR; | ||
11283 | } | ||
11284 | |||
11285 | if ((p_sccb->OperationCode == RESIDUAL_SG_COMMAND) || | ||
11286 | (p_sccb->OperationCode == RESIDUAL_COMMAND)) | ||
11287 | { | ||
11288 | |||
11289 | utilUpdateResidual(p_sccb); | ||
11290 | |||
11291 | p_ucb->UCB_datalen=p_sccb->DataLength; | ||
11292 | } | ||
11293 | |||
11294 | pCurrCard->cmdCounter--; | ||
11295 | if (!pCurrCard->cmdCounter) | ||
11296 | { | ||
11297 | |||
11298 | if (pCurrCard->globalFlags & F_GREEN_PC) | ||
11299 | { | ||
11300 | WR_HARPOON(pCurrCard->ioPort+hp_clkctrl_0,(PWR_DWN | CLKCTRL_DEFAULT)); | ||
11301 | WR_HARPOON(pCurrCard->ioPort+hp_sys_ctrl, STOP_CLK); | ||
11302 | } | ||
11303 | |||
11304 | WR_HARPOON(pCurrCard->ioPort+hp_semaphore, | ||
11305 | (RD_HARPOON(pCurrCard->ioPort+hp_semaphore) & ~SCCB_MGR_ACTIVE)); | ||
11306 | } | ||
11307 | |||
11308 | if(pCurrCard->discQCount != 0) | ||
11309 | { | ||
11310 | currTar_Info = &sccbMgrTbl[p_card][p_sccb->TargID]; | ||
11311 | if(((pCurrCard->globalFlags & F_CONLUN_IO) && | ||
11312 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) | ||
11313 | { | ||
11314 | pCurrCard->discQCount--; | ||
11315 | pCurrCard->discQ_Tbl[currTar_Info->LunDiscQ_Idx[p_sccb->Lun]] = NULL; | ||
11316 | } | ||
11317 | else | ||
11318 | { | ||
11319 | if(p_sccb->Sccb_tag) | ||
11320 | { | ||
11321 | pCurrCard->discQCount--; | ||
11322 | pCurrCard->discQ_Tbl[p_sccb->Sccb_tag] = NULL; | ||
11323 | }else | ||
11324 | { | ||
11325 | pCurrCard->discQCount--; | ||
11326 | pCurrCard->discQ_Tbl[currTar_Info->LunDiscQ_Idx[0]] = NULL; | ||
11327 | } | ||
11328 | } | ||
11329 | |||
11330 | } | ||
11331 | callback = (CALL_BK_FN)p_ucb->UCB_callback; | ||
11332 | callback(p_ucb); | ||
11333 | pCurrCard->globalFlags |= F_NEW_SCCB_CMD; | ||
11334 | pCurrCard->currentSCCB = NULL; | ||
11335 | } | ||
11336 | |||
11337 | |||
11338 | |||
11339 | |||
11340 | #else | ||
11341 | |||
11342 | UCHAR i, SCSIcmd; | 7482 | UCHAR i, SCSIcmd; |
11343 | CALL_BK_FN callback; | 7483 | CALL_BK_FN callback; |
11344 | PSCCBMgr_tar_info currTar_Info; | 7484 | PSCCBMgr_tar_info currTar_Info; |
@@ -11383,7 +7523,7 @@ void queueCmdComplete(PSCCBcard pCurrCard, PSCCB p_sccb, UCHAR p_card) | |||
11383 | if ((p_sccb->OperationCode == RESIDUAL_SG_COMMAND) || | 7523 | if ((p_sccb->OperationCode == RESIDUAL_SG_COMMAND) || |
11384 | (p_sccb->OperationCode == RESIDUAL_COMMAND)) { | 7524 | (p_sccb->OperationCode == RESIDUAL_COMMAND)) { |
11385 | 7525 | ||
11386 | utilUpdateResidual(p_sccb); | 7526 | FPT_utilUpdateResidual(p_sccb); |
11387 | } | 7527 | } |
11388 | 7528 | ||
11389 | pCurrCard->cmdCounter--; | 7529 | pCurrCard->cmdCounter--; |
@@ -11401,7 +7541,7 @@ void queueCmdComplete(PSCCBcard pCurrCard, PSCCB p_sccb, UCHAR p_card) | |||
11401 | 7541 | ||
11402 | if(pCurrCard->discQCount != 0) | 7542 | if(pCurrCard->discQCount != 0) |
11403 | { | 7543 | { |
11404 | currTar_Info = &sccbMgrTbl[p_card][p_sccb->TargID]; | 7544 | currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID]; |
11405 | if(((pCurrCard->globalFlags & F_CONLUN_IO) && | 7545 | if(((pCurrCard->globalFlags & F_CONLUN_IO) && |
11406 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) | 7546 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) |
11407 | { | 7547 | { |
@@ -11428,7 +7568,6 @@ void queueCmdComplete(PSCCBcard pCurrCard, PSCCB p_sccb, UCHAR p_card) | |||
11428 | pCurrCard->globalFlags |= F_NEW_SCCB_CMD; | 7568 | pCurrCard->globalFlags |= F_NEW_SCCB_CMD; |
11429 | pCurrCard->currentSCCB = NULL; | 7569 | pCurrCard->currentSCCB = NULL; |
11430 | } | 7570 | } |
11431 | #endif /* ( if FW_TYPE==...) */ | ||
11432 | 7571 | ||
11433 | 7572 | ||
11434 | /*--------------------------------------------------------------------- | 7573 | /*--------------------------------------------------------------------- |
@@ -11438,30 +7577,30 @@ void queueCmdComplete(PSCCBcard pCurrCard, PSCCB p_sccb, UCHAR p_card) | |||
11438 | * Description: Add SCCB to our disconnect array. | 7577 | * Description: Add SCCB to our disconnect array. |
11439 | * | 7578 | * |
11440 | *---------------------------------------------------------------------*/ | 7579 | *---------------------------------------------------------------------*/ |
11441 | void queueDisconnect(PSCCB p_sccb, UCHAR p_card) | 7580 | static void FPT_queueDisconnect(PSCCB p_sccb, UCHAR p_card) |
11442 | { | 7581 | { |
11443 | PSCCBMgr_tar_info currTar_Info; | 7582 | PSCCBMgr_tar_info currTar_Info; |
11444 | 7583 | ||
11445 | currTar_Info = &sccbMgrTbl[p_card][p_sccb->TargID]; | 7584 | currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID]; |
11446 | 7585 | ||
11447 | if(((BL_Card[p_card].globalFlags & F_CONLUN_IO) && | 7586 | if(((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && |
11448 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) | 7587 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) |
11449 | { | 7588 | { |
11450 | BL_Card[p_card].discQ_Tbl[currTar_Info->LunDiscQ_Idx[p_sccb->Lun]] = p_sccb; | 7589 | FPT_BL_Card[p_card].discQ_Tbl[currTar_Info->LunDiscQ_Idx[p_sccb->Lun]] = p_sccb; |
11451 | } | 7590 | } |
11452 | else | 7591 | else |
11453 | { | 7592 | { |
11454 | if (p_sccb->Sccb_tag) | 7593 | if (p_sccb->Sccb_tag) |
11455 | { | 7594 | { |
11456 | BL_Card[p_card].discQ_Tbl[p_sccb->Sccb_tag] = p_sccb; | 7595 | FPT_BL_Card[p_card].discQ_Tbl[p_sccb->Sccb_tag] = p_sccb; |
11457 | sccbMgrTbl[p_card][p_sccb->TargID].TarLUNBusy[0] = FALSE; | 7596 | FPT_sccbMgrTbl[p_card][p_sccb->TargID].TarLUNBusy[0] = 0; |
11458 | sccbMgrTbl[p_card][p_sccb->TargID].TarTagQ_Cnt++; | 7597 | FPT_sccbMgrTbl[p_card][p_sccb->TargID].TarTagQ_Cnt++; |
11459 | }else | 7598 | }else |
11460 | { | 7599 | { |
11461 | BL_Card[p_card].discQ_Tbl[currTar_Info->LunDiscQ_Idx[0]] = p_sccb; | 7600 | FPT_BL_Card[p_card].discQ_Tbl[currTar_Info->LunDiscQ_Idx[0]] = p_sccb; |
11462 | } | 7601 | } |
11463 | } | 7602 | } |
11464 | BL_Card[p_card].currentSCCB = NULL; | 7603 | FPT_BL_Card[p_card].currentSCCB = NULL; |
11465 | } | 7604 | } |
11466 | 7605 | ||
11467 | 7606 | ||
@@ -11473,29 +7612,29 @@ void queueDisconnect(PSCCB p_sccb, UCHAR p_card) | |||
11473 | * | 7612 | * |
11474 | *---------------------------------------------------------------------*/ | 7613 | *---------------------------------------------------------------------*/ |
11475 | 7614 | ||
11476 | void queueFlushSccb(UCHAR p_card, UCHAR error_code) | 7615 | static void FPT_queueFlushSccb(UCHAR p_card, UCHAR error_code) |
11477 | { | 7616 | { |
11478 | UCHAR qtag,thisTarg; | 7617 | UCHAR qtag,thisTarg; |
11479 | PSCCB currSCCB; | 7618 | PSCCB currSCCB; |
11480 | PSCCBMgr_tar_info currTar_Info; | 7619 | PSCCBMgr_tar_info currTar_Info; |
11481 | 7620 | ||
11482 | currSCCB = BL_Card[p_card].currentSCCB; | 7621 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
11483 | if(currSCCB != NULL) | 7622 | if(currSCCB != NULL) |
11484 | { | 7623 | { |
11485 | thisTarg = (UCHAR)currSCCB->TargID; | 7624 | thisTarg = (UCHAR)currSCCB->TargID; |
11486 | currTar_Info = &sccbMgrTbl[p_card][thisTarg]; | 7625 | currTar_Info = &FPT_sccbMgrTbl[p_card][thisTarg]; |
11487 | 7626 | ||
11488 | for (qtag=0; qtag<QUEUE_DEPTH; qtag++) { | 7627 | for (qtag=0; qtag<QUEUE_DEPTH; qtag++) { |
11489 | 7628 | ||
11490 | if (BL_Card[p_card].discQ_Tbl[qtag] && | 7629 | if (FPT_BL_Card[p_card].discQ_Tbl[qtag] && |
11491 | (BL_Card[p_card].discQ_Tbl[qtag]->TargID == thisTarg)) | 7630 | (FPT_BL_Card[p_card].discQ_Tbl[qtag]->TargID == thisTarg)) |
11492 | { | 7631 | { |
11493 | 7632 | ||
11494 | BL_Card[p_card].discQ_Tbl[qtag]->HostStatus = (UCHAR)error_code; | 7633 | FPT_BL_Card[p_card].discQ_Tbl[qtag]->HostStatus = (UCHAR)error_code; |
11495 | 7634 | ||
11496 | queueCmdComplete(&BL_Card[p_card],BL_Card[p_card].discQ_Tbl[qtag], p_card); | 7635 | FPT_queueCmdComplete(&FPT_BL_Card[p_card],FPT_BL_Card[p_card].discQ_Tbl[qtag], p_card); |
11497 | 7636 | ||
11498 | BL_Card[p_card].discQ_Tbl[qtag] = NULL; | 7637 | FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL; |
11499 | currTar_Info->TarTagQ_Cnt--; | 7638 | currTar_Info->TarTagQ_Cnt--; |
11500 | 7639 | ||
11501 | } | 7640 | } |
@@ -11512,24 +7651,25 @@ void queueFlushSccb(UCHAR p_card, UCHAR error_code) | |||
11512 | * | 7651 | * |
11513 | *---------------------------------------------------------------------*/ | 7652 | *---------------------------------------------------------------------*/ |
11514 | 7653 | ||
11515 | void queueFlushTargSccb(UCHAR p_card, UCHAR thisTarg, UCHAR error_code) | 7654 | static void FPT_queueFlushTargSccb(UCHAR p_card, UCHAR thisTarg, |
7655 | UCHAR error_code) | ||
11516 | { | 7656 | { |
11517 | UCHAR qtag; | 7657 | UCHAR qtag; |
11518 | PSCCBMgr_tar_info currTar_Info; | 7658 | PSCCBMgr_tar_info currTar_Info; |
11519 | 7659 | ||
11520 | currTar_Info = &sccbMgrTbl[p_card][thisTarg]; | 7660 | currTar_Info = &FPT_sccbMgrTbl[p_card][thisTarg]; |
11521 | 7661 | ||
11522 | for (qtag=0; qtag<QUEUE_DEPTH; qtag++) { | 7662 | for (qtag=0; qtag<QUEUE_DEPTH; qtag++) { |
11523 | 7663 | ||
11524 | if (BL_Card[p_card].discQ_Tbl[qtag] && | 7664 | if (FPT_BL_Card[p_card].discQ_Tbl[qtag] && |
11525 | (BL_Card[p_card].discQ_Tbl[qtag]->TargID == thisTarg)) | 7665 | (FPT_BL_Card[p_card].discQ_Tbl[qtag]->TargID == thisTarg)) |
11526 | { | 7666 | { |
11527 | 7667 | ||
11528 | BL_Card[p_card].discQ_Tbl[qtag]->HostStatus = (UCHAR)error_code; | 7668 | FPT_BL_Card[p_card].discQ_Tbl[qtag]->HostStatus = (UCHAR)error_code; |
11529 | 7669 | ||
11530 | queueCmdComplete(&BL_Card[p_card],BL_Card[p_card].discQ_Tbl[qtag], p_card); | 7670 | FPT_queueCmdComplete(&FPT_BL_Card[p_card],FPT_BL_Card[p_card].discQ_Tbl[qtag], p_card); |
11531 | 7671 | ||
11532 | BL_Card[p_card].discQ_Tbl[qtag] = NULL; | 7672 | FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL; |
11533 | currTar_Info->TarTagQ_Cnt--; | 7673 | currTar_Info->TarTagQ_Cnt--; |
11534 | 7674 | ||
11535 | } | 7675 | } |
@@ -11541,10 +7681,10 @@ void queueFlushTargSccb(UCHAR p_card, UCHAR thisTarg, UCHAR error_code) | |||
11541 | 7681 | ||
11542 | 7682 | ||
11543 | 7683 | ||
11544 | void queueAddSccb(PSCCB p_SCCB, UCHAR p_card) | 7684 | static void FPT_queueAddSccb(PSCCB p_SCCB, UCHAR p_card) |
11545 | { | 7685 | { |
11546 | PSCCBMgr_tar_info currTar_Info; | 7686 | PSCCBMgr_tar_info currTar_Info; |
11547 | currTar_Info = &sccbMgrTbl[p_card][p_SCCB->TargID]; | 7687 | currTar_Info = &FPT_sccbMgrTbl[p_card][p_SCCB->TargID]; |
11548 | 7688 | ||
11549 | p_SCCB->Sccb_forwardlink = NULL; | 7689 | p_SCCB->Sccb_forwardlink = NULL; |
11550 | 7690 | ||
@@ -11575,12 +7715,12 @@ void queueAddSccb(PSCCB p_SCCB, UCHAR p_card) | |||
11575 | * | 7715 | * |
11576 | *---------------------------------------------------------------------*/ | 7716 | *---------------------------------------------------------------------*/ |
11577 | 7717 | ||
11578 | UCHAR queueFindSccb(PSCCB p_SCCB, UCHAR p_card) | 7718 | static UCHAR FPT_queueFindSccb(PSCCB p_SCCB, UCHAR p_card) |
11579 | { | 7719 | { |
11580 | PSCCB q_ptr; | 7720 | PSCCB q_ptr; |
11581 | PSCCBMgr_tar_info currTar_Info; | 7721 | PSCCBMgr_tar_info currTar_Info; |
11582 | 7722 | ||
11583 | currTar_Info = &sccbMgrTbl[p_card][p_SCCB->TargID]; | 7723 | currTar_Info = &FPT_sccbMgrTbl[p_card][p_SCCB->TargID]; |
11584 | 7724 | ||
11585 | q_ptr = currTar_Info->TarSelQ_Head; | 7725 | q_ptr = currTar_Info->TarSelQ_Head; |
11586 | 7726 | ||
@@ -11609,7 +7749,7 @@ UCHAR queueFindSccb(PSCCB p_SCCB, UCHAR p_card) | |||
11609 | 7749 | ||
11610 | currTar_Info->TarSelQ_Cnt--; | 7750 | currTar_Info->TarSelQ_Cnt--; |
11611 | 7751 | ||
11612 | return(TRUE); | 7752 | return(1); |
11613 | } | 7753 | } |
11614 | 7754 | ||
11615 | else { | 7755 | else { |
@@ -11618,7 +7758,7 @@ UCHAR queueFindSccb(PSCCB p_SCCB, UCHAR p_card) | |||
11618 | } | 7758 | } |
11619 | 7759 | ||
11620 | 7760 | ||
11621 | return(FALSE); | 7761 | return(0); |
11622 | 7762 | ||
11623 | } | 7763 | } |
11624 | 7764 | ||
@@ -11636,15 +7776,11 @@ UCHAR queueFindSccb(PSCCB p_SCCB, UCHAR p_card) | |||
11636 | * | 7776 | * |
11637 | *---------------------------------------------------------------------*/ | 7777 | *---------------------------------------------------------------------*/ |
11638 | 7778 | ||
11639 | void utilUpdateResidual(PSCCB p_SCCB) | 7779 | static void FPT_utilUpdateResidual(PSCCB p_SCCB) |
11640 | { | 7780 | { |
11641 | ULONG partial_cnt; | 7781 | ULONG partial_cnt; |
11642 | UINT sg_index; | 7782 | UINT sg_index; |
11643 | #if defined(COMPILER_16_BIT) && !defined(DOS) | ||
11644 | ULONG far *sg_ptr; | ||
11645 | #else | ||
11646 | ULONG *sg_ptr; | 7783 | ULONG *sg_ptr; |
11647 | #endif | ||
11648 | 7784 | ||
11649 | if (p_SCCB->Sccb_XferState & F_ALL_XFERRED) { | 7785 | if (p_SCCB->Sccb_XferState & F_ALL_XFERRED) { |
11650 | 7786 | ||
@@ -11657,11 +7793,7 @@ void utilUpdateResidual(PSCCB p_SCCB) | |||
11657 | 7793 | ||
11658 | sg_index = p_SCCB->Sccb_sgseg; | 7794 | sg_index = p_SCCB->Sccb_sgseg; |
11659 | 7795 | ||
11660 | #if defined(COMPILER_16_BIT) && !defined(DOS) | ||
11661 | sg_ptr = (ULONG far *)p_SCCB->DataPointer; | ||
11662 | #else | ||
11663 | sg_ptr = (ULONG *)p_SCCB->DataPointer; | 7796 | sg_ptr = (ULONG *)p_SCCB->DataPointer; |
11664 | #endif | ||
11665 | 7797 | ||
11666 | if (p_SCCB->Sccb_SGoffset) { | 7798 | if (p_SCCB->Sccb_SGoffset) { |
11667 | 7799 | ||
@@ -11694,17 +7826,13 @@ void utilUpdateResidual(PSCCB p_SCCB) | |||
11694 | * | 7826 | * |
11695 | *---------------------------------------------------------------------*/ | 7827 | *---------------------------------------------------------------------*/ |
11696 | 7828 | ||
11697 | #if defined(DOS) | 7829 | static void FPT_Wait1Second(ULONG p_port) |
11698 | void Wait1Second(USHORT p_port) | ||
11699 | #else | ||
11700 | void Wait1Second(ULONG p_port) | ||
11701 | #endif | ||
11702 | { | 7830 | { |
11703 | UCHAR i; | 7831 | UCHAR i; |
11704 | 7832 | ||
11705 | for(i=0; i < 4; i++) { | 7833 | for(i=0; i < 4; i++) { |
11706 | 7834 | ||
11707 | Wait(p_port, TO_250ms); | 7835 | FPT_Wait(p_port, TO_250ms); |
11708 | 7836 | ||
11709 | if ((RD_HARPOON(p_port+hp_scsictrl_0) & SCSI_RST)) | 7837 | if ((RD_HARPOON(p_port+hp_scsictrl_0) & SCSI_RST)) |
11710 | break; | 7838 | break; |
@@ -11717,17 +7845,13 @@ void Wait1Second(ULONG p_port) | |||
11717 | 7845 | ||
11718 | /*--------------------------------------------------------------------- | 7846 | /*--------------------------------------------------------------------- |
11719 | * | 7847 | * |
11720 | * Function: Wait | 7848 | * Function: FPT_Wait |
11721 | * | 7849 | * |
11722 | * Description: Wait the desired delay. | 7850 | * Description: Wait the desired delay. |
11723 | * | 7851 | * |
11724 | *---------------------------------------------------------------------*/ | 7852 | *---------------------------------------------------------------------*/ |
11725 | 7853 | ||
11726 | #if defined(DOS) | 7854 | static void FPT_Wait(ULONG p_port, UCHAR p_delay) |
11727 | void Wait(USHORT p_port, UCHAR p_delay) | ||
11728 | #else | ||
11729 | void Wait(ULONG p_port, UCHAR p_delay) | ||
11730 | #endif | ||
11731 | { | 7855 | { |
11732 | UCHAR old_timer; | 7856 | UCHAR old_timer; |
11733 | UCHAR green_flag; | 7857 | UCHAR green_flag; |
@@ -11739,7 +7863,7 @@ void Wait(ULONG p_port, UCHAR p_delay) | |||
11739 | 7863 | ||
11740 | WR_HARPOON(p_port+hp_seltimeout,p_delay); | 7864 | WR_HARPOON(p_port+hp_seltimeout,p_delay); |
11741 | WRW_HARPOON((p_port+hp_intstat), TIMEOUT); | 7865 | WRW_HARPOON((p_port+hp_intstat), TIMEOUT); |
11742 | WRW_HARPOON((p_port+hp_intena), (default_intena & ~TIMEOUT)); | 7866 | WRW_HARPOON((p_port+hp_intena), (FPT_default_intena & ~TIMEOUT)); |
11743 | 7867 | ||
11744 | 7868 | ||
11745 | WR_HARPOON(p_port+hp_portctrl_0, | 7869 | WR_HARPOON(p_port+hp_portctrl_0, |
@@ -11758,7 +7882,7 @@ void Wait(ULONG p_port, UCHAR p_delay) | |||
11758 | (RD_HARPOON(p_port+hp_portctrl_0) & ~START_TO)); | 7882 | (RD_HARPOON(p_port+hp_portctrl_0) & ~START_TO)); |
11759 | 7883 | ||
11760 | WRW_HARPOON((p_port+hp_intstat), TIMEOUT); | 7884 | WRW_HARPOON((p_port+hp_intstat), TIMEOUT); |
11761 | WRW_HARPOON((p_port+hp_intena), default_intena); | 7885 | WRW_HARPOON((p_port+hp_intena), FPT_default_intena); |
11762 | 7886 | ||
11763 | WR_HARPOON(p_port+hp_clkctrl_0,green_flag); | 7887 | WR_HARPOON(p_port+hp_clkctrl_0,green_flag); |
11764 | 7888 | ||
@@ -11775,11 +7899,7 @@ void Wait(ULONG p_port, UCHAR p_delay) | |||
11775 | * | 7899 | * |
11776 | *---------------------------------------------------------------------*/ | 7900 | *---------------------------------------------------------------------*/ |
11777 | 7901 | ||
11778 | #if defined(DOS) | 7902 | static void FPT_utilEEWriteOnOff(ULONG p_port,UCHAR p_mode) |
11779 | void utilEEWriteOnOff(USHORT p_port,UCHAR p_mode) | ||
11780 | #else | ||
11781 | void utilEEWriteOnOff(ULONG p_port,UCHAR p_mode) | ||
11782 | #endif | ||
11783 | { | 7903 | { |
11784 | UCHAR ee_value; | 7904 | UCHAR ee_value; |
11785 | 7905 | ||
@@ -11787,12 +7907,12 @@ void utilEEWriteOnOff(ULONG p_port,UCHAR p_mode) | |||
11787 | 7907 | ||
11788 | if (p_mode) | 7908 | if (p_mode) |
11789 | 7909 | ||
11790 | utilEESendCmdAddr(p_port, EWEN, EWEN_ADDR); | 7910 | FPT_utilEESendCmdAddr(p_port, EWEN, EWEN_ADDR); |
11791 | 7911 | ||
11792 | else | 7912 | else |
11793 | 7913 | ||
11794 | 7914 | ||
11795 | utilEESendCmdAddr(p_port, EWDS, EWDS_ADDR); | 7915 | FPT_utilEESendCmdAddr(p_port, EWDS, EWDS_ADDR); |
11796 | 7916 | ||
11797 | WR_HARPOON(p_port+hp_ee_ctrl, (ee_value | SEE_MS)); /*Turn off CS */ | 7917 | WR_HARPOON(p_port+hp_ee_ctrl, (ee_value | SEE_MS)); /*Turn off CS */ |
11798 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); /*Turn off Master Select */ | 7918 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); /*Turn off Master Select */ |
@@ -11808,11 +7928,7 @@ void utilEEWriteOnOff(ULONG p_port,UCHAR p_mode) | |||
11808 | * | 7928 | * |
11809 | *---------------------------------------------------------------------*/ | 7929 | *---------------------------------------------------------------------*/ |
11810 | 7930 | ||
11811 | #if defined(DOS) | 7931 | static void FPT_utilEEWrite(ULONG p_port, USHORT ee_data, USHORT ee_addr) |
11812 | void utilEEWrite(USHORT p_port, USHORT ee_data, USHORT ee_addr) | ||
11813 | #else | ||
11814 | void utilEEWrite(ULONG p_port, USHORT ee_data, USHORT ee_addr) | ||
11815 | #endif | ||
11816 | { | 7932 | { |
11817 | 7933 | ||
11818 | UCHAR ee_value; | 7934 | UCHAR ee_value; |
@@ -11823,7 +7939,7 @@ void utilEEWrite(ULONG p_port, USHORT ee_data, USHORT ee_addr) | |||
11823 | 7939 | ||
11824 | 7940 | ||
11825 | 7941 | ||
11826 | utilEESendCmdAddr(p_port, EE_WRITE, ee_addr); | 7942 | FPT_utilEESendCmdAddr(p_port, EE_WRITE, ee_addr); |
11827 | 7943 | ||
11828 | 7944 | ||
11829 | ee_value |= (SEE_MS + SEE_CS); | 7945 | ee_value |= (SEE_MS + SEE_CS); |
@@ -11847,7 +7963,7 @@ void utilEEWrite(ULONG p_port, USHORT ee_data, USHORT ee_addr) | |||
11847 | ee_value &= (EXT_ARB_ACK | SCSI_TERM_ENA_H); | 7963 | ee_value &= (EXT_ARB_ACK | SCSI_TERM_ENA_H); |
11848 | WR_HARPOON(p_port+hp_ee_ctrl, (ee_value | SEE_MS)); | 7964 | WR_HARPOON(p_port+hp_ee_ctrl, (ee_value | SEE_MS)); |
11849 | 7965 | ||
11850 | Wait(p_port, TO_10ms); | 7966 | FPT_Wait(p_port, TO_10ms); |
11851 | 7967 | ||
11852 | WR_HARPOON(p_port+hp_ee_ctrl, (ee_value | SEE_MS | SEE_CS)); /* Set CS to EEPROM */ | 7968 | WR_HARPOON(p_port+hp_ee_ctrl, (ee_value | SEE_MS | SEE_CS)); /* Set CS to EEPROM */ |
11853 | WR_HARPOON(p_port+hp_ee_ctrl, (ee_value | SEE_MS)); /* Turn off CS */ | 7969 | WR_HARPOON(p_port+hp_ee_ctrl, (ee_value | SEE_MS)); /* Turn off CS */ |
@@ -11863,19 +7979,15 @@ void utilEEWrite(ULONG p_port, USHORT ee_data, USHORT ee_addr) | |||
11863 | * | 7979 | * |
11864 | *---------------------------------------------------------------------*/ | 7980 | *---------------------------------------------------------------------*/ |
11865 | 7981 | ||
11866 | #if defined(DOS) | 7982 | static USHORT FPT_utilEERead(ULONG p_port, USHORT ee_addr) |
11867 | USHORT utilEERead(USHORT p_port, USHORT ee_addr) | ||
11868 | #else | ||
11869 | USHORT utilEERead(ULONG p_port, USHORT ee_addr) | ||
11870 | #endif | ||
11871 | { | 7983 | { |
11872 | USHORT i, ee_data1, ee_data2; | 7984 | USHORT i, ee_data1, ee_data2; |
11873 | 7985 | ||
11874 | i = 0; | 7986 | i = 0; |
11875 | ee_data1 = utilEEReadOrg(p_port, ee_addr); | 7987 | ee_data1 = FPT_utilEEReadOrg(p_port, ee_addr); |
11876 | do | 7988 | do |
11877 | { | 7989 | { |
11878 | ee_data2 = utilEEReadOrg(p_port, ee_addr); | 7990 | ee_data2 = FPT_utilEEReadOrg(p_port, ee_addr); |
11879 | 7991 | ||
11880 | if(ee_data1 == ee_data2) | 7992 | if(ee_data1 == ee_data2) |
11881 | return(ee_data1); | 7993 | return(ee_data1); |
@@ -11897,11 +8009,7 @@ USHORT utilEERead(ULONG p_port, USHORT ee_addr) | |||
11897 | * | 8009 | * |
11898 | *---------------------------------------------------------------------*/ | 8010 | *---------------------------------------------------------------------*/ |
11899 | 8011 | ||
11900 | #if defined(DOS) | 8012 | static USHORT FPT_utilEEReadOrg(ULONG p_port, USHORT ee_addr) |
11901 | USHORT utilEEReadOrg(USHORT p_port, USHORT ee_addr) | ||
11902 | #else | ||
11903 | USHORT utilEEReadOrg(ULONG p_port, USHORT ee_addr) | ||
11904 | #endif | ||
11905 | { | 8013 | { |
11906 | 8014 | ||
11907 | UCHAR ee_value; | 8015 | UCHAR ee_value; |
@@ -11911,7 +8019,7 @@ USHORT utilEEReadOrg(ULONG p_port, USHORT ee_addr) | |||
11911 | (SEE_MS | SEE_CS)); | 8019 | (SEE_MS | SEE_CS)); |
11912 | 8020 | ||
11913 | 8021 | ||
11914 | utilEESendCmdAddr(p_port, EE_READ, ee_addr); | 8022 | FPT_utilEESendCmdAddr(p_port, EE_READ, ee_addr); |
11915 | 8023 | ||
11916 | 8024 | ||
11917 | ee_value |= (SEE_MS + SEE_CS); | 8025 | ee_value |= (SEE_MS + SEE_CS); |
@@ -11949,11 +8057,7 @@ USHORT utilEEReadOrg(ULONG p_port, USHORT ee_addr) | |||
11949 | * | 8057 | * |
11950 | *---------------------------------------------------------------------*/ | 8058 | *---------------------------------------------------------------------*/ |
11951 | 8059 | ||
11952 | #if defined(DOS) | 8060 | static void FPT_utilEESendCmdAddr(ULONG p_port, UCHAR ee_cmd, USHORT ee_addr) |
11953 | void utilEESendCmdAddr(USHORT p_port, UCHAR ee_cmd, USHORT ee_addr) | ||
11954 | #else | ||
11955 | void utilEESendCmdAddr(ULONG p_port, UCHAR ee_cmd, USHORT ee_addr) | ||
11956 | #endif | ||
11957 | { | 8061 | { |
11958 | UCHAR ee_value; | 8062 | UCHAR ee_value; |
11959 | UCHAR narrow_flg; | 8063 | UCHAR narrow_flg; |
@@ -12016,7 +8120,7 @@ void utilEESendCmdAddr(ULONG p_port, UCHAR ee_cmd, USHORT ee_addr) | |||
12016 | } | 8120 | } |
12017 | } | 8121 | } |
12018 | 8122 | ||
12019 | USHORT CalcCrc16(UCHAR buffer[]) | 8123 | static USHORT FPT_CalcCrc16(UCHAR buffer[]) |
12020 | { | 8124 | { |
12021 | USHORT crc=0; | 8125 | USHORT crc=0; |
12022 | int i,j; | 8126 | int i,j; |
@@ -12036,7 +8140,7 @@ USHORT CalcCrc16(UCHAR buffer[]) | |||
12036 | return(crc); | 8140 | return(crc); |
12037 | } | 8141 | } |
12038 | 8142 | ||
12039 | UCHAR CalcLrc(UCHAR buffer[]) | 8143 | static UCHAR FPT_CalcLrc(UCHAR buffer[]) |
12040 | { | 8144 | { |
12041 | int i; | 8145 | int i; |
12042 | UCHAR lrc; | 8146 | UCHAR lrc; |
@@ -12109,33 +8213,6 @@ FlashPoint__HandleInterrupt(FlashPoint_CardHandle_T CardHandle) | |||
12109 | #define FlashPoint_HandleInterrupt FlashPoint__HandleInterrupt | 8213 | #define FlashPoint_HandleInterrupt FlashPoint__HandleInterrupt |
12110 | 8214 | ||
12111 | 8215 | ||
12112 | /* | ||
12113 | FlashPoint_InquireTargetInfo returns the Synchronous Period, Synchronous | ||
12114 | Offset, and Wide Transfers Active information for TargetID on CardHandle. | ||
12115 | */ | ||
12116 | |||
12117 | void FlashPoint_InquireTargetInfo(FlashPoint_CardHandle_T CardHandle, | ||
12118 | int TargetID, | ||
12119 | unsigned char *SynchronousPeriod, | ||
12120 | unsigned char *SynchronousOffset, | ||
12121 | unsigned char *WideTransfersActive) | ||
12122 | { | ||
12123 | SCCBMGR_TAR_INFO *TargetInfo = | ||
12124 | &sccbMgrTbl[((SCCBCARD *)CardHandle)->cardIndex][TargetID]; | ||
12125 | if ((TargetInfo->TarSyncCtrl & SYNC_OFFSET) > 0) | ||
12126 | { | ||
12127 | *SynchronousPeriod = 5 * ((TargetInfo->TarSyncCtrl >> 5) + 1); | ||
12128 | *SynchronousOffset = TargetInfo->TarSyncCtrl & SYNC_OFFSET; | ||
12129 | } | ||
12130 | else | ||
12131 | { | ||
12132 | *SynchronousPeriod = 0; | ||
12133 | *SynchronousOffset = 0; | ||
12134 | } | ||
12135 | *WideTransfersActive = (TargetInfo->TarSyncCtrl & NARROW_SCSI ? 0 : 1); | ||
12136 | } | ||
12137 | |||
12138 | |||
12139 | #else /* CONFIG_SCSI_OMIT_FLASHPOINT */ | 8216 | #else /* CONFIG_SCSI_OMIT_FLASHPOINT */ |
12140 | 8217 | ||
12141 | 8218 | ||
@@ -12151,9 +8228,6 @@ extern int FlashPoint_AbortCCB(FlashPoint_CardHandle_T, struct BusLogic_CCB *); | |||
12151 | extern boolean FlashPoint_InterruptPending(FlashPoint_CardHandle_T); | 8228 | extern boolean FlashPoint_InterruptPending(FlashPoint_CardHandle_T); |
12152 | extern int FlashPoint_HandleInterrupt(FlashPoint_CardHandle_T); | 8229 | extern int FlashPoint_HandleInterrupt(FlashPoint_CardHandle_T); |
12153 | extern void FlashPoint_ReleaseHostAdapter(FlashPoint_CardHandle_T); | 8230 | extern void FlashPoint_ReleaseHostAdapter(FlashPoint_CardHandle_T); |
12154 | extern void FlashPoint_InquireTargetInfo(FlashPoint_CardHandle_T, | ||
12155 | int, unsigned char *, | ||
12156 | unsigned char *, unsigned char *); | ||
12157 | 8231 | ||
12158 | 8232 | ||
12159 | #endif /* CONFIG_SCSI_OMIT_FLASHPOINT */ | 8233 | #endif /* CONFIG_SCSI_OMIT_FLASHPOINT */ |