tlb.h revision 101898
1/*- 2 * Copyright (c) 2001 Jake Burkholder. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * $FreeBSD: head/sys/sparc64/include/tlb.h 101898 2002-08-15 05:24:55Z jake $ 27 */ 28 29#ifndef _MACHINE_TLB_H_ 30#define _MACHINE_TLB_H_ 31 32#define TLB_DIRECT_MASK (((1UL << (64 - 38)) - 1) << 38) 33#define TLB_DIRECT_SHIFT (3) 34#define TLB_DIRECT_UNCACHEABLE_SHIFT (11) 35#define TLB_DIRECT_COLOR_SHIFT (10) 36#define TLB_DIRECT_UNCACHEABLE (1 << TLB_DIRECT_UNCACHEABLE_SHIFT) 37 38#define TLB_DAR_SLOT_SHIFT (3) 39#define TLB_DAR_SLOT(slot) ((slot) << TLB_DAR_SLOT_SHIFT) 40 41#define TAR_VPN_SHIFT (13) 42#define TAR_CTX_MASK ((1 << TAR_VPN_SHIFT) - 1) 43 44#define TLB_TAR_VA(va) ((va) & ~TAR_CTX_MASK) 45#define TLB_TAR_CTX(ctx) ((ctx) & TAR_CTX_MASK) 46 47#define TLB_DEMAP_ID_SHIFT (4) 48#define TLB_DEMAP_ID_PRIMARY (0) 49#define TLB_DEMAP_ID_SECONDARY (1) 50#define TLB_DEMAP_ID_NUCLEUS (2) 51 52#define TLB_DEMAP_TYPE_SHIFT (6) 53#define TLB_DEMAP_TYPE_PAGE (0) 54#define TLB_DEMAP_TYPE_CONTEXT (1) 55 56#define TLB_DEMAP_VA(va) ((va) & ~PAGE_MASK) 57#define TLB_DEMAP_ID(id) ((id) << TLB_DEMAP_ID_SHIFT) 58#define TLB_DEMAP_TYPE(type) ((type) << TLB_DEMAP_TYPE_SHIFT) 59 60#define TLB_DEMAP_PAGE (TLB_DEMAP_TYPE(TLB_DEMAP_TYPE_PAGE)) 61#define TLB_DEMAP_CONTEXT (TLB_DEMAP_TYPE(TLB_DEMAP_TYPE_CONTEXT)) 62 63#define TLB_DEMAP_PRIMARY (TLB_DEMAP_ID(TLB_DEMAP_ID_PRIMARY)) 64#define TLB_DEMAP_SECONDARY (TLB_DEMAP_ID(TLB_DEMAP_ID_SECONDARY)) 65#define TLB_DEMAP_NUCLEUS (TLB_DEMAP_ID(TLB_DEMAP_ID_NUCLEUS)) 66 67#define TLB_CTX_KERNEL (0) 68#define TLB_CTX_USER_MIN (1) 69#define TLB_CTX_USER_MAX (8192) 70 71#define MMU_SFSR_ASI_SHIFT (16) 72#define MMU_SFSR_FT_SHIFT (7) 73#define MMU_SFSR_E_SHIFT (6) 74#define MMU_SFSR_CT_SHIFT (4) 75#define MMU_SFSR_PR_SHIFT (3) 76#define MMU_SFSR_W_SHIFT (2) 77#define MMU_SFSR_OW_SHIFT (1) 78#define MMU_SFSR_FV_SHIFT (0) 79 80#define MMU_SFSR_ASI_SIZE (8) 81#define MMU_SFSR_FT_SIZE (6) 82#define MMU_SFSR_CT_SIZE (2) 83 84#define MMU_SFSR_W (1L << MMU_SFSR_W_SHIFT) 85 86struct tlb_entry; 87 88extern int kernel_tlb_slots; 89extern struct tlb_entry *kernel_tlbs; 90 91extern int tlb_dtlb_entries; 92extern int tlb_itlb_entries; 93 94void tlb_context_demap(struct pmap *pm); 95void tlb_page_demap(struct pmap *pm, vm_offset_t va); 96void tlb_range_demap(struct pmap *pm, vm_offset_t start, vm_offset_t end); 97void tlb_dump(void); 98 99#endif /* !_MACHINE_TLB_H_ */ 100