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

unix.superglobalmegacorp.com

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