summaryrefslogtreecommitdiffstats
path: root/sys/dev/hwpmc
diff options
context:
space:
mode:
authorjkoshy <jkoshy@FreeBSD.org>2009-10-24 01:58:10 +0000
committerjkoshy <jkoshy@FreeBSD.org>2009-10-24 01:58:10 +0000
commit618cf470ad3ab354dc0cbe97d57f6ff9aecb226e (patch)
tree986bf5a983d711fd4edac0bf57195150f92762ba /sys/dev/hwpmc
parent305f44a5b165fdb1923a69b5b51da43b8de5ed5d (diff)
downloadFreeBSD-src-618cf470ad3ab354dc0cbe97d57f6ff9aecb226e.zip
FreeBSD-src-618cf470ad3ab354dc0cbe97d57f6ff9aecb226e.tar.gz
Only claim that the PMC_CLASS_IAF PMCs are supported by a CPU if
there are PMCs on the CPU that belong to the class. Review and testing by: fabient
Diffstat (limited to 'sys/dev/hwpmc')
-rw-r--r--sys/dev/hwpmc/hwpmc_core.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/sys/dev/hwpmc/hwpmc_core.c b/sys/dev/hwpmc/hwpmc_core.c
index d4f065b..b6de04d 100644
--- a/sys/dev/hwpmc/hwpmc_core.c
+++ b/sys/dev/hwpmc/hwpmc_core.c
@@ -1977,11 +1977,21 @@ pmc_core_initialize(struct pmc_mdep *md, int maxcpu)
core_iaf_npmc = cpuid[CORE_CPUID_EDX] & 0x1F;
core_iaf_width = (cpuid[CORE_CPUID_EDX] >> 5) & 0xFF;
- iaf_initialize(md, maxcpu, core_iaf_npmc, core_iaf_width);
-
- core_pmcmask |= ((1ULL << core_iaf_npmc) - 1) <<
- IAF_OFFSET;
-
+ if (core_iaf_npmc > 0) {
+ iaf_initialize(md, maxcpu, core_iaf_npmc,
+ core_iaf_width);
+ core_pmcmask |= ((1ULL << core_iaf_npmc) - 1) <<
+ IAF_OFFSET;
+ } else {
+ /*
+ * Adjust the number of classes exported to
+ * user space.
+ */
+ md->pmd_nclass--;
+ KASSERT(md->pmd_nclass == 2,
+ ("[core,%d] unexpected nclass %d", __LINE__,
+ md->pmd_nclass));
+ }
}
PMCDBG(MDP,INI,1,"core-init pmcmask=0x%jx iafri=%d", core_pmcmask,
OpenPOWER on IntegriCloud