@@ -224,7 +224,8 @@ impl OpaqueData {
224224 | OpaqueDataType :: Nvdec0Status
225225 | OpaqueDataType :: Project
226226 | OpaqueDataType :: ProjectSku
227- | OpaqueDataType :: ProtectedPcieStatus => Value :: String (
227+ | OpaqueDataType :: ProtectedPcieStatus
228+ | OpaqueDataType :: ChipInfo => Value :: String (
228229 String :: from_utf8_lossy ( data_bytes)
229230 . trim_end_matches ( '\0' )
230231 . to_string ( ) ,
@@ -235,6 +236,10 @@ impl OpaqueData {
235236 ) ,
236237 OpaqueDataType :: MsrsCnt => Self :: decode_measurement_count ( data_bytes) ?,
237238 OpaqueDataType :: SwitchPdi => Self :: decode_switch_pdi ( data_bytes) ?,
239+ OpaqueDataType :: OpaqueDataVersion => {
240+ Value :: Number ( Self :: decode_le_u64 ( data_bytes) ?. into ( ) )
241+ }
242+ OpaqueDataType :: FeatureFlag => Self :: decode_feature_flag ( data_bytes) ?,
238243 OpaqueDataType :: Invalid => bail ! ( anyhow!( "Hashmap: Invalid OpaqueDataType" ) ) ,
239244 _ => Value :: String ( hex:: encode ( data_bytes) ) ,
240245 } ;
@@ -316,6 +321,29 @@ impl OpaqueData {
316321
317322 Ok ( Value :: Object ( values) )
318323 }
324+
325+ fn decode_feature_flag ( bytes : & [ u8 ] ) -> Result < Value > {
326+ let value = Self :: decode_le_u64 ( bytes) ?;
327+ let feature = match value {
328+ 0 => "SPT" ,
329+ 1 => "MPT" ,
330+ 2 => "PPCIE" ,
331+ _ => "unknown" ,
332+ } ;
333+ Ok ( Value :: String ( feature. to_string ( ) ) )
334+ }
335+
336+ fn decode_le_u64 ( bytes : & [ u8 ] ) -> Result < u64 > {
337+ if bytes. len ( ) > 8 {
338+ bail ! ( "OpaqueDataType integer larger than 8 bytes" ) ;
339+ }
340+ let mut padded = [ 0u8 ; 8 ] ;
341+ let len = bytes. len ( ) . min ( 8 ) ;
342+ padded[ ..len] . copy_from_slice ( & bytes[ ..len] ) ;
343+
344+ let value = u64:: from_le_bytes ( padded) ;
345+ Ok ( value)
346+ }
319347}
320348
321349#[ derive( Clone , Debug , Default ) ]
@@ -467,6 +495,10 @@ pub enum OpaqueDataType {
467495 PositionId = 24 ,
468496 LockSwitchStatus = 25 ,
469497 GpuLinkConn = 32 ,
498+ SysEnableStatus = 33 ,
499+ OpaqueDataVersion = 34 ,
500+ ChipInfo = 35 ,
501+ FeatureFlag = 36 ,
470502 #[ default]
471503 Invalid = 255 ,
472504}
@@ -499,6 +531,10 @@ impl OpaqueDataType {
499531 24 => Some ( OpaqueDataType :: PositionId ) ,
500532 25 => Some ( OpaqueDataType :: LockSwitchStatus ) ,
501533 32 => Some ( OpaqueDataType :: GpuLinkConn ) ,
534+ 33 => Some ( OpaqueDataType :: SysEnableStatus ) ,
535+ 34 => Some ( OpaqueDataType :: OpaqueDataVersion ) ,
536+ 35 => Some ( OpaqueDataType :: ChipInfo ) ,
537+ 36 => Some ( OpaqueDataType :: FeatureFlag ) ,
502538 _ => None ,
503539 }
504540 }
@@ -536,6 +572,10 @@ impl fmt::Display for OpaqueDataType {
536572 OpaqueDataType :: PositionId => write ! ( f, "position_id" ) ,
537573 OpaqueDataType :: LockSwitchStatus => write ! ( f, "lock_switch_status" ) ,
538574 OpaqueDataType :: GpuLinkConn => write ! ( f, "gpu_link_conn" ) ,
575+ OpaqueDataType :: SysEnableStatus => write ! ( f, "sys_enable_status" ) ,
576+ OpaqueDataType :: OpaqueDataVersion => write ! ( f, "opaque_data_version" ) ,
577+ OpaqueDataType :: ChipInfo => write ! ( f, "chip_info" ) ,
578+ OpaqueDataType :: FeatureFlag => write ! ( f, "feature_flag" ) ,
539579 OpaqueDataType :: Invalid => write ! ( f, "invalid" ) ,
540580 }
541581 }
0 commit comments