1: /*
2: * Copyright (c) 1986 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: *
6: * @(#)si.c 2.2 (2.11BSD) 1996/3/8
7: *
8: * SI 9500 CDC 9766 Stand Alone disk driver
9: */
10:
11: #include "../h/param.h"
12: #include "../pdpuba/sireg.h"
13: #include "saio.h"
14:
15: #define NSI 2
16:
17: struct sidevice *SIcsr[NSI + 1] =
18: {
19: (struct sidevice *)0176700,
20: (struct sidevice *)0,
21: (struct sidevice *)-1
22: };
23:
24: /* defines for 9766 */
25: #define NHEADS 19
26: #define NSECT 32
27:
28: #define NSPC NSECT*NHEADS
29: static u_char dualsi[NSI];
30:
31: sistrategy(io, func)
32: register struct iob *io;
33: {
34: int unit = io->i_unit;
35: register int ctlr = io->i_ctlr;
36: register struct sidevice *siaddr = SIcsr[ctlr];
37: int ii;
38: daddr_t bn;
39: int sn, cn, tn, bae, lo16;
40:
41: /*
42: * weirdness with bit 2 (04) removed - see xp.c for comments
43: * about this
44: */
45: bn = io->i_bn;
46: cn = bn / (NSPC);
47: sn = bn % (NSPC);
48: tn = sn / (NSECT);
49: sn = sn % (NSECT);
50:
51: if (!dualsi[ctlr]) {
52: if (siaddr->siscr != 0)
53: dualsi[ctlr]++;
54: else
55: if ((siaddr->sierr & (SIERR_ERR | SIERR_CNT)) == (SIERR_ERR | SIERR_CNT))
56: dualsi[ctlr]++;
57: }
58: if (dualsi[ctlr])
59: while (!(siaddr->siscr & 0200)) {
60: siaddr->sicnr = SI_RESET;
61: siaddr->siscr = 1;
62: }
63: iomapadr(io->i_ma, &bae, &lo16);
64: siaddr->sipcr = cn + (unit <<10);
65: siaddr->sihsr = (tn << 5) + sn;
66: siaddr->simar = (caddr_t)lo16;
67: siaddr->siwcr = io->i_cc >> 1;
68: ii = (bae << 4) | SI_GO;
69: if (func == READ)
70: ii |= SI_READ;
71: else if (func == WRITE)
72: ii |= SI_WRITE;
73:
74: siaddr->sicnr = ii;
75:
76: while ((siaddr->sicnr & SI_DONE) == 0)
77: continue;
78:
79: if (siaddr->sierr & SIERR_ERR) {
80: printf("%s err cy=%d hd=%d sc=%d cnr=%o, err=%o\n",
81: devname(io), cn, tn, sn, siaddr->sicnr, siaddr->sierr);
82: return(-1);
83: }
84: return(io->i_cc);
85: }
86:
87: siopen(io)
88: struct iob *io;
89: {
90: return(genopen(NSI, io));
91: }
Defined functions
Defined variables
SIcsr
defined in line
17; used 2 times
Defined macros
NSECT
defined in line
26; used 3 times
NSI
defined in line
15; used 3 times
NSPC
defined in line
28; used 2 times