Programming the DECMATE II for the RD51D Disk Subsystem Revision 1 16-March-83 John Elkins Robert F. Morse Table Of Contents Section Page 1. INTRODUCTION 1 Bad block mapping 2 Error retries 2 2. SYSTEM CONTROL DATA ON DISK 3 Block 1: Disk geometry and bad block map 4 Blocks 13..15: Disk directory 5 3. 6120 INSTRUCTIONS AND FLAGS 6 Instructions 6 Flags 6 Interrupts 7 Command execution 7 Power-on reset 8 4. CONTROLLER COMMANDS 9 Command errors 10 Command error codes 11 5. COMMAND DETAILS Mount volume 12 Get volume data 13 Update volume data 14 Read disk directories 15 Dismount volume 16 Set block 17 Fill buffer 18 Write 19 Read 20 Empty buffer 21 Get error 22 Test error 23 Get status 24 Execute self-test 25 Set retry-count 26 Set normal mode 27 Set special mode 28 Set format sequence 29 Set physical address 30 Restore 31 Format 32 APPENDIX A. OPERATING SYSTEM CONSIDERATIONS A1 APPENDIX B. CHANGES TO RD51 PROGRAMMING SPECIFICATIONS B1 ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page i ----------------------------------------------------------------- Programming the DECMATE II for the RD51D Disk Subsystem _______________________________________________________ 1. INTRODUCTION _______________ The RD51D Disk Subsystem consists of a controller and one or two __________ Winchester disk units. Each unit has up to eight heads and up to _____ _____ 4096 cylinders. Each cylinder-head (track) has 16 sectors of 512 _________ _____ _______ bytes each. Each physical unit contains up to 60 logical volumes. Disk data _______ are addressed in units of 512-byte (or 256-word) blocks relative ______ to the beginning of a volume (the first block is numbered 0). Each block is stored in one physical sector (the terms are used interchangably in this document). Volumes are created on a disk by entering their descriptions in a disk directory which is written in a fixed location on the disk. ______________ Each volume's entry in the directory has an eight-character volume name, separate 16-bit passwords for read and write access, a physical disk starting block, a block count which determines the volume's size, a system format indicator (e.g., WPS, CP/M, COS-310, OS/8), and additional operating-system dependent data. The controller allows access to a volume via a path called a logical device. The controller supports 16 such devices, which _______________ are designated by numbers from 0 through 15. To access disk data it is first necessary to associate a volume with a device number by issuing a MOUNT VOLUME command. The eight device numbers 0 through 7 are for use by operating systems and application programs. Devices 8 through 15 are reserved for special functions. Once a volume is mounted, its blocks can be read and written. To read a block, use the SET BLOCK command to specify the device number and block number. Then issue the READ command and wait for the "done" flag. Then use an EMPTY BUFFER command to get the block image from the controller's buffer. To write disk data, issue SET BLOCK to specify device and block number. Then use a FILL BUFFER command to send the block's data to the controller's buffer and issue a WRITE command. For all normal volumes, only those blocks within the volume can be accessed, and volume spaces do not overlap (i.e. a particular physical block can be assigned to only one volume). Access to ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 1 ----------------------------------------------------------------- the entire disk for volume directory maintenance is via a pseudo-volume called the "master volume", which maps the entire physical disk as a volume such that volume block 0 refers to physical block 0. The master volumes for units 0 and 1 are permanently mounted on devices 8 and 9, respectively. A 6120 program uses six IOT instructions to send commands to the controller, exchange data with it, and test its status. These commands are discussed in section 3, below. Section 2 describes the principal data structures on the disk and in the controller's local storage which are necessary to understand the operation of the various controller commands. Section 4 describes the controller commands in detail. Bad block mapping _________________ The controller automatically resolves references to physically defective blocks. The disk control block (permanently written on block 1 of each disk) contains a list of physically defective blocks and the location of a replacement block for each one. This list is read into the controller's storage whenever an EXECUTE SELF-TEST command is executed to create a "bad block map". There is a value in each sector header that indicates whether a block is a bad block. If a block is bad or if a block is not found or if a sector header contains a CRC error, the block number is looked up in the bad-block map. If the block is not found in the bad-block map, retries will continue. If the block is found, the block number of the corresponding good block will be substituted for the bad block number and the read or write will be retried. Error retries _____________ Retries consist of the following: If the DAA state machine detects an error in a block, the controller firmware determines whether the error is retryable. There are two categories of retryable errors: Category 1 errors consist of data or header CRC errors and header found but no data found. These errors are retried by staying on track and continuing to attempt the operation until either the error goes away or the retry-count (see SET RETRY-COUNT) has been satisfied. Category 2 errors consist of header-not-found errors. These errors are retried by restoring the unit to track 0, reseeking, and trying again until either the error goes away or the retry-count has been satisfied. ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 2 ----------------------------------------------------------------- 2. SYSTEM CONTROL DATA ON DISK _______________________________ The first 64 blocks of a disk contain special information that the disk controller firmware requires for operation. Blocks Usage ______ _____ 0 System boot block. This block is read by the DECmate II ROM bootstrap code to determine whether there is valid firmware in blocks 16..47. 1 Disk geometry and bad block map. 2..12 (Reserved) 13..15 Disk directory. Each block contains a header and twenty 24-byte directory entries. 16..47 DECmate II firmware. 48..63 Alternates for bad sectors. These blocks constitute a volume whose name is always "FIRMWARE". This volume is created by the utility program which formats a new disk unit, and can be mounted by programs which update the firmware or directory contents. (The contents of the disk directory can be read more easily and safely by a READ DISK DIRECTORIES command.) ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 3 ----------------------------------------------------------------- Block 1: Disk geometry and bad-block map _________________________________________ This block contains information about the unit geometry and bad block mapping. Its contents are read by the controller into its local RAM storage during an EXECUTE SELF TEST command (which is automatically performed upon a power-on reset). Since the controller is designed to operate with a wide range of Winchester units, it must accomodate varying numbers of cylinders and heads. Therefore this geometry information is recorded in a "disk control block" at a fixed location on the disk that may be accessed without prior knowldege of the unit's geometry. (All units are assumed to have 16 blocks of 512 bytes on each track). Occasionally a unit will have bad spots that make it impossible to reliably read or write some blocks. When these blocks are discovered, their numbers are recorded in a "bad-block map" in the disk control block and they are physically formatted with "bad block" flags. Subsequent references to such a block will cause it them to be looked up in the bad-block map, which contains the location of an alternate block to be used as a replacement for the original block. The disk control block is physical block 1 and looks like this: Bytes Contents _____ ________ 0..7 Literal ASCII value "DRIVEHDR" 8..15 Disk name (ASCII) 16..19 Disk password (binary) 20..31 Reserved 32..33 16-bit number of cylinders on the unit (low, high). 34 Number of heads on the unit (1..8). 35..63 Reserved 64..191 Bad block map. Provision is made to map up to 16 bad blocks. The map contains 16 entries of 8 bytes each. The first four bytes identify the bad block, as follows: 0: low-order cylinder number 1: high-order cylinder number 2: head number 3: sector number The next four bytes identify (using the same format) the replacement block. ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 4 ----------------------------------------------------------------- Blocks 13..15: Disk directory ______________________________ Each disk contains up to 60 logical volumes allocated by a user through the use of a special disk utility program. Each volume has a name, read and write passwords, a number of blocks (which is always a multiple of 16), and a physical starting point. The disk directory occupies three blocks and each block contains directory entries for 20 volumes. Each block is formatted as follows: Bytes Contents _____ ________ 0..11 Literal ASCII value "DIRECTORY " 12..31 (reserved) 32..511 Twenty entries of 24 bytes each Each directory entry contains information as described in the following table. Note that bits within a byte are numbered 7 through 0, left to right. Bit 0 is the least-significant bit. Bytes Contents _____ ________ 0..7 Volume name (ASCII) 8..9 Password for reading (binary) 10..11 Password for writing (binary) 12..13 Physical starting block, divided by 16 (low- order byte first) 14..15 Number of blocks in volume, divided by 16 (low-order byte first) 16 <4> "1" = active volume entry; "0" = unused entry <2> "1" marks the "startup volume" which is mounted by the MOUNT STARTUP VOLUME command <1> "1" indicates that the volume has been modified by one or more WRITE commands (this bit should be cleared by a utility which has made a backup copy) 17..23 7 bytes of operating system data (see Appendix A) ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 5 ----------------------------------------------------------------- 3. 6120 INSTRUCTIONS AND FLAGS ______________________________ Instructions ____________ Six instructions are used to program the RD51D controller. There is one instruction to send a command (RDSC), one to transfer data (RDTD), one to control interrupts (RDWE), and three to test and reset the flags. All of the instructions clear the AC after execution except for an RDTD when the direction of data transfer is "in" to the 6120. Table 1 lists the instructions and their octal values. _________________________________________________________________ Octal Mnemonic Description _____ ________ ___________ 6700 -- (reserved, effect TBS) 6701 RDSR Skip on DATA REQUEST flag; clear flag. 6702 RDSC Send command (in AC) to controller. 6703 RDSD Skip on DONE flag; clear flag. 6704 RDTD Transfer data to/from AC <0:11>. 6705 RDWE Write interrupt-enable mask from AC <11>. 6706 RDSE Skip on ERROR flag; clear flag. 6707 -- (reserved, effect TBS) Table 1. 6120 Instructions for RD51D _________________________________________________________________ Flags _____ Three flags are used to synchronize the 6120 and the controller. They are: -- DONE, which is set at the completion of a command (and causes an interrupt if the interrupt-enable mask has been set). -- ERROR, which is set simultaneously with DONE if the command ended with an error condition. -- DATA REQUEST, which is set for each word to be transferred to or from the controller for commands which have associated data transfers. Each flag has an associated "skip" instruction which tests the flag and, if the flag is set, skips the next instruction in the program and clears the flag. A 6120 CAF instruction does not ___ affect the flags. ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 6 ----------------------------------------------------------------- Interrupts __________ The RDWE instruction stores the low-order-bit of the AC in the controller's interrupt-enable mask. A "one" enables interrupts so that the assertion of the DONE flag generates an interrupt request. This mask is cleared to "zero" uponpower-on reset. A 6120 CAF instruction does not affect the interrupt mask. Command execution _________________ A program executes an RD51D command as follows: -- Issue a command. -- Transfer zero or more words of data. -- Wait for done flag. -- Test error flag. To issue a command, the program loads the AC with the desired command word and executes an RDSC instruction to send the command to the controller. The AC is cleared by this instruction. Each command may be followed by a number of data transfer requests (which may be zero). The command descriptions (in section 4) show for each command the number and direction of such transfers. If the number is not zero, the program transfers each word by waiting until the DATA REQUEST flag is set (using the RDSR instruction) and then issuing an RDTD instruction to transfer one word of data. If the transfer direction is "in" from the controller to the 6120, the RDTD clears the AC and then loads it with the incoming word. If the transfer direction is "out" to the controller from the 6120, the program must place the outgoing data in the AC before issuing the RDTD. The AC is cleared by an RDTD for outgoing data. The program uses the RDSD instruction to test the DONE flag which indicates the completion of a command. If the RD51D interrupt enable mask is set, assertion of the DONE flag will also request an interrupt. In this case, the interrupt service code must issue an RDSD to clear the flag and turn off the interrupt request. After the DONE flag has been detected and cleared, the program may use the RDSE instruction to test and clear the ERROR flag. The GET ERROR command can be issued to determine the nature of an error. Once a command has been issued to the controller, the program must monitor the DATA REQUEST and DONE flags and satisfy them as described above before attempting another command. There is no way to prematurely terminate a command except by a power-on reset. Note that the CAF instruction has no effect on the RD51D controller. ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 7 ----------------------------------------------------------------- Power-on reset ______________ A power-on reset causes the controller to execute the equivalent of an EXECUTE SELF-TEST command and to set the DONE and possibly the ERROR flags to reflect the outcome of this operation. Note that this operation may require 20 seconds or more to complete if the disk unit must spin up to speed from rest. ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 8 ----------------------------------------------------------------- 4. CONTROLLER COMMANDS ______________________ This section describes the commands which are executed by the controller. These are listed below in Table 2. _________________________________________________________________ Octal Command Name In/out Words code ____________ ______ _____ _____ Normal commands _______________ MOUNT VOLUME Out 9 0000 GET VOLUME DATA In 24 0030 UPDATE VOLUME DATA Out 25 0006 READ DISK DIRECTORIES In n * 24 0033 DISMOUNT VOLUME Out 1 0005 SET BLOCK Out 3 0001 FILL BUFFER (8-bit) Out 512 0102 FILL BUFFER (12-bit) Out 256 0002 WRITE - - 0003 READ - - 0004 EMPTY BUFFER (8-bit) In 512 0125 EMPTY BUFFER (12-bit) In 256 0025 GET ERROR In 1 0027 TEST ERROR - - 0021 GET STATUS In 5 0026 EXECUTE SELF-TEST - - 0011 SET RETRY COUNT Out 1 0013 SET NORMAL MODE - - 0020 SET SPECIAL MODE - - 0007 SET FORMAT SEQUENCE Out 16 0015 Special commands ________________ SET PHYSICAL ADDRESS Out 4 0014 RESTORE - - 0016 FORMAT - - 0017 Table 2. Command Summary. _________________________________________________________________ ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 9 ----------------------------------------------------------------- There are two classes of commands: normal and special. Normal commands are used by operating systems and application programs to read and write the various volumes on a disk. As long as the FIRMWARE volume is not mounted, none of the normal commands can compromise the volume structure of the disk, and only blocks in volumes which are mounted can be read and written. Only devices 0 through 7 may be used in normal mode. System utility programs which create and delete volumes and make backup copies can use the master volumes which are mounted on devices 8 and 9 to obtain write access to the volume directory. These devices can only be used when the controller is in special mode. Special commands are used only to physically format a disk and write its disk control block. They allow device-dependent addressing by physical unit, cylinder, head, and sector and for execution of the FORMAT and RESTORE commands. These commands can only be executed after a SET SPECIAL MODE command has been issued. The controller is set to normal mode by a power-on reset and by SET NORMAL MODE and EXECUTE SELF-TEST commands. Command errors ______________ Execution of a command sets or clears the ERROR flag and puts a value in the error register in the controller which can be read by a GET ERROR command. The detailed command descriptions in this section list the error codes which can be generated by each command. There is a group of codes which can result from actual read or write access to a disk; these are denoted by the summary code DIO in the command descriptions. These codes (in octal) are: 0001 Invalid cylinder number (too high for disk) 0005 Data CRC error 0006 Header CRC error 0007 Header not found (format error, or bad block with no alternate assigned in bad-block map) 0014 DAA failed to complete (controller hardware error) 0015 DAA failed to start (controller hardware error) 0016 Invalid head number (too high for disk) 0020 Invalid unit--not ready or not installed 0021 Seek incomplete (disk hardware error) 0032 No data found after header (format error) An RDSC instruction which sends an invalid command code to the controller yields an error code of 0011. Table 3 lists all the error codes. ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 10 ----------------------------------------------------------------- _________________________________________________________________ Octal code Meaning _____ _______ 0000 No error 0001 Invalid cylinder number 0002 Invalid block number 0003 (not used) 0004 (not used) 0005 Data CRC error 0006 ID (header) CRC error 0007 ID not found 0010 Write fault 0011 Illegal command code 0012 Unable to find cylinder 0 0013 (not used) 0014 DAA state machine failed to complete in 2 revolutions 0015 DAA state machine failed to respond to abort command 0016 Invalid head selected 0017 No units in system 0020 Invalid unit--not ready or not installed 0021 Seek incomplete 0022 Invalid device number 0023 Volume name not found in directory 0024 Device has no volume mounted 0025 Read or write access denied 0026 Special mode required 0027 RAM failure during self-test 0030 Bad format command 0031 No index found during FORMAT command 0032 Time-out (found header but no data) 0033 DAA failed self-diagnosis 0034 Invalid volume directory 0035 Invalid disk control block 0036 (not used) 0037 (not used) Table 3. Command Error Codes. _________________________________________________________________ ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 11 ----------------------------------------------------------------- MOUNT VOLUME MOUNT VOLUME ____________ ____________ This command associates a volume with a device number so that its contents can be read and written. A MOUNT VOLUME command must be issued once before the first SET BLOCK, READ or WRITE command for that device. Each volume in the disk directory has an 8-character name. In addition, one volume may be marked with a special flag as the "startup volume". In this command, you may specify the volume you want either by name or by asking for the startup volume. Command code: 0000 Data words: 9 out Word Bits Contents ____ ____ ________ 1 <4:4> Read access allowed if "1" <5:5> Write access allowed if "1" <6:6> "0" for unit 0; "1" for unit 1 <7:7> "0" for mount by name; "1" to mount the startup volume <8:11> Device number by which to refer to this volume (0..15) 2..9 <4:11> 8-character volume name Error codes: 0022 Invalid device number 0023 Volume name not found in directory 0026 Special mode required for devices 8..15 0034 Invalid volume directory DIO Disk read errors Notes: 1. Execution of this command sets the device number to the number specified in word 1 and sets the block number to 0. 2. This command destroys the contents of the block buffer. 3. Do not attempt to mount a volume on devices 8 or 9; these are reserved for the master volumes (which are automatically mounted at the conclusion of a self-test command). ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 12 ----------------------------------------------------------------- GET VOLUME DATA GET VOLUME DATA _______________ _______________ This command returns the contents of the directory entry for the volume mounted on the device referenced in the most recent SET BLOCK command. Command code: 0030 Data words: 24 in Word Bits Contents ____ ____ ________ 1..8 <4:11> Volume name 9..10 <4:11> Read password 11..12 <4:11> Write password 13..14 <4:11> Starting physical block number, divided by 16 (low-order 8 bits in first word) 15..16 <4:11> Number of blocks in volume, divided by 16 (low-order 8 bits in first word) 17 <4> "1" indicates read access permitted <5> "1" indicates write access permitted <6> "0" for unit 0; "1" for unit 1 <7> "1" if a volume is mounted on this device <9> "1" if this is the "startup" volume <10> "1" if this volume has been modified by a WRITE command 18..24 <4:11> OS-dependent data (see Appendix A) Error codes: none Notes: 1. If bit 7 of word 17 is "0", no volume is mounted on the device and the rest of the data returned by this command is invalid. ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 13 ----------------------------------------------------------------- UPDATE VOLUME DATA UPDATE VOLUME DATA __________________ __________________ This command replaces the contents of the directory entry for the volume mounted on the specified device (except for the physical size and location of the volume). It can be used, in conjunction with GET VOLUME DATA, to rename a volume, change its passwords, alter the "startup" and "modified" flags, and change its OS data. Command code: 0006 Data words: 25 out Word Bits Contents 1 <8:11> Device upon which the volume is presently mounted (0..7) 2..9 <4:11> Volume name 10..11 <4:11> Read password 12..13 <4:11> Write password 14..17 (ignored) 18 <4> "1" indicates read access permitted <5> "1" indicates write access permitted <6:7> (ignored) <9> "1" if this is the "startup" volume <10> "1" if this volume has been modified by a WRITE command 19..25 <4:11> OS-dependent data (see Appendix A) Error codes: 0022 Invalid device number 0024 Device has no volume mounted DIO Disk I/O errors Notes: 1. The arrangement of the 24 words to be written to the volume's directory entry is the same as those returned by GET VOLUME DATA. Thus these two commands can be conveniently used to selectively alter a volume's data by getting it with GET VOLUME DATA, making the desired alterations, and then rewriting it with UPDATE VOLUME DATA (remembering to precede the data for the latter with the device number). 2. The new data is both written to the permanent disk directory and stored in the controller's device table, making any changes immediately effective. For example, if the update alters the read or write access bits, these will govern subsequent attempts to use the volume until it is dismounted and remounted (these bits are not written in the disk directory). 3. This command destroys the contents of the block buffer. ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 14 ----------------------------------------------------------------- READ DISK DIRECTORIES READ DISK DIRECTORIES _____________________ _____________________ This command reads the directories of all the disks available to the controller and returns the contents of each 24-byte directory entry which represents a volume on a disk. Unused entries are not returned. The number of transfer requests will be 24 times the number of volumes defined in the available directories. Command code: 0033 Data words: n * 24 in Word Bits Contents ____ ____ ________ 1..8 <4:11> Volume name 9..10 <4:11> Read password 11..12 <4:11> Write password 13..14 <4:11> Starting physical block number, divided by 16 (low-order 8 bits in first word) 15..16 <4:11> Number of blocks in volume, divided by 16 (low-order 8 bits in first word) 17 <6> "0" for unit 0; "1" for unit 1 <7> "1" if an active directory entry (should never be "0") <9> "1" if this is the "startup" <10> "1" if this volume has been modified by a WRITE command 18..24 <4:11> OS-dependent data (see Appendix A) Error codes: 0034 Invalid volume directory DIO Disk read errors Notes: 1. This command destroys the contents of the block buffer. ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 15 ----------------------------------------------------------------- DISMOUNT VOLUME DISMOUNT VOLUME _______________ _______________ This command reverses the effect of a MOUNT VOLUME command by breaking the association between a device number and a volume. After execution of this command, subsequent references to the device number will be rejected. Command code: 0005 Data words: 1 out Word Bits Contents ____ ____ ________ 1 <8:11> Device number from which volume is to be dismounted (0..15) Error codes: 0022 Invalid device number 0026 Special mode required for devices 8..15 Notes: 1. Issuing DISMOUNT VOLUME invalidates the stored device and block numbers in the controller. A new SET BLOCK must precede the next READ or WRITE. 2. No error occurs if no volume was mounted on the device. 3. The master volumes on devices 8 and 9 should never be dismounted. (An EXECUTE SELF-TEST will remount them, but will dismount the volumes on all other devices.) ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 16 ----------------------------------------------------------------- SET BLOCK SET BLOCK _________ _________ This command establishes the device and block number for a subsequent READ or WRITE operation. Command code: 0001 Data words: 3 out Word Bits Contents ____ ____ ________ 1 <8:11> Device number (0..15) 2 <0:11> Low-order 12 bits of block number 3 <4:11> High-order 8 bits of block number Error codes: 0002 Invalid block number (too high for volume) 0022 Invalid device number 0024 Device has no volume mounted 0026 Special mode required for devices 8..15 ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 17 ----------------------------------------------------------------- FILL BUFFER FILL BUFFER ___________ ___________ This command transfers a block of data from the 6120 to the controller's block buffer. It is used prior to a WRITE command. If the command qualifier is "1" (8-bit mode) then there will be 512 transfer requests, each for a byte of data from AC<4:11>. If the command qualifier is "0" (12-bit mode) then there will be 256 transfers, each for a word of data from AC<0:11>. Command code: 0002 (12-bit) 0102 (8-bit) Data words: 256 out (12-bit) 512 out (8-bit) Error codes: none ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 18 ----------------------------------------------------------------- WRITE WRITE _____ _____ This command writes the contents of the block buffer to the disk. This command normally should be preceeded by a FILL BUFFER command and a SET BLOCK command or (in special mode) a SET PHYSICAL ADDRESS command. Command code: 0003 Data words: none Notes: 1. If the "modified" flag in the volume's directory data is "0", execution of a WRITE sets that bit to "1" in both the device table and the on-disk directory. (This bit can be cleared by using the UPDATE VOLUME DATA command.) Error codes: 0025 Write access denied (i.e. the volume was mounted with a "0" in AC<5> of word 1 of the command's data words). DIO Disk write errors ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 19 ----------------------------------------------------------------- READ READ ____ ____ This command reads the selected block from the disk into the controller's block buffer. A subsequent EMPTY BUFFER command is needed to bring the data back to the 6120. Note that before issuing this command, the 6120 program should issue a SET BLOCK command or (in special mode) a SET PHYSICAL ADDRESS command. Command code: 0004 Data words: none Error codes: 0025 Read access denied (i.e. the volume was mounted with a "0" in AC<4> of word 1 of the command's data words). DIO Disk read errors ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 20 ----------------------------------------------------------------- EMPTY BUFFER EMPTY BUFFER ____________ ____________ This command transfers the contents of the controller's block buffer to the 6120. If the command qualifier is "1" (8-bit mode) then there will be 512 data transfers, each for a byte of data into AC<4:11> (AC<0:3> is cleared). If the command qualifier is "0" (12-bit mode) then there will be 256 transfers, each for a word of data into AC<0:11>. Command code: 0025 (12-bit) 0125 (8-bit) Data words: 256 in (12-bit) 512 in (8-bit) Error codes: none Notes: 1. This command does not alter the contents of the controller's block buffer. ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 21 ----------------------------------------------------------------- GET ERROR GET ERROR _________ _________ This command returns the error code set by the last command executed (other than GET ERROR). This command may be issued at any time after the completion of another command, regardless of whether or not the error flag was set. A returned value of zero indicates that there was no error. Execution of this command does not clear the error register. Table 3 lists the possible error code values. Command code: 0027 Data words: 1 in Word Bits Contents 1 <0:11> Error code from previous command Error codes: (any; see description above) ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 22 ----------------------------------------------------------------- TEST ERROR TEST ERROR __________ __________ This command sets or clears the ERROR flag according to the current value in the controller's error register. If the value is not zero, the ERROR flag is set; otherwise it is cleared. Execution of this command does not alter the error register. Command code: 0021 Data words: none Error codes: (any; see description above) ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 23 ----------------------------------------------------------------- GET STATUS GET STATUS __________ __________ This command returns the current mechanical status of the last- selected unit and the physical cylinder, head and sector last addressed. Command code: 0026 Data words: 5 in Word Bits Contents 1 <4:4> Index pulse (transient) <5:5> "1" if unit is at physical cylinder zero <6:6> "1" if a write fault occurred on the last disk operation <7:7> "1" if selected unit is ready <8:8> (undefined) <9:9> "1" if seek complete (from unit) <10:10> "1" if unit 1 is selected (acknowledge signal from unit) <11:11> "1" if unit 0 is selected (acknowledge signal from unit) 2 <0:11> Cylinder number 3 <9:11> Head number 4 <8:11> Sector number 5 <0:11> Controller program version number Error codes: none ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 24 ----------------------------------------------------------------- EXECUTE SELF-TEST EXECUTE SELF-TEST _________________ _________________ This command causes the controller to execute its self-test code and reset its internal data. It dismounts all mounted volumes and sets the controller to "normal" command mode. It reads the disk control blocks (block 1) from each available disk to establish their geometries and store their bad-block maps, and mounts the master volumes on devices 8 and 9. Command code: 0011 Data words: none Error codes: 0017 No units are attached to the controller 0027 RAM failure during self-test 0033 DAA failed its self-test 0035 Invalid device control block DIO Disk read error (on device control block) Notes: 1. Since self-test dismounts all volumes, no reads or writes can be performed (except to the master volumes) until one of the MOUNT commands has been executed successfully after this command. 2. This command is executed automatically upon a power-on reset. ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 25 ----------------------------------------------------------------- SET RETRY-COUNT SET RETRY-COUNT _______________ _______________ The disk controller will retry read and write errors by restoring seeking to cylinder 0) and re-seeking and reading/writing again. It will do this times. The default value for is 1. This command alters the value of ; the new value remains effective until another SET RETRY-COUNT or an EXECUTE SELF-TEST command is executed. Command code: 0013 Data words: 1 out Word Bits Contents ____ ____ ________ 1 <4.11> Number of retries to attempt Error codes: none ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 26 ----------------------------------------------------------------- SET NORMAL MODE SET NORMAL MODE _______________ _______________ This command places the controller in "normal" mode, which disallows execution of all of the "special mode" commands. Special mode can only be reestablished by the SET SPECIAL MODE command. Command code: 0020 Data words: none Error codes: none ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 27 ----------------------------------------------------------------- SET SPECIAL MODE SET SPECIAL MODE ________________ ________________ This command enables the execution of "special" disk commands listed in Table 2 and the use of devices 8 through 15. Command code: 0007 Data words: none Error codes: none ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 28 ----------------------------------------------------------------- SET FORMAT SEQUENCE SET FORMAT SEQUENCE ___________________ ___________________ This command specifies the order in which the sixteen sectors on a track are numbered when the track is formatted, and must be issued before issuing a FORMAT command. Sixteen words are transmitted to the controller, each containing a sector number in bits 8:11. Each number from 0 through 15 must be sent once and only once. The sequence can be set up to effect an interleaving scheme to match the speed of the disk to the speed of the programs which use it. A physically defective sector is permanently marked as such by a value of 255 (decimal) in the word in the pattern list containing its sector number. The controller will record this in the sector header on the disk track. When a block so marked is later accessed, the controller will note the flag and search the bad-block map for the identity of a substitute block. Command code: 0015 Data words: 16 out Word Bits Contents ____ ____ ________ 1..16 <4:11> Sector number 0..15, or 255 for a bad sector Error codes: none ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 29 ----------------------------------------------------------------- SET PHYSICAL ADDRESS SET PHYSICAL ADDRESS ____________________ ____________________ This command selects the unit, cylinder, head and sector to be used for subsequent READ, WRITE, RESTORE, or FORMAT commands. Command code: 0014 Data words: 4 out Word Bits Contents ____ ____ ________ 1 <11:11> "0" = select unit 0 "1" = select unit 1 2 <0:11> Cylinder number, 0 4095 (subject to the physical limits of the unit!) 3 <9:11> Head number, 0..7 4 <8:11> Sector number, 0..15 Error codes: 0026 Special mode required Notes: 1. This command merely stores the cylinder value; it does not perform a physical disk seek. 2. The cylinder number must be in the range zero through one less than the number of physical cylinders in the unit. This is not checked in this command, but will be checked when an actual disk operation attempts to use the cylinder value. 3. The head number must be in the range zero through one less than the number of heads in the unit. This is not checked in this command, but will be checked when an actual disk operation attempts to use the head value. ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 30 ----------------------------------------------------------------- RESTORE RESTORE _______ _______ This command moves the heads of the previously selected unit (see SET PHYSICAL ADDRESS command) to cylinder 0 (the outside edge of the disk). The command will complete within 1.2 seconds. Command code: 0016 Data words: none Error codes: 0012 Unable to find cylinder 0 (disk hardware error) 0020 Unit not installed 0026 Special mode required ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 31 ----------------------------------------------------------------- FORMAT FORMAT ______ ______ This command writes sector format information on the track designated by the preceding SET PHYSICAL ADDRESS command. The sectors are numbered in the sequence specified by the preceding SET FORMAT SEQUENCE command. Command code: 0017 Data words: none Error codes: 0026 Special mode required 0030 Bad format command 0031 No index found DIO Disk I/O errors Notes: 1. Formatting destroys the contents of the track. After formatting, each sector contains 512 bytes of binary zeros. 2. A SET FORMAT SEQUENCE command must be issued before the first use of the FORMAT command, but that pattern is not altered by FORMAT and remains valid for subsequent FORMAT commands. ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page 32 ----------------------------------------------------------------- Appendix A. OPERATING SYSTEM CONSIDERATIONS ____________________________________________ The last seven bytes (offset 17 through 23) of each volume's 24-byte directory entry contain data specific to the file structure of the volume. The first byte indicates the file structure of the volume, as follows: Bytes Bits Contents _____ _________ ________ 17 X... .... Bootable-system flag A "1" marks a volume whose block 0 contains an executable bootstrap loader. 17 .XXX XXXX File structure (values in octal): 010 WPS-8 011 OS-8 012 COS 310 100 CP/M Bytes 18..23 for the various file structures are TBS. Operating system bootstrapping ______________________________ A logical volume may contain an operating system which can be bootstrapped into an empty machine. Such a volume is marked "bootable" (as shown above) and has a 256-word bootstrap loader in its block 0. By convention, such a system is loaded by the following command sequence: -- Execute self-test to dismount all volumes. -- Mount the system volume on device 0. -- Read block 0 from the volume -- Empty the buffer in 12-bit mode (256 words) into 6120 storage starting at address 0200 in field 0. -- Begin execution at address 0210. A special case is the "startup" volume. This is marked so that it can be mounted by a MOUNT VOLUME command without knowing its name. The DECmate II firmware mounts and bootstraps this volume after the firmware has been loaded during system initialization. Operating systems which have completed operation and have been directed to "quit" should mount and bootstrap the startup volume. <<< End of document >>> ----------------------------------------------------------------- Programming the DECMATE II for the RD5lD Disk Subsystem Revision 1, 16-March-83 Page A1 ----------------------------------------------------------------- Changes to RD5lD Programming Specifications Page B1 _________________________________________________________________ - - - - - - - d i g i t a l MEMORANDUM - - - - - - - From: Bob Morse To: J. Elkins Dept: Micro Systems Eng. D. Rice Loc : MLO3-2/E41 W. Keefe DTN : 223-6720 cc: Interested parties Date: 16-Mar-83 (rev 2) Subject: Changes to RD51D Programming Specifications _________________________________________________________________ This memo summarizes changes to the programming specifications for the RD51D hard disk controller for the DECmate II. These alter the controller commands described in Programming the ________________ DECmate II for the RD51D Disk Subsystem, revision 0, dated 7 ____________________________________________ January 1983, and are incorporated in revision 1 of that document. The revised specifications are reflected in version 13 ("D") and later of the 8751 controller ROM. 1. The number of logical devices available to a normal-mode user has been reduced from 16 to 8. Only devices 0..7 should be used for normal program and operating system functions. Devices 8..15 may be used only when special mode is in effect. 2. Devices 8 and 9 are automatically initialized to access the "master volume" (which maps the entire physical unit) for units 0 and 1, respectively. These devices can be used only in master mode. Their volumes should never be dismounted! 3. The MOUNT MASTER VOLUME command (code 0006) has been deleted. 4. The MOUNT STARTUP VOLUME command (code 0010) has been deleted. Its function is now performed by the MOUNT VOLUME command (see next item). 5 The MOUNT VOLUME command no longer checks the read and write passwords; this is now the responsibility of the operating system (error code 0037 has been deleted). This reduces the number of data words from 13 to 9: one option byte followed by 8 bytes of volume name. This command no longer checks for duplicate mounting of a volume (error code 0036 has been deleted). Such mounting poses no problems to the controller, but programs should be wary of mounting the same volume on more than one device if they then believe the two devices to contain independent data! Changes to RD5lD Programming Specifications Page B2 _________________________________________________________________ Bit 4 (or AC<7>) of the flag byte is "0" for a normal mount by name, or "1" to mount the startup volume. In the latter case, the name supplied with the command is ignored. 6. The GET VOLUME PARAMETERS and READ DISK DIRECTORIES commands no longer suppress the contents of the password fields. This data is now returned to the caller, who is now responsible for password checking. 7. The GET CONTROLLER VERSION command (code 0031) has been eliminated. Instead, the version number is returned as the fifth word of data returned by a GET STATUS command (code 0026). 8. The READ STARTUP SECTOR command (code 0032) has been eliminated. Instead, read block 0 of the master volume (which is pre-mounted on device 8) and do a normal 12-bit empty-buffer. 9. The SET DRIVE, SET CYLINDER, SET HEAD and SET SECTOR commands (codes 0040, 0041, 0042 and 0043) have been replaced by a single command named SET PHYSICAL ADDRESS (code 0014) which sends four data words to the controller. These four words are identical to the four sent separately by the four former commands. This command is for use only by the disk-formatting utility ____ and diagnostic exerciser programs. 10. Command codes for the following commands have been changed (to reduce the size of the command dispatch table in the controller): Command Old code New code _______ ________ ________ SET NORMAL MODE 0047 0020 SET FORMAT SEQUENCE 0050 0015 RESTORE 0045 0016 FORMAT 0046 0017 11. The information returned by the GET STATUS command has been revised: Bit 3 of the first byte (or AC<8>) no longer reflects the "error" status; its value is now unspecified. A fifth word has been added; it is the controller program version number. 12. The SET SPECIAL MODE COMMAND (code 0007) no longer requires a password and hence requires no data words. 13. Electrical interface problems limit the present version of the firmware to one unit (unit 0); a second unit cannot be attached. However, the controller command structure remains in place to handle two units in future versions. Changes to RD51D Programming Specifications Page B3 _________________________________________________________________ 14. A new command named UPDATE VOLUME DATA (code 0006) allows any of the data in a volume's directory entry, such as name, OS type, and "modified" flag, to be revised without disturbing the contents of the volume. The volume's physical position and size are protected from alteration by this command. 15. A new command named TEST ERROR (code 0021) requests the controller to set its ERROR flag (again) if the controller's error register contains a non-zero error code. 16. The following error codes are no longer (or never were) generated by the controller: 0003 Self test failed in unit 0004 Self test failed in controller 0013 Data mark (in format) not found 0036 Volume already mounted on another device 0037 Incorrect read or write password Error code 0027 is newly defined. Its description is "RAM failure in self test". In order to reduce confusion with various operating system terminologies, the word "unit" has been substituted for "drive" to refer to the physical hard disk mechanism which is connected to one of the two electrical interfaces of the controller. For the convenience of various system maintenance programs, the 64-block area at the beginning of a unit (which contains its device control block, volume directory, and system firmware) will be described as a volume named FIRMWARE with a file structure code of 0. This will be the first entry in the volume directory, and is created by the FORMAT program which initializes the unit. The controller does not depend upon the presence of this entry, but utility programs may use it instead of the master volume to reduce the chances of inadvertantly damaging data outside the first 64 blocks. The bootstrap block which is written in block 0 of a bootable volume now has a standard execution entry point of 0210 instead of 0200. This leaves the first 16 bytes of the block free to contain the DEC standard boot block identification sequence. rfm