Blame src/libpfm-3.y/lib/pfmlib_itanium2_priv.h

Packit Service a1973e
/*
Packit Service a1973e
 * Copyright (c) 2002-2006 Hewlett-Packard Development Company, L.P.
Packit Service a1973e
 * Contributed by Stephane Eranian <eranian@hpl.hp.com>
Packit Service a1973e
 *
Packit Service a1973e
 * Permission is hereby granted, free of charge, to any person obtaining a copy
Packit Service a1973e
 * of this software and associated documentation files (the "Software"), to deal
Packit Service a1973e
 * in the Software without restriction, including without limitation the rights
Packit Service a1973e
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
Packit Service a1973e
 * of the Software, and to permit persons to whom the Software is furnished to do so,
Packit Service a1973e
 * subject to the following conditions:
Packit Service a1973e
 *
Packit Service a1973e
 * The above copyright notice and this permission notice shall be included in all
Packit Service a1973e
 * copies or substantial portions of the Software.
Packit Service a1973e
 *
Packit Service a1973e
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
Packit Service a1973e
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
Packit Service a1973e
 * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
Packit Service a1973e
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
Packit Service a1973e
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
Packit Service a1973e
 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Packit Service a1973e
 *
Packit Service a1973e
 * This file is part of libpfm, a performance monitoring support library for
Packit Service a1973e
 * applications on Linux/ia64.
Packit Service a1973e
 */
Packit Service a1973e
#ifndef __PFMLIB_ITANIUM2_PRIV_H__
Packit Service a1973e
#define __PFMLIB_ITANIUM2_PRIV_H__
Packit Service a1973e
Packit Service a1973e
/*
Packit Service a1973e
 * Event type definitions
Packit Service a1973e
 *
Packit Service a1973e
 * The virtual events are not really defined in the specs but are an artifact used
Packit Service a1973e
 * to quickly and easily setup EAR and/or BTB. The event type encodes the exact feature
Packit Service a1973e
 * which must be configured in combination with a counting monitor.
Packit Service a1973e
 * For instance, DATA_EAR_CACHE_LAT4 is a virtual D-EAR cache event. If the user
Packit Service a1973e
 * requests this event, this will configure a counting monitor to count DATA_EAR_EVENTS
Packit Service a1973e
 * and PMC11 will be configured for cache mode. The latency is encoded in the umask, here
Packit Service a1973e
 * it would correspond to 4 cycles.
Packit Service a1973e
 *
Packit Service a1973e
 */
Packit Service a1973e
#define PFMLIB_ITA2_EVENT_NORMAL	0x0 /* standard counter */
Packit Service a1973e
#define PFMLIB_ITA2_EVENT_BTB		0x1 /* virtual event used with BTB configuration */
Packit Service a1973e
#define PFMLIB_ITA2_EVENT_IEAR_TLB	0x2 /* virtual event used for I-EAR TLB configuration */	
Packit Service a1973e
#define PFMLIB_ITA2_EVENT_IEAR_CACHE	0x3 /* virtual event used for I-EAR cache configuration */	
Packit Service a1973e
#define PFMLIB_ITA2_EVENT_DEAR_TLB	0x4 /* virtual event used for D-EAR TLB configuration */	
Packit Service a1973e
#define PFMLIB_ITA2_EVENT_DEAR_CACHE	0x5 /* virtual event used for D-EAR cache configuration */	
Packit Service a1973e
#define PFMLIB_ITA2_EVENT_DEAR_ALAT	0x6 /* virtual event used for D-EAR ALAT configuration */
Packit Service a1973e
Packit Service a1973e
#define event_is_ear(e)	       ((e)->pme_type >= PFMLIB_ITA2_EVENT_IEAR_TLB &&(e)->pme_type <= PFMLIB_ITA2_EVENT_DEAR_ALAT)
Packit Service a1973e
#define event_is_iear(e)       ((e)->pme_type == PFMLIB_ITA2_EVENT_IEAR_TLB || (e)->pme_type == PFMLIB_ITA2_EVENT_IEAR_CACHE)
Packit Service a1973e
#define event_is_dear(e)       ((e)->pme_type >= PFMLIB_ITA2_EVENT_DEAR_TLB && (e)->pme_type <= PFMLIB_ITA2_EVENT_DEAR_ALAT)
Packit Service a1973e
#define event_is_ear_cache(e)  ((e)->pme_type == PFMLIB_ITA2_EVENT_DEAR_CACHE || (e)->pme_type == PFMLIB_ITA2_EVENT_IEAR_CACHE)
Packit Service a1973e
#define event_is_ear_tlb(e)    ((e)->pme_type == PFMLIB_ITA2_EVENT_IEAR_TLB || (e)->pme_type == PFMLIB_ITA2_EVENT_DEAR_TLB)
Packit Service a1973e
#define event_is_ear_alat(e)   ((e)->pme_type == PFMLIB_ITA2_EVENT_DEAR_ALAT)
Packit Service a1973e
#define event_is_btb(e)	       ((e)->pme_type == PFMLIB_ITA2_EVENT_BTB)
Packit Service a1973e
Packit Service a1973e
Packit Service a1973e
/*
Packit Service a1973e
 * Itanium encoding structure
Packit Service a1973e
 * (code must be first 8 bits)
Packit Service a1973e
 */
Packit Service a1973e
typedef struct {
Packit Service a1973e
	unsigned long pme_code:8;	/* major event code */
Packit Service a1973e
	unsigned long pme_type:3;	/* see definitions above */
Packit Service a1973e
	unsigned long pme_ig1:5;	/* ignored */
Packit Service a1973e
	unsigned long pme_umask:16;	/* unit mask*/
Packit Service a1973e
	unsigned long pme_ig:32;	/* ignored */
Packit Service a1973e
} pme_ita2_entry_code_t;		
Packit Service a1973e
Packit Service a1973e
typedef union {
Packit Service a1973e
	unsigned long  	     pme_vcode;
Packit Service a1973e
	pme_ita2_entry_code_t pme_ita2_code;	/* must not be larger than vcode */
Packit Service a1973e
} pme_ita2_code_t;
Packit Service a1973e
Packit Service a1973e
typedef union {
Packit Service a1973e
	unsigned long qual;		/* generic qualifier */
Packit Service a1973e
	struct {
Packit Service a1973e
		unsigned long pme_iar:1;	/* instruction address range supported */
Packit Service a1973e
		unsigned long pme_opm:1;	/* opcode match supported */
Packit Service a1973e
		unsigned long pme_dar:1;	/* data address range supported */
Packit Service a1973e
		unsigned long pme_res1:13;	/* reserved */
Packit Service a1973e
		unsigned long pme_group:4;	/* event group */
Packit Service a1973e
		unsigned long pme_set:4;	/* event feature set*/
Packit Service a1973e
		unsigned long pme_res2:40;	/* reserved */
Packit Service a1973e
	} pme_qual;
Packit Service a1973e
} pme_ita2_qualifiers_t;
Packit Service a1973e
Packit Service a1973e
typedef struct {
Packit Service a1973e
	char			*pme_name;
Packit Service a1973e
	pme_ita2_code_t		pme_entry_code;
Packit Service a1973e
	unsigned long	 	pme_counters;		/* supported counters */
Packit Service a1973e
	unsigned int		pme_maxincr;
Packit Service a1973e
	pme_ita2_qualifiers_t	pme_qualifiers;
Packit Service a1973e
	char			*pme_desc;	/* text description of the event */
Packit Service a1973e
} pme_ita2_entry_t;
Packit Service a1973e
Packit Service a1973e
Packit Service a1973e
/*
Packit Service a1973e
 * We embed the umask value into the event code. Because it really is
Packit Service a1973e
 * like a subevent.
Packit Service a1973e
 * pme_code:
Packit Service a1973e
 * 	- lower 16 bits: major event code
Packit Service a1973e
 * 	- upper 16 bits: unit mask
Packit Service a1973e
 */
Packit Service a1973e
#define pme_code	pme_entry_code.pme_ita2_code.pme_code
Packit Service a1973e
#define pme_umask	pme_entry_code.pme_ita2_code.pme_umask
Packit Service a1973e
#define pme_used	pme_qualifiers.pme_qual_struct.pme_used
Packit Service a1973e
#define pme_type	pme_entry_code.pme_ita2_code.pme_type
Packit Service a1973e
Packit Service a1973e
#define event_opcm_ok(e) ((e)->pme_qualifiers.pme_qual.pme_opm==1)
Packit Service a1973e
#define event_iarr_ok(e) ((e)->pme_qualifiers.pme_qual.pme_iar==1)
Packit Service a1973e
#define event_darr_ok(e) ((e)->pme_qualifiers.pme_qual.pme_dar==1)
Packit Service a1973e
Packit Service a1973e
#endif /* __PFMLIB_ITANIUM2_PRIV_H__ */