1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_SPITREGS_H 28*7c478bd9Sstevel@tonic-gate #define _SYS_SPITREGS_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 33*7c478bd9Sstevel@tonic-gate extern "C" { 34*7c478bd9Sstevel@tonic-gate #endif 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate /* 37*7c478bd9Sstevel@tonic-gate * This file is cpu dependent. 38*7c478bd9Sstevel@tonic-gate */ 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate #ifdef _STARFIRE 41*7c478bd9Sstevel@tonic-gate /* 42*7c478bd9Sstevel@tonic-gate * Starfire's cpu upaids are not the same 43*7c478bd9Sstevel@tonic-gate * as cpuids. 44*7c478bd9Sstevel@tonic-gate * XXX - our obp took the liberty of 45*7c478bd9Sstevel@tonic-gate * converting cpu upaids into cpuids when 46*7c478bd9Sstevel@tonic-gate * presenting it as upa-portid property. 47*7c478bd9Sstevel@tonic-gate */ 48*7c478bd9Sstevel@tonic-gate #define CPUID_TO_UPAID(upaid) (((upaid & 0x3C) << 1) | \ 49*7c478bd9Sstevel@tonic-gate ((upaid & 0x40) >> 4) | \ 50*7c478bd9Sstevel@tonic-gate (upaid &0x3)) 51*7c478bd9Sstevel@tonic-gate #else 52*7c478bd9Sstevel@tonic-gate /* 53*7c478bd9Sstevel@tonic-gate * The mid is the same as the cpu id. 54*7c478bd9Sstevel@tonic-gate * We might want to change this later 55*7c478bd9Sstevel@tonic-gate */ 56*7c478bd9Sstevel@tonic-gate #define CPUID_TO_UPAID(cpuid) (cpuid) 57*7c478bd9Sstevel@tonic-gate #endif /* _STARFIRE */ 58*7c478bd9Sstevel@tonic-gate 59*7c478bd9Sstevel@tonic-gate /* 60*7c478bd9Sstevel@tonic-gate * LSU Control Register 61*7c478bd9Sstevel@tonic-gate * 62*7c478bd9Sstevel@tonic-gate * +------+----+----+----+----+----+----+-----+------+----+----+----+---+ 63*7c478bd9Sstevel@tonic-gate * | Resv | PM | VM | PR | PW | VR | VW | Rsv | FM | DM | IM | DC | IC| 64*7c478bd9Sstevel@tonic-gate * +------+----+----+----+----+----+----+-----+------+----+----+----+---+ 65*7c478bd9Sstevel@tonic-gate * 63 41 33 25 24 23 22 21 20 19 4 3 2 1 0 66*7c478bd9Sstevel@tonic-gate * 67*7c478bd9Sstevel@tonic-gate */ 68*7c478bd9Sstevel@tonic-gate 69*7c478bd9Sstevel@tonic-gate #define LSU_IC 0x00000000001 /* icache enable */ 70*7c478bd9Sstevel@tonic-gate #define LSU_DC 0x00000000002 /* dcache enable */ 71*7c478bd9Sstevel@tonic-gate #define LSU_IM 0x00000000004 /* immu enable */ 72*7c478bd9Sstevel@tonic-gate #define LSU_DM 0x00000000008 /* dmmu enable */ 73*7c478bd9Sstevel@tonic-gate #define LSU_FM 0x000000FFFF0 /* parity mask */ 74*7c478bd9Sstevel@tonic-gate #define LSU_VW 0x00000200000 /* virtual watchpoint write enable */ 75*7c478bd9Sstevel@tonic-gate #define LSU_VR 0x00000400000 /* virtual watchpoint read enable */ 76*7c478bd9Sstevel@tonic-gate #define LSU_PW 0x00000800000 /* physical watchpoint write enable */ 77*7c478bd9Sstevel@tonic-gate #define LSU_PR 0x00001000000 /* physical watchpoint read enable */ 78*7c478bd9Sstevel@tonic-gate #define LSU_VM 0x001fe000000 /* virtual watchpoint byte mask */ 79*7c478bd9Sstevel@tonic-gate #define LSU_PM 0x1fe00000000 /* physical watch point byte mask */ 80*7c478bd9Sstevel@tonic-gate 81*7c478bd9Sstevel@tonic-gate #define LSU_VM_SHIFT 25 82*7c478bd9Sstevel@tonic-gate #define LSU_PM_SHIFT 33 83*7c478bd9Sstevel@tonic-gate 84*7c478bd9Sstevel@tonic-gate /* 85*7c478bd9Sstevel@tonic-gate * Defines for the different types of dcache_flush 86*7c478bd9Sstevel@tonic-gate * it is stored in dflush_type 87*7c478bd9Sstevel@tonic-gate */ 88*7c478bd9Sstevel@tonic-gate #define FLUSHALL_TYPE 0x0 /* blasts all cache lines */ 89*7c478bd9Sstevel@tonic-gate #define FLUSHMATCH_TYPE 0x1 /* flush entire cache but check each */ 90*7c478bd9Sstevel@tonic-gate /* each line for a match */ 91*7c478bd9Sstevel@tonic-gate #define FLUSHPAGE_TYPE 0x2 /* flush only one page and check */ 92*7c478bd9Sstevel@tonic-gate /* each line for a match */ 93*7c478bd9Sstevel@tonic-gate 94*7c478bd9Sstevel@tonic-gate /* 95*7c478bd9Sstevel@tonic-gate * D-Cache Tag Data Register 96*7c478bd9Sstevel@tonic-gate * 97*7c478bd9Sstevel@tonic-gate * +----------+--------+----------+ 98*7c478bd9Sstevel@tonic-gate * | Reserved | DC_Tag | DC_Valid | 99*7c478bd9Sstevel@tonic-gate * +----------+--------+----------+ 100*7c478bd9Sstevel@tonic-gate * 63 30 29 2 1 0 101*7c478bd9Sstevel@tonic-gate * 102*7c478bd9Sstevel@tonic-gate */ 103*7c478bd9Sstevel@tonic-gate #define ICACHE_FLUSHSZ 0x20 /* one line in i$ */ 104*7c478bd9Sstevel@tonic-gate #define DC_PTAG_SHIFT 34 105*7c478bd9Sstevel@tonic-gate #define DC_LINE_SHIFT 30 106*7c478bd9Sstevel@tonic-gate #define SF_DC_VBIT_SHIFT 2 107*7c478bd9Sstevel@tonic-gate #define SF_DC_VBIT_MASK 0x3 108*7c478bd9Sstevel@tonic-gate #define IC_LINE_SHIFT 3 109*7c478bd9Sstevel@tonic-gate #define IC_LINE 512 110*7c478bd9Sstevel@tonic-gate #define INDEX_BIT_SHIFT 13 111*7c478bd9Sstevel@tonic-gate 112*7c478bd9Sstevel@tonic-gate /* 113*7c478bd9Sstevel@tonic-gate * Definitions of sun4u cpu implementations as specified in version register 114*7c478bd9Sstevel@tonic-gate */ 115*7c478bd9Sstevel@tonic-gate #define SPITFIRE_IMPL 0x10 116*7c478bd9Sstevel@tonic-gate #define IS_SPITFIRE(impl) ((impl) == SPITFIRE_IMPL) 117*7c478bd9Sstevel@tonic-gate #define SPITFIRE_MAJOR_VERSION(rev) (((rev) >> 4) & 0xf) 118*7c478bd9Sstevel@tonic-gate #define SPITFIRE_MINOR_VERSION(rev) ((rev) & 0xf) 119*7c478bd9Sstevel@tonic-gate 120*7c478bd9Sstevel@tonic-gate #define BLACKBIRD_IMPL 0x11 121*7c478bd9Sstevel@tonic-gate #define IS_BLACKBIRD(impl) ((impl) == BLACKBIRD_IMPL) 122*7c478bd9Sstevel@tonic-gate #define BLACKBIRD_MAJOR_VERSION(rev) (((rev) >> 4) & 0xf) 123*7c478bd9Sstevel@tonic-gate #define BLACKBIRD_MINOR_VERSION(rev) ((rev) & 0xf) 124*7c478bd9Sstevel@tonic-gate 125*7c478bd9Sstevel@tonic-gate #define SABRE_IMPL 0x12 126*7c478bd9Sstevel@tonic-gate #define HUMMBRD_IMPL 0x13 127*7c478bd9Sstevel@tonic-gate 128*7c478bd9Sstevel@tonic-gate /* 129*7c478bd9Sstevel@tonic-gate * Bits of Spitfire Asynchronous Fault Status Register 130*7c478bd9Sstevel@tonic-gate */ 131*7c478bd9Sstevel@tonic-gate #define P_AFSR_STICKY 0x00000001FFF00000ULL /* mask for all sticky bits */ 132*7c478bd9Sstevel@tonic-gate #define P_AFSR_ERRS 0x000000001EE00000ULL /* mask for remaining errors */ 133*7c478bd9Sstevel@tonic-gate #define P_AFSR_ME 0x0000000100000000ULL /* errors > 1, same type!=CE */ 134*7c478bd9Sstevel@tonic-gate #define P_AFSR_PRIV 0x0000000080000000ULL /* priv/supervisor access */ 135*7c478bd9Sstevel@tonic-gate #define P_AFSR_ISAP 0x0000000040000000ULL /* incoming system addr. parity */ 136*7c478bd9Sstevel@tonic-gate #define P_AFSR_ETP 0x0000000020000000ULL /* ecache tag parity */ 137*7c478bd9Sstevel@tonic-gate #define P_AFSR_IVUE 0x0000000010000000ULL /* interrupt vector with UE */ 138*7c478bd9Sstevel@tonic-gate #define P_AFSR_TO 0x0000000008000000ULL /* bus timeout */ 139*7c478bd9Sstevel@tonic-gate #define P_AFSR_BERR 0x0000000004000000ULL /* bus error */ 140*7c478bd9Sstevel@tonic-gate #define P_AFSR_LDP 0x0000000002000000ULL /* data parity error from SDB */ 141*7c478bd9Sstevel@tonic-gate #define P_AFSR_CP 0x0000000001000000ULL /* copyout parity error */ 142*7c478bd9Sstevel@tonic-gate #define P_AFSR_WP 0x0000000000800000ULL /* writeback ecache data parity */ 143*7c478bd9Sstevel@tonic-gate #define P_AFSR_EDP 0x0000000000400000ULL /* ecache data parity */ 144*7c478bd9Sstevel@tonic-gate #define P_AFSR_UE 0x0000000000200000ULL /* uncorrectable ECC error */ 145*7c478bd9Sstevel@tonic-gate #define P_AFSR_CE 0x0000000000100000ULL /* correctable ECC error */ 146*7c478bd9Sstevel@tonic-gate #define P_AFSR_ETS 0x00000000000F0000ULL /* cache tag parity syndrome */ 147*7c478bd9Sstevel@tonic-gate #define P_AFSR_P_SYND 0x000000000000FFFFULL /* data parity syndrome */ 148*7c478bd9Sstevel@tonic-gate 149*7c478bd9Sstevel@tonic-gate /* 150*7c478bd9Sstevel@tonic-gate * All error types 151*7c478bd9Sstevel@tonic-gate */ 152*7c478bd9Sstevel@tonic-gate #define S_AFSR_ALL_ERRS (P_AFSR_STICKY & ~P_AFSR_PRIV) 153*7c478bd9Sstevel@tonic-gate 154*7c478bd9Sstevel@tonic-gate /* 155*7c478bd9Sstevel@tonic-gate * Shifts for Spitfire Asynchronous Fault Status Register 156*7c478bd9Sstevel@tonic-gate */ 157*7c478bd9Sstevel@tonic-gate #define P_AFSR_D_SIZE_SHIFT (57) 158*7c478bd9Sstevel@tonic-gate #define P_AFSR_CP_SHIFT (24) 159*7c478bd9Sstevel@tonic-gate #define P_AFSR_ETS_SHIFT (16) 160*7c478bd9Sstevel@tonic-gate 161*7c478bd9Sstevel@tonic-gate /* 162*7c478bd9Sstevel@tonic-gate * AFSR error bits for AFT Level 1 messages (uncorrected + parity + BERR + TO) 163*7c478bd9Sstevel@tonic-gate */ 164*7c478bd9Sstevel@tonic-gate #define P_AFSR_LEVEL1 (P_AFSR_UE | P_AFSR_EDP | P_AFSR_WP | P_AFSR_CP |\ 165*7c478bd9Sstevel@tonic-gate P_AFSR_LDP | P_AFSR_BERR | P_AFSR_TO) 166*7c478bd9Sstevel@tonic-gate 167*7c478bd9Sstevel@tonic-gate /* 168*7c478bd9Sstevel@tonic-gate * Bits of Spitfire Asynchronous Fault Status Register 169*7c478bd9Sstevel@tonic-gate */ 170*7c478bd9Sstevel@tonic-gate #define S_AFSR_MASK 0x00000001FFFFFFFFULL /* <33:0>: valid AFSR bits */ 171*7c478bd9Sstevel@tonic-gate 172*7c478bd9Sstevel@tonic-gate /* 173*7c478bd9Sstevel@tonic-gate * Bits of Spitfire Asynchronous Fault Address Register 174*7c478bd9Sstevel@tonic-gate * The Sabre AFAR includes more bits since it only has a UDBH, no UDBL 175*7c478bd9Sstevel@tonic-gate */ 176*7c478bd9Sstevel@tonic-gate #define S_AFAR_PA 0x000001FFFFFFFFF0ULL /* PA<40:4>: physical address */ 177*7c478bd9Sstevel@tonic-gate #define SABRE_AFAR_PA 0x000001FFFFFFFFF8ULL /* PA<40:3>: physical address */ 178*7c478bd9Sstevel@tonic-gate 179*7c478bd9Sstevel@tonic-gate /* 180*7c478bd9Sstevel@tonic-gate * Bits of Spitfire/Sabre/Hummingbird Error Enable Registers 181*7c478bd9Sstevel@tonic-gate */ 182*7c478bd9Sstevel@tonic-gate #define EER_EPEN 0x00000000000000010ULL /* enable ETP, EDP, WP, CP */ 183*7c478bd9Sstevel@tonic-gate #define EER_UEEN 0x00000000000000008ULL /* enable UE */ 184*7c478bd9Sstevel@tonic-gate #define EER_ISAPEN 0x00000000000000004ULL /* enable ISAP */ 185*7c478bd9Sstevel@tonic-gate #define EER_NCEEN 0x00000000000000002ULL /* enable the other errors */ 186*7c478bd9Sstevel@tonic-gate #define EER_CEEN 0x00000000000000001ULL /* enable CE */ 187*7c478bd9Sstevel@tonic-gate #define EER_DISABLE 0x00000000000000000ULL /* no errors enabled */ 188*7c478bd9Sstevel@tonic-gate #define EER_ECC_DISABLE (EER_EPEN|EER_UEEN|EER_ISAPEN) 189*7c478bd9Sstevel@tonic-gate #define EER_CE_DISABLE (EER_EPEN|EER_UEEN|EER_ISAPEN|EER_NCEEN) 190*7c478bd9Sstevel@tonic-gate #define EER_ENABLE (EER_EPEN|EER_UEEN|EER_ISAPEN|EER_NCEEN|EER_CEEN) 191*7c478bd9Sstevel@tonic-gate 192*7c478bd9Sstevel@tonic-gate /* 193*7c478bd9Sstevel@tonic-gate * Bits and vaddrs of Spitfire Datapath Error Registers 194*7c478bd9Sstevel@tonic-gate */ 195*7c478bd9Sstevel@tonic-gate #define P_DER_UE 0x00000000000000200ULL /* UE has occurred */ 196*7c478bd9Sstevel@tonic-gate #define P_DER_CE 0x00000000000000100ULL /* CE has occurred */ 197*7c478bd9Sstevel@tonic-gate #define P_DER_E_SYND 0x000000000000000FFULL /* SYND<7:0>: ECC syndrome */ 198*7c478bd9Sstevel@tonic-gate #define P_DER_H 0x0 /* datapath error reg upper */ 199*7c478bd9Sstevel@tonic-gate #define P_DER_L 0x18 /* datapath error reg upper */ 200*7c478bd9Sstevel@tonic-gate 201*7c478bd9Sstevel@tonic-gate /* 202*7c478bd9Sstevel@tonic-gate * Bits of Spitfire Datapath Control Register 203*7c478bd9Sstevel@tonic-gate */ 204*7c478bd9Sstevel@tonic-gate #define P_DCR_VER 0x000001E00 /* datapath version */ 205*7c478bd9Sstevel@tonic-gate #define P_DCR_F_MODE 0x000000100 /* send FCB<7:0> */ 206*7c478bd9Sstevel@tonic-gate #define P_DCR_FCB 0x0000000FF /* ECC check bits to force */ 207*7c478bd9Sstevel@tonic-gate #define P_DCR_H 0x20 /* datapath control reg upper */ 208*7c478bd9Sstevel@tonic-gate #define P_DCR_L 0x38 /* datapath control reg lower */ 209*7c478bd9Sstevel@tonic-gate 210*7c478bd9Sstevel@tonic-gate /* 211*7c478bd9Sstevel@tonic-gate * Bits and shifts for the Spitfire (S), Sabre (SB) and Hummingbird (HB) 212*7c478bd9Sstevel@tonic-gate * Ecache tag data 213*7c478bd9Sstevel@tonic-gate */ 214*7c478bd9Sstevel@tonic-gate #define S_ECTAG_MASK 0x000000000003FFFFFULL /* spitfire ecache tag mask */ 215*7c478bd9Sstevel@tonic-gate #define SB_ECTAG_MASK 0x00000000000000FFFULL /* sabre ecache tag mask */ 216*7c478bd9Sstevel@tonic-gate #define HB_ECTAG_MASK 0x0000000000000FFFFULL /* hbird ecache tag mask */ 217*7c478bd9Sstevel@tonic-gate #define S_ECSTATE_MASK 0x00000000001C00000ULL /* spitfire tag state mask */ 218*7c478bd9Sstevel@tonic-gate #define SB_ECSTATE_MASK 0x0000000000000C000ULL /* sabre tag state mask */ 219*7c478bd9Sstevel@tonic-gate #define HB_ECSTATE_MASK 0x00000000000030000ULL /* hbird tag state mask */ 220*7c478bd9Sstevel@tonic-gate #define S_ECPAR_MASK 0x0000000001E000000ULL /* spitfire tag parity mask */ 221*7c478bd9Sstevel@tonic-gate #define SB_ECPAR_MASK 0x00000000000030000ULL /* sabre tag parity mask */ 222*7c478bd9Sstevel@tonic-gate #define HB_ECPAR_MASK 0x00000000000300000ULL /* hbird tag parity mask */ 223*7c478bd9Sstevel@tonic-gate #define S_ECTAG_SHIFT 19 /* spitfire ecache tag shift */ 224*7c478bd9Sstevel@tonic-gate #define SB_ECTAG_SHIFT 18 /* sabre ecache tag shift */ 225*7c478bd9Sstevel@tonic-gate #define HB_ECTAG_SHIFT 16 /* hbird ecache tag shift */ 226*7c478bd9Sstevel@tonic-gate #define S_ECSTATE_SHIFT 22 /* spitfire tag state shift */ 227*7c478bd9Sstevel@tonic-gate #define SB_ECSTATE_SHIFT 14 /* sabre tag state shift */ 228*7c478bd9Sstevel@tonic-gate #define HB_ECSTATE_SHIFT 16 /* hbird tag state shift */ 229*7c478bd9Sstevel@tonic-gate #define S_ECPAR_SHIFT 25 /* spitfire tag parity shift */ 230*7c478bd9Sstevel@tonic-gate #define SB_ECPAR_SHIFT 16 /* sabre tag parity shift */ 231*7c478bd9Sstevel@tonic-gate #define HB_ECPAR_SHIFT 20 /* hbird tag parity shift */ 232*7c478bd9Sstevel@tonic-gate #define S_ECACHE_MAX_LSIZE 64 /* E$ line size */ 233*7c478bd9Sstevel@tonic-gate 234*7c478bd9Sstevel@tonic-gate /* 235*7c478bd9Sstevel@tonic-gate * Constants representing the complete Spitfire (S), Sabre (SB) and Hummingbird 236*7c478bd9Sstevel@tonic-gate * (HB) tag state: 237*7c478bd9Sstevel@tonic-gate */ 238*7c478bd9Sstevel@tonic-gate #define S_ECSTATE_SHR 0x1 /* shared */ 239*7c478bd9Sstevel@tonic-gate #define S_ECSTATE_EXL 0x3 /* exclusive */ 240*7c478bd9Sstevel@tonic-gate #define S_ECSTATE_OWN 0x5 /* owner */ 241*7c478bd9Sstevel@tonic-gate #define S_ECSTATE_MOD 0x7 /* modified */ 242*7c478bd9Sstevel@tonic-gate #define SB_ECSTATE_EXL 0x2 /* exclusive */ 243*7c478bd9Sstevel@tonic-gate #define SB_ECSTATE_MOD 0x3 /* modified */ 244*7c478bd9Sstevel@tonic-gate #define HB_ECSTATE_EXL 0x2 /* exclusive */ 245*7c478bd9Sstevel@tonic-gate #define HB_ECSTATE_MOD 0x3 /* modified */ 246*7c478bd9Sstevel@tonic-gate 247*7c478bd9Sstevel@tonic-gate /* 248*7c478bd9Sstevel@tonic-gate * Constants representing the individual Spitfire (S), Sabre (SB) and 249*7c478bd9Sstevel@tonic-gate * Hummingbird (HB) state bits: 250*7c478bd9Sstevel@tonic-gate */ 251*7c478bd9Sstevel@tonic-gate #define S_ECSTATE_VALID 0x1 /* line is valid */ 252*7c478bd9Sstevel@tonic-gate #define S_ECSTATE_DIRTY 0x4 /* line is dirty */ 253*7c478bd9Sstevel@tonic-gate #define SB_ECSTATE_VALID 0x2 /* line is valid */ 254*7c478bd9Sstevel@tonic-gate #define SB_ECSTATE_DIRTY 0x1 /* line is dirty */ 255*7c478bd9Sstevel@tonic-gate #define HB_ECSTATE_VALID 0x2 /* line is valid */ 256*7c478bd9Sstevel@tonic-gate #define HB_ECSTATE_DIRTY 0x1 /* line is dirty */ 257*7c478bd9Sstevel@tonic-gate 258*7c478bd9Sstevel@tonic-gate /* 259*7c478bd9Sstevel@tonic-gate * Constants representing the individual Spitfire (S), Sabre (SB) and 260*7c478bd9Sstevel@tonic-gate * Hummingbird (HB) state parity and address parity bits: 261*7c478bd9Sstevel@tonic-gate */ 262*7c478bd9Sstevel@tonic-gate #define S_ECSTATE_PARITY 0x8 /* tag state parity bit */ 263*7c478bd9Sstevel@tonic-gate #define S_EC_PARITY 0xF /* all parity bits */ 264*7c478bd9Sstevel@tonic-gate #define SB_ECSTATE_PARITY 0x2 /* tag state parity bit */ 265*7c478bd9Sstevel@tonic-gate #define SB_EC_PARITY 0x3 /* all parity bits */ 266*7c478bd9Sstevel@tonic-gate #define HB_ECSTATE_PARITY 0x2 /* tag state parity bit */ 267*7c478bd9Sstevel@tonic-gate #define HB_EC_PARITY 0x3 /* all parity bits */ 268*7c478bd9Sstevel@tonic-gate 269*7c478bd9Sstevel@tonic-gate #ifdef HUMMINGBIRD 270*7c478bd9Sstevel@tonic-gate 271*7c478bd9Sstevel@tonic-gate #define HB_ESTAR_MODE INT64_C(0x1FE0000F080) /* estar mode reg */ 272*7c478bd9Sstevel@tonic-gate #define HB_MEM_CNTRL0 INT64_C(0x1FE0000F010) /* mem control0 reg */ 273*7c478bd9Sstevel@tonic-gate #define HB_REFRESH_COUNT_MASK 0x7F00 /* mc0<14:8>: ref cnt */ 274*7c478bd9Sstevel@tonic-gate #define HB_REFRESH_COUNT_SHIFT 8 /* bits to shift */ 275*7c478bd9Sstevel@tonic-gate #define HB_REFRESH_INTERVAL INT64_C(7800) /* 7800 nsecs memory */ 276*7c478bd9Sstevel@tonic-gate /* refresh interval */ 277*7c478bd9Sstevel@tonic-gate /* works for all DIMM */ 278*7c478bd9Sstevel@tonic-gate /* same value as OBP */ 279*7c478bd9Sstevel@tonic-gate #define HB_REFRESH_CLOCKS_PER_COUNT INT64_C(64) /* cpu clks per count */ 280*7c478bd9Sstevel@tonic-gate #define HB_SELF_REFRESH_MASK 0x10000 /* mc0<16>: self ref */ 281*7c478bd9Sstevel@tonic-gate #define HB_SELF_REFRESH_SHIFT 16 /* bits to shift */ 282*7c478bd9Sstevel@tonic-gate #define HB_SELF_REFRESH_DISABLE 0 /* disable self ref */ 283*7c478bd9Sstevel@tonic-gate #define HB_SELF_REFRESH_ENABLE 1 /* enable self ref */ 284*7c478bd9Sstevel@tonic-gate 285*7c478bd9Sstevel@tonic-gate #define HB_ECLK_1 INT64_C(0x0000000000000000) /* 1/1 clock */ 286*7c478bd9Sstevel@tonic-gate #define HB_ECLK_2 INT64_C(0x0000000000000001) /* 1/2 clock */ 287*7c478bd9Sstevel@tonic-gate #define HB_ECLK_4 INT64_C(0x0000000000000003) /* 1/4 clock */ 288*7c478bd9Sstevel@tonic-gate #define HB_ECLK_6 INT64_C(0x0000000000000002) /* 1/6 clock */ 289*7c478bd9Sstevel@tonic-gate #define HB_ECLK_8 INT64_C(0x0000000000000004) /* 1/8 clock */ 290*7c478bd9Sstevel@tonic-gate #define HB_ECLK_MASK (HB_ECLK_1|HB_ECLK_2|HB_ECLK_4|HB_ECLK_6|HB_ECLK_8) 291*7c478bd9Sstevel@tonic-gate 292*7c478bd9Sstevel@tonic-gate 293*7c478bd9Sstevel@tonic-gate /* 294*7c478bd9Sstevel@tonic-gate * UPA Configuration Register 295*7c478bd9Sstevel@tonic-gate * 296*7c478bd9Sstevel@tonic-gate * +--------------+----+------+------+----------+------+-------------+ 297*7c478bd9Sstevel@tonic-gate * | Resv | RR | DM | ELIM | PCON | MID | PCAP | 298*7c478bd9Sstevel@tonic-gate * +--------------+----+------+------+----------+------+-------------+ 299*7c478bd9Sstevel@tonic-gate * 63 39 38 37..36 35..33 32......22 21..17 16..........0 300*7c478bd9Sstevel@tonic-gate * 301*7c478bd9Sstevel@tonic-gate */ 302*7c478bd9Sstevel@tonic-gate 303*7c478bd9Sstevel@tonic-gate #define HB_UPA_DMAP_DATA_BIT 36 /* loads and stores direct mapped */ 304*7c478bd9Sstevel@tonic-gate #define HB_UPA_DMAP_INSTR_BIT 37 /* instruction misses direct mapped */ 305*7c478bd9Sstevel@tonic-gate #define HB_UPA_RR_BIT 38 /* reset rand generator */ 306*7c478bd9Sstevel@tonic-gate 307*7c478bd9Sstevel@tonic-gate #endif /* HUMMINGBIRD */ 308*7c478bd9Sstevel@tonic-gate 309*7c478bd9Sstevel@tonic-gate /* 310*7c478bd9Sstevel@tonic-gate * The minimum size needed to ensure consistency on a virtually address 311*7c478bd9Sstevel@tonic-gate * cache. Computed by taking the largest virtually indexed cache and dividing 312*7c478bd9Sstevel@tonic-gate * by its associativity. 313*7c478bd9Sstevel@tonic-gate */ 314*7c478bd9Sstevel@tonic-gate #define S_VAC_SIZE 0x4000 315*7c478bd9Sstevel@tonic-gate 316*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 317*7c478bd9Sstevel@tonic-gate 318*7c478bd9Sstevel@tonic-gate #ifndef _ASM 319*7c478bd9Sstevel@tonic-gate #include <sys/kstat.h> 320*7c478bd9Sstevel@tonic-gate 321*7c478bd9Sstevel@tonic-gate void get_udb_errors(uint64_t *udbh, uint64_t *udbl); 322*7c478bd9Sstevel@tonic-gate 323*7c478bd9Sstevel@tonic-gate /* 324*7c478bd9Sstevel@tonic-gate * The scrub_misc structure contains miscellaneous bookeepping items for 325*7c478bd9Sstevel@tonic-gate * scrubbing the E$. 326*7c478bd9Sstevel@tonic-gate * 327*7c478bd9Sstevel@tonic-gate * Counter of outstanding E$ scrub requests. The counter for a given CPU id 328*7c478bd9Sstevel@tonic-gate * is atomically incremented and decremented _only_ on that CPU, 329*7c478bd9Sstevel@tonic-gate * to avoid cacheline ownership bouncing. 330*7c478bd9Sstevel@tonic-gate */ 331*7c478bd9Sstevel@tonic-gate 332*7c478bd9Sstevel@tonic-gate typedef struct spitfire_scrub_misc { 333*7c478bd9Sstevel@tonic-gate uint32_t ec_scrub_outstanding; /* outstanding reqs */ 334*7c478bd9Sstevel@tonic-gate int ecache_flush_index; /* offset into E$ for flush */ 335*7c478bd9Sstevel@tonic-gate int ecache_busy; /* keeps track if cpu busy */ 336*7c478bd9Sstevel@tonic-gate int ecache_nlines; /* no. of E$ lines */ 337*7c478bd9Sstevel@tonic-gate int ecache_mirror; /* E$ is mirrored */ 338*7c478bd9Sstevel@tonic-gate kstat_t *ecache_ksp; /* ptr to the kstat */ 339*7c478bd9Sstevel@tonic-gate } spitfire_scrub_misc_t; 340*7c478bd9Sstevel@tonic-gate 341*7c478bd9Sstevel@tonic-gate /* 342*7c478bd9Sstevel@tonic-gate * Spitfire module private data structure. One of these is allocated for each 343*7c478bd9Sstevel@tonic-gate * valid cpu at setup time and is pointed to by the machcpu "cpu_private" 344*7c478bd9Sstevel@tonic-gate * pointer. 345*7c478bd9Sstevel@tonic-gate */ 346*7c478bd9Sstevel@tonic-gate typedef struct spitfire_private { 347*7c478bd9Sstevel@tonic-gate spitfire_scrub_misc_t sfpr_scrub_misc; 348*7c478bd9Sstevel@tonic-gate uint64_t sfpr_scrub_afsr; 349*7c478bd9Sstevel@tonic-gate } spitfire_private_t; 350*7c478bd9Sstevel@tonic-gate 351*7c478bd9Sstevel@tonic-gate #endif /* !_ASM */ 352*7c478bd9Sstevel@tonic-gate 353*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 354*7c478bd9Sstevel@tonic-gate 355*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 356*7c478bd9Sstevel@tonic-gate } 357*7c478bd9Sstevel@tonic-gate #endif 358*7c478bd9Sstevel@tonic-gate 359*7c478bd9Sstevel@tonic-gate #endif /* _SYS_SPITREGS_H */ 360