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 */ 214203Srsmaeda 220Sstevel@tonic-gate /* 23*5834Spt157919 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef _SYS_CPU_MODULE_H 280Sstevel@tonic-gate #define _SYS_CPU_MODULE_H 290Sstevel@tonic-gate 300Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 310Sstevel@tonic-gate 320Sstevel@tonic-gate #include <sys/pte.h> 330Sstevel@tonic-gate #include <sys/async.h> 340Sstevel@tonic-gate #include <sys/x_call.h> 350Sstevel@tonic-gate #include <sys/conf.h> 360Sstevel@tonic-gate #include <sys/obpdefs.h> 375000Sjc25722 #include <sys/mdesc.h> 380Sstevel@tonic-gate 390Sstevel@tonic-gate #ifdef __cplusplus 400Sstevel@tonic-gate extern "C" { 410Sstevel@tonic-gate #endif 420Sstevel@tonic-gate 430Sstevel@tonic-gate 440Sstevel@tonic-gate #ifdef _KERNEL 450Sstevel@tonic-gate 460Sstevel@tonic-gate /* 470Sstevel@tonic-gate * The are functions that are expected of the cpu modules. 480Sstevel@tonic-gate */ 490Sstevel@tonic-gate 500Sstevel@tonic-gate extern struct module_ops *moduleops; 510Sstevel@tonic-gate 520Sstevel@tonic-gate struct kdi; 530Sstevel@tonic-gate 540Sstevel@tonic-gate /* 550Sstevel@tonic-gate * module initialization 560Sstevel@tonic-gate */ 570Sstevel@tonic-gate void cpu_setup(void); 580Sstevel@tonic-gate 590Sstevel@tonic-gate /* 600Sstevel@tonic-gate * set CPU implementation details 610Sstevel@tonic-gate * 620Sstevel@tonic-gate * mmu_init_mmu_page_sizes changes the mmu_page_sizes variable from 630Sstevel@tonic-gate * The default 4 page sizes to 6 page sizes for Panther-only domains, 640Sstevel@tonic-gate * and is called from fillsysinfo.c:check_cpus_set at early bootup time. 650Sstevel@tonic-gate */ 660Sstevel@tonic-gate struct cpu_node; 670Sstevel@tonic-gate void cpu_fiximp(struct cpu_node *cpunode); 684203Srsmaeda void cpu_map_exec_units(struct cpu *cp); 690Sstevel@tonic-gate #pragma weak mmu_init_mmu_page_sizes 700Sstevel@tonic-gate int mmu_init_mmu_page_sizes(int cinfo); 710Sstevel@tonic-gate 720Sstevel@tonic-gate /* 730Sstevel@tonic-gate * virtual demap flushes (tlbs & virtual tag caches) 740Sstevel@tonic-gate */ 752241Shuah void vtag_flushpage(caddr_t addr, uint64_t sfmmup); 760Sstevel@tonic-gate void vtag_flushall(void); 772241Shuah #pragma weak vtag_flushall_uctxs 782241Shuah void vtag_flushall_uctxs(void); 792241Shuah void vtag_flushpage_tl1(uint64_t addr, uint64_t sfmmup); 802241Shuah void vtag_flush_pgcnt_tl1(uint64_t addr, uint64_t sfmmup_pgcnt); 810Sstevel@tonic-gate void vtag_flushall_tl1(uint64_t dummy1, uint64_t dummy2); 820Sstevel@tonic-gate void vtag_unmap_perm_tl1(uint64_t addr, uint64_t ctx); 830Sstevel@tonic-gate 840Sstevel@tonic-gate /* 852296Sae112802 * Calculate, set optimal dtlb pagesize, for ISM and mpss, to support 862296Sae112802 * cpus with non-fully-associative dtlbs. 870Sstevel@tonic-gate */ 882296Sae112802 extern uchar_t *ctx_pgsz_array; 890Sstevel@tonic-gate 900Sstevel@tonic-gate /* 910Sstevel@tonic-gate * flush instruction cache if needed 920Sstevel@tonic-gate */ 930Sstevel@tonic-gate void flush_instr_mem(caddr_t addr, size_t len); 940Sstevel@tonic-gate 950Sstevel@tonic-gate /* 960Sstevel@tonic-gate * Cpu-specific error and ecache handling routines 970Sstevel@tonic-gate */ 980Sstevel@tonic-gate #pragma weak itlb_parity_trap 990Sstevel@tonic-gate void itlb_parity_trap(void); 1000Sstevel@tonic-gate 1010Sstevel@tonic-gate #pragma weak dtlb_parity_trap 1020Sstevel@tonic-gate void dtlb_parity_trap(void); 1030Sstevel@tonic-gate 1040Sstevel@tonic-gate /* 1050Sstevel@tonic-gate * this symbol appears as a second label for vtag_flushall 1060Sstevel@tonic-gate * only for cpus that implement DEMAP_ALL_TYPE 1070Sstevel@tonic-gate */ 1080Sstevel@tonic-gate #pragma weak demap_all 1090Sstevel@tonic-gate 1100Sstevel@tonic-gate /* 1110Sstevel@tonic-gate * change cpu speed 1120Sstevel@tonic-gate */ 1130Sstevel@tonic-gate void cpu_change_speed(uint64_t divisor, uint64_t arg2); 1140Sstevel@tonic-gate 1150Sstevel@tonic-gate /* 1160Sstevel@tonic-gate * flush routine 1170Sstevel@tonic-gate */ 1180Sstevel@tonic-gate #pragma weak dtrace_flush_sec 1190Sstevel@tonic-gate void dtrace_flush_sec(uintptr_t); 1200Sstevel@tonic-gate 1210Sstevel@tonic-gate /* 1220Sstevel@tonic-gate * Cpu private initialize/uninitialize, including ecache scrubber. 1230Sstevel@tonic-gate */ 1240Sstevel@tonic-gate void cpu_init_private(struct cpu *); 1250Sstevel@tonic-gate void cpu_uninit_private(struct cpu *); 1260Sstevel@tonic-gate 1270Sstevel@tonic-gate #pragma weak cpu_mp_init 1280Sstevel@tonic-gate void cpu_mp_init(void); 1290Sstevel@tonic-gate 1300Sstevel@tonic-gate #pragma weak cpu_feature_init 1310Sstevel@tonic-gate void cpu_feature_init(void); 1320Sstevel@tonic-gate 1330Sstevel@tonic-gate #pragma weak cpu_error_init 1340Sstevel@tonic-gate void cpu_error_init(int); 1350Sstevel@tonic-gate 1360Sstevel@tonic-gate extern int kzero(void *addr, size_t count); 1370Sstevel@tonic-gate extern void uzero(void *addr, size_t count); 1380Sstevel@tonic-gate extern void bzero(void *addr, size_t count); 1390Sstevel@tonic-gate 1401050Sgirish /* 1411050Sgirish * trapstat interface and cpu_trapstat_conf commands 1421050Sgirish */ 1431050Sgirish #define CPU_TSTATCONF_INIT 1 1441050Sgirish #define CPU_TSTATCONF_FINI 2 1451050Sgirish #define CPU_TSTATCONF_ENABLE 3 1461050Sgirish #define CPU_TSTATCONF_DISABLE 4 1471050Sgirish 1481050Sgirish int cpu_trapstat_conf(int cmd); 1491050Sgirish void cpu_trapstat_data(void *buf, uint_t pgszs); 1504769Sdp78419 /* Used by the fill_cpu() function */ 1514732Sdavemq #define NO_MAPPING_FOUND 0xffffffff 1524732Sdavemq #define NO_EU_MAPPING_FOUND NO_MAPPING_FOUND 1534732Sdavemq #define NO_CHIP_MAPPING_FOUND NO_MAPPING_FOUND 1544732Sdavemq #define NO_CORE_MAPPING_FOUND NO_MAPPING_FOUND 1554769Sdp78419 #define NO_L2_CACHE_MAPPING_FOUND NO_MAPPING_FOUND 1561991Sheppo /* 1571991Sheppo * Default MMU pagesize mask for sun4v architecture. 1581991Sheppo */ 1591991Sheppo #define DEFAULT_SUN4V_MMU_PAGESIZE_MASK ((1 << TTE8K) | (1 << TTE64K) \ 1601991Sheppo | (1 << TTE4M)) 1611991Sheppo 1621991Sheppo void cpu_setup_common(char **); 163*5834Spt157919 int l2_cache_node_count(void); 164*5834Spt157919 1655000Sjc25722 void fill_cpu(md_t *, mde_cookie_t); 1665000Sjc25722 int setup_cpu_common(int); 1675000Sjc25722 int cleanup_cpu_common(int); 1685000Sjc25722 void setup_exec_unit_mappings(md_t *); 1695000Sjc25722 void setup_chip_mappings(md_t *); 1701991Sheppo 1711991Sheppo boolean_t broken_md_flag; 1721991Sheppo int va_bits; 1731991Sheppo 1740Sstevel@tonic-gate #endif /* _KERNEL */ 1750Sstevel@tonic-gate 1760Sstevel@tonic-gate #ifdef __cplusplus 1770Sstevel@tonic-gate } 1780Sstevel@tonic-gate #endif 1790Sstevel@tonic-gate 1800Sstevel@tonic-gate #endif /* _SYS_CPU_MODULE_H */ 181