1*30869Skarels /* cyreg.h 7.5 87/04/09 */ 225676Ssam 325979Ssam /* 425979Ssam * Tapemaster controller definitions. 525979Ssam */ 625676Ssam 730719Skarels /* 830719Skarels * With 20-bit addressing, the intermediate buffer 930719Skarels * must be allocated early in startup(). 1030719Skarels */ 11*30869Skarels #define CYMAXIO (64*1024) /* max i/o size + 1 */ 1230719Skarels char *cybuf; 1330719Skarels 1425979Ssam /* for byte swapping Multibus values */ 1525979Ssam #define htoms(x) (short)((((x)>>8)&0xff) | (((x)<<8)&0xff00)) 1625676Ssam 1725979Ssam #define b_repcnt b_bcount 1825979Ssam #define b_command b_resid 1925676Ssam 2025979Ssam /* 2130372Skarels * System configuration pointer. 2230372Skarels * Memory address is jumpered on controller. 2330372Skarels */ 2430372Skarels struct cyscp { 2530372Skarels char csp_buswidth; /* system bus width */ 2630372Skarels #define CSP_16BITS 1 /* 16-bit system bus */ 2730372Skarels #define CSP_8BITS 0 /* 8-bit system bus */ 2830372Skarels char csp_unused; 2930372Skarels u_char csp_scb[4]; /* point to system config block */ 3030372Skarels }; 3130372Skarels 3230372Skarels /* 3330372Skarels * System configuration block 3430372Skarels */ 3530372Skarels struct cyscb { 3630372Skarels char csb_fixed; /* fixed value code (must be 3) */ 3730372Skarels char csb_unused; /* unused */ 3830372Skarels u_char csb_ccb[4]; /* pointer to channel control block */ 3930372Skarels }; 4030372Skarels 4130372Skarels #define CSB_FIXED 0x3 4230372Skarels 4330372Skarels /* 4425979Ssam * Channel control block definitions 4525979Ssam */ 4625979Ssam struct cyccb { 4725979Ssam char cbcw; /* channel control word */ 4825979Ssam char cbgate; /* tpb access gate */ 4930372Skarels u_char cbtpb[4]; /* first tape parameter block */ 5025979Ssam }; 5125676Ssam 5225979Ssam #define GATE_OPEN (char)(0x00) 5325979Ssam #define GATE_CLOSED (char)(0xff) 5425676Ssam 5525979Ssam #define CY_GO(addr) movob((addr), 0xff) /* channel attention */ 5625979Ssam #define CY_RESET(addr) movob((addr)+1, 0xff) /* software controller reset */ 5725676Ssam 5825979Ssam #define CBCW_IE 0x11 /* interrupt on cmd completion */ 5925979Ssam #define CBCW_CLRINT 0x09 /* clear active interrupt */ 6025676Ssam 6125979Ssam /* 6225979Ssam * Tape parameter block definitions 6325979Ssam */ 6425979Ssam struct cytpb { 65*30869Skarels u_long tpcmd; /* command, see below */ 66*30869Skarels u_short tpcontrol; /* control word */ 67*30869Skarels u_short tpcount; /* return count */ 68*30869Skarels u_short tpsize; /* buffer size */ 69*30869Skarels u_short tprec; /* records/overrun */ 7030372Skarels u_char tpdata[4]; /* pointer to source/dest */ 71*30869Skarels u_short tpstatus; /* status */ 7230372Skarels u_char tplink[4]; /* pointer to next parameter block */ 7325979Ssam }; 7425676Ssam 7525979Ssam /* control field bit definitions */ 7625979Ssam #define CYCW_UNIT (0x000c<<8) /* unit select mask, 2 bit field */ 7725979Ssam #define CYCW_IE (0x0020<<8) /* interrupt enable */ 7825979Ssam #define CYCW_LOCK (0x0080<<8) /* bus lock flag */ 7925979Ssam #define CYCW_REV (0x0400>>8) /* reverse flag */ 8025979Ssam #define CYCW_SPEED (0x0800>>8) /* speed/density */ 8125979Ssam #define CYCW_25IPS 0 8225979Ssam #define CYCW_100IPS (0x0800>>8) 8325979Ssam #define CYCW_WIDTH (0x8000>>8) /* width */ 8425979Ssam #define CYCW_8BITS 0 8525979Ssam #define CYCW_16BITS (0x8000>>8) 8625676Ssam 8725979Ssam #define CYCW_BITS "\20\3REV\005100IPS\00716BITS\16IE\20LOCK" 8825676Ssam 8925979Ssam /* 9025979Ssam * Controller commands 9125979Ssam */ 9225676Ssam 9325979Ssam /* control status/commands */ 9425979Ssam #define CY_CONFIG (0x00<<24) /* configure */ 9525979Ssam #define CY_NOP (0x20<<24) /* no operation */ 9630372Skarels #define CY_SETPAGE (0x08<<24) /* set page (addr bits 20-23) */ 9725979Ssam #define CY_SENSE (0x28<<24) /* drive status */ 9825979Ssam #define CY_CLRINT (0x9c<<24) /* clear Multibus interrupt */ 9925676Ssam 10025979Ssam /* tape position commands */ 10125979Ssam #define CY_REW (0x34<<24) /* rewind tape */ 10225979Ssam #define CY_OFFL (0x38<<24) /* off_line and unload */ 10325979Ssam #define CY_WEOF (0x40<<24) /* write end-of-file mark */ 10425979Ssam #define CY_SFORW (0x70<<24) /* space record forward */ 10530372Skarels #define CY_SREV (CY_SFORW|CYCW_REV) /* space record backwards */ 10630372Skarels #define CY_FSF (0x44<<24) /* space file forward */ 10730372Skarels #define CY_BSF (CY_FSF|CYCW_REV) /* space file backwards */ 10825979Ssam #define CY_ERASE (0x4c<<24) /* erase record */ 10925676Ssam 11025979Ssam /* data transfer commands */ 11125979Ssam #define CY_BRCOM (0x10<<24) /* read buffered */ 11225979Ssam #define CY_BWCOM (0x14<<24) /* write buffered */ 11325979Ssam #define CY_RCOM (0x2c<<24) /* read tape unbuffered */ 11425979Ssam #define CY_WCOM (0x30<<24) /* write tape unbuffered */ 11525676Ssam 11625979Ssam /* status field bit definitions */ 11725979Ssam #define CYS_WP (0x0002<<8) /* write protected, no write ring */ 11825979Ssam #define CYS_BSY (0x0004<<8) /* formatter busy */ 11925979Ssam #define CYS_RDY (0x0008<<8) /* drive ready */ 12025979Ssam #define CYS_EOT (0x0010<<8) /* end of tape detected */ 12125979Ssam #define CYS_BOT (0x0020<<8) /* tape is at load point */ 12225979Ssam #define CYS_OL (0x0040<<8) /* drive on_line */ 12325979Ssam #define CYS_FM (0x0080<<8) /* filemark detected */ 12425979Ssam #define CYS_ERR (0x1f00>>8) /* error value mask */ 12525979Ssam #define CYS_CR (0x2000>>8) /* controller executed retries */ 12625979Ssam #define CYS_CC (0x4000>>8) /* command completed successfully */ 12725979Ssam #define CYS_CE (0x8000>>8) /* command execution has begun */ 12825676Ssam 12925979Ssam #define CYS_BITS "\20\6CR\7CC\10CE\12WP\13BSY\14RDY\15EOT/BOT\16BOT\17OL\20FM" 13025676Ssam 13125979Ssam /* error codes for CYS_ERR */ 13225979Ssam #define CYER_TIMOUT 0x01 /* timed out data busy false */ 13325979Ssam #define CYER_TIMOUT1 0x02 /* data busy false,formatter,ready */ 13425979Ssam #define CYER_TIMOUT2 0x03 /* time out ready busy false */ 13525979Ssam #define CYER_TIMOUT3 0x04 /* time out ready busy true */ 13625979Ssam #define CYER_TIMOUT4 0x05 /* time out data busy true */ 13725979Ssam #define CYER_NXM 0x06 /* time out memory */ 13825979Ssam #define CYER_BLANK 0x07 /* blank tape */ 13925979Ssam #define CYER_DIAG 0x08 /* micro-diagnostic */ 14025979Ssam #define CYER_EOT 0x09 /* EOT forward, BOT rev. */ 14125979Ssam #define CYER_BOT 0x09 /* EOT forward, BOT rev. */ 14225979Ssam #define CYER_HERR 0x0a /* retry unsuccessful */ 14325979Ssam #define CYER_FIFO 0x0b /* FIFO over/under flow */ 14425979Ssam #define CYER_PARITY 0x0d /* drive to tapemaster parity error */ 14525979Ssam #define CYER_CKSUM 0x0e /* prom checksum */ 14625979Ssam #define CYER_STROBE 0x0f /* time out tape strobe */ 14725979Ssam #define CYER_NOTRDY 0x10 /* tape not ready */ 14825979Ssam #define CYER_PROT 0x11 /* write, no enable ring */ 14925979Ssam #define CYER_JUMPER 0x13 /* missing diagnostic jumper */ 15025979Ssam #define CYER_LINK 0x14 /* bad link, link inappropriate */ 15125979Ssam #define CYER_FM 0x15 /* unexpected filemark */ 15225979Ssam #define CYER_PARAM 0x16 /* bad parameter, byte count ? */ 15325979Ssam #define CYER_HDWERR 0x18 /* unidentified hardware error */ 15425979Ssam #define CYER_NOSTRM 0x19 /* streaming terminated */ 15525676Ssam 15625979Ssam #ifdef CYERROR 15725979Ssam char *cyerror[] = { 15830372Skarels "no error", 15925979Ssam "timeout", 16025979Ssam "timeout1", 16125979Ssam "timeout2", 16225979Ssam "timeout3", 16325979Ssam "timeout4", 16430372Skarels "non-existent memory", 16525979Ssam "blank tape", 16625979Ssam "micro-diagnostic", 16725979Ssam "eot/bot detected", 16825979Ssam "retry unsuccessful", 16925979Ssam "fifo over/under-flow", 17030372Skarels "#0xc", 17125979Ssam "drive to controller parity error", 17225979Ssam "prom checksum", 17325979Ssam "time out tape strobe (record length error)", 17425979Ssam "tape not ready", 17525979Ssam "write protected", 17630372Skarels "#0x12", 17725979Ssam "missing diagnostic jumper", 17825979Ssam "invalid link pointer", 17925979Ssam "unexpected file mark", 18030372Skarels "invalid byte count/parameter", 18130372Skarels "#0x17", 18225979Ssam "unidentified hardware error", 18325979Ssam "streaming terminated" 18425979Ssam }; 18525979Ssam #define NCYERROR (sizeof (cyerror) / sizeof (cyerror[0])) 18625979Ssam #endif 18725676Ssam 18825979Ssam /* 18925979Ssam * Masks defining hard and soft errors (must check against 1<<CYER_code). 19025979Ssam */ 19125979Ssam #define CYMASK(e) (1<<(CYER_/**/e)) 19225979Ssam #define CYER_HARD (CYMASK(TIMOUT)|CYMASK(TIMOUT1)|CYMASK(TIMOUT2)|\ 19325979Ssam CYMASK(TIMOUT3)|CYMASK(TIMOUT4)|CYMASK(NXM)|CYMASK(DIAG)|CYMASK(JUMPER)|\ 19425979Ssam CYMASK(STROBE)|CYMASK(PROT)|CYMASK(CKSUM)|CYMASK(HERR)|CYMASK(BLANK)) 19525979Ssam #define CYER_SOFT (CYMASK(FIFO)|CYMASK(NOTRDY)|CYMASK(PARITY)) 196