xref: /illumos-gate/usr/src/uts/sun4v/sys/cpu_module.h (revision cbab2b2687744cbfdc12fae90f8088127a0b266c)
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, uint64_t sfmmup);
73 void	vtag_flushall(void);
74 #pragma weak vtag_flushall_uctxs
75 void    vtag_flushall_uctxs(void);
76 void	vtag_flushpage_tl1(uint64_t addr,  uint64_t sfmmup);
77 void	vtag_flush_pgcnt_tl1(uint64_t addr, uint64_t sfmmup_pgcnt);
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  * flush instruction cache if needed
91  */
92 void	flush_instr_mem(caddr_t addr, size_t len);
93 
94 /*
95  * Cpu-specific error and ecache handling routines
96  */
97 #pragma weak itlb_parity_trap
98 void itlb_parity_trap(void);
99 
100 #pragma weak dtlb_parity_trap
101 void dtlb_parity_trap(void);
102 
103 /*
104  * this symbol appears as a second label for vtag_flushall
105  * only for cpus that implement DEMAP_ALL_TYPE
106  */
107 #pragma	weak demap_all
108 
109 /*
110  * change cpu speed
111  */
112 void	cpu_change_speed(uint64_t divisor, uint64_t arg2);
113 
114 /*
115  * flush routine
116  */
117 #pragma weak dtrace_flush_sec
118 void	dtrace_flush_sec(uintptr_t);
119 
120 /*
121  * Cpu private initialize/uninitialize, including ecache scrubber.
122  */
123 void	cpu_init_private(struct cpu *);
124 void	cpu_uninit_private(struct cpu *);
125 
126 #pragma weak cpu_mp_init
127 void    cpu_mp_init(void);
128 
129 #pragma weak cpu_feature_init
130 void    cpu_feature_init(void);
131 
132 #pragma weak cpu_error_init
133 void	cpu_error_init(int);
134 
135 extern int kzero(void *addr, size_t count);
136 extern void uzero(void *addr, size_t count);
137 extern void bzero(void *addr, size_t count);
138 
139 /*
140  * trapstat interface and cpu_trapstat_conf commands
141  */
142 #define	CPU_TSTATCONF_INIT	1
143 #define	CPU_TSTATCONF_FINI	2
144 #define	CPU_TSTATCONF_ENABLE	3
145 #define	CPU_TSTATCONF_DISABLE	4
146 
147 int	cpu_trapstat_conf(int cmd);
148 void	cpu_trapstat_data(void *buf, uint_t pgszs);
149 
150 #define	NO_EU_MAPPING_FOUND		0xffffffff
151 /*
152  * Default MMU pagesize mask for sun4v architecture.
153  */
154 #define	DEFAULT_SUN4V_MMU_PAGESIZE_MASK	((1 << TTE8K) | (1 << TTE64K) \
155 					    | (1 << TTE4M))
156 
157 void	cpu_setup_common(char **);
158 
159 boolean_t	broken_md_flag;
160 int	va_bits;
161 
162 #endif /* _KERNEL */
163 
164 #ifdef	__cplusplus
165 }
166 #endif
167 
168 #endif /* _SYS_CPU_MODULE_H */
169