pmc_mdep.h (145337) | pmc_mdep.h (147191) |
---|---|
1/*- | 1/*- |
2 * Copyright (c) 2003, Joseph Koshy | 2 * Copyright (c) 2003-2005 Joseph Koshy |
3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright --- 7 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright --- 7 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/amd64/include/pmc_mdep.h 145337 2005-04-20 20:22:33Z marcel $ | 26 * $FreeBSD: head/sys/amd64/include/pmc_mdep.h 147191 2005-06-09 19:45:09Z jkoshy $ |
27 */ 28 29/* Machine dependent interfaces */ 30 31#ifndef _MACHINE_PMC_MDEP_H 32#define _MACHINE_PMC_MDEP_H 1 33 | 27 */ 28 29/* Machine dependent interfaces */ 30 31#ifndef _MACHINE_PMC_MDEP_H 32#define _MACHINE_PMC_MDEP_H 1 33 |
34#include <machine/specialreg.h> | 34#include <dev/hwpmc/hwpmc_amd.h> 35#include <dev/hwpmc/hwpmc_piv.h> |
35 | 36 |
36/* AMD K7 PMCs */ | 37union pmc_md_op_pmcallocate { 38 struct pmc_md_amd_op_pmcallocate pm_amd; 39 struct pmc_md_p4_op_pmcallocate pm_p4; 40 uint64_t __pad[4]; 41}; |
37 | 42 |
38#define K8_NPMCS 5 /* 1 TSC + 4 PMCs */ | 43/* Logging */ 44#define PMCLOG_READADDR PMCLOG_READ64 45#define PMCLOG_EMITADDR PMCLOG_EMIT64 |
39 | 46 |
40#define K8_PMC_COUNTERMASK 0xFF000000 41#define K8_PMC_TO_COUNTER(x) (((x) << 24) & K8_PMC_COUNTERMASK) 42#define K8_PMC_INVERT (1 << 23) 43#define K8_PMC_ENABLE (1 << 22) 44#define K8_PMC_INT (1 << 20) 45#define K8_PMC_PC (1 << 19) 46#define K8_PMC_EDGE (1 << 18) 47#define K8_PMC_OS (1 << 17) 48#define K8_PMC_USR (1 << 16) | 47#ifdef _KERNEL |
49 | 48 |
50#define K8_PMC_UNITMASK_M 0x10 51#define K8_PMC_UNITMASK_O 0x08 52#define K8_PMC_UNITMASK_E 0x04 53#define K8_PMC_UNITMASK_S 0x02 54#define K8_PMC_UNITMASK_I 0x01 55#define K8_PMC_UNITMASK_MOESI 0x1F | 49union pmc_md_pmc { 50 struct pmc_md_amd_pmc pm_amd; 51 struct pmc_md_p4_pmc pm_p4; 52}; |
56 | 53 |
57#define K8_PMC_UNITMASK 0xFF00 58#define K8_PMC_EVENTMASK 0x00FF 59#define K8_PMC_TO_UNITMASK(x) (((x) << 8) & K8_PMC_UNITMASK) 60#define K8_PMC_TO_EVENTMASK(x) ((x) & 0xFF) 61#define K8_VALID_BITS (K8_PMC_COUNTERMASK | K8_PMC_INVERT | \ 62 K8_PMC_ENABLE | K8_PMC_INT | K8_PMC_PC | K8_PMC_EDGE | K8_PMC_OS | \ 63 K8_PMC_USR | K8_PMC_UNITMASK | K8_PMC_EVENTMASK) | 54struct pmc; |
64 | 55 |
65#ifdef _KERNEL 66 | |
67/* 68 * Prototypes 69 */ 70 | 56/* 57 * Prototypes 58 */ 59 |
71#if defined(__amd64__) 72struct pmc_mdep *pmc_amd_initialize(void); 73#endif /* defined(__i386__) */ | 60void pmc_x86_lapic_enable_pmc_interrupt(void); |
74 | 61 |
75#endif /* _KERNEL */ | 62#endif |
76#endif /* _MACHINE_PMC_MDEP_H */ | 63#endif /* _MACHINE_PMC_MDEP_H */ |