xref: /original-bsd/sys/vax/stand/upmaptype.c (revision 18f6d767)
1 /*	upmaptype.c	6.1	83/07/29	*/
2 
3 /*
4  * UNIBUS peripheral standalone
5  * driver: drive type mapping routine.
6  */
7 
8 #include "../h/param.h"
9 #include "../h/inode.h"
10 #include "../h/fs.h"
11 #include "../h/dkbad.h"
12 #include "../h/vmmac.h"
13 
14 #include "../vax/pte.h"
15 #include "../vaxuba/upreg.h"
16 #include "../vaxuba/ubareg.h"
17 
18 #include "saio.h"
19 #include "savax.h"
20 
21 short	up9300_off[] = { 0, 27, 0, -1, -1, -1, 562, 82 };
22 short	fj_off[] = { 0, 50, 0, -1, -1, -1, 155, -1 };
23 short	upam_off[] = { 0, 32, 0, 668, 723, 778, 668, 98 };
24 short	up980_off[] = { 0, 100, 0, -1, -1 , -1, 309, -1};
25 
26 struct st upst[] = {
27 	32,	19,	32*19,	815,	up9300_off,	/* 9300 */
28 	32,	19,	32*19,	823,	up9300_off,	/* 9766 */
29 	32,	10,	32*10,	823,	fj_off,		/* Fuji 160 */
30 	32,	16,	32*16,	1024,	upam_off,	/* Capricorn */
31 	32,	5,	32*5,	823,	up980_off,	/* DM980 */
32 	0,	0,	0,	0,	0,
33 };
34 
35 upmaptype(unit, upaddr)
36 	int unit;
37 	register struct updevice *upaddr;
38 {
39 	register struct st *st;
40 	int type = -1;
41 
42 	upaddr->upcs1 = 0;
43 	upaddr->upcs2 = unit % 8;
44 	upaddr->uphr = UPHR_MAXTRAK;
45 	for (st = upst; st->ntrak != 0; st++)
46 		if (upaddr->uphr == st->ntrak - 1) {
47 			type = st - upst;
48 			break;
49 		}
50 	if (st->ntrak == 0)
51 		printf("up%d: uphr=%x\n", unit, upaddr->uphr);
52 	if (type == 0) {
53 		upaddr->uphr = UPHR_MAXCYL;
54 		if (upaddr->uphr == 822)	/* CDC 9766 */
55 			type++;
56 	}
57 	upaddr->upcs2 = UPCS2_CLR;
58 	return (type);
59 }
60