@@ -331,10 +331,10 @@ class CONST(object):
331331 ASIC_TEMP_FAULT_DEF = 105000
332332 ASIC_TEMP_CRIT_DEF = 120000
333333 #
334- MODULE_TEMP_MIN_DEF = 70000
335334 MODULE_TEMP_MAX_DEF = 75000
336335 MODULE_TEMP_FAULT_DEF = 105000
337336 MODULE_TEMP_CRIT_DEF = 120000
337+ MODULE_TEMP_EMERGENCY_OFFSET = 10000
338338
339339REDFISH_OBJ = None
340340
@@ -632,9 +632,9 @@ def module_temp_populate(arg_list, _dummy):
632632
633633 # Default temperature values
634634 temperature = "0"
635- temperature_min = "0"
636- temperature_max = "0"
635+ temperature_emergency = "0"
637636 temperature_fault = "0"
637+ temperature_trip_crit = "0"
638638 temperature_crit = "0"
639639
640640 if module_present :
@@ -646,44 +646,48 @@ def module_temp_populate(arg_list, _dummy):
646646 continue
647647
648648 f_src_input = os .path .join (f_src_path , "temperature/input" )
649- f_src_min = os .path .join (f_src_path , "temperature/threshold_lo " )
650- f_src_max = os .path .join (f_src_path , "temperature/threshold_hi " )
649+ f_src_crit = os .path .join (f_src_path , "temperature/threshold_hi " )
650+ f_src_hcrit = os .path .join (f_src_path , "temperature/threshold_critical_hi " )
651651
652652 try :
653653 with open (f_src_input , 'r' ) as f :
654654 val = f .read ()
655655 temperature = sdk_temp2degree (int (val ))
656656
657- if os .path .isfile (f_src_min ):
658- with open (f_src_min , 'r' ) as f :
657+ if os .path .isfile (f_src_crit ):
658+ with open (f_src_crit , 'r' ) as f :
659659 val = f .read ()
660- temperature_min = sdk_temp2degree (int (val ))
660+ temperature_crit = sdk_temp2degree (int (val ))
661661 else :
662- temperature_min = CONST .MODULE_TEMP_MIN_DEF
662+ temperature_crit = CONST .MODULE_TEMP_MAX_DEF
663663
664- if os .path .isfile (f_src_max ):
665- with open (f_src_max , 'r' ) as f :
664+ if temperature_crit != 0 :
665+ temperature_emergency = temperature_crit + CONST .MODULE_TEMP_EMERGENCY_OFFSET
666+
667+ if os .path .isfile (f_src_hcrit ):
668+ with open (f_src_hcrit , 'r' ) as f :
666669 val = f .read ()
667- temperature_max = sdk_temp2degree (int (val ))
670+ temperature_trip_crit = sdk_temp2degree (int (val ))
668671 else :
669- temperature_max = CONST .MODULE_TEMP_MAX_DEF
670- temperature_crit = CONST . MODULE_TEMP_CRIT_DEF
672+ temperature_trip_crit = CONST .MODULE_TEMP_CRIT_DEF
673+
671674 except :
672675 pass
673676
674677 # Write the temperature data to files
675678 file_paths = {
676679 "_temp_input" : temperature ,
677- "_temp_crit" : temperature_min ,
678- "_temp_emergency" : temperature_max ,
680+ "_temp_crit" : temperature_crit ,
681+ "_temp_emergency" : temperature_emergency ,
679682 "_temp_fault" : temperature_fault ,
680- "_temp_trip_crit" : temperature_crit
683+ "_temp_trip_crit" : temperature_trip_crit
681684 }
682685
683686 for suffix , value in file_paths .items ():
684687 f_name = "/var/run/hw-management/thermal/{}{}" .format (module_name , suffix )
685- with open (f_name , 'w' , encoding = "utf-8" ) as f :
686- f .write ("{}\n " .format (value ))
688+ if value is not None :
689+ with open (f_name , 'w' , encoding = "utf-8" ) as f :
690+ f .write ("{}\n " .format (value ))
687691
688692 with open ("/var/run/hw-management/config/module_counter" , 'w+' , encoding = "utf-8" ) as f :
689693 f .write ("{}\n " .format (module_count ))
0 commit comments