xref: /titanic_51/usr/src/uts/sun4v/sys/cpu_module.h (revision fa9e4066f08beec538e775443c5be79dd423fcab)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 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 #pragma weak mmu_init_mmu_page_sizes
68 int	mmu_init_mmu_page_sizes(int cinfo);
69 
70 /*
71  * virtual demap flushes (tlbs & virtual tag caches)
72  */
73 void	vtag_flushpage(caddr_t addr, uint_t ctx);
74 void	vtag_flushctx(uint_t ctx);
75 void	vtag_flushall(void);
76 void	vtag_flushpage_tl1(uint64_t addr, uint64_t ctx);
77 void	vtag_flush_pgcnt_tl1(uint64_t addr, uint64_t ctx_pgcnt);
78 void	vtag_flushctx_tl1(uint64_t ctx, uint64_t dummy);
79 void	vtag_flushall_tl1(uint64_t dummy1, uint64_t dummy2);
80 void	vtag_unmap_perm_tl1(uint64_t addr, uint64_t ctx);
81 
82 /*
83  * virtual alias flushes (virtual address caches)
84  */
85 void	vac_flushpage(pfn_t pf, int color);
86 void	vac_flushpage_tl1(uint64_t pf, uint64_t color);
87 void	vac_flushcolor(int color, pfn_t pf);
88 void	vac_flushcolor_tl1(uint64_t color, uint64_t dummy);
89 
90 /*
91  * Calculate, set optimal dtlb pagesize, for ISM and mpss, to support
92  * cpus with non-fully-associative dtlbs.
93  */
94 extern uchar_t *ctx_pgsz_array;
95 
96 /*
97  * flush instruction cache if needed
98  */
99 void	flush_instr_mem(caddr_t addr, size_t len);
100 
101 /*
102  * Cpu-specific error and ecache handling routines
103  */
104 #pragma weak itlb_parity_trap
105 void itlb_parity_trap(void);
106 
107 #pragma weak dtlb_parity_trap
108 void dtlb_parity_trap(void);
109 
110 /*
111  * this symbol appears as a second label for vtag_flushall
112  * only for cpus that implement DEMAP_ALL_TYPE
113  */
114 #pragma	weak demap_all
115 
116 /*
117  * change cpu speed
118  */
119 void	cpu_change_speed(uint64_t divisor, uint64_t arg2);
120 
121 /*
122  * flush routine
123  */
124 #pragma weak dtrace_flush_sec
125 void	dtrace_flush_sec(uintptr_t);
126 
127 /*
128  * Cpu private initialize/uninitialize, including ecache scrubber.
129  */
130 void	cpu_init_private(struct cpu *);
131 void	cpu_uninit_private(struct cpu *);
132 
133 #pragma weak cpu_mp_init
134 void    cpu_mp_init(void);
135 
136 #pragma weak cpu_feature_init
137 void    cpu_feature_init(void);
138 
139 #pragma weak cpu_error_init
140 void	cpu_error_init(int);
141 
142 extern int kzero(void *addr, size_t count);
143 extern void uzero(void *addr, size_t count);
144 extern void bzero(void *addr, size_t count);
145 
146 #endif /* _KERNEL */
147 
148 #ifdef	__cplusplus
149 }
150 #endif
151 
152 #endif /* _SYS_CPU_MODULE_H */
153