implemented generic linux sal with heuristics
This commit is contained in:
90
src/sal/heuristic/schema.rs
Normal file
90
src/sal/heuristic/schema.rs
Normal file
@@ -0,0 +1,90 @@
|
||||
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 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 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>,
|
||||
}
|
||||
|
||||
#[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,
|
||||
}
|
||||
|
||||
#[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,
|
||||
}
|
||||
Reference in New Issue
Block a user