6 ; Interrupt codes used to signal driver from SCRIPTS
8 ABSOLUTE status_ready = 0x10 ; idle loop interrupted by driver
9 ABSOLUTE status_reselected = 0x11 ; select or idle interrupted by reselection
10 ABSOLUTE status_timeout = 0x12 ; select timed out
11 ABSOLUTE status_selected = 0x13 ; select succeeded
12 ABSOLUTE status_complete = 0x14 ; transaction completed
13 ABSOLUTE status_disconnect = 0x15 ; device disconnected in the middle
14 ABSOLUTE status_badstatus = 0x16 ; snafu in the status phase
15 ABSOLUTE status_overrun = 0x17 ; data overrun occurred
16 ABSOLUTE status_underrun = 0x18 ; data underrun occurred
17 ABSOLUTE status_badphase = 0x19 ; weird phase transition occurred
18 ABSOLUTE status_badmsg = 0x1a ; bad msg received
19 ABSOLUTE status_badextmsg = 0x1b ; bad extended msg received
20 ABSOLUTE status_selftest = 0x1c ; used by selftest stub
21 ABSOLUTE status_iocomplete = 0x1d ; used by driver
22 ABSOLUTE status_syncin = 0x1e ; inbound sync msg
23 ABSOLUTE status_widein = 0x1f ; inbound wdtr msg
24 ABSOLUTE status_ignore_residue = 0x20 ; ignore wide residue bytes
26 ; DSA-offset data table
28 ABSOLUTE ctxt_device = 0x00 ; targ id, sync params, etc
29 ABSOLUTE ctxt_sendmsg = 0x08 ; outgoing (ID) msg(1) pointer
30 ABSOLUTE ctxt_recvmsg = 0x10 ; incoming msg(1) pointer
31 ABSOLUTE ctxt_extdmsg = 0x18 ; extdmsg(1) pointer
32 ABSOLUTE ctxt_syncmsg = 0x20 ; sync(2) pointer
33 ABSOLUTE ctxt_status = 0x28 ; status(1) pointer
34 ABSOLUTE ctxt_command = 0x30 ; command(6,10,12) pointer
35 ABSOLUTE ctxt_widemsg = 0x38 ; wide(2) pointer
47 ; ------------------------------------------------------------------------------------
48 ; Idle loop -- when no new requests are pending wait for a reselect
49 ; or interrupt from the driver
52 WAIT RESELECT interrupted
56 MOVE CTEST2 TO SFBR ; read sigp to clear it
60 ; ------------------------------------------------------------------------------------
61 ; Driver must load DSA and jump here to attempt to select a target, beginning a new
62 ; transaction. Interrupt will indicate success, timeout, or reselection
65 SELECT ATN FROM ctxt_device, resel ; try to select the dev for the req
66 JUMP selected, WHEN MSG_OUT ; force wait for timeout
76 ; ------------------------------------------------------------------------------------
77 ; If we're entering the main dispatcher after a reselection, we must insure that
78 ; the registers for SYNC/WIDE transfers are properly loaded. This is the solution
79 ; suggested in 9-18 of the Symbios programming guide.
82 SELECT FROM ctxt_device, switch ; force the load of SXFER/SCNTL3, etc
84 ; ------------------------------------------------------------------------------------
85 ; Main activity entry -- driver must set DSA and patch do_datain and do_dataout
86 ; before starting this dispatch function.
89 JUMP phase_msgin, WHEN MSG_IN
90 JUMP phase_msgout, IF MSG_OUT
91 JUMP phase_command, IF CMD
92 do_datain: ; Patched by driver
93 JUMP phase_dataerr, IF DATA_IN
94 do_dataout: ; Patched by driver
95 JUMP phase_dataerr, IF DATA_OUT
96 JUMP phase_status, IF STATUS
100 MOVE FROM ctxt_recvmsg, WHEN MSG_IN
101 JUMP phase_msgin_ext, IF 0x01
103 JUMP ignore, IF 0x23 ; /* wide ignore residue */
105 JUMP switch, IF 0x02 ; ignore save data pointers
106 JUMP switch, IF 0x07 ; ignore message reject :)
107 JUMP switch, IF 0x03 ; ignore restore data pointers
108 JUMP switch, IF 0x80 ; ignore ident after reselect
109 JUMP switch, IF 0x81 ; ignore ident after reselect
110 JUMP switch, IF 0x82 ; ignore ident after reselect
111 JUMP switch, IF 0x83 ; ignore ident after reselect
112 JUMP switch, IF 0x84 ; ignore ident after reselect
113 JUMP switch, IF 0x85 ; ignore ident after reselect
114 JUMP switch, IF 0x86 ; ignore ident after reselect
115 JUMP switch, IF 0x87 ; ignore ident after reselect
116 JUMP switch, IF 0xC0 ; ignore ident after reselect
117 JUMP switch, IF 0xC1 ; ignore ident after reselect
118 JUMP switch, IF 0xC2 ; ignore ident after reselect
119 JUMP switch, IF 0xC3 ; ignore ident after reselect
120 JUMP switch, IF 0xC4 ; ignore ident after reselect
121 JUMP switch, IF 0xC5 ; ignore ident after reselect
122 JUMP switch, IF 0xC6 ; ignore ident after reselect
123 JUMP switch, IF 0xC7 ; ignore ident after reselect
128 MOVE FROM ctxt_extdmsg, WHEN MSG_IN ; read status byte
131 ; INT status_ignore_residue
135 MOVE FROM ctxt_extdmsg, WHEN MSG_IN ; read extended message length
136 JUMP phase_msgin_sync, IF 0x03
137 JUMP phase_msgin_wide, IF 0x02
142 MOVE FROM ctxt_widemsg, WHEN MSG_IN
148 MOVE FROM ctxt_syncmsg, WHEN MSG_IN
153 MOVE FROM ctxt_sendmsg, WHEN MSG_OUT
157 MOVE FROM ctxt_command, WHEN CMD
164 MOVE FROM ctxt_status, WHEN STATUS
165 INT status_badstatus, WHEN NOT MSG_IN
166 MOVE FROM ctxt_recvmsg, WHEN MSG_IN
167 INT status_badmsg, IF NOT 0x00 ; not disconnect?!
168 MOVE SCNTL2 & 0x7f TO SCNTL2
174 MOVE SCNTL2 & 0x7f to SCNTL2 ; expect disconnect
177 INT status_disconnect
179 ; ------------------------------------------------------------------------------------