Messages¶
- class squishy.scsi.messages.MessageCodes(value)¶
 SCSI Message Codes
SCSI Messages are to facilitate physical path management between a target and initiator.
The only mandatory command is
COMMAND_COMPLETEand as such any functional SCSI device only needs to support that message.There are two directions a message may be sent in,
inandout. With messages that areinthe flow is from the target to the initiator. Withoutmessages the flow is from the initiator to the target.- COMMAND_COMPLETE = 0¶
 Command Complete (Mandatory, In).
This message is sent to the Initiator to indicate that the execution of a command or series of linked commands has been terminated and that a valid status has been sent to the initiator.
After this message is sent the Initiator should go into the BUS FREE phase.
Note
The command may have been successfully or unsuccessfully completed
- EXTENDED_MESSAGE = 1¶
 Extended Message (Optional, In/Out).
This message indicates that the following data is an extended message. See
ExtendedMessageCodesfor more details on extended messages.
- SAVE_DATA_PTR = 2¶
 Save Data Pointer (Optional, In).
This message directs the Initiator to save a copy of the current active data pointer for the currently attached LUN.
- RESTORE_PTR = 3¶
 Restore Pointers (Optional, In).
This message directs the Initiator to restore the recently saved pointers to the active state.
Pointers to the command, data, and status locations for the LUN shall be restored to the active pointers.
Commands and status pointers shall be restored to the beginning of the current command and status areas.
The data pointer shall be restored to the value at the beginning of the data area in the absence of a
SAVE_DATA_PTRmessage, or to the value of the pointer from the lastSAVE_DATA_PTRmessage that was issued to the LUN.
- DISCONNECT = 4¶
 Disconnect (Optional, In/Out).
When sent from a Target, this message informs the Initiator that the present physical path will invalidated, and that a later reconnection will be needed in order to finish the current operation.
If BUS FREE is detected by the Initiator in any case other than a RESET condition and it did not receive a disconnect or command complete, it is considered a fatal error condition.
If the target caused the error intentionally, it will clear the current command.
This message shall not cause the initiator to save the data pointer.
Note
If one or more
DISCONNECTmessages are used to segment a long data transfer into two or more smaller transfers, then aSAVE_DATA_PTRmust be issued before eachDISCONNECTmessage.
- INT_DETECT_ERR = 5¶
 Initiator Detected Error (Optional, Out).
This message is sent from the Initiator to indicate to the target that an error has occurred that not prevent the target from re-attempting the operation.
Warning
Integrity of the pointers are not assured. However a
RESTORE_PTRmessage or a disconnect followed by a reconnect, shall cause the pointers to be restored to their defined prior state.
- ABORT = 6¶
 Abort (Optional, Out).
This message is sent from the Initiator to clear the current operation. If a LUN has been identified, then all pending data and status for the initiator issuing the message from the effected LUN shall be cleared. The target will then go into BUS FREE.
Pending data and status for any other Initiators on the bus shall not be cleared.
If a LUN has not been identified, then the target will go into the BUS FREE phase.
No status or ending message shall be sent for the operation.
Note
It is not an error for this message to be sent to a LUN that is not currently performing an operation for the sending Initiator.
- MESSAGE_REJECT = 7¶
 Message Reject (Optional, In/Out).
This message is sent from either the Target or Initiator to indicate that the previous message was invalid or not implemented.
When an Initiator sends this message, it asserts the ATN signal prior to releasing ACK for the REQ/ACK handshake of the message that is being rejected.
In the case of a Target, it moves to the MESSAGE IN phase and sends this message prior to requesting any additional message bytes from the Initiator. This ensures that the Initiator can check to see if the message is rejected or not before sending the remaining bytes of the message.
Note
This message must be implemented if any other optional messages are implemented.
- NOP = 8¶
 No-Operation (Optional, Out).
This message is sent to a Target in response to a request of the Initiator when there is no other messages to be sent.
- MSG_PARITY_ERR = 9¶
 Message Parity Error (Optional, Out).
This message is sent from an Initiator to the Target where one or more bytes of the last message had a parity error.
To send this message, the Initiator must indicate its intentions to do so. It does this by the same method as the
MESSAGE_REJECTmessage.
- LINK_CMD_COM = 10¶
 Linked Command Complete (Optional, In).
Note
This command is almost entirely identical to
LINK_CMD_COM_Fwith the only difference being that the flag bit of the command is not set.This message is sent to an Initiator to indicate that the execution of a linked command has completed and the status for it has been sent. The Initiator will then set the pointers to the initial state for the next linked command.
- LINK_CMD_COM_F = 11¶
 Linked Command Completed With Flag (Optional, In).
Note
This command is almost entirely identical to
LINK_CMD_COMwith the only difference being that the flag bit of the command is set.This message is sent to an Initiator to indicate that the execution of a linked command with the flag bit set has completed and the status for it has been sent. The Initiator will then set the pointers to the initial state for the next linked command.
This message is typically used to cause an interrupt in the Initiator between two linked commands.
- BUS_DEV_RESET = 12¶
 Bus Device Reset (Optional, Out).
This message is sent to a Target to tell it to clear all current commands on that SCSI device. It forces the SCSI device to an initial clean state with no pending operations for any Initiator on the bus.
When the Target receives this message, it must go to the BUS FREE phase.
- RESERVED_START = 13¶
 Start of Reserved Range.
The message codes between
RESERVED_STARTand :py:const`RESERVED_END` are all reserved for future possible standards.
- RESERVED_END = 127¶
 End of Reserved Range.
The message codes between
RESERVED_STARTand :py:const`RESERVED_END` are all reserved for future possible standards.
- IDENTIFY_START = 128¶
 Start of Identify Range (Optional, In/Out).
The message codes between
IDENTIFY_STARTand :py:const`IDENTIFY_END` are sent by either the Target or the Initiator to establish a physical path between a Target and Initiator for a particular LUN.These messages have a special format that sets them apart from all other messages as illustrated below.
7
6
5
4
3
2
1
0
1IReserved
LUN
Bit
7Is always set to a1to indicate that this is an IDENTIFY message.Bit
6Is only set to one if the message is coming from an Initiator, this is to indicate that it supports disconnection and reconnection.Bits
5thru3are reserved for future use.Bits
2thru0are the LUN number.Warning
Only one LUN can be identified for any one selection sequence. The bus must be released before a new IDENTIFY message with a new LUN can be issued.
Note
When sent to an Initiator from a Target during a reconnection, there is an implied
RESTORE_PTRmessage which should be completed by the Initiator before the completion of this message.
- IDENTIFY_END = 255¶
 End of Identify Range (Optional, In/Out).
The message codes between
IDENTIFY_STARTand :py:const`IDENTIFY_END` are sent by either the Target or the Initiator to establish a physical path between a Target and Initiator for a particular LUN.
- class squishy.scsi.messages.ExtendedMessageCodes(value)¶
 Message Codes for Extended SCSI Messages
Extended SCSI Messages roughly follow this format:
Byte
Value
Description
00x01Extended Message ID
1lMessage Length
2cMessage Code
3-Message Args Start
l+1-Message Args End
Note
The message length field is the number of bytes after and including that field.
- MODIFY_DATA_PTR = 0¶
 Modify Data Pointer (Optional).
This extended message is sent to the initiator from the target. It asks the initiator to add the signed 4 byte integer argument to the current data pointer.
Byte
Value
Description
00x01Extended Message ID
10x05Message Length
20x00Message Code
3oOffset (MSB)
4oOffset
5oOffset
6oOffset (LSB)
- SYNC_DATA_XFR_REQ = 1¶
 Synchronous Data Transfer Request (Optional).
Todo
Document better
Byte
Value
Description
00x01Extended Message ID
10x03Message Length
20x01Message Code
3tTransfer Period
4xREQ/ACK Offset
Note
The transfer period is in 4ns increments.
- EXTENDED_IDENT = 2¶
 Extended Identify Command (Optional).
This extended message may be sent by a target or initiator, and may be used in conjunction with the normal
IDENTIFYmessage to allow for an extended range for LUN addressing.Using the Sub-LUN byte to add 256 sub units to the target LUN allows for targets to have up to 2048 addressable units.
Byte
Value
Description
00x01Extended Message ID
10x02Message Length
20x02Message Code
3nSub-LUN Number
- RESERVED_START = 3¶
 Start of Reserved Range.
The message codes between
RESERVED_STARTand :py:const`RESERVED_END` are all reserved for future possible standards.
- RESERVED_END = 127¶
 End of Reserved Range.
The message codes between
RESERVED_STARTand :py:const`RESERVED_END` are all reserved for future possible standards.
- VENDOR_START = 128¶
 Start of Vendor Reserved Range.
The message codes between
VENDOR_STARTand :py:const`VENDOR_END` are all for vendor-specific extended messages.
- VENDOR_END = 255¶
 End of Vendor Reserved Range.
The message codes between
VENDOR_STARTand :py:const`VENDOR_END` are all for vendor-specific extended messages.