@@ -6455,6 +6455,57 @@ impl<'nvml> Device<'nvml> {
64556455 }
64566456 }
64576457
6458+ /**
6459+ Get GSP firmware mode. Whether it is enabled and if it is in default mode.
6460+
6461+ # Errors
6462+
6463+ * `Uninitialized`, if the library has not been successfully initialized
6464+ * `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
6465+ * `Unknown`, on any unexpected error
6466+ * `NotSupported`, if the platform does not support this feature
6467+ */
6468+ #[ doc( alias = "nvmlDeviceGetGspFirmwareMode" ) ]
6469+ pub fn gsp_firmware_mode ( & self ) -> Result < GspFirmwareMode , NvmlError > {
6470+ let sym = nvml_sym ( self . nvml . lib . nvmlDeviceGetGspFirmwareMode . as_ref ( ) ) ?;
6471+
6472+ unsafe {
6473+ let mut enabled: c_uint = 0 ;
6474+ let mut default: c_uint = 0 ;
6475+
6476+ nvml_try ( sym ( self . device , & mut enabled, & mut default) ) ?;
6477+
6478+ Ok ( GspFirmwareMode {
6479+ enabled : enabled != 0 ,
6480+ default : default != 0 ,
6481+ } )
6482+ }
6483+ }
6484+
6485+ /**
6486+ Get GSP firmware version.
6487+
6488+ # Errors
6489+
6490+ * `Uninitialized`, if the library has not been successfully initialized
6491+ * `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
6492+ * `Unknown`, on any unexpected error
6493+ * `NotSupported`, if the platform does not support this feature
6494+ */
6495+ #[ doc( alias = "nvmlDeviceGetGspFirmwareVersion" ) ]
6496+ pub fn gsp_firmware_version ( & self ) -> Result < String , NvmlError > {
6497+ let sym = nvml_sym ( self . nvml . lib . nvmlDeviceGetGspFirmwareVersion . as_ref ( ) ) ?;
6498+
6499+ unsafe {
6500+ let mut version = vec ! [ 0 ; 80 ] ;
6501+
6502+ nvml_try ( sym ( self . device , version. as_mut_ptr ( ) ) ) ?;
6503+ let raw = CStr :: from_ptr ( version. as_ptr ( ) ) ;
6504+
6505+ Ok ( raw. to_str ( ) ?. into ( ) )
6506+ }
6507+ }
6508+
64586509 // NvLink
64596510
64606511 /**
@@ -7213,6 +7264,18 @@ mod test {
72137264 } )
72147265 }
72157266
7267+ #[ test]
7268+ fn gsp_firmware_mode ( ) {
7269+ let nvml = nvml ( ) ;
7270+ test_with_device ( 3 , & nvml, |device| device. gsp_firmware_mode ( ) )
7271+ }
7272+
7273+ #[ test]
7274+ fn gsp_firmware_version ( ) {
7275+ let nvml = nvml ( ) ;
7276+ test_with_device ( 3 , & nvml, |device| device. gsp_firmware_version ( ) )
7277+ }
7278+
72167279 #[ test]
72177280 fn field_values_for ( ) {
72187281 let nvml = nvml ( ) ;
0 commit comments