1255164Sjhibbits/*- 2255164Sjhibbits * Copyright (c) 2013 Justin Hibbits 3255164Sjhibbits * All rights reserved. 4255164Sjhibbits * 5255164Sjhibbits * Redistribution and use in source and binary forms, with or without 6255164Sjhibbits * modification, are permitted provided that the following conditions 7255164Sjhibbits * are met: 8255164Sjhibbits * 1. Redistributions of source code must retain the above copyright 9255164Sjhibbits * notice, this list of conditions and the following disclaimer. 10255164Sjhibbits * 2. Redistributions in binary form must reproduce the above copyright 11255164Sjhibbits * notice, this list of conditions and the following disclaimer in the 12255164Sjhibbits * documentation and/or other materials provided with the distribution. 13255164Sjhibbits * 14255164Sjhibbits * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15255164Sjhibbits * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16255164Sjhibbits * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17255164Sjhibbits * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18255164Sjhibbits * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19255164Sjhibbits * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20255164Sjhibbits * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21255164Sjhibbits * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22255164Sjhibbits * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23255164Sjhibbits * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24255164Sjhibbits * SUCH DAMAGE. 25255164Sjhibbits * 26255164Sjhibbits * $FreeBSD: releng/11.0/sys/dev/hwpmc/hwpmc_powerpc.h 281713 2015-04-18 21:39:17Z jhibbits $ 27255164Sjhibbits */ 28255164Sjhibbits 29255164Sjhibbits#ifndef _DEV_HWPMC_POWERPC_H_ 30255164Sjhibbits#define _DEV_HWPMC_POWERPC_H_ 1 31255164Sjhibbits 32255164Sjhibbits#ifdef _KERNEL 33255164Sjhibbits 34255164Sjhibbits#define POWERPC_PMC_CAPS (PMC_CAP_INTERRUPT | PMC_CAP_USER | \ 35255164Sjhibbits PMC_CAP_SYSTEM | PMC_CAP_EDGE | \ 36255164Sjhibbits PMC_CAP_THRESHOLD | PMC_CAP_READ | \ 37255164Sjhibbits PMC_CAP_WRITE | PMC_CAP_INVERT | \ 38255164Sjhibbits PMC_CAP_QUALIFIER) 39255164Sjhibbits 40255164Sjhibbits#define POWERPC_PMC_KERNEL_ENABLE (0x1 << 30) 41255164Sjhibbits#define POWERPC_PMC_USER_ENABLE (0x1 << 31) 42255164Sjhibbits 43255164Sjhibbits#define POWERPC_PMC_ENABLE (POWERPC_PMC_KERNEL_ENABLE | POWERPC_PMC_USER_ENABLE) 44255164Sjhibbits#define POWERPC_RELOAD_COUNT_TO_PERFCTR_VALUE(V) (0x80000000-(V)) 45255164Sjhibbits#define POWERPC_PERFCTR_VALUE_TO_RELOAD_COUNT(P) (0x80000000-(P)) 46255164Sjhibbits 47255164Sjhibbitsstruct powerpc_cpu { 48255164Sjhibbits struct pmc_hw *pc_ppcpmcs; 49261342Sjhibbits enum pmc_class pc_class; 50255164Sjhibbits}; 51255164Sjhibbits 52255164Sjhibbitsextern struct powerpc_cpu **powerpc_pcpu; 53255164Sjhibbits 54281713Sjhibbitsextern int pmc_e500_initialize(struct pmc_mdep *pmc_mdep); 55255164Sjhibbitsextern int pmc_mpc7xxx_initialize(struct pmc_mdep *pmc_mdep); 56261342Sjhibbitsextern int pmc_ppc970_initialize(struct pmc_mdep *pmc_mdep); 57255164Sjhibbits 58255164Sjhibbitsextern int powerpc_describe(int cpu, int ri, struct pmc_info *pi, struct pmc **ppmc); 59255164Sjhibbitsextern int powerpc_get_config(int cpu, int ri, struct pmc **ppm); 60255164Sjhibbits#endif /* _KERNEL */ 61255164Sjhibbits 62255164Sjhibbits#endif /* _DEV_HWPMC_POWERPC_H_ */ 63