1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _SYS_CPU_MODULE_H 27 #define _SYS_CPU_MODULE_H 28 29 #pragma ident "%Z%%M% %I% %E% SMI" 30 31 #include <sys/pte.h> 32 #include <sys/async.h> 33 #include <sys/x_call.h> 34 #include <sys/conf.h> 35 #include <sys/obpdefs.h> 36 37 #ifdef __cplusplus 38 extern "C" { 39 #endif 40 41 42 #ifdef _KERNEL 43 44 /* 45 * The are functions that are expected of the cpu modules. 46 */ 47 48 extern struct module_ops *moduleops; 49 50 struct kdi; 51 52 /* 53 * module initialization 54 */ 55 void cpu_setup(void); 56 57 /* 58 * set CPU implementation details 59 * 60 * mmu_init_mmu_page_sizes changes the mmu_page_sizes variable from 61 * The default 4 page sizes to 6 page sizes for Panther-only domains, 62 * and is called from fillsysinfo.c:check_cpus_set at early bootup time. 63 */ 64 struct cpu_node; 65 void cpu_fiximp(struct cpu_node *cpunode); 66 #pragma weak mmu_init_mmu_page_sizes 67 int mmu_init_mmu_page_sizes(int cinfo); 68 69 /* 70 * virtual demap flushes (tlbs & virtual tag caches) 71 */ 72 void vtag_flushpage(caddr_t addr, uint_t ctx); 73 void vtag_flushctx(uint_t ctx); 74 void vtag_flushall(void); 75 void vtag_flushpage_tl1(uint64_t addr, uint64_t ctx); 76 void vtag_flush_pgcnt_tl1(uint64_t addr, uint64_t ctx_pgcnt); 77 void vtag_flushctx_tl1(uint64_t ctx, uint64_t dummy); 78 void vtag_flushall_tl1(uint64_t dummy1, uint64_t dummy2); 79 void vtag_unmap_perm_tl1(uint64_t addr, uint64_t ctx); 80 81 /* 82 * virtual alias flushes (virtual address caches) 83 */ 84 void vac_flushpage(pfn_t pf, int color); 85 void vac_flushpage_tl1(uint64_t pf, uint64_t color); 86 void vac_flushcolor(int color, pfn_t pf); 87 void vac_flushcolor_tl1(uint64_t color, uint64_t dummy); 88 89 /* 90 * Calculate, set optimal dtlb pagesize, for ISM and mpss, to support 91 * cpus with non-fully-associative dtlbs. 92 */ 93 extern uchar_t *ctx_pgsz_array; 94 95 /* 96 * flush instruction cache if needed 97 */ 98 void flush_instr_mem(caddr_t addr, size_t len); 99 100 /* 101 * Cpu-specific error and ecache handling routines 102 */ 103 #pragma weak itlb_parity_trap 104 void itlb_parity_trap(void); 105 106 #pragma weak dtlb_parity_trap 107 void dtlb_parity_trap(void); 108 109 /* 110 * this symbol appears as a second label for vtag_flushall 111 * only for cpus that implement DEMAP_ALL_TYPE 112 */ 113 #pragma weak demap_all 114 115 /* 116 * change cpu speed 117 */ 118 void cpu_change_speed(uint64_t divisor, uint64_t arg2); 119 120 /* 121 * flush routine 122 */ 123 #pragma weak dtrace_flush_sec 124 void dtrace_flush_sec(uintptr_t); 125 126 /* 127 * Cpu private initialize/uninitialize, including ecache scrubber. 128 */ 129 void cpu_init_private(struct cpu *); 130 void cpu_uninit_private(struct cpu *); 131 132 #pragma weak cpu_mp_init 133 void cpu_mp_init(void); 134 135 #pragma weak cpu_feature_init 136 void cpu_feature_init(void); 137 138 #pragma weak cpu_error_init 139 void cpu_error_init(int); 140 141 extern int kzero(void *addr, size_t count); 142 extern void uzero(void *addr, size_t count); 143 extern void bzero(void *addr, size_t count); 144 145 /* 146 * trapstat interface and cpu_trapstat_conf commands 147 */ 148 #define CPU_TSTATCONF_INIT 1 149 #define CPU_TSTATCONF_FINI 2 150 #define CPU_TSTATCONF_ENABLE 3 151 #define CPU_TSTATCONF_DISABLE 4 152 153 int cpu_trapstat_conf(int cmd); 154 void cpu_trapstat_data(void *buf, uint_t pgszs); 155 156 #define NO_EU_MAPPING_FOUND 0xffffffff 157 /* 158 * Default MMU pagesize mask for sun4v architecture. 159 */ 160 #define DEFAULT_SUN4V_MMU_PAGESIZE_MASK ((1 << TTE8K) | (1 << TTE64K) \ 161 | (1 << TTE4M)) 162 163 void cpu_setup_common(char **); 164 165 boolean_t broken_md_flag; 166 int va_bits; 167 168 #endif /* _KERNEL */ 169 170 #ifdef __cplusplus 171 } 172 #endif 173 174 #endif /* _SYS_CPU_MODULE_H */ 175