diff --git a/123.patch b/123.patch new file mode 100644 index 0000000000..f6ee0957d8 --- /dev/null +++ b/123.patch @@ -0,0 +1,5611 @@ +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/hwsku.json b/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/hwsku.json +new file mode 100755 +index 000000000..faf0aac09 +--- /dev/null ++++ b/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/hwsku.json +@@ -0,0 +1,315 @@ ++{ ++ "interfaces": { ++ "Ethernet0": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet1": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet2": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet3": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet4": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet5": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet6": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet7": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet8": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet9": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet10": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet11": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet12": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet13": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet14": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet15": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet16": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet17": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet18": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet19": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet20": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet21": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet22": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet23": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet24": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet25": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet26": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet27": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet28": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet29": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet30": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet31": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet32": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet33": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet34": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet35": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet36": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet37": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet38": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet39": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet40": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet41": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet42": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet43": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet44": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet45": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet46": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet47": { ++ "default_brkout_mode": "1x1G", ++ "autoneg": "on", ++ "port_type": "RJ45" ++ }, ++ ++ "Ethernet48": { ++ "default_brkout_mode": "1x25G[10G]" ++ }, ++ ++ "Ethernet49": { ++ "default_brkout_mode": "1x25G[10G]" ++ }, ++ ++ "Ethernet50": { ++ "default_brkout_mode": "1x25G[10G]" ++ }, ++ ++ "Ethernet51": { ++ "default_brkout_mode": "1x25G[10G]" ++ }, ++ ++ "Ethernet52": { ++ "default_brkout_mode": "1x100G[40G]" ++ }, ++ ++ "Ethernet56": { ++ "default_brkout_mode": "1x100G[40G]" ++ } ++ } ++} +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/hx5-as4630-48x1G+4x25G+2x100G.bcm b/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/hx5-as4630-48x1G+4x25G+2x100G.bcm +new file mode 100755 +index 000000000..1a0241506 +--- /dev/null ++++ b/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/hx5-as4630-48x1G+4x25G+2x100G.bcm +@@ -0,0 +1,502 @@ ++stable_size=76303168 ++ ++#polarity/lanemap is using TH2 style. ++core_clock_frequency=893 ++dpp_clock_ratio=2:3 ++ ++ptp_ts_pll_fref=50000000 ++ptp_bs_fref_0=50000000 ++ptp_bs_fref_1=50000000 ++ ++#oversubscribe_mode=1 ++ ++pbmp_xport_xe=0x1FFFFFFE000000000000 ++ ++parity_enable=0 ++mem_cache_enable=1 ++ ++l2_mem_entries=32768 ++#l3_mem_entries=49152 ++#fpem_mem_entries=16384 ++l2xmsg_mode=1 ++l3_alpm_enable=2 ++ipv6_lpm_128b_enable=1 ++port_flex_enable=1 ++pcie_hot_swap_timeout_usec=10000 ++ifp_inports_support_enable=1 ++ ++#3x PM4x10Q (3 * 16 = 48 physical ports) ++#Doesn't support oversubscribe in Q mode ++#MCQ0 ++port_gmii_mode_1=1 #Q mode ++ ++#riot vxlan ++#dport_map_direct=1 ++flow_init_mode=1 ++riot_enable=1 ++riot_overlay_l3_intf_mem_size=4096 ++riot_overlay_l3_egress_mem_size=8192 ++l3_ecmp_levels=2 ++riot_overlay_ecmp_resilient_hash_size=16384 ++use_all_splithorizon_groups=1 ++host_as_route_disable=1 ++max_vp_lags=448 ++ ++#PHY4 U56 xx1, MDC/MDIO2, PHYADDR:0x00-0x07, 0x08 ++port_phy_addr_1=0x40 ++port_phy_addr_2=0x41 ++port_phy_addr_3=0x42 ++port_phy_addr_4=0x43 ++port_phy_addr_5=0x44 ++port_phy_addr_6=0x45 ++port_phy_addr_7=0x46 ++port_phy_addr_8=0x47 ++phy_port_primary_and_offset_1=0x0100 ++phy_port_primary_and_offset_2=0x0101 ++phy_port_primary_and_offset_3=0x0102 ++phy_port_primary_and_offset_4=0x0103 ++phy_port_primary_and_offset_5=0x0104 ++phy_port_primary_and_offset_6=0x0105 ++phy_port_primary_and_offset_7=0x0106 ++phy_port_primary_and_offset_8=0x0107 ++dport_map_port_1=26 ++dport_map_port_2=25 ++dport_map_port_3=28 ++dport_map_port_4=27 ++dport_map_port_5=30 ++dport_map_port_6=29 ++dport_map_port_7=32 ++dport_map_port_8=31 ++portmap_1=1:1 ++portmap_2=2:1 ++portmap_3=3:1 ++portmap_4=4:1 ++portmap_5=5:1 ++portmap_6=6:1 ++portmap_7=7:1 ++portmap_8=8:1 ++phy_chain_rx_lane_map_physical{1.0}=0x3210 ++phy_chain_rx_lane_map_physical{2.0}=0x3210 ++phy_chain_rx_lane_map_physical{3.0}=0x3210 ++phy_chain_rx_lane_map_physical{4.0}=0x3210 ++phy_chain_rx_lane_map_physical{5.0}=0x3210 ++phy_chain_rx_lane_map_physical{6.0}=0x3210 ++phy_chain_rx_lane_map_physical{7.0}=0x3210 ++phy_chain_rx_lane_map_physical{8.0}=0x3210 ++phy_chain_tx_lane_map_physical{1.0}=0x3210 ++phy_chain_tx_lane_map_physical{2.0}=0x3210 ++phy_chain_tx_lane_map_physical{3.0}=0x3210 ++phy_chain_tx_lane_map_physical{4.0}=0x3210 ++phy_chain_tx_lane_map_physical{5.0}=0x3210 ++phy_chain_tx_lane_map_physical{6.0}=0x3210 ++phy_chain_tx_lane_map_physical{7.0}=0x3210 ++phy_chain_tx_lane_map_physical{8.0}=0x3210 ++phy_chain_rx_polarity_flip_physical{1.0}=0x0 ++phy_chain_rx_polarity_flip_physical{2.0}=0x0 ++phy_chain_rx_polarity_flip_physical{3.0}=0x0 ++phy_chain_rx_polarity_flip_physical{4.0}=0x0 ++phy_chain_rx_polarity_flip_physical{5.0}=0x0 ++phy_chain_rx_polarity_flip_physical{6.0}=0x0 ++phy_chain_rx_polarity_flip_physical{7.0}=0x0 ++phy_chain_rx_polarity_flip_physical{8.0}=0x0 ++phy_chain_tx_polarity_flip_physical{1.0}=0x0 ++phy_chain_tx_polarity_flip_physical{2.0}=0x0 ++phy_chain_tx_polarity_flip_physical{3.0}=0x0 ++phy_chain_tx_polarity_flip_physical{4.0}=0x0 ++phy_chain_tx_polarity_flip_physical{5.0}=0x0 ++phy_chain_tx_polarity_flip_physical{6.0}=0x0 ++phy_chain_tx_polarity_flip_physical{7.0}=0x0 ++phy_chain_tx_polarity_flip_physical{8.0}=0x0 ++ ++ ++#PHY5 U57 x1x, MDC/MDIO2, PHYADDR:0x09-0x10, 0x11 ++port_phy_addr_9=0x49 ++port_phy_addr_10=0x4A ++port_phy_addr_11=0x4B ++port_phy_addr_12=0x4C ++port_phy_addr_13=0x4D ++port_phy_addr_14=0x4E ++port_phy_addr_15=0x4F ++port_phy_addr_16=0x50 ++phy_port_primary_and_offset_9=0x0900 ++phy_port_primary_and_offset_10=0x0901 ++phy_port_primary_and_offset_11=0x0902 ++phy_port_primary_and_offset_12=0x0903 ++phy_port_primary_and_offset_13=0x0904 ++phy_port_primary_and_offset_14=0x0905 ++phy_port_primary_and_offset_15=0x0906 ++phy_port_primary_and_offset_16=0x0907 ++dport_map_port_9=34 ++dport_map_port_10=33 ++dport_map_port_11=36 ++dport_map_port_12=35 ++dport_map_port_13=38 ++dport_map_port_14=37 ++dport_map_port_15=40 ++dport_map_port_16=39 ++portmap_9=9:1 ++portmap_10=10:1 ++portmap_11=11:1 ++portmap_12=12:1 ++portmap_13=13:1 ++portmap_14=14:1 ++portmap_15=15:1 ++portmap_16=16:1 ++phy_chain_rx_lane_map_physical{9.0}=0x3210 ++phy_chain_rx_lane_map_physical{10.0}=0x3210 ++phy_chain_rx_lane_map_physical{11.0}=0x3210 ++phy_chain_rx_lane_map_physical{12.0}=0x3210 ++phy_chain_rx_lane_map_physical{13.0}=0x3210 ++phy_chain_rx_lane_map_physical{14.0}=0x3210 ++phy_chain_rx_lane_map_physical{15.0}=0x3210 ++phy_chain_rx_lane_map_physical{16.0}=0x3210 ++phy_chain_tx_lane_map_physical{9.0}=0x3210 ++phy_chain_tx_lane_map_physical{10.0}=0x3210 ++phy_chain_tx_lane_map_physical{11.0}=0x3210 ++phy_chain_tx_lane_map_physical{12.0}=0x3210 ++phy_chain_tx_lane_map_physical{13.0}=0x3210 ++phy_chain_tx_lane_map_physical{14.0}=0x3210 ++phy_chain_tx_lane_map_physical{15.0}=0x3210 ++phy_chain_tx_lane_map_physical{16.0}=0x3210 ++phy_chain_rx_polarity_flip_physical{9.0}=0x0 ++phy_chain_rx_polarity_flip_physical{10.0}=0x0 ++phy_chain_rx_polarity_flip_physical{11.0}=0x0 ++phy_chain_rx_polarity_flip_physical{12.0}=0x0 ++phy_chain_rx_polarity_flip_physical{13.0}=0x0 ++phy_chain_rx_polarity_flip_physical{14.0}=0x0 ++phy_chain_rx_polarity_flip_physical{15.0}=0x0 ++phy_chain_rx_polarity_flip_physical{16.0}=0x0 ++phy_chain_tx_polarity_flip_physical{9.0}=0x0 ++phy_chain_tx_polarity_flip_physical{10.0}=0x0 ++phy_chain_tx_polarity_flip_physical{11.0}=0x0 ++phy_chain_tx_polarity_flip_physical{12.0}=0x0 ++phy_chain_tx_polarity_flip_physical{13.0}=0x0 ++phy_chain_tx_polarity_flip_physical{14.0}=0x0 ++phy_chain_tx_polarity_flip_physical{15.0}=0x0 ++phy_chain_tx_polarity_flip_physical{16.0}=0x0 ++ ++#MCQ1 ++port_gmii_mode_17=1 #Q mode ++ ++#PHY6 U58 11x, MDC/MDIO2, PHYADDR:0x12-0x19, 0x1A ++port_phy_addr_17=0x52 ++port_phy_addr_18=0x53 ++port_phy_addr_19=0x54 ++port_phy_addr_20=0x55 ++port_phy_addr_21=0x56 ++port_phy_addr_22=0x57 ++port_phy_addr_23=0x58 ++port_phy_addr_24=0x59 ++phy_port_primary_and_offset_17=0x1100 ++phy_port_primary_and_offset_18=0x1101 ++phy_port_primary_and_offset_19=0x1102 ++phy_port_primary_and_offset_20=0x1103 ++phy_port_primary_and_offset_21=0x1104 ++phy_port_primary_and_offset_22=0x1105 ++phy_port_primary_and_offset_23=0x1106 ++phy_port_primary_and_offset_24=0x1107 ++dport_map_port_17=42 ++dport_map_port_18=41 ++dport_map_port_19=44 ++dport_map_port_20=43 ++dport_map_port_21=46 ++dport_map_port_22=45 ++dport_map_port_23=48 ++dport_map_port_24=47 ++portmap_17=17:1 ++portmap_18=18:1 ++portmap_19=19:1 ++portmap_20=20:1 ++portmap_21=21:1 ++portmap_22=22:1 ++portmap_23=23:1 ++portmap_24=24:1 ++phy_chain_rx_lane_map_physical{17.0}=0x3210 ++phy_chain_rx_lane_map_physical{18.0}=0x3210 ++phy_chain_rx_lane_map_physical{19.0}=0x3210 ++phy_chain_rx_lane_map_physical{20.0}=0x3210 ++phy_chain_rx_lane_map_physical{21.0}=0x3210 ++phy_chain_rx_lane_map_physical{22.0}=0x3210 ++phy_chain_rx_lane_map_physical{23.0}=0x3210 ++phy_chain_rx_lane_map_physical{24.0}=0x3210 ++phy_chain_tx_lane_map_physical{17.0}=0x3210 ++phy_chain_tx_lane_map_physical{18.0}=0x3210 ++phy_chain_tx_lane_map_physical{19.0}=0x3210 ++phy_chain_tx_lane_map_physical{20.0}=0x3210 ++phy_chain_tx_lane_map_physical{21.0}=0x3210 ++phy_chain_tx_lane_map_physical{22.0}=0x3210 ++phy_chain_tx_lane_map_physical{23.0}=0x3210 ++phy_chain_tx_lane_map_physical{24.0}=0x3210 ++phy_chain_rx_polarity_flip_physical{17.0}=0x0 ++phy_chain_rx_polarity_flip_physical{18.0}=0x0 ++phy_chain_rx_polarity_flip_physical{19.0}=0x0 ++phy_chain_rx_polarity_flip_physical{20.0}=0x0 ++phy_chain_rx_polarity_flip_physical{21.0}=0x0 ++phy_chain_rx_polarity_flip_physical{22.0}=0x0 ++phy_chain_rx_polarity_flip_physical{23.0}=0x0 ++phy_chain_rx_polarity_flip_physical{24.0}=0x0 ++phy_chain_tx_polarity_flip_physical{17.0}=0x0 ++phy_chain_tx_polarity_flip_physical{18.0}=0x0 ++phy_chain_tx_polarity_flip_physical{19.0}=0x0 ++phy_chain_tx_polarity_flip_physical{20.0}=0x0 ++phy_chain_tx_polarity_flip_physical{21.0}=0x0 ++phy_chain_tx_polarity_flip_physical{22.0}=0x0 ++phy_chain_tx_polarity_flip_physical{23.0}=0x0 ++phy_chain_tx_polarity_flip_physical{24.0}=0x0 ++ ++#PHY1 U53 xx1, MDC/MDIO0, PHYADDR:0x00-0x07, 0x08 ++port_phy_addr_25=0x00 ++port_phy_addr_26=0x01 ++port_phy_addr_27=0x02 ++port_phy_addr_28=0x03 ++port_phy_addr_29=0x04 ++port_phy_addr_30=0x05 ++port_phy_addr_31=0x06 ++port_phy_addr_32=0x07 ++phy_port_primary_and_offset_25=0x1900 ++phy_port_primary_and_offset_26=0x1901 ++phy_port_primary_and_offset_27=0x1902 ++phy_port_primary_and_offset_28=0x1903 ++phy_port_primary_and_offset_29=0x1904 ++phy_port_primary_and_offset_30=0x1905 ++phy_port_primary_and_offset_31=0x1906 ++phy_port_primary_and_offset_32=0x1907 ++dport_map_port_25=2 ++dport_map_port_26=1 ++dport_map_port_27=4 ++dport_map_port_28=3 ++dport_map_port_29=6 ++dport_map_port_30=5 ++dport_map_port_31=8 ++dport_map_port_32=7 ++portmap_25=25:1 ++portmap_26=26:1 ++portmap_27=27:1 ++portmap_28=28:1 ++portmap_29=29:1 ++portmap_30=30:1 ++portmap_31=31:1 ++portmap_32=32:1 ++phy_chain_rx_lane_map_physical{25.0}=0x3210 ++phy_chain_rx_lane_map_physical{26.0}=0x3210 ++phy_chain_rx_lane_map_physical{27.0}=0x3210 ++phy_chain_rx_lane_map_physical{28.0}=0x3210 ++phy_chain_rx_lane_map_physical{29.0}=0x3210 ++phy_chain_rx_lane_map_physical{30.0}=0x3210 ++phy_chain_rx_lane_map_physical{31.0}=0x3210 ++phy_chain_rx_lane_map_physical{32.0}=0x3210 ++phy_chain_tx_lane_map_physical{25.0}=0x3210 ++phy_chain_tx_lane_map_physical{26.0}=0x3210 ++phy_chain_tx_lane_map_physical{27.0}=0x3210 ++phy_chain_tx_lane_map_physical{28.0}=0x3210 ++phy_chain_tx_lane_map_physical{29.0}=0x3210 ++phy_chain_tx_lane_map_physical{30.0}=0x3210 ++phy_chain_tx_lane_map_physical{31.0}=0x3210 ++phy_chain_tx_lane_map_physical{32.0}=0x3210 ++phy_chain_rx_polarity_flip_physical{25.0}=0x0 ++phy_chain_rx_polarity_flip_physical{26.0}=0x0 ++phy_chain_rx_polarity_flip_physical{27.0}=0x0 ++phy_chain_rx_polarity_flip_physical{28.0}=0x0 ++phy_chain_rx_polarity_flip_physical{29.0}=0x0 ++phy_chain_rx_polarity_flip_physical{30.0}=0x0 ++phy_chain_rx_polarity_flip_physical{31.0}=0x0 ++phy_chain_rx_polarity_flip_physical{32.0}=0x0 ++phy_chain_tx_polarity_flip_physical{25.0}=0x0 ++phy_chain_tx_polarity_flip_physical{26.0}=0x0 ++phy_chain_tx_polarity_flip_physical{27.0}=0x0 ++phy_chain_tx_polarity_flip_physical{28.0}=0x0 ++phy_chain_tx_polarity_flip_physical{29.0}=0x0 ++phy_chain_tx_polarity_flip_physical{30.0}=0x0 ++phy_chain_tx_polarity_flip_physical{31.0}=0x0 ++phy_chain_tx_polarity_flip_physical{32.0}=0x0 ++ ++#MCQ2 ++port_gmii_mode_33=1 #Q mode ++ ++#PHY2 U54 x1x, MDC/MDIO0, PHYADDR:0x09-0x10, 0x11 ++port_phy_addr_33=0x0D ++port_phy_addr_34=0x0E ++port_phy_addr_35=0x0F ++port_phy_addr_36=0x10 ++port_phy_addr_37=0x09 ++port_phy_addr_38=0x0A ++port_phy_addr_39=0x0B ++port_phy_addr_40=0x0C ++phy_port_primary_and_offset_33=0x2504 ++phy_port_primary_and_offset_34=0x2505 ++phy_port_primary_and_offset_35=0x2506 ++phy_port_primary_and_offset_36=0x2507 ++phy_port_primary_and_offset_37=0x2500 ++phy_port_primary_and_offset_38=0x2501 ++phy_port_primary_and_offset_39=0x2502 ++phy_port_primary_and_offset_40=0x2503 ++dport_map_port_33=14 ++dport_map_port_34=13 ++dport_map_port_35=16 ++dport_map_port_36=15 ++dport_map_port_37=10 ++dport_map_port_38=9 ++dport_map_port_39=12 ++dport_map_port_40=11 ++portmap_33=33:1 ++portmap_34=34:1 ++portmap_35=35:1 ++portmap_36=36:1 ++portmap_37=37:1 ++portmap_38=38:1 ++portmap_39=39:1 ++portmap_40=40:1 ++phy_chain_rx_lane_map_physical{33.0}=0x3210 ++phy_chain_rx_lane_map_physical{34.0}=0x3210 ++phy_chain_rx_lane_map_physical{35.0}=0x3210 ++phy_chain_rx_lane_map_physical{36.0}=0x3210 ++phy_chain_rx_lane_map_physical{37.0}=0x3210 ++phy_chain_rx_lane_map_physical{38.0}=0x3210 ++phy_chain_rx_lane_map_physical{39.0}=0x3210 ++phy_chain_rx_lane_map_physical{40.0}=0x3210 ++phy_chain_tx_lane_map_physical{33.0}=0x3210 ++phy_chain_tx_lane_map_physical{34.0}=0x3210 ++phy_chain_tx_lane_map_physical{35.0}=0x3210 ++phy_chain_tx_lane_map_physical{36.0}=0x3210 ++phy_chain_tx_lane_map_physical{37.0}=0x3210 ++phy_chain_tx_lane_map_physical{38.0}=0x3210 ++phy_chain_tx_lane_map_physical{39.0}=0x3210 ++phy_chain_tx_lane_map_physical{40.0}=0x3210 ++phy_chain_rx_polarity_flip_physical{33.0}=0x1 ++phy_chain_rx_polarity_flip_physical{34.0}=0x1 ++phy_chain_rx_polarity_flip_physical{35.0}=0x1 ++phy_chain_rx_polarity_flip_physical{36.0}=0x1 ++phy_chain_rx_polarity_flip_physical{37.0}=0x1 ++phy_chain_rx_polarity_flip_physical{38.0}=0x1 ++phy_chain_rx_polarity_flip_physical{39.0}=0x1 ++phy_chain_rx_polarity_flip_physical{40.0}=0x1 ++phy_chain_tx_polarity_flip_physical{33.0}=0x1 ++phy_chain_tx_polarity_flip_physical{34.0}=0x1 ++phy_chain_tx_polarity_flip_physical{35.0}=0x1 ++phy_chain_tx_polarity_flip_physical{36.0}=0x1 ++phy_chain_tx_polarity_flip_physical{37.0}=0x1 ++phy_chain_tx_polarity_flip_physical{38.0}=0x1 ++phy_chain_tx_polarity_flip_physical{39.0}=0x1 ++phy_chain_tx_polarity_flip_physical{40.0}=0x1 ++ ++#PHY3 U55 11x, MDC/MDIO0, PHYADDR:0x12-0x19, 0x1A ++port_phy_addr_41=0x16 ++port_phy_addr_42=0x17 ++port_phy_addr_43=0x18 ++port_phy_addr_44=0x19 ++port_phy_addr_45=0x12 ++port_phy_addr_46=0x13 ++port_phy_addr_47=0x14 ++port_phy_addr_48=0x15 ++phy_port_primary_and_offset_41=0x2D00 ++phy_port_primary_and_offset_42=0x2D01 ++phy_port_primary_and_offset_43=0x2D02 ++phy_port_primary_and_offset_44=0x2D03 ++phy_port_primary_and_offset_45=0x2D04 ++phy_port_primary_and_offset_46=0x2D05 ++phy_port_primary_and_offset_47=0x2D06 ++phy_port_primary_and_offset_48=0x2D07 ++dport_map_port_41=22 ++dport_map_port_42=21 ++dport_map_port_43=24 ++dport_map_port_44=23 ++dport_map_port_45=18 ++dport_map_port_46=17 ++dport_map_port_47=20 ++dport_map_port_48=19 ++portmap_41=41:1 ++portmap_42=42:1 ++portmap_43=43:1 ++portmap_44=44:1 ++portmap_45=45:1 ++portmap_46=46:1 ++portmap_47=47:1 ++portmap_48=48:1 ++phy_chain_rx_lane_map_physical{41.0}=0x3210 ++phy_chain_rx_lane_map_physical{42.0}=0x3210 ++phy_chain_rx_lane_map_physical{43.0}=0x3210 ++phy_chain_rx_lane_map_physical{44.0}=0x3210 ++phy_chain_rx_lane_map_physical{45.0}=0x3210 ++phy_chain_rx_lane_map_physical{46.0}=0x3210 ++phy_chain_rx_lane_map_physical{47.0}=0x3210 ++phy_chain_rx_lane_map_physical{48.0}=0x3210 ++phy_chain_tx_lane_map_physical{41.0}=0x3210 ++phy_chain_tx_lane_map_physical{42.0}=0x3210 ++phy_chain_tx_lane_map_physical{43.0}=0x3210 ++phy_chain_tx_lane_map_physical{44.0}=0x3210 ++phy_chain_tx_lane_map_physical{45.0}=0x3210 ++phy_chain_tx_lane_map_physical{46.0}=0x3210 ++phy_chain_tx_lane_map_physical{47.0}=0x3210 ++phy_chain_tx_lane_map_physical{48.0}=0x3210 ++phy_chain_rx_polarity_flip_physical{41.0}=0x1 ++phy_chain_rx_polarity_flip_physical{42.0}=0x1 ++phy_chain_rx_polarity_flip_physical{43.0}=0x1 ++phy_chain_rx_polarity_flip_physical{44.0}=0x1 ++phy_chain_rx_polarity_flip_physical{45.0}=0x1 ++phy_chain_rx_polarity_flip_physical{46.0}=0x1 ++phy_chain_rx_polarity_flip_physical{47.0}=0x1 ++phy_chain_rx_polarity_flip_physical{48.0}=0x1 ++phy_chain_tx_polarity_flip_physical{41.0}=0x1 ++phy_chain_tx_polarity_flip_physical{42.0}=0x1 ++phy_chain_tx_polarity_flip_physical{43.0}=0x1 ++phy_chain_tx_polarity_flip_physical{44.0}=0x1 ++phy_chain_tx_polarity_flip_physical{45.0}=0x1 ++phy_chain_tx_polarity_flip_physical{46.0}=0x1 ++phy_chain_tx_polarity_flip_physical{47.0}=0x1 ++phy_chain_tx_polarity_flip_physical{48.0}=0x1 ++ ++#3x PM4x25 (3 * 4 = 12 physical ports) ++#FC0 ++dport_map_port_49=51 ++dport_map_port_50=50 ++dport_map_port_51=49 ++dport_map_port_52=52 ++portmap_49=65:25 ++portmap_50=66:25 ++portmap_51=67:25 ++portmap_52=68:25 ++#FC1 ++dport_map_port_53=57 ++dport_map_port_54=58 ++dport_map_port_55=59 ++dport_map_port_56=60 ++portmap_53=69:100:4 ++#portmap_55=71:50 ++#portmap_54=70:25 ++#portmap_55=71:25 ++#portmap_56=72:25 ++#FC2 ++dport_map_port_57=53 ++dport_map_port_58=54 ++dport_map_port_59=55 ++dport_map_port_60=56 ++portmap_57=73:100:4 ++#portmap_59=75:50 ++#portmap_58=74:25 ++#portmap_59=75:25 ++#portmap_60=76:25 ++ ++#4x PM4x10 (4 * 4 = 16 physical ports) ++#MC0 No connection ++#MC1 No connection ++#MC2 No connection ++#MC3 No connection ++#portmap_=49:10 ++#portmap_=50:10 ++#portmap_=51:10 ++#portmap_=52:10 ++ ++#portmap_=53:10 ++#portmap_=54:10 ++#portmap_=55:10 ++#portmap_=56:10 ++ ++#portmap_=57:10 ++#portmap_=58:10 ++#portmap_=59:10 ++#portmap_=60:10 ++ ++#portmap_=61:10 ++#portmap_=62:10 ++#portmap_=63:10 ++#portmap_=64:10 +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/port_config.ini b/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/port_config.ini +index 7040875fa..c30f99f48 100755 +--- a/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/port_config.ini ++++ b/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/port_config.ini +@@ -1,55 +1,55 @@ +-# name lanes alias index speed autoneg +-Ethernet0 26 thousandE1 1 1000 on +-Ethernet1 25 thousandE2 2 1000 on +-Ethernet2 28 thousandE3 3 1000 on +-Ethernet3 27 thousandE4 4 1000 on +-Ethernet4 30 thousandE5 5 1000 on +-Ethernet5 29 thousandE6 6 1000 on +-Ethernet6 32 thousandE7 7 1000 on +-Ethernet7 31 thousandE8 8 1000 on +-Ethernet8 38 thousandE9 9 1000 on +-Ethernet9 37 thousandE10 10 1000 on +-Ethernet10 40 thousandE11 11 1000 on +-Ethernet11 39 thousandE12 12 1000 on +-Ethernet12 34 thousandE13 13 1000 on +-Ethernet13 33 thousandE14 14 1000 on +-Ethernet14 36 thousandE15 15 1000 on +-Ethernet15 35 thousandE16 16 1000 on +-Ethernet16 46 thousandE17 17 1000 on +-Ethernet17 45 thousandE18 18 1000 on +-Ethernet18 48 thousandE19 19 1000 on +-Ethernet19 47 thousandE20 20 1000 on +-Ethernet20 42 thousandE21 21 1000 on +-Ethernet21 41 thousandE22 22 1000 on +-Ethernet22 44 thousandE23 23 1000 on +-Ethernet23 43 thousandE24 24 1000 on +-Ethernet24 2 thousandE25 25 1000 on +-Ethernet25 1 thousandE26 26 1000 on +-Ethernet26 4 thousandE27 27 1000 on +-Ethernet27 3 thousandE28 28 1000 on +-Ethernet28 6 thousandE29 29 1000 on +-Ethernet29 5 thousandE30 30 1000 on +-Ethernet30 8 thousandE31 31 1000 on +-Ethernet31 7 thousandE32 32 1000 on +-Ethernet32 10 thousandE33 33 1000 on +-Ethernet33 9 thousandE34 34 1000 on +-Ethernet34 12 thousandE35 35 1000 on +-Ethernet35 11 thousandE36 36 1000 on +-Ethernet36 14 thousandE37 37 1000 on +-Ethernet37 13 thousandE38 38 1000 on +-Ethernet38 16 thousandE39 39 1000 on +-Ethernet39 15 thousandE40 40 1000 on +-Ethernet40 18 thousandE41 41 1000 on +-Ethernet41 17 thousandE42 42 1000 on +-Ethernet42 20 thousandE43 43 1000 on +-Ethernet43 19 thousandE44 44 1000 on +-Ethernet44 22 thousandE45 45 1000 on +-Ethernet45 21 thousandE46 46 1000 on +-Ethernet46 24 thousandE47 47 1000 on +-Ethernet47 23 thousandE48 48 1000 on +-Ethernet48 67 twentyfiveGigE49 49 25000 off +-Ethernet49 66 twentyfiveGigE50 50 25000 off +-Ethernet50 65 twentyfiveGigE51 51 25000 off +-Ethernet51 68 twentyfiveGigE52 52 25000 off +-Ethernet52 73,74,75,76 hundredGigE53 53 100000 off +-Ethernet56 69,70,71,72 hundredGigE54 54 100000 off ++# name lanes alias index speed autoneg ++Ethernet0 26 Eth1(Port1) 1 1000 on ++Ethernet1 25 Eth2(Port2) 2 1000 on ++Ethernet2 28 Eth3(Port3) 3 1000 on ++Ethernet3 27 Eth4(Port4) 4 1000 on ++Ethernet4 30 Eth5(Port5) 5 1000 on ++Ethernet5 29 Eth6(Port6) 6 1000 on ++Ethernet6 32 Eth7(Port7) 7 1000 on ++Ethernet7 31 Eth8(Port8) 8 1000 on ++Ethernet8 38 Eth9(Port9) 9 1000 on ++Ethernet9 37 Eth10(Port10) 10 1000 on ++Ethernet10 40 Eth11(Port11) 11 1000 on ++Ethernet11 39 Eth12(Port12) 12 1000 on ++Ethernet12 34 Eth13(Port13) 13 1000 on ++Ethernet13 33 Eth14(Port14) 14 1000 on ++Ethernet14 36 Eth15(Port15) 15 1000 on ++Ethernet15 35 Eth16(Port16) 16 1000 on ++Ethernet16 46 Eth17(Port17) 17 1000 on ++Ethernet17 45 Eth18(Port18) 18 1000 on ++Ethernet18 48 Eth19(Port19) 19 1000 on ++Ethernet19 47 Eth20(Port20) 20 1000 on ++Ethernet20 42 Eth21(Port21) 21 1000 on ++Ethernet21 41 Eth22(Port22) 22 1000 on ++Ethernet22 44 Eth23(Port23) 23 1000 on ++Ethernet23 43 Eth24(Port24) 24 1000 on ++Ethernet24 2 Eth25(Port25) 25 1000 on ++Ethernet25 1 Eth26(Port26) 26 1000 on ++Ethernet26 4 Eth27(Port27) 27 1000 on ++Ethernet27 3 Eth28(Port28) 28 1000 on ++Ethernet28 6 Eth29(Port29) 29 1000 on ++Ethernet29 5 Eth30(Port30) 30 1000 on ++Ethernet30 8 Eth31(Port31) 31 1000 on ++Ethernet31 7 Eth32(Port32) 32 1000 on ++Ethernet32 10 Eth33(Port33) 33 1000 on ++Ethernet33 9 Eth34(Port34) 34 1000 on ++Ethernet34 12 Eth35(Port35) 35 1000 on ++Ethernet35 11 Eth36(Port36) 36 1000 on ++Ethernet36 14 Eth37(Port37) 37 1000 on ++Ethernet37 13 Eth38(Port38) 38 1000 on ++Ethernet38 16 Eth39(Port39) 39 1000 on ++Ethernet39 15 Eth40(Port40) 40 1000 on ++Ethernet40 18 Eth41(Port41) 41 1000 on ++Ethernet41 17 Eth42(Port42) 42 1000 on ++Ethernet42 20 Eth43(Port43) 43 1000 on ++Ethernet43 19 Eth44(Port44) 44 1000 on ++Ethernet44 22 Eth45(Port45) 45 1000 on ++Ethernet45 21 Eth46(Port46) 46 1000 on ++Ethernet46 24 Eth47(Port47) 47 1000 on ++Ethernet47 23 Eth48(Port48) 48 1000 on ++Ethernet48 67 Eth49(Port49) 49 25000 off ++Ethernet49 66 Eth50(Port50) 50 25000 off ++Ethernet50 65 Eth51(Port51) 51 25000 off ++Ethernet51 68 Eth52(Port52) 52 25000 off ++Ethernet52 73,74,75,76 Eth53(Port53) 53 100000 off ++Ethernet56 69,70,71,72 Eth54(Port54) 54 100000 off +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/sai.profile b/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/sai.profile +new file mode 100755 +index 000000000..5329410fe +--- /dev/null ++++ b/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/sai.profile +@@ -0,0 +1 @@ ++SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/hx5-as4630-48x1G+4x25G+2x100G.bcm +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/installer.conf b/device/accton/x86_64-accton_as4630_54te-r0/installer.conf +index 925a32fc0..d5f9419d7 100755 +--- a/device/accton/x86_64-accton_as4630_54te-r0/installer.conf ++++ b/device/accton/x86_64-accton_as4630_54te-r0/installer.conf +@@ -1,3 +1,4 @@ + CONSOLE_PORT=0x3f8 + CONSOLE_DEV=0 + CONSOLE_SPEED=115200 ++ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="pcie_aspm=off" +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/led_proc_init.soc b/device/accton/x86_64-accton_as4630_54te-r0/led_proc_init.soc +new file mode 100644 +index 000000000..696632b6e +--- /dev/null ++++ b/device/accton/x86_64-accton_as4630_54te-r0/led_proc_init.soc +@@ -0,0 +1,3 @@ ++#m0 load 0 0x3800 /usr/share/sonic/platform/custom_led.bin ++led start ++#led auto on +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/pcie.yaml b/device/accton/x86_64-accton_as4630_54te-r0/pcie.yaml +new file mode 100644 +index 000000000..c7e99c867 +--- /dev/null ++++ b/device/accton/x86_64-accton_as4630_54te-r0/pcie.yaml +@@ -0,0 +1,167 @@ ++- bus: '00' ++ dev: '00' ++ fn: '0' ++ id: '1980' ++ name: 'Host bridge: Intel Corporation Atom Processor C3000 Series System Agent (rev ++ 11)' ++- bus: '00' ++ dev: '04' ++ fn: '0' ++ id: 19a1 ++ name: 'Host bridge: Intel Corporation Atom Processor C3000 Series Error Registers ++ (rev 11)' ++- bus: '00' ++ dev: '05' ++ fn: '0' ++ id: 19a2 ++ name: 'Generic system peripheral [0807]: Intel Corporation Atom Processor C3000 ++ Series Root Complex Event Collector (rev 11)' ++- bus: '00' ++ dev: '06' ++ fn: '0' ++ id: 19a3 ++ name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series Integrated QAT ++ Root Port (rev 11)' ++- bus: '00' ++ dev: 09 ++ fn: '0' ++ id: 19a4 ++ name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root ++ Port #0 (rev 11)' ++- bus: '00' ++ dev: 0b ++ fn: '0' ++ id: 19a6 ++ name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root ++ Port #2 (rev 11)' ++- bus: '00' ++ dev: 0e ++ fn: '0' ++ id: 19a8 ++ name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root ++ Port #4 (rev 11)' ++- bus: '00' ++ dev: '10' ++ fn: '0' ++ id: 19aa ++ name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root ++ Port #6 (rev 11)' ++- bus: '00' ++ dev: '12' ++ fn: '0' ++ id: 19ac ++ name: 'System peripheral: Intel Corporation Atom Processor C3000 Series SMBus Contoller ++ - Host (rev 11)' ++- bus: '00' ++ dev: '13' ++ fn: '0' ++ id: 19b2 ++ name: 'SATA controller: Intel Corporation Atom Processor C3000 Series SATA Controller ++ 0 (rev 11)' ++- bus: '00' ++ dev: '15' ++ fn: '0' ++ id: 19d0 ++ name: 'USB controller: Intel Corporation Atom Processor C3000 Series USB 3.0 xHCI ++ Controller (rev 11)' ++- bus: '00' ++ dev: '16' ++ fn: '0' ++ id: 19d1 ++ name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series Integrated LAN ++ Root Port #0 (rev 11)' ++- bus: '00' ++ dev: '17' ++ fn: '0' ++ id: 19d2 ++ name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series Integrated LAN ++ Root Port #1 (rev 11)' ++- bus: '00' ++ dev: '18' ++ fn: '0' ++ id: 19d3 ++ name: 'Communication controller: Intel Corporation Atom Processor C3000 Series ME ++ HECI 1 (rev 11)' ++- bus: '00' ++ dev: 1a ++ fn: '0' ++ id: 19d8 ++ name: 'Serial controller: Intel Corporation Atom Processor C3000 Series HSUART Controller ++ (rev 11)' ++- bus: '00' ++ dev: 1a ++ fn: '1' ++ id: 19d8 ++ name: 'Serial controller: Intel Corporation Atom Processor C3000 Series HSUART Controller ++ (rev 11)' ++- bus: '00' ++ dev: 1a ++ fn: '2' ++ id: 19d8 ++ name: 'Serial controller: Intel Corporation Atom Processor C3000 Series HSUART Controller ++ (rev 11)' ++- bus: '00' ++ dev: 1c ++ fn: '0' ++ id: 19db ++ name: 'SD Host controller: Intel Corporation Device 19db (rev 11)' ++- bus: '00' ++ dev: 1f ++ fn: '0' ++ id: 19dc ++ name: 'ISA bridge: Intel Corporation Atom Processor C3000 Series LPC or eSPI (rev ++ 11)' ++- bus: '00' ++ dev: 1f ++ fn: '1' ++ id: 19dd ++ name: 'Memory controller: Intel Corporation Atom Processor C3000 Series Primary ++ to Side Band (P2SB) Bridge (rev 11)' ++- bus: '00' ++ dev: 1f ++ fn: '2' ++ id: 19de ++ name: 'Memory controller: Intel Corporation Atom Processor C3000 Series Power Management ++ Controller (rev 11)' ++- bus: '00' ++ dev: 1f ++ fn: '4' ++ id: 19df ++ name: 'SMBus: Intel Corporation Atom Processor C3000 Series SMBus controller (rev ++ 11)' ++- bus: '00' ++ dev: 1f ++ fn: '5' ++ id: 19e0 ++ name: 'Serial bus controller [0c80]: Intel Corporation Atom Processor C3000 Series ++ SPI Controller (rev 11)' ++- bus: '01' ++ dev: '00' ++ fn: '0' ++ id: 19e2 ++ name: 'Co-processor: Intel Corporation Atom Processor C3000 Series QuickAssist Technology ++ (rev 11)' ++- bus: '05' ++ dev: '00' ++ fn: '0' ++ id: b371 ++ name: 'Ethernet controller: Broadcom Inc. and subsidiaries BCM56371 Switch ASIC ++ (rev 03)' ++- bus: '06' ++ dev: '00' ++ fn: '0' ++ id: 15c2 ++ name: 'Ethernet controller: Intel Corporation Ethernet Connection X553 Backplane ++ (rev 11)' ++- bus: '06' ++ dev: '00' ++ fn: '1' ++ id: 15c2 ++ name: 'Ethernet controller: Intel Corporation Ethernet Connection X553 Backplane ++ (rev 11)' ++- bus: 08 ++ dev: '00' ++ fn: '0' ++ id: 15e5 ++ name: 'Ethernet controller: Intel Corporation Ethernet Connection X553 1GbE (rev ++ 11)' +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/platform.json b/device/accton/x86_64-accton_as4630_54te-r0/platform.json +new file mode 100644 +index 000000000..af158fc72 +--- /dev/null ++++ b/device/accton/x86_64-accton_as4630_54te-r0/platform.json +@@ -0,0 +1,820 @@ ++{ ++ "chassis": { ++ "name": "AS4630-54TE", ++ "thermal_manager":false, ++ "status_led": { ++ "controllable": true, ++ "colors": ["STATUS_LED_COLOR_GREEN", "STATUS_LED_COLOR_GREEN_BLINK", "STATUS_LED_COLOR_AMBER", "STATUS_LED_COLOR_OFF"] ++ }, ++ "components": [ ++ { ++ "name": "CPLD1" ++ }, ++ { ++ "name": "CPLD2" ++ }, ++ { ++ "name": "BIOS" ++ } ++ ], ++ "fans": [ ++ { ++ "name": "FAN-1", ++ "speed": { ++ "controllable": true, ++ "minimum": 7 ++ }, ++ "status_led": { ++ "controllable": false ++ } ++ }, ++ { ++ "name": "FAN-2", ++ "speed": { ++ "controllable": true, ++ "minimum": 7 ++ }, ++ "status_led": { ++ "controllable": false ++ } ++ }, ++ { ++ "name": "FAN-3", ++ "speed": { ++ "controllable": true, ++ "minimum": 7 ++ }, ++ "status_led": { ++ "controllable": false ++ } ++ } ++ ], ++ "fan_drawers":[ ++ { ++ "name": "FanTray1", ++ "status_led": { ++ "controllable": false ++ }, ++ "num_fans" : 1, ++ "fans": [ ++ { ++ "name": "FAN-1", ++ "speed": { ++ "controllable": true, ++ "minimum": 7 ++ }, ++ "status_led": { ++ "controllable": false ++ } ++ } ++ ] ++ }, ++ { ++ "name": "FanTray2", ++ "status_led": { ++ "controllable": false ++ }, ++ "num_fans" : 1, ++ "fans": [ ++ { ++ "name": "FAN-2", ++ "speed": { ++ "controllable": true, ++ "minimum": 7 ++ }, ++ "status_led": { ++ "controllable": false ++ } ++ } ++ ] ++ }, ++ { ++ "name": "FanTray3", ++ "status_led": { ++ "controllable": false ++ }, ++ "num_fans" : 1, ++ "fans": [ ++ { ++ "name": "FAN-3", ++ "speed": { ++ "controllable": true, ++ "minimum": 7 ++ }, ++ "status_led": { ++ "controllable": false ++ } ++ } ++ ] ++ } ++ ], ++ "psus": [ ++ { ++ "name": "PSU-1", ++ "status_led": { ++ "controllable": true, ++ "colors": ["STATUS_LED_COLOR_GREEN", "STATUS_LED_COLOR_AMBER", "STATUS_LED_COLOR_OFF"] ++ }, ++ "fans": [ ++ { ++ "name": "PSU-1 FAN-1" ++ } ++ ], ++ "thermals": [ ++ { ++ "name": "PSU-1 temp sensor 1", ++ "controllable": false, ++ "low-crit-threshold": false, ++ "high-crit-threshold": false ++ } ++ ] ++ }, ++ { ++ "name": "PSU-2", ++ "status_led": { ++ "controllable": true, ++ "colors": ["STATUS_LED_COLOR_GREEN", "STATUS_LED_COLOR_AMBER", "STATUS_LED_COLOR_OFF"] ++ }, ++ "fans": [ ++ { ++ "name": "PSU-2 FAN-1" ++ } ++ ], ++ "thermals": [ ++ { ++ "name": "PSU-2 temp sensor 1", ++ "controllable": false, ++ "low-crit-threshold": false, ++ "high-crit-threshold": false ++ } ++ ] ++ } ++ ], ++ "thermals": [ ++ { ++ "name": "MB_temp(0x48)", ++ "controllable": true, ++ "low-threshold": false, ++ "high-threshold": true, ++ "low-crit-threshold": false, ++ "high-crit-threshold": false ++ }, ++ { ++ "name": "CB_temp(0x4B)", ++ "controllable": true, ++ "low-threshold": false, ++ "high-threshold": true, ++ "low-crit-threshold": false, ++ "high-crit-threshold": false ++ }, ++ { ++ "name": "FB_temp(0x4A)", ++ "controllable": true, ++ "low-threshold": false, ++ "high-threshold": true, ++ "low-crit-threshold": false, ++ "high-crit-threshold": false ++ }, ++ { ++ "name": "CPU_Package_temp", ++ "controllable": false, ++ "low-threshold": false, ++ "high-threshold": true, ++ "low-crit-threshold": false, ++ "high-crit-threshold": true ++ }, ++ { ++ "name": "CPU_Core_0_temp", ++ "controllable": false, ++ "low-threshold": false, ++ "high-threshold": true, ++ "low-crit-threshold": false, ++ "high-crit-threshold": true ++ }, ++ { ++ "name": "CPU_Core_1_temp", ++ "controllable": false, ++ "low-threshold": false, ++ "high-threshold": true, ++ "low-crit-threshold": false, ++ "high-crit-threshold": true ++ }, ++ { ++ "name": "CPU_Core_2_temp", ++ "controllable": false, ++ "low-threshold": false, ++ "high-threshold": true, ++ "low-crit-threshold": false, ++ "high-crit-threshold": true ++ }, ++ { ++ "name": "CPU_Core_3_temp", ++ "controllable": false, ++ "low-threshold": false, ++ "high-threshold": true, ++ "low-crit-threshold": false, ++ "high-crit-threshold": true ++ } ++ ], ++ "sfps": [ ++ { ++ "name": "Ethernet0" ++ }, ++ { ++ "name": "Ethernet1" ++ }, ++ { ++ "name": "Ethernet2" ++ }, ++ { ++ "name": "Ethernet3" ++ }, ++ { ++ "name": "Ethernet4" ++ }, ++ { ++ "name": "Ethernet5" ++ }, ++ { ++ "name": "Ethernet6" ++ }, ++ { ++ "name": "Ethernet7" ++ }, ++ { ++ "name": "Ethernet8" ++ }, ++ { ++ "name": "Ethernet9" ++ }, ++ { ++ "name": "Ethernet10" ++ }, ++ { ++ "name": "Ethernet11" ++ }, ++ { ++ "name": "Ethernet12" ++ }, ++ { ++ "name": "Ethernet13" ++ }, ++ { ++ "name": "Ethernet14" ++ }, ++ { ++ "name": "Ethernet15" ++ }, ++ { ++ "name": "Ethernet16" ++ }, ++ { ++ "name": "Ethernet17" ++ }, ++ { ++ "name": "Ethernet18" ++ }, ++ { ++ "name": "Ethernet19" ++ }, ++ { ++ "name": "Ethernet20" ++ }, ++ { ++ "name": "Ethernet21" ++ }, ++ { ++ "name": "Ethernet22" ++ }, ++ { ++ "name": "Ethernet23" ++ }, ++ { ++ "name": "Ethernet24" ++ }, ++ { ++ "name": "Ethernet25" ++ }, ++ { ++ "name": "Ethernet26" ++ }, ++ { ++ "name": "Ethernet27" ++ }, ++ { ++ "name": "Ethernet28" ++ }, ++ { ++ "name": "Ethernet29" ++ }, ++ { ++ "name": "Ethernet30" ++ }, ++ { ++ "name": "Ethernet31" ++ }, ++ { ++ "name": "Ethernet32" ++ }, ++ { ++ "name": "Ethernet33" ++ }, ++ { ++ "name": "Ethernet34" ++ }, ++ { ++ "name": "Ethernet35" ++ }, ++ { ++ "name": "Ethernet36" ++ }, ++ { ++ "name": "Ethernet37" ++ }, ++ { ++ "name": "Ethernet38" ++ }, ++ { ++ "name": "Ethernet39" ++ }, ++ { ++ "name": "Ethernet40" ++ }, ++ { ++ "name": "Ethernet41" ++ }, ++ { ++ "name": "Ethernet42" ++ }, ++ { ++ "name": "Ethernet43" ++ }, ++ { ++ "name": "Ethernet44" ++ }, ++ { ++ "name": "Ethernet45" ++ }, ++ { ++ "name": "Ethernet46" ++ }, ++ { ++ "name": "Ethernet47" ++ }, ++ { ++ "name": "Ethernet48" ++ }, ++ { ++ "name": "Ethernet49" ++ }, ++ { ++ "name": "Ethernet50" ++ }, ++ { ++ "name": "Ethernet51" ++ }, ++ { ++ "name": "Ethernet52" ++ }, ++ { ++ "name": "Ethernet56" ++ } ++ ] ++ }, ++ "interfaces": { ++ "Ethernet0": { ++ "index": "1", ++ "lanes": "26", ++ "breakout_modes": { ++ "1x1G": ["Eth1(Port1)"] ++ } ++ }, ++ ++ "Ethernet1": { ++ "index": "2", ++ "lanes": "25", ++ "breakout_modes": { ++ "1x1G": ["Eth2(Port2)"] ++ } ++ }, ++ ++ "Ethernet2": { ++ "index": "3", ++ "lanes": "28", ++ "breakout_modes": { ++ "1x1G": ["Eth3(Port3)"] ++ } ++ }, ++ ++ "Ethernet3": { ++ "index": "4", ++ "lanes": "27", ++ "breakout_modes": { ++ "1x1G": ["Eth4(Port4)"] ++ } ++ }, ++ ++ "Ethernet4": { ++ "index": "5", ++ "lanes": "30", ++ "breakout_modes": { ++ "1x1G": ["Eth5(Port5)"] ++ } ++ }, ++ ++ "Ethernet5": { ++ "index": "6", ++ "lanes": "29", ++ "breakout_modes": { ++ "1x1G": ["Eth6(Port6)"] ++ } ++ }, ++ ++ "Ethernet6": { ++ "index": "7", ++ "lanes": "32", ++ "breakout_modes": { ++ "1x1G": ["Eth7(Port7)"] ++ } ++ }, ++ ++ "Ethernet7": { ++ "index": "8", ++ "lanes": "31", ++ "breakout_modes": { ++ "1x1G": ["Eth8(Port8)"] ++ } ++ }, ++ ++ "Ethernet8": { ++ "index": "9", ++ "lanes": "38", ++ "breakout_modes": { ++ "1x1G": ["Eth9(Port9)"] ++ } ++ }, ++ ++ "Ethernet9": { ++ "index": "10", ++ "lanes": "37", ++ "breakout_modes": { ++ "1x1G": ["Eth10(Port10)"] ++ } ++ }, ++ ++ "Ethernet10": { ++ "index": "11", ++ "lanes": "40", ++ "breakout_modes": { ++ "1x1G": ["Eth11(Port11)"] ++ } ++ }, ++ ++ "Ethernet11": { ++ "index": "12", ++ "lanes": "39", ++ "breakout_modes": { ++ "1x1G": ["Eth12(Port12)"] ++ } ++ }, ++ ++ "Ethernet12": { ++ "index": "13", ++ "lanes": "34", ++ "breakout_modes": { ++ "1x1G": ["Eth13(Port13)"] ++ } ++ }, ++ ++ "Ethernet13": { ++ "index": "14", ++ "lanes": "33", ++ "breakout_modes": { ++ "1x1G": ["Eth14(Port14)"] ++ } ++ }, ++ ++ "Ethernet14": { ++ "index": "15", ++ "lanes": "36", ++ "breakout_modes": { ++ "1x1G": ["Eth15(Port15)"] ++ } ++ }, ++ ++ "Ethernet15": { ++ "index": "16", ++ "lanes": "35", ++ "breakout_modes": { ++ "1x1G": ["Eth16(Port16)"] ++ } ++ }, ++ ++ "Ethernet16": { ++ "index": "17", ++ "lanes": "46", ++ "breakout_modes": { ++ "1x1G": ["Eth17(Port17)"] ++ } ++ }, ++ ++ "Ethernet17": { ++ "index": "18", ++ "lanes": "45", ++ "breakout_modes": { ++ "1x1G": ["Eth18(Port18)"] ++ } ++ }, ++ ++ "Ethernet18": { ++ "index": "19", ++ "lanes": "48", ++ "breakout_modes": { ++ "1x1G": ["Eth19(Port19)"] ++ } ++ }, ++ ++ "Ethernet19": { ++ "index": "20", ++ "lanes": "47", ++ "breakout_modes": { ++ "1x1G": ["Eth20(Port20)"] ++ } ++ }, ++ ++ "Ethernet20": { ++ "index": "21", ++ "lanes": "42", ++ "breakout_modes": { ++ "1x1G": ["Eth21(Port21)"] ++ } ++ }, ++ ++ "Ethernet21": { ++ "index": "22", ++ "lanes": "41", ++ "breakout_modes": { ++ "1x1G": ["Eth22(Port22)"] ++ } ++ }, ++ ++ "Ethernet22": { ++ "index": "23", ++ "lanes": "44", ++ "breakout_modes": { ++ "1x1G": ["Eth23(Port23)"] ++ } ++ }, ++ ++ "Ethernet23": { ++ "index": "24", ++ "lanes": "43", ++ "breakout_modes": { ++ "1x1G": ["Eth24(Port24)"] ++ } ++ }, ++ ++ "Ethernet24": { ++ "index": "25", ++ "lanes": "2", ++ "breakout_modes": { ++ "1x1G": ["Eth25(Port25)"] ++ } ++ }, ++ ++ "Ethernet25": { ++ "index": "26", ++ "lanes": "1", ++ "breakout_modes": { ++ "1x1G": ["Eth26(Port26)"] ++ } ++ }, ++ ++ "Ethernet26": { ++ "index": "27", ++ "lanes": "4", ++ "breakout_modes": { ++ "1x1G": ["Eth27(Port27)"] ++ } ++ }, ++ ++ "Ethernet27": { ++ "index": "28", ++ "lanes": "3", ++ "breakout_modes": { ++ "1x1G": ["Eth28(Port28)"] ++ } ++ }, ++ ++ "Ethernet28": { ++ "index": "29", ++ "lanes": "6", ++ "breakout_modes": { ++ "1x1G": ["Eth29(Port29)"] ++ } ++ }, ++ ++ "Ethernet29": { ++ "index": "30", ++ "lanes": "5", ++ "breakout_modes": { ++ "1x1G": ["Eth30(Port30)"] ++ } ++ }, ++ ++ "Ethernet30": { ++ "index": "31", ++ "lanes": "8", ++ "breakout_modes": { ++ "1x1G": ["Eth31(Port31)"] ++ } ++ }, ++ ++ "Ethernet31": { ++ "index": "32", ++ "lanes": "7", ++ "breakout_modes": { ++ "1x1G": ["Eth32(Port32)"] ++ } ++ }, ++ ++ "Ethernet32": { ++ "index": "33", ++ "lanes": "10", ++ "breakout_modes": { ++ "1x1G": ["Eth33(Port33)"] ++ } ++ }, ++ ++ "Ethernet33": { ++ "index": "34", ++ "lanes": "9", ++ "breakout_modes": { ++ "1x1G": ["Eth34(Port34)"] ++ } ++ }, ++ ++ "Ethernet34": { ++ "index": "35", ++ "lanes": "12", ++ "breakout_modes": { ++ "1x1G": ["Eth35(Port35)"] ++ } ++ }, ++ ++ "Ethernet35": { ++ "index": "36", ++ "lanes": "11", ++ "breakout_modes": { ++ "1x1G": ["Eth36(Port36)"] ++ } ++ }, ++ ++ "Ethernet36": { ++ "index": "37", ++ "lanes": "14", ++ "breakout_modes": { ++ "1x1G": ["Eth37(Port37)"] ++ } ++ }, ++ ++ "Ethernet37": { ++ "index": "38", ++ "lanes": "13", ++ "breakout_modes": { ++ "1x1G": ["Eth38(Port38)"] ++ } ++ }, ++ ++ "Ethernet38": { ++ "index": "39", ++ "lanes": "16", ++ "breakout_modes": { ++ "1x1G": ["Eth39(Port39)"] ++ } ++ }, ++ ++ "Ethernet39": { ++ "index": "40", ++ "lanes": "15", ++ "breakout_modes": { ++ "1x1G": ["Eth40(Port40)"] ++ } ++ }, ++ ++ "Ethernet40": { ++ "index": "41", ++ "lanes": "18", ++ "breakout_modes": { ++ "1x1G": ["Eth41(Port41)"] ++ } ++ }, ++ ++ "Ethernet41": { ++ "index": "42", ++ "lanes": "17", ++ "breakout_modes": { ++ "1x1G": ["Eth42(Port42)"] ++ } ++ }, ++ ++ "Ethernet42": { ++ "index": "43", ++ "lanes": "20", ++ "breakout_modes": { ++ "1x1G": ["Eth43(Port43)"] ++ } ++ }, ++ ++ "Ethernet43": { ++ "index": "44", ++ "lanes": "19", ++ "breakout_modes": { ++ "1x1G": ["Eth44(Port44)"] ++ } ++ }, ++ ++ "Ethernet44": { ++ "index": "45", ++ "lanes": "22", ++ "breakout_modes": { ++ "1x1G": ["Eth45(Port45)"] ++ } ++ }, ++ ++ "Ethernet45": { ++ "index": "46", ++ "lanes": "21", ++ "breakout_modes": { ++ "1x1G": ["Eth46(Port46)"] ++ } ++ }, ++ ++ "Ethernet46": { ++ "index": "47", ++ "lanes": "24", ++ "breakout_modes": { ++ "1x1G": ["Eth47(Port47)"] ++ } ++ }, ++ ++ "Ethernet47": { ++ "index": "48", ++ "lanes": "23", ++ "breakout_modes": { ++ "1x1G": ["Eth48(Port48)"] ++ } ++ }, ++ ++ "Ethernet48": { ++ "index": "49", ++ "lanes": "67", ++ "breakout_modes": { ++ "1x25G[10G]": ["Eth49(Port49)"] ++ } ++ }, ++ ++ "Ethernet49": { ++ "index": "50", ++ "lanes": "66", ++ "breakout_modes": { ++ "1x25G[10G]": ["Eth50(Port50)"] ++ } ++ }, ++ ++ "Ethernet50": { ++ "index": "51", ++ "lanes": "65", ++ "breakout_modes": { ++ "1x25G[10G]": ["Eth51(Port51)"] ++ } ++ }, ++ ++ "Ethernet51": { ++ "index": "52", ++ "lanes": "68", ++ "breakout_modes": { ++ "1x25G[10G]": ["Eth52(Port52)"] ++ } ++ }, ++ "Ethernet52": { ++ "index": "53,53,53,53", ++ "lanes": "73,74,75,76", ++ "breakout_modes": { ++ "1x100G[40G]": ["Eth53(Port53)"], ++ "2x50G": ["Eth53/1(Port53)", "Eth53/2(Port53)"], ++ "4x25G[10G]": ["Eth53/1(Port53)", "Eth53/2(Port53)", "Eth53/3(Port53)", "Eth53/4(Port53)"] ++ } ++ }, ++ ++ "Ethernet56": { ++ "index": "54,54,54,54", ++ "lanes": "69,70,71,72", ++ "breakout_modes": { ++ "1x100G[40G]": ["Eth54(Port54)"], ++ "2x50G": ["Eth54/1(Port54)", "Eth54/2(Port54)"], ++ "4x25G[10G]": ["Eth54/1(Port54)", "Eth54/2(Port54)", "Eth54/3(Port54)", "Eth54/4(Port54)"] ++ } ++ } ++ } ++} +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/platform_components.json b/device/accton/x86_64-accton_as4630_54te-r0/platform_components.json +new file mode 100644 +index 000000000..5e70a87a4 +--- /dev/null ++++ b/device/accton/x86_64-accton_as4630_54te-r0/platform_components.json +@@ -0,0 +1,11 @@ ++{ ++ "chassis": { ++ "AS4630-54TE-O-AC-F": { ++ "component": { ++ "CPLD1": { }, ++ "CPLD2": { }, ++ "BIOS": { } ++ } ++ } ++ } ++} +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/plugins/eeprom.py b/device/accton/x86_64-accton_as4630_54te-r0/plugins/eeprom.py +deleted file mode 100755 +index 7409239d0..000000000 +--- a/device/accton/x86_64-accton_as4630_54te-r0/plugins/eeprom.py ++++ /dev/null +@@ -1,13 +0,0 @@ +-try: +- from sonic_eeprom import eeprom_tlvinfo +- +-except ImportError as e: +- raise ImportError(str(e) + "- required module not found") +- +- +-class board(eeprom_tlvinfo.TlvInfoDecoder): +- _TLV_INFO_MAX_LEN = 256 +- +- def __init__(self, name, path, cpld_root, ro): +- self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom" +- super(board, self).__init__(self.eeprom_path, 0, '', True) +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/plugins/psuutil.py b/device/accton/x86_64-accton_as4630_54te-r0/plugins/psuutil.py +deleted file mode 100755 +index 92ae68eb8..000000000 +--- a/device/accton/x86_64-accton_as4630_54te-r0/plugins/psuutil.py ++++ /dev/null +@@ -1,61 +0,0 @@ +-#!/usr/bin/env python +- +-############################################################################# +-# Accton +-# +-# Module contains an implementation of SONiC PSU Base API and +-# provides the PSUs status which are available in the platform +-# +-############################################################################# +- +- +-try: +- from sonic_psu.psu_base import PsuBase +-except ImportError as e: +- raise ImportError(str(e) + "- required module not found") +- +- +-class PsuUtil(PsuBase): +- """Platform-specific PSUutil class""" +- +- def __init__(self): +- PsuBase.__init__(self) +- +- self.psu_path = "/sys/bus/i2c/devices/" +- self.psu_presence = "/psu_present" +- self.psu_oper_status = "/psu_power_good" +- self.psu_mapping = { +- 1: "10-0050", +- 2: "11-0051", +- } +- +- def get_num_psus(self): +- return len(self.psu_mapping) +- +- def get_psu_status(self, index): +- if index is None: +- return False +- +- status = 0 +- node = self.psu_path + self.psu_mapping[index] + self.psu_oper_status +- try: +- with open(node, 'r') as power_status: +- status = int(power_status.read()) +- except IOError: +- return False +- +- return status == 1 +- +- def get_psu_presence(self, index): +- if index is None: +- return False +- +- status = 0 +- node = self.psu_path + self.psu_mapping[index] + self.psu_presence +- try: +- with open(node, 'r') as presence_status: +- status = int(presence_status.read()) +- except IOError: +- return False +- +- return status == 1 +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as4630_54te-r0/plugins/sfputil.py +deleted file mode 100755 +index 63e6bd536..000000000 +--- a/device/accton/x86_64-accton_as4630_54te-r0/plugins/sfputil.py ++++ /dev/null +@@ -1,196 +0,0 @@ +-# sfputil.py +-# +-# Platform-specific SFP transceiver interface for SONiC +-# +- +-try: +- import sys +- import time +- from ctypes import create_string_buffer +- from sonic_sfp.sfputilbase import SfpUtilBase +-except ImportError as e: +- raise ImportError("%s - required module not found" % str(e)) +- +-SFP_STATUS_INSERTED = '1' +-SFP_STATUS_REMOVED = '0' +- +- +-class SfpUtil(SfpUtilBase): +- """Platform-specific SfpUtil class""" +- +- PORT_START = 49 +- PORT_END = 54 +- PORTS_IN_BLOCK = 54 +- QSFP_START = 53 +- +- BASE_OOM_PATH = "/sys/bus/i2c/devices/{0}-0050/" +- BASE_CPLD_PATH = "/sys/bus/i2c/devices/3-0060/" +- +- _port_to_is_present = {} +- _port_to_lp_mode = {} +- +- _port_to_eeprom_mapping = {} +- _port_to_i2c_mapping = { +- 49: [18], +- 50: [19], +- 51: [20], +- 52: [21], +- 53: [22], +- 54: [23], +- } +- +- @property +- def port_start(self): +- return self.PORT_START +- +- @property +- def port_end(self): +- return self.PORT_END +- +- @property +- def qsfp_ports(self): +- return range(self.PORT_START, self.PORTS_IN_BLOCK + 1) +- +- @property +- def port_to_eeprom_mapping(self): +- return self._port_to_eeprom_mapping +- +- def __init__(self): +- eeprom_path = self.BASE_OOM_PATH + "eeprom" +- for x in range(self.port_start, self.port_end + 1): +- self.port_to_eeprom_mapping[x] = eeprom_path.format( +- self._port_to_i2c_mapping[x][0]) +- SfpUtilBase.__init__(self) +- +- def get_presence(self, port_num): +- # Check for invalid port_num +- if port_num < self.port_start or port_num > self.port_end: +- return False +- +- present_path = self.BASE_CPLD_PATH + "module_present_" + str(port_num) +- self.__port_to_is_present = present_path +- +- try: +- val_file = open(self.__port_to_is_present) +- content = val_file.readline().rstrip() +- val_file.close() +- except IOError as e: +- print ('Error: unable to access file: %s') % str(e) +- return False +- +- if content == "1": +- return True +- +- return False +- +- def get_low_power_mode(self, port_num): +- # Check for invalid port_num +- if port_num < self.QSFP_START or port_num > self.port_end: +- return False +- +- try: +- eeprom = None +- if not self.get_presence(port_num): +- return False +- eeprom = open(self.port_to_eeprom_mapping[port_num], "rb") +- eeprom.seek(93) +- lpmode = ord(eeprom.read(1)) +- +- # if "Power override" bit is 1 and "Power set" bit is 1 +- if ((lpmode & 0x3) == 0x3): +- return True +- +- # High Power Mode if one of the following conditions is matched: +- # 1. "Power override" bit is 0 +- # 2. "Power override" bit is 1 and "Power set" bit is 0 +- else: +- return False +- +- except IOError as e: +- print ('Error: unable to open file: %s') % str(e) +- return False +- finally: +- if eeprom is not None: +- eeprom.close() +- time.sleep(0.01) +- +- def set_low_power_mode(self, port_num, lpmode): +- # Check for invalid port_num +- if port_num < self.QSFP_START or port_num > self.port_end: +- return False +- +- try: +- eeprom = None +- if not self.get_presence(port_num): +- return False # Port is not present, unable to set the eeprom +- +- # Fill in write buffer +- # 0x3:Low Power Mode, 0x1:High Power Mode +- regval = 0x3 if lpmode else 0x1 +- +- buffer = create_string_buffer(1) +- 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], "r+b") +- eeprom.seek(93) +- eeprom.write(buffer[0]) +- return True +- except IOError as e: +- print ('Error: unable to open file: %s') % str(e) +- return False +- finally: +- if eeprom is not None: +- eeprom.close() +- time.sleep(0.01) +- +- def reset(self, port_num): +- raise NotImplementedError +- +- @property +- def _get_presence_bitmap(self): +- +- bits = [] +- for x in range(self.port_start, self.port_end + 1): +- bits.append(str(int(self.get_presence(x)))) +- +- rev = "".join(bits[::-1]) +- return int(rev, 2) +- +- data = {'present': 0} +- +- def get_transceiver_change_event(self, timeout=0): +- port_dict = {} +- +- if timeout == 0: +- cd_ms = sys.maxsize +- else: +- cd_ms = timeout +- +- # poll per second +- while cd_ms > 0: +- reg_value = self._get_presence_bitmap +- changed_ports = self.data['present'] ^ reg_value +- if changed_ports != 0: +- break +- time.sleep(1) +- cd_ms = cd_ms - 1000 +- +- if changed_ports != 0: +- for port in range(self.port_start, self.port_end + 1): +- # Mask off the bit corresponding to our port +- mask = (1 << (port - self.port_start)) +- if changed_ports & mask: +- if (reg_value & mask) == 0: +- port_dict[port] = SFP_STATUS_REMOVED +- else: +- port_dict[port] = SFP_STATUS_INSERTED +- +- # Update cache +- self.data['present'] = reg_value +- return True, port_dict +- else: +- return True, {} +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/plugins/ssd_util.py b/device/accton/x86_64-accton_as4630_54te-r0/plugins/ssd_util.py +new file mode 100755 +index 000000000..4b173c5e3 +--- /dev/null ++++ b/device/accton/x86_64-accton_as4630_54te-r0/plugins/ssd_util.py +@@ -0,0 +1,24 @@ ++# ssd_util.py ++# ++# Platform-specific SSD interface for SONiC ++## ++ ++try: ++ from sonic_platform_base.sonic_ssd.ssd_generic import SsdUtil as MainSsdUtil ++except ImportError as e: ++ raise ImportError (str(e) + "- required module not found") ++ ++NOT_AVAILABLE = "N/A" ++ ++class SsdUtil(MainSsdUtil): ++ """Platform-specific SsdUtil class""" ++ ++ def __init__(self, diskdev): ++ super(SsdUtil, self).__init__(diskdev) ++ ++ # If it has no vendor tool to read SSD information, ++ # ssd_util.py will use generic SSD information ++ # for vendor SSD information. ++ if self.vendor_ssd_info == NOT_AVAILABLE: ++ self.vendor_ssd_info = self.ssd_info ++ +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/pmon_daemon_control.json b/device/accton/x86_64-accton_as4630_54te-r0/pmon_daemon_control.json +index a3b204e20..44bad6494 100644 +--- a/device/accton/x86_64-accton_as4630_54te-r0/pmon_daemon_control.json ++++ b/device/accton/x86_64-accton_as4630_54te-r0/pmon_daemon_control.json +@@ -1,5 +1,4 @@ + { +- "skip_ledd": true, +- "skip_pcied": true ++ "skip_ledd": true + } + +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sensors.conf b/device/accton/x86_64-accton_as4630_54te-r0/sensors.conf +index b22fff04d..cbb82e0df 100644 +--- a/device/accton/x86_64-accton_as4630_54te-r0/sensors.conf ++++ b/device/accton/x86_64-accton_as4630_54te-r0/sensors.conf +@@ -31,10 +31,10 @@ chip "as4630_54te_cpld-*" + + + chip "lm77-i2c-*-48" +- label temp1 "Main Board Temperature" ++ label temp1 "MB_temp" + + chip "lm75-i2c-*-4a" +- label temp1 "Fan Board Temperature" ++ label temp1 "FB_temp" + + chip "lm75-i2c-*-4b" +- label temp1 "CPU Board Temperature" ++ label temp1 "CB_temp" +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/chassis.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/chassis.py +index 9f39c903c..9ec4c7ccf 100644 +--- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/chassis.py ++++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/chassis.py +@@ -6,27 +6,27 @@ + # + ############################################################################# + +-import subprocess +- + try: ++ import sys + from sonic_platform_base.chassis_base import ChassisBase + from .helper import APIHelper ++ from .event import SfpEvent + except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + NUM_FAN_TRAY = 3 + NUM_FAN = 2 + NUM_PSU = 2 +-NUM_THERMAL = 3 ++NUM_THERMAL = 8 + NUM_QSFP = 6 + PORT_START = 49 + PORT_END = 54 +-NUM_COMPONENT = 2 ++NUM_COMPONENT = 3 + HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/" + PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" + REBOOT_CAUSE_FILE = "reboot-cause.txt" + PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" +-HOST_CHK_CMD = ["docker"] ++HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" + SYSLED_FNODE = "/sys/class/leds/diag/brightness" + SYSLED_MODES = { + "0" : "STATUS_LED_COLOR_OFF", +@@ -42,7 +42,6 @@ class Chassis(ChassisBase): + def __init__(self): + ChassisBase.__init__(self) + self._api_helper = APIHelper() +- self._api_helper = APIHelper() + self.is_host = self._api_helper.is_host() + + self.config_data = {} +@@ -59,6 +58,7 @@ class Chassis(ChassisBase): + for index in range(0, PORT_END): + sfp = Sfp(index) + self._sfp_list.append(sfp) ++ self._sfpevent = SfpEvent(self._sfp_list) + self.sfp_module_initialized = True + + def __initialize_fan(self): +@@ -89,23 +89,6 @@ class Chassis(ChassisBase): + component = Component(index) + self._component_list.append(component) + +- def __initialize_watchdog(self): +- from sonic_platform.watchdog import Watchdog +- self._watchdog = Watchdog() +- +- +- def __is_host(self): +- return subprocess.call(HOST_CHK_CMD) == 0 +- +- 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 None +- + def get_name(self): + """ + Retrieves the name of the device +@@ -113,7 +96,7 @@ class Chassis(ChassisBase): + string: The name of the device + """ + +- return self._api_helper.hwsku ++ return self._eeprom.get_modelstr() + + def get_presence(self): + """ +@@ -176,6 +159,12 @@ class Chassis(ChassisBase): + + return ('REBOOT_CAUSE_NON_HARDWARE', sw_reboot_cause) + ++ def get_change_event(self, timeout=0): ++ # SFP event ++ if not self.sfp_module_initialized: ++ self.__initialize_sfp() ++ return self._sfpevent.get_sfp_event(timeout) ++ + def get_sfp(self, index): + """ + Retrieves sfp represented by (1-based) index +@@ -234,3 +223,28 @@ class Chassis(ChassisBase): + return False + else: + return self._api_helper.write_txt_file(SYSLED_FNODE, mode) ++ ++ def get_model(self): ++ """ ++ Retrieves the model number (or part number) of the device ++ Returns: ++ string: Model/part number of device ++ """ ++ return self._eeprom.get_pn() ++ ++ def get_serial(self): ++ """ ++ Retrieves the serial number of the device ++ Returns: ++ string: Serial number of device ++ """ ++ return self._eeprom.get_serial() ++ ++ def get_revision(self): ++ """ ++ Retrieves the hardware revision of the device ++ ++ Returns: ++ string: Revision value of device ++ """ ++ return self._eeprom.get_revisionstr() +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/component.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/component.py +index 8137d0f3a..f5dafd007 100644 +--- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/component.py ++++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/component.py +@@ -6,10 +6,12 @@ + # + ############################################################################# + +- + try: ++ import os ++ import json + from sonic_platform_base.component_base import ComponentBase + from .helper import APIHelper ++ from sonic_py_common.general import getstatusoutput_noshell + except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +@@ -20,6 +22,7 @@ SYSFS_PATH = "/sys/bus/i2c/devices/" + BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version" + COMPONENT_LIST= [ + ("CPLD1", "CPLD 1"), ++ ("CPLD2", "CPLD CPU"), + ("BIOS", "Basic Input/Output System") + + ] +@@ -58,6 +61,15 @@ class Component(ComponentBase): + + return cpld_version + ++ def __get_cpldcpu_version(self): ++ cpld_version = dict() ++ cmd = ["i2cget", "-y", "1", "0x65", "0x01"] ++ status, output1 = getstatusoutput_noshell(cmd) ++ cmd = ["i2cget", "-y", "1", "0x65", "0x02"] ++ status, output2 = getstatusoutput_noshell(cmd) ++ cpld_version[self.name] = "{}{}{}".format(int(output1,16),".",int(output2,16)) ++ return cpld_version ++ + def get_name(self): + """ + Retrieves the name of the component +@@ -85,9 +97,12 @@ class Component(ComponentBase): + + if self.name == "BIOS": + fw_version = self.__get_bios_version() +- elif "CPLD" in self.name: ++ elif self.name == "CPLD1": + cpld_version = self.__get_cpld_version() + fw_version = cpld_version.get(self.name) ++ elif self.name == "CPLD2": ++ cpld_version = self.__get_cpldcpu_version() ++ fw_version = cpld_version.get(self.name) + + return fw_version + +@@ -99,4 +114,85 @@ class Component(ComponentBase): + Returns: + A boolean, True if install successfully, False if not + """ +- raise NotImplementedError ++ ret, output = getstatusoutput_noshell(["tar", "-C", "/tmp", "-xzf", image_path ] ) ++ if ret != 0 : ++ print("Installation failed because of wrong image package") ++ return False ++ ++ if False == os.path.exists("/tmp/install.json") : ++ print("Installation failed without jsonfile") ++ return False ++ ++ input_file = open ('/tmp/install.json') ++ json_array = json.load(input_file) ++ ret = 1 ++ for item in json_array: ++ if item.get('id')==None or item.get('path')==None: ++ continue ++ if self.name == item['id'] and item['path'] and item.get('cpu'): ++ print( "Find", item['id'], item['path'], item['cpu'] ) ++ ret, output = getstatusoutput_noshell(["/tmp/run_install.sh", item['id'], item['path'], item['cpu'] ]) ++ if ret==0: ++ break ++ elif self.name == item['id'] and item['path']: ++ print( "Find", item['id'], item['path'] ) ++ ret, output = getstatusoutput_noshell(["/tmp/run_install.sh", item['id'], item['path'] ]) ++ if ret==0: ++ break ++ ++ if ret==0: ++ return True ++ else : ++ return False ++ ++ def get_presence(self): ++ """ ++ Retrieves the presence of the device ++ Returns: ++ bool: True if device is present, False if not ++ """ ++ return True ++ ++ def get_model(self): ++ """ ++ Retrieves the model number (or part number) of the device ++ Returns: ++ string: Model/part number of device ++ """ ++ return 'N/A' ++ ++ def get_serial(self): ++ """ ++ Retrieves the serial number of the device ++ Returns: ++ string: Serial number of device ++ """ ++ return 'N/A' ++ ++ def get_status(self): ++ """ ++ Retrieves the operational status of the device ++ Returns: ++ A boolean value, True if device is operating properly, False if not ++ """ ++ return True ++ ++ def get_position_in_parent(self): ++ """ ++ Retrieves 1-based relative physical position in parent device. ++ If the agent cannot determine the parent-relative position ++ for some reason, or if the associated value of ++ entPhysicalContainedIn is'0', then the value '-1' is returned ++ Returns: ++ integer: The 1-based relative physical position in parent device ++ or -1 if cannot determine the position ++ """ ++ return -1 ++ ++ def is_replaceable(self): ++ """ ++ Indicate whether this device is replaceable. ++ Returns: ++ bool: True if it is replaceable. ++ """ ++ return False +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/eeprom.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/eeprom.py +index 7bf2bb58d..f3bc202eb 100644 +--- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/eeprom.py ++++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/eeprom.py +@@ -13,7 +13,7 @@ except ImportError as e: + + CACHE_ROOT = '/var/cache/sonic/decode-syseeprom' + CACHE_FILE = 'syseeprom_cache' +- ++NULL = 'N/A' + + class Tlv(eeprom_tlvinfo.TlvInfoDecoder): + +@@ -33,7 +33,7 @@ class Tlv(eeprom_tlvinfo.TlvInfoDecoder): + for line in lines: + try: + match = re.search( +- '(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)([\S]+)', line) ++ '(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)(.+)', line) + if match is not None: + idx = match.group(1) + value = match.group(3).rstrip('\0') +@@ -92,11 +92,46 @@ class Tlv(eeprom_tlvinfo.TlvInfoDecoder): + + return self.__parse_output(decode_output) + ++ def _valid_tlv(self, eeprom_data): ++ tlvinfo_type_codes_list = [ ++ self._TLV_CODE_PRODUCT_NAME, ++ self._TLV_CODE_PART_NUMBER, ++ self._TLV_CODE_SERIAL_NUMBER, ++ self._TLV_CODE_MAC_BASE, ++ self._TLV_CODE_MANUF_DATE, ++ self._TLV_CODE_DEVICE_VERSION, ++ self._TLV_CODE_LABEL_REVISION, ++ self._TLV_CODE_PLATFORM_NAME, ++ self._TLV_CODE_ONIE_VERSION, ++ self._TLV_CODE_MAC_SIZE, ++ self._TLV_CODE_MANUF_NAME, ++ self._TLV_CODE_MANUF_COUNTRY, ++ self._TLV_CODE_VENDOR_NAME, ++ self._TLV_CODE_DIAG_VERSION, ++ self._TLV_CODE_SERVICE_TAG, ++ self._TLV_CODE_VENDOR_EXT, ++ self._TLV_CODE_CRC_32 ++ ] ++ ++ for code in tlvinfo_type_codes_list: ++ code_str = "0x{:X}".format(code) ++ eeprom_data[code_str] = eeprom_data.get(code_str, NULL) ++ return eeprom_data ++ + def get_eeprom(self): +- return self._eeprom ++ return self._valid_tlv(self._eeprom) ++ ++ def get_pn(self): ++ return self._eeprom.get('0x22', NULL) + + def get_serial(self): +- return self._eeprom.get('0x23', "Undefined.") ++ return self._eeprom.get('0x23', NULL) + + def get_mac(self): +- return self._eeprom.get('0x24', "Undefined.") ++ return self._eeprom.get('0x24', NULL) ++ ++ def get_modelstr(self): ++ return self._eeprom.get('0x21', NULL) ++ ++ def get_revisionstr(self): ++ return self._eeprom.get('0x27', NULL) +\ No newline at end of file +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/event.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/event.py +new file mode 100644 +index 000000000..ade466b2e +--- /dev/null ++++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/event.py +@@ -0,0 +1,109 @@ ++try: ++ import time ++ from sonic_py_common.logger import Logger ++ from .sfp import Sfp ++except ImportError as e: ++ raise ImportError(repr(e) + " - required module not found") ++ ++POLL_INTERVAL_IN_SEC = 1 ++ ++# SFP errors that will block eeprom accessing ++SFP_BLOCKING_ERRORS = [ ++ Sfp.SFP_ERROR_BIT_I2C_STUCK, ++ Sfp.SFP_ERROR_BIT_BAD_EEPROM, ++ Sfp.SFP_ERROR_BIT_UNSUPPORTED_CABLE, ++ Sfp.SFP_ERROR_BIT_HIGH_TEMP, ++ Sfp.SFP_ERROR_BIT_BAD_CABLE ++] ++ ++class SfpEvent: ++ ''' Listen to insert/remove sfp events ''' ++ ++ def __init__(self, sfp_list): ++ self._sfp_list = sfp_list ++ self._logger = Logger() ++ self._sfp_change_event_data = {'present': 0} ++ ++ def get_presence_bitmap(self): ++ bitmap = 0 ++ for sfp in self._sfp_list: ++ modpres = sfp.get_presence() ++ i=sfp.get_position_in_parent() - 1 ++ if modpres: ++ bitmap = bitmap | (1 << i) ++ return bitmap ++ ++ def get_sfp_event(self, timeout=2000): ++ port_dict = {} ++ change_dict = {} ++ change_dict['sfp'] = port_dict ++ ++ if timeout < 1000: ++ cd_ms = 1000 ++ else: ++ cd_ms = timeout ++ ++ while cd_ms > 0: ++ bitmap = self.get_presence_bitmap() ++ changed_ports = self._sfp_change_event_data['present'] ^ bitmap ++ if changed_ports != 0: ++ break ++ time.sleep(POLL_INTERVAL_IN_SEC) ++ # timeout=0 means wait for event forever ++ if timeout != 0: ++ cd_ms = cd_ms - POLL_INTERVAL_IN_SEC * 1000 ++ ++ if changed_ports != 0: ++ for sfp in self._sfp_list: ++ i=sfp.get_position_in_parent() - 1 ++ if (changed_ports & (1 << i)) == 0: ++ continue ++ ++ if (bitmap & (1 << i)) == 0: ++ port_dict[i+1] = '0' ++ else: ++ # sfp.refresh_optoe_dev_class() ++ sfp_state_bits = self.get_sfp_state_bits(sfp, True) ++ sfp_state_bits = self.check_sfp_blocking_errors(sfp_state_bits) ++ ++ port_dict[i+1] = str(sfp_state_bits) ++ ++ # Update the cache dict ++ self._sfp_change_event_data['present'] = bitmap ++ return True, change_dict ++ else: ++ return True, change_dict ++ ++ def get_sfp_state_bits(self, sfp, present): ++ sfp_state_bits = 0 ++ ++ if present is True: ++ sfp_state_bits |= Sfp.SFP_STATUS_BIT_INSERTED ++ else: ++ return sfp_state_bits ++ ++ status = sfp.validate_eeprom() ++ if status is None: ++ sfp_state_bits |= Sfp.SFP_ERROR_BIT_I2C_STUCK ++ return sfp_state_bits ++ elif status is not True: ++ sfp_state_bits |= Sfp.SFP_ERROR_BIT_BAD_EEPROM ++ return sfp_state_bits ++ ++ status = sfp.validate_temperature() ++ if status is None: ++ sfp_state_bits |= Sfp.SFP_ERROR_BIT_I2C_STUCK ++ return sfp_state_bits ++ elif status is not True: ++ sfp_state_bits |= Sfp.SFP_ERROR_BIT_HIGH_TEMP ++ return sfp_state_bits ++ ++ return sfp_state_bits ++ ++ def check_sfp_blocking_errors(self, sfp_state_bits): ++ for i in SFP_BLOCKING_ERRORS: ++ if (i & sfp_state_bits) == 0: ++ continue ++ sfp_state_bits |= Sfp.SFP_ERROR_BIT_BLOCKING ++ ++ return sfp_state_bits +\ No newline at end of file +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/fan.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/fan.py +index 8f4893124..e14550355 100644 +--- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/fan.py ++++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/fan.py +@@ -38,10 +38,6 @@ PSU_CPLD_I2C_MAPPING = { + }, + } + +- +-FAN_NAME_LIST = ["FAN-1F", "FAN-1R", "FAN-2F", "FAN-2R", +- "FAN-3F", "FAN-3R"] +- + class Fan(FanBase): + """Platform-specific Fan class""" + +@@ -63,7 +59,7 @@ class Fan(FanBase): + self.psu_cpld_path = I2C_PATH.format( + self.psu_i2c_num, self.psu_i2c_addr) + +- FanBase.__init__(self) ++ FanBase.__init__(self) + + + def get_direction(self): +@@ -73,16 +69,14 @@ class Fan(FanBase): + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + """ +- +- + if not self.is_psu_fan: + dir_str = "{}{}{}".format(CPLD_FAN_I2C_PATH, 'direction_', self.fan_tray_index+1) + val=self._api_helper.read_txt_file(dir_str) + if val is not None: + if int(val, 10)==0:#F2B +- direction=self.FAN_DIRECTION_EXHAUST +- else: + direction=self.FAN_DIRECTION_INTAKE ++ else: ++ direction=self.FAN_DIRECTION_EXHAUST + else: + direction=self.FAN_DIRECTION_EXHAUST + +@@ -105,7 +99,7 @@ class Fan(FanBase): + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) +- ++ + """ + speed = 0 + if self.is_psu_fan: +@@ -117,7 +111,7 @@ class Fan(FanBase): + speed=100 + else: + return 0 +- elif self.get_presence(): ++ elif self.get_presence(): + speed_path = "{}{}".format(CPLD_FAN_I2C_PATH, 'duty_cycle_percentage') + speed=self._api_helper.read_txt_file(speed_path) + if speed is None: +@@ -156,7 +150,7 @@ class Fan(FanBase): + A boolean, True if speed is set successfully, False if not + """ + +- if not self.is_psu_fan and self.get_presence(): ++ if not self.is_psu_fan and self.get_presence(): + speed_path = "{}{}".format(CPLD_FAN_I2C_PATH, 'duty_cycle_percentage') + return self._api_helper.write_txt_file(speed_path, int(speed)) + +@@ -179,14 +173,13 @@ class Fan(FanBase): + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ +- status=self.get_presence() +- if status is None: +- return self.STATUS_LED_COLOR_OFF ++ if self.is_psu_fan: ++ return None + + return { +- 1: self.STATUS_LED_COLOR_GREEN, +- 0: self.STATUS_LED_COLOR_RED +- }.get(status, self.STATUS_LED_COLOR_OFF) ++ True: self.STATUS_LED_COLOR_GREEN, ++ False: self.STATUS_LED_COLOR_OFF ++ }.get(self.get_status(), self.STATUS_LED_COLOR_OFF) + + def get_name(self): + """ +@@ -194,11 +187,10 @@ class Fan(FanBase): + Returns: + string: The name of the device + """ +- fan_name = FAN_NAME_LIST[self.fan_tray_index*2 + self.fan_index] \ +- if not self.is_psu_fan \ +- else "PSU-{} FAN-{}".format(self.psu_index+1, self.fan_index+1) ++ if self.is_psu_fan: ++ return "PSU-{} FAN-{}".format(self.psu_index+1, self.fan_index+1) + +- return fan_name ++ return "FAN-{}".format(self.fan_tray_index+1) + + def get_presence(self): + """ +@@ -206,8 +198,6 @@ class Fan(FanBase): + Returns: + bool: True if FAN is present, False if not + """ +- +- + if self.is_psu_fan: + present_path="{}{}".format(self.psu_cpld_path, 'psu_present') + else: +@@ -226,6 +216,11 @@ class Fan(FanBase): + A boolean value, True if device is operating properly, False if not + """ + if self.is_psu_fan: ++ psu_fan_path = "{}{}".format(self.psu_cpld_path, 'psu_power_good') ++ val = self._api_helper.read_txt_file(psu_fan_path) ++ if val is None or int(val, 10)==0: ++ return False ++ + psu_fan_path= "{}{}".format(self.psu_hwmon_path, 'psu_fan1_fault') + val=self._api_helper.read_txt_file(psu_fan_path) + if val is not None: +@@ -268,7 +263,7 @@ class Fan(FanBase): + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ +- return (self.fan_tray_index+1) \ ++ return (self.fan_index+1) \ + if not self.is_psu_fan else (self.psu_index+1) + + def is_replaceable(self): +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/fan_drawer.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/fan_drawer.py +index e21163c10..b4c2146b9 100644 +--- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/fan_drawer.py ++++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/fan_drawer.py +@@ -10,7 +10,7 @@ try: + except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +-FANS_PER_FANTRAY = 2 ++FANS_PER_FANTRAY = 1 + + + class FanDrawer(FanDrawerBase): +@@ -88,3 +88,25 @@ class FanDrawer(FanDrawerBase): + bool: True if it is replaceable. + """ + return True ++ ++ 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: True if status LED state is set successfully, False if not ++ """ ++ return False # Not supported ++ ++ def get_status_led(self): ++ """ ++ Gets the state of the fan status LED ++ Returns: ++ A string, one of the predefined STATUS_LED_COLOR_* strings above ++ """ ++ return { ++ True: self.STATUS_LED_COLOR_GREEN, ++ False: self.STATUS_LED_COLOR_OFF ++ }.get(self.get_status(), self.STATUS_LED_COLOR_OFF) +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/helper.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/helper.py +index b19fab85d..f6adee309 100644 +--- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/helper.py ++++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/helper.py +@@ -1,8 +1,14 @@ + import os + import struct +-import subprocess ++import json ++import fcntl + from mmap import * + from sonic_py_common import device_info ++from sonic_py_common import logger ++from threading import Lock ++from typing import cast ++from sonic_py_common.general import getstatusoutput_noshell_pipe ++from sonic_py_common.general import getstatusoutput_noshell + + HOST_CHK_CMD = ["docker"] + EMPTY_STRING = "" +@@ -14,7 +20,11 @@ class APIHelper(): + (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() + + def is_host(self): +- return subprocess.call(HOST_CHK_CMD) == 0 ++ try: ++ status, output = getstatusoutput_noshell(HOST_CHK_CMD) ++ return status == 0 ++ except Exception: ++ return False + + def pci_get_value(self, resource, offset): + status = True +@@ -29,11 +39,20 @@ class APIHelper(): + status = False + return status, result + ++ def run_interactive_command(self, cmd): ++ try: ++ os.system(cmd) ++ except Exception: ++ return False ++ return True ++ + def read_txt_file(self, file_path): + try: + with open(file_path, 'r', errors='replace') as fd: + data = fd.read() +- return data.strip() ++ ret = data.strip() ++ if len(ret) > 0: ++ return ret + except IOError: + pass + return None +@@ -46,3 +65,304 @@ class APIHelper(): + return False + return True + ++ def ipmi_raw(self, netfn, cmd): ++ status = True ++ result = "" ++ try: ++ err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'raw', str(netfn), str(cmd)]) ++ if err == [0]: ++ result = raw_data.strip() ++ else: ++ status = False ++ except Exception: ++ status = False ++ return status, result ++ ++ def ipmi_fru_id(self, id, key=None): ++ status = True ++ result = "" ++ try: ++ if (key is None): ++ err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'fru', 'print', str(id)]) ++ else: ++ err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'fru', 'print', str(id)], ['grep', str(key)]) ++ if err == [0] or err == [0, 0]: ++ result = raw_data.strip() ++ else: ++ status = False ++ except Exception: ++ status = False ++ return status, result ++ ++ def ipmi_set_ss_thres(self, id, threshold_key, value): ++ status = True ++ result = "" ++ try: ++ err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'sensor', 'thresh', str(id), str(threshold_key), str(value)]) ++ if err == [0]: ++ result = raw_data.strip() ++ else: ++ status = False ++ except Exception: ++ status = False ++ return status, result ++ ++ ++class FileLock: ++ """ ++ Due to pmon docker not installing the py-filelock, this class ++ implements a simple file lock feature. ++ Ref: https://github.com/tox-dev/py-filelock/blob/main/src/filelock/ ++ """ ++ ++ def __init__(self, lock_file): ++ self._lock_file = lock_file ++ self._thread_lock = Lock() ++ self.is_locked = False ++ ++ def acquire(self): ++ with self._thread_lock: ++ if self.is_locked: ++ return ++ ++ fd = os.open(self._lock_file, flags=(os.O_RDWR | os.O_CREAT | os.O_TRUNC)) ++ fcntl.flock(fd, fcntl.LOCK_EX) ++ self._lock_file_fd = fd ++ self.is_locked = True ++ ++ def release(self): ++ with self._thread_lock: ++ if self.is_locked: ++ fd = cast(int, self._lock_file_fd) ++ self._lock_file_fd = None ++ fcntl.flock(fd, fcntl.LOCK_UN) ++ os.close(fd) ++ self.is_locked = False ++ ++ def __enter__(self): ++ self.acquire() ++ return self ++ ++ def __exit__(self, exc_type, exc_val, traceback): ++ self.release() ++ ++ def __del__(self): ++ self.release() ++ ++ ++DEVICE_THRESHOLD_JSON_PATH = "/tmp/device_threshold.json" ++ ++class DeviceThreshold: ++ HIGH_THRESHOLD = 'high_threshold' ++ LOW_THRESHOLD = 'low_threshold' ++ HIGH_CRIT_THRESHOLD = 'high_critical_threshold' ++ LOW_CRIT_THRESHOLD = 'low_critical_threshold' ++ NOT_AVAILABLE = 'N/A' ++ ++ def __init__(self, th_name = NOT_AVAILABLE): ++ self.flock = FileLock("{}.lock".format(DEVICE_THRESHOLD_JSON_PATH)) ++ self.name = th_name ++ self.__log = logger.Logger(log_identifier="DeviceThreshold") ++ ++ self.__db_data = {} ++ self.__db_mtime = 0 ++ ++ def __reload_db(self): ++ try: ++ db_data = {} ++ with self.flock: ++ with open(DEVICE_THRESHOLD_JSON_PATH, "r") as db_file: ++ db_data = json.load(db_file) ++ except Exception as e: ++ self.__log.log_warning('{}'.format(str(e))) ++ return None ++ ++ return db_data ++ ++ def __get_data(self, field): ++ """ ++ Retrieves data frome JSON file by field ++ ++ Args : ++ field: String ++ ++ Returns: ++ A string if getting is successfully, 'N/A' if not ++ """ ++ if os.path.exists(DEVICE_THRESHOLD_JSON_PATH): ++ new_mtime = os.path.getmtime(DEVICE_THRESHOLD_JSON_PATH) ++ if new_mtime != self.__db_mtime: ++ new_data = self.__reload_db() ++ if new_data is not None: ++ self.__db_data = new_data ++ self.__db_mtime = new_mtime ++ ++ if self.name not in self.__db_data.keys(): ++ return self.NOT_AVAILABLE ++ ++ if field not in self.__db_data[self.name].keys(): ++ return self.NOT_AVAILABLE ++ ++ return self.__db_data[self.name][field] ++ ++ def __set_data(self, field, new_val): ++ """ ++ Set data to JSON file by field ++ ++ Args : ++ field: String ++ new_val: String ++ ++ Returns: ++ A boolean, True if setting is set successfully, False if not ++ """ ++ if self.name not in self.__db_data.keys(): ++ self.__db_data[self.name] = {} ++ ++ old_val = self.__db_data[self.name].get(field, None) ++ if old_val is not None and old_val == new_val: ++ return True ++ ++ self.__db_data[self.name][field] = new_val ++ ++ try: ++ with self.flock: ++ db_data = {} ++ mode = "r+" if os.path.exists(DEVICE_THRESHOLD_JSON_PATH) else "w+" ++ with open(DEVICE_THRESHOLD_JSON_PATH, mode) as db_file: ++ if mode == "r+": ++ db_data = json.load(db_file) ++ ++ if self.name not in db_data.keys(): ++ db_data[self.name] = {} ++ ++ db_data[self.name][field] = new_val ++ ++ if mode == "r+": ++ db_file.seek(0) ++ # erase old data ++ db_file.truncate(0) ++ # write all data ++ json.dump(db_data, db_file, indent=4) ++ self.__db_mtime = os.path.getmtime(DEVICE_THRESHOLD_JSON_PATH) ++ except Exception as e: ++ self.__log.log_error('{}'.format(str(e))) ++ return False ++ ++ return True ++ ++ def get_high_threshold(self): ++ """ ++ Retrieves the high threshold temperature from JSON file. ++ ++ Returns: ++ string : the high threshold temperature of thermal, ++ e.g. "30.125" ++ """ ++ return self.__get_data(self.HIGH_THRESHOLD) ++ ++ def set_high_threshold(self, temperature): ++ """ ++ Sets the high threshold temperature of thermal ++ Args : ++ temperature: A string of temperature, e.g. "30.125" ++ Returns: ++ A boolean, True if threshold is set successfully, False if not ++ """ ++ if isinstance(temperature, str) is not True: ++ raise TypeError('The parameter requires string type.') ++ ++ try: ++ if temperature != self.NOT_AVAILABLE: ++ float(temperature) ++ except ValueError: ++ raise ValueError('The parameter requires a float string. ex:\"30.1\"') ++ ++ return self.__set_data(self.HIGH_THRESHOLD, temperature) ++ ++ def get_low_threshold(self): ++ """ ++ Retrieves the low threshold temperature from JSON file. ++ ++ Returns: ++ string : the low threshold temperature of thermal, ++ e.g. "30.125" ++ """ ++ return self.__get_data(self.LOW_THRESHOLD) ++ ++ def set_low_threshold(self, temperature): ++ """ ++ Sets the low threshold temperature of thermal ++ Args : ++ temperature: A string of temperature, e.g. "30.125" ++ Returns: ++ A boolean, True if threshold is set successfully, False if not ++ """ ++ if isinstance(temperature, str) is not True: ++ raise TypeError('The parameter requires string type.') ++ ++ try: ++ if temperature != self.NOT_AVAILABLE: ++ float(temperature) ++ except ValueError: ++ raise ValueError('The parameter requires a float string. ex:\"30.1\"') ++ ++ return self.__set_data(self.LOW_THRESHOLD, temperature) ++ ++ def get_high_critical_threshold(self): ++ """ ++ Retrieves the high critical threshold temperature from JSON file. ++ ++ Returns: ++ string : the high critical threshold temperature of thermal, ++ e.g. "30.125" ++ """ ++ return self.__get_data(self.HIGH_CRIT_THRESHOLD) ++ ++ def set_high_critical_threshold(self, temperature): ++ """ ++ Sets the high critical threshold temperature of thermal ++ Args : ++ temperature: A string of temperature, e.g. "30.125" ++ Returns: ++ A boolean, True if threshold is set successfully, False if not ++ """ ++ if isinstance(temperature, str) is not True: ++ raise TypeError('The parameter requires string type.') ++ ++ try: ++ if temperature != self.NOT_AVAILABLE: ++ float(temperature) ++ except ValueError: ++ raise ValueError('The parameter requires a float string. ex:\"30.1\"') ++ ++ return self.__set_data(self.HIGH_CRIT_THRESHOLD, temperature) ++ ++ def get_low_critical_threshold(self): ++ """ ++ Retrieves the low critical threshold temperature from JSON file. ++ ++ Returns: ++ string : the low critical threshold temperature of thermal, ++ e.g. "30.125" ++ """ ++ return self.__get_data(self.LOW_CRIT_THRESHOLD) ++ ++ def set_low_critical_threshold(self, temperature): ++ """ ++ Sets the low critical threshold temperature of thermal ++ Args : ++ temperature: A string of temperature, e.g. "30.125" ++ Returns: ++ A boolean, True if threshold is set successfully, False if not ++ """ ++ if isinstance(temperature, str) is not True: ++ raise TypeError('The parameter requires string type.') ++ ++ try: ++ if temperature != self.NOT_AVAILABLE: ++ float(temperature) ++ except ValueError: ++ raise ValueError('The parameter requires a float string. ex:\"30.1\"') ++ ++ return self.__set_data(self.LOW_CRIT_THRESHOLD, temperature) +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/pcie.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/pcie.py +new file mode 100644 +index 000000000..73d3627db +--- /dev/null ++++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/pcie.py +@@ -0,0 +1,19 @@ ++############################################################################# ++# Edgecore ++# ++# Module contains an implementation of SONiC Platform Base API and ++# provides the fan status which are available in the platform ++# Base PCIe class ++############################################################################# ++ ++try: ++ from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil ++except ImportError as e: ++ raise ImportError(str(e) + "- required module not found") ++ ++ ++class Pcie(PcieUtil): ++ """Edgecore Platform-specific PCIe class""" ++ ++ def __init__(self, platform_path): ++ PcieUtil.__init__(self, platform_path) +\ No newline at end of file +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/psu.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/psu.py +index 8eab43891..6df7fd3ff 100644 +--- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/psu.py ++++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/psu.py +@@ -10,7 +10,7 @@ + + try: + from sonic_platform_base.psu_base import PsuBase +- #from sonic_platform.fan import Fan ++ from sonic_platform.thermal import Thermal + from .helper import APIHelper + except ImportError as e: + raise ImportError(str(e) + "- required module not found") +@@ -58,19 +58,13 @@ class Psu(PsuBase): + self.i2c_addr = PSU_CPLD_I2C_MAPPING[self.index]["addr"] + self.cpld_path = I2C_PATH.format(self.i2c_num, self.i2c_addr) + self.__initialize_fan() +- ''' +- for fan_index in range(0, PSU_NUM_FAN[self.index]): +- #def __init__(self, fan_tray_index, fan_index=0, is_psu_fan=False, psu_index=0): +- #fan = Fan(fan_index, 0, is_psu_fan=True, psu_index=self.index) +- fan = Fan(fan_index, 0, True, self.index) +- self._fan_list.append(fan) +- ''' + + def __initialize_fan(self): + from sonic_platform.fan import Fan + for fan_index in range(0, PSU_NUM_FAN[self.index]): + fan = Fan(fan_index, 0, is_psu_fan=True, psu_index=self.index) + self._fan_list.append(fan) ++ self._thermal_list.append(Thermal(is_psu=True, psu_index=self.index)) + + def get_voltage(self): + """ +@@ -79,12 +73,15 @@ class Psu(PsuBase): + A float number, the output voltage in volts, + e.g. 12.1 + """ ++ if self.get_status() is not True: ++ return 0.0 ++ + vout_path = "{}{}".format(self.hwmon_path, 'psu_v_out') + vout_val=self._api_helper.read_txt_file(vout_path) + if vout_val is not None: + return float(vout_val)/ 1000 + else: +- return 0 ++ return 0.0 + + def get_current(self): + """ +@@ -92,12 +89,15 @@ class Psu(PsuBase): + Returns: + A float number, the electric current in amperes, e.g 15.4 + """ ++ if self.get_status() is not True: ++ return 0.0 ++ + iout_path = "{}{}".format(self.hwmon_path, 'psu_i_out') + val=self._api_helper.read_txt_file(iout_path) + if val is not None: + return float(val)/1000 + else: +- return 0 ++ return 0.0 + + def get_power(self): + """ +@@ -105,12 +105,15 @@ class Psu(PsuBase): + Returns: + A float number, the power in watts, e.g. 302.6 + """ ++ if self.get_status() is not True: ++ return 0.0 ++ + pout_path = "{}{}".format(self.hwmon_path, 'psu_p_out') + val=self._api_helper.read_txt_file(pout_path) + if val is not None: + return float(val)/1000 + else: +- return 0 ++ return 0.0 + + def get_powergood_status(self): + """ +@@ -156,12 +159,15 @@ class Psu(PsuBase): + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ ++ if self.get_status() is not True: ++ return 0.0 ++ + temp_path = "{}{}".format(self.hwmon_path, 'psu_temp1_input') + val=self._api_helper.read_txt_file(temp_path) + if val is not None: + return float(val)/1000 + else: +- return 0 ++ return 0.0 + + def get_temperature_high_threshold(self): + """ +@@ -170,7 +176,7 @@ class Psu(PsuBase): + A float number, the high threshold temperature of PSU in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ +- return False #Not supported ++ return self._thermal_list[0].get_high_threshold() + + def get_voltage_high_threshold(self): + """ +@@ -179,12 +185,15 @@ class Psu(PsuBase): + A float number, the high threshold output voltage in volts, + e.g. 12.1 + """ ++ if self.get_status() is not True: ++ return 0.0 ++ + vout_path = "{}{}".format(self.hwmon_path, 'psu_mfr_vout_max') + vout_val=self._api_helper.read_txt_file(vout_path) + if vout_val is not None: + return float(vout_val)/ 1000 + else: +- return 0 ++ return 0.0 + + def get_voltage_low_threshold(self): + """ +@@ -193,12 +202,15 @@ class Psu(PsuBase): + A float number, the low threshold output voltage in volts, + e.g. 12.1 + """ ++ if self.get_status() is not True: ++ return 0.0 ++ + vout_path = "{}{}".format(self.hwmon_path, 'psu_mfr_vout_min') + vout_val=self._api_helper.read_txt_file(vout_path) + if vout_val is not None: + return float(vout_val)/ 1000 + else: +- return 0 ++ return 0.0 + + def get_name(self): + """ +@@ -219,7 +231,7 @@ class Psu(PsuBase): + if val is not None: + return int(val, 10) == 1 + else: +- return 0 ++ return False + + def get_status(self): + """ +@@ -232,7 +244,7 @@ class Psu(PsuBase): + if val is not None: + return int(val, 10) == 1 + else: +- return 0 ++ return False + + def get_model(self): + """ +@@ -275,3 +287,34 @@ class Psu(PsuBase): + bool: True if it is replaceable. + """ + return True ++ ++ def get_revision(self): ++ """ ++ Retrieves the hardware revision of the device ++ ++ Returns: ++ string: Revision value of device ++ """ ++ revision_path = "{}{}".format(self.hwmon_path, 'psu_mfr_revision') ++ revision = self._api_helper.read_txt_file(revision_path) ++ if revision is None: ++ return 'N/A' ++ ++ return revision ++ ++ def get_maximum_supplied_power(self): ++ """ ++ Retrieves the maximum supplied power by PSU ++ Returns: ++ A float number, the maximum power output in Watts. ++ e.g. 1200.1 ++ """ ++ if self.get_status() is not True: ++ return 0.0 ++ ++ pout_max_path = "{}{}".format(self.hwmon_path, 'psu_mfr_pout_max') ++ val=self._api_helper.read_txt_file(pout_max_path) ++ if val is not None: ++ return float(val)/1000 ++ else: ++ return 0.0 +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/sfp.py +index adab3d294..d6f894b28 100644 +--- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/sfp.py ++++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/sfp.py +@@ -1,5 +1,3 @@ +-#!/usr/bin/env python +- + ############################################################################# + # Edgecore + # +@@ -8,115 +6,26 @@ + # + ############################################################################# + ++import os + import time +-import sys +-import subprocess +-from ctypes import create_string_buffer + + try: +- from sonic_platform_base.sfp_base import SfpBase +- from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom +- from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId +- from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom +- from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId +- #from sonic_platform_base.sonic_sfp.sff8472 import sffbase ++ from sonic_py_common.logger import Logger ++ from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase + from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper + from .helper import APIHelper ++ from sonic_py_common import device_info + except ImportError as e: + raise ImportError(str(e) + "- required module not found") + ++NONE_SFP_TYPE = "NONE-SFP" ++SFP_TYPE = "SFP" ++QSFP_TYPE = "QSFP" ++ + CPLD_I2C_PATH = "/sys/bus/i2c/devices/3-0060/" + +-QSFP_INFO_OFFSET = 128 +-QSFP_DOM_OFFSET = 0 +- +-SFP_INFO_OFFSET = 0 +-SFP_DOM_OFFSET = 256 +- +-XCVR_INTFACE_BULK_OFFSET = 0 +-XCVR_INTFACE_BULK_WIDTH_QSFP = 20 +-XCVR_INTFACE_BULK_WIDTH_SFP = 21 +-XCVR_HW_REV_WIDTH_QSFP = 2 +-XCVR_HW_REV_WIDTH_SFP = 4 +-XCVR_CABLE_LENGTH_WIDTH_QSFP = 5 +-XCVR_VENDOR_NAME_OFFSET = 20 +-XCVR_VENDOR_NAME_WIDTH = 16 +-XCVR_VENDOR_OUI_OFFSET = 37 +-XCVR_VENDOR_OUI_WIDTH = 3 +-XCVR_VENDOR_PN_OFFSET = 40 +-XCVR_VENDOR_PN_WIDTH = 16 +-XCVR_HW_REV_OFFSET = 56 +-XCVR_HW_REV_WIDTH_OSFP = 2 +-XCVR_HW_REV_WIDTH_SFP = 4 +-XCVR_VENDOR_SN_OFFSET = 68 +-XCVR_VENDOR_SN_WIDTH = 16 +-XCVR_VENDOR_DATE_OFFSET = 84 +-XCVR_VENDOR_DATE_WIDTH = 8 +-XCVR_DOM_CAPABILITY_OFFSET = 92 +-XCVR_DOM_CAPABILITY_WIDTH = 1 +- +-# Offset for values in QSFP eeprom +-QSFP_DOM_REV_OFFSET = 1 +-QSFP_DOM_REV_WIDTH = 1 +-QSFP_TEMPE_OFFSET = 22 +-QSFP_TEMPE_WIDTH = 2 +-QSFP_VOLT_OFFSET = 26 +-QSFP_VOLT_WIDTH = 2 +-QSFP_CHANNL_MON_OFFSET = 34 +-QSFP_CHANNL_MON_WIDTH = 16 +-QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH = 24 +-QSFP_CONTROL_OFFSET = 86 +-QSFP_CONTROL_WIDTH = 8 +-QSFP_CHANNL_RX_LOS_STATUS_OFFSET = 3 +-QSFP_CHANNL_RX_LOS_STATUS_WIDTH = 1 +-QSFP_CHANNL_TX_FAULT_STATUS_OFFSET = 4 +-QSFP_CHANNL_TX_FAULT_STATUS_WIDTH = 1 +-QSFP_POWEROVERRIDE_OFFSET = 93 +-QSFP_POWEROVERRIDE_WIDTH = 1 +-QSFP_PAGE03_OFFSET = 384 +-QSFP_MODULE_THRESHOLD_OFFSET = 128 +-QSFP_MODULE_THRESHOLD_WIDTH = 24 +-QSFP_CHANNEL_THRESHOLD_OFFSET = 176 +-QSFP_CHANNEL_THRESHOLD_WIDTH = 16 +- +-qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)', +- 'Length OM2(m)', 'Length OM1(m)', +- 'Length Cable Assembly(m)') +- +-qsfp_compliance_code_tup = ('10/40G Ethernet Compliance Code', 'SONET Compliance codes', +- 'SAS/SATA compliance codes', 'Gigabit Ethernet Compliant codes', +- 'Fibre Channel link length/Transmitter Technology', +- 'Fibre Channel transmission media', 'Fibre Channel Speed') +- +- +-# Offset for values in SFP eeprom +-SFP_TEMPE_OFFSET = 96 +-SFP_TEMPE_WIDTH = 2 +-SFP_VOLT_OFFSET = 98 +-SFP_VOLT_WIDTH = 2 +-SFP_CHANNL_MON_OFFSET = 100 +-SFP_CHANNL_MON_WIDTH = 6 +-SFP_MODULE_THRESHOLD_OFFSET = 0 +-SFP_MODULE_THRESHOLD_WIDTH = 40 +-SFP_CHANNL_THRESHOLD_OFFSET = 112 +-SFP_CHANNL_THRESHOLD_WIDTH = 2 +-SFP_STATUS_CONTROL_OFFSET = 110 +-SFP_STATUS_CONTROL_WIDTH = 1 +-SFP_TX_DISABLE_HARD_BIT = 7 +-SFP_TX_DISABLE_SOFT_BIT = 6 +- +-sfp_cable_length_tup = ('LengthSMFkm-UnitsOfKm', 'LengthSMF(UnitsOf100m)', +- 'Length50um(UnitsOf10m)', 'Length62.5um(UnitsOfm)', +- 'LengthCable(UnitsOfm)', 'LengthOM3(UnitsOf10m)') +- +-sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode', +- 'ESCONComplianceCodes', 'SONETComplianceCodes', +- 'EthernetComplianceCodes', 'FibreChannelLinkLength', +- 'FibreChannelTechnology', 'SFP+CableTechnology', +- 'FibreChannelTransmissionMedia', 'FibreChannelSpeed') +- +- +-class Sfp(SfpBase): ++logger = Logger() ++class Sfp(SfpOptoeBase): + """Platform-specific Sfp class""" + + # Port number +@@ -126,10 +35,7 @@ class Sfp(SfpBase): + # Path to sysfs + PLATFORM_ROOT_PATH = "/usr/share/sonic/device" + PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" +- HOST_CHK_CMD = ["docker"] +- +- PLATFORM = "x86_64-accton_as4630_54te-r0" +- HWSKU = "Accton-AS4630-54TE" ++ HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" + + _port_to_i2c_mapping = { + 49: 18, +@@ -140,510 +46,41 @@ class Sfp(SfpBase): + 54: 23, + } + ++ SFP_TYPE_CODE_LIST = [ ++ 0x03, # SFP/SFP+/SFP28 ++ 0x0b # DWDM-SFP/SFP+ ++ ] ++ QSFP_TYPE_CODE_LIST = [ ++ 0x0c, # QSFP ++ 0x0d, # QSFP+ or later ++ 0x11, # QSFP28 or later ++ 0xe1 # QSFP28 EDFA ++ ] ++ + def __init__(self, sfp_index=0): ++ SfpOptoeBase.__init__(self) + self._api_helper=APIHelper() + # Init index +- self.index = sfp_index +- self.port_num = self.index + 1 ++ self.port_num = sfp_index + 1 ++ self.index = self.port_num ++ if self.port_num < self.PORT_START: ++ self.sfp_type = NONE_SFP_TYPE ++ elif self.port_num < 53: ++ self.sfp_type = SFP_TYPE ++ else: ++ self.sfp_type = QSFP_TYPE ++ + # Init eeprom path + eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom' + self.port_to_eeprom_mapping = {} + 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]) + +- self.info_dict_keys = ['type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', +- 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', 'vendor_oui', +- 'application_advertisement', 'type_abbrv_name'] +- +- self.dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', 'power_lpmode', 'tx_disable', 'tx_disable_channel', 'temperature', 'voltage', +- 'rx1power', 'rx2power', 'rx3power', 'rx4power', 'tx1bias', 'tx2bias', 'tx3bias', 'tx4bias', 'tx1power', 'tx2power', 'tx3power', 'tx4power'] +- +- self.threshold_dict_keys = ['temphighalarm', 'temphighwarning', 'templowalarm', 'templowwarning', 'vcchighalarm', 'vcchighwarning', 'vcclowalarm', 'vcclowwarning', 'rxpowerhighalarm', 'rxpowerhighwarning', +- 'rxpowerlowalarm', 'rxpowerlowwarning', 'txpowerhighalarm', 'txpowerhighwarning', 'txpowerlowalarm', 'txpowerlowwarning', 'txbiashighalarm', 'txbiashighwarning', 'txbiaslowalarm', 'txbiaslowwarning'] +- +- SfpBase.__init__(self) +- +- def _convert_string_to_num(self, value_str): +- if "-inf" in value_str: +- return 'N/A' +- elif "Unknown" in value_str: +- return 'N/A' +- elif 'dBm' in value_str: +- t_str = value_str.rstrip('dBm') +- return float(t_str) +- elif 'mA' in value_str: +- t_str = value_str.rstrip('mA') +- return float(t_str) +- elif 'C' in value_str: +- t_str = value_str.rstrip('C') +- return float(t_str) +- elif 'Volts' in value_str: +- t_str = value_str.rstrip('Volts') +- return float(t_str) +- else: +- return 'N/A' +- +- def __write_txt_file(self, file_path, value): +- try: +- with open(file_path, 'w', buffering=0) as fd: +- fd.write(str(value)) +- except Exception: +- return False +- return True ++ def get_eeprom_path(self): ++ return self.port_to_eeprom_mapping[self.port_num] + + def __is_host(self): +- return subprocess.call(self.HOST_CHK_CMD) == 0 +- +- def __get_path_to_port_config_file(self): +- platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) +- hwsku_path = "/".join([platform_path, self.HWSKU] +- ) if self.__is_host() else self.PMON_HWSKU_PATH +- return "/".join([hwsku_path, "port_config.ini"]) +- +- def __read_eeprom_specific_bytes(self, offset, num_bytes): +- sysfsfile_eeprom = None +- eeprom_raw = [] +- for i in range(0, num_bytes): +- eeprom_raw.append("0x00") +- +- sysfs_sfp_i2c_client_eeprom_path = self.port_to_eeprom_mapping[self.port_num] +- try: +- sysfsfile_eeprom = open( +- sysfs_sfp_i2c_client_eeprom_path, mode="rb", buffering=0) +- sysfsfile_eeprom.seek(offset) +- raw = sysfsfile_eeprom.read(num_bytes) +- if sys.version_info[0] >= 3: +- for n in range(0, num_bytes): +- eeprom_raw[n] = hex(raw[n])[2:].zfill(2) +- else: +- for n in range(0, num_bytes): +- eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) +- except Exception: +- pass +- finally: +- if sysfsfile_eeprom: +- sysfsfile_eeprom.close() +- +- return eeprom_raw +- +- def get_transceiver_info(self): +- """ +- Retrieves transceiver info of this SFP +- Returns: +- A dict which contains following keys/values : +- ======================================================================== +- keys |Value Format |Information +- ---------------------------|---------------|---------------------------- +- type |1*255VCHAR |type of SFP +- vendor_rev |1*255VCHAR |vendor revision of SFP +- serial |1*255VCHAR |serial number of the SFP +- manufacturer |1*255VCHAR |SFP vendor name +- model |1*255VCHAR |SFP model name +- connector |1*255VCHAR |connector information +- encoding |1*255VCHAR |encoding information +- ext_identifier |1*255VCHAR |extend identifier +- ext_rateselect_compliance |1*255VCHAR |extended rateSelect compliance +- cable_length |INT |cable length in m +- nominal_bit_rate |INT |nominal bit rate by 100Mbs +- specification_compliance |1*255VCHAR |specification compliance +- vendor_date |1*255VCHAR |vendor date +- vendor_oui |1*255VCHAR |vendor OUI +- application_advertisement |1*255VCHAR |supported applications advertisement +- ======================================================================== +- """ +- # check present status +- if self.port_num < 49: +- return {} +- elif self.port_num < 53: +- sfpi_obj = sff8472InterfaceId() #SFP +- else: +- sfpi_obj = sff8436InterfaceId() #QSFP +- if not self.get_presence() or not sfpi_obj: +- return {} +- +- if self.port_num < 53: +- offset = SFP_INFO_OFFSET +- sfp_interface_bulk_raw = self.__read_eeprom_specific_bytes( +- (offset + XCVR_INTFACE_BULK_OFFSET), XCVR_INTFACE_BULK_WIDTH_SFP) +- else: +- offset = QSFP_INFO_OFFSET +- sfp_interface_bulk_raw = self.__read_eeprom_specific_bytes( +- (offset + XCVR_INTFACE_BULK_OFFSET), XCVR_INTFACE_BULK_WIDTH_QSFP) +- +- sfp_interface_bulk_data = sfpi_obj.parse_sfp_info_bulk( +- sfp_interface_bulk_raw, 0) +- +- sfp_vendor_name_raw = self.__read_eeprom_specific_bytes( +- (offset + XCVR_VENDOR_NAME_OFFSET), XCVR_VENDOR_NAME_WIDTH) +- sfp_vendor_name_data = sfpi_obj.parse_vendor_name( +- sfp_vendor_name_raw, 0) +- +- sfp_vendor_pn_raw = self.__read_eeprom_specific_bytes( +- (offset + XCVR_VENDOR_PN_OFFSET), XCVR_VENDOR_PN_WIDTH) +- sfp_vendor_pn_data = sfpi_obj.parse_vendor_pn( +- sfp_vendor_pn_raw, 0) +- +- if self.port_num < 53: +- sfp_vendor_rev_raw = self.__read_eeprom_specific_bytes( +- (offset + XCVR_HW_REV_OFFSET), XCVR_HW_REV_WIDTH_SFP) +- else: +- sfp_vendor_rev_raw = self.__read_eeprom_specific_bytes( +- (offset + XCVR_HW_REV_OFFSET), XCVR_HW_REV_WIDTH_QSFP) +- +- sfp_vendor_rev_data = sfpi_obj.parse_vendor_rev( +- sfp_vendor_rev_raw, 0) +- +- sfp_vendor_sn_raw = self.__read_eeprom_specific_bytes( +- (offset + XCVR_VENDOR_SN_OFFSET), XCVR_VENDOR_SN_WIDTH) +- sfp_vendor_sn_data = sfpi_obj.parse_vendor_sn( +- sfp_vendor_sn_raw, 0) +- +- sfp_vendor_oui_raw = self.__read_eeprom_specific_bytes( +- (offset + XCVR_VENDOR_OUI_OFFSET), XCVR_VENDOR_OUI_WIDTH) +- if sfp_vendor_oui_raw is not None: +- sfp_vendor_oui_data = sfpi_obj.parse_vendor_oui( +- sfp_vendor_oui_raw, 0) +- +- sfp_vendor_date_raw = self.__read_eeprom_specific_bytes( +- (offset + XCVR_VENDOR_DATE_OFFSET), XCVR_VENDOR_DATE_WIDTH) +- sfp_vendor_date_data = sfpi_obj.parse_vendor_date( +- sfp_vendor_date_raw, 0) +- +- transceiver_info_dict = dict.fromkeys(self.info_dict_keys, 'N/A') +- compliance_code_dict = dict() +- +- if sfp_interface_bulk_data: +- transceiver_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value'] +- transceiver_info_dict['connector'] = sfp_interface_bulk_data['data']['Connector']['value'] +- transceiver_info_dict['encoding'] = sfp_interface_bulk_data['data']['EncodingCodes']['value'] +- transceiver_info_dict['ext_identifier'] = sfp_interface_bulk_data['data']['Extended Identifier']['value'] +- transceiver_info_dict['ext_rateselect_compliance'] = sfp_interface_bulk_data['data']['RateIdentifier']['value'] +- transceiver_info_dict['type_abbrv_name'] = sfp_interface_bulk_data['data']['type_abbrv_name']['value'] +- +- transceiver_info_dict['manufacturer'] = sfp_vendor_name_data[ +- 'data']['Vendor Name']['value'] if sfp_vendor_name_data else 'N/A' +- transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] if sfp_vendor_pn_data else 'N/A' +- transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] if sfp_vendor_rev_data else 'N/A' +- transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] if sfp_vendor_sn_data else 'N/A' +- transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] if sfp_vendor_oui_data else 'N/A' +- transceiver_info_dict['vendor_date'] = sfp_vendor_date_data[ +- 'data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] if sfp_vendor_date_data else 'N/A' +- transceiver_info_dict['cable_type'] = "Unknown" +- transceiver_info_dict['cable_length'] = "Unknown" +- +- if self.port_num < 53: +- for key in sfp_cable_length_tup: +- if key in sfp_interface_bulk_data['data']: +- transceiver_info_dict['cable_type'] = key +- transceiver_info_dict['cable_length'] = str( +- sfp_interface_bulk_data['data'][key]['value']) +- +- for key in sfp_compliance_code_tup: +- if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: +- compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value'] +- +- transceiver_info_dict['specification_compliance'] = str( +- compliance_code_dict) +- transceiver_info_dict['nominal_bit_rate'] = str( +- sfp_interface_bulk_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value']) +- else: +- for key in qsfp_cable_length_tup: +- if key in sfp_interface_bulk_data['data']: +- transceiver_info_dict['cable_type'] = key +- transceiver_info_dict['cable_length'] = str( +- sfp_interface_bulk_data['data'][key]['value']) +- +- for key in qsfp_compliance_code_tup: +- if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: +- compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value'] +- +- transceiver_info_dict['specification_compliance'] = str( +- compliance_code_dict) +- transceiver_info_dict['nominal_bit_rate'] = str( +- sfp_interface_bulk_data['data']['Nominal Bit Rate(100Mbs)']['value']) +- +- +- return transceiver_info_dict +- +- def get_transceiver_bulk_status(self): +- """ +- Retrieves transceiver bulk status of this SFP +- Returns: +- A dict which contains following keys/values : +- ======================================================================== +- keys |Value Format |Information +- ---------------------------|---------------|---------------------------- +- rx_los |BOOLEAN |RX loss-of-signal status, True if has RX los, False if not. +- tx_fault |BOOLEAN |TX fault status, True if has TX fault, False if not. +- reset_status |BOOLEAN |reset status, True if SFP in reset, False if not. +- lp_mode |BOOLEAN |low power mode status, True in lp mode, False if not. +- tx_disable |BOOLEAN |TX disable status, True TX disabled, False if not. +- tx_disabled_channel |HEX |disabled TX channels in hex, bits 0 to 3 represent channel 0 +- | |to channel 3. +- temperature |INT |module temperature in Celsius +- voltage |INT |supply voltage in mV +- txbias |INT |TX Bias Current in mA, n is the channel number, +- | |for example, tx2bias stands for tx bias of channel 2. +- rxpower |INT |received optical power in mW, n is the channel number, +- | |for example, rx2power stands for rx power of channel 2. +- txpower |INT |TX output power in mW, n is the channel number, +- | |for example, tx2power stands for tx power of channel 2. +- ======================================================================== +- """ +- # check present status +- if self.port_num < 53: #SFP case +- sfpd_obj = sff8472Dom() +- if not self.get_presence() or not sfpd_obj: +- return {} +- +- eeprom_ifraw = self.__read_eeprom_specific_bytes(0, SFP_DOM_OFFSET) +- sfpi_obj = sff8472InterfaceId(eeprom_ifraw) +- cal_type = sfpi_obj.get_calibration_type() +- sfpd_obj._calibration_type = cal_type +- +- offset = SFP_DOM_OFFSET +- transceiver_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A') +- dom_temperature_raw = self.__read_eeprom_specific_bytes( +- (offset + SFP_TEMPE_OFFSET), SFP_TEMPE_WIDTH) +- +- if dom_temperature_raw is not None: +- dom_temperature_data = sfpd_obj.parse_temperature( +- dom_temperature_raw, 0) +- transceiver_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] +- +- dom_voltage_raw = self.__read_eeprom_specific_bytes( +- (offset + SFP_VOLT_OFFSET), SFP_VOLT_WIDTH) +- if dom_voltage_raw is not None: +- dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) +- transceiver_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] +- +- dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( +- (offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) +- if dom_channel_monitor_raw is not None: +- dom_voltage_data = sfpd_obj.parse_channel_monitor_params( +- dom_channel_monitor_raw, 0) +- transceiver_dom_info_dict['tx1power'] = dom_voltage_data['data']['TXPower']['value'] +- transceiver_dom_info_dict['rx1power'] = dom_voltage_data['data']['RXPower']['value'] +- transceiver_dom_info_dict['tx1bias'] = dom_voltage_data['data']['TXBias']['value'] +- +- else: #QSFP case +- sfpd_obj = sff8436Dom() +- sfpi_obj = sff8436InterfaceId() +- +- if not self.get_presence() or not sfpi_obj or not sfpd_obj: +- return {} +- +- transceiver_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A') +- offset = QSFP_DOM_OFFSET +- offset_xcvr = QSFP_INFO_OFFSET +- +- # QSFP capability byte parse, through this byte can know whether it support tx_power or not. +- # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, +- # need to add more code for determining the capability and version compliance +- # in SFF-8636 dom capability definitions evolving with the versions. +- qsfp_dom_capability_raw = self.__read_eeprom_specific_bytes( +- (offset_xcvr + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH) +- if qsfp_dom_capability_raw is not None: +- qspf_dom_capability_data = sfpi_obj.parse_dom_capability( +- qsfp_dom_capability_raw, 0) +- else: +- return None +- +- dom_temperature_raw = self.__read_eeprom_specific_bytes( +- (offset + QSFP_TEMPE_OFFSET), QSFP_TEMPE_WIDTH) +- if dom_temperature_raw is not None: +- dom_temperature_data = sfpd_obj.parse_temperature( +- dom_temperature_raw, 0) +- transceiver_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] +- +- dom_voltage_raw = self.__read_eeprom_specific_bytes( +- (offset + QSFP_VOLT_OFFSET), QSFP_VOLT_WIDTH) +- if dom_voltage_raw is not None: +- dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) +- transceiver_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] +- +- qsfp_dom_rev_raw = self.__read_eeprom_specific_bytes( +- (offset + QSFP_DOM_REV_OFFSET), QSFP_DOM_REV_WIDTH) +- if qsfp_dom_rev_raw is not None: +- qsfp_dom_rev_data = sfpd_obj.parse_sfp_dom_rev(qsfp_dom_rev_raw, 0) +- qsfp_dom_rev = qsfp_dom_rev_data['data']['dom_rev']['value'] +- +- # The tx_power monitoring is only available on QSFP which compliant with SFF-8636 +- # and claimed that it support tx_power with one indicator bit. +- dom_channel_monitor_data = {} +- dom_channel_monitor_raw = None +- qsfp_tx_power_support = qspf_dom_capability_data['data']['Tx_power_support']['value'] +- if (qsfp_dom_rev[0:8] != 'SFF-8636' or (qsfp_dom_rev[0:8] == 'SFF-8636' and qsfp_tx_power_support != 'on')): +- dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( +- (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WIDTH) +- if dom_channel_monitor_raw is not None: +- dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params( +- dom_channel_monitor_raw, 0) +- +- else: +- dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( +- (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) +- if dom_channel_monitor_raw is not None: +- dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power( +- dom_channel_monitor_raw, 0) +- transceiver_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TX1Power']['value'] +- transceiver_dom_info_dict['tx2power'] = dom_channel_monitor_data['data']['TX2Power']['value'] +- transceiver_dom_info_dict['tx3power'] = dom_channel_monitor_data['data']['TX3Power']['value'] +- transceiver_dom_info_dict['tx4power'] = dom_channel_monitor_data['data']['TX4Power']['value'] +- +- if dom_channel_monitor_raw: +- transceiver_dom_info_dict['rx1power'] = dom_channel_monitor_data['data']['RX1Power']['value'] +- transceiver_dom_info_dict['rx2power'] = dom_channel_monitor_data['data']['RX2Power']['value'] +- transceiver_dom_info_dict['rx3power'] = dom_channel_monitor_data['data']['RX3Power']['value'] +- transceiver_dom_info_dict['rx4power'] = dom_channel_monitor_data['data']['RX4Power']['value'] +- transceiver_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TX1Bias']['value'] +- transceiver_dom_info_dict['tx2bias'] = dom_channel_monitor_data['data']['TX2Bias']['value'] +- transceiver_dom_info_dict['tx3bias'] = dom_channel_monitor_data['data']['TX3Bias']['value'] +- transceiver_dom_info_dict['tx4bias'] = dom_channel_monitor_data['data']['TX4Bias']['value'] +- #End of else +- +- +- for key in transceiver_dom_info_dict: +- transceiver_dom_info_dict[key] = self._convert_string_to_num( +- transceiver_dom_info_dict[key]) +- +- transceiver_dom_info_dict['rx_los'] = self.get_rx_los() +- transceiver_dom_info_dict['tx_fault'] = self.get_tx_fault() +- transceiver_dom_info_dict['reset_status'] = self.get_reset_status() +- transceiver_dom_info_dict['lp_mode'] = self.get_lpmode() +- +- return transceiver_dom_info_dict +- +- def get_transceiver_threshold_info(self): +- """ +- Retrieves transceiver threshold info of this SFP +- Returns: +- A dict which contains following keys/values : +- ======================================================================== +- keys |Value Format |Information +- ---------------------------|---------------|---------------------------- +- temphighalarm |FLOAT |High Alarm Threshold value of temperature in Celsius. +- templowalarm |FLOAT |Low Alarm Threshold value of temperature in Celsius. +- temphighwarning |FLOAT |High Warning Threshold value of temperature in Celsius. +- templowwarning |FLOAT |Low Warning Threshold value of temperature in Celsius. +- vcchighalarm |FLOAT |High Alarm Threshold value of supply voltage in mV. +- vcclowalarm |FLOAT |Low Alarm Threshold value of supply voltage in mV. +- vcchighwarning |FLOAT |High Warning Threshold value of supply voltage in mV. +- vcclowwarning |FLOAT |Low Warning Threshold value of supply voltage in mV. +- rxpowerhighalarm |FLOAT |High Alarm Threshold value of received power in dBm. +- rxpowerlowalarm |FLOAT |Low Alarm Threshold value of received power in dBm. +- rxpowerhighwarning |FLOAT |High Warning Threshold value of received power in dBm. +- rxpowerlowwarning |FLOAT |Low Warning Threshold value of received power in dBm. +- txpowerhighalarm |FLOAT |High Alarm Threshold value of transmit power in dBm. +- txpowerlowalarm |FLOAT |Low Alarm Threshold value of transmit power in dBm. +- txpowerhighwarning |FLOAT |High Warning Threshold value of transmit power in dBm. +- txpowerlowwarning |FLOAT |Low Warning Threshold value of transmit power in dBm. +- txbiashighalarm |FLOAT |High Alarm Threshold value of tx Bias Current in mA. +- txbiaslowalarm |FLOAT |Low Alarm Threshold value of tx Bias Current in mA. +- txbiashighwarning |FLOAT |High Warning Threshold value of tx Bias Current in mA. +- txbiaslowwarning |FLOAT |Low Warning Threshold value of tx Bias Current in mA. +- ======================================================================== +- """ +- # check present status +- if self.port_num < 53: +- sfpd_obj = sff8472Dom() +- +- if not self.get_presence() and not sfpd_obj: +- return {} +- +- eeprom_ifraw = self.__read_eeprom_specific_bytes(0, SFP_DOM_OFFSET) +- sfpi_obj = sff8472InterfaceId(eeprom_ifraw) +- cal_type = sfpi_obj.get_calibration_type() +- sfpd_obj._calibration_type = cal_type +- +- offset = SFP_DOM_OFFSET +- transceiver_dom_threshold_info_dict = dict.fromkeys( +- self.threshold_dict_keys, 'N/A') +- dom_module_threshold_raw = self.__read_eeprom_specific_bytes( +- (offset + SFP_MODULE_THRESHOLD_OFFSET), SFP_MODULE_THRESHOLD_WIDTH) +- if dom_module_threshold_raw is not None: +- dom_module_threshold_data = sfpd_obj.parse_alarm_warning_threshold( +- dom_module_threshold_raw, 0) +- +- transceiver_dom_threshold_info_dict['temphighalarm'] = dom_module_threshold_data['data']['TempHighAlarm']['value'] +- transceiver_dom_threshold_info_dict['templowalarm'] = dom_module_threshold_data['data']['TempLowAlarm']['value'] +- transceiver_dom_threshold_info_dict['temphighwarning'] = dom_module_threshold_data['data']['TempHighWarning']['value'] +- transceiver_dom_threshold_info_dict['templowwarning'] = dom_module_threshold_data['data']['TempLowWarning']['value'] +- transceiver_dom_threshold_info_dict['vcchighalarm'] = dom_module_threshold_data['data']['VoltageHighAlarm']['value'] +- transceiver_dom_threshold_info_dict['vcclowalarm'] = dom_module_threshold_data['data']['VoltageLowAlarm']['value'] +- transceiver_dom_threshold_info_dict['vcchighwarning'] = dom_module_threshold_data[ +- 'data']['VoltageHighWarning']['value'] +- transceiver_dom_threshold_info_dict['vcclowwarning'] = dom_module_threshold_data['data']['VoltageLowWarning']['value'] +- transceiver_dom_threshold_info_dict['txbiashighalarm'] = dom_module_threshold_data['data']['BiasHighAlarm']['value'] +- transceiver_dom_threshold_info_dict['txbiaslowalarm'] = dom_module_threshold_data['data']['BiasLowAlarm']['value'] +- transceiver_dom_threshold_info_dict['txbiashighwarning'] = dom_module_threshold_data['data']['BiasHighWarning']['value'] +- transceiver_dom_threshold_info_dict['txbiaslowwarning'] = dom_module_threshold_data['data']['BiasLowWarning']['value'] +- transceiver_dom_threshold_info_dict['txpowerhighalarm'] = dom_module_threshold_data['data']['TXPowerHighAlarm']['value'] +- transceiver_dom_threshold_info_dict['txpowerlowalarm'] = dom_module_threshold_data['data']['TXPowerLowAlarm']['value'] +- transceiver_dom_threshold_info_dict['txpowerhighwarning'] = dom_module_threshold_data['data']['TXPowerHighWarning']['value'] +- transceiver_dom_threshold_info_dict['txpowerlowwarning'] = dom_module_threshold_data['data']['TXPowerLowWarning']['value'] +- transceiver_dom_threshold_info_dict['rxpowerhighalarm'] = dom_module_threshold_data['data']['RXPowerHighAlarm']['value'] +- transceiver_dom_threshold_info_dict['rxpowerlowalarm'] = dom_module_threshold_data['data']['RXPowerLowAlarm']['value'] +- transceiver_dom_threshold_info_dict['rxpowerhighwarning'] = dom_module_threshold_data['data']['RXPowerHighWarning']['value'] +- transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_module_threshold_data['data']['RXPowerLowWarning']['value'] +- +- for key in transceiver_dom_threshold_info_dict: +- transceiver_dom_threshold_info_dict[key] = self._convert_string_to_num( +- transceiver_dom_threshold_info_dict[key]) +- +- return transceiver_dom_threshold_info_dict +- +- +- else: +- sfpd_obj = sff8436Dom() +- +- if not self.get_presence() or not sfpd_obj: +- return {} +- +- offset = QSFP_PAGE03_OFFSET +- transceiver_dom_threshold_dict = dict.fromkeys( +- self.threshold_dict_keys, 'N/A') +- dom_thres_raw = self.__read_eeprom_specific_bytes( +- offset + QSFP_MODULE_THRESHOLD_OFFSET, QSFP_MODULE_THRESHOLD_WIDTH) if self.get_presence() and sfpd_obj else None +- +- if dom_thres_raw: +- module_threshold_values = sfpd_obj.parse_module_threshold_values( +- dom_thres_raw, 0) +- module_threshold_data = module_threshold_values.get('data') +- if module_threshold_data: +- transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['TempHighAlarm']['value'] +- transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['TempLowAlarm']['value'] +- transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['TempHighWarning']['value'] +- transceiver_dom_threshold_dict['templowwarning'] = module_threshold_data['TempLowWarning']['value'] +- transceiver_dom_threshold_dict['vcchighalarm'] = module_threshold_data['VccHighAlarm']['value'] +- transceiver_dom_threshold_dict['vcclowalarm'] = module_threshold_data['VccLowAlarm']['value'] +- transceiver_dom_threshold_dict['vcchighwarning'] = module_threshold_data['VccHighWarning']['value'] +- transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['VccLowWarning']['value'] +- +- dom_thres_raw = self.__read_eeprom_specific_bytes( +- offset + QSFP_CHANNEL_THRESHOLD_OFFSET, QSFP_CHANNEL_THRESHOLD_WIDTH) if self.get_presence() and sfpd_obj else None +- channel_threshold_values = sfpd_obj.parse_channel_threshold_values( +- dom_thres_raw, 0) +- channel_threshold_data = channel_threshold_values.get('data') +- if channel_threshold_data: +- transceiver_dom_threshold_dict['rxpowerhighalarm'] = channel_threshold_data['RxPowerHighAlarm']['value'] +- transceiver_dom_threshold_dict['rxpowerlowalarm'] = channel_threshold_data['RxPowerLowAlarm']['value'] +- transceiver_dom_threshold_dict['rxpowerhighwarning'] = channel_threshold_data['RxPowerHighWarning']['value'] +- transceiver_dom_threshold_dict['rxpowerlowwarning'] = channel_threshold_data['RxPowerLowWarning']['value'] +- transceiver_dom_threshold_dict['txpowerhighalarm'] = "0.0dBm" +- transceiver_dom_threshold_dict['txpowerlowalarm'] = "0.0dBm" +- transceiver_dom_threshold_dict['txpowerhighwarning'] = "0.0dBm" +- transceiver_dom_threshold_dict['txpowerlowwarning'] = "0.0dBm" +- transceiver_dom_threshold_dict['txbiashighalarm'] = channel_threshold_data['TxBiasHighAlarm']['value'] +- transceiver_dom_threshold_dict['txbiaslowalarm'] = channel_threshold_data['TxBiasLowAlarm']['value'] +- transceiver_dom_threshold_dict['txbiashighwarning'] = channel_threshold_data['TxBiasHighWarning']['value'] +- transceiver_dom_threshold_dict['txbiaslowwarning'] = channel_threshold_data['TxBiasLowWarning']['value'] +- +- for key in transceiver_dom_threshold_dict: +- transceiver_dom_threshold_dict[key] = self._convert_string_to_num( +- transceiver_dom_threshold_dict[key]) +- +- return transceiver_dom_threshold_dict ++ return os.system(self.HOST_CHK_CMD) == 0 + + def get_reset_status(self): + """ +@@ -651,7 +88,7 @@ class Sfp(SfpBase): + Returns: + A Boolean, True if reset enabled, False if disabled + """ +- if self.port_num < 53: # non-QSFP ports don't support it. ++ if self.port_num < 53: #Copper port and sfp ports aren't supported. + return False + + reset_path="{}{}{}".format(CPLD_I2C_PATH , "module_reset_" , str(self.port_num)) +@@ -660,7 +97,7 @@ class Sfp(SfpBase): + if val is not None: + return int(val, 10) == 1 + else: +- return False ++ return False # CPLD port doesn't support this feature + + def get_rx_los(self): + """ +@@ -669,34 +106,29 @@ class Sfp(SfpBase): + A Boolean, True if SFP has RX LOS, False if not. + Note : RX LOS status is latched until a call to get_rx_los or a reset. + """ +- rx_los = False ++ rx_los = [False] + + if self.port_num < 49: #Copper port, no sysfs +- return False ++ return [False] + + if self.port_num < 53: +- rx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_rx_los_', self.port_num) ++ rx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_rx_los_', self.port_num) + rx_los=self._api_helper.read_txt_file(rx_path) +- if rx_los is None: +- return False +- #status_control_raw = self.__read_eeprom_specific_bytes( +- # SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) +- #if status_control_raw: +- # data = int(status_control_raw[0], 16) +- # rx_los = (sffbase().test_bit(data, 1) != 0) +- ++ if rx_los is not None: ++ if rx_los == '1': ++ return [True] ++ else: ++ return [False] ++ else: ++ return [False] + else: +- rx_los_list = [] +- dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( +- QSFP_CHANNL_RX_LOS_STATUS_OFFSET, QSFP_CHANNL_RX_LOS_STATUS_WIDTH) if self.get_presence() else None +- if dom_channel_monitor_raw is not None: +- rx_los_data = int(dom_channel_monitor_raw[0], 16) +- rx_los_list.append(rx_los_data & 0x01 != 0) +- rx_los_list.append(rx_los_data & 0x02 != 0) +- rx_los_list.append(rx_los_data & 0x04 != 0) +- rx_los_list.append(rx_los_data & 0x08 != 0) +- rx_los = rx_los_list[0] and rx_los_list[1] and rx_los_list[2] and rx_los_list[3] +- return rx_los ++ api = self.get_xcvr_api() ++ if api is not None: ++ rx_los = api.get_rx_los() ++ if isinstance(rx_los, list) and "N/A" in rx_los: ++ return [False for _ in rx_los] ++ return rx_los ++ return None + + def get_tx_fault(self): + """ +@@ -705,33 +137,28 @@ class Sfp(SfpBase): + A Boolean, True if SFP has TX fault, False if not + Note : TX fault status is lached until a call to get_tx_fault or a reset. + """ +- tx_fault = False ++ tx_fault = [False] + if self.port_num < 49: #Copper port, no sysfs +- return False ++ return [False] + + if self.port_num < 53: +- tx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_tx_fault_', self.port_num) ++ tx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_tx_fault_', self.port_num) + tx_fault=self._api_helper.read_txt_file(tx_path) +- if tx_fault is None: +- return False +- #status_control_raw = self.__read_eeprom_specific_bytes( +- # SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) +- #if status_control_raw: +- # data = int(status_control_raw[0], 16) +- # tx_fault = (sffbase().test_bit(data, 2) != 0) ++ if tx_fault is not None: ++ if tx_fault == '1': ++ return [True] ++ else: ++ return [False] ++ else: ++ return [False] + else: +- tx_fault_list = [] +- dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( +- QSFP_CHANNL_TX_FAULT_STATUS_OFFSET, QSFP_CHANNL_TX_FAULT_STATUS_WIDTH) if self.get_presence() else None +- if dom_channel_monitor_raw is not None: +- tx_fault_data = int(dom_channel_monitor_raw[0], 16) +- tx_fault_list.append(tx_fault_data & 0x01 != 0) +- tx_fault_list.append(tx_fault_data & 0x02 != 0) +- tx_fault_list.append(tx_fault_data & 0x04 != 0) +- tx_fault_list.append(tx_fault_data & 0x08 != 0) +- tx_fault = tx_fault_list[0] and tx_fault_list[1] and tx_fault_list[2] and tx_fault_list[3] +- +- return tx_fault ++ api = self.get_xcvr_api() ++ if api is not None: ++ tx_fault = api.get_tx_fault() ++ if isinstance(tx_fault, list) and "N/A" in tx_fault: ++ return [False for _ in tx_fault] ++ return tx_fault ++ return None + + def get_tx_disable(self): + """ +@@ -742,70 +169,19 @@ class Sfp(SfpBase): + if self.port_num < 49: #Copper port, no sysfs + return False + +- if self.port_num < 53: +- tx_disable = False ++ if self.port_num < 53: ++ tx_disable = False + + tx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_tx_disable_', self.port_num) + tx_disable=self._api_helper.read_txt_file(tx_path) +- +- +- #status_control_raw = self.__read_eeprom_specific_bytes( +- # SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) +- #if status_control_raw: +- # data = int(status_control_raw[0], 16) +- # tx_disable_hard = (sffbase().test_bit( +- # data, SFP_TX_DISABLE_HARD_BIT) != 0) +- # tx_disable_soft = (sffbase().test_bit( +- # data, SFP_TX_DISABLE_SOFT_BIT) != 0) +- # tx_disable = tx_disable_hard | tx_disable_soft + if tx_disable is not None: +- return tx_disable ++ return tx_disable + else: + return False + + else: +- tx_disable_list = [] +- +- sfpd_obj = sff8436Dom() +- if sfpd_obj is None: +- return False +- +- dom_control_raw = self.__read_eeprom_specific_bytes( +- QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None +- if dom_control_raw is not None: +- dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) +- tx_disable_list.append( +- 'On' == dom_control_data['data']['TX1Disable']['value']) +- tx_disable_list.append( +- 'On' == dom_control_data['data']['TX2Disable']['value']) +- tx_disable_list.append( +- 'On' == dom_control_data['data']['TX3Disable']['value']) +- tx_disable_list.append( +- 'On' == dom_control_data['data']['TX4Disable']['value']) +- +- return tx_disable_list +- +- def get_tx_disable_channel(self): +- """ +- Retrieves the TX disabled channels in this SFP +- Returns: +- A hex of 4 bits (bit 0 to bit 3 as channel 0 to channel 3) to represent +- TX channels which have been disabled in this SFP. +- As an example, a returned value of 0x5 indicates that channel 0 +- and channel 2 have been disabled. +- """ +- if self.port_num < 53: +- # SFP doesn't support this feature +- return False +- else: +- tx_disable_list = self.get_tx_disable() +- if tx_disable_list is None: +- return 0 +- tx_disabled = 0 +- for i in range(len(tx_disable_list)): +- if tx_disable_list[i]: +- tx_disabled |= 1 << i +- return tx_disabled ++ api = self.get_xcvr_api() ++ return api.get_tx_disable() if api is not None else None + + def get_lpmode(self): + """ +@@ -813,7 +189,7 @@ class Sfp(SfpBase): + Returns: + A Boolean, True if lpmode is enabled, False if disabled + """ +- if self.port_num < 53: ++ if self.port_num < 53: + # SFP doesn't support this feature + return False + else: +@@ -821,124 +197,14 @@ class Sfp(SfpBase): + power_override = self.get_power_override() + return power_set and power_override + +- +- def get_power_set(self): +- +- if self.port_num < 53: ++ def get_power_set(self): ++ if self.port_num < 53: + # SFP doesn't support this feature + return False + else: +- power_set = False +- +- sfpd_obj = sff8436Dom() +- if sfpd_obj is None: +- return False +- +- dom_control_raw = self.__read_eeprom_specific_bytes( +- QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None +- if dom_control_raw is not None: +- dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) +- power_set = ( +- 'On' == dom_control_data['data']['PowerSet']['value']) +- +- return power_set +- +- def get_power_override(self): +- """ +- Retrieves the power-override status of this SFP +- Returns: +- A Boolean, True if power-override is enabled, False if disabled +- """ +- if self.port_num < 53: +- return False # SFP doesn't support this feature +- else: +- power_override = False +- +- +- sfpd_obj = sff8436Dom() +- if sfpd_obj is None: +- return False +- +- dom_control_raw = self.__read_eeprom_specific_bytes( +- QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None +- if dom_control_raw is not None: +- dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) +- power_override = ( +- 'On' == dom_control_data['data']['PowerOverride']['value']) +- +- return power_override +- +- def get_temperature(self): +- """ +- Retrieves the temperature of this SFP +- Returns: +- An integer number of current temperature in Celsius +- """ +- transceiver_dom_info_dict = self.get_transceiver_bulk_status() +- return transceiver_dom_info_dict.get("temperature", "N/A") +- +- def get_voltage(self): +- """ +- Retrieves the supply voltage of this SFP +- Returns: +- An integer number of supply voltage in mV +- """ +- transceiver_dom_info_dict = self.get_transceiver_bulk_status() +- return transceiver_dom_info_dict.get("voltage", "N/A") +- +- def get_tx_bias(self): +- """ +- Retrieves the TX bias current of this SFP +- Returns: +- A list of four integer numbers, representing TX bias in mA +- for channel 0 to channel 4. +- Ex. ['110.09', '111.12', '108.21', '112.09'] +- """ +- transceiver_dom_info_dict = self.get_transceiver_bulk_status() ++ api = self.get_xcvr_api() ++ return api.get_power_set() if api is not None else None + +- tx1_bs = transceiver_dom_info_dict.get("tx1bias", "N/A") +- if self.port_num < 53: +- return [tx1_bs, "N/A", "N/A", "N/A"] if transceiver_dom_info_dict else [] +- +- tx2_bs = transceiver_dom_info_dict.get("tx2bias", "N/A") +- tx3_bs = transceiver_dom_info_dict.get("tx3bias", "N/A") +- tx4_bs = transceiver_dom_info_dict.get("tx4bias", "N/A") +- return [tx1_bs, tx2_bs, tx3_bs, tx4_bs] if transceiver_dom_info_dict else [] +- +- def get_rx_power(self): +- """ +- Retrieves the received optical power for this SFP +- Returns: +- A list of four integer numbers, representing received optical +- power in mW for channel 0 to channel 4. +- Ex. ['1.77', '1.71', '1.68', '1.70'] +- """ +- transceiver_dom_info_dict = self.get_transceiver_bulk_status() +- +- rx1_pw = transceiver_dom_info_dict.get("rx1power", "N/A") +- if self.port_num < 53: +- return [rx1_pw, "N/A", "N/A", "N/A"] if transceiver_dom_info_dict else [] +- rx2_pw = transceiver_dom_info_dict.get("rx2power", "N/A") +- rx3_pw = transceiver_dom_info_dict.get("rx3power", "N/A") +- rx4_pw = transceiver_dom_info_dict.get("rx4power", "N/A") +- return [rx1_pw, rx2_pw, rx3_pw, rx4_pw] if transceiver_dom_info_dict else [] +- +- def get_tx_power(self): +- """ +- Retrieves the TX power of this SFP +- Returns: +- A list of four integer numbers, representing TX power in mW +- for channel 0 to channel 4. +- Ex. ['1.86', '1.86', '1.86', '1.86'] +- """ +- transceiver_dom_info_dict = self.get_transceiver_bulk_status() +- tx1_pw = transceiver_dom_info_dict.get("tx1power", "N/A") +- if self.port_num < 53: +- return [tx1_pw, "N/A", "N/A", "N/A"] if transceiver_dom_info_dict else [] +- tx2_pw = transceiver_dom_info_dict.get("tx2power", "N/A") +- tx3_pw = transceiver_dom_info_dict.get("tx3power", "N/A") +- tx4_pw = transceiver_dom_info_dict.get("tx4power", "N/A") +- return [tx1_pw, tx2_pw, tx3_pw, tx4_pw] + + def reset(self): + """ +@@ -947,7 +213,7 @@ class Sfp(SfpBase): + A boolean, True if successful, False if not + """ + # Check for invalid port_num +- if self.port_num < 53: # non-QSFP ports don't support it. ++ if self.port_num < 49: #Copper port, no sysfs + return False + + reset_path = "{}{}{}".format(CPLD_I2C_PATH, 'module_reset_', self.port_num) +@@ -974,8 +240,8 @@ class Sfp(SfpBase): + return False + + if self.port_num < 53: +- tx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_tx_disable_', self.port_num) +- ret = self.__write_txt_file(tx_path, 1 if tx_disable else 0) ++ tx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_tx_disable_', self.port_num) ++ ret = self._api_helper.write_txt_file(tx_path, 1 if tx_disable else 0) + if ret is not None: + time.sleep(0.01) + return ret +@@ -985,78 +251,8 @@ class Sfp(SfpBase): + else: + if not self.get_presence(): + return False +- sysfsfile_eeprom = None +- try: +- tx_disable_ctl = 0xf if tx_disable else 0x0 +- buffer = create_string_buffer(1) +- if sys.version_info[0] >= 3: +- buffer[0] = tx_disable_ctl +- else: +- buffer[0] = chr(tx_disable_ctl) +- # Write to eeprom +- sysfsfile_eeprom = open( +- self.port_to_eeprom_mapping[self.port_num], "r+b") +- sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) +- sysfsfile_eeprom.write(buffer[0]) +- except IOError as e: +- print ('Error: unable to open file: ',str(e)) +- return False +- finally: +- if sysfsfile_eeprom is not None: +- sysfsfile_eeprom.close() +- time.sleep(0.01) +- return True +- +- def tx_disable_channel(self, channel, disable): +- """ +- Sets the tx_disable for specified SFP channels +- Args: +- channel : A hex of 4 bits (bit 0 to bit 3) which represent channel 0 to 3, +- e.g. 0x5 for channel 0 and channel 2. +- disable : A boolean, True to disable TX channels specified in channel, +- False to enable +- Returns: +- A boolean, True if successful, False if not +- """ +- +- if self.port_num < 53: +- return False # SFP doesn't support this feature +- else: +- if not self.get_presence(): +- return False +- +- sysfsfile_eeprom = None +- try: +- channel_state = self.get_tx_disable_channel() +- +- for i in range(4): +- channel_mask = (1 << i) +- if not (channel & channel_mask): +- continue +- +- if disable: +- channel_state |= channel_mask +- else: +- channel_state &= ~channel_mask +- +- buffer = create_string_buffer(1) +- if sys.version_info[0] >= 3: +- buffer[0] = channel_state +- else: +- buffer[0] = chr(channel_state) +- # Write to eeprom +- sysfsfile_eeprom = open( +- self.port_to_eeprom_mapping[self.port_num], "r+b") +- sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) +- sysfsfile_eeprom.write(buffer[0]) +- except IOError as e: +- print ('Error: unable to open file: ', str(e)) +- return False +- finally: +- if sysfsfile_eeprom is not None: +- sysfsfile_eeprom.close() +- time.sleep(0.01) +- return True ++ api = self.get_xcvr_api() ++ return api.tx_disable(tx_disable) if api is not None else None + + def set_lpmode(self, lpmode): + """ +@@ -1070,12 +266,23 @@ class Sfp(SfpBase): + if self.port_num < 53: + return False # SFP doesn't support this feature + else: ++ ''' ++ use power override to control lpmode ++ ''' ++ if not self.get_presence(): ++ return False ++ api = self.get_xcvr_api() ++ if api is None: ++ return False ++ if api.get_lpmode_support() == False: ++ logger.log_notice("The transceiver of port {} doesn't support to set low power mode.". format(self.port_num)) ++ return True + if lpmode is True: +- self.set_power_override(True, True) ++ ret = api.set_power_override(True, True) + else: +- self.set_power_override(False, False) ++ ret = api.set_power_override(True, False) + +- return True ++ return ret + + def set_power_override(self, power_override, power_set): + """ +@@ -1099,24 +306,8 @@ class Sfp(SfpBase): + else: + if not self.get_presence(): + return False +- try: +- power_override_bit = (1 << 0) if power_override else 0 +- power_set_bit = (1 << 1) if power_set else (1 << 3) +- +- buffer = create_string_buffer(1) +- if sys.version_info[0] >= 3: +- buffer[0] = (power_override_bit | power_set_bit) +- else: +- buffer[0] = chr(power_override_bit | power_set_bit) +- # Write to eeprom +- with open(self.port_to_eeprom_mapping[self.port_num], "r+b") as fd: +- fd.seek(QSFP_POWEROVERRIDE_OFFSET) +- fd.write(buffer[0]) +- time.sleep(0.01) +- except Exception: +- print ('Error: unable to open file: ', str(e)) +- return False +- return True ++ api = self.get_xcvr_api() ++ return api.set_power_override(power_override, power_set) if api is not None else None + + def get_name(self): + """ +@@ -1125,9 +316,9 @@ class Sfp(SfpBase): + string: The name of the device + """ + sfputil_helper = SfpUtilHelper() +- sfputil_helper.read_porttab_mappings( +- self.__get_path_to_port_config_file()) +- name = sfputil_helper.logical[self.index] or "Unknown" ++ port_config_file_path = device_info.get_path_to_port_config_file() ++ sfputil_helper.read_porttab_mappings(port_config_file_path) ++ name = sfputil_helper.logical[self.port_num - 1] or "Unknown" + return name + + def get_presence(self): +@@ -1139,11 +330,11 @@ class Sfp(SfpBase): + if self.port_num < 49: #Copper port, no sysfs + return False + +- present_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_present_', self.port_num) ++ present_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_present_', self.port_num) + val=self._api_helper.read_txt_file(present_path) + if val is not None: + return int(val, 10)==1 +- else: ++ else: + return False + + def get_model(self): +@@ -1170,7 +361,7 @@ class Sfp(SfpBase): + Returns: + A boolean value, True if device is operating properly, False if not + """ +- return self.get_presence() and self.get_transceiver_bulk_status() ++ return self.get_presence() and not self.get_reset_status() + + def get_position_in_parent(self): + """ +@@ -1188,3 +379,150 @@ class Sfp(SfpBase): + bool: True if it is replaceable. + """ + return True ++ ++ def __validate_eeprom_sfp(self): ++ checksum_test = 0 ++ eeprom_raw = self.read_eeprom(0, 96) ++ if eeprom_raw is None: ++ return None ++ ++ for i in range(0, 63): ++ checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF ++ else: ++ if checksum_test != eeprom_raw[63]: ++ return False ++ ++ checksum_test = 0 ++ for i in range(64, 95): ++ checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF ++ else: ++ if checksum_test != eeprom_raw[95]: ++ return False ++ ++ api = self.get_xcvr_api() ++ if api is None: ++ return False ++ ++ if api.is_flat_memory(): ++ return True ++ ++ checksum_test = 0 ++ eeprom_raw = self.read_eeprom(384, 96) ++ if eeprom_raw is None: ++ return None ++ ++ for i in range(0, 95): ++ checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF ++ else: ++ if checksum_test != eeprom_raw[95]: ++ return False ++ ++ return True ++ ++ def __validate_eeprom_qsfp(self): ++ checksum_test = 0 ++ eeprom_raw = self.read_eeprom(128, 96) ++ if eeprom_raw is None: ++ return None ++ ++ for i in range(0, 63): ++ checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF ++ else: ++ if checksum_test != eeprom_raw[63]: ++ return False ++ ++ checksum_test = 0 ++ for i in range(64, 95): ++ checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF ++ else: ++ if checksum_test != eeprom_raw[95]: ++ return False ++ ++ api = self.get_xcvr_api() ++ if api is None: ++ return False ++ ++ if api.is_flat_memory(): ++ return True ++ ++ return True ++ ++ def validate_eeprom(self): ++ id_byte_raw = self.read_eeprom(0, 1) ++ if id_byte_raw is None: ++ return None ++ ++ id = id_byte_raw[0] ++ if id in self.QSFP_TYPE_CODE_LIST: ++ return self.__validate_eeprom_qsfp() ++ elif id in self.SFP_TYPE_CODE_LIST: ++ return self.__validate_eeprom_sfp() ++ else: ++ return False ++ ++ def validate_temperature(self): ++ temperature = self.get_temperature() ++ if temperature is None: ++ return None ++ ++ threshold_dict = self.get_transceiver_threshold_info() ++ if threshold_dict is None: ++ return None ++ ++ if isinstance(temperature, float) is not True: ++ return True ++ ++ if isinstance(threshold_dict['temphighalarm'], float) is not True: ++ return True ++ ++ return threshold_dict['temphighalarm'] > temperature ++ ++ def __get_error_description(self): ++ if not self.get_presence(): ++ return self.SFP_STATUS_UNPLUGGED ++ ++ err_stat = self.SFP_STATUS_BIT_INSERTED ++ ++ status = self.validate_eeprom() ++ if status is not True: ++ err_stat = (err_stat | self.SFP_ERROR_BIT_BAD_EEPROM) ++ ++ status = self.validate_temperature() ++ if status is not True: ++ err_stat = (err_stat | self.SFP_ERROR_BIT_HIGH_TEMP) ++ ++ if err_stat is self.SFP_STATUS_BIT_INSERTED: ++ return self.SFP_STATUS_OK ++ else: ++ err_desc = '' ++ cnt = 0 ++ for key in self.SFP_ERROR_BIT_TO_DESCRIPTION_DICT: ++ if (err_stat & key) != 0: ++ if cnt > 0: ++ err_desc = err_desc + "|" ++ cnt = cnt + 1 ++ err_desc = err_desc + self.SFP_ERROR_BIT_TO_DESCRIPTION_DICT[key] ++ ++ return err_desc ++ ++ def get_error_description(self): ++ """ ++ Retrives the error descriptions of the SFP module ++ ++ Returns: ++ String that represents the current error descriptions of vendor specific errors ++ In case there are multiple errors, they should be joined by '|', ++ like: "Bad EEPROM|Unsupported cable" ++ """ ++ if self.port_num < 49: ++ # RJ45 doesn't support this feature ++ return None ++ else: ++ api = self.get_xcvr_api() ++ if api is not None: ++ try: ++ return api.get_error_description() ++ except NotImplementedError: ++ return self.__get_error_description() ++ else: ++ return self.__get_error_description() +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/thermal.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/thermal.py +index 7a453c594..04a714510 100644 +--- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/thermal.py ++++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/thermal.py +@@ -12,56 +12,189 @@ import glob + + try: + from sonic_platform_base.thermal_base import ThermalBase ++ from .helper import DeviceThreshold + except ImportError as e: + raise ImportError(str(e) + "- required module not found") + ++PSU_I2C_PATH = "/sys/bus/i2c/devices/{}-00{}/" ++PSU_I2C_MAPPING = { ++ 0: { ++ "num": 10, ++ "addr": "58" ++ }, ++ 1: { ++ "num": 11, ++ "addr": "59" ++ }, ++} ++ ++PSU_CPLD_I2C_MAPPING = { ++ 0: { ++ "num": 10, ++ "addr": "50" ++ }, ++ 1: { ++ "num": 11, ++ "addr": "51" ++ }, ++} ++ ++NOT_AVAILABLE = DeviceThreshold.NOT_AVAILABLE ++HIGH_THRESHOLD = DeviceThreshold.HIGH_THRESHOLD ++LOW_THRESHOLD = DeviceThreshold.LOW_THRESHOLD ++HIGH_CRIT_THRESHOLD = DeviceThreshold.HIGH_CRIT_THRESHOLD ++LOW_CRIT_THRESHOLD = DeviceThreshold.LOW_CRIT_THRESHOLD ++ ++DEFAULT_THRESHOLD = { ++ 'MB_temp(0x48)' : { ++ HIGH_THRESHOLD : '80.0', ++ LOW_THRESHOLD : NOT_AVAILABLE, ++ HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, ++ LOW_CRIT_THRESHOLD : NOT_AVAILABLE ++ }, ++ 'CB_temp(0x4B)' : { ++ HIGH_THRESHOLD : '80.0', ++ LOW_THRESHOLD : NOT_AVAILABLE, ++ HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, ++ LOW_CRIT_THRESHOLD : NOT_AVAILABLE ++ }, ++ 'FB_temp(0x4A)' : { ++ HIGH_THRESHOLD : '80.0', ++ LOW_THRESHOLD : NOT_AVAILABLE, ++ HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, ++ LOW_CRIT_THRESHOLD : NOT_AVAILABLE ++ }, ++ 'CPU_Package_temp' : { ++ HIGH_THRESHOLD : '71.0', ++ LOW_THRESHOLD : NOT_AVAILABLE, ++ HIGH_CRIT_THRESHOLD : '91.0', ++ LOW_CRIT_THRESHOLD : NOT_AVAILABLE ++ }, ++ 'CPU_Core_0_temp' : { ++ HIGH_THRESHOLD : '71.0', ++ LOW_THRESHOLD : NOT_AVAILABLE, ++ HIGH_CRIT_THRESHOLD : '91.0', ++ LOW_CRIT_THRESHOLD : NOT_AVAILABLE ++ }, ++ 'CPU_Core_1_temp' : { ++ HIGH_THRESHOLD : '71.0', ++ LOW_THRESHOLD : NOT_AVAILABLE, ++ HIGH_CRIT_THRESHOLD : '91.0', ++ LOW_CRIT_THRESHOLD : NOT_AVAILABLE ++ }, ++ 'CPU_Core_2_temp' : { ++ HIGH_THRESHOLD : '71.0', ++ LOW_THRESHOLD : NOT_AVAILABLE, ++ HIGH_CRIT_THRESHOLD : '91.0', ++ LOW_CRIT_THRESHOLD : NOT_AVAILABLE ++ }, ++ 'CPU_Core_3_temp' : { ++ HIGH_THRESHOLD : '71.0', ++ LOW_THRESHOLD : NOT_AVAILABLE, ++ HIGH_CRIT_THRESHOLD : '91.0', ++ LOW_CRIT_THRESHOLD : NOT_AVAILABLE ++ }, ++ 'PSU-1 temp sensor 1' : { ++ HIGH_THRESHOLD : '80.0', ++ LOW_THRESHOLD : NOT_AVAILABLE, ++ HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, ++ LOW_CRIT_THRESHOLD : NOT_AVAILABLE ++ }, ++ 'PSU-2 temp sensor 1' : { ++ HIGH_THRESHOLD : '80.0', ++ LOW_THRESHOLD : NOT_AVAILABLE, ++ HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, ++ LOW_CRIT_THRESHOLD : NOT_AVAILABLE ++ } ++} + + class Thermal(ThermalBase): + """Platform-specific Thermal class""" + + THERMAL_NAME_LIST = [] ++ PSU_THERMAL_NAME_LIST = [] + SYSFS_PATH = "/sys/bus/i2c/devices" ++ CPU_SYSFS_PATH = "/sys/devices/platform" + +- def __init__(self, thermal_index=0): +- self.THERMAL_NAME_LIST = [] +- self.SYSFS_PATH = "/sys/bus/i2c/devices" ++ def __init__(self, thermal_index=0, is_psu=False, psu_index=0): + self.index = thermal_index ++ self.is_psu = is_psu ++ self.psu_index = psu_index ++ self.min_temperature = None ++ self.max_temperature = None ++ ++ if self.is_psu: ++ psu_i2c_bus = PSU_I2C_MAPPING[psu_index]["num"] ++ psu_i2c_addr = PSU_I2C_MAPPING[psu_index]["addr"] ++ self.psu_hwmon_path = PSU_I2C_PATH.format(psu_i2c_bus, ++ psu_i2c_addr) ++ psu_i2c_bus = PSU_CPLD_I2C_MAPPING[psu_index]["num"] ++ psu_i2c_addr = PSU_CPLD_I2C_MAPPING[psu_index]["addr"] ++ self.cpld_path = PSU_I2C_PATH.format(psu_i2c_bus, psu_i2c_addr) + # Add thermal name +- self.THERMAL_NAME_LIST.append("Temp sensor 1") +- self.THERMAL_NAME_LIST.append("Temp sensor 2") +- self.THERMAL_NAME_LIST.append("Temp sensor 3") ++ self.THERMAL_NAME_LIST.append("MB_temp(0x48)") ++ self.THERMAL_NAME_LIST.append("CB_temp(0x4B)") ++ self.THERMAL_NAME_LIST.append("FB_temp(0x4A)") ++ self.THERMAL_NAME_LIST.append("CPU_Package_temp") ++ self.THERMAL_NAME_LIST.append("CPU_Core_0_temp") ++ self.THERMAL_NAME_LIST.append("CPU_Core_1_temp") ++ self.THERMAL_NAME_LIST.append("CPU_Core_2_temp") ++ self.THERMAL_NAME_LIST.append("CPU_Core_3_temp") ++ self.PSU_THERMAL_NAME_LIST.append("PSU-1 temp sensor 1") ++ self.PSU_THERMAL_NAME_LIST.append("PSU-2 temp sensor 1") ++ ++ # Threshold Configuration ++ self.__conf = DeviceThreshold(self.get_name()) ++ # Default threshold. ++ self.__default_threshold = DEFAULT_THRESHOLD[self.get_name()] + + # Set hwmon path + i2c_path = { +- 0: "14-0048/hwmon/hwmon*/", +- 1: "24-004b/hwmon/hwmon*/", +- 2: "25-004a/hwmon/hwmon*/" ++ 0: {"hwmon_path":"14-0048/hwmon/hwmon*/", "ss_index":1}, ++ 1: {"hwmon_path":"24-004b/hwmon/hwmon*/", "ss_index":1}, ++ 2: {"hwmon_path":"25-004a/hwmon/hwmon*/", "ss_index":1}, ++ 3: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":1}, ++ 4: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":4}, ++ 5: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":8}, ++ 6: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":10}, ++ 7: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":14} + }.get(self.index, None) + +- self.hwmon_path = "{}/{}".format(self.SYSFS_PATH, i2c_path) ++ self.is_cpu = False ++ if self.index in range(3,8): ++ self.is_cpu = True ++ self.hwmon_path = "{}/{}".format(self.CPU_SYSFS_PATH, i2c_path["hwmon_path"]) ++ else: ++ self.hwmon_path = "{}/{}".format(self.SYSFS_PATH, i2c_path["hwmon_path"]) + self.ss_key = self.THERMAL_NAME_LIST[self.index] +- self.ss_index = 1 ++ self.ss_index = i2c_path["ss_index"] + + def __read_txt_file(self, file_path): + for filename in glob.glob(file_path): + try: +- with open(filename, 'r') as fd: +- data =fd.readline().rstrip() +- return data ++ with open(filename, 'r') as fd: ++ data =fd.readline().strip() ++ if len(data) > 0: ++ return data + except IOError as e: + pass + + return None + + def __get_temp(self, temp_file): +- temp_file_path = os.path.join(self.hwmon_path, temp_file) ++ if not self.is_psu: ++ temp_file_path = os.path.join(self.hwmon_path, temp_file) ++ else: ++ temp_file_path = temp_file + raw_temp = self.__read_txt_file(temp_file_path) + if raw_temp is not None: + return float(raw_temp)/1000 + else: +- return 0 ++ return 0 + + def __set_threshold(self, file_name, temperature): ++ if self.is_psu: ++ return True + temp_file_path = os.path.join(self.hwmon_path, file_name) + for filename in glob.glob(temp_file_path): + try: +@@ -79,41 +212,153 @@ class Thermal(ThermalBase): + 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) ++ if not self.is_psu: ++ temp_file = "temp{}_input".format(self.ss_index) ++ else: ++ temp_file = self.psu_hwmon_path + "psu_temp1_input" + +- 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 +- """ +- temp_file = "temp{}_max".format(self.ss_index) +- return self.__get_temp(temp_file) ++ current = self.__get_temp(temp_file) ++ ++ if self.min_temperature is None or \ ++ current < self.min_temperature: ++ self.min_temperature = current ++ ++ if self.max_temperature is None or \ ++ current > self.max_temperature: ++ self.max_temperature = current ++ ++ return current + + 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 +- """ +- temp_file = "temp{}_max".format(self.ss_index) +- temperature = temperature *1000 +- self.__set_threshold(temp_file, temperature) ++ try: ++ value = float(temperature) ++ except Exception: ++ return False ++ ++ # The new value can not be more than the default value. ++ default_value = self.__default_threshold[HIGH_THRESHOLD] ++ if default_value != NOT_AVAILABLE: ++ if value > float(default_value): ++ return False ++ ++ try: ++ self.__conf.set_high_threshold(str(value)) ++ except Exception: ++ return False ++ ++ return True ++ ++ def get_high_threshold(self): ++ value = self.__conf.get_high_threshold() ++ if value != NOT_AVAILABLE: ++ return float(value) ++ ++ default_value = self.__default_threshold[HIGH_THRESHOLD] ++ if default_value != NOT_AVAILABLE: ++ return float(default_value) ++ ++ raise NotImplementedError ++ ++ def set_low_threshold(self, temperature): ++ try: ++ value = float(temperature) ++ except Exception: ++ return False ++ ++ # The new value can not be less than the default value. ++ default_value = self.__default_threshold[LOW_THRESHOLD] ++ if default_value != NOT_AVAILABLE: ++ if value < float(default_value): ++ return False ++ ++ try: ++ self.__conf.set_low_threshold(str(value)) ++ except Exception: ++ return False ++ ++ return True ++ ++ def get_low_threshold(self): ++ value = self.__conf.get_low_threshold() ++ if value != NOT_AVAILABLE: ++ return float(value) ++ ++ default_value = self.__default_threshold[LOW_THRESHOLD] ++ if default_value != NOT_AVAILABLE: ++ return float(default_value) ++ ++ raise NotImplementedError ++ ++ def set_high_critical_threshold(self, temperature): ++ try: ++ value = float(temperature) ++ except Exception: ++ return False ++ ++ # The new value can not be more than the default value. ++ default_value = self.__default_threshold[HIGH_CRIT_THRESHOLD] ++ if default_value != NOT_AVAILABLE: ++ if value > float(default_value): ++ return False ++ ++ try: ++ self.__conf.set_high_critical_threshold(str(value)) ++ except Exception: ++ return False + + return True + ++ def get_high_critical_threshold(self): ++ value = self.__conf.get_high_critical_threshold() ++ if value != NOT_AVAILABLE: ++ return float(value) ++ ++ default_value = self.__default_threshold[HIGH_CRIT_THRESHOLD] ++ if default_value != NOT_AVAILABLE: ++ return float(default_value) ++ ++ raise NotImplementedError ++ ++ def set_low_critical_threshold(self, temperature): ++ try: ++ value = float(temperature) ++ except Exception: ++ return False ++ ++ # The new value can not be less than the default value. ++ default_value = self.__default_threshold[LOW_CRIT_THRESHOLD] ++ if default_value != NOT_AVAILABLE: ++ if value < float(default_value): ++ return False ++ ++ try: ++ self.__conf.set_low_critical_threshold(str(value)) ++ except Exception: ++ return False ++ ++ return True ++ ++ def get_low_critical_threshold(self): ++ value = self.__conf.get_low_critical_threshold() ++ if value != NOT_AVAILABLE: ++ return float(value) ++ ++ default_value = self.__default_threshold[LOW_CRIT_THRESHOLD] ++ if default_value != NOT_AVAILABLE: ++ return float(default_value) ++ ++ raise NotImplementedError ++ + 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] ++ if self.is_psu: ++ return self.PSU_THERMAL_NAME_LIST[self.psu_index] ++ else: ++ return self.THERMAL_NAME_LIST[self.index] + + def get_presence(self): + """ +@@ -121,6 +366,15 @@ class Thermal(ThermalBase): + Returns: + bool: True if Thermal is present, False if not + """ ++ if self.is_cpu: ++ return True ++ ++ if self.is_psu: ++ val = self.__read_txt_file(self.cpld_path + "psu_present") ++ if val is not None: ++ return int(val, 10) == 1 ++ else: ++ return False + temp_file = "temp{}_input".format(self.ss_index) + temp_file_path = os.path.join(self.hwmon_path, temp_file) + raw_txt = self.__read_txt_file(temp_file_path) +@@ -135,11 +389,78 @@ class Thermal(ThermalBase): + Returns: + A boolean value, True if device is operating properly, False if not + """ ++ if self.is_cpu: ++ return True ++ ++ if self.is_psu: ++ temp_file = self.psu_hwmon_path + "psu_temp_fault" ++ psu_temp_fault = self.__read_txt_file(temp_file) ++ if psu_temp_fault is None: ++ psu_temp_fault = '1' ++ return self.get_presence() and (not int(psu_temp_fault)) + + file_str = "temp{}_input".format(self.ss_index) + file_path = os.path.join(self.hwmon_path, file_str) + raw_txt = self.__read_txt_file(file_path) + if raw_txt is None: + return False +- else: ++ else: + return int(raw_txt) != 0 ++ ++ def get_model(self): ++ """ ++ Retrieves the model number (or part number) of the device ++ Returns: ++ string: Model/part number of device ++ """ ++ ++ return "N/A" ++ ++ def get_serial(self): ++ """ ++ Retrieves the serial number of the device ++ Returns: ++ string: Serial number of device ++ """ ++ return "N/A" ++ ++ def get_position_in_parent(self): ++ """ ++ Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position ++ for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned ++ Returns: ++ integer: The 1-based relative physical position in parent device or -1 if cannot determine the position ++ """ ++ return self.index+1 ++ ++ def is_replaceable(self): ++ """ ++ Retrieves whether thermal module is replaceable ++ Returns: ++ A boolean value, True if replaceable, False if not ++ """ ++ return False ++ ++ def get_minimum_recorded(self): ++ """ ++ Retrieves the minimum recorded temperature of thermal ++ Returns: ++ A float number, the minimum recorded temperature of thermal in Celsius ++ up to nearest thousandth of one degree Celsius, e.g. 30.125 ++ """ ++ if self.min_temperature is None: ++ self.get_temperature() ++ ++ return self.min_temperature ++ ++ def get_maximum_recorded(self): ++ """ ++ Retrieves the maximum recorded temperature of thermal ++ Returns: ++ A float number, the maximum recorded temperature of thermal in Celsius ++ up to nearest thousandth of one degree Celsius, e.g. 30.125 ++ """ ++ if self.max_temperature is None: ++ self.get_temperature() ++ ++ return self.max_temperature +diff --git a/device/accton/x86_64-accton_as4630_54te-r0/system_health_monitoring_config.json b/device/accton/x86_64-accton_as4630_54te-r0/system_health_monitoring_config.json +index 91a29558b..97f9aa305 100644 +--- a/device/accton/x86_64-accton_as4630_54te-r0/system_health_monitoring_config.json ++++ b/device/accton/x86_64-accton_as4630_54te-r0/system_health_monitoring_config.json +@@ -1,9 +1,7 @@ + { + "services_to_ignore": [], + "devices_to_ignore": [ +- "asic", +- "psu.temperature" +- ++ "asic" + ], + "user_defined_checkers": [], + "polling_interval": 60, +diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-psu.c b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-psu.c +index 3a99f19a9..5813d8918 100755 +--- a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-psu.c ++++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-psu.c +@@ -91,7 +91,6 @@ static ssize_t show_status(struct device *dev, struct device_attribute *da, + struct as4630_54te_psu_data *data = as4630_54te_psu_update_device(dev); + u8 status = 0; + +- //printk("data->status=0x%x, attr->index=%d,data->index=%d \n", data->status, attr->index, data->index); + if (attr->index == PSU_PRESENT) { + if(data->index==0) + status = !( (data->status >> 5) & 0x1); +@@ -102,7 +101,7 @@ static ssize_t show_status(struct device *dev, struct device_attribute *da, + if(data->index==0) + status = ( (data->status >> 6) & 0x1); + else +- status = ( (data->status >> 2) & 0x1); ++ status = ( (data->status >> 2) & 0x1); + } + + return sprintf(buf, "%d\n", status); +@@ -261,13 +260,14 @@ static struct as4630_54te_psu_data *as4630_54te_psu_update_device(struct device + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int status; ++ u8 serial_offset; + int power_good = 0; + + dev_dbg(&client->dev, "Starting as4630_54te update\n"); + + /* Read psu status */ + status = as4630_54te_cpld_read(0x60, 0x22); +- //printk("status=0x%x in %s\n", status, __FUNCTION__); ++ + if (status < 0) { + dev_dbg(&client->dev, "cpld reg 0x60 err %d\n", status); + } +@@ -278,29 +278,49 @@ static struct as4630_54te_psu_data *as4630_54te_psu_update_device(struct device + /* Read model name */ + memset(data->model_name, 0, sizeof(data->model_name)); + memset(data->serial_number, 0, sizeof(data->serial_number)); +- power_good = (data->status >> (3-data->index) & 0x1); +- ++ if(data->index==0) ++ power_good = ( (data->status >> 6) & 0x1); ++ else ++ power_good = ( (data->status >> 2) & 0x1); ++ + if (power_good) { + status = as4630_54te_psu_read_block(client, 0x20, data->model_name, +- ARRAY_SIZE(data->model_name)-1); ++ ARRAY_SIZE(data->model_name)-1); ++ + if (status < 0) { + data->model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x)\n", client->addr); +- printk("unable to read model name from (0x%x)\n", client->addr); + } + else { ++ data->model_name[8] = '-'; + data->model_name[ARRAY_SIZE(data->model_name)-1] = '\0'; +- + } +- /* Read from offset 0x2e ~ 0x3d (16 bytes) */ +- status = as4630_54te_psu_read_block(client, 0x35,data->serial_number, MAX_SERIAL_NUMBER); ++ if(!strncmp(data->model_name, "YM-1151D", strlen("YM-1151D"))) ++ { ++ if (!strncmp(data->model_name, "YM-1151D-A03R", strlen("YM-1151D-A03R"))) ++ { ++ data->model_name[strlen("YM-1151D-A03R")] = '\0'; ++ serial_offset = 0x2E; /* YM-1151D-A03R, F2B dir */ ++ } ++ else ++ { ++ data->model_name[strlen("YM-1151D-A02R")] = '\0'; ++ serial_offset = 0x35; /* YM-1151D-A02R, B2F dir */ ++ } ++ } ++ else ++ serial_offset = 0x2E; ++ ++ /* Read from offset 0x2e ~ 0x3f (16 bytes) */ ++ status = as4630_54te_psu_read_block(client, serial_offset, data->serial_number, MAX_SERIAL_NUMBER); + if (status < 0) + { + data->serial_number[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x2e)\n", client->addr); +- printk("unable to read model name from (0x%x) offset(0x2e)\n", client->addr); + } ++ + data->serial_number[MAX_SERIAL_NUMBER-1]='\0'; ++ + } + + data->last_updated = jiffies; +diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/service/as4630-54te-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/service/as4630-54te-platform-monitor.service +index 587e6a1ca..b0c5fe6a7 100644 +--- a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/service/as4630-54te-platform-monitor.service ++++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/service/as4630-54te-platform-monitor.service +@@ -1,6 +1,6 @@ + [Unit] + Description=Accton AS4630-54TE Platform Monitoring service +-Before=pmon.service ++Before=pmon.service system-health.service + After=sysinit.target + DefaultDependencies=no + +diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/udev/70-persistent-net.rules b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/udev/70-persistent-net.rules +new file mode 100644 +index 000000000..11ca59a6f +--- /dev/null ++++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/udev/70-persistent-net.rules +@@ -0,0 +1,3 @@ ++ACTION=="add", SUBSYSTEM=="net", DRIVERS=="ixgbe", KERNELS=="0000:08:00.0", NAME:="eth0" ++ACTION=="add", SUBSYSTEM=="net", DRIVERS=="ixgbe", KERNELS=="0000:06:00.1", NAME:="eth1" ++ACTION=="add", SUBSYSTEM=="net", DRIVERS=="ixgbe", KERNELS=="0000:06:00.0", NAME:="eth3" +\ No newline at end of file +diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor.py +index aa5076c2c..005d9d6b1 100755 +--- a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor.py ++++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor.py +@@ -87,6 +87,9 @@ class device_monitor(object): + + def __init__(self, log_file, log_level): + """Needs a logger and a logger level.""" ++ ++ self.thermal = ThermalUtil() ++ self.fan = FanUtil() + # set up logging to file + logging.basicConfig( + filename=log_file, +@@ -138,8 +141,8 @@ class device_monitor(object): + LEVEL_TEMP_CRITICAL: [100, 16, 240000, 300000], + } + temp = [0, 0, 0] +- thermal = ThermalUtil() +- fan = FanUtil() ++ thermal = self.thermal ++ fan = self.fan + ori_duty_cycle = fan.get_fan_duty_cycle() + new_duty_cycle = 0 + +diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/handle_mgmt_interface.sh b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/handle_mgmt_interface.sh +index 82f4d5e02..cdc3c04fc 100755 +--- a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/handle_mgmt_interface.sh ++++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/handle_mgmt_interface.sh +@@ -1,8 +1,7 @@ + #!/bin/bash + +-#Due to the hardware design, as4630-54te use "eth2" instead of "eth0" as management interface. +-#Rename netdev "eth0" and "eth2" to swap original "eth2" to "eth0". +-ifconfig eth0 down +-ip link set eth0 name eth3 +-ip link set eth2 name eth0 +-ifconfig eth0 up ++# Re-install the igb and ixgbe again to make the NIC sequence follow the udev rule ++modprobe -r igb ++modprobe -r ixgbe ++modprobe igb ++modprobe ixgbe +\ No newline at end of file +diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/restart_ixgbe.sh b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/restart_ixgbe.sh +new file mode 100755 +index 000000000..57c14e5ba +--- /dev/null ++++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/restart_ixgbe.sh +@@ -0,0 +1,8 @@ ++#!/bin/bash ++ ++/etc/init.d/netfilter-persistent stop ++modprobe -r ixgbe ++udevadm control --reload-rules ++udevadm trigger ++modprobe ixgbe ++/etc/init.d/netfilter-persistent start +diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/rules b/platform/broadcom/sonic-platform-modules-accton/debian/rules +index c47aa3b3e..cfbfeaed7 100755 +--- a/platform/broadcom/sonic-platform-modules-accton/debian/rules ++++ b/platform/broadcom/sonic-platform-modules-accton/debian/rules +@@ -27,6 +27,7 @@ MODULE_DIR := modules + UTILS_DIR := utils + SERVICE_DIR := service + CONF_DIR := conf ++UDEV_DIR := udev + + %: + dh $@ --with systemd,python3 --buildsystem=pybuild +@@ -70,9 +71,15 @@ binary-indep: + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} usr/local/bin; \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} lib/systemd/system; \ ++ if [ -d $(MOD_SRC_DIR)/$${mod}/$(UDEV_DIR) ]; then \ ++ dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} etc/udev/rules.d; \ ++ fi; \ + cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \ + cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \ ++ if [ -f $(MOD_SRC_DIR)/$${mod}/$(UDEV_DIR)/* ]; then \ ++ cp $(MOD_SRC_DIR)/$${mod}/$(UDEV_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/etc/udev/rules.d/; \ ++ fi; \ + $(PYTHON3) $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \ + done) + # Resuming debhelper scripts diff --git a/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/hwsku.json b/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/hwsku.json index c7f49d1665..29852938ec 100644 --- a/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/hwsku.json +++ b/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/hwsku.json @@ -1,195 +1,291 @@ { "interfaces": { "Ethernet0": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet1": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet2": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet3": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet4": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet5": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet6": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet7": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet8": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet9": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet10": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet11": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet12": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet13": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet14": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet15": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet16": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet17": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet18": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet19": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet20": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet21": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet22": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet23": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet24": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet25": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet26": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet27": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet28": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet29": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet30": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet31": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet32": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet33": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet34": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet35": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet36": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet37": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet38": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet39": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet40": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet41": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet42": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet43": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet44": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet45": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet46": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet47": { - "default_brkout_mode": "1x1G" + "default_brkout_mode": "1x1G", + "port_type": "RJ45", + "autoneg": "on" }, "Ethernet48": { diff --git a/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/hx5-as4630-48x1G+4x25G+2x100G.bcm b/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/hx5-as4630-48x1G+4x25G+2x100G.bcm index 1a02415067..75e5ad6909 100644 --- a/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/hx5-as4630-48x1G+4x25G+2x100G.bcm +++ b/device/accton/x86_64-accton_as4630_54te-r0/Accton-AS4630-54TE/hx5-as4630-48x1G+4x25G+2x100G.bcm @@ -1,4 +1,4 @@ -stable_size=76303168 +stable_size=0x5500000 #polarity/lanemap is using TH2 style. core_clock_frequency=893 diff --git a/device/accton/x86_64-accton_as4630_54te-r0/custom_led.bin b/device/accton/x86_64-accton_as4630_54te-r0/custom_led.bin new file mode 100644 index 0000000000..11f7790348 Binary files /dev/null and b/device/accton/x86_64-accton_as4630_54te-r0/custom_led.bin differ diff --git a/device/accton/x86_64-accton_as4630_54te-r0/led_proc_init.soc b/device/accton/x86_64-accton_as4630_54te-r0/led_proc_init.soc new file mode 100644 index 0000000000..5bef973ed2 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/led_proc_init.soc @@ -0,0 +1,3 @@ +m0 load 0 0x3800 /usr/share/sonic/platform/custom_led.bin +led start +led auto on diff --git a/device/accton/x86_64-accton_as4630_54te-r0/pcie.yaml b/device/accton/x86_64-accton_as4630_54te-r0/pcie.yaml new file mode 100644 index 0000000000..c7e99c8678 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/pcie.yaml @@ -0,0 +1,167 @@ +- bus: '00' + dev: '00' + fn: '0' + id: '1980' + name: 'Host bridge: Intel Corporation Atom Processor C3000 Series System Agent (rev + 11)' +- bus: '00' + dev: '04' + fn: '0' + id: 19a1 + name: 'Host bridge: Intel Corporation Atom Processor C3000 Series Error Registers + (rev 11)' +- bus: '00' + dev: '05' + fn: '0' + id: 19a2 + name: 'Generic system peripheral [0807]: Intel Corporation Atom Processor C3000 + Series Root Complex Event Collector (rev 11)' +- bus: '00' + dev: '06' + fn: '0' + id: 19a3 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series Integrated QAT + Root Port (rev 11)' +- bus: '00' + dev: 09 + fn: '0' + id: 19a4 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root + Port #0 (rev 11)' +- bus: '00' + dev: 0b + fn: '0' + id: 19a6 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root + Port #2 (rev 11)' +- bus: '00' + dev: 0e + fn: '0' + id: 19a8 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root + Port #4 (rev 11)' +- bus: '00' + dev: '10' + fn: '0' + id: 19aa + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root + Port #6 (rev 11)' +- bus: '00' + dev: '12' + fn: '0' + id: 19ac + name: 'System peripheral: Intel Corporation Atom Processor C3000 Series SMBus Contoller + - Host (rev 11)' +- bus: '00' + dev: '13' + fn: '0' + id: 19b2 + name: 'SATA controller: Intel Corporation Atom Processor C3000 Series SATA Controller + 0 (rev 11)' +- bus: '00' + dev: '15' + fn: '0' + id: 19d0 + name: 'USB controller: Intel Corporation Atom Processor C3000 Series USB 3.0 xHCI + Controller (rev 11)' +- bus: '00' + dev: '16' + fn: '0' + id: 19d1 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series Integrated LAN + Root Port #0 (rev 11)' +- bus: '00' + dev: '17' + fn: '0' + id: 19d2 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series Integrated LAN + Root Port #1 (rev 11)' +- bus: '00' + dev: '18' + fn: '0' + id: 19d3 + name: 'Communication controller: Intel Corporation Atom Processor C3000 Series ME + HECI 1 (rev 11)' +- bus: '00' + dev: 1a + fn: '0' + id: 19d8 + name: 'Serial controller: Intel Corporation Atom Processor C3000 Series HSUART Controller + (rev 11)' +- bus: '00' + dev: 1a + fn: '1' + id: 19d8 + name: 'Serial controller: Intel Corporation Atom Processor C3000 Series HSUART Controller + (rev 11)' +- bus: '00' + dev: 1a + fn: '2' + id: 19d8 + name: 'Serial controller: Intel Corporation Atom Processor C3000 Series HSUART Controller + (rev 11)' +- bus: '00' + dev: 1c + fn: '0' + id: 19db + name: 'SD Host controller: Intel Corporation Device 19db (rev 11)' +- bus: '00' + dev: 1f + fn: '0' + id: 19dc + name: 'ISA bridge: Intel Corporation Atom Processor C3000 Series LPC or eSPI (rev + 11)' +- bus: '00' + dev: 1f + fn: '1' + id: 19dd + name: 'Memory controller: Intel Corporation Atom Processor C3000 Series Primary + to Side Band (P2SB) Bridge (rev 11)' +- bus: '00' + dev: 1f + fn: '2' + id: 19de + name: 'Memory controller: Intel Corporation Atom Processor C3000 Series Power Management + Controller (rev 11)' +- bus: '00' + dev: 1f + fn: '4' + id: 19df + name: 'SMBus: Intel Corporation Atom Processor C3000 Series SMBus controller (rev + 11)' +- bus: '00' + dev: 1f + fn: '5' + id: 19e0 + name: 'Serial bus controller [0c80]: Intel Corporation Atom Processor C3000 Series + SPI Controller (rev 11)' +- bus: '01' + dev: '00' + fn: '0' + id: 19e2 + name: 'Co-processor: Intel Corporation Atom Processor C3000 Series QuickAssist Technology + (rev 11)' +- bus: '05' + dev: '00' + fn: '0' + id: b371 + name: 'Ethernet controller: Broadcom Inc. and subsidiaries BCM56371 Switch ASIC + (rev 03)' +- bus: '06' + dev: '00' + fn: '0' + id: 15c2 + name: 'Ethernet controller: Intel Corporation Ethernet Connection X553 Backplane + (rev 11)' +- bus: '06' + dev: '00' + fn: '1' + id: 15c2 + name: 'Ethernet controller: Intel Corporation Ethernet Connection X553 Backplane + (rev 11)' +- bus: 08 + dev: '00' + fn: '0' + id: 15e5 + name: 'Ethernet controller: Intel Corporation Ethernet Connection X553 1GbE (rev + 11)' diff --git a/device/accton/x86_64-accton_as4630_54te-r0/platform.json b/device/accton/x86_64-accton_as4630_54te-r0/platform.json index 5f8798239d..7174cf59a1 100644 --- a/device/accton/x86_64-accton_as4630_54te-r0/platform.json +++ b/device/accton/x86_64-accton_as4630_54te-r0/platform.json @@ -1,6 +1,11 @@ { "chassis": { - "name": "4630-54PE", + "name": "AS4630-54TE", + "thermal_manager":false, + "status_led": { + "controllable": true, + "colors": ["STATUS_LED_COLOR_GREEN", "STATUS_LED_COLOR_GREEN_BLINK", "STATUS_LED_COLOR_AMBER", "STATUS_LED_COLOR_OFF"] + }, "components": [ { "name": "CPLD1" @@ -14,40 +19,91 @@ ], "fans": [ { - "name": "FAN-1" - }, - { - "name": "FAN-2" - }, - { - "name": "FAN-3" + "name": "FAN-1", + "speed": { + "controllable": true, + "minimum": 7 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-2", + "speed": { + "controllable": true, + "minimum": 7 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-3", + "speed": { + "controllable": true, + "minimum": 7 + }, + "status_led": { + "controllable": false + } } ], "fan_drawers":[ { "name": "FanTray1", + "status_led": { + "controllable": false + }, "num_fans" : 1, "fans": [ { - "name": "FAN-1" + "name": "FAN-1", + "speed": { + "controllable": true, + "minimum": 7 + }, + "status_led": { + "controllable": false + } } ] }, { "name": "FanTray2", + "status_led": { + "controllable": false + }, "num_fans" : 1, "fans": [ { - "name": "FAN-2" + "name": "FAN-2", + "speed": { + "controllable": true, + "minimum": 7 + }, + "status_led": { + "controllable": false + } } ] }, { "name": "FanTray3", + "status_led": { + "controllable": false + }, "num_fans" : 1, "fans": [ { - "name": "FAN-3" + "name": "FAN-3", + "speed": { + "controllable": true, + "minimum": 7 + }, + "status_led": { + "controllable": false + } } ] } @@ -55,6 +111,10 @@ "psus": [ { "name": "PSU-1", + "status_led": { + "controllable": true, + "colors": ["STATUS_LED_COLOR_GREEN", "STATUS_LED_COLOR_AMBER", "STATUS_LED_COLOR_OFF"] + }, "fans": [ { "name": "PSU-1 FAN-1" @@ -62,12 +122,19 @@ ], "thermals": [ { - "name": "PSU-1 temp sensor 1" + "name": "PSU-1 temp sensor 1", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false } ] }, { "name": "PSU-2", + "status_led": { + "controllable": true, + "colors": ["STATUS_LED_COLOR_GREEN", "STATUS_LED_COLOR_AMBER", "STATUS_LED_COLOR_OFF"] + }, "fans": [ { "name": "PSU-2 FAN-1" @@ -75,20 +142,46 @@ ], "thermals": [ { - "name": "PSU-2 temp sensor 1" + "name": "PSU-2 temp sensor 1", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false } ] } ], "thermals": [ { - "name": "Temp sensor 1" + "name": "Temp sensor 1", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false + }, + { + "name": "Temp sensor 2", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false }, { - "name": "Temp sensor 2" + "name": "Temp sensor 3", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false }, { - "name": "Temp sensor 3" + "name": "Temp sensor 4", + "controllable": false, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": true } ], "sfps": [ @@ -692,4 +785,4 @@ } } } -} +} \ No newline at end of file diff --git a/device/accton/x86_64-accton_as4630_54te-r0/platform_components.json b/device/accton/x86_64-accton_as4630_54te-r0/platform_components.json new file mode 100644 index 0000000000..5e70a87a41 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/platform_components.json @@ -0,0 +1,11 @@ +{ + "chassis": { + "AS4630-54TE-O-AC-F": { + "component": { + "CPLD1": { }, + "CPLD2": { }, + "BIOS": { } + } + } + } +} diff --git a/device/accton/x86_64-accton_as4630_54te-r0/pmon_daemon_control.json b/device/accton/x86_64-accton_as4630_54te-r0/pmon_daemon_control.json index a3b204e20d..44bad64942 100644 --- a/device/accton/x86_64-accton_as4630_54te-r0/pmon_daemon_control.json +++ b/device/accton/x86_64-accton_as4630_54te-r0/pmon_daemon_control.json @@ -1,5 +1,4 @@ { - "skip_ledd": true, - "skip_pcied": true + "skip_ledd": true } diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/chassis.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/chassis.py index 9f39c903c6..f7b71dac41 100644 --- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/chassis.py +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/chassis.py @@ -6,27 +6,26 @@ # ############################################################################# -import subprocess - try: + import sys from sonic_platform_base.chassis_base import ChassisBase from .helper import APIHelper + from .event import SfpEvent except ImportError as e: raise ImportError(str(e) + "- required module not found") NUM_FAN_TRAY = 3 NUM_FAN = 2 NUM_PSU = 2 -NUM_THERMAL = 3 +NUM_THERMAL = 4 NUM_QSFP = 6 PORT_START = 49 PORT_END = 54 -NUM_COMPONENT = 2 +NUM_COMPONENT = 3 HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/" PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" REBOOT_CAUSE_FILE = "reboot-cause.txt" PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" -HOST_CHK_CMD = ["docker"] SYSLED_FNODE = "/sys/class/leds/diag/brightness" SYSLED_MODES = { "0" : "STATUS_LED_COLOR_OFF", @@ -42,7 +41,6 @@ class Chassis(ChassisBase): def __init__(self): ChassisBase.__init__(self) self._api_helper = APIHelper() - self._api_helper = APIHelper() self.is_host = self._api_helper.is_host() self.config_data = {} @@ -59,6 +57,7 @@ def __initialize_sfp(self): for index in range(0, PORT_END): sfp = Sfp(index) self._sfp_list.append(sfp) + self._sfpevent = SfpEvent(self._sfp_list) self.sfp_module_initialized = True def __initialize_fan(self): @@ -89,22 +88,6 @@ def __initialize_components(self): component = Component(index) self._component_list.append(component) - def __initialize_watchdog(self): - from sonic_platform.watchdog import Watchdog - self._watchdog = Watchdog() - - - def __is_host(self): - return subprocess.call(HOST_CHK_CMD) == 0 - - 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 None def get_name(self): """ @@ -113,7 +96,7 @@ def get_name(self): string: The name of the device """ - return self._api_helper.hwsku + return self._eeprom.get_modelstr() def get_presence(self): """ @@ -176,6 +159,12 @@ def get_reboot_cause(self): return ('REBOOT_CAUSE_NON_HARDWARE', sw_reboot_cause) + def get_change_event(self, timeout=0): + # SFP event + if not self.sfp_module_initialized: + self.__initialize_sfp() + return self._sfpevent.get_sfp_event(timeout) + def get_sfp(self, index): """ Retrieves sfp represented by (1-based) index @@ -234,3 +223,28 @@ def set_status_led(self, color): return False else: return self._api_helper.write_txt_file(SYSLED_FNODE, mode) + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self._eeprom.get_pn() + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return self._eeprom.get_serial() + + def get_revision(self): + """ + Retrieves the hardware revision of the device + + Returns: + string: Revision value of device + """ + return self._eeprom.get_revisionstr() diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/component.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/component.py index 8137d0f3a7..f5dafd0073 100644 --- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/component.py +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/component.py @@ -6,10 +6,12 @@ # ############################################################################# - try: + import os + import json from sonic_platform_base.component_base import ComponentBase from .helper import APIHelper + from sonic_py_common.general import getstatusoutput_noshell except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -20,6 +22,7 @@ BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version" COMPONENT_LIST= [ ("CPLD1", "CPLD 1"), + ("CPLD2", "CPLD CPU"), ("BIOS", "Basic Input/Output System") ] @@ -58,6 +61,15 @@ def __get_cpld_version(self): return cpld_version + def __get_cpldcpu_version(self): + cpld_version = dict() + cmd = ["i2cget", "-y", "1", "0x65", "0x01"] + status, output1 = getstatusoutput_noshell(cmd) + cmd = ["i2cget", "-y", "1", "0x65", "0x02"] + status, output2 = getstatusoutput_noshell(cmd) + cpld_version[self.name] = "{}{}{}".format(int(output1,16),".",int(output2,16)) + return cpld_version + def get_name(self): """ Retrieves the name of the component @@ -85,9 +97,12 @@ def get_firmware_version(self): if self.name == "BIOS": fw_version = self.__get_bios_version() - elif "CPLD" in self.name: + elif self.name == "CPLD1": cpld_version = self.__get_cpld_version() fw_version = cpld_version.get(self.name) + elif self.name == "CPLD2": + cpld_version = self.__get_cpldcpu_version() + fw_version = cpld_version.get(self.name) return fw_version @@ -99,4 +114,85 @@ def install_firmware(self, image_path): Returns: A boolean, True if install successfully, False if not """ - raise NotImplementedError + ret, output = getstatusoutput_noshell(["tar", "-C", "/tmp", "-xzf", image_path ] ) + if ret != 0 : + print("Installation failed because of wrong image package") + return False + + if False == os.path.exists("/tmp/install.json") : + print("Installation failed without jsonfile") + return False + + input_file = open ('/tmp/install.json') + json_array = json.load(input_file) + ret = 1 + for item in json_array: + if item.get('id')==None or item.get('path')==None: + continue + if self.name == item['id'] and item['path'] and item.get('cpu'): + print( "Find", item['id'], item['path'], item['cpu'] ) + ret, output = getstatusoutput_noshell(["/tmp/run_install.sh", item['id'], item['path'], item['cpu'] ]) + if ret==0: + break + elif self.name == item['id'] and item['path']: + print( "Find", item['id'], item['path'] ) + ret, output = getstatusoutput_noshell(["/tmp/run_install.sh", item['id'], item['path'] ]) + if ret==0: + break + + if ret==0: + return True + else : + return False + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return 'N/A' + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return 'N/A' + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return True + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/eeprom.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/eeprom.py index 7bf2bb58d1..f3bc202ebd 100644 --- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/eeprom.py +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/eeprom.py @@ -13,7 +13,7 @@ CACHE_ROOT = '/var/cache/sonic/decode-syseeprom' CACHE_FILE = 'syseeprom_cache' - +NULL = 'N/A' class Tlv(eeprom_tlvinfo.TlvInfoDecoder): @@ -33,7 +33,7 @@ def __parse_output(self, decode_output): for line in lines: try: match = re.search( - '(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)([\S]+)', line) + '(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)(.+)', line) if match is not None: idx = match.group(1) value = match.group(3).rstrip('\0') @@ -92,11 +92,46 @@ def _load_eeprom(self): return self.__parse_output(decode_output) + def _valid_tlv(self, eeprom_data): + tlvinfo_type_codes_list = [ + self._TLV_CODE_PRODUCT_NAME, + self._TLV_CODE_PART_NUMBER, + self._TLV_CODE_SERIAL_NUMBER, + self._TLV_CODE_MAC_BASE, + self._TLV_CODE_MANUF_DATE, + self._TLV_CODE_DEVICE_VERSION, + self._TLV_CODE_LABEL_REVISION, + self._TLV_CODE_PLATFORM_NAME, + self._TLV_CODE_ONIE_VERSION, + self._TLV_CODE_MAC_SIZE, + self._TLV_CODE_MANUF_NAME, + self._TLV_CODE_MANUF_COUNTRY, + self._TLV_CODE_VENDOR_NAME, + self._TLV_CODE_DIAG_VERSION, + self._TLV_CODE_SERVICE_TAG, + self._TLV_CODE_VENDOR_EXT, + self._TLV_CODE_CRC_32 + ] + + for code in tlvinfo_type_codes_list: + code_str = "0x{:X}".format(code) + eeprom_data[code_str] = eeprom_data.get(code_str, NULL) + return eeprom_data + def get_eeprom(self): - return self._eeprom + return self._valid_tlv(self._eeprom) + + def get_pn(self): + return self._eeprom.get('0x22', NULL) def get_serial(self): - return self._eeprom.get('0x23', "Undefined.") + return self._eeprom.get('0x23', NULL) def get_mac(self): - return self._eeprom.get('0x24', "Undefined.") + return self._eeprom.get('0x24', NULL) + + def get_modelstr(self): + return self._eeprom.get('0x21', NULL) + + def get_revisionstr(self): + return self._eeprom.get('0x27', NULL) \ No newline at end of file diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/event.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/event.py new file mode 100644 index 0000000000..ade466b2e3 --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/event.py @@ -0,0 +1,109 @@ +try: + import time + from sonic_py_common.logger import Logger + from .sfp import Sfp +except ImportError as e: + raise ImportError(repr(e) + " - required module not found") + +POLL_INTERVAL_IN_SEC = 1 + +# SFP errors that will block eeprom accessing +SFP_BLOCKING_ERRORS = [ + Sfp.SFP_ERROR_BIT_I2C_STUCK, + Sfp.SFP_ERROR_BIT_BAD_EEPROM, + Sfp.SFP_ERROR_BIT_UNSUPPORTED_CABLE, + Sfp.SFP_ERROR_BIT_HIGH_TEMP, + Sfp.SFP_ERROR_BIT_BAD_CABLE +] + +class SfpEvent: + ''' Listen to insert/remove sfp events ''' + + def __init__(self, sfp_list): + self._sfp_list = sfp_list + self._logger = Logger() + self._sfp_change_event_data = {'present': 0} + + def get_presence_bitmap(self): + bitmap = 0 + for sfp in self._sfp_list: + modpres = sfp.get_presence() + i=sfp.get_position_in_parent() - 1 + if modpres: + bitmap = bitmap | (1 << i) + return bitmap + + def get_sfp_event(self, timeout=2000): + port_dict = {} + change_dict = {} + change_dict['sfp'] = port_dict + + if timeout < 1000: + cd_ms = 1000 + else: + cd_ms = timeout + + while cd_ms > 0: + bitmap = self.get_presence_bitmap() + changed_ports = self._sfp_change_event_data['present'] ^ bitmap + if changed_ports != 0: + break + time.sleep(POLL_INTERVAL_IN_SEC) + # timeout=0 means wait for event forever + if timeout != 0: + cd_ms = cd_ms - POLL_INTERVAL_IN_SEC * 1000 + + if changed_ports != 0: + for sfp in self._sfp_list: + i=sfp.get_position_in_parent() - 1 + if (changed_ports & (1 << i)) == 0: + continue + + if (bitmap & (1 << i)) == 0: + port_dict[i+1] = '0' + else: + # sfp.refresh_optoe_dev_class() + sfp_state_bits = self.get_sfp_state_bits(sfp, True) + sfp_state_bits = self.check_sfp_blocking_errors(sfp_state_bits) + + port_dict[i+1] = str(sfp_state_bits) + + # Update the cache dict + self._sfp_change_event_data['present'] = bitmap + return True, change_dict + else: + return True, change_dict + + def get_sfp_state_bits(self, sfp, present): + sfp_state_bits = 0 + + if present is True: + sfp_state_bits |= Sfp.SFP_STATUS_BIT_INSERTED + else: + return sfp_state_bits + + status = sfp.validate_eeprom() + if status is None: + sfp_state_bits |= Sfp.SFP_ERROR_BIT_I2C_STUCK + return sfp_state_bits + elif status is not True: + sfp_state_bits |= Sfp.SFP_ERROR_BIT_BAD_EEPROM + return sfp_state_bits + + status = sfp.validate_temperature() + if status is None: + sfp_state_bits |= Sfp.SFP_ERROR_BIT_I2C_STUCK + return sfp_state_bits + elif status is not True: + sfp_state_bits |= Sfp.SFP_ERROR_BIT_HIGH_TEMP + return sfp_state_bits + + return sfp_state_bits + + def check_sfp_blocking_errors(self, sfp_state_bits): + for i in SFP_BLOCKING_ERRORS: + if (i & sfp_state_bits) == 0: + continue + sfp_state_bits |= Sfp.SFP_ERROR_BIT_BLOCKING + + return sfp_state_bits \ No newline at end of file diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/fan.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/fan.py index 8f48931244..e145503551 100644 --- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/fan.py +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/fan.py @@ -38,10 +38,6 @@ }, } - -FAN_NAME_LIST = ["FAN-1F", "FAN-1R", "FAN-2F", "FAN-2R", - "FAN-3F", "FAN-3R"] - class Fan(FanBase): """Platform-specific Fan class""" @@ -63,7 +59,7 @@ def __init__(self, fan_tray_index, fan_index=0, is_psu_fan=False, psu_index=0): self.psu_cpld_path = I2C_PATH.format( self.psu_i2c_num, self.psu_i2c_addr) - FanBase.__init__(self) + FanBase.__init__(self) def get_direction(self): @@ -73,16 +69,14 @@ def get_direction(self): A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST depending on fan direction """ - - if not self.is_psu_fan: dir_str = "{}{}{}".format(CPLD_FAN_I2C_PATH, 'direction_', self.fan_tray_index+1) val=self._api_helper.read_txt_file(dir_str) if val is not None: if int(val, 10)==0:#F2B - direction=self.FAN_DIRECTION_EXHAUST - else: direction=self.FAN_DIRECTION_INTAKE + else: + direction=self.FAN_DIRECTION_EXHAUST else: direction=self.FAN_DIRECTION_EXHAUST @@ -105,7 +99,7 @@ def get_speed(self): Returns: An integer, the percentage of full fan speed, in the range 0 (off) to 100 (full speed) - + """ speed = 0 if self.is_psu_fan: @@ -117,7 +111,7 @@ def get_speed(self): speed=100 else: return 0 - elif self.get_presence(): + elif self.get_presence(): speed_path = "{}{}".format(CPLD_FAN_I2C_PATH, 'duty_cycle_percentage') speed=self._api_helper.read_txt_file(speed_path) if speed is None: @@ -156,7 +150,7 @@ def set_speed(self, speed): A boolean, True if speed is set successfully, False if not """ - if not self.is_psu_fan and self.get_presence(): + if not self.is_psu_fan and self.get_presence(): speed_path = "{}{}".format(CPLD_FAN_I2C_PATH, 'duty_cycle_percentage') return self._api_helper.write_txt_file(speed_path, int(speed)) @@ -179,14 +173,13 @@ def get_status_led(self): Returns: A string, one of the predefined STATUS_LED_COLOR_* strings above """ - status=self.get_presence() - if status is None: - return self.STATUS_LED_COLOR_OFF + if self.is_psu_fan: + return None return { - 1: self.STATUS_LED_COLOR_GREEN, - 0: self.STATUS_LED_COLOR_RED - }.get(status, self.STATUS_LED_COLOR_OFF) + True: self.STATUS_LED_COLOR_GREEN, + False: self.STATUS_LED_COLOR_OFF + }.get(self.get_status(), self.STATUS_LED_COLOR_OFF) def get_name(self): """ @@ -194,11 +187,10 @@ def get_name(self): Returns: string: The name of the device """ - fan_name = FAN_NAME_LIST[self.fan_tray_index*2 + self.fan_index] \ - if not self.is_psu_fan \ - else "PSU-{} FAN-{}".format(self.psu_index+1, self.fan_index+1) + if self.is_psu_fan: + return "PSU-{} FAN-{}".format(self.psu_index+1, self.fan_index+1) - return fan_name + return "FAN-{}".format(self.fan_tray_index+1) def get_presence(self): """ @@ -206,8 +198,6 @@ def get_presence(self): Returns: bool: True if FAN is present, False if not """ - - if self.is_psu_fan: present_path="{}{}".format(self.psu_cpld_path, 'psu_present') else: @@ -226,6 +216,11 @@ def get_status(self): A boolean value, True if device is operating properly, False if not """ if self.is_psu_fan: + psu_fan_path = "{}{}".format(self.psu_cpld_path, 'psu_power_good') + val = self._api_helper.read_txt_file(psu_fan_path) + if val is None or int(val, 10)==0: + return False + psu_fan_path= "{}{}".format(self.psu_hwmon_path, 'psu_fan1_fault') val=self._api_helper.read_txt_file(psu_fan_path) if val is not None: @@ -268,7 +263,7 @@ def get_position_in_parent(self): integer: The 1-based relative physical position in parent device or -1 if cannot determine the position """ - return (self.fan_tray_index+1) \ + return (self.fan_index+1) \ if not self.is_psu_fan else (self.psu_index+1) def is_replaceable(self): diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/fan_drawer.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/fan_drawer.py index e21163c106..b4c2146b9f 100644 --- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/fan_drawer.py +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/fan_drawer.py @@ -10,7 +10,7 @@ except ImportError as e: raise ImportError(str(e) + "- required module not found") -FANS_PER_FANTRAY = 2 +FANS_PER_FANTRAY = 1 class FanDrawer(FanDrawerBase): @@ -88,3 +88,25 @@ def is_replaceable(self): bool: True if it is replaceable. """ return True + + 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: True if status LED state is set successfully, False if not + """ + return False # Not supported + + def get_status_led(self): + """ + Gets the state of the fan status LED + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + return { + True: self.STATUS_LED_COLOR_GREEN, + False: self.STATUS_LED_COLOR_OFF + }.get(self.get_status(), self.STATUS_LED_COLOR_OFF) diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/helper.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/helper.py index fdbd0f46a0..f6adee3098 100644 --- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/helper.py +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/helper.py @@ -1,7 +1,13 @@ import os import struct +import json +import fcntl from mmap import * from sonic_py_common import device_info +from sonic_py_common import logger +from threading import Lock +from typing import cast +from sonic_py_common.general import getstatusoutput_noshell_pipe from sonic_py_common.general import getstatusoutput_noshell HOST_CHK_CMD = ["docker"] @@ -33,11 +39,20 @@ def pci_get_value(self, resource, offset): status = False return status, result + def run_interactive_command(self, cmd): + try: + os.system(cmd) + except Exception: + return False + return True + def read_txt_file(self, file_path): try: with open(file_path, 'r', errors='replace') as fd: data = fd.read() - return data.strip() + ret = data.strip() + if len(ret) > 0: + return ret except IOError: pass return None @@ -50,3 +65,304 @@ def write_txt_file(self, file_path, value): return False return True + def ipmi_raw(self, netfn, cmd): + status = True + result = "" + try: + err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'raw', str(netfn), str(cmd)]) + if err == [0]: + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result + + def ipmi_fru_id(self, id, key=None): + status = True + result = "" + try: + if (key is None): + err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'fru', 'print', str(id)]) + else: + err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'fru', 'print', str(id)], ['grep', str(key)]) + if err == [0] or err == [0, 0]: + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result + + def ipmi_set_ss_thres(self, id, threshold_key, value): + status = True + result = "" + try: + err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'sensor', 'thresh', str(id), str(threshold_key), str(value)]) + if err == [0]: + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result + + +class FileLock: + """ + Due to pmon docker not installing the py-filelock, this class + implements a simple file lock feature. + Ref: https://github.com/tox-dev/py-filelock/blob/main/src/filelock/ + """ + + def __init__(self, lock_file): + self._lock_file = lock_file + self._thread_lock = Lock() + self.is_locked = False + + def acquire(self): + with self._thread_lock: + if self.is_locked: + return + + fd = os.open(self._lock_file, flags=(os.O_RDWR | os.O_CREAT | os.O_TRUNC)) + fcntl.flock(fd, fcntl.LOCK_EX) + self._lock_file_fd = fd + self.is_locked = True + + def release(self): + with self._thread_lock: + if self.is_locked: + fd = cast(int, self._lock_file_fd) + self._lock_file_fd = None + fcntl.flock(fd, fcntl.LOCK_UN) + os.close(fd) + self.is_locked = False + + def __enter__(self): + self.acquire() + return self + + def __exit__(self, exc_type, exc_val, traceback): + self.release() + + def __del__(self): + self.release() + + +DEVICE_THRESHOLD_JSON_PATH = "/tmp/device_threshold.json" + +class DeviceThreshold: + HIGH_THRESHOLD = 'high_threshold' + LOW_THRESHOLD = 'low_threshold' + HIGH_CRIT_THRESHOLD = 'high_critical_threshold' + LOW_CRIT_THRESHOLD = 'low_critical_threshold' + NOT_AVAILABLE = 'N/A' + + def __init__(self, th_name = NOT_AVAILABLE): + self.flock = FileLock("{}.lock".format(DEVICE_THRESHOLD_JSON_PATH)) + self.name = th_name + self.__log = logger.Logger(log_identifier="DeviceThreshold") + + self.__db_data = {} + self.__db_mtime = 0 + + def __reload_db(self): + try: + db_data = {} + with self.flock: + with open(DEVICE_THRESHOLD_JSON_PATH, "r") as db_file: + db_data = json.load(db_file) + except Exception as e: + self.__log.log_warning('{}'.format(str(e))) + return None + + return db_data + + def __get_data(self, field): + """ + Retrieves data frome JSON file by field + + Args : + field: String + + Returns: + A string if getting is successfully, 'N/A' if not + """ + if os.path.exists(DEVICE_THRESHOLD_JSON_PATH): + new_mtime = os.path.getmtime(DEVICE_THRESHOLD_JSON_PATH) + if new_mtime != self.__db_mtime: + new_data = self.__reload_db() + if new_data is not None: + self.__db_data = new_data + self.__db_mtime = new_mtime + + if self.name not in self.__db_data.keys(): + return self.NOT_AVAILABLE + + if field not in self.__db_data[self.name].keys(): + return self.NOT_AVAILABLE + + return self.__db_data[self.name][field] + + def __set_data(self, field, new_val): + """ + Set data to JSON file by field + + Args : + field: String + new_val: String + + Returns: + A boolean, True if setting is set successfully, False if not + """ + if self.name not in self.__db_data.keys(): + self.__db_data[self.name] = {} + + old_val = self.__db_data[self.name].get(field, None) + if old_val is not None and old_val == new_val: + return True + + self.__db_data[self.name][field] = new_val + + try: + with self.flock: + db_data = {} + mode = "r+" if os.path.exists(DEVICE_THRESHOLD_JSON_PATH) else "w+" + with open(DEVICE_THRESHOLD_JSON_PATH, mode) as db_file: + if mode == "r+": + db_data = json.load(db_file) + + if self.name not in db_data.keys(): + db_data[self.name] = {} + + db_data[self.name][field] = new_val + + if mode == "r+": + db_file.seek(0) + # erase old data + db_file.truncate(0) + # write all data + json.dump(db_data, db_file, indent=4) + self.__db_mtime = os.path.getmtime(DEVICE_THRESHOLD_JSON_PATH) + except Exception as e: + self.__log.log_error('{}'.format(str(e))) + return False + + return True + + def get_high_threshold(self): + """ + Retrieves the high threshold temperature from JSON file. + + Returns: + string : the high threshold temperature of thermal, + e.g. "30.125" + """ + return self.__get_data(self.HIGH_THRESHOLD) + + def set_high_threshold(self, temperature): + """ + Sets the high threshold temperature of thermal + Args : + temperature: A string of temperature, e.g. "30.125" + Returns: + A boolean, True if threshold is set successfully, False if not + """ + if isinstance(temperature, str) is not True: + raise TypeError('The parameter requires string type.') + + try: + if temperature != self.NOT_AVAILABLE: + float(temperature) + except ValueError: + raise ValueError('The parameter requires a float string. ex:\"30.1\"') + + return self.__set_data(self.HIGH_THRESHOLD, temperature) + + def get_low_threshold(self): + """ + Retrieves the low threshold temperature from JSON file. + + Returns: + string : the low threshold temperature of thermal, + e.g. "30.125" + """ + return self.__get_data(self.LOW_THRESHOLD) + + def set_low_threshold(self, temperature): + """ + Sets the low threshold temperature of thermal + Args : + temperature: A string of temperature, e.g. "30.125" + Returns: + A boolean, True if threshold is set successfully, False if not + """ + if isinstance(temperature, str) is not True: + raise TypeError('The parameter requires string type.') + + try: + if temperature != self.NOT_AVAILABLE: + float(temperature) + except ValueError: + raise ValueError('The parameter requires a float string. ex:\"30.1\"') + + return self.__set_data(self.LOW_THRESHOLD, temperature) + + def get_high_critical_threshold(self): + """ + Retrieves the high critical threshold temperature from JSON file. + + Returns: + string : the high critical threshold temperature of thermal, + e.g. "30.125" + """ + return self.__get_data(self.HIGH_CRIT_THRESHOLD) + + def set_high_critical_threshold(self, temperature): + """ + Sets the high critical threshold temperature of thermal + Args : + temperature: A string of temperature, e.g. "30.125" + Returns: + A boolean, True if threshold is set successfully, False if not + """ + if isinstance(temperature, str) is not True: + raise TypeError('The parameter requires string type.') + + try: + if temperature != self.NOT_AVAILABLE: + float(temperature) + except ValueError: + raise ValueError('The parameter requires a float string. ex:\"30.1\"') + + return self.__set_data(self.HIGH_CRIT_THRESHOLD, temperature) + + def get_low_critical_threshold(self): + """ + Retrieves the low critical threshold temperature from JSON file. + + Returns: + string : the low critical threshold temperature of thermal, + e.g. "30.125" + """ + return self.__get_data(self.LOW_CRIT_THRESHOLD) + + def set_low_critical_threshold(self, temperature): + """ + Sets the low critical threshold temperature of thermal + Args : + temperature: A string of temperature, e.g. "30.125" + Returns: + A boolean, True if threshold is set successfully, False if not + """ + if isinstance(temperature, str) is not True: + raise TypeError('The parameter requires string type.') + + try: + if temperature != self.NOT_AVAILABLE: + float(temperature) + except ValueError: + raise ValueError('The parameter requires a float string. ex:\"30.1\"') + + return self.__set_data(self.LOW_CRIT_THRESHOLD, temperature) diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/pcie.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/pcie.py new file mode 100644 index 0000000000..73d3627dbf --- /dev/null +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/pcie.py @@ -0,0 +1,19 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the fan status which are available in the platform +# Base PCIe class +############################################################################# + +try: + from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Pcie(PcieUtil): + """Edgecore Platform-specific PCIe class""" + + def __init__(self, platform_path): + PcieUtil.__init__(self, platform_path) \ No newline at end of file diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/psu.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/psu.py index 8eab43891b..0c16de92dc 100644 --- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/psu.py +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/psu.py @@ -10,7 +10,7 @@ try: from sonic_platform_base.psu_base import PsuBase - #from sonic_platform.fan import Fan + from sonic_platform.thermal import Thermal from .helper import APIHelper except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -58,19 +58,13 @@ def __init__(self, psu_index=0): self.i2c_addr = PSU_CPLD_I2C_MAPPING[self.index]["addr"] self.cpld_path = I2C_PATH.format(self.i2c_num, self.i2c_addr) self.__initialize_fan() - ''' - for fan_index in range(0, PSU_NUM_FAN[self.index]): - #def __init__(self, fan_tray_index, fan_index=0, is_psu_fan=False, psu_index=0): - #fan = Fan(fan_index, 0, is_psu_fan=True, psu_index=self.index) - fan = Fan(fan_index, 0, True, self.index) - self._fan_list.append(fan) - ''' def __initialize_fan(self): from sonic_platform.fan import Fan for fan_index in range(0, PSU_NUM_FAN[self.index]): fan = Fan(fan_index, 0, is_psu_fan=True, psu_index=self.index) self._fan_list.append(fan) + self._thermal_list.append(Thermal(is_psu=True, psu_index=self.index)) def get_voltage(self): """ @@ -79,6 +73,9 @@ def get_voltage(self): A float number, the output voltage in volts, e.g. 12.1 """ + if self.get_status() is not True: + return 0 + vout_path = "{}{}".format(self.hwmon_path, 'psu_v_out') vout_val=self._api_helper.read_txt_file(vout_path) if vout_val is not None: @@ -92,6 +89,9 @@ def get_current(self): Returns: A float number, the electric current in amperes, e.g 15.4 """ + if self.get_status() is not True: + return 0 + iout_path = "{}{}".format(self.hwmon_path, 'psu_i_out') val=self._api_helper.read_txt_file(iout_path) if val is not None: @@ -105,6 +105,9 @@ def get_power(self): Returns: A float number, the power in watts, e.g. 302.6 """ + if self.get_status() is not True: + return 0 + pout_path = "{}{}".format(self.hwmon_path, 'psu_p_out') val=self._api_helper.read_txt_file(pout_path) if val is not None: @@ -170,7 +173,7 @@ def get_temperature_high_threshold(self): A float number, the high threshold temperature of PSU in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - return False #Not supported + return self._thermal_list[0].get_high_threshold() def get_voltage_high_threshold(self): """ @@ -275,3 +278,31 @@ def is_replaceable(self): bool: True if it is replaceable. """ return True + + def get_revision(self): + """ + Retrieves the hardware revision of the device + + Returns: + string: Revision value of device + """ + revision_path = "{}{}".format(self.hwmon_path, 'psu_mfr_revision') + revision = self._api_helper.read_txt_file(revision_path) + if revision is None: + return 'N/A' + + return revision + + def get_maximum_supplied_power(self): + """ + Retrieves the maximum supplied power by PSU + Returns: + A float number, the maximum power output in Watts. + e.g. 1200.1 + """ + pout_max_path = "{}{}".format(self.hwmon_path, 'psu_mfr_pout_max') + val=self._api_helper.read_txt_file(pout_max_path) + if val is not None: + return float(val)/1000 + else: + return 0.0 diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/sfp.py index adab3d294c..0aad3b6485 100644 --- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/sfp.py +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/sfp.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - ############################################################################# # Edgecore # @@ -8,115 +6,26 @@ # ############################################################################# +import os import time -import sys -import subprocess -from ctypes import create_string_buffer try: - from sonic_platform_base.sfp_base import SfpBase - from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom - from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId - from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom - from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId - #from sonic_platform_base.sonic_sfp.sff8472 import sffbase + from sonic_py_common.logger import Logger + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper from .helper import APIHelper + from sonic_py_common import device_info except ImportError as e: raise ImportError(str(e) + "- required module not found") +NONE_SFP_TYPE = "NONE-SFP" +SFP_TYPE = "SFP" +QSFP_TYPE = "QSFP" + CPLD_I2C_PATH = "/sys/bus/i2c/devices/3-0060/" -QSFP_INFO_OFFSET = 128 -QSFP_DOM_OFFSET = 0 - -SFP_INFO_OFFSET = 0 -SFP_DOM_OFFSET = 256 - -XCVR_INTFACE_BULK_OFFSET = 0 -XCVR_INTFACE_BULK_WIDTH_QSFP = 20 -XCVR_INTFACE_BULK_WIDTH_SFP = 21 -XCVR_HW_REV_WIDTH_QSFP = 2 -XCVR_HW_REV_WIDTH_SFP = 4 -XCVR_CABLE_LENGTH_WIDTH_QSFP = 5 -XCVR_VENDOR_NAME_OFFSET = 20 -XCVR_VENDOR_NAME_WIDTH = 16 -XCVR_VENDOR_OUI_OFFSET = 37 -XCVR_VENDOR_OUI_WIDTH = 3 -XCVR_VENDOR_PN_OFFSET = 40 -XCVR_VENDOR_PN_WIDTH = 16 -XCVR_HW_REV_OFFSET = 56 -XCVR_HW_REV_WIDTH_OSFP = 2 -XCVR_HW_REV_WIDTH_SFP = 4 -XCVR_VENDOR_SN_OFFSET = 68 -XCVR_VENDOR_SN_WIDTH = 16 -XCVR_VENDOR_DATE_OFFSET = 84 -XCVR_VENDOR_DATE_WIDTH = 8 -XCVR_DOM_CAPABILITY_OFFSET = 92 -XCVR_DOM_CAPABILITY_WIDTH = 1 - -# Offset for values in QSFP eeprom -QSFP_DOM_REV_OFFSET = 1 -QSFP_DOM_REV_WIDTH = 1 -QSFP_TEMPE_OFFSET = 22 -QSFP_TEMPE_WIDTH = 2 -QSFP_VOLT_OFFSET = 26 -QSFP_VOLT_WIDTH = 2 -QSFP_CHANNL_MON_OFFSET = 34 -QSFP_CHANNL_MON_WIDTH = 16 -QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH = 24 -QSFP_CONTROL_OFFSET = 86 -QSFP_CONTROL_WIDTH = 8 -QSFP_CHANNL_RX_LOS_STATUS_OFFSET = 3 -QSFP_CHANNL_RX_LOS_STATUS_WIDTH = 1 -QSFP_CHANNL_TX_FAULT_STATUS_OFFSET = 4 -QSFP_CHANNL_TX_FAULT_STATUS_WIDTH = 1 -QSFP_POWEROVERRIDE_OFFSET = 93 -QSFP_POWEROVERRIDE_WIDTH = 1 -QSFP_PAGE03_OFFSET = 384 -QSFP_MODULE_THRESHOLD_OFFSET = 128 -QSFP_MODULE_THRESHOLD_WIDTH = 24 -QSFP_CHANNEL_THRESHOLD_OFFSET = 176 -QSFP_CHANNEL_THRESHOLD_WIDTH = 16 - -qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)', - 'Length OM2(m)', 'Length OM1(m)', - 'Length Cable Assembly(m)') - -qsfp_compliance_code_tup = ('10/40G Ethernet Compliance Code', 'SONET Compliance codes', - 'SAS/SATA compliance codes', 'Gigabit Ethernet Compliant codes', - 'Fibre Channel link length/Transmitter Technology', - 'Fibre Channel transmission media', 'Fibre Channel Speed') - - -# Offset for values in SFP eeprom -SFP_TEMPE_OFFSET = 96 -SFP_TEMPE_WIDTH = 2 -SFP_VOLT_OFFSET = 98 -SFP_VOLT_WIDTH = 2 -SFP_CHANNL_MON_OFFSET = 100 -SFP_CHANNL_MON_WIDTH = 6 -SFP_MODULE_THRESHOLD_OFFSET = 0 -SFP_MODULE_THRESHOLD_WIDTH = 40 -SFP_CHANNL_THRESHOLD_OFFSET = 112 -SFP_CHANNL_THRESHOLD_WIDTH = 2 -SFP_STATUS_CONTROL_OFFSET = 110 -SFP_STATUS_CONTROL_WIDTH = 1 -SFP_TX_DISABLE_HARD_BIT = 7 -SFP_TX_DISABLE_SOFT_BIT = 6 - -sfp_cable_length_tup = ('LengthSMFkm-UnitsOfKm', 'LengthSMF(UnitsOf100m)', - 'Length50um(UnitsOf10m)', 'Length62.5um(UnitsOfm)', - 'LengthCable(UnitsOfm)', 'LengthOM3(UnitsOf10m)') - -sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode', - 'ESCONComplianceCodes', 'SONETComplianceCodes', - 'EthernetComplianceCodes', 'FibreChannelLinkLength', - 'FibreChannelTechnology', 'SFP+CableTechnology', - 'FibreChannelTransmissionMedia', 'FibreChannelSpeed') - - -class Sfp(SfpBase): +logger = Logger() +class Sfp(SfpOptoeBase): """Platform-specific Sfp class""" # Port number @@ -126,10 +35,7 @@ class Sfp(SfpBase): # Path to sysfs PLATFORM_ROOT_PATH = "/usr/share/sonic/device" PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" - HOST_CHK_CMD = ["docker"] - - PLATFORM = "x86_64-accton_as4630_54te-r0" - HWSKU = "Accton-AS4630-54TE" + HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" _port_to_i2c_mapping = { 49: 18, @@ -140,510 +46,41 @@ class Sfp(SfpBase): 54: 23, } + SFP_TYPE_CODE_LIST = [ + 0x03, # SFP/SFP+/SFP28 + 0x0b # DWDM-SFP/SFP+ + ] + QSFP_TYPE_CODE_LIST = [ + 0x0c, # QSFP + 0x0d, # QSFP+ or later + 0x11, # QSFP28 or later + 0xe1 # QSFP28 EDFA + ] + def __init__(self, sfp_index=0): + SfpOptoeBase.__init__(self) self._api_helper=APIHelper() # Init index - self.index = sfp_index - self.port_num = self.index + 1 + self.port_num = sfp_index + 1 + self.index = self.port_num + if self.port_num < self.PORT_START: + self.sfp_type = NONE_SFP_TYPE + elif self.port_num < 53: + self.sfp_type = SFP_TYPE + else: + self.sfp_type = QSFP_TYPE + # Init eeprom path eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom' self.port_to_eeprom_mapping = {} 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]) - self.info_dict_keys = ['type', 'vendor_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', - 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate', 'specification_compliance', 'vendor_date', 'vendor_oui', - 'application_advertisement', 'type_abbrv_name'] - - self.dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', 'power_lpmode', 'tx_disable', 'tx_disable_channel', 'temperature', 'voltage', - 'rx1power', 'rx2power', 'rx3power', 'rx4power', 'tx1bias', 'tx2bias', 'tx3bias', 'tx4bias', 'tx1power', 'tx2power', 'tx3power', 'tx4power'] - - self.threshold_dict_keys = ['temphighalarm', 'temphighwarning', 'templowalarm', 'templowwarning', 'vcchighalarm', 'vcchighwarning', 'vcclowalarm', 'vcclowwarning', 'rxpowerhighalarm', 'rxpowerhighwarning', - 'rxpowerlowalarm', 'rxpowerlowwarning', 'txpowerhighalarm', 'txpowerhighwarning', 'txpowerlowalarm', 'txpowerlowwarning', 'txbiashighalarm', 'txbiashighwarning', 'txbiaslowalarm', 'txbiaslowwarning'] - - SfpBase.__init__(self) - - def _convert_string_to_num(self, value_str): - if "-inf" in value_str: - return 'N/A' - elif "Unknown" in value_str: - return 'N/A' - elif 'dBm' in value_str: - t_str = value_str.rstrip('dBm') - return float(t_str) - elif 'mA' in value_str: - t_str = value_str.rstrip('mA') - return float(t_str) - elif 'C' in value_str: - t_str = value_str.rstrip('C') - return float(t_str) - elif 'Volts' in value_str: - t_str = value_str.rstrip('Volts') - return float(t_str) - else: - return 'N/A' - - def __write_txt_file(self, file_path, value): - try: - with open(file_path, 'w', buffering=0) as fd: - fd.write(str(value)) - except Exception: - return False - return True + def get_eeprom_path(self): + return self.port_to_eeprom_mapping[self.port_num] def __is_host(self): - return subprocess.call(self.HOST_CHK_CMD) == 0 - - def __get_path_to_port_config_file(self): - platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) - hwsku_path = "/".join([platform_path, self.HWSKU] - ) if self.__is_host() else self.PMON_HWSKU_PATH - return "/".join([hwsku_path, "port_config.ini"]) - - def __read_eeprom_specific_bytes(self, offset, num_bytes): - sysfsfile_eeprom = None - eeprom_raw = [] - for i in range(0, num_bytes): - eeprom_raw.append("0x00") - - sysfs_sfp_i2c_client_eeprom_path = self.port_to_eeprom_mapping[self.port_num] - try: - sysfsfile_eeprom = open( - sysfs_sfp_i2c_client_eeprom_path, mode="rb", buffering=0) - sysfsfile_eeprom.seek(offset) - raw = sysfsfile_eeprom.read(num_bytes) - if sys.version_info[0] >= 3: - for n in range(0, num_bytes): - eeprom_raw[n] = hex(raw[n])[2:].zfill(2) - else: - for n in range(0, num_bytes): - eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) - except Exception: - pass - finally: - if sysfsfile_eeprom: - sysfsfile_eeprom.close() - - return eeprom_raw - - def get_transceiver_info(self): - """ - Retrieves transceiver info of this SFP - Returns: - A dict which contains following keys/values : - ======================================================================== - keys |Value Format |Information - ---------------------------|---------------|---------------------------- - type |1*255VCHAR |type of SFP - vendor_rev |1*255VCHAR |vendor revision of SFP - serial |1*255VCHAR |serial number of the SFP - manufacturer |1*255VCHAR |SFP vendor name - model |1*255VCHAR |SFP model name - connector |1*255VCHAR |connector information - encoding |1*255VCHAR |encoding information - ext_identifier |1*255VCHAR |extend identifier - ext_rateselect_compliance |1*255VCHAR |extended rateSelect compliance - cable_length |INT |cable length in m - nominal_bit_rate |INT |nominal bit rate by 100Mbs - specification_compliance |1*255VCHAR |specification compliance - vendor_date |1*255VCHAR |vendor date - vendor_oui |1*255VCHAR |vendor OUI - application_advertisement |1*255VCHAR |supported applications advertisement - ======================================================================== - """ - # check present status - if self.port_num < 49: - return {} - elif self.port_num < 53: - sfpi_obj = sff8472InterfaceId() #SFP - else: - sfpi_obj = sff8436InterfaceId() #QSFP - if not self.get_presence() or not sfpi_obj: - return {} - - if self.port_num < 53: - offset = SFP_INFO_OFFSET - sfp_interface_bulk_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_INTFACE_BULK_OFFSET), XCVR_INTFACE_BULK_WIDTH_SFP) - else: - offset = QSFP_INFO_OFFSET - sfp_interface_bulk_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_INTFACE_BULK_OFFSET), XCVR_INTFACE_BULK_WIDTH_QSFP) - - sfp_interface_bulk_data = sfpi_obj.parse_sfp_info_bulk( - sfp_interface_bulk_raw, 0) - - sfp_vendor_name_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_VENDOR_NAME_OFFSET), XCVR_VENDOR_NAME_WIDTH) - sfp_vendor_name_data = sfpi_obj.parse_vendor_name( - sfp_vendor_name_raw, 0) - - sfp_vendor_pn_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_VENDOR_PN_OFFSET), XCVR_VENDOR_PN_WIDTH) - sfp_vendor_pn_data = sfpi_obj.parse_vendor_pn( - sfp_vendor_pn_raw, 0) - - if self.port_num < 53: - sfp_vendor_rev_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_HW_REV_OFFSET), XCVR_HW_REV_WIDTH_SFP) - else: - sfp_vendor_rev_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_HW_REV_OFFSET), XCVR_HW_REV_WIDTH_QSFP) - - sfp_vendor_rev_data = sfpi_obj.parse_vendor_rev( - sfp_vendor_rev_raw, 0) - - sfp_vendor_sn_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_VENDOR_SN_OFFSET), XCVR_VENDOR_SN_WIDTH) - sfp_vendor_sn_data = sfpi_obj.parse_vendor_sn( - sfp_vendor_sn_raw, 0) - - sfp_vendor_oui_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_VENDOR_OUI_OFFSET), XCVR_VENDOR_OUI_WIDTH) - if sfp_vendor_oui_raw is not None: - sfp_vendor_oui_data = sfpi_obj.parse_vendor_oui( - sfp_vendor_oui_raw, 0) - - sfp_vendor_date_raw = self.__read_eeprom_specific_bytes( - (offset + XCVR_VENDOR_DATE_OFFSET), XCVR_VENDOR_DATE_WIDTH) - sfp_vendor_date_data = sfpi_obj.parse_vendor_date( - sfp_vendor_date_raw, 0) - - transceiver_info_dict = dict.fromkeys(self.info_dict_keys, 'N/A') - compliance_code_dict = dict() - - if sfp_interface_bulk_data: - transceiver_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value'] - transceiver_info_dict['connector'] = sfp_interface_bulk_data['data']['Connector']['value'] - transceiver_info_dict['encoding'] = sfp_interface_bulk_data['data']['EncodingCodes']['value'] - transceiver_info_dict['ext_identifier'] = sfp_interface_bulk_data['data']['Extended Identifier']['value'] - transceiver_info_dict['ext_rateselect_compliance'] = sfp_interface_bulk_data['data']['RateIdentifier']['value'] - transceiver_info_dict['type_abbrv_name'] = sfp_interface_bulk_data['data']['type_abbrv_name']['value'] - - transceiver_info_dict['manufacturer'] = sfp_vendor_name_data[ - 'data']['Vendor Name']['value'] if sfp_vendor_name_data else 'N/A' - transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] if sfp_vendor_pn_data else 'N/A' - transceiver_info_dict['vendor_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] if sfp_vendor_rev_data else 'N/A' - transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] if sfp_vendor_sn_data else 'N/A' - transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] if sfp_vendor_oui_data else 'N/A' - transceiver_info_dict['vendor_date'] = sfp_vendor_date_data[ - 'data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] if sfp_vendor_date_data else 'N/A' - transceiver_info_dict['cable_type'] = "Unknown" - transceiver_info_dict['cable_length'] = "Unknown" - - if self.port_num < 53: - for key in sfp_cable_length_tup: - if key in sfp_interface_bulk_data['data']: - transceiver_info_dict['cable_type'] = key - transceiver_info_dict['cable_length'] = str( - sfp_interface_bulk_data['data'][key]['value']) - - for key in sfp_compliance_code_tup: - if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value'] - - transceiver_info_dict['specification_compliance'] = str( - compliance_code_dict) - transceiver_info_dict['nominal_bit_rate'] = str( - sfp_interface_bulk_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value']) - else: - for key in qsfp_cable_length_tup: - if key in sfp_interface_bulk_data['data']: - transceiver_info_dict['cable_type'] = key - transceiver_info_dict['cable_length'] = str( - sfp_interface_bulk_data['data'][key]['value']) - - for key in qsfp_compliance_code_tup: - if key in sfp_interface_bulk_data['data']['Specification compliance']['value']: - compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value'] - - transceiver_info_dict['specification_compliance'] = str( - compliance_code_dict) - transceiver_info_dict['nominal_bit_rate'] = str( - sfp_interface_bulk_data['data']['Nominal Bit Rate(100Mbs)']['value']) - - - return transceiver_info_dict - - def get_transceiver_bulk_status(self): - """ - Retrieves transceiver bulk status of this SFP - Returns: - A dict which contains following keys/values : - ======================================================================== - keys |Value Format |Information - ---------------------------|---------------|---------------------------- - rx_los |BOOLEAN |RX loss-of-signal status, True if has RX los, False if not. - tx_fault |BOOLEAN |TX fault status, True if has TX fault, False if not. - reset_status |BOOLEAN |reset status, True if SFP in reset, False if not. - lp_mode |BOOLEAN |low power mode status, True in lp mode, False if not. - tx_disable |BOOLEAN |TX disable status, True TX disabled, False if not. - tx_disabled_channel |HEX |disabled TX channels in hex, bits 0 to 3 represent channel 0 - | |to channel 3. - temperature |INT |module temperature in Celsius - voltage |INT |supply voltage in mV - txbias |INT |TX Bias Current in mA, n is the channel number, - | |for example, tx2bias stands for tx bias of channel 2. - rxpower |INT |received optical power in mW, n is the channel number, - | |for example, rx2power stands for rx power of channel 2. - txpower |INT |TX output power in mW, n is the channel number, - | |for example, tx2power stands for tx power of channel 2. - ======================================================================== - """ - # check present status - if self.port_num < 53: #SFP case - sfpd_obj = sff8472Dom() - if not self.get_presence() or not sfpd_obj: - return {} - - eeprom_ifraw = self.__read_eeprom_specific_bytes(0, SFP_DOM_OFFSET) - sfpi_obj = sff8472InterfaceId(eeprom_ifraw) - cal_type = sfpi_obj.get_calibration_type() - sfpd_obj._calibration_type = cal_type - - offset = SFP_DOM_OFFSET - transceiver_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A') - dom_temperature_raw = self.__read_eeprom_specific_bytes( - (offset + SFP_TEMPE_OFFSET), SFP_TEMPE_WIDTH) - - if dom_temperature_raw is not None: - dom_temperature_data = sfpd_obj.parse_temperature( - dom_temperature_raw, 0) - transceiver_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] - - dom_voltage_raw = self.__read_eeprom_specific_bytes( - (offset + SFP_VOLT_OFFSET), SFP_VOLT_WIDTH) - if dom_voltage_raw is not None: - dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) - transceiver_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] - - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - (offset + SFP_CHANNL_MON_OFFSET), SFP_CHANNL_MON_WIDTH) - if dom_channel_monitor_raw is not None: - dom_voltage_data = sfpd_obj.parse_channel_monitor_params( - dom_channel_monitor_raw, 0) - transceiver_dom_info_dict['tx1power'] = dom_voltage_data['data']['TXPower']['value'] - transceiver_dom_info_dict['rx1power'] = dom_voltage_data['data']['RXPower']['value'] - transceiver_dom_info_dict['tx1bias'] = dom_voltage_data['data']['TXBias']['value'] - - else: #QSFP case - sfpd_obj = sff8436Dom() - sfpi_obj = sff8436InterfaceId() - - if not self.get_presence() or not sfpi_obj or not sfpd_obj: - return {} - - transceiver_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A') - offset = QSFP_DOM_OFFSET - offset_xcvr = QSFP_INFO_OFFSET - - # QSFP capability byte parse, through this byte can know whether it support tx_power or not. - # TODO: in the future when decided to migrate to support SFF-8636 instead of SFF-8436, - # need to add more code for determining the capability and version compliance - # in SFF-8636 dom capability definitions evolving with the versions. - qsfp_dom_capability_raw = self.__read_eeprom_specific_bytes( - (offset_xcvr + XCVR_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH) - if qsfp_dom_capability_raw is not None: - qspf_dom_capability_data = sfpi_obj.parse_dom_capability( - qsfp_dom_capability_raw, 0) - else: - return None - - dom_temperature_raw = self.__read_eeprom_specific_bytes( - (offset + QSFP_TEMPE_OFFSET), QSFP_TEMPE_WIDTH) - if dom_temperature_raw is not None: - dom_temperature_data = sfpd_obj.parse_temperature( - dom_temperature_raw, 0) - transceiver_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value'] - - dom_voltage_raw = self.__read_eeprom_specific_bytes( - (offset + QSFP_VOLT_OFFSET), QSFP_VOLT_WIDTH) - if dom_voltage_raw is not None: - dom_voltage_data = sfpd_obj.parse_voltage(dom_voltage_raw, 0) - transceiver_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] - - qsfp_dom_rev_raw = self.__read_eeprom_specific_bytes( - (offset + QSFP_DOM_REV_OFFSET), QSFP_DOM_REV_WIDTH) - if qsfp_dom_rev_raw is not None: - qsfp_dom_rev_data = sfpd_obj.parse_sfp_dom_rev(qsfp_dom_rev_raw, 0) - qsfp_dom_rev = qsfp_dom_rev_data['data']['dom_rev']['value'] - - # The tx_power monitoring is only available on QSFP which compliant with SFF-8636 - # and claimed that it support tx_power with one indicator bit. - dom_channel_monitor_data = {} - dom_channel_monitor_raw = None - qsfp_tx_power_support = qspf_dom_capability_data['data']['Tx_power_support']['value'] - if (qsfp_dom_rev[0:8] != 'SFF-8636' or (qsfp_dom_rev[0:8] == 'SFF-8636' and qsfp_tx_power_support != 'on')): - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WIDTH) - if dom_channel_monitor_raw is not None: - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params( - dom_channel_monitor_raw, 0) - - else: - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - (offset + QSFP_CHANNL_MON_OFFSET), QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH) - if dom_channel_monitor_raw is not None: - dom_channel_monitor_data = sfpd_obj.parse_channel_monitor_params_with_tx_power( - dom_channel_monitor_raw, 0) - transceiver_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TX1Power']['value'] - transceiver_dom_info_dict['tx2power'] = dom_channel_monitor_data['data']['TX2Power']['value'] - transceiver_dom_info_dict['tx3power'] = dom_channel_monitor_data['data']['TX3Power']['value'] - transceiver_dom_info_dict['tx4power'] = dom_channel_monitor_data['data']['TX4Power']['value'] - - if dom_channel_monitor_raw: - transceiver_dom_info_dict['rx1power'] = dom_channel_monitor_data['data']['RX1Power']['value'] - transceiver_dom_info_dict['rx2power'] = dom_channel_monitor_data['data']['RX2Power']['value'] - transceiver_dom_info_dict['rx3power'] = dom_channel_monitor_data['data']['RX3Power']['value'] - transceiver_dom_info_dict['rx4power'] = dom_channel_monitor_data['data']['RX4Power']['value'] - transceiver_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TX1Bias']['value'] - transceiver_dom_info_dict['tx2bias'] = dom_channel_monitor_data['data']['TX2Bias']['value'] - transceiver_dom_info_dict['tx3bias'] = dom_channel_monitor_data['data']['TX3Bias']['value'] - transceiver_dom_info_dict['tx4bias'] = dom_channel_monitor_data['data']['TX4Bias']['value'] - #End of else - - - for key in transceiver_dom_info_dict: - transceiver_dom_info_dict[key] = self._convert_string_to_num( - transceiver_dom_info_dict[key]) - - transceiver_dom_info_dict['rx_los'] = self.get_rx_los() - transceiver_dom_info_dict['tx_fault'] = self.get_tx_fault() - transceiver_dom_info_dict['reset_status'] = self.get_reset_status() - transceiver_dom_info_dict['lp_mode'] = self.get_lpmode() - - return transceiver_dom_info_dict - - def get_transceiver_threshold_info(self): - """ - Retrieves transceiver threshold info of this SFP - Returns: - A dict which contains following keys/values : - ======================================================================== - keys |Value Format |Information - ---------------------------|---------------|---------------------------- - temphighalarm |FLOAT |High Alarm Threshold value of temperature in Celsius. - templowalarm |FLOAT |Low Alarm Threshold value of temperature in Celsius. - temphighwarning |FLOAT |High Warning Threshold value of temperature in Celsius. - templowwarning |FLOAT |Low Warning Threshold value of temperature in Celsius. - vcchighalarm |FLOAT |High Alarm Threshold value of supply voltage in mV. - vcclowalarm |FLOAT |Low Alarm Threshold value of supply voltage in mV. - vcchighwarning |FLOAT |High Warning Threshold value of supply voltage in mV. - vcclowwarning |FLOAT |Low Warning Threshold value of supply voltage in mV. - rxpowerhighalarm |FLOAT |High Alarm Threshold value of received power in dBm. - rxpowerlowalarm |FLOAT |Low Alarm Threshold value of received power in dBm. - rxpowerhighwarning |FLOAT |High Warning Threshold value of received power in dBm. - rxpowerlowwarning |FLOAT |Low Warning Threshold value of received power in dBm. - txpowerhighalarm |FLOAT |High Alarm Threshold value of transmit power in dBm. - txpowerlowalarm |FLOAT |Low Alarm Threshold value of transmit power in dBm. - txpowerhighwarning |FLOAT |High Warning Threshold value of transmit power in dBm. - txpowerlowwarning |FLOAT |Low Warning Threshold value of transmit power in dBm. - txbiashighalarm |FLOAT |High Alarm Threshold value of tx Bias Current in mA. - txbiaslowalarm |FLOAT |Low Alarm Threshold value of tx Bias Current in mA. - txbiashighwarning |FLOAT |High Warning Threshold value of tx Bias Current in mA. - txbiaslowwarning |FLOAT |Low Warning Threshold value of tx Bias Current in mA. - ======================================================================== - """ - # check present status - if self.port_num < 53: - sfpd_obj = sff8472Dom() - - if not self.get_presence() and not sfpd_obj: - return {} - - eeprom_ifraw = self.__read_eeprom_specific_bytes(0, SFP_DOM_OFFSET) - sfpi_obj = sff8472InterfaceId(eeprom_ifraw) - cal_type = sfpi_obj.get_calibration_type() - sfpd_obj._calibration_type = cal_type - - offset = SFP_DOM_OFFSET - transceiver_dom_threshold_info_dict = dict.fromkeys( - self.threshold_dict_keys, 'N/A') - dom_module_threshold_raw = self.__read_eeprom_specific_bytes( - (offset + SFP_MODULE_THRESHOLD_OFFSET), SFP_MODULE_THRESHOLD_WIDTH) - if dom_module_threshold_raw is not None: - dom_module_threshold_data = sfpd_obj.parse_alarm_warning_threshold( - dom_module_threshold_raw, 0) - - transceiver_dom_threshold_info_dict['temphighalarm'] = dom_module_threshold_data['data']['TempHighAlarm']['value'] - transceiver_dom_threshold_info_dict['templowalarm'] = dom_module_threshold_data['data']['TempLowAlarm']['value'] - transceiver_dom_threshold_info_dict['temphighwarning'] = dom_module_threshold_data['data']['TempHighWarning']['value'] - transceiver_dom_threshold_info_dict['templowwarning'] = dom_module_threshold_data['data']['TempLowWarning']['value'] - transceiver_dom_threshold_info_dict['vcchighalarm'] = dom_module_threshold_data['data']['VoltageHighAlarm']['value'] - transceiver_dom_threshold_info_dict['vcclowalarm'] = dom_module_threshold_data['data']['VoltageLowAlarm']['value'] - transceiver_dom_threshold_info_dict['vcchighwarning'] = dom_module_threshold_data[ - 'data']['VoltageHighWarning']['value'] - transceiver_dom_threshold_info_dict['vcclowwarning'] = dom_module_threshold_data['data']['VoltageLowWarning']['value'] - transceiver_dom_threshold_info_dict['txbiashighalarm'] = dom_module_threshold_data['data']['BiasHighAlarm']['value'] - transceiver_dom_threshold_info_dict['txbiaslowalarm'] = dom_module_threshold_data['data']['BiasLowAlarm']['value'] - transceiver_dom_threshold_info_dict['txbiashighwarning'] = dom_module_threshold_data['data']['BiasHighWarning']['value'] - transceiver_dom_threshold_info_dict['txbiaslowwarning'] = dom_module_threshold_data['data']['BiasLowWarning']['value'] - transceiver_dom_threshold_info_dict['txpowerhighalarm'] = dom_module_threshold_data['data']['TXPowerHighAlarm']['value'] - transceiver_dom_threshold_info_dict['txpowerlowalarm'] = dom_module_threshold_data['data']['TXPowerLowAlarm']['value'] - transceiver_dom_threshold_info_dict['txpowerhighwarning'] = dom_module_threshold_data['data']['TXPowerHighWarning']['value'] - transceiver_dom_threshold_info_dict['txpowerlowwarning'] = dom_module_threshold_data['data']['TXPowerLowWarning']['value'] - transceiver_dom_threshold_info_dict['rxpowerhighalarm'] = dom_module_threshold_data['data']['RXPowerHighAlarm']['value'] - transceiver_dom_threshold_info_dict['rxpowerlowalarm'] = dom_module_threshold_data['data']['RXPowerLowAlarm']['value'] - transceiver_dom_threshold_info_dict['rxpowerhighwarning'] = dom_module_threshold_data['data']['RXPowerHighWarning']['value'] - transceiver_dom_threshold_info_dict['rxpowerlowwarning'] = dom_module_threshold_data['data']['RXPowerLowWarning']['value'] - - for key in transceiver_dom_threshold_info_dict: - transceiver_dom_threshold_info_dict[key] = self._convert_string_to_num( - transceiver_dom_threshold_info_dict[key]) - - return transceiver_dom_threshold_info_dict - - - else: - sfpd_obj = sff8436Dom() - - if not self.get_presence() or not sfpd_obj: - return {} - - offset = QSFP_PAGE03_OFFSET - transceiver_dom_threshold_dict = dict.fromkeys( - self.threshold_dict_keys, 'N/A') - dom_thres_raw = self.__read_eeprom_specific_bytes( - offset + QSFP_MODULE_THRESHOLD_OFFSET, QSFP_MODULE_THRESHOLD_WIDTH) if self.get_presence() and sfpd_obj else None - - if dom_thres_raw: - module_threshold_values = sfpd_obj.parse_module_threshold_values( - dom_thres_raw, 0) - module_threshold_data = module_threshold_values.get('data') - if module_threshold_data: - transceiver_dom_threshold_dict['temphighalarm'] = module_threshold_data['TempHighAlarm']['value'] - transceiver_dom_threshold_dict['templowalarm'] = module_threshold_data['TempLowAlarm']['value'] - transceiver_dom_threshold_dict['temphighwarning'] = module_threshold_data['TempHighWarning']['value'] - transceiver_dom_threshold_dict['templowwarning'] = module_threshold_data['TempLowWarning']['value'] - transceiver_dom_threshold_dict['vcchighalarm'] = module_threshold_data['VccHighAlarm']['value'] - transceiver_dom_threshold_dict['vcclowalarm'] = module_threshold_data['VccLowAlarm']['value'] - transceiver_dom_threshold_dict['vcchighwarning'] = module_threshold_data['VccHighWarning']['value'] - transceiver_dom_threshold_dict['vcclowwarning'] = module_threshold_data['VccLowWarning']['value'] - - dom_thres_raw = self.__read_eeprom_specific_bytes( - offset + QSFP_CHANNEL_THRESHOLD_OFFSET, QSFP_CHANNEL_THRESHOLD_WIDTH) if self.get_presence() and sfpd_obj else None - channel_threshold_values = sfpd_obj.parse_channel_threshold_values( - dom_thres_raw, 0) - channel_threshold_data = channel_threshold_values.get('data') - if channel_threshold_data: - transceiver_dom_threshold_dict['rxpowerhighalarm'] = channel_threshold_data['RxPowerHighAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerlowalarm'] = channel_threshold_data['RxPowerLowAlarm']['value'] - transceiver_dom_threshold_dict['rxpowerhighwarning'] = channel_threshold_data['RxPowerHighWarning']['value'] - transceiver_dom_threshold_dict['rxpowerlowwarning'] = channel_threshold_data['RxPowerLowWarning']['value'] - transceiver_dom_threshold_dict['txpowerhighalarm'] = "0.0dBm" - transceiver_dom_threshold_dict['txpowerlowalarm'] = "0.0dBm" - transceiver_dom_threshold_dict['txpowerhighwarning'] = "0.0dBm" - transceiver_dom_threshold_dict['txpowerlowwarning'] = "0.0dBm" - transceiver_dom_threshold_dict['txbiashighalarm'] = channel_threshold_data['TxBiasHighAlarm']['value'] - transceiver_dom_threshold_dict['txbiaslowalarm'] = channel_threshold_data['TxBiasLowAlarm']['value'] - transceiver_dom_threshold_dict['txbiashighwarning'] = channel_threshold_data['TxBiasHighWarning']['value'] - transceiver_dom_threshold_dict['txbiaslowwarning'] = channel_threshold_data['TxBiasLowWarning']['value'] - - for key in transceiver_dom_threshold_dict: - transceiver_dom_threshold_dict[key] = self._convert_string_to_num( - transceiver_dom_threshold_dict[key]) - - return transceiver_dom_threshold_dict + return os.system(self.HOST_CHK_CMD) == 0 def get_reset_status(self): """ @@ -669,34 +106,29 @@ def get_rx_los(self): A Boolean, True if SFP has RX LOS, False if not. Note : RX LOS status is latched until a call to get_rx_los or a reset. """ - rx_los = False + rx_los = [False] if self.port_num < 49: #Copper port, no sysfs - return False + return [False] if self.port_num < 53: - rx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_rx_los_', self.port_num) + rx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_rx_los_', self.port_num) rx_los=self._api_helper.read_txt_file(rx_path) - if rx_los is None: - return False - #status_control_raw = self.__read_eeprom_specific_bytes( - # SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - #if status_control_raw: - # data = int(status_control_raw[0], 16) - # rx_los = (sffbase().test_bit(data, 1) != 0) - + if rx_los is not None: + if rx_los == '1': + return [True] + else: + return [False] + else: + return [False] else: - rx_los_list = [] - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - QSFP_CHANNL_RX_LOS_STATUS_OFFSET, QSFP_CHANNL_RX_LOS_STATUS_WIDTH) if self.get_presence() else None - if dom_channel_monitor_raw is not None: - rx_los_data = int(dom_channel_monitor_raw[0], 16) - rx_los_list.append(rx_los_data & 0x01 != 0) - rx_los_list.append(rx_los_data & 0x02 != 0) - rx_los_list.append(rx_los_data & 0x04 != 0) - rx_los_list.append(rx_los_data & 0x08 != 0) - rx_los = rx_los_list[0] and rx_los_list[1] and rx_los_list[2] and rx_los_list[3] - return rx_los + api = self.get_xcvr_api() + if api is not None: + rx_los = api.get_rx_los() + if isinstance(rx_los, list) and "N/A" in rx_los: + return [False for _ in rx_los] + return rx_los + return None def get_tx_fault(self): """ @@ -705,33 +137,28 @@ def get_tx_fault(self): A Boolean, True if SFP has TX fault, False if not Note : TX fault status is lached until a call to get_tx_fault or a reset. """ - tx_fault = False + tx_fault = [False] if self.port_num < 49: #Copper port, no sysfs - return False + return [False] if self.port_num < 53: - tx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_tx_fault_', self.port_num) + tx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_tx_fault_', self.port_num) tx_fault=self._api_helper.read_txt_file(tx_path) - if tx_fault is None: - return False - #status_control_raw = self.__read_eeprom_specific_bytes( - # SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - #if status_control_raw: - # data = int(status_control_raw[0], 16) - # tx_fault = (sffbase().test_bit(data, 2) != 0) + if tx_fault is not None: + if tx_fault == '1': + return [True] + else: + return [False] + else: + return [False] else: - tx_fault_list = [] - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - QSFP_CHANNL_TX_FAULT_STATUS_OFFSET, QSFP_CHANNL_TX_FAULT_STATUS_WIDTH) if self.get_presence() else None - if dom_channel_monitor_raw is not None: - tx_fault_data = int(dom_channel_monitor_raw[0], 16) - tx_fault_list.append(tx_fault_data & 0x01 != 0) - tx_fault_list.append(tx_fault_data & 0x02 != 0) - tx_fault_list.append(tx_fault_data & 0x04 != 0) - tx_fault_list.append(tx_fault_data & 0x08 != 0) - tx_fault = tx_fault_list[0] and tx_fault_list[1] and tx_fault_list[2] and tx_fault_list[3] - - return tx_fault + api = self.get_xcvr_api() + if api is not None: + tx_fault = api.get_tx_fault() + if isinstance(tx_fault, list) and "N/A" in tx_fault: + return [False for _ in tx_fault] + return tx_fault + return None def get_tx_disable(self): """ @@ -740,72 +167,24 @@ def get_tx_disable(self): A Boolean, True if tx_disable is enabled, False if disabled """ if self.port_num < 49: #Copper port, no sysfs - return False + return [False] - if self.port_num < 53: - tx_disable = False + if self.port_num < 53: + tx_disable = False tx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_tx_disable_', self.port_num) tx_disable=self._api_helper.read_txt_file(tx_path) - - - #status_control_raw = self.__read_eeprom_specific_bytes( - # SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - #if status_control_raw: - # data = int(status_control_raw[0], 16) - # tx_disable_hard = (sffbase().test_bit( - # data, SFP_TX_DISABLE_HARD_BIT) != 0) - # tx_disable_soft = (sffbase().test_bit( - # data, SFP_TX_DISABLE_SOFT_BIT) != 0) - # tx_disable = tx_disable_hard | tx_disable_soft if tx_disable is not None: - return tx_disable + if tx_disable == '1': + return [True] + else: + return [False] else: - return False - - else: - tx_disable_list = [] - - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return False + return [False] - dom_control_raw = self.__read_eeprom_specific_bytes( - QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None - if dom_control_raw is not None: - dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) - tx_disable_list.append( - 'On' == dom_control_data['data']['TX1Disable']['value']) - tx_disable_list.append( - 'On' == dom_control_data['data']['TX2Disable']['value']) - tx_disable_list.append( - 'On' == dom_control_data['data']['TX3Disable']['value']) - tx_disable_list.append( - 'On' == dom_control_data['data']['TX4Disable']['value']) - - return tx_disable_list - - def get_tx_disable_channel(self): - """ - Retrieves the TX disabled channels in this SFP - Returns: - A hex of 4 bits (bit 0 to bit 3 as channel 0 to channel 3) to represent - TX channels which have been disabled in this SFP. - As an example, a returned value of 0x5 indicates that channel 0 - and channel 2 have been disabled. - """ - if self.port_num < 53: - # SFP doesn't support this feature - return False else: - tx_disable_list = self.get_tx_disable() - if tx_disable_list is None: - return 0 - tx_disabled = 0 - for i in range(len(tx_disable_list)): - if tx_disable_list[i]: - tx_disabled |= 1 << i - return tx_disabled + api = self.get_xcvr_api() + return api.get_tx_disable() if api is not None else None def get_lpmode(self): """ @@ -813,7 +192,7 @@ def get_lpmode(self): Returns: A Boolean, True if lpmode is enabled, False if disabled """ - if self.port_num < 53: + if self.port_num < 53: # SFP doesn't support this feature return False else: @@ -821,124 +200,14 @@ def get_lpmode(self): power_override = self.get_power_override() return power_set and power_override - - def get_power_set(self): - - if self.port_num < 53: + def get_power_set(self): + if self.port_num < 53: # SFP doesn't support this feature return False else: - power_set = False - - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return False - - dom_control_raw = self.__read_eeprom_specific_bytes( - QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None - if dom_control_raw is not None: - dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) - power_set = ( - 'On' == dom_control_data['data']['PowerSet']['value']) - - return power_set - - def get_power_override(self): - """ - Retrieves the power-override status of this SFP - Returns: - A Boolean, True if power-override is enabled, False if disabled - """ - if self.port_num < 53: - return False # SFP doesn't support this feature - else: - power_override = False - - - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return False - - dom_control_raw = self.__read_eeprom_specific_bytes( - QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH) if self.get_presence() else None - if dom_control_raw is not None: - dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) - power_override = ( - 'On' == dom_control_data['data']['PowerOverride']['value']) - - return power_override - - def get_temperature(self): - """ - Retrieves the temperature of this SFP - Returns: - An integer number of current temperature in Celsius - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - return transceiver_dom_info_dict.get("temperature", "N/A") - - def get_voltage(self): - """ - Retrieves the supply voltage of this SFP - Returns: - An integer number of supply voltage in mV - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - return transceiver_dom_info_dict.get("voltage", "N/A") - - def get_tx_bias(self): - """ - Retrieves the TX bias current of this SFP - Returns: - A list of four integer numbers, representing TX bias in mA - for channel 0 to channel 4. - Ex. ['110.09', '111.12', '108.21', '112.09'] - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - - tx1_bs = transceiver_dom_info_dict.get("tx1bias", "N/A") - if self.port_num < 53: - return [tx1_bs, "N/A", "N/A", "N/A"] if transceiver_dom_info_dict else [] - - tx2_bs = transceiver_dom_info_dict.get("tx2bias", "N/A") - tx3_bs = transceiver_dom_info_dict.get("tx3bias", "N/A") - tx4_bs = transceiver_dom_info_dict.get("tx4bias", "N/A") - return [tx1_bs, tx2_bs, tx3_bs, tx4_bs] if transceiver_dom_info_dict else [] + api = self.get_xcvr_api() + return api.get_power_set() if api is not None else None - def get_rx_power(self): - """ - Retrieves the received optical power for this SFP - Returns: - A list of four integer numbers, representing received optical - power in mW for channel 0 to channel 4. - Ex. ['1.77', '1.71', '1.68', '1.70'] - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - - rx1_pw = transceiver_dom_info_dict.get("rx1power", "N/A") - if self.port_num < 53: - return [rx1_pw, "N/A", "N/A", "N/A"] if transceiver_dom_info_dict else [] - rx2_pw = transceiver_dom_info_dict.get("rx2power", "N/A") - rx3_pw = transceiver_dom_info_dict.get("rx3power", "N/A") - rx4_pw = transceiver_dom_info_dict.get("rx4power", "N/A") - return [rx1_pw, rx2_pw, rx3_pw, rx4_pw] if transceiver_dom_info_dict else [] - - def get_tx_power(self): - """ - Retrieves the TX power of this SFP - Returns: - A list of four integer numbers, representing TX power in mW - for channel 0 to channel 4. - Ex. ['1.86', '1.86', '1.86', '1.86'] - """ - transceiver_dom_info_dict = self.get_transceiver_bulk_status() - tx1_pw = transceiver_dom_info_dict.get("tx1power", "N/A") - if self.port_num < 53: - return [tx1_pw, "N/A", "N/A", "N/A"] if transceiver_dom_info_dict else [] - tx2_pw = transceiver_dom_info_dict.get("tx2power", "N/A") - tx3_pw = transceiver_dom_info_dict.get("tx3power", "N/A") - tx4_pw = transceiver_dom_info_dict.get("tx4power", "N/A") - return [tx1_pw, tx2_pw, tx3_pw, tx4_pw] def reset(self): """ @@ -974,8 +243,8 @@ def tx_disable(self, tx_disable): return False if self.port_num < 53: - tx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_tx_disable_', self.port_num) - ret = self.__write_txt_file(tx_path, 1 if tx_disable else 0) + tx_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_tx_disable_', self.port_num) + ret = self._api_helper.write_txt_file(tx_path, 1 if tx_disable else 0) if ret is not None: time.sleep(0.01) return ret @@ -985,78 +254,8 @@ def tx_disable(self, tx_disable): else: if not self.get_presence(): return False - sysfsfile_eeprom = None - try: - tx_disable_ctl = 0xf if tx_disable else 0x0 - buffer = create_string_buffer(1) - if sys.version_info[0] >= 3: - buffer[0] = tx_disable_ctl - else: - buffer[0] = chr(tx_disable_ctl) - # Write to eeprom - sysfsfile_eeprom = open( - self.port_to_eeprom_mapping[self.port_num], "r+b") - sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) - sysfsfile_eeprom.write(buffer[0]) - except IOError as e: - print ('Error: unable to open file: ',str(e)) - return False - finally: - if sysfsfile_eeprom is not None: - sysfsfile_eeprom.close() - time.sleep(0.01) - return True - - def tx_disable_channel(self, channel, disable): - """ - Sets the tx_disable for specified SFP channels - Args: - channel : A hex of 4 bits (bit 0 to bit 3) which represent channel 0 to 3, - e.g. 0x5 for channel 0 and channel 2. - disable : A boolean, True to disable TX channels specified in channel, - False to enable - Returns: - A boolean, True if successful, False if not - """ - - if self.port_num < 53: - return False # SFP doesn't support this feature - else: - if not self.get_presence(): - return False - - sysfsfile_eeprom = None - try: - channel_state = self.get_tx_disable_channel() - - for i in range(4): - channel_mask = (1 << i) - if not (channel & channel_mask): - continue - - if disable: - channel_state |= channel_mask - else: - channel_state &= ~channel_mask - - buffer = create_string_buffer(1) - if sys.version_info[0] >= 3: - buffer[0] = channel_state - else: - buffer[0] = chr(channel_state) - # Write to eeprom - sysfsfile_eeprom = open( - self.port_to_eeprom_mapping[self.port_num], "r+b") - sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) - sysfsfile_eeprom.write(buffer[0]) - except IOError as e: - print ('Error: unable to open file: ', str(e)) - return False - finally: - if sysfsfile_eeprom is not None: - sysfsfile_eeprom.close() - time.sleep(0.01) - return True + api = self.get_xcvr_api() + return api.tx_disable(tx_disable) if api is not None else None def set_lpmode(self, lpmode): """ @@ -1070,12 +269,23 @@ def set_lpmode(self, lpmode): if self.port_num < 53: return False # SFP doesn't support this feature else: + ''' + use power override to control lpmode + ''' + if not self.get_presence(): + return False + api = self.get_xcvr_api() + if api is None: + return False + if api.get_lpmode_support() == False: + logger.log_notice("The transceiver of port {} doesn't support to set low power mode.". format(self.port_num)) + return True if lpmode is True: - self.set_power_override(True, True) + ret = api.set_power_override(True, True) else: - self.set_power_override(False, False) + ret = api.set_power_override(True, False) - return True + return ret def set_power_override(self, power_override, power_set): """ @@ -1099,24 +309,8 @@ def set_power_override(self, power_override, power_set): else: if not self.get_presence(): return False - try: - power_override_bit = (1 << 0) if power_override else 0 - power_set_bit = (1 << 1) if power_set else (1 << 3) - - buffer = create_string_buffer(1) - if sys.version_info[0] >= 3: - buffer[0] = (power_override_bit | power_set_bit) - else: - buffer[0] = chr(power_override_bit | power_set_bit) - # Write to eeprom - with open(self.port_to_eeprom_mapping[self.port_num], "r+b") as fd: - fd.seek(QSFP_POWEROVERRIDE_OFFSET) - fd.write(buffer[0]) - time.sleep(0.01) - except Exception: - print ('Error: unable to open file: ', str(e)) - return False - return True + api = self.get_xcvr_api() + return api.set_power_override(power_override, power_set) if api is not None else None def get_name(self): """ @@ -1125,9 +319,9 @@ def get_name(self): string: The name of the device """ sfputil_helper = SfpUtilHelper() - sfputil_helper.read_porttab_mappings( - self.__get_path_to_port_config_file()) - name = sfputil_helper.logical[self.index] or "Unknown" + port_config_file_path = device_info.get_path_to_port_config_file() + sfputil_helper.read_porttab_mappings(port_config_file_path) + name = sfputil_helper.logical[self.port_num - 1] or "Unknown" return name def get_presence(self): @@ -1139,11 +333,11 @@ def get_presence(self): if self.port_num < 49: #Copper port, no sysfs return False - present_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_present_', self.port_num) + present_path = "{}{}{}".format(CPLD_I2C_PATH, '/module_present_', self.port_num) val=self._api_helper.read_txt_file(present_path) if val is not None: return int(val, 10)==1 - else: + else: return False def get_model(self): @@ -1170,7 +364,7 @@ def get_status(self): Returns: A boolean value, True if device is operating properly, False if not """ - return self.get_presence() and self.get_transceiver_bulk_status() + return self.get_presence() and not self.get_reset_status() def get_position_in_parent(self): """ @@ -1188,3 +382,150 @@ def is_replaceable(self): bool: True if it is replaceable. """ return True + + def __validate_eeprom_sfp(self): + checksum_test = 0 + eeprom_raw = self.read_eeprom(0, 96) + if eeprom_raw is None: + return None + + for i in range(0, 63): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[63]: + return False + + checksum_test = 0 + for i in range(64, 95): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[95]: + return False + + api = self.get_xcvr_api() + if api is None: + return False + + if api.is_flat_memory(): + return True + + checksum_test = 0 + eeprom_raw = self.read_eeprom(384, 96) + if eeprom_raw is None: + return None + + for i in range(0, 95): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[95]: + return False + + return True + + def __validate_eeprom_qsfp(self): + checksum_test = 0 + eeprom_raw = self.read_eeprom(128, 96) + if eeprom_raw is None: + return None + + for i in range(0, 63): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[63]: + return False + + checksum_test = 0 + for i in range(64, 95): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[95]: + return False + + api = self.get_xcvr_api() + if api is None: + return False + + if api.is_flat_memory(): + return True + + return True + + def validate_eeprom(self): + id_byte_raw = self.read_eeprom(0, 1) + if id_byte_raw is None: + return None + + id = id_byte_raw[0] + if id in self.QSFP_TYPE_CODE_LIST: + return self.__validate_eeprom_qsfp() + elif id in self.SFP_TYPE_CODE_LIST: + return self.__validate_eeprom_sfp() + else: + return False + + def validate_temperature(self): + temperature = self.get_temperature() + if temperature is None: + return None + + threshold_dict = self.get_transceiver_threshold_info() + if threshold_dict is None: + return None + + if isinstance(temperature, float) is not True: + return True + + if isinstance(threshold_dict['temphighalarm'], float) is not True: + return True + + return threshold_dict['temphighalarm'] > temperature + + def __get_error_description(self): + if not self.get_presence(): + return self.SFP_STATUS_UNPLUGGED + + err_stat = self.SFP_STATUS_BIT_INSERTED + + status = self.validate_eeprom() + if status is not True: + err_stat = (err_stat | self.SFP_ERROR_BIT_BAD_EEPROM) + + status = self.validate_temperature() + if status is not True: + err_stat = (err_stat | self.SFP_ERROR_BIT_HIGH_TEMP) + + if err_stat is self.SFP_STATUS_BIT_INSERTED: + return self.SFP_STATUS_OK + else: + err_desc = '' + cnt = 0 + for key in self.SFP_ERROR_BIT_TO_DESCRIPTION_DICT: + if (err_stat & key) != 0: + if cnt > 0: + err_desc = err_desc + "|" + cnt = cnt + 1 + err_desc = err_desc + self.SFP_ERROR_BIT_TO_DESCRIPTION_DICT[key] + + return err_desc + + def get_error_description(self): + """ + Retrives the error descriptions of the SFP module + + Returns: + String that represents the current error descriptions of vendor specific errors + In case there are multiple errors, they should be joined by '|', + like: "Bad EEPROM|Unsupported cable" + """ + if self.port_num < 49: + # RJ45 doesn't support this feature + return None + else: + api = self.get_xcvr_api() + if api is not None: + try: + return api.get_error_description() + except NotImplementedError: + return self.__get_error_description() + else: + return self.__get_error_description() diff --git a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/thermal.py b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/thermal.py index 7a453c594f..cb08ff1180 100644 --- a/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/thermal.py +++ b/device/accton/x86_64-accton_as4630_54te-r0/sonic_platform/thermal.py @@ -12,56 +12,157 @@ try: from sonic_platform_base.thermal_base import ThermalBase + from .helper import DeviceThreshold except ImportError as e: raise ImportError(str(e) + "- required module not found") +PSU_I2C_PATH = "/sys/bus/i2c/devices/{}-00{}/" +PSU_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "58" + }, + 1: { + "num": 11, + "addr": "59" + }, +} + +PSU_CPLD_I2C_MAPPING = { + 0: { + "num": 10, + "addr": "50" + }, + 1: { + "num": 11, + "addr": "51" + }, +} + +NOT_AVAILABLE = DeviceThreshold.NOT_AVAILABLE +HIGH_THRESHOLD = DeviceThreshold.HIGH_THRESHOLD +LOW_THRESHOLD = DeviceThreshold.LOW_THRESHOLD +HIGH_CRIT_THRESHOLD = DeviceThreshold.HIGH_CRIT_THRESHOLD +LOW_CRIT_THRESHOLD = DeviceThreshold.LOW_CRIT_THRESHOLD + +DEFAULT_THRESHOLD = { + 'Temp sensor 1' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'Temp sensor 2' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'Temp sensor 3' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'Temp sensor 4' : { + HIGH_THRESHOLD : '71.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : '91.0', + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'PSU-1 temp sensor 1' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'PSU-2 temp sensor 1' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + } +} class Thermal(ThermalBase): """Platform-specific Thermal class""" THERMAL_NAME_LIST = [] + PSU_THERMAL_NAME_LIST = [] SYSFS_PATH = "/sys/bus/i2c/devices" + CPU_SYSFS_PATH = "/sys/devices/platform" - def __init__(self, thermal_index=0): - self.THERMAL_NAME_LIST = [] - self.SYSFS_PATH = "/sys/bus/i2c/devices" + def __init__(self, thermal_index=0, is_psu=False, psu_index=0): self.index = thermal_index + self.is_psu = is_psu + self.psu_index = psu_index + self.min_temperature = None + self.max_temperature = None + + if self.is_psu: + psu_i2c_bus = PSU_I2C_MAPPING[psu_index]["num"] + psu_i2c_addr = PSU_I2C_MAPPING[psu_index]["addr"] + self.psu_hwmon_path = PSU_I2C_PATH.format(psu_i2c_bus, + psu_i2c_addr) + psu_i2c_bus = PSU_CPLD_I2C_MAPPING[psu_index]["num"] + psu_i2c_addr = PSU_CPLD_I2C_MAPPING[psu_index]["addr"] + self.cpld_path = PSU_I2C_PATH.format(psu_i2c_bus, psu_i2c_addr) # Add thermal name self.THERMAL_NAME_LIST.append("Temp sensor 1") self.THERMAL_NAME_LIST.append("Temp sensor 2") - self.THERMAL_NAME_LIST.append("Temp sensor 3") + self.THERMAL_NAME_LIST.append("Temp sensor 3") + self.THERMAL_NAME_LIST.append("Temp sensor 4") + self.PSU_THERMAL_NAME_LIST.append("PSU-1 temp sensor 1") + self.PSU_THERMAL_NAME_LIST.append("PSU-2 temp sensor 1") + + # Threshold Configuration + self.__conf = DeviceThreshold(self.get_name()) + # Default threshold. + self.__default_threshold = DEFAULT_THRESHOLD[self.get_name()] # Set hwmon path i2c_path = { - 0: "14-0048/hwmon/hwmon*/", - 1: "24-004b/hwmon/hwmon*/", - 2: "25-004a/hwmon/hwmon*/" + 0: "14-0048/hwmon/hwmon*/", + 1: "24-004b/hwmon/hwmon*/", + 2: "25-004a/hwmon/hwmon*/", + 3: "coretemp.0/hwmon/hwmon*/" }.get(self.index, None) - self.hwmon_path = "{}/{}".format(self.SYSFS_PATH, i2c_path) + self.is_cpu = False + if self.index == 3: + self.is_cpu = True + self.hwmon_path = "{}/{}".format(self.CPU_SYSFS_PATH, i2c_path) + else: + self.hwmon_path = "{}/{}".format(self.SYSFS_PATH, i2c_path) self.ss_key = self.THERMAL_NAME_LIST[self.index] self.ss_index = 1 def __read_txt_file(self, file_path): for filename in glob.glob(file_path): try: - with open(filename, 'r') as fd: - data =fd.readline().rstrip() - return data + with open(filename, 'r') as fd: + data =fd.readline().strip() + if len(data) > 0: + return data except IOError as e: pass return None def __get_temp(self, temp_file): - temp_file_path = os.path.join(self.hwmon_path, temp_file) + if not self.is_psu: + temp_file_path = os.path.join(self.hwmon_path, temp_file) + else: + temp_file_path = temp_file raw_temp = self.__read_txt_file(temp_file_path) if raw_temp is not None: return float(raw_temp)/1000 else: - return 0 + return 0 def __set_threshold(self, file_name, temperature): + if self.is_psu: + return True temp_file_path = os.path.join(self.hwmon_path, file_name) for filename in glob.glob(temp_file_path): try: @@ -79,41 +180,153 @@ def get_temperature(self): 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) + if not self.is_psu: + temp_file = "temp{}_input".format(self.ss_index) + else: + temp_file = self.psu_hwmon_path + "psu_temp1_input" - 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 - """ - temp_file = "temp{}_max".format(self.ss_index) - return self.__get_temp(temp_file) + current = self.__get_temp(temp_file) + + if self.min_temperature is None or \ + current < self.min_temperature: + self.min_temperature = current + + if self.max_temperature is None or \ + current > self.max_temperature: + self.max_temperature = current + + return current 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 - """ - temp_file = "temp{}_max".format(self.ss_index) - temperature = temperature *1000 - self.__set_threshold(temp_file, temperature) + try: + value = float(temperature) + except Exception: + return False + + # The new value can not be more than the default value. + default_value = self.__default_threshold[HIGH_THRESHOLD] + if default_value != NOT_AVAILABLE: + if value > float(default_value): + return False + + try: + self.__conf.set_high_threshold(str(value)) + except Exception: + return False + + return True + + def get_high_threshold(self): + value = self.__conf.get_high_threshold() + if value != NOT_AVAILABLE: + return float(value) + + default_value = self.__default_threshold[HIGH_THRESHOLD] + if default_value != NOT_AVAILABLE: + return float(default_value) + + raise NotImplementedError + + def set_low_threshold(self, temperature): + try: + value = float(temperature) + except Exception: + return False + + # The new value can not be less than the default value. + default_value = self.__default_threshold[LOW_THRESHOLD] + if default_value != NOT_AVAILABLE: + if value < float(default_value): + return False + + try: + self.__conf.set_low_threshold(str(value)) + except Exception: + return False + + return True + + def get_low_threshold(self): + value = self.__conf.get_low_threshold() + if value != NOT_AVAILABLE: + return float(value) + + default_value = self.__default_threshold[LOW_THRESHOLD] + if default_value != NOT_AVAILABLE: + return float(default_value) + + raise NotImplementedError + + def set_high_critical_threshold(self, temperature): + try: + value = float(temperature) + except Exception: + return False + + # The new value can not be more than the default value. + default_value = self.__default_threshold[HIGH_CRIT_THRESHOLD] + if default_value != NOT_AVAILABLE: + if value > float(default_value): + return False + + try: + self.__conf.set_high_critical_threshold(str(value)) + except Exception: + return False return True + def get_high_critical_threshold(self): + value = self.__conf.get_high_critical_threshold() + if value != NOT_AVAILABLE: + return float(value) + + default_value = self.__default_threshold[HIGH_CRIT_THRESHOLD] + if default_value != NOT_AVAILABLE: + return float(default_value) + + raise NotImplementedError + + def set_low_critical_threshold(self, temperature): + try: + value = float(temperature) + except Exception: + return False + + # The new value can not be less than the default value. + default_value = self.__default_threshold[LOW_CRIT_THRESHOLD] + if default_value != NOT_AVAILABLE: + if value < float(default_value): + return False + + try: + self.__conf.set_low_critical_threshold(str(value)) + except Exception: + return False + + return True + + def get_low_critical_threshold(self): + value = self.__conf.get_low_critical_threshold() + if value != NOT_AVAILABLE: + return float(value) + + default_value = self.__default_threshold[LOW_CRIT_THRESHOLD] + if default_value != NOT_AVAILABLE: + return float(default_value) + + raise NotImplementedError + 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] + if self.is_psu: + return self.PSU_THERMAL_NAME_LIST[self.psu_index] + else: + return self.THERMAL_NAME_LIST[self.index] def get_presence(self): """ @@ -121,6 +334,15 @@ def get_presence(self): Returns: bool: True if Thermal is present, False if not """ + if self.is_cpu: + return True + + if self.is_psu: + val = self.__read_txt_file(self.cpld_path + "psu_present") + if val is not None: + return int(val, 10) == 1 + else: + return False temp_file = "temp{}_input".format(self.ss_index) temp_file_path = os.path.join(self.hwmon_path, temp_file) raw_txt = self.__read_txt_file(temp_file_path) @@ -135,11 +357,78 @@ def get_status(self): Returns: A boolean value, True if device is operating properly, False if not """ + if self.is_cpu: + return True + + if self.is_psu: + temp_file = self.psu_hwmon_path + "psu_temp_fault" + psu_temp_fault = self.__read_txt_file(temp_file) + if psu_temp_fault is None: + psu_temp_fault = '1' + return self.get_presence() and (not int(psu_temp_fault)) file_str = "temp{}_input".format(self.ss_index) file_path = os.path.join(self.hwmon_path, file_str) raw_txt = self.__read_txt_file(file_path) if raw_txt is None: return False - else: + else: return int(raw_txt) != 0 + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + + return "N/A" + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return "N/A" + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.index+1 + + def is_replaceable(self): + """ + Retrieves whether thermal module is replaceable + Returns: + A boolean value, True if replaceable, False if not + """ + return False + + def get_minimum_recorded(self): + """ + Retrieves the minimum recorded temperature of thermal + Returns: + A float number, the minimum recorded temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.min_temperature is None: + self.get_temperature() + + return self.min_temperature + + def get_maximum_recorded(self): + """ + Retrieves the maximum recorded temperature of thermal + Returns: + A float number, the maximum recorded temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.max_temperature is None: + self.get_temperature() + + return self.max_temperature diff --git a/device/accton/x86_64-accton_as4630_54te-r0/system_health_monitoring_config.json b/device/accton/x86_64-accton_as4630_54te-r0/system_health_monitoring_config.json index 91a29558b4..97f9aa3053 100644 --- a/device/accton/x86_64-accton_as4630_54te-r0/system_health_monitoring_config.json +++ b/device/accton/x86_64-accton_as4630_54te-r0/system_health_monitoring_config.json @@ -1,9 +1,7 @@ { "services_to_ignore": [], "devices_to_ignore": [ - "asic", - "psu.temperature" - + "asic" ], "user_defined_checkers": [], "polling_interval": 60, diff --git a/device/accton/x86_64-accton_as5835_54x-r0/Accton-AS5835-54X/mv2-as5835-48x10G+6x100G.config.bcm b/device/accton/x86_64-accton_as5835_54x-r0/Accton-AS5835-54X/mv2-as5835-48x10G+6x100G.config.bcm index 30fc86989c..2683cd7e70 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/Accton-AS5835-54X/mv2-as5835-48x10G+6x100G.config.bcm +++ b/device/accton/x86_64-accton_as5835_54x-r0/Accton-AS5835-54X/mv2-as5835-48x10G+6x100G.config.bcm @@ -41,6 +41,16 @@ skip_L2_USER_ENTRY=0 bcm_tunnel_term_compatible_mode=1 l3_alpm_ipv6_128b_bkt_rsvd=1 +flow_init_mode=1 +riot_enable=1 +riot_overlay_l3_intf_mem_size=4096 +riot_overlay_l3_egress_mem_size=8192 +l3_ecmp_levels=2 +riot_overlay_ecmp_resilient_hash_size=16384 +use_all_splithorizon_groups=1 +host_as_route_disable=1 +sai_tunnel_support=1 + #FC0 dport_map_port_1=1 dport_map_port_2=2 diff --git a/device/accton/x86_64-accton_as5835_54x-r0/media_settings.json b/device/accton/x86_64-accton_as5835_54x-r0/media_settings.json new file mode 100644 index 0000000000..ef930baab8 --- /dev/null +++ b/device/accton/x86_64-accton_as5835_54x-r0/media_settings.json @@ -0,0 +1,400 @@ +{ + "PORT_MEDIA_SETTINGS": { + "1": { + "Default": { + "preemphasis": { + "lane0": "0x000b2f01" + } + } + }, + "2": { + "Default": { + "preemphasis": { + "lane0": "0x000b2f01" + } + } + }, + "3": { + "Default": { + "preemphasis": { + "lane0": "0x000b2f01" + } + } + }, + "4": { + "Default": { + "preemphasis": { + "lane0": "0x000b2f01" + } + } + }, + "5": { + "Default": { + "preemphasis": { + "lane0": "0x000b2f01" + } + } + }, + "6": { + "Default": { + "preemphasis": { + "lane0": "0x000b2f01" + } + } + }, + "7": { + "Default": { + "preemphasis": { + "lane0": "0x000b2f01" + } + } + }, + "8": { + "Default": { + "preemphasis": { + "lane0": "0x000a2e01" + } + } + }, + "9": { + "Default": { + "preemphasis": { + "lane0": "0x000a2e01" + } + } + }, + "10": { + "Default": { + "preemphasis": { + "lane0": "0x000a2e01" + } + } + }, + "11": { + "Default": { + "preemphasis": { + "lane0": "0x000a2d01" + } + } + }, + "12": { + "Default": { + "preemphasis": { + "lane0": "0x00092a01" + } + } + }, + "13": { + "Default": { + "preemphasis": { + "lane0": "0x00092a01" + } + } + }, + "14": { + "Default": { + "preemphasis": { + "lane0": "0x00092a01" + } + } + }, + "15": { + "Default": { + "preemphasis": { + "lane0": "0x00092a01" + } + } + }, + "16": { + "Default": { + "preemphasis": { + "lane0": "0x00082a01" + } + } + }, + "17": { + "Default": { + "preemphasis": { + "lane0": "0x00082a01" + } + } + }, + "18": { + "Default": { + "preemphasis": { + "lane0": "0x00082801" + } + } + }, + "19": { + "Default": { + "preemphasis": { + "lane0": "0x00082801" + } + } + }, + "20": { + "Default": { + "preemphasis": { + "lane0": "0x00062501" + } + } + }, + "21": { + "Default": { + "preemphasis": { + "lane0": "0x00062501" + } + } + }, + "22": { + "Default": { + "preemphasis": { + "lane0": "0x00062801" + } + } + }, + "23": { + "Default": { + "preemphasis": { + "lane0": "0x00062601" + } + } + }, + "24": { + "Default": { + "preemphasis": { + "lane0": "0x00062501" + } + } + }, + "25": { + "Default": { + "preemphasis": { + "lane0": "0x00062a01" + } + } + }, + "26": { + "Default": { + "preemphasis": { + "lane0": "0x00062801" + } + } + }, + "27": { + "Default": { + "preemphasis": { + "lane0": "0x00062901" + } + } + }, + "28": { + "Default": { + "preemphasis": { + "lane0": "0x00062901" + } + } + }, + "29": { + "Default": { + "preemphasis": { + "lane0": "0x00062801" + } + } + }, + "30": { + "Default": { + "preemphasis": { + "lane0": "0x00062901" + } + } + }, + "31": { + "Default": { + "preemphasis": { + "lane0": "0x00062b01" + } + } + }, + "32": { + "Default": { + "preemphasis": { + "lane0": "0x00062901" + } + } + }, + "33": { + "Default": { + "preemphasis": { + "lane0": "0x00062801" + } + } + }, + "34": { + "Default": { + "preemphasis": { + "lane0": "0x00062901" + } + } + }, + "35": { + "Default": { + "preemphasis": { + "lane0": "0x00062801" + } + } + }, + "36": { + "Default": { + "preemphasis": { + "lane0": "0x00062801" + } + } + }, + "37": { + "Default": { + "preemphasis": { + "lane0": "0x00062701" + } + } + }, + "38": { + "Default": { + "preemphasis": { + "lane0": "0x00062901" + } + } + }, + "39": { + "Default": { + "preemphasis": { + "lane0": "0x00062801" + } + } + }, + "40": { + "Default": { + "preemphasis": { + "lane0": "0x00062901" + } + } + }, + "41": { + "Default": { + "preemphasis": { + "lane0": "0x00062901" + } + } + }, + "42": { + "Default": { + "preemphasis": { + "lane0": "0x00062b01" + } + } + }, + "43": { + "Default": { + "preemphasis": { + "lane0": "0x00062b01" + } + } + }, + "44": { + "Default": { + "preemphasis": { + "lane0": "0x00062b01" + } + } + }, + "45": { + "Default": { + "preemphasis": { + "lane0": "0x00062b01" + } + } + }, + "46": { + "Default": { + "preemphasis": { + "lane0": "0x00072b01" + } + } + }, + "47": { + "Default": { + "preemphasis": { + "lane0": "0x00072b01" + } + } + }, + "48": { + "Default": { + "preemphasis": { + "lane0": "0x00072b01" + } + } + }, + "49": { + "Default": { + "preemphasis": { + "lane0": "0x00194605", + "lane1": "0x00194605", + "lane2": "0x00194605", + "lane3": "0x00194605" + } + } + }, + "50": { + "Default": { + "preemphasis": { + "lane0": "0x00194506", + "lane1": "0x00194506", + "lane2": "0x00194506", + "lane3": "0x00194506" + } + } + }, + "51": { + "Default": { + "preemphasis": { + "lane0": "0x00194506", + "lane1": "0x00194506", + "lane2": "0x00194506", + "lane3": "0x00194506" + } + } + }, + "52": { + "Default": { + "preemphasis": { + "lane0": "0x00194506", + "lane1": "0x00194506", + "lane2": "0x00194506", + "lane3": "0x00194506" + } + } + }, + "53": { + "Default": { + "preemphasis": { + "lane0": "0x00194506", + "lane1": "0x00194506", + "lane2": "0x00194506", + "lane3": "0x00194506" + } + } + }, + "54": { + "Default": { + "preemphasis": { + "lane0": "0x00194506", + "lane1": "0x00194506", + "lane2": "0x00194506", + "lane3": "0x00194506" + } + } + } + } +} \ No newline at end of file diff --git a/device/accton/x86_64-accton_as5835_54x-r0/pcie.yaml b/device/accton/x86_64-accton_as5835_54x-r0/pcie.yaml new file mode 100644 index 0000000000..f9e26c35ff --- /dev/null +++ b/device/accton/x86_64-accton_as5835_54x-r0/pcie.yaml @@ -0,0 +1,161 @@ +- bus: '00' + dev: '00' + fn: '0' + id: '1980' + name: 'Host bridge: Intel Corporation Atom Processor C3000 Series System Agent (rev + 11)' +- bus: '00' + dev: '04' + fn: '0' + id: 19a1 + name: 'Host bridge: Intel Corporation Atom Processor C3000 Series Error Registers + (rev 11)' +- bus: '00' + dev: '05' + fn: '0' + id: 19a2 + name: 'Generic system peripheral [0807]: Intel Corporation Atom Processor C3000 + Series Root Complex Event Collector (rev 11)' +- bus: '00' + dev: '06' + fn: '0' + id: 19a3 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series Integrated QAT + Root Port (rev 11)' +- bus: '00' + dev: 09 + fn: '0' + id: 19a4 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root + Port #0 (rev 11)' +- bus: '00' + dev: 0b + fn: '0' + id: 19a6 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root + Port #2 (rev 11)' +- bus: '00' + dev: 0e + fn: '0' + id: 19a8 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root + Port #4 (rev 11)' +- bus: '00' + dev: '10' + fn: '0' + id: 19aa + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root + Port #6 (rev 11)' +- bus: '00' + dev: '12' + fn: '0' + id: 19ac + name: 'System peripheral: Intel Corporation Atom Processor C3000 Series SMBus Contoller + - Host (rev 11)' +- bus: '00' + dev: '13' + fn: '0' + id: 19b2 + name: 'SATA controller: Intel Corporation Atom Processor C3000 Series SATA Controller + 0 (rev 11)' +- bus: '00' + dev: '15' + fn: '0' + id: 19d0 + name: 'USB controller: Intel Corporation Atom Processor C3000 Series USB 3.0 xHCI + Controller (rev 11)' +- bus: '00' + dev: '16' + fn: '0' + id: 19d1 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series Integrated LAN + Root Port #0 (rev 11)' +- bus: '00' + dev: '17' + fn: '0' + id: 19d2 + name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series Integrated LAN + Root Port #1 (rev 11)' +- bus: '00' + dev: '18' + fn: '0' + id: 19d3 + name: 'Communication controller: Intel Corporation Atom Processor C3000 Series ME + HECI 1 (rev 11)' +- bus: '00' + dev: 1a + fn: '0' + id: 19d8 + name: 'Serial controller: Intel Corporation Atom Processor C3000 Series HSUART Controller + (rev 11)' +- bus: '00' + dev: 1a + fn: '1' + id: 19d8 + name: 'Serial controller: Intel Corporation Atom Processor C3000 Series HSUART Controller + (rev 11)' +- bus: '00' + dev: 1a + fn: '2' + id: 19d8 + name: 'Serial controller: Intel Corporation Atom Processor C3000 Series HSUART Controller + (rev 11)' +- bus: '00' + dev: 1f + fn: '0' + id: 19dc + name: 'ISA bridge: Intel Corporation Atom Processor C3000 Series LPC or eSPI (rev + 11)' +- bus: '00' + dev: 1f + fn: '1' + id: 19dd + name: 'Memory controller: Intel Corporation Atom Processor C3000 Series Primary + to Side Band (P2SB) Bridge (rev 11)' +- bus: '00' + dev: 1f + fn: '2' + id: 19de + name: 'Memory controller: Intel Corporation Atom Processor C3000 Series Power Management + Controller (rev 11)' +- bus: '00' + dev: 1f + fn: '4' + id: 19df + name: 'SMBus: Intel Corporation Atom Processor C3000 Series SMBus controller (rev + 11)' +- bus: '00' + dev: 1f + fn: '5' + id: 19e0 + name: 'Serial bus controller [0c80]: Intel Corporation Atom Processor C3000 Series + SPI Controller (rev 11)' +- bus: '01' + dev: '00' + fn: '0' + id: 19e2 + name: 'Co-processor: Intel Corporation Atom Processor C3000 Series QuickAssist Technology + (rev 11)' +- bus: '02' + dev: '00' + fn: '0' + id: b771 + name: 'Ethernet controller: Broadcom Inc. and subsidiaries Device b771 (rev 01)' +- bus: '05' + dev: '00' + fn: '0' + id: '1533' + name: 'Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev + 03)' +- bus: '06' + dev: '00' + fn: '0' + id: 15c2 + name: 'Ethernet controller: Intel Corporation Ethernet Connection X553 Backplane + (rev 11)' +- bus: 08 + dev: '00' + fn: '0' + id: 15e5 + name: 'Ethernet controller: Intel Corporation Ethernet Connection X553 1GbE (rev + 11)' diff --git a/device/accton/x86_64-accton_as5835_54x-r0/pddf/pd-plugin.json b/device/accton/x86_64-accton_as5835_54x-r0/pddf/pd-plugin.json new file mode 100644 index 0000000000..93cfc75899 --- /dev/null +++ b/device/accton/x86_64-accton_as5835_54x-r0/pddf/pd-plugin.json @@ -0,0 +1,66 @@ +{ + + "XCVR": + { + "xcvr_present": + { + "i2c": + { + "valmap-SFP28": {"1":true, "0":false }, + "valmap-QSFP28": {"1":true, "0":false} + } + } + }, + "PSU": + { + "psu_present": + { + "i2c": + { + "valmap": { "1":true, "0":false } + } + }, + + "psu_power_good": + { + "i2c": + { + "valmap": { "1": true, "0":false } + } + }, + + "psu_fan_dir": + { + "i2c": + { + "valmap": { "F2B":"exhaust", "B2F":"intake" } + } + }, + + "PSU_FAN_MAX_SPEED":"18000" + }, + + "FAN": + { + "direction": + { + "i2c": + { + "valmap": {"1":"intake", "0":"exhaust"} + } + }, + + "present": + { + "i2c": + { + "valmap": {"1":true, "0":false} + } + }, + + "duty_cycle_to_pwm": "lambda dc: (dc/5)", + + "pwm_to_duty_cycle": "lambda pwm: (pwm*5)" + } + +} diff --git a/device/accton/x86_64-accton_as5835_54x-r0/pddf/pddf-device.json b/device/accton/x86_64-accton_as5835_54x-r0/pddf/pddf-device.json new file mode 100644 index 0000000000..973ac4c119 --- /dev/null +++ b/device/accton/x86_64-accton_as5835_54x-r0/pddf/pddf-device.json @@ -0,0 +1,2899 @@ +{ + "PLATFORM": + { + "num_psus":2, + "num_fantrays":5, + "num_fans_pertray":2, + "num_ports":54, + "num_temps": 9, + "pddf_dev_types": + { + "description":"AS5835-54X - Below is the list of supported PDDF device types (chip names) for various components. If any component uses some other driver, we will create the client using 'echo > /new_device' method", + "CPLD": + [ + "i2c_cpld" + ], + "PSU": + [ + "psu_eeprom", + "psu_pmbus" + ], + "FAN": + [ + "fan_ctrl", + "fan_eeprom" + ], + "PORT_MODULE": + [ + "pddf_xcvr" + ] + }, + "std_kos": + [ + "i2c-i801", + "i2c-ismt", + "i2c_dev", + "i2c_mux_pca954x", + "optoe" + ], + "pddf_kos": + [ + "pddf_client_module", + "pddf_cpld_module", + "pddf_cpld_driver", + "pddf_mux_module", + "pddf_xcvr_module", + "pddf_xcvr_driver_module", + "pddf_psu_driver_module", + "pddf_psu_module", + "pddf_fan_driver_module", + "pddf_fan_module", + "pddf_led_module", + "pddf_sysstatus_module" + ], + "custom_kos": + [ + "pddf_custom_psu" + ] + }, + + "SYSTEM": + { + "dev_info": {"device_type":"CPU", "device_name":"ROOT_COMPLEX", "device_parent":null}, + "i2c": + { + "CONTROLLERS": + [ + { "dev_name":"i2c-1", "dev":"SMBUS1" } + ] + } + }, + + "SMBUS1": + { + "dev_info": {"device_type": "SMBUS", "device_name": "SMBUS1", "device_parent": "SYSTEM"}, + "i2c": + { + "topo_info": {"dev_addr": "0x1"}, + "DEVICES": + [ + {"dev": "EEPROM1"}, + {"dev": "CPU_CPLD"}, + {"dev": "MUX1"} + ] + } + }, + + "EEPROM1": + { + "dev_info": {"device_type": "EEPROM", "device_name": "EEPROM1", "device_parent": "SMBUS1"}, + "i2c": + { + "topo_info": {"parent_bus": "0x1", "dev_addr": "0x57", "dev_type": "24c02"}, + "dev_attr": {"access_mode": "BLOCK"}, + "attr_list": [ + {"attr_name": "eeprom"} + ] + } + }, + + "CPU_CPLD": + { + "dev_info": { "device_type":"CPLD", "device_name":"CPU_CPLD", "device_parent":"SMBUS1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x1", "dev_addr":"0x65", "dev_type":"i2c_cpld"}, + "dev_attr": { } + } + }, + + "MUX1": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX1", "device_parent":"SMBUS1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x1", "dev_addr":"0x77", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0x2", "idle_state":"-2"}, + "channel": + [ + { "chn":"0", "dev":"MUX2" }, + { "chn":"0", "dev":"MUX3" }, + { "chn":"0", "dev":"MUX4" }, + { "chn":"1", "dev":"CPLD1" }, + { "chn":"1", "dev":"CPLD2" }, + { "chn":"1", "dev":"CPLD3" }, + { "chn":"1", "dev":"FAN-CTRL" }, + { "chn":"1", "dev":"MUX5" } + ] + } + }, + "MUX2": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX2", "device_parent":"MUX1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2", "dev_addr":"0x70", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0xa", "idle_state":"-2"}, + "channel": + [ + { "chn":"1", "dev":"PSU1" }, + { "chn":"2", "dev":"PSU2" } + ] + } + }, + + "PSU1": + { + "dev_info": { "device_type":"PSU", "device_name":"PSU1", "device_parent":"MUX2"}, + "dev_attr": { "dev_idx":"1", "num_psu_fans": "1"}, + "i2c": + { + "interface": + [ + { "itf":"pmbus", "dev":"PSU1-PMBUS" }, + { "itf":"eeprom", "dev":"PSU1-EEPROM" } + ] + } + }, + + "PSU1-PMBUS": + { + "dev_info": { "device_type":"PSU-PMBUS", "device_name":"PSU1-PMBUS", "device_parent":"MUX2", "virt_parent":"PSU1"}, + "i2c": + { + "topo_info":{ "parent_bus":"0xb", "dev_addr":"0x58", "dev_type":"psu_pmbus"}, + "attr_list": + [ + { "attr_name":"psu_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"psu_model_name", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, + { "attr_name":"psu_power_good", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x2", "attr_cmpval":"0x2", "attr_len":"1"}, + { "attr_name":"psu_mfr_id", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, + { "attr_name":"psu_fan_dir", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"}, + { "attr_name":"psu_v_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_v_out_min", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xa4", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_v_out_max", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xa5", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_i_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_p_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_p_out_max", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xa7", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_temp1_input", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} + ] + } + }, + + "PSU1-EEPROM": + { + "dev_info": { "device_type":"PSU-EEPROM", "device_name":"PSU1-EEPROM", "device_parent":"MUX2", "virt_parent":"PSU1"}, + "i2c": + { + "topo_info":{ "parent_bus":"0xb", "dev_addr":"0x50", "dev_type":"psu_eeprom"}, + "attr_list": + [ + { "attr_name":"psu_serial_num", "attr_devaddr":"0x50", "attr_devtype":"eeprom", "attr_offset":"0x35", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"19" } + ] + } + }, + + "PSU2": + { + "dev_info": { "device_type":"PSU", "device_name":"PSU2", "device_parent":"MUX2" }, + "dev_attr": { "dev_idx":"2", "num_psu_fans":"1"}, + "i2c": + { + "interface": + [ + { "itf":"pmbus", "dev":"PSU2-PMBUS"}, + { "itf":"eeprom", "dev":"PSU2-EEPROM" } + ] + } + }, + + "PSU2-PMBUS": + { + "dev_info": {"device_type":"PSU-PMBUS", "device_name":"PSU2-PMBUS", "device_parent":"MUX2", "virt_parent":"PSU2"}, + "i2c": + { + "topo_info": { "parent_bus":"0xc", "dev_addr":"0x5b", "dev_type":"psu_pmbus"}, + "attr_list": + [ + { "attr_name":"psu_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x10", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"psu_model_name", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, + { "attr_name":"psu_power_good", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x20", "attr_cmpval":"0x20", "attr_len":"1"}, + { "attr_name":"psu_mfr_id", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, + { "attr_name":"psu_fan_dir", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"}, + { "attr_name":"psu_v_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_v_out_min", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xa4", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_v_out_max", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xa5", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_i_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_p_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_p_out_max", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xa7", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_temp1_input", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} + ] + } + }, + + "PSU2-EEPROM": + { + "dev_info": { "device_type":"PSU-EEPROM", "device_name":"PSU2-EEPROM", "device_parent":"MUX2", "virt_parent":"PSU2"}, + "i2c": + { + "topo_info":{ "parent_bus":"0xc", "dev_addr":"0x53", "dev_type":"psu_eeprom"}, + "attr_list": + [ + { "attr_name":"psu_serial_num", "attr_devaddr":"0x53", "attr_devtype":"eeprom", "attr_offset":"0x35", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"19" } + ] + } + }, + "MUX3": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX3", "device_parent":"MUX1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2", "dev_addr":"0x72", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0x12", "idle_state":"-2"}, + "channel": + [ + { "chn":"0", "dev":"PORT51" }, + { "chn":"1", "dev":"PORT54" }, + { "chn":"2", "dev":"PORT49" }, + { "chn":"3", "dev":"PORT50" }, + { "chn":"4", "dev":"PORT52" }, + { "chn":"5", "dev":"PORT53" } + ] + } + }, + + "PORT51": + { + "dev_info": { "device_type":"QSFP28", "device_name":"PORT51", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"51"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT51-EEPROM" }, + { "itf":"control", "dev":"PORT51-CTRL" } + ] + } + }, + "PORT51-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT51-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT51"}, + "i2c": + { + "topo_info": { "parent_bus":"0x12", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT51-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT51-CTRL", "device_parent":"MUX3", "virt_parent":"PORT51"}, + "i2c": + { + "topo_info": { "parent_bus":"0x12", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x14", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3","attr_offset":"0x15", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3","attr_offset":"0x13", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_lpmode", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x16", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"} + ] + } + }, + + "PORT54": + { + "dev_info": { "device_type":"QSFP28", "device_name":"PORT54", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"54"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT54-EEPROM" }, + { "itf":"control", "dev":"PORT54-CTRL" } + ] + } + }, + "PORT54-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT54-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT54"}, + "i2c": + { + "topo_info": { "parent_bus":"0x13", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT54-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT54-CTRL", "device_parent":"MUX3", "virt_parent":"PORT54"}, + "i2c": + { + "topo_info": { "parent_bus":"0x13", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3","attr_offset":"0x14", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3","attr_offset":"0x15", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3","attr_offset":"0x13", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_lpmode", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x16", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"} + ] + } + }, + + "PORT49": + { + "dev_info": { "device_type":"QSFP28", "device_name":"PORT49", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"49"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT49-EEPROM" }, + { "itf":"control", "dev":"PORT49-CTRL" } + ] + } + }, + "PORT49-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT49-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT49"}, + "i2c": + { + "topo_info": { "parent_bus":"0x14", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT49-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT49-CTRL", "device_parent":"MUX3", "virt_parent":"PORT49"}, + "i2c": + { + "topo_info": { "parent_bus":"0x14", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x14", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x15", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x13", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_lpmode", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x16", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"} + ] + } + }, + + "PORT50": + { + "dev_info": { "device_type":"QSFP28", "device_name":"PORT50", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"50"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT50-EEPROM" }, + { "itf":"control", "dev":"PORT50-CTRL" } + ] + } + }, + "PORT50-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT50-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT50"}, + "i2c": + { + "topo_info": { "parent_bus":"0x15", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + + "PORT50-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT50-CTRL", "device_parent":"MUX3", "virt_parent":"PORT50"}, + "i2c": + { + "topo_info": { "parent_bus":"0x15", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x14", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x15", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x13", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_lpmode", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3","attr_offset":"0x16", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"} + ] + } + }, + + "PORT52": + { + "dev_info": { "device_type":"QSFP28", "device_name":"PORT52", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"52"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT52-EEPROM" }, + { "itf":"control", "dev":"PORT52-CTRL" } + ] + } + }, + "PORT52-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT52-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT52"}, + "i2c": + { + "topo_info": { "parent_bus":"0x16", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT52-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT52-CTRL", "device_parent":"MUX3", "virt_parent":"PORT52"}, + "i2c": + { + "topo_info": { "parent_bus":"0x16", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x14", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x15", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x62", "attr_devtype":"cpld","attr_devname":"CPLD3", "attr_offset":"0x13", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_lpmode", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x16", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"} + ] + } + }, + + "PORT53": + { + "dev_info": { "device_type":"QSFP28", "device_name":"PORT53", "device_parent":"MUX3"}, + "dev_attr": { "dev_idx":"53"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT53-EEPROM" }, + { "itf":"control", "dev":"PORT53-CTRL" } + ] + } + }, + "PORT53-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT53-EEPROM", "device_parent":"MUX3", "virt_parent":"PORT53"}, + "i2c": + { + "topo_info": { "parent_bus":"0x17", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT53-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT53-CTRL", "device_parent":"MUX3", "virt_parent":"PORT53"}, + "i2c": + { + "topo_info": { "parent_bus":"0x17", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3","attr_offset":"0x14", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_reset", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x15", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_intr_status", "attr_devaddr":"0x62", "attr_devtype":"cpld","attr_devname":"CPLD3", "attr_offset":"0x13", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_lpmode", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3","attr_offset":"0x16", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"} + ] + } + }, + + + "CPLD1": + { + "dev_info": { "device_type":"CPLD", "device_name":"CPLD1", "device_parent":"MUX1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3", "dev_addr":"0x60", "dev_type":"i2c_cpld"}, + "dev_attr":{} + } + }, + "CPLD2": + { + "dev_info": { "device_type":"CPLD", "device_name":"CPLD2", "device_parent":"MUX1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3", "dev_addr":"0x61", "dev_type":"i2c_cpld"}, + "dev_attr":{} + } + }, + "CPLD3": + { + "dev_info": { "device_type":"CPLD", "device_name":"CPLD3", "device_parent":"MUX1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3", "dev_addr":"0x62", "dev_type":"i2c_cpld"}, + "dev_attr":{} + } + }, + + "FAN-CTRL": + { + "dev_info": { "device_type":"FAN", "device_name":"FAN-CTRL", "device_parent":"MUX1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3", "dev_addr":"0x63", "dev_type":"fan_ctrl"}, + "dev_attr": { "num_fantrays":"5"}, + "attr_list": + [ + { "attr_name":"fan1_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x02", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan2_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x02", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan3_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x02", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan4_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x02", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan5_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x02", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan6_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x02", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan7_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x02", "attr_mask":"0x8", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan8_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x02", "attr_mask":"0x8", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan9_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x02", "attr_mask":"0x10", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan10_present", "attr_devtype":"FAN-CTRL", "attr_offset":"0x02","attr_mask":"0x10", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"fan1_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x03", "attr_mask":"0x1", "attr_cmpval":"0x1", "attr_len":"1"}, + { "attr_name":"fan2_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x03", "attr_mask":"0x1", "attr_cmpval":"0x1", "attr_len":"1"}, + { "attr_name":"fan3_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x03", "attr_mask":"0x2", "attr_cmpval":"0x2", "attr_len":"1"}, + { "attr_name":"fan4_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x03", "attr_mask":"0x2", "attr_cmpval":"0x2", "attr_len":"1"}, + { "attr_name":"fan5_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x03", "attr_mask":"0x4", "attr_cmpval":"0x4", "attr_len":"1"}, + { "attr_name":"fan6_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x03", "attr_mask":"0x4", "attr_cmpval":"0x4", "attr_len":"1"}, + { "attr_name":"fan7_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x03", "attr_mask":"0x8", "attr_cmpval":"0x8", "attr_len":"1"}, + { "attr_name":"fan8_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x03", "attr_mask":"0x8", "attr_cmpval":"0x8", "attr_len":"1"}, + { "attr_name":"fan9_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x03", "attr_mask":"0x10", "attr_cmpval":"0x10", "attr_len":"1"}, + { "attr_name":"fan10_direction", "attr_devtype":"FAN-CTRL", "attr_offset":"0x03", "attr_mask":"0x10", "attr_cmpval":"0x10", "attr_len":"1"}, + { "attr_name":"fan1_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x07", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"150", "attr_is_divisor":0}, + { "attr_name":"fan2_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0C", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"150", "attr_is_divisor":0}, + { "attr_name":"fan3_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x08", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"150", "attr_is_divisor":0}, + { "attr_name":"fan4_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0D", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"150", "attr_is_divisor":0}, + { "attr_name":"fan5_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x09", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"150", "attr_is_divisor":0}, + { "attr_name":"fan6_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0E", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"150", "attr_is_divisor":0}, + { "attr_name":"fan7_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0A", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"150" , "attr_is_divisor":0}, + { "attr_name":"fan8_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0F", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"150" , "attr_is_divisor":0}, + { "attr_name":"fan9_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x0B", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"150" , "attr_is_divisor":0}, + { "attr_name":"fan10_input", "attr_devtype":"FAN-CTRL", "attr_offset":"0x10", "attr_mask":"0xFF", "attr_len":"1", "attr_mult":"150" , "attr_is_divisor":0}, + { "attr_name":"fan1_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x06", "attr_mask":"0x1F", "attr_len":"1" }, + { "attr_name":"fan2_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x06", "attr_mask":"0x1F", "attr_len":"1" }, + { "attr_name":"fan3_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x06", "attr_mask":"0x1F", "attr_len":"1" }, + { "attr_name":"fan4_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x06", "attr_mask":"0x1F", "attr_len":"1" }, + { "attr_name":"fan5_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x06", "attr_mask":"0x1F", "attr_len":"1" }, + { "attr_name":"fan6_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x06", "attr_mask":"0x1F", "attr_len":"1" }, + { "attr_name":"fan7_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x06", "attr_mask":"0x1F", "attr_len":"1" }, + { "attr_name":"fan8_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x06", "attr_mask":"0x1F", "attr_len":"1" }, + { "attr_name":"fan9_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x06", "attr_mask":"0x1F", "attr_len":"1" }, + { "attr_name":"fan10_pwm", "attr_devtype":"FAN-CTRL", "attr_offset":"0x06", "attr_mask":"0x1F", "attr_len":"1" } + ] + } + }, + + "MUX4": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX4", "device_parent":"MUX1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2", "dev_addr":"0x71", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0x1a", "idle_state":"-2"}, + "channel": + [ + { "chn":"0", "dev":"TEMP1" }, + { "chn":"1", "dev":"TEMP2" }, + { "chn":"2", "dev":"TEMP3" }, + { "chn":"3", "dev":"TEMP4" } + ] + } + }, + + "TEMP1" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP1", "device_parent":"MUX4"}, + "dev_attr": { "display_name":"CB_temp(0x4B)"}, + "i2c": + { + "topo_info": { "parent_bus":"0x1a", "dev_addr":"0x4B", "dev_type":"lm75"}, + "attr_list": + [ + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, + { "attr_name": "temp1_max_hyst"}, + { "attr_name": "temp1_input"} + ] + } + }, + "TEMP2" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP2", "device_parent":"MUX4"}, + "dev_attr": { "display_name":"MB_FrontMiddle_temp(0x4C)"}, + "i2c": + { + "topo_info": { "parent_bus":"0x1b", "dev_addr":"0x4C", "dev_type":"lm75"}, + "attr_list": + [ + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, + { "attr_name": "temp1_max_hyst"}, + { "attr_name": "temp1_input"} + ] + } + }, + "TEMP3" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP3", "device_parent":"MUX4"}, + "dev_attr": { "display_name":"MB_RearLeft_temp(0x49)"}, + "i2c": + { + "topo_info": { "parent_bus":"0x1c", "dev_addr":"0x49", "dev_type":"lm75"}, + "attr_list": + [ + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, + { "attr_name": "temp1_max_hyst"}, + { "attr_name": "temp1_input"} + ] + } + }, + "TEMP4" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP4", "device_parent":"MUX4"}, + "dev_attr": { "display_name":"MB_RearLeft_temp(0x4A)"}, + "i2c": + { + "topo_info": { "parent_bus":"0x1d", "dev_addr":"0x4A", "dev_type":"lm75"}, + "attr_list": + [ + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, + { "attr_name": "temp1_max_hyst"}, + { "attr_name": "temp1_input"} + ] + } + }, + "TEMP5" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP5"}, + "dev_attr": { "display_name":"CPU_Package_temp"}, + "i2c": + { + "path_info": {"sysfs_base_path": "/sys/class/hwmon/hwmon1"}, + "attr_list": + [ + { "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp1_crit"}, + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, + { "attr_name": "temp1_input"} + ] + } + }, + "TEMP6" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP6"}, + "dev_attr": { "display_name":"CPU_Core_0_temp"}, + "i2c": + { + "path_info": {"sysfs_base_path": "/sys/class/hwmon/hwmon1"}, + "attr_list": + [ + { "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp4_crit"}, + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp4_max"}, + { "attr_name": "temp1_input", "drv_attr_name":"temp4_input"} + ] + } + }, + "TEMP7" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP7"}, + "dev_attr": { "display_name":"CPU_Core_1_temp"}, + "i2c": + { + "path_info": {"sysfs_base_path": "/sys/class/hwmon/hwmon1"}, + "attr_list": + [ + { "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp8_crit"}, + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp8_max"}, + { "attr_name": "temp1_input", "drv_attr_name":"temp8_input"} + ] + } + }, + "TEMP8" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP8"}, + "dev_attr": { "display_name":"CPU_Core_2_temp"}, + "i2c": + { + "path_info": {"sysfs_base_path": "/sys/class/hwmon/hwmon1"}, + "attr_list": + [ + { "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp10_crit"}, + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp10_max"}, + { "attr_name": "temp1_input", "drv_attr_name":"temp10_input"} + ] + } + }, + "TEMP9" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP9"}, + "dev_attr": { "display_name":"CPU_Core_3_temp"}, + "i2c": + { + "path_info": {"sysfs_base_path": "/sys/class/hwmon/hwmon1"}, + "attr_list": + [ + { "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp14_crit"}, + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp14_max"}, + { "attr_name": "temp1_input", "drv_attr_name":"temp14_input"} + ] + } + }, + "SYSSTATUS": + { + "dev_info":{ "device_type":"SYSSTAT", "device_name":"SYSSTATUS"}, + "dev_attr":{ }, + "attr_list": + [ + + { "attr_name":"board_info","attr_devaddr":"0x60", "attr_offset":"0x0","attr_mask":"0xff","attr_len":"0x1"}, + { "attr_name":"cpld1_version","attr_devaddr":"0x60","attr_offset":"0x1","attr_mask":"0xff","attr_len":"0x1"}, + { "attr_name":"cpld2_version","attr_devaddr":"0x61","attr_offset":"0x1","attr_mask":"0xff","attr_len":"0x1"}, + { "attr_name":"cpld3version","attr_devaddr":"0x62","attr_offset":"0x1","attr_mask":"0xff","attr_len":"0x1"}, + { "attr_name":"fan_cpld_version","attr_devaddr":"0x63","attr_offset":"0x1","attr_mask":"0xff","attr_len":"0x1"} + + ] + }, + + "MUX5": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX5", "device_parent":"MUX1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3", "dev_addr":"0x70", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0x22", "idle_state":"-2"}, + "channel": + [ + { "chn":"0", "dev":"MUX6" }, + { "chn":"1", "dev":"MUX7" }, + { "chn":"2", "dev":"MUX8" }, + { "chn":"3", "dev":"MUX9" }, + { "chn":"4", "dev":"MUX10" }, + { "chn":"5", "dev":"MUX11" } + ] + } + }, + "MUX6": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX6", "device_parent":"MUX5"}, + "i2c": + { + "topo_info": { "parent_bus":"0x22", "dev_addr":"0x71", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0x2a", "idle_state":"-2"}, + "channel": + [ + { "chn":"0", "dev":"PORT1" }, + { "chn":"1", "dev":"PORT2" }, + { "chn":"2", "dev":"PORT3" }, + { "chn":"3", "dev":"PORT4" }, + { "chn":"4", "dev":"PORT5" }, + { "chn":"5", "dev":"PORT6" }, + { "chn":"6", "dev":"PORT7" }, + { "chn":"7", "dev":"PORT8" } + ] + } + }, + "MUX7": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX7", "device_parent":"MUX5"}, + "i2c": + { + "topo_info": { "parent_bus":"0x23", "dev_addr":"0x72", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0x32", "idle_state":"-2"}, + "channel": + [ + { "chn":"0", "dev":"PORT9" }, + { "chn":"1", "dev":"PORT10" }, + { "chn":"2", "dev":"PORT11" }, + { "chn":"3", "dev":"PORT12" }, + { "chn":"4", "dev":"PORT13" }, + { "chn":"5", "dev":"PORT14" }, + { "chn":"6", "dev":"PORT15" }, + { "chn":"7", "dev":"PORT16" } + ] + } + }, + "MUX8": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX8", "device_parent":"MUX5"}, + "i2c": + { + "topo_info": { "parent_bus":"0x24", "dev_addr":"0x73", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0x3a", "idle_state":"-2"}, + "channel": + [ + { "chn":"0", "dev":"PORT17" }, + { "chn":"1", "dev":"PORT18" }, + { "chn":"2", "dev":"PORT19" }, + { "chn":"3", "dev":"PORT20" }, + { "chn":"4", "dev":"PORT21" }, + { "chn":"5", "dev":"PORT22" }, + { "chn":"6", "dev":"PORT23" }, + { "chn":"7", "dev":"PORT24" } + ] + } + }, + "MUX9": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX9", "device_parent":"MUX5"}, + "i2c": + { + "topo_info": { "parent_bus":"0x25", "dev_addr":"0x74", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0x42", "idle_state":"-2"}, + "channel": + [ + { "chn":"0", "dev":"PORT25" }, + { "chn":"1", "dev":"PORT26" }, + { "chn":"2", "dev":"PORT27" }, + { "chn":"3", "dev":"PORT28" }, + { "chn":"4", "dev":"PORT29" }, + { "chn":"5", "dev":"PORT30" }, + { "chn":"6", "dev":"PORT31" }, + { "chn":"7", "dev":"PORT32" } + ] + } + }, + "MUX10": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX10", "device_parent":"MUX5"}, + "i2c": + { + "topo_info": { "parent_bus":"0x26", "dev_addr":"0x75", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0x4a", "idle_state":"-2"}, + "channel": + [ + { "chn":"0", "dev":"PORT33" }, + { "chn":"1", "dev":"PORT34" }, + { "chn":"2", "dev":"PORT35" }, + { "chn":"3", "dev":"PORT36" }, + { "chn":"4", "dev":"PORT37" }, + { "chn":"5", "dev":"PORT38" }, + { "chn":"6", "dev":"PORT39" }, + { "chn":"7", "dev":"PORT40" } + ] + } + }, + "MUX11": + { + "dev_info": { "device_type":"MUX", "device_name":"MUX11", "device_parent":"MUX5"}, + "i2c": + { + "topo_info": { "parent_bus":"0x27", "dev_addr":"0x76", "dev_type":"pca9548"}, + "dev_attr": { "virt_bus":"0x52", "idle_state":"-2"}, + "channel": + [ + { "chn":"0", "dev":"PORT41" }, + { "chn":"1", "dev":"PORT42" }, + { "chn":"2", "dev":"PORT43" }, + { "chn":"3", "dev":"PORT44" }, + { "chn":"4", "dev":"PORT45" }, + { "chn":"5", "dev":"PORT46" }, + { "chn":"6", "dev":"PORT47" }, + { "chn":"7", "dev":"PORT48" } + ] + } + }, + + "PORT1": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT1", "device_parent":"MUX6"}, + "dev_attr": { "dev_idx":"1"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT1-EEPROM" }, + { "itf":"control", "dev":"PORT1-CTRL" } + ] + } + }, + "PORT1-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT1-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2a", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT1-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT1-CTRL", "device_parent":"MUX6", "virt_parent":"PORT1"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2a", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x8", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0D", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x12", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x17", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"} + ] + } + }, + + "PORT2": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT2", "device_parent":"MUX6"}, + "dev_attr": { "dev_idx":"2"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT2-EEPROM" }, + { "itf":"control", "dev":"PORT2-CTRL" } + ] + } + }, + "PORT2-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT2-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT2"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2b", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT2-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT2-CTRL", "device_parent":"MUX6", "virt_parent":"PORT2"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2b", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x8", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0D", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x12", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x17", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"} + ] + } + }, + + "PORT3": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT3", "device_parent":"MUX6"}, + "dev_attr": { "dev_idx":"3"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT3-EEPROM" }, + { "itf":"control", "dev":"PORT3-CTRL" } + ] + } + }, + "PORT3-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT3-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT3"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2c", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT3-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT3-CTRL", "device_parent":"MUX6", "virt_parent":"PORT3"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2c", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x8", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0D", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x12", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x17", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"} + ] + } + }, + + "PORT4": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT4", "device_parent":"MUX6"}, + "dev_attr": { "dev_idx":"4"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT4-EEPROM" }, + { "itf":"control", "dev":"PORT4-CTRL" } + ] + } + }, + "PORT4-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT4-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT4"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2d", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT4-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT4-CTRL", "device_parent":"MUX6", "virt_parent":"PORT4"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2d", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x8", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0D", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x12", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x17", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"} + ] + } + }, + + "PORT5": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT5", "device_parent":"MUX6"}, + "dev_attr": { "dev_idx":"5"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT5-EEPROM" }, + { "itf":"control", "dev":"PORT5-CTRL" } + ] + } + }, + "PORT5-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT5-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT5"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2e", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT5-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT5-CTRL", "device_parent":"MUX6", "virt_parent":"PORT5"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2e", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x8", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0D", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x12", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x17", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"} + ] + } + }, + + "PORT6": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT6", "device_parent":"MUX6"}, + "dev_attr": { "dev_idx":"6"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT6-EEPROM" }, + { "itf":"control", "dev":"PORT6-CTRL" } + ] + } + }, + "PORT6-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT6-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT6"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2f", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT6-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT6-CTRL", "device_parent":"MUX6", "virt_parent":"PORT6"}, + "i2c": + { + "topo_info": { "parent_bus":"0x2f", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x8", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0D", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x12", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x17", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"} + ] + } + }, + + "PORT7": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT7", "device_parent":"MUX6"}, + "dev_attr": { "dev_idx":"7"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT7-EEPROM" }, + { "itf":"control", "dev":"PORT7-CTRL" } + ] + } + }, + "PORT7-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT7-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT7"}, + "i2c": + { + "topo_info": { "parent_bus":"0x30", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT7-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT7-CTRL", "device_parent":"MUX6", "virt_parent":"PORT7"}, + "i2c": + { + "topo_info": { "parent_bus":"0x30", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x8", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0D", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x12", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x17", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"} + ] + } + }, + + "PORT8": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT8", "device_parent":"MUX6"}, + "dev_attr": { "dev_idx":"8"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT8-EEPROM" }, + { "itf":"control", "dev":"PORT8-CTRL" } + ] + } + }, + "PORT8-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT8-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT8"}, + "i2c": + { + "topo_info": { "parent_bus":"0x31", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT8-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT8-CTRL", "device_parent":"MUX6", "virt_parent":"PORT8"}, + "i2c": + { + "topo_info": { "parent_bus":"0x31", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x8", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0D", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x12", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x17", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"} + ] + } + }, + + "PORT9": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT9", "device_parent":"MUX7"}, + "dev_attr": { "dev_idx":"9"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT9-EEPROM" }, + { "itf":"control", "dev":"PORT9-CTRL" } + ] + } + }, + "PORT9-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT9-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT9"}, + "i2c": + { + "topo_info": { "parent_bus":"0x32", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT9-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT9-CTRL", "device_parent":"MUX7", "virt_parent":"PORT9"}, + "i2c": + { + "topo_info": { "parent_bus":"0x32", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x09", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0E", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x13", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x18", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"} + ] + } + }, + + "PORT10": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT10", "device_parent":"MUX7"}, + "dev_attr": { "dev_idx":"10"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT10-EEPROM" }, + { "itf":"control", "dev":"PORT10-CTRL" } + ] + } + }, + "PORT10-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT10-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT10"}, + "i2c": + { + "topo_info": { "parent_bus":"0x33", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT10-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT10-CTRL", "device_parent":"MUX7", "virt_parent":"PORT10"}, + "i2c": + { + "topo_info": { "parent_bus":"0x33", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x09", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0E", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x13", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x18", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"} + ] + } + }, + + "PORT11": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT11", "device_parent":"MUX7"}, + "dev_attr": { "dev_idx":"11"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT11-EEPROM" }, + { "itf":"control", "dev":"PORT11-CTRL" } + ] + } + }, + "PORT11-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT11-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT11"}, + "i2c": + { + "topo_info": { "parent_bus":"0x34", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT11-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT11-CTRL", "device_parent":"MUX7", "virt_parent":"PORT11"}, + "i2c": + { + "topo_info": { "parent_bus":"0x34", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x09", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0E", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x13", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x18", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"} + ] + } + }, + + "PORT12": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT12", "device_parent":"MUX7"}, + "dev_attr": { "dev_idx":"12"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT12-EEPROM" }, + { "itf":"control", "dev":"PORT12-CTRL" } + ] + } + }, + "PORT12-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT12-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT12"}, + "i2c": + { + "topo_info": { "parent_bus":"0x35", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT12-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT12-CTRL", "device_parent":"MUX7", "virt_parent":"PORT12"}, + "i2c": + { + "topo_info": { "parent_bus":"0x35", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x09", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0E", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x13", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x18", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"} + ] + } + }, + + "PORT13": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT13", "device_parent":"MUX7"}, + "dev_attr": { "dev_idx":"13"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT13-EEPROM" }, + { "itf":"control", "dev":"PORT13-CTRL" } + ] + } + }, + "PORT13-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT13-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT13"}, + "i2c": + { + "topo_info": { "parent_bus":"0x36", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT13-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT13-CTRL", "device_parent":"MUX7", "virt_parent":"PORT13"}, + "i2c": + { + "topo_info": { "parent_bus":"0x36", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x09", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0E", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x13", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x18", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"} + ] + } + }, + + "PORT14": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT14", "device_parent":"MUX7"}, + "dev_attr": { "dev_idx":"14"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT14-EEPROM" }, + { "itf":"control", "dev":"PORT14-CTRL" } + ] + } + }, + "PORT14-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT14-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT14"}, + "i2c": + { + "topo_info": { "parent_bus":"0x37", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT14-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT14-CTRL", "device_parent":"MUX7", "virt_parent":"PORT14"}, + "i2c": + { + "topo_info": { "parent_bus":"0x37", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x09", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0E", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x13", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x18", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"} + ] + } + }, + + "PORT15": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT15", "device_parent":"MUX7"}, + "dev_attr": { "dev_idx":"15"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT15-EEPROM" }, + { "itf":"control", "dev":"PORT15-CTRL" } + ] + } + }, + "PORT15-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT15-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT15"}, + "i2c": + { + "topo_info": { "parent_bus":"0x38", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT15-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT15-CTRL", "device_parent":"MUX7", "virt_parent":"PORT15"}, + "i2c": + { + "topo_info": { "parent_bus":"0x38", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x09", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0E", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x13", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x18", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"} + ] + } + }, + + "PORT16": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT16", "device_parent":"MUX7"}, + "dev_attr": { "dev_idx":"16"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT16-EEPROM" }, + { "itf":"control", "dev":"PORT16-CTRL" } + ] + } + }, + "PORT16-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT16-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT16"}, + "i2c": + { + "topo_info": { "parent_bus":"0x39", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT16-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT16-CTRL", "device_parent":"MUX7", "virt_parent":"PORT16"}, + "i2c": + { + "topo_info": { "parent_bus":"0x39", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x09", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0E", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x13", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x18", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"} + ] + } + }, + + "PORT17": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT17", "device_parent":"MUX8"}, + "dev_attr": { "dev_idx":"17"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT17-EEPROM" }, + { "itf":"control", "dev":"PORT17-CTRL" } + ] + } + }, + "PORT17-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT17-EEPROM", "device_parent":"MUX8", "virt_parent":"PORT17"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3a", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT17-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT17-CTRL", "device_parent":"MUX8", "virt_parent":"PORT17"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3a", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0A", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0F", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x14", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x19", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"} + ] + } + }, + + "PORT18": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT18", "device_parent":"MUX8"}, + "dev_attr": { "dev_idx":"18"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT18-EEPROM" }, + { "itf":"control", "dev":"PORT18-CTRL" } + ] + } + }, + "PORT18-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT18-EEPROM", "device_parent":"MUX8", "virt_parent":"PORT18"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3b", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT18-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT18-CTRL", "device_parent":"MUX8", "virt_parent":"PORT18"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3b", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0A", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0F", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x14", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x19", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"} + ] + } + }, + + "PORT19": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT19", "device_parent":"MUX8"}, + "dev_attr": { "dev_idx":"19"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT19-EEPROM" }, + { "itf":"control", "dev":"PORT19-CTRL" } + ] + } + }, + "PORT19-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT19-EEPROM", "device_parent":"MUX8", "virt_parent":"PORT19"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3c", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT19-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT19-CTRL", "device_parent":"MUX8", "virt_parent":"PORT19"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3c", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0A", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0F", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x14", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x19", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"} + ] + } + }, + + "PORT20": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT20", "device_parent":"MUX8"}, + "dev_attr": { "dev_idx":"20"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT20-EEPROM" }, + { "itf":"control", "dev":"PORT20-CTRL" } + ] + } + }, + "PORT20-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT20-EEPROM", "device_parent":"MUX8", "virt_parent":"PORT20"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3d", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT20-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT20-CTRL", "device_parent":"MUX8", "virt_parent":"PORT20"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3d", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0A", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0F", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x14", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x19", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"} + ] + } + }, + + "PORT21": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT21", "device_parent":"MUX8"}, + "dev_attr": { "dev_idx":"21"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT21-EEPROM" }, + { "itf":"control", "dev":"PORT21-CTRL" } + ] + } + }, + "PORT21-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT21-EEPROM", "device_parent":"MUX8", "virt_parent":"PORT21"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3e", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT21-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT21-CTRL", "device_parent":"MUX8", "virt_parent":"PORT21"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3e", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0A", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0F", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x14", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x19", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"} + ] + } + }, + + "PORT22": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT22", "device_parent":"MUX8"}, + "dev_attr": { "dev_idx":"22"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT22-EEPROM" }, + { "itf":"control", "dev":"PORT22-CTRL" } + ] + } + }, + "PORT22-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT22-EEPROM", "device_parent":"MUX8", "virt_parent":"PORT22"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3f", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT22-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT22-CTRL", "device_parent":"MUX8", "virt_parent":"PORT22"}, + "i2c": + { + "topo_info": { "parent_bus":"0x3f", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0A", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0F", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x14", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x19", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"} + ] + } + }, + + "PORT23": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT23", "device_parent":"MUX8"}, + "dev_attr": { "dev_idx":"23"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT23-EEPROM" }, + { "itf":"control", "dev":"PORT23-CTRL" } + ] + } + }, + "PORT23-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT23-EEPROM", "device_parent":"MUX8", "virt_parent":"PORT23"}, + "i2c": + { + "topo_info": { "parent_bus":"0x40", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT23-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT23-CTRL", "device_parent":"MUX8", "virt_parent":"PORT23"}, + "i2c": + { + "topo_info": { "parent_bus":"0x40", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0A", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0F", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x14", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x19", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"} + ] + } + }, + + "PORT24": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT24", "device_parent":"MUX8"}, + "dev_attr": { "dev_idx":"24"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT24-EEPROM" }, + { "itf":"control", "dev":"PORT24-CTRL" } + ] + } + }, + "PORT24-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT24-EEPROM", "device_parent":"MUX8", "virt_parent":"PORT24"}, + "i2c": + { + "topo_info": { "parent_bus":"0x41", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT24-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT24-CTRL", "device_parent":"MUX8", "virt_parent":"PORT24"}, + "i2c": + { + "topo_info": { "parent_bus":"0x41", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0A", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0F", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x14", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x19", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"} + ] + } + }, + + "PORT25": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT25", "device_parent":"MUX9"}, + "dev_attr": { "dev_idx":"25"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT25-EEPROM" }, + { "itf":"control", "dev":"PORT25-CTRL" } + ] + } + }, + "PORT25-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT25-EEPROM", "device_parent":"MUX9", "virt_parent":"PORT25"}, + "i2c": + { + "topo_info": { "parent_bus":"0x42", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT25-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT25-CTRL", "device_parent":"MUX9", "virt_parent":"PORT25"}, + "i2c": + { + "topo_info": { "parent_bus":"0x42", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x0B", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x10", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x15", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x1A", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"} + ] + } + }, + + "PORT26": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT26", "device_parent":"MUX9"}, + "dev_attr": { "dev_idx":"26"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT26-EEPROM" }, + { "itf":"control", "dev":"PORT26-CTRL" } + ] + } + }, + "PORT26-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT26-EEPROM", "device_parent":"MUX9", "virt_parent":"PORT26"}, + "i2c": + { + "topo_info": { "parent_bus":"0x43", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT26-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT26-CTRL", "device_parent":"MUX9", "virt_parent":"PORT26"}, + "i2c": + { + "topo_info": { "parent_bus":"0x43", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x0B", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x10", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x15", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x1A", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"} + ] + } + }, + + "PORT27": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT27", "device_parent":"MUX9"}, + "dev_attr": { "dev_idx":"27"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT27-EEPROM" }, + { "itf":"control", "dev":"PORT27-CTRL" } + ] + } + }, + "PORT27-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT27-EEPROM", "device_parent":"MUX9", "virt_parent":"PORT27"}, + "i2c": + { + "topo_info": { "parent_bus":"0x44", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT27-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT27-CTRL", "device_parent":"MUX9", "virt_parent":"PORT27"}, + "i2c": + { + "topo_info": { "parent_bus":"0x44", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x0B", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x10", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld","attr_devname":"CPLD2", "attr_offset":"0x15", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x1A", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"} + ] + } + }, + + "PORT28": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT28", "device_parent":"MUX9"}, + "dev_attr": { "dev_idx":"28"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT28-EEPROM" }, + { "itf":"control", "dev":"PORT28-CTRL" } + ] + } + }, + "PORT28-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT28-EEPROM", "device_parent":"MUX9", "virt_parent":"PORT28"}, + "i2c": + { + "topo_info": { "parent_bus":"0x45", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT28-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT28-CTRL", "device_parent":"MUX9", "virt_parent":"PORT28"}, + "i2c": + { + "topo_info": { "parent_bus":"0x45", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x0B", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x10", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x15", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x1A", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"} + ] + } + }, + + "PORT29": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT29", "device_parent":"MUX9"}, + "dev_attr": { "dev_idx":"29"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT29-EEPROM" }, + { "itf":"control", "dev":"PORT29-CTRL" } + ] + } + }, + "PORT29-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT29-EEPROM", "device_parent":"MUX9", "virt_parent":"PORT29"}, + "i2c": + { + "topo_info": { "parent_bus":"0x46", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT29-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT29-CTRL", "device_parent":"MUX9", "virt_parent":"PORT29"}, + "i2c": + { + "topo_info": { "parent_bus":"0x46", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x0B", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x10", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x15", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x1A", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"} + ] + } + }, + + "PORT30": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT30", "device_parent":"MUX9"}, + "dev_attr": { "dev_idx":"30"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT30-EEPROM" }, + { "itf":"control", "dev":"PORT30-CTRL" } + ] + } + }, + "PORT30-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT30-EEPROM", "device_parent":"MUX9", "virt_parent":"PORT30"}, + "i2c": + { + "topo_info": { "parent_bus":"0x47", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT30-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT30-CTRL", "device_parent":"MUX9", "virt_parent":"PORT30"}, + "i2c": + { + "topo_info": { "parent_bus":"0x47", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0B", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x10", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld","attr_devname":"CPLD2", "attr_offset":"0x15", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x1A", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"} + ] + } + }, + + "PORT31": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT31", "device_parent":"MUX9"}, + "dev_attr": { "dev_idx":"31"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT31-EEPROM" }, + { "itf":"control", "dev":"PORT31-CTRL" } + ] + } + }, + "PORT31-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT31-EEPROM", "device_parent":"MUX9", "virt_parent":"PORT31"}, + "i2c": + { + "topo_info": { "parent_bus":"0x48", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT31-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT31-CTRL", "device_parent":"MUX9", "virt_parent":"PORT31"}, + "i2c": + { + "topo_info": { "parent_bus":"0x48", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x0B", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x10", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x15", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2","attr_offset":"0x1A", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"} + ] + } + }, + + "PORT32": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT32", "device_parent":"MUX9"}, + "dev_attr": { "dev_idx":"32"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT32-EEPROM" }, + { "itf":"control", "dev":"PORT32-CTRL" } + ] + } + }, + "PORT32-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT32-EEPROM", "device_parent":"MUX9", "virt_parent":"PORT32"}, + "i2c": + { + "topo_info": { "parent_bus":"0x49", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT32-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT32-CTRL", "device_parent":"MUX9", "virt_parent":"PORT32"}, + "i2c": + { + "topo_info": { "parent_bus":"0x49", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0B", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x10", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld","attr_devname":"CPLD2", "attr_offset":"0x15", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x1A", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"} + ] + } + }, + + "PORT33": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT33", "device_parent":"MUX10"}, + "dev_attr": { "dev_idx":"33"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT33-EEPROM" }, + { "itf":"control", "dev":"PORT33-CTRL" } + ] + } + }, + "PORT33-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT33-EEPROM", "device_parent":"MUX10", "virt_parent":"PORT33"}, + "i2c": + { + "topo_info": { "parent_bus":"0x4a", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT33-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT33-CTRL", "device_parent":"MUX10", "virt_parent":"PORT33"}, + "i2c": + { + "topo_info": { "parent_bus":"0x4a", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0C", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x11", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x16", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x1B", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"} + ] + } + }, + + "PORT34": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT34", "device_parent":"MUX10"}, + "dev_attr": { "dev_idx":"34"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT34-EEPROM" }, + { "itf":"control", "dev":"PORT34-CTRL" } + ] + } + }, + "PORT34-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT34-EEPROM", "device_parent":"MUX10", "virt_parent":"PORT34"}, + "i2c": + { + "topo_info": { "parent_bus":"0x4b", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT34-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT34-CTRL", "device_parent":"MUX10", "virt_parent":"PORT34"}, + "i2c": + { + "topo_info": { "parent_bus":"0x4b", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0C", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x11", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x16", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x1B", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"} + ] + } + }, + + "PORT35": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT35", "device_parent":"MUX10"}, + "dev_attr": { "dev_idx":"35"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT35-EEPROM" }, + { "itf":"control", "dev":"PORT35-CTRL" } + ] + } + }, + "PORT35-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT35-EEPROM", "device_parent":"MUX10", "virt_parent":"PORT35"}, + "i2c": + { + "topo_info": { "parent_bus":"0x4c", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT35-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT35-CTRL", "device_parent":"MUX10", "virt_parent":"PORT35"}, + "i2c": + { + "topo_info": { "parent_bus":"0x4c", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0C", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x11", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x16", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x1B", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"} + ] + } + }, + + "PORT36": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT36", "device_parent":"MUX10"}, + "dev_attr": { "dev_idx":"36"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT36-EEPROM" }, + { "itf":"control", "dev":"PORT36-CTRL" } + ] + } + }, + "PORT36-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT36-EEPROM", "device_parent":"MUX10", "virt_parent":"PORT36"}, + "i2c": + { + "topo_info": { "parent_bus":"0x4d", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT36-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT36-CTRL", "device_parent":"MUX10", "virt_parent":"PORT36"}, + "i2c": + { + "topo_info": { "parent_bus":"0x4d", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0C", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x11", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x16", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x1B", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"} + ] + } + }, + + "PORT37": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT37", "device_parent":"MUX10"}, + "dev_attr": { "dev_idx":"37"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT37-EEPROM" }, + { "itf":"control", "dev":"PORT37-CTRL" } + ] + } + }, + "PORT37-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT37-EEPROM", "device_parent":"MUX10", "virt_parent":"PORT37"}, + "i2c": + { + "topo_info": { "parent_bus":"0x4e", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT37-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT37-CTRL", "device_parent":"MUX10", "virt_parent":"PORT37"}, + "i2c": + { + "topo_info": { "parent_bus":"0x4e", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0C", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x11", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x16", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x1B", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"} + ] + } + }, + + "PORT38": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT38", "device_parent":"MUX10"}, + "dev_attr": { "dev_idx":"38"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT38-EEPROM" }, + { "itf":"control", "dev":"PORT38-CTRL" } + ] + } + }, + "PORT38-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT38-EEPROM", "device_parent":"MUX10", "virt_parent":"PORT38"}, + "i2c": + { + "topo_info": { "parent_bus":"0x4f", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT38-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT38-CTRL", "device_parent":"MUX10", "virt_parent":"PORT38"}, + "i2c": + { + "topo_info": { "parent_bus":"0x4f", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x0C", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x11", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x16", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x61", "attr_devtype":"cpld", "attr_devname":"CPLD2", "attr_offset":"0x1B", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"} + ] + } + }, + + "PORT39": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT39", "device_parent":"MUX10"}, + "dev_attr": { "dev_idx":"39"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT39-EEPROM" }, + { "itf":"control", "dev":"PORT39-CTRL" } + ] + } + }, + "PORT39-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT39-EEPROM", "device_parent":"MUX10", "virt_parent":"PORT39"}, + "i2c": + { + "topo_info": { "parent_bus":"0x50", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT39-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT39-CTRL", "device_parent":"MUX10", "virt_parent":"PORT39"}, + "i2c": + { + "topo_info": { "parent_bus":"0x50", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x06", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x09", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x0C", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x0F", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"} + ] + } + }, + + "PORT40": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT40", "device_parent":"MUX10"}, + "dev_attr": { "dev_idx":"40"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT40-EEPROM" }, + { "itf":"control", "dev":"PORT40-CTRL" } + ] + } + }, + "PORT40-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT40-EEPROM", "device_parent":"MUX10", "virt_parent":"PORT40"}, + "i2c": + { + "topo_info": { "parent_bus":"0x51", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT40-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT40-CTRL", "device_parent":"MUX10", "virt_parent":"PORT40"}, + "i2c": + { + "topo_info": { "parent_bus":"0x51", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x06", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x09", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x0C", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x0F", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"} + ] + } + }, + + "PORT41": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT41", "device_parent":"MUX11"}, + "dev_attr": { "dev_idx":"41"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT41-EEPROM" }, + { "itf":"control", "dev":"PORT41-CTRL" } + ] + } + }, + "PORT41-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT41-EEPROM", "device_parent":"MUX11", "virt_parent":"PORT41"}, + "i2c": + { + "topo_info": { "parent_bus":"0x52", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT41-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT41-CTRL", "device_parent":"MUX11", "virt_parent":"PORT41"}, + "i2c": + { + "topo_info": { "parent_bus":"0x52", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x06", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x09", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x0C", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x0F", "attr_mask":"0x2", "attr_cmpval":"0x4", "attr_len":"1"} + ] + } + }, + + "PORT42": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT42", "device_parent":"MUX11"}, + "dev_attr": { "dev_idx":"42"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT42-EEPROM" }, + { "itf":"control", "dev":"PORT42-CTRL" } + ] + } + }, + "PORT42-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT42-EEPROM", "device_parent":"MUX11", "virt_parent":"PORT42"}, + "i2c": + { + "topo_info": { "parent_bus":"0x53", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT42-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT42-CTRL", "device_parent":"MUX11", "virt_parent":"PORT42"}, + "i2c": + { + "topo_info": { "parent_bus":"0x53", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x06", "attr_mask":"0x3", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x09", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x0C", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x0F", "attr_mask":"0x3", "attr_cmpval":"0x8", "attr_len":"1"} + ] + } + }, + + "PORT43": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT43", "device_parent":"MUX11"}, + "dev_attr": { "dev_idx":"43"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT43-EEPROM" }, + { "itf":"control", "dev":"PORT43-CTRL" } + ] + } + }, + "PORT43-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT43-EEPROM", "device_parent":"MUX11", "virt_parent":"PORT43"}, + "i2c": + { + "topo_info": { "parent_bus":"0x54", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT43-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT43-CTRL", "device_parent":"MUX11", "virt_parent":"PORT43"}, + "i2c": + { + "topo_info": { "parent_bus":"0x54", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3","attr_offset":"0x06", "attr_mask":"0x4", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3","attr_offset":"0x09", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3","attr_offset":"0x0C", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3","attr_offset":"0x0F", "attr_mask":"0x4", "attr_cmpval":"0x10", "attr_len":"1"} + ] + } + }, + + "PORT44": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT44", "device_parent":"MUX11"}, + "dev_attr": { "dev_idx":"44"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT44-EEPROM" }, + { "itf":"control", "dev":"PORT44-CTRL" } + ] + } + }, + "PORT44-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT44-EEPROM", "device_parent":"MUX11", "virt_parent":"PORT44"}, + "i2c": + { + "topo_info": { "parent_bus":"0x55", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT44-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT44-CTRL", "device_parent":"MUX11", "virt_parent":"PORT44"}, + "i2c": + { + "topo_info": { "parent_bus":"0x55", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x06", "attr_mask":"0x5", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x09", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x0C", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x0F", "attr_mask":"0x5", "attr_cmpval":"0x20", "attr_len":"1"} + ] + } + }, + + "PORT45": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT45", "device_parent":"MUX11"}, + "dev_attr": { "dev_idx":"45"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT45-EEPROM" }, + { "itf":"control", "dev":"PORT45-CTRL" } + ] + } + }, + "PORT45-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT45-EEPROM", "device_parent":"MUX11", "virt_parent":"PORT45"}, + "i2c": + { + "topo_info": { "parent_bus":"0x56", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT45-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT45-CTRL", "device_parent":"MUX11", "virt_parent":"PORT45"}, + "i2c": + { + "topo_info": { "parent_bus":"0x56", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x06", "attr_mask":"0x6", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x09", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x0C", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x0F", "attr_mask":"0x6", "attr_cmpval":"0x40", "attr_len":"1"} + ] + } + }, + + "PORT46": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT46", "device_parent":"MUX11"}, + "dev_attr": { "dev_idx":"46"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT46-EEPROM" }, + { "itf":"control", "dev":"PORT46-CTRL" } + ] + } + }, + "PORT46-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT46-EEPROM", "device_parent":"MUX11", "virt_parent":"PORT46"}, + "i2c": + { + "topo_info": { "parent_bus":"0x57", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT46-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT46-CTRL", "device_parent":"MUX11", "virt_parent":"PORT46"}, + "i2c": + { + "topo_info": { "parent_bus":"0x57", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x06", "attr_mask":"0x7", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x09", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x0C", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x0F", "attr_mask":"0x7", "attr_cmpval":"0x80", "attr_len":"1"} + ] + } + }, + + "PORT47": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT47", "device_parent":"MUX11"}, + "dev_attr": { "dev_idx":"47"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT47-EEPROM" }, + { "itf":"control", "dev":"PORT47-CTRL" } + ] + } + }, + "PORT47-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT47-EEPROM", "device_parent":"MUX11", "virt_parent":"PORT47"}, + "i2c": + { + "topo_info": { "parent_bus":"0x58", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT47-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT47-CTRL", "device_parent":"MUX11", "virt_parent":"PORT47"}, + "i2c": + { + "topo_info": { "parent_bus":"0x58", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x07", "attr_mask":"0x0", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x0A", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x0D", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x10", "attr_mask":"0x0", "attr_cmpval":"0x1", "attr_len":"1"} + ] + } + }, + + "PORT48": + { + "dev_info": { "device_type":"SFP28", "device_name":"PORT48", "device_parent":"MUX11"}, + "dev_attr": { "dev_idx":"48"}, + "i2c": + { + "interface": + [ + { "itf":"eeprom", "dev":"PORT48-EEPROM" }, + { "itf":"control", "dev":"PORT48-CTRL" } + ] + } + }, + "PORT48-EEPROM": + { + "dev_info": { "device_type":"", "device_name":"PORT48-EEPROM", "device_parent":"MUX11", "virt_parent":"PORT48"}, + "i2c": + { + "topo_info": { "parent_bus":"0x59", "dev_addr":"0x50", "dev_type":"optoe1"}, + "attr_list": + [ + { "attr_name":"eeprom"} + ] + } + }, + "PORT48-CTRL": + { + "dev_info": { "device_type":"", "device_name":"PORT48-CTRL", "device_parent":"MUX11", "virt_parent":"PORT48"}, + "i2c": + { + "topo_info": { "parent_bus":"0x59", "dev_addr":"0x53", "dev_type":"pddf_xcvr"}, + "attr_list": + [ + { "attr_name":"xcvr_present", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x07", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, + { "attr_name":"xcvr_txfault", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x0A", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, + { "attr_name":"xcvr_txdisable", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x0D", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"}, + { "attr_name":"xcvr_rxlos", "attr_devaddr":"0x62", "attr_devtype":"cpld", "attr_devname":"CPLD3", "attr_offset":"0x10", "attr_mask":"0x1", "attr_cmpval":"0x2", "attr_len":"1"} + ] + } + }, + + "LOC_LED": + { + "dev_info": { "device_type":"LED", "device_name":"LOC_LED"}, + "dev_attr": { "index":"0", "flag": "rw"}, + "i2c" : + { + "attr_list": + [ + {"attr_name":"amber", "descr": "" , "bits" : "5:4", "value" : "0x0", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x0A"}, + {"attr_name":"off", "descr": "" , "bits" : "5:4", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x0A"} + + ] + } + }, + "DIAG_LED": + { + "dev_info": { "device_type":"LED", "device_name":"DIAG_LED"}, + "dev_attr": { "index":"0", "flag": "rw"}, + "i2c" : + { + "attr_list": + [ + {"attr_name":"green", "descr": "" , "bits" : "3:2", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x0A"}, + {"attr_name":"amber", "descr": "" , "bits" : "3:2", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x0A"}, + {"attr_name":"off", "descr": "" , "bits" : "3:2", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x0A"} + ] + } + } +} diff --git a/device/accton/x86_64-accton_as5835_54x-r0/pddf_support b/device/accton/x86_64-accton_as5835_54x-r0/pddf_support new file mode 100644 index 0000000000..e69de29bb2 diff --git a/device/accton/x86_64-accton_as5835_54x-r0/platform.json b/device/accton/x86_64-accton_as5835_54x-r0/platform.json index 5d0a490a7c..c69ab55381 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/platform.json +++ b/device/accton/x86_64-accton_as5835_54x-r0/platform.json @@ -1,15 +1,26 @@ { "chassis": { "name": "5835-54X", + "thermal_manager":false, + "status_led": { + "controllable": true, + "colors": ["green", "amber", "off"] + }, "components": [ { - "name": "CPLD1" + "name": "MB_CPLD1" + }, + { + "name": "MB_CPLD2" + }, + { + "name": "MB_CPLD3" }, { - "name": "CPLD2" + "name": "FAN_CPLD" }, { - "name": "CPLD3" + "name": "CPU_CPLD" }, { "name": "BIOS" @@ -119,9 +130,16 @@ ], "thermals": [ { - "name": "PSU-1 temp sensor 1" + "name": "PSU-1 temp sensor 1", + "controllable": false, + "low-threshold": false, + "high-threshold": false, + "low-crit-threshold": false, + "high-crit-threshold": false } - ] + ], + "temperature": true, + "temperature_high_threshold": true }, { "name": "PSU-2", @@ -132,23 +150,90 @@ ], "thermals": [ { - "name": "PSU-2 temp sensor 2" + "name": "PSU-2 temp sensor 1", + "controllable": false, + "low-threshold": false, + "high-threshold": false, + "low-crit-threshold": false, + "high-crit-threshold": false } - ] + ], + "temperature": true, + "temperature_high_threshold": true } ], "thermals": [ { - "name": "Temp sensor 1" + "name": "CB_temp(0x4B)", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false + }, + { + "name": "MB_FrontMiddle_temp(0x4C)", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false + }, + { + "name": "MB_RearLeft_temp(0x4A)", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false + }, + { + "name": "MB_RearLeft_temp(0x49)", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false + }, + { + "name": "CPU_Package_temp", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": true + }, + { + "name": "CPU_Core_0_temp", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": true }, { - "name": "Temp sensor 2" + "name": "CPU_Core_1_temp", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": true }, { - "name": "Temp sensor 3" + "name": "CPU_Core_2_temp", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": true }, { - "name": "Temp sensor 4" + "name": "CPU_Core_3_temp", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": true } ], "sfps": [ diff --git a/device/accton/x86_64-accton_as5835_54x-r0/platform_components.json b/device/accton/x86_64-accton_as5835_54x-r0/platform_components.json new file mode 100644 index 0000000000..16f6f73dd7 --- /dev/null +++ b/device/accton/x86_64-accton_as5835_54x-r0/platform_components.json @@ -0,0 +1,14 @@ +{ + "chassis": { + "5835-54X-O-AC-F": { + "component": { + "MB_CPLD1": { }, + "MB_CPLD2": { }, + "MB_CPLD3": { }, + "FAN_CPLD": { }, + "CPU_CPLD": { }, + "BIOS": { } + } + } + } +} diff --git a/device/accton/x86_64-accton_as5835_54x-r0/pmon_daemon_control.json b/device/accton/x86_64-accton_as5835_54x-r0/pmon_daemon_control.json index a3b204e20d..94592fa8ce 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/pmon_daemon_control.json +++ b/device/accton/x86_64-accton_as5835_54x-r0/pmon_daemon_control.json @@ -1,5 +1,3 @@ { - "skip_ledd": true, - "skip_pcied": true + "skip_ledd": true } - diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sensors.conf b/device/accton/x86_64-accton_as5835_54x-r0/sensors.conf index 38cf89fc68..4d132ef2a9 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sensors.conf +++ b/device/accton/x86_64-accton_as5835_54x-r0/sensors.conf @@ -39,13 +39,13 @@ chip "as5835_54x_fan-*" chip "lm75-i2c-*-49" - label temp1 "Main Board Temperature" + label temp1 "MB_RearLeft_temp" chip "lm75-i2c-*-4a" - label temp1 "Main Board Temperature" + label temp1 "MB_RearRight_temp" chip "lm75-i2c-*-4c" - label temp1 "Main Board Temperature" + label temp1 "MB_FrontMiddle_temp" chip "lm75-i2c-*-4b" - label temp1 "CPU Board Temperature" + label temp1 "CB_temp" diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan.py index 8cb1c17fdf..43ce61559a 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan.py @@ -44,7 +44,7 @@ FAN_NAME_LIST = ["FAN-1F", "FAN-1R", "FAN-2F", "FAN-2R", - "FAN-3F", "FAN-3R", "FAN-4F", "FAN-4R", + "FAN-3F", "FAN-3R", "FAN-4F", "FAN-4R", "FAN-5F", "FAN-5R"] class Fan(FanBase): @@ -61,7 +61,7 @@ def __init__(self, fan_tray_index, fan_index=0, is_psu_fan=False, psu_index=0): self.psu_i2c_addr = PSU_HWMON_I2C_MAPPING[self.psu_index]['addr'] self.psu_hwmon_path = I2C_PATH.format( self.psu_i2c_num, self.psu_i2c_addr) - + self.psu_i2c_num = PSU_CPLD_I2C_MAPPING[self.psu_index]['num'] self.psu_i2c_addr = PSU_CPLD_I2C_MAPPING[self.psu_index]['addr'] self.psu_cpld_path = I2C_PATH.format( @@ -77,7 +77,7 @@ def get_direction(self): A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST depending on fan direction """ - + if not self.is_psu_fan: dir_str = "{}{}{}".format(CPLD_FAN_I2C_PATH, self.fan_tray_index+1, '_direction') @@ -91,17 +91,17 @@ def get_direction(self): direction=self.FAN_DIRECTION_EXHAUST else: #For PSU dir_str = "{}{}".format(self.psu_hwmon_path,'psu_fan_dir') - + val=self._api_helper.read_txt_file(dir_str) - if val is not None: + if val is not None: if val=='F2B': direction=self.FAN_DIRECTION_EXHAUST else: direction=self.FAN_DIRECTION_INTAKE else: direction=self.FAN_DIRECTION_EXHAUST - + return direction def get_speed(self): @@ -122,12 +122,12 @@ def get_speed(self): speed=100 else: return 0 - elif self.get_presence(): + elif self.get_presence(): speed_path = "{}{}".format(CPLD_FAN_I2C_PATH, '_duty_cycle_percentage') speed=self._api_helper.read_txt_file(speed_path) if speed is None: return 0 - + return int(speed) def get_target_speed(self): @@ -164,8 +164,8 @@ def set_speed(self, speed): A boolean, True if speed is set successfully, False if not """ - - if not self.is_psu_fan and self.get_presence(): + + if not self.is_psu_fan and self.get_presence(): speed_path = "{}{}".format(CPLD_FAN_I2C_PATH, '_duty_cycle_percentage') return self._api_helper.write_txt_file(speed_path, int(speed)) @@ -181,21 +181,20 @@ def set_status_led(self, color): bool: True if status LED state is set successfully, False if not """ return False #Not supported - + def get_status_led(self): """ Gets the state of the fan status LED Returns: A string, one of the predefined STATUS_LED_COLOR_* strings above """ - status=self.get_presence() - if status is None: - return self.STATUS_LED_COLOR_OFF + if self.is_psu_fan: + return None return { - 1: self.STATUS_LED_COLOR_GREEN, - 0: self.STATUS_LED_COLOR_RED - }.get(status, self.STATUS_LED_COLOR_OFF) + True: self.STATUS_LED_COLOR_GREEN, + False: self.STATUS_LED_COLOR_RED + }.get(self.get_status(), self.STATUS_LED_COLOR_RED) def get_name(self): """ @@ -208,20 +207,18 @@ def get_name(self): else "PSU-{} FAN-{}".format(self.psu_index+1, self.fan_index+1) return fan_name - + def get_presence(self): """ Retrieves the presence of the FAN Returns: bool: True if FAN is present, False if not """ - - if self.is_psu_fan: present_path="{}{}".format(self.psu_cpld_path, 'psu_present') else: present_path = "{}{}{}".format(CPLD_FAN_I2C_PATH, self.fan_tray_index+1, '_present') - + val=self._api_helper.read_txt_file(present_path) if val is not None: return int(val, 10)==1 @@ -235,30 +232,34 @@ def get_status(self): A boolean value, True if device is operating properly, False if not """ if self.is_psu_fan: + psu_path = "{}{}".format(self.psu_cpld_path, 'psu_power_good') + val = self._api_helper.read_txt_file(psu_path) + if val is None or int(val, 10)==0: + return False + psu_fan_path= "{}{}".format(self.psu_hwmon_path, 'psu_fan1_fault') val=self._api_helper.read_txt_file(psu_fan_path) if val is not None: return int(val, 10)==0 else: return False - else: - path = "{}{}{}".format(CPLD_FAN_I2C_PATH, self.fan_tray_index+1, '_fault') + else: + sys_index = self.fan_index * 10 + self.fan_tray_index+1 + path = "{}{}{}".format(CPLD_FAN_I2C_PATH, sys_index, '_fault') val=self._api_helper.read_txt_file(path) if val is not None: return int(val, 10)==0 else: return False - def get_model(self): """ Retrieves the model number (or part number) of the device Returns: string: Model/part number of device """ - return "N/A" - + def get_serial(self): """ Retrieves the serial number of the device diff --git a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan_drawer.py b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan_drawer.py index 17d339ee55..cc1e87337e 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan_drawer.py +++ b/device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan_drawer.py @@ -22,7 +22,7 @@ def __init__(self, fantray_index): # FanTray is 0-based in platforms self.fantrayindex = fantray_index self.__initialize_fan_drawer() - + def __initialize_fan_drawer(self): from sonic_platform.fan import Fan @@ -67,7 +67,13 @@ def get_status(self): Returns: A boolean value, True if device is operating properly, False if not """ - return self._fan_list[0].get_status() + from sonic_platform.fan import Fan + + for fan in self._fan_list: + if not fan.get_status(): + return False + + return True def get_position_in_parent(self): """ @@ -88,3 +94,25 @@ def is_replaceable(self): bool: True if it is replaceable. """ return True + + 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: True if status LED state is set successfully, False if not + """ + return False # Not supported + + def get_status_led(self): + """ + Gets the state of the fan status LED + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + return { + True: self.STATUS_LED_COLOR_GREEN, + False: self.STATUS_LED_COLOR_RED + }.get(self.get_status(), self.STATUS_LED_COLOR_RED) diff --git a/device/accton/x86_64-accton_as5835_54x-r0/system_health_monitoring_config.json b/device/accton/x86_64-accton_as5835_54x-r0/system_health_monitoring_config.json index 5f3b3b07e7..4ea184946b 100644 --- a/device/accton/x86_64-accton_as5835_54x-r0/system_health_monitoring_config.json +++ b/device/accton/x86_64-accton_as5835_54x-r0/system_health_monitoring_config.json @@ -1,15 +1,17 @@ -{ - "services_to_ignore": [], - "devices_to_ignore": [ - "asic", - "psu.temperature" - - ], - "user_defined_checkers": [], - "polling_interval": 60, - "led_color": { - "fault": "STATUS_LED_COLOR_AMBER", - "normal": "STATUS_LED_COLOR_GREEN", - "booting": "STATUS_LED_COLOR_GREEN" - } -} +{ + "services_to_ignore": [], + "devices_to_ignore": [ + "asic", + "psu.voltage", + "psu.temperature", + "PSU1_FAN1.speed", + "PSU2_FAN1.speed" + ], + "user_defined_checkers": [], + "polling_interval": 60, + "led_color": { + "fault": "amber", + "normal": "green", + "booting": "off" + } +} diff --git a/device/accton/x86_64-accton_as7326_56x-r0/Accton-AS7326-56X/td3-as7326-48x25G+8x100G.config.bcm b/device/accton/x86_64-accton_as7326_56x-r0/Accton-AS7326-56X/td3-as7326-48x25G+8x100G.config.bcm index 21ca8a2fa5..859f54e8e6 100755 --- a/device/accton/x86_64-accton_as7326_56x-r0/Accton-AS7326-56X/td3-as7326-48x25G+8x100G.config.bcm +++ b/device/accton/x86_64-accton_as7326_56x-r0/Accton-AS7326-56X/td3-as7326-48x25G+8x100G.config.bcm @@ -33,6 +33,17 @@ tdma_timeout_usec=3000000 skip_L2_USER_ENTRY=0 bcm_tunnel_term_compatible_mode=1 l3_alpm_ipv6_128b_bkt_rsvd=1 +l3_ecmp_levels=2 + +#vxlan +use_all_splithorizon_groups=1 +riot_enable=1 +sai_tunnel_support=1 +riot_overlay_l3_intf_mem_size=4096 +riot_overlay_l3_egress_mem_size=32768 +riot_overlay_ecmp_resilient_hash_size=16384 +flow_init_mode=1 +host_as_route_disable=1 dport_map_port_1=6 dport_map_port_2=2 diff --git a/device/accton/x86_64-accton_as7326_56x-r0/media_settings.json b/device/accton/x86_64-accton_as7326_56x-r0/media_settings.json new file mode 100644 index 0000000000..f25c782810 --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/media_settings.json @@ -0,0 +1,420 @@ +{ + "PORT_MEDIA_SETTINGS": { + "1": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "2": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "3": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "4": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "5": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "6": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "7": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "8": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "9": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "10": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "11": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "12": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "13": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "14": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "15": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "16": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "17": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "18": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "19": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "20": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "21": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "22": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "23": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "24": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "25": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "26": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "27": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "28": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "29": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "30": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "31": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "32": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "33": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "34": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "35": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "36": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "37": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "38": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "39": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "40": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "41": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "42": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "43": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "44": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "45": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "46": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "47": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "48": { + "Default": { + "preemphasis": { + "lane0": "0x14410a" + } + } + }, + "49": { + "Default": { + "preemphasis": { + "lane0": "0x14410a", + "lane1": "0x14410a", + "lane2": "0x14410a", + "lane3": "0x14410a" + } + } + }, + "50": { + "Default": { + "preemphasis": { + "lane0": "0x14410a", + "lane1": "0x14410a", + "lane2": "0x14410a", + "lane3": "0x14410a" + } + } + }, + "51": { + "Default": { + "preemphasis": { + "lane0": "0x14410a", + "lane1": "0x14410a", + "lane2": "0x14410a", + "lane3": "0x14410a" + } + } + }, + "52": { + "Default": { + "preemphasis": { + "lane0": "0x14410a", + "lane1": "0x14410a", + "lane2": "0x14410a", + "lane3": "0x14410a" + } + } + }, + "53": { + "Default": { + "preemphasis": { + "lane0": "0x14410a", + "lane1": "0x14410a", + "lane2": "0x14410a", + "lane3": "0x14410a" + } + } + }, + "54": { + "Default": { + "preemphasis": { + "lane0": "0x14410a", + "lane1": "0x14410a", + "lane2": "0x14410a", + "lane3": "0x14410a" + } + } + }, + "55": { + "Default": { + "preemphasis": { + "lane0": "0x14410a", + "lane1": "0x14410a", + "lane2": "0x14410a", + "lane3": "0x14410a" + } + } + }, + "56": { + "Default": { + "preemphasis": { + "lane0": "0x14410a", + "lane1": "0x14410a", + "lane2": "0x14410a", + "lane3": "0x14410a" + } + } + } + } +} diff --git a/device/accton/x86_64-accton_as7326_56x-r0/pcie.yaml b/device/accton/x86_64-accton_as7326_56x-r0/pcie.yaml new file mode 100644 index 0000000000..6f1be3817a --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/pcie.yaml @@ -0,0 +1,465 @@ +- bus: '00' + dev: '00' + fn: '0' + id: 6f00 + name: 'Host bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D DMI2 + (rev 03)' +- bus: '00' + dev: '01' + fn: '0' + id: 6f02 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 1 (rev 03)' +- bus: '00' + dev: '01' + fn: '1' + id: 6f03 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 1 (rev 03)' +- bus: '00' + dev: '02' + fn: '0' + id: 6f04 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 2 (rev 03)' +- bus: '00' + dev: '02' + fn: '1' + id: 6f05 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 2 (rev 03)' +- bus: '00' + dev: '02' + fn: '2' + id: 6f06 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 2 (rev 03)' +- bus: '00' + dev: '02' + fn: '3' + id: 6f07 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 2 (rev 03)' +- bus: '00' + dev: '03' + fn: '0' + id: 6f08 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 3 (rev 03)' +- bus: '00' + dev: '03' + fn: '1' + id: 6f09 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 3 (rev 03)' +- bus: '00' + dev: '03' + fn: '2' + id: 6f0a + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 3 (rev 03)' +- bus: '00' + dev: '03' + fn: '3' + id: 6f0b + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 3 (rev 03)' +- bus: '00' + dev: '05' + fn: '0' + id: 6f28 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Map/VTd_Misc/System Management (rev 03)' +- bus: '00' + dev: '05' + fn: '1' + id: 6f29 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D IIO Hot Plug (rev 03)' +- bus: '00' + dev: '05' + fn: '2' + id: 6f2a + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D IIO RAS/Control Status/Global Errors (rev 03)' +- bus: '00' + dev: '05' + fn: '4' + id: 6f2c + name: 'PIC: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D I/O APIC (rev + 03)' +- bus: '00' + dev: '14' + fn: '0' + id: 8c31 + name: 'USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB + xHCI (rev 05)' +- bus: '00' + dev: '16' + fn: '0' + id: 8c3a + name: 'Communication controller: Intel Corporation 8 Series/C220 Series Chipset + Family MEI Controller #1 (rev 04)' +- bus: '00' + dev: '16' + fn: '1' + id: 8c3b + name: 'Communication controller: Intel Corporation 8 Series/C220 Series Chipset + Family MEI Controller #2 (rev 04)' +- bus: '00' + dev: 1c + fn: '0' + id: 8c10 + name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express + Root Port #1 (rev d5)' +- bus: '00' + dev: 1c + fn: '1' + id: 8c12 + name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express + Root Port #2 (rev d5)' +- bus: '00' + dev: 1d + fn: '0' + id: 8c26 + name: 'USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB + EHCI #1 (rev 05)' +- bus: '00' + dev: 1f + fn: '0' + id: 8c54 + name: 'ISA bridge: Intel Corporation C224 Series Chipset Family Server Standard + SKU LPC Controller (rev 05)' +- bus: '00' + dev: 1f + fn: '2' + id: 8c02 + name: 'SATA controller: Intel Corporation 8 Series/C220 Series Chipset Family 6-port + SATA Controller 1 [AHCI mode] (rev 05)' +- bus: '00' + dev: 1f + fn: '3' + id: 8c22 + name: 'SMBus: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller + (rev 05)' +- bus: '03' + dev: '00' + fn: '0' + id: 6f50 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 0' +- bus: '03' + dev: '00' + fn: '1' + id: 6f51 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 1' +- bus: '03' + dev: '00' + fn: '2' + id: 6f52 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 2' +- bus: '03' + dev: '00' + fn: '3' + id: 6f53 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 3' +- bus: '05' + dev: '00' + fn: '0' + id: 15ab + name: 'Ethernet controller: Intel Corporation Ethernet Connection X552 10 GbE Backplane' +- bus: '05' + dev: '00' + fn: '1' + id: 15ab + name: 'Ethernet controller: Intel Corporation Ethernet Connection X552 10 GbE Backplane' +- bus: '07' + dev: '00' + fn: '0' + id: b873 + name: 'Ethernet controller: Broadcom Inc. and subsidiaries Device b873 (rev 01)' +- bus: 0b + dev: '00' + fn: '0' + id: 165f + name: 'Ethernet controller: Broadcom Inc. and subsidiaries NetXtreme BCM5720 2-port + Gigabit Ethernet PCIe' +- bus: ff + dev: 0b + fn: '0' + id: 6f81 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link 0/1 (rev 03)' +- bus: ff + dev: 0b + fn: '1' + id: 6f36 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link 0/1 (rev 03)' +- bus: ff + dev: 0b + fn: '2' + id: 6f37 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link 0/1 (rev 03)' +- bus: ff + dev: 0b + fn: '3' + id: 6f76 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link Debug (rev 03)' +- bus: ff + dev: 0c + fn: '0' + id: 6fe0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0c + fn: '1' + id: 6fe1 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0c + fn: '2' + id: 6fe2 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0c + fn: '3' + id: 6fe3 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '0' + id: 6ff8 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '4' + id: 6ffc + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '5' + id: 6ffd + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '6' + id: 6ffe + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: '10' + fn: '0' + id: 6f1d + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R2PCIe Agent (rev 03)' +- bus: ff + dev: '10' + fn: '1' + id: 6f34 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R2PCIe Agent (rev 03)' +- bus: ff + dev: '10' + fn: '5' + id: 6f1e + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Ubox (rev 03)' +- bus: ff + dev: '10' + fn: '6' + id: 6f7d + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Ubox (rev 03)' +- bus: ff + dev: '10' + fn: '7' + id: 6f1f + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Ubox (rev 03)' +- bus: ff + dev: '12' + fn: '0' + id: 6fa0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Home Agent 0 (rev 03)' +- bus: ff + dev: '12' + fn: '1' + id: 6f30 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Home Agent 0 (rev 03)' +- bus: ff + dev: '13' + fn: '0' + id: 6fa8 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Target Address/Thermal/RAS (rev 03)' +- bus: ff + dev: '13' + fn: '1' + id: 6f71 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Target Address/Thermal/RAS (rev 03)' +- bus: ff + dev: '13' + fn: '2' + id: 6faa + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '3' + id: 6fab + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '4' + id: 6fac + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '5' + id: 6fad + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '6' + id: 6fae + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Broadcast (rev 03)' +- bus: ff + dev: '13' + fn: '7' + id: 6faf + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Global Broadcast (rev 03)' +- bus: ff + dev: '14' + fn: '0' + id: 6fb0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 0 Thermal Control (rev 03)' +- bus: ff + dev: '14' + fn: '1' + id: 6fb1 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 1 Thermal Control (rev 03)' +- bus: ff + dev: '14' + fn: '2' + id: 6fb2 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 0 Error (rev 03)' +- bus: ff + dev: '14' + fn: '3' + id: 6fb3 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 1 Error (rev 03)' +- bus: ff + dev: '14' + fn: '4' + id: 6fbc + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '14' + fn: '5' + id: 6fbd + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '14' + fn: '6' + id: 6fbe + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '14' + fn: '7' + id: 6fbf + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '15' + fn: '0' + id: 6fb4 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 2 Thermal Control (rev 03)' +- bus: ff + dev: '15' + fn: '1' + id: 6fb5 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 3 Thermal Control (rev 03)' +- bus: ff + dev: '15' + fn: '2' + id: 6fb6 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 2 Error (rev 03)' +- bus: ff + dev: '15' + fn: '3' + id: 6fb7 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 3 Error (rev 03)' +- bus: ff + dev: 1e + fn: '0' + id: 6f98 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '1' + id: 6f99 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '2' + id: 6f9a + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '3' + id: 6fc0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '4' + id: 6f9c + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1f + fn: '0' + id: 6f88 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1f + fn: '2' + id: 6f8a + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' diff --git a/device/accton/x86_64-accton_as7326_56x-r0/pddf/pd-plugin.json b/device/accton/x86_64-accton_as7326_56x-r0/pddf/pd-plugin.json index 317cf23b73..aacab4674f 100644 --- a/device/accton/x86_64-accton_as7326_56x-r0/pddf/pd-plugin.json +++ b/device/accton/x86_64-accton_as7326_56x-r0/pddf/pd-plugin.json @@ -34,7 +34,7 @@ { "i2c": { - "valmap": { "F2B":"EXHAUST", "B2F":"INTAKE" } + "valmap": { "F2B":"exhaust", "B2F":"intake" } } }, @@ -47,7 +47,7 @@ { "i2c": { - "valmap": {"1":"INTAKE", "0":"EXHAUST"} + "valmap": {"1":"intake", "0":"exhaust"} } }, @@ -61,7 +61,7 @@ "duty_cycle_to_pwm": "lambda dc: ((dc*100)/625 -1)", - "pwm_to_duty_cycle": "lambda pwm: (((pwm+1)*625+75)/100)" + "pwm_to_duty_cycle": "lambda pwm: (((pwm+1)*625)/100)" } } diff --git a/device/accton/x86_64-accton_as7326_56x-r0/pddf/pddf-device.json b/device/accton/x86_64-accton_as7326_56x-r0/pddf/pddf-device.json index 857b4e1c4c..85d219c3bc 100644 --- a/device/accton/x86_64-accton_as7326_56x-r0/pddf/pddf-device.json +++ b/device/accton/x86_64-accton_as7326_56x-r0/pddf/pddf-device.json @@ -5,7 +5,7 @@ "num_fantrays":6, "num_fans_pertray":2, "num_ports":58, - "num_temps": 4, + "num_temps": 5, "pddf_dev_types": { "description":"AS7326-56X - Below is the list of supported PDDF device types (chip names) for various components. If any component uses some other driver, we will create the client using 'echo > /new_device' method", @@ -202,12 +202,14 @@ { "attr_name":"psu_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, { "attr_name":"psu_power_good", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x4", "attr_cmpval":"0x4", "attr_len":"1"}, { "attr_name":"psu_mfr_id", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, - { "attr_name":"psu_fan_dir", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"}, { "attr_name":"psu_v_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_i_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_p_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, - { "attr_name":"psu_temp1_input", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} + { "attr_name":"psu_temp1_input", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_v_out_min", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xa4", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_v_out_max", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xa5", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_temp1_high_threshold", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xa8", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} ] } }, @@ -221,7 +223,8 @@ "attr_list": [ { "attr_name":"psu_model_name", "attr_devaddr":"0x53", "attr_devtype":"eeprom", "attr_offset":"0x15", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"11" }, - { "attr_name":"psu_serial_num", "attr_devaddr":"0x53", "attr_devtype":"eeprom", "attr_offset":"0x2e", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"17" } + { "attr_name":"psu_serial_num", "attr_devaddr":"0x53", "attr_devtype":"eeprom", "attr_offset":"0x2e", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"17" }, + { "attr_name":"psu_fan_dir", "attr_devaddr":"0x53", "attr_devtype":"eeprom", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"} ] } @@ -251,12 +254,14 @@ { "attr_name":"psu_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, { "attr_name":"psu_power_good", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x2", "attr_mask":"0x8", "attr_cmpval":"0x8", "attr_len":"1"}, { "attr_name":"psu_mfr_id", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, - { "attr_name":"psu_fan_dir", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"}, { "attr_name":"psu_v_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_i_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_p_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, - { "attr_name":"psu_temp1_input", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} + { "attr_name":"psu_temp1_input", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_v_out_min", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xa4", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_v_out_max", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xa5", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_temp1_high_threshold", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xa8", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} ] } }, @@ -269,7 +274,8 @@ "attr_list": [ { "attr_name":"psu_model_name", "attr_devaddr":"0x51", "attr_devtype":"eeprom", "attr_offset":"0x15", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"11" }, - { "attr_name":"psu_serial_num", "attr_devaddr":"0x51", "attr_devtype":"eeprom", "attr_offset":"0x2e", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"17" } + { "attr_name":"psu_serial_num", "attr_devaddr":"0x51", "attr_devtype":"eeprom", "attr_offset":"0x2e", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"17" }, + { "attr_name":"psu_fan_dir", "attr_devaddr":"0x51", "attr_devtype":"eeprom", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"} ] } }, @@ -360,6 +366,22 @@ ] } }, + "TEMP5" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP5"}, + "dev_attr": { "display_name":"coretemp-isa-0000"}, + "i2c": + { + "path_info": {"sysfs_base_path": "/sys/class/hwmon/hwmon0"}, + "attr_list": + [ + { "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp1_crit"}, + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, + { "attr_name": "temp1_input"} + ] + } + }, + "FAN-CTRL": { "dev_info": { "device_type":"FAN", "device_name":"FAN-CTRL", "device_parent":"MUX2"}, @@ -2911,36 +2933,36 @@ "LOC_LED": { "dev_info": { "device_type":"LED", "device_name":"LOC_LED"}, - "dev_attr": { "index":"0"}, + "dev_attr": { "index":"0", "flag": "rw"}, "i2c" : { "attr_list": [ - {"attr_name":"STATUS_LED_COLOR_BLUE_BLINK", "descr": "" , "bits" : "5:0", "value" : "0x27", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x25"}, - {"attr_name":"STATUS_LED_COLOR_GREEN_BLINK", "descr": "" , "bits" : "5:0", "value" : "0x17", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x25"}, - {"attr_name":"STATUS_LED_COLOR_AMBER_BLINK", "descr": "" , "bits" : "5:0", "value" : "0xf", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x25"}, - {"attr_name":"STATUS_LED_COLOR_BLUE", "descr": "" , "bits" : "5:0", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x25"}, - {"attr_name":"STATUS_LED_COLOR_GREEN", "descr": "" , "bits" : "5:0", "value" : "0x5", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x25"}, - {"attr_name":"STATUS_LED_COLOR_AMBER", "descr": "" , "bits" : "5:0", "value" : "0x6", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x25"}, - {"attr_name":"STATUS_LED_COLOR_OFF", "descr": "" , "bits" : "5:0", "value" : "0xf", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x25"} + {"attr_name":"blue_blink", "descr": "" , "bits" : "5:0", "value" : "0x27", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x25"}, + {"attr_name":"green_blink", "descr": "" , "bits" : "5:0", "value" : "0x17", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x25"}, + {"attr_name":"amber_blink", "descr": "" , "bits" : "5:0", "value" : "0xf", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x25"}, + {"attr_name":"blue", "descr": "" , "bits" : "5:0", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x25"}, + {"attr_name":"green", "descr": "" , "bits" : "5:0", "value" : "0x5", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x25"}, + {"attr_name":"amber", "descr": "" , "bits" : "5:0", "value" : "0x6", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x25"}, + {"attr_name":"off", "descr": "" , "bits" : "5:0", "value" : "0xf", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x25"} ] } }, "DIAG_LED": { "dev_info": { "device_type":"LED", "device_name":"DIAG_LED"}, - "dev_attr": { "index":"0"}, + "dev_attr": { "index":"0", "flag": "rw"}, "i2c" : { "attr_list": [ - {"attr_name":"STATUS_LED_COLOR_BLUE_BLINK", "descr": "" , "bits" : "5:0", "value" : "0x27", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x24"}, - {"attr_name":"STATUS_LED_COLOR_GREEN_BLINK", "descr": "" , "bits" : "5:0", "value" : "0x17", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x24"}, - {"attr_name":"STATUS_LED_COLOR_AMBER_BLINK", "descr": "" , "bits" : "5:0", "value" : "0xf", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x24"}, - {"attr_name":"STATUS_LED_COLOR_BLUE", "descr": "" , "bits" : "5:0", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x24"}, - {"attr_name":"STATUS_LED_COLOR_GREEN", "descr": "" , "bits" : "5:0", "value" : "0x5", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x24"}, - {"attr_name":"STATUS_LED_COLOR_AMBER", "descr": "" , "bits" : "5:0", "value" : "0x6", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x24"}, - {"attr_name":"STATUS_LED_COLOR_OFF", "descr": "" , "bits" : "5:0", "value" : "0x7", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x24"} + {"attr_name":"blue_blink", "descr": "" , "bits" : "5:0", "value" : "0x27", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x24"}, + {"attr_name":"green_blink", "descr": "" , "bits" : "5:0", "value" : "0x17", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x24"}, + {"attr_name":"amber_blink", "descr": "" , "bits" : "5:0", "value" : "0xf", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x24"}, + {"attr_name":"blue", "descr": "" , "bits" : "5:0", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x24"}, + {"attr_name":"green", "descr": "" , "bits" : "5:0", "value" : "0x5", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x24"}, + {"attr_name":"amber", "descr": "" , "bits" : "5:0", "value" : "0x6", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x24"}, + {"attr_name":"off", "descr": "" , "bits" : "5:0", "value" : "0x7", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x24"} ] } diff --git a/device/accton/x86_64-accton_as7326_56x-r0/platform.json b/device/accton/x86_64-accton_as7326_56x-r0/platform.json index 3b32cfdb26..99dd8305c2 100644 --- a/device/accton/x86_64-accton_as7326_56x-r0/platform.json +++ b/device/accton/x86_64-accton_as7326_56x-r0/platform.json @@ -1,15 +1,22 @@ { "chassis": { "name": "7326-56X", + "thermal_manager":false, "components": [ { - "name": "CPLD-1" + "name": "MB_CPLD1" }, { - "name": "CPLD-2" + "name": "MB_CPLD2" }, { - "name": "CPLD-3" + "name": "MB_CPLD3" + }, + { + "name": "FAN_CPLD" + }, + { + "name": "CPU_CPLD" }, { "name": "BIOS" @@ -17,40 +24,88 @@ ], "fans": [ { - "name": "FAN-1F" + "name": "FAN-1F", + "speed": { + "controllable": true, + "minimum": 32 + } }, { - "name": "FAN-1R" + "name": "FAN-1R", + "speed": { + "controllable": true, + "minimum": 32 + } }, { - "name": "FAN-2F" + "name": "FAN-2F", + "speed": { + "controllable": true, + "minimum": 32 + } }, { - "name": "FAN-2R" + "name": "FAN-2R", + "speed": { + "controllable": true, + "minimum": 32 + } }, { - "name": "FAN-3F" + "name": "FAN-3F", + "speed": { + "controllable": true, + "minimum": 32 + } }, { - "name": "FAN-3R" + "name": "FAN-3R", + "speed": { + "controllable": true, + "minimum": 32 + } }, { - "name": "FAN-4F" + "name": "FAN-4F", + "speed": { + "controllable": true, + "minimum": 32 + } }, { - "name": "FAN-4R" + "name": "FAN-4R", + "speed": { + "controllable": true, + "minimum": 32 + } }, { - "name": "FAN-5F" + "name": "FAN-5F", + "speed": { + "controllable": true, + "minimum": 32 + } }, { - "name": "FAN-5R" + "name": "FAN-5R", + "speed": { + "controllable": true, + "minimum": 32 + } }, { - "name": "FAN-6F" + "name": "FAN-6F", + "speed": { + "controllable": true, + "minimum": 32 + } }, { - "name": "FAN-6R" + "name": "FAN-6R", + "speed": { + "controllable": true, + "minimum": 32 + } } ], "fan_drawers":[ @@ -59,10 +114,18 @@ "num_fans" : 2, "fans": [ { - "name": "FAN-1F" + "name": "FAN-1F", + "speed": { + "controllable": true, + "minimum": 32 + } }, { - "name": "FAN-1R" + "name": "FAN-1R", + "speed": { + "controllable": true, + "minimum": 32 + } } ] }, @@ -71,10 +134,18 @@ "num_fans" : 2, "fans": [ { - "name": "FAN-2F" + "name": "FAN-2F", + "speed": { + "controllable": true, + "minimum": 32 + } }, { - "name": "FAN-2R" + "name": "FAN-2R", + "speed": { + "controllable": true, + "minimum": 32 + } } ] }, @@ -83,10 +154,18 @@ "num_fans" : 2, "fans": [ { - "name": "FAN-3F" + "name": "FAN-3F", + "speed": { + "controllable": true, + "minimum": 32 + } }, { - "name": "FAN-3R" + "name": "FAN-3R", + "speed": { + "controllable": true, + "minimum": 32 + } } ] }, @@ -95,10 +174,18 @@ "num_fans" : 2, "fans": [ { - "name": "FAN-4F" + "name": "FAN-4F", + "speed": { + "controllable": true, + "minimum": 32 + } }, { - "name": "FAN-4R" + "name": "FAN-4R", + "speed": { + "controllable": true, + "minimum": 32 + } } ] }, @@ -107,10 +194,18 @@ "num_fans" : 2, "fans": [ { - "name": "FAN-5F" + "name": "FAN-5F", + "speed": { + "controllable": true, + "minimum": 32 + } }, { - "name": "FAN-5R" + "name": "FAN-5R", + "speed": { + "controllable": true, + "minimum": 32 + } } ] }, @@ -119,10 +214,18 @@ "num_fans" : 2, "fans": [ { - "name": "FAN-6F" + "name": "FAN-6F", + "speed": { + "controllable": true, + "minimum": 32 + } }, { - "name": "FAN-6R" + "name": "FAN-6R", + "speed": { + "controllable": true, + "minimum": 32 + } } ] } @@ -137,9 +240,16 @@ ], "thermals": [ { - "name": "PSU-1 temp sensor 1" + "name": "PSU-1 temp sensor 1", + "controllable": false, + "low-threshold": false, + "high-threshold": false, + "low-crit-threshold": false, + "high-crit-threshold": false } - ] + ], + "temperature": true, + "temperature_high_threshold": true }, { "name": "PSU-2", @@ -150,23 +260,58 @@ ], "thermals": [ { - "name": "PSU-2 temp sensor 1" + "name": "PSU-2 temp sensor 1", + "controllable": false, + "low-threshold": false, + "high-threshold": false, + "low-crit-threshold": false, + "high-crit-threshold": false } - ] + ], + "temperature": true, + "temperature_high_threshold": true } ], "thermals": [ { - "name": "Temp sensor 1" + "name": "CB_temp(0x4B)", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false + }, + { + "name": "MB_FrontMAC_temp(0x49)", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false }, { - "name": "Temp sensor 2" + "name": "MB_LeftCenter_temp(0x4A)", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false }, { - "name": "Temp sensor 3" + "name": "MB_RearMAC_temp(0x48)", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false }, { - "name": "Temp sensor 4" + "name": "coretemp-isa-0000", + "controllable": false, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": true } ], "sfps": [ @@ -356,7 +501,7 @@ "1x25G": ["Eth2(Port2)"] } }, - + "Ethernet2": { "index": "3", "lanes": "4", @@ -365,7 +510,7 @@ } }, - "Ethernet3": { + "Ethernet3": { "index": "4", "lanes": "8", "breakout_modes": { @@ -405,7 +550,7 @@ } }, - "Ethernet8": { + "Ethernet8": { "index": "9", "lanes": "6", "breakout_modes": { @@ -444,7 +589,7 @@ "1x25G": ["Eth13(Port13)"] } }, - + "Ethernet13": { "index": "14", "lanes": "22", @@ -484,7 +629,7 @@ "1x25G": ["Eth18(Port18)"] } }, - + "Ethernet18": { "index": "19", "lanes": "29", @@ -605,7 +750,7 @@ } }, - "Ethernet33": { + "Ethernet33": { "index": "34", "lanes": "58", "breakout_modes": { @@ -645,7 +790,7 @@ } }, - "Ethernet38": { + "Ethernet38": { "index": "39", "lanes": "64", "breakout_modes": { @@ -685,7 +830,7 @@ } }, - "Ethernet43": { + "Ethernet43": { "index": "44", "lanes": "69", "breakout_modes": { diff --git a/device/accton/x86_64-accton_as7326_56x-r0/platform_components.json b/device/accton/x86_64-accton_as7326_56x-r0/platform_components.json new file mode 100644 index 0000000000..c32d4ac00d --- /dev/null +++ b/device/accton/x86_64-accton_as7326_56x-r0/platform_components.json @@ -0,0 +1,14 @@ +{ + "chassis": { + "7326-56X-O-AC-F": { + "component": { + "MB_CPLD1": { }, + "MB_CPLD2": { }, + "MB_CPLD3": { }, + "FAN_CPLD": { }, + "CPU_CPLD": { }, + "BIOS": { } + } + } + } +} diff --git a/device/accton/x86_64-accton_as7326_56x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7326_56x-r0/plugins/sfputil.py index 965e876691..26ddfca49e 100644 --- a/device/accton/x86_64-accton_as7326_56x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as7326_56x-r0/plugins/sfputil.py @@ -4,6 +4,7 @@ # try: + import sys import time import string from ctypes import create_string_buffer @@ -205,7 +206,10 @@ def set_low_power_mode(self, port_num, lpmode): # Fill in write buffer regval = 0x3 if lpmode else 0x1 # 0x3:Low Power Mode, 0x1:High Power Mode buffer = create_string_buffer(1) - buffer[0] = chr(regval) + 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], "r+b") @@ -220,6 +224,22 @@ def set_low_power_mode(self, port_num, lpmode): eeprom.close() time.sleep(0.01) + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + return fd.read().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 Exception: + return False + return True + def reset(self, port_num): if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: return False @@ -228,21 +248,20 @@ def reset(self, port_num): cpld_ps = self._cpld_mapping[cpld_i] path = "/sys/bus/i2c/devices/{0}/module_reset_{1}" port_ps = path.format(cpld_ps, port_num) - self.__port_to_mod_rst = port_ps - try: - reg_file = open(self.__port_to_mod_rst, 'r+', buffering=0) - except IOError as e: - print("Error: unable to open file: %s" % str(e)) - return False + + ret = self.__write_txt_file( + self.__port_to_mod_rst, 1) + if ret is not True: + return ret - # toggle reset - reg_file.seek(0) - reg_file.write('1') time.sleep(1) - reg_file.seek(0) - reg_file.write('0') - reg_file.close() + ret = self.__write_txt_file( + self.__port_to_mod_rst, 0) + + if ret is not True: + return ret + time.sleep(0.1) return True diff --git a/device/accton/x86_64-accton_as7326_56x-r0/pmon_daemon_control.json b/device/accton/x86_64-accton_as7326_56x-r0/pmon_daemon_control.json index a3b204e20d..44bad64942 100644 --- a/device/accton/x86_64-accton_as7326_56x-r0/pmon_daemon_control.json +++ b/device/accton/x86_64-accton_as7326_56x-r0/pmon_daemon_control.json @@ -1,5 +1,4 @@ { - "skip_ledd": true, - "skip_pcied": true + "skip_ledd": true } diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/__init__.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/__init__.py deleted file mode 100644 index 73a7720e89..0000000000 --- a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -__all__ = [ "platform", "chassis", "sfp", "eeprom", "component", "psu", "thermal", "fan", "fan_drawer" ] -from . import platform diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/sfp.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/sfp.py deleted file mode 100644 index 16fe60bfb6..0000000000 --- a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/sfp.py +++ /dev/null @@ -1,625 +0,0 @@ -############################################################################# -# Edgecore -# -# Sfp contains an implementation of SONiC Platform Base API and -# provides the sfp device status which are available in the platform -# -############################################################################# - -import time -import sys -import subprocess -from ctypes import create_string_buffer - -try: - from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase - from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper -except ImportError as e: - raise ImportError(str(e) + "- required module not found") - -CPLD_ADDR_MAPPING = { - 0: { - "bus": 18, - "addr": "60" - }, # port 31-56 - 1: { - "bus": 12, - "addr": "62" - }, # port 1-30 -} -CPLD_I2C_PATH = "/sys/bus/i2c/devices/{}-00{}/" - -class Sfp(SfpOptoeBase): - """Platform-specific Sfp class""" - - # Port number - PORT_START = 1 - PORT_END = 58 - - # Path to sysfs - PLATFORM_ROOT_PATH = "/usr/share/sonic/device" - PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" - HOST_CHK_CMD = ["which", "systemctl"] - - PLATFORM = "x86_64-accton_as7326_56x-r0" - HWSKU = "Accton-AS7326-56X" - - _port_to_i2c_mapping = { - 1: [42], - 2: [41], - 3: [44], - 4: [43], - 5: [47], - 6: [45], - 7: [46], - 8: [50], - 9: [48], - 10: [49], - 11: [52], - 12: [51], - 13: [53], - 14: [56], - 15: [55], - 16: [54], - 17: [58], - 18: [57], - 19: [60], - 20: [59], - 21: [61], - 22: [63], - 23: [62], - 24: [64], - 25: [66], - 26: [68], - 27: [65], - 28: [67], - 29: [69], - 30: [71], - 31: [72], - 32: [70], - 33: [74], - 34: [73], - 35: [76], - 36: [75], - 37: [77], - 38: [79], - 39: [78], - 40: [80], - 41: [81], - 42: [82], - 43: [84], - 44: [85], - 45: [83], - 46: [87], - 47: [88], - 48: [86], - 49: [25], - 50: [26], - 51: [27], - 52: [28], - 53: [29], - 54: [30], - 55: [31], - 56: [32], - 57: [22], - 58: [23] - } - - def __init__(self, sfp_index=0): - SfpOptoeBase.__init__(self) - # Init index - self.index = sfp_index - self.port_num = self.index + 1 - - cpld_idx = 0 if self.port_num > 30 else 1 - bus = CPLD_ADDR_MAPPING[cpld_idx]["bus"] - addr = CPLD_ADDR_MAPPING[cpld_idx]["addr"] - self.cpld_path = CPLD_I2C_PATH.format(bus, addr) - - # Init eeprom path - eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom' - self.port_to_eeprom_mapping = {} - for x in range(self.PORT_START, self.PORT_END + 1): - self.port_to_eeprom_mapping[x] = eeprom_path.format( - self._port_to_i2c_mapping[x][0]) - - def get_eeprom_path(self): - return self.port_to_eeprom_mapping[self.port_num] - - def __read_txt_file(self, file_path): - try: - with open(file_path, 'r') as fd: - return fd.read().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 Exception: - return False - return True - - def __is_host(self): - return subprocess.call(self.HOST_CHK_CMD) == 0 - - def __get_path_to_port_config_file(self): - platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) - hwsku_path = "/".join( - [platform_path, - self.HWSKU]) if self.__is_host() else self.PMON_HWSKU_PATH - return "/".join([hwsku_path, "port_config.ini"]) - - def __read_eeprom_specific_bytes(self, offset, num_bytes): - sysfsfile_eeprom = None - eeprom_raw = [] - for i in range(0, num_bytes): - eeprom_raw.append("0x00") - - sysfs_sfp_i2c_client_eeprom_path = self.port_to_eeprom_mapping[ - self.port_num] - try: - sysfsfile_eeprom = open( - sysfs_sfp_i2c_client_eeprom_path, mode="rb", buffering=0) - sysfsfile_eeprom.seek(offset) - raw = sysfsfile_eeprom.read(num_bytes) - for n in range(0, num_bytes): - if sys.version_info[0] >= 3: - eeprom_raw[n] = hex(raw[n])[2:].zfill(2) - else: - eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) - except Exception: - pass - finally: - if sysfsfile_eeprom: - sysfsfile_eeprom.close() - - return eeprom_raw - - def get_reset_status(self): - """ - Retrieves the reset status of SFP - Returns: - A Boolean, True if reset enabled, False if disabled - """ - if self.port_num <= 48 or self.port_num >=57: - return False # SPF port doesn't support this feature - - val = self.__read_txt_file( - self.cpld_path + "module_reset_" + str(self.port_num)) - return int(val, 10) == 1 - - def get_rx_los(self): - """ - Retrieves the RX LOS (lost-of-signal) status of SFP - Returns: - A Boolean, True if SFP has RX LOS, False if not. - Note : RX LOS status is latched until a call to get_rx_los or a reset. - """ - if self.port_num <= 48 or self.port_num >=57: - rx_los = self.__read_txt_file( - self.cpld_path + "module_rx_los_" + str(self.port_num)) - if int(rx_los, 10) == 1: - return [True] - else: - return [False] - #status_control_raw = self.__read_eeprom_specific_bytes( - # SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - #if status_control_raw: - # data = int(status_control_raw[0], 16) - # rx_los = (sffbase().test_bit(data, 1) != 0) - else: - rx_los_list = [] - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - QSFP_CHANNL_RX_LOS_STATUS_OFFSET, - QSFP_CHANNL_RX_LOS_STATUS_WIDTH) if self.get_presence( - ) else None - if dom_channel_monitor_raw is not None: - rx_los_data = int(dom_channel_monitor_raw[0], 16) - rx_los_list.append(rx_los_data & 0x01 != 0) - rx_los_list.append(rx_los_data & 0x02 != 0) - rx_los_list.append(rx_los_data & 0x04 != 0) - rx_los_list.append(rx_los_data & 0x08 != 0) - return rx_los_list - else: - return [False]*4 - - def get_tx_fault(self): - """ - Retrieves the TX fault status of SFP - - Returns: - A list of boolean values, representing the TX fault status - of each available channel, value is True if SFP channel - has TX fault, False if not. - E.g., for a tranceiver with four channels: [False, False, True, False] - Note : TX fault status is lached until a call to get_tx_fault or a reset. - """ - tx_fault = False - if self.port_num <= 48 or self.port_num >=57: - tx_fault = self.__read_txt_file( - self.cpld_path + "module_tx_fault_" + str(self.port_num)) - if int(tx_fault, 10) == 1: - return [True] - else: - return [False] - #status_control_raw = self.__read_eeprom_specific_bytes( - # SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - #if status_control_raw: - # data = int(status_control_raw[0], 16) - # tx_fault = (sffbase().test_bit(data, 2) != 0) - else: - tx_fault_list = [] - dom_channel_monitor_raw = self.__read_eeprom_specific_bytes( - QSFP_CHANNL_TX_FAULT_STATUS_OFFSET, - QSFP_CHANNL_TX_FAULT_STATUS_WIDTH) if self.get_presence( - ) else None - if dom_channel_monitor_raw is not None: - tx_fault_data = int(dom_channel_monitor_raw[0], 16) - tx_fault_list.append(tx_fault_data & 0x01 != 0) - tx_fault_list.append(tx_fault_data & 0x02 != 0) - tx_fault_list.append(tx_fault_data & 0x04 != 0) - tx_fault_list.append(tx_fault_data & 0x08 != 0) - return tx_fault_list - else: - return [False]*4 - - - def get_tx_disable(self): - """ - Retrieves the tx_disable status of this SFP - Returns: - A list of boolean values, representing the TX disable status - of each available channel, value is True if SFP channel - is TX disabled, False if not. - E.g., for a tranceiver with four channels: [False, False, True, False] - """ - if self.port_num <= 48 or self.port_num >=57: - tx_disable = False - - status_control_raw = self.__read_eeprom_specific_bytes( - SFP_STATUS_CONTROL_OFFSET, SFP_STATUS_CONTROL_WIDTH) - if status_control_raw: - cpld_val = self.__read_txt_file( - self.cpld_path + "module_tx_disable_" + str(self.port_num)) - tx_disable_hard = (int(cpld_val, 10) == 1) - data = int(status_control_raw[0], 16) - #tx_disable_hard = (sffbase().test_bit( - # data, SFP_TX_DISABLE_HARD_BIT) != 0) - tx_disable_soft = (sffbase().test_bit( - data, SFP_TX_DISABLE_SOFT_BIT) != 0) - tx_disable = tx_disable_hard | tx_disable_soft - if tx_disable==0: - return [False] - else: - return [True] - - else: - return [False] - - else: - tx_disable_list = [] - - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return [False] - - dom_control_raw = self.__read_eeprom_specific_bytes( - QSFP_CONTROL_OFFSET, - QSFP_CONTROL_WIDTH) if self.get_presence() else None - if dom_control_raw is not None: - dom_control_data = sfpd_obj.parse_control_bytes( - dom_control_raw, 0) - tx_disable_list.append( - 'On' == dom_control_data['data']['TX1Disable']['value']) - tx_disable_list.append( - 'On' == dom_control_data['data']['TX2Disable']['value']) - tx_disable_list.append( - 'On' == dom_control_data['data']['TX3Disable']['value']) - tx_disable_list.append( - 'On' == dom_control_data['data']['TX4Disable']['value']) - return tx_disable_list - else: - return [False]*4 - - def get_tx_disable_channel(self): - """ - Retrieves the TX disabled channels in this SFP - Returns: - A hex of 4 bits (bit 0 to bit 3 as channel 0 to channel 3) to represent - TX channels which have been disabled in this SFP. - As an example, a returned value of 0x5 indicates that channel 0 - and channel 2 have been disabled. - """ - tx_disable_list = self.get_tx_disable() - if tx_disable_list is None: - return 0 - tx_disabled = 0 - for i in range(len(tx_disable_list)): - if tx_disable_list[i]: - tx_disabled |= 1 << i - return tx_disabled - - def get_lpmode(self): - """ - Retrieves the lpmode (low power mode) status of this SFP - Returns: - A Boolean, True if lpmode is enabled, False if disabled - """ - if self.port_num <= 48 or self.port_num >= 57: - # SFP doesn't support this feature - return False - - power_set = self.get_power_set() - power_override = self.get_power_override() - return power_set and power_override - - def get_power_set(self): - - if self.port_num <= 48 or self.port_num >= 57: - # SFP doesn't support this feature - return False - else: - power_set = False - - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return False - - dom_control_raw = self.__read_eeprom_specific_bytes( - QSFP_CONTROL_OFFSET, - QSFP_CONTROL_WIDTH) if self.get_presence() else None - if dom_control_raw is not None: - dom_control_data = sfpd_obj.parse_control_bytes( - dom_control_raw, 0) - power_set = ( - 'On' == dom_control_data['data']['PowerSet']['value']) - - return power_set - - def get_power_override(self): - """ - Retrieves the power-override status of this SFP - Returns: - A Boolean, True if power-override is enabled, False if disabled - """ - if self.port_num <= 48 or self.port_num >= 57: - return False # SFP doesn't support this feature - else: - power_override = False - - sfpd_obj = sff8436Dom() - if sfpd_obj is None: - return False - - dom_control_raw = self.__read_eeprom_specific_bytes( - QSFP_CONTROL_OFFSET, - QSFP_CONTROL_WIDTH) if self.get_presence() else None - if dom_control_raw is not None: - dom_control_data = sfpd_obj.parse_control_bytes( - dom_control_raw, 0) - power_override = ( - 'On' == dom_control_data['data']['PowerOverride']['value']) - - return power_override - - def reset(self): - """ - Reset SFP and return all user module settings to their default srate. - Returns: - A boolean, True if successful, False if not - """ - # Check for invalid port_num - if self.port_num <= 48 or self.port_num >=57: - return False # SFP doesn't support this feature - - ret = self.__write_txt_file( - self.cpld_path + "module_reset_" + str(self.port_num), 1) - if ret is not True: - return ret - - time.sleep(0.01) - ret = self.__write_txt_file( - self.cpld_path + "module_reset_" + str(self.port_num), 0) - time.sleep(0.2) - return ret - - def tx_disable(self, tx_disable): - """ - Disable SFP TX for all channels - Args: - tx_disable : A Boolean, True to enable tx_disable mode, False to disable - tx_disable mode. - Returns: - A boolean, True if tx_disable is set successfully, False if not - """ - if self.port_num <= 48 or self.port_num >=57: - ret = self.__write_txt_file( - self.cpld_path + "module_tx_disable_" + str(self.port_num), 1 - if tx_disable else 0) - time.sleep(0.01) - return ret - else: - if not self.get_presence(): - return False - - sysfsfile_eeprom = None - try: - tx_disable_ctl = 0xf if tx_disable else 0x0 - buffer = create_string_buffer(1) - if sys.version_info[0] >= 3: - buffer[0] = tx_disable_ctl - else: - buffer[0] = chr(tx_disable_ctl) - # Write to eeprom - sysfsfile_eeprom = open( - self.port_to_eeprom_mapping[self.port_num], "r+b") - sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) - sysfsfile_eeprom.write(buffer[0]) - except IOError as e: - print("Error: unable to open file: %s" % str(e)) - return False - finally: - if sysfsfile_eeprom is not None: - sysfsfile_eeprom.close() - time.sleep(0.01) - return True - - def tx_disable_channel(self, channel, disable): - """ - Sets the tx_disable for specified SFP channels - Args: - channel : A hex of 4 bits (bit 0 to bit 3) which represent channel 0 to 3, - e.g. 0x5 for channel 0 and channel 2. - disable : A boolean, True to disable TX channels specified in channel, - False to enable - Returns: - A boolean, True if successful, False if not - """ - - if self.port_num <= 48 or self.port_num >=57: - return False # SFP doesn't support this feature - else: - if not self.get_presence(): - return False - - sysfsfile_eeprom = None - try: - channel_state = self.get_tx_disable_channel() - - for i in range(4): - channel_mask = (1 << i) - if not (channel & channel_mask): - continue - - if disable: - channel_state |= channel_mask - else: - channel_state &= ~channel_mask - - buffer = create_string_buffer(1) - if sys.version_info[0] >= 3: - buffer[0] = channel_state - else: - buffer[0] = chr(channel_state) - # Write to eeprom - sysfsfile_eeprom = open( - self.port_to_eeprom_mapping[self.port_num], "r+b") - sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) - sysfsfile_eeprom.write(buffer[0]) - except IOError as e: - print("Error: unable to open file: %s" % str(e)) - return False - finally: - if sysfsfile_eeprom is not None: - sysfsfile_eeprom.close() - time.sleep(0.01) - return True - - def set_lpmode(self, lpmode): - """ - Sets the lpmode (low power mode) of SFP - Args: - lpmode: A Boolean, True to enable lpmode, False to disable it - Note : lpmode can be overridden by set_power_override - Returns: - A boolean, True if lpmode is set successfully, False if not - """ - if self.port_num <= 48 or self.port_num >=57: - return False # SFP doesn't support this feature - - if lpmode: - return self.set_power_override(True, True) - else: - return self.set_power_override(True, False) - - def set_power_override(self, power_override, power_set): - """ - Sets SFP power level using power_override and power_set - Args: - power_override : - A Boolean, True to override set_lpmode and use power_set - to control SFP power, False to disable SFP power control - through power_override/power_set and use set_lpmode - to control SFP power. - power_set : - Only valid when power_override is True. - A Boolean, True to set SFP to low power mode, False to set - SFP to high power mode. - Returns: - A boolean, True if power-override and power_set are set successfully, - False if not - """ - if self.port_num <= 48 or self.port_num >=57: - return False # SFP doesn't support this feature - else: - if not self.get_presence(): - return False - try: - power_override_bit = (1 << 0) if power_override else 0 - power_set_bit = (1 << 1) if power_set else (1 << 3) - - buffer = create_string_buffer(1) - if sys.version_info[0] >= 3: - buffer[0] = (power_override_bit | power_set_bit) - else: - buffer[0] = chr(power_override_bit | power_set_bit) - # Write to eeprom - with open(self.port_to_eeprom_mapping[self.port_num], - "r+b") as fd: - fd.seek(QSFP_POWEROVERRIDE_OFFSET) - fd.write(buffer[0]) - time.sleep(0.01) - except Exception: - print("Error: unable to open file: %s" % str(e)) - return False - return True - - def get_name(self): - """ - Retrieves the name of the device - Returns: - string: The name of the device - """ - sfputil_helper = SfpUtilHelper() - sfputil_helper.read_porttab_mappings( - self.__get_path_to_port_config_file()) - name = sfputil_helper.logical[self.index] or "Unknown" - return name - - def get_presence(self): - """ - Retrieves the presence of the device - Returns: - bool: True if device is present, False if not - """ - val = self.__read_txt_file( - self.cpld_path + "module_present_" + str(self.port_num)) - return val == '1' - - def get_status(self): - """ - Retrieves the operational status of the device - Returns: - A boolean value, True if device is operating properly, False if not - """ - return self.get_presence() - - def get_position_in_parent(self): - """ - Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position - for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned - Returns: - integer: The 1-based relative physical position in parent device or -1 if cannot determine the position - """ - return self.port_num - - def is_replaceable(self): - """ - Indicate whether this device is replaceable. - Returns: - bool: True if it is replaceable. - """ - return True diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/thermal.py b/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/thermal.py deleted file mode 100644 index b2233e7b5a..0000000000 --- a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/thermal.py +++ /dev/null @@ -1,232 +0,0 @@ -############################################################################# -# Edgecore -# -# 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 -import glob - -try: - from sonic_platform_base.thermal_base import ThermalBase -except ImportError as e: - raise ImportError(str(e) + "- required module not found") - -PSU_I2C_PATH = "/sys/bus/i2c/devices/{}-00{}/" -PSU_HWMON_I2C_MAPPING = { - 0: { - "bus": 17, - "addr": "59" - }, - 1: { - "bus": 13, - "addr": "5b" - }, -} - -PSU_CPLD_I2C_MAPPING = { - 0: { - "bus": 17, - "addr": "51" - }, - 1: { - "bus": 13, - "addr": "53" - }, -} - - -class Thermal(ThermalBase): - """Platform-specific Thermal class""" - - THERMAL_NAME_LIST = [] - PSU_THERMAL_NAME_LIST = [] - SYSFS_PATH = "/sys/bus/i2c/devices" - - def __init__(self, thermal_index=0, is_psu=False, psu_index=0): - self.index = thermal_index - self.is_psu = is_psu - self.psu_index = psu_index - - if self.is_psu: - psu_i2c_bus = PSU_HWMON_I2C_MAPPING[psu_index]["bus"] - psu_i2c_addr = PSU_HWMON_I2C_MAPPING[psu_index]["addr"] - self.psu_hwmon_path = PSU_I2C_PATH.format(psu_i2c_bus, - psu_i2c_addr) - psu_i2c_bus = PSU_CPLD_I2C_MAPPING[psu_index]["bus"] - psu_i2c_addr = PSU_CPLD_I2C_MAPPING[psu_index]["addr"] - self.cpld_path = PSU_I2C_PATH.format(psu_i2c_bus, psu_i2c_addr) - - # Add thermal name - self.THERMAL_NAME_LIST.append("Temp sensor 1") - self.THERMAL_NAME_LIST.append("Temp sensor 2") - self.THERMAL_NAME_LIST.append("Temp sensor 3") - self.THERMAL_NAME_LIST.append("Temp sensor 4") - self.PSU_THERMAL_NAME_LIST.append("PSU-1 temp sensor 1") - self.PSU_THERMAL_NAME_LIST.append("PSU-2 temp sensor 1") - - # Set hwmon path - i2c_path = { - 0: "15-0048/hwmon/hwmon*/", - 1: "15-0049/hwmon/hwmon*/", - 2: "15-004a/hwmon/hwmon*/", - 3: "15-004b/hwmon/hwmon*/" - }.get(self.index, None) - - self.hwmon_path = "{}/{}".format(self.SYSFS_PATH, i2c_path) - self.ss_key = self.THERMAL_NAME_LIST[self.index] - self.ss_index = 1 - - def __read_txt_file(self, file_path): - for filename in glob.glob(file_path): - try: - with open(filename, 'r') as fd: - return fd.readline().rstrip() - except IOError as e: - pass - - def __get_temp(self, temp_file): - if not self.is_psu: - temp_file_path = os.path.join(self.hwmon_path, temp_file) - else: - temp_file_path = temp_file - - raw_temp = self.__read_txt_file(temp_file_path) - return float(raw_temp) / 1000 - - def __set_threshold(self, file_name, temperature): - if self.is_psu: - return True - - 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 - """ - if not self.is_psu: - temp_file = "temp{}_input".format(self.ss_index) - else: - temp_file = self.psu_hwmon_path + "psu_temp1_input" - - 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 - """ - if self.is_psu: - return 0 - - temp_file = "temp{}_max".format(self.ss_index) - return self.__get_temp(temp_file) - - 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 - """ - temp_file = "temp{}_max".format(self.ss_index) - temperature = temperature *1000 - self.__set_threshold(temp_file, temperature) - - return True - - def get_name(self): - """ - Retrieves the name of the thermal device - Returns: - string: The name of the thermal device - """ - if self.is_psu: - return self.PSU_THERMAL_NAME_LIST[self.psu_index] - else: - 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 - """ - if self.is_psu: - val = self.__read_txt_file(self.cpld_path + "psu_present") - return int(val, 10) == 1 - - temp_file = "temp{}_input".format(self.ss_index) - temp_file_path = os.path.join(self.hwmon_path, temp_file) - raw_txt = self.__read_txt_file(temp_file_path) - return raw_txt != None - - 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 self.is_psu: - temp_file = self.psu_hwmon_path + "psu_temp_fault" - return self.get_presence() and (not int( - self.__read_txt_file(temp_file))) - - file_str = "temp{}_input".format(self.ss_index) - file_path = os.path.join(self.hwmon_path, file_str) - - raw_txt = self.__read_txt_file(file_path) - if raw_txt is None: - return False - else: - return int(raw_txt) != 0 - - def get_model(self): - """ - Retrieves the model number (or part number) of the device - Returns: - string: Model/part number of device - """ - - return "N/A" - - def get_serial(self): - """ - Retrieves the serial number of the device - Returns: - string: Serial number of device - """ - return "N/A" - - def get_position_in_parent(self): - """ - Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position - for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned - Returns: - integer: The 1-based relative physical position in parent device or -1 if cannot determine the position - """ - return self.index+1 - - def is_replaceable(self): - """ - Retrieves whether thermal module is replaceable - Returns: - A boolean value, True if replaceable, False if not - """ - return False diff --git a/device/accton/x86_64-accton_as7326_56x-r0/system_health_monitoring_config.json b/device/accton/x86_64-accton_as7326_56x-r0/system_health_monitoring_config.json index 18d47b22a9..5aacf0c3bb 100644 --- a/device/accton/x86_64-accton_as7326_56x-r0/system_health_monitoring_config.json +++ b/device/accton/x86_64-accton_as7326_56x-r0/system_health_monitoring_config.json @@ -2,14 +2,14 @@ "services_to_ignore": [], "devices_to_ignore": [ "asic", + "psu.voltage", "psu.temperature" - ], "user_defined_checkers": [], "polling_interval": 60, "led_color": { - "fault": "STATUS_LED_COLOR_RED", - "normal": "STATUS_LED_COLOR_GREEN", - "booting": "STATUS_LED_COLOR_GREEN_BLINK" + "fault": "red", + "normal": "green", + "booting": "green_blink" } } diff --git a/device/accton/x86_64-accton_as7712_32x-r0/media_settings.json b/device/accton/x86_64-accton_as7712_32x-r0/media_settings.json new file mode 100644 index 0000000000..14669dee59 --- /dev/null +++ b/device/accton/x86_64-accton_as7712_32x-r0/media_settings.json @@ -0,0 +1,324 @@ +{ + "PORT_MEDIA_SETTINGS": { + "1": { + "Default": { + "preemphasis": { + "lane0": "0x264204", + "lane1": "0x264204", + "lane2": "0x264204", + "lane3": "0x264204" + } + } + }, + "2": { + "Default": { + "preemphasis": { + "lane0": "0x224406", + "lane1": "0x224406", + "lane2": "0x264204", + "lane3": "0x244206" + } + } + }, + "3": { + "Default": { + "preemphasis": { + "lane0": "0x204606", + "lane1": "0x264204", + "lane2": "0x204606", + "lane3": "0x224406" + } + } + }, + "4": { + "Default": { + "preemphasis": { + "lane0": "0x204606", + "lane1": "0x224406", + "lane2": "0x224406", + "lane3": "0x244206" + } + } + }, + "5": { + "Default": { + "preemphasis": { + "lane0": "0x204606", + "lane1": "0x204606", + "lane2": "0x204606", + "lane3": "0x204606" + } + } + }, + "6": { + "Default": { + "preemphasis": { + "lane0": "0x204606", + "lane1": "0x204606", + "lane2": "0x204606", + "lane3": "0x224406" + } + } + }, + "7": { + "Default": { + "preemphasis": { + "lane0": "0x204606", + "lane1": "0x204606", + "lane2": "0x204606", + "lane3": "0x204606" + } + } + }, + "8": { + "Default": { + "preemphasis": { + "lane0": "0x204606", + "lane1": "0x204606", + "lane2": "0x204606", + "lane3": "0x204606" + } + } + }, + "9": { + "Default": { + "preemphasis": { + "lane0": "0x284601", + "lane1": "0x284601", + "lane2": "0x284601", + "lane3": "0x284601" + } + } + }, + "10": { + "Default": { + "preemphasis": { + "lane0": "0x204604", + "lane1": "0x204604", + "lane2": "0x224406", + "lane3": "0x224406" + } + } + }, + "11": { + "Default": { + "preemphasis": { + "lane0": "0x284601", + "lane1": "0x294501", + "lane2": "0x284601", + "lane3": "0x284601" + } + } + }, + "12": { + "Default": { + "preemphasis": { + "lane0": "0x204802", + "lane1": "0x204802", + "lane2": "0x204802", + "lane3": "0x204802" + } + } + }, + "13": { + "Default": { + "preemphasis": { + "lane0": "0x1e4f01", + "lane1": "0x1e4d01", + "lane2": "0x1e4f01", + "lane3": "0x1e4f01" + } + } + }, + "14": { + "Default": { + "preemphasis": { + "lane0": "0x1f4a03", + "lane1": "0x1f4a03", + "lane2": "0x1f4a03", + "lane3": "0x1f4a03" + } + } + }, + "15": { + "Default": { + "preemphasis": { + "lane0": "0x1e4f01", + "lane1": "0x1e4f01", + "lane2": "0x1e4f01", + "lane3": "0x1e4f01" + } + } + }, + "16": { + "Default": { + "preemphasis": { + "lane0": "0x1e4e02", + "lane1": "0x1e4e02", + "lane2": "0x1e4e02", + "lane3": "0x1e4e02" + } + } + }, + "17": { + "Default": { + "preemphasis": { + "lane0": "0x1e4f01", + "lane1": "0x1e4f01", + "lane2": "0x1e4f01", + "lane3": "0x1e4f01" + } + } + }, + "18": { + "Default": { + "preemphasis": { + "lane0": "0x1e4e02", + "lane1": "0x1e4e02", + "lane2": "0x1e4e02", + "lane3": "0x1e4e02" + } + } + }, + "19": { + "Default": { + "preemphasis": { + "lane0": "0x1c4d02", + "lane1": "0x195002", + "lane2": "0x195002", + "lane3": "0x195002" + } + } + }, + "20": { + "Default": { + "preemphasis": { + "lane0": "0x1e4e02", + "lane1": "0x1e4e02", + "lane2": "0x1e4e02", + "lane3": "0x1e4e02" + } + } + }, + "21": { + "Default": { + "preemphasis": { + "lane0": "0x234701", + "lane1": "0x234701", + "lane2": "0x234701", + "lane3": "0x234701" + } + } + }, + "22": { + "Default": { + "preemphasis": { + "lane0": "0x224802", + "lane1": "0x224602", + "lane2": "0x224802", + "lane3": "0x224802" + } + } + }, + "23": { + "Default": { + "preemphasis": { + "lane0": "0x234801", + "lane1": "0x244701", + "lane2": "0x234801", + "lane3": "0x234601" + } + } + }, + "24": { + "Default": { + "preemphasis": { + "lane0": "0x204406", + "lane1": "0x204406", + "lane2": "0x204406", + "lane3": "0x224602" + } + } + }, + "25": { + "Default": { + "preemphasis": { + "lane0": "0x204606", + "lane1": "0x235002", + "lane2": "0x204606", + "lane3": "0x204606" + } + } + }, + "26": { + "Default": { + "preemphasis": { + "lane0": "0x204606", + "lane1": "0x204606", + "lane2": "0x204606", + "lane3": "0x204606" + } + } + }, + "27": { + "Default": { + "preemphasis": { + "lane0": "0x204606", + "lane1": "0x224406", + "lane2": "0x224406", + "lane3": "0x224406" + } + } + }, + "28": { + "Default": { + "preemphasis": { + "lane0": "0x224406", + "lane1": "0x204606", + "lane2": "0x204606", + "lane3": "0x224406" + } + } + }, + "29": { + "Default": { + "preemphasis": { + "lane0": "0x224406", + "lane1": "0x224406", + "lane2": "0x224406", + "lane3": "0x224406" + } + } + }, + "30": { + "Default": { + "preemphasis": { + "lane0": "0x244404", + "lane1": "0x244404", + "lane2": "0x244404", + "lane3": "0x244404" + } + } + }, + "31": { + "Default": { + "preemphasis": { + "lane0": "0x234504", + "lane1": "0x234404", + "lane2": "0x224406", + "lane3": "0x224406" + } + } + }, + "32": { + "Default": { + "preemphasis": { + "lane0": "0x244404", + "lane1": "0x244404", + "lane2": "0x234504", + "lane3": "0x264501" + } + } + } + } +} \ No newline at end of file diff --git a/device/accton/x86_64-accton_as7726_32x-r0/Accton-AS7726-32X/td3-as7726-32x100G.config.bcm b/device/accton/x86_64-accton_as7726_32x-r0/Accton-AS7726-32X/td3-as7726-32x100G.config.bcm index 1dcd7e3ef5..9e37b65bcd 100755 --- a/device/accton/x86_64-accton_as7726_32x-r0/Accton-AS7726-32X/td3-as7726-32x100G.config.bcm +++ b/device/accton/x86_64-accton_as7726_32x-r0/Accton-AS7726-32X/td3-as7726-32x100G.config.bcm @@ -35,6 +35,16 @@ skip_L2_USER_ENTRY=0 bcm_tunnel_term_compatible_mode=1 l3_alpm_ipv6_128b_bkt_rsvd=1 phy_an_c73=1 +l3_ecmp_levels=2 + +use_all_splithorizon_groups=1 +riot_enable=1 +sai_tunnel_support=1 +riot_overlay_l3_intf_mem_size=4096 +riot_overlay_l3_egress_mem_size=32768 +riot_overlay_ecmp_resilient_hash_size=16384 +flow_init_mode=1 +host_as_route_disable=1 dport_map_port_1=1 dport_map_port_5=2 diff --git a/device/accton/x86_64-accton_as7726_32x-r0/pcie.yaml b/device/accton/x86_64-accton_as7726_32x-r0/pcie.yaml new file mode 100644 index 0000000000..c019a23aa0 --- /dev/null +++ b/device/accton/x86_64-accton_as7726_32x-r0/pcie.yaml @@ -0,0 +1,471 @@ +- bus: '00' + dev: '00' + fn: '0' + id: 6f00 + name: 'Host bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D DMI2 + (rev 03)' +- bus: '00' + dev: '01' + fn: '0' + id: 6f02 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 1 (rev 03)' +- bus: '00' + dev: '01' + fn: '1' + id: 6f03 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 1 (rev 03)' +- bus: '00' + dev: '02' + fn: '0' + id: 6f04 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 2 (rev 03)' +- bus: '00' + dev: '02' + fn: '1' + id: 6f05 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 2 (rev 03)' +- bus: '00' + dev: '02' + fn: '2' + id: 6f06 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 2 (rev 03)' +- bus: '00' + dev: '02' + fn: '3' + id: 6f07 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 2 (rev 03)' +- bus: '00' + dev: '03' + fn: '0' + id: 6f08 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 3 (rev 03)' +- bus: '00' + dev: '03' + fn: '1' + id: 6f09 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 3 (rev 03)' +- bus: '00' + dev: '03' + fn: '2' + id: 6f0a + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 3 (rev 03)' +- bus: '00' + dev: '03' + fn: '3' + id: 6f0b + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 3 (rev 03)' +- bus: '00' + dev: '05' + fn: '0' + id: 6f28 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Map/VTd_Misc/System Management (rev 03)' +- bus: '00' + dev: '05' + fn: '1' + id: 6f29 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D IIO Hot Plug (rev 03)' +- bus: '00' + dev: '05' + fn: '2' + id: 6f2a + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D IIO RAS/Control Status/Global Errors (rev 03)' +- bus: '00' + dev: '05' + fn: '4' + id: 6f2c + name: 'PIC: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D I/O APIC (rev + 03)' +- bus: '00' + dev: '14' + fn: '0' + id: 8c31 + name: 'USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB + xHCI (rev 05)' +- bus: '00' + dev: '16' + fn: '0' + id: 8c3a + name: 'Communication controller: Intel Corporation 8 Series/C220 Series Chipset + Family MEI Controller #1 (rev 04)' +- bus: '00' + dev: '16' + fn: '1' + id: 8c3b + name: 'Communication controller: Intel Corporation 8 Series/C220 Series Chipset + Family MEI Controller #2 (rev 04)' +- bus: '00' + dev: 1c + fn: '0' + id: 8c10 + name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express + Root Port #1 (rev d5)' +- bus: '00' + dev: 1c + fn: '1' + id: 8c12 + name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express + Root Port #2 (rev d5)' +- bus: '00' + dev: 1c + fn: '4' + id: 8c18 + name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express + Root Port #5 (rev d5)' +- bus: '00' + dev: 1d + fn: '0' + id: 8c26 + name: 'USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB + EHCI #1 (rev 05)' +- bus: '00' + dev: 1f + fn: '0' + id: 8c54 + name: 'ISA bridge: Intel Corporation C224 Series Chipset Family Server Standard + SKU LPC Controller (rev 05)' +- bus: '00' + dev: 1f + fn: '2' + id: 8c02 + name: 'SATA controller: Intel Corporation 8 Series/C220 Series Chipset Family 6-port + SATA Controller 1 [AHCI mode] (rev 05)' +- bus: '00' + dev: 1f + fn: '3' + id: 8c22 + name: 'SMBus: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller + (rev 05)' +- bus: '03' + dev: '00' + fn: '0' + id: 6f50 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 0' +- bus: '03' + dev: '00' + fn: '1' + id: 6f51 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 1' +- bus: '03' + dev: '00' + fn: '2' + id: 6f52 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 2' +- bus: '03' + dev: '00' + fn: '3' + id: 6f53 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 3' +- bus: '05' + dev: '00' + fn: '0' + id: 15ab + name: 'Ethernet controller: Intel Corporation Ethernet Connection X552 10 GbE Backplane' +- bus: '05' + dev: '00' + fn: '1' + id: 15ab + name: 'Ethernet controller: Intel Corporation Ethernet Connection X552 10 GbE Backplane' +- bus: '07' + dev: '00' + fn: '0' + id: b870 + name: 'Ethernet controller: Broadcom Inc. and subsidiaries Device b870 (rev 01)' +- bus: 0b + dev: '00' + fn: '0' + id: 165f + name: 'Ethernet controller: Broadcom Inc. and subsidiaries NetXtreme BCM5720 2-port + Gigabit Ethernet PCIe' +- bus: ff + dev: 0b + fn: '0' + id: 6f81 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link 0/1 (rev 03)' +- bus: ff + dev: 0b + fn: '1' + id: 6f36 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link 0/1 (rev 03)' +- bus: ff + dev: 0b + fn: '2' + id: 6f37 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link 0/1 (rev 03)' +- bus: ff + dev: 0b + fn: '3' + id: 6f76 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link Debug (rev 03)' +- bus: ff + dev: 0c + fn: '0' + id: 6fe0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0c + fn: '1' + id: 6fe1 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0c + fn: '2' + id: 6fe2 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0c + fn: '3' + id: 6fe3 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '0' + id: 6ff8 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '4' + id: 6ffc + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '5' + id: 6ffd + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '6' + id: 6ffe + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: '10' + fn: '0' + id: 6f1d + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R2PCIe Agent (rev 03)' +- bus: ff + dev: '10' + fn: '1' + id: 6f34 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R2PCIe Agent (rev 03)' +- bus: ff + dev: '10' + fn: '5' + id: 6f1e + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Ubox (rev 03)' +- bus: ff + dev: '10' + fn: '6' + id: 6f7d + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Ubox (rev 03)' +- bus: ff + dev: '10' + fn: '7' + id: 6f1f + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Ubox (rev 03)' +- bus: ff + dev: '12' + fn: '0' + id: 6fa0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Home Agent 0 (rev 03)' +- bus: ff + dev: '12' + fn: '1' + id: 6f30 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Home Agent 0 (rev 03)' +- bus: ff + dev: '13' + fn: '0' + id: 6fa8 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Target Address/Thermal/RAS (rev 03)' +- bus: ff + dev: '13' + fn: '1' + id: 6f71 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Target Address/Thermal/RAS (rev 03)' +- bus: ff + dev: '13' + fn: '2' + id: 6faa + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '3' + id: 6fab + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '4' + id: 6fac + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '5' + id: 6fad + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '6' + id: 6fae + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Broadcast (rev 03)' +- bus: ff + dev: '13' + fn: '7' + id: 6faf + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Global Broadcast (rev 03)' +- bus: ff + dev: '14' + fn: '0' + id: 6fb0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 0 Thermal Control (rev 03)' +- bus: ff + dev: '14' + fn: '1' + id: 6fb1 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 1 Thermal Control (rev 03)' +- bus: ff + dev: '14' + fn: '2' + id: 6fb2 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 0 Error (rev 03)' +- bus: ff + dev: '14' + fn: '3' + id: 6fb3 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 1 Error (rev 03)' +- bus: ff + dev: '14' + fn: '4' + id: 6fbc + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '14' + fn: '5' + id: 6fbd + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '14' + fn: '6' + id: 6fbe + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '14' + fn: '7' + id: 6fbf + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '15' + fn: '0' + id: 6fb4 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 2 Thermal Control (rev 03)' +- bus: ff + dev: '15' + fn: '1' + id: 6fb5 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 3 Thermal Control (rev 03)' +- bus: ff + dev: '15' + fn: '2' + id: 6fb6 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 2 Error (rev 03)' +- bus: ff + dev: '15' + fn: '3' + id: 6fb7 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 3 Error (rev 03)' +- bus: ff + dev: 1e + fn: '0' + id: 6f98 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '1' + id: 6f99 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '2' + id: 6f9a + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '3' + id: 6fc0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '4' + id: 6f9c + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1f + fn: '0' + id: 6f88 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1f + fn: '2' + id: 6f8a + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' diff --git a/device/accton/x86_64-accton_as7726_32x-r0/pddf/pd-plugin.json b/device/accton/x86_64-accton_as7726_32x-r0/pddf/pd-plugin.json index b4e2cc4ac8..d79bdb4d52 100644 --- a/device/accton/x86_64-accton_as7726_32x-r0/pddf/pd-plugin.json +++ b/device/accton/x86_64-accton_as7726_32x-r0/pddf/pd-plugin.json @@ -34,7 +34,7 @@ { "i2c": { - "valmap": { "F2B":"EXHAUST", "B2F":"INTAKE" } + "valmap": { "F2B":"exhaust", "B2F":"intake" } } }, @@ -47,7 +47,7 @@ { "i2c": { - "valmap": {"1":"EXHAUST", "0":"INTAKE"} + "valmap": {"1":"exhaust", "0":"intake"} } }, @@ -61,7 +61,7 @@ "duty_cycle_to_pwm": "lambda dc: ((dc*100)/625 -1)", - "pwm_to_duty_cycle": "lambda pwm: (((pwm+1)*625+75)/100)" + "pwm_to_duty_cycle": "lambda pwm: (((pwm+1)*625)/100)" } } diff --git a/device/accton/x86_64-accton_as7726_32x-r0/pddf/pddf-device.json b/device/accton/x86_64-accton_as7726_32x-r0/pddf/pddf-device.json index b73f22b541..5d395d6388 100644 --- a/device/accton/x86_64-accton_as7726_32x-r0/pddf/pddf-device.json +++ b/device/accton/x86_64-accton_as7726_32x-r0/pddf/pddf-device.json @@ -5,7 +5,7 @@ "num_fantrays":6, "num_fans_pertray":2, "num_ports":34, - "num_temps":5, + "num_temps":10, "pddf_dev_types": { "description":"AS7726 - Below is the list of supported PDDF device types (chip names) for various components. If any component uses some other driver, we will create the client using 'echo > /new_device' method", @@ -1545,7 +1545,7 @@ "dev_info": { "device_type":"", "device_name":"PORT33-EEPROM", "device_parent":"MUX2", "virt_parent":"PORT33"}, "i2c": { - "topo_info": { "parent_bus":"0xf", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0xf", "dev_addr":"0x50", "dev_type":"optoe2"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1584,7 +1584,7 @@ "dev_info": { "device_type":"", "device_name":"PORT34-EEPROM", "device_parent":"MUX2", "virt_parent":"PORT34"}, "i2c": { - "topo_info": { "parent_bus":"0x10", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x10", "dev_addr":"0x50", "dev_type":"optoe2"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1657,7 +1657,11 @@ { "attr_name":"psu_i_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_p_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, - { "attr_name":"psu_temp1_input", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} + { "attr_name":"psu_temp1_input", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_v_out_max", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xa5", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_v_out_min", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xa4", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_p_out_max", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xa7", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_temp1_high_threshold", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xa8", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} ] } }, @@ -1705,7 +1709,11 @@ { "attr_name":"psu_i_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_p_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, - { "attr_name":"psu_temp1_input", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} + { "attr_name":"psu_temp1_input", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_v_out_max", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xa5", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_v_out_min", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xa4", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_p_out_max", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xa7", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_temp1_high_threshold", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xa8", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} ] } }, @@ -1865,7 +1873,82 @@ ] } }, - + "TEMP6" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP6"}, + "dev_attr": { "display_name":"CPU_Package_temp"}, + "i2c": + { + "path_info": {"sysfs_base_path": "/sys/class/hwmon/hwmon0"}, + "attr_list": + [ + { "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp1_crit"}, + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, + { "attr_name": "temp1_input"} + ] + } + }, + + "TEMP7" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP7"}, + "dev_attr": { "display_name":"CPU_Core_0_temp"}, + "i2c": + { + "path_info": {"sysfs_base_path": "/sys/class/hwmon/hwmon0"}, + "attr_list": + [ + { "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp2_crit"}, + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp2_max"}, + { "attr_name": "temp1_input", "drv_attr_name":"temp2_input"} + ] + } + }, + "TEMP8" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP8"}, + "dev_attr": { "display_name":"CPU_Core_1_temp"}, + "i2c": + { + "path_info": {"sysfs_base_path": "/sys/class/hwmon/hwmon0"}, + "attr_list": + [ + { "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp3_crit"}, + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp3_max"}, + { "attr_name": "temp1_input", "drv_attr_name":"temp3_input"} + ] + } + }, + "TEMP9" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP9"}, + "dev_attr": { "display_name":"CPU_Core_2_temp"}, + "i2c": + { + "path_info": {"sysfs_base_path": "/sys/class/hwmon/hwmon0"}, + "attr_list": + [ + { "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp4_crit"}, + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp4_max"}, + { "attr_name": "temp1_input", "drv_attr_name":"temp4_input"} + ] + } + }, + "TEMP10" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP10"}, + "dev_attr": { "display_name":"CPU_Core_3_temp"}, + "i2c": + { + "path_info": {"sysfs_base_path": "/sys/class/hwmon/hwmon0"}, + "attr_list": + [ + { "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp5_crit"}, + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp5_max"}, + { "attr_name": "temp1_input", "drv_attr_name":"temp5_input"} + ] + } + }, "SYSSTATUS": { "dev_info":{ "device_type":"SYSSTAT", "device_name":"SYSSTATUS"}, @@ -1890,12 +1973,12 @@ "LOC_LED": { "dev_info": { "device_type":"LED", "device_name":"LOC_LED"}, - "dev_attr": { "index":"0"}, + "dev_attr": { "index":"0", "flag": "rw"}, "i2c" : { "attr_list": [ - {"attr_name":"STATUS_LED_COLOR_BLUE", "descr" : "", "bits" : "7", "value" : "0x0", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"}, - {"attr_name":"STATUS_LED_COLOR_OFF", "descr" : "", "bits" : "7", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"} + {"attr_name":"blue", "descr" : "", "bits" : "7", "value" : "0x0", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"}, + {"attr_name":"off", "descr" : "", "bits" : "7", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"} ] } }, @@ -1903,13 +1986,13 @@ "DIAG_LED": { "dev_info": { "device_type":"LED", "device_name":"DIAG_LED"}, - "dev_attr": { "index":"0"}, + "dev_attr": { "index":"0", "flag": "rw"}, "i2c" : { "attr_list": [ - {"attr_name":"STATUS_LED_COLOR_GREEN", "descr" : "", "bits" : "1:0", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"}, - {"attr_name":"STATUS_LED_COLOR_RED", "descr" : "" ,"bits" : "1:0", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"}, - {"attr_name":"STATUS_LED_COLOR_OFF", "descr" : "" ,"bits" : "1:0", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"} + {"attr_name":"green", "descr" : "", "bits" : "1:0", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"}, + {"attr_name":"red", "descr" : "" ,"bits" : "1:0", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"}, + {"attr_name":"off", "descr" : "" ,"bits" : "1:0", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"} ] } diff --git a/device/accton/x86_64-accton_as7726_32x-r0/platform.json b/device/accton/x86_64-accton_as7726_32x-r0/platform.json new file mode 100644 index 0000000000..a0e25f83a8 --- /dev/null +++ b/device/accton/x86_64-accton_as7726_32x-r0/platform.json @@ -0,0 +1,902 @@ +{ + "chassis": { + "name": "7726-32X", + "thermal_manager":false, + "status_led": { + "controllable": true, + "colors": ["green", "red", "off"] + }, + "components": [ + { + "name": "MB_CPLD1" + }, + { + "name": "MB_CPLD2" + }, + { + "name": "MB_CPLD3" + }, + { + "name": "FAN_CPLD" + }, + { + "name": "CPU_CPLD" + }, + { + "name": "BIOS" + } + ], + "fans": [ + { + "name": "FAN-1F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-1R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-2F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-2R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-3F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-3R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-4F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-4R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-5F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-5R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-6F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-6R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + } + ], + "fan_drawers":[ + { + "name": "FanTray1", + "status_led": { + "controllable": false + }, + "num_fans" : 2, + "fans": [ + { + "name": "FAN-1F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-1R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + } + ] + }, + { + "name": "FanTray2", + "status_led": { + "controllable": false + }, + "num_fans" : 2, + "fans": [ + { + "name": "FAN-2F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-2R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + } + ] + }, + { + "name": "FanTray3", + "status_led": { + "controllable": false + }, + "num_fans" : 2, + "fans": [ + { + "name": "FAN-3F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-3R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + } + ] + }, + { + "name": "FanTray4", + "status_led": { + "controllable": false + }, + "num_fans" : 2, + "fans": [ + { + "name": "FAN-4F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-4R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + } + ] + }, + { + "name": "FanTray5", + "status_led": { + "controllable": false + }, + "num_fans" : 2, + "fans": [ + { + "name": "FAN-5F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-5R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + } + ] + }, + { + "name": "FanTray6", + "status_led": { + "controllable": false + }, + "num_fans" : 2, + "fans": [ + { + "name": "FAN-6F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-6R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + } + ] + } + ], + "psus": [ + { + "name": "PSU-1", + "status_led": { + "controllable": false + }, + "fans": [ + { + "name": "PSU-1 FAN-1" + } + ], + "thermals": [ + { + "name": "PSU-1 temp sensor 1", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false + } + ] + }, + { + "name": "PSU-2", + "status_led": { + "controllable": false + }, + "fans": [ + { + "name": "PSU-2 FAN-1" + } + ], + "thermals": [ + { + "name": "PSU-2 temp sensor 2", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false + } + ] + } + ], + "thermals": [ + { + "name": "CB_temp(0x4B)", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false + }, + { + "name": "FB_temp(0x4C)", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false + }, + { + "name": "MB_FrontMAC_temp(0x49)", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false + }, + { + "name": "MB_LeftCenter_temp(0x4A)", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false + }, + { + "name": "MB_RearMAC_temp(0x48)", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false + }, + { + "name": "CPU_Package_temp", + "controllable": false, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": true + }, + { + "name": "CPU_Core_0_temp", + "controllable": false, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": true + }, + { + "name": "CPU_Core_1_temp", + "controllable": false, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": true + }, + { + "name": "CPU_Core_2_temp", + "controllable": false, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": true + }, + { + "name": "CPU_Core_3_temp", + "controllable": false, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": true + } + ], + "sfps": [ + { + "name": "Ethernet0" + }, + { + "name": "Ethernet4" + }, + { + "name": "Ethernet8" + }, + { + "name": "Ethernet12" + }, + { + "name": "Ethernet16" + }, + { + "name": "Ethernet20" + }, + { + "name": "Ethernet24" + }, + { + "name": "Ethernet28" + }, + { + "name": "Ethernet32" + }, + { + "name": "Ethernet36" + }, + { + "name": "Ethernet40" + }, + { + "name": "Ethernet44" + }, + { + "name": "Ethernet48" + }, + { + "name": "Ethernet52" + }, + { + "name": "Ethernet56" + }, + { + "name": "Ethernet60" + }, + { + "name": "Ethernet64" + }, + { + "name": "Ethernet68" + }, + { + "name": "Ethernet72" + }, + { + "name": "Ethernet76" + }, + { + "name": "Ethernet80" + }, + { + "name": "Ethernet84" + }, + { + "name": "Ethernet88" + }, + { + "name": "Ethernet92" + }, + { + "name": "Ethernet96" + }, + { + "name": "Ethernet100" + }, + { + "name": "Ethernet104" + }, + { + "name": "Ethernet108" + }, + { + "name": "Ethernet112" + }, + { + "name": "Ethernet116" + }, + { + "name": "Ethernet120" + }, + { + "name": "Ethernet124" + } + ] + }, + "interfaces": { + "Ethernet0": { + "index": "1,1,1,1", + "lanes": "1,2,3,4", + "breakout_modes": { + "1x100G[40G]": ["Eth1(Port1)"], + "2x50G": ["Eth1/1(Port1)", "Eth1/2(Port1)"], + "4x25G": ["Eth1/1(Port1)", "Eth1/2(Port1)", "Eth1/3(Port1)", "Eth1/4(Port1)"], + "4x10G": ["Eth1/1(Port1)", "Eth1/2(Port1)", "Eth1/3(Port1)", "Eth1/4(Port1)"] + } + }, + + "Ethernet4": { + "index": "2,2,2,2", + "lanes": "5,6,7,8", + "breakout_modes": { + "1x100G[40G]": ["Eth2(Port2)"], + "2x50G": ["Eth2/1(Port2)", "Eth2/2(Port2)"], + "4x25G": ["Eth2/1(Port2)", "Eth2/2(Port2)", "Eth2/3(Port2)", "Eth2/4(Port2)"], + "4x10G": ["Eth2/1(Port2)", "Eth2/2(Port2)", "Eth2/3(Port2)", "Eth2/4(Port2)"] + } + }, + + "Ethernet8": { + "index": "3,3,3,3", + "lanes": "9,10,11,12", + "breakout_modes": { + "1x100G[40G]": ["Eth3(Port3)"], + "2x50G": ["Eth3/1(Port3)", "Eth3/2(Port3)"], + "4x25G": ["Eth3/1(Port3)", "Eth3/2(Port3)", "Eth3/3(Port3)", "Eth3/4(Port3)"], + "4x10G": ["Eth3/1(Port3)", "Eth3/2(Port3)", "Eth3/3(Port3)", "Eth3/4(Port3)"] + } + }, + + "Ethernet12": { + "index": "4,4,4,4", + "lanes": "13,14,15,16", + "breakout_modes": { + "1x100G[40G]": ["Eth4(Port4)"], + "2x50G": ["Eth4/1(Port4)", "Eth4/2(Port4)"], + "4x25G": ["Eth4/1(Port4)", "Eth4/2(Port4)", "Eth4/3(Port4)", "Eth4/4(Port4)"], + "4x10G": ["Eth4/1(Port4)", "Eth4/2(Port4)", "Eth4/3(Port4)", "Eth4/4(Port4)"] + } + }, + + "Ethernet16": { + "index": "5,5,5,5", + "lanes": "17,18,19,20", + "breakout_modes": { + "1x100G[40G]": ["Eth5(Port5)"], + "2x50G": ["Eth5/1(Port5)", "Eth5/2(Port5)"], + "4x25G": ["Eth5/1(Port5)", "Eth5/2(Port5)", "Eth5/3(Port5)", "Eth5/4(Port5)"], + "4x10G": ["Eth5/1(Port5)", "Eth5/2(Port5)", "Eth5/3(Port5)", "Eth5/4(Port5)"] + } + }, + + "Ethernet20": { + "index": "6,6,6,6", + "lanes": "21,22,23,24", + "breakout_modes": { + "1x100G[40G]": ["Eth6(Port6)"], + "2x50G": ["Eth6/1(Port6)", "Eth6/2(Port6)"], + "4x25G": ["Eth6/1(Port6)", "Eth6/2(Port6)", "Eth6/3(Port6)", "Eth6/4(Port6)"], + "4x10G": ["Eth6/1(Port6)", "Eth6/2(Port6)", "Eth6/3(Port6)", "Eth6/4(Port6)"] + } + }, + + "Ethernet24": { + "index": "7,7,7,7", + "lanes": "25,26,27,28", + "breakout_modes": { + "1x100G[40G]": ["Eth7(Port7)"], + "2x50G": ["Eth7/1(Port7)", "Eth7/2(Port7)"], + "4x25G": ["Eth7/1(Port7)", "Eth7/2(Port7)", "Eth7/3(Port7)", "Eth7/4(Port7)"], + "4x10G": ["Eth7/1(Port7)", "Eth7/2(Port7)", "Eth7/3(Port7)", "Eth7/4(Port7)"] + } + }, + + "Ethernet28": { + "index": "8,8,8,8", + "lanes": "29,30,31,32", + "breakout_modes": { + "1x100G[40G]": ["Eth8(Port8)"], + "2x50G": ["Eth8/1(Port8)", "Eth8/2(Port8)"], + "4x25G": ["Eth8/1(Port8)", "Eth8/2(Port8)", "Eth8/3(Port8)", "Eth8/4(Port8)"], + "4x10G": ["Eth8/1(Port8)", "Eth8/2(Port8)", "Eth8/3(Port8)", "Eth8/4(Port8)"] + } + }, + + "Ethernet32": { + "index": "9,9,9,9", + "lanes": "33,34,35,36", + "breakout_modes": { + "1x100G[40G]": ["Eth9(Port9)"], + "2x50G": ["Eth9/1(Port9)", "Eth9/2(Port9)"], + "4x25G": ["Eth9/1(Port9)", "Eth9/2(Port9)", "Eth9/3(Port9)", "Eth9/4(Port9)"], + "4x10G": ["Eth9/1(Port9)", "Eth9/2(Port9)", "Eth9/3(Port9)", "Eth9/4(Port9)"] + } + }, + + "Ethernet36": { + "index": "10,10,10,10", + "lanes": "37,38,39,40", + "breakout_modes": { + "1x100G[40G]": ["Eth10(Port10)"], + "2x50G": ["Eth10/1(Port10)", "Eth10/2(Port10)"], + "4x25G": ["Eth10/1(Port10)", "Eth10/2(Port10)", "Eth10/3(Port10)", "Eth10/4(Port10)"], + "4x10G": ["Eth10/1(Port10)", "Eth10/2(Port10)", "Eth10/3(Port10)", "Eth10/4(Port10)"] + } + }, + + "Ethernet40": { + "index": "11,11,11,11", + "lanes": "41,42,43,44", + "breakout_modes": { + "1x100G[40G]": ["Eth11(Port11)"], + "2x50G": ["Eth11/1(Port11)", "Eth11/2(Port11)"], + "4x25G": ["Eth11/1(Port11)", "Eth11/2(Port11)", "Eth11/3(Port11)", "Eth11/4(Port11)"], + "4x10G": ["Eth11/1(Port11)", "Eth11/2(Port11)", "Eth11/3(Port11)", "Eth11/4(Port11)"] + } + }, + + "Ethernet44": { + "index": "12,12,12,12", + "lanes": "45,46,47,48", + "breakout_modes": { + "1x100G[40G]": ["Eth12(Port12)"], + "2x50G": ["Eth12/1(Port12)", "Eth12/2(Port12)"], + "4x25G": ["Eth12/1(Port12)", "Eth12/2(Port12)", "Eth12/3(Port12)", "Eth12/4(Port12)"], + "4x10G": ["Eth12/1(Port12)", "Eth12/2(Port12)", "Eth12/3(Port12)", "Eth12/4(Port12)"] + } + }, + + "Ethernet48": { + "index": "13,13,13,13", + "lanes": "49,50,51,52", + "breakout_modes": { + "1x100G[40G]": ["Eth13(Port13)"], + "2x50G": ["Eth13/1(Port13)", "Eth13/2(Port13)"], + "4x25G": ["Eth13/1(Port13)", "Eth13/2(Port13)", "Eth13/3(Port13)", "Eth13/4(Port13)"], + "4x10G": ["Eth13/1(Port13)", "Eth13/2(Port13)", "Eth13/3(Port13)", "Eth13/4(Port13)"] + } + }, + + "Ethernet52": { + "index": "14,14,14,14", + "lanes": "53,54,55,56", + "breakout_modes": { + "1x100G[40G]": ["Eth14(Port14)"], + "2x50G": ["Eth14/1(Port14)", "Eth14/2(Port14)"], + "4x25G": ["Eth14/1(Port14)", "Eth14/2(Port14)", "Eth14/3(Port14)", "Eth14/4(Port14)"], + "4x10G": ["Eth14/1(Port14)", "Eth14/2(Port14)", "Eth14/3(Port14)", "Eth14/4(Port14)"] + } + }, + + "Ethernet56": { + "index": "15,15,15,15", + "lanes": "57,58,59,60", + "breakout_modes": { + "1x100G[40G]": ["Eth15(Port15)"], + "2x50G": ["Eth15/1(Port15)", "Eth15/2(Port15)"], + "4x25G": ["Eth15/1(Port15)", "Eth15/2(Port15)", "Eth15/3(Port15)", "Eth15/4(Port15)"], + "4x10G": ["Eth15/1(Port15)", "Eth15/2(Port15)", "Eth15/3(Port15)", "Eth15/4(Port15)"] + } + }, + + "Ethernet60": { + "index": "16,16,16,16", + "lanes": "61,62,63,64", + "breakout_modes": { + "1x100G[40G]": ["Eth16(Port16)"], + "2x50G": ["Eth16/1(Port16)", "Eth16/2(Port16)"], + "4x25G": ["Eth16/1(Port16)", "Eth16/2(Port16)", "Eth16/3(Port16)", "Eth16/4(Port16)"], + "4x10G": ["Eth16/1(Port16)", "Eth16/2(Port16)", "Eth16/3(Port16)", "Eth16/4(Port16)"] + } + }, + + "Ethernet64": { + "index": "17,17,17,17", + "lanes": "65,66,67,68", + "breakout_modes": { + "1x100G[40G]": ["Eth17(Port17)"], + "2x50G": ["Eth17/1(Port17)", "Eth17/2(Port17)"], + "4x25G": ["Eth17/1(Port17)", "Eth17/2(Port17)", "Eth17/3(Port17)", "Eth17/4(Port17)"], + "4x10G": ["Eth17/1(Port17)", "Eth17/2(Port17)", "Eth17/3(Port17)", "Eth17/4(Port17)"] + } + }, + + "Ethernet68": { + "index": "18,18,18,18", + "lanes": "69,70,71,72", + "breakout_modes": { + "1x100G[40G]": ["Eth18(Port18)"], + "2x50G": ["Eth18/1(Port18)", "Eth18/2(Port18)"], + "4x25G": ["Eth18/1(Port18)", "Eth18/2(Port18)", "Eth18/3(Port18)", "Eth18/4(Port18)"], + "4x10G": ["Eth18/1(Port18)", "Eth18/2(Port18)", "Eth18/3(Port18)", "Eth18/4(Port18)"] + } + }, + + "Ethernet72": { + "index": "19,19,19,19", + "lanes": "73,74,75,76", + "breakout_modes": { + "1x100G[40G]": ["Eth19(Port19)"], + "2x50G": ["Eth19/1(Port19)", "Eth19/2(Port19)"], + "4x25G": ["Eth19/1(Port19)", "Eth19/2(Port19)", "Eth19/3(Port19)", "Eth19/4(Port19)"], + "4x10G": ["Eth19/1(Port19)", "Eth19/2(Port19)", "Eth19/3(Port19)", "Eth19/4(Port19)"] + } + }, + + "Ethernet76": { + "index": "20,20,20,20", + "lanes": "77,78,79,80", + "breakout_modes": { + "1x100G[40G]": ["Eth20(Port20)"], + "2x50G": ["Eth20/1(Port20)", "Eth20/2(Port20)"], + "4x25G": ["Eth20/1(Port20)", "Eth20/2(Port20)", "Eth20/3(Port20)", "Eth20/4(Port20)"], + "4x10G": ["Eth20/1(Port20)", "Eth20/2(Port20)", "Eth20/3(Port20)", "Eth20/4(Port20)"] + } + }, + + "Ethernet80": { + "index": "21,21,21,21", + "lanes": "81,82,83,84", + "breakout_modes": { + "1x100G[40G]": ["Eth21(Port21)"], + "2x50G": ["Eth21/1(Port21)", "Eth21/2(Port21)"], + "4x25G": ["Eth21/1(Port21)", "Eth21/2(Port21)", "Eth21/3(Port21)", "Eth21/4(Port21)"], + "4x10G": ["Eth21/1(Port21)", "Eth21/2(Port21)", "Eth21/3(Port21)", "Eth21/4(Port21)"] + } + }, + + "Ethernet84": { + "index": "22,22,22,22", + "lanes": "85,86,87,88", + "breakout_modes": { + "1x100G[40G]": ["Eth22(Port22)"], + "2x50G": ["Eth22/1(Port22)", "Eth22/2(Port22)"], + "4x25G": ["Eth22/1(Port22)", "Eth22/2(Port22)", "Eth22/3(Port22)", "Eth22/4(Port22)"], + "4x10G": ["Eth22/1(Port22)", "Eth22/2(Port22)", "Eth22/3(Port22)", "Eth22/4(Port22)"] + } + }, + + "Ethernet88": { + "index": "23,23,23,23", + "lanes": "89,90,91,92", + "breakout_modes": { + "1x100G[40G]": ["Eth23(Port23)"], + "2x50G": ["Eth23/1(Port23)", "Eth23/2(Port23)"], + "4x25G": ["Eth23/1(Port23)", "Eth23/2(Port23)", "Eth23/3(Port23)", "Eth23/4(Port23)"], + "4x10G": ["Eth23/1(Port23)", "Eth23/2(Port23)", "Eth23/3(Port23)", "Eth23/4(Port23)"] + } + }, + + "Ethernet92": { + "index": "24,24,24,24", + "lanes": "93,94,95,96", + "breakout_modes": { + "1x100G[40G]": ["Eth24(Port24)"], + "2x50G": ["Eth24/1(Port24)", "Eth24/2(Port24)"], + "4x25G": ["Eth24/1(Port24)", "Eth24/2(Port24)", "Eth24/3(Port24)", "Eth24/4(Port24)"], + "4x10G": ["Eth24/1(Port24)", "Eth24/2(Port24)", "Eth24/3(Port24)", "Eth24/4(Port24)"] + } + }, + + "Ethernet96": { + "index": "25,25,25,25", + "lanes": "97,98,99,100", + "breakout_modes": { + "1x100G[40G]": ["Eth25(Port25)"], + "2x50G": ["Eth25/1(Port25)", "Eth25/2(Port25)"], + "4x25G": ["Eth25/1(Port25)", "Eth25/2(Port25)", "Eth25/3(Port25)", "Eth25/4(Port25)"], + "4x10G": ["Eth25/1(Port25)", "Eth25/2(Port25)", "Eth25/3(Port25)", "Eth25/4(Port25)"] + } + }, + + "Ethernet100": { + "index": "26,26,26,26", + "lanes": "101,102,103,104", + "breakout_modes": { + "1x100G[40G]": ["Eth26(Port26)"], + "2x50G": ["Eth26/1(Port26)", "Eth26/2(Port26)"], + "4x25G": ["Eth26/1(Port26)", "Eth26/2(Port26)", "Eth26/3(Port26)", "Eth26/4(Port26)"], + "4x10G": ["Eth26/1(Port26)", "Eth26/2(Port26)", "Eth26/3(Port26)", "Eth26/4(Port26)"] + } + }, + + "Ethernet104": { + "index": "27,27,27,27", + "lanes": "105,106,107,108", + "breakout_modes": { + "1x100G[40G]": ["Eth27(Port27)"], + "2x50G": ["Eth27/1(Port27)", "Eth27/2(Port27)"], + "4x25G": ["Eth27/1(Port27)", "Eth27/2(Port27)", "Eth27/3(Port27)", "Eth27/4(Port27)"], + "4x10G": ["Eth27/1(Port27)", "Eth27/2(Port27)", "Eth27/3(Port27)", "Eth27/4(Port27)"] + } + }, + + "Ethernet108": { + "index": "28,28,28,28", + "lanes": "109,110,111,112", + "breakout_modes": { + "1x100G[40G]": ["Eth28(Port28)"], + "2x50G": ["Eth28/1(Port28)", "Eth28/2(Port28)"], + "4x25G": ["Eth28/1(Port28)", "Eth28/2(Port28)", "Eth28/3(Port28)", "Eth28/4(Port28)"], + "4x10G": ["Eth28/1(Port28)", "Eth28/2(Port28)", "Eth28/3(Port28)", "Eth28/4(Port28)"] + } + }, + + "Ethernet112": { + "index": "29,29,29,29", + "lanes": "113,114,115,116", + "breakout_modes": { + "1x100G[40G]": ["Eth29(Port29)"], + "2x50G": ["Eth29/1(Port29)", "Eth29/2(Port29)"], + "4x25G": ["Eth29/1(Port29)", "Eth29/2(Port29)", "Eth29/3(Port29)", "Eth29/4(Port29)"], + "4x10G": ["Eth29/1(Port29)", "Eth29/2(Port29)", "Eth29/3(Port29)", "Eth29/4(Port29)"] + } + }, + + "Ethernet116": { + "index": "30,30,30,30", + "lanes": "117,118,119,120", + "breakout_modes": { + "1x100G[40G]": ["Eth30(Port30)"], + "2x50G": ["Eth30/1(Port30)", "Eth30/2(Port30)"], + "4x25G": ["Eth30/1(Port30)", "Eth30/2(Port30)", "Eth30/3(Port30)", "Eth30/4(Port30)"], + "4x10G": ["Eth30/1(Port30)", "Eth30/2(Port30)", "Eth30/3(Port30)", "Eth30/4(Port30)"] + } + }, + + "Ethernet120": { + "index": "31,31,31,31", + "lanes": "121,122,123,124", + "breakout_modes": { + "1x100G[40G]": ["Eth31(Port31)"], + "2x50G": ["Eth31/1(Port31)", "Eth31/2(Port31)"], + "4x25G": ["Eth31/1(Port31)", "Eth31/2(Port31)", "Eth31/3(Port31)", "Eth31/4(Port31)"], + "4x10G": ["Eth31/1(Port31)", "Eth31/2(Port31)", "Eth31/3(Port31)", "Eth31/4(Port31)"] + } + }, + + "Ethernet124": { + "index": "32,32,32,32", + "lanes": "125,126,127,128", + "breakout_modes": { + "1x100G[40G]": ["Eth32(Port32)"], + "2x50G": ["Eth32/1(Port32)", "Eth32/2(Port32)"], + "4x25G": ["Eth32/1(Port32)", "Eth32/2(Port32)", "Eth32/3(Port32)", "Eth32/4(Port32)"], + "4x10G": ["Eth32/1(Port32)", "Eth32/2(Port32)", "Eth32/3(Port32)", "Eth32/4(Port32)"] + } + } + } +} + diff --git a/device/accton/x86_64-accton_as7726_32x-r0/platform_components.json b/device/accton/x86_64-accton_as7726_32x-r0/platform_components.json new file mode 100644 index 0000000000..bf9378baeb --- /dev/null +++ b/device/accton/x86_64-accton_as7726_32x-r0/platform_components.json @@ -0,0 +1,14 @@ +{ + "chassis": { + "7726-32X-O-AC-F": { + "component": { + "MB_CPLD1": { }, + "MB_CPLD2": { }, + "MB_CPLD3": { }, + "FAN_CPLD": { }, + "CPU_CPLD": { }, + "BIOS": { } + } + } + } +} diff --git a/device/accton/x86_64-accton_as7726_32x-r0/pmon_daemon_control.json b/device/accton/x86_64-accton_as7726_32x-r0/pmon_daemon_control.json index a3b204e20d..44bad64942 100644 --- a/device/accton/x86_64-accton_as7726_32x-r0/pmon_daemon_control.json +++ b/device/accton/x86_64-accton_as7726_32x-r0/pmon_daemon_control.json @@ -1,5 +1,4 @@ { - "skip_ledd": true, - "skip_pcied": true + "skip_ledd": true } diff --git a/device/accton/x86_64-accton_as7726_32x-r0/system_health_monitoring_config.json b/device/accton/x86_64-accton_as7726_32x-r0/system_health_monitoring_config.json new file mode 100644 index 0000000000..2eb552f83f --- /dev/null +++ b/device/accton/x86_64-accton_as7726_32x-r0/system_health_monitoring_config.json @@ -0,0 +1,13 @@ +{ + "services_to_ignore": [], + "devices_to_ignore": [ + "asic" + ], + "user_defined_checkers": [], + "polling_interval": 60, + "led_color": { + "fault": "amber", + "normal": "green", + "booting": "off" + } +} diff --git a/device/accton/x86_64-accton_as7816_64x-r0/media_settings.json b/device/accton/x86_64-accton_as7816_64x-r0/media_settings.json new file mode 100644 index 0000000000..0c658a2898 --- /dev/null +++ b/device/accton/x86_64-accton_as7816_64x-r0/media_settings.json @@ -0,0 +1,644 @@ +{ + "PORT_MEDIA_SETTINGS": { + "1": { + "Default": { + "preemphasis": { + "lane0": "0x1c4503", + "lane1": "0x1c4503", + "lane2": "0x1c4503", + "lane3": "0x1c4503" + } + } + }, + "2": { + "Default": { + "preemphasis": { + "lane0": "0x1c4503", + "lane1": "0x1c4503", + "lane2": "0x1c4503", + "lane3": "0x1c4503" + } + } + }, + "3": { + "Default": { + "preemphasis": { + "lane0": "0x1c4503", + "lane1": "0x1c4503", + "lane2": "0x1c4503", + "lane3": "0x1c4503" + } + } + }, + "4": { + "Default": { + "preemphasis": { + "lane0": "0x1c4503", + "lane1": "0x1c4503", + "lane2": "0x1c4503", + "lane3": "0x1c4503" + } + } + }, + "5": { + "Default": { + "preemphasis": { + "lane0": "0x1b4603", + "lane1": "0x1b4603", + "lane2": "0x1b4603", + "lane3": "0x1b4603" + } + } + }, + "6": { + "Default": { + "preemphasis": { + "lane0": "0x1c4503", + "lane1": "0x1c4503", + "lane2": "0x1c4503", + "lane3": "0x1c4503" + } + } + }, + "7": { + "Default": { + "preemphasis": { + "lane0": "0x174a03", + "lane1": "0x174a03", + "lane2": "0x174a03", + "lane3": "0x174a03" + } + } + }, + "8": { + "Default": { + "preemphasis": { + "lane0": "0x194803", + "lane1": "0x1b4603", + "lane2": "0x174a03", + "lane3": "0x174a03" + } + } + }, + "9": { + "Default": { + "preemphasis": { + "lane0": "0x1c4503", + "lane1": "0x1c4503", + "lane2": "0x1c4503", + "lane3": "0x1c4503" + } + } + }, + "10": { + "Default": { + "preemphasis": { + "lane0": "0x1c4503", + "lane1": "0x1c4503", + "lane2": "0x1c4503", + "lane3": "0x1d4403" + } + } + }, + "11": { + "Default": { + "preemphasis": { + "lane0": "0x1a4703", + "lane1": "0x1a4703", + "lane2": "0x1a4703", + "lane3": "0x1a4703" + } + } + }, + "12": { + "Default": { + "preemphasis": { + "lane0": "0x1b4603", + "lane1": "0x1b4603", + "lane2": "0x1a4703", + "lane3": "0x1b4603" + } + } + }, + "13": { + "Default": { + "preemphasis": { + "lane0": "0x154c03", + "lane1": "0x154c03", + "lane2": "0x154c03", + "lane3": "0x154c03" + } + } + }, + "14": { + "Default": { + "preemphasis": { + "lane0": "0x154c03", + "lane1": "0x154c03", + "lane2": "0x154c03", + "lane3": "0x154c03" + } + } + }, + "15": { + "Default": { + "preemphasis": { + "lane0": "0x154c03", + "lane1": "0x154c03", + "lane2": "0x154c03", + "lane3": "0x154c03" + } + } + }, + "16": { + "Default": { + "preemphasis": { + "lane0": "0x154c03", + "lane1": "0x154c03", + "lane2": "0x154c03", + "lane3": "0x154c03" + } + } + }, + "17": { + "Default": { + "preemphasis": { + "lane0": "0x154901", + "lane1": "0x124901", + "lane2": "0x124903", + "lane3": "0x144900" + } + } + }, + "18": { + "Default": { + "preemphasis": { + "lane0": "0x154900", + "lane1": "0x124904", + "lane2": "0x124901", + "lane3": "0x144902" + } + } + }, + "19": { + "Default": { + "preemphasis": { + "lane0": "0x154900", + "lane1": "0x124900", + "lane2": "0x124903", + "lane3": "0x144902" + } + } + }, + "20": { + "Default": { + "preemphasis": { + "lane0": "0x154903", + "lane1": "0x124904", + "lane2": "0x124904", + "lane3": "0x144904" + } + } + }, + "21": { + "Default": { + "preemphasis": { + "lane0": "0x194803", + "lane1": "0x194803", + "lane2": "0x194803", + "lane3": "0x194803" + } + } + }, + "22": { + "Default": { + "preemphasis": { + "lane0": "0x194803", + "lane1": "0x194803", + "lane2": "0x194803", + "lane3": "0x194803" + } + } + }, + "23": { + "Default": { + "preemphasis": { + "lane0": "0x1c4503", + "lane1": "0x1c4503", + "lane2": "0x1c4503", + "lane3": "0x1c4503" + } + } + }, + "24": { + "Default": { + "preemphasis": { + "lane0": "0x1e4303", + "lane1": "0x1e4303", + "lane2": "0x1d4403", + "lane3": "0x1e4303" + } + } + }, + "25": { + "Default": { + "preemphasis": { + "lane0": "0x154906", + "lane1": "0x154904", + "lane2": "0x154903", + "lane3": "0x154903" + } + } + }, + "26": { + "Default": { + "preemphasis": { + "lane0": "0x174902", + "lane1": "0x174902", + "lane2": "0x174902", + "lane3": "0x174904" + } + } + }, + "27": { + "Default": { + "preemphasis": { + "lane0": "0x1a4703", + "lane1": "0x184903", + "lane2": "0x184903", + "lane3": "0x1a4703" + } + } + }, + "28": { + "Default": { + "preemphasis": { + "lane0": "0x1a4703", + "lane1": "0x1a4703", + "lane2": "0x1a4703", + "lane3": "0x1a4703" + } + } + }, + "29": { + "Default": { + "preemphasis": { + "lane0": "0x1a4505", + "lane1": "0x1a4505", + "lane2": "0x1a4505", + "lane3": "0x1a4505" + } + } + }, + "30": { + "Default": { + "preemphasis": { + "lane0": "0x1b4603", + "lane1": "0x1b4603", + "lane2": "0x1b4603", + "lane3": "0x1b4603" + } + } + }, + "31": { + "Default": { + "preemphasis": { + "lane0": "0x1a4604", + "lane1": "0x1a4604", + "lane2": "0x1a4604", + "lane3": "0x1a4604" + } + } + }, + "32": { + "Default": { + "preemphasis": { + "lane0": "0x1b4504", + "lane1": "0x1b4504", + "lane2": "0x1a4703", + "lane3": "0x1b4504" + } + } + }, + "33": { + "Default": { + "preemphasis": { + "lane0": "0x1c4503", + "lane1": "0x1c4404", + "lane2": "0x1c4503", + "lane3": "0x1c4404" + } + } + }, + "34": { + "Default": { + "preemphasis": { + "lane0": "0x1c4503", + "lane1": "0x1c4503", + "lane2": "0x1c4503", + "lane3": "0x1c4503" + } + } + }, + "35": { + "Default": { + "preemphasis": { + "lane0": "0x1a4703", + "lane1": "0x1a4604", + "lane2": "0x1a4703", + "lane3": "0x1a4703" + } + } + }, + "36": { + "Default": { + "preemphasis": { + "lane0": "0x1c4503", + "lane1": "0x1b4603", + "lane2": "0x1b4603", + "lane3": "0x1b4603" + } + } + }, + "37": { + "Default": { + "preemphasis": { + "lane0": "0x1b4603", + "lane1": "0x1b4603", + "lane2": "0x1a4703", + "lane3": "0x1b4603" + } + } + }, + "38": { + "Default": { + "preemphasis": { + "lane0": "0x194803", + "lane1": "0x194803", + "lane2": "0x194803", + "lane3": "0x194803" + } + } + }, + "39": { + "Default": { + "preemphasis": { + "lane0": "0x164903", + "lane1": "0x164903", + "lane2": "0x164903", + "lane3": "0x164903" + } + } + }, + "40": { + "Default": { + "preemphasis": { + "lane0": "0x164901", + "lane1": "0x184901", + "lane2": "0x184901", + "lane3": "0x184901" + } + } + }, + "41": { + "Default": { + "preemphasis": { + "lane0": "0x1c4503", + "lane1": "0x1c4503", + "lane2": "0x1c4503", + "lane3": "0x1c4404" + } + } + }, + "42": { + "Default": { + "preemphasis": { + "lane0": "0x1b4603", + "lane1": "0x1a4703", + "lane2": "0x1b4603", + "lane3": "0x1c4503" + } + } + }, + "43": { + "Default": { + "preemphasis": { + "lane0": "0x1a4703", + "lane1": "0x1a4703", + "lane2": "0x1a4703", + "lane3": "0x1a4703" + } + } + }, + "44": { + "Default": { + "preemphasis": { + "lane0": "0x1b4603", + "lane1": "0x1b4603", + "lane2": "0x1a4703", + "lane3": "0x1b4603" + } + } + }, + "45": { + "Default": { + "preemphasis": { + "lane0": "0x184902", + "lane1": "0x184902", + "lane2": "0x154902", + "lane3": "0x184902" + } + } + }, + "46": { + "Default": { + "preemphasis": { + "lane0": "0x154900", + "lane1": "0x154900", + "lane2": "0x154900", + "lane3": "0x154900" + } + } + }, + "47": { + "Default": { + "preemphasis": { + "lane0": "0x174900", + "lane1": "0x174900", + "lane2": "0x154900", + "lane3": "0x174904" + } + } + }, + "48": { + "Default": { + "preemphasis": { + "lane0": "0x154903", + "lane1": "0x154903", + "lane2": "0x154903", + "lane3": "0x154903" + } + } + }, + "49": { + "Default": { + "preemphasis": { + "lane0": "0x184902", + "lane1": "0x164902", + "lane2": "0x164902", + "lane3": "0x144900" + } + } + }, + "50": { + "Default": { + "preemphasis": { + "lane0": "0x174901", + "lane1": "0x144902", + "lane2": "0x144902", + "lane3": "0x144903" + } + } + }, + "51": { + "Default": { + "preemphasis": { + "lane0": "0x184901", + "lane1": "0x174901", + "lane2": "0x164903", + "lane3": "0x154904" + } + } + }, + "52": { + "Default": { + "preemphasis": { + "lane0": "0x154903", + "lane1": "0x154903", + "lane2": "0x134903", + "lane3": "0x144904" + } + } + }, + "53": { + "Default": { + "preemphasis": { + "lane0": "0x1c4503", + "lane1": "0x1e4204", + "lane2": "0x1c4503", + "lane3": "0x1d4304" + } + } + }, + "54": { + "Default": { + "preemphasis": { + "lane0": "0x1a4703", + "lane1": "0x1a4703", + "lane2": "0x1a4703", + "lane3": "0x1a4703" + } + } + }, + "55": { + "Default": { + "preemphasis": { + "lane0": "0x194803", + "lane1": "0x194803", + "lane2": "0x194803", + "lane3": "0x194803" + } + } + }, + "56": { + "Default": { + "preemphasis": { + "lane0": "0x194803", + "lane1": "0x194803", + "lane2": "0x184903", + "lane3": "0x194803" + } + } + }, + "57": { + "Default": { + "preemphasis": { + "lane0": "0x184903", + "lane1": "0x184903", + "lane2": "0x184903", + "lane3": "0x184903" + } + } + }, + "58": { + "Default": { + "preemphasis": { + "lane0": "0x194803", + "lane1": "0x194803", + "lane2": "0x184903", + "lane3": "0x194803" + } + } + }, + "59": { + "Default": { + "preemphasis": { + "lane0": "0x1a4703", + "lane1": "0x1a4703", + "lane2": "0x1a4703", + "lane3": "0x1a4703" + } + } + }, + "60": { + "Default": { + "preemphasis": { + "lane0": "0x1a4703", + "lane1": "0x1a4703", + "lane2": "0x1a4703", + "lane3": "0x1a4703" + } + } + }, + "61": { + "Default": { + "preemphasis": { + "lane0": "0x1a4703", + "lane1": "0x1a4703", + "lane2": "0x1a4703", + "lane3": "0x1a4505" + } + } + }, + "62": { + "Default": { + "preemphasis": { + "lane0": "0x1b4603", + "lane1": "0x1b4603", + "lane2": "0x1b4603", + "lane3": "0x1b4603" + } + } + }, + "63": { + "Default": { + "preemphasis": { + "lane0": "0x1c4404", + "lane1": "0x1c4404", + "lane2": "0x1b4504", + "lane3": "0x1c4404" + } + } + }, + "64": { + "Default": { + "preemphasis": { + "lane0": "0x1b4504", + "lane1": "0x1b4504", + "lane2": "0x1a4703", + "lane3": "0x1b4504" + } + } + } + } +} diff --git a/device/accton/x86_64-accton_as9716_32d-r0/Accton-AS9716-32D-100G/hwsku.json b/device/accton/x86_64-accton_as9716_32d-r0/Accton-AS9716-32D-100G/hwsku.json new file mode 100644 index 0000000000..cc8590d475 --- /dev/null +++ b/device/accton/x86_64-accton_as9716_32d-r0/Accton-AS9716-32D-100G/hwsku.json @@ -0,0 +1,132 @@ +{ + "interfaces": { + "Ethernet0": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet8": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet16": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet24": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet32": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet40": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet48": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet56": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet64": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet72": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet80": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet88": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet96": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet104": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet112": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet120": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet128": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet136": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet144": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet152": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet160": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet168": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet176": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet184": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet192": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet200": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet208": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet216": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet224": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet232": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet240": { + "default_brkout_mode": "1x100G[40G](4)" + }, + + "Ethernet248": { + "default_brkout_mode": "1x100G[40G](4)" + } + } +} + diff --git a/device/accton/x86_64-accton_as9716_32d-r0/Accton-AS9716-32D-100G/port_config.ini b/device/accton/x86_64-accton_as9716_32d-r0/Accton-AS9716-32D-100G/port_config.ini new file mode 100644 index 0000000000..08efc8dd12 --- /dev/null +++ b/device/accton/x86_64-accton_as9716_32d-r0/Accton-AS9716-32D-100G/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias index speed +Ethernet0 73,74,75,76 Eth1(Port1) 1 100000 +Ethernet8 65,66,67,68 Eth2(Port2) 2 100000 +Ethernet16 81,82,83,84 Eth3(Port3) 3 100000 +Ethernet24 89,90,91,92 Eth4(Port4) 4 100000 +Ethernet32 97,98,99,100 Eth5(Port5) 5 100000 +Ethernet40 105,106,107,108 Eth6(Port6) 6 100000 +Ethernet48 113,114,115,116 Eth7(Port7) 7 100000 +Ethernet56 121,122,123,124 Eth8(Port8) 8 100000 +Ethernet64 41,42,43,44 Eth9(Port9) 9 100000 +Ethernet72 33,34,35,36 Eth10(Port10) 10 100000 +Ethernet80 49,50,51,52 Eth11(Port11) 11 100000 +Ethernet88 57,58,59,60 Eth12(Port12) 12 100000 +Ethernet96 129,130,131,132 Eth13(Port13) 13 100000 +Ethernet104 137,138,139,140 Eth14(Port14) 14 100000 +Ethernet112 145,146,147,148 Eth15(Port15) 15 100000 +Ethernet120 153,154,155,156 Eth16(Port16) 16 100000 +Ethernet128 169,170,171,172 Eth17(Port17) 17 100000 +Ethernet136 161,162,163,164 Eth18(Port18) 18 100000 +Ethernet144 177,178,179,180 Eth19(Port19) 19 100000 +Ethernet152 185,186,187,188 Eth20(Port20) 20 100000 +Ethernet160 1,2,3,4 Eth21(Port21) 21 100000 +Ethernet168 9,10,11,12 Eth22(Port22) 22 100000 +Ethernet176 17,18,19,20 Eth23(Port23) 23 100000 +Ethernet184 25,26,27,28 Eth24(Port24) 24 100000 +Ethernet192 201,202,203,204 Eth25(Port25) 25 100000 +Ethernet200 193,194,195,196 Eth26(Port26) 26 100000 +Ethernet208 217,218,219,220 Eth27(Port27) 27 100000 +Ethernet216 209,210,211,212 Eth28(Port28) 28 100000 +Ethernet224 233,234,235,236 Eth29(Port29) 29 100000 +Ethernet232 225,226,227,228 Eth30(Port30) 30 100000 +Ethernet240 249,250,251,252 Eth31(Port31) 31 100000 +Ethernet248 241,242,243,244 Eth32(Port32) 32 100000 diff --git a/device/accton/x86_64-accton_as9716_32d-r0/Accton-AS9716-32D-100G/sai.profile b/device/accton/x86_64-accton_as9716_32d-r0/Accton-AS9716-32D-100G/sai.profile new file mode 100644 index 0000000000..9c44e73999 --- /dev/null +++ b/device/accton/x86_64-accton_as9716_32d-r0/Accton-AS9716-32D-100G/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th3-as9716-32x100G.config.bcm diff --git a/device/accton/x86_64-accton_as9716_32d-r0/Accton-AS9716-32D-100G/th3-as9716-32x100G.config.bcm b/device/accton/x86_64-accton_as9716_32d-r0/Accton-AS9716-32D-100G/th3-as9716-32x100G.config.bcm new file mode 100644 index 0000000000..d575603041 --- /dev/null +++ b/device/accton/x86_64-accton_as9716_32d-r0/Accton-AS9716-32D-100G/th3-as9716-32x100G.config.bcm @@ -0,0 +1,1318 @@ +pbmp_xport_xe.0=0x3ffffffffffffffffffffffffffffffffffffffe +ccm_dma_enable=0 +ccmdma_intr_enable=0 +#ctr_evict_enable=0 +mem_cache_enable=0 +# Reference specfic +parity_correction=1 +parity_enable=1 +phy_enable=1 +phy_null=1 +#pll_bypass=1 + +#init_all_modules=0 +core_clock_frequency=1325 +dpr_clock_frequency=1000 +device_clock_frequency=1325 +port_flex_enable=1 +l2xmsg_mode.0=1 +l2_mem_entries.0=8192 +ipv6_lpm_128b_enable=1 +l3_alpm_enable.0=2 +l3_mem_entries.0=16384 +mmu_port_num_mc_queue.0=1 +module_64ports.0=1 +multicast_l2_range.0=511 +oversubscribe_mode=1 + +# Platform specfic +arl_clean_timeout_usec=15000000 +asf_mem_profile.0=2 +bcm_num_cos.0=8 +bcm_stat_flags=1 +bcm_stat_jumbo.0=9236 +cdma_timeout_usec.0=15000000 +dma_desc_timeout_usec.0=15000000 +dpr_clock_frequency.0=1000 +max_vp_lags.0=0 +miim_intr_enable.0=0 +sram_scan_enable.0=0 +tdma_timeout_usec.0=15000000 +tslam_timeout_usec.0=15000000 + +#firmware load method, use fast load +load_firmware=0x2 + +serdes_lane_config_dfe=on +serdes_lane_config_media_type=copper + +#BC0# +dport_map_port_1=81 +dport_map_port_2=82 +dport_map_port_3=83 +dport_map_port_4=84 +portmap_1=1:100:4 +phy_chain_rx_lane_map_physical{1.0}=0x45301726 +phy_chain_rx_lane_map_physical{2.0}=0x45301726 +phy_chain_rx_lane_map_physical{3.0}=0x45301726 +phy_chain_rx_lane_map_physical{4.0}=0x45301726 +phy_chain_rx_lane_map_physical{5.0}=0x45301726 +phy_chain_rx_lane_map_physical{6.0}=0x45301726 +phy_chain_rx_lane_map_physical{7.0}=0x45301726 +phy_chain_rx_lane_map_physical{8.0}=0x45301726 +phy_chain_tx_lane_map_physical{1.0}=0x23761450 +phy_chain_tx_lane_map_physical{2.0}=0x23761450 +phy_chain_tx_lane_map_physical{3.0}=0x23761450 +phy_chain_tx_lane_map_physical{4.0}=0x23761450 +phy_chain_tx_lane_map_physical{5.0}=0x23761450 +phy_chain_tx_lane_map_physical{6.0}=0x23761450 +phy_chain_tx_lane_map_physical{7.0}=0x23761450 +phy_chain_tx_lane_map_physical{8.0}=0x23761450 +serdes_core_rx_polarity_flip_physical{1}=0xA9 +serdes_core_rx_polarity_flip_physical{2}=0xA9 +serdes_core_rx_polarity_flip_physical{3}=0xA9 +serdes_core_rx_polarity_flip_physical{4}=0xA9 +serdes_core_rx_polarity_flip_physical{5}=0xA9 +serdes_core_rx_polarity_flip_physical{6}=0xA9 +serdes_core_rx_polarity_flip_physical{7}=0xA9 +serdes_core_rx_polarity_flip_physical{8}=0xA9 +serdes_core_tx_polarity_flip_physical{1}=0x7E +serdes_core_tx_polarity_flip_physical{2}=0x7E +serdes_core_tx_polarity_flip_physical{3}=0x7E +serdes_core_tx_polarity_flip_physical{4}=0x7E +serdes_core_tx_polarity_flip_physical{5}=0x7E +serdes_core_tx_polarity_flip_physical{6}=0x7E +serdes_core_tx_polarity_flip_physical{7}=0x7E +serdes_core_tx_polarity_flip_physical{8}=0x7E + +#BC1# +dport_map_port_5=85 +dport_map_port_6=86 +dport_map_port_7=87 +dport_map_port_8=88 +portmap_5=9:100:4 +phy_chain_rx_lane_map_physical{9.0}=0x12650374 +phy_chain_rx_lane_map_physical{10.0}=0x12650374 +phy_chain_rx_lane_map_physical{11.0}=0x12650374 +phy_chain_rx_lane_map_physical{12.0}=0x12650374 +phy_chain_rx_lane_map_physical{13.0}=0x12650374 +phy_chain_rx_lane_map_physical{14.0}=0x12650374 +phy_chain_rx_lane_map_physical{15.0}=0x12650374 +phy_chain_rx_lane_map_physical{16.0}=0x12650374 +phy_chain_tx_lane_map_physical{9.0}=0x70146253 +phy_chain_tx_lane_map_physical{10.0}=0x70146253 +phy_chain_tx_lane_map_physical{11.0}=0x70146253 +phy_chain_tx_lane_map_physical{12.0}=0x70146253 +phy_chain_tx_lane_map_physical{13.0}=0x70146253 +phy_chain_tx_lane_map_physical{14.0}=0x70146253 +phy_chain_tx_lane_map_physical{15.0}=0x70146253 +phy_chain_tx_lane_map_physical{16.0}=0x70146253 +serdes_core_rx_polarity_flip_physical{9}=0x5A +serdes_core_rx_polarity_flip_physical{10}=0x5A +serdes_core_rx_polarity_flip_physical{11}=0x5A +serdes_core_rx_polarity_flip_physical{12}=0x5A +serdes_core_rx_polarity_flip_physical{13}=0x5A +serdes_core_rx_polarity_flip_physical{14}=0x5A +serdes_core_rx_polarity_flip_physical{15}=0x5A +serdes_core_rx_polarity_flip_physical{16}=0x5A +serdes_core_tx_polarity_flip_physical{9}=0x76 +serdes_core_tx_polarity_flip_physical{10}=0x76 +serdes_core_tx_polarity_flip_physical{11}=0x76 +serdes_core_tx_polarity_flip_physical{12}=0x76 +serdes_core_tx_polarity_flip_physical{13}=0x76 +serdes_core_tx_polarity_flip_physical{14}=0x76 +serdes_core_tx_polarity_flip_physical{15}=0x76 +serdes_core_tx_polarity_flip_physical{16}=0x76 + +#BC2# +dport_map_port_9=89 +dport_map_port_10=90 +dport_map_port_11=91 +dport_map_port_12=92 +portmap_9=17:100:4 +phy_chain_rx_lane_map_physical{17.0}=0x40572136 +phy_chain_rx_lane_map_physical{18.0}=0x40572136 +phy_chain_rx_lane_map_physical{19.0}=0x40572136 +phy_chain_rx_lane_map_physical{20.0}=0x40572136 +phy_chain_rx_lane_map_physical{21.0}=0x40572136 +phy_chain_rx_lane_map_physical{22.0}=0x40572136 +phy_chain_rx_lane_map_physical{23.0}=0x40572136 +phy_chain_rx_lane_map_physical{24.0}=0x40572136 +phy_chain_tx_lane_map_physical{17.0}=0x75324160 +phy_chain_tx_lane_map_physical{18.0}=0x75324160 +phy_chain_tx_lane_map_physical{19.0}=0x75324160 +phy_chain_tx_lane_map_physical{20.0}=0x75324160 +phy_chain_tx_lane_map_physical{21.0}=0x75324160 +phy_chain_tx_lane_map_physical{22.0}=0x75324160 +phy_chain_tx_lane_map_physical{23.0}=0x75324160 +phy_chain_tx_lane_map_physical{24.0}=0x75324160 +serdes_core_rx_polarity_flip_physical{17}=0x78 +serdes_core_rx_polarity_flip_physical{18}=0x78 +serdes_core_rx_polarity_flip_physical{19}=0x78 +serdes_core_rx_polarity_flip_physical{20}=0x78 +serdes_core_rx_polarity_flip_physical{21}=0x78 +serdes_core_rx_polarity_flip_physical{22}=0x78 +serdes_core_rx_polarity_flip_physical{23}=0x78 +serdes_core_rx_polarity_flip_physical{24}=0x78 +serdes_core_tx_polarity_flip_physical{17}=0x3B +serdes_core_tx_polarity_flip_physical{18}=0x3B +serdes_core_tx_polarity_flip_physical{19}=0x3B +serdes_core_tx_polarity_flip_physical{20}=0x3B +serdes_core_tx_polarity_flip_physical{21}=0x3B +serdes_core_tx_polarity_flip_physical{22}=0x3B +serdes_core_tx_polarity_flip_physical{23}=0x3B +serdes_core_tx_polarity_flip_physical{24}=0x3B + +#BC3# +dport_map_port_13=93 +dport_map_port_14=94 +dport_map_port_15=95 +dport_map_port_16=96 +portmap_13=25:100:4 +phy_chain_rx_lane_map_physical{25.0}=0x20576143 +phy_chain_rx_lane_map_physical{26.0}=0x20576143 +phy_chain_rx_lane_map_physical{27.0}=0x20576143 +phy_chain_rx_lane_map_physical{28.0}=0x20576143 +phy_chain_rx_lane_map_physical{29.0}=0x20576143 +phy_chain_rx_lane_map_physical{30.0}=0x20576143 +phy_chain_rx_lane_map_physical{31.0}=0x20576143 +phy_chain_rx_lane_map_physical{32.0}=0x20576143 +phy_chain_tx_lane_map_physical{25.0}=0x43716520 +phy_chain_tx_lane_map_physical{26.0}=0x43716520 +phy_chain_tx_lane_map_physical{27.0}=0x43716520 +phy_chain_tx_lane_map_physical{28.0}=0x43716520 +phy_chain_tx_lane_map_physical{29.0}=0x43716520 +phy_chain_tx_lane_map_physical{30.0}=0x43716520 +phy_chain_tx_lane_map_physical{31.0}=0x43716520 +phy_chain_tx_lane_map_physical{32.0}=0x43716520 +serdes_core_rx_polarity_flip_physical{25}=0xF8 +serdes_core_rx_polarity_flip_physical{26}=0xF8 +serdes_core_rx_polarity_flip_physical{27}=0xF8 +serdes_core_rx_polarity_flip_physical{28}=0xF8 +serdes_core_rx_polarity_flip_physical{29}=0xF8 +serdes_core_rx_polarity_flip_physical{30}=0xF8 +serdes_core_rx_polarity_flip_physical{31}=0xF8 +serdes_core_rx_polarity_flip_physical{32}=0xF8 +serdes_core_tx_polarity_flip_physical{25}=0x6E +serdes_core_tx_polarity_flip_physical{26}=0x6E +serdes_core_tx_polarity_flip_physical{27}=0x6E +serdes_core_tx_polarity_flip_physical{28}=0x6E +serdes_core_tx_polarity_flip_physical{29}=0x6E +serdes_core_tx_polarity_flip_physical{30}=0x6E +serdes_core_tx_polarity_flip_physical{31}=0x6E +serdes_core_tx_polarity_flip_physical{32}=0x6E + +#BC4# +dport_map_port_24=37 +dport_map_port_25=38 +dport_map_port_26=39 +dport_map_port_27=40 +portmap_24=33:100:4 +phy_chain_rx_lane_map_physical{33.0}=0x47205361 +phy_chain_rx_lane_map_physical{34.0}=0x47205361 +phy_chain_rx_lane_map_physical{35.0}=0x47205361 +phy_chain_rx_lane_map_physical{36.0}=0x47205361 +phy_chain_rx_lane_map_physical{37.0}=0x47205361 +phy_chain_rx_lane_map_physical{38.0}=0x47205361 +phy_chain_rx_lane_map_physical{39.0}=0x47205361 +phy_chain_rx_lane_map_physical{40.0}=0x47205361 +phy_chain_tx_lane_map_physical{33.0}=0x01452736 +phy_chain_tx_lane_map_physical{34.0}=0x01452736 +phy_chain_tx_lane_map_physical{35.0}=0x01452736 +phy_chain_tx_lane_map_physical{36.0}=0x01452736 +phy_chain_tx_lane_map_physical{37.0}=0x01452736 +phy_chain_tx_lane_map_physical{38.0}=0x01452736 +phy_chain_tx_lane_map_physical{39.0}=0x01452736 +phy_chain_tx_lane_map_physical{40.0}=0x01452736 +serdes_core_rx_polarity_flip_physical{33}=0x87 +serdes_core_rx_polarity_flip_physical{34}=0x87 +serdes_core_rx_polarity_flip_physical{35}=0x87 +serdes_core_rx_polarity_flip_physical{36}=0x87 +serdes_core_rx_polarity_flip_physical{37}=0x87 +serdes_core_rx_polarity_flip_physical{38}=0x87 +serdes_core_rx_polarity_flip_physical{39}=0x87 +serdes_core_rx_polarity_flip_physical{40}=0x87 +serdes_core_tx_polarity_flip_physical{33}=0x27 +serdes_core_tx_polarity_flip_physical{34}=0x27 +serdes_core_tx_polarity_flip_physical{35}=0x27 +serdes_core_tx_polarity_flip_physical{36}=0x27 +serdes_core_tx_polarity_flip_physical{37}=0x27 +serdes_core_tx_polarity_flip_physical{38}=0x27 +serdes_core_tx_polarity_flip_physical{39}=0x27 +serdes_core_tx_polarity_flip_physical{40}=0x27 + +#BC5# +dport_map_port_20=33 +dport_map_port_21=34 +dport_map_port_22=35 +dport_map_port_23=36 +portmap_20=41:100:4 +phy_chain_rx_lane_map_physical{41.0}=0x45013726 +phy_chain_rx_lane_map_physical{42.0}=0x45013726 +phy_chain_rx_lane_map_physical{43.0}=0x45013726 +phy_chain_rx_lane_map_physical{44.0}=0x45013726 +phy_chain_rx_lane_map_physical{45.0}=0x45013726 +phy_chain_rx_lane_map_physical{46.0}=0x45013726 +phy_chain_rx_lane_map_physical{47.0}=0x45013726 +phy_chain_rx_lane_map_physical{48.0}=0x45013726 +phy_chain_tx_lane_map_physical{41.0}=0x10273564 +phy_chain_tx_lane_map_physical{42.0}=0x10273564 +phy_chain_tx_lane_map_physical{43.0}=0x10273564 +phy_chain_tx_lane_map_physical{44.0}=0x10273564 +phy_chain_tx_lane_map_physical{45.0}=0x10273564 +phy_chain_tx_lane_map_physical{46.0}=0x10273564 +phy_chain_tx_lane_map_physical{47.0}=0x10273564 +phy_chain_tx_lane_map_physical{48.0}=0x10273564 +serdes_core_rx_polarity_flip_physical{41}=0x99 +serdes_core_rx_polarity_flip_physical{42}=0x99 +serdes_core_rx_polarity_flip_physical{43}=0x99 +serdes_core_rx_polarity_flip_physical{44}=0x99 +serdes_core_rx_polarity_flip_physical{45}=0x99 +serdes_core_rx_polarity_flip_physical{46}=0x99 +serdes_core_rx_polarity_flip_physical{47}=0x99 +serdes_core_rx_polarity_flip_physical{48}=0x99 +serdes_core_tx_polarity_flip_physical{41}=0xA8 +serdes_core_tx_polarity_flip_physical{42}=0xA8 +serdes_core_tx_polarity_flip_physical{43}=0xA8 +serdes_core_tx_polarity_flip_physical{44}=0xA8 +serdes_core_tx_polarity_flip_physical{45}=0xA8 +serdes_core_tx_polarity_flip_physical{46}=0xA8 +serdes_core_tx_polarity_flip_physical{47}=0xA8 +serdes_core_tx_polarity_flip_physical{48}=0xA8 + +#BC6# +dport_map_port_28=41 +dport_map_port_29=42 +dport_map_port_30=43 +dport_map_port_31=44 +portmap_28=49:100:4 +phy_chain_rx_lane_map_physical{49.0}=0x04571326 +phy_chain_rx_lane_map_physical{50.0}=0x04571326 +phy_chain_rx_lane_map_physical{51.0}=0x04571326 +phy_chain_rx_lane_map_physical{52.0}=0x04571326 +phy_chain_rx_lane_map_physical{53.0}=0x04571326 +phy_chain_rx_lane_map_physical{54.0}=0x04571326 +phy_chain_rx_lane_map_physical{55.0}=0x04571326 +phy_chain_rx_lane_map_physical{56.0}=0x04571326 +phy_chain_tx_lane_map_physical{49.0}=0x51230764 +phy_chain_tx_lane_map_physical{50.0}=0x51230764 +phy_chain_tx_lane_map_physical{51.0}=0x51230764 +phy_chain_tx_lane_map_physical{52.0}=0x51230764 +phy_chain_tx_lane_map_physical{53.0}=0x51230764 +phy_chain_tx_lane_map_physical{54.0}=0x51230764 +phy_chain_tx_lane_map_physical{55.0}=0x51230764 +phy_chain_tx_lane_map_physical{56.0}=0x51230764 +serdes_core_rx_polarity_flip_physical{49}=0xB2 +serdes_core_rx_polarity_flip_physical{50}=0xB2 +serdes_core_rx_polarity_flip_physical{51}=0xB2 +serdes_core_rx_polarity_flip_physical{52}=0xB2 +serdes_core_rx_polarity_flip_physical{53}=0xB2 +serdes_core_rx_polarity_flip_physical{54}=0xB2 +serdes_core_rx_polarity_flip_physical{55}=0xB2 +serdes_core_rx_polarity_flip_physical{56}=0xB2 +serdes_core_tx_polarity_flip_physical{49}=0x88 +serdes_core_tx_polarity_flip_physical{50}=0x88 +serdes_core_tx_polarity_flip_physical{51}=0x88 +serdes_core_tx_polarity_flip_physical{52}=0x88 +serdes_core_tx_polarity_flip_physical{53}=0x88 +serdes_core_tx_polarity_flip_physical{54}=0x88 +serdes_core_tx_polarity_flip_physical{55}=0x88 +serdes_core_tx_polarity_flip_physical{56}=0x88 + +#BC7# +dport_map_port_32=45 +dport_map_port_33=46 +dport_map_port_34=47 +dport_map_port_35=48 +portmap_32=57:100:4 +phy_chain_rx_lane_map_physical{57.0}=0x01675243 +phy_chain_rx_lane_map_physical{58.0}=0x01675243 +phy_chain_rx_lane_map_physical{59.0}=0x01675243 +phy_chain_rx_lane_map_physical{60.0}=0x01675243 +phy_chain_rx_lane_map_physical{61.0}=0x01675243 +phy_chain_rx_lane_map_physical{62.0}=0x01675243 +phy_chain_rx_lane_map_physical{63.0}=0x01675243 +phy_chain_rx_lane_map_physical{64.0}=0x01675243 +phy_chain_tx_lane_map_physical{57.0}=0x37106425 +phy_chain_tx_lane_map_physical{58.0}=0x37106425 +phy_chain_tx_lane_map_physical{59.0}=0x37106425 +phy_chain_tx_lane_map_physical{60.0}=0x37106425 +phy_chain_tx_lane_map_physical{61.0}=0x37106425 +phy_chain_tx_lane_map_physical{62.0}=0x37106425 +phy_chain_tx_lane_map_physical{63.0}=0x37106425 +phy_chain_tx_lane_map_physical{64.0}=0x37106425 +serdes_core_rx_polarity_flip_physical{57}=0x9C +serdes_core_rx_polarity_flip_physical{58}=0x9C +serdes_core_rx_polarity_flip_physical{59}=0x9C +serdes_core_rx_polarity_flip_physical{60}=0x9C +serdes_core_rx_polarity_flip_physical{61}=0x9C +serdes_core_rx_polarity_flip_physical{62}=0x9C +serdes_core_rx_polarity_flip_physical{63}=0x9C +serdes_core_rx_polarity_flip_physical{64}=0x9C +serdes_core_tx_polarity_flip_physical{57}=0x4F +serdes_core_tx_polarity_flip_physical{58}=0x4F +serdes_core_tx_polarity_flip_physical{59}=0x4F +serdes_core_tx_polarity_flip_physical{60}=0x4F +serdes_core_tx_polarity_flip_physical{61}=0x4F +serdes_core_tx_polarity_flip_physical{62}=0x4F +serdes_core_tx_polarity_flip_physical{63}=0x4F +serdes_core_tx_polarity_flip_physical{64}=0x4F + +#BC8# +dport_map_port_44=5 +dport_map_port_45=6 +dport_map_port_46=7 +dport_map_port_47=8 +portmap_44=65:100:4 +phy_chain_rx_lane_map_physical{65.0}=0x56024713 +phy_chain_rx_lane_map_physical{66.0}=0x56024713 +phy_chain_rx_lane_map_physical{67.0}=0x56024713 +phy_chain_rx_lane_map_physical{68.0}=0x56024713 +phy_chain_rx_lane_map_physical{69.0}=0x56024713 +phy_chain_rx_lane_map_physical{70.0}=0x56024713 +phy_chain_rx_lane_map_physical{71.0}=0x56024713 +phy_chain_rx_lane_map_physical{72.0}=0x56024713 +phy_chain_tx_lane_map_physical{65.0}=0x12673504 +phy_chain_tx_lane_map_physical{66.0}=0x12673504 +phy_chain_tx_lane_map_physical{67.0}=0x12673504 +phy_chain_tx_lane_map_physical{68.0}=0x12673504 +phy_chain_tx_lane_map_physical{69.0}=0x12673504 +phy_chain_tx_lane_map_physical{70.0}=0x12673504 +phy_chain_tx_lane_map_physical{71.0}=0x12673504 +phy_chain_tx_lane_map_physical{72.0}=0x12673504 +serdes_core_rx_polarity_flip_physical{65}=0x4B +serdes_core_rx_polarity_flip_physical{66}=0x4B +serdes_core_rx_polarity_flip_physical{67}=0x4B +serdes_core_rx_polarity_flip_physical{68}=0x4B +serdes_core_rx_polarity_flip_physical{69}=0x4B +serdes_core_rx_polarity_flip_physical{70}=0x4B +serdes_core_rx_polarity_flip_physical{71}=0x4B +serdes_core_rx_polarity_flip_physical{72}=0x4B +serdes_core_tx_polarity_flip_physical{65}=0xB7 +serdes_core_tx_polarity_flip_physical{66}=0xB7 +serdes_core_tx_polarity_flip_physical{67}=0xB7 +serdes_core_tx_polarity_flip_physical{68}=0xB7 +serdes_core_tx_polarity_flip_physical{69}=0xB7 +serdes_core_tx_polarity_flip_physical{70}=0xB7 +serdes_core_tx_polarity_flip_physical{71}=0xB7 +serdes_core_tx_polarity_flip_physical{72}=0xB7 + +#BC9# +dport_map_port_40=1 +dport_map_port_41=2 +dport_map_port_42=3 +dport_map_port_43=4 +portmap_40=73:100:4 +#portmap_41=77:100:4 +phy_chain_rx_lane_map_physical{73.0}=0x45231607 +phy_chain_rx_lane_map_physical{74.0}=0x45231607 +phy_chain_rx_lane_map_physical{75.0}=0x45231607 +phy_chain_rx_lane_map_physical{76.0}=0x45231607 +phy_chain_rx_lane_map_physical{77.0}=0x45231607 +phy_chain_rx_lane_map_physical{78.0}=0x45231607 +phy_chain_rx_lane_map_physical{79.0}=0x45231607 +phy_chain_rx_lane_map_physical{80.0}=0x45231607 +phy_chain_tx_lane_map_physical{73.0}=0x04273165 +phy_chain_tx_lane_map_physical{74.0}=0x04273165 +phy_chain_tx_lane_map_physical{75.0}=0x04273165 +phy_chain_tx_lane_map_physical{76.0}=0x04273165 +phy_chain_tx_lane_map_physical{77.0}=0x04273165 +phy_chain_tx_lane_map_physical{78.0}=0x04273165 +phy_chain_tx_lane_map_physical{79.0}=0x04273165 +phy_chain_tx_lane_map_physical{80.0}=0x04273165 +serdes_core_rx_polarity_flip_physical{73}=0x9C +serdes_core_rx_polarity_flip_physical{74}=0x9C +serdes_core_rx_polarity_flip_physical{75}=0x9C +serdes_core_rx_polarity_flip_physical{76}=0x9C +serdes_core_rx_polarity_flip_physical{77}=0x9C +serdes_core_rx_polarity_flip_physical{78}=0x9C +serdes_core_rx_polarity_flip_physical{79}=0x9C +serdes_core_rx_polarity_flip_physical{80}=0x9C +serdes_core_tx_polarity_flip_physical{73}=0xAC +serdes_core_tx_polarity_flip_physical{74}=0xAC +serdes_core_tx_polarity_flip_physical{75}=0xAC +serdes_core_tx_polarity_flip_physical{76}=0xAC +serdes_core_tx_polarity_flip_physical{77}=0xAC +serdes_core_tx_polarity_flip_physical{78}=0xAC +serdes_core_tx_polarity_flip_physical{79}=0xAC +serdes_core_tx_polarity_flip_physical{80}=0xAC + +#BC10# +dport_map_port_48=9 +dport_map_port_49=10 +dport_map_port_50=11 +dport_map_port_51=12 +portmap_48=81:100:4 +phy_chain_rx_lane_map_physical{81.0}=0x20563147 +phy_chain_rx_lane_map_physical{82.0}=0x20563147 +phy_chain_rx_lane_map_physical{83.0}=0x20563147 +phy_chain_rx_lane_map_physical{84.0}=0x20563147 +phy_chain_rx_lane_map_physical{85.0}=0x20563147 +phy_chain_rx_lane_map_physical{86.0}=0x20563147 +phy_chain_rx_lane_map_physical{87.0}=0x20563147 +phy_chain_rx_lane_map_physical{88.0}=0x20563147 +phy_chain_tx_lane_map_physical{81.0}=0x53216704 +phy_chain_tx_lane_map_physical{82.0}=0x53216704 +phy_chain_tx_lane_map_physical{83.0}=0x53216704 +phy_chain_tx_lane_map_physical{84.0}=0x53216704 +phy_chain_tx_lane_map_physical{85.0}=0x53216704 +phy_chain_tx_lane_map_physical{86.0}=0x53216704 +phy_chain_tx_lane_map_physical{87.0}=0x53216704 +phy_chain_tx_lane_map_physical{88.0}=0x53216704 +serdes_core_rx_polarity_flip_physical{81}=0xE1 +serdes_core_rx_polarity_flip_physical{82}=0xE1 +serdes_core_rx_polarity_flip_physical{83}=0xE1 +serdes_core_rx_polarity_flip_physical{84}=0xE1 +serdes_core_rx_polarity_flip_physical{85}=0xE1 +serdes_core_rx_polarity_flip_physical{86}=0xE1 +serdes_core_rx_polarity_flip_physical{87}=0xE1 +serdes_core_rx_polarity_flip_physical{88}=0xE1 +serdes_core_tx_polarity_flip_physical{81}=0xA2 +serdes_core_tx_polarity_flip_physical{82}=0xA2 +serdes_core_tx_polarity_flip_physical{83}=0xA2 +serdes_core_tx_polarity_flip_physical{84}=0xA2 +serdes_core_tx_polarity_flip_physical{85}=0xA2 +serdes_core_tx_polarity_flip_physical{86}=0xA2 +serdes_core_tx_polarity_flip_physical{87}=0xA2 +serdes_core_tx_polarity_flip_physical{88}=0xA2 + +#BC11# +dport_map_port_52=13 +dport_map_port_53=14 +dport_map_port_54=15 +dport_map_port_55=16 +portmap_52=89:100:4 +phy_chain_rx_lane_map_physical{89.0}=0x02514376 +phy_chain_rx_lane_map_physical{90.0}=0x02514376 +phy_chain_rx_lane_map_physical{91.0}=0x02514376 +phy_chain_rx_lane_map_physical{92.0}=0x02514376 +phy_chain_rx_lane_map_physical{93.0}=0x02514376 +phy_chain_rx_lane_map_physical{94.0}=0x02514376 +phy_chain_rx_lane_map_physical{95.0}=0x02514376 +phy_chain_rx_lane_map_physical{96.0}=0x02514376 +phy_chain_tx_lane_map_physical{89.0}=0x64012735 +phy_chain_tx_lane_map_physical{90.0}=0x64012735 +phy_chain_tx_lane_map_physical{91.0}=0x64012735 +phy_chain_tx_lane_map_physical{92.0}=0x64012735 +phy_chain_tx_lane_map_physical{93.0}=0x64012735 +phy_chain_tx_lane_map_physical{94.0}=0x64012735 +phy_chain_tx_lane_map_physical{95.0}=0x64012735 +phy_chain_tx_lane_map_physical{96.0}=0x64012735 +serdes_core_rx_polarity_flip_physical{89}=0xE2 +serdes_core_rx_polarity_flip_physical{90}=0xE2 +serdes_core_rx_polarity_flip_physical{91}=0xE2 +serdes_core_rx_polarity_flip_physical{92}=0xE2 +serdes_core_rx_polarity_flip_physical{93}=0xE2 +serdes_core_rx_polarity_flip_physical{94}=0xE2 +serdes_core_rx_polarity_flip_physical{95}=0xE2 +serdes_core_rx_polarity_flip_physical{96}=0xE2 +serdes_core_tx_polarity_flip_physical{89}=0xCF +serdes_core_tx_polarity_flip_physical{90}=0xCF +serdes_core_tx_polarity_flip_physical{91}=0xCF +serdes_core_tx_polarity_flip_physical{92}=0xCF +serdes_core_tx_polarity_flip_physical{93}=0xCF +serdes_core_tx_polarity_flip_physical{94}=0xCF +serdes_core_tx_polarity_flip_physical{95}=0xCF +serdes_core_tx_polarity_flip_physical{96}=0xCF + +#BC12# +dport_map_port_60=17 +dport_map_port_61=18 +dport_map_port_62=19 +dport_map_port_63=20 +portmap_60=97:100:4 +phy_chain_rx_lane_map_physical{97.0}=0x51276034 +phy_chain_rx_lane_map_physical{98.0}=0x51276034 +phy_chain_rx_lane_map_physical{99.0}=0x51276034 +phy_chain_rx_lane_map_physical{100.0}=0x51276034 +phy_chain_rx_lane_map_physical{101.0}=0x51276034 +phy_chain_rx_lane_map_physical{102.0}=0x51276034 +phy_chain_rx_lane_map_physical{103.0}=0x51276034 +phy_chain_rx_lane_map_physical{104.0}=0x51276034 +phy_chain_tx_lane_map_physical{97.0}=0x05476321 +phy_chain_tx_lane_map_physical{98.0}=0x05476321 +phy_chain_tx_lane_map_physical{99.0}=0x05476321 +phy_chain_tx_lane_map_physical{100.0}=0x05476321 +phy_chain_tx_lane_map_physical{101.0}=0x05476321 +phy_chain_tx_lane_map_physical{102.0}=0x05476321 +phy_chain_tx_lane_map_physical{103.0}=0x05476321 +phy_chain_tx_lane_map_physical{104.0}=0x05476321 +serdes_core_rx_polarity_flip_physical{97}=0x8E +serdes_core_rx_polarity_flip_physical{98}=0x8E +serdes_core_rx_polarity_flip_physical{99}=0x8E +serdes_core_rx_polarity_flip_physical{100}=0x8E +serdes_core_rx_polarity_flip_physical{101}=0x8E +serdes_core_rx_polarity_flip_physical{102}=0x8E +serdes_core_rx_polarity_flip_physical{103}=0x8E +serdes_core_rx_polarity_flip_physical{104}=0x8E +serdes_core_tx_polarity_flip_physical{97}=0xC8 +serdes_core_tx_polarity_flip_physical{98}=0xC8 +serdes_core_tx_polarity_flip_physical{99}=0xC8 +serdes_core_tx_polarity_flip_physical{100}=0xC8 +serdes_core_tx_polarity_flip_physical{101}=0xC8 +serdes_core_tx_polarity_flip_physical{102}=0xC8 +serdes_core_tx_polarity_flip_physical{103}=0xC8 +serdes_core_tx_polarity_flip_physical{104}=0xC8 + +#BC13# +dport_map_port_64=21 +dport_map_port_65=22 +dport_map_port_66=23 +dport_map_port_67=24 +portmap_64=105:100:4 +phy_chain_rx_lane_map_physical{105.0}=0x74126503 +phy_chain_rx_lane_map_physical{106.0}=0x74126503 +phy_chain_rx_lane_map_physical{107.0}=0x74126503 +phy_chain_rx_lane_map_physical{108.0}=0x74126503 +phy_chain_rx_lane_map_physical{109.0}=0x74126503 +phy_chain_rx_lane_map_physical{110.0}=0x74126503 +phy_chain_rx_lane_map_physical{111.0}=0x74126503 +phy_chain_rx_lane_map_physical{112.0}=0x74126503 +phy_chain_tx_lane_map_physical{105.0}=0x75236140 +phy_chain_tx_lane_map_physical{106.0}=0x75236140 +phy_chain_tx_lane_map_physical{107.0}=0x75236140 +phy_chain_tx_lane_map_physical{108.0}=0x75236140 +phy_chain_tx_lane_map_physical{109.0}=0x75236140 +phy_chain_tx_lane_map_physical{110.0}=0x75236140 +phy_chain_tx_lane_map_physical{111.0}=0x75236140 +phy_chain_tx_lane_map_physical{112.0}=0x75236140 +serdes_core_rx_polarity_flip_physical{105}=0x96 +serdes_core_rx_polarity_flip_physical{106}=0x96 +serdes_core_rx_polarity_flip_physical{107}=0x96 +serdes_core_rx_polarity_flip_physical{108}=0x96 +serdes_core_rx_polarity_flip_physical{109}=0x96 +serdes_core_rx_polarity_flip_physical{110}=0x96 +serdes_core_rx_polarity_flip_physical{111}=0x96 +serdes_core_rx_polarity_flip_physical{112}=0x96 +serdes_core_tx_polarity_flip_physical{105}=0xE1 +serdes_core_tx_polarity_flip_physical{106}=0xE1 +serdes_core_tx_polarity_flip_physical{107}=0xE1 +serdes_core_tx_polarity_flip_physical{108}=0xE1 +serdes_core_tx_polarity_flip_physical{109}=0xE1 +serdes_core_tx_polarity_flip_physical{110}=0xE1 +serdes_core_tx_polarity_flip_physical{111}=0xE1 +serdes_core_tx_polarity_flip_physical{112}=0xE1 + +#BC14# +dport_map_port_68=25 +dport_map_port_69=26 +dport_map_port_70=27 +dport_map_port_71=28 +portmap_68=113:100:4 +phy_chain_rx_lane_map_physical{113.0}=0x32461057 +phy_chain_rx_lane_map_physical{114.0}=0x32461057 +phy_chain_rx_lane_map_physical{115.0}=0x32461057 +phy_chain_rx_lane_map_physical{116.0}=0x32461057 +phy_chain_rx_lane_map_physical{117.0}=0x32461057 +phy_chain_rx_lane_map_physical{118.0}=0x32461057 +phy_chain_rx_lane_map_physical{119.0}=0x32461057 +phy_chain_rx_lane_map_physical{120.0}=0x32461057 +phy_chain_tx_lane_map_physical{113.0}=0x54107362 +phy_chain_tx_lane_map_physical{114.0}=0x54107362 +phy_chain_tx_lane_map_physical{115.0}=0x54107362 +phy_chain_tx_lane_map_physical{116.0}=0x54107362 +phy_chain_tx_lane_map_physical{117.0}=0x54107362 +phy_chain_tx_lane_map_physical{118.0}=0x54107362 +phy_chain_tx_lane_map_physical{119.0}=0x54107362 +phy_chain_tx_lane_map_physical{120.0}=0x54107362 +serdes_core_rx_polarity_flip_physical{113}=0x47 +serdes_core_rx_polarity_flip_physical{114}=0x47 +serdes_core_rx_polarity_flip_physical{115}=0x47 +serdes_core_rx_polarity_flip_physical{116}=0x47 +serdes_core_rx_polarity_flip_physical{117}=0x47 +serdes_core_rx_polarity_flip_physical{118}=0x47 +serdes_core_rx_polarity_flip_physical{119}=0x47 +serdes_core_rx_polarity_flip_physical{120}=0x47 +serdes_core_tx_polarity_flip_physical{113}=0xBD +serdes_core_tx_polarity_flip_physical{114}=0xBD +serdes_core_tx_polarity_flip_physical{115}=0xBD +serdes_core_tx_polarity_flip_physical{116}=0xBD +serdes_core_tx_polarity_flip_physical{117}=0xBD +serdes_core_tx_polarity_flip_physical{118}=0xBD +serdes_core_tx_polarity_flip_physical{119}=0xBD +serdes_core_tx_polarity_flip_physical{120}=0xBD + +#BC15# +dport_map_port_72=29 +dport_map_port_73=30 +dport_map_port_74=31 +dport_map_port_75=32 +portmap_72=121:100:4 +phy_chain_rx_lane_map_physical{121.0}=0x75342610 +phy_chain_rx_lane_map_physical{122.0}=0x75342610 +phy_chain_rx_lane_map_physical{123.0}=0x75342610 +phy_chain_rx_lane_map_physical{124.0}=0x75342610 +phy_chain_rx_lane_map_physical{125.0}=0x75342610 +phy_chain_rx_lane_map_physical{126.0}=0x75342610 +phy_chain_rx_lane_map_physical{127.0}=0x75342610 +phy_chain_rx_lane_map_physical{128.0}=0x75342610 +phy_chain_tx_lane_map_physical{121.0}=0x24617350 +phy_chain_tx_lane_map_physical{122.0}=0x24617350 +phy_chain_tx_lane_map_physical{123.0}=0x24617350 +phy_chain_tx_lane_map_physical{124.0}=0x24617350 +phy_chain_tx_lane_map_physical{125.0}=0x24617350 +phy_chain_tx_lane_map_physical{126.0}=0x24617350 +phy_chain_tx_lane_map_physical{127.0}=0x24617350 +phy_chain_tx_lane_map_physical{128.0}=0x24617350 +serdes_core_rx_polarity_flip_physical{121}=0x36 +serdes_core_rx_polarity_flip_physical{122}=0x36 +serdes_core_rx_polarity_flip_physical{123}=0x36 +serdes_core_rx_polarity_flip_physical{124}=0x36 +serdes_core_rx_polarity_flip_physical{125}=0x36 +serdes_core_rx_polarity_flip_physical{126}=0x36 +serdes_core_rx_polarity_flip_physical{127}=0x36 +serdes_core_rx_polarity_flip_physical{128}=0x36 +serdes_core_tx_polarity_flip_physical{121}=0x7F +serdes_core_tx_polarity_flip_physical{122}=0x7F +serdes_core_tx_polarity_flip_physical{123}=0x7F +serdes_core_tx_polarity_flip_physical{124}=0x7F +serdes_core_tx_polarity_flip_physical{125}=0x7F +serdes_core_tx_polarity_flip_physical{126}=0x7F +serdes_core_tx_polarity_flip_physical{127}=0x7F +serdes_core_tx_polarity_flip_physical{128}=0x7F + +#BC16# +dport_map_port_80=49 +dport_map_port_81=50 +dport_map_port_82=51 +dport_map_port_83=52 +portmap_80=129:100:4 +phy_chain_rx_lane_map_physical{129.0}=0x45302716 +phy_chain_rx_lane_map_physical{130.0}=0x45302716 +phy_chain_rx_lane_map_physical{131.0}=0x45302716 +phy_chain_rx_lane_map_physical{132.0}=0x45302716 +phy_chain_rx_lane_map_physical{133.0}=0x45302716 +phy_chain_rx_lane_map_physical{134.0}=0x45302716 +phy_chain_rx_lane_map_physical{135.0}=0x45302716 +phy_chain_rx_lane_map_physical{136.0}=0x45302716 +phy_chain_tx_lane_map_physical{129.0}=0x24763150 +phy_chain_tx_lane_map_physical{130.0}=0x24763150 +phy_chain_tx_lane_map_physical{131.0}=0x24763150 +phy_chain_tx_lane_map_physical{132.0}=0x24763150 +phy_chain_tx_lane_map_physical{133.0}=0x24763150 +phy_chain_tx_lane_map_physical{134.0}=0x24763150 +phy_chain_tx_lane_map_physical{135.0}=0x24763150 +phy_chain_tx_lane_map_physical{136.0}=0x24763150 +serdes_core_rx_polarity_flip_physical{129}=0xA3 +serdes_core_rx_polarity_flip_physical{130}=0xA3 +serdes_core_rx_polarity_flip_physical{131}=0xA3 +serdes_core_rx_polarity_flip_physical{132}=0xA3 +serdes_core_rx_polarity_flip_physical{133}=0xA3 +serdes_core_rx_polarity_flip_physical{134}=0xA3 +serdes_core_rx_polarity_flip_physical{135}=0xA3 +serdes_core_rx_polarity_flip_physical{136}=0xA3 +serdes_core_tx_polarity_flip_physical{129}=0x5C +serdes_core_tx_polarity_flip_physical{130}=0x5C +serdes_core_tx_polarity_flip_physical{131}=0x5C +serdes_core_tx_polarity_flip_physical{132}=0x5C +serdes_core_tx_polarity_flip_physical{133}=0x5C +serdes_core_tx_polarity_flip_physical{134}=0x5C +serdes_core_tx_polarity_flip_physical{135}=0x5C +serdes_core_tx_polarity_flip_physical{136}=0x5C + +#BC17# +dport_map_port_84=53 +dport_map_port_85=54 +dport_map_port_86=55 +dport_map_port_87=56 +portmap_84=137:100:4 +phy_chain_rx_lane_map_physical{137.0}=0x12460357 +phy_chain_rx_lane_map_physical{138.0}=0x12460357 +phy_chain_rx_lane_map_physical{139.0}=0x12460357 +phy_chain_rx_lane_map_physical{140.0}=0x12460357 +phy_chain_rx_lane_map_physical{141.0}=0x12460357 +phy_chain_rx_lane_map_physical{142.0}=0x12460357 +phy_chain_rx_lane_map_physical{143.0}=0x12460357 +phy_chain_rx_lane_map_physical{144.0}=0x12460357 +phy_chain_tx_lane_map_physical{137.0}=0x70135462 +phy_chain_tx_lane_map_physical{138.0}=0x70135462 +phy_chain_tx_lane_map_physical{139.0}=0x70135462 +phy_chain_tx_lane_map_physical{140.0}=0x70135462 +phy_chain_tx_lane_map_physical{141.0}=0x70135462 +phy_chain_tx_lane_map_physical{142.0}=0x70135462 +phy_chain_tx_lane_map_physical{143.0}=0x70135462 +phy_chain_tx_lane_map_physical{144.0}=0x70135462 +serdes_core_rx_polarity_flip_physical{137}=0x4B +serdes_core_rx_polarity_flip_physical{138}=0x4B +serdes_core_rx_polarity_flip_physical{139}=0x4B +serdes_core_rx_polarity_flip_physical{140}=0x4B +serdes_core_rx_polarity_flip_physical{141}=0x4B +serdes_core_rx_polarity_flip_physical{142}=0x4B +serdes_core_rx_polarity_flip_physical{143}=0x4B +serdes_core_rx_polarity_flip_physical{144}=0x4B +serdes_core_tx_polarity_flip_physical{137}=0xF8 +serdes_core_tx_polarity_flip_physical{138}=0xF8 +serdes_core_tx_polarity_flip_physical{139}=0xF8 +serdes_core_tx_polarity_flip_physical{140}=0xF8 +serdes_core_tx_polarity_flip_physical{141}=0xF8 +serdes_core_tx_polarity_flip_physical{142}=0xF8 +serdes_core_tx_polarity_flip_physical{143}=0xF8 +serdes_core_tx_polarity_flip_physical{144}=0xF8 + +#BC18# +dport_map_port_88=57 +dport_map_port_89=58 +dport_map_port_90=59 +dport_map_port_91=60 +portmap_88=145:100:4 +phy_chain_rx_lane_map_physical{145.0}=0x20563147 +phy_chain_rx_lane_map_physical{146.0}=0x20563147 +phy_chain_rx_lane_map_physical{147.0}=0x20563147 +phy_chain_rx_lane_map_physical{148.0}=0x20563147 +phy_chain_rx_lane_map_physical{149.0}=0x20563147 +phy_chain_rx_lane_map_physical{150.0}=0x20563147 +phy_chain_rx_lane_map_physical{151.0}=0x20563147 +phy_chain_rx_lane_map_physical{152.0}=0x20563147 +phy_chain_tx_lane_map_physical{145.0}=0x54126073 +phy_chain_tx_lane_map_physical{146.0}=0x54126073 +phy_chain_tx_lane_map_physical{147.0}=0x54126073 +phy_chain_tx_lane_map_physical{148.0}=0x54126073 +phy_chain_tx_lane_map_physical{149.0}=0x54126073 +phy_chain_tx_lane_map_physical{150.0}=0x54126073 +phy_chain_tx_lane_map_physical{151.0}=0x54126073 +phy_chain_tx_lane_map_physical{152.0}=0x54126073 +serdes_core_rx_polarity_flip_physical{145}=0xE1 +serdes_core_rx_polarity_flip_physical{146}=0xE1 +serdes_core_rx_polarity_flip_physical{147}=0xE1 +serdes_core_rx_polarity_flip_physical{148}=0xE1 +serdes_core_rx_polarity_flip_physical{149}=0xE1 +serdes_core_rx_polarity_flip_physical{150}=0xE1 +serdes_core_rx_polarity_flip_physical{151}=0xE1 +serdes_core_rx_polarity_flip_physical{152}=0xE1 +serdes_core_tx_polarity_flip_physical{145}=0xD5 +serdes_core_tx_polarity_flip_physical{146}=0xD5 +serdes_core_tx_polarity_flip_physical{147}=0xD5 +serdes_core_tx_polarity_flip_physical{148}=0xD5 +serdes_core_tx_polarity_flip_physical{149}=0xD5 +serdes_core_tx_polarity_flip_physical{150}=0xD5 +serdes_core_tx_polarity_flip_physical{151}=0xD5 +serdes_core_tx_polarity_flip_physical{152}=0xD5 + +#BC19# +dport_map_port_92=61 +dport_map_port_93=62 +dport_map_port_94=63 +dport_map_port_95=64 +portmap_92=153:100:4 +phy_chain_rx_lane_map_physical{153.0}=0x10652473 +phy_chain_rx_lane_map_physical{154.0}=0x10652473 +phy_chain_rx_lane_map_physical{155.0}=0x10652473 +phy_chain_rx_lane_map_physical{156.0}=0x10652473 +phy_chain_rx_lane_map_physical{157.0}=0x10652473 +phy_chain_rx_lane_map_physical{158.0}=0x10652473 +phy_chain_rx_lane_map_physical{159.0}=0x10652473 +phy_chain_rx_lane_map_physical{160.0}=0x10652473 +phy_chain_tx_lane_map_physical{153.0}=0x15036427 +phy_chain_tx_lane_map_physical{154.0}=0x15036427 +phy_chain_tx_lane_map_physical{155.0}=0x15036427 +phy_chain_tx_lane_map_physical{156.0}=0x15036427 +phy_chain_tx_lane_map_physical{157.0}=0x15036427 +phy_chain_tx_lane_map_physical{158.0}=0x15036427 +phy_chain_tx_lane_map_physical{159.0}=0x15036427 +phy_chain_tx_lane_map_physical{160.0}=0x15036427 +serdes_core_rx_polarity_flip_physical{153}=0xB1 +serdes_core_rx_polarity_flip_physical{154}=0xB1 +serdes_core_rx_polarity_flip_physical{155}=0xB1 +serdes_core_rx_polarity_flip_physical{156}=0xB1 +serdes_core_rx_polarity_flip_physical{157}=0xB1 +serdes_core_rx_polarity_flip_physical{158}=0xB1 +serdes_core_rx_polarity_flip_physical{159}=0xB1 +serdes_core_rx_polarity_flip_physical{160}=0xB1 +serdes_core_tx_polarity_flip_physical{153}=0x5E +serdes_core_tx_polarity_flip_physical{154}=0x5E +serdes_core_tx_polarity_flip_physical{155}=0x5E +serdes_core_tx_polarity_flip_physical{156}=0x5E +serdes_core_tx_polarity_flip_physical{157}=0x5E +serdes_core_tx_polarity_flip_physical{158}=0x5E +serdes_core_tx_polarity_flip_physical{159}=0x5E +serdes_core_tx_polarity_flip_physical{160}=0x5E + +#BC20# +dport_map_port_104=69 +dport_map_port_105=70 +dport_map_port_106=71 +dport_map_port_107=72 +portmap_104=161:100:4 +phy_chain_rx_lane_map_physical{161.0}=0x70125643 +phy_chain_rx_lane_map_physical{162.0}=0x70125643 +phy_chain_rx_lane_map_physical{163.0}=0x70125643 +phy_chain_rx_lane_map_physical{164.0}=0x70125643 +phy_chain_rx_lane_map_physical{165.0}=0x70125643 +phy_chain_rx_lane_map_physical{166.0}=0x70125643 +phy_chain_rx_lane_map_physical{167.0}=0x70125643 +phy_chain_rx_lane_map_physical{168.0}=0x70125643 +phy_chain_tx_lane_map_physical{161.0}=0x21073456 +phy_chain_tx_lane_map_physical{162.0}=0x21073456 +phy_chain_tx_lane_map_physical{163.0}=0x21073456 +phy_chain_tx_lane_map_physical{164.0}=0x21073456 +phy_chain_tx_lane_map_physical{165.0}=0x21073456 +phy_chain_tx_lane_map_physical{166.0}=0x21073456 +phy_chain_tx_lane_map_physical{167.0}=0x21073456 +phy_chain_tx_lane_map_physical{168.0}=0x21073456 +serdes_core_rx_polarity_flip_physical{161}=0x27 +serdes_core_rx_polarity_flip_physical{162}=0x27 +serdes_core_rx_polarity_flip_physical{163}=0x27 +serdes_core_rx_polarity_flip_physical{164}=0x27 +serdes_core_rx_polarity_flip_physical{165}=0x27 +serdes_core_rx_polarity_flip_physical{166}=0x27 +serdes_core_rx_polarity_flip_physical{167}=0x27 +serdes_core_rx_polarity_flip_physical{168}=0x27 +serdes_core_tx_polarity_flip_physical{161}=0x5 +serdes_core_tx_polarity_flip_physical{162}=0x5 +serdes_core_tx_polarity_flip_physical{163}=0x5 +serdes_core_tx_polarity_flip_physical{164}=0x5 +serdes_core_tx_polarity_flip_physical{165}=0x5 +serdes_core_tx_polarity_flip_physical{166}=0x5 +serdes_core_tx_polarity_flip_physical{167}=0x5 +serdes_core_tx_polarity_flip_physical{168}=0x5 + +#BC21# +dport_map_port_100=65 +dport_map_port_101=66 +dport_map_port_102=67 +dport_map_port_103=68 +portmap_100=169:100:4 +phy_chain_rx_lane_map_physical{169.0}=0x27416350 +phy_chain_rx_lane_map_physical{170.0}=0x27416350 +phy_chain_rx_lane_map_physical{171.0}=0x27416350 +phy_chain_rx_lane_map_physical{172.0}=0x27416350 +phy_chain_rx_lane_map_physical{173.0}=0x27416350 +phy_chain_rx_lane_map_physical{174.0}=0x27416350 +phy_chain_rx_lane_map_physical{175.0}=0x27416350 +phy_chain_rx_lane_map_physical{176.0}=0x27416350 +phy_chain_tx_lane_map_physical{169.0}=0x36570412 +phy_chain_tx_lane_map_physical{170.0}=0x36570412 +phy_chain_tx_lane_map_physical{171.0}=0x36570412 +phy_chain_tx_lane_map_physical{172.0}=0x36570412 +phy_chain_tx_lane_map_physical{173.0}=0x36570412 +phy_chain_tx_lane_map_physical{174.0}=0x36570412 +phy_chain_tx_lane_map_physical{175.0}=0x36570412 +phy_chain_tx_lane_map_physical{176.0}=0x36570412 +serdes_core_rx_polarity_flip_physical{169}=0x3C +serdes_core_rx_polarity_flip_physical{170}=0x3C +serdes_core_rx_polarity_flip_physical{171}=0x3C +serdes_core_rx_polarity_flip_physical{172}=0x3C +serdes_core_rx_polarity_flip_physical{173}=0x3C +serdes_core_rx_polarity_flip_physical{174}=0x3C +serdes_core_rx_polarity_flip_physical{175}=0x3C +serdes_core_rx_polarity_flip_physical{176}=0x3C +serdes_core_tx_polarity_flip_physical{169}=0x7D +serdes_core_tx_polarity_flip_physical{170}=0x7D +serdes_core_tx_polarity_flip_physical{171}=0x7D +serdes_core_tx_polarity_flip_physical{172}=0x7D +serdes_core_tx_polarity_flip_physical{173}=0x7D +serdes_core_tx_polarity_flip_physical{174}=0x7D +serdes_core_tx_polarity_flip_physical{175}=0x7D +serdes_core_tx_polarity_flip_physical{176}=0x7D + +#BC22# +dport_map_port_108=73 +dport_map_port_109=74 +dport_map_port_110=75 +dport_map_port_111=76 +portmap_108=177:100:4 +phy_chain_rx_lane_map_physical{177.0}=0x04153726 +phy_chain_rx_lane_map_physical{178.0}=0x04153726 +phy_chain_rx_lane_map_physical{179.0}=0x04153726 +phy_chain_rx_lane_map_physical{180.0}=0x04153726 +phy_chain_rx_lane_map_physical{181.0}=0x04153726 +phy_chain_rx_lane_map_physical{182.0}=0x04153726 +phy_chain_rx_lane_map_physical{183.0}=0x04153726 +phy_chain_rx_lane_map_physical{184.0}=0x04153726 +phy_chain_tx_lane_map_physical{177.0}=0x47305162 +phy_chain_tx_lane_map_physical{178.0}=0x47305162 +phy_chain_tx_lane_map_physical{179.0}=0x47305162 +phy_chain_tx_lane_map_physical{180.0}=0x47305162 +phy_chain_tx_lane_map_physical{181.0}=0x47305162 +phy_chain_tx_lane_map_physical{182.0}=0x47305162 +phy_chain_tx_lane_map_physical{183.0}=0x47305162 +phy_chain_tx_lane_map_physical{184.0}=0x47305162 +serdes_core_rx_polarity_flip_physical{177}=0x96 +serdes_core_rx_polarity_flip_physical{178}=0x96 +serdes_core_rx_polarity_flip_physical{179}=0x96 +serdes_core_rx_polarity_flip_physical{180}=0x96 +serdes_core_rx_polarity_flip_physical{181}=0x96 +serdes_core_rx_polarity_flip_physical{182}=0x96 +serdes_core_rx_polarity_flip_physical{183}=0x96 +serdes_core_rx_polarity_flip_physical{184}=0x96 +serdes_core_tx_polarity_flip_physical{177}=0xE9 +serdes_core_tx_polarity_flip_physical{178}=0xE9 +serdes_core_tx_polarity_flip_physical{179}=0xE9 +serdes_core_tx_polarity_flip_physical{180}=0xE9 +serdes_core_tx_polarity_flip_physical{181}=0xE9 +serdes_core_tx_polarity_flip_physical{182}=0xE9 +serdes_core_tx_polarity_flip_physical{183}=0xE9 +serdes_core_tx_polarity_flip_physical{184}=0xE9 + +#BC23# +dport_map_port_112=77 +dport_map_port_113=78 +dport_map_port_114=79 +dport_map_port_115=80 +portmap_112=185:100:4 +phy_chain_rx_lane_map_physical{185.0}=0x02561347 +phy_chain_rx_lane_map_physical{186.0}=0x02561347 +phy_chain_rx_lane_map_physical{187.0}=0x02561347 +phy_chain_rx_lane_map_physical{188.0}=0x02561347 +phy_chain_rx_lane_map_physical{189.0}=0x02561347 +phy_chain_rx_lane_map_physical{190.0}=0x02561347 +phy_chain_rx_lane_map_physical{191.0}=0x02561347 +phy_chain_rx_lane_map_physical{192.0}=0x02561347 +phy_chain_tx_lane_map_physical{185.0}=0x50327614 +phy_chain_tx_lane_map_physical{186.0}=0x50327614 +phy_chain_tx_lane_map_physical{187.0}=0x50327614 +phy_chain_tx_lane_map_physical{188.0}=0x50327614 +phy_chain_tx_lane_map_physical{189.0}=0x50327614 +phy_chain_tx_lane_map_physical{190.0}=0x50327614 +phy_chain_tx_lane_map_physical{191.0}=0x50327614 +phy_chain_tx_lane_map_physical{192.0}=0x50327614 +serdes_core_rx_polarity_flip_physical{185}=0xE1 +serdes_core_rx_polarity_flip_physical{186}=0xE1 +serdes_core_rx_polarity_flip_physical{187}=0xE1 +serdes_core_rx_polarity_flip_physical{188}=0xE1 +serdes_core_rx_polarity_flip_physical{189}=0xE1 +serdes_core_rx_polarity_flip_physical{190}=0xE1 +serdes_core_rx_polarity_flip_physical{191}=0xE1 +serdes_core_rx_polarity_flip_physical{192}=0xE1 +serdes_core_tx_polarity_flip_physical{185}=0x0 +serdes_core_tx_polarity_flip_physical{186}=0x0 +serdes_core_tx_polarity_flip_physical{187}=0x0 +serdes_core_tx_polarity_flip_physical{188}=0x0 +serdes_core_tx_polarity_flip_physical{189}=0x0 +serdes_core_tx_polarity_flip_physical{190}=0x0 +serdes_core_tx_polarity_flip_physical{191}=0x0 +serdes_core_tx_polarity_flip_physical{192}=0x0 + +#BC24# +dport_map_port_124=101 +dport_map_port_125=102 +dport_map_port_126=103 +dport_map_port_127=104 +portmap_124=193:100:4 +phy_chain_rx_lane_map_physical{193.0}=0x74126503 +phy_chain_rx_lane_map_physical{194.0}=0x74126503 +phy_chain_rx_lane_map_physical{195.0}=0x74126503 +phy_chain_rx_lane_map_physical{196.0}=0x74126503 +phy_chain_rx_lane_map_physical{197.0}=0x74126503 +phy_chain_rx_lane_map_physical{198.0}=0x74126503 +phy_chain_rx_lane_map_physical{199.0}=0x74126503 +phy_chain_rx_lane_map_physical{200.0}=0x74126503 +phy_chain_tx_lane_map_physical{193.0}=0x43571620 +phy_chain_tx_lane_map_physical{194.0}=0x43571620 +phy_chain_tx_lane_map_physical{195.0}=0x43571620 +phy_chain_tx_lane_map_physical{196.0}=0x43571620 +phy_chain_tx_lane_map_physical{197.0}=0x43571620 +phy_chain_tx_lane_map_physical{198.0}=0x43571620 +phy_chain_tx_lane_map_physical{199.0}=0x43571620 +phy_chain_tx_lane_map_physical{200.0}=0x43571620 +serdes_core_rx_polarity_flip_physical{193}=0x69 +serdes_core_rx_polarity_flip_physical{194}=0x69 +serdes_core_rx_polarity_flip_physical{195}=0x69 +serdes_core_rx_polarity_flip_physical{196}=0x69 +serdes_core_rx_polarity_flip_physical{197}=0x69 +serdes_core_rx_polarity_flip_physical{198}=0x69 +serdes_core_rx_polarity_flip_physical{199}=0x69 +serdes_core_rx_polarity_flip_physical{200}=0x69 +serdes_core_tx_polarity_flip_physical{193}=0xC4 +serdes_core_tx_polarity_flip_physical{194}=0xC4 +serdes_core_tx_polarity_flip_physical{195}=0xC4 +serdes_core_tx_polarity_flip_physical{196}=0xC4 +serdes_core_tx_polarity_flip_physical{197}=0xC4 +serdes_core_tx_polarity_flip_physical{198}=0xC4 +serdes_core_tx_polarity_flip_physical{199}=0xC4 +serdes_core_tx_polarity_flip_physical{200}=0xC4 + +#BC25# +dport_map_port_120=97 +dport_map_port_121=98 +dport_map_port_122=99 +dport_map_port_123=100 +portmap_120=201:100:4 +phy_chain_rx_lane_map_physical{201.0}=0x45031726 +phy_chain_rx_lane_map_physical{202.0}=0x45031726 +phy_chain_rx_lane_map_physical{203.0}=0x45031726 +phy_chain_rx_lane_map_physical{204.0}=0x45031726 +phy_chain_rx_lane_map_physical{205.0}=0x45031726 +phy_chain_rx_lane_map_physical{206.0}=0x45031726 +phy_chain_rx_lane_map_physical{207.0}=0x45031726 +phy_chain_rx_lane_map_physical{208.0}=0x45031726 +phy_chain_tx_lane_map_physical{201.0}=0x23761450 +phy_chain_tx_lane_map_physical{202.0}=0x23761450 +phy_chain_tx_lane_map_physical{203.0}=0x23761450 +phy_chain_tx_lane_map_physical{204.0}=0x23761450 +phy_chain_tx_lane_map_physical{205.0}=0x23761450 +phy_chain_tx_lane_map_physical{206.0}=0x23761450 +phy_chain_tx_lane_map_physical{207.0}=0x23761450 +phy_chain_tx_lane_map_physical{208.0}=0x23761450 +serdes_core_rx_polarity_flip_physical{201}=0x99 +serdes_core_rx_polarity_flip_physical{202}=0x99 +serdes_core_rx_polarity_flip_physical{203}=0x99 +serdes_core_rx_polarity_flip_physical{204}=0x99 +serdes_core_rx_polarity_flip_physical{205}=0x99 +serdes_core_rx_polarity_flip_physical{206}=0x99 +serdes_core_rx_polarity_flip_physical{207}=0x99 +serdes_core_rx_polarity_flip_physical{208}=0x99 +serdes_core_tx_polarity_flip_physical{201}=0x7F +serdes_core_tx_polarity_flip_physical{202}=0x7F +serdes_core_tx_polarity_flip_physical{203}=0x7F +serdes_core_tx_polarity_flip_physical{204}=0x7F +serdes_core_tx_polarity_flip_physical{205}=0x7F +serdes_core_tx_polarity_flip_physical{206}=0x7F +serdes_core_tx_polarity_flip_physical{207}=0x7F +serdes_core_tx_polarity_flip_physical{208}=0x7F + +#BC26# +dport_map_port_132=109 +dport_map_port_133=110 +dport_map_port_134=111 +dport_map_port_135=112 +portmap_132=209:100:4 +phy_chain_rx_lane_map_physical{209.0}=0x46150723 +phy_chain_rx_lane_map_physical{210.0}=0x46150723 +phy_chain_rx_lane_map_physical{211.0}=0x46150723 +phy_chain_rx_lane_map_physical{212.0}=0x46150723 +phy_chain_rx_lane_map_physical{213.0}=0x46150723 +phy_chain_rx_lane_map_physical{214.0}=0x46150723 +phy_chain_rx_lane_map_physical{215.0}=0x46150723 +phy_chain_rx_lane_map_physical{216.0}=0x46150723 +phy_chain_tx_lane_map_physical{209.0}=0x12603754 +phy_chain_tx_lane_map_physical{210.0}=0x12603754 +phy_chain_tx_lane_map_physical{211.0}=0x12603754 +phy_chain_tx_lane_map_physical{212.0}=0x12603754 +phy_chain_tx_lane_map_physical{213.0}=0x12603754 +phy_chain_tx_lane_map_physical{214.0}=0x12603754 +phy_chain_tx_lane_map_physical{215.0}=0x12603754 +phy_chain_tx_lane_map_physical{216.0}=0x12603754 +serdes_core_rx_polarity_flip_physical{209}=0xE1 +serdes_core_rx_polarity_flip_physical{210}=0xE1 +serdes_core_rx_polarity_flip_physical{211}=0xE1 +serdes_core_rx_polarity_flip_physical{212}=0xE1 +serdes_core_rx_polarity_flip_physical{213}=0xE1 +serdes_core_rx_polarity_flip_physical{214}=0xE1 +serdes_core_rx_polarity_flip_physical{215}=0xE1 +serdes_core_rx_polarity_flip_physical{216}=0xE1 +serdes_core_tx_polarity_flip_physical{209}=0x29 +serdes_core_tx_polarity_flip_physical{210}=0x29 +serdes_core_tx_polarity_flip_physical{211}=0x29 +serdes_core_tx_polarity_flip_physical{212}=0x29 +serdes_core_tx_polarity_flip_physical{213}=0x29 +serdes_core_tx_polarity_flip_physical{214}=0x29 +serdes_core_tx_polarity_flip_physical{215}=0x29 +serdes_core_tx_polarity_flip_physical{216}=0x29 + +#BC27# +dport_map_port_128=105 +dport_map_port_129=106 +dport_map_port_130=107 +dport_map_port_131=108 +portmap_128=217:100:4 +phy_chain_rx_lane_map_physical{217.0}=0x46127503 +phy_chain_rx_lane_map_physical{218.0}=0x46127503 +phy_chain_rx_lane_map_physical{219.0}=0x46127503 +phy_chain_rx_lane_map_physical{220.0}=0x46127503 +phy_chain_rx_lane_map_physical{221.0}=0x46127503 +phy_chain_rx_lane_map_physical{222.0}=0x46127503 +phy_chain_rx_lane_map_physical{223.0}=0x46127503 +phy_chain_rx_lane_map_physical{224.0}=0x46127503 +phy_chain_tx_lane_map_physical{217.0}=0x54273016 +phy_chain_tx_lane_map_physical{218.0}=0x54273016 +phy_chain_tx_lane_map_physical{219.0}=0x54273016 +phy_chain_tx_lane_map_physical{220.0}=0x54273016 +phy_chain_tx_lane_map_physical{221.0}=0x54273016 +phy_chain_tx_lane_map_physical{222.0}=0x54273016 +phy_chain_tx_lane_map_physical{223.0}=0x54273016 +phy_chain_tx_lane_map_physical{224.0}=0x54273016 +serdes_core_rx_polarity_flip_physical{217}=0xE1 +serdes_core_rx_polarity_flip_physical{218}=0xE1 +serdes_core_rx_polarity_flip_physical{219}=0xE1 +serdes_core_rx_polarity_flip_physical{220}=0xE1 +serdes_core_rx_polarity_flip_physical{221}=0xE1 +serdes_core_rx_polarity_flip_physical{222}=0xE1 +serdes_core_rx_polarity_flip_physical{223}=0xE1 +serdes_core_rx_polarity_flip_physical{224}=0xE1 +serdes_core_tx_polarity_flip_physical{217}=0x5B +serdes_core_tx_polarity_flip_physical{218}=0x5B +serdes_core_tx_polarity_flip_physical{219}=0x5B +serdes_core_tx_polarity_flip_physical{220}=0x5B +serdes_core_tx_polarity_flip_physical{221}=0x5B +serdes_core_tx_polarity_flip_physical{222}=0x5B +serdes_core_tx_polarity_flip_physical{223}=0x5B +serdes_core_tx_polarity_flip_physical{224}=0x5B + +#BC28# +dport_map_port_144=117 +dport_map_port_145=118 +dport_map_port_146=119 +dport_map_port_147=120 +portmap_144=225:100:4 +phy_chain_rx_lane_map_physical{225.0}=0x52761340 +phy_chain_rx_lane_map_physical{226.0}=0x52761340 +phy_chain_rx_lane_map_physical{227.0}=0x52761340 +phy_chain_rx_lane_map_physical{228.0}=0x52761340 +phy_chain_rx_lane_map_physical{229.0}=0x52761340 +phy_chain_rx_lane_map_physical{230.0}=0x52761340 +phy_chain_rx_lane_map_physical{231.0}=0x52761340 +phy_chain_rx_lane_map_physical{232.0}=0x52761340 +phy_chain_tx_lane_map_physical{225.0}=0x53462107 +phy_chain_tx_lane_map_physical{226.0}=0x53462107 +phy_chain_tx_lane_map_physical{227.0}=0x53462107 +phy_chain_tx_lane_map_physical{228.0}=0x53462107 +phy_chain_tx_lane_map_physical{229.0}=0x53462107 +phy_chain_tx_lane_map_physical{230.0}=0x53462107 +phy_chain_tx_lane_map_physical{231.0}=0x53462107 +phy_chain_tx_lane_map_physical{232.0}=0x53462107 +serdes_core_rx_polarity_flip_physical{225}=0x3C +serdes_core_rx_polarity_flip_physical{226}=0x3C +serdes_core_rx_polarity_flip_physical{227}=0x3C +serdes_core_rx_polarity_flip_physical{228}=0x3C +serdes_core_rx_polarity_flip_physical{229}=0x3C +serdes_core_rx_polarity_flip_physical{230}=0x3C +serdes_core_rx_polarity_flip_physical{231}=0x3C +serdes_core_rx_polarity_flip_physical{232}=0x3C +serdes_core_tx_polarity_flip_physical{225}=0x71 +serdes_core_tx_polarity_flip_physical{226}=0x71 +serdes_core_tx_polarity_flip_physical{227}=0x71 +serdes_core_tx_polarity_flip_physical{228}=0x71 +serdes_core_tx_polarity_flip_physical{229}=0x71 +serdes_core_tx_polarity_flip_physical{230}=0x71 +serdes_core_tx_polarity_flip_physical{231}=0x71 +serdes_core_tx_polarity_flip_physical{232}=0x71 + +#BC29# +dport_map_port_140=113 +dport_map_port_141=114 +dport_map_port_142=115 +dport_map_port_143=116 +portmap_140=233:100:4 +phy_chain_rx_lane_map_physical{233.0}=0x45021736 +phy_chain_rx_lane_map_physical{234.0}=0x45021736 +phy_chain_rx_lane_map_physical{235.0}=0x45021736 +phy_chain_rx_lane_map_physical{236.0}=0x45021736 +phy_chain_rx_lane_map_physical{237.0}=0x45021736 +phy_chain_rx_lane_map_physical{238.0}=0x45021736 +phy_chain_rx_lane_map_physical{239.0}=0x45021736 +phy_chain_rx_lane_map_physical{240.0}=0x45021736 +phy_chain_tx_lane_map_physical{233.0}=0x20465371 +phy_chain_tx_lane_map_physical{234.0}=0x20465371 +phy_chain_tx_lane_map_physical{235.0}=0x20465371 +phy_chain_tx_lane_map_physical{236.0}=0x20465371 +phy_chain_tx_lane_map_physical{237.0}=0x20465371 +phy_chain_tx_lane_map_physical{238.0}=0x20465371 +phy_chain_tx_lane_map_physical{239.0}=0x20465371 +phy_chain_tx_lane_map_physical{240.0}=0x20465371 +serdes_core_rx_polarity_flip_physical{233}=0x8B +serdes_core_rx_polarity_flip_physical{234}=0x8B +serdes_core_rx_polarity_flip_physical{235}=0x8B +serdes_core_rx_polarity_flip_physical{236}=0x8B +serdes_core_rx_polarity_flip_physical{237}=0x8B +serdes_core_rx_polarity_flip_physical{238}=0x8B +serdes_core_rx_polarity_flip_physical{239}=0x8B +serdes_core_rx_polarity_flip_physical{240}=0x8B +serdes_core_tx_polarity_flip_physical{233}=0x35 +serdes_core_tx_polarity_flip_physical{234}=0x35 +serdes_core_tx_polarity_flip_physical{235}=0x35 +serdes_core_tx_polarity_flip_physical{236}=0x35 +serdes_core_tx_polarity_flip_physical{237}=0x35 +serdes_core_tx_polarity_flip_physical{238}=0x35 +serdes_core_tx_polarity_flip_physical{239}=0x35 +serdes_core_tx_polarity_flip_physical{240}=0x35 + +#BC30# +dport_map_port_152=125 +dport_map_port_153=126 +dport_map_port_154=127 +dport_map_port_155=128 +portmap_152=241:100:4 +phy_chain_rx_lane_map_physical{241.0}=0x65721403 +phy_chain_rx_lane_map_physical{242.0}=0x65721403 +phy_chain_rx_lane_map_physical{243.0}=0x65721403 +phy_chain_rx_lane_map_physical{244.0}=0x65721403 +phy_chain_rx_lane_map_physical{245.0}=0x65721403 +phy_chain_rx_lane_map_physical{246.0}=0x65721403 +phy_chain_rx_lane_map_physical{247.0}=0x65721403 +phy_chain_rx_lane_map_physical{248.0}=0x65721403 +phy_chain_tx_lane_map_physical{241.0}=0x32647150 +phy_chain_tx_lane_map_physical{242.0}=0x32647150 +phy_chain_tx_lane_map_physical{243.0}=0x32647150 +phy_chain_tx_lane_map_physical{244.0}=0x32647150 +phy_chain_tx_lane_map_physical{245.0}=0x32647150 +phy_chain_tx_lane_map_physical{246.0}=0x32647150 +phy_chain_tx_lane_map_physical{247.0}=0x32647150 +phy_chain_tx_lane_map_physical{248.0}=0x32647150 +serdes_core_rx_polarity_flip_physical{241}=0x8D +serdes_core_rx_polarity_flip_physical{242}=0x8D +serdes_core_rx_polarity_flip_physical{243}=0x8D +serdes_core_rx_polarity_flip_physical{244}=0x8D +serdes_core_rx_polarity_flip_physical{245}=0x8D +serdes_core_rx_polarity_flip_physical{246}=0x8D +serdes_core_rx_polarity_flip_physical{247}=0x8D +serdes_core_rx_polarity_flip_physical{248}=0x8D +serdes_core_tx_polarity_flip_physical{241}=0x35 +serdes_core_tx_polarity_flip_physical{242}=0x35 +serdes_core_tx_polarity_flip_physical{243}=0x35 +serdes_core_tx_polarity_flip_physical{244}=0x35 +serdes_core_tx_polarity_flip_physical{245}=0x35 +serdes_core_tx_polarity_flip_physical{246}=0x35 +serdes_core_tx_polarity_flip_physical{247}=0x35 +serdes_core_tx_polarity_flip_physical{248}=0x35 + +#BC31# +dport_map_port_148=121 +dport_map_port_149=122 +dport_map_port_150=123 +dport_map_port_151=124 +portmap_148=249:100:4 +phy_chain_rx_lane_map_physical{249.0}=0x13560247 +phy_chain_rx_lane_map_physical{250.0}=0x13560247 +phy_chain_rx_lane_map_physical{251.0}=0x13560247 +phy_chain_rx_lane_map_physical{252.0}=0x13560247 +phy_chain_rx_lane_map_physical{253.0}=0x13560247 +phy_chain_rx_lane_map_physical{254.0}=0x13560247 +phy_chain_rx_lane_map_physical{255.0}=0x13560247 +phy_chain_rx_lane_map_physical{256.0}=0x13560247 +phy_chain_tx_lane_map_physical{249.0}=0x10456273 +phy_chain_tx_lane_map_physical{250.0}=0x10456273 +phy_chain_tx_lane_map_physical{251.0}=0x10456273 +phy_chain_tx_lane_map_physical{252.0}=0x10456273 +phy_chain_tx_lane_map_physical{253.0}=0x10456273 +phy_chain_tx_lane_map_physical{254.0}=0x10456273 +phy_chain_tx_lane_map_physical{255.0}=0x10456273 +phy_chain_tx_lane_map_physical{256.0}=0x10456273 +serdes_core_rx_polarity_flip_physical{249}=0x2D +serdes_core_rx_polarity_flip_physical{250}=0x2D +serdes_core_rx_polarity_flip_physical{251}=0x2D +serdes_core_rx_polarity_flip_physical{252}=0x2D +serdes_core_rx_polarity_flip_physical{253}=0x2D +serdes_core_rx_polarity_flip_physical{254}=0x2D +serdes_core_rx_polarity_flip_physical{255}=0x2D +serdes_core_rx_polarity_flip_physical{256}=0x2D +serdes_core_tx_polarity_flip_physical{249}=0xD6 +serdes_core_tx_polarity_flip_physical{250}=0xD6 +serdes_core_tx_polarity_flip_physical{251}=0xD6 +serdes_core_tx_polarity_flip_physical{252}=0xD6 +serdes_core_tx_polarity_flip_physical{253}=0xD6 +serdes_core_tx_polarity_flip_physical{254}=0xD6 +serdes_core_tx_polarity_flip_physical{255}=0xD6 +serdes_core_tx_polarity_flip_physical{256}=0xD6 + +#dport_map_port_38=129 +#portmap_38=257:10 +#dport_map_port_118=130 +#portmap_118=258:10 + +#portmap_19=259:10 + +#portmap_39=260:10 + +#portmap_59=261:10 + +#portmap_79=262:10 + +#portmap_99=263:10 + +#portmap_119=264:10 + +#portmap_139=265:10 + +#portmap_159=266:10 + diff --git a/device/accton/x86_64-accton_as9716_32d-r0/installer.conf b/device/accton/x86_64-accton_as9716_32d-r0/installer.conf index d5f9419d77..950679a3aa 100644 --- a/device/accton/x86_64-accton_as9716_32d-r0/installer.conf +++ b/device/accton/x86_64-accton_as9716_32d-r0/installer.conf @@ -1,4 +1,4 @@ CONSOLE_PORT=0x3f8 CONSOLE_DEV=0 CONSOLE_SPEED=115200 -ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="pcie_aspm=off" +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="pcie_aspm=off tg3.short_preamble=1 tg3.bcm5718s_reset=1" diff --git a/device/accton/x86_64-accton_as9716_32d-r0/media_settings.json b/device/accton/x86_64-accton_as9716_32d-r0/media_settings.json new file mode 100644 index 0000000000..0e3744e0f1 --- /dev/null +++ b/device/accton/x86_64-accton_as9716_32d-r0/media_settings.json @@ -0,0 +1,452 @@ +{ + "PORT_MEDIA_SETTINGS": { + "0": { + "Default": { + "preemphasis": { + "lane0": "0x00187c08", + "lane1": "0x00187c08", + "lane2": "0x00187c08", + "lane3": "0x00187c08", + "lane4": "0x00187c08", + "lane5": "0x00147c0c", + "lane6": "0x00187408", + "lane7": "0x00147c08" + } + } + }, + "1": { + "Default": { + "preemphasis": { + "lane0": "0x00187808", + "lane1": "0x00187c08", + "lane2": "0x0014800c", + "lane3": "0x00147c08", + "lane4": "0x000c8418", + "lane5": "0x000c8418", + "lane6": "0x000c8418", + "lane7": "0x000c8418" + } + } + }, + "2": { + "Default": { + "preemphasis": { + "lane0": "0x00147c08", + "lane1": "0x00147c08", + "lane2": "0x00147c08", + "lane3": "0x00147c08", + "lane4": "0x00147c08", + "lane5": "0x00147c0c", + "lane6": "0x00147c08", + "lane7": "0x00147c08" + } + } + }, + "3": { + "Default": { + "preemphasis": { + "lane0": "0x00187c08", + "lane1": "0x00147c08", + "lane2": "0x00147c08", + "lane3": "0x00147c08", + "lane4": "0x00187c08", + "lane5": "0x00147c0c", + "lane6": "0x00147c08", + "lane7": "0x00147c08" + } + } + }, + "4": { + "Default": { + "preemphasis": { + "lane0": "0x00147c08", + "lane1": "0x00147c08", + "lane2": "0x00147c08", + "lane3": "0x00147c08", + "lane4": "0x00147c08", + "lane5": "0x00147c0c", + "lane6": "0x00147c08", + "lane7": "0x00147c08" + } + } + }, + "5": { + "Default": { + "preemphasis": { + "lane0": "0x00147c08", + "lane1": "0x001c7c08", + "lane2": "0x00087c08", + "lane3": "0x00147c08", + "lane4": "0x000c7c08", + "lane5": "0x00147c0c", + "lane6": "0x00147c08", + "lane7": "0x00147c08" + } + } + }, + "6": { + "Default": { + "preemphasis": { + "lane0": "0x000c8008", + "lane1": "0x000c8008", + "lane2": "0x000c8008", + "lane3": "0x000c8008", + "lane4": "0x000c8008", + "lane5": "0x00147c0c", + "lane6": "0x00107c08", + "lane7": "0x000c7c08" + } + } + }, + "7": { + "Default": { + "preemphasis": { + "lane0": "0x000c7c08", + "lane1": "0x00087c08", + "lane2": "0x00087c08", + "lane3": "0x000c7c08", + "lane4": "0x00087c08", + "lane5": "0x000c7c0c", + "lane6": "0x000c7c08", + "lane7": "0x00107c08" + } + } + }, + "8": { + "Default": { + "preemphasis": { + "lane0": "0x00187c08", + "lane1": "0x00148010", + "lane2": "0x00147c08", + "lane3": "0x00107c08", + "lane4": "0x00187c08", + "lane5": "0x00107c0c", + "lane6": "0x00147c08", + "lane7": "0x00147c08" + } + } + }, + "9": { + "Default": { + "preemphasis": { + "lane0": "0x00147c0c", + "lane1": "0x001c7408", + "lane2": "0x00187408", + "lane3": "0x0018780c", + "lane4": "0x00187808", + "lane5": "0x00147c0c", + "lane6": "0x00187408", + "lane7": "0x00187408" + } + } + }, + "10": { + "Default": { + "preemphasis": { + "lane0": "0x000c8008", + "lane1": "0x00147408", + "lane2": "0x00147c08", + "lane3": "0x00108008", + "lane4": "0x0010800c", + "lane5": "0x00147c0c", + "lane6": "0x00147c08", + "lane7": "0x00147c08" + } + } + }, + "11": { + "Default": { + "preemphasis": { + "lane0": "0x00187c08", + "lane1": "0x000c7c08", + "lane2": "0x00107c08", + "lane3": "0x00147408", + "lane4": "0x00147c08", + "lane5": "0x00147c0c", + "lane6": "0x00147c08", + "lane7": "0x00107c08" + } + } + }, + "12": { + "Default": { + "preemphasis": { + "lane0": "0x00088008", + "lane1": "0x00088008", + "lane2": "0x000c7c08", + "lane3": "0x00087c08", + "lane4": "0x00087c08", + "lane5": "0x00087c0c", + "lane6": "0x00047c08", + "lane7": "0x00047c08" + } + } + }, + "13": { + "Default": { + "preemphasis": { + "lane0": "0x00087c08", + "lane1": "0x00087c08", + "lane2": "0x00087c08", + "lane3": "0x00087c08", + "lane4": "0x00087c08", + "lane5": "0x00087c0c", + "lane6": "0x00087c08", + "lane7": "0x00088008" + } + } + }, + "14": { + "Default": { + "preemphasis": { + "lane0": "0x00088008", + "lane1": "0x00088008", + "lane2": "0x00087c08", + "lane3": "0x00087c08", + "lane4": "0x000c7c08", + "lane5": "0x00087c0c", + "lane6": "0x00047c08", + "lane7": "0x00087c08" + } + } + }, + "15": { + "Default": { + "preemphasis": { + "lane0": "0x00087c08", + "lane1": "0x00087c08", + "lane2": "0x00087c08", + "lane3": "0x00087c08", + "lane4": "0x00087c08", + "lane5": "0x00087c0c", + "lane6": "0x00087c08", + "lane7": "0x00087c08" + } + } + }, + "16": { + "Default": { + "preemphasis": { + "lane0": "0x00088008", + "lane1": "0x00088008", + "lane2": "0x00087c08", + "lane3": "0x00087c08", + "lane4": "0x000c7c08", + "lane5": "0x00087c0c", + "lane6": "0x000c7c08", + "lane7": "0x000c7c08" + } + } + }, + "17": { + "Default": { + "preemphasis": { + "lane0": "0x00087c08", + "lane1": "0x000c7c08", + "lane2": "0x00087c08", + "lane3": "0x00087c08", + "lane4": "0x000c7c08", + "lane5": "0x00087c0c", + "lane6": "0x00087c08", + "lane7": "0x00087c08" + } + } + }, + "18": { + "Default": { + "preemphasis": { + "lane0": "0x00088008", + "lane1": "0x00088008", + "lane2": "0x00087c08", + "lane3": "0x00087c08", + "lane4": "0x000c7c08", + "lane5": "0x00087c0c", + "lane6": "0x00087c08", + "lane7": "0x000c7c08" + } + } + }, + "19": { + "Default": { + "preemphasis": { + "lane0": "0x00087c08", + "lane1": "0x00087c08", + "lane2": "0x00087c08", + "lane3": "0x00047c08", + "lane4": "0x0018840c", + "lane5": "0x00207c0c", + "lane6": "0x00087c08", + "lane7": "0x00087c08" + } + } + }, + "20": { + "Default": { + "preemphasis": { + "lane0": "0x000c8008", + "lane1": "0x000c8008", + "lane2": "0x00087c08", + "lane3": "0x000c7c08", + "lane4": "0x000c7c08", + "lane5": "0x00087c0c", + "lane6": "0x00107c08", + "lane7": "0x00147c08" + } + } + }, + "21": { + "Default": { + "preemphasis": { + "lane0": "0x00107c08", + "lane1": "0x00147c08", + "lane2": "0x000c7c08", + "lane3": "0x000c7c08", + "lane4": "0x00107c08", + "lane5": "0x00147c0c", + "lane6": "0x00147c08", + "lane7": "0x00107c08" + } + } + }, + "22": { + "Default": { + "preemphasis": { + "lane0": "0x000c8014", + "lane1": "0x001c740c", + "lane2": "0x00147808", + "lane3": "0x001c8008", + "lane4": "0x00147c08", + "lane5": "0x00147c0c", + "lane6": "0x00187c08", + "lane7": "0x0018800c" + } + } + }, + "23": { + "Default": { + "preemphasis": { + "lane0": "0x0024780c", + "lane1": "0x00247410", + "lane2": "0x0024780c", + "lane3": "0x00187408", + "lane4": "0x00207408", + "lane5": "0x00207408", + "lane6": "0x00187408", + "lane7": "0x0024780c" + } + } + }, + "24": { + "Default": { + "preemphasis": { + "lane0": "0x00088008", + "lane1": "0x000c8008", + "lane2": "0x00087c08", + "lane3": "0x000c7c08", + "lane4": "0x000c7c08", + "lane5": "0x000c7c0c", + "lane6": "0x000c7c08", + "lane7": "0x00107c08" + } + } + }, + "25": { + "Default": { + "preemphasis": { + "lane0": "0x00087c08", + "lane1": "0x000c7c08", + "lane2": "0x000c7808", + "lane3": "0x00107c08", + "lane4": "0x000c7c08", + "lane5": "0x000c7c0c", + "lane6": "0x000c7c08", + "lane7": "0x00147c08" + } + } + }, + "26": { + "Default": { + "preemphasis": { + "lane0": "0x000c8008", + "lane1": "0x00107808", + "lane2": "0x000c7c08", + "lane3": "0x00108008", + "lane4": "0x00147c08", + "lane5": "0x000c7c0c", + "lane6": "0x00147c08", + "lane7": "0x00147c08" + } + } + }, + "27": { + "Default": { + "preemphasis": { + "lane0": "0x00107c08", + "lane1": "0x00147c08", + "lane2": "0x00147c08", + "lane3": "0x00107c08", + "lane4": "0x00147c08", + "lane5": "0x00107c0c", + "lane6": "0x00107c08", + "lane7": "0x00147c08" + } + } + }, + "28": { + "Default": { + "preemphasis": { + "lane0": "0x00188008", + "lane1": "0x00108010", + "lane2": "0x00187c04", + "lane3": "0x00147c08", + "lane4": "0x00187c08", + "lane5": "0x00107c0c", + "lane6": "0x00187c08", + "lane7": "0x00147c08" + } + } + }, + "29": { + "Default": { + "preemphasis": { + "lane0": "0x00147c08", + "lane1": "0x00147c08", + "lane2": "0x00147c08", + "lane3": "0x00147c08", + "lane4": "0x00147c08", + "lane5": "0x00147c0c", + "lane6": "0x00107c08", + "lane7": "0x00187c08" + } + } + }, + "30": { + "Default": { + "preemphasis": { + "lane0": "0x000c8010", + "lane1": "0x00187c08", + "lane2": "0x00147c04", + "lane3": "0x00147c08", + "lane4": "0x00147c08", + "lane5": "0x00147c0c", + "lane6": "0x00147c08", + "lane7": "0x00147c08" + } + } + }, + "31": { + "Default": { + "preemphasis": { + "lane0": "0x00147c08", + "lane1": "0x00187c08", + "lane2": "0x00147c08", + "lane3": "0x00187c08", + "lane4": "0x00147c08", + "lane5": "0x00147c0c", + "lane6": "0x00147c08", + "lane7": "0x00187c08" + } + } + } + } +} diff --git a/device/accton/x86_64-accton_as9716_32d-r0/pcie.yaml b/device/accton/x86_64-accton_as9716_32d-r0/pcie.yaml new file mode 100644 index 0000000000..56a47d1c36 --- /dev/null +++ b/device/accton/x86_64-accton_as9716_32d-r0/pcie.yaml @@ -0,0 +1,471 @@ +- bus: '00' + dev: '00' + fn: '0' + id: 6f00 + name: 'Host bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D DMI2 + (rev 03)' +- bus: '00' + dev: '01' + fn: '0' + id: 6f02 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 1 (rev 03)' +- bus: '00' + dev: '01' + fn: '1' + id: 6f03 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 1 (rev 03)' +- bus: '00' + dev: '02' + fn: '0' + id: 6f04 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 2 (rev 03)' +- bus: '00' + dev: '02' + fn: '1' + id: 6f05 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 2 (rev 03)' +- bus: '00' + dev: '02' + fn: '2' + id: 6f06 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 2 (rev 03)' +- bus: '00' + dev: '02' + fn: '3' + id: 6f07 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 2 (rev 03)' +- bus: '00' + dev: '03' + fn: '0' + id: 6f08 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 3 (rev 03)' +- bus: '00' + dev: '03' + fn: '1' + id: 6f09 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 3 (rev 03)' +- bus: '00' + dev: '03' + fn: '2' + id: 6f0a + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 3 (rev 03)' +- bus: '00' + dev: '03' + fn: '3' + id: 6f0b + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 3 (rev 03)' +- bus: '00' + dev: '05' + fn: '0' + id: 6f28 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Map/VTd_Misc/System Management (rev 03)' +- bus: '00' + dev: '05' + fn: '1' + id: 6f29 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D IIO Hot Plug (rev 03)' +- bus: '00' + dev: '05' + fn: '2' + id: 6f2a + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D IIO RAS/Control Status/Global Errors (rev 03)' +- bus: '00' + dev: '05' + fn: '4' + id: 6f2c + name: 'PIC: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D I/O APIC (rev + 03)' +- bus: '00' + dev: '14' + fn: '0' + id: 8c31 + name: 'USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB + xHCI (rev 05)' +- bus: '00' + dev: '16' + fn: '0' + id: 8c3a + name: 'Communication controller: Intel Corporation 8 Series/C220 Series Chipset + Family MEI Controller #1 (rev 04)' +- bus: '00' + dev: '16' + fn: '1' + id: 8c3b + name: 'Communication controller: Intel Corporation 8 Series/C220 Series Chipset + Family MEI Controller #2 (rev 04)' +- bus: '00' + dev: 1c + fn: '0' + id: 8c10 + name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express + Root Port #1 (rev d5)' +- bus: '00' + dev: 1c + fn: '1' + id: 8c12 + name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express + Root Port #2 (rev d5)' +- bus: '00' + dev: 1c + fn: '4' + id: 8c18 + name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express + Root Port #5 (rev d5)' +- bus: '00' + dev: 1d + fn: '0' + id: 8c26 + name: 'USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB + EHCI #1 (rev 05)' +- bus: '00' + dev: 1f + fn: '0' + id: 8c54 + name: 'ISA bridge: Intel Corporation C224 Series Chipset Family Server Standard + SKU LPC Controller (rev 05)' +- bus: '00' + dev: 1f + fn: '2' + id: 8c02 + name: 'SATA controller: Intel Corporation 8 Series/C220 Series Chipset Family 6-port + SATA Controller 1 [AHCI mode] (rev 05)' +- bus: '00' + dev: 1f + fn: '3' + id: 8c22 + name: 'SMBus: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller + (rev 05)' +- bus: '03' + dev: '00' + fn: '0' + id: 6f50 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 0' +- bus: '03' + dev: '00' + fn: '1' + id: 6f51 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 1' +- bus: '03' + dev: '00' + fn: '2' + id: 6f52 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 2' +- bus: '03' + dev: '00' + fn: '3' + id: 6f53 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 3' +- bus: '05' + dev: '00' + fn: '0' + id: 15ab + name: 'Ethernet controller: Intel Corporation Ethernet Connection X552 10 GbE Backplane' +- bus: '05' + dev: '00' + fn: '1' + id: 15ab + name: 'Ethernet controller: Intel Corporation Ethernet Connection X552 10 GbE Backplane' +- bus: '07' + dev: '00' + fn: '0' + id: b980 + name: 'Ethernet controller: Broadcom Inc. and subsidiaries Device b980 (rev 11)' +- bus: 0b + dev: '00' + fn: '0' + id: 165f + name: 'Ethernet controller: Broadcom Inc. and subsidiaries NetXtreme BCM5720 2-port + Gigabit Ethernet PCIe' +- bus: ff + dev: 0b + fn: '0' + id: 6f81 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link 0/1 (rev 03)' +- bus: ff + dev: 0b + fn: '1' + id: 6f36 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link 0/1 (rev 03)' +- bus: ff + dev: 0b + fn: '2' + id: 6f37 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link 0/1 (rev 03)' +- bus: ff + dev: 0b + fn: '3' + id: 6f76 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link Debug (rev 03)' +- bus: ff + dev: 0c + fn: '0' + id: 6fe0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0c + fn: '1' + id: 6fe1 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0c + fn: '2' + id: 6fe2 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0c + fn: '3' + id: 6fe3 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '0' + id: 6ff8 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '4' + id: 6ffc + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '5' + id: 6ffd + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '6' + id: 6ffe + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: '10' + fn: '0' + id: 6f1d + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R2PCIe Agent (rev 03)' +- bus: ff + dev: '10' + fn: '1' + id: 6f34 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R2PCIe Agent (rev 03)' +- bus: ff + dev: '10' + fn: '5' + id: 6f1e + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Ubox (rev 03)' +- bus: ff + dev: '10' + fn: '6' + id: 6f7d + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Ubox (rev 03)' +- bus: ff + dev: '10' + fn: '7' + id: 6f1f + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Ubox (rev 03)' +- bus: ff + dev: '12' + fn: '0' + id: 6fa0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Home Agent 0 (rev 03)' +- bus: ff + dev: '12' + fn: '1' + id: 6f30 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Home Agent 0 (rev 03)' +- bus: ff + dev: '13' + fn: '0' + id: 6fa8 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Target Address/Thermal/RAS (rev 03)' +- bus: ff + dev: '13' + fn: '1' + id: 6f71 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Target Address/Thermal/RAS (rev 03)' +- bus: ff + dev: '13' + fn: '2' + id: 6faa + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '3' + id: 6fab + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '4' + id: 6fac + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '5' + id: 6fad + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '6' + id: 6fae + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Broadcast (rev 03)' +- bus: ff + dev: '13' + fn: '7' + id: 6faf + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Global Broadcast (rev 03)' +- bus: ff + dev: '14' + fn: '0' + id: 6fb0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 0 Thermal Control (rev 03)' +- bus: ff + dev: '14' + fn: '1' + id: 6fb1 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 1 Thermal Control (rev 03)' +- bus: ff + dev: '14' + fn: '2' + id: 6fb2 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 0 Error (rev 03)' +- bus: ff + dev: '14' + fn: '3' + id: 6fb3 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 1 Error (rev 03)' +- bus: ff + dev: '14' + fn: '4' + id: 6fbc + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '14' + fn: '5' + id: 6fbd + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '14' + fn: '6' + id: 6fbe + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '14' + fn: '7' + id: 6fbf + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '15' + fn: '0' + id: 6fb4 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 2 Thermal Control (rev 03)' +- bus: ff + dev: '15' + fn: '1' + id: 6fb5 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 3 Thermal Control (rev 03)' +- bus: ff + dev: '15' + fn: '2' + id: 6fb6 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 2 Error (rev 03)' +- bus: ff + dev: '15' + fn: '3' + id: 6fb7 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 3 Error (rev 03)' +- bus: ff + dev: 1e + fn: '0' + id: 6f98 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '1' + id: 6f99 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '2' + id: 6f9a + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '3' + id: 6fc0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '4' + id: 6f9c + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1f + fn: '0' + id: 6f88 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1f + fn: '2' + id: 6f8a + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' diff --git a/device/accton/x86_64-accton_as9716_32d-r0/pddf/pd-plugin.json b/device/accton/x86_64-accton_as9716_32d-r0/pddf/pd-plugin.json index 1d58827501..ccd49bd2d9 100644 --- a/device/accton/x86_64-accton_as9716_32d-r0/pddf/pd-plugin.json +++ b/device/accton/x86_64-accton_as9716_32d-r0/pddf/pd-plugin.json @@ -7,7 +7,8 @@ "i2c": { "valmap-SFP28": {"1":true, "0":false }, - "valmap-QSFP28": {"1":true, "0":false} + "valmap-QSFP28": {"1":true, "0":false}, + "valmap-QSFP-DD": {"1":true, "0":false} } } }, @@ -33,11 +34,11 @@ { "i2c": { - "valmap": { "F2B":"EXHAUST", "B2F":"INTAKE" } + "valmap": { "F2B":"exhaust", "B2F":"intake" } } }, - "PSU_FAN_MAX_SPEED":"18000" + "PSU_FAN_MAX_SPEED":"26688" }, "FAN": @@ -46,7 +47,7 @@ { "i2c": { - "valmap": {"1":"INTAKE", "0":"EXHAUST"} + "valmap": {"1":"intake", "0":"exhaust"} } }, diff --git a/device/accton/x86_64-accton_as9716_32d-r0/pddf/pddf-device.json b/device/accton/x86_64-accton_as9716_32d-r0/pddf/pddf-device.json index 6bde8eab76..3a68f21c7a 100644 --- a/device/accton/x86_64-accton_as9716_32d-r0/pddf/pddf-device.json +++ b/device/accton/x86_64-accton_as9716_32d-r0/pddf/pddf-device.json @@ -5,7 +5,7 @@ "num_fantrays":6, "num_fans_pertray":2, "num_ports":34, - "num_temps": 7, + "num_temps": 12, "pddf_dev_types": { "description":"AS9716 - Below is the list of supported PDDF device types (chip names) for various components. If any component uses some other driver, we will create the client using 'echo > /new_device' method", @@ -114,7 +114,7 @@ "i2c": { "topo_info": { "parent_bus":"0x0", "dev_addr":"0x77", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x1"}, + "dev_attr": { "virt_bus":"0x1", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"MUX2" }, @@ -134,7 +134,7 @@ "i2c": { "topo_info": { "parent_bus":"0x1", "dev_addr":"0x72", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x9"}, + "dev_attr": { "virt_bus":"0x9", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PSU2" }, @@ -165,15 +165,17 @@ "attr_list": [ { "attr_name":"psu_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x3", "attr_mask":"0x1", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"psu_model_name", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"12" }, { "attr_name":"psu_power_good", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x3", "attr_mask":"0x4", "attr_cmpval":"0x4", "attr_len":"1"}, { "attr_name":"psu_mfr_id", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, - { "attr_name":"psu_fan_dir", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"}, { "attr_name":"psu_v_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_i_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_p_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, - { "attr_name":"psu_temp1_input", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} + { "attr_name":"psu_temp1_input", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_v_out_min", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xa4", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_v_out_max", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xa5", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_p_out_max", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xa7", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_temp1_high_threshold", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xa8", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} ] } }, @@ -185,8 +187,10 @@ { "topo_info":{ "parent_bus":"0xa", "dev_addr":"0x51", "dev_type":"psu_eeprom"}, "attr_list": - [ - { "attr_name":"psu_serial_num", "attr_devaddr":"0x51", "attr_devtype":"eeprom", "attr_offset":"0x35", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"20" } + [ + { "attr_name":"psu_model_name", "attr_devaddr":"0x51", "attr_devtype":"eeprom", "attr_offset":"0x20", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"11" }, + { "attr_name":"psu_serial_num", "attr_devaddr":"0x51", "attr_devtype":"eeprom", "attr_offset":"0x35", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"20" }, + { "attr_name":"psu_fan_dir", "attr_devaddr":"0x51", "attr_devtype":"eeprom", "attr_offset":"0x35", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"3" } ] } }, @@ -214,15 +218,17 @@ "attr_list": [ { "attr_name":"psu_present", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x3", "attr_mask":"0x2", "attr_cmpval":"0x0", "attr_len":"1"}, - { "attr_name":"psu_model_name", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x9a", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"12" }, { "attr_name":"psu_power_good", "attr_devaddr":"0x60", "attr_devtype":"cpld", "attr_offset":"0x3", "attr_mask":"0x8", "attr_cmpval":"0x8", "attr_len":"1"}, { "attr_name":"psu_mfr_id", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0X99", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"10" }, - { "attr_name":"psu_fan_dir", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xc3", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"5"}, { "attr_name":"psu_v_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_i_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_p_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, { "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, - { "attr_name":"psu_temp1_input", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} + { "attr_name":"psu_temp1_input", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_v_out_min", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xa4", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_v_out_max", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xa5", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_p_out_max", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xa7", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}, + { "attr_name":"psu_temp1_high_threshold", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xa8", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"} ] } }, @@ -234,8 +240,10 @@ { "topo_info":{ "parent_bus":"0x9", "dev_addr":"0x50", "dev_type":"psu_eeprom"}, "attr_list": - [ - { "attr_name":"psu_serial_num", "attr_devaddr":"0x50", "attr_devtype":"eeprom", "attr_offset":"0x35", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"20" } + [ + { "attr_name":"psu_model_name", "attr_devaddr":"0x50", "attr_devtype":"eeprom", "attr_offset":"0x20", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"11" }, + { "attr_name":"psu_serial_num", "attr_devaddr":"0x50", "attr_devtype":"eeprom", "attr_offset":"0x35", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"20" }, + { "attr_name":"psu_fan_dir", "attr_devaddr":"0x50", "attr_devtype":"eeprom", "attr_offset":"0x35", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"3" } ] } }, @@ -245,7 +253,7 @@ "i2c": { "topo_info": { "parent_bus":"0x1", "dev_addr":"0x76", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x11"}, + "dev_attr": { "virt_bus":"0x11", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"FAN-CTRL" }, @@ -326,7 +334,7 @@ "TEMP1" : { "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP1", "device_parent":"MUX3"}, - "dev_attr": { "display_name":"Temp_1"}, + "dev_attr": { "display_name":"MB_FrontMiddle_temp(0x48)"}, "i2c": { "topo_info": { "parent_bus":"0x12", "dev_addr":"0x48", "dev_type":"lm75"}, @@ -342,7 +350,7 @@ "TEMP2" : { "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP2", "device_parent":"MUX3"}, - "dev_attr": { "display_name":"Temp_2"}, + "dev_attr": { "display_name":"MB_RightCenter_temp(0x49)"}, "i2c": { "topo_info": { "parent_bus":"0x12", "dev_addr":"0x49", "dev_type":"lm75"}, @@ -358,7 +366,7 @@ "TEMP3" : { "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP3", "device_parent":"MUX3"}, - "dev_attr": { "display_name":"Temp_3"}, + "dev_attr": { "display_name":"MB_LeftCenter_temp(0x4a)"}, "i2c": { "topo_info": { "parent_bus":"0x12", "dev_addr":"0x4a", "dev_type":"lm75"}, @@ -374,7 +382,7 @@ "TEMP4" : { "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP4", "device_parent":"MUX3"}, - "dev_attr": { "display_name":"Temp_4"}, + "dev_attr": { "display_name":"CB_temp(0x4b)"}, "i2c": { "topo_info": { "parent_bus":"0x12", "dev_addr":"0x4b", "dev_type":"lm75"}, @@ -390,7 +398,7 @@ "TEMP5" : { "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP5", "device_parent":"MUX3"}, - "dev_attr": { "display_name":"Temp_5"}, + "dev_attr": { "display_name":"OCXO_temp(0x4c)"}, "i2c": { "topo_info": { "parent_bus":"0x12", "dev_addr":"0x4c", "dev_type":"lm75"}, @@ -406,7 +414,7 @@ "TEMP6" : { "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP6", "device_parent":"MUX3"}, - "dev_attr": { "display_name":"Temp_6"}, + "dev_attr": { "display_name":"FB_1_temp(0x4e)"}, "i2c": { "topo_info": { "parent_bus":"0x12", "dev_addr":"0x4e", "dev_type":"lm75"}, @@ -422,7 +430,7 @@ "TEMP7" : { "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP7", "device_parent":"MUX3"}, - "dev_attr": { "display_name":"Temp_7"}, + "dev_attr": { "display_name":"FB_2_temp(0x4f)"}, "i2c": { "topo_info": { "parent_bus":"0x12", "dev_addr":"0x4f", "dev_type":"lm75"}, @@ -434,6 +442,82 @@ ] } }, + "TEMP8" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP8"}, + "dev_attr": { "display_name":"CPU_Package_temp"}, + "i2c": + { + "path_info": {"sysfs_base_path": "/sys/class/hwmon/hwmon0"}, + "attr_list": + [ + { "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp1_crit"}, + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"}, + { "attr_name": "temp1_input"} + ] + } + }, + + "TEMP9" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP9"}, + "dev_attr": { "display_name":"CPU_Core_0_temp"}, + "i2c": + { + "path_info": {"sysfs_base_path": "/sys/class/hwmon/hwmon0"}, + "attr_list": + [ + { "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp2_crit"}, + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp2_max"}, + { "attr_name": "temp1_input", "drv_attr_name":"temp2_input"} + ] + } + }, + "TEMP10" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP10"}, + "dev_attr": { "display_name":"CPU_Core_1_temp"}, + "i2c": + { + "path_info": {"sysfs_base_path": "/sys/class/hwmon/hwmon0"}, + "attr_list": + [ + { "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp3_crit"}, + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp3_max"}, + { "attr_name": "temp1_input", "drv_attr_name":"temp3_input"} + ] + } + }, + "TEMP11" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP11"}, + "dev_attr": { "display_name":"CPU_Core_2_temp"}, + "i2c": + { + "path_info": {"sysfs_base_path": "/sys/class/hwmon/hwmon0"}, + "attr_list": + [ + { "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp4_crit"}, + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp4_max"}, + { "attr_name": "temp1_input", "drv_attr_name":"temp4_input"} + ] + } + }, + "TEMP12" : + { + "dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP12"}, + "dev_attr": { "display_name":"CPU_Core_3_temp"}, + "i2c": + { + "path_info": {"sysfs_base_path": "/sys/class/hwmon/hwmon0"}, + "attr_list": + [ + { "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp5_crit"}, + { "attr_name": "temp1_high_threshold", "drv_attr_name":"temp5_max"}, + { "attr_name": "temp1_input", "drv_attr_name":"temp5_input"} + ] + } + }, "FPGA": { @@ -487,7 +571,7 @@ "i2c": { "topo_info": { "parent_bus":"0x2", "dev_addr":"0x72", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x19"}, + "dev_attr": { "virt_bus":"0x19", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PORT1" }, @@ -507,7 +591,7 @@ "i2c": { "topo_info": { "parent_bus":"0x2", "dev_addr":"0x73", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x21"}, + "dev_attr": { "virt_bus":"0x21", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PORT9" }, @@ -527,7 +611,7 @@ "i2c": { "topo_info": { "parent_bus":"0x2", "dev_addr":"0x74", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x29"}, + "dev_attr": { "virt_bus":"0x29", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PORT17" }, @@ -547,7 +631,7 @@ "i2c": { "topo_info": { "parent_bus":"0x2", "dev_addr":"0x75", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x31"}, + "dev_attr": { "virt_bus":"0x31", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PORT25" }, @@ -567,7 +651,7 @@ "i2c": { "topo_info": { "parent_bus":"0x2", "dev_addr":"0x76", "dev_type":"pca9548"}, - "dev_attr": { "virt_bus":"0x39"}, + "dev_attr": { "virt_bus":"0x39", "idle_state":"-2"}, "channel": [ { "chn":"0", "dev":"PORT33" }, @@ -577,7 +661,7 @@ }, "PORT1": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT1", "device_parent":"MUX4"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT1", "device_parent":"MUX4"}, "dev_attr": { "dev_idx":"1"}, "i2c": { @@ -593,7 +677,7 @@ "dev_info": { "device_type":"", "device_name":"PORT1-EEPROM", "device_parent":"MUX4", "virt_parent":"PORT1"}, "i2c": { - "topo_info": { "parent_bus":"0x19", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x19", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -616,7 +700,7 @@ }, "PORT2": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT2", "device_parent":"MUX4"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT2", "device_parent":"MUX4"}, "dev_attr": { "dev_idx":"2"}, "i2c": { @@ -632,7 +716,7 @@ "dev_info": { "device_type":"", "device_name":"PORT2-EEPROM", "device_parent":"MUX4", "virt_parent":"PORT2"}, "i2c": { - "topo_info": { "parent_bus":"0x1a", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x1a", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -655,7 +739,7 @@ }, "PORT3": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT3", "device_parent":"MUX4"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT3", "device_parent":"MUX4"}, "dev_attr": { "dev_idx":"3"}, "i2c": { @@ -671,7 +755,7 @@ "dev_info": { "device_type":"", "device_name":"PORT3-EEPROM", "device_parent":"MUX4", "virt_parent":"PORT3"}, "i2c": { - "topo_info": { "parent_bus":"0x1b", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x1b", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -694,7 +778,7 @@ }, "PORT4": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT4", "device_parent":"MUX4"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT4", "device_parent":"MUX4"}, "dev_attr": { "dev_idx":"4"}, "i2c": { @@ -710,7 +794,7 @@ "dev_info": { "device_type":"", "device_name":"PORT4-EEPROM", "device_parent":"MUX4", "virt_parent":"PORT4"}, "i2c": { - "topo_info": { "parent_bus":"0x1c", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x1c", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -733,7 +817,7 @@ }, "PORT5": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT5", "device_parent":"MUX4"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT5", "device_parent":"MUX4"}, "dev_attr": { "dev_idx":"5"}, "i2c": { @@ -749,7 +833,7 @@ "dev_info": { "device_type":"", "device_name":"PORT5-EEPROM", "device_parent":"MUX4", "virt_parent":"PORT5"}, "i2c": { - "topo_info": { "parent_bus":"0x1d", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x1d", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -772,7 +856,7 @@ }, "PORT6": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT6", "device_parent":"MUX4"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT6", "device_parent":"MUX4"}, "dev_attr": { "dev_idx":"6"}, "i2c": { @@ -788,7 +872,7 @@ "dev_info": { "device_type":"", "device_name":"PORT6-EEPROM", "device_parent":"MUX4", "virt_parent":"PORT6"}, "i2c": { - "topo_info": { "parent_bus":"0x1e", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x1e", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -811,7 +895,7 @@ }, "PORT7": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT7", "device_parent":"MUX4"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT7", "device_parent":"MUX4"}, "dev_attr": { "dev_idx":"7"}, "i2c": { @@ -827,7 +911,7 @@ "dev_info": { "device_type":"", "device_name":"PORT7-EEPROM", "device_parent":"MUX4", "virt_parent":"PORT7"}, "i2c": { - "topo_info": { "parent_bus":"0x1f", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x1f", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -850,7 +934,7 @@ }, "PORT8": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT8", "device_parent":"MUX4"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT8", "device_parent":"MUX4"}, "dev_attr": { "dev_idx":"8"}, "i2c": { @@ -866,7 +950,7 @@ "dev_info": { "device_type":"", "device_name":"PORT8-EEPROM", "device_parent":"MUX4", "virt_parent":"PORT8"}, "i2c": { - "topo_info": { "parent_bus":"0x20", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x20", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -887,17 +971,10 @@ ] } }, - - - - - - - - + "PORT9": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT9", "device_parent":"MUX5"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT9", "device_parent":"MUX5"}, "dev_attr": { "dev_idx":"9"}, "i2c": { @@ -913,7 +990,7 @@ "dev_info": { "device_type":"", "device_name":"PORT9-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT9"}, "i2c": { - "topo_info": { "parent_bus":"0x21", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x21", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -936,7 +1013,7 @@ }, "PORT10": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT10", "device_parent":"MUX5"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT10", "device_parent":"MUX5"}, "dev_attr": { "dev_idx":"10"}, "i2c": { @@ -952,7 +1029,7 @@ "dev_info": { "device_type":"", "device_name":"PORT2-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT10"}, "i2c": { - "topo_info": { "parent_bus":"0x22", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x22", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -975,7 +1052,7 @@ }, "PORT11": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT11", "device_parent":"MUX5"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT11", "device_parent":"MUX5"}, "dev_attr": { "dev_idx":"11"}, "i2c": { @@ -991,7 +1068,7 @@ "dev_info": { "device_type":"", "device_name":"PORT11-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT11"}, "i2c": { - "topo_info": { "parent_bus":"0x23", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x23", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1014,7 +1091,7 @@ }, "PORT12": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT12", "device_parent":"MUX5"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT12", "device_parent":"MUX5"}, "dev_attr": { "dev_idx":"12"}, "i2c": { @@ -1030,7 +1107,7 @@ "dev_info": { "device_type":"", "device_name":"PORT12-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT12"}, "i2c": { - "topo_info": { "parent_bus":"0x24", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x24", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1053,7 +1130,7 @@ }, "PORT13": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT13", "device_parent":"MUX5"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT13", "device_parent":"MUX5"}, "dev_attr": { "dev_idx":"13"}, "i2c": { @@ -1069,7 +1146,7 @@ "dev_info": { "device_type":"", "device_name":"PORT13-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT13"}, "i2c": { - "topo_info": { "parent_bus":"0x25", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x25", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1092,7 +1169,7 @@ }, "PORT14": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT14", "device_parent":"MUX5"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT14", "device_parent":"MUX5"}, "dev_attr": { "dev_idx":"14"}, "i2c": { @@ -1108,7 +1185,7 @@ "dev_info": { "device_type":"", "device_name":"PORT14-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT14"}, "i2c": { - "topo_info": { "parent_bus":"0x26", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x26", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1131,7 +1208,7 @@ }, "PORT15": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT15", "device_parent":"MUX5"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT15", "device_parent":"MUX5"}, "dev_attr": { "dev_idx":"15"}, "i2c": { @@ -1147,7 +1224,7 @@ "dev_info": { "device_type":"", "device_name":"PORT15-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT15"}, "i2c": { - "topo_info": { "parent_bus":"0x27", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x27", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1170,7 +1247,7 @@ }, "PORT16": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT16", "device_parent":"MUX5"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT16", "device_parent":"MUX5"}, "dev_attr": { "dev_idx":"16"}, "i2c": { @@ -1186,7 +1263,7 @@ "dev_info": { "device_type":"", "device_name":"PORT16-EEPROM", "device_parent":"MUX5", "virt_parent":"PORT16"}, "i2c": { - "topo_info": { "parent_bus":"0x28", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x28", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1212,7 +1289,7 @@ "PORT17": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT17", "device_parent":"MUX6"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT17", "device_parent":"MUX6"}, "dev_attr": { "dev_idx":"17"}, "i2c": { @@ -1228,7 +1305,7 @@ "dev_info": { "device_type":"", "device_name":"PORT17-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT17"}, "i2c": { - "topo_info": { "parent_bus":"0x29", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x29", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1251,7 +1328,7 @@ }, "PORT18": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT18", "device_parent":"MUX6"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT18", "device_parent":"MUX6"}, "dev_attr": { "dev_idx":"18"}, "i2c": { @@ -1267,7 +1344,7 @@ "dev_info": { "device_type":"", "device_name":"PORT18-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT18"}, "i2c": { - "topo_info": { "parent_bus":"0x2a", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x2a", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1290,7 +1367,7 @@ }, "PORT19": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT19", "device_parent":"MUX6"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT19", "device_parent":"MUX6"}, "dev_attr": { "dev_idx":"19"}, "i2c": { @@ -1306,7 +1383,7 @@ "dev_info": { "device_type":"", "device_name":"PORT19-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT19"}, "i2c": { - "topo_info": { "parent_bus":"0x2b", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x2b", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1329,7 +1406,7 @@ }, "PORT20": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT20", "device_parent":"MUX6"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT20", "device_parent":"MUX6"}, "dev_attr": { "dev_idx":"20"}, "i2c": { @@ -1345,7 +1422,7 @@ "dev_info": { "device_type":"", "device_name":"PORT20-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT20"}, "i2c": { - "topo_info": { "parent_bus":"0x2c", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x2c", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1368,7 +1445,7 @@ }, "PORT21": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT21", "device_parent":"MUX6"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT21", "device_parent":"MUX6"}, "dev_attr": { "dev_idx":"21"}, "i2c": { @@ -1384,7 +1461,7 @@ "dev_info": { "device_type":"", "device_name":"PORT21-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT21"}, "i2c": { - "topo_info": { "parent_bus":"0x2d", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x2d", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1407,7 +1484,7 @@ }, "PORT22": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT22", "device_parent":"MUX6"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT22", "device_parent":"MUX6"}, "dev_attr": { "dev_idx":"22"}, "i2c": { @@ -1423,7 +1500,7 @@ "dev_info": { "device_type":"", "device_name":"PORT22-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT22"}, "i2c": { - "topo_info": { "parent_bus":"0x2e", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x2e", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1446,7 +1523,7 @@ }, "PORT23": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT23", "device_parent":"MUX6"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT23", "device_parent":"MUX6"}, "dev_attr": { "dev_idx":"23"}, "i2c": { @@ -1462,7 +1539,7 @@ "dev_info": { "device_type":"", "device_name":"PORT23-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT23"}, "i2c": { - "topo_info": { "parent_bus":"0x2f", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x2f", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1485,7 +1562,7 @@ }, "PORT24": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT24", "device_parent":"MUX6"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT24", "device_parent":"MUX6"}, "dev_attr": { "dev_idx":"24"}, "i2c": { @@ -1501,7 +1578,7 @@ "dev_info": { "device_type":"", "device_name":"PORT24-EEPROM", "device_parent":"MUX6", "virt_parent":"PORT24"}, "i2c": { - "topo_info": { "parent_bus":"0x30", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x30", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1526,7 +1603,7 @@ "PORT25": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT25", "device_parent":"MUX7"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT25", "device_parent":"MUX7"}, "dev_attr": { "dev_idx":"25"}, "i2c": { @@ -1542,7 +1619,7 @@ "dev_info": { "device_type":"", "device_name":"PORT25-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT25"}, "i2c": { - "topo_info": { "parent_bus":"0x31", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x31", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1565,7 +1642,7 @@ }, "PORT26": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT26", "device_parent":"MUX7"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT26", "device_parent":"MUX7"}, "dev_attr": { "dev_idx":"26"}, "i2c": { @@ -1581,7 +1658,7 @@ "dev_info": { "device_type":"", "device_name":"PORT26-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT26"}, "i2c": { - "topo_info": { "parent_bus":"0x32", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x32", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1604,7 +1681,7 @@ }, "PORT27": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT27", "device_parent":"MUX7"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT27", "device_parent":"MUX7"}, "dev_attr": { "dev_idx":"27"}, "i2c": { @@ -1620,7 +1697,7 @@ "dev_info": { "device_type":"", "device_name":"PORT27-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT27"}, "i2c": { - "topo_info": { "parent_bus":"0x33", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x33", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1643,7 +1720,7 @@ }, "PORT28": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT28", "device_parent":"MUX7"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT28", "device_parent":"MUX7"}, "dev_attr": { "dev_idx":"28"}, "i2c": { @@ -1659,7 +1736,7 @@ "dev_info": { "device_type":"", "device_name":"PORT28-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT28"}, "i2c": { - "topo_info": { "parent_bus":"0x34", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x34", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1682,7 +1759,7 @@ }, "PORT29": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT29", "device_parent":"MUX7"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT29", "device_parent":"MUX7"}, "dev_attr": { "dev_idx":"29"}, "i2c": { @@ -1698,7 +1775,7 @@ "dev_info": { "device_type":"", "device_name":"PORT29-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT29"}, "i2c": { - "topo_info": { "parent_bus":"0x35", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x35", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1721,7 +1798,7 @@ }, "PORT30": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT30", "device_parent":"MUX7"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT30", "device_parent":"MUX7"}, "dev_attr": { "dev_idx":"30"}, "i2c": { @@ -1737,7 +1814,7 @@ "dev_info": { "device_type":"", "device_name":"PORT30-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT30"}, "i2c": { - "topo_info": { "parent_bus":"0x36", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x36", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1760,7 +1837,7 @@ }, "PORT31": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT31", "device_parent":"MUX7"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT31", "device_parent":"MUX7"}, "dev_attr": { "dev_idx":"31"}, "i2c": { @@ -1776,7 +1853,7 @@ "dev_info": { "device_type":"", "device_name":"PORT31-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT31"}, "i2c": { - "topo_info": { "parent_bus":"0x37", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x37", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1799,7 +1876,7 @@ }, "PORT32": { - "dev_info": { "device_type":"QSFP28", "device_name":"PORT32", "device_parent":"MUX7"}, + "dev_info": { "device_type":"QSFP-DD", "device_name":"PORT32", "device_parent":"MUX7"}, "dev_attr": { "dev_idx":"32"}, "i2c": { @@ -1815,7 +1892,7 @@ "dev_info": { "device_type":"", "device_name":"PORT32-EEPROM", "device_parent":"MUX7", "virt_parent":"PORT32"}, "i2c": { - "topo_info": { "parent_bus":"0x38", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x38", "dev_addr":"0x50", "dev_type":"optoe3"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1854,7 +1931,7 @@ "dev_info": { "device_type":"", "device_name":"PORT33-EEPROM", "device_parent":"MUX8", "virt_parent":"PORT33"}, "i2c": { - "topo_info": { "parent_bus":"0x39", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x39", "dev_addr":"0x50", "dev_type":"optoe2"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1894,7 +1971,7 @@ "dev_info": { "device_type":"", "device_name":"PORT34-EEPROM", "device_parent":"MUX8", "virt_parent":"PORT34"}, "i2c": { - "topo_info": { "parent_bus":"0x3a", "dev_addr":"0x50", "dev_type":"optoe1"}, + "topo_info": { "parent_bus":"0x3a", "dev_addr":"0x50", "dev_type":"optoe2"}, "attr_list": [ { "attr_name":"eeprom"} @@ -1920,13 +1997,13 @@ "LOC_LED": { "dev_info": { "device_type":"LED", "device_name":"LOC_LED"}, - "dev_attr": { "index":"0"}, + "dev_attr": { "index":"0", "flag": "rw"}, "i2c" : { "attr_list": [ - {"attr_name":"STATUS_LED_COLOR_GREEN_BLINK", "descr": "Green Blinking", "bits" : "7:6", "value" : "0x2", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x30"}, - {"attr_name":"STATUS_LED_COLOR_AMBER", "descr": "Amber", "bits" : "7:6", "value" : "0x1", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x30"}, - {"attr_name":"STATUS_LED_COLOR_OFF", "descr": "Off", "bits" : "7:6", "value" : "0x0", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x30"} + {"attr_name":"green_blink", "descr": "Green Blinking", "bits" : "7:6", "value" : "0x2", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x30"}, + {"attr_name":"amber", "descr": "Amber", "bits" : "7:6", "value" : "0x1", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x30"}, + {"attr_name":"off", "descr": "Off", "bits" : "7:6", "value" : "0x0", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x30"} ] } }, @@ -1934,16 +2011,57 @@ "DIAG_LED": { "dev_info": { "device_type":"LED", "device_name":"DIAG_LED"}, - "dev_attr": { "index":"0"}, + "dev_attr": { "index":"0", "flag": "rw"}, "i2c" : { "attr_list": [ - {"attr_name":"STATUS_LED_COLOR_GREEN", "descr": "Green", "bits" : "2:0", "value" : "0x1", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x31"}, - {"attr_name":"STATUS_LED_COLOR_GREEN_BLINK", "descr": "GreenBlinking", "bits" : "2:0", "value" : "0x4", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x31"}, - {"attr_name":"STATUS_LED_COLOR_AMBER", "descr": "Amber", "bits" : "2:0", "value" : "0x2", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x31"}, - {"attr_name":"STATUS_LED_COLOR_OFF", "descr": "Off", "bits" : "2:0", "value" : "0x0", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x31"} + {"attr_name":"green", "descr": "Green", "bits" : "2:0", "value" : "0x1", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x31"}, + {"attr_name":"green_blink", "descr": "GreenBlinking", "bits" : "2:0", "value" : "0x4", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x31"}, + {"attr_name":"amber", "descr": "Amber", "bits" : "2:0", "value" : "0x2", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x31"}, + {"attr_name":"off", "descr": "Off", "bits" : "2:0", "value" : "0x0", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x31"} ] } - } - + }, + + "PSU1_LED": + { + "dev_info": { "device_type":"LED", "device_name":"PSU_LED"}, + "dev_attr": { "index":"0"}, + "i2c" : { + "attr_list": + [ + {"attr_name":"green", "descr": "Green", "bits" : "1:0", "value" : "0x1", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x30"}, + {"attr_name":"amber", "descr": "Amber", "bits" : "1:0", "value" : "0x2", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x30"}, + {"attr_name":"off", "descr": "Off", "bits" : "1:0", "value" : "0x0", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x30"} + ] + } + }, + + "PSU2_LED": + { + "dev_info": { "device_type":"LED", "device_name":"PSU_LED"}, + "dev_attr": { "index":"1"}, + "i2c" : { + "attr_list": + [ + {"attr_name":"green", "descr": "Green", "bits" : "3:2", "value" : "0x1", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x30"}, + {"attr_name":"amber", "descr": "Amber", "bits" : "3:2", "value" : "0x2", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x30"}, + {"attr_name":"off", "descr": "Off", "bits" : "3:2", "value" : "0x0", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x30"} + ] + } + }, + + "FAN_LED": + { + "dev_info": { "device_type":"LED", "device_name":"FAN_LED"}, + "dev_attr": { "index":"0"}, + "i2c" : { + "attr_list": + [ + {"attr_name":"green", "descr": "Green", "bits" : "5:4", "value" : "0x1", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x30"}, + {"attr_name":"amber", "descr": "Amber", "bits" : "5:4", "value" : "0x2", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x30"}, + {"attr_name":"off", "descr": "Off", "bits" : "5:4", "value" : "0x0", "swpld_addr" : "0x61", "swpld_addr_offset" : "0x30"} + ] + } + } } diff --git a/device/accton/x86_64-accton_as9716_32d-r0/platform.json b/device/accton/x86_64-accton_as9716_32d-r0/platform.json index 8596cd76ae..a37d1aeaec 100644 --- a/device/accton/x86_64-accton_as9716_32d-r0/platform.json +++ b/device/accton/x86_64-accton_as9716_32d-r0/platform.json @@ -1,128 +1,326 @@ { "chassis": { "name": "9716-32D", + "thermal_manager":false, + "status_led": { + "controllable": true, + "colors": ["green", "green_blink", "amber", "off"] + }, "components": [ { "name": "FPGA" }, { - "name": "CPLD1" - }, - { - "name": "CPLD2" + "name": "MB_CPLD1" }, { - "name": "BIOS" - } - ], - "fans": [ - { - "name": "FAN-1F" + "name": "MB_CPLD2" }, { - "name": "FAN-1R" + "name": "FAN_CPLD" }, { - "name": "FAN-2F" + "name": "CPU_CPLD" }, { - "name": "FAN-2R" - }, - { - "name": "FAN-3F" - }, - { - "name": "FAN-3R" - }, - { - "name": "FAN-4F" - }, - { - "name": "FAN-4R" - }, - { - "name": "FAN-5F" - }, - { - "name": "FAN-5R" - }, - { - "name": "FAN-6F" - }, + "name": "BIOS" + } + ], + "fans": [ { - "name": "FAN-6R" + "name": "FAN-1F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-1R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-2F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-2R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-3F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-3R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-4F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-4R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-5F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-5R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-6F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } + }, + { + "name": "FAN-6R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } } ], "fan_drawers":[ { "name": "FanTray1", + "status_led": { + "controllable": false + }, "num_fans" : 2, "fans": [ { - "name": "FAN-1F" + "name": "FAN-1F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } }, { - "name": "FAN-1R" + "name": "FAN-1R", + "speed": { + "controllable": true, + "minimum": 32 + }, + + "status_led": { + "controllable": false + } } ] }, { "name": "FanTray2", + "status_led": { + "controllable": false + }, "num_fans" : 2, "fans": [ { - "name": "FAN-2F" + "name": "FAN-2F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } }, { - "name": "FAN-2R" + "name": "FAN-2R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } } ] }, { "name": "FanTray3", + "status_led": { + "controllable": false + }, "num_fans" : 2, "fans": [ { - "name": "FAN-3F" + "name": "FAN-3F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } }, { - "name": "FAN-3R" + "name": "FAN-3R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } } ] }, { "name": "FanTray4", + "status_led": { + "controllable": false + }, "num_fans" : 2, "fans": [ { - "name": "FAN-4F" + "name": "FAN-4F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } }, { - "name": "FAN-4R" + "name": "FAN-4R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } } ] }, { "name": "FanTray5", + "status_led": { + "controllable": false + }, "num_fans" : 2, "fans": [ { - "name": "FAN-5F" + "name": "FAN-5F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } }, { - "name": "FAN-5R" + "name": "FAN-5R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } } ] }, { "name": "FanTray6", + "status_led": { + "controllable": false + }, "num_fans" : 2, "fans": [ { - "name": "FAN-6F" + "name": "FAN-6F", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } }, { - "name": "FAN-6R" + "name": "FAN-6R", + "speed": { + "controllable": true, + "minimum": 32 + }, + "status_led": { + "controllable": false + } } ] } @@ -130,6 +328,10 @@ "psus": [ { "name": "PSU-1", + "status_led": { + "controllable": true, + "colors": ["green", "amber", "off"] + }, "fans": [ { "name": "PSU-1 FAN-1" @@ -137,12 +339,19 @@ ], "thermals": [ { - "name": "PSU-1 temp sensor 1" + "name": "PSU-1 temp sensor 1", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false } ] }, { "name": "PSU-2", + "status_led": { + "controllable": true, + "colors": ["green", "amber", "off"] + }, "fans": [ { "name": "PSU-2 FAN-1" @@ -150,32 +359,78 @@ ], "thermals": [ { - "name": "PSU-2 temp sensor 1" + "name": "PSU-2 temp sensor 1", + "controllable": false, + "low-crit-threshold": false, + "high-crit-threshold": false } ] } ], "thermals": [ { - "name": "Temp sensor 1" + "name": "MB_FrontMiddle_temp(0x48)", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false + }, + { + "name": "MB_RightCenter_temp(0x49)", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false }, { - "name": "Temp sensor 2" + "name": "MB_LeftCenter_temp(0x4a)", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false }, { - "name": "Temp sensor 3" + "name": "CB_temp(0x4b)", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false }, { - "name": "Temp sensor 4" + "name": "OCXO_temp(0x4c)", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false }, { - "name": "Temp sensor 5" + "name": "FB_1_temp(0x4e)", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false }, { - "name": "Temp sensor 6" + "name": "FB_2_temp(0x4f)", + "controllable": true, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false }, { - "name": "Temp sensor 7" + "name": "coretemp-isa-0000", + "controllable": false, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": true } ], "sfps": [ diff --git a/device/accton/x86_64-accton_as9716_32d-r0/platform_components.json b/device/accton/x86_64-accton_as9716_32d-r0/platform_components.json new file mode 100644 index 0000000000..86867c3f06 --- /dev/null +++ b/device/accton/x86_64-accton_as9716_32d-r0/platform_components.json @@ -0,0 +1,14 @@ +{ + "chassis": { + "9716-32D-O-AC-F": { + "component": { + "FPGA": { }, + "MB_CPLD1": { }, + "MB_CPLD2": { }, + "FAN_CPLD": { }, + "CPU_CPLD": { }, + "BIOS": { } + } + } + } +} diff --git a/device/accton/x86_64-accton_as9716_32d-r0/pmon_daemon_control.json b/device/accton/x86_64-accton_as9716_32d-r0/pmon_daemon_control.json index a3b204e20d..44bad64942 100644 --- a/device/accton/x86_64-accton_as9716_32d-r0/pmon_daemon_control.json +++ b/device/accton/x86_64-accton_as9716_32d-r0/pmon_daemon_control.json @@ -1,5 +1,4 @@ { - "skip_ledd": true, - "skip_pcied": true + "skip_ledd": true } diff --git a/device/accton/x86_64-accton_as9716_32d-r0/sensors.conf b/device/accton/x86_64-accton_as9716_32d-r0/sensors.conf index d375d2315d..b8fc184062 100644 --- a/device/accton/x86_64-accton_as9716_32d-r0/sensors.conf +++ b/device/accton/x86_64-accton_as9716_32d-r0/sensors.conf @@ -38,22 +38,22 @@ chip "as9716_32d_fan-*" chip "lm75-i2c-*-48" - label temp1 "Main Board Temperature" + label temp1 "MB_FrontMiddle_temp" chip "lm75-i2c-*-49" - label temp1 "Main Board Temperature" + label temp1 "MB_RightCenter_temp" chip "lm75-i2c-*-4a" - label temp1 "Main Board Temperature" + label temp1 "MB_LeftCenter_temp" chip "lm75-i2c-*-4b" - label temp1 "CPU Board Temperature" + label temp1 "CB_temp" chip "lm75-i2c-*-4c" - label temp1 "OCXO Temperature" + label temp1 "OCXO_temp" chip "lm75-i2c-*-4e" - label temp1 "Fan Board Temperature" + label temp1 "FB_1_temp" chip "lm75-i2c-*-4f" - label temp1 "Fan Board Temperature" + label temp1 "FB_2_temp" diff --git a/device/accton/x86_64-accton_as9716_32d-r0/system_health_monitoring_config.json b/device/accton/x86_64-accton_as9716_32d-r0/system_health_monitoring_config.json new file mode 100644 index 0000000000..deb3745e14 --- /dev/null +++ b/device/accton/x86_64-accton_as9716_32d-r0/system_health_monitoring_config.json @@ -0,0 +1,13 @@ +{ + "services_to_ignore": [], + "devices_to_ignore": [ + "asic" + ], + "user_defined_checkers": [], + "polling_interval": 60, + "led_color": { + "fault": "amber", + "normal": "green", + "booting": "green_blink" + } +} diff --git a/device/accton/x86_64-accton_as9726_32d-r0/Accton-AS9726-32D-100G/hwsku.json b/device/accton/x86_64-accton_as9726_32d-r0/Accton-AS9726-32D-100G/hwsku.json new file mode 100644 index 0000000000..db6e2c67e4 --- /dev/null +++ b/device/accton/x86_64-accton_as9726_32d-r0/Accton-AS9726-32D-100G/hwsku.json @@ -0,0 +1,175 @@ +{ + + "interfaces": { + "Ethernet0": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet8": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet16": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet24": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet32": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet40": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet48": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet56": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet64": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet72": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet80": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet88": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet96": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet104": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet112": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet120": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet128": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet136": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet144": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet152": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet160": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet168": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet176": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet184": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet192": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet200": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet208": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet216": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet224": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet232": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet240": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet248": { + "default_brkout_mode": "1x100G[40G](4)", + "autoneg": "off" + }, + + "Ethernet256": { + "default_brkout_mode": "1x10G[1G]", + "autoneg": "off" + }, + + "Ethernet257": { + "default_brkout_mode": "1x10G[1G]", + "autoneg": "off" + } + } +} + diff --git a/device/accton/x86_64-accton_as9726_32d-r0/Accton-AS9726-32D-100G/port_config.ini b/device/accton/x86_64-accton_as9726_32d-r0/Accton-AS9726-32D-100G/port_config.ini new file mode 100644 index 0000000000..d32f4f7b3b --- /dev/null +++ b/device/accton/x86_64-accton_as9726_32d-r0/Accton-AS9726-32D-100G/port_config.ini @@ -0,0 +1,35 @@ +# name lanes alias index speed +Ethernet0 73,74,75,76 Eth1(Port1) 1 100000 +Ethernet8 65,66,67,68 Eth2(Port2) 2 100000 +Ethernet16 81,82,83,84 Eth3(Port3) 3 100000 +Ethernet24 89,90,91,92 Eth4(Port4) 4 100000 +Ethernet32 97,98,99,100 Eth5(Port5) 5 100000 +Ethernet40 105,106,107,108 Eth6(Port6) 6 100000 +Ethernet48 113,114,115,116 Eth7(Port7) 7 100000 +Ethernet56 121,122,123,124 Eth8(Port8) 8 100000 +Ethernet64 41,42,43,44 Eth9(Port9) 9 100000 +Ethernet72 33,34,35,36 Eth10(Port10) 10 100000 +Ethernet80 49,50,51,52 Eth11(Port11) 11 100000 +Ethernet88 57,58,59,60 Eth12(Port12) 12 100000 +Ethernet96 129,130,131,132 Eth13(Port13) 13 100000 +Ethernet104 137,138,139,140 Eth14(Port14) 14 100000 +Ethernet112 145,146,147,148 Eth15(Port15) 15 100000 +Ethernet120 153,154,155,156 Eth16(Port16) 16 100000 +Ethernet128 169,170,171,172 Eth17(Port17) 17 100000 +Ethernet136 161,162,163,164 Eth18(Port18) 18 100000 +Ethernet144 177,178,179,180 Eth19(Port19) 19 100000 +Ethernet152 185,186,187,188 Eth20(Port20) 20 100000 +Ethernet160 1,2,3,4 Eth21(Port21) 21 100000 +Ethernet168 9,10,11,12 Eth22(Port22) 22 100000 +Ethernet176 17,18,19,20 Eth23(Port23) 23 100000 +Ethernet184 25,26,27,28 Eth24(Port24) 24 100000 +Ethernet192 201,202,203,204 Eth25(Port25) 25 100000 +Ethernet200 193,194,195,196 Eth26(Port26) 26 100000 +Ethernet208 217,218,219,220 Eth27(Port27) 27 100000 +Ethernet216 209,210,211,212 Eth28(Port28) 28 100000 +Ethernet224 233,234,235,236 Eth29(Port29) 29 100000 +Ethernet232 225,226,227,228 Eth30(Port30) 30 100000 +Ethernet240 249,250,251,252 Eth31(Port31) 31 100000 +Ethernet248 241,242,243,244 Eth32(Port32) 32 100000 +Ethernet256 259 Eth33(Port33) 33 10000 +Ethernet257 260 Eth34(Port34) 34 10000 diff --git a/device/accton/x86_64-accton_as9726_32d-r0/Accton-AS9726-32D-100G/sai.profile b/device/accton/x86_64-accton_as9726_32d-r0/Accton-AS9726-32D-100G/sai.profile new file mode 100644 index 0000000000..dffd07bce0 --- /dev/null +++ b/device/accton/x86_64-accton_as9726_32d-r0/Accton-AS9726-32D-100G/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td4-as9726-32x100G.config.yml diff --git a/device/accton/x86_64-accton_as9726_32d-r0/Accton-AS9726-32D-100G/td4-as9726-32x100G.config.yml b/device/accton/x86_64-accton_as9726_32d-r0/Accton-AS9726-32D-100G/td4-as9726-32x100G.config.yml new file mode 100644 index 0000000000..d9aca184b4 --- /dev/null +++ b/device/accton/x86_64-accton_as9726_32d-r0/Accton-AS9726-32D-100G/td4-as9726-32x100G.config.yml @@ -0,0 +1,797 @@ +# +# BCM56880 32x400g port configuration. +# +# configuration yaml file +# device: +# : +# : +# ? +# : +# : +# ... +# : +# : +# : +# : +# ... +# : +# +# $Copyright: (c) 2019 Broadcom. +# Broadcom Proprietary and Confidential. All rights reserved.$ +# + +--- +bcm_device: + 0: + global: + pktio_mode: 1 + skip_protocol_default_entries: 1 + uft_mode: 3 + l3_alpm_template: 1 + vlan_default_port: 3 + max_vp_lags: 894 + vlan_flooding_l2mc_num_reserved: 0 +... +--- +bcm_device: + 0: + port: + "*": + port_allow_tpid_disable: 1 +... +--- +device: + 0: + DEVICE_CONFIG: + # CORE CLOCK FREQUENCY + CORE_CLK_FREQ: CLK_1350MHZ + # PP CLOCK FREQUENCY + PP_CLK_FREQ: CLK_1350MHZ +... +--- +device: + 0: + PC_PM_CORE: + ? + PC_PM_ID: 1 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x01476352 + TX_LANE_MAP: 0x67015324 + RX_POLARITY_FLIP: 0xFF + TX_POLARITY_FLIP: 0xDD + ? + PC_PM_ID: 2 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x21563047 + TX_LANE_MAP: 0x70146253 + RX_POLARITY_FLIP: 0xEF + TX_POLARITY_FLIP: 0x6 + ? + PC_PM_ID: 3 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x34216570 + TX_LANE_MAP: 0x02453617 + RX_POLARITY_FLIP: 0x0 + TX_POLARITY_FLIP: 0xEE + ? + PC_PM_ID: 4 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x26531470 + TX_LANE_MAP: 0x40726513 + RX_POLARITY_FLIP: 0xFF + TX_POLARITY_FLIP: 0xBE + ? + PC_PM_ID: 5 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x23641705 + TX_LANE_MAP: 0x45326071 + RX_POLARITY_FLIP: 0xFF + TX_POLARITY_FLIP: 0xB3 + ? + PC_PM_ID: 6 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x45013726 + TX_LANE_MAP: 0x23170564 + RX_POLARITY_FLIP: 0x0 + TX_POLARITY_FLIP: 0x21 + ? + PC_PM_ID: 7 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x41025763 + TX_LANE_MAP: 0x25674013 + RX_POLARITY_FLIP: 0x0 + TX_POLARITY_FLIP: 0x4 + ? + PC_PM_ID: 8 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x01675243 + TX_LANE_MAP: 0x07236415 + RX_POLARITY_FLIP: 0xFF + TX_POLARITY_FLIP: 0xEB + ? + PC_PM_ID: 9 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x56024713 + TX_LANE_MAP: 0x21670534 + RX_POLARITY_FLIP: 0x0 + TX_POLARITY_FLIP: 0x3E + ? + PC_PM_ID: 10 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x01675342 + TX_LANE_MAP: 0x43607512 + RX_POLARITY_FLIP: 0xFF + TX_POLARITY_FLIP: 0x3D + ? + PC_PM_ID: 11 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x20563147 + TX_LANE_MAP: 0x50126734 + RX_POLARITY_FLIP: 0xFF + TX_POLARITY_FLIP: 0xF3 + ? + PC_PM_ID: 12 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x46150723 + TX_LANE_MAP: 0x13456072 + RX_POLARITY_FLIP: 0x0 + TX_POLARITY_FLIP: 0xEA + ? + PC_PM_ID: 13 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x51276034 + TX_LANE_MAP: 0x35476012 + RX_POLARITY_FLIP: 0xC5 + TX_POLARITY_FLIP: 0xED + ? + PC_PM_ID: 14 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x65217430 + TX_LANE_MAP: 0x02541637 + RX_POLARITY_FLIP: 0x0 + TX_POLARITY_FLIP: 0x4 + ? + PC_PM_ID: 15 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x32461057 + TX_LANE_MAP: 0x54107362 + RX_POLARITY_FLIP: 0xFF + TX_POLARITY_FLIP: 0xCD + ? + PC_PM_ID: 16 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x31405267 + TX_LANE_MAP: 0x63150724 + RX_POLARITY_FLIP: 0xFF + TX_POLARITY_FLIP: 0xF4 + ? + PC_PM_ID: 17 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x01475263 + TX_LANE_MAP: 0x63017524 + RX_POLARITY_FLIP: 0xFF + TX_POLARITY_FLIP: 0xFF + ? + PC_PM_ID: 18 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x21463057 + TX_LANE_MAP: 0x70135462 + RX_POLARITY_FLIP: 0xFF + TX_POLARITY_FLIP: 0x9C + ? + PC_PM_ID: 19 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x64217530 + TX_LANE_MAP: 0x23561407 + RX_POLARITY_FLIP: 0x0 + TX_POLARITY_FLIP: 0x53 + ? + PC_PM_ID: 20 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x10652473 + TX_LANE_MAP: 0x25306417 + RX_POLARITY_FLIP: 0x14 + TX_POLARITY_FLIP: 0xCA + ? + PC_PM_ID: 21 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x24561307 + TX_LANE_MAP: 0x65407321 + RX_POLARITY_FLIP: 0xFF + TX_POLARITY_FLIP: 0x37 + ? + PC_PM_ID: 22 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x27416350 + TX_LANE_MAP: 0x06573421 + RX_POLARITY_FLIP: 0x0 + TX_POLARITY_FLIP: 0xFB + ? + PC_PM_ID: 23 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x40517263 + TX_LANE_MAP: 0x30742516 + RX_POLARITY_FLIP: 0x0 + TX_POLARITY_FLIP: 0xB1 + ? + PC_PM_ID: 24 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x02561347 + TX_LANE_MAP: 0x53017624 + RX_POLARITY_FLIP: 0xFF + TX_POLARITY_FLIP: 0x23 + ? + PC_PM_ID: 25 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x64127503 + TX_LANE_MAP: 0x40572613 + RX_POLARITY_FLIP: 0x0 + TX_POLARITY_FLIP: 0xC + ? + PC_PM_ID: 26 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x01475362 + TX_LANE_MAP: 0x67015324 + RX_POLARITY_FLIP: 0xFF + TX_POLARITY_FLIP: 0x5C + ? + PC_PM_ID: 27 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x46150723 + TX_LANE_MAP: 0x21630754 + RX_POLARITY_FLIP: 0x0 + TX_POLARITY_FLIP: 0xA0 + ? + PC_PM_ID: 28 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x20563147 + TX_LANE_MAP: 0x23607451 + RX_POLARITY_FLIP: 0xFF + TX_POLARITY_FLIP: 0xCF + ? + PC_PM_ID: 29 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x72541360 + TX_LANE_MAP: 0x50461237 + RX_POLARITY_FLIP: 0x22 + TX_POLARITY_FLIP: 0x15 + ? + PC_PM_ID: 30 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x32465071 + TX_LANE_MAP: 0x64312705 + RX_POLARITY_FLIP: 0xFF + TX_POLARITY_FLIP: 0x7F + ? + PC_PM_ID: 31 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x56412730 + TX_LANE_MAP: 0x31647250 + RX_POLARITY_FLIP: 0x0 + TX_POLARITY_FLIP: 0x20 + ? + PC_PM_ID: 32 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x64127503 + TX_LANE_MAP: 0x54321607 + RX_POLARITY_FLIP: 0x0 + TX_POLARITY_FLIP: 0x80 +... +--- +device: + 0: + PC_PORT_PHYS_MAP: + ? + # CPU port + PORT_ID: 0 + : + PC_PHYS_PORT_ID: 0 + ? + PORT_ID: 1 + : + PC_PHYS_PORT_ID: 1 #TSC-BH7 0 in Pipe 0 + #? + # PORT_ID: 2 + #: + # PC_PHYS_PORT_ID: 5 #TSC-BH7 0 in Pipe 0 + ? + PORT_ID: 3 + : + PC_PHYS_PORT_ID: 9 #TSC-BH7 1 in Pipe 0 + #? + # PORT_ID: 4 + #: + # PC_PHYS_PORT_ID: 13 #TSC-BH7 1 in Pipe 0 + ? + PORT_ID: 5 + : + PC_PHYS_PORT_ID: 17 #TSC-BH7 2 in Pipe 0 + #? + # PORT_ID: 6 + #: + # PC_PHYS_PORT_ID: 21 #TSC-BH7 2 in Pipe 0 + ? + PORT_ID: 7 + : + PC_PHYS_PORT_ID: 25 #TSC-BH7 3 in Pipe 0 + #? + # PORT_ID: 8 + #: + # PC_PHYS_PORT_ID: 29 #TSC-BH7 3 in Pipe 0 + ? + PORT_ID: 20 + : + PC_PHYS_PORT_ID: 33 #TSC-BH7 4 in Pipe 1 + #? + # PORT_ID: 21 + #: + # PC_PHYS_PORT_ID: 37 #TSC-BH7 4 in Pipe 1 + ? + PORT_ID: 22 + : + PC_PHYS_PORT_ID: 41 #TSC-BH7 5 in Pipe 1 + #? + # PORT_ID: 23 + #: + # PC_PHYS_PORT_ID: 45 #TSC-BH7 5 in Pipe 1 + ? + PORT_ID: 24 + : + PC_PHYS_PORT_ID: 49 #TSC-BH7 6 in Pipe 1 + #? + # PORT_ID: 25 + #: + # PC_PHYS_PORT_ID: 53 #TSC-BH7 6 in Pipe 1 + ? + PORT_ID: 26 + : + PC_PHYS_PORT_ID: 57 #TSC-BH7 7 in Pipe 1 + #? + # PORT_ID: 27 + #: + # PC_PHYS_PORT_ID: 61 #TSC-BH7 7 in Pipe 1 + ? + PORT_ID: 40 + : + PC_PHYS_PORT_ID: 65 #TSC-BH7 8 in Pipe 2 + #? + # PORT_ID: 41 + #: + # PC_PHYS_PORT_ID: 69 #TSC-BH7 8 in Pipe 2 + ? + PORT_ID: 42 + : + PC_PHYS_PORT_ID: 73 #TSC-BH7 9 in Pipe 2 + #? + # PORT_ID: 43 + #: + # PC_PHYS_PORT_ID: 77 #TSC-BH7 9 in Pipe 2 + ? + PORT_ID: 44 + : + PC_PHYS_PORT_ID: 81 #TSC-BH7 10 in Pipe 2 + #? + # PORT_ID: 45 + #: + # PC_PHYS_PORT_ID: 85 #TSC-BH7 10 in Pipe 2 + ? + PORT_ID: 46 + : + PC_PHYS_PORT_ID: 89 #TSC-BH7 11 in Pipe 2 + #? + # PORT_ID: 47 + #: + # PC_PHYS_PORT_ID: 93 #TSC-BH7 11 in Pipe 2 + ? + PORT_ID: 60 + : + PC_PHYS_PORT_ID: 97 #TSC-BH7 12 in Pipe 3 + #? + # PORT_ID: 61 + #: + # PC_PHYS_PORT_ID: 101 #TSC-BH7 12 in Pipe 3 + ? + PORT_ID: 62 + : + PC_PHYS_PORT_ID: 105 #TSC-BH7 13 in Pipe 3 + #? + # PORT_ID: 63 + #: + # PC_PHYS_PORT_ID: 109 #TSC-BH7 13 in Pipe 3 + ? + PORT_ID: 64 + : + PC_PHYS_PORT_ID: 113 #TSC-BH7 14 in Pipe 3 + #? + # PORT_ID: 65 + #: + # PC_PHYS_PORT_ID: 117 #TSC-BH7 14 in Pipe 3 + ? + PORT_ID: 66 + : + PC_PHYS_PORT_ID: 121 #TSC-BH7 15 in Pipe 3 + #? + # PORT_ID: 67 + #: + # PC_PHYS_PORT_ID: 125 #TSC-BH7 15 in Pipe 3 + ? + PORT_ID: 80 + : + PC_PHYS_PORT_ID: 129 #TSC-BH7 16 in Pipe 4 + #? + # PORT_ID: 81 + #: + # PC_PHYS_PORT_ID: 133 #TSC-BH7 16 in Pipe 4 + ? + PORT_ID: 82 + : + PC_PHYS_PORT_ID: 137 #TSC-BH7 17 in Pipe 4 + #? + # PORT_ID: 83 + #: + # PC_PHYS_PORT_ID: 141 #TSC-BH7 17 in Pipe 4 + ? + PORT_ID: 84 + : + PC_PHYS_PORT_ID: 145 #TSC-BH7 18 in Pipe 4 + #? + # PORT_ID: 85 + #: + # PC_PHYS_PORT_ID: 149 #TSC-BH7 18 in Pipe 4 + ? + PORT_ID: 86 + : + PC_PHYS_PORT_ID: 153 #TSC-BH7 19 in Pipe 4 + #? + # PORT_ID: 87 + #: + # PC_PHYS_PORT_ID: 157 #TSC-BH7 19 in Pipe 4 + ? + PORT_ID: 100 + : + PC_PHYS_PORT_ID: 161 #TSC-BH7 20 in Pipe 5 + #? + # PORT_ID: 101 + #: + # PC_PHYS_PORT_ID: 165 #TSC-BH7 20 in Pipe 5 + ? + PORT_ID: 102 + : + PC_PHYS_PORT_ID: 169 #TSC-BH7 21 in Pipe 5 + #? + # PORT_ID: 103 + #: + # PC_PHYS_PORT_ID: 173 #TSC-BH7 21 in Pipe 5 + ? + PORT_ID: 104 + : + PC_PHYS_PORT_ID: 177 #TSC-BH7 22 in Pipe 5 + #? + # PORT_ID: 105 + #: + # PC_PHYS_PORT_ID: 181 #TSC-BH7 22 in Pipe 5 + ? + PORT_ID: 106 + : + PC_PHYS_PORT_ID: 185 #TSC-BH7 23 in Pipe 5 + #? + # PORT_ID: 107 + #: + # PC_PHYS_PORT_ID: 189 #TSC-BH7 23 in Pipe 5 + ? + PORT_ID: 120 + : + PC_PHYS_PORT_ID: 193 #TSC-BH7 24 in Pipe 6 + #? + # PORT_ID: 121 + #: + # PC_PHYS_PORT_ID: 197 #TSC-BH7 24 in Pipe 6 + ? + PORT_ID: 122 + : + PC_PHYS_PORT_ID: 201 #TSC-BH7 25 in Pipe 6 + #? + # PORT_ID: 123 + #: + # PC_PHYS_PORT_ID: 205 #TSC-BH7 25 in Pipe 6 + ? + PORT_ID: 124 + : + PC_PHYS_PORT_ID: 209 #TSC-BH7 26 in Pipe 6 + #? + # PORT_ID: 125 + #: + # PC_PHYS_PORT_ID: 213 #TSC-BH7 26 in Pipe 6 + ? + PORT_ID: 126 + : + PC_PHYS_PORT_ID: 217 #TSC-BH7 27 in Pipe 6 + #? + # PORT_ID: 127 + #: + # PC_PHYS_PORT_ID: 221 #TSC-BH7 27 in Pipe 6 + ? + PORT_ID: 140 + : + PC_PHYS_PORT_ID: 225 #TSC-BH7 28 in Pipe 7 + #? + # PORT_ID: 141 + #: + # PC_PHYS_PORT_ID: 229 #TSC-BH7 28 in Pipe 7 + ? + PORT_ID: 142 + : + PC_PHYS_PORT_ID: 233 #TSC-BH7 29 in Pipe 7 + #? + # PORT_ID: 143 + #: + # PC_PHYS_PORT_ID: 237 #TSC-BH7 29 in Pipe 7 + ? + PORT_ID: 144 + : + PC_PHYS_PORT_ID: 241 #TSC-BH7 30 in Pipe 7 + #? + # PORT_ID: 145 + #: + # PC_PHYS_PORT_ID: 245 #TSC-BH7 30 in Pipe 7 + ? + PORT_ID: 146 + : + PC_PHYS_PORT_ID: 249 #TSC-BH7 31 in Pipe 7 + #? + # PORT_ID: 147 + #: + # PC_PHYS_PORT_ID: 253 #TSC-BH7 31 in Pipe 7 + #? + # Management port 0 (Pipe 1) - CPU + # PORT_ID: 38 + #: + # PC_PHYS_PORT_ID: 257 + #? + # Management port 1 (Pipe 3) - CPU + # PORT_ID: 78 + #: + # PC_PHYS_PORT_ID: 258 + ? + # Management port 2 (Pipe 5) - Front Panel Port + PORT_ID: 118 + : + PC_PHYS_PORT_ID: 259 + ? + # Management port 3 (Pipe 7) - Front Panel Port + PORT_ID: 158 + : + PC_PHYS_PORT_ID: 260 +... +--- +device: + 0: + PC_PORT: + ? + PORT_ID: 0 + : + &port_mode_10g + ENABLE: 1 + SPEED: 10000 + NUM_LANES: 1 + ? + PORT_ID: [[1],[3],[5],[7], + [20],[22],[24],[26], + [40],[42],[44],[46], + [60],[62],[64],[66], + [80],[82],[84],[86], + [100],[102],[104],[106], + [120],[122],[124],[126], + [140],[142],[144],[146]] + : + &port_mode_100g + ENABLE: 0 + SPEED: 100000 + NUM_LANES: 4 + FEC_MODE: PC_FEC_RS528 + MAX_FRAME_SIZE: 9416 + #? + # PORT_ID: [38, # Management port 0 (Pipe 1) - CPU + # 78] # Management port 1 (Pipe 3) - CPU + #: + # &port_mode_10g_xfi + # ENABLE: 0 + # SPEED: 10000 + # NUM_LANES: 1 + # MAX_FRAME_SIZE: 9416 + ? + PORT_ID: [118, # Management port 2 (Pipe 5) - Front Panel Port + 158] # Management port 3 (Pipe 7) - Front Panel Port + : + &port_mode_10g_xfi + ENABLE: 0 + SPEED: 10000 + NUM_LANES: 1 + MAX_FRAME_SIZE: 9416 + + PC_PMD_FIRMWARE: + ? + PORT_ID: [[1],[3],[5],[7], + [20],[22],[24],[26], + [40],[42],[44],[46], + [60],[62],[64],[66], + [80],[82],[84],[86], + [100],[102],[104],[106], + [120],[122],[124],[126], + [140],[142],[144],[146]] + : + MEDIUM_TYPE_AUTO: 0 + MEDIUM_TYPE: PC_PHY_MEDIUM_COPPER +... +--- +device: + 0: + TM_THD_CONFIG: + THRESHOLD_MODE: LOSSLESS +... +--- +device: + 0: + FP_CONFIG: + FP_ING_OPERMODE: GLOBAL_PIPE_AWARE +... diff --git a/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D-100G/hwsku.json b/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D-100G/hwsku.json new file mode 100644 index 0000000000..6c3b42f2f0 --- /dev/null +++ b/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D-100G/hwsku.json @@ -0,0 +1,267 @@ +{ + "interfaces": { + "Ethernet0": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet4": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet8": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet12": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet16": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet20": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet24": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet28": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet32": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet36": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet40": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet44": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet48": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet52": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet56": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet60": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet64": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet68": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet72": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet76": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet80": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet84": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet88": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet92": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet96": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet100": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet104": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet108": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet112": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet116": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet120": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet124": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet128": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet132": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet136": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet140": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet144": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet148": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet152": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet156": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet160": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet164": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet168": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet172": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet176": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet180": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet184": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet188": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet192": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet196": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet200": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet204": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet208": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet212": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet216": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet220": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet224": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet228": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet232": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet236": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet240": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet244": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet248": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet252": { + "default_brkout_mode": "1x100G[40G](2)" + }, + + "Ethernet256": { + "default_brkout_mode": "1x10G[1G]" + }, + + "Ethernet257": { + "default_brkout_mode": "1x10G[1G]" + } + } +} diff --git a/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D-100G/port_config.ini b/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D-100G/port_config.ini new file mode 100644 index 0000000000..34f99f5e2f --- /dev/null +++ b/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D-100G/port_config.ini @@ -0,0 +1,67 @@ +# name lanes alias index speed +Ethernet0 65,66 Eth1(Port1) 1 100000 +Ethernet4 69,70 Eth2(Port2) 2 100000 +Ethernet8 73,74 Eth3(Port3) 3 100000 +Ethernet12 77,78 Eth4(Port4) 4 100000 +Ethernet16 81,82 Eth5(Port5) 5 100000 +Ethernet20 85,86 Eth6(Port6) 6 100000 +Ethernet24 89,90 Eth7(Port7) 7 100000 +Ethernet28 93,94 Eth8(Port8) 8 100000 +Ethernet32 97,98 Eth9(Port9) 9 100000 +Ethernet36 101,102 Eth10(Port10) 10 100000 +Ethernet40 125,126 Eth11(Port11) 11 100000 +Ethernet44 121,122 Eth12(Port12) 12 100000 +Ethernet48 113,114 Eth13(Port13) 13 100000 +Ethernet52 117,118 Eth14(Port14) 14 100000 +Ethernet56 109,110 Eth15(Port15) 15 100000 +Ethernet60 105,106 Eth16(Port16) 16 100000 +Ethernet64 145,146 Eth17(Port17) 17 100000 +Ethernet68 149,150 Eth18(Port18) 18 100000 +Ethernet72 141,142 Eth19(Port19) 19 100000 +Ethernet76 137,138 Eth20(Port20) 20 100000 +Ethernet80 129,130 Eth21(Port21) 21 100000 +Ethernet84 133,134 Eth22(Port22) 22 100000 +Ethernet88 153,154 Eth23(Port23) 23 100000 +Ethernet92 157,158 Eth24(Port24) 24 100000 +Ethernet96 161,162 Eth25(Port25) 25 100000 +Ethernet100 165,166 Eth26(Port26) 26 100000 +Ethernet104 169,170 Eth27(Port27) 27 100000 +Ethernet108 173,174 Eth28(Port28) 28 100000 +Ethernet112 177,178 Eth29(Port29) 29 100000 +Ethernet116 181,182 Eth30(Port30) 30 100000 +Ethernet120 185,186 Eth31(Port31) 31 100000 +Ethernet124 189,190 Eth32(Port32) 32 100000 +Ethernet128 49,50 Eth33(Port33) 33 100000 +Ethernet132 53,54 Eth34(Port34) 34 100000 +Ethernet136 57,58 Eth35(Port35) 35 100000 +Ethernet140 61,62 Eth36(Port36) 36 100000 +Ethernet144 29,30 Eth37(Port37) 37 100000 +Ethernet148 33,34 Eth38(Port38) 38 100000 +Ethernet152 25,26 Eth39(Port39) 39 100000 +Ethernet156 41,42 Eth40(Port40) 40 100000 +Ethernet160 21,22 Eth41(Port41) 41 100000 +Ethernet164 37,38 Eth42(Port42) 42 100000 +Ethernet168 17,18 Eth43(Port43) 43 100000 +Ethernet172 45,46 Eth44(Port44) 44 100000 +Ethernet176 13,14 Eth45(Port45) 45 100000 +Ethernet180 9,10 Eth46(Port46) 46 100000 +Ethernet184 1,2 Eth47(Port47) 47 100000 +Ethernet188 5,6 Eth48(Port48) 48 100000 +Ethernet192 249,250 Eth49(Port49) 49 100000 +Ethernet196 253,254 Eth50(Port50) 50 100000 +Ethernet200 245,246 Eth51(Port51) 51 100000 +Ethernet204 241,242 Eth52(Port52) 52 100000 +Ethernet208 237,238 Eth53(Port53) 53 100000 +Ethernet212 209,210 Eth54(Port54) 54 100000 +Ethernet216 233,234 Eth55(Port55) 55 100000 +Ethernet220 217,218 Eth56(Port56) 56 100000 +Ethernet224 229,230 Eth57(Port57) 57 100000 +Ethernet228 213,214 Eth58(Port58) 58 100000 +Ethernet232 225,226 Eth59(Port59) 59 100000 +Ethernet236 221,222 Eth60(Port60) 60 100000 +Ethernet240 193,194 Eth61(Port61) 61 100000 +Ethernet244 201,202 Eth62(Port62) 62 100000 +Ethernet248 197,198 Eth63(Port63) 63 100000 +Ethernet252 205,206 Eth64(Port64) 64 100000 +Ethernet256 257 Eth65(Port65) 65 10000 +Ethernet257 258 Eth66(Port66) 66 10000 diff --git a/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D-100G/sai.profile b/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D-100G/sai.profile new file mode 100644 index 0000000000..4d524c949a --- /dev/null +++ b/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D-100G/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th4-as9736-64x100G.config.yml diff --git a/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D-100G/th4-as9736-64x100G.config.yml b/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D-100G/th4-as9736-64x100G.config.yml new file mode 100644 index 0000000000..ad60e78876 --- /dev/null +++ b/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D-100G/th4-as9736-64x100G.config.yml @@ -0,0 +1,1218 @@ +#--- +#device: +# 0: +# DEVICE_CONFIG: +# # CORE CLOCK FREQUENCY +# CORE_CLK_FREQ: CLK_1350MHZ +# # PP CLOCK FREQUENCY +# PP_CLK_FREQ: CLK_1350MHZ +#... +--- +bcm_device: + 0: + global: + pktio_mode: 1 + vlan_flooding_l2mc_num_reserved: 0 + ipv6_lpm_128b_enable: 1 + shared_block_mask_section: uc_bc + skip_protocol_default_entries: 1 + # LTSW uses value 1 for ALPM combined mode + l3_alpm_template: 1 + l3_alpm_hit_skip: 1 + sai_feat_tail_timestamp : 1 + sai_field_group_auto_prioritize: 1 + #l3_intf_vlan_split_egress for MTU at L3IF + l3_intf_vlan_split_egress : 1 + pfc_deadlock_seq_control : 1 + sai_tunnel_support: 2 + bcm_tunnel_term_compatible_mode: 1 + l3_ecmp_member_first_lkup_mem_size: 12288 + sai_port_pmap_phy_lanes : 1 + sai_disable_ports_when_sw_shutdown: 1 +... +--- +bcm_device: + 0: + global: + dport_map_enable: 0 + port: + 68: { dport_map_port: 1 } + 72: { dport_map_port: 2 } + 76: { dport_map_port: 3 } + 80: { dport_map_port: 4 } + 85: { dport_map_port: 5 } + 89: { dport_map_port: 6 } + 93: { dport_map_port: 7 } + 97: { dport_map_port: 8 } + 102: { dport_map_port: 9 } + 106: { dport_map_port: 10 } + 131: { dport_map_port: 11 } + 127: { dport_map_port: 12 } + 119: { dport_map_port: 13 } + 123: { dport_map_port: 14 } + 114: { dport_map_port: 15 } + 110: { dport_map_port: 16 } + 153: { dport_map_port: 17 } + 157: { dport_map_port: 18 } + 148: { dport_map_port: 19 } + 144: { dport_map_port: 20 } + 136: { dport_map_port: 21 } + 140: { dport_map_port: 22 } + 161: { dport_map_port: 23 } + 165: { dport_map_port: 24 } + 170: { dport_map_port: 25 } + 174: { dport_map_port: 26 } + 178: { dport_map_port: 27 } + 182: { dport_map_port: 28 } + 187: { dport_map_port: 29 } + 191: { dport_map_port: 30 } + 195: { dport_map_port: 31 } + 199: { dport_map_port: 32 } + 51: { dport_map_port: 33 } + 55: { dport_map_port: 34 } + 59: { dport_map_port: 35 } + 63: { dport_map_port: 36 } + 29: { dport_map_port: 37 } + 34: { dport_map_port: 38 } + 25: { dport_map_port: 39 } + 42: { dport_map_port: 40 } + 21: { dport_map_port: 41 } + 38: { dport_map_port: 42 } + 17: { dport_map_port: 43 } + 46: { dport_map_port: 44 } + 13: { dport_map_port: 45 } + 9: { dport_map_port: 46 } + 1: { dport_map_port: 47 } + 5: { dport_map_port: 48 } + 263: { dport_map_port: 49 } + 267: { dport_map_port: 50 } + 259: { dport_map_port: 51 } + 255: { dport_map_port: 52 } + 250: { dport_map_port: 53 } + 221: { dport_map_port: 54 } + 246: { dport_map_port: 55 } + 229: { dport_map_port: 56 } + 242: { dport_map_port: 57 } + 225: { dport_map_port: 58 } + 238: { dport_map_port: 59 } + 233: { dport_map_port: 60 } + 204: { dport_map_port: 61 } + 212: { dport_map_port: 62 } + 208: { dport_map_port: 63 } + 216: { dport_map_port: 64 } + 152: { dport_map_port: 65 } + 50: { dport_map_port: 66 } +... +--- +device: + 0: + PC_PM_CORE: + ? + PC_PM_ID: 1 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x26371504 + TX_LANE_MAP: 0x37260415 + RX_POLARITY_FLIP: 0x0a + TX_POLARITY_FLIP: 0x0a + ? + PC_PM_ID: 2 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x26371504 + TX_LANE_MAP: 0x51406273 + RX_POLARITY_FLIP: 0x0a + TX_POLARITY_FLIP: 0xf5 + ? + PC_PM_ID: 3 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x62735140 + TX_LANE_MAP: 0x62735140 + RX_POLARITY_FLIP: 0x0a + TX_POLARITY_FLIP: 0x0a + ? + PC_PM_ID: 4 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x51406273 + TX_LANE_MAP: 0x40517362 + RX_POLARITY_FLIP: 0xf5 + TX_POLARITY_FLIP: 0xf5 + ? + PC_PM_ID: 5 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x52437061 + TX_LANE_MAP: 0x42537160 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xaf + ? + PC_PM_ID: 6 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x52437061 + TX_LANE_MAP: 0x41507362 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xfa + ? + PC_PM_ID: 7 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x52437061 + TX_LANE_MAP: 0x40517362 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xfa + ? + PC_PM_ID: 8 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x52437061 + TX_LANE_MAP: 0x41507362 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xfa + ? + PC_PM_ID: 9 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x42537160 + TX_LANE_MAP: 0x40516273 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xfa + ? + PC_PM_ID: 10 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x54237061 + TX_LANE_MAP: 0x41507362 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xfa + ? + PC_PM_ID: 11 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x23547160 + TX_LANE_MAP: 0x51406273 + RX_POLARITY_FLIP: 0x57 + TX_POLARITY_FLIP: 0xfa + ? + PC_PM_ID: 12 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x52437061 + TX_LANE_MAP: 0x41507362 + RX_POLARITY_FLIP: 0x57 + TX_POLARITY_FLIP: 0xfa + ? + PC_PM_ID: 13 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x24350716 + TX_LANE_MAP: 0x15042637 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0x0a + ? + PC_PM_ID: 14 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x41537062 + TX_LANE_MAP: 0x41507362 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xfa + ? + PC_PM_ID: 15 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x14350726 + TX_LANE_MAP: 0x15042637 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0x0a + ? + PC_PM_ID: 16 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x51437062 + TX_LANE_MAP: 0x41507362 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xfa + ? + PC_PM_ID: 17 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x52436071 + TX_LANE_MAP: 0x51406273 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xaa + ? + PC_PM_ID: 18 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x25340716 + TX_LANE_MAP: 0x04153726 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xaa + ? + PC_PM_ID: 19 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x52437061 + TX_LANE_MAP: 0x51406273 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xaa + ? + PC_PM_ID: 20 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x25340716 + TX_LANE_MAP: 0x04153726 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xaa + ? + PC_PM_ID: 21 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x52437061 + TX_LANE_MAP: 0x51406273 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xaa + ? + PC_PM_ID: 22 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x15340726 + TX_LANE_MAP: 0x04153726 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xaa + ? + PC_PM_ID: 23 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x52437061 + TX_LANE_MAP: 0x51406273 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xaa + ? + PC_PM_ID: 24 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x25340716 + TX_LANE_MAP: 0x04153726 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xaa + ? + PC_PM_ID: 25 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x52437061 + TX_LANE_MAP: 0x51406273 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xaa + ? + PC_PM_ID: 26 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x25340716 + TX_LANE_MAP: 0x04153726 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xaa + ? + PC_PM_ID: 27 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x34251607 + TX_LANE_MAP: 0x51406273 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xaa + ? + PC_PM_ID: 28 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x43516270 + TX_LANE_MAP: 0x34250716 + RX_POLARITY_FLIP: 0x51 + TX_POLARITY_FLIP: 0x00 + ? + PC_PM_ID: 29 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x15042637 + TX_LANE_MAP: 0x25041637 + RX_POLARITY_FLIP: 0xc5 + TX_POLARITY_FLIP: 0xc5 + ? + PC_PM_ID: 30 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x26371504 + TX_LANE_MAP: 0x37260415 + RX_POLARITY_FLIP: 0xca + TX_POLARITY_FLIP: 0xfa + ? + PC_PM_ID: 31 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x62735140 + TX_LANE_MAP: 0x04153726 + RX_POLARITY_FLIP: 0xcb + TX_POLARITY_FLIP: 0x05 + ? + PC_PM_ID: 32 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x62735140 + TX_LANE_MAP: 0x52736140 + RX_POLARITY_FLIP: 0x3a + TX_POLARITY_FLIP: 0x3a + ? + PC_PM_ID: 33 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x26371504 + TX_LANE_MAP: 0x25371604 + RX_POLARITY_FLIP: 0x0a + TX_POLARITY_FLIP: 0xca + ? + PC_PM_ID: 34 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x37260415 + TX_LANE_MAP: 0x40617352 + RX_POLARITY_FLIP: 0x0a + TX_POLARITY_FLIP: 0xf5 + ? + PC_PM_ID: 35 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x73624051 + TX_LANE_MAP: 0x73524061 + RX_POLARITY_FLIP: 0x0a + TX_POLARITY_FLIP: 0x0a + ? + PC_PM_ID: 36 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x51406273 + TX_LANE_MAP: 0x52406173 + RX_POLARITY_FLIP: 0xc5 + TX_POLARITY_FLIP: 0x35 + ? + PC_PM_ID: 37 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x34152607 + TX_LANE_MAP: 0x43527061 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xff + ? + PC_PM_ID: 38 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x52437061 + TX_LANE_MAP: 0x04153726 + RX_POLARITY_FLIP: 0x51 + TX_POLARITY_FLIP: 0xab + ? + PC_PM_ID: 39 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x25340716 + TX_LANE_MAP: 0x15042637 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xaa + ? + PC_PM_ID: 40 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x34251607 + TX_LANE_MAP: 0x40517362 + RX_POLARITY_FLIP: 0xaa + TX_POLARITY_FLIP: 0xaa + ? + PC_PM_ID: 41 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x25340716 + TX_LANE_MAP: 0x15072634 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xfb + ? + PC_PM_ID: 42 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x34521670 + TX_LANE_MAP: 0x40517362 + RX_POLARITY_FLIP: 0x99 + TX_POLARITY_FLIP: 0x8a + ? + PC_PM_ID: 43 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x15340726 + TX_LANE_MAP: 0x15042637 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xaa + ? + PC_PM_ID: 44 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x43526170 + TX_LANE_MAP: 0x40517362 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xaa + ? + PC_PM_ID: 45 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x25340716 + TX_LANE_MAP: 0x15042637 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xaa + ? + PC_PM_ID: 46 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x43526170 + TX_LANE_MAP: 0x40517362 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xaa + ? + PC_PM_ID: 47 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x25340716 + TX_LANE_MAP: 0x15042637 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xaa + ? + PC_PM_ID: 48 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x34527160 + TX_LANE_MAP: 0x51406273 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xaa + ? + PC_PM_ID: 49 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x43516270 + TX_LANE_MAP: 0x41507362 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xfa + ? + PC_PM_ID: 50 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x53416270 + TX_LANE_MAP: 0x51406273 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0xfa + ? + PC_PM_ID: 51 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x14350726 + TX_LANE_MAP: 0x05142637 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0x0a + ? + PC_PM_ID: 52 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x35241607 + TX_LANE_MAP: 0x04153726 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0x0a + ? + PC_PM_ID: 53 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x25340716 + TX_LANE_MAP: 0x14053726 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0x0a + ? + PC_PM_ID: 54 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x32451706 + TX_LANE_MAP: 0x15042637 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0x0a + ? + PC_PM_ID: 55 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x45320716 + TX_LANE_MAP: 0x14053726 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0x0a + ? + PC_PM_ID: 56 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x24351706 + TX_LANE_MAP: 0x04152637 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0x0a + ? + PC_PM_ID: 57 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x34251607 + TX_LANE_MAP: 0x14053726 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0x0a + ? + PC_PM_ID: 58 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x34251607 + TX_LANE_MAP: 0x04153726 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0x0a + ? + PC_PM_ID: 59 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x34251607 + TX_LANE_MAP: 0x14053726 + RX_POLARITY_FLIP: 0x55 + TX_POLARITY_FLIP: 0x0a + ? + PC_PM_ID: 60 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x34251607 + TX_LANE_MAP: 0x24351706 + RX_POLARITY_FLIP: 0x57 + TX_POLARITY_FLIP: 0xa0 + ? + PC_PM_ID: 61 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x51406273 + TX_LANE_MAP: 0x51406273 + RX_POLARITY_FLIP: 0xf5 + TX_POLARITY_FLIP: 0x35 + ? + PC_PM_ID: 62 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x62735140 + TX_LANE_MAP: 0x43627051 + RX_POLARITY_FLIP: 0x0a + TX_POLARITY_FLIP: 0x0a + ? + PC_PM_ID: 63 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x26371504 + TX_LANE_MAP: 0x40517362 + RX_POLARITY_FLIP: 0x0a + TX_POLARITY_FLIP: 0xf5 + ? + PC_PM_ID: 64 + CORE_INDEX: 0 + : + RX_LANE_MAP_AUTO: 0 + TX_LANE_MAP_AUTO: 0 + RX_POLARITY_FLIP_AUTO: 0 + TX_POLARITY_FLIP_AUTO: 0 + RX_LANE_MAP: 0x26371504 + TX_LANE_MAP: 0x26371504 + RX_POLARITY_FLIP: 0x0a + TX_POLARITY_FLIP: 0xca +... +--- +device: + 0: + PC_PORT_PHYS_MAP: + ? + # CPU port + PORT_ID: 0 + : + PC_PHYS_PORT_ID: 0 + ? + PORT_ID: 1 + : + PC_PHYS_PORT_ID: 1 + ? + PORT_ID: 5 + : + PC_PHYS_PORT_ID: 5 + ? + PORT_ID: 9 + : + PC_PHYS_PORT_ID: 9 + ? + PORT_ID: 13 + : + PC_PHYS_PORT_ID: 13 + ? + PORT_ID: 17 + : + PC_PHYS_PORT_ID: 17 + ? + PORT_ID: 21 + : + PC_PHYS_PORT_ID: 21 + ? + PORT_ID: 25 + : + PC_PHYS_PORT_ID: 25 + ? + PORT_ID: 29 + : + PC_PHYS_PORT_ID: 29 + ? + PORT_ID: 34 + : + PC_PHYS_PORT_ID: 33 + ? + PORT_ID: 38 + : + PC_PHYS_PORT_ID: 37 + ? + PORT_ID: 42 + : + PC_PHYS_PORT_ID: 41 + ? + PORT_ID: 46 + : + PC_PHYS_PORT_ID: 45 + ? + PORT_ID: 51 + : + PC_PHYS_PORT_ID: 49 + ? + PORT_ID: 55 + : + PC_PHYS_PORT_ID: 53 + ? + PORT_ID: 59 + : + PC_PHYS_PORT_ID: 57 + ? + PORT_ID: 63 + : + PC_PHYS_PORT_ID: 61 + ? + PORT_ID: 68 + : + PC_PHYS_PORT_ID: 65 + ? + PORT_ID: 72 + : + PC_PHYS_PORT_ID: 69 + ? + PORT_ID: 76 + : + PC_PHYS_PORT_ID: 73 + ? + PORT_ID: 80 + : + PC_PHYS_PORT_ID: 77 + ? + PORT_ID: 85 + : + PC_PHYS_PORT_ID: 81 + ? + PORT_ID: 89 + : + PC_PHYS_PORT_ID: 85 + ? + PORT_ID: 93 + : + PC_PHYS_PORT_ID: 89 + ? + PORT_ID: 97 + : + PC_PHYS_PORT_ID: 93 + ? + PORT_ID: 102 + : + PC_PHYS_PORT_ID: 97 + ? + PORT_ID: 106 + : + PC_PHYS_PORT_ID: 101 + ? + PORT_ID: 110 + : + PC_PHYS_PORT_ID: 105 + ? + PORT_ID: 114 + : + PC_PHYS_PORT_ID: 109 + ? + PORT_ID: 119 + : + PC_PHYS_PORT_ID: 113 + ? + PORT_ID: 123 + : + PC_PHYS_PORT_ID: 117 + ? + PORT_ID: 127 + : + PC_PHYS_PORT_ID: 121 + ? + PORT_ID: 131 + : + PC_PHYS_PORT_ID: 125 + ? + PORT_ID: 136 + : + PC_PHYS_PORT_ID: 129 + ? + PORT_ID: 140 + : + PC_PHYS_PORT_ID: 133 + ? + PORT_ID: 144 + : + PC_PHYS_PORT_ID: 137 + ? + PORT_ID: 148 + : + PC_PHYS_PORT_ID: 141 + ? + PORT_ID: 153 + : + PC_PHYS_PORT_ID: 145 + ? + PORT_ID: 157 + : + PC_PHYS_PORT_ID: 149 + ? + PORT_ID: 161 + : + PC_PHYS_PORT_ID: 153 + ? + PORT_ID: 165 + : + PC_PHYS_PORT_ID: 157 + ? + PORT_ID: 170 + : + PC_PHYS_PORT_ID: 161 + ? + PORT_ID: 174 + : + PC_PHYS_PORT_ID: 165 + ? + PORT_ID: 178 + : + PC_PHYS_PORT_ID: 169 + ? + PORT_ID: 182 + : + PC_PHYS_PORT_ID: 173 + ? + PORT_ID: 187 + : + PC_PHYS_PORT_ID: 177 + ? + PORT_ID: 191 + : + PC_PHYS_PORT_ID: 181 + ? + PORT_ID: 195 + : + PC_PHYS_PORT_ID: 185 + ? + PORT_ID: 199 + : + PC_PHYS_PORT_ID: 189 + ? + PORT_ID: 204 + : + PC_PHYS_PORT_ID: 193 + ? + PORT_ID: 208 + : + PC_PHYS_PORT_ID: 197 + ? + PORT_ID: 212 + : + PC_PHYS_PORT_ID: 201 + ? + PORT_ID: 216 + : + PC_PHYS_PORT_ID: 205 + ? + PORT_ID: 221 + : + PC_PHYS_PORT_ID: 209 + ? + PORT_ID: 225 + : + PC_PHYS_PORT_ID: 213 + ? + PORT_ID: 229 + : + PC_PHYS_PORT_ID: 217 + ? + PORT_ID: 233 + : + PC_PHYS_PORT_ID: 221 + ? + PORT_ID: 238 + : + PC_PHYS_PORT_ID: 225 + ? + PORT_ID: 242 + : + PC_PHYS_PORT_ID: 229 + ? + PORT_ID: 246 + : + PC_PHYS_PORT_ID: 233 + ? + PORT_ID: 250 + : + PC_PHYS_PORT_ID: 237 + ? + PORT_ID: 255 + : + PC_PHYS_PORT_ID: 241 + ? + PORT_ID: 259 + : + PC_PHYS_PORT_ID: 245 + ? + PORT_ID: 263 + : + PC_PHYS_PORT_ID: 249 + ? + PORT_ID: 267 + : + PC_PHYS_PORT_ID: 253 + ? + PORT_ID: 50 + : + PC_PHYS_PORT_ID: 258 + ? + PORT_ID: 152 + : + PC_PHYS_PORT_ID: 257 +... +--- +device: + 0: + PC_PORT: + ? + PORT_ID: 0 + : + &port_mode_10g + ENABLE: 1 + SPEED: 10000 + NUM_LANES: 1 + ? + PORT_ID: [1, 5, 9, 13, + 17, 21, 25, 29, + 34, 38, 42, 46, + 51, 55, 59, 63, + 68, 72, 76, 80, + 85, 89, 93, 97, + 102, 106, 110, 114, + 119, 123, 127, 131, + 136, 140, 144, 148, + 153, 157, 161, 165, + 170, 174, 178, 182, + 187, 191, 195, 199, + 204, 208, 212, 216, + 221, 225, 229, 233, + 238, 242, 246, 250, + 255, 259, 263, 267] + : + ENABLE: 0 + SPEED: 100000 + NUM_LANES: 4 + FEC_MODE: PC_FEC_RS528 + MAX_FRAME_SIZE: 9416 + LINK_TRAINING: 0 + ? # BCM56990 2x10g management port + PORT_ID: [50, 152] + : + ENABLE: 0 + SPEED: 10000 + NUM_LANES: 1 + MAX_FRAME_SIZE: 9416 + SER_CONFIG: + SER_ENABLE: 0 + PORT_CONFIG: + PORT_SYSTEM_PROFILE_OPERMODE_PIPEUNIQUE: 1 +device: + 0: + # Per pipe flex counter configuration + CTR_EFLEX_CONFIG: + CTR_ING_EFLEX_OPERMODE_PIPEUNIQUE: 0 + CTR_EGR_EFLEX_OPERMODE_PIPEUNIQUE: 0 + + # Per pipe flex state configuration + #FLEX_STATE_CONFIG: + # FLEX_STATE_ING_OPERMODE_PIPEUNIQUE: 0 + # FLEX_STATE_EGR_OPERMODE_PIPEUNIQUE: 1 + + # Lossy vs Lossless mode + TM_THD_CONFIG: + THRESHOLD_MODE: LOSSLESS + + # IFP mode + FP_CONFIG: + FP_ING_OPERMODE: GLOBAL_PIPE_AWARE +... diff --git a/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D/hwsku.json b/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D/hwsku.json index 0349f4c963..3456407c94 100644 --- a/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D/hwsku.json +++ b/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D/hwsku.json @@ -4,263 +4,263 @@ "default_brkout_mode": "1x400G" }, - "Ethernet4": { + "Ethernet8": { "default_brkout_mode": "1x400G" }, - "Ethernet8": { + "Ethernet16": { "default_brkout_mode": "1x400G" }, - "Ethernet12": { + "Ethernet24": { "default_brkout_mode": "1x400G" }, - "Ethernet16": { + "Ethernet32": { "default_brkout_mode": "1x400G" }, - "Ethernet20": { + "Ethernet40": { "default_brkout_mode": "1x400G" }, - "Ethernet24": { + "Ethernet48": { "default_brkout_mode": "1x400G" }, - "Ethernet28": { + "Ethernet56": { "default_brkout_mode": "1x400G" }, - "Ethernet32": { + "Ethernet64": { "default_brkout_mode": "1x400G" }, - "Ethernet36": { + "Ethernet72": { "default_brkout_mode": "1x400G" }, - "Ethernet40": { + "Ethernet80": { "default_brkout_mode": "1x400G" }, - "Ethernet44": { + "Ethernet88": { "default_brkout_mode": "1x400G" }, - "Ethernet48": { + "Ethernet96": { "default_brkout_mode": "1x400G" }, - "Ethernet52": { + "Ethernet104": { "default_brkout_mode": "1x400G" }, - "Ethernet56": { + "Ethernet112": { "default_brkout_mode": "1x400G" }, - "Ethernet60": { + "Ethernet120": { "default_brkout_mode": "1x400G" }, - "Ethernet64": { + "Ethernet128": { "default_brkout_mode": "1x400G" }, - "Ethernet68": { + "Ethernet136": { "default_brkout_mode": "1x400G" }, - "Ethernet72": { + "Ethernet144": { "default_brkout_mode": "1x400G" }, - "Ethernet76": { + "Ethernet152": { "default_brkout_mode": "1x400G" }, - "Ethernet80": { + "Ethernet160": { "default_brkout_mode": "1x400G" }, - "Ethernet84": { + "Ethernet168": { "default_brkout_mode": "1x400G" }, - "Ethernet88": { + "Ethernet176": { "default_brkout_mode": "1x400G" }, - "Ethernet92": { + "Ethernet184": { "default_brkout_mode": "1x400G" }, - "Ethernet96": { + "Ethernet192": { "default_brkout_mode": "1x400G" }, - "Ethernet100": { + "Ethernet200": { "default_brkout_mode": "1x400G" }, - "Ethernet104": { + "Ethernet208": { "default_brkout_mode": "1x400G" }, - "Ethernet108": { + "Ethernet216": { "default_brkout_mode": "1x400G" }, - "Ethernet112": { + "Ethernet224": { "default_brkout_mode": "1x400G" }, - "Ethernet116": { + "Ethernet232": { "default_brkout_mode": "1x400G" }, - "Ethernet120": { + "Ethernet240": { "default_brkout_mode": "1x400G" }, - "Ethernet124": { + "Ethernet248": { "default_brkout_mode": "1x400G" }, - "Ethernet128": { + "Ethernet256": { "default_brkout_mode": "1x400G" }, - "Ethernet132": { + "Ethernet264": { "default_brkout_mode": "1x400G" }, - "Ethernet136": { + "Ethernet272": { "default_brkout_mode": "1x400G" }, - "Ethernet140": { + "Ethernet280": { "default_brkout_mode": "1x400G" }, - "Ethernet144": { + "Ethernet288": { "default_brkout_mode": "1x400G" }, - "Ethernet148": { + "Ethernet296": { "default_brkout_mode": "1x400G" }, - "Ethernet152": { + "Ethernet304": { "default_brkout_mode": "1x400G" }, - "Ethernet156": { + "Ethernet312": { "default_brkout_mode": "1x400G" }, - "Ethernet160": { + "Ethernet320": { "default_brkout_mode": "1x400G" }, - "Ethernet164": { + "Ethernet328": { "default_brkout_mode": "1x400G" }, - "Ethernet168": { + "Ethernet336": { "default_brkout_mode": "1x400G" }, - "Ethernet172": { + "Ethernet344": { "default_brkout_mode": "1x400G" }, - "Ethernet176": { + "Ethernet352": { "default_brkout_mode": "1x400G" }, - "Ethernet180": { + "Ethernet360": { "default_brkout_mode": "1x400G" }, - "Ethernet184": { + "Ethernet368": { "default_brkout_mode": "1x400G" }, - "Ethernet188": { + "Ethernet376": { "default_brkout_mode": "1x400G" }, - "Ethernet192": { + "Ethernet384": { "default_brkout_mode": "1x400G" }, - "Ethernet196": { + "Ethernet392": { "default_brkout_mode": "1x400G" }, - "Ethernet200": { + "Ethernet400": { "default_brkout_mode": "1x400G" }, - "Ethernet204": { + "Ethernet408": { "default_brkout_mode": "1x400G" }, - "Ethernet208": { + "Ethernet416": { "default_brkout_mode": "1x400G" }, - "Ethernet212": { + "Ethernet424": { "default_brkout_mode": "1x400G" }, - "Ethernet216": { + "Ethernet432": { "default_brkout_mode": "1x400G" }, - "Ethernet220": { + "Ethernet440": { "default_brkout_mode": "1x400G" }, - "Ethernet224": { + "Ethernet448": { "default_brkout_mode": "1x400G" }, - "Ethernet228": { + "Ethernet456": { "default_brkout_mode": "1x400G" }, - "Ethernet232": { + "Ethernet464": { "default_brkout_mode": "1x400G" }, - "Ethernet236": { + "Ethernet472": { "default_brkout_mode": "1x400G" }, - "Ethernet240": { + "Ethernet480": { "default_brkout_mode": "1x400G" }, - "Ethernet244": { + "Ethernet488": { "default_brkout_mode": "1x400G" }, - "Ethernet248": { + "Ethernet496": { "default_brkout_mode": "1x400G" }, - "Ethernet252": { + "Ethernet504": { "default_brkout_mode": "1x400G" }, - "Ethernet256": { + "Ethernet512": { "default_brkout_mode": "1x10G[1G]" }, - "Ethernet257": { + "Ethernet513": { "default_brkout_mode": "1x10G[1G]" } } diff --git a/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D/port_config.ini b/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D/port_config.ini index 9eb04592b6..5907dc49d9 100644 --- a/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D/port_config.ini +++ b/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D/port_config.ini @@ -1,67 +1,67 @@ -# name lanes alias index speed -Ethernet0 65,66,67,68 Eth1(Port1) 1 400000 -Ethernet4 69,70,71,72 Eth2(Port2) 2 400000 -Ethernet8 73,74,75,76 Eth3(Port3) 3 400000 -Ethernet12 77,78,79,80 Eth4(Port4) 4 400000 -Ethernet16 81,82,83,84 Eth5(Port5) 5 400000 -Ethernet20 85,86,87,88 Eth6(Port6) 6 400000 -Ethernet24 89,90,91,92 Eth7(Port7) 7 400000 -Ethernet28 93,94,95,96 Eth8(Port8) 8 400000 -Ethernet32 97,98,99,100 Eth9(Port9) 9 400000 -Ethernet36 101,102,103,104 Eth10(Port10) 10 400000 -Ethernet40 125,126,127,128 Eth11(Port11) 11 400000 -Ethernet44 121,122,123,124 Eth12(Port12) 12 400000 -Ethernet48 113,114,115,116 Eth13(Port13) 13 400000 -Ethernet52 117,118,119,120 Eth14(Port14) 14 400000 -Ethernet56 109,110,111,112 Eth15(Port15) 15 400000 -Ethernet60 105,106,107,108 Eth16(Port16) 16 400000 -Ethernet64 145,146,147,148 Eth17(Port17) 17 400000 -Ethernet68 149,150,151,152 Eth18(Port18) 18 400000 -Ethernet72 141,142,143,144 Eth19(Port19) 19 400000 -Ethernet76 137,138,139,140 Eth20(Port20) 20 400000 -Ethernet80 129,130,131,132 Eth21(Port21) 21 400000 -Ethernet84 133,134,135,136 Eth22(Port22) 22 400000 -Ethernet88 153,154,155,156 Eth23(Port23) 23 400000 -Ethernet92 157,158,159,160 Eth24(Port24) 24 400000 -Ethernet96 161,162,163,164 Eth25(Port25) 25 400000 -Ethernet100 165,166,167,168 Eth26(Port26) 26 400000 -Ethernet104 169,170,171,172 Eth27(Port27) 27 400000 -Ethernet108 173,174,175,176 Eth28(Port28) 28 400000 -Ethernet112 177,178,179,180 Eth29(Port29) 29 400000 -Ethernet116 181,182,183,184 Eth30(Port30) 30 400000 -Ethernet120 185,186,187,188 Eth31(Port31) 31 400000 -Ethernet124 189,190,191,192 Eth32(Port32) 32 400000 -Ethernet128 49,50,51,52 Eth33(Port33) 33 400000 -Ethernet132 53,54,55,56 Eth34(Port34) 34 400000 -Ethernet136 57,58,59,60 Eth35(Port35) 35 400000 -Ethernet140 61,62,63,64 Eth36(Port36) 36 400000 -Ethernet144 29,30,31,32 Eth37(Port37) 37 400000 -Ethernet148 33,34,35,36 Eth38(Port38) 38 400000 -Ethernet152 25,26,27,28 Eth39(Port39) 39 400000 -Ethernet156 41,42,43,44 Eth40(Port40) 40 400000 -Ethernet160 21,22,23,24 Eth41(Port41) 41 400000 -Ethernet164 37,38,39,40 Eth42(Port42) 42 400000 -Ethernet168 17,18,19,20 Eth43(Port43) 43 400000 -Ethernet172 45,46,47,48 Eth44(Port44) 44 400000 -Ethernet176 13,14,15,16 Eth45(Port45) 45 400000 -Ethernet180 9,10,11,12 Eth46(Port46) 46 400000 -Ethernet184 1,2,3,4 Eth47(Port47) 47 400000 -Ethernet188 5,6,7,8 Eth48(Port48) 48 400000 -Ethernet192 249,250,251,252 Eth49(Port49) 49 400000 -Ethernet196 253,254,255,256 Eth50(Port50) 50 400000 -Ethernet200 245,246,247,248 Eth51(Port51) 51 400000 -Ethernet204 241,242,243,244 Eth52(Port52) 52 400000 -Ethernet208 237,238,239,240 Eth53(Port53) 53 400000 -Ethernet212 209,210,211,212 Eth54(Port54) 54 400000 -Ethernet216 233,234,235,236 Eth55(Port55) 55 400000 -Ethernet220 217,218,219,220 Eth56(Port56) 56 400000 -Ethernet224 229,230,231,232 Eth57(Port57) 57 400000 -Ethernet228 213,214,215,216 Eth58(Port58) 58 400000 -Ethernet232 225,226,227,228 Eth59(Port59) 59 400000 -Ethernet236 221,222,223,224 Eth60(Port60) 60 400000 -Ethernet240 193,194,195,196 Eth61(Port61) 61 400000 -Ethernet244 201,202,203,204 Eth62(Port62) 62 400000 -Ethernet248 197,198,199,200 Eth63(Port63) 63 400000 -Ethernet252 205,206,207,208 Eth64(Port64) 64 400000 -Ethernet256 257 Eth65(Port65) 65 10000 -Ethernet257 258 Eth66(Port66) 66 10000 +# name lanes alias index speed +Ethernet0 130,131,132,133,134,135,136,137 Eth1(Port1) 1 400000 +Ethernet8 138,139,140,141,142,143,144,145 Eth2(Port2) 2 400000 +Ethernet16 146,147,148,149,150,151,152,153 Eth3(Port3) 3 400000 +Ethernet24 154,155,156,157,158,159,160,161 Eth4(Port4) 4 400000 +Ethernet32 162,163,164,165,166,167,168,169 Eth5(Port5) 5 400000 +Ethernet40 170,171,172,173,174,175,176,177 Eth6(Port6) 6 400000 +Ethernet48 178,179,180,181,182,183,184,185 Eth7(Port7) 7 400000 +Ethernet56 186,187,188,189,190,191,192,193 Eth8(Port8) 8 400000 +Ethernet64 194,195,196,197,198,199,200,201 Eth9(Port9) 9 400000 +Ethernet72 202,203,204,205,206,207,208,209 Eth10(Port10) 10 400000 +Ethernet80 250,251,252,253,254,255,256,257 Eth11(Port11) 11 400000 +Ethernet88 242,243,244,245,246,247,248,249 Eth12(Port12) 12 400000 +Ethernet96 226,227,228,229,230,231,232,233 Eth13(Port13) 13 400000 +Ethernet104 234,235,236,237,238,239,240,241 Eth14(Port14) 14 400000 +Ethernet112 218,219,220,221,222,223,224,225 Eth15(Port15) 15 400000 +Ethernet120 210,211,212,213,214,215,216,217 Eth16(Port16) 16 400000 +Ethernet128 290,291,292,293,294,295,296,297 Eth17(Port17) 17 400000 +Ethernet136 298,299,300,301,302,303,304,305 Eth18(Port18) 18 400000 +Ethernet144 282,283,284,285,286,287,288,289 Eth19(Port19) 19 400000 +Ethernet152 274,275,276,277,278,279,280,281 Eth20(Port20) 20 400000 +Ethernet160 258,259,260,261,262,263,264,265 Eth21(Port21) 21 400000 +Ethernet168 266,267,268,269,270,271,272,273 Eth22(Port22) 22 400000 +Ethernet176 306,307,308,309,310,311,312,313 Eth23(Port23) 23 400000 +Ethernet184 314,315,316,317,318,319,320,321 Eth24(Port24) 24 400000 +Ethernet192 322,323,324,325,326,327,328,329 Eth25(Port25) 25 400000 +Ethernet200 330,331,332,333,334,335,336,337 Eth26(Port26) 26 400000 +Ethernet208 338,339,340,341,342,343,344,345 Eth27(Port27) 27 400000 +Ethernet216 346,347,348,349,350,351,352,353 Eth28(Port28) 28 400000 +Ethernet224 354,355,356,357,358,359,360,361 Eth29(Port29) 29 400000 +Ethernet232 362,363,364,365,366,367,368,369 Eth30(Port30) 30 400000 +Ethernet240 370,371,372,373,374,375,376,377 Eth31(Port31) 31 400000 +Ethernet248 378,379,380,381,382,383,384,385 Eth32(Port32) 32 400000 +Ethernet256 98,99,100,101,102,103,104,105 Eth33(Port33) 33 400000 +Ethernet264 106,107,108,109,110,111,112,113 Eth34(Port34) 34 400000 +Ethernet272 114,115,116,117,118,119,120,121 Eth35(Port35) 35 400000 +Ethernet280 122,123,124,125,126,127,128,129 Eth36(Port36) 36 400000 +Ethernet288 58,59,60,61,62,63,64,65 Eth37(Port37) 37 400000 +Ethernet296 66,67,68,69,70,71,72,73 Eth38(Port38) 38 400000 +Ethernet304 50,51,52,53,54,55,56,57 Eth39(Port39) 39 400000 +Ethernet312 82,83,84,85,86,87,88,89 Eth40(Port40) 40 400000 +Ethernet320 42,43,44,45,46,47,48,49 Eth41(Port41) 41 400000 +Ethernet328 74,75,76,77,78,79,80,81 Eth42(Port42) 42 400000 +Ethernet336 34,35,36,37,38,39,40,41 Eth43(Port43) 43 400000 +Ethernet344 90,91,92,93,94,95,96,97 Eth44(Port44) 44 400000 +Ethernet352 26,27,28,29,30,31,32,33 Eth45(Port45) 45 400000 +Ethernet360 18,19,20,21,22,23,24,25 Eth46(Port46) 46 400000 +Ethernet368 2,3,4,5,6,7,8,9 Eth47(Port47) 47 400000 +Ethernet376 10,11,12,13,14,15,16,17 Eth48(Port48) 48 400000 +Ethernet384 498,499,500,501,502,503,504,505 Eth49(Port49) 49 400000 +Ethernet392 506,507,508,509,510,511,512,513 Eth50(Port50) 50 400000 +Ethernet400 490,491,492,493,494,495,496,497 Eth51(Port51) 51 400000 +Ethernet408 482,483,484,485,486,487,488,489 Eth52(Port52) 52 400000 +Ethernet416 474,475,476,477,478,479,480,481 Eth53(Port53) 53 400000 +Ethernet424 418,419,420,421,422,423,424,425 Eth54(Port54) 54 400000 +Ethernet432 466,467,468,469,470,471,472,473 Eth55(Port55) 55 400000 +Ethernet440 434,435,436,437,438,439,440,441 Eth56(Port56) 56 400000 +Ethernet448 458,459,460,461,462,463,464,465 Eth57(Port57) 57 400000 +Ethernet456 426,427,428,429,430,431,432,433 Eth58(Port58) 58 400000 +Ethernet464 450,451,452,453,454,455,456,457 Eth59(Port59) 59 400000 +Ethernet472 442,443,444,445,446,447,448,449 Eth60(Port60) 60 400000 +Ethernet480 386,387,388,389,390,391,392,393 Eth61(Port61) 61 400000 +Ethernet488 402,403,404,405,406,407,408,409 Eth62(Port62) 62 400000 +Ethernet496 394,395,396,397,398,399,400,401 Eth63(Port63) 63 400000 +Ethernet504 410,411,412,413,414,415,416,417 Eth64(Port64) 64 400000 +Ethernet512 514 Eth65(Port65) 65 10000 +Ethernet513 516 Eth66(Port66) 66 10000 diff --git a/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D/th4-as9736-64x400G.config.yml b/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D/th4-as9736-64x400G.config.yml index fcf2245b04..6e2b59f8ee 100644 --- a/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D/th4-as9736-64x400G.config.yml +++ b/device/accton/x86_64-accton_as9736_64d-r0/Accton-AS9736-64D/th4-as9736-64x400G.config.yml @@ -11,30 +11,21 @@ bcm_device: 0: global: - pktio_mode: 1 - vlan_flooding_l2mc_num_reserved: 0 - ipv6_lpm_128b_enable: 1 - shared_block_mask_section: uc_bc - skip_protocol_default_entries: 1 - # LTSW uses value 1 for ALPM combined mode - l3_alpm_template: 1 - l3_alpm_hit_skip: 1 - sai_feat_tail_timestamp : 1 - sai_field_group_auto_prioritize: 1 - #l3_intf_vlan_split_egress for MTU at L3IF - l3_intf_vlan_split_egress : 1 - pfc_deadlock_seq_control : 1 - sai_tunnel_support: 2 - bcm_tunnel_term_compatible_mode: 1 - l3_ecmp_member_first_lkup_mem_size: 12288 - sai_port_pmap_phy_lanes : 1 - sai_disable_ports_when_sw_shutdown: 1 + pktio_mode: 1 + rx_cosq_mapping_management_mode: 1 + vlan_default_port: 3 + l3_alpm_template: 1 + port_allow_tpid_disable: 1 + riot_overlay_l3_intf_mem_size: 4096 + riot_overlay_l3_egress_mem_size: 8192 + l3_ecmp_member_first_lkup_mem_size: 8192 + l3_intf_vlan_split_egress: 1 ... --- bcm_device: 0: global: - dport_map_enable: 1 + dport_map_enable: 0 port: 68: { dport_map_port: 1 } 72: { dport_map_port: 2 } @@ -878,341 +869,322 @@ device: ... --- device: - 0: - PC_PORT_PHYS_MAP: - ? - # CPU port - PORT_ID: 0 - : - PC_PHYS_PORT_ID: 0 - ? - PORT_ID: 1 - : - PC_PHYS_PORT_ID: 1 - ? - PORT_ID: 5 - : - PC_PHYS_PORT_ID: 5 - ? - PORT_ID: 9 - : - PC_PHYS_PORT_ID: 9 - ? - PORT_ID: 13 - : - PC_PHYS_PORT_ID: 13 - ? - PORT_ID: 17 - : - PC_PHYS_PORT_ID: 17 - ? - PORT_ID: 21 - : - PC_PHYS_PORT_ID: 21 - ? - PORT_ID: 25 - : - PC_PHYS_PORT_ID: 25 - ? - PORT_ID: 29 - : - PC_PHYS_PORT_ID: 29 - ? - PORT_ID: 34 - : - PC_PHYS_PORT_ID: 33 - ? - PORT_ID: 38 - : - PC_PHYS_PORT_ID: 37 - ? - PORT_ID: 42 - : - PC_PHYS_PORT_ID: 41 - ? - PORT_ID: 46 - : - PC_PHYS_PORT_ID: 45 - ? - PORT_ID: 51 - : - PC_PHYS_PORT_ID: 49 - ? - PORT_ID: 55 - : - PC_PHYS_PORT_ID: 53 - ? - PORT_ID: 59 - : - PC_PHYS_PORT_ID: 57 - ? - PORT_ID: 63 - : - PC_PHYS_PORT_ID: 61 - ? - PORT_ID: 68 - : - PC_PHYS_PORT_ID: 65 - ? - PORT_ID: 72 - : - PC_PHYS_PORT_ID: 69 - ? - PORT_ID: 76 - : - PC_PHYS_PORT_ID: 73 - ? - PORT_ID: 80 - : - PC_PHYS_PORT_ID: 77 - ? - PORT_ID: 85 - : - PC_PHYS_PORT_ID: 81 - ? - PORT_ID: 89 - : - PC_PHYS_PORT_ID: 85 - ? - PORT_ID: 93 - : - PC_PHYS_PORT_ID: 89 - ? - PORT_ID: 97 - : - PC_PHYS_PORT_ID: 93 - ? - PORT_ID: 102 - : - PC_PHYS_PORT_ID: 97 - ? - PORT_ID: 106 - : - PC_PHYS_PORT_ID: 101 - ? - PORT_ID: 110 - : - PC_PHYS_PORT_ID: 105 - ? - PORT_ID: 114 - : - PC_PHYS_PORT_ID: 109 - ? - PORT_ID: 119 - : - PC_PHYS_PORT_ID: 113 - ? - PORT_ID: 123 - : - PC_PHYS_PORT_ID: 117 - ? - PORT_ID: 127 - : - PC_PHYS_PORT_ID: 121 - ? - PORT_ID: 131 - : - PC_PHYS_PORT_ID: 125 - ? - PORT_ID: 136 - : - PC_PHYS_PORT_ID: 129 - ? - PORT_ID: 140 - : - PC_PHYS_PORT_ID: 133 - ? - PORT_ID: 144 - : - PC_PHYS_PORT_ID: 137 - ? - PORT_ID: 148 - : - PC_PHYS_PORT_ID: 141 - ? - PORT_ID: 153 - : - PC_PHYS_PORT_ID: 145 - ? - PORT_ID: 157 - : - PC_PHYS_PORT_ID: 149 - ? - PORT_ID: 161 - : - PC_PHYS_PORT_ID: 153 - ? - PORT_ID: 165 - : - PC_PHYS_PORT_ID: 157 - ? - PORT_ID: 170 - : - PC_PHYS_PORT_ID: 161 - ? - PORT_ID: 174 - : - PC_PHYS_PORT_ID: 165 - ? - PORT_ID: 178 - : - PC_PHYS_PORT_ID: 169 - ? - PORT_ID: 182 - : - PC_PHYS_PORT_ID: 173 - ? - PORT_ID: 187 - : - PC_PHYS_PORT_ID: 177 - ? - PORT_ID: 191 - : - PC_PHYS_PORT_ID: 181 - ? - PORT_ID: 195 - : - PC_PHYS_PORT_ID: 185 - ? - PORT_ID: 199 - : - PC_PHYS_PORT_ID: 189 - ? - PORT_ID: 204 - : - PC_PHYS_PORT_ID: 193 - ? - PORT_ID: 208 - : - PC_PHYS_PORT_ID: 197 - ? - PORT_ID: 212 - : - PC_PHYS_PORT_ID: 201 - ? - PORT_ID: 216 - : - PC_PHYS_PORT_ID: 205 - ? - PORT_ID: 221 - : - PC_PHYS_PORT_ID: 209 - ? - PORT_ID: 225 - : - PC_PHYS_PORT_ID: 213 - ? - PORT_ID: 229 - : - PC_PHYS_PORT_ID: 217 - ? - PORT_ID: 233 - : - PC_PHYS_PORT_ID: 221 - ? - PORT_ID: 238 - : - PC_PHYS_PORT_ID: 225 - ? - PORT_ID: 242 - : - PC_PHYS_PORT_ID: 229 - ? - PORT_ID: 246 - : - PC_PHYS_PORT_ID: 233 - ? - PORT_ID: 250 - : - PC_PHYS_PORT_ID: 237 - ? - PORT_ID: 255 - : - PC_PHYS_PORT_ID: 241 - ? - PORT_ID: 259 - : - PC_PHYS_PORT_ID: 245 - ? - PORT_ID: 263 - : - PC_PHYS_PORT_ID: 249 - ? - PORT_ID: 267 - : - PC_PHYS_PORT_ID: 253 - ? - PORT_ID: 50 - : - PC_PHYS_PORT_ID: 258 - ? - PORT_ID: 152 - : - PC_PHYS_PORT_ID: 257 + 0: + PC_PORT_PHYS_MAP: + ? + PORT_ID: 0 + : + PC_PHYS_PORT_ID: 0 + ? + PORT_ID: 1 + : + PC_PHYS_PORT_ID: 1 + ? + PORT_ID: 5 + : + PC_PHYS_PORT_ID: 5 + ? + PORT_ID: 9 + : + PC_PHYS_PORT_ID: 9 + ? + PORT_ID: 13 + : + PC_PHYS_PORT_ID: 13 + ? + PORT_ID: 17 + : + PC_PHYS_PORT_ID: 17 + ? + PORT_ID: 21 + : + PC_PHYS_PORT_ID: 21 + ? + PORT_ID: 25 + : + PC_PHYS_PORT_ID: 25 + ? + PORT_ID: 29 + : + PC_PHYS_PORT_ID: 29 + ? + PORT_ID: 34 + : + PC_PHYS_PORT_ID: 33 + ? + PORT_ID: 38 + : + PC_PHYS_PORT_ID: 37 + ? + PORT_ID: 42 + : + PC_PHYS_PORT_ID: 41 + ? + PORT_ID: 46 + : + PC_PHYS_PORT_ID: 45 + ? + PORT_ID: 51 + : + PC_PHYS_PORT_ID: 49 + ? + PORT_ID: 55 + : + PC_PHYS_PORT_ID: 53 + ? + PORT_ID: 59 + : + PC_PHYS_PORT_ID: 57 + ? + PORT_ID: 63 + : + PC_PHYS_PORT_ID: 61 + ? + PORT_ID: 68 + : + PC_PHYS_PORT_ID: 65 + ? + PORT_ID: 72 + : + PC_PHYS_PORT_ID: 69 + ? + PORT_ID: 76 + : + PC_PHYS_PORT_ID: 73 + ? + PORT_ID: 80 + : + PC_PHYS_PORT_ID: 77 + ? + PORT_ID: 85 + : + PC_PHYS_PORT_ID: 81 + ? + PORT_ID: 89 + : + PC_PHYS_PORT_ID: 85 + ? + PORT_ID: 93 + : + PC_PHYS_PORT_ID: 89 + ? + PORT_ID: 97 + : + PC_PHYS_PORT_ID: 93 + ? + PORT_ID: 102 + : + PC_PHYS_PORT_ID: 97 + ? + PORT_ID: 106 + : + PC_PHYS_PORT_ID: 101 + ? + PORT_ID: 110 + : + PC_PHYS_PORT_ID: 105 + ? + PORT_ID: 114 + : + PC_PHYS_PORT_ID: 109 + ? + PORT_ID: 119 + : + PC_PHYS_PORT_ID: 113 + ? + PORT_ID: 123 + : + PC_PHYS_PORT_ID: 117 + ? + PORT_ID: 127 + : + PC_PHYS_PORT_ID: 121 + ? + PORT_ID: 131 + : + PC_PHYS_PORT_ID: 125 + ? + PORT_ID: 136 + : + PC_PHYS_PORT_ID: 129 + ? + PORT_ID: 140 + : + PC_PHYS_PORT_ID: 133 + ? + PORT_ID: 144 + : + PC_PHYS_PORT_ID: 137 + ? + PORT_ID: 148 + : + PC_PHYS_PORT_ID: 141 + ? + PORT_ID: 153 + : + PC_PHYS_PORT_ID: 145 + ? + PORT_ID: 157 + : + PC_PHYS_PORT_ID: 149 + ? + PORT_ID: 161 + : + PC_PHYS_PORT_ID: 153 + ? + PORT_ID: 165 + : + PC_PHYS_PORT_ID: 157 + ? + PORT_ID: 170 + : + PC_PHYS_PORT_ID: 161 + ? + PORT_ID: 174 + : + PC_PHYS_PORT_ID: 165 + ? + PORT_ID: 178 + : + PC_PHYS_PORT_ID: 169 + ? + PORT_ID: 182 + : + PC_PHYS_PORT_ID: 173 + ? + PORT_ID: 187 + : + PC_PHYS_PORT_ID: 177 + ? + PORT_ID: 191 + : + PC_PHYS_PORT_ID: 181 + ? + PORT_ID: 195 + : + PC_PHYS_PORT_ID: 185 + ? + PORT_ID: 199 + : + PC_PHYS_PORT_ID: 189 + ? + PORT_ID: 204 + : + PC_PHYS_PORT_ID: 193 + ? + PORT_ID: 208 + : + PC_PHYS_PORT_ID: 197 + ? + PORT_ID: 212 + : + PC_PHYS_PORT_ID: 201 + ? + PORT_ID: 216 + : + PC_PHYS_PORT_ID: 205 + ? + PORT_ID: 221 + : + PC_PHYS_PORT_ID: 209 + ? + PORT_ID: 225 + : + PC_PHYS_PORT_ID: 213 + ? + PORT_ID: 229 + : + PC_PHYS_PORT_ID: 217 + ? + PORT_ID: 233 + : + PC_PHYS_PORT_ID: 221 + ? + PORT_ID: 238 + : + PC_PHYS_PORT_ID: 225 + ? + PORT_ID: 242 + : + PC_PHYS_PORT_ID: 229 + ? + PORT_ID: 246 + : + PC_PHYS_PORT_ID: 233 + ? + PORT_ID: 250 + : + PC_PHYS_PORT_ID: 237 + ? + PORT_ID: 255 + : + PC_PHYS_PORT_ID: 241 + ? + PORT_ID: 259 + : + PC_PHYS_PORT_ID: 245 + ? + PORT_ID: 263 + : + PC_PHYS_PORT_ID: 249 + ? + PORT_ID: 267 + : + PC_PHYS_PORT_ID: 253 + ? + PORT_ID: 50 + : + PC_PHYS_PORT_ID: 258 + ? + PORT_ID: 152 + : + PC_PHYS_PORT_ID: 257 ... --- device: - 0: - PC_PORT: - ? - PORT_ID: 0 - : - &port_mode_10g - ENABLE: 1 - SPEED: 10000 - NUM_LANES: 1 - ? - PORT_ID: [1, 5, 9, 13, - 17, 21, 25, 29, - 34, 38, 42, 46, - 51, 55, 59, 63, - 68, 72, 76, 80, - 85, 89, 93, 97, - 102, 106, 110, 114, - 119, 123, 127, 131, - 136, 140, 144, 148, - 153, 157, 161, 165, - 170, 174, 178, 182, - 187, 191, 195, 199, - 204, 208, 212, 216, - 221, 225, 229, 233, - 238, 242, 246, 250, - 255, 259, 263, 267] - : - ENABLE: 0 - SPEED: 400000 - NUM_LANES: 8 - FEC_MODE: PC_FEC_RS544_2XN - MAX_FRAME_SIZE: 9416 - LINK_TRAINING: 0 - ? # BCM56990 2x10g management port - PORT_ID: [50, 152] - : - ENABLE: 0 - SPEED: 10000 - NUM_LANES: 1 - MAX_FRAME_SIZE: 9416 - SER_CONFIG: - SER_ENABLE: 0 - PORT_CONFIG: - PORT_SYSTEM_PROFILE_OPERMODE_PIPEUNIQUE: 1 -device: - 0: - # Per pipe flex counter configuration - CTR_EFLEX_CONFIG: - CTR_ING_EFLEX_OPERMODE_PIPEUNIQUE: 0 - CTR_EGR_EFLEX_OPERMODE_PIPEUNIQUE: 0 - - # Per pipe flex state configuration - #FLEX_STATE_CONFIG: - # FLEX_STATE_ING_OPERMODE_PIPEUNIQUE: 0 - # FLEX_STATE_EGR_OPERMODE_PIPEUNIQUE: 1 - - # Lossy vs Lossless mode - TM_THD_CONFIG: - THRESHOLD_MODE: LOSSLESS + 0: + PC_PORT: + ? + PORT_ID: [50, 152] + : + ENABLE: 0 + SPEED: 10000 + NUM_LANES: 1 + FEC_MODE: PC_FEC_NONE + ? + PORT_ID: 0 + : + ENABLE: 1 + SPEED: 10000 + NUM_LANES: 1 + FEC_MODE: PC_FEC_NONE + ? + PORT_ID: [1, 5, 9, 13, 17, 21, 25, 29, 34, 38, 42, 46, 51, 55, 59, 63, 68, 72, 76, 80, 85, 89, 93, 97, 102, 106, 110, 114, 119, 123, 127, 131, 136, 140, 144, 148, 153, 157, 161, 165, 170, 174, 178, 182, 187, 191, 195, 199, 204, 208, 212, 216, 221, 225, 229, 233, 238, 242, 246, 250, 255, 259, 263, 267] + : + ENABLE: 0 + SPEED: 400000 + NUM_LANES: 8 + FEC_MODE: PC_FEC_RS544_2XN - # IFP mode - FP_CONFIG: - FP_ING_OPERMODE: GLOBAL_PIPE_AWARE + PC_PMD_FIRMWARE: + ? + PORT_ID: [1, 5, 9, 13, 17, 21, 25, 29, 34, 38, 42, 46, 51, 55, 59, 63, 68, 72, 76, 80, 85, 89, 93, 97, 102, 106, 110, 114, 119, 123, 127, 131, 136, 140, 144, 148, 153, 157, 161, 165, 170, 174, 178, 182, 187, 191, 195, 199, 204, 208, 212, 216, 221, 225, 229, 233, 238, 242, 246, 250, 255, 259, 263, 267] + : + MEDIUM_TYPE_AUTO: 0 + MEDIUM_TYPE: PC_PHY_MEDIUM_COPPER ... +--- +device: + 0: + TM_THD_CONFIG: + THRESHOLD_MODE: LOSSLESS +... +--- +device: + 0: + FP_CONFIG: + FP_ING_OPERMODE: GLOBAL_PIPE_AWARE + FP_CONTROL: + FP_ING_ARP_AS_IP: 1 + FP_ING_RARP_AS_IP: 1 +... \ No newline at end of file diff --git a/device/accton/x86_64-accton_as9736_64d-r0/installer.conf b/device/accton/x86_64-accton_as9736_64d-r0/installer.conf new file mode 100644 index 0000000000..17f1ce1e8b --- /dev/null +++ b/device/accton/x86_64-accton_as9736_64d-r0/installer.conf @@ -0,0 +1,4 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="intel_iommu=off pcie_aspm=off" diff --git a/device/accton/x86_64-accton_as9736_64d-r0/pcie.yaml b/device/accton/x86_64-accton_as9736_64d-r0/pcie.yaml new file mode 100644 index 0000000000..3fb058f7c8 --- /dev/null +++ b/device/accton/x86_64-accton_as9736_64d-r0/pcie.yaml @@ -0,0 +1,507 @@ +- bus: '00' + dev: '00' + fn: '0' + id: 6f00 + name: 'Host bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D DMI2 + (rev 03)' +- bus: '00' + dev: '01' + fn: '0' + id: 6f02 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 1 (rev 03)' +- bus: '00' + dev: '02' + fn: '0' + id: 6f04 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 2 (rev 03)' +- bus: '00' + dev: '02' + fn: '2' + id: 6f06 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 2 (rev 03)' +- bus: '00' + dev: '03' + fn: '0' + id: 6f08 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 3 (rev 03)' +- bus: '00' + dev: '03' + fn: '1' + id: 6f09 + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 3 (rev 03)' +- bus: '00' + dev: '03' + fn: '2' + id: 6f0a + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 3 (rev 03)' +- bus: '00' + dev: '03' + fn: '3' + id: 6f0b + name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI + Express Root Port 3 (rev 03)' +- bus: '00' + dev: '05' + fn: '0' + id: 6f28 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Map/VTd_Misc/System Management (rev 03)' +- bus: '00' + dev: '05' + fn: '1' + id: 6f29 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D IIO Hot Plug (rev 03)' +- bus: '00' + dev: '05' + fn: '2' + id: 6f2a + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D IIO RAS/Control Status/Global Errors (rev 03)' +- bus: '00' + dev: '05' + fn: '4' + id: 6f2c + name: 'PIC: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D I/O APIC (rev + 03)' +- bus: '00' + dev: '14' + fn: '0' + id: 8c31 + name: 'USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB + xHCI (rev 05)' +- bus: '00' + dev: '16' + fn: '0' + id: 8c3a + name: 'Communication controller: Intel Corporation 8 Series/C220 Series Chipset + Family MEI Controller #1 (rev 04)' +- bus: '00' + dev: '16' + fn: '1' + id: 8c3b + name: 'Communication controller: Intel Corporation 8 Series/C220 Series Chipset + Family MEI Controller #2 (rev 04)' +- bus: '00' + dev: 1c + fn: '0' + id: 8c10 + name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express + Root Port #1 (rev d5)' +- bus: '00' + dev: 1c + fn: '7' + id: 8c1e + name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express + Root Port #8 (rev d5)' +- bus: '00' + dev: 1d + fn: '0' + id: 8c26 + name: 'USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB + EHCI #1 (rev 05)' +- bus: '00' + dev: 1f + fn: '0' + id: 8c54 + name: 'ISA bridge: Intel Corporation C224 Series Chipset Family Server Standard + SKU LPC Controller (rev 05)' +- bus: '00' + dev: 1f + fn: '2' + id: 8c02 + name: 'SATA controller: Intel Corporation 8 Series/C220 Series Chipset Family 6-port + SATA Controller 1 [AHCI mode] (rev 05)' +- bus: '00' + dev: 1f + fn: '3' + id: 8c22 + name: 'SMBus: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller + (rev 05)' +- bus: '02' + dev: '00' + fn: '0' + id: 6f50 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 0' +- bus: '02' + dev: '00' + fn: '1' + id: 6f51 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 1' +- bus: '02' + dev: '00' + fn: '2' + id: 6f52 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 2' +- bus: '02' + dev: '00' + fn: '3' + id: 6f53 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 3' +- bus: '03' + dev: '00' + fn: '0' + id: 15ab + name: 'Ethernet controller: Intel Corporation Ethernet Connection X552 10 GbE Backplane' +- bus: '03' + dev: '00' + fn: '1' + id: 15ab + name: 'Ethernet controller: Intel Corporation Ethernet Connection X552 10 GbE Backplane' +- bus: '05' + dev: '00' + fn: '0' + id: b404 + name: 'PCI bridge: Pericom Semiconductor Device b404 (rev 01)' +- bus: '06' + dev: '01' + fn: '0' + id: b404 + name: 'PCI bridge: Pericom Semiconductor Device b404 (rev 01)' +- bus: '06' + dev: '02' + fn: '0' + id: b404 + name: 'PCI bridge: Pericom Semiconductor Device b404 (rev 01)' +- bus: '06' + dev: '03' + fn: '0' + id: b404 + name: 'PCI bridge: Pericom Semiconductor Device b404 (rev 01)' +- bus: '07' + dev: '00' + fn: '0' + id: '8664' + name: 'Class 2080: Accton Technology Corporation Device 8664' +- bus: 08 + dev: '00' + fn: '0' + id: '8664' + name: 'Class 2080: Accton Technology Corporation Device 8664' +- bus: 09 + dev: '00' + fn: '0' + id: '8664' + name: 'Class 2080: Accton Technology Corporation Device 8664' +- bus: 0a + dev: '00' + fn: '0' + id: b990 + name: 'Ethernet controller: Broadcom Inc. and subsidiaries BCM56990 Switch ASIC + (rev 11)' +- bus: 0e + dev: '00' + fn: '0' + id: '1533' + name: 'Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev + 03)' +- bus: ff + dev: 0b + fn: '0' + id: 6f81 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link 0/1 (rev 03)' +- bus: ff + dev: 0b + fn: '1' + id: 6f36 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link 0/1 (rev 03)' +- bus: ff + dev: 0b + fn: '2' + id: 6f37 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link 0/1 (rev 03)' +- bus: ff + dev: 0b + fn: '3' + id: 6f76 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R3 QPI Link Debug (rev 03)' +- bus: ff + dev: 0c + fn: '0' + id: 6fe0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0c + fn: '1' + id: 6fe1 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0c + fn: '2' + id: 6fe2 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0c + fn: '3' + id: 6fe3 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0c + fn: '4' + id: 6fe4 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0c + fn: '5' + id: 6fe5 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0c + fn: '6' + id: 6fe6 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0c + fn: '7' + id: 6fe7 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '0' + id: 6ff8 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '4' + id: 6ffc + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '5' + id: 6ffd + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: 0f + fn: '6' + id: 6ffe + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Caching Agent (rev 03)' +- bus: ff + dev: '10' + fn: '0' + id: 6f1d + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R2PCIe Agent (rev 03)' +- bus: ff + dev: '10' + fn: '1' + id: 6f34 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D R2PCIe Agent (rev 03)' +- bus: ff + dev: '10' + fn: '5' + id: 6f1e + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Ubox (rev 03)' +- bus: ff + dev: '10' + fn: '6' + id: 6f7d + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Ubox (rev 03)' +- bus: ff + dev: '10' + fn: '7' + id: 6f1f + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Ubox (rev 03)' +- bus: ff + dev: '12' + fn: '0' + id: 6fa0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Home Agent 0 (rev 03)' +- bus: ff + dev: '12' + fn: '1' + id: 6f30 + name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Home Agent 0 (rev 03)' +- bus: ff + dev: '13' + fn: '0' + id: 6fa8 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Target Address/Thermal/RAS (rev 03)' +- bus: ff + dev: '13' + fn: '1' + id: 6f71 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Target Address/Thermal/RAS (rev 03)' +- bus: ff + dev: '13' + fn: '2' + id: 6faa + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '3' + id: 6fab + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '4' + id: 6fac + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '5' + id: 6fad + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel Target Address Decoder (rev 03)' +- bus: ff + dev: '13' + fn: '6' + id: 6fae + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Broadcast (rev 03)' +- bus: ff + dev: '13' + fn: '7' + id: 6faf + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Global Broadcast (rev 03)' +- bus: ff + dev: '14' + fn: '0' + id: 6fb0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 0 Thermal Control (rev 03)' +- bus: ff + dev: '14' + fn: '1' + id: 6fb1 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 1 Thermal Control (rev 03)' +- bus: ff + dev: '14' + fn: '2' + id: 6fb2 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 0 Error (rev 03)' +- bus: ff + dev: '14' + fn: '3' + id: 6fb3 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 1 Error (rev 03)' +- bus: ff + dev: '14' + fn: '4' + id: 6fbc + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '14' + fn: '5' + id: 6fbd + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '14' + fn: '6' + id: 6fbe + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '14' + fn: '7' + id: 6fbf + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D DDRIO Channel 0/1 Interface (rev 03)' +- bus: ff + dev: '15' + fn: '0' + id: 6fb4 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 2 Thermal Control (rev 03)' +- bus: ff + dev: '15' + fn: '1' + id: 6fb5 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 3 Thermal Control (rev 03)' +- bus: ff + dev: '15' + fn: '2' + id: 6fb6 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 2 Error (rev 03)' +- bus: ff + dev: '15' + fn: '3' + id: 6fb7 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Memory Controller 0 - Channel 3 Error (rev 03)' +- bus: ff + dev: 1e + fn: '0' + id: 6f98 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '1' + id: 6f99 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '2' + id: 6f9a + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '3' + id: 6fc0 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1e + fn: '4' + id: 6f9c + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1f + fn: '0' + id: 6f88 + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' +- bus: ff + dev: 1f + fn: '2' + id: 6f8a + name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon + D Power Control Unit (rev 03)' diff --git a/device/accton/x86_64-accton_as9736_64d-r0/platform.json b/device/accton/x86_64-accton_as9736_64d-r0/platform.json index 40a90cf35e..7d51a73e50 100644 --- a/device/accton/x86_64-accton_as9736_64d-r0/platform.json +++ b/device/accton/x86_64-accton_as9736_64d-r0/platform.json @@ -34,34 +34,61 @@ ], "fans": [ { - "name": "FAN-1F" + "name": "FAN-1F", + "status_led": { + "controllable": false + } }, { - "name": "FAN-1R" + "name": "FAN-1R", + "status_led": { + "controllable": false + } }, { - "name": "FAN-2F" + "name": "FAN-2F", + "status_led": { + "controllable": false + } }, { - "name": "FAN-2R" + "name": "FAN-2R", + "status_led": { + "controllable": false + } }, { - "name": "FAN-3F" + "name": "FAN-3F", + "status_led": { + "controllable": false + } }, { - "name": "FAN-3R" + "name": "FAN-3R", + "status_led": { + "controllable": false + } }, { - "name": "FAN-4F" + "name": "FAN-4F", + "status_led": { + "controllable": false + } }, { - "name": "FAN-4R" + "name": "FAN-4R", + "status_led": { + "controllable": false + } } ], "fan_drawers":[ { "name": "FanTray1", "num_fans" : 2, + "status_led": { + "controllable": false + }, "fans": [ { "name": "FAN-1F" @@ -74,6 +101,9 @@ { "name": "FanTray2", "num_fans" : 2, + "status_led": { + "controllable": false + }, "fans": [ { "name": "FAN-2F" @@ -86,6 +116,9 @@ { "name": "FanTray3", "num_fans" : 2, + "status_led": { + "controllable": false + }, "fans": [ { "name": "FAN-3F" @@ -98,6 +131,9 @@ { "name": "FanTray4", "num_fans" : 2, + "status_led": { + "controllable": false + }, "fans": [ { "name": "FAN-4F" @@ -158,7 +194,7 @@ ], "thermals": [ { - "name": "Temp sensor 1", + "name": "SMB_RearMiddle_temp(0x48)", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -166,7 +202,7 @@ "high-crit-threshold": true }, { - "name": "Temp sensor 2", + "name": "SMB_FrontMiddle_temp(0x49)", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -174,7 +210,7 @@ "high-crit-threshold": true }, { - "name": "Temp sensor 3", + "name": "SMB_LeftMiddle_temp(0x4C)", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -182,7 +218,7 @@ "high-crit-threshold": true }, { - "name": "Temp sensor 4", + "name": "FCM_Center_temp(0x48)", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -190,7 +226,7 @@ "high-crit-threshold": true }, { - "name": "Temp sensor 5", + "name": "FCM_Left_temp(0x49)", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -198,7 +234,7 @@ "high-crit-threshold": true }, { - "name": "Temp sensor 6", + "name": "PDB-L_temp(0x48)", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -206,7 +242,7 @@ "high-crit-threshold": true }, { - "name": "Temp sensor 7", + "name": "PDB-R_temp(0x49)", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -214,7 +250,7 @@ "high-crit-threshold": true }, { - "name": "Temp sensor 8", + "name": "UDB_RearLeft_temp(0x48)", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -222,7 +258,7 @@ "high-crit-threshold": true }, { - "name": "Temp sensor 9", + "name": "UDB_RearMiddle_temp(0x4C)", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -230,7 +266,7 @@ "high-crit-threshold": true }, { - "name": "Temp sensor 10", + "name": "LDB_FrontRight_temp(0x4C)", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -238,7 +274,7 @@ "high-crit-threshold": true }, { - "name": "Temp sensor 11", + "name": "LDB_RearRight_temp(0x4D)", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -246,7 +282,7 @@ "high-crit-threshold": true }, { - "name": "CPU Package Temp", + "name": "CPU_Package_temp", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -254,7 +290,7 @@ "high-crit-threshold": true }, { - "name": "CPU Core 0 Temp", + "name": "CPU_Core_0_temp", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -262,7 +298,7 @@ "high-crit-threshold": true }, { - "name": "CPU Core 1 Temp", + "name": "CPU_Core_1_temp", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -270,7 +306,7 @@ "high-crit-threshold": true }, { - "name": "CPU Core 2 Temp", + "name": "CPU_Core_2_temp", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -278,7 +314,7 @@ "high-crit-threshold": true }, { - "name": "CPU Core 3 Temp", + "name": "CPU_Core_3_temp", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -286,7 +322,7 @@ "high-crit-threshold": true }, { - "name": "CPU Core 4 Temp", + "name": "CPU_Core_4_temp", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -294,7 +330,7 @@ "high-crit-threshold": true }, { - "name": "CPU Core 5 Temp", + "name": "CPU_Core_5_temp", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -302,7 +338,7 @@ "high-crit-threshold": true }, { - "name": "CPU Core 6 Temp", + "name": "CPU_Core_6_temp", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -310,7 +346,7 @@ "high-crit-threshold": true }, { - "name": "CPU Core 7 Temp", + "name": "CPU_Core_7_temp", "controllable": true, "low-threshold": false, "high-threshold": true, @@ -323,1051 +359,1049 @@ "name": "Ethernet0" }, { - "name": "Ethernet4" + "name": "Ethernet8" }, { - "name": "Ethernet8" + "name": "Ethernet16" }, { - "name": "Ethernet12" + "name": "Ethernet24" }, { - "name": "Ethernet16" + "name": "Ethernet32" }, { - "name": "Ethernet20" + "name": "Ethernet40" }, { - "name": "Ethernet24" + "name": "Ethernet48" }, { - "name": "Ethernet28" + "name": "Ethernet56" }, { - "name": "Ethernet32" + "name": "Ethernet64" }, { - "name": "Ethernet36" + "name": "Ethernet72" }, { - "name": "Ethernet40" + "name": "Ethernet80" }, { - "name": "Ethernet44" + "name": "Ethernet88" }, { - "name": "Ethernet48" + "name": "Ethernet96" }, { - "name": "Ethernet52" + "name": "Ethernet104" }, { - "name": "Ethernet56" + "name": "Ethernet112" }, { - "name": "Ethernet60" + "name": "Ethernet120" }, { - "name": "Ethernet64" + "name": "Ethernet128" }, { - "name": "Ethernet68" + "name": "Ethernet136" }, { - "name": "Ethernet72" + "name": "Ethernet144" }, { - "name": "Ethernet76" + "name": "Ethernet152" }, { - "name": "Ethernet80" + "name": "Ethernet160" }, { - "name": "Ethernet84" + "name": "Ethernet168" }, { - "name": "Ethernet88" + "name": "Ethernet176" }, { - "name": "Ethernet92" + "name": "Ethernet184" }, { - "name": "Ethernet96" + "name": "Ethernet192" }, { - "name": "Ethernet100" + "name": "Ethernet200" }, { - "name": "Ethernet104" + "name": "Ethernet208" }, { - "name": "Ethernet108" + "name": "Ethernet216" }, { - "name": "Ethernet112" + "name": "Ethernet224" }, { - "name": "Ethernet116" + "name": "Ethernet232" }, { - "name": "Ethernet120" + "name": "Ethernet240" }, { - "name": "Ethernet124" + "name": "Ethernet248" }, { - "name": "Ethernet128" + "name": "Ethernet256" }, { - "name": "Ethernet132" + "name": "Ethernet264" }, { - "name": "Ethernet136" + "name": "Ethernet272" }, { - "name": "Ethernet140" + "name": "Ethernet280" }, { - "name": "Ethernet144" + "name": "Ethernet288" }, { - "name": "Ethernet148" + "name": "Ethernet296" }, { - "name": "Ethernet152" + "name": "Ethernet304" }, { - "name": "Ethernet156" + "name": "Ethernet312" }, { - "name": "Ethernet160" + "name": "Ethernet320" }, { - "name": "Ethernet164" + "name": "Ethernet328" }, { - "name": "Ethernet168" + "name": "Ethernet336" }, { - "name": "Ethernet172" + "name": "Ethernet344" }, { - "name": "Ethernet176" + "name": "Ethernet352" }, { - "name": "Ethernet180" + "name": "Ethernet360" }, { - "name": "Ethernet184" + "name": "Ethernet368" }, { - "name": "Ethernet188" + "name": "Ethernet376" }, { - "name": "Ethernet192" + "name": "Ethernet384" }, { - "name": "Ethernet196" + "name": "Ethernet392" }, { - "name": "Ethernet200" + "name": "Ethernet400" }, { - "name": "Ethernet204" + "name": "Ethernet408" }, { - "name": "Ethernet208" + "name": "Ethernet416" }, { - "name": "Ethernet212" + "name": "Ethernet424" }, { - "name": "Ethernet216" + "name": "Ethernet432" }, { - "name": "Ethernet220" + "name": "Ethernet440" }, { - "name": "Ethernet224" + "name": "Ethernet448" }, { - "name": "Ethernet228" + "name": "Ethernet456" }, { - "name": "Ethernet232" + "name": "Ethernet464" }, { - "name": "Ethernet236" + "name": "Ethernet472" }, { - "name": "Ethernet240" + "name": "Ethernet480" }, { - "name": "Ethernet244" + "name": "Ethernet488" }, { - "name": "Ethernet248" + "name": "Ethernet496" }, { - "name": "Ethernet252" + "name": "Ethernet504" }, { - "name": "Ethernet256" + "name": "Ethernet512" }, { - "name": "Ethernet257" + "name": "Ethernet513" } ] }, "interfaces": { "Ethernet0": { - "index": "1,1,1,1", - "lanes": "65,66,67,68", + "index": "1,1,1,1,1,1,1,1", + "lanes": "130,131,132,133,134,135,136,137", "breakout_modes": { "1x400G": ["Eth1(Port1)"], "2x200G": ["Eth1/1(Port1)", "Eth1/2(Port1)"], "4x100G": ["Eth1/1(Port1)", "Eth1/2(Port1)", "Eth1/3(Port1)", "Eth1/4(Port1)"], - "1x100G[40G](2)": ["Eth1(Port1)"], - "2x50G(2)": ["Eth1/1(Port1)", "Eth1/2(Port1)"], - "4x25G[10G]": ["Eth1/1(Port1)", "Eth1/2(Port1)", "Eth1/3(Port1)", "Eth1/4(Port1)"] + "1x100G[40G](4)": ["Eth1(Port1)"], + "2x50G(4)": ["Eth1/1(Port1)", "Eth1/2(Port1)"], + "4x25G[10G](4)": ["Eth1/1(Port1)", "Eth1/2(Port1)", "Eth1/3(Port1)", "Eth1/4(Port1)"] } }, - "Ethernet4": { - "index": "2,2,2,2", - "lanes": "69,70,71,72", + "Ethernet8": { + "index": "2,2,2,2,2,2,2,2", + "lanes": "138,139,140,141,142,143,144,145", "breakout_modes": { "1x400G": ["Eth2(Port2)"], "2x200G": ["Eth2/1(Port2)", "Eth2/2(Port2)"], "4x100G": ["Eth2/1(Port2)", "Eth2/2(Port2)", "Eth2/3(Port2)", "Eth2/4(Port2)"], - "1x100G[40G](2)": ["Eth2(Port2)"], - "2x50G(2)": ["Eth2/1(Port2)", "Eth2/2(Port2)"], - "4x25G[10G]": ["Eth2/1(Port2)", "Eth2/2(Port2)", "Eth2/3(Port2)", "Eth2/4(Port2)"] + "1x100G[40G](4)": ["Eth2(Port2)"], + "2x50G(4)": ["Eth2/1(Port2)", "Eth2/2(Port2)"], + "4x25G[10G](4)": ["Eth2/1(Port2)", "Eth2/2(Port2)", "Eth2/3(Port2)", "Eth2/4(Port2)"] } }, - "Ethernet8": { - "index": "3,3,3,3", - "lanes": "73,74,75,76", + "Ethernet16": { + "index": "3,3,3,3,3,3,3,3", + "lanes": "146,147,148,149,150,151,152,153", "breakout_modes": { "1x400G": ["Eth3(Port3)"], "2x200G": ["Eth3/1(Port3)", "Eth3/2(Port3)"], "4x100G": ["Eth3/1(Port3)", "Eth3/2(Port3)", "Eth3/3(Port3)", "Eth3/4(Port3)"], - "1x100G[40G](2)": ["Eth3(Port3)"], - "2x50G(2)": ["Eth3/1(Port3)", "Eth3/2(Port3)"], - "4x25G[10G]": ["Eth3/1(Port3)", "Eth3/2(Port3)", "Eth3/3(Port3)", "Eth3/4(Port3)"] + "1x100G[40G](4)": ["Eth3(Port3)"], + "2x50G(4)": ["Eth3/1(Port3)", "Eth3/2(Port3)"], + "4x25G[10G](4)": ["Eth3/1(Port3)", "Eth3/2(Port3)", "Eth3/3(Port3)", "Eth3/4(Port3)"] } }, - "Ethernet12": { - "index": "4,4,4,4", - "lanes": "77,78,79,80", + "Ethernet24": { + "index": "4,4,4,4,4,4,4,4", + "lanes": "154,155,156,157,158,159,160,161", "breakout_modes": { "1x400G": ["Eth4(Port4)"], "2x200G": ["Eth4/1(Port4)", "Eth4/2(Port4)"], "4x100G": ["Eth4/1(Port4)", "Eth4/2(Port4)", "Eth4/3(Port4)", "Eth4/4(Port4)"], - "1x100G[40G](2)": ["Eth4(Port4)"], - "2x50G(2)": ["Eth4/1(Port4)", "Eth4/2(Port4)"], - "4x25G[10G]": ["Eth4/1(Port4)", "Eth4/2(Port4)", "Eth4/3(Port4)", "Eth4/4(Port4)"] + "1x100G[40G](4)": ["Eth4(Port4)"], + "2x50G(4)": ["Eth4/1(Port4)", "Eth4/2(Port4)"], + "4x25G[10G](4)": ["Eth4/1(Port4)", "Eth4/2(Port4)", "Eth4/3(Port4)", "Eth4/4(Port4)"] } }, - - "Ethernet16": { - "index": "5,5,5,5", - "lanes": "81,82,83,84", + + "Ethernet32": { + "index": "5,5,5,5,5,5,5,5", + "lanes": "162,163,164,165,166,167,168,169", "breakout_modes": { "1x400G": ["Eth5(Port5)"], "2x200G": ["Eth5/1(Port5)", "Eth5/2(Port5)"], "4x100G": ["Eth5/1(Port5)", "Eth5/2(Port5)", "Eth5/3(Port5)", "Eth5/4(Port5)"], - "1x100G[40G](2)": ["Eth5(Port5)"], - "2x50G(2)": ["Eth5/1(Port5)", "Eth5/2(Port5)"], - "4x25G[10G]": ["Eth5/1(Port5)", "Eth5/2(Port5)", "Eth5/3(Port5)", "Eth5/4(Port5)"] + "1x100G[40G](4)": ["Eth5(Port5)"], + "2x50G(4)": ["Eth5/1(Port5)", "Eth5/2(Port5)"], + "4x25G[10G](4)": ["Eth5/1(Port5)", "Eth5/2(Port5)", "Eth5/3(Port5)", "Eth5/4(Port5)"] } }, - - "Ethernet20": { - "index": "6,6,6,6", - "lanes": "85,86,87,88", - "breakout_modes": { + + "Ethernet40": { + "index": "6,6,6,6,6,6,6,6", + "lanes": "170,171,172,173,174,175,176,177", + "breakout_modes": { "1x400G": ["Eth6(Port6)"], "2x200G": ["Eth6/1(Port6)", "Eth6/2(Port6)"], "4x100G": ["Eth6/1(Port6)", "Eth6/2(Port6)", "Eth6/3(Port6)", "Eth6/4(Port6)"], - "1x100G[40G](2)": ["Eth6(Port6)"], - "2x50G(2)": ["Eth6/1(Port6)", "Eth6/2(Port6)"], - "4x25G[10G]": ["Eth6/1(Port6)", "Eth6/2(Port6)", "Eth6/3(Port6)", "Eth6/4(Port6)"] + "1x100G[40G](4)": ["Eth6(Port6)"], + "2x50G(4)": ["Eth6/1(Port6)", "Eth6/2(Port6)"], + "4x25G[10G](4)": ["Eth6/1(Port6)", "Eth6/2(Port6)", "Eth6/3(Port6)", "Eth6/4(Port6)"] } }, - "Ethernet24": { - "index": "7,7,7,7", - "lanes": "89,90,91,92", - "breakout_modes": { + "Ethernet48": { + "index": "7,7,7,7,7,7,7,7", + "lanes": "178,179,180,181,182,183,184,185", + "breakout_modes": { "1x400G": ["Eth7(Port7)"], "2x200G": ["Eth7/1(Port7)", "Eth7/2(Port7)"], "4x100G": ["Eth7/1(Port7)", "Eth7/2(Port7)", "Eth7/3(Port7)", "Eth7/4(Port7)"], - "1x100G[40G](2)": ["Eth7(Port7)"], - "2x50G(2)": ["Eth7/1(Port7)", "Eth7/2(Port7)"], - "4x25G[10G]": ["Eth7/1(Port7)", "Eth7/2(Port7)", "Eth7/3(Port7)", "Eth7/4(Port7)"] + "1x100G[40G](4)": ["Eth7(Port7)"], + "2x50G(4)": ["Eth7/1(Port7)", "Eth7/2(Port7)"], + "4x25G[10G](4)": ["Eth7/1(Port7)", "Eth7/2(Port7)", "Eth7/3(Port7)", "Eth7/4(Port7)"] } }, - - "Ethernet28": { - "index": "8,8,8,8", - "lanes": "93,94,95,96", + + "Ethernet56": { + "index": "8,8,8,8,8,8,8,8", + "lanes": "186,187,188,189,190,191,192,193", "breakout_modes": { "1x400G": ["Eth8(Port8)"], "2x200G": ["Eth8/1(Port8)", "Eth8/2(Port8)"], "4x100G": ["Eth8/1(Port8)", "Eth8/2(Port8)", "Eth8/3(Port8)", "Eth8/4(Port8)"], - "1x100G[40G](2)": ["Eth8(Port8)"], - "2x50G(2)": ["Eth8/1(Port8)", "Eth8/2(Port8)"], - "4x25G[10G]": ["Eth8/1(Port8)", "Eth8/2(Port8)", "Eth8/3(Port8)", "Eth8/4(Port8)"] + "1x100G[40G](4)": ["Eth8(Port8)"], + "2x50G(4)": ["Eth8/1(Port8)", "Eth8/2(Port8)"], + "4x25G[10G](4)": ["Eth8/1(Port8)", "Eth8/2(Port8)", "Eth8/3(Port8)", "Eth8/4(Port8)"] } }, - "Ethernet32": { - "index": "9,9,9,9", - "lanes": "97,98,99,100", + "Ethernet64": { + "index": "9,9,9,9,9,9,9,9", + "lanes": "194,195,196,197,198,199,200,201", "breakout_modes": { "1x400G": ["Eth9(Port9)"], "2x200G": ["Eth9/1(Port9)", "Eth9/2(Port9)"], "4x100G": ["Eth9/1(Port9)", "Eth9/2(Port9)", "Eth9/3(Port9)", "Eth9/4(Port9)"], - "1x100G[40G](2)": ["Eth9(Port9)"], - "2x50G(2)": ["Eth9/1(Port9)", "Eth9/2(Port9)"], - "4x25G[10G]": ["Eth9/1(Port9)", "Eth9/2(Port9)", "Eth9/3(Port9)", "Eth9/4(Port9)"] + "1x100G[40G](4)": ["Eth9(Port9)"], + "2x50G(4)": ["Eth9/1(Port9)", "Eth9/2(Port9)"], + "4x25G[10G](4)": ["Eth9/1(Port9)", "Eth9/2(Port9)", "Eth9/3(Port9)", "Eth9/4(Port9)"] } }, - - "Ethernet36": { - "index": "10,10,10,10", - "lanes": "101,102,103,104", + + "Ethernet72": { + "index": "10,10,10,10,10,10,10,10", + "lanes": "202,203,204,205,206,207,208,209", "breakout_modes": { "1x400G": ["Eth10(Port10)"], "2x200G": ["Eth10/1(Port10)", "Eth10/2(Port10)"], "4x100G": ["Eth10/1(Port10)", "Eth10/2(Port10)", "Eth10/3(Port10)", "Eth10/4(Port10)"], - "1x100G[40G](2)": ["Eth10(Port10)"], - "2x50G(2)": ["Eth10/1(Port10)", "Eth10/2(Port10)"], - "4x25G[10G]": ["Eth10/1(Port10)", "Eth10/2(Port10)", "Eth10/3(Port10)", "Eth10/4(Port10)"] + "1x100G[40G](4)": ["Eth10(Port10)"], + "2x50G(4)": ["Eth10/1(Port10)", "Eth10/2(Port10)"], + "4x25G[10G](4)": ["Eth10/1(Port10)", "Eth10/2(Port10)", "Eth10/3(Port10)", "Eth10/4(Port10)"] } }, - "Ethernet40": { - "index": "11,11,11,11", - "lanes": "125,126,127,128", + "Ethernet80": { + "index": "11,11,11,11,11,11,11,11", + "lanes": "250,251,252,253,254,255,256,257", "breakout_modes": { "1x400G": ["Eth11(Port11)"], "2x200G": ["Eth11/1(Port11)", "Eth11/2(Port11)"], "4x100G": ["Eth11/1(Port11)", "Eth11/2(Port11)", "Eth11/3(Port11)", "Eth11/4(Port11)"], - "1x100G[40G](2)": ["Eth11(Port11)"], - "2x50G(2)": ["Eth11/1(Port11)", "Eth11/2(Port11)"], - "4x25G[10G]": ["Eth11/1(Port11)", "Eth11/2(Port11)", "Eth11/3(Port11)", "Eth11/4(Port11)"] + "1x100G[40G](4)": ["Eth11(Port11)"], + "2x50G(4)": ["Eth11/1(Port11)", "Eth11/2(Port11)"], + "4x25G[10G](4)": ["Eth11/1(Port11)", "Eth11/2(Port11)", "Eth11/3(Port11)", "Eth11/4(Port11)"] } }, - - "Ethernet44": { - "index": "12,12,12,12", - "lanes": "121,122,123,124", + + "Ethernet88": { + "index": "12,12,12,12,12,12,12,12", + "lanes": "242,243,244,245,246,247,248,249", "breakout_modes": { "1x400G": ["Eth12(Port12)"], "2x200G": ["Eth12/1(Port12)", "Eth12/2(Port12)"], "4x100G": ["Eth12/1(Port12)", "Eth12/2(Port12)", "Eth12/3(Port12)", "Eth12/4(Port12)"], - "1x100G[40G](2)": ["Eth12(Port12)"], - "2x50G(2)": ["Eth12/1(Port12)", "Eth12/2(Port12)"], - "4x25G[10G]": ["Eth12/1(Port12)", "Eth12/2(Port12)", "Eth12/3(Port12)", "Eth12/4(Port12)"] + "1x100G[40G](4)": ["Eth12(Port12)"], + "2x50G(4)": ["Eth12/1(Port12)", "Eth12/2(Port12)"], + "4x25G[10G](4)": ["Eth12/1(Port12)", "Eth12/2(Port12)", "Eth12/3(Port12)", "Eth12/4(Port12)"] } }, - "Ethernet48": { - "index": "13,13,13,13", - "lanes": "113,114,115,116", + "Ethernet96": { + "index": "13,13,13,13,13,13,13,13", + "lanes": "226,227,228,229,230,231,232,233", "breakout_modes": { "1x400G": ["Eth13(Port13)"], "2x200G": ["Eth13/1(Port13)", "Eth13/2(Port13)"], "4x100G": ["Eth13/1(Port13)", "Eth13/2(Port13)", "Eth13/3(Port13)", "Eth13/4(Port13)"], - "1x100G[40G](2)": ["Eth13(Port13)"], - "2x50G(2)": ["Eth13/1(Port13)", "Eth13/2(Port13)"], - "4x25G[10G]": ["Eth13/1(Port13)", "Eth13/2(Port13)", "Eth13/3(Port13)", "Eth13/4(Port13)"] + "1x100G[40G](4)": ["Eth13(Port13)"], + "2x50G(4)": ["Eth13/1(Port13)", "Eth13/2(Port13)"], + "4x25G[10G](4)": ["Eth13/1(Port13)", "Eth13/2(Port13)", "Eth13/3(Port13)", "Eth13/4(Port13)"] } }, - - "Ethernet52": { - "index": "14,14,14,14", - "lanes": "117,118,119,120", + + "Ethernet104": { + "index": "14,14,14,14,14,14,14,14", + "lanes": "234,235,236,237,238,239,240,241", "breakout_modes": { "1x400G": ["Eth14(Port14)"], "2x200G": ["Eth14/1(Port14)", "Eth14/2(Port14)"], "4x100G": ["Eth14/1(Port14)", "Eth14/2(Port14)", "Eth14/3(Port14)", "Eth14/4(Port14)"], - "1x100G[40G](2)": ["Eth14(Port14)"], - "2x50G(2)": ["Eth14/1(Port14)", "Eth14/2(Port14)"], - "4x25G[10G]": ["Eth14/1(Port14)", "Eth14/2(Port14)", "Eth14/3(Port14)", "Eth14/4(Port14)"] + "1x100G[40G](4)": ["Eth14(Port14)"], + "2x50G(4)": ["Eth14/1(Port14)", "Eth14/2(Port14)"], + "4x25G[10G](4)": ["Eth14/1(Port14)", "Eth14/2(Port14)", "Eth14/3(Port14)", "Eth14/4(Port14)"] } }, - "Ethernet56": { - "index": "15,15,15,15", - "lanes": "109,110,111,112", + "Ethernet112": { + "index": "15,15,15,15,15,15,15,15", + "lanes": "218,219,220,221,222,223,224,225", "breakout_modes": { "1x400G": ["Eth15(Port15)"], "2x200G": ["Eth15/1(Port15)", "Eth15/2(Port15)"], "4x100G": ["Eth15/1(Port15)", "Eth15/2(Port15)", "Eth15/3(Port15)", "Eth15/4(Port15)"], - "1x100G[40G](2)": ["Eth15(Port15)"], - "2x50G(2)": ["Eth15/1(Port15)", "Eth15/2(Port15)"], - "4x25G[10G]": ["Eth15/1(Port15)", "Eth15/2(Port15)", "Eth15/3(Port15)", "Eth15/4(Port15)"] + "1x100G[40G](4)": ["Eth15(Port15)"], + "2x50G(4)": ["Eth15/1(Port15)", "Eth15/2(Port15)"], + "4x25G[10G](4)": ["Eth15/1(Port15)", "Eth15/2(Port15)", "Eth15/3(Port15)", "Eth15/4(Port15)"] } }, - - "Ethernet60": { - "index": "16,16,16,16", - "lanes": "105,106,107,108", + + "Ethernet120": { + "index": "16,16,16,16,16,16,16,16", + "lanes": "210,211,212,213,214,215,216,217", "breakout_modes": { "1x400G": ["Eth16(Port16)"], "2x200G": ["Eth16/1(Port16)", "Eth16/2(Port16)"], "4x100G": ["Eth16/1(Port16)", "Eth16/2(Port16)", "Eth16/3(Port16)", "Eth16/4(Port16)"], - "1x100G[40G](2)": ["Eth16(Port16)"], - "2x50G(2)": ["Eth16/1(Port16)", "Eth16/2(Port16)"], - "4x25G[10G]": ["Eth16/1(Port16)", "Eth16/2(Port16)", "Eth16/3(Port16)", "Eth16/4(Port16)"] + "1x100G[40G](4)": ["Eth16(Port16)"], + "2x50G(4)": ["Eth16/1(Port16)", "Eth16/2(Port16)"], + "4x25G[10G](4)": ["Eth16/1(Port16)", "Eth16/2(Port16)", "Eth16/3(Port16)", "Eth16/4(Port16)"] } }, - "Ethernet64": { - "index": "17,17,17,17", - "lanes": "145,146,147,148", + "Ethernet128": { + "index": "17,17,17,17,17,17,17,17", + "lanes": "290,291,292,293,294,295,296,297", "breakout_modes": { "1x400G": ["Eth17(Port17)"], "2x200G": ["Eth17/1(Port17)", "Eth17/2(Port17)"], "4x100G": ["Eth17/1(Port17)", "Eth17/2(Port17)", "Eth17/3(Port17)", "Eth17/4(Port17)"], - "1x100G[40G](2)": ["Eth17(Port17)"], - "2x50G(2)": ["Eth17/1(Port17)", "Eth17/2(Port17)"], - "4x25G[10G]": ["Eth17/1(Port17)", "Eth17/2(Port17)", "Eth17/3(Port17)", "Eth17/4(Port17)"] + "1x100G[40G](4)": ["Eth17(Port17)"], + "2x50G(4)": ["Eth17/1(Port17)", "Eth17/2(Port17)"], + "4x25G[10G](4)": ["Eth17/1(Port17)", "Eth17/2(Port17)", "Eth17/3(Port17)", "Eth17/4(Port17)"] } }, - - "Ethernet68": { - "index": "18,18,18,18", - "lanes": "149,150,151,152", + + "Ethernet136": { + "index": "18,18,18,18,18,18,18,18", + "lanes": "298,299,300,301,302,303,304,305", "breakout_modes": { "1x400G": ["Eth18(Port18)"], "2x200G": ["Eth18/1(Port18)", "Eth18/2(Port18)"], "4x100G": ["Eth18/1(Port18)", "Eth18/2(Port18)", "Eth18/3(Port18)", "Eth18/4(Port18)"], - "1x100G[40G](2)": ["Eth18(Port18)"], - "2x50G(2)": ["Eth18/1(Port18)", "Eth18/2(Port18)"], - "4x25G[10G]": ["Eth18/1(Port18)", "Eth18/2(Port18)", "Eth18/3(Port18)", "Eth18/4(Port18)"] + "1x100G[40G](4)": ["Eth18(Port18)"], + "2x50G(4)": ["Eth18/1(Port18)", "Eth18/2(Port18)"], + "4x25G[10G](4)": ["Eth18/1(Port18)", "Eth18/2(Port18)", "Eth18/3(Port18)", "Eth18/4(Port18)"] } }, - "Ethernet72": { - "index": "19,19,19,19", - "lanes": "141,142,143,144", + "Ethernet144": { + "index": "19,19,19,19,19,19,19,19", + "lanes": "282,283,284,285,286,287,288,289", "breakout_modes": { "1x400G": ["Eth19(Port19)"], "2x200G": ["Eth19/1(Port19)", "Eth19/2(Port19)"], "4x100G": ["Eth19/1(Port19)", "Eth19/2(Port19)", "Eth19/3(Port19)", "Eth19/4(Port19)"], - "1x100G[40G](2)": ["Eth19(Port19)"], - "2x50G(2)": ["Eth19/1(Port19)", "Eth19/2(Port19)"], - "4x25G[10G]": ["Eth19/1(Port19)", "Eth19/2(Port19)", "Eth19/3(Port19)", "Eth19/4(Port19)"] + "1x100G[40G](4)": ["Eth19(Port19)"], + "2x50G(4)": ["Eth19/1(Port19)", "Eth19/2(Port19)"], + "4x25G[10G](4)": ["Eth19/1(Port19)", "Eth19/2(Port19)", "Eth19/3(Port19)", "Eth19/4(Port19)"] } }, - - "Ethernet76": { - "index": "20,20,20,20", - "lanes": "137,138,139,140", + + "Ethernet152": { + "index": "20,20,20,20,20,20,20,20", + "lanes": "274,275,276,277,278,279,280,281", "breakout_modes": { "1x400G": ["Eth20(Port20)"], "2x200G": ["Eth20/1(Port20)", "Eth20/2(Port20)"], "4x100G": ["Eth20/1(Port20)", "Eth20/2(Port20)", "Eth20/3(Port20)", "Eth20/4(Port20)"], - "1x100G[40G](2)": ["Eth20(Port20)"], - "2x50G(2)": ["Eth20/1(Port20)", "Eth20/2(Port20)"], - "4x25G[10G]": ["Eth20/1(Port20)", "Eth20/2(Port20)", "Eth20/3(Port20)", "Eth20/4(Port20)"] + "1x100G[40G](4)": ["Eth20(Port20)"], + "2x50G(4)": ["Eth20/1(Port20)", "Eth20/2(Port20)"], + "4x25G[10G](4)": ["Eth20/1(Port20)", "Eth20/2(Port20)", "Eth20/3(Port20)", "Eth20/4(Port20)"] } }, - "Ethernet80": { - "index": "21,21,21,21", - "lanes": "129,130,131,132", + "Ethernet160": { + "index": "21,21,21,21,21,21,21,21", + "lanes": "258,259,260,261,262,263,264,265", "breakout_modes": { "1x400G": ["Eth21(Port21)"], "2x200G": ["Eth21/1(Port21)", "Eth21/2(Port21)"], "4x100G": ["Eth21/1(Port21)", "Eth21/2(Port21)", "Eth21/3(Port21)", "Eth21/4(Port21)"], - "1x100G[40G](2)": ["Eth21(Port21)"], - "2x50G(2)": ["Eth21/1(Port21)", "Eth21/2(Port21)"], - "4x25G[10G]": ["Eth21/1(Port21)", "Eth21/2(Port21)", "Eth21/3(Port21)", "Eth21/4(Port21)"] + "1x100G[40G](4)": ["Eth21(Port21)"], + "2x50G(4)": ["Eth21/1(Port21)", "Eth21/2(Port21)"], + "4x25G[10G](4)": ["Eth21/1(Port21)", "Eth21/2(Port21)", "Eth21/3(Port21)", "Eth21/4(Port21)"] } }, - - "Ethernet84": { - "index": "22,22,22,22", - "lanes": "133,134,135,136", + + "Ethernet168": { + "index": "22,22,22,22,22,22,22,22", + "lanes": "266,267,268,269,270,271,272,273", "breakout_modes": { "1x400G": ["Eth22(Port22)"], "2x200G": ["Eth22/1(Port22)", "Eth22/2(Port22)"], "4x100G": ["Eth22/1(Port22)", "Eth22/2(Port22)", "Eth22/3(Port22)", "Eth22/4(Port22)"], - "1x100G[40G](2)": ["Eth22(Port22)"], - "2x50G(2)": ["Eth22/1(Port22)", "Eth22/2(Port22)"], - "4x25G[10G]": ["Eth22/1(Port22)", "Eth22/2(Port22)", "Eth22/3(Port22)", "Eth22/4(Port22)"] + "1x100G[40G](4)": ["Eth22(Port22)"], + "2x50G(4)": ["Eth22/1(Port22)", "Eth22/2(Port22)"], + "4x25G[10G](4)": ["Eth22/1(Port22)", "Eth22/2(Port22)", "Eth22/3(Port22)", "Eth22/4(Port22)"] } }, - "Ethernet88": { - "index": "23,23,23,23", - "lanes": "153,154,155,156", + "Ethernet176": { + "index": "23,23,23,23,23,23,23,23", + "lanes": "306,307,308,309,310,311,312,313", "breakout_modes": { "1x400G": ["Eth23(Port23)"], "2x200G": ["Eth23/1(Port23)", "Eth23/2(Port23)"], "4x100G": ["Eth23/1(Port23)", "Eth23/2(Port23)", "Eth23/3(Port23)", "Eth23/4(Port23)"], - "1x100G[40G](2)": ["Eth23(Port23)"], - "2x50G(2)": ["Eth23/1(Port23)", "Eth23/2(Port23)"], - "4x25G[10G]": ["Eth23/1(Port23)", "Eth23/2(Port23)", "Eth23/3(Port23)", "Eth23/4(Port23)"] + "1x100G[40G](4)": ["Eth23(Port23)"], + "2x50G(4)": ["Eth23/1(Port23)", "Eth23/2(Port23)"], + "4x25G[10G](4)": ["Eth23/1(Port23)", "Eth23/2(Port23)", "Eth23/3(Port23)", "Eth23/4(Port23)"] } }, - - "Ethernet92": { - "index": "24,24,24,24", - "lanes": "157,158,159,160", + + "Ethernet184": { + "index": "24,24,24,24,24,24,24,24", + "lanes": "314,315,316,317,318,319,320,321", "breakout_modes": { "1x400G": ["Eth24(Port24)"], "2x200G": ["Eth24/1(Port24)", "Eth24/2(Port24)"], "4x100G": ["Eth24/1(Port24)", "Eth24/2(Port24)", "Eth24/3(Port24)", "Eth24/4(Port24)"], - "1x100G[40G](2)": ["Eth24(Port24)"], - "2x50G(2)": ["Eth24/1(Port24)", "Eth24/2(Port24)"], - "4x25G[10G]": ["Eth24/1(Port24)", "Eth24/2(Port24)", "Eth24/3(Port24)", "Eth24/4(Port24)"] + "1x100G[40G](4)": ["Eth24(Port24)"], + "2x50G(4)": ["Eth24/1(Port24)", "Eth24/2(Port24)"], + "4x25G[10G](4)": ["Eth24/1(Port24)", "Eth24/2(Port24)", "Eth24/3(Port24)", "Eth24/4(Port24)"] } }, - "Ethernet96": { - "index": "25,25,25,25", - "lanes": "161,162,163,164", + "Ethernet192": { + "index": "25,25,25,25,25,25,25,25", + "lanes": "322,323,324,325,326,327,328,329", "breakout_modes": { "1x400G": ["Eth25(Port25)"], "2x200G": ["Eth25/1(Port25)", "Eth25/2(Port25)"], "4x100G": ["Eth25/1(Port25)", "Eth25/2(Port25)", "Eth25/3(Port25)", "Eth25/4(Port25)"], - "1x100G[40G](2)": ["Eth25(Port25)"], - "2x50G(2)": ["Eth25/1(Port25)", "Eth25/2(Port25)"], - "4x25G[10G]": ["Eth25/1(Port25)", "Eth25/2(Port25)", "Eth25/3(Port25)", "Eth25/4(Port25)"] + "1x100G[40G](4)": ["Eth25(Port25)"], + "2x50G(4)": ["Eth25/1(Port25)", "Eth25/2(Port25)"], + "4x25G[10G](4)": ["Eth25/1(Port25)", "Eth25/2(Port25)", "Eth25/3(Port25)", "Eth25/4(Port25)"] } }, - - "Ethernet100": { - "index": "26,26,26,26", - "lanes": "165,166,167,168", + + "Ethernet200": { + "index": "26,26,26,26,26,26,26,26", + "lanes": "330,331,332,333,334,335,336,337", "breakout_modes": { "1x400G": ["Eth26(Port26)"], "2x200G": ["Eth26/1(Port26)", "Eth26/2(Port26)"], "4x100G": ["Eth26/1(Port26)", "Eth26/2(Port26)", "Eth26/3(Port26)", "Eth26/4(Port26)"], - "1x100G[40G](2)": ["Eth26(Port26)"], - "2x50G(2)": ["Eth26/1(Port26)", "Eth26/2(Port26)"], - "4x25G[10G]": ["Eth26/1(Port26)", "Eth26/2(Port26)", "Eth26/3(Port26)", "Eth26/4(Port26)"] + "1x100G[40G](4)": ["Eth26(Port26)"], + "2x50G(4)": ["Eth26/1(Port26)", "Eth26/2(Port26)"], + "4x25G[10G](4)": ["Eth26/1(Port26)", "Eth26/2(Port26)", "Eth26/3(Port26)", "Eth26/4(Port26)"] } }, - "Ethernet104": { - "index": "27,27,27,27", - "lanes": "169,170,171,172", + "Ethernet208": { + "index": "27,27,27,27,27,27,27,27", + "lanes": "338,339,340,341,342,343,344,345", "breakout_modes": { "1x400G": ["Eth27(Port27)"], "2x200G": ["Eth27/1(Port27)", "Eth27/2(Port27)"], "4x100G": ["Eth27/1(Port27)", "Eth27/2(Port27)", "Eth27/3(Port27)", "Eth27/4(Port27)"], - "1x100G[40G](2)": ["Eth27(Port27)"], - "2x50G(2)": ["Eth27/1(Port27)", "Eth27/2(Port27)"], - "4x25G[10G]": ["Eth27/1(Port27)", "Eth27/2(Port27)", "Eth27/3(Port27)", "Eth27/4(Port27)"] + "1x100G[40G](4)": ["Eth27(Port27)"], + "2x50G(4)": ["Eth27/1(Port27)", "Eth27/2(Port27)"], + "4x25G[10G](4)": ["Eth27/1(Port27)", "Eth27/2(Port27)", "Eth27/3(Port27)", "Eth27/4(Port27)"] } }, - - "Ethernet108": { - "index": "28,28,28,28", - "lanes": "173,174,175,176", + + "Ethernet216": { + "index": "28,28,28,28,28,28,28,28", + "lanes": "346,347,348,349,350,351,352,353", "breakout_modes": { "1x400G": ["Eth28(Port28)"], "2x200G": ["Eth28/1(Port28)", "Eth28/2(Port28)"], "4x100G": ["Eth28/1(Port28)", "Eth28/2(Port28)", "Eth28/3(Port28)", "Eth28/4(Port28)"], - "1x100G[40G](2)": ["Eth28(Port28)"], - "2x50G(2)": ["Eth28/1(Port28)", "Eth28/2(Port28)"], - "4x25G[10G]": ["Eth28/1(Port28)", "Eth28/2(Port28)", "Eth28/3(Port28)", "Eth28/4(Port28)"] + "1x100G[40G](4)": ["Eth28(Port28)"], + "2x50G(4)": ["Eth28/1(Port28)", "Eth28/2(Port28)"], + "4x25G[10G](4)": ["Eth28/1(Port28)", "Eth28/2(Port28)", "Eth28/3(Port28)", "Eth28/4(Port28)"] } }, - "Ethernet112": { - "index": "29,29,29,29", - "lanes": "177,178,179,180", + "Ethernet224": { + "index": "29,29,29,29,29,29,29,29", + "lanes": "354,355,356,357,358,359,360,361", "breakout_modes": { "1x400G": ["Eth29(Port29)"], "2x200G": ["Eth29/1(Port29)", "Eth29/2(Port29)"], "4x100G": ["Eth29/1(Port29)", "Eth29/2(Port29)", "Eth29/3(Port29)", "Eth29/4(Port29)"], - "1x100G[40G](2)": ["Eth29(Port29)"], - "2x50G(2)": ["Eth29/1(Port29)", "Eth29/2(Port29)"], - "4x25G[10G]": ["Eth29/1(Port29)", "Eth29/2(Port29)", "Eth29/3(Port29)", "Eth29/4(Port29)"] + "1x100G[40G](4)": ["Eth29(Port29)"], + "2x50G(4)": ["Eth29/1(Port29)", "Eth29/2(Port29)"], + "4x25G[10G](4)": ["Eth29/1(Port29)", "Eth29/2(Port29)", "Eth29/3(Port29)", "Eth29/4(Port29)"] } }, - - "Ethernet116": { - "index": "30,30,30,30", - "lanes": "181,182,183,184", + + "Ethernet232": { + "index": "30,30,30,30,30,30,30,30", + "lanes": "362,363,364,365,366,367,368,369", "breakout_modes": { "1x400G": ["Eth30(Port30)"], "2x200G": ["Eth30/1(Port30)", "Eth30/2(Port30)"], "4x100G": ["Eth30/1(Port30)", "Eth30/2(Port30)", "Eth30/3(Port30)", "Eth30/4(Port30)"], - "1x100G[40G](2)": ["Eth30(Port30)"], - "2x50G(2)": ["Eth30/1(Port30)", "Eth30/2(Port30)"], - "4x25G[10G]": ["Eth30/1(Port30)", "Eth30/2(Port30)", "Eth30/3(Port30)", "Eth30/4(Port30)"] + "1x100G[40G](4)": ["Eth30(Port30)"], + "2x50G(4)": ["Eth30/1(Port30)", "Eth30/2(Port30)"], + "4x25G[10G](4)": ["Eth30/1(Port30)", "Eth30/2(Port30)", "Eth30/3(Port30)", "Eth30/4(Port30)"] } }, - "Ethernet120": { - "index": "31,31,31,31", - "lanes": "185,186,187,188", + "Ethernet240": { + "index": "31,31,31,31,31,31,31,31", + "lanes": "370,371,372,373,374,375,376,377", "breakout_modes": { "1x400G": ["Eth31(Port31)"], "2x200G": ["Eth31/1(Port31)", "Eth31/2(Port31)"], "4x100G": ["Eth31/1(Port31)", "Eth31/2(Port31)", "Eth31/3(Port31)", "Eth31/4(Port31)"], - "1x100G[40G](2)": ["Eth31(Port31)"], - "2x50G(2)": ["Eth31/1(Port31)", "Eth31/2(Port31)"], - "4x25G[10G]": ["Eth31/1(Port31)", "Eth31/2(Port31)", "Eth31/3(Port31)", "Eth31/4(Port31)"] + "1x100G[40G](4)": ["Eth31(Port31)"], + "2x50G(4)": ["Eth31/1(Port31)", "Eth31/2(Port31)"], + "4x25G[10G](4)": ["Eth31/1(Port31)", "Eth31/2(Port31)", "Eth31/3(Port31)", "Eth31/4(Port31)"] } }, - - "Ethernet124": { - "index": "32,32,32,32", - "lanes": "189,190,191,192", + + "Ethernet248": { + "index": "32,32,32,32,32,32,32,32", + "lanes": "378,379,380,381,382,383,384,385", "breakout_modes": { "1x400G": ["Eth32(Port32)"], "2x200G": ["Eth32/1(Port32)", "Eth32/2(Port32)"], "4x100G": ["Eth32/1(Port32)", "Eth32/2(Port32)", "Eth32/3(Port32)", "Eth32/4(Port32)"], - "1x100G[40G](2)": ["Eth32(Port32)"], - "2x50G(2)": ["Eth32/1(Port32)", "Eth32/2(Port32)"], - "4x25G[10G]": ["Eth32/1(Port32)", "Eth32/2(Port32)", "Eth32/3(Port32)", "Eth32/4(Port32)"] + "1x100G[40G](4)": ["Eth32(Port32)"], + "2x50G(4)": ["Eth32/1(Port32)", "Eth32/2(Port32)"], + "4x25G[10G](4)": ["Eth32/1(Port32)", "Eth32/2(Port32)", "Eth32/3(Port32)", "Eth32/4(Port32)"] } }, - - "Ethernet128": { - "index": "33,33,33,33", - "lanes": "49,50,51,52", + "Ethernet256": { + "index": "33,33,33,33,33,33,33,33", + "lanes": "98,99,100,101,102,103,104,105", "breakout_modes": { "1x400G": ["Eth33(Port33)"], "2x200G": ["Eth33/1(Port33)", "Eth33/2(Port33)"], "4x100G": ["Eth33/1(Port33)", "Eth33/2(Port33)", "Eth33/3(Port33)", "Eth33/4(Port33)"], - "1x100G[40G](2)": ["Eth33(Port33)"], - "2x50G(2)": ["Eth33/1(Port33)", "Eth33/2(Port33)"], - "4x25G[10G]": ["Eth33/1(Port33)", "Eth33/2(Port33)", "Eth33/3(Port33)", "Eth33/4(Port33)"] + "1x100G[40G](4)": ["Eth33(Port33)"], + "2x50G(4)": ["Eth33/1(Port33)", "Eth33/2(Port33)"], + "4x25G[10G](4)": ["Eth33/1(Port33)", "Eth33/2(Port33)", "Eth33/3(Port33)", "Eth33/4(Port33)"] } }, - - "Ethernet132": { - "index": "34,34,34,34", - "lanes": "53,54,55,56", + + "Ethernet264": { + "index": "34,34,34,34,34,34,34,34", + "lanes": "106,107,108,109,110,111,112,113", "breakout_modes": { "1x400G": ["Eth34(Port34)"], "2x200G": ["Eth34/1(Port34)", "Eth34/2(Port34)"], "4x100G": ["Eth34/1(Port34)", "Eth34/2(Port34)", "Eth34/3(Port34)", "Eth34/4(Port34)"], - "1x100G[40G](2)": ["Eth34(Port34)"], - "2x50G(2)": ["Eth34/1(Port34)", "Eth34/2(Port34)"], - "4x25G[10G]": ["Eth34/1(Port34)", "Eth34/2(Port34)", "Eth34/3(Port34)", "Eth34/4(Port34)"] + "1x100G[40G](4)": ["Eth34(Port34)"], + "2x50G(4)": ["Eth34/1(Port34)", "Eth34/2(Port34)"], + "4x25G[10G](4)": ["Eth34/1(Port34)", "Eth34/2(Port34)", "Eth34/3(Port34)", "Eth34/4(Port34)"] } }, - "Ethernet136": { - "index": "35,35,35,35", - "lanes": "57,58,59,60", + "Ethernet272": { + "index": "35,35,35,35,35,35,35,35", + "lanes": "114,115,116,117,118,119,120,121", "breakout_modes": { "1x400G": ["Eth35(Port35)"], "2x200G": ["Eth35/1(Port35)", "Eth35/2(Port35)"], "4x100G": ["Eth35/1(Port35)", "Eth35/2(Port35)", "Eth35/3(Port35)", "Eth35/4(Port35)"], - "1x100G[40G](2)": ["Eth35(Port35)"], - "2x50G(2)": ["Eth35/1(Port35)", "Eth35/2(Port35)"], - "4x25G[10G]": ["Eth35/1(Port35)", "Eth35/2(Port35)", "Eth35/3(Port35)", "Eth35/4(Port35)"] + "1x100G[40G](4)": ["Eth35(Port35)"], + "2x50G(4)": ["Eth35/1(Port35)", "Eth35/2(Port35)"], + "4x25G[10G](4)": ["Eth35/1(Port35)", "Eth35/2(Port35)", "Eth35/3(Port35)", "Eth35/4(Port35)"] } }, - - "Ethernet140": { - "index": "36,36,36,36", - "lanes": "61,62,63,64", + + "Ethernet280": { + "index": "36,36,36,36,36,36,36,36", + "lanes": "122,123,124,125,126,127,128,129", "breakout_modes": { "1x400G": ["Eth36(Port36)"], "2x200G": ["Eth36/1(Port36)", "Eth36/2(Port36)"], "4x100G": ["Eth36/1(Port36)", "Eth36/2(Port36)", "Eth36/3(Port36)", "Eth36/4(Port36)"], - "1x100G[40G](2)": ["Eth36(Port36)"], - "2x50G(2)": ["Eth36/1(Port36)", "Eth36/2(Port36)"], - "4x25G[10G]": ["Eth36/1(Port36)", "Eth36/2(Port36)", "Eth36/3(Port36)", "Eth36/4(Port36)"] + "1x100G[40G](4)": ["Eth36(Port36)"], + "2x50G(4)": ["Eth36/1(Port36)", "Eth36/2(Port36)"], + "4x25G[10G](4)": ["Eth36/1(Port36)", "Eth36/2(Port36)", "Eth36/3(Port36)", "Eth36/4(Port36)"] } }, - "Ethernet144": { - "index": "37,37,37,37", - "lanes": "29,30,31,32", + "Ethernet288": { + "index": "37,37,37,37,37,37,37,37", + "lanes": "58,59,60,61,62,63,64,65", "breakout_modes": { "1x400G": ["Eth37(Port37)"], "2x200G": ["Eth37/1(Port37)", "Eth37/2(Port37)"], "4x100G": ["Eth37/1(Port37)", "Eth37/2(Port37)", "Eth37/3(Port37)", "Eth37/4(Port37)"], - "1x100G[40G](2)": ["Eth37(Port37)"], - "2x50G(2)": ["Eth37/1(Port37)", "Eth37/2(Port37)"], - "4x25G[10G]": ["Eth37/1(Port37)", "Eth37/2(Port37)", "Eth37/3(Port37)", "Eth37/4(Port37)"] + "1x100G[40G](4)": ["Eth37(Port37)"], + "2x50G(4)": ["Eth37/1(Port37)", "Eth37/2(Port37)"], + "4x25G[10G](4)": ["Eth37/1(Port37)", "Eth37/2(Port37)", "Eth37/3(Port37)", "Eth37/4(Port37)"] } }, - - "Ethernet148": { - "index": "38,38,38,38", - "lanes": "33,34,35,36", + + "Ethernet296": { + "index": "38,38,38,38,38,38,38,38", + "lanes": "66,67,68,69,70,71,72,73", "breakout_modes": { "1x400G": ["Eth38(Port38)"], "2x200G": ["Eth38/1(Port38)", "Eth38/2(Port38)"], "4x100G": ["Eth38/1(Port38)", "Eth38/2(Port38)", "Eth38/3(Port38)", "Eth38/4(Port38)"], - "1x100G[40G](2)": ["Eth38(Port38)"], - "2x50G(2)": ["Eth38/1(Port38)", "Eth38/2(Port38)"], - "4x25G[10G]": ["Eth38/1(Port38)", "Eth38/2(Port38)", "Eth38/3(Port38)", "Eth38/4(Port38)"] + "1x100G[40G](4)": ["Eth38(Port38)"], + "2x50G(4)": ["Eth38/1(Port38)", "Eth38/2(Port38)"], + "4x25G[10G](4)": ["Eth38/1(Port38)", "Eth38/2(Port38)", "Eth38/3(Port38)", "Eth38/4(Port38)"] } }, - "Ethernet152": { - "index": "39,39,39,39", - "lanes": "25,26,27,28", + "Ethernet304": { + "index": "39,39,39,39,39,39,39,39", + "lanes": "50,51,52,53,54,55,56,57", "breakout_modes": { "1x400G": ["Eth39(Port39)"], "2x200G": ["Eth39/1(Port39)", "Eth39/2(Port39)"], "4x100G": ["Eth39/1(Port39)", "Eth39/2(Port39)", "Eth39/3(Port39)", "Eth39/4(Port39)"], - "1x100G[40G](2)": ["Eth39(Port39)"], - "2x50G(2)": ["Eth39/1(Port39)", "Eth39/2(Port39)"], - "4x25G[10G]": ["Eth39/1(Port39)", "Eth39/2(Port39)", "Eth39/3(Port39)", "Eth39/4(Port39)"] + "1x100G[40G](4)": ["Eth39(Port39)"], + "2x50G(4)": ["Eth39/1(Port39)", "Eth39/2(Port39)"], + "4x25G[10G](4)": ["Eth39/1(Port39)", "Eth39/2(Port39)", "Eth39/3(Port39)", "Eth39/4(Port39)"] } }, - - "Ethernet156": { - "index": "40,40,40,40", - "lanes": "41,42,43,44", + + "Ethernet312": { + "index": "40,40,40,40,40,40,40,40", + "lanes": "82,83,84,85,86,87,88,89", "breakout_modes": { "1x400G": ["Eth40(Port40)"], "2x200G": ["Eth40/1(Port40)", "Eth40/2(Port40)"], "4x100G": ["Eth40/1(Port40)", "Eth40/2(Port40)", "Eth40/3(Port40)", "Eth40/4(Port40)"], - "1x100G[40G](2)": ["Eth40(Port40)"], - "2x50G(2)": ["Eth40/1(Port40)", "Eth40/2(Port40)"], - "4x25G[10G]": ["Eth40/1(Port40)", "Eth40/2(Port40)", "Eth40/3(Port40)", "Eth40/4(Port40)"] + "1x100G[40G](4)": ["Eth40(Port40)"], + "2x50G(4)": ["Eth40/1(Port40)", "Eth40/2(Port40)"], + "4x25G[10G](4)": ["Eth40/1(Port40)", "Eth40/2(Port40)", "Eth40/3(Port40)", "Eth40/4(Port40)"] } }, - "Ethernet160": { - "index": "41,41,41,41", - "lanes": "21,22,23,24", + "Ethernet320": { + "index": "41,41,41,41,41,41,41,41", + "lanes": "42,43,44,45,46,47,48,49", "breakout_modes": { "1x400G": ["Eth41(Port41)"], "2x200G": ["Eth41/1(Port41)", "Eth41/2(Port41)"], "4x100G": ["Eth41/1(Port41)", "Eth41/2(Port41)", "Eth41/3(Port41)", "Eth41/4(Port41)"], - "1x100G[40G](2)": ["Eth41(Port41)"], - "2x50G(2)": ["Eth41/1(Port41)", "Eth41/2(Port41)"], - "4x25G[10G]": ["Eth41/1(Port41)", "Eth41/2(Port41)", "Eth41/3(Port41)", "Eth41/4(Port41)"] + "1x100G[40G](4)": ["Eth41(Port41)"], + "2x50G(4)": ["Eth41/1(Port41)", "Eth41/2(Port41)"], + "4x25G[10G](4)": ["Eth41/1(Port41)", "Eth41/2(Port41)", "Eth41/3(Port41)", "Eth41/4(Port41)"] } }, - - "Ethernet164": { - "index": "42,42,42,42", - "lanes": "37,38,39,40", + + "Ethernet328": { + "index": "42,42,42,42,42,42,42,42", + "lanes": "74,75,76,77,78,79,80,81", "breakout_modes": { "1x400G": ["Eth42(Port42)"], "2x200G": ["Eth42/1(Port42)", "Eth42/2(Port42)"], "4x100G": ["Eth42/1(Port42)", "Eth42/2(Port42)", "Eth42/3(Port42)", "Eth42/4(Port42)"], - "1x100G[40G](2)": ["Eth42(Port42)"], - "2x50G(2)": ["Eth42/1(Port42)", "Eth42/2(Port42)"], - "4x25G[10G]": ["Eth42/1(Port42)", "Eth42/2(Port42)", "Eth42/3(Port42)", "Eth42/4(Port42)"] + "1x100G[40G](4)": ["Eth42(Port42)"], + "2x50G(4)": ["Eth42/1(Port42)", "Eth42/2(Port42)"], + "4x25G[10G](4)": ["Eth42/1(Port42)", "Eth42/2(Port42)", "Eth42/3(Port42)", "Eth42/4(Port42)"] } }, - "Ethernet168": { - "index": "43,43,43,43", - "lanes": "17,18,19,20", + "Ethernet336": { + "index": "43,43,43,43,43,43,43,43", + "lanes": "34,35,36,37,38,39,40,41", "breakout_modes": { "1x400G": ["Eth43(Port43)"], "2x200G": ["Eth43/1(Port43)", "Eth43/2(Port43)"], "4x100G": ["Eth43/1(Port43)", "Eth43/2(Port43)", "Eth43/3(Port43)", "Eth43/4(Port43)"], - "1x100G[40G](2)": ["Eth43(Port43)"], - "2x50G(2)": ["Eth43/1(Port43)", "Eth43/2(Port43)"], - "4x25G[10G]": ["Eth43/1(Port43)", "Eth43/2(Port43)", "Eth43/3(Port43)", "Eth43/4(Port43)"] + "1x100G[40G](4)": ["Eth43(Port43)"], + "2x50G(4)": ["Eth43/1(Port43)", "Eth43/2(Port43)"], + "4x25G[10G](4)": ["Eth43/1(Port43)", "Eth43/2(Port43)", "Eth43/3(Port43)", "Eth43/4(Port43)"] } }, - - "Ethernet172": { - "index": "44,44,44,44", - "lanes": "45,46,47,48", + + "Ethernet344": { + "index": "44,44,44,44,44,44,44,44", + "lanes": "90,91,92,93,94,95,96,97", "breakout_modes": { "1x400G": ["Eth44(Port44)"], "2x200G": ["Eth44/1(Port44)", "Eth44/2(Port44)"], "4x100G": ["Eth44/1(Port44)", "Eth44/2(Port44)", "Eth44/3(Port44)", "Eth44/4(Port44)"], - "1x100G[40G](2)": ["Eth44(Port44)"], - "2x50G(2)": ["Eth44/1(Port44)", "Eth44/2(Port44)"], - "4x25G[10G]": ["Eth44/1(Port44)", "Eth44/2(Port44)", "Eth44/3(Port44)", "Eth44/4(Port44)"] + "1x100G[40G](4)": ["Eth44(Port44)"], + "2x50G(4)": ["Eth44/1(Port44)", "Eth44/2(Port44)"], + "4x25G[10G](4)": ["Eth44/1(Port44)", "Eth44/2(Port44)", "Eth44/3(Port44)", "Eth44/4(Port44)"] } }, - "Ethernet176": { - "index": "45,45,45,45", - "lanes": "13,14,15,16", + "Ethernet352": { + "index": "45,45,45,45,45,45,45,45", + "lanes": "26,27,28,29,30,31,32,33", "breakout_modes": { "1x400G": ["Eth45(Port45)"], "2x200G": ["Eth45/1(Port45)", "Eth45/2(Port45)"], "4x100G": ["Eth45/1(Port45)", "Eth45/2(Port45)", "Eth45/3(Port45)", "Eth45/4(Port45)"], - "1x100G[40G](2)": ["Eth45(Port45)"], - "2x50G(2)": ["Eth45/1(Port45)", "Eth45/2(Port45)"], - "4x25G[10G]": ["Eth45/1(Port45)", "Eth45/2(Port45)", "Eth45/3(Port45)", "Eth45/4(Port45)"] + "1x100G[40G](4)": ["Eth45(Port45)"], + "2x50G(4)": ["Eth45/1(Port45)", "Eth45/2(Port45)"], + "4x25G[10G](4)": ["Eth45/1(Port45)", "Eth45/2(Port45)", "Eth45/3(Port45)", "Eth45/4(Port45)"] } }, - - "Ethernet180": { - "index": "46,46,46,46", - "lanes": "9,10,11,12", + + "Ethernet360": { + "index": "46,46,46,46,46,46,46,46", + "lanes": "18,19,20,21,22,23,24,25", "breakout_modes": { "1x400G": ["Eth46(Port46)"], "2x200G": ["Eth46/1(Port46)", "Eth46/2(Port46)"], "4x100G": ["Eth46/1(Port46)", "Eth46/2(Port46)", "Eth46/3(Port46)", "Eth46/4(Port46)"], - "1x100G[40G](2)": ["Eth46(Port46)"], - "2x50G(2)": ["Eth46/1(Port46)", "Eth46/2(Port46)"], - "4x25G[10G]": ["Eth46/1(Port46)", "Eth46/2(Port46)", "Eth46/3(Port46)", "Eth46/4(Port46)"] + "1x100G[40G](4)": ["Eth46(Port46)"], + "2x50G(4)": ["Eth46/1(Port46)", "Eth46/2(Port46)"], + "4x25G[10G](4)": ["Eth46/1(Port46)", "Eth46/2(Port46)", "Eth46/3(Port46)", "Eth46/4(Port46)"] } }, - "Ethernet184": { - "index": "47,47,47,47", - "lanes": "1,2,3,4", + "Ethernet368": { + "index": "47,47,47,47,47,47,47,47", + "lanes": "2,3,4,5,6,7,8,9", "breakout_modes": { "1x400G": ["Eth47(Port47)"], "2x200G": ["Eth47/1(Port47)", "Eth47/2(Port47)"], "4x100G": ["Eth47/1(Port47)", "Eth47/2(Port47)", "Eth47/3(Port47)", "Eth47/4(Port47)"], - "1x100G[40G](2)": ["Eth47(Port47)"], - "2x50G(2)": ["Eth47/1(Port47)", "Eth47/2(Port47)"], - "4x25G[10G]": ["Eth47/1(Port47)", "Eth47/2(Port47)", "Eth47/3(Port47)", "Eth47/4(Port47)"] + "1x100G[40G](4)": ["Eth47(Port47)"], + "2x50G(4)": ["Eth47/1(Port47)", "Eth47/2(Port47)"], + "4x25G[10G](4)": ["Eth47/1(Port47)", "Eth47/2(Port47)", "Eth47/3(Port47)", "Eth47/4(Port47)"] } }, - - "Ethernet188": { - "index": "48,48,48,48", - "lanes": "5,6,7,8", + + "Ethernet376": { + "index": "48,48,48,48,48,48,48,48", + "lanes": "10,11,12,13,14,15,16,17", "breakout_modes": { "1x400G": ["Eth48(Port48)"], "2x200G": ["Eth48/1(Port48)", "Eth48/2(Port48)"], "4x100G": ["Eth48/1(Port48)", "Eth48/2(Port48)", "Eth48/3(Port48)", "Eth48/4(Port48)"], - "1x100G[40G](2)": ["Eth48(Port48)"], - "2x50G(2)": ["Eth48/1(Port48)", "Eth48/2(Port48)"], - "4x25G[10G]": ["Eth48/1(Port48)", "Eth48/2(Port48)", "Eth48/3(Port48)", "Eth48/4(Port48)"] + "1x100G[40G](4)": ["Eth48(Port48)"], + "2x50G(4)": ["Eth48/1(Port48)", "Eth48/2(Port48)"], + "4x25G[10G](4)": ["Eth48/1(Port48)", "Eth48/2(Port48)", "Eth48/3(Port48)", "Eth48/4(Port48)"] } }, - "Ethernet192": { - "index": "49,49,49,49", - "lanes": "249,250,251,252", + "Ethernet384": { + "index": "49,49,49,49,49,49,49,49", + "lanes": "498,499,500,501,502,503,504,505", "breakout_modes": { "1x400G": ["Eth49(Port49)"], "2x200G": ["Eth49/1(Port49)", "Eth49/2(Port49)"], "4x100G": ["Eth49/1(Port49)", "Eth49/2(Port49)", "Eth49/3(Port49)", "Eth49/4(Port49)"], - "1x100G[40G](2)": ["Eth49(Port49)"], - "2x50G(2)": ["Eth49/1(Port49)", "Eth49/2(Port49)"], - "4x25G[10G]": ["Eth49/1(Port49)", "Eth49/2(Port49)", "Eth49/3(Port49)", "Eth49/4(Port49)"] + "1x100G[40G](4)": ["Eth49(Port49)"], + "2x50G(4)": ["Eth49/1(Port49)", "Eth49/2(Port49)"], + "4x25G[10G](4)": ["Eth49/1(Port49)", "Eth49/2(Port49)", "Eth49/3(Port49)", "Eth49/4(Port49)"] } }, - - "Ethernet196": { - "index": "50,50,50,50", - "lanes": "253,254,255,256", + + "Ethernet392": { + "index": "50,50,50,50,50,50,50,50", + "lanes": "506,507,508,509,510,511,512,513", "breakout_modes": { "1x400G": ["Eth50(Port50)"], "2x200G": ["Eth50/1(Port50)", "Eth50/2(Port50)"], "4x100G": ["Eth50/1(Port50)", "Eth50/2(Port50)", "Eth50/3(Port50)", "Eth50/4(Port50)"], - "1x100G[40G](2)": ["Eth50(Port50)"], - "2x50G(2)": ["Eth50/1(Port50)", "Eth50/2(Port50)"], - "4x25G[10G]": ["Eth50/1(Port50)", "Eth50/2(Port50)", "Eth50/3(Port50)", "Eth50/4(Port50)"] + "1x100G[40G](4)": ["Eth50(Port50)"], + "2x50G(4)": ["Eth50/1(Port50)", "Eth50/2(Port50)"], + "4x25G[10G](4)": ["Eth50/1(Port50)", "Eth50/2(Port50)", "Eth50/3(Port50)", "Eth50/4(Port50)"] } }, - "Ethernet200": { - "index": "51,51,51,51", - "lanes": "245,246,247,248", + "Ethernet400": { + "index": "51,51,51,51,51,51,51,51", + "lanes": "490,491,492,493,494,495,496,497", "breakout_modes": { "1x400G": ["Eth51(Port51)"], "2x200G": ["Eth51/1(Port51)", "Eth51/2(Port51)"], "4x100G": ["Eth51/1(Port51)", "Eth51/2(Port51)", "Eth51/3(Port51)", "Eth51/4(Port51)"], - "1x100G[40G](2)": ["Eth51(Port51)"], - "2x50G(2)": ["Eth51/1(Port51)", "Eth51/2(Port51)"], - "4x25G[10G]": ["Eth51/1(Port51)", "Eth51/2(Port51)", "Eth51/3(Port51)", "Eth51/4(Port51)"] + "1x100G[40G](4)": ["Eth51(Port51)"], + "2x50G(4)": ["Eth51/1(Port51)", "Eth51/2(Port51)"], + "4x25G[10G](4)": ["Eth51/1(Port51)", "Eth51/2(Port51)", "Eth51/3(Port51)", "Eth51/4(Port51)"] } }, - - "Ethernet204": { - "index": "52,52,52,52", - "lanes": "241,242,243,244", + + "Ethernet408": { + "index": "52,52,52,52,52,52,52,52", + "lanes": "482,483,484,485,486,487,488,489", "breakout_modes": { "1x400G": ["Eth52(Port52)"], "2x200G": ["Eth52/1(Port52)", "Eth52/2(Port52)"], "4x100G": ["Eth52/1(Port52)", "Eth52/2(Port52)", "Eth52/3(Port52)", "Eth52/4(Port52)"], - "1x100G[40G](2)": ["Eth52(Port52)"], - "2x50G(2)": ["Eth52/1(Port52)", "Eth52/2(Port52)"], - "4x25G[10G]": ["Eth52/1(Port52)", "Eth52/2(Port52)", "Eth52/3(Port52)", "Eth52/4(Port52)"] + "1x100G[40G](4)": ["Eth52(Port52)"], + "2x50G(4)": ["Eth52/1(Port52)", "Eth52/2(Port52)"], + "4x25G[10G](4)": ["Eth52/1(Port52)", "Eth52/2(Port52)", "Eth52/3(Port52)", "Eth52/4(Port52)"] } }, - "Ethernet208": { - "index": "53,53,53,53", - "lanes": "237,238,239,240", + "Ethernet416": { + "index": "53,53,53,53,53,53,53,53", + "lanes": "474,475,476,477,478,479,480,481", "breakout_modes": { "1x400G": ["Eth53(Port53)"], "2x200G": ["Eth53/1(Port53)", "Eth53/2(Port53)"], "4x100G": ["Eth53/1(Port53)", "Eth53/2(Port53)", "Eth53/3(Port53)", "Eth53/4(Port53)"], - "1x100G[40G](2)": ["Eth53(Port53)"], - "2x50G(2)": ["Eth53/1(Port53)", "Eth53/2(Port53)"], - "4x25G[10G]": ["Eth53/1(Port53)", "Eth53/2(Port53)", "Eth53/3(Port53)", "Eth53/4(Port53)"] + "1x100G[40G](4)": ["Eth53(Port53)"], + "2x50G(4)": ["Eth53/1(Port53)", "Eth53/2(Port53)"], + "4x25G[10G](4)": ["Eth53/1(Port53)", "Eth53/2(Port53)", "Eth53/3(Port53)", "Eth53/4(Port53)"] } }, - - "Ethernet212": { - "index": "54,54,54,54", - "lanes": "209,210,211,212", + + "Ethernet424": { + "index": "54,54,54,54,54,54,54,54", + "lanes": "418,419,420,421,422,423,424,425", "breakout_modes": { "1x400G": ["Eth54(Port54)"], "2x200G": ["Eth54/1(Port54)", "Eth54/2(Port54)"], "4x100G": ["Eth54/1(Port54)", "Eth54/2(Port54)", "Eth54/3(Port54)", "Eth54/4(Port54)"], - "1x100G[40G](2)": ["Eth54(Port54)"], - "2x50G(2)": ["Eth54/1(Port54)", "Eth54/2(Port54)"], - "4x25G[10G]": ["Eth54/1(Port54)", "Eth54/2(Port54)", "Eth54/3(Port54)", "Eth54/4(Port54)"] + "1x100G[40G](4)": ["Eth54(Port54)"], + "2x50G(4)": ["Eth54/1(Port54)", "Eth54/2(Port54)"], + "4x25G[10G](4)": ["Eth54/1(Port54)", "Eth54/2(Port54)", "Eth54/3(Port54)", "Eth54/4(Port54)"] } }, - "Ethernet216": { - "index": "55,55,55,55", - "lanes": "233,234,235,236", + "Ethernet432": { + "index": "55,55,55,55,55,55,55,55", + "lanes": "466,467,468,469,470,471,472,473", "breakout_modes": { "1x400G": ["Eth55(Port55)"], "2x200G": ["Eth55/1(Port55)", "Eth55/2(Port55)"], "4x100G": ["Eth55/1(Port55)", "Eth55/2(Port55)", "Eth55/3(Port55)", "Eth55/4(Port55)"], - "1x100G[40G](2)": ["Eth55(Port55)"], - "2x50G(2)": ["Eth55/1(Port55)", "Eth55/2(Port55)"], - "4x25G[10G]": ["Eth55/1(Port55)", "Eth55/2(Port55)", "Eth55/3(Port55)", "Eth55/4(Port55)"] + "1x100G[40G](4)": ["Eth55(Port55)"], + "2x50G(4)": ["Eth55/1(Port55)", "Eth55/2(Port55)"], + "4x25G[10G](4)": ["Eth55/1(Port55)", "Eth55/2(Port55)", "Eth55/3(Port55)", "Eth55/4(Port55)"] } }, - - "Ethernet220": { - "index": "56,56,56,56", - "lanes": "217,218,219,220", + + "Ethernet440": { + "index": "56,56,56,56,56,56,56,56", + "lanes": "434,435,436,437,438,439,440,441", "breakout_modes": { "1x400G": ["Eth56(Port56)"], "2x200G": ["Eth56/1(Port56)", "Eth56/2(Port56)"], "4x100G": ["Eth56/1(Port56)", "Eth56/2(Port56)", "Eth56/3(Port56)", "Eth56/4(Port56)"], - "1x100G[40G](2)": ["Eth56(Port56)"], - "2x50G(2)": ["Eth56/1(Port56)", "Eth56/2(Port56)"], - "4x25G[10G]": ["Eth56/1(Port56)", "Eth56/2(Port56)", "Eth56/3(Port56)", "Eth56/4(Port56)"] + "1x100G[40G](4)": ["Eth56(Port56)"], + "2x50G(4)": ["Eth56/1(Port56)", "Eth56/2(Port56)"], + "4x25G[10G](4)": ["Eth56/1(Port56)", "Eth56/2(Port56)", "Eth56/3(Port56)", "Eth56/4(Port56)"] } }, - "Ethernet224": { - "index": "57,57,57,57", - "lanes": "229,230,231,232", + "Ethernet448": { + "index": "57,57,57,57,57,57,57,57", + "lanes": "458,459,460,461,462,463,464,465", "breakout_modes": { "1x400G": ["Eth57(Port57)"], "2x200G": ["Eth57/1(Port57)", "Eth57/2(Port57)"], "4x100G": ["Eth57/1(Port57)", "Eth57/2(Port57)", "Eth57/3(Port57)", "Eth57/4(Port57)"], - "1x100G[40G](2)": ["Eth57(Port57)"], - "2x50G(2)": ["Eth57/1(Port57)", "Eth57/2(Port57)"], - "4x25G[10G]": ["Eth57/1(Port57)", "Eth57/2(Port57)", "Eth57/3(Port57)", "Eth57/4(Port57)"] + "1x100G[40G](4)": ["Eth57(Port57)"], + "2x50G(4)": ["Eth57/1(Port57)", "Eth57/2(Port57)"], + "4x25G[10G](4)": ["Eth57/1(Port57)", "Eth57/2(Port57)", "Eth57/3(Port57)", "Eth57/4(Port57)"] } }, - - "Ethernet228": { - "index": "58,58,58,58", - "lanes": "213,214,215,216", + + "Ethernet456": { + "index": "58,58,58,58,58,58,58,58", + "lanes": "426,427,428,429,430,431,432,433", "breakout_modes": { "1x400G": ["Eth58(Port58)"], "2x200G": ["Eth58/1(Port58)", "Eth58/2(Port58)"], "4x100G": ["Eth58/1(Port58)", "Eth58/2(Port58)", "Eth58/3(Port58)", "Eth58/4(Port58)"], - "1x100G[40G](2)": ["Eth58(Port58)"], - "2x50G(2)": ["Eth58/1(Port58)", "Eth58/2(Port58)"], - "4x25G[10G]": ["Eth58/1(Port58)", "Eth58/2(Port58)", "Eth58/3(Port58)", "Eth58/4(Port58)"] + "1x100G[40G](4)": ["Eth58(Port58)"], + "2x50G(4)": ["Eth58/1(Port58)", "Eth58/2(Port58)"], + "4x25G[10G](4)": ["Eth58/1(Port58)", "Eth58/2(Port58)", "Eth58/3(Port58)", "Eth58/4(Port58)"] } }, - "Ethernet232": { - "index": "59,59,59,59", - "lanes": "225,226,227,228", + "Ethernet464": { + "index": "59,59,59,59,59,59,59,59", + "lanes": "450,451,452,453,454,455,456,457", "breakout_modes": { "1x400G": ["Eth59(Port59)"], "2x200G": ["Eth59/1(Port59)", "Eth59/2(Port59)"], "4x100G": ["Eth59/1(Port59)", "Eth59/2(Port59)", "Eth59/3(Port59)", "Eth59/4(Port59)"], - "1x100G[40G](2)": ["Eth59(Port59)"], - "2x50G(2)": ["Eth59/1(Port59)", "Eth59/2(Port59)"], - "4x25G[10G]": ["Eth59/1(Port59)", "Eth59/2(Port59)", "Eth59/3(Port59)", "Eth59/4(Port59)"] + "1x100G[40G](4)": ["Eth59(Port59)"], + "2x50G(4)": ["Eth59/1(Port59)", "Eth59/2(Port59)"], + "4x25G[10G](4)": ["Eth59/1(Port59)", "Eth59/2(Port59)", "Eth59/3(Port59)", "Eth59/4(Port59)"] } }, - - "Ethernet236": { - "index": "60,60,60,60", - "lanes": "221,222,223,224", + + "Ethernet472": { + "index": "60,60,60,60,60,60,60,60", + "lanes": "442,443,444,445,446,447,448,449", "breakout_modes": { "1x400G": ["Eth60(Port60)"], "2x200G": ["Eth60/1(Port60)", "Eth60/2(Port60)"], "4x100G": ["Eth60/1(Port60)", "Eth60/2(Port60)", "Eth60/3(Port60)", "Eth60/4(Port60)"], - "1x100G[40G](2)": ["Eth60(Port60)"], - "2x50G(2)": ["Eth60/1(Port60)", "Eth60/2(Port60)"], - "4x25G[10G]": ["Eth60/1(Port60)", "Eth60/2(Port60)", "Eth60/3(Port60)", "Eth60/4(Port60)"] + "1x100G[40G](4)": ["Eth60(Port60)"], + "2x50G(4)": ["Eth60/1(Port60)", "Eth60/2(Port60)"], + "4x25G[10G](4)": ["Eth60/1(Port60)", "Eth60/2(Port60)", "Eth60/3(Port60)", "Eth60/4(Port60)"] } }, - "Ethernet240": { - "index": "61,61,61,61", - "lanes": "193,194,195,196", + "Ethernet480": { + "index": "61,61,61,61,61,61,61,61", + "lanes": "386,387,388,389,390,391,392,393", "breakout_modes": { "1x400G": ["Eth61(Port61)"], "2x200G": ["Eth61/1(Port61)", "Eth61/2(Port61)"], "4x100G": ["Eth61/1(Port61)", "Eth61/2(Port61)", "Eth61/3(Port61)", "Eth61/4(Port61)"], - "1x100G[40G](2)": ["Eth61(Port61)"], - "2x50G(2)": ["Eth61/1(Port61)", "Eth61/2(Port61)"], - "4x25G[10G]": ["Eth61/1(Port61)", "Eth61/2(Port61)", "Eth61/3(Port61)", "Eth61/4(Port61)"] + "1x100G[40G](4)": ["Eth61(Port61)"], + "2x50G(4)": ["Eth61/1(Port61)", "Eth61/2(Port61)"], + "4x25G[10G](4)": ["Eth61/1(Port61)", "Eth61/2(Port61)", "Eth61/3(Port61)", "Eth61/4(Port61)"] } }, - - "Ethernet244": { - "index": "62,62,62,62", - "lanes": "201,202,203,204", + + "Ethernet488": { + "index": "62,62,62,62,62,62,62,62", + "lanes": "402,403,404,405,406,407,408,409", "breakout_modes": { "1x400G": ["Eth62(Port62)"], "2x200G": ["Eth62/1(Port62)", "Eth62/2(Port62)"], "4x100G": ["Eth62/1(Port62)", "Eth62/2(Port62)", "Eth62/3(Port62)", "Eth62/4(Port62)"], - "1x100G[40G](2)": ["Eth62(Port62)"], - "2x50G(2)": ["Eth62/1(Port62)", "Eth62/2(Port62)"], - "4x25G[10G]": ["Eth62/1(Port62)", "Eth62/2(Port62)", "Eth62/3(Port62)", "Eth62/4(Port62)"] + "1x100G[40G](4)": ["Eth62(Port62)"], + "2x50G(4)": ["Eth62/1(Port62)", "Eth62/2(Port62)"], + "4x25G[10G](4)": ["Eth62/1(Port62)", "Eth62/2(Port62)", "Eth62/3(Port62)", "Eth62/4(Port62)"] } }, - "Ethernet248": { - "index": "63,63,63,63", - "lanes": "197,198,199,200", + "Ethernet496": { + "index": "63,63,63,63,63,63,63,63", + "lanes": "394,395,396,397,398,399,400,401", "breakout_modes": { "1x400G": ["Eth63(Port63)"], "2x200G": ["Eth63/1(Port63)", "Eth63/2(Port63)"], "4x100G": ["Eth63/1(Port63)", "Eth63/2(Port63)", "Eth63/3(Port63)", "Eth63/4(Port63)"], - "1x100G[40G](2)": ["Eth63(Port63)"], - "2x50G(2)": ["Eth63/1(Port63)", "Eth63/2(Port63)"], - "4x25G[10G]": ["Eth63/1(Port63)", "Eth63/2(Port63)", "Eth63/3(Port63)", "Eth63/4(Port63)"] + "1x100G[40G](4)": ["Eth63(Port63)"], + "2x50G(4)": ["Eth63/1(Port63)", "Eth63/2(Port63)"], + "4x25G[10G](4)": ["Eth63/1(Port63)", "Eth63/2(Port63)", "Eth63/3(Port63)", "Eth63/4(Port63)"] } }, - - "Ethernet252": { - "index": "64,64,64,64", - "lanes": "205,206,207,208", + + "Ethernet504": { + "index": "64,64,64,64,64,64,64,64", + "lanes": "410,411,412,413,414,415,416,417", "breakout_modes": { "1x400G": ["Eth64(Port64)"], "2x200G": ["Eth64/1(Port64)", "Eth64/2(Port64)"], "4x100G": ["Eth64/1(Port64)", "Eth64/2(Port64)", "Eth64/3(Port64)", "Eth64/4(Port64)"], - "1x100G[40G](2)": ["Eth64(Port64)"], - "2x50G(2)": ["Eth64/1(Port64)", "Eth64/2(Port64)"], - "4x25G[10G]": ["Eth64/1(Port64)", "Eth64/2(Port64)", "Eth64/3(Port64)", "Eth64/4(Port64)"] + "1x100G[40G](4)": ["Eth64(Port64)"], + "2x50G(4)": ["Eth64/1(Port64)", "Eth64/2(Port64)"], + "4x25G[10G](4)": ["Eth64/1(Port64)", "Eth64/2(Port64)", "Eth64/3(Port64)", "Eth64/4(Port64)"] } }, - - "Ethernet256": { + + "Ethernet512": { "index": "65", - "lanes": "257", + "lanes": "514", "breakout_modes": { "1x10G[1G]": ["Eth65(Port65)"] } }, - "Ethernet257": { + "Ethernet513": { "index": "66", - "lanes": "258", + "lanes": "516", "breakout_modes": { "1x10G[1G]": ["Eth66(Port66)"] } } } } - diff --git a/device/accton/x86_64-accton_as9736_64d-r0/platform_components.json b/device/accton/x86_64-accton_as9736_64d-r0/platform_components.json new file mode 100644 index 0000000000..792a2b24b2 --- /dev/null +++ b/device/accton/x86_64-accton_as9736_64d-r0/platform_components.json @@ -0,0 +1,16 @@ +{ + "chassis": { + "AS9736-64D-O-AC-F": { + "component": { + "SYSTEM CPLD": { }, + "FCM CPLD": { }, + "PSU CPLD": { }, + "SCM CPLD": { }, + "UDB FPGA": { }, + "LDB FPGA": { }, + "SMB FPGA": { }, + "BIOS": { } + } + } + } +} diff --git a/device/accton/x86_64-accton_as9736_64d-r0/platform_env.conf b/device/accton/x86_64-accton_as9736_64d-r0/platform_env.conf index 28af0b988c..8cf7f252b4 100644 --- a/device/accton/x86_64-accton_as9736_64d-r0/platform_env.conf +++ b/device/accton/x86_64-accton_as9736_64d-r0/platform_env.conf @@ -1,2 +1,2 @@ -is_ltsw_chip=1 SYNCD_SHM_SIZE=1G +is_ltsw_chip=1 \ No newline at end of file diff --git a/device/accton/x86_64-accton_as4630_54te-r0/plugins/eeprom.py b/device/accton/x86_64-accton_as9736_64d-r0/plugins/eeprom.py similarity index 83% rename from device/accton/x86_64-accton_as4630_54te-r0/plugins/eeprom.py rename to device/accton/x86_64-accton_as9736_64d-r0/plugins/eeprom.py index 7409239d01..dbaed20ff8 100755 --- a/device/accton/x86_64-accton_as4630_54te-r0/plugins/eeprom.py +++ b/device/accton/x86_64-accton_as9736_64d-r0/plugins/eeprom.py @@ -9,5 +9,5 @@ class board(eeprom_tlvinfo.TlvInfoDecoder): _TLV_INFO_MAX_LEN = 256 def __init__(self, name, path, cpld_root, ro): - self.eeprom_path = "/sys/bus/i2c/devices/1-0057/eeprom" + self.eeprom_path = "/sys/bus/i2c/devices/20-0051/eeprom" super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/accton/x86_64-accton_as4630_54te-r0/plugins/psuutil.py b/device/accton/x86_64-accton_as9736_64d-r0/plugins/psuutil.py similarity index 96% rename from device/accton/x86_64-accton_as4630_54te-r0/plugins/psuutil.py rename to device/accton/x86_64-accton_as9736_64d-r0/plugins/psuutil.py index 92ae68eb87..23e9be4b98 100755 --- a/device/accton/x86_64-accton_as4630_54te-r0/plugins/psuutil.py +++ b/device/accton/x86_64-accton_as9736_64d-r0/plugins/psuutil.py @@ -25,8 +25,8 @@ def __init__(self): self.psu_presence = "/psu_present" self.psu_oper_status = "/psu_power_good" self.psu_mapping = { - 1: "10-0050", - 2: "11-0051", + 1: "33-0050", + 2: "41-0051", } def get_num_psus(self): diff --git a/device/accton/x86_64-accton_as4630_54te-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as9736_64d-r0/plugins/sfputil.py similarity index 60% rename from device/accton/x86_64-accton_as4630_54te-r0/plugins/sfputil.py rename to device/accton/x86_64-accton_as9736_64d-r0/plugins/sfputil.py index 63e6bd5364..805d846a0f 100755 --- a/device/accton/x86_64-accton_as4630_54te-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as9736_64d-r0/plugins/sfputil.py @@ -4,7 +4,6 @@ # try: - import sys import time from ctypes import create_string_buffer from sonic_sfp.sfputilbase import SfpUtilBase @@ -14,30 +13,22 @@ SFP_STATUS_INSERTED = '1' SFP_STATUS_REMOVED = '0' - class SfpUtil(SfpUtilBase): """Platform-specific SfpUtil class""" - PORT_START = 49 - PORT_END = 54 - PORTS_IN_BLOCK = 54 - QSFP_START = 53 + PORT_START = 1 + QSFP_PORT_END = 64 + PORT_END = 66 + PORTS_IN_BLOCK = 66 - BASE_OOM_PATH = "/sys/bus/i2c/devices/{0}-0050/" - BASE_CPLD_PATH = "/sys/bus/i2c/devices/3-0060/" + FPGA_PCIE_PATH = "/sys/devices/platform/as9736_64d_fpga/" + PCIE_UDB_EEPROM_PATH = '/sys/devices/platform/pcie_udb_fpga_device.{0}/eeprom' + PCIE_LDB_EEPROM_PATH = '/sys/devices/platform/pcie_ldb_fpga_device.{0}/eeprom' _port_to_is_present = {} _port_to_lp_mode = {} _port_to_eeprom_mapping = {} - _port_to_i2c_mapping = { - 49: [18], - 50: [19], - 51: [20], - 52: [21], - 53: [22], - 54: [23], - } @property def port_start(self): @@ -49,33 +40,43 @@ def port_end(self): @property def qsfp_ports(self): - return range(self.PORT_START, self.PORTS_IN_BLOCK + 1) + return list(range(self.PORT_START, self.PORTS_IN_BLOCK - 1)) @property def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping def __init__(self): - eeprom_path = self.BASE_OOM_PATH + "eeprom" - for x in range(self.port_start, self.port_end + 1): - self.port_to_eeprom_mapping[x] = eeprom_path.format( - self._port_to_i2c_mapping[x][0]) + + for x in range(self.port_start, self.port_end+1): + if x <= 32: + self.port_to_eeprom_mapping[x] = self.PCIE_UDB_EEPROM_PATH.format(x - 1) + else: + self.port_to_eeprom_mapping[x] = self.PCIE_LDB_EEPROM_PATH.format(x - 33) + SfpUtilBase.__init__(self) - def get_presence(self, port_num): - # Check for invalid port_num - if port_num < self.port_start or port_num > self.port_end: + def __write_txt_file(self, file_path, value): + try: + reg_file = open(file_path, "w") + except IOError as e: + print("Error: unable to open file: %s" % str(e)) return False - present_path = self.BASE_CPLD_PATH + "module_present_" + str(port_num) - self.__port_to_is_present = present_path + reg_file.write(str(value)) + reg_file.close() + return True + + def get_presence(self, port_num): + present_path = self.FPGA_PCIE_PATH + "module_present_" + str(port_num) + self.__port_to_is_present = present_path try: - val_file = open(self.__port_to_is_present) + val_file = open(present_path) content = val_file.readline().rstrip() val_file.close() except IOError as e: - print ('Error: unable to access file: %s') % str(e) + print("Error: unable to access file: %s" % str(e)) return False if content == "1": @@ -84,30 +85,27 @@ def get_presence(self, port_num): return False def get_low_power_mode(self, port_num): - # Check for invalid port_num - if port_num < self.QSFP_START or port_num > self.port_end: + if port_num > self.QSFP_PORT_END: #sfp not support lpmode return False - try: eeprom = None + if not self.get_presence(port_num): return False + eeprom = open(self.port_to_eeprom_mapping[port_num], "rb") eeprom.seek(93) lpmode = ord(eeprom.read(1)) - # if "Power override" bit is 1 and "Power set" bit is 1 if ((lpmode & 0x3) == 0x3): - return True - - # High Power Mode if one of the following conditions is matched: - # 1. "Power override" bit is 0 - # 2. "Power override" bit is 1 and "Power set" bit is 0 + return True # Low Power Mode if "Power override" bit is 1 and "Power set" bit is 1 else: + # High Power Mode if one of the following conditions is matched: + # 1. "Power override" bit is 0 + # 2. "Power override" bit is 1 and "Power set" bit is 0 return False - except IOError as e: - print ('Error: unable to open file: %s') % str(e) + print("Error: unable to open file: %s" % str(e)) return False finally: if eeprom is not None: @@ -116,7 +114,7 @@ def get_low_power_mode(self, port_num): def set_low_power_mode(self, port_num, lpmode): # Check for invalid port_num - if port_num < self.QSFP_START or port_num > self.port_end: + if port_num > self.QSFP_PORT_END: #sfp not support lpmode: return False try: @@ -125,14 +123,12 @@ def set_low_power_mode(self, port_num, lpmode): return False # Port is not present, unable to set the eeprom # Fill in write buffer - # 0x3:Low Power Mode, 0x1:High Power Mode - regval = 0x3 if lpmode else 0x1 + # 0x3:Low Power Mode. "Power override" bit is 1 and "Power set" bit is 1 + # 0x9:High Power Mode. "Power override" bit is 1 ,"Power set" bit is 0 and "High Power Class Enable" bit is 1 + regval = 0x3 if lpmode else 0x9 buffer = create_string_buffer(1) - if sys.version_info[0] >= 3: - buffer[0] = regval - else: - buffer[0] = chr(regval) + buffer[0] = regval # Write to eeprom eeprom = open(self.port_to_eeprom_mapping[port_num], "r+b") @@ -140,7 +136,7 @@ def set_low_power_mode(self, port_num, lpmode): eeprom.write(buffer[0]) return True except IOError as e: - print ('Error: unable to open file: %s') % str(e) + print("Error: unable to open file: %s" % str(e)) return False finally: if eeprom is not None: @@ -148,7 +144,24 @@ def set_low_power_mode(self, port_num, lpmode): time.sleep(0.01) def reset(self, port_num): - raise NotImplementedError + if port_num > self.QSFP_PORT_END: #sfp not support lpmode: + return False + if not self.get_presence(port_num): + return False # Port is not present, unable to set reset + + mod_rst_path = self.FPGA_PCIE_PATH + "module_reset_" + str(port_num) + + self.__port_to_mod_rst = mod_rst_path + + ret = self.__write_txt_file(self.__port_to_mod_rst, 1) + if ret is not True: + return ret + + time.sleep(0.2) + ret = self.__write_txt_file(self.__port_to_mod_rst, 0) + time.sleep(0.2) + + return ret @property def _get_presence_bitmap(self): @@ -194,3 +207,4 @@ def get_transceiver_change_event(self, timeout=0): return True, port_dict else: return True, {} + diff --git a/device/accton/x86_64-accton_as9736_64d-r0/plugins/ssd_util.py b/device/accton/x86_64-accton_as9736_64d-r0/plugins/ssd_util.py new file mode 100755 index 0000000000..4b173c5e38 --- /dev/null +++ b/device/accton/x86_64-accton_as9736_64d-r0/plugins/ssd_util.py @@ -0,0 +1,24 @@ +# ssd_util.py +# +# Platform-specific SSD interface for SONiC +## + +try: + from sonic_platform_base.sonic_ssd.ssd_generic import SsdUtil as MainSsdUtil +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +NOT_AVAILABLE = "N/A" + +class SsdUtil(MainSsdUtil): + """Platform-specific SsdUtil class""" + + def __init__(self, diskdev): + super(SsdUtil, self).__init__(diskdev) + + # If it has no vendor tool to read SSD information, + # ssd_util.py will use generic SSD information + # for vendor SSD information. + if self.vendor_ssd_info == NOT_AVAILABLE: + self.vendor_ssd_info = self.ssd_info + diff --git a/device/accton/x86_64-accton_as9736_64d-r0/pmon_daemon_control.json b/device/accton/x86_64-accton_as9736_64d-r0/pmon_daemon_control.json new file mode 100644 index 0000000000..44bad64942 --- /dev/null +++ b/device/accton/x86_64-accton_as9736_64d-r0/pmon_daemon_control.json @@ -0,0 +1,4 @@ +{ + "skip_ledd": true +} + diff --git a/device/accton/x86_64-accton_as9736_64d-r0/sensors.conf b/device/accton/x86_64-accton_as9736_64d-r0/sensors.conf new file mode 100644 index 0000000000..9876cf9640 --- /dev/null +++ b/device/accton/x86_64-accton_as9736_64d-r0/sensors.conf @@ -0,0 +1,79 @@ +# libsensors configuration file for as9736-64d +# ------------------------------------------------ +# + +bus "i2c-2" "i2c-0-mux (chan_id 1)" +bus "i2c-14" "i2c-3-mux (chan_id 5)" +bus "i2c-25" "i2c-9-mux (chan_id 0)" +bus "i2c-27" "i2c-9-mux (chan_id 2)" +bus "i2c-33" "i2c-10-mux (chan_id 0)" +bus "i2c-34" "i2c-10-mux (chan_id 1)" +bus "i2c-41" "i2c-11-mux (chan_id 0)" +bus "i2c-42" "i2c-11-mux (chan_id 1)" +bus "i2c-57" "i2c-18-mux (chan_id 0)" +bus "i2c-58" "i2c-18-mux (chan_id 1)" +bus "i2c-65" "i2c-19-mux (chan_id 0)" +bus "i2c-66" "i2c-19-mux (chan_id 1)" + + +chip "delta_dps2400-i2c-*-59" + label in3 "PSU 1 Voltage" + label fan1 "PSU 1 Fan" + label temp1 "PSU 1 Temperature" + label power2 "PSU 1 Power" + label curr2 "PSU 1 Current" + +chip "delta_dps2400-i2c-*-58" + label in3 "PSU 2 Voltage" + label fan1 "PSU 2 Fan" + label temp1 "PSU 2 Temperature" + label power2 "PSU 2 Power" + label curr2 "PSU 2 Current" + +chip "as9736_64d_fan-*" + label fan1 "Fan 1 Front" + label fan2 "Fan 2 Front" + label fan3 "Fan 3 Front" + label fan4 "Fan 4 Front" + label fan11 "Fan 1 Rear" + label fan12 "Fan 2 Rear" + label fan13 "Fan 3 Rear" + label fan14 "Fan 4 Rear" + + +chip "lm75-i2c-2-48" + label temp1 "SMB_RearMiddle_temp" + +chip "lm75-i2c-2-49" + label temp1 "SMB_FrontMiddle_temp" + +chip "tmp421-i2c-14-4c" + label temp1 "SMB_LeftMiddle_temp" + label temp2 "SMB_LeftMiddle_temp" + +chip "lm75-i2c-27-48" + label temp1 "FCM_Center_temp" + +chip "lm75-i2c-27-49" + label temp1 "FCM_Left_temp" + +chip "lm75-i2c-34-48" + label temp1 "PDB-L_temp" + +chip "lm75-i2c-42-49" + label temp1 "PDB-R_temp" + +chip "lm75-i2c-57-48" + label temp1 "UDB_RearLeft_temp" + +chip "tmp421-i2c-58-4c" + label temp1 "UDB_RearMiddle_temp" + label temp2 "UDB_RearMiddle_temp" + +chip "lm75-i2c-65-4c" + label temp1 "LDB_FrontRight_temp" + +chip "tmp421-i2c-66-4d" + label temp1 "LDB_RearRight_temp" + label temp2 "LDB_RearRight_temp" + diff --git a/device/accton/x86_64-accton_as9736_64d-r0/system_health_monitoring_config.json b/device/accton/x86_64-accton_as9736_64d-r0/system_health_monitoring_config.json new file mode 100644 index 0000000000..7aa53bcf4d --- /dev/null +++ b/device/accton/x86_64-accton_as9736_64d-r0/system_health_monitoring_config.json @@ -0,0 +1,14 @@ +{ + "services_to_ignore": [], + "devices_to_ignore": [ + "asic", + "psu.temperature" + ], + "user_defined_checkers": [], + "polling_interval": 60, + "led_color": { + "fault": "STATUS_LED_COLOR_AMBER", + "normal": "STATUS_LED_COLOR_GREEN", + "booting": "STATUS_LED_COLOR_GREEN_BLINKING" + } +} diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index c9660299ed..1c884eda31 100755 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -43,6 +43,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(ACCTON_AS5835_54X_PLATFORM_MODULE) \ $(ACCTON_AS9716_32D_PLATFORM_MODULE) \ $(ACCTON_AS9726_32D_PLATFORM_MODULE) \ + $(ACCTON_AS9736_64D_PLATFORM_MODULE) \ $(ACCTON_AS5835_54T_PLATFORM_MODULE) \ $(ACCTON_AS7312_54XS_PLATFORM_MODULE) \ $(ACCTON_AS7315_27XB_PLATFORM_MODULE) \ diff --git a/platform/broadcom/platform-modules-accton.mk b/platform/broadcom/platform-modules-accton.mk old mode 100755 new mode 100644 index 85e7ff1f56..923ff332c4 --- a/platform/broadcom/platform-modules-accton.mk +++ b/platform/broadcom/platform-modules-accton.mk @@ -17,6 +17,7 @@ ACCTON_AS5812_54T_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS5835_54X_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS9716_32D_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS9726_32D_PLATFORM_MODULE_VERSION = 1.1 +ACCTON_AS9736_64D_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS5835_54T_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS7312_54XS_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS7315_27XB_PLATFORM_MODULE_VERSION = 1.1 @@ -38,6 +39,7 @@ export ACCTON_AS5812_54T_PLATFORM_MODULE_VERSION export ACCTON_AS5835_54X_PLATFORM_MODULE_VERSION export ACCTON_AS9716_32D_PLATFORM_MODULE_VERSION export ACCTON_AS9726_32D_PLATFORM_MODULE_VERSION +export ACCTON_AS9736_64D_PLATFORM_MODULE_VERSION export ACCTON_AS5835_54T_PLATFORM_MODULE_VERSION export ACCTON_AS7312_54XS_PLATFORM_MODULE_VERSION export ACCTON_AS7315_27XB_PLATFORM_MODULE_VERSION @@ -116,6 +118,10 @@ ACCTON_AS9726_32D_PLATFORM_MODULE = sonic-platform-accton-as9726-32d_$(ACCTON_AS $(ACCTON_AS9726_32D_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as9726_32d-r0 $(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS9726_32D_PLATFORM_MODULE))) +ACCTON_AS9736_64D_PLATFORM_MODULE = sonic-platform-accton-as9736-64d_$(ACCTON_AS9736_64D_PLATFORM_MODULE_VERSION)_amd64.deb +$(ACCTON_AS9736_64D_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as9736_64d-r0 +$(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS9736_64D_PLATFORM_MODULE))) + ACCTON_AS5835_54T_PLATFORM_MODULE = sonic-platform-accton-as5835-54t_$(ACCTON_AS5835_54T_PLATFORM_MODULE_VERSION)_amd64.deb $(ACCTON_AS5835_54T_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as5835_54t-r0 $(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS5835_54T_PLATFORM_MODULE))) diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/accton_psu_api.h b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/accton_psu_api.h new file mode 120000 index 0000000000..a6b156930a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/accton_psu_api.h @@ -0,0 +1 @@ +../../common/modules/accton_psu_api.h \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/accton_psu_defs.h b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/accton_psu_defs.h new file mode 120000 index 0000000000..96202b3ead --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/modules/accton_psu_defs.h @@ -0,0 +1 @@ +../../common/modules/accton_psu_defs.h \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/as4630-54pe-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/as4630-54pe-platform-monitor.service index 8ed60fca95..af3708518f 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/as4630-54pe-platform-monitor.service +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/service/as4630-54pe-platform-monitor.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS4630-54PE Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=sysinit.target DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/accton_psu_api.h b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/accton_psu_api.h new file mode 120000 index 0000000000..a6b156930a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/accton_psu_api.h @@ -0,0 +1 @@ +../../common/modules/accton_psu_api.h \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/accton_psu_defs.h b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/accton_psu_defs.h new file mode 120000 index 0000000000..96202b3ead --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/accton_psu_defs.h @@ -0,0 +1 @@ +../../common/modules/accton_psu_defs.h \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-cpld.c b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-cpld.c index 317eac3a4c..372bb94267 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-cpld.c +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-cpld.c @@ -412,7 +412,7 @@ static ssize_t set_tx_disable(struct device *dev, struct device_attribute *da, break; case MODULE_TXDISABLE_51 ... MODULE_TXDISABLE_52: reg=0x6; - mask=0x1 << (attr->index==MODULE_TXFAULT_51?7:3); + mask=0x1 << (attr->index==MODULE_TXDISABLE_51?7:3); break; default: diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-leds.c b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-leds.c index f4e2668348..af12dc3ba5 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-leds.c +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-leds.c @@ -405,7 +405,7 @@ static struct led_classdev accton_as4630_54te_leds[] = { .brightness_set = accton_as4630_54te_led_diag_set, .brightness_get = accton_as4630_54te_led_diag_get, .flags = LED_CORE_SUSPENDRESUME, - .max_brightness = LED_MODE_GREEN, + .max_brightness = LED_MODE_GREEN_BLINK, }, [LED_TYPE_PRI] = { .name = "pri", diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-psu.c b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-psu.c index 3a99f19a9c..5813d89185 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-psu.c +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/modules/x86-64-accton-as4630-54te-psu.c @@ -91,7 +91,6 @@ static ssize_t show_status(struct device *dev, struct device_attribute *da, struct as4630_54te_psu_data *data = as4630_54te_psu_update_device(dev); u8 status = 0; - //printk("data->status=0x%x, attr->index=%d,data->index=%d \n", data->status, attr->index, data->index); if (attr->index == PSU_PRESENT) { if(data->index==0) status = !( (data->status >> 5) & 0x1); @@ -102,7 +101,7 @@ static ssize_t show_status(struct device *dev, struct device_attribute *da, if(data->index==0) status = ( (data->status >> 6) & 0x1); else - status = ( (data->status >> 2) & 0x1); + status = ( (data->status >> 2) & 0x1); } return sprintf(buf, "%d\n", status); @@ -261,13 +260,14 @@ static struct as4630_54te_psu_data *as4630_54te_psu_update_device(struct device if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || !data->valid) { int status; + u8 serial_offset; int power_good = 0; dev_dbg(&client->dev, "Starting as4630_54te update\n"); /* Read psu status */ status = as4630_54te_cpld_read(0x60, 0x22); - //printk("status=0x%x in %s\n", status, __FUNCTION__); + if (status < 0) { dev_dbg(&client->dev, "cpld reg 0x60 err %d\n", status); } @@ -278,29 +278,49 @@ static struct as4630_54te_psu_data *as4630_54te_psu_update_device(struct device /* Read model name */ memset(data->model_name, 0, sizeof(data->model_name)); memset(data->serial_number, 0, sizeof(data->serial_number)); - power_good = (data->status >> (3-data->index) & 0x1); - + if(data->index==0) + power_good = ( (data->status >> 6) & 0x1); + else + power_good = ( (data->status >> 2) & 0x1); + if (power_good) { status = as4630_54te_psu_read_block(client, 0x20, data->model_name, - ARRAY_SIZE(data->model_name)-1); + ARRAY_SIZE(data->model_name)-1); + if (status < 0) { data->model_name[0] = '\0'; dev_dbg(&client->dev, "unable to read model name from (0x%x)\n", client->addr); - printk("unable to read model name from (0x%x)\n", client->addr); } else { + data->model_name[8] = '-'; data->model_name[ARRAY_SIZE(data->model_name)-1] = '\0'; - } - /* Read from offset 0x2e ~ 0x3d (16 bytes) */ - status = as4630_54te_psu_read_block(client, 0x35,data->serial_number, MAX_SERIAL_NUMBER); + if(!strncmp(data->model_name, "YM-1151D", strlen("YM-1151D"))) + { + if (!strncmp(data->model_name, "YM-1151D-A03R", strlen("YM-1151D-A03R"))) + { + data->model_name[strlen("YM-1151D-A03R")] = '\0'; + serial_offset = 0x2E; /* YM-1151D-A03R, F2B dir */ + } + else + { + data->model_name[strlen("YM-1151D-A02R")] = '\0'; + serial_offset = 0x35; /* YM-1151D-A02R, B2F dir */ + } + } + else + serial_offset = 0x2E; + + /* Read from offset 0x2e ~ 0x3f (16 bytes) */ + status = as4630_54te_psu_read_block(client, serial_offset, data->serial_number, MAX_SERIAL_NUMBER); if (status < 0) { data->serial_number[0] = '\0'; dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x2e)\n", client->addr); - printk("unable to read model name from (0x%x) offset(0x2e)\n", client->addr); } + data->serial_number[MAX_SERIAL_NUMBER-1]='\0'; + } data->last_updated = jiffies; diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/service/as4630-54te-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/service/as4630-54te-platform-monitor.service index 587e6a1caf..b0c5fe6a78 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/service/as4630-54te-platform-monitor.service +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/service/as4630-54te-platform-monitor.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS4630-54TE Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=sysinit.target DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/udev/70-persistent-net.rules b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/udev/70-persistent-net.rules new file mode 100644 index 0000000000..11ca59a6ff --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/udev/70-persistent-net.rules @@ -0,0 +1,3 @@ +ACTION=="add", SUBSYSTEM=="net", DRIVERS=="ixgbe", KERNELS=="0000:08:00.0", NAME:="eth0" +ACTION=="add", SUBSYSTEM=="net", DRIVERS=="ixgbe", KERNELS=="0000:06:00.1", NAME:="eth1" +ACTION=="add", SUBSYSTEM=="net", DRIVERS=="ixgbe", KERNELS=="0000:06:00.0", NAME:="eth3" \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor.py index aa5076c2ca..9258561ef5 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/accton_as4630_54te_monitor.py @@ -20,12 +20,14 @@ # ------------------------------------------------------------------ try: + import os import sys import getopt import logging import logging.config import logging.handlers import time + import subprocess from as4630_54te.fanutil import FanUtil from as4630_54te.thermalutil import ThermalUtil except ImportError as e: @@ -87,6 +89,9 @@ class device_monitor(object): def __init__(self, log_file, log_level): """Needs a logger and a logger level.""" + + self.thermal = ThermalUtil() + self.fan = FanUtil() # set up logging to file logging.basicConfig( filename=log_file, @@ -138,8 +143,8 @@ def manage_fans(self): LEVEL_TEMP_CRITICAL: [100, 16, 240000, 300000], } temp = [0, 0, 0] - thermal = ThermalUtil() - fan = FanUtil() + thermal = self.thermal + fan = self.fan ori_duty_cycle = fan.get_fan_duty_cycle() new_duty_cycle = 0 @@ -192,11 +197,19 @@ def manage_fans(self): if temp[0] >= 70000: # LM75-48 # critical case*/ logging.critical( - 'Alarm-Critical for temperature critical is detected, reset DUT') - cmd_str = ["i2cset", "-y", "-f", "3", "0x60", "0x4", "0xE4"] + 'Alarm-Critical for temperature critical is detected, shutdown DUT') + + # Sync log buffer to disk + cmd_str="sync" + status, output = subprocess.getstatusoutput(cmd_str) + cmd_str="/sbin/fstrim -av" + status, output = subprocess.getstatusoutput(cmd_str) + time.sleep(3) + + cmd_str = ["i2cset", "-y", "-f", "3", "0x60", "0x4", "0x74"] time.sleep(2) return_value = subprocess.call(cmd_str) - logging.warning('Fan set: i2cset -y -f 3 0x60 0x4 0xE4, status is %d', return_value) + logging.warning('Fan set: i2cset -y -f 3 0x60 0x4 0x74, status is %d', return_value) #logging.debug('ori_state=%d, current_state=%d, temp_val=%d\n\n',ori_state, fan_policy_state, temp_val) diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/handle_mgmt_interface.sh b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/handle_mgmt_interface.sh index 82f4d5e021..cdc3c04fcc 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/handle_mgmt_interface.sh +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/handle_mgmt_interface.sh @@ -1,8 +1,7 @@ #!/bin/bash -#Due to the hardware design, as4630-54te use "eth2" instead of "eth0" as management interface. -#Rename netdev "eth0" and "eth2" to swap original "eth2" to "eth0". -ifconfig eth0 down -ip link set eth0 name eth3 -ip link set eth2 name eth0 -ifconfig eth0 up +# Re-install the igb and ixgbe again to make the NIC sequence follow the udev rule +modprobe -r igb +modprobe -r ixgbe +modprobe igb +modprobe ixgbe \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/restart_ixgbe.sh b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/restart_ixgbe.sh new file mode 100755 index 0000000000..57c14e5ba0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54te/utils/restart_ixgbe.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +/etc/init.d/netfilter-persistent stop +modprobe -r ixgbe +udevadm control --reload-rules +udevadm trigger +modprobe ixgbe +/etc/init.d/netfilter-persistent start diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/service/as5712-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/service/as5712-platform-monitor.service index da5d283a6d..d96842b9dc 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/service/as5712-platform-monitor.service +++ b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/service/as5712-platform-monitor.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS5712-54X Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=sysinit.target DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as5812-54t/service/as5812-platform-init.service b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/service/as5812-platform-init.service index 91c9adb01c..34bfe092d6 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5812-54t/service/as5812-platform-init.service +++ b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/service/as5812-platform-init.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS5812-54X Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=sysinit.target DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as5812-54x/service/as5812-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as5812-54x/service/as5812-platform-monitor.service index 91c9adb01c..34bfe092d6 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5812-54x/service/as5812-platform-monitor.service +++ b/platform/broadcom/sonic-platform-modules-accton/as5812-54x/service/as5812-platform-monitor.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS5812-54X Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=sysinit.target DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54t/service/as5835-54t-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as5835-54t/service/as5835-54t-platform-monitor.service index 9789201034..cba9bcf05b 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54t/service/as5835-54t-platform-monitor.service +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54t/service/as5835-54t-platform-monitor.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS5835-54T Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=sysinit.target DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/classes/fanutil.py index b8b4820f9e..c67b5bb67f 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/classes/fanutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/classes/fanutil.py @@ -42,7 +42,7 @@ class FanUtil(object): FAN_NODE_NUM_OF_MAP = 2 FAN_NODE_FAULT_IDX_OF_MAP = 1 FAN_NODE_DIR_IDX_OF_MAP = 2 - + BASE_VAL_PATH = '/sys/bus/i2c/devices/3-0063/{0}' FAN_DUTY_PATH = '/sys/bus/i2c/devices/3-0063/fan_duty_cycle_percentage' @@ -54,12 +54,7 @@ class FanUtil(object): key2 = fan node index (interger) starting from 1 value = path to fan device file (string) """ _fan_to_device_path_mapping = {} - -#fan1_direction -#fan1_fault -#fan1_present - #(FAN_NUM_2_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan2_duty_cycle_percentage', _fan_to_device_node_mapping = { (FAN_NUM_1_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan1_fault', (FAN_NUM_1_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan1_direction', @@ -174,14 +169,10 @@ def get_fan_to_device_path(self, fan_num, node_num): def get_fan_fault(self, fan_num): return self._get_fan_node_val(fan_num, self.FAN_NODE_FAULT_IDX_OF_MAP) - #def get_fan_speed(self, fan_num): - # return self._get_fan_node_val(fan_num, self.FAN_NODE_SPEED_IDX_OF_MAP) - def get_fan_dir(self, fan_num): return self._get_fan_node_val(fan_num, self.FAN_NODE_DIR_IDX_OF_MAP) def get_fan_duty_cycle(self): - #duty_path = self.FAN_DUTY_PATH try: val_file = open(self.FAN_DUTY_PATH) except IOError as e: @@ -203,9 +194,6 @@ def set_fan_duty_cycle(self, val): fan_file.close() return True - #def get_fanr_fault(self, fan_num): - # return self._get_fan_node_val(fan_num, self.FANR_NODE_FAULT_IDX_OF_MAP) - def get_fanr_speed(self, fan_num): return self._get_fan_node_val(fan_num, self.FANR_NODE_SPEED_IDX_OF_MAP) @@ -218,9 +206,5 @@ def get_fan_status(self, fan_num): logging.debug('GET. FAN fault. fan_num, %d', fan_num) return False - #if self.get_fanr_fault(fan_num) is not None and self.get_fanr_fault(fan_num) > 0: - # logging.debug('GET. FANR fault. fan_num, %d', fan_num) - # return False - return True diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/modules/Makefile index ec29de5fe7..eafc97032e 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/modules/Makefile +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/modules/Makefile @@ -1,8 +1,11 @@ ifneq ($(KERNELRELEASE),) obj-m:= accton_as5835_54x_cpld.o accton_as5835_54x_psu.o \ accton_as5835_54x_fan.o accton_as5835_54x_leds.o \ - ym2651y.o + ym2651y.o pddf_custom_psu.o +CFLAGS_pddf_custom_psu.o := -I$(M)/../../../../pddf/i2c/modules/include +KBUILD_EXTRA_SYMBOLS := $(M)/../../../../pddf/i2c/Module.symvers.PDDF + else ifeq (,$(KERNEL_SRC)) $(error KERNEL_SRC is not defined) diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/modules/accton_psu_api.h b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/modules/accton_psu_api.h new file mode 120000 index 0000000000..a6b156930a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/modules/accton_psu_api.h @@ -0,0 +1 @@ +../../common/modules/accton_psu_api.h \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/modules/accton_psu_defs.h b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/modules/accton_psu_defs.h new file mode 120000 index 0000000000..96202b3ead --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/modules/accton_psu_defs.h @@ -0,0 +1 @@ +../../common/modules/accton_psu_defs.h \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/modules/pddf_custom_psu.c b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/modules/pddf_custom_psu.c new file mode 100644 index 0000000000..1591267b01 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/modules/pddf_custom_psu.c @@ -0,0 +1,117 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "pddf_psu_defs.h" + +ssize_t pddf_show_custom_psu_v_out(struct device *dev, struct device_attribute *da, char *buf); +extern PSU_SYSFS_ATTR_DATA access_psu_v_out; + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + +static u8 psu_get_vout_mode(struct i2c_client *client) +{ + u8 status = 0, retry = 10; + uint8_t offset = 0x20; // VOUT_MODE + + while (retry) { + status = i2c_smbus_read_byte_data((struct i2c_client *)client, offset); + if (unlikely(status < 0)) { + msleep(60); + retry--; + continue; + } + break; + } + + if (status < 0) + { + printk(KERN_ERR "%s: Get PSU Vout mode failed\n", __func__); + return 0; + } + else + { + /*printk(KERN_ERR "%s: vout_mode reg value 0x%x\n", __func__, status);*/ + return status; + } +} + +static u16 psu_get_v_out(struct i2c_client *client) +{ + u16 status = 0, retry = 10; + uint8_t offset = 0x8b; // READ_VOUT + + while (retry) { + status = i2c_smbus_read_word_data((struct i2c_client *)client, offset); + if (unlikely(status < 0)) { + msleep(60); + retry--; + continue; + } + break; + } + + if (status < 0) + { + printk(KERN_ERR "%s: Get PSU Vout failed\n", __func__); + return 0; + } + else + { + /*printk(KERN_ERR "%s: vout reg value 0x%x\n", __func__, status);*/ + return status; + } +} + +ssize_t pddf_show_custom_psu_v_out(struct device *dev, struct device_attribute *da, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + int exponent, mantissa; + int multiplier = 1000; + + u16 value = psu_get_v_out(client); + u8 vout_mode = psu_get_vout_mode(client); + + exponent = two_complement_to_int(vout_mode, 5, 0x1f); + mantissa = value; + if (exponent >= 0) + return sprintf(buf, "%d\n", (mantissa << exponent) * multiplier); + else + return sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + + + +static int __init pddf_custom_psu_init(void) +{ + access_psu_v_out.show = pddf_show_custom_psu_v_out; + access_psu_v_out.do_get = NULL; + return 0; +} + +static void __exit pddf_custom_psu_exit(void) +{ + return; +} + +MODULE_AUTHOR("Broadcom"); +MODULE_DESCRIPTION("pddf custom psu api"); +MODULE_LICENSE("GPL"); + +module_init(pddf_custom_psu_init); +module_exit(pddf_custom_psu_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/service/as5835-54x-pddf-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/service/as5835-54x-pddf-platform-monitor.service new file mode 100644 index 0000000000..ddd8d6abbb --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/service/as5835-54x-pddf-platform-monitor.service @@ -0,0 +1,16 @@ +[Unit] +Description=Accton AS5835-54X Platform Monitoring service +Before=pmon.service +After=pddf-platform-init.service +DefaultDependencies=no + +[Service] +ExecStart=/usr/local/bin/accton_as5835_54x_pddf_monitor.py +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/service/as5835-54x-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/service/as5835-54x-platform-monitor.service index d522a0ca53..5e0805a598 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/service/as5835-54x-platform-monitor.service +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/service/as5835-54x-platform-monitor.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS5835-54X Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=sysinit.target DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/service/pddf-platform-init.service b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/service/pddf-platform-init.service new file mode 120000 index 0000000000..0fd9f25b6c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/service/pddf-platform-init.service @@ -0,0 +1 @@ +../../../../pddf/i2c/service/pddf-platform-init.service \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/__init__.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/__init__.py new file mode 100644 index 0000000000..cdc3b813f6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/__init__.py @@ -0,0 +1,3 @@ +# All the derived classes for PDDF +__all__ = ["platform", "chassis", "sfp", "psu", "thermal", "fan"] +from . import platform diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/chassis.py new file mode 100644 index 0000000000..9bd98ed18c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/chassis.py @@ -0,0 +1,128 @@ +#!/usr/bin/env python + +############################################################################# +# PDDF +# Module contains an implementation of SONiC Chassis API +# +############################################################################# + +try: + import sys + from sonic_platform_pddf_base.pddf_chassis import PddfChassis + from .event import SfpEvent + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +NUM_COMPONENT = 6 +HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/" +PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" +REBOOT_CAUSE_FILE = "reboot-cause.txt" + +class Chassis(PddfChassis): + """ + PDDF Platform-specific Chassis class + """ + + SYSLED_DEV_NAME = "DIAG_LED" + + def __init__(self, pddf_data=None, pddf_plugin_data=None): + PddfChassis.__init__(self, pddf_data, pddf_plugin_data) + self.__initialize_components() + self._api_helper = APIHelper() + self._sfpevent = SfpEvent(self.get_all_sfps()) + + def __initialize_components(self): + from sonic_platform.component import Component + for index in range(NUM_COMPONENT): + component = Component(index) + self._component_list.append(component) + + # Provide the functions/variables below for which implementation is to be overwritten + def get_change_event(self, timeout=0): + return self._sfpevent.get_sfp_event(timeout) + + 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. + """ + + reboot_cause_path = (HOST_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE) + sw_reboot_cause = self._api_helper.read_txt_file( + reboot_cause_path) or "Unknown" + + + return ('REBOOT_CAUSE_NON_HARDWARE', sw_reboot_cause) + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return -1 + + + def get_sfp(self, index): + """ + Retrieves sfp represented by (1-based) index + + Args: + index: An integer, the index (1-based) of the sfp to retrieve. + The index should be the sequence of a physical port in a chassis, + starting from 1. + For example, 1 for Ethernet0, 2 for Ethernet4 and so on. + + Returns: + An object derived from SfpBase representing the specified sfp + """ + sfp = None + + try: + # The index will start from 1 + sfp = self._sfp_list[index-1] + except IndexError: + sys.stderr.write("SFP index {} out of range (1-{})\n".format( + index, len(self._sfp_list))) + return sfp + + def initizalize_system_led(self): + return + + def get_status_led(self): + return self.get_system_led(self.SYSLED_DEV_NAME) + + def set_status_led(self, color): + return self.set_system_led(self.SYSLED_DEV_NAME, color) + + def get_port_or_cage_type(self, port): + from sonic_platform_base.sfp_base import SfpBase + if port in range(1, 49): + return SfpBase.SFP_PORT_TYPE_BIT_SFP | SfpBase.SFP_PORT_TYPE_BIT_SFP_PLUS + else: + return SfpBase.SFP_PORT_TYPE_BIT_QSFP | SfpBase.SFP_PORT_TYPE_BIT_QSFP_PLUS | SfpBase.SFP_PORT_TYPE_BIT_QSFP28 + + + def get_revision(self): + """ + Retrieves the hardware revision of the device + + Returns: + string: Revision value of device + """ + return 'N/A' \ No newline at end of file diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/component.py similarity index 79% rename from device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/component.py rename to platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/component.py index 75c2d3b918..d0932600c1 100644 --- a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/component.py @@ -1,36 +1,41 @@ ############################################################################# -# Edgecore -# +# # Component contains an implementation of SONiC Platform Base API and # provides the components firmware management function # ############################################################################# try: + import subprocess from sonic_platform_base.component_base import ComponentBase except ImportError as e: raise ImportError(str(e) + "- required module not found") CPLD_ADDR_MAPPING = { - "CPLD-1": "18-0060", - "CPLD-2": "12-0062", - "CPLD-3": "19-0064", + "MB_CPLD1": ['3', '0x60'], + "MB_CPLD2": ['3', '0x61'], + "MB_CPLD3": ['3', '0x62'], + "FAN_CPLD": ['3', '0x63'], + "CPU_CPLD": ['1', '0x65'] } SYSFS_PATH = "/sys/bus/i2c/devices/" BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version" -COMPONENT_NAME_LIST = ["CPLD-1", "CPLD-2", "CPLD-3", "BIOS"] -COMPONENT_DES_LIST = [ - "CPLD-1", "CPLD-2", "CPLD-3", "Basic Input/Output System" +COMPONENT_LIST= [ + ("MB_CPLD1", "Mainboard CPLD(0x60)"), + ("MB_CPLD2", "Mainboard CPLD(0x61)"), + ("MB_CPLD3", "Mainboard CPLD(0x62)"), + ("FAN_CPLD", "Fan board CPLD(0x63)"), + ("CPU_CPLD", "CPU CPLD(0x65)"), + ("BIOS", "Basic Input/Output System") + ] - class Component(ComponentBase): """Platform-specific Component class""" DEVICE_TYPE = "component" def __init__(self, component_index=0): - ComponentBase.__init__(self) self.index = component_index self.name = self.get_name() @@ -42,26 +47,16 @@ def __get_bios_version(self): return bios_version.strip() except Exception as e: return None - - def __get_sysfs_value(self, addr, name): - # Retrieves the cpld register value - try: - with open(SYSFS_PATH + addr + '/' + name, 'r') as fd: - return fd.read().strip() - except Exception as e: - return None - + def __get_cpld_version(self): # Retrieves the CPLD firmware version cpld_version = dict() for cpld_name in CPLD_ADDR_MAPPING: - try: - cpld_addr = CPLD_ADDR_MAPPING[cpld_name] - cpld_version_raw = self.__get_sysfs_value(cpld_addr, "version") - cpld_version[cpld_name] = "{}".format( - int(cpld_version_raw, 16)) - except Exception as e: - cpld_version[cpld_name] = 'None' + cmd = "i2cget -f -y {0} {1} 0x1".format(CPLD_ADDR_MAPPING[cpld_name][0], CPLD_ADDR_MAPPING[cpld_name][1]) + status, value = subprocess.getstatusoutput(cmd) + if not status: + cpld_version_raw = value.rstrip() + cpld_version[cpld_name] = "{}".format(int(cpld_version_raw,16)) return cpld_version @@ -71,7 +66,7 @@ def get_name(self): Returns: A string containing the name of the component """ - return COMPONENT_NAME_LIST[self.index] + return COMPONENT_LIST[self.index][0] def get_description(self): """ @@ -79,7 +74,7 @@ def get_description(self): Returns: A string containing the description of the component """ - return COMPONENT_DES_LIST[self.index] + return COMPONENT_LIST[self.index][1] def get_firmware_version(self): """ diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/eeprom.py new file mode 100644 index 0000000000..a87ecc9f6f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/eeprom.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +try: + from sonic_platform_pddf_base.pddf_eeprom import PddfEeprom +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Eeprom(PddfEeprom): + + def __init__(self, pddf_data=None, pddf_plugin_data=None): + PddfEeprom.__init__(self, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/event.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/event.py similarity index 94% rename from device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/event.py rename to platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/event.py index 3d6f81518a..d5dac6d7f7 100644 --- a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/event.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/event.py @@ -18,7 +18,7 @@ def get_presence_bitmap(self): bitmap = 0 for sfp in self._sfp_list: modpres = sfp.get_presence() - i=sfp.port_num-1 + i=sfp.get_position_in_parent() - 1 if modpres: bitmap = bitmap | (1 << i) return bitmap @@ -45,7 +45,7 @@ def get_sfp_event(self, timeout=2000): if changed_ports != 0: for sfp in self._sfp_list: - i=sfp.port_num-1 + i=sfp.get_position_in_parent() - 1 if (changed_ports & (1 << i)): if (bitmap & (1 << i)) == 0: port_dict[i+1] = '0' diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/fan.py new file mode 100644 index 0000000000..7aa6ebb387 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/fan.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python + + +try: + from sonic_platform_pddf_base.pddf_fan import PddfFan +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +FAN_NAME_LIST = ["FAN-1F", "FAN-1R", "FAN-2F", "FAN-2R", + "FAN-3F", "FAN-3R", "FAN-4F", "FAN-4R", + "FAN-5F", "FAN-5R"] + +class Fan(PddfFan): + """PDDF Platform-Specific Fan class""" + + def __init__(self, tray_idx, fan_idx=0, pddf_data=None, pddf_plugin_data=None, is_psu_fan=False, psu_index=0): + # idx is 0-based + PddfFan.__init__(self, tray_idx, fan_idx, pddf_data, pddf_plugin_data, is_psu_fan, psu_index) + + # Provide the functions/variables below for which implementation is to be overwritten + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + fan_name = FAN_NAME_LIST[(self.fantray_index-1)*2 + self.fan_index-1] \ + if not self.is_psu_fan \ + else "PSU-{} FAN-{}".format(self.fans_psu_index, self.fan_index) + + return fan_name + + + + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + + return "N/A" + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return "N/A" + + 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) + """ + if self.is_psu_fan: + return super().get_speed() + else: + return super().get_target_speed() diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/fan_drawer.py new file mode 100644 index 0000000000..e4e37f9620 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/fan_drawer.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python + + +try: + from sonic_platform_pddf_base.pddf_fan_drawer import PddfFanDrawer +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class FanDrawer(PddfFanDrawer): + """PDDF Platform-Specific Fan-Drawer class""" + + def __init__(self, tray_idx, pddf_data=None, pddf_plugin_data=None): + # idx is 0-based + PddfFanDrawer.__init__(self, tray_idx, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten + def get_name(self): + """ + Retrieves the fan drawer name + Returns: + string: The name of the device + """ + return "FanTray{}".format(self.fantray_index) + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self._fan_list[0].get_model() + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return self._fan_list[0].get_serial() + diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/helper.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/helper.py new file mode 100644 index 0000000000..24c8739340 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/helper.py @@ -0,0 +1,318 @@ +import os +import struct +import json +import fcntl +from mmap import * +from sonic_py_common import device_info +from sonic_py_common import logger +from threading import Lock +from typing import cast +from sonic_py_common.general import getstatusoutput_noshell_pipe +from sonic_py_common.general import getstatusoutput_noshell + +HOST_CHK_CMD = ["docker"] +EMPTY_STRING = "" + + +class APIHelper(): + + def __init__(self): + (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() + + def is_host(self): + try: + status, output = getstatusoutput_noshell(HOST_CHK_CMD) + return status == 0 + except Exception: + return False + + def pci_get_value(self, resource, offset): + status = True + result = "" + try: + fd = os.open(resource, os.O_RDWR) + mm = mmap(fd, 0) + mm.seek(int(offset)) + read_data_stream = mm.read(4) + result = struct.unpack('I', read_data_stream) + except Exception: + status = False + return status, result + + def read_txt_file(self, file_path): + try: + with open(file_path, 'r', errors='replace') as fd: + data = fd.read() + ret = data.strip() + if len(ret) > 0: + return ret + except IOError: + pass + return None + + 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 + +class FileLock: + """ + Due to pmon docker not installing the py-filelock, this class + implements a simple file lock feature. + Ref: https://github.com/tox-dev/py-filelock/blob/main/src/filelock/ + """ + + def __init__(self, lock_file): + self._lock_file = lock_file + self._thread_lock = Lock() + self.is_locked = False + + def acquire(self): + with self._thread_lock: + if self.is_locked: + return + + fd = os.open(self._lock_file, flags=(os.O_RDWR | os.O_CREAT | os.O_TRUNC)) + fcntl.flock(fd, fcntl.LOCK_EX) + self._lock_file_fd = fd + self.is_locked = True + + def release(self): + with self._thread_lock: + if self.is_locked: + fd = cast(int, self._lock_file_fd) + self._lock_file_fd = None + fcntl.flock(fd, fcntl.LOCK_UN) + os.close(fd) + self.is_locked = False + + def __enter__(self): + self.acquire() + return self + + def __exit__(self, exc_type, exc_val, traceback): + self.release() + + def __del__(self): + self.release() + + +DEVICE_THRESHOLD_JSON_PATH = "/tmp/device_threshold.json" + +class DeviceThreshold: + HIGH_THRESHOLD = 'high_threshold' + LOW_THRESHOLD = 'low_threshold' + HIGH_CRIT_THRESHOLD = 'high_critical_threshold' + LOW_CRIT_THRESHOLD = 'low_critical_threshold' + NOT_AVAILABLE = 'N/A' + + def __init__(self, th_name = NOT_AVAILABLE): + self.flock = FileLock("{}.lock".format(DEVICE_THRESHOLD_JSON_PATH)) + self.name = th_name + self.__log = logger.Logger(log_identifier="DeviceThreshold") + + self.__db_data = {} + self.__db_mtime = 0 + + def __reload_db(self): + try: + db_data = {} + with self.flock: + with open(DEVICE_THRESHOLD_JSON_PATH, "r") as db_file: + db_data = json.load(db_file) + except Exception as e: + self.__log.log_warning('{}'.format(str(e))) + return None + + return db_data + + def __get_data(self, field): + """ + Retrieves data frome JSON file by field + + Args : + field: String + + Returns: + A string if getting is successfully, 'N/A' if not + """ + if os.path.exists(DEVICE_THRESHOLD_JSON_PATH): + new_mtime = os.path.getmtime(DEVICE_THRESHOLD_JSON_PATH) + if new_mtime != self.__db_mtime: + new_data = self.__reload_db() + if new_data is not None: + self.__db_data = new_data + self.__db_mtime = new_mtime + + if self.name not in self.__db_data.keys(): + return self.NOT_AVAILABLE + + if field not in self.__db_data[self.name].keys(): + return self.NOT_AVAILABLE + + return self.__db_data[self.name][field] + + def __set_data(self, field, new_val): + """ + Set data to JSON file by field + + Args : + field: String + new_val: String + + Returns: + A boolean, True if setting is set successfully, False if not + """ + if self.name not in self.__db_data.keys(): + self.__db_data[self.name] = {} + + old_val = self.__db_data[self.name].get(field, None) + if old_val is not None and old_val == new_val: + return True + + self.__db_data[self.name][field] = new_val + + try: + with self.flock: + db_data = {} + mode = "r+" if os.path.exists(DEVICE_THRESHOLD_JSON_PATH) else "w+" + with open(DEVICE_THRESHOLD_JSON_PATH, mode) as db_file: + if mode == "r+": + db_data = json.load(db_file) + + if self.name not in db_data.keys(): + db_data[self.name] = {} + + db_data[self.name][field] = new_val + + if mode == "r+": + db_file.seek(0) + # erase old data + db_file.truncate(0) + # write all data + json.dump(db_data, db_file, indent=4) + self.__db_mtime = os.path.getmtime(DEVICE_THRESHOLD_JSON_PATH) + except Exception as e: + self.__log.log_error('{}'.format(str(e))) + return False + + return True + + def get_high_threshold(self): + """ + Retrieves the high threshold temperature from JSON file. + + Returns: + string : the high threshold temperature of thermal, + e.g. "30.125" + """ + return self.__get_data(self.HIGH_THRESHOLD) + + def set_high_threshold(self, temperature): + """ + Sets the high threshold temperature of thermal + Args : + temperature: A string of temperature, e.g. "30.125" + Returns: + A boolean, True if threshold is set successfully, False if not + """ + if isinstance(temperature, str) is not True: + raise TypeError('The parameter requires string type.') + + try: + if temperature != self.NOT_AVAILABLE: + float(temperature) + except ValueError: + raise ValueError('The parameter requires a float string. ex:\"30.1\"') + + return self.__set_data(self.HIGH_THRESHOLD, temperature) + + def get_low_threshold(self): + """ + Retrieves the low threshold temperature from JSON file. + + Returns: + string : the low threshold temperature of thermal, + e.g. "30.125" + """ + return self.__get_data(self.LOW_THRESHOLD) + + def set_low_threshold(self, temperature): + """ + Sets the low threshold temperature of thermal + Args : + temperature: A string of temperature, e.g. "30.125" + Returns: + A boolean, True if threshold is set successfully, False if not + """ + if isinstance(temperature, str) is not True: + raise TypeError('The parameter requires string type.') + + try: + if temperature != self.NOT_AVAILABLE: + float(temperature) + except ValueError: + raise ValueError('The parameter requires a float string. ex:\"30.1\"') + + return self.__set_data(self.LOW_THRESHOLD, temperature) + + def get_high_critical_threshold(self): + """ + Retrieves the high critical threshold temperature from JSON file. + + Returns: + string : the high critical threshold temperature of thermal, + e.g. "30.125" + """ + return self.__get_data(self.HIGH_CRIT_THRESHOLD) + + def set_high_critical_threshold(self, temperature): + """ + Sets the high critical threshold temperature of thermal + Args : + temperature: A string of temperature, e.g. "30.125" + Returns: + A boolean, True if threshold is set successfully, False if not + """ + if isinstance(temperature, str) is not True: + raise TypeError('The parameter requires string type.') + + try: + if temperature != self.NOT_AVAILABLE: + float(temperature) + except ValueError: + raise ValueError('The parameter requires a float string. ex:\"30.1\"') + + return self.__set_data(self.HIGH_CRIT_THRESHOLD, temperature) + + def get_low_critical_threshold(self): + """ + Retrieves the low critical threshold temperature from JSON file. + + Returns: + string : the low critical threshold temperature of thermal, + e.g. "30.125" + """ + return self.__get_data(self.LOW_CRIT_THRESHOLD) + + def set_low_critical_threshold(self, temperature): + """ + Sets the low critical threshold temperature of thermal + Args : + temperature: A string of temperature, e.g. "30.125" + Returns: + A boolean, True if threshold is set successfully, False if not + """ + if isinstance(temperature, str) is not True: + raise TypeError('The parameter requires string type.') + + try: + if temperature != self.NOT_AVAILABLE: + float(temperature) + except ValueError: + raise ValueError('The parameter requires a float string. ex:\"30.1\"') + + return self.__set_data(self.LOW_CRIT_THRESHOLD, temperature) diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/pcie.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/pcie.py new file mode 100644 index 0000000000..e4da32adf9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/pcie.py @@ -0,0 +1,19 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the fan status which are available in the platform +# Base PCIe class +############################################################################# + +try: + from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Pcie(PcieUtil): + """Edgecore Platform-specific PCIe class""" + + def __init__(self, platform_path): + PcieUtil.__init__(self, platform_path) diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/platform.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/platform.py new file mode 100644 index 0000000000..406b1179ae --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/platform.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +############################################################################# +# PDDF +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + + +try: + from sonic_platform_pddf_base.pddf_platform import PddfPlatform +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PddfPlatform): + """ + PDDF Platform-Specific Platform Class + """ + + def __init__(self): + PddfPlatform.__init__(self) + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/psu.py new file mode 100644 index 0000000000..a05923cc83 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/psu.py @@ -0,0 +1,130 @@ +#!/usr/bin/env python +# + + +try: + from sonic_platform_pddf_base.pddf_psu import PddfPsu +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + + +class Psu(PddfPsu): + """PDDF Platform-Specific PSU class""" + + PLATFORM_PSU_CAPACITY = 1200 + + def __init__(self, index, pddf_data=None, pddf_plugin_data=None): + PddfPsu.__init__(self, index, pddf_data, pddf_plugin_data) + + # Provide the functions/variables below for which implementation is to be overwritten + def get_voltage_high_threshold(self): + """ + Retrieves the high threshold PSU voltage output + Returns: + A float number, the high threshold output voltage in volts, + e.g. 12.1 + """ + return 14.72 + + def get_voltage_low_threshold(self): + """ + Retrieves the low threshold PSU voltage output + Returns: + A float number, the low threshold output voltage in volts, + e.g. 12.1 + """ + return 7.68 + + def get_name(self): + return "PSU-{}".format(self.psu_index) + + def get_maximum_supplied_power(self): + """ + Retrieves the maximum supplied power by PSU (or PSU capacity) + Returns: + A float number, the maximum power output in Watts. + e.g. 1200.1 + """ + return float(self.PLATFORM_PSU_CAPACITY) + + def get_capacity(self): + """ + Gets the capacity (maximum output power) of the PSU in watts + + Returns: + An integer, the capacity of PSU + """ + return (self.PLATFORM_PSU_CAPACITY) + + def get_type(self): + """ + Gets the type of the PSU + Returns: + A string, the type of PSU (AC/DC) + """ + return "AC" + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + + Returns: + string: Model/part number of device + """ + model = super().get_model() + if model and model.strip() == "": + return None + + return model + + def get_serial(self): + """ + Retrieves the serial number of the device + + Returns: + string: Serial number of device + """ + serial = super().get_serial() + if serial and serial.strip() == "": + return None + + return serial + + def get_voltage(self): + """ + Retrieves current PSU voltage output + + Returns: + A float number, the output voltage in volts, + e.g. 12.1 + """ + if self.get_status() is not True: + return 0.0 + + return super().get_voltage() + + def get_current(self): + """ + Retrieves present electric current supplied by PSU + + Returns: + A float number, electric current in amperes, + e.g. 15.4 + """ + if self.get_status() is not True: + return 0.0 + + return super().get_current() + + def get_power(self): + """ + Retrieves current energy supplied by PSU + + Returns: + A float number, the power in watts, + e.g. 302.6 + """ + if self.get_status() is not True: + return 0.0 + + return super().get_power() diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/sfp.py new file mode 100644 index 0000000000..b94e5d257c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/sfp.py @@ -0,0 +1,197 @@ +#!/usr/bin/env python + +try: + import natsort + from sonic_platform_pddf_base.pddf_sfp import PddfSfp + from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper + from sonic_py_common import device_info +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + + +class Sfp(PddfSfp): + """ + PDDF Platform-Specific Sfp class + """ + + SFP_TYPE_CODE_LIST = [ + 0x03, # SFP/SFP+/SFP28 + 0x0b # DWDM-SFP/SFP+ + ] + QSFP_TYPE_CODE_LIST = [ + 0x0c, # QSFP + 0x0d, # QSFP+ or later + 0x11, # QSFP28 or later + 0xe1 # QSFP28 EDFA + ] + + def __init__(self, index, pddf_data=None, pddf_plugin_data=None): + PddfSfp.__init__(self, index, pddf_data, pddf_plugin_data) + self.index = index + 1 + + # Provide the functions/variables below for which implementation is to be overwritten + def __get_path_to_port_config_file(self): + platform, hwsku = device_info.get_platform_and_hwsku() + hwsku_path = "/".join(["/usr/share/sonic/platform",hwsku]) + return "/".join([hwsku_path, "port_config.ini"]) + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + sfputil_helper = SfpUtilHelper() + sfputil_helper.read_porttab_mappings( + self.__get_path_to_port_config_file()) + + logical_port_list = sfputil_helper.logical + logical_port_list = natsort.natsorted(logical_port_list) + name = logical_port_list[self.port_index-1] or "Unknown" + + return name + + def get_position_in_parent(self): + """Retrieves 1-based relative physical position in parent device.""" + return self.port_index + + def __validate_eeprom_sfp(self): + checksum_test = 0 + eeprom_raw = self.read_eeprom(0, 96) + if eeprom_raw is None: + return None + + for i in range(0, 63): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[63]: + return False + + checksum_test = 0 + for i in range(64, 95): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[95]: + return False + + api = self.get_xcvr_api() + if api is None: + return False + + if api.is_flat_memory(): + return True + + checksum_test = 0 + eeprom_raw = self.read_eeprom(384, 96) + if eeprom_raw is None: + return None + + for i in range(0, 95): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[95]: + return False + + return True + + def __validate_eeprom_qsfp(self): + checksum_test = 0 + eeprom_raw = self.read_eeprom(128, 96) + if eeprom_raw is None: + return None + + for i in range(0, 63): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[63]: + return False + + checksum_test = 0 + for i in range(64, 95): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[95]: + return False + + api = self.get_xcvr_api() + if api is None: + return False + + if api.is_flat_memory(): + return True + + return True + + def validate_eeprom(self): + id_byte_raw = self.read_eeprom(0, 1) + if id_byte_raw is None: + return None + + id = id_byte_raw[0] + if id in self.QSFP_TYPE_CODE_LIST: + return self.__validate_eeprom_qsfp() + elif id in self.SFP_TYPE_CODE_LIST: + return self.__validate_eeprom_sfp() + else: + return False + + def validate_temperature(self): + temperature = self.get_temperature() + if temperature is None: + return None + + threshold_dict = self.get_transceiver_threshold_info() + if threshold_dict is None: + return None + + if isinstance(temperature, float) is not True: + return True + + if isinstance(threshold_dict['temphighalarm'], float) is not True: + return True + + return threshold_dict['temphighalarm'] > temperature + + def __get_error_description(self): + if not self.get_presence(): + return self.SFP_STATUS_UNPLUGGED + + err_stat = self.SFP_STATUS_BIT_INSERTED + + status = self.validate_eeprom() + if status is not True: + err_stat = (err_stat | self.SFP_ERROR_BIT_BAD_EEPROM) + + status = self.validate_temperature() + if status is not True: + err_stat = (err_stat | self.SFP_ERROR_BIT_HIGH_TEMP) + + if err_stat is self.SFP_STATUS_BIT_INSERTED: + return self.SFP_STATUS_OK + else: + err_desc = '' + cnt = 0 + for key in self.SFP_ERROR_BIT_TO_DESCRIPTION_DICT: + if (err_stat & key) != 0: + if cnt > 0: + err_desc = err_desc + "|" + cnt = cnt + 1 + err_desc = err_desc + self.SFP_ERROR_BIT_TO_DESCRIPTION_DICT[key] + + return err_desc + + def get_error_description(self): + """ + Retrives the error descriptions of the SFP module + Returns: + String that represents the current error descriptions of vendor specific errors + In case there are multiple errors, they should be joined by '|', + like: "Bad EEPROM|Unsupported cable" + """ + try: + ret = super().get_error_description() + if ret is not None: + return ret + except NotImplementedError: + pass + return self.__get_error_description() diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/thermal.py new file mode 100644 index 0000000000..cdd6c0993e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/thermal.py @@ -0,0 +1,290 @@ +#!/usr/bin/env python + + +try: + from sonic_platform_pddf_base.pddf_thermal import PddfThermal + from .helper import DeviceThreshold +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +NOT_AVAILABLE = DeviceThreshold.NOT_AVAILABLE +HIGH_THRESHOLD = DeviceThreshold.HIGH_THRESHOLD +LOW_THRESHOLD = DeviceThreshold.LOW_THRESHOLD +HIGH_CRIT_THRESHOLD = DeviceThreshold.HIGH_CRIT_THRESHOLD +LOW_CRIT_THRESHOLD = DeviceThreshold.LOW_CRIT_THRESHOLD + +DEFAULT_THRESHOLD = { + 'CB_temp(0x4B)' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'MB_FrontMiddle_temp(0x4C)' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'MB_RearLeft_temp(0x49)' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'MB_RearLeft_temp(0x4A)' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'CPU_Package_temp' : { + HIGH_THRESHOLD : '82.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : '104.0', + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'CPU_Core_0_temp' : { + HIGH_THRESHOLD : '82.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : '104.0', + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'CPU_Core_1_temp' : { + HIGH_THRESHOLD : '82.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : '104.0', + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'CPU_Core_2_temp' : { + HIGH_THRESHOLD : '82.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : '104.0', + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'CPU_Core_3_temp' : { + HIGH_THRESHOLD : '82.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : '104.0', + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'PSU-1 temp sensor 1' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'PSU-2 temp sensor 1' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + } +} + +class Thermal(PddfThermal): + """PDDF Platform-Specific Thermal class""" + + def __init__(self, index, pddf_data=None, pddf_plugin_data=None, is_psu_thermal=False, psu_index=0): + PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data, is_psu_thermal, psu_index) + + self.pddf_obj = pddf_data + self.thermal_obj_name = "TEMP{}".format(self.thermal_index) + self.thermal_obj = self.pddf_obj.data[self.thermal_obj_name] + + # Threshold Configuration + self.__conf = DeviceThreshold(self.get_name()) + # Default threshold. + self.__default_threshold = DEFAULT_THRESHOLD[self.get_name()] + self.min_temperature = None + self.max_temperature = None + + # Provide the functions/variables below for which implementation is to be overwritten + def get_name(self): + if self.is_psu_thermal: + return "PSU-{0} temp sensor 1".format(self.thermals_psu_index) + else: + if 'dev_attr' in self.thermal_obj.keys(): + if 'display_name' in self.thermal_obj['dev_attr']: + return str(self.thermal_obj['dev_attr']['display_name']) + + # In case of errors + return "Temp sensor {0}".format(self.thermal_index) + + def get_status(self): + get_temp=self.get_temperature() + + if get_temp is not None: + return True if get_temp else False + + def get_temperature(self): + current = super().get_temperature() + + if self.min_temperature is None or \ + current < self.min_temperature: + self.min_temperature = current + + if self.max_temperature is None or \ + current > self.max_temperature: + self.max_temperature = current + + return current + + def set_high_threshold(self, temperature): + try: + value = float(temperature) + except Exception: + return False + + # The new value can not be more than the default value. + default_value = self.__default_threshold[HIGH_THRESHOLD] + if default_value != NOT_AVAILABLE: + if value > float(default_value): + return False + + try: + self.__conf.set_high_threshold(str(value)) + except Exception: + return False + + return True + + def get_high_threshold(self): + value = self.__conf.get_high_threshold() + if value != NOT_AVAILABLE: + return float(value) + + default_value = self.__default_threshold[HIGH_THRESHOLD] + if default_value != NOT_AVAILABLE: + return float(default_value) + + return super().get_high_threshold() + + def set_low_threshold(self, temperature): + try: + value = float(temperature) + except Exception: + return False + + # The new value can not be less than the default value. + default_value = self.__default_threshold[LOW_THRESHOLD] + if default_value != NOT_AVAILABLE: + if value < float(default_value): + return False + + try: + self.__conf.set_low_threshold(str(value)) + except Exception: + return False + + return True + + def get_low_threshold(self): + value = self.__conf.get_low_threshold() + if value != NOT_AVAILABLE: + return float(value) + + default_value = self.__default_threshold[LOW_THRESHOLD] + if default_value != NOT_AVAILABLE: + return float(default_value) + + raise NotImplementedError + + def set_high_critical_threshold(self, temperature): + try: + value = float(temperature) + except Exception: + return False + + # The new value can not be more than the default value. + default_value = self.__default_threshold[HIGH_CRIT_THRESHOLD] + if default_value != NOT_AVAILABLE: + if value > float(default_value): + return False + + try: + self.__conf.set_high_critical_threshold(str(value)) + except Exception: + return False + + return True + + def get_high_critical_threshold(self): + value = self.__conf.get_high_critical_threshold() + if value != NOT_AVAILABLE: + return float(value) + + default_value = self.__default_threshold[HIGH_CRIT_THRESHOLD] + if default_value != NOT_AVAILABLE: + return float(default_value) + return super().get_high_critical_threshold() + + def set_low_critical_threshold(self, temperature): + try: + value = float(temperature) + except Exception: + return False + + # The new value can not be less than the default value. + default_value = self.__default_threshold[LOW_CRIT_THRESHOLD] + if default_value != NOT_AVAILABLE: + if value < float(default_value): + return False + + try: + self.__conf.set_low_critical_threshold(str(value)) + except Exception: + return False + + return True + + def get_low_critical_threshold(self): + value = self.__conf.get_low_critical_threshold() + if value != NOT_AVAILABLE: + return float(value) + + default_value = self.__default_threshold[LOW_CRIT_THRESHOLD] + if default_value != NOT_AVAILABLE: + return float(default_value) + + raise NotImplementedError + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return 'N/A' + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return 'N/A' + + def get_minimum_recorded(self): + """ + Retrieves the minimum recorded temperature of thermal + Returns: + A float number, the minimum recorded temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.min_temperature is None: + self.get_temperature() + + return self.min_temperature + + def get_maximum_recorded(self): + """ + Retrieves the maximum recorded temperature of thermal + Returns: + A float number, the maximum recorded temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.max_temperature is None: + self.get_temperature() + + return self.max_temperature diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/watchdog.py new file mode 100644 index 0000000000..88660b1a1f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform/watchdog.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +############################################################################# +# +# Module contains an implementation of platform specific watchdog API's +# +############################################################################# + +try: + from sonic_platform_pddf_base.pddf_watchdog import PddfWatchdog +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +class Watchdog(PddfWatchdog): + """ + PDDF Platform-specific Chassis class + """ + + def __init__(self): + PddfWatchdog.__init__(self) + self.timeout= 180 + + # Provide the functions/variables below for which implementation is to be overwritten diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform_setup.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform_setup.py index a775511c64..22bd354ea6 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform_setup.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/sonic_platform_setup.py @@ -1,8 +1,5 @@ from setuptools import setup -DEVICE_NAME = 'accton' -HW_SKU = 'x86_64-accton_as5835_54x-r0' - setup( name='sonic-platform', version='1.0', @@ -11,13 +8,7 @@ author='SONiC Team', author_email='linuxnetdev@microsoft.com', url='https://github.com/Azure/sonic-buildimage', - maintainer='Jostar Yang', - maintainer_email='jostar_yang@accton.com', - packages=[ - 'sonic_platform', - ], - package_dir={ - 'sonic_platform': '../../../../device/{}/{}/sonic_platform'.format(DEVICE_NAME, HW_SKU)}, + packages=['sonic_platform'], classifiers=[ 'Development Status :: 3 - Alpha', 'Environment :: Plugins', diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_pddf_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_pddf_monitor.py new file mode 100755 index 0000000000..02be5a0972 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_pddf_monitor.py @@ -0,0 +1,241 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2019 Accton Technology Corporation +# +# 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 3 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, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 05/29/2019: Brandon Chuang, changed for as5835-54x. +# 08/03/2020: Jostar Yang, change to call PDDF API . +# ------------------------------------------------------------------ + +try: + import sys, getopt + import logging + import logging.config + import time + import signal + from sonic_platform import platform +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +# Deafults +VERSION = '1.0' +FUNCTION_NAME = 'accton_as5835_54x_monitor' +DUTY_MAX = 100 + +platform_chassis = None + +test_temp = 0 +test_temp_list = [0, 0, 0, 0] +test_temp_revert=0 +temp_test_data=0 + +# Make a class we can use to capture stdout and sterr in the log +class accton_as5835_54x_monitor(object): + # static temp var + _ori_temp = 0 + _new_perc = 0 + + def __init__(self, log_file, log_level): + """Needs a logger and a logger level.""" + # set up logging to file + logging.basicConfig( + filename=log_file, + filemode='w', + level=log_level, + format= '[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s', + datefmt='%H:%M:%S' + ) + + # set up logging to console + if log_level == logging.DEBUG: + console = logging.StreamHandler() + console.setLevel(log_level) + formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') + console.setFormatter(formatter) + logging.getLogger('').addHandler(console) + + logging.debug('SET. logfile:%s / loglevel:%d', log_file, log_level) + + def manage_fans(self): + global platform_chassis + global test_temp_list + global temp_test_data + global test_temp + + THERMAL_NUM_MAX=4 + FAN_LEV1_UP_TEMP = 57700 # temperature + FAN_LEV1_SPEED_PERC = DUTY_MAX # percentage*/ + + FAN_LEV2_UP_TEMP = 53000 + FAN_LEV2_DOWN_TEMP = 52700 + FAN_LEV2_SPEED_PERC = 80 + + FAN_LEV3_UP_TEMP = 49500 + FAN_LEV3_DOWN_TEMP = 47700 + FAN_LEV3_SPEED_PERC = 65 + + FAN_LEV4_DOWN_TEMP = 42700 + FAN_LEV4_SPEED_PERC = 40 + + FAN_NUM=2 + FAN_TRAY_NUM=5 + + if test_temp_revert==0: + temp_test_data=temp_test_data+2000 + else: + temp_test_data=temp_test_data-2000 + + if test_temp==0: + temp2=platform_chassis.get_thermal(1).get_temperature()*1000 + if temp2 is None: + return False + + temp3=platform_chassis.get_thermal(2).get_temperature()*1000 + if temp3 is None: + return False + + new_temp = (temp2 + temp3) / 2 + else: + thermal_val=[0,0,0,0] + for i in range (THERMAL_NUM_MAX): + thermal_val[i]=test_temp_list[i] + thermal_val[i]= thermal_val[i] + temp_test_data + + + new_temp = (thermal_val[1] + thermal_val[2])/2 + logging.debug("Test case:thermal_val[1]=%d, thermal_val[2]=%d, get new_temp=%d", thermal_val[1], thermal_val[2],new_temp) + + for x in range(FAN_TRAY_NUM * FAN_NUM): + #fan_stat = platform_chassis.get_fan(x).get_status() or not platform_chassis.get_fan(x).get_speed_rpm() + + #if fan_stat is None: + # return False + #if fan_stat is False: + fan_stat=True + if not platform_chassis.get_fan(x).get_status() or not platform_chassis.get_fan(x).get_speed_rpm(): + self._new_perc = FAN_LEV1_SPEED_PERC + logging.debug('INFO. SET new_perc to %d (FAN fault. fan_num:%d)', self._new_perc, x+1) + fan_stat=False + break + logging.debug('INFO. fan_stat is True (fan_num:%d)', x+1) + + if fan_stat==True: + diff = new_temp - self._ori_temp + if diff == 0: + logging.debug('INFO. RETURN. THERMAL temp not changed. %d / %d (new_temp / ori_temp)', new_temp, self._ori_temp) + return True + else: + if diff >= 0: + is_up = True + logging.debug('INFO. THERMAL temp UP %d / %d (new_temp / ori_temp)', new_temp, self._ori_temp) + else: + is_up = False + logging.debug('INFO. THERMAL temp DOWN %d / %d (new_temp / ori_temp)', new_temp, self._ori_temp) + + if is_up is True: + if new_temp >= FAN_LEV1_UP_TEMP: + self._new_perc = FAN_LEV1_SPEED_PERC + elif new_temp >= FAN_LEV2_UP_TEMP: + self._new_perc = FAN_LEV2_SPEED_PERC + elif new_temp >= FAN_LEV3_UP_TEMP: + self._new_perc = FAN_LEV3_SPEED_PERC + else: + self._new_perc = FAN_LEV4_SPEED_PERC + logging.debug('INFO. SET. FAN_SPEED as %d (new THERMAL temp:%d)', self._new_perc, new_temp) + else: + if new_temp <= FAN_LEV4_DOWN_TEMP: + self._new_perc = FAN_LEV4_SPEED_PERC + elif new_temp <= FAN_LEV3_DOWN_TEMP: + self._new_perc = FAN_LEV3_SPEED_PERC + elif new_temp <= FAN_LEV2_DOWN_TEMP: + self._new_perc = FAN_LEV2_SPEED_PERC + else: + self._new_perc = FAN_LEV1_SPEED_PERC + logging.debug('INFO. SET. FAN_SPEED as %d (new THERMAL temp:%d)', self._new_perc, new_temp) + + cur_perc= platform_chassis.get_fan(0).get_speed() + #cur_perc = fan.get_fan_duty_cycle() + if cur_perc == self._new_perc: + logging.debug('INFO. RETURN. FAN speed not changed. %d / %d (new_perc / ori_perc)', self._new_perc, cur_perc) + return True + + #set_stat = fan.set_fan_duty_cycle(self._new_perc) + set_stat = platform_chassis.get_fan(0).set_speed(self._new_perc) + if set_stat is True: + logging.debug('INFO: PASS. set_fan_duty_cycle (%d)', self._new_perc) + else: + logging.debug('INFO: FAIL. set_fan_duty_cycle (%d)', self._new_perc) + + logging.debug('INFO: GET. ori_perc is %d. ori_temp is %d', cur_perc, self._ori_temp) + self._ori_temp = new_temp + logging.debug('INFO: UPDATE. ori_perc to %d. ori_temp to %d', cur_perc, self._ori_temp) + + return True + +def handler(signum, frame): + logging.debug('INFO:Cause signal %d, set fan speed max.', signum) + platform_chassis.get_fan(0).set_speed(DUTY_MAX) + sys.exit(0) + +def main(argv): + global test_temp + + log_file = '%s.log' % FUNCTION_NAME + log_level = logging.INFO + if len(sys.argv) != 1: + try: + opts, args = getopt.getopt(argv,'hdlt:',['lfile=']) + except getopt.GetoptError: + print('Usage: %s [-d] [-l ]' % sys.argv[0]) + return 0 + for opt, arg in opts: + if opt == '-h': + print('Usage: %s [-d] [-l ]' % sys.argv[0]) + return 0 + elif opt in ('-d', '--debug'): + log_level = logging.DEBUG + elif opt in ('-l', '--lfile'): + log_file = arg + + if sys.argv[1]== '-t': + if len(sys.argv)!=6: + print("temp test, need input 4 temp") + return 0 + i=0 + for x in range(2, 6): + test_temp_list[i]= int(sys.argv[x])*1000 + i=i+1 + test_temp = 1 + log_level = logging.DEBUG + print(test_temp_list) + + global platform_chassis + platform_chassis = platform.Platform().get_chassis() + + + signal.signal(signal.SIGINT, handler) + signal.signal(signal.SIGTERM, handler) + monitor = accton_as5835_54x_monitor(log_file, log_level) + + # Loop forever, doing something useful hopefully: + while True: + monitor.manage_fans() + time.sleep(10) + +if __name__ == '__main__': + main(sys.argv[1:]) \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_util.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_util.py index 5292d1ec3b..af4b7c0c33 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_util.py @@ -386,6 +386,8 @@ def do_sonic_platform_clean(): else: print('{} is uninstalled'.format(PLATFORM_API2_WHL_FILE_PY3)) + return + def do_install(): print("Checking system....") if driver_check() == False: diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/pddf_post_device_create.sh b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/pddf_post_device_create.sh new file mode 100755 index 0000000000..c1a6660f9e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/pddf_post_device_create.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +set_qsfp_reset_to_normal_state() +{ + i2cset -y -f 3 0x62 0x15 0x3f &>/dev/null +} + + +set_sfp_tx_disable_to_disable() +{ + i2cset -y -f 3 0x61 0x12 0x0 &>/dev/null + i2cset -y -f 3 0x61 0x13 0x0 &>/dev/null + i2cset -y -f 3 0x61 0x14 0x0 &>/dev/null + i2cset -y -f 3 0x61 0x15 0x0 &>/dev/null + i2cset -y -f 3 0x61 0x16 0x0 &>/dev/null + i2cset -y -f 3 0x62 0xc 0x0 &>/dev/null + i2cset -y -f 3 0x62 0xd 0x0 &>/dev/null +} + +set_system_led_diag_loc_to_off() +{ + i2cset -y -f 3 0x60 0xa 0x1c &>/dev/null +} + +set_qsfp_reset_to_normal_state +set_sfp_tx_disable_to_disable +set_system_led_diag_loc_to_off diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/pddf_switch_svc.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/pddf_switch_svc.py new file mode 100755 index 0000000000..c7dad91bae --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/pddf_switch_svc.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python +# Script to stop and start the respective platforms default services. +# This will be used while switching the pddf->non-pddf mode and vice versa +from sonic_py_common.general import getstatusoutput_noshell + +def check_pddf_support(): + return True + +def stop_platform_svc(): + + status, output = getstatusoutput_noshell(["systemctl", "stop", "as5835-54x-platform-monitor-fan.service"]) + if status: + print("Stop as5835-54x-platform-fan.service failed %d"%status) + return False + + status, output = getstatusoutput_noshell(["systemctl", "stop", "as5835-54x-platform-monitor-psu.service"]) + if status: + print("Stop as5835-54x-platform-psu.service failed %d"%status) + return False + + status, output = getstatusoutput_noshell(["systemctl", "stop", "as5835-54x-platform-monitor.service"]) + if status: + print("Stop as5835-54x-platform-init.service failed %d"%status) + return False + status, output = getstatusoutput_noshell(["systemctl", "disable", "as5835-54x-platform-monitor.service"]) + if status: + print("Disable as5835-54x-platform-monitor.service failed %d"%status) + return False + + status, output = getstatusoutput_noshell(["/usr/local/bin/accton_as5835_54x_util.py", "clean"]) + if status: + print("accton_as5835_54x_util.py clean command failed %d"%status) + return False + + # HACK , stop the pddf-platform-init service if it is active + status, output = getstatusoutput_noshell(["systemctl", "stop", "pddf-platform-init.service"]) + if status: + print("Stop pddf-platform-init.service along with other platform serives failed %d"%status) + return False + + return True + +def start_platform_svc(): + status, output = getstatusoutput_noshell(["/usr/local/bin/accton_as5835_54x_util.py", "install"]) + if status: + print("accton_as5835_54x_util.py install command failed %d"%status) + return False + + status, output = getstatusoutput_noshell(["systemctl", "enable", "as5835-54x-platform-monitor.service"]) + if status: + print("Enable as5835-54x-platform-monitor.service failed %d"%status) + return False + status, output = getstatusoutput_noshell(["systemctl", "start" ,"as5835-54x-platform-monitor-fan.service"]) + if status: + print("Start as5835-54x-platform-monitor-fan.service failed %d"%status) + return False + + status, output = getstatusoutput_noshell(["systemctl", "start", "as5835-54x-platform-monitor-psu.service"]) + if status: + print("Start as5835-54x-platform-monitor-psu.service failed %d"%status) + return False + + return True + +def start_platform_pddf(): + status, output = getstatusoutput_noshell(["systemctl", "start", "pddf-platform-init.service"]) + if status: + print("Start pddf-platform-init.service failed %d"%status) + return False + + return True + +def stop_platform_pddf(): + status, output = getstatusoutput_noshell(["systemctl", "stop", "pddf-platform-init.service"]) + if status: + print("Stop pddf-platform-init.service failed %d"%status) + return False + + return True + +def main(): + pass + +if __name__ == "__main__": + main() + diff --git a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/service/as6712-platform-init.service b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/service/as6712-platform-init.service index ffdd6e1cee..b256b06c11 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/service/as6712-platform-init.service +++ b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/service/as6712-platform-init.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS6712-32X Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=sysinit.target DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/service/as7312-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/service/as7312-platform-monitor.service index b79357665b..94ac9a98b3 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/service/as7312-platform-monitor.service +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/service/as7312-platform-monitor.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS7312-54X Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=sysinit.target DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/service/as7312-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/service/as7312-platform-monitor.service index b79357665b..94ac9a98b3 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/service/as7312-platform-monitor.service +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/service/as7312-platform-monitor.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS7312-54X Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=sysinit.target DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/service/as7315-platform-init.service b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/service/as7315-platform-init.service index cdaf437166..d06f636a1e 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/service/as7315-platform-init.service +++ b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/service/as7315-platform-init.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS7315-27XB Platform initialization service -Before=pmon.service +Before=pmon.service system-health.service After=sysinit.target DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_leds.c b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_leds.c index 035f9ad82e..b31702ca13 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_leds.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_leds.c @@ -59,7 +59,7 @@ static struct accton_as7326_56x_led_data *ledctl = NULL; #define LED_MODE_DIAG_RED_VALUE (0x06) #define LED_MODE_DIAG_BLUE_VALUE (0x03) #define LED_MODE_DIAG_GREEN_BLINK_VALUE (0x17) -#define LED_MODE_DIAG_RED_BLINK_VALUE (0x0d) +#define LED_MODE_DIAG_RED_BLINK_VALUE (0x0f) #define LED_MODE_DIAG_BLUE_BLINK_VALUE (0x27) #define LED_MODE_DIAG_OFF_VALUE (0x07) @@ -69,7 +69,7 @@ static struct accton_as7326_56x_led_data *ledctl = NULL; #define LED_MODE_LOC_RED_VALUE (0x06) #define LED_MODE_LOC_BLUE_VALUE (0x03) #define LED_MODE_LOC_GREEN_BLINK_VALUE (0x17) -#define LED_MODE_LOC_RED_BLINK_VALUE (0x0d) +#define LED_MODE_LOC_RED_BLINK_VALUE (0x0f) #define LED_MODE_LOC_BLUE_BLINK_VALUE (0x27) #define LED_MODE_LOC_OFF_VALUE (0x07) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_psu.c b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_psu.c index 8c2ece6200..9dbd061c9e 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_psu.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_as7326_56x_psu.c @@ -34,8 +34,10 @@ #include #include +#define MAX_MODEL_NAME 16 +#define MAX_SERIAL_NUMBER 18 static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); -static ssize_t show_model_name(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_string(struct device *dev, struct device_attribute *da, char *buf); static int as7326_56x_psu_read_block(struct i2c_client *client, u8 command, u8 *data,int data_len); extern int as7326_56x_cpld_read(unsigned short cpld_addr, u8 reg); @@ -52,7 +54,8 @@ struct as7326_56x_psu_data { unsigned long last_updated; /* In jiffies */ u8 index; /* PSU index */ u8 status; /* Status(present/power_good) register read from CPLD */ - char model_name[9]; /* Model name, read from eeprom */ + char model_name[MAX_MODEL_NAME+1]; /* Model name, read from eeprom */ + char serial_number[MAX_SERIAL_NUMBER+1]; }; static struct as7326_56x_psu_data *as7326_56x_psu_update_device(struct device *dev); @@ -60,18 +63,21 @@ static struct as7326_56x_psu_data *as7326_56x_psu_update_device(struct device *d enum as7326_56x_psu_sysfs_attributes { PSU_PRESENT, PSU_MODEL_NAME, + PSU_SERIAL_NUMBER, PSU_POWER_GOOD }; /* sysfs attributes for hwmon */ static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, show_status, NULL, PSU_PRESENT); -static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_model_name,NULL, PSU_MODEL_NAME); +static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_string, NULL, PSU_MODEL_NAME); +static SENSOR_DEVICE_ATTR(psu_serial_number, S_IRUGO, show_string, NULL, PSU_SERIAL_NUMBER); static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_status, NULL, PSU_POWER_GOOD); static struct attribute *as7326_56x_psu_attributes[] = { &sensor_dev_attr_psu_present.dev_attr.attr, &sensor_dev_attr_psu_model_name.dev_attr.attr, + &sensor_dev_attr_psu_serial_number.dev_attr.attr, &sensor_dev_attr_psu_power_good.dev_attr.attr, NULL }; @@ -83,6 +89,10 @@ static ssize_t show_status(struct device *dev, struct device_attribute *da, struct as7326_56x_psu_data *data = as7326_56x_psu_update_device(dev); u8 status = 0; + if (!data->valid) { + return -EIO; + } + if (attr->index == PSU_PRESENT) { status = !(data->status >> (1-data->index) & 0x1); } @@ -93,12 +103,27 @@ static ssize_t show_status(struct device *dev, struct device_attribute *da, return sprintf(buf, "%d\n", status); } -static ssize_t show_model_name(struct device *dev, struct device_attribute *da, - char *buf) +static ssize_t show_string(struct device *dev, struct device_attribute *da, + char *buf) { + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct as7326_56x_psu_data *data = as7326_56x_psu_update_device(dev); + char *ptr = NULL; - return sprintf(buf, "%s\n", data->model_name); + if (!data->valid) { + return -EIO; + } + + if (attr->index == PSU_MODEL_NAME) { + ptr = data->model_name; + } + else if (attr->index == PSU_SERIAL_NUMBER) { + ptr = data->serial_number; + } + else { + return -EIO; + } + return sprintf(buf, "%s\n", ptr); } static const struct attribute_group as7326_56x_psu_group = { @@ -219,6 +244,112 @@ static int as7326_56x_psu_read_block(struct i2c_client *client, u8 command, u8 * return result; } +enum psu_type { + PSU_TYPE_AC_110V, + PSU_TYPE_DC_48V, + PSU_TYPE_DC_12V, + PSU_TYPE_AC_ACBEL_FSF019, + PSU_TYPE_AC_ACBEL_FSF045 +}; + +struct model_name_info { + enum psu_type type; + u8 offset; + u8 length; + char* model_name; +}; + +struct serial_number_info { + enum psu_type type; + u8 offset; + u8 length; + char* serial_number; +}; + +struct model_name_info models[] = { + {PSU_TYPE_AC_110V, 0x20, 8, "YM-2651Y"}, + {PSU_TYPE_DC_48V, 0x20, 8, "YM-2651V"}, + {PSU_TYPE_DC_12V, 0x00, 11, "PSU-12V-750"}, + {PSU_TYPE_AC_ACBEL_FSF019, 0x15, 10, "FSF019-"}, + {PSU_TYPE_AC_ACBEL_FSF045, 0x15, 10, "FSF045-"} +}; + +struct serial_number_info serials[] = { + {PSU_TYPE_AC_110V, 0x2e, 18, "YM-2651Y"}, + {PSU_TYPE_DC_48V, 0x2e, 18, "YM-2651V"}, + {PSU_TYPE_DC_12V, 0x2e, 18, "PSU-12V-750"}, + {PSU_TYPE_AC_ACBEL_FSF019, 0x2e, 16, "FSF019-"}, + {PSU_TYPE_AC_ACBEL_FSF045, 0x2e, 16, "FSF045-"} +}; + +static int as7326_56x_psu_model_name_get(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7326_56x_psu_data *data = i2c_get_clientdata(client); + int i, status; + + for (i = 0; i < ARRAY_SIZE(models); i++) { + memset(data->model_name, 0, sizeof(data->model_name)); + + status = as7326_56x_psu_read_block(client, models[i].offset, + data->model_name, models[i].length); + if (status < 0) { + data->model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x%x)\n", + client->addr, models[i].offset); + return status; + } + else { + data->model_name[models[i].length] = '\0'; + } + + /* Determine if the model name is known, if not, read next index + */ + if (strncmp(data->model_name, models[i].model_name, strlen(models[i].model_name)) == 0) { + return 0; + } + else { + data->model_name[0] = '\0'; + } + } + + return -ENODATA; +} + +static int as7326_56x_psu_serial_number_get(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7326_56x_psu_data *data = i2c_get_clientdata(client); + int i, status; + + for (i = 0; i < ARRAY_SIZE(models); i++) { + memset(data->serial_number, 0, sizeof(data->serial_number)); + + status = as7326_56x_psu_read_block(client, serials[i].offset, + data->serial_number, serials[i].length); + if (status < 0) { + data->serial_number[0] = '\0'; + dev_dbg(&client->dev, "unable to read serial_number from (0x%x) offset(0x%x)\n", + client->addr, serials[i].offset); + return status; + } + else { + data->serial_number[serials[i].length] = '\0'; + } + + /* Determine if the model name is known, if not, read next index + */ + if (strncmp(data->model_name, models[i].model_name, strlen(models[i].model_name)) == 0) { + return 0; + } + else { + data->serial_number[0] = '\0'; + } + } + + return -ENODATA; +} + static struct as7326_56x_psu_data *as7326_56x_psu_update_device(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -231,6 +362,7 @@ static struct as7326_56x_psu_data *as7326_56x_psu_update_device(struct device *d int status; int power_good = 0; + data->valid = 0; dev_dbg(&client->dev, "Starting as7326_56x update\n"); /* Read psu status */ @@ -238,6 +370,7 @@ static struct as7326_56x_psu_data *as7326_56x_psu_update_device(struct device *d if (status < 0) { dev_dbg(&client->dev, "cpld reg 0x60 err %d\n", status); + goto exit; } else { data->status = status; @@ -245,18 +378,15 @@ static struct as7326_56x_psu_data *as7326_56x_psu_update_device(struct device *d /* Read model name */ memset(data->model_name, 0, sizeof(data->model_name)); + memset(data->serial_number, 0, sizeof(data->serial_number)); power_good = (data->status >> (3-data->index) & 0x1); if (power_good) { - status = as7326_56x_psu_read_block(client, 0x20, data->model_name, - ARRAY_SIZE(data->model_name)-1); - - if (status < 0) { - data->model_name[0] = '\0'; - dev_dbg(&client->dev, "unable to read model name from (0x%x)\n", client->addr); + if (as7326_56x_psu_model_name_get(dev) < 0) { + goto exit; } - else { - data->model_name[ARRAY_SIZE(data->model_name)-1] = '\0'; + if (as7326_56x_psu_serial_number_get(dev) < 0) { + goto exit; } } @@ -264,6 +394,7 @@ static struct as7326_56x_psu_data *as7326_56x_psu_update_device(struct device *d data->valid = 1; } +exit: mutex_unlock(&data->update_lock); return data; diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_i2c_cpld.c b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_i2c_cpld.c index 70d9a66aff..a67d6607ed 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_i2c_cpld.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_i2c_cpld.c @@ -760,7 +760,7 @@ static ssize_t show_status(struct device *dev, struct device_attribute *da, return 0; } - if (attr->index >= MODULE_PRESENT_1 && attr->index <= MODULE_PRESENT_56) { + if (attr->index >= MODULE_PRESENT_1 && attr->index <= MODULE_PRESENT_58) { revert = 1; } diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_psu_api.h b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_psu_api.h new file mode 120000 index 0000000000..a6b156930a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_psu_api.h @@ -0,0 +1 @@ +../../common/modules/accton_psu_api.h \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_psu_defs.h b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_psu_defs.h new file mode 120000 index 0000000000..96202b3ead --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/accton_psu_defs.h @@ -0,0 +1 @@ +../../common/modules/accton_psu_defs.h \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/pddf_custom_psu.c b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/pddf_custom_psu.c index 18c3edf72a..54e19007a8 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/pddf_custom_psu.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/modules/pddf_custom_psu.c @@ -13,57 +13,81 @@ ssize_t pddf_get_custom_psu_model_name(struct device *dev, struct device_attribute *da, char *buf); ssize_t pddf_get_custom_psu_serial_num(struct device *dev, struct device_attribute *da, char *buf); +ssize_t pddf_get_custom_psu_fan_dir(struct device *dev, struct device_attribute *da, char *buf); extern PSU_SYSFS_ATTR_DATA access_psu_model_name; extern PSU_SYSFS_ATTR_DATA access_psu_serial_num; +extern PSU_SYSFS_ATTR_DATA access_psu_fan_dir; -#define MAX_MODEL_NAME 16 -#define MAX_SERIAL_NUMBER 19 +#define MAX_MODEL_NAME 13 +#define MAX_SERIAL_NUMBER 18 +#define FAN_DIR_LEN 3 + +const char FAN_DIR_F2B[] = "F2B"; +const char FAN_DIR_B2F[] = "B2F"; +const char FAN_DIR_UNKNOWN[] = ""; enum psu_type { - PSU_TYPE_AC_110V, - PSU_TYPE_DC_48V, - PSU_TYPE_DC_12V, - PSU_TYPE_AC_ACBEL_FSF019, - PSU_TYPE_AC_ACBEL_FSF045 + PSU_TYPE_ACBEL_FSF019_AC_F2B, // FSF019-611G + PSU_TYPE_ACBEL_FSF045_AC_B2F, // FSH045-611G + PSU_TYPE_3Y_YM2651YBR_AC_F2B, // YM-2651Y-BR + PSU_TYPE_3Y_YM2651YB01R_AC_F2B, // YM-2651Y-B01R + PSU_TYPE_3Y_YM2651YCR_AC_B2F, // YM-2651Y-CR + PSU_TYPE_3Y_YM2651YC01R_AC_B2F, // YM-2651Y-C01R + PSU_TYPE_3Y_YM2651VBR_DC_F2B, // YM-2651V-BR + PSU_TYPE_3Y_YM2651VCR_DC_B2F, // YM-2651V-CR + PSU_TYPE_3Y_YM2651_SERIES }; struct model_name_info { + char* model_name; enum psu_type type; u8 offset; u8 length; u8 chk_length; - char* model_name; }; - struct serial_number_info { - enum psu_type type; u8 offset; u8 length; - u8 chk_length; - char* serial_number; }; -struct model_name_info models[] = { -{PSU_TYPE_AC_110V, 0x20, 8, 8, "YM-2651Y"}, -{PSU_TYPE_DC_48V, 0x20, 8, 8, "YM-2651V"}, -{PSU_TYPE_DC_12V, 0x00, 11, 11, "PSU-12V-750"}, -{PSU_TYPE_AC_ACBEL_FSF019, 0x15, 10, 7, "FSF019-"}, -{PSU_TYPE_AC_ACBEL_FSF045, 0x15, 10, 7, "FSF045-"} - +struct fan_dir_info { + char* model_name; + u8 model_length; + enum psu_type type; + const char* fan_dir; +}; +const struct model_name_info models[] = { + { "FSF019", PSU_TYPE_ACBEL_FSF019_AC_F2B, 0x20, 13, 6 }, + { "FSF045", PSU_TYPE_ACBEL_FSF045_AC_B2F, 0x20, 13, 6 }, + { "YM-2651", PSU_TYPE_3Y_YM2651_SERIES, 0x20, 13, 7 } }; -struct serial_number_info serials[] = { -{PSU_TYPE_AC_110V, 0x2e, 18, 18, "YM-2651Y"}, -{PSU_TYPE_DC_48V, 0x2e, 18, 18, "YM-2651V"}, -{PSU_TYPE_DC_12V, 0x2e, 18, 18, "PSU-12V-750"}, -{PSU_TYPE_AC_ACBEL_FSF019, 0x2e, 16, 16, "FSF019-"}, -{PSU_TYPE_AC_ACBEL_FSF019, 0x2e, 16, 16, "FSF045-"} +const struct fan_dir_info fan_dirs[] = { + { "FSF019", 6, PSU_TYPE_ACBEL_FSF019_AC_F2B, FAN_DIR_F2B }, + { "FSF045", 6, PSU_TYPE_ACBEL_FSF045_AC_B2F, FAN_DIR_B2F }, + { "YM-2651Y-BR", 11, PSU_TYPE_3Y_YM2651YBR_AC_F2B, FAN_DIR_F2B }, + { "YM-2651Y-B01R", 13, PSU_TYPE_3Y_YM2651YB01R_AC_F2B, FAN_DIR_F2B }, + { "YM-2651Y-CR", 11, PSU_TYPE_3Y_YM2651YCR_AC_B2F, FAN_DIR_B2F }, + { "YM-2651Y-C01R", 13, PSU_TYPE_3Y_YM2651YC01R_AC_B2F, FAN_DIR_B2F }, + { "YM-2651V-BR", 11, PSU_TYPE_3Y_YM2651VBR_DC_F2B, FAN_DIR_F2B }, + { "YM-2651V-CR", 11, PSU_TYPE_3Y_YM2651VCR_DC_B2F, FAN_DIR_B2F } +}; +const struct serial_number_info serials[] = { + [PSU_TYPE_ACBEL_FSF019_AC_F2B] = { 0x2e, 16 }, + [PSU_TYPE_ACBEL_FSF045_AC_B2F] = { 0x2e, 16 }, + [PSU_TYPE_3Y_YM2651YBR_AC_F2B] = { 0x2e, 18 }, + [PSU_TYPE_3Y_YM2651YB01R_AC_F2B] = { 0x2e, 18 }, + [PSU_TYPE_3Y_YM2651YCR_AC_B2F] = { 0x2e, 18 }, + [PSU_TYPE_3Y_YM2651YC01R_AC_B2F] = { 0x35, 18 }, + [PSU_TYPE_3Y_YM2651VBR_DC_F2B] = { 0x2e, 18 }, + [PSU_TYPE_3Y_YM2651VCR_DC_B2F] = { 0x2e, 18 } }; struct pddf_psu_data { char model_name[MAX_MODEL_NAME+1]; char serial_number[MAX_SERIAL_NUMBER+1]; + char fan_dir[FAN_DIR_LEN+1]; }; @@ -96,53 +120,118 @@ static int pddf_psu_read_block(struct i2c_client *client, u8 command, u8 *data, return result; } -ssize_t pddf_get_custom_psu_serial_num(struct device *dev, struct device_attribute *da, char *buf) +/* Get type and model_name + */ +static int pddf_get_model_name_and_type(struct i2c_client *client, enum psu_type *get_type, struct pddf_psu_data *get_data) { - struct i2c_client *client = to_i2c_client(dev); - struct pddf_psu_data data; + char model_name[MAX_MODEL_NAME+1]; int i, status; - + enum psu_type type; + + get_data->model_name[0]='\0'; + *get_type = PSU_TYPE_ACBEL_FSF019_AC_F2B; for (i = 0; i < ARRAY_SIZE(models); i++) { - memset(data.serial_number, 0, sizeof(data.serial_number)); - + model_name[0]='\0'; + if ((models[i].length+1) > ARRAY_SIZE(model_name)) { + dev_dbg(&client->dev, + "invalid models[%d].length(%d), should not exceed the size of data->model_name(%ld)\n", + i, models[i].length, ARRAY_SIZE(model_name)); + continue; + } + status = pddf_psu_read_block(client, models[i].offset, - data.model_name, models[i].length); + model_name, models[i].length); if (status < 0) { - data.model_name[0] = '\0'; + model_name[0] = '\0'; dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x%x)\n", client->addr, models[i].offset); return status; } else { - data.model_name[models[i].length] = '\0'; + model_name[models[i].length>=(sizeof(model_name)-1)?(sizeof(model_name)-1):models[i].length] = '\0'; } /* Determine if the model name is known, if not, read next index */ - if (strncmp(data.model_name, models[i].model_name, models[i].chk_length) == 0) { - status = pddf_psu_read_block(client, serials[i].offset, - data.serial_number, serials[i].length); - - if (status < 0) { - data.serial_number[0] = '\0'; - dev_dbg(&client->dev, "unable to read serial num from (0x%x) offset(0x%x)\n", - client->addr, serials[i].offset); - return status; - } - else { - data.serial_number[serials[i].length] = '\0'; - return sprintf(buf, "%s\n", data.serial_number); - } - - return 0; + if (strncmp(model_name, models[i].model_name, models[i].chk_length) == 0) { + type = models[i].type; + break; } else { - data.serial_number[0] = '\0'; + model_name[0] = '\0'; } } - return -ENODATA; + /* Remove useless characters for PSU_TYPE_3Y_YM2651_SERIES */ + if (type == PSU_TYPE_3Y_YM2651_SERIES) { + model_name[8] = '-'; + if (!isgraph(model_name[11])) + model_name[11] = '\0'; + else + model_name[MAX_MODEL_NAME] = '\0'; + } + /* Remove useless characters for PSU_TYPE_ACBEL_FSF* */ + else if ((type == PSU_TYPE_ACBEL_FSF019_AC_F2B) || (type == PSU_TYPE_ACBEL_FSF045_AC_B2F)) { + memmove(&model_name[7], &model_name[9], ARRAY_SIZE(model_name)-9); + model_name[6] = '-'; + model_name[11] = '\0'; + } + else + return -ENODEV; + + /* Determine fan direction and correct the PSU type */ + for (i = 0; i < ARRAY_SIZE(fan_dirs); i++) { + if ((fan_dirs[i].model_length+1) > ARRAY_SIZE(model_name)) { + dev_dbg(&client->dev, + "invalid fan_dirs[%d].model_length(%d), should not exceed the size of data->model_name(%ld)\n", + i, fan_dirs[i].model_length, ARRAY_SIZE(model_name)); + continue; + } + if (strncmp(model_name, fan_dirs[i].model_name, fan_dirs[i].model_length) == 0) { + type = fan_dirs[i].type; + break; + } + } + if (type >= PSU_TYPE_3Y_YM2651_SERIES) + { + return -ENODEV; + } + + *get_type = type; + memcpy(get_data->model_name, model_name, strlen(model_name)>=sizeof(get_data->model_name)?sizeof(get_data->model_name):strlen(model_name)); + get_data->model_name[strlen(model_name)>=(sizeof(get_data->model_name)-1)?(sizeof(get_data->model_name)-1):strlen(model_name)]='\0'; + return 0; +} + +ssize_t pddf_get_custom_psu_serial_num(struct device *dev, struct device_attribute *da, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct pddf_psu_data data; + int status; + enum psu_type type; + + data.serial_number[0]='\0'; + + status = pddf_get_model_name_and_type(client, &type, &data); + if (status < 0) + { + return -ENODEV; + } + + status = pddf_psu_read_block(client, serials[type].offset, + data.serial_number, serials[type].length); + if (status < 0) { + data.serial_number[0] = '\0'; + dev_dbg(&client->dev, "unable to read serial num from (0x%x) offset(0x%x)\n", + client->addr, serials[type].offset); + return status; + } + else { + data.serial_number[serials[type].length >= (sizeof(data.serial_number)-1)?(sizeof(data.serial_number)-1):serials[type].length] = '\0'; + } + + return sprintf(buf, "%s\n", data.serial_number); } @@ -150,34 +239,39 @@ ssize_t pddf_get_custom_psu_model_name(struct device *dev, struct device_attribu { struct i2c_client *client = to_i2c_client(dev); struct pddf_psu_data data; - int i, status; + int status; + enum psu_type type; + + status = pddf_get_model_name_and_type(client, &type, &data); + if (status < 0) + { + return -ENODEV; + } - for (i = 0; i < ARRAY_SIZE(models); i++) { - memset(data.model_name, 0, sizeof(data.model_name)); + return sprintf(buf, "%s\n", data.model_name); - status = pddf_psu_read_block(client, models[i].offset, - data.model_name, models[i].length); - if (status < 0) { - data.model_name[0] = '\0'; - dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x%x)\n", - client->addr, models[i].offset); - return status; - } - else { - data.model_name[models[i].length] = '\0'; - } +} - /* Determine if the model name is known, if not, read next index - */ - if (strncmp(data.model_name, models[i].model_name, models[i].chk_length) == 0) { - return sprintf(buf, "%s\n", data.model_name); - } - else { - data.model_name[0] = '\0'; - } - } +ssize_t pddf_get_custom_psu_fan_dir(struct device *dev, struct device_attribute *da, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct pddf_psu_data data; + int status; + enum psu_type type; - return -ENODATA; + status = pddf_get_model_name_and_type(client, &type, &data); + if (status < 0) + { + return -ENODEV; + } + + if (type < PSU_TYPE_3Y_YM2651_SERIES) + { + memcpy(data.fan_dir, fan_dirs[type].fan_dir, sizeof(data.fan_dir)); + return sprintf(buf, "%s\n", data.fan_dir); + } + else + return -ENODEV; } @@ -188,6 +282,9 @@ static int __init pddf_custom_psu_init(void) access_psu_model_name.show = pddf_get_custom_psu_model_name; access_psu_model_name.do_get = NULL; + + access_psu_fan_dir.show = pddf_get_custom_psu_fan_dir; + access_psu_fan_dir.do_get = NULL; return 0; } diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-56x-pddf-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-56x-pddf-platform-monitor.service index 03351824b7..49236706de 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-56x-pddf-platform-monitor.service +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-56x-pddf-platform-monitor.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS7326-56X Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=pddf-platform-init.service DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-platform-monitor.service index 9da8370471..51da61e5d9 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-platform-monitor.service +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/service/as7326-platform-monitor.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS7326-56X Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=as7326-platform-handle_mac.service DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/chassis.py index feb1fbdb56..a471e33089 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/chassis.py @@ -8,58 +8,58 @@ try: import sys - import time from sonic_platform_pddf_base.pddf_chassis import PddfChassis + from .event import SfpEvent + from .helper import APIHelper except ImportError as e: raise ImportError(str(e) + "- required module not found") +NUM_COMPONENT = 6 +HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/" +PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" +REBOOT_CAUSE_FILE = "reboot-cause.txt" class Chassis(PddfChassis): """ PDDF Platform-specific Chassis class """ + SYSLED_DEV_NAME = "DIAG_LED" def __init__(self, pddf_data=None, pddf_plugin_data=None): PddfChassis.__init__(self, pddf_data, pddf_plugin_data) + self.__initialize_components() + self._api_helper = APIHelper() + self._sfpevent = SfpEvent(self.get_all_sfps()) + + def __initialize_components(self): + from sonic_platform.component import Component + for index in range(NUM_COMPONENT): + component = Component(index) + self._component_list.append(component) # Provide the functions/variables below for which implementation is to be overwritten - sfp_change_event_data = {'valid': 0, 'last': 0, 'present': 0} - def get_change_event(self, timeout=2000): - now = time.time() - port_dict = {} - change_dict = {} - change_dict['sfp'] = port_dict - - if timeout < 1000: - timeout = 1000 - timeout = timeout / float(1000) # Convert to secs - - if now < (self.sfp_change_event_data['last'] + timeout) and self.sfp_change_event_data['valid']: - return True, change_dict - - bitmap = 0 - for i in range(58): - modpres = self.get_sfp(i+1).get_presence() - if modpres: - bitmap = bitmap | (1 << i) - - changed_ports = self.sfp_change_event_data['present'] ^ bitmap - if changed_ports: - for i in range(58): - if (changed_ports & (1 << i)): - if (bitmap & (1 << i)) == 0: - port_dict[i+1] = '0' - else: - port_dict[i+1] = '1' - - - # Update teh cache dict - self.sfp_change_event_data['present'] = bitmap - self.sfp_change_event_data['last'] = now - self.sfp_change_event_data['valid'] = 1 - return True, change_dict - else: - return True, change_dict + def get_change_event(self, timeout=0): + return self._sfpevent.get_sfp_event(timeout) + + 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. + """ + + reboot_cause_path = (HOST_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE) + sw_reboot_cause = self._api_helper.read_txt_file( + reboot_cause_path) or "Unknown" + + + return ('REBOOT_CAUSE_NON_HARDWARE', sw_reboot_cause) + def get_sfp(self, index): """ @@ -83,3 +83,50 @@ def get_sfp(self, index): sys.stderr.write("SFP index {} out of range (1-{})\n".format( index, len(self._sfp_list))) return sfp + + def initizalize_system_led(self): + return + + def get_status_led(self): + return self.get_system_led(self.SYSLED_DEV_NAME) + + def set_status_led(self, color): + return self.set_system_led(self.SYSLED_DEV_NAME, color) + + def get_port_or_cage_type(self, port): + from sonic_platform_base.sfp_base import SfpBase + if port in range(1, 49): + return SfpBase.SFP_PORT_TYPE_BIT_SFP | SfpBase.SFP_PORT_TYPE_BIT_SFP_PLUS | SfpBase.SFP_PORT_TYPE_BIT_SFP28 + elif port in range(49, 57): + return SfpBase.SFP_PORT_TYPE_BIT_QSFP | SfpBase.SFP_PORT_TYPE_BIT_QSFP_PLUS | SfpBase.SFP_PORT_TYPE_BIT_QSFP28 + else: + return SfpBase.SFP_PORT_TYPE_BIT_SFP + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + + def get_revision(self): + """ + Retrieves the hardware revision of the device + + Returns: + string: Revision value of device + """ + return 'N/A' \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/component.py new file mode 100644 index 0000000000..8feb4f1c0c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/component.py @@ -0,0 +1,156 @@ +############################################################################# +# +# Component contains an implementation of SONiC Platform Base API and +# provides the components firmware management function +# +############################################################################# + +try: + import subprocess + from sonic_platform_base.component_base import ComponentBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CPLD_ADDR_MAPPING = { + "MB_CPLD1": ['18', '0x60'], + "MB_CPLD2": ['12', '0x62'], + "MB_CPLD3": ['19', '0x64'], + "FAN_CPLD": ['11', '0x66'], + "CPU_CPLD": ['0', '0x65'] +} +SYSFS_PATH = "/sys/bus/i2c/devices/" +BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version" +COMPONENT_LIST= [ + ("MB_CPLD1", "Mainboard CPLD(0x60)"), + ("MB_CPLD2", "Mainboard CPLD(0x62)"), + ("MB_CPLD3", "Mainboard CPLD(0x64)"), + ("FAN_CPLD", "Fan board CPLD(0x66)"), + ("CPU_CPLD", "CPU CPLD(0x65)"), + ("BIOS", "Basic Input/Output System") + +] + +class Component(ComponentBase): + """Platform-specific Component class""" + + DEVICE_TYPE = "component" + + def __init__(self, component_index=0): + self.index = component_index + self.name = self.get_name() + + def __get_bios_version(self): + # Retrieves the BIOS firmware version + try: + with open(BIOS_VERSION_PATH, 'r') as fd: + bios_version = fd.read() + return bios_version.strip() + except Exception as e: + return None + + def __get_cpld_version(self): + # Retrieves the CPLD firmware version + cpld_version = dict() + for cpld_name in CPLD_ADDR_MAPPING: + cmd = "i2cget -f -y {0} {1} 0x1".format(CPLD_ADDR_MAPPING[cpld_name][0], CPLD_ADDR_MAPPING[cpld_name][1]) + status, value = subprocess.getstatusoutput(cmd) + if not status: + cpld_version_raw = value.rstrip() + cpld_version[cpld_name] = "{}".format(int(cpld_version_raw,16)) + + return cpld_version + + def get_name(self): + """ + Retrieves the name of the component + Returns: + A string containing the name of the component + """ + return COMPONENT_LIST[self.index][0] + + def get_description(self): + """ + Retrieves the description of the component + Returns: + A string containing the description of the component + """ + return COMPONENT_LIST[self.index][1] + + def get_firmware_version(self): + """ + Retrieves the firmware version of module + Returns: + string: The firmware versions of the module + """ + fw_version = None + + if self.name == "BIOS": + fw_version = self.__get_bios_version() + elif "CPLD" in self.name: + cpld_version = self.__get_cpld_version() + fw_version = cpld_version.get(self.name) + + return fw_version + + def install_firmware(self, image_path): + """ + Install firmware to module + Args: + image_path: A string, path to firmware image + Returns: + A boolean, True if install successfully, False if not + """ + raise NotImplementedError + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return 'N/A' + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return 'N/A' + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return True + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/eeprom.py index a87ecc9f6f..b0fbd57ac7 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/eeprom.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/eeprom.py @@ -12,3 +12,4 @@ def __init__(self, pddf_data=None, pddf_plugin_data=None): PddfEeprom.__init__(self, pddf_data, pddf_plugin_data) # Provide the functions/variables below for which implementation is to be overwritten + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/event.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/event.py new file mode 100644 index 0000000000..d5dac6d7f7 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/event.py @@ -0,0 +1,60 @@ +try: + import time + from sonic_py_common.logger import Logger +except ImportError as e: + raise ImportError(repr(e) + " - required module not found") + +POLL_INTERVAL_IN_SEC = 1 + +class SfpEvent: + ''' Listen to insert/remove sfp events ''' + + def __init__(self, sfp_list): + self._sfp_list = sfp_list + self._logger = Logger() + self._sfp_change_event_data = {'present': 0} + + def get_presence_bitmap(self): + bitmap = 0 + for sfp in self._sfp_list: + modpres = sfp.get_presence() + i=sfp.get_position_in_parent() - 1 + if modpres: + bitmap = bitmap | (1 << i) + return bitmap + + def get_sfp_event(self, timeout=2000): + port_dict = {} + change_dict = {} + change_dict['sfp'] = port_dict + + if timeout < 1000: + cd_ms = 1000 + else: + cd_ms = timeout + + while cd_ms > 0: + bitmap = self.get_presence_bitmap() + changed_ports = self._sfp_change_event_data['present'] ^ bitmap + if changed_ports != 0: + break + time.sleep(POLL_INTERVAL_IN_SEC) + # timeout=0 means wait for event forever + if timeout != 0: + cd_ms = cd_ms - POLL_INTERVAL_IN_SEC * 1000 + + if changed_ports != 0: + for sfp in self._sfp_list: + i=sfp.get_position_in_parent() - 1 + if (changed_ports & (1 << i)): + if (bitmap & (1 << i)) == 0: + port_dict[i+1] = '0' + else: + port_dict[i+1] = '1' + + + # Update the cache dict + self._sfp_change_event_data['present'] = bitmap + return True, change_dict + else: + return True, change_dict diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/fan.py index 23d8be5a8a..694593d030 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/fan.py @@ -6,6 +6,9 @@ except ImportError as e: raise ImportError(str(e) + "- required module not found") +FAN_NAME_LIST = ["FAN-1F", "FAN-1R", "FAN-2F", "FAN-2R", + "FAN-3F", "FAN-3R", "FAN-4F", "FAN-4R", + "FAN-5F", "FAN-5R", "FAN-6F", "FAN-6R"] class Fan(PddfFan): """PDDF Platform-Specific Fan class""" @@ -15,5 +18,48 @@ def __init__(self, tray_idx, fan_idx=0, pddf_data=None, pddf_plugin_data=None, i PddfFan.__init__(self, tray_idx, fan_idx, pddf_data, pddf_plugin_data, is_psu_fan, psu_index) # Provide the functions/variables below for which implementation is to be overwritten - # Since AS4630 psu_fan airflow direction cant be read from sysfs, it is fixed as 'F2B' or 'intake' + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + fan_name = FAN_NAME_LIST[(self.fantray_index-1)*2 + self.fan_index-1] \ + if not self.is_psu_fan \ + else "PSU-{} FAN-{}".format(self.fans_psu_index, self.fan_index) + + return fan_name + + + + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + + return "N/A" + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return "N/A" + + 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) + """ + if self.is_psu_fan: + return super().get_speed() + else: + return super().get_target_speed() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/fan_drawer.py index 3b9bb607f6..f1e5c6edbc 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/fan_drawer.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/fan_drawer.py @@ -15,3 +15,28 @@ def __init__(self, tray_idx, pddf_data=None, pddf_plugin_data=None): PddfFanDrawer.__init__(self, tray_idx, pddf_data, pddf_plugin_data) # Provide the functions/variables below for which implementation is to be overwritten + + def get_name(self): + """ + Retrieves the fan drawer name + Returns: + string: The name of the device + """ + return "FanTray{}".format(self.fantray_index) + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self._fan_list[0].get_model() + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return self._fan_list[0].get_serial() + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/helper.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/helper.py new file mode 100644 index 0000000000..c3b0f1d2f4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/helper.py @@ -0,0 +1,54 @@ +import os +import struct +import subprocess +from mmap import * +from sonic_py_common import device_info +from sonic_py_common.general import getstatusoutput_noshell + +HOST_CHK_CMD = ["docker"] +EMPTY_STRING = "" + + +class APIHelper(): + + def __init__(self): + (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() + + def is_host(self): + try: + status, output = getstatusoutput_noshell(HOST_CHK_CMD) + return status == 0 + except Exception: + return False + + def pci_get_value(self, resource, offset): + status = True + result = "" + try: + fd = os.open(resource, os.O_RDWR) + mm = mmap(fd, 0) + mm.seek(int(offset)) + read_data_stream = mm.read(4) + result = struct.unpack('I', read_data_stream) + except Exception: + status = False + return status, result + + def read_txt_file(self, file_path): + try: + with open(file_path, 'r', errors='replace') as fd: + data = fd.read() + ret = data.strip() + if len(ret) > 0: + return ret + except IOError: + pass + return None + + 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 diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/pcie.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/pcie.py new file mode 100644 index 0000000000..e4da32adf9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/pcie.py @@ -0,0 +1,19 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the fan status which are available in the platform +# Base PCIe class +############################################################################# + +try: + from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Pcie(PcieUtil): + """Edgecore Platform-specific PCIe class""" + + def __init__(self, platform_path): + PcieUtil.__init__(self, platform_path) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/psu.py index 1b260fccae..899d37be99 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/psu.py @@ -26,10 +26,79 @@ def get_maximum_supplied_power(self): """ return float(self.PLATFORM_PSU_CAPACITY) - def get_type(self): + def get_name(self): + return "PSU-{}".format(self.psu_index) + + def get_revision(self): + """ + Retrieves the hardware revision of the device + + Returns: + string: Revision value of device + """ + return 'N/A' + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + + Returns: + string: Model/part number of device + """ + model = super().get_model() + if model and model.strip() == "": + return None + + return model + + def get_serial(self): + """ + Retrieves the serial number of the device + + Returns: + string: Serial number of device + """ + serial = super().get_serial() + if serial and serial.strip() == "": + return None + + return serial + + def get_voltage(self): + """ + Retrieves current PSU voltage output + + Returns: + A float number, the output voltage in volts, + e.g. 12.1 + """ + if self.get_status() is not True: + return 0.0 + + return super().get_voltage() + + def get_current(self): """ - Gets the type of the PSU + Retrieves present electric current supplied by PSU + + Returns: + A float number, electric current in amperes, + e.g. 15.4 + """ + if self.get_status() is not True: + return 0.0 + + return super().get_current() + + def get_power(self): + """ + Retrieves current energy supplied by PSU + Returns: - A string, the type of PSU (AC/DC) + A float number, the power in watts, + e.g. 302.6 """ - return "DC" + if self.get_status() is not True: + return 0.0 + + return super().get_power() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/sfp.py index d9b6e491be..837d060e99 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/sfp.py @@ -1,7 +1,10 @@ #!/usr/bin/env python try: + import natsort from sonic_platform_pddf_base.pddf_sfp import PddfSfp + from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper + from sonic_py_common import device_info except ImportError as e: raise ImportError (str(e) + "- required module not found") @@ -11,7 +14,185 @@ class Sfp(PddfSfp): PDDF Platform-Specific Sfp class """ + SFP_TYPE_CODE_LIST = [ + 0x03, # SFP/SFP+/SFP28 + 0x0b # DWDM-SFP/SFP+ + ] + QSFP_TYPE_CODE_LIST = [ + 0x0c, # QSFP + 0x0d, # QSFP+ or later + 0x11, # QSFP28 or later + 0xe1 # QSFP28 EDFA + ] + def __init__(self, index, pddf_data=None, pddf_plugin_data=None): PddfSfp.__init__(self, index, pddf_data, pddf_plugin_data) + self.index = self.port_index # Provide the functions/variables below for which implementation is to be overwritten + def __get_path_to_port_config_file(self): + platform, hwsku = device_info.get_platform_and_hwsku() + hwsku_path = "/".join(["/usr/share/sonic/platform",hwsku]) + return "/".join([hwsku_path, "port_config.ini"]) + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + sfputil_helper = SfpUtilHelper() + sfputil_helper.read_porttab_mappings( + self.__get_path_to_port_config_file()) + + logical_port_list = sfputil_helper.logical + logical_port_list = natsort.natsorted(logical_port_list) + name = logical_port_list[self.port_index-1] or "Unknown" + + return name + + def get_position_in_parent(self): + """Retrieves 1-based relative physical position in parent device.""" + return self.port_index + + def __validate_eeprom_sfp(self): + checksum_test = 0 + eeprom_raw = self.read_eeprom(0, 96) + if eeprom_raw is None: + return None + + for i in range(0, 63): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[63]: + return False + + checksum_test = 0 + for i in range(64, 95): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[95]: + return False + + api = self.get_xcvr_api() + if api is None: + return False + + if api.is_flat_memory(): + return True + + checksum_test = 0 + eeprom_raw = self.read_eeprom(384, 96) + if eeprom_raw is None: + return None + + for i in range(0, 95): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[95]: + return False + + return True + + def __validate_eeprom_qsfp(self): + checksum_test = 0 + eeprom_raw = self.read_eeprom(128, 96) + if eeprom_raw is None: + return None + + for i in range(0, 63): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[63]: + return False + + checksum_test = 0 + for i in range(64, 95): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[95]: + return False + + api = self.get_xcvr_api() + if api is None: + return False + + if api.is_flat_memory(): + return True + + return True + + def validate_eeprom(self): + id_byte_raw = self.read_eeprom(0, 1) + if id_byte_raw is None: + return None + + id = id_byte_raw[0] + if id in self.QSFP_TYPE_CODE_LIST: + return self.__validate_eeprom_qsfp() + elif id in self.SFP_TYPE_CODE_LIST: + return self.__validate_eeprom_sfp() + else: + return False + + def validate_temperature(self): + temperature = self.get_temperature() + if temperature is None: + return None + + threshold_dict = self.get_transceiver_threshold_info() + if threshold_dict is None: + return None + + if isinstance(temperature, float) is not True: + return True + + if isinstance(threshold_dict['temphighalarm'], float) is not True: + return True + + return threshold_dict['temphighalarm'] > temperature + + def __get_error_description(self): + if not self.get_presence(): + return self.SFP_STATUS_UNPLUGGED + + err_stat = self.SFP_STATUS_BIT_INSERTED + + status = self.validate_eeprom() + if status is not True: + err_stat = (err_stat | self.SFP_ERROR_BIT_BAD_EEPROM) + + status = self.validate_temperature() + if status is not True: + err_stat = (err_stat | self.SFP_ERROR_BIT_HIGH_TEMP) + + if err_stat is self.SFP_STATUS_BIT_INSERTED: + return self.SFP_STATUS_OK + else: + err_desc = '' + cnt = 0 + for key in self.SFP_ERROR_BIT_TO_DESCRIPTION_DICT: + if (err_stat & key) != 0: + if cnt > 0: + err_desc = err_desc + "|" + cnt = cnt + 1 + err_desc = err_desc + self.SFP_ERROR_BIT_TO_DESCRIPTION_DICT[key] + + return err_desc + + def get_error_description(self): + """ + Retrives the error descriptions of the SFP module + + Returns: + String that represents the current error descriptions of vendor specific errors + In case there are multiple errors, they should be joined by '|', + like: "Bad EEPROM|Unsupported cable" + """ + try: + ret = super().get_error_description() + if ret is not None: + return ret + except NotImplementedError: + pass + return self.__get_error_description() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/thermal.py index 77d6ec7ae8..328ce462e3 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/sonic_platform/thermal.py @@ -13,5 +13,82 @@ class Thermal(PddfThermal): def __init__(self, index, pddf_data=None, pddf_plugin_data=None, is_psu_thermal=False, psu_index=0): PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data, is_psu_thermal, psu_index) + + self.pddf_obj = pddf_data + self.thermal_obj_name = "TEMP{}".format(self.thermal_index) + self.thermal_obj = self.pddf_obj.data[self.thermal_obj_name] + self.min_temperature = None + self.max_temperature = None # Provide the functions/variables below for which implementation is to be overwritten + def get_name(self): + if self.is_psu_thermal: + return "PSU-{0} temp sensor 1".format(self.thermals_psu_index) + else: + if 'dev_attr' in self.thermal_obj.keys(): + if 'display_name' in self.thermal_obj['dev_attr']: + return str(self.thermal_obj['dev_attr']['display_name']) + + # In case of errors + return "Temp sensor {0}".format(self.thermal_index) + + def get_status(self): + get_temp=self.get_temperature() + + if get_temp is not None: + return True if get_temp else False + + def get_temperature(self): + current = super().get_temperature() + + if self.min_temperature is None or \ + current < self.min_temperature: + self.min_temperature = current + + if self.max_temperature is None or \ + current > self.max_temperature: + self.max_temperature = current + + return current + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + + return "N/A" + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return "N/A" + + def get_minimum_recorded(self): + """ + Retrieves the minimum recorded temperature of thermal + Returns: + A float number, the minimum recorded temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.min_temperature is None: + self.get_temperature() + + return self.min_temperature + + def get_maximum_recorded(self): + """ + Retrieves the maximum recorded temperature of thermal + Returns: + A float number, the maximum recorded temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.max_temperature is None: + self.get_temperature() + + return self.max_temperature + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_pddf_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_pddf_monitor.py index 7f3add4e4d..0db5471b0b 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_pddf_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_pddf_monitor.py @@ -30,6 +30,7 @@ import logging.handlers import time from sonic_platform import platform + from sonic_py_common.general import getstatusoutput_noshell except ImportError as e: raise ImportError('%s - required module not found' % str(e)) @@ -294,15 +295,46 @@ def main(argv): global platform_chassis platform_chassis = platform.Platform().get_chassis() + #cmd_str = ["i2cset", "-y", "-f", "11", "0x66", "0x33", "0x0"] + #status, output = getstatusoutput_noshell(cmd_str) + #if status: + # print("Warning: Fan speed watchdog could not be disabled") + + cmd_str = ["i2cset", "-y", "-f", "11", "0x66", "0x33", "0x1"] + status, output = getstatusoutput_noshell(cmd_str) + if status: + print("Warning: Fan speed watchdog could not be enabled") + + #Timer need to be set after enable. + #if set timer is eralier than enable wdt. Speed will become to wdt speed after 6sec. + cmd_str = ["i2cset", "-y", "-f", "11", "0x66", "0x31", "0xF0"] + status, output = getstatusoutput_noshell(cmd_str) + if status: + print("Warning: Fan speed watchdog timer could not be disabled") platform_chassis.get_fan(0).set_speed(38) print("set default fan speed to 37.5%") monitor = device_monitor(log_file, log_level) + + cmd_kick = ["i2cset", "-y", "-f", "11", "0x66", "0x31", "0xF0"] #kick WDT + cmd_check_wdt = ["i2cget", "-y", "-f", "11", "0x66", "0x33"] while True: monitor.manage_fans() + getstatusoutput_noshell(cmd_kick) time.sleep(5) + #polling to check fan-wdt status + status, output = getstatusoutput_noshell(cmd_check_wdt) + if status is not None: + val= int(output,16) + if (val & 0x1) == 0: + logging.warning('Detect Fan-WDT disable') + logging.warning('Try to enable Fan-WDT') + cmd_str = ["i2cset", "-y", "-f", "11", "0x66", "0x33", "0x1"] + getstatusoutput_noshell(cmd_str) + cmd_str = ["i2cset", "-y", "-f", "11", "0x66", "0x31", "0xF0"] + getstatusoutput_noshell(cmd_str) if __name__ == '__main__': diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py index f4335bd445..f934743254 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py @@ -100,9 +100,9 @@ def show_help(): def dis_i2c_ir3570a(addr): - cmd = ["i2cset", "-y", "0", "0x"+"%x"%addr, "0xE5", "0x01"] + cmd = ["i2cset", "-y", "-a", "0", "0x"+"%x"%addr, "0xE5", "0x01"] status, output = getstatusoutput_noshell(cmd) - cmd = ["i2cset", "-y", "0", "0x"+"%x"%addr, "0x12", "0x02"] + cmd = ["i2cset", "-y", "-a", "0", "0x"+"%x"%addr, "0x12", "0x02"] status, output = getstatusoutput_noshell(cmd) return status diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pddf_post_device_create.sh b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pddf_post_device_create.sh deleted file mode 100755 index bfa5455953..0000000000 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/pddf_post_device_create.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -set_pca_mux_idle_disconnect() -{ - echo -2 | tee /sys/bus/i2c/drivers/pca954x/*-00*/idle_state >& /dev/null - if [ $? -ne 0 ]; then - echo Fail to set pca954x mux idle disconnect - exit 2 - fi -} - -set_pca_mux_idle_disconnect diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_psu.c b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_psu.c index 233aef78e0..7c611015cf 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_psu.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/modules/accton_as7712_32x_psu.c @@ -34,8 +34,9 @@ #include #include +#define MAX_MODEL_NAME 16 static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); -static ssize_t show_model_name(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_string(struct device *dev, struct device_attribute *da, char *buf); static int as7712_32x_psu_read_block(struct i2c_client *client, u8 command, u8 *data,int data_len); extern int accton_i2c_cpld_read(unsigned short cpld_addr, u8 reg); @@ -52,7 +53,7 @@ struct as7712_32x_psu_data { unsigned long last_updated; /* In jiffies */ u8 index; /* PSU index */ u8 status; /* Status(present/power_good) register read from CPLD */ - char model_name[9]; /* Model name, read from eeprom */ + char model_name[MAX_MODEL_NAME+1]; /* Model name, read from eeprom */ }; static struct as7712_32x_psu_data *as7712_32x_psu_update_device(struct device *dev); @@ -66,7 +67,7 @@ enum as7712_32x_psu_sysfs_attributes { /* sysfs attributes for hwmon */ static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, show_status, NULL, PSU_PRESENT); -static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_model_name,NULL, PSU_MODEL_NAME); +static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_string, NULL, PSU_MODEL_NAME); static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_status, NULL, PSU_POWER_GOOD); static struct attribute *as7712_32x_psu_attributes[] = { @@ -83,6 +84,10 @@ static ssize_t show_status(struct device *dev, struct device_attribute *da, struct as7712_32x_psu_data *data = as7712_32x_psu_update_device(dev); u8 status = 0; + if (!data->valid) { + return -EIO; + } + if (attr->index == PSU_PRESENT) { status = !(data->status >> (1-data->index) & 0x1); } @@ -93,12 +98,24 @@ static ssize_t show_status(struct device *dev, struct device_attribute *da, return sprintf(buf, "%d\n", status); } -static ssize_t show_model_name(struct device *dev, struct device_attribute *da, +static ssize_t show_string(struct device *dev, struct device_attribute *da, char *buf) { + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct as7712_32x_psu_data *data = as7712_32x_psu_update_device(dev); - - return sprintf(buf, "%s\n", data->model_name); + char *ptr = NULL; + + if (!data->valid) { + return -EIO; + } + + if (attr->index == PSU_MODEL_NAME) { + ptr = data->model_name; + } + else { + return -EIO; + } + return sprintf(buf, "%s\n", ptr); } static const struct attribute_group as7712_32x_psu_group = { @@ -219,6 +236,63 @@ static int as7712_32x_psu_read_block(struct i2c_client *client, u8 command, u8 * return result; } +enum psu_type { + PSU_TYPE_AC_110V, + PSU_TYPE_DC_48V, + PSU_TYPE_DC_12V, + PSU_TYPE_AC_ACBEL_FSF019, + PSU_TYPE_AC_ACBEL_FSF045 +}; + +struct model_name_info { + enum psu_type type; + u8 offset; + u8 length; + char* model_name; +}; + +struct model_name_info models[] = { + {PSU_TYPE_AC_110V, 0x20, 8, "YM-2651Y"}, + {PSU_TYPE_DC_48V, 0x20, 8, "YM-2651V"}, + {PSU_TYPE_DC_12V, 0x00, 11, "PSU-12V-750"}, + {PSU_TYPE_AC_ACBEL_FSF019, 0x15, 10, "FSF019-"}, + {PSU_TYPE_AC_ACBEL_FSF045, 0x15, 10, "FSF045-"} +}; + +static int as7712_32x_psu_model_name_get(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7712_32x_psu_data *data = i2c_get_clientdata(client); + int i, status; + + for (i = 0; i < ARRAY_SIZE(models); i++) { + memset(data->model_name, 0, sizeof(data->model_name)); + + status = as7712_32x_psu_read_block(client, models[i].offset, + data->model_name, models[i].length); + if (status < 0) { + data->model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x%x)\n", + client->addr, models[i].offset); + return status; + } + else { + data->model_name[models[i].length] = '\0'; + } + + /* Determine if the model name is known, if not, read next index + */ + if (strncmp(data->model_name, models[i].model_name, strlen(models[i].model_name)) == 0) { + return 0; + } + else { + data->model_name[0] = '\0'; + } + } + + return -ENODATA; +} + static struct as7712_32x_psu_data *as7712_32x_psu_update_device(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -231,6 +305,7 @@ static struct as7712_32x_psu_data *as7712_32x_psu_update_device(struct device *d int status; int power_good = 0; + data->valid = 0; dev_dbg(&client->dev, "Starting as7712_32x update\n"); /* Read psu status */ @@ -238,6 +313,7 @@ static struct as7712_32x_psu_data *as7712_32x_psu_update_device(struct device *d if (status < 0) { dev_dbg(&client->dev, "cpld reg 0x60 err %d\n", status); + goto exit; } else { data->status = status; @@ -248,15 +324,8 @@ static struct as7712_32x_psu_data *as7712_32x_psu_update_device(struct device *d power_good = (data->status >> (3-data->index) & 0x1); if (power_good) { - status = as7712_32x_psu_read_block(client, 0x20, data->model_name, - ARRAY_SIZE(data->model_name)-1); - - if (status < 0) { - data->model_name[0] = '\0'; - dev_dbg(&client->dev, "unable to read model name from (0x%x)\n", client->addr); - } - else { - data->model_name[ARRAY_SIZE(data->model_name)-1] = '\0'; + if (as7712_32x_psu_model_name_get(dev) < 0) { + goto exit; } } @@ -264,6 +333,7 @@ static struct as7712_32x_psu_data *as7712_32x_psu_update_device(struct device *d data->valid = 1; } +exit: mutex_unlock(&data->update_lock); return data; diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/service/as7712-pddf-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/service/as7712-pddf-platform-monitor.service index d0bd9940a3..737c751ab9 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/service/as7712-pddf-platform-monitor.service +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/service/as7712-pddf-platform-monitor.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS7712 Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=pddf-platform-init.service DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/service/as7712-platform-init.service b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/service/as7712-platform-init.service index d5d25b6cde..4d008e868e 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/service/as7712-platform-init.service +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/service/as7712-platform-init.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS7712-32X Platform initialization service -Before=pmon.service +Before=pmon.service system-health.service DefaultDependencies=no [Service] diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_psu.c b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_psu.c index 78a58b820b..7f5d8c2c8c 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_psu.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/modules/accton_as7716_32x_psu.c @@ -248,7 +248,9 @@ static int as7716_32x_psu_read_block(struct i2c_client *client, u8 command, u8 * enum psu_type { PSU_TYPE_AC_110V, PSU_TYPE_DC_48V, - PSU_TYPE_DC_12V + PSU_TYPE_DC_12V, + PSU_TYPE_AC_ACBEL_FSF019, + PSU_TYPE_AC_ACBEL_FSF045 }; struct model_name_info { @@ -259,9 +261,11 @@ struct model_name_info { }; struct model_name_info models[] = { -{PSU_TYPE_AC_110V, 0x20, 8, "YM-2651Y"}, -{PSU_TYPE_DC_48V, 0x20, 8, "YM-2651V"}, -{PSU_TYPE_DC_12V, 0x00, 11, "PSU-12V-750"}, + {PSU_TYPE_AC_110V, 0x20, 8, "YM-2651Y"}, + {PSU_TYPE_DC_48V, 0x20, 8, "YM-2651V"}, + {PSU_TYPE_DC_12V, 0x00, 11, "PSU-12V-750"}, + {PSU_TYPE_AC_ACBEL_FSF019, 0x15, 10, "FSF019-"}, + {PSU_TYPE_AC_ACBEL_FSF045, 0x15, 10, "FSF045-"} }; static int as7716_32x_psu_model_name_get(struct device *dev) @@ -287,7 +291,7 @@ static int as7716_32x_psu_model_name_get(struct device *dev) /* Determine if the model name is known, if not, read next index */ - if (strncmp(data->model_name, models[i].model_name, models[i].length) == 0) { + if (strncmp(data->model_name, models[i].model_name, strlen(models[i].model_name)) == 0) { return 0; } else { diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/service/as7716-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/service/as7716-platform-monitor.service index b1428d7844..c01d1f90f1 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/service/as7716-platform-monitor.service +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/service/as7716-platform-monitor.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS7716-32X Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=sysinit.target DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/service/as7716_32xb-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/service/as7716_32xb-platform-monitor.service index 05a5d93c48..da5fac3a13 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/service/as7716_32xb-platform-monitor.service +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/service/as7716_32xb-platform-monitor.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS7716-32XB Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=sysinit.target DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/accton_as7726_32x_fan.c b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/accton_as7726_32x_fan.c index 0341b3802b..bc8e112360 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/accton_as7726_32x_fan.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/accton_as7726_32x_fan.c @@ -45,7 +45,6 @@ static struct as7726_32x_fan_data *as7726_32x_fan_update_device(struct device *d static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf); static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, const char *buf, size_t count); -static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, char *buf); /* fan related data, the index should match sysfs_fan_attributes */ @@ -294,7 +293,7 @@ static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, if (value < 0 || value > FAN_MAX_DUTY_CYCLE) return -EINVAL; - as7726_32x_fan_write_value(client, 0x33, 0); /* Disable fan speed watch dog */ + //as7726_32x_fan_write_value(client, 0x33, 0); /* Disable fan speed watch dog */ as7726_32x_fan_write_value(client, fan_reg[FAN_DUTY_CYCLE_PERCENTAGE], duty_cycle_to_reg_val(value)); return count; } diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/accton_as7726_32x_psu.c b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/accton_as7726_32x_psu.c index f4da01e86d..3736cc8da0 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/accton_as7726_32x_psu.c +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/accton_as7726_32x_psu.c @@ -34,8 +34,10 @@ #include #include +#define MAX_MODEL_NAME 16 +#define MAX_SERIAL_NUMBER 18 static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); -static ssize_t show_model_name(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_string(struct device *dev, struct device_attribute *da, char *buf); static int as7726_32x_psu_read_block(struct i2c_client *client, u8 command, u8 *data,int data_len); extern int as7726_32x_cpld_read(unsigned short cpld_addr, u8 reg); @@ -52,7 +54,8 @@ struct as7726_32x_psu_data { unsigned long last_updated; /* In jiffies */ u8 index; /* PSU index */ u8 status; /* Status(present/power_good) register read from CPLD */ - char model_name[9]; /* Model name, read from eeprom */ + char model_name[MAX_MODEL_NAME+1]; /* Model name, read from eeprom */ + char serial_number[MAX_SERIAL_NUMBER+1]; }; static struct as7726_32x_psu_data *as7726_32x_psu_update_device(struct device *dev); @@ -60,18 +63,21 @@ static struct as7726_32x_psu_data *as7726_32x_psu_update_device(struct device *d enum as7726_32x_psu_sysfs_attributes { PSU_PRESENT, PSU_MODEL_NAME, + PSU_SERIAL_NUMBER, PSU_POWER_GOOD }; /* sysfs attributes for hwmon */ static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, show_status, NULL, PSU_PRESENT); -static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_model_name,NULL, PSU_MODEL_NAME); +static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_string, NULL, PSU_MODEL_NAME); +static SENSOR_DEVICE_ATTR(psu_serial_number, S_IRUGO, show_string, NULL, PSU_SERIAL_NUMBER); static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_status, NULL, PSU_POWER_GOOD); static struct attribute *as7726_32x_psu_attributes[] = { &sensor_dev_attr_psu_present.dev_attr.attr, &sensor_dev_attr_psu_model_name.dev_attr.attr, + &sensor_dev_attr_psu_serial_number.dev_attr.attr, &sensor_dev_attr_psu_power_good.dev_attr.attr, NULL }; @@ -83,6 +89,10 @@ static ssize_t show_status(struct device *dev, struct device_attribute *da, struct as7726_32x_psu_data *data = as7726_32x_psu_update_device(dev); u8 status = 0; + if (!data->valid) { + return -EIO; + } + if (attr->index == PSU_PRESENT) { status = !(data->status >> (1-data->index) & 0x1); } @@ -93,12 +103,27 @@ static ssize_t show_status(struct device *dev, struct device_attribute *da, return sprintf(buf, "%d\n", status); } -static ssize_t show_model_name(struct device *dev, struct device_attribute *da, - char *buf) +static ssize_t show_string(struct device *dev, struct device_attribute *da, + char *buf) { + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct as7726_32x_psu_data *data = as7726_32x_psu_update_device(dev); + char *ptr = NULL; - return sprintf(buf, "%s\n", data->model_name); + if (!data->valid) { + return -EIO; + } + + if (attr->index == PSU_MODEL_NAME) { + ptr = data->model_name; + } + else if (attr->index == PSU_SERIAL_NUMBER) { + ptr = data->serial_number; + } + else { + return -EIO; + } + return sprintf(buf, "%s\n", ptr); } static const struct attribute_group as7726_32x_psu_group = { @@ -219,6 +244,112 @@ static int as7726_32x_psu_read_block(struct i2c_client *client, u8 command, u8 * return result; } +enum psu_type { + PSU_TYPE_AC_110V, + PSU_TYPE_DC_48V, + PSU_TYPE_DC_12V, + PSU_TYPE_AC_ACBEL_FSF019, + PSU_TYPE_AC_ACBEL_FSF045 +}; + +struct model_name_info { + enum psu_type type; + u8 offset; + u8 length; + char* model_name; +}; + +struct serial_number_info { + enum psu_type type; + u8 offset; + u8 length; + char* serial_number; +}; +struct model_name_info models[] = { + {PSU_TYPE_AC_110V, 0x20, 8, "YM-2651Y"}, + {PSU_TYPE_DC_48V, 0x20, 8, "YM-2651V"}, + {PSU_TYPE_DC_12V, 0x00, 11, "PSU-12V-750"}, + {PSU_TYPE_AC_ACBEL_FSF019, 0x15, 10, "FSF019-"}, + {PSU_TYPE_AC_ACBEL_FSF045, 0x15, 10, "FSF045-"} +}; + +struct serial_number_info serials[] = { + {PSU_TYPE_AC_110V, 0x2e, 18, "YM-2651Y"}, + {PSU_TYPE_DC_48V, 0x2e, 18, "YM-2651V"}, + {PSU_TYPE_DC_12V, 0x2e, 18, "PSU-12V-750"}, + {PSU_TYPE_AC_ACBEL_FSF019, 0x2e, 16, "FSF019-"}, + {PSU_TYPE_AC_ACBEL_FSF045, 0x2e, 16, "FSF045-"} +}; + + +static int as7726_32x_psu_model_name_get(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7726_32x_psu_data *data = i2c_get_clientdata(client); + int i, status; + + for (i = 0; i < ARRAY_SIZE(models); i++) { + memset(data->model_name, 0, sizeof(data->model_name)); + + status = as7726_32x_psu_read_block(client, models[i].offset, + data->model_name, models[i].length); + if (status < 0) { + data->model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x%x)\n", + client->addr, models[i].offset); + return status; + } + else { + data->model_name[models[i].length] = '\0'; + } + + /* Determine if the model name is known, if not, read next index + */ + if (strncmp(data->model_name, models[i].model_name, strlen(models[i].model_name)) == 0) { + return 0; + } + else { + data->model_name[0] = '\0'; + } + } + + return -ENODATA; +} + +static int as7726_32x_psu_serial_number_get(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7726_32x_psu_data *data = i2c_get_clientdata(client); + int i, status; + + for (i = 0; i < ARRAY_SIZE(models); i++) { + memset(data->serial_number, 0, sizeof(data->serial_number)); + + status = as7726_32x_psu_read_block(client, serials[i].offset, + data->serial_number, serials[i].length); + if (status < 0) { + data->serial_number[0] = '\0'; + dev_dbg(&client->dev, "unable to read serial_number from (0x%x) offset(0x%x)\n", + client->addr, serials[i].offset); + return status; + } + else { + data->serial_number[serials[i].length] = '\0'; + } + + /* Determine if the model name is known, if not, read next index + */ + if (strncmp(data->model_name, models[i].model_name, strlen(models[i].model_name)) == 0) { + return 0; + } + else { + data->serial_number[0] = '\0'; + } + } + + return -ENODATA; +} + static struct as7726_32x_psu_data *as7726_32x_psu_update_device(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -231,6 +362,7 @@ static struct as7726_32x_psu_data *as7726_32x_psu_update_device(struct device *d int status; int power_good = 0; + data->valid = 0; dev_dbg(&client->dev, "Starting as7726_32x update\n"); /* Read psu status */ @@ -238,6 +370,7 @@ static struct as7726_32x_psu_data *as7726_32x_psu_update_device(struct device *d if (status < 0) { dev_dbg(&client->dev, "cpld reg 0x60 err %d\n", status); + goto exit; } else { data->status = status; @@ -245,17 +378,15 @@ static struct as7726_32x_psu_data *as7726_32x_psu_update_device(struct device *d /* Read model name */ memset(data->model_name, 0, sizeof(data->model_name)); + memset(data->serial_number, 0, sizeof(data->serial_number)); power_good = (data->status >> (3-data->index) & 0x1); if (power_good) { - status = as7726_32x_psu_read_block(client, 0x20, data->model_name, - ARRAY_SIZE(data->model_name)-1); - if (status < 0) { - data->model_name[0] = '\0'; - dev_dbg(&client->dev, "unable to read model name from (0x%x)\n", client->addr); + if (as7726_32x_psu_model_name_get(dev) < 0) { + goto exit; } - else { - data->model_name[ARRAY_SIZE(data->model_name)-1] = '\0'; + if (as7726_32x_psu_serial_number_get(dev) < 0) { + goto exit; } } @@ -263,6 +394,7 @@ static struct as7726_32x_psu_data *as7726_32x_psu_update_device(struct device *d data->valid = 1; } +exit: mutex_unlock(&data->update_lock); return data; diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/accton_psu_api.h b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/accton_psu_api.h new file mode 120000 index 0000000000..a6b156930a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/accton_psu_api.h @@ -0,0 +1 @@ +../../common/modules/accton_psu_api.h \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/accton_psu_defs.h b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/accton_psu_defs.h new file mode 120000 index 0000000000..96202b3ead --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/modules/accton_psu_defs.h @@ -0,0 +1 @@ +../../common/modules/accton_psu_defs.h \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/service/as7726-32x-pddf-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/service/as7726-32x-pddf-platform-monitor.service index a4aa842519..127e775bee 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/service/as7726-32x-pddf-platform-monitor.service +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/service/as7726-32x-pddf-platform-monitor.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS7726-32X Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=pddf-platform-init.service DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/service/as7726-32x-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/service/as7726-32x-platform-monitor.service index 5b04ad4101..2cdb614d6f 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/service/as7726-32x-platform-monitor.service +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/service/as7726-32x-platform-monitor.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS7726-32X Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=as7726-32x-platform-handle_mac.service DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/chassis.py index 8ff20a7605..c0cfc5c79c 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/chassis.py @@ -8,58 +8,59 @@ try: import sys - import time from sonic_platform_pddf_base.pddf_chassis import PddfChassis + from .event import SfpEvent + from .helper import APIHelper except ImportError as e: raise ImportError(str(e) + "- required module not found") +NUM_COMPONENT = 6 +HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/" +PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" +REBOOT_CAUSE_FILE = "reboot-cause.txt" class Chassis(PddfChassis): """ PDDF Platform-specific Chassis class """ + SYSLED_DEV_NAME = "DIAG_LED" + def __init__(self, pddf_data=None, pddf_plugin_data=None): PddfChassis.__init__(self, pddf_data, pddf_plugin_data) + self.__initialize_components() + self._api_helper = APIHelper() + self._sfpevent = SfpEvent(self.get_all_sfps()) + + + def __initialize_components(self): + from sonic_platform.component import Component + for index in range(NUM_COMPONENT): + component = Component(index) + self._component_list.append(component) # Provide the functions/variables below for which implementation is to be overwritten - sfp_change_event_data = {'valid': 0, 'last': 0, 'present': 0} - def get_change_event(self, timeout=2000): - now = time.time() - port_dict = {} - change_dict = {} - change_dict['sfp'] = port_dict - - if timeout < 1000: - timeout = 1000 - timeout = timeout / float(1000) # Convert to secs - - if now < (self.sfp_change_event_data['last'] + timeout) and self.sfp_change_event_data['valid']: - return True, change_dict - - bitmap = 0 - for i in range(34): - modpres = self.get_sfp(i+1).get_presence() - if modpres: - bitmap = bitmap | (1 << i) - - changed_ports = self.sfp_change_event_data['present'] ^ bitmap - if changed_ports: - for i in range(34): - if (changed_ports & (1 << i)): - if (bitmap & (1 << i)) == 0: - port_dict[i+1] = '0' - else: - port_dict[i+1] = '1' - - - # Update teh cache dict - self.sfp_change_event_data['present'] = bitmap - self.sfp_change_event_data['last'] = now - self.sfp_change_event_data['valid'] = 1 - return True, change_dict - else: - return True, change_dict + def get_change_event(self, timeout=0): + return self._sfpevent.get_sfp_event(timeout) + + 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. + """ + + reboot_cause_path = (HOST_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE) + sw_reboot_cause = self._api_helper.read_txt_file( + reboot_cause_path) or "Unknown" + + + return ('REBOOT_CAUSE_NON_HARDWARE', sw_reboot_cause) def get_sfp(self, index): @@ -84,3 +85,48 @@ def get_sfp(self, index): sys.stderr.write("SFP index {} out of range (1-{})\n".format( index, len(self._sfp_list))) return sfp + + def initizalize_system_led(self): + return + + def get_status_led(self): + return self.get_system_led(self.SYSLED_DEV_NAME) + + def set_status_led(self, color): + return self.set_system_led(self.SYSLED_DEV_NAME, color) + + def get_port_or_cage_type(self, port): + from sonic_platform_base.sfp_base import SfpBase + if port in range(1, 32): + return SfpBase.SFP_PORT_TYPE_BIT_QSFP | SfpBase.SFP_PORT_TYPE_BIT_QSFP_PLUS | SfpBase.SFP_PORT_TYPE_BIT_QSFP28 + else: + return SfpBase.SFP_PORT_TYPE_BIT_SFP | SfpBase.SFP_PORT_TYPE_BIT_SFP_PLUS + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + + def get_revision(self): + """ + Retrieves the hardware revision of the device + + Returns: + string: Revision value of device + """ + return self._eeprom.revision_str() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/component.py new file mode 100644 index 0000000000..704b4e2208 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/component.py @@ -0,0 +1,191 @@ +############################################################################# +# +# Component contains an implementation of SONiC Platform Base API and +# provides the components firmware management function +# +############################################################################# + +try: + import os + import json + from sonic_platform_base.component_base import ComponentBase + from sonic_py_common.general import getstatusoutput_noshell +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CPLD_ADDR_MAPPING = { + "MB_CPLD1": ['11', '0x60'], + "MB_CPLD2": ['12', '0x62'], + "MB_CPLD3": ['13', '0x64'], + "FAN_CPLD": ['54', '0x66'], + "CPU_CPLD": ['0', '0x65'], +} +SYSFS_PATH = "/sys/bus/i2c/devices/" +BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version" +COMPONENT_LIST= [ + ("MB_CPLD1", "Mainboard CPLD(0x60)"), + ("MB_CPLD2", "Mainboard CPLD(0x62)"), + ("MB_CPLD3", "Mainboard CPLD(0x64)"), + ("FAN_CPLD", "Fan board CPLD(0x66)"), + ("CPU_CPLD", "CPU CPLD(0x65)"), + ("BIOS", "Basic Input/Output System") + +] + +class Component(ComponentBase): + """Platform-specific Component class""" + + DEVICE_TYPE = "component" + + def __init__(self, component_index=0): + self.index = component_index + self.name = self.get_name() + + def __get_bios_version(self): + # Retrieves the BIOS firmware version + try: + with open(BIOS_VERSION_PATH, 'r') as fd: + bios_version = fd.read() + return bios_version.strip() + except Exception as e: + return None + + def __get_cpld_version(self): + # Retrieves the CPLD firmware version + cpld_version = dict() + for cpld_name in CPLD_ADDR_MAPPING: + cmd = ["i2cget", "-f", "-y", CPLD_ADDR_MAPPING[cpld_name][0], CPLD_ADDR_MAPPING[cpld_name][1], "0x1"] + status, value = getstatusoutput_noshell(cmd) + if not status: + cpld_version_raw = value.rstrip() + cpld_version[cpld_name] = "{}".format(int(cpld_version_raw,16)) + + return cpld_version + + def get_name(self): + """ + Retrieves the name of the component + Returns: + A string containing the name of the component + """ + return COMPONENT_LIST[self.index][0] + + def get_description(self): + """ + Retrieves the description of the component + Returns: + A string containing the description of the component + """ + return COMPONENT_LIST[self.index][1] + + def get_firmware_version(self): + """ + Retrieves the firmware version of module + Returns: + string: The firmware versions of the module + """ + fw_version = None + + if self.name == "BIOS": + fw_version = self.__get_bios_version() + elif "CPLD" in self.name: + cpld_version = self.__get_cpld_version() + fw_version = cpld_version.get(self.name) + + return fw_version + + def install_firmware(self, image_path): + """ + Install firmware to module + Args: + image_path: A string, path to firmware image + Returns: + A boolean, True if install successfully, False if not + """ + ret, output = getstatusoutput_noshell(["tar", "-C", "/tmp", "-xzf", image_path ] ) + if ret != 0 : + print("Installation failed because of wrong image package") + return False + + if False == os.path.exists("/tmp/install.json") : + print("Installation failed without jsonfile") + return False + + input_file = open ('/tmp/install.json') + json_array = json.load(input_file) + ret = 1 + for item in json_array: + if item.get('id')==None or item.get('path')==None: + continue + if self.name == item['id'] and item['path'] and item.get('cpu'): + print( "Find", item['id'], item['path'], item['cpu'] ) + ret, output = getstatusoutput_noshell(["/tmp/run_install.sh", item['id'], item['path'], item['cpu'] ]) + if ret==0: + break + elif self.name == item['id'] and item['path']: + print( "Find", item['id'], item['path'] ) + ret, output = getstatusoutput_noshell(["/tmp/run_install.sh", item['id'], item['path'] ]) + if ret==0: + break + + if ret==0: + return True + else : + return False + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return 'N/A' + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return 'N/A' + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return True + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + + + + + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/event.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/event.py new file mode 100644 index 0000000000..1a2f60dbb6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/event.py @@ -0,0 +1,109 @@ +try: + import time + from sonic_py_common.logger import Logger + from .sfp import Sfp +except ImportError as e: + raise ImportError(repr(e) + " - required module not found") + +POLL_INTERVAL_IN_SEC = 1 + +# SFP errors that will block eeprom accessing +SFP_BLOCKING_ERRORS = [ + Sfp.SFP_ERROR_BIT_I2C_STUCK, + Sfp.SFP_ERROR_BIT_BAD_EEPROM, + Sfp.SFP_ERROR_BIT_UNSUPPORTED_CABLE, + Sfp.SFP_ERROR_BIT_HIGH_TEMP, + Sfp.SFP_ERROR_BIT_BAD_CABLE +] + +class SfpEvent: + ''' Listen to insert/remove sfp events ''' + + def __init__(self, sfp_list): + self._sfp_list = sfp_list + self._logger = Logger() + self._sfp_change_event_data = {'present': 0} + + def get_presence_bitmap(self): + bitmap = 0 + for sfp in self._sfp_list: + modpres = sfp.get_presence() + i=sfp.get_position_in_parent() - 1 + if modpres: + bitmap = bitmap | (1 << i) + return bitmap + + def get_sfp_event(self, timeout=2000): + port_dict = {} + change_dict = {} + change_dict['sfp'] = port_dict + + if timeout < 1000: + cd_ms = 1000 + else: + cd_ms = timeout + + while cd_ms > 0: + bitmap = self.get_presence_bitmap() + changed_ports = self._sfp_change_event_data['present'] ^ bitmap + if changed_ports != 0: + break + time.sleep(POLL_INTERVAL_IN_SEC) + # timeout=0 means wait for event forever + if timeout != 0: + cd_ms = cd_ms - POLL_INTERVAL_IN_SEC * 1000 + + if changed_ports != 0: + for sfp in self._sfp_list: + i=sfp.get_position_in_parent() - 1 + if (changed_ports & (1 << i)) == 0: + continue + + if (bitmap & (1 << i)) == 0: + port_dict[i+1] = '0' + else: + # sfp.refresh_optoe_dev_class() + sfp_state_bits = self.get_sfp_state_bits(sfp, True) + sfp_state_bits = self.check_sfp_blocking_errors(sfp_state_bits) + + port_dict[i+1] = str(sfp_state_bits) + + # Update the cache dict + self._sfp_change_event_data['present'] = bitmap + return True, change_dict + else: + return True, change_dict + + def get_sfp_state_bits(self, sfp, present): + sfp_state_bits = 0 + + if present is True: + sfp_state_bits |= Sfp.SFP_STATUS_BIT_INSERTED + else: + return sfp_state_bits + + status = sfp.validate_eeprom() + if status is None: + sfp_state_bits |= Sfp.SFP_ERROR_BIT_I2C_STUCK + return sfp_state_bits + elif status is not True: + sfp_state_bits |= Sfp.SFP_ERROR_BIT_BAD_EEPROM + return sfp_state_bits + + status = sfp.validate_temperature() + if status is None: + sfp_state_bits |= Sfp.SFP_ERROR_BIT_I2C_STUCK + return sfp_state_bits + elif status is not True: + sfp_state_bits |= Sfp.SFP_ERROR_BIT_HIGH_TEMP + return sfp_state_bits + + return sfp_state_bits + + def check_sfp_blocking_errors(self, sfp_state_bits): + for i in SFP_BLOCKING_ERRORS: + if (i & sfp_state_bits) == 0: + continue + sfp_state_bits |= Sfp.SFP_ERROR_BIT_BLOCKING + + return sfp_state_bits diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/fan.py index 23d8be5a8a..46df75e256 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/fan.py @@ -6,6 +6,9 @@ except ImportError as e: raise ImportError(str(e) + "- required module not found") +FAN_NAME_LIST = ["FAN-1F", "FAN-1R", "FAN-2F", "FAN-2R", + "FAN-3F", "FAN-3R", "FAN-4F", "FAN-4R", + "FAN-5F", "FAN-5R", "FAN-6F", "FAN-6R"] class Fan(PddfFan): """PDDF Platform-Specific Fan class""" @@ -15,5 +18,61 @@ def __init__(self, tray_idx, fan_idx=0, pddf_data=None, pddf_plugin_data=None, i PddfFan.__init__(self, tray_idx, fan_idx, pddf_data, pddf_plugin_data, is_psu_fan, psu_index) # Provide the functions/variables below for which implementation is to be overwritten - # Since AS4630 psu_fan airflow direction cant be read from sysfs, it is fixed as 'F2B' or 'intake' + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + fan_name = FAN_NAME_LIST[(self.fantray_index-1)*2 + self.fan_index-1] \ + if not self.is_psu_fan \ + else "PSU-{} FAN-{}".format(self.fans_psu_index, self.fan_index) + return fan_name + + + + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + + return "N/A" + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return "N/A" + + 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) + """ + if self.is_psu_fan: + return super().get_speed() + else: + return super().get_target_speed() + + 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 = super().get_direction() + if direction is not None and len(direction) > 0: + return direction + + return 'N/A' diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/fan_drawer.py index 3b9bb607f6..e4e37f9620 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/fan_drawer.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/fan_drawer.py @@ -15,3 +15,27 @@ def __init__(self, tray_idx, pddf_data=None, pddf_plugin_data=None): PddfFanDrawer.__init__(self, tray_idx, pddf_data, pddf_plugin_data) # Provide the functions/variables below for which implementation is to be overwritten + def get_name(self): + """ + Retrieves the fan drawer name + Returns: + string: The name of the device + """ + return "FanTray{}".format(self.fantray_index) + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self._fan_list[0].get_model() + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return self._fan_list[0].get_serial() + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/helper.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/helper.py new file mode 100644 index 0000000000..b5e2e5a226 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/helper.py @@ -0,0 +1,368 @@ +import os +import struct +import json +import fcntl +from mmap import * +from sonic_py_common import device_info +from sonic_py_common import logger +from threading import Lock +from typing import cast +from sonic_py_common.general import getstatusoutput_noshell_pipe +from sonic_py_common.general import getstatusoutput_noshell + +HOST_CHK_CMD = ["docker"] +EMPTY_STRING = "" + + +class APIHelper(): + + def __init__(self): + (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() + + def is_host(self): + try: + status, output = getstatusoutput_noshell(HOST_CHK_CMD) + return status == 0 + except Exception: + return False + + def pci_get_value(self, resource, offset): + status = True + result = "" + try: + fd = os.open(resource, os.O_RDWR) + mm = mmap(fd, 0) + mm.seek(int(offset)) + read_data_stream = mm.read(4) + result = struct.unpack('I', read_data_stream) + except Exception: + status = False + return status, result + + def run_interactive_command(self, cmd): + try: + os.system(cmd) + except Exception: + return False + return True + + def read_txt_file(self, file_path): + try: + with open(file_path, 'r', errors='replace') as fd: + data = fd.read() + ret = data.strip() + if len(ret) > 0: + return ret + except IOError: + pass + return None + + 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 ipmi_raw(self, netfn, cmd): + status = True + result = "" + try: + err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'raw', str(netfn), str(cmd)]) + if err == [0]: + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result + + def ipmi_fru_id(self, id, key=None): + status = True + result = "" + try: + if (key is None): + err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'fru', 'print', str(id)]) + else: + err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'fru', 'print', str(id)], ['grep', str(key)]) + if err == [0] or err == [0, 0]: + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result + + def ipmi_set_ss_thres(self, id, threshold_key, value): + status = True + result = "" + try: + err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'sensor', 'thresh', str(id), str(threshold_key), str(value)]) + if err == [0]: + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result + + +class FileLock: + """ + Due to pmon docker not installing the py-filelock, this class + implements a simple file lock feature. + Ref: https://github.com/tox-dev/py-filelock/blob/main/src/filelock/ + """ + + def __init__(self, lock_file): + self._lock_file = lock_file + self._thread_lock = Lock() + self.is_locked = False + + def acquire(self): + with self._thread_lock: + if self.is_locked: + return + + fd = os.open(self._lock_file, flags=(os.O_RDWR | os.O_CREAT | os.O_TRUNC)) + fcntl.flock(fd, fcntl.LOCK_EX) + self._lock_file_fd = fd + self.is_locked = True + + def release(self): + with self._thread_lock: + if self.is_locked: + fd = cast(int, self._lock_file_fd) + self._lock_file_fd = None + fcntl.flock(fd, fcntl.LOCK_UN) + os.close(fd) + self.is_locked = False + + def __enter__(self): + self.acquire() + return self + + def __exit__(self, exc_type, exc_val, traceback): + self.release() + + def __del__(self): + self.release() + + +DEVICE_THRESHOLD_JSON_PATH = "/tmp/device_threshold.json" + +class DeviceThreshold: + HIGH_THRESHOLD = 'high_threshold' + LOW_THRESHOLD = 'low_threshold' + HIGH_CRIT_THRESHOLD = 'high_critical_threshold' + LOW_CRIT_THRESHOLD = 'low_critical_threshold' + NOT_AVAILABLE = 'N/A' + + def __init__(self, th_name = NOT_AVAILABLE): + self.flock = FileLock("{}.lock".format(DEVICE_THRESHOLD_JSON_PATH)) + self.name = th_name + self.__log = logger.Logger(log_identifier="DeviceThreshold") + + self.__db_data = {} + self.__db_mtime = 0 + + def __reload_db(self): + try: + db_data = {} + with self.flock: + with open(DEVICE_THRESHOLD_JSON_PATH, "r") as db_file: + db_data = json.load(db_file) + except Exception as e: + self.__log.log_warning('{}'.format(str(e))) + return None + + return db_data + + def __get_data(self, field): + """ + Retrieves data frome JSON file by field + + Args : + field: String + + Returns: + A string if getting is successfully, 'N/A' if not + """ + if os.path.exists(DEVICE_THRESHOLD_JSON_PATH): + new_mtime = os.path.getmtime(DEVICE_THRESHOLD_JSON_PATH) + if new_mtime != self.__db_mtime: + new_data = self.__reload_db() + if new_data is not None: + self.__db_data = new_data + self.__db_mtime = new_mtime + + if self.name not in self.__db_data.keys(): + return self.NOT_AVAILABLE + + if field not in self.__db_data[self.name].keys(): + return self.NOT_AVAILABLE + + return self.__db_data[self.name][field] + + def __set_data(self, field, new_val): + """ + Set data to JSON file by field + + Args : + field: String + new_val: String + + Returns: + A boolean, True if setting is set successfully, False if not + """ + if self.name not in self.__db_data.keys(): + self.__db_data[self.name] = {} + + old_val = self.__db_data[self.name].get(field, None) + if old_val is not None and old_val == new_val: + return True + + self.__db_data[self.name][field] = new_val + + try: + with self.flock: + db_data = {} + mode = "r+" if os.path.exists(DEVICE_THRESHOLD_JSON_PATH) else "w+" + with open(DEVICE_THRESHOLD_JSON_PATH, mode) as db_file: + if mode == "r+": + db_data = json.load(db_file) + + if self.name not in db_data.keys(): + db_data[self.name] = {} + + db_data[self.name][field] = new_val + + if mode == "r+": + db_file.seek(0) + # erase old data + db_file.truncate(0) + # write all data + json.dump(db_data, db_file, indent=4) + self.__db_mtime = os.path.getmtime(DEVICE_THRESHOLD_JSON_PATH) + except Exception as e: + self.__log.log_error('{}'.format(str(e))) + return False + + return True + + def get_high_threshold(self): + """ + Retrieves the high threshold temperature from JSON file. + + Returns: + string : the high threshold temperature of thermal, + e.g. "30.125" + """ + return self.__get_data(self.HIGH_THRESHOLD) + + def set_high_threshold(self, temperature): + """ + Sets the high threshold temperature of thermal + Args : + temperature: A string of temperature, e.g. "30.125" + Returns: + A boolean, True if threshold is set successfully, False if not + """ + if isinstance(temperature, str) is not True: + raise TypeError('The parameter requires string type.') + + try: + if temperature != self.NOT_AVAILABLE: + float(temperature) + except ValueError: + raise ValueError('The parameter requires a float string. ex:\"30.1\"') + + return self.__set_data(self.HIGH_THRESHOLD, temperature) + + def get_low_threshold(self): + """ + Retrieves the low threshold temperature from JSON file. + + Returns: + string : the low threshold temperature of thermal, + e.g. "30.125" + """ + return self.__get_data(self.LOW_THRESHOLD) + + def set_low_threshold(self, temperature): + """ + Sets the low threshold temperature of thermal + Args : + temperature: A string of temperature, e.g. "30.125" + Returns: + A boolean, True if threshold is set successfully, False if not + """ + if isinstance(temperature, str) is not True: + raise TypeError('The parameter requires string type.') + + try: + if temperature != self.NOT_AVAILABLE: + float(temperature) + except ValueError: + raise ValueError('The parameter requires a float string. ex:\"30.1\"') + + return self.__set_data(self.LOW_THRESHOLD, temperature) + + def get_high_critical_threshold(self): + """ + Retrieves the high critical threshold temperature from JSON file. + + Returns: + string : the high critical threshold temperature of thermal, + e.g. "30.125" + """ + return self.__get_data(self.HIGH_CRIT_THRESHOLD) + + def set_high_critical_threshold(self, temperature): + """ + Sets the high critical threshold temperature of thermal + Args : + temperature: A string of temperature, e.g. "30.125" + Returns: + A boolean, True if threshold is set successfully, False if not + """ + if isinstance(temperature, str) is not True: + raise TypeError('The parameter requires string type.') + + try: + if temperature != self.NOT_AVAILABLE: + float(temperature) + except ValueError: + raise ValueError('The parameter requires a float string. ex:\"30.1\"') + + return self.__set_data(self.HIGH_CRIT_THRESHOLD, temperature) + + def get_low_critical_threshold(self): + """ + Retrieves the low critical threshold temperature from JSON file. + + Returns: + string : the low critical threshold temperature of thermal, + e.g. "30.125" + """ + return self.__get_data(self.LOW_CRIT_THRESHOLD) + + def set_low_critical_threshold(self, temperature): + """ + Sets the low critical threshold temperature of thermal + Args : + temperature: A string of temperature, e.g. "30.125" + Returns: + A boolean, True if threshold is set successfully, False if not + """ + if isinstance(temperature, str) is not True: + raise TypeError('The parameter requires string type.') + + try: + if temperature != self.NOT_AVAILABLE: + float(temperature) + except ValueError: + raise ValueError('The parameter requires a float string. ex:\"30.1\"') + + return self.__set_data(self.LOW_CRIT_THRESHOLD, temperature) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/pcie.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/pcie.py new file mode 100644 index 0000000000..e4da32adf9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/pcie.py @@ -0,0 +1,19 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the fan status which are available in the platform +# Base PCIe class +############################################################################# + +try: + from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Pcie(PcieUtil): + """Edgecore Platform-specific PCIe class""" + + def __init__(self, platform_path): + PcieUtil.__init__(self, platform_path) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/psu.py index a2a3302065..a349319d4a 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/psu.py @@ -11,34 +11,120 @@ class Psu(PddfPsu): """PDDF Platform-Specific PSU class""" - PLATFORM_PSU_CAPACITY = 1200 - def __init__(self, index, pddf_data=None, pddf_plugin_data=None): PddfPsu.__init__(self, index, pddf_data, pddf_plugin_data) # Provide the functions/variables below for which implementation is to be overwritten - def get_maximum_supplied_power(self): + def get_voltage_high_threshold(self): + """ + Retrieves the high threshold PSU voltage output + Returns: + A float number, the high threshold output voltage in volts, + e.g. 12.1 + """ + return 14.72 + + def get_voltage_low_threshold(self): + """ + Retrieves the low threshold PSU voltage output + Returns: + A float number, the low threshold output voltage in volts, + e.g. 12.1 + """ + return 7.68 + + def get_name(self): + return "PSU-{}".format(self.psu_index) + + def get_temperature_high_threshold(self): + """ + Retrieves the high threshold temperature of PSU + Returns: + A float number, the high threshold temperature of PSU in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + threshold = super().get_temperature_high_threshold() + + for psu_thermal_idx in range(self.num_psu_thermals): + try: + tmp = self._thermal_list[psu_thermal_idx].get_high_threshold() + if threshold > tmp or threshold == 0.0: + threshold = tmp + except Exception: + pass + + return threshold + + def get_revision(self): + """ + Retrieves the hardware revision of the device + + Returns: + string: Revision value of device """ - Retrieves the maximum supplied power by PSU (or PSU capacity) + return 'N/A' + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: - A float number, the maximum power output in Watts. - e.g. 1200.1 + string: Model/part number of device """ - return float(self.PLATFORM_PSU_CAPACITY) + model = super().get_model() + if model and model.strip() == "": + return None - def get_capacity(self): + return model + + def get_serial(self): """ - Gets the capacity (maximum output power) of the PSU in watts + Retrieves the serial number of the device Returns: - An integer, the capacity of PSU + string: Serial number of device """ - return (self.PLATFORM_PSU_CAPACITY) + serial = super().get_serial() + if serial and serial.strip() == "": + return None + + return serial - def get_type(self): + def get_voltage(self): """ - Gets the type of the PSU + Retrieves current PSU voltage output + Returns: - A string, the type of PSU (AC/DC) + A float number, the output voltage in volts, + e.g. 12.1 """ - return "AC" + if self.get_status() is not True: + return 0.0 + + return super().get_voltage() + + def get_current(self): + """ + Retrieves present electric current supplied by PSU + + Returns: + A float number, electric current in amperes, + e.g. 15.4 + """ + if self.get_status() is not True: + return 0.0 + + return super().get_current() + + def get_power(self): + """ + Retrieves current energy supplied by PSU + + Returns: + A float number, the power in watts, + e.g. 302.6 + """ + if self.get_status() is not True: + return 0.0 + + return super().get_power() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/sfp.py index d9b6e491be..a0189bfcbc 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/sfp.py @@ -1,7 +1,10 @@ #!/usr/bin/env python try: + import natsort from sonic_platform_pddf_base.pddf_sfp import PddfSfp + from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper + from sonic_py_common import device_info except ImportError as e: raise ImportError (str(e) + "- required module not found") @@ -11,7 +14,180 @@ class Sfp(PddfSfp): PDDF Platform-Specific Sfp class """ + SFP_TYPE_CODE_LIST = [ + 0x03, # SFP/SFP+/SFP28 + 0x0b # DWDM-SFP/SFP+ + ] + QSFP_TYPE_CODE_LIST = [ + 0x0c, # QSFP + 0x0d, # QSFP+ or later + 0x11, # QSFP28 or later + 0xe1 # QSFP28 EDFA + ] + def __init__(self, index, pddf_data=None, pddf_plugin_data=None): PddfSfp.__init__(self, index, pddf_data, pddf_plugin_data) + self.index = self.port_index # Provide the functions/variables below for which implementation is to be overwritten + def __get_path_to_port_config_file(self): + platform, hwsku = device_info.get_platform_and_hwsku() + hwsku_path = "/".join(["/usr/share/sonic/platform",hwsku]) + return "/".join([hwsku_path, "port_config.ini"]) + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + sfputil_helper = SfpUtilHelper() + sfputil_helper.read_porttab_mappings( + self.__get_path_to_port_config_file()) + + logical_port_list = sfputil_helper.logical + logical_port_list = natsort.natsorted(logical_port_list) + name = logical_port_list[self.port_index-1] or "Unknown" + + return name + + def __validate_eeprom_sfp(self): + checksum_test = 0 + eeprom_raw = self.read_eeprom(0, 96) + if eeprom_raw is None: + return None + + for i in range(0, 63): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[63]: + return False + + checksum_test = 0 + for i in range(64, 95): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[95]: + return False + + api = self.get_xcvr_api() + if api is None: + return False + + if api.is_flat_memory(): + return True + + checksum_test = 0 + eeprom_raw = self.read_eeprom(384, 96) + if eeprom_raw is None: + return None + + for i in range(0, 95): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[95]: + return False + + return True + + def __validate_eeprom_qsfp(self): + checksum_test = 0 + eeprom_raw = self.read_eeprom(128, 96) + if eeprom_raw is None: + return None + + for i in range(0, 63): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[63]: + return False + + checksum_test = 0 + for i in range(64, 95): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[95]: + return False + + api = self.get_xcvr_api() + if api is None: + return False + + if api.is_flat_memory(): + return True + + return True + + def validate_eeprom(self): + id_byte_raw = self.read_eeprom(0, 1) + if id_byte_raw is None: + return None + + id = id_byte_raw[0] + if id in self.QSFP_TYPE_CODE_LIST: + return self.__validate_eeprom_qsfp() + elif id in self.SFP_TYPE_CODE_LIST: + return self.__validate_eeprom_sfp() + else: + return False + + def validate_temperature(self): + temperature = self.get_temperature() + if temperature is None: + return None + + threshold_dict = self.get_transceiver_threshold_info() + if threshold_dict is None: + return None + + if isinstance(temperature, float) is not True: + return True + + if isinstance(threshold_dict['temphighalarm'], float) is not True: + return True + + return threshold_dict['temphighalarm'] > temperature + + def __get_error_description(self): + if not self.get_presence(): + return self.SFP_STATUS_UNPLUGGED + + err_stat = self.SFP_STATUS_BIT_INSERTED + + status = self.validate_eeprom() + if status is not True: + err_stat = (err_stat | self.SFP_ERROR_BIT_BAD_EEPROM) + + status = self.validate_temperature() + if status is not True: + err_stat = (err_stat | self.SFP_ERROR_BIT_HIGH_TEMP) + + if err_stat is self.SFP_STATUS_BIT_INSERTED: + return self.SFP_STATUS_OK + else: + err_desc = '' + cnt = 0 + for key in self.SFP_ERROR_BIT_TO_DESCRIPTION_DICT: + if (err_stat & key) != 0: + if cnt > 0: + err_desc = err_desc + "|" + cnt = cnt + 1 + err_desc = err_desc + self.SFP_ERROR_BIT_TO_DESCRIPTION_DICT[key].replace(" ", "_") + + return err_desc + + def get_error_description(self): + """ + Retrives the error descriptions of the SFP module + Returns: + String that represents the current error descriptions of vendor specific errors + In case there are multiple errors, they should be joined by '|', + like: "Bad EEPROM|Unsupported cable" + """ + try: + ret = super().get_error_description() + if ret is not None: + return ret + except NotImplementedError: + pass + return self.__get_error_description() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/thermal.py index 77d6ec7ae8..6bf478bbda 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/sonic_platform/thermal.py @@ -3,15 +3,294 @@ try: from sonic_platform_pddf_base.pddf_thermal import PddfThermal + from .helper import DeviceThreshold except ImportError as e: raise ImportError(str(e) + "- required module not found") +NOT_AVAILABLE = DeviceThreshold.NOT_AVAILABLE +HIGH_THRESHOLD = DeviceThreshold.HIGH_THRESHOLD +LOW_THRESHOLD = DeviceThreshold.LOW_THRESHOLD +HIGH_CRIT_THRESHOLD = DeviceThreshold.HIGH_CRIT_THRESHOLD +LOW_CRIT_THRESHOLD = DeviceThreshold.LOW_CRIT_THRESHOLD +DEFAULT_THRESHOLD = { + 'CB_temp(0x4B)' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'FB_temp(0x4C)' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'MB_FrontMAC_temp(0x49)' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'MB_LeftCenter_temp(0x4A)' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'MB_RearMAC_temp(0x48)' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'CPU_Package_temp' : { + HIGH_THRESHOLD : '82.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : '104.0', + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'CPU_Core_0_temp' : { + HIGH_THRESHOLD : '82.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : '104.0', + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'CPU_Core_1_temp' : { + HIGH_THRESHOLD : '82.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : '104.0', + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'CPU_Core_2_temp' : { + HIGH_THRESHOLD : '82.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : '104.0', + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'CPU_Core_3_temp' : { + HIGH_THRESHOLD : '82.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : '104.0', + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'PSU-1 temp sensor 1' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'PSU-2 temp sensor 1' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + } +} class Thermal(PddfThermal): """PDDF Platform-Specific Thermal class""" def __init__(self, index, pddf_data=None, pddf_plugin_data=None, is_psu_thermal=False, psu_index=0): PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data, is_psu_thermal, psu_index) + # Threshold Configuration + self.__conf = DeviceThreshold(self.get_name()) + # Default threshold. + self.__default_threshold = DEFAULT_THRESHOLD[self.get_name()] + self.min_temperature = None + self.max_temperature = None + + self.pddf_obj = pddf_data + self.thermal_obj_name = "TEMP{}".format(self.thermal_index) + self.thermal_obj = self.pddf_obj.data[self.thermal_obj_name] # Provide the functions/variables below for which implementation is to be overwritten + def get_name(self): + if self.is_psu_thermal: + return "PSU-{0} temp sensor 1".format(self.thermals_psu_index) + else: + if 'dev_attr' in self.thermal_obj.keys(): + if 'display_name' in self.thermal_obj['dev_attr']: + return str(self.thermal_obj['dev_attr']['display_name']) + + # In case of errors + return "Temp sensor {0}".format(self.thermal_index) + + def get_status(self): + get_temp=self.get_temperature() + + if get_temp is not None: + return True if get_temp else False + + def get_temperature(self): + current = super().get_temperature() + + if self.min_temperature is None or \ + current < self.min_temperature: + self.min_temperature = current + + if self.max_temperature is None or \ + current > self.max_temperature: + self.max_temperature = current + + return current + + def set_high_threshold(self, temperature): + try: + value = float(temperature) + except Exception: + return False + + # The new value can not be more than the default value. + default_value = self.__default_threshold[HIGH_THRESHOLD] + if default_value != NOT_AVAILABLE: + if value > float(default_value): + return False + + try: + self.__conf.set_high_threshold(str(value)) + except Exception: + return False + + return True + + def get_high_threshold(self): + value = self.__conf.get_high_threshold() + if value != NOT_AVAILABLE: + return float(value) + + default_value = self.__default_threshold[HIGH_THRESHOLD] + if default_value != NOT_AVAILABLE: + return float(default_value) + + raise NotImplementedError + + def set_low_threshold(self, temperature): + try: + value = float(temperature) + except Exception: + return False + + # The new value can not be less than the default value. + default_value = self.__default_threshold[LOW_THRESHOLD] + if default_value != NOT_AVAILABLE: + if value < float(default_value): + return False + + try: + self.__conf.set_low_threshold(str(value)) + except Exception: + return False + + return True + + def get_low_threshold(self): + value = self.__conf.get_low_threshold() + if value != NOT_AVAILABLE: + return float(value) + + default_value = self.__default_threshold[LOW_THRESHOLD] + if default_value != NOT_AVAILABLE: + return float(default_value) + + raise NotImplementedError + + def set_high_critical_threshold(self, temperature): + try: + value = float(temperature) + except Exception: + return False + + # The new value can not be more than the default value. + default_value = self.__default_threshold[HIGH_CRIT_THRESHOLD] + if default_value != NOT_AVAILABLE: + if value > float(default_value): + return False + + try: + self.__conf.set_high_critical_threshold(str(value)) + except Exception: + return False + + return True + + def get_high_critical_threshold(self): + value = self.__conf.get_high_critical_threshold() + if value != NOT_AVAILABLE: + return float(value) + + default_value = self.__default_threshold[HIGH_CRIT_THRESHOLD] + if default_value != NOT_AVAILABLE: + return float(default_value) + + raise NotImplementedError + + def set_low_critical_threshold(self, temperature): + try: + value = float(temperature) + except Exception: + return False + + # The new value can not be less than the default value. + default_value = self.__default_threshold[LOW_CRIT_THRESHOLD] + if default_value != NOT_AVAILABLE: + if value < float(default_value): + return False + + try: + self.__conf.set_low_critical_threshold(str(value)) + except Exception: + return False + + return True + + def get_low_critical_threshold(self): + value = self.__conf.get_low_critical_threshold() + if value != NOT_AVAILABLE: + return float(value) + + default_value = self.__default_threshold[LOW_CRIT_THRESHOLD] + if default_value != NOT_AVAILABLE: + return float(default_value) + + raise NotImplementedError + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return 'N/A' + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return 'N/A' + + def get_minimum_recorded(self): + """ + Retrieves the minimum recorded temperature of thermal + Returns: + A float number, the minimum recorded temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.min_temperature is None: + self.get_temperature() + + return self.min_temperature + + def get_maximum_recorded(self): + """ + Retrieves the maximum recorded temperature of thermal + Returns: + A float number, the maximum recorded temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.max_temperature is None: + self.get_temperature() + + return self.max_temperature diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_pddf_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_pddf_monitor.py index 2b18ac646a..5d27ba134a 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_pddf_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_pddf_monitor.py @@ -21,6 +21,7 @@ # 4/20/2018: Jostar modify for as7726_32x # 12/03/2018:Jostar modify for as7726_32x thermal plan # 11/16/2020:Jostar modify for as7726_32x thermal plan based on PDDF +# 11/19/2023:Jostar modify to add kick fan-wdt # ------------------------------------------------------------------ try: @@ -32,6 +33,7 @@ import logging.handlers import time from sonic_platform import platform + from sonic_py_common.general import getstatusoutput_noshell except ImportError as e: raise ImportError('%s - required module not found' % str(e)) @@ -162,7 +164,7 @@ def manage_fans(self): } fan_dir= platform_chassis.get_fan(0).get_direction() - if fan_dir == 'EXHAUST': + if fan_dir == 'exhaust': fan_policy = fan_policy_f2b else: fan_policy = fan_policy_b2f @@ -305,15 +307,47 @@ def main(argv): global platform_chassis platform_chassis = platform.Platform().get_chassis() - + #cmd_str = ["i2cset", "-y", "-f", "54", "0x66", "0x33", "0x0"] + #status, output = getstatusoutput_noshell(cmd_str) + #if status: + # print("Warning: Fan speed watchdog could not be disabled") + + cmd_str = ["i2cset", "-y", "-f", "54", "0x66", "0x33", "0x1"] + status, output = getstatusoutput_noshell(cmd_str) + if status: + print("Warning: Fan speed watchdog could not be enabled") + + #Timer need to be set after enable. + #if set timer is eralier than enable wdt. Speed will become to wdt speed after 6sec. + cmd_str = ["i2cset", "-y", "-f", "54", "0x66", "0x31", "0xF0"] + status, output = getstatusoutput_noshell(cmd_str) + if status: + print("Warning: Fan speed watchdog timer could not be disabled") + platform_chassis.get_fan(0).set_speed(38) print("set default fan speed to 37.5%") monitor = device_monitor(log_file, log_level) + + cmd_kick = ["i2cset", "-y", "-f", "54", "0x66", "0x31", "0xF0"] #kick WDT + cmd_check_wdt = ["i2cget", "-y", "-f", "54", "0x66", "0x33"] # Loop forever, doing something useful hopefully: while True: monitor.manage_fans() + getstatusoutput_noshell(cmd_kick) time.sleep(10) + #polling to check fan-wdt status + status, output = getstatusoutput_noshell(cmd_check_wdt) + if status is not None: + val= int(output,16) + if (val & 0x1) == 0: + logging.warning('Detect Fan-WDT disable') + logging.warning('Try to enable Fan-WDT') + cmd_str = ["i2cset", "-y", "-f", "54", "0x66", "0x33", "0x1"] + getstatusoutput_noshell(cmd_str) + cmd_str = ["i2cset", "-y", "-f", "54", "0x66", "0x31", "0xF0"] + getstatusoutput_noshell(cmd_str) + if __name__ == '__main__': main(sys.argv[1:]) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_util.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_util.py index 949f1230de..0386e74001 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_util.py @@ -16,22 +16,27 @@ # along with this program. If not, see . """ -Usage: %(scriptName)s [options] command object - -options: - -h | --help : this help message - -d | --debug : run with debug mode - -f | --force : ignore error during installation or clean -command: - install : install drivers and generate related sysfs nodes - clean : uninstall drivers and remove related sysfs nodes +usage: accton_as7726_32x_util.py [-h] [-d] [-f] {install,clean,threshold} ... + +AS7726-32X Platform Utility + +optional arguments: + -h, --help show this help message and exit + -d, --debug run with debug mode + -f, --force ignore error during installation or clean + +Utility Command: + {install,clean,threshold} + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes + threshold : modify thermal threshold """ import subprocess -import getopt import sys import logging import re import time +import argparse from sonic_py_common.general import getstatusoutput_noshell PROJECT_NAME = 'as7726_32x' @@ -109,37 +114,44 @@ def main(): global DEBUG global args global FORCE + global THRESHOLD_RANGE_LOW, THRESHOLD_RANGE_HIGH + + util_parser = argparse.ArgumentParser(description="AS7726-32X Platform Utility") + util_parser.add_argument("-d", "--debug", dest='debug', action='store_true', default=False, + help="run with debug mode") + util_parser.add_argument("-f", "--force", dest='force', action='store_true', default=False, + help="ignore error during installation or clean") + subcommand = util_parser.add_subparsers(dest='cmd', title='Utility Command', required=True) + subcommand.add_parser('install', help=': install drivers and generate related sysfs nodes') + subcommand.add_parser('clean', help=': uninstall drivers and remove related sysfs nodes') + threshold_parser = subcommand.add_parser('threshold', help=': modify thermal threshold') + threshold_parser.add_argument("-l", dest='list', action='store_true', default=False, + help="list avaliable thermal") + threshold_parser.add_argument("-t", dest='thermal', type=str, metavar='THERMAL_NAME', + help="thermal name, ex: -t 'Temp sensor 1'") + threshold_parser.add_argument("-ht", dest='high_threshold', type=restricted_float, + metavar='THRESHOLD_VALUE', + help="high threshold: %.1f ~ %.1f" % (THRESHOLD_RANGE_LOW, THRESHOLD_RANGE_HIGH)) + threshold_parser.add_argument("-hct", dest='high_crit_threshold', type=restricted_float, + metavar='THRESHOLD_VALUE', + help="high critical threshold : %.1f ~ %.1f" % (THRESHOLD_RANGE_LOW, THRESHOLD_RANGE_HIGH)) + args = util_parser.parse_args() - if len(sys.argv)<2: - show_help() - - options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', - 'debug', - 'force', - ]) if DEBUG == True: - print(options) print(args) print((len(sys.argv))) - for opt, arg in options: - if opt in ('-h', '--help'): - show_help() - elif opt in ('-d', '--debug'): - DEBUG = True - logging.basicConfig(level=logging.INFO) - elif opt in ('-f', '--force'): - FORCE = 1 - else: - logging.info('no option') - for arg in args: - if arg == 'install': - do_install() - elif arg == 'clean': - do_uninstall() - else: - show_help() + DEBUG = args.debug + if DEBUG: + logging.basicConfig(level=logging.INFO) + FORCE = 1 if args.force else 0 + if args.cmd == 'install': + do_install() + elif args.cmd == 'clean': + do_uninstall() + elif args.cmd == 'threshold': + do_threshold() return 0 @@ -365,5 +377,162 @@ def device_exist(): ret2, log = log_os_system("ls "+i2c_prefix+"i2c-2", 0) return not(ret1 or ret2) +THRESHOLD_RANGE_LOW = 30.0 +THRESHOLD_RANGE_HIGH = 110.0 +# Code to initialize chassis object +init_chassis_code = \ + "import sonic_platform.platform\n"\ + "platform = sonic_platform.platform.Platform()\n"\ + "chassis = platform.get_chassis()\n\n" + +# Looking for thermal +looking_for_thermal_code = \ + "thermal = None\n"\ + "all_thermals = chassis.get_all_thermals()\n"\ + "for psu in chassis.get_all_psus():\n"\ + " all_thermals += psu.get_all_thermals()\n"\ + "for tmp in all_thermals:\n"\ + " if '{}' == tmp.get_name():\n"\ + " thermal = tmp\n"\ + " break\n"\ + "if thermal == None:\n"\ + " print('{} not found!')\n"\ + " exit(1)\n\n" + +def avaliable_thermals(): + global init_chassis_code + + get_all_thermal_name_code = \ + "thermal_list = []\n"\ + "all_thermals = chassis.get_all_thermals()\n"\ + "for psu in chassis.get_all_psus():\n"\ + " all_thermals += psu.get_all_thermals()\n"\ + "for tmp in all_thermals:\n"\ + " thermal_list.append(tmp.get_name())\n"\ + "print(str(thermal_list)[1:-1])\n" + + all_code = "{}{}".format(init_chassis_code, get_all_thermal_name_code) + + status, output = getstatusoutput_noshell(["docker", "exec", "pmon", "python3", "-c", all_code]) + if status != 0: + return "" + return output + +def restricted_float(x): + global THRESHOLD_RANGE_LOW, THRESHOLD_RANGE_HIGH + + try: + x = float(x) + except ValueError: + raise argparse.ArgumentTypeError("%r not a floating-point literal" % (x,)) + + if x < THRESHOLD_RANGE_LOW or x > THRESHOLD_RANGE_HIGH: + raise argparse.ArgumentTypeError("%r not in range [%.1f ~ %.1f]" % + (x, THRESHOLD_RANGE_LOW, THRESHOLD_RANGE_HIGH)) + + return x + +def get_high_threshold(name): + global init_chassis_code, looking_for_thermal_code + + get_high_threshold_code = \ + "try:\n"\ + " print(thermal.get_high_threshold())\n"\ + " exit(0)\n"\ + "except NotImplementedError:\n"\ + " print('Not implement the get_high_threshold method!')\n"\ + " exit(1)" + + all_code = "{}{}{}".format(init_chassis_code, looking_for_thermal_code.format(name, name), + get_high_threshold_code) + + status, output = getstatusoutput_noshell(["docker", "exec", "pmon", "python3", "-c", all_code]) + if status == 1: + return None + + return float(output) + +def get_high_crit_threshold(name): + global init_chassis_code, looking_for_thermal_code + + get_high_crit_threshold_code = \ + "try:\n"\ + " print(thermal.get_high_critical_threshold())\n"\ + " exit(0)\n"\ + "except NotImplementedError:\n"\ + " print('Not implement the get_high_critical_threshold method!')\n"\ + " exit(1)" + + all_code = "{}{}{}".format(init_chassis_code, looking_for_thermal_code.format(name, name), + get_high_crit_threshold_code) + + status, output = getstatusoutput_noshell(["docker", "exec", "pmon", "python3", "-c", all_code]) + if status == 1: + return None + + return float(output) + +def do_threshold(): + global args, init_chassis_code, looking_for_thermal_code + + if args.list: + print("Thermals: " + avaliable_thermals()) + return + + if args.thermal is None: + print("The following arguments are required: -t") + return + + set_threshold_code = "" + if args.high_threshold is not None: + if args.high_crit_threshold is not None and \ + args.high_threshold >= args.high_crit_threshold: + print("Invalid Threshold!(High threshold can not be more than " \ + "or equal to high critical threshold.)") + exit(1) + + high_crit = get_high_crit_threshold(args.thermal) + if high_crit is not None and \ + args.high_threshold >= high_crit: + print("Invalid Threshold!(High threshold can not be more than " \ + "or equal to high critical threshold.)") + exit(1) + + set_threshold_code += \ + "try:\n"\ + " if thermal.set_high_threshold({}) is False:\n"\ + " print('{}: set_high_threshold failure!')\n"\ + " exit(1)\n"\ + "except NotImplementedError:\n"\ + " print('Not implement the set_high_threshold method!')\n"\ + "print('Apply the new high threshold successfully.')\n"\ + "\n".format(args.high_threshold, args.thermal) + + if args.high_crit_threshold is not None: + high = get_high_threshold(args.thermal) + if high is not None and \ + args.high_crit_threshold <= high: + print("Invalid Threshold!(High critical threshold can not " \ + "be less than or equal to high threshold.)") + exit(1) + + set_threshold_code += \ + "try:\n"\ + " if thermal.set_high_critical_threshold({}) is False:\n"\ + " print('{}: set_high_critical_threshold failure!')\n"\ + " exit(1)\n"\ + "except NotImplementedError:\n"\ + " print('Not implement the set_high_critical_threshold method!')\n"\ + "print('Apply the new high critical threshold successfully.')\n"\ + "\n".format(args.high_crit_threshold, args.thermal) + + if set_threshold_code == "": + return + + all_code = "{}{}{}".format(init_chassis_code, looking_for_thermal_code.format(args.thermal, args.thermal), set_threshold_code) + + status, output = getstatusoutput_noshell(["docker", "exec", "pmon", "python3", "-c", all_code]) + print(output) + if __name__ == "__main__": main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-64x-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-64x-platform-monitor.service index f361642e69..e9005d1477 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-64x-platform-monitor.service +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-64x-platform-monitor.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS7816-64X Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=as7816-64x-platform-init.service Requires=as7816-64x-platform-init.service DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-pddf-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-pddf-platform-monitor.service index 7b6db7ddac..825a76fded 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-pddf-platform-monitor.service +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/service/as7816-pddf-platform-monitor.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS7816-64X Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=pddf-platform-init.service DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/classes/fanutil.py index 2afbf905a3..f4833b0b9c 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/classes/fanutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/classes/fanutil.py @@ -45,20 +45,12 @@ class FanUtil(object): BASE_VAL_PATH = '/sys/bus/i2c/devices/17-0066/{0}' FAN_DUTY_PATH = '/sys/bus/i2c/devices/17-0066/fan_duty_cycle_percentage' - #logfile = '' - #loglevel = logging.INFO - """ Dictionary where key1 = fan id index (integer) starting from 1 key2 = fan node index (interger) starting from 1 value = path to fan device file (string) """ _fan_device_path_mapping = {} -#fan1_direction -#fan1_fault -#fan1_present - - #(FAN_NUM_2_IDX, FAN_NODE_DUTY_IDX_OF_MAP): 'fan2_duty_cycle_percentage', _fan_device_node_mapping = { (FAN_NUM_1_IDX, FAN_NODE_FAULT_IDX_OF_MAP): 'fan1_fault', (FAN_NUM_1_IDX, FAN_NODE_DIR_IDX_OF_MAP): 'fan1_direction', @@ -106,7 +98,7 @@ def _get_fan_node_val(self, fan_num, node_num): return None try: - val_file.close() + val_file.close() except: logging.debug('GET. unable to close file. device_path:%s', device_path) return None @@ -137,7 +129,7 @@ def _set_fan_node_val(self, fan_num, node_num, val): val_file.write(content) try: - val_file.close() + val_file.close() except: logging.debug('GET. unable to close file. device_path:%s', device_path) return None @@ -184,7 +176,7 @@ def get_fan_duty_cycle(self): try: val_file = open(self.FAN_DUTY_PATH) except IOError as e: - print("Error: unable to open file: %s" % str(e)) + print("Error: unable to open file: %s" % str(e)) return False content = val_file.readline().rstrip() @@ -196,7 +188,7 @@ def set_fan_duty_cycle(self, val): try: fan_file = open(self.FAN_DUTY_PATH, 'r+') except IOError as e: - print("Error: unable to open file: %s" % str(e)) + print("Error: unable to open file: %s" % str(e)) return False fan_file.write(str(val)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/classes/thermalutil.py index 5f6af3811f..124098b74a 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/classes/thermalutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/classes/thermalutil.py @@ -24,7 +24,6 @@ import time import logging import glob - import subprocess from collections import namedtuple except ImportError as e: raise ImportError('%s - required module not found' % str(e)) @@ -76,7 +75,7 @@ def _get_thermal_val(self, thermal_num): logging.debug('GET. content is NULL. device_path:%s', device_path) return None try: - val_file.close() + val_file.close() except: logging.debug('GET. unable to close file. device_path:%s', device_path) return None diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_as9716_32d_psu.c b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_as9716_32d_psu.c index 06e8e23c3c..3584e2aeaa 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_as9716_32d_psu.c +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_as9716_32d_psu.c @@ -34,8 +34,13 @@ #include #include -#define MAX_MODEL_NAME 16 +#define MAX_MODEL_NAME 19 #define MAX_SERIAL_NUMBER 19 +#define FAN_DIR_LEN 3 + +const char FAN_DIR_F2B[] = "F2B"; +const char FAN_DIR_B2F[] = "B2F"; +const char FAN_DIR_UNKNOWN[] = ""; static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); static ssize_t show_string(struct device *dev, struct device_attribute *da, char *buf); @@ -55,8 +60,9 @@ struct as9716_32d_psu_data { unsigned long last_updated; /* In jiffies */ u8 index; /* PSU index */ u8 status; /* Status(present/power_good) register read from CPLD */ - char model_name[MAX_MODEL_NAME]; /* Model name, read from eeprom */ - char serial_number[MAX_SERIAL_NUMBER]; + char model_name[MAX_MODEL_NAME+1]; /* Model name, read from eeprom */ + char serial_number[MAX_SERIAL_NUMBER+1]; + const char* fan_dir; }; static struct as9716_32d_psu_data *as9716_32d_psu_update_device(struct device *dev); @@ -65,7 +71,8 @@ enum as9716_32d_psu_sysfs_attributes { PSU_PRESENT, PSU_MODEL_NAME, PSU_POWER_GOOD, - PSU_SERIAL_NUMBER + PSU_SERIAL_NUMBER, + PSU_FAN_DIR }; /* sysfs attributes for hwmon @@ -74,13 +81,14 @@ static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, show_status, NULL, PSU_PRE static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_string, NULL, PSU_MODEL_NAME); static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_status, NULL, PSU_POWER_GOOD); static SENSOR_DEVICE_ATTR(psu_serial_number, S_IRUGO, show_string, NULL, PSU_SERIAL_NUMBER); - +static SENSOR_DEVICE_ATTR(psu_fan_dir, S_IRUGO, show_string, NULL, PSU_FAN_DIR); static struct attribute *as9716_32d_psu_attributes[] = { &sensor_dev_attr_psu_present.dev_attr.attr, &sensor_dev_attr_psu_model_name.dev_attr.attr, &sensor_dev_attr_psu_power_good.dev_attr.attr, &sensor_dev_attr_psu_serial_number.dev_attr.attr, + &sensor_dev_attr_psu_fan_dir.dev_attr.attr, NULL }; @@ -106,7 +114,7 @@ static ssize_t show_string(struct device *dev, struct device_attribute *da, { struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct as9716_32d_psu_data *data = as9716_32d_psu_update_device(dev); - char *ptr = NULL; + const char *ptr = NULL; if (!data->valid) { return -EIO; @@ -119,6 +127,9 @@ static ssize_t show_string(struct device *dev, struct device_attribute *da, case PSU_SERIAL_NUMBER: ptr = data->serial_number; break; + case PSU_FAN_DIR: + ptr = data->fan_dir; + break; default: return -EINVAL; } @@ -244,6 +255,44 @@ static int as9716_32d_psu_read_block(struct i2c_client *client, u8 command, u8 * return result; } +enum psu_type { + PSU_TYPE_AC_ACBEL_FSF019_F2B, // FSF019 + PSU_TYPE_AC_ACBEL_FSH082_F2B, // FSH082-610G + PSU_TYPE_AC_ACBEL_FSH095_B2F, // FSH095-610G + PSU_TYPE_3Y_YESM1300AM // YESM1300AM-2A01P10(F2B) or YESM1300AM-2R01P10(B2F) +}; + +struct model_name_info { + enum psu_type type; + u8 offset; + u8 length; + u8 chk_length; + char* model_name; + const char* fan_dir; +}; + +struct serial_number_info { + enum psu_type type; + u8 offset; + u8 length; + u8 chk_length; + char* serial_number; +}; + +struct model_name_info models[] = { + { PSU_TYPE_AC_ACBEL_FSF019_F2B, 0x20, 13, 6, "FSF019", FAN_DIR_F2B }, + { PSU_TYPE_AC_ACBEL_FSH082_F2B, 0x20, 13, 6, "FSH082", FAN_DIR_F2B }, + { PSU_TYPE_AC_ACBEL_FSH095_B2F, 0x20, 13, 6, "FSH095", FAN_DIR_B2F }, + { PSU_TYPE_3Y_YESM1300AM, 0x20, 19, 8, "YESM1300", NULL } +}; + +struct serial_number_info serials[] = { + { PSU_TYPE_AC_ACBEL_FSF019_F2B, 0x2e, 16, 16, "FSF019" }, + { PSU_TYPE_AC_ACBEL_FSH082_F2B, 0x35, 18, 18, "FSH082" }, + { PSU_TYPE_AC_ACBEL_FSH095_B2F, 0x35, 18, 18, "FSH095" }, + { PSU_TYPE_3Y_YESM1300AM, 0x35, 19, 19, "YESM1300" } +}; + static struct as9716_32d_psu_data *as9716_32d_psu_update_device(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -253,53 +302,102 @@ static struct as9716_32d_psu_data *as9716_32d_psu_update_device(struct device *d if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || !data->valid) { - int status; + int i, status; int power_good = 0; dev_dbg(&client->dev, "Starting as9716_32d update\n"); + data->valid = 0; /* Read psu status */ status = as9716_32d_cpld_read(0x60, 0x3); if (status < 0) { dev_dbg(&client->dev, "cpld reg 0x60 err %d\n", status); + goto exit; } else { data->status = status; } /* Read model name */ - memset(data->model_name, 0, sizeof(data->model_name)); - memset(data->serial_number, 0, sizeof(data->serial_number)); + data->model_name[0] = '\0'; + data->serial_number[0] = '\0'; + data->fan_dir = FAN_DIR_UNKNOWN; power_good = (data->status >> (3-data->index) & 0x1); - + if (power_good) { - status = as9716_32d_psu_read_block(client, 0x20, data->model_name, - ARRAY_SIZE(data->model_name)-1); - if (status < 0) { - data->model_name[0] = '\0'; - dev_dbg(&client->dev, "unable to read model name from (0x%x)\n", client->addr); - } - else { - data->model_name[ARRAY_SIZE(data->model_name)-1] = '\0'; - + for (i = 0; i < ARRAY_SIZE(models); i++) { + memset(data->model_name, 0, sizeof(data->model_name)); + memset(data->serial_number, 0, sizeof(data->serial_number)); + + status = as9716_32d_psu_read_block(client, models[i].offset, + data->model_name, models[i].length); + if (status < 0) { + data->model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x%x)\n", + client->addr, models[i].offset); + goto exit; + } + else { + data->model_name[models[i].length] = '\0'; + } + + /* Determine if the model name is known, if not, read next index + */ + if (strncmp(data->model_name, models[i].model_name, models[i].chk_length) == 0) { + status = as9716_32d_psu_read_block(client, serials[i].offset, + data->serial_number, serials[i].length); + if (models[i].type == PSU_TYPE_3Y_YESM1300AM) { + // Adjust model name for PSU_TYPE_3Y_YESM1300AM + char buf[10] = {0}; + memcpy(buf, &data->model_name[9], 10); + memcpy(&data->model_name[8], buf, 10); + data->model_name[models[i].length-1] = '\0'; + + if (data->model_name[12] == 'A') + data->fan_dir = FAN_DIR_F2B; // YESM1300AM-2A01P10 + else + data->fan_dir = FAN_DIR_B2F; // YESM1300AM-2R01P10 + } + else if ((models[i].type == PSU_TYPE_AC_ACBEL_FSH082_F2B) || + (models[i].type == PSU_TYPE_AC_ACBEL_FSH095_B2F) || + (models[i].type == PSU_TYPE_AC_ACBEL_FSF019_F2B)) { + // Adjust model name for FSH082 / FSH095 / FSF019 + char buf[4] = {0}; + memcpy(buf, &data->model_name[9], 4); + memcpy(&data->model_name[7], buf, 4); + data->model_name[6] = '-'; + data->model_name[11] = '\0'; + data->fan_dir = models[i].fan_dir; + } + else { + data->fan_dir = models[i].fan_dir; + } + + // Read serial number + if (status < 0) { + data->serial_number[0] = '\0'; + dev_dbg(&client->dev, "unable to read serial num from (0x%x) offset(0x%x)\n", + client->addr, serials[i].offset); + goto exit; + } + else { + data->serial_number[serials[i].length] = '\0'; + break; + } + } + else { + data->serial_number[0] = '\0'; // model does not match, read next model + } } - /* Read from offset 0x2e ~ 0x3d (16 bytes) */ - status = as9716_32d_psu_read_block(client, 0x2e,data->serial_number, MAX_SERIAL_NUMBER); - if (status < 0) - { - data->serial_number[0] = '\0'; - dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x2e)\n", client->addr); - } - data->serial_number[MAX_SERIAL_NUMBER-1]='\0'; } data->last_updated = jiffies; data->valid = 1; } +exit: mutex_unlock(&data->update_lock); - return data; } @@ -308,4 +406,3 @@ module_i2c_driver(as9716_32d_psu_driver); MODULE_AUTHOR("Jostar Yang "); MODULE_DESCRIPTION("as9716_32d_psu driver"); MODULE_LICENSE("GPL"); - diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_i2c_psu.c b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_i2c_psu.c index df7324de56..3ddda2eef0 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_i2c_psu.c +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/accton_i2c_psu.c @@ -526,6 +526,7 @@ static struct accton_i2c_psu_data *accton_i2c_psu_update_device(struct device *d if (status < 0) { dev_dbg(&client->dev, "reg %d, err %d\n", regs_byte[i].reg, status); + *(regs_byte[i].value) = 0; } else { *(regs_byte[i].value) = status; @@ -539,6 +540,7 @@ static struct accton_i2c_psu_data *accton_i2c_psu_update_device(struct device *d if (status < 0) { dev_dbg(&client->dev, "reg %d, err %d\n", regs_word[i].reg, status); + *(regs_word[i].value) = 0; } else { *(regs_word[i].value) = status; @@ -546,33 +548,33 @@ static struct accton_i2c_psu_data *accton_i2c_psu_update_device(struct device *d } /* Read mfr_id */ - status = accton_i2c_psu_read_block_data(client, PMBUS_REGISTER_MFR_ID, data->mfr_id, - ARRAY_SIZE(data->mfr_id)); - if (status < 0) { - dev_dbg(&client->dev, "reg %d, err %d\n", PMBUS_REGISTER_MFR_ID, status); - goto exit; - } - /* Read mfr_model */ - status = accton_i2c_psu_read_block_data(client, PMBUS_REGISTER_MFR_MODEL, data->mfr_model, - ARRAY_SIZE(data->mfr_model)); - if (status < 0) { - dev_dbg(&client->dev, "reg %d, err %d\n", PMBUS_REGISTER_MFR_MODEL, status); - goto exit; - } + status = accton_i2c_psu_read_block_data(client, PMBUS_REGISTER_MFR_ID, data->mfr_id, + ARRAY_SIZE(data->mfr_id)); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", PMBUS_REGISTER_MFR_ID, status); + goto exit; + } + /* Read mfr_model */ + status = accton_i2c_psu_read_block_data(client, PMBUS_REGISTER_MFR_MODEL, data->mfr_model, + ARRAY_SIZE(data->mfr_model)); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", PMBUS_REGISTER_MFR_MODEL, status); + goto exit; + } /* Read mfr_revsion */ - status = accton_i2c_psu_read_block_data(client, PMBUS_REGISTER_MFR_REVISION, data->mfr_revsion, - ARRAY_SIZE(data->mfr_revsion)); - if (status < 0) { - dev_dbg(&client->dev, "reg %d, err %d\n", PMBUS_REGISTER_MFR_REVISION, status); - goto exit; - } - /* Read mfr_serial */ - status = accton_i2c_psu_read_block_data(client, PMBUS_REGISTER_MFR_SERIAL, data->mfr_serial, - ARRAY_SIZE(data->mfr_serial)); - if (status < 0) { - dev_dbg(&client->dev, "reg %d, err %d\n", PMBUS_REGISTER_MFR_SERIAL, status); - goto exit; - } + status = accton_i2c_psu_read_block_data(client, PMBUS_REGISTER_MFR_REVISION, data->mfr_revsion, + ARRAY_SIZE(data->mfr_revsion)); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", PMBUS_REGISTER_MFR_REVISION, status); + goto exit; + } + /* Read mfr_serial */ + status = accton_i2c_psu_read_block_data(client, PMBUS_REGISTER_MFR_SERIAL, data->mfr_serial, + ARRAY_SIZE(data->mfr_serial)); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", PMBUS_REGISTER_MFR_SERIAL, status); + goto exit; + } data->last_updated = jiffies; data->valid = 1; diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/pddf_custom_psu.c b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/pddf_custom_psu.c index 05f27f6fed..e3ffc0e7ef 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/pddf_custom_psu.c +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/modules/pddf_custom_psu.c @@ -1,3 +1,5 @@ + +#include #include #include #include @@ -15,16 +17,22 @@ ssize_t pddf_show_custom_psu_v_out(struct device *dev, struct device_attribute * extern PSU_SYSFS_ATTR_DATA access_psu_v_out; ssize_t pddf_get_custom_psu_model_name(struct device *dev, struct device_attribute *da, char *buf); ssize_t pddf_get_custom_psu_serial_num(struct device *dev, struct device_attribute *da, char *buf); +ssize_t pddf_get_custom_psu_fan_dir(struct device *dev, struct device_attribute *da, char *buf); extern PSU_SYSFS_ATTR_DATA access_psu_model_name; extern PSU_SYSFS_ATTR_DATA access_psu_serial_num; +extern PSU_SYSFS_ATTR_DATA access_psu_fan_dir; -#define MAX_MODEL_NAME 16 +#define MAX_FAN_DIR_LEN 3 +#define MAX_MODEL_NAME 18 #define MAX_SERIAL_NUMBER 19 +const char FAN_DIR_F2B[] = "F2B"; +const char FAN_DIR_B2F[] = "B2F"; enum psu_type { - PSU_TYPE_AC_ACBEL_FSF019, - PSU_TYPE_AC_ACBEL_FSH082, - PSU_TYPE_YESM1300 + PSU_TYPE_AC_ACBEL_FSF019_F2B, // FSF019-11G + PSU_TYPE_AC_ACBEL_FSH082_F2B, // FSH082-610G + PSU_TYPE_AC_ACBEL_FSH095_B2F, // FSH095-610G + PSU_TYPE_3Y_YESM1300AM // YESM1300AM-2A01P10(F2B) or YESM1300AM-2R01P10(B2F) }; struct model_name_info { @@ -33,6 +41,7 @@ struct model_name_info { u8 length; u8 chk_length; char* model_name; + const char* fan_dir; }; struct serial_number_info { @@ -42,22 +51,24 @@ struct serial_number_info { u8 chk_length; char* serial_number; }; - struct model_name_info models[] = { -{PSU_TYPE_AC_ACBEL_FSF019, 0x15, 10, 7, "FSF019-"}, -{PSU_TYPE_AC_ACBEL_FSH082, 0x20, 10, 7, "FSH082-"}, -{PSU_TYPE_YESM1300, 0x20, 11, 8, "YESM1300"}, + { PSU_TYPE_AC_ACBEL_FSF019_F2B, 0x15, 13, 6, "FSF019", FAN_DIR_F2B }, + { PSU_TYPE_AC_ACBEL_FSH082_F2B, 0x20, 13, 6, "FSH082", FAN_DIR_F2B }, + { PSU_TYPE_AC_ACBEL_FSH095_B2F, 0x20, 13, 6, "FSH095", FAN_DIR_B2F }, + { PSU_TYPE_3Y_YESM1300AM, 0x20, 19, 8, "YESM1300", NULL } }; struct serial_number_info serials[] = { -{PSU_TYPE_AC_ACBEL_FSF019, 0x2e, 16, 16, "FSF019-"}, -{PSU_TYPE_AC_ACBEL_FSH082, 0x35, 18, 18, "FSH082-"}, -{PSU_TYPE_YESM1300, 0x35, 20, 19, "YESM1300"}, + { PSU_TYPE_AC_ACBEL_FSF019_F2B, 0x2e, 16, 16, "FSF019" }, + { PSU_TYPE_AC_ACBEL_FSH082_F2B, 0x35, 18, 18, "FSH082" }, + { PSU_TYPE_AC_ACBEL_FSH095_B2F, 0x35, 18, 18, "FSH095" }, + { PSU_TYPE_3Y_YESM1300AM, 0x35, 19, 19, "YESM1300" } }; struct pddf_psu_data { char model_name[MAX_MODEL_NAME+1]; char serial_number[MAX_SERIAL_NUMBER+1]; + char fan_dir[MAX_FAN_DIR_LEN+1]; }; @@ -90,7 +101,6 @@ static int pddf_psu_read_block(struct i2c_client *client, u8 command, u8 *data, return result; } - static int two_complement_to_int(u16 data, u8 valid_bit, int mask) { u16 valid_data = data & mask; @@ -182,12 +192,12 @@ ssize_t pddf_get_custom_psu_serial_num(struct device *dev, struct device_attribu struct i2c_client *client = to_i2c_client(dev); struct pddf_psu_data data; int i, status; + char buffer[32]={0}; for (i = 0; i < ARRAY_SIZE(models); i++) { - memset(data.serial_number, 0, sizeof(data.serial_number)); status = pddf_psu_read_block(client, models[i].offset, - data.model_name, models[i].length); + buffer, models[i].length); if (status < 0) { data.model_name[0] = '\0'; dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x%x)\n", @@ -195,13 +205,13 @@ ssize_t pddf_get_custom_psu_serial_num(struct device *dev, struct device_attribu return status; } else { - data.model_name[models[i].length] = '\0'; + buffer[models[i].length >= (sizeof(buffer)-1)?(sizeof(buffer)-1):models[i].length] = '\0'; } /* Determine if the model name is known, if not, read next index */ - - if (strncmp(data.model_name, models[i].model_name, models[i].chk_length) == 0) { + data.serial_number[0] = '\0'; + if (strncmp(buffer, models[i].model_name, models[i].chk_length) == 0) { status = pddf_psu_read_block(client, serials[i].offset, data.serial_number, serials[i].length); @@ -212,7 +222,7 @@ ssize_t pddf_get_custom_psu_serial_num(struct device *dev, struct device_attribu return status; } else { - data.serial_number[serials[i].length] = '\0'; + data.serial_number[serials[i].length>=(sizeof(data.serial_number)-1)?(sizeof(data.serial_number)-1):serials[i].length] = '\0'; return sprintf(buf, "%s\n", data.serial_number); } @@ -234,9 +244,8 @@ ssize_t pddf_get_custom_psu_model_name(struct device *dev, struct device_attribu struct pddf_psu_data data; int i, status; + data.model_name[0]='\0'; for (i = 0; i < ARRAY_SIZE(models); i++) { - memset(data.model_name, 0, sizeof(data.model_name)); - status = pddf_psu_read_block(client, models[i].offset, data.model_name, models[i].length); if (status < 0) { @@ -246,47 +255,120 @@ ssize_t pddf_get_custom_psu_model_name(struct device *dev, struct device_attribu return status; } else { - data.model_name[models[i].length] = '\0'; + data.model_name[models[i].length >= (sizeof(data.model_name)-1)?(sizeof(data.model_name)-1):models[i].length] = '\0'; } /* Determine if the model name is known, if not, read next index */ if (strncmp(data.model_name, models[i].model_name, models[i].chk_length) == 0) { - if (models[i].type==PSU_TYPE_YESM1300) - { - if (data.model_name[9]=='A' && data.model_name[10]=='M') - { - data.model_name[8]='A'; - data.model_name[9]='M'; - data.model_name[strlen("YESM1300AM")]='\0'; - } - else - data.model_name[strlen("YESM1300")]='\0'; + if (models[i].type==PSU_TYPE_3Y_YESM1300AM) + { + char buf[10] = {0}; + memcpy(buf, &data.model_name[9], 10); + memcpy(&data.model_name[8], buf, 10); + data.model_name[MAX_MODEL_NAME] = '\0'; } - + else if ((models[i].type == PSU_TYPE_AC_ACBEL_FSH082_F2B) || + (models[i].type == PSU_TYPE_AC_ACBEL_FSH095_B2F) || + (models[i].type == PSU_TYPE_AC_ACBEL_FSF019_F2B)) { + // Adjust model name for FSH082 / FSH095 / FSF019 + char buf[4] = {0}; + memcpy(buf, &data.model_name[9], 4); + memcpy(&data.model_name[7], buf, 4); + data.model_name[6] = '-'; + data.model_name[11] = '\0'; + } + else + data.model_name[0]='\0'; + return sprintf(buf, "%s\n", data.model_name); } else { data.model_name[0] = '\0'; } + + } return -ENODATA; } +ssize_t pddf_get_custom_psu_fan_dir(struct device *dev, struct device_attribute *da, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct pddf_psu_data data; + int i, status; + char buffer[32]={0}; + + data.fan_dir[0]='\0'; + for (i = 0; i < ARRAY_SIZE(models); i++) { + buffer[0]='\0'; + status = pddf_psu_read_block(client, models[i].offset, + buffer, models[i].length); + if (status < 0) { + buffer[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x%x)\n", + client->addr, models[i].offset); + return status; + } + else { + buffer[models[i].length >= (sizeof(buffer)-1)?(sizeof(buffer)-1):models[i].length]='\0'; + } + + /* Determine if the model name is known, if not, read next index + */ + if (strncmp(buffer, models[i].model_name, models[i].chk_length) == 0) { + if (models[i].type==PSU_TYPE_3Y_YESM1300AM) + { + /*YESM1300AM-2A01P10(F2B) or YESM1300AM-2R01P10(B2F)*/ + if(strstr(buffer, "2A01P10")) + { + strncpy(data.fan_dir, "F2B", MAX_FAN_DIR_LEN); + } + else if(strstr(buffer, "2R01P10")) + { + strncpy(data.fan_dir, "B2F", MAX_FAN_DIR_LEN); + } + + } + else if ((models[i].type == PSU_TYPE_AC_ACBEL_FSH082_F2B) || + (models[i].type == PSU_TYPE_AC_ACBEL_FSF019_F2B)) + { + strncpy(data.fan_dir, "F2B", MAX_FAN_DIR_LEN); + } + else if ((models[i].type == PSU_TYPE_AC_ACBEL_FSH095_B2F)) + { + strncpy(data.fan_dir, "B2F", MAX_FAN_DIR_LEN); + } + + data.fan_dir[MAX_FAN_DIR_LEN] = '\0'; + + return sprintf(buf, "%s\n", data.fan_dir); + } + else { + data.fan_dir[0] = '\0'; + } + } + + return -ENODATA; + +} static int __init pddf_custom_psu_init(void) { - access_psu_v_out.show = pddf_show_custom_psu_v_out; - access_psu_v_out.do_get = NULL; + access_psu_v_out.show = pddf_show_custom_psu_v_out; + access_psu_v_out.do_get = NULL; - access_psu_serial_num.show = pddf_get_custom_psu_serial_num; - access_psu_serial_num.do_get = NULL; + access_psu_serial_num.show = pddf_get_custom_psu_serial_num; + access_psu_serial_num.do_get = NULL; + + access_psu_model_name.show = pddf_get_custom_psu_model_name; + access_psu_model_name.do_get = NULL; - access_psu_model_name.show = pddf_get_custom_psu_model_name; - access_psu_model_name.do_get = NULL; + access_psu_fan_dir.show = pddf_get_custom_psu_fan_dir; + access_psu_fan_dir.do_get = NULL; return 0; } diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/service/as9716-32d-pddf-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/service/as9716-32d-pddf-platform-monitor.service index 24e7fee811..5754e252c7 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/service/as9716-32d-pddf-platform-monitor.service +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/service/as9716-32d-pddf-platform-monitor.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS9716-32D Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=pddf-platform-init.service DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/service/as9716-32d-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/service/as9716-32d-platform-monitor.service index 1d77c39120..fd12cc007c 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/service/as9716-32d-platform-monitor.service +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/service/as9716-32d-platform-monitor.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS9716-32D Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=sysinit.target DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/setup.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/setup.py index 7c70492e5d..f316de0228 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/setup.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/setup.py @@ -11,6 +11,6 @@ description='Module to initialize Accton AS9716-32D platforms', packages=['as9716_32d'], - package_dir={'as9716_32d': 'as9716-32d/classes'}, + package_dir={'as9716_32d': 'classes'}, ) diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/chassis.py index 8ff20a7605..323c9c1d51 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/chassis.py @@ -8,58 +8,58 @@ try: import sys - import time from sonic_platform_pddf_base.pddf_chassis import PddfChassis + from .event import SfpEvent + from .helper import APIHelper except ImportError as e: raise ImportError(str(e) + "- required module not found") +NUM_COMPONENT = 6 +HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/" +PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" +REBOOT_CAUSE_FILE = "reboot-cause.txt" class Chassis(PddfChassis): """ PDDF Platform-specific Chassis class """ + SYSLED_DEV_NAME = "DIAG_LED" + def __init__(self, pddf_data=None, pddf_plugin_data=None): PddfChassis.__init__(self, pddf_data, pddf_plugin_data) + self.__initialize_components() + self._api_helper = APIHelper() + self._sfpevent = SfpEvent(self.get_all_sfps()) + + def __initialize_components(self): + from sonic_platform.component import Component + for index in range(NUM_COMPONENT): + component = Component(index) + self._component_list.append(component) # Provide the functions/variables below for which implementation is to be overwritten - sfp_change_event_data = {'valid': 0, 'last': 0, 'present': 0} - def get_change_event(self, timeout=2000): - now = time.time() - port_dict = {} - change_dict = {} - change_dict['sfp'] = port_dict - - if timeout < 1000: - timeout = 1000 - timeout = timeout / float(1000) # Convert to secs - - if now < (self.sfp_change_event_data['last'] + timeout) and self.sfp_change_event_data['valid']: - return True, change_dict - - bitmap = 0 - for i in range(34): - modpres = self.get_sfp(i+1).get_presence() - if modpres: - bitmap = bitmap | (1 << i) - - changed_ports = self.sfp_change_event_data['present'] ^ bitmap - if changed_ports: - for i in range(34): - if (changed_ports & (1 << i)): - if (bitmap & (1 << i)) == 0: - port_dict[i+1] = '0' - else: - port_dict[i+1] = '1' - - - # Update teh cache dict - self.sfp_change_event_data['present'] = bitmap - self.sfp_change_event_data['last'] = now - self.sfp_change_event_data['valid'] = 1 - return True, change_dict - else: - return True, change_dict + def get_change_event(self, timeout=0): + return self._sfpevent.get_sfp_event(timeout) + + 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. + """ + + reboot_cause_path = (HOST_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE) + sw_reboot_cause = self._api_helper.read_txt_file( + reboot_cause_path) or "Unknown" + + + return ('REBOOT_CAUSE_NON_HARDWARE', sw_reboot_cause) def get_sfp(self, index): @@ -84,3 +84,48 @@ def get_sfp(self, index): sys.stderr.write("SFP index {} out of range (1-{})\n".format( index, len(self._sfp_list))) return sfp + + def initizalize_system_led(self): + return + + def get_status_led(self): + return self.get_system_led(self.SYSLED_DEV_NAME) + + def set_status_led(self, color): + return self.set_system_led(self.SYSLED_DEV_NAME, color) + + def get_port_or_cage_type(self, port): + from sonic_platform_base.sfp_base import SfpBase + if port in range(1, 33): + return SfpBase.SFP_PORT_TYPE_BIT_QSFP | SfpBase.SFP_PORT_TYPE_BIT_QSFP_PLUS | SfpBase.SFP_PORT_TYPE_BIT_QSFP28 | SfpBase.SFP_PORT_TYPE_BIT_QSFP56 | SfpBase.SFP_PORT_TYPE_BIT_QSFPDD + else: + return SfpBase.SFP_PORT_TYPE_BIT_SFP + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + + def get_revision(self): + """ + Retrieves the hardware revision of the device + + Returns: + string: Revision value of device + """ + return self._eeprom.revision_str() diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/component.py new file mode 100644 index 0000000000..8ac81aa832 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/component.py @@ -0,0 +1,186 @@ +############################################################################# +# +# Component contains an implementation of SONiC Platform Base API and +# provides the components firmware management function +# +############################################################################# + +try: + import os + import json + from sonic_platform_base.component_base import ComponentBase + from sonic_py_common.general import getstatusoutput_noshell +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CPLD_ADDR_MAPPING = { + "FPGA": ['19', '0x60'], + "MB_CPLD1": ['20', '0x61'], + "MB_CPLD2": ['21', '0x62'], + "FAN_CPLD": ['17', '0x66'], + "CPU_CPLD": ['0', '0x65'] +} +SYSFS_PATH = "/sys/bus/i2c/devices/" +BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version" +COMPONENT_LIST= [ + ("FPGA", "FPGA(0x60)"), + ("MB_CPLD1", "Mainboard CPLD(0x62)"), + ("MB_CPLD2", "Mainboard CPLD(0x64)"), + ("FAN_CPLD", "Fan board CPLD(0x66)"), + ("CPU_CPLD", "CPU CPLD(0x65)"), + ("BIOS", "Basic Input/Output System") + +] + +class Component(ComponentBase): + """Platform-specific Component class""" + + DEVICE_TYPE = "component" + + def __init__(self, component_index=0): + self.index = component_index + self.name = self.get_name() + + def __get_bios_version(self): + # Retrieves the BIOS firmware version + try: + with open(BIOS_VERSION_PATH, 'r') as fd: + bios_version = fd.read() + return bios_version.strip() + except Exception as e: + return None + + def __get_cpld_version(self): + # Retrieves the CPLD firmware version + cpld_version = dict() + for cpld_name in CPLD_ADDR_MAPPING: + cmd = ["i2cget", "-f", "-y", CPLD_ADDR_MAPPING[cpld_name][0], CPLD_ADDR_MAPPING[cpld_name][1], "0x1"] + status, value = getstatusoutput_noshell(cmd) + if not status: + cpld_version_raw = value.rstrip() + cpld_version[cpld_name] = "{}".format(int(cpld_version_raw,16)) + + return cpld_version + + def get_name(self): + """ + Retrieves the name of the component + Returns: + A string containing the name of the component + """ + return COMPONENT_LIST[self.index][0] + + def get_description(self): + """ + Retrieves the description of the component + Returns: + A string containing the description of the component + """ + return COMPONENT_LIST[self.index][1] + + def get_firmware_version(self): + """ + Retrieves the firmware version of module + Returns: + string: The firmware versions of the module + """ + fw_version = None + + if self.name == "BIOS": + fw_version = self.__get_bios_version() + elif "CPLD" or "FPGA" in self.name: + cpld_version = self.__get_cpld_version() + fw_version = cpld_version.get(self.name) + + return fw_version + + def install_firmware(self, image_path): + """ + Install firmware to module + Args: + image_path: A string, path to firmware image + Returns: + A boolean, True if install successfully, False if not + """ + ret, output = getstatusoutput_noshell(["tar", "-C", "/tmp", "-xzf", image_path ]) + if ret != 0 : + print("Installation failed because of wrong image package") + return False + + if False == os.path.exists("/tmp/install.json") : + print("Installation failed without jsonfile") + return False + + input_file = open ('/tmp/install.json') + json_array = json.load(input_file) + ret = 1 + for item in json_array: + if item.get('id')==None or item.get('path')==None: + continue + if self.name == item['id'] and item['path'] and item.get('cpu'): + print( "Find", item['id'], item['path'], item['cpu'] ) + ret, output = getstatusoutput_noshell(["/tmp/run_install.sh", item['id'], item['path'], item['cpu'] ]) + if ret==0: + break + elif self.name == item['id'] and item['path']: + print( "Find", item['id'], item['path'] ) + ret, output = getstatusoutput_noshell(["/tmp/run_install.sh", item['id'], item['path'] ]) + if ret==0: + break + + if ret==0: + return True + else : + return False + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return 'N/A' + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return 'N/A' + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return True + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/event.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/event.py new file mode 100644 index 0000000000..1a2f60dbb6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/event.py @@ -0,0 +1,109 @@ +try: + import time + from sonic_py_common.logger import Logger + from .sfp import Sfp +except ImportError as e: + raise ImportError(repr(e) + " - required module not found") + +POLL_INTERVAL_IN_SEC = 1 + +# SFP errors that will block eeprom accessing +SFP_BLOCKING_ERRORS = [ + Sfp.SFP_ERROR_BIT_I2C_STUCK, + Sfp.SFP_ERROR_BIT_BAD_EEPROM, + Sfp.SFP_ERROR_BIT_UNSUPPORTED_CABLE, + Sfp.SFP_ERROR_BIT_HIGH_TEMP, + Sfp.SFP_ERROR_BIT_BAD_CABLE +] + +class SfpEvent: + ''' Listen to insert/remove sfp events ''' + + def __init__(self, sfp_list): + self._sfp_list = sfp_list + self._logger = Logger() + self._sfp_change_event_data = {'present': 0} + + def get_presence_bitmap(self): + bitmap = 0 + for sfp in self._sfp_list: + modpres = sfp.get_presence() + i=sfp.get_position_in_parent() - 1 + if modpres: + bitmap = bitmap | (1 << i) + return bitmap + + def get_sfp_event(self, timeout=2000): + port_dict = {} + change_dict = {} + change_dict['sfp'] = port_dict + + if timeout < 1000: + cd_ms = 1000 + else: + cd_ms = timeout + + while cd_ms > 0: + bitmap = self.get_presence_bitmap() + changed_ports = self._sfp_change_event_data['present'] ^ bitmap + if changed_ports != 0: + break + time.sleep(POLL_INTERVAL_IN_SEC) + # timeout=0 means wait for event forever + if timeout != 0: + cd_ms = cd_ms - POLL_INTERVAL_IN_SEC * 1000 + + if changed_ports != 0: + for sfp in self._sfp_list: + i=sfp.get_position_in_parent() - 1 + if (changed_ports & (1 << i)) == 0: + continue + + if (bitmap & (1 << i)) == 0: + port_dict[i+1] = '0' + else: + # sfp.refresh_optoe_dev_class() + sfp_state_bits = self.get_sfp_state_bits(sfp, True) + sfp_state_bits = self.check_sfp_blocking_errors(sfp_state_bits) + + port_dict[i+1] = str(sfp_state_bits) + + # Update the cache dict + self._sfp_change_event_data['present'] = bitmap + return True, change_dict + else: + return True, change_dict + + def get_sfp_state_bits(self, sfp, present): + sfp_state_bits = 0 + + if present is True: + sfp_state_bits |= Sfp.SFP_STATUS_BIT_INSERTED + else: + return sfp_state_bits + + status = sfp.validate_eeprom() + if status is None: + sfp_state_bits |= Sfp.SFP_ERROR_BIT_I2C_STUCK + return sfp_state_bits + elif status is not True: + sfp_state_bits |= Sfp.SFP_ERROR_BIT_BAD_EEPROM + return sfp_state_bits + + status = sfp.validate_temperature() + if status is None: + sfp_state_bits |= Sfp.SFP_ERROR_BIT_I2C_STUCK + return sfp_state_bits + elif status is not True: + sfp_state_bits |= Sfp.SFP_ERROR_BIT_HIGH_TEMP + return sfp_state_bits + + return sfp_state_bits + + def check_sfp_blocking_errors(self, sfp_state_bits): + for i in SFP_BLOCKING_ERRORS: + if (i & sfp_state_bits) == 0: + continue + sfp_state_bits |= Sfp.SFP_ERROR_BIT_BLOCKING + + return sfp_state_bits diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/fan.py index 360ecd3122..429e53c23c 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/fan.py @@ -6,6 +6,9 @@ except ImportError as e: raise ImportError(str(e) + "- required module not found") +FAN_NAME_LIST = ["FAN-1F", "FAN-1R", "FAN-2F", "FAN-2R", + "FAN-3F", "FAN-3R", "FAN-4F", "FAN-4R", + "FAN-5F", "FAN-5R", "FAN-6F", "FAN-6R"] class Fan(PddfFan): """PDDF Platform-Specific Fan class""" @@ -14,35 +17,43 @@ def __init__(self, tray_idx, fan_idx=0, pddf_data=None, pddf_plugin_data=None, i # idx is 0-based PddfFan.__init__(self, tray_idx, fan_idx, pddf_data, pddf_plugin_data, is_psu_fan, psu_index) - # Provide the functions/variables below for which implementation is to be overwritten - # Since psu_fan airflow direction cant be read from sysfs, it is fixed as 'F2B' or 'intake' - def get_direction(self): + def get_name(self): """ - Retrieves the direction of fan - - Returns: - A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST - depending on fan direction + Retrieves the name of the device + Returns: + string: The name of the device """ - if self.is_psu_fan: - direction = self.FAN_DIRECTION_EXHAUST + fan_name = FAN_NAME_LIST[(self.fantray_index-1)*2 + self.fan_index-1] \ + if not self.is_psu_fan \ + else "PSU-{} FAN-{}".format(self.fans_psu_index, self.fan_index) - else: - idx = (self.fantray_index-1)*self.platform['num_fans_pertray'] + self.fan_index - attr = "fan" + str(idx) + "_direction" - output = self.pddf_obj.get_attr_name_output("FAN-CTRL", attr) - if not output: - return False + return fan_name - mode = output['mode'] - val = output['status'] + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return "N/A" - val = val.rstrip() - vmap = self.plugin_data['FAN']['direction'][mode]['valmap'] - if val in vmap: - direction = vmap[val] - else: - direction = val + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return "N/A" - return direction + 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) + """ + if self.is_psu_fan: + return super().get_speed() + else: + return super().get_target_speed() diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/fan_drawer.py index 3b9bb607f6..e4e37f9620 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/fan_drawer.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/fan_drawer.py @@ -15,3 +15,27 @@ def __init__(self, tray_idx, pddf_data=None, pddf_plugin_data=None): PddfFanDrawer.__init__(self, tray_idx, pddf_data, pddf_plugin_data) # Provide the functions/variables below for which implementation is to be overwritten + def get_name(self): + """ + Retrieves the fan drawer name + Returns: + string: The name of the device + """ + return "FanTray{}".format(self.fantray_index) + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self._fan_list[0].get_model() + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return self._fan_list[0].get_serial() + diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/helper.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/helper.py new file mode 100644 index 0000000000..c19566e420 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/helper.py @@ -0,0 +1,361 @@ +import os +import struct +import json +import fcntl +from mmap import * +from sonic_py_common import device_info +from sonic_py_common import logger +from threading import Lock +from typing import cast +from sonic_py_common.general import getstatusoutput_noshell_pipe +from sonic_py_common.general import getstatusoutput_noshell + +HOST_CHK_CMD = ["docker"] +EMPTY_STRING = "" + + +class APIHelper(): + + def __init__(self): + (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() + + def is_host(self): + try: + status, output = getstatusoutput_noshell(HOST_CHK_CMD) + return status == 0 + except Exception: + return False + + def pci_get_value(self, resource, offset): + status = True + result = "" + try: + fd = os.open(resource, os.O_RDWR) + mm = mmap(fd, 0) + mm.seek(int(offset)) + read_data_stream = mm.read(4) + result = struct.unpack('I', read_data_stream) + except Exception: + status = False + return status, result + + def read_txt_file(self, file_path): + try: + with open(file_path, 'r', errors='replace') as fd: + data = fd.read() + ret = data.strip() + if len(ret) > 0: + return ret + except IOError: + pass + return None + + 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 ipmi_raw(self, netfn, cmd): + status = True + result = "" + try: + err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'raw', str(netfn), str(cmd)]) + if err == [0]: + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result + + def ipmi_fru_id(self, id, key=None): + status = True + result = "" + try: + if (key is None): + err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'fru', 'print', str(id)]) + else: + err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'fru', 'print', str(id)], ['grep', str(key)]) + if err == [0] or err == [0, 0]: + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result + + def ipmi_set_ss_thres(self, id, threshold_key, value): + status = True + result = "" + try: + err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'sensor', 'thresh', str(id), str(threshold_key), str(value)]) + if err == [0]: + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result + + +class FileLock: + """ + Due to pmon docker not installing the py-filelock, this class + implements a simple file lock feature. + Ref: https://github.com/tox-dev/py-filelock/blob/main/src/filelock/ + """ + + def __init__(self, lock_file): + self._lock_file = lock_file + self._thread_lock = Lock() + self.is_locked = False + + def acquire(self): + with self._thread_lock: + if self.is_locked: + return + + fd = os.open(self._lock_file, flags=(os.O_RDWR | os.O_CREAT | os.O_TRUNC)) + fcntl.flock(fd, fcntl.LOCK_EX) + self._lock_file_fd = fd + self.is_locked = True + + def release(self): + with self._thread_lock: + if self.is_locked: + fd = cast(int, self._lock_file_fd) + self._lock_file_fd = None + fcntl.flock(fd, fcntl.LOCK_UN) + os.close(fd) + self.is_locked = False + + def __enter__(self): + self.acquire() + return self + + def __exit__(self, exc_type, exc_val, traceback): + self.release() + + def __del__(self): + self.release() + + +DEVICE_THRESHOLD_JSON_PATH = "/tmp/device_threshold.json" + +class DeviceThreshold: + HIGH_THRESHOLD = 'high_threshold' + LOW_THRESHOLD = 'low_threshold' + HIGH_CRIT_THRESHOLD = 'high_critical_threshold' + LOW_CRIT_THRESHOLD = 'low_critical_threshold' + NOT_AVAILABLE = 'N/A' + + def __init__(self, th_name = NOT_AVAILABLE): + self.flock = FileLock("{}.lock".format(DEVICE_THRESHOLD_JSON_PATH)) + self.name = th_name + self.__log = logger.Logger(log_identifier="DeviceThreshold") + + self.__db_data = {} + self.__db_mtime = 0 + + def __reload_db(self): + try: + db_data = {} + with self.flock: + with open(DEVICE_THRESHOLD_JSON_PATH, "r") as db_file: + db_data = json.load(db_file) + except Exception as e: + self.__log.log_warning('{}'.format(str(e))) + return None + + return db_data + + def __get_data(self, field): + """ + Retrieves data frome JSON file by field + + Args : + field: String + + Returns: + A string if getting is successfully, 'N/A' if not + """ + if os.path.exists(DEVICE_THRESHOLD_JSON_PATH): + new_mtime = os.path.getmtime(DEVICE_THRESHOLD_JSON_PATH) + if new_mtime != self.__db_mtime: + new_data = self.__reload_db() + if new_data is not None: + self.__db_data = new_data + self.__db_mtime = new_mtime + + if self.name not in self.__db_data.keys(): + return self.NOT_AVAILABLE + + if field not in self.__db_data[self.name].keys(): + return self.NOT_AVAILABLE + + return self.__db_data[self.name][field] + + def __set_data(self, field, new_val): + """ + Set data to JSON file by field + + Args : + field: String + new_val: String + + Returns: + A boolean, True if setting is set successfully, False if not + """ + if self.name not in self.__db_data.keys(): + self.__db_data[self.name] = {} + + old_val = self.__db_data[self.name].get(field, None) + if old_val is not None and old_val == new_val: + return True + + self.__db_data[self.name][field] = new_val + + try: + with self.flock: + db_data = {} + mode = "r+" if os.path.exists(DEVICE_THRESHOLD_JSON_PATH) else "w+" + with open(DEVICE_THRESHOLD_JSON_PATH, mode) as db_file: + if mode == "r+": + db_data = json.load(db_file) + + if self.name not in db_data.keys(): + db_data[self.name] = {} + + db_data[self.name][field] = new_val + + if mode == "r+": + db_file.seek(0) + # erase old data + db_file.truncate(0) + # write all data + json.dump(db_data, db_file, indent=4) + self.__db_mtime = os.path.getmtime(DEVICE_THRESHOLD_JSON_PATH) + except Exception as e: + self.__log.log_error('{}'.format(str(e))) + return False + + return True + + def get_high_threshold(self): + """ + Retrieves the high threshold temperature from JSON file. + + Returns: + string : the high threshold temperature of thermal, + e.g. "30.125" + """ + return self.__get_data(self.HIGH_THRESHOLD) + + def set_high_threshold(self, temperature): + """ + Sets the high threshold temperature of thermal + Args : + temperature: A string of temperature, e.g. "30.125" + Returns: + A boolean, True if threshold is set successfully, False if not + """ + if isinstance(temperature, str) is not True: + raise TypeError('The parameter requires string type.') + + try: + if temperature != self.NOT_AVAILABLE: + float(temperature) + except ValueError: + raise ValueError('The parameter requires a float string. ex:\"30.1\"') + + return self.__set_data(self.HIGH_THRESHOLD, temperature) + + def get_low_threshold(self): + """ + Retrieves the low threshold temperature from JSON file. + + Returns: + string : the low threshold temperature of thermal, + e.g. "30.125" + """ + return self.__get_data(self.LOW_THRESHOLD) + + def set_low_threshold(self, temperature): + """ + Sets the low threshold temperature of thermal + Args : + temperature: A string of temperature, e.g. "30.125" + Returns: + A boolean, True if threshold is set successfully, False if not + """ + if isinstance(temperature, str) is not True: + raise TypeError('The parameter requires string type.') + + try: + if temperature != self.NOT_AVAILABLE: + float(temperature) + except ValueError: + raise ValueError('The parameter requires a float string. ex:\"30.1\"') + + return self.__set_data(self.LOW_THRESHOLD, temperature) + + def get_high_critical_threshold(self): + """ + Retrieves the high critical threshold temperature from JSON file. + + Returns: + string : the high critical threshold temperature of thermal, + e.g. "30.125" + """ + return self.__get_data(self.HIGH_CRIT_THRESHOLD) + + def set_high_critical_threshold(self, temperature): + """ + Sets the high critical threshold temperature of thermal + Args : + temperature: A string of temperature, e.g. "30.125" + Returns: + A boolean, True if threshold is set successfully, False if not + """ + if isinstance(temperature, str) is not True: + raise TypeError('The parameter requires string type.') + + try: + if temperature != self.NOT_AVAILABLE: + float(temperature) + except ValueError: + raise ValueError('The parameter requires a float string. ex:\"30.1\"') + + return self.__set_data(self.HIGH_CRIT_THRESHOLD, temperature) + + def get_low_critical_threshold(self): + """ + Retrieves the low critical threshold temperature from JSON file. + + Returns: + string : the low critical threshold temperature of thermal, + e.g. "30.125" + """ + return self.__get_data(self.LOW_CRIT_THRESHOLD) + + def set_low_critical_threshold(self, temperature): + """ + Sets the low critical threshold temperature of thermal + Args : + temperature: A string of temperature, e.g. "30.125" + Returns: + A boolean, True if threshold is set successfully, False if not + """ + if isinstance(temperature, str) is not True: + raise TypeError('The parameter requires string type.') + + try: + if temperature != self.NOT_AVAILABLE: + float(temperature) + except ValueError: + raise ValueError('The parameter requires a float string. ex:\"30.1\"') + + return self.__set_data(self.LOW_CRIT_THRESHOLD, temperature) diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/pcie.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/pcie.py new file mode 100644 index 0000000000..e4da32adf9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/pcie.py @@ -0,0 +1,19 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the fan status which are available in the platform +# Base PCIe class +############################################################################# + +try: + from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Pcie(PcieUtil): + """Edgecore Platform-specific PCIe class""" + + def __init__(self, platform_path): + PcieUtil.__init__(self, platform_path) diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/psu.py index 72a6d8f082..0f4b5cb459 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/psu.py @@ -10,27 +10,121 @@ class Psu(PddfPsu): """PDDF Platform-Specific PSU class""" - - PLATFORM_PSU_CAPACITY = 1200 def __init__(self, index, pddf_data=None, pddf_plugin_data=None): PddfPsu.__init__(self, index, pddf_data, pddf_plugin_data) # Provide the functions/variables below for which implementation is to be overwritten - def get_maximum_supplied_power(self): + def get_name(self): + return "PSU-{}".format(self.psu_index) + + def get_voltage_high_threshold(self): + """ + Retrieves the high threshold PSU voltage output + Returns: + A float number, the high threshold output voltage in volts, + e.g. 12.1 """ - Retrieves the maximum supplied power by PSU (or PSU capacity) + return 14.72 + + def get_voltage_low_threshold(self): + """ + Retrieves the low threshold PSU voltage output Returns: - A float number, the maximum power output in Watts. - e.g. 1200.1 + A float number, the low threshold output voltage in volts, + e.g. 12.1 """ - return float(self.PLATFORM_PSU_CAPACITY) + return 7.68 - def get_type(self): + def get_revision(self): """ - Gets the type of the PSU + Retrieves the hardware revision of the device + + Returns: + string: Revision value of device + """ + return 'N/A' + + def get_temperature_high_threshold(self): + """ + Retrieves the high threshold temperature of PSU + Returns: + A float number, the high threshold temperature of PSU in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + threshold = super().get_temperature_high_threshold() + + for psu_thermal_idx in range(self.num_psu_thermals): + try: + tmp = self._thermal_list[psu_thermal_idx].get_high_threshold() + if threshold > tmp or threshold == 0.0: + threshold = tmp + except Exception: + pass + + return threshold + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + + Returns: + string: Model/part number of device + """ + model = super().get_model() + if model and model.strip() == "": + return None + + return model + + def get_serial(self): + """ + Retrieves the serial number of the device + + Returns: + string: Serial number of device + """ + serial = super().get_serial() + if serial and serial.strip() == "": + return None + + return serial + + def get_voltage(self): + """ + Retrieves current PSU voltage output + + Returns: + A float number, the output voltage in volts, + e.g. 12.1 + """ + if self.get_status() is not True: + return 0.0 + + return super().get_voltage() + + def get_current(self): + """ + Retrieves present electric current supplied by PSU + + Returns: + A float number, electric current in amperes, + e.g. 15.4 + """ + if self.get_status() is not True: + return 0.0 + + return super().get_current() + + def get_power(self): + """ + Retrieves current energy supplied by PSU + Returns: - A string, the type of PSU (AC/DC) + A float number, the power in watts, + e.g. 302.6 """ - return "DC" + if self.get_status() is not True: + return 0.0 + return super().get_power() diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/sfp.py index d9b6e491be..018a9aea7b 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/sfp.py @@ -1,7 +1,10 @@ #!/usr/bin/env python try: + import natsort from sonic_platform_pddf_base.pddf_sfp import PddfSfp + from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper + from sonic_py_common import device_info except ImportError as e: raise ImportError (str(e) + "- required module not found") @@ -11,7 +14,245 @@ class Sfp(PddfSfp): PDDF Platform-Specific Sfp class """ + SFP_TYPE_CODE_LIST = [ + 0x03, # SFP/SFP+/SFP28 + 0x0b # DWDM-SFP/SFP+ + ] + QSFP_TYPE_CODE_LIST = [ + 0x0c, # QSFP + 0x0d, # QSFP+ or later + 0x11, # QSFP28 or later + 0xe1 # QSFP28 EDFA + ] + QSFP_DD_TYPE_CODE_LIST = [ + 0x18, # QSFP-DD Double Density 8X Pluggable Transceiver + 0x1E # QSFP+ or later with CMIS + ] + def __init__(self, index, pddf_data=None, pddf_plugin_data=None): PddfSfp.__init__(self, index, pddf_data, pddf_plugin_data) + self.index = self.port_index # Provide the functions/variables below for which implementation is to be overwritten + def get_position_in_parent(self): + """Retrieves 1-based relative physical position in parent device.""" + return self.port_index + + def __get_path_to_port_config_file(self): + platform, hwsku = device_info.get_platform_and_hwsku() + hwsku_path = "/".join(["/usr/share/sonic/platform",hwsku]) + return "/".join([hwsku_path, "port_config.ini"]) + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + sfputil_helper = SfpUtilHelper() + sfputil_helper.read_porttab_mappings( + self.__get_path_to_port_config_file()) + + logical_port_list = sfputil_helper.logical + logical_port_list = natsort.natsorted(logical_port_list) + name = logical_port_list[self.port_index-1] or "Unknown" + + return name + + def __validate_eeprom_sfp(self): + checksum_test = 0 + eeprom_raw = self.read_eeprom(0, 96) + if eeprom_raw is None: + return None + + for i in range(0, 63): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[63]: + return False + + checksum_test = 0 + for i in range(64, 95): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[95]: + return False + + api = self.get_xcvr_api() + if api is None: + return False + + if api.is_flat_memory(): + return True + + checksum_test = 0 + eeprom_raw = self.read_eeprom(384, 96) + if eeprom_raw is None: + return None + + for i in range(0, 95): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[95]: + return False + + return True + + def __validate_eeprom_qsfp(self): + checksum_test = 0 + eeprom_raw = self.read_eeprom(128, 96) + if eeprom_raw is None: + return None + + for i in range(0, 63): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[63]: + return False + + checksum_test = 0 + for i in range(64, 95): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[95]: + return False + + api = self.get_xcvr_api() + if api is None: + return False + + if api.is_flat_memory(): + return True + + return True + + def __validate_eeprom_cmis(self): + checksum_test = 0 + eeprom_raw = self.read_eeprom(128, 95) + if eeprom_raw is None: + return None + + for i in range(0, 94): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[94]: + return False + + api = self.get_xcvr_api() + if api is None: + return False + + if api.is_flat_memory(): + return True + + checksum_test = 0 + eeprom_raw = self.read_eeprom(258, 126) + if eeprom_raw is None: + return None + + for i in range(0, 125): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[125]: + return False + + checksum_test = 0 + eeprom_raw = self.read_eeprom(384, 128) + if eeprom_raw is None: + return None + + for i in range(0, 127): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[127]: + return False + + checksum_test = 0 + eeprom_raw = self.read_eeprom(640, 128) + if eeprom_raw is None: + return None + + for i in range(0, 127): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[127]: + return False + + return True + + def validate_eeprom(self): + id_byte_raw = self.read_eeprom(0, 1) + if id_byte_raw is None: + return None + + id = id_byte_raw[0] + if id in self.QSFP_TYPE_CODE_LIST: + return self.__validate_eeprom_qsfp() + elif id in self.SFP_TYPE_CODE_LIST: + return self.__validate_eeprom_sfp() + elif id in self.QSFP_DD_TYPE_CODE_LIST: + return self.__validate_eeprom_cmis() + else: + return False + + def validate_temperature(self): + temperature = self.get_temperature() + if temperature is None: + return None + + threshold_dict = self.get_transceiver_threshold_info() + if threshold_dict is None: + return None + + if isinstance(temperature, float) is not True: + return True + + if isinstance(threshold_dict['temphighalarm'], float) is not True: + return True + + return threshold_dict['temphighalarm'] > temperature + + def __get_error_description(self): + if not self.get_presence(): + return self.SFP_STATUS_UNPLUGGED + + err_stat = self.SFP_STATUS_BIT_INSERTED + + status = self.validate_eeprom() + if status is not True: + err_stat = (err_stat | self.SFP_ERROR_BIT_BAD_EEPROM) + + status = self.validate_temperature() + if status is not True: + err_stat = (err_stat | self.SFP_ERROR_BIT_HIGH_TEMP) + + if err_stat is self.SFP_STATUS_BIT_INSERTED: + return self.SFP_STATUS_OK + else: + err_desc = '' + cnt = 0 + for key in self.SFP_ERROR_BIT_TO_DESCRIPTION_DICT: + if (err_stat & key) != 0: + if cnt > 0: + err_desc = err_desc + "|" + cnt = cnt + 1 + err_desc = err_desc + self.SFP_ERROR_BIT_TO_DESCRIPTION_DICT[key] + + return err_desc + + def get_error_description(self): + """ + Retrives the error descriptions of the SFP module + + Returns: + String that represents the current error descriptions of vendor specific errors + In case there are multiple errors, they should be joined by '|', + like: "Bad EEPROM|Unsupported cable" + """ + try: + ret = super().get_error_description() + if ret is not None: + return ret + except NotImplementedError: + pass + return self.__get_error_description() diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/thermal.py index 77d6ec7ae8..3761173bbe 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/sonic_platform/thermal.py @@ -3,15 +3,306 @@ try: from sonic_platform_pddf_base.pddf_thermal import PddfThermal + from .helper import DeviceThreshold except ImportError as e: raise ImportError(str(e) + "- required module not found") +NOT_AVAILABLE = DeviceThreshold.NOT_AVAILABLE +HIGH_THRESHOLD = DeviceThreshold.HIGH_THRESHOLD +LOW_THRESHOLD = DeviceThreshold.LOW_THRESHOLD +HIGH_CRIT_THRESHOLD = DeviceThreshold.HIGH_CRIT_THRESHOLD +LOW_CRIT_THRESHOLD = DeviceThreshold.LOW_CRIT_THRESHOLD +DEFAULT_THRESHOLD = { + 'MB_FrontMiddle_temp(0x48)' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'MB_RightCenter_temp(0x49)' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'MB_LeftCenter_temp(0x4a)' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'CB_temp(0x4b)' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'OCXO_temp(0x4c)' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'FB_1_temp(0x4e)' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'FB_2_temp(0x4f)' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'CPU_Package_temp' : { + HIGH_THRESHOLD : '82.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : '104.0', + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'CPU_Core_0_temp' : { + HIGH_THRESHOLD : '82.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : '104.0', + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'CPU_Core_1_temp' : { + HIGH_THRESHOLD : '82.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : '104.0', + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'CPU_Core_2_temp' : { + HIGH_THRESHOLD : '82.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : '104.0', + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'CPU_Core_3_temp' : { + HIGH_THRESHOLD : '82.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : '104.0', + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'PSU-1 temp sensor 1' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + }, + 'PSU-2 temp sensor 1' : { + HIGH_THRESHOLD : '80.0', + LOW_THRESHOLD : NOT_AVAILABLE, + HIGH_CRIT_THRESHOLD : NOT_AVAILABLE, + LOW_CRIT_THRESHOLD : NOT_AVAILABLE + } +} class Thermal(PddfThermal): """PDDF Platform-Specific Thermal class""" def __init__(self, index, pddf_data=None, pddf_plugin_data=None, is_psu_thermal=False, psu_index=0): PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data, is_psu_thermal, psu_index) + + self.pddf_obj = pddf_data + self.thermal_obj_name = "TEMP{}".format(self.thermal_index) + self.thermal_obj = self.pddf_obj.data[self.thermal_obj_name] + + # Threshold Configuration + self.__conf = DeviceThreshold(self.get_name()) + # Default threshold. + self.__default_threshold = DEFAULT_THRESHOLD[self.get_name()] + self.min_temperature = None + self.max_temperature = None # Provide the functions/variables below for which implementation is to be overwritten + def get_name(self): + if self.is_psu_thermal: + return "PSU-{0} temp sensor 1".format(self.thermals_psu_index) + else: + if 'dev_attr' in self.thermal_obj.keys(): + if 'display_name' in self.thermal_obj['dev_attr']: + return str(self.thermal_obj['dev_attr']['display_name']) + + # In case of errors + return "Temp sensor {0}".format(self.thermal_index) + + def get_status(self): + get_temp=self.get_temperature() + + if get_temp is not None: + return True if get_temp else False + + def get_temperature(self): + current = super().get_temperature() + + if self.min_temperature is None or \ + current < self.min_temperature: + self.min_temperature = current + + if self.max_temperature is None or \ + current > self.max_temperature: + self.max_temperature = current + + return current + + def set_high_threshold(self, temperature): + try: + value = float(temperature) + except Exception: + return False + + # The new value can not be more than the default value. + default_value = self.__default_threshold[HIGH_THRESHOLD] + if default_value != NOT_AVAILABLE: + if value > float(default_value): + return False + + try: + self.__conf.set_high_threshold(str(value)) + except Exception: + return False + + return True + + def get_high_threshold(self): + value = self.__conf.get_high_threshold() + if value != NOT_AVAILABLE: + return float(value) + + default_value = self.__default_threshold[HIGH_THRESHOLD] + if default_value != NOT_AVAILABLE: + return float(default_value) + + return super().get_high_threshold() + + def set_low_threshold(self, temperature): + try: + value = float(temperature) + except Exception: + return False + + # The new value can not be less than the default value. + default_value = self.__default_threshold[LOW_THRESHOLD] + if default_value != NOT_AVAILABLE: + if value < float(default_value): + return False + + try: + self.__conf.set_low_threshold(str(value)) + except Exception: + return False + + return True + + def get_low_threshold(self): + value = self.__conf.get_low_threshold() + if value != NOT_AVAILABLE: + return float(value) + + default_value = self.__default_threshold[LOW_THRESHOLD] + if default_value != NOT_AVAILABLE: + return float(default_value) + + raise NotImplementedError + + def set_high_critical_threshold(self, temperature): + try: + value = float(temperature) + except Exception: + return False + + # The new value can not be more than the default value. + default_value = self.__default_threshold[HIGH_CRIT_THRESHOLD] + if default_value != NOT_AVAILABLE: + if value > float(default_value): + return False + + try: + self.__conf.set_high_critical_threshold(str(value)) + except Exception: + return False + + return True + + def get_high_critical_threshold(self): + value = self.__conf.get_high_critical_threshold() + if value != NOT_AVAILABLE: + return float(value) + + default_value = self.__default_threshold[HIGH_CRIT_THRESHOLD] + if default_value != NOT_AVAILABLE: + return float(default_value) + return super().get_high_critical_threshold() + + def set_low_critical_threshold(self, temperature): + try: + value = float(temperature) + except Exception: + return False + + # The new value can not be less than the default value. + default_value = self.__default_threshold[LOW_CRIT_THRESHOLD] + if default_value != NOT_AVAILABLE: + if value < float(default_value): + return False + + try: + self.__conf.set_low_critical_threshold(str(value)) + except Exception: + return False + + return True + + def get_low_critical_threshold(self): + value = self.__conf.get_low_critical_threshold() + if value != NOT_AVAILABLE: + return float(value) + + default_value = self.__default_threshold[LOW_CRIT_THRESHOLD] + if default_value != NOT_AVAILABLE: + return float(default_value) + + raise NotImplementedError + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return 'N/A' + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return 'N/A' + + def get_minimum_recorded(self): + """ + Retrieves the minimum recorded temperature of thermal + Returns: + A float number, the minimum recorded temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.min_temperature is None: + self.get_temperature() + + return self.min_temperature + + def get_maximum_recorded(self): + """ + Retrieves the maximum recorded temperature of thermal + Returns: + A float number, the maximum recorded temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.max_temperature is None: + self.get_temperature() + + return self.max_temperature diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor.py index f0eb95d97f..00536d20b5 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor.py @@ -25,7 +25,7 @@ import logging import logging.config import logging.handlers - import time # this is only being used as part of the example + import time from as9716_32d.fanutil import FanUtil from as9716_32d.thermalutil import ThermalUtil except ImportError as e: @@ -289,7 +289,7 @@ def __init__(self, log_file, log_level): console.setFormatter(formatter) logging.getLogger('').addHandler(console) - sys_handler = handler = logging.handlers.SysLogHandler(address = '/dev/log') + sys_handler = logging.handlers.SysLogHandler(address = '/dev/log') sys_handler.setLevel(logging.WARNING) logging.getLogger('').addHandler(sys_handler) #logging.debug('SET. logfile:%s / loglevel:%d', log_file, log_level) @@ -313,8 +313,7 @@ def manage_fans(self): LEVEL_FAN_INIT=0 LEVEL_FAN_MIN=1 LEVEL_FAN_MID=2 - LEVEL_FAN_MAX=3 - LEVEL_FAN_DEF=LEVEL_FAN_MAX + LEVEL_FAN_MAX=3 #LEVEL_FAN_DEF LEVEL_FAN_YELLOW_ALARM=4 LEVEL_FAN_RED_ALARM=5 LEVEL_FAN_SHUTDOWN=6 @@ -360,7 +359,6 @@ def manage_fans(self): count_check=0 thermal = ThermalUtil() - fan_dir=1 fan_dir=fan.get_fan_dir(1) if fan_dir==1: # AFI @@ -405,8 +403,9 @@ def manage_fans(self): max_to_mid=max_to_mid+1 if max_to_mid==thermal.THERMAL_NUM_MAX and fan_policy_state==LEVEL_FAN_MAX: - current_state=LEVEL_FAN_MID - logging.debug("current_state=LEVEL_FAN_MID") + if fan_fail==0: + current_state=LEVEL_FAN_MID + logging.debug("current_state=LEVEL_FAN_MID") else: #AFO psu_full_load=check_psu_loading() for i in range (0, thermal.THERMAL_NUM_MAX): @@ -418,10 +417,10 @@ def manage_fans(self): if psu_full_load!=True and thermal_val[i] <= fan_thermal_spec["mid_to_min_temp"][i]: mid_to_min=mid_to_min+1 elif ori_state==LEVEL_FAN_MIN: - if psu_full_load==True: + if psu_full_load==True and fan_fail==0: current_state=LEVEL_FAN_MID logging.debug("psu_full_load, set current_state=LEVEL_FAN_MID") - if thermal_val[i] >= fan_thermal_spec["min_to_mid_temp"][i]: + if thermal_val[i] >= fan_thermal_spec["min_to_mid_temp"][i] and fan_fail==0: current_state=LEVEL_FAN_MID else: @@ -447,14 +446,15 @@ def manage_fans(self): power_off_dut() if max_to_mid==thermal.THERMAL_NUM_MAX and ori_state==LEVEL_FAN_MAX: - current_state=LEVEL_FAN_MID + if fan_fail==0: + current_state=LEVEL_FAN_MID + logging.debug("current_state=LEVEL_FAN_MID") if fan_policy_alarm!=0: logging.warning('Alarm for temperature high is cleared') fan_policy_alarm=0 send_yellow_alarm=0 send_red_alarm=0 test_temp_revert=0 - logging.debug("current_state=LEVEL_FAN_MID") if mid_to_min==thermal.THERMAL_NUM_MAX and ori_state==LEVEL_FAN_MID: if psu_full_load==0: @@ -468,6 +468,16 @@ def manage_fans(self): logging.debug('fan_%d fail, set duty_cycle to 100',i) if test_temp==0: fan_fail=1 + #1.When insert/remove fan, fan speed/log still according to thermal policy. + #2.If thermal policy state is bigger than LEVEL_FAN_MAX: + # Do not change back to LEVEL_FAN_MAX, beacuse still need to deal with LOG or shutdown case. + #3.If thermal policy state is smaller than LEVEL_FAN_MAX, set state=MAX. + # When remove and insert back fan test, policy check temp and set to correct fan_speed. + # + + if current_state < LEVEL_FAN_MAX: + current_state=LEVEL_FAN_MAX + logging.debug('fan_%d fail, current_state=LEVEL_FAN_MAX', i) fan.set_fan_duty_cycle(new_duty_cycle) break else: diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_pddf_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_pddf_monitor.py index fa08071045..65f40be51b 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_pddf_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_pddf_monitor.py @@ -17,16 +17,24 @@ # HISTORY: # mm/dd/yyyy (A.D.)# # 8/27/2019:Jostar create for as9716_32d thermal plan +# 2/20/2023:Jostar modify to add kick fan-wdt +# 3/23/2023:Roger Add ZR port thermal plan +# 11/23/2023:Roger +# 1. Sync the log buffer to the disk before +# powering off the DUT. +# 2. Change the decision of FAN direction +# 3. Enhance test data # ------------------------------------------------------------------ try: - import subprocess import sys import getopt import logging import logging.config import logging.handlers import time + from swsscommon import swsscommon + from sonic_py_common.general import getstatusoutput_noshell from sonic_platform import platform except ImportError as e: raise ImportError('%s - required module not found' % str(e)) @@ -35,6 +43,10 @@ VERSION = '1.0' FUNCTION_NAME = '/usr/local/bin/accton_as9716_32d_pddf_monitor' +FAN_DUTY_CYCLE_MAX = 100 +STATE_DB = 'STATE_DB' +TRANSCEIVER_DOM_SENSOR_TABLE = 'TRANSCEIVER_DOM_SENSOR' +TEMPERATURE_FIELD_NAME = 'temperature' class switch(object): def __init__(self, value): @@ -65,114 +77,109 @@ def match(self, *args): # Default fan duty_cycle will be 100%(fan_policy_state=LEVEL_FAN_MAX). # If all below case meet with, set to 75%(LEVEL_FAN_MID). # MB board -# LM75-1(0X48)<=57 -# LM75-2(0X49)<=47.3 -# LM75-3(0X4A)<=45 -# LM75-4(0X4C)<=45.1 -# LM75-5(0X4E)<=40.75 -# LM75-6(0X4F)<=42.1 +# LM75-1(0X48)<=45.5 +# LM75-2(0X49)<=39.5 +# LM75-3(0X4A)<=37.5 +# LM75-4(0X4C)<=38.5 +# LM75-5(0X4E)<=34.5 +# LM75-6(0X4F)<=37 # CPU board -# Core<=44 -# LM75-1(0X4B)<=35 +# Core(1~4) <=40 +# LM75-1(0X4B)<=30.5 +# ZR<=62 # When fan_policy_state=LEVEL_FAN_MID, meet with below case, Fan duty_cycle will be 100%(LEVEL_FAN_DAX) # (MB board) -# LM75-1(0X48)>=61.5 -# LM75-2(0X49)>=51.5 -# LM75-3(0X4A)>=49.4 -# LM75-4(0X4C)>=49.4 -# LM75-5(0X4E)>=45.1 -# LM75-6(0X4F)>=46.75 +# LM75-1(0X48)>=51.5 +# LM75-2(0X49)>=44.5 +# LM75-3(0X4A)>=43.5 +# LM75-4(0X4C)>=43.5 +# LM75-5(0X4E)>=40 +# LM75-6(0X4F)>=42.5 # (CPU board) -# Core>=48 -# LM75-1(0X4B)>=38.5 - -# 2. For AFO: -# At default, FAN duty_cycle was 100%(LEVEL_FAN_MAX). If all below case meet with, set to 75%(LEVEL_FAN_MID). -# (MB board) -# LM75-1(0X48)<=59 -# LM75-2(0X49)<=53.5 -# LM75-3(0X4A)<=55.3 -# LM75-4(0X4C)<=50.3 -# LM75-5(0X4E)<=50 -# LM75-6(0X4F)<=52.5 -# (CPU board) -# Core<=59 -# LM75-1(0X4B)<=41.1 - -# When FAN duty_cycle was 75%(LEVEL_FAN_MID). If all below case meet with, set to 50%(LEVEL_FAN_DEF). -# (MB board) -# LM75-1(0X48)<=55.8 -# LM75-2(0X49)<=50.5 -# LM75-3(0X4A)<=51.1 -# LM75-4(0X4C)<=47.6 -# LM75-5(0X4E)<=45.75 -# LM75-6(0X4F)<=50.1 -# (CPU board) -# Core<=57 -# LM75-1(0X4B)<=36.6 - -# When fan_speed 50%(LEVEL_FAN_DEF). -# Meet with below case, Fan duty_cycle will be 75%(LEVEL_FAN_MID) -# (MB board) -# LM75-1(0X48)>=70 -# LM75-2(0X49)>=66 -# LM75-3(0X4A)>=68 -# LM75-4(0X4C)>=62 -# LM75-5(0X4E)>=62 -# LM75-6(0X4F)>=67 -# (CPU board) -# Core>=77 -# LM75-1(0X4B)>=50 - -# When FAN duty_cycle was 75%(LEVEL_FAN_MID). If all below case meet with, set to 100%(LEVEL_FAN_MAX). -# (MB board) -# LM75-1(0X48)>=67 -# LM75-2(0X49)>=62.5 -# LM75-3(0X4A)>=65 -# LM75-4(0X4C)>=59 -# LM75-5(0X4E)>=58.5 -# LM75-6(0X4F)>=63 - -# (CPU board) -# Core >=69 -# LM75-1(0X4B)>=49 - -# Yellow Alarm -# MB board -# LM75-1(0X48)>=68 -# LM75-2(0X49)>=64 -# LM75-3(0X4A)>=65 -# LM75-4(0X4C)>=61 -# LM75-5(0X4E)>=60 -# LM75-6(0X4F)>=64 -# CPU Board -# Core>=70 -# LM75-1(0X4B)>=68 - -# Red Alarm -# MB board -# LM75-1(0X48)>=72 -# LM75-2(0X49)>=68 -# LM75-3(0X4A)>=69 -# LM75-4(0X4C)>=65 -# LM75-5(0X4E)>=64 -# LM75-6(0X4F)>=68 -# CPU Board -# Core>=74 -# LM75-1(0X4B)>=72 - -# Shut down -# MB board -# LM75-1(0X48)>=77 -# LM75-2(0X49)>=73 -# LM75-3(0X4A)>=74 -# LM75-4(0X4C)>=70 -# LM75-5(0X4E)>=69 -# LM75-6(0X4F)>=73 -# CPU Board -# Core>=79 -# LM75-1(0X4B)>=77 +# Core-1>=45, Core-2>=45, Core-3>=46, Core-4>=46 +# LM75-1(0X4B)>=35.5 +# ZR>=65 + +# Red Alarm +# (MB board) +# LM75-1(0X48)>=55.5 +# LM75-2(0X49)>=48.5 +# LM75-3(0X4A)>=47.5 +# LM75-4(0X4C)>=47.5 +# LM75-5(0X4E)>=47 +# LM75-6(0X4F)>=49.5 +# (CPU board) +# Core(1~4) >=50 +# LM75-1(0X4B)>=40 +# ZR>=75 + +# 2.For AFO: +# At default, FAN duty_cycle was 100%(LEVEL_FAN_MAX). If all below case meet with, set to 75%(LEVEL_FAN_MID). +# (MB board) +# LM75-1(0X48)<=47 +# LM75-2(0X49)<=47 +# LM75-3(0X4A)<=47 +# LM75-4(0X4C)<=47 +# LM75-5(0X4E)<=47 +# LM75-6(0X4F)<=47 +# (CPU board) +# Core-(1~4)<=55 +# LM75-1(0X4B)<=40 +# ZR<=60 + +# When FAN duty_cycle was 75%(LEVEL_FAN_MID). If all below case meet with, set to 50%(LEVEL_FAN_DEF). +# (MB board) +# LM75-1(0X48)<=40 +# LM75-2(0X49)<=40 +# LM75-3(0X4A)<=40 +# LM75-4(0X4C)<=40 +# LM75-5(0X4E)<=40 +# LM75-6(0X4F)<=40 +# (CPU board) +# Core-(1~4)<=50 +# LM75-1(0X4B)<=33 +# ZR<=55 + +# When fan_speed 50%(LEVEL_FAN_DEF). +# Meet with below case, Fan duty_cycle will be 75%(LEVEL_FAN_MID) +# (MB board) +# LM75-1(0X48)>=63 +# LM75-2(0X49)>=63 +# LM75-3(0X4A)>=63 +# LM75-4(0X4C)>=63 +# LM75-5(0X4E)>=63 +# LM75-6(0X4F)>=63 +# (CPU board) +# Core-(1~4)>=73 +# LM75-1(0X4B)>=50 +# ZR>=65 + +# When FAN duty_cycle was 75%(LEVEL_FAN_MID). If all below case meet with, set to 100%(LEVEL_FAN_MAX). +# (MB board) +# LM75-1(0X48)>=68 +# LM75-2(0X49)>=68 +# LM75-3(0X4A)>=68 +# LM75-4(0X4C)>=68 +# LM75-5(0X4E)>=68 +# LM75-6(0X4F)>=68 +# (CPU board) +# Core-(1~4)>=77 +# LM75-1(0X4B)>=55 +# ZR>=70 + +# Red Alarm +# MB board +# LM75-1(0X48)>=72 +# LM75-2(0X49)>=72 +# LM75-3(0X4A)>=72 +# LM75-4(0X4C)>=72 +# LM75-5(0X4E)>=72 +# LM75-6(0X4F)>=72 +# CPU Board +# Core>=81 +# LM75-1(0X4B)>=60 +# ZR>=75 def as9716_32d_set_fan_speed(pwm): @@ -186,10 +193,23 @@ def as9716_32d_set_fan_speed(pwm): def power_off_dut(): - cmd_str = "i2cset -y -f 19 0x60 0x60 0x10" - status, output = subprocess.getstatusoutput(cmd_str) + # Sync log buffer to disk + cmd_str=["sync"] + (status, output) = getstatusoutput_noshell(cmd_str) + cmd_str=["/sbin/fstrim", "-av"] + (status, output) = getstatusoutput_noshell(cmd_str) + time.sleep(3) + + # Power off dut + cmd_str = ["i2cset", "-y", "-f", "19", "0x60", "0x60", "0x10"] + (status, output) = getstatusoutput_noshell(cmd_str) return status +def shutdown_transceiver(iface_name): + cmd_str = ["config", "interface", "shutdown", iface_name] + (status, output) = getstatusoutput_noshell(cmd_str) + return (status == 0) + # If only one PSU insert(or one of PSU pwoer fail), and watt >800w. Must let DUT fan pwm >= 75% in AFO. # Because the psu temp is high. # Return 1: full load @@ -218,13 +238,12 @@ def check_psu_loading(): fan_policy_state = 0 fan_policy_alarm = 0 -send_yellow_alarm = 0 send_red_alarm = 0 fan_fail = 0 count_check = 0 test_temp = 0 -test_temp_list = [0, 0, 0, 0, 0, 0, 0, 0] +test_temp_list = [0] * (8 + 8) # 8 Thermal, 8 ZR/ZR+ Thermal temp_test_data = 0 test_temp_revert = 0 platform_chassis = None @@ -252,7 +271,7 @@ def __init__(self, log_file, log_level): if log_level == logging.DEBUG: console = logging.StreamHandler() console.setLevel(log_level) - formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') + formatter = logging.Formatter('[%(asctime)s] %(name)-12s: %(levelname)-8s %(message)s', datefmt='%H:%M:%S') console.setFormatter(formatter) logging.getLogger('').addHandler(console) @@ -260,10 +279,25 @@ def __init__(self, log_file, log_level): sys_handler.setLevel(logging.WARNING) logging.getLogger('').addHandler(sys_handler) + self.transceiver_dom_sensor_table = None + + def __get_transceiver_temperature(self, iface_name): + if self.transceiver_dom_sensor_table is None: + return 0.0 + + (status, ret) = self.transceiver_dom_sensor_table.hget(iface_name, TEMPERATURE_FIELD_NAME) + if status: + try: + return float(ret) + except (TypeError, ValueError): + pass + + return 0.0 + + def manage_fans(self): global fan_policy_state global fan_policy_alarm - global send_yellow_alarm global send_red_alarm global fan_fail global count_check @@ -273,16 +307,15 @@ def manage_fans(self): global test_temp_revert global platform_chassis + # 30 seonds CHECK_TIMES = 3 LEVEL_FAN_INIT = 0 LEVEL_FAN_MIN = 1 LEVEL_FAN_MID = 2 LEVEL_FAN_MAX = 3 # LEVEL_FAN_DEF - LEVEL_FAN_YELLOW_ALARM = 4 - LEVEL_FAN_RED_ALARM = 5 - LEVEL_FAN_SHUTDOWN = 6 - THERMAL_NUM_MAX = 7 + LEVEL_FAN_RED_ALARM = 4 + THERMAL_NUM_MAX = 8 FAN_NUM = 2 FAN_TRAY_NUM = 6 @@ -297,24 +330,84 @@ def manage_fans(self): LEVEL_FAN_MAX: [100, 0xf] } + TYPE_SENSOR = 1 + TYPE_TRANSCEIVER = 2 + + # ZR Allocation + monitor_port = [5, 6, 11, 12, 19, 20, 31, 32] + TRANSCEIVER_NUM_MAX = len(monitor_port) + + # afi_thermal_spec = { + # "...............": [0x48, 0x49, + # 0x4a, 0x4b, + # 0x4c, 0x4e, + # 0x4f, CPU Core] + # afo_thermal_spec = { + # "...............": [0x48, 0x49, + # 0x4a, 0x4b, + # 0x4c, 0x4e, + # 0x4f, CPU Core] + afi_thermal_spec = { - "mid_to_max_temp": [61500, 51500, 49400, 49400, 45100, 46750, 48000, 38500], - "max_to_mid_temp": [57000, 47300, 45000, 45100, 40750, 42100, 44000, 35000] + "mid_to_max_temp": [(TYPE_SENSOR, 51500), (TYPE_SENSOR, 44500), + (TYPE_SENSOR, 43500), (TYPE_SENSOR, 35500), + (TYPE_SENSOR, 43500), (TYPE_SENSOR, 40000), + (TYPE_SENSOR, 42500), (TYPE_SENSOR, 45000)], + "max_to_mid_temp": [(TYPE_SENSOR, 45500), (TYPE_SENSOR, 39500), + (TYPE_SENSOR, 37500), (TYPE_SENSOR, 30500), + (TYPE_SENSOR, 38500), (TYPE_SENSOR, 34500), + (TYPE_SENSOR, 37000), (TYPE_SENSOR, 40000)], + "max_to_red_alarm": [(TYPE_SENSOR, 55500), (TYPE_SENSOR, 48500), + (TYPE_SENSOR, 47500), (TYPE_SENSOR, 40000), + (TYPE_SENSOR, 47500), (TYPE_SENSOR, 47000), + (TYPE_SENSOR, 49500), (TYPE_SENSOR, 50000)], } + afi_thermal_spec["mid_to_max_temp"] += [(TYPE_TRANSCEIVER, 65000)] * TRANSCEIVER_NUM_MAX + afi_thermal_spec["max_to_mid_temp"] += [(TYPE_TRANSCEIVER, 62000)] * TRANSCEIVER_NUM_MAX + afi_thermal_spec["max_to_red_alarm"] += [(TYPE_TRANSCEIVER, 75000)] * TRANSCEIVER_NUM_MAX + afo_thermal_spec = { - "min_to_mid_temp": [70000, 66000, 68000, 62000, 62000, 67000, 77000, 50000], - "mid_to_max_temp": [67000, 62000, 65000, 59000, 58500, 63000, 69000, 49000], - "max_to_mid_temp": [59000, 53500, 55300, 50300, 50000, 52500, 59000, 41100], - "mid_to_min_temp": [55800, 50500, 51100, 47600, 45750, 50100, 57000, 36600], - "max_to_yellow_alarm": [68000, 64000, 65000, 61000, 60000, 64000, 70000, 68000], - "yellow_to_red_alarm": [72000, 68000, 69000, 65000, 64000, 68000, 74000, 72000], - "red_alarm_to_shutdown": [77000, 73000, 74000, 70000, 69000, 73000, 79000, 77000] + "min_to_mid_temp": [(TYPE_SENSOR, 63000), (TYPE_SENSOR, 63000), + (TYPE_SENSOR, 63000), (TYPE_SENSOR, 50000), + (TYPE_SENSOR, 63000), (TYPE_SENSOR, 63000), + (TYPE_SENSOR, 63000), (TYPE_SENSOR, 73000)], + "mid_to_max_temp": [(TYPE_SENSOR, 68000), (TYPE_SENSOR, 68000), + (TYPE_SENSOR, 68000), (TYPE_SENSOR, 70000), + (TYPE_SENSOR, 68000), (TYPE_SENSOR, 68000), + (TYPE_SENSOR, 68000), (TYPE_SENSOR, 77000)], + "max_to_mid_temp": [(TYPE_SENSOR, 47000), (TYPE_SENSOR, 47000), + (TYPE_SENSOR, 47000), (TYPE_SENSOR, 40000), + (TYPE_SENSOR, 47000), (TYPE_SENSOR, 47000), + (TYPE_SENSOR, 47000), (TYPE_SENSOR, 55000)], + "mid_to_min_temp": [(TYPE_SENSOR, 40000), (TYPE_SENSOR, 40000), + (TYPE_SENSOR, 40000), (TYPE_SENSOR, 33000), + (TYPE_SENSOR, 40000), (TYPE_SENSOR, 40000), + (TYPE_SENSOR, 40000), (TYPE_SENSOR, 50000)], + "max_to_red_alarm": [(TYPE_SENSOR, 72000), (TYPE_SENSOR, 72000), + (TYPE_SENSOR, 72000), (TYPE_SENSOR, 60000), + (TYPE_SENSOR, 72000), (TYPE_SENSOR, 72000), + (TYPE_SENSOR, 72000), (TYPE_SENSOR, 81000)], } + afo_thermal_spec["min_to_mid_temp"] += [(TYPE_TRANSCEIVER, 65000)] * TRANSCEIVER_NUM_MAX + afo_thermal_spec["mid_to_max_temp"] += [(TYPE_TRANSCEIVER, 70000)] * TRANSCEIVER_NUM_MAX + afo_thermal_spec["max_to_mid_temp"] += [(TYPE_TRANSCEIVER, 60000)] * TRANSCEIVER_NUM_MAX + afo_thermal_spec["mid_to_min_temp"] += [(TYPE_TRANSCEIVER, 55000)] * TRANSCEIVER_NUM_MAX + afo_thermal_spec["max_to_red_alarm"] += [(TYPE_TRANSCEIVER, 75000)] * TRANSCEIVER_NUM_MAX - thermal_val = [0, 0, 0, 0, 0, 0, 0, 0] + thermal_val = [] max_to_mid = 0 mid_to_min = 0 + # After booting, the database might not be ready for + # connection. So, it should try to connect to the database + # if self.transceiver_dom_sensor_table is None. + if self.transceiver_dom_sensor_table is None: + try: + state_db = swsscommon.DBConnector(STATE_DB, 0, False) + self.transceiver_dom_sensor_table = swsscommon.Table(state_db, TRANSCEIVER_DOM_SENSOR_TABLE) + except Exception as e: + logging.debug("{}".format(e)) + if fan_policy_state == LEVEL_FAN_INIT: fan_policy_state = LEVEL_FAN_MAX # This is default state logging.debug("fan_policy_state=LEVEL_FAN_MAX") @@ -326,14 +419,29 @@ def manage_fans(self): else: count_check = 0 - fan_dir = platform_chassis.get_fan(1).get_direction() - - if fan_dir == "INTAKE": # AFI + f2b_dir = 0 + b2f_dir = 0 + for i in range(FAN_TRAY_NUM * FAN_NUM): + fan = platform_chassis.get_fan(i) + if fan.get_presence() == False: + continue + res = fan.get_direction() + if isinstance(res, str): + b2f_dir += res.lower() == "intake" + f2b_dir += res.lower() == "exhaust" + logging.debug("b2f_dir={} f2b_dir={}".format(b2f_dir, f2b_dir)) + fan_dir = "intake" if b2f_dir >= f2b_dir else "exhaust" + + logging.debug("fan_dir : %s", fan_dir) + + if fan_dir == "intake": # AFI fan_thermal_spec = afi_thermal_spec fan_policy = fan_policy_b2f - elif fan_dir == "EXHAUST": # AFO + logging.debug("fan_policy = fan_policy_b2f") + elif fan_dir == "exhaust": # AFO fan_thermal_spec = afo_thermal_spec fan_policy = fan_policy_f2b + logging.debug("fan_policy = fan_policy_f2b") else: logging.debug("NULL case, not meet with fan_dir=0 or 1") @@ -347,40 +455,88 @@ def manage_fans(self): if test_temp == 0: for i in range(THERMAL_NUM_MAX): - thermal_val[i] = platform_chassis.get_thermal(i).get_temperature()*1000 + thermal_val.append((TYPE_SENSOR, None, + platform_chassis.get_thermal(i).get_temperature()*1000)) + + for port_num in monitor_port: + sfp = platform_chassis.get_sfp(port_num) + thermal_val.append((TYPE_TRANSCEIVER, sfp, + self.__get_transceiver_temperature(sfp.get_name()) * 1000)) else: for i in range(THERMAL_NUM_MAX): - thermal_val[i] = test_temp_list[i] - thermal_val[i] = thermal_val[i] + temp_test_data - + thermal_val.append((TYPE_SENSOR, None, test_temp_list[i] + temp_test_data)) + for port_num in monitor_port: + sfp = platform_chassis.get_sfp(port_num) + thermal_val.append((TYPE_TRANSCEIVER, sfp, test_temp_list[i + 1] + temp_test_data)) + i = i + 1 fan_fail = 0 + logging.debug("Maximum avaliable port : %d", TRANSCEIVER_NUM_MAX) + logging.debug("thermal_val : %s", thermal_val) + ori_state = fan_policy_state current_state = fan_policy_state - if fan_dir == "INTAKE": # AFI - for i in range(THERMAL_NUM_MAX): + if fan_dir == "intake": # AFI + sfp_presence_num = 0 + for i, (temp_type, obj, current_temp) in enumerate(thermal_val): + sfp = None + if temp_type == TYPE_TRANSCEIVER: + sfp = obj + if sfp.get_presence(): + sfp_presence_num += 1 + else: + continue + if ori_state == LEVEL_FAN_MID: - if thermal_val[i] >= fan_thermal_spec["mid_to_max_temp"][i]: + if current_temp >= fan_thermal_spec["mid_to_max_temp"][i][1]: current_state = LEVEL_FAN_MAX logging.debug("current_state=LEVEL_FAN_MAX") break else: - if (thermal_val[i] <= fan_thermal_spec["max_to_mid_temp"][i]): - max_to_mid = max_to_mid+1 - if max_to_mid == THERMAL_NUM_MAX and fan_policy_state == LEVEL_FAN_MAX: + if current_temp <= fan_thermal_spec["max_to_mid_temp"][i][1]: + max_to_mid = max_to_mid + 1 + if fan_policy_alarm == 0: + if current_temp >= fan_thermal_spec["max_to_red_alarm"][i][1]: + if send_red_alarm == 0: + fan_policy_alarm = LEVEL_FAN_RED_ALARM + send_red_alarm = 1 + if fan_thermal_spec["max_to_red_alarm"][i][0] == TYPE_SENSOR: + logging.warning('Alarm-Red for temperature high is detected, shutdown DUT.') + time.sleep(2) + power_off_dut() + elif fan_thermal_spec["max_to_red_alarm"][i][0] == TYPE_TRANSCEIVER: + if shutdown_transceiver(sfp.get_name()): + logging.warning("Alarm-Red for temperature high is detected, shutdown %s.", sfp.get_name()) + + if max_to_mid == (THERMAL_NUM_MAX + sfp_presence_num) and fan_policy_state == LEVEL_FAN_MAX: if fan_fail == 0: current_state = LEVEL_FAN_MID logging.debug("current_state=LEVEL_FAN_MID") + if fan_policy_alarm != 0: + logging.warning('Alarm for temperature high is cleared') + fan_policy_alarm = 0 + send_red_alarm = 0 + test_temp_revert = 0 + else: # AFO + sfp_presence_num = 0 psu_full_load = check_psu_loading() - for i in range(THERMAL_NUM_MAX): + for i, (temp_type, obj, current_temp) in enumerate(thermal_val): + sfp = None + if temp_type == TYPE_TRANSCEIVER: + sfp = obj + if sfp.get_presence(): + sfp_presence_num += 1 + else: + continue + if ori_state == LEVEL_FAN_MID: - if thermal_val[i] >= fan_thermal_spec["mid_to_max_temp"][i]: + if current_temp >= fan_thermal_spec["mid_to_max_temp"][i][1]: current_state = LEVEL_FAN_MAX break else: - if psu_full_load != True and thermal_val[i] <= fan_thermal_spec["mid_to_min_temp"][i]: + if psu_full_load != True and current_temp <= fan_thermal_spec["mid_to_min_temp"][i][1]: mid_to_min = mid_to_min+1 elif ori_state == LEVEL_FAN_MIN: @@ -388,47 +544,37 @@ def manage_fans(self): current_state = LEVEL_FAN_MID logging.warning("psu_full_load, set current_state=LEVEL_FAN_MID") logging.debug("current_state=LEVEL_FAN_MID") - if thermal_val[i] >= fan_thermal_spec["min_to_mid_temp"][i] and fan_fail == 0: + if current_temp >= fan_thermal_spec["min_to_mid_temp"][i][1] and fan_fail == 0: current_state = LEVEL_FAN_MID logging.debug("current_state=LEVEL_FAN_MID") else: - if thermal_val[i] <= fan_thermal_spec["max_to_mid_temp"][i]: + if current_temp <= fan_thermal_spec["max_to_mid_temp"][i][1]: max_to_mid = max_to_mid+1 if fan_policy_alarm == 0: - if thermal_val[i] >= fan_thermal_spec["max_to_yellow_alarm"][i]: - if send_yellow_alarm == 0: - logging.warning('Alarm-Yellow for temperature high is detected') - fan_policy_alarm = LEVEL_FAN_YELLOW_ALARM - send_yellow_alarm = 1 - elif fan_policy_alarm == LEVEL_FAN_YELLOW_ALARM: - if thermal_val[i] >= fan_thermal_spec["yellow_to_red_alarm"][i]: + if current_temp >= fan_thermal_spec["max_to_red_alarm"][i][1]: if send_red_alarm == 0: - logging.warning('Alarm-Red for temperature high is detected') - logging.warning('Alarm for temperature high is detected ') fan_policy_alarm = LEVEL_FAN_RED_ALARM send_red_alarm = 1 - elif fan_policy_alarm == LEVEL_FAN_RED_ALARM: - if thermal_val[i] >= fan_thermal_spec["red_alarm_to_shutdown"][i]: - logging.critical('Alarm-Critical for temperature high is detected, shutdown DUT') - logging.critical('Alarm for temperature critical is detected ') - fan_policy_alarm = LEVEL_FAN_SHUTDOWN - time.sleep(2) - power_off_dut() - - if max_to_mid == THERMAL_NUM_MAX and ori_state == LEVEL_FAN_MAX: + if fan_thermal_spec["max_to_red_alarm"][i][0] == TYPE_SENSOR: + logging.warning('Alarm-Red for temperature high is detected, shutdown DUT.') + time.sleep(2) + power_off_dut() + elif fan_thermal_spec["max_to_red_alarm"][i][0] == TYPE_TRANSCEIVER: + if shutdown_transceiver(sfp.get_name()): + logging.warning("Alarm-Red for temperature high is detected, shutdown %s.", sfp.get_name()) + + if max_to_mid == (THERMAL_NUM_MAX + sfp_presence_num) and ori_state == LEVEL_FAN_MAX: if fan_fail == 0: current_state = LEVEL_FAN_MID logging.debug("current_state=LEVEL_FAN_MID") - logging.debug("current_state=LEVEL_FAN_MID") if fan_policy_alarm != 0: logging.warning('Alarm for temperature high is cleared') fan_policy_alarm = 0 - send_yellow_alarm = 0 send_red_alarm = 0 test_temp_revert = 0 - if mid_to_min == THERMAL_NUM_MAX and ori_state == LEVEL_FAN_MID: + if mid_to_min == (THERMAL_NUM_MAX + sfp_presence_num) and ori_state == LEVEL_FAN_MID: if psu_full_load == 0: current_state = LEVEL_FAN_MIN logging.debug("current_state=LEVEL_FAN_MIN") @@ -436,7 +582,7 @@ def manage_fans(self): # Check Fan status for i in range(FAN_TRAY_NUM * FAN_NUM): if not platform_chassis.get_fan(i).get_status() or not platform_chassis.get_fan(i).get_speed_rpm(): - new_duty_cycle = 100 + new_duty_cycle = FAN_DUTY_CYCLE_MAX logging.warning('fan_%d fail, set duty_cycle to 100', i+1) if test_temp == 0: fan_fail = 1 @@ -489,11 +635,11 @@ def main(argv): log_file = arg if sys.argv[1] == '-t': - if len(sys.argv) != 10: + if len(sys.argv) != (2 + 8 + 8): # 8 Thermal, 8 ZR/ZR+ Thermal print("temp test, need input 8 temp") return 0 i = 0 - for x in range(2, 10): + for x in range(2, (2 + 8 + 8)): # 8 Thermal, 8 ZR/ZR+ Thermal test_temp_list[i] = int(sys.argv[x])*1000 i = i+1 test_temp = 1 @@ -502,16 +648,39 @@ def main(argv): global platform_chassis platform_chassis = platform.Platform().get_chassis() - status, output = subprocess.getstatusoutput('i2cset -f -y 17 0x66 0x33 0x0') + #status, output = subprocess.getstatusoutput('i2cset -f -y 17 0x66 0x33 0x0') + #if status: + # print("Warning: Fan speed watchdog could not be disabled") + cmd_str = ["i2cset", "-y", "-f", "17", "0x66", "0x33", "0x1"] + status, output = getstatusoutput_noshell(cmd_str) + if status: + print("Warning: Fan speed watchdog could not be enabled") + + cmd_str = ["i2cset", "-y", "-f", "17", "0x66", "0x31", "0xF0"] + status, output = getstatusoutput_noshell(cmd_str) if status: - print("Warning: Fan speed watchdog could not be disabled") + print("Warning: Fan speed watchdog timer could not be disabled") + - as9716_32d_set_fan_speed(100) + as9716_32d_set_fan_speed(FAN_DUTY_CYCLE_MAX) monitor = device_monitor(log_file, log_level) - # Loop forever, doing something useful hopefully: + cmd_kick = ["i2cset", "-y", "-f", "17", "0x66", "0x31", "0xF0"] #kick WDT + cmd_check_wdt = ["i2cget", "-y", "-f", "17", "0x66", "0x33"] while True: monitor.manage_fans() + getstatusoutput_noshell(cmd_kick) time.sleep(10) + + status, output = getstatusoutput_noshell(cmd_check_wdt) + if status is not None: + val= int(output,16) + if (val & 0x1) == 0: + logging.warning('Detect Fan-WDT disable') + logging.warning('Try to enable Fan-WDT') + cmd_str = ["i2cset", "-y", "-f", "17", "0x66", "0x33", "0x1"] + getstatusoutput_noshell(cmd_str) + cmd_str = ["i2cset", "-y", "-f", "17", "0x66", "0x31", "0xF0"] + getstatusoutput_noshell(cmd_str) if __name__ == '__main__': diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_util.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_util.py index 53126109f9..efba8a3d08 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_util.py @@ -16,22 +16,27 @@ # along with this program. If not, see . """ -Usage: %(scriptName)s [options] command object - -options: - -h | --help : this help message - -d | --debug : run with debug mode - -f | --force : ignore error during installation or clean -command: - install : install drivers and generate related sysfs nodes - clean : uninstall drivers and remove related sysfs nodes +usage: accton_as9716_32d_util.py [-h] [-d] [-f] {install,clean,threshold} ... + +AS9716-32D Platform Utility + +optional arguments: + -h, --help show this help message and exit + -d, --debug run with debug mode + -f, --force ignore error during installation or clean + +Utility Command: + {install,clean,threshold} + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes + threshold : modify thermal threshold """ import subprocess -import getopt import sys import logging import re import time +import argparse from sonic_py_common.general import getstatusoutput_noshell PROJECT_NAME = 'as9716_32d' @@ -115,37 +120,42 @@ def main(): global DEBUG global args global FORCE + global THRESHOLD_RANGE_LOW, THRESHOLD_RANGE_HIGH + + util_parser = argparse.ArgumentParser(description="AS9716-32D Platform Utility") + util_parser.add_argument("-d", "--debug", dest='debug', action='store_true', default=False, + help="run with debug mode") + util_parser.add_argument("-f", "--force", dest='force', action='store_true', default=False, + help="ignore error during installation or clean") + subcommand = util_parser.add_subparsers(dest='cmd', title='Utility Command', required=True) + subcommand.add_parser('install', help=': install drivers and generate related sysfs nodes') + subcommand.add_parser('clean', help=': uninstall drivers and remove related sysfs nodes') + threshold_parser = subcommand.add_parser('threshold', help=': modify thermal threshold') + threshold_parser.add_argument("-l", dest='list', action='store_true', default=False, + help="list avaliable thermal") + threshold_parser.add_argument("-t", dest='thermal', type=str, metavar='THERMAL_NAME', + help="thermal name, ex: -t 'Temp sensor 1'") + threshold_parser.add_argument("-ht", dest='high_threshold', type=restricted_float, + metavar='THRESHOLD_VALUE', + help="high threshold: %.1f ~ %.1f" % (THRESHOLD_RANGE_LOW, THRESHOLD_RANGE_HIGH)) + threshold_parser.add_argument("-hct", dest='high_crit_threshold', type=restricted_float, + metavar='THRESHOLD_VALUE', + help="high critical threshold : %.1f ~ %.1f" % (THRESHOLD_RANGE_LOW, THRESHOLD_RANGE_HIGH)) + args = util_parser.parse_args() - if len(sys.argv)<2: - show_help() - - options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', - 'debug', - 'force', - ]) if DEBUG == True: - print(options) print(args) print((len(sys.argv))) - for opt, arg in options: - if opt in ('-h', '--help'): - show_help() - elif opt in ('-d', '--debug'): - DEBUG = True - logging.basicConfig(level=logging.INFO) - elif opt in ('-f', '--force'): - FORCE = 1 - else: - logging.info('no option') - for arg in args: - if arg == 'install': - do_install() - elif arg == 'clean': - do_uninstall() - else: - show_help() + DEBUG = args.debug + FORCE = 1 if args.force else 0 + if args.cmd == 'install': + do_install() + elif args.cmd == 'clean': + do_uninstall() + elif args.cmd == 'threshold': + do_threshold() return 0 @@ -385,5 +395,162 @@ def device_exist(): ret2, log = log_os_system("ls "+i2c_prefix+"i2c-2", 0) return not(ret1 or ret2) +THRESHOLD_RANGE_LOW = 30.0 +THRESHOLD_RANGE_HIGH = 110.0 +# Code to initialize chassis object +init_chassis_code = \ + "import sonic_platform.platform\n"\ + "platform = sonic_platform.platform.Platform()\n"\ + "chassis = platform.get_chassis()\n\n" + +# Looking for thermal +looking_for_thermal_code = \ + "thermal = None\n"\ + "all_thermals = chassis.get_all_thermals()\n"\ + "for psu in chassis.get_all_psus():\n"\ + " all_thermals += psu.get_all_thermals()\n"\ + "for tmp in all_thermals:\n"\ + " if '{}' == tmp.get_name():\n"\ + " thermal = tmp\n"\ + " break\n"\ + "if thermal == None:\n"\ + " print('{} not found!')\n"\ + " exit(1)\n\n" + +def avaliable_thermals(): + global init_chassis_code + + get_all_thermal_name_code = \ + "thermal_list = []\n"\ + "all_thermals = chassis.get_all_thermals()\n"\ + "for psu in chassis.get_all_psus():\n"\ + " all_thermals += psu.get_all_thermals()\n"\ + "for tmp in all_thermals:\n"\ + " thermal_list.append(tmp.get_name())\n"\ + "print(str(thermal_list)[1:-1])\n" + + all_code = "{}{}".format(init_chassis_code, get_all_thermal_name_code) + + status, output = getstatusoutput_noshell(["docker", "exec", "pmon", "python3", "-c", all_code]) + if status != 0: + return "" + return output + +def restricted_float(x): + global THRESHOLD_RANGE_LOW, THRESHOLD_RANGE_HIGH + + try: + x = float(x) + except ValueError: + raise argparse.ArgumentTypeError("%r not a floating-point literal" % (x,)) + + if x < THRESHOLD_RANGE_LOW or x > THRESHOLD_RANGE_HIGH: + raise argparse.ArgumentTypeError("%r not in range [%.1f ~ %.1f]" % + (x, THRESHOLD_RANGE_LOW, THRESHOLD_RANGE_HIGH)) + + return x + +def get_high_threshold(name): + global init_chassis_code, looking_for_thermal_code + + get_high_threshold_code = \ + "try:\n"\ + " print(thermal.get_high_threshold())\n"\ + " exit(0)\n"\ + "except NotImplementedError:\n"\ + " print('Not implement the get_high_threshold method!')\n"\ + " exit(1)" + + all_code = "{}{}{}".format(init_chassis_code, looking_for_thermal_code.format(name, name), + get_high_threshold_code) + + status, output = getstatusoutput_noshell(["docker", "exec", "pmon", "python3", "-c", all_code]) + if status == 1: + return None + + return float(output) + +def get_high_crit_threshold(name): + global init_chassis_code, looking_for_thermal_code + + get_high_crit_threshold_code = \ + "try:\n"\ + " print(thermal.get_high_critical_threshold())\n"\ + " exit(0)\n"\ + "except NotImplementedError:\n"\ + " print('Not implement the get_high_critical_threshold method!')\n"\ + " exit(1)" + + all_code = "{}{}{}".format(init_chassis_code, looking_for_thermal_code.format(name, name), + get_high_crit_threshold_code) + + status, output = getstatusoutput_noshell(["docker", "exec", "pmon", "python3", "-c", all_code]) + if status == 1: + return None + + return float(output) + +def do_threshold(): + global args, init_chassis_code, looking_for_thermal_code + + if args.list: + print("Thermals: " + avaliable_thermals()) + return + + if args.thermal is None: + print("The following arguments are required: -t") + return + + set_threshold_code = "" + if args.high_threshold is not None: + if args.high_crit_threshold is not None and \ + args.high_threshold >= args.high_crit_threshold: + print("Invalid Threshold!(High threshold can not be more than " \ + "or equal to high critical threshold.)") + exit(1) + + high_crit = get_high_crit_threshold(args.thermal) + if high_crit is not None and \ + args.high_threshold >= high_crit: + print("Invalid Threshold!(High threshold can not be more than " \ + "or equal to high critical threshold.)") + exit(1) + + set_threshold_code += \ + "try:\n"\ + " if thermal.set_high_threshold({}) is False:\n"\ + " print('{}: set_high_threshold failure!')\n"\ + " exit(1)\n"\ + "except NotImplementedError:\n"\ + " print('Not implement the set_high_threshold method!')\n"\ + "print('Apply the new high threshold successfully.')\n"\ + "\n".format(args.high_threshold, args.thermal) + + if args.high_crit_threshold is not None: + high = get_high_threshold(args.thermal) + if high is not None and \ + args.high_crit_threshold <= high: + print("Invalid Threshold!(High critical threshold can not " \ + "be less than or equal to high threshold.)") + exit(1) + + set_threshold_code += \ + "try:\n"\ + " if thermal.set_high_critical_threshold({}) is False:\n"\ + " print('{}: set_high_critical_threshold failure!')\n"\ + " exit(1)\n"\ + "except NotImplementedError:\n"\ + " print('Not implement the set_high_critical_threshold method!')\n"\ + "print('Apply the new high critical threshold successfully.')\n"\ + "\n".format(args.high_crit_threshold, args.thermal) + + if set_threshold_code == "": + return + + all_code = "{}{}{}".format(init_chassis_code, looking_for_thermal_code.format(args.thermal, args.thermal), set_threshold_code) + + status, output = getstatusoutput_noshell(["docker", "exec", "pmon", "python3", "-c", all_code]) + print(output) + if __name__ == "__main__": main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/pddf_post_driver_install.sh b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/pddf_post_driver_install.sh index 61eb4c0fd5..afa6e1fb50 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/pddf_post_driver_install.sh +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/pddf_post_driver_install.sh @@ -44,21 +44,34 @@ i2cset -y 0 0x1b 0x7 0x3 #set channel B i2cset -y 0 0x18 0xff 0x05 i2cset -y 0 0x19 0xff 0x05 +i2cset -y 0 0x1a 0xff 0x05 +i2cset -y 0 0x1b 0xff 0x05 + + + #write output voltage to 800mV i2cset -y 0 0x18 0x2d 0x82 i2cset -y 0 0x19 0x2d 0x82 +i2cset -y 0 0x1a 0x2d 0x82 +i2cset -y 0 0x1b 0x2d 0x82 + #write de-emphasis to -3.5dB i2cset -y 0 0x18 0x15 0x12 i2cset -y 0 0x19 0x15 0x12 -#read output voltage -#i2cget -y 0 0x18 0x2d -#i2cget -y 0 0x19 0x2d -#read de-emphasis -#i2cget -y 0 0x18 0x15 -#i2cget -y 0 0x19 0x15 +i2cset -y 0 0x1a 0x15 0x12 +i2cset -y 0 0x1b 0x15 0x12 + + +#invert the polarity of the driver +i2cset -y 0 0x18 0x1f 0xd5 +i2cset -y 0 0x19 0x1f 0xd5 +i2cset -y 0 0x1a 0x1f 0xd5 +i2cset -y 0 0x1b 0x1f 0xd5 #clr channel B i2cset -y 0 0x18 0xff 0x00 i2cset -y 0 0x19 0xff 0x00 +i2cset -y 0 0x1a 0xff 0x00 +i2cset -y 0 0x1b 0xff 0x00 # De-select the mux channels which were selected for above configs i2cset -y 0 0x76 0x0 diff --git a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/service/as9726-32d-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/service/as9726-32d-platform-monitor.service index 072a8227e7..669555840a 100644 --- a/platform/broadcom/sonic-platform-modules-accton/as9726-32d/service/as9726-32d-platform-monitor.service +++ b/platform/broadcom/sonic-platform-modules-accton/as9726-32d/service/as9726-32d-platform-monitor.service @@ -1,6 +1,6 @@ [Unit] Description=Accton AS9726_32D Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=sysinit.target DefaultDependencies=no diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/classes/__init__.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/classes/__init__.py new file mode 100755 index 0000000000..e69de29bb2 diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/classes/fanutil.py new file mode 100755 index 0000000000..1df07d34fe --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/classes/fanutil.py @@ -0,0 +1,220 @@ +#!/usr/bin/env python +# Copyright (c) 2019 Edgecore Networks Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT +# LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS +# FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. +# +# See the Apache Version 2.0 License for specific language governing +# permissions and limitations under the License. +# +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 12/07/2022:Michael_Shih craete for as9736_64d +# ------------------------------------------------------------------ + +try: + import logging +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + + +class FanUtil(object): + """Platform-specific FanUtil class""" + + FAN_NUM_ON_MAIN_BROAD = 4 + FAN_NUM_1_IDX = 1 + FAN_NUM_2_IDX = 2 + FAN_NUM_3_IDX = 3 + FAN_NUM_4_IDX = 4 + + FAN_NODE_NUM_OF_MAP = 5 + FAN_NODE_FAULT_IDX_OF_MAP = 1 + FAN_NODE_DUTY_IDX_OF_MAP = 2 + FAN_NODE_FRONT_SPD_OF_MAP = 3 + FAN_NODE_REAR_SPD_OF_MAP = 4 + FAN_NODE_PRESENT_IDX_OF_MAP = 5 + + BASE_VAL_PATH = '/sys/bus/i2c/devices/25-0033/{0}' + + """ Dictionary where + key1 = fan id index (integer) starting from 1 + key2 = fan node index (interger) starting from 1 + value = path to fan device file (string) + """ + _fan_device_path_mapping = {} + + _fan_device_node_mapping = { + (FAN_NUM_1_IDX, FAN_NODE_FAULT_IDX_OF_MAP) : 'fan1_fault', + (FAN_NUM_1_IDX, FAN_NODE_DUTY_IDX_OF_MAP) : 'fan1_duty_cycle_percentage', + (FAN_NUM_1_IDX, FAN_NODE_FRONT_SPD_OF_MAP) : 'fan1_front_speed_rpm', + (FAN_NUM_1_IDX, FAN_NODE_REAR_SPD_OF_MAP) : 'fan1_rear_speed_rpm', + (FAN_NUM_1_IDX, FAN_NODE_PRESENT_IDX_OF_MAP): 'fan1_present', + + (FAN_NUM_2_IDX, FAN_NODE_FAULT_IDX_OF_MAP) : 'fan2_fault', + (FAN_NUM_2_IDX, FAN_NODE_DUTY_IDX_OF_MAP) : 'fan2_duty_cycle_percentage', + (FAN_NUM_2_IDX, FAN_NODE_FRONT_SPD_OF_MAP) : 'fan2_front_speed_rpm', + (FAN_NUM_2_IDX, FAN_NODE_REAR_SPD_OF_MAP) : 'fan2_rear_speed_rpm', + (FAN_NUM_2_IDX, FAN_NODE_PRESENT_IDX_OF_MAP): 'fan2_present', + + (FAN_NUM_3_IDX, FAN_NODE_FAULT_IDX_OF_MAP) : 'fan3_fault', + (FAN_NUM_3_IDX, FAN_NODE_DUTY_IDX_OF_MAP) : 'fan3_duty_cycle_percentage', + (FAN_NUM_3_IDX, FAN_NODE_FRONT_SPD_OF_MAP) : 'fan3_front_speed_rpm', + (FAN_NUM_3_IDX, FAN_NODE_REAR_SPD_OF_MAP) : 'fan3_rear_speed_rpm', + (FAN_NUM_3_IDX, FAN_NODE_PRESENT_IDX_OF_MAP): 'fan3_present', + + (FAN_NUM_4_IDX, FAN_NODE_FAULT_IDX_OF_MAP) : 'fan4_fault', + (FAN_NUM_4_IDX, FAN_NODE_DUTY_IDX_OF_MAP) : 'fan4_duty_cycle_percentage', + (FAN_NUM_4_IDX, FAN_NODE_FRONT_SPD_OF_MAP) : 'fan4_front_speed_rpm', + (FAN_NUM_4_IDX, FAN_NODE_REAR_SPD_OF_MAP) : 'fan4_rear_speed_rpm', + (FAN_NUM_4_IDX, FAN_NODE_PRESENT_IDX_OF_MAP): 'fan4_present', + } + + #def _get_fan_device_node(self, fan_num, node_num): + # return self._fan_device_node_mapping[(fan_num, node_num)] + + def _get_fan_node_val(self, fan_num, node_num): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num:%d', fan_num) + return None + + if node_num < self.FAN_NODE_FAULT_IDX_OF_MAP or node_num > self.FAN_NODE_NUM_OF_MAP: + logging.debug('GET. Parameter error. node_num:%d', node_num) + return None + + device_path = self.get_fan_device_path(fan_num, node_num) + + try: + val_file = open(device_path, 'r') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + content = val_file.readline().rstrip() + + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + try: + val_file.close() + except IOError: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return int(content) + + def _set_fan_node_val(self, fan_num, node_num, val): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num:%d', fan_num) + return None + + if node_num < self.FAN_NODE_FAULT_IDX_OF_MAP or node_num > self.FAN_NODE_NUM_OF_MAP: + logging.debug('GET. Parameter error. node_num:%d', node_num) + return None + + content = str(val) + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + + device_path = self.get_fan_device_path(fan_num, node_num) + try: + val_file = open(device_path, 'w') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + val_file.write(content) + + try: + val_file.close() + except Exception: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return True + + def __init__(self): + fan_path = self.BASE_VAL_PATH + + for fan_num in range(self.FAN_NUM_1_IDX, self.FAN_NUM_ON_MAIN_BROAD+1): + for node_num in range(self.FAN_NODE_FAULT_IDX_OF_MAP, self.FAN_NODE_NUM_OF_MAP+1): + self._fan_device_path_mapping[(fan_num, node_num)] = fan_path.format( + self._fan_device_node_mapping[(fan_num, node_num)]) + + def get_num_fans(self): + return self.FAN_NUM_ON_MAIN_BROAD + + def get_idx_fan_start(self): + return self.FAN_NUM_1_IDX + + def get_num_nodes(self): + return self.FAN_NODE_NUM_OF_MAP + + def get_idx_node_start(self): + return self.FAN_NODE_FAULT_IDX_OF_MAP + + def get_size_node_map(self): + return len(self._fan_device_node_mapping) + + def get_size_path_map(self): + return len(self._fan_device_path_mapping) + + def get_fan_device_path(self, fan_num, node_num): + return self._fan_device_path_mapping[(fan_num, node_num)] + + def get_fan_fault(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_FAULT_IDX_OF_MAP) + + def get_fan_present(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_PRESENT_IDX_OF_MAP) + + def get_fan_duty_cycle(self): + duty_path = self._fan_device_path_mapping[(self.FAN_NUM_1_IDX, self.FAN_NODE_DUTY_IDX_OF_MAP)] + try: + val_file = open(duty_path) + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + + content = val_file.readline().rstrip() + val_file.close() + + return int(content) + + def set_fan_duty_cycle(self, val): + for fan_num in range(1, self.FAN_NUM_ON_MAIN_BROAD + 1): + duty_path = self._fan_device_path_mapping[(fan_num, self.FAN_NODE_DUTY_IDX_OF_MAP)] + try: + fan_file = open(duty_path, 'r+') + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + + fan_file.write(str(val)) + fan_file.close() + return True + + def get_fan_front_speed(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_FRONT_SPD_OF_MAP) + + def get_fan_rear_speed(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_NODE_REAR_SPD_OF_MAP) + + def get_fan_status(self, fan_num): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_NUM_ON_MAIN_BROAD: + logging.debug('GET. Parameter error. fan_num, %d', fan_num) + return None + + if self.get_fan_fault(fan_num) is not None and self.get_fan_fault(fan_num) > 0: + logging.debug('GET. FAN fault. fan_num, %d', fan_num) + return False + + return True diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/classes/thermalutil.py new file mode 100755 index 0000000000..5585e192a0 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/classes/thermalutil.py @@ -0,0 +1,116 @@ +#!/usr/bin/env python +# Copyright (c) 2019 Edgecore Networks Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT +# LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS +# FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. +# +# See the Apache Version 2.0 License for specific language governing +# permissions and limitations under the License. +# +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 04/06/2021: Michael_Shih craete for as9736_64d +# ------------------------------------------------------------------ + +try: + import logging + import glob +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +class ThermalUtil(object): + """Platform-specific ThermalUtil class""" + THERMAL_NUM_BD_SENSOR = 11 + THERMAL_NUM_CPU_CORE = 8 + THERMAL_NUM_MAX = THERMAL_NUM_BD_SENSOR + THERMAL_NUM_CPU_CORE + THERMAL_NUM_1_IDX = 1 #SMB TMP75 (0x48) + THERMAL_NUM_2_IDX = 2 #SMB TMP75 (0x49) + THERMAL_NUM_3_IDX = 3 #FCM TMP75 (0x48) + THERMAL_NUM_4_IDX = 4 #FCM TMP75 (0x49) + THERMAL_NUM_5_IDX = 5 #PDB-L TMP75 (0x48) + THERMAL_NUM_6_IDX = 6 #PDB-R TMP75 (0x49) + THERMAL_NUM_7_IDX = 7 #UDB TMP75 (0x48) + THERMAL_NUM_8_IDX = 8 #UDB TMP422 (0x4C) + THERMAL_NUM_9_IDX = 9 #LDB TMP75 (0x4C) + THERMAL_NUM_10_IDX = 10 #LDB TMP422 (0x4D) + THERMAL_NUM_11_IDX = 11 #SMB (TH4)TMP422 (0x4C) + THERMAL_CPU_CORE_0_IDX = 12 #CPU Core Temp + THERMAL_CPU_CORE_1_IDX = 13 + THERMAL_CPU_CORE_2_IDX = 14 + THERMAL_CPU_CORE_3_IDX = 15 + THERMAL_CPU_CORE_4_IDX = 16 + THERMAL_CPU_CORE_5_IDX = 17 + THERMAL_CPU_CORE_6_IDX = 18 + THERMAL_CPU_CORE_7_IDX = 19 + + """ Dictionary where + key1 = thermal id index (integer) starting from 1 + value = path to fan device file (string) """ + + thermal_sysfspath ={ + THERMAL_NUM_1_IDX: ["/sys/bus/i2c/devices/2-0048/hwmon/hwmon*/temp1_input", "SMB TMP75 (0x48)"], + THERMAL_NUM_2_IDX: ["/sys/bus/i2c/devices/2-0049/hwmon/hwmon*/temp1_input", "SMB TMP75 (0x49)"], + THERMAL_NUM_3_IDX: ["/sys/bus/i2c/devices/27-0048/hwmon/hwmon*/temp1_input", "FCM TMP75 (0x48)"], + THERMAL_NUM_4_IDX: ["/sys/bus/i2c/devices/27-0049/hwmon/hwmon*/temp1_input", "FCM TMP75 (0x49)"], + THERMAL_NUM_5_IDX: ["/sys/bus/i2c/devices/34-0048/hwmon/hwmon*/temp1_input", "PDB_L TMP75 (0x48)"], + THERMAL_NUM_6_IDX: ["/sys/bus/i2c/devices/42-0049/hwmon/hwmon*/temp1_input", "PDB_R TMP75 (0x49)"], + THERMAL_NUM_7_IDX: ["/sys/bus/i2c/devices/57-0048/hwmon/hwmon*/temp1_input", "UDB TMP75 (0x48)"], + THERMAL_NUM_8_IDX: ["/sys/bus/i2c/devices/58-004c/hwmon/hwmon*/temp1_input", "UDB TMP422(0x4c)"], + THERMAL_NUM_9_IDX: ["/sys/bus/i2c/devices/65-004c/hwmon/hwmon*/temp1_input", "LDB TMP75(0x4c)"], + THERMAL_NUM_10_IDX: ["/sys/bus/i2c/devices/66-004d/hwmon/hwmon*/temp1_input", "LDB TMP422(0x4d)"], + THERMAL_NUM_11_IDX: ["/sys/bus/i2c/devices/14-004c/hwmon/hwmon*/temp1_input", "SMB TMP422(0x4c)"], #SMB (TH4)TMP422 (0x4C), use for check MAC temperature + THERMAL_CPU_CORE_0_IDX: ["/sys/class/hwmon/hwmon0/temp2_input", "CPU Core0"], + THERMAL_CPU_CORE_1_IDX: ["/sys/class/hwmon/hwmon0/temp3_input", "CPU Core1"], + THERMAL_CPU_CORE_2_IDX: ["/sys/class/hwmon/hwmon0/temp4_input", "CPU Core2"], + THERMAL_CPU_CORE_3_IDX: ["/sys/class/hwmon/hwmon0/temp5_input", "CPU Core3"], + THERMAL_CPU_CORE_4_IDX: ["/sys/class/hwmon/hwmon0/temp6_input", "CPU Core4"], + THERMAL_CPU_CORE_5_IDX: ["/sys/class/hwmon/hwmon0/temp7_input", "CPU Core5"], + THERMAL_CPU_CORE_6_IDX: ["/sys/class/hwmon/hwmon0/temp8_input", "CPU Core6"], + THERMAL_CPU_CORE_7_IDX: ["/sys/class/hwmon/hwmon0/temp9_input", "CPU Core7"], + } + + def get_num_thermals(self): + return self.THERMAL_NUM_MAX + + def get_size_path_map(self): + return len(self.thermal_sysfspath) + + def get_thermal_path(self, thermal_num): + return self.thermal_sysfspath[thermal_num][0] + + def get_thermal_name(self, thermal_num): + return self.thermal_sysfspath[thermal_num][1] + + def _get_thermal_val(self, thermal_num): + if thermal_num < self.THERMAL_NUM_1_IDX or thermal_num > self.THERMAL_NUM_MAX: + logging.debug('GET. Parameter error. thermal_num, %d', thermal_num) + return None + + device_path = self.get_thermal_path(thermal_num) + for filename in glob.glob(device_path): + try: + val_file = open(filename, 'r') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + content = val_file.readline().rstrip() + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + try: + val_file.close() + except Exception: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return int(content) + + return 0 + diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/modules/Makefile new file mode 100755 index 0000000000..155c340b24 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/modules/Makefile @@ -0,0 +1,19 @@ +ifneq ($(KERNELRELEASE),) +obj-m:= accton_as9736_64d_cpld.o accton_as9736_64d_fan.o \ + accton_as9736_64d_psu.o accton_i2c_psu.o accton_as9736_64d_fpga.o + +else +ifeq (,$(KERNEL_SRC)) +#$(error KERNEL_SRC is not defined) +KVERSION=3.16.0-8-amd64 +KERNEL_DIR = /usr/src/linux-headers-$(KVERSION)/ +KERNELDIR:=$(KERNEL_DIR) +else +KERNELDIR:=$(KERNEL_SRC) +endif +PWD:=$(shell pwd) +default: + $(MAKE) -C $(KERNELDIR) M=$(PWD) modules +clean: + rm -rf *.o *.mod.o *.mod.o *.ko .*cmd *.mod.c .tmp_versions Module.markers Module.symvers modules.order +endif diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/modules/accton_as9736_64d_cpld.c b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/modules/accton_as9736_64d_cpld.c new file mode 100755 index 0000000000..438698ef82 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/modules/accton_as9736_64d_cpld.c @@ -0,0 +1,936 @@ +/* + * Copyright (C) Brandon Chuang + * + * This module supports the accton cpld that hold the channel select + * mechanism for other i2c slave devices, such as SFP. + * This includes the: + * Accton as9736_64d CPLD1/CPLD2/CPLD3 + * + * Based on: + * pca954x.c from Kumar Gala + * Copyright (C) 2006 + * + * Based on: + * pca954x.c from Ken Harrenstien + * Copyright (C) 2004 Google, Inc. (Ken Harrenstien) + * + * Based on: + * i2c-virtual_cb.c from Brian Kuschak + * and + * pca9540.c from Jean Delvare . + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define I2C_RW_RETRY_COUNT 10 +#define I2C_RW_RETRY_INTERVAL 60 /* ms */ + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + +enum cpld_type { + as9736_64d_fpga, + as9736_64d_cpld_cpu, + as9736_64d_cpld_pdb, + as9736_64d_cpld_scm, + as9736_64d_cpld_udb /*No attribute but add i2c addr to the list.*/ +}; + +struct as9736_64d_cpld_data { + enum cpld_type type; + struct device *hwmon_dev; + struct mutex update_lock; +}; + +static const struct i2c_device_id as9736_64d_cpld_id[] = { + { "as9736_64d_fpga", as9736_64d_fpga }, + { "as9736_64d_cpld_cpu", as9736_64d_cpld_cpu }, + { "as9736_64d_cpld_pdb", as9736_64d_cpld_pdb }, + { "as9736_64d_cpld_scm", as9736_64d_cpld_scm }, + { "as9736_64d_cpld_udb", as9736_64d_cpld_udb}, + { } +}; +MODULE_DEVICE_TABLE(i2c, as9736_64d_cpld_id); + +#define TRANSCEIVER_PRESENT_ATTR_ID(index) MODULE_PRESENT_##index +#define TRANSCEIVER_TXDISABLE_ATTR_ID(index) MODULE_TXDISABLE_##index +#define TRANSCEIVER_RXLOS_ATTR_ID(index) MODULE_RXLOS_##index +#define TRANSCEIVER_TXFAULT_ATTR_ID(index) MODULE_TXFAULT_##index +#define TRANSCEIVER_RESET_ATTR_ID(index) MODULE_RESET_##index +#define CPLD_INTR_ATTR_ID(index) CPLD_INTR_##index + +enum as9736_64d_cpld_sysfs_attributes { + PSU_RIGHT_PRESENT, + PSU_LEFT_PRESENT, + PSU_LEFT_POWER_GOOD, + PSU_RIGHT_POWER_GOOD, + CPLD_VERSION, + ACCESS, + /* transceiver attributes */ + TRANSCEIVER_PRESENT_ATTR_ID(1), + TRANSCEIVER_PRESENT_ATTR_ID(2), + TRANSCEIVER_PRESENT_ATTR_ID(3), + TRANSCEIVER_PRESENT_ATTR_ID(4), + TRANSCEIVER_PRESENT_ATTR_ID(5), + TRANSCEIVER_PRESENT_ATTR_ID(6), + TRANSCEIVER_PRESENT_ATTR_ID(7), + TRANSCEIVER_PRESENT_ATTR_ID(8), + TRANSCEIVER_PRESENT_ATTR_ID(9), + TRANSCEIVER_PRESENT_ATTR_ID(10), + TRANSCEIVER_PRESENT_ATTR_ID(11), + TRANSCEIVER_PRESENT_ATTR_ID(12), + TRANSCEIVER_PRESENT_ATTR_ID(13), + TRANSCEIVER_PRESENT_ATTR_ID(14), + TRANSCEIVER_PRESENT_ATTR_ID(15), + TRANSCEIVER_PRESENT_ATTR_ID(16), + TRANSCEIVER_PRESENT_ATTR_ID(17), + TRANSCEIVER_PRESENT_ATTR_ID(18), + TRANSCEIVER_PRESENT_ATTR_ID(19), + TRANSCEIVER_PRESENT_ATTR_ID(20), + TRANSCEIVER_PRESENT_ATTR_ID(21), + TRANSCEIVER_PRESENT_ATTR_ID(22), + TRANSCEIVER_PRESENT_ATTR_ID(23), + TRANSCEIVER_PRESENT_ATTR_ID(24), + TRANSCEIVER_PRESENT_ATTR_ID(25), + TRANSCEIVER_PRESENT_ATTR_ID(26), + TRANSCEIVER_PRESENT_ATTR_ID(27), + TRANSCEIVER_PRESENT_ATTR_ID(28), + TRANSCEIVER_PRESENT_ATTR_ID(29), + TRANSCEIVER_PRESENT_ATTR_ID(30), + TRANSCEIVER_PRESENT_ATTR_ID(31), + TRANSCEIVER_PRESENT_ATTR_ID(32), + TRANSCEIVER_PRESENT_ATTR_ID(33), + TRANSCEIVER_PRESENT_ATTR_ID(34), + TRANSCEIVER_TXDISABLE_ATTR_ID(33), + TRANSCEIVER_TXDISABLE_ATTR_ID(34), + TRANSCEIVER_RXLOS_ATTR_ID(33), + TRANSCEIVER_RXLOS_ATTR_ID(34), + TRANSCEIVER_TXFAULT_ATTR_ID(33), + TRANSCEIVER_TXFAULT_ATTR_ID(34), + TRANSCEIVER_RESET_ATTR_ID(1), + TRANSCEIVER_RESET_ATTR_ID(2), + TRANSCEIVER_RESET_ATTR_ID(3), + TRANSCEIVER_RESET_ATTR_ID(4), + TRANSCEIVER_RESET_ATTR_ID(5), + TRANSCEIVER_RESET_ATTR_ID(6), + TRANSCEIVER_RESET_ATTR_ID(7), + TRANSCEIVER_RESET_ATTR_ID(8), + TRANSCEIVER_RESET_ATTR_ID(9), + TRANSCEIVER_RESET_ATTR_ID(10), + TRANSCEIVER_RESET_ATTR_ID(11), + TRANSCEIVER_RESET_ATTR_ID(12), + TRANSCEIVER_RESET_ATTR_ID(13), + TRANSCEIVER_RESET_ATTR_ID(14), + TRANSCEIVER_RESET_ATTR_ID(15), + TRANSCEIVER_RESET_ATTR_ID(16), + TRANSCEIVER_RESET_ATTR_ID(17), + TRANSCEIVER_RESET_ATTR_ID(18), + TRANSCEIVER_RESET_ATTR_ID(19), + TRANSCEIVER_RESET_ATTR_ID(20), + TRANSCEIVER_RESET_ATTR_ID(21), + TRANSCEIVER_RESET_ATTR_ID(22), + TRANSCEIVER_RESET_ATTR_ID(23), + TRANSCEIVER_RESET_ATTR_ID(24), + TRANSCEIVER_RESET_ATTR_ID(25), + TRANSCEIVER_RESET_ATTR_ID(26), + TRANSCEIVER_RESET_ATTR_ID(27), + TRANSCEIVER_RESET_ATTR_ID(28), + TRANSCEIVER_RESET_ATTR_ID(29), + TRANSCEIVER_RESET_ATTR_ID(30), + TRANSCEIVER_RESET_ATTR_ID(31), + TRANSCEIVER_RESET_ATTR_ID(32), + CPLD_INTR_ATTR_ID(1), + CPLD_INTR_ATTR_ID(2), + CPLD_INTR_ATTR_ID(3), + CPLD_INTR_ATTR_ID(4), +}; + +/* sysfs attributes for hwmon + */ +static ssize_t show_interrupt(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t access(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t show_version(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t get_mode_reset(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); + +static int as9736_64d_cpld_read_internal(struct i2c_client *client, u8 reg); +static int as9736_64d_cpld_write_internal(struct i2c_client *client, u8 reg, u8 value); + +/* transceiver attributes */ +#define DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_present_##index, S_IRUGO, show_status, NULL, MODULE_PRESENT_##index) +#define DECLARE_TRANSCEIVER_PRESENT_ATTR(index) &sensor_dev_attr_module_present_##index.dev_attr.attr + +#define DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_tx_disable_##index, S_IRUGO | S_IWUSR, show_status, set_tx_disable, MODULE_TXDISABLE_##index); \ + static SENSOR_DEVICE_ATTR(module_rx_los_##index, S_IRUGO, show_status, NULL, MODULE_RXLOS_##index); \ + static SENSOR_DEVICE_ATTR(module_tx_fault_##index, S_IRUGO, show_status, NULL, MODULE_RXLOS_##index); + +#define DECLARE_SFP_TRANSCEIVER_ATTR(index) \ + &sensor_dev_attr_module_tx_disable_##index.dev_attr.attr, \ + &sensor_dev_attr_module_rx_los_##index.dev_attr.attr, \ + &sensor_dev_attr_module_tx_fault_##index.dev_attr.attr + +/*reset*/ +#define DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_reset_##index, S_IWUSR | S_IRUGO, get_mode_reset, set_mode_reset, MODULE_RESET_##index) +#define DECLARE_TRANSCEIVER_RESET_ATTR(index) &sensor_dev_attr_module_reset_##index.dev_attr.attr + +/*cpld interrupt*/ +#define DECLARE_CPLD_DEVICE_INTR_ATTR(index) \ + static SENSOR_DEVICE_ATTR(cpld_intr_##index, S_IRUGO, show_interrupt, NULL, CPLD_INTR_##index) +#define DECLARE_CPLD_INTR_ATTR(index) &sensor_dev_attr_cpld_intr_##index.dev_attr.attr + + +/* CPU-CPLD, CPLD1, CPLD2 Attributes*/ +static SENSOR_DEVICE_ATTR(psu1_present, S_IRUGO, show_status, NULL, PSU_LEFT_PRESENT); +static SENSOR_DEVICE_ATTR(psu2_present, S_IRUGO, show_status, NULL, PSU_RIGHT_PRESENT); +static SENSOR_DEVICE_ATTR(psu1_power_good, S_IRUGO, show_status, NULL, PSU_LEFT_POWER_GOOD); +static SENSOR_DEVICE_ATTR(psu2_power_good, S_IRUGO, show_status, NULL, PSU_RIGHT_POWER_GOOD); +static SENSOR_DEVICE_ATTR(version, S_IRUGO, show_version, NULL, CPLD_VERSION); +static SENSOR_DEVICE_ATTR(access, S_IWUSR, NULL, access, ACCESS); +/* transceiver attributes */ +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(1); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(2); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(3); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(4); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(5); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(6); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(7); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(8); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(9); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(10); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(11); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(12); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(13); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(14); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(15); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(16); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(17); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(18); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(19); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(20); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(21); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(22); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(23); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(24); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(25); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(26); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(27); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(28); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(29); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(30); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(31); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(32); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(33); +DECLARE_TRANSCEIVER_PRESENT_SENSOR_DEVICE_ATTR(34); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(33); +DECLARE_SFP_TRANSCEIVER_SENSOR_DEVICE_ATTR(34); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(1); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(2); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(3); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(4); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(5); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(6); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(7); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(8); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(9); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(10); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(11); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(12); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(13); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(14); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(15); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(16); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(17); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(18); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(19); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(20); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(21); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(22); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(23); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(24); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(25); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(26); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(27); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(28); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(29); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(30); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(31); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_RESET_ATTR(32); +DECLARE_CPLD_DEVICE_INTR_ATTR(1); +DECLARE_CPLD_DEVICE_INTR_ATTR(2); +DECLARE_CPLD_DEVICE_INTR_ATTR(3); +DECLARE_CPLD_DEVICE_INTR_ATTR(4); + + + +static struct attribute *as9736_64d_fpga_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_access.dev_attr.attr, + NULL +}; + +static const struct attribute_group as9736_64d_fpga_group = { + .attrs = as9736_64d_fpga_attributes, +}; + +static struct attribute *as9736_64d_cpld_cpu_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + &sensor_dev_attr_psu1_present.dev_attr.attr, /*left*/ + &sensor_dev_attr_psu2_present.dev_attr.attr, /*right*/ + &sensor_dev_attr_psu1_power_good.dev_attr.attr, /*left*/ + &sensor_dev_attr_psu2_power_good.dev_attr.attr, /*right*/ + NULL +}; + +static struct attribute *as9736_64d_cpld_pdb_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + NULL +}; + +static struct attribute *as9736_64d_cpld_scm_attributes[] = { + &sensor_dev_attr_version.dev_attr.attr, + NULL +}; + +static struct attribute *as9736_64d_cpld_udb_attributes[] = { + NULL +}; + +static const struct attribute_group as9736_64d_cpld_cpu_group = { + .attrs = as9736_64d_cpld_cpu_attributes, +}; + +static const struct attribute_group as9736_64d_cpld_pdb_group = { + .attrs = as9736_64d_cpld_pdb_attributes, +}; + +static const struct attribute_group as9736_64d_cpld_scm_group = { + .attrs = as9736_64d_cpld_scm_attributes, +}; + +static const struct attribute_group as9736_64d_cpld_udb_group = { + .attrs = as9736_64d_cpld_udb_attributes, +}; + + +static ssize_t show_interrupt(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as9736_64d_cpld_data *data = i2c_get_clientdata(client); + int status = 0; + u8 reg = 0; + + switch (attr->index) + { + case CPLD_INTR_1: + reg = 0x10; + break; + case CPLD_INTR_3: + reg = 0x10; + break; + case CPLD_INTR_2: + reg = 0x11; + break; + case CPLD_INTR_4: + reg = 0x11; + break; + default: + return -ENODEV; + } + mutex_lock(&data->update_lock); + status = as9736_64d_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + + return sprintf(buf, "0x%x\n", status); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + + +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as9736_64d_cpld_data *data = i2c_get_clientdata(client); + int status = 0; + u8 reg = 0, mask = 0, revert = 0; + + switch (attr->index) { + case PSU_RIGHT_PRESENT: + case PSU_LEFT_PRESENT: + reg = 0x14; + mask = 0x1 << attr->index; + revert = 1; + break; + case PSU_LEFT_POWER_GOOD: + case PSU_RIGHT_POWER_GOOD: + reg = 0x90; + mask = 0x1 << (attr->index - PSU_LEFT_POWER_GOOD); + break; + case MODULE_PRESENT_1 ... MODULE_PRESENT_8: + reg = 0x12; + mask = 0x1 << (attr->index - MODULE_PRESENT_1); + break; + case MODULE_PRESENT_9 ... MODULE_PRESENT_16: + reg = 0x13; + mask = 0x1 << (attr->index - MODULE_PRESENT_9); + break; + case MODULE_PRESENT_17 ... MODULE_PRESENT_24: + reg = 0x12; + mask = 0x1 << (attr->index - MODULE_PRESENT_17); + break; + case MODULE_PRESENT_25 ... MODULE_PRESENT_32: + reg = 0x13; + mask = 0x1 << (attr->index - MODULE_PRESENT_25); + break; + case MODULE_PRESENT_33: + reg = 0x20; + mask = 0x1; + break; + case MODULE_PRESENT_34: + reg = 0x20; + mask = 0x8; + break; + case MODULE_RXLOS_33: + reg = 0x20; + mask = 0x2; + break; + case MODULE_RXLOS_34: + reg = 0x20; + mask = 0x10; + break; + case MODULE_TXDISABLE_33: + reg = 0x21; + mask = 0x1; + break; + case MODULE_TXDISABLE_34: + reg = 0x21; + mask = 0x2; + break; + default: + return 0; + } + + if (attr->index >= MODULE_PRESENT_1 && attr->index <= MODULE_PRESENT_34) { + revert = 1; + } + + mutex_lock(&data->update_lock); + status = as9736_64d_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\n", revert ? !(status & mask) : !!(status & mask)); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as9736_64d_cpld_data *data = i2c_get_clientdata(client); + long disable; + int status; + u8 reg = 0, mask = 0; + + status = kstrtol(buf, 10, &disable); + if (status) { + return status; + } + + switch (attr->index) { + case MODULE_TXDISABLE_33: + reg = 0x21; + mask = 0x1; + break; + case MODULE_TXDISABLE_34: + reg = 0x21; + mask = 0x2; + break; + default: + return 0; + } + + /* Read current status */ + mutex_lock(&data->update_lock); + status = as9736_64d_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + + /* Update tx_disable status */ + if (disable) { + status |= mask; + } + else { + status &= ~mask; + } + + status = as9736_64d_cpld_write_internal(client, reg, status); + if (unlikely(status < 0)) { + goto exit; + } + + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t access(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int status; + u32 addr, val; + struct i2c_client *client = to_i2c_client(dev); + struct as9736_64d_cpld_data *data = i2c_get_clientdata(client); + + if (sscanf(buf, "0x%x 0x%x", &addr, &val) != 2) { + return -EINVAL; + } + + if (addr > 0xFF || val > 0xFF) { + return -EINVAL; + } + + mutex_lock(&data->update_lock); + status = as9736_64d_cpld_write_internal(client, addr, val); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static void as9736_64d_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", client->addr); + return; + } + + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void as9736_64d_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +static ssize_t show_version(struct device *dev, struct device_attribute *attr, char *buf) +{ + int val_major = 0, val_minor = 0; + struct i2c_client *client = to_i2c_client(dev); + + val_major = i2c_smbus_read_byte_data(client, 0x1); + val_minor = i2c_smbus_read_byte_data(client, 0x0); + + if (val_major < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x1) err %d\n", client->addr, val_major); + } + if (val_minor < 0) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x0) err %d\n", client->addr, val_minor); + } + + return sprintf(buf, "%d.%d\n", val_major, val_minor); +} + +static ssize_t get_mode_reset(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as9736_64d_cpld_data *data = i2c_get_clientdata(client); + int status = 0; + u8 reg = 0, mask = 0; + + switch (attr->index) { + case MODULE_RESET_1 ... MODULE_RESET_8: + reg = 0x14; + mask = 0x1 << (attr->index - MODULE_RESET_1); + break; + case MODULE_RESET_9 ... MODULE_RESET_16: + reg = 0x15; + mask = 0x1 << (attr->index - MODULE_RESET_9); + break; + case MODULE_RESET_17 ... MODULE_RESET_24: + reg = 0x14; + mask = 0x1 << (attr->index - MODULE_RESET_17); + break; + case MODULE_RESET_25 ... MODULE_RESET_32: + reg = 0x15; + mask = 0x1 << (attr->index - MODULE_RESET_25); + break; + default: + return 0; + } + + mutex_lock(&data->update_lock); + status = as9736_64d_cpld_read_internal(client, reg); + + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + + return sprintf(buf, "%d\r\n", !(status & mask)); + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t set_mode_reset(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct as9736_64d_cpld_data *data = i2c_get_clientdata(client); + long reset; + int status=0, val, error; + u8 reg = 0, mask = 0; + + error = kstrtol(buf, 10, &reset); + if (error) { + return error; + } + + switch (attr->index) { + case MODULE_RESET_1 ... MODULE_RESET_8: + reg = 0x14; + mask = 0x1 << (attr->index - MODULE_RESET_1); + break; + case MODULE_RESET_9 ... MODULE_RESET_16: + reg = 0x15; + mask = 0x1 << (attr->index - MODULE_RESET_9); + break; + case MODULE_RESET_17 ... MODULE_RESET_24: + reg = 0x14; + mask = 0x1 << (attr->index - MODULE_RESET_17); + break; + case MODULE_RESET_25 ... MODULE_RESET_32: + reg = 0x15; + mask = 0x1 << (attr->index - MODULE_RESET_25); + break; + default: + return 0; + } + mutex_lock(&data->update_lock); + + status = as9736_64d_cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + + /* Update lp_mode status */ + if (reset) + { + val = status&(~mask); + } + else + { + val =status | (mask); + } + + status = as9736_64d_cpld_write_internal(client, reg, val); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + + + +/* + * I2C init/probing/exit functions + */ +static int as9736_64d_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); + struct as9736_64d_cpld_data *data; + int ret = -ENODEV; + const struct attribute_group *group = NULL; + + if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE)) + goto exit; + + data = kzalloc(sizeof(struct as9736_64d_cpld_data), GFP_KERNEL); + if (!data) { + ret = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->type = id->driver_data; + + + /* Register sysfs hooks */ + switch (data->type) { + case as9736_64d_fpga: + group = &as9736_64d_fpga_group; + break; + case as9736_64d_cpld_cpu: + group = &as9736_64d_cpld_cpu_group; + break; + case as9736_64d_cpld_pdb: + group = &as9736_64d_cpld_pdb_group; + break; + case as9736_64d_cpld_scm: + group = &as9736_64d_cpld_scm_group; + break; + case as9736_64d_cpld_udb: + group = &as9736_64d_cpld_udb_group; + break; + default: + break; + } + + if (group) { + ret = sysfs_create_group(&client->dev.kobj, group); + if (ret) { + goto exit_free; + } + } + + if( data->type != as9736_64d_cpld_pdb ) { + as9736_64d_cpld_add_client(client); + } + + return 0; + +exit_free: + kfree(data); +exit: + return ret; +} + +static int as9736_64d_cpld_remove(struct i2c_client *client) +{ + struct as9736_64d_cpld_data *data = i2c_get_clientdata(client); + const struct attribute_group *group = NULL; + + as9736_64d_cpld_remove_client(client); + + /* Remove sysfs hooks */ + switch (data->type) { + case as9736_64d_fpga: + group = &as9736_64d_fpga_group; + break; + case as9736_64d_cpld_cpu: + group = &as9736_64d_cpld_cpu_group; + break; + case as9736_64d_cpld_pdb: + group = &as9736_64d_cpld_pdb_group; + break; + case as9736_64d_cpld_scm: + group = &as9736_64d_cpld_scm_group; + break; + case as9736_64d_cpld_udb: + group = &as9736_64d_cpld_udb_group; + default: + break; + } + + if (group) { + sysfs_remove_group(&client->dev.kobj, group); + } + + kfree(data); + + return 0; +} + +static int as9736_64d_cpld_read_internal(struct i2c_client *client, u8 reg) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_read_byte_data(client, reg); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + return status; +} + +static int as9736_64d_cpld_write_internal(struct i2c_client *client, u8 reg, u8 value) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_write_byte_data(client, reg, value); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + return status; +} + +int as9736_64d_cpld_read(unsigned short cpld_addr, u8 reg) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EPERM; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = as9736_64d_cpld_read_internal(cpld_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(as9736_64d_cpld_read); + +int as9736_64d_cpld_write(unsigned short cpld_addr, u8 reg, u8 value) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EIO; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = as9736_64d_cpld_write_internal(cpld_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(as9736_64d_cpld_write); + +static struct i2c_driver as9736_64d_cpld_driver = { + .driver = { + .name = "as9736_64d_cpld", + .owner = THIS_MODULE, + }, + .probe = as9736_64d_cpld_probe, + .remove = as9736_64d_cpld_remove, + .id_table = as9736_64d_cpld_id, +}; + +static int __init as9736_64d_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&as9736_64d_cpld_driver); +} + +static void __exit as9736_64d_cpld_exit(void) +{ + i2c_del_driver(&as9736_64d_cpld_driver); +} + +MODULE_AUTHOR("Jostar Yang "); +MODULE_DESCRIPTION("Accton I2C CPLD driver"); +MODULE_LICENSE("GPL"); + +module_init(as9736_64d_cpld_init); +module_exit(as9736_64d_cpld_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/modules/accton_as9736_64d_fan.c b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/modules/accton_as9736_64d_fan.c new file mode 100755 index 0000000000..1569abaefd --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/modules/accton_as9736_64d_fan.c @@ -0,0 +1,814 @@ +/* + * A hwmon driver for the Accton as9736-64d fan + * + * Copyright (C) 2014 Accton Technology Corporation. + * Michael Shih + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRVNAME "as9736_64d_fan" + +#define FAN_DUTY_CYCLE_REG_MASK 0xFF +#define FAN_MAX_DUTY_CYCLE 100 + +int fan_tach_clock[4] = {1048, /*10.48 * 100*/ + 2097, /*20.97 * 100*/ + 4194, /*41.94 * 100*/ + 8389}; /*83.89 * 100*/ + +static struct as9736_64d_fan_data *as9736_64d_fan_update_device(struct device *dev); +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t set_eeprom_protect(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t set_power_enable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t set_watch_dog(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); + +/* fan related data, the index should match sysfs_fan_attributes + */ +static const u8 fan_reg[] = { + 0x00, /* board info */ + 0x01, /* cpld major revision */ + 0x02, /* hw pcb version: R0A, R0B... */ + 0x10, /* fan 1-4 present status, bit3: port1 ~ bit0: port4*/ + 0x18, /* fan 1-4 eeprom un-protect/protect */ + 0x1a, /* fan 1-4 power enable/disable */ + 0x20, /* watchdog enable/disable */ + 0x30, /* fan 1 PWM */ + 0x31, /* fan 2 PWM */ + 0x32, /* fan 3 PWM */ + 0x33, /* fan 4 PWM */ + 0x40, /* fan 1 front tach speed(rpm) */ + 0x41, /* fan 2 front tach speed(rpm) */ + 0x42, /* fan 3 front tach speed(rpm) */ + 0x43, /* fan 4 front tach speed(rpm) */ + 0x50, /* fan 1 rear tach speed(rpm) */ + 0x51, /* fan 2 rear tach speed(rpm) */ + 0x52, /* fan 3 rear tach speed(rpm) */ + 0x53, /* fan 4 rear tach speed(rpm) */ + 0x90, /* fan tach speed setting */ +}; + +/* Each client has this additional data */ +struct as9736_64d_fan_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[ARRAY_SIZE(fan_reg)]; /* Register value */ + int system_temp; /*In unit of mini-Celsius*/ + int sensors_found; +}; + +enum fan_id { + FAN1_ID, + FAN2_ID, + FAN3_ID, + FAN4_ID, +}; + +enum sysfs_fan_attributes { + FAN_BOARD_INFO_REG, + FAN_CPLD_REVISION_REG, + FAN_HW_REVISION_REG, + FAN_PRESENT_REG, + FAN_EEPROM_PROTECT_REG, + FAN_POWER_ENABLE_REG, + FAN_WATCHDOG_REG, + FAN1_DUTY_CYCLE_PERCENTAGE, + FAN2_DUTY_CYCLE_PERCENTAGE, + FAN3_DUTY_CYCLE_PERCENTAGE, + FAN4_DUTY_CYCLE_PERCENTAGE, + FAN1_FRONT_SPEED_RPM, + FAN2_FRONT_SPEED_RPM, + FAN3_FRONT_SPEED_RPM, + FAN4_FRONT_SPEED_RPM, + FAN1_REAR_SPEED_RPM, + FAN2_REAR_SPEED_RPM, + FAN3_REAR_SPEED_RPM, + FAN4_REAR_SPEED_RPM, + FAN_TACH_SPEED_REG, + FAN1_PRESENT, + FAN2_PRESENT, + FAN3_PRESENT, + FAN4_PRESENT, + FAN1_EEPROM_PROTECT, + FAN2_EEPROM_PROTECT, + FAN3_EEPROM_PROTECT, + FAN4_EEPROM_PROTECT, + FAN1_POWER_ENABLE, + FAN2_POWER_ENABLE, + FAN3_POWER_ENABLE, + FAN4_POWER_ENABLE, + FAN_TACH_SPEED_CLOCK, + FAN_TACH_SPEED_COUNTER, + FAN1_FAULT, + FAN2_FAULT, + FAN3_FAULT, + FAN4_FAULT, + FAN_VERSION +}; + +/*********************************************************************** + * Define attributes + ***********************************************************************/ +/*fan present*/ +#define DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_present, S_IRUGO, fan_show_value, NULL, FAN##index##_PRESENT) +#define DECLARE_FAN_PRESENT_ATTR(index) &sensor_dev_attr_fan##index##_present.dev_attr.attr + +/*eeprom protect*/ +#define DECLARE_FAN_EEPROM_PROTECT_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_eeprom, S_IWUSR | S_IRUGO, fan_show_value, set_eeprom_protect, FAN##index##_EEPROM_PROTECT) +#define DECLARE_FAN_EEPROM_PROTECT_ATTR(index) &sensor_dev_attr_fan##index##_eeprom.dev_attr.attr + +/*power enable*/ +#define DECLARE_FAN_POWER_ENABLE_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_power, S_IWUSR | S_IRUGO, fan_show_value, set_power_enable, FAN##index##_POWER_ENABLE) +#define DECLARE_FAN_POWER_ENABLE_ATTR(index) &sensor_dev_attr_fan##index##_power.dev_attr.attr + +/*fan duty cycle percentage*/ +#define DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_duty_cycle_percentage, S_IWUSR | S_IRUGO, fan_show_value, set_duty_cycle, FAN##index##_DUTY_CYCLE_PERCENTAGE) +#define DECLARE_FAN_DUTY_CYCLE_ATTR(index) &sensor_dev_attr_fan##index##_duty_cycle_percentage.dev_attr.attr + +/*fan speed(RPM)*/ +#define DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(index, index2) \ + static SENSOR_DEVICE_ATTR(fan##index##_front_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_FRONT_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index##_rear_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_REAR_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index##_input, S_IRUGO, fan_show_value, NULL, FAN##index##_FRONT_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index2##_input, S_IRUGO, fan_show_value, NULL, FAN##index##_REAR_SPEED_RPM) +#define DECLARE_FAN_SPEED_RPM_ATTR(index, index2) &sensor_dev_attr_fan##index##_front_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_rear_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_input.dev_attr.attr, \ + &sensor_dev_attr_fan##index2##_input.dev_attr.attr + +/*fan fault*/ +#define DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_fault, S_IRUGO, fan_show_value, NULL, FAN##index##_FAULT) +#define DECLARE_FAN_FAULT_ATTR(index) &sensor_dev_attr_fan##index##_fault.dev_attr.attr + +/*********************************************************************** + * Extend attributes + ***********************************************************************/ +static SENSOR_DEVICE_ATTR(version, S_IRUGO, fan_show_value, NULL, FAN_VERSION); +static SENSOR_DEVICE_ATTR(board_info, S_IRUGO, fan_show_value, NULL, FAN_BOARD_INFO_REG); +static SENSOR_DEVICE_ATTR(cpld_ver, S_IRUGO, fan_show_value, NULL, FAN_CPLD_REVISION_REG); +static SENSOR_DEVICE_ATTR(hw_ver, S_IRUGO, fan_show_value, NULL, FAN_HW_REVISION_REG); +static SENSOR_DEVICE_ATTR(watch_dog, S_IWUSR | S_IRUGO, fan_show_value, set_watch_dog, FAN_WATCHDOG_REG); +static SENSOR_DEVICE_ATTR(fan_tach_speed_clk, S_IRUGO, fan_show_value, NULL, FAN_TACH_SPEED_CLOCK); +static SENSOR_DEVICE_ATTR(fan_tach_speed_cnt, S_IRUGO, fan_show_value, NULL, FAN_TACH_SPEED_COUNTER); +/* 4 fan present attributes in this platform */ +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(1); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(2); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(3); +DECLARE_FAN_PRESENT_SENSOR_DEV_ATTR(4); +/* 4 fan eeprom protect attributes in this platform */ +DECLARE_FAN_EEPROM_PROTECT_SENSOR_DEV_ATTR(1); +DECLARE_FAN_EEPROM_PROTECT_SENSOR_DEV_ATTR(2); +DECLARE_FAN_EEPROM_PROTECT_SENSOR_DEV_ATTR(3); +DECLARE_FAN_EEPROM_PROTECT_SENSOR_DEV_ATTR(4); +/* 4 fan power enable attributes in this platform */ +DECLARE_FAN_POWER_ENABLE_SENSOR_DEV_ATTR(1); +DECLARE_FAN_POWER_ENABLE_SENSOR_DEV_ATTR(2); +DECLARE_FAN_POWER_ENABLE_SENSOR_DEV_ATTR(3); +DECLARE_FAN_POWER_ENABLE_SENSOR_DEV_ATTR(4); +/* 4 fan duty cycle percentage attribute in this platform */ +DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(1); +DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(2); +DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(3); +DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(4); +/* 4 fan speed(rpm) attributes in this platform */ +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(1,11); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(2,12); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(3,13); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(4,14); +/* 4 fan fault attributes in this platform */ +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(1); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(2); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(3); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(4); + +/*********************************************************************** + * Define sysfs + ***********************************************************************/ +static struct attribute *as9736_64d_fan_attributes[] = { + /* fan related attributes */ + &sensor_dev_attr_board_info.dev_attr.attr, + &sensor_dev_attr_cpld_ver.dev_attr.attr, + &sensor_dev_attr_hw_ver.dev_attr.attr, + &sensor_dev_attr_watch_dog.dev_attr.attr, + &sensor_dev_attr_fan_tach_speed_clk.dev_attr.attr, + &sensor_dev_attr_fan_tach_speed_cnt.dev_attr.attr, + DECLARE_FAN_PRESENT_ATTR(1), + DECLARE_FAN_PRESENT_ATTR(2), + DECLARE_FAN_PRESENT_ATTR(3), + DECLARE_FAN_PRESENT_ATTR(4), + DECLARE_FAN_EEPROM_PROTECT_ATTR(1), + DECLARE_FAN_EEPROM_PROTECT_ATTR(2), + DECLARE_FAN_EEPROM_PROTECT_ATTR(3), + DECLARE_FAN_EEPROM_PROTECT_ATTR(4), + DECLARE_FAN_POWER_ENABLE_ATTR(1), + DECLARE_FAN_POWER_ENABLE_ATTR(2), + DECLARE_FAN_POWER_ENABLE_ATTR(3), + DECLARE_FAN_POWER_ENABLE_ATTR(4), + DECLARE_FAN_DUTY_CYCLE_ATTR(1), + DECLARE_FAN_DUTY_CYCLE_ATTR(2), + DECLARE_FAN_DUTY_CYCLE_ATTR(3), + DECLARE_FAN_DUTY_CYCLE_ATTR(4), + DECLARE_FAN_SPEED_RPM_ATTR(1,11), + DECLARE_FAN_SPEED_RPM_ATTR(2,12), + DECLARE_FAN_SPEED_RPM_ATTR(3,13), + DECLARE_FAN_SPEED_RPM_ATTR(4,14), + DECLARE_FAN_FAULT_ATTR(1), + DECLARE_FAN_FAULT_ATTR(2), + DECLARE_FAN_FAULT_ATTR(3), + DECLARE_FAN_FAULT_ATTR(4), + &sensor_dev_attr_version.dev_attr.attr, + NULL +}; + + +static int as9736_64d_fan_read_value(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int as9736_64d_fan_write_value(struct i2c_client *client, u8 reg, u8 value) +{ + return i2c_smbus_write_byte_data(client, reg, value); +} + +/* fan utility functions + */ +static u32 reg_val_to_duty_cycle(u8 reg_val) +{ + reg_val &= FAN_DUTY_CYCLE_REG_MASK; + u32 duty_cycle = 0; + + switch(reg_val) + { + case 0: + duty_cycle = 0; + break; + case 13: /*0xC*/ + duty_cycle = 5; + break; + case 26: /*0x19*/ + duty_cycle = 10; + break; + case 38: /*0x26*/ + duty_cycle = 15; + break; + case 51: /*0x33*/ + duty_cycle = 20; + break; + case 64: /*0x3F*/ + duty_cycle = 25; + break; + case 76: /*0x4C*/ + duty_cycle = 30; + break; + case 89: /*0x59*/ + duty_cycle = 35; + break; + case 102: /*0x66*/ + duty_cycle = 40; + break; + case 115: /*0x72*/ + duty_cycle = 45; + break; + case 127: /*0x7F*/ + duty_cycle = 50; + break; + case 140: /*0x8C*/ + duty_cycle = 55; + break; + case 153: /*0x99*/ + duty_cycle = 60; + break; + case 166: /*0xA5*/ + duty_cycle = 65; + break; + case 179: /*0xB3*/ + duty_cycle = 70; + break; + case 191: /*0xBF*/ + duty_cycle = 75; + break; + case 204: /*0xCC*/ + duty_cycle = 80; + break; + case 217: /*0xD8*/ + duty_cycle = 85; + break; + case 239: /*0xEF*/ + duty_cycle = 90; + break; + case 242: /*0xF2*/ + duty_cycle = 95; + break; + default: /*0xFF*/ + duty_cycle = 100; + break; + } + + return duty_cycle; +} + +static u32 reg_val_to_speed_rpm(u8 reg_val, u8 tach_speed) +{ + int fan_tach_clk_index = (tach_speed >> 6) & 0x3; + int fan_tach_cnt = tach_speed & 0x3F; + /* + Coculation formula = reg_val/(fan_clk*can_cnt)*1000/2*60 = [(reg_val)*30000] / fan_clk*can_cnt + */ + return (u32)( (reg_val * 30000 * 100) / (fan_tach_clock[fan_tach_clk_index] * fan_tach_cnt) ); +} + +static u8 reg_val_to_is_present(u8 reg_val, enum fan_id id) +{ + u8 mask = (1 << (id) ); + + reg_val &= mask; /*reg: 0 is present, 1 is not present*/ + + return reg_val ? 0 : 1; /*turn to : 0 is not present, 1 is present*/ +} + +static u8 is_fan_fault(struct as9736_64d_fan_data *data, enum fan_id id) +{ + u8 ret = 1; + int front_fan_index = id + 11; /*fan1=11, fan2=12, fan3=13, fan4=14*/ + int rear_fan_index = front_fan_index + 4; /*fan1=15, fan2=16, fan3=17, fan4=18*/ + + /* Check if the speed of front or rear fan is ZERO, + */ + if (reg_val_to_speed_rpm(data->reg_val[front_fan_index], data->reg_val[FAN_TACH_SPEED_REG]) && + reg_val_to_speed_rpm(data->reg_val[rear_fan_index], data->reg_val[FAN_TACH_SPEED_REG]) ) { + ret = 0; + } + + return ret; +} + +static u8 reg_val_to_is_eeprom_protect(u8 reg_val, enum fan_id id) +{ + u8 mask = 0x1; + reg_val = reg_val >> (id); + reg_val &= mask; /*reg: 0 is unprotect, 1 is protect*/ + + return reg_val; +} + +static u8 reg_val_to_is_power_enable(u8 reg_val, enum fan_id id) +{ + u8 mask = (1 << (3 - id) ); + + reg_val &= mask; /*reg: 0 is enable, 1 is disable*/ + + return reg_val ? 0 : 1; /*turn to : 0 is disable, 1 is enable*/ +} + +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int error, value; + struct i2c_client *client = to_i2c_client(dev); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + u8 duty_cycle = 0; + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < 0 || value > FAN_MAX_DUTY_CYCLE) + return -EINVAL; + + switch(value) + { + case 0: + duty_cycle = 0; + break; + case 1 ... 5: + duty_cycle = 13; + break; + case 6 ... 10: + duty_cycle = 26; + break; + case 11 ... 15: + duty_cycle = 38; + break; + case 16 ... 20: + duty_cycle = 51; + break; + case 21 ... 25: + duty_cycle = 64; + break; + case 26 ... 30: + duty_cycle = 76; + break; + case 31 ... 35: + duty_cycle = 89; + break; + case 36 ... 40: + duty_cycle = 102; + break; + case 41 ... 45: + duty_cycle = 115; + break; + case 46 ... 50: + duty_cycle = 127; + break; + case 51 ... 55: + duty_cycle = 140; + break; + case 56 ... 60: + duty_cycle = 153; + break; + case 61 ... 65: + duty_cycle = 166; + break; + case 66 ... 70: + duty_cycle = 179; + break; + case 71 ... 75: + duty_cycle = 191; + break; + case 76 ... 80: + duty_cycle = 204; + break; + case 81 ... 85: + duty_cycle = 217; + break; + case 86 ... 90: + duty_cycle = 239; + break; + case 91 ... 95: + duty_cycle = 242; + break; + default: + duty_cycle = 255; + break; + } + + switch (attr->index) { + case FAN1_DUTY_CYCLE_PERCENTAGE: + as9736_64d_fan_write_value(client, fan_reg[FAN1_DUTY_CYCLE_PERCENTAGE], duty_cycle); + break; + case FAN2_DUTY_CYCLE_PERCENTAGE: + as9736_64d_fan_write_value(client, fan_reg[FAN2_DUTY_CYCLE_PERCENTAGE], duty_cycle); + break; + case FAN3_DUTY_CYCLE_PERCENTAGE: + as9736_64d_fan_write_value(client, fan_reg[FAN3_DUTY_CYCLE_PERCENTAGE], duty_cycle); + break; + default: + as9736_64d_fan_write_value(client, fan_reg[FAN4_DUTY_CYCLE_PERCENTAGE], duty_cycle); + break; + } + + return count; +} + +static u8 set_reg_bit(u8 reg_val, u8 number_bit, u8 value) +{ + int chk_bit, i; + u8 high_bytes, lower_bytes; + u8 mask = 0x0; + chk_bit = (reg_val >> number_bit) & 0x1; + + if( chk_bit==value ) { + return reg_val; + } else { + for( i = 1 ; i <= number_bit ; i++ ) { + mask |= 1 << (i-1); + } + lower_bytes = reg_val & mask; + high_bytes = reg_val & ( (~mask << 1) ); + + return (u8)( high_bytes | (value << number_bit) | lower_bytes ); + } +} + +static ssize_t set_eeprom_protect(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int reg_val, port_bit; + int error, value; + struct i2c_client *client = to_i2c_client(dev); + struct as9736_64d_fan_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < 0 || value > 1) + return -EINVAL; + + reg_val = as9736_64d_fan_read_value(client, fan_reg[FAN_EEPROM_PROTECT_REG]); + port_bit = (3 - (attr->index - FAN1_EEPROM_PROTECT) ); + + mutex_lock(&data->update_lock); + as9736_64d_fan_write_value(client, fan_reg[FAN_EEPROM_PROTECT_REG], set_reg_bit(reg_val, port_bit, value)); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t set_power_enable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int reg_val, port_bit; + int error, value; + struct i2c_client *client = to_i2c_client(dev); + struct as9736_64d_fan_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < 0 || value > 1) + return -EINVAL; + + reg_val = as9736_64d_fan_read_value(client, fan_reg[FAN_POWER_ENABLE_REG]); + port_bit = (3 - (attr->index - FAN1_POWER_ENABLE) ); + + mutex_lock(&data->update_lock); + as9736_64d_fan_write_value(client, fan_reg[FAN_POWER_ENABLE_REG], set_reg_bit(reg_val, port_bit, value ? 0 : 1)); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t set_watch_dog(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int error, value; + struct i2c_client *client = to_i2c_client(dev); + struct as9736_64d_fan_data *data = i2c_get_clientdata(client); + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value < 0 || value > 1) + return -EINVAL; + + mutex_lock(&data->update_lock); + as9736_64d_fan_write_value(client, fan_reg[FAN_WATCHDOG_REG], value); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as9736_64d_fan_data *data = as9736_64d_fan_update_device(dev); + ssize_t ret = 0; + u32 duty_cycle = 0; + + if (data->valid) { + switch (attr->index) { + case FAN_VERSION: + ret = sprintf(buf, "%d.%d\n", (data->reg_val[FAN_CPLD_REVISION_REG]) & 0x7F, (data->reg_val[FAN_BOARD_INFO_REG]) & 0xFF); + break; + case FAN_BOARD_INFO_REG: + ret = sprintf(buf, "0x%x\n", (data->reg_val[FAN_BOARD_INFO_REG]) & 0xF); + break; + case FAN_CPLD_REVISION_REG: + ret = sprintf(buf, "0x%x\n", (data->reg_val[FAN_CPLD_REVISION_REG]) & 0xF); + break; + case FAN_HW_REVISION_REG: + ret = sprintf(buf, "0x%x\n", (data->reg_val[FAN_HW_REVISION_REG]) & 0xFF); + break; + case FAN1_PRESENT: + case FAN2_PRESENT: + case FAN3_PRESENT: + case FAN4_PRESENT: + ret = sprintf(buf, "%d\n", reg_val_to_is_present(data->reg_val[FAN_PRESENT_REG], + attr->index - FAN1_PRESENT) ); + break; + case FAN1_EEPROM_PROTECT: + case FAN2_EEPROM_PROTECT: + case FAN3_EEPROM_PROTECT: + case FAN4_EEPROM_PROTECT: + ret = sprintf(buf, "%d\n", reg_val_to_is_eeprom_protect(data->reg_val[FAN_EEPROM_PROTECT_REG], + attr->index - FAN1_EEPROM_PROTECT) ); + break; + case FAN1_POWER_ENABLE: + case FAN2_POWER_ENABLE: + case FAN3_POWER_ENABLE: + case FAN4_POWER_ENABLE: + ret = sprintf(buf, "%d\n", + reg_val_to_is_power_enable(data->reg_val[FAN_POWER_ENABLE_REG], + attr->index - FAN1_POWER_ENABLE) ); + break; + case FAN_WATCHDOG_REG: + ret = sprintf(buf, "%x\n", (data->reg_val[FAN_WATCHDOG_REG]) & 0x1); + break; + case FAN1_DUTY_CYCLE_PERCENTAGE: + duty_cycle = reg_val_to_duty_cycle(data->reg_val[FAN1_DUTY_CYCLE_PERCENTAGE]); + ret = sprintf(buf, "%u\n", duty_cycle); + break; + case FAN2_DUTY_CYCLE_PERCENTAGE: + duty_cycle = reg_val_to_duty_cycle(data->reg_val[FAN2_DUTY_CYCLE_PERCENTAGE]); + ret = sprintf(buf, "%u\n", duty_cycle); + break; + case FAN3_DUTY_CYCLE_PERCENTAGE: + duty_cycle = reg_val_to_duty_cycle(data->reg_val[FAN3_DUTY_CYCLE_PERCENTAGE]); + ret = sprintf(buf, "%u\n", duty_cycle); + break; + case FAN4_DUTY_CYCLE_PERCENTAGE: + { + duty_cycle = reg_val_to_duty_cycle(data->reg_val[FAN4_DUTY_CYCLE_PERCENTAGE]); + ret = sprintf(buf, "%u\n", duty_cycle); + break; + } + case FAN1_FRONT_SPEED_RPM: + case FAN2_FRONT_SPEED_RPM: + case FAN3_FRONT_SPEED_RPM: + case FAN4_FRONT_SPEED_RPM: + case FAN1_REAR_SPEED_RPM: + case FAN2_REAR_SPEED_RPM: + case FAN3_REAR_SPEED_RPM: + case FAN4_REAR_SPEED_RPM: + ret = sprintf(buf, "%u\n", reg_val_to_speed_rpm(data->reg_val[attr->index], data->reg_val[FAN_TACH_SPEED_REG])); + break; + case FAN_TACH_SPEED_CLOCK: + ret = sprintf(buf, "%d\n", ((data->reg_val[FAN_TACH_SPEED_REG]) >> 6) & 0x3); /*reg: 0x90, upper 2 bits*/ + break; + case FAN_TACH_SPEED_COUNTER: + ret = sprintf(buf, "%d\n", (data->reg_val[FAN_TACH_SPEED_REG]) & 0x3F); /*reg: 0x90, lower 6 bits*/ + break; + case FAN1_FAULT: + case FAN2_FAULT: + case FAN3_FAULT: + case FAN4_FAULT: + ret = sprintf(buf, "%d\n", is_fan_fault(data, attr->index - FAN1_FAULT)); + break; + default: + break; + } + } + + return ret; +} + +static const struct attribute_group as9736_64d_fan_group = { + .attrs = as9736_64d_fan_attributes, +}; + +static struct as9736_64d_fan_data *as9736_64d_fan_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as9736_64d_fan_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || + !data->valid) { + int i; + + dev_dbg(&client->dev, "Starting as9736_64d_fan update\n"); + data->valid = 0; + + /* Update fan data + */ + for (i = 0; i < ARRAY_SIZE(data->reg_val); i++) { + int status = as9736_64d_fan_read_value(client, fan_reg[i]); + if (status < 0) { + data->valid = 0; + mutex_unlock(&data->update_lock); + dev_dbg(&client->dev, "reg %d, err %d\n", fan_reg[i], status); + return data; + } + else { + data->reg_val[i] = status; + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +static int as9736_64d_fan_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as9736_64d_fan_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as9736_64d_fan_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as9736_64d_fan_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: fan '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as9736_64d_fan_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as9736_64d_fan_remove(struct i2c_client *client) +{ + struct as9736_64d_fan_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as9736_64d_fan_group); + + return 0; +} + +/* Addresses to scan */ +static const unsigned short normal_i2c[] = { 0x66, I2C_CLIENT_END }; + +static const struct i2c_device_id as9736_64d_fan_id[] = { + { "as9736_64d_fan", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as9736_64d_fan_id); + +static struct i2c_driver as9736_64d_fan_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = DRVNAME, + }, + .probe = as9736_64d_fan_probe, + .remove = as9736_64d_fan_remove, + .id_table = as9736_64d_fan_id, + .address_list = normal_i2c, +}; + +module_i2c_driver(as9736_64d_fan_driver); + +MODULE_AUTHOR("Michael Shih "); +MODULE_DESCRIPTION("as9736_64d_fan driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/modules/accton_as9736_64d_fpga.c b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/modules/accton_as9736_64d_fpga.c new file mode 100755 index 0000000000..15c4bb2f97 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/modules/accton_as9736_64d_fpga.c @@ -0,0 +1,2602 @@ +/* + * Copyright (C) Michael Shih + * + * This module supports the accton fpga via pcie that read/write reg + * mechanism to get QSFP/SFP status, eeprom info...etc. + * This includes the: + * Accton as9736_64d UDB/LDB + * + * Based on: + * optoe.c fromDON BOLLINGER + * Copyright (C) 2017 Finisar Corp. + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#define __STDC_WANT_LIB_EXT1__ 1 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/*********************************************** + * variable define + * *********************************************/ +#define DRVNAME "as9736_64d_fpga" +/* + * PCIE BAR0 address of UDB and LDB + */ +#define BAR0_NUM 0 +#define PCI_VENDOR_ID_ACCTON 0x1113 +#define PCI_DEVICE_ID_ACCTON 0x8664 +#define PCI_SUBSYSTEM_ID_UDB 0x0000 +#define PCI_SUBSYSTEM_ID_LDB 0x0001 +#define PCI_SUBSYSTEM_ID_SMB 0x0002 + +#define QSFP_PRESENT_REG_OFFSET 0x1500 +#define QSFP_LPMODE_REG_OFFSET 0x1550 +#define QSFP_RESET_REG_OFFSET 0x1560 + +#define SFP_LDB_GPIO1_DATA_EN 0x1000 +#define SFP_LDB_GPIO1_DATA_OUT 0x1004 +#define SFP_LDB_GPIO1_DATA_IN 0x1008 + +#define ASLPC_DEV_UDB_CPLD1_PCIE_START_OFFST 0x400 +#define ASLPC_DEV_UDB_CPLD2_PCIE_START_OFFST 0x500 +#define ASLPC_DEV_LDB_CPLD1_PCIE_START_OFFST 0x400 +#define ASLPC_DEV_LDB_CPLD2_PCIE_START_OFFST 0x500 +#define ASLPC_DEV_SMB_CPLD_PCIE_START_OFFST 0x200 + +#define REG_SET_ALL_32_BITS 0xFF +#define REG_SET_32_BITS_TO_0 0x00000000 +#define REG_SET_32_BITS_TO_1 0xFFFFFFFF +#define BIT(x) x +#define SFP_PORT0_TXDIS(x) ((x) >> (11)) +#define SFP_PORT0_ABS(x) ((x) >> (10)) +#define SFP_PORT0_TXFLT(x) ((x) >> (9)) +#define SFP_PORT0_RXLOS(x) ((x) >> (8)) +#define SFP_PORT1_TXDIS(x) ((x) >> (3)) +#define SFP_PORT1_ABS(x) ((x) >> (2)) +#define SFP_PORT1_TXFLT(x) ((x) >> (1)) +#define SFP_PORT1_RXLOS(x) ((x) >> (0)) + +#define QSFP_NUM_OF_PORT 64 +#define SFP_NUM_OF_PORT 2 +#define FPGA_NUM 3 + +#define TRANSCEIVER_PRESENT_ATTR_ID(index) MODULE_PRESENT_##index +#define TRANSCEIVER_LPMODE_ATTR_ID(index) MODULE_LPMODE_##index +#define TRANSCEIVER_RESET_ATTR_ID(index) MODULE_RESET_##index +#define TRANSCEIVER_TX_DISABLE_ATTR_ID(index) MODULE_TX_DISABLE_##index +#define TRANSCEIVER_TX_FAULT_ATTR_ID(index) MODULE_TX_FAULT_##index +#define TRANSCEIVER_RX_LOS_ATTR_ID(index) MODULE_RX_LOS_##index + +/* + *PCIE port dev define + */ +#define EEPROM_SYSFS_NAME "eeprom" + +#define FPGA_UDB_QSFP_PORT_NUM 32 +#define FPGA_LDB_QSFP_PORT_NUM 32 +#define FPGA_QSFP_PORT_NUM (FPGA_UDB_QSFP_PORT_NUM + FPGA_LDB_QSFP_PORT_NUM) +#define FPGA_LDB_SFP_PORT1_NO 65 +#define FPGA_LDB_SFP_PORT2_NO 66 +#define FPGA_LDB_SFP_PORT_NUM 2 + +#define QSFPDD_TYPE 0x18 +/* fundamental unit of addressing for EEPROM */ +#define OPTOE_PAGE_SIZE 128 +/* + * Single address devices (eg QSFP, CMIS) have 256 pages, plus the unpaged + * low 128 bytes. If the device does not support paging, it is + * only 2 'pages' long. + */ +#define OPTOE_ARCH_PAGES 256 +#define ONE_ADDR_EEPROM_SIZE ((1 + OPTOE_ARCH_PAGES) * OPTOE_PAGE_SIZE) +#define ONE_ADDR_EEPROM_UNPAGED_SIZE (2 * OPTOE_PAGE_SIZE) +/* + * Dual address devices (eg SFP) have 256 pages, plus the unpaged + * low 128 bytes, plus 256 bytes at 0x50. If the device does not + * support paging, it is 4 'pages' long. + */ +#define TWO_ADDR_EEPROM_SIZE ((3 + OPTOE_ARCH_PAGES) * OPTOE_PAGE_SIZE) +#define TWO_ADDR_EEPROM_UNPAGED_SIZE (4 * OPTOE_PAGE_SIZE) +#define TWO_ADDR_NO_0X51_SIZE (2 * OPTOE_PAGE_SIZE) + +/* a few constants to find our way around the EEPROM */ +#define OPTOE_PAGE_SELECT_REG 0x7F +#define ONE_ADDR_PAGEABLE_REG 0x02 +#define QSFP_NOT_PAGEABLE (1<<2) +#define CMIS_NOT_PAGEABLE (1<<7) +#define TWO_ADDR_PAGEABLE_REG 0x40 +#define TWO_ADDR_PAGEABLE (1<<4) +#define TWO_ADDR_0X51_REG 92 +#define TWO_ADDR_0X51_SUPP (1<<6) +#define OPTOE_READ_OP 0 +#define OPTOE_WRITE_OP 1 +#define OPTOE_EOF 0 /* used for access beyond end of device */ +#define TWO_ADDR_0X51 0x51 +#define EEPROM_ALLOW_SET_LEN 1 + +/* + * flags to distinguish one-address (QSFP family) from two-address (SFP family) + * and one-address Common Management Interface Specification (CMIS family) + */ +#define ONE_ADDR 1 +#define TWO_ADDR 2 +#define CMIS_ADDR 3 + +/* I2C Controller Management Registers */ +#define PCIE_FPGA_I2C_MGMT_RTC0_PROFILE_0 0x2008 + +/* I2C Real Time Control Registers */ +#define PCIE_FPGA_I2C_CONTROL_RTC0_CONFIG_0 0x2050 +#define PCIE_FPGA_I2C_CONTROL_RTC0_CONFIG_1 0x2054 +#define PCIE_FPGA_I2C_CONTROL_RTC0_STATUS_0 0x2060 + #define RTC0_STATUS_0_DONE 0x1 + #define RTC0_STATUS_0_ERROR 0x2 + #define RTC0_STATUS_0_BUSY 0x4 + +/* I2C RTC Data Block */ +#define PCIE_FPGA_I2C_RTC_WRITE_DATA_REG_0 0x5000 +#define PCIE_FPGA_I2C_RTC_READ_DATA_REG_0 0xA000 + +#define PCIE_FPGA_I2C_MAX_LEN 128 +#define PCIE_FPGA_I2C_NEW_TRIGGER_VALUE 0x80000000 + +/* Show system date time */ +#define DATETIME_LEN 50 +char g_datetime[DATETIME_LEN]; + +/* System LED: */ +#define UDB_CPLD2_SYSTEM_LED_OFFSET_CTRL_REG_1 0x10 +#define UDB_CPLD2_SYSTEM_LED_OFFSET_CTRL_REG_2 0x11 + +#define LED_TYPE_LOC_REG_MASK (0xC0) +#define LED_MODE_LOC_OFF_VALUE (0x00) +#define LED_MODE_LOC_BLUE_VALUE (0x80) +#define LED_MODE_LOC_BLUE_BLINK_VALUE (0x40) + +#define LED_TYPE_STAT_REG_MASK (0x0F) +#define LED_MODE_STAT_GREEN_VALUE (0x08) +#define LED_MODE_STAT_BLUE_VALUE (0x04) +#define LED_MODE_STAT_GREEN_BLINK_VALUE (0x02) +#define LED_MODE_STAT_AMBER_VALUE (0x01) +#define LED_MODE_STAT_OFF_VALUE (0x00) + +/* + * Ref optoe.c: + * specs often allow 5 msec for a page write, sometimes 20 msec; + * it's important to recover from write timeouts. + */ +static unsigned int write_timeout = 25; + +/*********************************************** + * structure & variable declare + * *********************************************/ +static char FPGA_NAME[FPGA_NUM][10] = {"UDB FPGA", "LDB FPGA", "SMB FPGA"}; + +typedef struct pci_fpga_device_s { + struct pci_dev *fpga_pdev; + void __iomem *data_base_addr; + resource_size_t data_mmio_start; + resource_size_t data_mmio_len; + u16 id; + u32 qsfp_present; + u32 qsfp_lpmode; + u32 qsfp_reset; + u32 sfp_input_data; + u32 sfp_output_data; + u16 aslpc_cpld1_offset; + u16 aslpc_cpld2_offset; +} pci_fpga_device_t; + +/*fpga port status*/ +struct as9736_64d_fpga_data { + struct platform_device *pdev; + struct pci_dev *pci_dev_addr[FPGA_NUM]; /*UDB, LDB and SMB*/ + pci_fpga_device_t pci_fpga_dev[FPGA_NUM]; /*UDB, LDB and SMB*/ + u32 udb_version; + u32 ldb_version; + u32 smb_version; + unsigned long last_updated; /* In jiffies */ +}; + +static struct as9736_64d_fpga_data *fpga_ctl = NULL; + +struct mutex update_lock; /*use for lock get/set port status via fpga register*/ +struct mutex xcvr_eeprom_lock[66]; /*use for lock read/write per port eeprom via fpga register*/ + +struct eeprom_bin_private_data { + int port_num; + int fpga_type; + int pageable; + int sfp_support_a2; + int i2c_slave_addr; + int i2c_mgmt_rtc0_profile; + int i2c_contrl_rtc0_config_0; + int i2c_contrl_rtc0_config_1; + int i2c_contrl_rtc0_stats; + int i2c_rtc_read_data; + int i2c_rtc_write_data; + void __iomem *data_base_addr; +}; + +struct pcie_fpga_dev_platform_data { + int port_num; + char name[10]; /*ex: port1*/ + char dev_name[10]; /*ex: optoe1*/ + int dev_class; + int fpga_type; + struct bin_attribute eeprom_bin; +}; + +/*********************************************** + * macro define + * *********************************************/ +#define pcie_err(fmt, args...) \ + printk(KERN_ERR "[accton_pcie_fpga_driver]: " fmt " ", ##args) + +#define pcie_info(fmt, args...) \ + printk(KERN_INFO "[accton_pcie_fpga_driver]: " fmt " ", ##args) + +/* UDB */ + /*c from 0 to 31*/ +#define pcie_udb_qsfp_device_port(c){ \ + .name = "pcie_udb_fpga_device", \ + .id = c, \ + .dev = { \ + .platform_data = &pcie_udb_dev_platform_data[c], \ + .release = device_release, \ + }, \ +} + /*c from 1*/ +#define pcie_udb_qsfp_platform_data_init(c){ \ + .port_num = c, \ + .dev_name = "optoe1", \ + .dev_class = 1, \ + .fpga_type = PCIE_FPGA_TYPE_UDB, \ + .eeprom_bin = { \ + .private = &pcie_udb_eeprom_bin_private_data[c-1], \ + }, \ +} + /*c from 1*/ +#define eeprom_udb_private_data_port_init(c){ \ + .port_num = c, \ + .fpga_type = PCIE_FPGA_TYPE_UDB, \ + .i2c_slave_addr = 0x50, \ + .i2c_mgmt_rtc0_profile = PCIE_FPGA_I2C_MGMT_RTC0_PROFILE_0 + 0x100*(c-1), \ + .i2c_contrl_rtc0_config_0 = PCIE_FPGA_I2C_CONTROL_RTC0_CONFIG_0 + 0x100*(c-1), \ + .i2c_contrl_rtc0_config_1 = PCIE_FPGA_I2C_CONTROL_RTC0_CONFIG_1 + 0x100*(c-1), \ + .i2c_contrl_rtc0_stats = PCIE_FPGA_I2C_CONTROL_RTC0_STATUS_0 + 0x100*(c-1), \ + .i2c_rtc_read_data = PCIE_FPGA_I2C_RTC_READ_DATA_REG_0 + 0x200*(c-1), \ + .i2c_rtc_write_data = PCIE_FPGA_I2C_RTC_WRITE_DATA_REG_0 + 0x200*(c-1), \ +} + +/* LDB */ + /*c from 0 to 31*/ +#define pcie_ldb_qsfp_device_port(c){ \ + .name = "pcie_ldb_fpga_device", \ + .id = c, \ + .dev = { \ + .platform_data = &pcie_ldb_dev_platform_data[c], \ + .release = device_release, \ + }, \ +} + /*c from 32 to 33*/ +#define pcie_ldb_sfp_device_port(c){ \ + .name = "pcie_ldb_fpga_device", \ + .id = c, \ + .dev = { \ + .platform_data = &pcie_ldb_dev_platform_data[c], \ + .release = device_release, \ + }, \ +} + +/*c from 1 to 32*/ +#define pcie_ldb_qsfp_platform_data_init(c){ \ + .port_num = c, \ + .dev_name = "optoe1", \ + .dev_class = 1, \ + .fpga_type = PCIE_FPGA_TYPE_LDB, \ + .eeprom_bin = { \ + .private = &pcie_ldb_eeprom_bin_private_data[c-1], \ + }, \ +} +/*c = 33, 34*/ +#define pcie_ldb_sfp_platform_data_init(c){ \ + .port_num = c, \ + .dev_name = "optoe2", \ + .dev_class = 2, \ + .fpga_type = PCIE_FPGA_TYPE_LDB, \ + .eeprom_bin = { \ + .private = &pcie_ldb_eeprom_bin_private_data[c-1], \ + }, \ +} +/*c from 1 to 32, 33, 34*/ +#define eeprom_ldb_private_data_port_init(c){ \ + .port_num = c + 32, \ + .fpga_type = PCIE_FPGA_TYPE_LDB, \ + .i2c_slave_addr = 0x50, \ + .i2c_mgmt_rtc0_profile = PCIE_FPGA_I2C_MGMT_RTC0_PROFILE_0 + 0x100*(c-1), \ + .i2c_contrl_rtc0_config_0 = PCIE_FPGA_I2C_CONTROL_RTC0_CONFIG_0 + 0x100*(c-1), \ + .i2c_contrl_rtc0_config_1 = PCIE_FPGA_I2C_CONTROL_RTC0_CONFIG_1 + 0x100*(c-1), \ + .i2c_contrl_rtc0_stats = PCIE_FPGA_I2C_CONTROL_RTC0_STATUS_0 + 0x100*(c-1), \ + .i2c_rtc_read_data = PCIE_FPGA_I2C_RTC_READ_DATA_REG_0 + 0x200*(c-1), \ + .i2c_rtc_write_data = PCIE_FPGA_I2C_RTC_WRITE_DATA_REG_0 + 0x200*(c-1), \ +} + +/*********************************************** + * enum define + * *********************************************/ +enum fpga_type_t { + PCIE_FPGA_UDB = 0, + PCIE_FPGA_LDB, + PCIE_FPGA_SMB +}; + +enum fpga_set_function_type_t { + PCIE_FPGA_SET_LPMODE, + PCIE_FPGA_SET_RESET, + PCIE_FPGA_SET_TX_DISABLE +}; + +enum fpga_sysfs_attributes { + /* transceiver attributes */ + TRANSCEIVER_PRESENT_ATTR_ID(1), + TRANSCEIVER_PRESENT_ATTR_ID(2), + TRANSCEIVER_PRESENT_ATTR_ID(3), + TRANSCEIVER_PRESENT_ATTR_ID(4), + TRANSCEIVER_PRESENT_ATTR_ID(5), + TRANSCEIVER_PRESENT_ATTR_ID(6), + TRANSCEIVER_PRESENT_ATTR_ID(7), + TRANSCEIVER_PRESENT_ATTR_ID(8), + TRANSCEIVER_PRESENT_ATTR_ID(9), + TRANSCEIVER_PRESENT_ATTR_ID(10), + TRANSCEIVER_PRESENT_ATTR_ID(11), + TRANSCEIVER_PRESENT_ATTR_ID(12), + TRANSCEIVER_PRESENT_ATTR_ID(13), + TRANSCEIVER_PRESENT_ATTR_ID(14), + TRANSCEIVER_PRESENT_ATTR_ID(15), + TRANSCEIVER_PRESENT_ATTR_ID(16), + TRANSCEIVER_PRESENT_ATTR_ID(17), + TRANSCEIVER_PRESENT_ATTR_ID(18), + TRANSCEIVER_PRESENT_ATTR_ID(19), + TRANSCEIVER_PRESENT_ATTR_ID(20), + TRANSCEIVER_PRESENT_ATTR_ID(21), + TRANSCEIVER_PRESENT_ATTR_ID(22), + TRANSCEIVER_PRESENT_ATTR_ID(23), + TRANSCEIVER_PRESENT_ATTR_ID(24), + TRANSCEIVER_PRESENT_ATTR_ID(25), + TRANSCEIVER_PRESENT_ATTR_ID(26), + TRANSCEIVER_PRESENT_ATTR_ID(27), + TRANSCEIVER_PRESENT_ATTR_ID(28), + TRANSCEIVER_PRESENT_ATTR_ID(29), + TRANSCEIVER_PRESENT_ATTR_ID(30), + TRANSCEIVER_PRESENT_ATTR_ID(31), + TRANSCEIVER_PRESENT_ATTR_ID(32), + TRANSCEIVER_PRESENT_ATTR_ID(33), + TRANSCEIVER_PRESENT_ATTR_ID(34), + TRANSCEIVER_PRESENT_ATTR_ID(35), + TRANSCEIVER_PRESENT_ATTR_ID(36), + TRANSCEIVER_PRESENT_ATTR_ID(37), + TRANSCEIVER_PRESENT_ATTR_ID(38), + TRANSCEIVER_PRESENT_ATTR_ID(39), + TRANSCEIVER_PRESENT_ATTR_ID(40), + TRANSCEIVER_PRESENT_ATTR_ID(41), + TRANSCEIVER_PRESENT_ATTR_ID(42), + TRANSCEIVER_PRESENT_ATTR_ID(43), + TRANSCEIVER_PRESENT_ATTR_ID(44), + TRANSCEIVER_PRESENT_ATTR_ID(45), + TRANSCEIVER_PRESENT_ATTR_ID(46), + TRANSCEIVER_PRESENT_ATTR_ID(47), + TRANSCEIVER_PRESENT_ATTR_ID(48), + TRANSCEIVER_PRESENT_ATTR_ID(49), + TRANSCEIVER_PRESENT_ATTR_ID(50), + TRANSCEIVER_PRESENT_ATTR_ID(51), + TRANSCEIVER_PRESENT_ATTR_ID(52), + TRANSCEIVER_PRESENT_ATTR_ID(53), + TRANSCEIVER_PRESENT_ATTR_ID(54), + TRANSCEIVER_PRESENT_ATTR_ID(55), + TRANSCEIVER_PRESENT_ATTR_ID(56), + TRANSCEIVER_PRESENT_ATTR_ID(57), + TRANSCEIVER_PRESENT_ATTR_ID(58), + TRANSCEIVER_PRESENT_ATTR_ID(59), + TRANSCEIVER_PRESENT_ATTR_ID(60), + TRANSCEIVER_PRESENT_ATTR_ID(61), + TRANSCEIVER_PRESENT_ATTR_ID(62), + TRANSCEIVER_PRESENT_ATTR_ID(63), + TRANSCEIVER_PRESENT_ATTR_ID(64), + TRANSCEIVER_PRESENT_ATTR_ID(65), + TRANSCEIVER_PRESENT_ATTR_ID(66), + /*Reset*/ + TRANSCEIVER_RESET_ATTR_ID(1), + TRANSCEIVER_RESET_ATTR_ID(2), + TRANSCEIVER_RESET_ATTR_ID(3), + TRANSCEIVER_RESET_ATTR_ID(4), + TRANSCEIVER_RESET_ATTR_ID(5), + TRANSCEIVER_RESET_ATTR_ID(6), + TRANSCEIVER_RESET_ATTR_ID(7), + TRANSCEIVER_RESET_ATTR_ID(8), + TRANSCEIVER_RESET_ATTR_ID(9), + TRANSCEIVER_RESET_ATTR_ID(10), + TRANSCEIVER_RESET_ATTR_ID(11), + TRANSCEIVER_RESET_ATTR_ID(12), + TRANSCEIVER_RESET_ATTR_ID(13), + TRANSCEIVER_RESET_ATTR_ID(14), + TRANSCEIVER_RESET_ATTR_ID(15), + TRANSCEIVER_RESET_ATTR_ID(16), + TRANSCEIVER_RESET_ATTR_ID(17), + TRANSCEIVER_RESET_ATTR_ID(18), + TRANSCEIVER_RESET_ATTR_ID(19), + TRANSCEIVER_RESET_ATTR_ID(20), + TRANSCEIVER_RESET_ATTR_ID(21), + TRANSCEIVER_RESET_ATTR_ID(22), + TRANSCEIVER_RESET_ATTR_ID(23), + TRANSCEIVER_RESET_ATTR_ID(24), + TRANSCEIVER_RESET_ATTR_ID(25), + TRANSCEIVER_RESET_ATTR_ID(26), + TRANSCEIVER_RESET_ATTR_ID(27), + TRANSCEIVER_RESET_ATTR_ID(28), + TRANSCEIVER_RESET_ATTR_ID(29), + TRANSCEIVER_RESET_ATTR_ID(30), + TRANSCEIVER_RESET_ATTR_ID(31), + TRANSCEIVER_RESET_ATTR_ID(32), + TRANSCEIVER_RESET_ATTR_ID(33), + TRANSCEIVER_RESET_ATTR_ID(34), + TRANSCEIVER_RESET_ATTR_ID(35), + TRANSCEIVER_RESET_ATTR_ID(36), + TRANSCEIVER_RESET_ATTR_ID(37), + TRANSCEIVER_RESET_ATTR_ID(38), + TRANSCEIVER_RESET_ATTR_ID(39), + TRANSCEIVER_RESET_ATTR_ID(40), + TRANSCEIVER_RESET_ATTR_ID(41), + TRANSCEIVER_RESET_ATTR_ID(42), + TRANSCEIVER_RESET_ATTR_ID(43), + TRANSCEIVER_RESET_ATTR_ID(44), + TRANSCEIVER_RESET_ATTR_ID(45), + TRANSCEIVER_RESET_ATTR_ID(46), + TRANSCEIVER_RESET_ATTR_ID(47), + TRANSCEIVER_RESET_ATTR_ID(48), + TRANSCEIVER_RESET_ATTR_ID(49), + TRANSCEIVER_RESET_ATTR_ID(50), + TRANSCEIVER_RESET_ATTR_ID(51), + TRANSCEIVER_RESET_ATTR_ID(52), + TRANSCEIVER_RESET_ATTR_ID(53), + TRANSCEIVER_RESET_ATTR_ID(54), + TRANSCEIVER_RESET_ATTR_ID(55), + TRANSCEIVER_RESET_ATTR_ID(56), + TRANSCEIVER_RESET_ATTR_ID(57), + TRANSCEIVER_RESET_ATTR_ID(58), + TRANSCEIVER_RESET_ATTR_ID(59), + TRANSCEIVER_RESET_ATTR_ID(60), + TRANSCEIVER_RESET_ATTR_ID(61), + TRANSCEIVER_RESET_ATTR_ID(62), + TRANSCEIVER_RESET_ATTR_ID(63), + TRANSCEIVER_RESET_ATTR_ID(64), + TRANSCEIVER_LPMODE_ATTR_ID(1), + TRANSCEIVER_LPMODE_ATTR_ID(2), + TRANSCEIVER_LPMODE_ATTR_ID(3), + TRANSCEIVER_LPMODE_ATTR_ID(4), + TRANSCEIVER_LPMODE_ATTR_ID(5), + TRANSCEIVER_LPMODE_ATTR_ID(6), + TRANSCEIVER_LPMODE_ATTR_ID(7), + TRANSCEIVER_LPMODE_ATTR_ID(8), + TRANSCEIVER_LPMODE_ATTR_ID(9), + TRANSCEIVER_LPMODE_ATTR_ID(10), + TRANSCEIVER_LPMODE_ATTR_ID(11), + TRANSCEIVER_LPMODE_ATTR_ID(12), + TRANSCEIVER_LPMODE_ATTR_ID(13), + TRANSCEIVER_LPMODE_ATTR_ID(14), + TRANSCEIVER_LPMODE_ATTR_ID(15), + TRANSCEIVER_LPMODE_ATTR_ID(16), + TRANSCEIVER_LPMODE_ATTR_ID(17), + TRANSCEIVER_LPMODE_ATTR_ID(18), + TRANSCEIVER_LPMODE_ATTR_ID(19), + TRANSCEIVER_LPMODE_ATTR_ID(20), + TRANSCEIVER_LPMODE_ATTR_ID(21), + TRANSCEIVER_LPMODE_ATTR_ID(22), + TRANSCEIVER_LPMODE_ATTR_ID(23), + TRANSCEIVER_LPMODE_ATTR_ID(24), + TRANSCEIVER_LPMODE_ATTR_ID(25), + TRANSCEIVER_LPMODE_ATTR_ID(26), + TRANSCEIVER_LPMODE_ATTR_ID(27), + TRANSCEIVER_LPMODE_ATTR_ID(28), + TRANSCEIVER_LPMODE_ATTR_ID(29), + TRANSCEIVER_LPMODE_ATTR_ID(30), + TRANSCEIVER_LPMODE_ATTR_ID(31), + TRANSCEIVER_LPMODE_ATTR_ID(32), + TRANSCEIVER_LPMODE_ATTR_ID(33), + TRANSCEIVER_LPMODE_ATTR_ID(34), + TRANSCEIVER_LPMODE_ATTR_ID(35), + TRANSCEIVER_LPMODE_ATTR_ID(36), + TRANSCEIVER_LPMODE_ATTR_ID(37), + TRANSCEIVER_LPMODE_ATTR_ID(38), + TRANSCEIVER_LPMODE_ATTR_ID(39), + TRANSCEIVER_LPMODE_ATTR_ID(40), + TRANSCEIVER_LPMODE_ATTR_ID(41), + TRANSCEIVER_LPMODE_ATTR_ID(42), + TRANSCEIVER_LPMODE_ATTR_ID(43), + TRANSCEIVER_LPMODE_ATTR_ID(44), + TRANSCEIVER_LPMODE_ATTR_ID(45), + TRANSCEIVER_LPMODE_ATTR_ID(46), + TRANSCEIVER_LPMODE_ATTR_ID(47), + TRANSCEIVER_LPMODE_ATTR_ID(48), + TRANSCEIVER_LPMODE_ATTR_ID(49), + TRANSCEIVER_LPMODE_ATTR_ID(50), + TRANSCEIVER_LPMODE_ATTR_ID(51), + TRANSCEIVER_LPMODE_ATTR_ID(52), + TRANSCEIVER_LPMODE_ATTR_ID(53), + TRANSCEIVER_LPMODE_ATTR_ID(54), + TRANSCEIVER_LPMODE_ATTR_ID(55), + TRANSCEIVER_LPMODE_ATTR_ID(56), + TRANSCEIVER_LPMODE_ATTR_ID(57), + TRANSCEIVER_LPMODE_ATTR_ID(58), + TRANSCEIVER_LPMODE_ATTR_ID(59), + TRANSCEIVER_LPMODE_ATTR_ID(60), + TRANSCEIVER_LPMODE_ATTR_ID(61), + TRANSCEIVER_LPMODE_ATTR_ID(62), + TRANSCEIVER_LPMODE_ATTR_ID(63), + TRANSCEIVER_LPMODE_ATTR_ID(64), + TRANSCEIVER_TX_DISABLE_ATTR_ID(65), + TRANSCEIVER_TX_DISABLE_ATTR_ID(66), + TRANSCEIVER_TX_FAULT_ATTR_ID(65), + TRANSCEIVER_TX_FAULT_ATTR_ID(66), + TRANSCEIVER_RX_LOS_ATTR_ID(65), + TRANSCEIVER_RX_LOS_ATTR_ID(66), + MODULE_RESET_ALL, + PCIE_FPGA_UDB_VERSION, + PCIE_FPGA_LDB_VERSION, + PCIE_FPGA_SMB_VERSION, +}; + +enum pcie_type_e { + PCIE_FPGA_TYPE_UDB = 0, + PCIE_FPGA_TYPE_LDB +}; + +enum eeprom_page_type_e { + EEPROM_LOWER_PAGE = -1, + EEPROM_UPPER_PAGE +}; + +enum port_sysfs_attributes { + PORT_SYSFS_NAME_ID = 1, + PORT_SYSFS_PORT_NAME_ID, + PORT_SYSFS_DEV_CLASS_ID +}; + +/* System LED: */ +enum led_type { + LED_SYSFS_LOC = 0, + LED_SYSFS_STAT, + LED_SYSFS_FAN, + LED_SYSFS_PSU1, + LED_SYSFS_PSU2 +}; + +enum led_light_mode { + LED_MODE_OFF, + LED_MODE_RED = 10, + LED_MODE_RED_BLINKING = 11, + LED_MODE_AMBER = 12, + LED_MODE_AMBER_BLINKING = 13, + LED_MODE_YELLOW = 14, + LED_MODE_YELLOW_BLINKING = 15, + LED_MODE_GREEN = 16, + LED_MODE_GREEN_BLINKING = 17, + LED_MODE_BLUE = 18, + LED_MODE_BLUE_BLINKING = 19, + LED_MODE_PURPLE = 20, + LED_MODE_PURPLE_BLINKING = 21, + LED_MODE_AUTO = 22, + LED_MODE_AUTO_BLINKING = 23, + LED_MODE_WHITE = 24, + LED_MODE_WHITE_BLINKING = 25, + LED_MODE_CYAN = 26, + LED_MODE_CYAN_BLINKING = 27, + LED_MODE_UNKNOWN = 99 +}; + +struct led_reg { + u32 types; + u8 reg_addr; +}; + +static const struct led_reg led_reg_map[] = { + {LED_SYSFS_LOC, UDB_CPLD2_SYSTEM_LED_OFFSET_CTRL_REG_1}, + {LED_SYSFS_STAT, UDB_CPLD2_SYSTEM_LED_OFFSET_CTRL_REG_2}, +}; + +struct led_type_mode { + enum led_type type; + enum led_light_mode mode; + u8 reg_bit_mask; + u8 mode_value; +}; + +static struct led_type_mode led_type_mode_data[] = { +{LED_SYSFS_LOC, LED_MODE_OFF, LED_TYPE_LOC_REG_MASK, LED_MODE_LOC_OFF_VALUE}, +{LED_SYSFS_LOC, LED_MODE_BLUE, LED_TYPE_LOC_REG_MASK, LED_MODE_LOC_BLUE_VALUE}, +{LED_SYSFS_LOC, LED_MODE_BLUE_BLINKING, LED_TYPE_LOC_REG_MASK, LED_MODE_LOC_BLUE_BLINK_VALUE}, +{LED_SYSFS_STAT, LED_MODE_OFF, LED_TYPE_STAT_REG_MASK, LED_MODE_STAT_OFF_VALUE}, +{LED_SYSFS_STAT, LED_MODE_GREEN, LED_TYPE_STAT_REG_MASK, LED_MODE_STAT_GREEN_VALUE}, +{LED_SYSFS_STAT, LED_MODE_BLUE, LED_TYPE_STAT_REG_MASK, LED_MODE_STAT_BLUE_VALUE}, +{LED_SYSFS_STAT, LED_MODE_GREEN_BLINKING, LED_TYPE_STAT_REG_MASK, LED_MODE_STAT_GREEN_BLINK_VALUE}, +{LED_SYSFS_STAT, LED_MODE_AMBER, LED_TYPE_STAT_REG_MASK, LED_MODE_STAT_AMBER_VALUE} +}; + +/*********************************************** + * function declare + * *********************************************/ +static ssize_t port_status_read(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t port_status_write(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); + +static ssize_t port_read(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t port_write(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); + +static ssize_t led_status_read(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t led_status_write(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); + +static int fpga_i2c_ready_to_read(struct bin_attribute *attr, int page_type, int i2c_slave_addr); + +/* UDB */ +/*init eeprom private data*/ +static struct eeprom_bin_private_data pcie_udb_eeprom_bin_private_data[] = { + eeprom_udb_private_data_port_init(1), + eeprom_udb_private_data_port_init(2), + eeprom_udb_private_data_port_init(3), + eeprom_udb_private_data_port_init(4), + eeprom_udb_private_data_port_init(5), + eeprom_udb_private_data_port_init(6), + eeprom_udb_private_data_port_init(7), + eeprom_udb_private_data_port_init(8), + eeprom_udb_private_data_port_init(9), + eeprom_udb_private_data_port_init(10), + eeprom_udb_private_data_port_init(11), + eeprom_udb_private_data_port_init(12), + eeprom_udb_private_data_port_init(13), + eeprom_udb_private_data_port_init(14), + eeprom_udb_private_data_port_init(15), + eeprom_udb_private_data_port_init(16), + eeprom_udb_private_data_port_init(17), + eeprom_udb_private_data_port_init(18), + eeprom_udb_private_data_port_init(19), + eeprom_udb_private_data_port_init(20), + eeprom_udb_private_data_port_init(21), + eeprom_udb_private_data_port_init(22), + eeprom_udb_private_data_port_init(23), + eeprom_udb_private_data_port_init(24), + eeprom_udb_private_data_port_init(25), + eeprom_udb_private_data_port_init(26), + eeprom_udb_private_data_port_init(27), + eeprom_udb_private_data_port_init(28), + eeprom_udb_private_data_port_init(29), + eeprom_udb_private_data_port_init(30), + eeprom_udb_private_data_port_init(31), + eeprom_udb_private_data_port_init(32), +}; + +/*init device platform data*/ +static struct pcie_fpga_dev_platform_data pcie_udb_dev_platform_data[] = { + pcie_udb_qsfp_platform_data_init(1), + pcie_udb_qsfp_platform_data_init(2), + pcie_udb_qsfp_platform_data_init(3), + pcie_udb_qsfp_platform_data_init(4), + pcie_udb_qsfp_platform_data_init(5), + pcie_udb_qsfp_platform_data_init(6), + pcie_udb_qsfp_platform_data_init(7), + pcie_udb_qsfp_platform_data_init(8), + pcie_udb_qsfp_platform_data_init(9), + pcie_udb_qsfp_platform_data_init(10), + pcie_udb_qsfp_platform_data_init(11), + pcie_udb_qsfp_platform_data_init(12), + pcie_udb_qsfp_platform_data_init(13), + pcie_udb_qsfp_platform_data_init(14), + pcie_udb_qsfp_platform_data_init(15), + pcie_udb_qsfp_platform_data_init(16), + pcie_udb_qsfp_platform_data_init(17), + pcie_udb_qsfp_platform_data_init(18), + pcie_udb_qsfp_platform_data_init(19), + pcie_udb_qsfp_platform_data_init(20), + pcie_udb_qsfp_platform_data_init(21), + pcie_udb_qsfp_platform_data_init(22), + pcie_udb_qsfp_platform_data_init(23), + pcie_udb_qsfp_platform_data_init(24), + pcie_udb_qsfp_platform_data_init(25), + pcie_udb_qsfp_platform_data_init(26), + pcie_udb_qsfp_platform_data_init(27), + pcie_udb_qsfp_platform_data_init(28), + pcie_udb_qsfp_platform_data_init(29), + pcie_udb_qsfp_platform_data_init(30), + pcie_udb_qsfp_platform_data_init(31), + pcie_udb_qsfp_platform_data_init(32), +}; + +/* LDB */ +/*init eeprom private data*/ +static struct eeprom_bin_private_data pcie_ldb_eeprom_bin_private_data[] = { + eeprom_ldb_private_data_port_init(1), + eeprom_ldb_private_data_port_init(2), + eeprom_ldb_private_data_port_init(3), + eeprom_ldb_private_data_port_init(4), + eeprom_ldb_private_data_port_init(5), + eeprom_ldb_private_data_port_init(6), + eeprom_ldb_private_data_port_init(7), + eeprom_ldb_private_data_port_init(8), + eeprom_ldb_private_data_port_init(9), + eeprom_ldb_private_data_port_init(10), + eeprom_ldb_private_data_port_init(11), + eeprom_ldb_private_data_port_init(12), + eeprom_ldb_private_data_port_init(13), + eeprom_ldb_private_data_port_init(14), + eeprom_ldb_private_data_port_init(15), + eeprom_ldb_private_data_port_init(16), + eeprom_ldb_private_data_port_init(17), + eeprom_ldb_private_data_port_init(18), + eeprom_ldb_private_data_port_init(19), + eeprom_ldb_private_data_port_init(20), + eeprom_ldb_private_data_port_init(21), + eeprom_ldb_private_data_port_init(22), + eeprom_ldb_private_data_port_init(23), + eeprom_ldb_private_data_port_init(24), + eeprom_ldb_private_data_port_init(25), + eeprom_ldb_private_data_port_init(26), + eeprom_ldb_private_data_port_init(27), + eeprom_ldb_private_data_port_init(28), + eeprom_ldb_private_data_port_init(29), + eeprom_ldb_private_data_port_init(30), + eeprom_ldb_private_data_port_init(31), + eeprom_ldb_private_data_port_init(32), + eeprom_ldb_private_data_port_init(33), /*sfp: port65*/ + eeprom_ldb_private_data_port_init(34), /*sfp: port66*/ +}; + +/*init device platform data*/ +static struct pcie_fpga_dev_platform_data pcie_ldb_dev_platform_data[] = { + pcie_ldb_qsfp_platform_data_init(1), + pcie_ldb_qsfp_platform_data_init(2), + pcie_ldb_qsfp_platform_data_init(3), + pcie_ldb_qsfp_platform_data_init(4), + pcie_ldb_qsfp_platform_data_init(5), + pcie_ldb_qsfp_platform_data_init(6), + pcie_ldb_qsfp_platform_data_init(7), + pcie_ldb_qsfp_platform_data_init(8), + pcie_ldb_qsfp_platform_data_init(9), + pcie_ldb_qsfp_platform_data_init(10), + pcie_ldb_qsfp_platform_data_init(11), + pcie_ldb_qsfp_platform_data_init(12), + pcie_ldb_qsfp_platform_data_init(13), + pcie_ldb_qsfp_platform_data_init(14), + pcie_ldb_qsfp_platform_data_init(15), + pcie_ldb_qsfp_platform_data_init(16), + pcie_ldb_qsfp_platform_data_init(17), + pcie_ldb_qsfp_platform_data_init(18), + pcie_ldb_qsfp_platform_data_init(19), + pcie_ldb_qsfp_platform_data_init(20), + pcie_ldb_qsfp_platform_data_init(21), + pcie_ldb_qsfp_platform_data_init(22), + pcie_ldb_qsfp_platform_data_init(23), + pcie_ldb_qsfp_platform_data_init(24), + pcie_ldb_qsfp_platform_data_init(25), + pcie_ldb_qsfp_platform_data_init(26), + pcie_ldb_qsfp_platform_data_init(27), + pcie_ldb_qsfp_platform_data_init(28), + pcie_ldb_qsfp_platform_data_init(29), + pcie_ldb_qsfp_platform_data_init(30), + pcie_ldb_qsfp_platform_data_init(31), + pcie_ldb_qsfp_platform_data_init(32), + pcie_ldb_sfp_platform_data_init(33), /*sfp: port65*/ + pcie_ldb_sfp_platform_data_init(34), /*sfp: port66*/ +}; + +static void device_release(struct device *dev) +{ + return; +} + +/*UDB platform device*/ +static struct platform_device pcie_udb_qsfp_device[] = { + pcie_udb_qsfp_device_port(0), + pcie_udb_qsfp_device_port(1), + pcie_udb_qsfp_device_port(2), + pcie_udb_qsfp_device_port(3), + pcie_udb_qsfp_device_port(4), + pcie_udb_qsfp_device_port(5), + pcie_udb_qsfp_device_port(6), + pcie_udb_qsfp_device_port(7), + pcie_udb_qsfp_device_port(8), + pcie_udb_qsfp_device_port(9), + pcie_udb_qsfp_device_port(10), + pcie_udb_qsfp_device_port(11), + pcie_udb_qsfp_device_port(12), + pcie_udb_qsfp_device_port(13), + pcie_udb_qsfp_device_port(14), + pcie_udb_qsfp_device_port(15), + pcie_udb_qsfp_device_port(16), + pcie_udb_qsfp_device_port(17), + pcie_udb_qsfp_device_port(18), + pcie_udb_qsfp_device_port(19), + pcie_udb_qsfp_device_port(20), + pcie_udb_qsfp_device_port(21), + pcie_udb_qsfp_device_port(22), + pcie_udb_qsfp_device_port(23), + pcie_udb_qsfp_device_port(24), + pcie_udb_qsfp_device_port(25), + pcie_udb_qsfp_device_port(26), + pcie_udb_qsfp_device_port(27), + pcie_udb_qsfp_device_port(28), + pcie_udb_qsfp_device_port(29), + pcie_udb_qsfp_device_port(30), + pcie_udb_qsfp_device_port(31), +}; + +/*LDB platform device*/ +static struct platform_device pcie_ldb_qsfp_device[] = { + pcie_ldb_qsfp_device_port(0), + pcie_ldb_qsfp_device_port(1), + pcie_ldb_qsfp_device_port(2), + pcie_ldb_qsfp_device_port(3), + pcie_ldb_qsfp_device_port(4), + pcie_ldb_qsfp_device_port(5), + pcie_ldb_qsfp_device_port(6), + pcie_ldb_qsfp_device_port(7), + pcie_ldb_qsfp_device_port(8), + pcie_ldb_qsfp_device_port(9), + pcie_ldb_qsfp_device_port(10), + pcie_ldb_qsfp_device_port(11), + pcie_ldb_qsfp_device_port(12), + pcie_ldb_qsfp_device_port(13), + pcie_ldb_qsfp_device_port(14), + pcie_ldb_qsfp_device_port(15), + pcie_ldb_qsfp_device_port(16), + pcie_ldb_qsfp_device_port(17), + pcie_ldb_qsfp_device_port(18), + pcie_ldb_qsfp_device_port(19), + pcie_ldb_qsfp_device_port(20), + pcie_ldb_qsfp_device_port(21), + pcie_ldb_qsfp_device_port(22), + pcie_ldb_qsfp_device_port(23), + pcie_ldb_qsfp_device_port(24), + pcie_ldb_qsfp_device_port(25), + pcie_ldb_qsfp_device_port(26), + pcie_ldb_qsfp_device_port(27), + pcie_ldb_qsfp_device_port(28), + pcie_ldb_qsfp_device_port(29), + pcie_ldb_qsfp_device_port(30), + pcie_ldb_qsfp_device_port(31), + pcie_ldb_sfp_device_port(32), /*sfp port65*/ + pcie_ldb_sfp_device_port(33), /*sfp port66*/ +}; + +#define DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(index) \ + static SENSOR_DEVICE_ATTR(module_present_##index, S_IRUGO, port_status_read, NULL, MODULE_PRESENT_##index); \ + static SENSOR_DEVICE_ATTR(module_reset_##index, S_IWUSR|S_IRUGO, port_status_read, port_status_write, MODULE_RESET_##index); \ + static SENSOR_DEVICE_ATTR(module_lp_mode_##index, S_IRUGO | S_IWUSR, port_status_read, port_status_write, MODULE_LPMODE_##index) +#define DECLARE_TRANSCEIVER_ATTR(index) \ + &sensor_dev_attr_module_present_##index.dev_attr.attr, \ + &sensor_dev_attr_module_reset_##index.dev_attr.attr, \ + &sensor_dev_attr_module_lp_mode_##index.dev_attr.attr + +/* transceiver attributes */ +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(1); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(2); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(3); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(4); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(5); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(6); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(7); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(8); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(9); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(10); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(11); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(12); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(13); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(14); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(15); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(16); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(17); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(18); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(19); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(20); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(21); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(22); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(23); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(24); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(25); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(26); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(27); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(28); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(29); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(30); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(31); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(32); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(33); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(34); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(35); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(36); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(37); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(38); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(39); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(40); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(41); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(42); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(43); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(44); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(45); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(46); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(47); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(48); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(49); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(50); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(51); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(52); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(53); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(54); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(55); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(56); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(57); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(58); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(59); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(60); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(61); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(62); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(63); +DECLARE_TRANSCEIVER_SENSOR_DEVICE_ATTR(64); +static SENSOR_DEVICE_ATTR(module_present_65, S_IRUGO, port_status_read, NULL, MODULE_PRESENT_65); +static SENSOR_DEVICE_ATTR(module_present_66, S_IRUGO, port_status_read, NULL, MODULE_PRESENT_66); +static SENSOR_DEVICE_ATTR(module_reset_all, S_IWUSR, NULL, port_status_write, MODULE_RESET_ALL); +static SENSOR_DEVICE_ATTR(module_tx_disable_65, S_IRUGO | S_IWUSR, port_status_read, port_status_write, MODULE_TX_DISABLE_65); +static SENSOR_DEVICE_ATTR(module_tx_disable_66, S_IRUGO | S_IWUSR, port_status_read, port_status_write, MODULE_TX_DISABLE_66); +static SENSOR_DEVICE_ATTR(module_tx_fault_65, S_IRUGO, port_status_read, NULL, MODULE_TX_FAULT_65); +static SENSOR_DEVICE_ATTR(module_tx_fault_66, S_IRUGO, port_status_read, NULL, MODULE_TX_FAULT_66); +static SENSOR_DEVICE_ATTR(module_rx_los_65, S_IRUGO, port_status_read, NULL, MODULE_RX_LOS_65); +static SENSOR_DEVICE_ATTR(module_rx_los_66, S_IRUGO, port_status_read, NULL, MODULE_RX_LOS_66); +static SENSOR_DEVICE_ATTR(udb_version, S_IRUGO, port_status_read, NULL, PCIE_FPGA_UDB_VERSION); +static SENSOR_DEVICE_ATTR(ldb_version, S_IRUGO, port_status_read, NULL, PCIE_FPGA_LDB_VERSION); +static SENSOR_DEVICE_ATTR(smb_version, S_IRUGO, port_status_read, NULL, PCIE_FPGA_SMB_VERSION); +/* led attribute */ +static SENSOR_DEVICE_ATTR(led_loc , S_IRUGO|S_IWUSR, led_status_read, led_status_write, LED_SYSFS_LOC); +static SENSOR_DEVICE_ATTR(led_stat, S_IRUGO|S_IWUSR, led_status_read, led_status_write, LED_SYSFS_STAT); +static SENSOR_DEVICE_ATTR(led_fan, S_IRUGO|S_IWUSR, led_status_read, led_status_write, LED_SYSFS_FAN); +static SENSOR_DEVICE_ATTR(led_psu1, S_IRUGO|S_IWUSR, led_status_read, led_status_write, LED_SYSFS_PSU1); +static SENSOR_DEVICE_ATTR(led_psu2, S_IRUGO|S_IWUSR, led_status_read, led_status_write, LED_SYSFS_PSU2); + +static struct attribute *fpga_transceiver_attributes[] = { + DECLARE_TRANSCEIVER_ATTR(1), + DECLARE_TRANSCEIVER_ATTR(2), + DECLARE_TRANSCEIVER_ATTR(3), + DECLARE_TRANSCEIVER_ATTR(4), + DECLARE_TRANSCEIVER_ATTR(5), + DECLARE_TRANSCEIVER_ATTR(6), + DECLARE_TRANSCEIVER_ATTR(7), + DECLARE_TRANSCEIVER_ATTR(8), + DECLARE_TRANSCEIVER_ATTR(9), + DECLARE_TRANSCEIVER_ATTR(10), + DECLARE_TRANSCEIVER_ATTR(11), + DECLARE_TRANSCEIVER_ATTR(12), + DECLARE_TRANSCEIVER_ATTR(13), + DECLARE_TRANSCEIVER_ATTR(14), + DECLARE_TRANSCEIVER_ATTR(15), + DECLARE_TRANSCEIVER_ATTR(16), + DECLARE_TRANSCEIVER_ATTR(17), + DECLARE_TRANSCEIVER_ATTR(18), + DECLARE_TRANSCEIVER_ATTR(19), + DECLARE_TRANSCEIVER_ATTR(20), + DECLARE_TRANSCEIVER_ATTR(21), + DECLARE_TRANSCEIVER_ATTR(22), + DECLARE_TRANSCEIVER_ATTR(23), + DECLARE_TRANSCEIVER_ATTR(24), + DECLARE_TRANSCEIVER_ATTR(25), + DECLARE_TRANSCEIVER_ATTR(26), + DECLARE_TRANSCEIVER_ATTR(27), + DECLARE_TRANSCEIVER_ATTR(28), + DECLARE_TRANSCEIVER_ATTR(29), + DECLARE_TRANSCEIVER_ATTR(30), + DECLARE_TRANSCEIVER_ATTR(31), + DECLARE_TRANSCEIVER_ATTR(32), + DECLARE_TRANSCEIVER_ATTR(33), + DECLARE_TRANSCEIVER_ATTR(34), + DECLARE_TRANSCEIVER_ATTR(35), + DECLARE_TRANSCEIVER_ATTR(36), + DECLARE_TRANSCEIVER_ATTR(37), + DECLARE_TRANSCEIVER_ATTR(38), + DECLARE_TRANSCEIVER_ATTR(39), + DECLARE_TRANSCEIVER_ATTR(40), + DECLARE_TRANSCEIVER_ATTR(41), + DECLARE_TRANSCEIVER_ATTR(42), + DECLARE_TRANSCEIVER_ATTR(43), + DECLARE_TRANSCEIVER_ATTR(44), + DECLARE_TRANSCEIVER_ATTR(45), + DECLARE_TRANSCEIVER_ATTR(46), + DECLARE_TRANSCEIVER_ATTR(47), + DECLARE_TRANSCEIVER_ATTR(48), + DECLARE_TRANSCEIVER_ATTR(49), + DECLARE_TRANSCEIVER_ATTR(50), + DECLARE_TRANSCEIVER_ATTR(51), + DECLARE_TRANSCEIVER_ATTR(52), + DECLARE_TRANSCEIVER_ATTR(53), + DECLARE_TRANSCEIVER_ATTR(54), + DECLARE_TRANSCEIVER_ATTR(55), + DECLARE_TRANSCEIVER_ATTR(56), + DECLARE_TRANSCEIVER_ATTR(57), + DECLARE_TRANSCEIVER_ATTR(58), + DECLARE_TRANSCEIVER_ATTR(59), + DECLARE_TRANSCEIVER_ATTR(60), + DECLARE_TRANSCEIVER_ATTR(61), + DECLARE_TRANSCEIVER_ATTR(62), + DECLARE_TRANSCEIVER_ATTR(63), + DECLARE_TRANSCEIVER_ATTR(64), + &sensor_dev_attr_module_present_65.dev_attr.attr, + &sensor_dev_attr_module_present_66.dev_attr.attr, + &sensor_dev_attr_module_reset_all.dev_attr.attr, + &sensor_dev_attr_module_tx_disable_65.dev_attr.attr, + &sensor_dev_attr_module_tx_disable_66.dev_attr.attr, + &sensor_dev_attr_module_tx_fault_65.dev_attr.attr, + &sensor_dev_attr_module_tx_fault_66.dev_attr.attr, + &sensor_dev_attr_module_rx_los_65.dev_attr.attr, + &sensor_dev_attr_module_rx_los_66.dev_attr.attr, + &sensor_dev_attr_udb_version.dev_attr.attr, + &sensor_dev_attr_ldb_version.dev_attr.attr, + &sensor_dev_attr_smb_version.dev_attr.attr, + &sensor_dev_attr_led_loc.dev_attr.attr, + &sensor_dev_attr_led_stat.dev_attr.attr, + &sensor_dev_attr_led_fan.dev_attr.attr, + &sensor_dev_attr_led_psu1.dev_attr.attr, + &sensor_dev_attr_led_psu2.dev_attr.attr, + NULL +}; + +/* eeprom attribute */ +static SENSOR_DEVICE_ATTR(name, S_IRUGO, port_read, NULL, PORT_SYSFS_NAME_ID); /* optoe{1, 2, 3} */ +static SENSOR_DEVICE_ATTR(port_name, S_IRUGO, port_read, NULL, PORT_SYSFS_PORT_NAME_ID); /* port{1~64} */ +static SENSOR_DEVICE_ATTR(dev_class, S_IRUGO|S_IWUSR, port_read, port_write, PORT_SYSFS_DEV_CLASS_ID); /* 1 or 2 or 3 */ + +static struct attribute *fpga_eeprom_attributes[] = { + &sensor_dev_attr_name.dev_attr.attr, + &sensor_dev_attr_port_name.dev_attr.attr, + &sensor_dev_attr_dev_class.dev_attr.attr, + NULL +}; + +static const struct attribute_group fpga_port_stat_group = { + .attrs = fpga_transceiver_attributes, +}; + +static const struct attribute_group fpga_eeprom_group = { + .attrs = fpga_eeprom_attributes, +}; + +static char *show_date_time(void) +{ + struct timespec64 tv; + struct tm tm_val; + +#ifdef __STDC_LIB_EXT1__ + memset_s(g_datetime, DATETIME_LEN, 0, DATETIME_LEN); +#else + memset(g_datetime, 0, DATETIME_LEN); +#endif + + ktime_get_real_ts64(&tv); + time64_to_tm(tv.tv_sec, 0, &tm_val); + sprintf(g_datetime, "[%04d/%02d/%02d-%02d:%02d:%02d.%06ld]", + 1900 + tm_val.tm_year, + tm_val.tm_mon + 1, + tm_val.tm_mday, + tm_val.tm_hour, + tm_val.tm_min, + tm_val.tm_sec, + tv.tv_nsec/1000); /*usec*/ + + return g_datetime; +} + +static ssize_t fpga_read_sfp_ddm_status_value(struct bin_attribute *eeprom) +{ + u32 reg_val = 0; + u16 pageable = 0; + u16 ddm_support = 0; + struct eeprom_bin_private_data *pdata = NULL; + + if(eeprom == NULL) { + return -1; + } + + pdata = eeprom->private; /*assign private sturct value*/ + + if(pdata->port_num > FPGA_QSFP_PORT_NUM) + { + /*get sfp pagable status*/ + if( fpga_i2c_ready_to_read(eeprom, EEPROM_LOWER_PAGE, pdata->i2c_slave_addr) != 1) { + return 0; + } + + reg_val = ioread32(pdata->data_base_addr + (pdata->i2c_rtc_read_data + TWO_ADDR_PAGEABLE_REG)); + pageable = (reg_val) & 0xff; /*check on bit4*/ + + /*get sfp support a2 status*/ + if( fpga_i2c_ready_to_read(eeprom, EEPROM_LOWER_PAGE, pdata->i2c_slave_addr) != 1) { + return 0; + } + + reg_val = ioread32(pdata->data_base_addr + (pdata->i2c_rtc_read_data + TWO_ADDR_0X51_REG )); + ddm_support = (reg_val) & 0xff; /*check on bit6*/ + + pdata->pageable = (pageable & TWO_ADDR_PAGEABLE ) ? 1 : 0; + pdata->sfp_support_a2 = (ddm_support & TWO_ADDR_0X51_SUPP) ? 1 : 0; + } + + return 0; +} + +static ssize_t fpga_read_port_status_value(struct bin_attribute *eeprom) +{ + int i = 0; + + if ( time_before(jiffies, fpga_ctl->last_updated + HZ / 2) ) { + return 0; + } + + for (i = 0; i < ARRAY_SIZE(fpga_ctl->pci_fpga_dev) -1; i++) + { + /*Update present*/ + fpga_ctl->pci_fpga_dev[i].qsfp_present = ioread32(fpga_ctl->pci_fpga_dev[i].data_base_addr + QSFP_PRESENT_REG_OFFSET); + + if(i==PCI_SUBSYSTEM_ID_LDB) + { + /*Read output data*/ + fpga_ctl->pci_fpga_dev[i].sfp_output_data = ioread32(fpga_ctl->pci_fpga_dev[i].data_base_addr + SFP_LDB_GPIO1_DATA_OUT); + /*Read input data*/ + fpga_ctl->pci_fpga_dev[i].sfp_input_data = ioread32(fpga_ctl->pci_fpga_dev[i].data_base_addr + SFP_LDB_GPIO1_DATA_IN); + } + /*Update lpmode*/ + fpga_ctl->pci_fpga_dev[i].qsfp_lpmode = ioread32(fpga_ctl->pci_fpga_dev[i].data_base_addr + QSFP_LPMODE_REG_OFFSET); + /*Update reset*/ + fpga_ctl->pci_fpga_dev[i].qsfp_reset = ioread32(fpga_ctl->pci_fpga_dev[i].data_base_addr + QSFP_RESET_REG_OFFSET); + } + + /*get version*/ + fpga_ctl->udb_version = ioread32(fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_UDB].data_base_addr); + fpga_ctl->ldb_version = ioread32(fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].data_base_addr); + fpga_ctl->smb_version = ioread32(fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_SMB].data_base_addr); + + fpga_ctl->last_updated = jiffies; + + return 0; +} + +static ssize_t fpga_write_port_value(int fpga_type, int set_type, int bit_num, long val) +{ + long val_set = 0; + u32 reg_val = 0; + + if(set_type == PCIE_FPGA_SET_LPMODE) { + reg_val = ioread32(fpga_ctl->pci_fpga_dev[fpga_type].data_base_addr + QSFP_LPMODE_REG_OFFSET); + } else if(set_type == PCIE_FPGA_SET_RESET) { + reg_val = ioread32(fpga_ctl->pci_fpga_dev[fpga_type].data_base_addr + QSFP_RESET_REG_OFFSET); + } else { + reg_val = ioread32(fpga_ctl->pci_fpga_dev[fpga_type].data_base_addr + SFP_LDB_GPIO1_DATA_OUT); + } + + if(val){ + val_set = (bit_num == REG_SET_ALL_32_BITS) ? REG_SET_32_BITS_TO_1 : (reg_val | (1<pci_fpga_dev[fpga_type].data_base_addr + QSFP_LPMODE_REG_OFFSET); + break; + case PCIE_FPGA_SET_RESET: + iowrite32(val_set, fpga_ctl->pci_fpga_dev[fpga_type].data_base_addr + QSFP_RESET_REG_OFFSET); + break; + case PCIE_FPGA_SET_TX_DISABLE: + iowrite32(val_set, fpga_ctl->pci_fpga_dev[fpga_type].data_base_addr + SFP_LDB_GPIO1_DATA_OUT); + break; + default: + break; + } + + return 0; +} + +static int get_present_by_attr_index(int attr_index) +{ + int present = 0; + int index_mapping = 0; + + switch(attr_index) + { + case MODULE_PRESENT_1 ... MODULE_PRESENT_32: + case MODULE_PRESENT_33 ... MODULE_PRESENT_64: + case MODULE_PRESENT_65: /*sfp port*/ + case MODULE_PRESENT_66: /*sfp port*/ + index_mapping = attr_index; + break; + case MODULE_LPMODE_1 ... MODULE_LPMODE_32: + index_mapping = attr_index - MODULE_LPMODE_1; + break; + case MODULE_LPMODE_33 ... MODULE_LPMODE_64: + index_mapping = attr_index - MODULE_LPMODE_33; + break; + case MODULE_RESET_1 ... MODULE_RESET_32: + index_mapping = attr_index - MODULE_RESET_1; + break; + case MODULE_RESET_33 ... MODULE_RESET_64: + index_mapping = attr_index - MODULE_RESET_33; + break; + case MODULE_TX_DISABLE_65: + case MODULE_TX_FAULT_65: + case MODULE_RX_LOS_65: + index_mapping = MODULE_PRESENT_65; + break; + case MODULE_TX_DISABLE_66: + case MODULE_TX_FAULT_66: + case MODULE_RX_LOS_66: + index_mapping = MODULE_PRESENT_66; + break; + default: + index_mapping = -EINVAL; + break; + } + + if( (index_mapping >= MODULE_PRESENT_1) && (index_mapping <= MODULE_PRESENT_32) ) + { + present =((fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_UDB].qsfp_present>>(index_mapping - MODULE_PRESENT_1)) & 0x1)?0:1; + } + else if( (index_mapping >= MODULE_PRESENT_33) && (index_mapping <= MODULE_PRESENT_64) ) + { + present = ((fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].qsfp_present>>(index_mapping - MODULE_PRESENT_33)) & 0x1)?0:1; + } + else if( index_mapping == MODULE_PRESENT_65 ) + { + present = ((SFP_PORT0_ABS(fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].sfp_input_data)) & 0x1)?0:1; + } + else if( index_mapping == MODULE_PRESENT_66 ) + { + present = ((SFP_PORT1_ABS(fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].sfp_input_data)) & 0x1)?0:1; + } + else { + present = 0; /*unpresent*/ + } + + return present; +} + +static ssize_t port_status_read(struct device *dev, struct device_attribute *da, char *buf) +{ + int present = 0; + ssize_t ret = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct bin_attribute *eeprom = NULL; + + mutex_lock(&update_lock); + fpga_read_port_status_value(eeprom); + + present = get_present_by_attr_index(attr->index); + + switch(attr->index) + { + case MODULE_PRESENT_1 ... MODULE_PRESENT_32: + case MODULE_PRESENT_33 ... MODULE_PRESENT_64: + case MODULE_PRESENT_65: /*sfp port*/ + case MODULE_PRESENT_66: /*sfp port*/ + ret = sprintf(buf, "%d\n", present); + break; + case MODULE_LPMODE_1 ... MODULE_LPMODE_32: + if(present){ + ret = sprintf(buf, "%d\n", ((fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_UDB].qsfp_lpmode >> (attr->index - MODULE_LPMODE_1)) & 0x1)); + } else { + ret = sprintf(buf, "%d\n", 0); /*unpresent: default value*/ + } + break; + case MODULE_LPMODE_33 ... MODULE_LPMODE_64: + if(present){ + ret = sprintf(buf, "%d\n", ((fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].qsfp_lpmode >> (attr->index - MODULE_LPMODE_33)) & 0x1)); + } else { + ret = sprintf(buf, "%d\n", 0); /*unpresent: default value*/ + } + break; + case MODULE_RESET_1 ... MODULE_RESET_32: + if(present){ + ret = sprintf(buf, "%d\n", ((fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_UDB].qsfp_reset >>(attr->index - MODULE_RESET_1)) & 0x1)?0:1); + } else { + ret = sprintf(buf, "%d\n", 0); /*unpresent: default value*/ + } + break; + case MODULE_RESET_33 ... MODULE_RESET_64: + if(present){ + ret = sprintf(buf, "%d\n", ((fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].qsfp_reset >> (attr->index - MODULE_RESET_33)) & 0x1)?0:1); + } else { + ret = sprintf(buf, "%d\n", 0); /*unpresent: default value*/ + } + break; + case MODULE_TX_DISABLE_65: + if(present){ + ret = sprintf(buf, "%d\n", (SFP_PORT0_TXDIS(fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].sfp_input_data)) & 0x1); + } else { + ret = sprintf(buf, "%d\n", 0); /*unpresent: default value*/ + } + break; + case MODULE_TX_DISABLE_66: + if(present){ + ret = sprintf(buf, "%d\n", (SFP_PORT1_TXDIS(fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].sfp_input_data)) & 0x1); + } else { + ret = sprintf(buf, "%d\n", 0); /*unpresent: default value*/ + } + break; + case MODULE_TX_FAULT_65: + if(present){ + ret = sprintf(buf, "%d\n", (SFP_PORT0_TXFLT(fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].sfp_input_data)) & 0x1); + } else { + ret = sprintf(buf, "%d\n", 1); /*unpresent: tx_fault is true*/ + } + break; + case MODULE_TX_FAULT_66: + if(present){ + ret = sprintf(buf, "%d\n", (SFP_PORT1_TXFLT(fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].sfp_input_data)) & 0x1); + } else { + ret = sprintf(buf, "%d\n", 1); /*unpresent: tx_fault is true*/ + } + break; + case MODULE_RX_LOS_65: + if(present){ + ret = sprintf(buf, "%d\n", (SFP_PORT0_RXLOS(fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].sfp_input_data)) & 0x1); + } else { + ret = sprintf(buf, "%d\n", 1); /*unpresent: rx_los is true*/ + } + break; + case MODULE_RX_LOS_66: + if(present){ + ret = sprintf(buf, "%d\n", (SFP_PORT1_RXLOS(fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].sfp_input_data)) & 0x1); + } else { + ret = sprintf(buf, "%d\n", 1); /*unpresent: rx_los is true*/ + } + break; + case PCIE_FPGA_UDB_VERSION: + ret = sprintf(buf, "%d.%d\n", (fpga_ctl->udb_version>>8) & 0x7f, fpga_ctl->udb_version & 0xff); + break; + case PCIE_FPGA_LDB_VERSION: + ret = sprintf(buf, "%d.%d\n", (fpga_ctl->ldb_version>>8) & 0x7f, fpga_ctl->ldb_version & 0xff); + break; + case PCIE_FPGA_SMB_VERSION: + ret = sprintf(buf, "%d.%d\n", (fpga_ctl->smb_version>>8) & 0x7f, fpga_ctl->smb_version & 0xff); + break; + default: + ret = -EINVAL; + break; + } + mutex_unlock(&update_lock); + + return ret; +} + +static ssize_t port_status_write(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + long value; + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct bin_attribute *eeprom = NULL; + + status = kstrtol(buf, 16, &value); + if (status) { + return status; + } + + mutex_lock(&update_lock); + + switch(attr->index) + { + case MODULE_LPMODE_1 ... MODULE_LPMODE_32: + fpga_write_port_value(PCIE_FPGA_UDB, PCIE_FPGA_SET_LPMODE, (attr->index - MODULE_LPMODE_1), !!value); + break; + case MODULE_LPMODE_33 ... MODULE_LPMODE_64: + fpga_write_port_value(PCIE_FPGA_LDB, PCIE_FPGA_SET_LPMODE, (attr->index - MODULE_LPMODE_33), !!value); + break; + case MODULE_RESET_1 ... MODULE_RESET_32: + fpga_write_port_value(PCIE_FPGA_UDB, PCIE_FPGA_SET_RESET, (attr->index - MODULE_RESET_1), !value); + break; + case MODULE_RESET_33 ... MODULE_RESET_64: + fpga_write_port_value(PCIE_FPGA_LDB, PCIE_FPGA_SET_RESET, (attr->index - MODULE_RESET_33), !value); + break; + case MODULE_RESET_ALL: + fpga_write_port_value(PCIE_FPGA_UDB, PCIE_FPGA_SET_RESET, REG_SET_ALL_32_BITS, !value); /*port 1~32*/ + fpga_write_port_value(PCIE_FPGA_LDB, PCIE_FPGA_SET_RESET, REG_SET_ALL_32_BITS, !value); /*port 33~64*/ + break; + case MODULE_TX_DISABLE_65 ... MODULE_TX_DISABLE_66: + fpga_write_port_value(PCIE_FPGA_LDB, PCIE_FPGA_SET_TX_DISABLE, ((attr->index - MODULE_TX_DISABLE_65) ? BIT(3) : BIT(11) ), !!value); /*bit3 and bit11*/ + break; + default: + mutex_unlock(&update_lock); + return -EINVAL; + } + + mutex_unlock(&update_lock); + + return count; +} + +static ssize_t port_read(struct device *dev, struct device_attribute *da, char *buf) +{ + ssize_t ret = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct platform_device *pdev = to_platform_device(dev); + struct pcie_fpga_dev_platform_data *pdata = NULL; + + pdata = pdev->dev.platform_data; + + mutex_lock(&xcvr_eeprom_lock[pdata->port_num - 1]); + switch(attr->index) + { + case PORT_SYSFS_PORT_NAME_ID: + ret = sprintf(buf, "%s\n", pdata->name); + break; + case PORT_SYSFS_NAME_ID: + ret = sprintf(buf, "%s\n", pdata->dev_name); + break; + case PORT_SYSFS_DEV_CLASS_ID: + ret = sprintf(buf, "%d\n", pdata->dev_class); + break; + default: + ret = -EINVAL; + break; + } + mutex_unlock(&xcvr_eeprom_lock[pdata->port_num - 1]); + + return ret; +} + +static ssize_t port_write(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int value; + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct platform_device *pdev = to_platform_device(dev); + struct pcie_fpga_dev_platform_data *pdata = NULL; + + pdata = pdev->dev.platform_data; + + status = kstrtoint(buf, 10, &value); + if (status) { + return status; + } + + mutex_lock(&xcvr_eeprom_lock[pdata->port_num - 1]); + switch(attr->index) + { + case PORT_SYSFS_DEV_CLASS_ID: + pdata->dev_class = value; + break; + default: + mutex_unlock(&xcvr_eeprom_lock[pdata->port_num - 1]); + return -EINVAL; + } + mutex_unlock(&xcvr_eeprom_lock[pdata->port_num - 1]); + return count; +} + +static int led_reg_val_to_light_mode(enum led_type type, u8 reg_val) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(led_type_mode_data); i++) { + + if (type != led_type_mode_data[i].type) + continue; + + if ((led_type_mode_data[i].reg_bit_mask & reg_val) == + led_type_mode_data[i].mode_value) + { + return led_type_mode_data[i].mode; + } + } + + return 0; +} + +static u8 led_light_mode_to_set_reg_val(enum led_type type, + enum led_light_mode mode, u8 reg_val) { + int i; + u8 set_val; + + for (i = 0; i < ARRAY_SIZE(led_type_mode_data); i++) { + if (type != led_type_mode_data[i].type) { + continue; + } + + if (mode != led_type_mode_data[i].mode) { + continue; + } + set_val = led_type_mode_data[i].mode_value | + (reg_val & (~led_type_mode_data[i].reg_bit_mask)); + + break; + } + + return set_val; +} + +static ssize_t led_status_read(struct device *dev, struct device_attribute *da, char *buf) +{ + u8 reg_val = 0; + int led_type = 0; + ssize_t ret = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + led_type = attr->index; + + mutex_lock(&update_lock); + + reg_val = ioread8(fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_UDB].data_base_addr + + ASLPC_DEV_UDB_CPLD2_PCIE_START_OFFST + led_reg_map[led_type].reg_addr); + + mutex_unlock(&update_lock); + + switch(led_type) + { + case LED_SYSFS_LOC: + case LED_SYSFS_STAT: + ret = sprintf(buf, "%d\n", led_reg_val_to_light_mode(led_type, reg_val)); + break; + case LED_SYSFS_FAN: + case LED_SYSFS_PSU2: + case LED_SYSFS_PSU1: + ret = sprintf(buf, "%d\n", LED_MODE_AUTO); + break; + default: + ret = -EINVAL; + break; + } + + return ret; +} + +static ssize_t led_status_write(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int status; + int value; + int led_type = 0; + u8 reg_val, set_value; + + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + led_type = attr->index; + + status = kstrtoint(buf, 10, &value); + if (status) { + return status; + } + + mutex_lock(&update_lock); + + reg_val = ioread8(fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_UDB].data_base_addr + + ASLPC_DEV_UDB_CPLD2_PCIE_START_OFFST + led_reg_map[led_type].reg_addr); + + switch(led_type) + { + case LED_SYSFS_LOC: + case LED_SYSFS_STAT: + set_value = led_light_mode_to_set_reg_val(led_type, value, reg_val); + iowrite8(set_value, fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_UDB].data_base_addr + + ASLPC_DEV_UDB_CPLD2_PCIE_START_OFFST + led_reg_map[led_type].reg_addr); + break; + case LED_SYSFS_FAN: + case LED_SYSFS_PSU2: + case LED_SYSFS_PSU1: + break; + default: + count = -EINVAL; + break; + } + + mutex_unlock(&update_lock); + + return count; +} + +/* + * eeprom read fumction + */ +static int fpga_i2c_ready_to_read(struct bin_attribute *attr, int page_type, int i2c_slave_addr) +{ + int cnt = 0; + int chk_state_cnt = 0; + unsigned long timeout, access_time; + u32 i2c_new_trigger_val = 0; + u32 flag = 0; + struct eeprom_bin_private_data *pdata = NULL; + + pdata = attr->private; + timeout = jiffies + msecs_to_jiffies(write_timeout); + + do { + access_time = jiffies; + + /*Select i2c protocol profile*/ + iowrite32(0x0, pdata->data_base_addr + pdata->i2c_mgmt_rtc0_profile); + + /*clean read data*/ + for(cnt = 0 ; cnt < 32; cnt++) + { + iowrite32(0x0, pdata->data_base_addr + ( pdata->i2c_rtc_read_data + (4 * cnt) )); + } + + /*clean done status*/ + iowrite32(0x3, pdata->data_base_addr + pdata->i2c_contrl_rtc0_stats); + + /*set read slave addr*/ + iowrite32( 0x10000080|(i2c_slave_addr << 8), pdata->data_base_addr + pdata->i2c_contrl_rtc0_config_0); + + /*triger*/ + if(page_type == EEPROM_LOWER_PAGE) { + i2c_new_trigger_val = PCIE_FPGA_I2C_NEW_TRIGGER_VALUE; + } else { + i2c_new_trigger_val = PCIE_FPGA_I2C_NEW_TRIGGER_VALUE + 0x80; + } + iowrite32(i2c_new_trigger_val, pdata->data_base_addr + pdata->i2c_contrl_rtc0_config_1); + + /*read done status*/ + while( 1 ) { + flag = ioread32(pdata->data_base_addr + pdata->i2c_contrl_rtc0_stats); + if(flag == 0) { + /*In normal case: + observed chk_state_cnt(10~120) times can get i2c rtc0 done status. */ + if( chk_state_cnt > 500 ) { + flag = -EAGAIN; + break; + } + usleep_range(50, 100); + chk_state_cnt++; + continue; + } + else { + break; + } + } + if( flag == RTC0_STATUS_0_DONE ) { + break; + } + + usleep_range(1000, 2000); + + } while (time_before(access_time, timeout)); + + return flag; +} + +static int fpga_i2c_set_data(struct bin_attribute *attr, loff_t offset, char *data, int i2c_slave_addr) +{ + int cnt = 0; + int chk_state_cnt = 0; + unsigned long timeout, access_time; + struct eeprom_bin_private_data *pdata = NULL; + u32 flag = 0; + u32 i2c_new_trigger_val = 0; + + pdata = attr->private; + timeout = jiffies + msecs_to_jiffies(write_timeout); + + do { + access_time = jiffies; + + /*Select i2c protocol profile*/ + iowrite32(0x0, pdata->data_base_addr + pdata->i2c_mgmt_rtc0_profile); + + /*clean read data*/ + for( cnt=0 ; cnt < (PCIE_FPGA_I2C_MAX_LEN/4); cnt++) + { + iowrite32(0x0, pdata->data_base_addr + ( pdata->i2c_rtc_write_data + (4 * cnt) )); + } + + /* Prepare date to set into data registor*/ + iowrite32(data[0], pdata->data_base_addr + pdata->i2c_rtc_write_data); + + /*clean done status*/ + iowrite32(0x3, pdata->data_base_addr + pdata->i2c_contrl_rtc0_stats); + + /*set write slave addr*/ + iowrite32( EEPROM_ALLOW_SET_LEN | (i2c_slave_addr << 8), pdata->data_base_addr + pdata->i2c_contrl_rtc0_config_0); + + /*triger*/ + i2c_new_trigger_val = PCIE_FPGA_I2C_NEW_TRIGGER_VALUE + offset; + iowrite32(i2c_new_trigger_val, pdata->data_base_addr + pdata->i2c_contrl_rtc0_config_1); + + /*read done status*/ + while( 1 ) { + flag = ioread32(pdata->data_base_addr + pdata->i2c_contrl_rtc0_stats); + if(flag == 0) { + /*In normal case: + observed chk_state_cnt(10~120) times can get i2c rtc0 done status. */ + if( chk_state_cnt > 500 ) { + flag = -EAGAIN; + break; + } + usleep_range(50, 100); + chk_state_cnt++; + continue; + } else { + break; + } + } + if( flag == RTC0_STATUS_0_DONE ) { + break; + } + + usleep_range(1000, 2000); + + } while (time_before(access_time, timeout)); + + return flag; +} + +static ssize_t fpga_i2c_read_data(struct bin_attribute *attr, u8 *data) +{ + int cnt = 0; + u32 read_status = 0; + ssize_t byte_size = 0; + struct eeprom_bin_private_data *pdata = NULL; + + pdata = attr->private; + + for( cnt=0 ; cnt < (PCIE_FPGA_I2C_MAX_LEN/4); cnt++) + { + read_status = ioread32(pdata->data_base_addr + (pdata->i2c_rtc_read_data + cnt*4)); + + *(data + cnt*4) = read_status & 0xff; + *(data + cnt*4 + 1) = (read_status >> 8) & 0xff; + *(data + cnt*4 + 2) = (read_status >> 16) & 0xff; + *(data + cnt*4 + 3) = (read_status >> 24) & 0xff; + + byte_size = cnt*4 + 3; + } + + return byte_size + 1; +} + +static int get_port_present_status(struct bin_attribute *attr) +{ + int present = 0; + struct eeprom_bin_private_data *pdata = NULL; + + fpga_read_port_status_value(attr); + + pdata = attr->private; + /* + * get present status: + * regval:0 is present, convert + * regval:1 is unpresent, convert + */ + if(pdata->port_num == FPGA_LDB_SFP_PORT1_NO) /*sfp:65*/ + { + present = !((SFP_PORT0_ABS(fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].sfp_input_data)) & 0x1); + } + else if(pdata->port_num == FPGA_LDB_SFP_PORT2_NO) /*sfp:66*/ + { + present = !((SFP_PORT1_ABS(fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].sfp_input_data)) & 0x1); + } + else + { + if(pdata->port_num <= FPGA_LDB_QSFP_PORT_NUM) { /*qsfp:1~32*/ + present = !((fpga_ctl->pci_fpga_dev[pdata->fpga_type].qsfp_present>>(pdata->port_num - 1)) & 0x1); + } else { /*qsfp:33~64*/ + present = !((fpga_ctl->pci_fpga_dev[pdata->fpga_type].qsfp_present>>(pdata->port_num - 33)) & 0x1); + } + } + + return present; +} + +static int get_filter_unpresent_case(struct bin_attribute *attr) +{ + int present = 0; + int err_cnt = 0; + + while(err_cnt < 2) + { + msleep(400); /*delay 0.4 second*/ + present = get_port_present_status(attr); + + if(present) { + err_cnt++; + continue; + } else { /*unpresent*/ + return 1; + } + } + + return 0; +} + +static ssize_t +sfp_eeprom_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count, int *page) +{ + int state = 0; + int page_num, slice; + char set_page_num[1] = {0}; + struct eeprom_bin_private_data *pdata = NULL; + pdata = attr->private; + + ssize_t byte_cnt; + + u8 data[128] = {0}; + + slice = off / OPTOE_PAGE_SIZE; + /*Cross page case, calculate number of count in current page*/ + if ((off + count) > (slice * OPTOE_PAGE_SIZE + OPTOE_PAGE_SIZE)) { + count = slice * OPTOE_PAGE_SIZE + OPTOE_PAGE_SIZE - off; + } + + if( slice == 0 ) + { + if( (state = fpga_i2c_ready_to_read(attr, EEPROM_LOWER_PAGE, pdata->i2c_slave_addr)) != 1) { + goto exit_err; + } + byte_cnt = fpga_i2c_read_data(attr, &data[0]); + } + else if( slice == 1 ) + { + if( (state = fpga_i2c_ready_to_read(attr, EEPROM_UPPER_PAGE, pdata->i2c_slave_addr)) != 1) { + goto exit_err; + } + byte_cnt = fpga_i2c_read_data(attr, &data[0]); + } + else + { + page_num = slice - 1; + if( pdata->port_num <= FPGA_QSFP_PORT_NUM) /*qsfp page1~0xff*/ + { + set_page_num[0] = page_num; + if( (state = fpga_i2c_set_data(attr, OPTOE_PAGE_SELECT_REG, set_page_num, pdata->i2c_slave_addr)) != 1) { + goto exit_err; + } + + if( (state = fpga_i2c_ready_to_read(attr, EEPROM_UPPER_PAGE, pdata->i2c_slave_addr)) != 1 ) { + goto exit_err; + } + byte_cnt = fpga_i2c_read_data(attr, &data[byte_cnt]); + *page = page_num; + } + else /*sfp support a2(0x51), cat behind a0(0x50)*/ + { + if(page_num == 1) /*a2 lower page*/ + { + if( (state = fpga_i2c_ready_to_read(attr, EEPROM_LOWER_PAGE, TWO_ADDR_0X51)) != 1) { + goto exit_err; + } + byte_cnt = fpga_i2c_read_data(attr, &data[0]); + } + else if (page_num == 2) /*a2 page0*/ + { + set_page_num[0] = 0; + if( (state = fpga_i2c_set_data(attr, OPTOE_PAGE_SELECT_REG, set_page_num, TWO_ADDR_0X51))!=1) { + goto exit_err; + } + + if( (state = fpga_i2c_ready_to_read(attr, EEPROM_UPPER_PAGE, TWO_ADDR_0X51)) != 1) { + goto exit_err; + } + byte_cnt = fpga_i2c_read_data(attr, &data[0]); + } + else + { + set_page_num[0] = page_num - 2; + if( (state = fpga_i2c_set_data(attr, OPTOE_PAGE_SELECT_REG, set_page_num, TWO_ADDR_0X51) != 1)) { /*set page from 1*/ + goto exit_err; + } + + if( (state = fpga_i2c_ready_to_read(attr, EEPROM_UPPER_PAGE, TWO_ADDR_0X51)) != 1 ) { + goto exit_err; + } + byte_cnt = fpga_i2c_read_data(attr, &data[byte_cnt]); + *page = page_num-2; + } + } + } + memcpy(buf, &data[off%128], count); + + return count; + +exit_err: + if( (state == RTC0_STATUS_0_ERROR) && + (get_filter_unpresent_case(attr)) ) { /*Filter xcvr unplug error case*/ + return -ENXIO; + } + pcie_err("%s ERROR(%d): Port%d pcie get(offset=0x%x) done status failed!!", show_date_time(), state, pdata->port_num, off); + + return -EBUSY; +} + +static ssize_t sfp_bin_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + int present; + int page = 0; + int state = 0; + int i2c_slave_addr; + char set_page_num[1] ={0}; + ssize_t retval = 0; + struct eeprom_bin_private_data *pdata = NULL; + pdata = attr->private; + + if (unlikely(!count)) { + return count; + } + + mutex_lock(&xcvr_eeprom_lock[pdata->port_num - 1]); + + present = get_port_present_status(attr); + if( !present ) { /*unpresent*/ + mutex_unlock(&xcvr_eeprom_lock[pdata->port_num - 1]); + return -ENODEV; + } + mutex_unlock(&xcvr_eeprom_lock[pdata->port_num - 1]); + + /* + * Read data from chip, protecting against concurrent updates + * from this host + */ + mutex_lock(&xcvr_eeprom_lock[pdata->port_num - 1]); + while (count) { + ssize_t status; + + status = sfp_eeprom_read(filp, kobj, attr, buf, off, count, &page); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + + buf += status; + off += status; + count -= status; + retval += status; + } + /* + * return the page register to page 0 - why? + * We either have to set the page register to 0 on every access + * to it, or restore it to 0 whenever we change it. Otherwise, + * accesses to page 0 would actually go to whatever the last page + * was. Assume more accesses to page 0 than all other pages + * combined, so less total accesses if we always leave it at page 0 + */ + if( (page > 0) && (pdata->pageable)) + { + i2c_slave_addr = + ( pdata->port_num > FPGA_QSFP_PORT_NUM) ? TWO_ADDR_0X51 : pdata->i2c_slave_addr; + + if( (state = fpga_i2c_set_data(attr, OPTOE_PAGE_SELECT_REG, set_page_num, i2c_slave_addr)) != 1) { /*set page to 0*/ + mutex_unlock(&xcvr_eeprom_lock[pdata->port_num - 1]); + goto exit_err; + } + } + mutex_unlock(&xcvr_eeprom_lock[pdata->port_num - 1]); + + return retval; + +exit_err: + if( (state == RTC0_STATUS_0_ERROR) && + (get_filter_unpresent_case(attr)) ) { /*Filter xcvr unplug error case*/ + return -ENXIO; + } + pcie_err("%s ERROR(%d): Port%d pcie get(offset=0x%x) done status failed!!", show_date_time(), state, pdata->port_num, off); + + return -EBUSY; +} + +static ssize_t +sfp_eeprom_write(struct bin_attribute *attr, char *buf, loff_t off, size_t count) +{ + int state = 0; + int page_num, slice, offset; + char set_page_num[1] = {0}; + struct eeprom_bin_private_data *pdata = NULL; + pdata = attr->private; + + slice = off / OPTOE_PAGE_SIZE; + page_num = slice - 1; + offset = off; + + if( page_num > 0) + { + set_page_num[0] = page_num; + if( (state = fpga_i2c_set_data(attr, OPTOE_PAGE_SELECT_REG, set_page_num, pdata->i2c_slave_addr)) != 1) { + goto exit_err; + } + offset = OPTOE_PAGE_SIZE + (off % OPTOE_PAGE_SIZE); + } + + if( (state = fpga_i2c_set_data(attr, offset, buf, pdata->i2c_slave_addr)) != 1) { + goto exit_err; + } + + /* + * If change page, we either have to set the page register to 0 on every access + * to it, or restore it to 0 whenever we change it. + */ + if( page_num > 0) + { + set_page_num[0] = 0; + if( (state = fpga_i2c_set_data(attr, OPTOE_PAGE_SELECT_REG, set_page_num, pdata->i2c_slave_addr)) != 1) { + goto exit_err; + } + } + + return count; + +exit_err: + if( (state == RTC0_STATUS_0_ERROR) && + (get_filter_unpresent_case(attr)) ) { /*Filter xcvr unplug error case*/ + return -ENXIO; + } + pcie_err("%s ERROR(%d): Port%d pcie set (offset=0x%x, value=0x%x) failed!!", show_date_time(), state, pdata->port_num, off, (unsigned char)buf[0]); + + return -EBUSY; +} + +static ssize_t sfp_bin_write(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + int present; + ssize_t status = 0; + + struct eeprom_bin_private_data *pdata = NULL; + pdata = attr->private; + + if (unlikely(!count) || + likely(count > EEPROM_ALLOW_SET_LEN)) { //only allow count = 1 + return count; + } + + mutex_lock(&xcvr_eeprom_lock[pdata->port_num - 1]); + + present = get_port_present_status(attr); + if( !present ) { /*unpresent*/ + mutex_unlock(&xcvr_eeprom_lock[pdata->port_num - 1]); + return -ENODEV; + } + mutex_unlock(&xcvr_eeprom_lock[pdata->port_num - 1]); + + /* + * Write data to chip, protecting against concurrent updates + * from this host. + */ + mutex_lock(&xcvr_eeprom_lock[pdata->port_num - 1]); + + status = sfp_eeprom_write(attr, buf, off, count); + + mutex_unlock(&xcvr_eeprom_lock[pdata->port_num - 1]); + + return status; +} + +static int check_qsfp_eeprom_pageable(struct bin_attribute *eeprom) +{ + int ret = 0; + int not_pageable; + u8 identifier_reg; + u8 pageable_reg; + u32 read_status = 0; + + struct eeprom_bin_private_data *pdata = NULL; + + pdata = eeprom->private; + + ret = fpga_i2c_ready_to_read(eeprom, EEPROM_LOWER_PAGE, pdata->i2c_slave_addr); + + if(ret != 1) { + /* If user space code create port_eeprom sysfs when 400G insert. + * FPGA FW can't handle data quickly. Status code (ret) is 2 (busy). + * We let default case to support pageable. + * PS:This fix if 400G try read bigger than 256 bytes data. But sysfs only is 256 bytes + */ + pdata->pageable = 1; /*This flag need to set 1, otherwise page-0 data can not get*/ + + return pdata->pageable; + } + + read_status = ioread32(pdata->data_base_addr + (pdata->i2c_rtc_read_data)); + + identifier_reg = read_status & 0xff; + pageable_reg = (read_status >> 16) & 0xff; /*check on bit2*/ + + if(identifier_reg == QSFPDD_TYPE) { + not_pageable = CMIS_NOT_PAGEABLE; + } else { + not_pageable = QSFP_NOT_PAGEABLE; + } + + if(pageable_reg & not_pageable) { /*not support*/ + pdata->pageable = 0; + } else { + pdata->pageable = 1; + } + + return pdata->pageable; +} + +static int sfp_sysfs_eeprom_init(struct kobject *kobj, struct bin_attribute *eeprom) +{ + int err; + int ret; + int present = 0; + struct eeprom_bin_private_data *pdata = NULL; + + pdata = eeprom->private; + + sysfs_bin_attr_init(eeprom); + eeprom->attr.name = EEPROM_SYSFS_NAME; + eeprom->attr.mode = S_IWUSR | S_IRUGO; + eeprom->read = sfp_bin_read; + eeprom->write = sfp_bin_write; + + mutex_lock(&xcvr_eeprom_lock[pdata->port_num - 1]); + + present = get_port_present_status(eeprom); + + if(pdata->port_num > FPGA_QSFP_PORT_NUM) /*sfp*/ + { + if( !present ) { /*unpresent*/ + eeprom->size = TWO_ADDR_NO_0X51_SIZE; + } + else + { + ret = fpga_read_sfp_ddm_status_value(eeprom); /*check support_a2 and pageable*/ + if(ret < 0) { + pcie_err("Err: PCIE device port eeprom is empty"); + mutex_unlock(&xcvr_eeprom_lock[pdata->port_num - 1]); + return ret; + } + + if( !(pdata->sfp_support_a2) ) { /*no A2(0x51)*/ + eeprom->size = TWO_ADDR_NO_0X51_SIZE; + } + else { + eeprom->size = ( (pdata->sfp_support_a2) && (!pdata->pageable) ) ? TWO_ADDR_EEPROM_UNPAGED_SIZE : TWO_ADDR_EEPROM_SIZE; + } + } + } + else /*qsfp*/ + { + if( !present ) { /*unpresent*/ + eeprom->size = OPTOE_ARCH_PAGES; + } else { + eeprom->size = ( check_qsfp_eeprom_pageable(eeprom) ) ? ONE_ADDR_EEPROM_SIZE : ONE_ADDR_EEPROM_UNPAGED_SIZE; + } + } + + mutex_unlock(&xcvr_eeprom_lock[pdata->port_num - 1]); + + /* Create eeprom file */ + err = sysfs_create_bin_file(kobj, eeprom); + if (err) { + return err; + } + + return 0; +} + +static int as9736_64d_pcie_fpga_stat_probe (struct platform_device *pdev) +{ + int cnt = 0, status = 0, port_index = 0; + int err_cnt, disable_cnt, release_cnt; + int find_flag = 0; /*UDB and LDB*/ + int err = 0; + int fpga_no = 0; + struct pci_dev *pcidev, *pcidev_from; + + u16 id16 = 0; + + /* Find Accton register memory space */ + for(cnt = 0 ; cnt < FPGA_NUM ; cnt++) + { + pcidev = pci_get_device(PCI_VENDOR_ID_ACCTON, PCI_DEVICE_ID_ACCTON, (cnt == 0) ? NULL : pcidev_from); + + /*Init*/ + fpga_ctl->pci_dev_addr[cnt] = NULL; + + if (!pcidev && !cnt ) { /*Failed at first time*/ + return -ENODEV; + } + fpga_ctl->pci_dev_addr[cnt] = pcidev; + + /* Enable device: Ask low-level code to enable I/O and memory */ + err = pci_enable_device(pcidev); + if (err != 0) { + pcie_err("Cannot enable PCI(%d) device\n", cnt); + disable_cnt = cnt - 1; + status = -ENODEV; + goto exit_pci_disable; + } + + if ( pci_read_config_word(pcidev, PCI_SUBSYSTEM_ID, &id16) ) + { + disable_cnt = cnt; + status = -ENODEV; + goto exit_pci_disable; + } + pcie_info("Found PCI Device: %s", FPGA_NAME[id16]); + + err = pci_request_regions(pcidev, FPGA_NAME[id16]); + if (err != 0) { + pcie_err("[%s] cannot request regions\n", FPGA_NAME[id16]); + release_cnt = cnt - 1; + disable_cnt = cnt; + goto exit_pci_release; + } + + switch(id16) + { + case PCI_SUBSYSTEM_ID_UDB: + fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_UDB].fpga_pdev = pcidev; + fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_UDB].id = PCI_SUBSYSTEM_ID_UDB; + fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_UDB].aslpc_cpld1_offset = ASLPC_DEV_UDB_CPLD1_PCIE_START_OFFST; + fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_UDB].aslpc_cpld2_offset = ASLPC_DEV_UDB_CPLD2_PCIE_START_OFFST; + fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_UDB].data_base_addr = pci_iomap(pcidev, BAR0_NUM, 0); /*0: means access to the complete BAR*/ + fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_UDB].data_mmio_start = pci_resource_start(pcidev, BAR0_NUM); + fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_UDB].data_mmio_len = pci_resource_len(pcidev, BAR0_NUM); + + /*Init eeprom (UDB)private data: I/O base address*/ + for(port_index = 0 ; port_index < FPGA_UDB_QSFP_PORT_NUM ; port_index++) { + pcie_udb_eeprom_bin_private_data[port_index].data_base_addr = fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_UDB].data_base_addr; + } + + pcie_info("(BAR%d resource: Start=0x%lx, Length=%lx)", BAR0_NUM, + (unsigned long)fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_UDB].data_mmio_start, + (unsigned long)fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_UDB].data_mmio_len); + + find_flag++; + break; + case PCI_SUBSYSTEM_ID_LDB: + fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].fpga_pdev = pcidev; + fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].id = PCI_SUBSYSTEM_ID_LDB; + fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].aslpc_cpld1_offset = ASLPC_DEV_LDB_CPLD1_PCIE_START_OFFST; + fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].aslpc_cpld2_offset = ASLPC_DEV_LDB_CPLD2_PCIE_START_OFFST; + fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].data_base_addr = pci_iomap(pcidev, BAR0_NUM, 0); /*0: means access to the complete BAR*/ + fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].data_mmio_start = pci_resource_start(pcidev, BAR0_NUM); + fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].data_mmio_len = pci_resource_len(pcidev, BAR0_NUM); + + /*Init eeprom (LDB)private data: I/O base address*/ + for(port_index = 0 ; port_index < (FPGA_LDB_QSFP_PORT_NUM + FPGA_LDB_SFP_PORT_NUM) ; port_index++) { + pcie_ldb_eeprom_bin_private_data[port_index].data_base_addr = fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].data_base_addr; + } + + pcie_info("(BAR%d resource: Start=0x%lx, Length=%lx)", BAR0_NUM, + (unsigned long)fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].data_mmio_start, + (unsigned long)fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].data_mmio_len); + + find_flag++; + break; + case PCI_SUBSYSTEM_ID_SMB: + fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_SMB].fpga_pdev = pcidev; + fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_SMB].id = PCI_SUBSYSTEM_ID_SMB; + fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_SMB].aslpc_cpld1_offset = ASLPC_DEV_SMB_CPLD_PCIE_START_OFFST; + fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_SMB].aslpc_cpld2_offset = 0; + fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_SMB].data_base_addr = pci_iomap(pcidev, BAR0_NUM, 0); /*0: means access to the complete BAR*/ + fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_SMB].data_mmio_start = pci_resource_start(pcidev, BAR0_NUM); + fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_SMB].data_mmio_len = pci_resource_len(pcidev, BAR0_NUM); + + pcie_info("(BAR%d resource: Start=0x%lx, Length=%lx)", BAR0_NUM, + (unsigned long)fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_SMB].data_mmio_start, + (unsigned long)fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_SMB].data_mmio_len); + break; + default: + status = -ENODEV; + break; + } + pcidev_from = pcidev; + } + release_cnt = cnt; + disable_cnt = cnt; + + if ( find_flag != (FPGA_NUM-1) ) { + dev_err(&pdev->dev, "Failed found UDB/LDB FPAG device!!\n"); + status = -ENODEV; + goto exit_pci_iounmap; + } + + status = sysfs_create_group(&pdev->dev.kobj, &fpga_port_stat_group); + if (status) { + goto exit_pci_iounmap; + } + + mutex_lock(&update_lock); + + /*set gpio input/output*/ + iowrite32(0x707, fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].data_base_addr + SFP_LDB_GPIO1_DATA_EN); + + /* QSFP Port LED: Init port Enable >> LDB/UDB (0 >> 1) */ + for(fpga_no = PCI_SUBSYSTEM_ID_LDB; fpga_no >= PCI_SUBSYSTEM_ID_UDB; fpga_no--) + { + for(cnt = 0; cnt <= 1; cnt++) { + iowrite8(0xff, fpga_ctl->pci_fpga_dev[fpga_no].data_base_addr + + fpga_ctl->pci_fpga_dev[fpga_no].aslpc_cpld1_offset + 0xb0 + cnt); + } + for(cnt = 0; cnt <= 1; cnt++) { + iowrite8(0xff, fpga_ctl->pci_fpga_dev[fpga_no].data_base_addr + + fpga_ctl->pci_fpga_dev[fpga_no].aslpc_cpld2_offset + 0xb0 + cnt); + } + } + /* QSFP Port LED: Init present >> LDB/UDB (1 >> 0) */ + for(fpga_no = PCI_SUBSYSTEM_ID_LDB; fpga_no >= PCI_SUBSYSTEM_ID_UDB; fpga_no--) + { + for(cnt = 0; cnt <= 1; cnt++) { + iowrite8(0x0, fpga_ctl->pci_fpga_dev[fpga_no].data_base_addr + + fpga_ctl->pci_fpga_dev[fpga_no].aslpc_cpld1_offset + 0xb8 + cnt); + } + for(cnt = 0; cnt <= 1; cnt++) { + iowrite8(0x0, fpga_ctl->pci_fpga_dev[fpga_no].data_base_addr + + fpga_ctl->pci_fpga_dev[fpga_no].aslpc_cpld2_offset + 0xb8 + cnt); + } + } + /* SFP Port LED: Init 2XSFP Port Eanble & Present */ + iowrite8(0x3, fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].data_base_addr + + fpga_ctl->pci_fpga_dev[PCI_SUBSYSTEM_ID_LDB].aslpc_cpld1_offset + 0xbd); + + mutex_unlock(&update_lock); + + return 0; + +exit_pci_iounmap: + for(err_cnt = (FPGA_NUM-1); err_cnt >=0; err_cnt--) { + pci_iounmap(fpga_ctl->pci_dev_addr[err_cnt], fpga_ctl->pci_fpga_dev[err_cnt].data_base_addr); + } +exit_pci_release: + for(err_cnt = release_cnt; err_cnt >=0; err_cnt--) { + pci_release_regions(fpga_ctl->pci_dev_addr[err_cnt]); + } +exit_pci_disable: + for(err_cnt = disable_cnt; err_cnt >=0; err_cnt--) { + pci_disable_device(fpga_ctl->pci_dev_addr[err_cnt]); + } + + return status; +} + +static int as9736_64d_pcie_fpga_stat_remove(struct platform_device *pdev) +{ + int cnt = 0; + sysfs_remove_group(&pdev->dev.kobj, &fpga_port_stat_group); + + for(cnt = (FPGA_NUM - 1); cnt >= 0; cnt--) { + pci_iounmap(fpga_ctl->pci_dev_addr[cnt], fpga_ctl->pci_fpga_dev[cnt].data_base_addr); + pci_release_regions(fpga_ctl->pci_dev_addr[cnt]); + pci_disable_device(fpga_ctl->pci_dev_addr[cnt]); + } + + return 0; +} + +static int as9736_64d_pcie_fpga_sfp_probe (struct platform_device *pdev) +{ + int status = 0; + + struct pcie_fpga_dev_platform_data *pdata = NULL; + + pdata = pdev->dev.platform_data; + + if (!pdata) { + status = -ENOMEM; + pcie_err("kzalloc failed\n"); + goto exit; + } + + /*assign port num*/ + if(pdata->fpga_type==PCIE_FPGA_TYPE_LDB) { + sprintf(pdata->name, "port%d", pdata->port_num + 32); + } else { + sprintf(pdata->name, "port%d", pdata->port_num); + } + + status = sysfs_create_group(&pdev->dev.kobj, &fpga_eeprom_group); + if (status) { + pcie_err("sysfs_create_group failed\n"); + goto exit; + } + + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&pdev->dev.kobj, &pdata->eeprom_bin); + if (status) { + pcie_err("sfp_sysfs_eeprom_init failed\n"); + goto exit_remove; + } + + return 0; + +exit_remove: + sysfs_remove_group(&pdev->dev.kobj, &fpga_eeprom_group); +exit: + return status; +} + +static int __exit as9736_64d_pcie_fpga_sfp_remove(struct platform_device *pdev) +{ + struct pcie_fpga_dev_platform_data *pdata = NULL; + + pdata = pdev->dev.platform_data; + + sysfs_remove_bin_file(&pdev->dev.kobj, &pdata->eeprom_bin); + sysfs_remove_group(&pdev->dev.kobj, &fpga_eeprom_group); + + return 0; +} + +static struct platform_driver pcie_fpga_port_stat_driver = { + .probe = as9736_64d_pcie_fpga_stat_probe, + .remove = as9736_64d_pcie_fpga_stat_remove, + .driver = { + .owner = THIS_MODULE, + .name = DRVNAME, + }, +}; + +static struct platform_driver pcie_udb_fpga_driver = { + .probe = as9736_64d_pcie_fpga_sfp_probe, + .remove = __exit_p(as9736_64d_pcie_fpga_sfp_remove), + .driver = { + .owner = THIS_MODULE, + .name = "pcie_udb_fpga_device", + } +}; + +static struct platform_driver pcie_ldb_fpga_driver = { + .probe = as9736_64d_pcie_fpga_sfp_probe, + .remove = __exit_p(as9736_64d_pcie_fpga_sfp_remove), + .driver = { + .owner = THIS_MODULE, + .name = "pcie_ldb_fpga_device", + } +}; + +static int __init as9736_64d_pcie_fpga_init(void) +{ + int status = 0; + int err_cnt; + + int udb_fpga_cnt = 0, ldb_fpga_cnt = 0, ldb_fpga_sfp_ddm_cnt = 0; + + /*Step1. + *Init UDB, LDB port status driver*/ + mutex_init(&update_lock); + + fpga_ctl = kzalloc(sizeof(struct as9736_64d_fpga_data), GFP_KERNEL); + if (!fpga_ctl) { + status = -ENOMEM; + platform_driver_unregister(&pcie_fpga_port_stat_driver); + goto exit; + } + + status = platform_driver_register(&pcie_fpga_port_stat_driver); + if (status < 0) { + goto exit; + } + + fpga_ctl->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(fpga_ctl->pdev)) { + status = PTR_ERR(fpga_ctl->pdev); + goto exit_pci; + } + + /*Step2. Init port device driver*/ + + /*UDB driver*/ + status = platform_driver_register(&pcie_udb_fpga_driver); + if (status < 0) { + pcie_err("Fail to register udb_fpga driver\n"); + goto exit_pci; + } + + /*UDB port1-32 qsfp device*/ + for (udb_fpga_cnt = 0; udb_fpga_cnt < ARRAY_SIZE(pcie_udb_qsfp_device); udb_fpga_cnt++) + { + status = platform_device_register(&pcie_udb_qsfp_device[udb_fpga_cnt]); + if (status) { + pcie_err("Fail to register (UDB)port%d device.\n", (udb_fpga_cnt + 1) ); + goto exit_udb_fpga; + } + xcvr_eeprom_lock[udb_fpga_cnt] = pcie_udb_qsfp_device[udb_fpga_cnt].dev.mutex; + mutex_init(&xcvr_eeprom_lock[udb_fpga_cnt]); + } + pcie_info("Init UDB_FPGA driver and device."); + + /*LDB driver*/ + status = platform_driver_register(&pcie_ldb_fpga_driver); + if (status < 0) { + pcie_err("Fail to register ldb_fpga driver.\n"); + goto exit_udb_fpga; + } + /*LDB port33-64, 65-66 qsfp and sfp device*/ + for (ldb_fpga_cnt = 0; ldb_fpga_cnt < ARRAY_SIZE(pcie_ldb_qsfp_device); ldb_fpga_cnt++) + { + status = platform_device_register(&pcie_ldb_qsfp_device[ldb_fpga_cnt]); + if (status) { + pcie_err("Fail to register (LDB)port%d device.\n", (ldb_fpga_cnt + 33) ); + goto exit_ldb_fpga; + } + xcvr_eeprom_lock[ldb_fpga_cnt+FPGA_UDB_QSFP_PORT_NUM] = pcie_ldb_qsfp_device[ldb_fpga_cnt].dev.mutex; + mutex_init(&xcvr_eeprom_lock[ldb_fpga_cnt+FPGA_UDB_QSFP_PORT_NUM]); + } + pcie_info("Init LDB_FPGA driver and device."); + + return 0; + +exit_ldb_fpga: + for(err_cnt=(ldb_fpga_cnt-1);err_cnt>=0;err_cnt--){ + platform_device_unregister(&pcie_ldb_qsfp_device[err_cnt]); + } + platform_driver_unregister(&pcie_ldb_fpga_driver); +exit_udb_fpga: + for(err_cnt=(udb_fpga_cnt-1);err_cnt>=0;err_cnt--){ + platform_device_unregister(&pcie_udb_qsfp_device[err_cnt]); + } + platform_driver_unregister(&pcie_udb_fpga_driver); +exit_pci: + platform_driver_unregister(&pcie_fpga_port_stat_driver); + kfree(fpga_ctl); +exit: + return status; +} + +static void __exit as9736_64d_pcie_fpga_exit(void) +{ + int i = 0; + + /*LDB qsfp port33-64, sfp port65-66*/ + for ( i = 0; i < ARRAY_SIZE(pcie_ldb_qsfp_device); i++ ) { + platform_device_unregister(&pcie_ldb_qsfp_device[i]); + } + platform_driver_unregister(&pcie_ldb_fpga_driver); + pcie_info("Remove LDB_FPGA driver and device."); + + /*UDB qsfp port1-32 */ + for ( i = 0; i < ARRAY_SIZE(pcie_udb_qsfp_device); i++ ) { + platform_device_unregister(&pcie_udb_qsfp_device[i]); + } + platform_driver_unregister(&pcie_udb_fpga_driver); + pcie_info("Remove UDB_FPGA driver and device."); + + /*UDB and LDB get port status*/ + platform_device_unregister(fpga_ctl->pdev); + platform_driver_unregister(&pcie_fpga_port_stat_driver); + pcie_info("Remove FPGA status driver."); + kfree(fpga_ctl); +} + + +module_init(as9736_64d_pcie_fpga_init); +module_exit(as9736_64d_pcie_fpga_exit); + +MODULE_AUTHOR("Michael Shih "); +MODULE_DESCRIPTION("AS9734-64D READ EEPROM From FPGA via PCIE"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/modules/accton_as9736_64d_psu.c b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/modules/accton_as9736_64d_psu.c new file mode 100755 index 0000000000..65ff06bcca --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/modules/accton_as9736_64d_psu.c @@ -0,0 +1,326 @@ +/* + * An hwmon driver for accton as9736_64d Power Module + * + * Copyright (C) 2014 Accton Technology Corporation. + * Michael Shih + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#define __STDC_WANT_LIB_EXT1__ 1 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_MODEL_NAME 12 +#define MAX_SERIAL_NUMBER 11 + +static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_string(struct device *dev, struct device_attribute *da, char *buf); +static int as9736_64d_psu_read_block(struct i2c_client *client, u8 command, u8 *data,int data_len); +extern int as9736_64d_cpld_read(unsigned short cpld_addr, u8 reg); + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { 0x50, 0x51, I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct as9736_64d_psu_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 index; /* PSU index */ + u8 status_present; /* Status(present) register read from CPLD */ + u8 status_pwr_good; /* Status(power_good) register read from CPLD */ + char model_name[MAX_MODEL_NAME+1]; /* Model name, read from eeprom */ + char serial_number[MAX_SERIAL_NUMBER+1]; +}; + +static struct as9736_64d_psu_data *as9736_64d_psu_update_device(struct device *dev); + +enum as9736_64d_psu_sysfs_attributes { + PSU_PRESENT, + PSU_MODEL_NAME, + PSU_POWER_GOOD, + PSU_SERIAL_NUMBER +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, show_status, NULL, PSU_PRESENT); +static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_string, NULL, PSU_MODEL_NAME); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_status, NULL, PSU_POWER_GOOD); +static SENSOR_DEVICE_ATTR(psu_serial_number, S_IRUGO, show_string, NULL, PSU_SERIAL_NUMBER); + + +static struct attribute *as9736_64d_psu_attributes[] = { + &sensor_dev_attr_psu_present.dev_attr.attr, + &sensor_dev_attr_psu_model_name.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + &sensor_dev_attr_psu_serial_number.dev_attr.attr, + NULL +}; + +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as9736_64d_psu_data *data = as9736_64d_psu_update_device(dev); + u8 status = 0; + + if (attr->index == PSU_PRESENT) { + status = !(data->status_present >> data->index & 0x1); + } + else { /* PSU_POWER_GOOD */ + status = (data->status_pwr_good >> (1-data->index) & 0x1); + } + + return sprintf(buf, "%d\n", status); +} + +static ssize_t show_string(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as9736_64d_psu_data *data = as9736_64d_psu_update_device(dev); + char *ptr = NULL; + + if (!data->valid) { + return -EIO; + } + + switch (attr->index) { + case PSU_MODEL_NAME: + ptr = data->model_name; + break; + case PSU_SERIAL_NUMBER: + ptr = data->serial_number; + break; + default: + return -EINVAL; + } + + return sprintf(buf, "%s\n", ptr); +} + +static const struct attribute_group as9736_64d_psu_group = { + .attrs = as9736_64d_psu_attributes, +}; + +static int as9736_64d_psu_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as9736_64d_psu_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as9736_64d_psu_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + data->index = dev_id->driver_data; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as9736_64d_psu_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as9736_64d_psu_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as9736_64d_psu_remove(struct i2c_client *client) +{ + struct as9736_64d_psu_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as9736_64d_psu_group); + kfree(data); + + return 0; +} + +enum psu_index +{ + as9736_64d_psu1, + as9736_64d_psu2 +}; + +static const struct i2c_device_id as9736_64d_psu_id[] = { + { "as9736_64d_psu1", as9736_64d_psu1 }, + { "as9736_64d_psu2", as9736_64d_psu2 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as9736_64d_psu_id); + +static struct i2c_driver as9736_64d_psu_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "as9736_64d_psu", + }, + .probe = as9736_64d_psu_probe, + .remove = as9736_64d_psu_remove, + .id_table = as9736_64d_psu_id, + .address_list = normal_i2c, +}; + +static int as9736_64d_psu_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int result = 0; + int retry_count = 5; + + while (retry_count) { + retry_count--; + + result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + + if (unlikely(result < 0)) { + msleep(10); + continue; + } + + if (unlikely(result != data_len)) { + result = -EIO; + msleep(10); + continue; + } + + result = 0; + break; + } + + return result; +} + +static struct as9736_64d_psu_data *as9736_64d_psu_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as9736_64d_psu_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int status; + int status_present, status_pwr_good; + int power_good = 0; + + dev_dbg(&client->dev, "Starting as9736_64d update\n"); + + /* Read psu status */ + status_present = as9736_64d_cpld_read(0x60, 0x14); + status_pwr_good = as9736_64d_cpld_read(0x60, 0x90); + + if ( (status_present < 0) || (status_pwr_good < 0) ) { + dev_dbg(&client->dev, "cpld reg 0x60 offse 0x14 is %d\n", status_present); + dev_dbg(&client->dev, "cpld reg 0x60 offset 0x90 is %d\n", status_pwr_good); + } + else { + data->status_present = status_present; + data->status_pwr_good = status_pwr_good; + } + + /* Read model name */ +#ifdef __STDC_LIB_EXT1__ + memset_s(data->model_name, sizeof(data->model_name), 0, sizeof(data->model_name)); +#else + memset(data->model_name, 0, sizeof(data->model_name)); +#endif +#ifdef __STDC_LIB_EXT1__ + memset_s(data->serial_number, sizeof(data->serial_number), 0, sizeof(data->serial_number)); +#else + memset(data->serial_number, 0, sizeof(data->serial_number)); +#endif + power_good = (data->status_pwr_good >> (1-data->index) & 0x1); + + if (power_good) { + status = as9736_64d_psu_read_block(client, 0x12, data->model_name, + ARRAY_SIZE(data->model_name)-1); + if (status < 0) { + data->model_name[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x)\n", client->addr); + } + else { + data->model_name[ARRAY_SIZE(data->model_name)-1] = '\0'; + + } + /* Read from offset 0x2e ~ 0x3d (16 bytes) */ + status = as9736_64d_psu_read_block(client, 0x3f, data->serial_number, MAX_SERIAL_NUMBER); + if (status < 0) + { + data->serial_number[0] = '\0'; + dev_dbg(&client->dev, "unable to read model name from (0x%x) offset(0x2e)\n", client->addr); + } + data->serial_number[MAX_SERIAL_NUMBER-1]='\0'; + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +module_i2c_driver(as9736_64d_psu_driver); + +MODULE_AUTHOR("Michael Shih "); +MODULE_DESCRIPTION("as9736_64d_psu driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/modules/accton_i2c_psu.c b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/modules/accton_i2c_psu.c new file mode 100755 index 0000000000..6e74398976 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/modules/accton_i2c_psu.c @@ -0,0 +1,699 @@ +/* + * An hwmon driver for the Accton Redundant Power Module + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_DESCRIPTION_NAME "accton i2c psu driver" +/* PMBus Protocol. */ +#define PMBUS_LITERAL_DATA_MULTIPLIER 1000 +#define PMBUS_REGISTER_VOUT_MODE 0x20 +#define PMBUS_REGISTER_STATUS_BYTE 0x78 +#define PMBUS_REGISTER_STATUS_WORD 0x79 +#define PMBUS_REGISTER_STATUS_FAN 0x81 +#define PMBUS_REGISTER_READ_VIN 0x88 +#define PMBUS_REGISTER_READ_IIN 0x89 +#define PMBUS_REGISTER_READ_VOUT 0x8B +#define PMBUS_REGISTER_READ_IOUT 0x8C +#define PMBUS_REGISTER_READ_TEMPERATURE_1 0x8D +#define PMBUS_REGISTER_READ_TEMPERATURE_2 0x8E +#define PMBUS_REGISTER_READ_TEMPERATURE_3 0x8F +#define PMBUS_REGISTER_READ_FAN_SPEED_1 0x90 +#define PMBUS_REGISTER_READ_FAN_SPEED_2 0x91 + +#define PMBUS_REGISTER_READ_FAN_CONFIG_1 0x3A +#define PMBUS_REGISTER_FAN_COMMAND_1 0x3B + +#define PMBUS_REGISTER_READ_POUT 0x96 +#define PMBUS_REGISTER_READ_PIN 0x97 +#define PMBUS_REGISTER_MFR_ID 0x99 +#define PMBUS_REGISTER_MFR_MODEL 0x9A +#define PMBUS_REGISTER_MFR_REVISION 0x9B +#define PMBUS_REGISTER_MFR_SERIAL 0x9E + +#define PMBUS_REGISTER_READ_VIN_MIN 0xa0 +#define PMBUS_REGISTER_READ_VIN_MAX 0xa1 +#define PMBUS_REGISTER_READ_IIN_MAX 0xa2 +#define PMBUS_REGISTER_READ_PIN_MAX 0xa3 +#define PMBUS_REGISTER_READ_VOUT_MIN 0xa4 +#define PMBUS_REGISTER_READ_VOUT_MAX 0xa5 +#define PMBUS_REGISTER_READ_IOUT_MAX 0xa6 +#define PMBUS_REGISTER_READ_POUT_MAX 0xa7 +#define PMBUS_REGISTER_READ_TEMP_MAX 0xa8 +#define PMBUS_REGISTER_READ_TEMP_MIN 0xa9 + +#define MAX_FAN_DUTY_CYCLE 100 +#define I2C_RW_RETRY_COUNT 10 +#define I2C_RW_RETRY_INTERVAL 60 /* ms */ + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct accton_i2c_psu_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 vout_mode; /* Register value */ + u16 v_in; /* Register value */ + u16 v_out; /* Register value */ + u16 i_in; /* Register value */ + u16 i_out; /* Register value */ + u16 p_in; /* Register value */ + u16 p_out; /* Register value */ + u16 temp_input[2]; /* Register value */ + u8 fan_fault; /* Register value */ + u16 fan_duty_cycle[2]; /* Register value */ + u16 fan_speed[2]; /* Register value */ + u8 pmbus_revision; /* Register value */ + u8 mfr_id[16]; /* Register value */ + u8 mfr_model[16]; /* Register value */ + u8 mfr_revsion[8]; /* Register value */ + u8 mfr_serial[16]; /* Register value */ + u16 mfr_vin_min; /* Register value */ + u16 mfr_vin_max; /* Register value */ + u16 mfr_iin_max; /* Register value */ + u16 mfr_iout_max; /* Register value */ + u16 mfr_pin_max; /* Register value */ + u16 mfr_pout_max; /* Register value */ + u16 mfr_vout_min; /* Register value */ + u16 mfr_vout_max; /* Register value */ + u16 mfr_tambient_max; /* Register value */ + u16 mfr_tambient_min; /* Register value */ +}; + +static ssize_t show_linear(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_vout(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t show_ascii(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t show_byte(struct device *dev, struct device_attribute *da, + char *buf); + +static int accton_i2c_psu_write_word(struct i2c_client *client, u8 reg, u16 value); +static struct accton_i2c_psu_data *accton_i2c_psu_update_device(struct device *dev); + +enum accton_i2c_psu_sysfs_attributes { + PSU_V_IN, + PSU_V_OUT, + PSU_I_IN, + PSU_I_OUT, + PSU_P_IN, + PSU_P_OUT_UV, + PSU_P_OUT, + PSU_TEMP1_INPUT, + PSU_FAN1_FAULT, + PSU_FAN1_DUTY_CYCLE, + PSU_FAN1_SPEED, + PSU_PMBUS_REVISION, + PSU_MFR_ID, + PSU_MFR_MODEL, + PSU_MFR_REVISION, + PSU_MFR_SERIAL, + PSU_MFR_VIN_MIN, + PSU_MFR_VIN_MAX, + PSU_MFR_VOUT_MIN, + PSU_MFR_VOUT_MAX, + PSU_MFR_IIN_MAX, + PSU_MFR_IOUT_MAX, + PSU_MFR_PIN_MAX, + PSU_MFR_POUT_MAX, + PSU_MFR_TAMBIENT_MAX, + PSU_MFR_TAMBIENT_MIN +}; + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_v_in, S_IRUGO, show_linear, NULL, PSU_V_IN); +static SENSOR_DEVICE_ATTR(psu_v_out, S_IRUGO, show_vout, NULL, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(psu_i_in, S_IRUGO, show_linear, NULL, PSU_I_IN); +static SENSOR_DEVICE_ATTR(psu_i_out, S_IRUGO, show_linear, NULL, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(psu_p_in, S_IRUGO, show_linear, NULL, PSU_P_IN); +static SENSOR_DEVICE_ATTR(psu_p_out, S_IRUGO, show_linear, NULL, PSU_P_OUT); +static SENSOR_DEVICE_ATTR(psu_temp1_input, S_IRUGO, show_linear, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(psu_fan1_fault, S_IRUGO, show_fan_fault, NULL, PSU_FAN1_FAULT); +static SENSOR_DEVICE_ATTR(psu_fan1_duty_cycle_percentage, S_IWUSR | S_IRUGO, show_linear, set_fan_duty_cycle, PSU_FAN1_DUTY_CYCLE); +static SENSOR_DEVICE_ATTR(psu_fan1_speed_rpm, S_IRUGO, show_linear, NULL, PSU_FAN1_SPEED); +static SENSOR_DEVICE_ATTR(psu_pmbus_revision,S_IRUGO, show_byte, NULL, PSU_PMBUS_REVISION); +static SENSOR_DEVICE_ATTR(psu_mfr_id, S_IRUGO, show_ascii, NULL, PSU_MFR_ID); +static SENSOR_DEVICE_ATTR(psu_mfr_model, S_IRUGO, show_ascii, NULL, PSU_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu_mfr_revision, S_IRUGO, show_ascii, NULL, PSU_MFR_REVISION); +static SENSOR_DEVICE_ATTR(psu_mfr_serial, S_IRUGO, show_ascii, NULL, PSU_MFR_SERIAL); +static SENSOR_DEVICE_ATTR(psu_mfr_vin_min, S_IRUGO, show_linear, NULL, PSU_MFR_VIN_MIN); +static SENSOR_DEVICE_ATTR(psu_mfr_vin_max, S_IRUGO, show_linear, NULL, PSU_MFR_VIN_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_vout_min, S_IRUGO, show_vout, NULL, PSU_MFR_VOUT_MIN); +static SENSOR_DEVICE_ATTR(psu_mfr_vout_max, S_IRUGO, show_vout, NULL, PSU_MFR_VOUT_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_iin_max, S_IRUGO, show_linear, NULL, PSU_MFR_IIN_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_iout_max, S_IRUGO, show_linear, NULL, PSU_MFR_IOUT_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_pin_max, S_IRUGO, show_linear, NULL, PSU_MFR_PIN_MAX); +static SENSOR_DEVICE_ATTR(psu_mfr_pout_max, S_IRUGO, show_linear, NULL, PSU_MFR_POUT_MAX); +static SENSOR_DEVICE_ATTR(psu_temp1_max, S_IRUGO, show_linear, NULL, PSU_MFR_TAMBIENT_MAX); +static SENSOR_DEVICE_ATTR(psu_temp1_min, S_IRUGO, show_linear, NULL, PSU_MFR_TAMBIENT_MIN); + + +/*Duplicate nodes for lm-sensors.*/ +static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_vout, NULL, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, show_linear, NULL, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(power2_input, S_IRUGO, show_linear, NULL, PSU_P_OUT_UV); +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_linear, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_linear, NULL, PSU_FAN1_SPEED); +//static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, show_word, NULL, PSU_TEMP_FAULT); + + +static struct attribute *accton_i2c_psu_attributes[] = { + &sensor_dev_attr_psu_v_in.dev_attr.attr, + &sensor_dev_attr_psu_v_out.dev_attr.attr, + &sensor_dev_attr_psu_i_in.dev_attr.attr, + &sensor_dev_attr_psu_i_out.dev_attr.attr, + &sensor_dev_attr_psu_p_in.dev_attr.attr, + &sensor_dev_attr_psu_p_out.dev_attr.attr, + &sensor_dev_attr_psu_temp1_input.dev_attr.attr, + &sensor_dev_attr_psu_fan1_fault.dev_attr.attr, + &sensor_dev_attr_psu_fan1_duty_cycle_percentage.dev_attr.attr, + &sensor_dev_attr_psu_fan1_speed_rpm.dev_attr.attr, + &sensor_dev_attr_psu_pmbus_revision.dev_attr.attr, + &sensor_dev_attr_psu_mfr_id.dev_attr.attr, + &sensor_dev_attr_psu_mfr_model.dev_attr.attr, + &sensor_dev_attr_psu_mfr_revision.dev_attr.attr, + &sensor_dev_attr_psu_mfr_serial.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vin_min.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_pout_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_iin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_pin_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vout_min.dev_attr.attr, + &sensor_dev_attr_psu_mfr_vout_max.dev_attr.attr, + &sensor_dev_attr_psu_mfr_iout_max.dev_attr.attr, + &sensor_dev_attr_psu_temp1_max.dev_attr.attr, + &sensor_dev_attr_psu_temp1_min.dev_attr.attr, + /*Duplicate nodes for lm-sensors.*/ + &sensor_dev_attr_curr2_input.dev_attr.attr, + &sensor_dev_attr_in3_input.dev_attr.attr, + &sensor_dev_attr_power2_input.dev_attr.attr, + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_fan1_input.dev_attr.attr, + //&sensor_dev_attr_temp1_fault.dev_attr.attr, + NULL +}; + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + bool is_negative = valid_data >> (valid_bit - 1); + + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct accton_i2c_psu_data *data = i2c_get_clientdata(client); + int nr = (attr->index == PSU_FAN1_DUTY_CYCLE) ? 0 : 1; + long speed; + int error; + + error = kstrtol(buf, 10, &speed); + if (error) + return error; + + if (speed < 0 || speed > MAX_FAN_DUTY_CYCLE) + return -EINVAL; + + mutex_lock(&data->update_lock); + data->fan_duty_cycle[nr] = speed; + accton_i2c_psu_write_word(client, PMBUS_REGISTER_FAN_COMMAND_1 + nr, data->fan_duty_cycle[nr]); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t show_linear(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct accton_i2c_psu_data *data = accton_i2c_psu_update_device(dev); + + u16 value = 0; + int exponent, mantissa; + int multiplier = 0; + + switch (attr->index) { + case PSU_V_IN: + value = data->v_in; + break; + case PSU_I_IN: + value = data->i_in; + break; + case PSU_I_OUT: + value = data->i_out; + break; + case PSU_P_IN: + value = data->p_in; + break; + case PSU_P_OUT_UV: + multiplier=1; + case PSU_P_OUT: + value = data->p_out; + break; + case PSU_TEMP1_INPUT: + value = data->temp_input[0]; + break; + case PSU_MFR_TAMBIENT_MAX: + value = data->mfr_tambient_max; + break; + case PSU_MFR_TAMBIENT_MIN: + value = data->mfr_tambient_min; + break; + case PSU_FAN1_DUTY_CYCLE: + multiplier = 1; + value = data->fan_duty_cycle[0]; + break; + case PSU_FAN1_SPEED: + multiplier = 1; + value = data->fan_speed[0]; + break; + case PSU_MFR_VIN_MIN: + value = data->mfr_vin_min; + break; + case PSU_MFR_VIN_MAX: + value = data->mfr_vin_max; + break; + case PSU_MFR_PIN_MAX: + value = data->mfr_pin_max; + break; + case PSU_MFR_POUT_MAX: + value = data->mfr_pout_max; + break; + case PSU_MFR_IOUT_MAX: + value = data->mfr_iout_max; + break; + case PSU_MFR_IIN_MAX: + value = data->mfr_iin_max; + break; + default: + break; + } + + exponent = two_complement_to_int(value >> 11, 5, 0x1f); + mantissa = two_complement_to_int(value & 0x7ff, 11, 0x7ff); + + if(!multiplier) + multiplier = PMBUS_LITERAL_DATA_MULTIPLIER; + if(attr->index==PSU_P_OUT_UV) + multiplier = 1000000; + + return (exponent >= 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct accton_i2c_psu_data *data = accton_i2c_psu_update_device(dev); + + u8 shift = (attr->index == PSU_FAN1_FAULT) ? 7 : 6; + + return sprintf(buf, "%d\n", data->fan_fault >> shift); +} + +static ssize_t show_vout(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct accton_i2c_psu_data *data = accton_i2c_psu_update_device(dev); + int exponent, mantissa; + + exponent = two_complement_to_int(data->vout_mode, 5, 0x1f); + switch (attr->index) { + case PSU_MFR_VOUT_MIN: + mantissa = data->mfr_vout_min; + break; + case PSU_MFR_VOUT_MAX: + mantissa = data->mfr_vout_max; + break; + case PSU_V_OUT: + mantissa = data->v_out; + break; + default: + return 0; + } + + return (exponent > 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * PMBUS_LITERAL_DATA_MULTIPLIER) : + sprintf(buf, "%d\n", (mantissa * PMBUS_LITERAL_DATA_MULTIPLIER) / (1 << -exponent)); +} + +static ssize_t show_byte(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct accton_i2c_psu_data *data = accton_i2c_psu_update_device(dev); + + if (!data->valid) { + return 0; + } + + return (attr->index == PSU_PMBUS_REVISION) ? sprintf(buf, "%d\n", data->pmbus_revision) : + sprintf(buf, "0\n"); +} + +static ssize_t show_ascii(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct accton_i2c_psu_data *data = accton_i2c_psu_update_device(dev); + u8 *ptr = NULL; + + if (!data->valid) { + return 0; + } + switch (attr->index) { + + case PSU_MFR_ID: + ptr = data->mfr_id; + break; + case PSU_MFR_MODEL: + ptr = data->mfr_model; + break; + case PSU_MFR_REVISION: + ptr = data->mfr_revsion; + break; + case PSU_MFR_SERIAL: + ptr = data->mfr_serial; + break; + default: + return 0; + } + + return sprintf(buf, "%s\n", ptr); +} + + +static const struct attribute_group accton_i2c_psu_group = { + .attrs = accton_i2c_psu_attributes, +}; + +static int accton_i2c_psu_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct accton_i2c_psu_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct accton_i2c_psu_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &accton_i2c_psu_group); + if (status) { + goto exit_free; + } + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &accton_i2c_psu_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int accton_i2c_psu_remove(struct i2c_client *client) +{ + struct accton_i2c_psu_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &accton_i2c_psu_group); + kfree(data); + + return 0; +} +/* Support psu moduel + */ +static const struct i2c_device_id accton_i2c_psu_id[] = { + { "delta_dps2400", 0 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, accton_i2c_psu_id); + +static struct i2c_driver accton_i2c_psu_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "accton_i2c_psu", + }, + .probe = accton_i2c_psu_probe, + .remove = accton_i2c_psu_remove, + .id_table = accton_i2c_psu_id, + .address_list = normal_i2c, +}; + +static int accton_i2c_psu_read_byte(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int accton_i2c_psu_read_word(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_word_data(client, reg); +} + +static int accton_i2c_psu_write_word(struct i2c_client *client, u8 reg, u16 value) +{ + return i2c_smbus_write_word_data(client, reg, value); +} + +static int accton_i2c_psu_read_block(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + return status; +} + + +static int accton_i2c_psu_read_block_data(struct i2c_client *client, u8 command, u8 *data, int data_length) +{ + int status = -EIO; + int length; + u8 buffer[128] = {0}, *ptr = buffer; + + status = accton_i2c_psu_read_byte(client, command); + if (status < 0) + { + dev_dbg(&client->dev, "Unable to get data from offset 0x%02X\r\n", command); + status = -EIO; + goto EXIT_READ_BLOCK_DATA; + } + + status = (status & 0xFF) + 1; + if ( status > 128) + { + dev_dbg(&client->dev, "Unable to get big data from offset 0x%02X\r\n", command); + status = -EINVAL; + goto EXIT_READ_BLOCK_DATA; + } + + length = status; + status = accton_i2c_psu_read_block(client, command, buffer, length); + if (unlikely(status < 0)) + goto EXIT_READ_BLOCK_DATA; + if (unlikely(status != length)) { + status = -EIO; + goto EXIT_READ_BLOCK_DATA; + } + /* The first byte is the count byte of string. */ + ptr++; + status--; + + length=status>(data_length-1)?(data_length-1):status; + memcpy(data, ptr, length); + data[length] = 0; + +EXIT_READ_BLOCK_DATA: + + return status; +} + + +struct reg_data_byte { + u8 reg; + u8 *value; +}; + +struct reg_data_word { + u8 reg; + u16 *value; +}; + +static struct accton_i2c_psu_data *accton_i2c_psu_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct accton_i2c_psu_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + int i, status; + //u8 command, buf; + struct reg_data_byte regs_byte[] = { {PMBUS_REGISTER_VOUT_MODE, &data->vout_mode}, + {PMBUS_REGISTER_STATUS_FAN, &data->fan_fault}}; + struct reg_data_word regs_word[] = { {PMBUS_REGISTER_READ_VIN, &data->v_in}, + {PMBUS_REGISTER_READ_VOUT, &data->v_out}, + {PMBUS_REGISTER_READ_IIN, &data->i_in}, + {PMBUS_REGISTER_READ_IOUT, &data->i_out}, + {PMBUS_REGISTER_READ_POUT, &data->p_out}, + {PMBUS_REGISTER_READ_PIN, &data->p_in}, + {PMBUS_REGISTER_READ_TEMPERATURE_1, &(data->temp_input[0])}, + {PMBUS_REGISTER_READ_TEMPERATURE_2, &(data->temp_input[1])}, + {PMBUS_REGISTER_FAN_COMMAND_1, &(data->fan_duty_cycle[0])}, + {PMBUS_REGISTER_READ_FAN_SPEED_1, &(data->fan_speed[0])}, + {PMBUS_REGISTER_READ_FAN_SPEED_2, &(data->fan_speed[1])}, + {PMBUS_REGISTER_READ_VIN_MIN, &data->mfr_vin_min}, + {PMBUS_REGISTER_READ_VIN_MAX, &data->mfr_vin_max}, + {PMBUS_REGISTER_READ_IIN_MAX, &data->mfr_iin_max}, + {PMBUS_REGISTER_READ_PIN_MAX, &data->mfr_pin_max}, + {PMBUS_REGISTER_READ_VOUT_MIN, &data->mfr_vout_min}, + {PMBUS_REGISTER_READ_VOUT_MAX, &data->mfr_vout_max}, + {PMBUS_REGISTER_READ_IOUT_MAX, &data->mfr_iout_max}, + {PMBUS_REGISTER_READ_POUT_MAX, &data->mfr_pout_max}, + {PMBUS_REGISTER_READ_TEMP_MAX, &data->mfr_tambient_max}, + {PMBUS_REGISTER_READ_TEMP_MIN, &data->mfr_tambient_min}, + }; + + dev_dbg(&client->dev, "Starting accton_i2c_psu update\n"); + + /* Read byte data */ + for (i = 0; i < ARRAY_SIZE(regs_byte); i++) { + status = accton_i2c_psu_read_byte(client, regs_byte[i].reg); + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_byte[i].reg, status); + } + else { + *(regs_byte[i].value) = status; + } + } + + /* Read word data */ + for (i = 0; i < ARRAY_SIZE(regs_word); i++) { + status = accton_i2c_psu_read_word(client, regs_word[i].reg); + + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_word[i].reg, status); + } + else { + *(regs_word[i].value) = status; + } + + } + /* Read mfr_id */ + status = accton_i2c_psu_read_block_data(client, PMBUS_REGISTER_MFR_ID, data->mfr_id, + ARRAY_SIZE(data->mfr_id)); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", PMBUS_REGISTER_MFR_ID, status); + goto exit; + } + /* Read mfr_model */ + status = accton_i2c_psu_read_block_data(client, PMBUS_REGISTER_MFR_MODEL, data->mfr_model, + ARRAY_SIZE(data->mfr_model)); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", PMBUS_REGISTER_MFR_MODEL, status); + goto exit; + } + /* Read mfr_revsion */ + status = accton_i2c_psu_read_block_data(client, PMBUS_REGISTER_MFR_REVISION, data->mfr_revsion, + ARRAY_SIZE(data->mfr_revsion)); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", PMBUS_REGISTER_MFR_REVISION, status); + goto exit; + } + /* Read mfr_serial */ + status = accton_i2c_psu_read_block_data(client, PMBUS_REGISTER_MFR_SERIAL, data->mfr_serial, + ARRAY_SIZE(data->mfr_serial)); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", PMBUS_REGISTER_MFR_SERIAL, status); + goto exit; + } + + data->last_updated = jiffies; + data->valid = 1; + } + +exit: + mutex_unlock(&data->update_lock); + + return data; +} + +static int __init accton_i2c_psu_init(void) +{ + return i2c_add_driver(&accton_i2c_psu_driver); +} + +static void __exit accton_i2c_psu_exit(void) +{ + i2c_del_driver(&accton_i2c_psu_driver); +} + +MODULE_AUTHOR("Michael Shih "); +MODULE_DESCRIPTION(DRIVER_DESCRIPTION_NAME); +MODULE_LICENSE("GPL"); + +module_init(accton_i2c_psu_init); +module_exit(accton_i2c_psu_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/service/as9736-64d-platform-monitor-fan.service b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/service/as9736-64d-platform-monitor-fan.service new file mode 100644 index 0000000000..4b1d2fd1c9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/service/as9736-64d-platform-monitor-fan.service @@ -0,0 +1,14 @@ +[Unit] +Description=Accton AS9736_64D Platform Monitoring FAN service +Before=pmon.service +After=as9736-64d-platform-monitor.service +DefaultDependencies=no + +[Service] +ExecStart=/usr/local/bin/accton_as9736_64d_monitor_fan.py + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/service/as9736-64d-platform-monitor-psu.service b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/service/as9736-64d-platform-monitor-psu.service new file mode 100644 index 0000000000..ec1d8ca9c4 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/service/as9736-64d-platform-monitor-psu.service @@ -0,0 +1,14 @@ +[Unit] +Description=Accton AS9736_64D Platform Monitoring PSU service +Before=pmon.service +After=as9736-64d-platform-monitor.service +DefaultDependencies=no + +[Service] +ExecStart=/usr/local/bin/accton_as9736_64d_monitor_psu.py + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/service/as9736-64d-platform-monitor.service b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/service/as9736-64d-platform-monitor.service new file mode 100644 index 0000000000..657a849ca3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/service/as9736-64d-platform-monitor.service @@ -0,0 +1,15 @@ +[Unit] +Description=Accton AS9736_64D Platform Monitoring service +Before=pmon.service system-health.service +After=sysinit.target +DefaultDependencies=no + +[Service] +ExecStartPre=/usr/local/bin/accton_as9736_64d_util.py install +ExecStart=/usr/local/bin/accton_as9736_64d_monitor.py + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/setup.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/setup.py new file mode 100755 index 0000000000..2df8b1d0e9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/setup.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +import os +from setuptools import setup +os.listdir + +setup( + name='as9736_64d', + version='1.0', + description='Module to initialize Accton AS9736_64D platforms', + + packages=['as9736_64d'], + package_dir={'as9736_64d': 'as9736-64d/classes'}, +) diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/__init__.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/__init__.py new file mode 100644 index 0000000000..706e231324 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/__init__.py @@ -0,0 +1,2 @@ +__all__ = ['chassis', 'eeprom', 'platform', 'psu', 'sfp', 'thermal', 'fan', 'fan_drawer'] +from . import platform diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/chassis.py similarity index 75% rename from device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/chassis.py rename to platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/chassis.py index 1c97d0e878..92ab824602 100644 --- a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/chassis.py @@ -1,5 +1,5 @@ ############################################################################# -# Edgecore +# Accton # # Module contains an implementation of SONiC Platform Base API and # provides the Chassis information which are available in the platform @@ -7,43 +7,53 @@ ############################################################################# import sys -import subprocess +import os try: from sonic_platform_base.chassis_base import ChassisBase + from sonic_py_common.logger import Logger + from .helper import APIHelper from .event import SfpEvent - from sonic_py_common import device_info - except ImportError as e: raise ImportError(str(e) + "- required module not found") -NUM_FAN_TRAY = 6 +NUM_FAN_TRAY = 4 +NUM_FAN = 2 NUM_PSU = 2 -NUM_THERMAL = 4 -NUM_PORT = 58 -NUM_COMPONENT = 4 - +NUM_THERMAL = 20 +NUM_QSFP = 64 +PORT_START = 1 +PORT_END = 66 +QSFP_PORT_START = 0 +QSFP_PORT_END = 63 +NUM_COMPONENT = 8 HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/" PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/" REBOOT_CAUSE_FILE = "reboot-cause.txt" PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" -HOST_CHK_CMD = ["which", "systemctl"] -SYSLED_FNODE= "/sys/class/leds/accton_as7326_56x_led::diag/brightness" +HOST_CHK_CMD = "docker > /dev/null 2>&1" +SYSLED_FNODE= "/sys/bus/platform/devices/as9736_64d_fpga/led_stat" + SYSLED_MODES = { - "0" : "STATUS_LED_COLOR_OFF", - "1" : "STATUS_LED_COLOR_GREEN", - "3" : "STATUS_LED_COLOR_RED", - "5" : "STATUS_LED_COLOR_GREEN_BLINK" + "12" : "STATUS_LED_COLOR_AMBER", + "16" : "STATUS_LED_COLOR_GREEN", + "17" : "STATUS_LED_COLOR_GREEN_BLINKING" } +SFP_STATUS_INSERTED = '1' + +# Global logger class instance +logger = Logger() class Chassis(ChassisBase): """Platform-specific Chassis class""" def __init__(self): ChassisBase.__init__(self) + self._api_helper = APIHelper() + self.is_host = self._api_helper.is_host() + self.config_data = {} - (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() self.__initialize_fan() self.__initialize_psu() @@ -54,9 +64,16 @@ def __init__(self): def __initialize_sfp(self): from sonic_platform.sfp import Sfp - for index in range(NUM_PORT): - sfp = Sfp(index) - self._sfp_list.append(sfp) + + self.QSFP_PORT_START = QSFP_PORT_START + self.QSFP_PORT_END = QSFP_PORT_END + for index in range(0, PORT_END): + if index in range(self.QSFP_PORT_START, self.QSFP_PORT_END + 1): + sfp_module = Sfp(index, 'QSFP') + else: + sfp_module = Sfp(index, 'SFP') + self._sfp_list.append(sfp_module) + self._sfpevent = SfpEvent(self._sfp_list) self.sfp_module_initialized = True @@ -69,13 +86,13 @@ def __initialize_fan(self): def __initialize_psu(self): from sonic_platform.psu import Psu - for index in range(NUM_PSU): + for index in range(0, NUM_PSU): psu = Psu(index) self._psu_list.append(psu) def __initialize_thermals(self): from sonic_platform.thermal import Thermal - for index in range(NUM_THERMAL): + for index in range(0, NUM_THERMAL): thermal = Thermal(index) self._thermal_list.append(thermal) @@ -85,39 +102,35 @@ def __initialize_eeprom(self): def __initialize_components(self): from sonic_platform.component import Component - for index in range(NUM_COMPONENT): + for index in range(0, NUM_COMPONENT): component = Component(index) self._component_list.append(component) def __initialize_watchdog(self): + from sonic_platform.watchdog import Watchdog self._watchdog = Watchdog() + def __is_host(self): - return subprocess.call(HOST_CHK_CMD) == 0 + return os.system(HOST_CHK_CMD) == 0 def __read_txt_file(self, file_path): try: with open(file_path, 'r') as fd: - return fd.read().strip() + data = fd.read() + return data.strip() except IOError: pass return None - def __write_txt_file(self, file_path, value): - try: - with open(file_path, 'w') as fd: - fd.write(str(value)) - except Exception: - return False - return True - def get_name(self): """ Retrieves the name of the device Returns: string: The name of the device """ - return self._eeprom.get_product_name() + + return self._eeprom.get_modelstr() def get_presence(self): """ @@ -134,6 +147,7 @@ def get_status(self): A boolean value, True if device is operating properly, False if not """ return True + def get_base_mac(self): """ Retrieves the base MAC address for the chassis @@ -145,9 +159,9 @@ def get_base_mac(self): def get_model(self): """ - Retrieves the model number (or part number) of the device + Retrieves the model number (or part number) of the chassis Returns: - string: Model/part number of device + string: Model/part number of chassis """ return self._eeprom.get_pn() @@ -179,30 +193,13 @@ def get_reboot_cause(self): is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used to pass a description of the reboot cause. """ - description = 'None' - - reboot_cause_path = (HOST_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE) if self.__is_host( - ) else (PMON_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE) - prev_reboot_cause_path = (HOST_REBOOT_CAUSE_PATH + PREV_REBOOT_CAUSE_FILE) if self.__is_host( - ) else (PMON_REBOOT_CAUSE_PATH + PREV_REBOOT_CAUSE_FILE) - sw_reboot_cause = self.__read_txt_file(reboot_cause_path) or "Unknown" - prev_sw_reboot_cause = self.__read_txt_file(prev_reboot_cause_path) or "Unknown" + reboot_cause_path = (HOST_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE) + sw_reboot_cause = self._api_helper.read_txt_file( + reboot_cause_path) or "Unknown" - if sw_reboot_cause != "Unknown": - reboot_cause = self.REBOOT_CAUSE_NON_HARDWARE - description = sw_reboot_cause - elif prev_reboot_cause_path != "Unknown": - reboot_cause = self.REBOOT_CAUSE_NON_HARDWARE - description = prev_sw_reboot_cause - return (reboot_cause, description) - - def get_change_event(self, timeout=0): - # SFP event - if not self.sfp_module_initialized: - self.__initialize_sfp() - return self._sfpevent.get_sfp_event(timeout) + return ('REBOOT_CAUSE_NON_HARDWARE', sw_reboot_cause) def get_sfp(self, index): """ @@ -227,14 +224,14 @@ def get_sfp(self, index): index, len(self._sfp_list))) return sfp - def get_position_in_parent(self): - """ - Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position - for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned - Returns: - integer: The 1-based relative physical position in parent device or -1 if cannot determine the position - """ - return -1 + def get_change_event(self, timeout=0): + # SFP event + if not self.sfp_module_initialized: + self.__initialize_sfp() + + status, sfp_event = self._sfpevent.get_sfp_event(timeout) + + return status, sfp_event def is_replaceable(self): """ @@ -244,12 +241,20 @@ def is_replaceable(self): """ return False + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return -1 def initizalize_system_led(self): return True def get_status_led(self): - val = self.__read_txt_file(SYSLED_FNODE) + val = self._api_helper.read_txt_file(SYSLED_FNODE) return SYSLED_MODES[val] if val in SYSLED_MODES else "UNKNOWN" def set_status_led(self, color): @@ -261,4 +266,14 @@ def set_status_led(self, color): if mode is None: return False else: - return self.__write_txt_file(SYSLED_FNODE, mode) + return self._api_helper.write_txt_file(SYSLED_FNODE, mode) + + def get_revision(self): + """ + Retrieves the hardware revision of the device + + Returns: + string: Revision value of device + """ + return self._eeprom.get_lb_revision() + diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/component.py new file mode 100644 index 0000000000..460961df46 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/component.py @@ -0,0 +1,187 @@ +############################################################################# +# Accton +# +# Component contains an implementation of SONiC Platform Base API and +# provides the components firmware management function +# +############################################################################# + +try: + from sonic_platform_base.component_base import ComponentBase + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +CPLD_ADDR_MAPPING = { + "SYSTEM CPLD": "6-0060", + "FCM CPLD": "25-0033", + "PSU CPLD": "36-0060", + "SCM CPLD": "51-0035" +} + +FPGA_VERSION_MAPPING = { + "UDB FPGA": "udb_version", + "LDB FPGA": "ldb_version", + "SMB FPGA": "smb_version" +} + +SYSFS_PATH = "/sys/bus/i2c/devices/" +FPGA_PATH = "/sys/devices/platform/as9736_64d_fpga/" +BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version" + +COMPONENT_LIST= [ + ("SYSTEM CPLD", "SYSTEM CPLD"), + ("FCM CPLD", "Fan Control Module CPLD"), + ("PSU CPLD", "Power Supply Unit CPLD"), + ("SCM CPLD", "Switch Control Module CPLD"), + ("UDB FPGA", "Upper Daughter Board FPGA"), + ("LDB FPGA", "Lower Daughter Board FPGA"), + ("SMB FPGA", "Switch Main Board FPGA"), + ("BIOS", "Basic Input/Output System") +] + +class Component(ComponentBase): + """Platform-specific Component class""" + + DEVICE_TYPE = "component" + + def __init__(self, component_index=0): + self._api_helper=APIHelper() + ComponentBase.__init__(self) + self.index = component_index + self.name = self.get_name() + + def __get_bios_version(self): + # Retrieves the BIOS firmware version + try: + with open(BIOS_VERSION_PATH, 'r') as fd: + bios_version = fd.read() + return bios_version.strip() + except Exception as e: + return None + + def __get_cpld_version(self): + # Retrieves the CPLD firmware version + cpld_version = dict() + for cpld_name in CPLD_ADDR_MAPPING: + try: + cpld_path = "{}{}{}".format(SYSFS_PATH, CPLD_ADDR_MAPPING[cpld_name], '/version') + cpld_version_raw= self._api_helper.read_txt_file(cpld_path) + cpld_version[cpld_name] = "{}".format(cpld_version_raw) + except Exception as e: + print('Get exception when read cpld') + cpld_version[cpld_name] = 'None' + + return cpld_version + + def __get_fpga_version(self): + # Retrieves the FPGA firmware version + fpga_version = dict() + for fpga_name in FPGA_VERSION_MAPPING: + try: + fpga_path = "{}{}".format(FPGA_PATH, FPGA_VERSION_MAPPING[fpga_name]) + fpga_version_raw= self._api_helper.read_txt_file(fpga_path) + fpga_version[fpga_name] = "{}".format(fpga_version_raw) + except Exception as e: + print('Get exception when read fpga') + fpga_version[fpga_name] = 'None' + + return fpga_version + + def get_name(self): + """ + Retrieves the name of the component + Returns: + A string containing the name of the component + """ + return COMPONENT_LIST[self.index][0] + + def get_description(self): + """ + Retrieves the description of the component + Returns: + A string containing the description of the component + """ + return COMPONENT_LIST[self.index][1] + + + def get_firmware_version(self): + """ + Retrieves the firmware version of module + Returns: + string: The firmware versions of the module + """ + fw_version = None + + if self.name == "BIOS": + fw_version = self.__get_bios_version() + elif "CPLD" in self.name: + cpld_version = self.__get_cpld_version() + fw_version = cpld_version.get(self.name) + elif "FPGA" in self.name: + fpga_version = self.__get_fpga_version() + fw_version = fpga_version.get(self.name) + + return fw_version + + def install_firmware(self, image_path): + """ + Install firmware to module + Args: + image_path: A string, path to firmware image + Returns: + A boolean, True if install successfully, False if not + """ + raise NotImplementedError + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return 'N/A' + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return 'N/A' + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return True + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + If the agent cannot determine the parent-relative position + for some reason, or if the associated value of + entPhysicalContainedIn is'0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device + or -1 if cannot determine the position + """ + return -1 + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/eeprom.py similarity index 84% rename from device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/eeprom.py rename to platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/eeprom.py index d0bffe53a2..7472b56e22 100644 --- a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/eeprom.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/eeprom.py @@ -2,29 +2,31 @@ import os import sys import re - from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo if sys.version_info[0] >= 3: from io import StringIO else: from cStringIO import StringIO + + from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo except ImportError as e: raise ImportError(str(e) + "- required module not found") CACHE_ROOT = '/var/cache/sonic/decode-syseeprom' CACHE_FILE = 'syseeprom_cache' NULL = 'N/A' +TLV_PRODUCT_NAME='0x21' +TLV_PART_NUMBER='0x22' +TLV_SERIAL_NUMBER='0x23' +TLV_BASE_MAC_ADDRESS='0x24' +TLV_CODE_LABEL_REVISION='0x27' class Tlv(eeprom_tlvinfo.TlvInfoDecoder): EEPROM_DECODE_HEADLINES = 6 def __init__(self): - #self._eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" - exists = os.path.isfile('/sys/bus/i2c/devices/0-0056/eeprom') - if (exists is True): - self._eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" - else: - self._eeprom_path = "/sys/bus/i2c/devices/0-0057/eeprom" + + self._eeprom_path = "/sys/bus/i2c/devices/20-0051/eeprom" super(Tlv, self).__init__(self._eeprom_path, 0, '', True) self._eeprom = self._load_eeprom() @@ -37,8 +39,8 @@ def __parse_output(self, decode_output): for line in lines: try: - match = re.search('(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)([\S]+)', - line) + match = re.search( + '(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)(.+)', line) if match is not None: idx = match.group(1) value = match.group(3).rstrip('\0') @@ -127,13 +129,17 @@ def get_eeprom(self): return self._valid_tlv(self._eeprom) def get_pn(self): - return self._eeprom.get('0x22', NULL) + return self._eeprom.get(TLV_PART_NUMBER, NULL) def get_serial(self): - return self._eeprom.get('0x23', NULL) + return self._eeprom.get(TLV_SERIAL_NUMBER, NULL) def get_mac(self): - return self._eeprom.get('0x24', NULL) + return self._eeprom.get(TLV_BASE_MAC_ADDRESS, NULL) + + def get_modelstr(self): + return self._eeprom.get(TLV_PRODUCT_NAME, NULL) + + def get_lb_revision(self): + return self._eeprom.get(TLV_CODE_LABEL_REVISION, NULL) - def get_product_name(self): - return self._eeprom.get('0x21', NULL) diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/event.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/event.py new file mode 100644 index 0000000000..f47be5b7c5 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/event.py @@ -0,0 +1,110 @@ +try: + import time + from sonic_py_common.logger import Logger + from .sfp import Sfp +except ImportError as e: + raise ImportError(repr(e) + " - required module not found") + +POLL_INTERVAL_IN_SEC = 1 + +# SFP errors that will block eeprom accessing +SFP_BLOCKING_ERRORS = [ + Sfp.SFP_ERROR_BIT_I2C_STUCK, + Sfp.SFP_ERROR_BIT_BAD_EEPROM, + Sfp.SFP_ERROR_BIT_UNSUPPORTED_CABLE, + Sfp.SFP_ERROR_BIT_HIGH_TEMP, + Sfp.SFP_ERROR_BIT_BAD_CABLE +] + +class SfpEvent: + ''' Listen to insert/remove sfp events ''' + + def __init__(self, sfp_list): + self._sfp_list = sfp_list + self._logger = Logger() + self._sfp_change_event_data = {'present': 0} + + def get_presence_bitmap(self): + bitmap = 0 + for sfp in self._sfp_list: + modpres = sfp.get_presence() + i=sfp.get_position_in_parent() - 1 + if modpres: + bitmap = bitmap | (1 << i) + return bitmap + + def get_sfp_event(self, timeout=2000): + port_dict = {} + change_dict = {} + change_dict['sfp'] = port_dict + + if timeout < 1000: + cd_ms = 1000 + else: + cd_ms = timeout + + while cd_ms > 0: + bitmap = self.get_presence_bitmap() + changed_ports = self._sfp_change_event_data['present'] ^ bitmap + if changed_ports != 0: + break + time.sleep(POLL_INTERVAL_IN_SEC) + # timeout=0 means wait for event forever + if timeout != 0: + cd_ms = cd_ms - POLL_INTERVAL_IN_SEC * 1000 + + if changed_ports != 0: + for sfp in self._sfp_list: + i=sfp.get_position_in_parent() - 1 + if (changed_ports & (1 << i)) == 0: + continue + + if (bitmap & (1 << i)) == 0: + port_dict[i+1] = '0' + else: + sfp.refresh_optoe_dev_class() + sfp_state_bits = self.get_sfp_state_bits(sfp, True) + sfp_state_bits = self.check_sfp_blocking_errors(sfp_state_bits) + + port_dict[i+1] = str(sfp_state_bits) + + # Update the cache dict + self._sfp_change_event_data['present'] = bitmap + return True, change_dict + else: + return True, change_dict + + def get_sfp_state_bits(self, sfp, present): + sfp_state_bits = 0 + + if present is True: + sfp_state_bits |= Sfp.SFP_STATUS_BIT_INSERTED + else: + return sfp_state_bits + + status = sfp.validate_eeprom() + if status is None: + sfp_state_bits |= Sfp.SFP_ERROR_BIT_I2C_STUCK + return sfp_state_bits + elif status is not True: + sfp_state_bits |= Sfp.SFP_ERROR_BIT_BAD_EEPROM + return sfp_state_bits + + status = sfp.validate_temperature() + if status is None: + sfp_state_bits |= Sfp.SFP_ERROR_BIT_I2C_STUCK + return sfp_state_bits + elif status is not True: + sfp_state_bits |= Sfp.SFP_ERROR_BIT_HIGH_TEMP + return sfp_state_bits + + return sfp_state_bits + + def check_sfp_blocking_errors(self, sfp_state_bits): + for i in SFP_BLOCKING_ERRORS: + if (i & sfp_state_bits) == 0: + continue + sfp_state_bits |= Sfp.SFP_ERROR_BIT_BLOCKING + + return sfp_state_bits + diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/fan.py similarity index 55% rename from device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/fan.py rename to platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/fan.py index c64d953b75..493a643327 100644 --- a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/fan.py @@ -1,5 +1,5 @@ ############################################################################# -# Edgecore +# Accton # # Module contains an implementation of SONiC Platform Base API and # provides the fan status which are available in the platform @@ -8,79 +8,62 @@ try: from sonic_platform_base.fan_base import FanBase + from .helper import APIHelper + import os.path except ImportError as e: raise ImportError(str(e) + "- required module not found") -FAN_MAX_RPM = 25500 -PSU_FAN_MAX_RPM = 25500 -SPEED_TOLERANCE = 15 -CPLD_I2C_PATH = "/sys/bus/i2c/devices/11-0066/fan" -PSU_I2C_PATH = "/sys/bus/i2c/devices/{}-00{}/" +SPEED_TOLERANCE = 30 +TARGET_SPEED_PATH = "/tmp/fan_target_speed" +CPLD_FAN_I2C_PATH = "/sys/bus/i2c/devices/25-0033/fan" +I2C_PATH ="/sys/bus/i2c/devices/{}-00{}/" PSU_HWMON_I2C_MAPPING = { 0: { - "bus": 17, + "num": 41, "addr": "59" }, 1: { - "bus": 13, - "addr": "5b" + "num": 33, + "addr": "58" }, } PSU_CPLD_I2C_MAPPING = { 0: { - "bus": 17, + "num": 41, "addr": "51" }, 1: { - "bus": 13, - "addr": "53" + "num": 33, + "addr": "50" }, } FAN_NAME_LIST = ["FAN-1F", "FAN-1R", "FAN-2F", "FAN-2R", - "FAN-3F", "FAN-3R", "FAN-4F", "FAN-4R", - "FAN-5F", "FAN-5R", "FAN-6F", "FAN-6R"] + "FAN-3F", "FAN-3R", "FAN-4F", "FAN-4R"] class Fan(FanBase): """Platform-specific Fan class""" - def __init__(self, - fan_tray_index, - fan_index=0, - is_psu_fan=False, - psu_index=0): + def __init__(self, fan_tray_index, fan_index=0, is_psu_fan=False, psu_index=0): + self._api_helper=APIHelper() self.fan_index = fan_index self.fan_tray_index = fan_tray_index self.is_psu_fan = is_psu_fan - self.psu_index = psu_index if self.is_psu_fan: - psu_i2c_bus = PSU_HWMON_I2C_MAPPING[psu_index]["bus"] - psu_i2c_addr = PSU_HWMON_I2C_MAPPING[psu_index]["addr"] - self.psu_hwmon_path = PSU_I2C_PATH.format(psu_i2c_bus, - psu_i2c_addr) - psu_i2c_bus = PSU_CPLD_I2C_MAPPING[psu_index]["bus"] - psu_i2c_addr = PSU_CPLD_I2C_MAPPING[psu_index]["addr"] - self.cpld_path = PSU_I2C_PATH.format(psu_i2c_bus, psu_i2c_addr) + self.psu_index = psu_index + self.psu_i2c_num = PSU_HWMON_I2C_MAPPING[self.psu_index]['num'] + self.psu_i2c_addr = PSU_HWMON_I2C_MAPPING[self.psu_index]['addr'] + self.psu_hwmon_path = I2C_PATH.format( + self.psu_i2c_num, self.psu_i2c_addr) - FanBase.__init__(self) + self.psu_i2c_num = PSU_CPLD_I2C_MAPPING[self.psu_index]['num'] + self.psu_i2c_addr = PSU_CPLD_I2C_MAPPING[self.psu_index]['addr'] + self.psu_cpld_path = I2C_PATH.format( + self.psu_i2c_num, self.psu_i2c_addr) - def __read_txt_file(self, file_path): - try: - with open(file_path, 'r') as fd: - return fd.read().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 Exception: - return False - return True + FanBase.__init__(self) def get_direction(self): """ @@ -90,14 +73,30 @@ def get_direction(self): depending on fan direction """ if not self.is_psu_fan: - val = self.__read_txt_file( - CPLD_I2C_PATH + str(self.fan_tray_index+1) + "_direction") - direction = self.FAN_DIRECTION_EXHAUST if ( + dir_str = "{}{}{}".format(CPLD_FAN_I2C_PATH, self.fan_tray_index+1, '_direction') + val=self._api_helper.read_txt_file(dir_str) + if val is not None: #F2B is FAN_DIRECTION_EXHAUST + direction = self.FAN_DIRECTION_EXHAUST if ( val == "0") else self.FAN_DIRECTION_INTAKE - else: - val = self.__read_txt_file(self.psu_hwmon_path + "psu_fan_dir") - direction = self.FAN_DIRECTION_EXHAUST if ( - val == "F2B") else self.FAN_DIRECTION_INTAKE + else: + direction=self.FAN_DIRECTION_EXHAUST + + else: #For PSU + psu_path = "{}{}".format(self.psu_cpld_path, 'psu_power_good') + val = self._api_helper.read_txt_file(psu_path) + if val is None or int(val, 10)==0: + return self.FAN_DIRECTION_NOT_APPLICABLE + + dir_str = "{}{}".format(self.psu_hwmon_path,'psu_fan_dir') + val=self._api_helper.read_txt_file(dir_str) + if val is None or val == "": + return self.FAN_DIRECTION_EXHAUST + else: + if val=='F2B': + direction=self.FAN_DIRECTION_EXHAUST + else: + direction=self.FAN_DIRECTION_INTAKE + return direction def get_speed(self): @@ -106,18 +105,26 @@ def get_speed(self): Returns: An integer, the percentage of full fan speed, in the range 0 (off) to 100 (full speed) + """ speed = 0 if self.is_psu_fan: - speed = self.__read_txt_file( - self.psu_hwmon_path + "psu_fan1_speed_rpm") - speed = (int(speed, 10)) * 100 / PSU_FAN_MAX_RPM - speed = 100 if (speed > 100) else speed + psu_fan_path= "{}{}".format(self.psu_hwmon_path, 'psu_fan1_speed_rpm') + fan_speed_rpm = self._api_helper.read_txt_file(psu_fan_path) + if fan_speed_rpm is not None: + speed = (int(fan_speed_rpm,10))*100/26688 + if speed > 100: + speed=100 + else: + return 0 elif self.get_presence(): - speed = self.__read_txt_file(CPLD_I2C_PATH + str( - self.fan_index * 10 + self.fan_tray_index + 1) + "_input") - speed = (int(speed, 10)) * 100 / FAN_MAX_RPM - speed = 100 if (speed > 100) else speed + if os.path.isfile(TARGET_SPEED_PATH): + speed=self._api_helper.read_txt_file(TARGET_SPEED_PATH) + else: + speed_path = "{}{}{}".format(CPLD_FAN_I2C_PATH, self.fan_tray_index+1, '_duty_cycle_percentage') + speed=self._api_helper.read_txt_file(speed_path) + if speed is None: + return 0 return int(speed) def get_target_speed(self): @@ -126,8 +133,10 @@ def get_target_speed(self): 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 """ @@ -150,11 +159,15 @@ def set_speed(self, speed): in the range 0 (off) to 100 (full speed) Returns: A boolean, True if speed is set successfully, False if not + """ if not self.is_psu_fan and self.get_presence(): - return self.__write_txt_file( - CPLD_I2C_PATH + "_duty_cycle_percentage", int(speed)) + speed_path = "{}{}{}".format(CPLD_FAN_I2C_PATH, self.fan_tray_index+1, '_duty_cycle_percentage') + ret = self._api_helper.write_txt_file(speed_path, int(speed)) + if ret == True: + self._api_helper.write_txt_file(TARGET_SPEED_PATH, int(speed)) + return ret return False @@ -167,7 +180,7 @@ def set_status_led(self, color): Returns: bool: True if status LED state is set successfully, False if not """ - return False #Not supported + return False #Not supported def get_status_led(self): """ @@ -175,13 +188,21 @@ def get_status_led(self): Returns: A string, one of the predefined STATUS_LED_COLOR_* strings above """ - status=self.get_presence() - if status is None: - return self.STATUS_LED_COLOR_OFF + if self.is_psu_fan: + status_ps=self.get_presence() #present + status=self.get_status() #power good + + if status is None or status_ps is False: + return self.STATUS_LED_COLOR_OFF + + else: + status=self.get_presence() + if status is None: + return self.STATUS_LED_COLOR_OFF return { 1: self.STATUS_LED_COLOR_GREEN, - 0: self.STATUS_LED_COLOR_RED + 0: self.STATUS_LED_COLOR_AMBER }.get(status, self.STATUS_LED_COLOR_OFF) def get_name(self): @@ -198,17 +219,24 @@ def get_name(self): def get_presence(self): """ - Retrieves the presence of the PSU + Retrieves the presence of the FAN Returns: - bool: True if PSU is present, False if not + bool: True if FAN is present, False if not """ - if self.is_psu_fan: - val = self.__read_txt_file(self.cpld_path + "psu_present") - return int(val, 10) == 1 - - val = self.__read_txt_file( - CPLD_I2C_PATH + str(self.fan_tray_index + 1) + "_present") - return int(val, 10)==1 + present_path = "{}{}{}".format(CPLD_FAN_I2C_PATH, self.fan_tray_index+1, '_present') + val=self._api_helper.read_txt_file(present_path) + if not self.is_psu_fan: + if val is not None: + return int(val, 10)==1 + else: + return False + else: + presence_path="{}{}".format(self.psu_cpld_path, 'psu_present') + val=self._api_helper.read_txt_file(presence_path) + if val is not None: + return int(val, 10) == 1 + else: + return False def get_status(self): """ @@ -217,29 +245,30 @@ def get_status(self): A boolean value, True if device is operating properly, False if not """ if self.is_psu_fan: - psu_fan_path= "{}{}".format(self.psu_hwmon_path, 'psu_fan1_fault') - val=self.__read_txt_file(psu_fan_path) + psu_fan_path= "{}{}".format(self.psu_cpld_path, 'psu_power_good') + val=self._api_helper.read_txt_file(psu_fan_path) if val is not None: - return int(val, 10)==0 + return int(val, 10)==1 else: return False - else: - path = "{}{}{}".format(CPLD_I2C_PATH, self.fan_tray_index+1, '_fault') - val=self.__read_txt_file(path) + else: + path = "{}{}{}".format(CPLD_FAN_I2C_PATH, self.fan_tray_index+1, '_fault') + val=self._api_helper.read_txt_file(path) if val is not None: return int(val, 10)==0 else: return False + def get_model(self): """ Retrieves the model number (or part number) of the device Returns: string: Model/part number of device """ - + return "N/A" - + def get_serial(self): """ Retrieves the serial number of the device @@ -268,3 +297,4 @@ def is_replaceable(self): bool: True if it is replaceable. """ return True if not self.is_psu_fan else False + diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/fan_drawer.py similarity index 89% rename from device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/fan_drawer.py rename to platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/fan_drawer.py index e21163c106..58f0bd17f7 100644 --- a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/fan_drawer.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/fan_drawer.py @@ -1,10 +1,3 @@ -######################################################################## -# -# 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 except ImportError as e: diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/helper.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/helper.py new file mode 100644 index 0000000000..eb4744f282 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/helper.py @@ -0,0 +1,369 @@ +import os +import struct +import json +import fcntl +from mmap import * +from sonic_py_common import device_info +from sonic_py_common import logger +from threading import Lock +from typing import cast +from sonic_py_common.general import getstatusoutput_noshell +from sonic_py_common.general import getstatusoutput_noshell_pipe + +HOST_CHK_CMD = ["docker"] +EMPTY_STRING = "" + + +class APIHelper(): + + def __init__(self): + (self.platform, self.hwsku) = device_info.get_platform_and_hwsku() + + def is_host(self): + try: + status, output = getstatusoutput_noshell(HOST_CHK_CMD) + return status == 0 + except Exception: + return False + + def pci_get_value(self, resource, offset): + status = True + result = "" + try: + fd = os.open(resource, os.O_RDWR) + mm = mmap(fd, 0) + mm.seek(int(offset)) + read_data_stream = mm.read(4) + result = struct.unpack('I', read_data_stream) + except Exception: + status = False + return status, result + + def run_interactive_command(self, cmd): + try: + os.system(cmd) + except Exception: + return False + return True + + def read_txt_file(self, file_path): + try: + with open(file_path, encoding='unicode_escape', errors='replace') as fd: + data = fd.read() + return data.strip() + except IOError: + pass + return None + + def write_txt_file(self, file_path, value): + try: + with open(file_path, 'w') as fd: + fd.write(str(value)) + fd.flush() + except IOError: + return False + return True + + def ipmi_raw(self, netfn, cmd): + status = True + result = "" + try: + err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'raw', str(netfn), str(cmd)]) + if err == [0]: + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result + + def ipmi_fru_id(self, id, key=None): + status = True + result = "" + try: + if (key is None): + err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'fru', 'print', str(id)]) + else: + err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'fru', 'print', str(id)], ['grep', str(key)]) + if err == [0] or err == [0, 0]: + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result + + def ipmi_set_ss_thres(self, id, threshold_key, value): + status = True + result = "" + try: + err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'sensor', 'thresh', str(id), str(threshold_key), str(value)]) + if err == [0]: + result = raw_data.strip() + else: + status = False + except Exception: + status = False + return status, result + + +class FileLock: + + def __init__(self, lock_file): + self._lock_file = lock_file + self._thread_lock = Lock() + self.is_locked = False + + def acquire(self): + with self._thread_lock: + if self.is_locked: + return + + fd = os.open(self._lock_file, flags=(os.O_RDWR | os.O_CREAT | os.O_TRUNC)) + fcntl.flock(fd, fcntl.LOCK_EX) + self._lock_file_fd = fd + self.is_locked = True + + def release(self): + with self._thread_lock: + if self.is_locked: + fd = cast(int, self._lock_file_fd) + self._lock_file_fd = None + fcntl.flock(fd, fcntl.LOCK_UN) + os.close(fd) + self.is_locked = False + + def __enter__(self): + self.acquire() + return self + + def __exit__(self, exc_type, exc_val, traceback): + self.release() + + def __del__(self): + self.release() + + +DEVICE_THRESHOLD_JSON_PATH = "/tmp/device_threshold.json" +HIGH_THRESHOLD_FIELD = 'high_threshold' +LOW_THRESHOLD_FIELD = 'low_threshold' +HIGH_CRIT_THRESHOLD_FIELD = 'high_critical_threshold' +LOW_CRIT_THRESHOLD_FIELD = 'low_critical_threshold' +NOT_AVAILABLE = 'N/A' + +class DeviceThreshold: + + def __init__(self, th_name = NOT_AVAILABLE): + self.flock = FileLock("{}.lock".format(DEVICE_THRESHOLD_JSON_PATH)) + self.name = th_name + self.__log = logger.Logger(log_identifier="DeviceThreshold") + + self.__db_data = {} + try: + with self.flock: + with open(DEVICE_THRESHOLD_JSON_PATH, "r") as db_file: + self.__db_data = json.load(db_file) + except Exception as e: + self.__log.log_warning('{}'.format(str(e))) + + @property + def HIGH_THRESHOLD_FIELD(self): + return HIGH_THRESHOLD_FIELD + + @property + def LOW_THRESHOLD_FIELD(self): + return LOW_THRESHOLD_FIELD + + @property + def HIGH_CRIT_THRESHOLD_FIELD(self): + return HIGH_CRIT_THRESHOLD_FIELD + + @property + def LOW_CRIT_THRESHOLD_FIELD(self): + return LOW_CRIT_THRESHOLD_FIELD + + @property + def NOT_AVAILABLE(self): + return NOT_AVAILABLE + + def __get_data(self, field): + """ + Retrieves data frome JSON file by field + + Args : + field: String + + Returns: + A string if getting is successfully, 'N/A' if not + """ + if self.name not in self.__db_data.keys(): + return NOT_AVAILABLE + + if field not in self.__db_data[self.name].keys(): + return NOT_AVAILABLE + + return self.__db_data[self.name][field] + + def __set_data(self, field, new_val): + """ + Set data to JSON file by field + + Args : + field: String + new_val: String + + Returns: + A boolean, True if setting is set successfully, False if not + """ + if self.name not in self.__db_data.keys(): + self.__db_data[self.name] = {} + + old_val = self.__db_data[self.name].get(field, None) + if old_val is not None and old_val == new_val: + return True + + self.__db_data[self.name][field] = new_val + + try: + with self.flock: + db_data = {} + mode = "w+" + if os.path.exists(DEVICE_THRESHOLD_JSON_PATH): + mode = "r+" + with open(DEVICE_THRESHOLD_JSON_PATH, mode) as db_file: + if mode == "r+": + db_data = json.load(db_file) + + if self.name not in db_data.keys(): + db_data[self.name] = {} + + db_data[self.name][field] = new_val + + if mode == "r+": + db_file.seek(0) + # erase old data + db_file.truncate(0) + # write all data + json.dump(db_data, db_file, indent=4) + except Exception as e: + self.__log.log_error('{}'.format(str(e))) + return False + + return True + + def get_high_threshold(self): + """ + Retrieves the high threshold temperature from JSON file. + + Returns: + string : the high threshold temperature of thermal, + e.g. "30.125" + """ + return self.__get_data(HIGH_THRESHOLD_FIELD) + + def set_high_threshold(self, temperature): + """ + Sets the high threshold temperature of thermal + Args : + temperature: A string of temperature, e.g. "30.125" + Returns: + A boolean, True if threshold is set successfully, False if not + """ + if isinstance(temperature, str) is not True: + raise TypeError('The parameter requires string type.') + + try: + if temperature != NOT_AVAILABLE: + float(temperature) + except ValueError: + raise ValueError('The parameter requires a float string. ex:\"30.1\"') + + return self.__set_data(HIGH_THRESHOLD_FIELD, temperature) + + def get_low_threshold(self): + """ + Retrieves the low threshold temperature from JSON file. + + Returns: + string : the low threshold temperature of thermal, + e.g. "30.125" + """ + return self.__get_data(LOW_THRESHOLD_FIELD) + + def set_low_threshold(self, temperature): + """ + Sets the low threshold temperature of thermal + Args : + temperature: A string of temperature, e.g. "30.125" + Returns: + A boolean, True if threshold is set successfully, False if not + """ + if isinstance(temperature, str) is not True: + raise TypeError('The parameter requires string type.') + + try: + if temperature != NOT_AVAILABLE: + float(temperature) + except ValueError: + raise ValueError('The parameter requires a float string. ex:\"30.1\"') + + return self.__set_data(LOW_THRESHOLD_FIELD, temperature) + + def get_high_critical_threshold(self): + """ + Retrieves the high critical threshold temperature from JSON file. + + Returns: + string : the high critical threshold temperature of thermal, + e.g. "30.125" + """ + return self.__get_data(HIGH_CRIT_THRESHOLD_FIELD) + + def set_high_critical_threshold(self, temperature): + """ + Sets the high critical threshold temperature of thermal + Args : + temperature: A string of temperature, e.g. "30.125" + Returns: + A boolean, True if threshold is set successfully, False if not + """ + if isinstance(temperature, str) is not True: + raise TypeError('The parameter requires string type.') + + try: + if temperature != NOT_AVAILABLE: + float(temperature) + except ValueError: + raise ValueError('The parameter requires a float string. ex:\"30.1\"') + + return self.__set_data(HIGH_CRIT_THRESHOLD_FIELD, temperature) + + def get_low_critical_threshold(self): + """ + Retrieves the low critical threshold temperature from JSON file. + + Returns: + string : the low critical threshold temperature of thermal, + e.g. "30.125" + """ + return self.__get_data(LOW_CRIT_THRESHOLD_FIELD) + + def set_low_critical_threshold(self, temperature): + """ + Sets the low critical threshold temperature of thermal + Args : + temperature: A string of temperature, e.g. "30.125" + Returns: + A boolean, True if threshold is set successfully, False if not + """ + if isinstance(temperature, str) is not True: + raise TypeError('The parameter requires string type.') + + try: + if temperature != NOT_AVAILABLE: + float(temperature) + except ValueError: + raise ValueError('The parameter requires a float string. ex:\"30.1\"') + + return self.__set_data(LOW_CRIT_THRESHOLD_FIELD, temperature) + diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/pcie.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/pcie.py new file mode 100644 index 0000000000..e4da32adf9 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/pcie.py @@ -0,0 +1,19 @@ +############################################################################# +# Edgecore +# +# Module contains an implementation of SONiC Platform Base API and +# provides the fan status which are available in the platform +# Base PCIe class +############################################################################# + +try: + from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Pcie(PcieUtil): + """Edgecore Platform-specific PCIe class""" + + def __init__(self, platform_path): + PcieUtil.__init__(self, platform_path) diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/platform.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/platform.py similarity index 98% rename from device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/platform.py rename to platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/platform.py index 2f2c2a447f..b6bc56b5cc 100644 --- a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/platform.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/platform.py @@ -1,5 +1,5 @@ ############################################################################# -# Edgecore +# Accton # # Module contains an implementation of SONiC Platform Base API and # provides the platform information diff --git a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/psu.py similarity index 60% rename from device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/psu.py rename to platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/psu.py index 44566aba1f..05184ca20e 100644 --- a/device/accton/x86_64-accton_as7326_56x-r0/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/psu.py @@ -1,79 +1,76 @@ ############################################################################# -# Edgecore +# Accton # # Module contains an implementation of SONiC Platform Base API and # provides the PSUs status which are available in the platform # ############################################################################# -#import sonic_platform - try: from sonic_platform_base.psu_base import PsuBase from sonic_platform.thermal import Thermal + from .helper import APIHelper except ImportError as e: raise ImportError(str(e) + "- required module not found") -I2C_PATH = "/sys/bus/i2c/devices/{}-00{}/" + +I2C_PATH ="/sys/bus/i2c/devices/{0}-00{1}/" PSU_NAME_LIST = ["PSU-1", "PSU-2"] PSU_NUM_FAN = [1, 1] PSU_HWMON_I2C_MAPPING = { 0: { - "bus": 17, + "num": 41, "addr": "59" }, 1: { - "bus": 13, - "addr": "5b" + "num": 33, + "addr": "58" }, } PSU_CPLD_I2C_MAPPING = { 0: { - "bus": 17, + "num": 41, "addr": "51" }, 1: { - "bus": 13, - "addr": "53" + "num": 33, + "addr": "50" }, } -NUM_FAN_TRAY = 6 - - class Psu(PsuBase): """Platform-specific Psu class""" def __init__(self, psu_index=0): PsuBase.__init__(self) self.index = psu_index + self._api_helper = APIHelper() - bus = PSU_HWMON_I2C_MAPPING[self.index]["bus"] - addr = PSU_HWMON_I2C_MAPPING[self.index]["addr"] - self.hwmon_path = I2C_PATH.format(bus, addr) + self.i2c_num = PSU_HWMON_I2C_MAPPING[self.index]["num"] + self.i2c_addr = PSU_HWMON_I2C_MAPPING[self.index]["addr"] + self.hwmon_path = I2C_PATH.format(self.i2c_num, self.i2c_addr) - bus = PSU_CPLD_I2C_MAPPING[self.index]["bus"] - addr = PSU_CPLD_I2C_MAPPING[self.index]["addr"] - self.cpld_path = I2C_PATH.format(bus, addr) + self.i2c_num = PSU_CPLD_I2C_MAPPING[self.index]["num"] + self.i2c_addr = PSU_CPLD_I2C_MAPPING[self.index]["addr"] + self.cpld_path = I2C_PATH.format(self.i2c_num, self.i2c_addr) self.__initialize_fan() + ''' + for fan_index in range(0, PSU_NUM_FAN[self.index]): + #def __init__(self, fan_tray_index, fan_index=0, is_psu_fan=False, psu_index=0): + #fan = Fan(fan_index, 0, is_psu_fan=True, psu_index=self.index) + fan = Fan(fan_index, 0, True, self.index) + self._fan_list.append(fan) + ''' def __initialize_fan(self): from sonic_platform.fan import Fan - self._fan_list.append( - Fan(NUM_FAN_TRAY + self.index, - is_psu_fan=True, - psu_index=self.index)) - self._thermal_list.append(Thermal(is_psu=True, psu_index=self.index)) + for fan_index in range(0, PSU_NUM_FAN[self.index]): + fan = Fan(fan_index, 0, is_psu_fan=True, psu_index=self.index) + self._fan_list.append(fan) - def __read_txt_file(self, file_path): - try: - with open(file_path, 'r') as fd: - return fd.read().strip() - except IOError: - pass - return None + self._thermal_list.append(Thermal(is_psu=True, psu_index=self.index)) def get_voltage(self): """ @@ -82,9 +79,13 @@ def get_voltage(self): A float number, the output voltage in volts, e.g. 12.1 """ - val = self.__read_txt_file(self.hwmon_path + "psu_v_out") - if val is not None: - return float(val)/ 1000 + if self.get_status() is not True: + return 0 + + vout_path = "{}{}".format(self.hwmon_path, 'psu_v_out') + vout_val=self._api_helper.read_txt_file(vout_path) + if vout_val is not None: + return float(vout_val)/ 1000 else: return 0 @@ -94,7 +95,11 @@ def get_current(self): Returns: A float number, the electric current in amperes, e.g 15.4 """ - val = self.__read_txt_file(self.hwmon_path + "psu_i_out") + if self.get_status() is not True: + return 0 + + iout_path = "{}{}".format(self.hwmon_path, 'psu_i_out') + val=self._api_helper.read_txt_file(iout_path) if val is not None: return float(val)/1000 else: @@ -106,7 +111,11 @@ def get_power(self): Returns: A float number, the power in watts, e.g. 302.6 """ - val = self.__read_txt_file(self.hwmon_path + "psu_p_out") + if self.get_status() is not True: + return 0 + + pout_path = "{}{}".format(self.hwmon_path, 'psu_p_out') + val=self._api_helper.read_txt_file(pout_path) if val is not None: return float(val)/1000 else: @@ -139,13 +148,15 @@ def get_status_led(self): Returns: A string, one of the predefined STATUS_LED_COLOR_* strings above """ - status=self.get_status() - if status is None: + status_ps=self.get_presence() #present + status=self.get_status() #power good + + if status is None or status_ps is False: return self.STATUS_LED_COLOR_OFF return { 1: self.STATUS_LED_COLOR_GREEN, - 0: self.STATUS_LED_COLOR_RED + 0: self.STATUS_LED_COLOR_AMBER }.get(status, self.STATUS_LED_COLOR_OFF) def get_temperature(self): @@ -155,7 +166,12 @@ def get_temperature(self): A float number of current temperature in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - return self._thermal_list[0].get_temperature() + temp_path = "{}{}".format(self.hwmon_path, 'psu_temp1_input') + val=self._api_helper.read_txt_file(temp_path) + if val is not None: + return float(val)/1000 + else: + return 0 def get_temperature_high_threshold(self): """ @@ -164,7 +180,7 @@ def get_temperature_high_threshold(self): A float number, the high threshold temperature of PSU in Celsius up to nearest thousandth of one degree Celsius, e.g. 30.125 """ - return False #Not supported + return self._thermal_list[0].get_high_threshold() def get_voltage_high_threshold(self): """ @@ -173,9 +189,10 @@ def get_voltage_high_threshold(self): A float number, the high threshold output voltage in volts, e.g. 12.1 """ - val = self.__read_txt_file(self.hwmon_path + "psu_mfr_vout_max") - if val is not None: - return float(val)/ 1000 + vout_path = "{}{}".format(self.hwmon_path, 'psu_mfr_vout_max') + vout_val=self._api_helper.read_txt_file(vout_path) + if vout_val is not None: + return float(vout_val)/ 1000 else: return 0 @@ -186,9 +203,10 @@ def get_voltage_low_threshold(self): A float number, the low threshold output voltage in volts, e.g. 12.1 """ - val = self.__read_txt_file(self.hwmon_path + "psu_mfr_vout_min") - if val is not None: - return float(val)/ 1000 + vout_path = "{}{}".format(self.hwmon_path, 'psu_mfr_vout_min') + vout_val=self._api_helper.read_txt_file(vout_path) + if vout_val is not None: + return float(vout_val)/ 1000 else: return 0 @@ -206,7 +224,8 @@ def get_presence(self): Returns: bool: True if PSU is present, False if not """ - val = self.__read_txt_file(self.cpld_path + "psu_present") + presence_path="{}{}".format(self.cpld_path, 'psu_present') + val=self._api_helper.read_txt_file(presence_path) if val is not None: return int(val, 10) == 1 else: @@ -218,7 +237,8 @@ def get_status(self): Returns: A boolean value, True if device is operating properly, False if not """ - val = self.__read_txt_file(self.cpld_path + "psu_power_good") + power_path="{}{}".format(self.cpld_path, 'psu_power_good') + val=self._api_helper.read_txt_file(power_path) if val is not None: return int(val, 10) == 1 else: @@ -230,7 +250,9 @@ def get_model(self): Returns: string: Model/part number of device """ - model = self.__read_txt_file(self.cpld_path + "psu_model_name") + model_path="{}{}".format(self.cpld_path, 'psu_model_name') + model=self._api_helper.read_txt_file(model_path) + if model is None: return "N/A" return model @@ -241,7 +263,9 @@ def get_serial(self): Returns: string: Serial number of device """ - serial = self.__read_txt_file(self.cpld_path + "psu_serial_number") + serial_path="{}{}".format(self.cpld_path, 'psu_serial_number') + serial=self._api_helper.read_txt_file(serial_path) + if serial is None: return "N/A" return serial @@ -262,3 +286,28 @@ def is_replaceable(self): bool: True if it is replaceable. """ return True + + def get_revision(self): + """ + Retrieves the hardware revision of the device + + Returns: + string: Revision value of device + """ + revision_path = "{}{}".format(self.hwmon_path, 'psu_mfr_revision') + revision=self._api_helper.read_txt_file(revision_path) + if revision is not None: + return revision + else: + return 'N/A' + + def get_maximum_supplied_power(self): + """ + Retrieves the maximum supplied power by PSU + + Returns: + A float number, the maximum power output in Watts. + e.g. 1200.1 + """ + return 2400.0 + diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/sfp.py new file mode 100644 index 0000000000..14bef59641 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/sfp.py @@ -0,0 +1,697 @@ +############################################################################# +# Accton +# +# Sfp contains an implementation of SONiC Platform Base API and +# provides the sfp device status which are available in the platform +# +############################################################################# + +import os +import sys +import time +import struct + +from ctypes import create_string_buffer + +try: + from sonic_py_common.logger import Logger + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase + from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper + from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom + from .helper import APIHelper +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +#Edge-core definitions +FPGA_PCIE_PATH = "/sys/devices/platform/as9736_64d_fpga/" + +XCVR_TYPE_OFFSET = 0 +XCVR_TYPE_WIDTH = 1 + +QSFP_CONTROL_WIDTH = 8 +QSFP_CONTROL_OFFSET = 86 +QSFP_POWEROVERRIDE_OFFSET = 93 + +NULL_VAL = 'N/A' + + +SFP_I2C_START = 17 +PCIE_UDB_EEPROM_PATH = '/sys/devices/platform/pcie_udb_fpga_device.{0}/eeprom' +PCIE_LDB_EEPROM_PATH = '/sys/devices/platform/pcie_ldb_fpga_device.{0}/eeprom' +PCIE_UDB_OPTOE_DEV_CLASS_PATH = '/sys/devices/platform/pcie_udb_fpga_device.{0}/dev_class' +PCIE_LDB_OPTOE_DEV_CLASS_PATH = '/sys/devices/platform/pcie_ldb_fpga_device.{0}/dev_class' + +PCIE_UDB_BIND_PATH = "/sys/bus/platform/drivers/pcie_udb_fpga_device/{0}" +PCIE_LDB_BIND_PATH = "/sys/bus/platform/drivers/pcie_ldb_fpga_device/{0}" + +logger = Logger() + +class Sfp(SfpOptoeBase): + """Platform-specific Sfp class""" + HOST_CHK_CMD = "which systemctl > /dev/null 2>&1" + PLATFORM = "x86_64-accton_as9736_64d-r0" + HWSKU = "Accton-AS9736-64D" + PORT_START = 1 + PORT_END = 66 + QSFP_PORT_START = 1 + QSFP_PORT_END = 64 + + SFP_TYPE_CODE_LIST = [ + 0x03, # SFP/SFP+/SFP28 + 0x0b # DWDM-SFP/SFP+ + ] + QSFP_TYPE_CODE_LIST = [ + 0x0c, # QSFP + 0x0d, # QSFP+ or later + 0x11, # QSFP28 or later + 0xe1 # QSFP28 EDFA + ] + QSFP_DD_TYPE_CODE_LIST = [ + 0x18, # QSFP-DD Double Density 8X Pluggable Transceiver + 0x1E # QSFP+ or later with CMIS + ] + OSFP_TYPE_CODE_LIST = [ + 0x19 # OSFP + ] + + SFP_TYPE = "SFP" + QSFP_TYPE = "QSFP" + OSFP_TYPE = "OSFP" + QSFP_DD_TYPE = "QSFP_DD" + + UPDATE_DONE = "Done" + EEPROM_DATA_NOT_READY = "eeprom not ready" + UNKNOWN_SFP_TYPE_ID = "unknow sfp ID" + + # Path to sysfs + PLATFORM_ROOT_PATH = "/usr/share/sonic/device" + PMON_HWSKU_PATH = "/usr/share/sonic/hwsku" + + UDB_QSFP_PORT_START = 1 + UDB_QSFP_PORT_END = 32 + LDB_QSFP_PORT_START = 33 + LDB_QSFP_PORT_END = 64 + LDB_SFP_PORT_START = 65 + LDB_SFP_PORT_END = 66 + + def __init__(self, sfp_index=0, sfp_name=None): + SfpOptoeBase.__init__(self) + + self._index = sfp_index + self.port_num = self._index + 1 + self.index = self.port_num + self._api_helper = APIHelper() + self._name = sfp_name + + self.sfp_type = self.QSFP_TYPE + self.update_sfp_type() + + def __write_txt_file(self, file_path, value): + try: + reg_file = open(file_path, "w") + except IOError as e: + logger.log_error("Error: unable to open file: %s" % str(e)) + return False + + reg_file.write(str(value)) + reg_file.close() + + return True + + def __is_host(self): + return os.system(self.HOST_CHK_CMD) == 0 + + def __get_path_to_port_config_file(self): + platform_path = "/".join([self.PLATFORM_ROOT_PATH, self.PLATFORM]) + hwsku_path = "/".join([platform_path, self.HWSKU] + ) if self.__is_host() else self.PMON_HWSKU_PATH + return "/".join([hwsku_path, "port_config.ini"]) + + def _convert_string_to_num(self, value_str): + if "-inf" in value_str: + return 'N/A' + elif "Unknown" in value_str: + return 'N/A' + elif 'dBm' in value_str: + t_str = value_str.rstrip('dBm') + return float(t_str) + elif 'mA' in value_str: + t_str = value_str.rstrip('mA') + return float(t_str) + elif 'C' in value_str: + t_str = value_str.rstrip('C') + return float(t_str) + elif 'Volts' in value_str: + t_str = value_str.rstrip('Volts') + return float(t_str) + else: + return 'N/A' + + def get_eeprom_path(self): + if self._index < 32: + port_eeprom_path = PCIE_UDB_EEPROM_PATH.format(self._index) + else: + port_eeprom_path = PCIE_LDB_EEPROM_PATH.format(self._index - 32) + + return port_eeprom_path + + def read_eeprom(self, offset, num_bytes): + port_eeprom_path = self.get_eeprom_path() + + #Try to solved IOError + tries = 15 + for i in range(tries): + try: + eeprom = open(port_eeprom_path, mode='rb', buffering=0) + except (IOError): + if i < tries - 1: + time.sleep(0.02) + continue + else: + return None + break + try: + eeprom.seek(offset) + eeprom_raw = bytearray(eeprom.read(num_bytes)) + eeprom.close() + return eeprom_raw + except (OSError, IOError): + return None + + + def write_eeprom(self, offset, num_bytes, write_buffer): + try: + with open(self.get_eeprom_path(), mode='r+b', buffering=0) as f: + for i in range(num_bytes): + f.seek(offset+i) + f.write(write_buffer[i:i+1]) + except (OSError, IOError): + return False + return True + + + def refresh_optoe_dev_class(self): + if self._index < 32: + port = "pcie_udb_fpga_device.{}".format(self._index) + port_dev_unbind = PCIE_UDB_BIND_PATH.format("unbind") + port_dev_bind = PCIE_UDB_BIND_PATH.format("bind") + else: + port = "pcie_ldb_fpga_device.{}".format(self._index-32) + port_dev_unbind = PCIE_LDB_BIND_PATH.format("unbind") + port_dev_bind = PCIE_LDB_BIND_PATH.format("bind") + + self._api_helper.write_txt_file(port_dev_unbind, port) + self._api_helper.write_txt_file(port_dev_bind, port) + + def get_reset_status(self): + """ + Retrieves the reset status of SFP + Returns: + A Boolean, True if reset enabled, False if disabled + """ + reset_path = "{}{}{}".format(FPGA_PCIE_PATH, '/module_reset_', self.port_num) + + val=self._api_helper.read_txt_file(reset_path) + if val is not None: + return int(val, 10)==1 + else: + return False + + def get_tx_disable_channel(self): + """ + Retrieves the TX disabled channels in this SFP + Returns: + A hex of 4 bits (bit 0 to bit 3 as channel 0 to channel 3) to represent + TX channels which have been disabled in this SFP. + As an example, a returned value of 0x5 indicates that channel 0 + and channel 2 have been disabled. + """ + tx_disable_list = self.get_tx_disable() + if tx_disable_list is None: + return 0 + tx_disabled = 0 + for i in range(len(tx_disable_list)): + if tx_disable_list[i]: + tx_disabled |= 1 << i + return tx_disabled + + def get_lpmode(self): + """ + Retrieves the lpmode (low power mode) status of this SFP + Returns: + A Boolean, True if lpmode is enabled, False if disabled + """ + if self.port_num > 64: + # SFP doesn't support this feature + return False + + if self.sfp_type == self.QSFP_DD_TYPE: + api = self.get_xcvr_api() + return api.get_lpmode() + else: + lpmode_path = "{}{}{}".format(FPGA_PCIE_PATH, '/module_lp_mode_', self.port_num) + + val=self._api_helper.read_txt_file(lpmode_path) + if val is not None: + return int(val, 10)==1 + else: + return False + + def reset(self): + """ + Reset SFP and return all user module settings to their default srate. + Returns: + A boolean, True if successful, False if not + """ + # Check for invalid port_num + + if self.port_num > 64: + return False # SFP doesn't support this feature + else: + if not self.get_presence(): + return False + reset_path = "{}{}{}".format(FPGA_PCIE_PATH, 'module_reset_', self.port_num) + + ret = self.__write_txt_file(reset_path, 1) #sysfs 1: enable reset + if ret is not True: + return ret + + time.sleep(0.2) + ret = self.__write_txt_file(reset_path, 0) #sysfs 0: disable reset + time.sleep(0.2) + + return ret + + def tx_disable(self, tx_disable): + """ + Disable SFP TX for all channels + Args: + tx_disable : A Boolean, True to enable tx_disable mode, False to disable + tx_disable mode. + Returns: + A boolean, True if tx_disable is set successfully, False if not + """ + if self.sfp_type == self.QSFP_TYPE: + sysfsfile_eeprom = None + try: + tx_disable_value = 0xf if tx_disable else 0x0 + # Write to eeprom + sysfsfile_eeprom = open(self.get_eeprom_path(), "r+b") + sysfsfile_eeprom.seek(QSFP_CONTROL_OFFSET) + sysfsfile_eeprom.write(struct.pack('B', tx_disable_value)) + except IOError: + return False + finally: + if sysfsfile_eeprom is not None: + sysfsfile_eeprom.close() + time.sleep(0.01) + return True + return False + + def set_lpmode(self, lpmode): + """ + Sets the lpmode (low power mode) of SFP + Args: + lpmode: A Boolean, True to enable lpmode, False to disable it + Note : lpmode can be overridden by set_power_override + Returns: + A boolean, True if lpmode is set successfully, False if not + """ + if self.port_num > 64: + return False # SFP doesn't support this feature + else: + if not self.get_presence(): + return False + + if self.sfp_type == self.QSFP_DD_TYPE: + api = self.get_xcvr_api() + api.set_lpmode(lpmode) + return True + else: + lpmode_path = "{}{}{}".format(FPGA_PCIE_PATH, 'module_lp_mode_', self.port_num) + + if lpmode is True: + ret = self.__write_txt_file(lpmode_path, 1) #enable lpmode + else: + ret = self.__write_txt_file(lpmode_path, 0) #disable lpmode + + return ret + + def _convert_raw_to_byte(self, raw, num_bytes): + """ + Convert raw to the sytle that can parsing by sfpd_obj function + Returns: + A Array, hex value convert with no prefix of 0x + """ + eeprom_raw = [] + + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + try: + if isinstance(raw, str): + for n in range(0, num_bytes): + eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + else: + for n in range(0, num_bytes): + eeprom_raw[n] = hex(raw[n])[2:].zfill(2) + + except Exception: + return None + + return eeprom_raw + + def get_power_override(self): + """ + Retrieves the power-override status of this SFP + Returns: + A Boolean, True if power-override is enabled, False if disabled + """ + power_override = False + sfpd_obj = sff8436Dom() + if sfpd_obj is None: + return False + + dom_control_raw = self._convert_raw_to_byte( + self.read_eeprom(QSFP_CONTROL_OFFSET, QSFP_CONTROL_WIDTH), QSFP_CONTROL_WIDTH) if self.get_presence() else None + + if dom_control_raw is not None: + dom_control_data = sfpd_obj.parse_control_bytes(dom_control_raw, 0) + power_override = ( + 'On' == dom_control_data['data']['PowerOverride']['value']) + + return power_override + + def set_power_override(self, power_override, power_set): + """ + Sets SFP power level using power_override and power_set + Args: + power_override : + A Boolean, True to override set_lpmode and use power_set + to control SFP power, False to disable SFP power control + through power_override/power_set and use set_lpmode + to control SFP power. + power_set : + Only valid when power_override is True. + A Boolean, True to set SFP to low power mode, False to set + SFP to high power mode. + Returns: + A boolean, True if power-override and power_set are set successfully, + False if not + """ + + if not self.get_presence(): + return False + try: + power_override_bit = (1 << 0) if power_override else 0 + power_set_bit = (1 << 1) if power_set else (1 << 3) + + buffer = create_string_buffer(1) + if sys.version_info[0] >= 3: + buffer[0] = (power_override_bit | power_set_bit) + else: + buffer[0] = chr(power_override_bit | power_set_bit) + + port_eeprom_path = self.get_eeprom_path() + + fd = open(port_eeprom_path, mode="rb+", buffering=0) + fd.seek(QSFP_POWEROVERRIDE_OFFSET) + fd.write(buffer[0]) + time.sleep(0.01) + fd.close() + + except Exception as e: + logger.log_error("Error: unable to open file: %s" % str(e)) + return False + + return True + + ############################################################## + ###################### Device methods ######################## + ############################################################## + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + sfputil_helper = SfpUtilHelper() + sfputil_helper.read_porttab_mappings( + self.__get_path_to_port_config_file()) + name = sfputil_helper.logical[self._index] or "Unknown" + return name + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + present_path = "{}{}{}".format(FPGA_PCIE_PATH, '/module_present_', self.port_num) + + val=self._api_helper.read_txt_file(present_path) + if val is not None: + return int(val, 10)==1 + else: + return False + + def get_status(self): + """ + Retrieves the operational status of the device + Returns: + A boolean value, True if device is operating properly, False if not + """ + return self.get_presence() and not self.get_reset_status() + + def get_position_in_parent(self): + """ + Returns: + Temp return 0 + """ + return self.port_num + + def is_replaceable(self): + """ + Retrieves if replaceable + Returns: + A boolean value, True if replaceable + """ + return True + + def update_sfp_type(self): + """ + Updates the sfp type + + """ + ret = self.UPDATE_DONE + eeprom_raw = [] + eeprom_raw = self.read_eeprom(0, 1) + if eeprom_raw and hasattr(self,'sfp_type'): + if eeprom_raw[0] in self.SFP_TYPE_CODE_LIST: + self.sfp_type = self.SFP_TYPE + elif eeprom_raw[0] in self.QSFP_TYPE_CODE_LIST: + self.sfp_type = self.QSFP_TYPE + elif eeprom_raw[0] in self.QSFP_DD_TYPE_CODE_LIST: + self.sfp_type = self.QSFP_DD_TYPE + elif eeprom_raw[0] in self.OSFP_TYPE_CODE_LIST: + self.sfp_type = self.OSFP_TYPE + else: + ret = self.UNKNOWN_SFP_TYPE_ID + else: + ret = self.EEPROM_DATA_NOT_READY + + return ret + + def validate_eeprom_sfp(self): + checksum_test = 0 + eeprom_raw = self.read_eeprom(0, 96) + if eeprom_raw is None: + return None + + for i in range(0, 63): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[63]: + return False + + checksum_test = 0 + for i in range(64, 95): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[95]: + return False + + api = self.get_xcvr_api() + if api is None: + return False + + if api.is_flat_memory(): + return True + + checksum_test = 0 + eeprom_raw = self.read_eeprom(384, 96) + if eeprom_raw is None: + return None + + for i in range(0, 95): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[95]: + return False + + return True + + def validate_eeprom_qsfp(self): + checksum_test = 0 + eeprom_raw = self.read_eeprom(128, 96) + if eeprom_raw is None: + return None + + for i in range(0, 63): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[63]: + return False + + checksum_test = 0 + for i in range(64, 95): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[95]: + return False + + api = self.get_xcvr_api() + if api is None: + return False + + if api.is_flat_memory(): + return True + + return True + + def validate_eeprom_cmis(self): + checksum_test = 0 + eeprom_raw = self.read_eeprom(128, 95) + if eeprom_raw is None: + return None + + for i in range(0, 94): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[94]: + return False + + api = self.get_xcvr_api() + if api is None: + return False + + if api.is_flat_memory(): + return True + + checksum_test = 0 + eeprom_raw = self.read_eeprom(258, 126) + if eeprom_raw is None: + return None + + for i in range(0, 125): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[125]: + return False + + checksum_test = 0 + eeprom_raw = self.read_eeprom(384, 128) + if eeprom_raw is None: + return None + + for i in range(0, 127): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[127]: + return False + + # EEPROM byte_1: Get '40h' indicates version 4.0, '52h' indicates version 5.2. + # CMIS_5.0 starts to support the checksum of page 04h + cmis_rev_byte_raw = self.read_eeprom(1, 1) + if cmis_rev_byte_raw[0] >= 0x50: + checksum_test = 0 + eeprom_raw = self.read_eeprom(640, 128) + if eeprom_raw is None: + return None + + for i in range(0, 127): + checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF + else: + if checksum_test != eeprom_raw[127]: + return False + + return True + + def validate_eeprom(self): + id_byte_raw = self.read_eeprom(0, 1) + if id_byte_raw is None: + return None + + id = id_byte_raw[0] + if id in self.QSFP_TYPE_CODE_LIST: + return self.validate_eeprom_qsfp() + elif id in self.SFP_TYPE_CODE_LIST: + return self.validate_eeprom_sfp() + elif id in self.QSFP_DD_TYPE_CODE_LIST: + return self.validate_eeprom_cmis() + else: + return False + + def validate_temperature(self): + temperature = self.get_temperature() + if temperature is None: + return None + + threshold_dict = self.get_transceiver_threshold_info() + if threshold_dict is None: + return None + + if isinstance(temperature, float) is not True: + return True + + if isinstance(threshold_dict['temphighalarm'], float) is not True: + return True + + return threshold_dict['temphighalarm'] > temperature + + def get_error_description(self): + """ + Retrives the error descriptions of the SFP module + Returns: + String that represents the current error descriptions of vendor specific errors + In case there are multiple errors, they should be joined by '|', + like: "Bad EEPROM|Unsupported cable" + """ + if not self.get_presence(): + return self.SFP_STATUS_UNPLUGGED + + err_stat = self.SFP_STATUS_BIT_INSERTED + + status = self.validate_eeprom() + if status is not True: + err_stat = (err_stat | self.SFP_ERROR_BIT_BAD_EEPROM) + + status = self.validate_temperature() + if status is not True: + err_stat = (err_stat | self.SFP_ERROR_BIT_HIGH_TEMP) + + if err_stat is self.SFP_STATUS_BIT_INSERTED: + return self.SFP_STATUS_OK + else: + err_desc = '' + cnt = 0 + for key in self.SFP_ERROR_BIT_TO_DESCRIPTION_DICT: + if (err_stat & key) != 0: + if cnt > 0: + err_desc = err_desc + "|" + cnt = cnt + 1 + err_desc = err_desc + self.SFP_ERROR_BIT_TO_DESCRIPTION_DICT[key] + + return err_desc + diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/thermal.py new file mode 100644 index 0000000000..19f7040d85 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform/thermal.py @@ -0,0 +1,583 @@ +############################################################################# +# Accton +# +# 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 +import glob + +try: + from sonic_platform_base.thermal_base import ThermalBase + from .helper import DeviceThreshold +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +PSU_I2C_PATH = "/sys/bus/i2c/devices/{}-00{}/" + +PSU_HWMON_I2C_MAPPING = { + 0: { + "num": 41, + "addr": "59" + }, + 1: { + "num": 33, + "addr": "58" + } +} + +PSU_CPLD_I2C_MAPPING = { + 0: { + "num": 41, + "addr": "51" + }, + 1: { + "num": 33, + "addr": "50" + } +} + +THERMAL_NAME_LIST = ["SMB_RearMiddle_temp(0x48)", "SMB_FrontMiddle_temp(0x49)", "SMB_LeftMiddle_temp(0x4C)", + "FCM_Center_temp(0x48)", "FCM_Left_temp(0x49)", "PDB-L_temp(0x48)", + "PDB-R_temp(0x49)", "UDB_RearLeft_temp(0x48)", "UDB_RearMiddle_temp(0x4C)", + "LDB_FrontRight_temp(0x4C)", "LDB_RearRight_temp(0x4D)", "CPU_Package_temp", + "CPU_Core_0_temp", "CPU_Core_1_temp", "CPU_Core_2_temp", + "CPU_Core_3_temp", "CPU_Core_4_temp", "CPU_Core_5_temp", + "CPU_Core_6_temp", "CPU_Core_7_temp"] + +PSU_THERMAL_NAME_LIST = ["PSU-1 temp sensor 1", "PSU-2 temp sensor 1"] + +SYSFS_PATH = "/sys/bus/i2c/devices" +CPU_SYSFS_PATH = "/sys/devices/platform" + +class Thermal(ThermalBase): + """Platform-specific Thermal class""" + + def __init__(self, thermal_index=0, is_psu=False, psu_index=0): + global psu_temp_max + global psu_temp_min + self.index = thermal_index + self.is_psu = is_psu + self.psu_index = psu_index + self.min_temperature = None + self.max_temperature = None + + if self.is_psu: + psu_i2c_bus = PSU_HWMON_I2C_MAPPING[psu_index]["num"] + psu_i2c_addr = PSU_HWMON_I2C_MAPPING[psu_index]["addr"] + self.psu_hwmon_path = PSU_I2C_PATH.format(psu_i2c_bus, + psu_i2c_addr) + psu_i2c_bus = PSU_CPLD_I2C_MAPPING[psu_index]["num"] + psu_i2c_addr = PSU_CPLD_I2C_MAPPING[psu_index]["addr"] + self.cpld_path = PSU_I2C_PATH.format(psu_i2c_bus, psu_i2c_addr) + + self.conf = DeviceThreshold(self.get_name()) + if self.is_psu: + temp_file_path = self.psu_hwmon_path + "psu_temp1_max" + psu_temp_max = self.__get_temp(temp_file_path) + temp_file_path = self.psu_hwmon_path + "psu_temp1_min" + psu_temp_min = self.__get_temp(temp_file_path) + # Default thresholds + self.default_threshold = { + THERMAL_NAME_LIST[0] : { + self.conf.HIGH_THRESHOLD_FIELD : '65.0', + self.conf.LOW_THRESHOLD_FIELD : '7.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '69.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '-7.0' + }, + THERMAL_NAME_LIST[1] : { + self.conf.HIGH_THRESHOLD_FIELD : '53.0', + self.conf.LOW_THRESHOLD_FIELD : '3.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '57.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '-10.0' + }, + THERMAL_NAME_LIST[2] : { + self.conf.HIGH_THRESHOLD_FIELD : '55.0', + self.conf.LOW_THRESHOLD_FIELD : '3.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '59.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '-11.0' + }, + THERMAL_NAME_LIST[3] : { + self.conf.HIGH_THRESHOLD_FIELD : '51.0', + self.conf.LOW_THRESHOLD_FIELD : '2.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '54.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '-16.0' + }, + THERMAL_NAME_LIST[4] : { + self.conf.HIGH_THRESHOLD_FIELD : '51.0', + self.conf.LOW_THRESHOLD_FIELD : '3.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '55.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '-14.0' + }, + THERMAL_NAME_LIST[5] : { + self.conf.HIGH_THRESHOLD_FIELD : '47.0', + self.conf.LOW_THRESHOLD_FIELD : '1.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '51.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '-17.0' + }, + THERMAL_NAME_LIST[6] : { + self.conf.HIGH_THRESHOLD_FIELD : '44.0', + self.conf.LOW_THRESHOLD_FIELD : '3.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '47.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '-14.0' + }, + THERMAL_NAME_LIST[7] : { + self.conf.HIGH_THRESHOLD_FIELD : '62.0', + self.conf.LOW_THRESHOLD_FIELD : '3.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '66.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '-13.0' + }, + THERMAL_NAME_LIST[8] : { + self.conf.HIGH_THRESHOLD_FIELD : '54.0', + self.conf.LOW_THRESHOLD_FIELD : '0.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '58.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '-17.0' + }, + THERMAL_NAME_LIST[9] : { + self.conf.HIGH_THRESHOLD_FIELD : '51.0', + self.conf.LOW_THRESHOLD_FIELD : '1.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '54.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '-17.0' + }, + THERMAL_NAME_LIST[10] : { + self.conf.HIGH_THRESHOLD_FIELD : '59.0', + self.conf.LOW_THRESHOLD_FIELD : '3.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '61.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '-13.0' + }, + THERMAL_NAME_LIST[11] : { + self.conf.HIGH_THRESHOLD_FIELD : '92.0', + self.conf.LOW_THRESHOLD_FIELD : '14.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '93.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '1.0' + }, + THERMAL_NAME_LIST[12] : { + self.conf.HIGH_THRESHOLD_FIELD : '92.0', + self.conf.LOW_THRESHOLD_FIELD : '14.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '93.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '1.0' + }, + THERMAL_NAME_LIST[13] : { + self.conf.HIGH_THRESHOLD_FIELD : '92.0', + self.conf.LOW_THRESHOLD_FIELD : '14.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '93.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '1.0' + }, + THERMAL_NAME_LIST[14] : { + self.conf.HIGH_THRESHOLD_FIELD : '92.0', + self.conf.LOW_THRESHOLD_FIELD : '14.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '93.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '1.0' + }, + THERMAL_NAME_LIST[15] : { + self.conf.HIGH_THRESHOLD_FIELD : '92.0', + self.conf.LOW_THRESHOLD_FIELD : '14.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '93.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '1.0' + }, + THERMAL_NAME_LIST[16] : { + self.conf.HIGH_THRESHOLD_FIELD : '92.0', + self.conf.LOW_THRESHOLD_FIELD : '14.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '93.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '1.0' + }, + THERMAL_NAME_LIST[17] : { + self.conf.HIGH_THRESHOLD_FIELD : '92.0', + self.conf.LOW_THRESHOLD_FIELD : '14.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '93.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '1.0' + }, + THERMAL_NAME_LIST[18] : { + self.conf.HIGH_THRESHOLD_FIELD : '92.0', + self.conf.LOW_THRESHOLD_FIELD : '14.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '93.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '1.0' + }, + THERMAL_NAME_LIST[19] : { + self.conf.HIGH_THRESHOLD_FIELD : '92.0', + self.conf.LOW_THRESHOLD_FIELD : '14.0', + self.conf.HIGH_CRIT_THRESHOLD_FIELD : '93.0', + self.conf.LOW_CRIT_THRESHOLD_FIELD : '1.0' + }, + PSU_THERMAL_NAME_LIST[0] : { + self.conf.HIGH_THRESHOLD_FIELD : str(float(psu_temp_max)), + self.conf.LOW_THRESHOLD_FIELD : str(float(psu_temp_min)), + self.conf.HIGH_CRIT_THRESHOLD_FIELD : self.conf.NOT_AVAILABLE, + self.conf.LOW_CRIT_THRESHOLD_FIELD : self.conf.NOT_AVAILABLE + }, + PSU_THERMAL_NAME_LIST[1] : { + self.conf.HIGH_THRESHOLD_FIELD : str(float(psu_temp_max)), + self.conf.LOW_THRESHOLD_FIELD : str(float(psu_temp_min)), + self.conf.HIGH_CRIT_THRESHOLD_FIELD : self.conf.NOT_AVAILABLE, + self.conf.LOW_CRIT_THRESHOLD_FIELD : self.conf.NOT_AVAILABLE + } + } + + # Set hwmon path + i2c_path = { + 0: {"hwmon_path":"2-0048/hwmon/hwmon*/", "ss_index":1}, + 1: {"hwmon_path":"2-0049/hwmon/hwmon*/", "ss_index":1}, + 2: {"hwmon_path":"14-004c/hwmon/hwmon*/", "ss_index":1}, + 3: {"hwmon_path":"27-0048/hwmon/hwmon*/", "ss_index":1}, + 4: {"hwmon_path":"27-0049/hwmon/hwmon*/", "ss_index":1}, + 5: {"hwmon_path":"34-0048/hwmon/hwmon*/", "ss_index":1}, + 6: {"hwmon_path":"42-0049/hwmon/hwmon*/", "ss_index":1}, + 7: {"hwmon_path":"57-0048/hwmon/hwmon*/", "ss_index":1}, + 8: {"hwmon_path":"58-004c/hwmon/hwmon*/", "ss_index":1}, + 9: {"hwmon_path":"65-004c/hwmon/hwmon*/", "ss_index":1}, + 10: {"hwmon_path":"66-004d/hwmon/hwmon*/", "ss_index":1}, + 11: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":1}, + 12: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":2}, + 13: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":3}, + 14: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":4}, + 15: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":5}, + 16: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":6}, + 17: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":7}, + 18: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":8}, + 19: {"hwmon_path":"coretemp.0/hwmon/hwmon*/", "ss_index":9} + }.get(self.index, None) + + self.is_cpu = False + if self.index in range(11,20): + self.is_cpu = True + self.hwmon_path = "{}/{}".format(CPU_SYSFS_PATH, i2c_path["hwmon_path"]) + else: + self.hwmon_path = "{}/{}".format(SYSFS_PATH, i2c_path["hwmon_path"]) + self.ss_key = THERMAL_NAME_LIST[self.index] + self.ss_index = i2c_path["ss_index"] + + def __read_txt_file(self, file_path): + for filename in glob.glob(file_path): + try: + with open(filename, 'r') as fd: + data =fd.readline().strip() + if len(data) > 0: + return data + except IOError as e: + pass + + return None + + def __get_temp(self, temp_file): + if not self.is_psu: + temp_file_path = os.path.join(self.hwmon_path, temp_file) + else: + temp_file_path = temp_file + raw_temp = self.__read_txt_file(temp_file_path) + if raw_temp is not None: + return float(raw_temp)/1000 + else: + return 80.0 + + def __set_threshold(self, file_name, temperature): + if self.is_psu: + return True + temp_file_path = os.path.join(self.hwmon_path, file_name) + for filename in glob.glob(temp_file_path): + try: + with open(filename, 'w') as fd: + fd.write(str(temperature)) + return True + except IOError as e: + print("IOError") + + + 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 + """ + if not self.is_psu: + temp_file = "temp{}_input".format(self.ss_index) + else: + temp_file = self.psu_hwmon_path + "psu_temp1_input" + + current = self.__get_temp(temp_file) + if self.min_temperature is None or current < self.min_temperature: + self.min_temperature = current + + if self.max_temperature is None or current > self.max_temperature: + self.max_temperature = current + + return current + + 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 + """ + value = self.conf.get_high_threshold() + if value != self.conf.NOT_AVAILABLE: + return float(value) + + default_value = self.default_threshold[self.get_name()][self.conf.HIGH_THRESHOLD_FIELD] + if default_value != self.conf.NOT_AVAILABLE: + return float(default_value) + + raise NotImplementedError + + 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 + """ + try: + value = float(temperature) + except Exception: + return False + + try: + self.conf.set_high_threshold(str(value)) + except Exception: + return False + + return True + + def get_name(self): + """ + Retrieves the name of the thermal device + Returns: + string: The name of the thermal device + """ + if self.is_psu: + return PSU_THERMAL_NAME_LIST[self.psu_index] + else: + return THERMAL_NAME_LIST[self.index] + + def get_presence(self): + """ + Retrieves the presence of the Thermal + Returns: + bool: True if Thermal is present, False if not + """ + if self.is_cpu: + return True + + if self.is_psu: + val = self.__read_txt_file(self.cpld_path + "psu_present") + if val is not None: + return int(val, 10) == 1 + else: + return False + temp_file = "temp{}_input".format(self.ss_index) + temp_file_path = os.path.join(self.hwmon_path, temp_file) + raw_txt = self.__read_txt_file(temp_file_path) + if raw_txt is not None: + return True + else: + return False + + + 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 self.is_cpu: + return True + + if self.is_psu: + temp_file = self.psu_hwmon_path + "psu_temp1_input" + psu_temp1_input = self.__read_txt_file(temp_file) + if psu_temp1_input is None: + psu_temp1_input = '0' + return self.get_presence() and (int(psu_temp1_input)) + + file_str = "temp{}_input".format(self.ss_index) + file_path = os.path.join(self.hwmon_path, file_str) + raw_txt = self.__read_txt_file(file_path) + if raw_txt is None: + return False + else: + return int(raw_txt) != 0 + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + + return "N/A" + + def get_serial(self): + """ + Retrieves the serial number of the device + Returns: + string: Serial number of device + """ + return "N/A" + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position + for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned + Returns: + integer: The 1-based relative physical position in parent device or -1 if cannot determine the position + """ + return self.index+1 + + def is_replaceable(self): + """ + Retrieves whether thermal module is replaceable + Returns: + A boolean value, True if replaceable, False if not + """ + return False + + def get_high_critical_threshold(self): + """ + Retrieves the high critical threshold temperature of thermal by 1-based index + Actions should be taken immediately if the temperature becomes higher than the high critical + threshold otherwise the device will be damaged. + + :param index: An integer, 1-based index of the thermal sensor of which to query status + :return: A float number, the high critical threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + value = self.conf.get_high_critical_threshold() + if value != self.conf.NOT_AVAILABLE: + return float(value) + + default_value = self.default_threshold[self.get_name()][self.conf.HIGH_CRIT_THRESHOLD_FIELD] + if default_value != self.conf.NOT_AVAILABLE: + return float(default_value) + + raise NotImplementedError + + def set_high_critical_threshold(self, temperature): + """ + Sets the critical 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 + """ + try: + value = float(temperature) + except Exception: + return False + + try: + self.conf.set_high_critical_threshold(str(value)) + except Exception: + return False + + return True + + def get_minimum_recorded(self): + """ Retrieves the minimum recorded temperature of thermal + Returns: A float number, the minimum recorded temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.min_temperature is None: + self.get_temperature() + + return self.min_temperature + + def get_maximum_recorded(self): + """ Retrieves the maximum recorded temperature of thermal + Returns: A float number, the maximum recorded temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + if self.max_temperature is None: + self.get_temperature() + + return self.max_temperature + + def get_low_threshold(self): + """ + Retrieves the low threshold temperature of thermal sensor by 1-based index + Actions should be taken if the temperature becomes lower than the low threshold. + :param index: An integer, 1-based index of the thermal sensor of which to query status + :return: A float number, the low threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + value = self.conf.get_low_threshold() + if value != self.conf.NOT_AVAILABLE: + return float(value) + + default_value = self.default_threshold[self.get_name()][self.conf.LOW_THRESHOLD_FIELD] + if default_value != self.conf.NOT_AVAILABLE: + return float(default_value) + + raise NotImplementedError + + def set_low_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 + """ + try: + value = float(temperature) + except Exception: + return False + + try: + self.conf.set_low_threshold(str(value)) + except Exception: + return False + + return True + + def get_low_critical_threshold(self): + """ + Retrieves the low critical threshold temperature of thermal by 1-based index + Actions should be taken immediately if the temperature becomes lower than the low critical + threshold otherwise the device will be damaged. + :param index: An integer, 1-based index of the thermal sensor of which to query status + :return: A float number, the low critical threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + value = self.conf.get_low_critical_threshold() + if value != self.conf.NOT_AVAILABLE: + return float(value) + + default_value = self.default_threshold[self.get_name()][self.conf.LOW_CRIT_THRESHOLD_FIELD] + if default_value != self.conf.NOT_AVAILABLE: + return float(default_value) + + raise NotImplementedError + + def set_low_critical_threshold(self, temperature): + """ + Sets the critical 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 + """ + try: + value = float(temperature) + except Exception: + return False + + try: + self.conf.set_low_critical_threshold(str(value)) + except Exception: + return False + + return True + diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform_setup.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform_setup.py new file mode 100644 index 0000000000..22bd354ea6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/sonic_platform_setup.py @@ -0,0 +1,25 @@ +from setuptools import setup + +setup( + name='sonic-platform', + version='1.0', + description='SONiC platform API implementation on Accton Platforms', + license='Apache 2.0', + author='SONiC Team', + author_email='linuxnetdev@microsoft.com', + url='https://github.com/Azure/sonic-buildimage', + packages=['sonic_platform'], + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Environment :: Plugins', + 'Intended Audience :: Developers', + 'Intended Audience :: Information Technology', + 'Intended Audience :: System Administrators', + 'License :: OSI Approved :: Apache Software License', + 'Natural Language :: English', + 'Operating System :: POSIX :: Linux', + 'Programming Language :: Python :: 3.7', + 'Topic :: Utilities', + ], + keywords='sonic SONiC platform PLATFORM', +) diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/utils/README b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/utils/README new file mode 100755 index 0000000000..78a5ce662b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/utils/README @@ -0,0 +1,65 @@ +Copyright (C) 2019 Accton Networks, Inc. + +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 3 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, see . + +All Linux kernel code is licensed under the GPLv1. All other code is +licensed under the GPLv3. Please see the LICENSE file for copies of +both licenses. + +The code for integacting with Accton AS9736-64D has 2 parts, +kernel drivers and operational script. +The kernel drivers of peripherals are under module/ directory. +1. These drivers are at module dir. +2. A operational script, accton_as9736_64d_util.py, for device initializatian and + peripheral accessing should be installed at /usr/bin. + Run "accton_as9736_64d_util.py install" to install drivers. + +To initialize the system, run "accton_as9736_64d_util.py install". +To clean up the drivers & devices, run "accton_as9736_64d_util.py clean". +To dump information of sensors, run "accton_as9736_64d_util.py show". +To dump SFP EEPROM, run "accton_as9736_64d_util.py sff". +To set fan speed, run "accton_as9736_64d_util.py set fan". +To enable/disable SFP emission, run "accton_as9736_64d_util.py set sfp". +To set system LEDs' color, run "accton_as9736_64d_util.py set led" +For more information, run "accton_as9736_64d_util.py --help". + +==================================================================== +Besides applying accton_as9736_64d_util.py to access peripherals, you can +access peripherals by sysfs nodes directly after the installation is run. + +System LED: + There are 5 system LEDs at the lower-left corner of front panel. + They are loc, diag, psu1, psu2 and fan. + The sysfs interface color mappings are as follows: + Brightness: + 0 => off + 1 => green + 2 => amber + But not all colors are available for each LED. + +Fan Control: + There are 12 fans inside 6 fan modules. + All fans share 1 duty setting, ranged from 0~100. + +Thermal sensers: + 6 temperature sensors are controlled by the lm75 kernel modules. + +PSUs: + There 2 power supplies slot at the left/right side of the back. + Once if a PSU is not plugged, the status of it is shown failed. + +There are 32 QSFP56-DD and 2 SFP+ modules are equipped. +Before operating on PSU and QSFP+, please make sure it is well plugged. +Otherwise, operation is going to fail. + diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/utils/accton_as9736_64d_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/utils/accton_as9736_64d_monitor.py new file mode 100755 index 0000000000..31603e4001 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/utils/accton_as9736_64d_monitor.py @@ -0,0 +1,625 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -* +# Copyright (c) 2019 Edgecore Networks Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR +# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT +# LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS +# FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. +# +# See the Apache Version 2.0 License for specific language governing +# permissions and limitations under the License. +# +# HISTORY: +# mm/dd/yyyy (A.D.)# +# 07/12/2022: Michael_Shih create for as9736_64d thermal plan +# 12/12/2023: Add detect temp of xcvr, and implement shutdown function. +# 23/01/2024: Sync the log buffer to the disk before powering off the DUT. +# ------------------------------------------------------------------ + +try: + import getopt + import sys + import logging + import logging.config + import logging.handlers + import signal + import time # this is only being used as part of the example + from as9736_64d.fanutil import FanUtil + from as9736_64d.thermalutil import ThermalUtil + from swsscommon import swsscommon + from sonic_platform import platform + from sonic_py_common.general import getstatusoutput_noshell +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +VERSION = '1.0' +FUNCTION_NAME = '/usr/local/bin/accton_as9736_64d_monitor' + +STATE_DB = 'STATE_DB' +TRANSCEIVER_DOM_SENSOR_TABLE = 'TRANSCEIVER_DOM_SENSOR' +TEMPERATURE_FIELD_NAME = 'temperature' + +class switch(object): + def __init__(self, value): + self.value = value + self.fall = False + + def __iter__(self): + """Return the match method once, then stop""" + yield self.match + raise StopIteration + + def match(self, *args): + """Indicate whether or not to enter a case suite""" + if self.fall or not args: + return True + elif self.value in args: # changed for v1.5, see below + self.fall = True + return True + else: + return False + + +# Thermal policy(AFO-Front to back): +# +# Fan Speed Level: +# Fan Level 1 (Fan speed: 50%, RPM +/- 10%: 6800) +# Fan Level 2 (Fan speed: 70%, RPM +/- 10%: 9520) +# Fan Level 3 (Fan speed: 100%, RPM +/- 10%: 13600) +# +# Using Thermal sensors as below: +# - SMB TMP75 (0x48) +# - SMB TMP75 (0x49) +# - SMB TMP422(0x4c) +# - FCM TMP75 (0x48) +# - FCM TTMP75 (0x49) +# - PDB_L TMP75 (0x48) +# - PDB_R TMP75 (0x49) +# - UDB TMP75 (0x48) +# - UDB TMP422(0x4c) +# - LDB TMP75(0x4c) +# - LDB TMP422(0x4d) +# - CPU core_1~8 +# - MAC Use SMB TMP422(0x4c) +# +# Raise to Fan Level 2 from Level 1 condition: +# - SMB TMP75 (0x48) >= 59 +# or +# - SMB TMP75 (0x49) >= 59 +# or +# - SMB TMP422(0x4c) >= 94 +# or +# - FCM TMP75 (0x48) >= 50 +# or +# - FCM TMP75 (0x49) >= 50 +# or +# - PDB_L TMP75 (0x48) >= 45 +# or +# - PDB_R TMP75 (0x49) >= 45 +# or +# - UDB TMP75 (0x48) >= 58 +# or +# - UDB TMP422(0x4c) >= 51 +# or +# - LDB TMP75 (0x4c) >= 54 +# or +# - LDB TMP422(0x4d) >= 54 +# +# Slow down to Fan Level 1 from Level 2 condition: +# - SMB TMP75 (0x48) <= 54 +# and +# - SMB TMP75 (0x49) <= 54 +# and +# - SMB TMP422(0x4c) <= 83 +# and +# - FCM TMP75 (0x48) <= 45 +# and +# - FCM TMP75 (0x49) <= 45 +# and +# - PDB_L TMP75 (0x48) <= 40 +# and +# - PDB_R TMP75 (0x49) <= 40 +# and +# - UDB TMP75 (0x48) <= 53 +# and +# - UDB TMP422(0x4c) <= 44 +# and +# - LDB TMP75 (0x4c) <= 47 +# and +# - LDB TMP422(0x4d) <= 47 +# +# Raise to Fan Level 3 conditions: +# - Fan failed +# - Fan has removed +# +# Thermal Protect Function for Shutdown condition: +# - CPU core temp >= 99 (System shutdown except to CPU) +# or +# - SMB TMP75 (0x48) >= 76 +# or +# - SMB TMP75 (0x49) >= 76 +# or +# - SMB TMP422(0x4c) >= 105 (MAC shutdown) +# or +# - FCM TMP75 (0x48) >= 67 +# or +# - FCM TMP75 (0x49) >= 67 +# or +# - PDB_L TMP75 (0x48) >= 62 +# or +# - PDB_R TMP75 (0x49) >= 62 +# or +# - UDB TMP75 (0x48) >= 70 +# or +# - UDB TMP422(0x4c) >= 61 +# or +# - LDB TMP75 (0x4c) >= 67 +# or +# - LDB TMP422(0x4d) >= 67 + +fan_policy_state = 0 +fan_fail = 0 +count_check = 0 + +board_thermal_min_to_mid = 0 +board_thermal_mid_to_min = 0 +cpu_fan_policy_state = 0 + +exit_by_sigterm=0 + +send_mac_shutdown_warning = 0 +send_cpu_shutdown_warning = 0 + +thermal_min_to_mid_waring_flag = [0] + +platform_chassis= None + +int_port_mapping = [] + +def stop_syncd_service(): + cmd_str = ["systemctl", "disable", "syncd"] + (status, output) = getstatusoutput_noshell(cmd_str) + if status: + logging.warning("Disable syncd.service failed") + return False + + cmd_str = ["systemctl", "stop", "syncd"] + (status, output) = getstatusoutput_noshell(cmd_str) + if status: + logging.warning("Stop syncd.service failed") + return False + + cmd_str = ["systemctl", "mask", "syncd"] + (status, output) = getstatusoutput_noshell(cmd_str) + if status: + logging.warning("Mask syncd.service failed") + return False + + return (status == 0) + +def sync_log_buffer_to_disk(): + cmd_str=["sync"] + (status, output) = getstatusoutput_noshell(cmd_str) + cmd_str=["/sbin/fstrim", "-av"] + (status, output) = getstatusoutput_noshell(cmd_str) + time.sleep(3) + + return (status == 0) + +def shutdown_mac(): + cmd_str = ["i2cset", "-f", "-y", "6", "0x60", "0x7", "0x1"] + (status, output) = getstatusoutput_noshell(cmd_str) + if status: + logging.warning("Shutdown MAC failed.") + + return (status == 0) + +def shutdown_except_cpu(): + cmd_str = ["i2cset", "-f", "-y", "6", "0x60", "0x7", "0x2"] + (status, output) = getstatusoutput_noshell(cmd_str) + if status: + logging.warning("Shutdown DUT failed.") + + return (status == 0) + +# Make a class we can use to capture stdout and sterr in the log +class device_monitor(object): + # static temp var + init_duty_cycle = 0 + new_duty_cycle = 0 + ori_duty_cycle = 0 + + def __init__(self, log_file, log_level): + """Needs a logger and a logger level.""" + + self.thermal = ThermalUtil() + self.fan = FanUtil() + + # set up logging to file + logging.basicConfig( + filename=log_file, + filemode='w', + level=log_level, + format= '[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s', + datefmt='%H:%M:%S' + ) + # set up logging to console + if log_level == logging.DEBUG: + console = logging.StreamHandler() + console.setLevel(log_level) + formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') + console.setFormatter(formatter) + logging.getLogger('').addHandler(console) + + sys_handler = logging.handlers.SysLogHandler(address = '/dev/log') + sys_handler.setLevel(logging.INFO) + logging.getLogger('').addHandler(sys_handler) + #logging.debug('SET. logfile:%s / loglevel:%d', log_file, log_level) + + self.transceiver_dom_sensor_table = None + + def set_fan_duty_cycle(self, fan_level, duty_cycle_percentage): + logging.debug("- [Fan]: fan_policy_state = %d, set new_duty_cycle = %d", fan_level, duty_cycle_percentage) + self.fan.set_fan_duty_cycle(duty_cycle_percentage) + + def get_transceiver_temperature(self, iface_name): + if self.transceiver_dom_sensor_table is None: + return 0.0 + + (status, ret) = self.transceiver_dom_sensor_table.hget(iface_name, TEMPERATURE_FIELD_NAME) + if status: + try: + return float(ret) + except (TypeError, ValueError): + pass + + return 0.0 + + def manage_fans(self): + + global platform_chassis + global fan_policy_state + global fan_fail + global count_check + global board_thermal_min_to_mid + global board_thermal_mid_to_min + global thermal_fan_policy_state + global cpu_fan_policy_state + global mac_fan_policy_state + global send_mac_shutdown_warning + global send_cpu_shutdown_warning + global thermal_min_to_mid_waring_flag + global int_port_mapping + + LEVEL_FAN_INIT=0 + FAN_LEVEL_1 = 1 + FAN_LEVEL_2 = 2 + FAN_LEVEL_3 = 3 + POLICY_NEED_SHUTDOWN = 4 + + fan_speed_policy = { + FAN_LEVEL_1: [50], + FAN_LEVEL_2: [75], + FAN_LEVEL_3: [100] + } + + fan = self.fan + thermal = self.thermal + + TYPE_SENSOR = 1 + TYPE_TRANSCEIVER = 2 + + TRANSCEIVER_NUM_MAX = 64 + TOTAL_DETECT_SENSOR_NUM = thermal.THERMAL_NUM_BD_SENSOR + TRANSCEIVER_NUM_MAX + + thermal_spec={ + "min_to_mid_temp": [(TYPE_SENSOR, 59000), (TYPE_SENSOR, 59000), + (TYPE_SENSOR, 50000), (TYPE_SENSOR, 50000), + (TYPE_SENSOR, 45000), (TYPE_SENSOR, 45000), + (TYPE_SENSOR, 58000), (TYPE_SENSOR, 51000), + (TYPE_SENSOR, 54000), (TYPE_SENSOR, 54000), (TYPE_SENSOR, 94000)], + "mid_to_min_temp": [(TYPE_SENSOR, 54000), (TYPE_SENSOR, 54000), + (TYPE_SENSOR, 45000), (TYPE_SENSOR, 45000), + (TYPE_SENSOR, 40000), (TYPE_SENSOR, 40000), + (TYPE_SENSOR, 53000), (TYPE_SENSOR, 44000), + (TYPE_SENSOR, 47000), (TYPE_SENSOR, 47000), (TYPE_SENSOR, 83000)], + "shutdown_temp" : [(TYPE_SENSOR, 76000), (TYPE_SENSOR, 76000), + (TYPE_SENSOR, 67000), (TYPE_SENSOR, 67000), + (TYPE_SENSOR, 62000), (TYPE_SENSOR, 62000), + (TYPE_SENSOR, 70000), (TYPE_SENSOR, 61000), + (TYPE_SENSOR, 67000), (TYPE_SENSOR, 67000), (TYPE_SENSOR, 105000)], + "cpu_temp" : [(TYPE_SENSOR, 80000), (TYPE_SENSOR, 99000)], + "mac_temp" : [(TYPE_SENSOR, 85000), (TYPE_SENSOR, 105000)] + } + + thermal_spec["min_to_mid_temp"] += [(TYPE_TRANSCEIVER, 70000)] + thermal_spec["mid_to_min_temp"] += [(TYPE_TRANSCEIVER, 60000)] + + board_thermal_val = [] + board_thermal_or_chk_min_to_mid = [0] * (TOTAL_DETECT_SENSOR_NUM) + board_thermal_and_chk_mid_to_min = [0] * (TOTAL_DETECT_SENSOR_NUM) + cpucore_thermal_val = [0, 0, 0, 0, 0, 0, 0, 0] + mactemp_thermal_val = [0] + + # After booting, the database might not be ready for + # connection. So, it should try to connect to the database + # if self.transceiver_dom_sensor_table is None. + if self.transceiver_dom_sensor_table is None: + try: + state_db = swsscommon.DBConnector(STATE_DB, 0, False) + self.transceiver_dom_sensor_table = swsscommon.Table(state_db, TRANSCEIVER_DOM_SENSOR_TABLE) + except Exception as e: + logging.debug("{}".format(e)) + + # Get duty_cycle at init: + if fan_policy_state == LEVEL_FAN_INIT: + # Init sensors record warning flag: + thermal_min_to_mid_waring_flag = thermal_min_to_mid_waring_flag * TOTAL_DETECT_SENSOR_NUM + + # Record port mapping to interface + for port_num in range(TRANSCEIVER_NUM_MAX): + sfp = platform_chassis.get_sfp(port_num+1) + int_port_mapping.append( (port_num+1, sfp, sfp.get_name()) ) + + self.init_duty_cycle = fan.get_fan_duty_cycle() + for i in range (FAN_LEVEL_1, FAN_LEVEL_3 + 1): + if self.init_duty_cycle == fan_speed_policy[i][0]: + fan_policy_state = i + else: + continue + logging.debug("- [Init]: fan_policy_state = %d, get duty_cycle = %d", fan_policy_state, self.init_duty_cycle) + # Fan duty_cycle is not in FAN_LEVEL_1~3 case + if fan_policy_state == LEVEL_FAN_INIT: + if (self.init_duty_cycle > fan_speed_policy[FAN_LEVEL_2][0] and + self.init_duty_cycle < fan_speed_policy[FAN_LEVEL_3][0]): + fan_policy_state = FAN_LEVEL_2 + else: + fan_policy_state = FAN_LEVEL_1 + + self.set_fan_duty_cycle(fan_policy_state, fan_speed_policy[fan_policy_state][0]) + + return + + self.ori_duty_cycle = fan.get_fan_duty_cycle() + self.new_duty_cycle = 0 + + board_thermal_min_to_mid = 0 #use for | operation + board_thermal_mid_to_min = 1 #use for & operation + broad_thermal_need_shutdown = 0 + thermal_fan_policy_state = LEVEL_FAN_INIT + cpu_fan_policy_state = LEVEL_FAN_INIT + mac_fan_policy_state = LEVEL_FAN_INIT + + #1 Check fan: Unpresent or fan_fault status + fan_fail = 0 + for i in range (fan.FAN_NUM_1_IDX, fan.FAN_NUM_ON_MAIN_BROAD+1): + if fan.get_fan_present(i) == 0: + fan_fail = 1 + logging.debug('- fan_%d absent, set duty_cycle to 100%', i) + elif fan.get_fan_fault(i) == 1: + fan_fail = 1 + logging.debug('- fan_%d fail, set duty_cycle to 100%', i) + else: + if fan_fail == 1: + continue + + ori_state = fan_policy_state + current_state = fan_policy_state + + if fan_fail == 1: + if ori_state == FAN_LEVEL_2 or ori_state == FAN_LEVEL_3: + current_state = FAN_LEVEL_3 + elif ori_state == FAN_LEVEL_1: + current_state = FAN_LEVEL_2 + + if current_state != ori_state: + fan_policy_state = current_state + self.new_duty_cycle = fan_speed_policy[fan_policy_state][0] + + if self.new_duty_cycle != self.ori_duty_cycle: + self.set_fan_duty_cycle(fan_policy_state, fan_speed_policy[fan_policy_state][0]) + return True + + #2-1 Board Sensors get value: + for i in range (thermal.THERMAL_NUM_1_IDX, thermal.THERMAL_NUM_11_IDX+1): + board_thermal_val.append((TYPE_SENSOR, None, thermal._get_thermal_val(i))) + #index: 0~10(11 thermal sensor) + if board_thermal_val[i-1][2] >= thermal_spec["min_to_mid_temp"][i-1][1]: + board_thermal_or_chk_min_to_mid[i-1] = 1 + # During this fan-speed rise, each sensors can only send warning log on syslog once + if thermal_min_to_mid_waring_flag[i-1] == 0: + logging.warning('- Monitor %s, temperature is %d. Temperature is over %d.', + thermal.get_thermal_name(i), + board_thermal_val[i-1][2]/1000, + thermal_spec["min_to_mid_temp"][i-1][1]/1000) + thermal_min_to_mid_waring_flag[i-1] = 1 + else: + board_thermal_or_chk_min_to_mid[i-1] = 0 + + if board_thermal_val[i-1][2] <= thermal_spec["mid_to_min_temp"][i-1][1]: + board_thermal_and_chk_mid_to_min[i-1] = 1 + else: + board_thermal_and_chk_mid_to_min[i-1] = 0 + + for port_num in range(TRANSCEIVER_NUM_MAX): + board_thermal_val.append((TYPE_TRANSCEIVER, int_port_mapping[port_num][1], + self.get_transceiver_temperature(int_port_mapping[port_num][2]) * 1000)) + #index: 11~74(64 port) + if board_thermal_val[thermal.THERMAL_NUM_11_IDX + port_num][2] >= thermal_spec["min_to_mid_temp"][thermal.THERMAL_NUM_BD_SENSOR][1]: + board_thermal_or_chk_min_to_mid[thermal.THERMAL_NUM_11_IDX + port_num] = 1 + # During this fan-speed rise, each xcvr can only send warning log on syslog once + if thermal_min_to_mid_waring_flag[thermal.THERMAL_NUM_11_IDX + port_num] == 0: + logging.warning('- Monitor port %d, temperature is %d. Temperature is over %d.', + port_num+1, + board_thermal_val[thermal.THERMAL_NUM_11_IDX + port_num][2]/1000, + thermal_spec["min_to_mid_temp"][thermal.THERMAL_NUM_BD_SENSOR][1]/1000) + thermal_min_to_mid_waring_flag[thermal.THERMAL_NUM_11_IDX + port_num] = 1 + else: + board_thermal_or_chk_min_to_mid[thermal.THERMAL_NUM_11_IDX + port_num] = 0 + + if board_thermal_val[thermal.THERMAL_NUM_11_IDX + port_num][2] <= thermal_spec["mid_to_min_temp"][thermal.THERMAL_NUM_BD_SENSOR][1]: + board_thermal_and_chk_mid_to_min[thermal.THERMAL_NUM_11_IDX + port_num] = 1 + else: + board_thermal_and_chk_mid_to_min[thermal.THERMAL_NUM_11_IDX + port_num] = 0 + + for i in range (thermal.THERMAL_NUM_1_IDX, thermal.THERMAL_NUM_10_IDX+1): #Not include TH4-TMP422(0x4c) + if board_thermal_val[i-1][2] >= thermal_spec["shutdown_temp"][i-1][1]: + broad_thermal_need_shutdown = 1 + logging.warning('- Monitor %s, temperature is %d. Temperature is over %d. Need shutdown DUT.', + thermal.get_thermal_name(i), + board_thermal_val[i-1][2]/1000, + thermal_spec["shutdown_temp"][i-1][1]/1000) + break + + #2-2 CPU Sensors get value: + for i in range (thermal.THERMAL_NUM_1_IDX, thermal.THERMAL_NUM_CPU_CORE+1): + cpucore_thermal_val[i-1] = thermal._get_thermal_val(i + thermal.THERMAL_NUM_BD_SENSOR) + + #2-3 MAC Sensors get value: + mactemp_thermal_val[0] = board_thermal_val[thermal.THERMAL_NUM_11_IDX-1][2] + + #3-1 Decide the board thermal policy: + if broad_thermal_need_shutdown == 1: + thermal_fan_policy_state = POLICY_NEED_SHUTDOWN + else: + for i in range (TOTAL_DETECT_SENSOR_NUM): + board_thermal_min_to_mid |= board_thermal_or_chk_min_to_mid[i] + board_thermal_mid_to_min &= board_thermal_and_chk_mid_to_min[i] + + if board_thermal_min_to_mid == 0 and board_thermal_mid_to_min == 1: + thermal_fan_policy_state = FAN_LEVEL_1 + elif board_thermal_min_to_mid == 1 and board_thermal_mid_to_min == 0: + thermal_fan_policy_state = FAN_LEVEL_2 + else: + if ori_state == FAN_LEVEL_1: + thermal_fan_policy_state = FAN_LEVEL_1 + else: + thermal_fan_policy_state = FAN_LEVEL_2 + + #3-2 Decide the CPU thermal policy: + for i in range (thermal.THERMAL_NUM_1_IDX, thermal.THERMAL_NUM_CPU_CORE+1): + + if cpucore_thermal_val[i-1] >= thermal_spec["cpu_temp"][1][1] : #Case of shutdown + if send_cpu_shutdown_warning == 0: + logging.warning('Monitor %s, temperature is %d. Temperature is over %d', + thermal.get_thermal_name(thermal.THERMAL_NUM_BD_SENSOR+i), + cpucore_thermal_val[i-1]/1000, + thermal_spec["cpu_temp"][1][1]/1000) + cpu_fan_policy_state = POLICY_NEED_SHUTDOWN + + #3-3 Decide the MAC thermal policy: + if mactemp_thermal_val[0] >= thermal_spec["mac_temp"][1][1] : #Case of shutdown + if send_mac_shutdown_warning == 0: + logging.warning('Monitor MAC, temperature is %d. Temperature is over %d', mactemp_thermal_val[0]/1000, thermal_spec["mac_temp"][1][1]/1000) + mac_fan_policy_state = POLICY_NEED_SHUTDOWN + + + #4 Condition of change fan speed by sensors policy: + if ori_state == FAN_LEVEL_3: + if thermal_fan_policy_state == POLICY_NEED_SHUTDOWN or cpu_fan_policy_state == POLICY_NEED_SHUTDOWN: + if send_cpu_shutdown_warning == 0: + send_cpu_shutdown_warning = 1 + stop_syncd_service() + logging.critical("CPU sensor for temperature high is detected, shutdown DUT.") + sync_log_buffer_to_disk() + shutdown_except_cpu() + return True + + elif mac_fan_policy_state == POLICY_NEED_SHUTDOWN: + if send_mac_shutdown_warning == 0: + send_mac_shutdown_warning =1 + stop_syncd_service() + logging.critical("MAC sensor for temperature high is detected, shutdown MAC chip.") + shutdown_mac() # No return, keep monitoring. + + else: + current_state = FAN_LEVEL_2 + + elif ori_state == FAN_LEVEL_2: + if thermal_fan_policy_state == POLICY_NEED_SHUTDOWN or cpu_fan_policy_state == POLICY_NEED_SHUTDOWN or mac_fan_policy_state == POLICY_NEED_SHUTDOWN: + current_state = FAN_LEVEL_3 + + elif thermal_fan_policy_state == FAN_LEVEL_1: + current_state = FAN_LEVEL_1 + logging.info('- Monitor all sensors, temperature is less than threshold. Decrease fan duty_cycle from %d to %d.', fan_speed_policy[FAN_LEVEL_2][0], fan_speed_policy[FAN_LEVEL_1][0]) + # Clear sensors send-syslog-warning record + thermal_min_to_mid_waring_flag = [0] * TOTAL_DETECT_SENSOR_NUM + else: + current_state = FAN_LEVEL_2 + + elif ori_state == FAN_LEVEL_1: + if thermal_fan_policy_state == POLICY_NEED_SHUTDOWN or cpu_fan_policy_state == POLICY_NEED_SHUTDOWN or mac_fan_policy_state == POLICY_NEED_SHUTDOWN: + current_state = FAN_LEVEL_2 + + elif thermal_fan_policy_state == FAN_LEVEL_2: + current_state = FAN_LEVEL_2 + logging.warning('- Increase fan duty_cycle from %d to %d.', fan_speed_policy[FAN_LEVEL_1][0], fan_speed_policy[FAN_LEVEL_2][0]) + + else: + current_state = FAN_LEVEL_1 + + #4 Setting new duty-cyle: + if current_state != ori_state: + fan_policy_state = current_state + + self.new_duty_cycle = fan_speed_policy[fan_policy_state][0] + + if self.new_duty_cycle != self.ori_duty_cycle: + self.set_fan_duty_cycle(fan_policy_state, fan_speed_policy[fan_policy_state][0]) + return True + + if self.new_duty_cycle == 0 : + self.set_fan_duty_cycle(FAN_LEVEL_3, fan_speed_policy[FAN_LEVEL_3][0]) + + return True + +def signal_handler(sig, frame): + global exit_by_sigterm + if sig == signal.SIGTERM: + print("Caught SIGTERM - exiting...") + exit_by_sigterm = 1 + else: + pass + +def main(argv): + log_file = '%s.log' % FUNCTION_NAME + log_level = logging.INFO + global test_temp + global exit_by_sigterm + signal.signal(signal.SIGTERM, signal_handler) + if len(sys.argv) != 1: + try: + opts, args = getopt.getopt(argv,'hdl:',['lfile=']) + except getopt.GetoptError: + print('Usage: %s [-d] [-l ]' % sys.argv[0]) + return 0 + for opt, arg in opts: + if opt == '-h': + print('Usage: %s [-d] [-l ]' % sys.argv[0]) + return 0 + elif opt in ('-d', '--debug'): + log_level = logging.DEBUG + elif opt in ('-l', '--lfile'): + log_file = arg + + monitor = device_monitor(log_file, log_level) + + global platform_chassis + platform_chassis = platform.Platform().get_chassis() + + # Loop forever, doing something useful hopefully: + while True: + monitor.manage_fans() + # HW recommends checking the temperature every 10 seconds + time.sleep(10) + if exit_by_sigterm == 1: + break + +if __name__ == '__main__': + main(sys.argv[1:]) + diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/utils/accton_as9736_64d_monitor_fan.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/utils/accton_as9736_64d_monitor_fan.py new file mode 100755 index 0000000000..d307f93e92 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/utils/accton_as9736_64d_monitor_fan.py @@ -0,0 +1,197 @@ +#!/usr/bin/env python +# +# Copyright (C) 2018 Accton Technology Corporation +# +# 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 3 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, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 04/23/2021: Michael_Shih create for as9736-64d +# ------------------------------------------------------------------ + +try: + import getopt + import sys + import logging + import logging.config + import logging.handlers + import signal + import time # this is only being used as part of the example +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +# Deafults +VERSION = '1.0' +FUNCTION_NAME = '/usr/local/bin/accton_as9736_64d_monitor_fan' + +class switch(object): + def __init__(self, value): + self.value = value + self.fall = False + + def __iter__(self): + """Return the match method once, then stop""" + yield self.match + raise StopIteration + + def match(self, *args): + """Indicate whether or not to enter a case suite""" + if self.fall or not args: + return True + elif self.value in args: # changed for v1.5, see below + self.fall = True + return True + else: + return False + + +fan_state=[2, 2, 2, 2] #init state=2, insert=1, remove=0 +fan_status_state=[2, 2, 2, 2] #init state=2, fault=1, normal=0 + +exit_by_sigterm=0 + +# Make a class we can use to capture stdout and sterr in the log +class device_monitor(object): + + def __init__(self, log_file, log_level): + + self.fan_num = 4 + self.fan_path = "/sys/bus/i2c/devices/25-0033/" + self.present = { + 0: "fan1_present", + 1: "fan2_present", + 2: "fan3_present", + 3: "fan4_present", + } + + self.fault = { + 0: "fan1_fault", + 1: "fan2_fault", + 2: "fan3_fault", + 3: "fan4_fault", + } + + """Needs a logger and a logger level.""" + # set up logging to file + logging.basicConfig( + filename=log_file, + filemode='w', + level=log_level, + format= '[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s', + datefmt='%H:%M:%S' + ) + + # set up logging to console + if log_level == logging.DEBUG: + console = logging.StreamHandler() + console.setLevel(logging.DEBUG) + formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') + console.setFormatter(formatter) + logging.getLogger('').addHandler(console) + + sys_handler = logging.handlers.SysLogHandler(address = '/dev/log') + #sys_handler.setLevel(logging.WARNING) + sys_handler.setLevel(logging.INFO) + logging.getLogger('').addHandler(sys_handler) + + #logging.debug('SET. logfile:%s / loglevel:%d', log_file, log_level) + + def manage_fan(self): + + FAN_STATE_REMOVE = 0 + FAN_STATE_INSERT = 1 + + FAN_STATUS_FAULT = 1 + FAN_STATUS_NORMAL = 0 + + global fan_state + global fan_status_state + + for idx in range (0, self.fan_num): + node = self.fan_path + self.present[idx] + try: + val_file = open(node) + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + content = val_file.readline().rstrip() + val_file.close() + # content is a string, either "0" or "1" + if content == "1": + if fan_state[idx]!=1: + fan_state[idx]=FAN_STATE_INSERT + logging.info("FAN-%d present is detected", idx+1); + else: + if fan_state[idx]!=0: + fan_state[idx]=FAN_STATE_REMOVE + logging.warning("Alarm for FAN-%d absent is detected", idx+1) + + for idx in range (0, self.fan_num): + node = self.fan_path + self.fault[idx] + try: + val_file = open(node) + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + content = val_file.readline().rstrip() + val_file.close() + # content is a string, either "0" or "1" + if content == "1": + if fan_status_state[idx]!=FAN_STATUS_FAULT: + if fan_state[idx] == FAN_STATE_INSERT: + logging.warning("Alarm for FAN-%d failed is detected", idx+1); + fan_status_state[idx]=FAN_STATUS_FAULT + else: + fan_status_state[idx]=FAN_STATUS_NORMAL + + return True + +def signal_handler(sig, frame): + global exit_by_sigterm + if sig == signal.SIGTERM: + print("Caught SIGTERM - exiting...") + exit_by_sigterm = 1 + else: + pass + +def main(argv): + log_file = '%s.log' % FUNCTION_NAME + log_level = logging.INFO + global exit_by_sigterm + signal.signal(signal.SIGTERM, signal_handler) + + if len(sys.argv) != 1: + try: + opts, args = getopt.getopt(argv,'hdl:',['lfile=']) + except getopt.GetoptError: + print('Usage: %s [-d] [-l ]' % sys.argv[0]) + return 0 + for opt, arg in opts: + if opt == '-h': + print('Usage: %s [-d] [-l ]' % sys.argv[0]) + return 0 + elif opt in ('-d', '--debug'): + log_level = logging.DEBUG + elif opt in ('-l', '--lfile'): + log_file = arg + monitor = device_monitor(log_file, log_level) + while True: + monitor.manage_fan() + time.sleep(3) + if exit_by_sigterm == 1: + break + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/utils/accton_as9736_64d_monitor_psu.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/utils/accton_as9736_64d_monitor_psu.py new file mode 100755 index 0000000000..e9112076ca --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/utils/accton_as9736_64d_monitor_psu.py @@ -0,0 +1,176 @@ +#!/usr/bin/env python +# +# Copyright (C) 2018 Accton Technology Corporation +# +# 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 3 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, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 04/23/2021: Michael_shih create for as9736-64d +# ------------------------------------------------------------------ + +try: + import getopt + import sys + import logging + import logging.config + import logging.handlers + import signal + import time # this is only being used as part of the example +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +# Deafults +VERSION = '1.0' +FUNCTION_NAME = '/usr/local/bin/accton_as9736_64d_monitor_psu' + +psu_state=[2, 2] +psu_status_state=[2, 2] + +exit_by_sigterm=0 + +# Make a class we can use to capture stdout and sterr in the log +class device_monitor(object): + + def __init__(self, log_file, log_level): + + self.psu_num = 2 + self.psu_path = "/sys/bus/i2c/devices/" + self.presence = "/psu_present" + self.oper_status = "/psu_power_good" + self.mapping = { + 0: "41-0051", + 1: "33-0050", + } + + """Needs a logger and a logger level.""" + # set up logging to file + logging.basicConfig( + filename=log_file, + filemode='w', + level=log_level, + format= '[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s', + datefmt='%H:%M:%S' + ) + # set up logging to console + + if log_level == logging.DEBUG: + console = logging.StreamHandler() + console.setLevel(log_level) + formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') + console.setFormatter(formatter) + logging.getLogger('').addHandler(console) + + sys_handler = logging.handlers.SysLogHandler(address = '/dev/log') + #sys_handler.setLevel(logging.WARNING) + sys_handler.setLevel(logging.INFO) + logging.getLogger('').addHandler(sys_handler) + + #logging.debug('SET. logfile:%s / loglevel:%d', log_file, log_level) + + def manage_psu(self): + + PSU_STATE_REMOVE = 0 + PSU_STATE_INSERT = 1 + + PSU_STATUS_NO_POWER = 0 + PSU_STATUS_POWER_GOOD = 1 + PSU_STATUS_IDLE =2 + + global psu_state + + for idx in range (0, self.psu_num): + node = self.psu_path + self.mapping[idx] + self.presence + try: + val_file = open(node) + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + content = val_file.readline().rstrip() + val_file.close() + # content is a string, either "0" or "1" + if content == "1": + if psu_state[idx]!=1: + psu_state[idx]=PSU_STATE_INSERT + logging.info("PSU-%d present is detected", idx+1); + #psu_status_state[idx]=PSU_STATUS_POWER_GOOD #when insert, assume power is good. If no_power, next code will find it. + else: + if psu_state[idx]!=0: + psu_state[idx]=PSU_STATE_REMOVE + logging.warning("Alarm for PSU-%d absent is detected", idx+1); + psu_status_state[idx]=PSU_STATUS_IDLE + + for idx in range (0, self.psu_num): + node = self.psu_path + self.mapping[idx] + self.oper_status + try: + val_file = open(node) + except IOError as e: + print("Error: unable to open file: %s" % str(e)) + return False + content = val_file.readline().rstrip() + val_file.close() + # content is a string, either "0" or "1" + if content == "0": + if psu_status_state[idx]!=PSU_STATUS_NO_POWER: + if psu_state[idx]==PSU_STATE_INSERT: + logging.warning("Alarm for PSU-%d failed is detected", idx+1); + psu_status_state[idx]=PSU_STATUS_NO_POWER + else: + if psu_state[idx]==PSU_STATE_INSERT: + if psu_status_state[idx]!=PSU_STATUS_POWER_GOOD: + logging.info("PSU-%d power_good is detected", idx+1); + psu_status_state[idx]=PSU_STATUS_POWER_GOOD + + + return True + +def signal_handler(sig, frame): + global exit_by_sigterm + if sig == signal.SIGTERM: + print("Caught SIGTERM - exiting...") + exit_by_sigterm = 1 + else: + pass + +def main(argv): + log_file = '%s.log' % FUNCTION_NAME + log_level = logging.INFO + global exit_by_sigterm + signal.signal(signal.SIGTERM, signal_handler) + if len(sys.argv) != 1: + try: + opts, args = getopt.getopt(argv,'hdl:',['lfile=']) + except getopt.GetoptError: + print('Usage: %s [-d] [-l ]' % sys.argv[0]) + return 0 + for opt, arg in opts: + if opt == '-h': + print('Usage: %s [-d] [-l ]' % sys.argv[0]) + return 0 + elif opt in ('-d', '--debug'): + log_level = logging.DEBUG + elif opt in ('-l', '--lfile'): + log_file = arg + monitor = device_monitor(log_file, log_level) + # Loop forever, doing something useful hopefully: + while True: + monitor.manage_psu() + time.sleep(3) + if exit_by_sigterm == 1: + break + +if __name__ == '__main__': + main(sys.argv[1:]) + diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/utils/accton_as9736_64d_util.py b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/utils/accton_as9736_64d_util.py new file mode 100755 index 0000000000..baabef9141 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/utils/accton_as9736_64d_util.py @@ -0,0 +1,361 @@ +#!/usr/bin/env python +# +# Copyright (C) 2016 Accton Networks, Inc. +# +# 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 3 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, see . + +""" +Usage: %(scriptName)s [options] command object +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes +""" + +import subprocess +import getopt +import sys +import logging +import time +import os + +PROJECT_NAME = 'as9736_64d' +version = '0.0.1' +verbose = False +DEBUG = False +args = [] + +i2c_prefix = '/sys/bus/i2c/devices/' +xcvr_set_no_reset = 'echo 0 > /sys/bus/platform/devices/as9736_64d_fpga/module_reset_all' + +mknod = [ + # i2c-mux + 'echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-0/new_device', + 'echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-3/new_device', + 'echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-5/new_device', + 'echo pca9548 0x76 > /sys/bus/i2c/devices/i2c-9/new_device', + 'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-10/new_device', + 'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-11/new_device', + 'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-12/new_device', + 'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-18/new_device', + 'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-19/new_device', + + # CPLD + 'echo as9736_64d_cpld_cpu 0x60 > /sys/bus/i2c/devices/i2c-6/new_device', + # PDB-L + 'echo as9736_64d_cpld_pdb 0x60 > /sys/bus/i2c/devices/i2c-36/new_device', + # PDB-R + 'echo as9736_64d_cpld_pdb 0x60 > /sys/bus/i2c/devices/i2c-44/new_device', + 'echo as9736_64d_cpld_scm 0x35 > /sys/bus/i2c/devices/i2c-51/new_device', + + # FAN + 'echo as9736_64d_fan 0x33 > /sys/bus/i2c/devices/i2c-25/new_device', + + # LM75 + 'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-2/new_device', + 'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-2/new_device', + 'echo tmp421 0x4c > /sys/bus/i2c/devices/i2c-14/new_device', + 'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-27/new_device', + 'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-27/new_device', + 'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-34/new_device', + 'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-42/new_device', + 'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-57/new_device', + 'echo tmp421 0x4c > /sys/bus/i2c/devices/i2c-58/new_device', + 'echo lm75 0x4c > /sys/bus/i2c/devices/i2c-65/new_device', + 'echo tmp421 0x4d > /sys/bus/i2c/devices/i2c-66/new_device', + + # PSU-1 + 'echo delta_dps2400 0x59 > /sys/bus/i2c/devices/i2c-41/new_device', + 'echo as9736_64d_psu1 0x51 > /sys/bus/i2c/devices/i2c-41/new_device', + + # PSU-2 + 'echo delta_dps2400 0x58 > /sys/bus/i2c/devices/i2c-33/new_device', + 'echo as9736_64d_psu2 0x50 > /sys/bus/i2c/devices/i2c-33/new_device', + + # EERPOM + 'echo 24c256 0x51 > /sys/bus/i2c/devices/i2c-20/new_device', +] + +FORCE = 0 + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv) < 2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG: + print(options) + print(args) + print(len(sys.argv)) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + do_mux_setting("fp") + elif arg == 'clean': + do_uninstall() + elif arg == 'api': + do_sonic_platform_install() + elif arg == 'api_clean': + do_sonic_platform_clean() + else: + show_help() + + return 0 + +def do_mux_setting(select_mode): + print("LDB 10G MUX setting select: mac to "+ select_mode) + status, output = log_os_system("ldb_mux_setting.sh " + select_mode, 0) + + if status: + print('Error: Failed to do MUX setting.') + return status + +def show_help(): + print(__doc__ % {'scriptName': sys.argv[0].split("/")[-1]}) + sys.exit(0) + + +def my_log(txt): + if DEBUG: + print("[ACCTON DBG]: " + txt) + return + +def log_os_system(cmd, show): + logging.info('Run :' + cmd) + output = "" + status, output = subprocess.getstatusoutput(cmd) + my_log(cmd + "with result:" + str(status)) + my_log("cmd:" + cmd) + my_log(" output:" + output) + if status: + logging.info('Failed :' + cmd) + if show: + print(('Failed :' + cmd)) + return status, output + +def driver_check(): + ret, lsmod = log_os_system("ls /sys/module/*accton*", 0) + logging.info('mods:' + lsmod) + if ret: + return False + +kos = [ + 'depmod', + 'modprobe i2c_i801', + 'modprobe i2c_ismt', + 'modprobe i2c_dev', + 'modprobe i2c_mux_pca954x', + 'modprobe accton_as9736_64d_cpld', + 'modprobe accton_as9736_64d_fan', + 'modprobe accton_i2c_psu', + 'modprobe accton_as9736_64d_psu', + 'modprobe accton_as9736_64d_fpga', + 'modprobe optoe', + 'modprobe tmp421', + 'modprobe lm75'] + +def driver_install(): + global FORCE + + for i in range(0, len(kos)): + status, output = log_os_system(kos[i], 1) + + if status: + if FORCE == 0: + return status + return 0 + +def driver_uninstall(): + global FORCE + for i in range(0, len(kos)): + rm = kos[-(i + 1)].replace("modprobe", "modprobe -rq") + lst = rm.split(" ") + + if len(lst) > 3: + del(lst[3]) + rm = " ".join(lst) + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + +def device_install(): + global FORCE + + for i in range(0, len(mknod)): + # for pca954x need times to built new i2c buses + if mknod[i].find('pca954') != -1: + time.sleep(2) + + status, output = log_os_system(mknod[i], 1) + if status: + print(output) + if FORCE == 0: + return status + + # set all pca954x idle_disconnect + cmd = 'echo -2 | tee /sys/bus/i2c/drivers/pca954x/*-00*/idle_state' + status, output = log_os_system(cmd, 1) + if status: + print(output) + if FORCE == 0: + return status + + return + +def device_uninstall(): + global FORCE + + nodelist = mknod + + for i in range(len(nodelist)): + target = nodelist[-(i + 1)] + temp = target.split() + del temp[1] + temp[-1] = temp[-1].replace('new_device', 'delete_device') + status, output = log_os_system(" ".join(temp), 1) + if status: + print(output) + if FORCE == 0: + return status + + return + +def system_ready(): + if driver_check() == False: + return False + if not device_exist(): + return False + return True + +PLATFORM_ROOT_PATH = '/usr/share/sonic/device' +PLATFORM_API2_WHL_FILE_PY3 ='sonic_platform-1.0-py3-none-any.whl' +def do_sonic_platform_install(): + device_path = "{}{}{}{}".format(PLATFORM_ROOT_PATH, '/x86_64-accton_', PROJECT_NAME, '-r0') + SONIC_PLATFORM_BSP_WHL_PKG_PY3 = "/".join([device_path, PLATFORM_API2_WHL_FILE_PY3]) + + #Check API2.0 on py whl file + status, output = log_os_system("pip3 show sonic-platform > /dev/null 2>&1", 0) + if status: + if os.path.exists(SONIC_PLATFORM_BSP_WHL_PKG_PY3): + status, output = log_os_system("pip3 install "+ SONIC_PLATFORM_BSP_WHL_PKG_PY3, 1) + if status: + print("Error: Failed to install {}".format(PLATFORM_API2_WHL_FILE_PY3)) + return status + else: + print("Successfully installed {} package".format(PLATFORM_API2_WHL_FILE_PY3)) + else: + print(('{} is not found'.format(PLATFORM_API2_WHL_FILE_PY3))) + else: + print(('{} has installed'.format(PLATFORM_API2_WHL_FILE_PY3))) + + return + +def do_sonic_platform_clean(): + status, output = log_os_system("pip3 show sonic-platform > /dev/null 2>&1", 0) + if status: + print(('{} does not install, not need to uninstall'.format(PLATFORM_API2_WHL_FILE_PY3))) + + else: + status, output = log_os_system("pip3 uninstall sonic-platform -y", 0) + if status: + print(('Error: Failed to uninstall {}'.format(PLATFORM_API2_WHL_FILE_PY3))) + return status + else: + print(('{} is uninstalled'.format(PLATFORM_API2_WHL_FILE_PY3))) + + return + +def do_install(): + if driver_check() == False: + print("No driver, installing....") + status = driver_install() + if status: + if FORCE == 0: + return status + else: + print(PROJECT_NAME.upper() + " drivers detected....") + if not device_exist(): + print("No device, installing....") + status = device_install() + if status: + if FORCE == 0: + return status + else: + print(PROJECT_NAME.upper() + " devices detected....") + + do_sonic_platform_install() + # Init QSFP release reset mode: + # (FPGA default change to reset mode after v.12) + print("Release reset mode") + status, output = log_os_system(xcvr_set_no_reset, 1) + if status: + if FORCE == 0: + return status + + return + +def do_uninstall(): + if not device_exist(): + print(PROJECT_NAME.upper() + " has no device installed....") + else: + print("Removing device....") + status = device_uninstall() + if status: + if FORCE == 0: + return status + + if driver_check() == False: + print(PROJECT_NAME.upper() + " has no driver installed....") + else: + print("Removing installed driver....") + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + do_sonic_platform_clean() + + return + +def device_exist(): + ret1, log = log_os_system("ls " + i2c_prefix + "*0072", 0) + ret2, log = log_os_system("ls " + i2c_prefix + "i2c-2", 0) + return not(ret1 or ret2) + +if __name__ == "__main__": + main() + diff --git a/platform/broadcom/sonic-platform-modules-accton/as9736-64d/utils/ldb_mux_setting.sh b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/utils/ldb_mux_setting.sh new file mode 100755 index 0000000000..0a8a679b85 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as9736-64d/utils/ldb_mux_setting.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +i2cget -y 72 0x58 0 b > /dev/null +if [ $? -ne 0 ];then + printf "Device DS100(0x58) not found\n" + i2cdetect -y 0 + exit 1 +else + printf "Device DS100(0x58) exits\n" +fi + +# Mux setting +i2cset -y 72 0x58 0x06 0x18 +i2cset -y 72 0x58 0x0F 0x00 +i2cset -y 72 0x58 0x16 0x00 +i2cset -y 72 0x58 0x17 0xAA +i2cset -y 72 0x58 0x18 0x00 +i2cset -y 72 0x58 0x1D 0x00 +i2cset -y 72 0x58 0x24 0x00 +i2cset -y 72 0x58 0x25 0xA8 +i2cset -y 72 0x58 0x26 0x00 +i2cset -y 72 0x58 0x2C 0x00 +i2cset -y 72 0x58 0x2D 0xAA +i2cset -y 72 0x58 0x2E 0x00 +i2cset -y 72 0x58 0x34 0xAA +i2cset -y 72 0x58 0x35 0x00 +i2cset -y 72 0x58 0x3A 0x00 +i2cset -y 72 0x58 0x3B 0xAA +i2cset -y 72 0x58 0x3C 0x00 +i2cset -y 72 0x58 0x41 0x00 +i2cset -y 72 0x58 0x42 0xAA +i2cset -y 72 0x58 0x43 0x00 + +if [ "$1" = "cpu" ];then + #/* Select MAC to CPU */ + i2cset -y 72 0x58 0x5E 0x06 + i2cset -y 72 0x58 0x5F 0xF0 + echo "Select MAC to CPU" +elif [ "$1" = "fp" ];then + #/* Select MAC to Front Port */ + i2cset -y 72 0x58 0x5E 0x06 + i2cset -y 72 0x58 0x5F 0x00 + echo "Select MAC to Front Port" +else + echo "format: ldb_mux_setting.sh {fp | cpu}" +fi + diff --git a/platform/broadcom/sonic-platform-modules-accton/common/modules/accton_psu_api.h b/platform/broadcom/sonic-platform-modules-accton/common/modules/accton_psu_api.h new file mode 100755 index 0000000000..d522979f1e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/common/modules/accton_psu_api.h @@ -0,0 +1,29 @@ +/* + * Copyright 2022 Accton Technology Corporation. + * + * 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. + * + * + * Description: + * PSU driver related api declarations + */ + +#ifndef ACCTON_PSU_API_H +#define ACCTON_PSU_API_H + +#include "accton_psu_defs.h" + +/** Description: + * Register psu status entry, set entry as NULL to unregister + */ +extern int register_psu_status_entry(PSU_STATUS_ENTRY *entry); + +#endif /* ACCTON_PSU_API_H */ diff --git a/platform/broadcom/sonic-platform-modules-accton/common/modules/accton_psu_defs.h b/platform/broadcom/sonic-platform-modules-accton/common/modules/accton_psu_defs.h new file mode 100755 index 0000000000..11bb253a57 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/common/modules/accton_psu_defs.h @@ -0,0 +1,28 @@ +/* + * Copyright 2022 Accton Technology Corporation. + * + * 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. + * + * + * Description: + * Platform PSU defines/structures header file + */ + +#ifndef ACCTON_PSU_DEFS_H +#define ACCTON_PSU_DEFS_H + +typedef struct PSU_STATUS_ENTRY +{ + int (*get_presence)(void *client); + int (*get_powergood)(void *client); +} PSU_STATUS_ENTRY; + +#endif /* ACCTON_PSU_DEFS_H */ diff --git a/platform/broadcom/sonic-platform-modules-accton/common/modules/ym2651y.c b/platform/broadcom/sonic-platform-modules-accton/common/modules/ym2651y.c index 20cef5d61a..0180fa6d73 100755 --- a/platform/broadcom/sonic-platform-modules-accton/common/modules/ym2651y.c +++ b/platform/broadcom/sonic-platform-modules-accton/common/modules/ym2651y.c @@ -31,29 +31,62 @@ #include #include #include +#include +#include +#include "accton_psu_defs.h" +#define __STDC_WANT_LIB_EXT1__ 1 +#include #define MAX_FAN_DUTY_CYCLE 100 +#define ACCESS_INTERVAL_MAX 120 +#define ACCESS_INTERVAL_YM1151D_DEFAULT 60 +#define REFRESH_INTERVAL_SECOND 3 +#define REFRESH_INTERVAL_MSEC (REFRESH_INTERVAL_SECOND * 1000) +#define REFRESH_INTERVAL_HZ (REFRESH_INTERVAL_SECOND * HZ) + +#define EXIT_IF_POWER_FAILED(c) \ + do { \ + if (ym2651y_is_powergood(c) != 1) \ + goto exit; \ + } while (0) + +#define SLEEP_IF_INTERVAL(pInterval) \ + do { \ + int interval = atomic_read(pInterval); \ + if (interval > 0) \ + msleep(interval); \ + } while (0) + +/* SLEEP_IF_INTERVAL should be called before EXIT_IF_POWER_FAILED. + * It is known that accessing PSU when power failed might cause problems. + * So it is better to do sleep before checking power status because it avoids + * the risk that power status changes to failed during the sleep period. + */ +#define VALIDATE_POWERGOOD_AND_INTERVAL(client, pInterval) \ + do { \ + SLEEP_IF_INTERVAL(pInterval); \ + EXIT_IF_POWER_FAILED(client); \ + } while (0) + +struct mutex entry_lock; +PSU_STATUS_ENTRY access_psu_status = { NULL, NULL }; /* Addresses scanned */ -static const unsigned short normal_i2c[] = { 0x58, 0x5b, I2C_CLIENT_END }; +static const unsigned short normal_i2c[] = { 0x58, 0x59, 0x5b, I2C_CLIENT_END }; enum chips { YM2651, YM2401, YM2851, YM1401A, - YPEB1200AM + YPEB1200AM, + YM1151D, + UMEC_UPD150SA, + UMEC_UP1K21R }; -/* Each client has this additional data - */ -struct ym2651y_data { - struct device *hwmon_dev; - struct mutex update_lock; - char valid; /* !=0 if registers are valid */ - unsigned long last_updated; /* In jiffies */ - u8 chip; /* chip id */ +struct pmbus_register_value { u8 capability; /* Register value */ u16 status_word; /* Register value */ u8 fan_fault; /* Register value */ @@ -62,7 +95,7 @@ struct ym2651y_data { u16 i_out; /* Register value */ u16 p_out; /* Register value */ u8 vout_mode; /* Register value */ - u16 temp; /* Register value */ + u16 temp_input[3]; /* Register value */ u16 fan_speed; /* Register value */ u16 fan_duty_cycle[2]; /* Register value */ u8 fan_dir[4]; /* Register value */ @@ -81,6 +114,21 @@ struct ym2651y_data { u16 mfr_vout_max; /* Register value */ }; +/* Each client has this additional data + */ +struct ym2651y_data { + struct device *hwmon_dev; + struct mutex update_lock; + struct task_struct *update_task; + struct completion update_stop; + atomic_t access_interval; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 chip; /* chip id */ + u8 mfr_serial_supported; + struct pmbus_register_value reg_val; +}; + static ssize_t show_vout(struct device *dev, struct device_attribute *da, char *buf); static ssize_t show_byte(struct device *dev, struct device_attribute *da, @@ -95,7 +143,14 @@ static ssize_t show_over_temp(struct device *dev, struct device_attribute *da, char *buf); static ssize_t show_ascii(struct device *dev, struct device_attribute *da, char *buf); -static struct ym2651y_data *ym2651y_update_device(struct device *dev); +static ssize_t show_interval(struct device *dev, struct device_attribute *da, + char *buf); +static ssize_t set_interval(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static int mfr_serial_supported(u8 chip); +static int ym2651y_update_device(struct i2c_client *client, + struct pmbus_register_value *data); +static int ym2651y_update_thread(void *arg); static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *da, const char *buf, size_t count); static int ym2651y_write_word(struct i2c_client *client, u8 reg, u16 value); @@ -112,6 +167,8 @@ enum ym2651y_sysfs_attributes { PSU_P_OUT, PSU_P_OUT_UV, /*In Unit of microVolt, instead of mini.*/ PSU_TEMP1_INPUT, + PSU_TEMP2_INPUT, + PSU_TEMP3_INPUT, PSU_FAN1_SPEED, PSU_FAN1_DUTY_CYCLE, PSU_PMBUS_REVISION, @@ -127,7 +184,8 @@ enum ym2651y_sysfs_attributes { PSU_MFR_IIN_MAX, PSU_MFR_IOUT_MAX, PSU_MFR_PIN_MAX, - PSU_MFR_POUT_MAX + PSU_MFR_POUT_MAX, + PSU_ACCESS_INTERVAL }; /* sysfs attributes for hwmon @@ -141,6 +199,8 @@ static SENSOR_DEVICE_ATTR(psu_v_out, S_IRUGO, show_vout, NULL, PSU_V_OU static SENSOR_DEVICE_ATTR(psu_i_out, S_IRUGO, show_linear, NULL, PSU_I_OUT); static SENSOR_DEVICE_ATTR(psu_p_out, S_IRUGO, show_linear, NULL, PSU_P_OUT); static SENSOR_DEVICE_ATTR(psu_temp1_input, S_IRUGO, show_linear, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(psu_temp2_input, S_IRUGO, show_linear, NULL, PSU_TEMP2_INPUT); +static SENSOR_DEVICE_ATTR(psu_temp3_input, S_IRUGO, show_linear, NULL, PSU_TEMP3_INPUT); static SENSOR_DEVICE_ATTR(psu_fan1_speed_rpm, S_IRUGO, show_linear, NULL, PSU_FAN1_SPEED); static SENSOR_DEVICE_ATTR(psu_fan1_duty_cycle_percentage, S_IWUSR | S_IRUGO, show_linear, set_fan_duty_cycle, PSU_FAN1_DUTY_CYCLE); static SENSOR_DEVICE_ATTR(psu_fan_dir, S_IRUGO, show_ascii, NULL, PSU_FAN_DIRECTION); @@ -158,14 +218,19 @@ static SENSOR_DEVICE_ATTR(psu_mfr_iin_max, S_IRUGO, show_linear, NULL, PSU_MFR static SENSOR_DEVICE_ATTR(psu_mfr_iout_max, S_IRUGO, show_linear, NULL, PSU_MFR_IOUT_MAX); static SENSOR_DEVICE_ATTR(psu_mfr_pin_max, S_IRUGO, show_linear, NULL, PSU_MFR_PIN_MAX); static SENSOR_DEVICE_ATTR(psu_mfr_pout_max, S_IRUGO, show_linear, NULL, PSU_MFR_POUT_MAX); +static SENSOR_DEVICE_ATTR(psu_access_interval, S_IWUSR | S_IRUGO, show_interval, set_interval, PSU_ACCESS_INTERVAL); /*Duplicate nodes for lm-sensors.*/ static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_vout, NULL, PSU_V_OUT); static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, show_linear, NULL, PSU_I_OUT); static SENSOR_DEVICE_ATTR(power2_input, S_IRUGO, show_linear, NULL, PSU_P_OUT_UV); static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_linear, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_linear, NULL, PSU_TEMP2_INPUT); +static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_linear, NULL, PSU_TEMP3_INPUT); static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_linear, NULL, PSU_FAN1_SPEED); static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, show_word, NULL, PSU_TEMP_FAULT); +static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_word, NULL, PSU_TEMP_FAULT); +static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_word, NULL, PSU_TEMP_FAULT); static struct attribute *ym2651y_attributes[] = { &sensor_dev_attr_psu_power_on.dev_attr.attr, @@ -177,6 +242,8 @@ static struct attribute *ym2651y_attributes[] = { &sensor_dev_attr_psu_i_out.dev_attr.attr, &sensor_dev_attr_psu_p_out.dev_attr.attr, &sensor_dev_attr_psu_temp1_input.dev_attr.attr, + &sensor_dev_attr_psu_temp2_input.dev_attr.attr, + &sensor_dev_attr_psu_temp3_input.dev_attr.attr, &sensor_dev_attr_psu_fan1_speed_rpm.dev_attr.attr, &sensor_dev_attr_psu_fan1_duty_cycle_percentage.dev_attr.attr, &sensor_dev_attr_psu_fan_dir.dev_attr.attr, @@ -194,13 +261,18 @@ static struct attribute *ym2651y_attributes[] = { &sensor_dev_attr_psu_mfr_vout_min.dev_attr.attr, &sensor_dev_attr_psu_mfr_vout_max.dev_attr.attr, &sensor_dev_attr_psu_mfr_iout_max.dev_attr.attr, + &sensor_dev_attr_psu_access_interval.dev_attr.attr, /*Duplicate nodes for lm-sensors.*/ &sensor_dev_attr_curr2_input.dev_attr.attr, &sensor_dev_attr_in3_input.dev_attr.attr, &sensor_dev_attr_power2_input.dev_attr.attr, &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_temp2_input.dev_attr.attr, + &sensor_dev_attr_temp3_input.dev_attr.attr, &sensor_dev_attr_fan1_input.dev_attr.attr, &sensor_dev_attr_temp1_fault.dev_attr.attr, + &sensor_dev_attr_temp2_fault.dev_attr.attr, + &sensor_dev_attr_temp3_fault.dev_attr.attr, NULL }; @@ -208,32 +280,59 @@ static ssize_t show_byte(struct device *dev, struct device_attribute *da, char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct ym2651y_data *data = ym2651y_update_device(dev); + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_data *data = i2c_get_clientdata(client); + u8 status = 0; - return (attr->index == PSU_PMBUS_REVISION) ? sprintf(buf, "%d\n", data->pmbus_revision) : - sprintf(buf, "0\n"); + mutex_lock(&data->update_lock); + if (!data->valid) { + goto exit; + } + + if (attr->index == PSU_PMBUS_REVISION) + status = data->reg_val.pmbus_revision; + + mutex_unlock(&data->update_lock); + return sprintf(buf, "%d\n", status); + +exit: + mutex_unlock(&data->update_lock); + return 0; } static ssize_t show_word(struct device *dev, struct device_attribute *da, char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct ym2651y_data *data = ym2651y_update_device(dev); + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_data *data = i2c_get_clientdata(client); u16 status = 0; + mutex_lock(&data->update_lock); + if (!data->valid) { + goto exit; + } + switch (attr->index) { case PSU_POWER_ON: /* psu_power_on, low byte bit 6 of status_word, 0=>ON, 1=>OFF */ - status = (data->status_word & 0x40) ? 0 : 1; + status = (data->reg_val.status_word & 0x40) ? 0 : 1; break; case PSU_TEMP_FAULT: /* psu_temp_fault, low byte bit 2 of status_word, 0=>Normal, 1=>temp fault */ - status = (data->status_word & 0x4) >> 2; + status = (data->reg_val.status_word & 0x4) >> 2; break; case PSU_POWER_GOOD: /* psu_power_good, high byte bit 3 of status_word, 0=>OK, 1=>FAIL */ - status = (data->status_word & 0x800) ? 0 : 1; + status = (data->reg_val.status_word & 0x800) ? 0 : 1; break; + default: + goto exit; } + mutex_unlock(&data->update_lock); return sprintf(buf, "%d\n", status); + +exit: + mutex_unlock(&data->update_lock); + return 0; } static int two_complement_to_int(u16 data, u8 valid_bit, int mask) @@ -262,8 +361,8 @@ static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *d return -EINVAL; mutex_lock(&data->update_lock); - data->fan_duty_cycle[nr] = speed; - ym2651y_write_word(client, 0x3B + nr, data->fan_duty_cycle[nr]); + data->reg_val.fan_duty_cycle[nr] = speed; + ym2651y_write_word(client, 0x3B + nr, data->reg_val.fan_duty_cycle[nr]); mutex_unlock(&data->update_lock); return count; @@ -273,151 +372,214 @@ static ssize_t show_linear(struct device *dev, struct device_attribute *da, char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct ym2651y_data *data = ym2651y_update_device(dev); - + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_data *data = i2c_get_clientdata(client); u16 value = 0; int exponent, mantissa; int multiplier = 1000; + mutex_lock(&data->update_lock); + if (!data->valid) { + goto exit; + } + switch (attr->index) { case PSU_V_OUT: - value = data->v_out; + value = data->reg_val.v_out; break; case PSU_I_OUT: - value = data->i_out; + value = data->reg_val.i_out; break; case PSU_P_OUT_UV: multiplier = 1000000; /*For lm-sensors, unit is micro-Volt.*/ /*Passing through*/ case PSU_P_OUT: - value = data->p_out; + value = data->reg_val.p_out; break; case PSU_TEMP1_INPUT: - value = data->temp; + case PSU_TEMP2_INPUT: + case PSU_TEMP3_INPUT: + value = data->reg_val.temp_input[attr->index - PSU_TEMP1_INPUT]; break; case PSU_FAN1_SPEED: - value = data->fan_speed; + value = data->reg_val.fan_speed; multiplier = 1; break; case PSU_FAN1_DUTY_CYCLE: - value = data->fan_duty_cycle[0]; + value = data->reg_val.fan_duty_cycle[0]; multiplier = 1; break; case PSU_MFR_VIN_MIN: - value = data->mfr_vin_min; + value = data->reg_val.mfr_vin_min; break; case PSU_MFR_VIN_MAX: - value = data->mfr_vin_max; + value = data->reg_val.mfr_vin_max; break; case PSU_MFR_VOUT_MIN: - value = data->mfr_vout_min; + value = data->reg_val.mfr_vout_min; break; case PSU_MFR_VOUT_MAX: - value = data->mfr_vout_max; + value = data->reg_val.mfr_vout_max; break; case PSU_MFR_PIN_MAX: - value = data->mfr_pin_max; + value = data->reg_val.mfr_pin_max; break; case PSU_MFR_POUT_MAX: - value = data->mfr_pout_max; + value = data->reg_val.mfr_pout_max; break; case PSU_MFR_IOUT_MAX: - value = data->mfr_iout_max; + value = data->reg_val.mfr_iout_max; break; case PSU_MFR_IIN_MAX: - value = data->mfr_iin_max; + value = data->reg_val.mfr_iin_max; break; + default: + goto exit; } + mutex_unlock(&data->update_lock); exponent = two_complement_to_int(value >> 11, 5, 0x1f); mantissa = two_complement_to_int(value & 0x7ff, 11, 0x7ff); return (exponent >= 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); + +exit: + mutex_unlock(&data->update_lock); + return 0; } static ssize_t show_fan_fault(struct device *dev, struct device_attribute *da, char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct ym2651y_data *data = ym2651y_update_device(dev); + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_data *data = i2c_get_clientdata(client); + u8 shift = 0; + u8 fan_fault = 0; - u8 shift = (attr->index == PSU_FAN1_FAULT) ? 7 : 6; + mutex_lock(&data->update_lock); + if (!data->valid) { + goto exit; + } - return sprintf(buf, "%d\n", data->fan_fault >> shift); + fan_fault = data->reg_val.fan_fault; + mutex_unlock(&data->update_lock); + + shift = (attr->index == PSU_FAN1_FAULT) ? 7 : 6; + return sprintf(buf, "%d\n", fan_fault >> shift); + +exit: + mutex_unlock(&data->update_lock); + return 0; } static ssize_t show_over_temp(struct device *dev, struct device_attribute *da, char *buf) { - struct ym2651y_data *data = ym2651y_update_device(dev); + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_data *data = i2c_get_clientdata(client); + u8 over_temp = 0; - return sprintf(buf, "%d\n", data->over_temp >> 7); + mutex_lock(&data->update_lock); + if (!data->valid) { + goto exit; + } + + over_temp = data->reg_val.over_temp; + mutex_unlock(&data->update_lock); + return sprintf(buf, "%d\n", over_temp >> 7); + +exit: + mutex_unlock(&data->update_lock); + return 0; } static ssize_t show_ascii(struct device *dev, struct device_attribute *da, char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct ym2651y_data *data = ym2651y_update_device(dev); + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_data *data = i2c_get_clientdata(client); + ssize_t ret = 0; u8 *ptr = NULL; + mutex_lock(&data->update_lock); + if (!data->valid) { + goto exit; + } + switch (attr->index) { case PSU_FAN_DIRECTION: /* psu_fan_dir */ if (data->chip==YPEB1200AM) { - memcpy(data->fan_dir, "F2B", 3); - data->fan_dir[3]='\0'; + #ifdef __STDC_LIB_EXT1__ + memcpy_s(data->reg_val.fan_dir, 3, "F2B", 3); + #else + memcpy(data->reg_val.fan_dir, "F2B", 3); + #endif + data->reg_val.fan_dir[3]='\0'; } - ptr = data->fan_dir; + ptr = data->reg_val.fan_dir; break; case PSU_MFR_SERIAL: /* psu_mfr_serial */ - ptr = data->mfr_serial+1; /* The first byte is the count byte of string. */ + ptr = data->reg_val.mfr_serial+1; /* The first byte is the count byte of string. */ break; case PSU_MFR_ID: /* psu_mfr_id */ - ptr = data->mfr_id+1; /* The first byte is the count byte of string. */ + ptr = data->reg_val.mfr_id+1; /* The first byte is the count byte of string. */ break; case PSU_MFR_MODEL: /* psu_mfr_model */ - ptr = data->mfr_model+1; /* The first byte is the count byte of string. */ + ptr = data->reg_val.mfr_model+1; /* The first byte is the count byte of string. */ break; case PSU_MFR_REVISION: /* psu_mfr_revision */ - ptr = data->mfr_revsion+1; + ptr = data->reg_val.mfr_revsion+1; break; default: - return 0; + goto exit; } - return sprintf(buf, "%s\n", ptr); + ret = sprintf(buf, "%s\n", ptr); + +exit: + mutex_unlock(&data->update_lock); + return ret; } static ssize_t show_vout_by_mode(struct device *dev, struct device_attribute *da, char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(da); - struct ym2651y_data *data = ym2651y_update_device(dev); + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_data *data = i2c_get_clientdata(client); int exponent, mantissa; int multiplier = 1000; + mutex_lock(&data->update_lock); if (!data->valid) { - return 0; + goto exit; } - exponent = two_complement_to_int(data->vout_mode, 5, 0x1f); + exponent = two_complement_to_int(data->reg_val.vout_mode, 5, 0x1f); switch (attr->index) { case PSU_MFR_VOUT_MIN: - mantissa = data->mfr_vout_min; + mantissa = data->reg_val.mfr_vout_min; break; case PSU_MFR_VOUT_MAX: - mantissa = data->mfr_vout_max; + mantissa = data->reg_val.mfr_vout_max; break; case PSU_V_OUT: - mantissa = data->v_out; + mantissa = data->reg_val.v_out; break; default: - return 0; + goto exit; } + mutex_unlock(&data->update_lock); return (exponent > 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); + +exit: + mutex_unlock(&data->update_lock); + return 0; } static ssize_t show_vout(struct device *dev, struct device_attribute *da, @@ -434,6 +596,34 @@ static ssize_t show_vout(struct device *dev, struct device_attribute *da, } } +static ssize_t show_interval(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_data *data = i2c_get_clientdata(client); + + return sprintf(buf, "%d\n", atomic_read(&data->access_interval)); +} + +static ssize_t set_interval(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int status; + long interval; + struct i2c_client *client = to_i2c_client(dev); + struct ym2651y_data *data = i2c_get_clientdata(client); + + status = kstrtol(buf, 10, &interval); + if (status) + return status; + + if (interval < 0 || interval > ACCESS_INTERVAL_MAX) + return -EINVAL; + + atomic_set(&data->access_interval, (int)interval); + return count; +} + static const struct attribute_group ym2651y_group = { .attrs = ym2651y_attributes, }; @@ -461,6 +651,7 @@ static int ym2651y_probe(struct i2c_client *client, i2c_set_clientdata(client, data); mutex_init(&data->update_lock); data->chip = dev_id->driver_data; + data->mfr_serial_supported = mfr_serial_supported(data->chip); dev_info(&client->dev, "chip found\n"); /* Register sysfs hooks */ @@ -475,11 +666,26 @@ static int ym2651y_probe(struct i2c_client *client, goto exit_remove; } + /* create update thread */ + if (data->chip == YM1151D) + atomic_set(&data->access_interval, ACCESS_INTERVAL_YM1151D_DEFAULT); + else + atomic_set(&data->access_interval, 0); + + init_completion(&data->update_stop); + data->update_task = kthread_run(ym2651y_update_thread, client, "ym2651y_update_task"); + if (IS_ERR(data->update_task)) { + dev_dbg(&client->dev, "Failed to create ym2651y update task!\n"); + goto exit_hwmon; + } + dev_info(&client->dev, "%s: psu '%s'\n", dev_name(data->hwmon_dev), client->name); return 0; +exit_hwmon: + hwmon_device_unregister(data->hwmon_dev); exit_remove: sysfs_remove_group(&client->dev.kobj, &ym2651y_group); exit_free: @@ -493,6 +699,10 @@ static int ym2651y_remove(struct i2c_client *client) { struct ym2651y_data *data = i2c_get_clientdata(client); + /* Stop update task */ + kthread_stop(data->update_task); + wait_for_completion(&data->update_stop); + hwmon_device_unregister(data->hwmon_dev); sysfs_remove_group(&client->dev.kobj, &ym2651y_group); kfree(data); @@ -506,6 +716,9 @@ static const struct i2c_device_id ym2651y_id[] = { { "ym2851", YM2851 }, { "ym1401a",YM1401A}, { "ype1200am", YPEB1200AM }, + { "ym1151d", YM1151D }, + { "umec_upd150sa", UMEC_UPD150SA }, + { "umec_up1k21r", UMEC_UP1K21R }, {} }; MODULE_DEVICE_TABLE(i2c, ym2651y_id); @@ -521,6 +734,23 @@ static struct i2c_driver ym2651y_driver = { .address_list = normal_i2c, }; +static int ym2651y_is_powergood(struct i2c_client *client) +{ + int powergood = 0; + + mutex_lock(&entry_lock); + if (access_psu_status.get_powergood == NULL) { + powergood = 1; /* skip powergood validation if API is not registered */ + goto exit; + } + + powergood = access_psu_status.get_powergood(client); + +exit: + mutex_unlock(&entry_lock); + return powergood; +} + static int ym2651y_read_byte(struct i2c_client *client, u8 reg) { return i2c_smbus_read_byte_data(client, reg); @@ -539,8 +769,9 @@ static int ym2651y_write_word(struct i2c_client *client, u8 reg, u16 value) static int ym2651y_read_block(struct i2c_client *client, u8 command, u8 *data, int data_len) { - int result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + int result; + result = i2c_smbus_read_i2c_block_data(client, command, data_len, data); if (unlikely(result < 0)) goto abort; if (unlikely(result != data_len)) { @@ -564,15 +795,10 @@ struct reg_data_word { u16 *value; }; -static struct ym2651y_data *ym2651y_update_device(struct device *dev) +static int ym2651y_update_device(struct i2c_client *client, + struct pmbus_register_value *data) { - struct i2c_client *client = to_i2c_client(dev); - struct ym2651y_data *data = i2c_get_clientdata(client); - - mutex_lock(&data->update_lock); - - if (time_after(jiffies, data->last_updated + HZ + HZ / 2) - || !data->valid) { + struct ym2651y_data *driver_data = i2c_get_clientdata(client); int i, status, length; u8 command, buf; u8 fan_dir[5] = {0}; @@ -586,7 +812,9 @@ static struct ym2651y_data *ym2651y_update_device(struct device *dev) {0x8b, &data->v_out}, {0x8c, &data->i_out}, {0x96, &data->p_out}, - {0x8d, &data->temp}, + {0x8d, &(data->temp_input[0])}, + {0x8e, &(data->temp_input[1])}, + {0x8f, &(data->temp_input[2])}, {0x3b, &(data->fan_duty_cycle[0])}, {0x3c, &(data->fan_duty_cycle[1])}, {0x90, &data->fan_speed}, @@ -604,8 +832,9 @@ static struct ym2651y_data *ym2651y_update_device(struct device *dev) /* Read byte data */ for (i = 0; i < ARRAY_SIZE(regs_byte); i++) { - status = ym2651y_read_byte(client, regs_byte[i].reg); + VALIDATE_POWERGOOD_AND_INTERVAL(client, &driver_data->access_interval); + status = ym2651y_read_byte(client, regs_byte[i].reg); if (status < 0) { dev_dbg(&client->dev, "reg %d, err %d\n", @@ -620,10 +849,20 @@ static struct ym2651y_data *ym2651y_update_device(struct device *dev) /* Read word data */ for (i = 0; i < ARRAY_SIZE(regs_word); i++) { - status = ym2651y_read_word(client, regs_word[i].reg); + VALIDATE_POWERGOOD_AND_INTERVAL(client, &driver_data->access_interval); + + /* To prevent hardware errors, + access to temp2_input and temp3_input should be skipped + if the chip ID is not in the following list. */ + if (regs_word[i].reg == 0x8e || regs_word[i].reg == 0x8f) { + if (driver_data->chip != UMEC_UPD150SA && + driver_data->chip != UMEC_UP1K21R) { + continue; + } + } - if (status < 0) - { + status = ym2651y_read_word(client, regs_word[i].reg); + if (status < 0) { dev_dbg(&client->dev, "reg %d, err %d\n", regs_word[i].reg, status); *(regs_word[i].value) = 0; @@ -636,109 +875,178 @@ static struct ym2651y_data *ym2651y_update_device(struct device *dev) /* Read fan_direction */ command = 0xC3; + VALIDATE_POWERGOOD_AND_INTERVAL(client, &driver_data->access_interval); status = ym2651y_read_block(client, command, fan_dir, ARRAY_SIZE(fan_dir)-1); - - if (status < 0) { - dev_dbg(&client->dev, "reg %d, err %d\n", command, status); - goto exit; - } - + if (status == 0) { strncpy(data->fan_dir, fan_dir+1, ARRAY_SIZE(data->fan_dir)-1); data->fan_dir[ARRAY_SIZE(data->fan_dir)-1] = '\0'; + } /* Read mfr_id */ command = 0x99; + VALIDATE_POWERGOOD_AND_INTERVAL(client, &driver_data->access_interval); status = ym2651y_read_block(client, command, data->mfr_id, ARRAY_SIZE(data->mfr_id)-1); + if (status == 0) data->mfr_id[ARRAY_SIZE(data->mfr_id)-1] = '\0'; - if (status < 0) - dev_dbg(&client->dev, "reg %d, err %d\n", command, status); - /* Read mfr_model */ command = 0x9a; length = 1; /* Read first byte to determine the length of data */ + VALIDATE_POWERGOOD_AND_INTERVAL(client, &driver_data->access_interval); status = ym2651y_read_block(client, command, &buf, length); - if (status < 0) { - dev_dbg(&client->dev, "reg %d, err %d\n", command, status); - goto exit; - } + if (status == 0 && buf != 0xFF) { + VALIDATE_POWERGOOD_AND_INTERVAL(client, &driver_data->access_interval); status = ym2651y_read_block(client, command, data->mfr_model, buf+1); - + if (status == 0) { if ((buf+1) >= (ARRAY_SIZE(data->mfr_model)-1)) - { data->mfr_model[ARRAY_SIZE(data->mfr_model)-1] = '\0'; - } else data->mfr_model[buf+1] = '\0'; - - if (status < 0) - { - dev_dbg(&client->dev, "reg %d, err %d\n", command, status); - goto exit; + } } /*YM-1401A PSU doens't support to get serial_num, so ignore it. *It's vout doesn't support linear, so let it use show_vout_by_mode(). */ - if(!strncmp("YM-1401A", data->mfr_model+1, strlen("YM-1401A"))) - { - data->chip=YM1401A; + if (!strncmp("YM-1401A", data->mfr_model+1, strlen("YM-1401A"))) { + driver_data->chip=YM1401A; } - else - { + else if (driver_data->mfr_serial_supported) { /* Read mfr_serial */ command = 0x9e; length = 1; /* Read first byte to determine the length of data */ + VALIDATE_POWERGOOD_AND_INTERVAL(client, &driver_data->access_interval); status = ym2651y_read_block(client, command, &buf, length); - if (status < 0) { - dev_dbg(&client->dev, "reg %d, err %d\n", command, status); - goto exit; - } + if (status == 0 && buf != 0xFF) { + VALIDATE_POWERGOOD_AND_INTERVAL(client, &driver_data->access_interval); status = ym2651y_read_block(client, command, data->mfr_serial, buf+1); - + if (status == 0) { if ((buf+1) >= (ARRAY_SIZE(data->mfr_serial)-1)) - { data->mfr_serial[ARRAY_SIZE(data->mfr_serial)-1] = '\0'; - } else data->mfr_serial[buf+1] = '\0'; - - if (status < 0) - { - dev_dbg(&client->dev, "reg %d, err %d\n", command, status); - goto exit; + } } } /* Read mfr_revsion */ command = 0x9b; + VALIDATE_POWERGOOD_AND_INTERVAL(client, &driver_data->access_interval); status = ym2651y_read_block(client, command, data->mfr_revsion, ARRAY_SIZE(data->mfr_revsion)-1); + if (status == 0) data->mfr_revsion[ARRAY_SIZE(data->mfr_revsion)-1] = '\0'; - if (status < 0) - { - dev_dbg(&client->dev, "reg %d, err %d\n", command, status); - goto exit; + return 1; /* Return 1 for valid data, 0 for invalid */ + +exit: + return 0; } - data->last_updated = jiffies; +static int ym2651y_update_thread(void *arg) +{ + int valid = 0; + unsigned long start_time = 0; + unsigned long next_start_time = 0; /* expected next start time */ + struct i2c_client *client = arg; + struct ym2651y_data *data = i2c_get_clientdata(client); + + if (data == NULL) + return -EINVAL; + + while (!kthread_should_stop()) { + struct pmbus_register_value reg_val = { 0 }; + + start_time = jiffies; + valid = ym2651y_update_device(client, ®_val); + + mutex_lock(&data->update_lock); data->valid = 1; + if (valid) { + #ifdef __STDC_LIB_EXT1__ + memcpy_s(&data->reg_val, sizeof(reg_val), ®_val, sizeof(reg_val)); + #else + memcpy(&data->reg_val, ®_val, sizeof(reg_val)); + #endif + } else { + #ifdef __STDC_LIB_EXT1__ + memset_s(&data->reg_val, sizeof(reg_val), 0, sizeof(reg_val)); + #else + memset(&data->reg_val, 0, sizeof(reg_val)); + #endif + + /* PMBus STATUS_WORD(0x79): psu_power_on, low byte bit 6, 0=>ON, 1=>OFF */ + data->reg_val.status_word |= 0x40; + + /* PMBus STATUS_WORD(0x79): psu_power_good, high byte bit 3, 0=>OK, 1=>FAIL */ + data->reg_val.status_word |= 0x800; + + /* psu_power_good = failed, modified to return 1023 degree for python used. */ + data->reg_val.temp_input[0] = 0x3ff; + data->reg_val.temp_input[1] = 0x3ff; + data->reg_val.temp_input[2] = 0x3ff; + } + mutex_unlock(&data->update_lock); + + next_start_time = start_time + REFRESH_INTERVAL_HZ; + if (time_before(jiffies, next_start_time)) { + /* Sleep if time consumed is less than REFRESH_INTERVAL_SECOND */ + msleep(min(jiffies_to_msecs(next_start_time - jiffies), REFRESH_INTERVAL_MSEC)); + } } - exit: - mutex_unlock(&data->update_lock); + complete_all(&data->update_stop); + return 0; +} + +int register_psu_status_entry(PSU_STATUS_ENTRY *entry) +{ + mutex_lock(&entry_lock); + + if (entry) { + access_psu_status.get_presence = entry->get_presence; + access_psu_status.get_powergood = entry->get_powergood; + } + else { + access_psu_status.get_presence = NULL; + access_psu_status.get_powergood = NULL; + } + + mutex_unlock(&entry_lock); + return 0; +} +EXPORT_SYMBOL(register_psu_status_entry); - return data; +static int __init ym2651y_init(void) +{ + mutex_init(&entry_lock); + return i2c_add_driver(&ym2651y_driver); } -module_i2c_driver(ym2651y_driver); +static void __exit ym2651y_exit(void) +{ + i2c_del_driver(&ym2651y_driver); +} + +static int mfr_serial_supported(u8 chip) +{ + int i = 0; + u8 supported_chips[] = {}; + + for (i = 0; i < ARRAY_SIZE(supported_chips); i++) { + if (chip == supported_chips[i]) + return 1; +} + + return 0; +} MODULE_AUTHOR("Brandon Chuang "); MODULE_DESCRIPTION("3Y Power YM-2651Y driver"); MODULE_LICENSE("GPL"); - +module_init(ym2651y_init); +module_exit(ym2651y_exit); diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/control b/platform/broadcom/sonic-platform-modules-accton/debian/control old mode 100755 new mode 100644 index 4410a2f077..6844f266f8 --- a/platform/broadcom/sonic-platform-modules-accton/debian/control +++ b/platform/broadcom/sonic-platform-modules-accton/debian/control @@ -73,6 +73,10 @@ Package: sonic-platform-accton-as9726-32d Architecture: amd64 Description: kernel modules for platform devices such as fan, led, sfp +Package: sonic-platform-accton-as9736-64d +Architecture: amd64 +Description: kernel modules for platform devices such as fan, led, sfp + Package: sonic-platform-accton-as5835-54t Architecture: amd64 Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/rules b/platform/broadcom/sonic-platform-modules-accton/debian/rules old mode 100755 new mode 100644 index 241b1be9d6..9810f41c38 --- a/platform/broadcom/sonic-platform-modules-accton/debian/rules +++ b/platform/broadcom/sonic-platform-modules-accton/debian/rules @@ -21,12 +21,13 @@ KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) MODULE_DIRS := as7712-32x as5712-54x as7816-64x as7716-32x as7716-32xb as7312-54x MODULE_DIRS += as7326-56x as6712-32x as7726-32x as4630-54pe as4630-54te minipack as5812-54x -MODULE_DIRS += as5835-54x as9716-32d as9726-32d as5835-54t as7312-54xs as7315-27xb as5812-54t +MODULE_DIRS += as5835-54x as9716-32d as9726-32d as9736-64d as5835-54t as7312-54xs as7315-27xb as5812-54t MODULE_DIR := modules UTILS_DIR := utils SERVICE_DIR := service UDEV_DIR := udev CONF_DIR := conf +UDEV_DIR := udev %: dh $@ --with systemd,python3 --buildsystem=pybuild @@ -71,13 +72,13 @@ binary-indep: dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} usr/local/bin; \ dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} lib/systemd/system; \ if [ -d $(MOD_SRC_DIR)/$${mod}/$(UDEV_DIR) ]; then \ - dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} etc/udev/rules.d; \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} etc/udev/rules.d; \ fi; \ cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \ cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \ if [ -f $(MOD_SRC_DIR)/$${mod}/$(UDEV_DIR)/* ]; then \ - cp $(MOD_SRC_DIR)/$${mod}/$(UDEV_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/etc/udev/rules.d/; \ + cp $(MOD_SRC_DIR)/$${mod}/$(UDEV_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/etc/udev/rules.d/; \ fi; \ $(PYTHON3) $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \ done) diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.prerm b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.prerm new file mode 100644 index 0000000000..24d7915833 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as4630-54pe.prerm @@ -0,0 +1,7 @@ +# Disable pddf-platform-init, monitor, monitor-fan, monitor-psu + +systemctl stop pddf-platform-init.service +systemctl disable pddf-platform-init.service +systemctl stop as4630-54pe-pddf-platform-monitor.service +systemctl disable as4630-54pe-pddf-platform-monitor.service + diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as5835-54t.prerm b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as5835-54t.prerm new file mode 100644 index 0000000000..b65570b83c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as5835-54t.prerm @@ -0,0 +1,7 @@ +# Disable pddf-platform-init, monitor, monitor-fan, monitor-psu + +systemctl stop pddf-platform-init.service +systemctl disable pddf-platform-init.service +systemctl stop as5835-54t-pddf-platform-monitor.service +systemctl disable as5835-54t-pddf-platform-monitor.service + diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as5835-54x.install b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as5835-54x.install index d108eb582c..a234273ab7 100644 --- a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as5835-54x.install +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as5835-54x.install @@ -1,2 +1 @@ -as5835-54x/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-accton_as5835_54x-r0 - +as5835-54x/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-accton_as5835_54x-r0/pddf diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as5835-54x.postinst b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as5835-54x.postinst new file mode 100644 index 0000000000..c478bcac28 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as5835-54x.postinst @@ -0,0 +1,9 @@ +# Special arrangement to make PDDF mode default +# Disable monitor, monitor-fan, monitor-psu (not enabling them would imply they will be disabled by default) +# Enable pddf-platform-monitor +depmod -a +depmod -a +systemctl enable pddf-platform-init.service +systemctl start pddf-platform-init.service +systemctl enable as5835-54x-pddf-platform-monitor.service +systemctl start as5835-54x-pddf-platform-monitor.service diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as5835-54x.prerm b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as5835-54x.prerm new file mode 100644 index 0000000000..41910e95b6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as5835-54x.prerm @@ -0,0 +1,7 @@ +# Disable pddf-platform-init, monitor, monitor-fan, monitor-psu + +systemctl stop pddf-platform-init.service +systemctl disable pddf-platform-init.service +systemctl stop as5835-54x-pddf-platform-monitor.service +systemctl disable as5835-54x-pddf-platform-monitor.service + diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7326-56x.prerm b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7326-56x.prerm new file mode 100644 index 0000000000..9b4e03fd8d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7326-56x.prerm @@ -0,0 +1,9 @@ +# Disable pddf-platform-init, monitor, monitor-fan, monitor-psu + +systemctl stop pddf-platform-init.service +systemctl disable pddf-platform-init.service +systemctl stop as7326-56x-pddf-platform-monitor.service +systemctl disable as7326-56x-pddf-platform-monitor.service +systemctl stop as7326-platform-handle_mac.service +systemctl disable as7326-platform-handle_mac.service + diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7712-32x.prerm b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7712-32x.prerm new file mode 100644 index 0000000000..627dca1d06 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7712-32x.prerm @@ -0,0 +1,7 @@ +# Disable pddf-platform-init, monitor, monitor-fan, monitor-psu + +systemctl stop pddf-platform-init.service +systemctl disable pddf-platform-init.service +systemctl stop as7712-pddf-platform-monitor.service +systemctl disable as7712-pddf-platform-monitor.service + diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7726-32x.prerm b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7726-32x.prerm new file mode 100644 index 0000000000..d4a2fd04f7 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7726-32x.prerm @@ -0,0 +1,10 @@ +# Disable pddf-platform-init, monitor, monitor-fan, monitor-psu + +systemctl stop pddf-platform-init.service +systemctl disable pddf-platform-init.service +systemctl stop as7726-32x-pddf-platform-monitor.service +systemctl disable as7726-32x-pddf-platform-monitor.service +systemctl stop as7726-32x-platform-handle_mac.service +systemctl disable as7726-32x-platform-handle_mac.service + + diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7816-64x.prerm b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7816-64x.prerm new file mode 100644 index 0000000000..94656c53b6 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as7816-64x.prerm @@ -0,0 +1,7 @@ +# Disable pddf-platform-init, monitor, monitor-fan, monitor-psu + +systemctl stop pddf-platform-init.service +systemctl disable pddf-platform-init.service +systemctl stop as7816-pddf-platform-monitor.service +systemctl disable as7816-pddf-platform-monitor.service + diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as9716-32d.prerm b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as9716-32d.prerm new file mode 100644 index 0000000000..5d83213cc3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as9716-32d.prerm @@ -0,0 +1,7 @@ +# Disable pddf-platform-init, monitor, monitor-fan, monitor-psu + +systemctl stop pddf-platform-init.service +systemctl disable pddf-platform-init.service +systemctl stop as9716-32d-pddf-platform-monitor.service +systemctl disable as9716-32d-pddf-platform-monitor.service + diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as9736-64d.install b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as9736-64d.install new file mode 100644 index 0000000000..02f948bcaf --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/debian/sonic-platform-accton-as9736-64d.install @@ -0,0 +1,2 @@ +as9736-64d/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-accton_as9736_64d-r0 + diff --git a/platform/broadcom/sonic-platform-modules-accton/minipack/service/minipack-platform-init.service b/platform/broadcom/sonic-platform-modules-accton/minipack/service/minipack-platform-init.service index 4a0f803b27..a56e0214c8 100644 --- a/platform/broadcom/sonic-platform-modules-accton/minipack/service/minipack-platform-init.service +++ b/platform/broadcom/sonic-platform-modules-accton/minipack/service/minipack-platform-init.service @@ -1,6 +1,6 @@ [Unit] Description=Accton MiniPack Platform Monitoring service -Before=pmon.service +Before=pmon.service system-health.service After=sysinit.target DefaultDependencies=no diff --git a/rules/sonic-dash-api.dep b/rules/sonic-dash-api.dep index 6d4ffcad84..64e23961d9 100644 --- a/rules/sonic-dash-api.dep +++ b/rules/sonic-dash-api.dep @@ -3,7 +3,7 @@ SPATH := $($(LIB_SONIC_DASH_API)_SRC_PATH) DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-dash-api.mk rules/sonic-dash-api.dep DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) DEP_FILES += $(shell git ls-files $(SPATH) | grep -v sonic-dash-api) -SMDEP_FILES := $(addprefix $(SPATH)/sonic-dash-api/,$(shell cd $(SPATH)/sonic-dash-api && git ls-files)) +SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH)/ && git ls-files)) $(LIB_SONIC_DASH_API)_CACHE_MODE := GIT_CONTENT_SHA $(LIB_SONIC_DASH_API)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)