📄 53c7xx.scr
字号:
; 3 debugging interrupt; 4 testing interrupt ; Next byte indicates specific error; XXX not yet implemented, I'm not sure if I want to - ; Next byte indicates the routine the error occurred in; The LSB indicates the specific place the error occurred ABSOLUTE int_err_unexpected_phase = 0x00000000 ; Unexpected phase encounteredABSOLUTE int_err_selected = 0x00010000 ; SELECTED (nee RESELECTED)ABSOLUTE int_err_unexpected_reselect = 0x00020000 ABSOLUTE int_err_check_condition = 0x00030000 ABSOLUTE int_err_no_phase = 0x00040000ABSOLUTE int_msg_wdtr = 0x01000000 ; WDTR message receivedABSOLUTE int_msg_sdtr = 0x01010000 ; SDTR receivedABSOLUTE int_msg_1 = 0x01020000 ; single byte special message ; receivedABSOLUTE int_norm_select_complete = 0x02000000 ; Select complete, reprogram ; registers.ABSOLUTE int_norm_reselect_complete = 0x02010000 ; Nexus establishedABSOLUTE int_norm_command_complete = 0x02020000 ; Command completeABSOLUTE int_norm_disconnected = 0x02030000 ; Disconnected ABSOLUTE int_norm_aborted =0x02040000 ; Aborted *dsaABSOLUTE int_norm_reset = 0x02050000 ; Generated BUS reset.ABSOLUTE int_norm_emulateintfly = 0x02060000 ; 53C710 Emulated intflyABSOLUTE int_debug_break = 0x03000000 ; Break point#ifdef DEBUGABSOLUTE int_debug_scheduled = 0x03010000 ; new I/O scheduled ABSOLUTE int_debug_idle = 0x03020000 ; scheduler is idleABSOLUTE int_debug_dsa_loaded = 0x03030000 ; dsa reloadedABSOLUTE int_debug_reselected = 0x03040000 ; NCR reselectedABSOLUTE int_debug_head = 0x03050000 ; issue head overwrittenABSOLUTE int_debug_disconnected = 0x03060000 ; disconnectedABSOLUTE int_debug_disconnect_msg = 0x03070000 ; got message to disconnectABSOLUTE int_debug_dsa_schedule = 0x03080000 ; in dsa_scheduleABSOLUTE int_debug_reselect_check = 0x03090000 ; Check for reselection of DSAABSOLUTE int_debug_reselected_ok = 0x030a0000 ; Reselection accepted#endifABSOLUTE int_debug_panic = 0x030b0000 ; Panic driver#ifdef DEBUGABSOLUTE int_debug_saved = 0x030c0000 ; save/restore pointersABSOLUTE int_debug_restored = 0x030d0000ABSOLUTE int_debug_sync = 0x030e0000 ; Sanity check synchronous ; parameters. ABSOLUTE int_debug_datain = 0x030f0000 ; going into data in phase ; now.ABSOLUTE int_debug_check_dsa = 0x03100000 ; Sanity check DSA against ; SDID.#endifABSOLUTE int_test_1 = 0x04000000 ; Test 1 completeABSOLUTE int_test_2 = 0x04010000 ; Test 2 completeABSOLUTE int_test_3 = 0x04020000 ; Test 3 complete; These should start with 0x05000000, with low bits incrementing for ; each one.#ifdef EVENTSABSOLUTE int_EVENT_SELECT = 0ABSOLUTE int_EVENT_DISCONNECT = 0ABSOLUTE int_EVENT_RESELECT = 0ABSOLUTE int_EVENT_COMPLETE = 0ABSOLUTE int_EVENT_IDLE = 0ABSOLUTE int_EVENT_SELECT_FAILED = 0ABSOLUTE int_EVENT_BEFORE_SELECT = 0ABSOLUTE int_EVENT_RESELECT_FAILED = 0#endif ABSOLUTE NCR53c7xx_msg_abort = 0 ; Pointer to abort messageABSOLUTE NCR53c7xx_msg_reject = 0 ; Pointer to reject messageABSOLUTE NCR53c7xx_zero = 0 ; long with zero in it, use for sourceABSOLUTE NCR53c7xx_sink = 0 ; long to dump worthless data inABSOLUTE NOP_insn = 0 ; NOP instruction; Pointer to message, potentially multi-byteABSOLUTE msg_buf = 0; Pointer to holding area for reselection informationABSOLUTE reselected_identify = 0ABSOLUTE reselected_tag = 0; Request sense command pointer, it's a 6 byte command, should; be constant for all commands since we always want 16 bytes of ; sense and we don't need to change any fields as we did under ; SCSI-I when we actually cared about the LUN field.;EXTERNAL NCR53c7xx_sense ; Request sense command#if (CHIP != 700) && (CHIP != 70066); dsa_schedule ; PURPOSE : after a DISCONNECT message has been received, and pointers; saved, insert the current DSA structure at the head of the ; disconnected queue and fall through to the scheduler.;; CALLS : OK;; INPUTS : dsa - current DSA structure, reconnect_dsa_head - list; of disconnected commands;; MODIFIES : SCRATCH, reconnect_dsa_head; ; EXITS : always passes control to scheduleENTRY dsa_scheduledsa_schedule:#ifdef DEBUG INT int_debug_dsa_schedule#endif;; Calculate the address of the next pointer within the DSA ; structure of the command that is currently disconnecting;#if (CHIP == 710) ; Read what should be the current DSA from memory - actual DSA ; register is probably corrupt MOVE MEMORY 4, saved_dsa, addr_scratch#else CALL dsa_to_scratch#endif MOVE SCRATCH0 + dsa_next TO SCRATCH0 MOVE SCRATCH1 + 0 TO SCRATCH1 WITH CARRY MOVE SCRATCH2 + 0 TO SCRATCH2 WITH CARRY MOVE SCRATCH3 + 0 TO SCRATCH3 WITH CARRY; Point the next field of this DSA structure at the current disconnected ; list DMODE_NCR_TO_MEMORY MOVE MEMORY 4, addr_scratch, dsa_schedule_insert + 8 DMODE_MEMORY_TO_MEMORYdsa_schedule_insert: MOVE MEMORY 4, reconnect_dsa_head, 0 ; And update the head pointer.#if (CHIP == 710) ; Read what should be the current DSA from memory - actual DSA ; register is probably corrupt MOVE MEMORY 4, saved_dsa, addr_scratch#else CALL dsa_to_scratch#endif DMODE_NCR_TO_MEMORY MOVE MEMORY 4, addr_scratch, reconnect_dsa_head DMODE_MEMORY_TO_MEMORY/* Temporarily, see what happens. */#ifndef ORIGINAL#if (CHIP != 710) MOVE SCNTL2 & 0x7f TO SCNTL2#endif CLEAR ACK#endif#if (CHIP == 710) ; Time to correct DSA following memory move MOVE MEMORY 4, saved_dsa, addr_dsa#endif WAIT DISCONNECT#ifdef EVENTS INT int_EVENT_DISCONNECT;#endif#ifdef DEBUG INT int_debug_disconnected#endif JUMP schedule#endif ;; select;; PURPOSE : establish a nexus for the SCSI command referenced by DSA.; On success, the current DSA structure is removed from the issue ; queue. Usually, this is entered as a fall-through from schedule,; although the contingent allegiance handling code will write; the select entry address to the DSP to restart a command as a ; REQUEST SENSE. A message is sent (usually IDENTIFY, although; additional SDTR or WDTR messages may be sent). COMMAND OUT; is handled.;; INPUTS : DSA - SCSI command, issue_dsa_head;; CALLS : NOT OK;; MODIFIES : SCRATCH, issue_dsa_head;; EXITS : on reselection or selection, go to select_failed; otherwise, RETURN so control is passed back to ; dsa_begin.;ENTRY selectselect:#ifdef EVENTS INT int_EVENT_BEFORE_SELECT#endif#ifdef DEBUG INT int_debug_scheduled#endif CLEAR TARGET; XXX;; In effect, SELECTION operations are backgrounded, with execution; continuing until code which waits for REQ or a fatal interrupt is ; encountered.;; So, for more performance, we could overlap the code which removes ; the command from the NCRs issue queue with the selection, but ; at this point I don't want to deal with the error recovery.;#if (CHIP != 700) && (CHIP != 70066)#if (CHIP == 710) ; Enable selection timer#ifdef NO_SELECTION_TIMEOUT MOVE CTEST7 & 0xff TO CTEST7#else MOVE CTEST7 & 0xef TO CTEST7#endif#endif SELECT ATN FROM dsa_select, select_failed JUMP select_msgout, WHEN MSG_OUTENTRY select_msgoutselect_msgout:#if (CHIP == 710) ; Disable selection timer MOVE CTEST7 | 0x10 TO CTEST7#endif MOVE FROM dsa_msgout, WHEN MSG_OUT#elseENTRY select_msgout SELECT ATN 0, select_failedselect_msgout: MOVE 0, 0, WHEN MSGOUT#endif#ifdef EVENTS INT int_EVENT_SELECT#endif RETURN; ; select_done; ; PURPOSE: continue on to normal data transfer; called as the exit ; point from dsa_begin.;; INPUTS: dsa;; CALLS: OK;;select_done:#if (CHIP == 710); NOTE DSA is corrupt when we arrive here! MOVE MEMORY 4, saved_dsa, addr_dsa#endif#ifdef DEBUGENTRY select_check_dsaselect_check_dsa: INT int_debug_check_dsa#endif; After a successful selection, we should get either a CMD phase or ; some transfer request negotiation message. JUMP cmdout, WHEN CMD INT int_err_unexpected_phase, WHEN NOT MSG_IN select_msg_in: CALL msg_in, WHEN MSG_IN JUMP select_msg_in, WHEN MSG_INcmdout: INT int_err_unexpected_phase, WHEN NOT CMD#if (CHIP == 700) INT int_norm_selected#endifENTRY cmdout_cmdoutcmdout_cmdout:#if (CHIP != 700) && (CHIP != 70066) MOVE FROM dsa_cmdout, WHEN CMD#else MOVE 0, 0, WHEN CMD#endif /* (CHIP != 700) && (CHIP != 70066) */;; data_transfer ; other_out; other_in; other_transfer;; PURPOSE : handle the main data transfer for a SCSI command in ; several parts. In the first part, data_transfer, DATA_IN; and DATA_OUT phases are allowed, with the user provided; code (usually dynamically generated based on the scatter/gather; list associated with a SCSI command) called to handle these ; phases.;; After control has passed to one of the user provided ; DATA_IN or DATA_OUT routines, back calls are made to ; other_transfer_in or other_transfer_out to handle non-DATA IN; and DATA OUT phases respectively, with the state of the active; data pointer being preserved in TEMP.;; On completion, the user code passes control to other_transfer; which causes DATA_IN and DATA_OUT to result in unexpected_phase; interrupts so that data overruns may be trapped.;; INPUTS : DSA - SCSI command;; CALLS : OK in data_transfer_start, not ok in other_out and other_in, ok in; other_transfer;; MODIFIES : SCRATCH;; EXITS : if STATUS IN is detected, signifying command completion,; the NCR jumps to command_complete. If MSG IN occurs, a ; CALL is made to msg_in. Otherwise, other_transfer runs in ; an infinite loop.; ENTRY data_transferdata_transfer: JUMP cmdout_cmdout, WHEN CMD CALL msg_in, WHEN MSG_IN INT int_err_unexpected_phase, WHEN MSG_OUT JUMP do_dataout, WHEN DATA_OUT JUMP do_datain, WHEN DATA_IN JUMP command_complete, WHEN STATUS JUMP data_transferENTRY end_data_transferend_data_transfer:;; FIXME: On NCR53c700 and NCR53c700-66 chips, do_dataout/do_datain ; should be fixed up whenever the nexus changes so it can point to the ; correct routine for that command.;#if (CHIP != 700) && (CHIP != 70066); Nasty jump to dsa->dataoutdo_dataout:#if (CHIP == 710) MOVE MEMORY 4, saved_dsa, addr_scratch#else CALL dsa_to_scratch#endif MOVE SCRATCH0 + dsa_dataout TO SCRATCH0 MOVE SCRATCH1 + 0 TO SCRATCH1 WITH CARRY MOVE SCRATCH2 + 0 TO SCRATCH2 WITH CARRY MOVE SCRATCH3 + 0 TO SCRATCH3 WITH CARRY DMODE_NCR_TO_MEMORY MOVE MEMORY 4, addr_scratch, dataout_to_jump + 4 DMODE_MEMORY_TO_MEMORYdataout_to_jump: MOVE MEMORY 4, 0, dataout_jump + 4 #if (CHIP == 710) ; Time to correct DSA following memory move MOVE MEMORY 4, saved_dsa, addr_dsa#endifdataout_jump: JUMP 0; Nasty jump to dsa->dsaindo_datain:#if (CHIP == 710) MOVE MEMORY 4, saved_dsa, addr_scratch#else CALL dsa_to_scratch#endif MOVE SCRATCH0 + dsa_datain TO SCRATCH0 MOVE SCRATCH1 + 0 TO SCRATCH1 WITH CARRY MOVE SCRATCH2 + 0 TO SCRATCH2 WITH CARRY MOVE SCRATCH3 + 0 TO SCRATCH3 WITH CARRY DMODE_NCR_TO_MEMORY MOVE MEMORY 4, addr_scratch, datain_to_jump + 4 DMODE_MEMORY_TO_MEMORYENTRY datain_to_jumpdatain_to_jump: MOVE MEMORY 4, 0, datain_jump + 4#if (CHIP == 710) ; Time to correct DSA following memory move MOVE MEMORY 4, saved_dsa, addr_dsa#endif#ifdef DEBUG INT int_debug_datain#endifdatain_jump: JUMP 0#endif /* (CHIP != 700) && (CHIP != 70066) */; Note that other_out and other_in loop until a non-data phase; is discovered, so we only execute return statements when we
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -