BSD 4_4 release
[unix-history] / usr / src / sys / vax / uba / rx.c
index 7f66472..05de40f 100644 (file)
@@ -1,4 +1,10 @@
-/*     rx.c    4.18    83/05/11        */
+/*
+ * Copyright (c) 1982, 1986 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ *     @(#)rx.c        7.5 (Berkeley) 12/16/90
+ */
 
 #include "rx.h"
 #if NFX > 0
 
 #include "rx.h"
 #if NFX > 0
  *     powered off at boot time, the controller won't interrupt!
  */
 
  *     powered off at boot time, the controller won't interrupt!
  */
 
-#include "../machine/pte.h"
+#include "../include/pte.h"
 
 
-#include "../h/param.h"
-#include "../h/buf.h"
-#include "../h/systm.h"
-#include "../h/conf.h"
-#include "../h/errno.h"
-#include "../h/time.h"
-#include "../h/kernel.h"
-#include "../h/uio.h"
-#include "../h/file.h"
+#include "sys/param.h"
+#include "sys/buf.h"
+#include "sys/systm.h"
+#include "sys/conf.h"
+#include "sys/errno.h"
+#include "sys/time.h"
+#include "sys/kernel.h"
+#include "sys/uio.h"
+#include "sys/file.h"
 
 
-#include "../vax/cpu.h"
+#include "../include/cpu.h"
 #include "../vax/nexus.h"
 
 #include "../vax/nexus.h"
 
-#include "../vaxuba/ubavar.h"
-#include "../vaxuba/ubareg.h"
-#include "../vaxuba/rxreg.h"
+#include "ubavar.h"
+#include "ubareg.h"
+#include "rxreg.h"
 
 #define b_cylin        b_resid
 
 
 #define b_cylin        b_resid
 
@@ -137,12 +143,11 @@ rxprobe (reg)
        return (sizeof (*rxaddr));
 }
 
        return (sizeof (*rxaddr));
 }
 
+/*ARGSUSED*/
 rxslave(ui, reg)
        struct uba_device *ui;
        caddr_t reg;
 {
 rxslave(ui, reg)
        struct uba_device *ui;
        caddr_t reg;
 {
-
-       ui->ui_dk = 1;
        return (ui->ui_slave == 0 || ui->ui_slave == 1);
 }
 
        return (ui->ui_slave == 0 || ui->ui_slave == 1);
 }
 
@@ -190,6 +195,7 @@ rxopen(dev, flag)
                iowait(bp);
                if (bp->b_flags & B_ERROR) {
                        sc->sc_csbits = 0;
                iowait(bp);
                if (bp->b_flags & B_ERROR) {
                        sc->sc_csbits = 0;
+                       sc->sc_flags &= ~RXF_LOCK;
                        return (bp->b_error);
                }
                if (rxwstart++ == 0) {
                        return (bp->b_error);
                }
                if (rxwstart++ == 0) {
@@ -205,7 +211,7 @@ rxopen(dev, flag)
                if (sc->sc_flags & RXF_LOCK)
                        return(EBUSY);
        }
                if (sc->sc_flags & RXF_LOCK)
                        return(EBUSY);
        }
-       sc->sc_open++;
+       sc->sc_open = 1;
        return (0);
 }
 
        return (0);
 }
 
@@ -215,10 +221,11 @@ rxclose(dev, flag)
 {
        register struct rx_softc *sc = &rx_softc[RXUNIT(dev)];
 
 {
        register struct rx_softc *sc = &rx_softc[RXUNIT(dev)];
 
-       --sc->sc_open;
+       sc->sc_open = 0;
 #ifdef RXDEBUG
        printf("rxclose: dev=0x%x, sc_open=%d\n", dev, sc->sc_open);
 #endif
 #ifdef RXDEBUG
        printf("rxclose: dev=0x%x, sc_open=%d\n", dev, sc->sc_open);
 #endif
+       return (0);
 }
 
 rxstrategy(bp)
 }
 
 rxstrategy(bp)
@@ -235,7 +242,7 @@ rxstrategy(bp)
        if (ui == 0 || ui->ui_alive == 0) 
                goto bad;
        sc = &rx_softc[unit];
        if (ui == 0 || ui->ui_alive == 0) 
                goto bad;
        sc = &rx_softc[unit];
-       if (bp->b_blkno < 0 || (bp->b_blkno * DEV_BSIZE) > RXSIZE )
+       if (bp->b_blkno < 0 || dbtob(bp->b_blkno) > RXSIZE)
                goto bad;
        if (sc->sc_flags & RXF_BAD) {
                bp->b_error = EIO;
                goto bad;
        if (sc->sc_flags & RXF_BAD) {
                bp->b_error = EIO;
@@ -315,7 +322,7 @@ rxmap(bp, psector, ptrack)
        register int lt, ls, ptoff;
        struct rx_softc *sc = &rx_softc[RXUNIT(bp->b_dev)];
 
        register int lt, ls, ptoff;
        struct rx_softc *sc = &rx_softc[RXUNIT(bp->b_dev)];
 
-       ls = ( bp->b_blkno * DEV_BSIZE + ( sc->sc_offset - sc->sc_resid ))/NBPS;
+       ls = (dbtob(bp->b_blkno) + (sc->sc_offset - sc->sc_resid)) / NBPS;
        lt = ls / 26;
        ls %= 26;
        /*
        lt = ls / 26;
        ls %= 26;
        /*
@@ -724,8 +731,11 @@ rxreset(uban)
                if ((um = rxminfo[ctlr]) == 0 || um->um_ubanum != uban ||
                    um->um_alive == 0)
                        continue;
                if ((um = rxminfo[ctlr]) == 0 || um->um_ubanum != uban ||
                    um->um_alive == 0)
                        continue;
-               if (um->um_ubinfo)
+               printf(" fx%d", ctlr);
+               if (um->um_ubinfo) {
+                       printf("<%d>", UBAI_BDP(um->um_ubinfo));
                        um->um_ubinfo = 0;
                        um->um_ubinfo = 0;
+               }
                rx_ctlr[ctlr].rxc_state = RXS_IDLE;
                rxaddr = (struct rxdevice *)um->um_addr;
                rxaddr->rxcs = RX_INIT;
                rx_ctlr[ctlr].rxc_state = RXS_IDLE;
                rxaddr = (struct rxdevice *)um->um_addr;
                rxaddr->rxcs = RX_INIT;
@@ -797,7 +807,7 @@ rxioctl(dev, cmd, data, flag)
        case RXIOC_FORMAT:
                if ((flag&FWRITE) == 0)
                        return (EBADF);
        case RXIOC_FORMAT:
                if ((flag&FWRITE) == 0)
                        return (EBADF);
-               if (sc->sc_open > 1 )
+               if (sc->sc_open > 1)
                        return (EBUSY);
                if (*(int *)data)
                        sc->sc_csbits |= RX_DDEN;
                        return (EBUSY);
                if (*(int *)data)
                        sc->sc_csbits |= RX_DDEN;
@@ -829,7 +839,7 @@ rxformat(dev)
        int unit = RXUNIT(dev);
        struct buf *bp;
        struct rx_softc *sc = &rx_softc[unit];
        int unit = RXUNIT(dev);
        struct buf *bp;
        struct rx_softc *sc = &rx_softc[unit];
-       int s, error = 0;
+       int error = 0;
 
        bp = &rrxbuf[unit];
        bp->b_flags = B_BUSY | B_CTRL;
 
        bp = &rrxbuf[unit];
        bp->b_flags = B_BUSY | B_CTRL;