summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2011-10-07 06:13:38 +0000
committeradrian <adrian@FreeBSD.org>2011-10-07 06:13:38 +0000
commit43d046c97a20bc0e31e43dbb644035f79a8ecf1a (patch)
tree3959c47af922fc710a6028743f45d8774ce8ca0a
parenta2b5592daeb3832bd468c2f86946f4e3e4e6090f (diff)
downloadFreeBSD-src-43d046c97a20bc0e31e43dbb644035f79a8ecf1a.zip
FreeBSD-src-43d046c97a20bc0e31e43dbb644035f79a8ecf1a.tar.gz
Begin implementing correct MIPS24K sampling mode behaviour.
* Add the interrupt bit in the configuration register * Correctly set the counter register for the sampling overflow interrupt. The interrupt is asserted when bit 31 is set. So set the overflow value at 0x80000000 and subtract the programmed value as appropriate.
-rw-r--r--sys/dev/hwpmc/hwpmc_mips24k.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/hwpmc/hwpmc_mips24k.h b/sys/dev/hwpmc/hwpmc_mips24k.h
index 5944e45..876bbe8 100644
--- a/sys/dev/hwpmc/hwpmc_mips24k.h
+++ b/sys/dev/hwpmc/hwpmc_mips24k.h
@@ -35,7 +35,7 @@
PMC_CAP_WRITE | PMC_CAP_INVERT | \
PMC_CAP_QUALIFIER)
-
+#define MIPS24K_PMC_INTERRUPT_ENABLE 0x10 /* Enable interrupts */
#define MIPS24K_PMC_USER_ENABLE 0x08 /* Count in USER mode */
#define MIPS24K_PMC_SUPER_ENABLE 0x04 /* Count in SUPERVISOR mode */
#define MIPS24K_PMC_KERNEL_ENABLE 0x02 /* Count in KERNEL mode */
@@ -43,9 +43,12 @@
MIPS24K_PMC_SUPER_ENABLE | \
MIPS24K_PMC_KERNEL_ENABLE)
-
-#define MIPS24K_RELOAD_COUNT_TO_PERFCTR_VALUE(R) (-(R))
-#define MIPS24K_PERFCTR_VALUE_TO_RELOAD_COUNT(P) (-(P))
+/*
+ * Interrupts are posted when bit 31 of the relevant
+ * counter is set.
+ */
+#define MIPS24K_RELOAD_COUNT_TO_PERFCTR_VALUE(R) (0x80000000 - (R))
+#define MIPS24K_PERFCTR_VALUE_TO_RELOAD_COUNT(P) ((P) - 0x80000000)
#define MIPS24K_PMC_SELECT 0x4 /* Which bit position the event starts at. */
#define MIPS24K_PMC_OFFSET 2 /* Control registers are 0, 2, 4, etc. */
OpenPOWER on IntegriCloud