blob: 4c5127eedb95e63df13190998b453f7ce373eea7 [file] [log] [blame]
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.device.manager;
using zx;
/// The number of variants of `SystemPowerState`.
const MAX_SYSTEM_POWER_STATES uint32 = 8;
/// Provides protocol for fetching relevant information during a system state transition.
@discoverable
closed protocol SystemStateTransition {
/// Gets the termination state.
strict GetTerminationSystemState() -> (struct {
// TODO(ravoorir): When the system power states are properly defined,
// remove the suspend flags. For now, treat each suspend flag as a system
// power state.
state @generated_name("SystemPowerState") strict enum : uint8 {
FULLY_ON = 1;
REBOOT = 2;
REBOOT_BOOTLOADER = 3;
REBOOT_RECOVERY = 4;
POWEROFF = 5;
MEXEC = 6;
SUSPEND_RAM = 7;
REBOOT_KERNEL_INITIATED = 8;
};
});
/// When the system termination state is MEXEC, in the course of shutting
/// down, driver_manager will perform an mexec itself after suspending all
/// drivers. This method allows driver manager to fetch the kernel and
/// data ZBIs to be passed to zx_system_mexec().
///
/// This method only should only be invoked in the case MEXEC shutdown.
///
/// It is expected that the ZBI items specified by
/// `zx_system_mexec_payload_get()` have not yet been appended to the
/// provided data ZBI.
///
/// Returns
/// * ZX_ERR_BAD_STATE: The termination system state is not set to MEXEC.
strict GetMexecZbis() -> (resource struct {
kernel_zbi zx.Handle:VMO;
data_zbi zx.Handle:VMO;
}) error zx.Status;
};