xref: /original-bsd/sys/vax/stand/upmaptype.c (revision a9c19d04)
1 /*
2  * Copyright (c) 1982, 1986 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  *
6  *	@(#)upmaptype.c	7.1 (Berkeley) 06/05/86
7  */
8 
9 /*
10  * UNIBUS peripheral standalone
11  * driver: drive type mapping routine.
12  */
13 
14 #include "../h/param.h"
15 #include "../h/inode.h"
16 #include "../h/fs.h"
17 #include "../h/dkbad.h"
18 #include "../h/vmmac.h"
19 
20 #include "../vax/pte.h"
21 #include "../vaxuba/upreg.h"
22 #include "../vaxuba/ubareg.h"
23 
24 #include "saio.h"
25 #include "savax.h"
26 
27 static short	up9300_off[] = { 0, 27, 0, -1, -1, -1, 562, 82 };
28 static short	fj_off[] = { 0, 50, 0, -1, -1, -1, 155, -1 };
29 static short	upam_off[] = { 0, 32, 0, 668, 723, 778, 668, 98 };
30 static short	up980_off[] = { 0, 100, 0, -1, -1 , -1, 309, -1};
31 static short	eagle_off[8] =	{ 0, 17, 0, 391, 408, 728, 391, 87 };
32 
33 struct st upst[] = {
34 	32,	19,	32*19,	815,	up9300_off,	/* 9300 */
35 	32,	19,	32*19,	823,	up9300_off,	/* 9766 */
36 	32,	10,	32*10,	823,	fj_off,		/* Fuji 160 */
37 	32,	16,	32*16,	1024,	upam_off,	/* Capricorn */
38 	32,	5,	32*5,	823,	up980_off,	/* DM980 */
39 	48,	20,	48*20,	842,	eagle_off,	/* Fuji Eagle */
40 	0,	0,	0,	0,	0,
41 };
42 
43 upmaptype(unit, upaddr)
44 	int unit;
45 	register struct updevice *upaddr;
46 {
47 	register struct st *st;
48 	int type = -1;
49 
50 	upaddr->upcs1 = 0;
51 	upaddr->upcs2 = unit % 8;
52 	upaddr->uphr = UPHR_MAXTRAK;
53 	for (st = upst; st->ntrak != 0; st++)
54 		if (upaddr->uphr == st->ntrak - 1) {
55 			type = st - upst;
56 			break;
57 		}
58 	if (st->ntrak == 0)
59 		printf("up%d: uphr=%x\n", unit, upaddr->uphr);
60 	if (type == 0) {
61 		upaddr->uphr = UPHR_MAXCYL;
62 		if (upaddr->uphr == 822)	/* CDC 9766 */
63 			type++;
64 	}
65 	upaddr->upcs2 = UPCS2_CLR;
66 	return (type);
67 }
68