xref: /onnv-gate/usr/src/uts/sun4v/sys/cpu_module.h (revision 2241:592fbc504a44)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
51991Sheppo  * Common Development and Distribution License (the "License").
61991Sheppo  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
221991Sheppo  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef _SYS_CPU_MODULE_H
270Sstevel@tonic-gate #define	_SYS_CPU_MODULE_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #include <sys/pte.h>
320Sstevel@tonic-gate #include <sys/async.h>
330Sstevel@tonic-gate #include <sys/x_call.h>
340Sstevel@tonic-gate #include <sys/conf.h>
350Sstevel@tonic-gate #include <sys/obpdefs.h>
360Sstevel@tonic-gate 
370Sstevel@tonic-gate #ifdef	__cplusplus
380Sstevel@tonic-gate extern "C" {
390Sstevel@tonic-gate #endif
400Sstevel@tonic-gate 
410Sstevel@tonic-gate 
420Sstevel@tonic-gate #ifdef _KERNEL
430Sstevel@tonic-gate 
440Sstevel@tonic-gate /*
450Sstevel@tonic-gate  * The are functions that are expected of the cpu modules.
460Sstevel@tonic-gate  */
470Sstevel@tonic-gate 
480Sstevel@tonic-gate extern struct module_ops *moduleops;
490Sstevel@tonic-gate 
500Sstevel@tonic-gate struct kdi;
510Sstevel@tonic-gate 
520Sstevel@tonic-gate /*
530Sstevel@tonic-gate  * module initialization
540Sstevel@tonic-gate  */
550Sstevel@tonic-gate void	cpu_setup(void);
560Sstevel@tonic-gate 
570Sstevel@tonic-gate /*
580Sstevel@tonic-gate  * set CPU implementation details
590Sstevel@tonic-gate  *
600Sstevel@tonic-gate  * mmu_init_mmu_page_sizes changes the mmu_page_sizes variable from
610Sstevel@tonic-gate  *	The default 4 page sizes to 6 page sizes for Panther-only domains,
620Sstevel@tonic-gate  *	and is called from fillsysinfo.c:check_cpus_set at early bootup time.
630Sstevel@tonic-gate  */
640Sstevel@tonic-gate struct cpu_node;
650Sstevel@tonic-gate void	cpu_fiximp(struct cpu_node *cpunode);
660Sstevel@tonic-gate #pragma weak mmu_init_mmu_page_sizes
670Sstevel@tonic-gate int	mmu_init_mmu_page_sizes(int cinfo);
680Sstevel@tonic-gate 
690Sstevel@tonic-gate /*
700Sstevel@tonic-gate  * virtual demap flushes (tlbs & virtual tag caches)
710Sstevel@tonic-gate  */
72*2241Shuah void	vtag_flushpage(caddr_t addr, uint64_t sfmmup);
730Sstevel@tonic-gate void	vtag_flushall(void);
74*2241Shuah #pragma weak vtag_flushall_uctxs
75*2241Shuah void    vtag_flushall_uctxs(void);
76*2241Shuah void	vtag_flushpage_tl1(uint64_t addr,  uint64_t sfmmup);
77*2241Shuah void	vtag_flush_pgcnt_tl1(uint64_t addr, uint64_t sfmmup_pgcnt);
780Sstevel@tonic-gate void	vtag_flushall_tl1(uint64_t dummy1, uint64_t dummy2);
790Sstevel@tonic-gate void	vtag_unmap_perm_tl1(uint64_t addr, uint64_t ctx);
800Sstevel@tonic-gate 
810Sstevel@tonic-gate /*
820Sstevel@tonic-gate  * virtual alias flushes (virtual address caches)
830Sstevel@tonic-gate  */
840Sstevel@tonic-gate void	vac_flushpage(pfn_t pf, int color);
850Sstevel@tonic-gate void	vac_flushpage_tl1(uint64_t pf, uint64_t color);
860Sstevel@tonic-gate void	vac_flushcolor(int color, pfn_t pf);
870Sstevel@tonic-gate void	vac_flushcolor_tl1(uint64_t color, uint64_t dummy);
880Sstevel@tonic-gate 
890Sstevel@tonic-gate /*
900Sstevel@tonic-gate  * flush instruction cache if needed
910Sstevel@tonic-gate  */
920Sstevel@tonic-gate void	flush_instr_mem(caddr_t addr, size_t len);
930Sstevel@tonic-gate 
940Sstevel@tonic-gate /*
950Sstevel@tonic-gate  * Cpu-specific error and ecache handling routines
960Sstevel@tonic-gate  */
970Sstevel@tonic-gate #pragma weak itlb_parity_trap
980Sstevel@tonic-gate void itlb_parity_trap(void);
990Sstevel@tonic-gate 
1000Sstevel@tonic-gate #pragma weak dtlb_parity_trap
1010Sstevel@tonic-gate void dtlb_parity_trap(void);
1020Sstevel@tonic-gate 
1030Sstevel@tonic-gate /*
1040Sstevel@tonic-gate  * this symbol appears as a second label for vtag_flushall
1050Sstevel@tonic-gate  * only for cpus that implement DEMAP_ALL_TYPE
1060Sstevel@tonic-gate  */
1070Sstevel@tonic-gate #pragma	weak demap_all
1080Sstevel@tonic-gate 
1090Sstevel@tonic-gate /*
1100Sstevel@tonic-gate  * change cpu speed
1110Sstevel@tonic-gate  */
1120Sstevel@tonic-gate void	cpu_change_speed(uint64_t divisor, uint64_t arg2);
1130Sstevel@tonic-gate 
1140Sstevel@tonic-gate /*
1150Sstevel@tonic-gate  * flush routine
1160Sstevel@tonic-gate  */
1170Sstevel@tonic-gate #pragma weak dtrace_flush_sec
1180Sstevel@tonic-gate void	dtrace_flush_sec(uintptr_t);
1190Sstevel@tonic-gate 
1200Sstevel@tonic-gate /*
1210Sstevel@tonic-gate  * Cpu private initialize/uninitialize, including ecache scrubber.
1220Sstevel@tonic-gate  */
1230Sstevel@tonic-gate void	cpu_init_private(struct cpu *);
1240Sstevel@tonic-gate void	cpu_uninit_private(struct cpu *);
1250Sstevel@tonic-gate 
1260Sstevel@tonic-gate #pragma weak cpu_mp_init
1270Sstevel@tonic-gate void    cpu_mp_init(void);
1280Sstevel@tonic-gate 
1290Sstevel@tonic-gate #pragma weak cpu_feature_init
1300Sstevel@tonic-gate void    cpu_feature_init(void);
1310Sstevel@tonic-gate 
1320Sstevel@tonic-gate #pragma weak cpu_error_init
1330Sstevel@tonic-gate void	cpu_error_init(int);
1340Sstevel@tonic-gate 
1350Sstevel@tonic-gate extern int kzero(void *addr, size_t count);
1360Sstevel@tonic-gate extern void uzero(void *addr, size_t count);
1370Sstevel@tonic-gate extern void bzero(void *addr, size_t count);
1380Sstevel@tonic-gate 
1391050Sgirish /*
1401050Sgirish  * trapstat interface and cpu_trapstat_conf commands
1411050Sgirish  */
1421050Sgirish #define	CPU_TSTATCONF_INIT	1
1431050Sgirish #define	CPU_TSTATCONF_FINI	2
1441050Sgirish #define	CPU_TSTATCONF_ENABLE	3
1451050Sgirish #define	CPU_TSTATCONF_DISABLE	4
1461050Sgirish 
1471050Sgirish int	cpu_trapstat_conf(int cmd);
1481050Sgirish void	cpu_trapstat_data(void *buf, uint_t pgszs);
1491050Sgirish 
1501991Sheppo #define	NO_EU_MAPPING_FOUND		0xffffffff
1511991Sheppo /*
1521991Sheppo  * Default MMU pagesize mask for sun4v architecture.
1531991Sheppo  */
1541991Sheppo #define	DEFAULT_SUN4V_MMU_PAGESIZE_MASK	((1 << TTE8K) | (1 << TTE64K) \
1551991Sheppo 					    | (1 << TTE4M))
1561991Sheppo 
1571991Sheppo void	cpu_setup_common(char **);
1581991Sheppo 
1591991Sheppo boolean_t	broken_md_flag;
1601991Sheppo int	va_bits;
1611991Sheppo 
1620Sstevel@tonic-gate #endif /* _KERNEL */
1630Sstevel@tonic-gate 
1640Sstevel@tonic-gate #ifdef	__cplusplus
1650Sstevel@tonic-gate }
1660Sstevel@tonic-gate #endif
1670Sstevel@tonic-gate 
1680Sstevel@tonic-gate #endif /* _SYS_CPU_MODULE_H */
169