Loading...
Searching...
No Matches
platform_control.h
Go to the documentation of this file.
/*
* (c) 2014 Alexander Warg <alexander.warg@kernkonzept.com>
*
* License: see LICENSE.spdx (in this directory or the directories above)
*/
#pragma once
#include <l4/sys/types.h>
#include <l4/sys/utcb.h>
L4_INLINE l4_msgtag_t
l4_platform_ctl_system_suspend(l4_cap_idx_t pfc,
l4_umword_t extras) L4_NOTHROW;
L4_INLINE l4_msgtag_t
l4_platform_ctl_system_suspend_u(l4_cap_idx_t pfc,
l4_umword_t extras,
l4_utcb_t *utcb) L4_NOTHROW;
L4_INLINE l4_msgtag_t
l4_platform_ctl_system_shutdown(l4_cap_idx_t pfc,
l4_umword_t reboot) L4_NOTHROW;
L4_INLINE l4_msgtag_t
l4_platform_ctl_system_shutdown_u(l4_cap_idx_t pfc,
l4_umword_t reboot,
l4_utcb_t *utcb) L4_NOTHROW;
L4_INLINE 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;
L4_INLINE l4_msgtag_t
l4_platform_ctl_cpu_allow_shutdown_u(l4_cap_idx_t pfc,
l4_umword_t phys_id,
l4_umword_t enable,
l4_utcb_t *utcb) L4_NOTHROW;
L4_INLINE l4_msgtag_t
l4_platform_ctl_cpu_enable(l4_cap_idx_t pfc,
l4_umword_t phys_id) L4_NOTHROW;
L4_INLINE l4_msgtag_t
l4_platform_ctl_cpu_enable_u(l4_cap_idx_t pfc,
l4_umword_t phys_id,
l4_utcb_t *utcb) L4_NOTHROW;
L4_INLINE l4_msgtag_t
l4_platform_ctl_cpu_disable(l4_cap_idx_t pfc,
l4_umword_t phys_id) L4_NOTHROW;
L4_INLINE l4_msgtag_t
l4_platform_ctl_cpu_disable_u(l4_cap_idx_t pfc,
l4_umword_t phys_id,
l4_utcb_t *utcb) L4_NOTHROW;
/* ends l4_platform_control_api group */
enum L4_platform_ctl_ops
{
L4_PLATFORM_CTL_SYS_SUSPEND_OP = 0UL,
L4_PLATFORM_CTL_SYS_SHUTDOWN_OP = 1UL,
L4_PLATFORM_CTL_CPU_ALLOW_SHUTDOWN_OP = 2UL,
L4_PLATFORM_CTL_CPU_ENABLE_OP = 3UL,
L4_PLATFORM_CTL_CPU_DISABLE_OP = 4UL,
L4_PLATFORM_CTL_SET_TASK_ASID_OP = 0x10UL,
};
enum L4_platform_ctl_proto
{
L4_PROTO_PLATFORM_CTL = 0
};
/* IMPLEMENTATION -----------------------------------------------------------*/
#include <l4/sys/ipc.h>
L4_INLINE l4_msgtag_t
l4_platform_ctl_system_suspend_u(l4_cap_idx_t pfc,
l4_umword_t extras,
l4_utcb_t *utcb) L4_NOTHROW
{
l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
v->mr[0] = L4_PLATFORM_CTL_SYS_SUSPEND_OP;
v->mr[1] = extras;
return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
L4_IPC_NEVER);
}
L4_INLINE l4_msgtag_t
l4_platform_ctl_system_shutdown_u(l4_cap_idx_t pfc,
l4_umword_t reboot,
l4_utcb_t *utcb) L4_NOTHROW
{
l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
v->mr[0] = L4_PLATFORM_CTL_SYS_SHUTDOWN_OP;
v->mr[1] = reboot;
return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
L4_IPC_NEVER);
}
L4_INLINE l4_msgtag_t
l4_platform_ctl_system_suspend(l4_cap_idx_t pfc,
l4_umword_t extras) L4_NOTHROW
{
return l4_platform_ctl_system_suspend_u(pfc, extras, l4_utcb());
}
L4_INLINE l4_msgtag_t
l4_platform_ctl_system_shutdown(l4_cap_idx_t pfc,
l4_umword_t reboot) L4_NOTHROW
{
return l4_platform_ctl_system_shutdown_u(pfc, reboot, l4_utcb());
}
L4_INLINE l4_msgtag_t
l4_platform_ctl_cpu_allow_shutdown_u(l4_cap_idx_t pfc,
l4_umword_t phys_id,
l4_umword_t enable,
l4_utcb_t *utcb) L4_NOTHROW
{
l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
v->mr[0] = L4_PLATFORM_CTL_CPU_ALLOW_SHUTDOWN_OP;
v->mr[1] = phys_id;
v->mr[2] = enable;
return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 3, 0, 0),
L4_IPC_NEVER);
}
L4_INLINE 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
{
return l4_platform_ctl_cpu_allow_shutdown_u(pfc, phys_id, enable, l4_utcb());
}
L4_INLINE l4_msgtag_t
l4_platform_ctl_cpu_enable_u(l4_cap_idx_t pfc,
l4_umword_t phys_id,
l4_utcb_t *utcb) L4_NOTHROW
{
l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
v->mr[0] = L4_PLATFORM_CTL_CPU_ENABLE_OP;
v->mr[1] = phys_id;
return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
L4_IPC_NEVER);
}
L4_INLINE l4_msgtag_t
l4_platform_ctl_cpu_disable_u(l4_cap_idx_t pfc,
l4_umword_t phys_id,
l4_utcb_t *utcb) L4_NOTHROW
{
l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
v->mr[0] = L4_PLATFORM_CTL_CPU_DISABLE_OP;
v->mr[1] = phys_id;
return l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_PLATFORM_CTL, 2, 0, 0),
L4_IPC_NEVER);
}
L4_INLINE l4_msgtag_t
l4_platform_ctl_cpu_enable(l4_cap_idx_t pfc,
l4_umword_t phys_id) L4_NOTHROW
{
return l4_platform_ctl_cpu_enable_u(pfc, phys_id, l4_utcb());
}
L4_INLINE l4_msgtag_t
l4_platform_ctl_cpu_disable(l4_cap_idx_t pfc,
l4_umword_t phys_id) L4_NOTHROW
{
return l4_platform_ctl_cpu_disable_u(pfc, phys_id, l4_utcb());
}
l4_umword_t
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:40
l4_cap_idx_t
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:336
l4_ipc_call
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
L4_platform_ctl_proto
Predefined protocol type for messages to platform-control objects.
Definition platform_control.h:175
l4_msgtag
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:405
L4_PROTO_PLATFORM_CTL
@ L4_PROTO_PLATFORM_CTL
Protocol messages to a platform control object.
Definition platform_control.h:181
l4_platform_ctl_cpu_allow_shutdown
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.
Definition platform_control.h:242
l4_platform_ctl_system_suspend
l4_msgtag_t l4_platform_ctl_system_suspend(l4_cap_idx_t pfc, l4_umword_t extras) L4_NOTHROW
Enter suspend to RAM.
Definition platform_control.h:214
l4_platform_ctl_system_shutdown
l4_msgtag_t l4_platform_ctl_system_shutdown(l4_cap_idx_t pfc, l4_umword_t reboot) L4_NOTHROW
Shutdown or reboot the system.
Definition platform_control.h:221
l4_platform_ctl_cpu_disable
l4_msgtag_t l4_platform_ctl_cpu_disable(l4_cap_idx_t pfc, l4_umword_t phys_id) L4_NOTHROW
Disable an online CPU.
Definition platform_control.h:281
l4_platform_ctl_cpu_enable
l4_msgtag_t l4_platform_ctl_cpu_enable(l4_cap_idx_t pfc, l4_umword_t phys_id) L4_NOTHROW
Enable an offline CPU.
Definition platform_control.h:274
L4_platform_ctl_ops
L4_platform_ctl_ops
Operations on platform-control objects.
Definition platform_control.h:160
L4_PLATFORM_CTL_CPU_ENABLE_OP
@ L4_PLATFORM_CTL_CPU_ENABLE_OP
enable an offline CPU
Definition platform_control.h:164
L4_PLATFORM_CTL_SYS_SHUTDOWN_OP
@ L4_PLATFORM_CTL_SYS_SHUTDOWN_OP
shutdown/reboot
Definition platform_control.h:162
L4_PLATFORM_CTL_SET_TASK_ASID_OP
@ L4_PLATFORM_CTL_SET_TASK_ASID_OP
Arm: set task ASID.
Definition platform_control.h:167
L4_PLATFORM_CTL_CPU_ALLOW_SHUTDOWN_OP
@ L4_PLATFORM_CTL_CPU_ALLOW_SHUTDOWN_OP
allow CPU shutdown
Definition platform_control.h:163
L4_PLATFORM_CTL_SYS_SUSPEND_OP
@ L4_PLATFORM_CTL_SYS_SUSPEND_OP
Suspend.
Definition platform_control.h:161
L4_PLATFORM_CTL_CPU_DISABLE_OP
@ L4_PLATFORM_CTL_CPU_DISABLE_OP
disable an online CPU
Definition platform_control.h:165
L4_IPC_NEVER
#define L4_IPC_NEVER
never timeout
Definition __timeout.h:76
l4_utcb_t
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition utcb.h:56
l4_utcb
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
Definition utcb.h:346
L4_NOTHROW
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:161
L4_INLINE
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
ipc.h
Common IPC interface.
types.h
Common L4 ABI Data Types.
utcb.h
UTCB definitions.
l4_msgtag_t
Message tag data structure.
Definition types.h:154
l4_msg_regs_t
Encapsulation of the message-register block in the UTCB.
Definition utcb.h:68
l4_msg_regs_t::mr
l4_umword_t mr[L4_UTCB_GENERIC_DATA_SIZE]
Message registers.
Definition utcb.h:69