Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
@@ -0,0 +1,56 @@
# name lanes alias index speed
Ethernet0 0,1 hundredGigE1 1 100000
Ethernet2 2,3 hundredGigE2 2 100000
Ethernet4 4,5 hundredGigE3 3 100000
Ethernet6 6,7 hundredGigE4 4 100000
Ethernet8 8,9 hundredGigE5 5 100000
Ethernet10 10,11 hundredGigE6 6 100000
Ethernet12 12,13 hundredGigE7 7 100000
Ethernet14 14,15 hundredGigE8 8 100000
Ethernet16 16,17 hundredGigE9 9 100000
Ethernet18 18,19 hundredGigE10 10 100000
Ethernet20 20,21 hundredGigE11 11 100000
Ethernet22 22,23 hundredGigE12 12 100000
Ethernet24 24,25 hundredGigE13 13 100000
Ethernet26 26,27 hundredGigE14 14 100000
Ethernet28 28,29 hundredGigE15 15 100000
Ethernet30 30,31 hundredGigE16 16 100000
Ethernet32 32,33 hundredGigE17 17 100000
Ethernet34 34,35 hundredGigE18 18 100000
Ethernet36 36,37 hundredGigE19 19 100000
Ethernet38 38,39 hundredGigE20 20 100000
Ethernet40 40,41 hundredGigE21 21 100000
Ethernet42 42,43 hundredGigE22 22 100000
Ethernet44 44,45 hundredGigE23 23 100000
Ethernet46 46,47 hundredGigE24 24 100000
Ethernet48 88,89 hundredGigE25 25 100000
Ethernet50 90,91 hundredGigE26 26 100000
Ethernet52 92,93 hundredGigE27 27 100000
Ethernet54 94,95 hundredGigE28 28 100000
Ethernet56 80,81 hundredGigE29 29 100000
Ethernet58 82,83 hundredGigE30 30 100000
Ethernet60 84,85 hundredGigE31 31 100000
Ethernet62 86,87 hundredGigE32 32 100000
Ethernet64 72,73 hundredGigE33 33 100000
Ethernet66 74,75 hundredGigE34 34 100000
Ethernet68 76,77 hundredGigE35 35 100000
Ethernet70 78,79 hundredGigE36 36 100000
Ethernet72 64,65 hundredGigE37 37 100000
Ethernet74 66,67 hundredGigE38 38 100000
Ethernet76 68,69 hundredGigE39 39 100000
Ethernet78 70,71 hundredGigE40 40 100000
Ethernet80 96,97 hundredGigE41 41 100000
Ethernet82 98,99 hundredGigE42 42 100000
Ethernet84 100,101 hundredGigE43 43 100000
Ethernet86 102,103 hundredGigE44 44 100000
Ethernet88 104,105 hundredGigE45 45 100000
Ethernet90 106,107 hundredGigE46 46 100000
Ethernet92 108,109 hundredGigE47 47 100000
Ethernet94 110,111 hundredGigE48 48 100000
Ethernet96 112,113 hundredGigE49 49 100000
Ethernet98 114,115 hundredGigE50 50 100000
Ethernet100 116,117 hundredGigE51 51 100000
Ethernet102 118,119 hundredGigE52 52 100000
Ethernet104 120,121 hundredGigE53 53 100000
Ethernet105 122 twentyfiveGigE54 54 25000
Ethernet106 123 twentyfiveGigE55 55 25000
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions device/accton/x86_64-accton_as7926_40xfb-r0/default_sku
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Accton-AS7926-40XFB t1
3 changes: 3 additions & 0 deletions device/accton/x86_64-accton_as7926_40xfb-r0/installer.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONSOLE_PORT=0x3f8
CONSOLE_DEV=0
CONSOLE_SPEED=115200
20 changes: 20 additions & 0 deletions device/accton/x86_64-accton_as7926_40xfb-r0/plugins/eeprom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env python

try:
import binascii
import time
import optparse
import warnings
import os
import sys
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
import subprocess
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/0-0057/eeprom"
super(board, self).__init__(self.eeprom_path, 0, '', True)
61 changes: 61 additions & 0 deletions device/accton/x86_64-accton_as7926_40xfb-r0/plugins/psuutil.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/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
#
#############################################################################

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"""

def __init__(self):
PsuBase.__init__(self)

self.psu_path = "/sys/devices/platform/as7926_40xfb_psu/psu"
self.psu_presence = "_present"
self.psu_oper_status = "_power_good"
self.psu_mapping = {
1: "1",
2: "2"
}

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
228 changes: 228 additions & 0 deletions device/accton/x86_64-accton_as7926_40xfb-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
# sfputil.py
#
# Platform-specific SFP transceiver interface for SONiC
#

try:
import sys
import time
import string
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 = 1
PORT_END = 55
QSFP_PORT_START = 1
QSFP_PORT_END = 53
CPLD_FMT = '/sys/bus/i2c/devices/{bus}-00{addr}/'

_port_to_eeprom_mapping = {}
_port_to_i2c_mapping = {
1: 33,
2: 34,
3: 37,
4: 38,
5: 41,
6: 42,
7: 45,
8: 46,
9: 49,
10: 50,
11: 53,
12: 54,
13: 57,
14: 58,
15: 61,
16: 62,
17: 65,
18: 66,
19: 69,
20: 70,
21: 35,
22: 36,
23: 39,
24: 40,
25: 43,
26: 44,
27: 47,
28: 48,
29: 51,
30: 52,
31: 55,
32: 56,
33: 59,
34: 60,
35: 63,
36: 64,
37: 67,
38: 68,
39: 71,
40: 72,
41: 93,
42: 84,
43: 83,
44: 82,
45: 81,
46: 86,
47: 85,
48: 88,
49: 87,
50: 90,
51: 89,
52: 92,
53: 91,
54: 30,
55: 31
}

@property
def port_start(self):
return self.PORT_START

@property
def port_end(self):
return self.PORT_END

@property
def qsfp_port_start(self):
return self.QSFP_PORT_START

@property
def qsfp_port_end(self):
return self.QSFP_PORT_END

@property
def qsfp_ports(self):
return range(self.QSFP_PORT_START, self.QSFP_PORT_END + 1)

@property
def port_to_eeprom_mapping(self):
return self._port_to_eeprom_mapping

def __init__(self):
eeprom_path = '/sys/bus/i2c/devices/{0}-0050/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])

SfpUtilBase.__init__(self)

def get_cpld_path(self, port_num):
if ((1 <= port_num <= 10) or (21 <= port_num <= 30) or (54 <= port_num <= 55)):
return self.CPLD_FMT.format(bus=str(12), addr=str(62))
elif ((11 <= port_num <= 20) or (31 <= port_num <= 40)):
return self.CPLD_FMT.format(bus=str(13), addr=str(63))
elif (41 <= port_num <= 53):
return self.CPLD_FMT.format(bus=str(76), addr=str(64))

return str()

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

port_ps = self.get_cpld_path(port_num) + 'module_present_{0}'.format(port_num)

try:
val_file = open(port_ps)
except IOError as e:
print ('Error: unable to open file: ', str(e))
return False

content = val_file.readline().rstrip()
val_file.close()

# content is a string, either "0" or "1"
return content == "1"

def get_low_power_mode(self, port_num):
if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end:
return False

if not self.get_presence(port_num):
return False

try:
eeprom = None

eeprom = open(self.port_to_eeprom_mapping[port_num], mode="rb", buffering=0)
eeprom.seek(93)
lpmode = ord(eeprom.read(1))

if not (lpmode & 0x1): # 'Power override' bit is 0
return False # Default High Power Mode
else:
if ((lpmode & 0x2) == 0x2):
return True # Low Power Mode if "Power set" bit is 1
else:
return False # High Power Mode if "Power set" bit is 0
except IOError as e:
print ('Error: unable to open file: ', 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):
if port_num < self.qsfp_port_start or port_num > self.qsfp_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
regval = 0x3 if lpmode else 0x1 # 0x3:Low Power Mode, 0x1:High Power Mode
buffer = create_string_buffer(1)
if sys.version_info[0] >= 3:
buffer[0] = regval
else:
buffer[0] = chr(regval)

# Write to eeprom
eeprom = open(self.port_to_eeprom_mapping[port_num], mode="r+b", buffering=0)
eeprom.seek(93)
eeprom.write(buffer[0])
return True
except IOError as e:
print ('Error: unable to open file: ', str(e))
return False
finally:
if eeprom is not None:
eeprom.close()
time.sleep(0.01)

def reset(self, port_num):
# Check for invalid port_num
if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end:
return False

port_ps = self.get_cpld_path(port_num) + 'module_reset_{0}'.format(port_num)

try:
reg_file = open(port_ps, mode="w")
except IOError as e:
print ('Error: unable to open file: ', 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"skip_ledd": true,
"skip_thermalctld": true
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__all__ = ['chassis', 'eeprom', 'platform', 'psu', 'sfp', 'thermal', 'fan', 'fan_drawer']
from . import platform
Loading