]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/ppc/pmap.h
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
26 * Copyright (c) 1990 The University of Utah and
27 * the Center for Software Science at the University of Utah (CSS).
28 * All rights reserved.
30 * Permission to use, copy, modify and distribute this software is hereby
31 * granted provided that (1) source code retains these copyright, permission,
32 * and disclaimer notices, and (2) redistributions including binaries
33 * reproduce the notices in supporting documentation, and (3) all advertising
34 * materials mentioning features or use of this software display the following
35 * acknowledgement: ``This product includes software developed by the Center
36 * for Software Science at the University of Utah.''
38 * THE UNIVERSITY OF UTAH AND CSS ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
39 * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSS DISCLAIM ANY LIABILITY OF
40 * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
42 * CSS requests users of this software to return to css-dist@cs.utah.edu any
43 * improvements that they make and grant CSS redistribution rights.
45 * Utah $Hdr: pmap.h 1.13 91/09/25$
46 * Author: Mike Hibler, Bob Wheeler, University of Utah CSS, 9/90
52 #include <mach/vm_types.h>
53 #include <mach/machine/vm_types.h>
54 #include <mach/vm_prot.h>
55 #include <mach/vm_statistics.h>
56 #include <kern/queue.h>
60 queue_head_t pmap_link
; /* MUST BE FIRST */
61 unsigned int pmapvr
; /* Virtual to real conversion mask */
62 space_t space
; /* space for this pmap */
63 #define BMAPLOCK 0x00000001
64 struct blokmap
*bmaps
; /* Physical pointer to odd-size page maps */
65 int ref_count
; /* reference count */
66 unsigned int vflags
; /* Alternate map validity flags */
67 #define pmapBatVal 0xFF000000
68 #define pmapBatDVal 0xF0000000
69 #define pmapBatIVal 0x0F000000
70 #define pmapFlags 0x00FF0000
71 #define pmapSubord 0x00800000
72 #define pmapAltSeg 0x0000FFFF
73 unsigned int spaceNum
; /* Space number */
74 /* PPC line boundary here - 020 */
75 unsigned int pmapSegs
[16]; /* Contents of segment register if different than base space */
76 /* PPC line boundary here - 060 */
77 struct pmap
*pmapPmaps
[16]; /* Pointer to next lower level of pmaps */
78 /* PPC line boundary here - 0A0 */
79 /* Note: this must start on a word boundary */
80 unsigned short pmapUsage
[128]; /* Count of pages mapped into 32mb (8192 page) slots */
81 #define pmapUsageShft 25
82 #define pmapUsageMask 0x0000007F
83 #define pmapUsageSize (32*1024*1024)
85 /* PPC line boundary here - 1A0 */
86 struct pmap_statistics stats
; /* statistics */
87 decl_simple_lock_data(,lock
) /* lock on map */
89 /* Need to pad out to a power of 2 - right now it is 512 bytes */
93 #define PMAP_NULL ((pmap_t) 0)
95 extern pmap_t kernel_pmap
; /* The kernel's map */
96 extern pmap_t cursor_pmap
; /* The pmap to start allocations with */
98 #define PMAP_SWITCH_USER(th, map, my_cpu) th->map = map;
100 #define PMAP_ACTIVATE(pmap, th, cpu)
101 #define PMAP_DEACTIVATE(pmap, th, cpu)
102 #define PMAP_CONTEXT(pmap,th)
104 #define pmap_kernel_va(VA) \
105 (((VA) >= VM_MIN_KERNEL_ADDRESS) && ((VA) <= VM_MAX_KERNEL_ADDRESS))
107 #define PPC_SID_KERNEL 0 /* Must change KERNEL_SEG_REG0_VALUE if !0 */
108 #define SID_MAX ((1<<20) - 1) /* Space ID=20 bits, segment_id=SID + 4 bits */
110 #define pmap_kernel() (kernel_pmap)
111 #define pmap_resident_count(pmap) ((pmap)->stats.resident_count)
112 #define pmap_remove_attributes(pmap,start,end)
113 #define pmap_copy(dpmap,spmap,da,len,sa)
114 #define pmap_update()
116 #define pmap_phys_address(x) ((x) << PPC_PGSHIFT)
117 #define pmap_phys_to_frame(x) ((x) >> PPC_PGSHIFT)
122 extern void ppc_protection_init(void);
123 extern vm_offset_t
phystokv(vm_offset_t pa
); /* Get kernel virtual address from physical */
124 extern vm_offset_t
kvtophys(vm_offset_t va
); /* Get physical address from kernel virtual */
125 extern vm_offset_t
pmap_map(vm_offset_t va
,
129 extern kern_return_t
pmap_add_physical_memory(vm_offset_t spa
,
133 extern vm_offset_t
pmap_map_bd(vm_offset_t va
,
137 extern void pmap_bootstrap(unsigned int mem_size
,
138 vm_offset_t
*first_avail
,
139 vm_offset_t
*first_phys_avail
, unsigned int kmapsize
);
140 extern void pmap_block_map(vm_offset_t pa
,
145 extern void pmap_switch(pmap_t
);
147 extern vm_offset_t
pmap_extract(pmap_t pmap
,
150 extern void pmap_remove_all(vm_offset_t pa
);
152 extern boolean_t
pmap_verify_free(vm_offset_t pa
);
153 extern void sync_cache(vm_offset_t pa
, unsigned length
);
154 extern void flush_dcache(vm_offset_t va
, unsigned length
, boolean_t phys
);
155 extern void invalidate_dcache(vm_offset_t va
, unsigned length
, boolean_t phys
);
156 extern void invalidate_icache(vm_offset_t va
, unsigned length
, boolean_t phys
);
157 extern void pmap_sync_caches_phys(vm_offset_t pa
);
158 extern void invalidate_cache_for_io(vm_offset_t va
, unsigned length
, boolean_t phys
);
159 extern void pmap_map_block(pmap_t pmap
, vm_offset_t va
, vm_offset_t pa
, vm_size_t size
,
160 vm_prot_t prot
, int attr
, unsigned int flags
); /* Map a block */
161 extern kern_return_t
pmap_map_block_opt(vm_map_t map
, vm_offset_t
*va
,
162 vm_offset_t pa
, vm_size_t size
, vm_prot_t prot
, int attr
); /* Map a block allocating an optimal virtual address */
163 extern kern_return_t
vm_map_block(vm_map_t map
, vm_offset_t
*va
, vm_offset_t
*bnd
, vm_offset_t pa
,
164 vm_size_t size
, vm_prot_t prot
);
166 extern kern_return_t
pmap_nest(pmap_t grand
, pmap_t subord
, vm_offset_t vaddr
, vm_size_t size
);
168 extern void pmap_ver(pmap_t pmap
, vm_offset_t sva
, vm_offset_t eva
);
170 #endif /* _PPC_PMAP_H_ */