?? sym895scr.n
字號(hào):
; 895Script.n Scripts code for sym895Lib driver.; copyright 1989 - 1999 Wind River Systems, Inc.;/*; modification history; --------------------;; 01a, 28feb00, bsp Created. Adapted form ncr810init.n;*/; All the ABSOLUTE definitions below will appear as #define LABELS in the; output file generated by NASM assembler. Refer to Chap. 4 &5 of PCI-SCSI; programming guide. ABSOLUTE FLAGS_IDENTIFY = 0x01ABSOLUTE SIZEOF_ULONG = 4ABSOLUTE SIZEOF_MOVE_PARAMS = 8ABSOLUTE OFFSET_DEVICE = 0ABSOLUTE OFFSET_CMD = (OFFSET_DEVICE + SIZEOF_ULONG)ABSOLUTE OFFSET_DATA_IN = (OFFSET_CMD + SIZEOF_MOVE_PARAMS)ABSOLUTE OFFSET_DATA_OUT = (OFFSET_DATA_IN + SIZEOF_MOVE_PARAMS)ABSOLUTE OFFSET_STATUS = (OFFSET_DATA_OUT + SIZEOF_MOVE_PARAMS)ABSOLUTE OFFSET_IDENT_OUT = (OFFSET_STATUS + SIZEOF_MOVE_PARAMS)ABSOLUTE OFFSET_IDENT_IN = (OFFSET_IDENT_OUT + SIZEOF_MOVE_PARAMS)ABSOLUTE OFFSET_MSG_OUT = (OFFSET_IDENT_IN + SIZEOF_MOVE_PARAMS)ABSOLUTE OFFSET_MSG_IN = (OFFSET_MSG_OUT + SIZEOF_MOVE_PARAMS)ABSOLUTE OFFSET_MSG_IN_SECOND = (OFFSET_MSG_IN + SIZEOF_MOVE_PARAMS)ABSOLUTE OFFSET_MSG_IN_REST = (OFFSET_MSG_IN_SECOND + SIZEOF_MOVE_PARAMS)ABSOLUTE OFFSET_SCAT_DATA = (OFFSET_MSG_IN_REST + SIZEOF_MOVE_PARAMS + SIZEOF_ULONG)ABSOLUTE LOOPBACK_DEVICE_OFFS = 0ABSOLUTE LOOPBACK_IDENT_OUT_OFFS = (LOOPBACK_DEVICE_OFFS + SIZEOF_ULONG)ABSOLUTE LOOPBACK_DATA_OUT_OFFS = (LOOPBACK_IDENT_OUT_OFFS + SIZEOF_MOVE_PARAMS)ABSOLUTE PHASE_NONE = 0xff ; /* no info transfer pending */ABSOLUTE PHASE_DATA_OUT = 0 ; /* data out (to target) */ABSOLUTE PHASE_DATA_IN = 1 ; /* data in (from target) */ABSOLUTE PHASE_COMMAND = 2 ; /* command (to target) */ABSOLUTE PHASE_STATUS = 3 ; /* status (from target) */ABSOLUTE PHASE_MSG_OUT = 6 ; /* message out (to target) */ABSOLUTE PHASE_MSG_IN = 7 ; /* message in (from target) */ABSOLUTE M_CMD_COMPLETE = 0x00 ; /* command complete msg. */ABSOLUTE M_EXT_MSG = 0x01 ; /* extended message msg. */ABSOLUTE M_DISCONNECT = 0x04 ; /* disconnect msg. */ABSOLUTE M_ABORT = 0x06 ; /* abort msg. */ABSOLUTE M_NO_OP = 0x08 ; /* no operation msg. */ABSOLUTE M_ABORT_TAG = 0x0d ; /* abort tag msg. */ABSOLUTE M_IN_NONE = 0 ; /* no message in in progress */ABSOLUTE M_IN_SECOND_BYTE = 1 ; /* next byte is second of two */ABSOLUTE M_IN_EXT_MSG_LEN = 2 ; /* next byte is ext msg length */ABSOLUTE M_IN_EXT_MSG_DATA = 3 ; /* next byte(s) are ext msg data */ABSOLUTE M_OUT_NONE = 0 ; /* no message out in progress */ABSOLUTE M_OUT_PENDING = 1 ; /* message out ready to send */ABSOLUTE M_OUT_SENT = 2 ; /* message out has been sent */ABSOLUTE SYM895_READY = 0 ; /* ready to start new host command */ABSOLUTE SYM895_SCRIPT_ABORTED = 1 ; /* have aborted a running script */ABSOLUTE SYM895_MESSAGE_OUT_SENT = 10 ; /* have successfully sent a message */ABSOLUTE SYM895_MESSAGE_IN_RECVD = 11 ; /* have received a complete message */ABSOLUTE SYM895_EXT_MESSAGE_SIZE = 12 ; /* have read size of extended msg */ABSOLUTE SYM895_NO_MSG_OUT = 13 ; /* msg out req. with no msg pending */ABSOLUTE SYM895_CMD_COMPLETE = 20 ; /* SCSI command completed */ABSOLUTE SYM895_DISCONNECTED = 21 ; /* target has disconnected */ABSOLUTE SYM895_RESELECTED = 22 ; /* have been reselected by target */ABSOLUTE SYM895_SELECTED = 23 ; /* have been selected as a target */ABSOLUTE SYM895_SPURIOUS_CMD = 30 ; /* spurious interrupt of resel wait */ABSOLUTE SYM895_ILLEGAL_PHASE = 31 ; /* target requested phase 4 or 5 */ABSOLUTE SYM895_NO_IDENTIFY = 32 ; /* no IDENTIFY after reselection */ABSOLUTE SBCL_SEL = 0x10 ; /* 1 => SCSI SEL signal asserted */ABSOLUTE SBCL_ATN = 0x08 ; /* 1 => SCSI ATN signal asserted */ABSOLUTE SCNTL0_TARGET_MODE = 0x01 ; /* 1 => SIOP is in target mode */ABSOLUTE SCNTL1_CONNECTED = 0x10 ; /* 1 => SIOP is connected to SCSI */ABSOLUTE SIEN0_MISMATCH_ATN = 0x80 ; /* 1 => mismatch/ATN intr enabled */ABSOLUTE CTEST2_SIGNAL = 0x40 ; /* 1 => signal pending from host */ABSOLUTE STIME0_HTH_MASK = 0xf0 ; /* Handshake-to-handshake timeout mask*/ABSOLUTE STIME0_SEL_MASK = 0x0f ; /* Select timeout bit-mask */ABSOLUTE STIME0_HTH_TIMEOUT = 0xd0 ; /* Handshake-to-handshake timeout value*/ABSOLUTE STIME0_SEL_TIMEOUT = 0x0d ; /* Select timeout value */; /* here starts the scripts */;;;/*******************************************************************************;*;* sym895Wait - Wait for re-selection by the target or new command from host.;* selection by an initiator is not fully supported yet.;*/PROC sym895Wait:call REL(timeoutDisable) ; No selection/reselection timeouts.call REL(mismatchATNIntrDisable) ; Diable Mismatch / ATN Interrupt.wait RESELECT REL(checkNewCmd) ; Wait for re-selection / selection / ; signal from host (SIGP bit);; Re-selected by a SCSI target.;reselected: clear TARGET ; required in case SIGP is setmove SSID to SFBR ; save target ID for ISRmove SFBR to SCRATCHA3 ;; Check and receive IDENTIFY message in (error if none or if incorrect message);int SYM895_NO_IDENTIFY, when not MSG_IN ; check for correct phase move from OFFSET_IDENT_IN, when MSG_IN ; read IDENTIFY Messageint SYM895_NO_IDENTIFY if not 0x80 and mask 0x7f ; check for IDENTIFYmove FLAGS_IDENTIFY to SCRATCHA0 ; we got the IDENTIFY messageint SYM895_RESELECTED ; reselected ;; Have been selected as a target by another SCSI device.; selected:set TARGET ; required in case of SIGP setmove SSID to SFBR ; save initiator ID for ISRmove SFBR to SCRATCHA3 ; save the initiator id in buffer;; Wait for SEL to be de-asserted.;selAsserted:move SBCL & SBCL_SEL to SFBR ; Get state of SCSI SEL linejump REL(selAsserted) if not 0 ; loop while SEL is asserted;; Test whether ATN is asserted during selection; move SBCL & SBCL_ATN to SFBR ; Get state of SCSI ATN linejump REL(atnAsserted) if not 0;; Selection without ATN, and hence without an identification message; Select with ATN is mandatory in SCSI-2 where as its optional in SCSI-1;move 0 to SCRATCHA0int SYM895_SELECTED;; Selection with ATN. True SCSI-2;atnAsserted:move from OFFSET_IDENT_IN, with MSG_OUT move FLAGS_IDENTIFY to SCRATCHA0int SYM895_SELECTED;; We might have a new Host command. Check the SGIP Bit;checkNewCmd:move SCNTL1 & SCNTL1_CONNECTED to SFBR ; Check CON bitjump REL(ackCmd) if 0 ; if not connected then must be ; a host command.;; Connected. Must have been Selected or Reselected;checkCon:move CTEST2 & CTEST2_SIGNAL to SFBR wait reselect REL(selected)jump REL(reselected);; there is a New Host command. Host has set the SGIP bit;ackCmd:move CTEST2 & CTEST2_SIGNAL to SFBR ; test and clear SIGP bitint SYM895_SPURIOUS_CMD if 0 ; if clear, spurious commandint SYM895_READY ; else, ack host command;/*****************************************************************************;*;* sym895InitStart - start new initiator thread, selecting target and;* continuing to transfer command, data, messages as requested.;*;* At this point the script requires some data in the scratch registers;*;* scratcha0 host flags (halt after data in, disable SCSI timeout);* scratcha1 message out status (none, pending, or sent);* scratcha2 message in status;* scratcha3 undefined;*;* When the script finishes, these registers are updated to contain;*;* scratcha0 info transfer phase currently being serviced;* scratcha1 message out status (none, pending, or sent);* scratcha2 message in status;* scratcha3 contents of LCRC reg (after a reselection);*/PROC sym895InitStart:move PHASE_NONE to SCRATCHA3 call REL(timeoutEnable) ; Enable HTH & Selection timeoutcall REL(mismatchATNIntrDisable) ; disable Mismatch/ATN interrupt;; If Required to identify, select with ATN and try to transfer IDENTIFY message; (if this fails, continue ). Otherwise select without ATN.;move SCRATCHA0 & FLAGS_IDENTIFY to SFBR jump REL(selNoAtn) if 0select ATN from OFFSET_DEVICE, REL(checkNewCmd) ; Now transfer the IDENTIFY message plus any other message concatenated to it.;; Note: This code will not tolerate phase mismatches during the message out ; transfer. If the target rejects either the IDENTIFY or the following message,; we are in deep trouble.;move from OFFSET_IDENT_OUT, when MSG_OUT; If there was a normal message concatenated to IDENTIFY; then we would have have send it now.move SCRATCHA1 to SFBR jump REL(doneSelect) if not M_OUT_PENDINGmove M_OUT_SENT to SFBRmove SFBR to SCRATCHA1jump REL(doneSelect)selNoAtn:move 0x6 to SCRATCHB1select from OFFSET_DEVICE, REL(checkNewCmd)jump REL(doneSelect), when not MSG_OUTdoneSelect:call REL(timeoutDisable)jump REL(nextPhase);/*****************************************************************************;*;* sym895InitContinue - resume an initiator thread.;*;* At this point the script requires some data in the scratch registers;*;* scratcha0 host flags (assert ATN on Selection);* scratcha1 message out status (none, pending, or sent);* scratcha2 message in status;* scratcha3 undefined;*;* When the script finishes, these registers are updated to contain;*;* scratcha0 info transfer phase currently being serviced;* scratcha1 message out status (none, pending, or sent);* scratcha2 message in status;* scratcha3 contents of LCRC reg (after a reselection);*/PROC sym895InitContinue:call REL(timeoutDisable)nextPhase:call REL(mismatchATNIntrEnable)move SCRATCHA1 to SFBR ; if (msgOutState is pending)call REL(assertAtn) if M_OUT_PENDING ; assert ATNclear ack; ; if a message out has just been sent, and the current phase is no longer ; message out, the target has accepted the message. Reset the message out; state to NONE and int the host to handle post msg-out processing,;jump REL(phaseSwitch), when MSG_OUT move SCRATCHA1 to SFBR ; if (phase is not msg_out)jump REL(phaseSwitch) if not M_OUT_SENT ;move M_OUT_NONE to SFBR ; and its message is sentmove SFBR to SCRATCHA1 int SYM895_MESSAGE_OUT_SENT;; Normal Info Transfer processing.;phaseSwitch:jump REL(doDataOut), when DATA_OUTjump REL(doDataIn) if DATA_INjump REL(doCommand) if COMMANDjump REL(doStatus) if STATUSjump REL(doMsgOut) if MSG_OUTjump REL(doMsgIn) if MSG_INint SYM895_ILLEGAL_PHASE;/************************************************************************;*;* doDataOut - handle Data OUT phase
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -