xref: /onnv-gate/usr/src/uts/i86pc/vm/kboot_mmu.h (revision 5084:7d838c5c0eed)
13446Smrj /*
23446Smrj  * CDDL HEADER START
33446Smrj  *
43446Smrj  * The contents of this file are subject to the terms of the
53446Smrj  * Common Development and Distribution License (the "License").
63446Smrj  * You may not use this file except in compliance with the License.
73446Smrj  *
83446Smrj  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
93446Smrj  * or http://www.opensolaris.org/os/licensing.
103446Smrj  * See the License for the specific language governing permissions
113446Smrj  * and limitations under the License.
123446Smrj  *
133446Smrj  * When distributing Covered Code, include this CDDL HEADER in each
143446Smrj  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
153446Smrj  * If applicable, add the following below this CDDL HEADER, with the
163446Smrj  * fields enclosed by brackets "[]" replaced with your own identifying
173446Smrj  * information: Portions Copyright [yyyy] [name of copyright owner]
183446Smrj  *
193446Smrj  * CDDL HEADER END
203446Smrj  */
213446Smrj 
223446Smrj /*
233446Smrj  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
243446Smrj  * Use is subject to license terms.
253446Smrj  */
263446Smrj 
273446Smrj #ifndef	_KBOOT_MMU_H
283446Smrj #define	_KBOOT_MMU_H
293446Smrj 
303446Smrj #pragma ident	"%Z%%M%	%I%	%E% SMI"
313446Smrj 
323446Smrj #ifdef	__cplusplus
333446Smrj extern "C" {
343446Smrj #endif
353446Smrj 
363446Smrj /*
373446Smrj  * Kernel boot-time interfaces for handling MMU mappings before the HAT proper
383446Smrj  * is running (i.e. before khat_running is set).
393446Smrj  */
403446Smrj 
413446Smrj #include <sys/mach_mmu.h>
423446Smrj 
433446Smrj struct xboot_info;
443446Smrj 
453446Smrj extern void kbm_init(struct xboot_info *);
463446Smrj 
473446Smrj /*
483446Smrj  * Interface to remap the page table window, also used by HAT during init.
493446Smrj  */
503446Smrj extern void *kbm_remap_window(paddr_t physaddr, int writeable);
513446Smrj 
523446Smrj /*
533446Smrj  * Find the next mapping at or above VA, if found returns non-zero and sets:
543446Smrj  * - va : virtual address
553446Smrj  * - pfn : pfn of real address
563446Smrj  * - size : pagesize of the mapping
573446Smrj  * - prot : protections
583446Smrj  */
593446Smrj extern int kbm_probe(uintptr_t *va, size_t *len, pfn_t *pfn, uint_t *prot);
603446Smrj 
613446Smrj /*
623446Smrj  * Add a new mapping
633446Smrj  */
643446Smrj extern void kbm_map(uintptr_t va, paddr_t pa, uint_t level, uint_t is_kernel);
653446Smrj 
66*5084Sjohnlev #ifdef __xpv
67*5084Sjohnlev extern void kbm_map_ma(maddr_t ma, uintptr_t va, uint_t level);
68*5084Sjohnlev #endif
69*5084Sjohnlev 
703446Smrj /*
713446Smrj  * unmap a single 4K page at VA
723446Smrj  */
733446Smrj extern void kbm_unmap(uintptr_t va);
743446Smrj 
753446Smrj /*
763446Smrj  * Remap a single 4K page at VA (always PROT_READ|PROT_WRITE).
773446Smrj  * Returns the pfn of the old mapping.
783446Smrj  */
793446Smrj extern pfn_t kbm_remap(uintptr_t va, pfn_t pfn);
803446Smrj 
813446Smrj /*
823446Smrj  * Make a page mapping read only
833446Smrj  */
843446Smrj extern void kbm_read_only(uintptr_t va, paddr_t pa);
853446Smrj 
863446Smrj 
873446Smrj /*
883446Smrj  * interface for kmdb to map a physical page, stack is only 1 deep
893446Smrj  */
903446Smrj extern void *kbm_push(paddr_t pa);
913446Smrj extern void kbm_pop(void);
923446Smrj 
933446Smrj /*
943446Smrj  * These are needed by mmu_init()
953446Smrj  */
963446Smrj extern int kbm_nx_support;
973446Smrj extern int kbm_pae_support;
983446Smrj extern int kbm_largepage_support;
993446Smrj 
1003446Smrj /*
1013446Smrj  * The size of memory mapped for the initial kernel nucleus text
1023446Smrj  * and data regions setup by the boot loader. needed for startup
1033446Smrj  */
1043446Smrj extern uint_t kbm_nucleus_size;
1053446Smrj 
1063446Smrj #ifdef	__cplusplus
1073446Smrj }
1083446Smrj #endif
1093446Smrj 
1103446Smrj #endif	/* _KBOOT_MMU_H */
111