wci_common.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 (c) 2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/cheetahregs.h>
#include <sys/wci_offsets.h>
#include <sys/wci_regs.h>
#include <sys/wci_common.h>
/* busstat-style kstats support */
/* Use predefined strings to name the kstats from this driver. */
#define WCI_KSTAT_NAME "%s"
#define WCI_LPBK_KSTAT_NAME "%slpbk"
#define WCI_LINK_KSTAT_NAME "%slink"
#define WCI_SFI_KSTAT_NAME "%ssfi"
#define EOSTR "\0"
/*
* Function prototypes
*/
static void wci_add_misc_kstats(struct wci_common_soft_state *, char *);
static void wci_add_lpbk_kstats(struct wci_common_soft_state *, char *);
static void wci_add_link_kstats(struct wci_common_soft_state *, char *);
static void wci_add_sfi_kstats(struct wci_common_soft_state *, char *);
static void wci_add_misc_pic_kstats(char *);
static void wci_add_lpbk_pic_kstats(char *);
static void wci_add_link_pic_kstats(char *);
static void wci_add_sfi_pic_kstats(char *);
static int wci_misc_kstat_update(kstat_t *, int);
static int wci_lpbk_kstat_update(kstat_t *, int);
static int wci_link_kstat_update(kstat_t *, int);
static int wci_sfi_kstat_update(kstat_t *, int);
/* this varible is used in wci_link_kstat_update() routine */
static int wci_link_kstat_modlen;
/* Wildcat ECC error handling support */
void
{
if (t_afsr == RA_ECC_MTAG_CE) {
"AFSR 0x%08x.%08x AFAR 0x%08x.%08x MemMod %s "
"Id %d\n",
}
if (t_afsr == RA_ECC_DATA_CE) {
"AFSR 0x%08x.%08x AFAR 0x%08x.%08x MemMod %s "
"Id %d\n",
}
if (t_afsr == HA_ECC_MTAG_CE) {
"AFSR 0x%08x.%08x AFAR 0x%08x.%08x MemMod %s "
"Id %d\n",
}
if (t_afsr == HA_ECC_DATA_CE) {
"AFSR 0x%08x.%08x AFAR 0x%08x.%08x MemMod %s "
"Id %d\n",
}
if (t_afsr == SA_ECC_MTAG_CE) {
"AFSR 0x%08x.%08x AFAR 0x%08x.%08x MemMod %s "
"Id %d\n",
}
if (t_afsr == SA_ECC_DATA_CE) {
"AFSR 0x%08x.%08x AFAR 0x%08x.%08x MemMod %s "
"Id %d\n",
}
if (t_afsr == CA_ECC_MTAG_CE) {
"AFSR 0x%08x.%08x AFAR 0x%08x.%08x MemMod %s "
"Id %d\n",
}
if (t_afsr == CA_ECC_DATA_CE) {
"AFSR 0x%08x.%08x AFAR 0x%08x.%08x MemMod %s "
"Id %d\n",
}
}
/*
* WCI Performance Events.
*
* For each pic there is an array of event-names and event-masks.
* The num of events in this array is WCI_NUM_EVENTS + 1
* (num of WCI events) + (clear_pic event)
*
*/
/* Misc Counter */
static wci_event_mask_t
/* pic 0 */
{
/* SFI agent */
{"sfi_sfi_histogram0", SFI_SFI_HISTOGRAM0},
{"sfi_sfi_histogram1", SFI_SFI_HISTOGRAM1},
{"sfi_atransid_alloc_1", SFI_ATRANSID_ALLOC_1},
{"sfi_atransid_alloc_4", SFI_ATRANSID_ALLOC_4},
{"sfi_atransid_alloc_8", SFI_ATRANSID_ALLOC_8},
{"sfi_atransid_alloc_10", SFI_ATRANSID_ALLOC_10},
{"sfi_atransid_alloc_12", SFI_ATRANSID_ALLOC_12},
{"sfi_atransid_dealloc", SFI_ATRANSID_DEALLOC},
{"sfi_targid_alloc_0", SFI_TARGID_ALLOC_0},
{"sfi_targid_alloc_2", SFI_TARGID_ALLOC_2},
{"sfi_targid_alloc_8", SFI_TARGID_ALLOC_8},
{"sfi_targid_dealloc", SFI_TARGID_DEALLOC},
{"sfi_p0_req_valid", SFI_P0_REQ_VALID},
{"sfi_p1_req_valid", SFI_P1_REQ_VALID},
{"sfi_p2_req_valid", SFI_P2_REQ_VALID},
{"sfi_p3_req_valid", SFI_P3_REQ_VALID},
{"sfi_p4_req_valid", SFI_P4_REQ_VALID},
{"sfi_p5_req_valid", SFI_P5_REQ_VALID},
{"sfi_p6_req_valid", SFI_P6_REQ_VALID},
{"sfi_p7_req_valid", SFI_P7_REQ_VALID},
{"sfi_p8_req_valid", SFI_P8_REQ_VALID},
{"sfi_p9_req_valid", SFI_P9_REQ_VALID},
{"sfi_p10_req_valid", SFI_P10_REQ_VALID},
{"sfi_p11_req_valid", SFI_P11_REQ_VALID},
{"sfi_p12_req_valid", SFI_P12_REQ_VALID},
{"sfi_p0_grant", SFI_P0_GRANT},
{"sfi_p1_grant", SFI_P1_GRANT},
{"sfi_p2_grant", SFI_P2_GRANT},
{"sfi_p3_grant", SFI_P3_GRANT},
{"sfi_p4_grant", SFI_P4_GRANT},
{"sfi_p5_grant", SFI_P5_GRANT},
{"sfi_p6_grant", SFI_P6_GRANT},
{"sfi_p7_grant", SFI_P7_GRANT},
{"sfi_p8_grant", SFI_P8_GRANT},
{"sfi_p9_grant", SFI_P9_GRANT},
{"sfi_p10_grant", SFI_P10_GRANT},
{"sfi_p11_grant", SFI_P11_GRANT},
{"sfi_p12_grant", SFI_P12_GRANT},
{"sfi_sfi_pull_req", SFI_SFI_PULL_REQ},
{"sfi_sfi_pull_grant", SFI_SFI_PULL_GRANT},
/* cnt0 duration */
{"sfi_atransid_dealloc_duration",
{"sfi_targid_dealloc_duration", SFI_TARGID_DEALLOC_DURATION},
/* DC agent */
{"dc_dif_output_valid", DC_DIF_OUTPUT_VALID},
{"dc_sfi_data_grant", DC_SFI_DATA_GRANT},
/* LC agent */
{"lc_dif_push", LC_DIF_PUSH},
{"lc_com_valid_links_dif_full", LC_COM_VALID_LINKS_DIF_FULL},
{"lc_data_pkt_fr_node", LC_DATA_PKT_FR_NODE},
{"lc_sfi_data_cancle", LC_SFI_DATA_CANCEL},
/* SFQ agent */
{"sfq_piq_push", SFQ_PIQ_PUSH},
{"sfq_piq_pop", SFQ_PIQ_POP},
{"sfq_niq_push", SFQ_NIQ_PUSH},
{"sfq_niq_pop", SFQ_NIQ_POP},
{"sfq_siq_push", SFQ_SIQ_PUSH},
{"sfq_siq_pop", SFQ_SIQ_POP},
/* HLI agent */
{"hli_slq_push", HLI_SLQ_PUSH},
{"hli_slq_pop", HLI_SLQ_POP},
{"hli_chq_push", HLI_CHQ_PUSH},
{"hli_chq_pop", HLI_CHQ_POP},
{"hli_phq_push", HLI_PHQ_PUSH},
{"hli_phq_pop", HLI_PHQ_POP},
/* Cache Control agent */
{"cachectl_clust0", CACHECTL_CLUST0},
{"cachectl_clust1", CACHECTL_CLUST1},
/* pic0, cluster event 0 */
{"cachectl_clust0_crd_cwr",
{"cachectl_clust0_at_cwr",
{"cachectl_clust0_at_crd",
{"cachectl_clust0_at_crd_cwr",
{"cachectl_clust0_int",
{"cachectl_clust0_int_cwr",
{"cachectl_clust0_int_crd",
{"cachectl_clust0_int_crd_cwr",
{"cachectl_clust0_int_at",
{"cachectl_clust0_int_at_cwr",
{"cachectl_clust0_int_at_crd",
{"cachectl_clust0_int_at_crd_cwr",
/* pic0, cluster event 1 */
{"cachectl_clust1_crd_cwr",
{"cachectl_clust1_at",
{"cachectl_clust1_at_cwr",
{"cachectl_clust1_at_crd",
{"cachectl_clust1_at_crd_cwr",
{"cachectl_clust1_int",
{"cachectl_clust1_int_cwr",
{"cachectl_clust1_int_crd",
{"cachectl_clust1_int_crd_cwr",
{"cachectl_clust1_int_at",
{"cachectl_clust1_int_at_cwr",
{"cachectl_clust1_int_at_crd",
{"cachectl_clust1_int_at_crd_cwr",
{"cachectl_cache_cyl_used", CACHECTL_CACHE_CYL_USED},
{"cachectl_lpa2ga_lookup", CACHECTL_LPA2GA_LOOKUP},
{"cachectl_ga2lpa_access", CACHECTL_GA2LPA_ACCESS},
{"cachectl_ga2lpa_lookup", CACHECTL_GA2LPA_LOOKUP},
{"cachectl_ga2lpa_miss", CACHECTL_GA2LPA_MISS},
{"cachectl_dir_lookup", CACHECTL_DIR_LOOKUP},
{"cachectl_dir_miss", CACHECTL_DIR_MISS},
{"cachectl_dir_wrtbk", CACHECTL_DIR_WRTBK},
{"cachectl_cmmu_access", CACHECTL_CMMU_ACCESS},
{"cachectl_cmmu_lookup", CACHECTL_CMMU_LOOKUP},
{"cachectl_csr_lookup", CACHECTL_CSR_LOOKUP},
{"cachectl_cnt_alwys", CACHECTL_CNT_ALWYS},
{"cachectl_hag_req_valid", CACHECTL_HAG_REQ_VALID},
{"cachectl_ciq_req_valid", CACHECTL_CIQ_REQ_VALID},
{"cachectl_slq_req_valid", CACHECTL_SLQ_REQ_VALID},
/* Cluster agent */
{"clust_agent_alloc", CLUSTER_AGENT_ALLOC},
{"clust_agent_retired", CLUSTER_AGENT_RETIRED},
{"clust_sfi_grant_rd", CLUSTER_SFI_GRANT_RD},
{"clust_sfi_grant_wr", CLUSTER_SFI_GRANT_WR},
{"clust_pull_seen", CLUSTER_PULL_SEEN},
{"clust_1dc_rcv_ack", CLUSTER_1DC_RCV_ACK},
{"clust_2dc_snd_ack", CLUSTER_2DC_SND_ACK},
{"clust_1_cpi_rcv_ack", CLUSTER_1_CPI_RCV_ACK},
{"clust_2_cpi_rcv_ack", CLUSTER_2_CPI_RCV_ACK},
{"clust_pkt_que_odd", CLUSTER_PKT_QUE_ODD},
{"clust_pkt_que_even", CLUSTER_PKT_QUE_EVEN},
{"clust_pkt_sent_odd", CLUSTER_PKT_SENT_ODD},
{"clust_pkt_sent_even", CLUSTER_PKT_SENT_EVEN},
{"clust_hli_req_0", CLUSTER_HLI_REQ_0},
{"clust_hli_req_1", CLUSTER_HLI_REQ_1},
{"clust_hli_req_2", CLUSTER_HLI_REQ_2},
{"clust_hli_req_3", CLUSTER_HLI_REQ_3},
{"clust_hli_req_4", CLUSTER_HLI_REQ_4},
{"clust_hli_req_5", CLUSTER_HLI_REQ_5},
{"clust_hli_grant_0", CLUSTER_HLI_GRANT_0},
{"clust_hli_grant_1", CLUSTER_HLI_GRANT_1},
{"clust_hli_grant_2", CLUSTER_HLI_GRANT_2},
{"clust_hli_grant_3", CLUSTER_HLI_GRANT_3},
{"clust_hli_grant_4", CLUSTER_HLI_GRANT_4},
{"clust_hli_grant_5", CLUSTER_HLI_GRANT_5},
/* cnt 0 duration */
{"clust_agent_retired_duration",
{"clust_pull_seen_duration",
{"clust_1dc_rcv_ack_duration",
{"clust_2dc_snd_ack_duration",
{"clust_pkt_sent_odd_duration",
{"clust_pkt_sent_even_duration",
{"clust_1_cpi_rcv_ack_duration",
{"clust_2_cpi_rcv_ack_duration",
/* Request agent */
{"req_agent_alloc", REQ_AGENT_ALLOC},
{"req_agent_retired", REQ_AGENT_RETIRED},
{"req_sfi_grant_p2", REQ_SFI_GRANT_P2},
{"req_1dc_rcv_ack", REQ_1DC_RCV_ACK},
{"req_2dc_snd_ack", REQ_2DC_SND_ACK},
{"req_1_cpi_rcv_ack", REQ_1_CPI_RCV_ACK},
{"req_2_cpi_rcv_ack", REQ_2_CPI_RCV_ACK},
{"req_pkt_que", REQ_PKT_QUE},
{"req_pkt_sent", REQ_PKT_SENT},
{"req_pkt_sent_clust_rd", REQ_PKT_SENT_CLUST_RD},
{"req_pkt_sent_clust_wr", REQ_PKT_SENT_CLUST_WR},
{"req_hli_req_0", REQ_HLI_REQ_0},
{"req_hli_req_1", REQ_HLI_REQ_1},
{"req_hli_req_2", REQ_HLI_REQ_2},
{"req_hli_req_3", REQ_HLI_REQ_3},
{"req_hli_req_4", REQ_HLI_REQ_4},
{"req_hli_req_5", REQ_HLI_REQ_5},
{"req_hli_grant_0", REQ_HLI_GRANT_0},
{"req_hli_grant_1", REQ_HLI_GRANT_1},
{"req_hli_grant_2", REQ_HLI_GRANT_2},
{"req_hli_grant_3", REQ_HLI_GRANT_3},
{"req_hli_grant_4", REQ_HLI_GRANT_4},
{"req_hli_grant_5", REQ_HLI_GRANT_5},
{"req_last_reply_rcvd", REQ_LAST_REPLY_RCVD},
{"req_sent_clust_rd", REQ_SENT_CLUST_RD},
{"req_sent_clust_wr", REQ_SENT_CLUST_WR},
{"req_piq_valid", REQ_PIQ_VALID},
{"req_piq_dispatch", REQ_PIQ_DISPATCH},
{"req_ciq_valid", REQ_CIQ_VALID},
{"req_ciq_dispatch", REQ_CIQ_DISPATCH},
{"req_niq_valid", REQ_NIQ_VALID},
{"req_niq_dispatch", REQ_NIQ_DISPATCH},
{"req_numa_bypass_dispatch", REQ_NUMA_BYPASS_DISPATCH},
/* cnt 0 duration */
{"req_agent_retired_duration",
{"req_1dc_rcv_ack_duration",
{"req_2dc_snd_ack_duration",
{"req_1_cpi_rcv_ack_duration",
{"req_2_cpi_rcv_ack_duration",
{"req_last_reply_rcvd_duration",
/* Home Agent */
{"home_agent_alloc", HOME_AGENT_ALLOC},
{"home_agent_retired", HOME_AGENT_RETIRED},
{"home_sfi_p8_rd_aux", HOME_SFI_P8_RD_AUX},
{"home_sfi_p8_rd_main", HOME_SFI_P8_RD_MAIN},
{"home_sfi_p8_wr", HOME_SFI_P8_WR},
{"home_sfi_p9_wr", HOME_SFI_P9_WR},
{"home_sfi_p10_wr", HOME_SFI_P10_WR},
{"home_1dc_rcv_ack_aux", HOME_1DC_RCV_ACK_AUX},
{"home_1dc_rcv_ack_main", HOME_1DC_RCV_ACK_MAIN},
{"home_2dc_snd_ack", HOME_2DC_SND_ACK},
{"home_sfi_pull_seen", HOME_SFI_PULL_SEEN},
{"home_last_demrep_sent", HOME_LAST_DEMREP_SENT},
{"home_comp_pkt_seen", HOME_COMP_PKT_SEEN},
{"home_hli_req_link_0_a", HOME_HLI_REQ_LINK_0_A},
{"home_hli_req_link_0_b", HOME_HLI_REQ_LINK_0_B},
{"home_hli_req_link_1_a", HOME_HLI_REQ_LINK_1_A},
{"home_hli_req_link_1_b", HOME_HLI_REQ_LINK_1_B},
{"home_hli_req_link_2_a", HOME_HLI_REQ_LINK_2_A},
{"home_hli_req_link_2_b", HOME_HLI_REQ_LINK_2_B},
{"home_hli_req_link_3_a", HOME_HLI_REQ_LINK_3_A},
{"home_hli_req_link_3_b", HOME_HLI_REQ_LINK_3_B},
{"home_hli_req_link_4_a", HOME_HLI_REQ_LINK_4_A},
{"home_hli_req_link_4_b", HOME_HLI_REQ_LINK_4_B},
{"home_hli_req_link_5_a", HOME_HLI_REQ_LINK_5_A},
{"home_hli_req_link_5_b", HOME_HLI_REQ_LINK_5_B},
{"home_hli_grant_link_0_a", HOME_HLI_GRANT_LINK_0_A},
{"home_hli_grant_link_0_b", HOME_HLI_GRANT_LINK_0_B},
{"home_hli_grant_link_1_a", HOME_HLI_GRANT_LINK_1_A},
{"home_hli_grant_link_1_b", HOME_HLI_GRANT_LINK_1_B},
{"home_hli_grant_link_2_a", HOME_HLI_GRANT_LINK_2_A},
{"home_hli_grant_link_2_b", HOME_HLI_GRANT_LINK_2_B},
{"home_hli_grant_link_3_a", HOME_HLI_GRANT_LINK_3_A},
{"home_hli_grant_link_3_b", HOME_HLI_GRANT_LINK_3_B},
{"home_hli_grant_link_4_a", HOME_HLI_GRANT_LINK_4_A},
{"home_hli_grant_link_4_b", HOME_HLI_GRANT_LINK_4_B},
{"home_hli_grant_link_5_a", HOME_HLI_GRANT_LINK_5_A},
{"home_hli_grant_link_5_b", HOME_HLI_GRANT_LINK_5_B},
{"home_blk_cam_hit", HOME_BLK_CAM_HIT},
{"home_dir_rtned-before_rd_grant",
{"home_dir_rtned_before_rd_order",
{"home_dir_rtned_before_rd_data",
{"home_dir_rtned_after_rd_data",
{"home_req_home", HOME_REQ_HOME},
{"home_req_same_box", HOME_REQ_SAME_BOX},
{"home_ref_data_back_home", HOME_REF_DATA_BACK_HOME},
{"home_dir_miss_alloc", HOME_DIR_MISS_ALLOC},
{"home_dir_hit_gi", HOME_DIR_HIT_GI},
{"home_dir_hit_gs", HOME_DIR_HIT_GS},
{"home_dir_hit_gm", HOME_DIR_HIT_GM},
{"home_dir_hit_rto_gm", HOME_DIR_HIT_RTO_GM},
{"home_dir_hit_rts_gms", HOME_DIR_HIT_RTS_GMS},
{"home_dir_miss_rts_gi", HOME_DIR_MISS_RTS_GI},
{"home_dir_miss_rts", HOME_DIR_MISS_RTS},
{"home_dir_miss_rto_gs_gi", HOME_DIR_MISS_RTO_GS_GI},
{"home_dir_miss_rto", HOME_DIR_MISS_RTO},
/* cnt 0 duration */
{"home_agent_retired_duration",
{"home_1dc_rcv_ack_aux_duration",
{"home_1dc_rcv_ack_main_duration",
{"home_2dc_snd_ack_duration",
{"home_sfi_pull_seen_duration",
{"home_comp_pkt_seen_duration",
/* Slave agent */
{"slave_agent_alloc", SLAVE_AGENT_ALLOC},
{"slave_agent_alloc_lpa", SLAVE_AGENT_ALLOC_LPA},
{"slave_agent_alloc_ga", SLAVE_AGENT_ALLOC_GA},
{"slave_agent_alloc_h_lpa", SLAVE_AGENT_ALLOC_H_LPA},
{"slave_agent_alloc_h_ga", SLAVE_AGENT_ALLOC_H_GA},
{"slave_agent_alloc_h_mlpa", SLAVE_AGENT_ALLOC_H_MLPA},
{"slave_agent_alloc_h_mga", SLAVE_AGENT_ALLOC_H_MGA},
{"slave_agent_alloc_h_m", SLAVE_AGENT_ALLOC_H_M},
{"slave_agent_alloc_h_inv_lpa", SLAVE_AGENT_ALLOC_H_INV_LPA},
{"slave_agent_alloc_h_inv_ga", SLAVE_AGENT_ALLOC_H_INV_GA},
{"slave_agent_retired", SLAVE_AGENT_RETIRED},
{"slave_reply_sent", SLAVE_REPLY_SENT},
{"slave_sfi_p6_grant_wr", SLAVE_SFI_P6_GRANT_WR},
{"slave_sfi_p12gt_rlpa", SLAVE_SFI_P12GT_RLPA},
{"slave_sfi_p12gt_rga", SLAVE_SFI_P12GT_RGA},
{"slave_sfi_p12gt_rhlpa",
{"slave_sfi_p12gt_rhga", SLAVE_SFI_P12GT_RHGA},
{"slave_sfi_p12gt_rhmlpa",
{"slave_sfi_p12gt_rhmga",
{"slave_sfi_p12gt_wr", SLAVE_SFI_P12GT_WR},
{"slave_1dc_rcv_ack", SLAVE_1DC_RCV_ACK},
{"slave_2dc_snd_ack", SLAVE_2DC_SND_ACK},
{"slave_2dc_snd_ack_refl", SLAVE_2DC_SND_ACK_REFL},
{"slave_4dc_snd_ack", SLAVE_4DC_SND_ACK},
{"slave_pull_seen", SLAVE_PULL_SEEN},
{"slave_h_m_ga_not_ownd", SLAVE_H_M_GA_NOT_OWND},
{"slave_h_m_no_state_change", SLAVE_H_M_NO_STATE_CHANGE},
{"slave_hli_req_0", SLAVE_HLI_REQ_0},
{"slave_hli_req_1", SLAVE_HLI_REQ_1},
{"slave_hli_req_2", SLAVE_HLI_REQ_2},
{"slave_hli_req_3", SLAVE_HLI_REQ_3},
{"slave_hli_req_4", SLAVE_HLI_REQ_4},
{"slave_hli_req_5", SLAVE_HLI_REQ_5},
{"slave_hli_grant_0", SLAVE_HLI_GRANT_0},
{"slave_hli_grant_1", SLAVE_HLI_GRANT_1},
{"slave_hli_grant_2", SLAVE_HLI_GRANT_2},
{"slave_hli_grant_3", SLAVE_HLI_GRANT_3},
{"slave_hli_grant_4", SLAVE_HLI_GRANT_4},
{"slave_hli_grant_5", SLAVE_HLI_GRANT_5},
/* cnt0 duration */
{"slave_agent_retired_duration",
{"slave_1dc_rcv_ack_c0_duration",
{"slave_2dc_snd_ack_duration",
{"slave_pull_seen_duration",
{"slave_reply_sent_duration",
{"slave_4dc_snd_ack_duration",
{"clear_pic", MISC_CLEAR_PIC0},
{EOSTR, 0}
},
/* pic 1 */
{
/* SFI agent */
/* cnt1 duration */
{"sfi_atransid_alloc_1_duration",
{"sfi_atransid_alloc_4_duration",
{"sfi_atransid_alloc_8_duration",
{"sfi_atransid_alloc_10_duration",
{"sfi_atransid_alloc_12_duration",
{"sfi_targid_alloc_0_duration",
{"sfi_targid_alloc_2_duration",
{"sfi_targid_alloc_8_duration",
/* DC agent */
/* LC agent */
{"lc_com_valid_links_dif_full",
/* SFQ agent */
/* HLI agent */
/* Cache Control agent */
/* pic1, cluster event 0 */
{"cachectl_clust0_cwr",
{"cachectl_clust0_crd",
{"cachectl_clust0_crd_cwr",
{"cachectl_clust0_at",
{"cachectl_clust0_at_cwr",
{"cachectl_clust0_at_crd",
{"cachectl_clust0_at_crd_cwr",
{"cachectl_clust0_int",
{"cachectl_clust0_int_cwr",
{"cachectl_clust0_int_crd",
{"cachectl_clust0_int_crd_cwr",
{"cachectl_clust0_int_at",
{"cachectl_clust0_int_at_cwr",
{"cachectl_clust0_int_at_crd",
{"cachectl_clust0_int_at_crd_cwr",
(CACHECTL_CLUST0<<10)},
/* pic1, clust event 1 */
{"cachectl_clust1_cwr",
{"cachectl_clust1_crd",
{"cachectl_clust1_crd_cwr",
{"cachectl_clust1_at",
{"cachectl_clust1_at_cwr",
{"cachectl_clust1_at_crd",
{"cachectl_clust1_at_crd_cwr",
{"cachectl_clust1_int",
{"cachectl_clust1_int_cwr",
{"cachectl_clust1_int_crd",
{"cachectl_clust1_int_crd_cwr",
{"cachectl_clust1_int_at",
{"cachectl_clust1_int_at_cwr",
{"cachectl_clust1_int_at_crd",
{"cachectl_clust1_int_at_crd_cwr",
(CACHECTL_CLUST1<<10)},
/* Cluster agent */
/* cnt1 duration */
{"clust_agent_alloc_duration",
{"clust_sfi_grant_wr_duration",
{"clust_sfi_grant_rd_duration",
{"clust_1dc_rcv_ack_duration",
{"clust_pkt_que_odd_duration",
{"clust_pkt_que_even_duration",
{"clust_hli_grant_0_duration",
{"clust_hli_grant_1_duration",
{"clust_hli_grant_2_duration",
{"clust_hli_grant_3_duration",
{"clust_hli_grant_4_duration",
{"clust_hli_grant_5_duration",
{"clust_1_cpi_rcv_ack_duration",
/* Request agent */
/* cnt1 duration */
{"req_agent_alloc_duration",
{"req_sfi_grant_p2_duration",
{"req_1dc_rcv_ack_duration",
{"req_pkt_sent_clust_rd_duration",
{"req_1_cpi_rcv_ack_duration",
{"req_pkt_sent_duration",
/* Home Agent */
{"home_dir_rtned_before_rd_grant",
{"home_dir_rtned_before_rd_order",
{"home_dir_rtned_before_rd_data",
{"home_dir_rtned_after_rd_data",
/* cnt1 duration */
{"home_agent_alloc_duration",
{"home_sfi_p8_rd_aux_duration",
{"home_sfi_p8_rd_main_duration",
{"home_1dc_rcv_ack_aux_duration",
{"home_1dc_rcv_ack_main_duration",
{"home_sfi_p8_wr_duration",
{"home_sfi_p9_wr_duration",
{"home_sfi_p10_wr_duration",
{"home_last_demrep_sent_duration",
/* Slave agent */
{"slave_agent_alloc_h_inv_lpa",
{"slave_agent_alloc_h_inv_ga",
{"slave_sfi_p12gt_rlpa",
SLAVE_SFI_P12GT_RLPA<<10},
{"slave_sfi_p12gt_rga",
SLAVE_SFI_P12GT_RGA<<10},
{"slave_sfi_p12gt_rhlpa",
SLAVE_SFI_P12GT_RHLPA<<10},
{"slave_sfi_p12gt_rhga",
SLAVE_SFI_P12GT_RHGA<<10},
{"slave_sfi_p12gt_rhmlpa",
SLAVE_SFI_P12GT_RHMLPA<<10},
{"slave_sfi_p12gt_rhmga",
SLAVE_SFI_P12GT_RHMGA<<10},
/* cnt1 duration */
{"slave_agent_alloc_duration",
{"slave_sfi_p12gt_rlpa_duration",
{"slave_sfi_p12gt_rga_duration",
{"slave_sfi_p12gt_rhlpa_duration",
{"slave_sfi_p12gt_rhga_duration",
{"slave_sfi_p12gtrhmlpa_duration",
{"slave_sfi_p12gt_rhmga_duration",
{"slave_1dc_rcv_ack_c1_duration",
{"slave_sfi_p6_grant_wr_duration",
{"slave_sfi_p12gt_wr_duration",
{"slave_2dc_sndack_refl_duration",
{"clear_pic", MISC_CLEAR_PIC1},
{EOSTR, 0}
}
};
/* Loopback Counter */
static wci_event_mask_t
/* pic 0 */
{
{"lpbk_rcvd_data_pkt", LPBK_RCVD_DATA_PKT},
{"lpbk_rcvd_addr_2_pkt", LPBK_RCVD_ADDR_2_PKT},
{"lpbk_raddr2_rdata", LPBK_RADDR2_RDATA},
{"lpbk_rcvd_addr_1_pkt", LPBK_RCVD_ADDR_1_PKT},
{"lpbk_raddr1_rdata", LPBK_RADDR1_RDATA},
{"lpbk_data_lpbk_full", LPBK_DATA_LPBK_FULL},
{"lpbk_dfull_rdata", LPBK_DFULL_RDATA},
{"lpbk_dfull_raddr2", LPBK_DFULL_RADDR2},
{"lpbk_dfull_raddr2_rdata", LPBK_DFULL_RADDR2_RDATA},
{"lpbk_dfull_raddr1", LPBK_DFULL_RADDR1},
{"lpbk_dfull_raddr1_rdata", LPBK_DFULL_RADDR1_RDATA},
{"lpbk_addr_lpbk_full", LPBK_ADDR_LPBK_FULL},
{"lpbk_afull_rdata", LPBK_AFULL_RDATA},
{"lpbk_afull_raddr2", LPBK_AFULL_RADDR2},
{"lpbk_afull_raddr2_rdata", LPBK_AFULL_RADDR2_RDATA},
{"lpbk_afull_raddr1", LPBK_AFULL_RADDR1},
{"lpbk_afull_raddr1_rdata", LPBK_AFULL_RADDR1_RDATA},
{"lpbk_afull_dfull", LPBK_AFULL_DFULL},
{"lpbk_afull_dfull_rdata", LPBK_AFULL_DFULL_RDATA},
{"lpbk_afull_dfull_raddr2", LPBK_AFULL_DFULL_RADDR2},
{"lpbk_afull_dfull_raddr2_rdata", LPBK_AFULL_DFULL_RADDR2_RDATA},
{"lpbk_afull_dfull_raddr1", LPBK_AFULL_DFULL_RADDR1},
{"lpbk_afull_dfull_raddr1_rdata", LPBK_AFULL_DFULL_RADDR1_RDATA},
{"clear_pic", LPBK_CLEAR_PIC0}
},
/* pic 1 */
{
{"clear_pic", LPBK_CLEAR_PIC1}
}
};
/* Link Counter */
/* one event list per counter, per link */
static wci_event_mask_t
/* pic 0 */
{
{"link_sending_admin_pkts", LINK_SENDING_ADMIN_PKTS},
{"link_rcvd_mh_data_pkt", LINK_RCVD_MH_DATA_PKT},
{"link_sadm_rmhdp", LINK_RMHDP_SADM},
{"link_rcvd_data_pkt", LINK_RCVD_DATA_PKT},
{"link_sadm_rdp", LINK_RDP_SADM},
{"link_rdp_rmhdp", LINK_RDP_RMHDP},
{"link_rejected_flit", LINK_REJECTED_FLIT},
{"link_rejflit_sadm", LINK_REJFLIT_SADM},
{"link_rejflit_rmhdp", LINK_REJFLIT_RMHDP},
{"link_rejflit_rmhdp_sadm", LINK_REJFLIT_RMHDP_SADM},
{"link_rejflit_rdp", LINK_REJFLIT_RDP},
{"link_rejflit_rdp_sadm", LINK_REJFLIT_RDP_SADM},
{"link_rcvd_admin_pkt", LINK_RCVD_ADMIN_PKT},
{"link_radmp_sadm", LINK_RADMP_SADM},
{"link_radmp_rmhdp", LINK_RADMP_RMHDP},
{"link_radmp_rmhdp_sadm", LINK_RADMP_RMHDP_SADM},
{"link_radmp_rdp", LINK_RADMP_RDP},
{"link_radmp_rdp_sadm", LINK_RADMP_RDP_SADM},
{"link_radmp_rejflit", LINK_RADMP_REJFLIT},
{"clear_pic", LINK_CLEAR_PIC0},
},
/* pic 1 */
{
{"clear_pic", LINK_CLEAR_PIC1}
}
};
/*
* WCI Safari Histogramming Counter
* One event list per pic counter.
*/
static wci_event_mask_t
/* pic 0 */
{
{"sfi_hstgrm_all_trans",
{"sfi_hstgrm_local_int",
{"sfi_hstgrm_rmt_clu_incm_int",
{"sfi_hstgrm_rmt_ssm_incm_int",
{"sfi_hstgrm_rmt_ssm_incm_io",
{"sfi_hstgrm_rmt_clu_incm_cohrnt",
{"sfi_hstgrm_rmt_ssm_otg_cohrnt",
{"sfi_hstgrm_rmt_ssm_incm_cohrnt",
{"clear_pic", WCI_SFI_CLEAR_PIC0}
},
/* pic 1 */
{
{"sfi_hstgrm_all_trans",
{"sfi_hstgrm_local_int",
{"sfi_hstgrm_rmt_clu_incm_int",
{"sfi_hstgrm_rmt_ssm_incm_int",
{"sfi_hstgrm_rmt_ssm_incm_io",
{"sfi_hstgrm_cohrnt",
{"sfi_hstgrm_rmt_clu_incm_cohrnt",
{"sfi_hstgrm_rmt_ssm_otg_cohrnt",
{"sfi_hstgrm_rmt_ssm_incm_cohrnt",
{"clear_pic", WCI_SFI_CLEAR_PIC1}
}
};
{ 0x0000000000000000ULL, 0x0000000000000000ULL, 0x000000000007FFFFULL },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, 0x0000000000000200ULL },
{ 0x00000000000F8000ULL, 0x00000000000F8000ULL, 0x0000000000000200ULL },
{ 0x0000F80000000000ULL, 0x0000F80000000000ULL, 0x0000000000000200ULL },
{ 0x0000F80000000000ULL, 0x0000F80000000000ULL, 0x0000000000000200ULL },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, 0x000000000000000FULL },
{ 0x0000F80000000000ULL, 0x0000F80000000000ULL, 0x000000000000000FULL },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, 0x000000000007FDF0ULL },
{ 0x0000F80000000000ULL, 0x0000F80000000000ULL, 0x0000000000018060ULL },
{ 0x0000000000000000ULL, 0x0000000000000000ULL, 0x00000000000001F0ULL },
{ 0x0000F80000000000ULL, 0x0000F80000000000ULL, 0x000000000007FC00ULL }
};
/*
* Driver globals
*/
void
{
}
void
wci_add_picN_kstats(char *drvname)
{
}
static void
{
struct kstat *wci_misc_ksp;
struct wci_counters_kstat *wci_misc_named_ksp;
char drvmod[15];
/*
* A "counter" kstat is created for each WCI
* instance that provides access to the %pcr and %pic
* registers for that instance.
*/
sizeof (struct wci_counters_kstat) / sizeof (kstat_named_t),
KSTAT_FLAG_WRITABLE)) == NULL) {
return;
}
/* initialize the named kstats */
/* update the common softstate */
}
/*
* called from wci_add_picN_kstats() to create a kstat for each %pic that
* the WCI Misc counter supports. These (read-only) kstats export the
* event names that each %pic supports.
*
* wci_misc_events_arr is an array of (event_name, pcr_mask) records
* for each (pic, event) pair.
*/
static void
wci_add_misc_pic_kstats(char *drvname)
{
struct kstat_named *wci_misc_pic_named_data;
char pic_name[30];
int i = 0;
int num_events = 0;
char drvmod[15];
/*
* calculate the actual number of events for
* each misc picN, since they are different for each picN
* Note: make sure {NULL, 0 } is the last event
*/
for (i = 0; i < WCI_MISC_NUM_EVENTS; i++) {
EOSTR) == 0)
break;
}
num_events = i;
/*
* create the picN kstat. The size of this kstat is
* WCI_NUM_EVENTS + 1 for the clear_event_mask
*/
pic_name);
/*
* remove all picN kstat from 0 to pic-1
* if current picN kstat create fails
*/
for (i = 0; i < pic; i++) {
wci_misc_pic_ksp[i] = NULL;
}
return;
}
/*
* for each picN event we need to write a kstat record
* (name = EVENT, value.ui64 = PCR_MASK)
*/
/* pcr_mask */
/* event-name */
}
}
}
{
struct wci_counters_kstat *wci_misc_ksp;
struct wci_common_soft_state *softsp;
if (rw == KSTAT_WRITE) {
/*
* can only write the wci_misc_ctr_ctl register
*/
*(softsp->wci_misc_ctr_ctl_vaddr) =
/*
* The misc counters can be used to count cluster
* related events related to incoming transactions
* as they are processed by the CMMU.
* The wci_cluster_ctr_ctl register has bits <3:0>
* specifying 4 different events that are counted
* if a misc counter is programmed with event
* "cluster event 0", and bits <7:4> specifying 4
* different events that are counted if a misc
* counter is programmed with event "cluster event 1".
* For counter 0, bits <27:24> of the
* wci_misc_ksp->wci_ctr_ctl represent the setting of
* the either the cnt0 or the cnt1 wci_cluster_ctr_ctl
* register fields. For counter 1, bits <31:28> of
* the wci_misc_ksp->wci_ctr_ctl represent the setting
* of the either the cnt0 or the cnt1 wci_cluster_ctr_ctl
* register fields. Selecting a pic0 or pic1 event type
* which specifies the CACHE-CTR agent and the event type
* of "cluster event 0" or "cluster event 1" causes the
* cnt0 or cnt1 events (respectively) in the
* wci_cluster_ctr_ctl register to be set as specified in
* bits <27:24> or <31:28>, respectively. If one or more
* of bits <31:24> of wci_misc_ksp->wci_ctr_ctl are
* non-zero, we need to write those bits in
* wci_cluster_ctr_ctl registers to set and enable
* the corresponding fields.
* Hence, the cluster counter fields are contained in the
* wci_misc_ksp->wci_ctr_ctl. We need to write these bits
* to the misc control register wci_misc_ctr_ctl_vaddr.
* Since for all the other misc counter event masks,
* the bits <31:24> are set to 0, these bits are never
* used by any events other than those with Cacthe-control
* agent and "cluster event 0" or "cluster event 1" set.
* Thus, It does not matter that we also write these bits
* to the misc control register. Also, for `busstat` support,
* we must keep consistent misc control register (pcr) values.
*/
/* only need bits<7:0>, keep bits <63:8> original value */
if (wci_cluster_ctr > 0)
(*(softsp->wci_cluster_ctr_ctl_vaddr) &
(~WCI_CLUSTER_MASK)) | wci_cluster_ctr;
} else {
/*
* copy the current state of the hardware into the
* kstat structure.
*/
}
return (0);
}
static void
{
struct kstat *wci_lpbk_ksp;
struct wci_counters_kstat *wci_lpbk_named_ksp;
char drvmod[15];
sizeof (struct wci_counters_kstat) / sizeof (kstat_named_t),
KSTAT_FLAG_WRITABLE)) == NULL) {
return;
}
wci_lpbk_named_ksp = (struct wci_counters_kstat *)
(wci_lpbk_ksp->ks_data);
/* initialize the named kstats */
/* update the common softstate */
}
static void
wci_add_lpbk_pic_kstats(char *drvname)
{
struct kstat_named *wci_lpbk_pic_named_data;
char pic_name[30];
char drvmod[15];
/*
* create the picN kstat. The size of this kstat is
* WCI_LPBK_NUM_EVENTS + 1 for the clear_event_mask
*/
"wci lpbk %s: kstat_create failed", pic_name);
/* remove pic0 kstat if pic1 create fails */
if (pic == 1) {
wci_lpbk_pic_ksp[0] = NULL;
}
return;
}
/*
* for each picN event we need to write a kstat record
* (name = EVENT, value.ui64 = PCR_MASK)
*/
/* pcr_mask */
/* event_name */
}
}
}
struct wci_counters_kstat *wci_lpbk_ksp;
struct wci_common_soft_state *softsp;
if (rw == KSTAT_WRITE) {
/*
* can only write the wci_misc_ctr_ctl register
*/
*(softsp->wci_lpbk_ctr_ctl_vaddr) =
} else {
}
return (0);
}
static void
{
int link_no;
char wci_link_kstat_name[30];
char tmp[15];
/*
* Calculate the link kstat name length, i.e., length of "wssmlink".
* This is needed in the wci_link_kstat_update() routine
*/
link_no + 'a');
sizeof (struct wci_counters_kstat) /
sizeof (kstat_named_t),
KSTAT_FLAG_WRITABLE)) == NULL) {
return;
}
/* initialize the named kstats */
/* update the common softstate */
}
}
static void
wci_add_link_pic_kstats(char *drvname)
{
struct kstat_named *wci_link_pic_named_data;
char pic_name[30];
char wci_link_kstat_name[30];
link_no + 'a');
/*
* create the picN kstat. The size of this kstat is
* WCI_LINK_NUM_EVENTS + 1 for the clear_event_mask
*/
WCI_LINK_NUM_EVENTS + 1,
"wci link%d %s: kstat_create failed",
/* remove pic0 kstat if pic1 create fails */
if (pic == 1) {
[link_no][0]);
}
return;
}
(struct kstat_named *)
/*
* for each picN event we need to write a kstat
* record (name = EVENT, value.ui64 = PCR_MASK)
*/
event++) {
/* pcr mask */
/* event_name */
}
}
}
}
struct wci_counters_kstat *wci_link_ksp;
struct wci_common_soft_state *softsp;
int arr_index;
if (rw == KSTAT_WRITE) {
/*
* can only write the wci_link_ctr_ctl register array
*/
} else {
}
return (0);
}
static void
{
struct kstat *wci_sfi_ksp;
struct wci_counters_kstat *wci_sfi_named_ksp;
char drvmod[15];
sizeof (struct wci_counters_kstat) / sizeof (kstat_named_t),
KSTAT_FLAG_WRITABLE)) == NULL) {
return;
}
wci_sfi_named_ksp = (struct wci_counters_kstat *)
(wci_sfi_ksp->ks_data);
/* initialize the named kstats */
/* update the common softstate */
}
static void
wci_add_sfi_pic_kstats(char *drvname)
{
struct kstat_named *wci_sfi_pic_named_data;
char pic_name[30];
char drvmod[15];
/*
* create the picN kstat. The size of this kstat is
* WCI_SFI_NUM_EVENTS + 1 for the clear_event_mask
*/
"wci sfi %s: kstat_create failed", pic_name);
/* remove pic0 kstat if pic1 create fails */
if (pic == 1) {
wci_sfi_pic_ksp[0] = NULL;
}
return;
}
/*
* for each picN event we need to write a kstat record
* (name = EVENT, value.ui64 = PCR_MASK)
*/
/* pcr_mask */
/* event_name */
}
}
}
{
struct wci_counters_kstat *wci_sfi_ksp;
struct wci_common_soft_state *softsp;
if (rw == KSTAT_WRITE) {
/* write to virtual sfi counter control */
/* write to wci_misc_ctr_ctl register bit <19:0> */
if (evt0 > 0) {
/* safri histogramming counter 0 */
switch (evt0) {
case SFI_HSTGRM_LOCAL_INT:
break;
break;
default:
break;
}
}
if (evt1 > 0) {
/* safri histogramming counter 1 */
switch (evt1 >> 4) {
case SFI_HSTGRM_LOCAL_INT:
break;
break;
default:
break;
}
}
} else {
/*
* Copy the current state of the hardware into the kstat
* structure. Here for safari histogram counter control, we
* need to copy the combination of wci_misc_ctr_ctl bits
* <19:0> and wci_sfi_sw_ctr_ctl bits <27:20> because the
* busstat needs a way to find out whether another process
* has changed wci_misc_ctr_ctl to count other events. When
* using safari histogramming counter, wci_misc_ctr_ctl must
* select agent 0, and event 0 or 1. If another process choose
* other agent or event by manipulating misc device, then the
* user who is monitoring sfi device should be notified.
*/
(~WCI_SFI_SW_CTR_CTL_MASK)));
}
return (0);
}
int link_no;
/* remove "link" counters kstat */
}
}
/* remove "lpbk" counters kstat */
}
/* remove "misc" counters kstat */
}
/* remove "sfi" counters kstat */
}
}
void wci_del_picN_kstats() {
/* remove "link" picN kstat */
}
}
}
/* remove "lpbk" picN kstat */
}
/* remove "misc" picN kstat */
}
/* remove "sfi" picN kstat */
}
}
}