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