Annotation of 43BSD/sys/stand/hpmaptype.c, revision 1.1

1.1     ! root        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: }

unix.superglobalmegacorp.com

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