1*0Sstevel@tonic-gate; 2*0Sstevel@tonic-gate; Copyright 2005 Sun Microsystems, Inc. All rights reserved. 3*0Sstevel@tonic-gate; Use is subject to license terms. 4*0Sstevel@tonic-gate; 5*0Sstevel@tonic-gate; CDDL HEADER START 6*0Sstevel@tonic-gate; 7*0Sstevel@tonic-gate; The contents of this file are subject to the terms of the 8*0Sstevel@tonic-gate; Common Development and Distribution License, Version 1.0 only 9*0Sstevel@tonic-gate; (the "License"). You may not use this file except in compliance 10*0Sstevel@tonic-gate; with the License. 11*0Sstevel@tonic-gate; 12*0Sstevel@tonic-gate; You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 13*0Sstevel@tonic-gate; or http://www.opensolaris.org/os/licensing. 14*0Sstevel@tonic-gate; See the License for the specific language governing permissions 15*0Sstevel@tonic-gate; and limitations under the License. 16*0Sstevel@tonic-gate; 17*0Sstevel@tonic-gate; When distributing Covered Code, include this CDDL HEADER in each 18*0Sstevel@tonic-gate; file and include the License file at usr/src/OPENSOLARIS.LICENSE. 19*0Sstevel@tonic-gate; If applicable, add the following below this CDDL HEADER, with the 20*0Sstevel@tonic-gate; fields enclosed by brackets "[]" replaced with your own identifying 21*0Sstevel@tonic-gate; information: Portions Copyright [yyyy] [name of copyright owner] 22*0Sstevel@tonic-gate; 23*0Sstevel@tonic-gate; CDDL HEADER END 24*0Sstevel@tonic-gate; 25*0Sstevel@tonic-gate; Multi-threaded general purpose script for the 26*0Sstevel@tonic-gate; Symbios 53C825/875 host bus adapter chips. 27*0Sstevel@tonic-gate; 28*0Sstevel@tonic-gate; ident "%Z%%M% %I% %E% SMI" 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate ARCH 825A 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate ABSOLUTE NBIT_ICON = 0x10 ; CON bit in SCNTL1 register 33*0Sstevel@tonic-gate 34*0Sstevel@tonic-gate; 35*0Sstevel@tonic-gate; Scatter/Gather DMA instructions for datain and dataout 36*0Sstevel@tonic-gate; 37*0Sstevel@tonic-gate ENTRY dt_do_list_end 38*0Sstevel@tonic-gate ENTRY dt_di_list_end 39*0Sstevel@tonic-gate ENTRY do_list_end 40*0Sstevel@tonic-gate ENTRY di_list_end 41*0Sstevel@tonic-gate 42*0Sstevel@tonic-gate; SCSI I/O entry points. One of these addresses must be loaded into the 43*0Sstevel@tonic-gate; DSA register to initiate SCSI I/O. 44*0Sstevel@tonic-gate 45*0Sstevel@tonic-gate ENTRY start_up 46*0Sstevel@tonic-gate ENTRY resel_m 47*0Sstevel@tonic-gate ENTRY ext_msg_out 48*0Sstevel@tonic-gate ENTRY clear_ack 49*0Sstevel@tonic-gate ENTRY continue 50*0Sstevel@tonic-gate ENTRY errmsg 51*0Sstevel@tonic-gate ENTRY abort 52*0Sstevel@tonic-gate ENTRY dev_reset 53*0Sstevel@tonic-gate ENTRY ext_msg_in 54*0Sstevel@tonic-gate ENTRY phase_mis_match 55*0Sstevel@tonic-gate 56*0Sstevel@tonic-gate;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 57*0Sstevel@tonic-gate 58*0Sstevel@tonic-gatestart_up: 59*0Sstevel@tonic-gate SELECT ATN FROM 0, REL(resel_m) 60*0Sstevel@tonic-gate 61*0Sstevel@tonic-gate; after selection, next phase should be msg_out or status 62*0Sstevel@tonic-gate INT PASS(NINT_ILI_PHASE), WHEN NOT MSG_OUT 63*0Sstevel@tonic-gate 64*0Sstevel@tonic-gatemsgout: 65*0Sstevel@tonic-gate MOVE FROM PASS(NTOFFSET(nt_sendmsg)), WHEN MSG_OUT 66*0Sstevel@tonic-gate JUMP REL(command_phase), WHEN CMD 67*0Sstevel@tonic-gate JUMP REL(switch), WHEN NOT MSG_OUT 68*0Sstevel@tonic-gate; target requested repeat, set atn in case it's an extended msg 69*0Sstevel@tonic-gate SET ATN 70*0Sstevel@tonic-gate JUMP REL(msgout) 71*0Sstevel@tonic-gate 72*0Sstevel@tonic-gate 73*0Sstevel@tonic-gate;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 74*0Sstevel@tonic-gate 75*0Sstevel@tonic-gate; The sync (SDTR) message interrupt handler restarts here if the 76*0Sstevel@tonic-gate; initiator and target have both succesfully exchanged SDTR messages. 77*0Sstevel@tonic-gate 78*0Sstevel@tonic-gateclear_ack: 79*0Sstevel@tonic-gate CLEAR ACK 80*0Sstevel@tonic-gate JUMP REL(switch) 81*0Sstevel@tonic-gate 82*0Sstevel@tonic-gate 83*0Sstevel@tonic-gate;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 84*0Sstevel@tonic-gate 85*0Sstevel@tonic-gate; Restart here after phase mismatch interrupt, clear ATN in case the 86*0Sstevel@tonic-gate; interrupt occurred during the msg_out phase. 87*0Sstevel@tonic-gate 88*0Sstevel@tonic-gatecontinue: 89*0Sstevel@tonic-gate CLEAR ATN 90*0Sstevel@tonic-gate JUMP REL(switch) 91*0Sstevel@tonic-gate 92*0Sstevel@tonic-gate 93*0Sstevel@tonic-gate;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 94*0Sstevel@tonic-gate 95*0Sstevel@tonic-gate; Send error message to the target. Usually the target will change 96*0Sstevel@tonic-gate; phase immediately. But if in data in or data out phase, or part 97*0Sstevel@tonic-gate; way through a command or message in the phase change will happen 98*0Sstevel@tonic-gate; at the end of the current phase. 99*0Sstevel@tonic-gate 100*0Sstevel@tonic-gateerrmsg: 101*0Sstevel@tonic-gate SET ATN 102*0Sstevel@tonic-gate CLEAR ACK 103*0Sstevel@tonic-gate JUMP REL(errmsg_out), WHEN MSG_OUT 104*0Sstevel@tonic-gate; not message out phase, the target will change phase later 105*0Sstevel@tonic-gate JUMP REL(switch) 106*0Sstevel@tonic-gate 107*0Sstevel@tonic-gateerrmsg_out: 108*0Sstevel@tonic-gate MOVE FROM PASS(NTOFFSET(nt_errmsg)), WHEN MSG_OUT 109*0Sstevel@tonic-gate JUMP REL(switch) , WHEN NOT MSG_OUT 110*0Sstevel@tonic-gate; target requested repeat 111*0Sstevel@tonic-gate JUMP REL(errmsg_out) 112*0Sstevel@tonic-gate 113*0Sstevel@tonic-gate 114*0Sstevel@tonic-gate;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 115*0Sstevel@tonic-gate 116*0Sstevel@tonic-gate; Send an abort message to a target that's attempting an invalid 117*0Sstevel@tonic-gate; reconnection. 118*0Sstevel@tonic-gate 119*0Sstevel@tonic-gateabort: 120*0Sstevel@tonic-gate SET ATN 121*0Sstevel@tonic-gate CLEAR ACK 122*0Sstevel@tonic-gate INT PASS(NINT_ILI_PHASE), WHEN NOT MSG_OUT 123*0Sstevel@tonic-gate 124*0Sstevel@tonic-gateabort_out: 125*0Sstevel@tonic-gate MOVE FROM PASS(NTOFFSET(nt_errmsg)), WHEN MSG_OUT 126*0Sstevel@tonic-gate JUMP REL(abort_done), WHEN NOT MSG_OUT 127*0Sstevel@tonic-gate SET ATN 128*0Sstevel@tonic-gate JUMP REL(abort_out) 129*0Sstevel@tonic-gate 130*0Sstevel@tonic-gateabort_done: 131*0Sstevel@tonic-gate MOVE 0x00 TO SCNTL2 132*0Sstevel@tonic-gate CLEAR ACK 133*0Sstevel@tonic-gate WAIT DISCONNECT 134*0Sstevel@tonic-gate INT PASS(NINT_OK) 135*0Sstevel@tonic-gate 136*0Sstevel@tonic-gate 137*0Sstevel@tonic-gate;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 138*0Sstevel@tonic-gate 139*0Sstevel@tonic-gate; send an Abort or Bus Device Reset message and wait for the disconnect 140*0Sstevel@tonic-gate 141*0Sstevel@tonic-gatedev_reset: 142*0Sstevel@tonic-gate MOVE 0x00 TO SCNTL2 143*0Sstevel@tonic-gate SELECT ATN FROM 0, REL(resel_m) 144*0Sstevel@tonic-gate; after selection, next phase should be msg_out 145*0Sstevel@tonic-gate INT PASS(NINT_ILI_PHASE), WHEN NOT MSG_OUT 146*0Sstevel@tonic-gate 147*0Sstevel@tonic-gatedev_reset_out: 148*0Sstevel@tonic-gate MOVE FROM PASS(NTOFFSET(nt_sendmsg)), WHEN MSG_OUT 149*0Sstevel@tonic-gate CLEAR ACK 150*0Sstevel@tonic-gate MOVE SCNTL2 & 0x7F TO SCNTL2 151*0Sstevel@tonic-gate WAIT DISCONNECT 152*0Sstevel@tonic-gate INT PASS(NINT_DEV_RESET) 153*0Sstevel@tonic-gate 154*0Sstevel@tonic-gate 155*0Sstevel@tonic-gate;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 156*0Sstevel@tonic-gate 157*0Sstevel@tonic-gate; The sync (SDTR) or wide (WDTR) message interrupt handler restarts here 158*0Sstevel@tonic-gate; if the initiator needs to send an SDTR/WDTR message in response to the 159*0Sstevel@tonic-gate; target's SDTR/WDTR. 160*0Sstevel@tonic-gate; 161*0Sstevel@tonic-gate; Set the ATN signal to let target know we've got a message to send 162*0Sstevel@tonic-gate; and ack the last byte of its SDTR/WDTR message. 163*0Sstevel@tonic-gate 164*0Sstevel@tonic-gateext_msg_out: 165*0Sstevel@tonic-gate SET ATN 166*0Sstevel@tonic-gate CLEAR ACK 167*0Sstevel@tonic-gate JUMP REL(msg_out), WHEN MSG_OUT 168*0Sstevel@tonic-gate; not message out phase, assume target decided not to do sync i/o 169*0Sstevel@tonic-gate; if this doesn't work, change it to treat this as illegal phase 170*0Sstevel@tonic-gate CLEAR ATN 171*0Sstevel@tonic-gate INT PASS(NINT_NEG_REJECT) 172*0Sstevel@tonic-gate 173*0Sstevel@tonic-gatemsg_out: 174*0Sstevel@tonic-gate MOVE FROM PASS(NTOFFSET(nt_sendmsg)), WHEN MSG_OUT 175*0Sstevel@tonic-gate JUMP REL(ext_msg_out_chk), WHEN NOT MSG_OUT 176*0Sstevel@tonic-gate SET ATN ; target requested repeat 177*0Sstevel@tonic-gate JUMP REL(msg_out) 178*0Sstevel@tonic-gate 179*0Sstevel@tonic-gate 180*0Sstevel@tonic-gateext_msg_out_chk: 181*0Sstevel@tonic-gate; test whether the target accepted the SDTR message 182*0Sstevel@tonic-gate; any phase besides MSG_IN means the sdtr message is okay 183*0Sstevel@tonic-gate JUMP REL(switch), WHEN NOT MSG_IN 184*0Sstevel@tonic-gate 185*0Sstevel@tonic-gate; any message besides Message Reject means the SDTR message is okay 186*0Sstevel@tonic-gate MOVE FROM PASS(NTOFFSET(nt_rcvmsg)), WHEN MSG_IN 187*0Sstevel@tonic-gate JUMP REL(msgin2), IF NOT 0x07 ; anything else is okay 188*0Sstevel@tonic-gate 189*0Sstevel@tonic-gate; SDTR got Message Reject response 190*0Sstevel@tonic-gate MOVE 0x00 TO SXFER 191*0Sstevel@tonic-gate INT PASS(NINT_NEG_REJECT) 192*0Sstevel@tonic-gate 193*0Sstevel@tonic-gate;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 194*0Sstevel@tonic-gate 195*0Sstevel@tonic-gateresel_m: 196*0Sstevel@tonic-gate WAIT RESELECT REL(alt_sig_p) 197*0Sstevel@tonic-gate MOVE SSID SHL SFBR 198*0Sstevel@tonic-gate MOVE SFBR SHL SFBR 199*0Sstevel@tonic-gate MOVE SFBR & 0x3C TO DSA0 200*0Sstevel@tonic-gate MOVE SCRATCHB1 TO SFBR 201*0Sstevel@tonic-gate MOVE SFBR TO DSA1 202*0Sstevel@tonic-gate MOVE SCRATCHB2 TO SFBR 203*0Sstevel@tonic-gate MOVE SFBR TO DSA2 204*0Sstevel@tonic-gate MOVE SCRATCHB3 TO SFBR 205*0Sstevel@tonic-gate MOVE SFBR TO DSA3 206*0Sstevel@tonic-gate SELECT FROM 0x00, REL(Next_Inst) 207*0Sstevel@tonic-gateNext_Inst: 208*0Sstevel@tonic-gate MOVE 0x00 TO DSA0 209*0Sstevel@tonic-gate INT PASS(NINT_MSGIN), WHEN NOT MSG_IN 210*0Sstevel@tonic-gate ; 211*0Sstevel@tonic-gate ; reselection Identify msg. 212*0Sstevel@tonic-gate ; 213*0Sstevel@tonic-gate MOVE FROM PASS(HBAOFFSET(g_rcvmsg)), WHEN MSG_IN 214*0Sstevel@tonic-gate CLEAR ACK 215*0Sstevel@tonic-gate ; 216*0Sstevel@tonic-gate ; Target will either continue in msg-in phase (tag q'ing) or 217*0Sstevel@tonic-gate ; transistion to data or status phase. 218*0Sstevel@tonic-gate ; 219*0Sstevel@tonic-gate ; non-tq case: target switched to status phase. 220*0Sstevel@tonic-gate ; 221*0Sstevel@tonic-gate INT PASS(NINT_RESEL), WHEN NOT MSG_IN ; Let UNIX driver grab it 222*0Sstevel@tonic-gate ; 223*0Sstevel@tonic-gate ; should be the 0x20 (tag msg). 224*0Sstevel@tonic-gate ; 225*0Sstevel@tonic-gate MOVE FROM PASS(HBAOFFSET(g_moremsgin)), WHEN MSG_IN 226*0Sstevel@tonic-gate ; 227*0Sstevel@tonic-gate ; if the target resel and disconnects, handle that here. 228*0Sstevel@tonic-gate JUMP REL(resel_disc), IF 0x04 229*0Sstevel@tonic-gate ; 230*0Sstevel@tonic-gate ; Check msg-in byte for 20, 21, or 22. 231*0Sstevel@tonic-gate JUMP REL(Got_tag), IF 0x20 AND MASK 0x01 232*0Sstevel@tonic-gate INT PASS(NINT_RESEL), IF NOT 0x22 ; Let UNIX driver grab it 233*0Sstevel@tonic-gateGot_tag: 234*0Sstevel@tonic-gate CLEAR ACK 235*0Sstevel@tonic-gate MOVE FROM PASS(HBAOFFSET(g_tagmsg)), WHEN MSG_IN 236*0Sstevel@tonic-gate CLEAR ACK 237*0Sstevel@tonic-gate INT PASS(NINT_RESEL) ; Let UNIX driver grab it 238*0Sstevel@tonic-gate 239*0Sstevel@tonic-gatealt_sig_p: 240*0Sstevel@tonic-gate ; The driver hit sig_p to start a new cmd. 241*0Sstevel@tonic-gate ; Test the connected bit in SCNTL1. If its set, retry the 242*0Sstevel@tonic-gate ; wait reselect. Otherwise, let the driver start a new cmd. 243*0Sstevel@tonic-gate MOVE CTEST2 TO SFBR ; clear sig_p bit, if set 244*0Sstevel@tonic-gate MOVE SCNTL1 & NBIT_ICON TO SFBR ; test the connected bit 245*0Sstevel@tonic-gate 246*0Sstevel@tonic-gate ; Interrupt if not connected. 247*0Sstevel@tonic-gate INT PASS(NINT_SIGPROC), IF NOT NBIT_ICON 248*0Sstevel@tonic-gate 249*0Sstevel@tonic-gate ; otherwise, handle reselection. 250*0Sstevel@tonic-gate JUMP REL(resel_m) 251*0Sstevel@tonic-gate 252*0Sstevel@tonic-gate;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 253*0Sstevel@tonic-gate 254*0Sstevel@tonic-gate; Every phase comes back to here. 255*0Sstevel@tonic-gateswitch: 256*0Sstevel@tonic-gate JUMP REL(msgin), WHEN MSG_IN 257*0Sstevel@tonic-gate JUMP REL(dataout_gotos), IF DATA_OUT 258*0Sstevel@tonic-gate JUMP REL(datain_gotos), IF DATA_IN 259*0Sstevel@tonic-gate JUMP REL(status_phase), IF STATUS 260*0Sstevel@tonic-gate JUMP REL(command_phase), IF CMD 261*0Sstevel@tonic-gate JUMP REL(errmsg_out), WHEN MSG_OUT 262*0Sstevel@tonic-gate JUMP REL(dt_dataout_gotos), IF RES4 263*0Sstevel@tonic-gate JUMP REL(dt_datain_gotos), IF RES5 264*0Sstevel@tonic-gate INT PASS(NINT_ILI_PHASE) 265*0Sstevel@tonic-gate 266*0Sstevel@tonic-gate 267*0Sstevel@tonic-gate;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 268*0Sstevel@tonic-gate 269*0Sstevel@tonic-gatemsgin: 270*0Sstevel@tonic-gate; read the first byte 271*0Sstevel@tonic-gate MOVE FROM PASS(NTOFFSET(nt_rcvmsg)), WHEN MSG_IN 272*0Sstevel@tonic-gatemsgin2: 273*0Sstevel@tonic-gate JUMP REL(end), IF 0x00 ; command complete message 274*0Sstevel@tonic-gate INT PASS(NINT_SDP_MSG), IF 0x02 ; save data pointers 275*0Sstevel@tonic-gate JUMP REL(disc), IF 0x04 ; disconnect message 276*0Sstevel@tonic-gate INT PASS(NINT_RP_MSG), IF 0x03 ; restore data pointers 277*0Sstevel@tonic-gate INT PASS(NINT_MSGREJ), IF 0x07 ; Message Reject 278*0Sstevel@tonic-gate JUMP REL(ext_msg_in), IF 0x01 ; extended message 279*0Sstevel@tonic-gate JUMP REL(ignore_wide_residue), IF 0x23 ; ignore wide residue 280*0Sstevel@tonic-gate INT PASS(NINT_UNS_MSG) ; unsupported message type 281*0Sstevel@tonic-gate 282*0Sstevel@tonic-gatedisc: 283*0Sstevel@tonic-gate MOVE 0x00 TO SCNTL2 284*0Sstevel@tonic-gate CLEAR ACK 285*0Sstevel@tonic-gate WAIT DISCONNECT 286*0Sstevel@tonic-gate INT PASS(NINT_DISC) 287*0Sstevel@tonic-gate 288*0Sstevel@tonic-gateresel_disc: 289*0Sstevel@tonic-gate MOVE 0x00 TO SCNTL2 290*0Sstevel@tonic-gate CLEAR ACK 291*0Sstevel@tonic-gate WAIT DISCONNECT 292*0Sstevel@tonic-gate INT PASS(NINT_RESEL) 293*0Sstevel@tonic-gate 294*0Sstevel@tonic-gateext_msg_in: 295*0Sstevel@tonic-gate CLEAR ACK 296*0Sstevel@tonic-gate MOVE FROM PASS(NTOFFSET(nt_extmsg)), WHEN MSG_IN 297*0Sstevel@tonic-gate JUMP REL(wide_msg_in), IF 0x02 298*0Sstevel@tonic-gate JUMP REL(sync_msg_in), IF 0x03 299*0Sstevel@tonic-gate JUMP REL(ppr_msg_in), IF 0x06 300*0Sstevel@tonic-gate INT PASS(NINT_UNS_EXTMSG) 301*0Sstevel@tonic-gate 302*0Sstevel@tonic-gateignore_wide_residue: 303*0Sstevel@tonic-gate CLEAR ACK 304*0Sstevel@tonic-gate MOVE FROM PASS(NTOFFSET(nt_rcvmsg)), WHEN MSG_IN 305*0Sstevel@tonic-gate INT PASS(NINT_IWR) 306*0Sstevel@tonic-gate 307*0Sstevel@tonic-gateppr_msg_in: 308*0Sstevel@tonic-gate CLEAR ACK 309*0Sstevel@tonic-gate MOVE FROM PASS(NTOFFSET(nt_pprin)), WHEN MSG_IN 310*0Sstevel@tonic-gate; don't ack the last byte until after the interrupt handler returns 311*0Sstevel@tonic-gate INT PASS(NINT_PPR), IF 0x04 312*0Sstevel@tonic-gate 313*0Sstevel@tonic-gatesync_msg_in: 314*0Sstevel@tonic-gate CLEAR ACK 315*0Sstevel@tonic-gate MOVE FROM PASS(NTOFFSET(nt_syncin)), WHEN MSG_IN 316*0Sstevel@tonic-gate; don't ack the last byte until after the interrupt handler returns 317*0Sstevel@tonic-gate INT PASS(NINT_SDTR), IF 0x01 318*0Sstevel@tonic-gate 319*0Sstevel@tonic-gate; unsupported extended message 320*0Sstevel@tonic-gate INT PASS(NINT_UNS_EXTMSG) 321*0Sstevel@tonic-gate 322*0Sstevel@tonic-gatewide_msg_in: 323*0Sstevel@tonic-gate CLEAR ACK 324*0Sstevel@tonic-gate MOVE FROM PASS(NTOFFSET(nt_widein)), WHEN MSG_IN 325*0Sstevel@tonic-gate; don't ack the last byte until after the interrupt handler returns 326*0Sstevel@tonic-gate INT PASS(NINT_WDTR), IF 0x03 327*0Sstevel@tonic-gate 328*0Sstevel@tonic-gate; unsupported extended message 329*0Sstevel@tonic-gate INT PASS(NINT_UNS_EXTMSG) 330*0Sstevel@tonic-gate 331*0Sstevel@tonic-gatephase_mis_match: 332*0Sstevel@tonic-gate INT PASS(NINT_PMM) 333*0Sstevel@tonic-gate 334*0Sstevel@tonic-gate;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 335*0Sstevel@tonic-gate 336*0Sstevel@tonic-gatecommand_phase: 337*0Sstevel@tonic-gate MOVE FROM PASS(NTOFFSET(nt_cmd)), WHEN CMD 338*0Sstevel@tonic-gate JUMP REL(msgin), WHEN MSG_IN 339*0Sstevel@tonic-gate JUMP REL(switch) 340*0Sstevel@tonic-gate 341*0Sstevel@tonic-gate 342*0Sstevel@tonic-gate;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 343*0Sstevel@tonic-gate 344*0Sstevel@tonic-gatestatus_phase: 345*0Sstevel@tonic-gate MOVE FROM PASS(NTOFFSET(nt_status)), WHEN STATUS 346*0Sstevel@tonic-gate JUMP REL(switch), WHEN NOT MSG_IN 347*0Sstevel@tonic-gate MOVE FROM PASS(NTOFFSET(nt_rcvmsg)), WHEN MSG_IN 348*0Sstevel@tonic-gate 349*0Sstevel@tonic-gate 350*0Sstevel@tonic-gate;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 351*0Sstevel@tonic-gate 352*0Sstevel@tonic-gateend: 353*0Sstevel@tonic-gate MOVE 0x00 TO SCNTL2 354*0Sstevel@tonic-gate CLEAR ACK 355*0Sstevel@tonic-gate WAIT DISCONNECT 356*0Sstevel@tonic-gate INT PASS(NINT_OK) 357*0Sstevel@tonic-gate 358*0Sstevel@tonic-gate 359*0Sstevel@tonic-gate;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 360*0Sstevel@tonic-gate 361*0Sstevel@tonic-gate; The data in and data out scatter/gather dma lists are set up by 362*0Sstevel@tonic-gate; the driver such that they're right justified in the table indirect 363*0Sstevel@tonic-gate; array. In other words if the s/g list contains a single segment then 364*0Sstevel@tonic-gate; only the last entry in the list is used. If the s/g list contains 365*0Sstevel@tonic-gate; two entries then the last two entries are used, etc.. The jump table 366*0Sstevel@tonic-gate; below skip over the unused entries. This way when a phase mismatch 367*0Sstevel@tonic-gate; interrupt occurs I can easily compute how far into the list processing 368*0Sstevel@tonic-gate; has proceeded and reset the pointers and the scratch register to 369*0Sstevel@tonic-gate; properly restart the dma. 370*0Sstevel@tonic-gate 371*0Sstevel@tonic-gatedataout_gotos: 372*0Sstevel@tonic-gate MOVE SCRATCHA0 TO SFBR 373*0Sstevel@tonic-gate INT PASS(NINT_TOOMUCHDATA), IF 0 374*0Sstevel@tonic-gate JUMP REL(dataout_1), IF 1 375*0Sstevel@tonic-gate JUMP REL(dataout_2), IF 2 376*0Sstevel@tonic-gate JUMP REL(dataout_3), IF 3 377*0Sstevel@tonic-gate JUMP REL(dataout_4), IF 4 378*0Sstevel@tonic-gate JUMP REL(dataout_5), IF 5 379*0Sstevel@tonic-gate JUMP REL(dataout_6), IF 6 380*0Sstevel@tonic-gate JUMP REL(dataout_7), IF 7 381*0Sstevel@tonic-gate JUMP REL(dataout_8), IF 8 382*0Sstevel@tonic-gate JUMP REL(dataout_9), IF 9 383*0Sstevel@tonic-gate JUMP REL(dataout_10), IF 10 384*0Sstevel@tonic-gate JUMP REL(dataout_11), IF 11 385*0Sstevel@tonic-gate JUMP REL(dataout_12), IF 12 386*0Sstevel@tonic-gate JUMP REL(dataout_13), IF 13 387*0Sstevel@tonic-gate JUMP REL(dataout_14), IF 14 388*0Sstevel@tonic-gate JUMP REL(dataout_15), IF 15 389*0Sstevel@tonic-gate JUMP REL(dataout_16), IF 16 390*0Sstevel@tonic-gate JUMP REL(dataout_17), IF 17 391*0Sstevel@tonic-gate INT PASS(NINT_TOOMUCHDATA) 392*0Sstevel@tonic-gate 393*0Sstevel@tonic-gatedataout_17: MOVE FROM PASS(NTOFFSET(nt_data[16])), WHEN DATA_OUT 394*0Sstevel@tonic-gatedataout_16: MOVE FROM PASS(NTOFFSET(nt_data[15])), WHEN DATA_OUT 395*0Sstevel@tonic-gatedataout_15: MOVE FROM PASS(NTOFFSET(nt_data[14])), WHEN DATA_OUT 396*0Sstevel@tonic-gatedataout_14: MOVE FROM PASS(NTOFFSET(nt_data[13])), WHEN DATA_OUT 397*0Sstevel@tonic-gatedataout_13: MOVE FROM PASS(NTOFFSET(nt_data[12])), WHEN DATA_OUT 398*0Sstevel@tonic-gatedataout_12: MOVE FROM PASS(NTOFFSET(nt_data[11])), WHEN DATA_OUT 399*0Sstevel@tonic-gatedataout_11: MOVE FROM PASS(NTOFFSET(nt_data[10])), WHEN DATA_OUT 400*0Sstevel@tonic-gatedataout_10: MOVE FROM PASS(NTOFFSET(nt_data[9])), WHEN DATA_OUT 401*0Sstevel@tonic-gatedataout_9: MOVE FROM PASS(NTOFFSET(nt_data[8])), WHEN DATA_OUT 402*0Sstevel@tonic-gatedataout_8: MOVE FROM PASS(NTOFFSET(nt_data[7])), WHEN DATA_OUT 403*0Sstevel@tonic-gatedataout_7: MOVE FROM PASS(NTOFFSET(nt_data[6])), WHEN DATA_OUT 404*0Sstevel@tonic-gatedataout_6: MOVE FROM PASS(NTOFFSET(nt_data[5])), WHEN DATA_OUT 405*0Sstevel@tonic-gatedataout_5: MOVE FROM PASS(NTOFFSET(nt_data[4])), WHEN DATA_OUT 406*0Sstevel@tonic-gatedataout_4: MOVE FROM PASS(NTOFFSET(nt_data[3])), WHEN DATA_OUT 407*0Sstevel@tonic-gatedataout_3: MOVE FROM PASS(NTOFFSET(nt_data[2])), WHEN DATA_OUT 408*0Sstevel@tonic-gatedataout_2: MOVE FROM PASS(NTOFFSET(nt_data[1])), WHEN DATA_OUT 409*0Sstevel@tonic-gatedataout_1: MOVE FROM PASS(NTOFFSET(nt_data[0])), WHEN DATA_OUT 410*0Sstevel@tonic-gatedo_list_end: 411*0Sstevel@tonic-gate MOVE 0 TO SCRATCHA0 412*0Sstevel@tonic-gate JUMP REL(switch) 413*0Sstevel@tonic-gate 414*0Sstevel@tonic-gate; 415*0Sstevel@tonic-gate; data in processing 416*0Sstevel@tonic-gate; 417*0Sstevel@tonic-gate 418*0Sstevel@tonic-gatedatain_gotos: 419*0Sstevel@tonic-gate MOVE SCRATCHA0 TO SFBR 420*0Sstevel@tonic-gate INT PASS(NINT_TOOMUCHDATA), IF 0 421*0Sstevel@tonic-gate JUMP REL(datain_1), IF 1 422*0Sstevel@tonic-gate JUMP REL(datain_2), IF 2 423*0Sstevel@tonic-gate JUMP REL(datain_3), IF 3 424*0Sstevel@tonic-gate JUMP REL(datain_4), IF 4 425*0Sstevel@tonic-gate JUMP REL(datain_5), IF 5 426*0Sstevel@tonic-gate JUMP REL(datain_6), IF 6 427*0Sstevel@tonic-gate JUMP REL(datain_7), IF 7 428*0Sstevel@tonic-gate JUMP REL(datain_8), IF 8 429*0Sstevel@tonic-gate JUMP REL(datain_9), IF 9 430*0Sstevel@tonic-gate JUMP REL(datain_10), IF 10 431*0Sstevel@tonic-gate JUMP REL(datain_11), IF 11 432*0Sstevel@tonic-gate JUMP REL(datain_12), IF 12 433*0Sstevel@tonic-gate JUMP REL(datain_13), IF 13 434*0Sstevel@tonic-gate JUMP REL(datain_14), IF 14 435*0Sstevel@tonic-gate JUMP REL(datain_15), IF 15 436*0Sstevel@tonic-gate JUMP REL(datain_16), IF 16 437*0Sstevel@tonic-gate JUMP REL(datain_17), IF 17 438*0Sstevel@tonic-gate INT PASS(NINT_TOOMUCHDATA) 439*0Sstevel@tonic-gate 440*0Sstevel@tonic-gatedatain_17: MOVE FROM PASS(NTOFFSET(nt_data[16])), WHEN DATA_IN 441*0Sstevel@tonic-gatedatain_16: MOVE FROM PASS(NTOFFSET(nt_data[15])), WHEN DATA_IN 442*0Sstevel@tonic-gatedatain_15: MOVE FROM PASS(NTOFFSET(nt_data[14])), WHEN DATA_IN 443*0Sstevel@tonic-gatedatain_14: MOVE FROM PASS(NTOFFSET(nt_data[13])), WHEN DATA_IN 444*0Sstevel@tonic-gatedatain_13: MOVE FROM PASS(NTOFFSET(nt_data[12])), WHEN DATA_IN 445*0Sstevel@tonic-gatedatain_12: MOVE FROM PASS(NTOFFSET(nt_data[11])), WHEN DATA_IN 446*0Sstevel@tonic-gatedatain_11: MOVE FROM PASS(NTOFFSET(nt_data[10])), WHEN DATA_IN 447*0Sstevel@tonic-gatedatain_10: MOVE FROM PASS(NTOFFSET(nt_data[9])), WHEN DATA_IN 448*0Sstevel@tonic-gatedatain_9: MOVE FROM PASS(NTOFFSET(nt_data[8])), WHEN DATA_IN 449*0Sstevel@tonic-gatedatain_8: MOVE FROM PASS(NTOFFSET(nt_data[7])), WHEN DATA_IN 450*0Sstevel@tonic-gatedatain_7: MOVE FROM PASS(NTOFFSET(nt_data[6])), WHEN DATA_IN 451*0Sstevel@tonic-gatedatain_6: MOVE FROM PASS(NTOFFSET(nt_data[5])), WHEN DATA_IN 452*0Sstevel@tonic-gatedatain_5: MOVE FROM PASS(NTOFFSET(nt_data[4])), WHEN DATA_IN 453*0Sstevel@tonic-gatedatain_4: MOVE FROM PASS(NTOFFSET(nt_data[3])), WHEN DATA_IN 454*0Sstevel@tonic-gatedatain_3: MOVE FROM PASS(NTOFFSET(nt_data[2])), WHEN DATA_IN 455*0Sstevel@tonic-gatedatain_2: MOVE FROM PASS(NTOFFSET(nt_data[1])), WHEN DATA_IN 456*0Sstevel@tonic-gatedatain_1: MOVE FROM PASS(NTOFFSET(nt_data[0])), WHEN DATA_IN 457*0Sstevel@tonic-gatedi_list_end: 458*0Sstevel@tonic-gate MOVE 0 TO SCRATCHA0 459*0Sstevel@tonic-gate JUMP REL(switch) 460*0Sstevel@tonic-gate 461*0Sstevel@tonic-gate 462*0Sstevel@tonic-gatedt_dataout_gotos: 463*0Sstevel@tonic-gate MOVE SCRATCHA0 TO SFBR 464*0Sstevel@tonic-gate INT PASS(NINT_TOOMUCHDATA), IF 0 465*0Sstevel@tonic-gate JUMP REL(dt_dataout_1), IF 1 466*0Sstevel@tonic-gate JUMP REL(dt_dataout_2), IF 2 467*0Sstevel@tonic-gate JUMP REL(dt_dataout_3), IF 3 468*0Sstevel@tonic-gate JUMP REL(dt_dataout_4), IF 4 469*0Sstevel@tonic-gate JUMP REL(dt_dataout_5), IF 5 470*0Sstevel@tonic-gate JUMP REL(dt_dataout_6), IF 6 471*0Sstevel@tonic-gate JUMP REL(dt_dataout_7), IF 7 472*0Sstevel@tonic-gate JUMP REL(dt_dataout_8), IF 8 473*0Sstevel@tonic-gate JUMP REL(dt_dataout_9), IF 9 474*0Sstevel@tonic-gate JUMP REL(dt_dataout_10), IF 10 475*0Sstevel@tonic-gate JUMP REL(dt_dataout_11), IF 11 476*0Sstevel@tonic-gate JUMP REL(dt_dataout_12), IF 12 477*0Sstevel@tonic-gate JUMP REL(dt_dataout_13), IF 13 478*0Sstevel@tonic-gate JUMP REL(dt_dataout_14), IF 14 479*0Sstevel@tonic-gate JUMP REL(dt_dataout_15), IF 15 480*0Sstevel@tonic-gate JUMP REL(dt_dataout_16), IF 16 481*0Sstevel@tonic-gate JUMP REL(dt_dataout_17), IF 17 482*0Sstevel@tonic-gate INT PASS(NINT_TOOMUCHDATA) 483*0Sstevel@tonic-gate 484*0Sstevel@tonic-gatedt_dataout_17: MOVE FROM PASS(NTOFFSET(nt_data[16])), WHEN RES4 485*0Sstevel@tonic-gatedt_dataout_16: MOVE FROM PASS(NTOFFSET(nt_data[15])), WHEN RES4 486*0Sstevel@tonic-gatedt_dataout_15: MOVE FROM PASS(NTOFFSET(nt_data[14])), WHEN RES4 487*0Sstevel@tonic-gatedt_dataout_14: MOVE FROM PASS(NTOFFSET(nt_data[13])), WHEN RES4 488*0Sstevel@tonic-gatedt_dataout_13: MOVE FROM PASS(NTOFFSET(nt_data[12])), WHEN RES4 489*0Sstevel@tonic-gatedt_dataout_12: MOVE FROM PASS(NTOFFSET(nt_data[11])), WHEN RES4 490*0Sstevel@tonic-gatedt_dataout_11: MOVE FROM PASS(NTOFFSET(nt_data[10])), WHEN RES4 491*0Sstevel@tonic-gatedt_dataout_10: MOVE FROM PASS(NTOFFSET(nt_data[9])), WHEN RES4 492*0Sstevel@tonic-gatedt_dataout_9: MOVE FROM PASS(NTOFFSET(nt_data[8])), WHEN RES4 493*0Sstevel@tonic-gatedt_dataout_8: MOVE FROM PASS(NTOFFSET(nt_data[7])), WHEN RES4 494*0Sstevel@tonic-gatedt_dataout_7: MOVE FROM PASS(NTOFFSET(nt_data[6])), WHEN RES4 495*0Sstevel@tonic-gatedt_dataout_6: MOVE FROM PASS(NTOFFSET(nt_data[5])), WHEN RES4 496*0Sstevel@tonic-gatedt_dataout_5: MOVE FROM PASS(NTOFFSET(nt_data[4])), WHEN RES4 497*0Sstevel@tonic-gatedt_dataout_4: MOVE FROM PASS(NTOFFSET(nt_data[3])), WHEN RES4 498*0Sstevel@tonic-gatedt_dataout_3: MOVE FROM PASS(NTOFFSET(nt_data[2])), WHEN RES4 499*0Sstevel@tonic-gatedt_dataout_2: MOVE FROM PASS(NTOFFSET(nt_data[1])), WHEN RES4 500*0Sstevel@tonic-gatedt_dataout_1: MOVE FROM PASS(NTOFFSET(nt_data[0])), WHEN RES4 501*0Sstevel@tonic-gatedt_do_list_end: 502*0Sstevel@tonic-gate MOVE 0 TO SCRATCHA0 503*0Sstevel@tonic-gate JUMP REL(switch) 504*0Sstevel@tonic-gate 505*0Sstevel@tonic-gate; 506*0Sstevel@tonic-gate; data in processing 507*0Sstevel@tonic-gate; 508*0Sstevel@tonic-gate 509*0Sstevel@tonic-gatedt_datain_gotos: 510*0Sstevel@tonic-gate MOVE SCRATCHA0 TO SFBR 511*0Sstevel@tonic-gate INT PASS(NINT_TOOMUCHDATA), IF 0 512*0Sstevel@tonic-gate JUMP REL(dt_datain_1), IF 1 513*0Sstevel@tonic-gate JUMP REL(dt_datain_2), IF 2 514*0Sstevel@tonic-gate JUMP REL(dt_datain_3), IF 3 515*0Sstevel@tonic-gate JUMP REL(dt_datain_4), IF 4 516*0Sstevel@tonic-gate JUMP REL(dt_datain_5), IF 5 517*0Sstevel@tonic-gate JUMP REL(dt_datain_6), IF 6 518*0Sstevel@tonic-gate JUMP REL(dt_datain_7), IF 7 519*0Sstevel@tonic-gate JUMP REL(dt_datain_8), IF 8 520*0Sstevel@tonic-gate JUMP REL(dt_datain_9), IF 9 521*0Sstevel@tonic-gate JUMP REL(dt_datain_10), IF 10 522*0Sstevel@tonic-gate JUMP REL(dt_datain_11), IF 11 523*0Sstevel@tonic-gate JUMP REL(dt_datain_12), IF 12 524*0Sstevel@tonic-gate JUMP REL(dt_datain_13), IF 13 525*0Sstevel@tonic-gate JUMP REL(dt_datain_14), IF 14 526*0Sstevel@tonic-gate JUMP REL(dt_datain_15), IF 15 527*0Sstevel@tonic-gate JUMP REL(dt_datain_16), IF 16 528*0Sstevel@tonic-gate JUMP REL(dt_datain_17), IF 17 529*0Sstevel@tonic-gate INT PASS(NINT_TOOMUCHDATA) 530*0Sstevel@tonic-gate 531*0Sstevel@tonic-gatedt_datain_17: MOVE FROM PASS(NTOFFSET(nt_data[16])), WHEN RES5 532*0Sstevel@tonic-gatedt_datain_16: MOVE FROM PASS(NTOFFSET(nt_data[15])), WHEN RES5 533*0Sstevel@tonic-gatedt_datain_15: MOVE FROM PASS(NTOFFSET(nt_data[14])), WHEN RES5 534*0Sstevel@tonic-gatedt_datain_14: MOVE FROM PASS(NTOFFSET(nt_data[13])), WHEN RES5 535*0Sstevel@tonic-gatedt_datain_13: MOVE FROM PASS(NTOFFSET(nt_data[12])), WHEN RES5 536*0Sstevel@tonic-gatedt_datain_12: MOVE FROM PASS(NTOFFSET(nt_data[11])), WHEN RES5 537*0Sstevel@tonic-gatedt_datain_11: MOVE FROM PASS(NTOFFSET(nt_data[10])), WHEN RES5 538*0Sstevel@tonic-gatedt_datain_10: MOVE FROM PASS(NTOFFSET(nt_data[9])), WHEN RES5 539*0Sstevel@tonic-gatedt_datain_9: MOVE FROM PASS(NTOFFSET(nt_data[8])), WHEN RES5 540*0Sstevel@tonic-gatedt_datain_8: MOVE FROM PASS(NTOFFSET(nt_data[7])), WHEN RES5 541*0Sstevel@tonic-gatedt_datain_7: MOVE FROM PASS(NTOFFSET(nt_data[6])), WHEN RES5 542*0Sstevel@tonic-gatedt_datain_6: MOVE FROM PASS(NTOFFSET(nt_data[5])), WHEN RES5 543*0Sstevel@tonic-gatedt_datain_5: MOVE FROM PASS(NTOFFSET(nt_data[4])), WHEN RES5 544*0Sstevel@tonic-gatedt_datain_4: MOVE FROM PASS(NTOFFSET(nt_data[3])), WHEN RES5 545*0Sstevel@tonic-gatedt_datain_3: MOVE FROM PASS(NTOFFSET(nt_data[2])), WHEN RES5 546*0Sstevel@tonic-gatedt_datain_2: MOVE FROM PASS(NTOFFSET(nt_data[1])), WHEN RES5 547*0Sstevel@tonic-gatedt_datain_1: MOVE FROM PASS(NTOFFSET(nt_data[0])), WHEN RES5 548*0Sstevel@tonic-gatedt_di_list_end: 549*0Sstevel@tonic-gate MOVE 0 TO SCRATCHA0 550*0Sstevel@tonic-gate JUMP REL(switch) 551