pmap.h (67bc8c8b9e69bc53221a9bd914e418d81d6cdc7d) pmap.h (4026b447908ec41deae2e5c9cdd62eef3072daa4)
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

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

69#include <sys/_cpuset.h>
70#include <sys/_lock.h>
71#include <sys/_mutex.h>
72#include <machine/sr.h>
73#include <machine/pte.h>
74#include <machine/slb.h>
75#include <machine/tlb.h>
76
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

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

69#include <sys/_cpuset.h>
70#include <sys/_lock.h>
71#include <sys/_mutex.h>
72#include <machine/sr.h>
73#include <machine/pte.h>
74#include <machine/slb.h>
75#include <machine/tlb.h>
76
77struct pmap;
78typedef struct pmap *pmap_t;
79
77#if defined(AIM)
78
79#if !defined(NPMAPS)
80#define NPMAPS 32768
81#endif /* !defined(NPMAPS) */
82
83struct slbtnode;
80#if defined(AIM)
81
82#if !defined(NPMAPS)
83#define NPMAPS 32768
84#endif /* !defined(NPMAPS) */
85
86struct slbtnode;
84struct pmap;
85typedef struct pmap *pmap_t;
86
87struct pvo_entry {
88 LIST_ENTRY(pvo_entry) pvo_vlink; /* Link to common virt page */
89#ifndef __powerpc64__
90 LIST_ENTRY(pvo_entry) pvo_olink; /* Link to overflow entry */
91#endif
92 RB_ENTRY(pvo_entry) pvo_plink; /* Link to pmap entries */
93 struct {

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

126#define PVO_PTEGIDX_ISSET(pvo) ((pvo)->pvo_vaddr & PVO_PTEGIDX_VALID)
127#define PVO_PTEGIDX_CLR(pvo) \
128 ((void)((pvo)->pvo_vaddr &= ~(PVO_PTEGIDX_VALID|PVO_PTEGIDX_MASK)))
129#define PVO_PTEGIDX_SET(pvo, i) \
130 ((void)((pvo)->pvo_vaddr |= (i)|PVO_PTEGIDX_VALID))
131#define PVO_VSID(pvo) ((pvo)->pvo_vpn >> 16)
132
133struct pmap {
87
88struct pvo_entry {
89 LIST_ENTRY(pvo_entry) pvo_vlink; /* Link to common virt page */
90#ifndef __powerpc64__
91 LIST_ENTRY(pvo_entry) pvo_olink; /* Link to overflow entry */
92#endif
93 RB_ENTRY(pvo_entry) pvo_plink; /* Link to pmap entries */
94 struct {

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

127#define PVO_PTEGIDX_ISSET(pvo) ((pvo)->pvo_vaddr & PVO_PTEGIDX_VALID)
128#define PVO_PTEGIDX_CLR(pvo) \
129 ((void)((pvo)->pvo_vaddr &= ~(PVO_PTEGIDX_VALID|PVO_PTEGIDX_MASK)))
130#define PVO_PTEGIDX_SET(pvo, i) \
131 ((void)((pvo)->pvo_vaddr |= (i)|PVO_PTEGIDX_VALID))
132#define PVO_VSID(pvo) ((pvo)->pvo_vpn >> 16)
133
134struct pmap {
135 struct pmap_statistics pm_stats;
134 struct mtx pm_mtx;
135
136 #ifdef __powerpc64__
137 struct slbtnode *pm_slb_tree_root;
138 struct slb **pm_slb;
139 int pm_slb_len;
140 #else
141 register_t pm_sr[16];
142 #endif
143 cpuset_t pm_active;
144
145 struct pmap *pmap_phys;
136 struct mtx pm_mtx;
137
138 #ifdef __powerpc64__
139 struct slbtnode *pm_slb_tree_root;
140 struct slb **pm_slb;
141 int pm_slb_len;
142 #else
143 register_t pm_sr[16];
144 #endif
145 cpuset_t pm_active;
146
147 struct pmap *pmap_phys;
146 struct pmap_statistics pm_stats;
147 struct pvo_tree pmap_pvo;
148};
149
150struct md_page {
151 volatile int32_t mdpg_attrs;
152 vm_memattr_t mdpg_cache_attrs;
153 struct pvo_head mdpg_pvoh;
154};

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

177struct slbtnode *slb_alloc_tree(void);
178void slb_free_tree(pmap_t pm);
179struct slb **slb_alloc_user_cache(void);
180void slb_free_user_cache(struct slb **);
181
182#elif defined(BOOKE)
183
184struct pmap {
148 struct pvo_tree pmap_pvo;
149};
150
151struct md_page {
152 volatile int32_t mdpg_attrs;
153 vm_memattr_t mdpg_cache_attrs;
154 struct pvo_head mdpg_pvoh;
155};

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

178struct slbtnode *slb_alloc_tree(void);
179void slb_free_tree(pmap_t pm);
180struct slb **slb_alloc_user_cache(void);
181void slb_free_user_cache(struct slb **);
182
183#elif defined(BOOKE)
184
185struct pmap {
186 struct pmap_statistics pm_stats; /* pmap statistics */
185 struct mtx pm_mtx; /* pmap mutex */
186 tlbtid_t pm_tid[MAXCPU]; /* TID to identify this pmap entries in TLB */
187 cpuset_t pm_active; /* active on cpus */
187 struct mtx pm_mtx; /* pmap mutex */
188 tlbtid_t pm_tid[MAXCPU]; /* TID to identify this pmap entries in TLB */
189 cpuset_t pm_active; /* active on cpus */
188 struct pmap_statistics pm_stats; /* pmap statistics */
189
190 /* Page table directory, array of pointers to page tables. */
191 pte_t *pm_pdir[PDIR_NENTRIES];
192
193 /* List of allocated ptbl bufs (ptbl kva regions). */
194 TAILQ_HEAD(, ptbl_buf) pm_ptbl_list;
195};
190
191 /* Page table directory, array of pointers to page tables. */
192 pte_t *pm_pdir[PDIR_NENTRIES];
193
194 /* List of allocated ptbl bufs (ptbl kva regions). */
195 TAILQ_HEAD(, ptbl_buf) pm_ptbl_list;
196};
196typedef struct pmap *pmap_t;
197
198struct pv_entry {
199 pmap_t pv_pmap;
200 vm_offset_t pv_va;
201 TAILQ_ENTRY(pv_entry) pv_link;
202};
203typedef struct pv_entry *pv_entry_t;
204
205struct md_page {
206 TAILQ_HEAD(, pv_entry) pv_list;
207 int pv_tracked;
208};
209
210#define pmap_page_get_memattr(m) VM_MEMATTR_DEFAULT
211#define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list))
212
197
198struct pv_entry {
199 pmap_t pv_pmap;
200 vm_offset_t pv_va;
201 TAILQ_ENTRY(pv_entry) pv_link;
202};
203typedef struct pv_entry *pv_entry_t;
204
205struct md_page {
206 TAILQ_HEAD(, pv_entry) pv_list;
207 int pv_tracked;
208};
209
210#define pmap_page_get_memattr(m) VM_MEMATTR_DEFAULT
211#define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list))
212
213#else
214/*
215 * Common pmap members between AIM and BOOKE.
216 * libkvm needs pm_stats at the same location between both, as it doesn't define
217 * AIM nor BOOKE, and is expected to work across all.
218 */
219struct pmap {
220 struct pmap_statistics pm_stats; /* pmap statistics */
221 struct mtx pm_mtx; /* pmap mutex */
222};
213#endif /* AIM */
214
215extern struct pmap kernel_pmap_store;
216#define kernel_pmap (&kernel_pmap_store)
217
218#ifdef _KERNEL
219
220#define PMAP_LOCK(pmap) mtx_lock(&(pmap)->pm_mtx)

--- 49 unchanged lines hidden ---
223#endif /* AIM */
224
225extern struct pmap kernel_pmap_store;
226#define kernel_pmap (&kernel_pmap_store)
227
228#ifdef _KERNEL
229
230#define PMAP_LOCK(pmap) mtx_lock(&(pmap)->pm_mtx)

--- 49 unchanged lines hidden ---