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