blob: 59fde54a9894133f5737cd97e3288e0b80a5f107 [file] [log] [blame] [edit]
// Copyright 2019 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.hardware.cpu.ctrl;
using zx;
/// CpuPerformanceStateInfo::frequency_hz and CpuPerformanceStateInfo::voltage_uv
/// are set to this if the frequency and voltage for the given performance state
/// are unknown respectively.
const FREQUENCY_UNKNOWN int64 = -1;
const VOLTAGE_UNKNOWN int64 = -1;
const DEVICE_PERFORMANCE_STATE_P0 uint32 = 0;
const MAX_DEVICE_PERFORMANCE_STATES uint32 = 20;
/// A collection of some basic information for a given performance state.
type CpuPerformanceStateInfo = struct {
/// Frequency the core is operating at in hertz.
frequency_hz int64;
// Voltage the core is operating at in microvolts.
voltage_uv int64;
};
closed protocol Device {
/// Returns information about a given performance state for this performance
/// domain.
strict GetPerformanceStateInfo(struct {
state uint32;
}) -> (struct {
info CpuPerformanceStateInfo;
}) error zx.Status;
/// Gets the current performance state of the device.
strict GetCurrentPerformanceState() -> (struct {
out_state uint32;
});
/// Set the performance state of this device to the requested performance state.
/// Returns ZX_OK, if the device is in a working state and the performance state is changed to
/// requested_state successfully. out_state will be same as requested_state.
/// Returns error status, if switching to the requested_state was unsuccessful. out_state
/// is the state that the device is currently in.
strict SetPerformanceState(struct {
requested_state uint32;
}) -> (struct {
out_state uint32;
}) error zx.Status;
/// Returns the number of logical cores contained within this performance
/// domain.
strict GetNumLogicalCores() -> (struct {
count uint64;
});
/// Returns a global system-wide core ID for the nth core in this
/// performance domain. `index` must be a value in the range [0, n) where
/// n is the value returned by GetNumLogicalCores().
strict GetLogicalCoreId(struct {
index uint64;
}) -> (struct {
id uint64;
});
};