Given the current multitude of timer/clock combinations on i386, but
also considering that we may provide HPET clocks on x86 in the future or
may face other archs with multiple options, this patch reports the
configured timer and clock devices via /proc/xenomai/timer. Example:

# cat /proc/xenomai/timer
status=on:setup=0:clock=4413929837202:timerdev=lapic:clockdev=tsc

Jan
---
 include/asm-generic/hal.h    |    7 +++++++
 include/asm-generic/system.h |    2 ++
 include/asm-x86/hal_32.h     |   10 ++++++++++
 include/asm-x86/hal_64.h     |    2 ++
 ksrc/nucleus/module.c        |    5 +++--
 5 files changed, 24 insertions(+), 2 deletions(-)

Index: xenomai/include/asm-generic/hal.h
===================================================================
--- xenomai.orig/include/asm-generic/hal.h
+++ xenomai/include/asm-generic/hal.h
@@ -49,6 +49,13 @@
 #define RTHAL_CPU_FREQ		(rthal_tunables.cpu_freq)
 #define RTHAL_NR_APCS		BITS_PER_LONG
 
+#ifndef RTHAL_TIMER_DEVICE
+#define RTHAL_TIMER_DEVICE	"<unnamed>"
+#endif
+#ifndef RTHAL_CLOCK_DEVICE
+#define RTHAL_CLOCK_DEVICE	"<unnamed>"
+#endif
+
 #define RTHAL_EVENT_PROPAGATE   0
 #define RTHAL_EVENT_STOP        1
 
Index: xenomai/include/asm-generic/system.h
===================================================================
--- xenomai.orig/include/asm-generic/system.h
+++ xenomai/include/asm-generic/system.h
@@ -125,6 +125,8 @@ typedef struct { atomic_t owner; } xnloc
 
 #define XNARCH_NR_IRQS               RTHAL_NR_IRQS
 #define XNARCH_TIMER_IRQ	     RTHAL_TIMER_IRQ
+#define XNARCH_TIMER_DEVICE          RTHAL_TIMER_DEVICE
+#define XNARCH_CLOCK_DEVICE          RTHAL_CLOCK_DEVICE
 
 #define XNARCH_ROOT_STACKSZ   0	/* Only a placeholder -- no stack */
 
Index: xenomai/include/asm-x86/hal_32.h
===================================================================
--- xenomai.orig/include/asm-x86/hal_32.h
+++ xenomai/include/asm-x86/hal_32.h
@@ -38,6 +38,16 @@
 #define _XENO_ASM_X86_HAL_32_H
 
 #define RTHAL_ARCH_NAME			"i386"
+#ifdef CONFIG_X86_LOCAL_APIC
+# define RTHAL_TIMER_DEVICE		"lapic"
+#else
+# define RTHAL_TIMER_DEVICE		"pit"
+#endif
+#ifdef CONFIG_X86_TSC
+# define RTHAL_CLOCK_DEVICE		"tsc"
+#else
+# define RTHAL_CLOCK_DEVICE		"pit"
+#endif
 
 #include <asm/xenomai/wrappers.h>
 
Index: xenomai/include/asm-x86/hal_64.h
===================================================================
--- xenomai.orig/include/asm-x86/hal_64.h
+++ xenomai/include/asm-x86/hal_64.h
@@ -24,6 +24,8 @@
 #define _XENO_ASM_X86_HAL_64_H
 
 #define RTHAL_ARCH_NAME			"x86_64"
+#define RTHAL_TIMER_DEVICE		"lapic"
+#define RTHAL_CLOCK_DEVICE		"tsc"
 
 #include <asm/xenomai/wrappers.h>
 #include <asm-generic/xenomai/hal.h>    /* Read the generic bits. */
Index: xenomai/ksrc/nucleus/module.c
===================================================================
--- xenomai.orig/ksrc/nucleus/module.c
+++ xenomai/ksrc/nucleus/module.c
@@ -793,9 +793,10 @@ static int timer_read_proc(char *page,
 		tm_status = "off";
 
 	len = sprintf(page,
-		      "status=%s%s:setup=%Lu:clock=%Lu\n",
+		      "status=%s%s:setup=%Lu:clock=%Lu:timerdev=%s:clockdev=%s\n",
 		      tm_status, wd_status, xnarch_tsc_to_ns(nktimerlat),
-		      xntbase_get_rawclock(&nktbase));
+		      xntbase_get_rawclock(&nktbase),
+		      XNARCH_TIMER_DEVICE, XNARCH_CLOCK_DEVICE);
 
 	len -= off;
 	if (len <= off + count)

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to