pmap.h revision 1.8 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.8 1994/06/28 21:44:38 gwr Exp $
32 */
33
34 #ifndef _PMAP_MACHINE_
35 #define _PMAP_MACHINE_
36
37 #include <sys/queue.h>
38
39 /*
40 * Pmap stuff
41 * [some ideas borrowed from torek, but no code]
42 */
43
44 struct context_state {
45 TAILQ_ENTRY(context_state) context_link;
46 int context_num;
47 struct pmap *context_upmap;
48 };
49
50 typedef struct context_state *context_t;
51
52 struct pmap {
53 int pm_refcount; /* pmap reference count */
54 simple_lock_data_t pm_lock; /* lock on pmap */
55 struct pmap_statistics pm_stats; /* pmap statistics */
56 context_t pm_context; /* context if any */
57 int pm_version;
58 unsigned char *pm_segmap;
59 };
60
61 typedef struct pmap *pmap_t;
62
63 extern pmap_t kernel_pmap;
64
65 #define PMEGQ_FREE 0
66 #define PMEGQ_INACTIVE 1
67 #define PMEGQ_ACTIVE 2
68 #define PMEGQ_KERNEL 3
69 #define PMEGQ_NONE 4
70
71 struct pmeg_state {
72 TAILQ_ENTRY(pmeg_state) pmeg_link;
73 int pmeg_index;
74 pmap_t pmeg_owner;
75 int pmeg_owner_version;
76 vm_offset_t pmeg_va;
77 int pmeg_wired_count;
78 int pmeg_reserved;
79 int pmeg_vpages;
80 int pmeg_qstate;
81 };
82
83 typedef struct pmeg_state *pmeg_t;
84
85 #define PMAP_ACTIVATE(pmap, pcbp, iscurproc) \
86 pmap_activate(pmap, pcbp)
87 #define PMAP_DEACTIVATE(pmap, pcbp) \
88 pmap_deactivate(pmap, pcbp)
89
90 #define pmap_kernel() (kernel_pmap)
91
92 /* like the sparc port, use the lower bits of a pa which must be page
93 * aligned anyway to pass memtype, caching information.
94 */
95 #define PMAP_MMEM 0x0
96 #define PMAP_OBIO 0x1
97 #define PMAP_VME16D 0x2
98 #define PMAP_VME32D 0x3
99 #define PMAP_MEMMASK 0x3
100 #define PMAP_NC 0x4
101 #define PMAP_SPECMASK 0x7
102
103 extern vm_offset_t virtual_avail, virtual_end;
104 extern vm_offset_t avail_start, avail_end;
105
106 #endif _PMAP_MACHINE_
107