hc
2024-11-01 2f529f9b558ca1c1bd74be7437a84e4711743404
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
 * SPDX-License-Identifier: GPL-2.0
 */
 
#ifndef _COBALT_KERNEL_IPIPE_PIPELINE_H
#define _COBALT_KERNEL_IPIPE_PIPELINE_H
 
#ifdef CONFIG_IPIPE_LEGACY
#error "CONFIG_IPIPE_LEGACY must be switched off"
#endif
 
#include <pipeline/machine.h>
#include <asm/xenomai/features.h>
#include <asm/xenomai/syscall.h>
 
#define xnsched_primary_domain  cobalt_pipeline.domain
 
#define PIPELINE_NR_IRQS  IPIPE_NR_IRQS
 
typedef unsigned long spl_t;
 
#define splhigh(x)  ((x) = ipipe_test_and_stall_head() & 1)
#ifdef CONFIG_SMP
#define splexit(x)  ipipe_restore_head(x & 1)
#else /* !CONFIG_SMP */
#define splexit(x)  ipipe_restore_head(x)
#endif /* !CONFIG_SMP */
#define splmax()    ipipe_stall_head()
#define splnone()   ipipe_unstall_head()
#define spltest()   ipipe_test_head()
 
#define is_secondary_domain()    ipipe_root_p
#define is_primary_domain()    (!ipipe_root_p)
 
#ifdef CONFIG_SMP
 
static inline int pipeline_request_resched_ipi(void (*handler)(void))
{
   return ipipe_request_irq(&cobalt_pipeline.domain,
               IPIPE_RESCHEDULE_IPI,
               (ipipe_irq_handler_t)handler,
               NULL, NULL);
}
 
static inline void pipeline_free_resched_ipi(void)
{
   ipipe_free_irq(&cobalt_pipeline.domain,
       IPIPE_RESCHEDULE_IPI);
}
 
static inline void pipeline_send_resched_ipi(const struct cpumask *dest)
{
   ipipe_send_ipi(IPIPE_RESCHEDULE_IPI, *dest);
}
 
static inline void pipeline_send_timer_ipi(const struct cpumask *dest)
{
   ipipe_send_ipi(IPIPE_HRTIMER_IPI, *dest);
}
 
#else  /* !CONFIG_SMP */
 
static inline int pipeline_request_resched_ipi(void (*handler)(void))
{
   return 0;
}
 
 
static inline void pipeline_free_resched_ipi(void)
{
}
 
#endif    /* CONFIG_SMP */
 
static inline void pipeline_prepare_panic(void)
{
   ipipe_prepare_panic();
}
 
static inline void pipeline_collect_features(struct cobalt_featinfo *f)
{
   f->clock_freq = cobalt_pipeline.clock_freq;
}
 
static inline void pipeline_get_syscall_args(struct task_struct *task,
                        struct pt_regs *regs,
                        unsigned long *args)
{
   *args++ = __xn_reg_arg1(regs);
   *args++ = __xn_reg_arg2(regs);
   *args++ = __xn_reg_arg3(regs);
   *args++ = __xn_reg_arg4(regs);
   *args   = __xn_reg_arg5(regs);
}
 
#endif /* !_COBALT_KERNEL_IPIPE_PIPELINE_H */