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
58 l4_umword_t extras) L4_NOTHROW;
59
64l4_platform_ctl_system_suspend_u(l4_cap_idx_t pfc,
65 l4_umword_t extras,
66 l4_utcb_t *utcb) L4_NOTHROW;
67
68
79 l4_umword_t reboot) L4_NOTHROW;
80
85l4_platform_ctl_system_shutdown_u(l4_cap_idx_t pfc,
86 l4_umword_t reboot,
87 l4_utcb_t *utcb) L4_NOTHROW;
88
100 l4_umword_t phys_id,
101 l4_umword_t enable) L4_NOTHROW;
102
107l4_platform_ctl_cpu_allow_shutdown_u(l4_cap_idx_t pfc,
108 l4_umword_t phys_id,
109 l4_umword_t enable,
110 l4_utcb_t *utcb) L4_NOTHROW;
123 l4_umword_t phys_id) L4_NOTHROW;
124
129l4_platform_ctl_cpu_enable_u(l4_cap_idx_t pfc,
130 l4_umword_t phys_id,
131 l4_utcb_t *utcb) L4_NOTHROW;
132
145 l4_umword_t phys_id) L4_NOTHROW;
146
151l4_platform_ctl_cpu_disable_u(l4_cap_idx_t pfc,
152 l4_umword_t phys_id,
153 l4_utcb_t *utcb) L4_NOTHROW;
154
/* ends l4_platform_control_api group */
156
157
174
188
189/* IMPLEMENTATION -----------------------------------------------------------*/
190
191#include <l4/sys/ipc.h>
192
194l4_platform_ctl_system_suspend_u(l4_cap_idx_t pfc,
195 l4_umword_t extras,
196 l4_utcb_t *utcb) L4_NOTHROW
197{
198 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
200 v->mr[1] = extras;
201 return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
203}
204
206l4_platform_ctl_system_shutdown_u(l4_cap_idx_t pfc,
207 l4_umword_t reboot,
208 l4_utcb_t *utcb) L4_NOTHROW
209{
210 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
212 v->mr[1] = reboot;
213 return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
215}
216
217
220 l4_umword_t extras) L4_NOTHROW
221{
222 return l4_platform_ctl_system_suspend_u(pfc, extras, l4_utcb());
223}
224
227 l4_umword_t reboot) L4_NOTHROW
228{
229 return l4_platform_ctl_system_shutdown_u(pfc, reboot, l4_utcb());
230}
231
233l4_platform_ctl_cpu_allow_shutdown_u(l4_cap_idx_t pfc,
234 l4_umword_t phys_id,
235 l4_umword_t enable,
236 l4_utcb_t *utcb) L4_NOTHROW
237{
238 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
240 v->mr[1] = phys_id;
241 v->mr[2] = enable;
242 return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 3, 0, 0),
244}
245
248 l4_umword_t phys_id,
249 l4_umword_t enable) L4_NOTHROW
250{
251 return l4_platform_ctl_cpu_allow_shutdown_u(pfc, phys_id, enable, l4_utcb());
252}
253
255l4_platform_ctl_cpu_enable_u(l4_cap_idx_t pfc,
256 l4_umword_t phys_id,
257 l4_utcb_t *utcb) L4_NOTHROW
258{
259 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
261 v->mr[1] = phys_id;
262 return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
264}
265
267l4_platform_ctl_cpu_disable_u(l4_cap_idx_t pfc,
268 l4_umword_t phys_id,
269 l4_utcb_t *utcb) L4_NOTHROW
270{
271 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
273 v->mr[1] = phys_id;
274 return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
276}
277
280 l4_umword_t phys_id) L4_NOTHROW
281{
282 return l4_platform_ctl_cpu_enable_u(pfc, phys_id, l4_utcb());
283}
284
287 l4_umword_t phys_id) L4_NOTHROW
288{
289 return l4_platform_ctl_cpu_disable_u(pfc, phys_id, l4_utcb());
290}
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:51
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:358
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:550
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:427
@ 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_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:82
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:163
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