1: /*
   2:  *	SCCS id	@(#)hs.c	2.1	8/5/83
   3:  */
   4: 
   5: /*
   6:  *	RS03/04 disk driver
   7:  */
   8: 
   9: #include "hs.h"
  10: #if NHS > 0
  11: #include "param.h"
  12: #include <sys/systm.h>
  13: #include <sys/buf.h>
  14: #include <sys/conf.h>
  15: #include <sys/dir.h>
  16: #include <sys/user.h>
  17: #include <sys/seg.h>
  18: #include <sys/hsreg.h>
  19: 
  20: #define HS_NRS03BLKS    1024
  21: #define HS_NRS04BLKS    2048
  22: 
  23: struct  hsdevice *HSADDR;
  24: 
  25: struct  buf hstab;
  26: struct  buf rhsbuf;
  27: 
  28: hsroot()
  29: {
  30:     hsattach(HSADDR, 0);
  31: }
  32: 
  33: hsattach(addr, unit)
  34: register struct hsdevice *addr;
  35: {
  36:     if (unit != 0)
  37:         return(0);
  38:     if (fioword(addr) != -1) {
  39:         HSADDR = addr;
  40: #if PDP11 == 70 || PDP11 == GENERIC
  41:         if (fioword(&(addr->hsbae)) != -1)
  42:             hstab.b_flags |= B_RH70;
  43: #endif
  44:         return(1);
  45:     }
  46:     HSADDR = (struct hsdevice *) NULL;
  47:     return(0);
  48: }
  49: 
  50: hsstrategy(bp)
  51: register struct buf *bp;
  52: {
  53:     register s, mblks;
  54: 
  55:     if (minor(bp->b_dev) < 8)
  56:         mblks = HS_NRS03BLKS;
  57:     else
  58:         mblks = HS_NRS04BLKS;
  59:     if (HSADDR == (struct hsdevice *) NULL) {
  60:         bp->b_error = ENXIO;
  61:         goto errexit;
  62:     }
  63:     if (bp->b_blkno < 0 || bp->b_blkno >= mblks) {
  64:         bp->b_error = EINVAL;
  65: errexit:
  66:         bp->b_flags |= B_ERROR;
  67:         iodone(bp);
  68:         return;
  69:     }
  70: 
  71: #ifdef  UNIBUS_MAP
  72:     if ((hstab.b_flags & B_RH70) == 0)
  73:         mapalloc(bp);
  74: #endif	UNIBUS_MAP
  75:     bp->av_forw = 0;
  76:     s = spl5();
  77:     if (hstab.b_actf == 0)
  78:         hstab.b_actf = bp;
  79:     else
  80:         hstab.b_actl->av_forw = bp;
  81:     hstab.b_actl = bp;
  82:     if (hstab.b_active == 0)
  83:         hsstart();
  84:     splx(s);
  85: }
  86: 
  87: hsstart()
  88: {
  89:     register struct hsdevice *hsaddr = HSADDR;
  90:     register struct buf *bp;
  91:     register com_addr;
  92: 
  93:     if ((bp = hstab.b_actf) == 0)
  94:         return;
  95:     hstab.b_active++;
  96:     com_addr = bp->b_blkno;
  97:     if(minor(bp->b_dev) < 8)
  98:         com_addr <<= 1; /* RJS03 */
  99:     hsaddr->hscs2 = minor(bp->b_dev) & 07;
 100:     hsaddr->hsda = com_addr << 1;
 101: #if PDP11 == 70 || PDP11 == GENERIC
 102:     if (hstab.b_flags & B_RH70)
 103:         hsaddr->hsbae = bp->b_xmem;
 104: #endif
 105:     hsaddr->hsba = bp->b_un.b_addr;
 106:     hsaddr->hswc = -(bp->b_bcount >> 1);
 107:     com_addr = HS_IE | HS_GO | ((bp->b_xmem & 03) << 8);
 108:     if(bp->b_flags & B_READ)
 109:         hsaddr->hscs1 = com_addr | HS_RCOM;
 110:     else
 111:         hsaddr->hscs1 = com_addr | HS_WCOM;
 112: #ifdef  HS_DKN
 113:     dk_busy |= 1 << HS_DKN;
 114:     dk_numb[HS_DKN]++;
 115:     dk_wds[HS_DKN] += (bp->b_bcount >> 6) & 01777;
 116: #endif	HS_DKN
 117: }
 118: 
 119: hsintr()
 120: {
 121:     register struct hsdevice *hsaddr = HSADDR;
 122:     register struct buf *bp;
 123:     register i;
 124: 
 125:     if (hstab.b_active == 0)
 126:         return;
 127: #ifdef  HS_DKN
 128:     dk_busy &= ~(1 << HS_DKN);
 129: #endif	HS_DKN
 130:     bp = hstab.b_actf;
 131:     hstab.b_active = 0;
 132:     if(hsaddr->hscs1 & HS_TRE) {
 133: #ifdef  UCB_DEVERR
 134:         harderr(bp, "hs");
 135:         printf("cs1=%b cs2=%b\n", hsaddr->hscs1,
 136:             HS_BITS, hsaddr->hscs2, HSCS2_BITS);
 137: #else
 138:         deverror(bp, hsaddr->hscs1, hsaddr->hscs2);
 139: #endif
 140:         hsaddr->hscs1 = HS_DCLR | HS_GO;
 141:         if (++hstab.b_errcnt <= 10) {
 142:             hsstart();
 143:             return;
 144:         }
 145:         bp->b_flags |= B_ERROR;
 146:     }
 147:     hstab.b_errcnt = 0;
 148:     hstab.b_actf = bp->av_forw;
 149:     iodone(bp);
 150:     hsstart();
 151: }
 152: 
 153: hsread(dev)
 154: dev_t   dev;
 155: {
 156:     physio(hsstrategy, &rhsbuf, dev, B_READ);
 157: }
 158: 
 159: hswrite(dev)
 160: dev_t   dev;
 161: {
 162:     physio(hsstrategy, &rhsbuf, dev, B_WRITE);
 163: }
 164: #endif	NHS

Defined functions

hsattach defined in line 33; used 1 times
  • in line 30
hsintr defined in line 119; used 4 times
hsread defined in line 153; never used
hsroot defined in line 28; never used
hsstart defined in line 87; used 3 times
hsstrategy defined in line 50; used 2 times
hswrite defined in line 159; never used

Defined variables

HSADDR defined in line 23; used 6 times
hstab defined in line 25; used 18 times
rhsbuf defined in line 26; used 2 times

Defined macros

HS_NRS03BLKS defined in line 20; used 1 times
  • in line 56
HS_NRS04BLKS defined in line 21; used 1 times
  • in line 58
Last modified: 1983-08-06
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 889
Valid CSS Valid XHTML 1.0 Strict