use crate::*;
pub const GRBM_OFFSET: u32 = 0x2004;
pub const GRBM2_OFFSET: u32 = 0x2002;
pub const SRBM_OFFSET: u32 = 0x394;
pub const SRBM2_OFFSET: u32 = 0x393;
pub const SRBM3_OFFSET: u32 = 0x395;
pub const CP_STAT_OFFSET: u32 = 0x21A0;
pub(crate) type DEVICE_HANDLE = bindings::amdgpu_device_handle;
pub const DEFAULT_DEVICE_NAME: &str = "AMD Radeon Graphics";
mod device_handle;
pub use device_handle::*;
mod family;
pub use family::*;
mod vram;
pub use vram::*;
mod asic;
pub use asic::*;
mod chip_class;
pub use chip_class::*;
mod gpu_info;
pub use gpu_info::*;
mod gfx_target_version;
pub use gfx_target_version::GfxTargetVersion;
mod context;
pub use context::*;
#[cfg(feature = "std")]
mod metrics_table;
#[cfg(feature = "std")]
pub use metrics_table::*;
#[cfg(feature = "std")]
mod gpu_metrics;
#[cfg(feature = "std")]
pub use gpu_metrics::*;
#[cfg(feature = "std")]
mod throttle_status;
#[cfg(feature = "std")]
pub use throttle_status::*;
#[cfg(feature = "std")]
mod hwmon_temp;
#[cfg(feature = "std")]
pub use hwmon_temp::*;
#[cfg(feature = "std")]
mod power_cap;
#[cfg(feature = "std")]
pub use power_cap::*;
#[cfg(feature = "std")]
mod power_profile;
#[cfg(feature = "std")]
pub use power_profile::*;
#[cfg(feature = "std")]
mod dpm_forced_level;
#[cfg(feature = "std")]
pub use dpm_forced_level::*;
#[cfg(feature = "std")]
mod ip_discovery;
#[cfg(feature = "std")]
pub use ip_discovery::*;
#[cfg(feature = "std")]
mod ras_features;
#[cfg(feature = "std")]
pub use ras_features::*;
#[cfg(feature = "std")]
pub(crate) fn parse_hwmon<T: std::str::FromStr, P: Into<std::path::PathBuf>>(path: P) -> Option<T> {
std::fs::read_to_string(path.into()).ok()
.and_then(|file| file.trim_end().parse::<T>().ok())
}
mod vbios;
mod vbios_parser;
mod video_caps;
mod hw_ip;
mod fw_version;
mod sensor_info;
pub mod pp_table;
pub use pp_table::PPTable;
pub mod VBIOS {
pub use super::vbios::*;
pub use super::vbios_parser::*;
}
pub mod VIDEO_CAPS {
pub use super::video_caps::*;
}
pub mod HW_IP {
pub use super::hw_ip::*;
}
pub mod FW_VERSION {
pub use super::fw_version::*;
}
pub mod SENSOR_INFO {
pub use super::sensor_info::*;
}
#[cfg(feature = "std")]
pub fn get_all_amdgpu_pci_bus() -> Vec<PCI::BUS_INFO> {
let Ok(amdgpu_devices) = std::fs::read_dir("/sys/bus/pci/drivers/amdgpu") else { return Vec::new() };
amdgpu_devices.flat_map(|v| {
let name = v.ok()?.file_name();
if name.len() != 12 { return None; }
name.into_string().ok()?.parse::<PCI::BUS_INFO>().ok()
}).collect()
}