|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights ! 7: * Reserved. This file contains Original Code and/or Modifications of ! 8: * Original Code as defined in and that are subject to the Apple Public ! 9: * Source License Version 1.1 (the "License"). You may not use this file ! 10: * except in compliance with the License. Please obtain a copy of the ! 11: * License at http://www.apple.com/publicsource and read it before using ! 12: * this file. ! 13: * ! 14: * The Original Code and all software distributed under the License are ! 15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 19: * License for the specific language governing rights and limitations ! 20: * under the License. ! 21: * ! 22: * @APPLE_LICENSE_HEADER_END@ ! 23: */ ! 24: ! 25: /** ! 26: * Copyright 1997 Apple Computer Inc. All Rights Reserved. ! 27: * @author Martin Minow mailto:[email protected] ! 28: * @revision 1997.02.12 Initial conversion from AMDPCSCSIDriver sources. ! 29: * ! 30: * There is no code in this module. It contains documentation of the 53C96 SCSI state ! 31: * machine. ! 32: * ! 33: * Note: we must use a comment here as some C compilers parse the text inside an #if 0 ! 34: * and post errors if there are unbalanced quotes or similar. ! 35: */ ! 36: ! 37: /* ! 38: ! 39: Primary Bus Operation State Machine ! 40: ! 41: ** ** ** NOTE: This is slightly out of date. See the code for the actual logic. ** ** ** ! 42: ! 43: from to where when ! 44: ----------------- ----------------- -------------- ------------------------- ! 45: unknown SCS_UNINITIALIZED -archInit Initial probe ! 46: xxx SCS_DISCONNECTED -hwReset Any hardware reset ! 47: xxx SCS_DISCONNECTED -hardwareInterrupt iDisconnect interrupt ! 48: ----------------- ! 49: SCS_DISCONNECTED SCS_SELECTING -hwStart Start of select sequence ! 50: SCS_DISCONNECTED SCS_ACCEPTINGMSG -fsmDisconnected Valid Reselect detected ! 51: ----------------- ! 52: SCS_SELECTING SCS_DISCONNECTED -fsmSelecting Select Timeout ! 53: SCS_SELECTING SCS_INITIATOR -fsmSelecting Select seq. interrupt (maybe incomplete) ! 54: SCS_SELECTING SCS_DISCONNECTED -fsmSelecting Reselect during select attempt ! 55: ----------------- ! 56: SCS_INITIATOR SCS_SENDINGCMD -fsmPhaseChange Phase change to CMDO ! 57: SCS_INITIATOR SCS_COMPLETING -fsmPhaseChange Phase change to STAT ! 58: SCS_INITIATOR SCS_GETTINGMSG -fsmPhaseChange Phase change to MSGI ! 59: SCS_INITIATOR SCS_SENDINGMSG -fsmPhaseChange Phase change to MSGO, msg bytes in FIFO ! 60: SCS_INITIATOR SCS_DMACOMPLETE -dmaStart DMA setup in DATI/DATO phase ! 61: ----------------- ! 62: SCS_SENDINGCMD SCS_INITIATOR -fsmSendingCmd Good interrupt after sending cmd ! 63: ----------------- ! 64: SCS_COMPLETING SCS_ACCEPTINGMSG -fsmCompleting Good SCMD_INIT_CMD_CMPLT ! 65: SCS_COMPLETING SCS_INITIATOR -fsmCompleting SCMD_INIT_CMD_CMPLT, but only STS byte. ! 66: ----------------- ! 67: SCS_GETTINGMSG SCS_ACCEPTINGMSG -fsmGettingMsg SCMD_MSG_ACCEPTED cmd sent ! 68: ----------------- ! 69: SCS_ACCEPTINGMSG SCS_GETTINGMSG -fsmAcceptingMsg Phase still MSGI ! 70: SCS_ACCEPTINGMSG SCS_INITIATOR -fsmAcceptingMsg Phase != MSGI ! 71: SCS_ACCEPTINGMSG SCS_DISCONNECTED -fsmAcceptingMsg Msg = Cmd complete ! 72: SCS_ACCEPTINGMSG SCS_DISCONNECTED -fsmAcceptingMsg Msg = disconnect ! 73: SCS_ACCEPTINGMSG SCS_INITIATOR -fsmAcceptingMsg Any other msg ! 74: ----------------- ! 75: SCS_DMACOMPLETE SCS_INITIATOR -fsmDMAComplete DMA complete ! 76: ----------------- ! 77: SCS_SENDINGMSG SCS_INITIATOR -fsmSendingMsg Always ! 78: ! 79: ! 80: Message Out State ! 81: ! 82: The purpose of this is to provide a means to send a message out to the target. Basically, ! 83: to do a message out: ! 84: ! 85: -- Set ATN true ! 86: -- Place message byte(s) in currMsgOut[] ! 87: -- Set currMsgOutCnt to length of message ! 88: -- Set msgOutState = MOS_WAITING ! 89: ! 90: All of these are done in -messageOut: for a single-byte message. For extended messages, ! 91: context-specific code must perform these manually. ! 92: ! 93: When we see a phase change to message out, -fsmPhaseChange sends the message byte(s) from ! 94: currMsgOut[] to the FIFO, does a SCMD_TRANSFER_INFO, and sets msgOutState to MOS_SAWMSGOUT. ! 95: We go back to MOS_NONE when we see any other phase. ! 96: ! 97: from to where when ! 98: ----------------- ----------------- -------------- ------------------------- ! 99: xxx MOS_NONE -hwReset Hardware reset ! 100: xxx MOS_NONE -hwStart Start of select sequence ! 101: MOS_NONE MOS_WAITING -fsmSelecting Select done, set ATN, sending SDTR msg ! 102: MOS_NONE MOS_WAITING -fsmAcceptingMsg Target-init SDTR, we set ATN for our SDTR ! 103: MOS_NONE MOS_WAITING -messageOut Set ATN to do a single-byte msg out ! 104: MOS_WAITING MOS_SAWMSGOUT -fsmPhaseChange Phase change to MSGO, our bytes in FIFO. ! 105: MOS_SAWMSGOUT MOS_NONE -fsmPhaseChange Phase != msg in or msg out ! 106: ! 107: ! 108: This state machine keeps track of SDTR negotiations, both target- and host-initiated. ! 109: ! 110: from to where when ! 111: ----------------- ----------------- -------------- ------------------------- ! 112: xxx SNS_NONE -hwReset Hardware reset ! 113: xxx SNS_HOST_INIT_NEEDED -hwStart We want to do SDTR ! 114: xxx SNS_NONE -hwStart We don't want to do SDTR ! 115: SNS_HOST_INIT_NEEDED SNS_NONE -fsmSelecting No message phase after Sel complete ! 116: SNS_HOST_INIT_NEEDED SNS_HOST_INIT -fsmPhaseChange Phase = MSGO after selection ! 117: SNS_HOST_INIT SNS_NONE -fsmAcceptingMsg Target rejected our SDTR. ! 118: SNS_HOST_INIT SNS_NONE -fsmAcceptingMsg Target's SDTR response recv'd ! 119: SNS_HOST_INIT SNS_NONE -fsmPhaseChange No MSGIn after our SDTR sent. ! 120: SNS_NONE SNS_TARGET_INIT -fsmGettingMsg Saw target-init'd SDTR ! 121: SNS_TARGET_INIT SNS_NONE -fsmSendingMsg Completed target-init'd SDTR ! 122: ! 123: */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.