17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 237c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _SYS_NIAGARAREGS_H 287c478bd9Sstevel@tonic-gate #define _SYS_NIAGARAREGS_H 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #ifdef __cplusplus 337c478bd9Sstevel@tonic-gate extern "C" { 347c478bd9Sstevel@tonic-gate #endif 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate /* 377c478bd9Sstevel@tonic-gate * Niagara SPARC Performance Instrumentation Counter 387c478bd9Sstevel@tonic-gate */ 397c478bd9Sstevel@tonic-gate #define PIC0_MASK (((uint64_t)1 << 32) - 1) /* pic0 in bits 31:0 */ 407c478bd9Sstevel@tonic-gate #define PIC1_SHIFT 32 /* pic1 in bits 64:32 */ 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate /* 437c478bd9Sstevel@tonic-gate * Niagara SPARC Performance Control Register 447c478bd9Sstevel@tonic-gate */ 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate #define CPC_NIAGARA_PCR_PRIVPIC 0 477c478bd9Sstevel@tonic-gate #define CPC_NIAGARA_PCR_SYS 1 487c478bd9Sstevel@tonic-gate #define CPC_NIAGARA_PCR_USR 2 497c478bd9Sstevel@tonic-gate 507c478bd9Sstevel@tonic-gate #define CPC_NIAGARA_PCR_PIC0_SHIFT 4 517c478bd9Sstevel@tonic-gate #define CPC_NIAGARA_PCR_PIC1_SHIFT 0 527c478bd9Sstevel@tonic-gate #define CPC_NIAGARA_PCR_PIC0_MASK UINT64_C(0x7) 537c478bd9Sstevel@tonic-gate #define CPC_NIAGARA_PCR_PIC1_MASK UINT64_C(0) 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate #define CPC_NIAGARA_PCR_OVF_MASK UINT64_C(0x300) 567c478bd9Sstevel@tonic-gate #define CPC_NIAGARA_PCR_OVF_SHIFT 8 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate /* 597c478bd9Sstevel@tonic-gate * Niagara DRAM performance counters 607c478bd9Sstevel@tonic-gate */ 617c478bd9Sstevel@tonic-gate #define NIAGARA_DRAM_BANKS 0x4 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate #define NIAGARA_DRAM_PIC0_SEL_SHIFT 0x4 647c478bd9Sstevel@tonic-gate #define NIAGARA_DRAM_PIC1_SEL_SHIFT 0x0 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate #define NIAGARA_DRAM_PIC0_SHIFT 0x20 677c478bd9Sstevel@tonic-gate #define NIAGARA_DRAM_PIC0_MASK 0x7fffffff 687c478bd9Sstevel@tonic-gate #define NIAGARA_DRAM_PIC1_SHIFT 0x0 697c478bd9Sstevel@tonic-gate #define NIAGARA_DRAM_PIC1_MASK 0x7fffffff 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate /* 727c478bd9Sstevel@tonic-gate * Niagara JBUS performance counters 737c478bd9Sstevel@tonic-gate */ 747c478bd9Sstevel@tonic-gate #define NIAGARA_JBUS_PIC0_SEL_SHIFT 0x4 757c478bd9Sstevel@tonic-gate #define NIAGARA_JBUS_PIC1_SEL_SHIFT 0x0 767c478bd9Sstevel@tonic-gate 777c478bd9Sstevel@tonic-gate #define NIAGARA_JBUS_PIC0_SHIFT 0x20 787c478bd9Sstevel@tonic-gate #define NIAGARA_JBUS_PIC0_MASK 0x7fffffff 797c478bd9Sstevel@tonic-gate #define NIAGARA_JBUS_PIC1_SHIFT 0x0 807c478bd9Sstevel@tonic-gate #define NIAGARA_JBUS_PIC1_MASK 0x7fffffff 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate /* 847c478bd9Sstevel@tonic-gate * Hypervisor FAST_TRAP API function numbers to get/set DRAM and 857c478bd9Sstevel@tonic-gate * JBUS performance counters 867c478bd9Sstevel@tonic-gate */ 877c478bd9Sstevel@tonic-gate #define HV_NIAGARA_GETPERF 0x100 887c478bd9Sstevel@tonic-gate #define HV_NIAGARA_SETPERF 0x101 897c478bd9Sstevel@tonic-gate 90*ce0352ebSgirish /* 91*ce0352ebSgirish * Hypervisor FAST_TRAP API function numbers for Niagara MMU statistics 92*ce0352ebSgirish */ 93*ce0352ebSgirish #define HV_NIAGARA_MMUSTAT_CONF 0x102 94*ce0352ebSgirish #define HV_NIAGARA_MMUSTAT_INFO 0x103 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate /* 977c478bd9Sstevel@tonic-gate * DRAM/JBUS performance counter register numbers for HV_NIAGARA_GETPERF 987c478bd9Sstevel@tonic-gate * and HV_NIAGARA_SETPERF 997c478bd9Sstevel@tonic-gate */ 1007c478bd9Sstevel@tonic-gate #define HV_NIAGARA_JBUS_CTL 0x0 1017c478bd9Sstevel@tonic-gate #define HV_NIAGARA_JBUS_COUNT 0x1 1027c478bd9Sstevel@tonic-gate #define HV_NIAGARA_DRAM_CTL0 0x2 1037c478bd9Sstevel@tonic-gate #define HV_NIAGARA_DRAM_COUNT0 0x3 1047c478bd9Sstevel@tonic-gate #define HV_NIAGARA_DRAM_CTL1 0x4 1057c478bd9Sstevel@tonic-gate #define HV_NIAGARA_DRAM_COUNT1 0x5 1067c478bd9Sstevel@tonic-gate #define HV_NIAGARA_DRAM_CTL2 0x6 1077c478bd9Sstevel@tonic-gate #define HV_NIAGARA_DRAM_COUNT2 0x7 1087c478bd9Sstevel@tonic-gate #define HV_NIAGARA_DRAM_CTL3 0x8 1097c478bd9Sstevel@tonic-gate #define HV_NIAGARA_DRAM_COUNT3 0x9 1107c478bd9Sstevel@tonic-gate 111*ce0352ebSgirish #ifndef _ASM 112*ce0352ebSgirish 113*ce0352ebSgirish /* 114*ce0352ebSgirish * Niagara MMU statistics data structure 115*ce0352ebSgirish */ 116*ce0352ebSgirish 117*ce0352ebSgirish #define NIAGARA_MMUSTAT_PGSZS 8 118*ce0352ebSgirish 119*ce0352ebSgirish typedef struct niagara_tsbinfo { 120*ce0352ebSgirish uint64_t tsbhit_count; 121*ce0352ebSgirish uint64_t tsbhit_time; 122*ce0352ebSgirish } niagara_tsbinfo_t; 123*ce0352ebSgirish 124*ce0352ebSgirish typedef struct niagara_mmustat { 125*ce0352ebSgirish niagara_tsbinfo_t kitsb[NIAGARA_MMUSTAT_PGSZS]; 126*ce0352ebSgirish niagara_tsbinfo_t uitsb[NIAGARA_MMUSTAT_PGSZS]; 127*ce0352ebSgirish niagara_tsbinfo_t kdtsb[NIAGARA_MMUSTAT_PGSZS]; 128*ce0352ebSgirish niagara_tsbinfo_t udtsb[NIAGARA_MMUSTAT_PGSZS]; 129*ce0352ebSgirish } niagara_mmustat_t; 130*ce0352ebSgirish 131*ce0352ebSgirish 1327c478bd9Sstevel@tonic-gate /* 1337c478bd9Sstevel@tonic-gate * prototypes for hypervisor interface to get/set DRAM and JBUS 1347c478bd9Sstevel@tonic-gate * performance counters 1357c478bd9Sstevel@tonic-gate */ 1367c478bd9Sstevel@tonic-gate extern uint64_t hv_niagara_setperf(uint64_t regnum, uint64_t val); 1377c478bd9Sstevel@tonic-gate extern uint64_t hv_niagara_getperf(uint64_t regnum, uint64_t *val); 138*ce0352ebSgirish extern uint64_t hv_niagara_mmustat_conf(uint64_t buf, uint64_t *prev_buf); 139*ce0352ebSgirish extern uint64_t hv_niagara_mmustat_info(uint64_t *buf); 140*ce0352ebSgirish 141*ce0352ebSgirish #endif /* _ASM */ 1427c478bd9Sstevel@tonic-gate 1436dfee483Stsien /* 1446dfee483Stsien * Bits defined in L2 Error Status Register 1456dfee483Stsien * 1466dfee483Stsien * +---+---+---+---+----+----+----+----+----+----+----+----+----+----+ 1476dfee483Stsien * |MEU|MEC|RW |RSV|MODA|VCID|LDAC|LDAU|LDWC|LDWU|LDRC|LDRU|LDSC|LDSU| 1486dfee483Stsien * +---+---+---+---+----+----+----+----+----+----+----+----+----+----+ 1496dfee483Stsien * 63 62 61 60 59 58-54 53 52 51 50 49 48 47 46 1506dfee483Stsien * 1516dfee483Stsien * +---+---+---+---+---+---+---+---+---+---+---+-------+------+ 1526dfee483Stsien * |LTC|LRU|LVU|DAC|DAU|DRC|DRU|DSC|DSU|VEC|VEU| RSVD1 | SYND | 1536dfee483Stsien * +---+---+---+---+---+---+---+---+---+---+---+-------+------+ 1546dfee483Stsien * 45 44 43 42 41 40 39 38 37 36 35 34-32 31-0 1556dfee483Stsien */ 1566dfee483Stsien #define NI_L2AFSR_MEU 0x8000000000000000 1576dfee483Stsien #define NI_L2AFSR_MEC 0x4000000000000000 1586dfee483Stsien #define NI_L2AFSR_RW 0x2000000000000000 1596dfee483Stsien #define NI_L2AFSR_RSVD0 0x1000000000000000 1606dfee483Stsien #define NI_L2AFSR_MODA 0x0800000000000000 1616dfee483Stsien #define NI_L2AFSR_VCID 0x07C0000000000000 1626dfee483Stsien #define NI_L2AFSR_LDAC 0x0020000000000000 1636dfee483Stsien #define NI_L2AFSR_LDAU 0x0010000000000000 1646dfee483Stsien #define NI_L2AFSR_LDWC 0x0008000000000000 1656dfee483Stsien #define NI_L2AFSR_LDWU 0x0004000000000000 1666dfee483Stsien #define NI_L2AFSR_LDRC 0x0002000000000000 1676dfee483Stsien #define NI_L2AFSR_LDRU 0x0001000000000000 1686dfee483Stsien #define NI_L2AFSR_LDSC 0x0000800000000000 1696dfee483Stsien #define NI_L2AFSR_LDSU 0x0000400000000000 1706dfee483Stsien #define NI_L2AFSR_LTC 0x0000200000000000 1716dfee483Stsien #define NI_L2AFSR_LRU 0x0000100000000000 1726dfee483Stsien #define NI_L2AFSR_LVU 0x0000080000000000 1736dfee483Stsien #define NI_L2AFSR_DAC 0x0000040000000000 1746dfee483Stsien #define NI_L2AFSR_DAU 0x0000020000000000 1756dfee483Stsien #define NI_L2AFSR_DRC 0x0000010000000000 1766dfee483Stsien #define NI_L2AFSR_DRU 0x0000008000000000 1776dfee483Stsien #define NI_L2AFSR_DSC 0x0000004000000000 1786dfee483Stsien #define NI_L2AFSR_DSU 0x0000002000000000 1796dfee483Stsien #define NI_L2AFSR_VEC 0x0000001000000000 1806dfee483Stsien #define NI_L2AFSR_VEU 0x0000000800000000 1816dfee483Stsien #define NI_L2AFSR_RSVD1 0x0000000700000000 1826dfee483Stsien #define NI_L2AFSR_SYND 0x00000000FFFFFFFF 1836dfee483Stsien 1846dfee483Stsien /* 1856dfee483Stsien * These L2 bit masks are used to determine if another bit of higher priority 1866dfee483Stsien * is set. This tells us whether the reported syndrome and address are valid 1876dfee483Stsien * for this ereport. If the error in hand is Pn, use Pn-1 to bitwise & with 1886dfee483Stsien * the l2-afsr value. If result is 0, then this ereport's afsr is valid. 1896dfee483Stsien */ 1906dfee483Stsien #define NI_L2AFSR_P01 (NI_L2AFSR_LVU) 1916dfee483Stsien #define NI_L2AFSR_P02 (NI_L2AFSR_P01 | NI_L2AFSR_LRU) 1926dfee483Stsien #define NI_L2AFSR_P03 (NI_L2AFSR_P02 | NI_L2AFSR_LDAU | NI_L2AFSR_LDSU) 1936dfee483Stsien #define NI_L2AFSR_P04 (NI_L2AFSR_P03 | NI_L2AFSR_LDWU) 1946dfee483Stsien #define NI_L2AFSR_P05 (NI_L2AFSR_P04 | NI_L2AFSR_LDRU) 1956dfee483Stsien #define NI_L2AFSR_P06 (NI_L2AFSR_P05 | NI_L2AFSR_DAU | NI_L2AFSR_DRU) 1966dfee483Stsien #define NI_L2AFSR_P07 (NI_L2AFSR_P06 | NI_L2AFSR_LTC) 1976dfee483Stsien #define NI_L2AFSR_P08 (NI_L2AFSR_P07 | NI_L2AFSR_LDAC | NI_L2AFSR_LDSC) 1986dfee483Stsien #define NI_L2AFSR_P09 (NI_L2AFSR_P08 | NI_L2AFSR_LDWC) 1996dfee483Stsien #define NI_L2AFSR_P10 (NI_L2AFSR_P09 | NI_L2AFSR_LDRC) 2006dfee483Stsien #define NI_L2AFSR_P11 (NI_L2AFSR_P10 | NI_L2AFSR_DAC | NI_L2AFSR_DRC) 2016dfee483Stsien 2026dfee483Stsien /* 2036dfee483Stsien * Bits defined in DRAM Error Status Register 2046dfee483Stsien * 2056dfee483Stsien * +---+---+---+---+---+---+---+----------+------+ 2066dfee483Stsien * |MEU|MEC|DAC|DAU|DSC|DSU|DBU| RESERVED | SYND | 2076dfee483Stsien * +---+---+---+---+---+---+---+----------+------+ 2086dfee483Stsien * 63 62 61 60 59 58 57 56-16 15-0 2096dfee483Stsien * 2106dfee483Stsien */ 2116dfee483Stsien #define NI_DMAFSR_MEU 0x8000000000000000 2126dfee483Stsien #define NI_DMAFSR_MEC 0x4000000000000000 2136dfee483Stsien #define NI_DMAFSR_DAC 0x2000000000000000 2146dfee483Stsien #define NI_DMAFSR_DAU 0x1000000000000000 2156dfee483Stsien #define NI_DMAFSR_DSC 0x0800000000000000 2166dfee483Stsien #define NI_DMAFSR_DSU 0x0400000000000000 2176dfee483Stsien #define NI_DMAFSR_DBU 0x0200000000000000 2186dfee483Stsien #define NI_DMAFSR_RSVD 0x01FFFFFFFFFF0000 2196dfee483Stsien #define NI_DMAFSR_SYND 0x000000000000FFFF 2206dfee483Stsien 2216dfee483Stsien /* Bit mask for DRAM priority determination */ 2226dfee483Stsien #define NI_DMAFSR_P01 (NI_DMAFSR_DSU | NI_DMAFSR_DAU) 2236dfee483Stsien 2246dfee483Stsien /* 2256dfee483Stsien * The following is the syndrome value placed in memory 2266dfee483Stsien * when an uncorrectable error is written back from L2 cache. 2276dfee483Stsien */ 2286dfee483Stsien #define NI_DRAM_POISON_SYND_FROM_LDWU 0x1118 2296dfee483Stsien 2306dfee483Stsien /* 2316dfee483Stsien * This L2 poison syndrome is placed on 4 byte checkwords of L2 2326dfee483Stsien * when a UE is loaded or DMA'ed into L2 2336dfee483Stsien */ 2346dfee483Stsien #define NI_L2_POISON_SYND_FROM_DAU 0x3 2356dfee483Stsien #define NI_L2_POISON_SYND_MASK 0x7F 2366dfee483Stsien #define NI_L2_POISON_SYND_SIZE 7 2376dfee483Stsien 2387c478bd9Sstevel@tonic-gate #ifdef __cplusplus 2397c478bd9Sstevel@tonic-gate } 2407c478bd9Sstevel@tonic-gate #endif 2417c478bd9Sstevel@tonic-gate 2427c478bd9Sstevel@tonic-gate #endif /* _SYS_NIAGARAREGS_H */ 243