mark unibus mass storage devices csr addresses as used;
authorMike Karels <karels@ucbvax.Berkeley.EDU>
Tue, 2 Dec 1986 08:43:54 +0000 (00:43 -0800)
committerMike Karels <karels@ucbvax.Berkeley.EDU>
Tue, 2 Dec 1986 08:43:54 +0000 (00:43 -0800)
check for and warn about overlaps.

SCCS-vsn: sys/vax/vax/autoconf.c 7.3

usr/src/sys/vax/vax/autoconf.c

index 45a7f95..126683f 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.
  *
- *     @(#)autoconf.c  7.2 (Berkeley) %G%
+ *     @(#)autoconf.c  7.3 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -751,6 +751,7 @@ unifind(uhp0, pumem)
                        continue;
                }
                printf("vec %o, ipl %x\n", cvec, br);
                        continue;
                }
                printf("vec %o, ipl %x\n", cvec, br);
+               csralloc(ualloc, addr, i);
                um->um_alive = 1;
                um->um_ubanum = numuba;
                um->um_hd = &uba_hd[numuba];
                um->um_alive = 1;
                um->um_ubanum = numuba;
                um->um_hd = &uba_hd[numuba];
@@ -832,8 +833,7 @@ unifind(uhp0, pumem)
                        continue;
                }
                printf("vec %o, ipl %x\n", cvec, br);
                        continue;
                }
                printf("vec %o, ipl %x\n", cvec, br);
-               while (--i >= 0)
-                       ualloc[ubdevreg(addr+i)] = 1;
+               csralloc(ualloc, addr, i);
                ui->ui_hd = &uba_hd[numuba];
                for (ivec = ui->ui_intr; *ivec; ivec++) {
                        ui->ui_hd->uh_vec[cvec/4] =
                ui->ui_hd = &uba_hd[numuba];
                for (ivec = ui->ui_intr; *ivec; ivec++) {
                        ui->ui_hd->uh_vec[cvec/4] =
@@ -889,6 +889,31 @@ unifind(uhp0, pumem)
        wmemfree(ualloc, 8*1024);
 }
 
        wmemfree(ualloc, 8*1024);
 }
 
+/*
+ * Mark addresses starting at "addr" and continuing
+ * "size" bytes as allocated in the map "ualloc".
+ * Warn if the new allocation overlaps a previous allocation.
+ */
+static
+csralloc(ualloc, addr, size)
+       caddr_t ualloc;
+       u_short addr;
+       register int size;
+{
+       register caddr_t p;
+       int warned = 0;
+
+       p = &ualloc[ubdevreg(addr+size)];
+       while (--size >= 0) {
+               if (*--p && !warned) {
+                       printf(
+       "WARNING: device registers overlap those for a previous device!\n");
+                       warned = 1;
+               }
+               *p = 1;
+       }
+}
+
 /*
  * Make an IO register area accessible at physical address physa
  * by mapping kernel ptes starting at pte.
 /*
  * Make an IO register area accessible at physical address physa
  * by mapping kernel ptes starting at pte.