Unify x86 HAL
PATCH 1/5 Unify x86 HAL
This is v2 of my already posted refactoring of the x86 HAL. Saves duplicates and actually makes following fixes/reworks simpler.
Jan
--- include/asm-x86/hal.h | 14 + include/asm-x86/hal_32.h | 42 ++++ include/asm-x86/hal_64.h | 20 ++ include/asm-x86/wrappers_64.h | 3 ksrc/arch/x86/Makefile | 4 ksrc/arch/x86/hal-shared.c | 371 +++++++++++++++++++++++++++++++++++++++++ ksrc/arch/x86/hal_32.c | 375 ------------------------------------------ ksrc/arch/x86/hal_64.c | 313 ----------------------------------- 8 files changed, 453 insertions(+), 689 deletions(-)
include/asm-x86/hal.h +14 -0
@@ -1,5 +1,19 @@ +#ifndef _XENO_ASM_X86_HAL_H +#define _XENO_ASM_X86_HAL_H + +enum rthal_ktimer_mode {/* <!> Must follow enum clock_event_mode */ +KTIMER_MODE_UNUSED =0 , +KTIMER_MODE_SHUTDOWN , +KTIMER_MODE_PERIODIC , +KTIMER_MODE_ONESHOT , +}; + +extern enum rthal_ktimer_mode rthal_ktimer_saved_mode; +#ifdef __i386__#include "hal_32.h" #else #include "hal_64.h" #endif + +#endif /* !_XENO_ASM_X86_HAL_H */
include/asm-x86/hal_32.h +40 -2
64 lines not on this page · raw message
include/asm-x86/hal_64.h +19 -1
@@ -22,7 +22,8 @@#ifndef _XENO_ASM_X86_HAL_64_H#define _XENO_ASM_X86_HAL_64_H -#define _XENO_ASM_X86_HAL_H + +#define RTHAL_ARCH_NAME "x86_64"#include <asm/xenomai/wrappers.h> #include <asm-generic/xenomai/hal.h> /* Read the generic bits. */
@@ -116,6 +117,23 @@ static const char *const rthal_fault_lab [20] = NULL, }; +#ifdef CONFIG_X86_LOCAL_APIC + +#include <asm/mach_apic.h> + +static inline void rthal_setup_periodic_apic (int count,int vector) +{ +apic_write (APIC_LVTT ,APIC_LVT_TIMER_PERIODIC | vector); +apic_write (APIC_TMICT , count); +} + +static inline void rthal_setup_oneshot_apic (int vector) +{ +apic_write (APIC_LVTT , vector); +} + +#endif /* !CONFIG_X86_LOCAL_APIC */ +#endif /* !__cplusplus */ long rthal_strncpy_from_user(char *dst,
ksrc/arch/x86/Makefile +2 -2
@@ -10,7 +10,7 @@ endif obj-$(CONFIG_XENOMAI) += xeno_hal.o -xeno_hal-y := hal_$(X86_MODE).o usercopy_$(X86_MODE).o +xeno_hal-y := hal_$(X86_MODE).o hal-shared.o usercopy_$(X86_MODE).o xeno_hal-$(CONFIG_XENO_HW_NMI_DEBUG_LATENCY) += nmi_$(X86_MODE).o
@@ -26,7 +26,7 @@ USE_STANDARD_AS_RULE := true O_TARGET := built-in.o -obj-y := hal_32.o +obj-y := hal_32.o hal-shared.o obj-$(CONFIG_XENO_HW_NMI_DEBUG_LATENCY) += nmi_32.o
ksrc/arch/x86/hal-shared.c new file +371 -0
371 lines not on this page · raw message
ksrc/arch/x86/hal_32.c +4 -371
425 lines not on this page · raw message
ksrc/arch/x86/hal_64.c +0 -313
328 lines not on this page · raw message
include/asm-x86/wrappers_64.h +3 -0
@@ -37,4 +37,7 @@typedef irq_handler_t rthal_irq_host_handler_t ; +#define DECLARE_LINUX_IRQ_HANDLER (fn, irq, dev_id) \ + irqreturn_t fn(int irq, void *dev_id) +#endif /* _XENO_ASM_X86_WRAPPERS_64_H */