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 /* 22*8d4e547dSae112802 * 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 4444961713Sgirish /* PIC overflow range is -16 to -1 */ 4544961713Sgirish #define PIC_IN_OV_RANGE(x) (((uint32_t)x >= 0xfffffff0) ? 1 : 0) 4644961713Sgirish 4744961713Sgirish /* 4844961713Sgirish * Niagara2 SPARC Performance Instrumentation Counter 4944961713Sgirish */ 5044961713Sgirish #define PIC0_MASK (((uint64_t)1 << 32) - 1) /* pic0 in bits 31:0 */ 5144961713Sgirish #define PIC1_SHIFT 32 /* pic1 in bits 64:32 */ 5244961713Sgirish 5344961713Sgirish /* 5444961713Sgirish * Niagara2 SPARC Performance Control Register 5544961713Sgirish */ 56*8d4e547dSae112802 #define CPC_NIAGARA2_PCR_PRIV_SHIFT 0 57*8d4e547dSae112802 #define CPC_NIAGARA2_PCR_ST_SHIFT 1 58*8d4e547dSae112802 #define CPC_NIAGARA2_PCR_UT_SHIFT 2 59*8d4e547dSae112802 60*8d4e547dSae112802 #define CPC_NIAGARA2_PCR_HT_SHIFT 3 61*8d4e547dSae112802 #define CPC_NIAGARA2_PCR_HT (1ull << CPC_NIAGARA2_PCR_HT_SHIFT) 62*8d4e547dSae112802 6344961713Sgirish #define CPC_NIAGARA2_PCR_TOE0_SHIFT 4 6444961713Sgirish #define CPC_NIAGARA2_PCR_TOE1_SHIFT 5 65*8d4e547dSae112802 #define CPC_NIAGARA2_PCR_TOE0 (1ull << CPC_NIAGARA2_PCR_TOE0_SHIFT) 66*8d4e547dSae112802 #define CPC_NIAGARA2_PCR_TOE1 (1ull << CPC_NIAGARA2_PCR_TOE1_SHIFT) 6744961713Sgirish 6844961713Sgirish #define CPC_NIAGARA2_PCR_PIC0_SHIFT 6 6944961713Sgirish #define CPC_NIAGARA2_PCR_PIC1_SHIFT 19 7044961713Sgirish #define CPC_NIAGARA2_PCR_PIC0_MASK UINT64_C(0xfff) 7144961713Sgirish #define CPC_NIAGARA2_PCR_PIC1_MASK UINT64_C(0xfff) 7244961713Sgirish 7344961713Sgirish #define CPC_NIAGARA2_PCR_OV0_SHIFT 18 7444961713Sgirish #define CPC_NIAGARA2_PCR_OV1_SHIFT 30 75*8d4e547dSae112802 #define CPC_NIAGARA2_PCR_OV0_MASK UINT64_C(0x40000) 76*8d4e547dSae112802 #define CPC_NIAGARA2_PCR_OV1_MASK UINT64_C(0x80000000) 77*8d4e547dSae112802 78*8d4e547dSae112802 #define CPC_NIAGARA2_PCR_HOLDOV0_SHIFT 62 79*8d4e547dSae112802 #define CPC_NIAGARA2_PCR_HOLDOV1_SHIFT 63 80*8d4e547dSae112802 #define CPC_NIAGARA2_PCR_HOLDOV0 (1ull << CPC_NIAGARA2_PCR_HOLDOV0_SHIFT) 81*8d4e547dSae112802 #define CPC_NIAGARA2_PCR_HOLDOV1 (1ull << CPC_NIAGARA2_PCR_HOLDOV1_SHIFT) 8244961713Sgirish 8344961713Sgirish /* 8444961713Sgirish * Hypervisor FAST_TRAP API function numbers to get/set DRAM 8544961713Sgirish * performance counters 8644961713Sgirish */ 8744961713Sgirish #define HV_NIAGARA2_GETPERF 0x104 8844961713Sgirish #define HV_NIAGARA2_SETPERF 0x105 8944961713Sgirish 9044961713Sgirish /* 9144961713Sgirish * Niagara2 DRAM performance counters 9244961713Sgirish */ 9344961713Sgirish #define NIAGARA_DRAM_BANKS 0x4 9444961713Sgirish 9544961713Sgirish #define NIAGARA_DRAM_PIC0_SEL_SHIFT 0x4 9644961713Sgirish #define NIAGARA_DRAM_PIC1_SEL_SHIFT 0x0 9744961713Sgirish 9844961713Sgirish #define NIAGARA_DRAM_PIC0_SHIFT 0x20 9944961713Sgirish #define NIAGARA_DRAM_PIC0_MASK 0x7fffffff 10044961713Sgirish #define NIAGARA_DRAM_PIC1_SHIFT 0x0 10144961713Sgirish #define NIAGARA_DRAM_PIC1_MASK 0x7fffffff 10244961713Sgirish 10344961713Sgirish /* 10444961713Sgirish * SPARC/DRAM performance counter register numbers for HV_NIAGARA2_GETPERF 10544961713Sgirish * and HV_NIAGARA2_SETPERF 10644961713Sgirish */ 10744961713Sgirish #define HV_NIAGARA_SPARC_CTL 0x0 10844961713Sgirish #define HV_NIAGARA_DRAM_CTL0 0x1 10944961713Sgirish #define HV_NIAGARA_DRAM_COUNT0 0x2 11044961713Sgirish #define HV_NIAGARA_DRAM_CTL1 0x3 11144961713Sgirish #define HV_NIAGARA_DRAM_COUNT1 0x4 11244961713Sgirish #define HV_NIAGARA_DRAM_CTL2 0x5 11344961713Sgirish #define HV_NIAGARA_DRAM_COUNT2 0x6 11444961713Sgirish #define HV_NIAGARA_DRAM_CTL3 0x7 11544961713Sgirish #define HV_NIAGARA_DRAM_COUNT3 0x8 11644961713Sgirish 11744961713Sgirish #ifndef _ASM 11844961713Sgirish /* 11944961713Sgirish * prototypes for hypervisor interface to get/set SPARC and DRAM 12044961713Sgirish * performance counters 12144961713Sgirish */ 12244961713Sgirish extern uint64_t hv_niagara_setperf(uint64_t regnum, uint64_t val); 12344961713Sgirish extern uint64_t hv_niagara_getperf(uint64_t regnum, uint64_t *val); 12444961713Sgirish #endif 12544961713Sgirish 12644961713Sgirish #ifdef __cplusplus 12744961713Sgirish } 12844961713Sgirish #endif 12944961713Sgirish 13044961713Sgirish #endif /* _SYS_NIAGARA2REGS_H */ 131