Deleted Added
full compact
hwpmc_ppro.c (147989) hwpmc_ppro.c (174395)
1/*-
2 * Copyright (c) 2003-2005 Joseph Koshy
1/*-
2 * Copyright (c) 2003-2005 Joseph Koshy
3 * Copyright (c) 2007 The FreeBSD Foundation
3 * All rights reserved.
4 *
4 * All rights reserved.
5 *
6 * Portions of this software were developed by A. Joseph Koshy under
7 * sponsorship from the FreeBSD Foundation and Google, Inc.
8 *
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
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.

--- 7 unchanged lines hidden (view full) ---

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
27#include <sys/cdefs.h>
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.

--- 7 unchanged lines hidden (view full) ---

24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/dev/hwpmc/hwpmc_ppro.c 147989 2005-07-14 15:09:14Z jkoshy $");
32__FBSDID("$FreeBSD: head/sys/dev/hwpmc/hwpmc_ppro.c 174395 2007-12-07 08:20:17Z jkoshy $");
29
30#include <sys/param.h>
31#include <sys/lock.h>
32#include <sys/mutex.h>
33#include <sys/pmc.h>
34#include <sys/pmckern.h>
35#include <sys/smp.h>
36#include <sys/systm.h>
37
33
34#include <sys/param.h>
35#include <sys/lock.h>
36#include <sys/mutex.h>
37#include <sys/pmc.h>
38#include <sys/pmckern.h>
39#include <sys/smp.h>
40#include <sys/systm.h>
41
42#include <machine/cpu.h>
38#include <machine/cpufunc.h>
39#include <machine/md_var.h>
40#include <machine/pmc_mdep.h>
41#include <machine/specialreg.h>
42
43/*
44 * PENTIUM PRO SUPPORT
45 *

--- 659 unchanged lines hidden (view full) ---

705
706 P6_SYNC_CTR_STATE(pc); /* restart CTR1 if need be */
707
708 PMCDBG(MDP,STO,2, "p6-stop/2 cpu=%d ri=%d", cpu, ri);
709 return 0;
710}
711
712static int
43#include <machine/cpufunc.h>
44#include <machine/md_var.h>
45#include <machine/pmc_mdep.h>
46#include <machine/specialreg.h>
47
48/*
49 * PENTIUM PRO SUPPORT
50 *

--- 659 unchanged lines hidden (view full) ---

710
711 P6_SYNC_CTR_STATE(pc); /* restart CTR1 if need be */
712
713 PMCDBG(MDP,STO,2, "p6-stop/2 cpu=%d ri=%d", cpu, ri);
714 return 0;
715}
716
717static int
713p6_intr(int cpu, uintptr_t eip, int usermode)
718p6_intr(int cpu, struct trapframe *tf)
714{
715 int i, error, retval, ri;
716 uint32_t perf0cfg;
717 struct pmc *pm;
718 struct p6_cpu *pc;
719 struct pmc_hw *phw;
720 pmc_value_t v;
721

--- 18 unchanged lines hidden (view full) ---

740 if ((pm = phw->phw_pmc) == NULL ||
741 pm->pm_state != PMC_STATE_RUNNING ||
742 !PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) {
743 continue;
744 }
745
746 retval = 1;
747
719{
720 int i, error, retval, ri;
721 uint32_t perf0cfg;
722 struct pmc *pm;
723 struct p6_cpu *pc;
724 struct pmc_hw *phw;
725 pmc_value_t v;
726

--- 18 unchanged lines hidden (view full) ---

745 if ((pm = phw->phw_pmc) == NULL ||
746 pm->pm_state != PMC_STATE_RUNNING ||
747 !PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) {
748 continue;
749 }
750
751 retval = 1;
752
748 error = pmc_process_interrupt(cpu, pm, eip, usermode);
753 error = pmc_process_interrupt(cpu, pm, tf,
754 TRAPF_USERMODE(tf));
749 if (error)
750 P6_MARK_STOPPED(pc,ri);
751
752 /* reload sampling count */
753 v = pm->pm_sc.pm_reloadcount;
754 wrmsr(P6_MSR_PERFCTR0 + i,
755 P6_RELOAD_COUNT_TO_PERFCTR_VALUE(v));
756

--- 109 unchanged lines hidden ---
755 if (error)
756 P6_MARK_STOPPED(pc,ri);
757
758 /* reload sampling count */
759 v = pm->pm_sc.pm_reloadcount;
760 wrmsr(P6_MSR_PERFCTR0 + i,
761 P6_RELOAD_COUNT_TO_PERFCTR_VALUE(v));
762

--- 109 unchanged lines hidden ---