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

1.1     ! root        1: /*     mba.c   6.1     83/07/29        */
        !             2: 
        !             3: #include "../machine/pte.h"
        !             4: 
        !             5: #include "../h/param.h"
        !             6: #include "../h/inode.h"
        !             7: #include "../h/fs.h"
        !             8: #include "../h/vm.h"
        !             9: 
        !            10: #include "../vax/mtpr.h"
        !            11: #include "../vaxmba/mbareg.h"
        !            12: #include "../vaxmba/hpreg.h"
        !            13: 
        !            14: #include "saio.h"
        !            15: #include "savax.h"
        !            16: 
        !            17: mbastart(io, func)
        !            18:        register struct iob *io;
        !            19:        int func;
        !            20: {
        !            21:        struct mba_regs *mba = mbamba(io->i_unit);
        !            22:        struct mba_drv *drv = mbadrv(io->i_unit);
        !            23:        register struct pte *pte = mba->mba_map;
        !            24:        int npf;
        !            25:        unsigned v;
        !            26:        int o;
        !            27:        int vaddr;
        !            28: 
        !            29:        v = btop(io->i_ma);
        !            30:        o = (int)io->i_ma & PGOFSET;
        !            31:        npf = btoc(io->i_cc + o);
        !            32:        vaddr = o;
        !            33:        while (--npf >= 0)
        !            34:                *(int *)pte++ = v++ | PG_V;
        !            35:        mba->mba_sr = -1;
        !            36:        mba->mba_bcr = -io->i_cc;
        !            37:        mba->mba_var = vaddr;
        !            38:        if (io->i_flgs&F_SSI)
        !            39:                drv->mbd_of |= HPOF_SSEI;
        !            40:        switch (io->i_flgs & F_TYPEMASK) {
        !            41: 
        !            42:        case F_RDDATA:                  /* standard read */
        !            43:                drv->mbd_cs1 = MB_RCOM|MB_GO;
        !            44:                mbawait(io);
        !            45:                return(0);
        !            46: 
        !            47:        case F_WRDATA:                  /* standard write */
        !            48:                drv->mbd_cs1 = MB_WCOM|MB_GO;
        !            49:                mbawait(io);
        !            50:                return(0);
        !            51: 
        !            52:        /* the following commands apply to disks only */
        !            53: 
        !            54:        case F_HDR|F_RDDATA:    
        !            55:                drv->mbd_cs1 = HP_RHDR|HP_GO;
        !            56:                break;
        !            57: 
        !            58:        case F_HDR|F_WRDATA:
        !            59:                drv->mbd_cs1 = HP_WHDR|HP_GO;
        !            60:                break;
        !            61: 
        !            62:        case F_CHECK|F_WRDATA:
        !            63:        case F_CHECK|F_RDDATA:
        !            64:                drv->mbd_cs1 = HP_WCDATA|HP_GO;
        !            65:                break;
        !            66: 
        !            67:        case F_HCHECK|F_WRDATA:
        !            68:        case F_HCHECK|F_RDDATA:
        !            69:                drv->mbd_cs1 = HP_WCHDR|HP_GO;
        !            70:                break;
        !            71: 
        !            72:        default:
        !            73:                goto error;
        !            74:        }
        !            75:        mbawait(io);
        !            76:        if ((drv->mbd_dt & MBDT_TAP) == 0)
        !            77:                return (0);
        !            78: error:
        !            79:        io->i_error = ECMD;
        !            80:        io->i_flgs &= ~F_TYPEMASK;
        !            81:        return (1);
        !            82: }
        !            83: 
        !            84: mbawait(io)
        !            85:        register struct iob *io;
        !            86: {
        !            87:        struct mba_regs *mba = mbamba(io->i_unit);
        !            88:        struct mba_drv *drv = mbadrv(io->i_unit);
        !            89: 
        !            90:        while (mba->mba_sr & MBSR_DTBUSY)
        !            91:                DELAY(100);
        !            92: }
        !            93: 
        !            94: mbainit(mbanum)
        !            95:        int mbanum;
        !            96: {
        !            97:        register struct mba_regs *mba = mbaddr[mbanum];
        !            98: 
        !            99:        /* SHOULD BADADDR IT */
        !           100:        if (mbaact & (1<<mbanum))
        !           101:                return;
        !           102:        mba->mba_cr = MBCR_INIT;
        !           103:        mbaact |= 1<<mbanum;
        !           104: }

unix.superglobalmegacorp.com

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