1200928Srpaulo/*- 2200928Srpaulo * Copyright (c) 2009 Rui Paulo <rpaulo@FreeBSD.org> 3200928Srpaulo * All rights reserved. 4200928Srpaulo * 5200928Srpaulo * Redistribution and use in source and binary forms, with or without 6200928Srpaulo * modification, are permitted provided that the following conditions 7200928Srpaulo * are met: 8200928Srpaulo * 1. Redistributions of source code must retain the above copyright 9200928Srpaulo * notice, this list of conditions and the following disclaimer. 10200928Srpaulo * 2. Redistributions in binary form must reproduce the above copyright 11200928Srpaulo * notice, this list of conditions and the following disclaimer in the 12200928Srpaulo * documentation and/or other materials provided with the distribution. 13200928Srpaulo * 14200928Srpaulo * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15200928Srpaulo * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16200928Srpaulo * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17200928Srpaulo * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18200928Srpaulo * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19200928Srpaulo * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20200928Srpaulo * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21200928Srpaulo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22200928Srpaulo * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23200928Srpaulo * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24200928Srpaulo * SUCH DAMAGE. 25200928Srpaulo * 26200928Srpaulo * $FreeBSD$ 27200928Srpaulo */ 28200928Srpaulo 29200928Srpaulo#ifndef _DEV_HWPMC_XSCALE_H_ 30200928Srpaulo#define _DEV_HWPMC_XSCALE_H_ 31200928Srpaulo 32200928Srpaulo#define XSCALE_PMC_CAPS (PMC_CAP_INTERRUPT | PMC_CAP_USER | \ 33200928Srpaulo PMC_CAP_SYSTEM | PMC_CAP_EDGE | \ 34200928Srpaulo PMC_CAP_THRESHOLD | PMC_CAP_READ | \ 35200928Srpaulo PMC_CAP_WRITE | PMC_CAP_INVERT | \ 36200928Srpaulo PMC_CAP_QUALIFIER) 37200928Srpaulo 38200928Srpaulo 39200928Srpaulo#define XSCALE_PMNC_ENABLE 0x01 /* Enable all Counters */ 40200928Srpaulo#define XSCALE_PMNC_PMNRESET 0x02 /* Performance Counter Reset */ 41200928Srpaulo#define XSCALE_PMNC_CCNTRESET 0x04 /* Clock Counter Reset */ 42200928Srpaulo#define XSCALE_PMNC_CCNTDIV 0x08 /* Clock Counter Divider */ 43200928Srpaulo/* IXP425 only -- first generation */ 44200928Srpaulo#define XSCALE_PMNC_EVT0_MASK 0x00ff000 45200928Srpaulo#define XSCALE_PMNC_EVT1_MASK 0xff00000 46200928Srpaulo 47200928Srpaulo#define XSCALE_INTEN_CCNT 0x01 /* Enable Clock Counter Int. */ 48200928Srpaulo#define XSCALE_INTEN_PMN0 0x02 /* Enable PMN0 Interrupts */ 49200928Srpaulo#define XSCALE_INTEN_PMN1 0x04 /* Enable PMN1 Interrupts */ 50200928Srpaulo#define XSCALE_INTEN_PMN2 0x08 /* Enable PMN2 Interrupts */ 51200928Srpaulo#define XSCALE_INTEN_PMN3 0x10 /* Enable PMN3 Interrupts */ 52200928Srpaulo 53200928Srpaulo#define XSCALE_EVTSEL_EVT0_MASK 0x000000ff 54200928Srpaulo#define XSCALE_EVTSEL_EVT1_MASK 0x0000ff00 55200928Srpaulo#define XSCALE_EVTSEL_EVT2_MASK 0x00ff0000 56200928Srpaulo#define XSCALE_EVTSEL_EVT3_MASK 0xff000000 57200928Srpaulo 58200928Srpaulo#define XSCALE_FLAG_CCNT_OVERFLOW 0x01 59200928Srpaulo#define XSCALE_FLAG_PMN0_OVERFLOW 0x02 60200928Srpaulo#define XSCALE_FLAG_PMN1_OVERFLOW 0x04 61200928Srpaulo#define XSCALE_FLAG_PMN2_OVERFLOW 0x08 62200928Srpaulo#define XSCALE_FLAG_PMN3_OVERFLOW 0x10 63200928Srpaulo 64200928Srpaulo#define XSCALE_RELOAD_COUNT_TO_PERFCTR_VALUE(R) (-(R)) 65200928Srpaulo#define XSCALE_PERFCTR_VALUE_TO_RELOAD_COUNT(P) (-(P)) 66200928Srpaulo 67200928Srpaulo#ifdef _KERNEL 68200928Srpaulo/* MD extension for 'struct pmc' */ 69200928Srpaulostruct pmc_md_xscale_pmc { 70200928Srpaulo uint32_t pm_xscale_evsel; 71200928Srpaulo}; 72200928Srpaulo#endif /* _KERNEL */ 73200928Srpaulo#endif /* _DEV_HWPMC_XSCALE_H_ */ 74