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