Update due to Watchdog Handler changes

This commit is contained in:
Sebastian Huber 2016-03-14 09:25:04 +01:00
parent 96bf77b2f9
commit a336c46301
3 changed files with 19 additions and 13 deletions

View File

@ -88,6 +88,7 @@ __FBSDID("$FreeBSD$");
#endif #endif
#ifdef __rtems__ #ifdef __rtems__
#include <machine/rtems-bsd-thread.h> #include <machine/rtems-bsd-thread.h>
#undef ticks
#include <rtems/score/threadimpl.h> #include <rtems/score/threadimpl.h>
#include <rtems/score/watchdogimpl.h> #include <rtems/score/watchdogimpl.h>
#endif /* __rtems__ */ #endif /* __rtems__ */
@ -176,7 +177,7 @@ static void sleepq_switch(void *wchan, int pri);
#ifndef __rtems__ #ifndef __rtems__
static void sleepq_timeout(void *arg); static void sleepq_timeout(void *arg);
#else /* __rtems__ */ #else /* __rtems__ */
static void sleepq_timeout(Objects_Id id, void *arg); static void sleepq_timeout(Watchdog_Control *watchdog);
#endif /* __rtems__ */ #endif /* __rtems__ */
SDT_PROBE_DECLARE(sched, , , sleep); SDT_PROBE_DECLARE(sched, , , sleep);
@ -417,15 +418,16 @@ sleepq_set_timeout(void *wchan, int timo)
MPASS(wchan != NULL); MPASS(wchan != NULL);
callout_reset_curcpu(&td->td_slpcallout, timo, sleepq_timeout, td); callout_reset_curcpu(&td->td_slpcallout, timo, sleepq_timeout, td);
#else /* __rtems__ */ #else /* __rtems__ */
Per_CPU_Control *cpu_self;
Thread_Control *executing; Thread_Control *executing;
_Thread_Disable_dispatch(); cpu_self = _Thread_Dispatch_disable();
executing = _Thread_Executing; executing = _Per_CPU_Get_executing(cpu_self);
BSD_ASSERT(executing->Timer.state == WATCHDOG_INACTIVE); BSD_ASSERT(_Watchdog_Get_state(&executing->Timer.Watchdog) ==
_Watchdog_Initialize(&executing->Timer, sleepq_timeout, WATCHDOG_INACTIVE);
0, executing); _Thread_Timer_insert_relative(executing, cpu_self, sleepq_timeout,
_Watchdog_Insert_ticks(&executing->Timer, (Watchdog_Interval)timo); (Watchdog_Interval)timo);
_Thread_Enable_dispatch(); _Thread_Dispatch_enable(cpu_self);
#endif /* __rtems__ */ #endif /* __rtems__ */
} }
@ -666,7 +668,7 @@ sleepq_switch(void *wchan, int pri)
_Thread_Lock_release_default(executing, &lock_context); _Thread_Lock_release_default(executing, &lock_context);
if (unblock) { if (unblock) {
_Watchdog_Remove_ticks(&executing->Timer); _Thread_Timer_remove(executing);
_Thread_Clear_state(executing, STATES_WAITING_FOR_BSD_WAKEUP); _Thread_Clear_state(executing, STATES_WAITING_FOR_BSD_WAKEUP);
} }
@ -950,7 +952,7 @@ sleepq_resume_thread(struct sleepqueue *sq, struct thread *td, int pri)
return (setrunnable(td)); return (setrunnable(td));
} }
#else /* __rtems__ */ #else /* __rtems__ */
unblock = _Watchdog_Is_active(&thread->Timer); unblock = _Watchdog_Is_scheduled(&thread->Timer.Watchdog);
switch (td->td_sq_state) { switch (td->td_sq_state) {
case TD_SQ_SLEEPING: case TD_SQ_SLEEPING:
unblock = true; unblock = true;
@ -971,7 +973,7 @@ sleepq_resume_thread(struct sleepqueue *sq, struct thread *td, int pri)
cpu_self = _Thread_Dispatch_disable_critical(&lock_context); cpu_self = _Thread_Dispatch_disable_critical(&lock_context);
_Thread_Lock_release_default(thread, &lock_context); _Thread_Lock_release_default(thread, &lock_context);
_Watchdog_Remove_ticks(&thread->Timer); _Thread_Timer_remove(thread);
_Thread_Clear_state(thread, STATES_WAITING_FOR_BSD_WAKEUP); _Thread_Clear_state(thread, STATES_WAITING_FOR_BSD_WAKEUP);
_Thread_Dispatch_enable(cpu_self); _Thread_Dispatch_enable(cpu_self);
@ -1166,14 +1168,14 @@ sleepq_timeout(void *arg)
} }
#else /* __rtems__ */ #else /* __rtems__ */
static void static void
sleepq_timeout(Objects_Id id, void *arg) sleepq_timeout(Watchdog_Control *watchdog)
{ {
Thread_Control *thread; Thread_Control *thread;
struct thread *td; struct thread *td;
ISR_lock_Context lock_context; ISR_lock_Context lock_context;
bool unblock; bool unblock;
thread = arg; thread = RTEMS_CONTAINER_OF(watchdog, Thread_Control, Timer.Watchdog);
td = rtems_bsd_get_thread(thread); td = rtems_bsd_get_thread(thread);
BSD_ASSERT(td != NULL); BSD_ASSERT(td != NULL);

View File

@ -1898,6 +1898,8 @@ selectinit(void *dummy __unused)
#ifdef __rtems__ #ifdef __rtems__
#include <machine/rtems-bsd-thread.h> #include <machine/rtems-bsd-thread.h>
#undef ticks
#include <rtems/score/objectimpl.h> #include <rtems/score/objectimpl.h>
#include <rtems/score/threadimpl.h> #include <rtems/score/threadimpl.h>

View File

@ -53,6 +53,8 @@
#include <rtems/bsd/bsd.h> #include <rtems/bsd/bsd.h>
#undef ticks
#include <rtems/score/objectimpl.h> #include <rtems/score/objectimpl.h>
#include <rtems/score/statesimpl.h> #include <rtems/score/statesimpl.h>
#include <rtems/score/threaddispatch.h> #include <rtems/score/threaddispatch.h>