1: /*
   2:  *	RK06/07 disk driver for standalone
   3:  */
   4: 
   5: #include <sys/param.h>
   6: #include <sys/inode.h>
   7: #include "../saio.h"
   8: 
   9: 
  10: struct device
  11: {
  12:     int hkcs1;
  13:     int hkwc;
  14:     caddr_t hkba;
  15:     int hkda;
  16:     int hkcs2;
  17:     int hkds;
  18:     int hkerr;
  19:     int hkas;
  20:     int hkdc;
  21:     int dum;
  22:     int hkdb;
  23:     int hkmr1;
  24:     int hkec1;
  25:     int hkec2;
  26:     int hkmr2;
  27:     int hkmr3;
  28: };
  29: 
  30: #define HKADDR  ((struct device *)0177440)
  31: #define NHK 8
  32: #define NSECT   22
  33: #define NTRAC   3
  34: 
  35: #define P400    020
  36: #define M400    0220
  37: #define P800    040
  38: #define M800    0240
  39: #define P1200   060
  40: #define M1200   0260
  41: 
  42: 
  43: #define GO  01
  44: #define SELECT  01
  45: #define PAKACK  02
  46: #define DCLR    04
  47: #define RECAL   012
  48: #define OFFSET  014
  49: #define RCOM    020
  50: #define WCOM    022
  51: #define IEI 0100
  52: #define CRDY    0200
  53: #define CCLR    0100000
  54: #define CERR    0100000
  55: 
  56: #define DLT 0100000
  57: #define UPE 020000
  58: #define NED 010000
  59: #define PGE 02000
  60: #define SCLR    040
  61: 
  62: #define SVAL    0100000
  63: #define CDA 040000
  64: #define PIP 020000
  65: #define WLE 010000
  66: #define DDT 0400
  67: #define DRDY    0200
  68: #define VV  0100
  69: #define DOFST   04
  70: #define DRA 01
  71: 
  72: #define DCK 0100000
  73: #define DUNS    040000
  74: #define OPI 020000
  75: #define DTE 010000
  76: #define DWLE    04000
  77: #define ECH 0100
  78: #define SKI 02
  79: #define DRTER 040
  80: 
  81: int hk_drvtyp[NHK];
  82: char hk_mntflg[NHK];
  83: 
  84: 
  85: hkstrategy(io, func)
  86: register struct iob *io;
  87: {
  88:     register unit,com;
  89:     register i;
  90:     daddr_t bn;
  91:     int sn, cn, tn;
  92: 
  93:     unit = io->i_unit;
  94:     if(hk_mntflg[unit] != '1')
  95:     {
  96:         hk_drvtyp[unit] = 0;
  97:         HKADDR->hkcs2 = unit;
  98:         HKADDR->hkcs1 = SELECT;
  99:         while((HKADDR->hkcs1 & CRDY) == 0);
 100:         if(HKADDR->hkcs1 & CERR && HKADDR->hkerr & DRTER)
 101:         {
 102:             hk_drvtyp[unit] = 02000;
 103:         }
 104:         hk_mntflg[unit] = '1';
 105:     }
 106:     bn = io->i_bn;
 107:     HKADDR->hkcs2 = SCLR;
 108:     while((HKADDR->hkcs1 & CRDY) == 0);
 109:     HKADDR->hkcs2 = unit;
 110:     HKADDR->hkcs1 = hk_drvtyp[unit]|SELECT;
 111:     while((HKADDR->hkcs1 & CRDY) == 0);
 112: 
 113:     if((HKADDR->hkds & VV) == 0){
 114:         HKADDR->hkcs1 = hk_drvtyp[unit]|PAKACK|GO;
 115:         while((HKADDR->hkcs1 & CRDY) == 0);
 116:     }
 117:     cn = bn/(NSECT*NTRAC);
 118:     sn = bn%(NSECT*NTRAC);
 119:     tn = sn/NSECT;
 120:     sn = sn%NSECT;
 121: 
 122:     HKADDR->hkdc = cn;
 123:     HKADDR->hkda = (tn<<8) | sn;
 124:     HKADDR->hkba = io->i_ma;
 125:     HKADDR->hkwc = -(io->i_cc>>1);
 126:     com = hk_drvtyp[unit]|(segflag << 8) | GO;
 127:     if (func == READ)
 128:         com |= RCOM;
 129:     else if (func == WRITE)
 130:         com |= WCOM;
 131:     HKADDR->hkcs1 = com;
 132: 
 133:     while((HKADDR->hkcs1 & CRDY) == 0);
 134: 
 135:     if (HKADDR->hkcs1 & CERR){
 136:         printf("disk error: cyl=%d track=%d sect=%d cs2=%d err=%o\n",
 137:             cn, tn, sn, HKADDR->hkcs2, HKADDR->hkerr);
 138:         return(-1);
 139:     }
 140:     return(io->i_cc);
 141: }

Defined functions

hkstrategy defined in line 85; used 2 times

Defined variables

hk_drvtyp defined in line 81; used 5 times
hk_mntflg defined in line 82; used 2 times

Defined struct's

device defined in line 10; never used

Defined macros

CCLR defined in line 53; never used
CDA defined in line 63; never used
CERR defined in line 54; used 2 times
CRDY defined in line 52; used 5 times
DCK defined in line 72; never used
DCLR defined in line 46; never used
DDT defined in line 66; never used
DLT defined in line 56; never used
DOFST defined in line 69; never used
DRA defined in line 70; never used
DRDY defined in line 67; never used
DRTER defined in line 79; used 1 times
DTE defined in line 75; never used
DUNS defined in line 73; never used
DWLE defined in line 76; never used
ECH defined in line 77; never used
GO defined in line 43; used 2 times
HKADDR defined in line 30; used 22 times
IEI defined in line 51; never used
M1200 defined in line 40; never used
M400 defined in line 36; never used
M800 defined in line 38; never used
NED defined in line 58; never used
NHK defined in line 31; used 2 times
NSECT defined in line 32; used 4 times
NTRAC defined in line 33; used 2 times
OFFSET defined in line 48; never used
OPI defined in line 74; never used
P1200 defined in line 39; never used
P400 defined in line 35; never used
P800 defined in line 37; never used
PAKACK defined in line 45; used 1 times
PGE defined in line 59; never used
PIP defined in line 64; never used
RCOM defined in line 49; used 1 times
RECAL defined in line 47; never used
SCLR defined in line 60; used 1 times
SELECT defined in line 44; used 2 times
SKI defined in line 78; never used
SVAL defined in line 62; never used
UPE defined in line 57; never used
VV defined in line 68; used 1 times
WCOM defined in line 50; used 1 times
WLE defined in line 65; never used
Last modified: 1982-11-21
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1269
Valid CSS Valid XHTML 1.0 Strict