Deleted Added
full compact
pmap.h (164895) pmap.h (176770)
1/*-
1/*-
2 * Copyright (C) 2006 Semihalf, Marian Balakowicz <m8@semihalf.com>
3 * All rights reserved.
4 *
5 * Adapted for Freescale's e500 core CPUs.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
21 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
23 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * $FreeBSD: head/sys/powerpc/include/pmap.h 176770 2008-03-03 13:20:52Z raj $
30 */
31/*-
2 * Copyright (C) 1995, 1996 Wolfgang Solfrank.
3 * Copyright (C) 1995, 1996 TooLs GmbH.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

23 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
32 * Copyright (C) 1995, 1996 Wolfgang Solfrank.
33 * Copyright (C) 1995, 1996 TooLs GmbH.
34 * All rights reserved.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

53 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
54 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
55 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
56 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
57 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
58 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
59 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60 *
31 * $NetBSD: pmap.h,v 1.17 2000/03/30 16:18:24 jdolecek Exp $
32 * $FreeBSD: head/sys/powerpc/include/pmap.h 164895 2006-12-05 04:01:52Z grehan $
61 * from: $NetBSD: pmap.h,v 1.17 2000/03/30 16:18:24 jdolecek Exp $
33 */
34
35#ifndef _MACHINE_PMAP_H_
36#define _MACHINE_PMAP_H_
37
38#include <sys/queue.h>
39#include <sys/_lock.h>
40#include <sys/_mutex.h>
41#include <machine/sr.h>
42#include <machine/pte.h>
62 */
63
64#ifndef _MACHINE_PMAP_H_
65#define _MACHINE_PMAP_H_
66
67#include <sys/queue.h>
68#include <sys/_lock.h>
69#include <sys/_mutex.h>
70#include <machine/sr.h>
71#include <machine/pte.h>
72#include <machine/tlb.h>
43
73
74#if defined(AIM)
75
44#if !defined(NPMAPS)
45#define NPMAPS 32768
46#endif /* !defined(NPMAPS) */
47
48struct pmap {
49 struct mtx pm_mtx;
50 u_int pm_sr[16];
51 u_int pm_active;

--- 12 unchanged lines hidden (view full) ---

64};
65LIST_HEAD(pvo_head, pvo_entry);
66
67struct md_page {
68 u_int mdpg_attrs;
69 struct pvo_head mdpg_pvoh;
70};
71
76#if !defined(NPMAPS)
77#define NPMAPS 32768
78#endif /* !defined(NPMAPS) */
79
80struct pmap {
81 struct mtx pm_mtx;
82 u_int pm_sr[16];
83 u_int pm_active;

--- 12 unchanged lines hidden (view full) ---

96};
97LIST_HEAD(pvo_head, pvo_entry);
98
99struct md_page {
100 u_int mdpg_attrs;
101 struct pvo_head mdpg_pvoh;
102};
103
104#define pmap_page_is_mapped(m) (!LIST_EMPTY(&(m)->md.mdpg_pvoh))
105
106#else
107
108struct pmap {
109 struct mtx pm_mtx; /* pmap mutex */
110 tlbtid_t pm_tid; /* TID to identify this pmap entries in TLB */
111 u_int pm_active; /* active on cpus */
112 int pm_refs; /* ref count */
113 struct pmap_statistics pm_stats;/* pmap statistics */
114
115 /* Page table directory, array of pointers to page tables. */
116 pte_t *pm_pdir[PDIR_NENTRIES];
117
118 /* List of allocated ptbl bufs (ptbl kva regions). */
119 TAILQ_HEAD(, ptbl_buf) ptbl_list;
120};
121typedef struct pmap *pmap_t;
122
123struct pv_entry {
124 pmap_t pv_pmap;
125 vm_offset_t pv_va;
126 TAILQ_ENTRY(pv_entry) pv_link;
127};
128typedef struct pv_entry *pv_entry_t;
129
130struct md_page {
131 TAILQ_HEAD(, pv_entry) pv_list;
132};
133
134#define MEM_REGIONS 8
135#define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list))
136
137#endif /* AIM */
138
72extern struct pmap kernel_pmap_store;
73#define kernel_pmap (&kernel_pmap_store)
74
139extern struct pmap kernel_pmap_store;
140#define kernel_pmap (&kernel_pmap_store)
141
75#define pmap_page_is_mapped(m) (!LIST_EMPTY(&(m)->md.mdpg_pvoh))
76
77#ifdef _KERNEL
78
79#define PMAP_LOCK(pmap) mtx_lock(&(pmap)->pm_mtx)
80#define PMAP_LOCK_ASSERT(pmap, type) \
81 mtx_assert(&(pmap)->pm_mtx, (type))
82#define PMAP_LOCK_DESTROY(pmap) mtx_destroy(&(pmap)->pm_mtx)
83#define PMAP_LOCK_INIT(pmap) mtx_init(&(pmap)->pm_mtx, "pmap", \
84 NULL, MTX_DEF)
85#define PMAP_LOCKED(pmap) mtx_owned(&(pmap)->pm_mtx)
86#define PMAP_MTX(pmap) (&(pmap)->pm_mtx)
87#define PMAP_TRYLOCK(pmap) mtx_trylock(&(pmap)->pm_mtx)
88#define PMAP_UNLOCK(pmap) mtx_unlock(&(pmap)->pm_mtx)
89
90void pmap_bootstrap(vm_offset_t, vm_offset_t);
91void pmap_kenter(vm_offset_t va, vm_offset_t pa);
92void pmap_kremove(vm_offset_t);
93void *pmap_mapdev(vm_offset_t, vm_size_t);
142#ifdef _KERNEL
143
144#define PMAP_LOCK(pmap) mtx_lock(&(pmap)->pm_mtx)
145#define PMAP_LOCK_ASSERT(pmap, type) \
146 mtx_assert(&(pmap)->pm_mtx, (type))
147#define PMAP_LOCK_DESTROY(pmap) mtx_destroy(&(pmap)->pm_mtx)
148#define PMAP_LOCK_INIT(pmap) mtx_init(&(pmap)->pm_mtx, "pmap", \
149 NULL, MTX_DEF)
150#define PMAP_LOCKED(pmap) mtx_owned(&(pmap)->pm_mtx)
151#define PMAP_MTX(pmap) (&(pmap)->pm_mtx)
152#define PMAP_TRYLOCK(pmap) mtx_trylock(&(pmap)->pm_mtx)
153#define PMAP_UNLOCK(pmap) mtx_unlock(&(pmap)->pm_mtx)
154
155void pmap_bootstrap(vm_offset_t, vm_offset_t);
156void pmap_kenter(vm_offset_t va, vm_offset_t pa);
157void pmap_kremove(vm_offset_t);
158void *pmap_mapdev(vm_offset_t, vm_size_t);
159boolean_t pmap_page_executable(vm_page_t);
94void pmap_unmapdev(vm_offset_t, vm_size_t);
95void pmap_deactivate(struct thread *);
96vm_offset_t pmap_kextract(vm_offset_t);
97int pmap_dev_direct_mapped(vm_offset_t, vm_size_t);
160void pmap_unmapdev(vm_offset_t, vm_size_t);
161void pmap_deactivate(struct thread *);
162vm_offset_t pmap_kextract(vm_offset_t);
163int pmap_dev_direct_mapped(vm_offset_t, vm_size_t);
98boolean_t pmap_page_executable(vm_page_t);
99boolean_t pmap_mmu_install(char *name, int prio);
100
101#define vtophys(va) pmap_kextract((vm_offset_t)(va))
102
103#define PHYS_AVAIL_SZ 128
104extern vm_offset_t phys_avail[PHYS_AVAIL_SZ];
105extern vm_offset_t virtual_avail;
106extern vm_offset_t virtual_end;
107
108extern vm_offset_t msgbuf_phys;
109
110extern int pmap_bootstrapped;
111
112#endif
113
114#endif /* !_MACHINE_PMAP_H_ */
164boolean_t pmap_mmu_install(char *name, int prio);
165
166#define vtophys(va) pmap_kextract((vm_offset_t)(va))
167
168#define PHYS_AVAIL_SZ 128
169extern vm_offset_t phys_avail[PHYS_AVAIL_SZ];
170extern vm_offset_t virtual_avail;
171extern vm_offset_t virtual_end;
172
173extern vm_offset_t msgbuf_phys;
174
175extern int pmap_bootstrapped;
176
177#endif
178
179#endif /* !_MACHINE_PMAP_H_ */