GENERAL INFORMATION 1 Introduction The MVME147 MPU VMEmodule contains a port to the Small Computer Systems Interface (SCSI) bus. The hardware interface is the WD33C93 SCSI interface controller. To relieve you of having to follow SCSI bus protocol, the SCSI firmware allows you to pass commands to the bus through high level command packets. Standard command packets are furnished, as well as custom SCSI sequence packets that you may easily modify to fit particular applications.
1 GENERAL INFORMATION Interrupt mode is the most processor-efficient mode of operation. Multitasking is allowed for TARGETs that support arbitration, reselection, and the message-out phase. When using the interrupt mode, you must specify the interrupt level in the packet description (refer to the packet descriptions in Chapter 7). The processor is returned to the caller; i.e.
MVME147 SCSI Firmware Entry Points 6. N ote $FFFE079A (RTE entry) Within the SCSI firmware, which can stand alone without the debug monitor, the first six longwords are the branch table entries referenced above. The hex offsets provided reside within the non-volatile RAM. The following are descriptions of the six entry points. For more detailed descriptions of their use, refer to the Interface Rules for Multiple Callers section in Chapter 5. $FFFE077C: COMMAND ENTRY Branches to FUNNEL entry.
1 GENERAL INFORMATION Interrupt Structure paragraph in Chapter 4) or SCSI bus activity is slowed down. Additional commands may be sent to the SCSI firmware for a different peripheral device. $FFFE078E: FUNNEL COMMAND ENTRY This entry point is used by applications that require multiple interfaces to the SCSI firmware. Unlike the single user command entry, you may issue commands anytime the firmware does not require an RTE to be performed.
Equipment Supported any particular controller, nor does Motorola assume responsibility for the operation of equipment manufactured by non-Motorola companies. Refer to Appendix A for information on how to use this firmware program.
1 GENERAL INFORMATION CONTROLLE R DEVICE CODE TYPE Streaming PART MANUFACTUR ER/MODEL NUMBER NOTES Tanberg 3660 (8535) 150Mb 6 TEAC MT2ST/45S2 2 Tape Cassette Tape CONTROLLE R DEVICE CODE TYPE 13 14 16 17 PART MANUFACTUR ER/MODEL 77777000 NOTES Winchester Seagate WREN IV 94171 Winchester Seagate WREN V 77777750 94181 2 Winchester Maxtor 4380S 2 1,2 Winchester Maxtor 8760S Winchester Seagate ST 157N/M 1,2,5 Winchester Seagate ST 125N/M 1,2,5 Winchester Seagate ST 10
Equipment Supported CONTROLLE R DEVICE CODE TYPE PART MANUFACTUR ER/MODEL NUMBER Floppy 18 8mm Tape NOTES 2,3 Exabyte EXB8200 820010-009 2 Devices Supported Under Common Command Set Winchester Televideo 7000/7400/3500 1,2 Floppy Televideo 7000/7400/3500 1002921-1B Winchester Seagate WREN III 94161 77774620 Winchester Seagate WREN IIIHH 94211 Winchester Micropolis 1375 900475-11-2B Winchester Seagate WREN IV 94171 77777000 Winchester Seagate WREN V 77777750 94181 2,4 Winchest
1 GENERAL INFORMATION 3. Common Command Set for floppy matches SCSI II rather than revision 17B. 4. Under Common Command Set the cache is not enabled on these devices. 5. Seagate /M means Motorola proprietary. 6. Firmware assembly order number is: 966096. Order number for tape drives is (85xx) as shown with drive type. Order from: Tanberg Data A/S, Data Storage Division, P.O. Box 9, Korsvoll N-0808, Oslo 8, Norway, Phone +47 2 18 90 90 or Tanberg Data Tech.
Manual Terminology MOTOROLA DOCUMENT TITLE M68000 16/32-Bit Microprocessor Programmer’s PUBLICATION NUMBER M68000UM Reference Manual M68000 Family VERSAdos System Facilities M68KVSF Reference Manual VERSAdos to VME Hardware and Software MVMEDOS Configuration User’s Manual NOTE: Although not shown in the above list, each Motorola Computer Group manual publication number is suffixed with characters which represent the revision level of the document, such as /D2 (the second revision of a manual); supp
1 GENERAL INFORMATION $ dollar specifies a hexadecimal number % percent specifies a binary number & ampersand specifies a decimal number Unless otherwise specified, all address references are in hexadecimal throughout this manual. An asterisk (*) following the signal name for signals which are level significant denotes that the signal is true or valid when the signal is low.
CUSTOM SCSI PACKETS 2 Introduction The SCSI firmware requests "canned" functions from SCSI disk controllers and from SCSI tape controllers. Some of these functions are disk read and write, disk format, tape read and write, and tape positioning operations. The "canned" functions are only provided for the supported SCSI devices that are listed in the Equipment Supported section in Chapter 1.
2 CUSTOM SCSI PACKETS FC B8 74 +$00 Controller LUN +$02 Status Byte 0 +$04 30 Device LUN Status Byte 1 (Note 1) Script Pointer (MSW) +$06 Script Pointer (LSW) +$08 Command Table Pointer (MSW) (Note 2) +$0A Command Table Pointer (LSW) (Note 2) +$0C 0 +$0E Flag = 0 +$10 0 0 0 0 0 0 Scatter/Gather Count +$12 0 0 0 +$14 0 0 Function Code (1C) 0 +$16 Interrupt Level Vector Number +$18 Status Byte 2 Status Byte 3 (Note 1) +$1A 0 0 Retry Count $00 00000xxx Control
Initiator Role Custom Packet $0E 00000000 $0F 00000000 $10 xxxxxxxx Initiator role (TARGET enable/sequence bit undefined) Reserved xxxxxxxx Scatter/gather entry count. No retry on firmware if scatter/gather DMA is used because command scatter/gather table could be modified after the command is complete if disconnect/reselect occurred.
2 CUSTOM SCSI PACKETS NOTES: 1. Refer to Chapter 3. 2. Command Table = 384 bytes RAM work area. This first class is used for command execution and/or message passing through the MVME147 SCSI firmware while the module is playing the initiator role. According to SCSI definition, an initiator is a SCSI device (usually a host system) which requests an operation to be performed by another SCSI device; a TARGET is a SCSI device which performs an operation requested by an initiator.
Initiator Role Custom Packet commonly called a "thread"). The script allows the SCSI firmware to follow the TARGET bus sequences and also allows the firmware to resume a disconnected thread once a disconnect/ reselect occurs. Because the SBC allows "multithreading" of SCSI commands on the SCSI bus, a script is necessary to resume any disconnected threads. Without a script, the SCSI firmware would not have any way to check whether the TARGET performed the command that was requested through the CDB.
2 CUSTOM SCSI PACKETS PHASE Message out DIRECTION initiator to TARGET NOTES Messages are sent to the TARGET to send bus, command, and controller information. Examples: identify, initiator detected error, abort, device reset. Scripts only specify the information transfer phases. The bus free, arbitration, and selection phases do not need to be specified in a script. The script codes that are understood by the MVME147 SCSI firmware are listed in the following table.
Initiator Role Custom Packet If you suspect data integrity error, you can set up the SCSI script to execute the data phase and then disconnect from the bus (script code 0x2c) or just return as an intermediate return without disconnect from the bus (script code 0x28). Firmware executes the data phase and then returns the firmware parity error status, if any, command packet, and command table back to you.
2 CUSTOM SCSI PACKETS FC +$00 B8 74 30 Status/Flag Byte Retry Count (00) +$02 Link Pointer (MSW) +$04 Link Pointer (LSW) +$06 Command Length +$08 SCSI Command Descriptor Block (CDB) +$0A SCSI Command Descriptor Block (CDB) +$0C SCSI Command Descriptor Block (CDB) +$0E SCSI Command Descriptor Block (CDB) +$10 SCSI Command Descriptor Block (CDB) +$12 +$14 SCSI Command Descriptor Block (CDB) SCSI Status Initiator SCSI Address (0 to 7) +$16 Data Length (MSW) +$18 Data Length (LSW)
Initiator Role Custom Packet Even Byte \ Odd Byte \ FC B8 74 +$68 +$6A 30 Transfer Address 0 0 0 0 +$6C 0 0 0 0 +$6E 0 0 0 0 +$70 0 0 0 +$72 Command +$74 0 Offset Sense Data Block . . . +$9E $00 Sense Data Block xxxxxxxx Status/flag byte 0....... Lnk -- link flag bit disabled 1....... Lnk -- link command tables, support linked commands .0...... Parity disabled .1...... Parity enabled -MVME147 checks SCSI bus parity ..0..... DMA on ..1.....
2 CUSTOM SCSI PACKETS status (Note 2) ...1.... CSCSI -- does not check SCSI status (Note 2) ....0... SCSI firmware uses SCSI rules (Note 3) ....1... SASI mode flag -firmware uses SASI rules (Note 3) .....1.. SG -- scatter/gather enable, use data points to scatter/gather table. During custom SCSI packet, you have to set this bit if scatter/gather DMA operation is required .....0.. SG -- scatter/gather disable ......1.
Initiator Role Custom Packet ......0. ASYNC -asynchronous transfers enable $01 00000000 Retry count (must be 00) $02 xxxxxxxx xxxxxxxx Link pointer (MSW) -for linked commands.
2 CUSTOM SCSI PACKETS the firmware status ($64) and sent to initiator. If you determine to use bit 1-4, such as data parity error, the firmware non-zero status on bit 1-4 has higher priority. You should load this byte with the appropriate status and set up the SCSI script for status phase before the target sequence packet is sent.
Initiator Role Custom Packet $1E xxxxxxxx xxxxxxxx Message-in length -bytes expected during message-in (max=258 for extended messages) $20 xxxxxxxx xxxxxxxx Message-in pointer (MSW) -- to RAM buffer where firmware stores received messages $22 xxxxxxxx xxxxxxxx Message-in pointer (LSW) $24 xxxxxxxx xxxxxxxx Message-out length -bytes expected to be transferred in message-out phase, has to be non-zero if message-out phase is required (max=258 for extended messages) $26 xxxxxxxx xxxxxxxx Mes
2 CUSTOM SCSI PACKETS $62 xxxxxxxx $64 xxxxxxxx xxxxxxxx Sector number in error (LSW) Initiator role - Status byte from SCSI controller (unchanged) TARGET role firmware determined SCSI status $65 xxxxxxxx $66 xxxxxxxx Reserved xxxxxxxx Transfer address -- for a read or write. This is the address of the next byte to be transferred. $68 xxxxxxxx xxxxxxxx Transfer address -- for a read or write. This is the memory address of the next byte to be transferred. . . . .
Initiator Role Custom Packet controller following a check status and a request sense data command. Valid information if bit 14 (additional status) is set. This block is firmware private area and only used on the INITIATOR role. . . . . $9E NOTE S: xxxxxxxx xxxxxxxx Sense data block 1. Points to scatter/gather table if scatter/gather bit = 1 in byte 0. 2.
2 CUSTOM SCSI PACKETS second command. The following linked command example may be performed on the Archive 2150 disk controller (it supports linked commands). The SCSI firmware does not support linked command with flag. PACKET FOR THE LINKED COMMAND EXAMPLE: PACKET DC.W $0400 CONTROLLER LEVEL=4, DEVICE LUN=0 DS.W 1 RETURNED STATUS WORD (BYTES 0 AND 1)+2 DC.L LSCRIPT SCRIPT POINTER +4 DC.L CT1 COMMAND TABLE POINTER +8 DC.W 0 RESERVED +C DC.W 0 INITIATOR ROLE CUSTOM SEQUENCE +E DC.W 0 RESERVED +10 DC.
Initiator Role Custom Packet *****************************COMMAND TABLE FOR THE FIRST COMMAND************** CT1 DC.B %11000000 * X LINK FLAG ON * X PARITY CHECKING ENABLED * X DMA ENABLED * X CUSTOM SEQ. FLAG=> FIRMWARE CHECKS STATUS * X FIRMWARE USES SCSI RULES (RESELECT, ETC.) * X RESERVED X NO SCATTER/GATHER OPERATION X ASYNC SCSI TRANSFER DC.B 0 RETRY COUNT=0 DC.L CT2 THE ADDRESS OF THE SECOND COMMAND TABLE DC.W 6 COMMAND LENGTH = 6 (GROUP 0 COMMAND) DC.B $08 READ COMMAND DC.
2 CUSTOM SCSI PACKETS *****************************COMMAND TABLE FOR THE WRITE COMMAND************** CT2 DC.B %01000000 * X LINK FLAG OFF * X PARITY CHECKING ENABLED * X DMA ENABLED * X CUSTOM SEQ. FLAG=> FIRMWARE CHECKS STATUS * X FIRMWARE USES SCSI RULES (RESELECT, ETC.) * X RESERVED. X NO SCATTER/GATHER X ASYNC SCSI TRANSFER DC.B 0 RETRY COUNT=0 DC.L 0 NO LINK ADDRESS PROVIDED. DC.W 6 COMMAND LENGTH = 6 (GROUP 0 COMMAND) DC.B $0A WRITE COMMAND DC.B $00 LUN=0, BLOCK ADDR MSB=0 DC.B $00 BLOCK ADDR DC.
TARGET Enable Custom Packet N ote A linked command with the flag bit set is not supported, and the flag bit is ignored if it is set. TARGET Enable Custom Packet The TARGET enable custom packet is shown in the following table.
2 CUSTOM SCSI PACKETS $03 xxxxxxxx Status from SCSI firmware (byte 1) (Note 1) $04 xxxxxxxx xxxxxxxx Not used $06 xxxxxxxx xxxxxxxx Not used $08 xxxxxxxx xxxxxxxx Command table pointer (MSW) (Note 2) $0A xxxxxxxx xxxxxxxx Command table pointer (LSW) (Note 2) $0C 00000000 00000000 Reserved $0E 1....... TARGET role .1...... TARGET enable ..
TARGET Enable Custom Packet This second "class" of custom packets is used to enable TARGET role service by the MVME147 SCSI firmware. All eight SCSI-defined logical units can be independently serviced through the firmware. Each logical unit needs to be enabled separately. In other words, a TARGET enable packet is sent for each logical unit that you want to service. The TARGET enable packet should not be deallocated even after TARGET is enabled and command is received (final return for TARGET enable).
2 CUSTOM SCSI PACKETS WORD $16: The interrupt level must be no-zero because TARGET role support is not used in non-interrupt mode. (If TARGET role support were done in polled mode, nothing else would be able to run on the MVME147 other than the TARGET firmware because the microprocessor would poll for a selection as a TARGET.) The vector number is used to provide the return path to you. (You take over that vector and point it to your service routine.
TARGET Sequence Custom Packet +$1A 0 0 Retry Count $00 00000xxx Controller logical unit number $01 00000xxx Device logical unit number $02 xxxxxxxx Status from SCSI firmware (byte 0) (Note 1) $03 xxxxxxxx Status from SCSI firmware (byte 1) (Note 1) $04 xxxxxxxx xxxxxxxx Script pointer (MSW) $06 xxxxxxxx xxxxxxxx Script pointer (LSW) $08 xxxxxxxx xxxxxxxx Command table pointer (MSW) (Note 2) $0A xxxxxxxx xxxxxxxx Command table pointer (LSW) (Note 2) $0C 00000000 00000000 R
2 CUSTOM SCSI PACKETS $19 xxxxxxxx Status from SCSI firmware (byte 3) (Note 1) $1A 00000000 Reserved $1B 0000xxxx Retry count must be 0 NOTES: 1. Refer to Chapter 3. 2. Command Table = 384 bytes RAM work area. This third "class" of custom packets is used to service received commands and messages for an enabled MVME147 TARGET logical unit.
TARGET Sequence Custom Packet WORDS $04 and $06: SCRIPT POINTER -- The address of the TARGET script to be performed to service the initiator request. In TARGET role, the MVME147 controls the SCSI bus. The TARGET script tells the firmware which information transfer phases to cycle through to service the initiator request that was encoded in the CDB. N ote In TARGET role, the names of the information transfer phases are consistent with initiator role.
2 CUSTOM SCSI PACKETS 3. During the message-in phase, the COMMAND COMPLETE message is sent to the initiator. 4. The END OF TARGET SCRIPT code causes the firmware to disconnect from the bus and return to you (through the vector provided in the TARGET sequence packet) with a final status of $xx18, indicating the TARGET script was completed successfully.
TARGET Sequence Custom Packet D7 = Not used by the TARGET role firmware. (This is the link bit. Command linking is not accomplished with the use of this bit.) D6 = Not used by the TARGET role firmware. (This is the parity bit. ) D5 = Not used by the TARGET role firmware. (This is the DMA disables bit. DMA is used in TARGET role: 0 = DMA, 1 = no DMA) D4 = MUST be zero. Not used by the TARGET role firmware. (This is the interpret bit and only relevant for initiator role.
2 CUSTOM SCSI PACKETS CT words $16 and $18: DATA LENGTH. The number of bytes to transfer during either the data-in or the data-out phase. Not used if DMA is enabled and SG bit is set in status/flag byte in word o. CT words $1A and $1C: DATA POINTER. If a DATA-IN code is in the TARGET script, the firmware starts transferring data FROM the contiguous data buffer pointed to by this pointer.
TARGET Sequence Custom Packet STATUS BYTES 2 and 3. Not used by the TARGET role firmware. Packet word $1A: RETRY COUNT. Not used by the TARGET role firmware.
2 CUSTOM SCSI PACKETS 2-30
PACKET RETURN STATUS 3 Packet Return Status When packets are returned to the user, they contain two status words: one with an offset of $02 and the other with an offset of $18, as shown in the tables below, respectively. The first table details the status codes contained in the word at offset $02. Refer to the Interface Rules for the SCSI Firmware section in Chapter 5 for additional information. Also, refer to the command table returned fields.
3 PACKET RETURN STATUS Bit 15 (FINALSTAT) 1 = Intermediate return. 0 = Final status. The script processing completed successfully, OR the script processing encountered a fatal error. N ote This does not mean that the operation that the user requested on the SCSI was successful. The status is contained in the status code (bits 7-0.
Packet Return Status Bit 2 (EOM) End of media. Bit 3 (FM) Filemark Bit 4 (COMMAND RETRY) 1 = Retries were performed. Bit 5 (COMMAND RETRY OVERFLOW) 1 = Retry overflow. The command was retried "retry count" times.
3 PACKET RETURN STATUS FC B8 74 30 +$00 . . +$60 Block Number in Error (MSW) +$62 +$64 Block Number in Error (LSW) SCSI Controller Status +$66 0 0 0 Transfer Address +$68 +$6A 0 Transfer Address 0 0 +$6C 0 0 0 0 +$6E 0 0 0 0 +$70 0 0 0 0 +$72 Command +$74 Offset Sense Data Block . .
Packet Return Status This is the memory address of the next byte to be transferred. $68 xxxxxxxx xxxxxxxx . . . . $72 Transfer address -- for a read or write. Command error status byte (valid following xxxxxxxx a command error $0B) $73 xxxxxxxx $74 xxxxxxxx Offset within packet. xxxxxxxx . . . . $9E xxxxxxxx xxxxxxxx Sense data block Sense data block Table 3-1. Packet Status Codes CODE MEANING NOTES Intermediate Return Codes $02 Wait for interrupt; command door open.
3 PACKET RETURN STATUS Table 3-1. Packet Status Codes CODE MEANING NOTES Intermediate Return Codes $09 (TARGET mode) data received from initiator with parity error, user must interpret then continue with new t_seq. 1,9 Final Return Codes 3-6 $00 GOOD. Script processing is OK. 2 $01 Undefined problem. 2 $02 TARGET has Received Data without error, and user may interpret then continue with new t_seq. 2 $03 Interrupt handler was entered with no pending IRQ ($F00050).
Packet Return Status Table 3-2. Packet Status Codes (cont’d) CODE MEANING NOTES $0A SCSI bus reset received (A1 pointing to packet list). (Refer to the SCSI Bus Reset Packet section in Chapter 7.) 2 $0B Command error (bad command code, bad timing, or command door was closed when a command was received) = 00. Custom SCSI sequence: controller level not equal to "147 local level", or interrupt not on. Format: format with defects on a con- troller type not supported.
3 PACKET RETURN STATUS Table 3-3. Packet Status Codes (cont’d) CODE MEANING NOTES $1B TARGET module rejected an initiator message and returned with this status to a particular LUN service routine. 2 $1C TARGET module sent a check status with an "illegal request" sense block to some initiator because the particular LUN that the initiator wanted was not enabled.
Packet Return Status Table 3-4. Packet Status Codes (cont’d) CODE MEANING NOTES $26 UNIT ATTENTION. Indicates that the removable media may have been changed or the TARGET has been reset. 2,3 $27 DATA PROTECT. Indicates that a command that reads or writes the medium was attempted on a block that is protected from this operation. 2,3 $28 BLANK CHECK.
3 PACKET RETURN STATUS Table 3-5. Packet Status Codes (cont’d) CODE MEANING NOTES Request-Sense-Data Error-Class 0 through 6 Codes (Controller-Dependent) 3-10 $40 NO ERROR STATUS. 2,5,6 $41 NO INDEX SIGNAL. 2,5,6 $42 NO SEEK COMPLETE. 2,5,6 $43 WRITE FAULT. 2,5,6 $44 DRIVE NOT READY. 2,5,6 $45 DRIVE NOT SELECTED. 2,5,6 $46 NO TRACK 00. 2,5,6 $47 MULTIPLE DRIVES SELECTED. 2,5,6 $49 CARTRIDGE CHANGED. 2,5,6 $4D SEEK IN PROGRESS. 2,5,6 $50 ID ERROR.
Packet Return Status NO TES : 1. Intermediate return codes. Bit 15-1, actual word=$80xx, $90xx, etc. 2. Final return codes. 3. Sense key status codes for Request-Sense-Data error -- class 7. An offset of $20 is added to all sense key codes. 4. The SCSI status sent from the controller is ANDed with $1E, shifted right one bit, and $30 added. 5. Sense key status codes for Request-Sense-Data error -- classes 0-6. An offset of $40 is added to all sense key codes. 6. Drive error codes. 7.
3 PACKET RETURN STATUS 3-12
SCSI FIRMWARE INTERRUPT STRUCTURE 4 SCSI Firmware Interrupt Structure The SCSI interface firmware was designed for processor efficiency. Whenever the SCSI bus is in a state that does not need monitoring, the firmware releases the processor so it may perform other functions such as user tasks and lower priority events. In these cases, an interrupt brings processor control back to the firmware. A return vector is provided to the SCSI firmware in all cases through the packet pointed to by register A2.
4 SCSI FIRMWARE INTERRUPT STRUCTURE the REACTIVATION entry point of the SCSI firmware. The WAIT FOR INTERRUPT (OPEN) status is usually given when a particular TARGET is "threaded" to the MVME147 on the SCSI bus, and is slow in transitioning between information transfer phases. A bus phase interrupt brings the processor back to the SCSI firmware to finish the command execution that was temporarily slowed down by the TARGET.
WRITING A DRIVER 5 Introduction This chapter covers information essential in writing a driver to support the SCSI interface in interrupt mode. A driver for non-interrupt mode is a trivial subset of the interrupt mode driver. The approach taken is to describe the major sections of a driver that need to be written. The examples shown have been extracted from the VERSAdos SCSI driver, and are dependent on the driver interface to the VERSAdos operating system. For this interface, see Figure 5-1.
5 WRITING A DRIVER Return from the SCSI firmware to the driver is done through the vector supplied in the packet. The VERSAdos driver uses vector $4E (offset $138), and tape driver uses vector $4D (offset $134). These vectors must be initialized to point to a driver routine which handles the return. Refer to the Interface Rules for the SCSI Firmware section in this chapter for details on the return. The SCSI firmware can accept six commands (average) per peripheral device.
Interface Rules for the SCSI Firmware information; it does imply that only one routine handles the exit conditions dictated by bit 13 of the second word in the user packet (also known as the status word). Multiple callers of the SCSI firmware are separate, independent drivers that handle SCSI returns without knowledge of other drivers/callers. This definition implies that more than one routine handles the exit conditions dictated by bit 13 of the first returned status word.
5 WRITING A DRIVER Command status processing is the result of a firmware return to the vector specified in the command packet. If this decoupling exists, the command entry execution can only occur if the processor is not tied up performing SCSI firmware functions or performing command status functions. That is, for the processor to execute the command entry functions, it cannot be at the same time executing command status functions.
Interface Rules for the SCSI Firmware RTE required, or the RTE entry ($FFFE079A) RTE required as status code $xx04 above. This intermediate status only happens when the TARGET role is enabled. CAUTION Care must be taken not to modify the contents of register A3 when the RTE entry is taken. Rule 3: ALL FINAL RETURNS MUST EXIT (THE DRIVER) PROPERLY THROUGH RTE, COMEAGAIN, OR REACTIVATION.
5 WRITING A DRIVER IF BIT 13 IS SET THEN RETURN TO THE CALLER OF YOUR CODE THROUGH (command 1. AN RTS IF HE CALLED YOU WITH A BSR/JSR thread) 2. AN RTE IF HE CALLED YOU WITH A TRAP THAT REQUIRES AN RTE RETURN. ELSE: (bit 13 is clear) 1. RESTORE THE REGISTER SET POINTED TO BY A3. (interrupt 2. SOMEHOW PERFORM THE RTE REQUIRED BY THE FIRMWARE. thread) SOME OPERATING SYSTEMS HAVE A COMMON INTERRUPT HANDLER THAT PERFORMS ALL RETURNS FROM INTERRUPT PROCESSING.
Interface Rules for the SCSI Firmware FUNNEL module queued the request and returned to you with a $A002 intermediate status code. In order for this packet to resume processing, the firmware sets the software interrupt to reenter the interrupt entry point ($FFFE0788). 3. The RTE condition receives third priority because if an RTE instruction was effectively executed before the command pending or before the queued commands were serviced, the command pending or the queued commands would never be serviced.
5 WRITING A DRIVER error because if a subsequent command is queued in the FUNNEL queue or the wait queue, no busy error is given. In average, a device could have one packet in FUNNEL queue, four packets in wait queue, and an active command in attach table. INTERFACE RULE SUMMARY FOR SCSI FIRMWARE USERS WITH MULTIPLE CALLERS: A typical system with multiple callers may have the following interfaces: 5-8 1. Disk driver: Handles all requests for SCSI disks. 2.
Interface Rules for the SCSI Firmware 9. TARGET LUN 6 service handler: Services requests for logical unit 6 of the MVME147 TARGET. 10. TARGET LUN 7 service handler: Services requests for logical unit 7 of the MVME147 TARGET. The summary below is intended to help users who have multiple callers to the SCSI firmware. 1. INTERMEDIATE RETURNS: xx02: PERFORM AN RTE (HOWEVER REQUIRED) IF BIT 13 OF THE RETURNED STATUS WORD IS 0 OR RETURN TO THE CALLER OF THE DRIVER/SERVER BY THE APPROPRIATE METHOD. E.G.
5 WRITING A DRIVER xx08: 2. SIMILAR TO xx08 ABOVE, ONLY THE DATA RECEIVED HAS SOME PARITY ERROR OCCURRED. FINAL RETURNS: STATUS WORD BIT 13: IF CLEAR, SOMEHOW RESTORE REGISTER (RTE) SET AND PERFORM AN RTE. IF SET, THE FIRST RETURN FROM THE SCSI FIRMWARE (COMMAND THREAD) AND THE USER SHOULD RETURN TO WHOMEVER CALLED THE DRIVER (RTS, ETC.).
Interface Rules for the SCSI Firmware MOVE.W 2(A2),D0 BTST #15,D0 BEQ FINALSTAT STATUS WORD TO D0. FINAL/INTERMEDIATE STATUS? IF 0, THE RETURN IS A FINAL ONE. ****************************************************************** ************ *THE FOLLOWING CODE CHECKS ALL ALLOWED INTERMEDIATE RETURN CODES. * CMP.
5 WRITING A DRIVER ****************************************************************** ************ ** * THE CODE BELOW HANDLES FINAL RETURN CODES. FINALSTAT: BSR POSTSTAT POSTSTAT IS A SUBROUTINE THAT POSTS FINAL STATUS * POSTSTAT RETURNS THE Z BIT=1 IF STATUS IS O.K. ****************************************************************** ************ ** * THE CODE BELOW IS A COMMON EXIT CODE FOR THIS DRIVER.
Interface Rules for the SCSI Firmware * RESTORE REGISTERS FOR SCSI ROUTINE * * * * The driver must restore the registers the SCSI firmware has used. A3 is pointing to a list of the registers to restore. The following code is for 68010 or newer processor and could be more efficient if more advanced processor as 68020, 68030 is used. * * Entry: * Exit: A3 = Pointer to register list of registers to restore. Back to caller. RESTORE_REG: MOVE.L #14,D0 ADDA.L #60,A3 Number of longwords to move = 15.
5 WRITING A DRIVER by the driver -- specifically, command queuing. If you choose to follow the rules for multiple callers, the firmware queues command packets for you whenever the bus is busy. For example, if a user of the SCSI interface only has disk applications, only a SCSI disk driver for the particular operating system may need to be written.
TARGET ROLE ROUTINES 6 Introduction According to SCSI definitions, an initiator is an SCSI device that initiates a command on the bus to be executed by the TARGET; a TARGET is an SCSI device that is selected by an initiator and executes what is requested by the initiator. The MVME147 is capable of playing both the initiator and TARGET roles with the WD33C93 SCSI interface chip.
6 TARGET ROLE ROUTINES particular device on the SCSI bus. The indexing is accomplished by simply splitting the 64 entries into 8 entries of 8 peripheral devices. Each block of eight devices corresponded to each SCSI device. The MVME147 is one of these SCSI devices. Seven other SCSI devices may be added to the SCSI bus to perform some application. As long as there is another SCSI device that can play the initiator role on the bus, then the MVME147 may also play the TARGET role on the bus.
MVME147 SCSI Firmware TARGET Role Structure Requirements Command Table pointer Script pointer Interrupt level 7 through 1 Return vector TARGET enable/TARGET sequence Control number = MVME147 level Peripheral device LUN (0 through 7) Script Below are the TARGET role script codes for SCSI bus phases.
6 TARGET ROLE ROUTINES Data Area Only one direction allowed per command. If multiple directions of data transfer are required, linked commands could provide a solution. Message-In Area (user defined) For messages to be sent to the initiator. Message-Out Area (user defined) 258 byte maximum for extended message for messages sent by initiator. Command Count The number of bytes command received in the command area. Command Area(s) Commands are stored in this 12-byte-maximum area.
Enabling TARGET Role enable (word $0E = $C000), and with the following data structures reserved for TARGET role service. a. N ote Command Table (384 bytes) During the TARGET role, when the TARGET enable packet is issued to the firmware, neither the custom command packet nor the command table shall be deallocated because firmware uses both areas for subsequent TARGET service. b.
6 TARGET ROLE ROUTINES the user command table. The service of this command is provided by you. This service is provided by a custom SCSI sequence -- TARGET sequence, which is described in the next section. IMPLEMENTATION NOTE: The TARGET LUN is deciphered from the identify message sent immediately after the selection phase. If the LUN identified during this phase is not enabled by you, the firmware rejects the message (by sending the MESSAGE REJECT message) and then disconnect from the bus.
Servicing the TARGET Requests service performed by the firmware is now complete. Finishing some housekeeping, the firmware returns to the user service routine for the selected LUN and gives it a final status code of $xx17. If initiator is not supporting disconnect, no message-in phase and the TARGET role returns an intermediate status $xx06 for command received. If firmware is not enabled, the target role will response to ’inquiry’, ’request sense’ commands with some meaningful data.
6 TARGET ROLE ROUTINES vu = vendor unique - = reserved f = flag l = link The operation code of $0A is for the SEND command. The LUN should match the logical unit for the MVME147 TARGET. The transfer length tells you how many bytes are going to be exchanged during the data-out phase. The flag and link bits are handled by the firmware and you only have to load a "INTERMEDIATE STATUS/GOOD STATUS" if the link bit was set and a "GOOD STATUS" if the link bit was clear.
Servicing the TARGET Requests STEP 3: Data Preparation a. Decode the transfer length from the command descriptor block and load this length into the command table words $16 and $18 -- data length. b. Decode the link bit and store the status to be sent to the initiator during the status phase into the STATUS word (MSB) of the command table -- word $64, even byte. c.
6 TARGET ROLE ROUTINES vu = vendor unique - = reserved f = flag l = link The operation code of $08 is for the RECEIVE command. The LUN should match the logical unit for the MVME147 TARGET. The transfer length tells you how many bytes are going to be exchanged during the data-out phase. The flag and link bits should be treated in the same manner as for the SEND command example above. (Not supported on the first release.
Servicing the TARGET Requests c. Decode the link and flag bits and store the proper message to be presented during the message-in phase into the message-in buffer (pointed to by words $20 and $22 of the command table). d. Create a TARGET sequence custom SCSI sequence packet as described in the TARGET Sequence Custom Sequence Packet section in Chapter 2. This packet should contain a pointer to the script described above and to the command table that was created or used.
6 TARGET ROLE ROUTINES 6-12
SCSI PACKETS 7 Introduction Command packets for the SCSI functions are listed in Table 7-1. The command packets are described in detail in the following paragraphs. Table 7-1.
7 SCSI PACKETS Table 7-2. SCSI Functions (cont’d) SCSI FUNCTION CODE DESCRIPTION $4C Reserved $50 Inquiry $54 Load/Unload $58 Recover Buffer Data $5C Request Sense Data $60 Check Status $64 Reserve Device $68 Release Device $6C New Tape Attach $70 New Read (disk and tape) $74 New Write (disk and tape) $78 New Disk Attach $7C Open (read of first blocks of a device) Read/Write Packet For common command set refer to Appendix A. DISK.
Read/Write Packet space-to-end-of-recorded-media, or write command. To read, the controller must be at BOT or following a space-blocks, space-filemarks, or read command. The command control field gives the user the ability to read forward or reverse (if supported by drive) and the ability to suppress illegal length indication (if supported by drive). DISK and TAPE.
7 SCSI PACKETS $00 00000xxx Controller logical unit number $01 00000xxx Device logical unit number $02 xxxxxxxx Status from SCSI firmware (byte 0) (Note 1) $03 xxxxxxxx Status from SCSI firmware (byte 1) (Note 1) $04 xxxxxxxx xxxxxxxx Memory Address (MSW)/scatter/gathe r table address if scatter/gather count >0 $06 xxxxxxxx xxxxxxxx Memory Address (LSW)/scatter/gather table address if scatter/gather count >0 $08 xxxxxxxx xxxxxxxx Sector Number (MSW) $0A xxxxxxxx xxxxxxxx Sector
Read/Write Packet in SG table, if zero, SG is disabled $12 00000000 00000000 Reserved $14 xxxxxxxx Command Control 0....... Cache ON for type 13 controller only 1....... Cache OFF for type 13 controller only .0...... Tape read forward for tape devices that support this .1...... Tape read reverse for tape devices that support this ..0..... Tape do not suppress illegal length indication for tape devices that support this ..1.....
7 SCSI PACKETS NOTE S: 1. Refer to Chapter 3. 2. Refer to the following scatter/gather table format. 3. The interrupt level of this firmware can be from level 0 to 7. It should be kept the same throughout the firmware execution; i.e., when the user has chosen a specific interrupt level, it must not be changed until there is no outstanding command. 4. The return vector should point to the user return routine at all times for the proper return path. 5.
Read/Write Packet +$12 0 +$14 Command Control 0 0 0 +$16 Interrupt Level Vector Number +$18 Status Byte 2 Status Byte 3 (Note 1) Function Code (00, 04) $00 00000xxx Controller logical unit number $01 00000xxx Device logical unit number $02 xxxxxxxx Status from SCSI firmware (byte 0) (Note 1) $03 xxxxxxxx Status from SCSI firmware (byte 1) (Note 1) $04 xxxxxxxx xxxxxxxx Memory Address (MSW)/scatter/gathe r table address if scatter/gather count >0 $06 xxxxxxxx xxxxxxxx Memory
7 SCSI PACKETS in SG table, if zero, SG is disabled $12 00000000 00000000 Reserved $14 xxxxxxxx Command Control 0....... Cache ON for type 13 controller only 1....... Cache OFF for type 13 controller only .0...... Tape read forward for tape devices that support this .1...... Tape read reverse for tape devices that support this ..0..... Tape do not suppress illegal length indication for tape devices that support this ..1.....
Read/Write Packet NOTE S: 1. Refer to Chapter 3. 2. Refer to the following scatter/gather table format. 3. The interrupt level of this firmware can be from level 0 to 7. It should be kept the same throughout the firmware execution; i.e., when the user has chosen a specific interrupt level, it must not be changed until there is no outstanding command. 4. The return vector should point to the user return routine at all times for the proper return path. 5.
7 SCSI PACKETS NOTES: There may be any number of scatter/gather entries. The scatter/gather table must be in local MVME147 RAM (the DMA channel does not table walk offboard RAM). Table address must be longword aligned. Attach/Detach Packet (all devices) For common command set refer to Appendix A.
Attach/Detach Packet (all devices) DEVICE TAPE COMMAND CONTROLLER NAME COMMAND NOTES Rewind $01 A rewind command is sent (2.0 firmware and later) because many tape devices require the tape to be at BOT to send a mode select command. Reserve device $16 Executed on attach if reserveon-attach/release-on-detach bit is set in packet. A reserve device command is sent to the controller. A reserve device command can be used in a multi-initiator SCSI environment to reserve the device.
7 SCSI PACKETS Some SCSI controllers return a "check" status on the first command sent to them after power-up or reset. The SCSI firmware retries the command if the controller returns "unit attention" request sense information and if you put a number that was one or greater into the retry field in the attach packet. Otherwise, the request-sense data is returned to you. You can then retry the command. The first table below shows the details of an attach/detach packet for disk.
Attach/Detach Packet (all devices) +$1E +$20 Pointer RAM Work Area (LSW) +$28 $00 Pointer RAM Work Area (MSW) +$24 Alt Sectors per Zone +$22 Logical Bytes per Block +$26 No.
7 SCSI PACKETS ........ .......0 FM encoding, single density ........ .......1 MFM encoding, double density ........ ......0. Single track density (media TPI = ½ drive TPI, double step) ........ ......1. Double track density (media TPI = drive TPI) ........ ........ Reserved ........ ....0... 250K bits/sec data rate (5¼ inch) ........ ....1... 500K bits/sec data rate (8 inch) ........ ...0.... Floppy media ........ ...1.... Rigid media ........ ..0.....
Attach/Detach Packet (all devices) $12 xxxxxxxx Controller type (refer to controller type table) $13 00000000 Drive type (0 = random access drive) $14 00000000 Reserved $15 xxxx1x00 SCSI function ($08 = attach, $78 = new attach, $16 000000xx Interrupt level (7 through 0) (0 = polled mode) $17 xxxxxxxx Vector number to use upon return $18 xxxxxxxx Status from SCSI firmware (byte 2) (Note 1) $19 xxxxxxxx Status from SCSI firmware (byte 3) (Note 1) $1A 00000000 Reserved $1B xxxxxxx
7 SCSI PACKETS $20 xxxxxxxx xxxxxxxx Address of 384-byte SCSI RAM area (MSW) $22 xxxxxxxx xxxxxxxx Address of 384-byte SCSI RAM area (LSW) This SCSI RAM work area cannot be deallocated or moved except after a detach or reset command. The firmware uses this area for the SCSI CDB and local pointers and variables.
Attach/Detach Packet (all devices) attributes (byte offset $10). $29 Alternate cylinders defines the number of xxxxxxxx alternate cylinders per disk that are to be reserved at the end of the disk for alternates. 1. NOTE: Refer to Chapter 3.
7 SCSI PACKETS +$20 RAM Work Area Address (MSW) +$22 RAM Work Area Address (LSW) $00 00000xxx Controller logical unit number (SCSI $01 00000xxx Device logical unit number (0-7) $02 xxxxxxxx Status from SCSI firmware (byte 0) (Note 1) $03 xxxxxxxx Status from SCSI firmware (byte 1) (Note 1) $04 00000000 Reserved $05 xxxxxxxx Step Rate -- number of 40 intervals per address 0-7) step (a value of 0 defaults to 6 ms) $06 00000000 Reserved $07 xxxxxxxx Number of heads on drive $08
Attach/Detach Packet (all devices) ........ ......0. Single track density (media TPI = ½ drive TPI, ........ ......1. Double track density (media TPI = drive TPI) ........ ........ Reserved ........ ....0... 250K bits/sec data rate (5¼ inch) ........ ....1... 500K bits/sec data rate (8 inch) ........ ...0.... Floppy media ........ ...1.... Rigid media ........ ..0..... No reserve on attach; no release on detach ........ ..1..... Reserve on attach; release on detach ........ .0..
7 SCSI PACKETS $13 00000000 Drive type (0 = random access drive) $14 00000000 Reserved $15 xxxx1x00 SCSI function ($08 = attach, $78 = new attach, $16 000000xx Interrupt level (7 through 0) (0 = polled mode) $17 xxxxxxxx Vector number to use upon return $18 xxxxxxxx Status from SCSI firmware (byte 2) (Note 1) $19 xxxxxxxx Status from SCSI firmware (byte 3) (Note 1) $1A 00000000 Reserved $1B xxxxxxxx Retry count: number of SCSI commands $0C = detach) (if this is set to 0, the fi
Attach/Detach Packet (all devices) be described as either a track or a cylinder, as specified by bit 11 of the SCSI drive attributes (byte offset $10). $1F Alternate cylinders defines the number of xxxxxxxx alternate cylinders per disk that are to be reserved at the end of the disk for alternates.
7 SCSI PACKETS 3½, 5¼ 3½, 5¼, 8 3½, 5¼ 250K B/S Data 500K B/S Data 250K B/S Data 3½, 5¼ 500K B/S Data Rate Rate Rate Rate Step Rate 0 0 0 0 Heads 2 2 2 2 $50 or $4D 8 in.
Attach/Detach Packet (all devices) +$04 0 0 Number of Tracks +$06 0 0 Minimum Read Transfer +$08 0 0 Minimum Write Transfer +$0A 0 0 Streaming Count +$0C +$0E Speed Code Density Code 0 0 +$10 Controller Type 0 +$16 +$1C Drive Type 0 Interrupt Level +$18 +$1A 0 SCSI Tape Attributes +$12 +$14 0 Vector Number Status Byte 2 0 Function Code (6C) Status Byte 3 (Note 1) 0 Retry Count Physical Bytes per Block (0 for Variable) (Note 2) +$1E +$20 Pointer to RAM Work Area (LSW)
7 SCSI PACKETS $07 00000000 Minimum read transfer size (not used by all $08 00000000 Reserved $09 xxxxxxxx Minimum write transfer size (not used by all $0A 00000000 Reserved $0B xxxxxxxx Streaming count (not used by all controllers) $0C 00000000 Speed code ($00 = default speed) controllers controllers $00 = use default speed $01 = lowest speed select $02 = higher speed select . .
Attach/Detach Packet (all devices) $05 1/4" 4/9 QIC-24 Cartridge Serial $06 1/2" 9 Reel-to-reel Parallel 8000 GC 3200 PE $0E 00000000 $10 xxxxxxxx xxxxxxxx SCSI tape attributes ........ .......0 Non-buffered writes (Note 3) ........ .......1 Buffered writes (Note 3) ........ ..0..... No reserve on attach; no release on detach ........ ..1.....
7 SCSI PACKETS (if this is set to 0, the firmware disables correction and turns off retries in the controller. Also, the firmware does not automatically retry the SCSI command except "unit attention" and "not diagnostics".
Attach/Detach Packet (all devices) Even Byte \ Odd Byte \ FC B8 74 30 +$00 Controller LUN Device LUN +$02 Status Byte 0 Status Byte 1 (Note 1) +$04 0 0 Number of Tracks +$06 0 0 Minimum Read Transfer +$08 0 0 Minimum Write Transfer +$0A 0 0 Streaming Count +$0C 0 0 0 0 +$0E 0 0 0 0 +$10 SCSI Tape Attributes +$12 +$14 Controller Type 0 +$16 0 Function Code (28) Interrupt Level +$18 +$1A Drive Type Vector Number Status Byte 2 0 Status Byte 3 (Note 1) 0 +$1C R
7 SCSI PACKETS $04 00000000 Reserved $05 00000000 Number of tracks on media (not used by all controllers $07 00000000 Minimum read transfer size (not used by all $08 00000000 Reserved $09 xxxxxxxx Minimum write transfer size (not used by all $0A 00000000 Reserved $0B xxxxxxxx Streaming count (not used by all controllers) $0C 00000000 00000000 Reserved $0E 00000000 00000000 Reserved $10 xxxxxxxx xxxxxxxx Tape drive attributes ........ .......
Attach/Detach Packet (all devices) $16 Interrupt level (7 through 0) (0 = polled 00000xxx mode) $17 xxxxxxxx Vector number to use upon return $18 xxxxxxxx Status from SCSI firmware (byte 2) (Note 1) $19 xxxxxxxx Status from SCSI firmware (byte 3) (Note 1) $1A xxxxxxxx Reserved $1B xxxxxxxx Retry count: number of SCSI commands (if this is set to 0, the firmware disables correction and turns off retries in the controller.
7 SCSI PACKETS 2. N ote Buffered writes are used to allow time for additional data to be transferred, thus keeping the tape streaming. If non-buffered, controller returns status only after all data has been written to the tape. If buffered, controller returns a good status when all data has been transferred to the buffer, although all data may not yet have been written to the tape. This work area is used by the SCSI firmware to build the SCSI command and to return additional information.
Attach/Detach Packet (all devices) . . +$9E $00 Sense Data Block xxxxxxxx . . . xxxxxxxx Reserved . . . $60 xxxxxxxx xxxxxxxx Block number in error (MSW) (Note 1) $62 xxxxxxxx xxxxxxxx Block number in error (LSW) (Note 1) $64 xxxxxxxx Status byte from SCSI controller (unchanged) $65 xxxxxxxx Reserved $66 xxxxxxxx xxxxxxxx Transfer address (MSW) -- for a read or write operation only. This is the address of the next byte to be transferred. (Rest to 0 is scatter/ gather is used.
7 SCSI PACKETS $72 Command error status byte (valid following a xxxxxxxx command error $08) - SCSI command in error. $73 xxxxxxxx $74 xxxxxxxx Offset within packet xxxxxxxx Sense data block (controllerdependent). This is the information returned by the controller following a check status and a request sense data command. Valid information if bit 14 (additional status) is set . . . . . . $9E NOTE S: xxxxxxxx 1.
Assign Alternate Sector Packet (SCSI) COMMAND CONTROLLER NAME COMMAND NOTES Mode select $15 Configures the controller for drive operational parameters. Format device $04 Formats drive. Format device $04 Formats drive. DEVICE Winchester Floppy The defect list is optional for this command. If the number of defects in the defect list is 0, a format device command with no defects is sent to the controller. If the field is nonzero, the defect list is sent to the controller.
7 SCSI PACKETS +$0E Interleave Factor 0 0 0 0 0 0 +$10 0 0 +$12 0 0 +$14 Command Control +$16 Interrupt Level Vector Number +$18 Status Byte 2 Status Byte 3 (Note 1) Function Code (10, 14) $00 00000xxx Controller logical unit number $01 00000xxx Device logical unit number $02 xxxxxxxx Status from SCSI firmware (byte 0) (Note 1) $03 xxxxxxxx Status from SCSI firmware (byte 1) (Note 1) $04 xxxxxxxx xxxxxxxx Number of defects (0 = no defect list) $06 xxxxxxxx xxxxxxxx
Assign Alternate Sector Packet (SCSI) 7 6 5 4 3 2 1 0 CL DP DC SF R R R R CL Complete List Clear and no defect list is supplied. Use existing grown defect list, no user list is supplied. Clear and defect list is supplied. Use existing grown defect list, add user list to the grown list. Set and no defect list is supplied. Do not use existing grown defect list, no user list is supplied. Set and defect list is supplied.
7 SCSI PACKETS $17 xxxxxxxx Vector number to use upon return $18 xxxxxxxx Status from SCSI firmware (byte 2) (Note 1) $19 xxxxxxxx Status from SCSI firmware (byte 3) (Note 1) 1. NOTE: Refer to Chapter 3. DEFECT LIST TYPE 0 Even Byte \ Odd Byte \ FC B8 74 30 +$00 Defect List Code = 0000 (Note 1) +$02 Reserved (Note 1) +$04 Reserved (Note 1) +$06 Sector Number (MSW) (Note 1, 2) +$08 Sector Number (LSW) (Note 1, 2) . . .
Assign Alternate Sector Packet (SCSI) . .
7 SCSI PACKETS Head Bytes from Index (MSW) (Note 2) Bytes from Index (LSW) (Note 2) $00 00000000 00000000 Defect list code $02 xxxxxxxx xxxxxxxx Reserved $04 xxxxxxxx xxxxxxxx Reserved $06 xxxxxxxx xxxxxxxx Sector number (MSW) (Note 5) $08 xxxxxxxx xxxxxxxx Sector number (LSW) (Note 5) . . . . . . xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx Sector number (MSW) (Note 5) Sector number (LSW) (Note 5) The packet points to the defect list.
SCSI Bus Reset Packet 2. N entries (ascending order). 3. Filled in by SCSI firmware if needed. 4. 2N entries. 5. 4N number of bytes. SCSI Bus Reset Packet This function activates the RST* (RESET) line on the SCSI bus (hardware reset). All devices on the bus are reset and any commands that were pending are terminated. The SCSI firmware cleans up internal flags and the status returned to the user is "command complete" ($00). All outstanding packets are returned with a "reset status" ($0A).
7 SCSI PACKETS $00 Controller logical unit number 00000000 (controller reset only) $01 00000000 Reserved $02 xxxxxxxx Status from SCSI firmware (byte 0) (Note 1) $03 xxxxxxxx Status from SCSI firmware (byte 1) (Note 1) $04 00000000 00000000 Reserved $06 00000000 00000000 Reserved $08 00000000 00000000 Reserved $0A 00000000 00000000 Reserved $0C 00000000 00000000 Reserved $0E 00000000 00000000 Reserved $10 00000000 00000000 Reserved $12 00000000 00000000 Reserved
SCSI Controller Reset Packet SCSI Controller Reset Packet This function sends a bus device reset message ($0C) to the controller specified in the packet. All outstanding packets are returned with a "reset status" ($0A). This command affects only the specified controller. After the controller reset command, the user has to send an "attach" command to SCSI firmware in order to interface with the controller again because the specified controller attach table entry is cleared.
7 SCSI PACKETS +$12 0 0 0 +$14 0 0 Function Code (2C) 0 +$16 Interrupt Level Vector Number +$18 Status Byte 2 Status Byte 3 (Note 1) $00 00000000 Controller logical unit number $01 00000000 Device logical unit number $02 xxxxxxxx Status from SCSI firmware (byte 0) (Note 1) $03 xxxxxxxx Status from SCSI firmware (byte 1) (Note 1) $04 00000000 00000000 Reserved $06 00000000 00000000 Reserved $08 00000000 00000000 Reserved $0A 00000000 00000000 Reserved $0C 0000000
Rewind Packet NOTE: 1. Refer to Chapter 3. Rewind Packet The Rewind command ($01) rewinds the tape to the BOT. If the immediate response bit is set, status is returned immediately, even though the controller is still busy rewinding. If a new command is sent before the controller is finished, a busy status may be sent to the MVME147, but the firmware performs an internal retry after the current command is done. If the immediate response bit is not set, status is not returned until the drive is finished.
7 SCSI PACKETS $01 00000000 Device logical unit number $02 xxxxxxxx Status from SCSI firmware (byte 0) (Note 1) $03 xxxxxxxx Status from SCSI firmware (byte 1) (Note 1) $04 00000000 00000000 Reserved $06 00000000 00000000 Reserved $08 00000000 00000000 Reserved $0A 00000000 00000000 Reserved $0C 00000000 00000000 Reserved $0E x0000000 Immediate response flag 0....... Respond when complete 1.......
Read Block Limits Packet Read Block Limits Packet The read block limits command ($05) returns the maximum and minimum block size written on the tape. The controllers supported by the SCSI firmware only support QIC 24 or QIC 11 type blocks which equal 512 ($200) bytes. The table below shows the read block limits packet.
7 SCSI PACKETS $04 xxxxxxxx xxxxxxxx Returned maximum block length (MSW) $06 xxxxxxxx xxxxxxxx Returned maximum block length (LSW) $08 xxxxxxxx xxxxxxxx Returned minimum block length $0A 00000000 00000000 Reserved $0C 00000000 00000000 Reserved $0E 00000000 00000000 Reserved $10 00000000 00000000 Reserved $12 00000000 00000000 Reserved $14 00000000 Reserved $15 00110100 SCSI function ($34 = read block limits) $16 000000xx Interrupt level (7 through 0) (0 = polled $
Space (Blocks, Filemarks, End of Recorded Media) Packet mode $02 = Space sequential filemarks (if supported by drive mode $03 = Space to end of recorded media where n = number of blocks or filemarks to Space. Some drives support spacing backwards by using negative 2’s complement number n. Refer to the drive manual. The table below shows the space packet.
7 SCSI PACKETS $02 xxxxxxxx Status from SCSI firmware (byte 0) (Note 1) $03 xxxxxxxx Status from SCSI firmware (byte 1) (Note 1) $04 xxxxxxxx xxxxxxxx Number of blocks/filemarks (MSW) (only 3 $06 xxxxxxxx xxxxxxxx Number of blocks/filemarks (LSW) (only 3 bytes used) bytes used) $08 00000000 00000000 Reserved $0A 00000000 00000000 Reserved $0C 00000000 00000000 Reserved $0E 000000xx Mode ......00 Space blocks ......01 Space filemarks ......10 Space sequential filemarks .
Write Filemarks Packet $19 Status from SCSI firmware (byte 3) (Note 1) xxxxxxxx NOTE: 1. Refer to Chapter 3. Write Filemarks Packet The write filemarks command ($10) writes the specified number of filemarks to the tape. N ote The controller must be in general mode or write mode. Refer to tape read/write packet for more information. The table below shows the write filemarks packet.
7 SCSI PACKETS $00 00000xxx Controller logical unit number $01 00000xxx Device logical unit number $02 xxxxxxxx Status from SCSI firmware (byte 0) (Note 1) $03 xxxxxxxx Status from SCSI firmware (byte 1) (Note 1) $04 xxxxxxxx xxxxxxxx Number of filemarks $06 00000000 00000000 Reserved $08 00000000 00000000 Reserved $0A 00000000 00000000 Reserved $0C 00000000 00000000 Reserved $0E 00000000 00000000 Reserved $10 00000000 00000000 Reserved $12 00000000 00000000 Rese
Verify CRC Packet Verify CRC Packet The verify Cyclic Redundancy Character (CRC) command ($13) instructs the controller to read the specified number of blocks and check the CRC of each block. The verify begins at the current tape position and the tape is left positioned at the end of the last block verified. No data is transferred to the MVME147 during this operation. N ote The controller must be in general or read mode. The table below shows the verify CRC packet.
7 SCSI PACKETS $02 xxxxxxxx Status from SCSI firmware (byte 0) (Note 1) $03 xxxxxxxx Status from SCSI firmware (byte 1) (Note 1) $04 xxxxxxxx xxxxxxxx Number of blocks $06 00000000 00000000 Reserved $08 00000000 00000000 Reserved $0A 00000000 00000000 Reserved $0C 00000000 00000000 Reserved $0E 00000000 00000000 Reserved $10 00000000 00000000 Reserved $12 00000000 00000000 Reserved $14 00000000 Reserved $15 01000000 SCSI function ($40 = verify CRC) $16 00000xxx
Tape Mode Select/Sense Packet The table below shows the tape mode select/sense packet. Even Byte \ Odd Byte \ FC B8 +$00 74 30 Controller LUN +$02 Device LUN Status Byte 0 Status Byte 1 (Note 1) +$04 0 0 Number of Tracks +$06 0 0 Min. Read Transfer +$08 0 0 Min.
7 SCSI PACKETS $05 xxxxxxxx Number of tracks on media (4 or 9) $06 00000000 Reserved $07 xxxxxxxx Minimum read transfer size (controller reconnects when it can take specified number of blocks in the spec) $08 00000000 Reserved $09 xxxxxxxx Minimum write transfer size (controller reconnects when it can take specified number of blocks in the spec) $0A 00000000 $0B xxxxxxxx $0C 00000000 00000000 $0E 00000000 00000000 Reserved $10 xxxxxxxx xxxxxxxx SCSI drive attributes ........
Inquiry Packet $17 xxxxxxxx Vector number to use upon return $18 xxxxxxxx Status from SCSI firmware (byte 2) (Note 1) $19 xxxxxxxx Status from SCSI firmware (byte 3) (Note 1) $1A 00000000 00000000 Reserved $1C xxxxxxxx xxxxxxxx Bytes per block NOT E: 1. Refer to Chapter 3. 2. Buffered writes are used to allow time for additional data to be transferred, thus keeping the tape streaming. If non- buffered, controller returns status only after all data has been written to the tape.
7 SCSI PACKETS +$00 Controller LUN Device LUN +$02 Status Byte 0 Status Byte 1 (Note 1) +$04 0 0 +$06 +$08 +$0A Inquiry Data Length Inquiry Data Pointer (MSW) Inquiry Data Pointer (LSW) 0 0 0 0 +$0C 0 0 0 0 +$0E 0 0 0 0 +$10 0 0 0 0 +$12 0 0 0 0 +$14 0 0 Function Code (50) +$16 Interrupt Level Vector Number +$18 Status Byte 2 Status Byte 3 (Note 1) $00 00000xxx Controller logical unit number $01 00000xxx Device logical unit number $02 xxxxxxxx Status fr
Inquiry Packet $14 00000000 Reserved $15 01000000 SCSI function ($50 = inquiry) $16 000000xx Interrupt level (7 through 0) (0 = polled $17 xxxxxxxx Vector number to use upon return $18 xxxxxxxx Status from SCSI firmware (byte 2) (Note 1) $19 xxxxxxxx Status from SCSI firmware (byte 3) (Note 1) mode) 1. NOTE: Refer to Chapter 3.
7 SCSI PACKETS +$1A Data Returned Data Returned +$1C Data Returned Data Returned +$1E Data Returned Data Returned $00 Device type code (00 = direct access) xxxxxxxx (01 = sequential access) (7F = logical unit not present) $01 $02 Device type qualifier xxxxxxxx 0....... Fixed media 1....... Removable media 00xxxxxx SCSI version .....xxx ANSI version (0 = version is unspecified) (1 = this version) ECMA version (0 = no claim of compliance ..xxx...
Load/Unload Packet $1E xxxxxxxx xxxxxxxx Data returned (Note 1) 1. NOTE: Controller-specific. Load/Unload Packet The load/unload command ($1B) positions the tape for removal or to BOT. The load mode positions the tape at BOT, and the unload mode positions the tape at End Of Tape (EOT). The retension bit causes the tape to go to BOT, then to EOT, then to BOT for the load mode. This is done before the load or unload function, if enabled.
7 SCSI PACKETS 0 +$14 0 0 0 0 0 Function Code (54) +$16 Interrupt Level Vector Number +$18 Status Byte 2 Status Byte 3 (Note 1) $00 00000xxx Controller logical unit number $01 00000xxx Device logical unit number $02 xxxxxxxx Status from SCSI firmware (byte 0) (Note 1) $03 xxxxxxxx Status from SCSI firmware (byte 1) (Note 1) $04 00000000 00000000 Reserved $06 00000000 00000000 Reserved $08 00000000 00000000 Reserved $0A 00000000 00000000 Reserved $0C 00000000 000000
Recover Buffer Data Packet $14 00000000 Reserved $15 01010100 SCSI function ($54 = load/unload) $16 00000xxx Interrupt level (7 through 0) (0 = polled $17 xxxxxxxx Vector number to use upon return $18 xxxxxxxx Status from SCSI firmware (byte 2) (Note 1) $19 xxxxxxxx Status from SCSI firmware (byte 3) (Note 1) mode) 1. NOTE: Refer to Chapter 3.
7 SCSI PACKETS +$0C Number of Blocks +$0E 0 0 0 0 +$10 0 0 0 0 +$12 0 0 0 0 +$14 0 0 Function Code (58) +$16 Interrupt Level Vector Number +$18 Status Byte 2 Status Byte 3 (Note 1) $00 00000xxx Controller logical unit number $01 00000xxx Device logical unit number $02 xxxxxxxx Status from SCSI firmware (byte 0) (Note 1) $03 xxxxxxxx Status from SCSI firmware (byte 1) (Note 1) $04 xxxxxxxx xxxxxxxx Memory address (MSW) $06 xxxxxxxx xxxxxxxx Memory address (LSW)
Request Sense Data Packet $18 xxxxxxxx Status from SCSI firmware (byte 2) (Note 1) $19 xxxxxxxx Status from SCSI firmware (byte 3) (Note 1) 1. NOTE: Refer to Chapter 3. Request Sense Data Packet The request sense data command ($03) returns the status of the controller. The maximum length parameter and the data pointer are used to return this status. The actual format and the number of bytes returned is controller- specific. Refer to the appropriate controller manual for information.
7 SCSI PACKETS $00 00000xxx Controller logical unit number $01 00000xxx Device logical unit number $02 xxxxxxxx Status from SCSI firmware (byte 0) (Note 1) $03 xxxxxxxx Status from SCSI firmware (byte 1) (Note 1) $04 00000000 Reserved $05 xxxxxxxx Maximum data length $06 xxxxxxxx xxxxxxxx Returned data pointer (MSW) $08 xxxxxxxx xxxxxxxx Returned data pointer (LSW) $0A 00000000 00000000 Reserved $0C 00000000 00000000 Reserved $0E 00000000 00000000 Reserved $10 000000
Check Status Packet NOTE: 1. Refer to Chapter 3. Check Status Packet The check status command ($60) senses a $00 test unit ready command to the device. The returned status is in the 4 status bytes (refer to Returned Status Command Table in Chapter 3). The table below shows the check status packet.
7 SCSI PACKETS $02 xxxxxxxx Status from SCSI firmware (byte 0) (Note 1) $03 xxxxxxxx Status from SCSI firmware (byte 1) (Note 1) $04 00000000 00000000 Reserved $06 00000000 00000000 Reserved $08 00000000 00000000 Reserved $0A 00000000 00000000 Reserved $0C 00000000 00000000 Reserved $0E 00000000 00000000 Reserved $10 00000000 00000000 Reserved $12 00000000 00000000 Reserved $14 00000000 Reserved $15 00101100 SCSI function ($60 = erase $16 000000xx Interrupt le
Open Packet Even Byte \ Odd Byte \ FC B8 74 30 +$00 Controller LUN Device LUN +$02 Status Byte 0 Status Byte 1 +$04 Memory Address +$06 +$08 +$0C Maximum +$0A Number of Bytes to Transfer Maximum Number of Logical Bytes to Transfer +$0E +$10 0 0 0 0 +$12 0 +$14 Command Control Function Code (7C = open) +$16 Interrupt Level Vector Number +$18 Status Byte 2 Status Byte 3 0 0 0 This command reads the first blocks of a disk or tape up to the maximum number of bytes or the m
7 SCSI PACKETS 7-68
COMMON COMMAND SET AND DISK OPERATION A The first high level command required to interface with a Winchester disk is an ATTACH. An ATTACH initializes the SCSI firmware pointers and internal flags. A RAM work area is used to build the SCSI command descriptor block, messages sent in the message-out phase, and a place to put incoming messages, and status. This area also contains a copy of the ATTACH packet parameters, and two work areas to for mode sense current values and changeable values.
A COMMON COMMAND SET AND DISK OPERATION BYTE VALUE 1 01 Extended message 2 03 Extended message length 3 01 Synchronous data transfer request 4 32 Transfer period (50 times 4 ns = 200 ns 5 05 REQ/ACK offset COMMENTS Test Unit Ready Command CDB BYTE OFFSET VALUE 0 00 Command code 1 00 LUN is inserted into bits 7-5 2 00 Reserved 3 00 Reserved 4 00 Reserved 5 00 Control byte: no link, no flag COMMENTS The firmware sends a mode sense command for page 3, current values.
A If the scatter/gather field at byte offset $10 in the user packet is not zero, the address at offset $4 is taken as a scatter/gather table address. Otherwise the address is the READ/WRITE buffer starting address.
A COMMON COMMAND SET AND DISK OPERATION NOTES: 1. If the previous attach command was the "old" ATTACH ($08) or the "new" ATTACH ($78) and the physical-bytes-per-block is equal to the logical-bytes-per-block, the logical block address is taken from the user packet byte offset $08.
A If it won’t fit, put the attach packet parameters offset into the error field in the command table (byte offset $72), and return a command error status in the user packet. Send mode select command. Mode sense for FORMAT PARAMETER PAGE 4 current values. If no illegal request error Mode sense for page 4 changeable values. If any of the previous mode sense commands returned a "Illegal Request" error status, this next step is skipped (mode sense and mode select are optional).
A COMMON COMMAND SET AND DISK OPERATION The format operation may have a defect list, if a defect list is supplied, a new defect list is built below the user supplied defect list with the four byte header as required by the SCSI device. Three defect list types are accepted. type 0 User list in logical block number. type 1 User list in head, cylinder, sector within track. type 2 User list in head, cylinder, bytes from index.
A Below is the Command Descriptor Block for the Format command. Format Command CDB BYTE OFFSET VALUE 0 04 1 (Note 1) COMMENTS Command code LUN is inserted, FMT data, CMP list, defect list format 2 00 Reserved 3 00 Reserved 4 (Note 2) Interleave 5 00 1. NOTES: Control byte: no link, no flag FMT data (bit 4) is always = 1. CMP list bit is taken from the CL bit in the user format packet byte offset $14. Defect list format (bits 2-0) depend on the defect list type supplied by the user.
A COMMON COMMAND SET AND DISK OPERATION MVME147 SCSI Firmware: Winchester Disk Parameters. Before formatting a Winchester disk, the MVME147 SCSI firmware sends a mode select command for read/write error recovery parameters (page 1) to the controller.
A 3 08 Block descriptor length Block Descriptor 0 00 Reserved 1 00 Number of blocks (MSB) 2 00 Number of blocks 3 00 Number of blocks (LSB) 4 00 Reserved 5 00 Block length (MSB) 6 (Note) Block length 7 (Note) Block length (LSB) The block length is taken from the attach packet, byte offset $1C, bytes per block. NOTE: The remaining 12 bytes that are transferred during the DATA OUT phase for the mode select command are the page 1 parameters.
A COMMON COMMAND SET AND DISK OPERATION NOTES: 1. If the retry field in the attach packet byte offset $1B is = 00, the DCR (disable correction) bit is set and the read retry count field is set to 00. If the retry field in the attach packet byte offset $1B is NOT = 00, the fields at byte 2 and 3 are left as the default value as returned from the mode sense command. 2. This field is left as the default value as returned from the mode sense command.
A BYTE OFFSET VALUE COMMENTS Mode Select Header 0 00 Reserved 1 00 Media type 2 00 Reserved 08 Block descriptor length 3 Block Descriptor 0 00 Reserved 1 00 Number of blocks (MSB) 2 00 Number of blocks 3 00 Number of blocks (LSB) 4 00 Reserved 5 00 Block length (MSB) 6 (Note) Block length 7 (Note) Block length (LSB) The block length is taken from the attach packet, byte offset $1C, bytes per block.
A COMMON COMMAND SET AND DISK OPERATION BYTE OFFSET VALUE 8 (Note 4) Alternate tracks per volume (MSB) 9 (Note 4) Alternate tracks per volume (LSB) A (Note 5) Sectors per track (MSB) B (Note 5) Sectors per track (LSB) Bytes per sector (MSB) COMMENTS C (Note 6) D (Note 6) Bytes per sector (LSB) E (Note 7) Interleave (MSB) F (Note 7) Interleave (LSB) 10 (Note 8) Track skew factor (MSB) 11 (Note 8) Track skew factor (LSB) 12 (Note 9) Cylinder skew factor (MSB) Mode Select P
A 4. Alternate tracks per volume is taken from the attach packets alternate cylinders to reserve field (byte offset $1F for "old" attach ($08), or offset $29 for "new" ATTACH ($78)) multiplied by the number of heads (to convert to tracks). 5. The number of sectors per track, logical sectors per track, the attach packet (byte offset $0C) plus spare sectors per zone (byte offset $1E) if zone = track bit 11 byte offset $10 = 1 6. Bytes per sector is taken from the attach packet byte offset $1C. 7.
A COMMON COMMAND SET AND DISK OPERATION NOTE: If all of the parameters match or are not changeable, only the mode select header and block descriptor is sent, and the parameter list length is be $0C. If a parameter is changed based on the current, changeable, and the packet parameter, the entire page 3 including the mode select header and the block descriptor is sent, and the parameter list length is $20.
A Mode Select Parameter List: Page 4 Parameters for Winchester drives BYTE OFFSET VALUE 0 4 COMMENTS Page code 1 12 2 (Note 1) Number of cylinders (MSB) Page length 3 (Note 1) Number of cylinders 4 (Note 1) Number of cylinders (LSB) 5 (Note 2) Number of heads 6 (Note 3) Starting cylinder - write precomp 7 (Note 3) 8 (Note 3) (MSB) Starting cylinder - write precomp Starting cylinder - write precomp (LSB) 9 (Note 4) Starting cylinder - reduced write current (MSB) A (Note 4) St
A COMMON COMMAND SET AND DISK OPERATION NOTES: 1. Number of cylinders is taken from the attach packet byte offset $08. 2. Number of heads is taken from the attach packet byte offset $07. 3. Starting cylinder - write precomp is taken from the attach packet byte offset $0A. 4. Starting cylinder - reduced write current is left as the default value as returned from the mode sense command. 5. The drive step rate is specified in the attach packet, byte offset $05 in units of 40 microseconds.
A BYTE OFFSET VALUE COMMENTS Mode Select Header 0 00 1 (Note 1) 2 00 Reserved 08 Block descriptor length 3 Reserved Media type Block Descriptor 0 00 Reserved 1 00 Number of blocks (MSB) 2 00 Number of blocks 3 00 Number of blocks (LSB) 4 00 Reserved 5 00 Block length (MSB) 6 (Note) Block length 7 (Note) Block length (LSB) 1. NOTES: The media type is selected using bit flags in the attach packet attributes word, offset $10.
A COMMON COMMAND SET AND DISK OPERATION ATTRIBUTE FLAGS MEDIA ALL SECTORS 500K BITS/ MFM TYPE SAME BIT 7 SEC BIT 3 BIT 0 12 0 0 1 NOTES 5 ¼ in., FM/MFM (VERSAdos double density) 2. The block length is taken from the attach packet, byte offset $1C, bytes per block. The remaining 32 bytes that are transferred during the DATA OUT phase for the mode select command are the page 5 header and parameters.
A BYTE OFFSET VALUE C (Note 6) COMMENTS Starting cylinder - reduced write current (MSB) D (Note 6) Starting cylinder - reduced write current (LSB) E (Note 7) Drive step rate (MSB) F (Note 7) Drive step rate (LSB) Mode Select Parameter List: Page 5 Parameters (cont’d) BYTE OFFSET VALUE 10 00 Drive step pulse width NOTES: COMMENTS 11 01 Head settle delay (MSB) 12 18 Head settle delay (LSB) 13 0C Motor on delay 14 64 Motor off delay 15 E0 16 (Note 8) Flags: TRDY = 1, SSN =
A COMMON COMMAND SET AND DISK OPERATION 3. Sectors/track is taken from the attach packet, byte offset $0C. 4. The number of bytes/sector is taken from the bytes per block field in the attach packet, byte offset $1C. 5. The Number of cylinders is taken from the attach packet, byte offset $08. 6. The write precompensation starting cylinder is taken from the attach packet, byte offset $0A.
A PIN 34 CONTROL BIT PIN 2 CONTROL 7 6 5 4 3 2 1 0 COMMENTS 0 0 0 1 1 1 0 1 Pin 34 = drive ready, low true Bit 3 = 0) Pin 2 = 1 (low density) 10. This field is left as the default value as returned from the mode sense command.
A COMMON COMMAND SET AND DISK OPERATION A-22