xref: /csrg-svn/sys/vax/stand/hpmaptype.c (revision 11226)
1 /*	hpmaptype.c	4.4	83/02/22	*/
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 */
19 short	rp06_off[8] =	{ 0, 38, 0, -1, -1, -1, 118, -1 };
20 short	rm03_off[8] =	{ 0, 100, 0, -1, -1, -1, 309, -1 };
21 short	rm05_off[8] =	{ 0, 27, 0, 562, 589, 681, 562, 82 };
22 short	rm80_off[8] =	{ 0, 37, 0, -1, -1, -1, 115, -1 };
23 short	rp07_off[8] = 	{ 0, 10, 0, 235, 245, 437, 235, 52 };
24 short	ml_off[8] =	{ 0, -1, -1, -1, -1, -1, -1, -1 };
25 short	cdc9775_off[8] = { 0, 13, 0, -1, -1, -1, 294, 66 };
26 short	cdc9730_off[8] = { 0, 50, 0, -1, -1, -1, 155, -1 };
27 short	capricorn_off[8] = { 0, 32, 0, 668, 723, 778, 668, 98 };
28 short	eagle_off[8] =	{ 0, 17, 0, 391, 408, 728, 391, 87 };
29 /* END SHOULD BE READ IN */
30 
31 struct st hpst[] = {
32 	32,	5,	32*5,	823,	rm03_off,	/* RM03 */
33 	32,	19,	32*19,	823,	rm05_off,	/* RM05 */
34 	22,	19,	22*19,	815,	rp06_off,	/* RP06 */
35 	31,	14, 	31*14,	559,	rm80_off,	/* RM80 */
36 	22,	19,	22*19,	411,	rp06_off,	/* RP06 */
37 	50,	32,	50*32,	630,	rp07_off,	/* RP07 */
38 	1,	1,	1,	1,	ml_off,		/* ML11A */
39 	1,	1,	1,	1,	ml_off,		/* ML11B */
40 	32,	40,	32*40,	843,	cdc9775_off,	/* 9775 */
41 	32,	10,	32*10,	823,	cdc9730_off,	/* 9730 */
42 	32,	16,	32*16,	1024,	capricorn_off,	/* Ampex capricorn */
43 	48,	20,	43*20,	842,	eagle_off,	/* Fuji Eagle */
44 	1,	1,	1,	1,	0,		/* rm02 - not used */
45 	32,	19,	32*19,	815,	rm05_off,	/* Ampex 9300 */
46 
47 };
48 
49 #define	MASKREG(reg)	((reg)&0xffff)
50 
51 hpmaptype(hpaddr, type, unit)
52 	register struct hpdevice *hpaddr;
53 	unsigned type;
54 	int unit;
55 {
56 	int ntracks, hpsn;
57 
58 	/*
59 	 * Handle SI model byte stuff when
60 	 * we think it's an RM03 or RM05.
61 	 */
62 	if (type == 0 || type == 1) {
63 		hpsn = hpaddr->hpsn;
64 		if ((hpsn & SIMB_LU) != unit)
65 			return (type);
66 		switch ((hpsn & SIMB_MB) &~ (SIMB_S6|SIRM03|SIRM05)) {
67 
68 		case SI9775D:
69 			return (8);
70 
71 		case SI9730D:
72 			return (9);
73 
74 		/*
75 		 * Beware, since the only have SI controller we
76 		 * have has a 9300 instead of a 9766, we map the
77 		 * drive type into the 9300.  This means that
78 		 * on a 9766 you lose the last 8 cylinders (argh).
79 		 */
80 		case SI9766:
81 			return (13);
82 
83 		case SI9762:
84 			return (0);
85 
86 		case SICAPD:
87 			return (10);
88 
89 		case SI9751D:
90 			return (11);
91 		}
92 		return (type);
93 	}
94 	/*
95 	 * RM03: EMULEX controller.  Map to correct
96 	 * drive type by checking the holding
97 	 * register for the disk geometry.
98 	 */
99 	if (type == 13) {
100 		hpaddr->hpcs1 = HP_NOP;
101 		hpaddr->hphr = HPHR_MAXTRAK;
102 		ntracks = MASKREG(hpaddr->hphr) + 1;
103 		if (ntracks == 16)
104 			return (10);	/* AMPEX capricorn */
105 		hpaddr->hphr = HPHR_MAXSECT;
106 		ntracks = MASKREG(hpaddr->hphr) + 1;
107 		if (ntracks == 48)
108 			return (11);	/* 48 sector Eagle */
109 		printf("RM02 with %d sectors/track?\n", ntracks);
110 		return (type);
111 	}
112 	/*
113 	 * ML11's all map to the same type.
114 	 */
115 	if (type == 6 || type == 7)
116 		return (6);
117 	return (type);
118 }
119