/* automatically generated by rust-bindgen 0.72.1 */

/* generated from: amdsmi-rocm-6.4.2.h */

pub const AMDSMI_LIB_VERSION_YEAR: u32 = 25;
pub const AMDSMI_LIB_VERSION_MAJOR: u32 = 25;
pub const AMDSMI_LIB_VERSION_MINOR: u32 = 5;
pub const AMDSMI_LIB_VERSION_RELEASE: u32 = 1;
impl amdsmi_status_t {
    #[doc = "```text\n!< Call succeeded\n```"]
    pub const AMDSMI_STATUS_SUCCESS: amdsmi_status_t = amdsmi_status_t(0);
    #[doc = "```text\n!< Invalid parameters\n```"]
    pub const AMDSMI_STATUS_INVAL: amdsmi_status_t = amdsmi_status_t(1);
    #[doc = "```text\n!< Command not supported\n```"]
    pub const AMDSMI_STATUS_NOT_SUPPORTED: amdsmi_status_t = amdsmi_status_t(2);
    #[doc = "```text\n!< Not implemented yet\n```"]
    pub const AMDSMI_STATUS_NOT_YET_IMPLEMENTED: amdsmi_status_t = amdsmi_status_t(3);
    #[doc = "```text\n!< Fail to load lib\n```"]
    pub const AMDSMI_STATUS_FAIL_LOAD_MODULE: amdsmi_status_t = amdsmi_status_t(4);
    #[doc = "```text\n!< Fail to load symbol\n```"]
    pub const AMDSMI_STATUS_FAIL_LOAD_SYMBOL: amdsmi_status_t = amdsmi_status_t(5);
    #[doc = "```text\n!< Error when call libdrm\n```"]
    pub const AMDSMI_STATUS_DRM_ERROR: amdsmi_status_t = amdsmi_status_t(6);
    #[doc = "```text\n!< API call failed\n```"]
    pub const AMDSMI_STATUS_API_FAILED: amdsmi_status_t = amdsmi_status_t(7);
    #[doc = "```text\n!< Timeout in API call\n```"]
    pub const AMDSMI_STATUS_TIMEOUT: amdsmi_status_t = amdsmi_status_t(8);
    #[doc = "```text\n!< Retry operation\n```"]
    pub const AMDSMI_STATUS_RETRY: amdsmi_status_t = amdsmi_status_t(9);
    #[doc = "```text\n!< Permission Denied\n```"]
    pub const AMDSMI_STATUS_NO_PERM: amdsmi_status_t = amdsmi_status_t(10);
    #[doc = "```text\n!< An interrupt occurred during execution of function\n```"]
    pub const AMDSMI_STATUS_INTERRUPT: amdsmi_status_t = amdsmi_status_t(11);
    #[doc = "```text\n!< I/O Error\n```"]
    pub const AMDSMI_STATUS_IO: amdsmi_status_t = amdsmi_status_t(12);
    #[doc = "```text\n!< Bad address\n```"]
    pub const AMDSMI_STATUS_ADDRESS_FAULT: amdsmi_status_t = amdsmi_status_t(13);
    #[doc = "```text\n!< Problem accessing a file\n```"]
    pub const AMDSMI_STATUS_FILE_ERROR: amdsmi_status_t = amdsmi_status_t(14);
    #[doc = "```text\n!< Not enough memory\n```"]
    pub const AMDSMI_STATUS_OUT_OF_RESOURCES: amdsmi_status_t = amdsmi_status_t(15);
    #[doc = "```text\n!< An internal exception was caught\n```"]
    pub const AMDSMI_STATUS_INTERNAL_EXCEPTION: amdsmi_status_t = amdsmi_status_t(16);
    #[doc = "```text\n!< The provided input is out of allowable or safe range\n```"]
    pub const AMDSMI_STATUS_INPUT_OUT_OF_BOUNDS: amdsmi_status_t = amdsmi_status_t(17);
    #[doc = "```text\n!< An error occurred when initializing internal data structures\n```"]
    pub const AMDSMI_STATUS_INIT_ERROR: amdsmi_status_t = amdsmi_status_t(18);
    #[doc = "```text\n!< An internal reference counter exceeded INT32_MAX\n```"]
    pub const AMDSMI_STATUS_REFCOUNT_OVERFLOW: amdsmi_status_t = amdsmi_status_t(19);
    #[doc = "```text\n!< Processor busy\n```"]
    pub const AMDSMI_STATUS_BUSY: amdsmi_status_t = amdsmi_status_t(30);
    #[doc = "```text\n!< Processor Not found\n```"]
    pub const AMDSMI_STATUS_NOT_FOUND: amdsmi_status_t = amdsmi_status_t(31);
    #[doc = "```text\n!< Processor not initialized\n```"]
    pub const AMDSMI_STATUS_NOT_INIT: amdsmi_status_t = amdsmi_status_t(32);
    #[doc = "```text\n!< No more free slot\n```"]
    pub const AMDSMI_STATUS_NO_SLOT: amdsmi_status_t = amdsmi_status_t(33);
    #[doc = "```text\n!< Processor driver not loaded\n```"]
    pub const AMDSMI_STATUS_DRIVER_NOT_LOADED: amdsmi_status_t = amdsmi_status_t(34);
    #[doc = "```text\n!< No data was found for a given input\n```"]
    pub const AMDSMI_STATUS_NO_DATA: amdsmi_status_t = amdsmi_status_t(40);
    #[doc = "```text\n!< Not enough resources were available for the operation\n```"]
    pub const AMDSMI_STATUS_INSUFFICIENT_SIZE: amdsmi_status_t = amdsmi_status_t(41);
    #[doc = "```text\n!< An unexpected amount of data was read\n```"]
    pub const AMDSMI_STATUS_UNEXPECTED_SIZE: amdsmi_status_t = amdsmi_status_t(42);
    #[doc = "```text\n!< The data read or provided to function is not what was expected\n```"]
    pub const AMDSMI_STATUS_UNEXPECTED_DATA: amdsmi_status_t = amdsmi_status_t(43);
    #[doc = "```text\n!< System has different cpu than AMD\n```"]
    pub const AMDSMI_STATUS_NON_AMD_CPU: amdsmi_status_t = amdsmi_status_t(44);
    #[doc = "```text\n!< Energy driver not found\n```"]
    pub const AMDSMI_STATUS_NO_ENERGY_DRV: amdsmi_status_t = amdsmi_status_t(45);
    #[doc = "```text\n!< MSR driver not found\n```"]
    pub const AMDSMI_STATUS_NO_MSR_DRV: amdsmi_status_t = amdsmi_status_t(46);
    #[doc = "```text\n!< HSMP driver not found\n```"]
    pub const AMDSMI_STATUS_NO_HSMP_DRV: amdsmi_status_t = amdsmi_status_t(47);
    #[doc = "```text\n!< HSMP not supported\n```"]
    pub const AMDSMI_STATUS_NO_HSMP_SUP: amdsmi_status_t = amdsmi_status_t(48);
    #[doc = "```text\n!< HSMP message/feature not supported\n```"]
    pub const AMDSMI_STATUS_NO_HSMP_MSG_SUP: amdsmi_status_t = amdsmi_status_t(49);
    #[doc = "```text\n!< HSMP message timed out\n```"]
    pub const AMDSMI_STATUS_HSMP_TIMEOUT: amdsmi_status_t = amdsmi_status_t(50);
    #[doc = "```text\n!< No Energy and HSMP driver present\n```"]
    pub const AMDSMI_STATUS_NO_DRV: amdsmi_status_t = amdsmi_status_t(51);
    #[doc = "```text\n!< file or directory not found\n```"]
    pub const AMDSMI_STATUS_FILE_NOT_FOUND: amdsmi_status_t = amdsmi_status_t(52);
    #[doc = "```text\n!< Parsed argument is invalid\n```"]
    pub const AMDSMI_STATUS_ARG_PTR_NULL: amdsmi_status_t = amdsmi_status_t(53);
    #[doc = "```text\n!< AMDGPU restart failed\n```"]
    pub const AMDSMI_STATUS_AMDGPU_RESTART_ERR: amdsmi_status_t = amdsmi_status_t(54);
    #[doc = "```text\n!< Setting is not available\n```"]
    pub const AMDSMI_STATUS_SETTING_UNAVAILABLE: amdsmi_status_t = amdsmi_status_t(55);
    #[doc = "```text\n!< EEPROM is corrupted\n```"]
    pub const AMDSMI_STATUS_CORRUPTED_EEPROM: amdsmi_status_t = amdsmi_status_t(56);
    #[doc = "```text\n!< There is more data than the buffer size the user passed\n```"]
    pub const AMDSMI_STATUS_MORE_DATA: amdsmi_status_t = amdsmi_status_t(57);
    #[doc = "```text\n!< The internal library error did not map to a status code\n```"]
    pub const AMDSMI_STATUS_MAP_ERROR: amdsmi_status_t = amdsmi_status_t(4294967294);
    #[doc = "```text\n!< An unknown error occurred\n```"]
    pub const AMDSMI_STATUS_UNKNOWN_ERROR: amdsmi_status_t = amdsmi_status_t(4294967295);
}
#[repr(transparent)]
#[doc = "```text\n @brief Error codes returned by amdsmi functions\n\n Please avoid status codes that are multiples of 256 (256, 512, etc..)\n Return values in the shell get modulo 256 applied, meaning any multiple of 256 ends up as 0\n\n @cond @tag{gpu_bm_linux} @tag{host} @tag{cpu_bm} @tag{guest_windows} @endcond\n```"]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct amdsmi_status_t(pub ::std::os::raw::c_uint);
#[doc = "```text\n @brief ASIC Information\n\n @cond @tag{gpu_bm_linux} @tag{host} @endcond\n```"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct amdsmi_asic_info_t {
    pub market_name: [::std::os::raw::c_char; 256usize],
    #[doc = "```text\n!< Use 32 bit to be compatible with other platform.\n```"]
    pub vendor_id: u32,
    pub vendor_name: [::std::os::raw::c_char; 256usize],
    #[doc = "```text\n!< The subsystem vendor id\n```"]
    pub subvendor_id: u32,
    #[doc = "```text\n!< The device id of a GPU\n```"]
    pub device_id: u64,
    pub rev_id: u32,
    pub asic_serial: [::std::os::raw::c_char; 256usize],
    #[doc = "```text\n!< 0xFFFF if not supported\n```"]
    pub oam_id: u32,
    #[doc = "```text\n!< 0xFFFFFFFF if not supported\n```"]
    pub num_of_compute_units: u32,
    #[doc = "```text\n!< 0xFFFFFFFFFFFFFFFF if not supported\n```"]
    pub target_graphics_version: u64,
    pub reserved: [u32; 22usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of amdsmi_asic_info_t"][::std::mem::size_of::<amdsmi_asic_info_t>() - 896usize];
    ["Alignment of amdsmi_asic_info_t"][::std::mem::align_of::<amdsmi_asic_info_t>() - 8usize];
    ["Offset of field: amdsmi_asic_info_t::market_name"]
        [::std::mem::offset_of!(amdsmi_asic_info_t, market_name) - 0usize];
    ["Offset of field: amdsmi_asic_info_t::vendor_id"]
        [::std::mem::offset_of!(amdsmi_asic_info_t, vendor_id) - 256usize];
    ["Offset of field: amdsmi_asic_info_t::vendor_name"]
        [::std::mem::offset_of!(amdsmi_asic_info_t, vendor_name) - 260usize];
    ["Offset of field: amdsmi_asic_info_t::subvendor_id"]
        [::std::mem::offset_of!(amdsmi_asic_info_t, subvendor_id) - 516usize];
    ["Offset of field: amdsmi_asic_info_t::device_id"]
        [::std::mem::offset_of!(amdsmi_asic_info_t, device_id) - 520usize];
    ["Offset of field: amdsmi_asic_info_t::rev_id"]
        [::std::mem::offset_of!(amdsmi_asic_info_t, rev_id) - 528usize];
    ["Offset of field: amdsmi_asic_info_t::asic_serial"]
        [::std::mem::offset_of!(amdsmi_asic_info_t, asic_serial) - 532usize];
    ["Offset of field: amdsmi_asic_info_t::oam_id"]
        [::std::mem::offset_of!(amdsmi_asic_info_t, oam_id) - 788usize];
    ["Offset of field: amdsmi_asic_info_t::num_of_compute_units"]
        [::std::mem::offset_of!(amdsmi_asic_info_t, num_of_compute_units) - 792usize];
    ["Offset of field: amdsmi_asic_info_t::target_graphics_version"]
        [::std::mem::offset_of!(amdsmi_asic_info_t, target_graphics_version) - 800usize];
    ["Offset of field: amdsmi_asic_info_t::reserved"]
        [::std::mem::offset_of!(amdsmi_asic_info_t, reserved) - 808usize];
};
#[doc = "```text\n @brief Power Information\n\n @cond @tag{gpu_bm_linux} @tag{host} @endcond\n```"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct amdsmi_power_info_t {
    #[doc = "```text\n!< Units in uW {@host}, Host only\n```"]
    pub socket_power: u64,
    #[doc = "```text\n!< Units in W {@linux_bm}, Linux only, Mi 300+ Series cards\n```"]
    pub current_socket_power: u32,
    #[doc = "```text\n!< Units in W {@linux_bm}, Linux only, Navi + Mi 200 and earlier Series cards\n```"]
    pub average_socket_power: u32,
    #[doc = "```text\n!< GFX voltage measurement in mV {@linux_bm} or V {@host}\n```"]
    pub gfx_voltage: u32,
    #[doc = "```text\n!< SOC voltage measurement in mV {@linux_bm} or V {@host}\n```"]
    pub soc_voltage: u32,
    #[doc = "```text\n!< MEM voltage measurement in mV {@linux_bm} or V {@host}\n```"]
    pub mem_voltage: u32,
    #[doc = "```text\n!< The power limit in W {@linux_bm}, Linux only\n```"]
    pub power_limit: u32,
    pub reserved: [u32; 2usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of amdsmi_power_info_t"][::std::mem::size_of::<amdsmi_power_info_t>() - 40usize];
    ["Alignment of amdsmi_power_info_t"][::std::mem::align_of::<amdsmi_power_info_t>() - 8usize];
    ["Offset of field: amdsmi_power_info_t::socket_power"]
        [::std::mem::offset_of!(amdsmi_power_info_t, socket_power) - 0usize];
    ["Offset of field: amdsmi_power_info_t::current_socket_power"]
        [::std::mem::offset_of!(amdsmi_power_info_t, current_socket_power) - 8usize];
    ["Offset of field: amdsmi_power_info_t::average_socket_power"]
        [::std::mem::offset_of!(amdsmi_power_info_t, average_socket_power) - 12usize];
    ["Offset of field: amdsmi_power_info_t::gfx_voltage"]
        [::std::mem::offset_of!(amdsmi_power_info_t, gfx_voltage) - 16usize];
    ["Offset of field: amdsmi_power_info_t::soc_voltage"]
        [::std::mem::offset_of!(amdsmi_power_info_t, soc_voltage) - 20usize];
    ["Offset of field: amdsmi_power_info_t::mem_voltage"]
        [::std::mem::offset_of!(amdsmi_power_info_t, mem_voltage) - 24usize];
    ["Offset of field: amdsmi_power_info_t::power_limit"]
        [::std::mem::offset_of!(amdsmi_power_info_t, power_limit) - 28usize];
    ["Offset of field: amdsmi_power_info_t::reserved"]
        [::std::mem::offset_of!(amdsmi_power_info_t, reserved) - 32usize];
};
#[doc = "```text\n @brief Process Handle\n\n @cond @tag{gpu_bm_linux} @tag{guest_windows} @endcond\n```"]
pub type amdsmi_process_handle_t = u32;
#[doc = "```text\n @brief Process Information\n\n @cond @tag{gpu_bm_linux} @tag{guest_windows} @endcond\n```"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct amdsmi_proc_info_t {
    pub name: [::std::os::raw::c_char; 256usize],
    pub pid: amdsmi_process_handle_t,
    #[doc = "```text\n!< In Bytes\n```"]
    pub mem: u64,
    #[doc = "```text\n!< time the process spends using these engines in ns\n```"]
    pub engine_usage: amdsmi_proc_info_t_engine_usage_,
    #[doc = "```text\n!< In Bytes\n```"]
    pub memory_usage: amdsmi_proc_info_t_memory_usage_,
    pub container_name: [::std::os::raw::c_char; 256usize],
    #[doc = "```text\n!< Num CUs utilized\n```"]
    pub cu_occupancy: u32,
    pub reserved: [u32; 11usize],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct amdsmi_proc_info_t_engine_usage_ {
    #[doc = "```text\n!< In nano-secs\n```"]
    pub gfx: u64,
    #[doc = "```text\n!< In nano-secs\n```"]
    pub enc: u64,
    pub reserved: [u32; 12usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of amdsmi_proc_info_t_engine_usage_"]
        [::std::mem::size_of::<amdsmi_proc_info_t_engine_usage_>() - 64usize];
    ["Alignment of amdsmi_proc_info_t_engine_usage_"]
        [::std::mem::align_of::<amdsmi_proc_info_t_engine_usage_>() - 8usize];
    ["Offset of field: amdsmi_proc_info_t_engine_usage_::gfx"]
        [::std::mem::offset_of!(amdsmi_proc_info_t_engine_usage_, gfx) - 0usize];
    ["Offset of field: amdsmi_proc_info_t_engine_usage_::enc"]
        [::std::mem::offset_of!(amdsmi_proc_info_t_engine_usage_, enc) - 8usize];
    ["Offset of field: amdsmi_proc_info_t_engine_usage_::reserved"]
        [::std::mem::offset_of!(amdsmi_proc_info_t_engine_usage_, reserved) - 16usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct amdsmi_proc_info_t_memory_usage_ {
    #[doc = "```text\n!< In Bytes\n```"]
    pub gtt_mem: u64,
    #[doc = "```text\n!< In Bytes\n```"]
    pub cpu_mem: u64,
    #[doc = "```text\n!< In Bytes\n```"]
    pub vram_mem: u64,
    pub reserved: [u32; 10usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of amdsmi_proc_info_t_memory_usage_"]
        [::std::mem::size_of::<amdsmi_proc_info_t_memory_usage_>() - 64usize];
    ["Alignment of amdsmi_proc_info_t_memory_usage_"]
        [::std::mem::align_of::<amdsmi_proc_info_t_memory_usage_>() - 8usize];
    ["Offset of field: amdsmi_proc_info_t_memory_usage_::gtt_mem"]
        [::std::mem::offset_of!(amdsmi_proc_info_t_memory_usage_, gtt_mem) - 0usize];
    ["Offset of field: amdsmi_proc_info_t_memory_usage_::cpu_mem"]
        [::std::mem::offset_of!(amdsmi_proc_info_t_memory_usage_, cpu_mem) - 8usize];
    ["Offset of field: amdsmi_proc_info_t_memory_usage_::vram_mem"]
        [::std::mem::offset_of!(amdsmi_proc_info_t_memory_usage_, vram_mem) - 16usize];
    ["Offset of field: amdsmi_proc_info_t_memory_usage_::reserved"]
        [::std::mem::offset_of!(amdsmi_proc_info_t_memory_usage_, reserved) - 24usize];
};
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of amdsmi_proc_info_t"][::std::mem::size_of::<amdsmi_proc_info_t>() - 704usize];
    ["Alignment of amdsmi_proc_info_t"][::std::mem::align_of::<amdsmi_proc_info_t>() - 8usize];
    ["Offset of field: amdsmi_proc_info_t::name"]
        [::std::mem::offset_of!(amdsmi_proc_info_t, name) - 0usize];
    ["Offset of field: amdsmi_proc_info_t::pid"]
        [::std::mem::offset_of!(amdsmi_proc_info_t, pid) - 256usize];
    ["Offset of field: amdsmi_proc_info_t::mem"]
        [::std::mem::offset_of!(amdsmi_proc_info_t, mem) - 264usize];
    ["Offset of field: amdsmi_proc_info_t::engine_usage"]
        [::std::mem::offset_of!(amdsmi_proc_info_t, engine_usage) - 272usize];
    ["Offset of field: amdsmi_proc_info_t::memory_usage"]
        [::std::mem::offset_of!(amdsmi_proc_info_t, memory_usage) - 336usize];
    ["Offset of field: amdsmi_proc_info_t::container_name"]
        [::std::mem::offset_of!(amdsmi_proc_info_t, container_name) - 400usize];
    ["Offset of field: amdsmi_proc_info_t::cu_occupancy"]
        [::std::mem::offset_of!(amdsmi_proc_info_t, cu_occupancy) - 656usize];
    ["Offset of field: amdsmi_proc_info_t::reserved"]
        [::std::mem::offset_of!(amdsmi_proc_info_t, reserved) - 660usize];
};
#[doc = "```text\n @brief This structure holds version information.\n\n @cond @tag{gpu_bm_linux} @endcond\n```"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct amdsmi_version_t {
    #[doc = "```text\n!< Last 2 digits of the Year released  -  To Be Depricated\n```"]
    pub year: u32,
    #[doc = "```text\n!< Major version\n```"]
    pub major: u32,
    #[doc = "```text\n!< Minor version\n```"]
    pub minor: u32,
    #[doc = "```text\n!< Patch, build or stepping version\n```"]
    pub release: u32,
    #[doc = "```text\n!< Full Build version string\n```"]
    pub build: *const ::std::os::raw::c_char,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of amdsmi_version_t"][::std::mem::size_of::<amdsmi_version_t>() - 24usize];
    ["Alignment of amdsmi_version_t"][::std::mem::align_of::<amdsmi_version_t>() - 8usize];
    ["Offset of field: amdsmi_version_t::year"]
        [::std::mem::offset_of!(amdsmi_version_t, year) - 0usize];
    ["Offset of field: amdsmi_version_t::major"]
        [::std::mem::offset_of!(amdsmi_version_t, major) - 4usize];
    ["Offset of field: amdsmi_version_t::minor"]
        [::std::mem::offset_of!(amdsmi_version_t, minor) - 8usize];
    ["Offset of field: amdsmi_version_t::release"]
        [::std::mem::offset_of!(amdsmi_version_t, release) - 12usize];
    ["Offset of field: amdsmi_version_t::build"]
        [::std::mem::offset_of!(amdsmi_version_t, build) - 16usize];
};
pub struct libamd_smi {
    __library: ::libloading::Library,
}
impl libamd_smi {
    pub unsafe fn new<P>(path: P) -> Result<Self, ::libloading::Error>
    where
        P: AsRef<::std::ffi::OsStr>,
    {
        let library = ::libloading::Library::new(path)?;
        Self::from_library(library)
    }
    pub unsafe fn from_library<L>(library: L) -> Result<Self, ::libloading::Error>
    where
        L: Into<::libloading::Library>,
    {
        let __library = library.into();
        Ok(libamd_smi { __library })
    }
}
