;========================================================== DC-820 / DC-320 Programming interface ;========================================================== ;========================================================== I. I/O ports ;========================================================== Possible I/O : 330, 334, 230, 234, 130, 134 Slot specific I/O : XC80--XC9F : X = slot #, 1 --> F XC80--XC83 == EISA BOARD ID IO/PORT --> XC80 XC81 XC82 XC83 -------------------------------------------- DC-820 52 4D 08 20 DC-320 52 4D 03 20 XC8D <-- 2 ==> Out 2 to port XC8D to start single threaded command XC8F != 0 ==> Command complete status XC90--XC9F == Command block ;========================================================== II. Single thread command ;========================================================== (A) Protocol Out FF to XC8F Fill XC90--XC9F with command block Out 2 to XC8D to start command wait for XC8F != 0 ==> command complete XC90 = execution status When XC90--XC9F is given the command block XC90 represent the command OPCODE XC91--XC9F = command parameter ;========================================================== command 0 : reset SCSI ( BIOS function ) input : 0 output : 0 ;========================================================== command 1 : read status ( BIOS function ) input : 1 output : 0 ;========================================================== command 2 : read sectors ( BIOS function ) input : 2, SCSI-ID(1), block count (1), block address(4), buffer address(4) output : status(1),error code(1) ;========================================================== command 3 : write sectors ( BIOS function ) input : 3, SCSI-ID(1), block count (1), block address(4), buffer address(4) output : status(1),error code(1) ;========================================================== command 4 : verify sectors ( BIOS function ) input : 4, SCSI-ID(1), block count (1), block address(4) output : status(1),error code(1) ;========================================================== command 5 : invalid ;========================================================== command 6 : invalid ;========================================================== command 7 : invalid ;========================================================== command 8 : read drive capacity ( BIOS function ) input : 8, SCSI-ID(1) output : status(1), drive capacity(4) ;========================================================== command 9 : ignored ;========================================================== command A : invalid ;========================================================== command B : invalid ;========================================================== command C : ignored ;========================================================== command D : reset SCSI ( BIOS function ) input : D output : 0 ;========================================================== command E : invalid ;========================================================== command F : invalid ;========================================================== command 10 : ignored ;========================================================== command 11 : ignored ;========================================================== command 12 : invalid ;========================================================== command 13 : invalid ;========================================================== command 14 : ignored ;========================================================== command 15 : read drive capacity ( BIOS function ) input : 8, SCSI-ID(1) output : status(1), drive capacity(4) ;========================================================== command 16 : invalid ;========================================================== command 17 : invalid ;========================================================== command 18 : mirror option ( TOOLBME : Used for DISK IMAGE COPY ) input : 18, 1/0 (1) 1:enable the previously disabled mirror pair 0:disable ALL mirror operation output : 0 ;========================================================== command 19 : read errors NO FUNCTION ;========================================================== command 1A : write cache data to Disk ( used by TOOLBME ) input : 1A, SCSI-ID(1) ID=0--7:write cache with drive ID ID=8:write all cache data to drive output : 0 ;========================================================== command 1B : invalidate cache ( Used by TOOLBME ) input : 1B, SCSI-ID(1) ID=0--7:invalidate that ID, ID=8:invalidate all output : 0 ;========================================================== command 1C : cache control ( Used by TOOLBME ) input : 1C, control(1) output : 0 control byte = 0..7 ==> disable the specified device cache option if it is cacheable 80..87 ==> Re-enable the specified device 8 ==> Disable all the device 88 ==> Enable all the device ;========================================================== command 1D : check cache input : 1D, SCSI_ID(1) ID=0--7:SCSI ID to be checked output : 0/1 0:cache is clean, 1:cache is dirty ;========================================================== command 1E : scatter gathered read sectors ( BIOS function ) input : 1E,SCSI-ID(1),block count(1),block address(4),address list address(4), address list entries(2) output : status(1),error code(1) ;========================================================== command 1F : scatter gathered write sectors ( BIOS function ) input : 1F,SCSI-ID(1),block count(1),block address(4),address list address(4), address list entries(2) output : status(1),error code(1) ;========================================================== command 20 : controller setup, USED BY EISA SYSTEM BIOS only to INITIALIZE THE CONTROLLER ( USER APP. DO NOT USE THIS FUNCTION!!! ) input : 20,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15 output : 0 s1 bit 543 IRQ 000 15 001 15 010 14 011 12 100 11 101 10 110 9 111 disabled s1 bit 210 BIOS address 000 DC00 001 DC00 010 D800 011 D400 100 D000 101 CC00 110 C800 111 disabled s2 bit 210 I/O PORT 000 330 001 334 010 230 011 234 100 130 101 134 110 disabled 111 --- s2 bit 543 DMA CHANNEL 000 0 001 DISABLED 010 --- 011 --- 100 --- 101 5 110 6 111 7 S3 = cache line size, possible value = 16,8,4 s4 = define adapter SCSI-ID, possible value = 0,1,2,3,4,5,6,7 s5 bit 32 DRAM test 00 suppressed 01 simplified test 10 full test 11 --- s5 bit 10 DOS 5 option 00 --- 01 disabled 10 enabled, use interrupt vector ( NO FUNCTION ) 11 enabled, steal 1K from DOS s6 power on delay for testing drive ready possible value 20,30,40,50,60,80,100,120 seconds s7 reserved s8 hash depth ( NO FUNCTION ) s9 reserved s10 reserved s11 reserved s12 reserved s13 reserved s14 reserved s15 reserved ;========================================================== command 21 : read EEPROM ( BIOS/DRIVER/TOOLBME Initialization ) input : 21, buffer address(4) output : 0 ( Refer to paragraph : EEPROM FORMAT ) ;========================================================== command 22 : write DRAM ( BIOS initialization ) input : 22, block count(2), block address(2), buffer address(4) output : 0 ;========================================================== command 23 : read DRAM ( BIOS initialization ) input : 22, block count(2), block address(2), buffer address(4) output : 0 ;========================================================== command 24 : write EEPROM ( Configuration or ACF20SU to set options ) input : 24, buffer address(4) output : 0 ;========================================================== command 25 : invalid ;========================================================== command 26 : invalid ;========================================================== command 27 : invalid ;========================================================== command 28 : invalid ;========================================================== command 29 : invalid ;========================================================== command 2A : invalid ;========================================================== command 2B : invalid ;========================================================== command 2C : invalid ;========================================================== command 2D : set DRAM size ( BIOS Initialization ) input : 2D, dram size(2) ; in Kbytes output : 0 ;========================================================== command 2E : get drive information ( BIOS/Driver Initialization ) input : 2E, SCSI-ID(1), buffer address(4) output : 0 buffer : 36 bytes inquery data 4 bytes capacity 4 bytes sector size ;========================================================== command 2F : invalid ;========================================================== command 30 : diag 0 ( Testing only ) input : 30, control(1) set BIOS address and IRQ selection output : 0 ;========================================================== command 31 : diag 1 ( Testing only ) input : 31, control(1) generate IRQ to host output : 0 ;========================================================== command 32 : diag 2 ( Testing only ) input : 32, control(1) set I/O address output : 0 ;========================================================== command 33 : diag 3 ( Testing only ) input : 33, data(15) invert 15 bytes of data output : 0, data(15) ;========================================================== command 34 : diag 4 ( BIOS initialization ) input : 34, buffer address(4) ; Read firmware version string output : 0 ;========================================================== command 35 : diag 5 ; read 64K bytes of SRAM ( Testing only ) input : 35, buffer address(4) ; assume buffer address is 4 byte boundary aligned output : 0 ;========================================================== command 36 : diag 6 ;========================================================== command 37 : diag 7 ;========================================================== command 38 : diag 8 ;========================================================== command 39 : diag 9 ;========================================================== command 3A : diag a ;========================================================== command 3B : Controller reset ; Controller is reset, system must be RESET input : 3B , 12, 34 ; Used after writing controller EEPROM output : None ;========================================================== ; EEPROM FORMAT ;========================================================== command 21 READ EEPROM ==> EEPROM data format Byte 0 --> 127 = EEPROM data byte 128 --> 143 = SETUP data and tha same as that of command 20H ;========================================================== Each ID has 8 bytes options ==> Only first 64 bytes of EEPROM is used in DC-820/DC-320 controller byte0 bit 10 00 Non-cacheable device 01 Cacheable device 32 00 Active sync nego 01 Passive sync nego 1x Async 4 0 Parity check enabled 1 Parity check disabled 5 0 Allow disconnect/reconnect 1 Do not allow disconnection 76 00 BIOS device if HD 01 BIOS device if HD or removable media 1x Not BIOS device byte1 bit 3210 0 1G 64x32 ; Traslation method 1 1.5G 64x48 ; For BIOS Controlled 2 2G 128x32 ; Disk device 3 3G 128x48 4 4.5G 192x48 bit 7654 1000 Mirror master or non-mirror device 0xxx Mirror slave xxx=0--7 : Mirror master's SCSI-ID byte2 bit 210 0 10 MB/SEC ; fast SCSI 1 8 MB/SEC ; fast SCSI 2 6.6 MB/SEC ; fast SCSI 3 5.7 MB/SEC ; fast SCSI 4 5 MB/SEC ; normal SCSI 5 4 MB/SEC ; normal SCSI 6 3 MB/SEC ; normal SCSI 7 2 MB/SEC ; normal SCSI ;========================================================== ; DOS 5 support parameter table ( 16bytes ) ;========================================================== 4 bytes : previous INT13 or previous parameter table 1 byte : previous 475H ( 80h--86h ) 1 byte : my total devices ( 81h--88h ) 2 bytes : Slot specific I/O address 7 bytes : low nibble SCSI-ID, high nibble translation method 1 byte : bit 7 = 1 link to INT13 0 link to parameter low nibble = I/O address bit 0123 (OR) bit 89AB 0000 --- 0001 130 0010 230 0011 330 0100 --- 0101 134 0110 234 0111 334 ;========================================================== ;========================================================== ; BIOS controlled device detect ;========================================================== ;========================================================== All BIOS functions are Adaptec compatible except when DOS 5 is enabled ==> When DOS 5 support disabled ( less or equal to 2 drives support ) AH=6 --- CY ==> No AHA compatible BIOS controlled device NC, BX=80 first device = ID 0, second device = ID 1 NC, BX=81 first device = ID 0 ==> When DOS 5 support enabled ( greater than 2 drives support ) AH=6 CX=4554H, SI=524BH, DI=4D41H CY ==> No TEKRAM DOS5 support device NC, CX=BAABH, SI=ADB4H, DI=B2BEH ==> TEKRAM DOS5 support device exist AH=6 DL,80--87,CX=BAAB, SI=ADB4, DI=B2BE CY ==> Device not controlled by DOS5 support controller NC, BX=IOPORT,AL low nibble = SCSI-ID,AL high nibble=translation method Procedures to determine AHA compatible device and TEKRAM DOS5 device 1. DL=80h, AH=6 ==> int13 ==> BX=ID of first SCSI device DL=81h, AH=6 ==> int13 ==> BX=ID of first SCSI device for all other drive # DL=8X, AH=6, CX=4554, SI=524b, DI=4D41, INT13 to check if TRM BIOS device if it is ==> INT13 again to get the IOPORT and ID, translation method Programming information ;========================================================== ;========================================================== ; Mailbox interface ;========================================================== ;========================================================== ************************************ Adaptec compatible mailbox structure ************************************ CCB structure byte 0 Command control block opcode 1 tar/init | data out | data in | LUN 2 SCSI command length ( = m ) 3 Request sense allocation 4 Data length ( MSB,MID,LSB ) 7 Data pointer ( MSB,MID,LSB ) 10 Link pointer ( MSB,MID,LSB ) 13 command link ID 14 Host status 15 Target status 16 Reserved ( byte #3 for data pointer ) 17 Reserved 18 SCSI command bytes ( m bytes ) 18+m Sense data buffer For Adaptec compatible byte 16,17 are reserved Command control block opcodes are 00,01,02,03,04,81h Addressing limitation is 16M bytes ;========================================================== ; Tekram enhanced OPCODE for breaking 16MB limitation : ;========================================================== Opcode 10h SCSI Initiator command control block 12h SCSI Initiator command control block with scatter gather Place byte #3 ( The most significant byte ) of data pointer at CCB offset 16. Address list format is also modified to break 16MB limitation when scatter gather is required. ********************************************************* Modified address list format for scatter gather operation ********************************************************* Maximum number of scatter gather list entries is 17 each entry have 4 bytes of data length, and 4 bytes of address Address list : Entry #0 data length byte #0, #1, #2, #3, address byte #0, #1, #2, #3 Entry #1 data length byte #0, #1, #2, #3, address byte #0, #1, #2, #3 .. .. .. Note : Address list is modified to LITTLE ENDIAN ( rather than BIG ENDIAN ) Mailbox initialization is not modified, so mailbox MUST be below 16MB Data buffer and address list can be placed above 16M by using OPCODE 10h or 12h and place the MSB of the address at CCB offset 16, use the modified address list format if scatter gather is desired.