L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
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
62 l4_umword_t extras) L4_NOTHROW;
63
68l4_platform_ctl_system_suspend_u(l4_cap_idx_t pfc,
69 l4_umword_t extras,
70 l4_utcb_t *utcb) L4_NOTHROW;
71
72
83 l4_umword_t reboot) L4_NOTHROW;
84
89l4_platform_ctl_system_shutdown_u(l4_cap_idx_t pfc,
90 l4_umword_t reboot,
91 l4_utcb_t *utcb) L4_NOTHROW;
92
104 l4_umword_t phys_id,
105 l4_umword_t enable) L4_NOTHROW;
106
111l4_platform_ctl_cpu_allow_shutdown_u(l4_cap_idx_t pfc,
112 l4_umword_t phys_id,
113 l4_umword_t enable,
114 l4_utcb_t *utcb) L4_NOTHROW;
127 l4_umword_t phys_id) L4_NOTHROW;
128
133l4_platform_ctl_cpu_enable_u(l4_cap_idx_t pfc,
134 l4_umword_t phys_id,
135 l4_utcb_t *utcb) L4_NOTHROW;
136
149 l4_umword_t phys_id) L4_NOTHROW;
150
155l4_platform_ctl_cpu_disable_u(l4_cap_idx_t pfc,
156 l4_umword_t phys_id,
157 l4_utcb_t *utcb) L4_NOTHROW;
158
/* ends l4_platform_control_api group */
160
161
180
194
195/* IMPLEMENTATION -----------------------------------------------------------*/
196
197#include <l4/sys/ipc.h>
198
200l4_platform_ctl_system_suspend_u(l4_cap_idx_t pfc,
201 l4_umword_t extras,
202 l4_utcb_t *utcb) L4_NOTHROW
203{
204 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
206 v->mr[1] = extras;
207 return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
209}
210
212l4_platform_ctl_system_shutdown_u(l4_cap_idx_t pfc,
213 l4_umword_t reboot,
214 l4_utcb_t *utcb) L4_NOTHROW
215{
216 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
218 v->mr[1] = reboot;
219 return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
221}
222
223
226 l4_umword_t extras) L4_NOTHROW
227{
228 return l4_platform_ctl_system_suspend_u(pfc, extras, l4_utcb());
229}
230
233 l4_umword_t reboot) L4_NOTHROW
234{
235 return l4_platform_ctl_system_shutdown_u(pfc, reboot, l4_utcb());
236}
237
239l4_platform_ctl_cpu_allow_shutdown_u(l4_cap_idx_t pfc,
240 l4_umword_t phys_id,
241 l4_umword_t enable,
242 l4_utcb_t *utcb) L4_NOTHROW
243{
244 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
246 v->mr[1] = phys_id;
247 v->mr[2] = enable;
248 return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 3, 0, 0),
250}
251
254 l4_umword_t phys_id,
255 l4_umword_t enable) L4_NOTHROW
256{
257 return l4_platform_ctl_cpu_allow_shutdown_u(pfc, phys_id, enable, l4_utcb());
258}
259
261l4_platform_ctl_cpu_enable_u(l4_cap_idx_t pfc,
262 l4_umword_t phys_id,
263 l4_utcb_t *utcb) L4_NOTHROW
264{
265 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
267 v->mr[1] = phys_id;
268 return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
270}
271
273l4_platform_ctl_cpu_disable_u(l4_cap_idx_t pfc,
274 l4_umword_t phys_id,
275 l4_utcb_t *utcb) L4_NOTHROW
276{
277 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
279 v->mr[1] = phys_id;
280 return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
282}
283
286 l4_umword_t phys_id) L4_NOTHROW
287{
288 return l4_platform_ctl_cpu_enable_u(pfc, phys_id, l4_utcb());
289}
290
293 l4_umword_t phys_id) L4_NOTHROW
294{
295 return l4_platform_ctl_cpu_disable_u(pfc, phys_id, l4_utcb());
296}
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:51
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:359
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:576
L4_platform_ctl_proto
Predefined protocol type for messages to platform-control objects.
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:428
@ L4_PROTO_PLATFORM_CTL
Protocol messages to a platform control object.
l4_msgtag_t l4_platform_ctl_cpu_allow_shutdown(l4_cap_idx_t pfc, l4_umword_t phys_id, l4_umword_t enable) L4_NOTHROW
Allow a CPU to be shut down.
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.
l4_msgtag_t l4_platform_ctl_cpu_disable(l4_cap_idx_t pfc, l4_umword_t phys_id) L4_NOTHROW
Disable an online CPU.
l4_msgtag_t l4_platform_ctl_cpu_enable(l4_cap_idx_t pfc, l4_umword_t phys_id) L4_NOTHROW
Enable an offline CPU.
L4_platform_ctl_ops
Operations on platform-control objects.
@ L4_PLATFORM_CTL_CPU_ENABLE_OP
enable an offline CPU
@ L4_PLATFORM_CTL_SYS_SHUTDOWN_OP
shutdown/reboot
@ L4_PLATFORM_CTL_SET_TASK_ASID_OP
Arm: set task ASID.
@ L4_PLATFORM_CTL_CPU_ALLOW_SHUTDOWN_OP
allow CPU shutdown
@ L4_PLATFORM_CTL_SYS_SUSPEND_OP
Suspend.
@ L4_PLATFORM_CTL_CPU_DISABLE_OP
disable an online CPU
#define L4_IPC_NEVER
never timeout
Definition __timeout.h:84
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition utcb.h:67
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
Definition utcb.h:340
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:188
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:62
Common L4 ABI Data Types.
Message tag data structure.
Definition types.h:164
Encapsulation of the message-register block in the UTCB.
Definition utcb.h:79
l4_umword_t mr[L4_UTCB_GENERIC_DATA_SIZE]
Message registers.
Definition utcb.h:80