L4Re Operating System Framework
Interface and Usage Documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
platform_control.h
Go to the documentation of this file.
1
5/*
6 * (c) 2014 Alexander Warg <alexander.warg@kernkonzept.com>
7 *
8 * License: see LICENSE.spdx (in this directory or the directories above)
9 */
10
11#pragma once
12
13#include <l4/sys/types.h>
14#include <l4/sys/utcb.h>
15
51 l4_umword_t extras) L4_NOTHROW;
52
57l4_platform_ctl_system_suspend_u(l4_cap_idx_t pfc,
58 l4_umword_t extras,
59 l4_utcb_t *utcb) L4_NOTHROW;
60
61
72 l4_umword_t reboot) L4_NOTHROW;
73
78l4_platform_ctl_system_shutdown_u(l4_cap_idx_t pfc,
79 l4_umword_t reboot,
80 l4_utcb_t *utcb) L4_NOTHROW;
81
93 l4_umword_t phys_id,
94 l4_umword_t enable) L4_NOTHROW;
95
100l4_platform_ctl_cpu_allow_shutdown_u(l4_cap_idx_t pfc,
101 l4_umword_t phys_id,
102 l4_umword_t enable,
103 l4_utcb_t *utcb) L4_NOTHROW;
116 l4_umword_t phys_id) L4_NOTHROW;
117
122l4_platform_ctl_cpu_enable_u(l4_cap_idx_t pfc,
123 l4_umword_t phys_id,
124 l4_utcb_t *utcb) L4_NOTHROW;
125
138 l4_umword_t phys_id) L4_NOTHROW;
139
144l4_platform_ctl_cpu_disable_u(l4_cap_idx_t pfc,
145 l4_umword_t phys_id,
146 l4_utcb_t *utcb) L4_NOTHROW;
147
/* ends l4_platform_control_api group */
149
150
169
183
184/* IMPLEMENTATION -----------------------------------------------------------*/
185
186#include <l4/sys/ipc.h>
187
189l4_platform_ctl_system_suspend_u(l4_cap_idx_t pfc,
190 l4_umword_t extras,
191 l4_utcb_t *utcb) L4_NOTHROW
192{
193 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
195 v->mr[1] = extras;
196 return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
198}
199
201l4_platform_ctl_system_shutdown_u(l4_cap_idx_t pfc,
202 l4_umword_t reboot,
203 l4_utcb_t *utcb) L4_NOTHROW
204{
205 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
207 v->mr[1] = reboot;
208 return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
210}
211
212
215 l4_umword_t extras) L4_NOTHROW
216{
217 return l4_platform_ctl_system_suspend_u(pfc, extras, l4_utcb());
218}
219
222 l4_umword_t reboot) L4_NOTHROW
223{
224 return l4_platform_ctl_system_shutdown_u(pfc, reboot, l4_utcb());
225}
226
228l4_platform_ctl_cpu_allow_shutdown_u(l4_cap_idx_t pfc,
229 l4_umword_t phys_id,
230 l4_umword_t enable,
231 l4_utcb_t *utcb) L4_NOTHROW
232{
233 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
235 v->mr[1] = phys_id;
236 v->mr[2] = enable;
237 return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 3, 0, 0),
239}
240
243 l4_umword_t phys_id,
244 l4_umword_t enable) L4_NOTHROW
245{
246 return l4_platform_ctl_cpu_allow_shutdown_u(pfc, phys_id, enable, l4_utcb());
247}
248
250l4_platform_ctl_cpu_enable_u(l4_cap_idx_t pfc,
251 l4_umword_t phys_id,
252 l4_utcb_t *utcb) L4_NOTHROW
253{
254 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
256 v->mr[1] = phys_id;
257 return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
259}
260
262l4_platform_ctl_cpu_disable_u(l4_cap_idx_t pfc,
263 l4_umword_t phys_id,
264 l4_utcb_t *utcb) L4_NOTHROW
265{
266 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
268 v->mr[1] = phys_id;
269 return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
271}
272
275 l4_umword_t phys_id) L4_NOTHROW
276{
277 return l4_platform_ctl_cpu_enable_u(pfc, phys_id, l4_utcb());
278}
279
282 l4_umword_t phys_id) L4_NOTHROW
283{
284 return l4_platform_ctl_cpu_disable_u(pfc, phys_id, l4_utcb());
285}
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:40
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:335
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:565
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:404
@ 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:76
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition utcb.h:56
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
Definition utcb.h:346
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:159
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
Common L4 ABI Data Types.
Message tag data structure.
Definition types.h:153
Encapsulation of the message-register block in the UTCB.
Definition utcb.h:68
l4_umword_t mr[L4_UTCB_GENERIC_DATA_SIZE]
Message registers.
Definition utcb.h:69