1292407Sbr/*- 2292407Sbr * Copyright (c) 2009 Rui Paulo <rpaulo@FreeBSD.org> 3292407Sbr * All rights reserved. 4292407Sbr * 5292407Sbr * Redistribution and use in source and binary forms, with or without 6292407Sbr * modification, are permitted provided that the following conditions 7292407Sbr * are met: 8292407Sbr * 1. Redistributions of source code must retain the above copyright 9292407Sbr * notice, this list of conditions and the following disclaimer. 10292407Sbr * 2. Redistributions in binary form must reproduce the above copyright 11292407Sbr * notice, this list of conditions and the following disclaimer in the 12292407Sbr * documentation and/or other materials provided with the distribution. 13292407Sbr * 14292407Sbr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15292407Sbr * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16292407Sbr * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17292407Sbr * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 18292407Sbr * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19292407Sbr * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20292407Sbr * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21292407Sbr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 22292407Sbr * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 23292407Sbr * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24292407Sbr * POSSIBILITY OF SUCH DAMAGE. 25292407Sbr * 26292407Sbr * $FreeBSD$ 27292407Sbr */ 28292407Sbr 29292407Sbr#ifndef _MACHINE_PMC_MDEP_H_ 30292407Sbr#define _MACHINE_PMC_MDEP_H_ 31292407Sbr 32292407Sbr#define PMC_MDEP_CLASS_INDEX_RISCV 1 33292407Sbr/* 34292407Sbr * On the RISC-V platform we don't support any PMCs yet. 35292407Sbr */ 36292407Sbr#include <dev/hwpmc/hwpmc_riscv.h> 37292407Sbr 38292407Sbrunion pmc_md_op_pmcallocate { 39292407Sbr uint64_t __pad[4]; 40292407Sbr}; 41292407Sbr 42292407Sbr/* Logging */ 43292407Sbr#define PMCLOG_READADDR PMCLOG_READ64 44292407Sbr#define PMCLOG_EMITADDR PMCLOG_EMIT64 45292407Sbr 46292407Sbr#ifdef _KERNEL 47292407Sbrunion pmc_md_pmc { 48292407Sbr struct pmc_md_riscv_pmc pm_riscv; 49292407Sbr}; 50292407Sbr 51292407Sbr#define PMC_IN_KERNEL_STACK(S,START,END) \ 52292407Sbr ((S) >= (START) && (S) < (END)) 53292407Sbr#define PMC_IN_KERNEL(va) INKERNEL((va)) 54292407Sbr#define PMC_IN_USERSPACE(va) ((va) <= VM_MAXUSER_ADDRESS) 55292407Sbr#define PMC_TRAPFRAME_TO_PC(TF) ((TF)->tf_ra) 56292407Sbr#define PMC_TRAPFRAME_TO_FP(TF) (0) /* stub */ 57292407Sbr 58292407Sbr/* 59292407Sbr * Prototypes 60292407Sbr */ 61292407Sbrstruct pmc_mdep *pmc_riscv_initialize(void); 62292407Sbrvoid pmc_riscv_finalize(struct pmc_mdep *_md); 63292407Sbr#endif /* _KERNEL */ 64292407Sbr 65292407Sbr#endif /* !_MACHINE_PMC_MDEP_H_ */ 66