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