1: /*
2: * RM02/3 disk driver
3: */
4:
5: #include <sys/param.h>
6: #include <sys/inode.h>
7: #include "../saio.h"
8:
9: struct device
10: {
11: union {
12: int w;
13: char c[2];
14: } rmcs1; /* Control and Status register 1 */
15: int rmwc; /* Word count register */
16: caddr_t rmba; /* UNIBUS address register */
17: int rmda; /* Desired address register */
18: union {
19: int w;
20: char c[2];
21: } rmcs2; /* Control and Status register 2*/
22: int rmds; /* Drive Status */
23: int rmer1; /* Error register 1 */
24: int rmas; /* Attention Summary */
25: int rmla; /* Look ahead */
26: int rmdb; /* Data buffer */
27: int rmmr1; /* Maintenance register 1 */
28: int rmdt; /* Drive type */
29: int rmsn; /* Serial number */
30: int rmof; /* Offset register */
31: int rmdc; /* Desired Cylinder register*/
32: int rmhr; /* Holding register - unused*/
33: int rmmr2; /* Maintenence register 2 */
34: int rmer2; /* Error register 2 */
35: int rmec1; /* Burst error bit position */
36: int rmec2; /* Burst error bit pattern */
37: int rmbae; /* 11/70 bus extension */
38: int rmcs3;
39: };
40:
41: #define RMADDR ((struct device *)0176700)
42: #define NSECT 32
43: #define NTRAC 5
44: #define SDIST 2
45: #define RDIST 6
46:
47: #define P400 020
48: #define M400 0220
49: #define P800 040
50: #define M800 0240
51: #define P1200 060
52: #define M1200 0260
53:
54: #define GO 01
55: #define PRESET 020
56: #define RTC 016
57: #define OFFSET 014
58: #define SEARCH 030
59: #define RECAL 06
60: #define DCLR 010
61: #define WCOM 060
62: #define RCOM 070
63:
64: #define IE 0100
65: #define PIP 020000
66: #define DRY 0200
67: #define ERR 040000
68: #define TRE 040000
69: #define DCK 0100000
70: #define WLE 04000
71: #define ECH 0100
72: #define VV 0100
73: #define FMT16 010000
74:
75: rmstrategy(io, func)
76: register struct iob *io;
77: {
78: register unit;
79: register i;
80: daddr_t bn;
81: int sn, cn, tn;
82:
83: if (((unit = io->i_unit) & 04) == 0)
84: bn = io->i_bn;
85: else {
86: unit &= 03;
87: bn = io->i_bn;
88: bn -= io->i_boff;
89: i = unit + 1;
90: unit = bn%i;
91: bn /= i;
92: bn += io->i_boff;
93: }
94:
95: RMADDR->rmcs2.w = unit;
96:
97: if((RMADDR->rmds & VV) == 0) {
98: RMADDR->rmcs1.c[0] = PRESET|GO;
99: RMADDR->rmof = FMT16;
100: }
101: cn = bn/(NSECT*NTRAC);
102: sn = bn%(NSECT*NTRAC);
103: tn = sn/NSECT;
104: sn = sn%NSECT;
105:
106: RMADDR->rmdc = cn;
107: RMADDR->rmda = (tn << 8) + sn;
108: RMADDR->rmba = io->i_ma;
109: RMADDR->rmwc = -(io->i_cc>>1);
110: unit = (segflag << 8) | GO;
111: if (func == READ)
112: unit |= RCOM;
113: else if (func == WRITE)
114: unit |= WCOM;
115: RMADDR->rmcs1.w = unit;
116: while ((RMADDR->rmcs1.w&DRY) == 0)
117: ;
118: if (RMADDR->rmcs1.w & TRE) {
119: printf("disk error: cyl=%d track=%d sect=%d cs2=%o, er1=%o\n",
120: cn, tn, sn, RMADDR->rmcs2, RMADDR->rmer1);
121: return(-1);
122: }
123: return(io->i_cc);
124: }
Defined functions
Defined struct's
device
defined in line
9;
never used
Defined macros
DCK
defined in line
69;
never used
DCLR
defined in line
60;
never used
DRY
defined in line
66; used 1 times
ECH
defined in line
71;
never used
ERR
defined in line
67;
never used
FMT16
defined in line
73; used 1 times
GO
defined in line
54; used 2 times
IE
defined in line
64;
never used
M1200
defined in line
52;
never used
M400
defined in line
48;
never used
M800
defined in line
50;
never used
NSECT
defined in line
42; used 4 times
NTRAC
defined in line
43; used 2 times
P1200
defined in line
51;
never used
P400
defined in line
47;
never used
P800
defined in line
49;
never used
PIP
defined in line
65;
never used
RCOM
defined in line
62; used 1 times
RDIST
defined in line
45;
never used
RECAL
defined in line
59;
never used
RMADDR
defined in line
41; used 13 times
RTC
defined in line
56;
never used
SDIST
defined in line
44;
never used
TRE
defined in line
68; used 1 times
VV
defined in line
72; used 1 times
WCOM
defined in line
61; used 1 times
WLE
defined in line
70;
never used