|
|
1.1 root 1: 1
2: 2 ; Copyright: 1997, 1998 by Apple Computer, Inc., all rights reserved.
3: 3 ;
4: 4 ; File Ownership:
5: 5 ;
6: 6 ; DRI: Mike Johnson
7: 7 ;
8: 8 ; Other Contact: Russ Berkoff
9: 9 ;
10: 10 ; Technology: SCSI
11: 11 ;
12: 12 ; Writers:
13: 13 ;
14: 14 ; (MLJ) Mike Johnson
15: 15 ; (RRA) Rick Auricchio
16: 16
17: 17
18: 18 ; NCR Errata Listing 125 Item 1 : Clear the SCNTL0 start bit
19: 19 ; when jump to reselect during select (try_reselect)
20: 20 ;
21: 21 ; NCR Errata Listing 117 Item 4 : Bad parity if odd bytes during
22: 22 ; wide transfer. Only for DATA OUT in Initiator mode.
23: 23 ; (Confirm by Manfred Eierle 3rd June 93 not during DATA IN)
24: 24
25: 25 ARCH 825A ;specifically for 825a and 875 (new instructions)
26: 26
27: 27
28: 28 ;*****************************************************************
29: 29 ;
30: 30 ; Phase codes - These values represent which action is being handled
31: 31 ;
32: 32 ;*****************************************************************
33: 33
34: 34 ABSOLUTE kphase_DATA_OUT = 0x00
35: 35 ABSOLUTE kphase_DATA_IN = 0x01
36: 36 ABSOLUTE kphase_COMMAND = 0x02
37: 37 ABSOLUTE kphase_STATUS = 0x03
38: 38 ABSOLUTE kphase_MSG_OUT = 0x06
39: 39 ABSOLUTE kphase_MSG_IN = 0x07
40: 40 ABSOLUTE kphase_SELECT = 0x08
41: 41 ABSOLUTE kphase_RESELECT = 0x09
42: 42 ABSOLUTE kphase_ABORT_CURRENT = 0x0A
43: 43 ABSOLUTE kphase_ABORT_MAILBOX = 0x0B
44: 44 ABSOLUTE kphase_CMD_COMPLETE = 0x0C
45: 45 ABSOLUTE kphase_DISCONNECT = 0x0D
46: 46 ABSOLUTE kphase_saveDataPointer = 0x0E ; ??? driver work to be done
47: 47 ABSOLUTE kphase_restoreDataPointer = 0x0F ; ??? driver work to be done
48: 48
49: 49
50: 50 ;*****************************************************************
51: 51 ; interrupt codes
52: 52 ;*****************************************************************
53: 53
54: 54 ABSOLUTE unknown_phase = 0x00 ; A spurious phase on SCSI Bus
55: 55 ABSOLUTE status_error = 0x01 ; IO completes, but with status error
56: 56 ABSOLUTE unexpected_msg = 0x02 ; An 'unknown' message is in ld_message var
57: 57 ABSOLUTE unexpected_ext_msg = 0x03 ; An 'unknown' extended message in ld_message
58: 58 ABSOLUTE wide_32_not_supported = 0x04 ; The device wants 32 bits data phase
59: 59 ABSOLUTE no_msgin_after_reselect = 0x05 ; No message-in after reselection
60: 60 ABSOLUTE reqack_too_large = 0x06 ; The device answer ReqAck offset is greater than 8
61: 61 ABSOLUTE unknown_reselect = 0x07 ; The valid bit in SFBR reg not set
62: 62 ABSOLUTE unallocated_nexus = 0x08 ; nexus index -> 0xFFFFFFFF
63: 63 ABSOLUTE abort_mailbox = 0x09 ; Abort/BDR mailbox completed
64: 64 ABSOLUTE abort_current = 0x0A ; Abort/BDR current op completed
65: 65 ABSOLUTE unknown_message_out = 0x0B ; Unknown phase before message out
66: 66 ABSOLUTE unknown_msg_reject = 0x0C ; Unknown message reject
67: 67 ABSOLUTE negotiateSDTR = 0x0D ; Sync negotiation rx'd
68: 68 ABSOLUTE negotiateWDTR = 0x0E ; Wide negotiation rx'd
69: 69 ABSOLUTE sglist_complete = 0x0F ; SGList complete
70: 70
71: 71
72: 72 ;*****************************************************************
73: 73 ;
74: 74 ; Data structure for T/L/Q Nexus:
75: 75 ;
76: 76 ;*****************************************************************
77: 77
78: 78 ABSOLUTE TLQ_SCSI_ID = 0 ; 4 SCSI ID et al for SELECT instruction
79: 79 ABSOLUTE TLQ_xferAdr = 4 ; 4 Physical address of CHMOV instructions
80: 80 ABSOLUTE TLQ_MSGOp = 8 ; 8 Byte count, data adr -> TLQ_MSGO
81: 81 ABSOLUTE TLQ_CDBp = 16 ; 8 Byte count, data adr -> TLQ_CDB
82: 82 ABSOLUTE TLQ_CDP = 24 ; 4 Current Data Pointer
83: 83 ABSOLUTE TLQ_SDP = 28 ; 4 Saved Data Pointer
84: 84 ABSOLUTE TLQ_index = 32 ; 1 index into nexus array
85: 85 ABSOLUTE TLQ_xferStarted= 33 ; 1 transfer started flag
86: 86 ABSOLUTE TLQ_IWR = 34 ; 1 flag to Ignore Wide Residue
87: 87 ABSOLUTE TLQ_pad = 35 ; 1 pad byte
88: 88
89: 89
90: 90 ;*****************************************************************
91: 91 ;
92: 92 ; ENTRY declarations - Declare entry points for driver
93: 93 ;
94: 94 ;*****************************************************************
95: 95
96: 96 ENTRY select_phase
97: 97 ENTRY phase_handler
98: 98 ENTRY issueMessageOut ; for negotiation and Reject messages
99: 99 ENTRY issueAbort_BDR ; to immediately Abort or Bus-Device-Reset
100: 100 ENTRY clearACK ; MsgIn done - clr ACK, jump to phase handler
101: 101
102: 102
103: 103 ;*****************************************************************
104: 104 ;
105: 105 ; Define local data structure at start of SCRIPTS.
106: 106 ; This structure is allocated by the following nops.
107: 107 ;
108: 108 ;*****************************************************************
109: 109 ;
110: 110
111: 111 RELATIVE local_data \
112: 112 00000000: ld_AbortCode = 4{??}\ ; 1 byte code to Abort or BDR
113: 113 00000004: ld_zeroes = 4{??}\ ; 4 bytes of 0 to clear registers
114: 114 00000008: ld_status = 4{??}\ ; Status byte from target
115: 115 0000000C: ld_counter = 4{??}\ ; index into mailbox array
116: 116 00000010: ld_AbortBdr_mailbox = 4{??}\ ; Abort/BusDeviceReset mailbox
117: 117 00000014: ld_IOdone_mailbox = 4{??}\ ; [ nexus 0 0 semaphore ]
118: 118 00000018: ld_sched_mlbx_base_adr = 4{??}\ ; base addr of mailbox array
119: 119 0000001C: ld_mailboxp = 4{??}\ ; address of current mailbox
120: 120 00000020: ld_scsi_id = 4{??}\ ; ptr to current mailbox
121: 121 00000024: ld_nexus_array_base = 4{??}\ ; base address of Nexus pointers
122: 122 00000028: ld_nexus_index = 4{??}\ ; index to Nexus pointer
123: 123 0000002C: ld_nexus = 4{??}\ ; address of Nexus
124: 124 00000030: ld_phase_flag = 4{??}\ ; for debugging
125: 125 00000034: ld_device_table_base_adr = 4{??}\ ; device configuration table
126: 126 00000038: ld_scratch = 4{??}\ ; scratch memory
127: 127 0000003C: ld_unused = 4{??}\ ; unused
128: 128 00000040: ld_message = 4{??}\ ; buffer for MsgIn bytes
129: 129 00000044: ld_message4 = 4{??}\ ; buffer continuation
130: 130 00000048: ld_pad = 4{??}\ ; padding
131: 131 0000004C: ld_size = 4{??} ; size of this structure
132: 132
133: 133
134: 134 00000000: PROC BSC_SCRIPT:
135: 135
136: 136 ; *** These NOPs must be at address 0. ***
137: 137 ; *** This is reserved space for the structure "local_data". ***
138: 138 ; *** The driver inits this area to zero. ***
139: 139
140: 140 00000000: 80000000 00000000 nop 0 ; ld_AbortCode, ld_zeroes
141: 141 00000008: 80000000 00000000 nop 0 ; ld_status, ld_counter
142: 142
143: 143 00000010: 80000000 00000000 nop 0 ; ld_AbortBdr_mailbox, ld_IOdone_mailbox
144: 144 00000018: 80000000 00000000 nop 0 ; ld_sched_mlbx_base_adr, ld_mailboxp
145: 145
146: 146 00000020: 80000000 00000000 nop 0 ; ld_scsi_id, ld_nexus_array_base
147: 147 00000028: 80000000 00000000 nop 0 ; ld_nexus_index, ld_nexus
148: 148
149: 149 00000030: 80000000 00000000 nop 0 ; ld_phase_flag, ld_device_table_base_adr
150: 150 00000038: 80000000 00000000 nop 0 ; ld_scratch, ld_unused
151: 151
152: 152 00000040: 80000000 00000000 nop 0 ; ld_message, ld_message4
153: 153 00000048: 80000000 0000004C nop ld_size ; ld_pad, ld_size (Use ld_size or lose it)
154: 154
155: 155 00000050: 80000000 0000000F nop sglist_complete ; use sglist_complete or lose it from gen'd output file
156: 156
157: 157 ;****************************************************************************
158: 158 ;
159: 159 ; findNexusFromIndex - load DSA with pointer to Nexus given a Nexus index:
160: 160 ;
161: 161 ;****************************************************************************
162: 162
163: 163 00000058: findNexusFromIndex:
164: 164
165: 165 00000058: E1340004 00000028 load SCRATCHA0, 4, ld_nexus_index ; load index and leading zeroes
166: 166 00000060: 60000400 00000000 clear CARRY
167: 167 00000068: 79340000 00000000 move SCRATCHA0 SHL 0 to SCRATCHA0 ; double the index
168: 168 00000070: 79350000 00000000 move SCRATCHA1 SHL 0 to SCRATCHA1
169: 169 00000078: 79340000 00000000 move SCRATCHA0 SHL 0 to SCRATCHA0 ; double again
170: 170 00000080: 79350000 00000000 move SCRATCHA1 SHL 0 to SCRATCHA1 ; A0 now has index to 4-byte address
171: 171 00000088: E0340004 0000009C store SCRATCHA0, 4, patchArrayOffset+4 ; *** patch the code
172: 172
173: 173 00000090: E1100004 00000024 load DSA0, 4, ld_nexus_array_base ; load base address of array of Nexus pointers
174: 174 00000098: patchArrayOffset:
175: 175 00000098: F1100004 00000000 load DSA0, 4, DSAREL( 0 ) ; *** patched offset. Load pointer.
176: 176
177: 177 000000A0: 72100000 00000000 move DSA0 to SFBR ; Ensure pointer is not 0xFFFFFFFF
178: 178 000000A8: 980C00FF 00000008 int unallocated_nexus, if 0xFF ; Interrupt if NFG
179: 179
180: 180 000000B0: E0100004 0000002C store DSA0, 4, ld_nexus ; Store the Nexus pointer
181: 181 000000B8: 90080000 00000000 return ; end findNexusFromIndex
182: 182
183: 183
184: 184 ;****************************************************************************
185: 185 ;
186: 186 ; initContext - Initialize the registers for Sync and Wide using
187: 187 ; values stored in the device configuration table.
188: 188 ; Return with values in SCRATCHB for Select code.
189: 189 ;
190: 190 ;****************************************************************************
191: 191
192: 192 000000C0: initContext:
193: 193
194: 194 000000C0: E15C0004 00000020 load SCRATCHB0, 4, ld_scsi_id ; load 4-bit SCSI ID and zeroes
195: 195 000000C8: 60000400 00000000 clear CARRY
196: 196 000000D0: 795C0000 00000000 move SCRATCHB0 SHL SCRATCHB0 ; * 2
197: 197 000000D8: 795C0000 00000000 move SCRATCHB0 SHL SCRATCHB0 ; * 2 -> UInt32 index
198: 198 000000E0: E05C0004 000000F4 store SCRATCHB0, 4, patchGetDevConfigOffset+4 ; *** Patch load code
199: 199
200: 200 000000E8: E1100004 00000034 load DSA0, 4, ld_device_table_base_adr ; load base physical addr of tables
201: 201
202: 202 000000F0: patchGetDevConfigOffset:
203: 203 000000F0: F15C0004 00000000 load SCRATCHB0, 4, DSAREL( 0 ) ; *** Patched table offset ***
204: 204
205: 205 ; SCRATCHB0 = 0
206: 206 ; SCRATCHB1 = TP,MO (SXFER bits7-5 bits3-0)
207: 207 ; SCRATCHB2 = 0 (position for SCSI ID)
208: 208 ; SCRATCHB3 = SCCF,EWS (SCNTL3 bits6-4 bit 3)
209: 209
210: 210 000000F8: 725D0000 00000000 move SCRATCHB1 to SFBR ; init SXFER from B1
211: 211 00000100: 6A050000 00000000 move SFBR to SXFER
212: 212 ; Init SCNTL3 from B3
213: 213 00000108: 725F0000 00000000 move SCRATCHB3 to SFBR
214: 214 00000110: 6A030000 00000000 move SFBR to SCNTL3
215: 215 00000118: 90080000 00000000 return ; return with SCRATCHB intact.
216: 216
217: 217
218: 218 ;*****************************************************************
219: 219 ;
220: 220 ; Select_phase:
221: 221 ; Clear the SIGP bit.
222: 222 ; Check if any Abort/BusDeviceReset request waiting.
223: 223 ; Nexus is found in the list of 256 mailboxes.
224: 224 ; If current mailbox is empty, jump to reselect_phase.
225: 225 ; SCRIPTS tries to select device.
226: 226 ; If select fails due to reselect, jump to reselect_phase
227: 227 ; Select Timeout handled by driver.
228: 228 ; If select succeeds, clear the mailbox entry
229: 229 ; and increment the mailbox counter.
230: 230 ; Jump to the phase_handler (hopefully for MSG_OUT)
231: 231 ;
232: 232 ;*****************************************************************
233: 233
234: 234 00000120: select_phase:
235: 235
236: 236 00000120: 7A1A0000 00000000 move CTEST2 | 0x00 to CTEST2 ; Clear SIGP bit from ISTAT reg
237: 237
238: 238 ; Check abort mailbox:
239: 239
240: 240 00000128: E1340004 00000010 load SCRATCHA0, 4, ld_AbortBdr_mailbox ; Get AbortBdr mailbox
241: 241 ; The Identify byte in byte 0 is also the semaphore
242: 242 ; A0 = Identify byte (0xC0 + LUN N.B. Disconnect allowed)
243: 243 ; A1 = Tag, if any
244: 244 ; A2 = SCSI ID
245: 245 ; A3 = Abort code Abort=0x06; Abort Tag=0D; Bus Device Reset=0x0C
246: 246 00000130: 72340000 00000000 move SCRATCHA0 to SFBR ; test the semaphore/Identify
247: 247 00000138: 80840000 000005D0 jump rel( AbortMailbox ), if not 0 ; jump if aborting
248: 248
249: 249
250: 250 ; Get the next IO nexus in the mailboxes circular list.
251: 251 ; Calculate current mailbox address as so:
252: 252 ; counter byte index * 4 to get mailbox index
253: 253 ; add base physical address of mailboxes giving current mailbox address
254: 254
255: 255 00000140: E1340004 0000000C load SCRATCHA0, 4, ld_counter ; get 1-byte mailbox counter & 0s
256: 256 00000148: 60000400 00000000 clear CARRY
257: 257 00000150: 79340000 00000000 move SCRATCHA0 SHL 0 to SCRATCHA0 ; double it
258: 258 00000158: 79350000 00000000 move SCRATCHA1 SHL 0 to SCRATCHA1
259: 259 00000160: 79340000 00000000 move SCRATCHA0 SHL 0 to SCRATCHA0 ; double it again
260: 260 00000168: 79350000 00000000 move SCRATCHA1 SHL 0 to SCRATCHA1 ; now have a UInt32 index
261: 261 00000170: E0340004 0000018C store SCRATCHA0, 4, fetchMailbox+4 ; *** patch the load DSA instruction
262: 262 00000178: E0340004 00000254 store SCRATCHA0, 4, clear_mailbox+4 ; *** patch the store DSA instruction
263: 263
264: 264 00000180: E1100004 00000018 load DSA0, 4, ld_sched_mlbx_base_adr ; load base physical address of mailboxes
265: 265
266: 266 00000188: fetchMailbox:
267: 267 00000188: F1100004 00000000 load DSA0, 4, DSAREL( 0 ) ; *** Patched offset. Load Nexus address
268: 268 00000190: E0100004 0000002C store DSA0, 4, ld_nexus ; save pointer to current Nexus
269: 269 00000198: E1340004 0000002C load SCRATCHA0, 4, ld_nexus ; copy to A0
270: 270
271: 271 000001A0: 72340000 00000000 move SCRATCHA0 to SFBR ; if non-zero, have implicit semaphore
272: 272 000001A8: 72B50000 00000000 move SCRATCHA1 | SFBR to SFBR
273: 273 000001B0: 72B60000 00000000 move SCRATCHA2 | SFBR to SFBR
274: 274 000001B8: 72B70000 00000000 move SCRATCHA3 | SFBR to SFBR
275: 275 000001C0: 808C0000 00000440 jump rel( reselect_phase ), if 0 ; go to reselect_phase if empty
276: 276
277: 277 ;*****************************************************************
278: 278 ;
279: 279 ; Something in mailbox: we have work to do
280: 280 ;
281: 281 ;*****************************************************************
282: 282
283: 283 000001C8: 785C0800 00000000 move kphase_SELECT to SCRATCHB0 ; set phase indicator
284: 284 000001D0: E05C0001 00000030 store SCRATCHB0, 1, ld_phase_flag
285: 285
286: 286 000001D8: E15C0004 00000004 load SCRATCHB0, 4, ld_zeroes ; clr the invalid-nexus-index flag
287: 287 000001E0: F15C0001 00000020 load SCRATCHB0, 1, DSAREL( TLQ_index ) ; get index byte from nexus
288: 288 000001E8: E05C0004 00000028 store SCRATCHB0, 4, ld_nexus_index ; save it in local data
289: 289
290: 290 000001F0: E1100004 0000002C load DSA0, 4, ld_nexus ; restore DSA register
291: 291 000001F8: F15E0001 00000002 load SCRATCHB2, 1, DSAREL( TLQ_SCSI_ID+2 ) ; get Target's SCSI ID
292: 292 00000200: 725E0000 00000000 move SCRATCHB2 to SFBR
293: 293 00000208: 6A5C0000 00000000 move SFBR to SCRATCHB0 ; position it
294: 294 00000210: E05C0001 00000020 store SCRATCHB0, 1, ld_scsi_id ; save it
295: 295 00000218: 88880000 FFFFFEA0 call rel( initContext ) ; setup Sync/Wide regs in SCRATCHB
296: 296 00000220: E1100004 0000002C load DSA0, 4, ld_nexus ; restore DSA register
297: 297 00000228: F05D0001 00000001 store SCRATCHB1, 1, DSAREL( TLQ_SCSI_ID+1 ) ; SXFER
298: 298 00000230: F05F0001 00000003 store SCRATCHB3, 1, DSAREL( TLQ_SCSI_ID+3 ) ; SCNTL3
299: 299
300: 300 ;********************** select the device ********************************
301: 301 00000238: 47000000 000003B8 SELECT ATN from TLQ_SCSI_ID, rel( try_reselect ) ; ************************
302: 302 ;*************************************************************************
303: 303
304: 304 ; looking good - clear the mailbox:
305: 305
306: 306 00000240: E1340004 00000004 load SCRATCHA0, 4, ld_zeroes ; zero out scratch register A
307: 307 00000248: E1100004 00000018 load DSA0, 4, ld_sched_mlbx_base_adr ; load base physical address of mailboxes
308: 308 00000250: clear_mailbox:
309: 309 00000250: F0340004 00000000 store SCRATCHA0, 4, DSAREL( 0 ) ; *** Patched offset. Zero the mailbox
310: 310
311: 311 ; Update the index to the mailbox circular list:
312: 312 00000258: E15C0001 0000000C load SCRATCHB0, 1, ld_counter ; get counter (mailbox index)
313: 313 00000260: 7E5C0100 00000000 move SCRATCHB0 + 1 to SCRATCHB0 ; add 1
314: 314 00000268: E05C0001 0000000C store SCRATCHB0, 1, ld_counter ; put it back
315: 315 ; *** FALL THROUGH TO phase_handler ***
316: 316
317: 317
318: 318 ;*****************************************************************
319: 319 ;
320: 320 ; Phase_handler
321: 321 ; The phase handler script is a dispatcher function of SCSI phase
322: 322 ;
323: 323 ;*****************************************************************
324: 324
325: 325 00000270: phase_handler:
326: 326 00000270: E1100004 0000002C load DSA0, 4, ld_nexus ; reload DSA
327: 327 00000278: 828B0000 00000088 jump rel( command_phase ), when CMD ; wait for REQ
328: 328 00000280: 808A0000 000000A8 jump rel( data_out_phase ), if DATA_OUT ; already latched REQ signal
329: 329 00000288: 868A0000 00000020 jump rel( message_out_phase ), if MSG_OUT
330: 330 00000290: 818A0000 000000E0 jump rel( data_in_phase ), if DATA_IN
331: 331 00000298: 838A0000 00000108 jump rel( status_phase ), if STATUS
332: 332 000002A0: 878A0000 00000120 jump rel( message_in_phase ), if MSG_IN
333: 333 000002A8: 98080000 00000000 int unknown_phase
334: 334
335: 335
336: 336 ;*****************************************************************
337: 337 ;
338: 338 ; Message-Out phase
339: 339 ;
340: 340 ;*****************************************************************
341: 341
342: 342 000002B0: message_out_phase:
343: 343 000002B0: 785C0600 00000000 move kphase_MSG_OUT to SCRATCHB0 ; Set phase indicator
344: 344 000002B8: E05C0001 00000030 store SCRATCHB0, 1, ld_phase_flag
345: 345
346: 346 000002C0: 1E000000 00000008 move from TLQ_MSGOp, when MSG_OUT ; put out the message(s)
347: 347 000002C8: 80880000 FFFFFFA0 jump rel( phase_handler )
348: 348
349: 349
350: 350 ; issueMessageOut - Driver entry point for Sync/Wide negotiation and
351: 351 ; to issue message Reject:
352: 352
353: 353 000002D0: issueMessageOut:
354: 354 000002D0: 58000008 00000000 set ATN ; tell Target we have something to say
355: 355 000002D8: 60000040 00000000 clear ACK
356: 356 000002E0: 868B0000 FFFFFFC8 jump rel( message_out_phase ), when MSG_OUT ; wait for REQ. Jump if msg-out phase.
357: 357 000002E8: 87820000 FFFFFF80 jump rel( phase_handler ), if not MSG_IN ; jump if weird phase
358: 358 000002F0: 0F000001 00000039 move 1, ld_scratch+1, when MSG_IN ; dump the msg byte
359: 359 000002F8: 60000040 00000000 clear ACK ; accept Target's last msg-in byte
360: 360 00000300: 80880000 FFFFFFC8 jump rel( issueMessageOut )
361: 361
362: 362
363: 363 ;*****************************************************************
364: 364 ;
365: 365 ; Command phase
366: 366 ;
367: 367 ;*****************************************************************
368: 368
369: 369 00000308: command_phase:
370: 370 00000308: 785C0200 00000000 move kphase_COMMAND to SCRATCHB0 ; Set phase indicator
371: 371 00000310: E05C0001 00000030 store SCRATCHB0, 1, ld_phase_flag
372: 372
373: 373 00000318: 60000008 00000000 clear ATN ; In case we missed the sending nego
374: 374 00000320: 1A000000 00000010 move FROM TLQ_CDBp, when CMD ; issue the CDB
375: 375 00000328: 80880000 FFFFFF40 jump rel( phase_handler )
376: 376
377: 377
378: 378 ;*****************************************************************
379: 379 ;
380: 380 ; Data_out_phase
381: 381 ;
382: 382 ;*****************************************************************
383: 383
384: 384 00000330: data_out_phase:
385: 385 00000330: 785C0000 00000000 move kphase_DATA_OUT to SCRATCHB0 ; Set phase indicator
386: 386 00000338: E05C0001 00000030 store SCRATCHB0, 1, ld_phase_flag
387: 387
388: 388 00000340: 88880000 00000008 call rel( driverXfer ) ; call driver-built CHMOV instructions
389: 389 00000348: 80880000 FFFFFF20 jump rel( phase_handler ) ; if all data xfer'd, get next phase
390: 390
391: 391 00000350: driverXfer: ; get here from data-in code also
392: 392 00000350: F1340004 00000004 load SCRATCHA0, 4, DSAREL( TLQ_xferAdr )
393: 393 00000358: E0340004 00000374 store SCRATCHA0, 4, doItPatch+4 ; *** patch the JUMP address
394: 394 00000360: 7835FF00 00000000 move 0xFF to SCRATCHA1
395: 395 00000368: F0350001 00000021 store SCRATCHA1, 1, DSAREL( TLQ_xferStarted )
396: 396
397: 397 00000370: doItPatch:
398: 398 00000370: 80080000 00000333 jump 0x0333 ; *** patched address
399: 399
400: 400
401: 401
402: 402 ;*****************************************************************
403: 403 ;
404: 404 ; Data_in_phase
405: 405 ; 875 sets ATN if bad parity detected.
406: 406 ; Use of CHMOV instructions assures that we properly handle
407: 407 ; a leftover wide byte in the SWIDE or SODL register, depending
408: 408 ; on the data direction. This can happen in either of two conditions:
409: 409 ; 1. The Target disconnects at an odd boundary. This is
410: 410 ; extremely unlikely with disk devices.
411: 411 ; 2. The client passes either an odd buffer address or
412: 412 ; an odd transfer count. When the Target disconnects (at
413: 413 ; an even boundary, we end up with the extra wide
414: 414 ; byte in SWIDE or SODL. MacOS does this with VM on.
415: 415 ;
416: 416 ;*****************************************************************
417: 417
418: 418 00000378: data_in_phase:
419: 419 00000378: 785C0100 00000000 move kphase_DATA_IN to SCRATCHB0 ; Set phase indicator
420: 420 00000380: E05C0001 00000030 store SCRATCHB0, 1, ld_phase_flag
421: 421
422: 422 00000388: 88880000 FFFFFFC0 call rel( driverXfer ) ; call driver-built CHMOV instructions
423: 423
424: 424 ; The driver gets interrupted if a phase mismatch occurs as when
425: 425 ; the Target goes MSG-IN with a Disconnect.
426: 426 ; The driver codes either a RETURN if the Scatter/Gather list is complete or
427: 427 ; an INT if more Scatter/Gather elements need to be generated.
428: 428 ; On the Macintosh, client programs expect extra incoming data to be dumped.
429: 429 ; For example, during boot the ROM reads 512 bytes from a 2K-byte-sector CD.
430: 430
431: 431 00000390: bucket_loop:
432: 432 00000390: 81830000 FFFFFED8 jump rel( phase_handler ), when not DATA_IN ; wait for phase, exit if changed
433: 433 00000398: 01000001 00000008 CHMOV 1, ld_status, when DATA_IN ; eat a byte
434: 434 000003A0: 80880000 FFFFFFE8 jump rel( bucket_loop ); ; keep dumping bytes
435: 435
436: 436
437: 437 ;*****************************************************************
438: 438 ;
439: 439 ; Status phase
440: 440 ;
441: 441 ;*****************************************************************
442: 442
443: 443 000003A8: status_phase:
444: 444 000003A8: 785C0300 00000000 move kphase_STATUS to SCRATCHB0 ; Set phase indicator
445: 445 000003B0: E05C0001 00000030 store SCRATCHB0, 1, ld_phase_flag
446: 446
447: 447 000003B8: 0B000001 00000008 move 1, ld_status, when STATUS ; Read Status byte from bus
448: 448 000003C0: 80880000 FFFFFEA8 jump rel( phase_handler )
449: 449
450: 450
451: 451 ;*****************************************************************
452: 452 ;
453: 453 ; Message-In phase
454: 454 ;
455: 455 ;*****************************************************************
456: 456
457: 457 000003C8: message_in_phase:
458: 458 000003C8: 785C0700 00000000 move kphase_MSG_IN to SCRATCHB0 ; Set phase indicator
459: 459 000003D0: E05C0001 00000030 store SCRATCHB0, 1, ld_phase_flag
460: 460
461: 461 000003D8: 0F000001 00000040 move 1, ld_message, when MSG_IN ; Read byte from bus
462: 462
463: 463 000003E0: 808C0000 000000C0 jump rel( cmdComplete ), if 0x00 ; Command Complete
464: 464 000003E8: 808C0002 000001A8 jump rel( saveDataPointer ), if 0x02 ; Save Data Pointer
465: 465 000003F0: 808C0004 00000148 jump rel( disconnect_msg ), if 0x04 ; Disconnect
466: 466 000003F8: 808C0023 00000038 jump rel( ignoreWideResidue ), if 0x23 ; Ignore Wide Residue
467: 467 00000400: 808C0003 000001B0 jump rel( restoreDataPointer ), if 0x03 ; Restore Data Pointer
468: 468 00000408: 808C0001 00000058 jump rel( extended_msg ), if 0x01 ; Extended message
469: 469 00000410: 808C0007 00000008 jump rel( msg_reject ), if 0x07 ; Message Reject
470: 470 ; Identify, if 0x80-FF ; Identify + LUN
471: 471 ; simple_queue_tag, if 0x20 ; Simple Queue Tag
472: 472 ; initiate_recovery, if 0x0F ; Initiate Recovery
473: 473 ; linked_cde_complete, if 0x0A/0x0B
474: 474 00000418: 98080000 00000002 int unexpected_msg ; unknown
475: 475
476: 476 00000420: msg_reject:
477: 477 00000420: 98080000 0000000C int unknown_msg_reject
478: 478
479: 479 00000428: clearACK: ; ENTRY point to end negotiation
480: 480 00000428: 60000040 00000000 clear ACK
481: 481 00000430: 80880000 FFFFFE38 jump rel( phase_handler )
482: 482
483: 483
484: 484
485: 485 ;*****************************************************************
486: 486 ;
487: 487 ; Ignore Wide Residue
488: 488 ;
489: 489 ;*****************************************************************
490: 490
491: 491 00000438: ignoreWideResidue: ; this is a two byte message so snag the 2nd byte here
492: 492 00000438: 60000040 00000000 clear ACK
493: 493 00000440: 0F000001 00000041 move 1, ld_message+1, when MSG_IN ; save residue count
494: 494 00000448: 6A5E0000 00000000 move SFBR to SCRATCHB2 ; byte is still in SFBR. Position it.
495: 495 00000450: F05E0001 00000022 store SCRATCHB2, 1, DSAREL( TLQ_IWR ) ; Store residue count in Nexus for driver.
496: 496 00000458: 60000040 00000000 clear ACK
497: 497 00000460: 80880000 FFFFFE08 jump rel( phase_handler )
498: 498
499: 499
500: 500 ;*****************************************************************
501: 501 ;
502: 502 ; Extended message
503: 503 ; Accept Wide and Synchronous Data Transfer messages
504: 504 ;
505: 505 ;*****************************************************************
506: 506
507: 507 00000468: extended_msg:
508: 508 00000468: 60000040 00000000 clear ACK
509: 509 00000470: 0F000001 00000041 move 1, ld_message+1, when MSG_IN ; read msg length byte from bus
510: 510 00000478: 60000040 00000000 clear ACK
511: 511 00000480: 0F000001 00000042 move 1, ld_message+2, when MSG_IN ; read ext msg code from bus
512: 512 00000488: 60000040 00000000 clear ACK
513: 513 ; extended_identify, IF 0x02
514: 514 ; modify_data_pointer, if 0x00
515: 515 00000490: 808C0001 00000140 jump rel( sdtr ), if 0x01 ; jump if SDTR, sync negotiation msg
516: 516 00000498: 808C0003 00000148 jump rel( wdtr ), if 0x03 ; jump if WDTR, wide negotiation msg
517: 517 000004A0: 98080000 00000003 int unexpected_ext_msg ; let driver deal with unknown
518: 518
519: 519
520: 520 ;*****************************************************************
521: 521 ;
522: 522 ; Command complete
523: 523 ; The Command-Complete message is sent to indicate that the
524: 524 ; IO operation has completed and valid status has been sent.
525: 525 ; The Target should then disconnect.
526: 526 ; SCRIPTS must spin until the IOdone mailbox is empty.
527: 527 ; Then it sets the IOdone mailbox with the current Nexus.
528: 528 ; The status message is analyzed.
529: 529 ; If status is good, INTF the driver and jump to select_phase.
530: 530 ; If status is NG, save it in the NEXUS and INT the driver.
531: 531 ;
532: 532 ;*****************************************************************
533: 533
534: 534 000004A8: cmdComplete:
535: 535 000004A8: 785C0C00 00000000 move kphase_CMD_COMPLETE to SCRATCHB0 ; Set phase indicator
536: 536 000004B0: E05C0001 00000030 store SCRATCHB0, 1, ld_phase_flag
537: 537
538: 538 000004B8: 7C027F00 00000000 move SCNTL2 & 0X7F to SCNTL2 ; Clr SDU: SCSI Disconnect Unexpected
539: 539 000004C0: 60000040 00000000 clear ACK
540: 540 000004C8: 48000000 00000000 WAIT DISCONNECT
541: 541
542: 542 000004D0: testMbxLp: ; loop until IOdone mailbox empty
543: 543 000004D0: E1340004 00000014 load SCRATCHA0, 4, ld_IOdone_mailbox
544: 544 000004D8: 72370000 00000000 move SCRATCHA3 to SFBR ; A3 = semaphore
545: 545 000004E0: 80840000 FFFFFFE8 jump rel( testMbxLp ), if not 0
546: 546
547: 547 ; Fill in the IOdone mailbox with the following:
548: 548 ; A0 = index to Nexus
549: 549 ; A1 = Status
550: 550 ; A2 = 0
551: 551 ; A3 = semaphore (FF = set)
552: 552 000004E8: E1340001 00000028 load SCRATCHA0, 1, ld_nexus_index ; A0 = index to Nexus
553: 553 000004F0: E15C0001 00000008 load SCRATCHB0, 1, ld_status
554: 554 000004F8: 725C0000 00000000 move SCRATCHB0 to SFBR
555: 555 00000500: 6A350000 00000000 move SFBR to SCRATCHA1 ; A1 = Status
556: 556 00000508: 78360000 00000000 move 0x00 to SCRATCHA2 ; A2 = 0
557: 557 00000510: 7837FF00 00000000 move 0xFF to SCRATCHA3 ; A3 = semaphore IOdone mailbox
558: 558 00000518: E0340004 00000014 store SCRATCHA0, 4, ld_IOdone_mailbox
559: 559
560: 560 00000520: 72350000 00000000 move SCRATCHA1 to SFBR ; Test the Status of this IO
561: 561 ; SFBR = status msg
562: 562 ; Test status - If good, Interrupt on the fly and jump to select phase
563: 563 00000528: 981CC100 000000FF intfly 0xFF, if 0 and mask 0xC1 ; mask off reserved bits
564: 564 00000530: 808CC100 FFFFFBE8 jump rel( select_phase ), if 0 and mask 0xC1
565: 565 00000538: 98080000 00000001 int status_error ; Status err. Interrupt driver & stop
566: 566
567: 567
568: 568 ;*****************************************************************
569: 569 ;
570: 570 ; Disconnect
571: 571 ; The 8xx Accepts the disconnection and jumps to the select_phase
572: 572 ; to check for another IO
573: 573 ;
574: 574 ;*****************************************************************
575: 575
576: 576 00000540: disconnect_msg:
577: 577 00000540: E15C0001 00000030 load SCRATCHB0, 1, ld_phase_flag
578: 578 00000548: 725C0000 00000000 move SCRATCHB0 to SFBR
579: 579 ; If we got here from reselect just bailout since ld_nexus is
580: 580 ; not setup and the code using it is not needed anyway (no data xfer)
581: 581 00000550: 808C0009 00000010 jump rel( bailout ), if kphase_RESELECT
582: 582
583: 583 00000558: 785C0D00 00000000 move kphase_DISCONNECT to SCRATCHB0
584: 584 00000560: E05C0001 00000030 store SCRATCHB0, 1, ld_phase_flag
585: 585
586: 586 00000568: bailout:
587: 587 00000568: 785FFF00 00000000 move 0xFF to SCRATCHB3 ; invalidate nexus index for driver
588: 588 00000570: E05F0001 0000002B store SCRATCHB3, 1, ld_nexus_index+3
589: 589 00000578: 7C027F00 00000000 move SCNTL2 & 0x7F to SCNTL2 ; Clr SDU: SCSI Disconnect Unexpected
590: 590 00000580: 60000040 00000000 clear ACK
591: 591 00000588: 48000000 00000000 WAIT DISCONNECT ; wait for bus-free
592: 592 00000590: 80880000 FFFFFB88 jump rel( select_phase ) ; go see if more to do
593: 593
594: 594
595: 595 ;******************************************************************
596: 596 ;
597: 597 ; ??? mlj - saveDataPointer and restoreDataPointer are incorrect.
598: 598 ; ??? They basically do nothing.
599: 599 ; Save Data Pointer
600: 600 ;
601: 601 ;*****************************************************************
602: 602
603: 603 00000598: saveDataPointer:
604: 604 00000598: 785C0E00 00000000 move kphase_saveDataPointer to SCRATCHB0
605: 605 000005A0: E05C0001 00000030 store SCRATCHB0, 1, ld_phase_flag
606: 606 000005A8: 60000040 00000000 clear ACK
607: 607 000005B0: 80880000 FFFFFCB8 jump rel( phase_handler )
608: 608
609: 609
610: 610 ;******************************************************************
611: 611 ;
612: 612 ; ??? mlj - saveDataPointer and restoreDataPointer are incorrect.
613: 613 ; ??? They basically do nothing.
614: 614 ; Restore Data Pointer
615: 615 ; The local values still blocks, still bytes and data address
616: 616 ; must be loaded from the corresponding NEXUS data set.
617: 617 ; This message should followed an IDE (parity error)
618: 618 ;
619: 619 ;*****************************************************************
620: 620
621: 621 000005B8: restoreDataPointer:
622: 622 000005B8: 785C0F00 00000000 move kphase_restoreDataPointer to SCRATCHB0
623: 623 000005C0: E05C0001 00000030 store SCRATCHB0, 1, ld_phase_flag
624: 624 000005C8: 60000040 00000000 clear ACK
625: 625 000005D0: 80880000 FFFFFC98 jump rel( phase_handler )
626: 626
627: 627
628: 628 ;*****************************************************************
629: 629 ;
630: 630 ; Synchronous data transfer request or response
631: 631 ;
632: 632 ;*****************************************************************
633: 633 000005D8: sdtr:
634: 634 000005D8: 0F000002 00000043 move 2, ld_message+3, when MSG_IN ; Read period & offset from bus
635: 635 000005E0: 98080000 0000000D int negotiateSDTR
636: 636
637: 637
638: 638 ;***************************************************************************
639: 639 ;
640: 640 ; Wide Data Transfer request or response
641: 641 ;
642: 642 ;***************************************************************************
643: 643 000005E8: wdtr:
644: 644 000005E8: 0F000001 00000043 move 1, ld_message+3, when MSG_IN ; get Transfer Width Exponent fm bus
645: 645 000005F0: 98080000 0000000E int negotiateWDTR
646: 646
647: 647
648: 648 ;*****************************************************************
649: 649 ;
650: 650 ; Reselect phase
651: 651 ; The chip waits here either for a Reselection from a Target or
652: 652 ; a SIGP from the driver indicating something in the mailbox.
653: 653 ; If reselected, the script uses the Nexus value which is either
654: 654 ; a Tag or a SCSI ID/LUN combo to lookup the Nexus.
655: 655 ; Then init the SXFER and SCNTL3 registers from the device config table.
656: 656 ;
657: 657 ;*****************************************************************
658: 658
659: 659 000005F8: try_reselect: ; Select failed - probably reselecting
660: 660 ; Cf NCR Errata Listing 117 Item 1:
661: 661 000005F8: 7C00DF00 00000000 move SCNTL0 & 0xDF to SCNTL0 ; clr Start bit
662: 662 00000600: 7A1A0000 00000000 move CTEST2 | 0x00 to CTEST2 ; Clear SIGP bit from ISTAT reg
663: 663
664: 664 00000608: reselect_phase:
665: 665 00000608: 785C0900 00000000 move kphase_RESELECT to SCRATCHB0 ; Set phase indicator
666: 666 00000610: E05C0001 00000030 store SCRATCHB0, 1, ld_phase_flag
667: 667
668: 668 00000618: 785FFF00 00000000 move 0xFF to SCRATCHB3 ; invalidate nexus index for driver
669: 669 00000620: E05F0001 0000002B store SCRATCHB3, 1, ld_nexus_index+3
670: 670
671: 671 ; wait here for reselect from a Target
672: 672 ; or SIGP from the driver
673: 673
674: 674 00000628: 54000000 FFFFFAF0 WAIT RESELECT REL( select_phase ) ; jump if SIGP
675: 675
676: 676 ; Reselected:
677: 677
678: 678 00000630: 720A0000 00000000 move SSID to SFBR ; SSID = [ Valxxx Scsi_id ]
679: 679 00000638: 980C7F00 00000007 int unknown_reselect, if 0 and mask 0x7F; Interrupt if VAL bit not set
680: 680 00000640: 6C5C0F00 00000000 move SFBR & 0x0F to SCRATCHB0 ; B0 = Target ID
681: 681 00000648: E05C0001 00000020 store SCRATCHB0, 1, ld_scsi_id ; save it
682: 682
683: 683 00000650: 88880000 FFFFFA68 call rel( initContext ) ; setup sync regs here
684: 684
685: 685 00000658: 9F030000 00000005 int no_msgin_after_reselect, when not MSG_IN
686: 686
687: 687 00000660: 0F000001 00000040 move 1, ld_message, when MSG_IN ; Read Identify byte from bus
688: 688
689: 689 ; if another REQ is asserted, a SimpleQueueTag message should be next
690: 690
691: 691 00000668: 60000040 00000000 clear ACK ; notify Target: msg byte rx'd
692: 692 00000670: 878B0000 00000048 jump rel( getNextMsg ), when MSG_IN ; jump if SimpleQueueTag coming
693: 693
694: 694 ; untagged operation:
695: 695
696: 696 00000678: 6C340700 00000000 move SFBR & 0x07 to SCRATCHA0 ; isolate LUN from Identify byte
697: 697
698: 698 00000680: E15C0001 00000020 load SCRATCHB0, 1, ld_scsi_id ; B0 = Target ID
699: 699 00000688: 60000400 00000000 clear CARRY
700: 700 00000690: 715C0000 00000000 move SCRATCHB0 SHL SFBR ; shift left #1
701: 701 00000698: 695C0000 00000000 move SFBR SHL SCRATCHB0 ; shift left #2
702: 702 000006A0: 715C0000 00000000 move SCRATCHB0 SHL SFBR ; shift left #3
703: 703 000006A8: 7AB40000 00000000 move SCRATCHA0 | SFBR to SCRATCHA0 ; form Nexus index = 0b0TTTTLLL
704: 704
705: 705 000006B0: E0340001 00000028 store SCRATCHA0, 1, ld_nexus_index ; store as index to Nexus
706: 706 000006B8: 80880000 00000030 jump rel( haveNexusIndex )
707: 707
708: 708 ; should be tagged operation:
709: 709
710: 710 000006C0: getNextMsg:
711: 711 000006C0: 0F000001 00000040 move 1, ld_message, when MSG_IN ; read message byte from bus
712: 712 000006C8: 808C0004 FFFFFE70 jump rel( disconnect_msg ), if 0x04 ; if Disconnect, oh well.
713: 713 000006D0: 60000040 00000000 clear ACK
714: 714 000006D8: 80840020 FFFFFB90 jump rel( phase_handler ), if not 0x20; Branch if not Queue tag code
715: 715 ; get the Queue Tag and save as the nexus index
716: 716 000006E0: 0F000001 00000028 move 1, ld_nexus_index, when MSG_IN ; Nexus index <- Tag from bus
717: 717 000006E8: 60000040 00000000 clear ACK ; acknowledge it
718: 718
719: 719 000006F0: haveNexusIndex:
720: 720 000006F0: 785F0000 00000000 move 0x00 to SCRATCHB3 ; clear invalid-nexus-index flag
721: 721 000006F8: E05F0001 0000002B store SCRATCHB3, 1, ld_nexus_index+3
722: 722 00000700: 88880000 FFFFF950 call rel( findNexusFromIndex ) ; set DSA <- Nexus pointer
723: 723 00000708: 80880000 FFFFFB60 jump rel( phase_handler ) ; start handling phases.
724: 724
725: 725
726: 726 ;*****************************************************************
727: 727 ;
728: 728 ; AbortMailbox - Abort (or BusDeviceReset) the mailbox entry.
729: 729 ; This is a queued operation - not an immediate
730: 730 ; operation as is issueAbort_BDR.
731: 731 ; The Abort message clears all IO processes for the
732: 732 ; selecting Initiator on the specified LUN.
733: 733 ;
734: 734 ; The Bus Device Reset message clears all IO processes for
735: 735 ; all Initiators on all LUNs of selected Target.
736: 736 ; It forces a hard reset condition to the selected SCSI device.
737: 737 ;
738: 738 ; A0 = Identify byte (0xC0 + LUN N.B. Disconnect allowed)
739: 739 ; A1 = Tag, if any
740: 740 ; A2 = SCSI ID
741: 741 ; A3 = Abort code Abort=0x06; Abort Tag=0D; Bus Device Reset=0x0C
742: 742 ;
743: 743 ; Mailbox not cleared by SCRIPTS so that driver can find SCSI ID when done
744: 744 ; N.B.: Device is Async and Narrow after BDR!!!
745: 745 ; Driver must set the device config table values accordingly.
746: 746 ;*****************************************************************
747: 747
748: 748 00000710: AbortMailbox:
749: 749 00000710: 785C0B00 00000000 move kphase_ABORT_MAILBOX to SCRATCHB0 ; Set phase code
750: 750 00000718: E05C0001 00000030 store SCRATCHB0, 1, ld_phase_flag
751: 751
752: 752 00000720: 785FFF00 00000000 move 0xFF to SCRATCHB3 ; invalidate nexus index for driver
753: 753 00000728: E05F0001 0000002B store SCRATCHB3, 1, ld_nexus_index+3
754: 754
755: 755 00000730: E15C0004 00000004 load SCRATCHB0, 4, ld_zeroes ; clear Scratch B
756: 756 00000738: E15E0001 00000012 load SCRATCHB2, 1, ld_AbortBdr_mailbox+2 ; get SCSI ID
757: 757 00000740: E05C0004 0000074C store SCRATCHB0, 4, AbortSelect+4 ; *** Patch the Select/ATN instruction
758: 758
759: 759 00000748: AbortSelect:
760: 760 00000748: 45000000 FFFFFEA8 SELECT ATN 0, REL( try_reselect ) ; *** Patched SCSI ID
761: 761
762: 762 00000750: 72350000 00000000 move SCRATCHA1 to SFBR ; check for Tag
763: 763 00000758: 80840000 00000038 jump rel( taggedAbort ) if not 0x00 ; jump if tagged abort
764: 764
765: 765 ; untagged Abort or BusDeviceReset:
766: 766
767: 767 00000760: 72370000 00000000 move SCRATCHA3 to SFBR ; position the abort code
768: 768 00000768: 6A350000 00000000 move SFBR to SCRATCHA1
769: 769 00000770: E0340002 00000038 store SCRATCHA0, 2, ld_scratch ; Store Identify and Abort msgs
770: 770 00000778: 78020000 00000000 move 0x00 to SCNTL2 ; Clr SDU SCSI Disconnect Unexpected
771: 771 00000780: 0E000002 00000038 move 2, ld_scratch , when MSG_OUT ; emit Identify and Abort messages
772: 772 00000788: 48000000 00000000 WAIT DISCONNECT
773: 773 00000790: 98080000 00000009 int abort_mailbox
774: 774
775: 775 ; AbortTag:
776: 776
777: 777 00000798: taggedAbort:
778: 778 00000798: 72350000 00000000 move SCRATCHA1 to SFBR ; position the Tag
779: 779 000007A0: 6A360000 00000000 move SFBR to SCRATCHA2
780: 780 000007A8: 78352000 00000000 move 0x20 to SCRATCHA1 ; gen SimpleQueueTag code
781: 781 000007B0: E0340004 00000038 store SCRATCHA0, 4, ld_scratch ; store Identify, SQT, Tag, AbortTag
782: 782 000007B8: 78020000 00000000 move 0x00 to SCNTL2 ; Clr SDU SCSI Disconnect Unexpected
783: 783 000007C0: 0E000004 00000038 move 4, ld_scratch, when MSG_OUT ; emit all 4 bytes
784: 784 000007C8: 48000000 00000000 WAIT DISCONNECT
785: 785 000007D0: 98080000 00000009 int abort_mailbox
786: 786
787: 787
788: 788 ;*****************************************************************
789: 789 ;
790: 790 ; issueAbort_BDR - Abort (or BusDeviceReset) the current operation.
791: 791 ; This is an immediate operation - not a queued operation
792: 792 ; as is AbortMailbox.
793: 793 ; The Abort message clears all IO processes for the
794: 794 ; selecting Initiator on the specified LUN.
795: 795 ;
796: 796 ; The Bus Device Reset message clears all IO processes for
797: 797 ; all Initiators on all LUNs of selected Target.
798: 798 ; It forces a hard reset condition to the selected SCSI device.
799: 799 ;
800: 800 ;*****************************************************************
801: 801
802: 802 000007D8: issueAbort_BDR:
803: 803 000007D8: 785C0A00 00000000 move kphase_ABORT_CURRENT to SCRATCHB0 ; Set phase code
804: 804 000007E0: E05C0001 00000030 store SCRATCHB0, 1, ld_phase_flag
805: 805
806: 806 000007E8: 74140800 00000000 move ISTAT & 0x08 to SFBR ; see if Target connected to bus
807: 807 000007F0: 980C0000 0000000A int abort_current, if 0 ; interrupt driver if not connected
808: 808
809: 809 000007F8: 58000008 00000000 SET ATN ; get Target's attention
810: 810 00000800: E1100004 0000002C load DSA0, 4, ld_nexus ; load pointer to Nexus
811: 811
812: 812 00000808: bucketLoop:
813: 813 00000808: 60000040 00000000 clear ACK
814: 814 00000810: 868B0000 000000A8 jump rel( sendAbortBDR ), when MSG_OUT ; wait for REQ. Jump if OK.
815: 815
816: 816 00000818: 838A0000 00000030 jump rel( BucketInStatus ), if STATUS ; bit bucket in
817: 817 00000820: 878A0000 00000038 jump rel( BucketInMsg ), if MSG_IN ; bit bucket in
818: 818 00000828: 818A0000 00000040 jump rel( BucketInData ), if DATA_IN ; bit bucket in
819: 819
820: 820 00000830: 7834AD00 00000000 move 0xAD to SCRATCHA0
821: 821 00000838: 808A0000 00000040 jump rel( BucketOutData ), if DATA_OUT ; bit bucket out
822: 822 00000840: 828A0000 00000058 jump rel( BucketOutCmd ), if CMD ; bit bucket out
823: 823 00000848: 98080000 00000000 int unknown_phase ; back to driver for harsher measures
824: 824
825: 825
826: 826 00000850: BucketInStatus:
827: 827 00000850: 0B000001 00000038 move 1, ld_scratch, when STATUS ; eat the Status byte
828: 828 00000858: 80880000 FFFFFFA8 jump rel( bucketLoop ); ; keep bit-bucketing bytes
829: 829
830: 830 00000860: BucketInMsg:
831: 831 00000860: 0F000001 00000038 move 1, ld_scratch, when MSG_IN ; eat a message byte
832: 832 00000868: 80880000 FFFFFF98 jump rel( bucketLoop ); ; keep bit-bucketing bytes
833: 833
834: 834 00000870: BucketInData:
835: 835 00000870: 09000001 00000038 move 1, ld_scratch, when DATA_IN ; eat a data byte
836: 836 00000878: 80880000 FFFFFF88 jump rel( bucketLoop ); ; keep bit-bucketing bytes
837: 837
838: 838 00000880: BucketOutData:
839: 839 00000880: 7B347300 00000000 move SCRATCHA0 xor 0x73 to SCRATCHA0 ; gen 0xDEAD ...
840: 840 00000888: E0340001 00000038 store SCRATCHA0, 1, ld_scratch
841: 841 00000890: 08000001 00000038 move 1, ld_scratch, when DATA_OUT ; pad a byte out
842: 842 00000898: 80880000 FFFFFF68 jump rel( bucketLoop ); ; keep bit-bucketing bytes
843: 843
844: 844 000008A0: BucketOutCmd:
845: 845 000008A0: 78340000 00000000 move 0x00 to SCRATCHA0 ; load Null, TestUnitReady, whatever
846: 846 000008A8: E0340001 00000038 store SCRATCHA0, 1, ld_scratch
847: 847 000008B0: 0A000001 00000038 move 1, ld_scratch, when CMD ; pad a byte out
848: 848 000008B8: 80880000 FFFFFF48 jump rel( bucketLoop ); ; keep bit-bucketing bytes
849: 849
850: 850
851: 851 000008C0: sendAbortBDR:
852: 852 000008C0: 78020000 00000000 move 0x00 to SCNTL2 ; Clr SDU SCSI Disconnect Unexpected
853: 853 000008C8: 0E000001 00000000 move 1, ld_AbortCode, when MSG_OUT ; Send Abort(06) or BDR(0C) message
854: 854 000008D0: E1340004 00000004 load SCRATCHA0, 4, ld_zeroes ; load 0's
855: 855 000008D8: E0340004 00000000 store SCRATCHA0, 4, ld_AbortCode ; clear the Abort code
856: 856 000008E0: 48000000 00000000 WAIT DISCONNECT
857: 857 000008E8: 98080000 0000000A int abort_current ; went BusFree - tell Driver
858:
859: --SYMBOL---------------------------VALUE------TYPE-------
860: abort_current 0000000A ABSOLUTE
861: abort_mailbox 00000009 ABSOLUTE
862: kphase_ABORT_MAILBOX 0000000B ABSOLUTE
863: kphase_ABORT_CURRENT 0000000A ABSOLUTE
864: kphase_CMD_COMPLETE 0000000C ABSOLUTE
865: kphase_COMMAND 00000002 ABSOLUTE
866: kphase_DATA_IN 00000001 ABSOLUTE
867: kphase_DATA_OUT 00000000 ABSOLUTE
868: kphase_DISCONNECT 0000000D ABSOLUTE
869: kphase_MSG_IN 00000007 ABSOLUTE
870: kphase_MSG_OUT 00000006 ABSOLUTE
871: kphase_RESELECT 00000009 ABSOLUTE
872: kphase_SELECT 00000008 ABSOLUTE
873: kphase_STATUS 00000003 ABSOLUTE
874: kphase_restoreDataPointer 0000000F ABSOLUTE
875: kphase_saveDataPointer 0000000E ABSOLUTE
876: negotiateWDTR 0000000E ABSOLUTE
877: negotiateSDTR 0000000D ABSOLUTE
878: no_msgin_after_reselect 00000005 ABSOLUTE
879: reqack_too_large 00000006 ABSOLUTE
880: sglist_complete 0000000F ABSOLUTE
881: status_error 00000001 ABSOLUTE
882: TLQ_CDP 00000018 ABSOLUTE
883: TLQ_CDBp 00000010 ABSOLUTE
884: TLQ_IWR 00000022 ABSOLUTE
885: TLQ_MSGOp 00000008 ABSOLUTE
886: TLQ_SDP 0000001C ABSOLUTE
887: TLQ_index 00000020 ABSOLUTE
888: TLQ_pad 00000023 ABSOLUTE
889: TLQ_xferAdr 00000004 ABSOLUTE
890: TLQ_SCSI_ID 00000000 ABSOLUTE
891: TLQ_xferStarted 00000021 ABSOLUTE
892: unallocated_nexus 00000008 ABSOLUTE
893: unexpected_ext_msg 00000003 ABSOLUTE
894: unexpected_msg 00000002 ABSOLUTE
895: unknown_message_out 0000000B ABSOLUTE
896: unknown_msg_reject 0000000C ABSOLUTE
897: unknown_phase 00000000 ABSOLUTE
898: unknown_reselect 00000007 ABSOLUTE
899: wide_32_not_supported 00000004 ABSOLUTE
900: BSC_SCRIPT 00000000 CODE SEGMENT
901: SCRIPT 00000000 CODE SEGMENT
902: local_data 00000000 DATA SEGMENT
903: clearACK 00000428 ENTRY
904: issueAbort_BDR 000007D8 ENTRY
905: issueMessageOut 000002D0 ENTRY
906: phase_handler 00000270 ENTRY
907: select_phase 00000120 ENTRY
908: AbortSelect 00000748 LABEL
909: AbortMailbox 00000710 LABEL
910: BucketInData 00000870 LABEL
911: BucketInMsg 00000860 LABEL
912: BucketInStatus 00000850 LABEL
913: BucketOutCmd 000008A0 LABEL
914: BucketOutData 00000880 LABEL
915: bucketLoop 00000808 LABEL
916: bailout 00000568 LABEL
917: bucket_loop 00000390 LABEL
918: clear_mailbox 00000250 LABEL
919: cmdComplete 000004A8 LABEL
920: command_phase 00000308 LABEL
921: data_in_phase 00000378 LABEL
922: data_out_phase 00000330 LABEL
923: disconnect_msg 00000540 LABEL
924: doItPatch 00000370 LABEL
925: driverXfer 00000350 LABEL
926: extended_msg 00000468 LABEL
927: fetchMailbox 00000188 LABEL
928: findNexusFromIndex 00000058 LABEL
929: getNextMsg 000006C0 LABEL
930: haveNexusIndex 000006F0 LABEL
931: ignoreWideResidue 00000438 LABEL
932: initContext 000000C0 LABEL
933: message_in_phase 000003C8 LABEL
934: message_out_phase 000002B0 LABEL
935: msg_reject 00000420 LABEL
936: patchGetDevConfigOffset 000000F0 LABEL
937: patchArrayOffset 00000098 LABEL
938: reselect_phase 00000608 LABEL
939: restoreDataPointer 000005B8 LABEL
940: sdtr 000005D8 LABEL
941: saveDataPointer 00000598 LABEL
942: sendAbortBDR 000008C0 LABEL
943: status_phase 000003A8 LABEL
944: taggedAbort 00000798 LABEL
945: testMbxLp 000004D0 LABEL
946: try_reselect 000005F8 LABEL
947: wdtr 000005E8 LABEL
948: ld_IOdone_mailbox 00000014 RELATIVE.
949: ld_AbortBdr_mailbox 00000010 RELATIVE.
950: ld_counter 0000000C RELATIVE.
951: ld_device_table_base_adr 00000034 RELATIVE.
952: ld_mailboxp 0000001C RELATIVE.
953: ld_message 00000040 RELATIVE.
954: ld_message4 00000044 RELATIVE.
955: ld_nexus 0000002C RELATIVE.
956: ld_nexus_array_base 00000024 RELATIVE.
957: ld_nexus_index 00000028 RELATIVE.
958: ld_pad 00000048 RELATIVE.
959: ld_phase_flag 00000030 RELATIVE.
960: ld_sched_mlbx_base_adr 00000018 RELATIVE.
961: ld_scratch 00000038 RELATIVE.
962: ld_scsi_id 00000020 RELATIVE.
963: ld_size 0000004C RELATIVE.
964: ld_status 00000008 RELATIVE.
965: ld_unused 0000003C RELATIVE.
966: ld_zeroes 00000004 RELATIVE.
967: ld_AbortCode 00000000 RELATIVE.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.