xref: /titanic_44/usr/src/uts/sun4v/sys/cpu_module.h (revision 0dc2366f7b9f9f36e10909b1e95edbf2a261c2ac)
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 2008 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 #include <sys/mdesc.h>
38 
39 #ifdef	__cplusplus
40 extern "C" {
41 #endif
42 
43 
44 #ifdef _KERNEL
45 
46 /*
47  * The are functions that are expected of the cpu modules.
48  */
49 
50 extern struct module_ops *moduleops;
51 
52 struct kdi;
53 
54 /*
55  * module initialization
56  */
57 void	cpu_setup(void);
58 
59 /*
60  * set CPU implementation details
61  *
62  * mmu_init_mmu_page_sizes changes the mmu_page_sizes variable from
63  *	The default 4 page sizes to 6 page sizes for Panther-only domains,
64  *	and is called from fillsysinfo.c:check_cpus_set at early bootup time.
65  */
66 struct cpu_node;
67 void	cpu_fiximp(struct cpu_node *cpunode);
68 void	cpu_map_exec_units(struct cpu *cp);
69 #pragma weak mmu_init_mmu_page_sizes
70 int	mmu_init_mmu_page_sizes(int cinfo);
71 
72 /*
73  * virtual demap flushes (tlbs & virtual tag caches)
74  */
75 void	vtag_flushpage(caddr_t addr, uint64_t sfmmup);
76 void	vtag_flushall(void);
77 #pragma weak vtag_flushall_uctxs
78 void    vtag_flushall_uctxs(void);
79 void	vtag_flushpage_tl1(uint64_t addr,  uint64_t sfmmup);
80 void	vtag_flush_pgcnt_tl1(uint64_t addr, uint64_t sfmmup_pgcnt);
81 void	vtag_flushall_tl1(uint64_t dummy1, uint64_t dummy2);
82 void	vtag_unmap_perm_tl1(uint64_t addr, uint64_t ctx);
83 
84 /*
85  * Calculate, set optimal dtlb pagesize, for ISM and mpss, to support
86  * cpus with non-fully-associative dtlbs.
87  */
88 extern uchar_t *ctx_pgsz_array;
89 
90 /*
91  * flush instruction cache if needed
92  */
93 void	flush_instr_mem(caddr_t addr, size_t len);
94 
95 /*
96  * Cpu-specific error and ecache handling routines
97  */
98 #pragma weak itlb_parity_trap
99 void itlb_parity_trap(void);
100 
101 #pragma weak dtlb_parity_trap
102 void dtlb_parity_trap(void);
103 
104 /*
105  * this symbol appears as a second label for vtag_flushall
106  * only for cpus that implement DEMAP_ALL_TYPE
107  */
108 #pragma	weak demap_all
109 
110 /*
111  * change cpu speed
112  */
113 void	cpu_change_speed(uint64_t divisor, uint64_t arg2);
114 
115 /*
116  * flush routine
117  */
118 #pragma weak dtrace_flush_sec
119 void	dtrace_flush_sec(uintptr_t);
120 
121 /*
122  * Cpu private initialize/uninitialize, including ecache scrubber.
123  */
124 void	cpu_init_private(struct cpu *);
125 void	cpu_uninit_private(struct cpu *);
126 
127 #pragma weak cpu_mp_init
128 void    cpu_mp_init(void);
129 
130 #pragma weak cpu_feature_init
131 void    cpu_feature_init(void);
132 
133 #pragma weak cpu_error_init
134 void	cpu_error_init(int);
135 
136 extern int kzero(void *addr, size_t count);
137 extern void uzero(void *addr, size_t count);
138 extern void bzero(void *addr, size_t count);
139 
140 /*
141  * trapstat interface and cpu_trapstat_conf commands
142  */
143 #define	CPU_TSTATCONF_INIT	1
144 #define	CPU_TSTATCONF_FINI	2
145 #define	CPU_TSTATCONF_ENABLE	3
146 #define	CPU_TSTATCONF_DISABLE	4
147 
148 int	cpu_trapstat_conf(int cmd);
149 void	cpu_trapstat_data(void *buf, uint_t pgszs);
150 /* Used  by the fill_cpu() function */
151 #define	NO_MAPPING_FOUND		0xffffffff
152 #define	NO_EU_MAPPING_FOUND		NO_MAPPING_FOUND
153 #define	NO_CHIP_MAPPING_FOUND		NO_MAPPING_FOUND
154 #define	NO_CORE_MAPPING_FOUND		NO_MAPPING_FOUND
155 #define	NO_L2_CACHE_MAPPING_FOUND	NO_MAPPING_FOUND
156 /*
157  * Default MMU pagesize mask for sun4v architecture.
158  */
159 #define	DEFAULT_SUN4V_MMU_PAGESIZE_MASK	((1 << TTE8K) | (1 << TTE64K) \
160 					    | (1 << TTE4M))
161 
162 void	cpu_setup_common(char **);
163 int	l2_cache_node_count(void);
164 
165 void	fill_cpu(md_t *, mde_cookie_t);
166 int	setup_cpu_common(int);
167 int	cleanup_cpu_common(int);
168 void	setup_exec_unit_mappings(md_t *);
169 void	setup_chip_mappings(md_t *);
170 
171 boolean_t	broken_md_flag;
172 int	va_bits;
173 
174 #endif /* _KERNEL */
175 
176 #ifdef	__cplusplus
177 }
178 #endif
179 
180 #endif /* _SYS_CPU_MODULE_H */
181