105 lines
2.8 KiB
Rust
105 lines
2.8 KiB
Rust
use serde::Deserialize;
|
|
use std::collections::HashMap;
|
|
|
|
#[derive(Debug, Deserialize, Clone)]
|
|
pub struct HardwareDb {
|
|
pub metadata: Metadata,
|
|
pub conflicts: Vec<Conflict>,
|
|
pub ecosystems: HashMap<String, Ecosystem>,
|
|
pub quirks: Vec<Quirk>,
|
|
pub discovery: Discovery,
|
|
pub benchmarking: Benchmarking,
|
|
pub preflight_checks: Vec<PreflightCheck>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize, Clone)]
|
|
pub struct Metadata {
|
|
pub version: String,
|
|
pub updated: String,
|
|
pub description: String,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize, Clone)]
|
|
pub struct Conflict {
|
|
pub id: String,
|
|
pub services: Vec<String>,
|
|
pub contention: String,
|
|
pub severity: String,
|
|
pub fix_action: String,
|
|
pub help_text: String,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize, Clone)]
|
|
pub struct Ecosystem {
|
|
pub vendor_regex: String,
|
|
pub product_regex: Option<String>,
|
|
pub polling_cap_ms: Option<u64>,
|
|
pub drivers: Option<Vec<String>>,
|
|
pub fan_manual_mode_cmd: Option<String>,
|
|
pub fan_auto_mode_cmd: Option<String>,
|
|
pub safety_register: Option<String>,
|
|
pub lap_mode_path: Option<String>,
|
|
pub profiles_path: Option<String>,
|
|
pub ec_write_required: Option<bool>,
|
|
pub thermal_policy_path: Option<String>,
|
|
pub policy_map: Option<HashMap<String, i32>>,
|
|
pub msr_lock_register: Option<String>,
|
|
pub msr_lock_bit: Option<u32>,
|
|
pub fan_boost_path: Option<String>,
|
|
pub ec_tool: Option<String>,
|
|
pub optimization: Option<String>,
|
|
pub help_text: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize, Clone)]
|
|
pub struct Quirk {
|
|
pub model_regex: String,
|
|
pub id: String,
|
|
pub issue: String,
|
|
pub action: String,
|
|
pub monitor_msr: Option<String>,
|
|
pub reset_bit: Option<u32>,
|
|
pub trigger_path: Option<String>,
|
|
pub trigger_value: Option<String>,
|
|
pub target_path: Option<String>,
|
|
pub format: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize, Clone)]
|
|
pub struct Discovery {
|
|
pub sensors: SensorDiscovery,
|
|
pub actuators: ActuatorDiscovery,
|
|
pub configs: HashMap<String, Vec<String>>,
|
|
pub tools: HashMap<String, String>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize, Clone)]
|
|
pub struct Benchmarking {
|
|
pub idle_duration_s: u64,
|
|
pub stress_duration_min_s: u64,
|
|
pub stress_duration_max_s: u64,
|
|
pub cool_down_s: u64,
|
|
pub power_steps_watts: Vec<f32>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize, Clone)]
|
|
pub struct SensorDiscovery {
|
|
pub temp_labels: Vec<String>,
|
|
pub fan_labels: Vec<String>,
|
|
pub hwmon_priority: Vec<String>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize, Clone)]
|
|
pub struct ActuatorDiscovery {
|
|
pub rapl_paths: Vec<String>,
|
|
pub amd_energy_paths: Vec<String>,
|
|
pub governor_files: Vec<String>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize, Clone)]
|
|
pub struct PreflightCheck {
|
|
pub name: String,
|
|
pub check_cmd: String,
|
|
pub fail_help: String,
|
|
}
|