hwpmc_pentium.h revision 147191
1147191Sjkoshy/*- 2147191Sjkoshy * Copyright (c) 2005, Joseph Koshy 3147191Sjkoshy * All rights reserved. 4147191Sjkoshy * 5147191Sjkoshy * Redistribution and use in source and binary forms, with or without 6147191Sjkoshy * modification, are permitted provided that the following conditions 7147191Sjkoshy * are met: 8147191Sjkoshy * 1. Redistributions of source code must retain the above copyright 9147191Sjkoshy * notice, this list of conditions and the following disclaimer. 10147191Sjkoshy * 2. Redistributions in binary form must reproduce the above copyright 11147191Sjkoshy * notice, this list of conditions and the following disclaimer in the 12147191Sjkoshy * documentation and/or other materials provided with the distribution. 13147191Sjkoshy * 14147191Sjkoshy * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15147191Sjkoshy * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16147191Sjkoshy * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17147191Sjkoshy * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18147191Sjkoshy * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19147191Sjkoshy * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20147191Sjkoshy * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21147191Sjkoshy * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22147191Sjkoshy * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23147191Sjkoshy * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24147191Sjkoshy * SUCH DAMAGE. 25147191Sjkoshy * 26147191Sjkoshy * $FreeBSD: head/sys/dev/hwpmc/hwpmc_pentium.h 147191 2005-06-09 19:45:09Z jkoshy $ 27147191Sjkoshy */ 28147191Sjkoshy 29147191Sjkoshy/* Machine dependent interfaces */ 30147191Sjkoshy 31147191Sjkoshy#ifndef _DEV_HWPMC_PENTIUM_H_ 32147191Sjkoshy#define _DEV_HWPMC_PENTIUM_H_ 1 33147191Sjkoshy 34147191Sjkoshy/* Intel Pentium PMCs */ 35147191Sjkoshy 36147191Sjkoshy#define PENTIUM_NPMCS 3 /* 1 TSC + 2 PMCs */ 37147191Sjkoshy#define PENTIUM_CESR_PC1 (1 << 25) 38147191Sjkoshy#define PENTIUM_CESR_CC1_MASK 0x01C00000 39147191Sjkoshy#define PENTIUM_CESR_TO_CC1(C) (((C) & 0x07) << 22) 40147191Sjkoshy#define PENTIUM_CESR_ES1_MASK 0x003F0000 41147191Sjkoshy#define PENTIUM_CESR_TO_ES1(E) (((E) & 0x3F) << 16) 42147191Sjkoshy#define PENTIUM_CESR_PC0 (1 << 9) 43147191Sjkoshy#define PENTIUM_CESR_CC0_MASK 0x000001C0 44147191Sjkoshy#define PENTIUM_CESR_TO_CC0(C) (((C) & 0x07) << 6) 45147191Sjkoshy#define PENTIUM_CESR_ES0_MASK 0x0000003F 46147191Sjkoshy#define PENTIUM_CESR_TO_ES0(E) ((E) & 0x3F) 47147191Sjkoshy#define PENTIUM_CESR_RESERVED 0xFC00FC00 48147191Sjkoshy 49147191Sjkoshy#define PENTIUM_MSR_CESR 0x11 50147191Sjkoshy#define PENTIUM_MSR_CTR0 0x12 51147191Sjkoshy#define PENTIUM_MSR_CTR1 0x13 52147191Sjkoshy 53147191Sjkoshystruct pmc_md_pentium_op_pmcallocate { 54147191Sjkoshy uint32_t pm_pentium_config; 55147191Sjkoshy}; 56147191Sjkoshy 57147191Sjkoshy#ifdef _KERNEL 58147191Sjkoshy 59147191Sjkoshy/* MD extension for 'struct pmc' */ 60147191Sjkoshystruct pmc_md_pentium_pmc { 61147191Sjkoshy uint32_t pm_pentium_cesr; 62147191Sjkoshy}; 63147191Sjkoshy 64147191Sjkoshy 65147191Sjkoshy/* 66147191Sjkoshy * Prototypes 67147191Sjkoshy */ 68147191Sjkoshy 69147191Sjkoshyint pmc_initialize_p5(struct pmc_mdep *); /* Pentium PMCs */ 70147191Sjkoshy 71147191Sjkoshy#endif /* _KERNEL */ 72147191Sjkoshy#endif /* _DEV_HWPMC_PENTIUM_H_ */ 73