xref: /titanic_41/usr/src/uts/i86pc/vm/kboot_mmu.h (revision 6a1af1a67532df169a657cce07140be64bdea084)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_KBOOT_MMU_H
28 #define	_KBOOT_MMU_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Kernel boot-time interfaces for handling MMU mappings before the HAT proper
38  * is running (i.e. before khat_running is set).
39  */
40 
41 #include <sys/mach_mmu.h>
42 
43 struct xboot_info;
44 
45 extern void kbm_init(struct xboot_info *);
46 
47 /*
48  * Interface to remap the page table window, also used by HAT during init.
49  */
50 extern void *kbm_remap_window(paddr_t physaddr, int writeable);
51 
52 /*
53  * Find the next mapping at or above VA, if found returns non-zero and sets:
54  * - va : virtual address
55  * - pfn : pfn of real address
56  * - size : pagesize of the mapping
57  * - prot : protections
58  */
59 extern int kbm_probe(uintptr_t *va, size_t *len, pfn_t *pfn, uint_t *prot);
60 
61 /*
62  * Add a new mapping
63  */
64 extern void kbm_map(uintptr_t va, paddr_t pa, uint_t level, uint_t is_kernel);
65 
66 #ifdef __xpv
67 extern void kbm_map_ma(maddr_t ma, uintptr_t va, uint_t level);
68 #endif
69 
70 /*
71  * unmap a single 4K page at VA
72  */
73 extern void kbm_unmap(uintptr_t va);
74 
75 /*
76  * Remap a single 4K page at VA (always PROT_READ|PROT_WRITE).
77  * Returns the pfn of the old mapping.
78  */
79 extern pfn_t kbm_remap(uintptr_t va, pfn_t pfn);
80 
81 /*
82  * Make a page mapping read only
83  */
84 extern void kbm_read_only(uintptr_t va, paddr_t pa);
85 
86 
87 /*
88  * interface for kmdb to map a physical page, stack is only 1 deep
89  */
90 extern void *kbm_push(paddr_t pa);
91 extern void kbm_pop(void);
92 
93 /*
94  * These are needed by mmu_init()
95  */
96 extern int kbm_nx_support;
97 extern int kbm_pae_support;
98 extern int kbm_largepage_support;
99 
100 /*
101  * The size of memory mapped for the initial kernel nucleus text
102  * and data regions setup by the boot loader. needed for startup
103  */
104 extern uint_t kbm_nucleus_size;
105 
106 #ifdef	__cplusplus
107 }
108 #endif
109 
110 #endif	/* _KBOOT_MMU_H */
111