Blame src/libpfm-3.y/include/perfmon/pfmlib_pentium4.h

Packit 577717
/*
Packit 577717
 * Intel Pentium 4 PMU specific types and definitions (32 and 64 bit modes)
Packit 577717
 *
Packit 577717
 * Copyright (c) 2006 IBM Corp.
Packit 577717
 * Contributed by Kevin Corry <kevcorry@us.ibm.com>
Packit 577717
 *
Packit 577717
 * Permission is hereby granted, free of charge, to any person obtaining a copy
Packit 577717
 * of this software and associated documentation files (the "Software"), to deal
Packit 577717
 * in the Software without restriction, including without limitation the rights
Packit 577717
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
Packit 577717
 * of the Software, and to permit persons to whom the Software is furnished to do so,
Packit 577717
 * subject to the following conditions:
Packit 577717
 *
Packit 577717
 * The above copyright notice and this permission notice shall be included in all
Packit 577717
 * copies or substantial portions of the Software.
Packit 577717
 *
Packit 577717
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
Packit 577717
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
Packit 577717
 * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
Packit 577717
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
Packit 577717
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
Packit 577717
 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Packit 577717
 */
Packit 577717
Packit 577717
#ifndef __PFMLIB_PENTIUM4_H__
Packit 577717
#define __PFMLIB_PENTIUM4_H__
Packit 577717
Packit 577717
#include <perfmon/pfmlib.h>
Packit 577717
Packit 577717
/* ESCR: Event Selection Control Register
Packit 577717
 *
Packit 577717
 * These registers are used to select which event to count along with options
Packit 577717
 * for that event. There are (up to) 45 ESCRs, but each data counter is
Packit 577717
 * restricted to a specific set of ESCRs.
Packit 577717
 */
Packit 577717
Packit 577717
/**
Packit 577717
 * pentium4_escr_value_t
Packit 577717
 *
Packit 577717
 * Bit-wise breakdown of the ESCR registers.
Packit 577717
 *
Packit 577717
 *    Bits     Description
Packit 577717
 *   -------   -----------
Packit 577717
 *   63 - 31   Reserved
Packit 577717
 *   30 - 25   Event Select
Packit 577717
 *   24 - 9    Event Mask
Packit 577717
 *    8 - 5    Tag Value
Packit 577717
 *      4      Tag Enable
Packit 577717
 *      3      T0 OS - Enable counting in kernel mode (thread 0)
Packit 577717
 *      2      T0 USR - Enable counting in user mode (thread 0)
Packit 577717
 *      1      T1 OS - Enable counting in kernel mode (thread 1)
Packit 577717
 *      0      T1 USR - Enable counting in user mode (thread 1)
Packit 577717
 **/
Packit 577717
Packit 577717
#define EVENT_MASK_BITS 16
Packit 577717
#define EVENT_SELECT_BITS 6
Packit 577717
Packit 577717
typedef union {
Packit 577717
	unsigned long val;
Packit 577717
	struct {
Packit 577717
		unsigned long t1_usr:1;
Packit 577717
		unsigned long t1_os:1;
Packit 577717
		unsigned long t0_usr:1;
Packit 577717
		unsigned long t0_os:1;
Packit 577717
		unsigned long tag_enable:1;
Packit 577717
		unsigned long tag_value:4;
Packit 577717
		unsigned long event_mask:EVENT_MASK_BITS;
Packit 577717
		unsigned long event_select:EVENT_SELECT_BITS;
Packit 577717
		unsigned long reserved:1;
Packit 577717
	} bits;
Packit 577717
} pentium4_escr_value_t;
Packit 577717
Packit 577717
/* CCCR: Counter Configuration Control Register
Packit 577717
 *
Packit 577717
 * These registers are used to configure the data counters. There are 18
Packit 577717
 * CCCRs, one for each data counter.
Packit 577717
 */
Packit 577717
Packit 577717
/**
Packit 577717
 * pentium4_cccr_value_t
Packit 577717
 *
Packit 577717
 * Bit-wise breakdown of the CCCR registers.
Packit 577717
 *
Packit 577717
 *    Bits     Description
Packit 577717
 *   -------   -----------
Packit 577717
 *   63 - 32   Reserved
Packit 577717
 *     31      OVF - The data counter overflowed.
Packit 577717
 *     30      Cascade - Enable cascading of data counter when alternate
Packit 577717
 *             counter overflows.
Packit 577717
 *   29 - 28   Reserved
Packit 577717
 *     27      OVF_PMI_T1 - Generate interrupt for LP1 on counter overflow
Packit 577717
 *     26      OVF_PMI_T0 - Generate interrupt for LP0 on counter overflow
Packit 577717
 *     25      FORCE_OVF - Force interrupt on every counter increment
Packit 577717
 *     24      Edge - Enable rising edge detection of the threshold comparison
Packit 577717
 *             output for filtering event counts.
Packit 577717
 *   23 - 20   Threshold Value - Select the threshold value for comparing to
Packit 577717
 *             incoming event counts.
Packit 577717
 *     19      Complement - Select how incoming event count is compared with
Packit 577717
 *             the threshold value.
Packit 577717
 *     18      Compare - Enable filtering of event counts.
Packit 577717
 *   17 - 16   Active Thread - Only used with HT enabled.
Packit 577717
 *             00 - None: Count when neither LP is active.
Packit 577717
 *             01 - Single: Count when only one LP is active.
Packit 577717
 *             10 - Both: Count when both LPs are active.
Packit 577717
 *             11 - Any: Count when either LP is active.
Packit 577717
 *   15 - 13   ESCR Select - Select which ESCR to use for selecting the
Packit 577717
 *             event to count.
Packit 577717
 *     12      Enable - Turns the data counter on or off.
Packit 577717
 *   11 - 0    Reserved
Packit 577717
 **/
Packit 577717
typedef union {
Packit 577717
	unsigned long val;
Packit 577717
	struct {
Packit 577717
		unsigned long reserved1:12;
Packit 577717
		unsigned long enable:1;
Packit 577717
		unsigned long escr_select:3;
Packit 577717
		unsigned long active_thread:2;
Packit 577717
		unsigned long compare:1;
Packit 577717
		unsigned long complement:1;
Packit 577717
		unsigned long threshold:4;
Packit 577717
		unsigned long edge:1;
Packit 577717
		unsigned long force_ovf:1;
Packit 577717
		unsigned long ovf_pmi_t0:1;
Packit 577717
		unsigned long ovf_pmi_t1:1;
Packit 577717
		unsigned long reserved2:2;
Packit 577717
		unsigned long cascade:1;
Packit 577717
		unsigned long overflow:1;
Packit 577717
	} bits;
Packit 577717
} pentium4_cccr_value_t;
Packit 577717
Packit 577717
#endif /* __PFMLIB_PENTIUM4_H__ */