1 ;************************************************************************* 2 ; demoPCI.ss 3 ; 4 ; ABSOLUTE declarations 5 6 ABSOLUTE SCSI_id = 0x00 7 ABSOLUTE error_not_cmd_phase = 0x01 8 ABSOLUTE error_not_data_in_phase = 0x02 9 ABSOLUTE error_not_data_out_phase = 0x03 10 ABSOLUTE error_not_msg_in_phase = 0x04 11 ABSOLUTE error_not_msg_out_phase = 0x05 12 ABSOLUTE error_not_status_phase = 0x06 13 ABSOLUTE error_unexpected_phase = 0x07 14 ABSOLUTE error_jump_not_taken = 0x10 15 ABSOLUTE error_not_cmd_complete = 0x20 16 ABSOLUTE error_not_extended_msg = 0x21 17 ABSOLUTE end_of_SCSI_SCRIPT = 0x0A 18 ABSOLUTE reselected_interrupt = 0x80 19 ABSOLUTE selected_interrupt = 0x81 20 ABSOLUTE synch_xfer_interrupt = 0x888 21 22 RELATIVE rel_data1 \ 23 00000000: identify_msg_buf = { 0x80 }, \ ;identify_msg_buf = 1 byte 24 00000001: targ_ident_buf = ??, \ 25 00000002: ident_with_disc = {0xc0}, \ ;Identify and allow disconnect 26 00000003: synch_msgo_buf = 5{??}, \ ;synch_msgo_buf = 5 bytes 27 00000008: synch_msgi_buf = 5{??}, \ ;synch_msgi_buf = 5 bytes 28 0000000D: dummy_buf = 9{??}, \ 29 00000016: disconnect_msg_in_buf = {0x02, 0x04} ;disconnect_msg_in_buf = 2 bytes 30 31 TABLE table_indirect \ 32 00000000: stat_buf = 0x00, \ ;stat_buf=1 byte 33 00000008: msg_in_buf = 0x00, \ ;msg_in_buf=1 byte 34 00000010: bogus_buf = 7{??}, \ 35 00000018: data_buf = 512{??}, \ 36 00000020: W_cmd_buf = {0x0A, 0x00, 0x00, 0x00, 0x01, 0x00}, \ ;W_cmd_buf=6 bytes 37 00000028: R_cmd_buf = {0x08, 0x00, 0x00, 0x00, 0x01, 0x00}, \ 38 00000030: req_sense_cmd_buf = {0x03, 0x00, 0x00, 0x00, 0x12, 0x00}, \ 39 00000038: ident_and_synch_msg_buf = { 0x80, 0x01, 0x03, 0x01, 0x19, 0x08 }, \ 40 00000040: dum_buf = 512{??}, \ 41 00000048: sid = ID{??},\ 42 00000050: select_id = ID{ 0x33, 0x00, 0x33, 0x00 } 43 44 EXTERN cmd_buf = 12{??} ;cmd_buf=12 bytes 45 EXTERN read_cap_buf = 8{??} ;read_cap_buf=8 bytes 46 EXTERN inquiry_buf = 36{??} ;inquiry_buf=36 bytes 47 EXTERN request_sense_buf= 18{??} ;request_sense_buf=18 bytes 48 EXTERN unused_buf = 7{??} 49 EXTERN write_cmd = { 0x0A, 0x00, 0x00, 0x00, 0x01, 0x00 } 50 EXTERN read_cmd = { 0x08, 0x00, 0x00, 0x00, 0x01, 0x00 } 51 EXTERN tur_cmd = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } 52 EXTERN inquiry_cmd = { 0x12, 0x00, 0x00, 0x00, 0x24, 0x00 } 53 EXTERN read_cap_cmd = { 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, \ 54 0x00, 0x00, 0x00, 0x00 } 55 56 ; additional relative data area for testing 57 58 RELATIVE rel_data2 \ 59 00000000: r1 = 3{??}, \ 60 00000003: r2 = { 0x02, 0x04, 0x06, 0x08 }, \ 61 00000007: r3 = { 0xEE } 62 63 ;*********************************************************************** 64 ; ENTRY declarations 65 ENTRY test_unit_ready 66 ENTRY read_capacity 67 ENTRY inquiry 68 ENTRY request_sense 69 ENTRY initiator_synchronous 70 ENTRY initiator_read 71 ENTRY initiator_write 72 ENTRY loop_write_read 73 ENTRY loop_read_select 74 ENTRY target_script 75 ENTRY target_reselect 76 ENTRY init_write_read_disconnect 77 ENTRY i_d_write_reconnect 78 ENTRY i_d_read_reconnect 79 ENTRY initiator_reselect 80 ENTRY init_read_byte_count 81 ENTRY init_write_byte_count 82 ENTRY init_loop_read_byte_count 83 ENTRY init_loop_write_byte_count 84 ENTRY to_decisions 85 ENTRY init_select_test 86 87 ;*********************************************************************** 88 ; Test Unit Ready Script followed by Request Sense Script 89 ; 90 ; A drive will return Check Condition until a TUR and 91 ; a Request Sense command are received after power up or SCSI 92 ; Reset. This Script can be executed to clear the Check 93 ; Condition. 94 ;*********************************************************************** 95 96 00000000: test_unit_ready_and_req_sense: 97 00000000: 43000050 000008F8 select ATN from select_id, alt_jump_reselected ;select the target 98 99 00000008: 80880000 00000074 jump REL(tur_decisions_req_sense) 100 101 00000010: tur_msg_out_req_sense: 102 00000010: 0E000001 00000000 move 1, identify_msg_buf, when MSG_OUT ;move the message byte in 103 104 00000018: tur_command_req_sense: 105 00000018: 60000008 00000000 clear ATN ;clear ATN when drive does 106 ;not support disconnect 107 00000020: 9A030000 00000001 int error_not_cmd_phase, when not CMD ;check for command phase 108 00000028: C0000006 00000000 00000000 move memory 6, tur_cmd, cmd_buf ;move the tur command into the 109 ;cmd_buf 110 00000034: 0A000006 00000000 move 6, cmd_buf, when CMD ;move the command bytes 111 112 0000003C: 9B030000 00000006 int error_not_status_phase, when not STATUS ;check for status phase 113 00000044: 1B000000 00000000 move from stat_buf, when STATUS ;move the status byte in 114 115 0000004C: 9F030000 00000004 int error_not_msg_in_phase, when not MSG_IN ;check for message in phase 116 00000054: 1F000000 00000008 move from msg_in_buf, when MSG_IN ;move the message in 117 0000005C: 98040000 00000020 int error_not_cmd_complete, if not 00 ;interrupt if not command 118 ;complete message 119 120 00000064: 7C027F00 00000000 move SCNTL2 & 0x7F to SCNTL2 ;clear the SCSI disconnect 121 ;unexpected bit 122 0000006C: 60000040 00000000 clear ACK ;accept the message byte 123 124 00000074: 48000000 0000000A wait disconnect end_of_SCSI_SCRIPT ;wait for bus free 125 0000007C: 80880000 00000020 jump REL(req_sense_after_tur) ;now do a Request Sense 126 127 00000084: tur_decisions_req_sense: 128 00000084: 868B0000 FFFFFF84 jump REL(tur_msg_out_req_sense), when MSG_OUT ; move identify message 129 0000008C: 828A0000 FFFFFF84 jump REL(tur_command_req_sense), if CMD ;jump to command when not 130 ;message out phase, drive may 131 ;not support select w/ ATN 132 00000094: 878A0000 00000344 jump REL(init_synch_msg_in_phase), if MSG_IN ;some drives immediately try 133 ;synchronous negotiation 134 0000009C: 98080000 00000007 int error_unexpected_phase 135 136 137 000000A4: req_sense_after_tur: 138 000000A4: 41000000 000008F8 select ATN SCSI_id, alt_jump_reselected ;select the target 139 140 000000AC: 86830000 00000010 jump REL(req_sense_command_phase_tur), when not MSG_OUT ;jump to command when 141 ;not message out phase 142 ;drive may not 143 ;support select w/ ATN 144 145 000000B4: 9E030000 00000005 int error_not_msg_out_phase, when not MSG_OUT ;check for message out phase next 146 000000BC: 0E000001 00000000 move 1, identify_msg_buf, when MSG_OUT ;move command byte in 147 148 000000C4: req_sense_command_phase_tur: 149 000000C4: 60000008 00000000 clear ATN 150 000000CC: 9A030000 00000001 int error_not_cmd_phase, when not CMD ;check for command phase 151 152 000000D4: 1A000000 00000030 move FROM req_sense_cmd_buf, when CMD ;move the command bytes out 153 154 000000DC: 99030000 00000002 int error_not_data_in_phase, when not DATA_IN ;check for data in phase 155 000000E4: 09000012 00000000 move 18, request_sense_buf, when DATA_IN ;move sense bytes 156 157 000000EC: 9B030000 00000006 int error_not_status_phase, when not STATUS ;check for status phase next 158 000000F4: 1B000000 00000000 move from stat_buf, when STATUS ;move the status byte in 159 160 000000FC: 9F030000 00000004 int error_not_msg_in_phase, when not MSG_IN ;check for message in phase 161 00000104: 1F000000 00000008 move from msg_in_buf, when MSG_IN ;move message in 162 0000010C: 98040000 00000020 int error_not_cmd_complete, if not 00 ;interrupt if not command 163 ;complete message 164 00000114: 7C027F00 00000000 move SCNTL2 & 0x7F to SCNTL2 ;clear the SCSI disconnect 165 ;unexpected bit 166 167 0000011C: 60000040 00000000 clear ACK ;accept the message byte 168 169 00000124: 48000000 0000000A wait disconnect end_of_SCSI_SCRIPT ;wait for bus free 170 0000012C: 98080000 0000000A int end_of_SCSI_SCRIPT ;interrupt end of SCSI I/O 171 172 ; end Request Sense After Test Unit Ready SCRIPT 173 174 175 176 177 ;*********************************************************************** 178 ; TEST UNIT READY SCRIPT 179 180 00000134: test_unit_ready: 181 00000134: 41000000 000008F8 select ATN SCSI_id, alt_jump_reselected ;select the target 182 183 0000013C: 80880000 00000074 jump REL(tur_decisions) 184 185 00000144: tur_msg_out: 186 00000144: 0E000001 00000000 move 1, identify_msg_buf, when MSG_OUT ;move the message byte in 187 188 0000014C: tur_command: 189 0000014C: 60000008 00000000 clear ATN ;clear ATN when drive does 190 ;not support disconnect 191 00000154: 9A030000 00000001 int error_not_cmd_phase, when not CMD ;check for command phase 192 0000015C: C0000006 00000000 00000000 move memory 6, tur_cmd, cmd_buf ;move the tur command into the 193 ;cmd_buf 194 00000168: 0A000006 00000000 move 6, cmd_buf, when CMD ;move the command bytes 195 196 00000170: 9B030000 00000006 int error_not_status_phase, when not STATUS ;check for status phase 197 00000178: 1B000000 00000000 move from stat_buf, when STATUS ;move the status byte in 198 199 00000180: 9F030000 00000004 int error_not_msg_in_phase, when not MSG_IN ;check for message in phase 200 00000188: 1F000000 00000008 move from msg_in_buf, when MSG_IN ;move the message in 201 00000190: 98040000 00000020 int error_not_cmd_complete, if not 00 ;interrupt if not command 202 ;complete message 203 00000198: 7C027F00 00000000 move SCNTL2 & 0x7F to SCNTL2 ;clear the SCSI disconnect 204 ;unexpected bit 205 000001A0: 60000040 00000000 clear ACK ;accept the message byte 206 207 000001A8: 48000000 0000000A wait disconnect end_of_SCSI_SCRIPT ;wait for bus free 208 000001B0: 98080000 0000000A int end_of_SCSI_SCRIPT ;interrupt end of SCSI I/O 209 210 000001B8: tur_decisions: 211 000001B8: 868B0000 FFFFFF84 jump REL(tur_msg_out), when MSG_OUT ; move identify message 212 000001C0: 828A0000 FFFFFF84 jump REL(tur_command), if CMD ;jump to command when not 213 ;message out phase, drive may 214 ;not support select w/ ATN 215 000001C8: 878A0000 00000210 jump REL(init_synch_msg_in_phase), if MSG_IN ;some drives immediately try 216 ;synchronous negotiation 217 000001D0: 98080000 00000007 int error_unexpected_phase 218 219 220 ; end Test Unit Ready SCRIPT 221 222 ;*********************************************************************** 223 ;READ CAPACITY SCRIPT 224 225 000001D8: PROC read_capacity: 226 000001D8: 41000000 000008F8 select ATN SCSI_id, alt_jump_reselected ;select the target 227 228 000001E0: 86830000 00000008 jump REL(read_cap_cmd_phase), when not MSG_OUT ;jump to cmd when not msg 229 ;out phase, drive may not 230 ;support select w/atn 231 000001E8: 0E000001 00000000 move 1, identify_msg_buf, when MSG_OUT ;move the msg byte into the 232 ;identify_msg_buf 233 000001F0: read_cap_cmd_phase: 234 000001F0: 60000008 00000000 clear ATN ;clear atn when drive does 235 ;not support select w/atn 236 000001F8: 9A030000 00000001 int error_not_cmd_phase, when not CMD ;issue interrupt when not 237 ;cmd phase 238 00000200: C000000A 00000000 00000000 move memory 10, read_cap_cmd, cmd_buf ;load the command buffer with 239 ;read capacity command 240 0000020C: 0A00000A 00000000 move 10, cmd_buf, when CMD ;move the read capacity cmd 241 242 00000214: 99030000 00000002 int error_not_data_in_phase, when not DATA_IN ;check for data in phase 243 0000021C: 09000008 00000000 move 8, read_cap_buf, when DATA_IN ;move data bytes: logical 244 ;block address byte 0-3 245 ;block length in bytes 246 ;byte 4-7 247 248 00000224: 9B030000 00000006 int error_not_status_phase, when not STATUS ;check for status phase 249 0000022C: 1B000000 00000000 move from stat_buf, when STATUS ;move status byte in 250 251 00000234: 9F030000 00000004 int error_not_msg_in_phase, when not MSG_IN ;check for message in phase 252 0000023C: 1F000000 00000008 move from msg_in_buf, when MSG_IN ;move the cmd complete msg in 253 00000244: 98040000 00000020 int error_not_cmd_complete, if not 00 ;interrupt if not a cmd compl. 254 ;message 255 0000024C: 7C027F00 00000000 move SCNTL2 & 0x7F to SCNTL2 ;clear the SCSI disconnect 256 ;unexpected bit 257 00000254: 60000040 00000000 clear ACK ;accept the msg byte 258 0000025C: 48000000 0000000A wait disconnect end_of_SCSI_SCRIPT ;wait for bus free 259 ;interrupt 260 00000264: 98080000 0000000A int end_of_SCSI_SCRIPT ;interrupt end SCSI I/O 261 262 ; end Read Capacity SCRIPT 263 264 ;*********************************************************************** 265 ; INQUIRY SCRIPT 266 267 0000026C: inquiry: 268 0000026C: 41000000 000008F8 select ATN SCSI_id, alt_jump_reselected ;select the target 269 270 00000274: 86830000 00000010 jump REL(inq_command_phase), when not MSG_OUT ;jump to command when 271 ;not message out phase, 272 ;drive may not support 273 ;select w/ ATN 274 275 0000027C: 9E030000 00000005 int error_not_msg_out_phase, when not MSG_OUT ;check for message out 276 00000284: 0E000001 00000000 move 1, identify_msg_buf, when MSG_OUT ;move command byte in 277 278 0000028C: inq_command_phase: 279 0000028C: 60000008 00000000 clear ATN 280 00000294: 9A030000 00000001 int error_not_cmd_phase, when not CMD ;check for command phase 281 0000029C: C0000006 00000000 00000000 move memory 6, inquiry_cmd, cmd_buf ;load the inquiry command into 282 ;cmd_buf 283 000002A8: 0A000006 00000000 move 6, cmd_buf, when CMD ;move the command bytes out 284 000002B0: 99030000 00000002 int error_not_data_in_phase, when not DATA_IN ;check for data in phase 285 000002B8: 09000024 00000000 move 36, inquiry_buf, when DATA_IN ;move inquiry bytes 286 287 000002C0: 9B030000 00000006 int error_not_status_phase, when not STATUS ;check for status phase 288 000002C8: 1B000000 00000000 move from stat_buf, when STATUS ;move the status byte in 289 290 000002D0: 9F030000 00000004 int error_not_msg_in_phase, when not MSG_IN ;check for message in phase 291 000002D8: 1F000000 00000008 move from msg_in_buf, when MSG_IN ;move command complete message in 292 000002E0: 98040000 00000020 int error_not_cmd_complete, if not 00 ;interrupt if not a command complete 293 000002E8: 7C027F00 00000000 move SCNTL2 & 0x7F to SCNTL2 ;clear the SCSI disconnect 294 ;unexpected bit 295 296 000002F0: 60000040 00000000 clear ACK ;accept the message byte 297 298 000002F8: 48000000 0000000A wait disconnect end_of_SCSI_SCRIPT ;wait for bus free 299 00000300: 98080000 0000000A int end_of_SCSI_SCRIPT ;interrupt end SCSI I/O 300 301 ; end Inquiry SCRIPT 302 303 ;*********************************************************************** 304 ; REQUEST SENSE SCRIPT 305 306 00000308: PROC request_sense: 307 00000308: 41000000 000008F8 select ATN SCSI_id, alt_jump_reselected ;select the target 308 309 00000310: 86830000 00000010 jump REL(req_sense_command_phase), when not MSG_OUT ;jump to command when 310 ;not message out phase 311 ;drive may not 312 ;support select w/ ATN 313 314 00000318: 9E030000 00000005 int error_not_msg_out_phase, when not MSG_OUT ;check for message out phase next 315 00000320: 0E000001 00000000 move 1, identify_msg_buf, when MSG_OUT ;move command byte in 316 317 00000328: req_sense_command_phase: 318 00000328: 60000008 00000000 clear ATN 319 00000330: 9A030000 00000001 int error_not_cmd_phase, when not CMD ;check for command phase 320 321 00000338: 1A000000 00000030 move FROM req_sense_cmd_buf, when CMD ;move the command bytes out 322 323 00000340: 99030000 00000002 int error_not_data_in_phase, when not DATA_IN ;check for data in phase 324 00000348: 09000012 00000000 move 18, request_sense_buf, when DATA_IN ;move sense bytes 325 326 00000350: 9B030000 00000006 int error_not_status_phase, when not STATUS ;check for status phase next 327 00000358: 1B000000 00000000 move from stat_buf, when STATUS ;move the status byte in 328 329 00000360: 9F030000 00000004 int error_not_msg_in_phase, when not MSG_IN ;check for message in phase 330 00000368: 1F000000 00000008 move from msg_in_buf, when MSG_IN ;move message in 331 00000370: 98040000 00000020 int error_not_cmd_complete, if not 00 ;interrupt if not command 332 ;complete message 333 00000378: 7C027F00 00000000 move SCNTL2 & 0x7F to SCNTL2 ;clear the SCSI disconnect 334 ;unexpected bit 335 336 00000380: 60000040 00000000 clear ACK ;accept the message byte 337 338 00000388: 48000000 0000000A wait disconnect end_of_SCSI_SCRIPT ;wait for bus free 339 00000390: 98080000 0000000A int end_of_SCSI_SCRIPT ;interrupt end of SCSI I/O 340 341 ; end Request Sense SCRIPT 342 343 ;*********************************************************************** 344 ; INITIATOR SYNCHRONOUS NEGOTIATION SCRIPT 345 346 00000398: initiator_synchronous: 347 00000398: 41000000 000008F8 select ATN SCSI_id, alt_jump_reselected ;select the target 348 349 000003A0: 868B0000 00000010 jump REL(init_synch_id_msg), when MSG_OUT 350 000003A8: 60000008 00000000 clear ATN 351 000003B0: 80880000 00000068 jump REL(to_decisions) 352 353 000003B8: init_synch_id_msg: 354 000003B8: 1E000000 00000038 move FROM ident_and_synch_msg_buf, when MSG_OUT ;move the identify 355 ;and synch neg msg out 356 000003C0: 80880000 00000058 jump REL(to_decisions) 357 358 000003C8: init_synch_cmd_phase: 359 000003C8: 9A020000 00000001 int error_not_cmd_phase, if not CMD ;check for command phase 360 000003D0: 0A000006 00000000 move 6, tur_cmd, when CMD ;move the command bytes out 361 000003D8: 80880000 00000040 jump REL(to_decisions) 362 363 364 000003E0: init_synch_msg_in_phase: 365 000003E0: 9F030000 00000004 int error_not_msg_in_phase, when not MSG_IN ;check for message in phase 366 000003E8: 0F000001 00000008 move 1, synch_msgi_buf, when MSG_IN ;move 1st message byte in 367 000003F0: 60000040 00000000 clear ACK ;accept the message byte 368 369 000003F8: 808C0007 00000020 jump REL(to_decisions), if 7 ;asynch if message reject 370 ;take jump to_data_in_phase 371 ;to properly check phase 372 ;with when instead of 373 ;if at data_in 374 00000400: 98040001 00000021 int error_not_extended_msg, if not 1 ;interrupt if not extended message 375 00000408: 0F000004 00000009 move 4, synch_msgi_buf+1, when MSG_IN ;move synch negotiation message in 376 00000410: 60000040 00000000 clear ACK ;accept the message byte 377 378 00000418: 98080000 00000888 int synch_xfer_interrupt ;interrupt to initialize 379 ;SIOP for synchronous transfer 380 ;(SXFER register) 381 382 00000420: to_decisions: 383 00000420: 818B0000 0000006C jump REL(init_read_data_in_phase), when DATA_IN 384 00000428: 808A0000 00000100 jump REL(init_write_data_out_phase), if DATA_OUT 385 00000430: 838A0000 0000006C jump REL(init_read_status_phase), if STATUS 386 00000438: 828A0000 FFFFFF88 jump REL(init_synch_cmd_phase), if CMD 387 00000440: 878A0000 FFFFFF98 jump REL(init_synch_msg_in_phase), if MSG_IN 388 00000448: 98080000 00000007 int error_unexpected_phase 389 390 ; end Initiator Synchronous Negotiation SCRIPT 391 392 ;*********************************************************************** 393 ; INITIATOR READ SCRIPT 394 395 00000450: initiator_read: 396 00000450: 41000000 000008F8 select ATN SCSI_id, alt_jump_reselected ;select the target 397 398 00000458: 86830000 00000010 jump REL(init_read_cmd_phase), when not MSG_OUT ;jump to command when not 399 ;message out phase, 400 ;drive may not 401 ;support select w/ ATN 402 403 00000460: 9E030000 00000005 int error_not_msg_out_phase, when not MSG_OUT ;check for message out phase next 404 00000468: 0E000001 00000000 move 1, identify_msg_buf, when MSG_OUT ;move the message byte in 405 406 00000470: init_read_cmd_phase: 407 00000470: 9A030000 00000001 int error_not_cmd_phase, when not CMD ;check for command phase 408 00000478: 60000008 00000000 clear ATN ;clear ATN when drive does 409 ;not support select w/ ATN 410 00000480: C0000006 00000000 00000000 move memory 6, read_cmd, cmd_buf ;move the read command into the 411 ;cmd_buf 412 0000048C: 0A000006 00000000 move 6, cmd_buf, when CMD ;move the command bytes out 413 414 00000494: init_read_data_in_phase: 415 00000494: 99030000 00000002 int error_not_data_in_phase, when not DATA_IN ;check for data in phase 416 0000049C: init_read_byte_count: 417 0000049C: 19000000 00000018 move from data_buf, when DATA_IN ;move data bytes 418 419 000004A4: init_read_status_phase: 420 000004A4: 9B030000 00000006 int error_not_status_phase, when not STATUS ;check for status phase next 421 000004AC: 1B000000 00000000 move from stat_buf, when STATUS ;move the status byte in 422 423 000004B4: 9F030000 00000004 int error_not_msg_in_phase, when not MSG_IN ;check for message in 424 000004BC: 1F000000 00000008 move from msg_in_buf, when MSG_IN ;move the message in 425 000004C4: 98040000 00000020 int error_not_cmd_complete, if not 00 ;interrupt if not command complete message 426 000004CC: 7C027F00 00000000 move SCNTL2 & 0x7F to SCNTL2 ;clear the SCSI disconnect 427 ;unexpected bit 428 429 000004D4: 60000040 00000000 clear ACK ;accept the message byte 430 431 000004DC: 48000000 0000000A wait disconnect end_of_SCSI_SCRIPT ;wait for bus free 432 000004E4: 98080000 0000000A int end_of_SCSI_SCRIPT ;interrupt end of SCSI I/O 433 434 ; end of Initiator Read SCRIPT 435 436 ;*********************************************************************** 437 ; INITIATOR WRITE SCRIPT 438 439 000004EC: initiator_write: 440 000004EC: 41000000 000008F8 select ATN SCSI_id, alt_jump_reselected ;select the target 441 442 000004F4: 86830000 00000010 jump REL(init_write_command_phase), when not MSG_OUT ;jump to command when 443 ;not message out phase 444 ;drive may not 445 ;support select w/ ATN 446 000004FC: 9E030000 00000005 int error_not_msg_out_phase, when not MSG_OUT ;check for message out 447 00000504: 0E000001 00000000 move 1, identify_msg_buf, when MSG_OUT ;move the message byte in 448 449 0000050C: init_write_command_phase: 450 0000050C: 9A030000 00000001 int error_not_cmd_phase, when not CMD ;check for command phase next 451 00000514: 60000008 00000000 clear ATN ;clear ATN when drive does not 452 ;support select w/ ATN 453 0000051C: C0000006 00000000 00000000 move memory 6, write_cmd, cmd_buf ;move the write command into the 454 ;cmd_buf 455 00000528: 0A000006 00000000 move 6, cmd_buf, when CMD ;move the command bytes out 456 457 00000530: init_write_data_out_phase: 458 00000530: 98030000 00000003 int error_not_data_out_phase, when not DATA_OUT ;interrupt if not data out 459 00000538: init_write_byte_count: 460 00000538: 18000000 00000018 move from data_buf, when DATA_OUT ;move data bytes 461 462 00000540: 9B030000 00000006 int error_not_status_phase, when not STATUS ;check for status phase next 463 00000548: 1B000000 00000000 move from stat_buf, when STATUS ;move the status byte in 464 465 00000550: 9F030000 00000004 int error_not_msg_in_phase, when not MSG_IN ;check for message in phase 466 00000558: 1F000000 00000008 move from msg_in_buf, when MSG_IN ;move the message in 467 00000560: 98040000 00000020 int error_not_cmd_complete, if not 00 ;interrupt if not command complete 468 00000568: 7C027F00 00000000 move SCNTL2 & 0x7F to SCNTL2 ;clear the SCSI disconnect 469 ;unexpected bit 470 471 00000570: 60000040 00000000 clear ACK ;accept the message byte 472 473 00000578: 48000000 0000000A wait disconnect end_of_SCSI_SCRIPT ;wait for bus free 474 475 00000580: 98080000 0000000A int end_of_SCSI_SCRIPT ;interrupt end SCSI I/O 476 477 ; end Initiator Write SCRIPT 478 479 ;*********************************************************************** 480 ; INITIATOR LOOP WRITE/READ SCRIPT 481 482 ; WRITE 483 484 00000588: loop_write_read: 485 00000588: 41000000 000008F8 select ATN SCSI_id, alt_jump_reselected ;select the target 486 487 00000590: 86830000 00000010 jump REL(w_r_command_phase), when not MSG_OUT ;jump to command when not 488 ;message out phase, drive may 489 ;not support select w/ ATN 490 00000598: 9E030000 00000005 int error_not_msg_out_phase, when not MSG_OUT ;check for message out phase next 491 000005A0: 0E000001 00000000 move 1, identify_msg_buf, when MSG_OUT ;move the message byte in 492 493 000005A8: w_r_command_phase: 494 000005A8: 9A030000 00000001 int error_not_cmd_phase, when not CMD ;check for command phase next 495 000005B0: 60000008 00000000 clear ATN ;clear ATN when drive does not 496 ;support select w/ ATN 497 000005B8: 1A000000 00000020 move from W_cmd_buf, when CMD ;move the command bytes out 498 499 000005C0: 98030000 00000003 int error_not_data_out_phase, when not DATA_OUT ;interrupt if not data out 500 000005C8: init_loop_write_byte_count: 501 000005C8: 18000000 00000018 move from data_buf, when DATA_OUT ;move data bytes 502 503 ; used to test scatter gather - seperate data buffers 504 ; move 512, data_buf0, when DATA_OUT 505 ; move 512, data_buf1, when DATA_OUT ; move data bytes 506 ; move 512, data_buf2, when DATA_OUT ; move data bytes 507 ; move 512, data_buf3, when DATA_OUT ; move data bytes 508 509 000005D0: 9B030000 00000006 int error_not_status_phase, when not STATUS ;check for status phase next 510 000005D8: 1B000000 00000000 move from stat_buf, when STATUS ;move the status byte in 511 512 000005E0: 9F030000 00000004 int error_not_msg_in_phase, when not MSG_IN ;check for message in phase 513 000005E8: 1F000000 00000008 move from msg_in_buf, when MSG_IN ;move the command complete message in 514 000005F0: 98040000 00000020 int error_not_cmd_complete, if not 00 ;interrupt if not command complete message 515 000005F8: 7C027F00 00000000 move SCNTL2 & 0x7F to SCNTL2 ;clear the SCSI disconnect 516 ;unexpected bit 517 518 00000600: 60000040 00000000 clear ACK ;accept the message byte 519 520 00000608: 48000000 0000000A wait disconnect end_of_SCSI_SCRIPT ;wait for the bus free 521 522 ; READ 523 00000610: loop_read_select: 524 00000610: 41000000 000008F8 select ATN SCSI_id, alt_jump_reselected ;select the target 525 526 00000618: 86830000 00000010 jump REL(r_w_command_phase), when not MSG_OUT ;jump to command when not 527 ;message out phase, drive may not 528 ;support select w/ ATN 529 00000620: 9E030000 00000005 int error_not_msg_out_phase, when not MSG_OUT ;check for message out phase next 530 00000628: 0E000001 00000000 move 1, identify_msg_buf, when MSG_OUT ;move the message byte in 531 532 00000630: r_w_command_phase: 533 00000630: 9A030000 00000001 int error_not_cmd_phase, when not CMD ;check for command phase next 534 00000638: 60000008 00000000 clear ATN ;clear ATN when drive does not 535 ;support select w/ ATN 536 00000640: 1A000000 00000028 move FROM R_cmd_buf, when CMD ;move the command bytes out 537 538 00000648: 99030000 00000002 int error_not_data_in_phase, when not DATA_IN ;interrupt if not data in 539 00000650: init_loop_read_byte_count: 540 00000650: 19000000 00000018 move from data_buf, when DATA_IN ;move data bytes 541 542 ; used to test scatter gather - seperate data buffers 543 ; move 512, data_buf0, when DATA_IN 544 ; move 512, data_buf1, when DATA_IN ; move data bytes 545 ; move 512, data_buf2, when DATA_IN ; move data bytes 546 ; move 512, data_buf3, when DATA_IN ; move data bytes 547 548 00000658: 9B030000 00000006 int error_not_status_phase, when not STATUS ;check for status phase 549 00000660: 1B000000 00000000 move from stat_buf, when STATUS ;move the status byte in 550 551 00000668: 9F030000 00000004 int error_not_msg_in_phase, when not MSG_IN ;check for message in phase 552 00000670: 1F000000 00000008 move from msg_in_buf, when MSG_IN ;move the command complete message in 553 00000678: 98040000 00000020 int error_not_cmd_complete, if not 00 ;interrupt if not a command complete message 554 00000680: 7C027F00 00000000 move SCNTL2 & 0x7F to SCNTL2 ;clear the SCSI disconnect 555 ;unexpected bit 556 557 00000688: 60000040 00000000 clear ACK ;accept the message byte 558 559 00000690: 48000000 0000000A wait disconnect end_of_SCSI_SCRIPT ;wait for the bus free 560 561 00000698: 80880000 FFFFFEE8 jump REL(loop_write_read) ;jump to start of loop read/write 562 563 ; end Initiator loop read write SCRIPT 564 565 ;*********************************************************************** 566 ; TARGET SCRIPT 567 ; accepts Test Unit Ready, Read, Write 568 569 000006A0: target_script: 570 000006A0: 50000000 00000900 wait select alt_jump_selected ;wait for selection 571 572 000006A8: 80820000 00000010 jump REL(t_no_msg_out), if not ATN ;check for atn next 573 000006B0: 06000001 00000001 move 1, targ_ident_buf, with MSG_OUT ;move the message byte in 574 000006B8: 808C00C0 00000060 jump REL(t_allow_disconnect), if 0xc0 ;allow disconnects 575 576 000006C0: t_no_msg_out: 577 000006C0: 02000000 00000000 move 0, cmd_buf, with CMD ;move the command bytes out next 578 000006C8: 808C0000 00000030 jump REL(t_status), if 0x00 ;test unit ready command 579 000006D0: 808C0008 00000010 jump REL(t_read), if 0x08 ;read command 580 000006D8: 808C000A 00000018 jump REL(t_write), if 0x0a ;write command 581 000006E0: 80880000 00000028 jump REL(t_disconnect) ;else disconnect 582 583 000006E8: t_read: 584 000006E8: 11000000 00000018 move from data_buf, with DATA_IN ;read operation if here 585 000006F0: 80880000 00000008 jump REL(t_status) 586 587 000006F8: t_write: 588 000006F8: 10000000 00000018 move from data_buf, with DATA_OUT ;write operation if here 589 590 00000700: t_status: 591 00000700: 13000000 00000000 move from stat_buf, with STATUS ;move the status byte in 592 593 00000708: 17000000 00000008 move from msg_in_buf, with MSG_IN ;move the command complete message in 594 595 00000710: t_disconnect: 596 00000710: 48000000 00000000 disconnect 597 598 00000718: 80880000 FFFFFF80 jump REL(target_script) ;loop back for another round of targeting 599 600 00000720: t_allow_disconnect: 601 00000720: 02000000 00000000 move 0, cmd_buf, with CMD ;move the command bytes out next 602 00000728: 07000002 00000016 move 2, disconnect_msg_in_buf, with MSG_IN ;move save data pointers 603 ; & disconnect message 604 00000730: 48000000 00000000 disconnect 605 606 ;*********************************************************************** 607 ; TARGET RESELECT SCRIPT 608 609 00000738: target_reselect: 610 00000738: 40070000 00000900 reselect 7, alt_jump_selected 611 00000740: 07000001 00000000 move 1, identify_msg_buf, with MSG_IN ;move the identify message byte 612 ; to the initiator for implied 613 ; restore data pointers 614 00000748: 808C000A FFFFFFA8 jump REL(t_write), if 0x0A ;write disconnect 615 00000750: 808C0008 FFFFFF90 jump REL(t_read), if 0x08 ;read disconnect 616 00000758: 98080000 000000BB int 0xBB 617 618 ;********************************************************************** 619 ; autoswitching experiment select while initiator WAIT RESELECT 620 00000760: autoswitch: 621 00000760: 60000200 00000000 clear TARGET 622 00000768: 41000000 00000900 select ATN SCSI_id, alt_jump_selected 623 ; jump REL(switch_to_init_test) 624 00000770: 98080000 00000077 int 0x77 625 ;*********************************************************************** 626 627 628 ;*********************************************************************** 629 ; INITIATOR WRITE SCRIPT w/ DISCONNECT 630 631 00000778: init_write_read_disconnect: 632 00000778: 41000000 00000898 select ATN SCSI_id, initiator_reselect ;select the target 633 634 00000780: 86830000 00000008 jump REL(i_d_cmd), when not MSG_OUT ;check for message out phase 635 00000788: 0E000001 00000002 move 1, ident_with_disc, when MSG_OUT ;move the message byte in 636 637 00000790: i_d_cmd: 638 00000790: 9A030000 00000001 int error_not_cmd_phase, when not CMD ;check for command phase next 639 00000798: 1A000000 00000020 move FROM W_cmd_buf, when CMD ;move the command bytes out next 640 641 000007A0: 878B0000 000000A0 jump REL(check_for_disconnect), when MSG_IN ;check for disconnect 642 000007A8: 808A0000 00000030 jump REL(i_d_write_reconnect), if DATA_OUT 643 000007B0: 818A0000 00000008 jump REL(i_d_read_reconnect), if DATA_IN 644 000007B8: 98080000 00000010 int 0x10 645 646 000007C0: i_d_read_reconnect: 647 000007C0: 19000000 00000018 move from data_buf, when DATA_IN ;move data 648 000007C8: 838B0000 00000030 jump REL(i_d_status), when STATUS 649 000007D0: 878A0000 00000070 jump REL(check_for_disconnect), if MSG_IN 650 000007D8: 98080000 00000020 int 0x20 ;int on disconnect after data 651 ;transfer 652 000007E0: i_d_write_reconnect: 653 000007E0: 18000000 00000018 move from data_buf, when DATA_OUT ;move data bytes 654 000007E8: 838B0000 00000010 jump REL(i_d_status), when STATUS 655 000007F0: 878A0000 00000050 jump REL(check_for_disconnect), if MSG_IN 656 000007F8: 98080000 00000030 int 0x30 ;int on disconnect after data 657 ;transfer 658 00000800: i_d_status: 659 00000800: 9B030000 00000006 int error_not_status_phase, when not STATUS ;check for status phase 660 00000808: 1B000000 00000000 move from stat_buf, when STATUS ;move the status byte in 661 662 00000810: 9F030000 00000004 int error_not_msg_in_phase, when not MSG_IN ;check for message in phase 663 00000818: 1F000000 00000008 move from msg_in_buf, when MSG_IN ;move the command complete message in 664 00000820: 98040000 00000020 int error_not_cmd_complete, if not 00 ;interrupt if not a command complete 665 00000828: 7C027F00 00000000 move SCNTL2 & 0x7F to SCNTL2 ;clear the SCSI disconnect 666 ;unexpected bit 667 668 00000830: 60000040 00000000 clear ACK ;accept the message byte 669 670 00000838: 48000000 0000000A wait disconnect end_of_SCSI_SCRIPT ;wait for the bus free 671 672 00000840: 98080000 0000000A int end_of_SCSI_SCRIPT ;interrupt end SCSI I/O 673 674 00000848: check_for_disconnect: 675 00000848: 9F020000 00000040 int 0x40, if not MSG_IN ;interrupt when not MSG_IN 676 00000850: 0F000001 00000016 move 1, disconnect_msg_in_buf, when MSG_IN ;move 1st message in 677 00000858: 808C0004 00000020 jump REL(initiator_disconnect), if 0x04 ;disconnect if disconnect message 678 00000860: 60000040 00000000 clear ack 679 00000868: 9F030000 00000004 int error_not_msg_in_phase, when not MSG_IN 680 00000870: 0F000001 00000017 move 1, disconnect_msg_in_buf+1, when MSG_IN ;move 2nd message in 681 00000878: 98040004 00000044 int 0x44, if not 0x04 682 683 00000880: initiator_disconnect: 684 00000880: 7C027F00 00000000 move SCNTL2 & 0x7F to SCNTL2 ;clear the SCSI disconnect 685 ;unexpected bit 686 687 00000888: 60000040 00000000 clear ACK ;accept the message byte 688 00000890: 48000000 0000000A wait disconnect end_of_SCSI_SCRIPT ;wait for the bus free 689 690 00000898: initiator_reselect: 691 00000898: 50000000 00000908 wait reselect init_select_test ;wait for reselect 692 000008A0: 838B0000 FFFFFF58 jump REL(i_d_status), when STATUS 693 000008A8: 818A0000 FFFFFF10 jump REL(i_d_read_reconnect), if DATA_IN 694 000008B0: 808A0000 FFFFFF28 jump REL(i_d_write_reconnect), if DATA_OUT 695 000008B8: 9F020000 00000004 int error_not_msg_in_phase, if not MSG_IN ;check for message in phase 696 000008C0: msg_in_reconnect: 697 000008C0: 1F000000 00000008 move from msg_in_buf, when MSG_IN ;move the message in 698 000008C8: 60000040 00000000 clear ACK ;accept the message byte 699 000008D0: 878B0000 FFFFFFE8 jump REL(msg_in_reconnect), when MSG_IN 700 000008D8: 838A0000 FFFFFF20 jump REL(i_d_status), if STATUS 701 000008E0: 818A0000 FFFFFED8 jump REL(i_d_read_reconnect), if DATA_IN 702 000008E8: 808A0000 FFFFFEF0 jump REL(i_d_write_reconnect), if DATA_OUT 703 000008F0: 98080000 00000007 int error_unexpected_phase 704 705 706 ; end Initiator Write SCRIPT 707 708 ;********************************************************* 709 ;interrupt if it took the alternate jump 710 711 000008F8: alt_jump_reselected: 712 000008F8: 98080000 00000080 int reselected_interrupt 713 714 00000900: alt_jump_selected: 715 00000900: 98080000 00000081 int selected_interrupt 716 00000908: init_select_test: 717 00000908: 98080000 00000082 int 0x82 718 ;end of code 719 --SYMBOL---------------------------VALUE------TYPE------- end_of_SCSI_SCRIPT 0000000A ABSOLUTE error_not_cmd_complete 00000020 ABSOLUTE error_jump_not_taken 00000010 ABSOLUTE error_not_data_in_phase 00000002 ABSOLUTE error_not_cmd_phase 00000001 ABSOLUTE error_not_data_out_phase 00000003 ABSOLUTE error_not_extended_msg 00000021 ABSOLUTE error_not_msg_in_phase 00000004 ABSOLUTE error_not_msg_out_phase 00000005 ABSOLUTE error_not_status_phase 00000006 ABSOLUTE error_unexpected_phase 00000007 ABSOLUTE reselected_interrupt 00000080 ABSOLUTE SCSI_id 00000000 ABSOLUTE selected_interrupt 00000081 ABSOLUTE synch_xfer_interrupt 00000888 ABSOLUTE read_capacity 000001D8 CODE SEGMENT request_sense 00000308 CODE SEGMENT SCRIPT 00000000 CODE SEGMENT rel_data1 00000000 DATA SEGMENT rel_data2 00000000 DATA SEGMENT table_indirect 0000000B DATA SEGMENT i_d_read_reconnect 000007C0 ENTRY i_d_write_reconnect 000007E0 ENTRY init_loop_read_byte_count 00000650 ENTRY init_loop_write_byte_count 000005C8 ENTRY init_read_byte_count 0000049C ENTRY init_select_test 00000908 ENTRY init_write_byte_count 00000538 ENTRY init_write_read_disconnect 00000778 ENTRY initiator_read 00000450 ENTRY initiator_reselect 00000898 ENTRY initiator_synchronous 00000398 ENTRY initiator_write 000004EC ENTRY inquiry 0000026C ENTRY loop_read_select 00000610 ENTRY loop_write_read 00000588 ENTRY target_reselect 00000738 ENTRY target_script 000006A0 ENTRY test_unit_ready 00000134 ENTRY to_decisions 00000420 ENTRY cmd_buf 00000000 EXTERNAL. inquiry_buf 00000000 EXTERNAL. inquiry_cmd 00000000 EXTERNAL. read_cap_buf 00000000 EXTERNAL. read_cap_cmd 00000000 EXTERNAL. read_cmd 00000000 EXTERNAL. request_sense_buf 00000000 EXTERNAL. tur_cmd 00000000 EXTERNAL. unused_buf 00000000 EXTERNAL. write_cmd 00000000 EXTERNAL. alt_jump_selected 00000900 LABEL alt_jump_reselected 000008F8 LABEL autoswitch 00000760 LABEL check_for_disconnect 00000848 LABEL i_d_cmd 00000790 LABEL i_d_status 00000800 LABEL init_read_cmd_phase 00000470 LABEL init_read_data_in_phase 00000494 LABEL init_read_status_phase 000004A4 LABEL init_synch_cmd_phase 000003C8 LABEL init_synch_id_msg 000003B8 LABEL init_synch_msg_in_phase 000003E0 LABEL init_write_command_phase 0000050C LABEL init_write_data_out_phase 00000530 LABEL initiator_disconnect 00000880 LABEL inq_command_phase 0000028C LABEL msg_in_reconnect 000008C0 LABEL r_w_command_phase 00000630 LABEL read_cap_cmd_phase 000001F0 LABEL req_sense_after_tur 000000A4 LABEL req_sense_command_phase 00000328 LABEL req_sense_command_phase_tur 000000C4 LABEL t_disconnect 00000710 LABEL t_allow_disconnect 00000720 LABEL t_no_msg_out 000006C0 LABEL t_read 000006E8 LABEL t_status 00000700 LABEL t_write 000006F8 LABEL test_unit_ready_and_req_sense 00000000 LABEL tur_command 0000014C LABEL tur_command_req_sense 00000018 LABEL tur_decisions 000001B8 LABEL tur_decisions_req_sense 00000084 LABEL tur_msg_out 00000144 LABEL tur_msg_out_req_sense 00000010 LABEL w_r_command_phase 000005A8 LABEL disconnect_msg_in_buf 00000016 RELATIVE. dummy_buf 0000000D RELATIVE. ident_with_disc 00000002 RELATIVE. identify_msg_buf 00000000 RELATIVE. r2 00000003 RELATIVE. r1 00000000 RELATIVE. r3 00000007 RELATIVE. synch_msgi_buf 00000008 RELATIVE. synch_msgo_buf 00000003 RELATIVE. targ_ident_buf 00000001 RELATIVE. bogus_buf 00000010 TABLE data_buf 00000018 TABLE dum_buf 00000040 TABLE ident_and_synch_msg_buf 00000038 TABLE msg_in_buf 00000008 TABLE R_cmd_buf 00000028 TABLE req_sense_cmd_buf 00000030 TABLE stat_buf 00000000 TABLE W_cmd_buf 00000020 TABLE