-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[platform] Add new platform as4630-54npe #8220
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
Closed
Closed
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
c2e9949
[platform] Add new platform as4630-54npe
seanwu-ec 05254a7
Update CPLD reg use according to PR8115
seanwu-ec 85eb84f
Add sensors.conf to AS4630-54NPE
seanwu-ec 5a20d29
[AS4630-54NPE] Enable thermalctld, disable pcied
seanwu-ec 1dc2874
Fix LGTM alerts
seanwu-ec e843b6d
Migrate API2.0 from AS4630-54PE to AS4630-54NPE
seanwu-ec 31c2d6b
Remove redundancy in accton_as4630_54npe_util.py
seanwu-ec 0143ef5
Apply changes from PR#5297
seanwu-ec 6289f88
Apply changes from PR#6035
seanwu-ec 0aa720a
Apply changes from PR#8033
seanwu-ec 66ab7e2
Fix LGTM alerts
seanwu-ec 2089895
Fix missing sonic_platform whl pkg
seanwu-ec bdbee1a
Make scripts executable
seanwu-ec bc1ce6f
Fix python2-style print in util.py
seanwu-ec ccd1172
Remove API 1.0 util python scripts
seanwu-ec 8a95c3e
Make sonic_platform package installed while bootup
seanwu-ec d2cdb8e
Fix PSU model/serial num fetching
seanwu-ec ddd7ec9
Implement thermal threshold APIs
seanwu-ec d553845
Revert "Remove API 1.0 util python scripts"
seanwu-ec 593159f
[as4630-54npe] fix errors in sfputil.py
seanwu-ec 97754e2
Fix as4630-54npe xcvrd busy issue
seanwu-ec cbaf3dd
Add platform_asic file because PR#8542
seanwu-ec 3a344b9
[4630-54NPE] Add CPU coretemp to thermal.py
seanwu-ec e5bd138
Fix kernel5.10 build err in cpld drv
seanwu-ec 1ed40b0
Enable pca954x idle_disconnect
seanwu-ec 5e55853
Revert "Implement thermal threshold APIs"
seanwu-ec 12e51d3
Add intel_iommu=off to installer.conf
seanwu-ec dedacc2
Update port_config.ini on as4630-54npe
chihhan123 d06be47
Add psu_index into thermal_list.
ec-michael-shih File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
device/accton/x86_64-accton_as4630_54npe-r0/Accton-AS4630-54NPE/port_config.ini
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # name lanes alias index speed autoneg | ||
| Ethernet0 2 twentyfivethousandE1 1 0 on | ||
| Ethernet1 1 twentyfivethousandE2 2 0 on | ||
| Ethernet2 4 twentyfivethousandE3 3 0 on | ||
| Ethernet3 3 twentyfivethousandE4 4 0 on | ||
| Ethernet4 6 twentyfivethousandE5 5 0 on | ||
| Ethernet5 5 twentyfivethousandE6 6 0 on | ||
| Ethernet6 8 twentyfivethousandE7 7 0 on | ||
| Ethernet7 7 twentyfivethousandE8 8 0 on | ||
| Ethernet8 10 twentyfivethousandE9 9 0 on | ||
| Ethernet9 9 twentyfivethousandE10 10 0 on | ||
| Ethernet10 12 twentyfivethousandE11 11 0 on | ||
| Ethernet11 11 twentyfivethousandE12 12 0 on | ||
| Ethernet12 14 twentyfivethousandE13 13 0 on | ||
| Ethernet13 13 twentyfivethousandE14 14 0 on | ||
| Ethernet14 16 twentyfivethousandE15 15 0 on | ||
| Ethernet15 15 twentyfivethousandE16 16 0 on | ||
| Ethernet16 18 twentyfivethousandE17 17 0 on | ||
| Ethernet17 17 twentyfivethousandE18 18 0 on | ||
| Ethernet18 20 twentyfivethousandE19 19 0 on | ||
| Ethernet19 19 twentyfivethousandE20 20 0 on | ||
| Ethernet20 22 twentyfivethousandE21 21 0 on | ||
| Ethernet21 21 twentyfivethousandE22 22 0 on | ||
| Ethernet22 24 twentyfivethousandE23 23 0 on | ||
| Ethernet23 23 twentyfivethousandE24 24 0 on | ||
| Ethernet24 26 twentyfivethousandE25 25 0 on | ||
| Ethernet25 25 twentyfivethousandE26 26 0 on | ||
| Ethernet26 28 twentyfivethousandE27 27 0 on | ||
| Ethernet27 27 twentyfivethousandE28 28 0 on | ||
| Ethernet28 30 twentyfivethousandE29 29 0 on | ||
| Ethernet29 29 twentyfivethousandE30 30 0 on | ||
| Ethernet30 32 twentyfivethousandE31 31 0 on | ||
| Ethernet31 31 twentyfivethousandE32 32 0 on | ||
| Ethernet32 34 twentyfivethousandE33 33 0 on | ||
| Ethernet33 33 twentyfivethousandE34 34 0 on | ||
| Ethernet34 36 twentyfivethousandE35 35 0 on | ||
| Ethernet35 35 twentyfivethousandE36 36 0 on | ||
| Ethernet36 51 tenGigE37 37 0 on | ||
| Ethernet37 52 tenGigE38 38 0 on | ||
| Ethernet38 49 tenGigE39 39 0 on | ||
| Ethernet39 50 tenGigE40 40 0 on | ||
| Ethernet40 55 tenGigE41 41 0 on | ||
| Ethernet41 56 tenGigE42 42 0 on | ||
| Ethernet42 53 tenGigE43 43 0 on | ||
| Ethernet43 54 tenGigE44 44 0 on | ||
| Ethernet44 59 tenGigE45 45 0 on | ||
| Ethernet45 60 tenGigE46 46 0 on | ||
| Ethernet46 57 tenGigE47 47 0 on | ||
| Ethernet47 58 tenGigE48 48 0 on | ||
| Ethernet48 67 twentyfiveGigE49 49 25000 off | ||
| Ethernet49 66 twentyfiveGigE50 50 25000 off | ||
| Ethernet50 65 twentyfiveGigE51 51 25000 off | ||
| Ethernet51 68 twentyfiveGigE52 52 25000 off | ||
| Ethernet52 73,74,75,76 hundredGigE53 53 100000 off | ||
| Ethernet56 69,70,71,72 hundredGigE54 54 100000 off |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Accton-AS4630-54NPE t1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| CONSOLE_PORT=0x3f8 | ||
| CONSOLE_DEV=0 | ||
| CONSOLE_SPEED=115200 | ||
| ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="intel_iommu=off modprobe.blacklist=i2c-ismt,i2c_ismt,i2c-i801,i2c_i801" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| broadcom |
14 changes: 14 additions & 0 deletions
14
device/accton/x86_64-accton_as4630_54npe-r0/plugins/eeprom.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #!/usr/bin/env python | ||
|
|
||
| try: | ||
| from sonic_eeprom import eeprom_tlvinfo | ||
| except ImportError as e: | ||
| raise ImportError(str(e) + "- required module not found") | ||
|
|
||
|
|
||
| class board(eeprom_tlvinfo.TlvInfoDecoder): | ||
| _TLV_INFO_MAX_LEN = 256 | ||
|
|
||
| def __init__(self, name, path, cpld_root, ro): | ||
| self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom" | ||
| super(board, self).__init__(self.eeprom_path, 0, '', True) |
60 changes: 60 additions & 0 deletions
60
device/accton/x86_64-accton_as4630_54npe-r0/plugins/psuutil.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| #!/usr/bin/env python | ||
|
|
||
| ############################################################################# | ||
| # Accton | ||
| # | ||
| # Module contains an implementation of SONiC PSU Base API and | ||
| # provides the PSUs status which are available in the platform | ||
| # | ||
| ############################################################################# | ||
|
|
||
| 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""" | ||
|
|
||
| def __init__(self): | ||
| PsuBase.__init__(self) | ||
|
|
||
| self.psu_path = "/sys/bus/i2c/devices/" | ||
| self.psu_presence = "/psu_present" | ||
| self.psu_oper_status = "/psu_power_good" | ||
| self.psu_mapping = { | ||
| 1: "10-0050", | ||
| 2: "11-0051", | ||
| } | ||
|
|
||
| def get_num_psus(self): | ||
| return len(self.psu_mapping) | ||
|
|
||
| def get_psu_status(self, index): | ||
| if index is None: | ||
| return False | ||
|
|
||
| status = 0 | ||
| node = self.psu_path + self.psu_mapping[index] + self.psu_oper_status | ||
| try: | ||
| with open(node, 'r') as power_status: | ||
| status = int(power_status.read()) | ||
| except IOError: | ||
| return False | ||
|
|
||
| return status == 1 | ||
|
|
||
| def get_psu_presence(self, index): | ||
| if index is None: | ||
| return False | ||
|
|
||
| status = 0 | ||
| node = self.psu_path + self.psu_mapping[index] + self.psu_presence | ||
| try: | ||
| with open(node, 'r') as presence_status: | ||
| status = int(presence_status.read()) | ||
| except IOError: | ||
| return False | ||
|
|
||
| return status == 1 |
211 changes: 211 additions & 0 deletions
211
device/accton/x86_64-accton_as4630_54npe-r0/plugins/sfputil.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,211 @@ | ||
| # sfputil.py | ||
| # | ||
| # Platform-specific SFP transceiver interface for SONiC | ||
| # | ||
|
|
||
| try: | ||
| import sys | ||
| import time | ||
| from ctypes import create_string_buffer | ||
| from sonic_sfp.sfputilbase import SfpUtilBase | ||
| except ImportError as e: | ||
| raise ImportError("%s - required module not found" % str(e)) | ||
|
|
||
| SFP_STATUS_INSERTED = '1' | ||
| SFP_STATUS_REMOVED = '0' | ||
|
|
||
|
|
||
| class SfpUtil(SfpUtilBase): | ||
| """Platform-specific SfpUtil class""" | ||
|
|
||
| PORT_START = 49 | ||
| PORT_END = 54 | ||
| PORTS_IN_BLOCK = 54 | ||
| QSFP_START = 53 | ||
|
|
||
| BASE_OOM_PATH = "/sys/bus/i2c/devices/{0}-0050/" | ||
| BASE_CPLD_PATH = "/sys/bus/i2c/devices/3-0060/" | ||
|
|
||
| _port_to_is_present = {} | ||
| _port_to_lp_mode = {} | ||
|
|
||
| _port_to_eeprom_mapping = {} | ||
| _port_to_i2c_mapping = { | ||
| 49: [18], | ||
| 50: [19], | ||
| 51: [20], | ||
| 52: [21], | ||
| 53: [22], | ||
| 54: [23], | ||
| } | ||
|
|
||
| @property | ||
| def port_start(self): | ||
| return self.PORT_START | ||
|
|
||
| @property | ||
| def port_end(self): | ||
| return self.PORT_END | ||
|
|
||
| @property | ||
| def qsfp_ports(self): | ||
| return range(self.QSFP_START, self.PORTS_IN_BLOCK + 1) | ||
|
|
||
| @property | ||
| def port_to_eeprom_mapping(self): | ||
| return self._port_to_eeprom_mapping | ||
|
|
||
| def __init__(self): | ||
| eeprom_path = self.BASE_OOM_PATH + "eeprom" | ||
| for x in range(self.port_start, self.port_end + 1): | ||
| self.port_to_eeprom_mapping[x] = eeprom_path.format( | ||
| self._port_to_i2c_mapping[x][0]) | ||
| SfpUtilBase.__init__(self) | ||
|
|
||
| def get_presence(self, port_num): | ||
| # Check for invalid port_num | ||
| if port_num < self.port_start or port_num > self.port_end: | ||
| return False | ||
|
|
||
| present_path = self.BASE_CPLD_PATH + "module_present_" + str(port_num) | ||
| self.__port_to_is_present = present_path | ||
|
|
||
| try: | ||
| val_file = open(self.__port_to_is_present) | ||
| content = val_file.readline().rstrip() | ||
| val_file.close() | ||
| except IOError as e: | ||
| print("Error: unable to access file: %s" % str(e)) | ||
| return False | ||
|
|
||
| if content == "1": | ||
| return True | ||
|
|
||
| return False | ||
|
|
||
| def get_low_power_mode(self, port_num): | ||
| # Check for invalid port_num | ||
| if port_num < self.QSFP_START or port_num > self.port_end: | ||
| return False | ||
|
|
||
| try: | ||
| eeprom = None | ||
| if not self.get_presence(port_num): | ||
| return False | ||
| eeprom = open(self.port_to_eeprom_mapping[port_num], "rb") | ||
| eeprom.seek(93) | ||
| lpmode = ord(eeprom.read(1)) | ||
|
|
||
| # if "Power override" bit is 1 and "Power set" bit is 1 | ||
| if ((lpmode & 0x3) == 0x3): | ||
| return True | ||
|
|
||
| # High Power Mode if one of the following conditions is matched: | ||
| # 1. "Power override" bit is 0 | ||
| # 2. "Power override" bit is 1 and "Power set" bit is 0 | ||
| else: | ||
| return False | ||
|
|
||
| except IOError as e: | ||
| print("Error: unable to open file: %s" % str(e)) | ||
| return False | ||
| finally: | ||
| if eeprom is not None: | ||
| eeprom.close() | ||
| time.sleep(0.01) | ||
|
|
||
| def set_low_power_mode(self, port_num, lpmode): | ||
| # Check for invalid port_num | ||
| if port_num < self.QSFP_START or port_num > self.port_end: | ||
| return False | ||
|
|
||
| try: | ||
| eeprom = None | ||
| if not self.get_presence(port_num): | ||
| return False # Port is not present, unable to set the eeprom | ||
|
|
||
| # Fill in write buffer | ||
| # 0x3:Low Power Mode, 0x1:High Power Mode | ||
| regval = 0x3 if lpmode else 0x1 | ||
|
|
||
| buffer = create_string_buffer(1) | ||
| buffer[0] = regval | ||
|
|
||
| # Write to eeprom | ||
| eeprom = open(self.port_to_eeprom_mapping[port_num], "r+b") | ||
| eeprom.seek(93) | ||
| eeprom.write(buffer[0]) | ||
| return True | ||
| except IOError as e: | ||
| print("Error: unable to open file: %s" % str(e)) | ||
| return False | ||
| finally: | ||
| if eeprom is not None: | ||
| eeprom.close() | ||
| time.sleep(0.01) | ||
|
|
||
| def reset(self, port_num): | ||
| if not port_num in self.qsfp_ports: | ||
| return False | ||
|
|
||
| path = self.BASE_CPLD_PATH + "module_reset_" + str(port_num) | ||
| self.__port_to_mod_rst = path | ||
| try: | ||
| reg_file = open(self.__port_to_mod_rst, 'r+') | ||
| except IOError as e: | ||
| print("Error: unable to open file: %s" % str(e)) | ||
| return False | ||
|
|
||
| #toggle reset | ||
| reg_file.seek(0) | ||
| reg_file.write('1') | ||
| time.sleep(1) | ||
| reg_file.seek(0) | ||
| reg_file.write('0') | ||
| reg_file.close() | ||
| return True | ||
|
|
||
| @property | ||
| def _get_presence_bitmap(self): | ||
|
|
||
| bits = [] | ||
| for x in range(self.port_start, self.port_end + 1): | ||
| bits.append(str(int(self.get_presence(x)))) | ||
|
|
||
| rev = "".join(bits[::-1]) | ||
| return int(rev, 2) | ||
|
|
||
| data = {'present': 0} | ||
|
|
||
| def get_transceiver_change_event(self, timeout=0): | ||
| port_dict = {} | ||
|
|
||
| if timeout == 0: | ||
| cd_ms = sys.maxsize | ||
| else: | ||
| cd_ms = timeout | ||
|
|
||
| # poll per second | ||
| while cd_ms > 0: | ||
| reg_value = self._get_presence_bitmap | ||
| changed_ports = self.data['present'] ^ reg_value | ||
| if changed_ports != 0: | ||
| break | ||
| time.sleep(1) | ||
| cd_ms = cd_ms - 1000 | ||
|
|
||
| if changed_ports != 0: | ||
| for port in range(self.port_start, self.port_end + 1): | ||
| # Mask off the bit corresponding to our port | ||
| mask = (1 << (port - self.port_start)) | ||
| if changed_ports & mask: | ||
| if (reg_value & mask) == 0: | ||
| port_dict[port] = SFP_STATUS_REMOVED | ||
| else: | ||
| port_dict[port] = SFP_STATUS_INSERTED | ||
|
|
||
| # Update cache | ||
| self.data['present'] = reg_value | ||
| return True, port_dict | ||
| else: | ||
| return True, {} |
4 changes: 4 additions & 0 deletions
4
device/accton/x86_64-accton_as4630_54npe-r0/pmon_daemon_control.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "skip_ledd": true, | ||
| "skip_pcied": true | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # libsensors configuration file for as4630-54npe | ||
| # ------------------------------------------------ | ||
| # | ||
|
|
||
| bus "i2c-3" "i2c-1-mux (chan_id 1)" | ||
| bus "i2c-10" "i2c-2-mux (chan_id 0)" | ||
| bus "i2c-11" "i2c-2-mux (chan_id 1)" | ||
| bus "i2c-14" "i2c-2-mux (chan_id 4)" | ||
| bus "i2c-24" "i2c-3-mux (chan_id 6)" | ||
| bus "i2c-25" "i2c-3-mux (chan_id 7)" | ||
|
|
||
|
|
||
| chip "ype1200am-i2c-*-58" | ||
| label in3 "PSU 1 Voltage" | ||
| label fan1 "PSU 1 Fan" | ||
| label temp1 "PSU 1 Temperature" | ||
| label power2 "PSU 1 Power" | ||
| label curr2 "PSU 1 Current" | ||
|
|
||
| chip "ype1200am-i2c-*-59" | ||
| label in3 "PSU 2 Voltage" | ||
| label fan1 "PSU 2 Fan" | ||
| label temp1 "PSU 2 Temperature" | ||
| label power2 "PSU 2 Power" | ||
| label curr2 "PSU 2 Current" | ||
|
|
||
| chip "as4630_54npe_cpld-*" | ||
| label fan1 "Fan 1" | ||
| label fan2 "Fan 2" | ||
| label fan3 "Fan 3" | ||
|
|
||
|
|
||
| chip "lm77-i2c-*-48" | ||
| label temp1 "Main Board Temperature" | ||
|
|
||
| chip "lm75-i2c-*-4a" | ||
| label temp1 "Fan Board Temperature" | ||
|
|
||
| chip "lm75-i2c-*-4b" | ||
| label temp1 "CPU Board Temperature" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you skip pcied for this platform?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no pcie devices, so we skip this daemon.