merge 4.1b with 4.1c
[unix-history] / usr / src / sys / vax / stand / mba.c
index 7d62b62..1320752 100644 (file)
@@ -1,49 +1,50 @@
-/*     mba.c   1.1     %G%     */
+/*     mba.c   4.4     82/07/15        */
 
 #include "../h/param.h"
 #include "../h/inode.h"
 #include "../h/pte.h"
 
 #include "../h/param.h"
 #include "../h/inode.h"
 #include "../h/pte.h"
-#include "../h/mba.h"
+#include "../h/mbareg.h"
+#include "../h/fs.h"
 #include "../h/mtpr.h"
 #include "../h/vm.h"
 #include "saio.h"
 #include "../h/mtpr.h"
 #include "../h/vm.h"
 #include "saio.h"
+#include "savax.h"
 
 
-/*
- * startup routine for MBA controllers.
- */
-#define        MBAWCOM 0x30
-#define        MBARCOM 0x38
-#define        GO      01
-
-mbastart(io, adcr, func)
-register struct iob *io;
-int *adcr;
+mbastart(io, func)
+       register struct iob *io;
+       int func;
 {
 {
-       register int i;
+       struct mba_regs *mba = mbamba(io->i_unit);
+       struct mba_drv *drv = mbadrv(io->i_unit);
+       register struct pte *pte = mba->mba_map;
        int npf;
        unsigned v;
        int npf;
        unsigned v;
-       register struct pte *pte;
        int o;
        int vaddr;
        int o;
        int vaddr;
-       extern int mbanum[], *mbaloc[];
-       register struct mba_regs *mbap;
 
 
-       mbap = (struct mba_regs *)mbaloc[mbanum[io->i_unit]];
-       pte = (struct pte *)mbap;
-       pte += (MBA_MAP + 128*4)/4;
        v = btop(io->i_ma);
        o = (int)io->i_ma & PGOFSET;
        npf = btoc(io->i_cc + o);
        v = btop(io->i_ma);
        o = (int)io->i_ma & PGOFSET;
        npf = btoc(io->i_cc + o);
-       vaddr = (128 << 9) | o;
-       v &= 0x1fffff;          /* drop to physical addr */
+       vaddr = o;
        while (--npf >= 0)
                *(int *)pte++ = v++ | PG_V;
        while (--npf >= 0)
                *(int *)pte++ = v++ | PG_V;
-       mbap->mba_sr = -1;      /* clear status (error) bits */
-       mbap->mba_bcr = -io->i_cc;
-       mbap->mba_var = vaddr;
-       if (func == READ)
-               *adcr = MBARCOM | GO;
-       else if (func == WRITE) {
-               *adcr = MBAWCOM | GO;
-       }
+       mba->mba_sr = -1;
+       mba->mba_bcr = -io->i_cc;
+       mba->mba_var = vaddr;
+       if (func == WRITE)
+               drv->mbd_cs1 = MB_WCOM | MB_GO;
+       else
+               drv->mbd_cs1 = MB_RCOM | MB_GO;
+}
+
+mbainit(mbanum)
+       int mbanum;
+{
+       register struct mba_regs *mba = mbaddr[mbanum];
+
+       /* SHOULD BADADDR IT */
+       if (mbaact & (1<<mbanum))
+               return;
+       mba->mba_cr = MBCR_INIT;
+       mbaact |= 1<<mbanum;
 }
 }