Annotation of 41BSD/sys/stand/mba.c, revision 1.1.1.1

1.1       root        1: /*     mba.c   4.1     11/9/80 */
                      2: 
                      3: #include "../h/param.h"
                      4: #include "../h/inode.h"
                      5: #include "../h/pte.h"
                      6: #include "../h/mba.h"
                      7: #include "../h/mtpr.h"
                      8: #include "../h/vm.h"
                      9: #include "saio.h"
                     10: 
                     11: /*
                     12:  * startup routine for MBA controllers.
                     13:  */
                     14: #define        MBAWCOM 0x30
                     15: #define        MBARCOM 0x38
                     16: #define        GO      01
                     17: 
                     18: struct mba_info mbainfo[] = {
                     19:        PHYSMBA0,
                     20:        PHYSMBA1,
                     21: };
                     22: 
                     23: mbastart(io, adcr, func)
                     24: register struct iob *io;
                     25: int *adcr;
                     26: {
                     27:        register int i;
                     28:        int npf;
                     29:        unsigned v;
                     30:        register struct pte *pte;
                     31:        int o;
                     32:        int vaddr;
                     33:        extern int mbanum[], *mbaloc[];
                     34:        register struct mba_regs *mbap;
                     35: 
                     36:        mbap = (struct mba_regs *)mbaloc[mbanum[io->i_ino.i_dev]];
                     37:        pte = &mbap->mba_map[128];
                     38:        v = btop(io->i_ma);
                     39:        o = (int)io->i_ma & PGOFSET;
                     40:        npf = btoc(io->i_cc + o);
                     41:        vaddr = (128 << 9) | o;
                     42:        v &= 0x1fffff;          /* drop to physical addr */
                     43:        while (--npf >= 0)
                     44:                *(int *)pte++ = v++ | PG_V;
                     45:        mbap->mba_sr = -1;      /* clear status (error) bits */
                     46:        mbap->mba_bcr = -io->i_cc;
                     47:        mbap->mba_var = vaddr;
                     48:        if (func == READ)
                     49:                *adcr = MBARCOM | GO;
                     50:        else if (func == WRITE) {
                     51:                *adcr = MBAWCOM | GO;
                     52:        }
                     53: }
                     54: 
                     55: mbainit(mbanum)
                     56:        int mbanum;
                     57: {
                     58:        register struct mba_regs *mbap = mbainfo[mbanum].mi_phys;
                     59: 
                     60:        mbap->mba_cr = MBAINIT;
                     61:        mbaact |= 1<<mbanum;
                     62: }

unix.superglobalmegacorp.com

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