sun merge
[unix-history] / usr / src / sys / vax / uba / rk.c
index 8be4a13..7f17005 100644 (file)
@@ -1,6 +1,4 @@
-#define        RKDEBUG
-#define RKBDEBUG
-/*     rk.c    4.41    82/06/14        */
+/*     rk.c    4.51    82/12/17        */
 
 #include "rk.h"
 #if NHK > 0
 
 #include "rk.h"
 #if NHK > 0
@@ -20,23 +18,25 @@ int rkbdebug;
  * TODO:
  *     Learn why we lose an interrupt sometime when spinning drives down
  */
  * TODO:
  *     Learn why we lose an interrupt sometime when spinning drives down
  */
+#include "../machine/pte.h"
+
 #include "../h/param.h"
 #include "../h/systm.h"
 #include "../h/buf.h"
 #include "../h/conf.h"
 #include "../h/dir.h"
 #include "../h/user.h"
 #include "../h/param.h"
 #include "../h/systm.h"
 #include "../h/buf.h"
 #include "../h/conf.h"
 #include "../h/dir.h"
 #include "../h/user.h"
-#include "../h/pte.h"
 #include "../h/map.h"
 #include "../h/vm.h"
 #include "../h/map.h"
 #include "../h/vm.h"
-#include "../h/ubareg.h"
-#include "../h/ubavar.h"
 #include "../h/dk.h"
 #include "../h/dk.h"
-#include "../h/cpu.h"
 #include "../h/cmap.h"
 #include "../h/dkbad.h"
 #include "../h/cmap.h"
 #include "../h/dkbad.h"
+#include "../h/uio.h"
 
 
-#include "../h/rkreg.h"
+#include "../vax/cpu.h"
+#include "../vaxuba/ubareg.h"
+#include "../vaxuba/ubavar.h"
+#include "../vaxuba/rkreg.h"
 
 struct rk_softc {
        int     sc_softas;
 
 struct rk_softc {
        int     sc_softas;
@@ -125,7 +125,7 @@ rkprobe(reg)
        ((struct rkdevice *)reg)->rkcs1 = RK_CDT|RK_IE|RK_CRDY;
        DELAY(10);
        ((struct rkdevice *)reg)->rkcs1 = RK_CDT;
        ((struct rkdevice *)reg)->rkcs1 = RK_CDT|RK_IE|RK_CRDY;
        DELAY(10);
        ((struct rkdevice *)reg)->rkcs1 = RK_CDT;
-       return (1);
+       return (sizeof (struct rkdevice));
 }
 
 rkslave(ui, reg)
 }
 
 rkslave(ui, reg)
@@ -167,6 +167,17 @@ rkattach(ui)
        ui->ui_flags = 0;
 }
  
        ui->ui_flags = 0;
 }
  
+rkopen(dev)
+       dev_t dev;
+{
+       register int unit = minor(dev) >> 3;
+       register struct uba_device *ui;
+
+       if (unit >= NRK || (ui = rkdinfo[unit]) == 0 || ui->ui_alive == 0)
+               return (ENXIO);
+       return (0);
+}
+
 rkstrategy(bp)
        register struct buf *bp;
 {
 rkstrategy(bp)
        register struct buf *bp;
 {
@@ -373,7 +384,6 @@ rkintr(rk11)
        int unit;
        struct rk_softc *sc = &rk_softc[um->um_ctlr];
        int as = (rkaddr->rkatt >> 8) | sc->sc_softas;
        int unit;
        struct rk_softc *sc = &rk_softc[um->um_ctlr];
        int as = (rkaddr->rkatt >> 8) | sc->sc_softas;
-       int needie = 1;
 
        sc->sc_wticks = 0;
        sc->sc_softas = 0;
 
        sc->sc_wticks = 0;
        sc->sc_softas = 0;
@@ -501,7 +511,7 @@ retry:
                }
        if (um->um_tab.b_actf && um->um_tab.b_active == 0)
                rkstart(um);
                }
        if (um->um_tab.b_actf && um->um_tab.b_active == 0)
                rkstart(um);
-       if (((needie = rkaddr->rkcs1) & RK_IE) == 0)
+       if (((rkaddr->rkcs1) & RK_IE) == 0)
                rkaddr->rkcs1 = RK_IE;
 }
 
                rkaddr->rkcs1 = RK_IE;
 }
 
@@ -513,26 +523,26 @@ rkwait(addr)
                ;
 }
 
                ;
 }
 
-rkread(dev)
+rkread(dev, uio)
        dev_t dev;
        dev_t dev;
+       struct uio *uio;
 {
        register int unit = minor(dev) >> 3;
 
        if (unit >= NRK)
 {
        register int unit = minor(dev) >> 3;
 
        if (unit >= NRK)
-               u.u_error = ENXIO;
-       else
-               physio(rkstrategy, &rrkbuf[unit], dev, B_READ, minphys);
+               return (ENXIO);
+       return (physio(rkstrategy, &rrkbuf[unit], dev, B_READ, minphys, uio));
 }
 
 }
 
-rkwrite(dev)
+rkwrite(dev, uio)
        dev_t dev;
        dev_t dev;
+       struct uio *uio;
 {
        register int unit = minor(dev) >> 3;
 
        if (unit >= NRK)
 {
        register int unit = minor(dev) >> 3;
 
        if (unit >= NRK)
-               u.u_error = ENXIO;
-       else
-               physio(rkstrategy, &rrkbuf[unit], dev, B_WRITE, minphys);
+               return (ENXIO);
+       return (physio(rkstrategy, &rrkbuf[unit], dev, B_WRITE, minphys, uio));
 }
 
 rkecc(ui, flag)
 }
 
 rkecc(ui, flag)
@@ -667,7 +677,7 @@ rkreset(uban)
                rk_softc[um->um_ctlr].sc_wticks = 0;
                if (um->um_ubinfo) {
                        printf("<%d>", (um->um_ubinfo>>28)&0xf);
                rk_softc[um->um_ctlr].sc_wticks = 0;
                if (um->um_ubinfo) {
                        printf("<%d>", (um->um_ubinfo>>28)&0xf);
-                       ubadone(um);
+                       um->um_ubinfo = 0;
                }
                for (unit = 0; unit < NRK; unit++) {
                        if ((ui = rkdinfo[unit]) == 0)
                }
                for (unit = 0; unit < NRK; unit++) {
                        if ((ui = rkdinfo[unit]) == 0)