[Platform] Add psuutil and update submodule for Ingrasys S9100-32X, S8810-32Q, S9200-64X on master branch (#1271)
* [platform] Add Psuutil and fixed voltage alarm for S9100 * Add I2C CPLD kernel module for psuutil. * Support psuutil script. * Add voltage min and max threshold. Signed-off-by: Wade He <chihen.he@gmail.com> * [Platform] Add Psuutil and update sensors.conf for S8810-32Q and S9200-64X * Support psuutil script. * Update sensors.conf for tmp75. Signed-off-by: Wade He <chihen.he@gmail.com>
This commit is contained in:
parent
5eb5e2162b
commit
22eea55c9b
@ -0,0 +1,92 @@
|
||||
#
|
||||
# psuutil.py
|
||||
# Platform-specific PSU status interface for SONiC
|
||||
#
|
||||
|
||||
|
||||
import os.path
|
||||
|
||||
try:
|
||||
from sonic_psu.psu_base import PsuBase
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
|
||||
class PsuUtil(PsuBase):
|
||||
"""Platform-specific PSUutil class"""
|
||||
|
||||
SYSFS_PSU_DIR = ["/sys/bus/i2c/devices/i2c-3/3-0051",
|
||||
"/sys/bus/i2c/devices/i2c-4/4-0051"]
|
||||
|
||||
def __init__(self):
|
||||
PsuBase.__init__(self)
|
||||
|
||||
|
||||
# Get sysfs attribute
|
||||
def get_attr_value(self, attr_path):
|
||||
|
||||
retval = 'ERR'
|
||||
if (not os.path.isfile(attr_path)):
|
||||
return retval
|
||||
|
||||
try:
|
||||
with open(attr_path, 'r') as fd:
|
||||
retval = fd.read()
|
||||
except Exception as error:
|
||||
logging.error("Unable to open ", attr_path, " file !")
|
||||
|
||||
retval = retval.rstrip('\r\n')
|
||||
return retval
|
||||
|
||||
def get_num_psus(self):
|
||||
"""
|
||||
Retrieves the number of PSUs available on the device
|
||||
:return: An integer, the number of PSUs available on the device
|
||||
"""
|
||||
MAX_PSUS = 2
|
||||
return MAX_PSUS
|
||||
|
||||
def get_psu_status(self, index):
|
||||
"""
|
||||
Retrieves the oprational status of power supply unit (PSU) defined
|
||||
by index <index>
|
||||
:param index: An integer, index of the PSU of which to query status
|
||||
:return: Boolean, True if PSU is operating properly, False if PSU is\
|
||||
faulty
|
||||
"""
|
||||
status = 0
|
||||
attr_file = 'psu_pg'
|
||||
attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file
|
||||
|
||||
attr_value = self.get_attr_value(attr_path)
|
||||
|
||||
if (attr_value != 'ERR'):
|
||||
attr_value = int(attr_value, 16)
|
||||
# Check for PSU status
|
||||
if (attr_value == 1):
|
||||
status = 1
|
||||
|
||||
return status
|
||||
|
||||
def get_psu_presence(self, index):
|
||||
"""
|
||||
Retrieves the presence status of power supply unit (PSU) defined
|
||||
by index <index>
|
||||
:param index: An integer, index of the PSU of which to query status
|
||||
:return: Boolean, True if PSU is plugged, False if not
|
||||
"""
|
||||
status = 0
|
||||
psu_absent = 0
|
||||
attr_file ='psu_abs'
|
||||
attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file
|
||||
|
||||
attr_value = self.get_attr_value(attr_path)
|
||||
|
||||
if (attr_value != 'ERR'):
|
||||
attr_value = int(attr_value, 16)
|
||||
# Check for PSU presence
|
||||
if (attr_value == 0):
|
||||
status = 1
|
||||
|
||||
return status
|
||||
|
92
device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/psuutil.py
Normal file
92
device/ingrasys/x86_64-ingrasys_s9100-r0/plugins/psuutil.py
Normal file
@ -0,0 +1,92 @@
|
||||
#
|
||||
# psuutil.py
|
||||
# Platform-specific PSU status interface for SONiC
|
||||
#
|
||||
|
||||
|
||||
import os.path
|
||||
|
||||
try:
|
||||
from sonic_psu.psu_base import PsuBase
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
|
||||
class PsuUtil(PsuBase):
|
||||
"""Platform-specific PSUutil class"""
|
||||
|
||||
PSU_CPLD_DIR = "/sys/bus/i2c/devices/0-0033"
|
||||
|
||||
def __init__(self):
|
||||
PsuBase.__init__(self)
|
||||
|
||||
|
||||
# Get sysfs attribute
|
||||
def get_attr_value(self, attr_path):
|
||||
|
||||
retval = 'ERR'
|
||||
if (not os.path.isfile(attr_path)):
|
||||
return retval
|
||||
|
||||
try:
|
||||
with open(attr_path, 'r') as fd:
|
||||
retval = fd.read()
|
||||
except Exception as error:
|
||||
logging.error("Unable to open ", attr_path, " file !")
|
||||
|
||||
retval = retval.rstrip('\r\n')
|
||||
return retval
|
||||
|
||||
def get_num_psus(self):
|
||||
"""
|
||||
Retrieves the number of PSUs available on the device
|
||||
:return: An integer, the number of PSUs available on the device
|
||||
"""
|
||||
MAX_PSUS = 2
|
||||
return MAX_PSUS
|
||||
|
||||
def get_psu_status(self, index):
|
||||
"""
|
||||
Retrieves the oprational status of power supply unit (PSU) defined
|
||||
by index <index>
|
||||
:param index: An integer, index of the PSU of which to query status
|
||||
:return: Boolean, True if PSU is operating properly, False if PSU is\
|
||||
faulty
|
||||
"""
|
||||
status = 0
|
||||
mask = [ 0x08, 0x10 ]
|
||||
attr_file = 'cpld_pw_good'
|
||||
attr_path = self.PSU_CPLD_DIR +'/'+ attr_file
|
||||
|
||||
attr_value = self.get_attr_value(attr_path)
|
||||
|
||||
if (attr_value != 'ERR'):
|
||||
attr_value = int(attr_value, 16)
|
||||
# Check for PSU status
|
||||
if (attr_value & mask[index-1]):
|
||||
status = 1
|
||||
|
||||
return status
|
||||
|
||||
def get_psu_presence(self, index):
|
||||
"""
|
||||
Retrieves the presence status of power supply unit (PSU) defined
|
||||
by index <index>
|
||||
:param index: An integer, index of the PSU of which to query status
|
||||
:return: Boolean, True if PSU is plugged, False if not
|
||||
"""
|
||||
status = 0
|
||||
mask = [ 0x01, 0x02 ]
|
||||
attr_file ='cpld_pw_abs'
|
||||
attr_path = self.PSU_CPLD_DIR +'/'+ attr_file
|
||||
|
||||
attr_value = self.get_attr_value(attr_path)
|
||||
|
||||
if (attr_value != 'ERR'):
|
||||
attr_value = int(attr_value, 16)
|
||||
# Check for PSU presence
|
||||
if (~attr_value & mask[index-1]):
|
||||
status = 1
|
||||
|
||||
return status
|
||||
|
@ -9,14 +9,24 @@ chip "jc42-*"
|
||||
|
||||
chip "w83795adg-*"
|
||||
label in0 "1.0V"
|
||||
set in0_min 1.00 * 0.97
|
||||
set in0_max 1.00 * 1.03
|
||||
label in1 "1.0V_ROV"
|
||||
set in1_min 1.00 * 0.98
|
||||
set in1_max 1.00 * 1.02
|
||||
label in2 "1.25V"
|
||||
set in2_min 1.25 * 0.97
|
||||
set in2_max 1.25 * 1.03
|
||||
label in3 "1.8V"
|
||||
set in3_min 1.80 * 0.97
|
||||
set in3_max 1.80 * 1.03
|
||||
ignore in4
|
||||
ignore in5
|
||||
ignore in6
|
||||
ignore in7
|
||||
label in12 "+3.3V"
|
||||
set in12_min 3.30 * 0.97
|
||||
set in12_max 3.30 * 1.03
|
||||
ignore in14
|
||||
ignore in15
|
||||
ignore in16
|
||||
|
@ -0,0 +1,92 @@
|
||||
#
|
||||
# psuutil.py
|
||||
# Platform-specific PSU status interface for SONiC
|
||||
#
|
||||
|
||||
|
||||
import os.path
|
||||
|
||||
try:
|
||||
from sonic_psu.psu_base import PsuBase
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
|
||||
class PsuUtil(PsuBase):
|
||||
"""Platform-specific PSUutil class"""
|
||||
|
||||
SYSFS_PSU_DIR = ["/sys/bus/i2c/devices/i2c-18/18-0050",
|
||||
"/sys/bus/i2c/devices/i2c-17/17-0050"]
|
||||
|
||||
def __init__(self):
|
||||
PsuBase.__init__(self)
|
||||
|
||||
|
||||
# Get sysfs attribute
|
||||
def get_attr_value(self, attr_path):
|
||||
|
||||
retval = 'ERR'
|
||||
if (not os.path.isfile(attr_path)):
|
||||
return retval
|
||||
|
||||
try:
|
||||
with open(attr_path, 'r') as fd:
|
||||
retval = fd.read()
|
||||
except Exception as error:
|
||||
logging.error("Unable to open ", attr_path, " file !")
|
||||
|
||||
retval = retval.rstrip('\r\n')
|
||||
return retval
|
||||
|
||||
def get_num_psus(self):
|
||||
"""
|
||||
Retrieves the number of PSUs available on the device
|
||||
:return: An integer, the number of PSUs available on the device
|
||||
"""
|
||||
MAX_PSUS = 2
|
||||
return MAX_PSUS
|
||||
|
||||
def get_psu_status(self, index):
|
||||
"""
|
||||
Retrieves the oprational status of power supply unit (PSU) defined
|
||||
by index <index>
|
||||
:param index: An integer, index of the PSU of which to query status
|
||||
:return: Boolean, True if PSU is operating properly, False if PSU is\
|
||||
faulty
|
||||
"""
|
||||
status = 0
|
||||
attr_file = 'psu_pg'
|
||||
attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file
|
||||
|
||||
attr_value = self.get_attr_value(attr_path)
|
||||
|
||||
if (attr_value != 'ERR'):
|
||||
attr_value = int(attr_value, 16)
|
||||
# Check for PSU status
|
||||
if (attr_value == 1):
|
||||
status = 1
|
||||
|
||||
return status
|
||||
|
||||
def get_psu_presence(self, index):
|
||||
"""
|
||||
Retrieves the presence status of power supply unit (PSU) defined
|
||||
by index <index>
|
||||
:param index: An integer, index of the PSU of which to query status
|
||||
:return: Boolean, True if PSU is plugged, False if not
|
||||
"""
|
||||
status = 0
|
||||
psu_absent = 0
|
||||
attr_file ='psu_abs'
|
||||
attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file
|
||||
|
||||
attr_value = self.get_attr_value(attr_path)
|
||||
|
||||
if (attr_value != 'ERR'):
|
||||
attr_value = int(attr_value, 16)
|
||||
# Check for PSU presence
|
||||
if (attr_value == 0):
|
||||
status = 1
|
||||
|
||||
return status
|
||||
|
@ -49,20 +49,30 @@ chip "w83795adg-*"
|
||||
ignore temp3
|
||||
ignore temp4
|
||||
ignore intrusion0
|
||||
|
||||
chip "tmp75-i2c-*-4A"
|
||||
label temp1 "BMC Board Temp"
|
||||
set temp1_max 50
|
||||
set temp1_max_hyst 45
|
||||
|
||||
chip "tmp75-i2c-*-4F"
|
||||
label temp1 "x86 CPU Board Temp"
|
||||
set temp1_max 50
|
||||
set temp1_max_hyst 45
|
||||
|
||||
bus "i2c-6" "i2c-0-mux (chan_id 5)"
|
||||
chip "lm75-i2c-6-4E"
|
||||
label temp1 "MAC Temp"
|
||||
set temp1_max 50
|
||||
set temp1_max_hyst 45
|
||||
|
||||
bus "i2c-6" "i2c-0-mux (chan_id 5)"
|
||||
chip "lm75-i2c-6-4D"
|
||||
label temp1 "REAR Temp"
|
||||
label temp1 "REAR MAC Temp"
|
||||
set temp1_max 50
|
||||
set temp1_max_hyst 45
|
||||
|
||||
bus "i2c-7" "i2c-0-mux (chan_id 6)"
|
||||
chip "lm75-i2c-7-4D"
|
||||
label temp1 "Front Temp"
|
||||
label temp1 "Front MAC Temp"
|
||||
set temp1_max 50
|
||||
set temp1_max_hyst 45
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 1d9ccb21aaf868a788fd593ff1c03fdaf150eaf0
|
||||
Subproject commit f2dc0aa6b96ab293b4ae6ebf3a942851dd9324b7
|
Loading…
Reference in New Issue
Block a user