change ubaalloc macros to allow 2047 map registers on Q-bus,
authorMike Karels <karels@ucbvax.Berkeley.EDU>
Fri, 21 Oct 1988 09:03:55 +0000 (01:03 -0800)
committerMike Karels <karels@ucbvax.Berkeley.EDU>
Fri, 21 Oct 1988 09:03:55 +0000 (01:03 -0800)
use the macros, and add qbgetpri for Q-bus device probe routines

SCCS-vsn: sys/vax/uba/uba.c 7.6
SCCS-vsn: sys/vax/uba/ubavar.h 7.5
SCCS-vsn: sys/vax/uba/ubareg.h 7.7

usr/src/sys/vax/uba/uba.c
usr/src/sys/vax/uba/ubareg.h
usr/src/sys/vax/uba/ubavar.h

index 84ea781..135e74b 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.
  *
- *     @(#)uba.c       7.5 (Berkeley) %G%
+ *     @(#)uba.c       7.6 (Berkeley) %G%
  */
 
 #include "../machine/pte.h"
  */
 
 #include "../machine/pte.h"
index 409741e..9499c67 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.
  *
- *     @(#)ubareg.h    7.6 (Berkeley) %G%
+ *     @(#)ubareg.h    7.7 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
 /*
  * Size of unibus memory address space in pages
  * (also number of map registers).
 /*
  * Size of unibus memory address space in pages
  * (also number of map registers).
- * QBAPAGES should be 8192, but we don't need nearly
- * that much address space; choose pragmatically.
+ * QBAPAGES should be 8192, but we don't need nearly that much
+ * address space, and the return from the allocation routine
+ * can accommodate at most 2047 (ubavar.h: UBA_MAXMR);
+ * QBAPAGES must be at least UBAPAGES.  Choose pragmatically.
  */
 #define        UBAPAGES        496
 #define        NUBMREG         496
  */
 #define        UBAPAGES        496
 #define        NUBMREG         496
-#ifdef GATEWAY
-#define        QBAPAGES        1024            /* tunable: min UBAPAGES, max 8192 */
+#if defined(GATEWAY) && !defined(QNIVERT)
+#define        QBAPAGES        1024
 #else
 #else
-#define        QBAPAGES        UBAPAGES        /* tunable: min UBAPAGES, max 8192 */
+#define        QBAPAGES        UBAPAGES
 #endif
 #define        UBAIOADDR       0760000         /* start of I/O page */
 #define        UBAIOPAGES      16
 #endif
 #define        UBAIOADDR       0760000         /* start of I/O page */
 #define        UBAIOPAGES      16
index b7a39ed..59cac57 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.
  *
- *     @(#)ubavar.h    7.4 (Berkeley) %G%
+ *     @(#)ubavar.h    7.5 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -61,7 +61,7 @@ struct        uba_hd {
        short   uh_xclu;                /* an rk07 is using this uba! */
        int     uh_lastmem;             /* limit of any unibus memory */
 #define        UAMSIZ  100
        short   uh_xclu;                /* an rk07 is using this uba! */
        int     uh_lastmem;             /* limit of any unibus memory */
 #define        UAMSIZ  100
-       struct  map *uh_map;            /* buffered data path regs free */
+       struct  map *uh_map;            /* register free map */
 };
 
 /* given a pointer to uba_regs, find DWBUA registers */
 };
 
 /* given a pointer to uba_regs, find DWBUA registers */
@@ -163,12 +163,28 @@ struct uba_driver {
 
 /*
  * Macros to bust return word from map allocation routines.
 
 /*
  * Macros to bust return word from map allocation routines.
+ * SHOULD USE STRUCTURE TO STORE UBA RESOURCE ALLOCATION:
  */
  */
-#define        UBAI_BDP(i)     ((int)(((unsigned)(i))>>28))
-#define        UBAI_NMR(i)     ((int)((i)>>18)&0x3ff)
-#define        UBAI_MR(i)      ((int)((i)>>9)&0x1ff)
-#define        UBAI_BOFF(i)    ((int)((i)&0x1ff))
-#define        UBAI_ADDR(i)    ((int)((i)&0x3ffff))    /* uba addr (boff+mr) */
+#ifdef notyet
+struct ubinfo {
+       long    ub_addr;        /* unibus address: mr + boff */
+       int     ub_nmr;         /* number of registers, 0 if empty */
+       int     ub_bdp;         /* bdp number, 0 if none */
+};
+#define        UBAI_MR(i)      (((i) >> 9) & 0x7ff)    /* starting map register */
+#define        UBAI_BOFF(i)    ((i)&0x1ff)             /* page offset */
+#else
+#define        UBAI_BDP(i)     ((int)(((unsigned)(i)) >> 28))
+#define        BDPMASK         0xf0000000
+#define        UBAI_NMR(i)     ((int)((i) >> 20) & 0xff)       /* max 255 (=127.5K) */
+#define        UBA_MAXNMR      255
+#define        UBAI_MR(i)      ((int)((i) >> 9) & 0x7ff)       /* max 2047 */
+#define        UBA_MAXMR       2047
+#define        UBAI_BOFF(i)    ((int)((i) & 0x1ff))
+#define        UBAI_ADDR(i)    ((int)((i) & 0xfffff))  /* uba addr (boff+mr) */
+#define        UBAI_INFO(off, mr, nmr, bdp) \
+       (((bdp) << 28) | ((nmr) << 20) | ((mr) << 9) | (off))
+#endif
 
 #ifndef LOCORE
 #ifdef KERNEL
 
 #ifndef LOCORE
 #ifdef KERNEL