L4Re - L4 Runtime Environment
platform_control.h
Go to the documentation of this file.
1 
5 /*
6  * (c) 2014 Alexander Warg <alexander.warg@kernkonzept.com>
7  *
8  * This file is part of TUD:OS and distributed under the terms of the
9  * GNU General Public License 2.
10  * Please see the COPYING-GPL-2 file for details.
11  *
12  * As a special exception, you may use this file as part of a free software
13  * library without restriction. Specifically, if other files instantiate
14  * templates or use macros or inline functions from this file, or you compile
15  * this file and link it with other files to produce an executable, this
16  * file does not by itself cause the resulting executable to be covered by
17  * the GNU General Public License. This exception does not however
18  * invalidate any other reasons why the executable file might be covered by
19  * the GNU General Public License.
20  */
21 
22 #pragma once
23 
24 #include <l4/sys/types.h>
25 #include <l4/sys/utcb.h>
26 
51 L4_INLINE l4_msgtag_t
53  l4_umword_t extras) L4_NOTHROW;
54 
58 L4_INLINE l4_msgtag_t
59 l4_platform_ctl_system_suspend_u(l4_cap_idx_t pfc,
60  l4_umword_t extras,
61  l4_utcb_t *utcb) L4_NOTHROW;
62 
63 
72 L4_INLINE l4_msgtag_t
74  l4_umword_t reboot) L4_NOTHROW;
75 
79 L4_INLINE l4_msgtag_t
80 l4_platform_ctl_system_shutdown_u(l4_cap_idx_t pfc,
81  l4_umword_t reboot,
82  l4_utcb_t *utcb) L4_NOTHROW;
83 
92 L4_INLINE l4_msgtag_t
94  l4_umword_t phys_id) L4_NOTHROW;
95 
99 L4_INLINE l4_msgtag_t
100 l4_platform_ctl_cpu_enable_u(l4_cap_idx_t pfc,
101  l4_umword_t phys_id,
102  l4_utcb_t *utcb) L4_NOTHROW;
103 
112 L4_INLINE l4_msgtag_t
114  l4_umword_t phys_id) L4_NOTHROW;
115 
119 L4_INLINE l4_msgtag_t
120 l4_platform_ctl_cpu_disable_u(l4_cap_idx_t pfc,
121  l4_umword_t phys_id,
122  l4_utcb_t *utcb) L4_NOTHROW;
123  /* ends l4_platform_control_api group */
125 
126 
136 {
141 };
142 
148 {
155 };
156 
157 /* IMPLEMENTATION -----------------------------------------------------------*/
158 
159 #include <l4/sys/ipc.h>
160 
161 L4_INLINE l4_msgtag_t
162 l4_platform_ctl_system_suspend_u(l4_cap_idx_t pfc,
163  l4_umword_t extras,
164  l4_utcb_t *utcb) L4_NOTHROW
165 {
166  l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
168  v->mr[1] = extras;
169  return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
170  L4_IPC_NEVER);
171 }
172 
173 L4_INLINE l4_msgtag_t
174 l4_platform_ctl_system_shutdown_u(l4_cap_idx_t pfc,
175  l4_umword_t reboot,
176  l4_utcb_t *utcb) L4_NOTHROW
177 {
178  l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
180  v->mr[1] = reboot;
181  return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
182  L4_IPC_NEVER);
183 }
184 
185 
186 L4_INLINE l4_msgtag_t
188  l4_umword_t extras) L4_NOTHROW
189 {
190  return l4_platform_ctl_system_suspend_u(pfc, extras, l4_utcb());
191 }
192 
193 L4_INLINE l4_msgtag_t
195  l4_umword_t reboot) L4_NOTHROW
196 {
197  return l4_platform_ctl_system_shutdown_u(pfc, reboot, l4_utcb());
198 }
199 
200 L4_INLINE l4_msgtag_t
201 l4_platform_ctl_cpu_enable_u(l4_cap_idx_t pfc,
202  l4_umword_t phys_id,
203  l4_utcb_t *utcb) L4_NOTHROW
204 {
205  l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
207  v->mr[1] = phys_id;
208  return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
209  L4_IPC_NEVER);
210 }
211 
212 L4_INLINE l4_msgtag_t
213 l4_platform_ctl_cpu_disable_u(l4_cap_idx_t pfc,
214  l4_umword_t phys_id,
215  l4_utcb_t *utcb) L4_NOTHROW
216 {
217  l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
219  v->mr[1] = phys_id;
220  return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
221  L4_IPC_NEVER);
222 }
223 
224 L4_INLINE l4_msgtag_t
226  l4_umword_t phys_id) L4_NOTHROW
227 {
228  return l4_platform_ctl_cpu_enable_u(pfc, phys_id, l4_utcb());
229 }
230 
231 L4_INLINE l4_msgtag_t
233  l4_umword_t phys_id) L4_NOTHROW
234 {
235  return l4_platform_ctl_cpu_disable_u(pfc, phys_id, l4_utcb());
236 }
Encapsulation of the message-register block in the UTCB.
Definition: utcb.h:78
l4_umword_t mr[L4_UTCB_GENERIC_DATA_SIZE]
Message registers.
Definition: utcb.h:80
Common L4 ABI Data Types.
l4_msgtag_t l4_ipc_call(l4_cap_idx_t object, l4_utcb_t *utcb, l4_msgtag_t tag, l4_timeout_t timeout) L4_NOTHROW
Object call (usual invocation).
Definition: ipc.h:445
L4_platform_ctl_proto
Predefined protocol type for messages to platform-control objects.
L4_platform_ctl_ops
Operations on platform-control objects.
unsigned long l4_cap_idx_t
L4 Capability selector Type.
Definition: types.h:342
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition: utcb.h:67
l4_msgtag_t l4_platform_ctl_cpu_disable(l4_cap_idx_t pfc, l4_umword_t phys_id) L4_NOTHROW
Disable an online CPU.
#define L4_IPC_NEVER
never timeout
Definition: __timeout.h:80
l4_msgtag_t l4_platform_ctl_system_suspend(l4_cap_idx_t pfc, l4_umword_t extras) L4_NOTHROW
Enter suspend to RAM.
l4_msgtag_t l4_platform_ctl_system_shutdown(l4_cap_idx_t pfc, l4_umword_t reboot) L4_NOTHROW
Shutdown or reboot the system.
unsigned long l4_umword_t
Unsigned machine word.
Definition: l4int.h:52
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
Definition: utcb.h:340
l4_msgtag_t l4_msgtag(long label, unsigned words, unsigned items, unsigned flags) L4_NOTHROW
Create a message tag from the specified values.
Definition: types.h:408
Protocol messages to a platform control object.
Message tag data structure.
Definition: types.h:159
l4_msgtag_t l4_platform_ctl_cpu_enable(l4_cap_idx_t pfc, l4_umword_t phys_id) L4_NOTHROW
Enable an offline CPU.
enable an offline CPU
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition: compiler.h:185