[ragile] adapter for kernel 5.x (#10762)

Why I did it
Ragile adapter ra-b6510-32c ra-b6510-48v8c ra-b6910-64c ra-b6920-4s to kernel 5.x

Signed-off-by: “pettershao” pettershao@ragilenetworks.com
This commit is contained in:
pettershao-ragilenetworks 2023-01-13 10:01:47 +08:00 committed by GitHub
parent d9c75b3fa2
commit bce4aa1412
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
73 changed files with 4299 additions and 1726 deletions

View File

@ -1,63 +0,0 @@
<DeviceMiniGraph xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="Microsoft.Search.Autopilot.Evolution">
<CpgDec>
</CpgDec>
<DpgDec>
<DeviceDataPlaneInfo>
<IPSecTunnels/>
<LoopbackIPInterfaces/>
<ManagementIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
</ManagementIPInterfaces>
<MplsInterfaces/>
<MplsTeInterfaces/>
<RsvpInterfaces/>
<Hostname>switch2</Hostname>
<PortChannelInterfaces/>
<VlanInterfaces/>
<IPInterfaces/>
<DataAcls/>
<AclInterfaces/>
<DownstreamSummaries/>
<DownstreamSummarySet xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
</DeviceDataPlaneInfo>
</DpgDec>
<PngDec>
<Devices>
<Device i:type="LeafRouter">
<Hostname>switch2</Hostname>
<HwSku>RA-B6510-32C</HwSku>
</Device>
</Devices>
</PngDec>
<MetadataDeclaration>
<Devices xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
<a:DeviceMetadata>
<a:Name>switch2</a:Name>
<a:Properties>
<a:DeviceProperty>
<a:Name>DhcpResources</a:Name>
<a:Reference i:nil="true"/>
<a:Value></a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>NtpResources</a:Name>
<a:Reference i:nil="true"/>
<a:Value>0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>SyslogResources</a:Name>
<a:Reference i:nil="true"/>
<a:Value></a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>ErspanDestinationIpv4</a:Name>
<a:Reference i:nil="true"/>
<a:Value>2.2.2.2</a:Value>
</a:DeviceProperty>
</a:Properties>
</a:DeviceMetadata>
</Devices>
<Properties xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
</MetadataDeclaration>
<Hostname>switch2</Hostname>
<HwSku>RA-B6510-32C</HwSku>
</DeviceMiniGraph>

View File

@ -1610,6 +1610,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x10",
@ -1618,6 +1619,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x14",
@ -1682,6 +1684,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x10",
@ -1690,6 +1693,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x14",
@ -1754,6 +1758,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x10",
@ -1762,6 +1767,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x14",
@ -1827,6 +1833,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x10",
@ -1835,6 +1842,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x14",
@ -1900,6 +1908,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x10",
@ -1908,6 +1917,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x14",
@ -1973,6 +1983,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x10",
@ -1981,6 +1992,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x14",
@ -2045,6 +2057,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x30",
@ -2053,6 +2066,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x14",
@ -2117,6 +2131,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x10",
@ -2125,6 +2140,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x14",
@ -2189,6 +2205,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x11",
@ -2197,6 +2214,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x15",
@ -2261,6 +2279,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x11",
@ -2269,6 +2288,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x15",
@ -2334,6 +2354,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x11",
@ -2342,6 +2363,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x15",
@ -2407,6 +2429,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x11",
@ -2415,6 +2438,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x15",
@ -2480,6 +2504,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x11",
@ -2488,6 +2513,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x15",
@ -2553,6 +2579,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x11",
@ -2561,6 +2588,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x15",
@ -2625,6 +2653,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x11",
@ -2633,6 +2662,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x15",
@ -2697,6 +2727,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x11",
@ -2705,6 +2736,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD1",
"attr_devaddr": "0x30",
"attr_devtype": "cpld",
"attr_offset": "0x15",
@ -2769,6 +2801,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x10",
@ -2777,6 +2810,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x14",
@ -2841,6 +2875,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x10",
@ -2849,6 +2884,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x14",
@ -2914,6 +2950,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x10",
@ -2922,6 +2959,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x14",
@ -2987,6 +3025,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x10",
@ -2995,6 +3034,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x14",
@ -3060,6 +3100,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x10",
@ -3068,6 +3109,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x14",
@ -3133,6 +3175,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x10",
@ -3141,6 +3184,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x14",
@ -3205,6 +3249,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x10",
@ -3213,6 +3258,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x14",
@ -3277,6 +3323,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x10",
@ -3285,6 +3332,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x14",
@ -3349,6 +3397,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x11",
@ -3357,6 +3406,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x15",
@ -3421,6 +3471,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x11",
@ -3429,6 +3480,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x15",
@ -3494,6 +3546,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x11",
@ -3502,6 +3555,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x15",
@ -3567,6 +3621,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x11",
@ -3575,6 +3630,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x15",
@ -3640,6 +3696,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x11",
@ -3648,6 +3705,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x15",
@ -3713,6 +3771,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x11",
@ -3721,6 +3780,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x15",
@ -3785,6 +3845,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x11",
@ -3793,6 +3854,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x15",
@ -3857,6 +3919,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x11",
@ -3865,6 +3928,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_reset",
"attr_devname": "MAC_BOARD_CPLD2",
"attr_devaddr": "0x31",
"attr_devtype": "cpld",
"attr_offset": "0x15",
@ -4124,7 +4188,7 @@
}
},
"FANTRAY1_LED": {
"FAN1_LED": {
"dev_info": {
"device_type": "LED",
"device_name": "FANTRAY_LED"
@ -4193,7 +4257,7 @@
}
},
"FANTRAY2_LED": {
"FAN2_LED": {
"dev_info": {
"device_type": "LED",
"device_name": "FANTRAY_LED"
@ -4262,7 +4326,7 @@
}
},
"FANTRAY3_LED": {
"FAN3_LED": {
"dev_info": {
"device_type": "LED",
"device_name": "FANTRAY_LED"
@ -4331,7 +4395,7 @@
}
},
"FANTRAY4_LED": {
"FAN4_LED": {
"dev_info": {
"device_type": "LED",
"device_name": "FANTRAY_LED"
@ -4400,7 +4464,7 @@
}
},
"FANTRAY5_LED": {
"FAN5_LED": {
"dev_info": {
"device_type": "LED",
"device_name": "FANTRAY_LED"

View File

@ -1 +1 @@
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td3-b6510-48vs8cq-48x25G+8x100G.config.bcm
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td3-ra-b6510-48v8c-48x25G+8x100G.config.bcm

View File

@ -1,8 +1,10 @@
cancun_dir=/usr/share/sonic/platform/cancun/sdk_6.5.16/
l2_mem_entries=32768
l3_mem_entries=16384
l3_alpm_enable=2
ipv6_lpm_128b_enable=0x1
l2xmsg_mode=0
l3_max_ecmp_mode=1
l3_mem_entries=49152
l3_alpm_enable=0
bcm_num_cos=8
bcm_stat_interval=2000000
cdma_timeout_usec=3000000
@ -10,7 +12,6 @@ core_clock_frequency=1525
dpp_clock_ratio=2:3
help_cli_enable=1
ifp_inports_support_enable=1
ipv6_lpm_128b_enable=0x1
#lpm_scaling_enable=1
max_vp_lags=0
mem_cache_enable=0
@ -337,230 +338,62 @@ dport_map_port_107=54
dport_map_port_123=55
dport_map_port_127=56
serdes_preemphasis_lane0_1=0x0f480d
serdes_preemphasis_lane1_1=0x0f480d
serdes_preemphasis_lane2_1=0x0f480d
serdes_preemphasis_lane3_1=0x0f480d
serdes_preemphasis_lane0_2=0x0f480d
serdes_preemphasis_lane1_2=0x0f480d
serdes_preemphasis_lane2_2=0x0f480d
serdes_preemphasis_lane3_2=0x0f480d
serdes_preemphasis_lane0_3=0x0f480d
serdes_preemphasis_lane1_3=0x0f480d
serdes_preemphasis_lane2_3=0x0f480d
serdes_preemphasis_lane3_3=0x0f480d
serdes_preemphasis_lane0_4=0x0f480d
serdes_preemphasis_lane1_4=0x0f480d
serdes_preemphasis_lane2_4=0x0f480d
serdes_preemphasis_lane3_4=0x0f480d
serdes_preemphasis_lane0_5=0x0f480d
serdes_preemphasis_lane1_5=0x0f480d
serdes_preemphasis_lane2_5=0x0f480d
serdes_preemphasis_lane3_5=0x0f480d
serdes_preemphasis_lane0_6=0x0f480d
serdes_preemphasis_lane1_6=0x0f480d
serdes_preemphasis_lane2_6=0x0f480d
serdes_preemphasis_lane3_6=0x0f480d
serdes_preemphasis_lane0_7=0x0d4b0c
serdes_preemphasis_lane1_7=0x0d4b0c
serdes_preemphasis_lane2_7=0x0d4b0c
serdes_preemphasis_lane3_7=0x0d4b0c
serdes_preemphasis_lane0_8=0x0d4b0c
serdes_preemphasis_lane1_8=0x0d4b0c
serdes_preemphasis_lane2_8=0x0d4b0c
serdes_preemphasis_lane3_8=0x0d4b0c
serdes_preemphasis_lane0_13=0x0d4b0c
serdes_preemphasis_lane1_13=0x0d4b0c
serdes_preemphasis_lane2_13=0x0d4b0c
serdes_preemphasis_lane3_13=0x0d4b0c
serdes_preemphasis_lane0_14=0x0d4b0c
serdes_preemphasis_lane1_14=0x0d4b0c
serdes_preemphasis_lane2_14=0x0d4b0c
serdes_preemphasis_lane3_14=0x0d4b0c
serdes_preemphasis_lane0_15=0x0d4b0c
serdes_preemphasis_lane1_15=0x0d4b0c
serdes_preemphasis_lane2_15=0x0d4b0c
serdes_preemphasis_lane3_15=0x0d4b0c
serdes_preemphasis_lane0_16=0x0d4b0c
serdes_preemphasis_lane1_16=0x0d4b0c
serdes_preemphasis_lane2_16=0x0d4b0c
serdes_preemphasis_lane3_16=0x0d4b0c
serdes_preemphasis_lane0_21=0x0d4b0c
serdes_preemphasis_lane1_21=0x0d4b0c
serdes_preemphasis_lane2_21=0x0d4b0c
serdes_preemphasis_lane3_21=0x0d4b0c
serdes_preemphasis_lane0_22=0x0d4b0c
serdes_preemphasis_lane1_22=0x0d4b0c
serdes_preemphasis_lane2_22=0x0d4b0c
serdes_preemphasis_lane3_22=0x0d4b0c
serdes_preemphasis_lane0_23=0x0d4b0c
serdes_preemphasis_lane1_23=0x0d4b0c
serdes_preemphasis_lane2_23=0x0d4b0c
serdes_preemphasis_lane3_23=0x0d4b0c
serdes_preemphasis_lane0_24=0x0d4b0c
serdes_preemphasis_lane1_24=0x0d4b0c
serdes_preemphasis_lane2_24=0x0d4b0c
serdes_preemphasis_lane3_24=0x0d4b0c
serdes_preemphasis_lane0_29=0x0d4b0c
serdes_preemphasis_lane1_29=0x0d4b0c
serdes_preemphasis_lane2_29=0x0d4b0c
serdes_preemphasis_lane3_29=0x0d4b0c
serdes_preemphasis_lane0_30=0x0d4b0c
serdes_preemphasis_lane1_30=0x0d4b0c
serdes_preemphasis_lane2_30=0x0d4b0c
serdes_preemphasis_lane3_30=0x0d4b0c
serdes_preemphasis_lane0_31=0x0d4b0c
serdes_preemphasis_lane1_31=0x0d4b0c
serdes_preemphasis_lane2_31=0x0d4b0c
serdes_preemphasis_lane3_31=0x0d4b0c
serdes_preemphasis_lane0_32=0x0d4b0c
serdes_preemphasis_lane1_32=0x0d4b0c
serdes_preemphasis_lane2_32=0x0d4b0c
serdes_preemphasis_lane3_32=0x0d4b0c
serdes_preemphasis_lane0_33=0x0d4b0c
serdes_preemphasis_lane1_33=0x0d4b0c
serdes_preemphasis_lane2_33=0x0d4b0c
serdes_preemphasis_lane3_33=0x0d4b0c
serdes_preemphasis_lane0_34=0x0d4b0c
serdes_preemphasis_lane1_34=0x0d4b0c
serdes_preemphasis_lane2_34=0x0d4b0c
serdes_preemphasis_lane3_34=0x0d4b0c
serdes_preemphasis_lane0_35=0x0d4b0c
serdes_preemphasis_lane1_35=0x0d4b0c
serdes_preemphasis_lane2_35=0x0d4b0c
serdes_preemphasis_lane3_35=0x0d4b0c
serdes_preemphasis_lane0_36=0x0d4b0c
serdes_preemphasis_lane1_36=0x0d4b0c
serdes_preemphasis_lane2_36=0x0d4b0c
serdes_preemphasis_lane3_36=0x0d4b0c
serdes_preemphasis_lane0_41=0x0d4b0c
serdes_preemphasis_lane1_41=0x0d4b0c
serdes_preemphasis_lane2_41=0x0d4b0c
serdes_preemphasis_lane3_41=0x0d4b0c
serdes_preemphasis_lane0_42=0x0d4b0c
serdes_preemphasis_lane1_42=0x0d4b0c
serdes_preemphasis_lane2_42=0x0d4b0c
serdes_preemphasis_lane3_42=0x0d4b0c
serdes_preemphasis_lane0_43=0x0d4b0c
serdes_preemphasis_lane1_43=0x0d4b0c
serdes_preemphasis_lane2_43=0x0d4b0c
serdes_preemphasis_lane3_43=0x0d4b0c
serdes_preemphasis_lane0_44=0x0d4b0c
serdes_preemphasis_lane1_44=0x0d4b0c
serdes_preemphasis_lane2_44=0x0d4b0c
serdes_preemphasis_lane3_44=0x0d4b0c
serdes_preemphasis_lane0_49=0x0d4b0c
serdes_preemphasis_lane1_49=0x0d4b0c
serdes_preemphasis_lane2_49=0x0d4b0c
serdes_preemphasis_lane3_49=0x0d4b0c
serdes_preemphasis_lane0_50=0x0d4b0c
serdes_preemphasis_lane1_50=0x0d4b0c
serdes_preemphasis_lane2_50=0x0d4b0c
serdes_preemphasis_lane3_50=0x0d4b0c
serdes_preemphasis_lane0_51=0x0d4b0c
serdes_preemphasis_lane1_51=0x0d4b0c
serdes_preemphasis_lane2_51=0x0d4b0c
serdes_preemphasis_lane3_51=0x0d4b0c
serdes_preemphasis_lane0_52=0x0d4b0c
serdes_preemphasis_lane1_52=0x0d4b0c
serdes_preemphasis_lane2_52=0x0d4b0c
serdes_preemphasis_lane3_52=0x0d4b0c
serdes_preemphasis_lane0_57=0x0d4b0c
serdes_preemphasis_lane1_57=0x0d4b0c
serdes_preemphasis_lane2_57=0x0d4b0c
serdes_preemphasis_lane3_57=0x0d4b0c
serdes_preemphasis_lane0_58=0x0d4b0c
serdes_preemphasis_lane1_58=0x0d4b0c
serdes_preemphasis_lane2_58=0x0d4b0c
serdes_preemphasis_lane3_58=0x0d4b0c
serdes_preemphasis_lane0_59=0x0d4b0c
serdes_preemphasis_lane1_59=0x0d4b0c
serdes_preemphasis_lane2_59=0x0d4b0c
serdes_preemphasis_lane3_59=0x0d4b0c
serdes_preemphasis_lane0_60=0x0d4b0c
serdes_preemphasis_lane1_60=0x0d4b0c
serdes_preemphasis_lane2_60=0x0d4b0c
serdes_preemphasis_lane3_60=0x0d4b0c
serdes_preemphasis_lane0_61=0x0d4b0c
serdes_preemphasis_lane1_61=0x0d4b0c
serdes_preemphasis_lane2_61=0x0d4b0c
serdes_preemphasis_lane3_61=0x0d4b0c
serdes_preemphasis_lane0_62=0x0d4b0c
serdes_preemphasis_lane1_62=0x0d4b0c
serdes_preemphasis_lane2_62=0x0d4b0c
serdes_preemphasis_lane3_62=0x0d4b0c
serdes_preemphasis_lane0_63=0x0d4b0c
serdes_preemphasis_lane1_63=0x0d4b0c
serdes_preemphasis_lane2_63=0x0d4b0c
serdes_preemphasis_lane3_63=0x0d4b0c
serdes_preemphasis_lane0_64=0x0d4b0c
serdes_preemphasis_lane1_64=0x0d4b0c
serdes_preemphasis_lane2_64=0x0d4b0c
serdes_preemphasis_lane3_64=0x0d4b0c
serdes_preemphasis_lane0_67=0x0d4b0c
serdes_preemphasis_lane1_67=0x0d4b0c
serdes_preemphasis_lane2_67=0x0d4b0c
serdes_preemphasis_lane3_67=0x0d4b0c
serdes_preemphasis_lane0_68=0x0d4b0c
serdes_preemphasis_lane1_68=0x0d4b0c
serdes_preemphasis_lane2_68=0x0d4b0c
serdes_preemphasis_lane3_68=0x0d4b0c
serdes_preemphasis_lane0_69=0x0d4b0c
serdes_preemphasis_lane1_69=0x0d4b0c
serdes_preemphasis_lane2_69=0x0d4b0c
serdes_preemphasis_lane3_69=0x0d4b0c
serdes_preemphasis_lane0_70=0x0d4b0c
serdes_preemphasis_lane1_70=0x0d4b0c
serdes_preemphasis_lane2_70=0x0d4b0c
serdes_preemphasis_lane3_70=0x0d4b0c
serdes_preemphasis_lane0_71=0x0d4b0c
serdes_preemphasis_lane1_71=0x0d4b0c
serdes_preemphasis_lane2_71=0x0d4b0c
serdes_preemphasis_lane3_71=0x0d4b0c
serdes_preemphasis_lane0_72=0x0d4b0c
serdes_preemphasis_lane1_72=0x0d4b0c
serdes_preemphasis_lane2_72=0x0d4b0c
serdes_preemphasis_lane3_72=0x0d4b0c
serdes_preemphasis_lane0_73=0x0d4b0c
serdes_preemphasis_lane1_73=0x0d4b0c
serdes_preemphasis_lane2_73=0x0d4b0c
serdes_preemphasis_lane3_73=0x0d4b0c
serdes_preemphasis_lane0_74=0x0d4b0c
serdes_preemphasis_lane1_74=0x0d4b0c
serdes_preemphasis_lane2_74=0x0d4b0c
serdes_preemphasis_lane3_74=0x0d4b0c
serdes_preemphasis_lane0_87=0x0d4b0c
serdes_preemphasis_lane1_87=0x0d4b0c
serdes_preemphasis_lane2_87=0x0d4b0c
serdes_preemphasis_lane3_87=0x0d4b0c
serdes_preemphasis_lane0_79=0x0d4b0c
serdes_preemphasis_lane1_79=0x0d4b0c
serdes_preemphasis_lane2_79=0x0d4b0c
serdes_preemphasis_lane3_79=0x0d4b0c
serdes_preemphasis_lane0_99=0x0d4b0c
serdes_preemphasis_lane1_99=0x0d4b0c
serdes_preemphasis_lane2_99=0x0d4b0c
serdes_preemphasis_lane3_99=0x0d4b0c
serdes_preemphasis_lane0_95=0x0d4b0c
serdes_preemphasis_lane1_95=0x0d4b0c
serdes_preemphasis_lane2_95=0x0d4b0c
serdes_preemphasis_lane3_95=0x0d4b0c
serdes_preemphasis_lane0_115=0x0f480d
serdes_preemphasis_lane1_115=0x0f480d
serdes_preemphasis_lane2_115=0x0f480d
serdes_preemphasis_lane3_115=0x0f480d
serdes_preemphasis_lane0_107=0x0f480d
serdes_preemphasis_lane1_107=0x0f480d
serdes_preemphasis_lane2_107=0x0f480d
serdes_preemphasis_lane3_107=0x0f480d
serdes_preemphasis_lane0_123=0x0f480d
serdes_preemphasis_lane1_123=0x0f480d
serdes_preemphasis_lane2_123=0x0f480d
serdes_preemphasis_lane3_123=0x0f480d
serdes_preemphasis_lane0_127=0x0f480d
serdes_preemphasis_lane1_127=0x0f480d
serdes_preemphasis_lane2_127=0x0f480d
serdes_preemphasis_lane3_127=0x0f480d
serdes_if_type_1=13
serdes_if_type_2=13
serdes_if_type_3=13
serdes_if_type_4=13
serdes_if_type_5=13
serdes_if_type_6=13
serdes_if_type_7=13
serdes_if_type_8=13
serdes_if_type_13=13
serdes_if_type_14=13
serdes_if_type_15=13
serdes_if_type_16=13
serdes_if_type_21=13
serdes_if_type_22=13
serdes_if_type_23=13
serdes_if_type_24=13
serdes_if_type_29=13
serdes_if_type_30=13
serdes_if_type_31=13
serdes_if_type_32=13
serdes_if_type_33=13
serdes_if_type_34=13
serdes_if_type_35=13
serdes_if_type_36=13
serdes_if_type_41=13
serdes_if_type_42=13
serdes_if_type_43=13
serdes_if_type_44=13
serdes_if_type_49=13
serdes_if_type_50=13
serdes_if_type_51=13
serdes_if_type_52=13
serdes_if_type_57=13
serdes_if_type_58=13
serdes_if_type_59=13
serdes_if_type_60=13
serdes_if_type_61=13
serdes_if_type_62=13
serdes_if_type_63=13
serdes_if_type_64=13
serdes_if_type_67=13
serdes_if_type_68=13
serdes_if_type_69=13
serdes_if_type_70=13
serdes_if_type_71=13
serdes_if_type_72=13
serdes_if_type_73=13
serdes_if_type_74=13
serdes_if_type_87=14
serdes_if_type_79=14
serdes_if_type_99=14
serdes_if_type_95=14
serdes_if_type_115=14
serdes_if_type_107=14
serdes_if_type_123=14
serdes_if_type_127=14
reglist_enable=1
scache_filename=/tmp/scache

View File

@ -0,0 +1,25 @@
try:
import os
import sys
import json
sys.path.append('/usr/share/sonic/platform/plugins')
import pddfparse
#from sonic_eeprom import eeprom_base
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):
global pddf_obj
global plugin_data
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)) + '/../pddf/pd-plugin.json')) as pd:
plugin_data = json.load(pd)
pddf_obj = pddfparse.PddfParse()
# system EEPROM always has device name EEPROM1
self.eeprom_path = pddf_obj.get_path("EEPROM1", "eeprom")
super(board, self).__init__(self.eeprom_path, 0, '', True)

View File

@ -0,0 +1,187 @@
# Sample pddf_fanutil file
# All the supported FAN SysFS aattributes are
#- fan<idx>_present
#- fan<idx>_direction
#- fan<idx>_input
#- fan<idx>_pwm
#- fan<idx>_fault
# where idx is in the range [1-12]
#
import os.path
import sys
sys.path.append('/usr/share/sonic/platform/plugins')
import pddfparse
import json
try:
from sonic_fan.fan_base import FanBase
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class FanUtil(FanBase):
"""PDDF generic FAN util class"""
def __init__(self):
FanBase.__init__(self)
global pddf_obj
global plugin_data
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)) + '/../pddf/pd-plugin.json')) as pd:
plugin_data = json.load(pd)
pddf_obj = pddfparse.PddfParse()
self.platform = pddf_obj.get_platform()
self.num_fans = (self.platform['num_fantrays'] * self.platform['num_fans_pertray'])
def get_num_fans(self):
return self.num_fans
def get_presence(self, idx):
# 1 based fan index
if idx < 1 or idx > self.num_fans:
print("Invalid fan index %d\n" % idx)
return False
attr_name = "fan" + str(idx) + "_present"
output = pddf_obj.get_attr_name_output("FAN-CTRL", attr_name)
if not output:
return False
mode = output['mode']
presence = output['status'].rstrip()
vmap = plugin_data['FAN']['present'][mode]['valmap']
if presence in vmap:
status = vmap[presence]
else:
status = False
return status
def get_status(self, idx):
# 1 based fan index
if idx < 1 or idx > self.num_fans:
print("Invalid fan index %d\n" % idx)
return False
speed = self.get_speed(idx)
status = True if (speed != 0) else False
return status
def get_direction(self, idx):
# 1 based fan index
if idx < 1 or idx > self.num_fans:
print("Invalid fan index %d\n" % idx)
return None
attr = "fan" + str(idx) + "_direction"
output = pddf_obj.get_attr_name_output("FAN-CTRL", attr)
if not output:
return None
mode = output['mode']
val = output['status']
val = val.rstrip()
vmap = plugin_data['FAN']['direction'][mode]['valmap']
if val in vmap:
direction = vmap[val]
else:
direction = val
return direction
def get_directions(self):
num_fan = self.get_num_fan()
for i in range(1, num_fan+1):
attr = "fan" + str(i) + "_direction"
output = pddf_obj.get_attr_name_output("FAN-CTRL", attr)
if not output:
return None
mode = output['mode']
val = output['status']
val = val.rstrip()
vmap = plugin_data['FAN']['direction'][mode]['valmap']
direction = vmap[str(val)]
print("FAN-%d direction is %s" % (i, direction))
return 0
def get_speed(self, idx):
# 1 based fan index
if idx < 1 or idx > self.num_fans:
print("Invalid fan index %d\n" % idx)
return 0
attr = "fan" + str(idx) + "_input"
output = pddf_obj.get_attr_name_output("FAN-CTRL", attr)
if not output:
return 0
#mode = output['mode']
val = output['status'].rstrip()
if val.isalpha():
return 0
else:
rpm_speed = int(float(val))
return rpm_speed
def get_speeds(self):
num_fan = self.get_num_fan()
ret = "FAN_INDEX\t\tRPM\n"
for i in range(1, num_fan+1):
attr1 = "fan" + str(i) + "_input"
output = pddf_obj.get_attr_name_output("FAN-CTRL", attr1)
if not output:
return ""
#mode = output['mode']
val = output['status'].rstrip()
if val.isalpha():
frpm = 0
else:
frpm = int(val)
ret += "FAN-%d\t\t\t%d\n" % (i, frpm)
return ret
def set_speed(self, val):
if val < 0 or val > 100:
print("Error: Invalid speed %d. Please provide a valid speed percentage" % val)
return False
#num_fan = self.num_fans
if 'duty_cycle_to_pwm' not in plugin_data['FAN']:
print("Setting fan speed is not allowed !")
return False
else:
print("setspeed nothing to do")
return False
#return True
def dump_sysfs(self):
return pddf_obj.cli_dump_dsysfs('fan')
def get_change_event(self):
"""
TODO: This function need to be implemented
when decide to support monitoring FAN(fand)
on this platform.
"""
raise NotImplementedError

View File

@ -0,0 +1,59 @@
import sys
sys.path.append('/usr/share/sonic/platform/plugins')
import pddfparse
class LedUtil:
color_map = {
"STATUS_LED_COLOR_GREEN": "on",
"STATUS_LED_COLOR_RED": "faulty",
"STATUS_LED_COLOR_OFF": "off"
}
def __init__(self):
global pddf_obj
pddf_obj = pddfparse.PddfParse()
self.path = "pddf/devices/led"
self.cur_state_path = "pddf/devices/led/cur_state"
def set_status_led(self, led_device_name, color, color_state="SOLID"):
if (not led_device_name in list(pddf_obj.data.keys())):
status = "ERROR: " + led_device_name + " is not configured"
return (status)
if (not color in list(self.color_map.keys())):
status = "ERROR: Invalid color"
return (status)
index = pddf_obj.data[led_device_name]['dev_attr']['index']
pddf_obj.create_attr('device_name', led_device_name, self.path)
pddf_obj.create_attr('index', index, self.path)
pddf_obj.create_attr(
'color', self.color_map[color], self.cur_state_path)
pddf_obj.create_attr('color_state', color_state, self.cur_state_path)
pddf_obj.create_attr('dev_ops', 'set_status', self.path)
return ("Executed")
def get_status_led(self, led_device_name):
if (not led_device_name in list(pddf_obj.data.keys())):
status = "ERROR: " + led_device_name + " is not configured"
return (status)
index = pddf_obj.data[led_device_name]['dev_attr']['index']
pddf_obj.create_attr('device_name', led_device_name, self.path)
pddf_obj.create_attr('index', index, self.path)
pddf_obj.create_attr('dev_ops', 'get_status', self.path)
color_f = "/sys/kernel/" + self.cur_state_path + "/color"
color_state_f = "/sys/kernel/" + self.cur_state_path + "/color_state"
try:
with open(color_f, 'r') as f:
color = f.read().strip("\r\n")
with open(color_state_f, 'r') as f:
color_state = f.read().strip("\r\n")
except IOError:
status = "ERROR :" + color_f + " open failed"
return (status)
status = "%s-%s:\t%s %s\n" % (led_device_name,
index, color, color_state)
return (status)

View File

@ -0,0 +1,270 @@
#
# Sample pddf_psuutil file
#
# All the supported PSU SysFS aattributes are
#- psu_present
#- psu_model_name
#- psu_power_good
#- psu_mfr_id
#- psu_serial_num
#- psu_fan_dir
#- psu_v_out
#- psu_i_out
#- psu_p_out
#- psu_fan1_speed_rpm
#
import os.path
import sys
sys.path.append('/usr/share/sonic/platform/plugins')
import pddfparse
import json
try:
from sonic_psu.psu_base import PsuBase
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""PDDF generic PSU util class"""
def __init__(self):
PsuBase.__init__(self)
global pddf_obj
global plugin_data
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)) + '/../pddf/pd-plugin.json')) as pd:
plugin_data = json.load(pd)
pddf_obj = pddfparse.PddfParse()
self.platform = pddf_obj.get_platform()
def get_num_psus(self):
return int(self.platform['num_psus'])
def get_psu_status(self, index):
if index is None:
return False
device = "PSU" + "%d" % index
output = pddf_obj.get_attr_name_output(device, "psu_power_good")
if not output:
return False
mode = output['mode']
val = output['status']
val = val.rstrip()
vmap = plugin_data['PSU']['psu_power_good'][mode]['valmap']
if val in vmap:
return vmap[val]
else:
return False
def get_psu_presence(self, index):
if index is None:
return False
status = 0
device = "PSU" + "%d" % index
output = pddf_obj.get_attr_name_output(device, "psu_present")
if not output:
return False
mode = output['mode']
status = output['status']
vmap = plugin_data['PSU']['psu_present'][mode]['valmap']
if status.rstrip('\n') in vmap:
return vmap[status.rstrip('\n')]
else:
return False
def get_powergood_status(self, idx):
if idx is None:
return False
if idx < 1 or idx > self.platform['num_psus']:
print("Invalid index %d\n" % idx)
return False
device = "PSU"+"%d" % (idx)
output = pddf_obj.get_attr_name_output(device, "psu_power_good")
if not output:
return False
mode = output['mode']
status = output['status']
vmap = plugin_data['PSU']['psu_power_good'][mode]['valmap']
if status.rstrip('\n') in vmap:
return vmap[status.rstrip('\n')]
else:
return False
def get_model(self, idx):
if idx is None:
return None
if idx < 1 or idx > self.platform['num_psus']:
print("Invalid index %d\n" % idx)
return None
device = "PSU"+"%d" % (idx)
output = pddf_obj.get_attr_name_output(device, "psu_model_name")
if not output:
return None
model = output['status']
# strip_non_ascii
stripped = (c for c in model if 0 < ord(c) < 127)
model = ''.join(stripped)
return model.rstrip('\n')
def get_mfr_id(self, idx):
if idx is None:
return None
if idx < 1 or idx > self.platform['num_psus']:
print("Invalid index %d\n" % idx)
return None
device = "PSU"+"%d" % (idx)
output = pddf_obj.get_attr_name_output(device, "psu_mfr_id")
if not output:
return None
mfr = output['status']
return mfr.rstrip('\n')
def get_serial(self, idx):
if idx is None:
return None
if idx < 1 or idx > self.platform['num_psus']:
print("Invalid index %d\n" % idx)
return None
device = "PSU"+"%d" % (idx)
output = pddf_obj.get_attr_name_output(device, "psu_serial_num")
if not output:
return None
serial = output['status']
return serial.rstrip('\n')
def get_direction(self, idx):
if idx is None:
return None
if idx < 1 or idx > self.platform['num_psus']:
print("Invalid index %d\n" % idx)
return None
device = "PSU"+"%d" % (idx)
output = pddf_obj.get_attr_name_output(device, "psu_fan_dir")
if not output:
return None
mode = output['mode']
direction = output['status'].rstrip('\n')
vmap = plugin_data['PSU']['psu_fan_dir'][mode]['valmap']
if direction in vmap:
airflow_dir_real = vmap[direction]
else:
airflow_dir_real = direction
return airflow_dir_real
def get_output_voltage(self, idx):
if idx is None:
return 0.0
if idx < 1 or idx > self.platform['num_psus']:
print("Invalid index %d\n" % idx)
return 0.0
device = "PSU"+"%d" % (idx)
output = pddf_obj.get_attr_name_output(device, "psu_v_out")
if not output:
return 0.0
v_out = output['status']
# value returned by the psu driver is in mV
return float(v_out)/1000
def get_output_current(self, idx):
if idx is None:
return 0.0
if idx < 1 or idx > self.platform['num_psus']:
print("Invalid index %d\n" % idx)
return 0.0
device = "PSU"+"%d" % (idx)
output = pddf_obj.get_attr_name_output(device, "psu_i_out")
if not output:
return 0.0
i_out = output['status']
# current in mA
return float(i_out)/1000
def get_output_power(self, idx):
if idx is None:
return 0.0
if idx < 1 or idx > self.platform['num_psus']:
print("Invalid index %d\n" % idx)
return 0.0
device = "PSU"+"%d" % (idx)
output = pddf_obj.get_attr_name_output(device, "psu_p_out")
if not output:
return 0.0
p_out = output['status']
# power is returned in micro watts
return float(p_out)/1000000
def get_fan_rpm(self, idx, fan_idx):
if idx is None or fan_idx is None:
return 0
if idx < 1 or idx > self.platform['num_psus']:
print("Invalid index %d\n" % idx)
return 0
device = "PSU"+"%d" % (idx)
num_fans = pddf_obj.get_num_psu_fans(device)
if fan_idx < 1 or fan_idx > num_fans:
print("Invalid PSU-fan index %d\n" % fan_idx)
return 0
output = pddf_obj.get_attr_name_output(device, "psu_fan"+str(fan_idx)+"_speed_rpm")
if not output:
return 0
#mode = output['mode']
output['status'] = output['status'].rstrip()
if output['status'].isalpha():
return 0
else:
speed = int(output['status'])
return speed
def dump_sysfs(self):
return pddf_obj.cli_dump_dsysfs('psu')

View File

@ -0,0 +1,236 @@
import os.path
import sys
sys.path.append('/usr/share/sonic/platform/plugins')
import pddfparse
import json
try:
import time
from ctypes import create_string_buffer
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class SfpUtil(SfpUtilBase):
"""Platform generic PDDF SfpUtil class"""
_port_to_eeprom_mapping = {}
_port_start = 0
_port_end = 0
_port_to_type_mapping = {}
_qsfp_ports = []
_sfp_ports = []
def __init__(self):
SfpUtilBase.__init__(self)
global pddf_obj
global plugin_data
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)) + '/../pddf/pd-plugin.json')) as pd:
plugin_data = json.load(pd)
pddf_obj = pddfparse.PddfParse()
self.platform = pddf_obj.get_platform()
self._port_start = 0
self._port_end = self.get_num_ports()
for port_num in range(self._port_start, self._port_end):
device = "PORT" + "%d" % (port_num+1)
port_eeprom_path = pddf_obj.get_path(device, "eeprom")
self._port_to_eeprom_mapping[port_num] = port_eeprom_path
port_type = pddf_obj.get_device_type(device)
self._port_to_type_mapping[port_num] = port_type
self.populate_port_type(port_num)
def get_num_ports(self):
return int(self.platform['num_ports'])
def is_valid_port(self, port_num):
if port_num < self._port_start or port_num > self._port_end:
return False
else:
return True
def get_presence(self, port_num):
if port_num < self._port_start or port_num > self._port_end:
return False
device = "PORT" + "%d" % (port_num+1)
output = pddf_obj.get_attr_name_output(device, 'xcvr_present')
if not output:
return False
#mode = output['mode']
modpres = output['status'].rstrip()
if 'XCVR' in plugin_data:
if 'xcvr_present' in plugin_data['XCVR']:
ptype = self._port_to_type_mapping[port_num]
vtype = 'valmap-'+ptype
if vtype in plugin_data['XCVR']['xcvr_present']:
vmap = plugin_data['XCVR']['xcvr_present'][vtype]
if modpres in vmap:
return vmap[modpres]
else:
return False
# if plugin_data doesn't specify anything regarding Transceivers
if modpres == '1':
return True
return False
def populate_port_type(self, port):
if self._port_to_type_mapping[port] == 'QSFP' or self._port_to_type_mapping[port] == 'QSFP28':
self._qsfp_ports.append(port)
elif self._port_to_type_mapping[port] == 'SFP' or self._port_to_type_mapping[port] == 'SFP28':
self._sfp_ports.append(port)
@property
def port_start(self):
return self._port_start
@property
def port_end(self):
return (self._port_end - 1)
@property
def port_to_eeprom_mapping(self):
return self._port_to_eeprom_mapping
@property
def qsfp_ports(self):
return self._qsfp_ports
def reset(self, port_num):
if port_num < self._port_start or port_num > self._port_end:
return False
device = "PORT" + "%d" % (port_num+1)
port_ps = pddf_obj.get_path(device, "xcvr_reset")
if port_ps is None:
return False
try:
reg_file = open(port_ps, 'w')
except IOError as e:
print("Error: unable to open file: %s" % str(e))
return False
try:
reg_file.seek(0)
reg_file.write('1')
time.sleep(1)
reg_file.seek(0)
reg_file.write('0')
reg_file.close()
return True
except IOError as e:
return False
def get_low_power_mode(self, port_num):
# Check for invalid port_num
if port_num < self._port_start or port_num > self._port_end:
return False
if not self.get_presence(port_num):
return False
device = "PORT" + "%d" % (port_num+1)
output = pddf_obj.get_attr_name_output(device, 'xcvr_lpmode')
if not output:
if port_num not in self.qsfp_ports:
return False # Read from eeprom only for QSFP ports
try:
eeprom = None
eeprom = open(self.port_to_eeprom_mapping[port_num], "rb")
# check for valid connector type
eeprom.seek(2)
ctype = eeprom.read(1)
if ctype in ['21', '23']:
return False
eeprom.seek(93)
lpmode = ord(eeprom.read(1))
if ((lpmode & 0x3) == 0x3):
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))
return False
finally:
if eeprom is not None:
eeprom.close()
time.sleep(0.01)
else:
#mode = output['mode']
status = int(output['status'].rstrip())
if status == 1:
return True
else:
return False
def set_low_power_mode(self, port_num, lpmode):
# Check for invalid port_num
if port_num < self._port_start or port_num > self._port_end:
return False
if not self.get_presence(port_num):
return False # Port is not present, unable to set the eeprom
device = "PORT" + "%d" % (port_num+1)
port_ps = pddf_obj.get_path(device, "xcvr_lpmode")
if port_ps is None:
if port_num not in self.qsfp_ports:
return False # Write to eeprom only for QSFP ports
try:
eeprom = None
eeprom = open(self.port_to_eeprom_mapping[port_num], "r+b")
# check for valid connector type
eeprom.seek(2)
ctype = eeprom.read(1)
if ctype in ['21', '23']:
return False
# 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)
# Write to eeprom
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)
else:
try:
f = open(port_ps, 'w')
if lpmode:
f.write('1')
else:
f.write('0')
f.close()
return True
except IOError as e:
return False
def get_transceiver_change_event(self):
"""
TODO: This function need to be implemented
when decide to support monitoring SFP(Xcvrd)
on this platform.
"""
raise NotImplementedError
def dump_sysfs(self):
return pddf_obj.cli_dump_dsysfs('xcvr')

View File

@ -0,0 +1,82 @@
import os.path
import sys
sys.path.append('/usr/share/sonic/platform/plugins')
import pddfparse
import json
class SYSStatusUtil():
"""Platform-specific SYSStatus class"""
def __init__(self):
global pddf_obj
global plugin_data
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)) + '/../pddf/pd-plugin.json')) as pd:
plugin_data = json.load(pd)
pddf_obj = pddfparse.PddfParse()
def get_board_info(self):
device = "SYSSTATUS"
node = pddf_obj.get_path(device, "board_info")
if node is None:
return False
try:
with open(node, 'r') as f:
status = f.read()
print("board_info : %s" % status)
except IOError:
return False
def get_cpld_versio(self):
device = "SYSSTATUS"
node = pddf_obj.get_path(device, "cpld1_version")
if node is None:
return False
try:
with open(node, 'r') as f:
status = f.read()
print("cpld1_version : %s" % status)
except IOError:
return False
def get_power_module_status(self):
device = "SYSSTATUS"
node = pddf_obj.get_path(device, "power_module_status")
if node is None:
return False
try:
with open(node, 'r') as f:
status = f.read()
print("power_module_status : %s" % status)
except IOError:
return False
def get_system_reset_status(self):
device = "SYSSTATUS"
for i in range(1, 8):
node = pddf_obj.get_path(device, "system_reset"+str(i))
if node is None:
return False
try:
with open(node, 'r') as f:
status = f.read()
print("system_reset%s : %s" % (i, status))
except IOError:
print("system_reset%s not supported" % i)
def get_misc_status(self):
device = "SYSSTATUS"
for i in range(1, 3):
node = pddf_obj.get_path(device, "misc"+str(i))
if node is None:
return False
try:
with open(node, 'r') as f:
status = f.read()
print("misc%s : %s" % (i, status))
except IOError:
print("system_reset%s not supported" % i)
def dump_sysfs(self):
return pddf_obj.cli_dump_dsysfs('sys-status')

View File

@ -0,0 +1,75 @@
import os.path
import sys
import json
sys.path.append('/usr/share/sonic/platform/plugins')
import pddfparse
class ThermalUtil:
def __init__(self):
global pddf_obj
global plugin_data
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)) + '/../pddf/pd-plugin.json')) as pd:
plugin_data = json.load(pd)
pddf_obj = pddfparse.PddfParse()
self.platform = pddf_obj.get_platform()
self.num_thermals = self.platform['num_temps']
self.info = []
def get_num_thermals(self):
return (self.num_thermals)
def get_thermal_info(self):
list = []
pddf_obj.get_device_list(list, "TEMP_SENSOR")
list.sort()
for dev in list:
data = {}
device_name = dev['dev_info']['device_name']
topo_info = dev['i2c']['topo_info']
label = "%s-i2c-%d-%x" % (topo_info['dev_type'],
int(topo_info['parent_bus'], 0), int(topo_info['dev_addr'], 0))
attr_list = dev['i2c']['attr_list']
data['device_name'] = device_name
data['label'] = label
for attr in attr_list:
attr_name = attr['attr_name']
node = pddf_obj.get_path(device_name, attr_name)
if node is None:
return False
try:
with open(node, 'r') as f:
attr_value = int(f.read())
except IOError:
return False
data[attr_name] = attr_value/float(1000)
self.info.append(data)
def show_thermal_temp_values(self, idx):
if idx < 1 or idx > self.num_thermals:
print("Invalid temperature sensor idx %d" % idx)
return None
self.get_thermal_info()
thermal_name = "TEMP"+"%d" % idx
label = ""
value = ""
for temp in self.info:
if thermal_name == temp['device_name']:
label = temp['label']
value = "temp1\t %+.1f C (high = %+.1f C, hyst = %+.1f C)" % (
temp['temp1_input'], temp['temp1_max'], temp['temp1_max_hyst'])
else:
continue
return (label, value)
def show_temp_values(self):
self.get_thermal_info()
for temp in self.info:
print(temp['label'])
print("temp1\t %+.1f C (high = %+.1f C, hyst = %+.1f C)" %
(temp['temp1_input'], temp['temp1_max'], temp['temp1_max_hyst']))
def dump_sysfs(self):
return pddf_obj.cli_dump_dsysfs('temp-sensors')

View File

@ -1,5 +1,3 @@
{
"skip_ledd": true,
"skip_xcvrd": false,
"skip_psud": false
}
"skip_ledd": true
}

View File

@ -1,63 +0,0 @@
<DeviceMiniGraph xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="Microsoft.Search.Autopilot.Evolution">
<CpgDec>
</CpgDec>
<DpgDec>
<DeviceDataPlaneInfo>
<IPSecTunnels/>
<LoopbackIPInterfaces/>
<ManagementIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
</ManagementIPInterfaces>
<MplsInterfaces/>
<MplsTeInterfaces/>
<RsvpInterfaces/>
<Hostname>switch2</Hostname>
<PortChannelInterfaces/>
<VlanInterfaces/>
<IPInterfaces/>
<DataAcls/>
<AclInterfaces/>
<DownstreamSummaries/>
<DownstreamSummarySet xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
</DeviceDataPlaneInfo>
</DpgDec>
<PngDec>
<Devices>
<Device i:type="LeafRouter">
<Hostname>switch2</Hostname>
<HwSku>RA-B6910-64C</HwSku>
</Device>
</Devices>
</PngDec>
<MetadataDeclaration>
<Devices xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
<a:DeviceMetadata>
<a:Name>switch2</a:Name>
<a:Properties>
<a:DeviceProperty>
<a:Name>DhcpResources</a:Name>
<a:Reference i:nil="true"/>
<a:Value></a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>NtpResources</a:Name>
<a:Reference i:nil="true"/>
<a:Value>0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>SyslogResources</a:Name>
<a:Reference i:nil="true"/>
<a:Value></a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>ErspanDestinationIpv4</a:Name>
<a:Reference i:nil="true"/>
<a:Value>2.2.2.2</a:Value>
</a:DeviceProperty>
</a:Properties>
</a:DeviceMetadata>
</Devices>
<Properties xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
</MetadataDeclaration>
<Hostname>switch2</Hostname>
<HwSku>RA-B6910-64C</HwSku>
</DeviceMiniGraph>

View File

@ -73,12 +73,12 @@
"CONTROLLERS": [{
"dev_name": "i2c-0",
"dev": "SMBUS0"
}, {
"dev_name": "i2c-1",
"dev": "I2C-GPIO0"
}, {
"dev_name": "i2c-2",
"dev": "SMBUS1"
}, {
"dev_name": "i2c-1",
"dev": "I2C-GPIO0"
}]
}
},
@ -1370,6 +1370,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x30",
@ -1378,6 +1379,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x40",
@ -1451,6 +1453,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x30",
@ -1459,6 +1462,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x40",
@ -1532,6 +1536,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x30",
@ -1540,6 +1545,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x40",
@ -1614,6 +1620,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x30",
@ -1622,6 +1629,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x40",
@ -1696,6 +1704,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x30",
@ -1704,6 +1713,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x40",
@ -1778,6 +1788,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x30",
@ -1786,6 +1797,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x40",
@ -1859,6 +1871,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x30",
@ -1867,6 +1880,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x40",
@ -1940,6 +1954,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x30",
@ -1948,6 +1963,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x40",
@ -2021,6 +2037,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x31",
@ -2029,6 +2046,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x41",
@ -2102,6 +2120,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x31",
@ -2110,6 +2129,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x41",
@ -2184,6 +2204,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x31",
@ -2192,6 +2213,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x41",
@ -2266,6 +2288,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x31",
@ -2274,6 +2297,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x41",
@ -2348,6 +2372,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x31",
@ -2356,6 +2381,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x41",
@ -2430,6 +2456,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x31",
@ -2438,6 +2465,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x41",
@ -2511,6 +2539,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x31",
@ -2519,6 +2548,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x41",
@ -2592,6 +2622,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x31",
@ -2600,6 +2631,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x41",
@ -2673,6 +2705,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x30",
@ -2681,6 +2714,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x40",
@ -2754,6 +2788,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x30",
@ -2762,6 +2797,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x40",
@ -2836,6 +2872,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x30",
@ -2844,6 +2881,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x40",
@ -2918,6 +2956,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x30",
@ -2926,6 +2965,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x40",
@ -3000,6 +3040,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x30",
@ -3008,6 +3049,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x40",
@ -3082,6 +3124,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x30",
@ -3090,6 +3133,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x40",
@ -3163,6 +3207,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x30",
@ -3171,6 +3216,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x40",
@ -3244,6 +3290,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x30",
@ -3252,6 +3299,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x40",
@ -3325,6 +3373,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x31",
@ -3333,6 +3382,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x41",
@ -3406,6 +3456,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x31",
@ -3414,6 +3465,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x41",
@ -3488,6 +3540,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x31",
@ -3496,6 +3549,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x41",
@ -3570,6 +3624,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x31",
@ -3578,6 +3633,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x41",
@ -3652,6 +3708,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x31",
@ -3660,6 +3717,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x41",
@ -3734,6 +3792,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x31",
@ -3742,6 +3801,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x41",
@ -3815,6 +3875,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x31",
@ -3823,6 +3884,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x41",
@ -3896,6 +3958,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x31",
@ -3904,6 +3967,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x41",
@ -3977,6 +4041,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x32",
@ -3985,6 +4050,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x42",
@ -4058,6 +4124,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x32",
@ -4066,6 +4133,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x42",
@ -4140,6 +4208,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x32",
@ -4148,6 +4217,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x42",
@ -4222,6 +4292,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x32",
@ -4230,6 +4301,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x42",
@ -4304,6 +4376,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x32",
@ -4312,6 +4385,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x42",
@ -4386,6 +4460,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x32",
@ -4394,6 +4469,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x42",
@ -4467,6 +4543,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x32",
@ -4475,6 +4552,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x42",
@ -4548,6 +4626,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x32",
@ -4556,6 +4635,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x42",
@ -4629,6 +4709,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x33",
@ -4637,6 +4718,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x43",
@ -4710,6 +4792,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x33",
@ -4718,6 +4801,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x43",
@ -4792,6 +4876,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x33",
@ -4800,6 +4885,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x43",
@ -4874,6 +4960,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x33",
@ -4882,6 +4969,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x43",
@ -4956,6 +5044,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x33",
@ -4964,6 +5053,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x43",
@ -5038,6 +5128,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x33",
@ -5046,6 +5137,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x43",
@ -5119,6 +5211,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x33",
@ -5127,6 +5220,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x43",
@ -5200,6 +5294,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x33",
@ -5208,6 +5303,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD1_B",
"attr_devaddr": "0x34",
"attr_devtype": "cpld",
"attr_offset": "0x43",
@ -5281,6 +5377,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x32",
@ -5289,6 +5386,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x42",
@ -5362,6 +5460,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x32",
@ -5370,6 +5469,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x42",
@ -5444,6 +5544,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x32",
@ -5452,6 +5553,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x42",
@ -5526,6 +5628,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x32",
@ -5534,6 +5637,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x42",
@ -5608,6 +5712,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x32",
@ -5616,6 +5721,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x42",
@ -5690,6 +5796,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x32",
@ -5698,6 +5805,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x42",
@ -5771,6 +5879,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x32",
@ -5779,6 +5888,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x42",
@ -5852,6 +5962,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x32",
@ -5860,6 +5971,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x42",
@ -5933,6 +6045,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x33",
@ -5941,6 +6054,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x43",
@ -6014,6 +6128,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x33",
@ -6022,6 +6137,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x43",
@ -6095,6 +6211,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x33",
@ -6103,6 +6220,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x43",
@ -6176,6 +6294,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x33",
@ -6184,6 +6303,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x43",
@ -6257,6 +6377,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x33",
@ -6265,6 +6386,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x43",
@ -6338,6 +6460,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x33",
@ -6346,6 +6469,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x43",
@ -6419,6 +6543,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x33",
@ -6427,6 +6552,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x43",
@ -6500,6 +6626,7 @@
},
"attr_list": [{
"attr_name": "xcvr_present",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x33",
@ -6508,6 +6635,7 @@
"attr_len": "1"
}, {
"attr_name": "xcvr_intr_status",
"attr_devname": "MAC_BOARD_CPLD2_B",
"attr_devaddr": "0x36",
"attr_devtype": "cpld",
"attr_offset": "0x43",

View File

@ -166,7 +166,7 @@ class FanUtil(FanBase):
print("Error: Invalid speed %d. Please provide a valid speed percentage" % val)
return False
num_fan = self.num_fans
#num_fan = self.num_fans
if 'duty_cycle_to_pwm' not in plugin_data['FAN']:
print("Setting fan speed is not allowed !")
return False

View File

@ -1,5 +1,3 @@
{
"skip_ledd": true,
"skip_xcvrd": false,
"skip_psud": false
}
"skip_ledd": true
}

View File

@ -1,63 +0,0 @@
<DeviceMiniGraph xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="Microsoft.Search.Autopilot.Evolution">
<CpgDec>
</CpgDec>
<DpgDec>
<DeviceDataPlaneInfo>
<IPSecTunnels/>
<LoopbackIPInterfaces/>
<ManagementIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
</ManagementIPInterfaces>
<MplsInterfaces/>
<MplsTeInterfaces/>
<RsvpInterfaces/>
<Hostname>switch2</Hostname>
<PortChannelInterfaces/>
<VlanInterfaces/>
<IPInterfaces/>
<DataAcls/>
<AclInterfaces/>
<DownstreamSummaries/>
<DownstreamSummarySet xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
</DeviceDataPlaneInfo>
</DpgDec>
<PngDec>
<Devices>
<Device i:type="LeafRouter">
<Hostname>switch2</Hostname>
<HwSku>RA-B6920-4S</HwSku>
</Device>
</Devices>
</PngDec>
<MetadataDeclaration>
<Devices xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
<a:DeviceMetadata>
<a:Name>switch2</a:Name>
<a:Properties>
<a:DeviceProperty>
<a:Name>DhcpResources</a:Name>
<a:Reference i:nil="true"/>
<a:Value></a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>NtpResources</a:Name>
<a:Reference i:nil="true"/>
<a:Value>0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org</a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>SyslogResources</a:Name>
<a:Reference i:nil="true"/>
<a:Value></a:Value>
</a:DeviceProperty>
<a:DeviceProperty>
<a:Name>ErspanDestinationIpv4</a:Name>
<a:Reference i:nil="true"/>
<a:Value>2.2.2.2</a:Value>
</a:DeviceProperty>
</a:Properties>
</a:DeviceMetadata>
</Devices>
<Properties xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
</MetadataDeclaration>
<Hostname>switch2</Hostname>
<HwSku>RA-B6920-4S</HwSku>
</DeviceMiniGraph>

View File

@ -4,7 +4,7 @@ export RAGILE_RA_B6510_48V8C_PLATFORM_MODULE_VERSION
RAGILE_RA_B6510_48V8C_PLATFORM_MODULE = platform-modules-ragile-ra-b6510-48v8c_$(RAGILE_RA_B6510_48V8C_PLATFORM_MODULE_VERSION)_amd64.deb
$(RAGILE_RA_B6510_48V8C_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-ragile
$(RAGILE_RA_B6510_48V8C_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
$(RAGILE_RA_B6510_48V8C_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(PDDF_PLATFORM_MODULE)
$(RAGILE_RA_B6510_48V8C_PLATFORM_MODULE)_PLATFORM = x86_64-ragile_ra-b6510-48v8c-r0
SONIC_DPKG_DEBS += $(RAGILE_RA_B6510_48V8C_PLATFORM_MODULE)
SONIC_STRETCH_DEBS += $(RAGILE_RA_B6510_48V8C_PLATFORM_MODULE)

View File

@ -14,7 +14,7 @@ include $(PLATFORM_PATH)/platform-modules-quanta.mk
include $(PLATFORM_PATH)/platform-modules-juniper.mk
#include $(PLATFORM_PATH)/platform-modules-brcm-xlr-gts.mk
#include $(PLATFORM_PATH)/platform-modules-ruijie.mk
#include $(PLATFORM_PATH)/platform-modules-ragile.mk
include $(PLATFORM_PATH)/platform-modules-ragile.mk
#include $(PLATFORM_PATH)/platform-modules-tencent.mk
include $(PLATFORM_PATH)/docker-syncd-brcm.mk
include $(PLATFORM_PATH)/docker-syncd-brcm-rpc.mk

View File

@ -29,8 +29,15 @@
#include <linux/pmbus.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/version.h>
#include "pmbus.h"
struct pmbus_device_info {
int pages;
u32 flags;
};
static const struct i2c_device_id pmbus_id[];
/*
* Find sensor groups and status registers on each page.
@ -114,7 +121,7 @@ static int pmbus_identify(struct i2c_client *client,
}
if (pmbus_check_byte_register(client, 0, PMBUS_VOUT_MODE)) {
int vout_mode;
int vout_mode, i;
vout_mode = pmbus_read_byte_data(client, 0, PMBUS_VOUT_MODE);
if (vout_mode >= 0 && vout_mode != 0xff) {
@ -123,6 +130,11 @@ static int pmbus_identify(struct i2c_client *client,
break;
case 1:
info->format[PSC_VOLTAGE_OUT] = vid;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
for (i = 0; i < info->pages; i++) {
info->vrm_version[i] = vr11;
}
#endif
break;
case 2:
info->format[PSC_VOLTAGE_OUT] = direct;
@ -156,6 +168,7 @@ abort:
return ret;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
static int pmbus_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
struct pmbus_driver_info *info;
@ -182,7 +195,34 @@ static int pmbus_probe(struct i2c_client *client, const struct i2c_device_id *id
return pmbus_do_probe(client, id, info);
}
#else
static int pmbus_probe(struct i2c_client *client)
{
struct pmbus_driver_info *info;
struct pmbus_platform_data *pdata = NULL;
struct device *dev = &client->dev;
struct pmbus_device_info *device_info;
info = devm_kzalloc(dev, sizeof(struct pmbus_driver_info), GFP_KERNEL);
if (!info)
return -ENOMEM;
device_info = (struct pmbus_device_info *)i2c_match_id(pmbus_id, client)->driver_data;
if (device_info->flags & PMBUS_SKIP_STATUS_CHECK) {
pdata = devm_kzalloc(dev, sizeof(struct pmbus_platform_data), GFP_KERNEL);
if (!pdata) {
return -ENOMEM;
}
pdata->flags = PMBUS_SKIP_STATUS_CHECK;
}
info->pages = device_info->pages;
info->identify = pmbus_identify;
dev->platform_data = pdata;
return pmbus_do_probe(client, info);
}
#endif
static const struct i2c_device_id pmbus_id[] = {
{"csu550", 0},
{"csu800", 1},
@ -194,8 +234,11 @@ MODULE_DEVICE_TABLE(i2c, pmbus_id);
/* This is the driver that will be inserted */
static struct i2c_driver pmbus_driver = {
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
.probe = pmbus_probe,
.remove = pmbus_do_remove,
#else
.probe_new = pmbus_probe,
#endif
.id_table = pmbus_id,
.driver = {
.name = "pmbus",

View File

@ -25,10 +25,10 @@
#include <linux/log2.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <fpga_i2c_ocores.h>
#include "fpga_i2c_ocores.h"
#include <linux/spinlock.h>
#include <linux/delay.h>
#include <linux/version.h>
struct ocores_i2c {
void __iomem *base;
@ -835,8 +835,13 @@ static int rg_ocores_i2c_probe(struct platform_device *pdev)
/* add in known devices to the bus */
if (pdata) {
for (i = 0; i < pdata->num_devices; i++)
for (i = 0; i < pdata->num_devices; i++) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
i2c_new_client_device(&i2c->adap, pdata->devices + i);
#else
i2c_new_device(&i2c->adap, pdata->devices + i);
#endif
}
}
oc_debug_sysfs_init(pdev);

View File

@ -11,9 +11,9 @@
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <fpga_i2c_ocores.h>
#include <fpga_pcie_i2c.h>
#include <fpga_reg_defs.h>
#include "fpga_i2c_ocores.h"
#include "fpga_pcie_i2c.h"
#include "fpga_reg_defs.h"
#include <linux/i2c-mux.h>
#include <linux/i2c-mux.h>

View File

@ -40,7 +40,13 @@
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/i2c-mux.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
#include <dt-bindings/mux/mux.h>
#include <linux/property.h>
#else
#include <linux/platform_data/pca954x.h>
#endif
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/module.h>
@ -63,7 +69,12 @@
extern int pca9641_setmuxflag(int nr, int flag);
int force_create_bus = 0;
static int close_chan_force_reset = 0;
static int select_chan_check = 0;
module_param(force_create_bus, int, S_IRUGO | S_IWUSR);
module_param(close_chan_force_reset, int, S_IRUGO | S_IWUSR);
module_param(select_chan_check, int, S_IRUGO | S_IWUSR);
enum pca_type {
pca_9540,
@ -86,14 +97,15 @@ struct chip_desc {
} muxtype;
};
struct pca954x {
const struct chip_desc *chip;
u8 last_chan; /* last register value */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
s32 idle_state;
#else
u8 deselect;
#endif
struct i2c_client *client;
struct irq_domain *irq;
@ -157,7 +169,20 @@ static const struct i2c_device_id pca954x_id[] = {
{ }
};
MODULE_DEVICE_TABLE(i2c, pca954x_id);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
static const struct of_device_id pca954x_of_match[] = {
{ .compatible = "nxp,pca9540", .data = &chips[pca_9540] },
{ .compatible = "nxp,pca9542", .data = &chips[pca_9542] },
{ .compatible = "nxp,pca9543", .data = &chips[pca_9543] },
{ .compatible = "nxp,pca9544", .data = &chips[pca_9544] },
{ .compatible = "nxp,pca9545", .data = &chips[pca_9545] },
{ .compatible = "nxp,pca9546", .data = &chips[pca_9546] },
{ .compatible = "nxp,pca9547", .data = &chips[pca_9547] },
{ .compatible = "nxp,pca9548", .data = &chips[pca_9548] },
{}
};
MODULE_DEVICE_TABLE(of, pca954x_of_match);
#else
#ifdef CONFIG_OF
static const struct of_device_id pca954x_of_match[] = {
{ .compatible = "nxp,pca9540", .data = &chips[pca_9540] },
@ -172,6 +197,7 @@ static const struct of_device_id pca954x_of_match[] = {
};
MODULE_DEVICE_TABLE(of, pca954x_of_match);
#endif
#endif
/* Write to mux register. Don't use i2c_transfer()/i2c_smbus_xfer()
for this as they will try to lock adapter a second time */
@ -204,6 +230,53 @@ static int pca954x_reg_write(struct i2c_adapter *adap,
return ret;
}
static int pca954x_reg_read(struct i2c_adapter *adap,
struct i2c_client *client, u8 *val)
{
int ret = -ENODEV;
u8 tmp_val;
if (adap->algo->master_xfer) {
struct i2c_msg msg;
msg.addr = client->addr;
msg.flags = I2C_M_RD;
msg.len = 1;
msg.buf = &tmp_val;
ret = __i2c_transfer(adap, &msg, 1);
if (ret >= 0 && ret != 1) {
ret = -EREMOTEIO;
} else {
*val = tmp_val;
}
} else {
union i2c_smbus_data data;
ret = adap->algo->smbus_xfer(adap, client->addr,
client->flags,
I2C_SMBUS_READ,
0, I2C_SMBUS_BYTE, &data);
if (!ret) {
tmp_val = data.byte;
*val = tmp_val;
}
}
return ret;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
static u8 pca954x_regval(struct pca954x *data, u8 chan)
{
/* We make switches look like muxes, not sure how to be smarter. */
if (data->chip->muxtype == pca954x_ismux)
return chan | data->chip->enable;
else
return 1 << chan;
}
#endif
static int pca954x_setmuxflag(struct i2c_client *client, int flag)
{
struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent);
@ -211,31 +284,6 @@ static int pca954x_setmuxflag(struct i2c_client *client, int flag)
return 0;
}
static int pca954x_select_chan(struct i2c_mux_core *muxc, u32 chan)
{
struct pca954x *data = i2c_mux_priv(muxc);
struct i2c_client *client = data->client;
const struct chip_desc *chip = data->chip;
u8 regval;
int ret = 0;
/* we make switches look like muxes, not sure how to be smarter */
if (chip->muxtype == pca954x_ismux)
regval = chan | chip->enable;
else
regval = 1 << chan;
/* Only select the channel if its different from the last channel */
if (data->last_chan != regval) {
pca954x_setmuxflag(client, 0);
ret = pca954x_reg_write(muxc->parent, client, regval);
data->last_chan = ret < 0 ? 0 : regval;
}
return ret;
}
typedef void (*pca954x_hw_do_reset_func_t)(int busid, int addr);
pca954x_hw_do_reset_func_t g_notify_to_do_reset = NULL;
@ -1132,6 +1180,179 @@ static int pca954x_do_reset(struct i2c_adapter *adap,
ret = 0;
return ret;
}
static int pca954x_select_chan(struct i2c_mux_core *muxc, u32 chan)
{
struct pca954x *data = i2c_mux_priv(muxc);
struct i2c_client *client = data->client;
const struct chip_desc *chip = data->chip;
u8 regval;
int ret = 0;
u8 read_val;
int rv;
read_val = 0;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
regval = pca954x_regval(data, chan);
#else
/* we make switches look like muxes, not sure how to be smarter */
if (chip->muxtype == pca954x_ismux)
regval = chan | chip->enable;
else
regval = 1 << chan;
#endif
/* Only select the channel if its different from the last channel */
if (data->last_chan != regval) {
pca954x_setmuxflag(client, 0);
ret = pca954x_reg_write(muxc->parent, client, regval);
data->last_chan = ret < 0 ? 0 : regval;
}
if (select_chan_check) { /* check chan */
ret = pca954x_reg_read(muxc->parent, client, &read_val);
/* read failed or chan not open, reset pca9548 */
if ((ret < 0) || (read_val != data->last_chan)) {
dev_warn(&client->dev, "pca954x open channle %u failed, do reset.\n", chan);
PCA954X_DEBUG("ret = %d, read_val = %d, last_chan = %d.\n", ret, read_val, data->last_chan);
rv = pca954x_do_reset(client->adapter, client, chan);
if (rv >= 0) {
PCA954X_DEBUG("pca954x_do_reset success, rv = %d.\n", rv);
} else {
PCA954X_DEBUG("pca954x_do_reset failed, rv = %d.\n", rv);
}
if (ret >= 0) {
ret = -EIO; /* chan not match, return IO error */
}
}
}
return ret;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
static int pca954x_deselect_mux(struct i2c_mux_core *muxc, u32 chan)
{
struct pca954x *data = i2c_mux_priv(muxc);
struct i2c_client *client = data->client;
s32 idle_state;
int ret, rv;
struct i2c_client * new_client;
if (close_chan_force_reset) {
data->last_chan = 0;
ret = pca954x_do_reset(client->adapter, client, chan);
if (ret < 0) {
dev_warn(&client->dev, "pca954x do reset failed %d.\n", ret);
}
return ret;
} else {
idle_state = READ_ONCE(data->idle_state);
if (idle_state >= 0)
/* Set the mux back to a predetermined channel */
return pca954x_select_chan(muxc, idle_state);
if (idle_state == MUX_IDLE_DISCONNECT) {
/* Deselect active channel */
data->last_chan = 0;
ret = pca954x_reg_write(muxc->parent, client,
data->last_chan);
if (ret < 0) {
new_client =(struct i2c_client *) client;
dev_warn(&new_client->dev, "pca954x close chn failed, do reset.\n");
rv = pca954x_do_reset(client->adapter, client, chan);
if (rv == 0) {
ret = 0;
}
}
return ret;
}
}
/* otherwise leave as-is */
return 0;
}
static ssize_t idle_state_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct i2c_client *client = to_i2c_client(dev);
struct i2c_mux_core *muxc = i2c_get_clientdata(client);
struct pca954x *data = i2c_mux_priv(muxc);
return sprintf(buf, "%d\n", READ_ONCE(data->idle_state));
}
static ssize_t idle_state_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct i2c_client *client = to_i2c_client(dev);
struct i2c_mux_core *muxc = i2c_get_clientdata(client);
struct pca954x *data = i2c_mux_priv(muxc);
int val;
int ret;
ret = kstrtoint(buf, 0, &val);
if (ret < 0)
return ret;
if (val != MUX_IDLE_AS_IS && val != MUX_IDLE_DISCONNECT &&
(val < 0 || val >= data->chip->nchans))
return -EINVAL;
i2c_lock_bus(muxc->parent, I2C_LOCK_SEGMENT);
WRITE_ONCE(data->idle_state, val);
/*
* Set the mux into a state consistent with the new
* idle_state.
*/
if (data->last_chan || val != MUX_IDLE_DISCONNECT)
ret = pca954x_deselect_mux(muxc, 0);
i2c_unlock_bus(muxc->parent, I2C_LOCK_SEGMENT);
return ret < 0 ? ret : count;
}
static DEVICE_ATTR_RW(idle_state);
static irqreturn_t pca954x_irq_handler(int irq, void *dev_id)
{
struct pca954x *data = dev_id;
unsigned long pending;
int ret, i;
ret = i2c_smbus_read_byte(data->client);
if (ret < 0)
return IRQ_NONE;
pending = (ret >> PCA954X_IRQ_OFFSET) & (BIT(data->chip->nchans) - 1);
for_each_set_bit(i, &pending, data->chip->nchans)
handle_nested_irq(irq_linear_revmap(data->irq, i));
return IRQ_RETVAL(pending);
}
static int pca954x_init(struct i2c_client *client, struct pca954x *data)
{
int ret;
if (data->idle_state >= 0)
data->last_chan = pca954x_regval(data, data->idle_state);
else
data->last_chan = 0; /* Disconnect multiplexer */
ret = i2c_smbus_write_byte(client, data->last_chan);
if (ret < 0)
data->last_chan = 0;
return ret;
}
#else
static int pca954x_deselect_mux(struct i2c_mux_core *muxc, u32 chan)
{
struct pca954x *data = i2c_mux_priv(muxc);
@ -1178,6 +1399,7 @@ static irqreturn_t pca954x_irq_handler(int irq, void *dev_id)
}
return handled ? IRQ_HANDLED : IRQ_NONE;
}
#endif
static void pca954x_irq_mask(struct irq_data *idata)
{
@ -1274,7 +1496,9 @@ static int pca954x_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent);
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev);
#endif
struct device_node *of_node = client->dev.of_node;
bool idle_disconnect_dt;
struct gpio_desc *gpio;
@ -1302,7 +1526,25 @@ static int pca954x_probe(struct i2c_client *client,
gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW);
if (IS_ERR(gpio))
return PTR_ERR(gpio);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
data->idle_state = MUX_IDLE_AS_IS;
if (device_property_read_u32(&client->dev, "idle-state", &data->idle_state)) {
if (device_property_read_bool(&client->dev, "i2c-mux-idle-disconnect"))
data->idle_state = MUX_IDLE_DISCONNECT;
}
/*
* Write the mux register at addr to verify
* that the mux is in fact present. This also
* initializes the mux to a channel
* or disconnected state.
*/
ret = pca954x_init(client, data);
if (ret < 0) {
dev_warn(&client->dev, "probe failed\n");
return -ENODEV;
}
#else
/* Write the mux register at addr to verify
* that the mux is in fact present. This also
* initializes the mux to disconnected state.
@ -1311,7 +1553,7 @@ static int pca954x_probe(struct i2c_client *client,
dev_warn(&client->dev, "probe failed\n");
return -ENODEV;
}
#endif
match = of_match_device(of_match_ptr(pca954x_of_match), &client->dev);
if (match)
data->chip = of_device_get_match_data(&client->dev);
@ -1329,6 +1571,9 @@ static int pca954x_probe(struct i2c_client *client,
/* Now create an adapter for each channel */
for (num = 0; num < data->chip->nchans; num++) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
ret = i2c_mux_add_adapter(muxc, 0, num, 0);
#else
bool idle_disconnect_pd = false;
force = 0; /* dynamic adap number */
@ -1347,10 +1592,17 @@ static int pca954x_probe(struct i2c_client *client,
idle_disconnect_dt) << num;
ret = i2c_mux_add_adapter(muxc, force, num, class);
#endif
if (ret)
goto fail_del_adapters;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
/*
* The attr probably isn't going to be needed in most cases,
* so don't fail completely on error.
*/
device_create_file(&client->dev, &dev_attr_idle_state);
#endif
dev_info(&client->dev,
"registered %d multiplexed busses for I2C %s %s\n",
num, data->chip->muxtype == pca954x_ismux
@ -1376,7 +1628,9 @@ static int pca954x_remove(struct i2c_client *client)
}
irq_domain_remove(data->irq);
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
device_remove_file(&client->dev, &dev_attr_idle_state);
#endif
i2c_mux_del_adapters(muxc);
return 0;
}
@ -1387,9 +1641,18 @@ static int pca954x_resume(struct device *dev)
struct i2c_client *client = to_i2c_client(dev);
struct i2c_mux_core *muxc = i2c_get_clientdata(client);
struct pca954x *data = i2c_mux_priv(muxc);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
int ret;
ret = pca954x_init(client, data);
if (ret < 0)
dev_err(&client->dev, "failed to verify mux presence\n");
return ret;
#else
data->last_chan = 0;
return i2c_smbus_write_byte(client, 0);
#endif
}
#endif

View File

@ -23,7 +23,12 @@
#include <linux/device.h>
#include <linux/i2c.h>
#include <linux/i2c-mux.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
#include <linux/bitops.h>
#else
#include <linux/platform_data/pca954x.h>
#endif
/*
* The PCA9541 is a bus master selector. It supports two I2C masters connected
@ -546,7 +551,9 @@ static int pca9541_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct i2c_adapter *adap = client->adapter;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev);
#endif
struct i2c_mux_core *muxc;
struct pca9541 *data;
int force;
@ -573,11 +580,11 @@ static int pca9541_probe(struct i2c_client *client,
}
/* Create mux adapter */
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
force = 0;
if (pdata)
force = pdata->modes[0].adap_id;
#endif
if (detect_id == 0) {
muxc = i2c_mux_alloc(adap, &client->dev, 1, sizeof(*data),
I2C_MUX_ARBITRATOR,
@ -589,8 +596,11 @@ static int pca9541_probe(struct i2c_client *client,
data->client = client;
i2c_set_clientdata(client, muxc);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
ret = i2c_mux_add_adapter(muxc, 0, 0, 0);
#else
ret = i2c_mux_add_adapter(muxc, force, 0, 0);
#endif
if (ret)
return ret;
} else {

View File

@ -25,10 +25,11 @@
#include <linux/log2.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <lpc_cpld_i2c_ocores.h>
#include "lpc_cpld_i2c_ocores.h"
#include <linux/spinlock.h>
#include <linux/delay.h>
#include <linux/jiffies.h>
#include <linux/version.h>
#define OCORES_FLAG_POLL BIT(0)
@ -768,8 +769,13 @@ static int rg_ocores_i2c_probe(struct platform_device *pdev)
/* add in known devices to the bus */
if (pdata) {
LPC_CPLD_I2C_DEBUG_VERBOSE("i2c device %d.\n", pdata->num_devices);
for (i = 0; i < pdata->num_devices; i++)
for (i = 0; i < pdata->num_devices; i++) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
i2c_new_client_device(&i2c->adap, pdata->devices + i);
#else
i2c_new_device(&i2c->adap, pdata->devices + i);
#endif
}
}
oc_debug_sysfs_init(pdev);

View File

@ -24,6 +24,7 @@
#include <linux/bitops.h>
#include <linux/regulator/driver.h>
#include <linux/version.h>
/*
* Registers
@ -35,6 +36,8 @@ enum pmbus_regs {
PMBUS_CLEAR_FAULTS = 0x03,
PMBUS_PHASE = 0x04,
PMBUS_WRITE_PROTECT = 0x10,
PMBUS_CAPABILITY = 0x19,
PMBUS_QUERY = 0x1A,
@ -130,6 +133,23 @@ enum pmbus_regs {
PMBUS_MFR_DATE = 0x9D,
PMBUS_MFR_SERIAL = 0x9E,
PMBUS_MFR_VIN_MIN = 0xA0,
PMBUS_MFR_VIN_MAX = 0xA1,
PMBUS_MFR_IIN_MAX = 0xA2,
PMBUS_MFR_PIN_MAX = 0xA3,
PMBUS_MFR_VOUT_MIN = 0xA4,
PMBUS_MFR_VOUT_MAX = 0xA5,
PMBUS_MFR_IOUT_MAX = 0xA6,
PMBUS_MFR_POUT_MAX = 0xA7,
PMBUS_IC_DEVICE_ID = 0xAD,
PMBUS_IC_DEVICE_REV = 0xAE,
PMBUS_MFR_MAX_TEMP_1 = 0xC0,
PMBUS_MFR_MAX_TEMP_2 = 0xC1,
PMBUS_MFR_MAX_TEMP_3 = 0xC2,
/*
* Virtual registers.
* Useful to support attributes which are not supported by standard PMBus
@ -217,6 +237,19 @@ enum pmbus_regs {
PMBUS_VIRT_PWM_ENABLE_2,
PMBUS_VIRT_PWM_ENABLE_3,
PMBUS_VIRT_PWM_ENABLE_4,
/* Samples for average
*
* Drivers wanting to expose functionality for changing the number of
* samples used for average values should implement support in
* {read,write}_word_data callback for either PMBUS_VIRT_SAMPLES if it
* applies to all types of measurements, or any number of specific
* PMBUS_VIRT_*_SAMPLES registers to allow for individual control.
*/
PMBUS_VIRT_SAMPLES,
PMBUS_VIRT_IN_SAMPLES,
PMBUS_VIRT_CURR_SAMPLES,
PMBUS_VIRT_POWER_SAMPLES,
PMBUS_VIRT_TEMP_SAMPLES,
};
/*
@ -224,6 +257,15 @@ enum pmbus_regs {
*/
#define PB_OPERATION_CONTROL_ON BIT(7)
/*
* WRITE_PROTECT
*/
#define PB_WP_ALL BIT(7) /* all but WRITE_PROTECT */
#define PB_WP_OP BIT(6) /* all but WP, OPERATION, PAGE */
#define PB_WP_VOUT BIT(5) /* all but WP, OPERATION, PAGE, VOUT, ON_OFF */
#define PB_WP_ANY (PB_WP_ALL | PB_WP_OP | PB_WP_VOUT)
/*
* CAPABILITY
*/
@ -347,7 +389,7 @@ enum pmbus_sensor_classes {
};
#define PMBUS_PAGES 32 /* Per PMBus specification */
#define PMBUS_PHASES 8 /* Maximum number of phases per page */
/* Functionality bit mask */
#define PMBUS_HAVE_VIN BIT(0)
#define PMBUS_HAVE_VCAP BIT(1)
@ -371,16 +413,23 @@ enum pmbus_sensor_classes {
#define PMBUS_HAVE_STATUS_VMON BIT(19)
#define PMBUS_HAVE_PWM12 BIT(20)
#define PMBUS_HAVE_PWM34 BIT(21)
#define PMBUS_HAVE_SAMPLES BIT(22)
#define PMBUS_PHASE_VIRTUAL BIT(30)
#define PMBUS_PAGE_VIRTUAL BIT(31)
enum pmbus_data_format { linear = 0, direct, vid };
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
enum vrm_version { vr11 = 0, vr12, vr13, imvp9, amd625mv };
#else
enum vrm_version { vr11 = 0, vr12, vr13 };
#endif
struct pmbus_driver_info {
int pages; /* Total number of pages */
enum pmbus_data_format format[PSC_NUM_CLASSES];
enum vrm_version vrm_version[PMBUS_PAGES];
u8 phases[PMBUS_PAGES];/* Number of phases per page */
u32 pfunc[PMBUS_PHASES];/* Functionality, per phase */
/*
* Support one set of coefficients for each sensor type
* Used for chips providing data in direct mode.
@ -417,6 +466,7 @@ struct pmbus_driver_info {
/* Regulator functionality, if supported by this chip driver. */
int num_regulators;
const struct regulator_desc *reg_desc;
const struct attribute_group **groups;
};
/* Regulator ops */
@ -450,8 +500,12 @@ int pmbus_update_byte_data(struct i2c_client *client, int page, u8 reg,
void pmbus_clear_faults(struct i2c_client *client);
bool pmbus_check_byte_register(struct i2c_client *client, int page, int reg);
bool pmbus_check_word_register(struct i2c_client *client, int page, int reg);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info);
#else
int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id,
struct pmbus_driver_info *info);
#endif
int pmbus_do_remove(struct i2c_client *client);
const struct pmbus_driver_info *pmbus_get_driver_info(struct i2c_client
*client);

View File

@ -37,9 +37,6 @@ module_param(g_common_debug_verbose, int, S_IRUGO | S_IWUSR);
int dfd_get_my_card_type(void)
{
int type;
int cnt;
if (dfd_my_type != 0) {
RAGILE_COMMON_DEBUG_VERBOSE("my_type = 0x%x\r\n", dfd_my_type);
return dfd_my_type;

View File

@ -5,7 +5,7 @@ import click
import os
import time
import subprocess
from ragileconfig import GLOBALCONFIG, GLOBALINITPARAM, MAC_LED_RESET, STARTMODULE, i2ccheck_params
from ragileconfig import *
from ragileutil import rgpciwr, rgi2cset, io_wr
from sonic_py_common.general import getstatusoutput_noshell, getstatusoutput_noshell_pipe
@ -96,13 +96,6 @@ def starthal_ledctrl():
if len(rets) == 0:
subprocess.Popen(cmd)
def start_dev_monitor():
if STARTMODULE.get('dev_monitor',0) == 1:
cmd = ["dev_monitor.py", "start"]
rets = get_pid("dev_monitor.py")
if len(rets) == 0:
subprocess.Popen(cmd)
def start_slot_monitor():
if STARTMODULE.get('slot_monitor',0) == 1:
cmd = ["slot_monitor.py", "start"]
@ -127,16 +120,6 @@ def stophal_ledctrl():
subprocess.call(cmd)
return True
def stop_dev_monitor():
u'''disable the fan timer service'''
if STARTMODULE.get('dev_monitor',0) == 1:
rets = get_pid("dev_monitor.py") #
for ret in rets:
cmd = ["kill", ret]
subprocess.call(cmd)
return True
def stop_slot_monitor():
u'''disable slot timer service'''
if STARTMODULE.get('slot_monitor',0) == 1:
@ -259,7 +242,6 @@ def otherinit():
def unload_driver():
u'''remove devices and drivers'''
stop_dev_monitor() # disable removable device driver monitors
stop_fan_ctrl() # disable fan-control service
removedevs() # remove other devices
removedrivers() # remove drivers
@ -311,7 +293,6 @@ def load_driver():
starthal_ledctrl() # enable LED control
if STARTMODULE['avscontrol'] == 1:
start_avs_ctrl() # avs voltage-adjustment
start_dev_monitor() # enable removable device driver monitors
start_slot_monitor() # slot insertion and removal initialization monitor
otherinit(); # other initialization, QSFP initialization
if STARTMODULE.get("macledreset", 0) == 1:

View File

@ -0,0 +1 @@
ra-b6910-64c/scripts/pddf_post_driver_install.sh /usr/local/bin

View File

@ -0,0 +1,17 @@
#!/bin/sh
# postinst
kernel_version=$(uname -r)
if [ -e /boot/System.map-${kernel_version} ]; then
depmod -a -F /boot/System.map-${kernel_version} ${kernel_version} || true
fi
# enable platform-service
depmod -a
# systemctl enable platform-modules-ra-b6510-48v8c.service
# systemctl start platform-modules-ra-b6510-48v8c.service
systemctl enable pddf-platform-init.service
systemctl start pddf-platform-init.service
#DEBHELPER#

View File

@ -18,7 +18,7 @@ export INSTALL_MOD_DIR top_srcdir KVERSION KERNEL_SRC CC KBUILD_OUTPUT
include $(CUSTOM_RULES_DIR)/rule-ragile.mk
#all product need common
#all products need common
COMPILE_DIRS = $(MODULE_DIRS)
clean_dirs = $(MODULE_DIRS)
@ -64,7 +64,7 @@ $(COMPILE_DIRS): common_build
cp -r $(MOD_SRC_DIR)/$@/build/* debian/platform-modules-ragile-$@/
binary: binary-indep
@echo "======================================================="
@echo "======================================================"
binary-indep:
# Resuming debhelper scripts

View File

@ -8,6 +8,9 @@ INSTALL_SCRIPT_DIR = $(SUB_BUILD_DIR)/usr/local/bin
INSTALL_SERVICE_DIR = $(SUB_BUILD_DIR)/lib/systemd/system/
KBUILD_EXTRA_SYMBOLS += $(DIR_KERNEL_SRC)/Module.symvers
ifeq "5.10.0" "$(word 1, $(sort 5.10.0 $(KERNEL_VERSION)))"
KBUILD_EXTRA_SYMBOLS += $(PWD)/../../../pddf/i2c/Module.symvers.PDDF
endif
export KBUILD_EXTRA_SYMBOLS
all:

View File

@ -22,12 +22,13 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/hwmon-sysfs.h>
#include "pddf_led_defs.h"
#include "pddf_client_defs.h"
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/version.h>
#include <linux/i2c.h>
#include "../../../../../pddf/i2c/modules/include/pddf_led_defs.h"
#include "../../../../../pddf/i2c/modules/include/pddf_client_defs.h"
#define DEBUG 0
LED_OPS_DATA sys_led_ops_data[1]={0};
@ -48,11 +49,16 @@ LED_OPS_DATA* dev_list[LED_TYPE_MAX] = {
int num_psus = 0;
int num_fantrays = 0;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
extern int board_i2c_cpld_read_new(unsigned short cpld_addr, char *name, u8 reg);
extern int board_i2c_cpld_write_new(unsigned short cpld_addr, char *name, u8 reg, u8 value);
#else
extern int board_i2c_cpld_read(unsigned short cpld_addr, u8 reg);
extern int board_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value);
extern void *get_device_table(char *name);
#endif
extern ssize_t show_pddf_data(struct device *dev, struct device_attribute *da, char *buf);
extern ssize_t store_pddf_data(struct device *dev, struct device_attribute *da, const char *buf, size_t count);
extern void *get_device_table(char *name);
static LED_STATUS find_state_index(const char* state_str) {
int index;
@ -151,6 +157,7 @@ static void print_led_data(LED_OPS_DATA *ptr, LED_STATUS state)
}
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
int get_sys_val(LED_OPS_DATA *ops_ptr, uint32_t *sys_val)
{
int ret;
@ -181,11 +188,10 @@ int get_sys_val(LED_OPS_DATA *ops_ptr, uint32_t *sys_val)
*sys_val = (uint32_t)ret;
ret = 0;
}
return ret;
}
#endif
ssize_t get_status_led(struct device_attribute *da)
{
int ret=0;
@ -203,6 +209,7 @@ ssize_t get_status_led(struct device_attribute *da)
temp_data_ptr->device_name, temp_data_ptr->index);
return (-1);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
ret = get_sys_val(ops_ptr, &sys_val);
if (ret < 0) {
pddf_dbg(LED, KERN_ERR "ERROR %s: Cannot get sys val\n", __func__);
@ -210,7 +217,11 @@ ssize_t get_status_led(struct device_attribute *da)
}
/* keep ret as old value */
ret = 0;
#else
sys_val = board_i2c_cpld_read_new(ops_ptr->swpld_addr, ops_ptr->device_name, ops_ptr->swpld_addr_offset);
if (sys_val < 0)
return sys_val;
#endif
strcpy(temp_data.cur_state.color, "None");
for (state=0; state<MAX_LED_STATUS; state++) {
color_val = (sys_val & ~ops_ptr->data[state].bits.mask_bits);
@ -228,6 +239,7 @@ ssize_t get_status_led(struct device_attribute *da)
return(ret);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
int set_sys_val(LED_OPS_DATA *ops_ptr, uint32_t new_val)
{
int ret;
@ -257,6 +269,7 @@ int set_sys_val(LED_OPS_DATA *ops_ptr, uint32_t new_val)
return ret;
}
#endif
ssize_t set_status_led(struct device_attribute *da)
{
@ -288,12 +301,18 @@ ssize_t set_status_led(struct device_attribute *da)
}
if(ops_ptr->data[cur_state].swpld_addr != 0x0) {
ret = get_sys_val(ops_ptr, &sys_val);
if (ret < 0) {
pddf_dbg(LED, KERN_ERR "ERROR %s: Cannot get sys val\n", __func__);
return (-1);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
ret = get_sys_val(ops_ptr, &sys_val);
if (ret < 0) {
pddf_dbg(LED, KERN_ERR "ERROR %s: Cannot get sys val\n", __func__);
return (-1);
}
#else
sys_val = board_i2c_cpld_read_new(ops_ptr->swpld_addr, ops_ptr->device_name, ops_ptr->swpld_addr_offset);
if (sys_val < 0) {
return sys_val;
}
#endif
new_val = (sys_val & ops_ptr->data[cur_state].bits.mask_bits) |
(ops_ptr->data[cur_state].value << ops_ptr->data[cur_state].bits.pos);
@ -303,16 +322,24 @@ ssize_t set_status_led(struct device_attribute *da)
return (-1);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
ret = set_sys_val(ops_ptr, new_val);
if (ret < 0) {
pddf_dbg(LED, KERN_ERR "ERROR %s: Cannot set sys val\n", __func__);
return (-1);
}
#else
board_i2c_cpld_write_new(ops_ptr->swpld_addr, ops_ptr->device_name, ops_ptr->swpld_addr_offset, new_val);
#endif
pddf_dbg(LED, KERN_INFO "Set color:%s; 0x%x:0x%x sys_val:0x%x new_val:0x%x read:0x%x\n",
LED_STATUS_STR[cur_state],
ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset,
sys_val, new_val,
ret = board_i2c_cpld_read(ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset));
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
ret = board_i2c_cpld_read(ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset));
#else
ret = board_i2c_cpld_read_new(ops_ptr->swpld_addr, ops_ptr->device_name, ops_ptr->swpld_addr_offset));
#endif
if (ret < 0)
{
pddf_dbg(LED, KERN_ERR "PDDF_LED ERROR %s: Error %d in reading from cpld(0x%x) offset 0x%x\n", __FUNCTION__, ret, ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset);

View File

@ -0,0 +1,203 @@
#############################################################################
# PDDF
# Module contains an implementation of SONiC pddfapi Base API and
# provides the pddfpai information
#
#############################################################################
try:
from sonic_platform_pddf_base.pddfapi import PddfApi
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class newapi(PddfApi):
"""
PDDF Platform-Specific pddfapi Class
"""
def __init__(self):
PddfApi.__init__(self)
def show_attr_eeprom_device(self, dev, ops):
ret = []
attr_name = ops['attr']
attr_list = dev['i2c']['attr_list']
KEY = "eeprom"
dsysfs_path = ""
if KEY not in self.data_sysfs_obj:
self.data_sysfs_obj[KEY] = []
for attr in attr_list:
if attr_name == attr['attr_name'] or attr_name == 'all':
if 'drv_attr_name' in attr.keys():
real_name = attr['drv_attr_name']
else:
real_name = attr['attr_name']
dsysfs_path = self.show_device_sysfs(dev, ops) + \
"/%d-00%02x" % (int(dev['i2c']['topo_info']['parent_bus'], 0),
int(dev['i2c']['topo_info']['dev_addr'], 0)) + \
"/%s" % real_name
if dsysfs_path not in self.data_sysfs_obj[KEY]:
self.data_sysfs_obj[KEY].append(dsysfs_path)
ret.append(dsysfs_path)
return ret
def show_attr_psu_i2c_device(self, dev, ops):
target = ops['target']
attr_name = ops['attr']
ret = []
KEY = "psu"
dsysfs_path = ""
if KEY not in self.data_sysfs_obj:
self.data_sysfs_obj[KEY] = []
if target == 'all' or target == dev['dev_info']['virt_parent']:
attr_list = dev['i2c']['attr_list'] if 'i2c' in dev else []
for attr in attr_list:
if attr_name == attr['attr_name'] or attr_name == 'all':
if 'attr_devtype' in attr.keys() and attr['attr_devtype'] == "gpio":
# Check and enable the gpio from class
attr_path = self.get_gpio_attr_path(self.data[attr['attr_devname']], attr['attr_offset'])
if (os.path.exists(attr_path)):
if attr_path not in self.data_sysfs_obj[KEY]:
self.data_sysfs_obj[KEY].append(attr_path)
ret.append(attr_path)
else:
if 'drv_attr_name' in attr.keys():
real_name = attr['drv_attr_name']
real_dev = dev
elif 'attr_devattr' in attr.keys():
real_name = attr['attr_devattr']
real_devname = attr['attr_devname'] if 'attr_devname' in attr.keys() else ''
real_dev = self.data[real_devname]
else:
real_name = attr['attr_name']
real_dev = dev
dsysfs_path = self.show_device_sysfs(real_dev, ops) + \
"/%d-00%02x" % (int(real_dev['i2c']['topo_info']['parent_bus'], 0),
int(real_dev['i2c']['topo_info']['dev_addr'], 0)) + \
"/%s" % real_name
if dsysfs_path not in self.data_sysfs_obj[KEY]:
self.data_sysfs_obj[KEY].append(dsysfs_path)
ret.append(dsysfs_path)
return ret
def show_attr_fan_device(self, dev, ops):
ret = []
attr_name = ops['attr']
attr_list = dev['i2c']['attr_list'] if 'i2c' in dev else []
KEY = "fan"
dsysfs_path = ""
if KEY not in self.data_sysfs_obj:
self.data_sysfs_obj[KEY] = []
for attr in attr_list:
if attr_name == attr['attr_name'] or attr_name == 'all':
if 'attr_devtype' in attr.keys() and attr['attr_devtype'] == "gpio":
# Check and enable the gpio from class
attr_path = self.get_gpio_attr_path(self.data[attr['attr_devname']], attr['attr_offset'])
if (os.path.exists(attr_path)):
if attr_path not in self.data_sysfs_obj[KEY]:
self.data_sysfs_obj[KEY].append(attr_path)
ret.append(attr_path)
else:
if 'drv_attr_name' in attr.keys():
real_name = attr['drv_attr_name']
real_dev = dev
elif 'attr_devattr' in attr.keys():
real_name = attr['attr_devattr']
real_devname = attr['attr_devname'] if 'attr_devname' in attr.keys() else ''
real_dev = self.data[real_devname]
else:
real_name = attr['attr_name']
real_dev = dev
dsysfs_path = self.show_device_sysfs(real_dev, ops) + \
"/%d-00%02x" % (int(real_dev['i2c']['topo_info']['parent_bus'], 0),
int(real_dev['i2c']['topo_info']['dev_addr'], 0)) + \
"/%s" % real_name
if dsysfs_path not in self.data_sysfs_obj[KEY]:
self.data_sysfs_obj[KEY].append(dsysfs_path)
ret.append(dsysfs_path)
return ret
# This is only valid for LM75
def show_attr_temp_sensor_device(self, dev, ops):
ret = []
if 'i2c' not in dev.keys():
return ret
attr_name = ops['attr']
attr_list = dev['i2c']['attr_list'] if 'i2c' in dev else []
KEY = "temp-sensors"
dsysfs_path = ""
if KEY not in self.data_sysfs_obj:
self.data_sysfs_obj[KEY] = []
for attr in attr_list:
if attr_name == attr['attr_name'] or attr_name == 'all':
path = self.show_device_sysfs(dev, ops)+"/%d-00%02x/" % (int(dev['i2c']['topo_info']['parent_bus'], 0),
int(dev['i2c']['topo_info']['dev_addr'], 0))
if 'drv_attr_name' in attr.keys():
real_name = attr['drv_attr_name']
else:
real_name = attr['attr_name']
if (os.path.exists(path)):
full_path = glob.glob(path + 'hwmon/hwmon*/' + real_name)[0]
dsysfs_path = full_path
if dsysfs_path not in self.data_sysfs_obj[KEY]:
self.data_sysfs_obj[KEY].append(dsysfs_path)
ret.append(full_path)
return ret
def show_attr_xcvr_i2c_device(self, dev, ops):
target = ops['target']
attr_name = ops['attr']
ret = []
dsysfs_path = ""
KEY = "xcvr"
if KEY not in self.data_sysfs_obj:
self.data_sysfs_obj[KEY] = []
if target == 'all' or target == dev['dev_info']['virt_parent']:
attr_list = dev['i2c']['attr_list']
for attr in attr_list:
if attr_name == attr['attr_name'] or attr_name == 'all':
if 'attr_devtype' in attr.keys() and attr['attr_devtype'] == "gpio":
# Check and enable the gpio from class
attr_path = self.get_gpio_attr_path(self.data[attr['attr_devname']], attr['attr_offset'])
if (os.path.exists(attr_path)):
if attr_path not in self.data_sysfs_obj[KEY]:
self.data_sysfs_obj[KEY].append(attr_path)
ret.append(attr_path)
else:
if 'drv_attr_name' in attr.keys():
real_name = attr['drv_attr_name']
real_dev = dev
elif 'attr_devattr' in attr.keys():
real_name = attr['attr_devattr']
real_devname = attr['attr_devname'] if 'attr_devname' in attr.keys() else ''
real_dev = self.data[real_devname]
else:
real_name = attr['attr_name']
real_dev = dev
dsysfs_path = self.show_device_sysfs(real_dev, ops) + \
"/%d-00%02x" % (int(real_dev['i2c']['topo_info']['parent_bus'], 0),
int(real_dev['i2c']['topo_info']['dev_addr'], 0)) + \
"/%s" % real_name
if dsysfs_path not in self.data_sysfs_obj[KEY]:
self.data_sysfs_obj[KEY].append(dsysfs_path)
ret.append(dsysfs_path)
return ret

View File

@ -7,36 +7,49 @@
try:
import time
from sonic_platform_pddf_base.pddf_chassis import PddfChassis
from sonic_platform.fan_drawer import FanDrawer
from .component import Component
from sonic_platform.sfp import *
from .sfp_config import *
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
PORT_START = 0
PORTS_IN_BLOCK = 32
FAN_NUM_PER_DRAWER = 2
class Chassis(PddfChassis):
"""
PDDF Platform-specific Chassis class
"""
SFP_STATUS_INSERTED = "1"
SFP_STATUS_REMOVED = "0"
port_dict = {}
STATUS_INSERTED = "1"
STATUS_REMOVED = "0"
sfp_present_dict = {}
def __init__(self, pddf_data=None, pddf_plugin_data=None):
PddfChassis.__init__(self, pddf_data, pddf_plugin_data)
for i in range(0,5):
self._component_list.append(Component(i))
# fan drawer
temp = []
drawer_index = 0
for idx, fan in enumerate(self.get_all_fans()):
temp.append(fan)
if (idx + 1) % FAN_NUM_PER_DRAWER == 0:
drawer = FanDrawer(drawer_index + 1, temp)
self.get_all_fan_drawers().append(drawer)
temp = []
drawer_index += 1
try:
self._sfp_list = []
sfp_config = get_sfp_config()
self.port_start_index = sfp_config.get("port_index_start", 0)
self.port_num = sfp_config.get("port_num", 0)
# fix problem with first index is 1, we add a fake sfp node
if self.port_start_index == 1:
self._sfp_list.append(Sfp(1))
# sfp id always start at 1
for index in range(1, self.port_num + 1):
self._sfp_list.append(Sfp(index))
for i in range(self.port_start_index, self.port_start_index + self.port_num):
self.sfp_present_dict[i] = self.STATUS_REMOVED
except Exception as err:
print("SFP init error: %s" % str(err))
def get_revision(self):
val = ord(self._eeprom.revision_str())
test = "{}".format(val)
return test
def get_reboot_cause(self):
"""
@ -52,17 +65,9 @@ class Chassis(PddfChassis):
return (self.REBOOT_CAUSE_NON_HARDWARE, None)
def get_change_event(self, timeout=0):
change_event_dict = {"fan": {}, "sfp": {}}
sfp_status, sfp_change_dict = self.get_transceiver_change_event(timeout)
change_event_dict["sfp"] = sfp_change_dict
if sfp_status is True:
return True, change_event_dict
change_event_dict = {"sfp": {}}
return False, {}
def get_transceiver_change_event(self, timeout=0):
start_time = time.time()
currernt_port_dict = {}
forever = False
if timeout == 0:
@ -70,25 +75,23 @@ class Chassis(PddfChassis):
elif timeout > 0:
timeout = timeout / float(1000) # Convert to secs
else:
print("get_transceiver_change_event:Invalid timeout value", timeout)
return False, {}
print("get_change_event:Invalid timeout value", timeout)
return False, change_event_dict
end_time = start_time + timeout
if start_time > end_time:
print(
"get_transceiver_change_event:" "time wrap / invalid timeout value",
"get_change_event:" "time wrap / invalid timeout value",
timeout,
)
return False, {} # Time wrap or possibly incorrect timeout
while timeout >= 0:
# Check for OIR events and return updated port_dict
for index in range(PORT_START, PORTS_IN_BLOCK):
if self._sfp_list[index].get_presence():
currernt_port_dict[index] = self.SFP_STATUS_INSERTED
else:
currernt_port_dict[index] = self.SFP_STATUS_REMOVED
if currernt_port_dict == self.port_dict:
return False, change_event_dict # Time wrap or possibly incorrect timeout
try:
while timeout >= 0:
# check for sfp
sfp_change_dict = self.get_transceiver_change_event()
if sfp_change_dict :
change_event_dict["sfp"] = sfp_change_dict
return True, change_event_dict
if forever:
time.sleep(1)
else:
@ -98,11 +101,34 @@ class Chassis(PddfChassis):
else:
if timeout > 0:
time.sleep(timeout)
return True, {}
return True, change_event_dict
except Exception as e:
print(e)
print("get_change_event: Should not reach here.")
return False, change_event_dict
def get_transceiver_change_event(self):
cur_sfp_present_dict = {}
ret_dict = {}
# Check for OIR events and return ret_dict
for i in range(self.port_start_index, self.port_start_index + self.port_num):
sfp = self._sfp_list[i]
if sfp.get_presence():
cur_sfp_present_dict[i] = self.STATUS_INSERTED
else:
# Update reg value
self.port_dict = currernt_port_dict
print(self.port_dict)
return True, self.port_dict
print("get_transceiver_change_event: Should not reach here.")
return False, {}
cur_sfp_present_dict[i] = self.STATUS_REMOVED
# Update reg value
if cur_sfp_present_dict == self.sfp_present_dict:
return ret_dict
for index, status in cur_sfp_present_dict.items():
if self.sfp_present_dict[index] != status:
ret_dict[index] = status
self.sfp_present_dict = cur_sfp_present_dict
return ret_dict

View File

@ -9,22 +9,67 @@
try:
from sonic_platform_base.component_base import ComponentBase
from sonic_platform.regutil import Reg
from sonic_platform.logger import logger
import sonic_platform.hwaccess as hwaccess
from sonic_py_common.general import getstatusoutput_noshell
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
def get_cpld_version(bus, i2caddr):
return '{}{}{}{}'.format(hwaccess.i2c_get(bus, i2caddr, 1),
hwaccess.i2c_get(bus, i2caddr, 2),
hwaccess.i2c_get(bus, i2caddr, 3),
hwaccess.i2c_get(bus, i2caddr, 0)
)
def get_cpu_cpld_version():
return get_cpld_version(6, 0x0d)
def get_fan_cpld_version():
return get_cpld_version(2, 0x0d)
def get_cpld1_version():
return get_cpld_version(8, 0x30)
def get_cpld2_version():
return get_cpld_version(8, 0x31)
def get_fpga_version():
version = hwaccess.pci_get_value('/sys/bus/pci/devices/0000:08:00.0/resource0', 0)
datetime = hwaccess.pci_get_value('/sys/bus/pci/devices/0000:08:00.0/resource0',4)
return "%08x-%08x"%(version,datetime)
COMPONENT_LIST= [
['CPU CPLD',
'cpu board',
get_cpu_cpld_version
],
['CPU FAN CPLD',
'cpu fan',
get_fan_cpld_version
],
['MAC1 CPLD',
'mac1 board',
get_cpld1_version
],
['MAC2 CPLD',
'mac2 board',
get_cpld2_version
],
['FPGA',
'fpga version',
get_fpga_version
]
]
class Component(ComponentBase):
""" Ragile Platform-specific Component class"""
def __init__(self, index, config=None):
self.index = index
self.name = config.get("name")
self._reg_fm_ver = Reg(config.get("firmware_version"))
self.description = config.get("desc")
self.slot = config.get("slot")
def __init__(self, component_index=0):
ComponentBase.__init__(self)
self.index = component_index
def get_name(self):
"""
@ -33,7 +78,7 @@ class Component(ComponentBase):
Returns:
A string containing the name of the component
"""
return self.name
return COMPONENT_LIST[self.index][0]
def get_description(self):
"""
@ -42,7 +87,7 @@ class Component(ComponentBase):
Returns:
A string containing the description of the component
"""
return self.description
return COMPONENT_LIST[self.index][1]
def get_firmware_version(self):
"""
@ -51,12 +96,7 @@ class Component(ComponentBase):
Returns:
A string containing the firmware version of the component
"""
try:
return self._reg_fm_ver.decode()
except Exception as e:
logger.error(str(e))
return ""
return COMPONENT_LIST[self.index][2]()
def install_firmware(self, image_path):
"""

View File

@ -1,5 +1,6 @@
try:
from sonic_platform_pddf_base.pddf_fan import PddfFan
from . import api
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
@ -10,6 +11,7 @@ class Fan(PddfFan):
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)
self.pddf_obj = api.newapi()
# 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'

View File

@ -1,69 +1,17 @@
#
# fan_drawer
#
#!/usr/bin/env python
try:
from sonic_platform_base.fan_drawer_base import FanDrawerBase
from sonic_platform_pddf_base.pddf_fan_drawer import PddfFanDrawer
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class FanDrawer(FanDrawerBase):
# Device type definition. Note, this is a constant.
DEVICE_TYPE = "fan_drawer"
class FanDrawer(PddfFanDrawer):
"""PDDF Platform-Specific Fan-Drawer class"""
def __init__(self, index, fan_list):
FanDrawerBase.__init__(self)
self._fan_list = fan_list
self._index = index
def get_name(self):
"""
Retrieves the name of the device
Returns:
string: The name of the device
"""
return "fan drawer {}".format(self._index)
def get_num_fans(self):
"""
Retrieves the number of fans available on this fan drawer
Returns:
An integer, the number of fan modules available on this fan drawer
"""
return len(self._fan_list)
def get_all_fans(self):
"""
Retrieves all fan modules available on this fan drawer
Returns:
A list of objects derived from FanBase representing all fan
modules available on this fan drawer
"""
return self._fan_list
def set_status_led(self, color):
"""
Sets the state of the fan drawer status LED
Args:
color: A string representing the color with which to set the
fan drawer status LED
Returns:
bool: True if status LED state is set successfully, False if not
"""
if self.get_num_fans() > 0:
return self._fan_list[0].set_status_led(color)
return False
def get_status_led(self):
"""
Gets the state of the fan drawer LED
Returns:
A string, one of the predefined STATUS_LED_COLOR_* strings above
"""
if self.get_num_fans() > 0:
return self._fan_list[0].get_status_led()
return "N/A"
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

View File

@ -0,0 +1,47 @@
# Helper functions to access hardware
import os
import struct
import mmap
import subprocess
# Read PCI device
def pci_mem_read(mm, offset):
mm.seek(offset)
read_data_stream = mm.read(4)
return struct.unpack('I',read_data_stream)[0]
def pci_get_value(resource, offset):
with open(resource, 'r+b') as fd:
mm = mmap.mmap(fd.fileno(), 0)
val = pci_mem_read(mm, offset)
mm.close()
return val
def pci_mem_write(memmap, offset, data):
""" Write PCI device """
memmap.seek(offset)
memmap.write(struct.pack('I', data))
def pci_set_value(resource, val, offset):
""" Set a value to PCI device """
with open(resource, 'w+b') as filed:
memmap = None
try:
memmap = mmap.mmap(filed.fileno(), 0)
pci_mem_write(memmap, offset, val)
except EnvironmentError:
pass
if memmap is not None:
memmap.close()
# Read I2C device
def i2c_get(bus, i2caddr, ofs):
try:
valx = int(subprocess.check_output(['/usr/sbin/i2cget','-f', '-y', str(bus), str(i2caddr), str(ofs)]), 16)
return "{:02x}".format(valx)
except (FileNotFoundError, subprocess.CalledProcessError):
return -1

View File

@ -1,5 +1,7 @@
try:
from sonic_platform_pddf_base.pddf_psu import PddfPsu
from sonic_py_common.general import getstatusoutput_noshell
import time
except ImportError as e:
raise ImportError (str(e) + "- required module not found")
@ -29,4 +31,74 @@ class Psu(PddfPsu):
A string, the type of PSU (AC/DC)
"""
return "DC"
def runcmd(self, cmd):
time_retry = 6
result_msg = ""
time_delay = 0.01
while time_retry:
try:
val, result_msg = getstatusoutput_noshell(cmd.split(" "))
if val is False:
time_retry -=1
time.sleep(time_delay)
continue
else:
return val, result_msg
except Exception as e:
time_retry -= 1
result_msg = str(e)
time.sleep(time_delay)
return False, result_msg
def get_voltage(self):
"""
Retrieves current PSU voltage output
Returns:
A float number, the output voltage in volts,
e.g. 12.1
"""
v_out = 0
label_t = "psu_v_out"
device = "PSU{}".format(self.psu_index)
#print(device)
pddf_obj_data = self.pddf_obj.data
if device in pddf_obj_data.keys():
pmbusloc = pddf_obj_data[device]['i2c']['interface']
for val in pmbusloc:
dev_name = val['dev']
pmbus_loc = pddf_obj_data[dev_name]
i2cloc = pmbus_loc['i2c']['attr_list']
parentbus = pmbus_loc['i2c']['topo_info']
for item_t in i2cloc:
if item_t['attr_name'] == label_t:
parentbus_id = int(parentbus['parent_bus'], 16)
vout_mode_cmd = "i2cget -f -y {} {} 0x20 bp".format(parentbus_id, parentbus['dev_addr'])
ret_t, val_voutmode = self.runcmd(vout_mode_cmd)
if ret_t is False:
return 0.0
v_out_cmd = "i2cget -f -y {} {} {} wp".format(parentbus_id, parentbus['dev_addr'], item_t['attr_offset'])
ret_t, val_p_out = self.runcmd(v_out_cmd)
if ret_t is False:
return 0.0
val_voutmode_t = int(val_voutmode, 16)
val_p_out_t = int(val_p_out, 16) * 1000
import ctypes
val_voutmode_t_t = ctypes.c_int8(val_voutmode_t << 3).value >>3
if (val_voutmode_t_t) < 0:
val_p_out_t_f = val_p_out_t>> (-val_voutmode_t_t)
else:
val_p_out_t_f = val_p_out_t << val_voutmode_t_t
return float(val_p_out_t_f)/1000
return float(v_out)/1000

View File

@ -1,287 +1,525 @@
#!/usr/bin/env python
#!/usr/bin/python
# -*- coding: UTF-8 -*-
#############################################################################
#
# Module contains an implementation of SONiC Platform Base API and
# provides the platform information
#
#
# *_device.py config version instruction:
# ver 1.0 - platform api:
# "presence_cpld": {
# "dev_id": {
# [dev_id]: {
# "offset": {
# [offset]: [port_id]
# }
# }
# }
# }
# "reset_cpld": {
# "dev_id": {
# [dev_id]: {
# "offset": {
# [offset]: [port_id]
# }
# }
# }
# }
# ver 2.0 - rg_plat:
# "presence_path": "/xx/rg_plat/xx[port_id]/present"
# "eeprom_path": "/sys/bus/i2c/devices/i2c-[bus]/[bus]-0050/eeprom"
# "reset_path": "/xx/rg_plat/xx[port_id]/reset"
#############################################################################
import sys
import time
import syslog
import traceback
from abc import abstractmethod
try:
#from sonic_platform_pddf_base.pddf_sfp import *
from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId
from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom
from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId
from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom
from sonic_platform_pddf_base.pddf_sfp import PddfSfp
from sonic_platform_pddf_base.pddf_sfp import SFP_VOLT_OFFSET
from sonic_platform_pddf_base.pddf_sfp import SFP_VOLT_WIDTH
from sonic_platform_pddf_base.pddf_sfp import SFP_CHANNL_MON_OFFSET
from sonic_platform_pddf_base.pddf_sfp import SFP_CHANNL_MON_WIDTH
from sonic_platform_pddf_base.pddf_sfp import SFP_TEMPE_OFFSET
from sonic_platform_pddf_base.pddf_sfp import SFP_TEMPE_WIDTH
from sonic_platform_pddf_base.pddf_sfp import QSFP_DOM_REV_OFFSET
from sonic_platform_pddf_base.pddf_sfp import QSFP_DOM_REV_WIDTH
from sonic_platform_pddf_base.pddf_sfp import QSFP_CHANNL_MON_OFFSET
from sonic_platform_pddf_base.pddf_sfp import QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH
import os
from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase
from .sfp_config import *
except ImportError as e:
raise ImportError (str(e) + "- required module not found")
XCVR_DOM_CAPABILITY_OFFSET = 92
XCVR_DOM_CAPABILITY_WIDTH = 2
QSFP_VERSION_COMPLIANCE_OFFSET = 1
QSFP_VERSION_COMPLIANCE_WIDTH = 2
QSFP_OPTION_VALUE_OFFSET = 192
QSFP_OPTION_VALUE_WIDTH = 4
LOG_DEBUG_LEVEL = 1
LOG_WARNING_LEVEL = 2
LOG_ERROR_LEVEL = 3
class Sfp(PddfSfp):
"""
PDDF Platform-Specific Sfp class
"""
CONFIG_DB_PATH = "/etc/sonic/config_db.json"
def __init__(self, index, pddf_data=None, pddf_plugin_data=None):
PddfSfp.__init__(self, index, pddf_data, pddf_plugin_data)
self.dom_supported = False
self.__dom_capability_detect()
def getonieplatform(path):
if not os.path.isfile(path):
return ""
machine_vars = {}
with open(path) as machine_file:
for line in machine_file:
tokens = line.split('=')
if len(tokens) < 2:
continue
machine_vars[tokens[0]] = tokens[1].strip()
return machine_vars.get("onie_platform")
def __dom_capability_detect(self):
self.dom_supported = False
self.dom_temp_supported = False
self.dom_volt_supported = False
self.dom_rx_power_supported = False
self.dom_tx_power_supported = False
self.qsfp_page3_available = False
self.calibration = 0
if not self.get_presence():
return
def getplatform_config_db():
if not os.path.isfile(CONFIG_DB_PATH):
return ""
val = os.popen("sonic-cfggen -j %s -v DEVICE_METADATA.localhost.platform" % CONFIG_DB_PATH).read().strip()
if len(val) <= 0:
return ""
else:
return val
if self.is_osfp_port:
# Not implement
return
elif self.is_qsfp_port:
self.calibration = 1
sfpi_obj = sff8436InterfaceId()
if sfpi_obj is None:
self.dom_supported = False
offset = 128
def getplatform_name():
if os.path.isfile('/host/machine.conf'):
return getonieplatform('/host/machine.conf')
elif os.path.isfile('/usr/share/sonic/hwsku/machine.conf'):
return getonieplatform('/usr/share/sonic/hwsku/machine.conf')
else:
return getplatform_config_db()
# 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_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH)
if qsfp_dom_capability_raw is not None:
qsfp_version_compliance_raw = self.__read_eeprom_specific_bytes(
QSFP_VERSION_COMPLIANCE_OFFSET, QSFP_VERSION_COMPLIANCE_WIDTH)
qsfp_version_compliance = int(
qsfp_version_compliance_raw[0], 16)
dom_capability = sfpi_obj.parse_dom_capability(
qsfp_dom_capability_raw, 0)
if qsfp_version_compliance >= 0x08:
self.dom_temp_supported = dom_capability['data']['Temp_support']['value'] == 'On'
self.dom_volt_supported = dom_capability['data']['Voltage_support']['value'] == 'On'
self.dom_rx_power_supported = dom_capability['data']['Rx_power_support']['value'] == 'On'
self.dom_tx_power_supported = dom_capability['data']['Tx_power_support']['value'] == 'On'
else:
self.dom_temp_supported = True
self.dom_volt_supported = True
self.dom_rx_power_supported = dom_capability['data']['Rx_power_support']['value'] == 'On'
self.dom_tx_power_supported = True
def get_sfp_config():
dev = getplatform_name()
return cust_sfp_cfg.get(dev, None)
self.dom_supported = True
self.calibration = 1
sfpd_obj = sff8436Dom()
if sfpd_obj is None:
return None
qsfp_option_value_raw = self.__read_eeprom_specific_bytes(
QSFP_OPTION_VALUE_OFFSET, QSFP_OPTION_VALUE_WIDTH)
if qsfp_option_value_raw is not None:
optional_capability = sfpd_obj.parse_option_params(
qsfp_option_value_raw, 0)
self.dom_tx_disable_supported = optional_capability[
'data']['TxDisable']['value'] == 'On'
dom_status_indicator = sfpd_obj.parse_dom_status_indicator(
qsfp_version_compliance_raw, 1)
self.qsfp_page3_available = dom_status_indicator['data']['FlatMem']['value'] == 'Off'
else:
self.dom_supported = False
self.dom_temp_supported = False
self.dom_volt_supported = False
self.dom_rx_power_supported = False
self.dom_tx_power_supported = False
self.calibration = 0
self.qsfp_page3_available = False
class Sfp(SfpOptoeBase):
OPTOE_DRV_TYPE1 = 1
OPTOE_DRV_TYPE2 = 2
OPTOE_DRV_TYPE3 = 3
# index must start at 1
def __init__(self, index, a=None, b=None):
SfpOptoeBase.__init__(self)
self.sfp_type = None
sfp_config = get_sfp_config()
self.log_level_config = sfp_config.get("log_level", LOG_WARNING_LEVEL)
# Init instance of SfpCust
ver = sfp_config.get("ver", None)
if ver is None:
self._sfplog(LOG_ERROR_LEVEL, "Get Ver Config Error!")
vers = int(float(ver))
if vers == 1:
self._sfp_api = SfpV1(index)
elif vers == 2:
self._sfp_api = SfpV2(index)
else:
sfpi_obj = sff8472InterfaceId()
if sfpi_obj is None:
return None
sfp_dom_capability_raw = self.__read_eeprom_specific_bytes(
XCVR_DOM_CAPABILITY_OFFSET, XCVR_DOM_CAPABILITY_WIDTH)
if sfp_dom_capability_raw is not None:
sfp_dom_capability = int(sfp_dom_capability_raw[0], 16)
self.dom_supported = (sfp_dom_capability & 0x40 != 0)
if self.dom_supported:
self.dom_temp_supported = True
self.dom_volt_supported = True
self.dom_rx_power_supported = True
self.dom_tx_power_supported = True
if sfp_dom_capability & 0x20 != 0:
self.calibration = 1
elif sfp_dom_capability & 0x10 != 0:
self.calibration = 2
self._sfplog(LOG_ERROR_LEVEL, "Get SfpVer Error!")
def get_eeprom_path(self):
return self._sfp_api._get_eeprom_path()
def read_eeprom(self, offset, num_bytes):
return self._sfp_api.read_eeprom(offset, num_bytes)
def write_eeprom(self, offset, num_bytes, write_buffer):
return self._sfp_api.write_eeprom(offset, num_bytes, write_buffer)
def get_presence(self):
return self._sfp_api.get_presence()
def get_transceiver_info(self):
# temporary solution for a sonic202111 bug
transceiver_info = super().get_transceiver_info()
try:
if transceiver_info["vendor_rev"] is not None:
transceiver_info["hardware_rev"] = transceiver_info["vendor_rev"]
return transceiver_info
except Exception as e:
print(traceback.format_exc())
def reset(self):
if self.get_presence() is False:
return False
if self.sfp_type is None:
self.refresh_xcvr_api()
if self.sfp_type == 'SFP':
self._sfplog(LOG_ERROR_LEVEL, 'SFP does not support reset')
return False
self._sfplog(LOG_DEBUG_LEVEL, 'resetting...')
ret = self._sfp_api.set_reset(True)
if ret:
time.sleep(0.5)
ret = self._sfp_api.set_reset(False)
return ret
def get_lpmode(self):
if self.get_presence() is False:
return False
if self.sfp_type is None:
self.refresh_xcvr_api()
if self.sfp_type == 'SFP':
self._sfplog(LOG_WARNING_LEVEL, 'SFP does not support lpmode')
return False
#implement in future
return False
def set_lpmode(self, lpmode):
if self.get_presence() is False:
return False
if self.sfp_type is None or self._xcvr_api is None:
self.refresh_xcvr_api()
if self.sfp_type == 'QSFP-DD':
return SfpOptoeBase.set_lpmode(self, lpmode)
elif self.sfp_type == 'QSFP':
if lpmode:
return self._xcvr_api.set_power_override(True, lpmode)
else:
return self._xcvr_api.set_power_override(False, lpmode)
else:
self._sfplog(LOG_WARNING_LEVEL, 'SFP does not support lpmode')
return False
def set_optoe_write_max(self, write_max):
"""
This func is declared and implemented by SONiC but we're not supported
so override it as NotImplemented
"""
self._sfplog(LOG_DEBUG_LEVEL, "set_optoe_write_max NotImplemented")
pass
def refresh_xcvr_api(self):
"""
Updates the XcvrApi associated with this SFP
"""
self._xcvr_api = self._xcvr_api_factory.create_xcvr_api()
class_name = self._xcvr_api.__class__.__name__
optoe_type = None
# set sfp_type
if (class_name == 'CmisApi'):
self.sfp_type = 'QSFP-DD'
optoe_type = self.OPTOE_DRV_TYPE3
elif (class_name == 'Sff8472Api'):
self.sfp_type = 'SFP'
optoe_type = self.OPTOE_DRV_TYPE2
elif (class_name == 'Sff8636Api' or class_name == 'Sff8436Api'):
self.sfp_type = 'QSFP'
optoe_type = self.OPTOE_DRV_TYPE1
if optoe_type is not None:
# set optoe driver
self._sfp_api.set_optoe_type(optoe_type)
def _sfplog(self, log_level, msg):
if log_level >= self.log_level_config:
try:
syslog.openlog("Sfp")
if log_level == LOG_DEBUG_LEVEL:
syslog.syslog(syslog.LOG_DEBUG, msg)
elif log_level == LOG_WARNING_LEVEL:
syslog.syslog(syslog.LOG_DEBUG, msg)
elif log_level == LOG_ERROR_LEVEL:
syslog.syslog(syslog.LOG_ERR, msg)
syslog.closelog()
except Exception as e:
print(traceback.format_exc())
class SfpCust():
def __init__(self, index):
self.eeprom_path = None
self._init_config(index)
def _init_config(self, index):
sfp_config = get_sfp_config()
self.log_level_config = sfp_config.get("log_level", LOG_WARNING_LEVEL)
self._port_id = index
self.eeprom_retry_times = sfp_config.get("eeprom_retry_times", 0)
self.eeprom_retry_break_sec = sfp_config.get("eeprom_retry_break_sec", 0)
def combine_format_str(self, str, key):
count_format = str.count('%')
if count_format > 0:
args_k = []
for i in range(count_format):
args_k.append(key)
return str % (tuple(args_k))
else:
return str
def _get_eeprom_path(self):
return self.eeprom_path or None
@abstractmethod
def get_presence(self):
pass
def read_eeprom(self, offset, num_bytes):
try:
for i in range(self.eeprom_retry_times):
with open(self._get_eeprom_path(), mode='rb', buffering=0) as f:
f.seek(offset)
result = f.read(num_bytes)
# temporary solution for a sonic202111 bug
if len(result) < num_bytes:
result = result[::-1].zfill(num_bytes)[::-1]
if result != None:
return bytearray(result)
else:
self.calibration = 0
else:
self.dom_temp_supported = False
self.dom_volt_supported = False
self.dom_rx_power_supported = False
self.dom_tx_power_supported = False
self.calibration = 0
self.dom_tx_disable_supported = (
int(sfp_dom_capability_raw[1], 16) & 0x40 != 0)
time.sleep(self.eeprom_retry_break_sec)
continue
# Provide the functions/variables below for which implementation is to be overwritten
def __read_eeprom_specific_bytes(self, offset, num_bytes):
eeprom_raw = []
if not self.get_presence():
return None
for i in range(0, num_bytes):
eeprom_raw.append("0x00")
try:
with open(self.eeprom_path, mode="rb", buffering=0) as eeprom:
eeprom.seek(offset)
raw = eeprom.read(num_bytes)
except Exception as e:
print("Error: Unable to open eeprom_path: %s" % (str(e)))
return None
self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc())
return None
def write_eeprom(self, offset, num_bytes, write_buffer):
try:
if len(raw) == 0:
return None
for n in range(0, num_bytes):
eeprom_raw[n] = hex(raw[n])[2:].zfill(2)
for i in range(self.eeprom_retry_times):
ret = SfpOptoeBase.write_eeprom(self, offset, num_bytes, write_buffer)
if ret is False:
time.sleep(self.eeprom_retry_break_sec)
continue
break
return ret
except Exception as e:
print("Error: Exception info: %s" % (str(e)))
return None
self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc())
return eeprom_raw
def get_transceiver_bulk_status(self):
# check present status
if not self.get_presence():
return None
self.__dom_capability_detect()
@abstractmethod
def set_optoe_type(self, class_name):
pass
xcvr_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A')
@abstractmethod
def set_reset(self, reset):
pass
if self.is_osfp_port:
# Below part is added to avoid fail xcvrd, shall be implemented later
pass
elif self.is_qsfp_port:
# QSFPs
xcvr_dom_info_dict = super(Sfp, self).get_transceiver_bulk_status()
def _convert_str_range_to_int_arr(self, range_str):
if not range_str:
return []
# pddf_sfp "qsfp_tx_power_support != 'on'" is wrong
offset = 0
sfpd_obj = sff8436Dom()
if sfpd_obj is None:
return None
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)
int_range_strs = range_str.split(',')
range_res = []
for int_range_str in int_range_strs:
if '-' in int_range_str:
range_s = int(int_range_str.split('-')[0])
range_e = int(int_range_str.split('-')[1]) + 1
else:
return None
range_s = int(int_range_str)
range_e = int(int_range_str) + 1
dom_channel_monitor_data = {}
qsfp_dom_rev = qsfp_dom_rev_data['data']['dom_rev']['value']
range_res = range_res + list(range(range_s, range_e))
if (qsfp_dom_rev[0:8] == 'SFF-8636' and self.dom_tx_power_supported is True):
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)
return range_res
def _sfplog(self, log_level, msg):
if log_level >= self.log_level_config:
try:
syslog.openlog("SfpCust")
if log_level == LOG_DEBUG_LEVEL:
syslog.syslog(syslog.LOG_DEBUG, msg)
elif log_level == LOG_WARNING_LEVEL:
syslog.syslog(syslog.LOG_DEBUG, msg)
elif log_level == LOG_ERROR_LEVEL:
syslog.syslog(syslog.LOG_ERR, msg)
syslog.closelog()
except Exception as e:
print(traceback.format_exc())
class SfpV1(SfpCust):
def _init_config(self, index):
super()._init_config(index)
sfp_config = get_sfp_config()
# init presence path
self.presence_cpld = sfp_config.get("presence_cpld", None)
self.presence_val_is_present = sfp_config.get("presence_val_is_present", 0)
self._sfplog(LOG_DEBUG_LEVEL, "Done init presence path")
# init reset path
self.reset_cpld = sfp_config.get("reset_cpld", None)
self.reset_val_is_reset = sfp_config.get("reset_val_is_reset", 0)
self._sfplog(LOG_DEBUG_LEVEL, "Done init cpld path")
def get_presence(self):
if self.presence_cpld is None:
self._sfplog(LOG_ERROR_LEVEL, "presence_cpld is None!")
return False
try:
dev_id, offset, offset_bit = self._get_sfp_cpld_info(self.presence_cpld)
ret, info = platform_reg_read(0, dev_id, offset, 1)
return (info[0] & (1 << offset_bit) == self.presence_val_is_present)
except Exception as err:
self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc())
def read_eeprom(self, offset, num_bytes):
try:
for i in range(self.eeprom_retry_times):
ret, info = platform_sfp_read(self._port_id, offset, num_bytes)
if (ret is False
or info is None):
time.sleep(self.eeprom_retry_break_sec)
continue
eeprom_raw = []
for i in range(0, num_bytes):
eeprom_raw.append("0x00")
for n in range(0, len(info)):
eeprom_raw[n] = info[n]
# temporary solution for a sonic202111 bug
if len(eeprom_raw) < num_bytes:
eeprom_raw = eeprom_raw[::-1].zfill(num_bytes)[::-1]
return bytearray(eeprom_raw)
except Exception as e:
self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc())
return None
def write_eeprom(self, offset, num_bytes, write_buffer):
try:
for i in range(self.eeprom_retry_times):
# TODO: write_buffer is bytearray, need to convert to int array
val_list = []
if isinstance(write_buffer, list):
val_list = write_buffer
else:
return None
val_list.append(write_buffer)
ret, info = platform_sfp_write(self._port_id, offset, val_list)
if ret is False:
time.sleep(self.eeprom_retry_break_sec)
continue
return True
except Exception as e:
self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc())
xcvr_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TX1Power']['value']
xcvr_dom_info_dict['tx2power'] = dom_channel_monitor_data['data']['TX2Power']['value']
xcvr_dom_info_dict['tx3power'] = dom_channel_monitor_data['data']['TX3Power']['value']
xcvr_dom_info_dict['tx4power'] = dom_channel_monitor_data['data']['TX4Power']['value']
else:
# SFPs
offset = 256
if not self.dom_supported:
return xcvr_dom_info_dict
return False
sfpd_obj = sff8472Dom()
if sfpd_obj is None:
return None
def set_optoe_type(self, optoe_type):
ret, info = platform_get_optoe_type(self._port_id)
if info != optoe_type:
try:
ret, _ = platform_set_optoe_type(self._port_id, optoe_type)
except Exception as err:
self._sfplog(LOG_ERROR_LEVEL, "Set optoe err %s" % err)
sfpd_obj._calibration_type = self.calibration
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)
def set_reset(self, reset):
if self.reset_cpld is None:
self._sfplog(LOG_ERROR_LEVEL, "reset_cpld is None!")
return False
try:
val = []
dev_id, offset, offset_bit = self._get_sfp_cpld_info(self.reset_cpld)
ret, info = platform_reg_read(0, dev_id, offset, 1)
if self.reset_val_is_reset == 0:
if reset:
val.append(info[0] & (~(1 << offset_bit)))
else:
val.append(info[0] | (1 << offset_bit))
else:
return None
if reset:
val.append(info[0] | (1 << offset_bit))
else:
val.append(info[0] & (~(1 << offset_bit)))
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)
else:
return None
ret, info = platform_reg_write(0, dev_id, offset, val)
if ret is False:
self._sfplog(LOG_ERROR_LEVEL, "platform_reg_write error!")
return False
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_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_channel_monitor_raw, 0)
else:
return None
except Exception as err:
self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc())
return False
xcvr_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value']
xcvr_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value']
xcvr_dom_info_dict['rx1power'] = dom_channel_monitor_data['data']['RXPower']['value']
xcvr_dom_info_dict['rx2power'] = 'N/A'
xcvr_dom_info_dict['rx3power'] = 'N/A'
xcvr_dom_info_dict['rx4power'] = 'N/A'
xcvr_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TXBias']['value']
xcvr_dom_info_dict['tx2bias'] = 'N/A'
xcvr_dom_info_dict['tx3bias'] = 'N/A'
xcvr_dom_info_dict['tx4bias'] = 'N/A'
xcvr_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TXPower']['value']
xcvr_dom_info_dict['tx2power'] = 'N/A'
xcvr_dom_info_dict['tx3power'] = 'N/A'
xcvr_dom_info_dict['tx4power'] = 'N/A'
return True
xcvr_dom_info_dict['rx_los'] = self.get_rx_los()
xcvr_dom_info_dict['tx_fault'] = self.get_tx_fault()
xcvr_dom_info_dict['reset_status'] = self.get_reset_status()
xcvr_dom_info_dict['lp_mode'] = self.get_lpmode()
def _get_sfp_cpld_info(self, cpld_config):
dev_id = 0
offset = 0
return xcvr_dom_info_dict
for dev_id_temp in cpld_config["dev_id"]:
for offset_temp in cpld_config["dev_id"][dev_id_temp]["offset"]:
port_range_str = cpld_config["dev_id"][dev_id_temp]["offset"][offset_temp]
port_range_int = self._convert_str_range_to_int_arr(port_range_str)
if self._port_id in port_range_int:
dev_id = dev_id_temp
offset = offset_temp
offset_bit = port_range_int.index(self._port_id)
break
def get_transceiver_threshold_info(self):
# check present status
if not self.get_presence():
return None
self.__dom_capability_detect()
return dev_id, offset, offset_bit
xcvr_dom_threshold_info_dict = dict.fromkeys(self.threshold_dict_keys, 'N/A')
class SfpV2(SfpCust):
def _init_config(self, index):
super()._init_config(index)
sfp_config = get_sfp_config()
if self.is_osfp_port:
# Below part is added to avoid fail xcvrd, shall be implemented later
pass
elif self.is_qsfp_port:
# QSFPs
if not self.dom_supported or not self.qsfp_page3_available:
return xcvr_dom_threshold_info_dict
# init eeprom path
eeprom_path_config = sfp_config.get("eeprom_path", None)
eeprom_path_key = sfp_config.get("eeprom_path_key")[self._port_id - 1]
self.eeprom_path = self.combine_format_str(eeprom_path_config, eeprom_path_key)
self._sfplog(LOG_DEBUG_LEVEL, "Done init eeprom path: %s" % self.eeprom_path)
return super(Sfp, self).get_transceiver_threshold_info()
# init presence path
presence_path_config = sfp_config.get("presence_path", None)
presence_path_key = sfp_config.get("presence_path_key")[self._port_id - 1]
self.presence_path = self.combine_format_str(presence_path_config, presence_path_key)
self.presence_val_is_present = sfp_config.get("presence_val_is_present", 0)
self._sfplog(LOG_DEBUG_LEVEL, "Done init presence path: %s" % self.presence_path)
else:
# SFPs
if not self.dom_supported:
return xcvr_dom_threshold_info_dict
# init optoe driver path
optoe_driver_path_config = sfp_config.get("optoe_driver_path", None)
optoe_driver_key = sfp_config.get("optoe_driver_key")[self._port_id - 1]
self.dev_class_path = self.combine_format_str(optoe_driver_path_config, optoe_driver_key)
self._sfplog(LOG_DEBUG_LEVEL, "Done init optoe driver path: %s" % self.dev_class_path)
return super(Sfp, self).get_transceiver_threshold_info()
# init txdisable path
txdisable_path_config = sfp_config.get("txdisable_path", None)
if txdisable_path_config is not None:
txdisable_path_key = sfp_config.get("txdisable_path_key")[self._port_id - 1]
self.txdisable_path = self.combine_format_str(txdisable_path_config, txdisable_path_key)
self.txdisable_val_is_on = sfp_config.get("txdisable_val_is_on", 0)
self._sfplog(LOG_DEBUG_LEVEL, "Done init optoe driver path: %s" % self.dev_class_path)
return xcvr_dom_threshold_info_dict
# init reset path
reset_path_config = sfp_config.get("reset_path", None)
if reset_path_config is not None:
reset_path_key = sfp_config.get("reset_path_key")[self._port_id - 1]
self.reset_path = self.combine_format_str(reset_path_config, reset_path_key)
self.reset_val_is_on = sfp_config.get("reset_val_is_on", 0)
self._sfplog(LOG_DEBUG_LEVEL, "Done init reset path: %s" % self.reset_path)
def get_presence(self):
if self.presence_path is None:
self._sfplog(LOG_ERROR_LEVEL, "presence_path is None!")
return False
try:
with open(self.presence_path, "rb") as data:
sysfs_data = data.read(1)
if sysfs_data != "":
result = int(sysfs_data, 16)
return result == self.presence_val_is_present
except Exception as err:
self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc())
def set_reset(self, reset):
return True
def set_optoe_type(self, optoe_type):
if self.dev_class_path is None:
self._sfplog(LOG_ERROR_LEVEL, "dev_class_path is None!")
return False
try:
dc_file = open(self.dev_class_path, "r+")
dc_file_val = dc_file.read(1)
if int(dc_file_val) != optoe_type:
dc_str = "%s" % str(optoe_type)
dc_file.write(dc_str)
dc_file.close()
except Exception as err:
self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc())

View File

@ -0,0 +1,23 @@
cust_sfp_cfg = {
'x86_64-ragile_ra-b6510-32c-r0': {
"ver": '2.1',
"port_index_start": 0,
"port_num": 32,
"log_level": 2,
"eeprom_retry_times": 5,
"eeprom_retry_break_sec": 0.2,
"presence_path": "/sys/bus/i2c/devices/%d-0053/xcvr_present",
"presence_path_key": list(range(32, 64)),
"presence_val_is_present": 1,
"eeprom_path": "/sys/bus/i2c/devices/%d-0050/eeprom",
"eeprom_path_key": list(range(32, 64)),
"optoe_driver_path": "/sys/bus/i2c/devices/%d-0050/dev_class",
"optoe_driver_key": list(range(32, 64)),
"txdisable_path": "/sys/bus/i2c/devices/%d-0053/xcvr_txdisable",
"txdisable_path_key": list(range(32, 64)) ,
"txdisable_val_is_on": 0,
"reset_path": "/sys/bus/i2c/devices/%d-0053/xcvr_reset",
"reset_path_key": list(range(32, 64)),
"reset_val_is_on": 0,
},
}

View File

@ -8,7 +8,7 @@ except ImportError as e:
class Thermal(PddfThermal):
"""PDDF Platform-Specific Thermal class"""
def __init__(self, index, pddf_data=None, pddf_plugin_data=None):
PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data)
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)
# Provide the functions/variables below for which implementation is to be overwritten

View File

@ -8,6 +8,9 @@ INSTALL_SCRIPT_DIR = $(SUB_BUILD_DIR)/usr/local/bin
INSTALL_SERVICE_DIR = $(SUB_BUILD_DIR)/lib/systemd/system/
KBUILD_EXTRA_SYMBOLS += $(DIR_KERNEL_SRC)/Module.symvers
ifeq "5.10.0" "$(word 1, $(sort 5.10.0 $(KERNEL_VERSION)))"
KBUILD_EXTRA_SYMBOLS += $(PWD)/../../../pddf/i2c/Module.symvers.PDDF
endif
export KBUILD_EXTRA_SYMBOLS
all:

View File

@ -7,37 +7,49 @@
try:
import time
from sonic_platform_pddf_base.pddf_chassis import PddfChassis
from rgutil.logutil import Logger
from sonic_py_common.general import getstatusoutput_noshell
from .component import Component
from sonic_platform.sfp import *
from .sfp_config import *
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
PORT_START = 0
PORT_END = 55
PORTS_IN_BLOCK = 56
logger = Logger("CHASSIS", syslog=True)
class Chassis(PddfChassis):
"""
PDDF Platform-specific Chassis class
"""
SFP_STATUS_INSERTED = "1"
SFP_STATUS_REMOVED = "0"
port_dict = {}
STATUS_INSERTED = "1"
STATUS_REMOVED = "0"
sfp_present_dict = {}
def __init__(self, pddf_data=None, pddf_plugin_data=None):
PddfChassis.__init__(self, pddf_data, pddf_plugin_data)
for i in range(0,3):
self._component_list.append(Component(i))
self.enable_read = ["i2cset", "-f", "-y", "2", "0x35", "0x2a", "0x01"]
self.disable_read = ["i2cset", "-f", "-y", "2", "0x35", "0x2a", "0x00"]
self.enable_write = ["i2cset", "-f", "-y", "2", "0x35", "0x2b", "0x00"]
self.disable_write = ["i2cset", "-f", "-y", "2", "0x35", "0x2b", "0x01"]
self.enable_erase = ["i2cset", "-f", "-y", "2", "0x35", "0x2c", "0x01"]
self.disable_erase = ["i2cset", "-f", "-y", "2", "0x35", "0x2c", "0x00"]
self.read_value = ["i2cget", "-f", "-y", "2", "0x35", "0x25"]
self.write_value = ["i2cset", "-f", "-y", "2", "0x35", "0x21", "0x0a"]
try:
self._sfp_list = []
sfp_config = get_sfp_config()
self.port_start_index = sfp_config.get("port_index_start", 0)
self.port_num = sfp_config.get("port_num", 0)
# fix problem with first index is 1, we add a fake sfp node
if self.port_start_index == 1:
self._sfp_list.append(Sfp(1))
# sfp id always start at 1
for index in range(1, self.port_num + 1):
self._sfp_list.append(Sfp(index))
for i in range(self.port_start_index, self.port_start_index + self.port_num):
self.sfp_present_dict[i] = self.STATUS_REMOVED
except Exception as err:
print("SFP init error: %s" % str(err))
def get_revision(self):
val = ord(self._eeprom.revision_str())
test = "{}".format(val)
return test
def get_reboot_cause(self):
"""
@ -49,47 +61,13 @@ class Chassis(PddfChassis):
is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used
to pass a description of the reboot cause.
"""
try:
is_power_loss = False
# enable read
getstatusoutput_noshell(self.disable_write)
getstatusoutput_noshell(self.enable_read)
ret, log = getstatusoutput_noshell(self.read_value)
if ret == 0 and "0x0a" in log:
is_power_loss = True
# erase i2c and e2
getstatusoutput_noshell(self.enable_erase)
time.sleep(1)
getstatusoutput_noshell(self.disable_erase)
# clear data
getstatusoutput_noshell(self.enable_write)
getstatusoutput_noshell(self.disable_read)
getstatusoutput_noshell(self.disable_write)
getstatusoutput_noshell(self.enable_read)
# enable write and set data
getstatusoutput_noshell(self.enable_write)
getstatusoutput_noshell(self.disable_read)
getstatusoutput_noshell(self.write_value)
if is_power_loss:
return(self.REBOOT_CAUSE_POWER_LOSS, None)
except Exception as e:
logger.error(str(e))
return (self.REBOOT_CAUSE_NON_HARDWARE, None)
def get_change_event(self, timeout=0):
change_event_dict = {"fan": {}, "sfp": {}}
sfp_status, sfp_change_dict = self.get_transceiver_change_event(timeout)
change_event_dict["sfp"] = sfp_change_dict
if sfp_status is True:
return True, change_event_dict
change_event_dict = {"sfp": {}}
return False, {}
def get_transceiver_change_event(self, timeout=0):
start_time = time.time()
currernt_port_dict = {}
forever = False
if timeout == 0:
@ -97,25 +75,23 @@ class Chassis(PddfChassis):
elif timeout > 0:
timeout = timeout / float(1000) # Convert to secs
else:
print("get_transceiver_change_event:Invalid timeout value", timeout)
return False, {}
print("get_change_event:Invalid timeout value", timeout)
return False, change_event_dict
end_time = start_time + timeout
if start_time > end_time:
print(
"get_transceiver_change_event:" "time wrap / invalid timeout value",
"get_change_event:" "time wrap / invalid timeout value",
timeout,
)
return False, {} # Time wrap or possibly incorrect timeout
while timeout >= 0:
# Check for OIR events and return updated port_dict
for index in range(PORT_START, PORTS_IN_BLOCK):
if self._sfp_list[index].get_presence():
currernt_port_dict[index] = self.SFP_STATUS_INSERTED
else:
currernt_port_dict[index] = self.SFP_STATUS_REMOVED
if currernt_port_dict == self.port_dict:
return False, change_event_dict # Time wrap or possibly incorrect timeout
try:
while timeout >= 0:
# check for sfp
sfp_change_dict = self.get_transceiver_change_event()
if sfp_change_dict :
change_event_dict["sfp"] = sfp_change_dict
return True, change_event_dict
if forever:
time.sleep(1)
else:
@ -125,11 +101,34 @@ class Chassis(PddfChassis):
else:
if timeout > 0:
time.sleep(timeout)
return True, {}
return True, change_event_dict
except Exception as e:
print(e)
print("get_change_event: Should not reach here.")
return False, change_event_dict
def get_transceiver_change_event(self):
cur_sfp_present_dict = {}
ret_dict = {}
# Check for OIR events and return ret_dict
for i in range(self.port_start_index, self.port_start_index + self.port_num):
sfp = self._sfp_list[i]
if sfp.get_presence():
cur_sfp_present_dict[i] = self.STATUS_INSERTED
else:
# Update reg value
self.port_dict = currernt_port_dict
print(self.port_dict)
return True, self.port_dict
print("get_transceiver_change_event: Should not reach here.")
return False, {}
cur_sfp_present_dict[i] = self.STATUS_REMOVED
# Update reg value
if cur_sfp_present_dict == self.sfp_present_dict:
return ret_dict
for index, status in cur_sfp_present_dict.items():
if self.sfp_present_dict[index] != status:
ret_dict[index] = status
self.sfp_present_dict = cur_sfp_present_dict
return ret_dict

View File

@ -9,22 +9,52 @@
try:
from sonic_platform_base.component_base import ComponentBase
from sonic_platform.regutil import Reg
from sonic_platform.logger import logger
from sonic_py_common.general import getstatusoutput_noshell
import sonic_platform.hwaccess as hwaccess
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
def get_cpld_version(bus, i2caddr):
return '{}{}{}{}'.format(hwaccess.i2c_get(bus, i2caddr, 1),
hwaccess.i2c_get(bus, i2caddr, 2),
hwaccess.i2c_get(bus, i2caddr, 3),
hwaccess.i2c_get(bus, i2caddr, 0)
)
def get_cpu_cpld_version():
return get_cpld_version(0, 0x0d)
def get_cpld1_version():
return get_cpld_version(2, 0x33)
def get_cpld2_version():
return get_cpld_version(2, 0x35)
COMPONENT_LIST= [
['CPU CPLD',
'cpu board',
get_cpu_cpld_version
],
['MAC1 CPLD',
'mac1 board',
get_cpld1_version
],
['MAC2 CPLD',
'mac2 board',
get_cpld2_version
]
]
class Component(ComponentBase):
""" Ragile Platform-specific Component class"""
def __init__(self, index, config=None):
self.index = index
self.name = config.get("name")
self._reg_fm_ver = Reg(config.get("firmware_version"))
self.description = config.get("desc")
self.slot = config.get("slot")
def __init__(self, component_index=0):
ComponentBase.__init__(self)
self.index = component_index
def get_name(self):
"""
@ -33,7 +63,7 @@ class Component(ComponentBase):
Returns:
A string containing the name of the component
"""
return self.name
return COMPONENT_LIST[self.index][0]
def get_description(self):
"""
@ -42,7 +72,7 @@ class Component(ComponentBase):
Returns:
A string containing the description of the component
"""
return self.description
return COMPONENT_LIST[self.index][1]
def get_firmware_version(self):
"""
@ -51,12 +81,7 @@ class Component(ComponentBase):
Returns:
A string containing the firmware version of the component
"""
try:
return self._reg_fm_ver.decode()
except Exception as e:
logger.error(str(e))
return ""
return COMPONENT_LIST[self.index][2]()
def install_firmware(self, image_path):
"""

View File

@ -1,71 +1,17 @@
#
# fan_drawer_base.py
#
# Abstract base class for implementing a platform-specific class with which
# to interact with a fan drawer module in SONiC
#
#!/usr/bin/env python
try:
from sonic_platform_base.fan_drawer_base import FanDrawerBase
from sonic_platform_pddf_base.pddf_fan_drawer import PddfFanDrawer
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class FanDrawer(FanDrawerBase):
"""
Abstract base class for interfacing with a fan drawer
"""
# Device type definition. Note, this is a constant.
DEVICE_TYPE = "fan_drawer"
class FanDrawer(PddfFanDrawer):
"""PDDF Platform-Specific Fan-Drawer class"""
def __init__(self, index, fan_list):
FanDrawerBase.__init__(self)
self._fan_list = fan_list
self._index = index
def get_name(self):
"""
Retrieves the name of the device
Returns:
string: The name of the device
"""
return "fan {}".format(self._index)
def get_num_fans(self):
"""
Retrieves the number of fans available on this fan drawer
Returns:
An integer, the number of fan modules available on this fan drawer
"""
return len(self._fan_list)
def get_all_fans(self):
"""
Retrieves all fan modules available on this fan drawer
Returns:
A list of objects derived from FanBase representing all fan
modules available on this fan drawer
"""
return self._fan_list
def set_status_led(self, color):
"""
Sets the state of the fan drawer status LED
Args:
color: A string representing the color with which to set the
fan drawer status LED
Returns:
bool: True if status LED state is set successfully, False if not
"""
return self._fan_list[self._index].set_status_led(color)
def get_status_led(self, color):
"""
Gets the state of the fan drawer LED
Returns:
A string, one of the predefined STATUS_LED_COLOR_* strings above
"""
return self._fan_list[self._index].get_status_led(color)
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

View File

@ -0,0 +1,47 @@
# Helper functions to access hardware
import os
import struct
import mmap
import subprocess
# Read PCI device
def pci_mem_read(mm, offset):
mm.seek(offset)
read_data_stream = mm.read(4)
return struct.unpack('I',read_data_stream)[0]
def pci_get_value(resource, offset):
with open(resource, 'r+b') as fd:
mm = mmap.mmap(fd.fileno(), 0)
val = pci_mem_read(mm, offset)
mm.close()
return val
def pci_mem_write(memmap, offset, data):
""" Write PCI device """
memmap.seek(offset)
memmap.write(struct.pack('I', data))
def pci_set_value(resource, val, offset):
""" Set a value to PCI device """
with open(resource, 'w+b') as filed:
memmap = None
try:
memmap = mmap.mmap(filed.fileno(), 0)
pci_mem_write(memmap, offset, val)
except EnvironmentError:
pass
if memmap is not None:
memmap.close()
# Read I2C device
def i2c_get(bus, i2caddr, ofs):
try:
valx = int(subprocess.check_output(['/usr/sbin/i2cget','-f', '-y', str(bus), str(i2caddr), str(ofs)]), 16)
return "{:02x}".format(valx)
except (FileNotFoundError, subprocess.CalledProcessError):
return -1

View File

@ -5,7 +5,6 @@
#
#############################################################################
try:
from sonic_platform_pddf_base.pddf_platform import PddfPlatform
except ImportError as e:

View File

@ -1,5 +1,7 @@
try:
from sonic_platform_pddf_base.pddf_psu import PddfPsu
from sonic_py_common.general import getstatusoutput_noshell
import time
except ImportError as e:
raise ImportError (str(e) + "- required module not found")
@ -29,4 +31,74 @@ class Psu(PddfPsu):
A string, the type of PSU (AC/DC)
"""
return "DC"
def runcmd(self, cmd):
time_retry = 6
result_msg = ""
time_delay = 0.01
while time_retry:
try:
val, result_msg = getstatusoutput_noshell(cmd.split(" "))
if val is False:
time_retry -=1
time.sleep(time_delay)
continue
else:
return val, result_msg
except Exception as e:
time_retry -= 1
result_msg = str(e)
time.sleep(time_delay)
return False, result_msg
def get_voltage(self):
"""
Retrieves current PSU voltage output
Returns:
A float number, the output voltage in volts,
e.g. 12.1
"""
v_out = 0
label_t = "psu_v_out"
device = "PSU{}".format(self.psu_index)
#print(device)
pddf_obj_data = self.pddf_obj.data
if device in pddf_obj_data.keys():
pmbusloc = pddf_obj_data[device]['i2c']['interface']
for val in pmbusloc:
dev_name = val['dev']
pmbus_loc = pddf_obj_data[dev_name]
i2cloc = pmbus_loc['i2c']['attr_list']
parentbus = pmbus_loc['i2c']['topo_info']
for item_t in i2cloc:
if item_t['attr_name'] == label_t:
parentbus_id = int(parentbus['parent_bus'], 16)
vout_mode_cmd = "i2cget -f -y {} {} 0x20 bp".format(parentbus_id, parentbus['dev_addr'])
ret_t, val_voutmode = self.runcmd(vout_mode_cmd)
if ret_t is False:
return 0.0
v_out_cmd = "i2cget -f -y {} {} {} wp".format(parentbus_id, parentbus['dev_addr'], item_t['attr_offset'])
ret_t, val_p_out = self.runcmd(v_out_cmd)
if ret_t is False:
return 0.0
val_voutmode_t = int(val_voutmode, 16)
val_p_out_t = int(val_p_out, 16) * 1000
import ctypes
val_voutmode_t_t = ctypes.c_int8(val_voutmode_t << 3).value >>3
if (val_voutmode_t_t) < 0:
val_p_out_t_f = val_p_out_t>> (-val_voutmode_t_t)
else:
val_p_out_t_f = val_p_out_t << val_voutmode_t_t
return float(val_p_out_t_f)/1000
return float(v_out)/1000

View File

@ -1,15 +1,525 @@
#!/usr/bin/python
# -*- coding: UTF-8 -*-
#############################################################################
#
# Module contains an implementation of SONiC Platform Base API and
# provides the platform information
#
#
# *_device.py config version instruction:
# ver 1.0 - platform api:
# "presence_cpld": {
# "dev_id": {
# [dev_id]: {
# "offset": {
# [offset]: [port_id]
# }
# }
# }
# }
# "reset_cpld": {
# "dev_id": {
# [dev_id]: {
# "offset": {
# [offset]: [port_id]
# }
# }
# }
# }
# ver 2.0 - rg_plat:
# "presence_path": "/xx/rg_plat/xx[port_id]/present"
# "eeprom_path": "/sys/bus/i2c/devices/i2c-[bus]/[bus]-0050/eeprom"
# "reset_path": "/xx/rg_plat/xx[port_id]/reset"
#############################################################################
import sys
import time
import syslog
import traceback
from abc import abstractmethod
try:
from sonic_platform_pddf_base.pddf_sfp import PddfSfp
import os
from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase
from .sfp_config import *
except ImportError as e:
raise ImportError (str(e) + "- required module not found")
LOG_DEBUG_LEVEL = 1
LOG_WARNING_LEVEL = 2
LOG_ERROR_LEVEL = 3
class Sfp(PddfSfp):
"""
PDDF Platform-Specific Sfp class
"""
CONFIG_DB_PATH = "/etc/sonic/config_db.json"
def __init__(self, index, pddf_data=None, pddf_plugin_data=None):
PddfSfp.__init__(self, index, pddf_data, pddf_plugin_data)
def getonieplatform(path):
if not os.path.isfile(path):
return ""
machine_vars = {}
with open(path) as machine_file:
for line in machine_file:
tokens = line.split('=')
if len(tokens) < 2:
continue
machine_vars[tokens[0]] = tokens[1].strip()
return machine_vars.get("onie_platform")
# Provide the functions/variables below for which implementation is to be overwritten
def getplatform_config_db():
if not os.path.isfile(CONFIG_DB_PATH):
return ""
val = os.popen("sonic-cfggen -j %s -v DEVICE_METADATA.localhost.platform" % CONFIG_DB_PATH).read().strip()
if len(val) <= 0:
return ""
else:
return val
def getplatform_name():
if os.path.isfile('/host/machine.conf'):
return getonieplatform('/host/machine.conf')
elif os.path.isfile('/usr/share/sonic/hwsku/machine.conf'):
return getonieplatform('/usr/share/sonic/hwsku/machine.conf')
else:
return getplatform_config_db()
def get_sfp_config():
dev = getplatform_name()
return cust_sfp_cfg.get(dev, None)
class Sfp(SfpOptoeBase):
OPTOE_DRV_TYPE1 = 1
OPTOE_DRV_TYPE2 = 2
OPTOE_DRV_TYPE3 = 3
# index must start at 1
def __init__(self, index, a=None, b=None):
SfpOptoeBase.__init__(self)
self.sfp_type = None
sfp_config = get_sfp_config()
self.log_level_config = sfp_config.get("log_level", LOG_WARNING_LEVEL)
# Init instance of SfpCust
ver = sfp_config.get("ver", None)
if ver is None:
self._sfplog(LOG_ERROR_LEVEL, "Get Ver Config Error!")
vers = int(float(ver))
if vers == 1:
self._sfp_api = SfpV1(index)
elif vers == 2:
self._sfp_api = SfpV2(index)
else:
self._sfplog(LOG_ERROR_LEVEL, "Get SfpVer Error!")
def get_eeprom_path(self):
return self._sfp_api._get_eeprom_path()
def read_eeprom(self, offset, num_bytes):
return self._sfp_api.read_eeprom(offset, num_bytes)
def write_eeprom(self, offset, num_bytes, write_buffer):
return self._sfp_api.write_eeprom(offset, num_bytes, write_buffer)
def get_presence(self):
return self._sfp_api.get_presence()
def get_transceiver_info(self):
# temporary solution for a sonic202111 bug
transceiver_info = super().get_transceiver_info()
try:
if transceiver_info["vendor_rev"] is not None:
transceiver_info["hardware_rev"] = transceiver_info["vendor_rev"]
return transceiver_info
except Exception as e:
print(traceback.format_exc())
def reset(self):
if self.get_presence() is False:
return False
if self.sfp_type is None:
self.refresh_xcvr_api()
if self.sfp_type == 'SFP':
self._sfplog(LOG_ERROR_LEVEL, 'SFP does not support reset')
return False
self._sfplog(LOG_DEBUG_LEVEL, 'resetting...')
ret = self._sfp_api.set_reset(True)
if ret:
time.sleep(0.5)
ret = self._sfp_api.set_reset(False)
return ret
def get_lpmode(self):
if self.get_presence() is False:
return False
if self.sfp_type is None:
self.refresh_xcvr_api()
if self.sfp_type == 'SFP':
self._sfplog(LOG_WARNING_LEVEL, 'SFP does not support lpmode')
return False
#implement in future
return False
def set_lpmode(self, lpmode):
if self.get_presence() is False:
return False
if self.sfp_type is None or self._xcvr_api is None:
self.refresh_xcvr_api()
if self.sfp_type == 'QSFP-DD':
return SfpOptoeBase.set_lpmode(self, lpmode)
elif self.sfp_type == 'QSFP':
if lpmode:
return self._xcvr_api.set_power_override(True, lpmode)
else:
return self._xcvr_api.set_power_override(False, lpmode)
else:
self._sfplog(LOG_WARNING_LEVEL, 'SFP does not support lpmode')
return False
def set_optoe_write_max(self, write_max):
"""
This func is declared and implemented by SONiC but we're not supported
so override it as NotImplemented
"""
self._sfplog(LOG_DEBUG_LEVEL, "set_optoe_write_max NotImplemented")
pass
def refresh_xcvr_api(self):
"""
Updates the XcvrApi associated with this SFP
"""
self._xcvr_api = self._xcvr_api_factory.create_xcvr_api()
class_name = self._xcvr_api.__class__.__name__
optoe_type = None
# set sfp_type
if (class_name == 'CmisApi'):
self.sfp_type = 'QSFP-DD'
optoe_type = self.OPTOE_DRV_TYPE3
elif (class_name == 'Sff8472Api'):
self.sfp_type = 'SFP'
optoe_type = self.OPTOE_DRV_TYPE2
elif (class_name == 'Sff8636Api' or class_name == 'Sff8436Api'):
self.sfp_type = 'QSFP'
optoe_type = self.OPTOE_DRV_TYPE1
if optoe_type is not None:
# set optoe driver
self._sfp_api.set_optoe_type(optoe_type)
def _sfplog(self, log_level, msg):
if log_level >= self.log_level_config:
try:
syslog.openlog("Sfp")
if log_level == LOG_DEBUG_LEVEL:
syslog.syslog(syslog.LOG_DEBUG, msg)
elif log_level == LOG_WARNING_LEVEL:
syslog.syslog(syslog.LOG_DEBUG, msg)
elif log_level == LOG_ERROR_LEVEL:
syslog.syslog(syslog.LOG_ERR, msg)
syslog.closelog()
except Exception as e:
print(traceback.format_exc())
class SfpCust():
def __init__(self, index):
self.eeprom_path = None
self._init_config(index)
def _init_config(self, index):
sfp_config = get_sfp_config()
self.log_level_config = sfp_config.get("log_level", LOG_WARNING_LEVEL)
self._port_id = index
self.eeprom_retry_times = sfp_config.get("eeprom_retry_times", 0)
self.eeprom_retry_break_sec = sfp_config.get("eeprom_retry_break_sec", 0)
def combine_format_str(self, str, key):
count_format = str.count('%')
if count_format > 0:
args_k = []
for i in range(count_format):
args_k.append(key)
return str % (tuple(args_k))
else:
return str
def _get_eeprom_path(self):
return self.eeprom_path or None
@abstractmethod
def get_presence(self):
pass
def read_eeprom(self, offset, num_bytes):
try:
for i in range(self.eeprom_retry_times):
with open(self._get_eeprom_path(), mode='rb', buffering=0) as f:
f.seek(offset)
result = f.read(num_bytes)
# temporary solution for a sonic202111 bug
if len(result) < num_bytes:
result = result[::-1].zfill(num_bytes)[::-1]
if result != None:
return bytearray(result)
else:
time.sleep(self.eeprom_retry_break_sec)
continue
except Exception as e:
self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc())
return None
def write_eeprom(self, offset, num_bytes, write_buffer):
try:
for i in range(self.eeprom_retry_times):
ret = SfpOptoeBase.write_eeprom(self, offset, num_bytes, write_buffer)
if ret is False:
time.sleep(self.eeprom_retry_break_sec)
continue
break
return ret
except Exception as e:
self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc())
@abstractmethod
def set_optoe_type(self, class_name):
pass
@abstractmethod
def set_reset(self, reset):
pass
def _convert_str_range_to_int_arr(self, range_str):
if not range_str:
return []
int_range_strs = range_str.split(',')
range_res = []
for int_range_str in int_range_strs:
if '-' in int_range_str:
range_s = int(int_range_str.split('-')[0])
range_e = int(int_range_str.split('-')[1]) + 1
else:
range_s = int(int_range_str)
range_e = int(int_range_str) + 1
range_res = range_res + list(range(range_s, range_e))
return range_res
def _sfplog(self, log_level, msg):
if log_level >= self.log_level_config:
try:
syslog.openlog("SfpCust")
if log_level == LOG_DEBUG_LEVEL:
syslog.syslog(syslog.LOG_DEBUG, msg)
elif log_level == LOG_WARNING_LEVEL:
syslog.syslog(syslog.LOG_DEBUG, msg)
elif log_level == LOG_ERROR_LEVEL:
syslog.syslog(syslog.LOG_ERR, msg)
syslog.closelog()
except Exception as e:
print(traceback.format_exc())
class SfpV1(SfpCust):
def _init_config(self, index):
super()._init_config(index)
sfp_config = get_sfp_config()
# init presence path
self.presence_cpld = sfp_config.get("presence_cpld", None)
self.presence_val_is_present = sfp_config.get("presence_val_is_present", 0)
self._sfplog(LOG_DEBUG_LEVEL, "Done init presence path")
# init reset path
self.reset_cpld = sfp_config.get("reset_cpld", None)
self.reset_val_is_reset = sfp_config.get("reset_val_is_reset", 0)
self._sfplog(LOG_DEBUG_LEVEL, "Done init cpld path")
def get_presence(self):
if self.presence_cpld is None:
self._sfplog(LOG_ERROR_LEVEL, "presence_cpld is None!")
return False
try:
dev_id, offset, offset_bit = self._get_sfp_cpld_info(self.presence_cpld)
ret, info = platform_reg_read(0, dev_id, offset, 1)
return (info[0] & (1 << offset_bit) == self.presence_val_is_present)
except Exception as err:
self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc())
def read_eeprom(self, offset, num_bytes):
try:
for i in range(self.eeprom_retry_times):
ret, info = platform_sfp_read(self._port_id, offset, num_bytes)
if (ret is False
or info is None):
time.sleep(self.eeprom_retry_break_sec)
continue
eeprom_raw = []
for i in range(0, num_bytes):
eeprom_raw.append("0x00")
for n in range(0, len(info)):
eeprom_raw[n] = info[n]
# temporary solution for a sonic202111 bug
if len(eeprom_raw) < num_bytes:
eeprom_raw = eeprom_raw[::-1].zfill(num_bytes)[::-1]
return bytearray(eeprom_raw)
except Exception as e:
self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc())
return None
def write_eeprom(self, offset, num_bytes, write_buffer):
try:
for i in range(self.eeprom_retry_times):
# TODO: write_buffer is bytearray, need to convert to int array
val_list = []
if isinstance(write_buffer, list):
val_list = write_buffer
else:
val_list.append(write_buffer)
ret, info = platform_sfp_write(self._port_id, offset, val_list)
if ret is False:
time.sleep(self.eeprom_retry_break_sec)
continue
return True
except Exception as e:
self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc())
return False
def set_optoe_type(self, optoe_type):
ret, info = platform_get_optoe_type(self._port_id)
if info != optoe_type:
try:
ret, _ = platform_set_optoe_type(self._port_id, optoe_type)
except Exception as err:
self._sfplog(LOG_ERROR_LEVEL, "Set optoe err %s" % err)
def set_reset(self, reset):
if self.reset_cpld is None:
self._sfplog(LOG_ERROR_LEVEL, "reset_cpld is None!")
return False
try:
val = []
dev_id, offset, offset_bit = self._get_sfp_cpld_info(self.reset_cpld)
ret, info = platform_reg_read(0, dev_id, offset, 1)
if self.reset_val_is_reset == 0:
if reset:
val.append(info[0] & (~(1 << offset_bit)))
else:
val.append(info[0] | (1 << offset_bit))
else:
if reset:
val.append(info[0] | (1 << offset_bit))
else:
val.append(info[0] & (~(1 << offset_bit)))
ret, info = platform_reg_write(0, dev_id, offset, val)
if ret is False:
self._sfplog(LOG_ERROR_LEVEL, "platform_reg_write error!")
return False
except Exception as err:
self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc())
return False
return True
def _get_sfp_cpld_info(self, cpld_config):
dev_id = 0
offset = 0
for dev_id_temp in cpld_config["dev_id"]:
for offset_temp in cpld_config["dev_id"][dev_id_temp]["offset"]:
port_range_str = cpld_config["dev_id"][dev_id_temp]["offset"][offset_temp]
port_range_int = self._convert_str_range_to_int_arr(port_range_str)
if self._port_id in port_range_int:
dev_id = dev_id_temp
offset = offset_temp
offset_bit = port_range_int.index(self._port_id)
break
return dev_id, offset, offset_bit
class SfpV2(SfpCust):
def _init_config(self, index):
super()._init_config(index)
sfp_config = get_sfp_config()
# init eeprom path
eeprom_path_config = sfp_config.get("eeprom_path", None)
eeprom_path_key = sfp_config.get("eeprom_path_key")[self._port_id - 1]
self.eeprom_path = self.combine_format_str(eeprom_path_config, eeprom_path_key)
self._sfplog(LOG_DEBUG_LEVEL, "Done init eeprom path: %s" % self.eeprom_path)
# init presence path
presence_path_config = sfp_config.get("presence_path", None)
presence_path_key = sfp_config.get("presence_path_key")[self._port_id - 1]
self.presence_path = self.combine_format_str(presence_path_config, presence_path_key)
self.presence_val_is_present = sfp_config.get("presence_val_is_present", 0)
self._sfplog(LOG_DEBUG_LEVEL, "Done init presence path: %s" % self.presence_path)
# init optoe driver path
optoe_driver_path_config = sfp_config.get("optoe_driver_path", None)
optoe_driver_key = sfp_config.get("optoe_driver_key")[self._port_id - 1]
self.dev_class_path = self.combine_format_str(optoe_driver_path_config, optoe_driver_key)
self._sfplog(LOG_DEBUG_LEVEL, "Done init optoe driver path: %s" % self.dev_class_path)
# init txdisable path
txdisable_path_config = sfp_config.get("txdisable_path", None)
if txdisable_path_config is not None:
txdisable_path_key = sfp_config.get("txdisable_path_key")[self._port_id - 1]
self.txdisable_path = self.combine_format_str(txdisable_path_config, txdisable_path_key)
self.txdisable_val_is_on = sfp_config.get("txdisable_val_is_on", 0)
self._sfplog(LOG_DEBUG_LEVEL, "Done init optoe driver path: %s" % self.dev_class_path)
# init reset path
reset_path_config = sfp_config.get("reset_path", None)
if reset_path_config is not None:
reset_path_key = sfp_config.get("reset_path_key")[self._port_id - 1]
self.reset_path = self.combine_format_str(reset_path_config, reset_path_key)
self.reset_val_is_on = sfp_config.get("reset_val_is_on", 0)
self._sfplog(LOG_DEBUG_LEVEL, "Done init reset path: %s" % self.reset_path)
def get_presence(self):
if self.presence_path is None:
self._sfplog(LOG_ERROR_LEVEL, "presence_path is None!")
return False
try:
with open(self.presence_path, "rb") as data:
sysfs_data = data.read(1)
if sysfs_data != "":
result = int(sysfs_data, 16)
return result == self.presence_val_is_present
except Exception as err:
self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc())
def set_reset(self, reset):
return True
def set_optoe_type(self, optoe_type):
if self.dev_class_path is None:
self._sfplog(LOG_ERROR_LEVEL, "dev_class_path is None!")
return False
try:
dc_file = open(self.dev_class_path, "r+")
dc_file_val = dc_file.read(1)
if int(dc_file_val) != optoe_type:
dc_str = "%s" % str(optoe_type)
dc_file.write(dc_str)
dc_file.close()
except Exception as err:
self._sfplog(LOG_ERROR_LEVEL, traceback.format_exc())

View File

@ -0,0 +1,23 @@
cust_sfp_cfg = {
'x86_64-ragile_ra-b6510-48v8c-r0': {
"ver": '2.1',
"port_index_start": 0,
"port_num": 56,
"log_level": 2,
"eeprom_retry_times": 5,
"eeprom_retry_break_sec": 0.2,
"presence_path": "/sys/bus/i2c/devices/%d-0053/xcvr_present",
"presence_path_key": list(range(11, 67)),
"presence_val_is_present": 1,
"eeprom_path": "/sys/bus/i2c/devices/%d-0050/eeprom",
"eeprom_path_key": list(range(11, 67)),
"optoe_driver_path": "/sys/bus/i2c/devices/%d-0050/dev_class",
"optoe_driver_key": list(range(11, 67)),
"txdisable_path": "/sys/bus/i2c/devices/%d-0053/xcvr_txdisable",
"txdisable_path_key": list(range(11, 59)) + [0] * 8,
"txdisable_val_is_on": 0,
"reset_path": "/sys/bus/i2c/devices/%d-0053/xcvr_reset",
"reset_path_key": [0]* 48 + list(range(59, 67)),
"reset_val_is_on": 0,
},
}

View File

@ -8,7 +8,7 @@ except ImportError as e:
class Thermal(PddfThermal):
"""PDDF Platform-Specific Thermal class"""
def __init__(self, index, pddf_data=None, pddf_plugin_data=None):
PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data)
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)
# Provide the functions/variables below for which implementation is to be overwritten

View File

@ -8,6 +8,9 @@ INSTALL_SCRIPT_DIR = $(SUB_BUILD_DIR)/usr/local/bin
INSTALL_SERVICE_DIR = $(SUB_BUILD_DIR)/lib/systemd/system/
KBUILD_EXTRA_SYMBOLS += $(DIR_KERNEL_SRC)/Module.symvers
ifeq "5.10.0" "$(word 1, $(sort 5.10.0 $(KERNEL_VERSION)))"
KBUILD_EXTRA_SYMBOLS += $(PWD)/../../../pddf/i2c/Module.symvers.PDDF
endif
export KBUILD_EXTRA_SYMBOLS
all:

View File

@ -13,7 +13,8 @@ setup(
packages=[
'sonic_platform',
'rgutil',
'eepromutil'
'eepromutil',
'sonic_pcie'
],
classifiers=[
'Development Status :: 3 - Alpha',

View File

@ -0,0 +1 @@
__all__ = ["pcie_common"]

View File

@ -0,0 +1,107 @@
# pcie_common.py
# Common PCIE check interfaces for SONIC
#
import os
import yaml
import subprocess
import re
import sys
from copy import deepcopy
try:
from .pcie import PcieBase
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PcieUtil(PcieBase):
"""Platform-specific PCIEutil class"""
# got the config file path
def __init__(self, path):
self.config_path = path
# load the config file
def load_config_file(self):
config_file = self.config_path + "/" + "pcie.yaml"
try:
with open(config_file) as conf_file:
self.confInfo = yaml.load(conf_file)
except IOError as e:
print("Error: {}".format(str(e)))
print("Not found config file, please add a config file manually, or generate it by running [pcieutil pcie_generate]")
sys.exit()
# load current PCIe device
def get_pcie_device(self):
pciDict = {}
pciList = []
p1 = "^(\w+):(\w+)\.(\w)\s(.*)\s*\(*.*\)*"
p2 = "^.*:.*:.*:(\w+)\s*\(*.*\)*"
command1 = "sudo lspci"
command2 = "sudo lspci -n"
# run command 1
proc1 = subprocess.Popen(command1, shell=True, universal_newlines=True, stdout=subprocess.PIPE)
output1 = proc1.stdout.readlines()
proc1.communicate()
# run command 2
proc2 = subprocess.Popen(command2, shell=True, universal_newlines=True, stdout=subprocess.PIPE)
output2 = proc2.stdout.readlines()
proc2.communicate()
if proc1.returncode > 0:
for line1 in output1:
print(line1.strip())
return
elif proc2.returncode > 0:
for line2 in output2:
print(line2.strip())
return
else:
for (line1, line2) in zip(output1, output2):
pciDict.clear()
match1 = re.search(p1, line1.strip())
match2 = re.search(p2, line2.strip())
if match1 and match2:
Bus = match1.group(1)
Dev = match1.group(2)
Fn = match1.group(3)
Name = match1.group(4)
Id = match2.group(1)
pciDict["name"] = Name
pciDict["bus"] = Bus
pciDict["dev"] = Dev
pciDict["fn"] = Fn
pciDict["id"] = Id
pciList.append(pciDict)
pciDict = deepcopy(pciDict)
else:
print("CAN NOT MATCH PCIe DEVICE")
return pciList
# check the sysfs tree for each PCIe device
def check_pcie_sysfs(self, domain=0, bus=0, device=0, func=0):
dev_path = os.path.join('/sys/bus/pci/devices', '%04x:%02x:%02x.%d' % (domain, bus, device, func))
if os.path.exists(dev_path):
return True
return False
# check the current PCIe device with config file and return the result
def get_pcie_check(self):
self.load_config_file()
for item_conf in self.confInfo:
bus_conf = item_conf["bus"]
dev_conf = item_conf["dev"]
fn_conf = item_conf["fn"]
if self.check_pcie_sysfs(bus=int(bus_conf, base=16), device=int(dev_conf, base=16), func=int(fn_conf, base=16)):
item_conf["result"] = "Passed"
else:
item_conf["result"] = "Failed"
return self.confInfo
# generate the config file with current pci device
def dump_conf_yaml(self):
curInfo = self.get_pcie_device()
with open(self.config_path + "/" + "pcie.yaml", "w") as conf_file:
yaml.dump(curInfo, conf_file, default_flow_style=False)
return

View File

@ -9,16 +9,14 @@
try:
import time
from sonic_platform_pddf_base.pddf_chassis import PddfChassis
from rgutil.logutil import Logger
#from rgutil.logutil import Logger
from sonic_py_common.general import getstatusoutput_noshell
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
PORT_START = 0
PORT_END = 55
PORTS_IN_BLOCK = 56
logger = Logger("CHASSIS", syslog=True)
FAN_NUM_PER_DRAWER = 1
class Chassis(PddfChassis):
"""
@ -32,14 +30,10 @@ class Chassis(PddfChassis):
def __init__(self, pddf_data=None, pddf_plugin_data=None):
PddfChassis.__init__(self, pddf_data, pddf_plugin_data)
self.enable_read = ["i2cset", "-f", "-y", "2", "0x35", "0x2a", "0x01"]
self.disable_read = ["i2cset", "-f", "-y", "2", "0x35", "0x2a", "0x00"]
self.enable_write = ["i2cset", "-f", "-y", "2", "0x35", "0x2b", "0x00"]
self.disable_write = ["i2cset", "-f", "-y", "2", "0x35", "0x2b", "0x01"]
self.enable_erase = ["i2cset", "-f", "-y", "2", "0x35", "0x2c", "0x01"]
self.disable_erase = ["i2cset", "-f", "-y", "2", "0x35", "0x2c", "0x00"]
self.read_value = ["i2cget", "-f", "-y", "2", "0x35", "0x25"]
self.write_value = ["i2cset", "-f", "-y", "2", "0x35", "0x21", "0x0a"]
def get_revision(self):
val = ord(self._eeprom.revision_str())
test = "{}".format(val)
return test
def get_reboot_cause(self):
"""
@ -51,32 +45,6 @@ class Chassis(PddfChassis):
is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used
to pass a description of the reboot cause.
"""
try:
is_power_loss = False
# enable read
getstatusoutput_noshell(self.disable_write)
getstatusoutput_noshell(self.enable_read)
ret, log = getstatusoutput_noshell(self.read_value)
if ret == 0 and "0x0a" in log:
is_power_loss = True
# erase i2c and e2
getstatusoutput_noshell(self.enable_erase)
time.sleep(1)
getstatusoutput_noshell(self.disable_erase)
# clear data
getstatusoutput_noshell(self.enable_write)
getstatusoutput_noshell(self.disable_read)
getstatusoutput_noshell(self.disable_write)
getstatusoutput_noshell(self.enable_read)
# enable write and set data
getstatusoutput_noshell(self.enable_write)
getstatusoutput_noshell(self.disable_read)
getstatusoutput_noshell(self.write_value)
if is_power_loss:
return(self.REBOOT_CAUSE_POWER_LOSS, None)
except Exception as e:
logger.error(str(e))
return (self.REBOOT_CAUSE_NON_HARDWARE, None)

View File

@ -1,71 +1,17 @@
#
# fan_drawer_base.py
#
# Abstract base class for implementing a platform-specific class with which
# to interact with a fan drawer module in SONiC
#
#!/usr/bin/env python
try:
from sonic_platform_base.fan_drawer_base import FanDrawerBase
from sonic_platform_pddf_base.pddf_fan_drawer import PddfFanDrawer
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class FanDrawer(FanDrawerBase):
"""
Abstract base class for interfacing with a fan drawer
"""
# Device type definition. Note, this is a constant.
DEVICE_TYPE = "fan_drawer"
class FanDrawer(PddfFanDrawer):
"""PDDF Platform-Specific Fan-Drawer class"""
def __init__(self, index, fan_list):
FanDrawerBase.__init__(self)
self._fan_list = fan_list
self._index = index
def get_name(self):
"""
Retrieves the name of the device
Returns:
string: The name of the device
"""
return "fan {}".format(self._index)
def get_num_fans(self):
"""
Retrieves the number of fans available on this fan drawer
Returns:
An integer, the number of fan modules available on this fan drawer
"""
return len(self._fan_list)
def get_all_fans(self):
"""
Retrieves all fan modules available on this fan drawer
Returns:
A list of objects derived from FanBase representing all fan
modules available on this fan drawer
"""
return self._fan_list
def set_status_led(self, color):
"""
Sets the state of the fan drawer status LED
Args:
color: A string representing the color with which to set the
fan drawer status LED
Returns:
bool: True if status LED state is set successfully, False if not
"""
return self._fan_list[self._index].set_status_led(color)
def get_status_led(self, color):
"""
Gets the state of the fan drawer LED
Returns:
A string, one of the predefined STATUS_LED_COLOR_* strings above
"""
return self._fan_list[self._index].get_status_led(color)
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

View File

@ -0,0 +1,43 @@
#
# pcie_base.py
#
# Abstract base class for implementing platform-specific
# PCIE functionality for SONiC
#
try:
import abc
from sonic_pcie import PcieUtil
except ImportError as e:
raise ImportError (str(e) + " - required module not found")
class PcieBase(object):
def __init__(self, path):
"""
Constructor
Args:
pcieutil file and config file path
"""
self.pcie_util = PcieUtil(path)
@abc.abstractmethod
def get_pcie_device(self):
"""
get current device pcie info
Returns:
A list including pcie device info
"""
return self.pcie_util.get_pcie_device()
@abc.abstractmethod
def get_pcie_check(self):
"""
Check Pcie device with config file
Returns:
A list including pcie device and test result info
"""
return self.pcie_util.get_pcie_check()

View File

@ -1,9 +1,7 @@
#!/usr/bin/env python
#
try:
from sonic_platform_pddf_base.pddf_psu import PddfPsu
from sonic_py_common.general import getstatusoutput_noshell
import time
except ImportError as e:
raise ImportError (str(e) + "- required module not found")
@ -33,4 +31,74 @@ class Psu(PddfPsu):
A string, the type of PSU (AC/DC)
"""
return "DC"
def runcmd(self, cmd):
time_retry = 6
result_msg = ""
time_delay = 0.01
while time_retry:
try:
val, result_msg = getstatusoutput_noshell(cmd.split(" "))
if val is False:
time_retry -=1
time.sleep(time_delay)
continue
else:
return val, result_msg
except Exception as e:
time_retry -= 1
result_msg = str(e)
time.sleep(time_delay)
return False, result_msg
def get_voltage(self):
"""
Retrieves current PSU voltage output
Returns:
A float number, the output voltage in volts,
e.g. 12.1
"""
v_out = 0
label_t = "psu_v_out"
device = "PSU{}".format(self.psu_index)
#print(device)
pddf_obj_data = self.pddf_obj.data
if device in pddf_obj_data.keys():
pmbusloc = pddf_obj_data[device]['i2c']['interface']
for val in pmbusloc:
dev_name = val['dev']
pmbus_loc = pddf_obj_data[dev_name]
i2cloc = pmbus_loc['i2c']['attr_list']
parentbus = pmbus_loc['i2c']['topo_info']
for item_t in i2cloc:
if item_t['attr_name'] == label_t:
parentbus_id = int(parentbus['parent_bus'], 16)
vout_mode_cmd = "i2cget -f -y {} {} 0x20 bp".format(parentbus_id, parentbus['dev_addr'])
ret_t, val_voutmode = self.runcmd(vout_mode_cmd)
if ret_t is False:
return 0.0
v_out_cmd = "i2cget -f -y {} {} {} wp".format(parentbus_id, parentbus['dev_addr'], item_t['attr_offset'])
ret_t, val_p_out = self.runcmd(v_out_cmd)
if ret_t is False:
return 0.0
val_voutmode_t = int(val_voutmode, 16)
val_p_out_t = int(val_p_out, 16) * 1000
import ctypes
val_voutmode_t_t = ctypes.c_int8(val_voutmode_t << 3).value >>3
if (val_voutmode_t_t) < 0:
val_p_out_t_f = val_p_out_t>> (-val_voutmode_t_t)
else:
val_p_out_t_f = val_p_out_t << val_voutmode_t_t
return float(val_p_out_t_f)/1000
return float(v_out)/1000

View File

@ -1,10 +1,12 @@
#!/usr/bin/env python
import time
try:
from sonic_platform_pddf_base.pddf_sfp import PddfSfp
except ImportError as e:
raise ImportError (str(e) + "- required module not found")
EEPROM_RETRY = 5
EEPROM_RETRY_BREAK_SEC = 0.2
class Sfp(PddfSfp):
"""
@ -13,5 +15,46 @@ class Sfp(PddfSfp):
def __init__(self, index, pddf_data=None, pddf_plugin_data=None):
PddfSfp.__init__(self, index, pddf_data, pddf_plugin_data)
self._xcvr_api = self.get_xcvr_api()
# Provide the functions/variables below for which implementation is to be overwritten
def get_eeprom_path(self):
return self.eeprom_path
def read_eeprom(self, offset, num_bytes):
eeprom_raw = None
try:
for i in range(EEPROM_RETRY):
eeprom_raw = PddfSfp.read_eeprom(self, offset, num_bytes)
if eeprom_raw is None:
time.sleep(EEPROM_RETRY_BREAK_SEC)
continue
break
except Exception as e:
print("Error: Unable to read eeprom_path: %s" % (str(e)))
return None
return eeprom_raw
def write_eeprom(self, offset, num_bytes, write_buffer):
try:
for i in range(EEPROM_RETRY):
ret = PddfSfp.write_eeprom(self, offset, num_bytes, write_buffer)
if ret is False:
time.sleep(EEPROM_RETRY_BREAK_SEC)
continue
break
except Exception as e:
print("Error: Unable to write eeprom_path: %s" % (str(e)))
return None
return ret
def get_power_set(self):
if not self._xcvr_api.get_lpmode_support():
return False
return self._xcvr_api.get_power_set()
def get_power_override(self):
if not self._xcvr_api.get_power_override_support() or not self._xcvr_api.get_lpmode_support():
return False
return self._xcvr_api.get_power_override()

View File

@ -11,7 +11,7 @@ except ImportError as e:
class Thermal(PddfThermal):
"""PDDF Platform-Specific Thermal class"""
def __init__(self, index, pddf_data=None, pddf_plugin_data=None):
PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data)
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)
# Provide the functions/variables below for which implementation is to be overwritten

View File

@ -8,6 +8,9 @@ INSTALL_SCRIPT_DIR = $(SUB_BUILD_DIR)/usr/local/bin
INSTALL_SERVICE_DIR = $(SUB_BUILD_DIR)/lib/systemd/system/
KBUILD_EXTRA_SYMBOLS += $(DIR_KERNEL_SRC)/Module.symvers
ifeq "5.10.0" "$(word 1, $(sort 5.10.0 $(KERNEL_VERSION)))"
KBUILD_EXTRA_SYMBOLS += $(PWD)/../../../pddf/i2c/Module.symvers.PDDF
endif
export KBUILD_EXTRA_SYMBOLS
all:

View File

@ -27,6 +27,7 @@
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/version.h>
#include <linux/i2c.h>
#define DEBUG 0
@ -48,11 +49,16 @@ LED_OPS_DATA* dev_list[LED_TYPE_MAX] = {
int num_psus = 0;
int num_fantrays = 0;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
extern int board_i2c_cpld_read_new(unsigned short cpld_addr, char *name, u8 reg);
extern int board_i2c_cpld_write_new(unsigned short cpld_addr, char *name, u8 reg, u8 value);
#else
extern int board_i2c_cpld_read(unsigned short cpld_addr, u8 reg);
extern int board_i2c_cpld_write(unsigned short cpld_addr, u8 reg, u8 value);
extern void *get_device_table(char *name);
#endif
extern ssize_t show_pddf_data(struct device *dev, struct device_attribute *da, char *buf);
extern ssize_t store_pddf_data(struct device *dev, struct device_attribute *da, const char *buf, size_t count);
extern void *get_device_table(char *name);
static LED_STATUS find_state_index(const char* state_str) {
int index;
@ -151,6 +157,7 @@ static void print_led_data(LED_OPS_DATA *ptr, LED_STATUS state)
}
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
int get_sys_val(LED_OPS_DATA *ops_ptr, uint32_t *sys_val)
{
int ret;
@ -187,8 +194,8 @@ int get_sys_val(LED_OPS_DATA *ops_ptr, uint32_t *sys_val)
return ret;
}
#endif
ssize_t get_status_led(struct device_attribute *da)
{
int ret=0;
@ -206,6 +213,7 @@ ssize_t get_status_led(struct device_attribute *da)
temp_data_ptr->device_name, temp_data_ptr->index);
return (-1);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
ret = get_sys_val(ops_ptr, &sys_val);
if (ret < 0) {
pddf_dbg(LED, KERN_ERR "ERROR %s: Cannot get sys val\n", __func__);
@ -213,7 +221,11 @@ ssize_t get_status_led(struct device_attribute *da)
}
/* keep ret as old value */
ret = 0;
#else
sys_val = board_i2c_cpld_read_new(ops_ptr->swpld_addr, ops_ptr->device_name, ops_ptr->swpld_addr_offset);
if (sys_val < 0)
return sys_val;
#endif
strcpy(temp_data.cur_state.color, "None");
for (state=0; state<MAX_LED_STATUS; state++) {
color_val = (sys_val & ~ops_ptr->data[state].bits.mask_bits);
@ -232,6 +244,7 @@ ssize_t get_status_led(struct device_attribute *da)
return(ret);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
int set_sys_val(LED_OPS_DATA *ops_ptr, uint32_t new_val)
{
int ret;
@ -266,6 +279,7 @@ int set_sys_val(LED_OPS_DATA *ops_ptr, uint32_t new_val)
return ret;
}
#endif
ssize_t set_status_led(struct device_attribute *da)
{
@ -297,12 +311,18 @@ ssize_t set_status_led(struct device_attribute *da)
}
if(ops_ptr->data[cur_state].swpld_addr != 0x0) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
ret = get_sys_val(ops_ptr, &sys_val);
if (ret < 0) {
pddf_dbg(LED, KERN_ERR "ERROR %s: Cannot get sys val\n", __func__);
return (-1);
}
#else
sys_val = board_i2c_cpld_read_new(ops_ptr->swpld_addr, ops_ptr->device_name, ops_ptr->swpld_addr_offset);
if (sys_val < 0) {
return sys_val;
}
#endif
new_val = (sys_val & ops_ptr->data[cur_state].bits.mask_bits) |
(ops_ptr->data[cur_state].value << ops_ptr->data[cur_state].bits.pos);
@ -312,16 +332,24 @@ ssize_t set_status_led(struct device_attribute *da)
return (-1);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
ret = set_sys_val(ops_ptr, new_val);
if (ret < 0) {
pddf_dbg(LED, KERN_ERR "ERROR %s: Cannot set sys val\n", __func__);
return (-1);
}
#else
board_i2c_cpld_write_new(ops_ptr->swpld_addr, ops_ptr->device_name, ops_ptr->swpld_addr_offset, new_val);
#endif
pddf_dbg(LED, KERN_INFO "Set color:%s; 0x%x:0x%x sys_val:0x%x new_val:0x%x read:0x%x\n",
LED_STATUS_STR[cur_state],
ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset,
sys_val, new_val,
ret = board_i2c_cpld_read(ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset));
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
ret = board_i2c_cpld_read(ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset));
#else
ret = board_i2c_cpld_read_new(ops_ptr->swpld_addr, ops_ptr->device_name, ops_ptr->swpld_addr_offset));
#endif
if (ret < 0)
{
pddf_dbg(LED, KERN_ERR "PDDF_LED ERROR %s: Error %d in reading from cpld(0x%x) offset 0x%x\n", __FUNCTION__, ret, ops_ptr->swpld_addr, ops_ptr->swpld_addr_offset);

View File

@ -7,7 +7,6 @@
try:
import time
from sonic_platform_pddf_base.pddf_chassis import PddfChassis
from sonic_platform.fan_drawer import FanDrawer
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
@ -27,16 +26,10 @@ class Chassis(PddfChassis):
def __init__(self, pddf_data=None, pddf_plugin_data=None):
PddfChassis.__init__(self, pddf_data, pddf_plugin_data)
# fan drawer
temp = []
drawer_index = 0
for idx, fan in enumerate(self.get_all_fans()):
temp.append(fan)
if (idx + 1) % FAN_NUM_PER_DRAWER == 0:
drawer = FanDrawer(drawer_index + 1, temp)
self.get_all_fan_drawers().append(drawer)
temp = []
drawer_index += 1
def get_revision(self):
val = ord(self._eeprom.revision_str())
test = "{}".format(val)
return test
def get_reboot_cause(self):
"""

View File

@ -1,69 +1,17 @@
#
# fan_drawer
#
#!/usr/bin/env python
try:
from sonic_platform_base.fan_drawer_base import FanDrawerBase
from sonic_platform_pddf_base.pddf_fan_drawer import PddfFanDrawer
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class FanDrawer(FanDrawerBase):
# Device type definition. Note, this is a constant.
DEVICE_TYPE = "fan_drawer"
class FanDrawer(PddfFanDrawer):
"""PDDF Platform-Specific Fan-Drawer class"""
def __init__(self, index, fan_list):
FanDrawerBase.__init__(self)
self._fan_list = fan_list
self._index = index
def get_name(self):
"""
Retrieves the name of the device
Returns:
string: The name of the device
"""
return "fan drawer {}".format(self._index)
def get_num_fans(self):
"""
Retrieves the number of fans available on this fan drawer
Returns:
An integer, the number of fan modules available on this fan drawer
"""
return len(self._fan_list)
def get_all_fans(self):
"""
Retrieves all fan modules available on this fan drawer
Returns:
A list of objects derived from FanBase representing all fan
modules available on this fan drawer
"""
return self._fan_list
def set_status_led(self, color):
"""
Sets the state of the fan drawer status LED
Args:
color: A string representing the color with which to set the
fan drawer status LED
Returns:
bool: True if status LED state is set successfully, False if not
"""
if self.get_num_fans() > 0:
return self._fan_list[0].set_status_led(color)
return False
def get_status_led(self):
"""
Gets the state of the fan drawer LED
Returns:
A string, one of the predefined STATUS_LED_COLOR_* strings above
"""
if self.get_num_fans() > 0:
return self._fan_list[0].get_status_led()
return "N/A"
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

View File

@ -1,17 +1,19 @@
try:
from sonic_platform_pddf_base.pddf_psu import PddfPsu
from sonic_py_common.general import getstatusoutput_noshell
import time
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_maximum_supplied_power(self):
"""
@ -29,4 +31,74 @@ class Psu(PddfPsu):
A string, the type of PSU (AC/DC)
"""
return "DC"
def runcmd(self, cmd):
time_retry = 6
result_msg = ""
time_delay = 0.01
while time_retry:
try:
val, result_msg = getstatusoutput_noshell(cmd.split(" "))
if val is False:
time_retry -=1
time.sleep(time_delay)
continue
else:
return val, result_msg
except Exception as e:
time_retry -= 1
result_msg = str(e)
time.sleep(time_delay)
return False, result_msg
def get_voltage(self):
"""
Retrieves current PSU voltage output
Returns:
A float number, the output voltage in volts,
e.g. 12.1
"""
v_out = 0
label_t = "psu_v_out"
device = "PSU{}".format(self.psu_index)
#print(device)
pddf_obj_data = self.pddf_obj.data
if device in pddf_obj_data.keys():
pmbusloc = pddf_obj_data[device]['i2c']['interface']
for val in pmbusloc:
dev_name = val['dev']
pmbus_loc = pddf_obj_data[dev_name]
i2cloc = pmbus_loc['i2c']['attr_list']
parentbus = pmbus_loc['i2c']['topo_info']
for item_t in i2cloc:
if item_t['attr_name'] == label_t:
parentbus_id = int(parentbus['parent_bus'], 16)
vout_mode_cmd = "i2cget -f -y {} {} 0x20 bp".format(parentbus_id, parentbus['dev_addr'])
ret_t, val_voutmode = self.runcmd(vout_mode_cmd)
if ret_t is False:
return 0.0
v_out_cmd = "i2cget -f -y {} {} {} wp".format(parentbus_id, parentbus['dev_addr'], item_t['attr_offset'])
ret_t, val_p_out = self.runcmd(v_out_cmd)
if ret_t is False:
return 0.0
val_voutmode_t = int(val_voutmode, 16)
val_p_out_t = int(val_p_out, 16) * 1000
import ctypes
val_voutmode_t_t = ctypes.c_int8(val_voutmode_t << 3).value >>3
if (val_voutmode_t_t) < 0:
val_p_out_t_f = val_p_out_t>> (-val_voutmode_t_t)
else:
val_p_out_t_f = val_p_out_t << val_voutmode_t_t
return float(val_p_out_t_f)/1000
return float(v_out)/1000

View File

@ -1,31 +1,12 @@
#!/usr/bin/env python
import time
try:
#from sonic_platform_pddf_base.pddf_sfp import *
from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId
from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom
from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId
from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom
from sonic_platform_pddf_base.pddf_sfp import PddfSfp
from sonic_platform_pddf_base.pddf_sfp import SFP_VOLT_OFFSET
from sonic_platform_pddf_base.pddf_sfp import SFP_VOLT_WIDTH
from sonic_platform_pddf_base.pddf_sfp import SFP_CHANNL_MON_OFFSET
from sonic_platform_pddf_base.pddf_sfp import SFP_CHANNL_MON_WIDTH
from sonic_platform_pddf_base.pddf_sfp import SFP_TEMPE_OFFSET
from sonic_platform_pddf_base.pddf_sfp import SFP_TEMPE_WIDTH
from sonic_platform_pddf_base.pddf_sfp import QSFP_DOM_REV_OFFSET
from sonic_platform_pddf_base.pddf_sfp import QSFP_DOM_REV_WIDTH
from sonic_platform_pddf_base.pddf_sfp import QSFP_CHANNL_MON_OFFSET
from sonic_platform_pddf_base.pddf_sfp import QSFP_CHANNL_MON_WITH_TX_POWER_WIDTH
except ImportError as e:
raise ImportError (str(e) + "- required module not found")
XCVR_DOM_CAPABILITY_OFFSET = 92
XCVR_DOM_CAPABILITY_WIDTH = 2
QSFP_VERSION_COMPLIANCE_OFFSET = 1
QSFP_VERSION_COMPLIANCE_WIDTH = 2
QSFP_OPTION_VALUE_OFFSET = 192
QSFP_OPTION_VALUE_WIDTH = 4
EEPROM_RETRY = 5
EEPROM_RETRY_BREAK_SEC = 0.2
class Sfp(PddfSfp):
"""
@ -34,254 +15,46 @@ class Sfp(PddfSfp):
def __init__(self, index, pddf_data=None, pddf_plugin_data=None):
PddfSfp.__init__(self, index, pddf_data, pddf_plugin_data)
self.dom_supported = False
self.__dom_capability_detect()
self._xcvr_api = self.get_xcvr_api()
def __dom_capability_detect(self):
self.dom_supported = False
self.dom_temp_supported = False
self.dom_volt_supported = False
self.dom_rx_power_supported = False
self.dom_tx_power_supported = False
self.qsfp_page3_available = False
self.calibration = 0
if not self.get_presence():
return
if self.is_osfp_port:
# Not implement
return
elif self.is_qsfp_port:
self.calibration = 1
sfpi_obj = sff8436InterfaceId()
if sfpi_obj is None:
self.dom_supported = False
offset = 128
# 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_DOM_CAPABILITY_OFFSET), XCVR_DOM_CAPABILITY_WIDTH)
if qsfp_dom_capability_raw is not None:
qsfp_version_compliance_raw = self.__read_eeprom_specific_bytes(
QSFP_VERSION_COMPLIANCE_OFFSET, QSFP_VERSION_COMPLIANCE_WIDTH)
qsfp_version_compliance = int(
qsfp_version_compliance_raw[0], 16)
dom_capability = sfpi_obj.parse_dom_capability(
qsfp_dom_capability_raw, 0)
if qsfp_version_compliance >= 0x08:
self.dom_temp_supported = dom_capability['data']['Temp_support']['value'] == 'On'
self.dom_volt_supported = dom_capability['data']['Voltage_support']['value'] == 'On'
self.dom_rx_power_supported = dom_capability['data']['Rx_power_support']['value'] == 'On'
self.dom_tx_power_supported = dom_capability['data']['Tx_power_support']['value'] == 'On'
else:
self.dom_temp_supported = True
self.dom_volt_supported = True
self.dom_rx_power_supported = dom_capability['data']['Rx_power_support']['value'] == 'On'
self.dom_tx_power_supported = True
self.dom_supported = True
self.calibration = 1
sfpd_obj = sff8436Dom()
if sfpd_obj is None:
return None
qsfp_option_value_raw = self.__read_eeprom_specific_bytes(
QSFP_OPTION_VALUE_OFFSET, QSFP_OPTION_VALUE_WIDTH)
if qsfp_option_value_raw is not None:
optional_capability = sfpd_obj.parse_option_params(
qsfp_option_value_raw, 0)
self.dom_tx_disable_supported = optional_capability[
'data']['TxDisable']['value'] == 'On'
dom_status_indicator = sfpd_obj.parse_dom_status_indicator(
qsfp_version_compliance_raw, 1)
self.qsfp_page3_available = dom_status_indicator['data']['FlatMem']['value'] == 'Off'
else:
self.dom_supported = False
self.dom_temp_supported = False
self.dom_volt_supported = False
self.dom_rx_power_supported = False
self.dom_tx_power_supported = False
self.calibration = 0
self.qsfp_page3_available = False
else:
sfpi_obj = sff8472InterfaceId()
if sfpi_obj is None:
return None
sfp_dom_capability_raw = self.__read_eeprom_specific_bytes(
XCVR_DOM_CAPABILITY_OFFSET, XCVR_DOM_CAPABILITY_WIDTH)
if sfp_dom_capability_raw is not None:
sfp_dom_capability = int(sfp_dom_capability_raw[0], 16)
self.dom_supported = (sfp_dom_capability & 0x40 != 0)
if self.dom_supported:
self.dom_temp_supported = True
self.dom_volt_supported = True
self.dom_rx_power_supported = True
self.dom_tx_power_supported = True
if sfp_dom_capability & 0x20 != 0:
self.calibration = 1
elif sfp_dom_capability & 0x10 != 0:
self.calibration = 2
else:
self.calibration = 0
else:
self.dom_temp_supported = False
self.dom_volt_supported = False
self.dom_rx_power_supported = False
self.dom_tx_power_supported = False
self.calibration = 0
self.dom_tx_disable_supported = (
int(sfp_dom_capability_raw[1], 16) & 0x40 != 0)
# Provide the functions/variables below for which implementation is to be overwritten
def __read_eeprom_specific_bytes(self, offset, num_bytes):
eeprom_raw = []
if not self.get_presence():
return None
for i in range(0, num_bytes):
eeprom_raw.append("0x00")
def get_eeprom_path(self):
return self.eeprom_path
def read_eeprom(self, offset, num_bytes):
eeprom_raw = None
try:
with open(self.eeprom_path, mode="rb", buffering=0) as eeprom:
eeprom.seek(offset)
raw = eeprom.read(num_bytes)
for i in range(EEPROM_RETRY):
eeprom_raw = PddfSfp.read_eeprom(self, offset, num_bytes)
if eeprom_raw is None:
time.sleep(EEPROM_RETRY_BREAK_SEC)
continue
break
except Exception as e:
print("Error: Unable to open eeprom_path: %s" % (str(e)))
return None
try:
if len(raw) == 0:
return None
for n in range(0, num_bytes):
eeprom_raw[n] = hex(raw[n])[2:].zfill(2)
except Exception as e:
print("Error: Exception info: %s" % (str(e)))
print("Error: Unable to read eeprom_path: %s" % (str(e)))
return None
return eeprom_raw
def get_transceiver_bulk_status(self):
# check present status
if not self.get_presence():
def write_eeprom(self, offset, num_bytes, write_buffer):
try:
for i in range(EEPROM_RETRY):
ret = PddfSfp.write_eeprom(self, offset, num_bytes, write_buffer)
if ret is False:
time.sleep(EEPROM_RETRY_BREAK_SEC)
continue
break
except Exception as e:
print("Error: Unable to write eeprom_path: %s" % (str(e)))
return None
self.__dom_capability_detect()
xcvr_dom_info_dict = dict.fromkeys(self.dom_dict_keys, 'N/A')
return ret
if self.is_osfp_port:
# Below part is added to avoid fail xcvrd, shall be implemented later
pass
elif self.is_qsfp_port:
# QSFPs
xcvr_dom_info_dict = super(Sfp, self).get_transceiver_bulk_status()
def get_power_set(self):
if not self._xcvr_api.get_lpmode_support():
return False
return self._xcvr_api.get_power_set()
# pddf_sfp "qsfp_tx_power_support != 'on'" is wrong
offset = 0
sfpd_obj = sff8436Dom()
if sfpd_obj is None:
return None
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)
else:
return None
dom_channel_monitor_data = {}
qsfp_dom_rev = qsfp_dom_rev_data['data']['dom_rev']['value']
if (qsfp_dom_rev[0:8] == 'SFF-8636' and self.dom_tx_power_supported is True):
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)
else:
return None
xcvr_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TX1Power']['value']
xcvr_dom_info_dict['tx2power'] = dom_channel_monitor_data['data']['TX2Power']['value']
xcvr_dom_info_dict['tx3power'] = dom_channel_monitor_data['data']['TX3Power']['value']
xcvr_dom_info_dict['tx4power'] = dom_channel_monitor_data['data']['TX4Power']['value']
else:
# SFPs
offset = 256
if not self.dom_supported:
return xcvr_dom_info_dict
sfpd_obj = sff8472Dom()
if sfpd_obj is None:
return None
sfpd_obj._calibration_type = self.calibration
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)
else:
return None
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)
else:
return None
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_channel_monitor_data = sfpd_obj.parse_channel_monitor_params(dom_channel_monitor_raw, 0)
else:
return None
xcvr_dom_info_dict['temperature'] = dom_temperature_data['data']['Temperature']['value']
xcvr_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value']
xcvr_dom_info_dict['rx1power'] = dom_channel_monitor_data['data']['RXPower']['value']
xcvr_dom_info_dict['rx2power'] = 'N/A'
xcvr_dom_info_dict['rx3power'] = 'N/A'
xcvr_dom_info_dict['rx4power'] = 'N/A'
xcvr_dom_info_dict['tx1bias'] = dom_channel_monitor_data['data']['TXBias']['value']
xcvr_dom_info_dict['tx2bias'] = 'N/A'
xcvr_dom_info_dict['tx3bias'] = 'N/A'
xcvr_dom_info_dict['tx4bias'] = 'N/A'
xcvr_dom_info_dict['tx1power'] = dom_channel_monitor_data['data']['TXPower']['value']
xcvr_dom_info_dict['tx2power'] = 'N/A'
xcvr_dom_info_dict['tx3power'] = 'N/A'
xcvr_dom_info_dict['tx4power'] = 'N/A'
xcvr_dom_info_dict['rx_los'] = self.get_rx_los()
xcvr_dom_info_dict['tx_fault'] = self.get_tx_fault()
xcvr_dom_info_dict['reset_status'] = self.get_reset_status()
xcvr_dom_info_dict['lp_mode'] = self.get_lpmode()
return xcvr_dom_info_dict
def get_transceiver_threshold_info(self):
# check present status
if not self.get_presence():
return None
self.__dom_capability_detect()
xcvr_dom_threshold_info_dict = dict.fromkeys(self.threshold_dict_keys, 'N/A')
if self.is_osfp_port:
# Below part is added to avoid fail xcvrd, shall be implemented later
pass
elif self.is_qsfp_port:
# QSFPs
if not self.dom_supported or not self.qsfp_page3_available:
return xcvr_dom_threshold_info_dict
return super(Sfp, self).get_transceiver_threshold_info()
else:
# SFPs
if not self.dom_supported:
return xcvr_dom_threshold_info_dict
return super(Sfp, self).get_transceiver_threshold_info()
return xcvr_dom_threshold_info_dict
def get_power_override(self):
if not self._xcvr_api.get_power_override_support() or not self._xcvr_api.get_lpmode_support():
return False
return self._xcvr_api.get_power_override()

View File

@ -8,7 +8,7 @@ except ImportError as e:
class Thermal(PddfThermal):
"""PDDF Platform-Specific Thermal class"""
def __init__(self, index, pddf_data=None, pddf_plugin_data=None):
PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data)
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)
# Provide the functions/variables below for which implementation is to be overwritten

View File

@ -1,5 +1,5 @@
# PDDF Generic Platform modules
####################################################
#####################################################
PDDF_PLATFORM_MODULE_VERSION = 1.1
export PDDF_PLATFORM_MODULE_VERSION

View File

@ -308,6 +308,16 @@ sap_rx_polarity_flip
sap_tx_polarity_flip
sap_mdio_num
dport_map_port_9
cancun_dir
pcie_file
capi_level
phy_pin_compatibility_enable
cfg_int_phy_ctrl
stand_alone_phy_init
sap_rx_polarity_flip
sap_tx_polarity_flip
sap_mdio_num
dport_map_port_9
ifa_enable
port_gmii_mode
phy_force_firmware_load