]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/dev/hwpmc/hwpmc_xscale.h
MFV: r362513
[FreeBSD/FreeBSD.git] / sys / dev / hwpmc / hwpmc_xscale.h
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3  *
4  * Copyright (c) 2009 Rui Paulo <rpaulo@FreeBSD.org>
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  *
28  * $FreeBSD$
29  */
30
31 #ifndef _DEV_HWPMC_XSCALE_H_
32 #define _DEV_HWPMC_XSCALE_H_
33
34 #define XSCALE_PMC_CAPS         (PMC_CAP_INTERRUPT | PMC_CAP_USER |     \
35                                  PMC_CAP_SYSTEM | PMC_CAP_EDGE |        \
36                                  PMC_CAP_THRESHOLD | PMC_CAP_READ |     \
37                                  PMC_CAP_WRITE | PMC_CAP_INVERT |       \
38                                  PMC_CAP_QUALIFIER)
39
40
41 #define XSCALE_PMNC_ENABLE              0x01    /* Enable all Counters */
42 #define XSCALE_PMNC_PMNRESET            0x02    /* Performance Counter Reset */
43 #define XSCALE_PMNC_CCNTRESET           0x04    /* Clock Counter Reset */
44 #define XSCALE_PMNC_CCNTDIV             0x08    /* Clock Counter Divider */
45
46 #define XSCALE_INTEN_CCNT               0x01    /* Enable Clock Counter Int. */
47 #define XSCALE_INTEN_PMN0               0x02    /* Enable PMN0 Interrupts */
48 #define XSCALE_INTEN_PMN1               0x04    /* Enable PMN1 Interrupts */
49 #define XSCALE_INTEN_PMN2               0x08    /* Enable PMN2 Interrupts */
50 #define XSCALE_INTEN_PMN3               0x10    /* Enable PMN3 Interrupts */
51
52 #define XSCALE_EVTSEL_EVT0_MASK         0x000000ff
53 #define XSCALE_EVTSEL_EVT1_MASK         0x0000ff00
54 #define XSCALE_EVTSEL_EVT2_MASK         0x00ff0000
55 #define XSCALE_EVTSEL_EVT3_MASK         0xff000000
56
57 #define XSCALE_FLAG_CCNT_OVERFLOW       0x01
58 #define XSCALE_FLAG_PMN0_OVERFLOW       0x02
59 #define XSCALE_FLAG_PMN1_OVERFLOW       0x04
60 #define XSCALE_FLAG_PMN2_OVERFLOW       0x08
61 #define XSCALE_FLAG_PMN3_OVERFLOW       0x10
62
63 #define XSCALE_RELOAD_COUNT_TO_PERFCTR_VALUE(R) (-(R))
64 #define XSCALE_PERFCTR_VALUE_TO_RELOAD_COUNT(P) (-(P))
65
66 #ifdef _KERNEL
67 /* MD extension for 'struct pmc' */
68 struct pmc_md_xscale_pmc {
69         uint32_t        pm_xscale_evsel;
70 };
71 #endif /* _KERNEL */
72 #endif /* _DEV_HWPMC_XSCALE_H_ */