1*1772Sjl139090 /* 2*1772Sjl139090 * CDDL HEADER START 3*1772Sjl139090 * 4*1772Sjl139090 * The contents of this file are subject to the terms of the 5*1772Sjl139090 * Common Development and Distribution License (the "License"). 6*1772Sjl139090 * You may not use this file except in compliance with the License. 7*1772Sjl139090 * 8*1772Sjl139090 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*1772Sjl139090 * or http://www.opensolaris.org/os/licensing. 10*1772Sjl139090 * See the License for the specific language governing permissions 11*1772Sjl139090 * and limitations under the License. 12*1772Sjl139090 * 13*1772Sjl139090 * When distributing Covered Code, include this CDDL HEADER in each 14*1772Sjl139090 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*1772Sjl139090 * If applicable, add the following below this CDDL HEADER, with the 16*1772Sjl139090 * fields enclosed by brackets "[]" replaced with your own identifying 17*1772Sjl139090 * information: Portions Copyright [yyyy] [name of copyright owner] 18*1772Sjl139090 * 19*1772Sjl139090 * CDDL HEADER END 20*1772Sjl139090 */ 21*1772Sjl139090 /* 22*1772Sjl139090 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 23*1772Sjl139090 * Use is subject to license terms. 24*1772Sjl139090 */ 25*1772Sjl139090 26*1772Sjl139090 #ifndef _SYS_PCMU_COUNTERS_H 27*1772Sjl139090 #define _SYS_PCMU_COUNTERS_H 28*1772Sjl139090 29*1772Sjl139090 #pragma ident "%Z%%M% %I% %E% SMI" 30*1772Sjl139090 31*1772Sjl139090 #ifdef __cplusplus 32*1772Sjl139090 extern "C" { 33*1772Sjl139090 #endif 34*1772Sjl139090 35*1772Sjl139090 #define NUM_OF_PICS 2 36*1772Sjl139090 37*1772Sjl139090 /* 38*1772Sjl139090 * used to build array of event-names and pcr-mask values 39*1772Sjl139090 */ 40*1772Sjl139090 typedef struct pcmu_kev_mask { 41*1772Sjl139090 char *event_name; /* Event name */ 42*1772Sjl139090 uint64_t pcr_mask; /* PCR mask */ 43*1772Sjl139090 } pcmu_kev_mask_t; 44*1772Sjl139090 45*1772Sjl139090 typedef struct pcmu_ksinfo { 46*1772Sjl139090 uint8_t pic_no_evs; /* number of events */ 47*1772Sjl139090 uint8_t pic_shift[NUM_OF_PICS]; /* PIC shift */ 48*1772Sjl139090 kstat_t *pic_name_ksp[NUM_OF_PICS]; /* kstat names */ 49*1772Sjl139090 } pcmu_ksinfo_t; 50*1772Sjl139090 51*1772Sjl139090 typedef struct pcmu_cntr_addr { 52*1772Sjl139090 uint64_t *pcr_addr; 53*1772Sjl139090 uint64_t *pic_addr; 54*1772Sjl139090 } pcmu_cntr_addr_t; 55*1772Sjl139090 56*1772Sjl139090 typedef struct pcmu_cntr_pa { 57*1772Sjl139090 uint64_t pcr_pa; 58*1772Sjl139090 uint64_t pic_pa; 59*1772Sjl139090 } pcmu_cntr_pa_t; 60*1772Sjl139090 61*1772Sjl139090 /* 62*1772Sjl139090 * Prototypes. 63*1772Sjl139090 */ 64*1772Sjl139090 extern void pcmu_create_name_kstat(char *, pcmu_ksinfo_t *, pcmu_kev_mask_t *); 65*1772Sjl139090 extern void pcmu_delete_name_kstat(pcmu_ksinfo_t *); 66*1772Sjl139090 extern kstat_t *pcmu_create_cntr_kstat(pcmu_t *, char *, int, 67*1772Sjl139090 int (*update)(kstat_t *, int), void *); 68*1772Sjl139090 extern int pcmu_cntr_kstat_update(kstat_t *, int); 69*1772Sjl139090 extern int pcmu_cntr_kstat_pa_update(kstat_t *, int); 70*1772Sjl139090 extern void pcmu_kstat_create(pcmu_t *); 71*1772Sjl139090 extern void pcmu_kstat_destroy(pcmu_t *); 72*1772Sjl139090 extern void pcmu_rem_upstream_kstat(pcmu_t *); 73*1772Sjl139090 74*1772Sjl139090 #ifdef __cplusplus 75*1772Sjl139090 } 76*1772Sjl139090 #endif 77*1772Sjl139090 78*1772Sjl139090 #endif /* _SYS_PCMU_COUNTERS_H */ 79