[FS][arm64] support new boars s5800-48t4s and s5800-48t8s-mars8p (#12994)

Adding platform support for FS s5800-48t4s and s5800-48t8s-mars8p.

Both s5800-48t4s and s5800-48t8s-mars8p have 48 * 10/100/1000 Base-T ports, 4 * 10GE SFP+ Ports on Centec TsingMa.
s5800-48t4s is different from s5800-48t8s-mars8p in that:

The phy chip used by s5800-48t4s is Marvell 88e1680;
The phy chip used by s5800-48t4s-mars8p is Centec ctc21108;
This commit is contained in:
FSSec 2022-12-18 06:48:02 +08:00 committed by GitHub
parent 8788f1cc0f
commit bb09ebe977
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
56 changed files with 4718 additions and 0 deletions

View File

@ -0,0 +1,444 @@
{
"fibers" : [
{
"fiber_flg" : "E_FIBER_SFP",
"mode" : "E_FIBER_ASIC_ASIC",
"cs" : "0 0 0",
"en_mode" : "E_FIBER_EN_SYSFS",
"en" : "sfp_enable",
"sysfs_path" : "/sys/class/sfp/sfp1/",
"sync_fiber_present" : 1
},
{
"fiber_flg" : "E_FIBER_SFP",
"mode" : "E_FIBER_ASIC_ASIC",
"cs" : "0 0 1",
"en_mode" : "E_FIBER_EN_SYSFS",
"en" : "sfp_enable",
"sysfs_path" : "/sys/class/sfp/sfp2/",
"sync_fiber_present" : 1
},
{
"fiber_flg" : "E_FIBER_SFP",
"mode" : "E_FIBER_ASIC_ASIC",
"cs" : "0 0 2",
"en_mode" : "E_FIBER_EN_SYSFS",
"en" : "sfp_enable",
"sysfs_path" : "/sys/class/sfp/sfp3/",
"sync_fiber_present" : 1
},
{
"fiber_flg" : "E_FIBER_SFP",
"mode" : "E_FIBER_ASIC_ASIC",
"cs" : "0 0 3",
"en_mode" : "E_FIBER_EN_SYSFS",
"en" : "sfp_enable",
"sysfs_path" : "/sys/class/sfp/sfp4/",
"sync_fiber_present" : 1
}
],
"macleds" : {
"polarity" : 1,
"maps" : [
{
"port_id" : 14,
"lchip" : 0,
"ctl_id" : 0,
"mode" : "LED_MODE_2_FORCE_OFF",
"fixed" : 0,
"sysfs_path" : "/sys/class/leds/port52/brightness"
},
{
"port_id" : 15,
"lchip" : 0,
"ctl_id" : 0,
"mode" : "LED_MODE_2_FORCE_OFF",
"fixed" : 0,
"sysfs_path" : "/sys/class/leds/port51/brightness"
},
{
"port_id" : 12,
"lchip" : 0,
"ctl_id" : 0,
"mode" : "LED_MODE_2_FORCE_OFF",
"fixed" : 0,
"sysfs_path" : "/sys/class/leds/port50/brightness"
},
{
"port_id" : 13,
"lchip" : 0,
"ctl_id" : 0,
"mode" : "LED_MODE_2_FORCE_OFF",
"fixed" : 0,
"sysfs_path" : "/sys/class/leds/port49/brightness"
}
]
},
"phys" : [
{
"macid" : 1,
"busid" : 0,
"addr" : 1,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 0,
"busid" : 0,
"addr" : 0,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 3,
"busid" : 0,
"addr" : 3,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 2,
"busid" : 0,
"addr" : 2,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 5,
"busid" : 0,
"addr" : 5,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 4,
"busid" : 0,
"addr" : 4,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 7,
"busid" : 0,
"addr" : 7,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 6,
"busid" : 0,
"addr" : 6,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 17,
"busid" : 0,
"addr" : 9,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 16,
"busid" : 0,
"addr" : 8,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 19,
"busid" : 0,
"addr" : 11,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 18,
"busid" : 0,
"addr" : 10,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 21,
"busid" : 0,
"addr" : 13,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 20,
"busid" : 0,
"addr" : 12,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 23,
"busid" : 0,
"addr" : 15,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 22,
"busid" : 0,
"addr" : 14,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 9,
"busid" : 1,
"addr" : 1,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 8,
"busid" : 1,
"addr" : 0,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 11,
"busid" : 1,
"addr" : 3,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 10,
"busid" : 1,
"addr" : 2,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 33,
"busid" : 1,
"addr" : 5,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 32,
"busid" : 1,
"addr" : 4,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 35,
"busid" : 1,
"addr" : 7,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 34,
"busid" : 1,
"addr" : 6,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 37,
"busid" : 1,
"addr" : 9,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 36,
"busid" : 1,
"addr" : 8,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 39,
"busid" : 1,
"addr" : 11,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 38,
"busid" : 1,
"addr" : 10,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 41,
"busid" : 1,
"addr" : 13,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 40,
"busid" : 1,
"addr" : 12,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 43,
"busid" : 1,
"addr" : 15,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 42,
"busid" : 1,
"addr" : 14,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 25,
"busid" : 2,
"addr" : 1,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 24,
"busid" : 2,
"addr" : 0,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 27,
"busid" : 2,
"addr" : 3,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 26,
"busid" : 2,
"addr" : 2,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 49,
"busid" : 2,
"addr" : 5,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 48,
"busid" : 2,
"addr" : 4,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 51,
"busid" : 2,
"addr" : 7,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 50,
"busid" : 2,
"addr" : 6,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 53,
"busid" : 3,
"addr" : 1,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 52,
"busid" : 3,
"addr" : 0,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 55,
"busid" : 3,
"addr" : 3,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 54,
"busid" : 3,
"addr" : 2,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 57,
"busid" : 3,
"addr" : 5,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 56,
"busid" : 3,
"addr" : 4,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 59,
"busid" : 3,
"addr" : 7,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 58,
"busid" : 3,
"addr" : 6,
"base_port" : 0,
"last_port" : 7
}
],
"ffe" : {
"board_material" : "BOARD_MATERIAL_M4",
"config" : [
{
"serdes_id" : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
"is_dac" : 0,
"speed" : [1000, 100, 10],
"mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE",
"cfg" : [0, 100, 15, 0]
},
{
"serdes_id" : [12, 13, 14, 15],
"is_dac" : 0,
"speed" : [10000, 1000],
"mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE",
"cfg" : [2, 92, 15, 0]
},
{
"serdes_id" : [12, 13, 14, 15],
"is_dac" : 1,
"speed" : [10000, 1000],
"mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE",
"cfg" : [8, 174, 0, 0]
}
]
}
}

View File

@ -0,0 +1,131 @@
#----------------- SDK Feature Support --------------
[MPLS_SUPPORT] = 1;
[APS_SUPPORT] = 1;
[OAM_SUPPORT] = 1;
[PTP_SUPPORT] = 0;
[SYNCE_SUPPORT] = 0;
[STACKING_SUPPORT] = 1;
[BPE_SUPPORT] = 0;
[IPFIX_SUPPORT] = 1;
[MONITOR_SUPPORT] = 1;
[OVERLAY_SUPPORT] = 1;
[EFD_SUPPORT] = 1;
[FCOE_SUPPORT] = 0;
[TRILL_SUPPORT] = 0;
[WLAN_SUPPORT] = 1;
[NPM_SUPPORT] = 1;
[DOT1AE_SUPPORT] = 1;
[DTEL_SUPPORT] = 0;
[FDBSYNC_SUPPORT] = 1;
#----------------- Chip Init Parameter --------------
#Local chip number and global chip id
[Local chip_num] = 1
[Local chip0] = 0
[Local chip1] = 1
#Cut through mode 0: Disable; 1:10/40/100G; 2:1/10/100G; 3:1/10/40G; other:Flex, refer to CUT_THROUGH_BITMAP
[CUT_THROUGH_SPEED] = 0
#Flex cut through mode, speed enable by bitmap, refer to ctc_port_speed_t, Notice: 10M/100M/1G treat as the same speed
[CUT_THROUGH_BITMAP] = 0
#Network cpu port
[CPU_NETWORK_PORT_EN] = 0
[CPU_NETWORK_PORT_ID] = 47
#Enable parity error and multi-bit ecc recover
[ECC_RECOVER_EN] = 0
[TCAM_SCAN_EN] = 0
#----------------- KNET Init Parameter --------------
[KNET_EN] = 0
#----------------- RESILIENT HASH Init Parameter --------------
[RESILIENT_HASH_EN] = 0
#----------------- FTM Init Parameter --------------
#0: default; 1: layer3; 2: ipv6
[FTM Profile] = 0
#----------------- Interrupt Init Parameter --------------
#0: pin, 1: msi
[Interrupt_mode] = 1
[IRQ] = 69
#----------------- NextHop Init Parameter --------------
#0: SDK work in pizzbox (single chip system), 1: SDK work in multi-chip system
[Nexthop Edit Mode] = 0
[External Nexthop Number] = 16384
[MPLS Tunnel Number] = 1024
#----------------- L2 Init Parameter --------------
[FDB Hw Learning] = 0
[Logic Port Num] = 1024
#0: 128 instance per port, 1: 64 instance per port, 2: 32 instance per port
[STP MODE] = 0
[MAX_FID_NUM] = 5120
#STEP:Sync fdb count per second
[FDB_SYNC_STEP] = 100
#----------------- Port Init Parameter --------------
[PORT_STATS_ACL_EN] = 0
#----------------- Stats Init Parameter --------------
[STATS_PORT_EN] = 0
[STATS_ECMP_EN] = 0
#----------------- BPE Init Parameter --------------
[BPE_BR_PORT_EXTENDER_EN] = 0
[BPE_BR_UC_MAX_ECID] = 1024
[BPE_BR_MC_MAX_ECID] = 4096
[BPE_BR_PORT_BASE] = 0
#----------------- Ipuc Init Parameter --------------
#0: tcam use prefix 16; 1: tcam use prefix 8
[IPUC_TCAM_PREFIX_8] = 1
#----------------- QoS Init Parameter --------------
#QoS policer number support 1K/2K/4K/8K, default 4K
[QOS_POLICER_NUM] = 4096
#QoS port queue number support 16/8/8 BPE/4 BPE,
#When resrc_profile.cfg exist, queue number valid,
#Default 8 queue mode
#8 queue = 8
#16 queue = 16
#4 queue BPE = 17
#8 queue BPE = 18
[QOS_PORT_QUEUE_NUM] = 8
#QoS port extend queue number support 0/4, default 0
[QOS_PORT_EXT_QUEUE_NUM] = 0
#QoS CPU reason queue number support 128/64/32, default 128
[QOS_CPU_QUEUE_NUM] = 128
[QOS_INGRESS_VLAN_POLICER_NUM] = 0
[QOS_EGRESS_VLAN_POLICER_NUM] = 0
[QOS_POLICER_MERGE_MODE] = 0
#QOS service queue mode, default 0,0:logic scr port + dstport enq 1:service id + dstport enq
[QOS_SERVICE_QUEUE_MODE] = 0
#Global enable logic dst port + dstport enq
[QOS_SERVICE_QUEUE_EGRESS_EN] = 0
#----------------- Stacking Init Parameter --------------
#0: normal mode; 1: spine-leaf mode
[FABRIC MODE] = 0
[STACKING VERSION] = 1
#----------------- SDK&SAI Debug Level Init Parameter --------------
# SDK_DEBUG_TO_SYSLOG should be enable, 1 : enable ; 0 : disable
[SDK_DEBUG_TO_SYSLOG] = 0;
# Level same as SAI_LOG_LEVEL : 0 : debug ; 1 : info ; 2 : notice ; 3 : warning ; 4 : error ; 5 : critical
[DEBUG_LOG_LEVEL_SDK] = 1 ;
[DEBUG_LOG_LEVEL_SAI] = 0;
# CTC_ERROR_RETURN(g_error_on) in SDK to syslog, 1 : enable ; 0 : disable
[DEBUG_SDK_G_ERROR_ON] = 0;
# SDK debug module id (scope from 1 ~47,detail to see sdk_debug_module_t.csv),default all modules
[DEBUG_SDK_MODULE] = 0;
# part of SDK, 1 : enable in part ; 0 : disable in part
[DEBUG_SDK_CTC] = 0;
[DEBUG_SDK_SYS] = 1;

View File

@ -0,0 +1,281 @@
#Generated by 'CTC DataPath Tools' on Thu Aug 12 17:34:17 2021
#Version 1.0, Supported by TsingMa SDK
#SERDES_MODE : 0-NONE, 1-XFI, 2-SGMII, 3-Not Support, 4-QSGMII, 5-XAUI, 6-DXAUI, 7-XLG, 8-CG, 9-SGMII2G5
# 10-USXGMII-S, 11-USXGMII-M2G5, 12-USXGMII-M5G, 13-XXVG, 14-LG, 15-100BASE-FX
#SERDES_RX_POLY: 0-Normal, 1-Inverse
#SERDES_SWITCH : 0-Not Support Dynamic Switch, 1-Support Dynamic Switch
[WLAN_ENABLE] = 1
[DOT1AE_ENABLE] = 1
[CORE_PLLA] = 600
#{
[SERDES_ITEM]
#repeat 32 step 6
[SERDES_ID] = 0
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 1
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 1
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 2
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 1
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 3
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 1
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 4
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 1
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 5
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 1
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 6
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 7
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 1
[SERDES_TX_POLY] = 1
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 8
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 9
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 1
[SERDES_TX_POLY] = 1
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 10
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 1
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 11
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 12
[SERDES_MODE] = 1
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 13
[SERDES_MODE] = 1
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 14
[SERDES_MODE] = 1
[SERDES_RX_POLY] = 1
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 15
[SERDES_MODE] = 1
[SERDES_RX_POLY] = 1
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 16
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 17
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 18
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 19
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 20
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 21
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 22
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 23
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 24
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 25
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 26
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 1
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 1
[SERDES_ID] = 27
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 1
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 1
[SERDES_ID] = 28
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 29
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 1
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 30
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 1
[SERDES_TX_POLY] = 1
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 1
[SERDES_ID] = 31
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 1
[SERDES_TX_POLY] = 1
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 1
#repeat end
#}
#[SERDES_TO_LPORT]
#{
# | QSGMII/USXGMII-M2G5 | USXGMII-M5G | USXGMII-S | 100BASE-FX | SGMII/SGMII2G5/XFI | XAUI/DXAUI | XLG | XXVG | LG | CG
#---------|---------------------|-------------|-----------|------------|--------------------|------------|-----|------|----|---
#serdes 0 |0 /1 /2 /3 |0 /1 |0 |0 |0 |0 |0 |NA |NA |NA
#serdes 1 |4 /5 /6 /7 |4 /5 |1 |1 |1 |0 |0 |NA |NA |NA
#serdes 2 |16/17/18/19 |16/17 |2 |2 |2 |0 |0 |NA |NA |NA
#serdes 3 |20/21/22/23 |20/21 |3 |3 |3 |0 |0 |NA |NA |NA
#serdes 4 |8 /9 /10/11 |8 /9 |8 |8 |8 |8 |8 |NA |NA |NA
#serdes 5 |32/33/34/35 |32/33 |9 |9 |9 |8 |8 |NA |NA |NA
#serdes 6 |36/37/38/39 |36/37 |10 |10 |10 |8 |8 |NA |NA |NA
#serdes 7 |40/41/42/43 |40/41 |11 |11 |11 |8 |8 |NA |NA |NA
#serdes 8 |24/25/26/27 |24/25 |24 |24 |24 |24 |24 |NA |NA |NA
#serdes 9 |48/49/50/51 |48/49 |25 |25 |25 |24 |24 |NA |NA |NA
#serdes 10|52/53/54/55 |52/53 |26 |26 |26 |24 |24 |NA |NA |NA
#serdes 11|56/57/58/59 |56/57 |27 |27 |27 |24 |24 |NA |NA |NA
#serdes 12|NA |NA |NA |12 |12 |12 |12 |NA |NA |NA
#serdes 13|NA |NA |NA |13 |13 |12 |12 |NA |NA |NA
#serdes 14|NA |NA |NA |14 |14 |12 |12 |NA |NA |NA
#serdes 15|NA |NA |NA |15 |15 |12 |12 |NA |NA |NA
#serdes 16|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
#serdes 17|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
#serdes 18|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
#serdes 19|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
#serdes 20|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
#serdes 21|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
#serdes 22|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
#serdes 23|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
#serdes 24|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
#serdes 25|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
#serdes 26|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
#serdes 27|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
#serdes 28|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
#serdes 29|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
#serdes 30|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
#serdes 31|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
#}

View File

@ -0,0 +1,70 @@
{# Default values which will be used if no actual configura available #}
{% set default_cable = '40m' %}
{% set default_ports_num = 54 -%}
{# Port configuration to cable length look-up table #}
{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #}
{# Roles described in the minigraph #}
{% set ports2cable = {
'torrouter_server' : '5m',
'leafrouter_torrouter' : '40m',
'spinerouter_leafrouter' : '300m'
}
%}
{%- macro cable_length(port_name) -%}
{%- set cable_len = [] -%}
{%- for local_port in DEVICE_NEIGHBOR -%}
{%- if local_port == port_name -%}
{%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%}
{%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%}
{%- set neighbor_role = neighbor.type -%}
{%- set roles1 = switch_role + '_' + neighbor_role %}
{%- set roles2 = neighbor_role + '_' + switch_role -%}
{%- set roles1 = roles1 | lower -%}
{%- set roles2 = roles2 | lower -%}
{%- if roles1 in ports2cable -%}
{%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%}
{%- elif roles2 in ports2cable -%}
{%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- if cable_len -%}
{{ cable_len.0 }}
{%- else -%}
{{ default_cable }}
{%- endif -%}
{% endmacro %}
{%- if DEVICE_METADATA is defined %}
{%- set switch_role = DEVICE_METADATA['localhost']['type'] %}
{%- endif -%}
{# Generate list of ports if not defined #}
{% if PORT is not defined %}
{% set PORT = [] %}
{% for port_idx in range(1,default_ports_num+1) %}
{% if PORT.append("Ethernet%d" % (port_idx)) %}{% endif %}
{% endfor %}
{% endif -%}
{% set port_names_list = [] %}
{% for port in PORT %}
{%- if port_names_list.append(port) %}{% endif %}
{% endfor %}
{% set port_names = port_names_list | join(',') -%}
{
"CABLE_LENGTH": {
"AZURE": {
{% for port in PORT %}
{% set cable = cable_length(port) -%}
"{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %}
{% endfor %}
}
}
}

View File

@ -0,0 +1,21 @@
# PG lossless profiles.
# speed cable size xon xoff threshold
1000 5m 34816 18432 16384 0
10000 5m 34816 18432 16384 0
25000 5m 34816 18432 16384 0
40000 5m 34816 18432 16384 0
50000 5m 34816 18432 16384 0
100000 5m 36864 18432 18432 0
1000 40m 36864 18432 18432 0
10000 40m 36864 18432 18432 0
25000 40m 39936 18432 21504 0
40000 40m 41984 18432 23552 0
50000 40m 41984 18432 23552 0
100000 40m 54272 18432 35840 0
1000 300m 49152 18432 30720 0
10000 300m 49152 18432 30720 0
25000 300m 71680 18432 53248 0
40000 300m 94208 18432 75776 0
50000 300m 94208 18432 75776 0
100000 300m 184320 18432 165888 0

View File

@ -0,0 +1,53 @@
# name lanes alias index speed fec
Ethernet0 1 eth-0-1 0 1000 none
Ethernet1 0 eth-0-2 1 1000 none
Ethernet2 3 eth-0-3 2 1000 none
Ethernet3 2 eth-0-4 3 1000 none
Ethernet4 5 eth-0-5 4 1000 none
Ethernet5 4 eth-0-6 5 1000 none
Ethernet6 7 eth-0-7 6 1000 none
Ethernet7 6 eth-0-8 7 1000 none
Ethernet8 17 eth-0-9 8 1000 none
Ethernet9 16 eth-0-10 9 1000 none
Ethernet10 19 eth-0-11 10 1000 none
Ethernet11 18 eth-0-12 11 1000 none
Ethernet12 21 eth-0-13 12 1000 none
Ethernet13 20 eth-0-14 13 1000 none
Ethernet14 23 eth-0-15 14 1000 none
Ethernet15 22 eth-0-16 15 1000 none
Ethernet16 9 eth-0-17 16 1000 none
Ethernet17 8 eth-0-18 17 1000 none
Ethernet18 11 eth-0-19 18 1000 none
Ethernet19 10 eth-0-20 19 1000 none
Ethernet20 33 eth-0-21 20 1000 none
Ethernet21 32 eth-0-22 21 1000 none
Ethernet22 35 eth-0-23 22 1000 none
Ethernet23 34 eth-0-24 23 1000 none
Ethernet24 37 eth-0-25 24 1000 none
Ethernet25 36 eth-0-26 25 1000 none
Ethernet26 39 eth-0-27 26 1000 none
Ethernet27 38 eth-0-28 27 1000 none
Ethernet28 41 eth-0-29 28 1000 none
Ethernet29 40 eth-0-30 29 1000 none
Ethernet30 43 eth-0-31 30 1000 none
Ethernet31 42 eth-0-32 31 1000 none
Ethernet32 25 eth-0-33 32 1000 none
Ethernet33 24 eth-0-34 33 1000 none
Ethernet34 27 eth-0-35 34 1000 none
Ethernet35 26 eth-0-36 35 1000 none
Ethernet36 49 eth-0-37 36 1000 none
Ethernet37 48 eth-0-38 37 1000 none
Ethernet38 51 eth-0-39 38 1000 none
Ethernet39 50 eth-0-40 39 1000 none
Ethernet40 53 eth-0-41 40 1000 none
Ethernet41 52 eth-0-42 41 1000 none
Ethernet42 55 eth-0-43 42 1000 none
Ethernet43 54 eth-0-44 43 1000 none
Ethernet44 57 eth-0-45 44 1000 none
Ethernet45 56 eth-0-46 45 1000 none
Ethernet46 59 eth-0-47 46 1000 none
Ethernet47 58 eth-0-48 47 1000 none
Ethernet48 13 eth-0-49 48 10000 none
Ethernet49 12 eth-0-50 49 10000 none
Ethernet50 15 eth-0-51 50 10000 none
Ethernet51 14 eth-0-52 51 10000 none

View File

@ -0,0 +1 @@
{%- include 'qos_config.j2' %}

View File

@ -0,0 +1,4 @@
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/S5800-48t4s-mars8p-chip-profile.txt
SAI_HW_PORT_PROFILE_ID_CONFIG_FILE=/usr/share/sonic/hwsku/S5800-48t4s-mars8p-datapath.txt
SAI_PLATFORM_CFG_FILE=/usr/share/sonic/hwsku/S5800-48t4s-mars8p-board.json
SAI_PHY_DRIVER_PATH=/usr/lib/phy_drv/E530-48t4x-mars8p

View File

@ -0,0 +1,471 @@
{
"fibers" : [
{
"fiber_flg" : "E_FIBER_SFP",
"mode" : "E_FIBER_ASIC_ASIC",
"cs" : "0 0 0",
"en_mode" : "E_FIBER_EN_SYSFS",
"en" : "sfp_enable",
"sysfs_path" : "/sys/class/sfp/sfp1/",
"sync_fiber_present" : 1
},
{
"fiber_flg" : "E_FIBER_SFP",
"mode" : "E_FIBER_ASIC_ASIC",
"cs" : "0 0 1",
"en_mode" : "E_FIBER_EN_SYSFS",
"en" : "sfp_enable",
"sysfs_path" : "/sys/class/sfp/sfp2/",
"sync_fiber_present" : 1
},
{
"fiber_flg" : "E_FIBER_SFP",
"mode" : "E_FIBER_ASIC_ASIC",
"cs" : "0 0 2",
"en_mode" : "E_FIBER_EN_SYSFS",
"en" : "sfp_enable",
"sysfs_path" : "/sys/class/sfp/sfp3/",
"sync_fiber_present" : 1
},
{
"fiber_flg" : "E_FIBER_SFP",
"mode" : "E_FIBER_ASIC_ASIC",
"cs" : "0 0 3",
"en_mode" : "E_FIBER_EN_SYSFS",
"en" : "sfp_enable",
"sysfs_path" : "/sys/class/sfp/sfp4/",
"sync_fiber_present" : 1
}
],
"macleds" : {
"polarity" : 1,
"maps" : [
{
"port_id" : 14,
"lchip" : 0,
"ctl_id" : 0,
"mode" : "LED_MODE_2_FORCE_OFF",
"fixed" : 0,
"sysfs_path" : "/sys/class/leds/port52/brightness"
},
{
"port_id" : 15,
"lchip" : 0,
"ctl_id" : 0,
"mode" : "LED_MODE_2_FORCE_OFF",
"fixed" : 0,
"sysfs_path" : "/sys/class/leds/port51/brightness"
},
{
"port_id" : 12,
"lchip" : 0,
"ctl_id" : 0,
"mode" : "LED_MODE_2_FORCE_OFF",
"fixed" : 0,
"sysfs_path" : "/sys/class/leds/port50/brightness"
},
{
"port_id" : 13,
"lchip" : 0,
"ctl_id" : 0,
"mode" : "LED_MODE_2_FORCE_OFF",
"fixed" : 0,
"sysfs_path" : "/sys/class/leds/port49/brightness"
}
]
},
"phys" : [
{
"macid" : 1,
"busid" : 0,
"addr" : 1,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 0,
"busid" : 0,
"addr" : 0,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 3,
"busid" : 0,
"addr" : 3,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 2,
"busid" : 0,
"addr" : 2,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 5,
"busid" : 0,
"addr" : 5,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 4,
"busid" : 0,
"addr" : 4,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 7,
"busid" : 0,
"addr" : 7,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 6,
"busid" : 0,
"addr" : 6,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 17,
"busid" : 0,
"addr" : 9,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 16,
"busid" : 0,
"addr" : 8,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 19,
"busid" : 0,
"addr" : 11,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 18,
"busid" : 0,
"addr" : 10,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 21,
"busid" : 0,
"addr" : 13,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 20,
"busid" : 0,
"addr" : 12,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 23,
"busid" : 0,
"addr" : 15,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 22,
"busid" : 0,
"addr" : 14,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 9,
"busid" : 1,
"addr" : 1,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 8,
"busid" : 1,
"addr" : 0,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 11,
"busid" : 1,
"addr" : 3,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 10,
"busid" : 1,
"addr" : 2,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 33,
"busid" : 1,
"addr" : 5,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 32,
"busid" : 1,
"addr" : 4,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 35,
"busid" : 1,
"addr" : 7,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 34,
"busid" : 1,
"addr" : 6,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 37,
"busid" : 1,
"addr" : 9,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 36,
"busid" : 1,
"addr" : 8,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 39,
"busid" : 1,
"addr" : 11,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 38,
"busid" : 1,
"addr" : 10,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 41,
"busid" : 1,
"addr" : 13,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 40,
"busid" : 1,
"addr" : 12,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 43,
"busid" : 1,
"addr" : 15,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 42,
"busid" : 1,
"addr" : 14,
"base_port" : 8,
"last_port" : 15
},
{
"macid" : 25,
"busid" : 2,
"addr" : 1,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 24,
"busid" : 2,
"addr" : 0,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 27,
"busid" : 2,
"addr" : 3,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 26,
"busid" : 2,
"addr" : 2,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 49,
"busid" : 2,
"addr" : 5,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 48,
"busid" : 2,
"addr" : 4,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 51,
"busid" : 2,
"addr" : 7,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 50,
"busid" : 2,
"addr" : 6,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 53,
"busid" : 3,
"addr" : 1,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 52,
"busid" : 3,
"addr" : 0,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 55,
"busid" : 3,
"addr" : 3,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 54,
"busid" : 3,
"addr" : 2,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 57,
"busid" : 3,
"addr" : 5,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 56,
"busid" : 3,
"addr" : 4,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 59,
"busid" : 3,
"addr" : 7,
"base_port" : 0,
"last_port" : 7
},
{
"macid" : 58,
"busid" : 3,
"addr" : 6,
"base_port" : 0,
"last_port" : 7
}
],
"ffe" : {
"board_material" : "BOARD_MATERIAL_M4",
"config" : [
{
"serdes_id" : [12, 13, 14, 15],
"is_dac" : 0,
"speed" : [10000, 1000],
"mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE",
"cfg" : [2, 92, 15, 0]
},
{
"serdes_id" : [12, 13, 14, 15],
"is_dac" : 1,
"speed" : [10000, 1000],
"mode" : "CTC_CHIP_SERDES_FFE_MODE_DEFINE",
"cfg" : [8, 174, 0, 0]
}
]
},
"chip_interrupt" : {
"intr_mode" : 1,
"intr_group_config" : [
{
"group" : 0,
"irq" : 0,
"prio" : 120,
"desc" : "json msi interrupt group",
"interval" : 1000
}
],
"intr_config" : [
{ "group" : 0, "intr" : 0 },
{ "group" : 0, "intr" : 1 },
{ "group" : -1, "intr" : 2 },
{ "group" : 0, "intr" : 3 },
{ "group" : 0, "intr" : 4 },
{ "group" : 0, "intr" : 5 },
{ "group" : 0, "intr" : 6 },
{ "group" : 0, "intr" : 7 },
{ "group" : 0, "intr" : 9 },
{ "group" : 0, "intr" : 10 },
{ "group" : 0, "intr" : 11 },
{ "group" : 0, "intr" : 21 },
{ "group" : 0, "intr" : 17 },
{ "group" : 0, "intr" : 12 },
{ "group" : 0, "intr" : 13 },
{ "group" : 0, "intr" : 14 },
{ "group" : 0, "intr" : 15 },
{ "group" : -1, "intr" : 16 },
{ "group" : 0, "intr" : 20 },
{ "group" : 0, "intr" : 18 },
{ "group" : 0, "intr" : 22 }
]
}
}

View File

@ -0,0 +1,131 @@
#----------------- SDK Feature Support --------------
[MPLS_SUPPORT] = 1;
[APS_SUPPORT] = 1;
[OAM_SUPPORT] = 1;
[PTP_SUPPORT] = 0;
[SYNCE_SUPPORT] = 0;
[STACKING_SUPPORT] = 1;
[BPE_SUPPORT] = 0;
[IPFIX_SUPPORT] = 1;
[MONITOR_SUPPORT] = 1;
[OVERLAY_SUPPORT] = 1;
[EFD_SUPPORT] = 1;
[FCOE_SUPPORT] = 0;
[TRILL_SUPPORT] = 0;
[WLAN_SUPPORT] = 1;
[NPM_SUPPORT] = 1;
[DOT1AE_SUPPORT] = 1;
[DTEL_SUPPORT] = 0;
[FDBSYNC_SUPPORT] = 1;
#----------------- Chip Init Parameter --------------
#Local chip number and global chip id
[Local chip_num] = 1
[Local chip0] = 0
[Local chip1] = 1
#Cut through mode 0: Disable; 1:10/40/100G; 2:1/10/100G; 3:1/10/40G; other:Flex, refer to CUT_THROUGH_BITMAP
[CUT_THROUGH_SPEED] = 0
#Flex cut through mode, speed enable by bitmap, refer to ctc_port_speed_t, Notice: 10M/100M/1G treat as the same speed
[CUT_THROUGH_BITMAP] = 0
#Network cpu port
[CPU_NETWORK_PORT_EN] = 0
[CPU_NETWORK_PORT_ID] = 47
#Enable parity error and multi-bit ecc recover
[ECC_RECOVER_EN] = 0
[TCAM_SCAN_EN] = 0
#----------------- KNET Init Parameter --------------
[KNET_EN] = 0
#----------------- RESILIENT HASH Init Parameter --------------
[RESILIENT_HASH_EN] = 0
#----------------- FTM Init Parameter --------------
#0: not use; 1: default; 2: layer3; 3: ipv6
[FTM Profile] = 0
#----------------- Interrupt Init Parameter --------------
#0: pin, 1: msi
[Interrupt_mode] = 1
[IRQ] = 69
#----------------- NextHop Init Parameter --------------
#0: SDK work in pizzbox (single chip system), 1: SDK work in multi-chip system
[Nexthop Edit Mode] = 0
[External Nexthop Number] = 16384
[MPLS Tunnel Number] = 1024
#----------------- L2 Init Parameter --------------
[FDB Hw Learning] = 0
[Logic Port Num] = 1024
#0: 128 instance per port, 1: 64 instance per port, 2: 32 instance per port
[STP MODE] = 0
[MAX_FID_NUM] = 5120
#STEP:Sync fdb count per second
[FDB_SYNC_STEP] = 100
#----------------- Port Init Parameter --------------
[PORT_STATS_ACL_EN] = 0
#----------------- Stats Init Parameter --------------
[STATS_PORT_EN] = 0
[STATS_ECMP_EN] = 0
#----------------- BPE Init Parameter --------------
[BPE_BR_PORT_EXTENDER_EN] = 0
[BPE_BR_UC_MAX_ECID] = 1024
[BPE_BR_MC_MAX_ECID] = 4096
[BPE_BR_PORT_BASE] = 0
#----------------- Ipuc Init Parameter --------------
#0: tcam use prefix 16; 1: tcam use prefix 8
[IPUC_TCAM_PREFIX_8] = 1
#----------------- QoS Init Parameter --------------
#QoS policer number support 1K/2K/4K/8K, default 4K
[QOS_POLICER_NUM] = 4096
#QoS port queue number support 16/8/8 BPE/4 BPE,
#When resrc_profile.cfg exist, queue number valid,
#Default 8 queue mode
#8 queue = 8
#16 queue = 16
#4 queue BPE = 17
#8 queue BPE = 18
[QOS_PORT_QUEUE_NUM] = 8
#QoS port extend queue number support 0/4, default 0
[QOS_PORT_EXT_QUEUE_NUM] = 0
#QoS CPU reason queue number support 128/64/32, default 128
[QOS_CPU_QUEUE_NUM] = 128
[QOS_INGRESS_VLAN_POLICER_NUM] = 0
[QOS_EGRESS_VLAN_POLICER_NUM] = 0
[QOS_POLICER_MERGE_MODE] = 0
#QOS service queue mode, default 0,0:logic scr port + dstport enq 1:service id + dstport enq
[QOS_SERVICE_QUEUE_MODE] = 0
#Global enable logic dst port + dstport enq
[QOS_SERVICE_QUEUE_EGRESS_EN] = 0
#----------------- Stacking Init Parameter --------------
#0: normal mode; 1: spine-leaf mode
[FABRIC MODE] = 0
[STACKING VERSION] = 1
#----------------- SDK&SAI Debug Level Init Parameter --------------
# SDK_DEBUG_TO_SYSLOG should be enable, 1 : enable ; 0 : disable
[SDK_DEBUG_TO_SYSLOG] = 0;
# Level same as SAI_LOG_LEVEL : 0 : debug ; 1 : info ; 2 : notice ; 3 : warning ; 4 : error ; 5 : critical
[DEBUG_LOG_LEVEL_SDK] = 1 ;
[DEBUG_LOG_LEVEL_SAI] = 0;
# CTC_ERROR_RETURN(g_error_on) in SDK to syslog, 1 : enable ; 0 : disable
[DEBUG_SDK_G_ERROR_ON] = 0;
# SDK debug module id (scope from 1 ~47,detail to see sdk_debug_module_t.csv),default all modules
[DEBUG_SDK_MODULE] = 0;
# part of SDK, 1 : enable in part ; 0 : disable in part
[DEBUG_SDK_CTC] = 0;
[DEBUG_SDK_SYS] = 1;

View File

@ -0,0 +1,281 @@
#Generated by 'CTC DataPath Tools' on Fri Aug 9 14:48:37 2019
#Version 1.0, Supported by TsingMa SDK
#SERDES_MODE : 0-NONE, 1-XFI, 2-SGMII, 3-Not Support, 4-QSGMII, 5-XAUI, 6-DXAUI, 7-XLG, 8-CG, 9-SGMII2G5
# 10-USXGMII-S, 11-USXGMII-M2G5, 12-USXGMII-M5G, 13-XXVG, 14-LG, 15-100BASE-FX
#SERDES_RX_POLY: 0-Normal, 1-Inverse
#SERDES_SWITCH : 0-Not Support Dynamic Switch, 1-Support Dynamic Switch
[WLAN_ENABLE] = 1
[DOT1AE_ENABLE] = 1
[CORE_PLLA] = 600
#{
[SERDES_ITEM]
#repeat 32 step 6
[SERDES_ID] = 0
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 1
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 1
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 2
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 3
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 4
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 1
[SERDES_TX_POLY] = 1
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 5
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 6
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 1
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 7
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 1
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 8
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 9
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 1
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 10
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 1
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 11
[SERDES_MODE] = 4
[SERDES_RX_POLY] = 1
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 0
[SERDES_GROUP] = 0
[SERDES_ID] = 12
[SERDES_MODE] = 1
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 13
[SERDES_MODE] = 1
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 14
[SERDES_MODE] = 1
[SERDES_RX_POLY] = 1
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 15
[SERDES_MODE] = 1
[SERDES_RX_POLY] = 1
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 16
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 17
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 18
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 19
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 20
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 21
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 22
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 23
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 24
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 25
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 26
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 1
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 1
[SERDES_ID] = 27
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 1
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 1
[SERDES_ID] = 28
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 0
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 29
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 1
[SERDES_TX_POLY] = 0
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 0
[SERDES_ID] = 30
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 1
[SERDES_TX_POLY] = 1
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 1
[SERDES_ID] = 31
[SERDES_MODE] = 3
[SERDES_RX_POLY] = 1
[SERDES_TX_POLY] = 1
[SERDES_SWITCH] = 1
[SERDES_GROUP] = 1
#repeat end
#}
[SERDES_TO_LPORT]
#{
| QSGMII/USXGMII-M2G5 | USXGMII-M5G | USXGMII-S | 100BASE-FX | SGMII/SGMII2G5/XFI | XAUI/DXAUI | XLG | XXVG | LG | CG
---------|---------------------|-------------|-----------|------------|--------------------|------------|-----|------|----|---
serdes 0 |0 /1 /2 /3 |0 /1 |0 |0 |0 |0 |0 |NA |NA |NA
serdes 1 |4 /5 /6 /7 |4 /5 |1 |1 |1 |0 |0 |NA |NA |NA
serdes 2 |16/17/18/19 |16/17 |2 |2 |2 |0 |0 |NA |NA |NA
serdes 3 |20/21/22/23 |20/21 |3 |3 |3 |0 |0 |NA |NA |NA
serdes 4 |8 /9 /10/11 |8 /9 |8 |8 |8 |8 |8 |NA |NA |NA
serdes 5 |32/33/34/35 |32/33 |9 |9 |9 |8 |8 |NA |NA |NA
serdes 6 |36/37/38/39 |36/37 |10 |10 |10 |8 |8 |NA |NA |NA
serdes 7 |40/41/42/43 |40/41 |11 |11 |11 |8 |8 |NA |NA |NA
serdes 8 |24/25/26/27 |24/25 |24 |24 |24 |24 |24 |NA |NA |NA
serdes 9 |48/49/50/51 |48/49 |25 |25 |25 |24 |24 |NA |NA |NA
serdes 10|52/53/54/55 |52/53 |26 |26 |26 |24 |24 |NA |NA |NA
serdes 11|56/57/58/59 |NA |NA |NA |NA |NA |NA |NA |NA |NA
serdes 12|NA |NA |NA |12 |12 |12 |12 |NA |NA |NA
serdes 13|NA |NA |NA |13 |13 |12 |12 |NA |NA |NA
serdes 14|NA |NA |NA |14 |14 |12 |12 |NA |NA |NA
serdes 15|NA |NA |NA |15 |15 |12 |12 |NA |NA |NA
serdes 16|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
serdes 17|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
serdes 18|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
serdes 19|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
serdes 20|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
serdes 21|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
serdes 22|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
serdes 23|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
serdes 24|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
serdes 25|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
serdes 26|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
serdes 27|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
serdes 28|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
serdes 29|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
serdes 30|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
serdes 31|NA |NA |NA |NA |NA |NA |NA |NA |NA |NA
#}

View File

@ -0,0 +1,70 @@
{# Default values which will be used if no actual configura available #}
{% set default_cable = '40m' %}
{% set default_ports_num = 54 -%}
{# Port configuration to cable length look-up table #}
{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #}
{# Roles described in the minigraph #}
{% set ports2cable = {
'torrouter_server' : '5m',
'leafrouter_torrouter' : '40m',
'spinerouter_leafrouter' : '300m'
}
%}
{%- macro cable_length(port_name) -%}
{%- set cable_len = [] -%}
{%- for local_port in DEVICE_NEIGHBOR -%}
{%- if local_port == port_name -%}
{%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%}
{%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%}
{%- set neighbor_role = neighbor.type -%}
{%- set roles1 = switch_role + '_' + neighbor_role %}
{%- set roles2 = neighbor_role + '_' + switch_role -%}
{%- set roles1 = roles1 | lower -%}
{%- set roles2 = roles2 | lower -%}
{%- if roles1 in ports2cable -%}
{%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%}
{%- elif roles2 in ports2cable -%}
{%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- if cable_len -%}
{{ cable_len.0 }}
{%- else -%}
{{ default_cable }}
{%- endif -%}
{% endmacro %}
{%- if DEVICE_METADATA is defined %}
{%- set switch_role = DEVICE_METADATA['localhost']['type'] %}
{%- endif -%}
{# Generate list of ports if not defined #}
{% if PORT is not defined %}
{% set PORT = [] %}
{% for port_idx in range(1,default_ports_num+1) %}
{% if PORT.append("Ethernet%d" % (port_idx)) %}{% endif %}
{% endfor %}
{% endif -%}
{% set port_names_list = [] %}
{% for port in PORT %}
{%- if port_names_list.append(port) %}{% endif %}
{% endfor %}
{% set port_names = port_names_list | join(',') -%}
{
"CABLE_LENGTH": {
"AZURE": {
{% for port in PORT %}
{% set cable = cable_length(port) -%}
"{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %}
{% endfor %}
}
}
}

View File

@ -0,0 +1,21 @@
# PG lossless profiles.
# speed cable size xon xoff threshold
1000 5m 34816 18432 16384 0
10000 5m 34816 18432 16384 0
25000 5m 34816 18432 16384 0
40000 5m 34816 18432 16384 0
50000 5m 34816 18432 16384 0
100000 5m 36864 18432 18432 0
1000 40m 36864 18432 18432 0
10000 40m 36864 18432 18432 0
25000 40m 39936 18432 21504 0
40000 40m 41984 18432 23552 0
50000 40m 41984 18432 23552 0
100000 40m 54272 18432 35840 0
1000 300m 49152 18432 30720 0
10000 300m 49152 18432 30720 0
25000 300m 71680 18432 53248 0
40000 300m 94208 18432 75776 0
50000 300m 94208 18432 75776 0
100000 300m 184320 18432 165888 0

View File

@ -0,0 +1,53 @@
# name lanes alias index speed fec
Ethernet0 1 eth-0-1 0 1000 none
Ethernet1 0 eth-0-2 1 1000 none
Ethernet2 3 eth-0-3 2 1000 none
Ethernet3 2 eth-0-4 3 1000 none
Ethernet4 5 eth-0-5 4 1000 none
Ethernet5 4 eth-0-6 5 1000 none
Ethernet6 7 eth-0-7 6 1000 none
Ethernet7 6 eth-0-8 7 1000 none
Ethernet8 17 eth-0-9 8 1000 none
Ethernet9 16 eth-0-10 9 1000 none
Ethernet10 19 eth-0-11 10 1000 none
Ethernet11 18 eth-0-12 11 1000 none
Ethernet12 21 eth-0-13 12 1000 none
Ethernet13 20 eth-0-14 13 1000 none
Ethernet14 23 eth-0-15 14 1000 none
Ethernet15 22 eth-0-16 15 1000 none
Ethernet16 9 eth-0-17 16 1000 none
Ethernet17 8 eth-0-18 17 1000 none
Ethernet18 11 eth-0-19 18 1000 none
Ethernet19 10 eth-0-20 19 1000 none
Ethernet20 33 eth-0-21 20 1000 none
Ethernet21 32 eth-0-22 21 1000 none
Ethernet22 35 eth-0-23 22 1000 none
Ethernet23 34 eth-0-24 23 1000 none
Ethernet24 37 eth-0-25 24 1000 none
Ethernet25 36 eth-0-26 25 1000 none
Ethernet26 39 eth-0-27 26 1000 none
Ethernet27 38 eth-0-28 27 1000 none
Ethernet28 41 eth-0-29 28 1000 none
Ethernet29 40 eth-0-30 29 1000 none
Ethernet30 43 eth-0-31 30 1000 none
Ethernet31 42 eth-0-32 31 1000 none
Ethernet32 25 eth-0-33 32 1000 none
Ethernet33 24 eth-0-34 33 1000 none
Ethernet34 27 eth-0-35 34 1000 none
Ethernet35 26 eth-0-36 35 1000 none
Ethernet36 49 eth-0-37 36 1000 none
Ethernet37 48 eth-0-38 37 1000 none
Ethernet38 51 eth-0-39 38 1000 none
Ethernet39 50 eth-0-40 39 1000 none
Ethernet40 53 eth-0-41 40 1000 none
Ethernet41 52 eth-0-42 41 1000 none
Ethernet42 55 eth-0-43 42 1000 none
Ethernet43 54 eth-0-44 43 1000 none
Ethernet44 57 eth-0-45 44 1000 none
Ethernet45 56 eth-0-46 45 1000 none
Ethernet46 59 eth-0-47 46 1000 none
Ethernet47 58 eth-0-48 47 1000 none
Ethernet48 13 eth-0-49 48 10000 none
Ethernet49 12 eth-0-50 49 10000 none
Ethernet50 15 eth-0-51 50 10000 none
Ethernet51 14 eth-0-52 51 10000 none

View File

@ -0,0 +1 @@
{%- include 'qos_config.j2' %}

View File

@ -0,0 +1,4 @@
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/S5800-48t4s-chip-profile.txt
SAI_HW_PORT_PROFILE_ID_CONFIG_FILE=/usr/share/sonic/hwsku/S5800-48t4s-datapath.txt
SAI_PLATFORM_CFG_FILE=/usr/share/sonic/hwsku/S5800-48t4s-board.json
SAI_PHY_DRIVER_PATH=/usr/lib/phy_drv/E530-48t4x-p

View File

@ -0,0 +1 @@
S5800-48t4s-mars8p l2

View File

@ -0,0 +1,12 @@
# Configuration file generated by pwmconfig, changes will be lost
INTERVAL=10
DEVPATH=hwmon1=devices/platform/soc/soc:fan-ctc5236
DEVNAME=hwmon1=ctc5236fan
FCTEMPS=hwmon1/pwm1=hwmon1/temp1_input hwmon1/pwm2=hwmon1/temp1_input hwmon1/pwm3=hwmon1/temp1_input
FCFANS=hwmon1/pwm1=hwmon1/fan1_input hwmon1/pwm2=hwmon1/fan2_input hwmon1/pwm3=hwmon1/fan3_input
MINTEMP=hwmon1/pwm1=30 hwmon1/pwm2=30 hwmon1/pwm3=30
MAXTEMP=hwmon1/pwm1=90 hwmon1/pwm2=90 hwmon1/pwm3=90
MINSTART=hwmon1/pwm1=12 hwmon1/pwm2=12 hwmon1/pwm3=12
MINSTOP=hwmon1/pwm1=6 hwmon1/pwm2=6 hwmon1/pwm3=6
MINPWM=hwmon1/pwm1=6 hwmon1/pwm2=6 hwmon1/pwm3=6
MAXPWM=hwmon1/pwm1=18 hwmon1/pwm2=18 hwmon1/pwm3=18

View File

@ -0,0 +1 @@
centec

View File

@ -0,0 +1,8 @@
{
"chassis": {
"S5800-48t4s": {
"component": {
}
}
}
}

View File

@ -0,0 +1,13 @@
#!/usr/bin/python
def main():
# reboot the system
with open('/sys/class/gpio/export', 'w') as file:
file.write('502\n')
with open('/sys/class/gpio/gpio502/direction', 'w') as file:
file.write('out\n')
with open('/sys/class/gpio/gpio502/value', 'w') as file:
file.write('1\n')
if __name__ == "__main__":
main()

View File

@ -0,0 +1,22 @@
#!/usr/bin/env python
#############################################################################
# FS S5800-48T4S
#
# Platform and model specific eeprom subclass, inherits from the base class,
# and provides the followings:
# - the eeprom format definition
# - specific encoder/decoder if there is special need
#############################################################################
try:
from sonic_eeprom import eeprom_tlvinfo
except ImportError as e:
raise ImportError (str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/dev/mtd3"
super(board, self).__init__(self.eeprom_path, 0, '', True)

View File

@ -0,0 +1,98 @@
#!/usr/bin/env python
#
# led_control.py
#
# Platform-specific LED control functionality for SONiC
#
try:
from sonic_led.led_control_base import LedControlBase
import syslog
from socket import *
from select import *
except ImportError as e:
raise ImportError(str(e) + " - required module not found")
def DBG_PRINT(str):
syslog.openlog("fs-led")
syslog.syslog(syslog.LOG_INFO, str)
syslog.closelog()
class LedControl(LedControlBase):
"""Platform specific LED control class"""
# Helper method to map SONiC port name to index
def _port_name_to_index(self, port_name):
# Strip "Ethernet" off port name
if not port_name.startswith(self.SONIC_PORT_NAME_PREFIX):
return -1
port_idx = int(port_name[len(self.SONIC_PORT_NAME_PREFIX):])
return port_idx + 1
def _port_state_to_mode(self, port_idx, state):
if state == "up":
return self.LED_MODE_UP[0] if (port_idx < 49) else self.LED_MODE_UP[1]
else:
return self.LED_MODE_DOWN[0] if (port_idx < 49) else self.LED_MODE_DOWN[1]
def _port_led_mode_update(self, port_idx, ledMode):
with open(self.f_led.format("port{}".format(port_idx)), 'w') as led_file:
led_file.write(str(ledMode))
def _initSystemLed(self):
try:
with open(self.f_led.format("system"), 'w') as led_file:
led_file.write("1")
DBG_PRINT("init system led to normal")
with open(self.f_led.format("idn"), 'w') as led_file:
led_file.write("1")
DBG_PRINT("init idn led to off")
except IOError as e:
DBG_PRINT(str(e))
def _initPanelLed(self):
with open(self.f_led.format("port1"), 'r') as led_file:
shouldInit = (int(led_file.read()) == 0)
if shouldInit == True:
for idx in range(1, 53):
defmode = self._port_state_to_mode(idx, "down")
with open(self.f_led.format("port{}".format(idx)), 'w') as led_file:
led_file.write(str(defmode))
DBG_PRINT("init port{} led to mode={}".format(idx, defmode))
def _initDefaultConfig(self):
DBG_PRINT("start init led")
self._initSystemLed()
self._initPanelLed()
DBG_PRINT("init led done")
# Concrete implementation of port_link_state_change() method
def port_link_state_change(self, portname, state):
port_idx = self._port_name_to_index(portname)
ledMode = self._port_state_to_mode(port_idx, state)
with open(self.f_led.format("port{}".format(port_idx)), 'r') as led_file:
saveMode = int(led_file.read())
if ledMode == saveMode:
return
self._port_led_mode_update(port_idx, ledMode)
DBG_PRINT("update {} led mode from {} to {}".format(portname, saveMode, ledMode))
# Constructor
def __init__(self):
self.SONIC_PORT_NAME_PREFIX = "Ethernet"
self.LED_MODE_UP = [2, 11]
self.LED_MODE_DOWN = [1, 7]
self.f_led = "/sys/class/leds/{}/brightness"
self._initDefaultConfig()

View File

@ -0,0 +1,72 @@
#!/usr/bin/env python
#############################################################################
# FS
#
# 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/class/psu/psu{}/"
self.psu_presence = "psu_presence"
self.psu_oper_status = "psu_status"
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
"""
return 2
def get_psu_status(self, index):
"""
Retrieves the oprational status of power supply unit (PSU) defined
by 1-based index <index>
:param index: An integer, 1-based index of the PSU of which to query status
:return: Boolean, True if PSU is operating properly, False if PSU is faulty
"""
if index is None:
return False
status = 0
try:
with open(self.psu_path.format(index) + self.psu_oper_status, 'r') as power_status:
status = int(power_status.read())
except IOError:
return False
return status == 1
def get_psu_presence(self, index):
"""
Retrieves the presence status of power supply unit (PSU) defined
by 1-based index <index>
:param index: An integer, 1-based index of the PSU of which to query status
:return: Boolean, True if PSU is plugged, False if not
"""
if index is None:
return False
status = 0
try:
with open(self.psu_path.format(index) + self.psu_presence, 'r') as presence_status:
status = int(presence_status.read())
except IOError:
return False
return status == 1

View File

@ -0,0 +1,166 @@
#!/usr/bin/env python
# sfputil.py
#
# Platform-specific SFP transceiver interface for SONiC
#
try:
import time
from socket import *
from select import *
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError as e:
raise ImportError("%s - required module not found" % str(e))
def DBG_PRINT(str):
print(str + "\n")
SFP_STATUS_INSERTED = '1'
SFP_STATUS_REMOVED = '0'
class SfpUtil(SfpUtilBase):
"""Platform-specific SfpUtil class"""
@property
def port_start(self):
return self.PORT_START
@property
def port_end(self):
return self.PORT_END
@property
def sfp_base(self):
return self.SFP_BASE
@property
def qsfp_ports(self):
return ()
@property
def port_to_eeprom_mapping(self):
return self.eeprom_mapping
def is_logical_port(self, port_name):
return True
def get_eeprom_data(self, port):
ret = None
port_num = self.get_logical_to_physical(port)[0] + 1
if port_num < self.port_start or port_num > self.port_end:
return ret
if port_num < self.sfp_base:
return ret
try:
with open(self.eeprom_mapping[port_num], 'r') as eeprom_file:
ret = eeprom_file.read()
except IOError as e:
DBG_PRINT(str(e))
return ret
def __init__(self):
self.SONIC_PORT_NAME_PREFIX = "Ethernet"
self.PORT_START = 0
self.PORT_END = 51
self.SFP_BASE = 48
self.PORTS_IN_BLOCK = 52
self.logical = []
self.physical_to_logical = {}
self.logical_to_physical = {}
self.logical_to_asic = {}
self.data = {'valid':0, 'last':0}
self.eeprom_mapping = {}
self.f_sfp_present = "/sys/class/sfp/sfp{}/sfp_presence"
self.f_sfp_enable = "/sys/class/sfp/sfp{}/sfp_enable"
for x in range(self.port_start, self.sfp_base):
self.eeprom_mapping[x] = None
for x in range(self.sfp_base, self.port_end + 1):
self.eeprom_mapping[x] = "/sys/class/sfp/sfp{}/sfp_eeprom".format(x - self.sfp_base + 1)
self.presence = {}
for x in range(self.sfp_base, self.port_end + 1):
self.presence[x] = False;
SfpUtilBase.__init__(self)
for x in range(self.sfp_base, self.port_end + 1):
self.logical.append('Ethernet' + str(x))
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
if port_num < self.sfp_base:
return False
try:
with open(self.f_sfp_present.format(port_num - self.sfp_base + 1), 'r') as sfp_file:
return 1 == int(sfp_file.read())
except IOError as e:
DBG_PRINT(str(e))
return False
def get_low_power_mode(self, port_num):
# Check for invalid port_num
if port_num < self.port_start or port_num > self.port_end:
return False
return False
def set_low_power_mode(self, port_num, lpmode):
# Check for invalid port_num
if port_num < self.port_start or port_num > self.port_end:
return False
return False
def reset(self, port_num):
# Check for invalid port_num
if port_num < self.port_start or port_num > self.port_end:
return False
return False
def read_porttab_mappings(self, porttabfile, asic_inst = 0):
for x in range(self.sfp_base, self.port_end + 1):
self.logical_to_physical['Ethernet' + str(x)] = [x]
self.logical_to_asic['Ethernet' + str(x)] = 0
self.physical_to_logical[x] = ['Ethernet' + str(x)]
def get_transceiver_change_event(self, timeout=2000):
now = time.time()
port_dict = {}
if timeout < 1000:
timeout = 1000
timeout = (timeout) / float(1000) # Convert to secs
if now < (self.data['last'] + timeout) and self.data['valid']:
return True, {}
for x in range(self.sfp_base, self.port_end + 1):
presence = self.get_presence(x)
if presence != self.presence[x]:
self.presence[x] = presence
# index in port_config.ini
if presence:
port_dict[x] = SFP_STATUS_INSERTED
else:
port_dict[x] = SFP_STATUS_REMOVED
if bool(port_dict):
self.data['last'] = now
self.data['valid'] = 1
return True, port_dict
else:
time.sleep(0.5)
return True, {}
def get_transceiver_info_dict(self, port_num):
transceiver_info_dict = SfpUtilBase.get_transceiver_info_dict(self, port_num)
transceiver_info_dict['vendor_rev'] = transceiver_info_dict['hardware_rev']
return transceiver_info_dict

View File

@ -0,0 +1,3 @@
{
}

View File

@ -10,6 +10,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CENTEC_E530_48T4X_P_PLATFORM_MODULE)
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CENTEC_E530_24X2C_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CENTEC_E530_24X2C_PLATFORM_MODULE)
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CENTEC_E530_48S4X_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CENTEC_E530_48S4X_PLATFORM_MODULE)
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CENTEC_E530_24X2Q_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CENTEC_E530_24X2Q_PLATFORM_MODULE)
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(FS_S5800_48T4S_PLATFORM_MODULE)
ifeq ($(INSTALL_DEBUG_TOOLS),y) ifeq ($(INSTALL_DEBUG_TOOLS),y)
$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_DBG_IMAGES) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_DBG_IMAGES)

View File

@ -0,0 +1,12 @@
# fs s5800_48t4s Platform modules
FS_S5800_48T4S_PLATFORM_MODULE_VERSION =1.0
export FS_S5800_48T4S_PLATFORM_MODULE_VERSION
FS_S5800_48T4S_PLATFORM_MODULE = platform-modules-s5800-48t4s_$(FS_S5800_48T4S_PLATFORM_MODULE_VERSION)_arm64.deb
$(FS_S5800_48T4S_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-fs
$(FS_S5800_48T4S_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
$(FS_S5800_48T4S_PLATFORM_MODULE)_PLATFORM = arm64-fs_s5800_48t4s-r0
SONIC_DPKG_DEBS += $(FS_S5800_48T4S_PLATFORM_MODULE)

View File

@ -6,6 +6,7 @@ include $(PLATFORM_PATH)/one-image.mk
include $(PLATFORM_PATH)/libsaithrift-dev.mk include $(PLATFORM_PATH)/libsaithrift-dev.mk
include $(PLATFORM_PATH)/tsingma-bsp.mk include $(PLATFORM_PATH)/tsingma-bsp.mk
include $(PLATFORM_PATH)/platform-modules-centec-e530.mk include $(PLATFORM_PATH)/platform-modules-centec-e530.mk
include $(PLATFORM_PATH)/platform-modules-fs.mk
SONIC_ALL += $(SONIC_ONE_IMAGE) \ SONIC_ALL += $(SONIC_ONE_IMAGE) \
$(DOCKER_FPM) $(DOCKER_FPM)

View File

@ -0,0 +1,3 @@
KBUILD_EXTRA_SYMBOLS = /sonic/platform/centec-arm64/sonic-platform-modules-fs/pca954x/Module.symvers
obj-m := fs_s5800_48t4s_platform.o

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
[Unit]
Description=FS modules init
After=local-fs.target
Before=syncd.service
[Service]
Type=oneshot
ExecStart=-/etc/init.d/platform-modules-s5800-48t4s start
ExecStop=-/etc/init.d/platform-modules-s5800-48t4s stop
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,15 @@
#!/usr/bin/env python
import os
from setuptools import setup
os.listdir
setup(
name='sonic_platform',
version='1.0',
description='Module to initialize fs s5800-48t4s platforms',
packages=['sonic_platform'],
package_dir={'sonic_platform': 'sonic_platform'},
)

View File

@ -0,0 +1,3 @@
__all__ = ["platform", "chassis", "sfp", "eeprom", "psu", "thermal", "fan", "fan_drawer", "led"]
from . import platform

View File

@ -0,0 +1,242 @@
#!/usr/bin/env python
#
# Name: chassis.py, version: 1.0
#
# Description: Module contains the definitions of SONiC platform APIs
#
try:
import os
import re
import time
from sonic_platform_base.chassis_base import ChassisBase
from sonic_platform.eeprom import Eeprom
from sonic_platform.fan_drawer import FanDrawer
from sonic_platform.thermal import Thermal
from sonic_platform.sfp import Sfp
from sonic_platform.psu import Psu
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
NUM_FAN_TRAY = 1
NUM_THERMAL = 1
NUM_PORT = 52
NUM_PSU = 2
REBOOT_CAUSE_DIR = "/host/reboot-cause/"
REBOOT_CAUSE_FILE = os.path.join(REBOOT_CAUSE_DIR, "reboot-cause.txt")
class Chassis(ChassisBase):
# System status LED
_led = None
def __init__(self):
ChassisBase.__init__(self)
self.sfp_presence = {}
# Initialize EEPROM
self._eeprom = Eeprom()
# Initialize FAN
for i in range(NUM_FAN_TRAY):
fandrawer = FanDrawer(i)
self._fan_drawer_list.append(fandrawer)
self._fan_list.extend(fandrawer._fan_list)
# Initialize THERMAL
for index in range(0, NUM_THERMAL):
thermal = Thermal(index)
self._thermal_list.append(thermal)
# Initialize SFP
for index in range(0, NUM_PORT):
sfp = Sfp(index)
self._sfp_list.append(sfp)
self.sfp_presence[int(index)] = False
# Initialize PSU
for index in range(0, NUM_PSU):
psu = Psu(index + 1)
self._psu_list.append(psu)
##############################################
# Device methods
##############################################
def get_name(self):
"""
Retrieves the name of the chassis
Returns:
string: The name of the chassis
"""
return self._eeprom.modelstr()
def get_presence(self):
"""
Retrieves the presence of the chassis
Returns:
bool: True if chassis is present, False if not
"""
return True
def get_model(self):
"""
Retrieves the model number (or part number) of the chassis
Returns:
string: Model/part number of chassis
"""
return self._eeprom.part_number_str()
def get_serial(self):
"""
Retrieves the serial number of the chassis
Returns:
string: Serial number of chassis
"""
return self._eeprom.serial_number_str()
def get_status(self):
"""
Retrieves the operational status of the chassis
Returns:
bool: A boolean value, True if chassis is operating properly
False if not
"""
return True
##############################################
# Chassis methods
##############################################
def get_base_mac(self):
"""
Retrieves the base MAC address for the chassis
Returns:
A string containing the MAC address in the format
'XX:XX:XX:XX:XX:XX'
"""
return self._eeprom.base_mac_addr()
def get_serial_number(self):
"""
Retrieves the hardware serial number for the chassis
Returns:
A string containing the hardware serial number for this chassis.
"""
return self._eeprom.serial_number_str()
def get_system_eeprom_info(self):
"""
Retrieves the full content of system EEPROM information for the chassis
Returns:
A dictionary where keys are the type code defined in
OCP ONIE TlvInfo EEPROM format and values are their corresponding
values.
Ex. { '0x21':'AG9064', '0x22':'V1.0', '0x23':'AG9064-0109867821',
'0x24':'001c0f000fcd0a', '0x25':'02/03/2018 16:22:00',
'0x26':'01', '0x27':'REV01', '0x28':'AG9064-C2358-16G'}
"""
return self._eeprom.system_eeprom_info()
def get_reboot_cause(self):
"""
Retrieves the cause of the previous reboot
Returns:
A tuple (string, string) where the first element is a string
containing the cause of the previous reboot. This string must be
one of the predefined strings in this class. If the first string
is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used
to pass a description of the reboot cause.
"""
if os.path.exists(REBOOT_CAUSE_FILE):
with open(REBOOT_CAUSE_FILE) as reboot_cause_file:
reboot_cause = reboot_cause_file.readline()
if re.search(r'User issued', reboot_cause) is None:
return (self.REBOOT_CAUSE_POWER_LOSS, None)
else:
return (self.REBOOT_CAUSE_NON_HARDWARE, None)
else:
return (self.REBOOT_CAUSE_POWER_LOSS, None)
def get_change_event(self, timeout=2000):
"""
Returns a nested dictionary containing all devices which have
experienced a change at chassis level
Args:
timeout: Timeout in milliseconds (optional). If timeout == 0,
this method will block until a change is detected.
Returns:
(bool, dict):
- True if call successful, False if not;
- A nested dictionary where key is a device type,
value is a dictionary with key:value pairs in the
format of {'device_id':'device_event'},
where device_id is the device ID for this device and
device_event,
status='1' represents device inserted,
status='0' represents device removed.
Ex. {'fan':{'0':'0', '2':'1'}, 'sfp':{'11':'0'}}
indicates that fan 0 has been removed, fan 2
has been inserted and sfp 11 has been removed.
"""
SFP_STATUS_INSERTED = '1'
SFP_STATUS_REMOVED = '0'
old = time.time()
timeout = (timeout) / float(1000) # Convert to secs
port_dict = {}
while time.time() - old < timeout or timeout == 0:
for sfp in self._sfp_list:
sfp_presence = sfp.get_presence()
if sfp_presence != self.sfp_presence[sfp._index]:
self.sfp_presence[sfp._index] = sfp_presence
if sfp_presence:
port_dict[sfp._index] = SFP_STATUS_INSERTED
else:
port_dict[sfp._index] = SFP_STATUS_REMOVED
if not bool(port_dict):
time.sleep(0.5)
else:
break
ret_dict = {'sfp': port_dict}
return True, ret_dict
def get_num_psus(self):
return len(self._psu_list)
def get_psu(self, psu_index):
return self._psu_list[psu_index]
def initizalize_system_led(self):
from .led import SystemLed
Chassis._led = SystemLed()
def set_status_led(self, color):
"""
Sets the state of the system LED
Args:
color: A string representing the color with which to set the
system LED
Returns:
bool: True if system LED state is set successfully, False if not
"""
return False if not Chassis._led else Chassis._led.set_status(color)
def get_status_led(self):
"""
Gets the state of the system LED
Returns:
A string, one of the valid LED color strings which could be vendor
specified.
"""
return None if not Chassis._led else Chassis._led.get_status()

View File

@ -0,0 +1,111 @@
#!/usr/bin/env python
#
# Name: eeprom.py, version: 1.0
#
# Description: Module contains the definitions of SONiC platform APIs
#
try:
from sonic_eeprom import eeprom_tlvinfo
import binascii
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class Eeprom(eeprom_tlvinfo.TlvInfoDecoder):
def __init__(self):
self.__eeprom_path = "/dev/mtd3"
super(Eeprom, self).__init__(self.__eeprom_path, 0, '', True)
self.__eeprom_tlv_dict = dict()
try:
self.open_eeprom()
self.__eeprom_data = self.read_eeprom()
except:
self.__eeprom_data = "N/A"
raise RuntimeError("Eeprom is not Programmed")
else:
eeprom = self.__eeprom_data
if not self.is_valid_tlvinfo_header(eeprom):
return
total_length = (eeprom[9] << 8) | eeprom[10]
tlv_index = self._TLV_INFO_HDR_LEN
tlv_end = self._TLV_INFO_HDR_LEN + total_length
while (tlv_index + 2) < len(eeprom) and tlv_index < tlv_end:
if not self.is_valid_tlv(eeprom[tlv_index:]):
break
tlv = eeprom[tlv_index:tlv_index + 2
+ eeprom[tlv_index + 1]]
code = "0x%02X" % (tlv[0])
if tlv[0] == self._TLV_CODE_VENDOR_EXT:
value = str((tlv[2] << 24) | (tlv[3] << 16) |
(tlv[4] << 8) | tlv[5])
value += str(tlv[6:6 + tlv[1]])
else:
name, value = self.decoder(None, tlv)
self.__eeprom_tlv_dict[code] = value
if eeprom[tlv_index] == self._TLV_CODE_CRC_32:
break
tlv_index += eeprom[tlv_index+1] + 2
def serial_number_str(self):
(is_valid, results) = self.get_tlv_field(
self.__eeprom_data, self._TLV_CODE_SERIAL_NUMBER)
if not is_valid:
return "N/A"
return results[2].decode('ascii')
def base_mac_addr(self):
(is_valid, t) = self.get_tlv_field(
self.__eeprom_data, self._TLV_CODE_MAC_BASE)
if not is_valid or t[1] != 6:
return super(TlvInfoDecoder, self).switchaddrstr(e)
return ":".join([binascii.b2a_hex(T) for T in t[2]])
def modelstr(self):
(is_valid, results) = self.get_tlv_field(
self.__eeprom_data, self._TLV_CODE_PRODUCT_NAME)
if not is_valid:
return "N/A"
return results[2].decode('ascii')
def part_number_str(self):
(is_valid, results) = self.get_tlv_field(
self.__eeprom_data, self._TLV_CODE_PART_NUMBER)
if not is_valid:
return "N/A"
return results[2].decode('ascii')
def serial_tag_str(self):
(is_valid, results) = self.get_tlv_field(
self.__eeprom_data, self._TLV_CODE_SERVICE_TAG)
if not is_valid:
return "N/A"
return results[2].decode('ascii')
def revision_str(self):
(is_valid, results) = self.get_tlv_field(
self.__eeprom_data, self._TLV_CODE_DEVICE_VERSION)
if not is_valid:
return "N/A"
return results[2].decode('ascii')
def system_eeprom_info(self):
"""
Returns a dictionary, where keys are the type code defined in
ONIE EEPROM format and values are their corresponding values
found in the system EEPROM.
"""
return self.__eeprom_tlv_dict

View File

@ -0,0 +1,186 @@
#!/usr/bin/env python
#############################################################################
# Celestica
#
# Module contains an implementation of SONiC Platform Base API and
# provides the fan status which are available in the platform
#
#############################################################################
import math
import os.path
try:
from sonic_platform_base.fan_base import FanBase
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
FAN_PATH = "/sys/class/hwmon/hwmon1/"
FAN_MAX_PWM = 255
FAN_FAN_PWM = "pwm{}"
FAN_FAN_INPUT = "fan{}_input"
FAN_MAX_RPM = 9000
FAN_NAME_LIST = ["FAN-1", "FAN-2", "FAN-3", "FAN-4"]
class Fan(FanBase):
"""Platform-specific Fan class"""
def __init__(self, fan_tray_index, fan_index=0):
self.fan_index = fan_index
self.fan_tray_index = fan_tray_index
FanBase.__init__(self)
def __read_txt_file(self, file_path):
try:
with open(file_path, 'r') as fd:
data = fd.read()
return data.strip()
except IOError:
pass
return ""
def __write_txt_file(self, file_path, value):
try:
with open(file_path, 'w') as fd:
fd.write(str(value))
except IOError:
return False
return True
def __search_file_by_name(self, directory, file_name):
for dirpath, dirnames, files in os.walk(directory):
for name in files:
file_path = os.path.join(dirpath, name)
if name in file_name:
return file_path
return None
def get_direction(self):
"""
Retrieves the direction of fan
Returns:
A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST
depending on fan direction
"""
direction = self.FAN_DIRECTION_EXHAUST
return direction
def get_speed(self):
"""
Retrieves the speed of fan as a percentage of full speed
Returns:
An integer, the percentage of full fan speed, in the range 0 (off)
to 100 (full speed)
Note:
speed = pwm_in/255*100
"""
speed = 0
fan_speed_sysfs_name = "fan{}_input".format(self.fan_index+1)
fan_speed_sysfs_path = self.__search_file_by_name(
FAN_PATH, fan_speed_sysfs_name)
fan_speed_rpm = self.__read_txt_file(fan_speed_sysfs_path) or 0
speed = math.ceil(float(fan_speed_rpm) * 100 / FAN_MAX_RPM)
return int(speed)
def get_target_speed(self):
"""
Retrieves the target (expected) speed of the fan
Returns:
An integer, the percentage of full fan speed, in the range 0 (off)
to 100 (full speed)
Note:
speed_pc = pwm_target/255*100
0 : when PWM mode is use
pwm : when pwm mode is not use
"""
# target = 0
# fan_target_sysfs_name = "pwm{}".format(self.fan_index+1)
# fan_target_sysfs_path = self.__search_file_by_name(
# FAN_PATH, fan_target_sysfs_name)
# fan_target_pwm = self.__read_txt_file(fan_target_sysfs_path) or 0
# target = math.ceil(float(fan_target_pwm) * 100 / FAN_MAX_PWM)
# return target
speed = 0
fan_speed_sysfs_name = "fan{}_input".format(self.fan_index+1)
fan_speed_sysfs_path = self.__search_file_by_name(
FAN_PATH, fan_speed_sysfs_name)
fan_speed_rpm = self.__read_txt_file(fan_speed_sysfs_path) or 0
speed = math.ceil(float(fan_speed_rpm) * 100 / FAN_MAX_RPM)
return speed
def get_speed_tolerance(self):
"""
Retrieves the speed tolerance of the fan
Returns:
An integer, the percentage of variance from target speed which is
considered tolerable
"""
return 10
def set_speed(self, speed):
"""
Sets the fan speed
Args:
speed: An integer, the percentage of full fan speed to set fan to,
in the range 0 (off) to 100 (full speed)
Returns:
A boolean, True if speed is set successfully, False if not
Note:
Depends on pwm or target mode is selected:
1) pwm = speed_pc * 255 <-- Currently use this mode.
2) target_pwm = speed_pc * 100 / 255
2.1) set pwm{}_enable to 3
"""
pwm = speed * 255 / 100
fan_target_sysfs_name = "pwm{}".format(self.fan_index+1)
fan_target_sysfs_path = self.__search_file_by_name(
FAN_PATH, fan_target_sysfs_name)
return self.__write_txt_file(fan_target_sysfs_path, int(pwm))
def set_status_led(self, color):
"""
Sets the state of the fan module status LED
Args:
color: A string representing the color with which to set the
fan module status LED
Returns:
bool: always True
"""
return True
def get_name(self):
"""
Retrieves the name of the device
Returns:
string: The name of the device
"""
fan_name = FAN_NAME_LIST[self.fan_index]
return fan_name
def get_presence(self):
"""
Retrieves the presence of the FAN
Returns:
bool: always True
"""
return True
def get_status(self):
"""
Retrieves the status of the FAN
Returns:
bool: always True
"""
return True

View File

@ -0,0 +1,36 @@
#!/usr/bin/env python
########################################################################
# FS S5800 48t4s
#
# Module contains an implementation of SONiC Platform Base API and
# provides the Fan-Drawers' information available in the platform.
#
########################################################################
try:
from sonic_platform_base.fan_drawer_base import FanDrawerBase
from sonic_platform.fan import Fan
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
FS_FANS_PER_FANTRAY = 3
class FanDrawer(FanDrawerBase):
"""FS S5800 48t4s Platform-specific Fan class"""
def __init__(self, fantray_index):
FanDrawerBase.__init__(self)
self.fantrayindex = fantray_index
for i in range(FS_FANS_PER_FANTRAY):
self._fan_list.append(Fan(fantray_index, i))
def get_name(self):
"""
Retrieves the fan drawer name
Returns:
string: The name of the device
"""
return "FanTray{}".format(self.fantrayindex)

View File

@ -0,0 +1,42 @@
#!/usr/bin/env python
#############################################################################
#
# Module contains an implementation of SONiC Platform Base API and
# provides the led status which are available in the platform
#
#############################################################################
class SystemLed(object):
STATUS_LED_COLOR_GREEN = 'green'
STATUS_LED_COLOR_ORANGE = 'orange'
STATUS_LED_COLOR_OFF = 'off'
SYSTEM_LED_PATH = '/sys/class/leds/system/brightness'
def set_status(self, color):
status = False
if color == SystemLed.STATUS_LED_COLOR_GREEN:
with open(SystemLed.SYSTEM_LED_PATH, 'w') as led:
led.write('1')
status = True
elif color == SystemLed.STATUS_LED_COLOR_OFF:
with open(SystemLed.SYSTEM_LED_PATH, 'w') as led:
led.write('3')
status = True
elif color == SystemLed.STATUS_LED_COLOR_ORANGE:
with open(SystemLed.SYSTEM_LED_PATH, 'w') as led:
led.write('2')
status = True
return status
def get_status(self):
with open(SystemLed.SYSTEM_LED_PATH, 'r') as led:
if led.read().rstrip('\n') == '1':
return SystemLed.STATUS_LED_COLOR_GREEN
elif led.read().rstrip('\n') == '3':
return SystemLed.STATUS_LED_COLOR_OFF
else:
return SystemLed.STATUS_LED_COLOR_ORANGE

View File

@ -0,0 +1,21 @@
#!/usr/bin/env python
#
# Name: platform.py, version: 1.0
#
# Description: Module contains the definitions of SONiC platform APIs for FS S5800-48t4s
#
try:
from sonic_platform_base.platform_base import PlatformBase
from sonic_platform.chassis import Chassis
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class Platform(PlatformBase):
def __init__(self):
PlatformBase.__init__(self)
self._chassis = Chassis()

View File

@ -0,0 +1,46 @@
#!/usr/bin/env python
from __future__ import print_function
import imp
import os
try:
from sonic_platform_base.psu_base import PsuBase
from sonic_py_common import device_info
except ImportError as e:
raise ImportError("%s - required module not found" % e)
USR_SHARE_SONIC_PATH = "/usr/share/sonic"
HOST_DEVICE_PATH = USR_SHARE_SONIC_PATH + "/device"
CONTAINER_PLATFORM_PATH = USR_SHARE_SONIC_PATH + "/platform"
class Psu(PsuBase):
"""FS Platform-specific PSU class"""
def __init__(self, index):
self._index = index
self._fan_list = []
PsuBase.__init__(self)
if os.path.isdir(CONTAINER_PLATFORM_PATH):
platform_path = CONTAINER_PLATFORM_PATH
else:
platform = device_info.get_platform()
if platform is None:
return
platform_path = os.path.join(HOST_DEVICE_PATH, platform)
module_file = "/".join([platform_path, "plugins", "psuutil.py"])
module = imp.load_source("psuutil", module_file)
psu_util_class = getattr(module, "PsuUtil")
self._psuutil = psu_util_class()
def _get_psuutil(self):
return self._psuutil
def get_presence(self):
return self._get_psuutil().get_psu_presence(self._index)
def get_powergood_status(self):
return self._get_psuutil().get_psu_status(self._index)

View File

@ -0,0 +1,103 @@
#!/usr/bin/env python
from __future__ import print_function
import imp
import os
try:
from sonic_platform_base.sfp_base import SfpBase
from sonic_py_common import device_info
except ImportError as e:
raise ImportError("%s - required module not found" % e)
USR_SHARE_SONIC_PATH = "/usr/share/sonic"
HOST_DEVICE_PATH = USR_SHARE_SONIC_PATH + "/device"
CONTAINER_PLATFORM_PATH = USR_SHARE_SONIC_PATH + "/platform"
class Sfp(SfpBase):
"""
Platform-specific sfp class
Unimplemented methods:
- get_model
- get_serial
- get_status
- get_transceiver_info
- get_transceiver_bulk_status
- get_transceiver_threshold_info
- get_reset_status
- get_rx_los
- get_tx_fault
- get_tx_disable_channel
- get_power_override
- get_temperature
- get_voltage
- get_tx_bias
- get_rx_power
- get_tx_power
- tx_disable_channel
- set_power_override
"""
def __init__(self, index):
self._index = index
SfpBase.__init__(self)
if os.path.isdir(CONTAINER_PLATFORM_PATH):
platform_path = CONTAINER_PLATFORM_PATH
else:
platform = device_info.get_platform()
if platform is None:
return
platform_path = os.path.join(HOST_DEVICE_PATH, platform)
module_file = "/".join([platform_path, "plugins", "sfputil.py"])
module = imp.load_source("sfputil", module_file)
sfp_util_class = getattr(module, "SfpUtil")
self._sfputil = sfp_util_class()
def get_id(self):
return self._index
def get_name(self):
return "Ethernet{}".format(self._index)
def get_lpmode(self):
return False
def set_lpmode(self, lpmode):
return False
def get_tx_disable(self):
return False
def tx_disable(self, tx_disable):
return False
def reset(self):
pass
def clear_interrupt(self):
return False
def get_interrupt_file(self):
return None
def _get_sfputil(self):
return self._sfputil
def get_presence(self):
return self._get_sfputil().get_presence(self._index)
def get_transceiver_info(self):
return self._get_sfputil().get_transceiver_info_dict(self._index)
def get_transceiver_bulk_status(self):
return self._get_sfputil().get_transceiver_dom_info_dict(self._index)
def get_transceiver_threshold_info(self):
return self._get_sfputil().get_transceiver_dom_threshold_info_dict(self._index)
def get_transceiver_change_event(self, timeout):
return self._get_sfputil().get_transceiver_change_event(timeout)

View File

@ -0,0 +1,118 @@
#!/usr/bin/env python
#############################################################################
# Celestica
#
# Thermal contains an implementation of SONiC Platform Base API and
# provides the thermal device status which are available in the platform
#
#############################################################################
import os
import os.path
try:
from sonic_platform_base.thermal_base import ThermalBase
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class Thermal(ThermalBase):
"""Platform-specific Thermal class"""
THERMAL_NAME_LIST = []
CPUBOARD_SS_PATH = "/sys/class/hwmon/hwmon1"
def __init__(self, thermal_index):
self.index = thermal_index
self.high_threshold = float(112)
# Add thermal name
self.THERMAL_NAME_LIST.append("ASIC")
# Set hwmon path
self.ss_index, self.hwmon_path = 1, self.CPUBOARD_SS_PATH
self.ss_key = self.THERMAL_NAME_LIST[self.index - 1]
def __read_txt_file(self, file_path):
try:
with open(file_path, 'r') as fd:
data = fd.read()
return data.strip()
except IOError:
raise IOError("Unable to open %s file !" % file_path)
def __get_temp(self, temp_file):
temp_file_path = os.path.join(self.hwmon_path, temp_file)
raw_temp = self.__read_txt_file(temp_file_path)
temp = float(raw_temp)/1000
return float("{:.3f}".format(temp))
def __set_threshold(self, file_name, temperature):
temp_file_path = os.path.join(self.hwmon_path, file_name)
try:
with open(temp_file_path, 'w') as fd:
fd.write(str(temperature))
return True
except IOError:
return False
def get_temperature(self):
"""
Retrieves current temperature reading from thermal
Returns:
A float number of current temperature in Celsius up to nearest thousandth
of one degree Celsius, e.g. 30.125
"""
temp_file = "temp{}_input".format(self.ss_index)
return self.__get_temp(temp_file)
def get_high_threshold(self):
"""
Retrieves the high threshold temperature of thermal
Returns:
A float number, the high threshold temperature of thermal in Celsius
up to nearest thousandth of one degree Celsius, e.g. 30.125
"""
return self.high_threshold
def set_high_threshold(self, temperature):
"""
Sets the high threshold temperature of thermal
Args :
temperature: A float number up to nearest thousandth of one degree Celsius,
e.g. 30.125
Returns:
A boolean, True if threshold is set successfully, False if not
"""
self.high_threshold = float(temperature)
return True
def get_name(self):
"""
Retrieves the name of the thermal device
Returns:
string: The name of the thermal device
"""
return self.THERMAL_NAME_LIST[self.index]
def get_presence(self):
"""
Retrieves the presence of the PSU
Returns:
bool: True if PSU is present, False if not
"""
temp_file = "temp{}_input".format(self.ss_index)
temp_file_path = os.path.join(self.hwmon_path, temp_file)
return os.path.isfile(temp_file_path)
def get_status(self):
"""
Retrieves the operational status of the device
Returns:
A boolean value, True if device is operating properly, False if not
"""
if not self.get_presence():
return False
return True

View File

@ -0,0 +1,15 @@
Copyright (C) 2022 FS
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

View File

@ -0,0 +1 @@
platform drivers for FS for the SONiC project

View File

@ -0,0 +1,6 @@
sonic-platform-modules-fs (1.0) unstable; urgency=low
* Initial release
-- Sec <sec@feisu.com> Mon, 22 Nov 2022 14:50:00 +0800

View File

@ -0,0 +1 @@
9

View File

@ -0,0 +1,11 @@
Source: sonic-platform-modules-fs
Section: main
Priority: extra
Maintainer: Sec <sec@feisu.com>
Build-Depends: debhelper (>= 8.0.0), bzip2
Standards-Version: 3.9.3
Package: platform-modules-s5800-48t4s
Architecture: arm64
Depends: linux-image-5.10.0-18-2-arm64-unsigned
Description: kernel modules for platform devices such as fan, led, sfp

View File

@ -0,0 +1,80 @@
#!/bin/bash
# This script load/unload fs kernel modules
### BEGIN INIT INFO
# Provides: platform-modules-s5800-48t4s
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Load FS kernel modules
### END INIT INFO
function install_python_api_package()
{
device="/usr/share/sonic/device"
platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform)
rv=$(pip3 show sonic-platform > /dev/null 2>/dev/null)
if [ $? -ne 0 ]; then
rv=$(pip3 install $device/$platform/sonic_platform-1.0-py3-none-any.whl)
fi
}
function load_kernel_modules()
{
hwaddr=`fw_printenv ethaddr | awk -F = '{print $2}'`
if [ "$hwaddr" != "" ]; then
ifconfig eth0 hw ether $hwaddr
fi
depmod -a
modprobe ctc-i2c-mux-pca954x
modprobe fs_s5800_48t4s_platform
modprobe fan-ctc5236
modprobe dal
modprobe tun
modprobe tap
}
function remove_kernel_modules()
{
modprobe -r tap
modprobe -r tun
modprobe -r dal
modprobe -r fan-ctc5236
modprobe -r fs_s5800_48t4s_platform
modprobe -r ctc-i2c-mux-pca954x
}
case "$1" in
start)
echo -n "Load FS kernel modules... "
load_kernel_modules
install_python_api_package
echo "done."
;;
stop)
echo -n "Unload FS kernel modules... "
remove_kernel_modules
echo "done."
;;
force-reload|restart)
echo "Not supported"
;;
*)
echo "Usage: /etc/init.d/platform-modules-s5800-48t4s {start|stop}"
exit 1
;;
esac
exit 0

View File

@ -0,0 +1 @@
48t4s/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/arm64-fs_s5800_48t4s-r0

View File

@ -0,0 +1,9 @@
#!/bin/bash
hw_ver=`dd if=/dev/mtd2 bs=1 skip=4115 count=1 2>/dev/null | hexdump | awk '{print $2}'`
if [[ 0x$hw_ver -ge 0x30 ]] && [[ 0x$hw_ver -ne 0x44 ]]; then
sed -i "s/S5800-48t4s /S5800-48t4s-mars8p /g" /usr/share/sonic/device/arm64-fs_s5800_48t4s-r0/default_sku
fi
systemctl enable 48t4s_platform.service
systemctl start 48t4s_platform.service

View File

@ -0,0 +1,98 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
include /usr/share/dpkg/pkg-info.mk
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export INSTALL_MOD_DIR:=extra
PACKAGE_PRE_NAME := platform-modules-s5800
KVERSION ?= $(shell uname -r)
KERNEL_SRC := /lib/modules/$(KVERSION)
MOD_SRC_DIR:= $(shell pwd)
MODULE_DIRS:= 48t4s
MODULE_DIR := modules
SERVICE_DIR := service
CLASSES_DIR := classes
CONF_DIR := conf
KDAL_DIR := ../../centec/centec-dal/
FAN_DIR := fan
PCA954X_DIR := pca954x
%:
dh $@
clean:
dh_testdir
dh_testroot
dh_clean
build:
#make modules -C $(KERNEL_SRC)/build M=$(MODULE_SRC)
(for mod in $(KDAL_DIR); do \
make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/; \
done)
(for mod in $(FAN_DIR); do \
make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/; \
done)
(for mod in $(PCA954X_DIR); do \
make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/; \
done)
(for mod in $(MODULE_DIRS); do \
make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \
cd $${mod}; \
python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
cd -; \
done)
binary: binary-arch binary-indep
# Nothing to do
binary-arch:
# Nothing to do
#install: build
#dh_testdir
#dh_testroot
#dh_clean -k
#dh_installdirs
binary-indep:
dh_testdir
dh_installdirs
# Custom package commands
(for mod in $(MODULE_DIRS); do \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} lib/systemd/system; \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} etc; \
cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
cp $(MOD_SRC_DIR)/$(KDAL_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
cp $(MOD_SRC_DIR)/$(FAN_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
cp $(MOD_SRC_DIR)/$(PCA954X_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \
done)
# Resuming debhelper scripts
dh_testroot
dh_install
dh_installchangelogs
dh_installdocs
dh_systemd_enable
dh_installinit
dh_systemd_start
dh_link
dh_fixperms
dh_compress
dh_strip
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
.PHONY: build binary binary-arch binary-indep clean

View File

@ -0,0 +1 @@
../sonic-platform-modules-e530/fan

View File

@ -0,0 +1 @@
../sonic-platform-modules-e530/pca954x/

View File

@ -79,5 +79,12 @@
ramdisk = "initramfs"; ramdisk = "initramfs";
fdt = "ctc_fdt"; fdt = "ctc_fdt";
}; };
arm64-fs_s5800_48t4s-r0 {
description = "config for arm64-fs_s5800_48t4s-r0";
kernel = "kernel_ctc";
ramdisk = "initramfs";
fdt = "ctc_fdt";
};
}; };
}; };