Annotation of 42BSD/sys/stand/hp.old.c, revision 1.1

1.1     ! root        1: /*     hp.old.c        6.1     83/07/29        */
        !             2: 
        !             3: /*
        !             4:  * RP??/RM?? disk driver
        !             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: #define        MASKREG(reg)    ((reg)&0xffff)
        !            19: 
        !            20: short  hptypes[] = {
        !            21:        MBDT_RM03,
        !            22:        MBDT_RM05,
        !            23:        MBDT_RP06,
        !            24:        MBDT_RM80,
        !            25:        MBDT_RP05,
        !            26:        MBDT_RP07,
        !            27:        MBDT_ML11A,
        !            28:        MBDT_ML11B,
        !            29:        -1,             /* 9755 */
        !            30:        -1,             /* 9730 */
        !            31:        -1,             /* Capricorn */
        !            32:        -1,             /* Eagle */
        !            33:        MBDT_RM02,      /* actually something else */
        !            34:        -1,             /* 9300 */
        !            35:        0
        !            36: };
        !            37: 
        !            38: #define RP06 (hptypes[hp_type[unit]] <= MBDT_RP06)
        !            39: #define ML11 (hptypes[hp_type[unit]] == MBDT_ML11A)
        !            40: #define RM80 (hptypes[hp_type[unit]] == MBDT_RM80)
        !            41: 
        !            42: char   hp_type[MAXNMBA*8] = { 0 };
        !            43: extern struct st hpst[];
        !            44: 
        !            45: hpopen(io)
        !            46:        register struct iob *io;
        !            47: {
        !            48:        register unit = io->i_unit;
        !            49:        struct hpdevice *hpaddr = (struct hpdevice *)mbadrv(unit);
        !            50:        register struct st *st;
        !            51: 
        !            52:        mbainit(UNITTOMBA(io->i_unit));
        !            53:        if (hp_type[unit] == 0) {
        !            54:                register i, type = hpaddr->hpdt & MBDT_TYPE;
        !            55: 
        !            56:                for (i = 0; hptypes[i]; i++)
        !            57:                        if (hptypes[i] == type)
        !            58:                                goto found;
        !            59:                _stop("unknown drive type");
        !            60: found:
        !            61:                hpaddr->hpcs1 = HP_DCLR|HP_GO;          /* init drive */
        !            62:                hpaddr->hpcs1 = HP_PRESET|HP_GO;
        !            63:                if (type != MBDT_ML11A && type != MBDT_ML11B)
        !            64:                        hpaddr->hpof = HPOF_FMT22;
        !            65:                hp_type[unit] = hpmaptype(hpaddr, i, unit);
        !            66:        }
        !            67:        st = &hpst[hp_type[unit]];
        !            68:        if (io->i_boff < 0 || io->i_boff > 7 ||
        !            69:            st->off[io->i_boff]== -1)
        !            70:                _stop("hp bad minor");
        !            71:        io->i_boff = st->off[io->i_boff] * st->nspc;
        !            72: }
        !            73: 
        !            74: hpstrategy(io, func)
        !            75:        register struct iob *io;
        !            76: {
        !            77:        int unit = io->i_unit;
        !            78:        daddr_t bn = io->i_bn;
        !            79:        struct hpdevice *hpaddr = (struct hpdevice *)mbadrv(unit);
        !            80:        struct st *st = &hpst[hp_type[unit]];
        !            81:        int cn, tn, sn;
        !            82: 
        !            83:        if ((hpaddr->hpds & HPDS_VV) == 0) {
        !            84:                hpaddr->hpcs1 = HP_DCLR|HP_GO;
        !            85:                hpaddr->hpcs1 = HP_PRESET|HP_GO;
        !            86:                if (!ML11)
        !            87:                        hpaddr->hpof = HPOF_FMT22;
        !            88:        }
        !            89:        cn = bn/st->nspc;
        !            90:        sn = bn%st->nspc;
        !            91:        tn = sn/st->nsect;
        !            92:        sn = sn%st->nsect;
        !            93:        if (ML11)
        !            94:                hpaddr->hpda = bn;
        !            95:        else {
        !            96:                hpaddr->hpdc = cn;
        !            97:                hpaddr->hpda = (tn << 8) + sn;
        !            98:        }
        !            99:        mbastart(io, func);
        !           100:        while ((hpaddr->hpds & HPDS_DRY) == 0)
        !           101:                ;
        !           102:        if (hpaddr->hpds&HPDS_ERR) {
        !           103:                printf("hp error: (cyl,trk,sec)=(%d,%d,%d) ds=%b er1=%b\n",
        !           104:                    cn, tn, sn, MASKREG(hpaddr->hpds), HPDS_BITS,
        !           105:                    MASKREG(hpaddr->hper1), HPER1_BITS);
        !           106:                return (-1);
        !           107:        }
        !           108:        return (io->i_cc);
        !           109: }
        !           110: 
        !           111: /*ARGSUSED*/
        !           112: hpioctl(io, cmd, arg)
        !           113:        struct iob *io;
        !           114:        int cmd;
        !           115:        caddr_t arg;
        !           116: {
        !           117: 
        !           118:        return (ECMD);
        !           119: }

unix.superglobalmegacorp.com

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