xref: /original-bsd/sys/vax/stand/upmaptype.c (revision 551a7fb0)
1 /*	upmaptype.c	4.4	83/03/10	*/
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 
25 struct st upst[] = {
26 	32,	19,	32*19,	815,	up9300_off,	/* 9300 */
27 	32,	19,	32*19,	823,	up9300_off,	/* 9766 */
28 	32,	10,	32*10,	823,	fj_off,		/* Fuji 160 */
29 	32,	16,	32*16,	1024,	upam_off,	/* Capricorn */
30 	0,	0,	0,	0,	0,
31 };
32 
33 upmaptype(unit, upaddr)
34 	int unit;
35 	register struct updevice *upaddr;
36 {
37 	register struct st *st;
38 	int type = -1;
39 
40 	upaddr->upcs1 = 0;
41 	upaddr->upcs2 = unit % 8;
42 	upaddr->uphr = UPHR_MAXTRAK;
43 	for (st = upst; st->ntrak != 0; st++)
44 		if (upaddr->uphr == st->ntrak - 1) {
45 			type = st - upst;
46 			break;
47 		}
48 	if (st->ntrak == 0)
49 		printf("up%d: uphr=%x\n", unit, upaddr->uphr);
50 	if (type == 0) {
51 		upaddr->uphr = UPHR_MAXCYL;
52 		if (upaddr->uphr == 822)	/* CDC 9766 */
53 			type++;
54 	}
55 	upaddr->upcs2 = UPCS2_CLR;
56 	return (type);
57 }
58