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 * 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
30
31
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
170/* IMPLEMENTATION -----------------------------------------------------------*/
171
172#include <l4/sys/ipc.h>
173
175l4_platform_ctl_system_suspend_u(l4_cap_idx_t pfc,
176 l4_umword_t extras,
177 l4_utcb_t *utcb) L4_NOTHROW
178{
179 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
181 v->mr[1] = extras;
182 return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
184}
185
187l4_platform_ctl_system_shutdown_u(l4_cap_idx_t pfc,
188 l4_umword_t reboot,
189 l4_utcb_t *utcb) L4_NOTHROW
190{
191 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
193 v->mr[1] = reboot;
194 return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
196}
197
198
201 l4_umword_t extras) L4_NOTHROW
202{
203 return l4_platform_ctl_system_suspend_u(pfc, extras, l4_utcb());
204}
205
208 l4_umword_t reboot) L4_NOTHROW
209{
210 return l4_platform_ctl_system_shutdown_u(pfc, reboot, l4_utcb());
211}
212
214l4_platform_ctl_cpu_allow_shutdown_u(l4_cap_idx_t pfc,
215 l4_umword_t phys_id,
216 l4_umword_t enable,
217 l4_utcb_t *utcb) L4_NOTHROW
218{
219 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
221 v->mr[1] = phys_id;
222 v->mr[2] = enable;
223 return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 3, 0, 0),
225}
226
229 l4_umword_t phys_id,
230 l4_umword_t enable) L4_NOTHROW
231{
232 return l4_platform_ctl_cpu_allow_shutdown_u(pfc, phys_id, enable, l4_utcb());
233}
234
236l4_platform_ctl_cpu_enable_u(l4_cap_idx_t pfc,
237 l4_umword_t phys_id,
238 l4_utcb_t *utcb) L4_NOTHROW
239{
240 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
242 v->mr[1] = phys_id;
243 return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
245}
246
248l4_platform_ctl_cpu_disable_u(l4_cap_idx_t pfc,
249 l4_umword_t phys_id,
250 l4_utcb_t *utcb) L4_NOTHROW
251{
252 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
254 v->mr[1] = phys_id;
255 return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
257}
258
261 l4_umword_t phys_id) L4_NOTHROW
262{
263 return l4_platform_ctl_cpu_enable_u(pfc, phys_id, l4_utcb());
264}
265
268 l4_umword_t phys_id) L4_NOTHROW
269{
270 return l4_platform_ctl_cpu_disable_u(pfc, phys_id, l4_utcb());
271}
272
273#include <l4/sys/arch/platform_control.h>
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:40
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:372
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:598
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:441
@ L4_PROTO_PLATFORM_CTL
Platform control.
Definition types.h:59
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:369
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:167
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
Common IPC interface.
Common L4 ABI Data Types.
UTCB definitions.
Message tag data structure.
Definition types.h:269
Encapsulation of the message-register block in the UTCB.
Definition utcb.h:133
l4_umword_t mr[L4_UTCB_GENERIC_DATA_SIZE]
Message registers.
Definition utcb.h:134