diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2006-03-08 03:14:35 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-03-12 10:18:15 -0500 |
commit | 5c04a7b8981f2855869bf04c881553135445d701 (patch) | |
tree | 536192a7b3e15523e0a0aecbd629be27404f2b10 /drivers | |
parent | 13e6851aa1e8f7db0e9f0cc8567394a9fe451357 (diff) |
[SCSI] drivers/scsi/FlashPoint.c: Lindent
It's much, much more readable now.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/FlashPoint.c | 9190 |
1 files changed, 4490 insertions, 4700 deletions
diff --git a/drivers/scsi/FlashPoint.c b/drivers/scsi/FlashPoint.c index 37ee2cb60d20..ce49fbcafbb6 100644 --- a/drivers/scsi/FlashPoint.c +++ b/drivers/scsi/FlashPoint.c | |||
@@ -15,74 +15,47 @@ | |||
15 | 15 | ||
16 | */ | 16 | */ |
17 | 17 | ||
18 | |||
19 | #include <linux/config.h> | 18 | #include <linux/config.h> |
20 | 19 | ||
21 | |||
22 | #ifndef CONFIG_SCSI_OMIT_FLASHPOINT | 20 | #ifndef CONFIG_SCSI_OMIT_FLASHPOINT |
23 | 21 | ||
24 | |||
25 | #define MAX_CARDS 8 | 22 | #define MAX_CARDS 8 |
26 | #undef BUSTYPE_PCI | 23 | #undef BUSTYPE_PCI |
27 | 24 | ||
28 | |||
29 | |||
30 | |||
31 | |||
32 | |||
33 | |||
34 | |||
35 | |||
36 | #define CRCMASK 0xA001 | 25 | #define CRCMASK 0xA001 |
37 | 26 | ||
38 | |||
39 | |||
40 | #define FAILURE 0xFFFFFFFFL | 27 | #define FAILURE 0xFFFFFFFFL |
41 | 28 | ||
42 | 29 | #define BIT(x) ((unsigned char)(1<<(x))) /* single-bit mask in bit position x */ | |
43 | 30 | #define BITW(x) ((unsigned short)(1<<(x))) /* single-bit mask in bit position x */ | |
44 | |||
45 | |||
46 | |||
47 | |||
48 | |||
49 | |||
50 | |||
51 | #define BIT(x) ((unsigned char)(1<<(x))) /* single-bit mask in bit position x */ | ||
52 | #define BITW(x) ((unsigned short)(1<<(x))) /* single-bit mask in bit position x */ | ||
53 | |||
54 | |||
55 | 31 | ||
56 | struct sccb; | 32 | struct sccb; |
57 | typedef void (*CALL_BK_FN)(struct sccb *); | 33 | typedef void (*CALL_BK_FN) (struct sccb *); |
58 | |||
59 | 34 | ||
60 | struct sccb_mgr_info { | 35 | struct sccb_mgr_info { |
61 | unsigned long si_baseaddr; | 36 | unsigned long si_baseaddr; |
62 | unsigned char si_present; | 37 | unsigned char si_present; |
63 | unsigned char si_intvect; | 38 | unsigned char si_intvect; |
64 | unsigned char si_id; | 39 | unsigned char si_id; |
65 | unsigned char si_lun; | 40 | unsigned char si_lun; |
66 | unsigned short si_fw_revision; | 41 | unsigned short si_fw_revision; |
67 | unsigned short si_per_targ_init_sync; | 42 | unsigned short si_per_targ_init_sync; |
68 | unsigned short si_per_targ_fast_nego; | 43 | unsigned short si_per_targ_fast_nego; |
69 | unsigned short si_per_targ_ultra_nego; | 44 | unsigned short si_per_targ_ultra_nego; |
70 | unsigned short si_per_targ_no_disc; | 45 | unsigned short si_per_targ_no_disc; |
71 | unsigned short si_per_targ_wide_nego; | 46 | unsigned short si_per_targ_wide_nego; |
72 | unsigned short si_flags; | 47 | unsigned short si_flags; |
73 | unsigned char si_card_family; | 48 | unsigned char si_card_family; |
74 | unsigned char si_bustype; | 49 | unsigned char si_bustype; |
75 | unsigned char si_card_model[3]; | 50 | unsigned char si_card_model[3]; |
76 | unsigned char si_relative_cardnum; | 51 | unsigned char si_relative_cardnum; |
77 | unsigned char si_reserved[4]; | 52 | unsigned char si_reserved[4]; |
78 | unsigned long si_OS_reserved; | 53 | unsigned long si_OS_reserved; |
79 | unsigned char si_XlatInfo[4]; | 54 | unsigned char si_XlatInfo[4]; |
80 | unsigned long si_reserved2[5]; | 55 | unsigned long si_reserved2[5]; |
81 | unsigned long si_secondary_range; | 56 | unsigned long si_secondary_range; |
82 | }; | 57 | }; |
83 | 58 | ||
84 | |||
85 | |||
86 | #define SCSI_PARITY_ENA 0x0001 | 59 | #define SCSI_PARITY_ENA 0x0001 |
87 | #define LOW_BYTE_TERM 0x0010 | 60 | #define LOW_BYTE_TERM 0x0010 |
88 | #define HIGH_BYTE_TERM 0x0020 | 61 | #define HIGH_BYTE_TERM 0x0020 |
@@ -95,97 +68,82 @@ struct sccb_mgr_info { | |||
95 | #define FLAG_SCAM_ENABLED 0x0080 | 68 | #define FLAG_SCAM_ENABLED 0x0080 |
96 | #define FLAG_SCAM_LEVEL2 0x0100 | 69 | #define FLAG_SCAM_LEVEL2 0x0100 |
97 | 70 | ||
98 | |||
99 | |||
100 | |||
101 | #define HARPOON_FAMILY 0x02 | 71 | #define HARPOON_FAMILY 0x02 |
102 | 72 | ||
103 | |||
104 | |||
105 | /* SCCB struct used for both SCCB and UCB manager compiles! | 73 | /* SCCB struct used for both SCCB and UCB manager compiles! |
106 | * The UCB Manager treats the SCCB as it's 'native hardware structure' | 74 | * The UCB Manager treats the SCCB as it's 'native hardware structure' |
107 | */ | 75 | */ |
108 | 76 | ||
109 | |||
110 | #pragma pack(1) | 77 | #pragma pack(1) |
111 | struct sccb { | 78 | struct sccb { |
112 | unsigned char OperationCode; | 79 | unsigned char OperationCode; |
113 | unsigned char ControlByte; | 80 | unsigned char ControlByte; |
114 | unsigned char CdbLength; | 81 | unsigned char CdbLength; |
115 | unsigned char RequestSenseLength; | 82 | unsigned char RequestSenseLength; |
116 | unsigned long DataLength; | 83 | unsigned long DataLength; |
117 | unsigned long DataPointer; | 84 | unsigned long DataPointer; |
118 | unsigned char CcbRes[2]; | 85 | unsigned char CcbRes[2]; |
119 | unsigned char HostStatus; | 86 | unsigned char HostStatus; |
120 | unsigned char TargetStatus; | 87 | unsigned char TargetStatus; |
121 | unsigned char TargID; | 88 | unsigned char TargID; |
122 | unsigned char Lun; | 89 | unsigned char Lun; |
123 | unsigned char Cdb[12]; | 90 | unsigned char Cdb[12]; |
124 | unsigned char CcbRes1; | 91 | unsigned char CcbRes1; |
125 | unsigned char Reserved1; | 92 | unsigned char Reserved1; |
126 | unsigned long Reserved2; | 93 | unsigned long Reserved2; |
127 | unsigned long SensePointer; | 94 | unsigned long SensePointer; |
128 | 95 | ||
129 | 96 | CALL_BK_FN SccbCallback; /* VOID (*SccbCallback)(); */ | |
130 | CALL_BK_FN SccbCallback; /* VOID (*SccbCallback)(); */ | 97 | unsigned long SccbIOPort; /* Identifies board base port */ |
131 | unsigned long SccbIOPort; /* Identifies board base port */ | 98 | unsigned char SccbStatus; |
132 | unsigned char SccbStatus; | 99 | unsigned char SCCBRes2; |
133 | unsigned char SCCBRes2; | 100 | unsigned short SccbOSFlags; |
134 | unsigned short SccbOSFlags; | 101 | |
135 | 102 | unsigned long Sccb_XferCnt; /* actual transfer count */ | |
136 | 103 | unsigned long Sccb_ATC; | |
137 | unsigned long Sccb_XferCnt; /* actual transfer count */ | 104 | unsigned long SccbVirtDataPtr; /* virtual addr for OS/2 */ |
138 | unsigned long Sccb_ATC; | 105 | unsigned long Sccb_res1; |
139 | unsigned long SccbVirtDataPtr; /* virtual addr for OS/2 */ | 106 | unsigned short Sccb_MGRFlags; |
140 | unsigned long Sccb_res1; | 107 | unsigned short Sccb_sgseg; |
141 | unsigned short Sccb_MGRFlags; | 108 | unsigned char Sccb_scsimsg; /* identify msg for selection */ |
142 | unsigned short Sccb_sgseg; | 109 | unsigned char Sccb_tag; |
143 | unsigned char Sccb_scsimsg; /* identify msg for selection */ | 110 | unsigned char Sccb_scsistat; |
144 | unsigned char Sccb_tag; | 111 | unsigned char Sccb_idmsg; /* image of last msg in */ |
145 | unsigned char Sccb_scsistat; | 112 | struct sccb *Sccb_forwardlink; |
146 | unsigned char Sccb_idmsg; /* image of last msg in */ | 113 | struct sccb *Sccb_backlink; |
147 | struct sccb * Sccb_forwardlink; | 114 | unsigned long Sccb_savedATC; |
148 | struct sccb * Sccb_backlink; | 115 | unsigned char Save_Cdb[6]; |
149 | unsigned long Sccb_savedATC; | 116 | unsigned char Save_CdbLen; |
150 | unsigned char Save_Cdb[6]; | 117 | unsigned char Sccb_XferState; |
151 | unsigned char Save_CdbLen; | 118 | unsigned long Sccb_SGoffset; |
152 | unsigned char Sccb_XferState; | 119 | }; |
153 | unsigned long Sccb_SGoffset; | ||
154 | }; | ||
155 | |||
156 | 120 | ||
157 | #pragma pack() | 121 | #pragma pack() |
158 | 122 | ||
159 | |||
160 | |||
161 | #define SCATTER_GATHER_COMMAND 0x02 | 123 | #define SCATTER_GATHER_COMMAND 0x02 |
162 | #define RESIDUAL_COMMAND 0x03 | 124 | #define RESIDUAL_COMMAND 0x03 |
163 | #define RESIDUAL_SG_COMMAND 0x04 | 125 | #define RESIDUAL_SG_COMMAND 0x04 |
164 | #define RESET_COMMAND 0x81 | 126 | #define RESET_COMMAND 0x81 |
165 | 127 | ||
128 | #define F_USE_CMD_Q 0x20 /*Inidcates TAGGED command. */ | ||
129 | #define TAG_TYPE_MASK 0xC0 /*Type of tag msg to send. */ | ||
130 | #define SCCB_DATA_XFER_OUT 0x10 /* Write */ | ||
131 | #define SCCB_DATA_XFER_IN 0x08 /* Read */ | ||
166 | 132 | ||
167 | #define F_USE_CMD_Q 0x20 /*Inidcates TAGGED command. */ | 133 | #define NO_AUTO_REQUEST_SENSE 0x01 /* No Request Sense Buffer */ |
168 | #define TAG_TYPE_MASK 0xC0 /*Type of tag msg to send. */ | ||
169 | #define SCCB_DATA_XFER_OUT 0x10 /* Write */ | ||
170 | #define SCCB_DATA_XFER_IN 0x08 /* Read */ | ||
171 | |||
172 | 134 | ||
173 | #define NO_AUTO_REQUEST_SENSE 0x01 /* No Request Sense Buffer */ | 135 | #define BUS_FREE_ST 0 |
174 | |||
175 | |||
176 | #define BUS_FREE_ST 0 | ||
177 | #define SELECT_ST 1 | 136 | #define SELECT_ST 1 |
178 | #define SELECT_BDR_ST 2 /* Select w\ Bus Device Reset */ | 137 | #define SELECT_BDR_ST 2 /* Select w\ Bus Device Reset */ |
179 | #define SELECT_SN_ST 3 /* Select w\ Sync Nego */ | 138 | #define SELECT_SN_ST 3 /* Select w\ Sync Nego */ |
180 | #define SELECT_WN_ST 4 /* Select w\ Wide Data Nego */ | 139 | #define SELECT_WN_ST 4 /* Select w\ Wide Data Nego */ |
181 | #define SELECT_Q_ST 5 /* Select w\ Tagged Q'ing */ | 140 | #define SELECT_Q_ST 5 /* Select w\ Tagged Q'ing */ |
182 | #define COMMAND_ST 6 | 141 | #define COMMAND_ST 6 |
183 | #define DATA_OUT_ST 7 | 142 | #define DATA_OUT_ST 7 |
184 | #define DATA_IN_ST 8 | 143 | #define DATA_IN_ST 8 |
185 | #define DISCONNECT_ST 9 | 144 | #define DISCONNECT_ST 9 |
186 | #define ABORT_ST 11 | 145 | #define ABORT_ST 11 |
187 | 146 | ||
188 | |||
189 | #define F_HOST_XFER_DIR 0x01 | 147 | #define F_HOST_XFER_DIR 0x01 |
190 | #define F_ALL_XFERRED 0x02 | 148 | #define F_ALL_XFERRED 0x02 |
191 | #define F_SG_XFER 0x04 | 149 | #define F_SG_XFER 0x04 |
@@ -193,49 +151,37 @@ struct sccb { | |||
193 | #define F_ODD_BALL_CNT 0x10 | 151 | #define F_ODD_BALL_CNT 0x10 |
194 | #define F_NO_DATA_YET 0x80 | 152 | #define F_NO_DATA_YET 0x80 |
195 | 153 | ||
196 | |||
197 | #define F_STATUSLOADED 0x01 | 154 | #define F_STATUSLOADED 0x01 |
198 | #define F_DEV_SELECTED 0x04 | 155 | #define F_DEV_SELECTED 0x04 |
199 | 156 | ||
200 | 157 | #define SCCB_COMPLETE 0x00 /* SCCB completed without error */ | |
201 | #define SCCB_COMPLETE 0x00 /* SCCB completed without error */ | ||
202 | #define SCCB_DATA_UNDER_RUN 0x0C | 158 | #define SCCB_DATA_UNDER_RUN 0x0C |
203 | #define SCCB_SELECTION_TIMEOUT 0x11 /* Set SCSI selection timed out */ | 159 | #define SCCB_SELECTION_TIMEOUT 0x11 /* Set SCSI selection timed out */ |
204 | #define SCCB_DATA_OVER_RUN 0x12 | 160 | #define SCCB_DATA_OVER_RUN 0x12 |
205 | #define SCCB_PHASE_SEQUENCE_FAIL 0x14 /* Target bus phase sequence failure */ | 161 | #define SCCB_PHASE_SEQUENCE_FAIL 0x14 /* Target bus phase sequence failure */ |
206 | |||
207 | #define SCCB_GROSS_FW_ERR 0x27 /* Major problem! */ | ||
208 | #define SCCB_BM_ERR 0x30 /* BusMaster error. */ | ||
209 | #define SCCB_PARITY_ERR 0x34 /* SCSI parity error */ | ||
210 | |||
211 | |||
212 | |||
213 | 162 | ||
163 | #define SCCB_GROSS_FW_ERR 0x27 /* Major problem! */ | ||
164 | #define SCCB_BM_ERR 0x30 /* BusMaster error. */ | ||
165 | #define SCCB_PARITY_ERR 0x34 /* SCSI parity error */ | ||
214 | 166 | ||
215 | #define SCCB_IN_PROCESS 0x00 | 167 | #define SCCB_IN_PROCESS 0x00 |
216 | #define SCCB_SUCCESS 0x01 | 168 | #define SCCB_SUCCESS 0x01 |
217 | #define SCCB_ABORT 0x02 | 169 | #define SCCB_ABORT 0x02 |
218 | #define SCCB_ERROR 0x04 | 170 | #define SCCB_ERROR 0x04 |
219 | 171 | ||
220 | |||
221 | |||
222 | #define ORION_FW_REV 3110 | 172 | #define ORION_FW_REV 3110 |
223 | 173 | ||
174 | #define QUEUE_DEPTH 254+1 /*1 for Normal disconnect 32 for Q'ing. */ | ||
224 | 175 | ||
225 | 176 | #define MAX_MB_CARDS 4 /* Max. no of cards suppoerted on Mother Board */ | |
226 | #define QUEUE_DEPTH 254+1 /*1 for Normal disconnect 32 for Q'ing. */ | ||
227 | |||
228 | #define MAX_MB_CARDS 4 /* Max. no of cards suppoerted on Mother Board */ | ||
229 | |||
230 | 177 | ||
231 | #define MAX_SCSI_TAR 16 | 178 | #define MAX_SCSI_TAR 16 |
232 | #define MAX_LUN 32 | 179 | #define MAX_LUN 32 |
233 | #define LUN_MASK 0x1f | 180 | #define LUN_MASK 0x1f |
234 | 181 | ||
235 | #define SG_BUF_CNT 16 /*Number of prefetched elements. */ | 182 | #define SG_BUF_CNT 16 /*Number of prefetched elements. */ |
236 | |||
237 | #define SG_ELEMENT_SIZE 8 /*Eight byte per element. */ | ||
238 | 183 | ||
184 | #define SG_ELEMENT_SIZE 8 /*Eight byte per element. */ | ||
239 | 185 | ||
240 | #define RD_HARPOON(ioport) inb((u32)ioport) | 186 | #define RD_HARPOON(ioport) inb((u32)ioport) |
241 | #define RDW_HARPOON(ioport) inw((u32)ioport) | 187 | #define RDW_HARPOON(ioport) inw((u32)ioport) |
@@ -244,7 +190,6 @@ struct sccb { | |||
244 | #define WRW_HARPOON(ioport,val) outw((u16)val, (u32)ioport) | 190 | #define WRW_HARPOON(ioport,val) outw((u16)val, (u32)ioport) |
245 | #define WR_HARP32(ioport,offset,data) outl(data, (u32)(ioport + offset)) | 191 | #define WR_HARP32(ioport,offset,data) outl(data, (u32)(ioport + offset)) |
246 | 192 | ||
247 | |||
248 | #define TAR_SYNC_MASK (BIT(7)+BIT(6)) | 193 | #define TAR_SYNC_MASK (BIT(7)+BIT(6)) |
249 | #define SYNC_TRYING BIT(6) | 194 | #define SYNC_TRYING BIT(6) |
250 | #define SYNC_SUPPORTED (BIT(7)+BIT(6)) | 195 | #define SYNC_SUPPORTED (BIT(7)+BIT(6)) |
@@ -259,7 +204,6 @@ struct sccb { | |||
259 | 204 | ||
260 | #define TAR_ALLOW_DISC BIT(0) | 205 | #define TAR_ALLOW_DISC BIT(0) |
261 | 206 | ||
262 | |||
263 | #define EE_SYNC_MASK (BIT(0)+BIT(1)) | 207 | #define EE_SYNC_MASK (BIT(0)+BIT(1)) |
264 | #define EE_SYNC_5MB BIT(0) | 208 | #define EE_SYNC_5MB BIT(0) |
265 | #define EE_SYNC_10MB BIT(1) | 209 | #define EE_SYNC_10MB BIT(1) |
@@ -267,62 +211,55 @@ struct sccb { | |||
267 | 211 | ||
268 | #define EE_WIDE_SCSI BIT(7) | 212 | #define EE_WIDE_SCSI BIT(7) |
269 | 213 | ||
270 | |||
271 | |||
272 | |||
273 | struct sccb_mgr_tar_info { | 214 | struct sccb_mgr_tar_info { |
274 | 215 | ||
275 | struct sccb * TarSelQ_Head; | 216 | struct sccb *TarSelQ_Head; |
276 | struct sccb * TarSelQ_Tail; | 217 | struct sccb *TarSelQ_Tail; |
277 | unsigned char TarLUN_CA; /*Contingent Allgiance */ | 218 | unsigned char TarLUN_CA; /*Contingent Allgiance */ |
278 | unsigned char TarTagQ_Cnt; | 219 | unsigned char TarTagQ_Cnt; |
279 | unsigned char TarSelQ_Cnt; | 220 | unsigned char TarSelQ_Cnt; |
280 | unsigned char TarStatus; | 221 | unsigned char TarStatus; |
281 | unsigned char TarEEValue; | 222 | unsigned char TarEEValue; |
282 | unsigned char TarSyncCtrl; | 223 | unsigned char TarSyncCtrl; |
283 | unsigned char TarReserved[2]; /* for alignment */ | 224 | unsigned char TarReserved[2]; /* for alignment */ |
284 | unsigned char LunDiscQ_Idx[MAX_LUN]; | 225 | unsigned char LunDiscQ_Idx[MAX_LUN]; |
285 | unsigned char TarLUNBusy[MAX_LUN]; | 226 | unsigned char TarLUNBusy[MAX_LUN]; |
286 | }; | 227 | }; |
287 | 228 | ||
288 | struct nvram_info { | 229 | struct nvram_info { |
289 | unsigned char niModel; /* Model No. of card */ | 230 | unsigned char niModel; /* Model No. of card */ |
290 | unsigned char niCardNo; /* Card no. */ | 231 | unsigned char niCardNo; /* Card no. */ |
291 | unsigned long niBaseAddr; /* Port Address of card */ | 232 | unsigned long niBaseAddr; /* Port Address of card */ |
292 | unsigned char niSysConf; /* Adapter Configuration byte - Byte 16 of eeprom map */ | 233 | unsigned char niSysConf; /* Adapter Configuration byte - Byte 16 of eeprom map */ |
293 | unsigned char niScsiConf; /* SCSI Configuration byte - Byte 17 of eeprom map */ | 234 | unsigned char niScsiConf; /* SCSI Configuration byte - Byte 17 of eeprom map */ |
294 | unsigned char niScamConf; /* SCAM Configuration byte - Byte 20 of eeprom map */ | 235 | unsigned char niScamConf; /* SCAM Configuration byte - Byte 20 of eeprom map */ |
295 | unsigned char niAdapId; /* Host Adapter ID - Byte 24 of eerpom map */ | 236 | unsigned char niAdapId; /* Host Adapter ID - Byte 24 of eerpom map */ |
296 | unsigned char niSyncTbl[MAX_SCSI_TAR / 2]; /* Sync/Wide byte of targets */ | 237 | unsigned char niSyncTbl[MAX_SCSI_TAR / 2]; /* Sync/Wide byte of targets */ |
297 | unsigned char niScamTbl[MAX_SCSI_TAR][4]; /* Compressed Scam name string of Targets */ | 238 | unsigned char niScamTbl[MAX_SCSI_TAR][4]; /* Compressed Scam name string of Targets */ |
298 | }; | 239 | }; |
299 | 240 | ||
300 | |||
301 | #define MODEL_LT 1 | 241 | #define MODEL_LT 1 |
302 | #define MODEL_DL 2 | 242 | #define MODEL_DL 2 |
303 | #define MODEL_LW 3 | 243 | #define MODEL_LW 3 |
304 | #define MODEL_DW 4 | 244 | #define MODEL_DW 4 |
305 | 245 | ||
306 | |||
307 | struct sccb_card { | 246 | struct sccb_card { |
308 | struct sccb * currentSCCB; | 247 | struct sccb *currentSCCB; |
309 | struct sccb_mgr_info * cardInfo; | 248 | struct sccb_mgr_info *cardInfo; |
310 | |||
311 | unsigned long ioPort; | ||
312 | |||
313 | unsigned short cmdCounter; | ||
314 | unsigned char discQCount; | ||
315 | unsigned char tagQ_Lst; | ||
316 | unsigned char cardIndex; | ||
317 | unsigned char scanIndex; | ||
318 | unsigned char globalFlags; | ||
319 | unsigned char ourId; | ||
320 | struct nvram_info * pNvRamInfo; | ||
321 | struct sccb * discQ_Tbl[QUEUE_DEPTH]; | ||
322 | |||
323 | }; | ||
324 | 249 | ||
250 | unsigned long ioPort; | ||
325 | 251 | ||
252 | unsigned short cmdCounter; | ||
253 | unsigned char discQCount; | ||
254 | unsigned char tagQ_Lst; | ||
255 | unsigned char cardIndex; | ||
256 | unsigned char scanIndex; | ||
257 | unsigned char globalFlags; | ||
258 | unsigned char ourId; | ||
259 | struct nvram_info *pNvRamInfo; | ||
260 | struct sccb *discQ_Tbl[QUEUE_DEPTH]; | ||
261 | |||
262 | }; | ||
326 | 263 | ||
327 | #define F_TAG_STARTED 0x01 | 264 | #define F_TAG_STARTED 0x01 |
328 | #define F_CONLUN_IO 0x02 | 265 | #define F_CONLUN_IO 0x02 |
@@ -333,12 +270,10 @@ struct sccb_card { | |||
333 | #define F_NEW_SCCB_CMD 0x40 | 270 | #define F_NEW_SCCB_CMD 0x40 |
334 | #define F_UPDATE_EEPROM 0x80 | 271 | #define F_UPDATE_EEPROM 0x80 |
335 | 272 | ||
336 | |||
337 | #define ID_STRING_LENGTH 32 | 273 | #define ID_STRING_LENGTH 32 |
338 | #define TYPE_CODE0 0x63 /*Level2 Mstr (bits 7-6), */ | 274 | #define TYPE_CODE0 0x63 /*Level2 Mstr (bits 7-6), */ |
339 | 275 | ||
340 | 276 | #define SLV_TYPE_CODE0 0xA3 /*Priority Bit set (bits 7-6), */ | |
341 | #define SLV_TYPE_CODE0 0xA3 /*Priority Bit set (bits 7-6), */ | ||
342 | 277 | ||
343 | #define ASSIGN_ID 0x00 | 278 | #define ASSIGN_ID 0x00 |
344 | #define SET_P_FLAG 0x01 | 279 | #define SET_P_FLAG 0x01 |
@@ -351,23 +286,21 @@ struct sccb_card { | |||
351 | #define MISC_CODE 0x14 | 286 | #define MISC_CODE 0x14 |
352 | #define CLR_P_FLAG 0x18 | 287 | #define CLR_P_FLAG 0x18 |
353 | 288 | ||
354 | |||
355 | |||
356 | #define INIT_SELTD 0x01 | 289 | #define INIT_SELTD 0x01 |
357 | #define LEVEL2_TAR 0x02 | 290 | #define LEVEL2_TAR 0x02 |
358 | 291 | ||
359 | 292 | enum scam_id_st { ID0, ID1, ID2, ID3, ID4, ID5, ID6, ID7, ID8, ID9, ID10, ID11, | |
360 | enum scam_id_st { ID0,ID1,ID2,ID3,ID4,ID5,ID6,ID7,ID8,ID9,ID10,ID11,ID12, | 293 | ID12, |
361 | ID13,ID14,ID15,ID_UNUSED,ID_UNASSIGNED,ID_ASSIGNED,LEGACY, | 294 | ID13, ID14, ID15, ID_UNUSED, ID_UNASSIGNED, ID_ASSIGNED, LEGACY, |
362 | CLR_PRIORITY,NO_ID_AVAIL }; | 295 | CLR_PRIORITY, NO_ID_AVAIL |
296 | }; | ||
363 | 297 | ||
364 | typedef struct SCCBscam_info { | 298 | typedef struct SCCBscam_info { |
365 | 299 | ||
366 | unsigned char id_string[ID_STRING_LENGTH]; | 300 | unsigned char id_string[ID_STRING_LENGTH]; |
367 | enum scam_id_st state; | 301 | enum scam_id_st state; |
368 | |||
369 | } SCCBSCAM_INFO; | ||
370 | 302 | ||
303 | } SCCBSCAM_INFO; | ||
371 | 304 | ||
372 | #define SCSI_REQUEST_SENSE 0x03 | 305 | #define SCSI_REQUEST_SENSE 0x03 |
373 | #define SCSI_READ 0x08 | 306 | #define SCSI_READ 0x08 |
@@ -377,15 +310,10 @@ typedef struct SCCBscam_info { | |||
377 | #define SCSI_WRITE_EXTENDED 0x2A | 310 | #define SCSI_WRITE_EXTENDED 0x2A |
378 | #define SCSI_WRITE_AND_VERIFY 0x2E | 311 | #define SCSI_WRITE_AND_VERIFY 0x2E |
379 | 312 | ||
380 | |||
381 | |||
382 | #define SSGOOD 0x00 | 313 | #define SSGOOD 0x00 |
383 | #define SSCHECK 0x02 | 314 | #define SSCHECK 0x02 |
384 | #define SSQ_FULL 0x28 | 315 | #define SSQ_FULL 0x28 |
385 | 316 | ||
386 | |||
387 | |||
388 | |||
389 | #define SMCMD_COMP 0x00 | 317 | #define SMCMD_COMP 0x00 |
390 | #define SMEXT 0x01 | 318 | #define SMEXT 0x01 |
391 | #define SMSAVE_DATA_PTR 0x02 | 319 | #define SMSAVE_DATA_PTR 0x02 |
@@ -403,26 +331,17 @@ typedef struct SCCBscam_info { | |||
403 | #define SMIDENT 0x80 | 331 | #define SMIDENT 0x80 |
404 | #define DISC_PRIV 0x40 | 332 | #define DISC_PRIV 0x40 |
405 | 333 | ||
406 | |||
407 | #define SMSYNC 0x01 | 334 | #define SMSYNC 0x01 |
408 | #define SMWDTR 0x03 | 335 | #define SMWDTR 0x03 |
409 | #define SM8BIT 0x00 | 336 | #define SM8BIT 0x00 |
410 | #define SM16BIT 0x01 | 337 | #define SM16BIT 0x01 |
411 | #define SMIGNORWR 0x23 /* Ignore Wide Residue */ | 338 | #define SMIGNORWR 0x23 /* Ignore Wide Residue */ |
412 | |||
413 | |||
414 | |||
415 | |||
416 | |||
417 | |||
418 | |||
419 | 339 | ||
420 | #define SIX_BYTE_CMD 0x06 | 340 | #define SIX_BYTE_CMD 0x06 |
421 | #define TWELVE_BYTE_CMD 0x0C | 341 | #define TWELVE_BYTE_CMD 0x0C |
422 | 342 | ||
423 | #define ASYNC 0x00 | 343 | #define ASYNC 0x00 |
424 | #define MAX_OFFSET 0x0F /* Maxbyteoffset for Sync Xfers */ | 344 | #define MAX_OFFSET 0x0F /* Maxbyteoffset for Sync Xfers */ |
425 | |||
426 | 345 | ||
427 | #define EEPROM_WD_CNT 256 | 346 | #define EEPROM_WD_CNT 256 |
428 | 347 | ||
@@ -437,7 +356,6 @@ typedef struct SCCBscam_info { | |||
437 | #define SCAM_CONFIG 20 | 356 | #define SCAM_CONFIG 20 |
438 | #define ADAPTER_SCSI_ID 24 | 357 | #define ADAPTER_SCSI_ID 24 |
439 | 358 | ||
440 | |||
441 | #define IGNORE_B_SCAN 32 | 359 | #define IGNORE_B_SCAN 32 |
442 | #define SEND_START_ENA 34 | 360 | #define SEND_START_ENA 34 |
443 | #define DEVICE_ENABLE 36 | 361 | #define DEVICE_ENABLE 36 |
@@ -452,478 +370,385 @@ typedef struct SCCBscam_info { | |||
452 | #define SYNC_RATE_TBLcd 50 | 370 | #define SYNC_RATE_TBLcd 50 |
453 | #define SYNC_RATE_TBLef 52 | 371 | #define SYNC_RATE_TBLef 52 |
454 | 372 | ||
373 | #define EE_SCAMBASE 256 | ||
455 | 374 | ||
375 | #define SCAM_ENABLED BIT(2) | ||
376 | #define SCAM_LEVEL2 BIT(3) | ||
456 | 377 | ||
457 | #define EE_SCAMBASE 256 | 378 | #define RENEGO_ENA BITW(10) |
458 | 379 | #define CONNIO_ENA BITW(11) | |
459 | 380 | #define GREEN_PC_ENA BITW(12) | |
460 | |||
461 | #define SCAM_ENABLED BIT(2) | ||
462 | #define SCAM_LEVEL2 BIT(3) | ||
463 | |||
464 | |||
465 | #define RENEGO_ENA BITW(10) | ||
466 | #define CONNIO_ENA BITW(11) | ||
467 | #define GREEN_PC_ENA BITW(12) | ||
468 | |||
469 | 381 | ||
470 | #define AUTO_RATE_00 00 | 382 | #define AUTO_RATE_00 00 |
471 | #define AUTO_RATE_05 01 | 383 | #define AUTO_RATE_05 01 |
472 | #define AUTO_RATE_10 02 | 384 | #define AUTO_RATE_10 02 |
473 | #define AUTO_RATE_20 03 | 385 | #define AUTO_RATE_20 03 |
474 | 386 | ||
475 | #define WIDE_NEGO_BIT BIT(7) | 387 | #define WIDE_NEGO_BIT BIT(7) |
476 | #define DISC_ENABLE_BIT BIT(6) | 388 | #define DISC_ENABLE_BIT BIT(6) |
477 | 389 | ||
390 | #define hp_vendor_id_0 0x00 /* LSB */ | ||
391 | #define ORION_VEND_0 0x4B | ||
478 | 392 | ||
393 | #define hp_vendor_id_1 0x01 /* MSB */ | ||
394 | #define ORION_VEND_1 0x10 | ||
479 | 395 | ||
480 | #define hp_vendor_id_0 0x00 /* LSB */ | 396 | #define hp_device_id_0 0x02 /* LSB */ |
481 | #define ORION_VEND_0 0x4B | 397 | #define ORION_DEV_0 0x30 |
482 | |||
483 | #define hp_vendor_id_1 0x01 /* MSB */ | ||
484 | #define ORION_VEND_1 0x10 | ||
485 | 398 | ||
486 | #define hp_device_id_0 0x02 /* LSB */ | 399 | #define hp_device_id_1 0x03 /* MSB */ |
487 | #define ORION_DEV_0 0x30 | 400 | #define ORION_DEV_1 0x81 |
488 | |||
489 | #define hp_device_id_1 0x03 /* MSB */ | ||
490 | #define ORION_DEV_1 0x81 | ||
491 | 401 | ||
492 | /* Sub Vendor ID and Sub Device ID only available in | 402 | /* Sub Vendor ID and Sub Device ID only available in |
493 | Harpoon Version 2 and higher */ | 403 | Harpoon Version 2 and higher */ |
494 | |||
495 | #define hp_sub_device_id_0 0x06 /* LSB */ | ||
496 | |||
497 | |||
498 | |||
499 | #define hp_semaphore 0x0C | ||
500 | #define SCCB_MGR_ACTIVE BIT(0) | ||
501 | #define TICKLE_ME BIT(1) | ||
502 | #define SCCB_MGR_PRESENT BIT(3) | ||
503 | #define BIOS_IN_USE BIT(4) | ||
504 | |||
505 | |||
506 | |||
507 | #define hp_sys_ctrl 0x0F | ||
508 | |||
509 | #define STOP_CLK BIT(0) /*Turn off BusMaster Clock */ | ||
510 | #define DRVR_RST BIT(1) /*Firmware Reset to 80C15 chip */ | ||
511 | #define HALT_MACH BIT(3) /*Halt State Machine */ | ||
512 | #define HARD_ABORT BIT(4) /*Hard Abort */ | ||
513 | |||
514 | |||
515 | |||
516 | |||
517 | |||
518 | |||
519 | |||
520 | |||
521 | |||
522 | #define hp_host_blk_cnt 0x13 | ||
523 | |||
524 | #define XFER_BLK64 0x06 /* 1 1 0 64 byte per block*/ | ||
525 | |||
526 | #define BM_THRESHOLD 0x40 /* PCI mode can only xfer 16 bytes*/ | ||
527 | |||
528 | |||
529 | |||
530 | #define hp_int_mask 0x17 | ||
531 | |||
532 | #define INT_CMD_COMPL BIT(0) /* DMA command complete */ | ||
533 | #define INT_EXT_STATUS BIT(1) /* Extended Status Set */ | ||
534 | 404 | ||
405 | #define hp_sub_device_id_0 0x06 /* LSB */ | ||
535 | 406 | ||
536 | #define hp_xfer_cnt_lo 0x18 | 407 | #define hp_semaphore 0x0C |
537 | #define hp_xfer_cnt_hi 0x1A | 408 | #define SCCB_MGR_ACTIVE BIT(0) |
538 | #define hp_xfer_cmd 0x1B | 409 | #define TICKLE_ME BIT(1) |
410 | #define SCCB_MGR_PRESENT BIT(3) | ||
411 | #define BIOS_IN_USE BIT(4) | ||
539 | 412 | ||
540 | #define XFER_HOST_DMA 0x00 /* 0 0 0 Transfer Host -> DMA */ | 413 | #define hp_sys_ctrl 0x0F |
541 | #define XFER_DMA_HOST 0x01 /* 0 0 1 Transfer DMA -> Host */ | ||
542 | 414 | ||
415 | #define STOP_CLK BIT(0) /*Turn off BusMaster Clock */ | ||
416 | #define DRVR_RST BIT(1) /*Firmware Reset to 80C15 chip */ | ||
417 | #define HALT_MACH BIT(3) /*Halt State Machine */ | ||
418 | #define HARD_ABORT BIT(4) /*Hard Abort */ | ||
543 | 419 | ||
544 | #define XFER_HOST_AUTO 0x00 /* 0 0 Auto Transfer Size */ | 420 | #define hp_host_blk_cnt 0x13 |
545 | 421 | ||
546 | #define XFER_DMA_8BIT 0x20 /* 0 1 8 BIT Transfer Size */ | 422 | #define XFER_BLK64 0x06 /* 1 1 0 64 byte per block */ |
547 | 423 | ||
548 | #define DISABLE_INT BIT(7) /*Do not interrupt at end of cmd. */ | 424 | #define BM_THRESHOLD 0x40 /* PCI mode can only xfer 16 bytes */ |
549 | 425 | ||
550 | #define HOST_WRT_CMD ((DISABLE_INT + XFER_HOST_DMA + XFER_HOST_AUTO + XFER_DMA_8BIT)) | 426 | #define hp_int_mask 0x17 |
551 | #define HOST_RD_CMD ((DISABLE_INT + XFER_DMA_HOST + XFER_HOST_AUTO + XFER_DMA_8BIT)) | ||
552 | 427 | ||
553 | #define hp_host_addr_lo 0x1C | 428 | #define INT_CMD_COMPL BIT(0) /* DMA command complete */ |
554 | #define hp_host_addr_hmi 0x1E | 429 | #define INT_EXT_STATUS BIT(1) /* Extended Status Set */ |
555 | 430 | ||
556 | #define hp_ee_ctrl 0x22 | 431 | #define hp_xfer_cnt_lo 0x18 |
432 | #define hp_xfer_cnt_hi 0x1A | ||
433 | #define hp_xfer_cmd 0x1B | ||
557 | 434 | ||
558 | #define EXT_ARB_ACK BIT(7) | 435 | #define XFER_HOST_DMA 0x00 /* 0 0 0 Transfer Host -> DMA */ |
559 | #define SCSI_TERM_ENA_H BIT(6) /* SCSI high byte terminator */ | 436 | #define XFER_DMA_HOST 0x01 /* 0 0 1 Transfer DMA -> Host */ |
560 | #define SEE_MS BIT(5) | ||
561 | #define SEE_CS BIT(3) | ||
562 | #define SEE_CLK BIT(2) | ||
563 | #define SEE_DO BIT(1) | ||
564 | #define SEE_DI BIT(0) | ||
565 | 437 | ||
566 | #define EE_READ 0x06 | 438 | #define XFER_HOST_AUTO 0x00 /* 0 0 Auto Transfer Size */ |
567 | #define EE_WRITE 0x05 | ||
568 | #define EWEN 0x04 | ||
569 | #define EWEN_ADDR 0x03C0 | ||
570 | #define EWDS 0x04 | ||
571 | #define EWDS_ADDR 0x0000 | ||
572 | 439 | ||
440 | #define XFER_DMA_8BIT 0x20 /* 0 1 8 BIT Transfer Size */ | ||
573 | 441 | ||
442 | #define DISABLE_INT BIT(7) /*Do not interrupt at end of cmd. */ | ||
574 | 443 | ||
444 | #define HOST_WRT_CMD ((DISABLE_INT + XFER_HOST_DMA + XFER_HOST_AUTO + XFER_DMA_8BIT)) | ||
445 | #define HOST_RD_CMD ((DISABLE_INT + XFER_DMA_HOST + XFER_HOST_AUTO + XFER_DMA_8BIT)) | ||
575 | 446 | ||
447 | #define hp_host_addr_lo 0x1C | ||
448 | #define hp_host_addr_hmi 0x1E | ||
576 | 449 | ||
450 | #define hp_ee_ctrl 0x22 | ||
577 | 451 | ||
452 | #define EXT_ARB_ACK BIT(7) | ||
453 | #define SCSI_TERM_ENA_H BIT(6) /* SCSI high byte terminator */ | ||
454 | #define SEE_MS BIT(5) | ||
455 | #define SEE_CS BIT(3) | ||
456 | #define SEE_CLK BIT(2) | ||
457 | #define SEE_DO BIT(1) | ||
458 | #define SEE_DI BIT(0) | ||
578 | 459 | ||
579 | #define hp_bm_ctrl 0x26 | 460 | #define EE_READ 0x06 |
461 | #define EE_WRITE 0x05 | ||
462 | #define EWEN 0x04 | ||
463 | #define EWEN_ADDR 0x03C0 | ||
464 | #define EWDS 0x04 | ||
465 | #define EWDS_ADDR 0x0000 | ||
580 | 466 | ||
581 | #define SCSI_TERM_ENA_L BIT(0) /*Enable/Disable external terminators */ | 467 | #define hp_bm_ctrl 0x26 |
582 | #define FLUSH_XFER_CNTR BIT(1) /*Flush transfer counter */ | ||
583 | #define FORCE1_XFER BIT(5) /*Always xfer one byte in byte mode */ | ||
584 | #define FAST_SINGLE BIT(6) /*?? */ | ||
585 | 468 | ||
586 | #define BMCTRL_DEFAULT (FORCE1_XFER|FAST_SINGLE|SCSI_TERM_ENA_L) | 469 | #define SCSI_TERM_ENA_L BIT(0) /*Enable/Disable external terminators */ |
470 | #define FLUSH_XFER_CNTR BIT(1) /*Flush transfer counter */ | ||
471 | #define FORCE1_XFER BIT(5) /*Always xfer one byte in byte mode */ | ||
472 | #define FAST_SINGLE BIT(6) /*?? */ | ||
587 | 473 | ||
474 | #define BMCTRL_DEFAULT (FORCE1_XFER|FAST_SINGLE|SCSI_TERM_ENA_L) | ||
588 | 475 | ||
589 | #define hp_sg_addr 0x28 | 476 | #define hp_sg_addr 0x28 |
590 | #define hp_page_ctrl 0x29 | 477 | #define hp_page_ctrl 0x29 |
591 | 478 | ||
592 | #define SCATTER_EN BIT(0) | 479 | #define SCATTER_EN BIT(0) |
593 | #define SGRAM_ARAM BIT(1) | 480 | #define SGRAM_ARAM BIT(1) |
594 | #define G_INT_DISABLE BIT(3) /* Enable/Disable all Interrupts */ | 481 | #define G_INT_DISABLE BIT(3) /* Enable/Disable all Interrupts */ |
595 | #define NARROW_SCSI_CARD BIT(4) /* NARROW/WIDE SCSI config pin */ | 482 | #define NARROW_SCSI_CARD BIT(4) /* NARROW/WIDE SCSI config pin */ |
596 | 483 | ||
484 | #define hp_pci_stat_cfg 0x2D | ||
597 | 485 | ||
486 | #define REC_MASTER_ABORT BIT(5) /*received Master abort */ | ||
598 | 487 | ||
488 | #define hp_rev_num 0x33 | ||
599 | 489 | ||
600 | #define hp_pci_stat_cfg 0x2D | 490 | #define hp_stack_data 0x34 |
491 | #define hp_stack_addr 0x35 | ||
601 | 492 | ||
602 | #define REC_MASTER_ABORT BIT(5) /*received Master abort */ | 493 | #define hp_ext_status 0x36 |
603 | 494 | ||
604 | 495 | #define BM_FORCE_OFF BIT(0) /*Bus Master is forced to get off */ | |
605 | 496 | #define PCI_TGT_ABORT BIT(0) /*PCI bus master transaction aborted */ | |
606 | 497 | #define PCI_DEV_TMOUT BIT(1) /*PCI Device Time out */ | |
607 | 498 | #define CMD_ABORTED BIT(4) /*Command aborted */ | |
608 | 499 | #define BM_PARITY_ERR BIT(5) /*parity error on data received */ | |
609 | 500 | #define PIO_OVERRUN BIT(6) /*Slave data overrun */ | |
610 | 501 | #define BM_CMD_BUSY BIT(7) /*Bus master transfer command busy */ | |
611 | #define hp_rev_num 0x33 | 502 | #define BAD_EXT_STATUS (BM_FORCE_OFF | PCI_DEV_TMOUT | CMD_ABORTED | \ |
612 | |||
613 | |||
614 | #define hp_stack_data 0x34 | ||
615 | #define hp_stack_addr 0x35 | ||
616 | |||
617 | #define hp_ext_status 0x36 | ||
618 | |||
619 | #define BM_FORCE_OFF BIT(0) /*Bus Master is forced to get off */ | ||
620 | #define PCI_TGT_ABORT BIT(0) /*PCI bus master transaction aborted */ | ||
621 | #define PCI_DEV_TMOUT BIT(1) /*PCI Device Time out */ | ||
622 | #define CMD_ABORTED BIT(4) /*Command aborted */ | ||
623 | #define BM_PARITY_ERR BIT(5) /*parity error on data received */ | ||
624 | #define PIO_OVERRUN BIT(6) /*Slave data overrun */ | ||
625 | #define BM_CMD_BUSY BIT(7) /*Bus master transfer command busy */ | ||
626 | #define BAD_EXT_STATUS (BM_FORCE_OFF | PCI_DEV_TMOUT | CMD_ABORTED | \ | ||
627 | BM_PARITY_ERR | PIO_OVERRUN) | 503 | BM_PARITY_ERR | PIO_OVERRUN) |
628 | 504 | ||
629 | #define hp_int_status 0x37 | 505 | #define hp_int_status 0x37 |
630 | 506 | ||
631 | #define EXT_STATUS_ON BIT(1) /*Extended status is valid */ | 507 | #define EXT_STATUS_ON BIT(1) /*Extended status is valid */ |
632 | #define SCSI_INTERRUPT BIT(2) /*Global indication of a SCSI int. */ | 508 | #define SCSI_INTERRUPT BIT(2) /*Global indication of a SCSI int. */ |
633 | #define INT_ASSERTED BIT(5) /* */ | 509 | #define INT_ASSERTED BIT(5) /* */ |
634 | 510 | ||
635 | 511 | #define hp_fifo_cnt 0x38 | |
636 | #define hp_fifo_cnt 0x38 | 512 | |
637 | 513 | #define hp_intena 0x40 | |
638 | 514 | ||
639 | 515 | #define RESET BITW(7) | |
640 | 516 | #define PROG_HLT BITW(6) | |
641 | #define hp_intena 0x40 | 517 | #define PARITY BITW(5) |
642 | 518 | #define FIFO BITW(4) | |
643 | #define RESET BITW(7) | 519 | #define SEL BITW(3) |
644 | #define PROG_HLT BITW(6) | 520 | #define SCAM_SEL BITW(2) |
645 | #define PARITY BITW(5) | 521 | #define RSEL BITW(1) |
646 | #define FIFO BITW(4) | 522 | #define TIMEOUT BITW(0) |
647 | #define SEL BITW(3) | 523 | #define BUS_FREE BITW(15) |
648 | #define SCAM_SEL BITW(2) | 524 | #define XFER_CNT_0 BITW(14) |
649 | #define RSEL BITW(1) | 525 | #define PHASE BITW(13) |
650 | #define TIMEOUT BITW(0) | 526 | #define IUNKWN BITW(12) |
651 | #define BUS_FREE BITW(15) | 527 | #define ICMD_COMP BITW(11) |
652 | #define XFER_CNT_0 BITW(14) | 528 | #define ITICKLE BITW(10) |
653 | #define PHASE BITW(13) | 529 | #define IDO_STRT BITW(9) |
654 | #define IUNKWN BITW(12) | 530 | #define ITAR_DISC BITW(8) |
655 | #define ICMD_COMP BITW(11) | 531 | #define AUTO_INT (BITW(12)+BITW(11)+BITW(10)+BITW(9)+BITW(8)) |
656 | #define ITICKLE BITW(10) | 532 | #define CLR_ALL_INT 0xFFFF |
657 | #define IDO_STRT BITW(9) | 533 | #define CLR_ALL_INT_1 0xFF00 |
658 | #define ITAR_DISC BITW(8) | 534 | |
659 | #define AUTO_INT (BITW(12)+BITW(11)+BITW(10)+BITW(9)+BITW(8)) | 535 | #define hp_intstat 0x42 |
660 | #define CLR_ALL_INT 0xFFFF | 536 | |
661 | #define CLR_ALL_INT_1 0xFF00 | 537 | #define hp_scsisig 0x44 |
662 | 538 | ||
663 | #define hp_intstat 0x42 | 539 | #define SCSI_SEL BIT(7) |
664 | 540 | #define SCSI_BSY BIT(6) | |
665 | #define hp_scsisig 0x44 | 541 | #define SCSI_REQ BIT(5) |
666 | 542 | #define SCSI_ACK BIT(4) | |
667 | #define SCSI_SEL BIT(7) | 543 | #define SCSI_ATN BIT(3) |
668 | #define SCSI_BSY BIT(6) | 544 | #define SCSI_CD BIT(2) |
669 | #define SCSI_REQ BIT(5) | 545 | #define SCSI_MSG BIT(1) |
670 | #define SCSI_ACK BIT(4) | 546 | #define SCSI_IOBIT BIT(0) |
671 | #define SCSI_ATN BIT(3) | 547 | |
672 | #define SCSI_CD BIT(2) | 548 | #define S_SCSI_PHZ (BIT(2)+BIT(1)+BIT(0)) |
673 | #define SCSI_MSG BIT(1) | 549 | #define S_MSGO_PH (BIT(2)+BIT(1) ) |
674 | #define SCSI_IOBIT BIT(0) | 550 | #define S_MSGI_PH (BIT(2)+BIT(1)+BIT(0)) |
675 | 551 | #define S_DATAI_PH ( BIT(0)) | |
676 | #define S_SCSI_PHZ (BIT(2)+BIT(1)+BIT(0)) | 552 | #define S_DATAO_PH 0x00 |
677 | #define S_MSGO_PH (BIT(2)+BIT(1) ) | 553 | #define S_ILL_PH ( BIT(1) ) |
678 | #define S_MSGI_PH (BIT(2)+BIT(1)+BIT(0)) | 554 | |
679 | #define S_DATAI_PH ( BIT(0)) | 555 | #define hp_scsictrl_0 0x45 |
680 | #define S_DATAO_PH 0x00 | 556 | |
681 | #define S_ILL_PH ( BIT(1) ) | 557 | #define SEL_TAR BIT(6) |
682 | 558 | #define ENA_ATN BIT(4) | |
683 | #define hp_scsictrl_0 0x45 | 559 | #define ENA_RESEL BIT(2) |
560 | #define SCSI_RST BIT(1) | ||
561 | #define ENA_SCAM_SEL BIT(0) | ||
684 | 562 | ||
685 | #define SEL_TAR BIT(6) | 563 | #define hp_portctrl_0 0x46 |
686 | #define ENA_ATN BIT(4) | ||
687 | #define ENA_RESEL BIT(2) | ||
688 | #define SCSI_RST BIT(1) | ||
689 | #define ENA_SCAM_SEL BIT(0) | ||
690 | 564 | ||
565 | #define SCSI_PORT BIT(7) | ||
566 | #define SCSI_INBIT BIT(6) | ||
567 | #define DMA_PORT BIT(5) | ||
568 | #define DMA_RD BIT(4) | ||
569 | #define HOST_PORT BIT(3) | ||
570 | #define HOST_WRT BIT(2) | ||
571 | #define SCSI_BUS_EN BIT(1) | ||
572 | #define START_TO BIT(0) | ||
691 | 573 | ||
574 | #define hp_scsireset 0x47 | ||
692 | 575 | ||
693 | #define hp_portctrl_0 0x46 | 576 | #define SCSI_INI BIT(6) |
577 | #define SCAM_EN BIT(5) | ||
578 | #define DMA_RESET BIT(3) | ||
579 | #define HPSCSI_RESET BIT(2) | ||
580 | #define PROG_RESET BIT(1) | ||
581 | #define FIFO_CLR BIT(0) | ||
694 | 582 | ||
695 | #define SCSI_PORT BIT(7) | 583 | #define hp_xfercnt_0 0x48 |
696 | #define SCSI_INBIT BIT(6) | 584 | #define hp_xfercnt_2 0x4A |
697 | #define DMA_PORT BIT(5) | ||
698 | #define DMA_RD BIT(4) | ||
699 | #define HOST_PORT BIT(3) | ||
700 | #define HOST_WRT BIT(2) | ||
701 | #define SCSI_BUS_EN BIT(1) | ||
702 | #define START_TO BIT(0) | ||
703 | 585 | ||
704 | #define hp_scsireset 0x47 | 586 | #define hp_fifodata_0 0x4C |
587 | #define hp_addstat 0x4E | ||
705 | 588 | ||
706 | #define SCSI_INI BIT(6) | 589 | #define SCAM_TIMER BIT(7) |
707 | #define SCAM_EN BIT(5) | 590 | #define SCSI_MODE8 BIT(3) |
708 | #define DMA_RESET BIT(3) | 591 | #define SCSI_PAR_ERR BIT(0) |
709 | #define HPSCSI_RESET BIT(2) | ||
710 | #define PROG_RESET BIT(1) | ||
711 | #define FIFO_CLR BIT(0) | ||
712 | 592 | ||
713 | #define hp_xfercnt_0 0x48 | 593 | #define hp_prgmcnt_0 0x4F |
714 | #define hp_xfercnt_2 0x4A | ||
715 | 594 | ||
716 | #define hp_fifodata_0 0x4C | 595 | #define hp_selfid_0 0x50 |
717 | #define hp_addstat 0x4E | 596 | #define hp_selfid_1 0x51 |
597 | #define hp_arb_id 0x52 | ||
718 | 598 | ||
719 | #define SCAM_TIMER BIT(7) | 599 | #define hp_select_id 0x53 |
720 | #define SCSI_MODE8 BIT(3) | ||
721 | #define SCSI_PAR_ERR BIT(0) | ||
722 | 600 | ||
723 | #define hp_prgmcnt_0 0x4F | 601 | #define hp_synctarg_base 0x54 |
602 | #define hp_synctarg_12 0x54 | ||
603 | #define hp_synctarg_13 0x55 | ||
604 | #define hp_synctarg_14 0x56 | ||
605 | #define hp_synctarg_15 0x57 | ||
724 | 606 | ||
607 | #define hp_synctarg_8 0x58 | ||
608 | #define hp_synctarg_9 0x59 | ||
609 | #define hp_synctarg_10 0x5A | ||
610 | #define hp_synctarg_11 0x5B | ||
725 | 611 | ||
726 | #define hp_selfid_0 0x50 | 612 | #define hp_synctarg_4 0x5C |
727 | #define hp_selfid_1 0x51 | 613 | #define hp_synctarg_5 0x5D |
728 | #define hp_arb_id 0x52 | 614 | #define hp_synctarg_6 0x5E |
615 | #define hp_synctarg_7 0x5F | ||
729 | 616 | ||
617 | #define hp_synctarg_0 0x60 | ||
618 | #define hp_synctarg_1 0x61 | ||
619 | #define hp_synctarg_2 0x62 | ||
620 | #define hp_synctarg_3 0x63 | ||
730 | 621 | ||
731 | #define hp_select_id 0x53 | 622 | #define NARROW_SCSI BIT(4) |
623 | #define DEFAULT_OFFSET 0x0F | ||
732 | 624 | ||
625 | #define hp_autostart_0 0x64 | ||
626 | #define hp_autostart_1 0x65 | ||
627 | #define hp_autostart_3 0x67 | ||
733 | 628 | ||
734 | #define hp_synctarg_base 0x54 | 629 | #define AUTO_IMMED BIT(5) |
735 | #define hp_synctarg_12 0x54 | 630 | #define SELECT BIT(6) |
736 | #define hp_synctarg_13 0x55 | 631 | #define END_DATA (BIT(7)+BIT(6)) |
737 | #define hp_synctarg_14 0x56 | ||
738 | #define hp_synctarg_15 0x57 | ||
739 | 632 | ||
740 | #define hp_synctarg_8 0x58 | 633 | #define hp_gp_reg_0 0x68 |
741 | #define hp_synctarg_9 0x59 | 634 | #define hp_gp_reg_1 0x69 |
742 | #define hp_synctarg_10 0x5A | 635 | #define hp_gp_reg_3 0x6B |
743 | #define hp_synctarg_11 0x5B | ||
744 | 636 | ||
745 | #define hp_synctarg_4 0x5C | 637 | #define hp_seltimeout 0x6C |
746 | #define hp_synctarg_5 0x5D | ||
747 | #define hp_synctarg_6 0x5E | ||
748 | #define hp_synctarg_7 0x5F | ||
749 | 638 | ||
750 | #define hp_synctarg_0 0x60 | 639 | #define TO_4ms 0x67 /* 3.9959ms */ |
751 | #define hp_synctarg_1 0x61 | ||
752 | #define hp_synctarg_2 0x62 | ||
753 | #define hp_synctarg_3 0x63 | ||
754 | 640 | ||
755 | #define NARROW_SCSI BIT(4) | 641 | #define TO_5ms 0x03 /* 4.9152ms */ |
756 | #define DEFAULT_OFFSET 0x0F | 642 | #define TO_10ms 0x07 /* 11.xxxms */ |
643 | #define TO_250ms 0x99 /* 250.68ms */ | ||
644 | #define TO_290ms 0xB1 /* 289.99ms */ | ||
757 | 645 | ||
758 | #define hp_autostart_0 0x64 | 646 | #define hp_clkctrl_0 0x6D |
759 | #define hp_autostart_1 0x65 | ||
760 | #define hp_autostart_3 0x67 | ||
761 | 647 | ||
648 | #define PWR_DWN BIT(6) | ||
649 | #define ACTdeassert BIT(4) | ||
650 | #define CLK_40MHZ (BIT(1) + BIT(0)) | ||
762 | 651 | ||
652 | #define CLKCTRL_DEFAULT (ACTdeassert | CLK_40MHZ) | ||
763 | 653 | ||
764 | #define AUTO_IMMED BIT(5) | 654 | #define hp_fiforead 0x6E |
765 | #define SELECT BIT(6) | 655 | #define hp_fifowrite 0x6F |
766 | #define END_DATA (BIT(7)+BIT(6)) | ||
767 | 656 | ||
768 | #define hp_gp_reg_0 0x68 | 657 | #define hp_offsetctr 0x70 |
769 | #define hp_gp_reg_1 0x69 | 658 | #define hp_xferstat 0x71 |
770 | #define hp_gp_reg_3 0x6B | ||
771 | 659 | ||
772 | #define hp_seltimeout 0x6C | 660 | #define FIFO_EMPTY BIT(6) |
773 | 661 | ||
662 | #define hp_portctrl_1 0x72 | ||
774 | 663 | ||
775 | #define TO_4ms 0x67 /* 3.9959ms */ | 664 | #define CHK_SCSI_P BIT(3) |
665 | #define HOST_MODE8 BIT(0) | ||
776 | 666 | ||
777 | #define TO_5ms 0x03 /* 4.9152ms */ | 667 | #define hp_xfer_pad 0x73 |
778 | #define TO_10ms 0x07 /* 11.xxxms */ | ||
779 | #define TO_250ms 0x99 /* 250.68ms */ | ||
780 | #define TO_290ms 0xB1 /* 289.99ms */ | ||
781 | 668 | ||
782 | #define hp_clkctrl_0 0x6D | 669 | #define ID_UNLOCK BIT(3) |
783 | 670 | ||
784 | #define PWR_DWN BIT(6) | 671 | #define hp_scsidata_0 0x74 |
785 | #define ACTdeassert BIT(4) | 672 | #define hp_scsidata_1 0x75 |
786 | #define CLK_40MHZ (BIT(1) + BIT(0)) | ||
787 | 673 | ||
788 | #define CLKCTRL_DEFAULT (ACTdeassert | CLK_40MHZ) | 674 | #define hp_aramBase 0x80 |
675 | #define BIOS_DATA_OFFSET 0x60 | ||
676 | #define BIOS_RELATIVE_CARD 0x64 | ||
789 | 677 | ||
790 | #define hp_fiforead 0x6E | 678 | #define AR3 (BITW(9) + BITW(8)) |
791 | #define hp_fifowrite 0x6F | 679 | #define SDATA BITW(10) |
792 | 680 | ||
793 | #define hp_offsetctr 0x70 | 681 | #define CRD_OP BITW(11) /* Cmp Reg. w/ Data */ |
794 | #define hp_xferstat 0x71 | ||
795 | 682 | ||
796 | #define FIFO_EMPTY BIT(6) | 683 | #define CRR_OP BITW(12) /* Cmp Reg. w. Reg. */ |
797 | 684 | ||
798 | #define hp_portctrl_1 0x72 | 685 | #define CPE_OP (BITW(14)+BITW(11)) /* Cmp SCSI phs & Branch EQ */ |
799 | 686 | ||
800 | #define CHK_SCSI_P BIT(3) | 687 | #define CPN_OP (BITW(14)+BITW(12)) /* Cmp SCSI phs & Branch NOT EQ */ |
801 | #define HOST_MODE8 BIT(0) | ||
802 | 688 | ||
803 | #define hp_xfer_pad 0x73 | 689 | #define ADATA_OUT 0x00 |
690 | #define ADATA_IN BITW(8) | ||
691 | #define ACOMMAND BITW(10) | ||
692 | #define ASTATUS (BITW(10)+BITW(8)) | ||
693 | #define AMSG_OUT (BITW(10)+BITW(9)) | ||
694 | #define AMSG_IN (BITW(10)+BITW(9)+BITW(8)) | ||
804 | 695 | ||
805 | #define ID_UNLOCK BIT(3) | 696 | #define BRH_OP BITW(13) /* Branch */ |
806 | 697 | ||
807 | #define hp_scsidata_0 0x74 | 698 | #define ALWAYS 0x00 |
808 | #define hp_scsidata_1 0x75 | 699 | #define EQUAL BITW(8) |
700 | #define NOT_EQ BITW(9) | ||
809 | 701 | ||
702 | #define TCB_OP (BITW(13)+BITW(11)) /* Test condition & branch */ | ||
810 | 703 | ||
704 | #define FIFO_0 BITW(10) | ||
811 | 705 | ||
812 | #define hp_aramBase 0x80 | 706 | #define MPM_OP BITW(15) /* Match phase and move data */ |
813 | #define BIOS_DATA_OFFSET 0x60 | ||
814 | #define BIOS_RELATIVE_CARD 0x64 | ||
815 | 707 | ||
708 | #define MRR_OP BITW(14) /* Move DReg. to Reg. */ | ||
816 | 709 | ||
710 | #define S_IDREG (BIT(2)+BIT(1)+BIT(0)) | ||
817 | 711 | ||
712 | #define D_AR0 0x00 | ||
713 | #define D_AR1 BIT(0) | ||
714 | #define D_BUCKET (BIT(2) + BIT(1) + BIT(0)) | ||
818 | 715 | ||
819 | #define AR3 (BITW(9) + BITW(8)) | 716 | #define RAT_OP (BITW(14)+BITW(13)+BITW(11)) |
820 | #define SDATA BITW(10) | ||
821 | |||
822 | |||
823 | #define CRD_OP BITW(11) /* Cmp Reg. w/ Data */ | ||
824 | |||
825 | #define CRR_OP BITW(12) /* Cmp Reg. w. Reg. */ | ||
826 | |||
827 | |||
828 | |||
829 | #define CPE_OP (BITW(14)+BITW(11)) /* Cmp SCSI phs & Branch EQ */ | ||
830 | |||
831 | #define CPN_OP (BITW(14)+BITW(12)) /* Cmp SCSI phs & Branch NOT EQ */ | ||
832 | |||
833 | |||
834 | #define ADATA_OUT 0x00 | ||
835 | #define ADATA_IN BITW(8) | ||
836 | #define ACOMMAND BITW(10) | ||
837 | #define ASTATUS (BITW(10)+BITW(8)) | ||
838 | #define AMSG_OUT (BITW(10)+BITW(9)) | ||
839 | #define AMSG_IN (BITW(10)+BITW(9)+BITW(8)) | ||
840 | |||
841 | |||
842 | #define BRH_OP BITW(13) /* Branch */ | ||
843 | |||
844 | |||
845 | #define ALWAYS 0x00 | ||
846 | #define EQUAL BITW(8) | ||
847 | #define NOT_EQ BITW(9) | ||
848 | |||
849 | #define TCB_OP (BITW(13)+BITW(11)) /* Test condition & branch */ | ||
850 | |||
851 | |||
852 | #define FIFO_0 BITW(10) | ||
853 | |||
854 | |||
855 | #define MPM_OP BITW(15) /* Match phase and move data */ | ||
856 | |||
857 | |||
858 | #define MRR_OP BITW(14) /* Move DReg. to Reg. */ | ||
859 | |||
860 | |||
861 | #define S_IDREG (BIT(2)+BIT(1)+BIT(0)) | ||
862 | |||
863 | |||
864 | #define D_AR0 0x00 | ||
865 | #define D_AR1 BIT(0) | ||
866 | #define D_BUCKET (BIT(2) + BIT(1) + BIT(0)) | ||
867 | |||
868 | |||
869 | |||
870 | |||
871 | |||
872 | |||
873 | |||
874 | |||
875 | |||
876 | #define RAT_OP (BITW(14)+BITW(13)+BITW(11)) | ||
877 | |||
878 | #define SSI_OP (BITW(15)+BITW(11)) | ||
879 | |||
880 | |||
881 | #define SSI_ITAR_DISC (ITAR_DISC >> 8) | ||
882 | #define SSI_IDO_STRT (IDO_STRT >> 8) | ||
883 | |||
884 | #define SSI_ICMD_COMP (ICMD_COMP >> 8) | ||
885 | #define SSI_ITICKLE (ITICKLE >> 8) | ||
886 | |||
887 | #define SSI_IUNKWN (IUNKWN >> 8) | ||
888 | #define SSI_INO_CC (IUNKWN >> 8) | ||
889 | #define SSI_IRFAIL (IUNKWN >> 8) | ||
890 | |||
891 | |||
892 | #define NP 0x10 /*Next Phase */ | ||
893 | #define NTCMD 0x02 /*Non- Tagged Command start */ | ||
894 | #define CMDPZ 0x04 /*Command phase */ | ||
895 | #define DINT 0x12 /*Data Out/In interrupt */ | ||
896 | #define DI 0x13 /*Data Out */ | ||
897 | #define DC 0x19 /*Disconnect Message */ | ||
898 | #define ST 0x1D /*Status Phase */ | ||
899 | #define UNKNWN 0x24 /*Unknown bus action */ | ||
900 | #define CC 0x25 /*Command Completion failure */ | ||
901 | #define TICK 0x26 /*New target reselected us. */ | ||
902 | #define SELCHK 0x28 /*Select & Check SCSI ID latch reg */ | ||
903 | |||
904 | |||
905 | #define ID_MSG_STRT hp_aramBase + 0x00 | ||
906 | #define NON_TAG_ID_MSG hp_aramBase + 0x06 | ||
907 | #define CMD_STRT hp_aramBase + 0x08 | ||
908 | #define SYNC_MSGS hp_aramBase + 0x08 | ||
909 | |||
910 | |||
911 | |||
912 | |||
913 | |||
914 | #define TAG_STRT 0x00 | ||
915 | #define DISCONNECT_START 0x10/2 | ||
916 | #define END_DATA_START 0x14/2 | ||
917 | #define CMD_ONLY_STRT CMDPZ/2 | ||
918 | #define SELCHK_STRT SELCHK/2 | ||
919 | |||
920 | 717 | ||
718 | #define SSI_OP (BITW(15)+BITW(11)) | ||
921 | 719 | ||
720 | #define SSI_ITAR_DISC (ITAR_DISC >> 8) | ||
721 | #define SSI_IDO_STRT (IDO_STRT >> 8) | ||
922 | 722 | ||
723 | #define SSI_ICMD_COMP (ICMD_COMP >> 8) | ||
724 | #define SSI_ITICKLE (ITICKLE >> 8) | ||
923 | 725 | ||
726 | #define SSI_IUNKWN (IUNKWN >> 8) | ||
727 | #define SSI_INO_CC (IUNKWN >> 8) | ||
728 | #define SSI_IRFAIL (IUNKWN >> 8) | ||
924 | 729 | ||
730 | #define NP 0x10 /*Next Phase */ | ||
731 | #define NTCMD 0x02 /*Non- Tagged Command start */ | ||
732 | #define CMDPZ 0x04 /*Command phase */ | ||
733 | #define DINT 0x12 /*Data Out/In interrupt */ | ||
734 | #define DI 0x13 /*Data Out */ | ||
735 | #define DC 0x19 /*Disconnect Message */ | ||
736 | #define ST 0x1D /*Status Phase */ | ||
737 | #define UNKNWN 0x24 /*Unknown bus action */ | ||
738 | #define CC 0x25 /*Command Completion failure */ | ||
739 | #define TICK 0x26 /*New target reselected us. */ | ||
740 | #define SELCHK 0x28 /*Select & Check SCSI ID latch reg */ | ||
925 | 741 | ||
742 | #define ID_MSG_STRT hp_aramBase + 0x00 | ||
743 | #define NON_TAG_ID_MSG hp_aramBase + 0x06 | ||
744 | #define CMD_STRT hp_aramBase + 0x08 | ||
745 | #define SYNC_MSGS hp_aramBase + 0x08 | ||
926 | 746 | ||
747 | #define TAG_STRT 0x00 | ||
748 | #define DISCONNECT_START 0x10/2 | ||
749 | #define END_DATA_START 0x14/2 | ||
750 | #define CMD_ONLY_STRT CMDPZ/2 | ||
751 | #define SELCHK_STRT SELCHK/2 | ||
927 | 752 | ||
928 | #define GET_XFER_CNT(port, xfercnt) {RD_HARP32(port,hp_xfercnt_0,xfercnt); xfercnt &= 0xFFFFFF;} | 753 | #define GET_XFER_CNT(port, xfercnt) {RD_HARP32(port,hp_xfercnt_0,xfercnt); xfercnt &= 0xFFFFFF;} |
929 | /* #define GET_XFER_CNT(port, xfercnt) (xfercnt = RD_HARPOON(port+hp_xfercnt_2), \ | 754 | /* #define GET_XFER_CNT(port, xfercnt) (xfercnt = RD_HARPOON(port+hp_xfercnt_2), \ |
@@ -941,12 +766,9 @@ typedef struct SCCBscam_info { | |||
941 | #define ACCEPT_MSG(port) {while(RD_HARPOON(port+hp_scsisig) & SCSI_REQ){}\ | 766 | #define ACCEPT_MSG(port) {while(RD_HARPOON(port+hp_scsisig) & SCSI_REQ){}\ |
942 | WR_HARPOON(port+hp_scsisig, S_ILL_PH);} | 767 | WR_HARPOON(port+hp_scsisig, S_ILL_PH);} |
943 | 768 | ||
944 | |||
945 | #define ACCEPT_MSG_ATN(port) {while(RD_HARPOON(port+hp_scsisig) & SCSI_REQ){}\ | 769 | #define ACCEPT_MSG_ATN(port) {while(RD_HARPOON(port+hp_scsisig) & SCSI_REQ){}\ |
946 | WR_HARPOON(port+hp_scsisig, (S_ILL_PH|SCSI_ATN));} | 770 | WR_HARPOON(port+hp_scsisig, (S_ILL_PH|SCSI_ATN));} |
947 | 771 | ||
948 | |||
949 | |||
950 | #define DISABLE_AUTO(port) (WR_HARPOON(port+hp_scsireset, PROG_RESET),\ | 772 | #define DISABLE_AUTO(port) (WR_HARPOON(port+hp_scsireset, PROG_RESET),\ |
951 | WR_HARPOON(port+hp_scsireset, 0x00)) | 773 | WR_HARPOON(port+hp_scsireset, 0x00)) |
952 | 774 | ||
@@ -962,139 +784,146 @@ typedef struct SCCBscam_info { | |||
962 | #define MENABLE_INT(p_port) (WR_HARPOON(p_port+hp_page_ctrl, \ | 784 | #define MENABLE_INT(p_port) (WR_HARPOON(p_port+hp_page_ctrl, \ |
963 | (RD_HARPOON(p_port+hp_page_ctrl) & ~G_INT_DISABLE))) | 785 | (RD_HARPOON(p_port+hp_page_ctrl) & ~G_INT_DISABLE))) |
964 | 786 | ||
965 | 787 | static unsigned char FPT_sisyncn(unsigned long port, unsigned char p_card, | |
966 | 788 | unsigned char syncFlag); | |
967 | 789 | static void FPT_ssel(unsigned long port, unsigned char p_card); | |
968 | static unsigned char FPT_sisyncn(unsigned long port, unsigned char p_card, unsigned char syncFlag); | 790 | static void FPT_sres(unsigned long port, unsigned char p_card, |
969 | static void FPT_ssel(unsigned long port, unsigned char p_card); | 791 | struct sccb_card *pCurrCard); |
970 | static void FPT_sres(unsigned long port, unsigned char p_card, struct sccb_card * pCurrCard); | 792 | static void FPT_shandem(unsigned long port, unsigned char p_card, |
971 | static void FPT_shandem(unsigned long port, unsigned char p_card,struct sccb * pCurrSCCB); | 793 | struct sccb *pCurrSCCB); |
972 | static void FPT_stsyncn(unsigned long port, unsigned char p_card); | 794 | static void FPT_stsyncn(unsigned long port, unsigned char p_card); |
973 | static void FPT_sisyncr(unsigned long port,unsigned char sync_pulse, unsigned char offset); | 795 | static void FPT_sisyncr(unsigned long port, unsigned char sync_pulse, |
974 | static void FPT_sssyncv(unsigned long p_port, unsigned char p_id, unsigned char p_sync_value, | 796 | unsigned char offset); |
975 | struct sccb_mgr_tar_info * currTar_Info); | 797 | static void FPT_sssyncv(unsigned long p_port, unsigned char p_id, |
976 | static void FPT_sresb(unsigned long port, unsigned char p_card); | 798 | unsigned char p_sync_value, |
977 | static void FPT_sxfrp(unsigned long p_port, unsigned char p_card); | 799 | struct sccb_mgr_tar_info *currTar_Info); |
978 | static void FPT_schkdd(unsigned long port, unsigned char p_card); | 800 | static void FPT_sresb(unsigned long port, unsigned char p_card); |
801 | static void FPT_sxfrp(unsigned long p_port, unsigned char p_card); | ||
802 | static void FPT_schkdd(unsigned long port, unsigned char p_card); | ||
979 | static unsigned char FPT_RdStack(unsigned long port, unsigned char index); | 803 | static unsigned char FPT_RdStack(unsigned long port, unsigned char index); |
980 | static void FPT_WrStack(unsigned long portBase, unsigned char index, unsigned char data); | 804 | static void FPT_WrStack(unsigned long portBase, unsigned char index, |
805 | unsigned char data); | ||
981 | static unsigned char FPT_ChkIfChipInitialized(unsigned long ioPort); | 806 | static unsigned char FPT_ChkIfChipInitialized(unsigned long ioPort); |
982 | 807 | ||
983 | static void FPT_SendMsg(unsigned long port, unsigned char message); | 808 | static void FPT_SendMsg(unsigned long port, unsigned char message); |
984 | static void FPT_queueFlushTargSccb(unsigned char p_card, unsigned char thisTarg, | 809 | static void FPT_queueFlushTargSccb(unsigned char p_card, unsigned char thisTarg, |
985 | unsigned char error_code); | 810 | unsigned char error_code); |
986 | 811 | ||
987 | static void FPT_sinits(struct sccb * p_sccb, unsigned char p_card); | 812 | static void FPT_sinits(struct sccb *p_sccb, unsigned char p_card); |
988 | static void FPT_RNVRamData(struct nvram_info * pNvRamInfo); | 813 | static void FPT_RNVRamData(struct nvram_info *pNvRamInfo); |
989 | 814 | ||
990 | static unsigned char FPT_siwidn(unsigned long port, unsigned char p_card); | 815 | static unsigned char FPT_siwidn(unsigned long port, unsigned char p_card); |
991 | static void FPT_stwidn(unsigned long port, unsigned char p_card); | 816 | static void FPT_stwidn(unsigned long port, unsigned char p_card); |
992 | static void FPT_siwidr(unsigned long port, unsigned char width); | 817 | static void FPT_siwidr(unsigned long port, unsigned char width); |
993 | 818 | ||
994 | 819 | static void FPT_queueSelectFail(struct sccb_card *pCurrCard, | |
995 | static void FPT_queueSelectFail(struct sccb_card * pCurrCard, unsigned char p_card); | 820 | unsigned char p_card); |
996 | static void FPT_queueDisconnect(struct sccb * p_SCCB, unsigned char p_card); | 821 | static void FPT_queueDisconnect(struct sccb *p_SCCB, unsigned char p_card); |
997 | static void FPT_queueCmdComplete(struct sccb_card * pCurrCard, struct sccb * p_SCCB, | 822 | static void FPT_queueCmdComplete(struct sccb_card *pCurrCard, |
823 | struct sccb *p_SCCB, unsigned char p_card); | ||
824 | static void FPT_queueSearchSelect(struct sccb_card *pCurrCard, | ||
998 | unsigned char p_card); | 825 | unsigned char p_card); |
999 | static void FPT_queueSearchSelect(struct sccb_card * pCurrCard, unsigned char p_card); | 826 | static void FPT_queueFlushSccb(unsigned char p_card, unsigned char error_code); |
1000 | static void FPT_queueFlushSccb(unsigned char p_card, unsigned char error_code); | 827 | static void FPT_queueAddSccb(struct sccb *p_SCCB, unsigned char card); |
1001 | static void FPT_queueAddSccb(struct sccb * p_SCCB, unsigned char card); | 828 | static unsigned char FPT_queueFindSccb(struct sccb *p_SCCB, |
1002 | static unsigned char FPT_queueFindSccb(struct sccb * p_SCCB, unsigned char p_card); | 829 | unsigned char p_card); |
1003 | static void FPT_utilUpdateResidual(struct sccb * p_SCCB); | 830 | static void FPT_utilUpdateResidual(struct sccb *p_SCCB); |
1004 | static unsigned short FPT_CalcCrc16(unsigned char buffer[]); | 831 | static unsigned short FPT_CalcCrc16(unsigned char buffer[]); |
1005 | static unsigned char FPT_CalcLrc(unsigned char buffer[]); | 832 | static unsigned char FPT_CalcLrc(unsigned char buffer[]); |
1006 | 833 | ||
1007 | 834 | static void FPT_Wait1Second(unsigned long p_port); | |
1008 | static void FPT_Wait1Second(unsigned long p_port); | 835 | static void FPT_Wait(unsigned long p_port, unsigned char p_delay); |
1009 | static void FPT_Wait(unsigned long p_port, unsigned char p_delay); | 836 | static void FPT_utilEEWriteOnOff(unsigned long p_port, unsigned char p_mode); |
1010 | static void FPT_utilEEWriteOnOff(unsigned long p_port,unsigned char p_mode); | 837 | static void FPT_utilEEWrite(unsigned long p_port, unsigned short ee_data, |
1011 | static void FPT_utilEEWrite(unsigned long p_port, unsigned short ee_data, unsigned short ee_addr); | 838 | unsigned short ee_addr); |
1012 | static unsigned short FPT_utilEERead(unsigned long p_port, unsigned short ee_addr); | 839 | static unsigned short FPT_utilEERead(unsigned long p_port, |
1013 | static unsigned short FPT_utilEEReadOrg(unsigned long p_port, unsigned short ee_addr); | 840 | unsigned short ee_addr); |
1014 | static void FPT_utilEESendCmdAddr(unsigned long p_port, unsigned char ee_cmd, unsigned short ee_addr); | 841 | static unsigned short FPT_utilEEReadOrg(unsigned long p_port, |
1015 | 842 | unsigned short ee_addr); | |
1016 | 843 | static void FPT_utilEESendCmdAddr(unsigned long p_port, unsigned char ee_cmd, | |
1017 | 844 | unsigned short ee_addr); | |
1018 | static void FPT_phaseDataOut(unsigned long port, unsigned char p_card); | 845 | |
1019 | static void FPT_phaseDataIn(unsigned long port, unsigned char p_card); | 846 | static void FPT_phaseDataOut(unsigned long port, unsigned char p_card); |
1020 | static void FPT_phaseCommand(unsigned long port, unsigned char p_card); | 847 | static void FPT_phaseDataIn(unsigned long port, unsigned char p_card); |
1021 | static void FPT_phaseStatus(unsigned long port, unsigned char p_card); | 848 | static void FPT_phaseCommand(unsigned long port, unsigned char p_card); |
1022 | static void FPT_phaseMsgOut(unsigned long port, unsigned char p_card); | 849 | static void FPT_phaseStatus(unsigned long port, unsigned char p_card); |
1023 | static void FPT_phaseMsgIn(unsigned long port, unsigned char p_card); | 850 | static void FPT_phaseMsgOut(unsigned long port, unsigned char p_card); |
1024 | static void FPT_phaseIllegal(unsigned long port, unsigned char p_card); | 851 | static void FPT_phaseMsgIn(unsigned long port, unsigned char p_card); |
1025 | 852 | static void FPT_phaseIllegal(unsigned long port, unsigned char p_card); | |
1026 | static void FPT_phaseDecode(unsigned long port, unsigned char p_card); | 853 | |
1027 | static void FPT_phaseChkFifo(unsigned long port, unsigned char p_card); | 854 | static void FPT_phaseDecode(unsigned long port, unsigned char p_card); |
1028 | static void FPT_phaseBusFree(unsigned long p_port, unsigned char p_card); | 855 | static void FPT_phaseChkFifo(unsigned long port, unsigned char p_card); |
1029 | 856 | static void FPT_phaseBusFree(unsigned long p_port, unsigned char p_card); | |
1030 | 857 | ||
1031 | 858 | static void FPT_XbowInit(unsigned long port, unsigned char scamFlg); | |
1032 | 859 | static void FPT_BusMasterInit(unsigned long p_port); | |
1033 | static void FPT_XbowInit(unsigned long port, unsigned char scamFlg); | 860 | static void FPT_DiagEEPROM(unsigned long p_port); |
1034 | static void FPT_BusMasterInit(unsigned long p_port); | 861 | |
1035 | static void FPT_DiagEEPROM(unsigned long p_port); | 862 | static void FPT_dataXferProcessor(unsigned long port, |
1036 | 863 | struct sccb_card *pCurrCard); | |
1037 | 864 | static void FPT_busMstrSGDataXferStart(unsigned long port, | |
1038 | 865 | struct sccb *pCurrSCCB); | |
1039 | 866 | static void FPT_busMstrDataXferStart(unsigned long port, | |
1040 | static void FPT_dataXferProcessor(unsigned long port, struct sccb_card * pCurrCard); | 867 | struct sccb *pCurrSCCB); |
1041 | static void FPT_busMstrSGDataXferStart(unsigned long port, struct sccb * pCurrSCCB); | 868 | static void FPT_hostDataXferAbort(unsigned long port, unsigned char p_card, |
1042 | static void FPT_busMstrDataXferStart(unsigned long port, struct sccb * pCurrSCCB); | 869 | struct sccb *pCurrSCCB); |
1043 | static void FPT_hostDataXferAbort(unsigned long port, unsigned char p_card, struct sccb * pCurrSCCB); | 870 | static void FPT_hostDataXferRestart(struct sccb *currSCCB); |
1044 | static void FPT_hostDataXferRestart(struct sccb * currSCCB); | 871 | |
1045 | 872 | static unsigned char FPT_SccbMgr_bad_isr(unsigned long p_port, | |
1046 | 873 | unsigned char p_card, | |
1047 | static unsigned char FPT_SccbMgr_bad_isr(unsigned long p_port, unsigned char p_card, | 874 | struct sccb_card *pCurrCard, |
1048 | struct sccb_card * pCurrCard, unsigned short p_int); | 875 | unsigned short p_int); |
1049 | 876 | ||
1050 | static void FPT_SccbMgrTableInitAll(void); | 877 | static void FPT_SccbMgrTableInitAll(void); |
1051 | static void FPT_SccbMgrTableInitCard(struct sccb_card * pCurrCard, unsigned char p_card); | 878 | static void FPT_SccbMgrTableInitCard(struct sccb_card *pCurrCard, |
1052 | static void FPT_SccbMgrTableInitTarget(unsigned char p_card, unsigned char target); | 879 | unsigned char p_card); |
1053 | 880 | static void FPT_SccbMgrTableInitTarget(unsigned char p_card, | |
1054 | 881 | unsigned char target); | |
1055 | 882 | ||
1056 | static void FPT_scini(unsigned char p_card, unsigned char p_our_id, unsigned char p_power_up); | 883 | static void FPT_scini(unsigned char p_card, unsigned char p_our_id, |
1057 | 884 | unsigned char p_power_up); | |
1058 | static int FPT_scarb(unsigned long p_port, unsigned char p_sel_type); | 885 | |
1059 | static void FPT_scbusf(unsigned long p_port); | 886 | static int FPT_scarb(unsigned long p_port, unsigned char p_sel_type); |
1060 | static void FPT_scsel(unsigned long p_port); | 887 | static void FPT_scbusf(unsigned long p_port); |
1061 | static void FPT_scasid(unsigned char p_card, unsigned long p_port); | 888 | static void FPT_scsel(unsigned long p_port); |
889 | static void FPT_scasid(unsigned char p_card, unsigned long p_port); | ||
1062 | static unsigned char FPT_scxferc(unsigned long p_port, unsigned char p_data); | 890 | static unsigned char FPT_scxferc(unsigned long p_port, unsigned char p_data); |
1063 | static unsigned char FPT_scsendi(unsigned long p_port, unsigned char p_id_string[]); | 891 | static unsigned char FPT_scsendi(unsigned long p_port, |
1064 | static unsigned char FPT_sciso(unsigned long p_port, unsigned char p_id_string[]); | 892 | unsigned char p_id_string[]); |
1065 | static void FPT_scwirod(unsigned long p_port, unsigned char p_data_bit); | 893 | static unsigned char FPT_sciso(unsigned long p_port, |
1066 | static void FPT_scwiros(unsigned long p_port, unsigned char p_data_bit); | 894 | unsigned char p_id_string[]); |
895 | static void FPT_scwirod(unsigned long p_port, unsigned char p_data_bit); | ||
896 | static void FPT_scwiros(unsigned long p_port, unsigned char p_data_bit); | ||
1067 | static unsigned char FPT_scvalq(unsigned char p_quintet); | 897 | static unsigned char FPT_scvalq(unsigned char p_quintet); |
1068 | static unsigned char FPT_scsell(unsigned long p_port, unsigned char targ_id); | 898 | static unsigned char FPT_scsell(unsigned long p_port, unsigned char targ_id); |
1069 | static void FPT_scwtsel(unsigned long p_port); | 899 | static void FPT_scwtsel(unsigned long p_port); |
1070 | static void FPT_inisci(unsigned char p_card, unsigned long p_port, unsigned char p_our_id); | 900 | static void FPT_inisci(unsigned char p_card, unsigned long p_port, |
1071 | static void FPT_scsavdi(unsigned char p_card, unsigned long p_port); | 901 | unsigned char p_our_id); |
1072 | static unsigned char FPT_scmachid(unsigned char p_card, unsigned char p_id_string[]); | 902 | static void FPT_scsavdi(unsigned char p_card, unsigned long p_port); |
1073 | 903 | static unsigned char FPT_scmachid(unsigned char p_card, | |
1074 | 904 | unsigned char p_id_string[]); | |
1075 | static void FPT_autoCmdCmplt(unsigned long p_port, unsigned char p_card); | 905 | |
1076 | static void FPT_autoLoadDefaultMap(unsigned long p_port); | 906 | static void FPT_autoCmdCmplt(unsigned long p_port, unsigned char p_card); |
1077 | 907 | static void FPT_autoLoadDefaultMap(unsigned long p_port); | |
1078 | 908 | ||
1079 | 909 | static struct sccb_mgr_tar_info FPT_sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR] = | |
1080 | 910 | { {{0}} }; | |
1081 | static struct sccb_mgr_tar_info FPT_sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR] = { { { 0 } } }; | 911 | static struct sccb_card FPT_BL_Card[MAX_CARDS] = { {0} }; |
1082 | static struct sccb_card FPT_BL_Card[MAX_CARDS] = { { 0 } }; | 912 | static SCCBSCAM_INFO FPT_scamInfo[MAX_SCSI_TAR] = { {{0}} }; |
1083 | static SCCBSCAM_INFO FPT_scamInfo[MAX_SCSI_TAR] = { { { 0 } } }; | 913 | static struct nvram_info FPT_nvRamInfo[MAX_MB_CARDS] = { {0} }; |
1084 | static struct nvram_info FPT_nvRamInfo[MAX_MB_CARDS] = { { 0 } }; | ||
1085 | |||
1086 | 914 | ||
1087 | static unsigned char FPT_mbCards = 0; | 915 | static unsigned char FPT_mbCards = 0; |
1088 | static unsigned char FPT_scamHAString[] = {0x63, 0x07, 'B', 'U', 'S', 'L', 'O', 'G', 'I', 'C', \ | 916 | static unsigned char FPT_scamHAString[] = |
1089 | ' ', 'B', 'T', '-', '9', '3', '0', \ | 917 | { 0x63, 0x07, 'B', 'U', 'S', 'L', 'O', 'G', 'I', 'C', |
1090 | 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, \ | 918 | ' ', 'B', 'T', '-', '9', '3', '0', |
1091 | 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}; | 919 | 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, |
920 | 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 | ||
921 | }; | ||
1092 | 922 | ||
1093 | static unsigned short FPT_default_intena = 0; | 923 | static unsigned short FPT_default_intena = 0; |
1094 | 924 | ||
1095 | 925 | static void (*FPT_s_PhaseTbl[8]) (unsigned long, unsigned char) = { | |
1096 | static void (*FPT_s_PhaseTbl[8]) (unsigned long, unsigned char)= { 0 }; | 926 | 0}; |
1097 | |||
1098 | 927 | ||
1099 | /*--------------------------------------------------------------------- | 928 | /*--------------------------------------------------------------------- |
1100 | * | 929 | * |
@@ -1104,276 +933,270 @@ static void (*FPT_s_PhaseTbl[8]) (unsigned long, unsigned char)= { 0 }; | |||
1104 | * | 933 | * |
1105 | *---------------------------------------------------------------------*/ | 934 | *---------------------------------------------------------------------*/ |
1106 | 935 | ||
1107 | static int FlashPoint_ProbeHostAdapter(struct sccb_mgr_info * pCardInfo) | 936 | static int FlashPoint_ProbeHostAdapter(struct sccb_mgr_info *pCardInfo) |
1108 | { | 937 | { |
1109 | static unsigned char first_time = 1; | 938 | static unsigned char first_time = 1; |
1110 | |||
1111 | unsigned char i,j,id,ScamFlg; | ||
1112 | unsigned short temp,temp2,temp3,temp4,temp5,temp6; | ||
1113 | unsigned long ioport; | ||
1114 | struct nvram_info * pCurrNvRam; | ||
1115 | |||
1116 | ioport = pCardInfo->si_baseaddr; | ||
1117 | 939 | ||
940 | unsigned char i, j, id, ScamFlg; | ||
941 | unsigned short temp, temp2, temp3, temp4, temp5, temp6; | ||
942 | unsigned long ioport; | ||
943 | struct nvram_info *pCurrNvRam; | ||
1118 | 944 | ||
1119 | if (RD_HARPOON(ioport+hp_vendor_id_0) != ORION_VEND_0) | 945 | ioport = pCardInfo->si_baseaddr; |
1120 | return((int)FAILURE); | ||
1121 | 946 | ||
1122 | if ((RD_HARPOON(ioport+hp_vendor_id_1) != ORION_VEND_1)) | 947 | if (RD_HARPOON(ioport + hp_vendor_id_0) != ORION_VEND_0) |
1123 | return((int)FAILURE); | 948 | return ((int)FAILURE); |
1124 | 949 | ||
1125 | if ((RD_HARPOON(ioport+hp_device_id_0) != ORION_DEV_0)) | 950 | if ((RD_HARPOON(ioport + hp_vendor_id_1) != ORION_VEND_1)) |
1126 | return((int)FAILURE); | 951 | return ((int)FAILURE); |
1127 | 952 | ||
1128 | if ((RD_HARPOON(ioport+hp_device_id_1) != ORION_DEV_1)) | 953 | if ((RD_HARPOON(ioport + hp_device_id_0) != ORION_DEV_0)) |
1129 | return((int)FAILURE); | 954 | return ((int)FAILURE); |
1130 | 955 | ||
956 | if ((RD_HARPOON(ioport + hp_device_id_1) != ORION_DEV_1)) | ||
957 | return ((int)FAILURE); | ||
1131 | 958 | ||
1132 | if (RD_HARPOON(ioport+hp_rev_num) != 0x0f){ | 959 | if (RD_HARPOON(ioport + hp_rev_num) != 0x0f) { |
1133 | 960 | ||
1134 | /* For new Harpoon then check for sub_device ID LSB | 961 | /* For new Harpoon then check for sub_device ID LSB |
1135 | the bits(0-3) must be all ZERO for compatible with | 962 | the bits(0-3) must be all ZERO for compatible with |
1136 | current version of SCCBMgr, else skip this Harpoon | 963 | current version of SCCBMgr, else skip this Harpoon |
1137 | device. */ | 964 | device. */ |
1138 | 965 | ||
1139 | if (RD_HARPOON(ioport+hp_sub_device_id_0) & 0x0f) | 966 | if (RD_HARPOON(ioport + hp_sub_device_id_0) & 0x0f) |
1140 | return((int)FAILURE); | 967 | return ((int)FAILURE); |
1141 | } | 968 | } |
1142 | 969 | ||
1143 | if (first_time) | 970 | if (first_time) { |
1144 | { | 971 | FPT_SccbMgrTableInitAll(); |
1145 | FPT_SccbMgrTableInitAll(); | 972 | first_time = 0; |
1146 | first_time = 0; | ||
1147 | FPT_mbCards = 0; | 973 | FPT_mbCards = 0; |
1148 | } | 974 | } |
1149 | 975 | ||
1150 | if(FPT_RdStack(ioport, 0) != 0x00) { | 976 | if (FPT_RdStack(ioport, 0) != 0x00) { |
1151 | if(FPT_ChkIfChipInitialized(ioport) == 0) | 977 | if (FPT_ChkIfChipInitialized(ioport) == 0) { |
1152 | { | ||
1153 | pCurrNvRam = NULL; | 978 | pCurrNvRam = NULL; |
1154 | WR_HARPOON(ioport+hp_semaphore, 0x00); | 979 | WR_HARPOON(ioport + hp_semaphore, 0x00); |
1155 | FPT_XbowInit(ioport, 0); /*Must Init the SCSI before attempting */ | 980 | FPT_XbowInit(ioport, 0); /*Must Init the SCSI before attempting */ |
1156 | FPT_DiagEEPROM(ioport); | 981 | FPT_DiagEEPROM(ioport); |
1157 | } | 982 | } else { |
1158 | else | 983 | if (FPT_mbCards < MAX_MB_CARDS) { |
1159 | { | ||
1160 | if(FPT_mbCards < MAX_MB_CARDS) { | ||
1161 | pCurrNvRam = &FPT_nvRamInfo[FPT_mbCards]; | 984 | pCurrNvRam = &FPT_nvRamInfo[FPT_mbCards]; |
1162 | FPT_mbCards++; | 985 | FPT_mbCards++; |
1163 | pCurrNvRam->niBaseAddr = ioport; | 986 | pCurrNvRam->niBaseAddr = ioport; |
1164 | FPT_RNVRamData(pCurrNvRam); | 987 | FPT_RNVRamData(pCurrNvRam); |
1165 | }else | 988 | } else |
1166 | return((int) FAILURE); | 989 | return ((int)FAILURE); |
1167 | } | 990 | } |
1168 | }else | 991 | } else |
1169 | pCurrNvRam = NULL; | 992 | pCurrNvRam = NULL; |
1170 | 993 | ||
1171 | WR_HARPOON(ioport+hp_clkctrl_0, CLKCTRL_DEFAULT); | 994 | WR_HARPOON(ioport + hp_clkctrl_0, CLKCTRL_DEFAULT); |
1172 | WR_HARPOON(ioport+hp_sys_ctrl, 0x00); | 995 | WR_HARPOON(ioport + hp_sys_ctrl, 0x00); |
1173 | 996 | ||
1174 | if(pCurrNvRam) | 997 | if (pCurrNvRam) |
1175 | pCardInfo->si_id = pCurrNvRam->niAdapId; | 998 | pCardInfo->si_id = pCurrNvRam->niAdapId; |
1176 | else | 999 | else |
1177 | pCardInfo->si_id = (unsigned char)(FPT_utilEERead(ioport, (ADAPTER_SCSI_ID/2)) & | 1000 | pCardInfo->si_id = |
1178 | (unsigned char)0x0FF); | 1001 | (unsigned |
1002 | char)(FPT_utilEERead(ioport, | ||
1003 | (ADAPTER_SCSI_ID / | ||
1004 | 2)) & (unsigned char)0x0FF); | ||
1005 | |||
1006 | pCardInfo->si_lun = 0x00; | ||
1007 | pCardInfo->si_fw_revision = ORION_FW_REV; | ||
1008 | temp2 = 0x0000; | ||
1009 | temp3 = 0x0000; | ||
1010 | temp4 = 0x0000; | ||
1011 | temp5 = 0x0000; | ||
1012 | temp6 = 0x0000; | ||
1013 | |||
1014 | for (id = 0; id < (16 / 2); id++) { | ||
1015 | |||
1016 | if (pCurrNvRam) { | ||
1017 | temp = (unsigned short)pCurrNvRam->niSyncTbl[id]; | ||
1018 | temp = ((temp & 0x03) + ((temp << 4) & 0xc0)) + | ||
1019 | (((temp << 4) & 0x0300) + ((temp << 8) & 0xc000)); | ||
1020 | } else | ||
1021 | temp = | ||
1022 | FPT_utilEERead(ioport, | ||
1023 | (unsigned short)((SYNC_RATE_TBL / 2) | ||
1024 | + id)); | ||
1025 | |||
1026 | for (i = 0; i < 2; temp >>= 8, i++) { | ||
1027 | |||
1028 | temp2 >>= 1; | ||
1029 | temp3 >>= 1; | ||
1030 | temp4 >>= 1; | ||
1031 | temp5 >>= 1; | ||
1032 | temp6 >>= 1; | ||
1033 | switch (temp & 0x3) { | ||
1034 | case AUTO_RATE_20: /* Synchronous, 20 mega-transfers/second */ | ||
1035 | temp6 |= 0x8000; /* Fall through */ | ||
1036 | case AUTO_RATE_10: /* Synchronous, 10 mega-transfers/second */ | ||
1037 | temp5 |= 0x8000; /* Fall through */ | ||
1038 | case AUTO_RATE_05: /* Synchronous, 5 mega-transfers/second */ | ||
1039 | temp2 |= 0x8000; /* Fall through */ | ||
1040 | case AUTO_RATE_00: /* Asynchronous */ | ||
1041 | break; | ||
1042 | } | ||
1179 | 1043 | ||
1180 | pCardInfo->si_lun = 0x00; | 1044 | if (temp & DISC_ENABLE_BIT) |
1181 | pCardInfo->si_fw_revision = ORION_FW_REV; | 1045 | temp3 |= 0x8000; |
1182 | temp2 = 0x0000; | ||
1183 | temp3 = 0x0000; | ||
1184 | temp4 = 0x0000; | ||
1185 | temp5 = 0x0000; | ||
1186 | temp6 = 0x0000; | ||
1187 | 1046 | ||
1188 | for (id = 0; id < (16/2); id++) { | 1047 | if (temp & WIDE_NEGO_BIT) |
1048 | temp4 |= 0x8000; | ||
1189 | 1049 | ||
1190 | if(pCurrNvRam){ | 1050 | } |
1191 | temp = (unsigned short) pCurrNvRam->niSyncTbl[id]; | 1051 | } |
1192 | temp = ((temp & 0x03) + ((temp << 4) & 0xc0)) + | ||
1193 | (((temp << 4) & 0x0300) + ((temp << 8) & 0xc000)); | ||
1194 | }else | ||
1195 | temp = FPT_utilEERead(ioport, (unsigned short)((SYNC_RATE_TBL/2)+id)); | ||
1196 | |||
1197 | for (i = 0; i < 2; temp >>=8,i++) { | ||
1198 | |||
1199 | temp2 >>= 1; | ||
1200 | temp3 >>= 1; | ||
1201 | temp4 >>= 1; | ||
1202 | temp5 >>= 1; | ||
1203 | temp6 >>= 1; | ||
1204 | switch (temp & 0x3) | ||
1205 | { | ||
1206 | case AUTO_RATE_20: /* Synchronous, 20 mega-transfers/second */ | ||
1207 | temp6 |= 0x8000; /* Fall through */ | ||
1208 | case AUTO_RATE_10: /* Synchronous, 10 mega-transfers/second */ | ||
1209 | temp5 |= 0x8000; /* Fall through */ | ||
1210 | case AUTO_RATE_05: /* Synchronous, 5 mega-transfers/second */ | ||
1211 | temp2 |= 0x8000; /* Fall through */ | ||
1212 | case AUTO_RATE_00: /* Asynchronous */ | ||
1213 | break; | ||
1214 | } | ||
1215 | |||
1216 | if (temp & DISC_ENABLE_BIT) | ||
1217 | temp3 |= 0x8000; | ||
1218 | |||
1219 | if (temp & WIDE_NEGO_BIT) | ||
1220 | temp4 |= 0x8000; | ||
1221 | |||
1222 | } | ||
1223 | } | ||
1224 | 1052 | ||
1225 | pCardInfo->si_per_targ_init_sync = temp2; | 1053 | pCardInfo->si_per_targ_init_sync = temp2; |
1226 | pCardInfo->si_per_targ_no_disc = temp3; | 1054 | pCardInfo->si_per_targ_no_disc = temp3; |
1227 | pCardInfo->si_per_targ_wide_nego = temp4; | 1055 | pCardInfo->si_per_targ_wide_nego = temp4; |
1228 | pCardInfo->si_per_targ_fast_nego = temp5; | 1056 | pCardInfo->si_per_targ_fast_nego = temp5; |
1229 | pCardInfo->si_per_targ_ultra_nego = temp6; | 1057 | pCardInfo->si_per_targ_ultra_nego = temp6; |
1230 | 1058 | ||
1231 | if(pCurrNvRam) | 1059 | if (pCurrNvRam) |
1232 | i = pCurrNvRam->niSysConf; | 1060 | i = pCurrNvRam->niSysConf; |
1233 | else | 1061 | else |
1234 | i = (unsigned char)(FPT_utilEERead(ioport, (SYSTEM_CONFIG/2))); | 1062 | i = (unsigned |
1063 | char)(FPT_utilEERead(ioport, (SYSTEM_CONFIG / 2))); | ||
1235 | 1064 | ||
1236 | if(pCurrNvRam) | 1065 | if (pCurrNvRam) |
1237 | ScamFlg = pCurrNvRam->niScamConf; | 1066 | ScamFlg = pCurrNvRam->niScamConf; |
1238 | else | 1067 | else |
1239 | ScamFlg = (unsigned char) FPT_utilEERead(ioport, SCAM_CONFIG/2); | 1068 | ScamFlg = |
1069 | (unsigned char)FPT_utilEERead(ioport, SCAM_CONFIG / 2); | ||
1240 | 1070 | ||
1241 | pCardInfo->si_flags = 0x0000; | 1071 | pCardInfo->si_flags = 0x0000; |
1242 | 1072 | ||
1243 | if (i & 0x01) | 1073 | if (i & 0x01) |
1244 | pCardInfo->si_flags |= SCSI_PARITY_ENA; | 1074 | pCardInfo->si_flags |= SCSI_PARITY_ENA; |
1245 | 1075 | ||
1246 | if (!(i & 0x02)) | 1076 | if (!(i & 0x02)) |
1247 | pCardInfo->si_flags |= SOFT_RESET; | 1077 | pCardInfo->si_flags |= SOFT_RESET; |
1248 | 1078 | ||
1249 | if (i & 0x10) | 1079 | if (i & 0x10) |
1250 | pCardInfo->si_flags |= EXTENDED_TRANSLATION; | 1080 | pCardInfo->si_flags |= EXTENDED_TRANSLATION; |
1251 | 1081 | ||
1252 | if (ScamFlg & SCAM_ENABLED) | 1082 | if (ScamFlg & SCAM_ENABLED) |
1253 | pCardInfo->si_flags |= FLAG_SCAM_ENABLED; | 1083 | pCardInfo->si_flags |= FLAG_SCAM_ENABLED; |
1254 | 1084 | ||
1255 | if (ScamFlg & SCAM_LEVEL2) | 1085 | if (ScamFlg & SCAM_LEVEL2) |
1256 | pCardInfo->si_flags |= FLAG_SCAM_LEVEL2; | 1086 | pCardInfo->si_flags |= FLAG_SCAM_LEVEL2; |
1257 | 1087 | ||
1258 | j = (RD_HARPOON(ioport+hp_bm_ctrl) & ~SCSI_TERM_ENA_L); | 1088 | j = (RD_HARPOON(ioport + hp_bm_ctrl) & ~SCSI_TERM_ENA_L); |
1259 | if (i & 0x04) { | 1089 | if (i & 0x04) { |
1260 | j |= SCSI_TERM_ENA_L; | 1090 | j |= SCSI_TERM_ENA_L; |
1261 | } | 1091 | } |
1262 | WR_HARPOON(ioport+hp_bm_ctrl, j ); | 1092 | WR_HARPOON(ioport + hp_bm_ctrl, j); |
1263 | 1093 | ||
1264 | j = (RD_HARPOON(ioport+hp_ee_ctrl) & ~SCSI_TERM_ENA_H); | 1094 | j = (RD_HARPOON(ioport + hp_ee_ctrl) & ~SCSI_TERM_ENA_H); |
1265 | if (i & 0x08) { | 1095 | if (i & 0x08) { |
1266 | j |= SCSI_TERM_ENA_H; | 1096 | j |= SCSI_TERM_ENA_H; |
1267 | } | 1097 | } |
1268 | WR_HARPOON(ioport+hp_ee_ctrl, j ); | 1098 | WR_HARPOON(ioport + hp_ee_ctrl, j); |
1099 | |||
1100 | if (!(RD_HARPOON(ioport + hp_page_ctrl) & NARROW_SCSI_CARD)) | ||
1101 | |||
1102 | pCardInfo->si_flags |= SUPPORT_16TAR_32LUN; | ||
1103 | |||
1104 | pCardInfo->si_card_family = HARPOON_FAMILY; | ||
1105 | pCardInfo->si_bustype = BUSTYPE_PCI; | ||
1106 | |||
1107 | if (pCurrNvRam) { | ||
1108 | pCardInfo->si_card_model[0] = '9'; | ||
1109 | switch (pCurrNvRam->niModel & 0x0f) { | ||
1110 | case MODEL_LT: | ||
1111 | pCardInfo->si_card_model[1] = '3'; | ||
1112 | pCardInfo->si_card_model[2] = '0'; | ||
1113 | break; | ||
1114 | case MODEL_LW: | ||
1115 | pCardInfo->si_card_model[1] = '5'; | ||
1116 | pCardInfo->si_card_model[2] = '0'; | ||
1117 | break; | ||
1118 | case MODEL_DL: | ||
1119 | pCardInfo->si_card_model[1] = '3'; | ||
1120 | pCardInfo->si_card_model[2] = '2'; | ||
1121 | break; | ||
1122 | case MODEL_DW: | ||
1123 | pCardInfo->si_card_model[1] = '5'; | ||
1124 | pCardInfo->si_card_model[2] = '2'; | ||
1125 | break; | ||
1126 | } | ||
1127 | } else { | ||
1128 | temp = FPT_utilEERead(ioport, (MODEL_NUMB_0 / 2)); | ||
1129 | pCardInfo->si_card_model[0] = (unsigned char)(temp >> 8); | ||
1130 | temp = FPT_utilEERead(ioport, (MODEL_NUMB_2 / 2)); | ||
1269 | 1131 | ||
1270 | if (!(RD_HARPOON(ioport+hp_page_ctrl) & NARROW_SCSI_CARD)) | 1132 | pCardInfo->si_card_model[1] = (unsigned char)(temp & 0x00FF); |
1133 | pCardInfo->si_card_model[2] = (unsigned char)(temp >> 8); | ||
1134 | } | ||
1271 | 1135 | ||
1272 | pCardInfo->si_flags |= SUPPORT_16TAR_32LUN; | 1136 | if (pCardInfo->si_card_model[1] == '3') { |
1137 | if (RD_HARPOON(ioport + hp_ee_ctrl) & BIT(7)) | ||
1138 | pCardInfo->si_flags |= LOW_BYTE_TERM; | ||
1139 | } else if (pCardInfo->si_card_model[2] == '0') { | ||
1140 | temp = RD_HARPOON(ioport + hp_xfer_pad); | ||
1141 | WR_HARPOON(ioport + hp_xfer_pad, (temp & ~BIT(4))); | ||
1142 | if (RD_HARPOON(ioport + hp_ee_ctrl) & BIT(7)) | ||
1143 | pCardInfo->si_flags |= LOW_BYTE_TERM; | ||
1144 | WR_HARPOON(ioport + hp_xfer_pad, (temp | BIT(4))); | ||
1145 | if (RD_HARPOON(ioport + hp_ee_ctrl) & BIT(7)) | ||
1146 | pCardInfo->si_flags |= HIGH_BYTE_TERM; | ||
1147 | WR_HARPOON(ioport + hp_xfer_pad, temp); | ||
1148 | } else { | ||
1149 | temp = RD_HARPOON(ioport + hp_ee_ctrl); | ||
1150 | temp2 = RD_HARPOON(ioport + hp_xfer_pad); | ||
1151 | WR_HARPOON(ioport + hp_ee_ctrl, (temp | SEE_CS)); | ||
1152 | WR_HARPOON(ioport + hp_xfer_pad, (temp2 | BIT(4))); | ||
1153 | temp3 = 0; | ||
1154 | for (i = 0; i < 8; i++) { | ||
1155 | temp3 <<= 1; | ||
1156 | if (!(RD_HARPOON(ioport + hp_ee_ctrl) & BIT(7))) | ||
1157 | temp3 |= 1; | ||
1158 | WR_HARPOON(ioport + hp_xfer_pad, (temp2 & ~BIT(4))); | ||
1159 | WR_HARPOON(ioport + hp_xfer_pad, (temp2 | BIT(4))); | ||
1160 | } | ||
1161 | WR_HARPOON(ioport + hp_ee_ctrl, temp); | ||
1162 | WR_HARPOON(ioport + hp_xfer_pad, temp2); | ||
1163 | if (!(temp3 & BIT(7))) | ||
1164 | pCardInfo->si_flags |= LOW_BYTE_TERM; | ||
1165 | if (!(temp3 & BIT(6))) | ||
1166 | pCardInfo->si_flags |= HIGH_BYTE_TERM; | ||
1167 | } | ||
1273 | 1168 | ||
1274 | pCardInfo->si_card_family = HARPOON_FAMILY; | 1169 | ARAM_ACCESS(ioport); |
1275 | pCardInfo->si_bustype = BUSTYPE_PCI; | ||
1276 | 1170 | ||
1277 | if(pCurrNvRam){ | 1171 | for (i = 0; i < 4; i++) { |
1278 | pCardInfo->si_card_model[0] = '9'; | 1172 | |
1279 | switch(pCurrNvRam->niModel & 0x0f){ | 1173 | pCardInfo->si_XlatInfo[i] = |
1280 | case MODEL_LT: | 1174 | RD_HARPOON(ioport + hp_aramBase + BIOS_DATA_OFFSET + i); |
1281 | pCardInfo->si_card_model[1] = '3'; | 1175 | } |
1282 | pCardInfo->si_card_model[2] = '0'; | ||
1283 | break; | ||
1284 | case MODEL_LW: | ||
1285 | pCardInfo->si_card_model[1] = '5'; | ||
1286 | pCardInfo->si_card_model[2] = '0'; | ||
1287 | break; | ||
1288 | case MODEL_DL: | ||
1289 | pCardInfo->si_card_model[1] = '3'; | ||
1290 | pCardInfo->si_card_model[2] = '2'; | ||
1291 | break; | ||
1292 | case MODEL_DW: | ||
1293 | pCardInfo->si_card_model[1] = '5'; | ||
1294 | pCardInfo->si_card_model[2] = '2'; | ||
1295 | break; | ||
1296 | } | ||
1297 | }else{ | ||
1298 | temp = FPT_utilEERead(ioport, (MODEL_NUMB_0/2)); | ||
1299 | pCardInfo->si_card_model[0] = (unsigned char)(temp >> 8); | ||
1300 | temp = FPT_utilEERead(ioport, (MODEL_NUMB_2/2)); | ||
1301 | |||
1302 | pCardInfo->si_card_model[1] = (unsigned char)(temp & 0x00FF); | ||
1303 | pCardInfo->si_card_model[2] = (unsigned char)(temp >> 8); | ||
1304 | } | ||
1305 | |||
1306 | if (pCardInfo->si_card_model[1] == '3') | ||
1307 | { | ||
1308 | if (RD_HARPOON(ioport+hp_ee_ctrl) & BIT(7)) | ||
1309 | pCardInfo->si_flags |= LOW_BYTE_TERM; | ||
1310 | } | ||
1311 | else if (pCardInfo->si_card_model[2] == '0') | ||
1312 | { | ||
1313 | temp = RD_HARPOON(ioport+hp_xfer_pad); | ||
1314 | WR_HARPOON(ioport+hp_xfer_pad, (temp & ~BIT(4))); | ||
1315 | if (RD_HARPOON(ioport+hp_ee_ctrl) & BIT(7)) | ||
1316 | pCardInfo->si_flags |= LOW_BYTE_TERM; | ||
1317 | WR_HARPOON(ioport+hp_xfer_pad, (temp | BIT(4))); | ||
1318 | if (RD_HARPOON(ioport+hp_ee_ctrl) & BIT(7)) | ||
1319 | pCardInfo->si_flags |= HIGH_BYTE_TERM; | ||
1320 | WR_HARPOON(ioport+hp_xfer_pad, temp); | ||
1321 | } | ||
1322 | else | ||
1323 | { | ||
1324 | temp = RD_HARPOON(ioport+hp_ee_ctrl); | ||
1325 | temp2 = RD_HARPOON(ioport+hp_xfer_pad); | ||
1326 | WR_HARPOON(ioport+hp_ee_ctrl, (temp | SEE_CS)); | ||
1327 | WR_HARPOON(ioport+hp_xfer_pad, (temp2 | BIT(4))); | ||
1328 | temp3 = 0; | ||
1329 | for (i = 0; i < 8; i++) | ||
1330 | { | ||
1331 | temp3 <<= 1; | ||
1332 | if (!(RD_HARPOON(ioport+hp_ee_ctrl) & BIT(7))) | ||
1333 | temp3 |= 1; | ||
1334 | WR_HARPOON(ioport+hp_xfer_pad, (temp2 & ~BIT(4))); | ||
1335 | WR_HARPOON(ioport+hp_xfer_pad, (temp2 | BIT(4))); | ||
1336 | } | ||
1337 | WR_HARPOON(ioport+hp_ee_ctrl, temp); | ||
1338 | WR_HARPOON(ioport+hp_xfer_pad, temp2); | ||
1339 | if (!(temp3 & BIT(7))) | ||
1340 | pCardInfo->si_flags |= LOW_BYTE_TERM; | ||
1341 | if (!(temp3 & BIT(6))) | ||
1342 | pCardInfo->si_flags |= HIGH_BYTE_TERM; | ||
1343 | } | ||
1344 | |||
1345 | |||
1346 | ARAM_ACCESS(ioport); | ||
1347 | |||
1348 | for ( i = 0; i < 4; i++ ) { | ||
1349 | |||
1350 | pCardInfo->si_XlatInfo[i] = | ||
1351 | RD_HARPOON(ioport+hp_aramBase+BIOS_DATA_OFFSET+i); | ||
1352 | } | ||
1353 | 1176 | ||
1354 | /* return with -1 if no sort, else return with | 1177 | /* return with -1 if no sort, else return with |
1355 | logical card number sorted by BIOS (zero-based) */ | 1178 | logical card number sorted by BIOS (zero-based) */ |
1356 | 1179 | ||
1357 | pCardInfo->si_relative_cardnum = | 1180 | pCardInfo->si_relative_cardnum = |
1358 | (unsigned char)(RD_HARPOON(ioport+hp_aramBase+BIOS_RELATIVE_CARD)-1); | 1181 | (unsigned |
1182 | char)(RD_HARPOON(ioport + hp_aramBase + BIOS_RELATIVE_CARD) - 1); | ||
1359 | 1183 | ||
1360 | SGRAM_ACCESS(ioport); | 1184 | SGRAM_ACCESS(ioport); |
1361 | 1185 | ||
1362 | FPT_s_PhaseTbl[0] = FPT_phaseDataOut; | 1186 | FPT_s_PhaseTbl[0] = FPT_phaseDataOut; |
1363 | FPT_s_PhaseTbl[1] = FPT_phaseDataIn; | 1187 | FPT_s_PhaseTbl[1] = FPT_phaseDataIn; |
1364 | FPT_s_PhaseTbl[2] = FPT_phaseIllegal; | 1188 | FPT_s_PhaseTbl[2] = FPT_phaseIllegal; |
1365 | FPT_s_PhaseTbl[3] = FPT_phaseIllegal; | 1189 | FPT_s_PhaseTbl[3] = FPT_phaseIllegal; |
1366 | FPT_s_PhaseTbl[4] = FPT_phaseCommand; | 1190 | FPT_s_PhaseTbl[4] = FPT_phaseCommand; |
1367 | FPT_s_PhaseTbl[5] = FPT_phaseStatus; | 1191 | FPT_s_PhaseTbl[5] = FPT_phaseStatus; |
1368 | FPT_s_PhaseTbl[6] = FPT_phaseMsgOut; | 1192 | FPT_s_PhaseTbl[6] = FPT_phaseMsgOut; |
1369 | FPT_s_PhaseTbl[7] = FPT_phaseMsgIn; | 1193 | FPT_s_PhaseTbl[7] = FPT_phaseMsgIn; |
1370 | 1194 | ||
1371 | pCardInfo->si_present = 0x01; | 1195 | pCardInfo->si_present = 0x01; |
1372 | 1196 | ||
1373 | return(0); | 1197 | return (0); |
1374 | } | 1198 | } |
1375 | 1199 | ||
1376 | |||
1377 | /*--------------------------------------------------------------------- | 1200 | /*--------------------------------------------------------------------- |
1378 | * | 1201 | * |
1379 | * Function: FlashPoint_HardwareResetHostAdapter | 1202 | * Function: FlashPoint_HardwareResetHostAdapter |
@@ -1382,185 +1205,190 @@ static int FlashPoint_ProbeHostAdapter(struct sccb_mgr_info * pCardInfo) | |||
1382 | * | 1205 | * |
1383 | *---------------------------------------------------------------------*/ | 1206 | *---------------------------------------------------------------------*/ |
1384 | 1207 | ||
1385 | static unsigned long FlashPoint_HardwareResetHostAdapter(struct sccb_mgr_info * pCardInfo) | 1208 | static unsigned long FlashPoint_HardwareResetHostAdapter(struct sccb_mgr_info |
1209 | *pCardInfo) | ||
1386 | { | 1210 | { |
1387 | struct sccb_card * CurrCard = NULL; | 1211 | struct sccb_card *CurrCard = NULL; |
1388 | struct nvram_info * pCurrNvRam; | 1212 | struct nvram_info *pCurrNvRam; |
1389 | unsigned char i,j,thisCard, ScamFlg; | 1213 | unsigned char i, j, thisCard, ScamFlg; |
1390 | unsigned short temp,sync_bit_map,id; | 1214 | unsigned short temp, sync_bit_map, id; |
1391 | unsigned long ioport; | 1215 | unsigned long ioport; |
1392 | 1216 | ||
1393 | ioport = pCardInfo->si_baseaddr; | 1217 | ioport = pCardInfo->si_baseaddr; |
1394 | 1218 | ||
1395 | for(thisCard =0; thisCard <= MAX_CARDS; thisCard++) { | 1219 | for (thisCard = 0; thisCard <= MAX_CARDS; thisCard++) { |
1396 | 1220 | ||
1397 | if (thisCard == MAX_CARDS) { | 1221 | if (thisCard == MAX_CARDS) { |
1398 | 1222 | ||
1399 | return(FAILURE); | 1223 | return (FAILURE); |
1400 | } | 1224 | } |
1401 | 1225 | ||
1402 | if (FPT_BL_Card[thisCard].ioPort == ioport) { | 1226 | if (FPT_BL_Card[thisCard].ioPort == ioport) { |
1403 | 1227 | ||
1404 | CurrCard = &FPT_BL_Card[thisCard]; | 1228 | CurrCard = &FPT_BL_Card[thisCard]; |
1405 | FPT_SccbMgrTableInitCard(CurrCard,thisCard); | 1229 | FPT_SccbMgrTableInitCard(CurrCard, thisCard); |
1406 | break; | 1230 | break; |
1407 | } | 1231 | } |
1408 | 1232 | ||
1409 | else if (FPT_BL_Card[thisCard].ioPort == 0x00) { | 1233 | else if (FPT_BL_Card[thisCard].ioPort == 0x00) { |
1410 | 1234 | ||
1411 | FPT_BL_Card[thisCard].ioPort = ioport; | 1235 | FPT_BL_Card[thisCard].ioPort = ioport; |
1412 | CurrCard = &FPT_BL_Card[thisCard]; | 1236 | CurrCard = &FPT_BL_Card[thisCard]; |
1413 | 1237 | ||
1414 | if(FPT_mbCards) | 1238 | if (FPT_mbCards) |
1415 | for(i = 0; i < FPT_mbCards; i++){ | 1239 | for (i = 0; i < FPT_mbCards; i++) { |
1416 | if(CurrCard->ioPort == FPT_nvRamInfo[i].niBaseAddr) | 1240 | if (CurrCard->ioPort == |
1417 | CurrCard->pNvRamInfo = &FPT_nvRamInfo[i]; | 1241 | FPT_nvRamInfo[i].niBaseAddr) |
1242 | CurrCard->pNvRamInfo = | ||
1243 | &FPT_nvRamInfo[i]; | ||
1418 | } | 1244 | } |
1419 | FPT_SccbMgrTableInitCard(CurrCard,thisCard); | 1245 | FPT_SccbMgrTableInitCard(CurrCard, thisCard); |
1420 | CurrCard->cardIndex = thisCard; | 1246 | CurrCard->cardIndex = thisCard; |
1421 | CurrCard->cardInfo = pCardInfo; | 1247 | CurrCard->cardInfo = pCardInfo; |
1422 | 1248 | ||
1423 | break; | 1249 | break; |
1424 | } | 1250 | } |
1425 | } | 1251 | } |
1426 | 1252 | ||
1427 | pCurrNvRam = CurrCard->pNvRamInfo; | 1253 | pCurrNvRam = CurrCard->pNvRamInfo; |
1428 | 1254 | ||
1429 | if(pCurrNvRam){ | 1255 | if (pCurrNvRam) { |
1430 | ScamFlg = pCurrNvRam->niScamConf; | 1256 | ScamFlg = pCurrNvRam->niScamConf; |
1257 | } else { | ||
1258 | ScamFlg = | ||
1259 | (unsigned char)FPT_utilEERead(ioport, SCAM_CONFIG / 2); | ||
1431 | } | 1260 | } |
1432 | else{ | ||
1433 | ScamFlg = (unsigned char) FPT_utilEERead(ioport, SCAM_CONFIG/2); | ||
1434 | } | ||
1435 | |||
1436 | |||
1437 | FPT_BusMasterInit(ioport); | ||
1438 | FPT_XbowInit(ioport, ScamFlg); | ||
1439 | 1261 | ||
1440 | FPT_autoLoadDefaultMap(ioport); | 1262 | FPT_BusMasterInit(ioport); |
1263 | FPT_XbowInit(ioport, ScamFlg); | ||
1441 | 1264 | ||
1265 | FPT_autoLoadDefaultMap(ioport); | ||
1442 | 1266 | ||
1443 | for (i = 0,id = 0x01; i != pCardInfo->si_id; i++,id <<= 1){} | 1267 | for (i = 0, id = 0x01; i != pCardInfo->si_id; i++, id <<= 1) { |
1444 | 1268 | } | |
1445 | WR_HARPOON(ioport+hp_selfid_0, id); | ||
1446 | WR_HARPOON(ioport+hp_selfid_1, 0x00); | ||
1447 | WR_HARPOON(ioport+hp_arb_id, pCardInfo->si_id); | ||
1448 | CurrCard->ourId = pCardInfo->si_id; | ||
1449 | |||
1450 | i = (unsigned char) pCardInfo->si_flags; | ||
1451 | if (i & SCSI_PARITY_ENA) | ||
1452 | WR_HARPOON(ioport+hp_portctrl_1,(HOST_MODE8 | CHK_SCSI_P)); | ||
1453 | |||
1454 | j = (RD_HARPOON(ioport+hp_bm_ctrl) & ~SCSI_TERM_ENA_L); | ||
1455 | if (i & LOW_BYTE_TERM) | ||
1456 | j |= SCSI_TERM_ENA_L; | ||
1457 | WR_HARPOON(ioport+hp_bm_ctrl, j); | ||
1458 | 1269 | ||
1459 | j = (RD_HARPOON(ioport+hp_ee_ctrl) & ~SCSI_TERM_ENA_H); | 1270 | WR_HARPOON(ioport + hp_selfid_0, id); |
1460 | if (i & HIGH_BYTE_TERM) | 1271 | WR_HARPOON(ioport + hp_selfid_1, 0x00); |
1461 | j |= SCSI_TERM_ENA_H; | 1272 | WR_HARPOON(ioport + hp_arb_id, pCardInfo->si_id); |
1462 | WR_HARPOON(ioport+hp_ee_ctrl, j ); | 1273 | CurrCard->ourId = pCardInfo->si_id; |
1463 | 1274 | ||
1275 | i = (unsigned char)pCardInfo->si_flags; | ||
1276 | if (i & SCSI_PARITY_ENA) | ||
1277 | WR_HARPOON(ioport + hp_portctrl_1, (HOST_MODE8 | CHK_SCSI_P)); | ||
1464 | 1278 | ||
1465 | if (!(pCardInfo->si_flags & SOFT_RESET)) { | 1279 | j = (RD_HARPOON(ioport + hp_bm_ctrl) & ~SCSI_TERM_ENA_L); |
1280 | if (i & LOW_BYTE_TERM) | ||
1281 | j |= SCSI_TERM_ENA_L; | ||
1282 | WR_HARPOON(ioport + hp_bm_ctrl, j); | ||
1466 | 1283 | ||
1467 | FPT_sresb(ioport,thisCard); | 1284 | j = (RD_HARPOON(ioport + hp_ee_ctrl) & ~SCSI_TERM_ENA_H); |
1285 | if (i & HIGH_BYTE_TERM) | ||
1286 | j |= SCSI_TERM_ENA_H; | ||
1287 | WR_HARPOON(ioport + hp_ee_ctrl, j); | ||
1468 | 1288 | ||
1469 | FPT_scini(thisCard, pCardInfo->si_id, 0); | 1289 | if (!(pCardInfo->si_flags & SOFT_RESET)) { |
1470 | } | ||
1471 | 1290 | ||
1291 | FPT_sresb(ioport, thisCard); | ||
1472 | 1292 | ||
1293 | FPT_scini(thisCard, pCardInfo->si_id, 0); | ||
1294 | } | ||
1473 | 1295 | ||
1474 | if (pCardInfo->si_flags & POST_ALL_UNDERRRUNS) | 1296 | if (pCardInfo->si_flags & POST_ALL_UNDERRRUNS) |
1475 | CurrCard->globalFlags |= F_NO_FILTER; | 1297 | CurrCard->globalFlags |= F_NO_FILTER; |
1476 | 1298 | ||
1477 | if(pCurrNvRam){ | 1299 | if (pCurrNvRam) { |
1478 | if(pCurrNvRam->niSysConf & 0x10) | 1300 | if (pCurrNvRam->niSysConf & 0x10) |
1301 | CurrCard->globalFlags |= F_GREEN_PC; | ||
1302 | } else { | ||
1303 | if (FPT_utilEERead(ioport, (SYSTEM_CONFIG / 2)) & GREEN_PC_ENA) | ||
1479 | CurrCard->globalFlags |= F_GREEN_PC; | 1304 | CurrCard->globalFlags |= F_GREEN_PC; |
1480 | } | ||
1481 | else{ | ||
1482 | if (FPT_utilEERead(ioport, (SYSTEM_CONFIG/2)) & GREEN_PC_ENA) | ||
1483 | CurrCard->globalFlags |= F_GREEN_PC; | ||
1484 | } | 1305 | } |
1485 | 1306 | ||
1486 | /* Set global flag to indicate Re-Negotiation to be done on all | 1307 | /* Set global flag to indicate Re-Negotiation to be done on all |
1487 | ckeck condition */ | 1308 | ckeck condition */ |
1488 | if(pCurrNvRam){ | 1309 | if (pCurrNvRam) { |
1489 | if(pCurrNvRam->niScsiConf & 0x04) | 1310 | if (pCurrNvRam->niScsiConf & 0x04) |
1311 | CurrCard->globalFlags |= F_DO_RENEGO; | ||
1312 | } else { | ||
1313 | if (FPT_utilEERead(ioport, (SCSI_CONFIG / 2)) & RENEGO_ENA) | ||
1490 | CurrCard->globalFlags |= F_DO_RENEGO; | 1314 | CurrCard->globalFlags |= F_DO_RENEGO; |
1491 | } | ||
1492 | else{ | ||
1493 | if (FPT_utilEERead(ioport, (SCSI_CONFIG/2)) & RENEGO_ENA) | ||
1494 | CurrCard->globalFlags |= F_DO_RENEGO; | ||
1495 | } | 1315 | } |
1496 | 1316 | ||
1497 | if(pCurrNvRam){ | 1317 | if (pCurrNvRam) { |
1498 | if(pCurrNvRam->niScsiConf & 0x08) | 1318 | if (pCurrNvRam->niScsiConf & 0x08) |
1319 | CurrCard->globalFlags |= F_CONLUN_IO; | ||
1320 | } else { | ||
1321 | if (FPT_utilEERead(ioport, (SCSI_CONFIG / 2)) & CONNIO_ENA) | ||
1499 | CurrCard->globalFlags |= F_CONLUN_IO; | 1322 | CurrCard->globalFlags |= F_CONLUN_IO; |
1500 | } | 1323 | } |
1501 | else{ | ||
1502 | if (FPT_utilEERead(ioport, (SCSI_CONFIG/2)) & CONNIO_ENA) | ||
1503 | CurrCard->globalFlags |= F_CONLUN_IO; | ||
1504 | } | ||
1505 | |||
1506 | 1324 | ||
1507 | temp = pCardInfo->si_per_targ_no_disc; | 1325 | temp = pCardInfo->si_per_targ_no_disc; |
1508 | 1326 | ||
1509 | for (i = 0,id = 1; i < MAX_SCSI_TAR; i++, id <<= 1) { | 1327 | for (i = 0, id = 1; i < MAX_SCSI_TAR; i++, id <<= 1) { |
1510 | 1328 | ||
1511 | if (temp & id) | 1329 | if (temp & id) |
1512 | FPT_sccbMgrTbl[thisCard][i].TarStatus |= TAR_ALLOW_DISC; | 1330 | FPT_sccbMgrTbl[thisCard][i].TarStatus |= TAR_ALLOW_DISC; |
1513 | } | 1331 | } |
1514 | 1332 | ||
1515 | sync_bit_map = 0x0001; | 1333 | sync_bit_map = 0x0001; |
1516 | 1334 | ||
1517 | for (id = 0; id < (MAX_SCSI_TAR/2); id++) { | 1335 | for (id = 0; id < (MAX_SCSI_TAR / 2); id++) { |
1518 | 1336 | ||
1519 | if(pCurrNvRam){ | 1337 | if (pCurrNvRam) { |
1520 | temp = (unsigned short) pCurrNvRam->niSyncTbl[id]; | 1338 | temp = (unsigned short)pCurrNvRam->niSyncTbl[id]; |
1521 | temp = ((temp & 0x03) + ((temp << 4) & 0xc0)) + | 1339 | temp = ((temp & 0x03) + ((temp << 4) & 0xc0)) + |
1522 | (((temp << 4) & 0x0300) + ((temp << 8) & 0xc000)); | 1340 | (((temp << 4) & 0x0300) + ((temp << 8) & 0xc000)); |
1523 | }else | 1341 | } else |
1524 | temp = FPT_utilEERead(ioport, (unsigned short)((SYNC_RATE_TBL/2)+id)); | 1342 | temp = |
1343 | FPT_utilEERead(ioport, | ||
1344 | (unsigned short)((SYNC_RATE_TBL / 2) | ||
1345 | + id)); | ||
1525 | 1346 | ||
1526 | for (i = 0; i < 2; temp >>=8,i++) { | 1347 | for (i = 0; i < 2; temp >>= 8, i++) { |
1527 | 1348 | ||
1528 | if (pCardInfo->si_per_targ_init_sync & sync_bit_map) { | 1349 | if (pCardInfo->si_per_targ_init_sync & sync_bit_map) { |
1529 | 1350 | ||
1530 | FPT_sccbMgrTbl[thisCard][id*2+i].TarEEValue = (unsigned char)temp; | 1351 | FPT_sccbMgrTbl[thisCard][id * 2 + |
1531 | } | 1352 | i].TarEEValue = |
1353 | (unsigned char)temp; | ||
1354 | } | ||
1532 | 1355 | ||
1533 | else { | 1356 | else { |
1534 | FPT_sccbMgrTbl[thisCard][id*2+i].TarStatus |= SYNC_SUPPORTED; | 1357 | FPT_sccbMgrTbl[thisCard][id * 2 + |
1535 | FPT_sccbMgrTbl[thisCard][id*2+i].TarEEValue = | 1358 | i].TarStatus |= |
1536 | (unsigned char)(temp & ~EE_SYNC_MASK); | 1359 | SYNC_SUPPORTED; |
1537 | } | 1360 | FPT_sccbMgrTbl[thisCard][id * 2 + |
1361 | i].TarEEValue = | ||
1362 | (unsigned char)(temp & ~EE_SYNC_MASK); | ||
1363 | } | ||
1538 | 1364 | ||
1539 | /* if ((pCardInfo->si_per_targ_wide_nego & sync_bit_map) || | 1365 | /* if ((pCardInfo->si_per_targ_wide_nego & sync_bit_map) || |
1540 | (id*2+i >= 8)){ | 1366 | (id*2+i >= 8)){ |
1541 | */ | 1367 | */ |
1542 | if (pCardInfo->si_per_targ_wide_nego & sync_bit_map){ | 1368 | if (pCardInfo->si_per_targ_wide_nego & sync_bit_map) { |
1543 | 1369 | ||
1544 | FPT_sccbMgrTbl[thisCard][id*2+i].TarEEValue |= EE_WIDE_SCSI; | 1370 | FPT_sccbMgrTbl[thisCard][id * 2 + |
1371 | i].TarEEValue |= | ||
1372 | EE_WIDE_SCSI; | ||
1545 | 1373 | ||
1546 | } | 1374 | } |
1547 | |||
1548 | else { /* NARROW SCSI */ | ||
1549 | FPT_sccbMgrTbl[thisCard][id*2+i].TarStatus |= WIDE_NEGOCIATED; | ||
1550 | } | ||
1551 | |||
1552 | |||
1553 | sync_bit_map <<= 1; | ||
1554 | 1375 | ||
1376 | else { /* NARROW SCSI */ | ||
1377 | FPT_sccbMgrTbl[thisCard][id * 2 + | ||
1378 | i].TarStatus |= | ||
1379 | WIDE_NEGOCIATED; | ||
1380 | } | ||
1555 | 1381 | ||
1382 | sync_bit_map <<= 1; | ||
1556 | 1383 | ||
1557 | } | 1384 | } |
1558 | } | 1385 | } |
1559 | 1386 | ||
1560 | WR_HARPOON((ioport+hp_semaphore), | 1387 | WR_HARPOON((ioport + hp_semaphore), |
1561 | (unsigned char)(RD_HARPOON((ioport+hp_semaphore)) | SCCB_MGR_PRESENT)); | 1388 | (unsigned char)(RD_HARPOON((ioport + hp_semaphore)) | |
1389 | SCCB_MGR_PRESENT)); | ||
1562 | 1390 | ||
1563 | return((unsigned long)CurrCard); | 1391 | return ((unsigned long)CurrCard); |
1564 | } | 1392 | } |
1565 | 1393 | ||
1566 | static void FlashPoint_ReleaseHostAdapter(unsigned long pCurrCard) | 1394 | static void FlashPoint_ReleaseHostAdapter(unsigned long pCurrCard) |
@@ -1570,36 +1398,37 @@ static void FlashPoint_ReleaseHostAdapter(unsigned long pCurrCard) | |||
1570 | unsigned long regOffset; | 1398 | unsigned long regOffset; |
1571 | unsigned long scamData; | 1399 | unsigned long scamData; |
1572 | unsigned long *pScamTbl; | 1400 | unsigned long *pScamTbl; |
1573 | struct nvram_info * pCurrNvRam; | 1401 | struct nvram_info *pCurrNvRam; |
1574 | 1402 | ||
1575 | pCurrNvRam = ((struct sccb_card *)pCurrCard)->pNvRamInfo; | 1403 | pCurrNvRam = ((struct sccb_card *)pCurrCard)->pNvRamInfo; |
1576 | 1404 | ||
1577 | if(pCurrNvRam){ | 1405 | if (pCurrNvRam) { |
1578 | FPT_WrStack(pCurrNvRam->niBaseAddr, 0, pCurrNvRam->niModel); | 1406 | FPT_WrStack(pCurrNvRam->niBaseAddr, 0, pCurrNvRam->niModel); |
1579 | FPT_WrStack(pCurrNvRam->niBaseAddr, 1, pCurrNvRam->niSysConf); | 1407 | FPT_WrStack(pCurrNvRam->niBaseAddr, 1, pCurrNvRam->niSysConf); |
1580 | FPT_WrStack(pCurrNvRam->niBaseAddr, 2, pCurrNvRam->niScsiConf); | 1408 | FPT_WrStack(pCurrNvRam->niBaseAddr, 2, pCurrNvRam->niScsiConf); |
1581 | FPT_WrStack(pCurrNvRam->niBaseAddr, 3, pCurrNvRam->niScamConf); | 1409 | FPT_WrStack(pCurrNvRam->niBaseAddr, 3, pCurrNvRam->niScamConf); |
1582 | FPT_WrStack(pCurrNvRam->niBaseAddr, 4, pCurrNvRam->niAdapId); | 1410 | FPT_WrStack(pCurrNvRam->niBaseAddr, 4, pCurrNvRam->niAdapId); |
1583 | 1411 | ||
1584 | for(i = 0; i < MAX_SCSI_TAR / 2; i++) | 1412 | for (i = 0; i < MAX_SCSI_TAR / 2; i++) |
1585 | FPT_WrStack(pCurrNvRam->niBaseAddr, (unsigned char)(i+5), pCurrNvRam->niSyncTbl[i]); | 1413 | FPT_WrStack(pCurrNvRam->niBaseAddr, |
1414 | (unsigned char)(i + 5), | ||
1415 | pCurrNvRam->niSyncTbl[i]); | ||
1586 | 1416 | ||
1587 | portBase = pCurrNvRam->niBaseAddr; | 1417 | portBase = pCurrNvRam->niBaseAddr; |
1588 | 1418 | ||
1589 | for(i = 0; i < MAX_SCSI_TAR; i++){ | 1419 | for (i = 0; i < MAX_SCSI_TAR; i++) { |
1590 | regOffset = hp_aramBase + 64 + i*4; | 1420 | regOffset = hp_aramBase + 64 + i * 4; |
1591 | pScamTbl = (unsigned long *) &pCurrNvRam->niScamTbl[i]; | 1421 | pScamTbl = (unsigned long *)&pCurrNvRam->niScamTbl[i]; |
1592 | scamData = *pScamTbl; | 1422 | scamData = *pScamTbl; |
1593 | WR_HARP32(portBase, regOffset, scamData); | 1423 | WR_HARP32(portBase, regOffset, scamData); |
1594 | } | 1424 | } |
1595 | 1425 | ||
1596 | }else{ | 1426 | } else { |
1597 | FPT_WrStack(((struct sccb_card *)pCurrCard)->ioPort, 0, 0); | 1427 | FPT_WrStack(((struct sccb_card *)pCurrCard)->ioPort, 0, 0); |
1598 | } | 1428 | } |
1599 | } | 1429 | } |
1600 | 1430 | ||
1601 | 1431 | static void FPT_RNVRamData(struct nvram_info *pNvRamInfo) | |
1602 | static void FPT_RNVRamData(struct nvram_info * pNvRamInfo) | ||
1603 | { | 1432 | { |
1604 | unsigned char i; | 1433 | unsigned char i; |
1605 | unsigned long portBase; | 1434 | unsigned long portBase; |
@@ -1607,21 +1436,22 @@ static void FPT_RNVRamData(struct nvram_info * pNvRamInfo) | |||
1607 | unsigned long scamData; | 1436 | unsigned long scamData; |
1608 | unsigned long *pScamTbl; | 1437 | unsigned long *pScamTbl; |
1609 | 1438 | ||
1610 | pNvRamInfo->niModel = FPT_RdStack(pNvRamInfo->niBaseAddr, 0); | 1439 | pNvRamInfo->niModel = FPT_RdStack(pNvRamInfo->niBaseAddr, 0); |
1611 | pNvRamInfo->niSysConf = FPT_RdStack(pNvRamInfo->niBaseAddr, 1); | 1440 | pNvRamInfo->niSysConf = FPT_RdStack(pNvRamInfo->niBaseAddr, 1); |
1612 | pNvRamInfo->niScsiConf = FPT_RdStack(pNvRamInfo->niBaseAddr, 2); | 1441 | pNvRamInfo->niScsiConf = FPT_RdStack(pNvRamInfo->niBaseAddr, 2); |
1613 | pNvRamInfo->niScamConf = FPT_RdStack(pNvRamInfo->niBaseAddr, 3); | 1442 | pNvRamInfo->niScamConf = FPT_RdStack(pNvRamInfo->niBaseAddr, 3); |
1614 | pNvRamInfo->niAdapId = FPT_RdStack(pNvRamInfo->niBaseAddr, 4); | 1443 | pNvRamInfo->niAdapId = FPT_RdStack(pNvRamInfo->niBaseAddr, 4); |
1615 | 1444 | ||
1616 | for(i = 0; i < MAX_SCSI_TAR / 2; i++) | 1445 | for (i = 0; i < MAX_SCSI_TAR / 2; i++) |
1617 | pNvRamInfo->niSyncTbl[i] = FPT_RdStack(pNvRamInfo->niBaseAddr, (unsigned char)(i+5)); | 1446 | pNvRamInfo->niSyncTbl[i] = |
1447 | FPT_RdStack(pNvRamInfo->niBaseAddr, (unsigned char)(i + 5)); | ||
1618 | 1448 | ||
1619 | portBase = pNvRamInfo->niBaseAddr; | 1449 | portBase = pNvRamInfo->niBaseAddr; |
1620 | 1450 | ||
1621 | for(i = 0; i < MAX_SCSI_TAR; i++){ | 1451 | for (i = 0; i < MAX_SCSI_TAR; i++) { |
1622 | regOffset = hp_aramBase + 64 + i*4; | 1452 | regOffset = hp_aramBase + 64 + i * 4; |
1623 | RD_HARP32(portBase, regOffset, scamData); | 1453 | RD_HARP32(portBase, regOffset, scamData); |
1624 | pScamTbl = (unsigned long *) &pNvRamInfo->niScamTbl[i]; | 1454 | pScamTbl = (unsigned long *)&pNvRamInfo->niScamTbl[i]; |
1625 | *pScamTbl = scamData; | 1455 | *pScamTbl = scamData; |
1626 | } | 1456 | } |
1627 | 1457 | ||
@@ -1630,29 +1460,30 @@ static void FPT_RNVRamData(struct nvram_info * pNvRamInfo) | |||
1630 | static unsigned char FPT_RdStack(unsigned long portBase, unsigned char index) | 1460 | static unsigned char FPT_RdStack(unsigned long portBase, unsigned char index) |
1631 | { | 1461 | { |
1632 | WR_HARPOON(portBase + hp_stack_addr, index); | 1462 | WR_HARPOON(portBase + hp_stack_addr, index); |
1633 | return(RD_HARPOON(portBase + hp_stack_data)); | 1463 | return (RD_HARPOON(portBase + hp_stack_data)); |
1634 | } | 1464 | } |
1635 | 1465 | ||
1636 | static void FPT_WrStack(unsigned long portBase, unsigned char index, unsigned char data) | 1466 | static void FPT_WrStack(unsigned long portBase, unsigned char index, |
1467 | unsigned char data) | ||
1637 | { | 1468 | { |
1638 | WR_HARPOON(portBase + hp_stack_addr, index); | 1469 | WR_HARPOON(portBase + hp_stack_addr, index); |
1639 | WR_HARPOON(portBase + hp_stack_data, data); | 1470 | WR_HARPOON(portBase + hp_stack_data, data); |
1640 | } | 1471 | } |
1641 | 1472 | ||
1642 | |||
1643 | static unsigned char FPT_ChkIfChipInitialized(unsigned long ioPort) | 1473 | static unsigned char FPT_ChkIfChipInitialized(unsigned long ioPort) |
1644 | { | 1474 | { |
1645 | if((RD_HARPOON(ioPort + hp_arb_id) & 0x0f) != FPT_RdStack(ioPort, 4)) | 1475 | if ((RD_HARPOON(ioPort + hp_arb_id) & 0x0f) != FPT_RdStack(ioPort, 4)) |
1646 | return(0); | 1476 | return (0); |
1647 | if((RD_HARPOON(ioPort + hp_clkctrl_0) & CLKCTRL_DEFAULT) | 1477 | if ((RD_HARPOON(ioPort + hp_clkctrl_0) & CLKCTRL_DEFAULT) |
1648 | != CLKCTRL_DEFAULT) | 1478 | != CLKCTRL_DEFAULT) |
1649 | return(0); | 1479 | return (0); |
1650 | if((RD_HARPOON(ioPort + hp_seltimeout) == TO_250ms) || | 1480 | if ((RD_HARPOON(ioPort + hp_seltimeout) == TO_250ms) || |
1651 | (RD_HARPOON(ioPort + hp_seltimeout) == TO_290ms)) | 1481 | (RD_HARPOON(ioPort + hp_seltimeout) == TO_290ms)) |
1652 | return(1); | 1482 | return (1); |
1653 | return(0); | 1483 | return (0); |
1654 | 1484 | ||
1655 | } | 1485 | } |
1486 | |||
1656 | /*--------------------------------------------------------------------- | 1487 | /*--------------------------------------------------------------------- |
1657 | * | 1488 | * |
1658 | * Function: FlashPoint_StartCCB | 1489 | * Function: FlashPoint_StartCCB |
@@ -1662,117 +1493,115 @@ static unsigned char FPT_ChkIfChipInitialized(unsigned long ioPort) | |||
1662 | * callback function. | 1493 | * callback function. |
1663 | * | 1494 | * |
1664 | *---------------------------------------------------------------------*/ | 1495 | *---------------------------------------------------------------------*/ |
1665 | static void FlashPoint_StartCCB(unsigned long pCurrCard, struct sccb * p_Sccb) | 1496 | static void FlashPoint_StartCCB(unsigned long pCurrCard, struct sccb *p_Sccb) |
1666 | { | 1497 | { |
1667 | unsigned long ioport; | 1498 | unsigned long ioport; |
1668 | unsigned char thisCard, lun; | 1499 | unsigned char thisCard, lun; |
1669 | struct sccb * pSaveSccb; | 1500 | struct sccb *pSaveSccb; |
1670 | CALL_BK_FN callback; | 1501 | CALL_BK_FN callback; |
1671 | 1502 | ||
1672 | thisCard = ((struct sccb_card *) pCurrCard)->cardIndex; | 1503 | thisCard = ((struct sccb_card *)pCurrCard)->cardIndex; |
1673 | ioport = ((struct sccb_card *) pCurrCard)->ioPort; | 1504 | ioport = ((struct sccb_card *)pCurrCard)->ioPort; |
1674 | 1505 | ||
1675 | if((p_Sccb->TargID > MAX_SCSI_TAR) || (p_Sccb->Lun > MAX_LUN)) | 1506 | if ((p_Sccb->TargID > MAX_SCSI_TAR) || (p_Sccb->Lun > MAX_LUN)) { |
1676 | { | ||
1677 | 1507 | ||
1678 | p_Sccb->HostStatus = SCCB_COMPLETE; | 1508 | p_Sccb->HostStatus = SCCB_COMPLETE; |
1679 | p_Sccb->SccbStatus = SCCB_ERROR; | 1509 | p_Sccb->SccbStatus = SCCB_ERROR; |
1680 | callback = (CALL_BK_FN)p_Sccb->SccbCallback; | 1510 | callback = (CALL_BK_FN) p_Sccb->SccbCallback; |
1681 | if (callback) | 1511 | if (callback) |
1682 | callback(p_Sccb); | 1512 | callback(p_Sccb); |
1683 | 1513 | ||
1684 | return; | 1514 | return; |
1685 | } | 1515 | } |
1686 | 1516 | ||
1687 | FPT_sinits(p_Sccb,thisCard); | 1517 | FPT_sinits(p_Sccb, thisCard); |
1688 | |||
1689 | |||
1690 | if (!((struct sccb_card *) pCurrCard)->cmdCounter) | ||
1691 | { | ||
1692 | WR_HARPOON(ioport+hp_semaphore, (RD_HARPOON(ioport+hp_semaphore) | ||
1693 | | SCCB_MGR_ACTIVE)); | ||
1694 | |||
1695 | if (((struct sccb_card *) pCurrCard)->globalFlags & F_GREEN_PC) | ||
1696 | { | ||
1697 | WR_HARPOON(ioport+hp_clkctrl_0, CLKCTRL_DEFAULT); | ||
1698 | WR_HARPOON(ioport+hp_sys_ctrl, 0x00); | ||
1699 | } | ||
1700 | } | ||
1701 | |||
1702 | ((struct sccb_card *)pCurrCard)->cmdCounter++; | ||
1703 | 1518 | ||
1704 | if (RD_HARPOON(ioport+hp_semaphore) & BIOS_IN_USE) { | 1519 | if (!((struct sccb_card *)pCurrCard)->cmdCounter) { |
1520 | WR_HARPOON(ioport + hp_semaphore, | ||
1521 | (RD_HARPOON(ioport + hp_semaphore) | ||
1522 | | SCCB_MGR_ACTIVE)); | ||
1705 | 1523 | ||
1706 | WR_HARPOON(ioport+hp_semaphore, (RD_HARPOON(ioport+hp_semaphore) | 1524 | if (((struct sccb_card *)pCurrCard)->globalFlags & F_GREEN_PC) { |
1707 | | TICKLE_ME)); | 1525 | WR_HARPOON(ioport + hp_clkctrl_0, CLKCTRL_DEFAULT); |
1708 | if(p_Sccb->OperationCode == RESET_COMMAND) | 1526 | WR_HARPOON(ioport + hp_sys_ctrl, 0x00); |
1709 | { | 1527 | } |
1710 | pSaveSccb = ((struct sccb_card *) pCurrCard)->currentSCCB; | 1528 | } |
1711 | ((struct sccb_card *) pCurrCard)->currentSCCB = p_Sccb; | ||
1712 | FPT_queueSelectFail(&FPT_BL_Card[thisCard], thisCard); | ||
1713 | ((struct sccb_card *) pCurrCard)->currentSCCB = pSaveSccb; | ||
1714 | } | ||
1715 | else | ||
1716 | { | ||
1717 | FPT_queueAddSccb(p_Sccb,thisCard); | ||
1718 | } | ||
1719 | } | ||
1720 | 1529 | ||
1721 | else if ((RD_HARPOON(ioport+hp_page_ctrl) & G_INT_DISABLE)) { | 1530 | ((struct sccb_card *)pCurrCard)->cmdCounter++; |
1531 | |||
1532 | if (RD_HARPOON(ioport + hp_semaphore) & BIOS_IN_USE) { | ||
1533 | |||
1534 | WR_HARPOON(ioport + hp_semaphore, | ||
1535 | (RD_HARPOON(ioport + hp_semaphore) | ||
1536 | | TICKLE_ME)); | ||
1537 | if (p_Sccb->OperationCode == RESET_COMMAND) { | ||
1538 | pSaveSccb = | ||
1539 | ((struct sccb_card *)pCurrCard)->currentSCCB; | ||
1540 | ((struct sccb_card *)pCurrCard)->currentSCCB = p_Sccb; | ||
1541 | FPT_queueSelectFail(&FPT_BL_Card[thisCard], thisCard); | ||
1542 | ((struct sccb_card *)pCurrCard)->currentSCCB = | ||
1543 | pSaveSccb; | ||
1544 | } else { | ||
1545 | FPT_queueAddSccb(p_Sccb, thisCard); | ||
1546 | } | ||
1547 | } | ||
1722 | 1548 | ||
1723 | if(p_Sccb->OperationCode == RESET_COMMAND) | 1549 | else if ((RD_HARPOON(ioport + hp_page_ctrl) & G_INT_DISABLE)) { |
1724 | { | 1550 | |
1725 | pSaveSccb = ((struct sccb_card *) pCurrCard)->currentSCCB; | 1551 | if (p_Sccb->OperationCode == RESET_COMMAND) { |
1726 | ((struct sccb_card *) pCurrCard)->currentSCCB = p_Sccb; | 1552 | pSaveSccb = |
1727 | FPT_queueSelectFail(&FPT_BL_Card[thisCard], thisCard); | 1553 | ((struct sccb_card *)pCurrCard)->currentSCCB; |
1728 | ((struct sccb_card *) pCurrCard)->currentSCCB = pSaveSccb; | 1554 | ((struct sccb_card *)pCurrCard)->currentSCCB = p_Sccb; |
1729 | } | 1555 | FPT_queueSelectFail(&FPT_BL_Card[thisCard], thisCard); |
1730 | else | 1556 | ((struct sccb_card *)pCurrCard)->currentSCCB = |
1731 | { | 1557 | pSaveSccb; |
1732 | FPT_queueAddSccb(p_Sccb,thisCard); | 1558 | } else { |
1733 | } | 1559 | FPT_queueAddSccb(p_Sccb, thisCard); |
1734 | } | 1560 | } |
1561 | } | ||
1735 | 1562 | ||
1736 | else { | 1563 | else { |
1737 | 1564 | ||
1738 | MDISABLE_INT(ioport); | 1565 | MDISABLE_INT(ioport); |
1739 | 1566 | ||
1740 | if((((struct sccb_card *) pCurrCard)->globalFlags & F_CONLUN_IO) && | 1567 | if ((((struct sccb_card *)pCurrCard)->globalFlags & F_CONLUN_IO) |
1741 | ((FPT_sccbMgrTbl[thisCard][p_Sccb->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) | 1568 | && |
1569 | ((FPT_sccbMgrTbl[thisCard][p_Sccb->TargID]. | ||
1570 | TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) | ||
1742 | lun = p_Sccb->Lun; | 1571 | lun = p_Sccb->Lun; |
1743 | else | 1572 | else |
1744 | lun = 0; | 1573 | lun = 0; |
1745 | if ((((struct sccb_card *) pCurrCard)->currentSCCB == NULL) && | 1574 | if ((((struct sccb_card *)pCurrCard)->currentSCCB == NULL) && |
1746 | (FPT_sccbMgrTbl[thisCard][p_Sccb->TargID].TarSelQ_Cnt == 0) && | 1575 | (FPT_sccbMgrTbl[thisCard][p_Sccb->TargID].TarSelQ_Cnt == 0) |
1747 | (FPT_sccbMgrTbl[thisCard][p_Sccb->TargID].TarLUNBusy[lun] | 1576 | && (FPT_sccbMgrTbl[thisCard][p_Sccb->TargID].TarLUNBusy[lun] |
1748 | == 0)) { | 1577 | == 0)) { |
1749 | |||
1750 | ((struct sccb_card *) pCurrCard)->currentSCCB = p_Sccb; | ||
1751 | FPT_ssel(p_Sccb->SccbIOPort,thisCard); | ||
1752 | } | ||
1753 | |||
1754 | else { | ||
1755 | 1578 | ||
1756 | if(p_Sccb->OperationCode == RESET_COMMAND) | 1579 | ((struct sccb_card *)pCurrCard)->currentSCCB = p_Sccb; |
1757 | { | 1580 | FPT_ssel(p_Sccb->SccbIOPort, thisCard); |
1758 | pSaveSccb = ((struct sccb_card *) pCurrCard)->currentSCCB; | 1581 | } |
1759 | ((struct sccb_card *) pCurrCard)->currentSCCB = p_Sccb; | ||
1760 | FPT_queueSelectFail(&FPT_BL_Card[thisCard], thisCard); | ||
1761 | ((struct sccb_card *) pCurrCard)->currentSCCB = pSaveSccb; | ||
1762 | } | ||
1763 | else | ||
1764 | { | ||
1765 | FPT_queueAddSccb(p_Sccb,thisCard); | ||
1766 | } | ||
1767 | } | ||
1768 | 1582 | ||
1583 | else { | ||
1584 | |||
1585 | if (p_Sccb->OperationCode == RESET_COMMAND) { | ||
1586 | pSaveSccb = | ||
1587 | ((struct sccb_card *)pCurrCard)-> | ||
1588 | currentSCCB; | ||
1589 | ((struct sccb_card *)pCurrCard)->currentSCCB = | ||
1590 | p_Sccb; | ||
1591 | FPT_queueSelectFail(&FPT_BL_Card[thisCard], | ||
1592 | thisCard); | ||
1593 | ((struct sccb_card *)pCurrCard)->currentSCCB = | ||
1594 | pSaveSccb; | ||
1595 | } else { | ||
1596 | FPT_queueAddSccb(p_Sccb, thisCard); | ||
1597 | } | ||
1598 | } | ||
1769 | 1599 | ||
1770 | MENABLE_INT(ioport); | 1600 | MENABLE_INT(ioport); |
1771 | } | 1601 | } |
1772 | 1602 | ||
1773 | } | 1603 | } |
1774 | 1604 | ||
1775 | |||
1776 | /*--------------------------------------------------------------------- | 1605 | /*--------------------------------------------------------------------- |
1777 | * | 1606 | * |
1778 | * Function: FlashPoint_AbortCCB | 1607 | * Function: FlashPoint_AbortCCB |
@@ -1782,98 +1611,106 @@ static void FlashPoint_StartCCB(unsigned long pCurrCard, struct sccb * p_Sccb) | |||
1782 | * callback function. | 1611 | * callback function. |
1783 | * | 1612 | * |
1784 | *---------------------------------------------------------------------*/ | 1613 | *---------------------------------------------------------------------*/ |
1785 | static int FlashPoint_AbortCCB(unsigned long pCurrCard, struct sccb * p_Sccb) | 1614 | static int FlashPoint_AbortCCB(unsigned long pCurrCard, struct sccb *p_Sccb) |
1786 | { | 1615 | { |
1787 | unsigned long ioport; | 1616 | unsigned long ioport; |
1788 | 1617 | ||
1789 | unsigned char thisCard; | 1618 | unsigned char thisCard; |
1790 | CALL_BK_FN callback; | 1619 | CALL_BK_FN callback; |
1791 | unsigned char TID; | 1620 | unsigned char TID; |
1792 | struct sccb * pSaveSCCB; | 1621 | struct sccb *pSaveSCCB; |
1793 | struct sccb_mgr_tar_info * currTar_Info; | 1622 | struct sccb_mgr_tar_info *currTar_Info; |
1794 | |||
1795 | 1623 | ||
1796 | ioport = ((struct sccb_card *) pCurrCard)->ioPort; | 1624 | ioport = ((struct sccb_card *)pCurrCard)->ioPort; |
1797 | 1625 | ||
1798 | thisCard = ((struct sccb_card *)pCurrCard)->cardIndex; | 1626 | thisCard = ((struct sccb_card *)pCurrCard)->cardIndex; |
1799 | 1627 | ||
1800 | if (!(RD_HARPOON(ioport+hp_page_ctrl) & G_INT_DISABLE)) | 1628 | if (!(RD_HARPOON(ioport + hp_page_ctrl) & G_INT_DISABLE)) { |
1801 | { | ||
1802 | 1629 | ||
1803 | if (FPT_queueFindSccb(p_Sccb,thisCard)) | 1630 | if (FPT_queueFindSccb(p_Sccb, thisCard)) { |
1804 | { | ||
1805 | 1631 | ||
1806 | ((struct sccb_card *)pCurrCard)->cmdCounter--; | 1632 | ((struct sccb_card *)pCurrCard)->cmdCounter--; |
1807 | 1633 | ||
1808 | if (!((struct sccb_card *)pCurrCard)->cmdCounter) | 1634 | if (!((struct sccb_card *)pCurrCard)->cmdCounter) |
1809 | WR_HARPOON(ioport+hp_semaphore,(RD_HARPOON(ioport+hp_semaphore) | 1635 | WR_HARPOON(ioport + hp_semaphore, |
1810 | & (unsigned char)(~(SCCB_MGR_ACTIVE | TICKLE_ME)) )); | 1636 | (RD_HARPOON(ioport + hp_semaphore) |
1637 | & (unsigned | ||
1638 | char)(~(SCCB_MGR_ACTIVE | | ||
1639 | TICKLE_ME)))); | ||
1811 | 1640 | ||
1812 | p_Sccb->SccbStatus = SCCB_ABORT; | 1641 | p_Sccb->SccbStatus = SCCB_ABORT; |
1813 | callback = p_Sccb->SccbCallback; | 1642 | callback = p_Sccb->SccbCallback; |
1814 | callback(p_Sccb); | 1643 | callback(p_Sccb); |
1815 | 1644 | ||
1816 | return(0); | 1645 | return (0); |
1817 | } | 1646 | } |
1818 | 1647 | ||
1819 | else | 1648 | else { |
1820 | { | 1649 | if (((struct sccb_card *)pCurrCard)->currentSCCB == |
1821 | if (((struct sccb_card *)pCurrCard)->currentSCCB == p_Sccb) | 1650 | p_Sccb) { |
1822 | { | ||
1823 | p_Sccb->SccbStatus = SCCB_ABORT; | 1651 | p_Sccb->SccbStatus = SCCB_ABORT; |
1824 | return(0); | 1652 | return (0); |
1825 | 1653 | ||
1826 | } | 1654 | } |
1827 | 1655 | ||
1828 | else | 1656 | else { |
1829 | { | ||
1830 | 1657 | ||
1831 | TID = p_Sccb->TargID; | 1658 | TID = p_Sccb->TargID; |
1832 | 1659 | ||
1833 | 1660 | if (p_Sccb->Sccb_tag) { | |
1834 | if(p_Sccb->Sccb_tag) | ||
1835 | { | ||
1836 | MDISABLE_INT(ioport); | 1661 | MDISABLE_INT(ioport); |
1837 | if (((struct sccb_card *) pCurrCard)->discQ_Tbl[p_Sccb->Sccb_tag]==p_Sccb) | 1662 | if (((struct sccb_card *)pCurrCard)-> |
1838 | { | 1663 | discQ_Tbl[p_Sccb->Sccb_tag] == |
1664 | p_Sccb) { | ||
1839 | p_Sccb->SccbStatus = SCCB_ABORT; | 1665 | p_Sccb->SccbStatus = SCCB_ABORT; |
1840 | p_Sccb->Sccb_scsistat = ABORT_ST; | 1666 | p_Sccb->Sccb_scsistat = |
1841 | p_Sccb->Sccb_scsimsg = SMABORT_TAG; | 1667 | ABORT_ST; |
1842 | 1668 | p_Sccb->Sccb_scsimsg = | |
1843 | if(((struct sccb_card *) pCurrCard)->currentSCCB == NULL) | 1669 | SMABORT_TAG; |
1844 | { | 1670 | |
1845 | ((struct sccb_card *) pCurrCard)->currentSCCB = p_Sccb; | 1671 | if (((struct sccb_card *) |
1846 | FPT_ssel(ioport, thisCard); | 1672 | pCurrCard)->currentSCCB == |
1847 | } | 1673 | NULL) { |
1848 | else | 1674 | ((struct sccb_card *) |
1849 | { | 1675 | pCurrCard)-> |
1850 | pSaveSCCB = ((struct sccb_card *) pCurrCard)->currentSCCB; | 1676 | currentSCCB = p_Sccb; |
1851 | ((struct sccb_card *) pCurrCard)->currentSCCB = p_Sccb; | 1677 | FPT_ssel(ioport, |
1852 | FPT_queueSelectFail((struct sccb_card *) pCurrCard, thisCard); | 1678 | thisCard); |
1853 | ((struct sccb_card *) pCurrCard)->currentSCCB = pSaveSCCB; | 1679 | } else { |
1680 | pSaveSCCB = | ||
1681 | ((struct sccb_card | ||
1682 | *)pCurrCard)-> | ||
1683 | currentSCCB; | ||
1684 | ((struct sccb_card *) | ||
1685 | pCurrCard)-> | ||
1686 | currentSCCB = p_Sccb; | ||
1687 | FPT_queueSelectFail((struct sccb_card *)pCurrCard, thisCard); | ||
1688 | ((struct sccb_card *) | ||
1689 | pCurrCard)-> | ||
1690 | currentSCCB = pSaveSCCB; | ||
1854 | } | 1691 | } |
1855 | } | 1692 | } |
1856 | MENABLE_INT(ioport); | 1693 | MENABLE_INT(ioport); |
1857 | return(0); | 1694 | return (0); |
1858 | } | 1695 | } else { |
1859 | else | 1696 | currTar_Info = |
1860 | { | 1697 | &FPT_sccbMgrTbl[thisCard][p_Sccb-> |
1861 | currTar_Info = &FPT_sccbMgrTbl[thisCard][p_Sccb->TargID]; | 1698 | TargID]; |
1862 | 1699 | ||
1863 | if(FPT_BL_Card[thisCard].discQ_Tbl[currTar_Info->LunDiscQ_Idx[p_Sccb->Lun]] | 1700 | if (FPT_BL_Card[thisCard]. |
1864 | == p_Sccb) | 1701 | discQ_Tbl[currTar_Info-> |
1865 | { | 1702 | LunDiscQ_Idx[p_Sccb->Lun]] |
1703 | == p_Sccb) { | ||
1866 | p_Sccb->SccbStatus = SCCB_ABORT; | 1704 | p_Sccb->SccbStatus = SCCB_ABORT; |
1867 | return(0); | 1705 | return (0); |
1868 | } | 1706 | } |
1869 | } | 1707 | } |
1870 | } | 1708 | } |
1871 | } | 1709 | } |
1872 | } | 1710 | } |
1873 | return(-1); | 1711 | return (-1); |
1874 | } | 1712 | } |
1875 | 1713 | ||
1876 | |||
1877 | /*--------------------------------------------------------------------- | 1714 | /*--------------------------------------------------------------------- |
1878 | * | 1715 | * |
1879 | * Function: FlashPoint_InterruptPending | 1716 | * Function: FlashPoint_InterruptPending |
@@ -1884,22 +1721,19 @@ static int FlashPoint_AbortCCB(unsigned long pCurrCard, struct sccb * p_Sccb) | |||
1884 | *---------------------------------------------------------------------*/ | 1721 | *---------------------------------------------------------------------*/ |
1885 | static unsigned char FlashPoint_InterruptPending(unsigned long pCurrCard) | 1722 | static unsigned char FlashPoint_InterruptPending(unsigned long pCurrCard) |
1886 | { | 1723 | { |
1887 | unsigned long ioport; | 1724 | unsigned long ioport; |
1888 | 1725 | ||
1889 | ioport = ((struct sccb_card *)pCurrCard)->ioPort; | 1726 | ioport = ((struct sccb_card *)pCurrCard)->ioPort; |
1890 | 1727 | ||
1891 | if (RD_HARPOON(ioport+hp_int_status) & INT_ASSERTED) | 1728 | if (RD_HARPOON(ioport + hp_int_status) & INT_ASSERTED) { |
1892 | { | 1729 | return (1); |
1893 | return(1); | 1730 | } |
1894 | } | ||
1895 | 1731 | ||
1896 | else | 1732 | else |
1897 | 1733 | ||
1898 | return(0); | 1734 | return (0); |
1899 | } | 1735 | } |
1900 | 1736 | ||
1901 | |||
1902 | |||
1903 | /*--------------------------------------------------------------------- | 1737 | /*--------------------------------------------------------------------- |
1904 | * | 1738 | * |
1905 | * Function: FlashPoint_HandleInterrupt | 1739 | * Function: FlashPoint_HandleInterrupt |
@@ -1911,237 +1745,259 @@ static unsigned char FlashPoint_InterruptPending(unsigned long pCurrCard) | |||
1911 | *---------------------------------------------------------------------*/ | 1745 | *---------------------------------------------------------------------*/ |
1912 | static int FlashPoint_HandleInterrupt(unsigned long pCurrCard) | 1746 | static int FlashPoint_HandleInterrupt(unsigned long pCurrCard) |
1913 | { | 1747 | { |
1914 | struct sccb * currSCCB; | 1748 | struct sccb *currSCCB; |
1915 | unsigned char thisCard,result,bm_status, bm_int_st; | 1749 | unsigned char thisCard, result, bm_status, bm_int_st; |
1916 | unsigned short hp_int; | 1750 | unsigned short hp_int; |
1917 | unsigned char i, target; | 1751 | unsigned char i, target; |
1918 | unsigned long ioport; | 1752 | unsigned long ioport; |
1919 | |||
1920 | thisCard = ((struct sccb_card *)pCurrCard)->cardIndex; | ||
1921 | ioport = ((struct sccb_card *)pCurrCard)->ioPort; | ||
1922 | |||
1923 | MDISABLE_INT(ioport); | ||
1924 | 1753 | ||
1925 | if ((bm_int_st=RD_HARPOON(ioport+hp_int_status)) & EXT_STATUS_ON) | 1754 | thisCard = ((struct sccb_card *)pCurrCard)->cardIndex; |
1926 | bm_status = RD_HARPOON(ioport+hp_ext_status) & (unsigned char)BAD_EXT_STATUS; | 1755 | ioport = ((struct sccb_card *)pCurrCard)->ioPort; |
1927 | else | ||
1928 | bm_status = 0; | ||
1929 | 1756 | ||
1930 | WR_HARPOON(ioport+hp_int_mask, (INT_CMD_COMPL | SCSI_INTERRUPT)); | 1757 | MDISABLE_INT(ioport); |
1931 | 1758 | ||
1932 | while ((hp_int = RDW_HARPOON((ioport+hp_intstat)) & FPT_default_intena) | | 1759 | if ((bm_int_st = RD_HARPOON(ioport + hp_int_status)) & EXT_STATUS_ON) |
1933 | bm_status) | 1760 | bm_status = |
1934 | { | 1761 | RD_HARPOON(ioport + |
1762 | hp_ext_status) & (unsigned char)BAD_EXT_STATUS; | ||
1763 | else | ||
1764 | bm_status = 0; | ||
1935 | 1765 | ||
1936 | currSCCB = ((struct sccb_card *)pCurrCard)->currentSCCB; | 1766 | WR_HARPOON(ioport + hp_int_mask, (INT_CMD_COMPL | SCSI_INTERRUPT)); |
1937 | 1767 | ||
1938 | if (hp_int & (FIFO | TIMEOUT | RESET | SCAM_SEL) || bm_status) { | 1768 | while ((hp_int = |
1939 | result = FPT_SccbMgr_bad_isr(ioport,thisCard,((struct sccb_card *)pCurrCard),hp_int); | 1769 | RDW_HARPOON((ioport + |
1940 | WRW_HARPOON((ioport+hp_intstat), (FIFO | TIMEOUT | RESET | SCAM_SEL)); | 1770 | hp_intstat)) & FPT_default_intena) | bm_status) { |
1941 | bm_status = 0; | ||
1942 | 1771 | ||
1943 | if (result) { | 1772 | currSCCB = ((struct sccb_card *)pCurrCard)->currentSCCB; |
1944 | 1773 | ||
1945 | MENABLE_INT(ioport); | 1774 | if (hp_int & (FIFO | TIMEOUT | RESET | SCAM_SEL) || bm_status) { |
1946 | return(result); | 1775 | result = |
1947 | } | 1776 | FPT_SccbMgr_bad_isr(ioport, thisCard, |
1948 | } | 1777 | ((struct sccb_card *)pCurrCard), |
1778 | hp_int); | ||
1779 | WRW_HARPOON((ioport + hp_intstat), | ||
1780 | (FIFO | TIMEOUT | RESET | SCAM_SEL)); | ||
1781 | bm_status = 0; | ||
1949 | 1782 | ||
1783 | if (result) { | ||
1950 | 1784 | ||
1951 | else if (hp_int & ICMD_COMP) { | 1785 | MENABLE_INT(ioport); |
1786 | return (result); | ||
1787 | } | ||
1788 | } | ||
1952 | 1789 | ||
1953 | if ( !(hp_int & BUS_FREE) ) { | 1790 | else if (hp_int & ICMD_COMP) { |
1954 | /* Wait for the BusFree before starting a new command. We | 1791 | |
1955 | must also check for being reselected since the BusFree | 1792 | if (!(hp_int & BUS_FREE)) { |
1956 | may not show up if another device reselects us in 1.5us or | 1793 | /* Wait for the BusFree before starting a new command. We |
1957 | less. SRR Wednesday, 3/8/1995. | 1794 | must also check for being reselected since the BusFree |
1958 | */ | 1795 | may not show up if another device reselects us in 1.5us or |
1959 | while (!(RDW_HARPOON((ioport+hp_intstat)) & (BUS_FREE | RSEL))) ; | 1796 | less. SRR Wednesday, 3/8/1995. |
1960 | } | 1797 | */ |
1798 | while (! | ||
1799 | (RDW_HARPOON((ioport + hp_intstat)) & | ||
1800 | (BUS_FREE | RSEL))) ; | ||
1801 | } | ||
1961 | 1802 | ||
1962 | if (((struct sccb_card *)pCurrCard)->globalFlags & F_HOST_XFER_ACT) | 1803 | if (((struct sccb_card *)pCurrCard)-> |
1804 | globalFlags & F_HOST_XFER_ACT) | ||
1963 | 1805 | ||
1964 | FPT_phaseChkFifo(ioport, thisCard); | 1806 | FPT_phaseChkFifo(ioport, thisCard); |
1965 | 1807 | ||
1966 | /* WRW_HARPOON((ioport+hp_intstat), | 1808 | /* WRW_HARPOON((ioport+hp_intstat), |
1967 | (BUS_FREE | ICMD_COMP | ITAR_DISC | XFER_CNT_0)); | 1809 | (BUS_FREE | ICMD_COMP | ITAR_DISC | XFER_CNT_0)); |
1968 | */ | 1810 | */ |
1969 | 1811 | ||
1970 | WRW_HARPOON((ioport+hp_intstat), CLR_ALL_INT_1); | 1812 | WRW_HARPOON((ioport + hp_intstat), CLR_ALL_INT_1); |
1971 | |||
1972 | FPT_autoCmdCmplt(ioport,thisCard); | ||
1973 | 1813 | ||
1974 | } | 1814 | FPT_autoCmdCmplt(ioport, thisCard); |
1975 | 1815 | ||
1816 | } | ||
1976 | 1817 | ||
1977 | else if (hp_int & ITAR_DISC) | 1818 | else if (hp_int & ITAR_DISC) { |
1978 | { | ||
1979 | |||
1980 | if (((struct sccb_card *)pCurrCard)->globalFlags & F_HOST_XFER_ACT) { | ||
1981 | |||
1982 | FPT_phaseChkFifo(ioport, thisCard); | ||
1983 | |||
1984 | } | ||
1985 | |||
1986 | if (RD_HARPOON(ioport+hp_gp_reg_1) == SMSAVE_DATA_PTR) { | ||
1987 | |||
1988 | WR_HARPOON(ioport+hp_gp_reg_1, 0x00); | ||
1989 | currSCCB->Sccb_XferState |= F_NO_DATA_YET; | ||
1990 | |||
1991 | currSCCB->Sccb_savedATC = currSCCB->Sccb_ATC; | ||
1992 | } | ||
1993 | |||
1994 | currSCCB->Sccb_scsistat = DISCONNECT_ST; | ||
1995 | FPT_queueDisconnect(currSCCB,thisCard); | ||
1996 | |||
1997 | /* Wait for the BusFree before starting a new command. We | ||
1998 | must also check for being reselected since the BusFree | ||
1999 | may not show up if another device reselects us in 1.5us or | ||
2000 | less. SRR Wednesday, 3/8/1995. | ||
2001 | */ | ||
2002 | while (!(RDW_HARPOON((ioport+hp_intstat)) & (BUS_FREE | RSEL)) && | ||
2003 | !((RDW_HARPOON((ioport+hp_intstat)) & PHASE) && | ||
2004 | RD_HARPOON((ioport+hp_scsisig)) == | ||
2005 | (SCSI_BSY | SCSI_REQ | SCSI_CD | SCSI_MSG | SCSI_IOBIT))) ; | ||
2006 | |||
2007 | /* | ||
2008 | The additional loop exit condition above detects a timing problem | ||
2009 | with the revision D/E harpoon chips. The caller should reset the | ||
2010 | host adapter to recover when 0xFE is returned. | ||
2011 | */ | ||
2012 | if (!(RDW_HARPOON((ioport+hp_intstat)) & (BUS_FREE | RSEL))) | ||
2013 | { | ||
2014 | MENABLE_INT(ioport); | ||
2015 | return 0xFE; | ||
2016 | } | ||
2017 | 1819 | ||
2018 | WRW_HARPOON((ioport+hp_intstat), (BUS_FREE | ITAR_DISC)); | 1820 | if (((struct sccb_card *)pCurrCard)-> |
1821 | globalFlags & F_HOST_XFER_ACT) { | ||
2019 | 1822 | ||
1823 | FPT_phaseChkFifo(ioport, thisCard); | ||
2020 | 1824 | ||
2021 | ((struct sccb_card *)pCurrCard)->globalFlags |= F_NEW_SCCB_CMD; | 1825 | } |
2022 | 1826 | ||
2023 | } | 1827 | if (RD_HARPOON(ioport + hp_gp_reg_1) == SMSAVE_DATA_PTR) { |
2024 | 1828 | ||
1829 | WR_HARPOON(ioport + hp_gp_reg_1, 0x00); | ||
1830 | currSCCB->Sccb_XferState |= F_NO_DATA_YET; | ||
2025 | 1831 | ||
2026 | else if (hp_int & RSEL) { | 1832 | currSCCB->Sccb_savedATC = currSCCB->Sccb_ATC; |
1833 | } | ||
2027 | 1834 | ||
2028 | WRW_HARPOON((ioport+hp_intstat), (PROG_HLT | RSEL | PHASE | BUS_FREE)); | 1835 | currSCCB->Sccb_scsistat = DISCONNECT_ST; |
1836 | FPT_queueDisconnect(currSCCB, thisCard); | ||
1837 | |||
1838 | /* Wait for the BusFree before starting a new command. We | ||
1839 | must also check for being reselected since the BusFree | ||
1840 | may not show up if another device reselects us in 1.5us or | ||
1841 | less. SRR Wednesday, 3/8/1995. | ||
1842 | */ | ||
1843 | while (! | ||
1844 | (RDW_HARPOON((ioport + hp_intstat)) & | ||
1845 | (BUS_FREE | RSEL)) | ||
1846 | && !((RDW_HARPOON((ioport + hp_intstat)) & PHASE) | ||
1847 | && RD_HARPOON((ioport + hp_scsisig)) == | ||
1848 | (SCSI_BSY | SCSI_REQ | SCSI_CD | SCSI_MSG | | ||
1849 | SCSI_IOBIT))) ; | ||
1850 | |||
1851 | /* | ||
1852 | The additional loop exit condition above detects a timing problem | ||
1853 | with the revision D/E harpoon chips. The caller should reset the | ||
1854 | host adapter to recover when 0xFE is returned. | ||
1855 | */ | ||
1856 | if (! | ||
1857 | (RDW_HARPOON((ioport + hp_intstat)) & | ||
1858 | (BUS_FREE | RSEL))) { | ||
1859 | MENABLE_INT(ioport); | ||
1860 | return 0xFE; | ||
1861 | } | ||
2029 | 1862 | ||
2030 | if (RDW_HARPOON((ioport+hp_intstat)) & ITAR_DISC) | 1863 | WRW_HARPOON((ioport + hp_intstat), |
2031 | { | 1864 | (BUS_FREE | ITAR_DISC)); |
2032 | if (((struct sccb_card *)pCurrCard)->globalFlags & F_HOST_XFER_ACT) | ||
2033 | { | ||
2034 | FPT_phaseChkFifo(ioport, thisCard); | ||
2035 | } | ||
2036 | 1865 | ||
2037 | if (RD_HARPOON(ioport+hp_gp_reg_1) == SMSAVE_DATA_PTR) | 1866 | ((struct sccb_card *)pCurrCard)->globalFlags |= |
2038 | { | 1867 | F_NEW_SCCB_CMD; |
2039 | WR_HARPOON(ioport+hp_gp_reg_1, 0x00); | ||
2040 | currSCCB->Sccb_XferState |= F_NO_DATA_YET; | ||
2041 | currSCCB->Sccb_savedATC = currSCCB->Sccb_ATC; | ||
2042 | } | ||
2043 | 1868 | ||
2044 | WRW_HARPOON((ioport+hp_intstat), (BUS_FREE | ITAR_DISC)); | 1869 | } |
2045 | currSCCB->Sccb_scsistat = DISCONNECT_ST; | ||
2046 | FPT_queueDisconnect(currSCCB,thisCard); | ||
2047 | } | ||
2048 | 1870 | ||
2049 | FPT_sres(ioport,thisCard,((struct sccb_card *)pCurrCard)); | 1871 | else if (hp_int & RSEL) { |
2050 | FPT_phaseDecode(ioport,thisCard); | ||
2051 | 1872 | ||
2052 | } | 1873 | WRW_HARPOON((ioport + hp_intstat), |
1874 | (PROG_HLT | RSEL | PHASE | BUS_FREE)); | ||
2053 | 1875 | ||
1876 | if (RDW_HARPOON((ioport + hp_intstat)) & ITAR_DISC) { | ||
1877 | if (((struct sccb_card *)pCurrCard)-> | ||
1878 | globalFlags & F_HOST_XFER_ACT) { | ||
1879 | FPT_phaseChkFifo(ioport, thisCard); | ||
1880 | } | ||
2054 | 1881 | ||
2055 | else if ((hp_int & IDO_STRT) && (!(hp_int & BUS_FREE))) | 1882 | if (RD_HARPOON(ioport + hp_gp_reg_1) == |
2056 | { | 1883 | SMSAVE_DATA_PTR) { |
1884 | WR_HARPOON(ioport + hp_gp_reg_1, 0x00); | ||
1885 | currSCCB->Sccb_XferState |= | ||
1886 | F_NO_DATA_YET; | ||
1887 | currSCCB->Sccb_savedATC = | ||
1888 | currSCCB->Sccb_ATC; | ||
1889 | } | ||
2057 | 1890 | ||
2058 | WRW_HARPOON((ioport+hp_intstat), (IDO_STRT | XFER_CNT_0)); | 1891 | WRW_HARPOON((ioport + hp_intstat), |
2059 | FPT_phaseDecode(ioport,thisCard); | 1892 | (BUS_FREE | ITAR_DISC)); |
1893 | currSCCB->Sccb_scsistat = DISCONNECT_ST; | ||
1894 | FPT_queueDisconnect(currSCCB, thisCard); | ||
1895 | } | ||
2060 | 1896 | ||
2061 | } | 1897 | FPT_sres(ioport, thisCard, |
1898 | ((struct sccb_card *)pCurrCard)); | ||
1899 | FPT_phaseDecode(ioport, thisCard); | ||
2062 | 1900 | ||
1901 | } | ||
2063 | 1902 | ||
2064 | else if ( (hp_int & IUNKWN) || (hp_int & PROG_HLT) ) | 1903 | else if ((hp_int & IDO_STRT) && (!(hp_int & BUS_FREE))) { |
2065 | { | ||
2066 | WRW_HARPOON((ioport+hp_intstat), (PHASE | IUNKWN | PROG_HLT)); | ||
2067 | if ((RD_HARPOON(ioport+hp_prgmcnt_0) & (unsigned char)0x3f)< (unsigned char)SELCHK) | ||
2068 | { | ||
2069 | FPT_phaseDecode(ioport,thisCard); | ||
2070 | } | ||
2071 | else | ||
2072 | { | ||
2073 | /* Harpoon problem some SCSI target device respond to selection | ||
2074 | with short BUSY pulse (<400ns) this will make the Harpoon is not able | ||
2075 | to latch the correct Target ID into reg. x53. | ||
2076 | The work around require to correct this reg. But when write to this | ||
2077 | reg. (0x53) also increment the FIFO write addr reg (0x6f), thus we | ||
2078 | need to read this reg first then restore it later. After update to 0x53 */ | ||
2079 | 1904 | ||
2080 | i = (unsigned char)(RD_HARPOON(ioport+hp_fifowrite)); | 1905 | WRW_HARPOON((ioport + hp_intstat), |
2081 | target = (unsigned char)(RD_HARPOON(ioport+hp_gp_reg_3)); | 1906 | (IDO_STRT | XFER_CNT_0)); |
2082 | WR_HARPOON(ioport+hp_xfer_pad, (unsigned char) ID_UNLOCK); | 1907 | FPT_phaseDecode(ioport, thisCard); |
2083 | WR_HARPOON(ioport+hp_select_id, (unsigned char)(target | target<<4)); | ||
2084 | WR_HARPOON(ioport+hp_xfer_pad, (unsigned char) 0x00); | ||
2085 | WR_HARPOON(ioport+hp_fifowrite, i); | ||
2086 | WR_HARPOON(ioport+hp_autostart_3, (AUTO_IMMED+TAG_STRT)); | ||
2087 | } | ||
2088 | } | ||
2089 | 1908 | ||
2090 | else if (hp_int & XFER_CNT_0) { | 1909 | } |
2091 | 1910 | ||
2092 | WRW_HARPOON((ioport+hp_intstat), XFER_CNT_0); | 1911 | else if ((hp_int & IUNKWN) || (hp_int & PROG_HLT)) { |
1912 | WRW_HARPOON((ioport + hp_intstat), | ||
1913 | (PHASE | IUNKWN | PROG_HLT)); | ||
1914 | if ((RD_HARPOON(ioport + hp_prgmcnt_0) & (unsigned char) | ||
1915 | 0x3f) < (unsigned char)SELCHK) { | ||
1916 | FPT_phaseDecode(ioport, thisCard); | ||
1917 | } else { | ||
1918 | /* Harpoon problem some SCSI target device respond to selection | ||
1919 | with short BUSY pulse (<400ns) this will make the Harpoon is not able | ||
1920 | to latch the correct Target ID into reg. x53. | ||
1921 | The work around require to correct this reg. But when write to this | ||
1922 | reg. (0x53) also increment the FIFO write addr reg (0x6f), thus we | ||
1923 | need to read this reg first then restore it later. After update to 0x53 */ | ||
1924 | |||
1925 | i = (unsigned | ||
1926 | char)(RD_HARPOON(ioport + hp_fifowrite)); | ||
1927 | target = | ||
1928 | (unsigned | ||
1929 | char)(RD_HARPOON(ioport + hp_gp_reg_3)); | ||
1930 | WR_HARPOON(ioport + hp_xfer_pad, | ||
1931 | (unsigned char)ID_UNLOCK); | ||
1932 | WR_HARPOON(ioport + hp_select_id, | ||
1933 | (unsigned char)(target | target << | ||
1934 | 4)); | ||
1935 | WR_HARPOON(ioport + hp_xfer_pad, | ||
1936 | (unsigned char)0x00); | ||
1937 | WR_HARPOON(ioport + hp_fifowrite, i); | ||
1938 | WR_HARPOON(ioport + hp_autostart_3, | ||
1939 | (AUTO_IMMED + TAG_STRT)); | ||
1940 | } | ||
1941 | } | ||
2093 | 1942 | ||
2094 | FPT_schkdd(ioport,thisCard); | 1943 | else if (hp_int & XFER_CNT_0) { |
2095 | 1944 | ||
2096 | } | 1945 | WRW_HARPOON((ioport + hp_intstat), XFER_CNT_0); |
2097 | 1946 | ||
1947 | FPT_schkdd(ioport, thisCard); | ||
2098 | 1948 | ||
2099 | else if (hp_int & BUS_FREE) { | 1949 | } |
2100 | 1950 | ||
2101 | WRW_HARPOON((ioport+hp_intstat), BUS_FREE); | 1951 | else if (hp_int & BUS_FREE) { |
2102 | 1952 | ||
2103 | if (((struct sccb_card *)pCurrCard)->globalFlags & F_HOST_XFER_ACT) { | 1953 | WRW_HARPOON((ioport + hp_intstat), BUS_FREE); |
2104 | 1954 | ||
2105 | FPT_hostDataXferAbort(ioport,thisCard,currSCCB); | 1955 | if (((struct sccb_card *)pCurrCard)-> |
2106 | } | 1956 | globalFlags & F_HOST_XFER_ACT) { |
2107 | 1957 | ||
2108 | FPT_phaseBusFree(ioport,thisCard); | 1958 | FPT_hostDataXferAbort(ioport, thisCard, |
1959 | currSCCB); | ||
2109 | } | 1960 | } |
2110 | 1961 | ||
1962 | FPT_phaseBusFree(ioport, thisCard); | ||
1963 | } | ||
2111 | 1964 | ||
2112 | else if (hp_int & ITICKLE) { | 1965 | else if (hp_int & ITICKLE) { |
2113 | |||
2114 | WRW_HARPOON((ioport+hp_intstat), ITICKLE); | ||
2115 | ((struct sccb_card *)pCurrCard)->globalFlags |= F_NEW_SCCB_CMD; | ||
2116 | } | ||
2117 | |||
2118 | |||
2119 | |||
2120 | if (((struct sccb_card *)pCurrCard)->globalFlags & F_NEW_SCCB_CMD) { | ||
2121 | 1966 | ||
1967 | WRW_HARPOON((ioport + hp_intstat), ITICKLE); | ||
1968 | ((struct sccb_card *)pCurrCard)->globalFlags |= | ||
1969 | F_NEW_SCCB_CMD; | ||
1970 | } | ||
2122 | 1971 | ||
2123 | ((struct sccb_card *)pCurrCard)->globalFlags &= ~F_NEW_SCCB_CMD; | 1972 | if (((struct sccb_card *)pCurrCard)-> |
1973 | globalFlags & F_NEW_SCCB_CMD) { | ||
2124 | 1974 | ||
1975 | ((struct sccb_card *)pCurrCard)->globalFlags &= | ||
1976 | ~F_NEW_SCCB_CMD; | ||
2125 | 1977 | ||
2126 | if (((struct sccb_card *)pCurrCard)->currentSCCB == NULL) { | 1978 | if (((struct sccb_card *)pCurrCard)->currentSCCB == |
1979 | NULL) { | ||
2127 | 1980 | ||
2128 | FPT_queueSearchSelect(((struct sccb_card *)pCurrCard),thisCard); | 1981 | FPT_queueSearchSelect(((struct sccb_card *) |
2129 | } | 1982 | pCurrCard), thisCard); |
1983 | } | ||
2130 | 1984 | ||
2131 | if (((struct sccb_card *)pCurrCard)->currentSCCB != NULL) { | 1985 | if (((struct sccb_card *)pCurrCard)->currentSCCB != |
2132 | ((struct sccb_card *)pCurrCard)->globalFlags &= ~F_NEW_SCCB_CMD; | 1986 | NULL) { |
2133 | FPT_ssel(ioport,thisCard); | 1987 | ((struct sccb_card *)pCurrCard)->globalFlags &= |
2134 | } | 1988 | ~F_NEW_SCCB_CMD; |
1989 | FPT_ssel(ioport, thisCard); | ||
1990 | } | ||
2135 | 1991 | ||
2136 | break; | 1992 | break; |
2137 | 1993 | ||
2138 | } | 1994 | } |
2139 | 1995 | ||
2140 | } /*end while */ | 1996 | } /*end while */ |
2141 | 1997 | ||
2142 | MENABLE_INT(ioport); | 1998 | MENABLE_INT(ioport); |
2143 | 1999 | ||
2144 | return(0); | 2000 | return (0); |
2145 | } | 2001 | } |
2146 | 2002 | ||
2147 | /*--------------------------------------------------------------------- | 2003 | /*--------------------------------------------------------------------- |
@@ -2154,150 +2010,149 @@ static int FlashPoint_HandleInterrupt(unsigned long pCurrCard) | |||
2154 | * processing time. | 2010 | * processing time. |
2155 | * | 2011 | * |
2156 | *---------------------------------------------------------------------*/ | 2012 | *---------------------------------------------------------------------*/ |
2157 | static unsigned char FPT_SccbMgr_bad_isr(unsigned long p_port, unsigned char p_card, | 2013 | static unsigned char FPT_SccbMgr_bad_isr(unsigned long p_port, |
2158 | struct sccb_card * pCurrCard, unsigned short p_int) | 2014 | unsigned char p_card, |
2015 | struct sccb_card *pCurrCard, | ||
2016 | unsigned short p_int) | ||
2159 | { | 2017 | { |
2160 | unsigned char temp, ScamFlg; | 2018 | unsigned char temp, ScamFlg; |
2161 | struct sccb_mgr_tar_info * currTar_Info; | 2019 | struct sccb_mgr_tar_info *currTar_Info; |
2162 | struct nvram_info * pCurrNvRam; | 2020 | struct nvram_info *pCurrNvRam; |
2163 | |||
2164 | |||
2165 | if (RD_HARPOON(p_port+hp_ext_status) & | ||
2166 | (BM_FORCE_OFF | PCI_DEV_TMOUT | BM_PARITY_ERR | PIO_OVERRUN) ) | ||
2167 | { | ||
2168 | 2021 | ||
2169 | if (pCurrCard->globalFlags & F_HOST_XFER_ACT) | 2022 | if (RD_HARPOON(p_port + hp_ext_status) & |
2170 | { | 2023 | (BM_FORCE_OFF | PCI_DEV_TMOUT | BM_PARITY_ERR | PIO_OVERRUN)) { |
2171 | 2024 | ||
2172 | FPT_hostDataXferAbort(p_port,p_card, pCurrCard->currentSCCB); | 2025 | if (pCurrCard->globalFlags & F_HOST_XFER_ACT) { |
2173 | } | ||
2174 | 2026 | ||
2175 | if (RD_HARPOON(p_port+hp_pci_stat_cfg) & REC_MASTER_ABORT) | 2027 | FPT_hostDataXferAbort(p_port, p_card, |
2176 | 2028 | pCurrCard->currentSCCB); | |
2177 | { | 2029 | } |
2178 | WR_HARPOON(p_port+hp_pci_stat_cfg, | ||
2179 | (RD_HARPOON(p_port+hp_pci_stat_cfg) & ~REC_MASTER_ABORT)); | ||
2180 | |||
2181 | WR_HARPOON(p_port+hp_host_blk_cnt, 0x00); | ||
2182 | |||
2183 | } | ||
2184 | |||
2185 | if (pCurrCard->currentSCCB != NULL) | ||
2186 | { | ||
2187 | 2030 | ||
2188 | if (!pCurrCard->currentSCCB->HostStatus) | 2031 | if (RD_HARPOON(p_port + hp_pci_stat_cfg) & REC_MASTER_ABORT) |
2189 | pCurrCard->currentSCCB->HostStatus = SCCB_BM_ERR; | 2032 | { |
2033 | WR_HARPOON(p_port + hp_pci_stat_cfg, | ||
2034 | (RD_HARPOON(p_port + hp_pci_stat_cfg) & | ||
2035 | ~REC_MASTER_ABORT)); | ||
2190 | 2036 | ||
2191 | FPT_sxfrp(p_port,p_card); | 2037 | WR_HARPOON(p_port + hp_host_blk_cnt, 0x00); |
2192 | 2038 | ||
2193 | temp = (unsigned char)(RD_HARPOON(p_port+hp_ee_ctrl) & | 2039 | } |
2194 | (EXT_ARB_ACK | SCSI_TERM_ENA_H)); | ||
2195 | WR_HARPOON(p_port+hp_ee_ctrl, ((unsigned char)temp | SEE_MS | SEE_CS)); | ||
2196 | WR_HARPOON(p_port+hp_ee_ctrl, temp); | ||
2197 | 2040 | ||
2198 | if (!(RDW_HARPOON((p_port+hp_intstat)) & (BUS_FREE | RESET))) | 2041 | if (pCurrCard->currentSCCB != NULL) { |
2199 | { | ||
2200 | FPT_phaseDecode(p_port,p_card); | ||
2201 | } | ||
2202 | } | ||
2203 | } | ||
2204 | 2042 | ||
2043 | if (!pCurrCard->currentSCCB->HostStatus) | ||
2044 | pCurrCard->currentSCCB->HostStatus = | ||
2045 | SCCB_BM_ERR; | ||
2205 | 2046 | ||
2206 | else if (p_int & RESET) | 2047 | FPT_sxfrp(p_port, p_card); |
2207 | { | ||
2208 | 2048 | ||
2209 | WR_HARPOON(p_port+hp_clkctrl_0, CLKCTRL_DEFAULT); | 2049 | temp = (unsigned char)(RD_HARPOON(p_port + hp_ee_ctrl) & |
2210 | WR_HARPOON(p_port+hp_sys_ctrl, 0x00); | 2050 | (EXT_ARB_ACK | SCSI_TERM_ENA_H)); |
2211 | if (pCurrCard->currentSCCB != NULL) { | 2051 | WR_HARPOON(p_port + hp_ee_ctrl, |
2052 | ((unsigned char)temp | SEE_MS | SEE_CS)); | ||
2053 | WR_HARPOON(p_port + hp_ee_ctrl, temp); | ||
2212 | 2054 | ||
2213 | if (pCurrCard->globalFlags & F_HOST_XFER_ACT) | 2055 | if (! |
2056 | (RDW_HARPOON((p_port + hp_intstat)) & | ||
2057 | (BUS_FREE | RESET))) { | ||
2058 | FPT_phaseDecode(p_port, p_card); | ||
2059 | } | ||
2060 | } | ||
2061 | } | ||
2214 | 2062 | ||
2215 | FPT_hostDataXferAbort(p_port,p_card, pCurrCard->currentSCCB); | 2063 | else if (p_int & RESET) { |
2216 | } | ||
2217 | 2064 | ||
2065 | WR_HARPOON(p_port + hp_clkctrl_0, CLKCTRL_DEFAULT); | ||
2066 | WR_HARPOON(p_port + hp_sys_ctrl, 0x00); | ||
2067 | if (pCurrCard->currentSCCB != NULL) { | ||
2218 | 2068 | ||
2219 | DISABLE_AUTO(p_port); | 2069 | if (pCurrCard->globalFlags & F_HOST_XFER_ACT) |
2220 | 2070 | ||
2221 | FPT_sresb(p_port,p_card); | 2071 | FPT_hostDataXferAbort(p_port, p_card, |
2072 | pCurrCard->currentSCCB); | ||
2073 | } | ||
2222 | 2074 | ||
2223 | while(RD_HARPOON(p_port+hp_scsictrl_0) & SCSI_RST) {} | 2075 | DISABLE_AUTO(p_port); |
2224 | 2076 | ||
2225 | pCurrNvRam = pCurrCard->pNvRamInfo; | 2077 | FPT_sresb(p_port, p_card); |
2226 | if(pCurrNvRam){ | ||
2227 | ScamFlg = pCurrNvRam->niScamConf; | ||
2228 | } | ||
2229 | else{ | ||
2230 | ScamFlg = (unsigned char) FPT_utilEERead(p_port, SCAM_CONFIG/2); | ||
2231 | } | ||
2232 | 2078 | ||
2233 | FPT_XbowInit(p_port, ScamFlg); | 2079 | while (RD_HARPOON(p_port + hp_scsictrl_0) & SCSI_RST) { |
2080 | } | ||
2234 | 2081 | ||
2235 | FPT_scini(p_card, pCurrCard->ourId, 0); | 2082 | pCurrNvRam = pCurrCard->pNvRamInfo; |
2083 | if (pCurrNvRam) { | ||
2084 | ScamFlg = pCurrNvRam->niScamConf; | ||
2085 | } else { | ||
2086 | ScamFlg = | ||
2087 | (unsigned char)FPT_utilEERead(p_port, | ||
2088 | SCAM_CONFIG / 2); | ||
2089 | } | ||
2236 | 2090 | ||
2237 | return(0xFF); | 2091 | FPT_XbowInit(p_port, ScamFlg); |
2238 | } | ||
2239 | 2092 | ||
2093 | FPT_scini(p_card, pCurrCard->ourId, 0); | ||
2240 | 2094 | ||
2241 | else if (p_int & FIFO) { | 2095 | return (0xFF); |
2096 | } | ||
2242 | 2097 | ||
2243 | WRW_HARPOON((p_port+hp_intstat), FIFO); | 2098 | else if (p_int & FIFO) { |
2244 | 2099 | ||
2245 | if (pCurrCard->currentSCCB != NULL) | 2100 | WRW_HARPOON((p_port + hp_intstat), FIFO); |
2246 | FPT_sxfrp(p_port,p_card); | ||
2247 | } | ||
2248 | 2101 | ||
2249 | else if (p_int & TIMEOUT) | 2102 | if (pCurrCard->currentSCCB != NULL) |
2250 | { | 2103 | FPT_sxfrp(p_port, p_card); |
2104 | } | ||
2251 | 2105 | ||
2252 | DISABLE_AUTO(p_port); | 2106 | else if (p_int & TIMEOUT) { |
2253 | 2107 | ||
2254 | WRW_HARPOON((p_port+hp_intstat), | 2108 | DISABLE_AUTO(p_port); |
2255 | (PROG_HLT | TIMEOUT | SEL |BUS_FREE | PHASE | IUNKWN)); | ||
2256 | 2109 | ||
2257 | pCurrCard->currentSCCB->HostStatus = SCCB_SELECTION_TIMEOUT; | 2110 | WRW_HARPOON((p_port + hp_intstat), |
2111 | (PROG_HLT | TIMEOUT | SEL | BUS_FREE | PHASE | | ||
2112 | IUNKWN)); | ||
2258 | 2113 | ||
2114 | pCurrCard->currentSCCB->HostStatus = SCCB_SELECTION_TIMEOUT; | ||
2259 | 2115 | ||
2260 | currTar_Info = &FPT_sccbMgrTbl[p_card][pCurrCard->currentSCCB->TargID]; | 2116 | currTar_Info = |
2261 | if((pCurrCard->globalFlags & F_CONLUN_IO) && | 2117 | &FPT_sccbMgrTbl[p_card][pCurrCard->currentSCCB->TargID]; |
2262 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) | 2118 | if ((pCurrCard->globalFlags & F_CONLUN_IO) |
2263 | currTar_Info->TarLUNBusy[pCurrCard->currentSCCB->Lun] = 0; | 2119 | && ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != |
2120 | TAG_Q_TRYING)) | ||
2121 | currTar_Info->TarLUNBusy[pCurrCard->currentSCCB->Lun] = | ||
2122 | 0; | ||
2264 | else | 2123 | else |
2265 | currTar_Info->TarLUNBusy[0] = 0; | 2124 | currTar_Info->TarLUNBusy[0] = 0; |
2266 | |||
2267 | 2125 | ||
2268 | if (currTar_Info->TarEEValue & EE_SYNC_MASK) | 2126 | if (currTar_Info->TarEEValue & EE_SYNC_MASK) { |
2269 | { | 2127 | currTar_Info->TarSyncCtrl = 0; |
2270 | currTar_Info->TarSyncCtrl = 0; | 2128 | currTar_Info->TarStatus &= ~TAR_SYNC_MASK; |
2271 | currTar_Info->TarStatus &= ~TAR_SYNC_MASK; | 2129 | } |
2272 | } | ||
2273 | 2130 | ||
2274 | if (currTar_Info->TarEEValue & EE_WIDE_SCSI) | 2131 | if (currTar_Info->TarEEValue & EE_WIDE_SCSI) { |
2275 | { | 2132 | currTar_Info->TarStatus &= ~TAR_WIDE_MASK; |
2276 | currTar_Info->TarStatus &= ~TAR_WIDE_MASK; | 2133 | } |
2277 | } | ||
2278 | 2134 | ||
2279 | FPT_sssyncv(p_port, pCurrCard->currentSCCB->TargID, NARROW_SCSI,currTar_Info); | 2135 | FPT_sssyncv(p_port, pCurrCard->currentSCCB->TargID, NARROW_SCSI, |
2136 | currTar_Info); | ||
2280 | 2137 | ||
2281 | FPT_queueCmdComplete(pCurrCard, pCurrCard->currentSCCB, p_card); | 2138 | FPT_queueCmdComplete(pCurrCard, pCurrCard->currentSCCB, p_card); |
2282 | 2139 | ||
2283 | } | 2140 | } |
2284 | 2141 | ||
2285 | else if (p_int & SCAM_SEL) | 2142 | else if (p_int & SCAM_SEL) { |
2286 | { | ||
2287 | 2143 | ||
2288 | FPT_scarb(p_port,LEVEL2_TAR); | 2144 | FPT_scarb(p_port, LEVEL2_TAR); |
2289 | FPT_scsel(p_port); | 2145 | FPT_scsel(p_port); |
2290 | FPT_scasid(p_card, p_port); | 2146 | FPT_scasid(p_card, p_port); |
2291 | 2147 | ||
2292 | FPT_scbusf(p_port); | 2148 | FPT_scbusf(p_port); |
2293 | 2149 | ||
2294 | WRW_HARPOON((p_port+hp_intstat), SCAM_SEL); | 2150 | WRW_HARPOON((p_port + hp_intstat), SCAM_SEL); |
2295 | } | 2151 | } |
2296 | 2152 | ||
2297 | return(0x00); | 2153 | return (0x00); |
2298 | } | 2154 | } |
2299 | 2155 | ||
2300 | |||
2301 | /*--------------------------------------------------------------------- | 2156 | /*--------------------------------------------------------------------- |
2302 | * | 2157 | * |
2303 | * Function: SccbMgrTableInit | 2158 | * Function: SccbMgrTableInit |
@@ -2308,21 +2163,19 @@ static unsigned char FPT_SccbMgr_bad_isr(unsigned long p_port, unsigned char p_c | |||
2308 | 2163 | ||
2309 | static void FPT_SccbMgrTableInitAll() | 2164 | static void FPT_SccbMgrTableInitAll() |
2310 | { | 2165 | { |
2311 | unsigned char thisCard; | 2166 | unsigned char thisCard; |
2312 | 2167 | ||
2313 | for (thisCard = 0; thisCard < MAX_CARDS; thisCard++) | 2168 | for (thisCard = 0; thisCard < MAX_CARDS; thisCard++) { |
2314 | { | 2169 | FPT_SccbMgrTableInitCard(&FPT_BL_Card[thisCard], thisCard); |
2315 | FPT_SccbMgrTableInitCard(&FPT_BL_Card[thisCard],thisCard); | ||
2316 | 2170 | ||
2317 | FPT_BL_Card[thisCard].ioPort = 0x00; | 2171 | FPT_BL_Card[thisCard].ioPort = 0x00; |
2318 | FPT_BL_Card[thisCard].cardInfo = NULL; | 2172 | FPT_BL_Card[thisCard].cardInfo = NULL; |
2319 | FPT_BL_Card[thisCard].cardIndex = 0xFF; | 2173 | FPT_BL_Card[thisCard].cardIndex = 0xFF; |
2320 | FPT_BL_Card[thisCard].ourId = 0x00; | 2174 | FPT_BL_Card[thisCard].ourId = 0x00; |
2321 | FPT_BL_Card[thisCard].pNvRamInfo = NULL; | 2175 | FPT_BL_Card[thisCard].pNvRamInfo = NULL; |
2322 | } | 2176 | } |
2323 | } | 2177 | } |
2324 | 2178 | ||
2325 | |||
2326 | /*--------------------------------------------------------------------- | 2179 | /*--------------------------------------------------------------------- |
2327 | * | 2180 | * |
2328 | * Function: SccbMgrTableInit | 2181 | * Function: SccbMgrTableInit |
@@ -2331,33 +2184,30 @@ static void FPT_SccbMgrTableInitAll() | |||
2331 | * | 2184 | * |
2332 | *---------------------------------------------------------------------*/ | 2185 | *---------------------------------------------------------------------*/ |
2333 | 2186 | ||
2334 | static void FPT_SccbMgrTableInitCard(struct sccb_card * pCurrCard, unsigned char p_card) | 2187 | static void FPT_SccbMgrTableInitCard(struct sccb_card *pCurrCard, |
2188 | unsigned char p_card) | ||
2335 | { | 2189 | { |
2336 | unsigned char scsiID, qtag; | 2190 | unsigned char scsiID, qtag; |
2337 | 2191 | ||
2338 | for (qtag = 0; qtag < QUEUE_DEPTH; qtag++) | 2192 | for (qtag = 0; qtag < QUEUE_DEPTH; qtag++) { |
2339 | { | ||
2340 | FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL; | 2193 | FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL; |
2341 | } | 2194 | } |
2342 | 2195 | ||
2343 | for (scsiID = 0; scsiID < MAX_SCSI_TAR; scsiID++) | 2196 | for (scsiID = 0; scsiID < MAX_SCSI_TAR; scsiID++) { |
2344 | { | 2197 | FPT_sccbMgrTbl[p_card][scsiID].TarStatus = 0; |
2345 | FPT_sccbMgrTbl[p_card][scsiID].TarStatus = 0; | 2198 | FPT_sccbMgrTbl[p_card][scsiID].TarEEValue = 0; |
2346 | FPT_sccbMgrTbl[p_card][scsiID].TarEEValue = 0; | 2199 | FPT_SccbMgrTableInitTarget(p_card, scsiID); |
2347 | FPT_SccbMgrTableInitTarget(p_card, scsiID); | 2200 | } |
2348 | } | ||
2349 | 2201 | ||
2350 | pCurrCard->scanIndex = 0x00; | 2202 | pCurrCard->scanIndex = 0x00; |
2351 | pCurrCard->currentSCCB = NULL; | 2203 | pCurrCard->currentSCCB = NULL; |
2352 | pCurrCard->globalFlags = 0x00; | 2204 | pCurrCard->globalFlags = 0x00; |
2353 | pCurrCard->cmdCounter = 0x00; | 2205 | pCurrCard->cmdCounter = 0x00; |
2354 | pCurrCard->tagQ_Lst = 0x01; | 2206 | pCurrCard->tagQ_Lst = 0x01; |
2355 | pCurrCard->discQCount = 0; | 2207 | pCurrCard->discQCount = 0; |
2356 | |||
2357 | 2208 | ||
2358 | } | 2209 | } |
2359 | 2210 | ||
2360 | |||
2361 | /*--------------------------------------------------------------------- | 2211 | /*--------------------------------------------------------------------- |
2362 | * | 2212 | * |
2363 | * Function: SccbMgrTableInit | 2213 | * Function: SccbMgrTableInit |
@@ -2366,11 +2216,12 @@ static void FPT_SccbMgrTableInitCard(struct sccb_card * pCurrCard, unsigned char | |||
2366 | * | 2216 | * |
2367 | *---------------------------------------------------------------------*/ | 2217 | *---------------------------------------------------------------------*/ |
2368 | 2218 | ||
2369 | static void FPT_SccbMgrTableInitTarget(unsigned char p_card, unsigned char target) | 2219 | static void FPT_SccbMgrTableInitTarget(unsigned char p_card, |
2220 | unsigned char target) | ||
2370 | { | 2221 | { |
2371 | 2222 | ||
2372 | unsigned char lun, qtag; | 2223 | unsigned char lun, qtag; |
2373 | struct sccb_mgr_tar_info * currTar_Info; | 2224 | struct sccb_mgr_tar_info *currTar_Info; |
2374 | 2225 | ||
2375 | currTar_Info = &FPT_sccbMgrTbl[p_card][target]; | 2226 | currTar_Info = &FPT_sccbMgrTbl[p_card][target]; |
2376 | 2227 | ||
@@ -2382,19 +2233,15 @@ static void FPT_SccbMgrTableInitTarget(unsigned char p_card, unsigned char targe | |||
2382 | currTar_Info->TarTagQ_Cnt = 0; | 2233 | currTar_Info->TarTagQ_Cnt = 0; |
2383 | currTar_Info->TarLUN_CA = 0; | 2234 | currTar_Info->TarLUN_CA = 0; |
2384 | 2235 | ||
2385 | 2236 | for (lun = 0; lun < MAX_LUN; lun++) { | |
2386 | for (lun = 0; lun < MAX_LUN; lun++) | ||
2387 | { | ||
2388 | currTar_Info->TarLUNBusy[lun] = 0; | 2237 | currTar_Info->TarLUNBusy[lun] = 0; |
2389 | currTar_Info->LunDiscQ_Idx[lun] = 0; | 2238 | currTar_Info->LunDiscQ_Idx[lun] = 0; |
2390 | } | 2239 | } |
2391 | 2240 | ||
2392 | for (qtag = 0; qtag < QUEUE_DEPTH; qtag++) | 2241 | for (qtag = 0; qtag < QUEUE_DEPTH; qtag++) { |
2393 | { | 2242 | if (FPT_BL_Card[p_card].discQ_Tbl[qtag] != NULL) { |
2394 | if(FPT_BL_Card[p_card].discQ_Tbl[qtag] != NULL) | 2243 | if (FPT_BL_Card[p_card].discQ_Tbl[qtag]->TargID == |
2395 | { | 2244 | target) { |
2396 | if(FPT_BL_Card[p_card].discQ_Tbl[qtag]->TargID == target) | ||
2397 | { | ||
2398 | FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL; | 2245 | FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL; |
2399 | FPT_BL_Card[p_card].discQCount--; | 2246 | FPT_BL_Card[p_card].discQCount--; |
2400 | } | 2247 | } |
@@ -2402,7 +2249,6 @@ static void FPT_SccbMgrTableInitTarget(unsigned char p_card, unsigned char targe | |||
2402 | } | 2249 | } |
2403 | } | 2250 | } |
2404 | 2251 | ||
2405 | |||
2406 | /*--------------------------------------------------------------------- | 2252 | /*--------------------------------------------------------------------- |
2407 | * | 2253 | * |
2408 | * Function: sfetm | 2254 | * Function: sfetm |
@@ -2412,71 +2258,66 @@ static void FPT_SccbMgrTableInitTarget(unsigned char p_card, unsigned char targe | |||
2412 | * | 2258 | * |
2413 | *---------------------------------------------------------------------*/ | 2259 | *---------------------------------------------------------------------*/ |
2414 | 2260 | ||
2415 | static unsigned char FPT_sfm(unsigned long port, struct sccb * pCurrSCCB) | 2261 | static unsigned char FPT_sfm(unsigned long port, struct sccb *pCurrSCCB) |
2416 | { | 2262 | { |
2417 | unsigned char message; | 2263 | unsigned char message; |
2418 | unsigned short TimeOutLoop; | 2264 | unsigned short TimeOutLoop; |
2419 | 2265 | ||
2420 | TimeOutLoop = 0; | 2266 | TimeOutLoop = 0; |
2421 | while( (!(RD_HARPOON(port+hp_scsisig) & SCSI_REQ)) && | 2267 | while ((!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) && |
2422 | (TimeOutLoop++ < 20000) ){} | 2268 | (TimeOutLoop++ < 20000)) { |
2423 | 2269 | } | |
2424 | |||
2425 | WR_HARPOON(port+hp_portctrl_0, SCSI_PORT); | ||
2426 | 2270 | ||
2427 | message = RD_HARPOON(port+hp_scsidata_0); | 2271 | WR_HARPOON(port + hp_portctrl_0, SCSI_PORT); |
2428 | 2272 | ||
2429 | WR_HARPOON(port+hp_scsisig, SCSI_ACK + S_MSGI_PH); | 2273 | message = RD_HARPOON(port + hp_scsidata_0); |
2430 | 2274 | ||
2275 | WR_HARPOON(port + hp_scsisig, SCSI_ACK + S_MSGI_PH); | ||
2431 | 2276 | ||
2432 | if (TimeOutLoop > 20000) | 2277 | if (TimeOutLoop > 20000) |
2433 | message = 0x00; /* force message byte = 0 if Time Out on Req */ | 2278 | message = 0x00; /* force message byte = 0 if Time Out on Req */ |
2434 | 2279 | ||
2435 | if ((RDW_HARPOON((port+hp_intstat)) & PARITY) && | 2280 | if ((RDW_HARPOON((port + hp_intstat)) & PARITY) && |
2436 | (RD_HARPOON(port+hp_addstat) & SCSI_PAR_ERR)) | 2281 | (RD_HARPOON(port + hp_addstat) & SCSI_PAR_ERR)) { |
2437 | { | 2282 | WR_HARPOON(port + hp_scsisig, (SCSI_ACK + S_ILL_PH)); |
2438 | WR_HARPOON(port+hp_scsisig, (SCSI_ACK + S_ILL_PH)); | 2283 | WR_HARPOON(port + hp_xferstat, 0); |
2439 | WR_HARPOON(port+hp_xferstat, 0); | 2284 | WR_HARPOON(port + hp_fiforead, 0); |
2440 | WR_HARPOON(port+hp_fiforead, 0); | 2285 | WR_HARPOON(port + hp_fifowrite, 0); |
2441 | WR_HARPOON(port+hp_fifowrite, 0); | 2286 | if (pCurrSCCB != NULL) { |
2442 | if (pCurrSCCB != NULL) | ||
2443 | { | ||
2444 | pCurrSCCB->Sccb_scsimsg = SMPARITY; | 2287 | pCurrSCCB->Sccb_scsimsg = SMPARITY; |
2445 | } | 2288 | } |
2446 | message = 0x00; | 2289 | message = 0x00; |
2447 | do | 2290 | do { |
2448 | { | ||
2449 | ACCEPT_MSG_ATN(port); | 2291 | ACCEPT_MSG_ATN(port); |
2450 | TimeOutLoop = 0; | 2292 | TimeOutLoop = 0; |
2451 | while( (!(RD_HARPOON(port+hp_scsisig) & SCSI_REQ)) && | 2293 | while ((!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) && |
2452 | (TimeOutLoop++ < 20000) ){} | 2294 | (TimeOutLoop++ < 20000)) { |
2453 | if (TimeOutLoop > 20000) | ||
2454 | { | ||
2455 | WRW_HARPOON((port+hp_intstat), PARITY); | ||
2456 | return(message); | ||
2457 | } | 2295 | } |
2458 | if ((RD_HARPOON(port+hp_scsisig) & S_SCSI_PHZ) != S_MSGI_PH) | 2296 | if (TimeOutLoop > 20000) { |
2459 | { | 2297 | WRW_HARPOON((port + hp_intstat), PARITY); |
2460 | WRW_HARPOON((port+hp_intstat), PARITY); | 2298 | return (message); |
2461 | return(message); | 2299 | } |
2300 | if ((RD_HARPOON(port + hp_scsisig) & S_SCSI_PHZ) != | ||
2301 | S_MSGI_PH) { | ||
2302 | WRW_HARPOON((port + hp_intstat), PARITY); | ||
2303 | return (message); | ||
2462 | } | 2304 | } |
2463 | WR_HARPOON(port+hp_portctrl_0, SCSI_PORT); | 2305 | WR_HARPOON(port + hp_portctrl_0, SCSI_PORT); |
2464 | 2306 | ||
2465 | RD_HARPOON(port+hp_scsidata_0); | 2307 | RD_HARPOON(port + hp_scsidata_0); |
2466 | 2308 | ||
2467 | WR_HARPOON(port+hp_scsisig, (SCSI_ACK + S_ILL_PH)); | 2309 | WR_HARPOON(port + hp_scsisig, (SCSI_ACK + S_ILL_PH)); |
2468 | 2310 | ||
2469 | }while(1); | 2311 | } while (1); |
2470 | 2312 | ||
2471 | } | 2313 | } |
2472 | WR_HARPOON(port+hp_scsisig, (SCSI_ACK + S_ILL_PH)); | 2314 | WR_HARPOON(port + hp_scsisig, (SCSI_ACK + S_ILL_PH)); |
2473 | WR_HARPOON(port+hp_xferstat, 0); | 2315 | WR_HARPOON(port + hp_xferstat, 0); |
2474 | WR_HARPOON(port+hp_fiforead, 0); | 2316 | WR_HARPOON(port + hp_fiforead, 0); |
2475 | WR_HARPOON(port+hp_fifowrite, 0); | 2317 | WR_HARPOON(port + hp_fifowrite, 0); |
2476 | return(message); | 2318 | return (message); |
2477 | } | 2319 | } |
2478 | 2320 | ||
2479 | |||
2480 | /*--------------------------------------------------------------------- | 2321 | /*--------------------------------------------------------------------- |
2481 | * | 2322 | * |
2482 | * Function: FPT_ssel | 2323 | * Function: FPT_ssel |
@@ -2488,99 +2329,87 @@ static unsigned char FPT_sfm(unsigned long port, struct sccb * pCurrSCCB) | |||
2488 | static void FPT_ssel(unsigned long port, unsigned char p_card) | 2329 | static void FPT_ssel(unsigned long port, unsigned char p_card) |
2489 | { | 2330 | { |
2490 | 2331 | ||
2491 | unsigned char auto_loaded, i, target, *theCCB; | 2332 | unsigned char auto_loaded, i, target, *theCCB; |
2492 | |||
2493 | unsigned long cdb_reg; | ||
2494 | struct sccb_card * CurrCard; | ||
2495 | struct sccb * currSCCB; | ||
2496 | struct sccb_mgr_tar_info * currTar_Info; | ||
2497 | unsigned char lastTag, lun; | ||
2498 | 2333 | ||
2499 | CurrCard = &FPT_BL_Card[p_card]; | 2334 | unsigned long cdb_reg; |
2500 | currSCCB = CurrCard->currentSCCB; | 2335 | struct sccb_card *CurrCard; |
2501 | target = currSCCB->TargID; | 2336 | struct sccb *currSCCB; |
2502 | currTar_Info = &FPT_sccbMgrTbl[p_card][target]; | 2337 | struct sccb_mgr_tar_info *currTar_Info; |
2503 | lastTag = CurrCard->tagQ_Lst; | 2338 | unsigned char lastTag, lun; |
2504 | 2339 | ||
2505 | ARAM_ACCESS(port); | 2340 | CurrCard = &FPT_BL_Card[p_card]; |
2341 | currSCCB = CurrCard->currentSCCB; | ||
2342 | target = currSCCB->TargID; | ||
2343 | currTar_Info = &FPT_sccbMgrTbl[p_card][target]; | ||
2344 | lastTag = CurrCard->tagQ_Lst; | ||
2506 | 2345 | ||
2346 | ARAM_ACCESS(port); | ||
2507 | 2347 | ||
2508 | if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) == TAG_Q_REJECT) | 2348 | if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) == TAG_Q_REJECT) |
2509 | currSCCB->ControlByte &= ~F_USE_CMD_Q; | 2349 | currSCCB->ControlByte &= ~F_USE_CMD_Q; |
2510 | 2350 | ||
2511 | if(((CurrCard->globalFlags & F_CONLUN_IO) && | 2351 | if (((CurrCard->globalFlags & F_CONLUN_IO) && |
2512 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) | 2352 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) |
2513 | 2353 | ||
2514 | lun = currSCCB->Lun; | 2354 | lun = currSCCB->Lun; |
2515 | else | 2355 | else |
2516 | lun = 0; | 2356 | lun = 0; |
2517 | 2357 | ||
2358 | if (CurrCard->globalFlags & F_TAG_STARTED) { | ||
2359 | if (!(currSCCB->ControlByte & F_USE_CMD_Q)) { | ||
2360 | if ((currTar_Info->TarLUN_CA == 0) | ||
2361 | && ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) | ||
2362 | == TAG_Q_TRYING)) { | ||
2363 | |||
2364 | if (currTar_Info->TarTagQ_Cnt != 0) { | ||
2365 | currTar_Info->TarLUNBusy[lun] = 1; | ||
2366 | FPT_queueSelectFail(CurrCard, p_card); | ||
2367 | SGRAM_ACCESS(port); | ||
2368 | return; | ||
2369 | } | ||
2518 | 2370 | ||
2519 | if (CurrCard->globalFlags & F_TAG_STARTED) | 2371 | else { |
2520 | { | 2372 | currTar_Info->TarLUNBusy[lun] = 1; |
2521 | if (!(currSCCB->ControlByte & F_USE_CMD_Q)) | 2373 | } |
2522 | { | ||
2523 | if ((currTar_Info->TarLUN_CA == 0) | ||
2524 | && ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) | ||
2525 | == TAG_Q_TRYING)) | ||
2526 | { | ||
2527 | |||
2528 | if (currTar_Info->TarTagQ_Cnt !=0) | ||
2529 | { | ||
2530 | currTar_Info->TarLUNBusy[lun] = 1; | ||
2531 | FPT_queueSelectFail(CurrCard,p_card); | ||
2532 | SGRAM_ACCESS(port); | ||
2533 | return; | ||
2534 | } | ||
2535 | |||
2536 | else { | ||
2537 | currTar_Info->TarLUNBusy[lun] = 1; | ||
2538 | } | ||
2539 | |||
2540 | } /*End non-tagged */ | ||
2541 | |||
2542 | else { | ||
2543 | currTar_Info->TarLUNBusy[lun] = 1; | ||
2544 | } | ||
2545 | |||
2546 | } /*!Use cmd Q Tagged */ | ||
2547 | |||
2548 | else { | ||
2549 | if (currTar_Info->TarLUN_CA == 1) | ||
2550 | { | ||
2551 | FPT_queueSelectFail(CurrCard,p_card); | ||
2552 | SGRAM_ACCESS(port); | ||
2553 | return; | ||
2554 | } | ||
2555 | |||
2556 | currTar_Info->TarLUNBusy[lun] = 1; | ||
2557 | 2374 | ||
2558 | } /*else use cmd Q tagged */ | 2375 | } |
2376 | /*End non-tagged */ | ||
2377 | else { | ||
2378 | currTar_Info->TarLUNBusy[lun] = 1; | ||
2379 | } | ||
2559 | 2380 | ||
2560 | } /*if glob tagged started */ | 2381 | } |
2382 | /*!Use cmd Q Tagged */ | ||
2383 | else { | ||
2384 | if (currTar_Info->TarLUN_CA == 1) { | ||
2385 | FPT_queueSelectFail(CurrCard, p_card); | ||
2386 | SGRAM_ACCESS(port); | ||
2387 | return; | ||
2388 | } | ||
2561 | 2389 | ||
2562 | else { | 2390 | currTar_Info->TarLUNBusy[lun] = 1; |
2563 | currTar_Info->TarLUNBusy[lun] = 1; | ||
2564 | } | ||
2565 | 2391 | ||
2392 | } /*else use cmd Q tagged */ | ||
2566 | 2393 | ||
2394 | } | ||
2395 | /*if glob tagged started */ | ||
2396 | else { | ||
2397 | currTar_Info->TarLUNBusy[lun] = 1; | ||
2398 | } | ||
2567 | 2399 | ||
2568 | if((((CurrCard->globalFlags & F_CONLUN_IO) && | 2400 | if ((((CurrCard->globalFlags & F_CONLUN_IO) && |
2569 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) | 2401 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) |
2570 | || (!(currSCCB->ControlByte & F_USE_CMD_Q)))) | 2402 | || (!(currSCCB->ControlByte & F_USE_CMD_Q)))) { |
2571 | { | 2403 | if (CurrCard->discQCount >= QUEUE_DEPTH) { |
2572 | if(CurrCard->discQCount >= QUEUE_DEPTH) | ||
2573 | { | ||
2574 | currTar_Info->TarLUNBusy[lun] = 1; | 2404 | currTar_Info->TarLUNBusy[lun] = 1; |
2575 | FPT_queueSelectFail(CurrCard,p_card); | 2405 | FPT_queueSelectFail(CurrCard, p_card); |
2576 | SGRAM_ACCESS(port); | 2406 | SGRAM_ACCESS(port); |
2577 | return; | 2407 | return; |
2578 | } | 2408 | } |
2579 | for (i = 1; i < QUEUE_DEPTH; i++) | 2409 | for (i = 1; i < QUEUE_DEPTH; i++) { |
2580 | { | 2410 | if (++lastTag >= QUEUE_DEPTH) |
2581 | if (++lastTag >= QUEUE_DEPTH) lastTag = 1; | 2411 | lastTag = 1; |
2582 | if (CurrCard->discQ_Tbl[lastTag] == NULL) | 2412 | if (CurrCard->discQ_Tbl[lastTag] == NULL) { |
2583 | { | ||
2584 | CurrCard->tagQ_Lst = lastTag; | 2413 | CurrCard->tagQ_Lst = lastTag; |
2585 | currTar_Info->LunDiscQ_Idx[lun] = lastTag; | 2414 | currTar_Info->LunDiscQ_Idx[lun] = lastTag; |
2586 | CurrCard->discQ_Tbl[lastTag] = currSCCB; | 2415 | CurrCard->discQ_Tbl[lastTag] = currSCCB; |
@@ -2588,206 +2417,206 @@ static void FPT_ssel(unsigned long port, unsigned char p_card) | |||
2588 | break; | 2417 | break; |
2589 | } | 2418 | } |
2590 | } | 2419 | } |
2591 | if(i == QUEUE_DEPTH) | 2420 | if (i == QUEUE_DEPTH) { |
2592 | { | ||
2593 | currTar_Info->TarLUNBusy[lun] = 1; | 2421 | currTar_Info->TarLUNBusy[lun] = 1; |
2594 | FPT_queueSelectFail(CurrCard,p_card); | 2422 | FPT_queueSelectFail(CurrCard, p_card); |
2595 | SGRAM_ACCESS(port); | 2423 | SGRAM_ACCESS(port); |
2596 | return; | 2424 | return; |
2597 | } | 2425 | } |
2598 | } | 2426 | } |
2599 | 2427 | ||
2428 | auto_loaded = 0; | ||
2600 | 2429 | ||
2430 | WR_HARPOON(port + hp_select_id, target); | ||
2431 | WR_HARPOON(port + hp_gp_reg_3, target); /* Use by new automation logic */ | ||
2601 | 2432 | ||
2602 | auto_loaded = 0; | 2433 | if (currSCCB->OperationCode == RESET_COMMAND) { |
2603 | 2434 | WRW_HARPOON((port + ID_MSG_STRT), (MPM_OP + AMSG_OUT + | |
2604 | WR_HARPOON(port+hp_select_id, target); | 2435 | (currSCCB-> |
2605 | WR_HARPOON(port+hp_gp_reg_3, target); /* Use by new automation logic */ | 2436 | Sccb_idmsg & ~DISC_PRIV))); |
2606 | |||
2607 | if (currSCCB->OperationCode == RESET_COMMAND) { | ||
2608 | WRW_HARPOON((port+ID_MSG_STRT), (MPM_OP+AMSG_OUT+ | ||
2609 | (currSCCB->Sccb_idmsg & ~DISC_PRIV))); | ||
2610 | |||
2611 | WRW_HARPOON((port+ID_MSG_STRT+2),BRH_OP+ALWAYS+NP); | ||
2612 | 2437 | ||
2613 | currSCCB->Sccb_scsimsg = SMDEV_RESET; | 2438 | WRW_HARPOON((port + ID_MSG_STRT + 2), BRH_OP + ALWAYS + NP); |
2614 | 2439 | ||
2615 | WR_HARPOON(port+hp_autostart_3, (SELECT+SELCHK_STRT)); | 2440 | currSCCB->Sccb_scsimsg = SMDEV_RESET; |
2616 | auto_loaded = 1; | ||
2617 | currSCCB->Sccb_scsistat = SELECT_BDR_ST; | ||
2618 | 2441 | ||
2619 | if (currTar_Info->TarEEValue & EE_SYNC_MASK) | 2442 | WR_HARPOON(port + hp_autostart_3, (SELECT + SELCHK_STRT)); |
2620 | { | 2443 | auto_loaded = 1; |
2621 | currTar_Info->TarSyncCtrl = 0; | 2444 | currSCCB->Sccb_scsistat = SELECT_BDR_ST; |
2622 | currTar_Info->TarStatus &= ~TAR_SYNC_MASK; | ||
2623 | } | ||
2624 | 2445 | ||
2625 | if (currTar_Info->TarEEValue & EE_WIDE_SCSI) | 2446 | if (currTar_Info->TarEEValue & EE_SYNC_MASK) { |
2626 | { | 2447 | currTar_Info->TarSyncCtrl = 0; |
2627 | currTar_Info->TarStatus &= ~TAR_WIDE_MASK; | 2448 | currTar_Info->TarStatus &= ~TAR_SYNC_MASK; |
2628 | } | 2449 | } |
2629 | |||
2630 | FPT_sssyncv(port, target, NARROW_SCSI,currTar_Info); | ||
2631 | FPT_SccbMgrTableInitTarget(p_card, target); | ||
2632 | 2450 | ||
2633 | } | 2451 | if (currTar_Info->TarEEValue & EE_WIDE_SCSI) { |
2452 | currTar_Info->TarStatus &= ~TAR_WIDE_MASK; | ||
2453 | } | ||
2634 | 2454 | ||
2635 | else if(currSCCB->Sccb_scsistat == ABORT_ST) | 2455 | FPT_sssyncv(port, target, NARROW_SCSI, currTar_Info); |
2636 | { | 2456 | FPT_SccbMgrTableInitTarget(p_card, target); |
2637 | WRW_HARPOON((port+ID_MSG_STRT), (MPM_OP+AMSG_OUT+ | ||
2638 | (currSCCB->Sccb_idmsg & ~DISC_PRIV))); | ||
2639 | 2457 | ||
2640 | WRW_HARPOON((port+ID_MSG_STRT+2),BRH_OP+ALWAYS+CMDPZ); | 2458 | } |
2641 | 2459 | ||
2642 | WRW_HARPOON((port+SYNC_MSGS+0), (MPM_OP+AMSG_OUT+ | 2460 | else if (currSCCB->Sccb_scsistat == ABORT_ST) { |
2643 | (((unsigned char)(currSCCB->ControlByte & TAG_TYPE_MASK) | 2461 | WRW_HARPOON((port + ID_MSG_STRT), (MPM_OP + AMSG_OUT + |
2644 | >> 6) | (unsigned char)0x20))); | 2462 | (currSCCB-> |
2645 | WRW_HARPOON((port+SYNC_MSGS+2), | 2463 | Sccb_idmsg & ~DISC_PRIV))); |
2646 | (MPM_OP+AMSG_OUT+currSCCB->Sccb_tag)); | ||
2647 | WRW_HARPOON((port+SYNC_MSGS+4), (BRH_OP+ALWAYS+NP )); | ||
2648 | 2464 | ||
2649 | WR_HARPOON(port+hp_autostart_3, (SELECT+SELCHK_STRT)); | 2465 | WRW_HARPOON((port + ID_MSG_STRT + 2), BRH_OP + ALWAYS + CMDPZ); |
2650 | auto_loaded = 1; | ||
2651 | |||
2652 | } | ||
2653 | 2466 | ||
2654 | else if (!(currTar_Info->TarStatus & WIDE_NEGOCIATED)) { | 2467 | WRW_HARPOON((port + SYNC_MSGS + 0), (MPM_OP + AMSG_OUT + |
2655 | auto_loaded = FPT_siwidn(port,p_card); | 2468 | (((unsigned |
2656 | currSCCB->Sccb_scsistat = SELECT_WN_ST; | 2469 | char)(currSCCB-> |
2657 | } | 2470 | ControlByte & |
2471 | TAG_TYPE_MASK) | ||
2472 | >> 6) | (unsigned char) | ||
2473 | 0x20))); | ||
2474 | WRW_HARPOON((port + SYNC_MSGS + 2), | ||
2475 | (MPM_OP + AMSG_OUT + currSCCB->Sccb_tag)); | ||
2476 | WRW_HARPOON((port + SYNC_MSGS + 4), (BRH_OP + ALWAYS + NP)); | ||
2658 | 2477 | ||
2659 | else if (!((currTar_Info->TarStatus & TAR_SYNC_MASK) | 2478 | WR_HARPOON(port + hp_autostart_3, (SELECT + SELCHK_STRT)); |
2660 | == SYNC_SUPPORTED)) { | 2479 | auto_loaded = 1; |
2661 | auto_loaded = FPT_sisyncn(port,p_card, 0); | ||
2662 | currSCCB->Sccb_scsistat = SELECT_SN_ST; | ||
2663 | } | ||
2664 | 2480 | ||
2481 | } | ||
2665 | 2482 | ||
2666 | if (!auto_loaded) | 2483 | else if (!(currTar_Info->TarStatus & WIDE_NEGOCIATED)) { |
2667 | { | 2484 | auto_loaded = FPT_siwidn(port, p_card); |
2485 | currSCCB->Sccb_scsistat = SELECT_WN_ST; | ||
2486 | } | ||
2668 | 2487 | ||
2669 | if (currSCCB->ControlByte & F_USE_CMD_Q) | 2488 | else if (!((currTar_Info->TarStatus & TAR_SYNC_MASK) |
2670 | { | 2489 | == SYNC_SUPPORTED)) { |
2490 | auto_loaded = FPT_sisyncn(port, p_card, 0); | ||
2491 | currSCCB->Sccb_scsistat = SELECT_SN_ST; | ||
2492 | } | ||
2671 | 2493 | ||
2672 | CurrCard->globalFlags |= F_TAG_STARTED; | 2494 | if (!auto_loaded) { |
2673 | 2495 | ||
2674 | if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) | 2496 | if (currSCCB->ControlByte & F_USE_CMD_Q) { |
2675 | == TAG_Q_REJECT) | ||
2676 | { | ||
2677 | currSCCB->ControlByte &= ~F_USE_CMD_Q; | ||
2678 | 2497 | ||
2679 | /* Fix up the start instruction with a jump to | 2498 | CurrCard->globalFlags |= F_TAG_STARTED; |
2680 | Non-Tag-CMD handling */ | ||
2681 | WRW_HARPOON((port+ID_MSG_STRT),BRH_OP+ALWAYS+NTCMD); | ||
2682 | 2499 | ||
2683 | WRW_HARPOON((port+NON_TAG_ID_MSG), | 2500 | if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) |
2684 | (MPM_OP+AMSG_OUT+currSCCB->Sccb_idmsg)); | 2501 | == TAG_Q_REJECT) { |
2502 | currSCCB->ControlByte &= ~F_USE_CMD_Q; | ||
2685 | 2503 | ||
2686 | WR_HARPOON(port+hp_autostart_3, (SELECT+SELCHK_STRT)); | 2504 | /* Fix up the start instruction with a jump to |
2505 | Non-Tag-CMD handling */ | ||
2506 | WRW_HARPOON((port + ID_MSG_STRT), | ||
2507 | BRH_OP + ALWAYS + NTCMD); | ||
2687 | 2508 | ||
2688 | /* Setup our STATE so we know what happend when | 2509 | WRW_HARPOON((port + NON_TAG_ID_MSG), |
2689 | the wheels fall off. */ | 2510 | (MPM_OP + AMSG_OUT + |
2690 | currSCCB->Sccb_scsistat = SELECT_ST; | 2511 | currSCCB->Sccb_idmsg)); |
2691 | 2512 | ||
2692 | currTar_Info->TarLUNBusy[lun] = 1; | 2513 | WR_HARPOON(port + hp_autostart_3, |
2693 | } | 2514 | (SELECT + SELCHK_STRT)); |
2694 | 2515 | ||
2695 | else | 2516 | /* Setup our STATE so we know what happend when |
2696 | { | 2517 | the wheels fall off. */ |
2697 | WRW_HARPOON((port+ID_MSG_STRT), (MPM_OP+AMSG_OUT+currSCCB->Sccb_idmsg)); | 2518 | currSCCB->Sccb_scsistat = SELECT_ST; |
2698 | 2519 | ||
2699 | WRW_HARPOON((port+ID_MSG_STRT+2), (MPM_OP+AMSG_OUT+ | 2520 | currTar_Info->TarLUNBusy[lun] = 1; |
2700 | (((unsigned char)(currSCCB->ControlByte & TAG_TYPE_MASK) | 2521 | } |
2701 | >> 6) | (unsigned char)0x20))); | ||
2702 | 2522 | ||
2703 | for (i = 1; i < QUEUE_DEPTH; i++) | 2523 | else { |
2704 | { | 2524 | WRW_HARPOON((port + ID_MSG_STRT), |
2705 | if (++lastTag >= QUEUE_DEPTH) lastTag = 1; | 2525 | (MPM_OP + AMSG_OUT + |
2706 | if (CurrCard->discQ_Tbl[lastTag] == NULL) | 2526 | currSCCB->Sccb_idmsg)); |
2707 | { | 2527 | |
2708 | WRW_HARPOON((port+ID_MSG_STRT+6), | 2528 | WRW_HARPOON((port + ID_MSG_STRT + 2), |
2709 | (MPM_OP+AMSG_OUT+lastTag)); | 2529 | (MPM_OP + AMSG_OUT + |
2530 | (((unsigned char)(currSCCB-> | ||
2531 | ControlByte & | ||
2532 | TAG_TYPE_MASK) | ||
2533 | >> 6) | (unsigned char)0x20))); | ||
2534 | |||
2535 | for (i = 1; i < QUEUE_DEPTH; i++) { | ||
2536 | if (++lastTag >= QUEUE_DEPTH) | ||
2537 | lastTag = 1; | ||
2538 | if (CurrCard->discQ_Tbl[lastTag] == | ||
2539 | NULL) { | ||
2540 | WRW_HARPOON((port + | ||
2541 | ID_MSG_STRT + 6), | ||
2542 | (MPM_OP + AMSG_OUT + | ||
2543 | lastTag)); | ||
2710 | CurrCard->tagQ_Lst = lastTag; | 2544 | CurrCard->tagQ_Lst = lastTag; |
2711 | currSCCB->Sccb_tag = lastTag; | 2545 | currSCCB->Sccb_tag = lastTag; |
2712 | CurrCard->discQ_Tbl[lastTag] = currSCCB; | 2546 | CurrCard->discQ_Tbl[lastTag] = |
2547 | currSCCB; | ||
2713 | CurrCard->discQCount++; | 2548 | CurrCard->discQCount++; |
2714 | break; | 2549 | break; |
2715 | } | 2550 | } |
2716 | } | 2551 | } |
2717 | 2552 | ||
2553 | if (i == QUEUE_DEPTH) { | ||
2554 | currTar_Info->TarLUNBusy[lun] = 1; | ||
2555 | FPT_queueSelectFail(CurrCard, p_card); | ||
2556 | SGRAM_ACCESS(port); | ||
2557 | return; | ||
2558 | } | ||
2718 | 2559 | ||
2719 | if ( i == QUEUE_DEPTH ) | 2560 | currSCCB->Sccb_scsistat = SELECT_Q_ST; |
2720 | { | ||
2721 | currTar_Info->TarLUNBusy[lun] = 1; | ||
2722 | FPT_queueSelectFail(CurrCard,p_card); | ||
2723 | SGRAM_ACCESS(port); | ||
2724 | return; | ||
2725 | } | ||
2726 | |||
2727 | currSCCB->Sccb_scsistat = SELECT_Q_ST; | ||
2728 | |||
2729 | WR_HARPOON(port+hp_autostart_3, (SELECT+SELCHK_STRT)); | ||
2730 | } | ||
2731 | } | ||
2732 | |||
2733 | else | ||
2734 | { | ||
2735 | |||
2736 | WRW_HARPOON((port+ID_MSG_STRT),BRH_OP+ALWAYS+NTCMD); | ||
2737 | 2561 | ||
2738 | WRW_HARPOON((port+NON_TAG_ID_MSG), | 2562 | WR_HARPOON(port + hp_autostart_3, |
2739 | (MPM_OP+AMSG_OUT+currSCCB->Sccb_idmsg)); | 2563 | (SELECT + SELCHK_STRT)); |
2564 | } | ||
2565 | } | ||
2740 | 2566 | ||
2741 | currSCCB->Sccb_scsistat = SELECT_ST; | 2567 | else { |
2742 | 2568 | ||
2743 | WR_HARPOON(port+hp_autostart_3, (SELECT+SELCHK_STRT)); | 2569 | WRW_HARPOON((port + ID_MSG_STRT), |
2744 | } | 2570 | BRH_OP + ALWAYS + NTCMD); |
2745 | 2571 | ||
2572 | WRW_HARPOON((port + NON_TAG_ID_MSG), | ||
2573 | (MPM_OP + AMSG_OUT + currSCCB->Sccb_idmsg)); | ||
2746 | 2574 | ||
2747 | theCCB = (unsigned char *)&currSCCB->Cdb[0]; | 2575 | currSCCB->Sccb_scsistat = SELECT_ST; |
2748 | 2576 | ||
2749 | cdb_reg = port + CMD_STRT; | 2577 | WR_HARPOON(port + hp_autostart_3, |
2578 | (SELECT + SELCHK_STRT)); | ||
2579 | } | ||
2750 | 2580 | ||
2751 | for (i=0; i < currSCCB->CdbLength; i++) | 2581 | theCCB = (unsigned char *)&currSCCB->Cdb[0]; |
2752 | { | ||
2753 | WRW_HARPOON(cdb_reg, (MPM_OP + ACOMMAND + *theCCB)); | ||
2754 | cdb_reg +=2; | ||
2755 | theCCB++; | ||
2756 | } | ||
2757 | 2582 | ||
2758 | if (currSCCB->CdbLength != TWELVE_BYTE_CMD) | 2583 | cdb_reg = port + CMD_STRT; |
2759 | WRW_HARPOON(cdb_reg, (BRH_OP+ALWAYS+ NP)); | ||
2760 | 2584 | ||
2761 | } /* auto_loaded */ | 2585 | for (i = 0; i < currSCCB->CdbLength; i++) { |
2586 | WRW_HARPOON(cdb_reg, (MPM_OP + ACOMMAND + *theCCB)); | ||
2587 | cdb_reg += 2; | ||
2588 | theCCB++; | ||
2589 | } | ||
2762 | 2590 | ||
2763 | WRW_HARPOON((port+hp_fiforead), (unsigned short) 0x00); | 2591 | if (currSCCB->CdbLength != TWELVE_BYTE_CMD) |
2764 | WR_HARPOON(port+hp_xferstat, 0x00); | 2592 | WRW_HARPOON(cdb_reg, (BRH_OP + ALWAYS + NP)); |
2765 | 2593 | ||
2766 | WRW_HARPOON((port+hp_intstat), (PROG_HLT | TIMEOUT | SEL | BUS_FREE)); | 2594 | } |
2595 | /* auto_loaded */ | ||
2596 | WRW_HARPOON((port + hp_fiforead), (unsigned short)0x00); | ||
2597 | WR_HARPOON(port + hp_xferstat, 0x00); | ||
2767 | 2598 | ||
2768 | WR_HARPOON(port+hp_portctrl_0,(SCSI_PORT)); | 2599 | WRW_HARPOON((port + hp_intstat), (PROG_HLT | TIMEOUT | SEL | BUS_FREE)); |
2769 | 2600 | ||
2601 | WR_HARPOON(port + hp_portctrl_0, (SCSI_PORT)); | ||
2770 | 2602 | ||
2771 | if (!(currSCCB->Sccb_MGRFlags & F_DEV_SELECTED)) | 2603 | if (!(currSCCB->Sccb_MGRFlags & F_DEV_SELECTED)) { |
2772 | { | 2604 | WR_HARPOON(port + hp_scsictrl_0, |
2773 | WR_HARPOON(port+hp_scsictrl_0, (SEL_TAR | ENA_ATN | ENA_RESEL | ENA_SCAM_SEL)); | 2605 | (SEL_TAR | ENA_ATN | ENA_RESEL | ENA_SCAM_SEL)); |
2774 | } | 2606 | } else { |
2775 | else | ||
2776 | { | ||
2777 | 2607 | ||
2778 | /* auto_loaded = (RD_HARPOON(port+hp_autostart_3) & (unsigned char)0x1F); | 2608 | /* auto_loaded = (RD_HARPOON(port+hp_autostart_3) & (unsigned char)0x1F); |
2779 | auto_loaded |= AUTO_IMMED; */ | 2609 | auto_loaded |= AUTO_IMMED; */ |
2780 | auto_loaded = AUTO_IMMED; | 2610 | auto_loaded = AUTO_IMMED; |
2781 | 2611 | ||
2782 | DISABLE_AUTO(port); | 2612 | DISABLE_AUTO(port); |
2783 | 2613 | ||
2784 | WR_HARPOON(port+hp_autostart_3, auto_loaded); | 2614 | WR_HARPOON(port + hp_autostart_3, auto_loaded); |
2785 | } | 2615 | } |
2786 | 2616 | ||
2787 | SGRAM_ACCESS(port); | 2617 | SGRAM_ACCESS(port); |
2788 | } | 2618 | } |
2789 | 2619 | ||
2790 | |||
2791 | /*--------------------------------------------------------------------- | 2620 | /*--------------------------------------------------------------------- |
2792 | * | 2621 | * |
2793 | * Function: FPT_sres | 2622 | * Function: FPT_sres |
@@ -2796,303 +2625,276 @@ static void FPT_ssel(unsigned long port, unsigned char p_card) | |||
2796 | * | 2625 | * |
2797 | *---------------------------------------------------------------------*/ | 2626 | *---------------------------------------------------------------------*/ |
2798 | 2627 | ||
2799 | static void FPT_sres(unsigned long port, unsigned char p_card, struct sccb_card * pCurrCard) | 2628 | static void FPT_sres(unsigned long port, unsigned char p_card, |
2629 | struct sccb_card *pCurrCard) | ||
2800 | { | 2630 | { |
2801 | 2631 | ||
2802 | unsigned char our_target, message, lun = 0, tag, msgRetryCount; | 2632 | unsigned char our_target, message, lun = 0, tag, msgRetryCount; |
2803 | |||
2804 | |||
2805 | struct sccb_mgr_tar_info * currTar_Info; | ||
2806 | struct sccb * currSCCB; | ||
2807 | |||
2808 | |||
2809 | 2633 | ||
2634 | struct sccb_mgr_tar_info *currTar_Info; | ||
2635 | struct sccb *currSCCB; | ||
2810 | 2636 | ||
2811 | if(pCurrCard->currentSCCB != NULL) | 2637 | if (pCurrCard->currentSCCB != NULL) { |
2812 | { | 2638 | currTar_Info = |
2813 | currTar_Info = &FPT_sccbMgrTbl[p_card][pCurrCard->currentSCCB->TargID]; | 2639 | &FPT_sccbMgrTbl[p_card][pCurrCard->currentSCCB->TargID]; |
2814 | DISABLE_AUTO(port); | 2640 | DISABLE_AUTO(port); |
2815 | 2641 | ||
2816 | 2642 | WR_HARPOON((port + hp_scsictrl_0), (ENA_RESEL | ENA_SCAM_SEL)); | |
2817 | WR_HARPOON((port+hp_scsictrl_0),(ENA_RESEL | ENA_SCAM_SEL)); | ||
2818 | |||
2819 | 2643 | ||
2820 | currSCCB = pCurrCard->currentSCCB; | 2644 | currSCCB = pCurrCard->currentSCCB; |
2821 | if(currSCCB->Sccb_scsistat == SELECT_WN_ST) | 2645 | if (currSCCB->Sccb_scsistat == SELECT_WN_ST) { |
2822 | { | ||
2823 | currTar_Info->TarStatus &= ~TAR_WIDE_MASK; | 2646 | currTar_Info->TarStatus &= ~TAR_WIDE_MASK; |
2824 | currSCCB->Sccb_scsistat = BUS_FREE_ST; | 2647 | currSCCB->Sccb_scsistat = BUS_FREE_ST; |
2825 | } | 2648 | } |
2826 | if(currSCCB->Sccb_scsistat == SELECT_SN_ST) | 2649 | if (currSCCB->Sccb_scsistat == SELECT_SN_ST) { |
2827 | { | ||
2828 | currTar_Info->TarStatus &= ~TAR_SYNC_MASK; | 2650 | currTar_Info->TarStatus &= ~TAR_SYNC_MASK; |
2829 | currSCCB->Sccb_scsistat = BUS_FREE_ST; | 2651 | currSCCB->Sccb_scsistat = BUS_FREE_ST; |
2830 | } | 2652 | } |
2831 | if(((pCurrCard->globalFlags & F_CONLUN_IO) && | 2653 | if (((pCurrCard->globalFlags & F_CONLUN_IO) && |
2832 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) | 2654 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != |
2833 | { | 2655 | TAG_Q_TRYING))) { |
2834 | currTar_Info->TarLUNBusy[currSCCB->Lun] = 0; | 2656 | currTar_Info->TarLUNBusy[currSCCB->Lun] = 0; |
2835 | if(currSCCB->Sccb_scsistat != ABORT_ST) | 2657 | if (currSCCB->Sccb_scsistat != ABORT_ST) { |
2836 | { | ||
2837 | pCurrCard->discQCount--; | 2658 | pCurrCard->discQCount--; |
2838 | pCurrCard->discQ_Tbl[currTar_Info->LunDiscQ_Idx[currSCCB->Lun]] | 2659 | pCurrCard->discQ_Tbl[currTar_Info-> |
2839 | = NULL; | 2660 | LunDiscQ_Idx[currSCCB-> |
2661 | Lun]] | ||
2662 | = NULL; | ||
2840 | } | 2663 | } |
2841 | } | 2664 | } else { |
2842 | else | 2665 | currTar_Info->TarLUNBusy[0] = 0; |
2843 | { | 2666 | if (currSCCB->Sccb_tag) { |
2844 | currTar_Info->TarLUNBusy[0] = 0; | 2667 | if (currSCCB->Sccb_scsistat != ABORT_ST) { |
2845 | if(currSCCB->Sccb_tag) | ||
2846 | { | ||
2847 | if(currSCCB->Sccb_scsistat != ABORT_ST) | ||
2848 | { | ||
2849 | pCurrCard->discQCount--; | 2668 | pCurrCard->discQCount--; |
2850 | pCurrCard->discQ_Tbl[currSCCB->Sccb_tag] = NULL; | 2669 | pCurrCard->discQ_Tbl[currSCCB-> |
2670 | Sccb_tag] = NULL; | ||
2851 | } | 2671 | } |
2852 | }else | 2672 | } else { |
2853 | { | 2673 | if (currSCCB->Sccb_scsistat != ABORT_ST) { |
2854 | if(currSCCB->Sccb_scsistat != ABORT_ST) | ||
2855 | { | ||
2856 | pCurrCard->discQCount--; | 2674 | pCurrCard->discQCount--; |
2857 | pCurrCard->discQ_Tbl[currTar_Info->LunDiscQ_Idx[0]] = NULL; | 2675 | pCurrCard->discQ_Tbl[currTar_Info-> |
2676 | LunDiscQ_Idx[0]] = | ||
2677 | NULL; | ||
2858 | } | 2678 | } |
2859 | } | 2679 | } |
2860 | } | 2680 | } |
2861 | 2681 | ||
2862 | FPT_queueSelectFail(&FPT_BL_Card[p_card],p_card); | 2682 | FPT_queueSelectFail(&FPT_BL_Card[p_card], p_card); |
2863 | } | 2683 | } |
2864 | 2684 | ||
2865 | WRW_HARPOON((port+hp_fiforead), (unsigned short) 0x00); | 2685 | WRW_HARPOON((port + hp_fiforead), (unsigned short)0x00); |
2866 | |||
2867 | 2686 | ||
2868 | our_target = (unsigned char)(RD_HARPOON(port+hp_select_id) >> 4); | 2687 | our_target = (unsigned char)(RD_HARPOON(port + hp_select_id) >> 4); |
2869 | currTar_Info = &FPT_sccbMgrTbl[p_card][our_target]; | 2688 | currTar_Info = &FPT_sccbMgrTbl[p_card][our_target]; |
2870 | 2689 | ||
2871 | |||
2872 | msgRetryCount = 0; | 2690 | msgRetryCount = 0; |
2873 | do | 2691 | do { |
2874 | { | ||
2875 | 2692 | ||
2876 | currTar_Info = &FPT_sccbMgrTbl[p_card][our_target]; | 2693 | currTar_Info = &FPT_sccbMgrTbl[p_card][our_target]; |
2877 | tag = 0; | 2694 | tag = 0; |
2878 | 2695 | ||
2696 | while (!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) { | ||
2697 | if (!(RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) { | ||
2879 | 2698 | ||
2880 | while(!(RD_HARPOON(port+hp_scsisig) & SCSI_REQ)) | 2699 | WRW_HARPOON((port + hp_intstat), PHASE); |
2881 | { | ||
2882 | if (! (RD_HARPOON(port+hp_scsisig) & SCSI_BSY)) | ||
2883 | { | ||
2884 | |||
2885 | WRW_HARPOON((port+hp_intstat), PHASE); | ||
2886 | return; | 2700 | return; |
2887 | } | 2701 | } |
2888 | } | 2702 | } |
2889 | 2703 | ||
2890 | WRW_HARPOON((port+hp_intstat), PHASE); | 2704 | WRW_HARPOON((port + hp_intstat), PHASE); |
2891 | if ((RD_HARPOON(port+hp_scsisig) & S_SCSI_PHZ) == S_MSGI_PH) | 2705 | if ((RD_HARPOON(port + hp_scsisig) & S_SCSI_PHZ) == S_MSGI_PH) { |
2892 | { | ||
2893 | 2706 | ||
2894 | message = FPT_sfm(port,pCurrCard->currentSCCB); | 2707 | message = FPT_sfm(port, pCurrCard->currentSCCB); |
2895 | if (message) | 2708 | if (message) { |
2896 | { | ||
2897 | 2709 | ||
2898 | if (message <= (0x80 | LUN_MASK)) | 2710 | if (message <= (0x80 | LUN_MASK)) { |
2899 | { | ||
2900 | lun = message & (unsigned char)LUN_MASK; | 2711 | lun = message & (unsigned char)LUN_MASK; |
2901 | 2712 | ||
2902 | if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) == TAG_Q_TRYING) | 2713 | if ((currTar_Info-> |
2903 | { | 2714 | TarStatus & TAR_TAG_Q_MASK) == |
2904 | if (currTar_Info->TarTagQ_Cnt != 0) | 2715 | TAG_Q_TRYING) { |
2905 | { | 2716 | if (currTar_Info->TarTagQ_Cnt != |
2906 | 2717 | 0) { | |
2907 | if (!(currTar_Info->TarLUN_CA)) | 2718 | |
2908 | { | 2719 | if (! |
2909 | ACCEPT_MSG(port); /*Release the ACK for ID msg. */ | 2720 | (currTar_Info-> |
2910 | 2721 | TarLUN_CA)) { | |
2911 | 2722 | ACCEPT_MSG(port); /*Release the ACK for ID msg. */ | |
2912 | message = FPT_sfm(port,pCurrCard->currentSCCB); | 2723 | |
2913 | if (message) | 2724 | message = |
2914 | { | 2725 | FPT_sfm |
2915 | ACCEPT_MSG(port); | 2726 | (port, |
2727 | pCurrCard-> | ||
2728 | currentSCCB); | ||
2729 | if (message) { | ||
2730 | ACCEPT_MSG | ||
2731 | (port); | ||
2916 | } | 2732 | } |
2917 | 2733 | ||
2918 | else | 2734 | else |
2919 | message = 0; | 2735 | message |
2920 | 2736 | = 0; | |
2921 | if(message != 0) | 2737 | |
2922 | { | 2738 | if (message != |
2923 | tag = FPT_sfm(port,pCurrCard->currentSCCB); | 2739 | 0) { |
2924 | 2740 | tag = | |
2925 | if (!(tag)) | 2741 | FPT_sfm |
2926 | message = 0; | 2742 | (port, |
2743 | pCurrCard-> | ||
2744 | currentSCCB); | ||
2745 | |||
2746 | if (! | ||
2747 | (tag)) | ||
2748 | message | ||
2749 | = | ||
2750 | 0; | ||
2927 | } | 2751 | } |
2928 | 2752 | ||
2929 | } /*C.A. exists! */ | 2753 | } |
2930 | 2754 | /*C.A. exists! */ | |
2931 | } /*End Q cnt != 0 */ | 2755 | } |
2932 | 2756 | /*End Q cnt != 0 */ | |
2933 | } /*End Tag cmds supported! */ | 2757 | } |
2934 | 2758 | /*End Tag cmds supported! */ | |
2935 | } /*End valid ID message. */ | 2759 | } |
2936 | 2760 | /*End valid ID message. */ | |
2937 | else | 2761 | else { |
2938 | { | ||
2939 | 2762 | ||
2940 | ACCEPT_MSG_ATN(port); | 2763 | ACCEPT_MSG_ATN(port); |
2941 | } | 2764 | } |
2942 | 2765 | ||
2943 | } /* End good id message. */ | 2766 | } |
2944 | 2767 | /* End good id message. */ | |
2945 | else | 2768 | else { |
2946 | { | ||
2947 | 2769 | ||
2948 | message = 0; | 2770 | message = 0; |
2949 | } | 2771 | } |
2950 | } | 2772 | } else { |
2951 | else | ||
2952 | { | ||
2953 | ACCEPT_MSG_ATN(port); | 2773 | ACCEPT_MSG_ATN(port); |
2954 | 2774 | ||
2955 | while (!(RDW_HARPOON((port+hp_intstat)) & (PHASE | RESET)) && | 2775 | while (! |
2956 | !(RD_HARPOON(port+hp_scsisig) & SCSI_REQ) && | 2776 | (RDW_HARPOON((port + hp_intstat)) & |
2957 | (RD_HARPOON(port+hp_scsisig) & SCSI_BSY)) ; | 2777 | (PHASE | RESET)) |
2778 | && !(RD_HARPOON(port + hp_scsisig) & SCSI_REQ) | ||
2779 | && (RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) ; | ||
2958 | 2780 | ||
2959 | return; | 2781 | return; |
2960 | } | 2782 | } |
2961 | 2783 | ||
2962 | if(message == 0) | 2784 | if (message == 0) { |
2963 | { | ||
2964 | msgRetryCount++; | 2785 | msgRetryCount++; |
2965 | if(msgRetryCount == 1) | 2786 | if (msgRetryCount == 1) { |
2966 | { | ||
2967 | FPT_SendMsg(port, SMPARITY); | 2787 | FPT_SendMsg(port, SMPARITY); |
2968 | } | 2788 | } else { |
2969 | else | ||
2970 | { | ||
2971 | FPT_SendMsg(port, SMDEV_RESET); | 2789 | FPT_SendMsg(port, SMDEV_RESET); |
2972 | 2790 | ||
2973 | FPT_sssyncv(port, our_target, NARROW_SCSI,currTar_Info); | 2791 | FPT_sssyncv(port, our_target, NARROW_SCSI, |
2792 | currTar_Info); | ||
2974 | 2793 | ||
2975 | if (FPT_sccbMgrTbl[p_card][our_target].TarEEValue & EE_SYNC_MASK) | 2794 | if (FPT_sccbMgrTbl[p_card][our_target]. |
2976 | { | 2795 | TarEEValue & EE_SYNC_MASK) { |
2977 | 2796 | ||
2978 | FPT_sccbMgrTbl[p_card][our_target].TarStatus &= ~TAR_SYNC_MASK; | 2797 | FPT_sccbMgrTbl[p_card][our_target]. |
2798 | TarStatus &= ~TAR_SYNC_MASK; | ||
2979 | 2799 | ||
2980 | } | 2800 | } |
2981 | 2801 | ||
2982 | if (FPT_sccbMgrTbl[p_card][our_target].TarEEValue & EE_WIDE_SCSI) | 2802 | if (FPT_sccbMgrTbl[p_card][our_target]. |
2983 | { | 2803 | TarEEValue & EE_WIDE_SCSI) { |
2984 | 2804 | ||
2985 | FPT_sccbMgrTbl[p_card][our_target].TarStatus &= ~TAR_WIDE_MASK; | 2805 | FPT_sccbMgrTbl[p_card][our_target]. |
2806 | TarStatus &= ~TAR_WIDE_MASK; | ||
2986 | } | 2807 | } |
2987 | 2808 | ||
2988 | 2809 | FPT_queueFlushTargSccb(p_card, our_target, | |
2989 | FPT_queueFlushTargSccb(p_card, our_target, SCCB_COMPLETE); | 2810 | SCCB_COMPLETE); |
2990 | FPT_SccbMgrTableInitTarget(p_card,our_target); | 2811 | FPT_SccbMgrTableInitTarget(p_card, our_target); |
2991 | return; | 2812 | return; |
2992 | } | 2813 | } |
2993 | } | 2814 | } |
2994 | }while(message == 0); | 2815 | } while (message == 0); |
2995 | 2816 | ||
2996 | 2817 | if (((pCurrCard->globalFlags & F_CONLUN_IO) && | |
2997 | 2818 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) { | |
2998 | if(((pCurrCard->globalFlags & F_CONLUN_IO) && | ||
2999 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) | ||
3000 | { | ||
3001 | currTar_Info->TarLUNBusy[lun] = 1; | 2819 | currTar_Info->TarLUNBusy[lun] = 1; |
3002 | pCurrCard->currentSCCB = pCurrCard->discQ_Tbl[currTar_Info->LunDiscQ_Idx[lun]]; | 2820 | pCurrCard->currentSCCB = |
3003 | if(pCurrCard->currentSCCB != NULL) | 2821 | pCurrCard->discQ_Tbl[currTar_Info->LunDiscQ_Idx[lun]]; |
3004 | { | 2822 | if (pCurrCard->currentSCCB != NULL) { |
3005 | ACCEPT_MSG(port); | 2823 | ACCEPT_MSG(port); |
3006 | } | 2824 | } else { |
3007 | else | ||
3008 | { | ||
3009 | ACCEPT_MSG_ATN(port); | 2825 | ACCEPT_MSG_ATN(port); |
3010 | } | 2826 | } |
3011 | } | 2827 | } else { |
3012 | else | ||
3013 | { | ||
3014 | currTar_Info->TarLUNBusy[0] = 1; | 2828 | currTar_Info->TarLUNBusy[0] = 1; |
3015 | 2829 | ||
3016 | 2830 | if (tag) { | |
3017 | if (tag) | 2831 | if (pCurrCard->discQ_Tbl[tag] != NULL) { |
3018 | { | 2832 | pCurrCard->currentSCCB = |
3019 | if (pCurrCard->discQ_Tbl[tag] != NULL) | 2833 | pCurrCard->discQ_Tbl[tag]; |
3020 | { | 2834 | currTar_Info->TarTagQ_Cnt--; |
3021 | pCurrCard->currentSCCB = pCurrCard->discQ_Tbl[tag]; | ||
3022 | currTar_Info->TarTagQ_Cnt--; | ||
3023 | ACCEPT_MSG(port); | 2835 | ACCEPT_MSG(port); |
2836 | } else { | ||
2837 | ACCEPT_MSG_ATN(port); | ||
3024 | } | 2838 | } |
3025 | else | 2839 | } else { |
3026 | { | 2840 | pCurrCard->currentSCCB = |
3027 | ACCEPT_MSG_ATN(port); | 2841 | pCurrCard->discQ_Tbl[currTar_Info->LunDiscQ_Idx[0]]; |
3028 | } | 2842 | if (pCurrCard->currentSCCB != NULL) { |
3029 | }else | ||
3030 | { | ||
3031 | pCurrCard->currentSCCB = pCurrCard->discQ_Tbl[currTar_Info->LunDiscQ_Idx[0]]; | ||
3032 | if(pCurrCard->currentSCCB != NULL) | ||
3033 | { | ||
3034 | ACCEPT_MSG(port); | 2843 | ACCEPT_MSG(port); |
3035 | } | 2844 | } else { |
3036 | else | ||
3037 | { | ||
3038 | ACCEPT_MSG_ATN(port); | 2845 | ACCEPT_MSG_ATN(port); |
3039 | } | 2846 | } |
3040 | } | 2847 | } |
3041 | } | 2848 | } |
3042 | 2849 | ||
3043 | if(pCurrCard->currentSCCB != NULL) | 2850 | if (pCurrCard->currentSCCB != NULL) { |
3044 | { | 2851 | if (pCurrCard->currentSCCB->Sccb_scsistat == ABORT_ST) { |
3045 | if(pCurrCard->currentSCCB->Sccb_scsistat == ABORT_ST) | 2852 | /* During Abort Tag command, the target could have got re-selected |
3046 | { | 2853 | and completed the command. Check the select Q and remove the CCB |
3047 | /* During Abort Tag command, the target could have got re-selected | 2854 | if it is in the Select Q */ |
3048 | and completed the command. Check the select Q and remove the CCB | ||
3049 | if it is in the Select Q */ | ||
3050 | FPT_queueFindSccb(pCurrCard->currentSCCB, p_card); | 2855 | FPT_queueFindSccb(pCurrCard->currentSCCB, p_card); |
3051 | } | 2856 | } |
3052 | } | 2857 | } |
3053 | 2858 | ||
3054 | 2859 | while (!(RDW_HARPOON((port + hp_intstat)) & (PHASE | RESET)) && | |
3055 | while (!(RDW_HARPOON((port+hp_intstat)) & (PHASE | RESET)) && | 2860 | !(RD_HARPOON(port + hp_scsisig) & SCSI_REQ) && |
3056 | !(RD_HARPOON(port+hp_scsisig) & SCSI_REQ) && | 2861 | (RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) ; |
3057 | (RD_HARPOON(port+hp_scsisig) & SCSI_BSY)) ; | ||
3058 | } | 2862 | } |
3059 | 2863 | ||
3060 | static void FPT_SendMsg(unsigned long port, unsigned char message) | 2864 | static void FPT_SendMsg(unsigned long port, unsigned char message) |
3061 | { | 2865 | { |
3062 | while(!(RD_HARPOON(port+hp_scsisig) & SCSI_REQ)) | 2866 | while (!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) { |
3063 | { | 2867 | if (!(RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) { |
3064 | if (! (RD_HARPOON(port+hp_scsisig) & SCSI_BSY)) | ||
3065 | { | ||
3066 | 2868 | ||
3067 | WRW_HARPOON((port+hp_intstat), PHASE); | 2869 | WRW_HARPOON((port + hp_intstat), PHASE); |
3068 | return; | 2870 | return; |
3069 | } | 2871 | } |
3070 | } | 2872 | } |
3071 | 2873 | ||
3072 | WRW_HARPOON((port+hp_intstat), PHASE); | 2874 | WRW_HARPOON((port + hp_intstat), PHASE); |
3073 | if ((RD_HARPOON(port+hp_scsisig) & S_SCSI_PHZ) == S_MSGO_PH) | 2875 | if ((RD_HARPOON(port + hp_scsisig) & S_SCSI_PHZ) == S_MSGO_PH) { |
3074 | { | 2876 | WRW_HARPOON((port + hp_intstat), |
3075 | WRW_HARPOON((port+hp_intstat), (BUS_FREE | PHASE | XFER_CNT_0)); | 2877 | (BUS_FREE | PHASE | XFER_CNT_0)); |
3076 | |||
3077 | 2878 | ||
3078 | WR_HARPOON(port+hp_portctrl_0, SCSI_BUS_EN); | 2879 | WR_HARPOON(port + hp_portctrl_0, SCSI_BUS_EN); |
3079 | 2880 | ||
3080 | WR_HARPOON(port+hp_scsidata_0,message); | 2881 | WR_HARPOON(port + hp_scsidata_0, message); |
3081 | 2882 | ||
3082 | WR_HARPOON(port+hp_scsisig, (SCSI_ACK + S_ILL_PH)); | 2883 | WR_HARPOON(port + hp_scsisig, (SCSI_ACK + S_ILL_PH)); |
3083 | 2884 | ||
3084 | ACCEPT_MSG(port); | 2885 | ACCEPT_MSG(port); |
3085 | 2886 | ||
3086 | WR_HARPOON(port+hp_portctrl_0, 0x00); | 2887 | WR_HARPOON(port + hp_portctrl_0, 0x00); |
3087 | 2888 | ||
3088 | if ((message == SMABORT) || (message == SMDEV_RESET) || | 2889 | if ((message == SMABORT) || (message == SMDEV_RESET) || |
3089 | (message == SMABORT_TAG) ) | 2890 | (message == SMABORT_TAG)) { |
3090 | { | 2891 | while (! |
3091 | while(!(RDW_HARPOON((port+hp_intstat)) & (BUS_FREE | PHASE))) {} | 2892 | (RDW_HARPOON((port + hp_intstat)) & |
2893 | (BUS_FREE | PHASE))) { | ||
2894 | } | ||
3092 | 2895 | ||
3093 | if (RDW_HARPOON((port+hp_intstat)) & BUS_FREE) | 2896 | if (RDW_HARPOON((port + hp_intstat)) & BUS_FREE) { |
3094 | { | 2897 | WRW_HARPOON((port + hp_intstat), BUS_FREE); |
3095 | WRW_HARPOON((port+hp_intstat), BUS_FREE); | ||
3096 | } | 2898 | } |
3097 | } | 2899 | } |
3098 | } | 2900 | } |
@@ -3106,37 +2908,35 @@ static void FPT_SendMsg(unsigned long port, unsigned char message) | |||
3106 | * target device. | 2908 | * target device. |
3107 | * | 2909 | * |
3108 | *---------------------------------------------------------------------*/ | 2910 | *---------------------------------------------------------------------*/ |
3109 | static void FPT_sdecm(unsigned char message, unsigned long port, unsigned char p_card) | 2911 | static void FPT_sdecm(unsigned char message, unsigned long port, |
2912 | unsigned char p_card) | ||
3110 | { | 2913 | { |
3111 | struct sccb * currSCCB; | 2914 | struct sccb *currSCCB; |
3112 | struct sccb_card * CurrCard; | 2915 | struct sccb_card *CurrCard; |
3113 | struct sccb_mgr_tar_info * currTar_Info; | 2916 | struct sccb_mgr_tar_info *currTar_Info; |
3114 | 2917 | ||
3115 | CurrCard = &FPT_BL_Card[p_card]; | 2918 | CurrCard = &FPT_BL_Card[p_card]; |
3116 | currSCCB = CurrCard->currentSCCB; | 2919 | currSCCB = CurrCard->currentSCCB; |
3117 | 2920 | ||
3118 | currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID]; | 2921 | currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID]; |
3119 | 2922 | ||
3120 | if (message == SMREST_DATA_PTR) | 2923 | if (message == SMREST_DATA_PTR) { |
3121 | { | 2924 | if (!(currSCCB->Sccb_XferState & F_NO_DATA_YET)) { |
3122 | if (!(currSCCB->Sccb_XferState & F_NO_DATA_YET)) | ||
3123 | { | ||
3124 | currSCCB->Sccb_ATC = currSCCB->Sccb_savedATC; | 2925 | currSCCB->Sccb_ATC = currSCCB->Sccb_savedATC; |
3125 | 2926 | ||
3126 | FPT_hostDataXferRestart(currSCCB); | 2927 | FPT_hostDataXferRestart(currSCCB); |
3127 | } | 2928 | } |
3128 | 2929 | ||
3129 | ACCEPT_MSG(port); | 2930 | ACCEPT_MSG(port); |
3130 | WR_HARPOON(port+hp_autostart_1, (AUTO_IMMED+DISCONNECT_START)); | 2931 | WR_HARPOON(port + hp_autostart_1, |
2932 | (AUTO_IMMED + DISCONNECT_START)); | ||
3131 | } | 2933 | } |
3132 | 2934 | ||
3133 | else if (message == SMCMD_COMP) | 2935 | else if (message == SMCMD_COMP) { |
3134 | { | ||
3135 | |||
3136 | 2936 | ||
3137 | if (currSCCB->Sccb_scsistat == SELECT_Q_ST) | 2937 | if (currSCCB->Sccb_scsistat == SELECT_Q_ST) { |
3138 | { | 2938 | currTar_Info->TarStatus &= |
3139 | currTar_Info->TarStatus &= ~(unsigned char)TAR_TAG_Q_MASK; | 2939 | ~(unsigned char)TAR_TAG_Q_MASK; |
3140 | currTar_Info->TarStatus |= (unsigned char)TAG_Q_REJECT; | 2940 | currTar_Info->TarStatus |= (unsigned char)TAG_Q_REJECT; |
3141 | } | 2941 | } |
3142 | 2942 | ||
@@ -3144,140 +2944,144 @@ static void FPT_sdecm(unsigned char message, unsigned long port, unsigned char p | |||
3144 | 2944 | ||
3145 | } | 2945 | } |
3146 | 2946 | ||
3147 | else if ((message == SMNO_OP) || (message >= SMIDENT) | 2947 | else if ((message == SMNO_OP) || (message >= SMIDENT) |
3148 | || (message == SMINIT_RECOVERY) || (message == SMREL_RECOVERY)) | 2948 | || (message == SMINIT_RECOVERY) || (message == SMREL_RECOVERY)) { |
3149 | { | ||
3150 | 2949 | ||
3151 | ACCEPT_MSG(port); | 2950 | ACCEPT_MSG(port); |
3152 | WR_HARPOON(port+hp_autostart_1, (AUTO_IMMED+DISCONNECT_START)); | 2951 | WR_HARPOON(port + hp_autostart_1, |
2952 | (AUTO_IMMED + DISCONNECT_START)); | ||
3153 | } | 2953 | } |
3154 | 2954 | ||
3155 | else if (message == SMREJECT) | 2955 | else if (message == SMREJECT) { |
3156 | { | ||
3157 | 2956 | ||
3158 | if ((currSCCB->Sccb_scsistat == SELECT_SN_ST) || | 2957 | if ((currSCCB->Sccb_scsistat == SELECT_SN_ST) || |
3159 | (currSCCB->Sccb_scsistat == SELECT_WN_ST) || | 2958 | (currSCCB->Sccb_scsistat == SELECT_WN_ST) || |
3160 | ((currTar_Info->TarStatus & TAR_SYNC_MASK) == SYNC_TRYING ) || | 2959 | ((currTar_Info->TarStatus & TAR_SYNC_MASK) == SYNC_TRYING) |
3161 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) == TAG_Q_TRYING ) ) | 2960 | || ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) == |
3162 | 2961 | TAG_Q_TRYING)) | |
3163 | { | 2962 | { |
3164 | WRW_HARPOON((port+hp_intstat), BUS_FREE); | 2963 | WRW_HARPOON((port + hp_intstat), BUS_FREE); |
3165 | 2964 | ||
3166 | ACCEPT_MSG(port); | 2965 | ACCEPT_MSG(port); |
3167 | 2966 | ||
3168 | 2967 | while ((!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) && | |
3169 | while ((!(RD_HARPOON(port+hp_scsisig) & SCSI_REQ)) && | 2968 | (!(RDW_HARPOON((port + hp_intstat)) & BUS_FREE))) |
3170 | (!(RDW_HARPOON((port+hp_intstat)) & BUS_FREE))) {} | ||
3171 | |||
3172 | if(currSCCB->Lun == 0x00) | ||
3173 | { | 2969 | { |
3174 | if ((currSCCB->Sccb_scsistat == SELECT_SN_ST)) | 2970 | } |
3175 | { | ||
3176 | 2971 | ||
3177 | currTar_Info->TarStatus |= (unsigned char)SYNC_SUPPORTED; | 2972 | if (currSCCB->Lun == 0x00) { |
2973 | if ((currSCCB->Sccb_scsistat == SELECT_SN_ST)) { | ||
3178 | 2974 | ||
3179 | currTar_Info->TarEEValue &= ~EE_SYNC_MASK; | 2975 | currTar_Info->TarStatus |= |
3180 | } | 2976 | (unsigned char)SYNC_SUPPORTED; |
3181 | 2977 | ||
3182 | else if ((currSCCB->Sccb_scsistat == SELECT_WN_ST)) | 2978 | currTar_Info->TarEEValue &= |
3183 | { | 2979 | ~EE_SYNC_MASK; |
2980 | } | ||
3184 | 2981 | ||
2982 | else if ((currSCCB->Sccb_scsistat == | ||
2983 | SELECT_WN_ST)) { | ||
3185 | 2984 | ||
3186 | currTar_Info->TarStatus = (currTar_Info->TarStatus & | 2985 | currTar_Info->TarStatus = |
3187 | ~WIDE_ENABLED) | WIDE_NEGOCIATED; | 2986 | (currTar_Info-> |
2987 | TarStatus & ~WIDE_ENABLED) | | ||
2988 | WIDE_NEGOCIATED; | ||
3188 | 2989 | ||
3189 | currTar_Info->TarEEValue &= ~EE_WIDE_SCSI; | 2990 | currTar_Info->TarEEValue &= |
2991 | ~EE_WIDE_SCSI; | ||
3190 | 2992 | ||
3191 | } | 2993 | } |
3192 | 2994 | ||
3193 | else if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) == TAG_Q_TRYING ) | 2995 | else if ((currTar_Info-> |
3194 | { | 2996 | TarStatus & TAR_TAG_Q_MASK) == |
3195 | currTar_Info->TarStatus = (currTar_Info->TarStatus & | 2997 | TAG_Q_TRYING) { |
3196 | ~(unsigned char)TAR_TAG_Q_MASK) | TAG_Q_REJECT; | 2998 | currTar_Info->TarStatus = |
3197 | 2999 | (currTar_Info-> | |
3000 | TarStatus & ~(unsigned char) | ||
3001 | TAR_TAG_Q_MASK) | TAG_Q_REJECT; | ||
3198 | 3002 | ||
3199 | currSCCB->ControlByte &= ~F_USE_CMD_Q; | 3003 | currSCCB->ControlByte &= ~F_USE_CMD_Q; |
3200 | CurrCard->discQCount--; | 3004 | CurrCard->discQCount--; |
3201 | CurrCard->discQ_Tbl[currSCCB->Sccb_tag] = NULL; | 3005 | CurrCard->discQ_Tbl[currSCCB-> |
3006 | Sccb_tag] = NULL; | ||
3202 | currSCCB->Sccb_tag = 0x00; | 3007 | currSCCB->Sccb_tag = 0x00; |
3203 | 3008 | ||
3204 | } | 3009 | } |
3205 | } | 3010 | } |
3206 | 3011 | ||
3207 | if (RDW_HARPOON((port+hp_intstat)) & BUS_FREE) | 3012 | if (RDW_HARPOON((port + hp_intstat)) & BUS_FREE) { |
3208 | { | ||
3209 | 3013 | ||
3210 | 3014 | if (currSCCB->Lun == 0x00) { | |
3211 | if(currSCCB->Lun == 0x00) | 3015 | WRW_HARPOON((port + hp_intstat), |
3212 | { | 3016 | BUS_FREE); |
3213 | WRW_HARPOON((port+hp_intstat), BUS_FREE); | ||
3214 | CurrCard->globalFlags |= F_NEW_SCCB_CMD; | 3017 | CurrCard->globalFlags |= F_NEW_SCCB_CMD; |
3215 | } | 3018 | } |
3216 | } | 3019 | } |
3217 | 3020 | ||
3218 | else | 3021 | else { |
3219 | { | ||
3220 | 3022 | ||
3221 | if((CurrCard->globalFlags & F_CONLUN_IO) && | 3023 | if ((CurrCard->globalFlags & F_CONLUN_IO) && |
3222 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) | 3024 | ((currTar_Info-> |
3223 | currTar_Info->TarLUNBusy[currSCCB->Lun] = 1; | 3025 | TarStatus & TAR_TAG_Q_MASK) != |
3026 | TAG_Q_TRYING)) | ||
3027 | currTar_Info->TarLUNBusy[currSCCB-> | ||
3028 | Lun] = 1; | ||
3224 | else | 3029 | else |
3225 | currTar_Info->TarLUNBusy[0] = 1; | 3030 | currTar_Info->TarLUNBusy[0] = 1; |
3226 | 3031 | ||
3032 | currSCCB->ControlByte &= | ||
3033 | ~(unsigned char)F_USE_CMD_Q; | ||
3227 | 3034 | ||
3228 | currSCCB->ControlByte &= ~(unsigned char)F_USE_CMD_Q; | 3035 | WR_HARPOON(port + hp_autostart_1, |
3229 | 3036 | (AUTO_IMMED + DISCONNECT_START)); | |
3230 | WR_HARPOON(port+hp_autostart_1, (AUTO_IMMED+DISCONNECT_START)); | ||
3231 | 3037 | ||
3232 | } | 3038 | } |
3233 | } | 3039 | } |
3234 | 3040 | ||
3235 | else | 3041 | else { |
3236 | { | ||
3237 | ACCEPT_MSG(port); | 3042 | ACCEPT_MSG(port); |
3238 | 3043 | ||
3239 | while ((!(RD_HARPOON(port+hp_scsisig) & SCSI_REQ)) && | 3044 | while ((!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) && |
3240 | (!(RDW_HARPOON((port+hp_intstat)) & BUS_FREE))) {} | 3045 | (!(RDW_HARPOON((port + hp_intstat)) & BUS_FREE))) |
3241 | |||
3242 | if (!(RDW_HARPOON((port+hp_intstat)) & BUS_FREE)) | ||
3243 | { | 3046 | { |
3244 | WR_HARPOON(port+hp_autostart_1, (AUTO_IMMED+DISCONNECT_START)); | 3047 | } |
3048 | |||
3049 | if (!(RDW_HARPOON((port + hp_intstat)) & BUS_FREE)) { | ||
3050 | WR_HARPOON(port + hp_autostart_1, | ||
3051 | (AUTO_IMMED + DISCONNECT_START)); | ||
3245 | } | 3052 | } |
3246 | } | 3053 | } |
3247 | } | 3054 | } |
3248 | 3055 | ||
3249 | else if (message == SMEXT) | 3056 | else if (message == SMEXT) { |
3250 | { | ||
3251 | 3057 | ||
3252 | ACCEPT_MSG(port); | 3058 | ACCEPT_MSG(port); |
3253 | FPT_shandem(port,p_card,currSCCB); | 3059 | FPT_shandem(port, p_card, currSCCB); |
3254 | } | 3060 | } |
3255 | 3061 | ||
3256 | else if (message == SMIGNORWR) | 3062 | else if (message == SMIGNORWR) { |
3257 | { | ||
3258 | 3063 | ||
3259 | ACCEPT_MSG(port); /* ACK the RESIDUE MSG */ | 3064 | ACCEPT_MSG(port); /* ACK the RESIDUE MSG */ |
3260 | 3065 | ||
3261 | message = FPT_sfm(port,currSCCB); | 3066 | message = FPT_sfm(port, currSCCB); |
3262 | 3067 | ||
3263 | if(currSCCB->Sccb_scsimsg != SMPARITY) | 3068 | if (currSCCB->Sccb_scsimsg != SMPARITY) |
3264 | ACCEPT_MSG(port); | 3069 | ACCEPT_MSG(port); |
3265 | WR_HARPOON(port+hp_autostart_1, (AUTO_IMMED+DISCONNECT_START)); | 3070 | WR_HARPOON(port + hp_autostart_1, |
3071 | (AUTO_IMMED + DISCONNECT_START)); | ||
3266 | } | 3072 | } |
3267 | 3073 | ||
3268 | 3074 | else { | |
3269 | else | ||
3270 | { | ||
3271 | 3075 | ||
3272 | currSCCB->HostStatus = SCCB_PHASE_SEQUENCE_FAIL; | 3076 | currSCCB->HostStatus = SCCB_PHASE_SEQUENCE_FAIL; |
3273 | currSCCB->Sccb_scsimsg = SMREJECT; | 3077 | currSCCB->Sccb_scsimsg = SMREJECT; |
3274 | 3078 | ||
3275 | ACCEPT_MSG_ATN(port); | 3079 | ACCEPT_MSG_ATN(port); |
3276 | WR_HARPOON(port+hp_autostart_1, (AUTO_IMMED+DISCONNECT_START)); | 3080 | WR_HARPOON(port + hp_autostart_1, |
3081 | (AUTO_IMMED + DISCONNECT_START)); | ||
3277 | } | 3082 | } |
3278 | } | 3083 | } |
3279 | 3084 | ||
3280 | |||
3281 | /*--------------------------------------------------------------------- | 3085 | /*--------------------------------------------------------------------- |
3282 | * | 3086 | * |
3283 | * Function: FPT_shandem | 3087 | * Function: FPT_shandem |
@@ -3285,76 +3089,65 @@ static void FPT_sdecm(unsigned char message, unsigned long port, unsigned char p | |||
3285 | * Description: Decide what to do with the extended message. | 3089 | * Description: Decide what to do with the extended message. |
3286 | * | 3090 | * |
3287 | *---------------------------------------------------------------------*/ | 3091 | *---------------------------------------------------------------------*/ |
3288 | static void FPT_shandem(unsigned long port, unsigned char p_card, struct sccb * pCurrSCCB) | 3092 | static void FPT_shandem(unsigned long port, unsigned char p_card, |
3093 | struct sccb *pCurrSCCB) | ||
3289 | { | 3094 | { |
3290 | unsigned char length,message; | 3095 | unsigned char length, message; |
3291 | 3096 | ||
3292 | length = FPT_sfm(port,pCurrSCCB); | 3097 | length = FPT_sfm(port, pCurrSCCB); |
3293 | if (length) | 3098 | if (length) { |
3294 | { | ||
3295 | 3099 | ||
3296 | ACCEPT_MSG(port); | 3100 | ACCEPT_MSG(port); |
3297 | message = FPT_sfm(port,pCurrSCCB); | 3101 | message = FPT_sfm(port, pCurrSCCB); |
3298 | if (message) | 3102 | if (message) { |
3299 | { | ||
3300 | 3103 | ||
3301 | if (message == SMSYNC) | 3104 | if (message == SMSYNC) { |
3302 | { | ||
3303 | 3105 | ||
3304 | if (length == 0x03) | 3106 | if (length == 0x03) { |
3305 | { | ||
3306 | 3107 | ||
3307 | ACCEPT_MSG(port); | 3108 | ACCEPT_MSG(port); |
3308 | FPT_stsyncn(port,p_card); | 3109 | FPT_stsyncn(port, p_card); |
3309 | } | 3110 | } else { |
3310 | else | ||
3311 | { | ||
3312 | 3111 | ||
3313 | pCurrSCCB->Sccb_scsimsg = SMREJECT; | 3112 | pCurrSCCB->Sccb_scsimsg = SMREJECT; |
3314 | ACCEPT_MSG_ATN(port); | 3113 | ACCEPT_MSG_ATN(port); |
3315 | } | 3114 | } |
3316 | } | 3115 | } else if (message == SMWDTR) { |
3317 | else if (message == SMWDTR) | ||
3318 | { | ||
3319 | 3116 | ||
3320 | if (length == 0x02) | 3117 | if (length == 0x02) { |
3321 | { | ||
3322 | 3118 | ||
3323 | ACCEPT_MSG(port); | 3119 | ACCEPT_MSG(port); |
3324 | FPT_stwidn(port,p_card); | 3120 | FPT_stwidn(port, p_card); |
3325 | } | 3121 | } else { |
3326 | else | ||
3327 | { | ||
3328 | 3122 | ||
3329 | pCurrSCCB->Sccb_scsimsg = SMREJECT; | 3123 | pCurrSCCB->Sccb_scsimsg = SMREJECT; |
3330 | ACCEPT_MSG_ATN(port); | 3124 | ACCEPT_MSG_ATN(port); |
3331 | 3125 | ||
3332 | WR_HARPOON(port+hp_autostart_1, (AUTO_IMMED+DISCONNECT_START)); | 3126 | WR_HARPOON(port + hp_autostart_1, |
3127 | (AUTO_IMMED + | ||
3128 | DISCONNECT_START)); | ||
3333 | } | 3129 | } |
3334 | } | 3130 | } else { |
3335 | else | ||
3336 | { | ||
3337 | 3131 | ||
3338 | pCurrSCCB->Sccb_scsimsg = SMREJECT; | 3132 | pCurrSCCB->Sccb_scsimsg = SMREJECT; |
3339 | ACCEPT_MSG_ATN(port); | 3133 | ACCEPT_MSG_ATN(port); |
3340 | 3134 | ||
3341 | WR_HARPOON(port+hp_autostart_1, (AUTO_IMMED+DISCONNECT_START)); | 3135 | WR_HARPOON(port + hp_autostart_1, |
3136 | (AUTO_IMMED + DISCONNECT_START)); | ||
3342 | } | 3137 | } |
3343 | } | 3138 | } else { |
3344 | else | 3139 | if (pCurrSCCB->Sccb_scsimsg != SMPARITY) |
3345 | { | ||
3346 | if(pCurrSCCB->Sccb_scsimsg != SMPARITY) | ||
3347 | ACCEPT_MSG(port); | 3140 | ACCEPT_MSG(port); |
3348 | WR_HARPOON(port+hp_autostart_1, (AUTO_IMMED+DISCONNECT_START)); | 3141 | WR_HARPOON(port + hp_autostart_1, |
3142 | (AUTO_IMMED + DISCONNECT_START)); | ||
3349 | } | 3143 | } |
3350 | }else | 3144 | } else { |
3351 | { | 3145 | if (pCurrSCCB->Sccb_scsimsg == SMPARITY) |
3352 | if(pCurrSCCB->Sccb_scsimsg == SMPARITY) | 3146 | WR_HARPOON(port + hp_autostart_1, |
3353 | WR_HARPOON(port+hp_autostart_1, (AUTO_IMMED+DISCONNECT_START)); | 3147 | (AUTO_IMMED + DISCONNECT_START)); |
3354 | } | 3148 | } |
3355 | } | 3149 | } |
3356 | 3150 | ||
3357 | |||
3358 | /*--------------------------------------------------------------------- | 3151 | /*--------------------------------------------------------------------- |
3359 | * | 3152 | * |
3360 | * Function: FPT_sisyncn | 3153 | * Function: FPT_sisyncn |
@@ -3364,73 +3157,79 @@ static void FPT_shandem(unsigned long port, unsigned char p_card, struct sccb * | |||
3364 | * | 3157 | * |
3365 | *---------------------------------------------------------------------*/ | 3158 | *---------------------------------------------------------------------*/ |
3366 | 3159 | ||
3367 | static unsigned char FPT_sisyncn(unsigned long port, unsigned char p_card, unsigned char syncFlag) | 3160 | static unsigned char FPT_sisyncn(unsigned long port, unsigned char p_card, |
3161 | unsigned char syncFlag) | ||
3368 | { | 3162 | { |
3369 | struct sccb * currSCCB; | 3163 | struct sccb *currSCCB; |
3370 | struct sccb_mgr_tar_info * currTar_Info; | 3164 | struct sccb_mgr_tar_info *currTar_Info; |
3371 | |||
3372 | currSCCB = FPT_BL_Card[p_card].currentSCCB; | ||
3373 | currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID]; | ||
3374 | |||
3375 | if (!((currTar_Info->TarStatus & TAR_SYNC_MASK) == SYNC_TRYING)) { | ||
3376 | |||
3377 | |||
3378 | WRW_HARPOON((port+ID_MSG_STRT), | ||
3379 | (MPM_OP+AMSG_OUT+(currSCCB->Sccb_idmsg & ~(unsigned char)DISC_PRIV))); | ||
3380 | |||
3381 | WRW_HARPOON((port+ID_MSG_STRT+2),BRH_OP+ALWAYS+CMDPZ); | ||
3382 | |||
3383 | WRW_HARPOON((port+SYNC_MSGS+0), (MPM_OP+AMSG_OUT+SMEXT )); | ||
3384 | WRW_HARPOON((port+SYNC_MSGS+2), (MPM_OP+AMSG_OUT+0x03 )); | ||
3385 | WRW_HARPOON((port+SYNC_MSGS+4), (MPM_OP+AMSG_OUT+SMSYNC)); | ||
3386 | 3165 | ||
3166 | currSCCB = FPT_BL_Card[p_card].currentSCCB; | ||
3167 | currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID]; | ||
3387 | 3168 | ||
3388 | if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == EE_SYNC_20MB) | 3169 | if (!((currTar_Info->TarStatus & TAR_SYNC_MASK) == SYNC_TRYING)) { |
3389 | 3170 | ||
3390 | WRW_HARPOON((port+SYNC_MSGS+6), (MPM_OP+AMSG_OUT+ 12)); | 3171 | WRW_HARPOON((port + ID_MSG_STRT), |
3172 | (MPM_OP + AMSG_OUT + | ||
3173 | (currSCCB-> | ||
3174 | Sccb_idmsg & ~(unsigned char)DISC_PRIV))); | ||
3391 | 3175 | ||
3392 | else if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == EE_SYNC_10MB) | 3176 | WRW_HARPOON((port + ID_MSG_STRT + 2), BRH_OP + ALWAYS + CMDPZ); |
3393 | 3177 | ||
3394 | WRW_HARPOON((port+SYNC_MSGS+6), (MPM_OP+AMSG_OUT+ 25)); | 3178 | WRW_HARPOON((port + SYNC_MSGS + 0), |
3179 | (MPM_OP + AMSG_OUT + SMEXT)); | ||
3180 | WRW_HARPOON((port + SYNC_MSGS + 2), (MPM_OP + AMSG_OUT + 0x03)); | ||
3181 | WRW_HARPOON((port + SYNC_MSGS + 4), | ||
3182 | (MPM_OP + AMSG_OUT + SMSYNC)); | ||
3395 | 3183 | ||
3396 | else if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == EE_SYNC_5MB) | 3184 | if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == EE_SYNC_20MB) |
3397 | 3185 | ||
3398 | WRW_HARPOON((port+SYNC_MSGS+6), (MPM_OP+AMSG_OUT+ 50)); | 3186 | WRW_HARPOON((port + SYNC_MSGS + 6), |
3187 | (MPM_OP + AMSG_OUT + 12)); | ||
3399 | 3188 | ||
3400 | else | 3189 | else if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == |
3401 | WRW_HARPOON((port+SYNC_MSGS+6), (MPM_OP+AMSG_OUT+ 00)); | 3190 | EE_SYNC_10MB) |
3402 | 3191 | ||
3192 | WRW_HARPOON((port + SYNC_MSGS + 6), | ||
3193 | (MPM_OP + AMSG_OUT + 25)); | ||
3403 | 3194 | ||
3404 | WRW_HARPOON((port+SYNC_MSGS+8), (RAT_OP )); | 3195 | else if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == |
3405 | WRW_HARPOON((port+SYNC_MSGS+10),(MPM_OP+AMSG_OUT+DEFAULT_OFFSET)); | 3196 | EE_SYNC_5MB) |
3406 | WRW_HARPOON((port+SYNC_MSGS+12),(BRH_OP+ALWAYS+NP )); | ||
3407 | 3197 | ||
3198 | WRW_HARPOON((port + SYNC_MSGS + 6), | ||
3199 | (MPM_OP + AMSG_OUT + 50)); | ||
3408 | 3200 | ||
3409 | if(syncFlag == 0) | ||
3410 | { | ||
3411 | WR_HARPOON(port+hp_autostart_3, (SELECT+SELCHK_STRT)); | ||
3412 | currTar_Info->TarStatus = ((currTar_Info->TarStatus & | ||
3413 | ~(unsigned char)TAR_SYNC_MASK) | (unsigned char)SYNC_TRYING); | ||
3414 | } | ||
3415 | else | 3201 | else |
3416 | { | 3202 | WRW_HARPOON((port + SYNC_MSGS + 6), |
3417 | WR_HARPOON(port+hp_autostart_3, (AUTO_IMMED + CMD_ONLY_STRT)); | 3203 | (MPM_OP + AMSG_OUT + 00)); |
3204 | |||
3205 | WRW_HARPOON((port + SYNC_MSGS + 8), (RAT_OP)); | ||
3206 | WRW_HARPOON((port + SYNC_MSGS + 10), | ||
3207 | (MPM_OP + AMSG_OUT + DEFAULT_OFFSET)); | ||
3208 | WRW_HARPOON((port + SYNC_MSGS + 12), (BRH_OP + ALWAYS + NP)); | ||
3209 | |||
3210 | if (syncFlag == 0) { | ||
3211 | WR_HARPOON(port + hp_autostart_3, | ||
3212 | (SELECT + SELCHK_STRT)); | ||
3213 | currTar_Info->TarStatus = | ||
3214 | ((currTar_Info-> | ||
3215 | TarStatus & ~(unsigned char)TAR_SYNC_MASK) | | ||
3216 | (unsigned char)SYNC_TRYING); | ||
3217 | } else { | ||
3218 | WR_HARPOON(port + hp_autostart_3, | ||
3219 | (AUTO_IMMED + CMD_ONLY_STRT)); | ||
3418 | } | 3220 | } |
3419 | 3221 | ||
3222 | return (1); | ||
3223 | } | ||
3420 | 3224 | ||
3421 | return(1); | 3225 | else { |
3422 | } | ||
3423 | |||
3424 | else { | ||
3425 | 3226 | ||
3426 | currTar_Info->TarStatus |= (unsigned char)SYNC_SUPPORTED; | 3227 | currTar_Info->TarStatus |= (unsigned char)SYNC_SUPPORTED; |
3427 | currTar_Info->TarEEValue &= ~EE_SYNC_MASK; | 3228 | currTar_Info->TarEEValue &= ~EE_SYNC_MASK; |
3428 | return(0); | 3229 | return (0); |
3429 | } | 3230 | } |
3430 | } | 3231 | } |
3431 | 3232 | ||
3432 | |||
3433 | |||
3434 | /*--------------------------------------------------------------------- | 3233 | /*--------------------------------------------------------------------- |
3435 | * | 3234 | * |
3436 | * Function: FPT_stsyncn | 3235 | * Function: FPT_stsyncn |
@@ -3441,129 +3240,126 @@ static unsigned char FPT_sisyncn(unsigned long port, unsigned char p_card, unsig | |||
3441 | *---------------------------------------------------------------------*/ | 3240 | *---------------------------------------------------------------------*/ |
3442 | static void FPT_stsyncn(unsigned long port, unsigned char p_card) | 3241 | static void FPT_stsyncn(unsigned long port, unsigned char p_card) |
3443 | { | 3242 | { |
3444 | unsigned char sync_msg,offset,sync_reg,our_sync_msg; | 3243 | unsigned char sync_msg, offset, sync_reg, our_sync_msg; |
3445 | struct sccb * currSCCB; | 3244 | struct sccb *currSCCB; |
3446 | struct sccb_mgr_tar_info * currTar_Info; | 3245 | struct sccb_mgr_tar_info *currTar_Info; |
3447 | 3246 | ||
3448 | currSCCB = FPT_BL_Card[p_card].currentSCCB; | 3247 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
3449 | currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID]; | 3248 | currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID]; |
3450 | 3249 | ||
3451 | sync_msg = FPT_sfm(port,currSCCB); | 3250 | sync_msg = FPT_sfm(port, currSCCB); |
3452 | 3251 | ||
3453 | if((sync_msg == 0x00) && (currSCCB->Sccb_scsimsg == SMPARITY)) | 3252 | if ((sync_msg == 0x00) && (currSCCB->Sccb_scsimsg == SMPARITY)) { |
3454 | { | 3253 | WR_HARPOON(port + hp_autostart_1, |
3455 | WR_HARPOON(port+hp_autostart_1, (AUTO_IMMED+DISCONNECT_START)); | 3254 | (AUTO_IMMED + DISCONNECT_START)); |
3456 | return; | 3255 | return; |
3457 | } | 3256 | } |
3458 | 3257 | ||
3459 | ACCEPT_MSG(port); | 3258 | ACCEPT_MSG(port); |
3460 | |||
3461 | 3259 | ||
3462 | offset = FPT_sfm(port,currSCCB); | 3260 | offset = FPT_sfm(port, currSCCB); |
3463 | 3261 | ||
3464 | if((offset == 0x00) && (currSCCB->Sccb_scsimsg == SMPARITY)) | 3262 | if ((offset == 0x00) && (currSCCB->Sccb_scsimsg == SMPARITY)) { |
3465 | { | 3263 | WR_HARPOON(port + hp_autostart_1, |
3466 | WR_HARPOON(port+hp_autostart_1, (AUTO_IMMED+DISCONNECT_START)); | 3264 | (AUTO_IMMED + DISCONNECT_START)); |
3467 | return; | 3265 | return; |
3468 | } | 3266 | } |
3469 | 3267 | ||
3470 | if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == EE_SYNC_20MB) | 3268 | if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == EE_SYNC_20MB) |
3471 | |||
3472 | our_sync_msg = 12; /* Setup our Message to 20mb/s */ | ||
3473 | 3269 | ||
3474 | else if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == EE_SYNC_10MB) | 3270 | our_sync_msg = 12; /* Setup our Message to 20mb/s */ |
3475 | 3271 | ||
3476 | our_sync_msg = 25; /* Setup our Message to 10mb/s */ | 3272 | else if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == EE_SYNC_10MB) |
3477 | 3273 | ||
3478 | else if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == EE_SYNC_5MB) | 3274 | our_sync_msg = 25; /* Setup our Message to 10mb/s */ |
3479 | 3275 | ||
3480 | our_sync_msg = 50; /* Setup our Message to 5mb/s */ | 3276 | else if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == EE_SYNC_5MB) |
3481 | else | ||
3482 | |||
3483 | our_sync_msg = 0; /* Message = Async */ | ||
3484 | |||
3485 | if (sync_msg < our_sync_msg) { | ||
3486 | sync_msg = our_sync_msg; /*if faster, then set to max. */ | ||
3487 | } | ||
3488 | |||
3489 | if (offset == ASYNC) | ||
3490 | sync_msg = ASYNC; | ||
3491 | 3277 | ||
3492 | if (offset > MAX_OFFSET) | 3278 | our_sync_msg = 50; /* Setup our Message to 5mb/s */ |
3493 | offset = MAX_OFFSET; | 3279 | else |
3494 | 3280 | ||
3495 | sync_reg = 0x00; | 3281 | our_sync_msg = 0; /* Message = Async */ |
3496 | 3282 | ||
3497 | if (sync_msg > 12) | 3283 | if (sync_msg < our_sync_msg) { |
3284 | sync_msg = our_sync_msg; /*if faster, then set to max. */ | ||
3285 | } | ||
3498 | 3286 | ||
3499 | sync_reg = 0x20; /* Use 10MB/s */ | 3287 | if (offset == ASYNC) |
3288 | sync_msg = ASYNC; | ||
3500 | 3289 | ||
3501 | if (sync_msg > 25) | 3290 | if (offset > MAX_OFFSET) |
3291 | offset = MAX_OFFSET; | ||
3502 | 3292 | ||
3503 | sync_reg = 0x40; /* Use 6.6MB/s */ | 3293 | sync_reg = 0x00; |
3504 | 3294 | ||
3505 | if (sync_msg > 38) | 3295 | if (sync_msg > 12) |
3506 | 3296 | ||
3507 | sync_reg = 0x60; /* Use 5MB/s */ | 3297 | sync_reg = 0x20; /* Use 10MB/s */ |
3508 | 3298 | ||
3509 | if (sync_msg > 50) | 3299 | if (sync_msg > 25) |
3510 | 3300 | ||
3511 | sync_reg = 0x80; /* Use 4MB/s */ | 3301 | sync_reg = 0x40; /* Use 6.6MB/s */ |
3512 | 3302 | ||
3513 | if (sync_msg > 62) | 3303 | if (sync_msg > 38) |
3514 | 3304 | ||
3515 | sync_reg = 0xA0; /* Use 3.33MB/s */ | 3305 | sync_reg = 0x60; /* Use 5MB/s */ |
3516 | 3306 | ||
3517 | if (sync_msg > 75) | 3307 | if (sync_msg > 50) |
3518 | 3308 | ||
3519 | sync_reg = 0xC0; /* Use 2.85MB/s */ | 3309 | sync_reg = 0x80; /* Use 4MB/s */ |
3520 | 3310 | ||
3521 | if (sync_msg > 87) | 3311 | if (sync_msg > 62) |
3522 | 3312 | ||
3523 | sync_reg = 0xE0; /* Use 2.5MB/s */ | 3313 | sync_reg = 0xA0; /* Use 3.33MB/s */ |
3524 | 3314 | ||
3525 | if (sync_msg > 100) { | 3315 | if (sync_msg > 75) |
3526 | 3316 | ||
3527 | sync_reg = 0x00; /* Use ASYNC */ | 3317 | sync_reg = 0xC0; /* Use 2.85MB/s */ |
3528 | offset = 0x00; | ||
3529 | } | ||
3530 | 3318 | ||
3319 | if (sync_msg > 87) | ||
3531 | 3320 | ||
3532 | if (currTar_Info->TarStatus & WIDE_ENABLED) | 3321 | sync_reg = 0xE0; /* Use 2.5MB/s */ |
3533 | 3322 | ||
3534 | sync_reg |= offset; | 3323 | if (sync_msg > 100) { |
3535 | 3324 | ||
3536 | else | 3325 | sync_reg = 0x00; /* Use ASYNC */ |
3326 | offset = 0x00; | ||
3327 | } | ||
3537 | 3328 | ||
3538 | sync_reg |= (offset | NARROW_SCSI); | 3329 | if (currTar_Info->TarStatus & WIDE_ENABLED) |
3539 | 3330 | ||
3540 | FPT_sssyncv(port,currSCCB->TargID,sync_reg,currTar_Info); | 3331 | sync_reg |= offset; |
3541 | 3332 | ||
3333 | else | ||
3542 | 3334 | ||
3543 | if (currSCCB->Sccb_scsistat == SELECT_SN_ST) { | 3335 | sync_reg |= (offset | NARROW_SCSI); |
3544 | 3336 | ||
3337 | FPT_sssyncv(port, currSCCB->TargID, sync_reg, currTar_Info); | ||
3545 | 3338 | ||
3546 | ACCEPT_MSG(port); | 3339 | if (currSCCB->Sccb_scsistat == SELECT_SN_ST) { |
3547 | 3340 | ||
3548 | currTar_Info->TarStatus = ((currTar_Info->TarStatus & | 3341 | ACCEPT_MSG(port); |
3549 | ~(unsigned char)TAR_SYNC_MASK) | (unsigned char)SYNC_SUPPORTED); | ||
3550 | 3342 | ||
3551 | WR_HARPOON(port+hp_autostart_1, (AUTO_IMMED+DISCONNECT_START)); | 3343 | currTar_Info->TarStatus = ((currTar_Info->TarStatus & |
3552 | } | 3344 | ~(unsigned char)TAR_SYNC_MASK) | |
3345 | (unsigned char)SYNC_SUPPORTED); | ||
3553 | 3346 | ||
3554 | else { | 3347 | WR_HARPOON(port + hp_autostart_1, |
3348 | (AUTO_IMMED + DISCONNECT_START)); | ||
3349 | } | ||
3555 | 3350 | ||
3351 | else { | ||
3556 | 3352 | ||
3557 | ACCEPT_MSG_ATN(port); | 3353 | ACCEPT_MSG_ATN(port); |
3558 | 3354 | ||
3559 | FPT_sisyncr(port,sync_msg,offset); | 3355 | FPT_sisyncr(port, sync_msg, offset); |
3560 | 3356 | ||
3561 | currTar_Info->TarStatus = ((currTar_Info->TarStatus & | 3357 | currTar_Info->TarStatus = ((currTar_Info->TarStatus & |
3562 | ~(unsigned char)TAR_SYNC_MASK) | (unsigned char)SYNC_SUPPORTED); | 3358 | ~(unsigned char)TAR_SYNC_MASK) | |
3563 | } | 3359 | (unsigned char)SYNC_SUPPORTED); |
3360 | } | ||
3564 | } | 3361 | } |
3565 | 3362 | ||
3566 | |||
3567 | /*--------------------------------------------------------------------- | 3363 | /*--------------------------------------------------------------------- |
3568 | * | 3364 | * |
3569 | * Function: FPT_sisyncr | 3365 | * Function: FPT_sisyncr |
@@ -3571,28 +3367,28 @@ static void FPT_stsyncn(unsigned long port, unsigned char p_card) | |||
3571 | * Description: Answer the targets sync message. | 3367 | * Description: Answer the targets sync message. |
3572 | * | 3368 | * |
3573 | *---------------------------------------------------------------------*/ | 3369 | *---------------------------------------------------------------------*/ |
3574 | static void FPT_sisyncr(unsigned long port,unsigned char sync_pulse, unsigned char offset) | 3370 | static void FPT_sisyncr(unsigned long port, unsigned char sync_pulse, |
3371 | unsigned char offset) | ||
3575 | { | 3372 | { |
3576 | ARAM_ACCESS(port); | 3373 | ARAM_ACCESS(port); |
3577 | WRW_HARPOON((port+SYNC_MSGS+0), (MPM_OP+AMSG_OUT+SMEXT )); | 3374 | WRW_HARPOON((port + SYNC_MSGS + 0), (MPM_OP + AMSG_OUT + SMEXT)); |
3578 | WRW_HARPOON((port+SYNC_MSGS+2), (MPM_OP+AMSG_OUT+0x03 )); | 3375 | WRW_HARPOON((port + SYNC_MSGS + 2), (MPM_OP + AMSG_OUT + 0x03)); |
3579 | WRW_HARPOON((port+SYNC_MSGS+4), (MPM_OP+AMSG_OUT+SMSYNC)); | 3376 | WRW_HARPOON((port + SYNC_MSGS + 4), (MPM_OP + AMSG_OUT + SMSYNC)); |
3580 | WRW_HARPOON((port+SYNC_MSGS+6), (MPM_OP+AMSG_OUT+sync_pulse)); | 3377 | WRW_HARPOON((port + SYNC_MSGS + 6), (MPM_OP + AMSG_OUT + sync_pulse)); |
3581 | WRW_HARPOON((port+SYNC_MSGS+8), (RAT_OP )); | 3378 | WRW_HARPOON((port + SYNC_MSGS + 8), (RAT_OP)); |
3582 | WRW_HARPOON((port+SYNC_MSGS+10),(MPM_OP+AMSG_OUT+offset)); | 3379 | WRW_HARPOON((port + SYNC_MSGS + 10), (MPM_OP + AMSG_OUT + offset)); |
3583 | WRW_HARPOON((port+SYNC_MSGS+12),(BRH_OP+ALWAYS+NP )); | 3380 | WRW_HARPOON((port + SYNC_MSGS + 12), (BRH_OP + ALWAYS + NP)); |
3584 | SGRAM_ACCESS(port); | 3381 | SGRAM_ACCESS(port); |
3585 | 3382 | ||
3586 | WR_HARPOON(port+hp_portctrl_0, SCSI_PORT); | 3383 | WR_HARPOON(port + hp_portctrl_0, SCSI_PORT); |
3587 | WRW_HARPOON((port+hp_intstat), CLR_ALL_INT_1); | 3384 | WRW_HARPOON((port + hp_intstat), CLR_ALL_INT_1); |
3588 | 3385 | ||
3589 | WR_HARPOON(port+hp_autostart_3, (AUTO_IMMED+CMD_ONLY_STRT)); | 3386 | WR_HARPOON(port + hp_autostart_3, (AUTO_IMMED + CMD_ONLY_STRT)); |
3590 | 3387 | ||
3591 | while (!(RDW_HARPOON((port+hp_intstat)) & (BUS_FREE | AUTO_INT))) {} | 3388 | while (!(RDW_HARPOON((port + hp_intstat)) & (BUS_FREE | AUTO_INT))) { |
3389 | } | ||
3592 | } | 3390 | } |
3593 | 3391 | ||
3594 | |||
3595 | |||
3596 | /*--------------------------------------------------------------------- | 3392 | /*--------------------------------------------------------------------- |
3597 | * | 3393 | * |
3598 | * Function: FPT_siwidn | 3394 | * Function: FPT_siwidn |
@@ -3604,48 +3400,51 @@ static void FPT_sisyncr(unsigned long port,unsigned char sync_pulse, unsigned ch | |||
3604 | 3400 | ||
3605 | static unsigned char FPT_siwidn(unsigned long port, unsigned char p_card) | 3401 | static unsigned char FPT_siwidn(unsigned long port, unsigned char p_card) |
3606 | { | 3402 | { |
3607 | struct sccb * currSCCB; | 3403 | struct sccb *currSCCB; |
3608 | struct sccb_mgr_tar_info * currTar_Info; | 3404 | struct sccb_mgr_tar_info *currTar_Info; |
3609 | |||
3610 | currSCCB = FPT_BL_Card[p_card].currentSCCB; | ||
3611 | currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID]; | ||
3612 | |||
3613 | if (!((currTar_Info->TarStatus & TAR_WIDE_MASK) == WIDE_NEGOCIATED)) { | ||
3614 | 3405 | ||
3406 | currSCCB = FPT_BL_Card[p_card].currentSCCB; | ||
3407 | currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID]; | ||
3615 | 3408 | ||
3616 | WRW_HARPOON((port+ID_MSG_STRT), | 3409 | if (!((currTar_Info->TarStatus & TAR_WIDE_MASK) == WIDE_NEGOCIATED)) { |
3617 | (MPM_OP+AMSG_OUT+(currSCCB->Sccb_idmsg & ~(unsigned char)DISC_PRIV))); | ||
3618 | 3410 | ||
3619 | WRW_HARPOON((port+ID_MSG_STRT+2),BRH_OP+ALWAYS+CMDPZ); | 3411 | WRW_HARPOON((port + ID_MSG_STRT), |
3412 | (MPM_OP + AMSG_OUT + | ||
3413 | (currSCCB-> | ||
3414 | Sccb_idmsg & ~(unsigned char)DISC_PRIV))); | ||
3620 | 3415 | ||
3621 | WRW_HARPOON((port+SYNC_MSGS+0), (MPM_OP+AMSG_OUT+SMEXT )); | 3416 | WRW_HARPOON((port + ID_MSG_STRT + 2), BRH_OP + ALWAYS + CMDPZ); |
3622 | WRW_HARPOON((port+SYNC_MSGS+2), (MPM_OP+AMSG_OUT+0x02 )); | ||
3623 | WRW_HARPOON((port+SYNC_MSGS+4), (MPM_OP+AMSG_OUT+SMWDTR)); | ||
3624 | WRW_HARPOON((port+SYNC_MSGS+6), (RAT_OP )); | ||
3625 | WRW_HARPOON((port+SYNC_MSGS+8), (MPM_OP+AMSG_OUT+ SM16BIT)); | ||
3626 | WRW_HARPOON((port+SYNC_MSGS+10),(BRH_OP+ALWAYS+NP )); | ||
3627 | 3417 | ||
3628 | WR_HARPOON(port+hp_autostart_3, (SELECT+SELCHK_STRT)); | 3418 | WRW_HARPOON((port + SYNC_MSGS + 0), |
3419 | (MPM_OP + AMSG_OUT + SMEXT)); | ||
3420 | WRW_HARPOON((port + SYNC_MSGS + 2), (MPM_OP + AMSG_OUT + 0x02)); | ||
3421 | WRW_HARPOON((port + SYNC_MSGS + 4), | ||
3422 | (MPM_OP + AMSG_OUT + SMWDTR)); | ||
3423 | WRW_HARPOON((port + SYNC_MSGS + 6), (RAT_OP)); | ||
3424 | WRW_HARPOON((port + SYNC_MSGS + 8), | ||
3425 | (MPM_OP + AMSG_OUT + SM16BIT)); | ||
3426 | WRW_HARPOON((port + SYNC_MSGS + 10), (BRH_OP + ALWAYS + NP)); | ||
3629 | 3427 | ||
3428 | WR_HARPOON(port + hp_autostart_3, (SELECT + SELCHK_STRT)); | ||
3630 | 3429 | ||
3631 | currTar_Info->TarStatus = ((currTar_Info->TarStatus & | 3430 | currTar_Info->TarStatus = ((currTar_Info->TarStatus & |
3632 | ~(unsigned char)TAR_WIDE_MASK) | (unsigned char)WIDE_ENABLED); | 3431 | ~(unsigned char)TAR_WIDE_MASK) | |
3432 | (unsigned char)WIDE_ENABLED); | ||
3633 | 3433 | ||
3634 | return(1); | 3434 | return (1); |
3635 | } | 3435 | } |
3636 | 3436 | ||
3637 | else { | 3437 | else { |
3638 | 3438 | ||
3639 | currTar_Info->TarStatus = ((currTar_Info->TarStatus & | 3439 | currTar_Info->TarStatus = ((currTar_Info->TarStatus & |
3640 | ~(unsigned char)TAR_WIDE_MASK) | WIDE_NEGOCIATED); | 3440 | ~(unsigned char)TAR_WIDE_MASK) | |
3441 | WIDE_NEGOCIATED); | ||
3641 | 3442 | ||
3642 | currTar_Info->TarEEValue &= ~EE_WIDE_SCSI; | 3443 | currTar_Info->TarEEValue &= ~EE_WIDE_SCSI; |
3643 | return(0); | 3444 | return (0); |
3644 | } | 3445 | } |
3645 | } | 3446 | } |
3646 | 3447 | ||
3647 | |||
3648 | |||
3649 | /*--------------------------------------------------------------------- | 3448 | /*--------------------------------------------------------------------- |
3650 | * | 3449 | * |
3651 | * Function: FPT_stwidn | 3450 | * Function: FPT_stwidn |
@@ -3656,77 +3455,68 @@ static unsigned char FPT_siwidn(unsigned long port, unsigned char p_card) | |||
3656 | *---------------------------------------------------------------------*/ | 3455 | *---------------------------------------------------------------------*/ |
3657 | static void FPT_stwidn(unsigned long port, unsigned char p_card) | 3456 | static void FPT_stwidn(unsigned long port, unsigned char p_card) |
3658 | { | 3457 | { |
3659 | unsigned char width; | 3458 | unsigned char width; |
3660 | struct sccb * currSCCB; | 3459 | struct sccb *currSCCB; |
3661 | struct sccb_mgr_tar_info * currTar_Info; | 3460 | struct sccb_mgr_tar_info *currTar_Info; |
3662 | 3461 | ||
3663 | currSCCB = FPT_BL_Card[p_card].currentSCCB; | 3462 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
3664 | currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID]; | 3463 | currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID]; |
3665 | 3464 | ||
3666 | width = FPT_sfm(port,currSCCB); | 3465 | width = FPT_sfm(port, currSCCB); |
3667 | 3466 | ||
3668 | if((width == 0x00) && (currSCCB->Sccb_scsimsg == SMPARITY)) | 3467 | if ((width == 0x00) && (currSCCB->Sccb_scsimsg == SMPARITY)) { |
3669 | { | 3468 | WR_HARPOON(port + hp_autostart_1, |
3670 | WR_HARPOON(port+hp_autostart_1, (AUTO_IMMED+DISCONNECT_START)); | 3469 | (AUTO_IMMED + DISCONNECT_START)); |
3671 | return; | 3470 | return; |
3672 | } | 3471 | } |
3673 | 3472 | ||
3473 | if (!(currTar_Info->TarEEValue & EE_WIDE_SCSI)) | ||
3474 | width = 0; | ||
3674 | 3475 | ||
3675 | if (!(currTar_Info->TarEEValue & EE_WIDE_SCSI)) | 3476 | if (width) { |
3676 | width = 0; | 3477 | currTar_Info->TarStatus |= WIDE_ENABLED; |
3677 | 3478 | width = 0; | |
3678 | if (width) { | 3479 | } else { |
3679 | currTar_Info->TarStatus |= WIDE_ENABLED; | 3480 | width = NARROW_SCSI; |
3680 | width = 0; | 3481 | currTar_Info->TarStatus &= ~WIDE_ENABLED; |
3681 | } | 3482 | } |
3682 | else { | ||
3683 | width = NARROW_SCSI; | ||
3684 | currTar_Info->TarStatus &= ~WIDE_ENABLED; | ||
3685 | } | ||
3686 | |||
3687 | |||
3688 | FPT_sssyncv(port,currSCCB->TargID,width,currTar_Info); | ||
3689 | |||
3690 | |||
3691 | if (currSCCB->Sccb_scsistat == SELECT_WN_ST) | ||
3692 | { | ||
3693 | 3483 | ||
3484 | FPT_sssyncv(port, currSCCB->TargID, width, currTar_Info); | ||
3694 | 3485 | ||
3486 | if (currSCCB->Sccb_scsistat == SELECT_WN_ST) { | ||
3695 | 3487 | ||
3696 | currTar_Info->TarStatus |= WIDE_NEGOCIATED; | 3488 | currTar_Info->TarStatus |= WIDE_NEGOCIATED; |
3697 | 3489 | ||
3698 | if (!((currTar_Info->TarStatus & TAR_SYNC_MASK) == SYNC_SUPPORTED)) | 3490 | if (! |
3699 | { | 3491 | ((currTar_Info->TarStatus & TAR_SYNC_MASK) == |
3700 | ACCEPT_MSG_ATN(port); | 3492 | SYNC_SUPPORTED)) { |
3701 | ARAM_ACCESS(port); | 3493 | ACCEPT_MSG_ATN(port); |
3702 | FPT_sisyncn(port,p_card, 1); | 3494 | ARAM_ACCESS(port); |
3703 | currSCCB->Sccb_scsistat = SELECT_SN_ST; | 3495 | FPT_sisyncn(port, p_card, 1); |
3704 | SGRAM_ACCESS(port); | 3496 | currSCCB->Sccb_scsistat = SELECT_SN_ST; |
3705 | } | 3497 | SGRAM_ACCESS(port); |
3706 | else | 3498 | } else { |
3707 | { | 3499 | ACCEPT_MSG(port); |
3708 | ACCEPT_MSG(port); | 3500 | WR_HARPOON(port + hp_autostart_1, |
3709 | WR_HARPOON(port+hp_autostart_1, (AUTO_IMMED+DISCONNECT_START)); | 3501 | (AUTO_IMMED + DISCONNECT_START)); |
3710 | } | 3502 | } |
3711 | } | 3503 | } |
3712 | |||
3713 | else { | ||
3714 | 3504 | ||
3505 | else { | ||
3715 | 3506 | ||
3716 | ACCEPT_MSG_ATN(port); | 3507 | ACCEPT_MSG_ATN(port); |
3717 | 3508 | ||
3718 | if (currTar_Info->TarEEValue & EE_WIDE_SCSI) | 3509 | if (currTar_Info->TarEEValue & EE_WIDE_SCSI) |
3719 | width = SM16BIT; | 3510 | width = SM16BIT; |
3720 | else | 3511 | else |
3721 | width = SM8BIT; | 3512 | width = SM8BIT; |
3722 | 3513 | ||
3723 | FPT_siwidr(port,width); | 3514 | FPT_siwidr(port, width); |
3724 | 3515 | ||
3725 | currTar_Info->TarStatus |= (WIDE_NEGOCIATED | WIDE_ENABLED); | 3516 | currTar_Info->TarStatus |= (WIDE_NEGOCIATED | WIDE_ENABLED); |
3726 | } | 3517 | } |
3727 | } | 3518 | } |
3728 | 3519 | ||
3729 | |||
3730 | /*--------------------------------------------------------------------- | 3520 | /*--------------------------------------------------------------------- |
3731 | * | 3521 | * |
3732 | * Function: FPT_siwidr | 3522 | * Function: FPT_siwidr |
@@ -3736,25 +3526,24 @@ static void FPT_stwidn(unsigned long port, unsigned char p_card) | |||
3736 | *---------------------------------------------------------------------*/ | 3526 | *---------------------------------------------------------------------*/ |
3737 | static void FPT_siwidr(unsigned long port, unsigned char width) | 3527 | static void FPT_siwidr(unsigned long port, unsigned char width) |
3738 | { | 3528 | { |
3739 | ARAM_ACCESS(port); | 3529 | ARAM_ACCESS(port); |
3740 | WRW_HARPOON((port+SYNC_MSGS+0), (MPM_OP+AMSG_OUT+SMEXT )); | 3530 | WRW_HARPOON((port + SYNC_MSGS + 0), (MPM_OP + AMSG_OUT + SMEXT)); |
3741 | WRW_HARPOON((port+SYNC_MSGS+2), (MPM_OP+AMSG_OUT+0x02 )); | 3531 | WRW_HARPOON((port + SYNC_MSGS + 2), (MPM_OP + AMSG_OUT + 0x02)); |
3742 | WRW_HARPOON((port+SYNC_MSGS+4), (MPM_OP+AMSG_OUT+SMWDTR)); | 3532 | WRW_HARPOON((port + SYNC_MSGS + 4), (MPM_OP + AMSG_OUT + SMWDTR)); |
3743 | WRW_HARPOON((port+SYNC_MSGS+6), (RAT_OP )); | 3533 | WRW_HARPOON((port + SYNC_MSGS + 6), (RAT_OP)); |
3744 | WRW_HARPOON((port+SYNC_MSGS+8),(MPM_OP+AMSG_OUT+width)); | 3534 | WRW_HARPOON((port + SYNC_MSGS + 8), (MPM_OP + AMSG_OUT + width)); |
3745 | WRW_HARPOON((port+SYNC_MSGS+10),(BRH_OP+ALWAYS+NP )); | 3535 | WRW_HARPOON((port + SYNC_MSGS + 10), (BRH_OP + ALWAYS + NP)); |
3746 | SGRAM_ACCESS(port); | 3536 | SGRAM_ACCESS(port); |
3747 | 3537 | ||
3748 | WR_HARPOON(port+hp_portctrl_0, SCSI_PORT); | 3538 | WR_HARPOON(port + hp_portctrl_0, SCSI_PORT); |
3749 | WRW_HARPOON((port+hp_intstat), CLR_ALL_INT_1); | 3539 | WRW_HARPOON((port + hp_intstat), CLR_ALL_INT_1); |
3750 | 3540 | ||
3751 | WR_HARPOON(port+hp_autostart_3, (AUTO_IMMED+CMD_ONLY_STRT)); | 3541 | WR_HARPOON(port + hp_autostart_3, (AUTO_IMMED + CMD_ONLY_STRT)); |
3752 | 3542 | ||
3753 | while (!(RDW_HARPOON((port+hp_intstat)) & (BUS_FREE | AUTO_INT))) {} | 3543 | while (!(RDW_HARPOON((port + hp_intstat)) & (BUS_FREE | AUTO_INT))) { |
3544 | } | ||
3754 | } | 3545 | } |
3755 | 3546 | ||
3756 | |||
3757 | |||
3758 | /*--------------------------------------------------------------------- | 3547 | /*--------------------------------------------------------------------- |
3759 | * | 3548 | * |
3760 | * Function: FPT_sssyncv | 3549 | * Function: FPT_sssyncv |
@@ -3763,71 +3552,71 @@ static void FPT_siwidr(unsigned long port, unsigned char width) | |||
3763 | * ID specified. | 3552 | * ID specified. |
3764 | * | 3553 | * |
3765 | *---------------------------------------------------------------------*/ | 3554 | *---------------------------------------------------------------------*/ |
3766 | static void FPT_sssyncv(unsigned long p_port, unsigned char p_id, unsigned char p_sync_value, | 3555 | static void FPT_sssyncv(unsigned long p_port, unsigned char p_id, |
3767 | struct sccb_mgr_tar_info * currTar_Info) | 3556 | unsigned char p_sync_value, |
3557 | struct sccb_mgr_tar_info *currTar_Info) | ||
3768 | { | 3558 | { |
3769 | unsigned char index; | 3559 | unsigned char index; |
3770 | 3560 | ||
3771 | index = p_id; | 3561 | index = p_id; |
3772 | 3562 | ||
3773 | switch (index) { | 3563 | switch (index) { |
3774 | 3564 | ||
3775 | case 0: | 3565 | case 0: |
3776 | index = 12; /* hp_synctarg_0 */ | 3566 | index = 12; /* hp_synctarg_0 */ |
3777 | break; | 3567 | break; |
3778 | case 1: | 3568 | case 1: |
3779 | index = 13; /* hp_synctarg_1 */ | 3569 | index = 13; /* hp_synctarg_1 */ |
3780 | break; | 3570 | break; |
3781 | case 2: | 3571 | case 2: |
3782 | index = 14; /* hp_synctarg_2 */ | 3572 | index = 14; /* hp_synctarg_2 */ |
3783 | break; | 3573 | break; |
3784 | case 3: | 3574 | case 3: |
3785 | index = 15; /* hp_synctarg_3 */ | 3575 | index = 15; /* hp_synctarg_3 */ |
3786 | break; | 3576 | break; |
3787 | case 4: | 3577 | case 4: |
3788 | index = 8; /* hp_synctarg_4 */ | 3578 | index = 8; /* hp_synctarg_4 */ |
3789 | break; | 3579 | break; |
3790 | case 5: | 3580 | case 5: |
3791 | index = 9; /* hp_synctarg_5 */ | 3581 | index = 9; /* hp_synctarg_5 */ |
3792 | break; | 3582 | break; |
3793 | case 6: | 3583 | case 6: |
3794 | index = 10; /* hp_synctarg_6 */ | 3584 | index = 10; /* hp_synctarg_6 */ |
3795 | break; | 3585 | break; |
3796 | case 7: | 3586 | case 7: |
3797 | index = 11; /* hp_synctarg_7 */ | 3587 | index = 11; /* hp_synctarg_7 */ |
3798 | break; | 3588 | break; |
3799 | case 8: | 3589 | case 8: |
3800 | index = 4; /* hp_synctarg_8 */ | 3590 | index = 4; /* hp_synctarg_8 */ |
3801 | break; | 3591 | break; |
3802 | case 9: | 3592 | case 9: |
3803 | index = 5; /* hp_synctarg_9 */ | 3593 | index = 5; /* hp_synctarg_9 */ |
3804 | break; | 3594 | break; |
3805 | case 10: | 3595 | case 10: |
3806 | index = 6; /* hp_synctarg_10 */ | 3596 | index = 6; /* hp_synctarg_10 */ |
3807 | break; | 3597 | break; |
3808 | case 11: | 3598 | case 11: |
3809 | index = 7; /* hp_synctarg_11 */ | 3599 | index = 7; /* hp_synctarg_11 */ |
3810 | break; | 3600 | break; |
3811 | case 12: | 3601 | case 12: |
3812 | index = 0; /* hp_synctarg_12 */ | 3602 | index = 0; /* hp_synctarg_12 */ |
3813 | break; | 3603 | break; |
3814 | case 13: | 3604 | case 13: |
3815 | index = 1; /* hp_synctarg_13 */ | 3605 | index = 1; /* hp_synctarg_13 */ |
3816 | break; | 3606 | break; |
3817 | case 14: | 3607 | case 14: |
3818 | index = 2; /* hp_synctarg_14 */ | 3608 | index = 2; /* hp_synctarg_14 */ |
3819 | break; | 3609 | break; |
3820 | case 15: | 3610 | case 15: |
3821 | index = 3; /* hp_synctarg_15 */ | 3611 | index = 3; /* hp_synctarg_15 */ |
3822 | 3612 | ||
3823 | } | 3613 | } |
3824 | 3614 | ||
3825 | WR_HARPOON(p_port+hp_synctarg_base+index, p_sync_value); | 3615 | WR_HARPOON(p_port + hp_synctarg_base + index, p_sync_value); |
3826 | 3616 | ||
3827 | currTar_Info->TarSyncCtrl = p_sync_value; | 3617 | currTar_Info->TarSyncCtrl = p_sync_value; |
3828 | } | 3618 | } |
3829 | 3619 | ||
3830 | |||
3831 | /*--------------------------------------------------------------------- | 3620 | /*--------------------------------------------------------------------- |
3832 | * | 3621 | * |
3833 | * Function: FPT_sresb | 3622 | * Function: FPT_sresb |
@@ -3837,67 +3626,65 @@ static void FPT_sssyncv(unsigned long p_port, unsigned char p_id, unsigned char | |||
3837 | *---------------------------------------------------------------------*/ | 3626 | *---------------------------------------------------------------------*/ |
3838 | static void FPT_sresb(unsigned long port, unsigned char p_card) | 3627 | static void FPT_sresb(unsigned long port, unsigned char p_card) |
3839 | { | 3628 | { |
3840 | unsigned char scsiID, i; | 3629 | unsigned char scsiID, i; |
3841 | 3630 | ||
3842 | struct sccb_mgr_tar_info * currTar_Info; | 3631 | struct sccb_mgr_tar_info *currTar_Info; |
3843 | 3632 | ||
3844 | WR_HARPOON(port+hp_page_ctrl, | 3633 | WR_HARPOON(port + hp_page_ctrl, |
3845 | (RD_HARPOON(port+hp_page_ctrl) | G_INT_DISABLE)); | 3634 | (RD_HARPOON(port + hp_page_ctrl) | G_INT_DISABLE)); |
3846 | WRW_HARPOON((port+hp_intstat), CLR_ALL_INT); | 3635 | WRW_HARPOON((port + hp_intstat), CLR_ALL_INT); |
3847 | 3636 | ||
3848 | WR_HARPOON(port+hp_scsictrl_0, SCSI_RST); | 3637 | WR_HARPOON(port + hp_scsictrl_0, SCSI_RST); |
3849 | 3638 | ||
3850 | scsiID = RD_HARPOON(port+hp_seltimeout); | 3639 | scsiID = RD_HARPOON(port + hp_seltimeout); |
3851 | WR_HARPOON(port+hp_seltimeout,TO_5ms); | 3640 | WR_HARPOON(port + hp_seltimeout, TO_5ms); |
3852 | WRW_HARPOON((port+hp_intstat), TIMEOUT); | 3641 | WRW_HARPOON((port + hp_intstat), TIMEOUT); |
3853 | 3642 | ||
3854 | WR_HARPOON(port+hp_portctrl_0,(SCSI_PORT | START_TO)); | 3643 | WR_HARPOON(port + hp_portctrl_0, (SCSI_PORT | START_TO)); |
3855 | 3644 | ||
3856 | while (!(RDW_HARPOON((port+hp_intstat)) & TIMEOUT)) {} | 3645 | while (!(RDW_HARPOON((port + hp_intstat)) & TIMEOUT)) { |
3646 | } | ||
3857 | 3647 | ||
3858 | WR_HARPOON(port+hp_seltimeout,scsiID); | 3648 | WR_HARPOON(port + hp_seltimeout, scsiID); |
3859 | 3649 | ||
3860 | WR_HARPOON(port+hp_scsictrl_0, ENA_SCAM_SEL); | 3650 | WR_HARPOON(port + hp_scsictrl_0, ENA_SCAM_SEL); |
3861 | 3651 | ||
3862 | FPT_Wait(port, TO_5ms); | 3652 | FPT_Wait(port, TO_5ms); |
3863 | 3653 | ||
3864 | WRW_HARPOON((port+hp_intstat), CLR_ALL_INT); | 3654 | WRW_HARPOON((port + hp_intstat), CLR_ALL_INT); |
3865 | 3655 | ||
3866 | WR_HARPOON(port+hp_int_mask, (RD_HARPOON(port+hp_int_mask) | 0x00)); | 3656 | WR_HARPOON(port + hp_int_mask, (RD_HARPOON(port + hp_int_mask) | 0x00)); |
3867 | 3657 | ||
3868 | for (scsiID = 0; scsiID < MAX_SCSI_TAR; scsiID++) | 3658 | for (scsiID = 0; scsiID < MAX_SCSI_TAR; scsiID++) { |
3869 | { | 3659 | currTar_Info = &FPT_sccbMgrTbl[p_card][scsiID]; |
3870 | currTar_Info = &FPT_sccbMgrTbl[p_card][scsiID]; | ||
3871 | 3660 | ||
3872 | if (currTar_Info->TarEEValue & EE_SYNC_MASK) | 3661 | if (currTar_Info->TarEEValue & EE_SYNC_MASK) { |
3873 | { | 3662 | currTar_Info->TarSyncCtrl = 0; |
3874 | currTar_Info->TarSyncCtrl = 0; | 3663 | currTar_Info->TarStatus &= ~TAR_SYNC_MASK; |
3875 | currTar_Info->TarStatus &= ~TAR_SYNC_MASK; | 3664 | } |
3876 | } | ||
3877 | 3665 | ||
3878 | if (currTar_Info->TarEEValue & EE_WIDE_SCSI) | 3666 | if (currTar_Info->TarEEValue & EE_WIDE_SCSI) { |
3879 | { | 3667 | currTar_Info->TarStatus &= ~TAR_WIDE_MASK; |
3880 | currTar_Info->TarStatus &= ~TAR_WIDE_MASK; | 3668 | } |
3881 | } | ||
3882 | 3669 | ||
3883 | FPT_sssyncv(port, scsiID, NARROW_SCSI,currTar_Info); | 3670 | FPT_sssyncv(port, scsiID, NARROW_SCSI, currTar_Info); |
3884 | 3671 | ||
3885 | FPT_SccbMgrTableInitTarget(p_card, scsiID); | 3672 | FPT_SccbMgrTableInitTarget(p_card, scsiID); |
3886 | } | 3673 | } |
3887 | 3674 | ||
3888 | FPT_BL_Card[p_card].scanIndex = 0x00; | 3675 | FPT_BL_Card[p_card].scanIndex = 0x00; |
3889 | FPT_BL_Card[p_card].currentSCCB = NULL; | 3676 | FPT_BL_Card[p_card].currentSCCB = NULL; |
3890 | FPT_BL_Card[p_card].globalFlags &= ~(F_TAG_STARTED | F_HOST_XFER_ACT | 3677 | FPT_BL_Card[p_card].globalFlags &= ~(F_TAG_STARTED | F_HOST_XFER_ACT |
3891 | | F_NEW_SCCB_CMD); | 3678 | | F_NEW_SCCB_CMD); |
3892 | FPT_BL_Card[p_card].cmdCounter = 0x00; | 3679 | FPT_BL_Card[p_card].cmdCounter = 0x00; |
3893 | FPT_BL_Card[p_card].discQCount = 0x00; | 3680 | FPT_BL_Card[p_card].discQCount = 0x00; |
3894 | FPT_BL_Card[p_card].tagQ_Lst = 0x01; | 3681 | FPT_BL_Card[p_card].tagQ_Lst = 0x01; |
3895 | 3682 | ||
3896 | for(i = 0; i < QUEUE_DEPTH; i++) | 3683 | for (i = 0; i < QUEUE_DEPTH; i++) |
3897 | FPT_BL_Card[p_card].discQ_Tbl[i] = NULL; | 3684 | FPT_BL_Card[p_card].discQ_Tbl[i] = NULL; |
3898 | 3685 | ||
3899 | WR_HARPOON(port+hp_page_ctrl, | 3686 | WR_HARPOON(port + hp_page_ctrl, |
3900 | (RD_HARPOON(port+hp_page_ctrl) & ~G_INT_DISABLE)); | 3687 | (RD_HARPOON(port + hp_page_ctrl) & ~G_INT_DISABLE)); |
3901 | 3688 | ||
3902 | } | 3689 | } |
3903 | 3690 | ||
@@ -3908,46 +3695,43 @@ static void FPT_sresb(unsigned long port, unsigned char p_card) | |||
3908 | * Description: Setup for the Auto Sense command. | 3695 | * Description: Setup for the Auto Sense command. |
3909 | * | 3696 | * |
3910 | *---------------------------------------------------------------------*/ | 3697 | *---------------------------------------------------------------------*/ |
3911 | static void FPT_ssenss(struct sccb_card * pCurrCard) | 3698 | static void FPT_ssenss(struct sccb_card *pCurrCard) |
3912 | { | 3699 | { |
3913 | unsigned char i; | 3700 | unsigned char i; |
3914 | struct sccb * currSCCB; | 3701 | struct sccb *currSCCB; |
3915 | |||
3916 | currSCCB = pCurrCard->currentSCCB; | ||
3917 | 3702 | ||
3703 | currSCCB = pCurrCard->currentSCCB; | ||
3918 | 3704 | ||
3919 | currSCCB->Save_CdbLen = currSCCB->CdbLength; | 3705 | currSCCB->Save_CdbLen = currSCCB->CdbLength; |
3920 | 3706 | ||
3921 | for (i = 0; i < 6; i++) { | 3707 | for (i = 0; i < 6; i++) { |
3922 | 3708 | ||
3923 | currSCCB->Save_Cdb[i] = currSCCB->Cdb[i]; | 3709 | currSCCB->Save_Cdb[i] = currSCCB->Cdb[i]; |
3924 | } | 3710 | } |
3925 | 3711 | ||
3926 | currSCCB->CdbLength = SIX_BYTE_CMD; | 3712 | currSCCB->CdbLength = SIX_BYTE_CMD; |
3927 | currSCCB->Cdb[0] = SCSI_REQUEST_SENSE; | 3713 | currSCCB->Cdb[0] = SCSI_REQUEST_SENSE; |
3928 | currSCCB->Cdb[1] = currSCCB->Cdb[1] & (unsigned char)0xE0; /*Keep LUN. */ | 3714 | currSCCB->Cdb[1] = currSCCB->Cdb[1] & (unsigned char)0xE0; /*Keep LUN. */ |
3929 | currSCCB->Cdb[2] = 0x00; | 3715 | currSCCB->Cdb[2] = 0x00; |
3930 | currSCCB->Cdb[3] = 0x00; | 3716 | currSCCB->Cdb[3] = 0x00; |
3931 | currSCCB->Cdb[4] = currSCCB->RequestSenseLength; | 3717 | currSCCB->Cdb[4] = currSCCB->RequestSenseLength; |
3932 | currSCCB->Cdb[5] = 0x00; | 3718 | currSCCB->Cdb[5] = 0x00; |
3933 | 3719 | ||
3934 | currSCCB->Sccb_XferCnt = (unsigned long)currSCCB->RequestSenseLength; | 3720 | currSCCB->Sccb_XferCnt = (unsigned long)currSCCB->RequestSenseLength; |
3935 | 3721 | ||
3936 | currSCCB->Sccb_ATC = 0x00; | 3722 | currSCCB->Sccb_ATC = 0x00; |
3937 | 3723 | ||
3938 | currSCCB->Sccb_XferState |= F_AUTO_SENSE; | 3724 | currSCCB->Sccb_XferState |= F_AUTO_SENSE; |
3939 | 3725 | ||
3940 | currSCCB->Sccb_XferState &= ~F_SG_XFER; | 3726 | currSCCB->Sccb_XferState &= ~F_SG_XFER; |
3941 | 3727 | ||
3942 | currSCCB->Sccb_idmsg = currSCCB->Sccb_idmsg & ~(unsigned char)DISC_PRIV; | 3728 | currSCCB->Sccb_idmsg = currSCCB->Sccb_idmsg & ~(unsigned char)DISC_PRIV; |
3943 | 3729 | ||
3944 | currSCCB->ControlByte = 0x00; | 3730 | currSCCB->ControlByte = 0x00; |
3945 | 3731 | ||
3946 | currSCCB->Sccb_MGRFlags &= F_STATUSLOADED; | 3732 | currSCCB->Sccb_MGRFlags &= F_STATUSLOADED; |
3947 | } | 3733 | } |
3948 | 3734 | ||
3949 | |||
3950 | |||
3951 | /*--------------------------------------------------------------------- | 3735 | /*--------------------------------------------------------------------- |
3952 | * | 3736 | * |
3953 | * Function: FPT_sxfrp | 3737 | * Function: FPT_sxfrp |
@@ -3959,77 +3743,77 @@ static void FPT_ssenss(struct sccb_card * pCurrCard) | |||
3959 | 3743 | ||
3960 | static void FPT_sxfrp(unsigned long p_port, unsigned char p_card) | 3744 | static void FPT_sxfrp(unsigned long p_port, unsigned char p_card) |
3961 | { | 3745 | { |
3962 | unsigned char curr_phz; | 3746 | unsigned char curr_phz; |
3963 | 3747 | ||
3748 | DISABLE_AUTO(p_port); | ||
3964 | 3749 | ||
3965 | DISABLE_AUTO(p_port); | 3750 | if (FPT_BL_Card[p_card].globalFlags & F_HOST_XFER_ACT) { |
3966 | 3751 | ||
3967 | if (FPT_BL_Card[p_card].globalFlags & F_HOST_XFER_ACT) { | 3752 | FPT_hostDataXferAbort(p_port, p_card, |
3753 | FPT_BL_Card[p_card].currentSCCB); | ||
3968 | 3754 | ||
3969 | FPT_hostDataXferAbort(p_port,p_card,FPT_BL_Card[p_card].currentSCCB); | 3755 | } |
3970 | 3756 | ||
3971 | } | 3757 | /* If the Automation handled the end of the transfer then do not |
3758 | match the phase or we will get out of sync with the ISR. */ | ||
3759 | |||
3760 | if (RDW_HARPOON((p_port + hp_intstat)) & | ||
3761 | (BUS_FREE | XFER_CNT_0 | AUTO_INT)) | ||
3762 | return; | ||
3763 | |||
3764 | WR_HARPOON(p_port + hp_xfercnt_0, 0x00); | ||
3765 | |||
3766 | curr_phz = RD_HARPOON(p_port + hp_scsisig) & (unsigned char)S_SCSI_PHZ; | ||
3972 | 3767 | ||
3973 | /* If the Automation handled the end of the transfer then do not | 3768 | WRW_HARPOON((p_port + hp_intstat), XFER_CNT_0); |
3974 | match the phase or we will get out of sync with the ISR. */ | ||
3975 | 3769 | ||
3976 | if (RDW_HARPOON((p_port+hp_intstat)) & (BUS_FREE | XFER_CNT_0 | AUTO_INT)) | 3770 | WR_HARPOON(p_port + hp_scsisig, curr_phz); |
3977 | return; | ||
3978 | 3771 | ||
3979 | WR_HARPOON(p_port+hp_xfercnt_0, 0x00); | 3772 | while (!(RDW_HARPOON((p_port + hp_intstat)) & (BUS_FREE | RESET)) && |
3773 | (curr_phz == | ||
3774 | (RD_HARPOON(p_port + hp_scsisig) & (unsigned char)S_SCSI_PHZ))) | ||
3775 | { | ||
3776 | if (curr_phz & (unsigned char)SCSI_IOBIT) { | ||
3777 | WR_HARPOON(p_port + hp_portctrl_0, | ||
3778 | (SCSI_PORT | HOST_PORT | SCSI_INBIT)); | ||
3980 | 3779 | ||
3981 | curr_phz = RD_HARPOON(p_port+hp_scsisig) & (unsigned char)S_SCSI_PHZ; | 3780 | if (!(RD_HARPOON(p_port + hp_xferstat) & FIFO_EMPTY)) { |
3781 | RD_HARPOON(p_port + hp_fifodata_0); | ||
3782 | } | ||
3783 | } else { | ||
3784 | WR_HARPOON(p_port + hp_portctrl_0, | ||
3785 | (SCSI_PORT | HOST_PORT | HOST_WRT)); | ||
3786 | if (RD_HARPOON(p_port + hp_xferstat) & FIFO_EMPTY) { | ||
3787 | WR_HARPOON(p_port + hp_fifodata_0, 0xFA); | ||
3788 | } | ||
3789 | } | ||
3790 | } /* End of While loop for padding data I/O phase */ | ||
3982 | 3791 | ||
3983 | WRW_HARPOON((p_port+hp_intstat), XFER_CNT_0); | 3792 | while (!(RDW_HARPOON((p_port + hp_intstat)) & (BUS_FREE | RESET))) { |
3793 | if (RD_HARPOON(p_port + hp_scsisig) & SCSI_REQ) | ||
3794 | break; | ||
3795 | } | ||
3984 | 3796 | ||
3797 | WR_HARPOON(p_port + hp_portctrl_0, | ||
3798 | (SCSI_PORT | HOST_PORT | SCSI_INBIT)); | ||
3799 | while (!(RD_HARPOON(p_port + hp_xferstat) & FIFO_EMPTY)) { | ||
3800 | RD_HARPOON(p_port + hp_fifodata_0); | ||
3801 | } | ||
3985 | 3802 | ||
3986 | WR_HARPOON(p_port+hp_scsisig, curr_phz); | 3803 | if (!(RDW_HARPOON((p_port + hp_intstat)) & (BUS_FREE | RESET))) { |
3804 | WR_HARPOON(p_port + hp_autostart_0, | ||
3805 | (AUTO_IMMED + DISCONNECT_START)); | ||
3806 | while (!(RDW_HARPOON((p_port + hp_intstat)) & AUTO_INT)) { | ||
3807 | } | ||
3987 | 3808 | ||
3988 | while ( !(RDW_HARPOON((p_port+hp_intstat)) & (BUS_FREE | RESET)) && | 3809 | if (RDW_HARPOON((p_port + hp_intstat)) & |
3989 | (curr_phz == (RD_HARPOON(p_port+hp_scsisig) & (unsigned char)S_SCSI_PHZ)) ) | 3810 | (ICMD_COMP | ITAR_DISC)) |
3990 | { | 3811 | while (! |
3991 | if (curr_phz & (unsigned char)SCSI_IOBIT) | 3812 | (RDW_HARPOON((p_port + hp_intstat)) & |
3992 | { | 3813 | (BUS_FREE | RSEL))) ; |
3993 | WR_HARPOON(p_port+hp_portctrl_0, (SCSI_PORT | HOST_PORT | SCSI_INBIT)); | 3814 | } |
3994 | |||
3995 | if (!(RD_HARPOON(p_port+hp_xferstat) & FIFO_EMPTY)) | ||
3996 | { | ||
3997 | RD_HARPOON(p_port+hp_fifodata_0); | ||
3998 | } | ||
3999 | } | ||
4000 | else | ||
4001 | { | ||
4002 | WR_HARPOON(p_port+hp_portctrl_0, (SCSI_PORT | HOST_PORT | HOST_WRT)); | ||
4003 | if (RD_HARPOON(p_port+hp_xferstat) & FIFO_EMPTY) | ||
4004 | { | ||
4005 | WR_HARPOON(p_port+hp_fifodata_0,0xFA); | ||
4006 | } | ||
4007 | } | ||
4008 | } /* End of While loop for padding data I/O phase */ | ||
4009 | |||
4010 | while ( !(RDW_HARPOON((p_port+hp_intstat)) & (BUS_FREE | RESET))) | ||
4011 | { | ||
4012 | if (RD_HARPOON(p_port+hp_scsisig) & SCSI_REQ) | ||
4013 | break; | ||
4014 | } | ||
4015 | |||
4016 | WR_HARPOON(p_port+hp_portctrl_0, (SCSI_PORT | HOST_PORT | SCSI_INBIT)); | ||
4017 | while (!(RD_HARPOON(p_port+hp_xferstat) & FIFO_EMPTY)) | ||
4018 | { | ||
4019 | RD_HARPOON(p_port+hp_fifodata_0); | ||
4020 | } | ||
4021 | |||
4022 | if ( !(RDW_HARPOON((p_port+hp_intstat)) & (BUS_FREE | RESET))) | ||
4023 | { | ||
4024 | WR_HARPOON(p_port+hp_autostart_0, (AUTO_IMMED+DISCONNECT_START)); | ||
4025 | while (!(RDW_HARPOON((p_port+hp_intstat)) & AUTO_INT)) {} | ||
4026 | |||
4027 | if (RDW_HARPOON((p_port+hp_intstat)) & (ICMD_COMP | ITAR_DISC)) | ||
4028 | while (!(RDW_HARPOON((p_port+hp_intstat)) & (BUS_FREE | RSEL))) ; | ||
4029 | } | ||
4030 | } | 3815 | } |
4031 | 3816 | ||
4032 | |||
4033 | /*--------------------------------------------------------------------- | 3817 | /*--------------------------------------------------------------------- |
4034 | * | 3818 | * |
4035 | * Function: FPT_schkdd | 3819 | * Function: FPT_schkdd |
@@ -4041,109 +3825,97 @@ static void FPT_sxfrp(unsigned long p_port, unsigned char p_card) | |||
4041 | 3825 | ||
4042 | static void FPT_schkdd(unsigned long port, unsigned char p_card) | 3826 | static void FPT_schkdd(unsigned long port, unsigned char p_card) |
4043 | { | 3827 | { |
4044 | unsigned short TimeOutLoop; | 3828 | unsigned short TimeOutLoop; |
4045 | unsigned char sPhase; | 3829 | unsigned char sPhase; |
4046 | 3830 | ||
4047 | struct sccb * currSCCB; | 3831 | struct sccb *currSCCB; |
4048 | |||
4049 | currSCCB = FPT_BL_Card[p_card].currentSCCB; | ||
4050 | 3832 | ||
3833 | currSCCB = FPT_BL_Card[p_card].currentSCCB; | ||
4051 | 3834 | ||
4052 | if ((currSCCB->Sccb_scsistat != DATA_OUT_ST) && | 3835 | if ((currSCCB->Sccb_scsistat != DATA_OUT_ST) && |
4053 | (currSCCB->Sccb_scsistat != DATA_IN_ST)) { | 3836 | (currSCCB->Sccb_scsistat != DATA_IN_ST)) { |
4054 | return; | 3837 | return; |
4055 | } | 3838 | } |
4056 | |||
4057 | 3839 | ||
3840 | if (currSCCB->Sccb_XferState & F_ODD_BALL_CNT) { | ||
4058 | 3841 | ||
4059 | if (currSCCB->Sccb_XferState & F_ODD_BALL_CNT) | 3842 | currSCCB->Sccb_ATC += (currSCCB->Sccb_XferCnt - 1); |
4060 | { | ||
4061 | 3843 | ||
4062 | currSCCB->Sccb_ATC += (currSCCB->Sccb_XferCnt-1); | 3844 | currSCCB->Sccb_XferCnt = 1; |
4063 | 3845 | ||
4064 | currSCCB->Sccb_XferCnt = 1; | 3846 | currSCCB->Sccb_XferState &= ~F_ODD_BALL_CNT; |
4065 | 3847 | WRW_HARPOON((port + hp_fiforead), (unsigned short)0x00); | |
4066 | currSCCB->Sccb_XferState &= ~F_ODD_BALL_CNT; | 3848 | WR_HARPOON(port + hp_xferstat, 0x00); |
4067 | WRW_HARPOON((port+hp_fiforead), (unsigned short) 0x00); | 3849 | } |
4068 | WR_HARPOON(port+hp_xferstat, 0x00); | ||
4069 | } | ||
4070 | 3850 | ||
4071 | else | 3851 | else { |
4072 | { | ||
4073 | 3852 | ||
4074 | currSCCB->Sccb_ATC += currSCCB->Sccb_XferCnt; | 3853 | currSCCB->Sccb_ATC += currSCCB->Sccb_XferCnt; |
4075 | 3854 | ||
4076 | currSCCB->Sccb_XferCnt = 0; | 3855 | currSCCB->Sccb_XferCnt = 0; |
4077 | } | 3856 | } |
4078 | 3857 | ||
4079 | if ((RDW_HARPOON((port+hp_intstat)) & PARITY) && | 3858 | if ((RDW_HARPOON((port + hp_intstat)) & PARITY) && |
4080 | (currSCCB->HostStatus == SCCB_COMPLETE)) { | 3859 | (currSCCB->HostStatus == SCCB_COMPLETE)) { |
4081 | 3860 | ||
4082 | currSCCB->HostStatus = SCCB_PARITY_ERR; | 3861 | currSCCB->HostStatus = SCCB_PARITY_ERR; |
4083 | WRW_HARPOON((port+hp_intstat), PARITY); | 3862 | WRW_HARPOON((port + hp_intstat), PARITY); |
4084 | } | 3863 | } |
4085 | 3864 | ||
3865 | FPT_hostDataXferAbort(port, p_card, currSCCB); | ||
4086 | 3866 | ||
4087 | FPT_hostDataXferAbort(port,p_card,currSCCB); | 3867 | while (RD_HARPOON(port + hp_scsisig) & SCSI_ACK) { |
3868 | } | ||
4088 | 3869 | ||
3870 | TimeOutLoop = 0; | ||
4089 | 3871 | ||
4090 | while (RD_HARPOON(port+hp_scsisig) & SCSI_ACK) {} | 3872 | while (RD_HARPOON(port + hp_xferstat) & FIFO_EMPTY) { |
3873 | if (RDW_HARPOON((port + hp_intstat)) & BUS_FREE) { | ||
3874 | return; | ||
3875 | } | ||
3876 | if (RD_HARPOON(port + hp_offsetctr) & (unsigned char)0x1F) { | ||
3877 | break; | ||
3878 | } | ||
3879 | if (RDW_HARPOON((port + hp_intstat)) & RESET) { | ||
3880 | return; | ||
3881 | } | ||
3882 | if ((RD_HARPOON(port + hp_scsisig) & SCSI_REQ) | ||
3883 | || (TimeOutLoop++ > 0x3000)) | ||
3884 | break; | ||
3885 | } | ||
4091 | 3886 | ||
4092 | TimeOutLoop = 0; | 3887 | sPhase = RD_HARPOON(port + hp_scsisig) & (SCSI_BSY | S_SCSI_PHZ); |
3888 | if ((!(RD_HARPOON(port + hp_xferstat) & FIFO_EMPTY)) || | ||
3889 | (RD_HARPOON(port + hp_offsetctr) & (unsigned char)0x1F) || | ||
3890 | (sPhase == (SCSI_BSY | S_DATAO_PH)) || | ||
3891 | (sPhase == (SCSI_BSY | S_DATAI_PH))) { | ||
4093 | 3892 | ||
4094 | while(RD_HARPOON(port+hp_xferstat) & FIFO_EMPTY) | 3893 | WR_HARPOON(port + hp_portctrl_0, SCSI_PORT); |
4095 | { | ||
4096 | if (RDW_HARPOON((port+hp_intstat)) & BUS_FREE) { | ||
4097 | return; | ||
4098 | } | ||
4099 | if (RD_HARPOON(port+hp_offsetctr) & (unsigned char)0x1F) { | ||
4100 | break; | ||
4101 | } | ||
4102 | if (RDW_HARPOON((port+hp_intstat)) & RESET) { | ||
4103 | return; | ||
4104 | } | ||
4105 | if ((RD_HARPOON(port+hp_scsisig) & SCSI_REQ) || (TimeOutLoop++>0x3000) ) | ||
4106 | break; | ||
4107 | } | ||
4108 | 3894 | ||
4109 | sPhase = RD_HARPOON(port+hp_scsisig) & (SCSI_BSY | S_SCSI_PHZ); | 3895 | if (!(currSCCB->Sccb_XferState & F_ALL_XFERRED)) { |
4110 | if ((!(RD_HARPOON(port+hp_xferstat) & FIFO_EMPTY)) || | 3896 | if (currSCCB->Sccb_XferState & F_HOST_XFER_DIR) { |
4111 | (RD_HARPOON(port+hp_offsetctr) & (unsigned char)0x1F) || | 3897 | FPT_phaseDataIn(port, p_card); |
4112 | (sPhase == (SCSI_BSY | S_DATAO_PH)) || | 3898 | } |
4113 | (sPhase == (SCSI_BSY | S_DATAI_PH))) | ||
4114 | { | ||
4115 | 3899 | ||
4116 | WR_HARPOON(port+hp_portctrl_0, SCSI_PORT); | 3900 | else { |
3901 | FPT_phaseDataOut(port, p_card); | ||
3902 | } | ||
3903 | } else { | ||
3904 | FPT_sxfrp(port, p_card); | ||
3905 | if (!(RDW_HARPOON((port + hp_intstat)) & | ||
3906 | (BUS_FREE | ICMD_COMP | ITAR_DISC | RESET))) { | ||
3907 | WRW_HARPOON((port + hp_intstat), AUTO_INT); | ||
3908 | FPT_phaseDecode(port, p_card); | ||
3909 | } | ||
3910 | } | ||
4117 | 3911 | ||
4118 | if (!(currSCCB->Sccb_XferState & F_ALL_XFERRED)) | 3912 | } |
4119 | { | ||
4120 | if (currSCCB->Sccb_XferState & F_HOST_XFER_DIR) { | ||
4121 | FPT_phaseDataIn(port,p_card); | ||
4122 | } | ||
4123 | 3913 | ||
4124 | else { | 3914 | else { |
4125 | FPT_phaseDataOut(port,p_card); | 3915 | WR_HARPOON(port + hp_portctrl_0, 0x00); |
4126 | } | 3916 | } |
4127 | } | ||
4128 | else | ||
4129 | { | ||
4130 | FPT_sxfrp(port,p_card); | ||
4131 | if (!(RDW_HARPOON((port+hp_intstat)) & | ||
4132 | (BUS_FREE | ICMD_COMP | ITAR_DISC | RESET))) | ||
4133 | { | ||
4134 | WRW_HARPOON((port+hp_intstat), AUTO_INT); | ||
4135 | FPT_phaseDecode(port,p_card); | ||
4136 | } | ||
4137 | } | ||
4138 | |||
4139 | } | ||
4140 | |||
4141 | else { | ||
4142 | WR_HARPOON(port+hp_portctrl_0, 0x00); | ||
4143 | } | ||
4144 | } | 3917 | } |
4145 | 3918 | ||
4146 | |||
4147 | /*--------------------------------------------------------------------- | 3919 | /*--------------------------------------------------------------------- |
4148 | * | 3920 | * |
4149 | * Function: FPT_sinits | 3921 | * Function: FPT_sinits |
@@ -4152,39 +3924,37 @@ static void FPT_schkdd(unsigned long port, unsigned char p_card) | |||
4152 | * | 3924 | * |
4153 | *---------------------------------------------------------------------*/ | 3925 | *---------------------------------------------------------------------*/ |
4154 | 3926 | ||
4155 | static void FPT_sinits(struct sccb * p_sccb, unsigned char p_card) | 3927 | static void FPT_sinits(struct sccb *p_sccb, unsigned char p_card) |
4156 | { | 3928 | { |
4157 | struct sccb_mgr_tar_info * currTar_Info; | 3929 | struct sccb_mgr_tar_info *currTar_Info; |
4158 | 3930 | ||
4159 | if((p_sccb->TargID > MAX_SCSI_TAR) || (p_sccb->Lun > MAX_LUN)) | 3931 | if ((p_sccb->TargID > MAX_SCSI_TAR) || (p_sccb->Lun > MAX_LUN)) { |
4160 | { | ||
4161 | return; | 3932 | return; |
4162 | } | 3933 | } |
4163 | currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID]; | 3934 | currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID]; |
4164 | 3935 | ||
4165 | p_sccb->Sccb_XferState = 0x00; | 3936 | p_sccb->Sccb_XferState = 0x00; |
4166 | p_sccb->Sccb_XferCnt = p_sccb->DataLength; | 3937 | p_sccb->Sccb_XferCnt = p_sccb->DataLength; |
4167 | 3938 | ||
4168 | if ((p_sccb->OperationCode == SCATTER_GATHER_COMMAND) || | 3939 | if ((p_sccb->OperationCode == SCATTER_GATHER_COMMAND) || |
4169 | (p_sccb->OperationCode == RESIDUAL_SG_COMMAND)) { | 3940 | (p_sccb->OperationCode == RESIDUAL_SG_COMMAND)) { |
4170 | 3941 | ||
4171 | p_sccb->Sccb_SGoffset = 0; | 3942 | p_sccb->Sccb_SGoffset = 0; |
4172 | p_sccb->Sccb_XferState = F_SG_XFER; | 3943 | p_sccb->Sccb_XferState = F_SG_XFER; |
4173 | p_sccb->Sccb_XferCnt = 0x00; | 3944 | p_sccb->Sccb_XferCnt = 0x00; |
4174 | } | 3945 | } |
4175 | 3946 | ||
4176 | if (p_sccb->DataLength == 0x00) | 3947 | if (p_sccb->DataLength == 0x00) |
4177 | 3948 | ||
4178 | p_sccb->Sccb_XferState |= F_ALL_XFERRED; | 3949 | p_sccb->Sccb_XferState |= F_ALL_XFERRED; |
4179 | 3950 | ||
4180 | if (p_sccb->ControlByte & F_USE_CMD_Q) | 3951 | if (p_sccb->ControlByte & F_USE_CMD_Q) { |
4181 | { | 3952 | if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) == TAG_Q_REJECT) |
4182 | if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) == TAG_Q_REJECT) | 3953 | p_sccb->ControlByte &= ~F_USE_CMD_Q; |
4183 | p_sccb->ControlByte &= ~F_USE_CMD_Q; | ||
4184 | 3954 | ||
4185 | else | 3955 | else |
4186 | currTar_Info->TarStatus |= TAG_Q_TRYING; | 3956 | currTar_Info->TarStatus |= TAG_Q_TRYING; |
4187 | } | 3957 | } |
4188 | 3958 | ||
4189 | /* For !single SCSI device in system & device allow Disconnect | 3959 | /* For !single SCSI device in system & device allow Disconnect |
4190 | or command is tag_q type then send Cmd with Disconnect Enable | 3960 | or command is tag_q type then send Cmd with Disconnect Enable |
@@ -4195,35 +3965,35 @@ static void FPT_sinits(struct sccb * p_sccb, unsigned char p_card) | |||
4195 | (currTar_Info->TarStatus & TAR_ALLOW_DISC)) || | 3965 | (currTar_Info->TarStatus & TAR_ALLOW_DISC)) || |
4196 | (currTar_Info->TarStatus & TAG_Q_TRYING)) { | 3966 | (currTar_Info->TarStatus & TAG_Q_TRYING)) { |
4197 | */ | 3967 | */ |
4198 | if ((currTar_Info->TarStatus & TAR_ALLOW_DISC) || | 3968 | if ((currTar_Info->TarStatus & TAR_ALLOW_DISC) || |
4199 | (currTar_Info->TarStatus & TAG_Q_TRYING)) { | 3969 | (currTar_Info->TarStatus & TAG_Q_TRYING)) { |
4200 | p_sccb->Sccb_idmsg = (unsigned char)(SMIDENT | DISC_PRIV) | p_sccb->Lun; | 3970 | p_sccb->Sccb_idmsg = |
4201 | } | 3971 | (unsigned char)(SMIDENT | DISC_PRIV) | p_sccb->Lun; |
3972 | } | ||
4202 | 3973 | ||
4203 | else { | 3974 | else { |
4204 | 3975 | ||
4205 | p_sccb->Sccb_idmsg = (unsigned char)SMIDENT | p_sccb->Lun; | 3976 | p_sccb->Sccb_idmsg = (unsigned char)SMIDENT | p_sccb->Lun; |
4206 | } | 3977 | } |
4207 | 3978 | ||
4208 | p_sccb->HostStatus = 0x00; | 3979 | p_sccb->HostStatus = 0x00; |
4209 | p_sccb->TargetStatus = 0x00; | 3980 | p_sccb->TargetStatus = 0x00; |
4210 | p_sccb->Sccb_tag = 0x00; | 3981 | p_sccb->Sccb_tag = 0x00; |
4211 | p_sccb->Sccb_MGRFlags = 0x00; | 3982 | p_sccb->Sccb_MGRFlags = 0x00; |
4212 | p_sccb->Sccb_sgseg = 0x00; | 3983 | p_sccb->Sccb_sgseg = 0x00; |
4213 | p_sccb->Sccb_ATC = 0x00; | 3984 | p_sccb->Sccb_ATC = 0x00; |
4214 | p_sccb->Sccb_savedATC = 0x00; | 3985 | p_sccb->Sccb_savedATC = 0x00; |
4215 | /* | 3986 | /* |
4216 | p_sccb->SccbVirtDataPtr = 0x00; | 3987 | p_sccb->SccbVirtDataPtr = 0x00; |
4217 | p_sccb->Sccb_forwardlink = NULL; | 3988 | p_sccb->Sccb_forwardlink = NULL; |
4218 | p_sccb->Sccb_backlink = NULL; | 3989 | p_sccb->Sccb_backlink = NULL; |
4219 | */ | 3990 | */ |
4220 | p_sccb->Sccb_scsistat = BUS_FREE_ST; | 3991 | p_sccb->Sccb_scsistat = BUS_FREE_ST; |
4221 | p_sccb->SccbStatus = SCCB_IN_PROCESS; | 3992 | p_sccb->SccbStatus = SCCB_IN_PROCESS; |
4222 | p_sccb->Sccb_scsimsg = SMNO_OP; | 3993 | p_sccb->Sccb_scsimsg = SMNO_OP; |
4223 | 3994 | ||
4224 | } | 3995 | } |
4225 | 3996 | ||
4226 | |||
4227 | /*--------------------------------------------------------------------- | 3997 | /*--------------------------------------------------------------------- |
4228 | * | 3998 | * |
4229 | * Function: Phase Decode | 3999 | * Function: Phase Decode |
@@ -4234,21 +4004,19 @@ static void FPT_sinits(struct sccb * p_sccb, unsigned char p_card) | |||
4234 | 4004 | ||
4235 | static void FPT_phaseDecode(unsigned long p_port, unsigned char p_card) | 4005 | static void FPT_phaseDecode(unsigned long p_port, unsigned char p_card) |
4236 | { | 4006 | { |
4237 | unsigned char phase_ref; | 4007 | unsigned char phase_ref; |
4238 | void (*phase) (unsigned long, unsigned char); | 4008 | void (*phase) (unsigned long, unsigned char); |
4239 | 4009 | ||
4010 | DISABLE_AUTO(p_port); | ||
4240 | 4011 | ||
4241 | DISABLE_AUTO(p_port); | 4012 | phase_ref = |
4013 | (unsigned char)(RD_HARPOON(p_port + hp_scsisig) & S_SCSI_PHZ); | ||
4242 | 4014 | ||
4243 | phase_ref = (unsigned char) (RD_HARPOON(p_port+hp_scsisig) & S_SCSI_PHZ); | 4015 | phase = FPT_s_PhaseTbl[phase_ref]; |
4244 | 4016 | ||
4245 | phase = FPT_s_PhaseTbl[phase_ref]; | 4017 | (*phase) (p_port, p_card); /* Call the correct phase func */ |
4246 | |||
4247 | (*phase)(p_port, p_card); /* Call the correct phase func */ | ||
4248 | } | 4018 | } |
4249 | 4019 | ||
4250 | |||
4251 | |||
4252 | /*--------------------------------------------------------------------- | 4020 | /*--------------------------------------------------------------------- |
4253 | * | 4021 | * |
4254 | * Function: Data Out Phase | 4022 | * Function: Data Out Phase |
@@ -4260,39 +4028,36 @@ static void FPT_phaseDecode(unsigned long p_port, unsigned char p_card) | |||
4260 | static void FPT_phaseDataOut(unsigned long port, unsigned char p_card) | 4028 | static void FPT_phaseDataOut(unsigned long port, unsigned char p_card) |
4261 | { | 4029 | { |
4262 | 4030 | ||
4263 | struct sccb * currSCCB; | 4031 | struct sccb *currSCCB; |
4264 | 4032 | ||
4265 | currSCCB = FPT_BL_Card[p_card].currentSCCB; | 4033 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
4266 | if (currSCCB == NULL) | 4034 | if (currSCCB == NULL) { |
4267 | { | 4035 | return; /* Exit if No SCCB record */ |
4268 | return; /* Exit if No SCCB record */ | 4036 | } |
4269 | } | ||
4270 | |||
4271 | currSCCB->Sccb_scsistat = DATA_OUT_ST; | ||
4272 | currSCCB->Sccb_XferState &= ~(F_HOST_XFER_DIR | F_NO_DATA_YET); | ||
4273 | 4037 | ||
4274 | WR_HARPOON(port+hp_portctrl_0, SCSI_PORT); | 4038 | currSCCB->Sccb_scsistat = DATA_OUT_ST; |
4039 | currSCCB->Sccb_XferState &= ~(F_HOST_XFER_DIR | F_NO_DATA_YET); | ||
4275 | 4040 | ||
4276 | WRW_HARPOON((port+hp_intstat), XFER_CNT_0); | 4041 | WR_HARPOON(port + hp_portctrl_0, SCSI_PORT); |
4277 | 4042 | ||
4278 | WR_HARPOON(port+hp_autostart_0, (END_DATA+END_DATA_START)); | 4043 | WRW_HARPOON((port + hp_intstat), XFER_CNT_0); |
4279 | 4044 | ||
4280 | FPT_dataXferProcessor(port, &FPT_BL_Card[p_card]); | 4045 | WR_HARPOON(port + hp_autostart_0, (END_DATA + END_DATA_START)); |
4281 | 4046 | ||
4282 | if (currSCCB->Sccb_XferCnt == 0) { | 4047 | FPT_dataXferProcessor(port, &FPT_BL_Card[p_card]); |
4283 | 4048 | ||
4049 | if (currSCCB->Sccb_XferCnt == 0) { | ||
4284 | 4050 | ||
4285 | if ((currSCCB->ControlByte & SCCB_DATA_XFER_OUT) && | 4051 | if ((currSCCB->ControlByte & SCCB_DATA_XFER_OUT) && |
4286 | (currSCCB->HostStatus == SCCB_COMPLETE)) | 4052 | (currSCCB->HostStatus == SCCB_COMPLETE)) |
4287 | currSCCB->HostStatus = SCCB_DATA_OVER_RUN; | 4053 | currSCCB->HostStatus = SCCB_DATA_OVER_RUN; |
4288 | 4054 | ||
4289 | FPT_sxfrp(port,p_card); | 4055 | FPT_sxfrp(port, p_card); |
4290 | if (!(RDW_HARPOON((port+hp_intstat)) & (BUS_FREE | RESET))) | 4056 | if (!(RDW_HARPOON((port + hp_intstat)) & (BUS_FREE | RESET))) |
4291 | FPT_phaseDecode(port,p_card); | 4057 | FPT_phaseDecode(port, p_card); |
4292 | } | 4058 | } |
4293 | } | 4059 | } |
4294 | 4060 | ||
4295 | |||
4296 | /*--------------------------------------------------------------------- | 4061 | /*--------------------------------------------------------------------- |
4297 | * | 4062 | * |
4298 | * Function: Data In Phase | 4063 | * Function: Data In Phase |
@@ -4304,40 +4069,37 @@ static void FPT_phaseDataOut(unsigned long port, unsigned char p_card) | |||
4304 | static void FPT_phaseDataIn(unsigned long port, unsigned char p_card) | 4069 | static void FPT_phaseDataIn(unsigned long port, unsigned char p_card) |
4305 | { | 4070 | { |
4306 | 4071 | ||
4307 | struct sccb * currSCCB; | 4072 | struct sccb *currSCCB; |
4308 | |||
4309 | currSCCB = FPT_BL_Card[p_card].currentSCCB; | ||
4310 | |||
4311 | if (currSCCB == NULL) | ||
4312 | { | ||
4313 | return; /* Exit if No SCCB record */ | ||
4314 | } | ||
4315 | 4073 | ||
4074 | currSCCB = FPT_BL_Card[p_card].currentSCCB; | ||
4316 | 4075 | ||
4317 | currSCCB->Sccb_scsistat = DATA_IN_ST; | 4076 | if (currSCCB == NULL) { |
4318 | currSCCB->Sccb_XferState |= F_HOST_XFER_DIR; | 4077 | return; /* Exit if No SCCB record */ |
4319 | currSCCB->Sccb_XferState &= ~F_NO_DATA_YET; | 4078 | } |
4320 | 4079 | ||
4321 | WR_HARPOON(port+hp_portctrl_0, SCSI_PORT); | 4080 | currSCCB->Sccb_scsistat = DATA_IN_ST; |
4081 | currSCCB->Sccb_XferState |= F_HOST_XFER_DIR; | ||
4082 | currSCCB->Sccb_XferState &= ~F_NO_DATA_YET; | ||
4322 | 4083 | ||
4323 | WRW_HARPOON((port+hp_intstat), XFER_CNT_0); | 4084 | WR_HARPOON(port + hp_portctrl_0, SCSI_PORT); |
4324 | 4085 | ||
4325 | WR_HARPOON(port+hp_autostart_0, (END_DATA+END_DATA_START)); | 4086 | WRW_HARPOON((port + hp_intstat), XFER_CNT_0); |
4326 | 4087 | ||
4327 | FPT_dataXferProcessor(port, &FPT_BL_Card[p_card]); | 4088 | WR_HARPOON(port + hp_autostart_0, (END_DATA + END_DATA_START)); |
4328 | 4089 | ||
4329 | if (currSCCB->Sccb_XferCnt == 0) { | 4090 | FPT_dataXferProcessor(port, &FPT_BL_Card[p_card]); |
4330 | 4091 | ||
4092 | if (currSCCB->Sccb_XferCnt == 0) { | ||
4331 | 4093 | ||
4332 | if ((currSCCB->ControlByte & SCCB_DATA_XFER_IN) && | 4094 | if ((currSCCB->ControlByte & SCCB_DATA_XFER_IN) && |
4333 | (currSCCB->HostStatus == SCCB_COMPLETE)) | 4095 | (currSCCB->HostStatus == SCCB_COMPLETE)) |
4334 | currSCCB->HostStatus = SCCB_DATA_OVER_RUN; | 4096 | currSCCB->HostStatus = SCCB_DATA_OVER_RUN; |
4335 | 4097 | ||
4336 | FPT_sxfrp(port,p_card); | 4098 | FPT_sxfrp(port, p_card); |
4337 | if (!(RDW_HARPOON((port+hp_intstat)) & (BUS_FREE | RESET))) | 4099 | if (!(RDW_HARPOON((port + hp_intstat)) & (BUS_FREE | RESET))) |
4338 | FPT_phaseDecode(port,p_card); | 4100 | FPT_phaseDecode(port, p_card); |
4339 | 4101 | ||
4340 | } | 4102 | } |
4341 | } | 4103 | } |
4342 | 4104 | ||
4343 | /*--------------------------------------------------------------------- | 4105 | /*--------------------------------------------------------------------- |
@@ -4350,48 +4112,47 @@ static void FPT_phaseDataIn(unsigned long port, unsigned char p_card) | |||
4350 | 4112 | ||
4351 | static void FPT_phaseCommand(unsigned long p_port, unsigned char p_card) | 4113 | static void FPT_phaseCommand(unsigned long p_port, unsigned char p_card) |
4352 | { | 4114 | { |
4353 | struct sccb * currSCCB; | 4115 | struct sccb *currSCCB; |
4354 | unsigned long cdb_reg; | 4116 | unsigned long cdb_reg; |
4355 | unsigned char i; | 4117 | unsigned char i; |
4356 | |||
4357 | currSCCB = FPT_BL_Card[p_card].currentSCCB; | ||
4358 | 4118 | ||
4359 | if (currSCCB->OperationCode == RESET_COMMAND) { | 4119 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
4360 | 4120 | ||
4361 | currSCCB->HostStatus = SCCB_PHASE_SEQUENCE_FAIL; | 4121 | if (currSCCB->OperationCode == RESET_COMMAND) { |
4362 | currSCCB->CdbLength = SIX_BYTE_CMD; | ||
4363 | } | ||
4364 | 4122 | ||
4365 | WR_HARPOON(p_port+hp_scsisig, 0x00); | 4123 | currSCCB->HostStatus = SCCB_PHASE_SEQUENCE_FAIL; |
4124 | currSCCB->CdbLength = SIX_BYTE_CMD; | ||
4125 | } | ||
4366 | 4126 | ||
4367 | ARAM_ACCESS(p_port); | 4127 | WR_HARPOON(p_port + hp_scsisig, 0x00); |
4368 | 4128 | ||
4129 | ARAM_ACCESS(p_port); | ||
4369 | 4130 | ||
4370 | cdb_reg = p_port + CMD_STRT; | 4131 | cdb_reg = p_port + CMD_STRT; |
4371 | 4132 | ||
4372 | for (i=0; i < currSCCB->CdbLength; i++) { | 4133 | for (i = 0; i < currSCCB->CdbLength; i++) { |
4373 | 4134 | ||
4374 | if (currSCCB->OperationCode == RESET_COMMAND) | 4135 | if (currSCCB->OperationCode == RESET_COMMAND) |
4375 | 4136 | ||
4376 | WRW_HARPOON(cdb_reg, (MPM_OP + ACOMMAND + 0x00)); | 4137 | WRW_HARPOON(cdb_reg, (MPM_OP + ACOMMAND + 0x00)); |
4377 | 4138 | ||
4378 | else | 4139 | else |
4379 | WRW_HARPOON(cdb_reg, (MPM_OP + ACOMMAND + currSCCB->Cdb[i])); | 4140 | WRW_HARPOON(cdb_reg, |
4380 | cdb_reg +=2; | 4141 | (MPM_OP + ACOMMAND + currSCCB->Cdb[i])); |
4381 | } | 4142 | cdb_reg += 2; |
4143 | } | ||
4382 | 4144 | ||
4383 | if (currSCCB->CdbLength != TWELVE_BYTE_CMD) | 4145 | if (currSCCB->CdbLength != TWELVE_BYTE_CMD) |
4384 | WRW_HARPOON(cdb_reg, (BRH_OP+ALWAYS+ NP)); | 4146 | WRW_HARPOON(cdb_reg, (BRH_OP + ALWAYS + NP)); |
4385 | 4147 | ||
4386 | WR_HARPOON(p_port+hp_portctrl_0,(SCSI_PORT)); | 4148 | WR_HARPOON(p_port + hp_portctrl_0, (SCSI_PORT)); |
4387 | 4149 | ||
4388 | currSCCB->Sccb_scsistat = COMMAND_ST; | 4150 | currSCCB->Sccb_scsistat = COMMAND_ST; |
4389 | 4151 | ||
4390 | WR_HARPOON(p_port+hp_autostart_3, (AUTO_IMMED | CMD_ONLY_STRT)); | 4152 | WR_HARPOON(p_port + hp_autostart_3, (AUTO_IMMED | CMD_ONLY_STRT)); |
4391 | SGRAM_ACCESS(p_port); | 4153 | SGRAM_ACCESS(p_port); |
4392 | } | 4154 | } |
4393 | 4155 | ||
4394 | |||
4395 | /*--------------------------------------------------------------------- | 4156 | /*--------------------------------------------------------------------- |
4396 | * | 4157 | * |
4397 | * Function: Status phase | 4158 | * Function: Status phase |
@@ -4402,17 +4163,16 @@ static void FPT_phaseCommand(unsigned long p_port, unsigned char p_card) | |||
4402 | 4163 | ||
4403 | static void FPT_phaseStatus(unsigned long port, unsigned char p_card) | 4164 | static void FPT_phaseStatus(unsigned long port, unsigned char p_card) |
4404 | { | 4165 | { |
4405 | /* Start-up the automation to finish off this command and let the | 4166 | /* Start-up the automation to finish off this command and let the |
4406 | isr handle the interrupt for command complete when it comes in. | 4167 | isr handle the interrupt for command complete when it comes in. |
4407 | We could wait here for the interrupt to be generated? | 4168 | We could wait here for the interrupt to be generated? |
4408 | */ | 4169 | */ |
4409 | 4170 | ||
4410 | WR_HARPOON(port+hp_scsisig, 0x00); | 4171 | WR_HARPOON(port + hp_scsisig, 0x00); |
4411 | 4172 | ||
4412 | WR_HARPOON(port+hp_autostart_0, (AUTO_IMMED+END_DATA_START)); | 4173 | WR_HARPOON(port + hp_autostart_0, (AUTO_IMMED + END_DATA_START)); |
4413 | } | 4174 | } |
4414 | 4175 | ||
4415 | |||
4416 | /*--------------------------------------------------------------------- | 4176 | /*--------------------------------------------------------------------- |
4417 | * | 4177 | * |
4418 | * Function: Phase Message Out | 4178 | * Function: Phase Message Out |
@@ -4424,9 +4184,9 @@ static void FPT_phaseStatus(unsigned long port, unsigned char p_card) | |||
4424 | 4184 | ||
4425 | static void FPT_phaseMsgOut(unsigned long port, unsigned char p_card) | 4185 | static void FPT_phaseMsgOut(unsigned long port, unsigned char p_card) |
4426 | { | 4186 | { |
4427 | unsigned char message,scsiID; | 4187 | unsigned char message, scsiID; |
4428 | struct sccb * currSCCB; | 4188 | struct sccb *currSCCB; |
4429 | struct sccb_mgr_tar_info * currTar_Info; | 4189 | struct sccb_mgr_tar_info *currTar_Info; |
4430 | 4190 | ||
4431 | currSCCB = FPT_BL_Card[p_card].currentSCCB; | 4191 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
4432 | 4192 | ||
@@ -4435,133 +4195,124 @@ static void FPT_phaseMsgOut(unsigned long port, unsigned char p_card) | |||
4435 | message = currSCCB->Sccb_scsimsg; | 4195 | message = currSCCB->Sccb_scsimsg; |
4436 | scsiID = currSCCB->TargID; | 4196 | scsiID = currSCCB->TargID; |
4437 | 4197 | ||
4438 | if (message == SMDEV_RESET) | 4198 | if (message == SMDEV_RESET) { |
4439 | { | ||
4440 | |||
4441 | 4199 | ||
4442 | currTar_Info = &FPT_sccbMgrTbl[p_card][scsiID]; | 4200 | currTar_Info = &FPT_sccbMgrTbl[p_card][scsiID]; |
4443 | currTar_Info->TarSyncCtrl = 0; | 4201 | currTar_Info->TarSyncCtrl = 0; |
4444 | FPT_sssyncv(port, scsiID, NARROW_SCSI,currTar_Info); | 4202 | FPT_sssyncv(port, scsiID, NARROW_SCSI, currTar_Info); |
4445 | 4203 | ||
4446 | if (FPT_sccbMgrTbl[p_card][scsiID].TarEEValue & EE_SYNC_MASK) | 4204 | if (FPT_sccbMgrTbl[p_card][scsiID]. |
4447 | { | 4205 | TarEEValue & EE_SYNC_MASK) { |
4448 | 4206 | ||
4449 | FPT_sccbMgrTbl[p_card][scsiID].TarStatus &= ~TAR_SYNC_MASK; | 4207 | FPT_sccbMgrTbl[p_card][scsiID].TarStatus &= |
4208 | ~TAR_SYNC_MASK; | ||
4450 | 4209 | ||
4451 | } | 4210 | } |
4452 | 4211 | ||
4453 | if (FPT_sccbMgrTbl[p_card][scsiID].TarEEValue & EE_WIDE_SCSI) | 4212 | if (FPT_sccbMgrTbl[p_card][scsiID]. |
4454 | { | 4213 | TarEEValue & EE_WIDE_SCSI) { |
4455 | 4214 | ||
4456 | FPT_sccbMgrTbl[p_card][scsiID].TarStatus &= ~TAR_WIDE_MASK; | 4215 | FPT_sccbMgrTbl[p_card][scsiID].TarStatus &= |
4216 | ~TAR_WIDE_MASK; | ||
4457 | } | 4217 | } |
4458 | 4218 | ||
4459 | 4219 | FPT_queueFlushSccb(p_card, SCCB_COMPLETE); | |
4460 | FPT_queueFlushSccb(p_card,SCCB_COMPLETE); | 4220 | FPT_SccbMgrTableInitTarget(p_card, scsiID); |
4461 | FPT_SccbMgrTableInitTarget(p_card,scsiID); | 4221 | } else if (currSCCB->Sccb_scsistat == ABORT_ST) { |
4462 | } | ||
4463 | else if (currSCCB->Sccb_scsistat == ABORT_ST) | ||
4464 | { | ||
4465 | currSCCB->HostStatus = SCCB_COMPLETE; | 4222 | currSCCB->HostStatus = SCCB_COMPLETE; |
4466 | if(FPT_BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] != NULL) | 4223 | if (FPT_BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] != |
4467 | { | 4224 | NULL) { |
4468 | FPT_BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] = NULL; | 4225 | FPT_BL_Card[p_card].discQ_Tbl[currSCCB-> |
4226 | Sccb_tag] = NULL; | ||
4469 | FPT_sccbMgrTbl[p_card][scsiID].TarTagQ_Cnt--; | 4227 | FPT_sccbMgrTbl[p_card][scsiID].TarTagQ_Cnt--; |
4470 | } | 4228 | } |
4471 | |||
4472 | } | ||
4473 | 4229 | ||
4474 | else if (currSCCB->Sccb_scsistat < COMMAND_ST) | 4230 | } |
4475 | { | ||
4476 | 4231 | ||
4232 | else if (currSCCB->Sccb_scsistat < COMMAND_ST) { | ||
4477 | 4233 | ||
4478 | if(message == SMNO_OP) | 4234 | if (message == SMNO_OP) { |
4479 | { | ||
4480 | currSCCB->Sccb_MGRFlags |= F_DEV_SELECTED; | 4235 | currSCCB->Sccb_MGRFlags |= F_DEV_SELECTED; |
4481 | 4236 | ||
4482 | FPT_ssel(port,p_card); | 4237 | FPT_ssel(port, p_card); |
4483 | return; | 4238 | return; |
4484 | } | 4239 | } |
4485 | } | 4240 | } else { |
4486 | else | ||
4487 | { | ||
4488 | |||
4489 | 4241 | ||
4490 | if (message == SMABORT) | 4242 | if (message == SMABORT) |
4491 | 4243 | ||
4492 | FPT_queueFlushSccb(p_card,SCCB_COMPLETE); | 4244 | FPT_queueFlushSccb(p_card, SCCB_COMPLETE); |
4493 | } | 4245 | } |
4494 | 4246 | ||
4495 | } | 4247 | } else { |
4496 | else | ||
4497 | { | ||
4498 | message = SMABORT; | 4248 | message = SMABORT; |
4499 | } | 4249 | } |
4500 | 4250 | ||
4501 | WRW_HARPOON((port+hp_intstat), (BUS_FREE | PHASE | XFER_CNT_0)); | 4251 | WRW_HARPOON((port + hp_intstat), (BUS_FREE | PHASE | XFER_CNT_0)); |
4502 | |||
4503 | 4252 | ||
4504 | WR_HARPOON(port+hp_portctrl_0, SCSI_BUS_EN); | 4253 | WR_HARPOON(port + hp_portctrl_0, SCSI_BUS_EN); |
4505 | 4254 | ||
4506 | WR_HARPOON(port+hp_scsidata_0,message); | 4255 | WR_HARPOON(port + hp_scsidata_0, message); |
4507 | 4256 | ||
4508 | WR_HARPOON(port+hp_scsisig, (SCSI_ACK + S_ILL_PH)); | 4257 | WR_HARPOON(port + hp_scsisig, (SCSI_ACK + S_ILL_PH)); |
4509 | 4258 | ||
4510 | ACCEPT_MSG(port); | 4259 | ACCEPT_MSG(port); |
4511 | 4260 | ||
4512 | WR_HARPOON(port+hp_portctrl_0, 0x00); | 4261 | WR_HARPOON(port + hp_portctrl_0, 0x00); |
4513 | 4262 | ||
4514 | if ((message == SMABORT) || (message == SMDEV_RESET) || | 4263 | if ((message == SMABORT) || (message == SMDEV_RESET) || |
4515 | (message == SMABORT_TAG) ) | 4264 | (message == SMABORT_TAG)) { |
4516 | { | ||
4517 | 4265 | ||
4518 | while(!(RDW_HARPOON((port+hp_intstat)) & (BUS_FREE | PHASE))) {} | 4266 | while (!(RDW_HARPOON((port + hp_intstat)) & (BUS_FREE | PHASE))) { |
4267 | } | ||
4519 | 4268 | ||
4520 | if (RDW_HARPOON((port+hp_intstat)) & BUS_FREE) | 4269 | if (RDW_HARPOON((port + hp_intstat)) & BUS_FREE) { |
4521 | { | 4270 | WRW_HARPOON((port + hp_intstat), BUS_FREE); |
4522 | WRW_HARPOON((port+hp_intstat), BUS_FREE); | ||
4523 | 4271 | ||
4524 | if (currSCCB != NULL) | 4272 | if (currSCCB != NULL) { |
4525 | { | ||
4526 | 4273 | ||
4527 | if((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && | 4274 | if ((FPT_BL_Card[p_card]. |
4528 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) | 4275 | globalFlags & F_CONLUN_IO) |
4529 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = 0; | 4276 | && |
4277 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID]. | ||
4278 | TarStatus & TAR_TAG_Q_MASK) != | ||
4279 | TAG_Q_TRYING)) | ||
4280 | FPT_sccbMgrTbl[p_card][currSCCB-> | ||
4281 | TargID]. | ||
4282 | TarLUNBusy[currSCCB->Lun] = 0; | ||
4530 | else | 4283 | else |
4531 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = 0; | 4284 | FPT_sccbMgrTbl[p_card][currSCCB-> |
4285 | TargID]. | ||
4286 | TarLUNBusy[0] = 0; | ||
4532 | 4287 | ||
4533 | FPT_queueCmdComplete(&FPT_BL_Card[p_card],currSCCB, p_card); | 4288 | FPT_queueCmdComplete(&FPT_BL_Card[p_card], |
4289 | currSCCB, p_card); | ||
4534 | } | 4290 | } |
4535 | 4291 | ||
4536 | else | 4292 | else { |
4537 | { | 4293 | FPT_BL_Card[p_card].globalFlags |= |
4538 | FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD; | 4294 | F_NEW_SCCB_CMD; |
4539 | } | 4295 | } |
4540 | } | 4296 | } |
4541 | 4297 | ||
4542 | else | 4298 | else { |
4543 | { | ||
4544 | 4299 | ||
4545 | FPT_sxfrp(port,p_card); | 4300 | FPT_sxfrp(port, p_card); |
4546 | } | 4301 | } |
4547 | } | 4302 | } |
4548 | 4303 | ||
4549 | else | 4304 | else { |
4550 | { | ||
4551 | 4305 | ||
4552 | if(message == SMPARITY) | 4306 | if (message == SMPARITY) { |
4553 | { | ||
4554 | currSCCB->Sccb_scsimsg = SMNO_OP; | 4307 | currSCCB->Sccb_scsimsg = SMNO_OP; |
4555 | WR_HARPOON(port+hp_autostart_1, (AUTO_IMMED+DISCONNECT_START)); | 4308 | WR_HARPOON(port + hp_autostart_1, |
4556 | } | 4309 | (AUTO_IMMED + DISCONNECT_START)); |
4557 | else | 4310 | } else { |
4558 | { | 4311 | FPT_sxfrp(port, p_card); |
4559 | FPT_sxfrp(port,p_card); | ||
4560 | } | 4312 | } |
4561 | } | 4313 | } |
4562 | } | 4314 | } |
4563 | 4315 | ||
4564 | |||
4565 | /*--------------------------------------------------------------------- | 4316 | /*--------------------------------------------------------------------- |
4566 | * | 4317 | * |
4567 | * Function: Message In phase | 4318 | * Function: Message In phase |
@@ -4573,46 +4324,40 @@ static void FPT_phaseMsgOut(unsigned long port, unsigned char p_card) | |||
4573 | static void FPT_phaseMsgIn(unsigned long port, unsigned char p_card) | 4324 | static void FPT_phaseMsgIn(unsigned long port, unsigned char p_card) |
4574 | { | 4325 | { |
4575 | unsigned char message; | 4326 | unsigned char message; |
4576 | struct sccb * currSCCB; | 4327 | struct sccb *currSCCB; |
4577 | 4328 | ||
4578 | currSCCB = FPT_BL_Card[p_card].currentSCCB; | 4329 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
4579 | 4330 | ||
4580 | if (FPT_BL_Card[p_card].globalFlags & F_HOST_XFER_ACT) | 4331 | if (FPT_BL_Card[p_card].globalFlags & F_HOST_XFER_ACT) { |
4581 | { | ||
4582 | 4332 | ||
4583 | FPT_phaseChkFifo(port, p_card); | 4333 | FPT_phaseChkFifo(port, p_card); |
4584 | } | 4334 | } |
4585 | 4335 | ||
4586 | message = RD_HARPOON(port+hp_scsidata_0); | 4336 | message = RD_HARPOON(port + hp_scsidata_0); |
4587 | if ((message == SMDISC) || (message == SMSAVE_DATA_PTR)) | 4337 | if ((message == SMDISC) || (message == SMSAVE_DATA_PTR)) { |
4588 | { | ||
4589 | 4338 | ||
4590 | WR_HARPOON(port+hp_autostart_1, (AUTO_IMMED+END_DATA_START)); | 4339 | WR_HARPOON(port + hp_autostart_1, |
4340 | (AUTO_IMMED + END_DATA_START)); | ||
4591 | 4341 | ||
4592 | } | 4342 | } |
4593 | 4343 | ||
4594 | else | 4344 | else { |
4595 | { | ||
4596 | |||
4597 | message = FPT_sfm(port,currSCCB); | ||
4598 | if (message) | ||
4599 | { | ||
4600 | 4345 | ||
4346 | message = FPT_sfm(port, currSCCB); | ||
4347 | if (message) { | ||
4601 | 4348 | ||
4602 | FPT_sdecm(message,port,p_card); | 4349 | FPT_sdecm(message, port, p_card); |
4603 | 4350 | ||
4604 | } | 4351 | } else { |
4605 | else | 4352 | if (currSCCB->Sccb_scsimsg != SMPARITY) |
4606 | { | ||
4607 | if(currSCCB->Sccb_scsimsg != SMPARITY) | ||
4608 | ACCEPT_MSG(port); | 4353 | ACCEPT_MSG(port); |
4609 | WR_HARPOON(port+hp_autostart_1, (AUTO_IMMED+DISCONNECT_START)); | 4354 | WR_HARPOON(port + hp_autostart_1, |
4355 | (AUTO_IMMED + DISCONNECT_START)); | ||
4610 | } | 4356 | } |
4611 | } | 4357 | } |
4612 | 4358 | ||
4613 | } | 4359 | } |
4614 | 4360 | ||
4615 | |||
4616 | /*--------------------------------------------------------------------- | 4361 | /*--------------------------------------------------------------------- |
4617 | * | 4362 | * |
4618 | * Function: Illegal phase | 4363 | * Function: Illegal phase |
@@ -4625,23 +4370,21 @@ static void FPT_phaseMsgIn(unsigned long port, unsigned char p_card) | |||
4625 | 4370 | ||
4626 | static void FPT_phaseIllegal(unsigned long port, unsigned char p_card) | 4371 | static void FPT_phaseIllegal(unsigned long port, unsigned char p_card) |
4627 | { | 4372 | { |
4628 | struct sccb * currSCCB; | 4373 | struct sccb *currSCCB; |
4629 | 4374 | ||
4630 | currSCCB = FPT_BL_Card[p_card].currentSCCB; | 4375 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
4631 | 4376 | ||
4632 | WR_HARPOON(port+hp_scsisig, RD_HARPOON(port+hp_scsisig)); | 4377 | WR_HARPOON(port + hp_scsisig, RD_HARPOON(port + hp_scsisig)); |
4633 | if (currSCCB != NULL) { | 4378 | if (currSCCB != NULL) { |
4634 | 4379 | ||
4635 | currSCCB->HostStatus = SCCB_PHASE_SEQUENCE_FAIL; | 4380 | currSCCB->HostStatus = SCCB_PHASE_SEQUENCE_FAIL; |
4636 | currSCCB->Sccb_scsistat = ABORT_ST; | 4381 | currSCCB->Sccb_scsistat = ABORT_ST; |
4637 | currSCCB->Sccb_scsimsg = SMABORT; | 4382 | currSCCB->Sccb_scsimsg = SMABORT; |
4638 | } | 4383 | } |
4639 | 4384 | ||
4640 | ACCEPT_MSG_ATN(port); | 4385 | ACCEPT_MSG_ATN(port); |
4641 | } | 4386 | } |
4642 | 4387 | ||
4643 | |||
4644 | |||
4645 | /*--------------------------------------------------------------------- | 4388 | /*--------------------------------------------------------------------- |
4646 | * | 4389 | * |
4647 | * Function: Phase Check FIFO | 4390 | * Function: Phase Check FIFO |
@@ -4653,74 +4396,67 @@ static void FPT_phaseIllegal(unsigned long port, unsigned char p_card) | |||
4653 | 4396 | ||
4654 | static void FPT_phaseChkFifo(unsigned long port, unsigned char p_card) | 4397 | static void FPT_phaseChkFifo(unsigned long port, unsigned char p_card) |
4655 | { | 4398 | { |
4656 | unsigned long xfercnt; | 4399 | unsigned long xfercnt; |
4657 | struct sccb * currSCCB; | 4400 | struct sccb *currSCCB; |
4658 | 4401 | ||
4659 | currSCCB = FPT_BL_Card[p_card].currentSCCB; | 4402 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
4660 | |||
4661 | if (currSCCB->Sccb_scsistat == DATA_IN_ST) | ||
4662 | { | ||
4663 | |||
4664 | while((!(RD_HARPOON(port+hp_xferstat) & FIFO_EMPTY)) && | ||
4665 | (RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY)) {} | ||
4666 | |||
4667 | |||
4668 | if (!(RD_HARPOON(port+hp_xferstat) & FIFO_EMPTY)) | ||
4669 | { | ||
4670 | currSCCB->Sccb_ATC += currSCCB->Sccb_XferCnt; | ||
4671 | |||
4672 | currSCCB->Sccb_XferCnt = 0; | ||
4673 | |||
4674 | if ((RDW_HARPOON((port+hp_intstat)) & PARITY) && | ||
4675 | (currSCCB->HostStatus == SCCB_COMPLETE)) | ||
4676 | { | ||
4677 | currSCCB->HostStatus = SCCB_PARITY_ERR; | ||
4678 | WRW_HARPOON((port+hp_intstat), PARITY); | ||
4679 | } | ||
4680 | |||
4681 | FPT_hostDataXferAbort(port,p_card,currSCCB); | ||
4682 | 4403 | ||
4683 | FPT_dataXferProcessor(port, &FPT_BL_Card[p_card]); | 4404 | if (currSCCB->Sccb_scsistat == DATA_IN_ST) { |
4684 | 4405 | ||
4685 | while((!(RD_HARPOON(port+hp_xferstat) & FIFO_EMPTY)) && | 4406 | while ((!(RD_HARPOON(port + hp_xferstat) & FIFO_EMPTY)) && |
4686 | (RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY)) {} | 4407 | (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY)) { |
4408 | } | ||
4687 | 4409 | ||
4688 | } | 4410 | if (!(RD_HARPOON(port + hp_xferstat) & FIFO_EMPTY)) { |
4689 | } /*End Data In specific code. */ | 4411 | currSCCB->Sccb_ATC += currSCCB->Sccb_XferCnt; |
4690 | 4412 | ||
4413 | currSCCB->Sccb_XferCnt = 0; | ||
4691 | 4414 | ||
4415 | if ((RDW_HARPOON((port + hp_intstat)) & PARITY) && | ||
4416 | (currSCCB->HostStatus == SCCB_COMPLETE)) { | ||
4417 | currSCCB->HostStatus = SCCB_PARITY_ERR; | ||
4418 | WRW_HARPOON((port + hp_intstat), PARITY); | ||
4419 | } | ||
4692 | 4420 | ||
4693 | GET_XFER_CNT(port,xfercnt); | 4421 | FPT_hostDataXferAbort(port, p_card, currSCCB); |
4694 | 4422 | ||
4423 | FPT_dataXferProcessor(port, &FPT_BL_Card[p_card]); | ||
4695 | 4424 | ||
4696 | WR_HARPOON(port+hp_xfercnt_0, 0x00); | 4425 | while ((!(RD_HARPOON(port + hp_xferstat) & FIFO_EMPTY)) |
4426 | && (RD_HARPOON(port + hp_ext_status) & | ||
4427 | BM_CMD_BUSY)) { | ||
4428 | } | ||
4697 | 4429 | ||
4430 | } | ||
4431 | } | ||
4698 | 4432 | ||
4699 | WR_HARPOON(port+hp_portctrl_0, 0x00); | 4433 | /*End Data In specific code. */ |
4434 | GET_XFER_CNT(port, xfercnt); | ||
4700 | 4435 | ||
4701 | currSCCB->Sccb_ATC += (currSCCB->Sccb_XferCnt - xfercnt); | 4436 | WR_HARPOON(port + hp_xfercnt_0, 0x00); |
4702 | 4437 | ||
4703 | currSCCB->Sccb_XferCnt = xfercnt; | 4438 | WR_HARPOON(port + hp_portctrl_0, 0x00); |
4704 | 4439 | ||
4705 | if ((RDW_HARPOON((port+hp_intstat)) & PARITY) && | 4440 | currSCCB->Sccb_ATC += (currSCCB->Sccb_XferCnt - xfercnt); |
4706 | (currSCCB->HostStatus == SCCB_COMPLETE)) { | ||
4707 | 4441 | ||
4708 | currSCCB->HostStatus = SCCB_PARITY_ERR; | 4442 | currSCCB->Sccb_XferCnt = xfercnt; |
4709 | WRW_HARPOON((port+hp_intstat), PARITY); | ||
4710 | } | ||
4711 | 4443 | ||
4444 | if ((RDW_HARPOON((port + hp_intstat)) & PARITY) && | ||
4445 | (currSCCB->HostStatus == SCCB_COMPLETE)) { | ||
4712 | 4446 | ||
4713 | FPT_hostDataXferAbort(port,p_card,currSCCB); | 4447 | currSCCB->HostStatus = SCCB_PARITY_ERR; |
4448 | WRW_HARPOON((port + hp_intstat), PARITY); | ||
4449 | } | ||
4714 | 4450 | ||
4451 | FPT_hostDataXferAbort(port, p_card, currSCCB); | ||
4715 | 4452 | ||
4716 | WR_HARPOON(port+hp_fifowrite, 0x00); | 4453 | WR_HARPOON(port + hp_fifowrite, 0x00); |
4717 | WR_HARPOON(port+hp_fiforead, 0x00); | 4454 | WR_HARPOON(port + hp_fiforead, 0x00); |
4718 | WR_HARPOON(port+hp_xferstat, 0x00); | 4455 | WR_HARPOON(port + hp_xferstat, 0x00); |
4719 | 4456 | ||
4720 | WRW_HARPOON((port+hp_intstat), XFER_CNT_0); | 4457 | WRW_HARPOON((port + hp_intstat), XFER_CNT_0); |
4721 | } | 4458 | } |
4722 | 4459 | ||
4723 | |||
4724 | /*--------------------------------------------------------------------- | 4460 | /*--------------------------------------------------------------------- |
4725 | * | 4461 | * |
4726 | * Function: Phase Bus Free | 4462 | * Function: Phase Bus Free |
@@ -4731,94 +4467,92 @@ static void FPT_phaseChkFifo(unsigned long port, unsigned char p_card) | |||
4731 | *---------------------------------------------------------------------*/ | 4467 | *---------------------------------------------------------------------*/ |
4732 | static void FPT_phaseBusFree(unsigned long port, unsigned char p_card) | 4468 | static void FPT_phaseBusFree(unsigned long port, unsigned char p_card) |
4733 | { | 4469 | { |
4734 | struct sccb * currSCCB; | 4470 | struct sccb *currSCCB; |
4735 | |||
4736 | currSCCB = FPT_BL_Card[p_card].currentSCCB; | ||
4737 | 4471 | ||
4738 | if (currSCCB != NULL) | 4472 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
4739 | { | ||
4740 | 4473 | ||
4741 | DISABLE_AUTO(port); | 4474 | if (currSCCB != NULL) { |
4742 | 4475 | ||
4476 | DISABLE_AUTO(port); | ||
4743 | 4477 | ||
4744 | if (currSCCB->OperationCode == RESET_COMMAND) | 4478 | if (currSCCB->OperationCode == RESET_COMMAND) { |
4745 | { | ||
4746 | 4479 | ||
4747 | if((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && | 4480 | if ((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && |
4748 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) | 4481 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID]. |
4749 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = 0; | 4482 | TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) |
4750 | else | 4483 | FPT_sccbMgrTbl[p_card][currSCCB->TargID]. |
4751 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = 0; | 4484 | TarLUNBusy[currSCCB->Lun] = 0; |
4752 | |||
4753 | FPT_queueCmdComplete(&FPT_BL_Card[p_card], currSCCB, p_card); | ||
4754 | |||
4755 | FPT_queueSearchSelect(&FPT_BL_Card[p_card],p_card); | ||
4756 | |||
4757 | } | ||
4758 | |||
4759 | else if(currSCCB->Sccb_scsistat == SELECT_SN_ST) | ||
4760 | { | ||
4761 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus |= | ||
4762 | (unsigned char)SYNC_SUPPORTED; | ||
4763 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &= ~EE_SYNC_MASK; | ||
4764 | } | ||
4765 | |||
4766 | else if(currSCCB->Sccb_scsistat == SELECT_WN_ST) | ||
4767 | { | ||
4768 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus = | ||
4769 | (FPT_sccbMgrTbl[p_card][currSCCB->TargID]. | ||
4770 | TarStatus & ~WIDE_ENABLED) | WIDE_NEGOCIATED; | ||
4771 | |||
4772 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &= ~EE_WIDE_SCSI; | ||
4773 | } | ||
4774 | |||
4775 | else if(currSCCB->Sccb_scsistat == SELECT_Q_ST) | ||
4776 | { | ||
4777 | /* Make sure this is not a phony BUS_FREE. If we were | ||
4778 | reselected or if BUSY is NOT on then this is a | ||
4779 | valid BUS FREE. SRR Wednesday, 5/10/1995. */ | ||
4780 | |||
4781 | if ((!(RD_HARPOON(port+hp_scsisig) & SCSI_BSY)) || | ||
4782 | (RDW_HARPOON((port+hp_intstat)) & RSEL)) | ||
4783 | { | ||
4784 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus &= ~TAR_TAG_Q_MASK; | ||
4785 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus |= TAG_Q_REJECT; | ||
4786 | } | ||
4787 | |||
4788 | else | ||
4789 | { | ||
4790 | return; | ||
4791 | } | ||
4792 | } | ||
4793 | |||
4794 | else | ||
4795 | { | ||
4796 | |||
4797 | currSCCB->Sccb_scsistat = BUS_FREE_ST; | ||
4798 | |||
4799 | if (!currSCCB->HostStatus) | ||
4800 | { | ||
4801 | currSCCB->HostStatus = SCCB_PHASE_SEQUENCE_FAIL; | ||
4802 | } | ||
4803 | |||
4804 | if((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && | ||
4805 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) | ||
4806 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = 0; | ||
4807 | else | 4485 | else |
4808 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = 0; | 4486 | FPT_sccbMgrTbl[p_card][currSCCB->TargID]. |
4487 | TarLUNBusy[0] = 0; | ||
4809 | 4488 | ||
4810 | FPT_queueCmdComplete(&FPT_BL_Card[p_card], currSCCB, p_card); | 4489 | FPT_queueCmdComplete(&FPT_BL_Card[p_card], currSCCB, |
4811 | return; | 4490 | p_card); |
4812 | } | ||
4813 | 4491 | ||
4492 | FPT_queueSearchSelect(&FPT_BL_Card[p_card], p_card); | ||
4814 | 4493 | ||
4815 | FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD; | 4494 | } |
4816 | 4495 | ||
4817 | } /*end if !=null */ | 4496 | else if (currSCCB->Sccb_scsistat == SELECT_SN_ST) { |
4818 | } | 4497 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus |= |
4498 | (unsigned char)SYNC_SUPPORTED; | ||
4499 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &= | ||
4500 | ~EE_SYNC_MASK; | ||
4501 | } | ||
4502 | |||
4503 | else if (currSCCB->Sccb_scsistat == SELECT_WN_ST) { | ||
4504 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus = | ||
4505 | (FPT_sccbMgrTbl[p_card][currSCCB->TargID]. | ||
4506 | TarStatus & ~WIDE_ENABLED) | WIDE_NEGOCIATED; | ||
4507 | |||
4508 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &= | ||
4509 | ~EE_WIDE_SCSI; | ||
4510 | } | ||
4819 | 4511 | ||
4512 | else if (currSCCB->Sccb_scsistat == SELECT_Q_ST) { | ||
4513 | /* Make sure this is not a phony BUS_FREE. If we were | ||
4514 | reselected or if BUSY is NOT on then this is a | ||
4515 | valid BUS FREE. SRR Wednesday, 5/10/1995. */ | ||
4516 | |||
4517 | if ((!(RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) || | ||
4518 | (RDW_HARPOON((port + hp_intstat)) & RSEL)) { | ||
4519 | FPT_sccbMgrTbl[p_card][currSCCB->TargID]. | ||
4520 | TarStatus &= ~TAR_TAG_Q_MASK; | ||
4521 | FPT_sccbMgrTbl[p_card][currSCCB->TargID]. | ||
4522 | TarStatus |= TAG_Q_REJECT; | ||
4523 | } | ||
4524 | |||
4525 | else { | ||
4526 | return; | ||
4527 | } | ||
4528 | } | ||
4820 | 4529 | ||
4530 | else { | ||
4821 | 4531 | ||
4532 | currSCCB->Sccb_scsistat = BUS_FREE_ST; | ||
4533 | |||
4534 | if (!currSCCB->HostStatus) { | ||
4535 | currSCCB->HostStatus = SCCB_PHASE_SEQUENCE_FAIL; | ||
4536 | } | ||
4537 | |||
4538 | if ((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && | ||
4539 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID]. | ||
4540 | TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) | ||
4541 | FPT_sccbMgrTbl[p_card][currSCCB->TargID]. | ||
4542 | TarLUNBusy[currSCCB->Lun] = 0; | ||
4543 | else | ||
4544 | FPT_sccbMgrTbl[p_card][currSCCB->TargID]. | ||
4545 | TarLUNBusy[0] = 0; | ||
4546 | |||
4547 | FPT_queueCmdComplete(&FPT_BL_Card[p_card], currSCCB, | ||
4548 | p_card); | ||
4549 | return; | ||
4550 | } | ||
4551 | |||
4552 | FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD; | ||
4553 | |||
4554 | } /*end if !=null */ | ||
4555 | } | ||
4822 | 4556 | ||
4823 | /*--------------------------------------------------------------------- | 4557 | /*--------------------------------------------------------------------- |
4824 | * | 4558 | * |
@@ -4829,101 +4563,99 @@ static void FPT_phaseBusFree(unsigned long port, unsigned char p_card) | |||
4829 | *---------------------------------------------------------------------*/ | 4563 | *---------------------------------------------------------------------*/ |
4830 | static void FPT_autoLoadDefaultMap(unsigned long p_port) | 4564 | static void FPT_autoLoadDefaultMap(unsigned long p_port) |
4831 | { | 4565 | { |
4832 | unsigned long map_addr; | 4566 | unsigned long map_addr; |
4833 | 4567 | ||
4834 | ARAM_ACCESS(p_port); | 4568 | ARAM_ACCESS(p_port); |
4835 | map_addr = p_port + hp_aramBase; | 4569 | map_addr = p_port + hp_aramBase; |
4836 | 4570 | ||
4837 | WRW_HARPOON(map_addr, (MPM_OP+AMSG_OUT+ 0xC0)); /*ID MESSAGE */ | 4571 | WRW_HARPOON(map_addr, (MPM_OP + AMSG_OUT + 0xC0)); /*ID MESSAGE */ |
4838 | map_addr +=2; | 4572 | map_addr += 2; |
4839 | WRW_HARPOON(map_addr, (MPM_OP+AMSG_OUT+ 0x20)); /*SIMPLE TAG QUEUEING MSG */ | 4573 | WRW_HARPOON(map_addr, (MPM_OP + AMSG_OUT + 0x20)); /*SIMPLE TAG QUEUEING MSG */ |
4840 | map_addr +=2; | 4574 | map_addr += 2; |
4841 | WRW_HARPOON(map_addr, RAT_OP); /*RESET ATTENTION */ | 4575 | WRW_HARPOON(map_addr, RAT_OP); /*RESET ATTENTION */ |
4842 | map_addr +=2; | 4576 | map_addr += 2; |
4843 | WRW_HARPOON(map_addr, (MPM_OP+AMSG_OUT+ 0x00)); /*TAG ID MSG */ | 4577 | WRW_HARPOON(map_addr, (MPM_OP + AMSG_OUT + 0x00)); /*TAG ID MSG */ |
4844 | map_addr +=2; | 4578 | map_addr += 2; |
4845 | WRW_HARPOON(map_addr, (MPM_OP+ACOMMAND+ 0x00)); /*CDB BYTE 0 */ | 4579 | WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00)); /*CDB BYTE 0 */ |
4846 | map_addr +=2; | 4580 | map_addr += 2; |
4847 | WRW_HARPOON(map_addr, (MPM_OP+ACOMMAND+ 0x00)); /*CDB BYTE 1 */ | 4581 | WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00)); /*CDB BYTE 1 */ |
4848 | map_addr +=2; | 4582 | map_addr += 2; |
4849 | WRW_HARPOON(map_addr, (MPM_OP+ACOMMAND+ 0x00)); /*CDB BYTE 2 */ | 4583 | WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00)); /*CDB BYTE 2 */ |
4850 | map_addr +=2; | 4584 | map_addr += 2; |
4851 | WRW_HARPOON(map_addr, (MPM_OP+ACOMMAND+ 0x00)); /*CDB BYTE 3 */ | 4585 | WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00)); /*CDB BYTE 3 */ |
4852 | map_addr +=2; | 4586 | map_addr += 2; |
4853 | WRW_HARPOON(map_addr, (MPM_OP+ACOMMAND+ 0x00)); /*CDB BYTE 4 */ | 4587 | WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00)); /*CDB BYTE 4 */ |
4854 | map_addr +=2; | 4588 | map_addr += 2; |
4855 | WRW_HARPOON(map_addr, (MPM_OP+ACOMMAND+ 0x00)); /*CDB BYTE 5 */ | 4589 | WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00)); /*CDB BYTE 5 */ |
4856 | map_addr +=2; | 4590 | map_addr += 2; |
4857 | WRW_HARPOON(map_addr, (MPM_OP+ACOMMAND+ 0x00)); /*CDB BYTE 6 */ | 4591 | WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00)); /*CDB BYTE 6 */ |
4858 | map_addr +=2; | 4592 | map_addr += 2; |
4859 | WRW_HARPOON(map_addr, (MPM_OP+ACOMMAND+ 0x00)); /*CDB BYTE 7 */ | 4593 | WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00)); /*CDB BYTE 7 */ |
4860 | map_addr +=2; | 4594 | map_addr += 2; |
4861 | WRW_HARPOON(map_addr, (MPM_OP+ACOMMAND+ 0x00)); /*CDB BYTE 8 */ | 4595 | WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00)); /*CDB BYTE 8 */ |
4862 | map_addr +=2; | 4596 | map_addr += 2; |
4863 | WRW_HARPOON(map_addr, (MPM_OP+ACOMMAND+ 0x00)); /*CDB BYTE 9 */ | 4597 | WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00)); /*CDB BYTE 9 */ |
4864 | map_addr +=2; | 4598 | map_addr += 2; |
4865 | WRW_HARPOON(map_addr, (MPM_OP+ACOMMAND+ 0x00)); /*CDB BYTE 10 */ | 4599 | WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00)); /*CDB BYTE 10 */ |
4866 | map_addr +=2; | 4600 | map_addr += 2; |
4867 | WRW_HARPOON(map_addr, (MPM_OP+ACOMMAND+ 0x00)); /*CDB BYTE 11 */ | 4601 | WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00)); /*CDB BYTE 11 */ |
4868 | map_addr +=2; | 4602 | map_addr += 2; |
4869 | WRW_HARPOON(map_addr, (CPE_OP+ADATA_OUT+ DINT)); /*JUMP IF DATA OUT */ | 4603 | WRW_HARPOON(map_addr, (CPE_OP + ADATA_OUT + DINT)); /*JUMP IF DATA OUT */ |
4870 | map_addr +=2; | 4604 | map_addr += 2; |
4871 | WRW_HARPOON(map_addr, (TCB_OP+FIFO_0+ DI)); /*JUMP IF NO DATA IN FIFO */ | 4605 | WRW_HARPOON(map_addr, (TCB_OP + FIFO_0 + DI)); /*JUMP IF NO DATA IN FIFO */ |
4872 | map_addr +=2; /*This means AYNC DATA IN */ | 4606 | map_addr += 2; /*This means AYNC DATA IN */ |
4873 | WRW_HARPOON(map_addr, (SSI_OP+ SSI_IDO_STRT)); /*STOP AND INTERRUPT */ | 4607 | WRW_HARPOON(map_addr, (SSI_OP + SSI_IDO_STRT)); /*STOP AND INTERRUPT */ |
4874 | map_addr +=2; | 4608 | map_addr += 2; |
4875 | WRW_HARPOON(map_addr, (CPE_OP+ADATA_IN+DINT)); /*JUMP IF NOT DATA IN PHZ */ | 4609 | WRW_HARPOON(map_addr, (CPE_OP + ADATA_IN + DINT)); /*JUMP IF NOT DATA IN PHZ */ |
4876 | map_addr +=2; | 4610 | map_addr += 2; |
4877 | WRW_HARPOON(map_addr, (CPN_OP+AMSG_IN+ ST)); /*IF NOT MSG IN CHECK 4 DATA IN */ | 4611 | WRW_HARPOON(map_addr, (CPN_OP + AMSG_IN + ST)); /*IF NOT MSG IN CHECK 4 DATA IN */ |
4878 | map_addr +=2; | 4612 | map_addr += 2; |
4879 | WRW_HARPOON(map_addr, (CRD_OP+SDATA+ 0x02)); /*SAVE DATA PTR MSG? */ | 4613 | WRW_HARPOON(map_addr, (CRD_OP + SDATA + 0x02)); /*SAVE DATA PTR MSG? */ |
4880 | map_addr +=2; | 4614 | map_addr += 2; |
4881 | WRW_HARPOON(map_addr, (BRH_OP+NOT_EQ+ DC)); /*GO CHECK FOR DISCONNECT MSG */ | 4615 | WRW_HARPOON(map_addr, (BRH_OP + NOT_EQ + DC)); /*GO CHECK FOR DISCONNECT MSG */ |
4882 | map_addr +=2; | 4616 | map_addr += 2; |
4883 | WRW_HARPOON(map_addr, (MRR_OP+SDATA+ D_AR1)); /*SAVE DATA PTRS MSG */ | 4617 | WRW_HARPOON(map_addr, (MRR_OP + SDATA + D_AR1)); /*SAVE DATA PTRS MSG */ |
4884 | map_addr +=2; | 4618 | map_addr += 2; |
4885 | WRW_HARPOON(map_addr, (CPN_OP+AMSG_IN+ ST)); /*IF NOT MSG IN CHECK DATA IN */ | 4619 | WRW_HARPOON(map_addr, (CPN_OP + AMSG_IN + ST)); /*IF NOT MSG IN CHECK DATA IN */ |
4886 | map_addr +=2; | 4620 | map_addr += 2; |
4887 | WRW_HARPOON(map_addr, (CRD_OP+SDATA+ 0x04)); /*DISCONNECT MSG? */ | 4621 | WRW_HARPOON(map_addr, (CRD_OP + SDATA + 0x04)); /*DISCONNECT MSG? */ |
4888 | map_addr +=2; | 4622 | map_addr += 2; |
4889 | WRW_HARPOON(map_addr, (BRH_OP+NOT_EQ+ UNKNWN));/*UKNKNOWN MSG */ | 4623 | WRW_HARPOON(map_addr, (BRH_OP + NOT_EQ + UNKNWN)); /*UKNKNOWN MSG */ |
4890 | map_addr +=2; | 4624 | map_addr += 2; |
4891 | WRW_HARPOON(map_addr, (MRR_OP+SDATA+ D_BUCKET));/*XFER DISCONNECT MSG */ | 4625 | WRW_HARPOON(map_addr, (MRR_OP + SDATA + D_BUCKET)); /*XFER DISCONNECT MSG */ |
4892 | map_addr +=2; | 4626 | map_addr += 2; |
4893 | WRW_HARPOON(map_addr, (SSI_OP+ SSI_ITAR_DISC));/*STOP AND INTERRUPT */ | 4627 | WRW_HARPOON(map_addr, (SSI_OP + SSI_ITAR_DISC)); /*STOP AND INTERRUPT */ |
4894 | map_addr +=2; | 4628 | map_addr += 2; |
4895 | WRW_HARPOON(map_addr, (CPN_OP+ASTATUS+ UNKNWN));/*JUMP IF NOT STATUS PHZ. */ | 4629 | WRW_HARPOON(map_addr, (CPN_OP + ASTATUS + UNKNWN)); /*JUMP IF NOT STATUS PHZ. */ |
4896 | map_addr +=2; | 4630 | map_addr += 2; |
4897 | WRW_HARPOON(map_addr, (MRR_OP+SDATA+ D_AR0)); /*GET STATUS BYTE */ | 4631 | WRW_HARPOON(map_addr, (MRR_OP + SDATA + D_AR0)); /*GET STATUS BYTE */ |
4898 | map_addr +=2; | 4632 | map_addr += 2; |
4899 | WRW_HARPOON(map_addr, (CPN_OP+AMSG_IN+ CC)); /*ERROR IF NOT MSG IN PHZ */ | 4633 | WRW_HARPOON(map_addr, (CPN_OP + AMSG_IN + CC)); /*ERROR IF NOT MSG IN PHZ */ |
4900 | map_addr +=2; | 4634 | map_addr += 2; |
4901 | WRW_HARPOON(map_addr, (CRD_OP+SDATA+ 0x00)); /*CHECK FOR CMD COMPLETE MSG. */ | 4635 | WRW_HARPOON(map_addr, (CRD_OP + SDATA + 0x00)); /*CHECK FOR CMD COMPLETE MSG. */ |
4902 | map_addr +=2; | 4636 | map_addr += 2; |
4903 | WRW_HARPOON(map_addr, (BRH_OP+NOT_EQ+ CC)); /*ERROR IF NOT CMD COMPLETE MSG. */ | 4637 | WRW_HARPOON(map_addr, (BRH_OP + NOT_EQ + CC)); /*ERROR IF NOT CMD COMPLETE MSG. */ |
4904 | map_addr +=2; | 4638 | map_addr += 2; |
4905 | WRW_HARPOON(map_addr, (MRR_OP+SDATA+ D_BUCKET));/*GET CMD COMPLETE MSG */ | 4639 | WRW_HARPOON(map_addr, (MRR_OP + SDATA + D_BUCKET)); /*GET CMD COMPLETE MSG */ |
4906 | map_addr +=2; | 4640 | map_addr += 2; |
4907 | WRW_HARPOON(map_addr, (SSI_OP+ SSI_ICMD_COMP));/*END OF COMMAND */ | 4641 | WRW_HARPOON(map_addr, (SSI_OP + SSI_ICMD_COMP)); /*END OF COMMAND */ |
4908 | map_addr +=2; | 4642 | map_addr += 2; |
4909 | 4643 | ||
4910 | WRW_HARPOON(map_addr, (SSI_OP+ SSI_IUNKWN)); /*RECEIVED UNKNOWN MSG BYTE */ | 4644 | WRW_HARPOON(map_addr, (SSI_OP + SSI_IUNKWN)); /*RECEIVED UNKNOWN MSG BYTE */ |
4911 | map_addr +=2; | 4645 | map_addr += 2; |
4912 | WRW_HARPOON(map_addr, (SSI_OP+ SSI_INO_CC)); /*NO COMMAND COMPLETE AFTER STATUS */ | 4646 | WRW_HARPOON(map_addr, (SSI_OP + SSI_INO_CC)); /*NO COMMAND COMPLETE AFTER STATUS */ |
4913 | map_addr +=2; | 4647 | map_addr += 2; |
4914 | WRW_HARPOON(map_addr, (SSI_OP+ SSI_ITICKLE)); /*BIOS Tickled the Mgr */ | 4648 | WRW_HARPOON(map_addr, (SSI_OP + SSI_ITICKLE)); /*BIOS Tickled the Mgr */ |
4915 | map_addr +=2; | 4649 | map_addr += 2; |
4916 | WRW_HARPOON(map_addr, (SSI_OP+ SSI_IRFAIL)); /*EXPECTED ID/TAG MESSAGES AND */ | 4650 | WRW_HARPOON(map_addr, (SSI_OP + SSI_IRFAIL)); /*EXPECTED ID/TAG MESSAGES AND */ |
4917 | map_addr +=2; /* DIDN'T GET ONE */ | 4651 | map_addr += 2; /* DIDN'T GET ONE */ |
4918 | WRW_HARPOON(map_addr, (CRR_OP+AR3+ S_IDREG)); /* comp SCSI SEL ID & AR3*/ | 4652 | WRW_HARPOON(map_addr, (CRR_OP + AR3 + S_IDREG)); /* comp SCSI SEL ID & AR3 */ |
4919 | map_addr +=2; | 4653 | map_addr += 2; |
4920 | WRW_HARPOON(map_addr, (BRH_OP+EQUAL+ 0x00)); /*SEL ID OK then Conti. */ | 4654 | WRW_HARPOON(map_addr, (BRH_OP + EQUAL + 0x00)); /*SEL ID OK then Conti. */ |
4921 | map_addr +=2; | 4655 | map_addr += 2; |
4922 | WRW_HARPOON(map_addr, (SSI_OP+ SSI_INO_CC)); /*NO COMMAND COMPLETE AFTER STATUS */ | 4656 | WRW_HARPOON(map_addr, (SSI_OP + SSI_INO_CC)); /*NO COMMAND COMPLETE AFTER STATUS */ |
4923 | 4657 | ||
4924 | 4658 | SGRAM_ACCESS(p_port); | |
4925 | |||
4926 | SGRAM_ACCESS(p_port); | ||
4927 | } | 4659 | } |
4928 | 4660 | ||
4929 | /*--------------------------------------------------------------------- | 4661 | /*--------------------------------------------------------------------- |
@@ -4937,201 +4669,259 @@ static void FPT_autoLoadDefaultMap(unsigned long p_port) | |||
4937 | 4669 | ||
4938 | static void FPT_autoCmdCmplt(unsigned long p_port, unsigned char p_card) | 4670 | static void FPT_autoCmdCmplt(unsigned long p_port, unsigned char p_card) |
4939 | { | 4671 | { |
4940 | struct sccb * currSCCB; | 4672 | struct sccb *currSCCB; |
4941 | unsigned char status_byte; | 4673 | unsigned char status_byte; |
4942 | |||
4943 | currSCCB = FPT_BL_Card[p_card].currentSCCB; | ||
4944 | 4674 | ||
4945 | status_byte = RD_HARPOON(p_port+hp_gp_reg_0); | 4675 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
4946 | 4676 | ||
4947 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUN_CA = 0; | 4677 | status_byte = RD_HARPOON(p_port + hp_gp_reg_0); |
4948 | 4678 | ||
4949 | if (status_byte != SSGOOD) { | 4679 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUN_CA = 0; |
4950 | 4680 | ||
4951 | if (status_byte == SSQ_FULL) { | 4681 | if (status_byte != SSGOOD) { |
4952 | 4682 | ||
4683 | if (status_byte == SSQ_FULL) { | ||
4953 | 4684 | ||
4954 | if(((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && | 4685 | if (((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && |
4955 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) | 4686 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID]. |
4956 | { | 4687 | TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) { |
4957 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = 1; | 4688 | FPT_sccbMgrTbl[p_card][currSCCB->TargID]. |
4958 | if(FPT_BL_Card[p_card].discQCount != 0) | 4689 | TarLUNBusy[currSCCB->Lun] = 1; |
4690 | if (FPT_BL_Card[p_card].discQCount != 0) | ||
4959 | FPT_BL_Card[p_card].discQCount--; | 4691 | FPT_BL_Card[p_card].discQCount--; |
4960 | FPT_BL_Card[p_card].discQ_Tbl[FPT_sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[currSCCB->Lun]] = NULL; | 4692 | FPT_BL_Card[p_card]. |
4961 | } | 4693 | discQ_Tbl[FPT_sccbMgrTbl[p_card] |
4962 | else | 4694 | [currSCCB->TargID]. |
4963 | { | 4695 | LunDiscQ_Idx[currSCCB->Lun]] = |
4964 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = 1; | 4696 | NULL; |
4965 | if(currSCCB->Sccb_tag) | 4697 | } else { |
4966 | { | 4698 | FPT_sccbMgrTbl[p_card][currSCCB->TargID]. |
4967 | if(FPT_BL_Card[p_card].discQCount != 0) | 4699 | TarLUNBusy[0] = 1; |
4968 | FPT_BL_Card[p_card].discQCount--; | 4700 | if (currSCCB->Sccb_tag) { |
4969 | FPT_BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] = NULL; | 4701 | if (FPT_BL_Card[p_card].discQCount != 0) |
4970 | }else | 4702 | FPT_BL_Card[p_card]. |
4971 | { | 4703 | discQCount--; |
4972 | if(FPT_BL_Card[p_card].discQCount != 0) | 4704 | FPT_BL_Card[p_card].discQ_Tbl[currSCCB-> |
4973 | FPT_BL_Card[p_card].discQCount--; | 4705 | Sccb_tag] |
4974 | FPT_BL_Card[p_card].discQ_Tbl[FPT_sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[0]] = NULL; | 4706 | = NULL; |
4707 | } else { | ||
4708 | if (FPT_BL_Card[p_card].discQCount != 0) | ||
4709 | FPT_BL_Card[p_card]. | ||
4710 | discQCount--; | ||
4711 | FPT_BL_Card[p_card]. | ||
4712 | discQ_Tbl[FPT_sccbMgrTbl[p_card] | ||
4713 | [currSCCB->TargID]. | ||
4714 | LunDiscQ_Idx[0]] = NULL; | ||
4975 | } | 4715 | } |
4976 | } | 4716 | } |
4977 | 4717 | ||
4978 | currSCCB->Sccb_MGRFlags |= F_STATUSLOADED; | 4718 | currSCCB->Sccb_MGRFlags |= F_STATUSLOADED; |
4979 | 4719 | ||
4980 | FPT_queueSelectFail(&FPT_BL_Card[p_card],p_card); | 4720 | FPT_queueSelectFail(&FPT_BL_Card[p_card], p_card); |
4981 | 4721 | ||
4982 | return; | 4722 | return; |
4983 | } | 4723 | } |
4984 | 4724 | ||
4985 | if(currSCCB->Sccb_scsistat == SELECT_SN_ST) | 4725 | if (currSCCB->Sccb_scsistat == SELECT_SN_ST) { |
4986 | { | 4726 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus |= |
4987 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus |= | 4727 | (unsigned char)SYNC_SUPPORTED; |
4988 | (unsigned char)SYNC_SUPPORTED; | ||
4989 | 4728 | ||
4990 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &= ~EE_SYNC_MASK; | 4729 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &= |
4991 | FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD; | 4730 | ~EE_SYNC_MASK; |
4731 | FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD; | ||
4992 | 4732 | ||
4993 | if(((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && | 4733 | if (((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && |
4994 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) | 4734 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID]. |
4995 | { | 4735 | TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) { |
4996 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = 1; | 4736 | FPT_sccbMgrTbl[p_card][currSCCB->TargID]. |
4997 | if(FPT_BL_Card[p_card].discQCount != 0) | 4737 | TarLUNBusy[currSCCB->Lun] = 1; |
4738 | if (FPT_BL_Card[p_card].discQCount != 0) | ||
4998 | FPT_BL_Card[p_card].discQCount--; | 4739 | FPT_BL_Card[p_card].discQCount--; |
4999 | FPT_BL_Card[p_card].discQ_Tbl[FPT_sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[currSCCB->Lun]] = NULL; | 4740 | FPT_BL_Card[p_card]. |
5000 | } | 4741 | discQ_Tbl[FPT_sccbMgrTbl[p_card] |
5001 | else | 4742 | [currSCCB->TargID]. |
5002 | { | 4743 | LunDiscQ_Idx[currSCCB->Lun]] = |
5003 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = 1; | 4744 | NULL; |
5004 | if(currSCCB->Sccb_tag) | 4745 | } else { |
5005 | { | 4746 | FPT_sccbMgrTbl[p_card][currSCCB->TargID]. |
5006 | if(FPT_BL_Card[p_card].discQCount != 0) | 4747 | TarLUNBusy[0] = 1; |
5007 | FPT_BL_Card[p_card].discQCount--; | 4748 | if (currSCCB->Sccb_tag) { |
5008 | FPT_BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] = NULL; | 4749 | if (FPT_BL_Card[p_card].discQCount != 0) |
5009 | }else | 4750 | FPT_BL_Card[p_card]. |
5010 | { | 4751 | discQCount--; |
5011 | if(FPT_BL_Card[p_card].discQCount != 0) | 4752 | FPT_BL_Card[p_card].discQ_Tbl[currSCCB-> |
5012 | FPT_BL_Card[p_card].discQCount--; | 4753 | Sccb_tag] |
5013 | FPT_BL_Card[p_card].discQ_Tbl[FPT_sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[0]] = NULL; | 4754 | = NULL; |
4755 | } else { | ||
4756 | if (FPT_BL_Card[p_card].discQCount != 0) | ||
4757 | FPT_BL_Card[p_card]. | ||
4758 | discQCount--; | ||
4759 | FPT_BL_Card[p_card]. | ||
4760 | discQ_Tbl[FPT_sccbMgrTbl[p_card] | ||
4761 | [currSCCB->TargID]. | ||
4762 | LunDiscQ_Idx[0]] = NULL; | ||
5014 | } | 4763 | } |
5015 | } | 4764 | } |
5016 | return; | 4765 | return; |
5017 | 4766 | ||
5018 | } | 4767 | } |
5019 | 4768 | ||
5020 | if(currSCCB->Sccb_scsistat == SELECT_WN_ST) | 4769 | if (currSCCB->Sccb_scsistat == SELECT_WN_ST) { |
5021 | { | ||
5022 | 4770 | ||
5023 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus = | 4771 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus = |
5024 | (FPT_sccbMgrTbl[p_card][currSCCB->TargID]. | 4772 | (FPT_sccbMgrTbl[p_card][currSCCB->TargID]. |
5025 | TarStatus & ~WIDE_ENABLED) | WIDE_NEGOCIATED; | 4773 | TarStatus & ~WIDE_ENABLED) | WIDE_NEGOCIATED; |
5026 | 4774 | ||
5027 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &= ~EE_WIDE_SCSI; | 4775 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &= |
5028 | FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD; | 4776 | ~EE_WIDE_SCSI; |
4777 | FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD; | ||
5029 | 4778 | ||
5030 | if(((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && | 4779 | if (((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && |
5031 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) | 4780 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID]. |
5032 | { | 4781 | TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) { |
5033 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = 1; | 4782 | FPT_sccbMgrTbl[p_card][currSCCB->TargID]. |
5034 | if(FPT_BL_Card[p_card].discQCount != 0) | 4783 | TarLUNBusy[currSCCB->Lun] = 1; |
4784 | if (FPT_BL_Card[p_card].discQCount != 0) | ||
5035 | FPT_BL_Card[p_card].discQCount--; | 4785 | FPT_BL_Card[p_card].discQCount--; |
5036 | FPT_BL_Card[p_card].discQ_Tbl[FPT_sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[currSCCB->Lun]] = NULL; | 4786 | FPT_BL_Card[p_card]. |
5037 | } | 4787 | discQ_Tbl[FPT_sccbMgrTbl[p_card] |
5038 | else | 4788 | [currSCCB->TargID]. |
5039 | { | 4789 | LunDiscQ_Idx[currSCCB->Lun]] = |
5040 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = 1; | 4790 | NULL; |
5041 | if(currSCCB->Sccb_tag) | 4791 | } else { |
5042 | { | 4792 | FPT_sccbMgrTbl[p_card][currSCCB->TargID]. |
5043 | if(FPT_BL_Card[p_card].discQCount != 0) | 4793 | TarLUNBusy[0] = 1; |
5044 | FPT_BL_Card[p_card].discQCount--; | 4794 | if (currSCCB->Sccb_tag) { |
5045 | FPT_BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] = NULL; | 4795 | if (FPT_BL_Card[p_card].discQCount != 0) |
5046 | }else | 4796 | FPT_BL_Card[p_card]. |
5047 | { | 4797 | discQCount--; |
5048 | if(FPT_BL_Card[p_card].discQCount != 0) | 4798 | FPT_BL_Card[p_card].discQ_Tbl[currSCCB-> |
5049 | FPT_BL_Card[p_card].discQCount--; | 4799 | Sccb_tag] |
5050 | FPT_BL_Card[p_card].discQ_Tbl[FPT_sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[0]] = NULL; | 4800 | = NULL; |
4801 | } else { | ||
4802 | if (FPT_BL_Card[p_card].discQCount != 0) | ||
4803 | FPT_BL_Card[p_card]. | ||
4804 | discQCount--; | ||
4805 | FPT_BL_Card[p_card]. | ||
4806 | discQ_Tbl[FPT_sccbMgrTbl[p_card] | ||
4807 | [currSCCB->TargID]. | ||
4808 | LunDiscQ_Idx[0]] = NULL; | ||
5051 | } | 4809 | } |
5052 | } | 4810 | } |
5053 | return; | 4811 | return; |
5054 | 4812 | ||
5055 | } | 4813 | } |
5056 | 4814 | ||
5057 | if (status_byte == SSCHECK) | 4815 | if (status_byte == SSCHECK) { |
5058 | { | 4816 | if (FPT_BL_Card[p_card].globalFlags & F_DO_RENEGO) { |
5059 | if(FPT_BL_Card[p_card].globalFlags & F_DO_RENEGO) | 4817 | if (FPT_sccbMgrTbl[p_card][currSCCB->TargID]. |
5060 | { | 4818 | TarEEValue & EE_SYNC_MASK) { |
5061 | if (FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue & EE_SYNC_MASK) | 4819 | FPT_sccbMgrTbl[p_card][currSCCB-> |
5062 | { | 4820 | TargID]. |
5063 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus &= ~TAR_SYNC_MASK; | 4821 | TarStatus &= ~TAR_SYNC_MASK; |
5064 | } | 4822 | } |
5065 | if (FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue & EE_WIDE_SCSI) | 4823 | if (FPT_sccbMgrTbl[p_card][currSCCB->TargID]. |
5066 | { | 4824 | TarEEValue & EE_WIDE_SCSI) { |
5067 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus &= ~TAR_WIDE_MASK; | 4825 | FPT_sccbMgrTbl[p_card][currSCCB-> |
4826 | TargID]. | ||
4827 | TarStatus &= ~TAR_WIDE_MASK; | ||
5068 | } | 4828 | } |
5069 | } | 4829 | } |
5070 | } | 4830 | } |
5071 | 4831 | ||
5072 | if (!(currSCCB->Sccb_XferState & F_AUTO_SENSE)) { | 4832 | if (!(currSCCB->Sccb_XferState & F_AUTO_SENSE)) { |
5073 | 4833 | ||
5074 | currSCCB->SccbStatus = SCCB_ERROR; | 4834 | currSCCB->SccbStatus = SCCB_ERROR; |
5075 | currSCCB->TargetStatus = status_byte; | 4835 | currSCCB->TargetStatus = status_byte; |
5076 | 4836 | ||
5077 | if (status_byte == SSCHECK) { | 4837 | if (status_byte == SSCHECK) { |
5078 | 4838 | ||
5079 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUN_CA | 4839 | FPT_sccbMgrTbl[p_card][currSCCB->TargID]. |
5080 | = 1; | 4840 | TarLUN_CA = 1; |
5081 | 4841 | ||
5082 | 4842 | if (currSCCB->RequestSenseLength != | |
5083 | if (currSCCB->RequestSenseLength != NO_AUTO_REQUEST_SENSE) { | 4843 | NO_AUTO_REQUEST_SENSE) { |
5084 | 4844 | ||
5085 | if (currSCCB->RequestSenseLength == 0) | 4845 | if (currSCCB->RequestSenseLength == 0) |
5086 | currSCCB->RequestSenseLength = 14; | 4846 | currSCCB->RequestSenseLength = |
5087 | 4847 | 14; | |
5088 | FPT_ssenss(&FPT_BL_Card[p_card]); | 4848 | |
5089 | FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD; | 4849 | FPT_ssenss(&FPT_BL_Card[p_card]); |
5090 | 4850 | FPT_BL_Card[p_card].globalFlags |= | |
5091 | if(((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && | 4851 | F_NEW_SCCB_CMD; |
5092 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) | 4852 | |
5093 | { | 4853 | if (((FPT_BL_Card[p_card]. |
5094 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = 1; | 4854 | globalFlags & F_CONLUN_IO) |
5095 | if(FPT_BL_Card[p_card].discQCount != 0) | 4855 | && |
5096 | FPT_BL_Card[p_card].discQCount--; | 4856 | ((FPT_sccbMgrTbl[p_card] |
5097 | FPT_BL_Card[p_card].discQ_Tbl[FPT_sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[currSCCB->Lun]] = NULL; | 4857 | [currSCCB->TargID]. |
5098 | } | 4858 | TarStatus & TAR_TAG_Q_MASK) != |
5099 | else | 4859 | TAG_Q_TRYING))) { |
5100 | { | 4860 | FPT_sccbMgrTbl[p_card] |
5101 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = 1; | 4861 | [currSCCB->TargID]. |
5102 | if(currSCCB->Sccb_tag) | 4862 | TarLUNBusy[currSCCB->Lun] = |
5103 | { | 4863 | 1; |
5104 | if(FPT_BL_Card[p_card].discQCount != 0) | 4864 | if (FPT_BL_Card[p_card]. |
5105 | FPT_BL_Card[p_card].discQCount--; | 4865 | discQCount != 0) |
5106 | FPT_BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] = NULL; | 4866 | FPT_BL_Card[p_card]. |
5107 | }else | 4867 | discQCount--; |
5108 | { | 4868 | FPT_BL_Card[p_card]. |
5109 | if(FPT_BL_Card[p_card].discQCount != 0) | 4869 | discQ_Tbl[FPT_sccbMgrTbl |
5110 | FPT_BL_Card[p_card].discQCount--; | 4870 | [p_card] |
5111 | FPT_BL_Card[p_card].discQ_Tbl[FPT_sccbMgrTbl[p_card][currSCCB->TargID].LunDiscQ_Idx[0]] = NULL; | 4871 | [currSCCB-> |
4872 | TargID]. | ||
4873 | LunDiscQ_Idx | ||
4874 | [currSCCB->Lun]] = | ||
4875 | NULL; | ||
4876 | } else { | ||
4877 | FPT_sccbMgrTbl[p_card] | ||
4878 | [currSCCB->TargID]. | ||
4879 | TarLUNBusy[0] = 1; | ||
4880 | if (currSCCB->Sccb_tag) { | ||
4881 | if (FPT_BL_Card[p_card]. | ||
4882 | discQCount != 0) | ||
4883 | FPT_BL_Card | ||
4884 | [p_card]. | ||
4885 | discQCount--; | ||
4886 | FPT_BL_Card[p_card]. | ||
4887 | discQ_Tbl[currSCCB-> | ||
4888 | Sccb_tag] | ||
4889 | = NULL; | ||
4890 | } else { | ||
4891 | if (FPT_BL_Card[p_card]. | ||
4892 | discQCount != 0) | ||
4893 | FPT_BL_Card | ||
4894 | [p_card]. | ||
4895 | discQCount--; | ||
4896 | FPT_BL_Card[p_card]. | ||
4897 | discQ_Tbl | ||
4898 | [FPT_sccbMgrTbl | ||
4899 | [p_card][currSCCB-> | ||
4900 | TargID]. | ||
4901 | LunDiscQ_Idx[0]] = | ||
4902 | NULL; | ||
5112 | } | 4903 | } |
5113 | } | 4904 | } |
5114 | return; | 4905 | return; |
5115 | } | 4906 | } |
5116 | } | 4907 | } |
5117 | } | 4908 | } |
5118 | } | 4909 | } |
5119 | |||
5120 | 4910 | ||
5121 | if((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && | 4911 | if ((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && |
5122 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) | 4912 | ((FPT_sccbMgrTbl[p_card][currSCCB->TargID]. |
5123 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->Lun] = 0; | 4913 | TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) |
4914 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB-> | ||
4915 | Lun] = 0; | ||
5124 | else | 4916 | else |
5125 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = 0; | 4917 | FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = 0; |
5126 | |||
5127 | 4918 | ||
5128 | FPT_queueCmdComplete(&FPT_BL_Card[p_card], currSCCB, p_card); | 4919 | FPT_queueCmdComplete(&FPT_BL_Card[p_card], currSCCB, p_card); |
5129 | } | 4920 | } |
5130 | 4921 | ||
5131 | #define SHORT_WAIT 0x0000000F | 4922 | #define SHORT_WAIT 0x0000000F |
5132 | #define LONG_WAIT 0x0000FFFFL | 4923 | #define LONG_WAIT 0x0000FFFFL |
5133 | 4924 | ||
5134 | |||
5135 | /*--------------------------------------------------------------------- | 4925 | /*--------------------------------------------------------------------- |
5136 | * | 4926 | * |
5137 | * Function: Data Transfer Processor | 4927 | * Function: Data Transfer Processor |
@@ -5150,37 +4940,33 @@ static void FPT_autoCmdCmplt(unsigned long p_port, unsigned char p_card) | |||
5150 | * | 4940 | * |
5151 | *---------------------------------------------------------------------*/ | 4941 | *---------------------------------------------------------------------*/ |
5152 | 4942 | ||
5153 | static void FPT_dataXferProcessor(unsigned long port, struct sccb_card * pCurrCard) | 4943 | static void FPT_dataXferProcessor(unsigned long port, |
4944 | struct sccb_card *pCurrCard) | ||
5154 | { | 4945 | { |
5155 | struct sccb * currSCCB; | 4946 | struct sccb *currSCCB; |
5156 | 4947 | ||
5157 | currSCCB = pCurrCard->currentSCCB; | 4948 | currSCCB = pCurrCard->currentSCCB; |
5158 | 4949 | ||
5159 | if (currSCCB->Sccb_XferState & F_SG_XFER) | 4950 | if (currSCCB->Sccb_XferState & F_SG_XFER) { |
5160 | { | 4951 | if (pCurrCard->globalFlags & F_HOST_XFER_ACT) |
5161 | if (pCurrCard->globalFlags & F_HOST_XFER_ACT) | 4952 | { |
4953 | currSCCB->Sccb_sgseg += (unsigned char)SG_BUF_CNT; | ||
4954 | currSCCB->Sccb_SGoffset = 0x00; | ||
4955 | } | ||
4956 | pCurrCard->globalFlags |= F_HOST_XFER_ACT; | ||
5162 | 4957 | ||
5163 | { | 4958 | FPT_busMstrSGDataXferStart(port, currSCCB); |
5164 | currSCCB->Sccb_sgseg += (unsigned char)SG_BUF_CNT; | 4959 | } |
5165 | currSCCB->Sccb_SGoffset = 0x00; | 4960 | |
5166 | } | 4961 | else { |
4962 | if (!(pCurrCard->globalFlags & F_HOST_XFER_ACT)) { | ||
5167 | pCurrCard->globalFlags |= F_HOST_XFER_ACT; | 4963 | pCurrCard->globalFlags |= F_HOST_XFER_ACT; |
5168 | |||
5169 | FPT_busMstrSGDataXferStart(port, currSCCB); | ||
5170 | } | ||
5171 | 4964 | ||
5172 | else | 4965 | FPT_busMstrDataXferStart(port, currSCCB); |
5173 | { | 4966 | } |
5174 | if (!(pCurrCard->globalFlags & F_HOST_XFER_ACT)) | 4967 | } |
5175 | { | ||
5176 | pCurrCard->globalFlags |= F_HOST_XFER_ACT; | ||
5177 | |||
5178 | FPT_busMstrDataXferStart(port, currSCCB); | ||
5179 | } | ||
5180 | } | ||
5181 | } | 4968 | } |
5182 | 4969 | ||
5183 | |||
5184 | /*--------------------------------------------------------------------- | 4970 | /*--------------------------------------------------------------------- |
5185 | * | 4971 | * |
5186 | * Function: BusMaster Scatter Gather Data Transfer Start | 4972 | * Function: BusMaster Scatter Gather Data Transfer Start |
@@ -5188,104 +4974,101 @@ static void FPT_dataXferProcessor(unsigned long port, struct sccb_card * pCurrCa | |||
5188 | * Description: | 4974 | * Description: |
5189 | * | 4975 | * |
5190 | *---------------------------------------------------------------------*/ | 4976 | *---------------------------------------------------------------------*/ |
5191 | static void FPT_busMstrSGDataXferStart(unsigned long p_port, struct sccb * pcurrSCCB) | 4977 | static void FPT_busMstrSGDataXferStart(unsigned long p_port, |
4978 | struct sccb *pcurrSCCB) | ||
5192 | { | 4979 | { |
5193 | unsigned long count,addr,tmpSGCnt; | 4980 | unsigned long count, addr, tmpSGCnt; |
5194 | unsigned int sg_index; | 4981 | unsigned int sg_index; |
5195 | unsigned char sg_count, i; | 4982 | unsigned char sg_count, i; |
5196 | unsigned long reg_offset; | 4983 | unsigned long reg_offset; |
5197 | |||
5198 | |||
5199 | if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR) { | ||
5200 | |||
5201 | count = ((unsigned long) HOST_RD_CMD)<<24; | ||
5202 | } | ||
5203 | |||
5204 | else { | ||
5205 | count = ((unsigned long) HOST_WRT_CMD)<<24; | ||
5206 | } | ||
5207 | 4984 | ||
5208 | sg_count = 0; | 4985 | if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR) { |
5209 | tmpSGCnt = 0; | ||
5210 | sg_index = pcurrSCCB->Sccb_sgseg; | ||
5211 | reg_offset = hp_aramBase; | ||
5212 | 4986 | ||
4987 | count = ((unsigned long)HOST_RD_CMD) << 24; | ||
4988 | } | ||
5213 | 4989 | ||
5214 | i = (unsigned char) (RD_HARPOON(p_port+hp_page_ctrl) & ~(SGRAM_ARAM|SCATTER_EN)); | 4990 | else { |
5215 | 4991 | count = ((unsigned long)HOST_WRT_CMD) << 24; | |
5216 | 4992 | } | |
5217 | WR_HARPOON(p_port+hp_page_ctrl, i); | ||
5218 | |||
5219 | while ((sg_count < (unsigned char)SG_BUF_CNT) && | ||
5220 | ((unsigned long)(sg_index * (unsigned int)SG_ELEMENT_SIZE) < pcurrSCCB->DataLength) ) { | ||
5221 | |||
5222 | tmpSGCnt += *(((unsigned long *)pcurrSCCB->DataPointer)+ | ||
5223 | (sg_index * 2)); | ||
5224 | 4993 | ||
5225 | count |= *(((unsigned long *)pcurrSCCB->DataPointer)+ | 4994 | sg_count = 0; |
5226 | (sg_index * 2)); | 4995 | tmpSGCnt = 0; |
4996 | sg_index = pcurrSCCB->Sccb_sgseg; | ||
4997 | reg_offset = hp_aramBase; | ||
5227 | 4998 | ||
5228 | addr = *(((unsigned long *)pcurrSCCB->DataPointer)+ | 4999 | i = (unsigned char)(RD_HARPOON(p_port + hp_page_ctrl) & |
5229 | ((sg_index * 2) + 1)); | 5000 | ~(SGRAM_ARAM | SCATTER_EN)); |
5230 | 5001 | ||
5002 | WR_HARPOON(p_port + hp_page_ctrl, i); | ||
5231 | 5003 | ||
5232 | if ((!sg_count) && (pcurrSCCB->Sccb_SGoffset)) { | 5004 | while ((sg_count < (unsigned char)SG_BUF_CNT) && |
5005 | ((unsigned long)(sg_index * (unsigned int)SG_ELEMENT_SIZE) < | ||
5006 | pcurrSCCB->DataLength)) { | ||
5233 | 5007 | ||
5234 | addr += ((count & 0x00FFFFFFL) - pcurrSCCB->Sccb_SGoffset); | 5008 | tmpSGCnt += *(((unsigned long *)pcurrSCCB->DataPointer) + |
5235 | count = (count & 0xFF000000L) | pcurrSCCB->Sccb_SGoffset; | 5009 | (sg_index * 2)); |
5236 | 5010 | ||
5237 | tmpSGCnt = count & 0x00FFFFFFL; | 5011 | count |= *(((unsigned long *)pcurrSCCB->DataPointer) + |
5238 | } | 5012 | (sg_index * 2)); |
5239 | 5013 | ||
5240 | WR_HARP32(p_port,reg_offset,addr); | 5014 | addr = *(((unsigned long *)pcurrSCCB->DataPointer) + |
5241 | reg_offset +=4; | 5015 | ((sg_index * 2) + 1)); |
5242 | 5016 | ||
5243 | WR_HARP32(p_port,reg_offset,count); | 5017 | if ((!sg_count) && (pcurrSCCB->Sccb_SGoffset)) { |
5244 | reg_offset +=4; | ||
5245 | 5018 | ||
5246 | count &= 0xFF000000L; | 5019 | addr += |
5247 | sg_index++; | 5020 | ((count & 0x00FFFFFFL) - pcurrSCCB->Sccb_SGoffset); |
5248 | sg_count++; | 5021 | count = |
5022 | (count & 0xFF000000L) | pcurrSCCB->Sccb_SGoffset; | ||
5249 | 5023 | ||
5250 | } /*End While */ | 5024 | tmpSGCnt = count & 0x00FFFFFFL; |
5025 | } | ||
5251 | 5026 | ||
5252 | pcurrSCCB->Sccb_XferCnt = tmpSGCnt; | 5027 | WR_HARP32(p_port, reg_offset, addr); |
5028 | reg_offset += 4; | ||
5253 | 5029 | ||
5254 | WR_HARPOON(p_port+hp_sg_addr,(sg_count<<4)); | 5030 | WR_HARP32(p_port, reg_offset, count); |
5031 | reg_offset += 4; | ||
5255 | 5032 | ||
5256 | if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR) { | 5033 | count &= 0xFF000000L; |
5034 | sg_index++; | ||
5035 | sg_count++; | ||
5257 | 5036 | ||
5258 | WR_HARP32(p_port,hp_xfercnt_0,tmpSGCnt); | 5037 | } /*End While */ |
5259 | 5038 | ||
5039 | pcurrSCCB->Sccb_XferCnt = tmpSGCnt; | ||
5260 | 5040 | ||
5261 | WR_HARPOON(p_port+hp_portctrl_0,(DMA_PORT | SCSI_PORT | SCSI_INBIT)); | 5041 | WR_HARPOON(p_port + hp_sg_addr, (sg_count << 4)); |
5262 | WR_HARPOON(p_port+hp_scsisig, S_DATAI_PH); | ||
5263 | } | ||
5264 | 5042 | ||
5265 | else { | 5043 | if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR) { |
5266 | 5044 | ||
5045 | WR_HARP32(p_port, hp_xfercnt_0, tmpSGCnt); | ||
5267 | 5046 | ||
5268 | if ((!(RD_HARPOON(p_port+hp_synctarg_0) & NARROW_SCSI)) && | 5047 | WR_HARPOON(p_port + hp_portctrl_0, |
5269 | (tmpSGCnt & 0x000000001)) | 5048 | (DMA_PORT | SCSI_PORT | SCSI_INBIT)); |
5270 | { | 5049 | WR_HARPOON(p_port + hp_scsisig, S_DATAI_PH); |
5050 | } | ||
5271 | 5051 | ||
5272 | pcurrSCCB->Sccb_XferState |= F_ODD_BALL_CNT; | 5052 | else { |
5273 | tmpSGCnt--; | ||
5274 | } | ||
5275 | 5053 | ||
5054 | if ((!(RD_HARPOON(p_port + hp_synctarg_0) & NARROW_SCSI)) && | ||
5055 | (tmpSGCnt & 0x000000001)) { | ||
5276 | 5056 | ||
5277 | WR_HARP32(p_port,hp_xfercnt_0,tmpSGCnt); | 5057 | pcurrSCCB->Sccb_XferState |= F_ODD_BALL_CNT; |
5058 | tmpSGCnt--; | ||
5059 | } | ||
5278 | 5060 | ||
5279 | WR_HARPOON(p_port+hp_portctrl_0,(SCSI_PORT | DMA_PORT | DMA_RD)); | 5061 | WR_HARP32(p_port, hp_xfercnt_0, tmpSGCnt); |
5280 | WR_HARPOON(p_port+hp_scsisig, S_DATAO_PH); | ||
5281 | } | ||
5282 | 5062 | ||
5063 | WR_HARPOON(p_port + hp_portctrl_0, | ||
5064 | (SCSI_PORT | DMA_PORT | DMA_RD)); | ||
5065 | WR_HARPOON(p_port + hp_scsisig, S_DATAO_PH); | ||
5066 | } | ||
5283 | 5067 | ||
5284 | WR_HARPOON(p_port+hp_page_ctrl, (unsigned char) (i | SCATTER_EN)); | 5068 | WR_HARPOON(p_port + hp_page_ctrl, (unsigned char)(i | SCATTER_EN)); |
5285 | 5069 | ||
5286 | } | 5070 | } |
5287 | 5071 | ||
5288 | |||
5289 | /*--------------------------------------------------------------------- | 5072 | /*--------------------------------------------------------------------- |
5290 | * | 5073 | * |
5291 | * Function: BusMaster Data Transfer Start | 5074 | * Function: BusMaster Data Transfer Start |
@@ -5293,47 +5076,49 @@ static void FPT_busMstrSGDataXferStart(unsigned long p_port, struct sccb * pcurr | |||
5293 | * Description: | 5076 | * Description: |
5294 | * | 5077 | * |
5295 | *---------------------------------------------------------------------*/ | 5078 | *---------------------------------------------------------------------*/ |
5296 | static void FPT_busMstrDataXferStart(unsigned long p_port, struct sccb * pcurrSCCB) | 5079 | static void FPT_busMstrDataXferStart(unsigned long p_port, |
5080 | struct sccb *pcurrSCCB) | ||
5297 | { | 5081 | { |
5298 | unsigned long addr,count; | 5082 | unsigned long addr, count; |
5299 | |||
5300 | if (!(pcurrSCCB->Sccb_XferState & F_AUTO_SENSE)) { | ||
5301 | 5083 | ||
5302 | count = pcurrSCCB->Sccb_XferCnt; | 5084 | if (!(pcurrSCCB->Sccb_XferState & F_AUTO_SENSE)) { |
5303 | 5085 | ||
5304 | addr = (unsigned long) pcurrSCCB->DataPointer + pcurrSCCB->Sccb_ATC; | 5086 | count = pcurrSCCB->Sccb_XferCnt; |
5305 | } | ||
5306 | 5087 | ||
5307 | else { | 5088 | addr = |
5308 | addr = pcurrSCCB->SensePointer; | 5089 | (unsigned long)pcurrSCCB->DataPointer + pcurrSCCB->Sccb_ATC; |
5309 | count = pcurrSCCB->RequestSenseLength; | 5090 | } |
5310 | 5091 | ||
5311 | } | 5092 | else { |
5093 | addr = pcurrSCCB->SensePointer; | ||
5094 | count = pcurrSCCB->RequestSenseLength; | ||
5312 | 5095 | ||
5313 | HP_SETUP_ADDR_CNT(p_port,addr,count); | 5096 | } |
5314 | 5097 | ||
5098 | HP_SETUP_ADDR_CNT(p_port, addr, count); | ||
5315 | 5099 | ||
5316 | if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR) { | 5100 | if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR) { |
5317 | 5101 | ||
5318 | WR_HARPOON(p_port+hp_portctrl_0,(DMA_PORT | SCSI_PORT | SCSI_INBIT)); | 5102 | WR_HARPOON(p_port + hp_portctrl_0, |
5319 | WR_HARPOON(p_port+hp_scsisig, S_DATAI_PH); | 5103 | (DMA_PORT | SCSI_PORT | SCSI_INBIT)); |
5104 | WR_HARPOON(p_port + hp_scsisig, S_DATAI_PH); | ||
5320 | 5105 | ||
5321 | WR_HARPOON(p_port+hp_xfer_cmd, | 5106 | WR_HARPOON(p_port + hp_xfer_cmd, |
5322 | (XFER_DMA_HOST | XFER_HOST_AUTO | XFER_DMA_8BIT)); | 5107 | (XFER_DMA_HOST | XFER_HOST_AUTO | XFER_DMA_8BIT)); |
5323 | } | 5108 | } |
5324 | 5109 | ||
5325 | else { | 5110 | else { |
5326 | 5111 | ||
5327 | WR_HARPOON(p_port+hp_portctrl_0,(SCSI_PORT | DMA_PORT | DMA_RD)); | 5112 | WR_HARPOON(p_port + hp_portctrl_0, |
5328 | WR_HARPOON(p_port+hp_scsisig, S_DATAO_PH); | 5113 | (SCSI_PORT | DMA_PORT | DMA_RD)); |
5114 | WR_HARPOON(p_port + hp_scsisig, S_DATAO_PH); | ||
5329 | 5115 | ||
5330 | WR_HARPOON(p_port+hp_xfer_cmd, | 5116 | WR_HARPOON(p_port + hp_xfer_cmd, |
5331 | (XFER_HOST_DMA | XFER_HOST_AUTO | XFER_DMA_8BIT)); | 5117 | (XFER_HOST_DMA | XFER_HOST_AUTO | XFER_DMA_8BIT)); |
5332 | 5118 | ||
5333 | } | 5119 | } |
5334 | } | 5120 | } |
5335 | 5121 | ||
5336 | |||
5337 | /*--------------------------------------------------------------------- | 5122 | /*--------------------------------------------------------------------- |
5338 | * | 5123 | * |
5339 | * Function: BusMaster Timeout Handler | 5124 | * Function: BusMaster Timeout Handler |
@@ -5348,35 +5133,36 @@ static void FPT_busMstrDataXferStart(unsigned long p_port, struct sccb * pcurrSC | |||
5348 | *---------------------------------------------------------------------*/ | 5133 | *---------------------------------------------------------------------*/ |
5349 | static unsigned char FPT_busMstrTimeOut(unsigned long p_port) | 5134 | static unsigned char FPT_busMstrTimeOut(unsigned long p_port) |
5350 | { | 5135 | { |
5351 | unsigned long timeout; | 5136 | unsigned long timeout; |
5352 | 5137 | ||
5353 | timeout = LONG_WAIT; | 5138 | timeout = LONG_WAIT; |
5354 | 5139 | ||
5355 | WR_HARPOON(p_port+hp_sys_ctrl, HALT_MACH); | 5140 | WR_HARPOON(p_port + hp_sys_ctrl, HALT_MACH); |
5356 | 5141 | ||
5357 | while ((!(RD_HARPOON(p_port+hp_ext_status) & CMD_ABORTED)) && timeout--) {} | 5142 | while ((!(RD_HARPOON(p_port + hp_ext_status) & CMD_ABORTED)) |
5143 | && timeout--) { | ||
5144 | } | ||
5358 | 5145 | ||
5359 | 5146 | if (RD_HARPOON(p_port + hp_ext_status) & BM_CMD_BUSY) { | |
5360 | 5147 | WR_HARPOON(p_port + hp_sys_ctrl, HARD_ABORT); | |
5361 | if (RD_HARPOON(p_port+hp_ext_status) & BM_CMD_BUSY) { | ||
5362 | WR_HARPOON(p_port+hp_sys_ctrl, HARD_ABORT); | ||
5363 | 5148 | ||
5364 | timeout = LONG_WAIT; | 5149 | timeout = LONG_WAIT; |
5365 | while ((RD_HARPOON(p_port+hp_ext_status) & BM_CMD_BUSY) && timeout--) {} | 5150 | while ((RD_HARPOON(p_port + hp_ext_status) & BM_CMD_BUSY) |
5366 | } | 5151 | && timeout--) { |
5152 | } | ||
5153 | } | ||
5367 | 5154 | ||
5368 | RD_HARPOON(p_port+hp_int_status); /*Clear command complete */ | 5155 | RD_HARPOON(p_port + hp_int_status); /*Clear command complete */ |
5369 | 5156 | ||
5370 | if (RD_HARPOON(p_port+hp_ext_status) & BM_CMD_BUSY) { | 5157 | if (RD_HARPOON(p_port + hp_ext_status) & BM_CMD_BUSY) { |
5371 | return(1); | 5158 | return (1); |
5372 | } | 5159 | } |
5373 | 5160 | ||
5374 | else { | 5161 | else { |
5375 | return(0); | 5162 | return (0); |
5376 | } | 5163 | } |
5377 | } | 5164 | } |
5378 | 5165 | ||
5379 | |||
5380 | /*--------------------------------------------------------------------- | 5166 | /*--------------------------------------------------------------------- |
5381 | * | 5167 | * |
5382 | * Function: Host Data Transfer Abort | 5168 | * Function: Host Data Transfer Abort |
@@ -5384,256 +5170,282 @@ static unsigned char FPT_busMstrTimeOut(unsigned long p_port) | |||
5384 | * Description: Abort any in progress transfer. | 5170 | * Description: Abort any in progress transfer. |
5385 | * | 5171 | * |
5386 | *---------------------------------------------------------------------*/ | 5172 | *---------------------------------------------------------------------*/ |
5387 | static void FPT_hostDataXferAbort(unsigned long port, unsigned char p_card, struct sccb * pCurrSCCB) | 5173 | static void FPT_hostDataXferAbort(unsigned long port, unsigned char p_card, |
5174 | struct sccb *pCurrSCCB) | ||
5388 | { | 5175 | { |
5389 | 5176 | ||
5390 | unsigned long timeout; | 5177 | unsigned long timeout; |
5391 | unsigned long remain_cnt; | 5178 | unsigned long remain_cnt; |
5392 | unsigned int sg_ptr; | 5179 | unsigned int sg_ptr; |
5393 | |||
5394 | FPT_BL_Card[p_card].globalFlags &= ~F_HOST_XFER_ACT; | ||
5395 | |||
5396 | if (pCurrSCCB->Sccb_XferState & F_AUTO_SENSE) { | ||
5397 | |||
5398 | 5180 | ||
5399 | if (!(RD_HARPOON(port+hp_int_status) & INT_CMD_COMPL)) { | 5181 | FPT_BL_Card[p_card].globalFlags &= ~F_HOST_XFER_ACT; |
5400 | 5182 | ||
5401 | WR_HARPOON(port+hp_bm_ctrl, (RD_HARPOON(port+hp_bm_ctrl) | FLUSH_XFER_CNTR)); | 5183 | if (pCurrSCCB->Sccb_XferState & F_AUTO_SENSE) { |
5402 | timeout = LONG_WAIT; | ||
5403 | 5184 | ||
5404 | while ((RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) && timeout--) {} | 5185 | if (!(RD_HARPOON(port + hp_int_status) & INT_CMD_COMPL)) { |
5405 | |||
5406 | WR_HARPOON(port+hp_bm_ctrl, (RD_HARPOON(port+hp_bm_ctrl) & ~FLUSH_XFER_CNTR)); | ||
5407 | |||
5408 | if (RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) { | ||
5409 | |||
5410 | if (FPT_busMstrTimeOut(port)) { | ||
5411 | |||
5412 | if (pCurrSCCB->HostStatus == 0x00) | ||
5413 | |||
5414 | pCurrSCCB->HostStatus = SCCB_BM_ERR; | ||
5415 | |||
5416 | } | ||
5417 | |||
5418 | if (RD_HARPOON(port+hp_int_status) & INT_EXT_STATUS) | ||
5419 | |||
5420 | if (RD_HARPOON(port+hp_ext_status) & BAD_EXT_STATUS) | ||
5421 | |||
5422 | if (pCurrSCCB->HostStatus == 0x00) | ||
5423 | |||
5424 | { | ||
5425 | pCurrSCCB->HostStatus = SCCB_BM_ERR; | ||
5426 | } | ||
5427 | } | ||
5428 | } | ||
5429 | } | ||
5430 | 5186 | ||
5431 | else if (pCurrSCCB->Sccb_XferCnt) { | 5187 | WR_HARPOON(port + hp_bm_ctrl, |
5188 | (RD_HARPOON(port + hp_bm_ctrl) | | ||
5189 | FLUSH_XFER_CNTR)); | ||
5190 | timeout = LONG_WAIT; | ||
5432 | 5191 | ||
5433 | if (pCurrSCCB->Sccb_XferState & F_SG_XFER) { | 5192 | while ((RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY) |
5434 | 5193 | && timeout--) { | |
5435 | 5194 | } | |
5436 | WR_HARPOON(port+hp_page_ctrl, (RD_HARPOON(port+hp_page_ctrl) & | ||
5437 | ~SCATTER_EN)); | ||
5438 | 5195 | ||
5439 | WR_HARPOON(port+hp_sg_addr,0x00); | 5196 | WR_HARPOON(port + hp_bm_ctrl, |
5197 | (RD_HARPOON(port + hp_bm_ctrl) & | ||
5198 | ~FLUSH_XFER_CNTR)); | ||
5440 | 5199 | ||
5441 | sg_ptr = pCurrSCCB->Sccb_sgseg + SG_BUF_CNT; | 5200 | if (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY) { |
5442 | 5201 | ||
5443 | if (sg_ptr > (unsigned int)(pCurrSCCB->DataLength / SG_ELEMENT_SIZE)) { | 5202 | if (FPT_busMstrTimeOut(port)) { |
5444 | 5203 | ||
5445 | sg_ptr = (unsigned int)(pCurrSCCB->DataLength / SG_ELEMENT_SIZE); | 5204 | if (pCurrSCCB->HostStatus == 0x00) |
5446 | } | ||
5447 | 5205 | ||
5448 | remain_cnt = pCurrSCCB->Sccb_XferCnt; | 5206 | pCurrSCCB->HostStatus = |
5207 | SCCB_BM_ERR; | ||
5449 | 5208 | ||
5450 | while (remain_cnt < 0x01000000L) { | 5209 | } |
5451 | 5210 | ||
5452 | sg_ptr--; | 5211 | if (RD_HARPOON(port + hp_int_status) & |
5212 | INT_EXT_STATUS) | ||
5453 | 5213 | ||
5454 | if (remain_cnt > (unsigned long)(*(((unsigned long *)pCurrSCCB-> | 5214 | if (RD_HARPOON(port + hp_ext_status) & |
5455 | DataPointer) + (sg_ptr * 2)))) { | 5215 | BAD_EXT_STATUS) |
5456 | 5216 | ||
5457 | remain_cnt -= (unsigned long)(*(((unsigned long *)pCurrSCCB-> | 5217 | if (pCurrSCCB->HostStatus == |
5458 | DataPointer) + (sg_ptr * 2))); | 5218 | 0x00) |
5459 | } | 5219 | { |
5220 | pCurrSCCB->HostStatus = | ||
5221 | SCCB_BM_ERR; | ||
5222 | } | ||
5223 | } | ||
5224 | } | ||
5225 | } | ||
5460 | 5226 | ||
5461 | else { | 5227 | else if (pCurrSCCB->Sccb_XferCnt) { |
5462 | 5228 | ||
5463 | break; | 5229 | if (pCurrSCCB->Sccb_XferState & F_SG_XFER) { |
5464 | } | ||
5465 | } | ||
5466 | 5230 | ||
5231 | WR_HARPOON(port + hp_page_ctrl, | ||
5232 | (RD_HARPOON(port + hp_page_ctrl) & | ||
5233 | ~SCATTER_EN)); | ||
5467 | 5234 | ||
5235 | WR_HARPOON(port + hp_sg_addr, 0x00); | ||
5468 | 5236 | ||
5469 | if (remain_cnt < 0x01000000L) { | 5237 | sg_ptr = pCurrSCCB->Sccb_sgseg + SG_BUF_CNT; |
5470 | 5238 | ||
5239 | if (sg_ptr > | ||
5240 | (unsigned int)(pCurrSCCB->DataLength / | ||
5241 | SG_ELEMENT_SIZE)) { | ||
5471 | 5242 | ||
5472 | pCurrSCCB->Sccb_SGoffset = remain_cnt; | 5243 | sg_ptr = |
5244 | (unsigned int)(pCurrSCCB->DataLength / | ||
5245 | SG_ELEMENT_SIZE); | ||
5246 | } | ||
5473 | 5247 | ||
5474 | pCurrSCCB->Sccb_sgseg = (unsigned short)sg_ptr; | 5248 | remain_cnt = pCurrSCCB->Sccb_XferCnt; |
5475 | 5249 | ||
5250 | while (remain_cnt < 0x01000000L) { | ||
5476 | 5251 | ||
5477 | if ((unsigned long)(sg_ptr * SG_ELEMENT_SIZE) == pCurrSCCB->DataLength | 5252 | sg_ptr--; |
5478 | && (remain_cnt == 0)) | ||
5479 | 5253 | ||
5480 | pCurrSCCB->Sccb_XferState |= F_ALL_XFERRED; | 5254 | if (remain_cnt > |
5481 | } | 5255 | (unsigned |
5256 | long)(*(((unsigned long *)pCurrSCCB-> | ||
5257 | DataPointer) + (sg_ptr * 2)))) { | ||
5482 | 5258 | ||
5483 | else { | 5259 | remain_cnt -= |
5260 | (unsigned | ||
5261 | long)(*(((unsigned long *) | ||
5262 | pCurrSCCB->DataPointer) + | ||
5263 | (sg_ptr * 2))); | ||
5264 | } | ||
5484 | 5265 | ||
5266 | else { | ||
5485 | 5267 | ||
5486 | if (pCurrSCCB->HostStatus == 0x00) { | 5268 | break; |
5269 | } | ||
5270 | } | ||
5487 | 5271 | ||
5488 | pCurrSCCB->HostStatus = SCCB_GROSS_FW_ERR; | 5272 | if (remain_cnt < 0x01000000L) { |
5489 | } | ||
5490 | } | ||
5491 | } | ||
5492 | 5273 | ||
5274 | pCurrSCCB->Sccb_SGoffset = remain_cnt; | ||
5493 | 5275 | ||
5494 | if (!(pCurrSCCB->Sccb_XferState & F_HOST_XFER_DIR)) { | 5276 | pCurrSCCB->Sccb_sgseg = (unsigned short)sg_ptr; |
5495 | 5277 | ||
5278 | if ((unsigned long)(sg_ptr * SG_ELEMENT_SIZE) == | ||
5279 | pCurrSCCB->DataLength && (remain_cnt == 0)) | ||
5496 | 5280 | ||
5497 | if (RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) { | 5281 | pCurrSCCB->Sccb_XferState |= |
5282 | F_ALL_XFERRED; | ||
5283 | } | ||
5498 | 5284 | ||
5499 | FPT_busMstrTimeOut(port); | 5285 | else { |
5500 | } | ||
5501 | 5286 | ||
5502 | else { | 5287 | if (pCurrSCCB->HostStatus == 0x00) { |
5503 | 5288 | ||
5504 | if (RD_HARPOON(port+hp_int_status) & INT_EXT_STATUS) { | 5289 | pCurrSCCB->HostStatus = |
5290 | SCCB_GROSS_FW_ERR; | ||
5291 | } | ||
5292 | } | ||
5293 | } | ||
5505 | 5294 | ||
5506 | if (RD_HARPOON(port+hp_ext_status) & BAD_EXT_STATUS) { | 5295 | if (!(pCurrSCCB->Sccb_XferState & F_HOST_XFER_DIR)) { |
5507 | 5296 | ||
5508 | if (pCurrSCCB->HostStatus == 0x00) { | 5297 | if (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY) { |
5509 | 5298 | ||
5510 | pCurrSCCB->HostStatus = SCCB_BM_ERR; | 5299 | FPT_busMstrTimeOut(port); |
5511 | } | 5300 | } |
5512 | } | ||
5513 | } | ||
5514 | 5301 | ||
5515 | } | 5302 | else { |
5516 | } | ||
5517 | 5303 | ||
5518 | else { | 5304 | if (RD_HARPOON(port + hp_int_status) & |
5305 | INT_EXT_STATUS) { | ||
5519 | 5306 | ||
5307 | if (RD_HARPOON(port + hp_ext_status) & | ||
5308 | BAD_EXT_STATUS) { | ||
5520 | 5309 | ||
5521 | if ((RD_HARPOON(port+hp_fifo_cnt)) >= BM_THRESHOLD) { | 5310 | if (pCurrSCCB->HostStatus == |
5311 | 0x00) { | ||
5522 | 5312 | ||
5523 | timeout = SHORT_WAIT; | 5313 | pCurrSCCB->HostStatus = |
5314 | SCCB_BM_ERR; | ||
5315 | } | ||
5316 | } | ||
5317 | } | ||
5524 | 5318 | ||
5525 | while ((RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) && | 5319 | } |
5526 | ((RD_HARPOON(port+hp_fifo_cnt)) >= BM_THRESHOLD) && | 5320 | } |
5527 | timeout--) {} | ||
5528 | } | ||
5529 | 5321 | ||
5530 | if (RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) { | 5322 | else { |
5531 | 5323 | ||
5532 | WR_HARPOON(port+hp_bm_ctrl, (RD_HARPOON(port+hp_bm_ctrl) | | 5324 | if ((RD_HARPOON(port + hp_fifo_cnt)) >= BM_THRESHOLD) { |
5533 | FLUSH_XFER_CNTR)); | ||
5534 | 5325 | ||
5535 | timeout = LONG_WAIT; | 5326 | timeout = SHORT_WAIT; |
5536 | 5327 | ||
5537 | while ((RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) && | 5328 | while ((RD_HARPOON(port + hp_ext_status) & |
5538 | timeout--) {} | 5329 | BM_CMD_BUSY) |
5330 | && ((RD_HARPOON(port + hp_fifo_cnt)) >= | ||
5331 | BM_THRESHOLD) && timeout--) { | ||
5332 | } | ||
5333 | } | ||
5539 | 5334 | ||
5540 | WR_HARPOON(port+hp_bm_ctrl, (RD_HARPOON(port+hp_bm_ctrl) & | 5335 | if (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY) { |
5541 | ~FLUSH_XFER_CNTR)); | ||
5542 | 5336 | ||
5337 | WR_HARPOON(port + hp_bm_ctrl, | ||
5338 | (RD_HARPOON(port + hp_bm_ctrl) | | ||
5339 | FLUSH_XFER_CNTR)); | ||
5543 | 5340 | ||
5544 | if (RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) { | 5341 | timeout = LONG_WAIT; |
5545 | 5342 | ||
5546 | if (pCurrSCCB->HostStatus == 0x00) { | 5343 | while ((RD_HARPOON(port + hp_ext_status) & |
5344 | BM_CMD_BUSY) && timeout--) { | ||
5345 | } | ||
5547 | 5346 | ||
5548 | pCurrSCCB->HostStatus = SCCB_BM_ERR; | 5347 | WR_HARPOON(port + hp_bm_ctrl, |
5549 | } | 5348 | (RD_HARPOON(port + hp_bm_ctrl) & |
5349 | ~FLUSH_XFER_CNTR)); | ||
5550 | 5350 | ||
5551 | FPT_busMstrTimeOut(port); | 5351 | if (RD_HARPOON(port + hp_ext_status) & |
5552 | } | 5352 | BM_CMD_BUSY) { |
5553 | } | ||
5554 | 5353 | ||
5555 | if (RD_HARPOON(port+hp_int_status) & INT_EXT_STATUS) { | 5354 | if (pCurrSCCB->HostStatus == 0x00) { |
5556 | 5355 | ||
5557 | if (RD_HARPOON(port+hp_ext_status) & BAD_EXT_STATUS) { | 5356 | pCurrSCCB->HostStatus = |
5357 | SCCB_BM_ERR; | ||
5358 | } | ||
5558 | 5359 | ||
5559 | if (pCurrSCCB->HostStatus == 0x00) { | 5360 | FPT_busMstrTimeOut(port); |
5361 | } | ||
5362 | } | ||
5560 | 5363 | ||
5561 | pCurrSCCB->HostStatus = SCCB_BM_ERR; | 5364 | if (RD_HARPOON(port + hp_int_status) & INT_EXT_STATUS) { |
5562 | } | ||
5563 | } | ||
5564 | } | ||
5565 | } | ||
5566 | 5365 | ||
5567 | } | 5366 | if (RD_HARPOON(port + hp_ext_status) & |
5367 | BAD_EXT_STATUS) { | ||
5568 | 5368 | ||
5569 | else { | 5369 | if (pCurrSCCB->HostStatus == 0x00) { |
5570 | 5370 | ||
5371 | pCurrSCCB->HostStatus = | ||
5372 | SCCB_BM_ERR; | ||
5373 | } | ||
5374 | } | ||
5375 | } | ||
5376 | } | ||
5571 | 5377 | ||
5572 | if (RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) { | 5378 | } |
5573 | 5379 | ||
5574 | timeout = LONG_WAIT; | 5380 | else { |
5575 | 5381 | ||
5576 | while ((RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) && timeout--) {} | 5382 | if (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY) { |
5577 | 5383 | ||
5578 | if (RD_HARPOON(port+hp_ext_status) & BM_CMD_BUSY) { | 5384 | timeout = LONG_WAIT; |
5579 | 5385 | ||
5580 | if (pCurrSCCB->HostStatus == 0x00) { | 5386 | while ((RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY) |
5387 | && timeout--) { | ||
5388 | } | ||
5581 | 5389 | ||
5582 | pCurrSCCB->HostStatus = SCCB_BM_ERR; | 5390 | if (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY) { |
5583 | } | ||
5584 | 5391 | ||
5585 | FPT_busMstrTimeOut(port); | 5392 | if (pCurrSCCB->HostStatus == 0x00) { |
5586 | } | ||
5587 | } | ||
5588 | 5393 | ||
5394 | pCurrSCCB->HostStatus = SCCB_BM_ERR; | ||
5395 | } | ||
5589 | 5396 | ||
5590 | if (RD_HARPOON(port+hp_int_status) & INT_EXT_STATUS) { | 5397 | FPT_busMstrTimeOut(port); |
5398 | } | ||
5399 | } | ||
5591 | 5400 | ||
5592 | if (RD_HARPOON(port+hp_ext_status) & BAD_EXT_STATUS) { | 5401 | if (RD_HARPOON(port + hp_int_status) & INT_EXT_STATUS) { |
5593 | 5402 | ||
5594 | if (pCurrSCCB->HostStatus == 0x00) { | 5403 | if (RD_HARPOON(port + hp_ext_status) & BAD_EXT_STATUS) { |
5595 | 5404 | ||
5596 | pCurrSCCB->HostStatus = SCCB_BM_ERR; | 5405 | if (pCurrSCCB->HostStatus == 0x00) { |
5597 | } | ||
5598 | } | ||
5599 | 5406 | ||
5600 | } | 5407 | pCurrSCCB->HostStatus = SCCB_BM_ERR; |
5408 | } | ||
5409 | } | ||
5601 | 5410 | ||
5602 | if (pCurrSCCB->Sccb_XferState & F_SG_XFER) { | 5411 | } |
5603 | 5412 | ||
5604 | WR_HARPOON(port+hp_page_ctrl, (RD_HARPOON(port+hp_page_ctrl) & | 5413 | if (pCurrSCCB->Sccb_XferState & F_SG_XFER) { |
5605 | ~SCATTER_EN)); | ||
5606 | 5414 | ||
5607 | WR_HARPOON(port+hp_sg_addr,0x00); | 5415 | WR_HARPOON(port + hp_page_ctrl, |
5416 | (RD_HARPOON(port + hp_page_ctrl) & | ||
5417 | ~SCATTER_EN)); | ||
5608 | 5418 | ||
5609 | pCurrSCCB->Sccb_sgseg += SG_BUF_CNT; | 5419 | WR_HARPOON(port + hp_sg_addr, 0x00); |
5610 | 5420 | ||
5611 | pCurrSCCB->Sccb_SGoffset = 0x00; | 5421 | pCurrSCCB->Sccb_sgseg += SG_BUF_CNT; |
5612 | 5422 | ||
5423 | pCurrSCCB->Sccb_SGoffset = 0x00; | ||
5613 | 5424 | ||
5614 | if ((unsigned long)(pCurrSCCB->Sccb_sgseg * SG_ELEMENT_SIZE) >= | 5425 | if ((unsigned long)(pCurrSCCB->Sccb_sgseg * |
5615 | pCurrSCCB->DataLength) { | 5426 | SG_ELEMENT_SIZE) >= |
5427 | pCurrSCCB->DataLength) { | ||
5616 | 5428 | ||
5617 | pCurrSCCB->Sccb_XferState |= F_ALL_XFERRED; | 5429 | pCurrSCCB->Sccb_XferState |= F_ALL_XFERRED; |
5618 | 5430 | ||
5619 | pCurrSCCB->Sccb_sgseg = (unsigned short)(pCurrSCCB->DataLength / SG_ELEMENT_SIZE); | 5431 | pCurrSCCB->Sccb_sgseg = |
5432 | (unsigned short)(pCurrSCCB->DataLength / | ||
5433 | SG_ELEMENT_SIZE); | ||
5620 | 5434 | ||
5621 | } | 5435 | } |
5622 | } | 5436 | } |
5623 | 5437 | ||
5624 | else { | 5438 | else { |
5625 | 5439 | ||
5626 | if (!(pCurrSCCB->Sccb_XferState & F_AUTO_SENSE)) | 5440 | if (!(pCurrSCCB->Sccb_XferState & F_AUTO_SENSE)) |
5627 | 5441 | ||
5628 | pCurrSCCB->Sccb_XferState |= F_ALL_XFERRED; | 5442 | pCurrSCCB->Sccb_XferState |= F_ALL_XFERRED; |
5629 | } | 5443 | } |
5630 | } | 5444 | } |
5631 | 5445 | ||
5632 | WR_HARPOON(port+hp_int_mask,(INT_CMD_COMPL | SCSI_INTERRUPT)); | 5446 | WR_HARPOON(port + hp_int_mask, (INT_CMD_COMPL | SCSI_INTERRUPT)); |
5633 | } | 5447 | } |
5634 | 5448 | ||
5635 | |||
5636 | |||
5637 | /*--------------------------------------------------------------------- | 5449 | /*--------------------------------------------------------------------- |
5638 | * | 5450 | * |
5639 | * Function: Host Data Transfer Restart | 5451 | * Function: Host Data Transfer Restart |
@@ -5642,47 +5454,47 @@ static void FPT_hostDataXferAbort(unsigned long port, unsigned char p_card, stru | |||
5642 | * pointers message. | 5454 | * pointers message. |
5643 | * | 5455 | * |
5644 | *---------------------------------------------------------------------*/ | 5456 | *---------------------------------------------------------------------*/ |
5645 | static void FPT_hostDataXferRestart(struct sccb * currSCCB) | 5457 | static void FPT_hostDataXferRestart(struct sccb *currSCCB) |
5646 | { | 5458 | { |
5647 | unsigned long data_count; | 5459 | unsigned long data_count; |
5648 | unsigned int sg_index; | 5460 | unsigned int sg_index; |
5649 | unsigned long *sg_ptr; | 5461 | unsigned long *sg_ptr; |
5650 | 5462 | ||
5651 | if (currSCCB->Sccb_XferState & F_SG_XFER) { | 5463 | if (currSCCB->Sccb_XferState & F_SG_XFER) { |
5652 | 5464 | ||
5653 | currSCCB->Sccb_XferCnt = 0; | 5465 | currSCCB->Sccb_XferCnt = 0; |
5654 | 5466 | ||
5655 | sg_index = 0xffff; /*Index by long words into sg list. */ | 5467 | sg_index = 0xffff; /*Index by long words into sg list. */ |
5656 | data_count = 0; /*Running count of SG xfer counts. */ | 5468 | data_count = 0; /*Running count of SG xfer counts. */ |
5657 | 5469 | ||
5658 | sg_ptr = (unsigned long *)currSCCB->DataPointer; | 5470 | sg_ptr = (unsigned long *)currSCCB->DataPointer; |
5659 | 5471 | ||
5660 | while (data_count < currSCCB->Sccb_ATC) { | 5472 | while (data_count < currSCCB->Sccb_ATC) { |
5661 | 5473 | ||
5662 | sg_index++; | 5474 | sg_index++; |
5663 | data_count += *(sg_ptr+(sg_index * 2)); | 5475 | data_count += *(sg_ptr + (sg_index * 2)); |
5664 | } | 5476 | } |
5665 | 5477 | ||
5666 | if (data_count == currSCCB->Sccb_ATC) { | 5478 | if (data_count == currSCCB->Sccb_ATC) { |
5667 | 5479 | ||
5668 | currSCCB->Sccb_SGoffset = 0; | 5480 | currSCCB->Sccb_SGoffset = 0; |
5669 | sg_index++; | 5481 | sg_index++; |
5670 | } | 5482 | } |
5671 | 5483 | ||
5672 | else { | 5484 | else { |
5673 | currSCCB->Sccb_SGoffset = data_count - currSCCB->Sccb_ATC; | 5485 | currSCCB->Sccb_SGoffset = |
5674 | } | 5486 | data_count - currSCCB->Sccb_ATC; |
5487 | } | ||
5675 | 5488 | ||
5676 | currSCCB->Sccb_sgseg = (unsigned short)sg_index; | 5489 | currSCCB->Sccb_sgseg = (unsigned short)sg_index; |
5677 | } | 5490 | } |
5678 | 5491 | ||
5679 | else { | 5492 | else { |
5680 | currSCCB->Sccb_XferCnt = currSCCB->DataLength - currSCCB->Sccb_ATC; | 5493 | currSCCB->Sccb_XferCnt = |
5681 | } | 5494 | currSCCB->DataLength - currSCCB->Sccb_ATC; |
5495 | } | ||
5682 | } | 5496 | } |
5683 | 5497 | ||
5684 | |||
5685 | |||
5686 | /*--------------------------------------------------------------------- | 5498 | /*--------------------------------------------------------------------- |
5687 | * | 5499 | * |
5688 | * Function: FPT_scini | 5500 | * Function: FPT_scini |
@@ -5691,177 +5503,192 @@ static void FPT_hostDataXferRestart(struct sccb * currSCCB) | |||
5691 | * | 5503 | * |
5692 | *---------------------------------------------------------------------*/ | 5504 | *---------------------------------------------------------------------*/ |
5693 | 5505 | ||
5694 | static void FPT_scini(unsigned char p_card, unsigned char p_our_id, unsigned char p_power_up) | 5506 | static void FPT_scini(unsigned char p_card, unsigned char p_our_id, |
5507 | unsigned char p_power_up) | ||
5695 | { | 5508 | { |
5696 | 5509 | ||
5697 | unsigned char loser,assigned_id; | 5510 | unsigned char loser, assigned_id; |
5698 | unsigned long p_port; | 5511 | unsigned long p_port; |
5699 | 5512 | ||
5700 | unsigned char i,k,ScamFlg ; | 5513 | unsigned char i, k, ScamFlg; |
5701 | struct sccb_card * currCard; | 5514 | struct sccb_card *currCard; |
5702 | struct nvram_info * pCurrNvRam; | 5515 | struct nvram_info *pCurrNvRam; |
5703 | 5516 | ||
5704 | currCard = &FPT_BL_Card[p_card]; | 5517 | currCard = &FPT_BL_Card[p_card]; |
5705 | p_port = currCard->ioPort; | 5518 | p_port = currCard->ioPort; |
5706 | pCurrNvRam = currCard->pNvRamInfo; | 5519 | pCurrNvRam = currCard->pNvRamInfo; |
5707 | 5520 | ||
5708 | 5521 | if (pCurrNvRam) { | |
5709 | if(pCurrNvRam){ | ||
5710 | ScamFlg = pCurrNvRam->niScamConf; | 5522 | ScamFlg = pCurrNvRam->niScamConf; |
5711 | i = pCurrNvRam->niSysConf; | 5523 | i = pCurrNvRam->niSysConf; |
5524 | } else { | ||
5525 | ScamFlg = | ||
5526 | (unsigned char)FPT_utilEERead(p_port, SCAM_CONFIG / 2); | ||
5527 | i = (unsigned | ||
5528 | char)(FPT_utilEERead(p_port, (SYSTEM_CONFIG / 2))); | ||
5712 | } | 5529 | } |
5713 | else{ | 5530 | if (!(i & 0x02)) /* check if reset bus in AutoSCSI parameter set */ |
5714 | ScamFlg = (unsigned char) FPT_utilEERead(p_port, SCAM_CONFIG/2); | ||
5715 | i = (unsigned char)(FPT_utilEERead(p_port, (SYSTEM_CONFIG/2))); | ||
5716 | } | ||
5717 | if(!(i & 0x02)) /* check if reset bus in AutoSCSI parameter set */ | ||
5718 | return; | 5531 | return; |
5719 | 5532 | ||
5720 | FPT_inisci(p_card,p_port, p_our_id); | 5533 | FPT_inisci(p_card, p_port, p_our_id); |
5721 | 5534 | ||
5722 | /* Force to wait 1 sec after SCSI bus reset. Some SCAM device FW | 5535 | /* Force to wait 1 sec after SCSI bus reset. Some SCAM device FW |
5723 | too slow to return to SCAM selection */ | 5536 | too slow to return to SCAM selection */ |
5724 | 5537 | ||
5725 | /* if (p_power_up) | 5538 | /* if (p_power_up) |
5726 | FPT_Wait1Second(p_port); | 5539 | FPT_Wait1Second(p_port); |
5727 | else | 5540 | else |
5728 | FPT_Wait(p_port, TO_250ms); */ | 5541 | FPT_Wait(p_port, TO_250ms); */ |
5729 | |||
5730 | FPT_Wait1Second(p_port); | ||
5731 | 5542 | ||
5732 | if ((ScamFlg & SCAM_ENABLED) && (ScamFlg & SCAM_LEVEL2)) | 5543 | FPT_Wait1Second(p_port); |
5733 | { | ||
5734 | while (!(FPT_scarb(p_port,INIT_SELTD))) {} | ||
5735 | 5544 | ||
5736 | FPT_scsel(p_port); | 5545 | if ((ScamFlg & SCAM_ENABLED) && (ScamFlg & SCAM_LEVEL2)) { |
5546 | while (!(FPT_scarb(p_port, INIT_SELTD))) { | ||
5547 | } | ||
5737 | 5548 | ||
5738 | do { | 5549 | FPT_scsel(p_port); |
5739 | FPT_scxferc(p_port,SYNC_PTRN); | ||
5740 | FPT_scxferc(p_port,DOM_MSTR); | ||
5741 | loser = FPT_scsendi(p_port,&FPT_scamInfo[p_our_id].id_string[0]); | ||
5742 | } while ( loser == 0xFF ); | ||
5743 | 5550 | ||
5744 | FPT_scbusf(p_port); | 5551 | do { |
5552 | FPT_scxferc(p_port, SYNC_PTRN); | ||
5553 | FPT_scxferc(p_port, DOM_MSTR); | ||
5554 | loser = | ||
5555 | FPT_scsendi(p_port, | ||
5556 | &FPT_scamInfo[p_our_id].id_string[0]); | ||
5557 | } while (loser == 0xFF); | ||
5745 | 5558 | ||
5746 | if ((p_power_up) && (!loser)) | 5559 | FPT_scbusf(p_port); |
5747 | { | ||
5748 | FPT_sresb(p_port,p_card); | ||
5749 | FPT_Wait(p_port, TO_250ms); | ||
5750 | 5560 | ||
5751 | while (!(FPT_scarb(p_port,INIT_SELTD))) {} | 5561 | if ((p_power_up) && (!loser)) { |
5562 | FPT_sresb(p_port, p_card); | ||
5563 | FPT_Wait(p_port, TO_250ms); | ||
5752 | 5564 | ||
5753 | FPT_scsel(p_port); | 5565 | while (!(FPT_scarb(p_port, INIT_SELTD))) { |
5566 | } | ||
5754 | 5567 | ||
5755 | do { | 5568 | FPT_scsel(p_port); |
5756 | FPT_scxferc(p_port, SYNC_PTRN); | ||
5757 | FPT_scxferc(p_port, DOM_MSTR); | ||
5758 | loser = FPT_scsendi(p_port,&FPT_scamInfo[p_our_id]. | ||
5759 | id_string[0]); | ||
5760 | } while ( loser == 0xFF ); | ||
5761 | 5569 | ||
5762 | FPT_scbusf(p_port); | 5570 | do { |
5763 | } | 5571 | FPT_scxferc(p_port, SYNC_PTRN); |
5764 | } | 5572 | FPT_scxferc(p_port, DOM_MSTR); |
5573 | loser = | ||
5574 | FPT_scsendi(p_port, | ||
5575 | &FPT_scamInfo[p_our_id]. | ||
5576 | id_string[0]); | ||
5577 | } while (loser == 0xFF); | ||
5765 | 5578 | ||
5766 | else | 5579 | FPT_scbusf(p_port); |
5767 | { | 5580 | } |
5768 | loser = 0; | 5581 | } |
5769 | } | ||
5770 | 5582 | ||
5583 | else { | ||
5584 | loser = 0; | ||
5585 | } | ||
5771 | 5586 | ||
5772 | if (!loser) | 5587 | if (!loser) { |
5773 | { | 5588 | |
5589 | FPT_scamInfo[p_our_id].state = ID_ASSIGNED; | ||
5590 | |||
5591 | if (ScamFlg & SCAM_ENABLED) { | ||
5592 | |||
5593 | for (i = 0; i < MAX_SCSI_TAR; i++) { | ||
5594 | if ((FPT_scamInfo[i].state == ID_UNASSIGNED) || | ||
5595 | (FPT_scamInfo[i].state == ID_UNUSED)) { | ||
5596 | if (FPT_scsell(p_port, i)) { | ||
5597 | FPT_scamInfo[i].state = LEGACY; | ||
5598 | if ((FPT_scamInfo[i]. | ||
5599 | id_string[0] != 0xFF) | ||
5600 | || (FPT_scamInfo[i]. | ||
5601 | id_string[1] != 0xFA)) { | ||
5602 | |||
5603 | FPT_scamInfo[i]. | ||
5604 | id_string[0] = 0xFF; | ||
5605 | FPT_scamInfo[i]. | ||
5606 | id_string[1] = 0xFA; | ||
5607 | if (pCurrNvRam == NULL) | ||
5608 | currCard-> | ||
5609 | globalFlags | ||
5610 | |= | ||
5611 | F_UPDATE_EEPROM; | ||
5612 | } | ||
5613 | } | ||
5614 | } | ||
5615 | } | ||
5774 | 5616 | ||
5775 | FPT_scamInfo[p_our_id].state = ID_ASSIGNED; | 5617 | FPT_sresb(p_port, p_card); |
5618 | FPT_Wait1Second(p_port); | ||
5619 | while (!(FPT_scarb(p_port, INIT_SELTD))) { | ||
5620 | } | ||
5621 | FPT_scsel(p_port); | ||
5622 | FPT_scasid(p_card, p_port); | ||
5623 | } | ||
5776 | 5624 | ||
5625 | } | ||
5777 | 5626 | ||
5778 | if (ScamFlg & SCAM_ENABLED) | 5627 | else if ((loser) && (ScamFlg & SCAM_ENABLED)) { |
5779 | { | 5628 | FPT_scamInfo[p_our_id].id_string[0] = SLV_TYPE_CODE0; |
5629 | assigned_id = 0; | ||
5630 | FPT_scwtsel(p_port); | ||
5780 | 5631 | ||
5781 | for (i=0; i < MAX_SCSI_TAR; i++) | 5632 | do { |
5782 | { | 5633 | while (FPT_scxferc(p_port, 0x00) != SYNC_PTRN) { |
5783 | if ((FPT_scamInfo[i].state == ID_UNASSIGNED) || | 5634 | } |
5784 | (FPT_scamInfo[i].state == ID_UNUSED)) | ||
5785 | { | ||
5786 | if (FPT_scsell(p_port,i)) | ||
5787 | { | ||
5788 | FPT_scamInfo[i].state = LEGACY; | ||
5789 | if ((FPT_scamInfo[i].id_string[0] != 0xFF) || | ||
5790 | (FPT_scamInfo[i].id_string[1] != 0xFA)) | ||
5791 | { | ||
5792 | |||
5793 | FPT_scamInfo[i].id_string[0] = 0xFF; | ||
5794 | FPT_scamInfo[i].id_string[1] = 0xFA; | ||
5795 | if(pCurrNvRam == NULL) | ||
5796 | currCard->globalFlags |= F_UPDATE_EEPROM; | ||
5797 | } | ||
5798 | } | ||
5799 | } | ||
5800 | } | ||
5801 | |||
5802 | FPT_sresb(p_port,p_card); | ||
5803 | FPT_Wait1Second(p_port); | ||
5804 | while (!(FPT_scarb(p_port,INIT_SELTD))) {} | ||
5805 | FPT_scsel(p_port); | ||
5806 | FPT_scasid(p_card, p_port); | ||
5807 | } | ||
5808 | 5635 | ||
5809 | } | 5636 | i = FPT_scxferc(p_port, 0x00); |
5637 | if (i == ASSIGN_ID) { | ||
5638 | if (! | ||
5639 | (FPT_scsendi | ||
5640 | (p_port, | ||
5641 | &FPT_scamInfo[p_our_id].id_string[0]))) { | ||
5642 | i = FPT_scxferc(p_port, 0x00); | ||
5643 | if (FPT_scvalq(i)) { | ||
5644 | k = FPT_scxferc(p_port, 0x00); | ||
5645 | |||
5646 | if (FPT_scvalq(k)) { | ||
5647 | currCard->ourId = | ||
5648 | ((unsigned char)(i | ||
5649 | << | ||
5650 | 3) | ||
5651 | + | ||
5652 | (k & | ||
5653 | (unsigned char)7)) | ||
5654 | & (unsigned char) | ||
5655 | 0x3F; | ||
5656 | FPT_inisci(p_card, | ||
5657 | p_port, | ||
5658 | p_our_id); | ||
5659 | FPT_scamInfo[currCard-> | ||
5660 | ourId]. | ||
5661 | state = ID_ASSIGNED; | ||
5662 | FPT_scamInfo[currCard-> | ||
5663 | ourId]. | ||
5664 | id_string[0] | ||
5665 | = SLV_TYPE_CODE0; | ||
5666 | assigned_id = 1; | ||
5667 | } | ||
5668 | } | ||
5669 | } | ||
5670 | } | ||
5810 | 5671 | ||
5811 | else if ((loser) && (ScamFlg & SCAM_ENABLED)) | 5672 | else if (i == SET_P_FLAG) { |
5812 | { | 5673 | if (!(FPT_scsendi(p_port, |
5813 | FPT_scamInfo[p_our_id].id_string[0] = SLV_TYPE_CODE0; | 5674 | &FPT_scamInfo[p_our_id]. |
5814 | assigned_id = 0; | 5675 | id_string[0]))) |
5815 | FPT_scwtsel(p_port); | 5676 | FPT_scamInfo[p_our_id].id_string[0] |= |
5816 | 5677 | 0x80; | |
5817 | do { | 5678 | } |
5818 | while (FPT_scxferc(p_port,0x00) != SYNC_PTRN) {} | 5679 | } while (!assigned_id); |
5819 | |||
5820 | i = FPT_scxferc(p_port,0x00); | ||
5821 | if (i == ASSIGN_ID) | ||
5822 | { | ||
5823 | if (!(FPT_scsendi(p_port,&FPT_scamInfo[p_our_id].id_string[0]))) | ||
5824 | { | ||
5825 | i = FPT_scxferc(p_port,0x00); | ||
5826 | if (FPT_scvalq(i)) | ||
5827 | { | ||
5828 | k = FPT_scxferc(p_port,0x00); | ||
5829 | |||
5830 | if (FPT_scvalq(k)) | ||
5831 | { | ||
5832 | currCard->ourId = | ||
5833 | ((unsigned char)(i<<3)+(k & (unsigned char)7)) & (unsigned char) 0x3F; | ||
5834 | FPT_inisci(p_card, p_port, p_our_id); | ||
5835 | FPT_scamInfo[currCard->ourId].state = ID_ASSIGNED; | ||
5836 | FPT_scamInfo[currCard->ourId].id_string[0] | ||
5837 | = SLV_TYPE_CODE0; | ||
5838 | assigned_id = 1; | ||
5839 | } | ||
5840 | } | ||
5841 | } | ||
5842 | } | ||
5843 | |||
5844 | else if (i == SET_P_FLAG) | ||
5845 | { | ||
5846 | if (!(FPT_scsendi(p_port, | ||
5847 | &FPT_scamInfo[p_our_id].id_string[0]))) | ||
5848 | FPT_scamInfo[p_our_id].id_string[0] |= 0x80; | ||
5849 | } | ||
5850 | }while (!assigned_id); | ||
5851 | |||
5852 | while (FPT_scxferc(p_port,0x00) != CFG_CMPLT) {} | ||
5853 | } | ||
5854 | 5680 | ||
5855 | if (ScamFlg & SCAM_ENABLED) | 5681 | while (FPT_scxferc(p_port, 0x00) != CFG_CMPLT) { |
5856 | { | 5682 | } |
5857 | FPT_scbusf(p_port); | 5683 | } |
5858 | if (currCard->globalFlags & F_UPDATE_EEPROM) | ||
5859 | { | ||
5860 | FPT_scsavdi(p_card, p_port); | ||
5861 | currCard->globalFlags &= ~F_UPDATE_EEPROM; | ||
5862 | } | ||
5863 | } | ||
5864 | 5684 | ||
5685 | if (ScamFlg & SCAM_ENABLED) { | ||
5686 | FPT_scbusf(p_port); | ||
5687 | if (currCard->globalFlags & F_UPDATE_EEPROM) { | ||
5688 | FPT_scsavdi(p_card, p_port); | ||
5689 | currCard->globalFlags &= ~F_UPDATE_EEPROM; | ||
5690 | } | ||
5691 | } | ||
5865 | 5692 | ||
5866 | /* | 5693 | /* |
5867 | for (i=0,k=0; i < MAX_SCSI_TAR; i++) | 5694 | for (i=0,k=0; i < MAX_SCSI_TAR; i++) |
@@ -5878,7 +5705,6 @@ static void FPT_scini(unsigned char p_card, unsigned char p_our_id, unsigned cha | |||
5878 | */ | 5705 | */ |
5879 | } | 5706 | } |
5880 | 5707 | ||
5881 | |||
5882 | /*--------------------------------------------------------------------- | 5708 | /*--------------------------------------------------------------------- |
5883 | * | 5709 | * |
5884 | * Function: FPT_scarb | 5710 | * Function: FPT_scarb |
@@ -5889,57 +5715,58 @@ static void FPT_scini(unsigned char p_card, unsigned char p_our_id, unsigned cha | |||
5889 | 5715 | ||
5890 | static int FPT_scarb(unsigned long p_port, unsigned char p_sel_type) | 5716 | static int FPT_scarb(unsigned long p_port, unsigned char p_sel_type) |
5891 | { | 5717 | { |
5892 | if (p_sel_type == INIT_SELTD) | 5718 | if (p_sel_type == INIT_SELTD) { |
5893 | { | ||
5894 | |||
5895 | while (RD_HARPOON(p_port+hp_scsisig) & (SCSI_SEL | SCSI_BSY)) {} | ||
5896 | |||
5897 | 5719 | ||
5898 | if (RD_HARPOON(p_port+hp_scsisig) & SCSI_SEL) | 5720 | while (RD_HARPOON(p_port + hp_scsisig) & (SCSI_SEL | SCSI_BSY)) { |
5899 | return(0); | 5721 | } |
5900 | |||
5901 | if (RD_HARPOON(p_port+hp_scsidata_0) != 00) | ||
5902 | return(0); | ||
5903 | 5722 | ||
5904 | WR_HARPOON(p_port+hp_scsisig, (RD_HARPOON(p_port+hp_scsisig) | SCSI_BSY)); | 5723 | if (RD_HARPOON(p_port + hp_scsisig) & SCSI_SEL) |
5724 | return (0); | ||
5905 | 5725 | ||
5906 | if (RD_HARPOON(p_port+hp_scsisig) & SCSI_SEL) { | 5726 | if (RD_HARPOON(p_port + hp_scsidata_0) != 00) |
5727 | return (0); | ||
5907 | 5728 | ||
5908 | WR_HARPOON(p_port+hp_scsisig, (RD_HARPOON(p_port+hp_scsisig) & | 5729 | WR_HARPOON(p_port + hp_scsisig, |
5909 | ~SCSI_BSY)); | 5730 | (RD_HARPOON(p_port + hp_scsisig) | SCSI_BSY)); |
5910 | return(0); | ||
5911 | } | ||
5912 | 5731 | ||
5732 | if (RD_HARPOON(p_port + hp_scsisig) & SCSI_SEL) { | ||
5913 | 5733 | ||
5914 | WR_HARPOON(p_port+hp_scsisig, (RD_HARPOON(p_port+hp_scsisig) | SCSI_SEL)); | 5734 | WR_HARPOON(p_port + hp_scsisig, |
5735 | (RD_HARPOON(p_port + hp_scsisig) & | ||
5736 | ~SCSI_BSY)); | ||
5737 | return (0); | ||
5738 | } | ||
5915 | 5739 | ||
5916 | if (RD_HARPOON(p_port+hp_scsidata_0) != 00) { | 5740 | WR_HARPOON(p_port + hp_scsisig, |
5741 | (RD_HARPOON(p_port + hp_scsisig) | SCSI_SEL)); | ||
5917 | 5742 | ||
5918 | WR_HARPOON(p_port+hp_scsisig, (RD_HARPOON(p_port+hp_scsisig) & | 5743 | if (RD_HARPOON(p_port + hp_scsidata_0) != 00) { |
5919 | ~(SCSI_BSY | SCSI_SEL))); | ||
5920 | return(0); | ||
5921 | } | ||
5922 | } | ||
5923 | 5744 | ||
5745 | WR_HARPOON(p_port + hp_scsisig, | ||
5746 | (RD_HARPOON(p_port + hp_scsisig) & | ||
5747 | ~(SCSI_BSY | SCSI_SEL))); | ||
5748 | return (0); | ||
5749 | } | ||
5750 | } | ||
5924 | 5751 | ||
5925 | WR_HARPOON(p_port+hp_clkctrl_0, (RD_HARPOON(p_port+hp_clkctrl_0) | 5752 | WR_HARPOON(p_port + hp_clkctrl_0, (RD_HARPOON(p_port + hp_clkctrl_0) |
5926 | & ~ACTdeassert)); | 5753 | & ~ACTdeassert)); |
5927 | WR_HARPOON(p_port+hp_scsireset, SCAM_EN); | 5754 | WR_HARPOON(p_port + hp_scsireset, SCAM_EN); |
5928 | WR_HARPOON(p_port+hp_scsidata_0, 0x00); | 5755 | WR_HARPOON(p_port + hp_scsidata_0, 0x00); |
5929 | WR_HARPOON(p_port+hp_scsidata_1, 0x00); | 5756 | WR_HARPOON(p_port + hp_scsidata_1, 0x00); |
5930 | WR_HARPOON(p_port+hp_portctrl_0, SCSI_BUS_EN); | 5757 | WR_HARPOON(p_port + hp_portctrl_0, SCSI_BUS_EN); |
5931 | 5758 | ||
5932 | WR_HARPOON(p_port+hp_scsisig, (RD_HARPOON(p_port+hp_scsisig) | SCSI_MSG)); | 5759 | WR_HARPOON(p_port + hp_scsisig, |
5760 | (RD_HARPOON(p_port + hp_scsisig) | SCSI_MSG)); | ||
5933 | 5761 | ||
5934 | WR_HARPOON(p_port+hp_scsisig, (RD_HARPOON(p_port+hp_scsisig) | 5762 | WR_HARPOON(p_port + hp_scsisig, (RD_HARPOON(p_port + hp_scsisig) |
5935 | & ~SCSI_BSY)); | 5763 | & ~SCSI_BSY)); |
5936 | 5764 | ||
5937 | FPT_Wait(p_port,TO_250ms); | 5765 | FPT_Wait(p_port, TO_250ms); |
5938 | 5766 | ||
5939 | return(1); | 5767 | return (1); |
5940 | } | 5768 | } |
5941 | 5769 | ||
5942 | |||
5943 | /*--------------------------------------------------------------------- | 5770 | /*--------------------------------------------------------------------- |
5944 | * | 5771 | * |
5945 | * Function: FPT_scbusf | 5772 | * Function: FPT_scbusf |
@@ -5950,32 +5777,28 @@ static int FPT_scarb(unsigned long p_port, unsigned char p_sel_type) | |||
5950 | 5777 | ||
5951 | static void FPT_scbusf(unsigned long p_port) | 5778 | static void FPT_scbusf(unsigned long p_port) |
5952 | { | 5779 | { |
5953 | WR_HARPOON(p_port+hp_page_ctrl, | 5780 | WR_HARPOON(p_port + hp_page_ctrl, |
5954 | (RD_HARPOON(p_port+hp_page_ctrl) | G_INT_DISABLE)); | 5781 | (RD_HARPOON(p_port + hp_page_ctrl) | G_INT_DISABLE)); |
5955 | |||
5956 | |||
5957 | WR_HARPOON(p_port+hp_scsidata_0, 0x00); | ||
5958 | 5782 | ||
5959 | WR_HARPOON(p_port+hp_portctrl_0, (RD_HARPOON(p_port+hp_portctrl_0) | 5783 | WR_HARPOON(p_port + hp_scsidata_0, 0x00); |
5960 | & ~SCSI_BUS_EN)); | ||
5961 | 5784 | ||
5962 | WR_HARPOON(p_port+hp_scsisig, 0x00); | 5785 | WR_HARPOON(p_port + hp_portctrl_0, (RD_HARPOON(p_port + hp_portctrl_0) |
5786 | & ~SCSI_BUS_EN)); | ||
5963 | 5787 | ||
5788 | WR_HARPOON(p_port + hp_scsisig, 0x00); | ||
5964 | 5789 | ||
5965 | WR_HARPOON(p_port+hp_scsireset, (RD_HARPOON(p_port+hp_scsireset) | 5790 | WR_HARPOON(p_port + hp_scsireset, (RD_HARPOON(p_port + hp_scsireset) |
5966 | & ~SCAM_EN)); | 5791 | & ~SCAM_EN)); |
5967 | 5792 | ||
5968 | WR_HARPOON(p_port+hp_clkctrl_0, (RD_HARPOON(p_port+hp_clkctrl_0) | 5793 | WR_HARPOON(p_port + hp_clkctrl_0, (RD_HARPOON(p_port + hp_clkctrl_0) |
5969 | | ACTdeassert)); | 5794 | | ACTdeassert)); |
5970 | 5795 | ||
5971 | WRW_HARPOON((p_port+hp_intstat), (BUS_FREE | AUTO_INT | SCAM_SEL)); | 5796 | WRW_HARPOON((p_port + hp_intstat), (BUS_FREE | AUTO_INT | SCAM_SEL)); |
5972 | 5797 | ||
5973 | WR_HARPOON(p_port+hp_page_ctrl, | 5798 | WR_HARPOON(p_port + hp_page_ctrl, |
5974 | (RD_HARPOON(p_port+hp_page_ctrl) & ~G_INT_DISABLE)); | 5799 | (RD_HARPOON(p_port + hp_page_ctrl) & ~G_INT_DISABLE)); |
5975 | } | 5800 | } |
5976 | 5801 | ||
5977 | |||
5978 | |||
5979 | /*--------------------------------------------------------------------- | 5802 | /*--------------------------------------------------------------------- |
5980 | * | 5803 | * |
5981 | * Function: FPT_scasid | 5804 | * Function: FPT_scasid |
@@ -5986,84 +5809,73 @@ static void FPT_scbusf(unsigned long p_port) | |||
5986 | 5809 | ||
5987 | static void FPT_scasid(unsigned char p_card, unsigned long p_port) | 5810 | static void FPT_scasid(unsigned char p_card, unsigned long p_port) |
5988 | { | 5811 | { |
5989 | unsigned char temp_id_string[ID_STRING_LENGTH]; | 5812 | unsigned char temp_id_string[ID_STRING_LENGTH]; |
5990 | 5813 | ||
5991 | unsigned char i,k,scam_id; | 5814 | unsigned char i, k, scam_id; |
5992 | unsigned char crcBytes[3]; | 5815 | unsigned char crcBytes[3]; |
5993 | struct nvram_info * pCurrNvRam; | 5816 | struct nvram_info *pCurrNvRam; |
5994 | unsigned short * pCrcBytes; | 5817 | unsigned short *pCrcBytes; |
5995 | 5818 | ||
5996 | pCurrNvRam = FPT_BL_Card[p_card].pNvRamInfo; | 5819 | pCurrNvRam = FPT_BL_Card[p_card].pNvRamInfo; |
5997 | 5820 | ||
5998 | i=0; | 5821 | i = 0; |
5999 | 5822 | ||
6000 | while (!i) | 5823 | while (!i) { |
6001 | { | ||
6002 | 5824 | ||
6003 | for (k=0; k < ID_STRING_LENGTH; k++) | 5825 | for (k = 0; k < ID_STRING_LENGTH; k++) { |
6004 | { | 5826 | temp_id_string[k] = (unsigned char)0x00; |
6005 | temp_id_string[k] = (unsigned char) 0x00; | 5827 | } |
6006 | } | ||
6007 | 5828 | ||
6008 | FPT_scxferc(p_port,SYNC_PTRN); | 5829 | FPT_scxferc(p_port, SYNC_PTRN); |
6009 | FPT_scxferc(p_port,ASSIGN_ID); | 5830 | FPT_scxferc(p_port, ASSIGN_ID); |
6010 | 5831 | ||
6011 | if (!(FPT_sciso(p_port,&temp_id_string[0]))) | 5832 | if (!(FPT_sciso(p_port, &temp_id_string[0]))) { |
6012 | { | 5833 | if (pCurrNvRam) { |
6013 | if(pCurrNvRam){ | ||
6014 | pCrcBytes = (unsigned short *)&crcBytes[0]; | 5834 | pCrcBytes = (unsigned short *)&crcBytes[0]; |
6015 | *pCrcBytes = FPT_CalcCrc16(&temp_id_string[0]); | 5835 | *pCrcBytes = FPT_CalcCrc16(&temp_id_string[0]); |
6016 | crcBytes[2] = FPT_CalcLrc(&temp_id_string[0]); | 5836 | crcBytes[2] = FPT_CalcLrc(&temp_id_string[0]); |
6017 | temp_id_string[1] = crcBytes[2]; | 5837 | temp_id_string[1] = crcBytes[2]; |
6018 | temp_id_string[2] = crcBytes[0]; | 5838 | temp_id_string[2] = crcBytes[0]; |
6019 | temp_id_string[3] = crcBytes[1]; | 5839 | temp_id_string[3] = crcBytes[1]; |
6020 | for(k = 4; k < ID_STRING_LENGTH; k++) | 5840 | for (k = 4; k < ID_STRING_LENGTH; k++) |
6021 | temp_id_string[k] = (unsigned char) 0x00; | 5841 | temp_id_string[k] = (unsigned char)0x00; |
6022 | } | 5842 | } |
6023 | i = FPT_scmachid(p_card,temp_id_string); | 5843 | i = FPT_scmachid(p_card, temp_id_string); |
6024 | 5844 | ||
6025 | if (i == CLR_PRIORITY) | 5845 | if (i == CLR_PRIORITY) { |
6026 | { | 5846 | FPT_scxferc(p_port, MISC_CODE); |
6027 | FPT_scxferc(p_port,MISC_CODE); | 5847 | FPT_scxferc(p_port, CLR_P_FLAG); |
6028 | FPT_scxferc(p_port,CLR_P_FLAG); | 5848 | i = 0; /*Not the last ID yet. */ |
6029 | i = 0; /*Not the last ID yet. */ | 5849 | } |
6030 | } | ||
6031 | |||
6032 | else if (i != NO_ID_AVAIL) | ||
6033 | { | ||
6034 | if (i < 8 ) | ||
6035 | FPT_scxferc(p_port,ID_0_7); | ||
6036 | else | ||
6037 | FPT_scxferc(p_port,ID_8_F); | ||
6038 | 5850 | ||
6039 | scam_id = (i & (unsigned char) 0x07); | 5851 | else if (i != NO_ID_AVAIL) { |
5852 | if (i < 8) | ||
5853 | FPT_scxferc(p_port, ID_0_7); | ||
5854 | else | ||
5855 | FPT_scxferc(p_port, ID_8_F); | ||
6040 | 5856 | ||
5857 | scam_id = (i & (unsigned char)0x07); | ||
6041 | 5858 | ||
6042 | for (k=1; k < 0x08; k <<= 1) | 5859 | for (k = 1; k < 0x08; k <<= 1) |
6043 | if (!( k & i )) | 5860 | if (!(k & i)) |
6044 | scam_id += 0x08; /*Count number of zeros in DB0-3. */ | 5861 | scam_id += 0x08; /*Count number of zeros in DB0-3. */ |
6045 | 5862 | ||
6046 | FPT_scxferc(p_port,scam_id); | 5863 | FPT_scxferc(p_port, scam_id); |
6047 | 5864 | ||
6048 | i = 0; /*Not the last ID yet. */ | 5865 | i = 0; /*Not the last ID yet. */ |
6049 | } | 5866 | } |
6050 | } | 5867 | } |
6051 | 5868 | ||
6052 | else | 5869 | else { |
6053 | { | 5870 | i = 1; |
6054 | i = 1; | 5871 | } |
6055 | } | ||
6056 | 5872 | ||
6057 | } /*End while */ | 5873 | } /*End while */ |
6058 | 5874 | ||
6059 | FPT_scxferc(p_port,SYNC_PTRN); | 5875 | FPT_scxferc(p_port, SYNC_PTRN); |
6060 | FPT_scxferc(p_port,CFG_CMPLT); | 5876 | FPT_scxferc(p_port, CFG_CMPLT); |
6061 | } | 5877 | } |
6062 | 5878 | ||
6063 | |||
6064 | |||
6065 | |||
6066 | |||
6067 | /*--------------------------------------------------------------------- | 5879 | /*--------------------------------------------------------------------- |
6068 | * | 5880 | * |
6069 | * Function: FPT_scsel | 5881 | * Function: FPT_scsel |
@@ -6075,29 +5887,29 @@ static void FPT_scasid(unsigned char p_card, unsigned long p_port) | |||
6075 | static void FPT_scsel(unsigned long p_port) | 5887 | static void FPT_scsel(unsigned long p_port) |
6076 | { | 5888 | { |
6077 | 5889 | ||
6078 | WR_HARPOON(p_port+hp_scsisig, SCSI_SEL); | 5890 | WR_HARPOON(p_port + hp_scsisig, SCSI_SEL); |
6079 | FPT_scwiros(p_port, SCSI_MSG); | 5891 | FPT_scwiros(p_port, SCSI_MSG); |
6080 | |||
6081 | WR_HARPOON(p_port+hp_scsisig, (SCSI_SEL | SCSI_BSY)); | ||
6082 | |||
6083 | 5892 | ||
6084 | WR_HARPOON(p_port+hp_scsisig, (SCSI_SEL | SCSI_BSY | SCSI_IOBIT | SCSI_CD)); | 5893 | WR_HARPOON(p_port + hp_scsisig, (SCSI_SEL | SCSI_BSY)); |
6085 | WR_HARPOON(p_port+hp_scsidata_0, (unsigned char)(RD_HARPOON(p_port+hp_scsidata_0) | | ||
6086 | (unsigned char)(BIT(7)+BIT(6)))); | ||
6087 | 5894 | ||
5895 | WR_HARPOON(p_port + hp_scsisig, | ||
5896 | (SCSI_SEL | SCSI_BSY | SCSI_IOBIT | SCSI_CD)); | ||
5897 | WR_HARPOON(p_port + hp_scsidata_0, | ||
5898 | (unsigned char)(RD_HARPOON(p_port + hp_scsidata_0) | | ||
5899 | (unsigned char)(BIT(7) + BIT(6)))); | ||
6088 | 5900 | ||
6089 | WR_HARPOON(p_port+hp_scsisig, (SCSI_BSY | SCSI_IOBIT | SCSI_CD)); | 5901 | WR_HARPOON(p_port + hp_scsisig, (SCSI_BSY | SCSI_IOBIT | SCSI_CD)); |
6090 | FPT_scwiros(p_port, SCSI_SEL); | 5902 | FPT_scwiros(p_port, SCSI_SEL); |
6091 | 5903 | ||
6092 | WR_HARPOON(p_port+hp_scsidata_0, (unsigned char)(RD_HARPOON(p_port+hp_scsidata_0) & | 5904 | WR_HARPOON(p_port + hp_scsidata_0, |
6093 | ~(unsigned char)BIT(6))); | 5905 | (unsigned char)(RD_HARPOON(p_port + hp_scsidata_0) & |
6094 | FPT_scwirod(p_port, BIT(6)); | 5906 | ~(unsigned char)BIT(6))); |
5907 | FPT_scwirod(p_port, BIT(6)); | ||
6095 | 5908 | ||
6096 | WR_HARPOON(p_port+hp_scsisig, (SCSI_SEL | SCSI_BSY | SCSI_IOBIT | SCSI_CD)); | 5909 | WR_HARPOON(p_port + hp_scsisig, |
5910 | (SCSI_SEL | SCSI_BSY | SCSI_IOBIT | SCSI_CD)); | ||
6097 | } | 5911 | } |
6098 | 5912 | ||
6099 | |||
6100 | |||
6101 | /*--------------------------------------------------------------------- | 5913 | /*--------------------------------------------------------------------- |
6102 | * | 5914 | * |
6103 | * Function: FPT_scxferc | 5915 | * Function: FPT_scxferc |
@@ -6108,46 +5920,45 @@ static void FPT_scsel(unsigned long p_port) | |||
6108 | 5920 | ||
6109 | static unsigned char FPT_scxferc(unsigned long p_port, unsigned char p_data) | 5921 | static unsigned char FPT_scxferc(unsigned long p_port, unsigned char p_data) |
6110 | { | 5922 | { |
6111 | unsigned char curr_data, ret_data; | 5923 | unsigned char curr_data, ret_data; |
6112 | 5924 | ||
6113 | curr_data = p_data | BIT(7) | BIT(5); /*Start with DB7 & DB5 asserted. */ | 5925 | curr_data = p_data | BIT(7) | BIT(5); /*Start with DB7 & DB5 asserted. */ |
6114 | 5926 | ||
6115 | WR_HARPOON(p_port+hp_scsidata_0, curr_data); | 5927 | WR_HARPOON(p_port + hp_scsidata_0, curr_data); |
6116 | 5928 | ||
6117 | curr_data &= ~BIT(7); | 5929 | curr_data &= ~BIT(7); |
6118 | 5930 | ||
6119 | WR_HARPOON(p_port+hp_scsidata_0, curr_data); | 5931 | WR_HARPOON(p_port + hp_scsidata_0, curr_data); |
6120 | 5932 | ||
6121 | FPT_scwirod(p_port,BIT(7)); /*Wait for DB7 to be released. */ | 5933 | FPT_scwirod(p_port, BIT(7)); /*Wait for DB7 to be released. */ |
6122 | while (!(RD_HARPOON(p_port+hp_scsidata_0) & BIT(5))); | 5934 | while (!(RD_HARPOON(p_port + hp_scsidata_0) & BIT(5))) ; |
6123 | 5935 | ||
6124 | ret_data = (RD_HARPOON(p_port+hp_scsidata_0) & (unsigned char) 0x1F); | 5936 | ret_data = (RD_HARPOON(p_port + hp_scsidata_0) & (unsigned char)0x1F); |
6125 | 5937 | ||
6126 | curr_data |= BIT(6); | 5938 | curr_data |= BIT(6); |
6127 | 5939 | ||
6128 | WR_HARPOON(p_port+hp_scsidata_0, curr_data); | 5940 | WR_HARPOON(p_port + hp_scsidata_0, curr_data); |
6129 | 5941 | ||
6130 | curr_data &= ~BIT(5); | 5942 | curr_data &= ~BIT(5); |
6131 | 5943 | ||
6132 | WR_HARPOON(p_port+hp_scsidata_0, curr_data); | 5944 | WR_HARPOON(p_port + hp_scsidata_0, curr_data); |
6133 | 5945 | ||
6134 | FPT_scwirod(p_port,BIT(5)); /*Wait for DB5 to be released. */ | 5946 | FPT_scwirod(p_port, BIT(5)); /*Wait for DB5 to be released. */ |
6135 | 5947 | ||
6136 | curr_data &= ~(BIT(4)|BIT(3)|BIT(2)|BIT(1)|BIT(0)); /*Release data bits */ | 5948 | curr_data &= ~(BIT(4) | BIT(3) | BIT(2) | BIT(1) | BIT(0)); /*Release data bits */ |
6137 | curr_data |= BIT(7); | 5949 | curr_data |= BIT(7); |
6138 | 5950 | ||
6139 | WR_HARPOON(p_port+hp_scsidata_0, curr_data); | 5951 | WR_HARPOON(p_port + hp_scsidata_0, curr_data); |
6140 | 5952 | ||
6141 | curr_data &= ~BIT(6); | 5953 | curr_data &= ~BIT(6); |
6142 | 5954 | ||
6143 | WR_HARPOON(p_port+hp_scsidata_0, curr_data); | 5955 | WR_HARPOON(p_port + hp_scsidata_0, curr_data); |
6144 | 5956 | ||
6145 | FPT_scwirod(p_port,BIT(6)); /*Wait for DB6 to be released. */ | 5957 | FPT_scwirod(p_port, BIT(6)); /*Wait for DB6 to be released. */ |
6146 | 5958 | ||
6147 | return(ret_data); | 5959 | return (ret_data); |
6148 | } | 5960 | } |
6149 | 5961 | ||
6150 | |||
6151 | /*--------------------------------------------------------------------- | 5962 | /*--------------------------------------------------------------------- |
6152 | * | 5963 | * |
6153 | * Function: FPT_scsendi | 5964 | * Function: FPT_scsendi |
@@ -6157,51 +5968,50 @@ static unsigned char FPT_scxferc(unsigned long p_port, unsigned char p_data) | |||
6157 | * | 5968 | * |
6158 | *---------------------------------------------------------------------*/ | 5969 | *---------------------------------------------------------------------*/ |
6159 | 5970 | ||
6160 | static unsigned char FPT_scsendi(unsigned long p_port, unsigned char p_id_string[]) | 5971 | static unsigned char FPT_scsendi(unsigned long p_port, |
5972 | unsigned char p_id_string[]) | ||
6161 | { | 5973 | { |
6162 | unsigned char ret_data,byte_cnt,bit_cnt,defer; | 5974 | unsigned char ret_data, byte_cnt, bit_cnt, defer; |
6163 | 5975 | ||
6164 | defer = 0; | 5976 | defer = 0; |
6165 | 5977 | ||
6166 | for (byte_cnt = 0; byte_cnt < ID_STRING_LENGTH; byte_cnt++) { | 5978 | for (byte_cnt = 0; byte_cnt < ID_STRING_LENGTH; byte_cnt++) { |
6167 | 5979 | ||
6168 | for (bit_cnt = 0x80; bit_cnt != 0 ; bit_cnt >>= 1) { | 5980 | for (bit_cnt = 0x80; bit_cnt != 0; bit_cnt >>= 1) { |
6169 | 5981 | ||
6170 | if (defer) | 5982 | if (defer) |
6171 | ret_data = FPT_scxferc(p_port,00); | 5983 | ret_data = FPT_scxferc(p_port, 00); |
6172 | 5984 | ||
6173 | else if (p_id_string[byte_cnt] & bit_cnt) | 5985 | else if (p_id_string[byte_cnt] & bit_cnt) |
6174 | 5986 | ||
6175 | ret_data = FPT_scxferc(p_port,02); | 5987 | ret_data = FPT_scxferc(p_port, 02); |
6176 | 5988 | ||
6177 | else { | 5989 | else { |
6178 | 5990 | ||
6179 | ret_data = FPT_scxferc(p_port,01); | 5991 | ret_data = FPT_scxferc(p_port, 01); |
6180 | if (ret_data & 02) | 5992 | if (ret_data & 02) |
6181 | defer = 1; | 5993 | defer = 1; |
6182 | } | 5994 | } |
6183 | 5995 | ||
6184 | if ((ret_data & 0x1C) == 0x10) | 5996 | if ((ret_data & 0x1C) == 0x10) |
6185 | return(0x00); /*End of isolation stage, we won! */ | 5997 | return (0x00); /*End of isolation stage, we won! */ |
6186 | 5998 | ||
6187 | if (ret_data & 0x1C) | 5999 | if (ret_data & 0x1C) |
6188 | return(0xFF); | 6000 | return (0xFF); |
6189 | 6001 | ||
6190 | if ((defer) && (!(ret_data & 0x1F))) | 6002 | if ((defer) && (!(ret_data & 0x1F))) |
6191 | return(0x01); /*End of isolation stage, we lost. */ | 6003 | return (0x01); /*End of isolation stage, we lost. */ |
6192 | 6004 | ||
6193 | } /*bit loop */ | 6005 | } /*bit loop */ |
6194 | 6006 | ||
6195 | } /*byte loop */ | 6007 | } /*byte loop */ |
6196 | 6008 | ||
6197 | if (defer) | 6009 | if (defer) |
6198 | return(0x01); /*We lost */ | 6010 | return (0x01); /*We lost */ |
6199 | else | 6011 | else |
6200 | return(0); /*We WON! Yeeessss! */ | 6012 | return (0); /*We WON! Yeeessss! */ |
6201 | } | 6013 | } |
6202 | 6014 | ||
6203 | |||
6204 | |||
6205 | /*--------------------------------------------------------------------- | 6015 | /*--------------------------------------------------------------------- |
6206 | * | 6016 | * |
6207 | * Function: FPT_sciso | 6017 | * Function: FPT_sciso |
@@ -6210,31 +6020,31 @@ static unsigned char FPT_scsendi(unsigned long p_port, unsigned char p_id_string | |||
6210 | * | 6020 | * |
6211 | *---------------------------------------------------------------------*/ | 6021 | *---------------------------------------------------------------------*/ |
6212 | 6022 | ||
6213 | static unsigned char FPT_sciso(unsigned long p_port, unsigned char p_id_string[]) | 6023 | static unsigned char FPT_sciso(unsigned long p_port, |
6024 | unsigned char p_id_string[]) | ||
6214 | { | 6025 | { |
6215 | unsigned char ret_data,the_data,byte_cnt,bit_cnt; | 6026 | unsigned char ret_data, the_data, byte_cnt, bit_cnt; |
6216 | 6027 | ||
6217 | the_data = 0; | 6028 | the_data = 0; |
6218 | 6029 | ||
6219 | for (byte_cnt = 0; byte_cnt < ID_STRING_LENGTH; byte_cnt++) { | 6030 | for (byte_cnt = 0; byte_cnt < ID_STRING_LENGTH; byte_cnt++) { |
6220 | 6031 | ||
6221 | for (bit_cnt = 0; bit_cnt < 8; bit_cnt++) { | 6032 | for (bit_cnt = 0; bit_cnt < 8; bit_cnt++) { |
6222 | 6033 | ||
6223 | ret_data = FPT_scxferc(p_port,0); | 6034 | ret_data = FPT_scxferc(p_port, 0); |
6224 | 6035 | ||
6225 | if (ret_data & 0xFC) | 6036 | if (ret_data & 0xFC) |
6226 | return(0xFF); | 6037 | return (0xFF); |
6227 | 6038 | ||
6228 | else { | 6039 | else { |
6229 | 6040 | ||
6230 | the_data <<= 1; | 6041 | the_data <<= 1; |
6231 | if (ret_data & BIT(1)) { | 6042 | if (ret_data & BIT(1)) { |
6232 | the_data |= 1; | 6043 | the_data |= 1; |
6233 | } | 6044 | } |
6234 | } | 6045 | } |
6235 | 6046 | ||
6236 | if ((ret_data & 0x1F) == 0) | 6047 | if ((ret_data & 0x1F) == 0) { |
6237 | { | ||
6238 | /* | 6048 | /* |
6239 | if(bit_cnt != 0 || bit_cnt != 8) | 6049 | if(bit_cnt != 0 || bit_cnt != 8) |
6240 | { | 6050 | { |
@@ -6245,23 +6055,21 @@ static unsigned char FPT_sciso(unsigned long p_port, unsigned char p_id_string[] | |||
6245 | continue; | 6055 | continue; |
6246 | } | 6056 | } |
6247 | */ | 6057 | */ |
6248 | if (byte_cnt) | 6058 | if (byte_cnt) |
6249 | return(0x00); | 6059 | return (0x00); |
6250 | else | 6060 | else |
6251 | return(0xFF); | 6061 | return (0xFF); |
6252 | } | 6062 | } |
6253 | 6063 | ||
6254 | } /*bit loop */ | 6064 | } /*bit loop */ |
6255 | 6065 | ||
6256 | p_id_string[byte_cnt] = the_data; | 6066 | p_id_string[byte_cnt] = the_data; |
6257 | 6067 | ||
6258 | } /*byte loop */ | 6068 | } /*byte loop */ |
6259 | 6069 | ||
6260 | return(0); | 6070 | return (0); |
6261 | } | 6071 | } |
6262 | 6072 | ||
6263 | |||
6264 | |||
6265 | /*--------------------------------------------------------------------- | 6073 | /*--------------------------------------------------------------------- |
6266 | * | 6074 | * |
6267 | * Function: FPT_scwirod | 6075 | * Function: FPT_scwirod |
@@ -6273,24 +6081,22 @@ static unsigned char FPT_sciso(unsigned long p_port, unsigned char p_id_string[] | |||
6273 | 6081 | ||
6274 | static void FPT_scwirod(unsigned long p_port, unsigned char p_data_bit) | 6082 | static void FPT_scwirod(unsigned long p_port, unsigned char p_data_bit) |
6275 | { | 6083 | { |
6276 | unsigned char i; | 6084 | unsigned char i; |
6277 | 6085 | ||
6278 | i = 0; | 6086 | i = 0; |
6279 | while ( i < MAX_SCSI_TAR ) { | 6087 | while (i < MAX_SCSI_TAR) { |
6280 | 6088 | ||
6281 | if (RD_HARPOON(p_port+hp_scsidata_0) & p_data_bit) | 6089 | if (RD_HARPOON(p_port + hp_scsidata_0) & p_data_bit) |
6282 | 6090 | ||
6283 | i = 0; | 6091 | i = 0; |
6284 | 6092 | ||
6285 | else | 6093 | else |
6286 | 6094 | ||
6287 | i++; | 6095 | i++; |
6288 | 6096 | ||
6289 | } | 6097 | } |
6290 | } | 6098 | } |
6291 | 6099 | ||
6292 | |||
6293 | |||
6294 | /*--------------------------------------------------------------------- | 6100 | /*--------------------------------------------------------------------- |
6295 | * | 6101 | * |
6296 | * Function: FPT_scwiros | 6102 | * Function: FPT_scwiros |
@@ -6302,23 +6108,22 @@ static void FPT_scwirod(unsigned long p_port, unsigned char p_data_bit) | |||
6302 | 6108 | ||
6303 | static void FPT_scwiros(unsigned long p_port, unsigned char p_data_bit) | 6109 | static void FPT_scwiros(unsigned long p_port, unsigned char p_data_bit) |
6304 | { | 6110 | { |
6305 | unsigned char i; | 6111 | unsigned char i; |
6306 | 6112 | ||
6307 | i = 0; | 6113 | i = 0; |
6308 | while ( i < MAX_SCSI_TAR ) { | 6114 | while (i < MAX_SCSI_TAR) { |
6309 | 6115 | ||
6310 | if (RD_HARPOON(p_port+hp_scsisig) & p_data_bit) | 6116 | if (RD_HARPOON(p_port + hp_scsisig) & p_data_bit) |
6311 | 6117 | ||
6312 | i = 0; | 6118 | i = 0; |
6313 | 6119 | ||
6314 | else | 6120 | else |
6315 | 6121 | ||
6316 | i++; | 6122 | i++; |
6317 | 6123 | ||
6318 | } | 6124 | } |
6319 | } | 6125 | } |
6320 | 6126 | ||
6321 | |||
6322 | /*--------------------------------------------------------------------- | 6127 | /*--------------------------------------------------------------------- |
6323 | * | 6128 | * |
6324 | * Function: FPT_scvalq | 6129 | * Function: FPT_scvalq |
@@ -6329,21 +6134,20 @@ static void FPT_scwiros(unsigned long p_port, unsigned char p_data_bit) | |||
6329 | 6134 | ||
6330 | static unsigned char FPT_scvalq(unsigned char p_quintet) | 6135 | static unsigned char FPT_scvalq(unsigned char p_quintet) |
6331 | { | 6136 | { |
6332 | unsigned char count; | 6137 | unsigned char count; |
6333 | 6138 | ||
6334 | for (count=1; count < 0x08; count<<=1) { | 6139 | for (count = 1; count < 0x08; count <<= 1) { |
6335 | if (!(p_quintet & count)) | 6140 | if (!(p_quintet & count)) |
6336 | p_quintet -= 0x80; | 6141 | p_quintet -= 0x80; |
6337 | } | 6142 | } |
6338 | 6143 | ||
6339 | if (p_quintet & 0x18) | 6144 | if (p_quintet & 0x18) |
6340 | return(0); | 6145 | return (0); |
6341 | 6146 | ||
6342 | else | 6147 | else |
6343 | return(1); | 6148 | return (1); |
6344 | } | 6149 | } |
6345 | 6150 | ||
6346 | |||
6347 | /*--------------------------------------------------------------------- | 6151 | /*--------------------------------------------------------------------- |
6348 | * | 6152 | * |
6349 | * Function: FPT_scsell | 6153 | * Function: FPT_scsell |
@@ -6356,73 +6160,76 @@ static unsigned char FPT_scvalq(unsigned char p_quintet) | |||
6356 | 6160 | ||
6357 | static unsigned char FPT_scsell(unsigned long p_port, unsigned char targ_id) | 6161 | static unsigned char FPT_scsell(unsigned long p_port, unsigned char targ_id) |
6358 | { | 6162 | { |
6359 | unsigned long i; | 6163 | unsigned long i; |
6360 | |||
6361 | WR_HARPOON(p_port+hp_page_ctrl, | ||
6362 | (RD_HARPOON(p_port+hp_page_ctrl) | G_INT_DISABLE)); | ||
6363 | |||
6364 | ARAM_ACCESS(p_port); | ||
6365 | 6164 | ||
6366 | WR_HARPOON(p_port+hp_addstat,(RD_HARPOON(p_port+hp_addstat) | SCAM_TIMER)); | 6165 | WR_HARPOON(p_port + hp_page_ctrl, |
6367 | WR_HARPOON(p_port+hp_seltimeout,TO_4ms); | 6166 | (RD_HARPOON(p_port + hp_page_ctrl) | G_INT_DISABLE)); |
6368 | 6167 | ||
6168 | ARAM_ACCESS(p_port); | ||
6369 | 6169 | ||
6370 | for (i = p_port+CMD_STRT; i < p_port+CMD_STRT+12; i+=2) { | 6170 | WR_HARPOON(p_port + hp_addstat, |
6371 | WRW_HARPOON(i, (MPM_OP+ACOMMAND)); | 6171 | (RD_HARPOON(p_port + hp_addstat) | SCAM_TIMER)); |
6372 | } | 6172 | WR_HARPOON(p_port + hp_seltimeout, TO_4ms); |
6373 | WRW_HARPOON(i, (BRH_OP+ALWAYS+ NP)); | ||
6374 | 6173 | ||
6375 | WRW_HARPOON((p_port+hp_intstat), | 6174 | for (i = p_port + CMD_STRT; i < p_port + CMD_STRT + 12; i += 2) { |
6376 | (RESET | TIMEOUT | SEL | BUS_FREE | AUTO_INT)); | 6175 | WRW_HARPOON(i, (MPM_OP + ACOMMAND)); |
6176 | } | ||
6177 | WRW_HARPOON(i, (BRH_OP + ALWAYS + NP)); | ||
6377 | 6178 | ||
6378 | WR_HARPOON(p_port+hp_select_id, targ_id); | 6179 | WRW_HARPOON((p_port + hp_intstat), |
6180 | (RESET | TIMEOUT | SEL | BUS_FREE | AUTO_INT)); | ||
6379 | 6181 | ||
6380 | WR_HARPOON(p_port+hp_portctrl_0, SCSI_PORT); | 6182 | WR_HARPOON(p_port + hp_select_id, targ_id); |
6381 | WR_HARPOON(p_port+hp_autostart_3, (SELECT | CMD_ONLY_STRT)); | ||
6382 | WR_HARPOON(p_port+hp_scsictrl_0, (SEL_TAR | ENA_RESEL)); | ||
6383 | 6183 | ||
6184 | WR_HARPOON(p_port + hp_portctrl_0, SCSI_PORT); | ||
6185 | WR_HARPOON(p_port + hp_autostart_3, (SELECT | CMD_ONLY_STRT)); | ||
6186 | WR_HARPOON(p_port + hp_scsictrl_0, (SEL_TAR | ENA_RESEL)); | ||
6384 | 6187 | ||
6385 | while (!(RDW_HARPOON((p_port+hp_intstat)) & | 6188 | while (!(RDW_HARPOON((p_port + hp_intstat)) & |
6386 | (RESET | PROG_HLT | TIMEOUT | AUTO_INT))) {} | 6189 | (RESET | PROG_HLT | TIMEOUT | AUTO_INT))) { |
6190 | } | ||
6387 | 6191 | ||
6388 | if (RDW_HARPOON((p_port+hp_intstat)) & RESET) | 6192 | if (RDW_HARPOON((p_port + hp_intstat)) & RESET) |
6389 | FPT_Wait(p_port, TO_250ms); | 6193 | FPT_Wait(p_port, TO_250ms); |
6390 | 6194 | ||
6391 | DISABLE_AUTO(p_port); | 6195 | DISABLE_AUTO(p_port); |
6392 | 6196 | ||
6393 | WR_HARPOON(p_port+hp_addstat,(RD_HARPOON(p_port+hp_addstat) & ~SCAM_TIMER)); | 6197 | WR_HARPOON(p_port + hp_addstat, |
6394 | WR_HARPOON(p_port+hp_seltimeout,TO_290ms); | 6198 | (RD_HARPOON(p_port + hp_addstat) & ~SCAM_TIMER)); |
6199 | WR_HARPOON(p_port + hp_seltimeout, TO_290ms); | ||
6395 | 6200 | ||
6396 | SGRAM_ACCESS(p_port); | 6201 | SGRAM_ACCESS(p_port); |
6397 | 6202 | ||
6398 | if (RDW_HARPOON((p_port+hp_intstat)) & (RESET | TIMEOUT) ) { | 6203 | if (RDW_HARPOON((p_port + hp_intstat)) & (RESET | TIMEOUT)) { |
6399 | 6204 | ||
6400 | WRW_HARPOON((p_port+hp_intstat), | 6205 | WRW_HARPOON((p_port + hp_intstat), |
6401 | (RESET | TIMEOUT | SEL | BUS_FREE | PHASE)); | 6206 | (RESET | TIMEOUT | SEL | BUS_FREE | PHASE)); |
6402 | 6207 | ||
6403 | WR_HARPOON(p_port+hp_page_ctrl, | 6208 | WR_HARPOON(p_port + hp_page_ctrl, |
6404 | (RD_HARPOON(p_port+hp_page_ctrl) & ~G_INT_DISABLE)); | 6209 | (RD_HARPOON(p_port + hp_page_ctrl) & |
6210 | ~G_INT_DISABLE)); | ||
6405 | 6211 | ||
6406 | return(0); /*No legacy device */ | 6212 | return (0); /*No legacy device */ |
6407 | } | 6213 | } |
6408 | 6214 | ||
6409 | else { | 6215 | else { |
6410 | 6216 | ||
6411 | while(!(RDW_HARPOON((p_port+hp_intstat)) & BUS_FREE)) { | 6217 | while (!(RDW_HARPOON((p_port + hp_intstat)) & BUS_FREE)) { |
6412 | if (RD_HARPOON(p_port+hp_scsisig) & SCSI_REQ) | 6218 | if (RD_HARPOON(p_port + hp_scsisig) & SCSI_REQ) { |
6413 | { | 6219 | WR_HARPOON(p_port + hp_scsisig, |
6414 | WR_HARPOON(p_port+hp_scsisig, (SCSI_ACK + S_ILL_PH)); | 6220 | (SCSI_ACK + S_ILL_PH)); |
6415 | ACCEPT_MSG(p_port); | 6221 | ACCEPT_MSG(p_port); |
6416 | } | 6222 | } |
6417 | } | 6223 | } |
6418 | 6224 | ||
6419 | WRW_HARPOON((p_port+hp_intstat), CLR_ALL_INT_1); | 6225 | WRW_HARPOON((p_port + hp_intstat), CLR_ALL_INT_1); |
6420 | 6226 | ||
6421 | WR_HARPOON(p_port+hp_page_ctrl, | 6227 | WR_HARPOON(p_port + hp_page_ctrl, |
6422 | (RD_HARPOON(p_port+hp_page_ctrl) & ~G_INT_DISABLE)); | 6228 | (RD_HARPOON(p_port + hp_page_ctrl) & |
6229 | ~G_INT_DISABLE)); | ||
6423 | 6230 | ||
6424 | return(1); /*Found one of them oldies! */ | 6231 | return (1); /*Found one of them oldies! */ |
6425 | } | 6232 | } |
6426 | } | 6233 | } |
6427 | 6234 | ||
6428 | /*--------------------------------------------------------------------- | 6235 | /*--------------------------------------------------------------------- |
@@ -6435,10 +6242,10 @@ static unsigned char FPT_scsell(unsigned long p_port, unsigned char targ_id) | |||
6435 | 6242 | ||
6436 | static void FPT_scwtsel(unsigned long p_port) | 6243 | static void FPT_scwtsel(unsigned long p_port) |
6437 | { | 6244 | { |
6438 | while(!(RDW_HARPOON((p_port+hp_intstat)) & SCAM_SEL)) {} | 6245 | while (!(RDW_HARPOON((p_port + hp_intstat)) & SCAM_SEL)) { |
6246 | } | ||
6439 | } | 6247 | } |
6440 | 6248 | ||
6441 | |||
6442 | /*--------------------------------------------------------------------- | 6249 | /*--------------------------------------------------------------------- |
6443 | * | 6250 | * |
6444 | * Function: FPT_inisci | 6251 | * Function: FPT_inisci |
@@ -6447,57 +6254,64 @@ static void FPT_scwtsel(unsigned long p_port) | |||
6447 | * | 6254 | * |
6448 | *---------------------------------------------------------------------*/ | 6255 | *---------------------------------------------------------------------*/ |
6449 | 6256 | ||
6450 | static void FPT_inisci(unsigned char p_card, unsigned long p_port, unsigned char p_our_id) | 6257 | static void FPT_inisci(unsigned char p_card, unsigned long p_port, |
6258 | unsigned char p_our_id) | ||
6451 | { | 6259 | { |
6452 | unsigned char i,k,max_id; | 6260 | unsigned char i, k, max_id; |
6453 | unsigned short ee_data; | 6261 | unsigned short ee_data; |
6454 | struct nvram_info * pCurrNvRam; | 6262 | struct nvram_info *pCurrNvRam; |
6455 | 6263 | ||
6456 | pCurrNvRam = FPT_BL_Card[p_card].pNvRamInfo; | 6264 | pCurrNvRam = FPT_BL_Card[p_card].pNvRamInfo; |
6457 | 6265 | ||
6458 | if (RD_HARPOON(p_port+hp_page_ctrl) & NARROW_SCSI_CARD) | 6266 | if (RD_HARPOON(p_port + hp_page_ctrl) & NARROW_SCSI_CARD) |
6459 | max_id = 0x08; | 6267 | max_id = 0x08; |
6460 | 6268 | ||
6461 | else | 6269 | else |
6462 | max_id = 0x10; | 6270 | max_id = 0x10; |
6463 | 6271 | ||
6464 | if(pCurrNvRam){ | 6272 | if (pCurrNvRam) { |
6465 | for(i = 0; i < max_id; i++){ | 6273 | for (i = 0; i < max_id; i++) { |
6466 | 6274 | ||
6467 | for(k = 0; k < 4; k++) | 6275 | for (k = 0; k < 4; k++) |
6468 | FPT_scamInfo[i].id_string[k] = pCurrNvRam->niScamTbl[i][k]; | 6276 | FPT_scamInfo[i].id_string[k] = |
6469 | for(k = 4; k < ID_STRING_LENGTH; k++) | 6277 | pCurrNvRam->niScamTbl[i][k]; |
6470 | FPT_scamInfo[i].id_string[k] = (unsigned char) 0x00; | 6278 | for (k = 4; k < ID_STRING_LENGTH; k++) |
6279 | FPT_scamInfo[i].id_string[k] = | ||
6280 | (unsigned char)0x00; | ||
6471 | 6281 | ||
6472 | if(FPT_scamInfo[i].id_string[0] == 0x00) | 6282 | if (FPT_scamInfo[i].id_string[0] == 0x00) |
6473 | FPT_scamInfo[i].state = ID_UNUSED; /*Default to unused ID. */ | 6283 | FPT_scamInfo[i].state = ID_UNUSED; /*Default to unused ID. */ |
6474 | else | 6284 | else |
6475 | FPT_scamInfo[i].state = ID_UNASSIGNED; /*Default to unassigned ID. */ | 6285 | FPT_scamInfo[i].state = ID_UNASSIGNED; /*Default to unassigned ID. */ |
6476 | 6286 | ||
6477 | } | 6287 | } |
6478 | }else { | 6288 | } else { |
6479 | for (i=0; i < max_id; i++) | 6289 | for (i = 0; i < max_id; i++) { |
6480 | { | 6290 | for (k = 0; k < ID_STRING_LENGTH; k += 2) { |
6481 | for (k=0; k < ID_STRING_LENGTH; k+=2) | 6291 | ee_data = |
6482 | { | 6292 | FPT_utilEERead(p_port, |
6483 | ee_data = FPT_utilEERead(p_port, (unsigned short)((EE_SCAMBASE/2) + | 6293 | (unsigned |
6484 | (unsigned short) (i*((unsigned short)ID_STRING_LENGTH/2)) + (unsigned short)(k/2))); | 6294 | short)((EE_SCAMBASE / 2) + |
6485 | FPT_scamInfo[i].id_string[k] = (unsigned char) ee_data; | 6295 | (unsigned short)(i * |
6486 | ee_data >>= 8; | 6296 | ((unsigned short)ID_STRING_LENGTH / 2)) + (unsigned short)(k / 2))); |
6487 | FPT_scamInfo[i].id_string[k+1] = (unsigned char) ee_data; | 6297 | FPT_scamInfo[i].id_string[k] = |
6488 | } | 6298 | (unsigned char)ee_data; |
6299 | ee_data >>= 8; | ||
6300 | FPT_scamInfo[i].id_string[k + 1] = | ||
6301 | (unsigned char)ee_data; | ||
6302 | } | ||
6489 | 6303 | ||
6490 | if ((FPT_scamInfo[i].id_string[0] == 0x00) || | 6304 | if ((FPT_scamInfo[i].id_string[0] == 0x00) || |
6491 | (FPT_scamInfo[i].id_string[0] == 0xFF)) | 6305 | (FPT_scamInfo[i].id_string[0] == 0xFF)) |
6492 | 6306 | ||
6493 | FPT_scamInfo[i].state = ID_UNUSED; /*Default to unused ID. */ | 6307 | FPT_scamInfo[i].state = ID_UNUSED; /*Default to unused ID. */ |
6494 | 6308 | ||
6495 | else | 6309 | else |
6496 | FPT_scamInfo[i].state = ID_UNASSIGNED; /*Default to unassigned ID. */ | 6310 | FPT_scamInfo[i].state = ID_UNASSIGNED; /*Default to unassigned ID. */ |
6497 | 6311 | ||
6498 | } | 6312 | } |
6499 | } | 6313 | } |
6500 | for(k = 0; k < ID_STRING_LENGTH; k++) | 6314 | for (k = 0; k < ID_STRING_LENGTH; k++) |
6501 | FPT_scamInfo[p_our_id].id_string[k] = FPT_scamHAString[k]; | 6315 | FPT_scamInfo[p_our_id].id_string[k] = FPT_scamHAString[k]; |
6502 | 6316 | ||
6503 | } | 6317 | } |
@@ -6511,127 +6325,114 @@ static void FPT_inisci(unsigned char p_card, unsigned long p_port, unsigned char | |||
6511 | * | 6325 | * |
6512 | *---------------------------------------------------------------------*/ | 6326 | *---------------------------------------------------------------------*/ |
6513 | 6327 | ||
6514 | static unsigned char FPT_scmachid(unsigned char p_card, unsigned char p_id_string[]) | 6328 | static unsigned char FPT_scmachid(unsigned char p_card, |
6329 | unsigned char p_id_string[]) | ||
6515 | { | 6330 | { |
6516 | 6331 | ||
6517 | unsigned char i,k,match; | 6332 | unsigned char i, k, match; |
6518 | |||
6519 | |||
6520 | for (i=0; i < MAX_SCSI_TAR; i++) { | ||
6521 | |||
6522 | match = 1; | ||
6523 | 6333 | ||
6524 | for (k=0; k < ID_STRING_LENGTH; k++) | 6334 | for (i = 0; i < MAX_SCSI_TAR; i++) { |
6525 | { | ||
6526 | if (p_id_string[k] != FPT_scamInfo[i].id_string[k]) | ||
6527 | match = 0; | ||
6528 | } | ||
6529 | 6335 | ||
6530 | if (match) | 6336 | match = 1; |
6531 | { | ||
6532 | FPT_scamInfo[i].state = ID_ASSIGNED; | ||
6533 | return(i); | ||
6534 | } | ||
6535 | |||
6536 | } | ||
6537 | 6337 | ||
6338 | for (k = 0; k < ID_STRING_LENGTH; k++) { | ||
6339 | if (p_id_string[k] != FPT_scamInfo[i].id_string[k]) | ||
6340 | match = 0; | ||
6341 | } | ||
6538 | 6342 | ||
6343 | if (match) { | ||
6344 | FPT_scamInfo[i].state = ID_ASSIGNED; | ||
6345 | return (i); | ||
6346 | } | ||
6539 | 6347 | ||
6540 | if (p_id_string[0] & BIT(5)) | 6348 | } |
6541 | i = 8; | ||
6542 | else | ||
6543 | i = MAX_SCSI_TAR; | ||
6544 | 6349 | ||
6545 | if (((p_id_string[0] & 0x06) == 0x02) || ((p_id_string[0] & 0x06) == 0x04)) | 6350 | if (p_id_string[0] & BIT(5)) |
6546 | match = p_id_string[1] & (unsigned char) 0x1F; | 6351 | i = 8; |
6547 | else | 6352 | else |
6548 | match = 7; | 6353 | i = MAX_SCSI_TAR; |
6549 | 6354 | ||
6550 | while (i > 0) | 6355 | if (((p_id_string[0] & 0x06) == 0x02) |
6551 | { | 6356 | || ((p_id_string[0] & 0x06) == 0x04)) |
6552 | i--; | 6357 | match = p_id_string[1] & (unsigned char)0x1F; |
6358 | else | ||
6359 | match = 7; | ||
6553 | 6360 | ||
6554 | if (FPT_scamInfo[match].state == ID_UNUSED) | 6361 | while (i > 0) { |
6555 | { | 6362 | i--; |
6556 | for (k=0; k < ID_STRING_LENGTH; k++) | ||
6557 | { | ||
6558 | FPT_scamInfo[match].id_string[k] = p_id_string[k]; | ||
6559 | } | ||
6560 | 6363 | ||
6561 | FPT_scamInfo[match].state = ID_ASSIGNED; | 6364 | if (FPT_scamInfo[match].state == ID_UNUSED) { |
6365 | for (k = 0; k < ID_STRING_LENGTH; k++) { | ||
6366 | FPT_scamInfo[match].id_string[k] = | ||
6367 | p_id_string[k]; | ||
6368 | } | ||
6562 | 6369 | ||
6563 | if(FPT_BL_Card[p_card].pNvRamInfo == NULL) | 6370 | FPT_scamInfo[match].state = ID_ASSIGNED; |
6564 | FPT_BL_Card[p_card].globalFlags |= F_UPDATE_EEPROM; | ||
6565 | return(match); | ||
6566 | 6371 | ||
6567 | } | 6372 | if (FPT_BL_Card[p_card].pNvRamInfo == NULL) |
6373 | FPT_BL_Card[p_card].globalFlags |= | ||
6374 | F_UPDATE_EEPROM; | ||
6375 | return (match); | ||
6568 | 6376 | ||
6377 | } | ||
6569 | 6378 | ||
6570 | match--; | 6379 | match--; |
6571 | 6380 | ||
6572 | if (match == 0xFF) | 6381 | if (match == 0xFF) { |
6573 | { | 6382 | if (p_id_string[0] & BIT(5)) |
6574 | if (p_id_string[0] & BIT(5)) | 6383 | match = 7; |
6575 | match = 7; | 6384 | else |
6576 | else | 6385 | match = MAX_SCSI_TAR - 1; |
6577 | match = MAX_SCSI_TAR-1; | 6386 | } |
6578 | } | 6387 | } |
6579 | } | ||
6580 | |||
6581 | |||
6582 | 6388 | ||
6583 | if (p_id_string[0] & BIT(7)) | 6389 | if (p_id_string[0] & BIT(7)) { |
6584 | { | 6390 | return (CLR_PRIORITY); |
6585 | return(CLR_PRIORITY); | 6391 | } |
6586 | } | ||
6587 | |||
6588 | |||
6589 | if (p_id_string[0] & BIT(5)) | ||
6590 | i = 8; | ||
6591 | else | ||
6592 | i = MAX_SCSI_TAR; | ||
6593 | 6392 | ||
6594 | if (((p_id_string[0] & 0x06) == 0x02) || ((p_id_string[0] & 0x06) == 0x04)) | 6393 | if (p_id_string[0] & BIT(5)) |
6595 | match = p_id_string[1] & (unsigned char) 0x1F; | 6394 | i = 8; |
6596 | else | 6395 | else |
6597 | match = 7; | 6396 | i = MAX_SCSI_TAR; |
6598 | 6397 | ||
6599 | while (i > 0) | 6398 | if (((p_id_string[0] & 0x06) == 0x02) |
6600 | { | 6399 | || ((p_id_string[0] & 0x06) == 0x04)) |
6400 | match = p_id_string[1] & (unsigned char)0x1F; | ||
6401 | else | ||
6402 | match = 7; | ||
6601 | 6403 | ||
6602 | i--; | 6404 | while (i > 0) { |
6603 | 6405 | ||
6604 | if (FPT_scamInfo[match].state == ID_UNASSIGNED) | 6406 | i--; |
6605 | { | ||
6606 | for (k=0; k < ID_STRING_LENGTH; k++) | ||
6607 | { | ||
6608 | FPT_scamInfo[match].id_string[k] = p_id_string[k]; | ||
6609 | } | ||
6610 | 6407 | ||
6611 | FPT_scamInfo[match].id_string[0] |= BIT(7); | 6408 | if (FPT_scamInfo[match].state == ID_UNASSIGNED) { |
6612 | FPT_scamInfo[match].state = ID_ASSIGNED; | 6409 | for (k = 0; k < ID_STRING_LENGTH; k++) { |
6613 | if(FPT_BL_Card[p_card].pNvRamInfo == NULL) | 6410 | FPT_scamInfo[match].id_string[k] = |
6614 | FPT_BL_Card[p_card].globalFlags |= F_UPDATE_EEPROM; | 6411 | p_id_string[k]; |
6615 | return(match); | 6412 | } |
6616 | 6413 | ||
6617 | } | 6414 | FPT_scamInfo[match].id_string[0] |= BIT(7); |
6415 | FPT_scamInfo[match].state = ID_ASSIGNED; | ||
6416 | if (FPT_BL_Card[p_card].pNvRamInfo == NULL) | ||
6417 | FPT_BL_Card[p_card].globalFlags |= | ||
6418 | F_UPDATE_EEPROM; | ||
6419 | return (match); | ||
6618 | 6420 | ||
6421 | } | ||
6619 | 6422 | ||
6620 | match--; | 6423 | match--; |
6621 | 6424 | ||
6622 | if (match == 0xFF) | 6425 | if (match == 0xFF) { |
6623 | { | 6426 | if (p_id_string[0] & BIT(5)) |
6624 | if (p_id_string[0] & BIT(5)) | 6427 | match = 7; |
6625 | match = 7; | 6428 | else |
6626 | else | 6429 | match = MAX_SCSI_TAR - 1; |
6627 | match = MAX_SCSI_TAR-1; | 6430 | } |
6628 | } | 6431 | } |
6629 | } | ||
6630 | 6432 | ||
6631 | return(NO_ID_AVAIL); | 6433 | return (NO_ID_AVAIL); |
6632 | } | 6434 | } |
6633 | 6435 | ||
6634 | |||
6635 | /*--------------------------------------------------------------------- | 6436 | /*--------------------------------------------------------------------- |
6636 | * | 6437 | * |
6637 | * Function: FPT_scsavdi | 6438 | * Function: FPT_scsavdi |
@@ -6642,43 +6443,39 @@ static unsigned char FPT_scmachid(unsigned char p_card, unsigned char p_id_strin | |||
6642 | 6443 | ||
6643 | static void FPT_scsavdi(unsigned char p_card, unsigned long p_port) | 6444 | static void FPT_scsavdi(unsigned char p_card, unsigned long p_port) |
6644 | { | 6445 | { |
6645 | unsigned char i,k,max_id; | 6446 | unsigned char i, k, max_id; |
6646 | unsigned short ee_data,sum_data; | 6447 | unsigned short ee_data, sum_data; |
6647 | 6448 | ||
6449 | sum_data = 0x0000; | ||
6648 | 6450 | ||
6649 | sum_data = 0x0000; | 6451 | for (i = 1; i < EE_SCAMBASE / 2; i++) { |
6650 | 6452 | sum_data += FPT_utilEERead(p_port, i); | |
6651 | for (i = 1; i < EE_SCAMBASE/2; i++) | 6453 | } |
6652 | { | ||
6653 | sum_data += FPT_utilEERead(p_port, i); | ||
6654 | } | ||
6655 | |||
6656 | |||
6657 | FPT_utilEEWriteOnOff(p_port,1); /* Enable write access to the EEPROM */ | ||
6658 | |||
6659 | if (RD_HARPOON(p_port+hp_page_ctrl) & NARROW_SCSI_CARD) | ||
6660 | max_id = 0x08; | ||
6661 | 6454 | ||
6662 | else | 6455 | FPT_utilEEWriteOnOff(p_port, 1); /* Enable write access to the EEPROM */ |
6663 | max_id = 0x10; | ||
6664 | 6456 | ||
6665 | for (i=0; i < max_id; i++) | 6457 | if (RD_HARPOON(p_port + hp_page_ctrl) & NARROW_SCSI_CARD) |
6666 | { | 6458 | max_id = 0x08; |
6667 | |||
6668 | for (k=0; k < ID_STRING_LENGTH; k+=2) | ||
6669 | { | ||
6670 | ee_data = FPT_scamInfo[i].id_string[k+1]; | ||
6671 | ee_data <<= 8; | ||
6672 | ee_data |= FPT_scamInfo[i].id_string[k]; | ||
6673 | sum_data += ee_data; | ||
6674 | FPT_utilEEWrite(p_port, ee_data, (unsigned short)((EE_SCAMBASE/2) + | ||
6675 | (unsigned short)(i*((unsigned short)ID_STRING_LENGTH/2)) + (unsigned short)(k/2))); | ||
6676 | } | ||
6677 | } | ||
6678 | 6459 | ||
6460 | else | ||
6461 | max_id = 0x10; | ||
6462 | |||
6463 | for (i = 0; i < max_id; i++) { | ||
6464 | |||
6465 | for (k = 0; k < ID_STRING_LENGTH; k += 2) { | ||
6466 | ee_data = FPT_scamInfo[i].id_string[k + 1]; | ||
6467 | ee_data <<= 8; | ||
6468 | ee_data |= FPT_scamInfo[i].id_string[k]; | ||
6469 | sum_data += ee_data; | ||
6470 | FPT_utilEEWrite(p_port, ee_data, | ||
6471 | (unsigned short)((EE_SCAMBASE / 2) + | ||
6472 | (unsigned short)(i * | ||
6473 | ((unsigned short)ID_STRING_LENGTH / 2)) + (unsigned short)(k / 2))); | ||
6474 | } | ||
6475 | } | ||
6679 | 6476 | ||
6680 | FPT_utilEEWrite(p_port, sum_data, EEPROM_CHECK_SUM/2); | 6477 | FPT_utilEEWrite(p_port, sum_data, EEPROM_CHECK_SUM / 2); |
6681 | FPT_utilEEWriteOnOff(p_port,0); /* Turn off write access */ | 6478 | FPT_utilEEWriteOnOff(p_port, 0); /* Turn off write access */ |
6682 | } | 6479 | } |
6683 | 6480 | ||
6684 | /*--------------------------------------------------------------------- | 6481 | /*--------------------------------------------------------------------- |
@@ -6691,46 +6488,45 @@ static void FPT_scsavdi(unsigned char p_card, unsigned long p_port) | |||
6691 | 6488 | ||
6692 | static void FPT_XbowInit(unsigned long port, unsigned char ScamFlg) | 6489 | static void FPT_XbowInit(unsigned long port, unsigned char ScamFlg) |
6693 | { | 6490 | { |
6694 | unsigned char i; | 6491 | unsigned char i; |
6695 | 6492 | ||
6696 | i = RD_HARPOON(port+hp_page_ctrl); | 6493 | i = RD_HARPOON(port + hp_page_ctrl); |
6697 | WR_HARPOON(port+hp_page_ctrl, (unsigned char) (i | G_INT_DISABLE)); | 6494 | WR_HARPOON(port + hp_page_ctrl, (unsigned char)(i | G_INT_DISABLE)); |
6698 | 6495 | ||
6699 | WR_HARPOON(port+hp_scsireset,0x00); | 6496 | WR_HARPOON(port + hp_scsireset, 0x00); |
6700 | WR_HARPOON(port+hp_portctrl_1,HOST_MODE8); | 6497 | WR_HARPOON(port + hp_portctrl_1, HOST_MODE8); |
6701 | 6498 | ||
6702 | WR_HARPOON(port+hp_scsireset,(DMA_RESET | HPSCSI_RESET | PROG_RESET | \ | 6499 | WR_HARPOON(port + hp_scsireset, (DMA_RESET | HPSCSI_RESET | PROG_RESET | |
6703 | FIFO_CLR)); | 6500 | FIFO_CLR)); |
6704 | 6501 | ||
6705 | WR_HARPOON(port+hp_scsireset,SCSI_INI); | 6502 | WR_HARPOON(port + hp_scsireset, SCSI_INI); |
6706 | 6503 | ||
6707 | WR_HARPOON(port+hp_clkctrl_0,CLKCTRL_DEFAULT); | 6504 | WR_HARPOON(port + hp_clkctrl_0, CLKCTRL_DEFAULT); |
6708 | 6505 | ||
6709 | WR_HARPOON(port+hp_scsisig,0x00); /* Clear any signals we might */ | 6506 | WR_HARPOON(port + hp_scsisig, 0x00); /* Clear any signals we might */ |
6710 | WR_HARPOON(port+hp_scsictrl_0,ENA_SCAM_SEL); | 6507 | WR_HARPOON(port + hp_scsictrl_0, ENA_SCAM_SEL); |
6711 | 6508 | ||
6712 | WRW_HARPOON((port+hp_intstat), CLR_ALL_INT); | 6509 | WRW_HARPOON((port + hp_intstat), CLR_ALL_INT); |
6713 | 6510 | ||
6714 | FPT_default_intena = RESET | RSEL | PROG_HLT | TIMEOUT | | 6511 | FPT_default_intena = RESET | RSEL | PROG_HLT | TIMEOUT | |
6715 | BUS_FREE | XFER_CNT_0 | AUTO_INT; | 6512 | BUS_FREE | XFER_CNT_0 | AUTO_INT; |
6716 | 6513 | ||
6717 | if ((ScamFlg & SCAM_ENABLED) && (ScamFlg & SCAM_LEVEL2)) | 6514 | if ((ScamFlg & SCAM_ENABLED) && (ScamFlg & SCAM_LEVEL2)) |
6718 | FPT_default_intena |= SCAM_SEL; | 6515 | FPT_default_intena |= SCAM_SEL; |
6719 | 6516 | ||
6720 | WRW_HARPOON((port+hp_intena), FPT_default_intena); | 6517 | WRW_HARPOON((port + hp_intena), FPT_default_intena); |
6721 | 6518 | ||
6722 | WR_HARPOON(port+hp_seltimeout,TO_290ms); | 6519 | WR_HARPOON(port + hp_seltimeout, TO_290ms); |
6723 | 6520 | ||
6724 | /* Turn on SCSI_MODE8 for narrow cards to fix the | 6521 | /* Turn on SCSI_MODE8 for narrow cards to fix the |
6725 | strapping issue with the DUAL CHANNEL card */ | 6522 | strapping issue with the DUAL CHANNEL card */ |
6726 | if (RD_HARPOON(port+hp_page_ctrl) & NARROW_SCSI_CARD) | 6523 | if (RD_HARPOON(port + hp_page_ctrl) & NARROW_SCSI_CARD) |
6727 | WR_HARPOON(port+hp_addstat,SCSI_MODE8); | 6524 | WR_HARPOON(port + hp_addstat, SCSI_MODE8); |
6728 | 6525 | ||
6729 | WR_HARPOON(port+hp_page_ctrl, i); | 6526 | WR_HARPOON(port + hp_page_ctrl, i); |
6730 | 6527 | ||
6731 | } | 6528 | } |
6732 | 6529 | ||
6733 | |||
6734 | /*--------------------------------------------------------------------- | 6530 | /*--------------------------------------------------------------------- |
6735 | * | 6531 | * |
6736 | * Function: FPT_BusMasterInit | 6532 | * Function: FPT_BusMasterInit |
@@ -6742,25 +6538,21 @@ unsigned char i; | |||
6742 | static void FPT_BusMasterInit(unsigned long p_port) | 6538 | static void FPT_BusMasterInit(unsigned long p_port) |
6743 | { | 6539 | { |
6744 | 6540 | ||
6541 | WR_HARPOON(p_port + hp_sys_ctrl, DRVR_RST); | ||
6542 | WR_HARPOON(p_port + hp_sys_ctrl, 0x00); | ||
6745 | 6543 | ||
6746 | WR_HARPOON(p_port+hp_sys_ctrl, DRVR_RST); | 6544 | WR_HARPOON(p_port + hp_host_blk_cnt, XFER_BLK64); |
6747 | WR_HARPOON(p_port+hp_sys_ctrl, 0x00); | ||
6748 | |||
6749 | WR_HARPOON(p_port+hp_host_blk_cnt, XFER_BLK64); | ||
6750 | 6545 | ||
6546 | WR_HARPOON(p_port + hp_bm_ctrl, (BMCTRL_DEFAULT)); | ||
6751 | 6547 | ||
6752 | WR_HARPOON(p_port+hp_bm_ctrl, (BMCTRL_DEFAULT)); | 6548 | WR_HARPOON(p_port + hp_ee_ctrl, (SCSI_TERM_ENA_H)); |
6753 | 6549 | ||
6754 | WR_HARPOON(p_port+hp_ee_ctrl, (SCSI_TERM_ENA_H)); | 6550 | RD_HARPOON(p_port + hp_int_status); /*Clear interrupts. */ |
6755 | 6551 | WR_HARPOON(p_port + hp_int_mask, (INT_CMD_COMPL | SCSI_INTERRUPT)); | |
6756 | 6552 | WR_HARPOON(p_port + hp_page_ctrl, (RD_HARPOON(p_port + hp_page_ctrl) & | |
6757 | RD_HARPOON(p_port+hp_int_status); /*Clear interrupts. */ | 6553 | ~SCATTER_EN)); |
6758 | WR_HARPOON(p_port+hp_int_mask, (INT_CMD_COMPL | SCSI_INTERRUPT)); | ||
6759 | WR_HARPOON(p_port+hp_page_ctrl, (RD_HARPOON(p_port+hp_page_ctrl) & | ||
6760 | ~SCATTER_EN)); | ||
6761 | } | 6554 | } |
6762 | 6555 | ||
6763 | |||
6764 | /*--------------------------------------------------------------------- | 6556 | /*--------------------------------------------------------------------- |
6765 | * | 6557 | * |
6766 | * Function: FPT_DiagEEPROM | 6558 | * Function: FPT_DiagEEPROM |
@@ -6772,156 +6564,151 @@ static void FPT_BusMasterInit(unsigned long p_port) | |||
6772 | 6564 | ||
6773 | static void FPT_DiagEEPROM(unsigned long p_port) | 6565 | static void FPT_DiagEEPROM(unsigned long p_port) |
6774 | { | 6566 | { |
6775 | unsigned short index,temp,max_wd_cnt; | 6567 | unsigned short index, temp, max_wd_cnt; |
6776 | 6568 | ||
6777 | if (RD_HARPOON(p_port+hp_page_ctrl) & NARROW_SCSI_CARD) | 6569 | if (RD_HARPOON(p_port + hp_page_ctrl) & NARROW_SCSI_CARD) |
6778 | max_wd_cnt = EEPROM_WD_CNT; | 6570 | max_wd_cnt = EEPROM_WD_CNT; |
6779 | else | 6571 | else |
6780 | max_wd_cnt = EEPROM_WD_CNT * 2; | 6572 | max_wd_cnt = EEPROM_WD_CNT * 2; |
6781 | |||
6782 | temp = FPT_utilEERead(p_port, FW_SIGNATURE/2); | ||
6783 | 6573 | ||
6784 | if (temp == 0x4641) { | 6574 | temp = FPT_utilEERead(p_port, FW_SIGNATURE / 2); |
6785 | 6575 | ||
6786 | for (index = 2; index < max_wd_cnt; index++) { | 6576 | if (temp == 0x4641) { |
6787 | 6577 | ||
6788 | temp += FPT_utilEERead(p_port, index); | 6578 | for (index = 2; index < max_wd_cnt; index++) { |
6789 | 6579 | ||
6790 | } | 6580 | temp += FPT_utilEERead(p_port, index); |
6791 | 6581 | ||
6792 | if (temp == FPT_utilEERead(p_port, EEPROM_CHECK_SUM/2)) { | 6582 | } |
6793 | 6583 | ||
6794 | return; /*EEPROM is Okay so return now! */ | 6584 | if (temp == FPT_utilEERead(p_port, EEPROM_CHECK_SUM / 2)) { |
6795 | } | ||
6796 | } | ||
6797 | 6585 | ||
6586 | return; /*EEPROM is Okay so return now! */ | ||
6587 | } | ||
6588 | } | ||
6798 | 6589 | ||
6799 | FPT_utilEEWriteOnOff(p_port,(unsigned char)1); | 6590 | FPT_utilEEWriteOnOff(p_port, (unsigned char)1); |
6800 | 6591 | ||
6801 | for (index = 0; index < max_wd_cnt; index++) { | 6592 | for (index = 0; index < max_wd_cnt; index++) { |
6802 | 6593 | ||
6803 | FPT_utilEEWrite(p_port, 0x0000, index); | 6594 | FPT_utilEEWrite(p_port, 0x0000, index); |
6804 | } | 6595 | } |
6805 | 6596 | ||
6806 | temp = 0; | 6597 | temp = 0; |
6807 | 6598 | ||
6808 | FPT_utilEEWrite(p_port, 0x4641, FW_SIGNATURE/2); | 6599 | FPT_utilEEWrite(p_port, 0x4641, FW_SIGNATURE / 2); |
6809 | temp += 0x4641; | 6600 | temp += 0x4641; |
6810 | FPT_utilEEWrite(p_port, 0x3920, MODEL_NUMB_0/2); | 6601 | FPT_utilEEWrite(p_port, 0x3920, MODEL_NUMB_0 / 2); |
6811 | temp += 0x3920; | 6602 | temp += 0x3920; |
6812 | FPT_utilEEWrite(p_port, 0x3033, MODEL_NUMB_2/2); | 6603 | FPT_utilEEWrite(p_port, 0x3033, MODEL_NUMB_2 / 2); |
6813 | temp += 0x3033; | 6604 | temp += 0x3033; |
6814 | FPT_utilEEWrite(p_port, 0x2020, MODEL_NUMB_4/2); | 6605 | FPT_utilEEWrite(p_port, 0x2020, MODEL_NUMB_4 / 2); |
6815 | temp += 0x2020; | 6606 | temp += 0x2020; |
6816 | FPT_utilEEWrite(p_port, 0x70D3, SYSTEM_CONFIG/2); | 6607 | FPT_utilEEWrite(p_port, 0x70D3, SYSTEM_CONFIG / 2); |
6817 | temp += 0x70D3; | 6608 | temp += 0x70D3; |
6818 | FPT_utilEEWrite(p_port, 0x0010, BIOS_CONFIG/2); | 6609 | FPT_utilEEWrite(p_port, 0x0010, BIOS_CONFIG / 2); |
6819 | temp += 0x0010; | 6610 | temp += 0x0010; |
6820 | FPT_utilEEWrite(p_port, 0x0003, SCAM_CONFIG/2); | 6611 | FPT_utilEEWrite(p_port, 0x0003, SCAM_CONFIG / 2); |
6821 | temp += 0x0003; | 6612 | temp += 0x0003; |
6822 | FPT_utilEEWrite(p_port, 0x0007, ADAPTER_SCSI_ID/2); | 6613 | FPT_utilEEWrite(p_port, 0x0007, ADAPTER_SCSI_ID / 2); |
6823 | temp += 0x0007; | 6614 | temp += 0x0007; |
6824 | 6615 | ||
6825 | FPT_utilEEWrite(p_port, 0x0000, IGNORE_B_SCAN/2); | 6616 | FPT_utilEEWrite(p_port, 0x0000, IGNORE_B_SCAN / 2); |
6826 | temp += 0x0000; | 6617 | temp += 0x0000; |
6827 | FPT_utilEEWrite(p_port, 0x0000, SEND_START_ENA/2); | 6618 | FPT_utilEEWrite(p_port, 0x0000, SEND_START_ENA / 2); |
6828 | temp += 0x0000; | 6619 | temp += 0x0000; |
6829 | FPT_utilEEWrite(p_port, 0x0000, DEVICE_ENABLE/2); | 6620 | FPT_utilEEWrite(p_port, 0x0000, DEVICE_ENABLE / 2); |
6830 | temp += 0x0000; | 6621 | temp += 0x0000; |
6831 | 6622 | ||
6832 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL01/2); | 6623 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL01 / 2); |
6833 | temp += 0x4242; | 6624 | temp += 0x4242; |
6834 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL23/2); | 6625 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL23 / 2); |
6835 | temp += 0x4242; | 6626 | temp += 0x4242; |
6836 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL45/2); | 6627 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL45 / 2); |
6837 | temp += 0x4242; | 6628 | temp += 0x4242; |
6838 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL67/2); | 6629 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL67 / 2); |
6839 | temp += 0x4242; | 6630 | temp += 0x4242; |
6840 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL89/2); | 6631 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL89 / 2); |
6841 | temp += 0x4242; | 6632 | temp += 0x4242; |
6842 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBLab/2); | 6633 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBLab / 2); |
6843 | temp += 0x4242; | 6634 | temp += 0x4242; |
6844 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBLcd/2); | 6635 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBLcd / 2); |
6845 | temp += 0x4242; | 6636 | temp += 0x4242; |
6846 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBLef/2); | 6637 | FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBLef / 2); |
6847 | temp += 0x4242; | 6638 | temp += 0x4242; |
6848 | 6639 | ||
6849 | 6640 | FPT_utilEEWrite(p_port, 0x6C46, 64 / 2); /*PRODUCT ID */ | |
6850 | FPT_utilEEWrite(p_port, 0x6C46, 64/2); /*PRODUCT ID */ | 6641 | temp += 0x6C46; |
6851 | temp += 0x6C46; | 6642 | FPT_utilEEWrite(p_port, 0x7361, 66 / 2); /* FlashPoint LT */ |
6852 | FPT_utilEEWrite(p_port, 0x7361, 66/2); /* FlashPoint LT */ | 6643 | temp += 0x7361; |
6853 | temp += 0x7361; | 6644 | FPT_utilEEWrite(p_port, 0x5068, 68 / 2); |
6854 | FPT_utilEEWrite(p_port, 0x5068, 68/2); | 6645 | temp += 0x5068; |
6855 | temp += 0x5068; | 6646 | FPT_utilEEWrite(p_port, 0x696F, 70 / 2); |
6856 | FPT_utilEEWrite(p_port, 0x696F, 70/2); | 6647 | temp += 0x696F; |
6857 | temp += 0x696F; | 6648 | FPT_utilEEWrite(p_port, 0x746E, 72 / 2); |
6858 | FPT_utilEEWrite(p_port, 0x746E, 72/2); | 6649 | temp += 0x746E; |
6859 | temp += 0x746E; | 6650 | FPT_utilEEWrite(p_port, 0x4C20, 74 / 2); |
6860 | FPT_utilEEWrite(p_port, 0x4C20, 74/2); | 6651 | temp += 0x4C20; |
6861 | temp += 0x4C20; | 6652 | FPT_utilEEWrite(p_port, 0x2054, 76 / 2); |
6862 | FPT_utilEEWrite(p_port, 0x2054, 76/2); | 6653 | temp += 0x2054; |
6863 | temp += 0x2054; | 6654 | FPT_utilEEWrite(p_port, 0x2020, 78 / 2); |
6864 | FPT_utilEEWrite(p_port, 0x2020, 78/2); | 6655 | temp += 0x2020; |
6865 | temp += 0x2020; | 6656 | |
6866 | 6657 | index = ((EE_SCAMBASE / 2) + (7 * 16)); | |
6867 | index = ((EE_SCAMBASE/2)+(7*16)); | 6658 | FPT_utilEEWrite(p_port, (0x0700 + TYPE_CODE0), index); |
6868 | FPT_utilEEWrite(p_port, (0x0700+TYPE_CODE0), index); | 6659 | temp += (0x0700 + TYPE_CODE0); |
6869 | temp += (0x0700+TYPE_CODE0); | 6660 | index++; |
6870 | index++; | 6661 | FPT_utilEEWrite(p_port, 0x5542, index); /*Vendor ID code */ |
6871 | FPT_utilEEWrite(p_port, 0x5542, index); /*Vendor ID code */ | 6662 | temp += 0x5542; /* BUSLOGIC */ |
6872 | temp += 0x5542; /* BUSLOGIC */ | 6663 | index++; |
6873 | index++; | 6664 | FPT_utilEEWrite(p_port, 0x4C53, index); |
6874 | FPT_utilEEWrite(p_port, 0x4C53, index); | 6665 | temp += 0x4C53; |
6875 | temp += 0x4C53; | 6666 | index++; |
6876 | index++; | 6667 | FPT_utilEEWrite(p_port, 0x474F, index); |
6877 | FPT_utilEEWrite(p_port, 0x474F, index); | 6668 | temp += 0x474F; |
6878 | temp += 0x474F; | 6669 | index++; |
6879 | index++; | 6670 | FPT_utilEEWrite(p_port, 0x4349, index); |
6880 | FPT_utilEEWrite(p_port, 0x4349, index); | 6671 | temp += 0x4349; |
6881 | temp += 0x4349; | 6672 | index++; |
6882 | index++; | 6673 | FPT_utilEEWrite(p_port, 0x5442, index); /*Vendor unique code */ |
6883 | FPT_utilEEWrite(p_port, 0x5442, index); /*Vendor unique code */ | 6674 | temp += 0x5442; /* BT- 930 */ |
6884 | temp += 0x5442; /* BT- 930 */ | 6675 | index++; |
6885 | index++; | 6676 | FPT_utilEEWrite(p_port, 0x202D, index); |
6886 | FPT_utilEEWrite(p_port, 0x202D, index); | 6677 | temp += 0x202D; |
6887 | temp += 0x202D; | 6678 | index++; |
6888 | index++; | 6679 | FPT_utilEEWrite(p_port, 0x3339, index); |
6889 | FPT_utilEEWrite(p_port, 0x3339, index); | 6680 | temp += 0x3339; |
6890 | temp += 0x3339; | 6681 | index++; /*Serial # */ |
6891 | index++; /*Serial # */ | 6682 | FPT_utilEEWrite(p_port, 0x2030, index); /* 01234567 */ |
6892 | FPT_utilEEWrite(p_port, 0x2030, index); /* 01234567 */ | 6683 | temp += 0x2030; |
6893 | temp += 0x2030; | 6684 | index++; |
6894 | index++; | 6685 | FPT_utilEEWrite(p_port, 0x5453, index); |
6895 | FPT_utilEEWrite(p_port, 0x5453, index); | 6686 | temp += 0x5453; |
6896 | temp += 0x5453; | 6687 | index++; |
6897 | index++; | 6688 | FPT_utilEEWrite(p_port, 0x5645, index); |
6898 | FPT_utilEEWrite(p_port, 0x5645, index); | 6689 | temp += 0x5645; |
6899 | temp += 0x5645; | 6690 | index++; |
6900 | index++; | 6691 | FPT_utilEEWrite(p_port, 0x2045, index); |
6901 | FPT_utilEEWrite(p_port, 0x2045, index); | 6692 | temp += 0x2045; |
6902 | temp += 0x2045; | 6693 | index++; |
6903 | index++; | 6694 | FPT_utilEEWrite(p_port, 0x202F, index); |
6904 | FPT_utilEEWrite(p_port, 0x202F, index); | 6695 | temp += 0x202F; |
6905 | temp += 0x202F; | 6696 | index++; |
6906 | index++; | 6697 | FPT_utilEEWrite(p_port, 0x4F4A, index); |
6907 | FPT_utilEEWrite(p_port, 0x4F4A, index); | 6698 | temp += 0x4F4A; |
6908 | temp += 0x4F4A; | 6699 | index++; |
6909 | index++; | 6700 | FPT_utilEEWrite(p_port, 0x204E, index); |
6910 | FPT_utilEEWrite(p_port, 0x204E, index); | 6701 | temp += 0x204E; |
6911 | temp += 0x204E; | 6702 | index++; |
6912 | index++; | 6703 | FPT_utilEEWrite(p_port, 0x3539, index); |
6913 | FPT_utilEEWrite(p_port, 0x3539, index); | 6704 | temp += 0x3539; |
6914 | temp += 0x3539; | 6705 | |
6915 | 6706 | FPT_utilEEWrite(p_port, temp, EEPROM_CHECK_SUM / 2); | |
6916 | 6707 | ||
6917 | 6708 | FPT_utilEEWriteOnOff(p_port, (unsigned char)0); | |
6918 | FPT_utilEEWrite(p_port, temp, EEPROM_CHECK_SUM/2); | ||
6919 | |||
6920 | FPT_utilEEWriteOnOff(p_port,(unsigned char)0); | ||
6921 | 6709 | ||
6922 | } | 6710 | } |
6923 | 6711 | ||
6924 | |||
6925 | /*--------------------------------------------------------------------- | 6712 | /*--------------------------------------------------------------------- |
6926 | * | 6713 | * |
6927 | * Function: Queue Search Select | 6714 | * Function: Queue Search Select |
@@ -6930,103 +6717,127 @@ static void FPT_DiagEEPROM(unsigned long p_port) | |||
6930 | * | 6717 | * |
6931 | *---------------------------------------------------------------------*/ | 6718 | *---------------------------------------------------------------------*/ |
6932 | 6719 | ||
6933 | static void FPT_queueSearchSelect(struct sccb_card * pCurrCard, unsigned char p_card) | 6720 | static void FPT_queueSearchSelect(struct sccb_card *pCurrCard, |
6721 | unsigned char p_card) | ||
6934 | { | 6722 | { |
6935 | unsigned char scan_ptr, lun; | 6723 | unsigned char scan_ptr, lun; |
6936 | struct sccb_mgr_tar_info * currTar_Info; | 6724 | struct sccb_mgr_tar_info *currTar_Info; |
6937 | struct sccb * pOldSccb; | 6725 | struct sccb *pOldSccb; |
6938 | 6726 | ||
6939 | scan_ptr = pCurrCard->scanIndex; | 6727 | scan_ptr = pCurrCard->scanIndex; |
6940 | do | 6728 | do { |
6941 | { | ||
6942 | currTar_Info = &FPT_sccbMgrTbl[p_card][scan_ptr]; | 6729 | currTar_Info = &FPT_sccbMgrTbl[p_card][scan_ptr]; |
6943 | if((pCurrCard->globalFlags & F_CONLUN_IO) && | 6730 | if ((pCurrCard->globalFlags & F_CONLUN_IO) && |
6944 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)) | 6731 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != |
6945 | { | 6732 | TAG_Q_TRYING)) { |
6946 | if (currTar_Info->TarSelQ_Cnt != 0) | 6733 | if (currTar_Info->TarSelQ_Cnt != 0) { |
6947 | { | ||
6948 | 6734 | ||
6949 | scan_ptr++; | 6735 | scan_ptr++; |
6950 | if (scan_ptr == MAX_SCSI_TAR) | 6736 | if (scan_ptr == MAX_SCSI_TAR) |
6951 | scan_ptr = 0; | 6737 | scan_ptr = 0; |
6952 | |||
6953 | for(lun=0; lun < MAX_LUN; lun++) | ||
6954 | { | ||
6955 | if(currTar_Info->TarLUNBusy[lun] == 0) | ||
6956 | { | ||
6957 | 6738 | ||
6958 | pCurrCard->currentSCCB = currTar_Info->TarSelQ_Head; | 6739 | for (lun = 0; lun < MAX_LUN; lun++) { |
6740 | if (currTar_Info->TarLUNBusy[lun] == 0) { | ||
6741 | |||
6742 | pCurrCard->currentSCCB = | ||
6743 | currTar_Info->TarSelQ_Head; | ||
6959 | pOldSccb = NULL; | 6744 | pOldSccb = NULL; |
6960 | 6745 | ||
6961 | while((pCurrCard->currentSCCB != NULL) && | 6746 | while ((pCurrCard-> |
6962 | (lun != pCurrCard->currentSCCB->Lun)) | 6747 | currentSCCB != NULL) |
6963 | { | 6748 | && (lun != |
6964 | pOldSccb = pCurrCard->currentSCCB; | 6749 | pCurrCard-> |
6965 | pCurrCard->currentSCCB = (struct sccb *)(pCurrCard->currentSCCB)-> | 6750 | currentSCCB->Lun)) { |
6966 | Sccb_forwardlink; | 6751 | pOldSccb = |
6752 | pCurrCard-> | ||
6753 | currentSCCB; | ||
6754 | pCurrCard->currentSCCB = | ||
6755 | (struct sccb | ||
6756 | *)(pCurrCard-> | ||
6757 | currentSCCB)-> | ||
6758 | Sccb_forwardlink; | ||
6967 | } | 6759 | } |
6968 | if(pCurrCard->currentSCCB == NULL) | 6760 | if (pCurrCard->currentSCCB == |
6761 | NULL) | ||
6969 | continue; | 6762 | continue; |
6970 | if(pOldSccb != NULL) | 6763 | if (pOldSccb != NULL) { |
6971 | { | 6764 | pOldSccb-> |
6972 | pOldSccb->Sccb_forwardlink = (struct sccb *)(pCurrCard->currentSCCB)-> | 6765 | Sccb_forwardlink = |
6973 | Sccb_forwardlink; | 6766 | (struct sccb |
6974 | pOldSccb->Sccb_backlink = (struct sccb *)(pCurrCard->currentSCCB)-> | 6767 | *)(pCurrCard-> |
6975 | Sccb_backlink; | 6768 | currentSCCB)-> |
6976 | currTar_Info->TarSelQ_Cnt--; | 6769 | Sccb_forwardlink; |
6977 | } | 6770 | pOldSccb-> |
6978 | else | 6771 | Sccb_backlink = |
6979 | { | 6772 | (struct sccb |
6980 | currTar_Info->TarSelQ_Head = (struct sccb *)(pCurrCard->currentSCCB)->Sccb_forwardlink; | 6773 | *)(pCurrCard-> |
6981 | 6774 | currentSCCB)-> | |
6982 | if (currTar_Info->TarSelQ_Head == NULL) | 6775 | Sccb_backlink; |
6983 | { | 6776 | currTar_Info-> |
6984 | currTar_Info->TarSelQ_Tail = NULL; | 6777 | TarSelQ_Cnt--; |
6985 | currTar_Info->TarSelQ_Cnt = 0; | 6778 | } else { |
6986 | } | 6779 | currTar_Info-> |
6987 | else | 6780 | TarSelQ_Head = |
6988 | { | 6781 | (struct sccb |
6989 | currTar_Info->TarSelQ_Cnt--; | 6782 | *)(pCurrCard-> |
6990 | currTar_Info->TarSelQ_Head->Sccb_backlink = (struct sccb *)NULL; | 6783 | currentSCCB)-> |
6784 | Sccb_forwardlink; | ||
6785 | |||
6786 | if (currTar_Info-> | ||
6787 | TarSelQ_Head == | ||
6788 | NULL) { | ||
6789 | currTar_Info-> | ||
6790 | TarSelQ_Tail | ||
6791 | = NULL; | ||
6792 | currTar_Info-> | ||
6793 | TarSelQ_Cnt | ||
6794 | = 0; | ||
6795 | } else { | ||
6796 | currTar_Info-> | ||
6797 | TarSelQ_Cnt--; | ||
6798 | currTar_Info-> | ||
6799 | TarSelQ_Head-> | ||
6800 | Sccb_backlink | ||
6801 | = | ||
6802 | (struct sccb | ||
6803 | *)NULL; | ||
6991 | } | 6804 | } |
6992 | } | 6805 | } |
6993 | pCurrCard->scanIndex = scan_ptr; | 6806 | pCurrCard->scanIndex = scan_ptr; |
6994 | 6807 | ||
6995 | pCurrCard->globalFlags |= F_NEW_SCCB_CMD; | 6808 | pCurrCard->globalFlags |= |
6809 | F_NEW_SCCB_CMD; | ||
6996 | 6810 | ||
6997 | break; | 6811 | break; |
6998 | } | 6812 | } |
6999 | } | 6813 | } |
7000 | } | 6814 | } |
7001 | 6815 | ||
7002 | else | 6816 | else { |
7003 | { | ||
7004 | scan_ptr++; | 6817 | scan_ptr++; |
7005 | if (scan_ptr == MAX_SCSI_TAR) { | 6818 | if (scan_ptr == MAX_SCSI_TAR) { |
7006 | scan_ptr = 0; | 6819 | scan_ptr = 0; |
7007 | } | 6820 | } |
7008 | } | 6821 | } |
7009 | 6822 | ||
7010 | } | 6823 | } else { |
7011 | else | ||
7012 | { | ||
7013 | if ((currTar_Info->TarSelQ_Cnt != 0) && | 6824 | if ((currTar_Info->TarSelQ_Cnt != 0) && |
7014 | (currTar_Info->TarLUNBusy[0] == 0)) | 6825 | (currTar_Info->TarLUNBusy[0] == 0)) { |
7015 | { | ||
7016 | 6826 | ||
7017 | pCurrCard->currentSCCB = currTar_Info->TarSelQ_Head; | 6827 | pCurrCard->currentSCCB = |
6828 | currTar_Info->TarSelQ_Head; | ||
7018 | 6829 | ||
7019 | currTar_Info->TarSelQ_Head = (struct sccb *)(pCurrCard->currentSCCB)->Sccb_forwardlink; | 6830 | currTar_Info->TarSelQ_Head = |
6831 | (struct sccb *)(pCurrCard->currentSCCB)-> | ||
6832 | Sccb_forwardlink; | ||
7020 | 6833 | ||
7021 | if (currTar_Info->TarSelQ_Head == NULL) | 6834 | if (currTar_Info->TarSelQ_Head == NULL) { |
7022 | { | ||
7023 | currTar_Info->TarSelQ_Tail = NULL; | 6835 | currTar_Info->TarSelQ_Tail = NULL; |
7024 | currTar_Info->TarSelQ_Cnt = 0; | 6836 | currTar_Info->TarSelQ_Cnt = 0; |
7025 | } | 6837 | } else { |
7026 | else | ||
7027 | { | ||
7028 | currTar_Info->TarSelQ_Cnt--; | 6838 | currTar_Info->TarSelQ_Cnt--; |
7029 | currTar_Info->TarSelQ_Head->Sccb_backlink = (struct sccb *)NULL; | 6839 | currTar_Info->TarSelQ_Head-> |
6840 | Sccb_backlink = (struct sccb *)NULL; | ||
7030 | } | 6841 | } |
7031 | 6842 | ||
7032 | scan_ptr++; | 6843 | scan_ptr++; |
@@ -7040,11 +6851,9 @@ static void FPT_queueSearchSelect(struct sccb_card * pCurrCard, unsigned char p_ | |||
7040 | break; | 6851 | break; |
7041 | } | 6852 | } |
7042 | 6853 | ||
7043 | else | 6854 | else { |
7044 | { | ||
7045 | scan_ptr++; | 6855 | scan_ptr++; |
7046 | if (scan_ptr == MAX_SCSI_TAR) | 6856 | if (scan_ptr == MAX_SCSI_TAR) { |
7047 | { | ||
7048 | scan_ptr = 0; | 6857 | scan_ptr = 0; |
7049 | } | 6858 | } |
7050 | } | 6859 | } |
@@ -7052,7 +6861,6 @@ static void FPT_queueSearchSelect(struct sccb_card * pCurrCard, unsigned char p_ | |||
7052 | } while (scan_ptr != pCurrCard->scanIndex); | 6861 | } while (scan_ptr != pCurrCard->scanIndex); |
7053 | } | 6862 | } |
7054 | 6863 | ||
7055 | |||
7056 | /*--------------------------------------------------------------------- | 6864 | /*--------------------------------------------------------------------- |
7057 | * | 6865 | * |
7058 | * Function: Queue Select Fail | 6866 | * Function: Queue Select Fail |
@@ -7061,37 +6869,39 @@ static void FPT_queueSearchSelect(struct sccb_card * pCurrCard, unsigned char p_ | |||
7061 | * | 6869 | * |
7062 | *---------------------------------------------------------------------*/ | 6870 | *---------------------------------------------------------------------*/ |
7063 | 6871 | ||
7064 | static void FPT_queueSelectFail(struct sccb_card * pCurrCard, unsigned char p_card) | 6872 | static void FPT_queueSelectFail(struct sccb_card *pCurrCard, |
6873 | unsigned char p_card) | ||
7065 | { | 6874 | { |
7066 | unsigned char thisTarg; | 6875 | unsigned char thisTarg; |
7067 | struct sccb_mgr_tar_info * currTar_Info; | 6876 | struct sccb_mgr_tar_info *currTar_Info; |
7068 | 6877 | ||
7069 | if (pCurrCard->currentSCCB != NULL) | 6878 | if (pCurrCard->currentSCCB != NULL) { |
7070 | { | 6879 | thisTarg = |
7071 | thisTarg = (unsigned char)(((struct sccb *)(pCurrCard->currentSCCB))->TargID); | 6880 | (unsigned char)(((struct sccb *)(pCurrCard->currentSCCB))-> |
7072 | currTar_Info = &FPT_sccbMgrTbl[p_card][thisTarg]; | 6881 | TargID); |
6882 | currTar_Info = &FPT_sccbMgrTbl[p_card][thisTarg]; | ||
7073 | 6883 | ||
7074 | pCurrCard->currentSCCB->Sccb_backlink = (struct sccb *)NULL; | 6884 | pCurrCard->currentSCCB->Sccb_backlink = (struct sccb *)NULL; |
7075 | 6885 | ||
7076 | pCurrCard->currentSCCB->Sccb_forwardlink = currTar_Info->TarSelQ_Head; | 6886 | pCurrCard->currentSCCB->Sccb_forwardlink = |
6887 | currTar_Info->TarSelQ_Head; | ||
7077 | 6888 | ||
7078 | if (currTar_Info->TarSelQ_Cnt == 0) | 6889 | if (currTar_Info->TarSelQ_Cnt == 0) { |
7079 | { | 6890 | currTar_Info->TarSelQ_Tail = pCurrCard->currentSCCB; |
7080 | currTar_Info->TarSelQ_Tail = pCurrCard->currentSCCB; | 6891 | } |
7081 | } | ||
7082 | |||
7083 | else | ||
7084 | { | ||
7085 | currTar_Info->TarSelQ_Head->Sccb_backlink = pCurrCard->currentSCCB; | ||
7086 | } | ||
7087 | 6892 | ||
6893 | else { | ||
6894 | currTar_Info->TarSelQ_Head->Sccb_backlink = | ||
6895 | pCurrCard->currentSCCB; | ||
6896 | } | ||
7088 | 6897 | ||
7089 | currTar_Info->TarSelQ_Head = pCurrCard->currentSCCB; | 6898 | currTar_Info->TarSelQ_Head = pCurrCard->currentSCCB; |
7090 | 6899 | ||
7091 | pCurrCard->currentSCCB = NULL; | 6900 | pCurrCard->currentSCCB = NULL; |
7092 | currTar_Info->TarSelQ_Cnt++; | 6901 | currTar_Info->TarSelQ_Cnt++; |
7093 | } | 6902 | } |
7094 | } | 6903 | } |
6904 | |||
7095 | /*--------------------------------------------------------------------- | 6905 | /*--------------------------------------------------------------------- |
7096 | * | 6906 | * |
7097 | * Function: Queue Command Complete | 6907 | * Function: Queue Command Complete |
@@ -7100,101 +6910,97 @@ static void FPT_queueSelectFail(struct sccb_card * pCurrCard, unsigned char p_ca | |||
7100 | * | 6910 | * |
7101 | *---------------------------------------------------------------------*/ | 6911 | *---------------------------------------------------------------------*/ |
7102 | 6912 | ||
7103 | static void FPT_queueCmdComplete(struct sccb_card * pCurrCard, struct sccb * p_sccb, | 6913 | static void FPT_queueCmdComplete(struct sccb_card *pCurrCard, |
7104 | unsigned char p_card) | 6914 | struct sccb *p_sccb, unsigned char p_card) |
7105 | { | 6915 | { |
7106 | 6916 | ||
7107 | unsigned char i, SCSIcmd; | 6917 | unsigned char i, SCSIcmd; |
7108 | CALL_BK_FN callback; | 6918 | CALL_BK_FN callback; |
7109 | struct sccb_mgr_tar_info * currTar_Info; | 6919 | struct sccb_mgr_tar_info *currTar_Info; |
7110 | 6920 | ||
7111 | SCSIcmd = p_sccb->Cdb[0]; | 6921 | SCSIcmd = p_sccb->Cdb[0]; |
7112 | 6922 | ||
7113 | 6923 | if (!(p_sccb->Sccb_XferState & F_ALL_XFERRED)) { | |
7114 | if (!(p_sccb->Sccb_XferState & F_ALL_XFERRED)) { | 6924 | |
7115 | 6925 | if ((p_sccb-> | |
7116 | if ((p_sccb->ControlByte & (SCCB_DATA_XFER_OUT | SCCB_DATA_XFER_IN)) && | 6926 | ControlByte & (SCCB_DATA_XFER_OUT | SCCB_DATA_XFER_IN)) |
7117 | (p_sccb->HostStatus == SCCB_COMPLETE) && | 6927 | && (p_sccb->HostStatus == SCCB_COMPLETE) |
7118 | (p_sccb->TargetStatus != SSCHECK)) | 6928 | && (p_sccb->TargetStatus != SSCHECK)) |
7119 | 6929 | ||
7120 | if ((SCSIcmd == SCSI_READ) || | 6930 | if ((SCSIcmd == SCSI_READ) || |
7121 | (SCSIcmd == SCSI_WRITE) || | 6931 | (SCSIcmd == SCSI_WRITE) || |
7122 | (SCSIcmd == SCSI_READ_EXTENDED) || | 6932 | (SCSIcmd == SCSI_READ_EXTENDED) || |
7123 | (SCSIcmd == SCSI_WRITE_EXTENDED) || | 6933 | (SCSIcmd == SCSI_WRITE_EXTENDED) || |
7124 | (SCSIcmd == SCSI_WRITE_AND_VERIFY) || | 6934 | (SCSIcmd == SCSI_WRITE_AND_VERIFY) || |
7125 | (SCSIcmd == SCSI_START_STOP_UNIT) || | 6935 | (SCSIcmd == SCSI_START_STOP_UNIT) || |
7126 | (pCurrCard->globalFlags & F_NO_FILTER) | 6936 | (pCurrCard->globalFlags & F_NO_FILTER) |
7127 | ) | 6937 | ) |
7128 | p_sccb->HostStatus = SCCB_DATA_UNDER_RUN; | 6938 | p_sccb->HostStatus = SCCB_DATA_UNDER_RUN; |
7129 | } | 6939 | } |
7130 | |||
7131 | 6940 | ||
7132 | if(p_sccb->SccbStatus == SCCB_IN_PROCESS) | 6941 | if (p_sccb->SccbStatus == SCCB_IN_PROCESS) { |
7133 | { | 6942 | if (p_sccb->HostStatus || p_sccb->TargetStatus) |
7134 | if (p_sccb->HostStatus || p_sccb->TargetStatus) | 6943 | p_sccb->SccbStatus = SCCB_ERROR; |
7135 | p_sccb->SccbStatus = SCCB_ERROR; | 6944 | else |
7136 | else | 6945 | p_sccb->SccbStatus = SCCB_SUCCESS; |
7137 | p_sccb->SccbStatus = SCCB_SUCCESS; | ||
7138 | } | 6946 | } |
7139 | 6947 | ||
7140 | if (p_sccb->Sccb_XferState & F_AUTO_SENSE) { | 6948 | if (p_sccb->Sccb_XferState & F_AUTO_SENSE) { |
7141 | 6949 | ||
7142 | p_sccb->CdbLength = p_sccb->Save_CdbLen; | 6950 | p_sccb->CdbLength = p_sccb->Save_CdbLen; |
7143 | for (i=0; i < 6; i++) { | 6951 | for (i = 0; i < 6; i++) { |
7144 | p_sccb->Cdb[i] = p_sccb->Save_Cdb[i]; | 6952 | p_sccb->Cdb[i] = p_sccb->Save_Cdb[i]; |
7145 | } | 6953 | } |
7146 | } | 6954 | } |
7147 | 6955 | ||
7148 | if ((p_sccb->OperationCode == RESIDUAL_SG_COMMAND) || | 6956 | if ((p_sccb->OperationCode == RESIDUAL_SG_COMMAND) || |
7149 | (p_sccb->OperationCode == RESIDUAL_COMMAND)) { | 6957 | (p_sccb->OperationCode == RESIDUAL_COMMAND)) { |
7150 | 6958 | ||
7151 | FPT_utilUpdateResidual(p_sccb); | 6959 | FPT_utilUpdateResidual(p_sccb); |
7152 | } | 6960 | } |
7153 | 6961 | ||
7154 | pCurrCard->cmdCounter--; | 6962 | pCurrCard->cmdCounter--; |
7155 | if (!pCurrCard->cmdCounter) { | 6963 | if (!pCurrCard->cmdCounter) { |
7156 | 6964 | ||
7157 | if (pCurrCard->globalFlags & F_GREEN_PC) { | 6965 | if (pCurrCard->globalFlags & F_GREEN_PC) { |
7158 | WR_HARPOON(pCurrCard->ioPort+hp_clkctrl_0,(PWR_DWN | CLKCTRL_DEFAULT)); | 6966 | WR_HARPOON(pCurrCard->ioPort + hp_clkctrl_0, |
7159 | WR_HARPOON(pCurrCard->ioPort+hp_sys_ctrl, STOP_CLK); | 6967 | (PWR_DWN | CLKCTRL_DEFAULT)); |
7160 | } | 6968 | WR_HARPOON(pCurrCard->ioPort + hp_sys_ctrl, STOP_CLK); |
6969 | } | ||
7161 | 6970 | ||
7162 | WR_HARPOON(pCurrCard->ioPort+hp_semaphore, | 6971 | WR_HARPOON(pCurrCard->ioPort + hp_semaphore, |
7163 | (RD_HARPOON(pCurrCard->ioPort+hp_semaphore) & ~SCCB_MGR_ACTIVE)); | 6972 | (RD_HARPOON(pCurrCard->ioPort + hp_semaphore) & |
6973 | ~SCCB_MGR_ACTIVE)); | ||
7164 | 6974 | ||
7165 | } | 6975 | } |
7166 | 6976 | ||
7167 | if(pCurrCard->discQCount != 0) | 6977 | if (pCurrCard->discQCount != 0) { |
7168 | { | 6978 | currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID]; |
7169 | currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID]; | 6979 | if (((pCurrCard->globalFlags & F_CONLUN_IO) && |
7170 | if(((pCurrCard->globalFlags & F_CONLUN_IO) && | 6980 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != |
7171 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) | 6981 | TAG_Q_TRYING))) { |
7172 | { | ||
7173 | pCurrCard->discQCount--; | 6982 | pCurrCard->discQCount--; |
7174 | pCurrCard->discQ_Tbl[currTar_Info->LunDiscQ_Idx[p_sccb->Lun]] = NULL; | 6983 | pCurrCard->discQ_Tbl[currTar_Info-> |
7175 | } | 6984 | LunDiscQ_Idx[p_sccb->Lun]] = NULL; |
7176 | else | 6985 | } else { |
7177 | { | 6986 | if (p_sccb->Sccb_tag) { |
7178 | if(p_sccb->Sccb_tag) | ||
7179 | { | ||
7180 | pCurrCard->discQCount--; | 6987 | pCurrCard->discQCount--; |
7181 | pCurrCard->discQ_Tbl[p_sccb->Sccb_tag] = NULL; | 6988 | pCurrCard->discQ_Tbl[p_sccb->Sccb_tag] = NULL; |
7182 | }else | 6989 | } else { |
7183 | { | ||
7184 | pCurrCard->discQCount--; | 6990 | pCurrCard->discQCount--; |
7185 | pCurrCard->discQ_Tbl[currTar_Info->LunDiscQ_Idx[0]] = NULL; | 6991 | pCurrCard->discQ_Tbl[currTar_Info-> |
6992 | LunDiscQ_Idx[0]] = NULL; | ||
7186 | } | 6993 | } |
7187 | } | 6994 | } |
7188 | 6995 | ||
7189 | } | 6996 | } |
7190 | 6997 | ||
7191 | callback = (CALL_BK_FN)p_sccb->SccbCallback; | 6998 | callback = (CALL_BK_FN) p_sccb->SccbCallback; |
7192 | callback(p_sccb); | 6999 | callback(p_sccb); |
7193 | pCurrCard->globalFlags |= F_NEW_SCCB_CMD; | 7000 | pCurrCard->globalFlags |= F_NEW_SCCB_CMD; |
7194 | pCurrCard->currentSCCB = NULL; | 7001 | pCurrCard->currentSCCB = NULL; |
7195 | } | 7002 | } |
7196 | 7003 | ||
7197 | |||
7198 | /*--------------------------------------------------------------------- | 7004 | /*--------------------------------------------------------------------- |
7199 | * | 7005 | * |
7200 | * Function: Queue Disconnect | 7006 | * Function: Queue Disconnect |
@@ -7202,33 +7008,32 @@ static void FPT_queueCmdComplete(struct sccb_card * pCurrCard, struct sccb * p_s | |||
7202 | * Description: Add SCCB to our disconnect array. | 7008 | * Description: Add SCCB to our disconnect array. |
7203 | * | 7009 | * |
7204 | *---------------------------------------------------------------------*/ | 7010 | *---------------------------------------------------------------------*/ |
7205 | static void FPT_queueDisconnect(struct sccb * p_sccb, unsigned char p_card) | 7011 | static void FPT_queueDisconnect(struct sccb *p_sccb, unsigned char p_card) |
7206 | { | 7012 | { |
7207 | struct sccb_mgr_tar_info * currTar_Info; | 7013 | struct sccb_mgr_tar_info *currTar_Info; |
7208 | 7014 | ||
7209 | currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID]; | 7015 | currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID]; |
7210 | 7016 | ||
7211 | if(((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && | 7017 | if (((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) && |
7212 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) | 7018 | ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) { |
7213 | { | 7019 | FPT_BL_Card[p_card].discQ_Tbl[currTar_Info-> |
7214 | FPT_BL_Card[p_card].discQ_Tbl[currTar_Info->LunDiscQ_Idx[p_sccb->Lun]] = p_sccb; | 7020 | LunDiscQ_Idx[p_sccb->Lun]] = |
7215 | } | 7021 | p_sccb; |
7216 | else | 7022 | } else { |
7217 | { | 7023 | if (p_sccb->Sccb_tag) { |
7218 | if (p_sccb->Sccb_tag) | 7024 | FPT_BL_Card[p_card].discQ_Tbl[p_sccb->Sccb_tag] = |
7219 | { | 7025 | p_sccb; |
7220 | FPT_BL_Card[p_card].discQ_Tbl[p_sccb->Sccb_tag] = p_sccb; | 7026 | FPT_sccbMgrTbl[p_card][p_sccb->TargID].TarLUNBusy[0] = |
7221 | FPT_sccbMgrTbl[p_card][p_sccb->TargID].TarLUNBusy[0] = 0; | 7027 | 0; |
7222 | FPT_sccbMgrTbl[p_card][p_sccb->TargID].TarTagQ_Cnt++; | 7028 | FPT_sccbMgrTbl[p_card][p_sccb->TargID].TarTagQ_Cnt++; |
7223 | }else | 7029 | } else { |
7224 | { | 7030 | FPT_BL_Card[p_card].discQ_Tbl[currTar_Info-> |
7225 | FPT_BL_Card[p_card].discQ_Tbl[currTar_Info->LunDiscQ_Idx[0]] = p_sccb; | 7031 | LunDiscQ_Idx[0]] = p_sccb; |
7226 | } | 7032 | } |
7227 | } | 7033 | } |
7228 | FPT_BL_Card[p_card].currentSCCB = NULL; | 7034 | FPT_BL_Card[p_card].currentSCCB = NULL; |
7229 | } | 7035 | } |
7230 | 7036 | ||
7231 | |||
7232 | /*--------------------------------------------------------------------- | 7037 | /*--------------------------------------------------------------------- |
7233 | * | 7038 | * |
7234 | * Function: Queue Flush SCCB | 7039 | * Function: Queue Flush SCCB |
@@ -7237,33 +7042,35 @@ static void FPT_queueDisconnect(struct sccb * p_sccb, unsigned char p_card) | |||
7237 | * | 7042 | * |
7238 | *---------------------------------------------------------------------*/ | 7043 | *---------------------------------------------------------------------*/ |
7239 | 7044 | ||
7240 | static void FPT_queueFlushSccb(unsigned char p_card, unsigned char error_code) | 7045 | static void FPT_queueFlushSccb(unsigned char p_card, unsigned char error_code) |
7241 | { | 7046 | { |
7242 | unsigned char qtag,thisTarg; | 7047 | unsigned char qtag, thisTarg; |
7243 | struct sccb * currSCCB; | 7048 | struct sccb *currSCCB; |
7244 | struct sccb_mgr_tar_info * currTar_Info; | 7049 | struct sccb_mgr_tar_info *currTar_Info; |
7245 | 7050 | ||
7246 | currSCCB = FPT_BL_Card[p_card].currentSCCB; | 7051 | currSCCB = FPT_BL_Card[p_card].currentSCCB; |
7247 | if(currSCCB != NULL) | 7052 | if (currSCCB != NULL) { |
7248 | { | 7053 | thisTarg = (unsigned char)currSCCB->TargID; |
7249 | thisTarg = (unsigned char)currSCCB->TargID; | 7054 | currTar_Info = &FPT_sccbMgrTbl[p_card][thisTarg]; |
7250 | currTar_Info = &FPT_sccbMgrTbl[p_card][thisTarg]; | 7055 | |
7056 | for (qtag = 0; qtag < QUEUE_DEPTH; qtag++) { | ||
7251 | 7057 | ||
7252 | for (qtag=0; qtag<QUEUE_DEPTH; qtag++) { | 7058 | if (FPT_BL_Card[p_card].discQ_Tbl[qtag] && |
7059 | (FPT_BL_Card[p_card].discQ_Tbl[qtag]->TargID == | ||
7060 | thisTarg)) { | ||
7253 | 7061 | ||
7254 | if (FPT_BL_Card[p_card].discQ_Tbl[qtag] && | 7062 | FPT_BL_Card[p_card].discQ_Tbl[qtag]-> |
7255 | (FPT_BL_Card[p_card].discQ_Tbl[qtag]->TargID == thisTarg)) | 7063 | HostStatus = (unsigned char)error_code; |
7256 | { | ||
7257 | 7064 | ||
7258 | FPT_BL_Card[p_card].discQ_Tbl[qtag]->HostStatus = (unsigned char)error_code; | 7065 | FPT_queueCmdComplete(&FPT_BL_Card[p_card], |
7259 | 7066 | FPT_BL_Card[p_card]. | |
7260 | FPT_queueCmdComplete(&FPT_BL_Card[p_card],FPT_BL_Card[p_card].discQ_Tbl[qtag], p_card); | 7067 | discQ_Tbl[qtag], p_card); |
7261 | 7068 | ||
7262 | FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL; | 7069 | FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL; |
7263 | currTar_Info->TarTagQ_Cnt--; | 7070 | currTar_Info->TarTagQ_Cnt--; |
7264 | 7071 | ||
7265 | } | 7072 | } |
7266 | } | 7073 | } |
7267 | } | 7074 | } |
7268 | 7075 | ||
7269 | } | 7076 | } |
@@ -7276,61 +7083,57 @@ static void FPT_queueFlushSccb(unsigned char p_card, unsigned char error_code) | |||
7276 | * | 7083 | * |
7277 | *---------------------------------------------------------------------*/ | 7084 | *---------------------------------------------------------------------*/ |
7278 | 7085 | ||
7279 | static void FPT_queueFlushTargSccb(unsigned char p_card, unsigned char thisTarg, | 7086 | static void FPT_queueFlushTargSccb(unsigned char p_card, unsigned char thisTarg, |
7280 | unsigned char error_code) | 7087 | unsigned char error_code) |
7281 | { | 7088 | { |
7282 | unsigned char qtag; | 7089 | unsigned char qtag; |
7283 | struct sccb_mgr_tar_info * currTar_Info; | 7090 | struct sccb_mgr_tar_info *currTar_Info; |
7284 | 7091 | ||
7285 | currTar_Info = &FPT_sccbMgrTbl[p_card][thisTarg]; | 7092 | currTar_Info = &FPT_sccbMgrTbl[p_card][thisTarg]; |
7286 | 7093 | ||
7287 | for (qtag=0; qtag<QUEUE_DEPTH; qtag++) { | 7094 | for (qtag = 0; qtag < QUEUE_DEPTH; qtag++) { |
7288 | 7095 | ||
7289 | if (FPT_BL_Card[p_card].discQ_Tbl[qtag] && | 7096 | if (FPT_BL_Card[p_card].discQ_Tbl[qtag] && |
7290 | (FPT_BL_Card[p_card].discQ_Tbl[qtag]->TargID == thisTarg)) | 7097 | (FPT_BL_Card[p_card].discQ_Tbl[qtag]->TargID == thisTarg)) { |
7291 | { | ||
7292 | 7098 | ||
7293 | FPT_BL_Card[p_card].discQ_Tbl[qtag]->HostStatus = (unsigned char)error_code; | 7099 | FPT_BL_Card[p_card].discQ_Tbl[qtag]->HostStatus = |
7100 | (unsigned char)error_code; | ||
7294 | 7101 | ||
7295 | FPT_queueCmdComplete(&FPT_BL_Card[p_card],FPT_BL_Card[p_card].discQ_Tbl[qtag], p_card); | 7102 | FPT_queueCmdComplete(&FPT_BL_Card[p_card], |
7103 | FPT_BL_Card[p_card]. | ||
7104 | discQ_Tbl[qtag], p_card); | ||
7296 | 7105 | ||
7297 | FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL; | 7106 | FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL; |
7298 | currTar_Info->TarTagQ_Cnt--; | 7107 | currTar_Info->TarTagQ_Cnt--; |
7299 | 7108 | ||
7300 | } | 7109 | } |
7301 | } | 7110 | } |
7302 | 7111 | ||
7303 | } | 7112 | } |
7304 | 7113 | ||
7305 | 7114 | static void FPT_queueAddSccb(struct sccb *p_SCCB, unsigned char p_card) | |
7306 | |||
7307 | |||
7308 | |||
7309 | static void FPT_queueAddSccb(struct sccb * p_SCCB, unsigned char p_card) | ||
7310 | { | 7115 | { |
7311 | struct sccb_mgr_tar_info * currTar_Info; | 7116 | struct sccb_mgr_tar_info *currTar_Info; |
7312 | currTar_Info = &FPT_sccbMgrTbl[p_card][p_SCCB->TargID]; | 7117 | currTar_Info = &FPT_sccbMgrTbl[p_card][p_SCCB->TargID]; |
7313 | |||
7314 | p_SCCB->Sccb_forwardlink = NULL; | ||
7315 | 7118 | ||
7316 | p_SCCB->Sccb_backlink = currTar_Info->TarSelQ_Tail; | 7119 | p_SCCB->Sccb_forwardlink = NULL; |
7317 | 7120 | ||
7318 | if (currTar_Info->TarSelQ_Cnt == 0) { | 7121 | p_SCCB->Sccb_backlink = currTar_Info->TarSelQ_Tail; |
7319 | 7122 | ||
7320 | currTar_Info->TarSelQ_Head = p_SCCB; | 7123 | if (currTar_Info->TarSelQ_Cnt == 0) { |
7321 | } | ||
7322 | 7124 | ||
7323 | else { | 7125 | currTar_Info->TarSelQ_Head = p_SCCB; |
7126 | } | ||
7324 | 7127 | ||
7325 | currTar_Info->TarSelQ_Tail->Sccb_forwardlink = p_SCCB; | 7128 | else { |
7326 | } | ||
7327 | 7129 | ||
7130 | currTar_Info->TarSelQ_Tail->Sccb_forwardlink = p_SCCB; | ||
7131 | } | ||
7328 | 7132 | ||
7329 | currTar_Info->TarSelQ_Tail = p_SCCB; | 7133 | currTar_Info->TarSelQ_Tail = p_SCCB; |
7330 | currTar_Info->TarSelQ_Cnt++; | 7134 | currTar_Info->TarSelQ_Cnt++; |
7331 | } | 7135 | } |
7332 | 7136 | ||
7333 | |||
7334 | /*--------------------------------------------------------------------- | 7137 | /*--------------------------------------------------------------------- |
7335 | * | 7138 | * |
7336 | * Function: Queue Find SCCB | 7139 | * Function: Queue Find SCCB |
@@ -7340,54 +7143,56 @@ static void FPT_queueAddSccb(struct sccb * p_SCCB, unsigned char p_card) | |||
7340 | * | 7143 | * |
7341 | *---------------------------------------------------------------------*/ | 7144 | *---------------------------------------------------------------------*/ |
7342 | 7145 | ||
7343 | static unsigned char FPT_queueFindSccb(struct sccb * p_SCCB, unsigned char p_card) | 7146 | static unsigned char FPT_queueFindSccb(struct sccb *p_SCCB, |
7147 | unsigned char p_card) | ||
7344 | { | 7148 | { |
7345 | struct sccb * q_ptr; | 7149 | struct sccb *q_ptr; |
7346 | struct sccb_mgr_tar_info * currTar_Info; | 7150 | struct sccb_mgr_tar_info *currTar_Info; |
7347 | |||
7348 | currTar_Info = &FPT_sccbMgrTbl[p_card][p_SCCB->TargID]; | ||
7349 | 7151 | ||
7350 | q_ptr = currTar_Info->TarSelQ_Head; | 7152 | currTar_Info = &FPT_sccbMgrTbl[p_card][p_SCCB->TargID]; |
7351 | 7153 | ||
7352 | while(q_ptr != NULL) { | 7154 | q_ptr = currTar_Info->TarSelQ_Head; |
7353 | 7155 | ||
7354 | if (q_ptr == p_SCCB) { | 7156 | while (q_ptr != NULL) { |
7355 | 7157 | ||
7158 | if (q_ptr == p_SCCB) { | ||
7356 | 7159 | ||
7357 | if (currTar_Info->TarSelQ_Head == q_ptr) { | 7160 | if (currTar_Info->TarSelQ_Head == q_ptr) { |
7358 | 7161 | ||
7359 | currTar_Info->TarSelQ_Head = q_ptr->Sccb_forwardlink; | 7162 | currTar_Info->TarSelQ_Head = |
7163 | q_ptr->Sccb_forwardlink; | ||
7360 | } | 7164 | } |
7361 | 7165 | ||
7362 | if (currTar_Info->TarSelQ_Tail == q_ptr) { | 7166 | if (currTar_Info->TarSelQ_Tail == q_ptr) { |
7363 | 7167 | ||
7364 | currTar_Info->TarSelQ_Tail = q_ptr->Sccb_backlink; | 7168 | currTar_Info->TarSelQ_Tail = |
7169 | q_ptr->Sccb_backlink; | ||
7365 | } | 7170 | } |
7366 | 7171 | ||
7367 | if (q_ptr->Sccb_forwardlink != NULL) { | 7172 | if (q_ptr->Sccb_forwardlink != NULL) { |
7368 | q_ptr->Sccb_forwardlink->Sccb_backlink = q_ptr->Sccb_backlink; | 7173 | q_ptr->Sccb_forwardlink->Sccb_backlink = |
7174 | q_ptr->Sccb_backlink; | ||
7369 | } | 7175 | } |
7370 | 7176 | ||
7371 | if (q_ptr->Sccb_backlink != NULL) { | 7177 | if (q_ptr->Sccb_backlink != NULL) { |
7372 | q_ptr->Sccb_backlink->Sccb_forwardlink = q_ptr->Sccb_forwardlink; | 7178 | q_ptr->Sccb_backlink->Sccb_forwardlink = |
7179 | q_ptr->Sccb_forwardlink; | ||
7373 | } | 7180 | } |
7374 | 7181 | ||
7375 | currTar_Info->TarSelQ_Cnt--; | 7182 | currTar_Info->TarSelQ_Cnt--; |
7376 | 7183 | ||
7377 | return(1); | 7184 | return (1); |
7378 | } | 7185 | } |
7379 | |||
7380 | else { | ||
7381 | q_ptr = q_ptr->Sccb_forwardlink; | ||
7382 | } | ||
7383 | } | ||
7384 | 7186 | ||
7187 | else { | ||
7188 | q_ptr = q_ptr->Sccb_forwardlink; | ||
7189 | } | ||
7190 | } | ||
7385 | 7191 | ||
7386 | return(0); | 7192 | return (0); |
7387 | 7193 | ||
7388 | } | 7194 | } |
7389 | 7195 | ||
7390 | |||
7391 | /*--------------------------------------------------------------------- | 7196 | /*--------------------------------------------------------------------- |
7392 | * | 7197 | * |
7393 | * Function: Utility Update Residual Count | 7198 | * Function: Utility Update Residual Count |
@@ -7401,48 +7206,47 @@ static unsigned char FPT_queueFindSccb(struct sccb * p_SCCB, unsigned char p_car | |||
7401 | * | 7206 | * |
7402 | *---------------------------------------------------------------------*/ | 7207 | *---------------------------------------------------------------------*/ |
7403 | 7208 | ||
7404 | static void FPT_utilUpdateResidual(struct sccb * p_SCCB) | 7209 | static void FPT_utilUpdateResidual(struct sccb *p_SCCB) |
7405 | { | 7210 | { |
7406 | unsigned long partial_cnt; | 7211 | unsigned long partial_cnt; |
7407 | unsigned int sg_index; | 7212 | unsigned int sg_index; |
7408 | unsigned long *sg_ptr; | 7213 | unsigned long *sg_ptr; |
7409 | 7214 | ||
7410 | if (p_SCCB->Sccb_XferState & F_ALL_XFERRED) { | 7215 | if (p_SCCB->Sccb_XferState & F_ALL_XFERRED) { |
7411 | 7216 | ||
7412 | p_SCCB->DataLength = 0x0000; | 7217 | p_SCCB->DataLength = 0x0000; |
7413 | } | 7218 | } |
7414 | 7219 | ||
7415 | else if (p_SCCB->Sccb_XferState & F_SG_XFER) { | 7220 | else if (p_SCCB->Sccb_XferState & F_SG_XFER) { |
7416 | 7221 | ||
7417 | partial_cnt = 0x0000; | 7222 | partial_cnt = 0x0000; |
7418 | 7223 | ||
7419 | sg_index = p_SCCB->Sccb_sgseg; | 7224 | sg_index = p_SCCB->Sccb_sgseg; |
7420 | 7225 | ||
7421 | sg_ptr = (unsigned long *)p_SCCB->DataPointer; | 7226 | sg_ptr = (unsigned long *)p_SCCB->DataPointer; |
7422 | 7227 | ||
7423 | if (p_SCCB->Sccb_SGoffset) { | 7228 | if (p_SCCB->Sccb_SGoffset) { |
7424 | 7229 | ||
7425 | partial_cnt = p_SCCB->Sccb_SGoffset; | 7230 | partial_cnt = p_SCCB->Sccb_SGoffset; |
7426 | sg_index++; | 7231 | sg_index++; |
7427 | } | 7232 | } |
7428 | 7233 | ||
7429 | while ( ((unsigned long)sg_index * (unsigned long)SG_ELEMENT_SIZE) < | 7234 | while (((unsigned long)sg_index * |
7430 | p_SCCB->DataLength ) { | 7235 | (unsigned long)SG_ELEMENT_SIZE) < p_SCCB->DataLength) { |
7431 | 7236 | ||
7432 | partial_cnt += *(sg_ptr+(sg_index * 2)); | 7237 | partial_cnt += *(sg_ptr + (sg_index * 2)); |
7433 | sg_index++; | 7238 | sg_index++; |
7434 | } | 7239 | } |
7435 | 7240 | ||
7436 | p_SCCB->DataLength = partial_cnt; | 7241 | p_SCCB->DataLength = partial_cnt; |
7437 | } | 7242 | } |
7438 | 7243 | ||
7439 | else { | 7244 | else { |
7440 | 7245 | ||
7441 | p_SCCB->DataLength -= p_SCCB->Sccb_ATC; | 7246 | p_SCCB->DataLength -= p_SCCB->Sccb_ATC; |
7442 | } | 7247 | } |
7443 | } | 7248 | } |
7444 | 7249 | ||
7445 | |||
7446 | /*--------------------------------------------------------------------- | 7250 | /*--------------------------------------------------------------------- |
7447 | * | 7251 | * |
7448 | * Function: Wait 1 Second | 7252 | * Function: Wait 1 Second |
@@ -7453,21 +7257,20 @@ static void FPT_utilUpdateResidual(struct sccb * p_SCCB) | |||
7453 | 7257 | ||
7454 | static void FPT_Wait1Second(unsigned long p_port) | 7258 | static void FPT_Wait1Second(unsigned long p_port) |
7455 | { | 7259 | { |
7456 | unsigned char i; | 7260 | unsigned char i; |
7457 | 7261 | ||
7458 | for(i=0; i < 4; i++) { | 7262 | for (i = 0; i < 4; i++) { |
7459 | 7263 | ||
7460 | FPT_Wait(p_port, TO_250ms); | 7264 | FPT_Wait(p_port, TO_250ms); |
7461 | 7265 | ||
7462 | if ((RD_HARPOON(p_port+hp_scsictrl_0) & SCSI_RST)) | 7266 | if ((RD_HARPOON(p_port + hp_scsictrl_0) & SCSI_RST)) |
7463 | break; | 7267 | break; |
7464 | 7268 | ||
7465 | if((RDW_HARPOON((p_port+hp_intstat)) & SCAM_SEL)) | 7269 | if ((RDW_HARPOON((p_port + hp_intstat)) & SCAM_SEL)) |
7466 | break; | 7270 | break; |
7467 | } | 7271 | } |
7468 | } | 7272 | } |
7469 | 7273 | ||
7470 | |||
7471 | /*--------------------------------------------------------------------- | 7274 | /*--------------------------------------------------------------------- |
7472 | * | 7275 | * |
7473 | * Function: FPT_Wait | 7276 | * Function: FPT_Wait |
@@ -7478,43 +7281,41 @@ static void FPT_Wait1Second(unsigned long p_port) | |||
7478 | 7281 | ||
7479 | static void FPT_Wait(unsigned long p_port, unsigned char p_delay) | 7282 | static void FPT_Wait(unsigned long p_port, unsigned char p_delay) |
7480 | { | 7283 | { |
7481 | unsigned char old_timer; | 7284 | unsigned char old_timer; |
7482 | unsigned char green_flag; | 7285 | unsigned char green_flag; |
7483 | |||
7484 | old_timer = RD_HARPOON(p_port+hp_seltimeout); | ||
7485 | 7286 | ||
7486 | green_flag=RD_HARPOON(p_port+hp_clkctrl_0); | 7287 | old_timer = RD_HARPOON(p_port + hp_seltimeout); |
7487 | WR_HARPOON(p_port+hp_clkctrl_0, CLKCTRL_DEFAULT); | ||
7488 | 7288 | ||
7489 | WR_HARPOON(p_port+hp_seltimeout,p_delay); | 7289 | green_flag = RD_HARPOON(p_port + hp_clkctrl_0); |
7490 | WRW_HARPOON((p_port+hp_intstat), TIMEOUT); | 7290 | WR_HARPOON(p_port + hp_clkctrl_0, CLKCTRL_DEFAULT); |
7491 | WRW_HARPOON((p_port+hp_intena), (FPT_default_intena & ~TIMEOUT)); | ||
7492 | 7291 | ||
7292 | WR_HARPOON(p_port + hp_seltimeout, p_delay); | ||
7293 | WRW_HARPOON((p_port + hp_intstat), TIMEOUT); | ||
7294 | WRW_HARPOON((p_port + hp_intena), (FPT_default_intena & ~TIMEOUT)); | ||
7493 | 7295 | ||
7494 | WR_HARPOON(p_port+hp_portctrl_0, | 7296 | WR_HARPOON(p_port + hp_portctrl_0, |
7495 | (RD_HARPOON(p_port+hp_portctrl_0) | START_TO)); | 7297 | (RD_HARPOON(p_port + hp_portctrl_0) | START_TO)); |
7496 | 7298 | ||
7497 | while (!(RDW_HARPOON((p_port+hp_intstat)) & TIMEOUT)) { | 7299 | while (!(RDW_HARPOON((p_port + hp_intstat)) & TIMEOUT)) { |
7498 | 7300 | ||
7499 | if ((RD_HARPOON(p_port+hp_scsictrl_0) & SCSI_RST)) | 7301 | if ((RD_HARPOON(p_port + hp_scsictrl_0) & SCSI_RST)) |
7500 | break; | 7302 | break; |
7501 | 7303 | ||
7502 | if ((RDW_HARPOON((p_port+hp_intstat)) & SCAM_SEL)) | 7304 | if ((RDW_HARPOON((p_port + hp_intstat)) & SCAM_SEL)) |
7503 | break; | 7305 | break; |
7504 | } | 7306 | } |
7505 | 7307 | ||
7506 | WR_HARPOON(p_port+hp_portctrl_0, | 7308 | WR_HARPOON(p_port + hp_portctrl_0, |
7507 | (RD_HARPOON(p_port+hp_portctrl_0) & ~START_TO)); | 7309 | (RD_HARPOON(p_port + hp_portctrl_0) & ~START_TO)); |
7508 | 7310 | ||
7509 | WRW_HARPOON((p_port+hp_intstat), TIMEOUT); | 7311 | WRW_HARPOON((p_port + hp_intstat), TIMEOUT); |
7510 | WRW_HARPOON((p_port+hp_intena), FPT_default_intena); | 7312 | WRW_HARPOON((p_port + hp_intena), FPT_default_intena); |
7511 | 7313 | ||
7512 | WR_HARPOON(p_port+hp_clkctrl_0,green_flag); | 7314 | WR_HARPOON(p_port + hp_clkctrl_0, green_flag); |
7513 | 7315 | ||
7514 | WR_HARPOON(p_port+hp_seltimeout,old_timer); | 7316 | WR_HARPOON(p_port + hp_seltimeout, old_timer); |
7515 | } | 7317 | } |
7516 | 7318 | ||
7517 | |||
7518 | /*--------------------------------------------------------------------- | 7319 | /*--------------------------------------------------------------------- |
7519 | * | 7320 | * |
7520 | * Function: Enable/Disable Write to EEPROM | 7321 | * Function: Enable/Disable Write to EEPROM |
@@ -7524,26 +7325,26 @@ static void FPT_Wait(unsigned long p_port, unsigned char p_delay) | |||
7524 | * | 7325 | * |
7525 | *---------------------------------------------------------------------*/ | 7326 | *---------------------------------------------------------------------*/ |
7526 | 7327 | ||
7527 | static void FPT_utilEEWriteOnOff(unsigned long p_port,unsigned char p_mode) | 7328 | static void FPT_utilEEWriteOnOff(unsigned long p_port, unsigned char p_mode) |
7528 | { | 7329 | { |
7529 | unsigned char ee_value; | 7330 | unsigned char ee_value; |
7530 | |||
7531 | ee_value = (unsigned char)(RD_HARPOON(p_port+hp_ee_ctrl) & (EXT_ARB_ACK | SCSI_TERM_ENA_H)); | ||
7532 | 7331 | ||
7533 | if (p_mode) | 7332 | ee_value = |
7333 | (unsigned char)(RD_HARPOON(p_port + hp_ee_ctrl) & | ||
7334 | (EXT_ARB_ACK | SCSI_TERM_ENA_H)); | ||
7534 | 7335 | ||
7535 | FPT_utilEESendCmdAddr(p_port, EWEN, EWEN_ADDR); | 7336 | if (p_mode) |
7536 | 7337 | ||
7537 | else | 7338 | FPT_utilEESendCmdAddr(p_port, EWEN, EWEN_ADDR); |
7538 | 7339 | ||
7340 | else | ||
7539 | 7341 | ||
7540 | FPT_utilEESendCmdAddr(p_port, EWDS, EWDS_ADDR); | 7342 | FPT_utilEESendCmdAddr(p_port, EWDS, EWDS_ADDR); |
7541 | 7343 | ||
7542 | WR_HARPOON(p_port+hp_ee_ctrl, (ee_value | SEE_MS)); /*Turn off CS */ | 7344 | WR_HARPOON(p_port + hp_ee_ctrl, (ee_value | SEE_MS)); /*Turn off CS */ |
7543 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); /*Turn off Master Select */ | 7345 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); /*Turn off Master Select */ |
7544 | } | 7346 | } |
7545 | 7347 | ||
7546 | |||
7547 | /*--------------------------------------------------------------------- | 7348 | /*--------------------------------------------------------------------- |
7548 | * | 7349 | * |
7549 | * Function: Write EEPROM | 7350 | * Function: Write EEPROM |
@@ -7553,46 +7354,46 @@ static void FPT_utilEEWriteOnOff(unsigned long p_port,unsigned char p_mode) | |||
7553 | * | 7354 | * |
7554 | *---------------------------------------------------------------------*/ | 7355 | *---------------------------------------------------------------------*/ |
7555 | 7356 | ||
7556 | static void FPT_utilEEWrite(unsigned long p_port, unsigned short ee_data, unsigned short ee_addr) | 7357 | static void FPT_utilEEWrite(unsigned long p_port, unsigned short ee_data, |
7358 | unsigned short ee_addr) | ||
7557 | { | 7359 | { |
7558 | 7360 | ||
7559 | unsigned char ee_value; | 7361 | unsigned char ee_value; |
7560 | unsigned short i; | 7362 | unsigned short i; |
7561 | 7363 | ||
7562 | ee_value = (unsigned char)((RD_HARPOON(p_port+hp_ee_ctrl) & (EXT_ARB_ACK | SCSI_TERM_ENA_H))| | 7364 | ee_value = |
7563 | (SEE_MS | SEE_CS)); | 7365 | (unsigned |
7366 | char)((RD_HARPOON(p_port + hp_ee_ctrl) & | ||
7367 | (EXT_ARB_ACK | SCSI_TERM_ENA_H)) | (SEE_MS | SEE_CS)); | ||
7564 | 7368 | ||
7369 | FPT_utilEESendCmdAddr(p_port, EE_WRITE, ee_addr); | ||
7565 | 7370 | ||
7371 | ee_value |= (SEE_MS + SEE_CS); | ||
7566 | 7372 | ||
7567 | FPT_utilEESendCmdAddr(p_port, EE_WRITE, ee_addr); | 7373 | for (i = 0x8000; i != 0; i >>= 1) { |
7568 | 7374 | ||
7375 | if (i & ee_data) | ||
7376 | ee_value |= SEE_DO; | ||
7377 | else | ||
7378 | ee_value &= ~SEE_DO; | ||
7379 | |||
7380 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); | ||
7381 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); | ||
7382 | ee_value |= SEE_CLK; /* Clock data! */ | ||
7383 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); | ||
7384 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); | ||
7385 | ee_value &= ~SEE_CLK; | ||
7386 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); | ||
7387 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); | ||
7388 | } | ||
7389 | ee_value &= (EXT_ARB_ACK | SCSI_TERM_ENA_H); | ||
7390 | WR_HARPOON(p_port + hp_ee_ctrl, (ee_value | SEE_MS)); | ||
7569 | 7391 | ||
7570 | ee_value |= (SEE_MS + SEE_CS); | 7392 | FPT_Wait(p_port, TO_10ms); |
7571 | |||
7572 | for(i = 0x8000; i != 0; i>>=1) { | ||
7573 | |||
7574 | if (i & ee_data) | ||
7575 | ee_value |= SEE_DO; | ||
7576 | else | ||
7577 | ee_value &= ~SEE_DO; | ||
7578 | |||
7579 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | ||
7580 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | ||
7581 | ee_value |= SEE_CLK; /* Clock data! */ | ||
7582 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | ||
7583 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | ||
7584 | ee_value &= ~SEE_CLK; | ||
7585 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | ||
7586 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | ||
7587 | } | ||
7588 | ee_value &= (EXT_ARB_ACK | SCSI_TERM_ENA_H); | ||
7589 | WR_HARPOON(p_port+hp_ee_ctrl, (ee_value | SEE_MS)); | ||
7590 | |||
7591 | FPT_Wait(p_port, TO_10ms); | ||
7592 | 7393 | ||
7593 | WR_HARPOON(p_port+hp_ee_ctrl, (ee_value | SEE_MS | SEE_CS)); /* Set CS to EEPROM */ | 7394 | WR_HARPOON(p_port + hp_ee_ctrl, (ee_value | SEE_MS | SEE_CS)); /* Set CS to EEPROM */ |
7594 | WR_HARPOON(p_port+hp_ee_ctrl, (ee_value | SEE_MS)); /* Turn off CS */ | 7395 | WR_HARPOON(p_port + hp_ee_ctrl, (ee_value | SEE_MS)); /* Turn off CS */ |
7595 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); /* Turn off Master Select */ | 7396 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); /* Turn off Master Select */ |
7596 | } | 7397 | } |
7597 | 7398 | ||
7598 | /*--------------------------------------------------------------------- | 7399 | /*--------------------------------------------------------------------- |
@@ -7604,25 +7405,25 @@ static void FPT_utilEEWrite(unsigned long p_port, unsigned short ee_data, unsign | |||
7604 | * | 7405 | * |
7605 | *---------------------------------------------------------------------*/ | 7406 | *---------------------------------------------------------------------*/ |
7606 | 7407 | ||
7607 | static unsigned short FPT_utilEERead(unsigned long p_port, unsigned short ee_addr) | 7408 | static unsigned short FPT_utilEERead(unsigned long p_port, |
7409 | unsigned short ee_addr) | ||
7608 | { | 7410 | { |
7609 | unsigned short i, ee_data1, ee_data2; | 7411 | unsigned short i, ee_data1, ee_data2; |
7610 | 7412 | ||
7611 | i = 0; | 7413 | i = 0; |
7612 | ee_data1 = FPT_utilEEReadOrg(p_port, ee_addr); | 7414 | ee_data1 = FPT_utilEEReadOrg(p_port, ee_addr); |
7613 | do | 7415 | do { |
7614 | { | ||
7615 | ee_data2 = FPT_utilEEReadOrg(p_port, ee_addr); | 7416 | ee_data2 = FPT_utilEEReadOrg(p_port, ee_addr); |
7616 | 7417 | ||
7617 | if(ee_data1 == ee_data2) | 7418 | if (ee_data1 == ee_data2) |
7618 | return(ee_data1); | 7419 | return (ee_data1); |
7619 | 7420 | ||
7620 | ee_data1 = ee_data2; | 7421 | ee_data1 = ee_data2; |
7621 | i++; | 7422 | i++; |
7622 | 7423 | ||
7623 | }while(i < 4); | 7424 | } while (i < 4); |
7624 | 7425 | ||
7625 | return(ee_data1); | 7426 | return (ee_data1); |
7626 | } | 7427 | } |
7627 | 7428 | ||
7628 | /*--------------------------------------------------------------------- | 7429 | /*--------------------------------------------------------------------- |
@@ -7634,45 +7435,45 @@ static unsigned short FPT_utilEERead(unsigned long p_port, unsigned short ee_add | |||
7634 | * | 7435 | * |
7635 | *---------------------------------------------------------------------*/ | 7436 | *---------------------------------------------------------------------*/ |
7636 | 7437 | ||
7637 | static unsigned short FPT_utilEEReadOrg(unsigned long p_port, unsigned short ee_addr) | 7438 | static unsigned short FPT_utilEEReadOrg(unsigned long p_port, |
7439 | unsigned short ee_addr) | ||
7638 | { | 7440 | { |
7639 | 7441 | ||
7640 | unsigned char ee_value; | 7442 | unsigned char ee_value; |
7641 | unsigned short i, ee_data; | 7443 | unsigned short i, ee_data; |
7642 | |||
7643 | ee_value = (unsigned char)((RD_HARPOON(p_port+hp_ee_ctrl) & (EXT_ARB_ACK | SCSI_TERM_ENA_H))| | ||
7644 | (SEE_MS | SEE_CS)); | ||
7645 | |||
7646 | 7444 | ||
7647 | FPT_utilEESendCmdAddr(p_port, EE_READ, ee_addr); | 7445 | ee_value = |
7446 | (unsigned | ||
7447 | char)((RD_HARPOON(p_port + hp_ee_ctrl) & | ||
7448 | (EXT_ARB_ACK | SCSI_TERM_ENA_H)) | (SEE_MS | SEE_CS)); | ||
7648 | 7449 | ||
7450 | FPT_utilEESendCmdAddr(p_port, EE_READ, ee_addr); | ||
7649 | 7451 | ||
7650 | ee_value |= (SEE_MS + SEE_CS); | 7452 | ee_value |= (SEE_MS + SEE_CS); |
7651 | ee_data = 0; | 7453 | ee_data = 0; |
7652 | 7454 | ||
7653 | for(i = 1; i <= 16; i++) { | 7455 | for (i = 1; i <= 16; i++) { |
7654 | 7456 | ||
7655 | ee_value |= SEE_CLK; /* Clock data! */ | 7457 | ee_value |= SEE_CLK; /* Clock data! */ |
7656 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | 7458 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); |
7657 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | 7459 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); |
7658 | ee_value &= ~SEE_CLK; | 7460 | ee_value &= ~SEE_CLK; |
7659 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | 7461 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); |
7660 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | 7462 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); |
7661 | 7463 | ||
7662 | ee_data <<= 1; | 7464 | ee_data <<= 1; |
7663 | 7465 | ||
7664 | if (RD_HARPOON(p_port+hp_ee_ctrl) & SEE_DI) | 7466 | if (RD_HARPOON(p_port + hp_ee_ctrl) & SEE_DI) |
7665 | ee_data |= 1; | 7467 | ee_data |= 1; |
7666 | } | 7468 | } |
7667 | 7469 | ||
7668 | ee_value &= ~(SEE_MS + SEE_CS); | 7470 | ee_value &= ~(SEE_MS + SEE_CS); |
7669 | WR_HARPOON(p_port+hp_ee_ctrl, (ee_value | SEE_MS)); /*Turn off CS */ | 7471 | WR_HARPOON(p_port + hp_ee_ctrl, (ee_value | SEE_MS)); /*Turn off CS */ |
7670 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); /*Turn off Master Select */ | 7472 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); /*Turn off Master Select */ |
7671 | 7473 | ||
7672 | return(ee_data); | 7474 | return (ee_data); |
7673 | } | 7475 | } |
7674 | 7476 | ||
7675 | |||
7676 | /*--------------------------------------------------------------------- | 7477 | /*--------------------------------------------------------------------- |
7677 | * | 7478 | * |
7678 | * Function: Send EE command and Address to the EEPROM | 7479 | * Function: Send EE command and Address to the EEPROM |
@@ -7682,87 +7483,83 @@ static unsigned short FPT_utilEEReadOrg(unsigned long p_port, unsigned short ee_ | |||
7682 | * | 7483 | * |
7683 | *---------------------------------------------------------------------*/ | 7484 | *---------------------------------------------------------------------*/ |
7684 | 7485 | ||
7685 | static void FPT_utilEESendCmdAddr(unsigned long p_port, unsigned char ee_cmd, unsigned short ee_addr) | 7486 | static void FPT_utilEESendCmdAddr(unsigned long p_port, unsigned char ee_cmd, |
7487 | unsigned short ee_addr) | ||
7686 | { | 7488 | { |
7687 | unsigned char ee_value; | 7489 | unsigned char ee_value; |
7688 | unsigned char narrow_flg; | 7490 | unsigned char narrow_flg; |
7689 | |||
7690 | unsigned short i; | ||
7691 | |||
7692 | |||
7693 | narrow_flg= (unsigned char)(RD_HARPOON(p_port+hp_page_ctrl) & NARROW_SCSI_CARD); | ||
7694 | |||
7695 | |||
7696 | ee_value = SEE_MS; | ||
7697 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | ||
7698 | |||
7699 | ee_value |= SEE_CS; /* Set CS to EEPROM */ | ||
7700 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | ||
7701 | 7491 | ||
7492 | unsigned short i; | ||
7702 | 7493 | ||
7703 | for(i = 0x04; i != 0; i>>=1) { | 7494 | narrow_flg = |
7495 | (unsigned char)(RD_HARPOON(p_port + hp_page_ctrl) & | ||
7496 | NARROW_SCSI_CARD); | ||
7704 | 7497 | ||
7705 | if (i & ee_cmd) | 7498 | ee_value = SEE_MS; |
7706 | ee_value |= SEE_DO; | 7499 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); |
7707 | else | ||
7708 | ee_value &= ~SEE_DO; | ||
7709 | 7500 | ||
7710 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | 7501 | ee_value |= SEE_CS; /* Set CS to EEPROM */ |
7711 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | 7502 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); |
7712 | ee_value |= SEE_CLK; /* Clock data! */ | ||
7713 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | ||
7714 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | ||
7715 | ee_value &= ~SEE_CLK; | ||
7716 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | ||
7717 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | ||
7718 | } | ||
7719 | 7503 | ||
7504 | for (i = 0x04; i != 0; i >>= 1) { | ||
7720 | 7505 | ||
7721 | if (narrow_flg) | 7506 | if (i & ee_cmd) |
7722 | i = 0x0080; | 7507 | ee_value |= SEE_DO; |
7723 | 7508 | else | |
7724 | else | 7509 | ee_value &= ~SEE_DO; |
7725 | i = 0x0200; | 7510 | |
7726 | 7511 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); | |
7512 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); | ||
7513 | ee_value |= SEE_CLK; /* Clock data! */ | ||
7514 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); | ||
7515 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); | ||
7516 | ee_value &= ~SEE_CLK; | ||
7517 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); | ||
7518 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); | ||
7519 | } | ||
7727 | 7520 | ||
7728 | while (i != 0) { | 7521 | if (narrow_flg) |
7522 | i = 0x0080; | ||
7729 | 7523 | ||
7730 | if (i & ee_addr) | 7524 | else |
7731 | ee_value |= SEE_DO; | 7525 | i = 0x0200; |
7732 | else | ||
7733 | ee_value &= ~SEE_DO; | ||
7734 | 7526 | ||
7735 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | 7527 | while (i != 0) { |
7736 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | ||
7737 | ee_value |= SEE_CLK; /* Clock data! */ | ||
7738 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | ||
7739 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | ||
7740 | ee_value &= ~SEE_CLK; | ||
7741 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | ||
7742 | WR_HARPOON(p_port+hp_ee_ctrl, ee_value); | ||
7743 | 7528 | ||
7744 | i >>= 1; | 7529 | if (i & ee_addr) |
7745 | } | 7530 | ee_value |= SEE_DO; |
7531 | else | ||
7532 | ee_value &= ~SEE_DO; | ||
7533 | |||
7534 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); | ||
7535 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); | ||
7536 | ee_value |= SEE_CLK; /* Clock data! */ | ||
7537 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); | ||
7538 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); | ||
7539 | ee_value &= ~SEE_CLK; | ||
7540 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); | ||
7541 | WR_HARPOON(p_port + hp_ee_ctrl, ee_value); | ||
7542 | |||
7543 | i >>= 1; | ||
7544 | } | ||
7746 | } | 7545 | } |
7747 | 7546 | ||
7748 | static unsigned short FPT_CalcCrc16(unsigned char buffer[]) | 7547 | static unsigned short FPT_CalcCrc16(unsigned char buffer[]) |
7749 | { | 7548 | { |
7750 | unsigned short crc=0; | 7549 | unsigned short crc = 0; |
7751 | int i,j; | 7550 | int i, j; |
7752 | unsigned short ch; | 7551 | unsigned short ch; |
7753 | for (i=0; i < ID_STRING_LENGTH; i++) | 7552 | for (i = 0; i < ID_STRING_LENGTH; i++) { |
7754 | { | 7553 | ch = (unsigned short)buffer[i]; |
7755 | ch = (unsigned short) buffer[i]; | 7554 | for (j = 0; j < 8; j++) { |
7756 | for(j=0; j < 8; j++) | 7555 | if ((crc ^ ch) & 1) |
7757 | { | 7556 | crc = (crc >> 1) ^ CRCMASK; |
7758 | if ((crc ^ ch) & 1) | 7557 | else |
7759 | crc = (crc >> 1) ^ CRCMASK; | 7558 | crc >>= 1; |
7760 | else | 7559 | ch >>= 1; |
7761 | crc >>= 1; | 7560 | } |
7762 | ch >>= 1; | 7561 | } |
7763 | } | 7562 | return (crc); |
7764 | } | ||
7765 | return(crc); | ||
7766 | } | 7563 | } |
7767 | 7564 | ||
7768 | static unsigned char FPT_CalcLrc(unsigned char buffer[]) | 7565 | static unsigned char FPT_CalcLrc(unsigned char buffer[]) |
@@ -7770,13 +7567,11 @@ static unsigned char FPT_CalcLrc(unsigned char buffer[]) | |||
7770 | int i; | 7567 | int i; |
7771 | unsigned char lrc; | 7568 | unsigned char lrc; |
7772 | lrc = 0; | 7569 | lrc = 0; |
7773 | for(i = 0; i < ID_STRING_LENGTH; i++) | 7570 | for (i = 0; i < ID_STRING_LENGTH; i++) |
7774 | lrc ^= buffer[i]; | 7571 | lrc ^= buffer[i]; |
7775 | return(lrc); | 7572 | return (lrc); |
7776 | } | 7573 | } |
7777 | 7574 | ||
7778 | |||
7779 | |||
7780 | /* | 7575 | /* |
7781 | The following inline definitions avoid type conflicts. | 7576 | The following inline definitions avoid type conflicts. |
7782 | */ | 7577 | */ |
@@ -7784,51 +7579,49 @@ static unsigned char FPT_CalcLrc(unsigned char buffer[]) | |||
7784 | static inline unsigned char | 7579 | static inline unsigned char |
7785 | FlashPoint__ProbeHostAdapter(struct FlashPoint_Info *FlashPointInfo) | 7580 | FlashPoint__ProbeHostAdapter(struct FlashPoint_Info *FlashPointInfo) |
7786 | { | 7581 | { |
7787 | return FlashPoint_ProbeHostAdapter((struct sccb_mgr_info *) FlashPointInfo); | 7582 | return FlashPoint_ProbeHostAdapter((struct sccb_mgr_info *) |
7583 | FlashPointInfo); | ||
7788 | } | 7584 | } |
7789 | 7585 | ||
7790 | |||
7791 | static inline FlashPoint_CardHandle_T | 7586 | static inline FlashPoint_CardHandle_T |
7792 | FlashPoint__HardwareResetHostAdapter(struct FlashPoint_Info *FlashPointInfo) | 7587 | FlashPoint__HardwareResetHostAdapter(struct FlashPoint_Info *FlashPointInfo) |
7793 | { | 7588 | { |
7794 | return FlashPoint_HardwareResetHostAdapter((struct sccb_mgr_info *) FlashPointInfo); | 7589 | return FlashPoint_HardwareResetHostAdapter((struct sccb_mgr_info *) |
7590 | FlashPointInfo); | ||
7795 | } | 7591 | } |
7796 | 7592 | ||
7797 | static inline void | 7593 | static inline void |
7798 | FlashPoint__ReleaseHostAdapter(FlashPoint_CardHandle_T CardHandle) | 7594 | FlashPoint__ReleaseHostAdapter(FlashPoint_CardHandle_T CardHandle) |
7799 | { | 7595 | { |
7800 | FlashPoint_ReleaseHostAdapter(CardHandle); | 7596 | FlashPoint_ReleaseHostAdapter(CardHandle); |
7801 | } | 7597 | } |
7802 | 7598 | ||
7803 | |||
7804 | static inline void | 7599 | static inline void |
7805 | FlashPoint__StartCCB(FlashPoint_CardHandle_T CardHandle, struct BusLogic_CCB *CCB) | 7600 | FlashPoint__StartCCB(FlashPoint_CardHandle_T CardHandle, |
7601 | struct BusLogic_CCB *CCB) | ||
7806 | { | 7602 | { |
7807 | FlashPoint_StartCCB(CardHandle, (struct sccb *) CCB); | 7603 | FlashPoint_StartCCB(CardHandle, (struct sccb *)CCB); |
7808 | } | 7604 | } |
7809 | 7605 | ||
7810 | |||
7811 | static inline void | 7606 | static inline void |
7812 | FlashPoint__AbortCCB(FlashPoint_CardHandle_T CardHandle, struct BusLogic_CCB *CCB) | 7607 | FlashPoint__AbortCCB(FlashPoint_CardHandle_T CardHandle, |
7608 | struct BusLogic_CCB *CCB) | ||
7813 | { | 7609 | { |
7814 | FlashPoint_AbortCCB(CardHandle, (struct sccb *) CCB); | 7610 | FlashPoint_AbortCCB(CardHandle, (struct sccb *)CCB); |
7815 | } | 7611 | } |
7816 | 7612 | ||
7817 | |||
7818 | static inline boolean | 7613 | static inline boolean |
7819 | FlashPoint__InterruptPending(FlashPoint_CardHandle_T CardHandle) | 7614 | FlashPoint__InterruptPending(FlashPoint_CardHandle_T CardHandle) |
7820 | { | 7615 | { |
7821 | return FlashPoint_InterruptPending(CardHandle); | 7616 | return FlashPoint_InterruptPending(CardHandle); |
7822 | } | 7617 | } |
7823 | 7618 | ||
7824 | |||
7825 | static inline int | 7619 | static inline int |
7826 | FlashPoint__HandleInterrupt(FlashPoint_CardHandle_T CardHandle) | 7620 | FlashPoint__HandleInterrupt(FlashPoint_CardHandle_T CardHandle) |
7827 | { | 7621 | { |
7828 | return FlashPoint_HandleInterrupt(CardHandle); | 7622 | return FlashPoint_HandleInterrupt(CardHandle); |
7829 | } | 7623 | } |
7830 | 7624 | ||
7831 | |||
7832 | #define FlashPoint_ProbeHostAdapter FlashPoint__ProbeHostAdapter | 7625 | #define FlashPoint_ProbeHostAdapter FlashPoint__ProbeHostAdapter |
7833 | #define FlashPoint_HardwareResetHostAdapter FlashPoint__HardwareResetHostAdapter | 7626 | #define FlashPoint_HardwareResetHostAdapter FlashPoint__HardwareResetHostAdapter |
7834 | #define FlashPoint_ReleaseHostAdapter FlashPoint__ReleaseHostAdapter | 7627 | #define FlashPoint_ReleaseHostAdapter FlashPoint__ReleaseHostAdapter |
@@ -7837,9 +7630,7 @@ FlashPoint__HandleInterrupt(FlashPoint_CardHandle_T CardHandle) | |||
7837 | #define FlashPoint_InterruptPending FlashPoint__InterruptPending | 7630 | #define FlashPoint_InterruptPending FlashPoint__InterruptPending |
7838 | #define FlashPoint_HandleInterrupt FlashPoint__HandleInterrupt | 7631 | #define FlashPoint_HandleInterrupt FlashPoint__HandleInterrupt |
7839 | 7632 | ||
7840 | 7633 | #else /* CONFIG_SCSI_OMIT_FLASHPOINT */ | |
7841 | #else /* CONFIG_SCSI_OMIT_FLASHPOINT */ | ||
7842 | |||
7843 | 7634 | ||
7844 | /* | 7635 | /* |
7845 | Define prototypes for the FlashPoint SCCB Manager Functions. | 7636 | Define prototypes for the FlashPoint SCCB Manager Functions. |
@@ -7847,12 +7638,11 @@ FlashPoint__HandleInterrupt(FlashPoint_CardHandle_T CardHandle) | |||
7847 | 7638 | ||
7848 | extern unsigned char FlashPoint_ProbeHostAdapter(struct FlashPoint_Info *); | 7639 | extern unsigned char FlashPoint_ProbeHostAdapter(struct FlashPoint_Info *); |
7849 | extern FlashPoint_CardHandle_T | 7640 | extern FlashPoint_CardHandle_T |
7850 | FlashPoint_HardwareResetHostAdapter(struct FlashPoint_Info *); | 7641 | FlashPoint_HardwareResetHostAdapter(struct FlashPoint_Info *); |
7851 | extern void FlashPoint_StartCCB(FlashPoint_CardHandle_T, struct BusLogic_CCB *); | 7642 | extern void FlashPoint_StartCCB(FlashPoint_CardHandle_T, struct BusLogic_CCB *); |
7852 | extern int FlashPoint_AbortCCB(FlashPoint_CardHandle_T, struct BusLogic_CCB *); | 7643 | extern int FlashPoint_AbortCCB(FlashPoint_CardHandle_T, struct BusLogic_CCB *); |
7853 | extern boolean FlashPoint_InterruptPending(FlashPoint_CardHandle_T); | 7644 | extern boolean FlashPoint_InterruptPending(FlashPoint_CardHandle_T); |
7854 | extern int FlashPoint_HandleInterrupt(FlashPoint_CardHandle_T); | 7645 | extern int FlashPoint_HandleInterrupt(FlashPoint_CardHandle_T); |
7855 | extern void FlashPoint_ReleaseHostAdapter(FlashPoint_CardHandle_T); | 7646 | extern void FlashPoint_ReleaseHostAdapter(FlashPoint_CardHandle_T); |
7856 | 7647 | ||
7857 | 7648 | #endif /* CONFIG_SCSI_OMIT_FLASHPOINT */ | |
7858 | #endif /* CONFIG_SCSI_OMIT_FLASHPOINT */ | ||