xref: /titanic_44/usr/src/uts/sun4v/sys/cpu_module.h (revision 4b22b9337f359bfd063322244f5336cc7c6ffcfa)
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 /*
23  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_CPU_MODULE_H
28 #define	_SYS_CPU_MODULE_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/pte.h>
33 #include <sys/async.h>
34 #include <sys/x_call.h>
35 #include <sys/conf.h>
36 #include <sys/obpdefs.h>
37 
38 #ifdef	__cplusplus
39 extern "C" {
40 #endif
41 
42 
43 #ifdef _KERNEL
44 
45 /*
46  * The are functions that are expected of the cpu modules.
47  */
48 
49 extern struct module_ops *moduleops;
50 
51 struct kdi;
52 
53 /*
54  * module initialization
55  */
56 void	cpu_setup(void);
57 
58 /*
59  * set CPU implementation details
60  *
61  * mmu_init_mmu_page_sizes changes the mmu_page_sizes variable from
62  *	The default 4 page sizes to 6 page sizes for Panther-only domains,
63  *	and is called from fillsysinfo.c:check_cpus_set at early bootup time.
64  */
65 struct cpu_node;
66 void	cpu_fiximp(struct cpu_node *cpunode);
67 void	cpu_map_exec_units(struct cpu *cp);
68 #pragma weak mmu_init_mmu_page_sizes
69 int	mmu_init_mmu_page_sizes(int cinfo);
70 
71 /*
72  * virtual demap flushes (tlbs & virtual tag caches)
73  */
74 void	vtag_flushpage(caddr_t addr, uint64_t sfmmup);
75 void	vtag_flushall(void);
76 #pragma weak vtag_flushall_uctxs
77 void    vtag_flushall_uctxs(void);
78 void	vtag_flushpage_tl1(uint64_t addr,  uint64_t sfmmup);
79 void	vtag_flush_pgcnt_tl1(uint64_t addr, uint64_t sfmmup_pgcnt);
80 void	vtag_flushall_tl1(uint64_t dummy1, uint64_t dummy2);
81 void	vtag_unmap_perm_tl1(uint64_t addr, uint64_t ctx);
82 
83 /*
84  * Calculate, set optimal dtlb pagesize, for ISM and mpss, to support
85  * cpus with non-fully-associative dtlbs.
86  */
87 extern uchar_t *ctx_pgsz_array;
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 /* Used  by the fill_cpu() function */
150 #define	NO_MAPPING_FOUND		0xffffffff
151 #define	NO_EU_MAPPING_FOUND		NO_MAPPING_FOUND
152 #define	NO_CHIP_MAPPING_FOUND		NO_MAPPING_FOUND
153 #define	NO_CORE_MAPPING_FOUND		NO_MAPPING_FOUND
154 #define	NO_L2_CACHE_MAPPING_FOUND	NO_MAPPING_FOUND
155 /*
156  * Default MMU pagesize mask for sun4v architecture.
157  */
158 #define	DEFAULT_SUN4V_MMU_PAGESIZE_MASK	((1 << TTE8K) | (1 << TTE64K) \
159 					    | (1 << TTE4M))
160 
161 void	cpu_setup_common(char **);
162 
163 boolean_t	broken_md_flag;
164 int	va_bits;
165 
166 #endif /* _KERNEL */
167 
168 #ifdef	__cplusplus
169 }
170 #endif
171 
172 #endif /* _SYS_CPU_MODULE_H */
173