Annotation of 43BSDTahoe/sys/vaxstand/hpmaptype.c, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.