1: #
2: /*
3: */
4:
5: /*
6: * RF disk driver
7: */
8:
9: #include "../param.h"
10: #include "../buf.h"
11: #include "../conf.h"
12: #include "../user.h"
13:
14: struct {
15: int rfcs;
16: int rfwc;
17: int rfba;
18: int rfda;
19: int rfdae;
20: };
21:
22: struct devtab rftab;
23: struct buf rrfbuf;
24:
25: #define NRFBLK 1024
26: #define RFADDR 0177460
27:
28: #define GO 01
29: #define RCOM 02
30: #define WCOM 04
31: #define CTLCLR 0400
32: #define IENABLE 0100
33:
34: rfstrategy(abp)
35: struct buf *abp;
36: {
37: register struct buf *bp;
38:
39: bp = abp;
40: if(bp->b_flags&B_PHYS)
41: mapalloc(bp);
42: if (bp->b_blkno >= NRFBLK*(bp->b_dev.d_minor+1)) {
43: bp->b_flags =| B_ERROR;
44: iodone(bp);
45: return;
46: }
47: bp->av_forw = 0;
48: spl5();
49: if (rftab.d_actf==0)
50: rftab.d_actf = bp;
51: else
52: rftab.d_actl->av_forw = bp;
53: rftab.d_actl = bp;
54: if (rftab.d_active==0)
55: rfstart();
56: spl0();
57: }
58:
59: rfstart()
60: {
61: register struct buf *bp;
62:
63: if ((bp = rftab.d_actf) == 0)
64: return;
65: rftab.d_active++;
66: RFADDR->rfdae = bp->b_blkno.hibyte;
67: devstart(bp, &RFADDR->rfda, bp->b_blkno<<8, 0);
68: }
69:
70: rfintr()
71: {
72: register struct buf *bp;
73:
74: if (rftab.d_active == 0)
75: return;
76: bp = rftab.d_actf;
77: rftab.d_active = 0;
78: if (RFADDR->rfcs < 0) { /* error bit */
79: deverror(bp, RFADDR->rfcs, RFADDR->rfdae);
80: RFADDR->rfcs = CTLCLR;
81: if (++rftab.d_errcnt <= 10) {
82: rfstart();
83: return;
84: }
85: bp->b_flags =| B_ERROR;
86: }
87: rftab.d_errcnt = 0;
88: rftab.d_actf = bp->av_forw;
89: iodone(bp);
90: rfstart();
91: }
92:
93: rfread(dev)
94: {
95:
96: physio(rfstrategy, &rrfbuf, dev, B_READ);
97: }
98:
99: rfwrite(dev)
100: {
101:
102: physio(rfstrategy, &rrfbuf, dev, B_WRITE);
103: }
Defined functions
Defined variables
rftab
defined in line
22; used 13 times
Defined macros
GO
defined in line
28;
never used
RCOM
defined in line
29;
never used
WCOM
defined in line
30;
never used