TODO(fxbug.dev/32938)
#include <zircon/syscalls.h> zx_status_t zx_system_powerctl(zx_handle_t resource, uint32_t cmd, const zx_system_powerctl_arg_t* arg);
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.
Sets all processor cores as active.
arg type: n/a
Set only the primary CPU as active.
arg type: n/a
Only defined for x86-64.
Currently only transitions to the S3 state are supported.
Before calling this syscall the following steps should be taken:
_PTS
control method_SST
control methodarg type: zx_system_powerctl_arg_t
with only the acpi_transition_s_state
union element considered valid.
struct { uint8_t target_s_state; // Value between 1 and 5 indicating which S-state uint8_t sleep_type_a; // Value from ACPI VM (SLP_TYPa) uint8_t sleep_type_b; // Value from ACPI VM (SLP_TYPb) } acpi_transition_s_state;
Returns ZX_ERR_INVALID_ARGS if the target S state is not in the range 1-5.
Returns ZX_ERR_NOT_SUPPORTED if transitioning to the target S state is not supported.
Returns ZX_ERR_BAD_STATE if the target S state is not 5 and the secondary CPUs have not been shut down.
Returns ZX_ERR_NO_MEMORY if there are not enough resources to run the thread.
Returns ZX_ERR_INTERNAL if the S state transition fails.
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;
Restart the system, control should go through any relevant firmware and bootloaders.
arg type: n/a
Restart the system, but stop in the bootloader instead of loading the operating system.
arg type: n/a
Restart the system, but load the recovery operating system instead of the primary OS.
arg type: n/a
Turn the system off.
arg type: n/a
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.
resource must have resource kind ZX_RSRC_KIND_SYSTEM with base ZX_RSRC_SYSTEM_POWER_BASE.
ZX_OK
Returns ZX_ERR_INVALID_ARGS when an unrecognized cmd
value is supplied.
TODO(fxbug.dev/32938)