Annotation of 41BSD/4.0.upgrade/sys/stand/hp.c, revision 1.1.1.1

1.1       root        1: /*     hp.c    4.6     81/05/10        */
                      2: 
                      3: /*
                      4:  * RP??/RM?? disk driver
                      5:  */
                      6: 
                      7: #include "../h/param.h"
                      8: #include "../h/inode.h"
                      9: #include "../h/hpreg.h"
                     10: #include "../h/pte.h"
                     11: #include "../h/mbareg.h"
                     12: #include "saio.h"
                     13: #include "savax.h"
                     14: 
                     15: #define        MASKREG(reg)    ((reg)&0xffff)
                     16: 
                     17: char   hp_type[MAXNMBA*8] = { 0 };
                     18: 
                     19: /* THIS SHOULD BE READ IN OFF THE PACK, PER DRIVE */
                     20: short  hp6_off[8] =    { 0, 38, 0, -1, -1, -1, 118, -1 };
                     21: short  rm3_off[8] =    { 0, 100, 0, -1, -1, -1, 310, -1 };
                     22: short  rm5_off[8] =    { 0, 27, 0, 562, 589, 681, 562, 82 };
                     23: short  rm80_off[8] =   { 0, 37, 0, -1, -1, -1, 115, 305 };
                     24: short  hp7_off[8] =    { 0, 10, 0, 330, 340, 500, 330, 50 };
                     25: /* END SHOULD BE READ IN */
                     26: 
                     27: short  hptypes[] =
                     28:     { MBDT_RM03, MBDT_RM05, MBDT_RP06, MBDT_RM80, MBDT_RP05, MBDT_RP07, 0 };
                     29: 
                     30: struct hpst {
                     31:        short   nsect;
                     32:        short   ntrak;
                     33:        short   nspc;
                     34:        short   ncyl;
                     35:        short   *off;
                     36: } hpst[] = {
                     37:        32,     5,      32*5,   823,    rm3_off,        /* RM03 */
                     38:        32,     19,     32*19,  823,    rm5_off,        /* RM05 */
                     39:        22,     19,     22*19,  815,    hp6_off,        /* RP06 */
                     40:        31,     14,     31*14,  559,    rm80_off,       /* RM80 */
                     41:        22,     19,     22*19,  411,    hp6_off,        /* RP06 */
                     42:        50,     32,     50*32,  630,    hp7_off,        /* RP07 */
                     43: };
                     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 hpst *st;
                     51: 
                     52:        mbainit(UNITTOMBA(io->i_unit));
                     53:        if (hp_type[unit] == 0) {
                     54:                register type = hpaddr->hpdt & MBDT_TYPE;
                     55:                register int i;
                     56: 
                     57:                for (i = 0; hptypes[i]; i++)
                     58:                        if (hptypes[i] == type)
                     59:                                goto found;
                     60:                _stop("unknown drive type");
                     61: found:
                     62:                hp_type[unit] = i;
                     63:        }
                     64:        st = &hpst[hp_type[unit]];
                     65:        if (io->i_boff < 0 || io->i_boff > 7 ||
                     66:            st->off[io->i_boff]== -1)
                     67:                _stop("hp bad minor");
                     68:        io->i_boff = st->off[io->i_boff] * st->nspc;
                     69: }
                     70: 
                     71: hpstrategy(io, func)
                     72:        register struct iob *io;
                     73: {
                     74:        int unit = io->i_unit;
                     75:        daddr_t bn = io->i_bn;
                     76:        struct hpdevice *hpaddr = (struct hpdevice *)mbadrv(unit);
                     77:        struct hpst *st = &hpst[hp_type[unit]];
                     78:        int cn, tn, sn;
                     79: 
                     80:        if ((hpaddr->hpds & HPDS_VV) == 0) {
                     81:                hpaddr->hpcs1 = HP_DCLR|HP_GO;
                     82:                hpaddr->hpcs1 = HP_PRESET|HP_GO;
                     83:                hpaddr->hpof = HPOF_FMT22;
                     84:        }
                     85:        cn = bn/st->nspc;
                     86:        sn = bn%st->nspc;
                     87:        tn = sn/st->nsect;
                     88:        sn = sn%st->nsect;
                     89:        hpaddr->hpdc = cn;
                     90:        hpaddr->hpda = (tn << 8) + sn;
                     91:        mbastart(io, func);
                     92:        while ((hpaddr->hpds & HPDS_DRY) == 0)
                     93:                ;
                     94:        if (hpaddr->hpds&HPDS_ERR) {
                     95:                printf("hp error: (cyl,trk,sec)=(%d,%d,%d) ds=%b er1=%b\n",
                     96:                    cn, tn, sn, MASKREG(hpaddr->hpds), HPDS_BITS,
                     97:                    MASKREG(hpaddr->hper1), HPER1_BITS);
                     98:                return (-1);
                     99:        }
                    100:        return (io->i_cc);
                    101: }

unix.superglobalmegacorp.com

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