141480Smckusick /* 241480Smckusick * Copyright (c) 1988 University of Utah. 341480Smckusick * Copyright (c) 1982, 1990 The Regents of the University of California. 441480Smckusick * All rights reserved. 541480Smckusick * 641480Smckusick * This code is derived from software contributed to Berkeley by 741480Smckusick * the Systems Programming Group of the University of Utah Computer 841480Smckusick * Science Department. 941480Smckusick * 1041480Smckusick * %sccs.include.redist.c% 1141480Smckusick * 12*46681Smckusick * from: Utah $Hdr: rdreg.h 1.2 90/10/12$ 1341480Smckusick * 14*46681Smckusick * @(#)rdreg.h 7.3 (Berkeley) 02/25/91 1541480Smckusick */ 1641480Smckusick 1741480Smckusick struct rd_iocmd { 1841480Smckusick char c_pad; 1941480Smckusick char c_unit; 2041480Smckusick char c_volume; 2141480Smckusick char c_saddr; 2241480Smckusick short c_hiaddr; 2341480Smckusick long c_addr; 2441480Smckusick char c_nop2; 2541480Smckusick char c_slen; 2641480Smckusick long c_len; 2741480Smckusick char c_cmd; 2841480Smckusick char c_pad2; 2941480Smckusick }; 3041480Smckusick 3141480Smckusick struct rd_rscmd { 3241480Smckusick char c_unit; 3341480Smckusick char c_sram; 3441480Smckusick char c_ram; 3541480Smckusick char c_cmd; 3641480Smckusick }; 3741480Smckusick 3841480Smckusick struct rd_stat { 3941480Smckusick char c_vu; 4041480Smckusick char c_pend; 4141480Smckusick short c_ref; 4241480Smckusick short c_fef; 4341480Smckusick short c_aef; 4441480Smckusick short c_ief; 4541480Smckusick union { 4641480Smckusick char cu_raw[10]; 4741480Smckusick struct { 4841480Smckusick short cu_msw; 4941480Smckusick long cu_lsl; 5041480Smckusick } cu_sva; 5141480Smckusick struct { 5241480Smckusick long cu_cyhd; 5341480Smckusick short cu_sect; 5441480Smckusick } cu_tva; 5541480Smckusick } c_pf; 5641480Smckusick }; 5741480Smckusick #define c_raw c_pf.cu_raw 5841480Smckusick #define c_blk c_pf.cu_sva.cu_lsl /* for now */ 5941480Smckusick #define c_tva c_pf.cu_tva 6041480Smckusick 6141480Smckusick struct rd_ssmcmd { 6241480Smckusick char c_unit; 6341480Smckusick char c_cmd; 6441480Smckusick short c_refm; 6541480Smckusick short c_fefm; 6641480Smckusick short c_aefm; 6741480Smckusick short c_iefm; 6841480Smckusick }; 6941480Smckusick 7041480Smckusick struct rd_srcmd { 7141480Smckusick char c_unit; 7241480Smckusick char c_nop; 7341480Smckusick char c_cmd; 7441480Smckusick char c_param; 7541480Smckusick }; 7641480Smckusick 7741480Smckusick struct rd_clearcmd { 7841480Smckusick char c_unit; 7941480Smckusick char c_cmd; 8041480Smckusick }; 8141480Smckusick 8241480Smckusick struct rd_describe { 8341480Smckusick u_int d_iuw:16, /* controller: installed unit word */ 8441480Smckusick d_cmaxxfr:16, /* controller: max transfer rate (Kb) */ 8541480Smckusick d_ctype:8, /* controller: controller type */ 8641480Smckusick d_utype:8, /* unit: unit type */ 8741480Smckusick d_name:24, /* unit: name (6 BCD digits) */ 8841480Smckusick d_sectsize:16, /* unit: # of bytes per block (sector) */ 8941480Smckusick d_blkbuf:8, /* unit: # of blocks which can be buffered */ 9041480Smckusick d_burstsize:8, /* unit: recommended burst size */ 9141480Smckusick d_blocktime:16, /* unit: block time (u-sec) */ 9241480Smckusick d_uavexfr:16, /* unit: average transfer rate (Kb) */ 9341480Smckusick d_retry:16, /* unit: optimal retry time (1/100-sec) */ 9441480Smckusick d_access:16, /* unit: access time param (1/100-sec) */ 9541480Smckusick d_maxint:8, /* unit: maximum interleave */ 9641480Smckusick d_fvbyte:8, /* unit: fixed volume byte */ 9741480Smckusick d_rvbyte:8, /* unit: removeable volume byte */ 9841480Smckusick d_maxcyl:24, /* volume: maximum cylinder */ 9941480Smckusick d_maxhead:8, /* volume: maximum head */ 10041480Smckusick d_maxsect:16, /* volume: maximum sector on track */ 10141480Smckusick d_maxvsecth:16, /* volume: maximum sector on volume (MSW) */ 10241480Smckusick d_maxvsectl:32, /* volume: maximum sector on volume (LSWs) */ 10341480Smckusick d_interleave:8; /* volume: current interleave */ 10441480Smckusick }; 10541480Smckusick 10641480Smckusick /* indicies into rdinfo -- order is arbitrary */ 10741480Smckusick #define RD7945A 0 10841480Smckusick #define RD9134D 1 10941480Smckusick #define RD9122S 2 11041480Smckusick #define RD7912P 3 11141480Smckusick #define RD7914P 4 11241480Smckusick #define RD7958A 5 11341480Smckusick #define RD7957A 6 11441480Smckusick #define RD7933H 7 11541480Smckusick #define RD9134L 8 11641480Smckusick #define RD7936H 9 11741480Smckusick #define RD7937H 10 11841480Smckusick #define RD7914CT 11 11941480Smckusick #define RD7946A 12 12041480Smckusick #define RD9122D 13 12141480Smckusick #define RD7957B 14 12241480Smckusick #define RD7958B 15 12341480Smckusick #define RD7959B 16 12441480Smckusick 12541480Smckusick /* HW ids */ 12641480Smckusick #define RD7946AID 0x220 /* also 7945A */ 12741480Smckusick #define RD9134DID 0x221 /* also 9122S */ 12841480Smckusick #define RD9134LID 0x222 /* also 9122D */ 12941480Smckusick #define RD7912PID 0x209 13041480Smckusick #define RD7914CTID 0x20A 13141480Smckusick #define RD7914PID 0x20B 13241480Smckusick #define RD7958AID 0x22B 13341480Smckusick #define RD7957AID 0x22A 13441480Smckusick #define RD7933HID 0x212 13541480Smckusick #define RD7936HID 0x213 /* just guessing -- as of yet unknown */ 13641480Smckusick #define RD7937HID 0x214 13741480Smckusick #define RD7957BID 0x22C /* another guess based on 7958B */ 13841480Smckusick #define RD7958BID 0x22D 13941480Smckusick #define RD7959BID 0x22E /* another guess based on 7958B */ 140*46681Smckusick #define RD2200AID 0x22F 141*46681Smckusick #define RD2203AID 0x230 /* yet another guess */ 14241480Smckusick 14341480Smckusick #define NRD7945ABPT (32 >> (DEV_BSHIFT-8)) 14441480Smckusick #define NRD7945ATRK 7 14541480Smckusick #define NRD9134DBPT (32 >> (DEV_BSHIFT-8)) 14641480Smckusick #define NRD9134DTRK 6 14741480Smckusick #define NRD9122SBPT (16 >> (DEV_BSHIFT-8)) 14841480Smckusick #define NRD9122STRK 2 14941480Smckusick #define NRD7912PBPT (64 >> (DEV_BSHIFT-8)) 15041480Smckusick #define NRD7912PTRK 7 15141480Smckusick #define NRD7914PBPT (64 >> (DEV_BSHIFT-8)) 15241480Smckusick #define NRD7914PTRK 7 15341480Smckusick #define NRD7933HBPT (92 >> (DEV_BSHIFT-8)) 15441480Smckusick #define NRD7933HTRK 13 15541480Smckusick #define NRD9134LBPT (32 >> (DEV_BSHIFT-8)) 15641480Smckusick #define NRD9134LTRK 5 15741480Smckusick 15841480Smckusick /* 15941480Smckusick * Several HP drives have an odd number of 256 byte sectors per track. 16041480Smckusick * This makes it rather difficult to break them into 512 and 1024 byte blocks. 16141480Smckusick * So...we just do like HPUX and don't bother to respect hardware track/head 16241480Smckusick * boundries -- we just mold the disk so that we use the entire capacity. 16341480Smckusick * HPUX also sometimes doen't abide by cylinder boundries, we attempt to 16441480Smckusick * whenever possible. 16541480Smckusick * 16641480Smckusick * DISK REAL (256 BPS) HPUX (1024 BPS) BSD (512 BPS) 16741480Smckusick * SPT x HD x CYL SPT x HD x CYL SPT x HD x CYL 16841480Smckusick * ----- --------------- --------------- -------------- 169*46681Smckusick * 7936: 123 x 7 x 1396 25 x 7 x 1716 123 x 7 x 698 170*46681Smckusick * 7937: 123 x 13 x 1396 25 x 16 x 1395 123 x 13 x 698 17141480Smckusick * 172*46681Smckusick * 7957A: 63 x 5 x 1013 11 x 7 x 1036 22 x 7 x 1036 173*46681Smckusick * 7958A: 63 x 8 x 1013 21 x 6 x 1013 36 x 7 x 1013 17441480Smckusick * 175*46681Smckusick * 7957B: 63 x 4 x 1269 9 x 7 x 1269 18 x 7 x 1269 176*46681Smckusick * 7958B: 63 x 6 x 1572 21 x 9 x 786 42 x 9 x 786 177*46681Smckusick * 7959B: 63 x 12 x 1572 21 x 9 x 1572 42 x 9 x 1572 178*46681Smckusick * 179*46681Smckusick * 2200A: 113 x 8 x 1449 113 x 2 x 1449 113 x 4 x 1449 180*46681Smckusick * 2203A: 113 x 16 x 1449 113 x 4 x 1449 113 x 8 x 1449 18141480Smckusick */ 18241480Smckusick #if DEV_BSIZE == 512 18341480Smckusick # define NRD7936HBPT 123 18441480Smckusick # define NRD7936HTRK 7 18541480Smckusick # define NRD7937HBPT 123 18641480Smckusick # define NRD7937HTRK 13 18741480Smckusick # define NRD7957ABPT 22 18841480Smckusick # define NRD7957ATRK 7 18941480Smckusick # define NRD7958ABPT 36 19041480Smckusick # define NRD7958ATRK 7 19141480Smckusick # define NRD7957BBPT 18 19241480Smckusick # define NRD7957BTRK 7 19341480Smckusick # define NRD7958BBPT 42 19441480Smckusick # define NRD7958BTRK 9 19541480Smckusick # define NRD7959BBPT 42 19641480Smckusick # define NRD7959BTRK 9 197*46681Smckusick # define NRD2200ABPT 113 198*46681Smckusick # define NRD2200ATRK 4 199*46681Smckusick # define NRD2203ABPT 113 200*46681Smckusick # define NRD2203ATRK 8 20141480Smckusick #endif 20241480Smckusick #if DEV_BSIZE == 1024 20341480Smckusick # define NRD7957ABPT 11 20441480Smckusick # define NRD7957ATRK 7 20541480Smckusick # define NRD7958ABPT 21 20641480Smckusick # define NRD7958ATRK 6 20741480Smckusick # define NRD7957BBPT 9 20841480Smckusick # define NRD7957BTRK 7 20941480Smckusick # define NRD7958BBPT 21 21041480Smckusick # define NRD7958BTRK 9 21141480Smckusick # define NRD7959BBPT 21 21241480Smckusick # define NRD7959BTRK 9 213*46681Smckusick # define NRD2200ABPT 113 214*46681Smckusick # define NRD2200ATRK 2 215*46681Smckusick # define NRD2203ABPT 113 216*46681Smckusick # define NRD2203ATRK 4 21741480Smckusick #endif 21841480Smckusick 21941480Smckusick /* controller "unit" number */ 22041480Smckusick #define RDCTLR 15 22141480Smckusick 22241480Smckusick /* convert 512 byte count into DEV_BSIZE count */ 22341480Smckusick #define RDSZ(x) ((x) >> (DEV_BSHIFT-9)) 22441480Smckusick 22541480Smckusick /* convert block number into sector number and back */ 22641480Smckusick #define RDBTOS(x) ((x) << (DEV_BSHIFT-8)) 22741480Smckusick #define RDSTOB(x) ((x) >> (DEV_BSHIFT-8)) 22841480Smckusick 22941480Smckusick /* extract cyl/head/sect info from three-vector address */ 23041480Smckusick #define RDCYL(tva) ((u_long)(tva).cu_cyhd >> 8) 23141480Smckusick #define RDHEAD(tva) ((tva).cu_cyhd & 0xFF) 23241480Smckusick #define RDSECT(tva) ((tva).cu_sect) 23341480Smckusick 23441480Smckusick #define REF_MASK 0x0 23541480Smckusick #define FEF_MASK 0x0 23641480Smckusick #define AEF_MASK 0x0 23741480Smckusick #define IEF_MASK 0xF970 23841480Smckusick 23941480Smckusick #define FEF_CU 0x4000 /* cross-unit */ 24041480Smckusick #define FEF_DR 0x0080 /* diagnostic result */ 24141480Smckusick #define FEF_IMR 0x0008 /* internal maintenance release */ 24241480Smckusick #define FEF_PF 0x0002 /* power fail */ 24341480Smckusick #define FEF_REXMT 0x0001 /* retransmit */ 24441480Smckusick #define AEF_UD 0x0040 /* unrecoverable data */ 24541480Smckusick #define IEF_RRMASK 0xe000 /* request release bits */ 24641480Smckusick #define IEF_MD 0x0020 /* marginal data */ 24741480Smckusick #define IEF_RD 0x0010 /* recoverable data */ 24841480Smckusick 24941480Smckusick #define C_READ 0x00 25041480Smckusick #define C_RAM 0x00 /* single vector (i.e. sector number) */ 25141480Smckusick #define C_WRITE 0x02 25241480Smckusick #define C_CLEAR 0x08 25341480Smckusick #define C_STATUS 0x0d 25441480Smckusick #define C_SADDR 0x10 25541480Smckusick #define C_SLEN 0x18 25641480Smckusick #define C_SUNIT(x) (0x20 | (x)) 25741480Smckusick #define C_SVOL(x) (0x40 | (x)) 25841480Smckusick #define C_NOP 0x34 25941480Smckusick #define C_DESC 0x35 26041480Smckusick #define C_SREL 0x3b 26141480Smckusick #define C_SSM 0x3e 26241480Smckusick #define C_SRAM 0x48 26341480Smckusick #define C_REL 0x140 26441480Smckusick 26541480Smckusick #define C_CMD 0x05 26641480Smckusick #define C_EXEC 0x0e 26741480Smckusick #define C_QSTAT 0x10 26841480Smckusick #define C_TCMD 0x12 269