144961713Sgirish /* 244961713Sgirish * CDDL HEADER START 344961713Sgirish * 444961713Sgirish * The contents of this file are subject to the terms of the 544961713Sgirish * Common Development and Distribution License (the "License"). 644961713Sgirish * You may not use this file except in compliance with the License. 744961713Sgirish * 844961713Sgirish * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 944961713Sgirish * or http://www.opensolaris.org/os/licensing. 1044961713Sgirish * See the License for the specific language governing permissions 1144961713Sgirish * and limitations under the License. 1244961713Sgirish * 1344961713Sgirish * When distributing Covered Code, include this CDDL HEADER in each 1444961713Sgirish * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 1544961713Sgirish * If applicable, add the following below this CDDL HEADER, with the 1644961713Sgirish * fields enclosed by brackets "[]" replaced with your own identifying 1744961713Sgirish * information: Portions Copyright [yyyy] [name of copyright owner] 1844961713Sgirish * 1944961713Sgirish * CDDL HEADER END 2044961713Sgirish */ 2144961713Sgirish /* 228d4e547dSae112802 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 2344961713Sgirish * Use is subject to license terms. 2444961713Sgirish */ 2544961713Sgirish 2644961713Sgirish #ifndef _SYS_NIAGARA2REGS_H 2744961713Sgirish #define _SYS_NIAGARA2REGS_H 2844961713Sgirish 2944961713Sgirish #pragma ident "%Z%%M% %I% %E% SMI" 3044961713Sgirish 3144961713Sgirish #ifdef __cplusplus 3244961713Sgirish extern "C" { 3344961713Sgirish #endif 3444961713Sgirish 3544961713Sgirish #define MB(n) ((n) * 1024 * 1024) 3644961713Sgirish 3744961713Sgirish #define L2CACHE_SIZE MB(4) 3844961713Sgirish #define L2CACHE_LINESIZE 64 3944961713Sgirish #define L2CACHE_ASSOCIATIVITY 16 4044961713Sgirish 4144961713Sgirish #define NIAGARA2_HSVC_MAJOR 1 4244961713Sgirish #define NIAGARA2_HSVC_MINOR 0 4344961713Sgirish 4459ac0c16Sdavemq #define VFALLS_HSVC_MAJOR 1 4559ac0c16Sdavemq #define VFALLS_HSVC_MINOR 0 4659ac0c16Sdavemq 47aaa10e67Sha137994 #define NIAGARA2_PREALLOC_BASE MB(196) 48aaa10e67Sha137994 4944961713Sgirish /* PIC overflow range is -16 to -1 */ 5044961713Sgirish #define PIC_IN_OV_RANGE(x) (((uint32_t)x >= 0xfffffff0) ? 1 : 0) 5144961713Sgirish 5244961713Sgirish /* 5344961713Sgirish * Niagara2 SPARC Performance Instrumentation Counter 5444961713Sgirish */ 5544961713Sgirish #define PIC0_MASK (((uint64_t)1 << 32) - 1) /* pic0 in bits 31:0 */ 5644961713Sgirish #define PIC1_SHIFT 32 /* pic1 in bits 64:32 */ 5744961713Sgirish 5844961713Sgirish /* 5944961713Sgirish * Niagara2 SPARC Performance Control Register 6044961713Sgirish */ 618d4e547dSae112802 #define CPC_NIAGARA2_PCR_PRIV_SHIFT 0 628d4e547dSae112802 #define CPC_NIAGARA2_PCR_ST_SHIFT 1 638d4e547dSae112802 #define CPC_NIAGARA2_PCR_UT_SHIFT 2 648d4e547dSae112802 658d4e547dSae112802 #define CPC_NIAGARA2_PCR_HT_SHIFT 3 668d4e547dSae112802 #define CPC_NIAGARA2_PCR_HT (1ull << CPC_NIAGARA2_PCR_HT_SHIFT) 678d4e547dSae112802 6844961713Sgirish #define CPC_NIAGARA2_PCR_TOE0_SHIFT 4 6944961713Sgirish #define CPC_NIAGARA2_PCR_TOE1_SHIFT 5 708d4e547dSae112802 #define CPC_NIAGARA2_PCR_TOE0 (1ull << CPC_NIAGARA2_PCR_TOE0_SHIFT) 718d4e547dSae112802 #define CPC_NIAGARA2_PCR_TOE1 (1ull << CPC_NIAGARA2_PCR_TOE1_SHIFT) 7244961713Sgirish 7344961713Sgirish #define CPC_NIAGARA2_PCR_PIC0_SHIFT 6 7444961713Sgirish #define CPC_NIAGARA2_PCR_PIC1_SHIFT 19 7544961713Sgirish #define CPC_NIAGARA2_PCR_PIC0_MASK UINT64_C(0xfff) 7644961713Sgirish #define CPC_NIAGARA2_PCR_PIC1_MASK UINT64_C(0xfff) 7744961713Sgirish 7844961713Sgirish #define CPC_NIAGARA2_PCR_OV0_SHIFT 18 7944961713Sgirish #define CPC_NIAGARA2_PCR_OV1_SHIFT 30 808d4e547dSae112802 #define CPC_NIAGARA2_PCR_OV0_MASK UINT64_C(0x40000) 818d4e547dSae112802 #define CPC_NIAGARA2_PCR_OV1_MASK UINT64_C(0x80000000) 828d4e547dSae112802 838d4e547dSae112802 #define CPC_NIAGARA2_PCR_HOLDOV0_SHIFT 62 848d4e547dSae112802 #define CPC_NIAGARA2_PCR_HOLDOV1_SHIFT 63 858d4e547dSae112802 #define CPC_NIAGARA2_PCR_HOLDOV0 (1ull << CPC_NIAGARA2_PCR_HOLDOV0_SHIFT) 868d4e547dSae112802 #define CPC_NIAGARA2_PCR_HOLDOV1 (1ull << CPC_NIAGARA2_PCR_HOLDOV1_SHIFT) 8744961713Sgirish 8844961713Sgirish /* 8944961713Sgirish * Hypervisor FAST_TRAP API function numbers to get/set DRAM 9059ac0c16Sdavemq * performance counters for Niagara2 9144961713Sgirish */ 9244961713Sgirish #define HV_NIAGARA2_GETPERF 0x104 9344961713Sgirish #define HV_NIAGARA2_SETPERF 0x105 9444961713Sgirish 9544961713Sgirish /* 9659ac0c16Sdavemq * Hypervisor FAST_TRAP API function numbers to get/set DRAM 9759ac0c16Sdavemq * performance counters for Victoria Falls 9859ac0c16Sdavemq */ 9959ac0c16Sdavemq #define HV_VFALLS_GETPERF 0x106 10059ac0c16Sdavemq #define HV_VFALLS_SETPERF 0x107 10159ac0c16Sdavemq 10259ac0c16Sdavemq /* 10344961713Sgirish * Niagara2 DRAM performance counters 10444961713Sgirish */ 10544961713Sgirish #define NIAGARA_DRAM_PIC0_SEL_SHIFT 0x4 10644961713Sgirish #define NIAGARA_DRAM_PIC1_SEL_SHIFT 0x0 10744961713Sgirish 10844961713Sgirish #define NIAGARA_DRAM_PIC0_SHIFT 0x20 10944961713Sgirish #define NIAGARA_DRAM_PIC0_MASK 0x7fffffff 11044961713Sgirish #define NIAGARA_DRAM_PIC1_SHIFT 0x0 11144961713Sgirish #define NIAGARA_DRAM_PIC1_MASK 0x7fffffff 11244961713Sgirish 11359ac0c16Sdavemq #if defined(NIAGARA2_IMPL) 11444961713Sgirish /* 11544961713Sgirish * SPARC/DRAM performance counter register numbers for HV_NIAGARA2_GETPERF 11659ac0c16Sdavemq * and HV_NIAGARA2_SETPERF for Niagara2 11744961713Sgirish */ 118*64cfc8edSsvemuri #define NIAGARA_DRAM_BANKS 0x4 119*64cfc8edSsvemuri 12044961713Sgirish #define HV_NIAGARA_SPARC_CTL 0x0 12144961713Sgirish #define HV_NIAGARA_DRAM_CTL0 0x1 12244961713Sgirish #define HV_NIAGARA_DRAM_COUNT0 0x2 12344961713Sgirish #define HV_NIAGARA_DRAM_CTL1 0x3 12444961713Sgirish #define HV_NIAGARA_DRAM_COUNT1 0x4 12544961713Sgirish #define HV_NIAGARA_DRAM_CTL2 0x5 12644961713Sgirish #define HV_NIAGARA_DRAM_COUNT2 0x6 12744961713Sgirish #define HV_NIAGARA_DRAM_CTL3 0x7 12844961713Sgirish #define HV_NIAGARA_DRAM_COUNT3 0x8 12944961713Sgirish 13059ac0c16Sdavemq #elif defined(VFALLS_IMPL) 13159ac0c16Sdavemq /* 13259ac0c16Sdavemq * SPARC/DRAM performance counter register numbers for HV_VFALLS_GETPERF 13359ac0c16Sdavemq * and HV_VFALLS_SETPERF for Victoria Falls 134*64cfc8edSsvemuri * Support for 4-node configuration 13559ac0c16Sdavemq */ 136*64cfc8edSsvemuri #define NIAGARA_DRAM_BANKS 0x8 137*64cfc8edSsvemuri 13859ac0c16Sdavemq #define HV_NIAGARA_SPARC_CTL 0x0 13959ac0c16Sdavemq #define HV_NIAGARA_L2_CTL 0x1 14059ac0c16Sdavemq #define HV_NIAGARA_DRAM_CTL0 0x2 14159ac0c16Sdavemq #define HV_NIAGARA_DRAM_COUNT0 0x3 14259ac0c16Sdavemq #define HV_NIAGARA_DRAM_CTL1 0x4 14359ac0c16Sdavemq #define HV_NIAGARA_DRAM_COUNT1 0x5 14459ac0c16Sdavemq #define HV_NIAGARA_DRAM_CTL2 0x6 14559ac0c16Sdavemq #define HV_NIAGARA_DRAM_COUNT2 0x7 14659ac0c16Sdavemq #define HV_NIAGARA_DRAM_CTL3 0x8 14759ac0c16Sdavemq #define HV_NIAGARA_DRAM_COUNT3 0x9 148*64cfc8edSsvemuri #define HV_NIAGARA_DRAM_CTL4 0xa 149*64cfc8edSsvemuri #define HV_NIAGARA_DRAM_COUNT4 0xb 150*64cfc8edSsvemuri #define HV_NIAGARA_DRAM_CTL5 0xc 151*64cfc8edSsvemuri #define HV_NIAGARA_DRAM_COUNT5 0xd 152*64cfc8edSsvemuri #define HV_NIAGARA_DRAM_CTL6 0xe 153*64cfc8edSsvemuri #define HV_NIAGARA_DRAM_COUNT6 0xf 154*64cfc8edSsvemuri #define HV_NIAGARA_DRAM_CTL7 0x10 155*64cfc8edSsvemuri #define HV_NIAGARA_DRAM_COUNT7 0x11 156*64cfc8edSsvemuri 157*64cfc8edSsvemuri #define ZAMBEZI_PIC0_SEL_SHIFT 0x0 158*64cfc8edSsvemuri #define ZAMBEZI_PIC1_SEL_SHIFT 0x8 159*64cfc8edSsvemuri 160*64cfc8edSsvemuri #define ZAMBEZI_LPU_COUNTERS 0x10 161*64cfc8edSsvemuri #define ZAMBEZI_GPD_COUNTERS 0x4 162*64cfc8edSsvemuri #define ZAMBEZI_ASU_COUNTERS 0x4 163*64cfc8edSsvemuri 164*64cfc8edSsvemuri #define HV_ZAM0_LPU_A_PCR 0x12 165*64cfc8edSsvemuri #define HV_ZAM0_LPU_A_PIC0 0x13 166*64cfc8edSsvemuri #define HV_ZAM0_LPU_A_PIC1 0x14 167*64cfc8edSsvemuri #define HV_ZAM0_LPU_B_PCR 0x15 168*64cfc8edSsvemuri #define HV_ZAM0_LPU_B_PIC0 0x16 169*64cfc8edSsvemuri #define HV_ZAM0_LPU_B_PIC1 0x17 170*64cfc8edSsvemuri #define HV_ZAM0_LPU_C_PCR 0x18 171*64cfc8edSsvemuri #define HV_ZAM0_LPU_C_PIC0 0x19 172*64cfc8edSsvemuri #define HV_ZAM0_LPU_C_PIC1 0x1a 173*64cfc8edSsvemuri #define HV_ZAM0_LPU_D_PCR 0x1b 174*64cfc8edSsvemuri #define HV_ZAM0_LPU_D_PIC0 0x1c 175*64cfc8edSsvemuri #define HV_ZAM0_LPU_D_PIC1 0x1d 176*64cfc8edSsvemuri #define HV_ZAM0_GPD_PCR 0x1e 177*64cfc8edSsvemuri #define HV_ZAM0_GPD_PIC0 0x1f 178*64cfc8edSsvemuri #define HV_ZAM0_GPD_PIC1 0x20 179*64cfc8edSsvemuri #define HV_ZAM0_ASU_PCR 0x21 180*64cfc8edSsvemuri #define HV_ZAM0_ASU_PIC0 0x22 181*64cfc8edSsvemuri #define HV_ZAM0_ASU_PIC1 0x23 182*64cfc8edSsvemuri 183*64cfc8edSsvemuri #define HV_ZAM1_LPU_A_PCR 0x24 184*64cfc8edSsvemuri #define HV_ZAM1_LPU_A_PIC0 0x25 185*64cfc8edSsvemuri #define HV_ZAM1_LPU_A_PIC1 0x26 186*64cfc8edSsvemuri #define HV_ZAM1_LPU_B_PCR 0x27 187*64cfc8edSsvemuri #define HV_ZAM1_LPU_B_PIC0 0x28 188*64cfc8edSsvemuri #define HV_ZAM1_LPU_B_PIC1 0x29 189*64cfc8edSsvemuri #define HV_ZAM1_LPU_C_PCR 0x2a 190*64cfc8edSsvemuri #define HV_ZAM1_LPU_C_PIC0 0x2b 191*64cfc8edSsvemuri #define HV_ZAM1_LPU_C_PIC1 0x2c 192*64cfc8edSsvemuri #define HV_ZAM1_LPU_D_PCR 0x2d 193*64cfc8edSsvemuri #define HV_ZAM1_LPU_D_PIC0 0x2e 194*64cfc8edSsvemuri #define HV_ZAM1_LPU_D_PIC1 0x2f 195*64cfc8edSsvemuri #define HV_ZAM1_GPD_PCR 0x30 196*64cfc8edSsvemuri #define HV_ZAM1_GPD_PIC0 0x31 197*64cfc8edSsvemuri #define HV_ZAM1_GPD_PIC1 0x32 198*64cfc8edSsvemuri #define HV_ZAM1_ASU_PCR 0x33 199*64cfc8edSsvemuri #define HV_ZAM1_ASU_PIC0 0x34 200*64cfc8edSsvemuri #define HV_ZAM1_ASU_PIC1 0x35 201*64cfc8edSsvemuri 202*64cfc8edSsvemuri #define HV_ZAM2_LPU_A_PCR 0x36 203*64cfc8edSsvemuri #define HV_ZAM2_LPU_A_PIC0 0x37 204*64cfc8edSsvemuri #define HV_ZAM2_LPU_A_PIC1 0x38 205*64cfc8edSsvemuri #define HV_ZAM2_LPU_B_PCR 0x39 206*64cfc8edSsvemuri #define HV_ZAM2_LPU_B_PIC0 0x3a 207*64cfc8edSsvemuri #define HV_ZAM2_LPU_B_PIC1 0x3b 208*64cfc8edSsvemuri #define HV_ZAM2_LPU_C_PCR 0x3c 209*64cfc8edSsvemuri #define HV_ZAM2_LPU_C_PIC0 0x3d 210*64cfc8edSsvemuri #define HV_ZAM2_LPU_C_PIC1 0x3e 211*64cfc8edSsvemuri #define HV_ZAM2_LPU_D_PCR 0x3f 212*64cfc8edSsvemuri #define HV_ZAM2_LPU_D_PIC0 0x40 213*64cfc8edSsvemuri #define HV_ZAM2_LPU_D_PIC1 0x41 214*64cfc8edSsvemuri #define HV_ZAM2_GPD_PCR 0x42 215*64cfc8edSsvemuri #define HV_ZAM2_GPD_PIC0 0x43 216*64cfc8edSsvemuri #define HV_ZAM2_GPD_PIC1 0x44 217*64cfc8edSsvemuri #define HV_ZAM2_ASU_PCR 0x45 218*64cfc8edSsvemuri #define HV_ZAM2_ASU_PIC0 0x46 219*64cfc8edSsvemuri #define HV_ZAM2_ASU_PIC1 0x47 220*64cfc8edSsvemuri 221*64cfc8edSsvemuri #define HV_ZAM3_LPU_A_PCR 0x48 222*64cfc8edSsvemuri #define HV_ZAM3_LPU_A_PIC0 0x49 223*64cfc8edSsvemuri #define HV_ZAM3_LPU_A_PIC1 0x4a 224*64cfc8edSsvemuri #define HV_ZAM3_LPU_B_PCR 0x4b 225*64cfc8edSsvemuri #define HV_ZAM3_LPU_B_PIC0 0x4c 226*64cfc8edSsvemuri #define HV_ZAM3_LPU_B_PIC1 0x4d 227*64cfc8edSsvemuri #define HV_ZAM3_LPU_C_PCR 0x4e 228*64cfc8edSsvemuri #define HV_ZAM3_LPU_C_PIC0 0x4f 229*64cfc8edSsvemuri #define HV_ZAM3_LPU_C_PIC1 0x50 230*64cfc8edSsvemuri #define HV_ZAM3_LPU_D_PCR 0x51 231*64cfc8edSsvemuri #define HV_ZAM3_LPU_D_PIC0 0x52 232*64cfc8edSsvemuri #define HV_ZAM3_LPU_D_PIC1 0x53 233*64cfc8edSsvemuri #define HV_ZAM3_GPD_PCR 0x54 234*64cfc8edSsvemuri #define HV_ZAM3_GPD_PIC0 0x55 235*64cfc8edSsvemuri #define HV_ZAM3_GPD_PIC1 0x56 236*64cfc8edSsvemuri #define HV_ZAM3_ASU_PCR 0x57 237*64cfc8edSsvemuri #define HV_ZAM3_ASU_PIC0 0x58 238*64cfc8edSsvemuri #define HV_ZAM3_ASU_PIC1 0x59 23959ac0c16Sdavemq 24059ac0c16Sdavemq #define VFALLS_L2_CTL_MASK 0x3 24159ac0c16Sdavemq #define VFALLS_SL3_MASK 0x300 24259ac0c16Sdavemq 24359ac0c16Sdavemq #endif 24459ac0c16Sdavemq 24544961713Sgirish #ifndef _ASM 24644961713Sgirish /* 24744961713Sgirish * prototypes for hypervisor interface to get/set SPARC and DRAM 24844961713Sgirish * performance counters 24944961713Sgirish */ 25044961713Sgirish extern uint64_t hv_niagara_setperf(uint64_t regnum, uint64_t val); 25144961713Sgirish extern uint64_t hv_niagara_getperf(uint64_t regnum, uint64_t *val); 25244961713Sgirish #endif 25344961713Sgirish 25444961713Sgirish #ifdef __cplusplus 25544961713Sgirish } 25644961713Sgirish #endif 25744961713Sgirish 25844961713Sgirish #endif /* _SYS_NIAGARA2REGS_H */ 259