BSD 4_4 release
[unix-history] / usr / src / sys / vax / uba / ts.c
index 19ebe8f..9af0214 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)ts.c        7.12 (Berkeley) %G%
+ *     @(#)ts.c        7.15 (Berkeley) 2/27/92
  */
 
 #include "ts.h"
  */
 
 #include "ts.h"
  * TODO:
  *     test dump code
  */
  * TODO:
  *     test dump code
  */
-#include "param.h"
-#include "systm.h"
-#include "buf.h"
-#include "conf.h"
-#include "file.h"
-#include "map.h"
-#include "vm.h"
-#include "ioctl.h"
-#include "mtio.h"
-#include "cmap.h"
-#include "uio.h"
-#include "syslog.h"
-#include "tprintf.h"
-
-#include "machine/pte.h"
-#include "../vax/cpu.h"
+#include "sys/param.h"
+#include "sys/systm.h"
+#include "sys/buf.h"
+#include "sys/conf.h"
+#include "sys/errno.h"
+#include "sys/file.h"
+#include "sys/map.h"
+#include "sys/vm.h"
+#include "sys/ioctl.h"
+#include "sys/mtio.h"
+#include "sys/cmap.h"
+#include "sys/uio.h"
+#include "sys/syslog.h"
+#include "sys/tprintf.h"
+
+#include "../include/pte.h"
+#include "../include/cpu.h"
 #include "ubareg.h"
 #include "ubavar.h"
 #include "tsreg.h"
 #include "ubareg.h"
 #include "ubavar.h"
 #include "tsreg.h"
@@ -123,7 +124,6 @@ tsprobe(reg, ctlr, um)
        register struct tsdevice *addr = (struct tsdevice *)reg;
        register struct ts_softc *sc;
        register int i;
        register struct tsdevice *addr = (struct tsdevice *)reg;
        register struct ts_softc *sc;
        register int i;
-       int a;
 
 #ifdef lint
        br = 0; cvec = br; br = cvec;
 
 #ifdef lint
        br = 0; cvec = br; br = cvec;
@@ -139,7 +139,7 @@ tsprobe(reg, ctlr, um)
         * TS_SETCHR|TS_IE alone refuses to interrupt for me.
         */
        sc = &ts_softc[ctlr];
         * TS_SETCHR|TS_IE alone refuses to interrupt for me.
         */
        sc = &ts_softc[ctlr];
-       tsmap(sc, numuba, &a);
+       tsmap(sc, numuba);
        i = (int)&sc->sc_ubaddr->t_char;
        sc->sc_ts.t_cmd.c_loba = i;
        sc->sc_ts.t_cmd.c_hiba = (i >> 16) & 3;
        i = (int)&sc->sc_ubaddr->t_char;
        sc->sc_ts.t_cmd.c_loba = i;
        sc->sc_ts.t_cmd.c_hiba = (i >> 16) & 3;
@@ -154,12 +154,17 @@ tsprobe(reg, ctlr, um)
        sc->sc_ts.t_cmd.c_repcnt = 1;
        addr->tsdb = sc->sc_uba;
        DELAY(20000);
        sc->sc_ts.t_cmd.c_repcnt = 1;
        addr->tsdb = sc->sc_uba;
        DELAY(20000);
-       /* should have interrupted by now */
-
-       if (cvec == 0 || cvec == 0x200) /* no interrupt */
-               ubarelse(numuba, &a);
-
-       return (sizeof (struct tsdevice));
+       /*
+        * The controller should have interrupted by now, but some do not,
+        * even if the delays above are extended to many seconds.  If the
+        * vector is still unknown, we assume the drive is present at
+        * the usual vector.
+        */
+       if (cvec == 0 || cvec == 0x200) {
+               cvec = (int)reg & 7 ? 0260 : 0224;
+               br = 0x15;
+       }
+       return (sizeof(struct tsdevice));
 }
 
 /*
 }
 
 /*
@@ -167,15 +172,13 @@ tsprobe(reg, ctlr, um)
  * make them contiguous to keep overhead down.  This also sets
  * sc_uba (which then never changes).
  */
  * make them contiguous to keep overhead down.  This also sets
  * sc_uba (which then never changes).
  */
-tsmap(sc, uban, a)
+tsmap(sc, uban)
        register struct ts_softc *sc;
        register struct ts_softc *sc;
-       int uban, *a;
+       int uban;
 {
        register int i;
 
        i = uballoc(uban, (caddr_t)&sc->sc_ts, sizeof(sc->sc_ts), 0);
 {
        register int i;
 
        i = uballoc(uban, (caddr_t)&sc->sc_ts, sizeof(sc->sc_ts), 0);
-       if (a != NULL)
-               *a = i;
        i = UBAI_ADDR(i);
        sc->sc_ubaddr = (struct ts_tsdata *)i;
        /*
        i = UBAI_ADDR(i);
        sc->sc_ubaddr = (struct ts_tsdata *)i;
        /*
@@ -808,7 +811,7 @@ tsreset(uban)
                                break;
                        }
                }
                                break;
                        }
                }
-               tsmap(&ts_softc[ts11], uban, (int *)NULL);
+               tsmap(&ts_softc[ts11], uban);
                (void) tsinit(ts11);
                tsstart(um);
        }
                (void) tsinit(ts11);
                tsstart(um);
        }