cheetahregs.h revision af3c157a4e8d42cc096b1dd757e47d1c97101aee
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_CHEETAHREGS_H
#define _SYS_CHEETAHREGS_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef _KERNEL
#endif /* _KERNEL */
/*
* This file is cpu dependent.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Definitions of UltraSparc III cpu implementations as specified
* in version register
*/
#define CHEETAH_IMPL 0x14
/*
* Definitions of UltraSPARC III+ cpu implementation as specified
* in version register
*/
#define CHEETAH_PLUS_IMPL 0x15
/*
* Definitions of UltraSPARC IIIi cpu implementation as specified
* in version register. Jalapeno major and minor rev's are in
*/
#define JALAPENO_IMPL 0x16
/*
* Definitions of UltraSPARC IV cpu implementation as specified
* in version register. Jaguar major and minor rev's are in
*/
#define JAGUAR_IMPL 0x18
/*
* Definitions of UltraSPARC IIIi+ cpu implementation as specified
* in version register. Serrano major and minor rev's are in
*/
#define SERRANO_IMPL 0x22
/*
* Definitions of UltraSPARC IV+ cpu implementation as specified
* in version register. Panther major and minor rev's are in
*/
#define PANTHER_IMPL 0x19
/*
* Cheetah includes the process info in its mask to make things
* more difficult. The process is the low bit of the major mask,
* so to convert to the netlist major:
* netlist_major = ((mask_major >> 1) + 1)
*/
#ifdef _ASM
/*
* assembler doesn't understand the 'ull' suffix for C constants so
* use the inttypes.h macros and undefine them here for assembly code
*/
#define INT64_C(x) (x)
#define UINT64_C(x) (x)
#endif /* _ASM */
/*
* DCU Control Register
*
* +------+----+----+----+----+----+-----+-----+----+----+----+
* | Resv | CP | CV | ME | RE | PE | HPE | SPE | SL | WE | PM |
* +------+----+----+----+----+----+-----+-----+----+----+----+
* 63:50 49 48 47 46 45 44 43 42 41 40:33
*
* +----+----+----+----+----+----------+-----+----+----+----+---+
* | VM | PR | PW | VR | VW | Reserved | WIH | DM | IM | DC | IC|
* +----+----+----+----+----+----------+-----+----+----+----+---+
* 32:25 24 23 22 21 20:5 4 3 2 1 0
*/
/*
* bit shifts for the prefetch enable bit
*/
#define DCU_PE_SHIFT 45
/*
* Safari Configuration Register
*/
/*
* JBUS Configuration Register
*/
#define JBUS_CONFIG_ECLK_SHIFT 13
/*
*/
#define JP_MCU_FSM_SHIFT 25
#endif /* JALAPENO || SERRANO */
#if defined(SERRANO)
#endif /* SERRANO */
#if defined(JALAPENO) && defined(JALAPENO_ERRATA_85)
/*
* Tomatillo Estar control registers (for JP Errataum 85)
*/
#define JBUS_SLAVE_T_PORT_BIT 48
#define TOM_FULL_SPEED 0x1
#define TOM_HALF_SPEED 0x2
#define TOM_SLOW_SPEED 0x20
#define TOM_TRIGGER_MASK 0x18
#define TOM_TRIGGER 0x10
#endif /* JALAPENO && JALAPENO_ERRATA_85 */
/*
* Miscellaneous ASI definitions not in machasi.h
*/
/*
* Bits of Cheetah Asynchronous Fault Status Register
*
* +---+--+----+----+----+----+---+---+---+---+--+----
* |rsv|ME|PRIV|PERR|IERR|ISAP|EMC|EMU|IVC|IVU|TO|BERR
* +---+--+----+----+----+----+---+---+---+---+--+----
* 63:54 53 52 51 50 49 48 47 46 45 44 43
* +---+---+---+---+---+---+---+---+--+--+---+------+---+-------+
* |UCC|UCU|CPC|CPU|WDC|WDU|EDC|EDU|UE|CE|rsv|M_SYND|rsv||E_SYND|
* +---+---+---+---+---+---+---+---+--+--+---+------+---+-------+
* 42 41 40 39 38 37 36 35 34 33 32:20 19:16 15:9 8:0
*
*/
#if defined(CHEETAH_PLUS)
/*
* Bits of Cheetah+ Asynchronous Fault Status Register
*
* +------------------+----------------------------
* |rsv|TUE_SH|IMC|IMU|DTO|DBERR|THCE|TSCE|TUE|DUE|
* +------------------+---------------------------- . . .
* 63 62 61 60 59 58 57 56 55 54
*
* Note that bits 60-62 are only implemented in Panther (reserved
* in Cheetah+ and Jaguar. Also, bit 56 is reserved in Panther instead
* of TSCE since those errors are HW corrected in Panther.
*/
#endif /* CHEETAH_PLUS */
/* AFSR bits that could result in CPU removal due to E$ error */
/*
* Bits of the Panther Extended Asynchronous Fault Status Register (AFSR_EXT)
*
* +-----+-------+-----------+-------+-------+---------+------+------+------+
* | rsv |RED_ERR|EFA_PAR_ERR|L3_MECC|L3_THCE|L3_TUE_SH|L3_TUE|L3_EDC|L3_EDU|
* +-----+-------+-----------+-------+-------+---------+------+------+------+
* 63:14 13 12 11 10 9 8 7 6
*
* +------+------+------+------+------+------+
* |L3_UCC|L3_UCU|L3_CPC|L3_CPU|L3_WDC|L3_WDU|
* +------+------+------+------+------+------+
* 5 4 3 2 1 0
*
* If the L3_MECC bit is set along with any of the L3 cache errors (bits 0-7)
* above, it indicates that an address parity error has occured.
*/
/*
* Bits of Jalapeno Asynchronous Fault Status Register
*
* +-----+------------------------------------------------------------------
* | rsv |JETO|SCE|JEIC|JEIT|ME|PRIV|JEIS|IERR|ISAP|ETP|OM|UMS|IVPE|TO|BERR|
* +-----+------------------------------------------------------------------
* 63:58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43
*
* +---+---+---+---+---+---+---+---+--+--+---+---+--+---+-------+
* |UCC|UCU|CPC|CPU|WDC|WDU|EDC|EDU|UE|CE|RUE|RCE|BP|WBP|FRC|FRU|
* +---+---+---+---+---+---+---+---+--+--+---+---+--+---+-------+
* 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27
*
* +-----+-----+-----+------+-----------+-------+
* | JREQ| ETW | rsv |B_SYND| rsv | AID | E_SYND|
* +-----+-----+-----+------+-----+-----+-------+
* 26:24 23:22 21:20 19:16 15:14 13:9 8:0
*
*/
/*
* Bits of Serrano Asynchronous Fault Status Register
*
* +-----+------------------------------------------------------------------
* | rsv |JETO|SCE|JEIC|JEIT|ME|PRIV|JEIS|IERR|ISAP|ETU|OM|UMS|IVPE|TO|BERR|
* +-----+------------------------------------------------------------------
* 63:58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43
*
* +---+---+---+---+---+---+---+---+--+--+---+---+--+---+-------+
* |UCC|UCU|CPC|CPU|WDC|WDU|EDC|EDU|UE|CE|RUE|RCE|BP|WBP|FRC|FRU|
* +---+---+---+---+---+---+---+---+--+--+---+---+--+---+-------+
* 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27
*
* +-----+-----+------+---+------+---+---+-----+-------+
* | JREQ| ETW | EFES |ETS|B_SYND|ETI|ETC| AID | E_SYND|
* +-----+-----+------+---+------+---+---+-----+-------+
* 26:24 23:22 21 20 19:16 15 14 13:9 8:0
*
*/
#if defined(SERRANO)
#endif /* JALAPENO */
#if defined(SERRANO)
#endif /* SERRANO */
#if defined(SERRANO)
#endif /* SERRANO */
/* bit shifts for selected errors */
#define C_AFSR_WDU_SHIFT 37
#define C_AFSR_UCU_SHIFT 41
#define C_AFSR_UCC_SHIFT 42
#define C_AFSR_JREQ_SHIFT 24
#define C_AFSR_AID_SHIFT 9
/*
* Overloaded AFSR fields. During error processing, some of the reserved
* fields within the saved AFSR are overwritten with extra information.
*/
#define C_AFSR_PANIC_SHIFT 62
#define C_AFSR_IPE_SHIFT 59
#define C_AFSR_DPE_SHIFT 58
#else /* JALAPENO || SERRANO */
/* bit shifts for selected errors */
#define C_AFSR_WDU_SHIFT 37
#define C_AFSR_UCU_SHIFT 41
#define C_AFSR_UCC_SHIFT 42
#define C_AFSR_L3_UCU_SHIFT 4
/*
* Overloaded AFSR fields. During error processing, some of the reserved fields
* within the saved AFSR are overwritten with extra information.
*/
#define C_AFSR_FIRSTFLT_SHIFT 63
#define C_AFSR_PANIC_SHIFT 30
#define C_AFSR_DPE_SHIFT 20
#define C_AFSR_IPE_SHIFT 21
#endif /* JALAPENO || SERRANO */
/*
* Jalapeno L2 Cache Control Register Bits.
*
* Bit# Name Description
* 63-24 - reserved
* 23:20 EC_ACT_WAY (read only) indicates which sets are present
* 19:16 EC_BLK_WAY Bit mask indicating which sets are blocked
* from replacement
* 15:14 EC_SIZE L2 cache size
* 13:12 - reserved
* 11 EC_PAR_EN Enables parity checking on L2 cache tags
* 10 EC_ECC_EN Enables ECC checking on L2 cache data
* 9 EC_ECC_FORCE Enables EC_CHECK[8:0] onto L2 cache ECC bits
* 8:0 EC_CHECK ECC check vector to force onto ECC bits
*/
#define JP_ECCTRL_ECSIZE_MASK 0xc000
#define JP_ECCTRL_ECSIZE_SHIFT 14
#define JP_ECCTRL_ECSIZE_MIN 0x80000
/*
* Jalapeno L2 Cache Error Enable Register Bits
*
* Bit# Name Description
* 63-33 - reserved
* 32 SCDE Enable detection of JBUS control parity error
* 31:24 - reserved
* 23 IAEN Enable trap on illegal physical address
* 22 IERREN Enable FERR system reset on CPU internal errors
* 21 PERREN Enable FERR system reset on JBUS protocol errors
* 20 SCEN Enable FERR system reset on JBUS control parity error
* 19:11 FMED Forced error on the memory ECC
* 10 FME Force error on memory ECC
* 4 ETPEN Enable FERR system reset on L2 tags parity error
* 3 UCEEN Enable trap on SW handled external cache error
* 2 ISAPEN Enable FERR system reset on request parity error
* 1 NCEEN Enable trap on uncorrectable ECC error and system err
* 0 CEEN Enable trap on correctable ECC errors
*/
#define EN_REG_ENABLE \
#else /* JALAPENO || SERRANO */
#if defined(CHEETAH_PLUS)
/*
* Cheetah+ External Cache Control Register Bits.
*/
#define ECCR_ASSOC_SHIFT 24
#endif /* CHEETAH_PLUS */
/*
* Bits of Cheetah External Cache Error Enable Register
*
* +-----+-----+-------+-----+-------+-------+--------+-------+------+
* | rsv | FMT | FMECC | FMD | FDECC | UCEEN | ISAPEN | NCEEN | CEEN |
* +-----+-----+-------+-----+-------+-------+--------+-------+------+
* 63:19 18 17 14 13 12:4 3 2 1 0
*
*/
#define EN_REG_ENABLE \
#endif /* JALAPENO || SERRANO */
/*
* bit shifts for selected bits
*/
#define EN_REG_CEEN_SHIFT 0
#define CH_DCACHE_SIZE 0x10000
#define CH_DCACHE_LSIZE 0x20
#define CH_ICACHE_SIZE 0x8000
#define CH_ICACHE_LSIZE 0x20
/* Panther Icache size */
#define PN_ICACHE_SIZE 0x10000
/* Panther Icache linesize */
#define PN_ICACHE_LSIZE 0x40
/* Pcache size for the cheetah family of CPUs */
#define CH_PCACHE_SIZE 0x800
/* Pcache linesize for the cheetah family of CPUs */
#define CH_PCACHE_LSIZE 0x40
/*
* The cheetah+ CPU module handles Cheetah+, Jaguar, and Panther so
* we have to pick max size and min linesize values for the Icache
* accordingly.
*/
#define CHP_ICACHE_MAX_SIZE PN_ICACHE_SIZE
#define CHP_ICACHE_MIN_LSIZE CH_ICACHE_LSIZE
/*
* The minimum size needed to ensure consistency on a virtually address
* cache. Computed by taking the largest virtually indexed cache and dividing
* by its associativity.
*/
#define CH_VAC_SIZE 0x4000
/*
* The following definitions give the syndromes that will be seen when attempts
* are made to read data that has been intentionally poisoned. Intentional
* poisoning is performed when an error has been detected, and is designed to
* allow software to effectively distinguish between root problems and secondary
* effects. The following syndromes and their descriptions are taken from the
* UltraSPARC-III Cu Error Manual, Section 5.4.3.1.
*/
/*
* For a DSTAT = 2 or 3 event (see Sec 5.3.4.4) from the system bus for a
* cacheable load, data bits [1:0] are inverted in the data stored in the
* L2-cache. The syndrome seen when one of these signalling words is read will
* be 0x11c.
*/
#define CH_POISON_SYND_FROM_DSTAT23 0x11c
/*
* For an uncorrectable data ECC error from the L2-cache, data bits [127:126]
* are inverted in data sent to the system bus as part of a writeback or
* copyout. The syndrome seen when one of these signalling words is read will
* be 0x071.
*/
#define CH_POISON_SYND_FROM_XXU_WRITE 0x71
/*
* For uncorrectable data ECC error on the L2-cache read done to complete a
* store merge event, where bytes written by the processor are merged with
* bytes from an L2-cache line, ECC check bits [1:0] are inverted in the data
* scrubbed back to the L2-cache. The syndrome seen when one of these
* signalling words is read will be 0x003.
*/
#define CH_POISON_SYND_FROM_XXU_WRMERGE 0x3
/*
* To help understand the following definitions, this block of comments
* provides information on Cheetah's E$.
*
* Cheetah supports three different E$ sizes (1MB, 4MB, and 8MB). The
* number of E$ lines remains constant regardless of the size of the E$
* as does the subblock size, however the number of 64-byte subblocks per
* line varies depending on the E$ size.
*
* An E$ tag (for an E$ line) contains an EC_tag field, corresponding to the
* high order physical address bits of that E$ line's contents, and 1 to 8
* EC_state fields, indicating the state of each subblock. Due to the E$ line
* size variance depending on the total size of the E$, the number of bits in
* the EC_tag field varies as does the number of subblocks (and EC_state
* fields) per E$ line.
*
* A 1MB E$ has a line size of 64 bytes, containing 1 subblock per line.
* A 4MB E$ has a line size of 256 bytes, containing 4 subblocks per line.
* An 8MB E$ has a line size of 512 bytes, containing 8 subblocks per line.
*
* An E$ tag for a particular E$ line can be read via a diagnostic ASI
* as a 64-bit value.
* Within the E$ tag 64-bit value, the EC_tag field is interpreted as follows:
* - for a 1MB E$, the EC_tag is in bits <43:21> and corresponds
* to physical address bits <42:20> (bits <41:19> for Cheetah+)
* - for a 4MB E$, the EC_tag is in bits <43:23> and corresponds
* to physical address bits <42:22> (bits <41:21> for Cheetah+)
* - for an 8MB E$, the EC_tag is in bits <43:24> and corresponds
* to physical address bits <42:23> (bits <41:22> for Cheetah+)
* Within the E$ tag 64-bit value, the EC_state field(s) is(are) interpreted
* as follows:
* - for a 1MB E$, EC_state0 is in bits <2:0>
* - for a 4MB E$, EC_state0 is in bits <2:0>, EC_state1 is in
* bits <5:3>, EC_state2 is in bits <8:6>, EC_state3 is
* in bits <11:9>
* - for an 8MB E$, EC_state0 is in bits <2:0>, EC_state1 is in
* bits <5:3>, EC_state2 is in bits <8:6>, EC_state3 is
* in bits <11:9>, EC_state4 is in bits <14:12>, EC_state5
* is in bits <17:15>, EC_state6 is in bits <20:18>,
* EC_state7 is in bits <23:21>
* Note that each EC_state field contains a value representing the state
* of its corresponding subblock.
*
*/
/*
*
* couple of differences :
* - Jaguar Ecache only comes in 4MB and 8MB versions.
* - 8MB E$ has 2 64 byte subblocks per line.
* - 4MB E$ has 1 64 byte subblock per line.
*
* An E$ tag for a particular E$ line can be read via a diagnostic ASI
* as a 64-bit value.
* Within the E$ tag 64-bit value, the EC_tag field is interpreted as follows:
* - for a 4MB E$, the EC_tag is in bits <41:21> and corresponds
* to physical address bits <41:21>
* - for a 8MB E$, the EC_tag is in bits <41:22> and corresponds
* to physical address bits <41:22>
*
* The Jaguar E$ tag also contains LRU field in bit <42> which must be
* masked off when the tag value is being compared to a PA.
*
* Within the E$ tag 64-bit value, the EC_state field(s) is(are) interpreted
* as follows:
* - for 4MB E$, EC_state0 is in bits <2:0>
* - for 8MB E$, EC_state0 is in bits <2:0>, EC_state1 is in bits <5:3>.
* Each EC_state field contains a value representing the state of its
* corresponding subblock.
*
* Note that the subblock size and state values are the same for both
*/
/* Ecache sizes */
#define CH_ECACHE_8M_SIZE 0x800000
#define CH_ECACHE_4M_SIZE 0x400000
#define CH_ECACHE_1M_SIZE 0x100000
#define PN_L2_SIZE 0x200000
#define PN_L2_LINESIZE 64
#define PN_L2_ECC_WORDS 2
#define PN_L2_NWAYS 4
#define PN_L2_WAY_SHIFT 19
#define PN_L3_SIZE 0x2000000
#define PN_L3_LINESIZE 64
#define PN_L3_NWAYS 4
#define PN_L3_WAY_SHIFT 23
/* Pcache Defines */
#define PN_PCACHE_NWAYS 4
/* Cheetah Ecache is direct-mapped, Cheetah+ can be 2-way or direct-mapped */
#define CH_ECACHE_NWAY 1
#if defined(CHEETAH_PLUS)
#define CHP_ECACHE_NWAY 2
#define PN_ECACHE_NWAY 4
#endif /* CHEETAH_PLUS */
#define JP_ECACHE_NWAY 4
#define JP_ECACHE_NWAY_SHIFT 2
#endif /* JALAPENO || SERRANO */
/* Maximum Ecache size */
#define CH_ECACHE_MAX_SIZE CH_ECACHE_8M_SIZE
/* Minimum Ecache line size */
#define CH_ECACHE_MIN_LSIZE 64
/* Maximum Ecache line size - 8Mb Ecache has 512 byte linesize */
#define CH_ECACHE_MAX_LSIZE 512
/* Size of Ecache data staging register size (see Cheetah PRM 10.7.2) */
#define CH_ECACHE_STGREG_SIZE 32
/* The number of staging registers containing data, for ASI_EC_DATA */
/* Size of Ecache data subblock which has state field in Ecache tag */
#define CH_ECACHE_SUBBLK_SIZE 64
#define CH_ECACHE_SUBBLK_SHIFT 6
#define JP_ECACHE_MAX_SIZE 0x400000
#endif /* JALAPENO || SERRANO */
/*
* Maximum ecache setsize to support page coloring of heterogenous
* cheetah+ cpus. Max ecache setsize is calculated to be the max ecache size
* divided by the minimum associativity of the max ecache.
*
* NOTE: CHP_ECACHE_MAX_SIZE and CHP_ECACHE_MIN_NWAY need to be updated with
* new cheetah+ cpus. The maximum setsize may not necessarily be associated with
* the max ecache size if the cache associativity is large. If so, MAX_SETSIZE
* needs to be updated accordingly.
*/
#if defined(CHEETAH_PLUS)
#endif /* CHEETAH_PLUS */
/*
* Bits to shift EC_tag field of E$ tag to form PA
* (See Cheetah PRM 10.7.4, Cheetah+ Delta PRM 10.7)
*/
#define CH_ECTAG_PA_SHIFT 18
#elif defined(CHEETAH_PLUS)
#define CH_ECTAG_PA_SHIFT 2
#else /* CHEETAH_PLUS */
#define CH_ECTAG_PA_SHIFT 1
#endif /* CHEETAH_PLUS */
#define PN_L3TAG_PA_SHIFT 1
/*
*
* +-----------+--------+--------+----------------------+
* | - | EC_par |EC_state| EC_tag = PA[42:18] |
* +-----------+--------+--------+----------------------+
* 63:29 28 27:25 24:0
*/
/*
* Constants representing the complete Jalapeno Ecache tag state:
*/
#define JP_ECTAG_STATE_SHIFT 25
#define CH_ECSTATE_SIZE JP_ECSTATE_SIZE
#define CH_ECSTATE_MASK JP_ECSTATE_MASK
#define CH_ECSTATE_INV JP_ECSTATE_INV
#define CH_ECSTATE_SHR JP_ECSTATE_SHR
#define CH_ECSTATE_EXL JP_ECSTATE_EXL
#define CH_ECSTATE_OWN JP_ECSTATE_OWN
#define CH_ECSTATE_MOD JP_ECSTATE_MOD
#define CH_ECSTATE_RES1 JP_ECSTATE_RES1
#define CH_ECSTATE_OWS JP_ECSTATE_RES3
#define CH_ECSTATE_RES2 JP_ECSTATE_RES2
/* Number of subblock states per Ecache line. */
/* Mask for Tag state(s) field, 3 bits per subblock state. */
#define CH_ECTAG_STATE_MASK(totalsize) \
/* For a line to be invalid, all of its subblock states must be invalid. */
/* Build address mask for tag physical address bits. */
/* Get physical address bits from the EC_tag field of an E$ tag */
/* Given a physical address, compute index for subblock tag state. */
/* Given a physical address and assoc. tag, get the subblock state. */
#else /* JALAPENO || SERRANO */
/*
* Constants representing the complete Cheetah Ecache tag state:
*/
/*
* Macros for Cheetah Ecache tags
*/
/* Number of subblock states per Ecache line. */
/* Mask for Tag state(s) field, 3 bits per subblock state. */
#define CH_ECTAG_STATE_MASK(totalsize) \
((uint64_t) \
/* For a line to be invalid, all of its subblock states must be invalid. */
/* Build address mask for tag physical address bits. */
/* Get physical address bits from the EC_tag field of an E$ tag */
/* Given a physical address, compute index for subblock tag state. */
/* Given a physical address and assoc. tag, get the subblock state. */
(((tag) >> \
#endif /* JALAPENO || SERRANO */
/* Panther only has one EC_State field in the L3 tag */
/* Panther only has one State field in the L2 tag */
/* Get physical address bits from the EC_tag field of an L3$ tag */
/* Get physical address bits from the tag field of an L2$ tag */
/*
* Jalapeno L2 Cache ASI_ECACHE_FLUSH:
* +-------+-----------------+--------+---+-----+-------------+------+
* | - | Port_ID | - | EC_Way | 1 | - | EC_Tag_Addr | - |
* +-------+-----------------+--------+---+-----+-------------+------+
* 63:41 40:36 35:34 33:32 31 30:18 17:6 5:0
*/
#define JP_EC_TO_SET_SIZE_SHIFT 2
#define JP_ECFLUSH_PORTID_SHIFT 36
#define JP_ECFLUSH_EC_WAY_SHIFT 32
#endif /* JALAPENO || SERRANO */
/*
* Macros for Jaguar Ecache tags
*/
/* Ecache sizes */
#define JG_ECACHE_8M_SIZE 0x800000
#define JG_ECACHE_4M_SIZE 0x400000
/* Jaguar E$ tag LRU mask */
/*
* so rather than duplicating existing defn's we can use the Cheetah+ versions
* in the Jaguar defn's below.
*/
/* Number of subblock states per Ecache line. */
/* Mask for Tag state(s) field, 3 bits per subblock state. */
#define JG_ECTAG_STATE_MASK(totalsize) \
((uint64_t) \
/* For a line to be invalid, all of its subblock states must be invalid. */
/* Build address mask for tag physical address bits. */
(int)(setsize))
/* Get physical address bits from the EC_tag field of an E$ tag */
/* Given a physical address, compute index for subblock tag state. */
/* Given a physical address and assoc. tag, get the subblock state. */
(((tag) >> \
#if defined(CHEETAH_PLUS)
/*
* Cheetah+ Tag ECC Bit and Displacement Flush Bit in Ecache Tag Access.
* See Cheetah+ Delta PRM 10.7
*/
#endif /* CHEETAH_PLUS */
/*
* Macros for Cheetah Dcache diagnostic accesses.
*/
/*
* Dcache Index Mask for bits from *AFAR*. Note that Dcache is virtually
* indexed, so only bits [12:5] are valid from the AFAR. This
* means we have to search through the 4 ways + bit 13 (i.e. we have
* to try 8 indexes).
*/
#define CH_DCACHE_IDX_MASK 0x01fe0
#define CH_DCACHE_IDX_INCR 0x02000
#define CH_DCACHE_IDX_LIMIT 0x10000
#define CH_DCACHE_NWAY 4
#define CH_DCACHE_WAY_MASK 0x0c000
#define CH_DCACHE_WAY_SHIFT 14
#define CH_DCTAG_PA_SHIFT 12
#define CH_DCUTAG_IDX_MASK 0x03fe0
#define CH_DC_DATA_REG_SIZE 32
#define CH_DC_UTAG_MASK 0xff
#define CHP_DC_TAG 0x1
#define CHP_DC_SNTAG 0x2
#define PN_DC_DATA_PARITY_SHIFT 8
#define PN_DC_DATA_PARITY_MASK 0xff
#define PN_DC_DATA_ALL_PARITY_MASK 0xffffffff
#endif /* CHEETAH_PLUS || JALAPENO || SERRANO */
#define PN_DC_DATA_PARITY_BIT_SHIFT 16
/*
* Macros for Cheetah Icache diagnostic accesses.
*/
/*
* Icache Index Mask for bits from *AFAR*. Note that the Icache is virtually
* indexed for Panther and physically indexed for other CPUs. For Panther,
* we obtain an index by looking at bits[12:6] of the AFAR PA and we check
* both lines associated with bit 13 = 0 or 1 (total of 8 entries to check).
* For non-Panther CPUs we get our index by just looking at bits[12:5] of
* the AFAR PA (total of 4 entries to check). The Icache index is also
* confusing because we need to shift the virtual address bits left by one
* for the index.
*/
#define CH_ICACHE_IDX_MASK 0x01fe0
#define PN_ICACHE_IDX_MASK 0x03fc0
#define PN_ICACHE_VA_IDX_MASK 0x01fc0
#define CH_ICACHE_IDX_SHIFT 1
#define CH_ICACHE_IDX_INCR 0x04000
#define PN_ICACHE_IDX_INCR 0x08000
#define CH_ICACHE_IDX_LIMIT 0x10000
#define PN_ICACHE_IDX_LIMIT 0x20000
#define CH_ICACHE_NWAY 4
#define CH_ICACHE_WAY_MASK 0x0c000
#define CH_ICACHE_WAY_SHIFT 14
#define PN_ICACHE_WAY_MASK 0x18000
#define PN_ICACHE_WAY_SHIFT 15
#define CH_ICTAG_PA 0x00
#define CH_ICTAG_UTAG 0x08
#define CH_ICTAG_UPPER 0x10
#define CH_ICTAG_LOWER 0x30
#define CH_ICTAG_TMASK 0x3f
#define CH_ICPATAG_SHIFT 5
((pa) & CH_ICPATAG_MASK))
#if defined(CHEETAH_PLUS)
CH_ICLOWER_VALID) && \
#else /* CHEETAH_PLUS */
#define PN_ICUTAG_TO_VA(tag) 0
#endif /* CHEETAH_PLUS */
#define CH_IC_DATA_REG_SIZE 64
#define PN_IC_DATA_REG_SIZE 128
/*
* Cheetah+ Icache data parity masks, see Cheetah+ Delta PRM 7.3
* PC-relative instructions have different bits protected by parity.
* Predecode bit 7 is not parity protected and indicates if the instruction
* is PC-relative or not.
*/
#define CHP_IC_TAG 0x1
#define CHP_IC_SNTAG 0x2
#endif /* CHEETAH_PLUS || JALAPENO || SERRANO */
#if defined(CHEETAH_PLUS)
#define PN_IPB_TAG_ADDR_LINESIZE 0x40
#define PN_IPB_TAG_ADDR_MAX 0x3c0
#endif /* CHEETAH_PLUS */
/*
* Macros for Pcache diagnostic accesses.
*/
#define CH_PC_WAY_MASK 0x600
#define CH_PC_WAY_SHIFT 9
#define CH_PC_DATA_REG_SIZE 64
#define CH_PCACHE_NWAY 4
#define PN_PC_PARITY_SHIFT 50
#define PN_PC_PARITY_MASK 0xff
#define PN_PC_PARITY_BITS(status) \
#define CH_PCTAG_ADDR_SHIFT 6
#define CH_PC_PA_MASK 0x7ffffffffc0
#define CH_PCTAG_BNK0_VALID_MASK 0x2000000000000000
#define CH_PCTAG_BNK1_VALID_MASK 0x1000000000000000
0)
0)
/*
* CPU Log Out Structure parameters.
* This structure is filled in by the Error Trap handlers and captures the
* For Cheetah Phase II, this structure is filled in at the TL=0 code. For
* Cheetah Phase III, this will be filled in at the trap handlers.
*/
/*
* We use this to mark the LOGOUT structure as invalid. Note that
* this cannot be a valid AFAR, as AFAR bits outside of [41:5] should always
* be zero.
*/
#define LOGOUT_INVALID_U32 0xecc1ecc1
#define LOGOUT_INVALID_L32 0xecc1ecc1
/*
* Max number of TLs to support for Fast ECC or Cache Parity Errors
* at TL>0. Traps are OK from TL=1-2, at TL>=3, we will Red Mode.
*/
#define CH_ERR_TL1_TLMAX 2
/*
* Software traps used by TL>0 handlers.
*/
#define SWTRAP_0 0 /* Used by Fast ECC */
/*
* Bit mask defines for various Cheetah Error conditions.
*/
#define CH_ERR_ME_FLAGS(x) ((x) >> CH_ERR_ME_SHIFT)
/*
* Defines for Bit8 (CH_ERR_TSTATE_IC_ON) and Bit9 (CH_ERR_TSTATE_DC_ON)
* in %tstate, which is used to remember D$/I$ state on Fast ECC handler
* at TL>0. Note that DCU_IC=0x1, DCU_DC=0x2.
*/
#define CH_ERR_G2_TO_TSTATE_SHFT 10
#define CH_ERR_DCU_TO_TSTATE_SHFT 8
/*
* Multiple offset TL>0 handler structure elements
*/
/*
* Interval for deferred CEEN reenable
*/
#define CPU_CEEN_DELAY_SECS 6
/*
* flags for flt_trapped_ce variable
*/
/*
* default value for cpu_ce_not_deferred
*/
#define CPU_CE_NOT_DEFERRED (C_AFSR_CECC_ERRS & \
#else /* JALAPENO || SERRANO */
#define CPU_CE_NOT_DEFERRED C_AFSR_CECC_ERRS & \
~(C_AFSR_CE | C_AFSR_EMC)
#endif /* JALAPENO || SERRANO */
#if defined(CHEETAH_PLUS)
/*
*/
#define ASI_SHADOW_REG_VA 0x8
#define ASI_AFSR_EXT_VA 0x10
#define ASI_SHADOW_AFSR_EXT_VA 0x18
/*
* Bitmask for keeping track of core parking in ECC error handlers.
* We share a register that also saves the DCUCR value so we use
* one of the reserved bit positions of the DCUCR register to keep
* track of whether or not we have parked our sibling core.
*/
#define PN_PARKED_OTHER_CORE 0x20
#define PN_BOTH_CORES_RUNNING 0x3
/*
* Panther EMU Activity Status Register Bits.
*/
#define ASI_EMU_ACT_STATUS_VA 0x18
#endif /* CHEETAH_PLUS */
#define ASR_DISPATCH_CONTROL %asr18
#define ASR_DISPATCH_CONTROL_BPE 0x20
/*
* Max number of E$ sets logged in ch_diag_data structure
*/
/*
* Definitions for Panther TLB parity handling.
*/
#define PN_ITLB_NWAYS 2
#define PN_NUM_512_ITLBS 1
#define PN_DTLB_NWAYS 2
#define PN_NUM_512_DTLBS 2
#define PN_SFSR_PARITY_SHIFT 12
#define PN_ITLB_PGSZ_SHIFT 22
#define PN_DTLB_PGSZ0_SHIFT 16
#define PN_DTLB_PGSZ1_SHIFT 19
#define PN_TLO_INFO_IMMU_SHIFT 14
#define PN_TLO_INFO_TL1_SHIFT 13
#define PN_TLB_ACC_IDX_SHIFT 3
/*
* tag parity = XOR(Size[2:0],Global,VA[63:21],Context[12:0])
* which requires looking at both the tag and the data.
*/
#define PN_TLB_TAG_PARITY_TAG_MASK 0xffffffffffe01fff
#define PN_TLB_TAG_PARITY_DATA_MASK 0x6001400000000001
/* data parity = XOR(NFO,IE,PA[42:13],CP,CV,E,P,W) */
#define PN_TLB_DATA_PARITY_DATA_MASK 0x180087ffffffe03e
#ifdef _KERNEL
#ifndef _ASM
/*
* One Ecache data element, 32 bytes of data, 8 bytes of ECC.
* See Cheetah PRM 10.7.2.
*/
typedef struct ec_data_elm {
/*
* L2 and L3 cache data captured by cpu log out code.
* See Cheetah PRM 10.7.4.
*/
typedef struct ch_ec_data {
} ch_ec_data_t;
/*
* Dcache data captured by cpu log out code and get_dcache_dtag.
* See Cheetah PRM 10.6.[1-4].
*/
typedef struct ch_dc_data {
} ch_dc_data_t;
/*
* Icache data captured by cpu log out code and get_icache_dtag.
* See Cheetah PRM 10.4.[1-3].
*/
typedef struct ch_ic_data {
} ch_ic_data_t;
/*
* Pcache data captured by get_pcache_dtag
*/
typedef struct ch_pc_data {
} ch_pc_data_t;
/*
* CPU Error State
*/
typedef struct ch_cpu_errors {
/*
* The following registers don't exist on cheetah
*/
/*
* CPU logout structures.
* NOTE: These structures should be the same for Cheetah, Cheetah+,
* Jaguar, Panther, and Jalapeno since the assembler code relies
* on one set of offsets. Panther is the only processor that
* uses the chd_l2_data field since it has both L3 and L2 caches.
*/
typedef struct ch_diag_data {
/*
* Top level CPU logout structure.
* clo_flags is used to hold information such as trap type, trap level,
* CEEN value, etc that is needed by the individual trap handlers. Not
* all fields in this flag are used by all trap handlers but when they
* are used, here's how they are laid out:
*
* |-------------------------------------------------------|
* | | trap type | trap level | |UCEEN| |NCEEN|CEEN|
* |-------------------------------------------------------|
* 63 19 12 11 8 3 2 1 0
*
* Note that the *CEEN bits correspond exactly to the same bit positions
* that are used in the error enable register.
*/
typedef struct ch_cpu_logout {
typedef struct ch_tte_entry {
/*
* Top level CPU logout structure for TLB parity errors.
*
* tlo_logflag - Flag indicates if data was logged
* tlo_info - Used to keep track of a number of values:
* itlb pgsz - Page size of the VA whose lookup in the ITLB caused
* the exception (from ASI_IMMU_TAG_ACCESS_EXT.)
* dtlb pgsz1 - Page size of the VA whose lookup in the DTLB T512_1
* caused the exception (from ASI_DMMU_TAG_ACCESS_EXT.).
* dtlb pgsz0 - Page size of the VA whose lookup in the DTLB T512_0
* caused the exception (from ASI_DMMU_TAG_ACCESS_EXT.).
* immu - Trap is the result of an ITLB exception if immu == 1.
* Otherwise, for DTLB exceptions immu == 0.
* tl1 - Set to 1 if the exception occured at TL>0.
* context - Context of the VA whose lookup in the TLB caused the
* exception (from ASI_[I|D]MMU_TAG_ACCESS.)
* |---------------------------------------------------------------------|
* |...| itlb pgsz | dtlb pgsz1 | dtlb pgsz0 |...| immu | tl1 | context |
* |---------------------------------------------------------------------|
* 24 22 21 19 18 16 14 13 12 0
*
* tlo_addr - VA that cause the MMU exception trap.
* tlo_pc - PC where the exception occured.
* tlo_itlb_tte - TTEs that were in the ITLB after the trap at the index
* specific to the VA and page size in question.
* tlo_dtlb_tte - TTEs that were in the DTLB after the trap at the index
* specific to the VA and page size in question.
*/
typedef struct pn_tlb_logout {
#if defined(CPU_IMP_L1_CACHE_PARITY)
/*
* Parity error logging structure.
*/
typedef union ch_l1_parity_log {
struct {
int cpl_way; /* Faulty line way */
int cpl_off; /* Faulty line offset */
int cpl_tag; /* Faulty tags list */
int cpl_lcnt; /* Faulty cache lines */
int cpl_cache; /* error in D$ or P$? */
} dpe; /* D$ parity error */
struct {
int cpl_way; /* Faulty line way */
int cpl_off; /* Faulty line offset */
int cpl_tag; /* Faulty tags list */
int cpl_lcnt; /* Faulty cache lines */
} ipe; /* I$ parity error */
#endif /* CPU_IMP_L1_CACHE_PARITY */
/*
* Error at TL>0 CPU logout data.
* Needs some extra space to save %g registers and miscellaneous info.
*/
typedef struct ch_err_tl1_data {
/* Indices into chsm_outstanding and friends */
#define CACHE_SCRUBBER_INFO_E 0
#define CACHE_SCRUBBER_INFO_D 1
#define CACHE_SCRUBBER_INFO_I 2
/* We define 3 scrubbers: E$, D$, and I$ */
#define CACHE_SCRUBBER_COUNT 3
/*
* The ch_scrub_misc structure contains miscellaneous bookkeeping
* items for scrubbing the I$, D$, and E$.
*
* For a description of the use of chsm_core_state and why it's not needed
* on Jaguar, see the comment above cpu_scrub_cpu_setup() in us3_cheetahplus.c.
*/
typedef struct ch_scrub_misc {
/* outstanding requests */
/* next line to flush */
/* is this scrubber enabled on this core? */
int chsm_ecache_nlines; /* no. of E$ lines */
int chsm_ecache_busy; /* keeps track if cpu busy */
int chsm_icache_nlines; /* no. of I$ lines */
int chsm_core_state; /* which core the scrubber is */
/* running on (Panther only) */
/*
* Cheetah module private data structure. One of these is allocated for
* each valid cpu at setup time and is pointed to by the machcpu
* "cpu_private" pointer. For Cheetah, we have the miscellaneous scrubber
* variables and cpu log out structures for Fast ECC traps at TL=0,
* Disrupting (correctable) traps and Deferred (asynchronous) traps. For
* Disrupting traps only one log out structure is needed because we cannot
* get a TL>0 disrupting trap since it obeys IE. For Deferred traps we
* cannot get a TL>0 because we turn off NCEEN during log out capture. E$
* set size (E$ size / nways) is saved here to avoid repeated calculations.
* NB: The ch_err_tl1_data_t structures cannot cross a page boundary
* because we use physical addresses to access them. We ensure this
* by allocating them near the front of cheetah_private_t, which is
* aligned on PAGESIZE (8192) via kmem_cache_create, and by ASSERTing
* sizeof (chpr_tl1_err_data) <= CH_ECACHE_MAX_LSIZE in the
* cpu_init_private routines.
* NB: chpr_icache_size and chpr_icache_linesize need to be at the front
* of cheetah_private_t because putting them after chpr_tl1_err_data
* would make their offsets > 4195.
*/
typedef struct cheetah_private {
int chpr_icache_size;
int chpr_icache_linesize;
int chpr_ec_set_size;
int chpr_ceptnr_id;
#endif /* _ASM */
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_CHEETAHREGS_H */