Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CPLD value for thermal shutdown #26

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,24 @@ def manage_fans(self):
fan_fail_list[i] = 0

if sum(fan_fail_list) == NUM_FANS:
logging.critical(
'Alarm for all fan faulty/absent is detected, disable PoE')
cmd_str = ["i2cset", "-f", "-y", "16", "0x20", "0x06", "0x0", "0x0", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xFE", "i"]
getstatusoutput_noshell(cmd_str) # Disable PoE

# Critical: Either all the fans are faulty or they are removed, shutdown the system
logging.critical('Alarm for all fan faulty/absent is detected')
logging.critical("Alarm for all fan faulty/absent is detected, reset DUT")
cmd_str = ["i2cset", "-y", "-f", "3", "0x60", "0x4", "0xE4"]
logging.critical("Alarm for all fan faulty/absent is detected, shutdown DUT")

# Sync log buffer to disk
cmd_str = ["sync"]
getstatusoutput_noshell(cmd_str)
cmd_str = ["/sbin/fstrim", "-av"]
getstatusoutput_noshell(cmd_str)
time.sleep(3)

cmd_str = ["i2cset", "-y", "-f", "3", "0x60", "0x4", "0x74"]
time.sleep(2)
getstatusoutput_noshell('sync')
getstatusoutput_noshell('sync')
getstatusoutput_noshell('sync')
getstatusoutput_noshell(cmd_str)
elif sum(fan_fail_list) != 0:
# Set the 100% speed only for first fan failure detection
Expand Down Expand Up @@ -243,8 +253,13 @@ def manage_fans(self):

if temp[0] >= 70000: # LM77-48
# critical case*/
logging.critical(
'Alarm-Critical for temperature critical is detected, disable PoE')
cmd_str = ["i2cset", "-f", "-y", "16", "0x20", "0x06", "0x0", "0x0", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xff", "0xFE", "i"]
getstatusoutput_noshell(cmd_str) # Disable PoE

logging.critical('Alarm for temperature critical is detected')
logging.critical("Alarm-Critical for temperature critical is detected, reset DUT")
logging.critical("Alarm-Critical for temperature critical is detected, shutdown DUT")
# Update the reboot cause file to reflect that critical temperature
# has been crossed. Upon next boot, the contents of this file will
# be used to determine the cause of the previous reboot
Expand All @@ -255,10 +270,14 @@ def manage_fans(self):
if status:
logging.warning('Reboot cause file not updated. {}'.format(output))

cmd_str = ["i2cset", "-y", "-f", "3", "0x60", "0x4", "0xE4"]
getstatusoutput_noshell('sync')
getstatusoutput_noshell('sync')
getstatusoutput_noshell('sync')
# Sync log buffer to disk
cmd_str = ["sync"]
getstatusoutput_noshell(cmd_str)
cmd_str = ["/sbin/fstrim", "-av"]
getstatusoutput_noshell(cmd_str)
time.sleep(3)

cmd_str = ["i2cset", "-y", "-f", "3", "0x60", "0x4", "0x74"]
time.sleep(3)
getstatusoutput_noshell(cmd_str)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
# ------------------------------------------------------------------

try:
import os
import sys
import getopt
import logging
import logging.config
import logging.handlers
import time
import subprocess
from as4630_54te.fanutil import FanUtil
from as4630_54te.thermalutil import ThermalUtil
except ImportError as e:
Expand Down Expand Up @@ -195,11 +197,19 @@ def manage_fans(self):
if temp[0] >= 70000: # LM75-48
# critical case*/
logging.critical(
'Alarm-Critical for temperature critical is detected, reset DUT')
cmd_str = ["i2cset", "-y", "-f", "3", "0x60", "0x4", "0xE4"]
'Alarm-Critical for temperature critical is detected, shutdown DUT')

# Sync log buffer to disk
cmd_str="sync"
status, output = subprocess.getstatusoutput(cmd_str)
cmd_str="/sbin/fstrim -av"
status, output = subprocess.getstatusoutput(cmd_str)
time.sleep(3)

cmd_str = ["i2cset", "-y", "-f", "3", "0x60", "0x4", "0x74"]
time.sleep(2)
return_value = subprocess.call(cmd_str)
logging.warning('Fan set: i2cset -y -f 3 0x60 0x4 0xE4, status is %d', return_value)
logging.warning('Fan set: i2cset -y -f 3 0x60 0x4 0x74, status is %d', return_value)

#logging.debug('ori_state=%d, current_state=%d, temp_val=%d\n\n',ori_state, fan_policy_state, temp_val)

Expand Down