1: /*
   2:  * Copyright (c) 1986 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)uba.h	1.2 (2.11BSD GTE) 1/3/93
   7:  */
   8: 
   9: /*
  10:  *	Structure to access UNIBUS map registers.
  11:  */
  12: 
  13: struct  ubmap   {
  14:     short   ub_lo;
  15:     short   ub_hi;
  16: };
  17: 
  18: #ifdef UCB_METER
  19: /*
  20:  *	Structure for metering mapalloc performance.
  21:  */
  22: struct  ubmeter {
  23:     long    ub_calls;   /* total # of calls to mapalloc */
  24:     long    ub_remaps;  /* total # of buffer remappings */
  25:     long    ub_fails;   /* total # of allocation failures */
  26:     long    ub_pages;   /* total # of pages allocated */
  27: };
  28: #endif
  29: 
  30: #define UBMAP   ((struct ubmap *) 0170200)
  31: #define UBPAGE  020000          /* size of UNIBUS map segment */
  32: 
  33: /*
  34:  *	BUF_UBADDR is the UNIBUS address of buffers
  35:  *	if we have a UNIBUS map, as distinguished from bpaddr,
  36:  *	which is the physical address in clicks.
  37:  */
  38: #define BUF_UBADDR  020000
  39: 
  40: /*
  41:  *	Bytes to UNIBUS pages.
  42:  */
  43: #define btoub(b)    ((((long)(b)) + ((long)(UBPAGE - 1))) / ((long)UBPAGE))
  44: 
  45: /*
  46:  *	Number of UNIBUS registers required by n objects of size s.
  47:  */
  48: #define nubreg(n,s) (((long) (n) * (long) (s) +     \
  49:             ((long) (UBPAGE - 1))) / (long) UBPAGE)
  50: 
  51: /*
  52:  *	Set UNIBUS register r to point at physical address p (in bytes).
  53:  */
  54: #define setubregno(r,p) {                   \
  55:                 UBMAP[r].ub_lo  = loint(p); \
  56:                 UBMAP[r].ub_hi  = hiint(p); \
  57:             }
  58: 
  59: /*
  60:  *	Point the appropriate UNIBUS register at a kernel
  61:  *	virtual data address (in clicks).  V must be less
  62:  *	than btoc(248K).
  63:  */
  64: #define pointubreg(v,sep)   {   ubadr_t x; \
  65:                     short   regno; \
  66:                     regno   = ((v) >> 7) & 037; \
  67:                     x   = (ubadr_t) (v) & ~01; \
  68:                     UBMAP[regno].ub_lo  = loint (x); \
  69:                     UBMAP[regno].ub_hi  = hiint (x); \
  70:                 }
  71: 
  72: #ifdef KERNEL
  73: extern  short   ubmap;          /* Do we have UNIBUS registers? */
  74: extern  memaddr bpaddr;         /* physical click-address of buffers */
  75: extern  struct map  ub_map[];
  76: extern  int ub_wantmr;
  77: #endif

Defined struct's

ubmeter defined in line 22; used 2 times

Defined macros

BUF_UBADDR defined in line 38; used 4 times
nubreg defined in line 48; used 1 times
pointubreg defined in line 64; never used
setubregno defined in line 54; used 2 times

Usage of this include

Last modified: 1993-01-03
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2622
Valid CSS Valid XHTML 1.0 Strict