Home | History | Annotate | Line # | Download | only in include
pmap.h revision 1.5
      1 /*
      2  * Copyright (c) 1993 Adam Glass
      3  * All rights reserved.
      4  *
      5  * Redistribution and use in source and binary forms, with or without
      6  * modification, are permitted provided that the following conditions
      7  * are met:
      8  * 1. Redistributions of source code must retain the above copyright
      9  *    notice, this list of conditions and the following disclaimer.
     10  * 2. Redistributions in binary form must reproduce the above copyright
     11  *    notice, this list of conditions and the following disclaimer in the
     12  *    documentation and/or other materials provided with the distribution.
     13  * 3. All advertising materials mentioning features or use of this software
     14  *    must display the following acknowledgement:
     15  *	This product includes software developed by Adam Glass.
     16  * 4. The name of the Author may not be used to endorse or promote products
     17  *    derived from this software without specific prior written permission.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
     20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29  * SUCH DAMAGE.
     30  *
     31  * $Header: /tank/opengrok/rsync2/NetBSD/src/sys/arch/sun3/include/pmap.h,v 1.5 1993/08/28 15:36:36 glass Exp $
     32  */
     33 
     34 #ifndef	_PMAP_MACHINE_
     35 #define	_PMAP_MACHINE_
     36 
     37 /*
     38  * Pmap stuff
     39  * [some ideas borrowed from torek, but no code]
     40  */
     41 
     42 struct context_state {
     43     queue_chain_t  context_link;
     44     int            context_num;
     45     struct pmap   *context_upmap;
     46 };
     47 
     48 typedef struct context_state *context_t;
     49 
     50 struct pmap {
     51     int		                pm_refcount;	/* pmap reference count */
     52     simple_lock_data_t	        pm_lock;	/* lock on pmap */
     53     struct pmap_statistics	pm_stats;	/* pmap statistics */
     54     context_t                   pm_context;     /* context if any */
     55     int                         pm_version;
     56     unsigned char               *pm_segmap;
     57 };
     58 
     59 typedef struct pmap *pmap_t;
     60 
     61 extern pmap_t kernel_pmap;
     62 
     63 struct pmeg_state {
     64     queue_chain_t  pmeg_link;
     65     int            pmeg_index;
     66     pmap_t         pmeg_owner;
     67     int            pmeg_owner_version;
     68     vm_offset_t    pmeg_va;
     69     int            pmeg_wired_count;
     70     int            pmeg_reserved;
     71     int            pmeg_vpages;
     72 };
     73 
     74 typedef struct pmeg_state *pmeg_t;
     75 
     76 #define PMAP_ACTIVATE(pmap, pcbp, iscurproc) \
     77       pmap_activate(pmap, pcbp)
     78 #define PMAP_DEACTIVATE(pmap, pcbp) \
     79       pmap_deactivate(pmap, pcbp)
     80 
     81 #define	pmap_kernel()			(kernel_pmap)
     82 
     83 /* like the sparc port, use the lower bits of a pa which must be page
     84  *  aligned anyway to pass memtype, caching information.
     85  */
     86 #define PMAP_MMEM      0x0
     87 #define PMAP_OBIO      0x1
     88 #define PMAP_VME16D    0x2
     89 #define PMAP_VME32D    0x3
     90 #define PMAP_MEMMASK   0x3
     91 #define PMAP_NC        0x4
     92 #define PMAP_SPECMASK  0x7
     93 
     94 extern vm_offset_t virtual_avail, virtual_end;
     95 extern vm_offset_t avail_start, avail_end;
     96 
     97 #endif	_PMAP_MACHINE_
     98