new version which doesn't get hung up
[unix-history] / usr / src / sys / vax / uba / uba.c
index b56bcf0..93e1531 100644 (file)
@@ -1,4 +1,4 @@
-/*     uba.c   4.15    %G%     */
+/*     uba.c   4.18    %G%     */
 
 #define        DELAY(N)        { register int d; d = N; while (--d > 0); }
 
 
 #define        DELAY(N)        { register int d; d = N; while (--d > 0); }
 
@@ -112,7 +112,7 @@ ubasetup(uban, bp, flags)
        o = (int)bp->b_un.b_addr & PGOFSET;
        npf = btoc(bp->b_bcount + o) + 1;
        a = spl6();
        o = (int)bp->b_un.b_addr & PGOFSET;
        npf = btoc(bp->b_bcount + o) + 1;
        a = spl6();
-       while ((reg = malloc(uh->uh_map, npf)) == 0) {
+       while ((reg = rmalloc(uh->uh_map, npf)) == 0) {
                if (flags & UBA_CANTWAIT)
                        return (0);
                uh->uh_mrwant++;
                if (flags & UBA_CANTWAIT)
                        return (0);
                uh->uh_mrwant++;
@@ -122,7 +122,7 @@ ubasetup(uban, bp, flags)
        if (flags & UBA_NEEDBDP) {
                while ((bdp = ffs(uh->uh_bdpfree)) == 0) {
                        if (flags & UBA_CANTWAIT) {
        if (flags & UBA_NEEDBDP) {
                while ((bdp = ffs(uh->uh_bdpfree)) == 0) {
                        if (flags & UBA_CANTWAIT) {
-                               mfree(uh->uh_map, npf, reg);
+                               rmfree(uh->uh_map, npf, reg);
                                return (0);
                        }
                        uh->uh_bdpwant++;
                                return (0);
                        }
                        uh->uh_bdpwant++;
@@ -209,8 +209,7 @@ ubarelse(uban, amr)
        splx(s);                /* let interrupts in, we're safe for a while */
        bdp = (mr >> 28) & 0x0f;
        if (bdp) {
        splx(s);                /* let interrupts in, we're safe for a while */
        bdp = (mr >> 28) & 0x0f;
        if (bdp) {
-               switch (cpu)
-               {
+               switch (cpu) {
 #if VAX780
                case VAX_780:
                        uh->uh_uba->uba_dpr[bdp] |= UBA_BNE;
 #if VAX780
                case VAX_780:
                        uh->uh_uba->uba_dpr[bdp] |= UBA_BNE;
@@ -236,7 +235,7 @@ ubarelse(uban, amr)
        npf = (mr >> 18) & 0x3ff;
        reg = ((mr >> 9) & 0x1ff) + 1;
        s = spl6();
        npf = (mr >> 18) & 0x3ff;
        reg = ((mr >> 9) & 0x1ff) + 1;
        s = spl6();
-       mfree(uh->uh_map, npf, reg);
+       rmfree(uh->uh_map, npf, reg);
        splx(s);
 
        /*
        splx(s);
 
        /*
@@ -252,6 +251,26 @@ ubarelse(uban, amr)
                ;
 }
 
                ;
 }
 
+ubapurge(um)
+       register struct uba_minfo *um;
+{
+       register struct uba_hd *uh = um->um_hd;
+       register int bdp = (um->um_ubinfo >> 28) & 0x0f;
+
+       switch (cpu) {
+#if VAX780
+       case VAX_780:
+               uh->uh_uba->uba_dpr[bdp] |= UBA_BNE;
+               break;
+#endif
+#if VAX750
+       case VAX_750:
+               uh->uh_uba->uba_dpr[bdp] |= UBA_PURGE|UBA_NXM|UBA_UCE;
+               break;
+#endif
+       }
+}
+
 /*
  * Generate a reset on uba number uban.  Then
  * call each device in the character device table,
 /*
  * Generate a reset on uba number uban.  Then
  * call each device in the character device table,
@@ -295,6 +314,7 @@ ubareset(uban)
        splx(s);
 }
 
        splx(s);
 }
 
+#if VAX780
 /*
  * Init a uba.  This is called with a pointer
  * rather than a virtual address since it is called
 /*
  * Init a uba.  This is called with a pointer
  * rather than a virtual address since it is called
@@ -313,7 +333,6 @@ ubainit(uba)
                ;
 }
 
                ;
 }
 
-#if VAX780
 /*
  * Check to make sure the UNIBUS adaptor is not hung,
  * with an interrupt in the register to be presented,
 /*
  * Check to make sure the UNIBUS adaptor is not hung,
  * with an interrupt in the register to be presented,
@@ -330,7 +349,7 @@ unhang()
                if (up->uba_sr == 0)
                        return;
                uh->uh_hangcnt++;
                if (up->uba_sr == 0)
                        return;
                uh->uh_hangcnt++;
-               if (uh->uh_hangcnt > 5*HZ) {
+               if (uh->uh_hangcnt > 5*hz) {
                        uh->uh_hangcnt = 0;
                        printf("HANG ");
                        ubareset(uban);
                        uh->uh_hangcnt = 0;
                        printf("HANG ");
                        ubareset(uban);
@@ -349,6 +368,8 @@ ubawatch()
        register struct uba_hd *uh;
        register int uban;
 
        register struct uba_hd *uh;
        register int uban;
 
+       if (panicstr)
+               return;
        for (uban = 0; uban < numuba; uban++) {
                uh = &uba_hd[uban];
                if (uh->uh_hangcnt)
        for (uban = 0; uban < numuba; uban++) {
                uh = &uba_hd[uban];
                if (uh->uh_hangcnt)