Commit | Line | Data |
---|---|---|
da7c5cc6 | 1 | /* |
0880b18e | 2 | * Copyright (c) 1982, 1986 Regents of the University of California. |
da7c5cc6 KM |
3 | * All rights reserved. The Berkeley software License Agreement |
4 | * specifies the terms and conditions for redistribution. | |
5 | * | |
02630c6a | 6 | * @(#)upmaptype.c 7.3 (Berkeley) %G% |
da7c5cc6 | 7 | */ |
3663fec8 SL |
8 | |
9 | /* | |
10 | * UNIBUS peripheral standalone | |
11 | * driver: drive type mapping routine. | |
12 | */ | |
02630c6a | 13 | #ifdef COMPAT_42 |
39c71180 MK |
14 | #include "param.h" |
15 | #include "inode.h" | |
16 | #include "fs.h" | |
17 | #include "dkbad.h" | |
02630c6a | 18 | #include "disklabel.h" |
39c71180 | 19 | #include "vmmac.h" |
3663fec8 SL |
20 | |
21 | #include "../vax/pte.h" | |
22 | #include "../vaxuba/upreg.h" | |
23 | #include "../vaxuba/ubareg.h" | |
24 | ||
25 | #include "saio.h" | |
26 | #include "savax.h" | |
27 | ||
02630c6a KB |
28 | static short up9300_off[] = { 0, 27, 0, -1, -1, -1, 562, 82 }; |
29 | static short fj_off[] = { 0, 50, 0, -1, -1, -1, 155, -1 }; | |
30 | static short upam_off[] = { 0, 32, 0, 668, 723, 778, 668, 98 }; | |
31 | static short up980_off[] = { 0, 100, 0, -1, -1, -1, 309, -1 }; | |
32 | static short eagle_off[] = { 0, 17, 0, 391, 408, 728, 391, 87 }; | |
3663fec8 SL |
33 | |
34 | struct st upst[] = { | |
35 | 32, 19, 32*19, 815, up9300_off, /* 9300 */ | |
f7ca52be | 36 | 32, 19, 32*19, 823, up9300_off, /* 9766 */ |
3663fec8 SL |
37 | 32, 10, 32*10, 823, fj_off, /* Fuji 160 */ |
38 | 32, 16, 32*16, 1024, upam_off, /* Capricorn */ | |
9ed60318 | 39 | 32, 5, 32*5, 823, up980_off, /* DM980 */ |
7249a989 | 40 | 48, 20, 48*20, 842, eagle_off, /* Fuji Eagle */ |
3663fec8 SL |
41 | 0, 0, 0, 0, 0, |
42 | }; | |
43 | ||
02630c6a | 44 | upmaptype(unit, upaddr, lp) |
3663fec8 SL |
45 | int unit; |
46 | register struct updevice *upaddr; | |
02630c6a | 47 | register struct disklabel *lp; |
3663fec8 SL |
48 | { |
49 | register struct st *st; | |
02630c6a | 50 | register int i; |
3663fec8 SL |
51 | int type = -1; |
52 | ||
53 | upaddr->upcs1 = 0; | |
54 | upaddr->upcs2 = unit % 8; | |
55 | upaddr->uphr = UPHR_MAXTRAK; | |
02630c6a KB |
56 | for (st = upst;; ++st) { |
57 | if (!st->ntrak) | |
58 | return(1); | |
3663fec8 | 59 | if (upaddr->uphr == st->ntrak - 1) { |
e72af119 | 60 | type = st - upst; |
3663fec8 SL |
61 | break; |
62 | } | |
02630c6a | 63 | } |
3663fec8 SL |
64 | if (type == 0) { |
65 | upaddr->uphr = UPHR_MAXCYL; | |
66 | if (upaddr->uphr == 822) /* CDC 9766 */ | |
02630c6a | 67 | ++type; |
3663fec8 SL |
68 | } |
69 | upaddr->upcs2 = UPCS2_CLR; | |
02630c6a KB |
70 | st = &upst[type]; |
71 | ||
72 | /* set up a minimal disk label */ | |
73 | lp->d_nsectors = st->nsect; | |
74 | lp->d_ntracks = st->ntrak; | |
75 | lp->d_secpercyl = st->nspc; | |
76 | lp->d_ncylinders = st->ncyl; | |
77 | lp->d_secperunit = st->nspc * st->ncyl; | |
78 | lp->d_npartitions = 8; | |
79 | for (i = 0; i < 8; i++) | |
80 | if (st->off[i] == -1) | |
81 | lp->d_partitions[i].p_size = 0; | |
82 | else { | |
83 | lp->d_partitions[i].p_offset = st->off[i] * | |
84 | lp->d_secpercyl; | |
85 | lp->d_partitions[i].p_size = lp->d_secperunit; | |
86 | } | |
87 | return(0); | |
3663fec8 | 88 | } |
02630c6a | 89 | #endif /* COMPAT_42 */ |