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:  *	@(#)hpmaptype.c	7.1 (Berkeley) 6/5/86
   7:  */
   8: 
   9: /*
  10:  * RP??/RM?? drive type mapping routine.
  11:  */
  12: #include "../machine/pte.h"
  13: 
  14: #include "../h/param.h"
  15: #include "../h/inode.h"
  16: #include "../h/fs.h"
  17: 
  18: #include "../vaxmba/hpreg.h"
  19: #include "../vaxmba/mbareg.h"
  20: 
  21: #include "saio.h"
  22: #include "savax.h"
  23: 
  24: /* THIS SHOULD BE READ IN OFF THE PACK, PER DRIVE */
  25: short   rp06_off[8] =   { 0, 38, 0, -1, -1, -1, 118, -1 };
  26: short   rm03_off[8] =   { 0, 100, 0, -1, -1, -1, 309, -1 };
  27: short   rm05_off[8] =   { 0, 27, 0, 562, 589, 681, 562, 82 };
  28: short   rm80_off[8] =   { 0, 37, 0, -1, -1, -1, 115, -1 };
  29: short   rp07_off[8] =   { 0, 10, 0, 235, 245, 437, 235, 52 };
  30: short   ml_off[8] = { 0, -1, -1, -1, -1, -1, -1, -1 };
  31: short   cdc9775_off[8] = { 0, 13, 0, -1, -1, -1, 294, 66 };
  32: short   cdc9730_off[8] = { 0, 50, 0, -1, -1, -1, 155, -1 };
  33: short   capricorn_off[8] = { 0, 32, 0, 668, 723, 778, 668, 98 };
  34: short   eagle_off[8] =  { 0, 17, 0, 391, 408, 728, 391, 87 };
  35: short   fj2361_off[8] = { 0, 13, 0, 294, 307, 547, 294, 66 };
  36: /* END SHOULD BE READ IN */
  37: 
  38: /*
  39:  * hptypes is used to translate Massbus drive type and other information
  40:  * into an index in hpst.  The indices of hptypes and hpst must therefore agree.
  41:  */
  42: short   hptypes[] = {
  43:     MBDT_RM03,
  44:     MBDT_RM05,
  45:     MBDT_RP06,
  46:     MBDT_RM80,
  47:     MBDT_RP05,
  48:     MBDT_RP07,
  49:     MBDT_ML11A,
  50:     MBDT_ML11B,
  51:     -1,     /* 9755 */
  52:     -1,     /* 9730 */
  53:     -1,     /* Capricorn */
  54:     -1,     /* Eagle */
  55:     MBDT_RM02,  /* actually something else */
  56:     -1,     /* 9300 */
  57:     -1,     /* 9766 */
  58:     -1,     /* 2361 */
  59:     0
  60: };
  61: 
  62: struct st hpst[] = {
  63: #define HPDT_RM03   0
  64:     32, 5,  32*5,   823,    rm03_off,   /* RM03 */
  65: #define HPDT_RM05   1
  66:     32, 19, 32*19,  823,    rm05_off,   /* RM05 */
  67: #define HPDT_RP06   2
  68:     22, 19, 22*19,  815,    rp06_off,   /* RP06 */
  69: #define HPDT_RM80   3
  70:     31, 14,     31*14,  559,    rm80_off,   /* RM80 */
  71: #define HPDT_RP05   4
  72:     22, 19, 22*19,  411,    rp06_off,   /* RP05 */
  73: #define HPDT_RP07   5
  74:     50, 32, 50*32,  630,    rp07_off,   /* RP07 */
  75: #define HPDT_ML11A  6
  76:     1,  1,  1,  1,  ml_off,     /* ML11A */
  77: #define HPDT_ML11B  7
  78:     1,  1,  1,  1,  ml_off,     /* ML11B */
  79: #define HPDT_9775   8
  80:     32, 40, 32*40,  843,    cdc9775_off,    /* 9775 */
  81: #define HPDT_9730   9
  82:     32, 10, 32*10,  823,    cdc9730_off,    /* 9730 */
  83: #define HPDT_CAP    10
  84:     32, 16, 32*16,  1024,   capricorn_off,  /* Ampex capricorn */
  85: #define HPDT_EAGLE  11
  86:     48, 20, 48*20,  842,    eagle_off,  /* Fuji Eagle */
  87: #define HPDT_RM02   12
  88:     32, 5,  32*5,   823,    rm03_off,   /* rm02 - not used */
  89: #define HPDT_9300   13
  90:     32, 19, 32*19,  815,    rm05_off,   /* Ampex 9300 */
  91: #define HPDT_9766   14
  92:     32, 19, 32*19,  823,    rm05_off,   /* CDC 9766 */
  93: #define HPDT_2361   15
  94:     64, 20, 64*20,  842,    fj2361_off, /* Fuji 2361 */
  95: };
  96: #define NTYPES  (sizeof(hpst) / sizeof(hpst[0]))
  97: 
  98: #define MASKREG(reg)    ((reg)&0xffff)
  99: 
 100: hpmaptype(hpaddr, type, unit)
 101:     register struct hpdevice *hpaddr;
 102:     unsigned type;
 103:     int unit;
 104: {
 105:     int hpsn;
 106: 
 107:     /*
 108: 	 * Handle SI model byte stuff when
 109: 	 * we think it's an RM03 or RM05.
 110: 	 */
 111:     if (type == HPDT_RM03 || type == HPDT_RM05) {
 112:         hpsn = hpaddr->hpsn;
 113:         if ((hpsn & SIMB_LU) != unit)
 114:             return (type);
 115:         switch ((hpsn & SIMB_MB) &~ (SIMB_S6|SIRM03|SIRM05)) {
 116: 
 117:         case SI9775D:
 118:             return (HPDT_9775);
 119: 
 120:         case SI9730D:
 121:             return (HPDT_9730);
 122: 
 123:         case SI9766:
 124:             return (HPDT_9766);
 125: 
 126:         case SI9762:
 127:             return (HPDT_RM03);
 128: 
 129:         case SICAPD:
 130:             return (HPDT_CAP);
 131: 
 132:         case SI9751D:
 133:             return (HPDT_EAGLE);
 134:         }
 135:         return (type);
 136:     }
 137:     /*
 138: 	 * RM02: EMULEX controller.  Map to correct
 139: 	 * drive type by checking the holding
 140: 	 * register for the disk geometry.
 141: 	 */
 142:     if (type == HPDT_RM02) {
 143:         int newtype, nsectors, ntracks, ncyl;
 144: 
 145:         hpaddr->hpcs1 = HP_NOP;
 146:         hpaddr->hphr = HPHR_MAXTRAK;
 147:         ntracks = MASKREG(hpaddr->hphr) + 1;
 148:         DELAY(100);
 149:         hpaddr->hpcs1 = HP_NOP;
 150:         hpaddr->hphr = HPHR_MAXSECT;
 151:         nsectors = MASKREG(hpaddr->hphr) + 1;
 152:         DELAY(100);
 153:         hpaddr->hpcs1 = HP_NOP;
 154:         hpaddr->hphr = HPHR_MAXCYL;
 155:         ncyl = MASKREG(hpaddr->hphr) + 1;
 156:         for (newtype = 0; newtype < NTYPES; newtype++)
 157:             if (hpst[newtype].nsect == nsectors &&
 158:                 hpst[newtype].ntrak == ntracks &&
 159:                 hpst[newtype].ncyl == ncyl)
 160:                 break;
 161: 
 162:         if (newtype >= NTYPES) {
 163:             printf("RM02 with %d sectors, %d tracks, %d cylinders?\n",
 164:                 nsectors, ntracks, ncyl);
 165:             newtype = type;
 166:         }
 167:     done:
 168:         hpaddr->hpcs1 = HP_DCLR|HP_GO;
 169:         return (newtype);
 170:     }
 171:     /*
 172: 	 * ML11's all map to the same type.
 173: 	 */
 174:     if (type == HPDT_ML11A || type == HPDT_ML11B)
 175:         return (HPDT_ML11A);
 176:     return (type);
 177: }

Defined functions

hpmaptype defined in line 100; used 2 times

Defined variables

capricorn_off defined in line 33; used 1 times
  • in line 84
cdc9730_off defined in line 32; used 1 times
  • in line 82
cdc9775_off defined in line 31; used 1 times
  • in line 80
eagle_off defined in line 34; used 1 times
  • in line 86
fj2361_off defined in line 35; used 1 times
  • in line 94
hpst defined in line 62; used 12 times
hptypes defined in line 42; used 9 times
ml_off defined in line 30; used 2 times
rm03_off defined in line 26; used 2 times
rm05_off defined in line 27; used 3 times
rm80_off defined in line 28; used 1 times
  • in line 70
rp06_off defined in line 25; used 2 times
rp07_off defined in line 29; used 1 times
  • in line 74

Defined macros

HPDT_2361 defined in line 93; never used
HPDT_9300 defined in line 89; never used
HPDT_9730 defined in line 81; used 1 times
HPDT_9766 defined in line 91; used 1 times
HPDT_9775 defined in line 79; used 1 times
HPDT_CAP defined in line 83; used 1 times
HPDT_EAGLE defined in line 85; used 1 times
HPDT_ML11A defined in line 75; used 2 times
HPDT_ML11B defined in line 77; used 1 times
HPDT_RM02 defined in line 87; used 1 times
HPDT_RM03 defined in line 63; used 2 times
HPDT_RM05 defined in line 65; used 1 times
HPDT_RM80 defined in line 69; never used
HPDT_RP05 defined in line 71; never used
HPDT_RP06 defined in line 67; never used
HPDT_RP07 defined in line 73; never used
MASKREG defined in line 98; used 3 times
NTYPES defined in line 96; used 2 times
Last modified: 1986-06-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1211
Valid CSS Valid XHTML 1.0 Strict