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.5 (Berkeley) 04/04/90 7 */ 8 9 /* 10 * UNIBUS peripheral standalone 11 * driver: drive type mapping routine. 12 */ 13 #ifdef COMPAT_42 14 #include "param.h" 15 #include "dkbad.h" 16 #include "disklabel.h" 17 #include "vmmac.h" 18 19 #include "../vax/pte.h" 20 #include "../vaxuba/upreg.h" 21 #include "../vaxuba/ubareg.h" 22 23 #include "saio.h" 24 #include "savax.h" 25 26 static short up9300_off[] = { 0, 27, 0, -1, -1, -1, 562, 82 }; 27 static short fj_off[] = { 0, 50, 0, -1, -1, -1, 155, -1 }; 28 static short upam_off[] = { 0, 32, 0, 668, 723, 778, 668, 98 }; 29 static short up980_off[] = { 0, 100, 0, -1, -1, -1, 309, -1 }; 30 static short eagle_off[] = { 0, 17, 0, 391, 408, 728, 391, 87 }; 31 32 struct st upst[] = { 33 32, 19, 32*19, 815, up9300_off, /* 9300 */ 34 32, 19, 32*19, 823, up9300_off, /* 9766 */ 35 32, 10, 32*10, 823, fj_off, /* Fuji 160 */ 36 32, 16, 32*16, 1024, upam_off, /* Capricorn */ 37 32, 5, 32*5, 823, up980_off, /* DM980 */ 38 48, 20, 48*20, 842, eagle_off, /* Fuji Eagle */ 39 0, 0, 0, 0, 0, 40 }; 41 42 upmaptype(unit, upaddr, lp) 43 int unit; 44 register struct updevice *upaddr; 45 register struct disklabel *lp; 46 { 47 register struct st *st; 48 register int i; 49 int type = -1; 50 51 upaddr->upcs1 = 0; 52 upaddr->upcs2 = unit % 8; 53 upaddr->uphr = UPHR_MAXTRAK; 54 for (st = upst;; ++st) { 55 if (!st->ntrak) 56 return(0); 57 if (upaddr->uphr == st->ntrak - 1) { 58 type = st - upst; 59 break; 60 } 61 } 62 if (type == 0) { 63 upaddr->uphr = UPHR_MAXCYL; 64 if (upaddr->uphr == 822) /* CDC 9766 */ 65 ++type; 66 } 67 upaddr->upcs2 = UPCS2_CLR; 68 st = &upst[type]; 69 70 /* set up a minimal disk label */ 71 lp->d_nsectors = st->nsect; 72 lp->d_ntracks = st->ntrak; 73 lp->d_secpercyl = st->nspc; 74 lp->d_ncylinders = st->ncyl; 75 lp->d_secperunit = st->nspc * st->ncyl; 76 lp->d_npartitions = 8; 77 for (i = 0; i < 8; i++) 78 if (st->off[i] == -1) 79 lp->d_partitions[i].p_size = 0; 80 else { 81 lp->d_partitions[i].p_offset = st->off[i] * 82 lp->d_secpercyl; 83 lp->d_partitions[i].p_size = lp->d_secperunit; 84 } 85 return(1); 86 } 87 #endif /* COMPAT_42 */ 88