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.4 (Berkeley) 05/27/88 7 */ 8 9 /* 10 * UNIBUS peripheral standalone 11 * driver: drive type mapping routine. 12 */ 13 #ifdef COMPAT_42 14 #include "param.h" 15 #include "inode.h" 16 #include "fs.h" 17 #include "dkbad.h" 18 #include "disklabel.h" 19 #include "vmmac.h" 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 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 }; 33 34 struct st upst[] = { 35 32, 19, 32*19, 815, up9300_off, /* 9300 */ 36 32, 19, 32*19, 823, up9300_off, /* 9766 */ 37 32, 10, 32*10, 823, fj_off, /* Fuji 160 */ 38 32, 16, 32*16, 1024, upam_off, /* Capricorn */ 39 32, 5, 32*5, 823, up980_off, /* DM980 */ 40 48, 20, 48*20, 842, eagle_off, /* Fuji Eagle */ 41 0, 0, 0, 0, 0, 42 }; 43 44 upmaptype(unit, upaddr, lp) 45 int unit; 46 register struct updevice *upaddr; 47 register struct disklabel *lp; 48 { 49 register struct st *st; 50 register int i; 51 int type = -1; 52 53 upaddr->upcs1 = 0; 54 upaddr->upcs2 = unit % 8; 55 upaddr->uphr = UPHR_MAXTRAK; 56 for (st = upst;; ++st) { 57 if (!st->ntrak) 58 return(0); 59 if (upaddr->uphr == st->ntrak - 1) { 60 type = st - upst; 61 break; 62 } 63 } 64 if (type == 0) { 65 upaddr->uphr = UPHR_MAXCYL; 66 if (upaddr->uphr == 822) /* CDC 9766 */ 67 ++type; 68 } 69 upaddr->upcs2 = UPCS2_CLR; 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(1); 88 } 89 #endif /* COMPAT_42 */ 90