Summary
TODO(https://fxbug.dev/42108078)
Declaration
#include <zircon/syscalls.h>
zx_status_t zx_system_powerctl(zx_handle_t resource,
uint32_t cmd,
const zx_system_powerctl_arg_t* arg);
Description
zx_system_powerctl
changes the power state of the system based on the value of
cmd. Zircon may not be able to put the system in a given power state,
depending on its level of support for the architecture being used.
arg is an optional pointer to a struct which provides further information about the command to be executed.
COMMANDS
ZX_SYSTEM_POWERCTL_ENABLE_ALL_CPUS
Sets all processor cores as active.
arg type: n/a
ZX_SYSTEM_POWERCTL_DISABLE_ALL_CPUS_BUT_PRIMARY
Set only the primary CPU as active.
arg type: n/a
ZX_SYSTEM_POWERCTL_ACPI_TRANSITION_S_STATE
Only defined for x86-64, but is no longer supported.
Returns ZX_ERR_NOT_SUPPORTED
.
ZX_SYSTEM_POWERCTL_X86_SET_PKG_PL1
Only defined for x86-64.
Set CPU to power level 1.
arg type: zx_system_powerctl_arg_t
with only the x86_power_limit
union
element considered valid.
struct {
uint32_t power_limit; // PL1 value in milliwatts
uint32_t time_window; // PL1 time window in microseconds
uint8_t clamp; // PL1 clamping enable
uint8_t enable; // PL1 enable
uint8_t padding2[2];
} x86_power_limit;
ZX_SYSTEM_POWERCTL_REBOOT
Restart the system, control should go through any relevant firmware and bootloaders.
arg type: n/a
ZX_SYSTEM_POWERCTL_REBOOT_BOOTLOADER
Restart the system, but stop in the bootloader instead of loading the operating system.
arg type: n/a
ZX_SYSTEM_POWERCTL_REBOOT_RECOVERY
Restart the system, but load the recovery operating system instead of the primary OS.
arg type: n/a
ZX_SYSTEM_POWERCTL_SHUTDOWN
Turn the system off.
arg type: n/a
ZX_SYSTEM_POWERCTL_ACK_KERNEL_INITIATED_REBOOT
Used by userspace when it is ready for a reboot in response to a previous signal from the kernel that the kernel wanted to reboot the system.
arg type: n/a
Returns ZX_ERR_BAD_STATE
if the kernel has not previously signaled a desire
to reboot.
Rights
resource must have resource kind ZX_RSRC_KIND_SYSTEM
with base ZX_RSRC_SYSTEM_POWER_BASE
.
Return value
ZX_OK
Errors
Returns ZX_ERR_INVALID_ARGS
when an unrecognized cmd
value is supplied.
See also
TODO(https://fxbug.dev/42108078)