pub trait Driver {
type PData: ForeignOwnable;
Show 24 associated constants and 20 methods
const USE_VTABLE_ATTR: ();
const NAME: &'static CStr;
const FLAGS: u16;
const BOOST_ENABLED: bool;
const HAS_INIT: bool = false;
const HAS_EXIT: bool = false;
const HAS_ONLINE: bool = false;
const HAS_OFFLINE: bool = false;
const HAS_SUSPEND: bool = false;
const HAS_RESUME: bool = false;
const HAS_READY: bool = false;
const HAS_VERIFY: bool = false;
const HAS_SETPOLICY: bool = false;
const HAS_TARGET: bool = false;
const HAS_TARGET_INDEX: bool = false;
const HAS_FAST_SWITCH: bool = false;
const HAS_ADJUST_PERF: bool = false;
const HAS_GET_INTERMEDIATE: bool = false;
const HAS_TARGET_INTERMEDIATE: bool = false;
const HAS_GET: bool = false;
const HAS_UPDATE_LIMITS: bool = false;
const HAS_BIOS_LIMIT: bool = false;
const HAS_SET_BOOST: bool = false;
const HAS_REGISTER_EM: bool = false;
// Required methods
fn init(policy: &mut Policy) -> Result<Self::PData>;
fn verify(data: &mut PolicyData) -> Result<()>;
// Provided methods
fn exit(_policy: &mut Policy, _data: Option<Self::PData>) -> Result<()> { ... }
fn online(_policy: &mut Policy) -> Result<()> { ... }
fn offline(_policy: &mut Policy) -> Result<()> { ... }
fn suspend(_policy: &mut Policy) -> Result<()> { ... }
fn resume(_policy: &mut Policy) -> Result<()> { ... }
fn ready(_policy: &mut Policy) { ... }
fn setpolicy(_policy: &mut Policy) -> Result<()> { ... }
fn target(
_policy: &mut Policy,
_target_freq: u32,
_relation: Relation,
) -> Result<()> { ... }
fn target_index(_policy: &mut Policy, _index: TableIndex) -> Result<()> { ... }
fn fast_switch(_policy: &mut Policy, _target_freq: u32) -> u32 { ... }
fn adjust_perf(
_policy: &mut Policy,
_min_perf: usize,
_target_perf: usize,
_capacity: usize,
) { ... }
fn get_intermediate(_policy: &mut Policy, _index: TableIndex) -> u32 { ... }
fn target_intermediate(
_policy: &mut Policy,
_index: TableIndex,
) -> Result<()> { ... }
fn get(_policy: &mut Policy) -> Result<u32> { ... }
fn update_limits(_policy: &mut Policy) { ... }
fn bios_limit(_policy: &mut Policy, _limit: &mut u32) -> Result<()> { ... }
fn set_boost(_policy: &mut Policy, _state: i32) -> Result<()> { ... }
fn register_em(_policy: &mut Policy) { ... }
}
Expand description
CPU frequency driver.
Implement this trait to provide a CPU frequency driver and its callbacks.
Reference: https://docs.kernel.org/cpu-freq/cpu-drivers.html
Required Associated Constants§
Sourceconst USE_VTABLE_ATTR: ()
const USE_VTABLE_ATTR: ()
A marker to prevent implementors from forgetting to use #[vtable]
attribute when implementing this trait.
Sourceconst BOOST_ENABLED: bool
const BOOST_ENABLED: bool
Boost support.
Provided Associated Constants§
Sourceconst HAS_ONLINE: bool = false
const HAS_ONLINE: bool = false
Indicates if the online
method is overridden by the implementor.
Sourceconst HAS_OFFLINE: bool = false
const HAS_OFFLINE: bool = false
Indicates if the offline
method is overridden by the implementor.
Sourceconst HAS_SUSPEND: bool = false
const HAS_SUSPEND: bool = false
Indicates if the suspend
method is overridden by the implementor.
Sourceconst HAS_RESUME: bool = false
const HAS_RESUME: bool = false
Indicates if the resume
method is overridden by the implementor.
Sourceconst HAS_VERIFY: bool = false
const HAS_VERIFY: bool = false
Indicates if the verify
method is overridden by the implementor.
Sourceconst HAS_SETPOLICY: bool = false
const HAS_SETPOLICY: bool = false
Indicates if the setpolicy
method is overridden by the implementor.
Sourceconst HAS_TARGET: bool = false
const HAS_TARGET: bool = false
Indicates if the target
method is overridden by the implementor.
Sourceconst HAS_TARGET_INDEX: bool = false
const HAS_TARGET_INDEX: bool = false
Indicates if the target_index
method is overridden by the implementor.
Sourceconst HAS_FAST_SWITCH: bool = false
const HAS_FAST_SWITCH: bool = false
Indicates if the fast_switch
method is overridden by the implementor.
Sourceconst HAS_ADJUST_PERF: bool = false
const HAS_ADJUST_PERF: bool = false
Indicates if the adjust_perf
method is overridden by the implementor.
Sourceconst HAS_GET_INTERMEDIATE: bool = false
const HAS_GET_INTERMEDIATE: bool = false
Indicates if the get_intermediate
method is overridden by the implementor.
Sourceconst HAS_TARGET_INTERMEDIATE: bool = false
const HAS_TARGET_INTERMEDIATE: bool = false
Indicates if the target_intermediate
method is overridden by the implementor.
Sourceconst HAS_UPDATE_LIMITS: bool = false
const HAS_UPDATE_LIMITS: bool = false
Indicates if the update_limits
method is overridden by the implementor.
Sourceconst HAS_BIOS_LIMIT: bool = false
const HAS_BIOS_LIMIT: bool = false
Indicates if the bios_limit
method is overridden by the implementor.
Sourceconst HAS_SET_BOOST: bool = false
const HAS_SET_BOOST: bool = false
Indicates if the set_boost
method is overridden by the implementor.
Sourceconst HAS_REGISTER_EM: bool = false
const HAS_REGISTER_EM: bool = false
Indicates if the register_em
method is overridden by the implementor.
Required Associated Types§
Sourcetype PData: ForeignOwnable
type PData: ForeignOwnable
Policy specific data.
Require that PData
implements ForeignOwnable
. We guarantee to never move the underlying
wrapped data structure.
Required Methods§
Sourcefn verify(data: &mut PolicyData) -> Result<()>
fn verify(data: &mut PolicyData) -> Result<()>
Driver’s verify
callback.
Provided Methods§
Sourcefn exit(_policy: &mut Policy, _data: Option<Self::PData>) -> Result<()>
fn exit(_policy: &mut Policy, _data: Option<Self::PData>) -> Result<()>
Driver’s exit
callback.
Sourcefn target(
_policy: &mut Policy,
_target_freq: u32,
_relation: Relation,
) -> Result<()>
fn target( _policy: &mut Policy, _target_freq: u32, _relation: Relation, ) -> Result<()>
Driver’s target
callback.
Sourcefn target_index(_policy: &mut Policy, _index: TableIndex) -> Result<()>
fn target_index(_policy: &mut Policy, _index: TableIndex) -> Result<()>
Driver’s target_index
callback.
Sourcefn fast_switch(_policy: &mut Policy, _target_freq: u32) -> u32
fn fast_switch(_policy: &mut Policy, _target_freq: u32) -> u32
Driver’s fast_switch
callback.
Sourcefn adjust_perf(
_policy: &mut Policy,
_min_perf: usize,
_target_perf: usize,
_capacity: usize,
)
fn adjust_perf( _policy: &mut Policy, _min_perf: usize, _target_perf: usize, _capacity: usize, )
Driver’s adjust_perf
callback.
Sourcefn get_intermediate(_policy: &mut Policy, _index: TableIndex) -> u32
fn get_intermediate(_policy: &mut Policy, _index: TableIndex) -> u32
Driver’s get_intermediate
callback.
Sourcefn target_intermediate(_policy: &mut Policy, _index: TableIndex) -> Result<()>
fn target_intermediate(_policy: &mut Policy, _index: TableIndex) -> Result<()>
Driver’s target_intermediate
callback.
Sourcefn update_limits(_policy: &mut Policy)
fn update_limits(_policy: &mut Policy)
Driver’s update_limits
callback.
Sourcefn bios_limit(_policy: &mut Policy, _limit: &mut u32) -> Result<()>
fn bios_limit(_policy: &mut Policy, _limit: &mut u32) -> Result<()>
Driver’s bios_limit
callback.
Sourcefn register_em(_policy: &mut Policy)
fn register_em(_policy: &mut Policy)
Driver’s register_em
callback.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.