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 113453 2003-04-13 21:54:58Z jake $
|
26 * $FreeBSD: head/sys/sparc64/include/tlb.h 176994 2008-03-09 15:53:34Z marius $ |
27 */ 28 29#ifndef _MACHINE_TLB_H_ 30#define _MACHINE_TLB_H_ 31 32#define TLB_DIRECT_ADDRESS_BITS (43) 33#define TLB_DIRECT_PAGE_BITS (PAGE_SHIFT_4M) 34 35#define TLB_DIRECT_ADDRESS_MASK ((1UL << TLB_DIRECT_ADDRESS_BITS) - 1) 36#define TLB_DIRECT_PAGE_MASK ((1UL << TLB_DIRECT_PAGE_BITS) - 1) 37 38#define TLB_PHYS_TO_DIRECT(pa) \ 39 ((pa) | VM_MIN_DIRECT_ADDRESS) 40#define TLB_DIRECT_TO_PHYS(va) \ 41 ((va) & TLB_DIRECT_ADDRESS_MASK) 42#define TLB_DIRECT_TO_TTE_MASK \ 43 (TD_V | TD_4M | (TLB_DIRECT_ADDRESS_MASK - TLB_DIRECT_PAGE_MASK)) 44 45#define TLB_DAR_SLOT_SHIFT (3) 46#define TLB_DAR_SLOT(slot) ((slot) << TLB_DAR_SLOT_SHIFT) 47 48#define TAR_VPN_SHIFT (13) 49#define TAR_CTX_MASK ((1 << TAR_VPN_SHIFT) - 1) 50 51#define TLB_TAR_VA(va) ((va) & ~TAR_CTX_MASK) 52#define TLB_TAR_CTX(ctx) ((ctx) & TAR_CTX_MASK) 53 54#define TLB_DEMAP_ID_SHIFT (4) 55#define TLB_DEMAP_ID_PRIMARY (0) 56#define TLB_DEMAP_ID_SECONDARY (1) 57#define TLB_DEMAP_ID_NUCLEUS (2) 58 59#define TLB_DEMAP_TYPE_SHIFT (6) 60#define TLB_DEMAP_TYPE_PAGE (0) 61#define TLB_DEMAP_TYPE_CONTEXT (1)
|
62/* US-III and greater only */ 63#define TLB_DEMAP_TYPE_ALL (2) |
64 65#define TLB_DEMAP_VA(va) ((va) & ~PAGE_MASK) 66#define TLB_DEMAP_ID(id) ((id) << TLB_DEMAP_ID_SHIFT) 67#define TLB_DEMAP_TYPE(type) ((type) << TLB_DEMAP_TYPE_SHIFT) 68 69#define TLB_DEMAP_PAGE (TLB_DEMAP_TYPE(TLB_DEMAP_TYPE_PAGE)) 70#define TLB_DEMAP_CONTEXT (TLB_DEMAP_TYPE(TLB_DEMAP_TYPE_CONTEXT))
|
71#define TLB_DEMAP_ALL (TLB_DEMAP_TYPE(TLB_DEMAP_TYPE_ALL)) |
72 73#define TLB_DEMAP_PRIMARY (TLB_DEMAP_ID(TLB_DEMAP_ID_PRIMARY)) 74#define TLB_DEMAP_SECONDARY (TLB_DEMAP_ID(TLB_DEMAP_ID_SECONDARY)) 75#define TLB_DEMAP_NUCLEUS (TLB_DEMAP_ID(TLB_DEMAP_ID_NUCLEUS)) 76 77#define TLB_CTX_KERNEL (0) 78#define TLB_CTX_USER_MIN (1) 79#define TLB_CTX_USER_MAX (8192) 80 81#define MMU_SFSR_ASI_SHIFT (16) 82#define MMU_SFSR_FT_SHIFT (7) 83#define MMU_SFSR_E_SHIFT (6) 84#define MMU_SFSR_CT_SHIFT (4) 85#define MMU_SFSR_PR_SHIFT (3) 86#define MMU_SFSR_W_SHIFT (2) 87#define MMU_SFSR_OW_SHIFT (1) 88#define MMU_SFSR_FV_SHIFT (0) 89 90#define MMU_SFSR_ASI_SIZE (8) 91#define MMU_SFSR_FT_SIZE (6) 92#define MMU_SFSR_CT_SIZE (2) 93 94#define MMU_SFSR_GET_ASI(sfsr) \ 95 (((sfsr) >> MMU_SFSR_ASI_SHIFT) & ((1UL << MMU_SFSR_ASI_SIZE) - 1)) 96#define MMU_SFSR_W (1UL << MMU_SFSR_W_SHIFT) 97#define MMU_SFSR_FV (1UL << MMU_SFSR_FV_SHIFT) 98
|
99typedef void tlb_flush_nonlocked_t(void); |
100typedef void tlb_flush_user_t(void); 101 102struct pmap; 103struct tlb_entry; 104 105extern int kernel_tlb_slots; 106extern struct tlb_entry *kernel_tlbs; 107 108void tlb_context_demap(struct pmap *pm); 109void tlb_page_demap(struct pmap *pm, vm_offset_t va); 110void tlb_range_demap(struct pmap *pm, vm_offset_t start, vm_offset_t end); 111
|
112tlb_flush_nonlocked_t cheetah_tlb_flush_nonlocked; |
113tlb_flush_user_t cheetah_tlb_flush_user;
|
114 115tlb_flush_nonlocked_t spitfire_tlb_flush_nonlocked; |
116tlb_flush_user_t spitfire_tlb_flush_user; 117
|
118extern tlb_flush_nonlocked_t *tlb_flush_nonlocked; |
119extern tlb_flush_user_t *tlb_flush_user; 120 121#endif /* !_MACHINE_TLB_H_ */
|