bozo typing
[unix-history] / usr / src / sys / vax / stand / hpmaptype.c
CommitLineData
e4b4ea82 1/* hpmaptype.c 4.7 83/03/03 */
c29bef6b
SL
2
3/*
4 * RP??/RM?? drive type mapping routine.
5 */
6#include "../machine/pte.h"
7
8#include "../h/param.h"
9#include "../h/inode.h"
10#include "../h/fs.h"
11
12#include "../vaxmba/hpreg.h"
13#include "../vaxmba/mbareg.h"
14
15#include "saio.h"
16#include "savax.h"
17
18/* THIS SHOULD BE READ IN OFF THE PACK, PER DRIVE */
f7ca52be
SL
19short rp06_off[8] = { 0, 38, 0, -1, -1, -1, 118, -1 };
20short rm03_off[8] = { 0, 100, 0, -1, -1, -1, 309, -1 };
21short rm05_off[8] = { 0, 27, 0, 562, 589, 681, 562, 82 };
22short rm80_off[8] = { 0, 37, 0, -1, -1, -1, 115, -1 };
23short rp07_off[8] = { 0, 10, 0, 235, 245, 437, 235, 52 };
c29bef6b 24short ml_off[8] = { 0, -1, -1, -1, -1, -1, -1, -1 };
f7ca52be
SL
25short cdc9775_off[8] = { 0, 13, 0, -1, -1, -1, 294, 66 };
26short cdc9730_off[8] = { 0, 50, 0, -1, -1, -1, 155, -1 };
27short capricorn_off[8] = { 0, 32, 0, 668, 723, 778, 668, 98 };
28short eagle_off[8] = { 0, 17, 0, 391, 408, 728, 391, 87 };
c29bef6b
SL
29/* END SHOULD BE READ IN */
30
31struct st hpst[] = {
ad8fa496 32#define HPDT_RM03 0
f7ca52be 33 32, 5, 32*5, 823, rm03_off, /* RM03 */
ad8fa496 34#define HPDT_RM05 1
f7ca52be 35 32, 19, 32*19, 823, rm05_off, /* RM05 */
ad8fa496 36#define HPDT_RP06 2
f7ca52be 37 22, 19, 22*19, 815, rp06_off, /* RP06 */
ad8fa496 38#define HPDT_RM80 3
c29bef6b 39 31, 14, 31*14, 559, rm80_off, /* RM80 */
ad8fa496
SL
40#define HPDT_RP05 4
41 22, 19, 22*19, 411, rp06_off, /* RP05 */
42#define HPDT_RP07 5
f7ca52be 43 50, 32, 50*32, 630, rp07_off, /* RP07 */
ad8fa496 44#define HPDT_ML11A 6
c29bef6b 45 1, 1, 1, 1, ml_off, /* ML11A */
ad8fa496 46#define HPDT_ML11B 7
c29bef6b 47 1, 1, 1, 1, ml_off, /* ML11B */
ad8fa496 48#define HPDT_9775 8
f7ca52be 49 32, 40, 32*40, 843, cdc9775_off, /* 9775 */
ad8fa496 50#define HPDT_9730 9
f7ca52be 51 32, 10, 32*10, 823, cdc9730_off, /* 9730 */
ad8fa496 52#define HPDT_CAP 10
f7ca52be 53 32, 16, 32*16, 1024, capricorn_off, /* Ampex capricorn */
ad8fa496 54#define HPDT_EAGLE 11
e4b4ea82 55 48, 20, 48*20, 842, eagle_off, /* Fuji Eagle */
ad8fa496 56#define HPDT_RM02 12
c29bef6b 57 1, 1, 1, 1, 0, /* rm02 - not used */
ad8fa496 58#define HPDT_9300 13
f7ca52be 59 32, 19, 32*19, 815, rm05_off, /* Ampex 9300 */
c29bef6b
SL
60};
61
62#define MASKREG(reg) ((reg)&0xffff)
63
64hpmaptype(hpaddr, type, unit)
65 register struct hpdevice *hpaddr;
66 unsigned type;
67 int unit;
68{
69 int ntracks, hpsn;
70
c29bef6b
SL
71 /*
72 * Handle SI model byte stuff when
73 * we think it's an RM03 or RM05.
74 */
ad8fa496 75 if (type == HPDT_RM03 || type == HPDT_RM05) {
c29bef6b 76 hpsn = hpaddr->hpsn;
c29bef6b
SL
77 if ((hpsn & SIMB_LU) != unit)
78 return (type);
79 switch ((hpsn & SIMB_MB) &~ (SIMB_S6|SIRM03|SIRM05)) {
80
81 case SI9775D:
ad8fa496 82 return (HPDT_9775);
c29bef6b
SL
83
84 case SI9730D:
ad8fa496 85 return (HPDT_9730);
c29bef6b
SL
86
87 /*
88 * Beware, since the only have SI controller we
89 * have has a 9300 instead of a 9766, we map the
90 * drive type into the 9300. This means that
91 * on a 9766 you lose the last 8 cylinders (argh).
92 */
93 case SI9766:
ad8fa496 94 return (HPDT_9300);
c29bef6b
SL
95
96 case SI9762:
ad8fa496 97 return (HPDT_RM03);
c29bef6b
SL
98
99 case SICAPD:
ad8fa496 100 return (HPDT_CAP);
c29bef6b
SL
101
102 case SI9751D:
ad8fa496 103 return (HPDT_EAGLE);
c29bef6b
SL
104 }
105 return (type);
106 }
107 /*
108 * RM03: EMULEX controller. Map to correct
109 * drive type by checking the holding
110 * register for the disk geometry.
111 */
ad8fa496 112 if (type == HPDT_RM02) {
35d06460
SL
113 int newtype = type;
114
c29bef6b
SL
115 hpaddr->hpcs1 = HP_NOP;
116 hpaddr->hphr = HPHR_MAXTRAK;
117 ntracks = MASKREG(hpaddr->hphr) + 1;
35d06460 118 if (ntracks == 16) {
ad8fa496 119 newtype = HPDT_CAP; /* AMPEX capricorn */
35d06460
SL
120 goto done;
121 }
122 hpaddr->hpcs1 = HP_NOP;
c29bef6b
SL
123 hpaddr->hphr = HPHR_MAXSECT;
124 ntracks = MASKREG(hpaddr->hphr) + 1;
35d06460 125 if (ntracks == 48) {
ad8fa496 126 newtype = HPDT_EAGLE; /* 48 sector Eagle */
35d06460
SL
127 goto done;
128 }
c29bef6b 129 printf("RM02 with %d sectors/track?\n", ntracks);
35d06460
SL
130 done:
131 hpaddr->hpcs1 = HP_DCLR|HP_GO;
132 return (newtype);
c29bef6b
SL
133 }
134 /*
135 * ML11's all map to the same type.
136 */
ad8fa496
SL
137 if (type == HPDT_ML11A || type == HPDT_ML11B)
138 return (HPDT_ML11A);
c29bef6b
SL
139 return (type);
140}