1283112Sbr/*-
2283112Sbr * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com>
3283112Sbr * All rights reserved.
4283112Sbr *
5283112Sbr * This software was developed by the University of Cambridge Computer
6283112Sbr * Laboratory with support from ARM Ltd.
7283112Sbr *
8283112Sbr * Redistribution and use in source and binary forms, with or without
9283112Sbr * modification, are permitted provided that the following conditions
10283112Sbr * are met:
11283112Sbr * 1. Redistributions of source code must retain the above copyright
12283112Sbr *    notice, this list of conditions and the following disclaimer.
13283112Sbr * 2. Redistributions in binary form must reproduce the above copyright
14283112Sbr *    notice, this list of conditions and the following disclaimer in the
15283112Sbr *    documentation and/or other materials provided with the distribution.
16283112Sbr *
17283112Sbr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18283112Sbr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19283112Sbr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20283112Sbr * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21283112Sbr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22283112Sbr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23283112Sbr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24283112Sbr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25283112Sbr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26283112Sbr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27283112Sbr * SUCH DAMAGE.
28283112Sbr *
29283112Sbr * $FreeBSD$
30283112Sbr */
31283112Sbr
32283112Sbr#ifndef _DEV_HWPMC_ARMV8_H_
33283112Sbr#define _DEV_HWPMC_ARMV8_H_
34283112Sbr
35283112Sbr#define	ARMV8_PMC_CAPS		(PMC_CAP_INTERRUPT | PMC_CAP_USER |	\
36283112Sbr				 PMC_CAP_SYSTEM | PMC_CAP_EDGE |	\
37283112Sbr				 PMC_CAP_THRESHOLD | PMC_CAP_READ |	\
38283112Sbr				 PMC_CAP_WRITE | PMC_CAP_INVERT |	\
39283112Sbr				 PMC_CAP_QUALIFIER)
40283112Sbr
41283112Sbr#define	ARMV8_RELOAD_COUNT_TO_PERFCTR_VALUE(R)	(-(R))
42283112Sbr#define	ARMV8_PERFCTR_VALUE_TO_RELOAD_COUNT(P)	(-(P))
43283112Sbr#define	EVENT_ID_MASK	0xFF
44283112Sbr
45283112Sbr#ifdef _KERNEL
46283112Sbr/* MD extension for 'struct pmc' */
47283112Sbrstruct pmc_md_arm64_pmc {
48283112Sbr	uint32_t	pm_arm64_evsel;
49283112Sbr};
50283112Sbr#endif /* _KERNEL */
51283112Sbr#endif /* _DEV_HWPMC_ARMV8_H_ */
52