1 /* hpmaptype.c 6.1 83/07/29 */ 2 3 /* 4 * RP??/RM?? drive type mapping routine. 5 */ 6 #include "../machine/pte.h" 7 8 #include "../h/param.h" 9 #include "../h/inode.h" 10 #include "../h/fs.h" 11 12 #include "../vaxmba/hpreg.h" 13 #include "../vaxmba/mbareg.h" 14 15 #include "saio.h" 16 #include "savax.h" 17 18 /* THIS SHOULD BE READ IN OFF THE PACK, PER DRIVE */ 19 short rp06_off[8] = { 0, 38, 0, -1, -1, -1, 118, -1 }; 20 short rm03_off[8] = { 0, 100, 0, -1, -1, -1, 309, -1 }; 21 short rm05_off[8] = { 0, 27, 0, 562, 589, 681, 562, 82 }; 22 short rm80_off[8] = { 0, 37, 0, -1, -1, -1, 115, -1 }; 23 short rp07_off[8] = { 0, 10, 0, 235, 245, 437, 235, 52 }; 24 short ml_off[8] = { 0, -1, -1, -1, -1, -1, -1, -1 }; 25 short cdc9775_off[8] = { 0, 13, 0, -1, -1, -1, 294, 66 }; 26 short cdc9730_off[8] = { 0, 50, 0, -1, -1, -1, 155, -1 }; 27 short capricorn_off[8] = { 0, 32, 0, 668, 723, 778, 668, 98 }; 28 short eagle_off[8] = { 0, 17, 0, 391, 408, 728, 391, 87 }; 29 /* END SHOULD BE READ IN */ 30 31 struct st hpst[] = { 32 #define HPDT_RM03 0 33 32, 5, 32*5, 823, rm03_off, /* RM03 */ 34 #define HPDT_RM05 1 35 32, 19, 32*19, 823, rm05_off, /* RM05 */ 36 #define HPDT_RP06 2 37 22, 19, 22*19, 815, rp06_off, /* RP06 */ 38 #define HPDT_RM80 3 39 31, 14, 31*14, 559, rm80_off, /* RM80 */ 40 #define HPDT_RP05 4 41 22, 19, 22*19, 411, rp06_off, /* RP05 */ 42 #define HPDT_RP07 5 43 50, 32, 50*32, 630, rp07_off, /* RP07 */ 44 #define HPDT_ML11A 6 45 1, 1, 1, 1, ml_off, /* ML11A */ 46 #define HPDT_ML11B 7 47 1, 1, 1, 1, ml_off, /* ML11B */ 48 #define HPDT_9775 8 49 32, 40, 32*40, 843, cdc9775_off, /* 9775 */ 50 #define HPDT_9730 9 51 32, 10, 32*10, 823, cdc9730_off, /* 9730 */ 52 #define HPDT_CAP 10 53 32, 16, 32*16, 1024, capricorn_off, /* Ampex capricorn */ 54 #define HPDT_EAGLE 11 55 48, 20, 48*20, 842, eagle_off, /* Fuji Eagle */ 56 #define HPDT_RM02 12 57 1, 1, 1, 1, 0, /* rm02 - not used */ 58 #define HPDT_9300 13 59 32, 19, 32*19, 815, rm05_off, /* Ampex 9300 */ 60 }; 61 62 #define MASKREG(reg) ((reg)&0xffff) 63 64 hpmaptype(hpaddr, type, unit) 65 register struct hpdevice *hpaddr; 66 unsigned type; 67 int unit; 68 { 69 int ntracks, hpsn; 70 71 /* 72 * Handle SI model byte stuff when 73 * we think it's an RM03 or RM05. 74 */ 75 if (type == HPDT_RM03 || type == HPDT_RM05) { 76 hpsn = hpaddr->hpsn; 77 if ((hpsn & SIMB_LU) != unit) 78 return (type); 79 switch ((hpsn & SIMB_MB) &~ (SIMB_S6|SIRM03|SIRM05)) { 80 81 case SI9775D: 82 return (HPDT_9775); 83 84 case SI9730D: 85 return (HPDT_9730); 86 87 /* 88 * Beware, since the only have SI controller we 89 * have has a 9300 instead of a 9766, we map the 90 * drive type into the 9300. This means that 91 * on a 9766 you lose the last 8 cylinders (argh). 92 */ 93 case SI9766: 94 return (HPDT_9300); 95 96 case SI9762: 97 return (HPDT_RM03); 98 99 case SICAPD: 100 return (HPDT_CAP); 101 102 case SI9751D: 103 return (HPDT_EAGLE); 104 } 105 return (type); 106 } 107 /* 108 * RM03: EMULEX controller. Map to correct 109 * drive type by checking the holding 110 * register for the disk geometry. 111 */ 112 if (type == HPDT_RM02) { 113 int newtype = type; 114 115 hpaddr->hpcs1 = HP_NOP; 116 hpaddr->hphr = HPHR_MAXTRAK; 117 ntracks = MASKREG(hpaddr->hphr) + 1; 118 if (ntracks == 16) { 119 newtype = HPDT_CAP; /* AMPEX capricorn */ 120 goto done; 121 } 122 if (ntracks == 19) { 123 newtype = HPDT_9300; /* AMPEX 9300 */ 124 goto done; 125 } 126 hpaddr->hpcs1 = HP_NOP; 127 hpaddr->hphr = HPHR_MAXSECT; 128 ntracks = MASKREG(hpaddr->hphr) + 1; 129 if (ntracks == 48) { 130 newtype = HPDT_EAGLE; /* 48 sector Eagle */ 131 goto done; 132 } 133 printf("RM02 with %d sectors/track?\n", ntracks); 134 done: 135 hpaddr->hpcs1 = HP_DCLR|HP_GO; 136 return (newtype); 137 } 138 /* 139 * ML11's all map to the same type. 140 */ 141 if (type == HPDT_ML11A || type == HPDT_ML11B) 142 return (HPDT_ML11A); 143 return (type); 144 } 145