xref: /titanic_41/usr/src/uts/i86pc/vm/kboot_mmu.h (revision dfb96a4f56fb431b915bc67e5d9d5c8d4f4f6679)
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 /*
67  * unmap a single 4K page at VA
68  */
69 extern void kbm_unmap(uintptr_t va);
70 
71 /*
72  * Remap a single 4K page at VA (always PROT_READ|PROT_WRITE).
73  * Returns the pfn of the old mapping.
74  */
75 extern pfn_t kbm_remap(uintptr_t va, pfn_t pfn);
76 
77 /*
78  * Make a page mapping read only
79  */
80 extern void kbm_read_only(uintptr_t va, paddr_t pa);
81 
82 
83 /*
84  * interface for kmdb to map a physical page, stack is only 1 deep
85  */
86 extern void *kbm_push(paddr_t pa);
87 extern void kbm_pop(void);
88 
89 /*
90  * These are needed by mmu_init()
91  */
92 extern int kbm_nx_support;
93 extern int kbm_pae_support;
94 extern int kbm_largepage_support;
95 
96 /*
97  * The size of memory mapped for the initial kernel nucleus text
98  * and data regions setup by the boot loader. needed for startup
99  */
100 extern uint_t kbm_nucleus_size;
101 
102 #ifdef	__cplusplus
103 }
104 #endif
105 
106 #endif	/* _KBOOT_MMU_H */
107