Skip to content

Commit 2d4c8a2

Browse files
wadelnnlguohan
authored andcommitted
[Platform] Update switch config files for Ingrasys platforms. (#1474)
* Add psuutil for S8900-54XC and S8900-64XC. * Update syseeprom to CPU EEPROM for S9130-32X, S9200-64X and S9230-64X. * Update sensors.conf for S9200-64X and S9230-64X. * Update submodule for platform/broadcom/sonic-platform-modules-ingrasys Signed-off-by: Wade He <[email protected]>
1 parent e4a02cb commit 2d4c8a2

File tree

8 files changed

+192
-13
lines changed

8 files changed

+192
-13
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#
2+
# psuutil.py
3+
# Platform-specific PSU status interface for SONiC
4+
#
5+
6+
7+
import os.path
8+
9+
try:
10+
from sonic_psu.psu_base import PsuBase
11+
except ImportError as e:
12+
raise ImportError(str(e) + "- required module not found")
13+
14+
15+
class PsuUtil(PsuBase):
16+
"""Platform-specific PSUutil class"""
17+
18+
PSU_CPLD_DIR = "/sys/bus/i2c/devices/0-0033"
19+
20+
def __init__(self):
21+
PsuBase.__init__(self)
22+
23+
24+
# Get sysfs attribute
25+
def get_attr_value(self, attr_path):
26+
27+
retval = 'ERR'
28+
if (not os.path.isfile(attr_path)):
29+
return retval
30+
31+
try:
32+
with open(attr_path, 'r') as fd:
33+
retval = fd.read()
34+
except Exception as error:
35+
logging.error("Unable to open ", attr_path, " file !")
36+
37+
retval = retval.rstrip('\r\n')
38+
return retval
39+
40+
def get_num_psus(self):
41+
"""
42+
Retrieves the number of PSUs available on the device
43+
:return: An integer, the number of PSUs available on the device
44+
"""
45+
MAX_PSUS = 2
46+
return MAX_PSUS
47+
48+
def get_psu_status(self, index):
49+
"""
50+
Retrieves the oprational status of power supply unit (PSU) defined
51+
by index <index>
52+
:param index: An integer, index of the PSU of which to query status
53+
:return: Boolean, True if PSU is operating properly, False if PSU is\
54+
faulty
55+
"""
56+
status = 0
57+
mask = [ 0x08, 0x10 ]
58+
attr_file = 'cpld_pw_good'
59+
attr_path = self.PSU_CPLD_DIR +'/'+ attr_file
60+
61+
attr_value = self.get_attr_value(attr_path)
62+
63+
if (attr_value != 'ERR'):
64+
attr_value = int(attr_value, 16)
65+
# Check for PSU status
66+
if (attr_value & mask[index-1]):
67+
status = 1
68+
69+
return status
70+
71+
def get_psu_presence(self, index):
72+
"""
73+
Retrieves the presence status of power supply unit (PSU) defined
74+
by index <index>
75+
:param index: An integer, index of the PSU of which to query status
76+
:return: Boolean, True if PSU is plugged, False if not
77+
"""
78+
status = 0
79+
mask = [ 0x01, 0x02 ]
80+
attr_file ='cpld_pw_abs'
81+
attr_path = self.PSU_CPLD_DIR +'/'+ attr_file
82+
83+
attr_value = self.get_attr_value(attr_path)
84+
85+
if (attr_value != 'ERR'):
86+
attr_value = int(attr_value, 16)
87+
# Check for PSU presence
88+
if (~attr_value & mask[index-1]):
89+
status = 1
90+
91+
return status
92+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#
2+
# psuutil.py
3+
# Platform-specific PSU status interface for SONiC
4+
#
5+
6+
7+
import os.path
8+
9+
try:
10+
from sonic_psu.psu_base import PsuBase
11+
except ImportError as e:
12+
raise ImportError(str(e) + "- required module not found")
13+
14+
15+
class PsuUtil(PsuBase):
16+
"""Platform-specific PSUutil class"""
17+
18+
PSU_CPLD_DIR = "/sys/bus/i2c/devices/0-0033"
19+
20+
def __init__(self):
21+
PsuBase.__init__(self)
22+
23+
24+
# Get sysfs attribute
25+
def get_attr_value(self, attr_path):
26+
27+
retval = 'ERR'
28+
if (not os.path.isfile(attr_path)):
29+
return retval
30+
31+
try:
32+
with open(attr_path, 'r') as fd:
33+
retval = fd.read()
34+
except Exception as error:
35+
logging.error("Unable to open ", attr_path, " file !")
36+
37+
retval = retval.rstrip('\r\n')
38+
return retval
39+
40+
def get_num_psus(self):
41+
"""
42+
Retrieves the number of PSUs available on the device
43+
:return: An integer, the number of PSUs available on the device
44+
"""
45+
MAX_PSUS = 2
46+
return MAX_PSUS
47+
48+
def get_psu_status(self, index):
49+
"""
50+
Retrieves the oprational status of power supply unit (PSU) defined
51+
by index <index>
52+
:param index: An integer, index of the PSU of which to query status
53+
:return: Boolean, True if PSU is operating properly, False if PSU is\
54+
faulty
55+
"""
56+
status = 0
57+
mask = [ 0x04, 0x08 ]
58+
attr_file = 'cpld_pw_good'
59+
attr_path = self.PSU_CPLD_DIR +'/'+ attr_file
60+
61+
attr_value = self.get_attr_value(attr_path)
62+
63+
if (attr_value != 'ERR'):
64+
attr_value = int(attr_value, 16)
65+
# Check for PSU status
66+
if (attr_value & mask[index-1]):
67+
status = 1
68+
69+
return status
70+
71+
def get_psu_presence(self, index):
72+
"""
73+
Retrieves the presence status of power supply unit (PSU) defined
74+
by index <index>
75+
:param index: An integer, index of the PSU of which to query status
76+
:return: Boolean, True if PSU is plugged, False if not
77+
"""
78+
status = 0
79+
mask = [ 0x01, 0x02 ]
80+
attr_file ='cpld_pw_abs'
81+
attr_path = self.PSU_CPLD_DIR +'/'+ attr_file
82+
83+
attr_value = self.get_attr_value(attr_path)
84+
85+
if (attr_value != 'ERR'):
86+
attr_value = int(attr_value, 16)
87+
# Check for PSU presence
88+
if (~attr_value & mask[index-1]):
89+
status = 1
90+
91+
return status
92+

device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/eeprom.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
class board(eeprom_tlvinfo.TlvInfoDecoder):
1919

2020
def __init__(self, name, path, cpld_root, ro):
21-
self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0055/eeprom"
21+
self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0051/eeprom"
2222
super(board, self).__init__(self.eeprom_path, 0, '', True)

device/ingrasys/x86_64-ingrasys_s9200_64x-r0/plugins/eeprom.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ class board(eeprom_tlvinfo.TlvInfoDecoder):
1919

2020
def __init__(self, name, path, cpld_root, ro):
2121
i2c_bus = "0"
22-
i2c_addr = "0055"
22+
i2c_addr = "0051"
2323
self.eeprom_path = "/sys/class/i2c-adapter/i2c-" + i2c_bus + "/" + i2c_bus + "-" + i2c_addr + "/eeprom"
2424
super(board, self).__init__(self.eeprom_path, 0, '', True)

device/ingrasys/x86_64-ingrasys_s9200_64x-r0/sensors.conf

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ chip "w83795adg-*"
4848
ignore temp2
4949
ignore temp3
5050
ignore temp4
51+
ignore temp5
52+
ignore temp6
5153
ignore intrusion0
5254

5355
chip "tmp75-i2c-*-4A"

device/ingrasys/x86_64-ingrasys_s9230_64x-r0/plugins/eeprom.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
class board(eeprom_tlvinfo.TlvInfoDecoder):
1919

2020
def __init__(self, name, path, cpld_root, ro):
21-
self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0055/eeprom"
21+
self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0051/eeprom"
2222
super(board, self).__init__(self.eeprom_path, 0, '', True)

device/ingrasys/x86_64-ingrasys_s9230_64x-r0/sensors.conf

+2-9
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,12 @@ chip "w83795adg-*"
3636
ignore in18
3737
ignore in19
3838
label fan1 "FANTRAY 1"
39-
#label fan2 "FANTRAY 1-B"
4039
ignore fan2
4140
label fan3 "FANTRAY 2"
42-
#label fan4 "FANTRAY 2-B"
4341
ignore fan4
4442
label fan5 "FANTRAY 3"
45-
#label fan6 "FANTRAY 3-B"
4643
ignore fan6
4744
label fan7 "FANTRAY 4"
48-
#label fan8 "FANTRAY 4-B"
4945
ignore fan8
5046
ignore temp1
5147
ignore temp2
@@ -55,15 +51,14 @@ chip "w83795adg-*"
5551
ignore temp6
5652
ignore intrusion0
5753

58-
# TODO: need to confirm the critial temp value with HW after board ready
5954
chip "tmp75-i2c-*-4A"
60-
label temp1 "BMC board Temp"
55+
label temp1 "BMC Board Temp"
6156
set temp1_max 50
6257
set temp1_max_hyst 45
6358

6459
bus "i2c-0" "SMBus I801 adapter at f000"
6560
chip "tmp75-i2c-*-4F"
66-
label temp1 "x86 CPU board Temp"
61+
label temp1 "x86 CPU Board Temp"
6762
set temp1_max 50
6863
set temp1_max_hyst 45
6964

@@ -86,5 +81,3 @@ chip "lm75-i2c-7-4E"
8681
label temp1 "Front MAC Temp"
8782
set temp1_max 50
8883
set temp1_max_hyst 45
89-
90-

0 commit comments

Comments
 (0)