|
|
1.1 root 1: /* hp.c 4.6 81/05/10 */
2:
3: /*
4: * RP??/RM?? disk driver
5: */
6:
7: #include <sys/param.h>
8: #include <sys/inode.h>
9: #include <sys/hpreg.h>
10: #include <sys/pte.h>
11: #include <sys/mbareg.h>
12: #include "saio.h"
13: #include "savax.h"
14:
15: #define MASKREG(reg) ((reg)&0xffff)
16:
17: char hp_type[MAXNMBA*8] = { 0 };
18:
19: /* THIS SHOULD BE READ IN OFF THE PACK, PER DRIVE */
20: short hp6_off[8] = { 0, 38, 0, -1, -1, -1, 118, -1 };
21: short rm3_off[8] = { 0, 100, 0, -1, -1, -1, 310, -1 };
22: short rm5_off[8] = { 0, 27, 0, 562, 589, 681, 562, 82 };
23: short rm80_off[8] = { 0, 37, 0, -1, -1, -1, 115, 305 };
24: short hp7_off[8] = { 0, 10, 0, 330, 340, 500, 330, 50 };
25: short mfj_off[8] = { 0, 32, 96, 0, 0, 0, 0, 0};
26: /* END SHOULD BE READ IN */
27:
28: short hptypes[] =
29: { MBDT_RM03, MBDT_RM05, MBDT_RP06, MBDT_RM80, MBDT_RP05, MBDT_RP07,
30: MBDT_FUJI, 0 };
31:
32: struct hpst {
33: short nsect;
34: short ntrak;
35: short nspc;
36: short ncyl;
37: short *off;
38: } hpst[] = {
39: 32, 5, 32*5, 823, rm3_off, /* RM03 */
40: 32, 19, 32*19, 823, rm5_off, /* RM05 */
41: 22, 19, 22*19, 815, hp6_off, /* RP06 */
42: 31, 14, 31*14, 559, rm80_off, /* RM80 */
43: 22, 19, 22*19, 411, hp6_off, /* RP06 */
44: 50, 32, 50*32, 630, hp7_off, /* RP07 */
45: 32, 10, 32*10, 823, mfj_off, /* little fujitsu */
46: };
47:
48: hpopen(io)
49: register struct iob *io;
50: {
51: register unit = io->i_unit;
52: struct hpdevice *hpaddr = (struct hpdevice *)mbadrv(unit);
53: register struct hpst *st;
54:
55: mbainit(UNITTOMBA(io->i_unit));
56: if (hp_type[unit] == 0) {
57: register type = hpaddr->hpdt & MBDT_TYPE;
58: register int i;
59:
60: for (i = 0; hptypes[i]; i++)
61: if (hptypes[i] == type)
62: goto found;
63: _stop("unknown drive type");
64: found:
65: hp_type[unit] = i;
66: }
67: st = &hpst[hp_type[unit]];
68: if (io->i_boff < 0 || io->i_boff > 7 ||
69: st->off[io->i_boff]== -1)
70: _stop("hp bad minor");
71: io->i_boff = st->off[io->i_boff] * st->nspc;
72: }
73:
74: hpstrategy(io, func)
75: register struct iob *io;
76: {
77: int unit = io->i_unit;
78: daddr_t bn = io->i_bn;
79: struct hpdevice *hpaddr = (struct hpdevice *)mbadrv(unit);
80: struct hpst *st = &hpst[hp_type[unit]];
81: int cn, tn, sn;
82:
83: if ((hpaddr->hpds & HPDS_VV) == 0) {
84: hpaddr->hpcs1 = HP_DCLR|HP_GO;
85: hpaddr->hpcs1 = HP_PRESET|HP_GO;
86: hpaddr->hpof = HPOF_FMT22;
87: }
88: cn = bn/st->nspc;
89: sn = bn%st->nspc;
90: tn = sn/st->nsect;
91: sn = sn%st->nsect;
92: hpaddr->hpdc = cn;
93: hpaddr->hpda = (tn << 8) + sn;
94: mbastart(io, func);
95: while ((hpaddr->hpds & HPDS_DRY) == 0)
96: ;
97: if (hpaddr->hpds&HPDS_ERR) {
98: printf("hp error: (cyl,trk,sec)=(%d,%d,%d) ds=%b er1=%b\n",
99: cn, tn, sn, MASKREG(hpaddr->hpds), HPDS_BITS,
100: MASKREG(hpaddr->hper1), HPER1_BITS);
101: return (-1);
102: }
103: return (io->i_cc);
104: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.