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 #ifdef __cplusplus 31ae115bc7Smrj extern "C" { 32ae115bc7Smrj #endif 33ae115bc7Smrj 34ae115bc7Smrj /* 35ae115bc7Smrj * Kernel boot-time interfaces for handling MMU mappings before the HAT proper 36ae115bc7Smrj * is running (i.e. before khat_running is set). 37ae115bc7Smrj */ 38ae115bc7Smrj 39ae115bc7Smrj #include <sys/mach_mmu.h> 40ae115bc7Smrj 41ae115bc7Smrj struct xboot_info; 42ae115bc7Smrj 43ae115bc7Smrj extern void kbm_init(struct xboot_info *); 44ae115bc7Smrj 45ae115bc7Smrj /* 46ae115bc7Smrj * Interface to remap the page table window, also used by HAT during init. 47ae115bc7Smrj */ 48ae115bc7Smrj extern void *kbm_remap_window(paddr_t physaddr, int writeable); 49ae115bc7Smrj 50ae115bc7Smrj /* 51ae115bc7Smrj * Find the next mapping at or above VA, if found returns non-zero and sets: 52ae115bc7Smrj * - va : virtual address 53ae115bc7Smrj * - pfn : pfn of real address 54ae115bc7Smrj * - size : pagesize of the mapping 55ae115bc7Smrj * - prot : protections 56ae115bc7Smrj */ 57ae115bc7Smrj extern int kbm_probe(uintptr_t *va, size_t *len, pfn_t *pfn, uint_t *prot); 58ae115bc7Smrj 59ae115bc7Smrj /* 60ae115bc7Smrj * Add a new mapping 61ae115bc7Smrj */ 62ae115bc7Smrj extern void kbm_map(uintptr_t va, paddr_t pa, uint_t level, uint_t is_kernel); 63ae115bc7Smrj 64*843e1988Sjohnlev #ifdef __xpv 65*843e1988Sjohnlev extern void kbm_map_ma(maddr_t ma, uintptr_t va, uint_t level); 66*843e1988Sjohnlev #endif 67*843e1988Sjohnlev 68ae115bc7Smrj /* 69ae115bc7Smrj * unmap a single 4K page at VA 70ae115bc7Smrj */ 71ae115bc7Smrj extern void kbm_unmap(uintptr_t va); 72ae115bc7Smrj 73ae115bc7Smrj /* 74ae115bc7Smrj * Remap a single 4K page at VA (always PROT_READ|PROT_WRITE). 75ae115bc7Smrj * Returns the pfn of the old mapping. 76ae115bc7Smrj */ 77ae115bc7Smrj extern pfn_t kbm_remap(uintptr_t va, pfn_t pfn); 78ae115bc7Smrj 79ae115bc7Smrj /* 80ae115bc7Smrj * Make a page mapping read only 81ae115bc7Smrj */ 82ae115bc7Smrj extern void kbm_read_only(uintptr_t va, paddr_t pa); 83ae115bc7Smrj 84ae115bc7Smrj 85ae115bc7Smrj /* 86ae115bc7Smrj * interface for kmdb to map a physical page, stack is only 1 deep 87ae115bc7Smrj */ 88ae115bc7Smrj extern void *kbm_push(paddr_t pa); 89ae115bc7Smrj extern void kbm_pop(void); 90ae115bc7Smrj 91ae115bc7Smrj /* 92ae115bc7Smrj * These are needed by mmu_init() 93ae115bc7Smrj */ 94ae115bc7Smrj extern int kbm_nx_support; 95ae115bc7Smrj extern int kbm_pae_support; 96ae115bc7Smrj extern int kbm_largepage_support; 97ae115bc7Smrj 98ae115bc7Smrj /* 99ae115bc7Smrj * The size of memory mapped for the initial kernel nucleus text 100ae115bc7Smrj * and data regions setup by the boot loader. needed for startup 101ae115bc7Smrj */ 102ae115bc7Smrj extern uint_t kbm_nucleus_size; 103ae115bc7Smrj 104ae115bc7Smrj #ifdef __cplusplus 105ae115bc7Smrj } 106ae115bc7Smrj #endif 107ae115bc7Smrj 108ae115bc7Smrj #endif /* _KBOOT_MMU_H */ 109