Skip to contentSkip to conversation

fix 2.4 build of mksound workaround

PATCH Applied Jan Kiszka 2 participants 2 messages Aug 14, 2006 – Aug 18, 2006

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 fix 2.4 build of mksound workaround

Hi Philippe,

various issues with the new mksound workaround for x86-2.4 kernels popped up here during test builds (wrong dependency on CONFIG_XENO_HW_NMI_DEBUG_LATENCY, missing dep on CONFIG_VT, missing linux/vt_kern.h). The attached patch aims at fixing them. Compile-tested over 2.4.33.

Additionally, you may remove the EXPORT_SYMBOL(kd_mksound) from the latest ipipe patch. A) it's broken in case of !CONFIG_VT, B) it should not be required given that kd_mksound is only needed by the hal, and that's built-in anyway. Or do you have non-Xenomai users in mind here?

Jan

arch/i386/hal.c +14 -10
Index: ksrc/arch/i386/hal.c
===================================================================
@@ -62,6 +62,16 @@
 #include <asm/xenomai/hal.h>
 #include <stdarg.h>
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) && !defined(CONFIG_X86_TSC) && defined(CONFIG_VT)
+#include <linux/vt_kern.h>
+
+static void (*old_mksound)(unsigned int hz, unsigned int ticks);
+
+static void dummy_mksound (unsigned int hz, unsigned int ticks)
+{
+}
+#endif /* Linux < 2.6 && !CONFIG_X86_TSC && CONFIG_VT */
+
 extern struct desc_struct idt_table[];
 
 static struct {
@@ -206,12 +216,6 @@ void die_nmi(struct pt_regs *regs, const
     do_exit(SIGSEGV);
 }
 
-static void (*old_mksound)(unsigned int hz, unsigned int ticks);
-
-static void dummy_mksound (unsigned int hz, unsigned int ticks)
-{
-}
-
 #else /* Linux >= 2.6 */
 #include <asm/nmi.h>
 #endif /* Linux < 2.6 */
@@ -601,13 +605,13 @@ int rthal_arch_init(void)
         rthal_smi_restore();
         return -ENODEV;
     }
-#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) && !defined(CONFIG_X86_TSC)
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) && !defined(CONFIG_X86_TSC) && defined(CONFIG_VT)
     /* Prevent the speaker code from bugging our TSC emulation, also
        based on PIT channel 2. kd_mksound is exported by the Adeos
        patch. */
     old_mksound = kd_mksound;
     kd_mksound = &dummy_mksound;
-#endif /* !CONFIG_X86_LOCAL_APIC && Linux < 2.6 && !CONFIG_X86_TSC */
+#endif /* !CONFIG_X86_LOCAL_APIC && Linux < 2.6 && !CONFIG_X86_TSC && CONFIG_VT */
 
     if (rthal_cpufreq_arg == 0)
 #ifdef CONFIG_X86_TSC
@@ -631,10 +635,10 @@ int rthal_arch_init(void)
 
 void rthal_arch_cleanup(void)
 {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) && !defined(CONFIG_X86_TSC)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) && !defined(CONFIG_X86_TSC) && defined(CONFIG_VT)
     /* Restore previous PC speaker code. */
     kd_mksound = old_mksound;
-#endif /* Linux < 2.6 && !CONFIG_X86_TSC */
+#endif /* Linux < 2.6 && !CONFIG_X86_TSC && CONFIG_VT */
     printk(KERN_INFO "Xenomai: hal/x86 stopped.\n");
 }
 
#1 lore raw
Quoted 7 lines · Jan Kiszka

Hi Philippe,

various issues with the new mksound workaround for x86-2.4 kernels popped up here during test builds (wrong dependency on CONFIG_XENO_HW_NMI_DEBUG_LATENCY, missing dep on CONFIG_VT, missing linux/vt_kern.h). The attached patch aims at fixing them. Compile-tested over 2.4.33.

Applied, thanks.

Quoted 6 lines

Additionally, you may remove the EXPORT_SYMBOL(kd_mksound) from the latest ipipe patch. A) it's broken in case of !CONFIG_VT, B) it should not be required given that kd_mksound is only needed by the hal, and that's built-in anyway. Or do you have non-Xenomai users in mind here?

Nope. This export is indeed useless and will be removed, thanks.

Quoted 65 lines

Jan
plain text document attachment (fix-mksound-workaround.patch)
Index: ksrc/arch/i386/hal.c
===================================================================

arch/i386/hal.c +14 -10
@@ -62,6 +62,16 @@
 #include <asm/xenomai/hal.h>
 #include <stdarg.h>
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) && !defined(CONFIG_X86_TSC) && defined(CONFIG_VT)
+#include <linux/vt_kern.h>
+
+static void (*old_mksound)(unsigned int hz, unsigned int ticks);
+
+static void dummy_mksound (unsigned int hz, unsigned int ticks)
+{
+}
+#endif /* Linux < 2.6 && !CONFIG_X86_TSC && CONFIG_VT */
+
 extern struct desc_struct idt_table[];
 
 static struct {
@@ -206,12 +216,6 @@ void die_nmi(struct pt_regs *regs, const
     do_exit(SIGSEGV);
 }
 
-static void (*old_mksound)(unsigned int hz, unsigned int ticks);
-
-static void dummy_mksound (unsigned int hz, unsigned int ticks)
-{
-}
-
 #else /* Linux >= 2.6 */
 #include <asm/nmi.h>
 #endif /* Linux < 2.6 */
@@ -601,13 +605,13 @@ int rthal_arch_init(void)
         rthal_smi_restore();
         return -ENODEV;
     }
-#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) && !defined(CONFIG_X86_TSC)
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) && !defined(CONFIG_X86_TSC) && defined(CONFIG_VT)
     /* Prevent the speaker code from bugging our TSC emulation, also
        based on PIT channel 2. kd_mksound is exported by the Adeos
        patch. */
     old_mksound = kd_mksound;
     kd_mksound = &dummy_mksound;
-#endif /* !CONFIG_X86_LOCAL_APIC && Linux < 2.6 && !CONFIG_X86_TSC */
+#endif /* !CONFIG_X86_LOCAL_APIC && Linux < 2.6 && !CONFIG_X86_TSC && CONFIG_VT */
 
     if (rthal_cpufreq_arg == 0)
 #ifdef CONFIG_X86_TSC
@@ -631,10 +635,10 @@ int rthal_arch_init(void)
 
 void rthal_arch_cleanup(void)
 {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) && !defined(CONFIG_X86_TSC)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) && !defined(CONFIG_X86_TSC) && defined(CONFIG_VT)
     /* Restore previous PC speaker code. */
     kd_mksound = old_mksound;
-#endif /* Linux < 2.6 && !CONFIG_X86_TSC */
+#endif /* Linux < 2.6 && !CONFIG_X86_TSC && CONFIG_VT */
     printk(KERN_INFO "Xenomai: hal/x86 stopped.\n");
 }
 
Signature · 1 line
Philippe.