2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2013 Justin Hibbits
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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.
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
31 #ifndef _DEV_HWPMC_POWERPC_H_
32 #define _DEV_HWPMC_POWERPC_H_ 1
36 #define POWERPC_PMC_CAPS (PMC_CAP_INTERRUPT | PMC_CAP_USER | \
37 PMC_CAP_SYSTEM | PMC_CAP_EDGE | \
38 PMC_CAP_THRESHOLD | PMC_CAP_READ | \
39 PMC_CAP_WRITE | PMC_CAP_INVERT | \
42 #define POWERPC_PMC_KERNEL_ENABLE (0x1 << 30)
43 #define POWERPC_PMC_USER_ENABLE (0x1 << 31)
45 #define POWERPC_PMC_ENABLE (POWERPC_PMC_KERNEL_ENABLE | POWERPC_PMC_USER_ENABLE)
46 #define POWERPC_RELOAD_COUNT_TO_PERFCTR_VALUE(V) (0x80000000-(V))
47 #define POWERPC_PERFCTR_VALUE_TO_RELOAD_COUNT(P) (0x80000000-(P))
50 struct pmc_hw *pc_ppcpmcs;
51 enum pmc_class pc_class;
54 extern struct powerpc_cpu **powerpc_pcpu;
56 extern int pmc_e500_initialize(struct pmc_mdep *pmc_mdep);
57 extern int pmc_mpc7xxx_initialize(struct pmc_mdep *pmc_mdep);
58 extern int pmc_ppc970_initialize(struct pmc_mdep *pmc_mdep);
60 extern int powerpc_describe(int cpu, int ri, struct pmc_info *pi, struct pmc **ppmc);
61 extern int powerpc_get_config(int cpu, int ri, struct pmc **ppm);
64 #endif /* _DEV_HWPMC_POWERPC_H_ */