[rtems-libbsd commit] Add support for EARLY_COUNTER
Sebastian Huber
sebh at rtems.org
Thu Nov 14 06:05:46 UTC 2019
Module: rtems-libbsd
Branch: 5-freebsd-12
Commit: b5f802ef431b78f6b0474bd1234a9a9e9b8b7fd6
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=b5f802ef431b78f6b0474bd1234a9a9e9b8b7fd6
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Sep 25 10:58:00 2019 +0200
Add support for EARLY_COUNTER
---
freebsd/sys/kern/subr_counter.c | 3 +++
freebsd/sys/sys/pcpu.h | 4 ++++
rtemsbsd/include/machine/counter.h | 10 ++++++++++
3 files changed, 17 insertions(+)
diff --git a/freebsd/sys/kern/subr_counter.c b/freebsd/sys/kern/subr_counter.c
index 66cda02..2855a5d 100644
--- a/freebsd/sys/kern/subr_counter.c
+++ b/freebsd/sys/kern/subr_counter.c
@@ -174,3 +174,6 @@ counter_ratecheck(struct counter_rate *cr, int64_t limit)
return (val);
}
+#ifdef __rtems__
+uint64_t _bsd_early_counter[_BSD_EARLY_COUNTER_SIZE];
+#endif /* __rtems__ */
diff --git a/freebsd/sys/sys/pcpu.h b/freebsd/sys/sys/pcpu.h
index de5936f..0ce30af 100644
--- a/freebsd/sys/sys/pcpu.h
+++ b/freebsd/sys/sys/pcpu.h
@@ -227,7 +227,11 @@ extern struct pcpu *cpuid_to_pcpu[];
#endif
#define curvidata PCPU_GET(vidata)
+#ifndef __rtems__
#define UMA_PCPU_ALLOC_SIZE PAGE_SIZE
+#else /* __rtems__ */
+#define UMA_PCPU_ALLOC_SIZE (PAGE_SIZE / 32)
+#endif /* __rtems__ */
#ifndef __rtems__
#ifdef CTASSERT
diff --git a/rtemsbsd/include/machine/counter.h b/rtemsbsd/include/machine/counter.h
index 4c25d61..1705e39 100644
--- a/rtemsbsd/include/machine/counter.h
+++ b/rtemsbsd/include/machine/counter.h
@@ -36,6 +36,16 @@
#include <rtems/score/isrlevel.h>
+#ifdef RTEMS_SMP
+#define _BSD_EARLY_COUNTER_SIZE (CPU_MAXIMUM_PROCESSORS * UMA_PCPU_ALLOC_SIZE)
+#else
+#define _BSD_EARLY_COUNTER_SIZE 1
+#endif
+
+extern uint64_t _bsd_early_counter[_BSD_EARLY_COUNTER_SIZE];
+
+#define EARLY_COUNTER (&_bsd_early_counter[0])
+
#ifdef IN_SUBR_COUNTER_C
static inline uint64_t
More information about the vc
mailing list