Deleted Added
full compact
hwpmc_core.c (295560) hwpmc_core.c (298411)
1/*-
2 * Copyright (c) 2008 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

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

24 * SUCH DAMAGE.
25 */
26
27/*
28 * Intel Core PMCs.
29 */
30
31#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2008 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

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

24 * SUCH DAMAGE.
25 */
26
27/*
28 * Intel Core PMCs.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/dev/hwpmc/hwpmc_core.c 295560 2016-02-12 07:27:24Z kib $");
32__FBSDID("$FreeBSD: head/sys/dev/hwpmc/hwpmc_core.c 298411 2016-04-21 15:38:28Z pfg $");
33
34#include <sys/param.h>
35#include <sys/bus.h>
36#include <sys/pmc.h>
37#include <sys/pmckern.h>
38#include <sys/systm.h>
39
40#include <machine/intr_machdep.h>

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

1889 IAPDESCR(FDH_02H, 0xFD, 0x02, IAP_F_FM | IAP_F_WM | IAP_F_I7),
1890 IAPDESCR(FDH_04H, 0xFD, 0x04, IAP_F_FM | IAP_F_WM | IAP_F_I7),
1891 IAPDESCR(FDH_08H, 0xFD, 0x08, IAP_F_FM | IAP_F_WM | IAP_F_I7),
1892 IAPDESCR(FDH_10H, 0xFD, 0x10, IAP_F_FM | IAP_F_WM | IAP_F_I7),
1893 IAPDESCR(FDH_20H, 0xFD, 0x20, IAP_F_FM | IAP_F_WM | IAP_F_I7),
1894 IAPDESCR(FDH_40H, 0xFD, 0x40, IAP_F_FM | IAP_F_WM | IAP_F_I7),
1895};
1896
33
34#include <sys/param.h>
35#include <sys/bus.h>
36#include <sys/pmc.h>
37#include <sys/pmckern.h>
38#include <sys/systm.h>
39
40#include <machine/intr_machdep.h>

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

1889 IAPDESCR(FDH_02H, 0xFD, 0x02, IAP_F_FM | IAP_F_WM | IAP_F_I7),
1890 IAPDESCR(FDH_04H, 0xFD, 0x04, IAP_F_FM | IAP_F_WM | IAP_F_I7),
1891 IAPDESCR(FDH_08H, 0xFD, 0x08, IAP_F_FM | IAP_F_WM | IAP_F_I7),
1892 IAPDESCR(FDH_10H, 0xFD, 0x10, IAP_F_FM | IAP_F_WM | IAP_F_I7),
1893 IAPDESCR(FDH_20H, 0xFD, 0x20, IAP_F_FM | IAP_F_WM | IAP_F_I7),
1894 IAPDESCR(FDH_40H, 0xFD, 0x40, IAP_F_FM | IAP_F_WM | IAP_F_I7),
1895};
1896
1897static const int niap_events = sizeof(iap_events) / sizeof(iap_events[0]);
1898
1899static pmc_value_t
1900iap_perfctr_value_to_reload_count(pmc_value_t v)
1901{
1902
1903 /* If the PMC has overflowed, return a reload count of zero. */
1904 if ((v & (1ULL << (core_iap_width - 1))) == 0)
1905 return (0);
1906 v &= (1ULL << core_iap_width) - 1;

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

2246 case PMC_CPU_INTEL_SANDYBRIDGE_XEON:
2247 cpuflag = IAP_F_SBX;
2248 break;
2249 case PMC_CPU_INTEL_WESTMERE:
2250 cpuflag = IAP_F_WM;
2251 break;
2252 }
2253
1897static pmc_value_t
1898iap_perfctr_value_to_reload_count(pmc_value_t v)
1899{
1900
1901 /* If the PMC has overflowed, return a reload count of zero. */
1902 if ((v & (1ULL << (core_iap_width - 1))) == 0)
1903 return (0);
1904 v &= (1ULL << core_iap_width) - 1;

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

2244 case PMC_CPU_INTEL_SANDYBRIDGE_XEON:
2245 cpuflag = IAP_F_SBX;
2246 break;
2247 case PMC_CPU_INTEL_WESTMERE:
2248 cpuflag = IAP_F_WM;
2249 break;
2250 }
2251
2254 for (n = 0, ie = iap_events; n < niap_events; n++, ie++)
2252 for (n = 0, ie = iap_events; n < nitems(iap_events); n++, ie++)
2255 if (ie->iap_ev == ev && ie->iap_flags & cpuflag)
2256 break;
2257
2253 if (ie->iap_ev == ev && ie->iap_flags & cpuflag)
2254 break;
2255
2258 if (n == niap_events)
2256 if (n == nitems(iap_events))
2259 return (EINVAL);
2260
2261 /*
2262 * A matching event descriptor has been found, so start
2263 * assembling the contents of the event select register.
2264 */
2265 evsel = ie->iap_evcode;
2266

--- 670 unchanged lines hidden ---
2257 return (EINVAL);
2258
2259 /*
2260 * A matching event descriptor has been found, so start
2261 * assembling the contents of the event select register.
2262 */
2263 evsel = ie->iap_evcode;
2264

--- 670 unchanged lines hidden ---