@@ -6331,6 +6331,54 @@ impl<'nvml> Device<'nvml> {
63316331 }
63326332 }
63336333
6334+ /**
6335+ Get GSP firmware mode. Whether it is enabled and if it is in default mode.
6336+
6337+ # Errors
6338+
6339+ * `Uninitialized`, if the library has not been successfully initialized
6340+ * `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
6341+ * `Unknown`, on any unexpected error
6342+ * `NotSupported`, if the platform does not support this feature
6343+ */
6344+ #[ doc( alias = "nvmlDeviceGetGspFirmwareMode" ) ]
6345+ pub fn gsp_firmware_mode ( & self ) -> Result < ( bool , bool ) , NvmlError > {
6346+ let sym = nvml_sym ( self . nvml . lib . nvmlDeviceGetGspFirmwareMode . as_ref ( ) ) ?;
6347+
6348+ unsafe {
6349+ let mut enabled: c_uint = 0 ;
6350+ let mut default: c_uint = 0 ;
6351+
6352+ nvml_try ( sym ( self . device , & mut enabled, & mut default) ) ?;
6353+
6354+ Ok ( ( enabled != 0 , default != 0 ) )
6355+ }
6356+ }
6357+
6358+ /**
6359+ Get GSP firmware version.
6360+
6361+ # Errors
6362+
6363+ * `Uninitialized`, if the library has not been successfully initialized
6364+ * `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
6365+ * `Unknown`, on any unexpected error
6366+ * `NotSupported`, if the platform does not support this feature
6367+ */
6368+ #[ doc( alias = "nvmlDeviceGetGspFirmwareVersion" ) ]
6369+ pub fn gsp_firmware_version ( & self ) -> Result < String , NvmlError > {
6370+ let sym = nvml_sym ( self . nvml . lib . nvmlDeviceGetGspFirmwareVersion . as_ref ( ) ) ?;
6371+
6372+ unsafe {
6373+ let mut version = vec ! [ 0 ; 80 ] ;
6374+
6375+ nvml_try ( sym ( self . device , version. as_mut_ptr ( ) ) ) ?;
6376+ let raw = CStr :: from_ptr ( version. as_ptr ( ) ) ;
6377+
6378+ Ok ( raw. to_str ( ) ?. into ( ) )
6379+ }
6380+ }
6381+
63346382 // NvLink
63356383
63366384 /**
@@ -7070,6 +7118,18 @@ mod test {
70707118 } )
70717119 }
70727120
7121+ #[ test]
7122+ fn gsp_firmware_mode ( ) {
7123+ let nvml = nvml ( ) ;
7124+ test_with_device ( 3 , & nvml, |device| device. gsp_firmware_mode ( ) )
7125+ }
7126+
7127+ #[ test]
7128+ fn gsp_firmware_version ( ) {
7129+ let nvml = nvml ( ) ;
7130+ test_with_device ( 3 , & nvml, |device| device. gsp_firmware_version ( ) )
7131+ }
7132+
70737133 #[ test]
70747134 fn field_values_for ( ) {
70757135 let nvml = nvml ( ) ;
0 commit comments