[Alphanetworks] Add new platform SNJ60D0-320F (#8780)

Why I did it
Added Support for Alphanetworks SNJ60D0-320F platform

How I did it
Implemented the support for Alphanetworks SNJ60D0-320F platform

Platform: x86_64-alphanetworks_snj60d0_320f-r0
HwSKU: Alphanetworks-SNJ60D0-320F
ASIC: broadcom
ASIC Count: 1

How to verify it
Verified the show command outputs
This commit is contained in:
juntseng62 2021-10-23 03:37:39 +08:00 committed by GitHub
parent 3971c20001
commit 963217891e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
52 changed files with 14910 additions and 9 deletions

View File

@ -0,0 +1,2 @@
{%- set default_topo = 't0' %}
{%- include 'buffers_config.j2' %}

View File

@ -0,0 +1,47 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"egress_lossy_pool": {
"size": "67108864",
"type": "egress",
"mode": "dynamic"
},
"ingress_lossless_pool": {
"mode": "dynamic",
"size": "59001152",
"xoff": "7428992",
"type": "ingress"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"static_th":"67108864"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_lossy_pool]",
"size":"0",
"dynamic_th":"3"
}
},
{%- endmacro %}
{%- macro generate_pg_profils(port_names_active) %}
"BUFFER_PG": {
"{{ port_names_active }}|0": {
"profile" : "[BUFFER_PROFILE|ingress_lossy_profile]"
}
},
{%- endmacro %}
{% macro generate_queue_buffers(port_names_active) %}
"BUFFER_QUEUE": {
"{{ port_names_active }}|0-6": {
"profile" : "[BUFFER_PROFILE|egress_lossy_profile]"
}
}
{% endmacro %}

View File

@ -0,0 +1,47 @@
{%- set default_cable = '40m' %}
{%- macro generate_buffer_pool_and_profiles() %}
"BUFFER_POOL": {
"egress_lossy_pool": {
"size": "67108864",
"type": "egress",
"mode": "dynamic"
},
"ingress_lossless_pool": {
"mode": "dynamic",
"size": "59001152",
"xoff": "7428992",
"type": "ingress"
}
},
"BUFFER_PROFILE": {
"ingress_lossy_profile": {
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
"size":"0",
"static_th":"67108864"
},
"egress_lossy_profile": {
"pool":"[BUFFER_POOL|egress_lossy_pool]",
"size":"0",
"dynamic_th":"3"
}
},
{%- endmacro %}
{%- macro generate_pg_profils(port_names_active) %}
"BUFFER_PG": {
"{{ port_names_active }}|0": {
"profile" : "[BUFFER_PROFILE|ingress_lossy_profile]"
}
},
{%- endmacro %}
{% macro generate_queue_buffers(port_names_active) %}
"BUFFER_QUEUE": {
"{{ port_names_active }}|0-6": {
"profile" : "[BUFFER_PROFILE|egress_lossy_profile]"
}
}
{% endmacro %}

View File

@ -0,0 +1,106 @@
{
"interfaces": {
"Ethernet0": {
"default_brkout_mode": "1x400G"
},
"Ethernet8": {
"default_brkout_mode": "1x400G"
},
"Ethernet16": {
"default_brkout_mode": "1x400G"
},
"Ethernet24": {
"default_brkout_mode": "1x400G"
},
"Ethernet32": {
"default_brkout_mode": "1x400G"
},
"Ethernet40": {
"default_brkout_mode": "1x400G"
},
"Ethernet48": {
"default_brkout_mode": "1x400G"
},
"Ethernet56": {
"default_brkout_mode": "1x400G"
},
"Ethernet64": {
"default_brkout_mode": "1x400G"
},
"Ethernet72": {
"default_brkout_mode": "1x400G"
},
"Ethernet80": {
"default_brkout_mode": "1x400G"
},
"Ethernet88": {
"default_brkout_mode": "1x400G"
},
"Ethernet96": {
"default_brkout_mode": "1x400G"
},
"Ethernet104": {
"default_brkout_mode": "1x400G"
},
"Ethernet112": {
"default_brkout_mode": "1x400G"
},
"Ethernet120": {
"default_brkout_mode": "1x400G"
},
"Ethernet128": {
"default_brkout_mode": "1x400G"
},
"Ethernet136": {
"default_brkout_mode": "1x400G"
},
"Ethernet144": {
"default_brkout_mode": "1x400G"
},
"Ethernet152": {
"default_brkout_mode": "1x400G"
},
"Ethernet160": {
"default_brkout_mode": "1x400G"
},
"Ethernet168": {
"default_brkout_mode": "1x400G"
},
"Ethernet176": {
"default_brkout_mode": "1x400G"
},
"Ethernet184": {
"default_brkout_mode": "1x400G"
},
"Ethernet192": {
"default_brkout_mode": "1x400G"
},
"Ethernet200": {
"default_brkout_mode": "1x400G"
},
"Ethernet208": {
"default_brkout_mode": "1x400G"
},
"Ethernet216": {
"default_brkout_mode": "1x400G"
},
"Ethernet224": {
"default_brkout_mode": "1x400G"
},
"Ethernet232": {
"default_brkout_mode": "1x400G"
},
"Ethernet240": {
"default_brkout_mode": "1x400G"
},
"Ethernet248": {
"default_brkout_mode": "1x400G"
},
"Ethernet256": {
"default_brkout_mode": "1x10G"
},
"Ethernet257": {
"default_brkout_mode": "1x10G"
}
}
}

View File

@ -0,0 +1,23 @@
# PG lossless profiles.
# speed cable size xon xoff threshold xon_offset
10000 5m 1270 0 190500 -2 2540
25000 5m 1270 0 190500 -2 2540
40000 5m 1270 0 190500 -2 2540
50000 5m 1270 0 190500 -2 2540
100000 5m 1270 0 190500 -2 2540
200000 5m 1270 0 190500 -2 2540
400000 5m 1270 0 190500 -2 2540
10000 40m 1270 0 190500 -2 2540
25000 40m 1270 0 190500 -2 2540
40000 40m 1270 0 190500 -2 2540
50000 40m 1270 0 190500 -2 2540
100000 40m 1270 0 190500 -2 2540
200000 40m 1270 0 190500 -2 2540
400000 40m 1270 0 190500 -2 2540
10000 300m 1270 0 190500 -2 2540
25000 300m 1270 0 190500 -2 2540
40000 300m 1270 0 190500 -2 2540
50000 300m 1270 0 190500 -2 2540
100000 300m 1270 0 190500 -2 2540
200000 300m 1270 0 190500 -2 2540
400000 300m 1270 0 190500 -2 2540

View File

@ -0,0 +1,228 @@
{%- set PORT_ALL = [] %}
{%- for port in PORT %}
{%- if PORT_ALL.append(port) %}{% endif %}
{%- endfor %}
{%- if PORT_ALL | sort_by_port_index %}{% endif %}
{%- set port_names_list_all = [] %}
{%- for port in PORT_ALL %}
{%- if port_names_list_all.append(port) %}{% endif %}
{%- endfor %}
{%- set port_names_all = port_names_list_all | join(',') -%}
{%- set PORT_ACTIVE = [] %}
{%- if DEVICE_NEIGHBOR is not defined %}
{%- set PORT_ACTIVE = PORT_ALL %}
{%- else %}
{%- for port in DEVICE_NEIGHBOR.keys() %}
{%- if PORT_ACTIVE.append(port) %}{%- endif %}
{%- endfor %}
{%- endif %}
{%- if PORT_ACTIVE | sort_by_port_index %}{% endif %}
{%- set port_names_list_active = [] %}
{%- for port in PORT_ACTIVE %}
{%- if port_names_list_active.append(port) %}{%- endif %}
{%- endfor %}
{%- set port_names_active = port_names_list_active | join(',') -%}
{%- set pfc_to_pg_map_supported_asics = ['mellanox', 'barefoot', 'marvell'] -%}
{
{% if generate_tc_to_pg_map is defined %}
{{- generate_tc_to_pg_map() }}
{% else %}
"TC_TO_PRIORITY_GROUP_MAP": {
"DEFAULT": {
"0": "0",
"1": "0",
"2": "0",
"3": "3",
"4": "4",
"5": "0",
"6": "0",
"7": "7"
}
},
{% endif %}
"MAP_PFC_PRIORITY_TO_QUEUE": {
"DEFAULT": {
"0": "0",
"1": "1",
"2": "2",
"3": "3",
"4": "4",
"5": "5",
"6": "6",
"7": "7"
}
},
"TC_TO_QUEUE_MAP": {
"DEFAULT": {
"0": "0",
"1": "1",
"2": "2",
"3": "3",
"4": "4",
"5": "5",
"6": "6",
"7": "7"
}
},
"DSCP_TO_TC_MAP": {
"DEFAULT": {
"0" : "0",
"1" : "0",
"2" : "0",
"3" : "0",
"4" : "0",
"5" : "0",
"6" : "0",
"7" : "0",
"8" : "0",
"9" : "0",
"10": "0",
"11": "0",
"12": "0",
"13": "0",
"14": "0",
"15": "0",
"16": "0",
"17": "0",
"18": "0",
"19": "0",
"20": "0",
"21": "0",
"22": "0",
"23": "0",
"24": "0",
"25": "0",
"26": "0",
"27": "0",
"28": "0",
"29": "0",
"30": "0",
"31": "0",
"32": "0",
"33": "0",
"34": "0",
"35": "0",
"36": "0",
"37": "0",
"38": "0",
"39": "0",
"40": "0",
"41": "0",
"42": "0",
"43": "0",
"44": "0",
"45": "0",
"46": "0",
"47": "0",
"48": "0",
"49": "0",
"50": "0",
"51": "0",
"52": "0",
"53": "0",
"54": "0",
"55": "0",
"56": "0",
"57": "0",
"58": "0",
"59": "0",
"60": "0",
"61": "0",
"62": "0",
"63": "0"
}
},
"SCHEDULER": {
"scheduler.0": {
"type" : "DWRR",
"weight": "1"
},
"scheduler.1": {
"type" : "DWRR",
"weight": "2"
},
"scheduler.2": {
"type" : "DWRR",
"weight": "3"
},
"scheduler.3": {
"type" : "DWRR",
"weight": "4"
},
"scheduler.4": {
"type" : "DWRR",
"weight": "5"
},
"scheduler.5": {
"type" : "DWRR",
"weight": "10"
},
"scheduler.6": {
"type" : "DWRR",
"weight": "25"
},
"scheduler.7": {
"type" : "DWRR",
"weight": "50"
}
},
"PORT_QOS_MAP": {
"{{ port_names_active }}": {
"dscp_to_tc_map" : "[DSCP_TO_TC_MAP|DEFAULT]",
"tc_to_queue_map" : "[TC_TO_QUEUE_MAP|DEFAULT]",
"pfc_enable" : "3,4",
"pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|DEFAULT]",
"tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|DEFAULT]"
}
},
"QUEUE": {
{% for port in PORT_ACTIVE %}
"{{ port }}|0": {
"scheduler" : "[SCHEDULER|scheduler.0]"
},
{% endfor %}
{% for port in PORT_ACTIVE %}
"{{ port }}|1": {
"scheduler" : "[SCHEDULER|scheduler.1]"
},
{% endfor %}
{% for port in PORT_ACTIVE %}
"{{ port }}|2": {
"scheduler": "[SCHEDULER|scheduler.2]"
},
{% endfor %}
{% for port in PORT_ACTIVE %}
"{{ port }}|3": {
"scheduler": "[SCHEDULER|scheduler.3]"
},
{% endfor %}
{% for port in PORT_ACTIVE %}
"{{ port }}|4": {
"scheduler": "[SCHEDULER|scheduler.4]"
},
{% endfor %}
{% for port in PORT_ACTIVE %}
"{{ port }}|5": {
"scheduler": "[SCHEDULER|scheduler.5]"
},
{% endfor %}
{% for port in PORT_ACTIVE %}
"{{ port }}|6": {
"scheduler": "[SCHEDULER|scheduler.6]"
},
{% endfor %}
{% for port in PORT_ACTIVE %}
"{{ port }}|7": {
"scheduler": "[SCHEDULER|scheduler.7]"
}{% if not loop.last %},{% endif %}
{% endfor %}
}
}

View File

@ -0,0 +1 @@
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th3-snj60d0-32x400G.config.bcm

View File

@ -0,0 +1,266 @@
# This property file is for SNJ60D0-320F 1x400Gx32 mode only.
# SNJ60D0-320F uses Tomahawk3 BCM56980 as its mac. Besides, it is phyless.
led_fw_path="/usr/share/sonic/platform/"
bcm_stat_interval.0=1000000
bcm_linkscan_interval.0=250000
mdio_output_delay.0=0xf
mem_cache_enable=0
parity_enable=0
core_clock_frequency=1325
dpr_clock_frequency=1000
# Merlin Core - 2 management ports
portmap_38=257:10
portmap_118=258:10
# Blackhawk Core - 32 front ports
# BlackhawkCore[0 - 3] must map to device port[1-18], PIPE-0.
portmap_1=1:400
portmap_5=9:400
portmap_9=17:400
portmap_13=25:400
# BlackhawkCore[4 - 7] must map to device port[20-37], PIPE-1.
portmap_20=33:400
portmap_24=41:400
portmap_28=49:400
portmap_32=57:400
# BlackhawkCore[8 - 11] must map to logical port[40-57], PIPE-2.
portmap_40=65:400
portmap_44=73:400
portmap_48=81:400
portmap_52=89:400
# BlackhawkCore[12 - 15] must map to logical port[60-77], PIPE-3.
portmap_60=97:400
portmap_64=105:400
portmap_68=113:400
portmap_72=121:400
# BlackhawkCore[16 - 19] must map to logical port[80-97], PIPE-4.
portmap_80=129:400
portmap_84=137:400
portmap_88=145:400
portmap_92=153:400
# BlackhawkCore[20 - 23] must map to logical port[100-117], PIPE-5.
portmap_100=161:400
portmap_104=169:400
portmap_108=177:400
portmap_112=185:400
# BlackhawkCore[24 - 27] must map to logical port[120-137], PIPE-6.
portmap_120=193:400
portmap_124=201:400
portmap_128=209:400
portmap_132=217:400
# BlackhawkCore[28 - 31] must map to logical port[140-157], PIPE-7.
portmap_140=225:400
portmap_144=233:400
portmap_148=241:400
portmap_152=249:400
# Configure all front port as XE and CD ports.
pbmp_xport_xe=0x0FFFF0FFFF4FFFF0FFFF0FFFF0FFFF4FFFF1FFFE
# Oversubscription mode
pbmp_oversubscribe=0x0FFFF0FFFF4FFFF0FFFF0FFFF0FFFF4FFFF1FFFE
# lane map and polarity
# BlackhawkCore0
phy_chain_rx_lane_map_physical{1.0}=0x47105362
serdes_core_rx_polarity_flip_physical{1}=0xd7
phy_chain_tx_lane_map_physical{1.0}=0x51704263
serdes_core_tx_polarity_flip_physical{1}=0x31
# BlackhawkCore1
phy_chain_rx_lane_map_physical{9.0}=0x12640735
serdes_core_rx_polarity_flip_physical{9}=0x4c
phy_chain_tx_lane_map_physical{9.0}=0x65230714
serdes_core_tx_polarity_flip_physical{9}=0x4c
# BlackhawkCore2
phy_chain_rx_lane_map_physical{17.0}=0x40615273
serdes_core_rx_polarity_flip_physical{17}=0xab
phy_chain_tx_lane_map_physical{17.0}=0x31206745
serdes_core_tx_polarity_flip_physical{17}=0x4f
# BlackhawkCore3
phy_chain_rx_lane_map_physical{25.0}=0x36042715
serdes_core_rx_polarity_flip_physical{25}=0x82
phy_chain_tx_lane_map_physical{25.0}=0x67320415
serdes_core_tx_polarity_flip_physical{25}=0x59
# BlackhawkCore4
phy_chain_rx_lane_map_physical{33.0}=0x10476253
serdes_core_rx_polarity_flip_physical{33}=0xa2
phy_chain_tx_lane_map_physical{33.0}=0x75326041
serdes_core_tx_polarity_flip_physical{33}=0x2e
# BlackhawkCore5
phy_chain_rx_lane_map_physical{41.0}=0x23160547
serdes_core_rx_polarity_flip_physical{41}=0x8d
phy_chain_tx_lane_map_physical{41.0}=0x75236014
serdes_core_tx_polarity_flip_physical{41}=0xc4
# BlackhawkCore6
phy_chain_rx_lane_map_physical{49.0}=0x10765243
serdes_core_rx_polarity_flip_physical{49}=0x98
phy_chain_tx_lane_map_physical{49.0}=0x57306142
serdes_core_tx_polarity_flip_physical{49}=0xab
# BlackhawkCore7
phy_chain_rx_lane_map_physical{57.0}=0x23460517
serdes_core_rx_polarity_flip_physical{57}=0x8d
phy_chain_tx_lane_map_physical{57.0}=0x67230415
serdes_core_tx_polarity_flip_physical{57}=0xe9
# BlackhawkCore8
phy_chain_rx_lane_map_physical{65.0}=0x10674253
serdes_core_rx_polarity_flip_physical{65}=0xa6
phy_chain_tx_lane_map_physical{65.0}=0x57306142
serdes_core_tx_polarity_flip_physical{65}=0x3b
# BlackhawkCore9
phy_chain_rx_lane_map_physical{73.0}=0x23160547
serdes_core_rx_polarity_flip_physical{73}=0x8d
phy_chain_tx_lane_map_physical{73.0}=0x67230514
serdes_core_tx_polarity_flip_physical{73}=0x6c
# BlackhawkCore10
phy_chain_rx_lane_map_physical{81.0}=0x10674253
serdes_core_rx_polarity_flip_physical{81}=0xa6
phy_chain_tx_lane_map_physical{81.0}=0x05326741
serdes_core_tx_polarity_flip_physical{81}=0xae
# BlackhawkCore11
phy_chain_rx_lane_map_physical{89.0}=0x23460517
serdes_core_rx_polarity_flip_physical{89}=0x8d
phy_chain_tx_lane_map_physical{89.0}=0x76230514
serdes_core_tx_polarity_flip_physical{89}=0x8c
# BlackhawkCore12
phy_chain_rx_lane_map_physical{97.0}=0x10674253
serdes_core_rx_polarity_flip_physical{97}=0xa3
phy_chain_tx_lane_map_physical{97.0}=0x57316042
serdes_core_tx_polarity_flip_physical{97}=0x3f
# BlackhawkCore13
phy_chain_rx_lane_map_physical{105.0}=0x64230517
serdes_core_rx_polarity_flip_physical{105}=0x29
phy_chain_tx_lane_map_physical{105.0}=0x67320415
serdes_core_tx_polarity_flip_physical{105}=0x59
# BlackhawkCore14
phy_chain_rx_lane_map_physical{113.0}=0x10476352
serdes_core_rx_polarity_flip_physical{113}=0xa6
phy_chain_tx_lane_map_physical{113.0}=0x57126043
serdes_core_tx_polarity_flip_physical{113}=0x2e
# BlackhawkCore15
phy_chain_rx_lane_map_physical{121.0}=0x46201537
serdes_core_rx_polarity_flip_physical{121}=0xce
phy_chain_tx_lane_map_physical{121.0}=0x23571406
serdes_core_tx_polarity_flip_physical{121}=0x6d
# BlackhawkCore16
phy_chain_rx_lane_map_physical{129.0}=0x67015342
serdes_core_rx_polarity_flip_physical{129}=0x63
phy_chain_tx_lane_map_physical{129.0}=0x32574160
serdes_core_tx_polarity_flip_physical{129}=0xf4
# BlackhawkCore17
phy_chain_rx_lane_map_physical{137.0}=0x23460517
serdes_core_rx_polarity_flip_physical{137}=0x89
phy_chain_tx_lane_map_physical{137.0}=0x57321604
serdes_core_tx_polarity_flip_physical{137}=0xd2
# BlackhawkCore18
phy_chain_rx_lane_map_physical{145.0}=0x01675342
serdes_core_rx_polarity_flip_physical{145}=0x6c
phy_chain_tx_lane_map_physical{145.0}=0x75126043
serdes_core_tx_polarity_flip_physical{145}=0x2e
# BlackhawkCore19
phy_chain_rx_lane_map_physical{153.0}=0x40231567
serdes_core_rx_polarity_flip_physical{153}=0x50
phy_chain_tx_lane_map_physical{153.0}=0x46231705
serdes_core_tx_polarity_flip_physical{153}=0xaf
# BlackhawkCore20
phy_chain_rx_lane_map_physical{161.0}=0x16540273
serdes_core_rx_polarity_flip_physical{161}=0x56
phy_chain_tx_lane_map_physical{161.0}=0x75326041
serdes_core_tx_polarity_flip_physical{161}=0x1f
# BlackhawkCore21
phy_chain_rx_lane_map_physical{169.0}=0x01234567
serdes_core_rx_polarity_flip_physical{169}=0x95
phy_chain_tx_lane_map_physical{169.0}=0x57321604
serdes_core_tx_polarity_flip_physical{169}=0x52
# BlackhawkCore22
phy_chain_rx_lane_map_physical{177.0}=0x16540273
serdes_core_rx_polarity_flip_physical{177}=0xde
phy_chain_tx_lane_map_physical{177.0}=0x57326041
serdes_core_tx_polarity_flip_physical{177}=0x2e
# BlackhawkCore23
phy_chain_rx_lane_map_physical{185.0}=0x01234567
serdes_core_rx_polarity_flip_physical{185}=0x95
phy_chain_tx_lane_map_physical{185.0}=0x57320614
serdes_core_tx_polarity_flip_physical{185}=0x58
# BlackhawkCore24
phy_chain_rx_lane_map_physical{193.0}=0x16540273
serdes_core_rx_polarity_flip_physical{193}=0xde
phy_chain_tx_lane_map_physical{193.0}=0x57326041
serdes_core_tx_polarity_flip_physical{193}=0x2e
# BlackhawkCore25
phy_chain_rx_lane_map_physical{201.0}=0x01234567
serdes_core_rx_polarity_flip_physical{201}=0x95
phy_chain_tx_lane_map_physical{201.0}=0x57230614
serdes_core_tx_polarity_flip_physical{201}=0x68
# BlackhawkCore26
phy_chain_rx_lane_map_physical{209.0}=0x16570243
serdes_core_rx_polarity_flip_physical{209}=0xcc
phy_chain_tx_lane_map_physical{209.0}=0x50316742
serdes_core_tx_polarity_flip_physical{209}=0x35
# BlackhawkCore27
phy_chain_rx_lane_map_physical{217.0}=0x01342567
serdes_core_rx_polarity_flip_physical{217}=0x9d
phy_chain_tx_lane_map_physical{217.0}=0x57320614
serdes_core_tx_polarity_flip_physical{217}=0x58
# BlackhawkCore28
phy_chain_rx_lane_map_physical{225.0}=0x01456273
serdes_core_rx_polarity_flip_physical{225}=0x5d
phy_chain_tx_lane_map_physical{225.0}=0x75326041
serdes_core_tx_polarity_flip_physical{225}=0x2e
# BlackhawkCore29
phy_chain_rx_lane_map_physical{233.0}=0x43102567
serdes_core_rx_polarity_flip_physical{233}=0xa2
phy_chain_tx_lane_map_physical{233.0}=0x56320714
serdes_core_tx_polarity_flip_physical{233}=0x9c
# BlackhawkCore30
phy_chain_rx_lane_map_physical{241.0}=0x01546273
serdes_core_rx_polarity_flip_physical{241}=0x53
phy_chain_tx_lane_map_physical{241.0}=0x57326041
serdes_core_tx_polarity_flip_physical{241}=0x2e
# BlackhawkCore31
phy_chain_rx_lane_map_physical{249.0}=0x64103527
serdes_core_rx_polarity_flip_physical{249}=0xed
phy_chain_tx_lane_map_physical{249.0}=0x32570416
serdes_core_tx_polarity_flip_physical{249}=0x87

View File

@ -0,0 +1 @@
Alphanetworks-SNJ60D0-320F t1

View File

@ -0,0 +1,4 @@
CONSOLE_PORT=0x3f8
CONSOLE_DEV=0
CONSOLE_SPEED=115200
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="modprobe.blacklist=i2c-ismt,i2c_ismt,i2c-i801,i2c_i801"

View File

@ -0,0 +1,11 @@
# LED microprocessor initialization for alphanetworks snj60b0-320f
#LED FW is loaded in SAI platform_init.c
#m0 load 0 0x3800 /alpha/bcm/led/jungfrau-320f_traffic_led.bin
led start
led auto on
# Load SFP Pre-Emphasis static configure
# This is work around for 6-taps mode
#rcload /usr/share/sonic/platform/preemphasis-32x400G.soc

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,118 @@
- bus: '00'
dev: '00'
fn: '0'
id: '1980'
name: 'Host bridge: Intel Corporation Atom Processor C3000 Series System Agent (rev
11)'
- bus: '00'
dev: '04'
fn: '0'
id: 19a1
name: 'Host bridge: Intel Corporation Atom Processor C3000 Series Error Registers
(rev 11)'
- bus: '00'
dev: '05'
fn: '0'
id: 19a2
name: 'Generic system peripheral [0807]: Intel Corporation Atom Processor C3000
Series Root Complex Event Collector (rev 11)'
- bus: '00'
dev: '06'
fn: '0'
id: 19a3
name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series Integrated QAT
Root Port (rev 11)'
- bus: '00'
dev: 0a
fn: '0'
id: 19a5
name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root
Port (rev 11)'
- bus: '00'
dev: 0c
fn: '0'
id: 19a7
name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root
Port (rev 11)'
- bus: '00'
dev: 0e
fn: '0'
id: 19a8
name: 'PCI bridge: Intel Corporation Atom Processor C3000 Series PCI Express Root
Port (rev 11)'
- bus: '00'
dev: '12'
fn: '0'
id: 19ac
name: 'System peripheral: Intel Corporation DNV SMBus Contoller - Host (rev 11)'
- bus: '00'
dev: '13'
fn: '0'
id: 19b2
name: 'SATA controller: Intel Corporation DNV SATA Controller 0 (rev 11)'
- bus: '00'
dev: '14'
fn: '0'
id: 19c2
name: 'SATA controller: Intel Corporation DNV SATA Controller 1 (rev 11)'
- bus: '00'
dev: '15'
fn: '0'
id: 19d0
name: 'USB controller: Intel Corporation Atom Processor C3000 Series USB 3.0 xHCI
Controller (rev 11)'
- bus: '00'
dev: '18'
fn: '0'
id: 19d3
name: 'Communication controller: Intel Corporation Atom Processor C3000 Series ME
HECI 1 (rev 11)'
- bus: '00'
dev: 1a
fn: '0'
id: 19d8
name: 'Serial controller: Intel Corporation Atom Processor C3000 Series HSUART Controller
(rev 11)'
- bus: '00'
dev: 1c
fn: '0'
id: 19db
name: 'SD Host controller: Intel Corporation Device 19db (rev 11)'
- bus: '00'
dev: 1f
fn: '0'
id: 19dc
name: 'ISA bridge: Intel Corporation DNV LPC or eSPI (rev 11)'
- bus: '00'
dev: 1f
fn: '2'
id: 19de
name: 'Memory controller: Intel Corporation Atom Processor C3000 Series Power Management
Controller (rev 11)'
- bus: '00'
dev: 1f
fn: '4'
id: 19df
name: 'SMBus: Intel Corporation DNV SMBus controller (rev 11)'
- bus: '00'
dev: 1f
fn: '5'
id: 19e0
name: 'Serial bus controller [0c80]: Intel Corporation DNV SPI Controller (rev 11)'
- bus: '01'
dev: '00'
fn: '0'
id: 19e2
name: 'Co-processor: Intel Corporation Atom Processor C3000 Series QuickAssist Technology
(rev 11)'
- bus: '04'
dev: '00'
fn: '0'
id: '1533'
name: 'Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev
03)'
- bus: '05'
dev: '00'
fn: '0'
id: b980
name: 'Ethernet controller: Broadcom Limited Device b980 (rev 11)'

View File

@ -0,0 +1,306 @@
{
"interfaces": {
"Ethernet0": {
"breakout_modes": {
"1x400G": ["Ethernet1/1/1"],
"2x200G[100G]": ["Ethernet1/1/1", "Ethernet1/1/2"],
"4x100G[50G]": ["Ethernet1/1/1", "Ethernet1/1/2", "Ethernet1/1/3", "Ethernet1/1/4"]
},
"index": "0,0,0,0,0,0,0,0",
"lanes": "1,2,3,4,5,6,7,8"
},
"Ethernet8": {
"breakout_modes": {
"1x400G": ["Ethernet1/2/1"],
"2x200G[100G]": ["Ethernet1/2/1", "Ethernet1/2/2"],
"4x100G[50G]": ["Ethernet1/2/1", "Ethernet1/2/2", "Ethernet1/2/3", "Ethernet1/2/4"]
},
"index": "1,1,1,1,1,1,1,1",
"lanes": "9,10,11,12,13,14,15,16"
},
"Ethernet16": {
"breakout_modes": {
"1x400G": ["Ethernet1/3/1"],
"2x200G[100G]": ["Ethernet1/3/1", "Ethernet1/3/2"],
"4x100G[50G]": ["Ethernet1/3/1", "Ethernet1/3/2", "Ethernet1/3/3", "Ethernet1/3/4"]
},
"index": "2,2,2,2,2,2,2,2",
"lanes": "17,18,19,20,21,22,23,24"
},
"Ethernet24": {
"breakout_modes": {
"1x400G": ["Ethernet1/4/1"],
"2x200G[100G]": ["Ethernet1/4/1", "Ethernet1/4/2"],
"4x100G[50G]": ["Ethernet1/4/1", "Ethernet1/4/2", "Ethernet1/4/3", "Ethernet1/4/4"]
},
"index": "3,3,3,3,3,3,3,3",
"lanes": "25,26,27,28,29,30,31,32"
},
"Ethernet32": {
"breakout_modes": {
"1x400G": ["Ethernet1/5/1"],
"2x200G[100G]": ["Ethernet1/5/1", "Ethernet1/5/2"],
"4x100G[50G]": ["Ethernet1/5/1", "Ethernet1/5/2", "Ethernet1/5/3", "Ethernet1/5/4"]
},
"index": "4,4,4,4,4,4,4,4",
"lanes": "33,34,35,36,37,38,39,40"
},
"Ethernet40": {
"breakout_modes": {
"1x400G": ["Ethernet1/6/1"],
"2x200G[100G]": ["Ethernet1/6/1", "Ethernet1/6/2"],
"4x100G[50G]": ["Ethernet1/6/1", "Ethernet1/6/2", "Ethernet1/6/3", "Ethernet1/6/4"]
},
"index": "5,5,5,5,5,5,5,5",
"lanes": "41,42,43,44,45,46,47,48"
},
"Ethernet48": {
"breakout_modes": {
"1x400G": ["Ethernet1/7/1"],
"2x200G[100G]": ["Ethernet1/7/1", "Ethernet1/7/2"],
"4x100G[50G]": ["Ethernet1/7/1", "Ethernet1/7/2", "Ethernet1/7/3", "Ethernet1/7/4"]
},
"index": "6,6,6,6,6,6,6,6",
"lanes": "49,50,51,52,53,54,55,56"
},
"Ethernet56": {
"breakout_modes": {
"1x400G": ["Ethernet1/8/1"],
"2x200G[100G]": ["Ethernet1/8/1", "Ethernet1/8/2"],
"4x100G[50G]": ["Ethernet1/8/1", "Ethernet1/8/2", "Ethernet1/8/3", "Ethernet1/8/4"]
},
"index": "7,7,7,7,7,7,7,7",
"lanes": "57,58,59,60,61,62,63,64"
},
"Ethernet64": {
"breakout_modes": {
"1x400G": ["Ethernet1/9/1"],
"2x200G[100G]": ["Ethernet1/9/1", "Ethernet1/9/2"],
"4x100G[50G]": ["Ethernet1/9/1", "Ethernet1/9/2", "Ethernet1/9/3", "Ethernet1/9/4"]
},
"index": "8,8,8,8,8,8,8,8",
"lanes": "65,66,67,68,69,70,71,72"
},
"Ethernet72": {
"breakout_modes": {
"1x400G": ["Ethernet1/10/1"],
"2x200G[100G]": ["Ethernet1/10/1", "Ethernet1/10/2"],
"4x100G[50G]": ["Ethernet1/10/1", "Ethernet1/10/2", "Ethernet1/10/3", "Ethernet1/10/4"]
},
"index": "9,9,9,9,9,9,9,9",
"lanes": "73,74,75,76,77,78,79,80"
},
"Ethernet80": {
"breakout_modes": {
"1x400G": ["Ethernet1/11/1"],
"2x200G[100G]": ["Ethernet1/11/1", "Ethernet1/11/2"],
"4x100G[50G]": ["Ethernet1/11/1", "Ethernet1/11/2", "Ethernet1/11/3", "Ethernet1/11/4"]
},
"index": "10,10,10,10,10,10,10,10",
"lanes": "81,82,83,84,85,86,87,88"
},
"Ethernet88": {
"breakout_modes": {
"1x400G": ["Ethernet1/12/1"],
"2x200G[100G]": ["Ethernet1/12/1", "Ethernet1/12/2"],
"4x100G[50G]": ["Ethernet1/12/1", "Ethernet1/12/2", "Ethernet1/12/3", "Ethernet1/12/4"]
},
"index": "11,11,11,11,11,11,11,11",
"lanes": "89,90,91,92,93,94,95,96"
},
"Ethernet96": {
"breakout_modes": {
"1x400G": ["Ethernet1/13/1"],
"2x200G[100G]": ["Ethernet1/13/1", "Ethernet1/13/2"],
"4x100G[50G]": ["Ethernet1/13/1", "Ethernet1/13/2", "Ethernet1/13/3", "Ethernet1/13/4"]
},
"index": "12,12,12,12,12,12,12,12",
"lanes": "97,98,99,100,101,102,103,104"
},
"Ethernet104": {
"breakout_modes": {
"1x400G": ["Ethernet1/14/1"],
"2x200G[100G]": ["Ethernet1/14/1", "Ethernet1/14/2"],
"4x100G[50G]": ["Ethernet1/14/1", "Ethernet1/14/2", "Ethernet1/14/3", "Ethernet1/14/4"]
},
"index": "13,13,13,13,13,13,13,13",
"lanes": "105,106,107,108,109,110,111,112"
},
"Ethernet112": {
"breakout_modes": {
"1x400G": ["Ethernet1/15/1"],
"2x200G[100G]": ["Ethernet1/15/1", "Ethernet1/15/2"],
"4x100G[50G]": ["Ethernet1/15/1", "Ethernet1/15/2", "Ethernet1/15/3", "Ethernet1/15/4"]
},
"index": "14,14,14,14,14,14,14,14",
"lanes": "113,114,115,116,117,118,119,120"
},
"Ethernet120": {
"breakout_modes": {
"1x400G": ["Ethernet1/16/1"],
"2x200G[100G]": ["Ethernet1/16/1", "Ethernet1/16/2"],
"4x100G[50G]": ["Ethernet1/16/1", "Ethernet1/16/2", "Ethernet1/16/3", "Ethernet1/16/4"]
},
"index": "15,15,15,15,15,15,15,15",
"lanes": "121,122,123,124,125,126,127,128"
},
"Ethernet128": {
"breakout_modes": {
"1x400G": ["Ethernet1/17/1"],
"2x200G[100G]": ["Ethernet1/17/1", "Ethernet1/17/2"],
"4x100G[50G]": ["Ethernet1/17/1", "Ethernet1/17/2", "Ethernet1/17/3", "Ethernet1/17/4"]
},
"index": "16,16,16,16,16,16,16,16",
"lanes": "129,130,131,132,133,134,135,136"
},
"Ethernet136": {
"breakout_modes": {
"1x400G": ["Ethernet1/18/1"],
"2x200G[100G]": ["Ethernet1/18/1", "Ethernet1/18/2"],
"4x100G[50G]": ["Ethernet1/18/1", "Ethernet1/18/2", "Ethernet1/18/3", "Ethernet1/18/4"]
},
"index": "17,17,17,17,17,17,17,17",
"lanes": "137,138,139,140,141,142,143,144"
},
"Ethernet144": {
"breakout_modes": {
"1x400G": ["Ethernet1/19/1"],
"2x200G[100G]": ["Ethernet1/19/1", "Ethernet1/19/2"],
"4x100G[50G]": ["Ethernet1/19/1", "Ethernet1/19/2", "Ethernet1/19/3", "Ethernet1/19/4"]
},
"index": "18,18,18,18,18,18,18,18",
"lanes": "145,146,147,148,149,150,151,152"
},
"Ethernet152": {
"breakout_modes": {
"1x400G": ["Ethernet1/20/1"],
"2x200G[100G]": ["Ethernet1/20/1", "Ethernet1/20/2"],
"4x100G[50G]": ["Ethernet1/20/1", "Ethernet1/20/2", "Ethernet1/20/3", "Ethernet1/20/4"]
},
"index": "19,19,19,19,19,19,19,19",
"lanes": "153,154,155,156,157,158,159,160"
},
"Ethernet160": {
"breakout_modes": {
"1x400G": ["Ethernet1/21/1"],
"2x200G[100G]": ["Ethernet1/21/1", "Ethernet1/21/2"],
"4x100G[50G]": ["Ethernet1/21/1", "Ethernet1/21/2", "Ethernet1/21/3", "Ethernet1/21/4"]
},
"index": "20,20,20,20,20,20,20,20",
"lanes": "161,162,163,164,165,166,167,168"
},
"Ethernet168": {
"breakout_modes": {
"1x400G": ["Ethernet1/22/1"],
"2x200G[100G]": ["Ethernet1/22/1", "Ethernet1/22/2"],
"4x100G[50G]": ["Ethernet1/22/1", "Ethernet1/22/2", "Ethernet1/22/3", "Ethernet1/22/4"]
},
"index": "21,21,21,21,21,21,21,21",
"lanes": "169,170,171,172,173,174,175,176"
},
"Ethernet176": {
"breakout_modes": {
"1x400G": ["Ethernet1/23/1"],
"2x200G[100G]": ["Ethernet1/23/1", "Ethernet1/23/2"],
"4x100G[50G]": ["Ethernet1/23/1", "Ethernet1/23/2", "Ethernet1/23/3", "Ethernet1/23/4"]
},
"index": "22,22,22,22,22,22,22,22",
"lanes": "177,178,179,180,181,182,183,184"
},
"Ethernet184": {
"breakout_modes": {
"1x400G": ["Ethernet1/24/1"],
"2x200G[100G]": ["Ethernet1/24/1", "Ethernet1/24/2"],
"4x100G[50G]": ["Ethernet1/24/1", "Ethernet1/24/2", "Ethernet1/24/3", "Ethernet1/24/4"]
},
"index": "23,23,23,23,23,23,23,23",
"lanes": "185,186,187,188,189,190,191,192"
},
"Ethernet192": {
"breakout_modes": {
"1x400G": ["Ethernet1/25/1"],
"2x200G[100G]": ["Ethernet1/25/1", "Ethernet1/25/2"],
"4x100G[50G]": ["Ethernet1/25/1", "Ethernet1/25/2", "Ethernet1/25/3", "Ethernet1/25/4"]
},
"index": "24,24,24,24,24,24,24,24",
"lanes": "193,194,195,196,197,198,199,200"
},
"Ethernet200": {
"breakout_modes": {
"1x400G": ["Ethernet1/26/1"],
"2x200G[100G]": ["Ethernet1/26/1", "Ethernet1/26/2"],
"4x100G[50G]": ["Ethernet1/26/1", "Ethernet1/26/2", "Ethernet1/26/3", "Ethernet1/26/4"]
},
"index": "25,25,25,25,25,25,25,25",
"lanes": "201,202,203,204,205,206,207,208"
},
"Ethernet208": {
"breakout_modes": {
"1x400G":["Ethernet1/27/1"],
"2x200G[100G]":["Ethernet1/27/1", "Ethernet1/27/2"],
"4x100G[50G]":["Ethernet1/27/1", "Ethernet1/27/2", "Ethernet1/27/3", "Ethernet1/27/4"],
"8x50G":["Ethernet1/27/1", "Ethernet1/27/2", "Ethernet1/27/3", "Ethernet1/27/4", "Ethernet1/27/5", "Ethernet1/27/6", "Ethernet1/27/7", "Ethernet1/27/8"],
"8x25G[10G]":["Ethernet1/27/1", "Ethernet1/27/2", "Ethernet1/27/3", "Ethernet1/27/4", "Ethernet1/27/5", "Ethernet1/27/6", "Ethernet1/27/7", "Ethernet1/27/8"]
},
"index": "26,26,26,26,26,26,26,26",
"lanes": "209,210,211,212,213,214,215,216"
},
"Ethernet216": {
"breakout_modes": {
"1x400G":["Ethernet1/28/1"],
"2x200G[100G]":["Ethernet1/28/1", "Ethernet1/28/2"],
"4x100G[50G]":["Ethernet1/28/1", "Ethernet1/28/2", "Ethernet1/28/3", "Ethernet1/28/4"],
"8x50G":["Ethernet1/28/1", "Ethernet1/28/2", "Ethernet1/28/3", "Ethernet1/28/4", "Ethernet1/28/5", "Ethernet1/28/6", "Ethernet1/28/7", "Ethernet1/28/8"],
"8x25G[10G]":["Ethernet1/28/1", "Ethernet1/28/2", "Ethernet1/28/3", "Ethernet1/28/4", "Ethernet1/28/5", "Ethernet1/28/6", "Ethernet1/28/7", "Ethernet1/28/8"]
},
"index": "27,27,27,27,27,27,27,27",
"lanes": "217,218,219,220,221,222,223,224"
},
"Ethernet224": {
"breakout_modes": {
"1x400G":["Ethernet1/29/1"]
},
"index": "28,28,28,28,28,28,28,28",
"lanes": "225,226,227,228,229,230,231,232"
},
"Ethernet232": {
"breakout_modes": {
"1x400G":["Ethernet1/30/1"]
},
"index": "29,29,29,29,29,29,29,29",
"lanes": "233,234,235,236,237,238,239,240"
},
"Ethernet240": {
"breakout_modes": {
"1x400G": ["Ethernet1/31/1"],
"2x200G[100G]": ["Ethernet1/31/1", "Ethernet1/31/2"],
"4x100G[50G]": ["Ethernet1/31/1", "Ethernet1/31/2", "Ethernet1/31/3", "Ethernet1/31/4"]
},
"index": "30,30,30,30,30,30,30,30",
"lanes": "241,242,243,244,245,246,247,248"
},
"Ethernet248": {
"breakout_modes": {
"1x400G": ["Ethernet1/32/1"],
"2x200G[100G]": ["Ethernet1/32/1", "Ethernet1/32/2"],
"4x100G[50G]": ["Ethernet1/32/1", "Ethernet1/32/2", "Ethernet1/32/3", "Ethernet1/1/4"]
},
"index": "31,31,31,31,31,31,31,31",
"lanes": "249,250,251,252,253,254,255,256"
},
"Ethernet256": {
"breakout_modes": {
"1x10G": ["Ethernet1/33"]
},
"index": "32",
"lanes": "257"
},
"Ethernet257": {
"breakout_modes": {
"1x10G": ["Ethernet1/34"]
},
"index": "33",
"lanes": "258"
}
}
}

View File

@ -0,0 +1 @@
broadcom

View File

@ -0,0 +1,2 @@
dmasize=32M
usemsi=0

View File

@ -0,0 +1,5 @@
{
"skip_ledd": true,
"skip_fancontrol": true
}

View File

@ -0,0 +1,954 @@
# Preemphasis
# port1 (DAC)
phy raw c45 0x81 0x1 0xffde 0
phy raw c45 0x81 0x1 0xd134 0x1e0
phy raw c45 0x81 0x1 0xd135 0x88
phy raw c45 0x81 0x1 0xd136 0x0
phy raw c45 0x81 0x1 0xffde 1
phy raw c45 0x81 0x1 0xd134 0x1e0
phy raw c45 0x81 0x1 0xd135 0x88
phy raw c45 0x81 0x1 0xd136 0x0
phy raw c45 0x81 0x1 0xffde 2
phy raw c45 0x81 0x1 0xd134 0x1e0
phy raw c45 0x81 0x1 0xd135 0x88
phy raw c45 0x81 0x1 0xd136 0x0
phy raw c45 0x81 0x1 0xffde 3
phy raw c45 0x81 0x1 0xd134 0x1e0
phy raw c45 0x81 0x1 0xd135 0x88
phy raw c45 0x81 0x1 0xd136 0x0
phy raw c45 0x81 0x1 0xffde 4
phy raw c45 0x81 0x1 0xd134 0x1e0
phy raw c45 0x81 0x1 0xd135 0x88
phy raw c45 0x81 0x1 0xd136 0x0
phy raw c45 0x81 0x1 0xffde 5
phy raw c45 0x81 0x1 0xd134 0x1e0
phy raw c45 0x81 0x1 0xd135 0x88
phy raw c45 0x81 0x1 0xd136 0x0
phy raw c45 0x81 0x1 0xffde 6
phy raw c45 0x81 0x1 0xd134 0x1e0
phy raw c45 0x81 0x1 0xd135 0x88
phy raw c45 0x81 0x1 0xd136 0x0
phy raw c45 0x81 0x1 0xffde 7
phy raw c45 0x81 0x1 0xd134 0x1e0
phy raw c45 0x81 0x1 0xd135 0x88
phy raw c45 0x81 0x1 0xd136 0x0
# port2 (DAC)
phy raw c45 0x89 0x1 0xffde 0
phy raw c45 0x89 0x1 0xd134 0x1e4
phy raw c45 0x89 0x1 0xd135 0x88
phy raw c45 0x89 0x1 0xd136 0x0
phy raw c45 0x89 0x1 0xffde 1
phy raw c45 0x89 0x1 0xd134 0x1e4
phy raw c45 0x89 0x1 0xd135 0x88
phy raw c45 0x89 0x1 0xd136 0x0
phy raw c45 0x89 0x1 0xffde 2
phy raw c45 0x89 0x1 0xd134 0x1e4
phy raw c45 0x89 0x1 0xd135 0x88
phy raw c45 0x89 0x1 0xd136 0x0
phy raw c45 0x89 0x1 0xffde 3
phy raw c45 0x89 0x1 0xd134 0x1e4
phy raw c45 0x89 0x1 0xd135 0x88
phy raw c45 0x89 0x1 0xd136 0x0
phy raw c45 0x89 0x1 0xffde 4
phy raw c45 0x89 0x1 0xd134 0x1e4
phy raw c45 0x89 0x1 0xd135 0x88
phy raw c45 0x89 0x1 0xd136 0x0
phy raw c45 0x89 0x1 0xffde 5
phy raw c45 0x89 0x1 0xd134 0x1e4
phy raw c45 0x89 0x1 0xd135 0x88
phy raw c45 0x89 0x1 0xd136 0x0
phy raw c45 0x89 0x1 0xffde 6
phy raw c45 0x89 0x1 0xd134 0x1e4
phy raw c45 0x89 0x1 0xd135 0x88
phy raw c45 0x89 0x1 0xd136 0x0
phy raw c45 0x89 0x1 0xffde 7
phy raw c45 0x89 0x1 0xd134 0x1e4
phy raw c45 0x89 0x1 0xd135 0x88
phy raw c45 0x89 0x1 0xd136 0x0
# port3 (DAC)
phy raw c45 0x91 0x1 0xffde 0
phy raw c45 0x91 0x1 0xd134 0x1e1
phy raw c45 0x91 0x1 0xd135 0x89
phy raw c45 0x91 0x1 0xd136 0x0
phy raw c45 0x91 0x1 0xffde 1
phy raw c45 0x91 0x1 0xd134 0x1e1
phy raw c45 0x91 0x1 0xd135 0x89
phy raw c45 0x91 0x1 0xd136 0x0
phy raw c45 0x91 0x1 0xffde 2
phy raw c45 0x91 0x1 0xd134 0x1e1
phy raw c45 0x91 0x1 0xd135 0x89
phy raw c45 0x91 0x1 0xd136 0x0
phy raw c45 0x91 0x1 0xffde 3
phy raw c45 0x91 0x1 0xd134 0x1e1
phy raw c45 0x91 0x1 0xd135 0x89
phy raw c45 0x91 0x1 0xd136 0x0
phy raw c45 0x91 0x1 0xffde 4
phy raw c45 0x91 0x1 0xd134 0x1e1
phy raw c45 0x91 0x1 0xd135 0x89
phy raw c45 0x91 0x1 0xd136 0x0
phy raw c45 0x91 0x1 0xffde 5
phy raw c45 0x91 0x1 0xd134 0x1e1
phy raw c45 0x91 0x1 0xd135 0x89
phy raw c45 0x91 0x1 0xd136 0x0
phy raw c45 0x91 0x1 0xffde 6
phy raw c45 0x91 0x1 0xd134 0x1e1
phy raw c45 0x91 0x1 0xd135 0x89
phy raw c45 0x91 0x1 0xd136 0x0
phy raw c45 0x91 0x1 0xffde 7
phy raw c45 0x91 0x1 0xd134 0x1e1
phy raw c45 0x91 0x1 0xd135 0x89
phy raw c45 0x91 0x1 0xd136 0x0
# port4 (DAC)
phy raw c45 0xa1 0x1 0xffde 0
phy raw c45 0xa1 0x1 0xd134 0x1e0
phy raw c45 0xa1 0x1 0xd135 0x88
phy raw c45 0xa1 0x1 0xd136 0x0
phy raw c45 0xa1 0x1 0xffde 1
phy raw c45 0xa1 0x1 0xd134 0x1e0
phy raw c45 0xa1 0x1 0xd135 0x88
phy raw c45 0xa1 0x1 0xd136 0x0
phy raw c45 0xa1 0x1 0xffde 2
phy raw c45 0xa1 0x1 0xd134 0x1e0
phy raw c45 0xa1 0x1 0xd135 0x88
phy raw c45 0xa1 0x1 0xd136 0x0
phy raw c45 0xa1 0x1 0xffde 3
phy raw c45 0xa1 0x1 0xd134 0x1e0
phy raw c45 0xa1 0x1 0xd135 0x88
phy raw c45 0xa1 0x1 0xd136 0x0
phy raw c45 0xa1 0x1 0xffde 4
phy raw c45 0xa1 0x1 0xd134 0x1e0
phy raw c45 0xa1 0x1 0xd135 0x88
phy raw c45 0xa1 0x1 0xd136 0x0
phy raw c45 0xa1 0x1 0xffde 5
phy raw c45 0xa1 0x1 0xd134 0x1e0
phy raw c45 0xa1 0x1 0xd135 0x88
phy raw c45 0xa1 0x1 0xd136 0x0
phy raw c45 0xa1 0x1 0xffde 6
phy raw c45 0xa1 0x1 0xd134 0x1e0
phy raw c45 0xa1 0x1 0xd135 0x88
phy raw c45 0xa1 0x1 0xd136 0x0
phy raw c45 0xa1 0x1 0xffde 7
phy raw c45 0xa1 0x1 0xd134 0x1e0
phy raw c45 0xa1 0x1 0xd135 0x88
phy raw c45 0xa1 0x1 0xd136 0x0
# port5 (DAC)
phy raw c45 0xa9 0x1 0xffde 0
phy raw c45 0xa9 0x1 0xd134 0x1e8
phy raw c45 0xa9 0x1 0xd135 0x90
phy raw c45 0xa9 0x1 0xd136 0x0
phy raw c45 0xa9 0x1 0xffde 1
phy raw c45 0xa9 0x1 0xd134 0x1e8
phy raw c45 0xa9 0x1 0xd135 0x90
phy raw c45 0xa9 0x1 0xd136 0x0
phy raw c45 0xa9 0x1 0xffde 2
phy raw c45 0xa9 0x1 0xd134 0x1e8
phy raw c45 0xa9 0x1 0xd135 0x90
phy raw c45 0xa9 0x1 0xd136 0x0
phy raw c45 0xa9 0x1 0xffde 3
phy raw c45 0xa9 0x1 0xd134 0x1e8
phy raw c45 0xa9 0x1 0xd135 0x90
phy raw c45 0xa9 0x1 0xd136 0x0
phy raw c45 0xa9 0x1 0xffde 4
phy raw c45 0xa9 0x1 0xd134 0x1e8
phy raw c45 0xa9 0x1 0xd135 0x90
phy raw c45 0xa9 0x1 0xd136 0x0
phy raw c45 0xa9 0x1 0xffde 5
phy raw c45 0xa9 0x1 0xd134 0x1e8
phy raw c45 0xa9 0x1 0xd135 0x90
phy raw c45 0xa9 0x1 0xd136 0x0
phy raw c45 0xa9 0x1 0xffde 6
phy raw c45 0xa9 0x1 0xd134 0x1e8
phy raw c45 0xa9 0x1 0xd135 0x90
phy raw c45 0xa9 0x1 0xd136 0x0
phy raw c45 0xa9 0x1 0xffde 7
phy raw c45 0xa9 0x1 0xd134 0x1e8
phy raw c45 0xa9 0x1 0xd135 0x90
phy raw c45 0xa9 0x1 0xd136 0x0
# port6 (DAC)
phy raw c45 0xb1 0x1 0xffde 0
phy raw c45 0xb1 0x1 0xd134 0x1e4
phy raw c45 0xb1 0x1 0xd135 0x8c
phy raw c45 0xb1 0x1 0xd136 0x0
phy raw c45 0xb1 0x1 0xffde 1
phy raw c45 0xb1 0x1 0xd134 0x1e4
phy raw c45 0xb1 0x1 0xd135 0x8c
phy raw c45 0xb1 0x1 0xd136 0x0
phy raw c45 0xb1 0x1 0xffde 2
phy raw c45 0xb1 0x1 0xd134 0x1e4
phy raw c45 0xb1 0x1 0xd135 0x8c
phy raw c45 0xb1 0x1 0xd136 0x0
phy raw c45 0xb1 0x1 0xffde 3
phy raw c45 0xb1 0x1 0xd134 0x1e4
phy raw c45 0xb1 0x1 0xd135 0x8c
phy raw c45 0xb1 0x1 0xd136 0x0
phy raw c45 0xb1 0x1 0xffde 4
phy raw c45 0xb1 0x1 0xd134 0x1e4
phy raw c45 0xb1 0x1 0xd135 0x8c
phy raw c45 0xb1 0x1 0xd136 0x0
phy raw c45 0xb1 0x1 0xffde 5
phy raw c45 0xb1 0x1 0xd134 0x1e4
phy raw c45 0xb1 0x1 0xd135 0x8c
phy raw c45 0xb1 0x1 0xd136 0x0
phy raw c45 0xb1 0x1 0xffde 6
phy raw c45 0xb1 0x1 0xd134 0x1e4
phy raw c45 0xb1 0x1 0xd135 0x8c
phy raw c45 0xb1 0x1 0xd136 0x0
phy raw c45 0xb1 0x1 0xffde 7
phy raw c45 0xb1 0x1 0xd134 0x1e4
phy raw c45 0xb1 0x1 0xd135 0x8c
phy raw c45 0xb1 0x1 0xd136 0x0
# port7 (DAC)
phy raw c45 0xc1 0x1 0xffde 0
phy raw c45 0xc1 0x1 0xd134 0x1e5
phy raw c45 0xc1 0x1 0xd135 0x8d
phy raw c45 0xc1 0x1 0xd136 0x0
phy raw c45 0xc1 0x1 0xffde 1
phy raw c45 0xc1 0x1 0xd134 0x1e5
phy raw c45 0xc1 0x1 0xd135 0x8d
phy raw c45 0xc1 0x1 0xd136 0x0
phy raw c45 0xc1 0x1 0xffde 2
phy raw c45 0xc1 0x1 0xd134 0x1e5
phy raw c45 0xc1 0x1 0xd135 0x8d
phy raw c45 0xc1 0x1 0xd136 0x0
phy raw c45 0xc1 0x1 0xffde 3
phy raw c45 0xc1 0x1 0xd134 0x1e5
phy raw c45 0xc1 0x1 0xd135 0x8d
phy raw c45 0xc1 0x1 0xd136 0x0
phy raw c45 0xc1 0x1 0xffde 4
phy raw c45 0xc1 0x1 0xd134 0x1e5
phy raw c45 0xc1 0x1 0xd135 0x8d
phy raw c45 0xc1 0x1 0xd136 0x0
phy raw c45 0xc1 0x1 0xffde 5
phy raw c45 0xc1 0x1 0xd134 0x1e5
phy raw c45 0xc1 0x1 0xd135 0x8d
phy raw c45 0xc1 0x1 0xd136 0x0
phy raw c45 0xc1 0x1 0xffde 6
phy raw c45 0xc1 0x1 0xd134 0x1e5
phy raw c45 0xc1 0x1 0xd135 0x8d
phy raw c45 0xc1 0x1 0xd136 0x0
phy raw c45 0xc1 0x1 0xffde 7
phy raw c45 0xc1 0x1 0xd134 0x1e5
phy raw c45 0xc1 0x1 0xd135 0x8d
phy raw c45 0xc1 0x1 0xd136 0x0
# port8 (DAC)
phy raw c45 0xc9 0x1 0xffde 0
phy raw c45 0xc9 0x1 0xd134 0x1e8
phy raw c45 0xc9 0x1 0xd135 0x8c
phy raw c45 0xc9 0x1 0xd136 0x0
phy raw c45 0xc9 0x1 0xffde 1
phy raw c45 0xc9 0x1 0xd134 0x1e8
phy raw c45 0xc9 0x1 0xd135 0x8c
phy raw c45 0xc9 0x1 0xd136 0x0
phy raw c45 0xc9 0x1 0xffde 2
phy raw c45 0xc9 0x1 0xd134 0x1e8
phy raw c45 0xc9 0x1 0xd135 0x8c
phy raw c45 0xc9 0x1 0xd136 0x0
phy raw c45 0xc9 0x1 0xffde 3
phy raw c45 0xc9 0x1 0xd134 0x1e8
phy raw c45 0xc9 0x1 0xd135 0x8c
phy raw c45 0xc9 0x1 0xd136 0x0
phy raw c45 0xc9 0x1 0xffde 4
phy raw c45 0xc9 0x1 0xd134 0x1e8
phy raw c45 0xc9 0x1 0xd135 0x8c
phy raw c45 0xc9 0x1 0xd136 0x0
phy raw c45 0xc9 0x1 0xffde 5
phy raw c45 0xc9 0x1 0xd134 0x1e8
phy raw c45 0xc9 0x1 0xd135 0x8c
phy raw c45 0xc9 0x1 0xd136 0x0
phy raw c45 0xc9 0x1 0xffde 6
phy raw c45 0xc9 0x1 0xd134 0x1e8
phy raw c45 0xc9 0x1 0xd135 0x8c
phy raw c45 0xc9 0x1 0xd136 0x0
phy raw c45 0xc9 0x1 0xffde 7
phy raw c45 0xc9 0x1 0xd134 0x1e8
phy raw c45 0xc9 0x1 0xd135 0x8c
phy raw c45 0xc9 0x1 0xd136 0x0
# port9 (Fiber)
phy raw c45 0xd1 0x1 0xffde 0
phy raw c45 0xd1 0x1 0xd134 0x1f1
phy raw c45 0xd1 0x1 0xd135 0x8c
phy raw c45 0xd1 0x1 0xd136 0x1f1
phy raw c45 0xd1 0x1 0xffde 1
phy raw c45 0xd1 0x1 0xd134 0x1f1
phy raw c45 0xd1 0x1 0xd135 0x8c
phy raw c45 0xd1 0x1 0xd136 0x1f1
phy raw c45 0xd1 0x1 0xffde 2
phy raw c45 0xd1 0x1 0xd134 0x1f1
phy raw c45 0xd1 0x1 0xd135 0x8c
phy raw c45 0xd1 0x1 0xd136 0x1f1
phy raw c45 0xd1 0x1 0xffde 3
phy raw c45 0xd1 0x1 0xd134 0x1f1
phy raw c45 0xd1 0x1 0xd135 0x8c
phy raw c45 0xd1 0x1 0xd136 0x1f1
phy raw c45 0xd1 0x1 0xffde 4
phy raw c45 0xd1 0x1 0xd134 0x1f1
phy raw c45 0xd1 0x1 0xd135 0x8c
phy raw c45 0xd1 0x1 0xd136 0x1f1
phy raw c45 0xd1 0x1 0xffde 5
phy raw c45 0xd1 0x1 0xd134 0x1f1
phy raw c45 0xd1 0x1 0xd135 0x8c
phy raw c45 0xd1 0x1 0xd136 0x1f1
phy raw c45 0xd1 0x1 0xffde 6
phy raw c45 0xd1 0x1 0xd134 0x1f1
phy raw c45 0xd1 0x1 0xd135 0x8c
phy raw c45 0xd1 0x1 0xd136 0x1f1
phy raw c45 0xd1 0x1 0xffde 7
phy raw c45 0xd1 0x1 0xd134 0x1f1
phy raw c45 0xd1 0x1 0xd135 0x8c
phy raw c45 0xd1 0x1 0xd136 0x1f1
# port10 (Fiber)
phy raw c45 0xe1 0x1 0xffde 0
phy raw c45 0xe1 0x1 0xd134 0x1f1
phy raw c45 0xe1 0x1 0xd135 0x8c
phy raw c45 0xe1 0x1 0xd136 0x1f1
phy raw c45 0xe1 0x1 0xffde 1
phy raw c45 0xe1 0x1 0xd134 0x1f1
phy raw c45 0xe1 0x1 0xd135 0x8c
phy raw c45 0xe1 0x1 0xd136 0x1f1
phy raw c45 0xe1 0x1 0xffde 2
phy raw c45 0xe1 0x1 0xd134 0x1f1
phy raw c45 0xe1 0x1 0xd135 0x8c
phy raw c45 0xe1 0x1 0xd136 0x1f1
phy raw c45 0xe1 0x1 0xffde 3
phy raw c45 0xe1 0x1 0xd134 0x1f1
phy raw c45 0xe1 0x1 0xd135 0x8c
phy raw c45 0xe1 0x1 0xd136 0x1f1
phy raw c45 0xe1 0x1 0xffde 4
phy raw c45 0xe1 0x1 0xd134 0x1f1
phy raw c45 0xe1 0x1 0xd135 0x8c
phy raw c45 0xe1 0x1 0xd136 0x1f1
phy raw c45 0xe1 0x1 0xffde 5
phy raw c45 0xe1 0x1 0xd134 0x1f1
phy raw c45 0xe1 0x1 0xd135 0x8c
phy raw c45 0xe1 0x1 0xd136 0x1f1
phy raw c45 0xe1 0x1 0xffde 6
phy raw c45 0xe1 0x1 0xd134 0x1f1
phy raw c45 0xe1 0x1 0xd135 0x8c
phy raw c45 0xe1 0x1 0xd136 0x1f1
phy raw c45 0xe1 0x1 0xffde 7
phy raw c45 0xe1 0x1 0xd134 0x1f1
phy raw c45 0xe1 0x1 0xd135 0x8c
phy raw c45 0xe1 0x1 0xd136 0x1f1
# port11 (Fiber)
phy raw c45 0xe9 0x1 0xffde 0
phy raw c45 0xe9 0x1 0xd134 0x1f4
phy raw c45 0xe9 0x1 0xd135 0x92
phy raw c45 0xe9 0x1 0xd136 0x1f4
phy raw c45 0xe9 0x1 0xffde 1
phy raw c45 0xe9 0x1 0xd134 0x1f4
phy raw c45 0xe9 0x1 0xd135 0x92
phy raw c45 0xe9 0x1 0xd136 0x1f4
phy raw c45 0xe9 0x1 0xffde 2
phy raw c45 0xe9 0x1 0xd134 0x1f4
phy raw c45 0xe9 0x1 0xd135 0x92
phy raw c45 0xe9 0x1 0xd136 0x1f4
phy raw c45 0xe9 0x1 0xffde 3
phy raw c45 0xe9 0x1 0xd134 0x1f4
phy raw c45 0xe9 0x1 0xd135 0x92
phy raw c45 0xe9 0x1 0xd136 0x1f4
phy raw c45 0xe9 0x1 0xffde 4
phy raw c45 0xe9 0x1 0xd134 0x1f4
phy raw c45 0xe9 0x1 0xd135 0x92
phy raw c45 0xe9 0x1 0xd136 0x1f4
phy raw c45 0xe9 0x1 0xffde 5
phy raw c45 0xe9 0x1 0xd134 0x1f4
phy raw c45 0xe9 0x1 0xd135 0x92
phy raw c45 0xe9 0x1 0xd136 0x1f4
phy raw c45 0xe9 0x1 0xffde 6
phy raw c45 0xe9 0x1 0xd134 0x1f4
phy raw c45 0xe9 0x1 0xd135 0x92
phy raw c45 0xe9 0x1 0xd136 0x1f4
phy raw c45 0xe9 0x1 0xffde 7
phy raw c45 0xe9 0x1 0xd134 0x1f4
phy raw c45 0xe9 0x1 0xd135 0x92
phy raw c45 0xe9 0x1 0xd136 0x1f4
# port12 (Fiber)
phy raw c45 0xf1 0x1 0xffde 0
phy raw c45 0xf1 0x1 0xd134 0x1f6
phy raw c45 0xf1 0x1 0xd135 0x96
phy raw c45 0xf1 0x1 0xd136 0x1f6
phy raw c45 0xf1 0x1 0xffde 1
phy raw c45 0xf1 0x1 0xd134 0x1f6
phy raw c45 0xf1 0x1 0xd135 0x96
phy raw c45 0xf1 0x1 0xd136 0x1f6
phy raw c45 0xf1 0x1 0xffde 2
phy raw c45 0xf1 0x1 0xd134 0x1f6
phy raw c45 0xf1 0x1 0xd135 0x96
phy raw c45 0xf1 0x1 0xd136 0x1f6
phy raw c45 0xf1 0x1 0xffde 3
phy raw c45 0xf1 0x1 0xd134 0x1f6
phy raw c45 0xf1 0x1 0xd135 0x96
phy raw c45 0xf1 0x1 0xd136 0x1f6
phy raw c45 0xf1 0x1 0xffde 4
phy raw c45 0xf1 0x1 0xd134 0x1f6
phy raw c45 0xf1 0x1 0xd135 0x96
phy raw c45 0xf1 0x1 0xd136 0x1f6
phy raw c45 0xf1 0x1 0xffde 5
phy raw c45 0xf1 0x1 0xd134 0x1f6
phy raw c45 0xf1 0x1 0xd135 0x96
phy raw c45 0xf1 0x1 0xd136 0x1f6
phy raw c45 0xf1 0x1 0xffde 6
phy raw c45 0xf1 0x1 0xd134 0x1f6
phy raw c45 0xf1 0x1 0xd135 0x96
phy raw c45 0xf1 0x1 0xd136 0x1f6
phy raw c45 0xf1 0x1 0xffde 7
phy raw c45 0xf1 0x1 0xd134 0x1f6
phy raw c45 0xf1 0x1 0xd135 0x96
phy raw c45 0xf1 0x1 0xd136 0x1f6
# port13 (Fiber)
phy raw c45 0x181 0x1 0xffde 0
phy raw c45 0x181 0x1 0xd134 0x1f3
phy raw c45 0x181 0x1 0xd135 0x90
phy raw c45 0x181 0x1 0xd136 0x1f3
phy raw c45 0x181 0x1 0xffde 1
phy raw c45 0x181 0x1 0xd134 0x1f3
phy raw c45 0x181 0x1 0xd135 0x90
phy raw c45 0x181 0x1 0xd136 0x1f3
phy raw c45 0x181 0x1 0xffde 2
phy raw c45 0x181 0x1 0xd134 0x1f3
phy raw c45 0x181 0x1 0xd135 0x90
phy raw c45 0x181 0x1 0xd136 0x1f3
phy raw c45 0x181 0x1 0xffde 3
phy raw c45 0x181 0x1 0xd134 0x1f3
phy raw c45 0x181 0x1 0xd135 0x90
phy raw c45 0x181 0x1 0xd136 0x1f3
phy raw c45 0x181 0x1 0xffde 4
phy raw c45 0x181 0x1 0xd134 0x1f3
phy raw c45 0x181 0x1 0xd135 0x90
phy raw c45 0x181 0x1 0xd136 0x1f3
phy raw c45 0x181 0x1 0xffde 5
phy raw c45 0x181 0x1 0xd134 0x1f3
phy raw c45 0x181 0x1 0xd135 0x90
phy raw c45 0x181 0x1 0xd136 0x1f3
phy raw c45 0x181 0x1 0xffde 6
phy raw c45 0x181 0x1 0xd134 0x1f3
phy raw c45 0x181 0x1 0xd135 0x90
phy raw c45 0x181 0x1 0xd136 0x1f3
phy raw c45 0x181 0x1 0xffde 7
phy raw c45 0x181 0x1 0xd134 0x1f3
phy raw c45 0x181 0x1 0xd135 0x90
phy raw c45 0x181 0x1 0xd136 0x1f3
# port14 (Fiber)
phy raw c45 0x189 0x1 0xffde 0
phy raw c45 0x189 0x1 0xd134 0x1f5
phy raw c45 0x189 0x1 0xd135 0x94
phy raw c45 0x189 0x1 0xd136 0x1f5
phy raw c45 0x189 0x1 0xffde 1
phy raw c45 0x189 0x1 0xd134 0x1f5
phy raw c45 0x189 0x1 0xd135 0x94
phy raw c45 0x189 0x1 0xd136 0x1f5
phy raw c45 0x189 0x1 0xffde 2
phy raw c45 0x189 0x1 0xd134 0x1f5
phy raw c45 0x189 0x1 0xd135 0x94
phy raw c45 0x189 0x1 0xd136 0x1f5
phy raw c45 0x189 0x1 0xffde 3
phy raw c45 0x189 0x1 0xd134 0x1f5
phy raw c45 0x189 0x1 0xd135 0x94
phy raw c45 0x189 0x1 0xd136 0x1f5
phy raw c45 0x189 0x1 0xffde 4
phy raw c45 0x189 0x1 0xd134 0x1f5
phy raw c45 0x189 0x1 0xd135 0x94
phy raw c45 0x189 0x1 0xd136 0x1f5
phy raw c45 0x189 0x1 0xffde 5
phy raw c45 0x189 0x1 0xd134 0x1f5
phy raw c45 0x189 0x1 0xd135 0x94
phy raw c45 0x189 0x1 0xd136 0x1f5
phy raw c45 0x189 0x1 0xffde 6
phy raw c45 0x189 0x1 0xd134 0x1f5
phy raw c45 0x189 0x1 0xd135 0x94
phy raw c45 0x189 0x1 0xd136 0x1f5
phy raw c45 0x189 0x1 0xffde 7
phy raw c45 0x189 0x1 0xd134 0x1f5
phy raw c45 0x189 0x1 0xd135 0x94
phy raw c45 0x189 0x1 0xd136 0x1f5
# port15 (Fiber)
phy raw c45 0x191 0x1 0xffde 0
phy raw c45 0x191 0x1 0xd134 0x1f7
phy raw c45 0x191 0x1 0xd135 0x98
phy raw c45 0x191 0x1 0xd136 0x1f7
phy raw c45 0x191 0x1 0xffde 1
phy raw c45 0x191 0x1 0xd134 0x1f7
phy raw c45 0x191 0x1 0xd135 0x98
phy raw c45 0x191 0x1 0xd136 0x1f7
phy raw c45 0x191 0x1 0xffde 2
phy raw c45 0x191 0x1 0xd134 0x1f7
phy raw c45 0x191 0x1 0xd135 0x98
phy raw c45 0x191 0x1 0xd136 0x1f7
phy raw c45 0x191 0x1 0xffde 3
phy raw c45 0x191 0x1 0xd134 0x1f7
phy raw c45 0x191 0x1 0xd135 0x98
phy raw c45 0x191 0x1 0xd136 0x1f7
phy raw c45 0x191 0x1 0xffde 4
phy raw c45 0x191 0x1 0xd134 0x1f7
phy raw c45 0x191 0x1 0xd135 0x98
phy raw c45 0x191 0x1 0xd136 0x1f7
phy raw c45 0x191 0x1 0xffde 5
phy raw c45 0x191 0x1 0xd134 0x1f7
phy raw c45 0x191 0x1 0xd135 0x98
phy raw c45 0x191 0x1 0xd136 0x1f7
phy raw c45 0x191 0x1 0xffde 6
phy raw c45 0x191 0x1 0xd134 0x0
phy raw c45 0x191 0x1 0xd135 0x96
phy raw c45 0x191 0x1 0xd136 0x0
phy raw c45 0x191 0x1 0xffde 7
phy raw c45 0x191 0x1 0xd134 0x1f7
phy raw c45 0x191 0x1 0xd135 0x98
phy raw c45 0x191 0x1 0xd136 0x1f7
# port16 (Fiber)
phy raw c45 0x1a1 0x1 0xffde 0
phy raw c45 0x1a1 0x1 0xd134 0x1f6
phy raw c45 0x1a1 0x1 0xd135 0x96
phy raw c45 0x1a1 0x1 0xd136 0x1f6
phy raw c45 0x1a1 0x1 0xffde 1
phy raw c45 0x1a1 0x1 0xd134 0x1f6
phy raw c45 0x1a1 0x1 0xd135 0x96
phy raw c45 0x1a1 0x1 0xd136 0x1f6
phy raw c45 0x1a1 0x1 0xffde 2
phy raw c45 0x1a1 0x1 0xd134 0x1f6
phy raw c45 0x1a1 0x1 0xd135 0x96
phy raw c45 0x1a1 0x1 0xd136 0x1f6
phy raw c45 0x1a1 0x1 0xffde 3
phy raw c45 0x1a1 0x1 0xd134 0x1f6
phy raw c45 0x1a1 0x1 0xd135 0x96
phy raw c45 0x1a1 0x1 0xd136 0x1f6
phy raw c45 0x1a1 0x1 0xffde 4
phy raw c45 0x1a1 0x1 0xd134 0x1f6
phy raw c45 0x1a1 0x1 0xd135 0x96
phy raw c45 0x1a1 0x1 0xd136 0x1f6
phy raw c45 0x1a1 0x1 0xffde 5
phy raw c45 0x1a1 0x1 0xd134 0x1f6
phy raw c45 0x1a1 0x1 0xd135 0x96
phy raw c45 0x1a1 0x1 0xd136 0x1f6
phy raw c45 0x1a1 0x1 0xffde 6
phy raw c45 0x1a1 0x1 0xd134 0x1f6
phy raw c45 0x1a1 0x1 0xd135 0x96
phy raw c45 0x1a1 0x1 0xd136 0x1f6
phy raw c45 0x1a1 0x1 0xffde 7
phy raw c45 0x1a1 0x1 0xd134 0x1f6
phy raw c45 0x1a1 0x1 0xd135 0x96
phy raw c45 0x1a1 0x1 0xd136 0x1f6
# port17 (Fiber)
phy raw c45 0x1a9 0x1 0xffde 0
phy raw c45 0x1a9 0x1 0xd134 0x1f9
phy raw c45 0x1a9 0x1 0xd135 0x9c
phy raw c45 0x1a9 0x1 0xd136 0x1f9
phy raw c45 0x1a9 0x1 0xffde 1
phy raw c45 0x1a9 0x1 0xd134 0x1f9
phy raw c45 0x1a9 0x1 0xd135 0x9c
phy raw c45 0x1a9 0x1 0xd136 0x1f9
phy raw c45 0x1a9 0x1 0xffde 2
phy raw c45 0x1a9 0x1 0xd134 0x1f9
phy raw c45 0x1a9 0x1 0xd135 0x9c
phy raw c45 0x1a9 0x1 0xd136 0x1f9
phy raw c45 0x1a9 0x1 0xffde 3
phy raw c45 0x1a9 0x1 0xd134 0x1f9
phy raw c45 0x1a9 0x1 0xd135 0x9c
phy raw c45 0x1a9 0x1 0xd136 0x1f9
phy raw c45 0x1a9 0x1 0xffde 4
phy raw c45 0x1a9 0x1 0xd134 0x1f9
phy raw c45 0x1a9 0x1 0xd135 0x9c
phy raw c45 0x1a9 0x1 0xd136 0x1f9
phy raw c45 0x1a9 0x1 0xffde 5
phy raw c45 0x1a9 0x1 0xd134 0x1f9
phy raw c45 0x1a9 0x1 0xd135 0x9c
phy raw c45 0x1a9 0x1 0xd136 0x1f9
phy raw c45 0x1a9 0x1 0xffde 6
phy raw c45 0x1a9 0x1 0xd134 0x1f9
phy raw c45 0x1a9 0x1 0xd135 0x9c
phy raw c45 0x1a9 0x1 0xd136 0x1f9
phy raw c45 0x1a9 0x1 0xffde 7
phy raw c45 0x1a9 0x1 0xd134 0x1f9
phy raw c45 0x1a9 0x1 0xd135 0x9c
phy raw c45 0x1a9 0x1 0xd136 0x1f9
# port18 (Fiber)
phy raw c45 0x1b1 0x1 0xffde 0
phy raw c45 0x1b1 0x1 0xd134 0x1fa
phy raw c45 0x1b1 0x1 0xd135 0x9e
phy raw c45 0x1b1 0x1 0xd136 0x1fa
phy raw c45 0x1b1 0x1 0xffde 1
phy raw c45 0x1b1 0x1 0xd134 0x1fa
phy raw c45 0x1b1 0x1 0xd135 0x9e
phy raw c45 0x1b1 0x1 0xd136 0x1fa
phy raw c45 0x1b1 0x1 0xffde 2
phy raw c45 0x1b1 0x1 0xd134 0x1fa
phy raw c45 0x1b1 0x1 0xd135 0x9e
phy raw c45 0x1b1 0x1 0xd136 0x1fa
phy raw c45 0x1b1 0x1 0xffde 3
phy raw c45 0x1b1 0x1 0xd134 0x1fa
phy raw c45 0x1b1 0x1 0xd135 0x9e
phy raw c45 0x1b1 0x1 0xd136 0x1fa
phy raw c45 0x1b1 0x1 0xffde 4
phy raw c45 0x1b1 0x1 0xd134 0x1fa
phy raw c45 0x1b1 0x1 0xd135 0x9e
phy raw c45 0x1b1 0x1 0xd136 0x1fa
phy raw c45 0x1b1 0x1 0xffde 5
phy raw c45 0x1b1 0x1 0xd134 0x1fa
phy raw c45 0x1b1 0x1 0xd135 0x9e
phy raw c45 0x1b1 0x1 0xd136 0x1fa
phy raw c45 0x1b1 0x1 0xffde 6
phy raw c45 0x1b1 0x1 0xd134 0x1fa
phy raw c45 0x1b1 0x1 0xd135 0x9e
phy raw c45 0x1b1 0x1 0xd136 0x1fa
phy raw c45 0x1b1 0x1 0xffde 7
phy raw c45 0x1b1 0x1 0xd134 0x1fa
phy raw c45 0x1b1 0x1 0xd135 0x9e
phy raw c45 0x1b1 0x1 0xd136 0x1fa
# port19 (Fiber)
phy raw c45 0x1c1 0x1 0xffde 0
phy raw c45 0x1c1 0x1 0xd134 0x1f5
phy raw c45 0x1c1 0x1 0xd135 0x94
phy raw c45 0x1c1 0x1 0xd136 0x1f5
phy raw c45 0x1c1 0x1 0xffde 1
phy raw c45 0x1c1 0x1 0xd134 0x1f5
phy raw c45 0x1c1 0x1 0xd135 0x94
phy raw c45 0x1c1 0x1 0xd136 0x1f5
phy raw c45 0x1c1 0x1 0xffde 2
phy raw c45 0x1c1 0x1 0xd134 0x1f5
phy raw c45 0x1c1 0x1 0xd135 0x94
phy raw c45 0x1c1 0x1 0xd136 0x1f5
phy raw c45 0x1c1 0x1 0xffde 3
phy raw c45 0x1c1 0x1 0xd134 0x1f5
phy raw c45 0x1c1 0x1 0xd135 0x94
phy raw c45 0x1c1 0x1 0xd136 0x1f5
phy raw c45 0x1c1 0x1 0xffde 4
phy raw c45 0x1c1 0x1 0xd134 0x1f5
phy raw c45 0x1c1 0x1 0xd135 0x94
phy raw c45 0x1c1 0x1 0xd136 0x1f5
phy raw c45 0x1c1 0x1 0xffde 5
phy raw c45 0x1c1 0x1 0xd134 0x1f5
phy raw c45 0x1c1 0x1 0xd135 0x94
phy raw c45 0x1c1 0x1 0xd136 0x1f5
phy raw c45 0x1c1 0x1 0xffde 6
phy raw c45 0x1c1 0x1 0xd134 0x1f5
phy raw c45 0x1c1 0x1 0xd135 0x94
phy raw c45 0x1c1 0x1 0xd136 0x1f5
phy raw c45 0x1c1 0x1 0xffde 7
phy raw c45 0x1c1 0x1 0xd134 0x1f5
phy raw c45 0x1c1 0x1 0xd135 0x94
phy raw c45 0x1c1 0x1 0xd136 0x1f5
# port20 (Fiber)
phy raw c45 0x1c9 0x1 0xffde 0
phy raw c45 0x1c9 0x1 0xd134 0x1f9
phy raw c45 0x1c9 0x1 0xd135 0x9c
phy raw c45 0x1c9 0x1 0xd136 0x1f9
phy raw c45 0x1c9 0x1 0xffde 1
phy raw c45 0x1c9 0x1 0xd134 0x1f9
phy raw c45 0x1c9 0x1 0xd135 0x9c
phy raw c45 0x1c9 0x1 0xd136 0x1f9
phy raw c45 0x1c9 0x1 0xffde 2
phy raw c45 0x1c9 0x1 0xd134 0x1f9
phy raw c45 0x1c9 0x1 0xd135 0x9c
phy raw c45 0x1c9 0x1 0xd136 0x1f9
phy raw c45 0x1c9 0x1 0xffde 3
phy raw c45 0x1c9 0x1 0xd134 0x1f9
phy raw c45 0x1c9 0x1 0xd135 0x9c
phy raw c45 0x1c9 0x1 0xd136 0x1f9
phy raw c45 0x1c9 0x1 0xffde 4
phy raw c45 0x1c9 0x1 0xd134 0x1f9
phy raw c45 0x1c9 0x1 0xd135 0x9c
phy raw c45 0x1c9 0x1 0xd136 0x1f9
phy raw c45 0x1c9 0x1 0xffde 5
phy raw c45 0x1c9 0x1 0xd134 0x1f9
phy raw c45 0x1c9 0x1 0xd135 0x9c
phy raw c45 0x1c9 0x1 0xd136 0x1f9
phy raw c45 0x1c9 0x1 0xffde 6
phy raw c45 0x1c9 0x1 0xd134 0x1f9
phy raw c45 0x1c9 0x1 0xd135 0x9c
phy raw c45 0x1c9 0x1 0xd136 0x1f9
phy raw c45 0x1c9 0x1 0xffde 7
phy raw c45 0x1c9 0x1 0xd134 0x1f9
phy raw c45 0x1c9 0x1 0xd135 0x9c
phy raw c45 0x1c9 0x1 0xd136 0x1f9
# port21-24 (default)
# port25 (DAC)
phy raw c45 0x281 0x1 0xffde 0
phy raw c45 0x281 0x1 0xd134 0x1e6
phy raw c45 0x281 0x1 0xd135 0x8e
phy raw c45 0x281 0x1 0xd136 0x0
phy raw c45 0x281 0x1 0xffde 1
phy raw c45 0x281 0x1 0xd134 0x1e6
phy raw c45 0x281 0x1 0xd135 0x8e
phy raw c45 0x281 0x1 0xd136 0x0
phy raw c45 0x281 0x1 0xffde 2
phy raw c45 0x281 0x1 0xd134 0x1e6
phy raw c45 0x281 0x1 0xd135 0x8e
phy raw c45 0x281 0x1 0xd136 0x0
phy raw c45 0x281 0x1 0xffde 3
phy raw c45 0x281 0x1 0xd134 0x1e6
phy raw c45 0x281 0x1 0xd135 0x8e
phy raw c45 0x281 0x1 0xd136 0x0
phy raw c45 0x281 0x1 0xffde 4
phy raw c45 0x281 0x1 0xd134 0x1e6
phy raw c45 0x281 0x1 0xd135 0x8e
phy raw c45 0x281 0x1 0xd136 0x0
phy raw c45 0x281 0x1 0xffde 5
phy raw c45 0x281 0x1 0xd134 0x1e6
phy raw c45 0x281 0x1 0xd135 0x8e
phy raw c45 0x281 0x1 0xd136 0x0
phy raw c45 0x281 0x1 0xffde 6
phy raw c45 0x281 0x1 0xd134 0x1e6
phy raw c45 0x281 0x1 0xd135 0x8e
phy raw c45 0x281 0x1 0xd136 0x0
phy raw c45 0x281 0x1 0xffde 7
phy raw c45 0x281 0x1 0xd134 0x1e6
phy raw c45 0x281 0x1 0xd135 0x8e
phy raw c45 0x281 0x1 0xd136 0x0
# port26 (DAC)
phy raw c45 0x289 0x1 0xffde 0
phy raw c45 0x289 0x1 0xd134 0x1e8
phy raw c45 0x289 0x1 0xd135 0x90
phy raw c45 0x289 0x1 0xd136 0x0
phy raw c45 0x289 0x1 0xffde 1
phy raw c45 0x289 0x1 0xd134 0x1e8
phy raw c45 0x289 0x1 0xd135 0x90
phy raw c45 0x289 0x1 0xd136 0x0
phy raw c45 0x289 0x1 0xffde 2
phy raw c45 0x289 0x1 0xd134 0x1e8
phy raw c45 0x289 0x1 0xd135 0x90
phy raw c45 0x289 0x1 0xd136 0x0
phy raw c45 0x289 0x1 0xffde 3
phy raw c45 0x289 0x1 0xd134 0x1e8
phy raw c45 0x289 0x1 0xd135 0x90
phy raw c45 0x289 0x1 0xd136 0x0
phy raw c45 0x289 0x1 0xffde 4
phy raw c45 0x289 0x1 0xd134 0x1e8
phy raw c45 0x289 0x1 0xd135 0x90
phy raw c45 0x289 0x1 0xd136 0x0
phy raw c45 0x289 0x1 0xffde 5
phy raw c45 0x289 0x1 0xd134 0x1e8
phy raw c45 0x289 0x1 0xd135 0x90
phy raw c45 0x289 0x1 0xd136 0x0
phy raw c45 0x289 0x1 0xffde 6
phy raw c45 0x289 0x1 0xd134 0x1e8
phy raw c45 0x289 0x1 0xd135 0x90
phy raw c45 0x289 0x1 0xd136 0x0
phy raw c45 0x289 0x1 0xffde 7
phy raw c45 0x289 0x1 0xd134 0x1e8
phy raw c45 0x289 0x1 0xd135 0x90
phy raw c45 0x289 0x1 0xd136 0x0
# port27 (DAC)
phy raw c45 0x291 0x1 0xffde 0
phy raw c45 0x291 0x1 0xd134 0x1e5
phy raw c45 0x291 0x1 0xd135 0x8d
phy raw c45 0x291 0x1 0xd136 0x0
phy raw c45 0x291 0x1 0xffde 1
phy raw c45 0x291 0x1 0xd134 0x1e5
phy raw c45 0x291 0x1 0xd135 0x8d
phy raw c45 0x291 0x1 0xd136 0x0
phy raw c45 0x291 0x1 0xffde 2
phy raw c45 0x291 0x1 0xd134 0x1e5
phy raw c45 0x291 0x1 0xd135 0x8d
phy raw c45 0x291 0x1 0xd136 0x0
phy raw c45 0x291 0x1 0xffde 3
phy raw c45 0x291 0x1 0xd134 0x1e5
phy raw c45 0x291 0x1 0xd135 0x8d
phy raw c45 0x291 0x1 0xd136 0x0
phy raw c45 0x291 0x1 0xffde 4
phy raw c45 0x291 0x1 0xd134 0x1e5
phy raw c45 0x291 0x1 0xd135 0x8d
phy raw c45 0x291 0x1 0xd136 0x0
phy raw c45 0x291 0x1 0xffde 5
phy raw c45 0x291 0x1 0xd134 0x1e5
phy raw c45 0x291 0x1 0xd135 0x8d
phy raw c45 0x291 0x1 0xd136 0x0
phy raw c45 0x291 0x1 0xffde 6
phy raw c45 0x291 0x1 0xd134 0x1e5
phy raw c45 0x291 0x1 0xd135 0x8d
phy raw c45 0x291 0x1 0xd136 0x0
phy raw c45 0x291 0x1 0xffde 7
phy raw c45 0x291 0x1 0xd134 0x1e5
phy raw c45 0x291 0x1 0xd135 0x8d
phy raw c45 0x291 0x1 0xd136 0x0
# port28 (DAC)
phy raw c45 0x2a1 0x1 0xffde 0
phy raw c45 0x2a1 0x1 0xd134 0x1e2
phy raw c45 0x2a1 0x1 0xd135 0x8a
phy raw c45 0x2a1 0x1 0xd136 0x0
phy raw c45 0x2a1 0x1 0xffde 1
phy raw c45 0x2a1 0x1 0xd134 0x1e2
phy raw c45 0x2a1 0x1 0xd135 0x8a
phy raw c45 0x2a1 0x1 0xd136 0x0
phy raw c45 0x2a1 0x1 0xffde 2
phy raw c45 0x2a1 0x1 0xd134 0x1e2
phy raw c45 0x2a1 0x1 0xd135 0x8a
phy raw c45 0x2a1 0x1 0xd136 0x0
phy raw c45 0x2a1 0x1 0xffde 3
phy raw c45 0x2a1 0x1 0xd134 0x1e2
phy raw c45 0x2a1 0x1 0xd135 0x8a
phy raw c45 0x2a1 0x1 0xd136 0x0
phy raw c45 0x2a1 0x1 0xffde 4
phy raw c45 0x2a1 0x1 0xd134 0x1e2
phy raw c45 0x2a1 0x1 0xd135 0x8a
phy raw c45 0x2a1 0x1 0xd136 0x0
phy raw c45 0x2a1 0x1 0xffde 5
phy raw c45 0x2a1 0x1 0xd134 0x1e2
phy raw c45 0x2a1 0x1 0xd135 0x8a
phy raw c45 0x2a1 0x1 0xd136 0x0
phy raw c45 0x2a1 0x1 0xffde 6
phy raw c45 0x2a1 0x1 0xd134 0x1e2
phy raw c45 0x2a1 0x1 0xd135 0x8a
phy raw c45 0x2a1 0x1 0xd136 0x0
phy raw c45 0x2a1 0x1 0xffde 7
phy raw c45 0x2a1 0x1 0xd134 0x1e2
phy raw c45 0x2a1 0x1 0xd135 0x8a
phy raw c45 0x2a1 0x1 0xd136 0x0
# port29 (DAC)
phy raw c45 0x2a9 0x1 0xffde 0
phy raw c45 0x2a9 0x1 0xd134 0x1e4
phy raw c45 0x2a9 0x1 0xd135 0x8c
phy raw c45 0x2a9 0x1 0xd136 0x0
phy raw c45 0x2a9 0x1 0xffde 1
phy raw c45 0x2a9 0x1 0xd134 0x1e4
phy raw c45 0x2a9 0x1 0xd135 0x8c
phy raw c45 0x2a9 0x1 0xd136 0x0
phy raw c45 0x2a9 0x1 0xffde 2
phy raw c45 0x2a9 0x1 0xd134 0x1e4
phy raw c45 0x2a9 0x1 0xd135 0x8c
phy raw c45 0x2a9 0x1 0xd136 0x0
phy raw c45 0x2a9 0x1 0xffde 3
phy raw c45 0x2a9 0x1 0xd134 0x1e4
phy raw c45 0x2a9 0x1 0xd135 0x8c
phy raw c45 0x2a9 0x1 0xd136 0x0
phy raw c45 0x2a9 0x1 0xffde 4
phy raw c45 0x2a9 0x1 0xd134 0x1e4
phy raw c45 0x2a9 0x1 0xd135 0x8c
phy raw c45 0x2a9 0x1 0xd136 0x0
phy raw c45 0x2a9 0x1 0xffde 5
phy raw c45 0x2a9 0x1 0xd134 0x1e4
phy raw c45 0x2a9 0x1 0xd135 0x8c
phy raw c45 0x2a9 0x1 0xd136 0x0
phy raw c45 0x2a9 0x1 0xffde 6
phy raw c45 0x2a9 0x1 0xd134 0x1e4
phy raw c45 0x2a9 0x1 0xd135 0x8c
phy raw c45 0x2a9 0x1 0xd136 0x0
phy raw c45 0x2a9 0x1 0xffde 7
phy raw c45 0x2a9 0x1 0xd134 0x1e4
phy raw c45 0x2a9 0x1 0xd135 0x8c
phy raw c45 0x2a9 0x1 0xd136 0x0
# port30 (DAC)
phy raw c45 0x2b1 0x1 0xffde 0
phy raw c45 0x2b1 0x1 0xd134 0x1e4
phy raw c45 0x2b1 0x1 0xd135 0x8c
phy raw c45 0x2b1 0x1 0xd136 0x0
phy raw c45 0x2b1 0x1 0xffde 1
phy raw c45 0x2b1 0x1 0xd134 0x1e4
phy raw c45 0x2b1 0x1 0xd135 0x8c
phy raw c45 0x2b1 0x1 0xd136 0x0
phy raw c45 0x2b1 0x1 0xffde 2
phy raw c45 0x2b1 0x1 0xd134 0x1e4
phy raw c45 0x2b1 0x1 0xd135 0x8c
phy raw c45 0x2b1 0x1 0xd136 0x0
phy raw c45 0x2b1 0x1 0xffde 3
phy raw c45 0x2b1 0x1 0xd134 0x1e4
phy raw c45 0x2b1 0x1 0xd135 0x8c
phy raw c45 0x2b1 0x1 0xd136 0x0
phy raw c45 0x2b1 0x1 0xffde 4
phy raw c45 0x2b1 0x1 0xd134 0x1e4
phy raw c45 0x2b1 0x1 0xd135 0x8c
phy raw c45 0x2b1 0x1 0xd136 0x0
phy raw c45 0x2b1 0x1 0xffde 5
phy raw c45 0x2b1 0x1 0xd134 0x1e4
phy raw c45 0x2b1 0x1 0xd135 0x8c
phy raw c45 0x2b1 0x1 0xd136 0x0
phy raw c45 0x2b1 0x1 0xffde 6
phy raw c45 0x2b1 0x1 0xd134 0x1e4
phy raw c45 0x2b1 0x1 0xd135 0x8c
phy raw c45 0x2b1 0x1 0xd136 0x0
phy raw c45 0x2b1 0x1 0xffde 7
phy raw c45 0x2b1 0x1 0xd134 0x1e4
phy raw c45 0x2b1 0x1 0xd135 0x8c
phy raw c45 0x2b1 0x1 0xd136 0x0
# port31 (DAC)
phy raw c45 0x2c1 0x1 0xffde 0
phy raw c45 0x2c1 0x1 0xd134 0x1e2
phy raw c45 0x2c1 0x1 0xd135 0x8a
phy raw c45 0x2c1 0x1 0xd136 0x0
phy raw c45 0x2c1 0x1 0xffde 1
phy raw c45 0x2c1 0x1 0xd134 0x1e2
phy raw c45 0x2c1 0x1 0xd135 0x8a
phy raw c45 0x2c1 0x1 0xd136 0x0
phy raw c45 0x2c1 0x1 0xffde 2
phy raw c45 0x2c1 0x1 0xd134 0x1e2
phy raw c45 0x2c1 0x1 0xd135 0x8a
phy raw c45 0x2c1 0x1 0xd136 0x0
phy raw c45 0x2c1 0x1 0xffde 3
phy raw c45 0x2c1 0x1 0xd134 0x1e2
phy raw c45 0x2c1 0x1 0xd135 0x8a
phy raw c45 0x2c1 0x1 0xd136 0x0
phy raw c45 0x2c1 0x1 0xffde 4
phy raw c45 0x2c1 0x1 0xd134 0x1e2
phy raw c45 0x2c1 0x1 0xd135 0x8a
phy raw c45 0x2c1 0x1 0xd136 0x0
phy raw c45 0x2c1 0x1 0xffde 5
phy raw c45 0x2c1 0x1 0xd134 0x1e2
phy raw c45 0x2c1 0x1 0xd135 0x8a
phy raw c45 0x2c1 0x1 0xd136 0x0
phy raw c45 0x2c1 0x1 0xffde 6
phy raw c45 0x2c1 0x1 0xd134 0x1e2
phy raw c45 0x2c1 0x1 0xd135 0x8a
phy raw c45 0x2c1 0x1 0xd136 0x0
phy raw c45 0x2c1 0x1 0xffde 7
phy raw c45 0x2c1 0x1 0xd134 0x1e2
phy raw c45 0x2c1 0x1 0xd135 0x8a
phy raw c45 0x2c1 0x1 0xd136 0x0
# port32 (DAC)
phy raw c45 0x2c9 0x1 0xffde 0
phy raw c45 0x2c9 0x1 0xd134 0x1e4
phy raw c45 0x2c9 0x1 0xd135 0x8c
phy raw c45 0x2c9 0x1 0xd136 0x0
phy raw c45 0x2c9 0x1 0xffde 1
phy raw c45 0x2c9 0x1 0xd134 0x1e4
phy raw c45 0x2c9 0x1 0xd135 0x8c
phy raw c45 0x2c9 0x1 0xd136 0x0
phy raw c45 0x2c9 0x1 0xffde 2
phy raw c45 0x2c9 0x1 0xd134 0x1e4
phy raw c45 0x2c9 0x1 0xd135 0x8c
phy raw c45 0x2c9 0x1 0xd136 0x0
phy raw c45 0x2c9 0x1 0xffde 3
phy raw c45 0x2c9 0x1 0xd134 0x1e4
phy raw c45 0x2c9 0x1 0xd135 0x8c
phy raw c45 0x2c9 0x1 0xd136 0x0
phy raw c45 0x2c9 0x1 0xffde 4
phy raw c45 0x2c9 0x1 0xd134 0x1e4
phy raw c45 0x2c9 0x1 0xd135 0x8c
phy raw c45 0x2c9 0x1 0xd136 0x0
phy raw c45 0x2c9 0x1 0xffde 5
phy raw c45 0x2c9 0x1 0xd134 0x1e4
phy raw c45 0x2c9 0x1 0xd135 0x8c
phy raw c45 0x2c9 0x1 0xd136 0x0
phy raw c45 0x2c9 0x1 0xffde 6
phy raw c45 0x2c9 0x1 0xd134 0x1e4
phy raw c45 0x2c9 0x1 0xd135 0x8c
phy raw c45 0x2c9 0x1 0xd136 0x0
phy raw c45 0x2c9 0x1 0xffde 7
phy raw c45 0x2c9 0x1 0xd134 0x1e4
phy raw c45 0x2c9 0x1 0xd135 0x8c
phy raw c45 0x2c9 0x1 0xd136 0x0

View File

@ -0,0 +1,13 @@
# libsensors configuration file for snj60d0_320f
# ------------------------------------------------
#bus "i2c-1" "SMBus I801 adapter at f000"
#chip "goreme_power_cpld-*"
# label fan1 "Fan tray 1 front"
# label fan2 "Fan tray 2 front"
# label fan3 "Fan tray 3 front"
# label fan4 "Fan tray 4 front"
# label fan11 "Fan tray 1 rear"
# label fan12 "Fan tray 2 rear"
# label fan13 "Fan tray 3 rear"
# label fan14 "Fan tray 4 rear"

View File

@ -0,0 +1,18 @@
{
"services_to_ignore": [],
"devices_to_ignore": [
"asic",
"psu.temperature",
"psu.voltage",
"PSU1-FAN1",
"PSU2-FAN1"
],
"user_defined_checkers": [],
"polling_interval": 60,
"led_color": {
"fault": "amber_blink",
"normal": "green",
"booting": "amber_blink"
}
}

View File

@ -0,0 +1,74 @@
{
"thermal_control_algorithm": {
"run_at_boot_up": "True",
"fan_speed_when_suspend": "50"
},
"info_types": [
{
"type": "fan_info"
},
{
"type": "thermal_info"
},
{
"type": "chassis_info"
}
],
"policies": [
{
"name": "temp over high critical threshold",
"conditions": [
{
"type": "thermal.over.high_critical_threshold"
}
],
"actions": [
{
"type": "switch.shutdown"
}
]
},
{
"name": "any fan absence",
"conditions": [
{
"type": "fan.any.absence"
}
],
"actions": [
{
"type": "fan.all.set_speed_max"
}
]
},
{
"name": "any fan broken",
"conditions": [
{
"type": "fan.any.fault"
}
],
"actions": [
{
"type": "fan.all.set_speed_max"
}
]
},
{
"name": "thermal recover",
"conditions": [
{
"type": "fan.all.presence"
},
{
"type": "fan.all.good"
}
],
"actions": [
{
"type": "thermal.temp_check_and_set_all_fan_speed"
}
]
}
]
}

View File

@ -65,6 +65,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \
$(MITAC_LY1200_32X_PLATFORM_MODULE) \
$(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE) \
$(ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE) \
$(ALPHANETWORKS_SNJ60D0_320F_PLATFORM_MODULE) \
$(BRCM_XLR_GTS_PLATFORM_MODULE) \
$(DELTA_AG9032V2A_PLATFORM_MODULE) \
$(JUNIPER_QFX5210_PLATFORM_MODULE) \

View File

@ -2,9 +2,11 @@
ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE_VERSION = 1.0
ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE_VERSION = 1.0
ALPHANETWORKS_SNJ60D0_320F_PLATFORM_MODULE_VERSION = 1.0
export ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE_VERSION
export ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE_VERSION
export ALPHANETWORKS_SNJ60D0_320F_PLATFORM_MODULE_VERSION
ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE = sonic-platform-alphanetworks-snh60a0-320fv2_$(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE_VERSION)_amd64.deb
$(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-alphanetworks
@ -16,5 +18,8 @@ ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE = sonic-platform-alphanetworks-snh60b
$(ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE)_PLATFORM = x86_64-alphanetworks_snh60b0_640f-r0
$(eval $(call add_extra_package,$(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE),$(ALPHANETWORKS_SNH60B0_640F_PLATFORM_MODULE)))
ALPHANETWORKS_SNJ60D0_320F_PLATFORM_MODULE = sonic-platform-alphanetworks-snj60d0-320f_$(ALPHANETWORKS_SNJ60D0_320F_PLATFORM_MODULE_VERSION)_amd64.deb
$(ALPHANETWORKS_SNJ60D0_320F_PLATFORM_MODULE)_PLATFORM = x86_64-alphanetworks_snj60d0_320f-r0
$(eval $(call add_extra_package,$(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE),$(ALPHANETWORKS_SNJ60D0_320F_PLATFORM_MODULE)))

View File

@ -1,6 +1,6 @@
sonic-alphanetworks-platform-modules (1.0) unstable; urgency=low
* Add support for SNH60A0-320FV2 and SNH60B0_640F.
* Add support for SNH60A0-320FV2, SNH60B0_640F, and SNJ60D0_320F.
-- Alphanetworks <Jun_Tseng@alphanetworks.com> Tue, 19 Dec 2017 09:35:58 +0800
-- Alphanetworks <Jun_Tseng@alphanetworks.com> Tue, 14 Sep 2021 14:50:08 +0800

View File

@ -15,3 +15,8 @@ Architecture: amd64
Depends: linux-image-4.19.0-12-2-amd64-unsigned
Description: kernel modules for platform devices such as fan, led, sfp
Package: sonic-platform-alphanetworks-snj60d0-320f
Architecture: amd64
Depends: linux-image-4.19.0-12-2-amd64-unsigned
Description: kernel modules for platform devices such as fan, led, sfp

View File

@ -19,7 +19,7 @@ PACKAGE_PRE_NAME := sonic-platform-alphanetworks
KVERSION ?= $(shell uname -r)
KERNEL_SRC := /lib/modules/$(KVERSION)
MOD_SRC_DIR:= $(shell pwd)
MODULE_DIRS:= snh60a0-320fv2 snh60b0-640f
MODULE_DIRS:= snh60a0-320fv2 snh60b0-640f snj60d0-320f
MODULE_DIR := modules
UTILS_DIR := utils
SERVICE_DIR := service
@ -38,7 +38,14 @@ build:
#make modules -C $(KERNEL_SRC)/build M=$(MODULE_SRC)
(for mod in $(MODULE_DIRS); do \
make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \
$(PYTHON) $${mod}/setup.py build; \
cd $(MOD_SRC_DIR)/$${mod}; \
$(PYTHON) setup.py build; \
$(PYTHON) setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/utils; \
if [ $$mod = "snj60d0-320f" ]; then \
python3 setup.py build; \
python3 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/utils; \
fi; \
cd $(MOD_SRC_DIR); \
done)
binary: binary-arch binary-indep
@ -59,13 +66,21 @@ binary-indep:
# Custom package commands
(for mod in $(MODULE_DIRS); do \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin; \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system; \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} usr/local/bin; \
platform_name=`echo $${mod} | sed "s/-/_/g"`; \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} usr/share/sonic/device/x86_64-alphanetworks_$${platform_name}-r0; \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} lib/systemd/system; \
cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \
cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/*.py debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \
cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/*.whl debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/share/sonic/device/x86_64-alphanetworks_$${platform_name}-r0; \
cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \
$(PYTHON) $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \
cd $(MOD_SRC_DIR)/$${mod}; \
$(PYTHON) setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \
if [ $$mod = "snj60d0-320f" ]; then \
python3 setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \
fi; \
cd $(MOD_SRC_DIR); \
done)
# Resuming debhelper scripts
dh_testroot

View File

@ -0,0 +1,8 @@
# obj-m:=accton_as7712_32x_fan.o accton_as7712_32x_sfp.o leds-accton_as7712_32x.o \
# goreme_system_cpld.o ym2651y.o optoe.o
obj-m:=snj60d0-320f_i2c_mux_cpld.o snj60d0-320f_fpga.o snj60d0-320f_onie_eeprom.o yesm1300am.o
# obj-m:=accton_as7712_32x_fan.o accton_as7712_32x_sfp.o leds-accton_as7712_32x.o \
# accton_as7712_32x_psu.o accton_i2c_cpld.o ym2651y.o optoe.o

View File

@ -0,0 +1,943 @@
/*
* A hwmon driver for the alphanetworks_snj60d0_320f_fpga
*
* Copyright (C) 2020 Alphanetworks Technology Corporation.
* Robin Chen <Robin_chen@Alphanetworks.com>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* see <http://www.gnu.org/licenses/>
*
* Based on ad7414.c
* Copyright 2006 Stefan Roese <sr at denx.de>, DENX Software Engineering
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/dmi.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/mutex.h>
#define DRIVER_NAME "snj60d0_fpga"
#define PSU1_STATUS_REG 0x2
#define PSU2_STATUS_REG 0x3
#define FAN_PWM_REG 0x18
#define PSU_PRESENT_BIT 0x10
#define PSU_POWER_BIT 0x20
#define FAN_DIRECTION_BIT 0x1
#define FAN_PRESENT_BIT 0x2
#define FPGA_REVISION_BIT 0xF
#define FPGA_REVISION_REG 0x0
#define SYS_LED_REG 0x2D
#define SYS2_LED_REG 0x2E
#define FAN12_LED_REG 0x30
#define FAN34_LED_REG 0x31
#define FAN56_LED_REG 0x32
#define FAN1_STATUS_REG 0x5
#define FAN2_STATUS_REG 0x6
#define FAN3_STATUS_REG 0x7
#define FAN4_STATUS_REG 0x8
#define FAN5_STATUS_REG 0x9
#define FAN6_STATUS_REG 0xA
#define SYS_RESET1_REG 0x1C
#define SYS_RESET2_REG 0x1D
#define SYS_RESET3_REG 0x1E
//#define SWI_CTRL_REG 0x4
#define SYS_LOCATOR_LED_BITS 0x07
#define SYS_PWR_LED_BITS 0x38
#define PORT_LED_DISABLE_BITS 0x40
#define SYS_STATUS_LED_BITS 0x07
#define SYS_FAN_LED_BITS 0x38
#define FAN135_LED_BITS 0x07
#define FAN246_LED_BITS 0x38
#define REST_BUTTON_BITS 0x0
#define SFP_TX_FAULT_REG 0x25
#define SFP_TX_FAULT_MASK_REG 0x26
#define SFP_TX_DISABLE_REG 0x27
#define SFP_PRESENT_REG 0x28
#define SFP_PRESENT_MASK_REG 0x29
#define SFP_RX_LOSS_REG 0x2A
#define SFP_RX_LOSS_MASK_REG 0x2B
//#define SWI_CTRL_REG 0x34
static ssize_t psu_show_status(struct device *dev, struct device_attribute *attr, char *buf);
static ssize_t fan_pwm_show(struct device *dev, struct device_attribute *attr, char *buf);
static ssize_t set_fan_pwm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
static ssize_t fpga_version_show(struct device *dev, struct device_attribute *attr, char *buf);
static ssize_t fan_show_status(struct device *dev, struct device_attribute *attr, char *buf);
static ssize_t fan_show_status_reg(struct device *dev, struct device_attribute *attr, char *buf);
static ssize_t sys_sfp_read(struct device *dev, struct device_attribute *attr, char *buf);
static ssize_t sys_sfp_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
static ssize_t sys_led_read(struct device *dev, struct device_attribute *attr, char *buf);
static ssize_t sys_led_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
static LIST_HEAD(fpga_client_list);
static struct mutex list_lock;
struct fpga_client_node {
struct i2c_client *client;
struct list_head list;
};
/* Addresses scanned for alphanetworks_snj60d0_320f_fpga */
static const unsigned short normal_i2c[] = { 0x5E, I2C_CLIENT_END };
struct alphanetworks_snj60d0_320f_pwr_fpga_data {
struct device *hwmon_dev;
struct mutex update_lock;
char model_name[9]; /* Model name, read from eeprom */
};
enum sysfs_fpga_attributes {
PSU1_PRESENT,
PSU2_PRESENT,
PSU1_POWER_GOOD,
PSU2_POWER_GOOD,
FAN_PWM,
FAN1_PRESENT=0x05,
FAN2_PRESENT,
FAN3_PRESENT,
FAN4_PRESENT,
FAN5_PRESENT,
FAN6_PRESENT,
FAN1_FRONT_SPEED_RPM=0x0b,
FAN1_REAR_SPEED_RPM,
FAN2_FRONT_SPEED_RPM,
FAN2_REAR_SPEED_RPM,
FAN3_FRONT_SPEED_RPM,
FAN3_REAR_SPEED_RPM,
FAN4_FRONT_SPEED_RPM,
FAN4_REAR_SPEED_RPM,
FAN5_FRONT_SPEED_RPM,
FAN5_REAR_SPEED_RPM,
FAN6_FRONT_SPEED_RPM,
FAN6_REAR_SPEED_RPM,
FAN1_FAULT,
FAN2_FAULT,
FAN3_FAULT,
FAN4_FAULT,
FAN5_FAULT,
FAN6_FAULT,
SYS_STATUS,
SYS_PWR,
SYS_FAN,
SYS_LOCATOR,
SFP_TX_FAULT,
SFP_TX_FAULT_MASK,
SFP_TX_DISABLE,
SFP_PRESENT,
SFP_PRESENT_MASK,
SFP_RX_LOSS,
SFP_RX_LOSS_MASK,
FAN1_LED,
FAN2_LED,
FAN3_LED,
FAN4_LED,
FAN5_LED,
FAN6_LED,
SYS_RESET1,
SYS_RESET2,
SYS_RESET3,
PORT_LED_DISABLE,
FAN1_DIRECTION,
FAN2_DIRECTION,
FAN3_DIRECTION,
FAN4_DIRECTION,
FAN5_DIRECTION,
FAN6_DIRECTION,
FPGA_REVISION,
};
static SENSOR_DEVICE_ATTR(psu1_present, S_IRUGO, psu_show_status, NULL, PSU1_PRESENT);
static SENSOR_DEVICE_ATTR(psu2_present, S_IRUGO, psu_show_status, NULL, PSU2_PRESENT);
static SENSOR_DEVICE_ATTR(psu1_power_good, S_IRUGO, psu_show_status, NULL, PSU1_POWER_GOOD);
static SENSOR_DEVICE_ATTR(psu2_power_good, S_IRUGO, psu_show_status, NULL, PSU2_POWER_GOOD);
static SENSOR_DEVICE_ATTR(fan_pwm, (0660), fan_pwm_show, set_fan_pwm, FAN_PWM);
static SENSOR_DEVICE_ATTR(fpga_revision, (0660), fpga_version_show, NULL, FPGA_REVISION);
static SENSOR_DEVICE_ATTR(fan1_present, S_IRUGO, fan_show_status_reg, NULL, FAN1_PRESENT);
static SENSOR_DEVICE_ATTR(fan2_present, S_IRUGO, fan_show_status_reg, NULL, FAN2_PRESENT);
static SENSOR_DEVICE_ATTR(fan3_present, S_IRUGO, fan_show_status_reg, NULL, FAN3_PRESENT);
static SENSOR_DEVICE_ATTR(fan4_present, S_IRUGO, fan_show_status_reg, NULL, FAN4_PRESENT);
static SENSOR_DEVICE_ATTR(fan5_present, S_IRUGO, fan_show_status_reg, NULL, FAN5_PRESENT);
static SENSOR_DEVICE_ATTR(fan6_present, S_IRUGO, fan_show_status_reg, NULL, FAN6_PRESENT);
static SENSOR_DEVICE_ATTR(fan1_direction, S_IRUGO, fan_show_status_reg, NULL, FAN1_DIRECTION);
static SENSOR_DEVICE_ATTR(fan2_direction, S_IRUGO, fan_show_status_reg, NULL, FAN2_DIRECTION);
static SENSOR_DEVICE_ATTR(fan3_direction, S_IRUGO, fan_show_status_reg, NULL, FAN3_DIRECTION);
static SENSOR_DEVICE_ATTR(fan4_direction, S_IRUGO, fan_show_status_reg, NULL, FAN4_DIRECTION);
static SENSOR_DEVICE_ATTR(fan5_direction, S_IRUGO, fan_show_status_reg, NULL, FAN5_DIRECTION);
static SENSOR_DEVICE_ATTR(fan6_direction, S_IRUGO, fan_show_status_reg, NULL, FAN6_DIRECTION);
static SENSOR_DEVICE_ATTR(fan1_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN1_FRONT_SPEED_RPM);
static SENSOR_DEVICE_ATTR(fan2_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN2_FRONT_SPEED_RPM);
static SENSOR_DEVICE_ATTR(fan3_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN3_FRONT_SPEED_RPM);
static SENSOR_DEVICE_ATTR(fan4_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN4_FRONT_SPEED_RPM);
static SENSOR_DEVICE_ATTR(fan5_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN5_FRONT_SPEED_RPM);
static SENSOR_DEVICE_ATTR(fan6_front_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN6_FRONT_SPEED_RPM);
static SENSOR_DEVICE_ATTR(fan1_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN1_REAR_SPEED_RPM);
static SENSOR_DEVICE_ATTR(fan2_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN2_REAR_SPEED_RPM);
static SENSOR_DEVICE_ATTR(fan3_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN3_REAR_SPEED_RPM);
static SENSOR_DEVICE_ATTR(fan4_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN4_REAR_SPEED_RPM);
static SENSOR_DEVICE_ATTR(fan5_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN5_REAR_SPEED_RPM);
static SENSOR_DEVICE_ATTR(fan6_rear_speed_rpm, S_IRUGO, fan_show_status, NULL, FAN6_REAR_SPEED_RPM);
static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, fan_show_status, NULL, FAN1_FAULT); static SENSOR_DEVICE_ATTR(fan11_fault, S_IRUGO, fan_show_status, NULL, FAN1_FAULT);
static SENSOR_DEVICE_ATTR(fan2_fault, S_IRUGO, fan_show_status, NULL, FAN2_FAULT); static SENSOR_DEVICE_ATTR(fan12_fault, S_IRUGO, fan_show_status, NULL, FAN2_FAULT);
static SENSOR_DEVICE_ATTR(fan3_fault, S_IRUGO, fan_show_status, NULL, FAN3_FAULT); static SENSOR_DEVICE_ATTR(fan13_fault, S_IRUGO, fan_show_status, NULL, FAN3_FAULT);
static SENSOR_DEVICE_ATTR(fan4_fault, S_IRUGO, fan_show_status, NULL, FAN4_FAULT); static SENSOR_DEVICE_ATTR(fan14_fault, S_IRUGO, fan_show_status, NULL, FAN4_FAULT);
static SENSOR_DEVICE_ATTR(fan5_fault, S_IRUGO, fan_show_status, NULL, FAN5_FAULT); static SENSOR_DEVICE_ATTR(fan15_fault, S_IRUGO, fan_show_status, NULL, FAN5_FAULT);
static SENSOR_DEVICE_ATTR(fan6_fault, S_IRUGO, fan_show_status, NULL, FAN6_FAULT); static SENSOR_DEVICE_ATTR(fan16_fault, S_IRUGO, fan_show_status, NULL, FAN6_FAULT);
static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, fan_show_status, NULL, FAN1_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan11_input, S_IRUGO, fan_show_status, NULL, FAN1_REAR_SPEED_RPM);
static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, fan_show_status, NULL, FAN2_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan12_input, S_IRUGO, fan_show_status, NULL, FAN2_REAR_SPEED_RPM);
static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, fan_show_status, NULL, FAN3_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan13_input, S_IRUGO, fan_show_status, NULL, FAN3_REAR_SPEED_RPM);
static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, fan_show_status, NULL, FAN4_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan14_input, S_IRUGO, fan_show_status, NULL, FAN4_REAR_SPEED_RPM);
static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, fan_show_status, NULL, FAN5_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan15_input, S_IRUGO, fan_show_status, NULL, FAN5_REAR_SPEED_RPM);
static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO, fan_show_status, NULL, FAN6_FRONT_SPEED_RPM); static SENSOR_DEVICE_ATTR(fan16_input, S_IRUGO, fan_show_status, NULL, FAN6_REAR_SPEED_RPM);
static SENSOR_DEVICE_ATTR(sys_status, (0600), sys_led_read, sys_led_write, SYS_STATUS);
static SENSOR_DEVICE_ATTR(port_led_disable, (0660), sys_led_read, sys_led_write, PORT_LED_DISABLE);
static SENSOR_DEVICE_ATTR(sys_pwr, (0660), sys_led_read, sys_led_write, SYS_PWR);
static SENSOR_DEVICE_ATTR(sys_locator, (0660), sys_led_read, sys_led_write, SYS_LOCATOR);
static SENSOR_DEVICE_ATTR(fan1_led, (0660), sys_led_read, sys_led_write, FAN1_LED);
static SENSOR_DEVICE_ATTR(fan2_led, (0660), sys_led_read, sys_led_write, FAN2_LED);
static SENSOR_DEVICE_ATTR(fan3_led, (0660), sys_led_read, sys_led_write, FAN3_LED);
static SENSOR_DEVICE_ATTR(fan4_led, (0660), sys_led_read, sys_led_write, FAN4_LED);
static SENSOR_DEVICE_ATTR(fan5_led, (0660), sys_led_read, sys_led_write, FAN5_LED);
static SENSOR_DEVICE_ATTR(fan6_led, (0660), sys_led_read, sys_led_write, FAN6_LED);
static SENSOR_DEVICE_ATTR(sys_reset1, (0660), sys_led_read, sys_led_write, SYS_RESET1);
static SENSOR_DEVICE_ATTR(sys_reset2, (0660), sys_led_read, sys_led_write, SYS_RESET2);
static SENSOR_DEVICE_ATTR(sys_reset3, (0660), sys_led_read, sys_led_write, SYS_RESET3);
static SENSOR_DEVICE_ATTR(sfp_tx_fault, (0660), sys_sfp_read, sys_sfp_write, SFP_TX_FAULT);
static SENSOR_DEVICE_ATTR(sfp_tx_fault_mask, (0660), sys_sfp_read, sys_sfp_write, SFP_TX_FAULT_MASK);
static SENSOR_DEVICE_ATTR(sfp_tx_disable, (0660), sys_sfp_read, sys_sfp_write, SFP_TX_DISABLE);
static SENSOR_DEVICE_ATTR(sfp_present, (0660), sys_sfp_read, sys_sfp_write, SFP_PRESENT);
static SENSOR_DEVICE_ATTR(sfp_present_mask, (0660), sys_sfp_read, sys_sfp_write, SFP_PRESENT_MASK);
static SENSOR_DEVICE_ATTR(sfp_rx_loss, (0660), sys_sfp_read, sys_sfp_write, SFP_RX_LOSS);
static SENSOR_DEVICE_ATTR(sfp_rx_loss_mask, (0660), sys_sfp_read, sys_sfp_write, SFP_RX_LOSS_MASK);
static struct attribute *alphanetworks_snj60d0_320f_fpga_attributes[] = {
&sensor_dev_attr_psu1_present.dev_attr.attr,
&sensor_dev_attr_psu2_present.dev_attr.attr,
&sensor_dev_attr_psu1_power_good.dev_attr.attr,
&sensor_dev_attr_psu2_power_good.dev_attr.attr,
&sensor_dev_attr_fan_pwm.dev_attr.attr,
&sensor_dev_attr_fan1_present.dev_attr.attr,
&sensor_dev_attr_fan2_present.dev_attr.attr,
&sensor_dev_attr_fan3_present.dev_attr.attr,
&sensor_dev_attr_fan4_present.dev_attr.attr,
&sensor_dev_attr_fan5_present.dev_attr.attr,
&sensor_dev_attr_fan6_present.dev_attr.attr,
&sensor_dev_attr_fan1_front_speed_rpm.dev_attr.attr,
&sensor_dev_attr_fan2_front_speed_rpm.dev_attr.attr,
&sensor_dev_attr_fan3_front_speed_rpm.dev_attr.attr,
&sensor_dev_attr_fan4_front_speed_rpm.dev_attr.attr,
&sensor_dev_attr_fan5_front_speed_rpm.dev_attr.attr,
&sensor_dev_attr_fan6_front_speed_rpm.dev_attr.attr,
&sensor_dev_attr_fan1_rear_speed_rpm.dev_attr.attr,
&sensor_dev_attr_fan2_rear_speed_rpm.dev_attr.attr,
&sensor_dev_attr_fan3_rear_speed_rpm.dev_attr.attr,
&sensor_dev_attr_fan4_rear_speed_rpm.dev_attr.attr,
&sensor_dev_attr_fan5_rear_speed_rpm.dev_attr.attr,
&sensor_dev_attr_fan6_rear_speed_rpm.dev_attr.attr,
&sensor_dev_attr_fan1_fault.dev_attr.attr, &sensor_dev_attr_fan11_fault.dev_attr.attr,
&sensor_dev_attr_fan2_fault.dev_attr.attr, &sensor_dev_attr_fan12_fault.dev_attr.attr,
&sensor_dev_attr_fan3_fault.dev_attr.attr, &sensor_dev_attr_fan13_fault.dev_attr.attr,
&sensor_dev_attr_fan4_fault.dev_attr.attr, &sensor_dev_attr_fan14_fault.dev_attr.attr,
&sensor_dev_attr_fan5_fault.dev_attr.attr, &sensor_dev_attr_fan15_fault.dev_attr.attr,
&sensor_dev_attr_fan6_fault.dev_attr.attr, &sensor_dev_attr_fan16_fault.dev_attr.attr,
&sensor_dev_attr_fan1_input.dev_attr.attr, &sensor_dev_attr_fan11_input.dev_attr.attr,
&sensor_dev_attr_fan2_input.dev_attr.attr, &sensor_dev_attr_fan12_input.dev_attr.attr,
&sensor_dev_attr_fan3_input.dev_attr.attr, &sensor_dev_attr_fan13_input.dev_attr.attr,
&sensor_dev_attr_fan4_input.dev_attr.attr, &sensor_dev_attr_fan14_input.dev_attr.attr,
&sensor_dev_attr_fan5_input.dev_attr.attr, &sensor_dev_attr_fan15_input.dev_attr.attr,
&sensor_dev_attr_fan6_input.dev_attr.attr, &sensor_dev_attr_fan16_input.dev_attr.attr,
&sensor_dev_attr_sys_status.dev_attr.attr,
&sensor_dev_attr_sys_pwr.dev_attr.attr,
&sensor_dev_attr_fan1_led.dev_attr.attr,
&sensor_dev_attr_fan2_led.dev_attr.attr,
&sensor_dev_attr_fan3_led.dev_attr.attr,
&sensor_dev_attr_fan4_led.dev_attr.attr,
&sensor_dev_attr_fan5_led.dev_attr.attr,
&sensor_dev_attr_fan6_led.dev_attr.attr,
&sensor_dev_attr_sys_reset1.dev_attr.attr,
&sensor_dev_attr_sys_reset2.dev_attr.attr,
&sensor_dev_attr_sys_reset3.dev_attr.attr,
&sensor_dev_attr_sfp_tx_fault.dev_attr.attr,
&sensor_dev_attr_sfp_tx_fault_mask.dev_attr.attr,
&sensor_dev_attr_sfp_tx_disable.dev_attr.attr,
&sensor_dev_attr_sfp_present.dev_attr.attr,
&sensor_dev_attr_sfp_present_mask.dev_attr.attr,
&sensor_dev_attr_sfp_rx_loss.dev_attr.attr,
&sensor_dev_attr_sfp_rx_loss_mask.dev_attr.attr,
&sensor_dev_attr_sys_locator.dev_attr.attr,
&sensor_dev_attr_port_led_disable.dev_attr.attr,
&sensor_dev_attr_fan1_direction.dev_attr.attr,
&sensor_dev_attr_fan2_direction.dev_attr.attr,
&sensor_dev_attr_fan3_direction.dev_attr.attr,
&sensor_dev_attr_fan4_direction.dev_attr.attr,
&sensor_dev_attr_fan5_direction.dev_attr.attr,
&sensor_dev_attr_fan6_direction.dev_attr.attr,
&sensor_dev_attr_fpga_revision.dev_attr.attr,
NULL
};
static const struct attribute_group alphanetworks_snj60d0_320f_fpga_group = {
.attrs = alphanetworks_snj60d0_320f_fpga_attributes,
};
static ssize_t psu_show_status(struct device *dev, struct device_attribute *attr, char *buf)
{
int val = 0, res = 0;
u8 command;
struct i2c_client *client = to_i2c_client(dev);
struct sensor_device_attribute *sda = to_sensor_dev_attr(attr);
switch(sda->index) {
case PSU1_PRESENT:
case PSU1_POWER_GOOD:
command = PSU1_STATUS_REG;
break;
case PSU2_PRESENT:
case PSU2_POWER_GOOD:
command = PSU2_STATUS_REG;
break;
}
val = i2c_smbus_read_byte_data(client, command);
if (val < 0) {
dev_dbg(&client->dev, "fpga(0x%x) reg(0x1) err %d\n", client->addr, val);
}
switch(sda->index) {
case PSU1_PRESENT:
case PSU2_PRESENT:
res = (val & PSU_PRESENT_BIT ? 0 : 1 );
break;
case PSU1_POWER_GOOD:
case PSU2_POWER_GOOD:
res = (val & PSU_POWER_BIT ? 1 : 0 );
break;
}
return sprintf(buf, "%d\n", res);
}
static ssize_t fan_pwm_show(struct device *dev, struct device_attribute *attr, char *buf)
{
int val = 0;
struct i2c_client *client = to_i2c_client(dev);
val = i2c_smbus_read_byte_data(client, FAN_PWM_REG);
if (val < 0) {
dev_dbg(&client->dev, "fpga(0x%x) reg(0x1) err %d\n", client->addr, val);
}
return sprintf(buf, "%d", val);
}
static ssize_t set_fan_pwm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
struct i2c_client *client = to_i2c_client(dev);
int error, value;
error = kstrtoint(buf, 10, &value);
if (error)
return error;
if (value < 0 || value > 0xFF)
return -EINVAL;
i2c_smbus_write_byte_data(client, FAN_PWM_REG, value);
return count;
}
static ssize_t fpga_version_show(struct device *dev, struct device_attribute *attr, char *buf)
{
int val = 0;
struct i2c_client *client = to_i2c_client(dev);
val = i2c_smbus_read_byte_data(client, FPGA_REVISION_REG);
if (val < 0) {
dev_dbg(&client->dev, "fpga(0x%x) reg(0x1) err %d\n", client->addr, val);
}
return sprintf(buf, "%d\n", (val & FPGA_REVISION_BIT));
}
static ssize_t fan_show_status(struct device *dev, struct device_attribute *attr, char *buf)
{
struct sensor_device_attribute *sda = to_sensor_dev_attr(attr);
struct i2c_client *client = to_i2c_client(dev);
// struct as7712_32x_fan_data *data = as7712_32x_fan_update_device(dev);
ssize_t ret = 0;
int val, val2;
switch (sda->index) {
/* case FAN_DUTY_CYCLE_PERCENTAGE: */
/* { */
/* u32 duty_cycle = reg_val_to_duty_cycle(data->reg_val[FAN_DUTY_CYCLE_PERCENTAGE]); */
/* ret = sprintf(buf, "%u\n", duty_cycle); */
/* break; */
/* } */
case FAN1_FRONT_SPEED_RPM:
case FAN2_FRONT_SPEED_RPM:
case FAN3_FRONT_SPEED_RPM:
case FAN4_FRONT_SPEED_RPM:
case FAN5_FRONT_SPEED_RPM:
case FAN6_FRONT_SPEED_RPM:
case FAN1_REAR_SPEED_RPM:
case FAN2_REAR_SPEED_RPM:
case FAN3_REAR_SPEED_RPM:
case FAN4_REAR_SPEED_RPM:
case FAN5_REAR_SPEED_RPM:
case FAN6_REAR_SPEED_RPM:
val = i2c_smbus_read_byte_data(client, sda->index);
ret = sprintf(buf, "%d\n", val * 150);
break;
case FAN1_FAULT:
case FAN2_FAULT:
case FAN3_FAULT:
case FAN4_FAULT:
case FAN5_FAULT:
case FAN6_FAULT:
val = i2c_smbus_read_byte_data(client, (sda->index - FAN1_FAULT)*2 + FAN1_FRONT_SPEED_RPM);
val2 = i2c_smbus_read_byte_data(client, (sda->index - FAN1_FAULT)*2 + FAN1_REAR_SPEED_RPM);
ret = sprintf(buf, "%d\n", (val|val2) ? 0 : 1);
break;
default:
break;
}
return ret;
}
static ssize_t fan_show_status_reg(struct device *dev, struct device_attribute *attr, char *buf)
{
struct sensor_device_attribute *sda = to_sensor_dev_attr(attr);
struct i2c_client *client = to_i2c_client(dev);
ssize_t ret = 0;
int val;
u8 fan_status_offset = 0;
switch (sda->index) {
case FAN1_PRESENT:
case FAN1_DIRECTION:
fan_status_offset = FAN1_STATUS_REG;
break;
case FAN2_PRESENT:
case FAN2_DIRECTION:
fan_status_offset = FAN2_STATUS_REG;
break;
case FAN3_PRESENT:
case FAN3_DIRECTION:
fan_status_offset = FAN3_STATUS_REG;
break;
case FAN4_PRESENT:
case FAN4_DIRECTION:
fan_status_offset = FAN4_STATUS_REG;
break;
case FAN5_PRESENT:
case FAN5_DIRECTION:
fan_status_offset = FAN5_STATUS_REG;
break;
case FAN6_PRESENT:
case FAN6_DIRECTION:
fan_status_offset = FAN6_STATUS_REG;
break;
default:
break;
}
switch (sda->index) {
case FAN1_PRESENT:
case FAN2_PRESENT:
case FAN3_PRESENT:
case FAN4_PRESENT:
case FAN5_PRESENT:
case FAN6_PRESENT:
val = i2c_smbus_read_byte_data(client, fan_status_offset);
/* Debug Msg
printk(KERN_ERR "%s: Present: fan_status_offset: %d, Value: %d \n", __FUNCTION__, fan_status_offset, val);
*/
ret = sprintf(buf, "%d\n", (val & FAN_PRESENT_BIT) ? 1 : 0);
break;
case FAN1_DIRECTION:
case FAN2_DIRECTION:
case FAN3_DIRECTION:
case FAN4_DIRECTION:
case FAN5_DIRECTION:
case FAN6_DIRECTION:
val = i2c_smbus_read_byte_data(client, fan_status_offset);
/* Debug Msg
printk(KERN_ERR "%s: Direction: fan_status_offset: %d, Value: %d \n", __FUNCTION__, fan_status_offset, val);
*/
ret = sprintf(buf, "%d\n", (val & FAN_DIRECTION_BIT) ? 1 : 0);
break;
default:
break;
}
return ret;
}
static ssize_t sys_led_read(struct device *dev, struct device_attribute *attr, char *buf)
{
int val = 0, res = 0;
u8 command;
struct i2c_client *client = to_i2c_client(dev);
struct sensor_device_attribute *sda = to_sensor_dev_attr(attr);
switch(sda->index) {
case SYS_LOCATOR:
case SYS_PWR:
case PORT_LED_DISABLE:
command = SYS_LED_REG;
break;
case SYS_STATUS:
case FAN1_LED:
case FAN2_LED:
case FAN3_LED:
case FAN4_LED:
case FAN5_LED:
case FAN6_LED:
command = SYS2_LED_REG;
break;
case SYS_RESET1:
command = SYS_RESET1_REG;
break;
case SYS_RESET2:
command = SYS_RESET2_REG;
break;
case SYS_RESET3:
command = SYS_RESET3_REG;
break;
}
val = i2c_smbus_read_byte_data(client, command);
if (val < 0) {
dev_dbg(&client->dev, "fpga(0x%x) reg(0x1) err %d\n", client->addr, val);
}
switch(sda->index) {
case SYS_LOCATOR:
res = (val & SYS_LOCATOR_LED_BITS) >> 0;
break;
case SYS_PWR:
res = (val & SYS_PWR_LED_BITS) >> 3;
break;
case PORT_LED_DISABLE:
res = (val & PORT_LED_DISABLE_BITS) >> 6;
break;
case SYS_STATUS:
res = (val & SYS_STATUS_LED_BITS) >> 0;
break;
case FAN1_LED:
case FAN3_LED:
case FAN5_LED:
case FAN2_LED:
case FAN4_LED:
case FAN6_LED:
res = (val & SYS_FAN_LED_BITS) >> 3;
break;
case SYS_RESET1:
res = val;
break;
case SYS_RESET2:
res = val;
break;
case SYS_RESET3:
res = val;
break;
}
return sprintf(buf, "%d\n", res);
}
static ssize_t sys_led_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
struct i2c_client *client = to_i2c_client(dev);
struct sensor_device_attribute *sda = to_sensor_dev_attr(attr);
int error, write, command, read;
error = kstrtoint(buf, 10, &write);
if (error)
return error;
switch(sda->index) {
case SYS_LOCATOR:
case SYS_PWR:
case PORT_LED_DISABLE:
if(write < 0 || write > 7)
return -EINVAL;
command = SYS_LED_REG;
break;
case SYS_STATUS:
if (write < 0 || write > 7)
return -EINVAL;
command = SYS2_LED_REG;
break;
case FAN1_LED:
case FAN2_LED:
case FAN3_LED:
case FAN4_LED:
case FAN5_LED:
case FAN6_LED:
if (write < 0 || write > 7)
return -EINVAL;
command = SYS2_LED_REG;
break;
case SYS_RESET1:
if (write < 0 || write > 255)
return -EINVAL;
command = SYS_RESET1_REG;
break;
case SYS_RESET2:
if (write < 0 || write > 255)
return -EINVAL;
command = SYS_RESET2_REG;
break;
case SYS_RESET3:
if (write < 0 || write > 255)
return -EINVAL;
command = SYS_RESET3_REG;
break;
}
read = i2c_smbus_read_byte_data(client, command);
if (read < 0) {
dev_dbg(&client->dev, "fpga(0x%x) reg(0x1) err %d\n", client->addr, read);
}
switch(sda->index) {
case SYS_LOCATOR:
read &= ~SYS_LOCATOR_LED_BITS;
read |= write << 0;
break;
case SYS_PWR:
read &= ~SYS_PWR_LED_BITS;
read |= write << 3;
break;
case PORT_LED_DISABLE:
read &= ~PORT_LED_DISABLE_BITS;
read |= write << 6;
break;
case SYS_STATUS:
read &= ~SYS_STATUS_LED_BITS;
read |= write << 0;
break;
case FAN1_LED:
case FAN3_LED:
case FAN5_LED:
case FAN2_LED:
case FAN4_LED:
case FAN6_LED:
read &= ~SYS_FAN_LED_BITS;
read |= write << 3;
break;
case SYS_RESET1:
read = write;
break;
case SYS_RESET2:
read = write;
break;
case SYS_RESET3:
read = write;
break;
}
i2c_smbus_write_byte_data(client, command, read);
return count;
}
static ssize_t sys_sfp_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
struct i2c_client *client = to_i2c_client(dev);
struct sensor_device_attribute *sda = to_sensor_dev_attr(attr);
int error, write, command;
error = kstrtoint(buf, 10, &write);
if (error)
return error;
switch(sda->index) {
case SFP_TX_FAULT:
command = SFP_TX_FAULT_MASK_REG;
break;
case SFP_TX_DISABLE:
command = SFP_TX_DISABLE_REG;
break;
case SFP_PRESENT:
command = SFP_PRESENT_MASK_REG;
case SFP_RX_LOSS:
command = SFP_RX_LOSS_MASK_REG;
break;
default:
return 0;
}
i2c_smbus_write_byte_data(client, command, write);
return count;
}
static ssize_t sys_sfp_read(struct device *dev, struct device_attribute *attr, char *buf)
{
int val = 0, res = 0;
u8 command;
struct i2c_client *client = to_i2c_client(dev);
struct sensor_device_attribute *sda = to_sensor_dev_attr(attr);
switch(sda->index) {
case SFP_TX_FAULT:
command = SFP_TX_FAULT_REG;
break;
case SFP_TX_DISABLE:
command = SFP_TX_DISABLE_REG;
break;
case SFP_PRESENT:
command = SFP_PRESENT_REG;
break;
case SFP_RX_LOSS:
command = SFP_RX_LOSS_REG;
break;
}
val = i2c_smbus_read_byte_data(client, command);
if (val < 0) {
dev_dbg(&client->dev, "fpga(0x%x) reg(0x1) err %d\n", client->addr, val);
}
res = val;
return sprintf(buf, "%d\n", res);
}
static void alpha_i2c_fpga_add_client(struct i2c_client *client)
{
struct fpga_client_node *node = kzalloc(sizeof(struct fpga_client_node), GFP_KERNEL);
if (!node) {
dev_dbg(&client->dev, "Can't allocate fpga_client_node (0x%x)\n", client->addr);
return;
}
node->client = client;
mutex_lock(&list_lock);
list_add(&node->list, &fpga_client_list);
mutex_unlock(&list_lock);
}
static void alpha_i2c_fpga_remove_client(struct i2c_client *client)
{
struct list_head *list_node = NULL;
struct fpga_client_node *fpga_node = NULL;
int found = 0;
mutex_lock(&list_lock);
list_for_each(list_node, &fpga_client_list)
{
fpga_node = list_entry(list_node, struct fpga_client_node, list);
if (fpga_node->client == client) {
found = 1;
break;
}
}
if (found) {
list_del(list_node);
kfree(fpga_node);
}
mutex_unlock(&list_lock);
}
static int alpha_i2c_fpga_probe(struct i2c_client *client,
const struct i2c_device_id *dev_id)
{
int status;
struct alphanetworks_snj60d0_320f_pwr_fpga_data* data;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
dev_dbg(&client->dev, "i2c_check_functionality failed (0x%x)\n", client->addr);
status = -EIO;
goto exit;
}
data = kzalloc(sizeof(struct alphanetworks_snj60d0_320f_pwr_fpga_data), GFP_KERNEL);
if (!data) {
status = -ENOMEM;
goto exit;
}
status = sysfs_create_group(&client->dev.kobj, &alphanetworks_snj60d0_320f_fpga_group);
if (status) {
goto exit;
}
dev_info(&client->dev, "chip found\n");
alpha_i2c_fpga_add_client(client);
data->hwmon_dev = hwmon_device_register(&client->dev);
if (IS_ERR(data->hwmon_dev)) {
status = PTR_ERR(data->hwmon_dev);
goto exit;
}
dev_info(&client->dev, "%s: pwr_fpga '%s'\n",
dev_name(data->hwmon_dev), client->name);
return 0;
exit:
return status;
}
static int alpha_i2c_fpga_remove(struct i2c_client *client)
{
struct alphanetworks_snj60d0_320f_pwr_fpga_data *data = i2c_get_clientdata(client);
sysfs_remove_group(&client->dev.kobj, &alphanetworks_snj60d0_320f_fpga_group);
alpha_i2c_fpga_remove_client(client);
kfree(data);
return 0;
}
static const struct i2c_device_id alpha_i2c_fpga_id[] = {
{ DRIVER_NAME, 0 },
{}
};
MODULE_DEVICE_TABLE(i2c, alpha_i2c_fpga_id);
static struct i2c_driver alpha_i2c_fpga_driver = {
.class = I2C_CLASS_HWMON,
.driver = {
.name = DRIVER_NAME,
},
.probe = alpha_i2c_fpga_probe,
.remove = alpha_i2c_fpga_remove,
.id_table = alpha_i2c_fpga_id,
.address_list = normal_i2c,
};
int alpha_i2c_fpga_read(unsigned short fpga_addr, u8 reg)
{
struct list_head *list_node = NULL;
struct fpga_client_node *fpga_node = NULL;
int ret = -EPERM;
mutex_lock(&list_lock);
list_for_each(list_node, &fpga_client_list)
{
fpga_node = list_entry(list_node, struct fpga_client_node, list);
if (fpga_node->client->addr == fpga_addr) {
ret = i2c_smbus_read_byte_data(fpga_node->client, reg);
break;
}
}
mutex_unlock(&list_lock);
return ret;
}
EXPORT_SYMBOL(alpha_i2c_fpga_read);
int alpha_i2c_fpga_write(unsigned short fpga_addr, u8 reg, u8 value)
{
struct list_head *list_node = NULL;
struct fpga_client_node *fpga_node = NULL;
int ret = -EIO;
mutex_lock(&list_lock);
list_for_each(list_node, &fpga_client_list)
{
fpga_node = list_entry(list_node, struct fpga_client_node, list);
if (fpga_node->client->addr == fpga_addr) {
ret = i2c_smbus_write_byte_data(fpga_node->client, reg, value);
break;
}
}
mutex_unlock(&list_lock);
return ret;
}
EXPORT_SYMBOL(alpha_i2c_fpga_write);
static int __init alpha_i2c_fpga_init(void)
{
mutex_init(&list_lock);
return i2c_add_driver(&alpha_i2c_fpga_driver);
}
static void __exit alpha_i2c_fpga_exit(void)
{
i2c_del_driver(&alpha_i2c_fpga_driver);
}
MODULE_AUTHOR("Alpha-SID6");
MODULE_DESCRIPTION("alpha fpga driver");
MODULE_LICENSE("GPL");
module_init(alpha_i2c_fpga_init);
module_exit(alpha_i2c_fpga_exit);

View File

@ -0,0 +1,209 @@
/*
* A driver for alphanetworks_snj60d0_320f ONIE EEPROM
*
* Copyright (C) 2020 Alphanetworks Technology Corporation.
* Robin Chen <Robin_chen@Alphanetworks.com>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* see <http://www.gnu.org/licenses/>
*
* Based on ad7414.c
* Copyright 2006 Stefan Roese <sr at denx.de>, DENX Software Engineering
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/mutex.h>
#define EEPROM_SIZE 256
static ssize_t onie_read(struct device *dev, struct device_attribute *attr, char *buf);
static ssize_t onie_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
/* Each client has this additional data
*/
struct snj60d0_320f_onie_eeprom_data
{
struct mutex update_lock;
unsigned char onie_eeprom[EEPROM_SIZE];
};
/* Addresses scanned for snj60d0-320f_onie_eeprom */
static const unsigned short normal_i2c[] = { 0x56, I2C_CLIENT_END };
enum snj60d0_320f_onie_eeprom_sysfs_attributes {
ONIE_RW,
};
static SENSOR_DEVICE_ATTR(eeprom, (0660), onie_read, onie_write, ONIE_RW);
static struct attribute *snj60d0_onie_attributes[] = {
&sensor_dev_attr_eeprom.dev_attr.attr,
NULL
};
static const struct attribute_group snj60d0_onie_group = {
.attrs = snj60d0_onie_attributes,
};
static ssize_t onie_read(struct device *dev, struct device_attribute *attr, char *buf)
{
int val = 0, res = 0;
u8 command;
__u8 read_write;
unsigned short offset = 0;
union i2c_smbus_data temp;
struct i2c_client *client = to_i2c_client(dev);
struct snj60d0_320f_onie_eeprom_data *data = i2c_get_clientdata(client);
mutex_lock(&data->update_lock);
read_write = I2C_SMBUS_WRITE;
offset = offset & 0x3fff;
temp.byte = (u8)offset;
res = i2c_smbus_xfer(client->adapter, client->addr, client->flags=0,
read_write, 0, 2, &temp);
res = i2c_smbus_xfer(client->adapter, client->addr, client->flags=0,
read_write, 0, 2, &temp);
for( offset=0 ; offset < EEPROM_SIZE ; ++offset )
{
read_write = I2C_SMBUS_READ;
res = i2c_smbus_xfer(client->adapter, client->addr, client->flags=0,
read_write, 0, 1, &temp);
if (!res)
{
data->onie_eeprom[offset] = temp.byte;
}
}
memcpy(buf, data->onie_eeprom, EEPROM_SIZE);
mutex_unlock(&data->update_lock);
return EEPROM_SIZE;
}
static ssize_t onie_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
struct i2c_client *client = to_i2c_client(dev);
int error, write, command, read;
error = kstrtoint(buf, 10, &write);
if (error)
return error;
if (write < 0 || write > 255)
return -EINVAL;
/* Not support yet */
return count;
}
static int onie_eeprom_probe(struct i2c_client *client,
const struct i2c_device_id *dev_id)
{
struct snj60d0_320f_onie_eeprom_data *data;
int status;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
dev_dbg(&client->dev, "i2c_check_functionality failed (0x%x)\n", client->addr);
status = -EIO;
goto exit;
}
data = kzalloc(sizeof(struct snj60d0_320f_onie_eeprom_data), GFP_KERNEL);
if (!data) {
status = -ENOMEM;
goto exit;
}
i2c_set_clientdata(client, data);
mutex_init(&data->update_lock);
dev_info(&client->dev, "chip found\n");
/* Register sysfs hooks */
status = sysfs_create_group(&client->dev.kobj, &snj60d0_onie_group);
if (status) {
goto exit_free;
}
return 0;
exit_free:
kfree(data);
exit:
return status;
}
static int onie_eeprom_remove(struct i2c_client *client)
{
struct snj60d0_320f_onie_eeprom_data *data = i2c_get_clientdata(client);
sysfs_remove_group(&client->dev.kobj, &snj60d0_onie_group);
kfree(data);
return 0;
}
static const struct i2c_device_id onie_eeprom_id[] = {
{ "snj60d0_onie_eeprom", 0 },
{}
};
MODULE_DEVICE_TABLE(i2c, onie_eeprom_id);
static struct i2c_driver onie_eeprom_driver = {
.driver = {
.name = "snj60d0_onie_eeprom",
},
.probe = onie_eeprom_probe,
.remove = onie_eeprom_remove,
.id_table = onie_eeprom_id,
.address_list = normal_i2c,
};
static int __init onie_eeprom_init(void)
{
return i2c_add_driver(&onie_eeprom_driver);
}
static void __exit onie_eeprom_exit(void)
{
i2c_del_driver(&onie_eeprom_driver);
}
module_init(onie_eeprom_init);
module_exit(onie_eeprom_exit);
MODULE_AUTHOR("Alpha-SID6");
MODULE_DESCRIPTION("ONIE EEPROM Driver");
MODULE_LICENSE("GPL");

View File

@ -0,0 +1,459 @@
/*
* An hwmon driver for the 3Y Power YESM1300AM Power Module
*
* Copyright (C) 2014 Accton Technology Corporation.
* Brandon Chuang <brandon_chuang@accton.com.tw>
*
* Based on ad7414.c
* Copyright 2006 Stefan Roese <sr at denx.de>, DENX Software Engineering
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/module.h>
#include <linux/jiffies.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/sysfs.h>
#include <linux/slab.h>
/* PMBus Protocol. */
#define PSU_REG_VOUT_MODE 0x20
#define PSU_REG_READ_VIN 0x88
#define PSU_REG_READ_IIN 0x89
#define PSU_REG_READ_VOUT 0x8B
#define PSU_REG_READ_IOUT 0x8C
#define PSU_REG_READ_TEMPERATURE_1 0x8D
#define PSU_REG_READ_FAN_SPEED_1 0x90
#define PSU_REG_READ_POUT 0x96
#define PSU_REG_READ_PIN 0x97
#define PSU_REG_MFR_ID 0x99
#define PSU_REG_MFR_MODEL 0x9A
#define PSU_REG_MFR_POUT_MAX 0xA7
/* Addresses scanned
*/
static const unsigned short normal_i2c[] = {0x58, 0x59, I2C_CLIENT_END};
/* Each client has this additional data
*/
struct yesm1300am_data
{
struct device *hwmon_dev;
struct mutex update_lock;
char valid; /* !=0 if registers are valid */
unsigned long last_updated; /* In jiffies */
u8 vout_mode; /* Register value */
u16 v_in; /* Register value */
u16 v_out; /* Register value */
u16 i_in; /* Register value */
u16 i_out; /* Register value */
u16 p_in; /* Register value */
u16 p_out; /* Register value */
u16 temp1_input; /* Register value */
u16 fan_speed; /* Register value */
u8 mfr_id[10]; /* Register value */
u8 mfr_model[12]; /* Register value */
u16 mfr_pout_max; /* Register value */
};
static ssize_t show_vout_by_mode(struct device *dev, struct device_attribute *da, char *buf);
static ssize_t show_linear(struct device *dev, struct device_attribute *da, char *buf);
static ssize_t show_ascii(struct device *dev, struct device_attribute *da, char *buf);
static struct yesm1300am_data *yesm1300am_update_device(struct device *dev);
enum yesm1300am_sysfs_attributes
{
PSU_V_IN,
PSU_V_OUT,
PSU_I_IN,
PSU_I_OUT,
PSU_P_IN,
PSU_P_OUT_UW,
PSU_P_OUT,
PSU_TEMP1_INPUT,
PSU_FAN1_SPEED,
PSU_MFR_ID,
PSU_MODEL_NAME,
PSU_MFR_POUT_MAX
};
/* sysfs attributes for hwmon
*/
static SENSOR_DEVICE_ATTR(psu_v_in, S_IRUGO, show_linear, NULL, PSU_V_IN);
static SENSOR_DEVICE_ATTR(psu_v_out, S_IRUGO, show_vout_by_mode, NULL, PSU_V_OUT);
static SENSOR_DEVICE_ATTR(psu_i_in, S_IRUGO, show_linear, NULL, PSU_I_IN);
static SENSOR_DEVICE_ATTR(psu_i_out, S_IRUGO, show_linear, NULL, PSU_I_OUT);
static SENSOR_DEVICE_ATTR(psu_p_in, S_IRUGO, show_linear, NULL, PSU_P_IN);
static SENSOR_DEVICE_ATTR(psu_p_out, S_IRUGO, show_linear, NULL, PSU_P_OUT);
static SENSOR_DEVICE_ATTR(psu_temp1_input, S_IRUGO, show_linear, NULL, PSU_TEMP1_INPUT);
static SENSOR_DEVICE_ATTR(psu_fan1_speed_rpm, S_IRUGO, show_linear, NULL, PSU_FAN1_SPEED);
static SENSOR_DEVICE_ATTR(psu_mfr_id, S_IRUGO, show_ascii, NULL, PSU_MFR_ID);
static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_ascii, NULL, PSU_MODEL_NAME);
static SENSOR_DEVICE_ATTR(psu_mfr_pout_max, S_IRUGO, show_linear, NULL, PSU_MFR_POUT_MAX);
/*Duplicate nodes for lm-sensors.*/
static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_vout_by_mode, NULL, PSU_V_OUT);
static SENSOR_DEVICE_ATTR(curr2_input, S_IRUGO, show_linear, NULL, PSU_I_OUT);
static SENSOR_DEVICE_ATTR(power2_input, S_IRUGO, show_linear, NULL, PSU_P_OUT_UW);
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_linear, NULL, PSU_TEMP1_INPUT);
static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_linear, NULL, PSU_FAN1_SPEED);
static struct attribute *yesm1300am_attributes[] = {
&sensor_dev_attr_psu_v_in.dev_attr.attr,
&sensor_dev_attr_psu_v_out.dev_attr.attr,
&sensor_dev_attr_psu_i_in.dev_attr.attr,
&sensor_dev_attr_psu_i_out.dev_attr.attr,
&sensor_dev_attr_psu_p_in.dev_attr.attr,
&sensor_dev_attr_psu_p_out.dev_attr.attr,
&sensor_dev_attr_psu_temp1_input.dev_attr.attr,
&sensor_dev_attr_psu_fan1_speed_rpm.dev_attr.attr,
&sensor_dev_attr_psu_mfr_id.dev_attr.attr,
&sensor_dev_attr_psu_model_name.dev_attr.attr,
&sensor_dev_attr_psu_mfr_pout_max.dev_attr.attr,
/*Duplicate nodes for lm-sensors.*/
&sensor_dev_attr_curr2_input.dev_attr.attr,
&sensor_dev_attr_in3_input.dev_attr.attr,
&sensor_dev_attr_power2_input.dev_attr.attr,
&sensor_dev_attr_temp1_input.dev_attr.attr,
&sensor_dev_attr_fan1_input.dev_attr.attr,
NULL};
static int two_complement_to_int(u16 data, u8 valid_bit, int mask)
{
u16 valid_data = data & mask;
bool is_negative = valid_data >> (valid_bit - 1);
return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data;
}
static ssize_t show_linear(struct device *dev, struct device_attribute *da,
char *buf)
{
struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
struct yesm1300am_data *data = yesm1300am_update_device(dev);
u16 value = 0;
int exponent, mantissa;
int multiplier = 1000;
switch (attr->index)
{
case PSU_V_IN:
value = data->v_in;
break;
case PSU_I_IN:
value = data->i_in;
break;
case PSU_I_OUT:
value = data->i_out;
break;
case PSU_P_IN:
value = data->p_in;
break;
case PSU_P_OUT:
value = data->p_out;
break;
case PSU_P_OUT_UW:
value = data->p_out;
multiplier = 1000000;
break;
case PSU_TEMP1_INPUT:
value = data->temp1_input;
break;
case PSU_FAN1_SPEED:
value = data->fan_speed;
multiplier = 1;
break;
case PSU_MFR_POUT_MAX:
value = data->mfr_pout_max;
break;
}
exponent = two_complement_to_int(value >> 11, 5, 0x1f);
mantissa = two_complement_to_int(value & 0x7ff, 11, 0x7ff);
return (exponent >= 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent));
}
static ssize_t show_ascii(struct device *dev, struct device_attribute *da,
char *buf)
{
struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
struct yesm1300am_data *data = yesm1300am_update_device(dev);
u8 *ptr = NULL;
switch (attr->index)
{
case PSU_MFR_ID: /* psu_mfr_id */
ptr = data->mfr_id;
break;
case PSU_MODEL_NAME: /* psu_mfr_model */
ptr = data->mfr_model;
break;
default:
return 0;
}
return sprintf(buf, "%s\n", ptr);
}
static ssize_t show_vout_by_mode(struct device *dev, struct device_attribute *da,
char *buf)
{
struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
struct yesm1300am_data *data = yesm1300am_update_device(dev);
int exponent, mantissa;
int multiplier = 1000;
if (!data->valid)
{
return 0;
}
exponent = two_complement_to_int(data->vout_mode, 5, 0x1f);
switch (attr->index)
{
case PSU_V_OUT:
mantissa = data->v_out;
break;
default:
return 0;
}
return (exponent > 0) ? sprintf(buf, "%d\n", (mantissa << exponent) * multiplier) : sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent));
}
static const struct attribute_group yesm1300am_group = {
.attrs = yesm1300am_attributes,
};
static int yesm1300am_probe(struct i2c_client *client,
const struct i2c_device_id *dev_id)
{
struct yesm1300am_data *data;
int status;
if (!i2c_check_functionality(client->adapter,
I2C_FUNC_SMBUS_BYTE_DATA |
I2C_FUNC_SMBUS_WORD_DATA |
I2C_FUNC_SMBUS_I2C_BLOCK))
{
status = -EIO;
goto exit;
}
data = kzalloc(sizeof(struct yesm1300am_data), GFP_KERNEL);
if (!data)
{
status = -ENOMEM;
goto exit;
}
i2c_set_clientdata(client, data);
mutex_init(&data->update_lock);
dev_info(&client->dev, "chip found\n");
/* Register sysfs hooks */
status = sysfs_create_group(&client->dev.kobj, &yesm1300am_group);
if (status)
{
goto exit_free;
}
data->hwmon_dev = hwmon_device_register(&client->dev);
if (IS_ERR(data->hwmon_dev))
{
status = PTR_ERR(data->hwmon_dev);
goto exit_remove;
}
dev_info(&client->dev, "%s: psu '%s'\n",
dev_name(data->hwmon_dev), client->name);
return 0;
exit_remove:
sysfs_remove_group(&client->dev.kobj, &yesm1300am_group);
exit_free:
kfree(data);
exit:
return status;
}
static int yesm1300am_remove(struct i2c_client *client)
{
struct yesm1300am_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &yesm1300am_group);
kfree(data);
return 0;
}
static const struct i2c_device_id yesm1300am_id[] = {
{"yesm1300am", 0},
{}
};
MODULE_DEVICE_TABLE(i2c, yesm1300am_id);
static struct i2c_driver yesm1300am_driver = {
.class = I2C_CLASS_HWMON,
.driver = {
.name = "yesm1300am",
},
.probe = yesm1300am_probe,
.remove = yesm1300am_remove,
.id_table = yesm1300am_id,
.address_list = normal_i2c,
};
static int yesm1300am_read_byte(struct i2c_client *client, u8 reg)
{
return i2c_smbus_read_byte_data(client, reg);
}
static int yesm1300am_read_word(struct i2c_client *client, u8 reg)
{
return i2c_smbus_read_word_data(client, reg);
}
static int yesm1300am_read_block(struct i2c_client *client, u8 command, u8 *data,
int data_len)
{
int result = i2c_smbus_read_i2c_block_data(client, command, data_len, data);
if (unlikely(result < 0))
goto abort;
if (unlikely(result != data_len))
{
result = -EIO;
goto abort;
}
result = 0;
abort:
return result;
}
struct reg_data_byte
{
u8 reg;
u8 *value;
};
struct reg_data_word
{
u8 reg;
u16 *value;
};
static struct yesm1300am_data *yesm1300am_update_device(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct yesm1300am_data *data = i2c_get_clientdata(client);
mutex_lock(&data->update_lock);
if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || !data->valid)
{
int i, status;
u8 command;
struct reg_data_byte regs_byte[] = {{PSU_REG_VOUT_MODE, &data->vout_mode}};
struct reg_data_word regs_word[] = {{PSU_REG_READ_VIN, &data->v_in},
{PSU_REG_READ_VOUT, &data->v_out},
{PSU_REG_READ_IIN, &data->i_in},
{PSU_REG_READ_IOUT, &data->i_out},
{PSU_REG_READ_PIN, &data->p_in},
{PSU_REG_READ_POUT, &data->p_out},
{PSU_REG_READ_TEMPERATURE_1, &data->temp1_input},
{PSU_REG_READ_FAN_SPEED_1, &data->fan_speed},
{PSU_REG_MFR_POUT_MAX, &data->mfr_pout_max}};
dev_dbg(&client->dev, "Starting yesm1300am update\n");
/* Read byte data */
for (i = 0; i < ARRAY_SIZE(regs_byte); i++)
{
status = yesm1300am_read_byte(client, regs_byte[i].reg);
if (status < 0)
{
dev_dbg(&client->dev, "reg %d, err %d\n",
regs_byte[i].reg, status);
*(regs_byte[i].value) = 0;
}
else
{
*(regs_byte[i].value) = status;
}
}
/* Read word data */
for (i = 0; i < ARRAY_SIZE(regs_word); i++)
{
status = yesm1300am_read_word(client, regs_word[i].reg);
if (status < 0)
{
dev_dbg(&client->dev, "reg %d, err %d\n",
regs_word[i].reg, status);
*(regs_word[i].value) = 0;
}
else
{
*(regs_word[i].value) = status;
}
}
/* Read mfr_id */
command = PSU_REG_MFR_ID;
status = yesm1300am_read_block(client, command, data->mfr_id,
ARRAY_SIZE(data->mfr_id) - 1);
data->mfr_id[ARRAY_SIZE(data->mfr_id) - 1] = '\0';
strncpy(data->mfr_id, (u8 *)&data->mfr_id + 1, ARRAY_SIZE(data->mfr_id) - 1);
if (status < 0)
dev_dbg(&client->dev, "reg %d, err %d\n", command, status);
/* Read mfr_model */
command = PSU_REG_MFR_MODEL;
status = yesm1300am_read_block(client, command, data->mfr_model,
ARRAY_SIZE(data->mfr_model) - 1);
data->mfr_model[ARRAY_SIZE(data->mfr_model) - 1] = '\0';
strncpy(data->mfr_model, (u8 *)&data->mfr_model + 1, ARRAY_SIZE(data->mfr_model) - 1);
if (status < 0)
dev_dbg(&client->dev, "reg %d, err %d\n", command, status);
data->last_updated = jiffies;
data->valid = 1;
}
mutex_unlock(&data->update_lock);
return data;
}
module_i2c_driver(yesm1300am_driver);
MODULE_AUTHOR("Alpha-SID6");
MODULE_DESCRIPTION("3Y Power yesm1300am driver");
MODULE_LICENSE("GPL");

View File

@ -0,0 +1,13 @@
[Unit]
Description=Alphanetworks SNJ60D0-320F Platform initialization service
Before=pmon.service
DefaultDependencies=no
[Service]
Type=oneshot
ExecStart=/usr/local/bin/alphanetworks_snj60d0_util.py -f install
ExecStop=/usr/local/bin/alphanetworks_snj60d0_util.py clean
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,12 @@
import os
from setuptools import setup
os.listdir
setup(
name='sonic-platform',
version='1.0',
description='Module to initialize Alphanetworks SNJ60D0-320F platforms',
packages=['sonic_platform'],
)

View File

@ -0,0 +1,2 @@
__all__ = ['chassis', 'eeprom', 'platform', 'psu', 'sfp', 'thermal', 'fan']
from . import platform

View File

@ -0,0 +1,265 @@
#############################################################################
# Alphanetworks
#
# Module contains an implementation of SONiC Platform Base API and
# provides the Chassis information which are available in the platform
#
#############################################################################
import time
try:
from sonic_platform_base.chassis_base import ChassisBase
from sonic_platform.fan import Fan
from sonic_platform.psu import Psu
from sonic_platform.sfp import Sfp
from sonic_platform.eeprom import Eeprom
from sonic_platform.thermal import Thermal
from sonic_platform.fan_drawer import FanDrawer
from sonic_platform.led import FanLed
from sonic_platform.led import PsuLed
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class Chassis(ChassisBase):
NUM_THERMAL = 3
NUM_FANDRAWER = 6
NUM_FANSPERDRAWER = 2
NUM_FAN = NUM_FANDRAWER * NUM_FANSPERDRAWER
NUM_PSU = 2
NUM_SFP = 34
HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/"
PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/"
REBOOT_CAUSE_FILE = "reboot-cause.txt"
PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt"
HOST_CHK_CMD = "docker > /dev/null 2>&1"
def __init__(self):
ChassisBase.__init__(self)
# initialize thermals
for index in range(0, Chassis.NUM_THERMAL):
thermal = Thermal(index)
self._thermal_list.append(thermal)
# initialize fans
for index in range(0, Chassis.NUM_FANDRAWER):
fan_drawer = FanDrawer(index)
for i in range(0, Chassis.NUM_FANSPERDRAWER):
fan_index = Chassis.NUM_FANSPERDRAWER * index + i
fan = Fan(fan_index, False)
fan_drawer._fan_list.append(fan)
self._fan_list.append(fan)
self._fan_drawer_list.append(fan_drawer)
# initialize fan led
self.fan_led = FanLed.get_fanLed()
self.fan_led.set_fans(self._fan_list)
# initialize psus
for index in range(0, Chassis.NUM_PSU):
psu = Psu(index)
self._psu_list.append(psu)
# initialize psu led
self.psu_led = PsuLed.get_psuLed()
self.psu_led.set_psus(self._psu_list)
# initialize sfps
self.sfp_state = []
for index in range(0, Chassis.NUM_SFP):
if (index < Chassis.NUM_SFP-2):
sfp = Sfp(index, 'QSFP')
else:
sfp = Sfp(index, 'SFP')
self._sfp_list.append(sfp)
# initialize eeprom
self._eeprom = Eeprom()
def get_change_event(self, timeout=0):
"""
Returns a nested dictionary containing all devices which have
experienced a change at chassis level
Args:
timeout: Timeout in milliseconds (optional). If timeout == 0,
this method will block until a change is detected.
Returns:
(bool, dict):
- True if call successful, False if not;
- A nested dictionary where key is a device type,
value is a dictionary with key:value pairs in the format of
{'device_id':'device_event'},
where device_id is the device ID for this device and
device_event,
status='1' represents device inserted,
status='0' represents device removed.
Ex. {'fan':{'0':'0', '2':'1'}, 'sfp':{'11':'0'}}
indicates that fan 0 has been removed, fan 2
has been inserted and sfp 11 has been removed.
Specifically for SFP event, besides SFP plug in and plug out,
there are some other error event could be raised from SFP, when
these error happened, SFP eeprom will not be avalaible, XCVRD shall
stop to read eeprom before SFP recovered from error status.
status='2' I2C bus stuck,
status='3' Bad eeprom,
status='4' Unsupported cable,
status='5' High Temperature,
status='6' Bad cable.
"""
change_event_dict = {"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
return False, {}
def get_transceiver_change_event(self, timeout=0):
start_time = time.time()
# SFP status definition from xcvrd
SFP_STATUS_INSERTED = '1'
SFP_STATUS_REMOVED = '0'
timeout = (timeout/1000)
end_time = start_time + timeout
while (timeout >= 0):
new_sfp_state = []
change_dict = {}
for index in range(self.get_num_sfps()):
# get current status
state = self._sfp_list[index].get_presence()
new_sfp_state.append(state)
if self.sfp_state == []:
change_dict[index] = SFP_STATUS_INSERTED if state == True else SFP_STATUS_REMOVED
elif state != self.sfp_state[index]:
change_dict[index] = SFP_STATUS_INSERTED if state == True else SFP_STATUS_REMOVED
self.sfp_state = new_sfp_state
current_time = time.time()
if bool(change_dict):
return True, change_dict
elif timeout == 0 or current_time < end_time:
time.sleep(1)
continue
else:
return True, {}
return False, {}
def get_thermal_manager(self):
from sonic_platform.thermal_manager import ThermalManager
return ThermalManager
def get_name(self):
"""
Retrieves the name of the device
Returns:
string: The name of the device
"""
return self._eeprom.modelstr()
def get_model(self):
"""
Retrieves the model number (or part number) of the chassis
Returns:
string: Model/part number of chassis
"""
return self._eeprom.part_number_str()
def get_serial(self):
"""
Retrieves the serial number of the device
Returns:
string: Serial number of device
"""
return self._eeprom.serial_number_str()
def get_system_eeprom_info(self):
"""
Retrieves the full content of system EEPROM information for the chassis
Returns:
A dictionary where keys are the type code defined in
OCP ONIE TlvInfo EEPROM format and values are their corresponding
values.
"""
return self._eeprom.get_system_eeprom_info()
def initizalize_system_led(self):
from .led import SystemLed
self._status_led = SystemLed.get_systemLed()
def set_status_led(self, color):
"""
Sets the state of the system LED
Args:
color: A string representing the color with which to set the
system LED
Returns:
bool: True if system LED state is set successfully, False if not
"""
if self._status_led is None:
self.initizalize_system_led()
return self._status_led.set_status(color)
def get_status_led(self):
"""
Gets the state of the system LED
Returns:
A string, one of the valid LED color strings which could be vendor
specified.
"""
if self._status_led is None:
self.initizalize_system_led()
return self._status_led.get_status()
def get_watchdog(self):
"""
Retreives hardware watchdog device on this chassis
Returns:
An object derived from WatchdogBase representing the hardware
watchdog device
"""
try:
if self._watchdog is None:
from sonic_platform.watchdog import Watchdog
# Create the watchdog Instance
self._watchdog = Watchdog()
except Exception as e:
syslog.syslog(syslog.LOG_ERR, "Fail to load watchdog due to {}".format(e))
return self._watchdog
def get_reboot_cause(self):
"""
Retrieves the cause of the previous reboot
Returns:
A tuple (string, string) where the first element is a string
containing the cause of the previous reboot. This string must be
one of the predefined strings in this class. If the first string
is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used
to pass a description of the reboot cause.
"""
reboot_cause_path = (Chassis.HOST_REBOOT_CAUSE_PATH + Chassis.REBOOT_CAUSE_FILE)
sw_reboot_cause = "Unknown"
try:
with open(reboot_cause_path, 'r') as fd:
sw_reboot_cause = fd.read().strip()
except IOError:
pass
return ('REBOOT_CAUSE_NON_HARDWARE', sw_reboot_cause)

View File

@ -0,0 +1,124 @@
#############################################################################
# Alphanetworks
#
# Module contains an implementation of SONiC Platform Base API and
# provides the eeprom information which are available in the platform
#
#############################################################################
import sys
if sys.version_info.major == 3:
from io import StringIO
else:
from cStringIO import StringIO
try:
from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
CACHE_ROOT = '/var/cache/sonic/decode-syseeprom'
CACHE_FILE = 'syseeprom_cache'
class Eeprom(eeprom_tlvinfo.TlvInfoDecoder):
_TLV_DISPLAY_VENDOR_EXT = True
EEPROM_DECODE_HEADLINES = 6
def __init__(self):
self.eeprom_path = "/sys/bus/i2c/devices/1-0056/eeprom"
super(Eeprom, self).__init__(self.eeprom_path, 0, '', True)
self.eeprom_tlv_dict = dict()
try:
self.eeprom_data = self.read_eeprom()
except Exception as e:
self.eeprom_data = "N/A"
print("eeprom_data {}".format(self.eeprom_data))
else:
eeprom = self.eeprom_data
if not self.is_valid_tlvinfo_header(eeprom):
return
total_length = ((eeprom[9]) << 8) | (eeprom[10])
tlv_index = self._TLV_INFO_HDR_LEN
tlv_end = self._TLV_INFO_HDR_LEN + total_length
while (tlv_index + 2) < len(eeprom) and tlv_index < tlv_end:
if not self.is_valid_tlv(eeprom[tlv_index:]):
break
tlv = eeprom[tlv_index:tlv_index + 2
+ (eeprom[tlv_index + 1])]
code = "0x%02X" % ((tlv[0]))
if (tlv[0]) == self._TLV_CODE_VENDOR_EXT:
value = str(((tlv[2]) << 24) | ((tlv[3]) << 16) |
((tlv[4]) << 8) | (tlv[5]))
value += str(tlv[6:6 + (tlv[1])])
else:
name, value = self.decoder(None, tlv)
self.eeprom_tlv_dict[code] = value
if (eeprom[tlv_index]) == self._TLV_CODE_CRC_32:
break
tlv_index += (eeprom[tlv_index+1]) + 2
def serial_number_str(self):
(is_valid, results) = self.get_tlv_field(self.eeprom_data, self._TLV_CODE_SERIAL_NUMBER)
if not is_valid:
return "N/A"
return results[2].decode('ascii')
def base_mac_addr(self):
(is_valid, t) = self.get_tlv_field(self.eeprom_data, self._TLV_CODE_MAC_BASE)
if not is_valid or t[1] != 6:
return super(TlvInfoDecoder, self).switchaddrstr(e)
return ":".join(["{:02x}".format(T) for T in t[2]]).upper()
def modelstr(self):
(is_valid, results) = self.get_tlv_field(self.eeprom_data, self._TLV_CODE_PRODUCT_NAME)
if not is_valid:
return "N/A"
return results[2].decode('ascii')
def platformstr(self):
(is_valid, results) = self.get_tlv_field(
self.eeprom_data, self._TLV_CODE_PLATFORM_NAME)
if not is_valid:
return "N/A"
return results[2].decode('ascii')
def part_number_str(self):
(is_valid, results) = self.get_tlv_field(self.eeprom_data, self._TLV_CODE_PART_NUMBER)
if not is_valid:
return "N/A"
return results[2].decode('ascii')
def serial_str(self):
(is_valid, results) = self.get_tlv_field(self.eeprom_data, self._TLV_CODE_SERVICE_TAG)
if not is_valid:
return "N/A"
return results[2].decode('ascii')
def revision_str(self):
(is_valid, results) = self.get_tlv_field(self.eeprom_data, self._TLV_CODE_DEVICE_VERSION)
if not is_valid:
return "N/A"
return results[2].decode('ascii')
def system_eeprom_info(self):
"""
Returns a dictionary, where keys are the type code defined in
ONIE EEPROM format and values are their corresponding values
found in the system EEPROM.
"""
return self.eeprom_tlv_dict

View File

@ -0,0 +1,261 @@
#############################################################################
# Alphanetworks
#
# Module contains an implementation of SONiC Platform Base API and
# provides the fan status which are available in the platform
#
#############################################################################
try:
from sonic_platform_base.fan_base import FanBase
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class Fan(FanBase):
"""Platform-specific Fan class"""
FAN_FRONT_RPM_MAX = 21000
FAN_REAR_RPM_MAX = 19000
PSU_FAN_RPM_MAX = 27000
FAN_SPEED_TOLERANCE_PERCENTAGE = 20
NUM_FANTRAYS = 6
FANS_PERTRAY = 2
def __init__(self, fan_index, is_psu_fan):
self.index = fan_index + 1
self.is_psu_fan = is_psu_fan
FanBase.__init__(self)
base_path = "/sys/bus/i2c/devices/"
if self.is_psu_fan:
psu_bus_num = [10, 11]
psu_pmbus_address = [58, 59]
self.psu_pmbus_path = base_path +"{}-00{}".format(psu_bus_num[self.index-1], psu_pmbus_address[self.index-1])
# driver attribute
self.psu_fan_rpm = "/psu_fan1_speed_rpm"
else:
self.fan_path = base_path + '1-005e'
self.fantray_index = int((fan_index)/self.FANS_PERTRAY) + 1
self.fan_index_intray = self.index - ((self.fantray_index-1)*self.FANS_PERTRAY)
self.fan_index_intray_str = 'front' if (self.fan_index_intray==1) else 'rear'
# driver attribute
self.fan_present = '/fan{}_present'.format(self.fantray_index)
self.fan_direction = '/fan{}_direction'.format(self.fantray_index)
self.fan_speed_rpm = '/fan{}_{}_speed_rpm'.format(self.fantray_index, self.fan_index_intray_str)
self.fan_speed_pwm = '/fan_pwm'
def get_name(self):
"""
Retrieves the name of the device
Returns:
string: The name of the device
"""
if self.is_psu_fan:
# each PSU has 1 Fan
return "PSU{}-FAN{}".format(self.index, 1)
else:
return "Fantray{}_{}".format(self.fantray_index, self.fan_index_intray)
def get_status(self):
"""
Retrieves the operational status of the device
Returns:
A boolean value, True if device is operating properly, False if not
"""
speed = self.get_speed_rpm()
status = True if (speed != 0) else False
return status
def get_presence(self):
"""
Retrieves the presence of the device
Returns:
bool: True if device is present, False if not
"""
if self.is_psu_fan:
return True
else:
status = 0
node = self.fan_path + self.fan_present
try:
with open(node, 'r') as presence_status:
status = int(presence_status.read())
except IOError as e:
return False
return status == 1
def get_direction(self):
"""
Retrieves the direction of fan
Returns:
A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST
depending on fan direction
"""
direction = ""
if self.is_psu_fan:
direction = self.FAN_DIRECTION_EXHAUST
else:
node = self.fan_path + self.fan_direction
try:
with open(node, 'r') as fan_dir:
val = int(fan_dir.read())
except IOError as e:
return direction
if val == 1:
direction = self.FAN_DIRECTION_INTAKE
else:
direction = self.FAN_DIRECTION_EXHAUST
return direction
def get_speed(self):
"""
Retrieves the speed of fan as a percentage of full speed
Returns:
An integer, the percentage of full fan speed, in the range 0 (off)
to 100 (full speed)
"""
speed = 0
if self.is_psu_fan:
rpm = self.get_speed_rpm()
speed = int((rpm * 100) / self.PSU_FAN_RPM_MAX)
else:
frpm = 0
node = self.fan_path + self.fan_speed_rpm
try:
with open(node, 'r') as speed:
frpm = int(speed.read())
except IOError as e:
return 0
if self.fan_index_intray == 1:
speed = int((frpm * 100) / self.FAN_FRONT_RPM_MAX)
else:
speed = int((frpm * 100) / self.FAN_REAR_RPM_MAX)
if speed > 100:
speed = 100
return speed
def get_speed_rpm(self):
"""
Retrieves the speed of fan in RPM
Returns:
An integer, representing speed of the FAN in rpm
"""
frpm = 0
if self.is_psu_fan:
node = self.psu_pmbus_path + self.psu_fan_rpm
else:
node = self.fan_path + self.fan_speed_rpm
try:
with open(node, 'r') as speed:
frpm = int(speed.read())
except IOError as e:
return 0
return frpm
def get_target_speed(self):
"""
Retrieves the target (expected) speed of the fan
Returns:
An integer, the percentage of full fan speed, in the range 0 (off)
to 100 (full speed)
"""
duty = 0
if self.is_psu_fan:
# Target speed not supported for PSU fans
duty = 0
else:
node = self.fan_path + self.fan_speed_pwm
try:
with open(node, 'r') as fan_duty:
duty = int(fan_duty.read())
duty = int(duty * 100 / 255)
except IOError:
duty = 0
return duty
def set_speed(self, speed):
"""
Sets the fan speed
Args:
speed: An integer, the percentage of full fan speed to set fan to,
in the range 0 (off) to 100 (full speed)
Returns:
A boolean, True if speed is set successfully, False if not
"""
if self.is_psu_fan:
print("Setting PSU fan speed is not allowed")
return False
else:
if speed < 0 or speed > 100:
return False
node = self.fan_path + self.fan_speed_pwm
speed = int(round(speed * 255.0 / 100))
try:
with open(node, 'w') as fan_duty:
fan_duty.write(str(speed))
except IOError:
return False
return True
def get_speed_tolerance(self):
"""
Retrieves the speed tolerance of the fan
Returns:
An integer, the percentage of variance from target speed which is
considered tolerable
"""
return self.FAN_SPEED_TOLERANCE_PERCENTAGE
def set_status_led(self, color):
"""
Sets the state of the fan module status LED
Args:
color: A string representing the color with which to set the
fan module status LED
Returns:
bool: True if status LED state is set successfully, False if not
"""
if self.is_psu_fan:
# Usually there is no led for psu_fan
return True
else:
from .led import FanLed
fanled = FanLed.get_fanLed()
return fanled.update_status()
def get_status_led(self):
"""
Gets the state of the fan status LED
Returns:
A string, one of the predefined STATUS_LED_COLOR_* strings above
"""
if self.is_psu_fan:
# Usually no led for psu_fan hence implement a generic scheme
if self.get_status():
return self.STATUS_LED_COLOR_GREEN
else:
return self.STATUS_LED_COLOR_OFF
else:
from .led import FanLed
fanled = FanLed.get_fanLed()
return fanled.get_status()

View File

@ -0,0 +1,71 @@
#############################################################################
# Alphanetworks
#
# Module contains an implementation of SONiC Platform Base API and
# provides the Fan Drawer status which are available in the platform
#
#############################################################################
try:
from sonic_platform_base.fan_drawer_base import FanDrawerBase
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class FanDrawer(FanDrawerBase):
def __init__(self, index):
FanDrawerBase.__init__(self)
self.index = index + 1
def get_name(self):
"""
Retrieves the name of the device
Returns:
string: The name of the device
"""
return "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
"""
# fan_drawer led not support
return True
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
"""
# fan_drawer led not support
return True

View File

@ -0,0 +1,124 @@
class Led(object):
STATUS_LED_COLOR_GREEN = "green"
STATUS_LED_COLOR_AMBER_BLINK = "amber_blink"
STATUS_LED_COLOR_OFF = "off"
value_map = {
"on": 1,
"off": 0,
"blink": 4
}
color_map = {
0: STATUS_LED_COLOR_OFF,
1: STATUS_LED_COLOR_GREEN,
4: STATUS_LED_COLOR_AMBER_BLINK
}
@staticmethod
def get_path():
path = "/sys/bus/i2c/devices/1-005e/"
return path
def set_value(self, value):
try:
with open(self.led_path, 'w') as led:
led.write(str(value))
except IOError:
return False
return True
def get_status(self):
status = 0
try:
with open(self.led_path, 'r') as led:
status = int(led.read())
except IOError:
return False
return self.color_map[status]
class SystemLed(Led):
_systemLed = None
@staticmethod
def get_systemLed():
if SystemLed._systemLed is None:
SystemLed()
return SystemLed._systemLed
def __init__(self):
if SystemLed._systemLed is not None:
raise Exception('only one SystemLed can exist')
else:
self.led_path = self.get_path() + "sys_status"
SystemLed._systemLed = self
def set_status(self, color):
if color == Led.STATUS_LED_COLOR_GREEN:
return self.set_value(Led.value_map["on"])
if color == Led.STATUS_LED_COLOR_AMBER_BLINK:
return self.set_value(Led.value_map["blink"])
if color == Led.STATUS_LED_COLOR_OFF:
return self.set_value(Led.value_map["off"])
return False
class PsuLed(Led):
_psuLed = None
@staticmethod
def get_psuLed():
if PsuLed._psuLed is None:
PsuLed()
return PsuLed._psuLed
def __init__(self):
if PsuLed._psuLed is not None:
raise Exception('only one psuLed can exist')
else:
self.led_path = self.get_path() + "sys_pwr"
PsuLed._psuLed = self
def set_psus(self, psu_list):
self._psu_list = psu_list
def update_status(self):
is_power_all_OK = True
for psu in self._psu_list:
if not psu.get_presence() or not psu.get_status():
is_power_all_OK = False
status = self.value_map["on"] if is_power_all_OK else self.value_map["blink"]
# update led status
return self.set_value(status)
class FanLed(Led):
_fanLed = None
@staticmethod
def get_fanLed():
if FanLed._fanLed is None:
FanLed()
return FanLed._fanLed
def __init__(self):
if FanLed._fanLed is not None:
raise Exception('only one fanLed can exist')
else:
self.led_path = self.get_path() + "fan1_led"
FanLed._fanLed = self
def set_fans(self, fan_lsit):
self._fan_list = fan_lsit
def update_status(self):
is_fan_all_OK = True
for fan in self._fan_list:
if not fan.get_status():
is_fan_all_OK = False
status = self.value_map["on"] if is_fan_all_OK else self.value_map["blink"]
# update led status
return self.set_value(status)

View File

@ -0,0 +1,19 @@
#############################################################################
# Alphanetworks
#
# Module contains an implementation of SONiC Platform Base API and
# provides the platform information
#
#############################################################################
try:
from sonic_platform_base.platform_base import PlatformBase
from sonic_platform.chassis import Chassis
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class Platform(PlatformBase):
def __init__(self):
PlatformBase.__init__(self)
# initialize chassis
self._chassis = Chassis()

View File

@ -0,0 +1,328 @@
#############################################################################
# Alphanetworks
#
# Module contains an implementation of SONiC Platform Base API and
# provides the PSU status which are available in the platform
#
#############################################################################
try:
from sonic_platform_base.psu_base import PsuBase
from sonic_platform.fan import Fan
from sonic_eeprom import eeprom_base
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class Psu(PsuBase):
"""Platform-specific PSU class"""
def __init__(self, psu_index):
PsuBase.__init__(self)
# initialize PSU Fan
fan = Fan(psu_index, True)
self._fan_list.append(fan)
self.index = psu_index + 1
self.pus_type = "AC"
# driver attribute
self.psu_presence = "/psu{}_present".format(psu_index+1)
self.psu_oper_status = "/psu{}_power_good".format(psu_index+1)
self.psu_model_name = "/psu_model_name"
self.psu_mfr_id = "/psu_mfr_id"
self.psu_v_in = "/psu_v_in"
self.psu_v_out = "/psu_v_out"
self.psu_i_in = "/psu_i_in"
self.psu_i_out = "/psu_i_out"
self.psu_p_in = "/psu_p_in"
self.psu_p_out = "/psu_p_out"
self.psu_temp1_input = "/psu_temp1_input"
self.psu_mfr_pout_max = "/psu_mfr_pout_max"
self.psu_serial_num = "/eeprom"
# psu eeprom info
self._PSU_EEPROM_SERIAL_NUM_OFFSET = 0x35
self._PSU_EEPROM_SERIAL_NUM_LENGTH = 19
# driver path
psu_bus_num = [10, 11]
psu_eeprom_address = [50, 51]
psu_pmbus_address = [58, 59]
psu_path = "/sys/bus/i2c/devices/"
self.psu_mapping = psu_path + "1-005e"
self.psu_eeprom = psu_path + "{}-00{}".format(psu_bus_num[psu_index], psu_eeprom_address[psu_index])
self.psu_pmbus = psu_path +"{}-00{}".format(psu_bus_num[psu_index], psu_pmbus_address[psu_index])
def get_name(self):
"""
Retrieves the name of the device
Returns:
string: The name of the device
"""
return "PSU{}".format(self.index)
def get_presence(self):
"""
Retrieves the presence of the device
Returns:
bool: True if device is present, False if not
"""
status = 0
node = self.psu_mapping + self.psu_presence
try:
with open(node, 'r') as presence_status:
status = int(presence_status.read())
except IOError:
return False
return status == 1
def get_status(self):
"""
Retrieves the operational status of the device
Returns:
A boolean value, True if device is operating properly, False if not
"""
status = 0
node = self.psu_mapping + self.psu_oper_status
try:
with open(node, 'r') as power_status:
status = int(power_status.read())
except IOError:
return False
return status == 1
def get_model(self):
"""
Retrieves the model number (or part number) of the device
Returns:
string: Model/part number of device
"""
model = ""
node = self.psu_pmbus + self.psu_model_name
try:
with open(node, 'r') as model_name:
model = model_name.read()
except IOError:
return None
return model.rstrip()
def get_mfr_id(self):
"""
Retrieves the manufacturer's name (or id) of the device
Returns:
string: Manufacturer's id of device
"""
mfr = ""
node = self.psu_pmbus + self.psu_mfr_id
try:
with open(node, 'r') as mfr_id:
mfr = mfr_id.read()
except IOError:
return None
return mfr.rstrip()
def get_serial(self):
"""
Retrieves the serial number of the device
Returns:
string: Serial number of device
"""
serial = ""
node = self.psu_eeprom + self.psu_serial_num
try:
psu_eeprom = eeprom_base.EepromDecoder(node, None, 0, '', True)
serial = psu_eeprom.read_eeprom_bytes(self._PSU_EEPROM_SERIAL_NUM_LENGTH, self._PSU_EEPROM_SERIAL_NUM_OFFSET)
if len(serial) != self._PSU_EEPROM_SERIAL_NUM_LENGTH:
return None
except IOError:
return None
return serial.decode("utf-8")
def get_voltage(self):
"""
Retrieves current PSU voltage output
Returns:
A float number, the output voltage in volts,
e.g. 12.1
"""
vout = 0.0
node = self.psu_pmbus + self.psu_v_out
try:
with open(node, 'r') as v_out:
vout = int(v_out.read())
except IOError:
return vout
return float(vout) / 1000
def get_current(self):
"""
Retrieves present electric current supplied by PSU
Returns:
A float number, the electric current in amperes, e.g 15.4
"""
iout = 0.0
node = self.psu_pmbus + self.psu_i_out
try:
with open(node, 'r') as i_out:
iout = int(i_out.read())
except IOError:
return iout
return float(iout) / 1000
def get_power(self):
"""
Retrieves current energy supplied by PSU
Returns:
A float number, the power in watts, e.g. 302.6
"""
pout = 0.0
node = self.psu_pmbus + self.psu_p_out
try:
with open(node, 'r') as p_out:
pout = int(p_out.read())
except IOError:
return pout
return float(pout) / 1000
def get_powergood_status(self):
"""
Retrieves the powergood status of PSU
Returns:
A boolean, True if PSU has stablized its output voltages and passed all
its internal self-tests, False if not.
"""
status = 0
node = self.psu_mapping + self.psu_oper_status
try:
with open(node, 'r') as powergood_status:
status = int(powergood_status.read())
except IOError:
return False
return status == 1
def set_status_led(self, color):
"""
Sets the state of the PSU status LED
Args:
color: A string representing the color with which to set the
PSU status LED
Returns:
bool: True if status LED state is set successfully, False if not
"""
from .led import PsuLed
psuled = PsuLed.get_psuLed()
return psuled.update_status()
def get_status_led(self):
"""
Gets the state of the PSU status LED
Returns:
A string, one of the predefined STATUS_LED_COLOR_* strings above
"""
from .led import PsuLed
psuled = PsuLed.get_psuLed()
return psuled.get_status()
def get_input_voltage(self):
"""
Retrieves current input voltage to the PSU
Returns:
A float number, the input voltage in volts,
e.g. 20.3
"""
vin = 0.0
node = self.psu_pmbus + self.psu_v_in
try:
with open(node, 'r') as v_in:
vin = int(v_in.read())
except IOError:
return vin
return float(vin) / 1000
def get_input_current(self):
"""
Retrieves present electric current supplied to the PSU
Returns:
A float number, the electric current in amperes, e.g 13.7
"""
iin = 0.0
node = self.psu_pmbus + self.psu_i_in
try:
with open(node, 'r') as i_in:
iin = int(i_in.read())
except IOError:
return iin
return float(iin) / 1000
def get_input_power(self):
"""
Retrieves current energy supplied to the PSU
Returns:
A float number, the power in watts, e.g. 302.6
"""
pin = 0.0
node = self.psu_pmbus + self.psu_p_in
try:
with open(node, 'r') as p_in:
pin = int(p_in.read())
except IOError:
return pin
return float(pin) / 1000
def get_temperature(self):
"""
Retrieves current temperature reading from PSU
Returns:
A float number of current temperature in Celsius up to nearest thousandth
of one degree Celsius, e.g. 30.125
"""
temp1in = 0.0
node = self.psu_pmbus + self.psu_temp1_input
try:
with open(node, 'r') as temp1_in:
temp1in = int(temp1_in.read())
except IOError:
return temp1in
return float(temp1in) / 1000
def get_type(self):
"""
Gets the type of the PSU
Returns:
A string, the type of PSU (AC/DC)
"""
return self.pus_type
def get_capacity(self):
"""
Gets the capacity (maximum output power) of the PSU in watts
Returns:
An integer, the capacity of PSU
"""
poutmax = 0
node = self.psu_pmbus + self.psu_mfr_pout_max
try:
with open(node, 'r') as pout_max:
poutmax = int(pout_max.read())
except IOError:
return poutmax
return int(float(poutmax) / 1000)

View File

@ -0,0 +1,136 @@
#############################################################################
# Alphanetworks
#
# Module contains an implementation of SONiC Platform Base API and
# provides the thermal status which are available in the platform
#
#############################################################################
import glob
import os.path
try:
from sonic_platform_base.thermal_base import ThermalBase
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class Thermal(ThermalBase):
"""Platform-specific Thermal class"""
def __init__(self, thermal_index):
ThermalBase.__init__(self)
self.index = thermal_index
# driver path
tmp_bus_num = [1, 4, 5]
tmp_address = ["4f", "4d", "4c"]
self.tmp_node = "/sys/bus/i2c/devices/{}-00{}/hwmon/".format(tmp_bus_num[self.index], tmp_address[self.index])
def get_name(self):
"""
Retrieves the name of the device
Returns:
string: The name of the device
"""
return "TMP75#{}".format(self.index + 1)
def get_status(self):
"""
Retrieves the operational status of the device
Returns:
A boolean value, True if device is operating properly, False if not
"""
if (self.get_temperature() != None):
return True
else:
return False
def get_presence(self):
"""
Retrieves the presence of the device
Returns:
bool: True if device is present, False if not
"""
node = glob.glob(self.tmp_node + "hwmon*")
if len(node) == 0:
return False
node = node[0] + "/temp1_input"
if os.path.exists(node):
return True
return False
def get_temperature(self):
"""
Retrieves current temperature reading from thermal
Returns:
A float number of current temperature in Celsius up to nearest thousandth
of one degree Celsius, e.g. 30.125
"""
temp = 0
node = glob.glob(self.tmp_node + "hwmon*")
if len(node) == 0:
return None
node = node[0] + "/temp1_input"
try:
with open(node, 'r') as fp:
temp = float(fp.read()) / 1000
except IOError:
return None
return temp
def get_high_threshold(self):
"""
Retrieves the high threshold temperature of thermal
Returns:
A float number, the high threshold temperature of thermal in Celsius
up to nearest thousandth of one degree Celsius, e.g. 30.125
"""
temp = 0
node = glob.glob(self.tmp_node + "hwmon*")
if len(node) == 0:
return None
node = node[0] + "/temp1_max"
try:
with open(node, 'r') as fp:
temp = float(fp.read()) / 1000
except IOError:
return None
return temp
def set_high_threshold(self, temperature):
"""
Sets the high threshold temperature of thermal
Args :
temperature: A float number up to nearest thousandth of one degree Celsius,
e.g. 30.125
Returns:
A boolean, True if threshold is set successfully, False if not
"""
temp = temperature * 1000
node = glob.glob(self.tmp_node + "hwmon*")
if len(node) == 0:
return None
node = node[0] + "/temp1_max"
try:
with open(node, 'w') as fp:
fp.write(str(temp))
except IOError:
return False
return True
def get_high_critical_threshold(self):
"""
Retrieves the high critical threshold temperature of thermal
Returns:
A float number, the high critical threshold temperature of thermal in Celsius
up to nearest thousandth of one degree Celsius, e.g. 30.125
"""
return None

View File

@ -0,0 +1,95 @@
from sonic_platform_base.sonic_thermal_control.thermal_action_base import ThermalPolicyActionBase
from sonic_platform_base.sonic_thermal_control.thermal_json_object import thermal_json_object
from sonic_py_common.logger import Logger
logger = Logger()
class SetFanSpeedAction():
"""
Base thermal action class to set speed for fans
"""
DEFAULT_SPEED = 50
MAX_SPEED = 100
@classmethod
def set_all_fan_speed(cls, thermal_info_dict, speed):
from .thermal_infos import FanInfo
if FanInfo.INFO_NAME in thermal_info_dict and isinstance(thermal_info_dict[FanInfo.INFO_NAME], FanInfo):
fan_info_obj = thermal_info_dict[FanInfo.INFO_NAME]
for fan in fan_info_obj.get_presence_fans():
fan.set_speed(speed)
@classmethod
def set_all_fan_speed_default(cls, thermal_info_dict):
cls.set_all_fan_speed(thermal_info_dict, cls.DEFAULT_SPEED)
@classmethod
def set_all_fan_speed_max(cls, thermal_info_dict):
cls.set_all_fan_speed(thermal_info_dict, cls.MAX_SPEED)
@thermal_json_object('fan.all.set_speed_max')
class SetAllFanSpeedMaxAction(ThermalPolicyActionBase):
"""
Action to set max speed for all fans
"""
def execute(self, thermal_info_dict):
"""
Set max speed for all fans
:param thermal_info_dict: A dictionary stores all thermal information.
:return:
"""
SetFanSpeedAction.set_all_fan_speed_max(thermal_info_dict)
@thermal_json_object('fan.all.set_speed_default')
class SetAllFanSpeedDefaultAction(ThermalPolicyActionBase):
"""
Action to set default speed for all fans
"""
def execute(self, thermal_info_dict):
"""
Set default speed for all fans
:param thermal_info_dict: A dictionary stores all thermal information.
:return:
"""
SetFanSpeedAction.set_all_fan_speed_default(thermal_info_dict)
@thermal_json_object('thermal.temp_check_and_set_all_fan_speed')
class ThermalRecoverAction(ThermalPolicyActionBase):
"""
Action to check thermal sensor temperature change status and set speed for all fans
"""
def execute(self, thermal_info_dict):
"""
Check thermal sensor temperature change status and set speed for all fans
:param thermal_info_dict: A dictionary stores all thermal information.
:return:
"""
from .thermal_infos import ThermalInfo
if ThermalInfo.INFO_NAME in thermal_info_dict and isinstance(thermal_info_dict[ThermalInfo.INFO_NAME], ThermalInfo):
thermal_info_obj = thermal_info_dict[ThermalInfo.INFO_NAME]
if thermal_info_obj.is_below_low_threshold():
SetFanSpeedAction.set_all_fan_speed_default(thermal_info_dict)
elif thermal_info_obj.is_over_high_threshold():
SetFanSpeedAction.set_all_fan_speed_max(thermal_info_dict)
elif thermal_info_obj.is_warm_up():
SetFanSpeedAction.set_all_fan_speed_default(thermal_info_dict)
elif thermal_info_obj.is_cool_down():
SetFanSpeedAction.set_all_fan_speed_max(thermal_info_dict)
@thermal_json_object('switch.shutdown')
class SwitchShutdownAction(ThermalPolicyActionBase):
"""
Action to shutdown switch.
"""
def execute(self, thermal_info_dict):
"""
Take action when thermal sensor temperature over high critical threshold. Shut
down the switch.
"""
logger.log_warning("Alarm for temperature critical is detected, reboot DUT")
# import os
# os.system('reboot')

View File

@ -0,0 +1,54 @@
from sonic_platform_base.sonic_thermal_control.thermal_condition_base import ThermalPolicyConditionBase
from sonic_platform_base.sonic_thermal_control.thermal_json_object import thermal_json_object
class FanCondition(ThermalPolicyConditionBase):
def get_fan_info(self, thermal_info_dict):
from .thermal_infos import FanInfo
if FanInfo.INFO_NAME in thermal_info_dict and isinstance(thermal_info_dict[FanInfo.INFO_NAME], FanInfo):
return thermal_info_dict[FanInfo.INFO_NAME]
else:
return None
@thermal_json_object('fan.any.absence')
class AnyFanAbsenceCondition(FanCondition):
def is_match(self, thermal_info_dict):
fan_info_obj = self.get_fan_info(thermal_info_dict)
return len(fan_info_obj.get_absence_fans()) > 0 if fan_info_obj else False
@thermal_json_object('fan.all.presence')
class AllFanPresenceCondition(FanCondition):
def is_match(self, thermal_info_dict):
fan_info_obj = self.get_fan_info(thermal_info_dict)
return len(fan_info_obj.get_absence_fans()) == 0 if fan_info_obj else False
@thermal_json_object('fan.any.fault')
class AnyFanFaultCondition(FanCondition):
def is_match(self, thermal_info_dict):
fan_info_obj = self.get_fan_info(thermal_info_dict)
return len(fan_info_obj.get_fault_fans()) > 0 if fan_info_obj else False
@thermal_json_object('fan.all.good')
class AllFanGoodCondition(FanCondition):
def is_match(self, thermal_info_dict):
fan_info_obj = self.get_fan_info(thermal_info_dict)
return len(fan_info_obj.get_fault_fans()) == 0 if fan_info_obj else False
class ThermalCondition(ThermalPolicyConditionBase):
def get_thermal_info(self, thermal_info_dict):
from .thermal_infos import ThermalInfo
if ThermalInfo.INFO_NAME in thermal_info_dict and isinstance(thermal_info_dict[ThermalInfo.INFO_NAME], ThermalInfo):
return thermal_info_dict[ThermalInfo.INFO_NAME]
else:
return None
@thermal_json_object('thermal.over.high_critical_threshold')
class ThermalOverHighCriticalCondition(ThermalCondition):
def is_match(self, thermal_info_dict):
thermal_info_obj = self.get_thermal_info(thermal_info_dict)
return thermal_info_obj.is_over_high_critical_threshold() if thermal_info_obj else False

View File

@ -0,0 +1,200 @@
from sonic_platform_base.sonic_thermal_control.thermal_info_base import ThermalPolicyInfoBase
from sonic_platform_base.sonic_thermal_control.thermal_json_object import thermal_json_object
@thermal_json_object('fan_info')
class FanInfo(ThermalPolicyInfoBase):
"""
Fan information needed by thermal policy
"""
# Fan information name
INFO_NAME = 'fan_info'
def __init__(self):
self._absence_fans = set()
self._presence_fans = set()
self._fault_fans = set()
self._presence_changed = False
self._status_changed = False
def collect(self, chassis):
"""
Collect absence and presence fans.
:param chassis: The chassis object
:return:
"""
self._presence_changed = False
self._status_changed = False
for fan in chassis.get_all_fans():
presence = fan.get_presence()
status = fan.get_status()
if presence and fan not in self._presence_fans:
self._presence_fans.add(fan)
self._presence_changed = True
if fan in self._absence_fans:
self._absence_fans.remove(fan)
elif not presence and fan not in self._absence_fans:
self._absence_fans.add(fan)
self._presence_changed = True
if fan in self._presence_fans:
self._presence_fans.remove(fan)
if not status and fan not in self._fault_fans:
self._fault_fans.add(fan)
self._status_changed = True
elif status and fan in self._fault_fans:
self._fault_fans.remove(fan)
self._status_changed = True
def get_absence_fans(self):
"""
Retrieves absence fans
:return: A set of absence fans
"""
return self._absence_fans
def get_presence_fans(self):
"""
Retrieves presence fans
:return: A set of presence fans
"""
return self._presence_fans
def get_fault_fans(self):
"""
Retrieves fault fans
:return: A set of fault fans
"""
return self._fault_fans
def is_presence_changed(self):
"""
Retrieves if the presence status of fan information changed
:return: True if status changed else False
"""
return self._presence_changed
@thermal_json_object('thermal_info')
class ThermalInfo(ThermalPolicyInfoBase):
"""
Thermal information needed by thermal policy
"""
INFO_NAME = 'thermal_info'
def __init__(self):
self.init = False
self._old_avg_temp = 0
self._current_avg_temp = 0
self._high_crital_threshold = 75
self._high_threshold = 60
self._low_threshold = 50
self._thermal_0x4d_index = 1
self._temp_scale = 0.5
def collect(self, chassis):
"""
Collect thermal sensor temperature change status
:param chassis: The chassis object
:return:
"""
self._temps = []
self._over_high_critical_threshold = False
self._over_high_threshold = False
self._below_low_threshold = False
self._warm_up = False
self._cool_down = False
temp = 0
num_of_thermals = chassis.get_num_thermals()
for index in range(num_of_thermals):
self._temps.insert(index, chassis.get_thermal(index).get_temperature())
temp += self._temps[index]
self._current_avg_temp = temp / num_of_thermals
if self.init == False:
self._old_avg_temp = self._current_avg_temp
self.init = True
if self._current_avg_temp >= self._high_threshold:
self._over_high_threshold = True
if self._current_avg_temp <= self._low_threshold:
self._below_low_threshold = True
temp_tolerance = self._temp_scale/num_of_thermals
temp_diff = abs(self._current_avg_temp - self._old_avg_temp)
if self._current_avg_temp > self._old_avg_temp and temp_diff > temp_tolerance:
self._warm_up = True
if self._current_avg_temp < self._old_avg_temp and temp_diff > temp_tolerance:
self._cool_down = True
if self._temps[self._thermal_0x4d_index] >= self._high_crital_threshold:
self._over_high_critical_threshold = True
self._old_avg_temp = self._current_avg_temp
def is_warm_up(self):
"""
Retrieves if the temperature is warm up
:return: True if the temperature is warm up else False
"""
return self._warm_up
def is_over_high_threshold(self):
"""
Retrieves if the temperature is over high threshold
:return: True if the temperature is over high threshold else False
"""
return self._over_high_threshold
def is_cool_down(self):
"""
Retrieves if the temperature is cood down
:return: True if the temperature is cood down else False
"""
return self._cool_down
def is_below_low_threshold(self):
"""
Retrieves if the temperature is below low threshold
:return: True if the temperature is below low threshold else False
"""
return self._below_low_threshold
def is_over_high_critical_threshold(self):
"""
Retrieves if the temperature is over high critical threshold
:return: True if the temperature is over high critical threshold else False
"""
return self._over_high_critical_threshold
@thermal_json_object('chassis_info')
class ChassisInfo(ThermalPolicyInfoBase):
"""
Chassis information needed by thermal policy
"""
INFO_NAME = 'chassis_info'
def __init__(self):
self._chassis = None
def collect(self, chassis):
"""
Collect platform chassis.
:param chassis: The chassis object
:return:
"""
self._chassis = chassis
def get_chassis(self):
"""
Retrieves platform chassis object
:return: A platform chassis object.
"""
return self._chassis

View File

@ -0,0 +1,23 @@
from sonic_platform_base.sonic_thermal_control.thermal_manager_base import ThermalManagerBase
from .thermal_infos import *
from .thermal_conditions import *
from .thermal_actions import *
class ThermalManager(ThermalManagerBase):
@classmethod
def initialize(cls):
"""
Initialize thermal manager, including register thermal condition types and thermal action types
and any other vendor specific initialization.
:return:
"""
return True
@classmethod
def deinitialize(cls):
"""
Destroy thermal manager, including any vendor specific cleanup. The default behavior of this function
is a no-op.
:return:
"""
return True

View File

@ -0,0 +1,237 @@
#############################################################################
#
# Watchdog contains an implementation of SONiC Platform Base Watchdog API
#
#############################################################################
import fcntl
import os
import array
try:
from sonic_platform_base.watchdog_base import WatchdogBase
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
""" ioctl constants """
IO_WRITE = 0x40000000
IO_READ = 0x80000000
IO_READ_WRITE = 0xC0000000
IO_SIZE_INT = 0x00040000
IO_SIZE_40 = 0x00280000
IO_TYPE_WATCHDOG = ord('W') << 8
WDR_INT = IO_READ | IO_SIZE_INT | IO_TYPE_WATCHDOG
WDR_40 = IO_READ | IO_SIZE_40 | IO_TYPE_WATCHDOG
WDWR_INT = IO_READ_WRITE | IO_SIZE_INT | IO_TYPE_WATCHDOG
""" Watchdog ioctl commands """
WDIOC_GETSUPPORT = 0 | WDR_40
WDIOC_GETSTATUS = 1 | WDR_INT
WDIOC_GETBOOTSTATUS = 2 | WDR_INT
WDIOC_GETTEMP = 3 | WDR_INT
WDIOC_SETOPTIONS = 4 | WDR_INT
WDIOC_KEEPALIVE = 5 | WDR_INT
WDIOC_SETTIMEOUT = 6 | WDWR_INT
WDIOC_GETTIMEOUT = 7 | WDR_INT
WDIOC_SETPRETIMEOUT = 8 | WDWR_INT
WDIOC_GETPRETIMEOUT = 9 | WDR_INT
WDIOC_GETTIMELEFT = 10 | WDR_INT
""" Watchdog status constants """
WDIOS_DISABLECARD = 0x0001
WDIOS_ENABLECARD = 0x0002
WDT_COMMON_ERROR = -1
WD_MAIN_IDENTITY = "iTCO_wdt"
WDT_SYSFS_PATH = "/sys/class/watchdog/"
DEFAULT_TIMEOUT=180
watchdog = 0
class Watchdog(WatchdogBase):
def __init__(self):
self.watchdog, self.wdt_main_dev_name = self._get_wdt()
if self.wdt_main_dev_name is None:
raise Exception("Watchdog device is not instantiated")
self.status_path = "/sys/class/watchdog/%s/status" % self.wdt_main_dev_name
self.state_path = "/sys/class/watchdog/%s/state" % self.wdt_main_dev_name
self.timeout_path = "/sys/class/watchdog/%s/timeout" % self.wdt_main_dev_name
# Set default value
self._disable()
self.armed = False
self.timeout = DEFAULT_TIMEOUT
def _is_wd_main(self, dev):
"""
Checks watchdog identity
"""
identity = self._read_file(
"{}/{}/identity".format(WDT_SYSFS_PATH, dev))
return identity == WD_MAIN_IDENTITY
def _get_wdt(self):
"""
Retrieves watchdog device
"""
global watchdog
wdt_main_dev_list = [dev for dev in os.listdir(
"/dev/") if dev.startswith("watchdog") and self._is_wd_main(dev)]
if not wdt_main_dev_list:
return (None, None)
wdt_main_dev_name = wdt_main_dev_list[0]
watchdog_device_path = "/dev/{}".format(wdt_main_dev_name)
if not watchdog:
watchdog = os.open(watchdog_device_path, os.O_RDWR)
return watchdog, wdt_main_dev_name
def _read_file(self, file_path):
"""
Read text file
"""
try:
with open(file_path, "r") as fd:
txt = fd.read()
except IOError:
return WDT_COMMON_ERROR
return txt.strip()
def _enable(self):
"""
Turn on the watchdog timer
"""
req = array.array('h', [WDIOS_ENABLECARD])
fcntl.ioctl(self.watchdog, WDIOC_SETOPTIONS, req, False)
def _disable(self):
"""
Turn off the watchdog timer
"""
req = array.array('h', [WDIOS_DISABLECARD])
fcntl.ioctl(self.watchdog, WDIOC_SETOPTIONS, req, False)
def _keepalive(self):
"""
Keep alive watchdog timer
"""
fcntl.ioctl(self.watchdog, WDIOC_KEEPALIVE)
def _settimeout(self, seconds):
"""
Set watchdog timer timeout
@param seconds - timeout in seconds
@return is the actual set timeout
"""
req = array.array('I', [seconds])
fcntl.ioctl(self.watchdog, WDIOC_SETTIMEOUT, req, True)
return int(req[0])
def _gettimeout(self, timeout_path):
"""
Get watchdog timeout
@return watchdog timeout
"""
req = array.array('I', [0])
fcntl.ioctl(self.watchdog, WDIOC_GETTIMEOUT, req, True)
return int(req[0])
def _gettimeleft(self):
"""
Get time left before watchdog timer expires
@return time left in seconds
"""
req = array.array('I', [0])
fcntl.ioctl(self.watchdog, WDIOC_GETTIMELEFT, req, True)
return int(req[0])
#################################################################
def arm(self, seconds):
"""
Arm the hardware watchdog with a timeout of <seconds> seconds.
If the watchdog is currently armed, calling this function will
simply reset the timer to the provided value. If the underlying
hardware does not support the value provided in <seconds>, this
method should arm the watchdog with the *next greater* available
value.
Returns:
An integer specifying the *actual* number of seconds the watchdog
was armed with. On failure returns -1.
"""
ret = WDT_COMMON_ERROR
if seconds < 0:
return ret
try:
if self.timeout != seconds:
self.timeout = self._settimeout(seconds)
if self.armed:
self._keepalive()
else:
self._settimeout(seconds)
self._enable()
self.armed = True
ret = self.timeout
except IOError as e:
pass
return ret
def disarm(self):
"""
Disarm the hardware watchdog
Returns:
A boolean, True if watchdog is disarmed successfully, False if not
"""
disarmed = False
if self.is_armed():
try:
self._disable()
self.armed = False
disarmed = True
except IOError:
pass
return disarmed
def is_armed(self):
"""
Retrieves the armed state of the hardware watchdog.
Returns:
A boolean, True if watchdog is armed, False if not
"""
return self.armed
def get_remaining_time(self):
"""
If the watchdog is armed, retrieve the number of seconds remaining on
the watchdog timer
Returns:
An integer specifying the number of seconds remaining on thei
watchdog timer. If the watchdog is not armed, returns -1.
"""
timeleft = WDT_COMMON_ERROR
if self.armed:
try:
timeleft = self._gettimeleft()
except IOError:
pass
return timeleft
def __del__(self):
"""
Close watchdog
"""
if self.watchdog is not None :
os.close(self.watchdog)

View File

@ -0,0 +1,358 @@
#!/usr/bin/env python3
#
# Copyright (C) 2019 Alphanetworks Technology Corporation.
# Robin Chen <Robin_chen@Alphanetworks.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# see <http://www.gnu.org/licenses/>
#
# Copyright (C) 2016 Accton Networks, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Usage: %(scriptName)s [options] command object
options:
-h | --help : this help message
-d | --debug : run with debug mode
-f | --force : ignore error during installation or clean
command:
install : install drivers and generate related sysfs nodes
clean : uninstall drivers and remove related sysfs nodes
"""
import subprocess
import sys, getopt
import logging
import time
PROJECT_NAME = 'snj60d0-320f'
DRIVER_NAME = 'snj60d0_320f'
version = '0.1.0'
verbose = False
DEBUG = False
args = []
FORCE = 0
if DEBUG == True:
print(sys.argv[0])
print('ARGV :', sys.argv[1:])
def main():
global DEBUG
global args
global FORCE
if len(sys.argv)<2:
show_help()
options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help',
'debug',
'force',
])
if DEBUG == True:
print(options)
print(args)
print(len(sys.argv))
for opt, arg in options:
if opt in ('-h', '--help'):
show_help()
elif opt in ('-d', '--debug'):
DEBUG = True
logging.basicConfig(level=logging.INFO)
elif opt in ('-f', '--force'):
FORCE = 1
else:
logging.info('no option')
for arg in args:
if arg == 'install':
do_install()
elif arg == 'clean':
do_uninstall()
else:
show_help()
return 0
def show_help():
print(__doc__ % {'scriptName' : sys.argv[0].split("/")[-1]})
sys.exit(0)
def show_log(txt):
if DEBUG == True:
print(PROJECT_NAME.upper()+": "+txt)
return
def log_os_system(cmd, show):
logging.info('Run :'+cmd)
status, output = subprocess.getstatusoutput(cmd)
show_log(cmd +" with result: " + str(status))
show_log(" output:"+output)
if status:
logging.info('Failed :'+cmd)
if show:
print('Failed :'+cmd)
return status, output
def driver_check():
ret, lsmod = log_os_system("lsmod | grep " + DRIVER_NAME, 0)
logging.info('mods:'+lsmod)
if len(lsmod) ==0:
return False
return True
kos = [
'modprobe i2c_ismt',
'modprobe i2c_i801',
'modprobe i2c_dev',
'modprobe i2c_mux_pca954x',
'modprobe optoe',
'modprobe yesm1300am',
'modprobe '+PROJECT_NAME+'_fpga' ,
'modprobe '+PROJECT_NAME+'_onie_eeprom' ,
'modprobe '+PROJECT_NAME+'_i2c_mux_cpld' ]
def driver_install():
global FORCE
#remove default drivers to avoid modprobe order conflicts
log_os_system("echo 'blacklist i2c-ismt' > /etc/modprobe.d/blacklist.conf", 1)
time.sleep(1)
log_os_system("modprobe -r i2c-ismt ", 1)
log_os_system("modprobe -r i2c-i801 ", 1)
#setup driver dependency
status, output = log_os_system("depmod", 1)
if status:
if FORCE == 0:
return status
for i in range(0,len(kos)):
if kos[i].find('pca954') != -1:
status, output = log_os_system(kos[i]+ " force_deselect_on_exit=1", 1)
else:
status, output = log_os_system(kos[i], 1)
if status:
if FORCE == 0:
return status
return 0
def driver_uninstall():
global FORCE
for i in range(0,len(kos)):
rm = kos[-(i+1)].replace("modprobe", "modprobe -rq")
rm = rm.replace("insmod", "rmmod")
status, output = log_os_system(rm, 1)
if status:
if FORCE == 0:
return status
return 0
i2c_prefix = '/sys/bus/i2c/devices/'
sfp_map = [ 22,23,24,25,26,27,28,29,
30,31,32,33,34,35,36,37,
38,39,40,41,42,43,44,45,
46,47,48,49,50,51,52,53]
mknod =[
'echo snj60d0_onie_eeprom 0x56 > /sys/bus/i2c/devices/i2c-1/new_device',
'echo lm75 0x4F > /sys/bus/i2c/devices/i2c-1/new_device',
'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-1/new_device',
'echo snj60d0_fpga 0x5e > /sys/bus/i2c/devices/i2c-1/new_device',
'echo lm75 0x4D > /sys/bus/i2c/devices/i2c-4/new_device',
'echo lm75 0x4C > /sys/bus/i2c/devices/i2c-5/new_device',
'echo pca9545 0x71 > /sys/bus/i2c/devices/i2c-6/new_device',
'echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-8/new_device',
'echo 24c02 0x50 > /sys/bus/i2c/devices/i2c-10/new_device',
'echo yesm1300am 0x58 > /sys/bus/i2c/devices/i2c-10/new_device',
'echo 24c02 0x51 > /sys/bus/i2c/devices/i2c-11/new_device',
'echo yesm1300am 0x59 > /sys/bus/i2c/devices/i2c-11/new_device',
'echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-12/new_device',
'echo optoe2 0x50 > /sys/bus/i2c/devices/i2c-13/new_device',
'echo snj60d0_320f_cpld1 0x5f > /sys/bus/i2c/devices/i2c-14/new_device',
'echo snj60d0_320f_cpld2 0x5f > /sys/bus/i2c/devices/i2c-15/new_device',
'echo snj60d0_320f_cpld3 0x5f > /sys/bus/i2c/devices/i2c-16/new_device',
'echo snj60d0_320f_cpld4 0x5f > /sys/bus/i2c/devices/i2c-17/new_device', ]
port_led_disable= 'echo {value} > /sys/bus/i2c/devices/1-005e/port_led_disable'
cpld_port_led_enable=[
'echo {value} > /sys/bus/i2c/devices/14-005f/cpld_port_led_enable_1',
'echo {value} > /sys/bus/i2c/devices/15-005f/cpld_port_led_enable_2',
'echo {value} > /sys/bus/i2c/devices/16-005f/cpld_port_led_enable_3',
'echo {value} > /sys/bus/i2c/devices/17-005f/cpld_port_led_enable_4', ]
def device_install():
global FORCE
for i in range(0,len(mknod)):
#for pca954x need times to built new i2c buses
if mknod[i].find('pca954') != -1:
time.sleep(1)
if mknod[i].find('lm75') != -1:
time.sleep(1)
status, output = log_os_system(mknod[i], 1)
if status:
print(output)
if FORCE == 0:
return status
for port in range(len(sfp_map)):
cmd = 'echo optoe3 0x50 > /sys/bus/i2c/devices/i2c-{}/new_device'.format(sfp_map[port])
status, output =log_os_system(cmd, 1)
if status:
print(output)
if FORCE == 0:
return status
cmd = "echo 0 > /sys/bus/i2c/devices/1-005e/sys_reset1"
status, output =log_os_system(cmd, 1)
if status:
print(output)
if FORCE == 0:
return status
cmd = "echo 4 > /sys/bus/i2c/devices/1-005e/sys_reset2"
status, output =log_os_system(cmd, 1)
if status:
print(output)
if FORCE == 0:
return status
# Front port LED enable
cmd = port_led_disable.format(value=0)
status, output =log_os_system(cmd, 1)
if status:
print(output)
if FORCE == 0:
return status
for i in range(len(cpld_port_led_enable)):
cmd = cpld_port_led_enable[i].format(value=1)
status, output =log_os_system(cmd, 1)
if status:
print(output)
if FORCE == 0:
return status
return
def device_uninstall():
global FORCE
# Front port LED disable
cmd = port_led_disable.format(value=1)
status, output =log_os_system(cmd, 1)
if status:
print(output)
if FORCE == 0:
return status
for i in range(len(cpld_port_led_enable)):
cmd = cpld_port_led_enable[i].format(value=0)
status, output =log_os_system(cmd, 1)
if status:
print(output)
if FORCE == 0:
return status
for port in range(len(sfp_map)):
cmd = 'echo 0x50 > /sys/bus/i2c/devices/i2c-{}/delete_device'.format(sfp_map[port])
status, output =log_os_system(cmd, 1)
if status:
print(output)
if FORCE == 0:
return status
nodelist = mknod
for i in range(len(nodelist)):
target = nodelist[-(i+1)]
temp = target.split()
del temp[1]
temp[-1] = temp[-1].replace('new_device', 'delete_device')
status, output = log_os_system(" ".join(temp), 1)
if status:
print(output)
if FORCE == 0:
return status
return
def system_ready():
if driver_check() == False:
return False
if not device_exist():
return False
return True
def do_install():
print("Checking system....")
if driver_check() == False:
print("No driver, installing....")
status = driver_install()
if status:
if FORCE == 0:
return status
else:
print(PROJECT_NAME.upper() + " drivers detected....")
if not device_exist():
print("No device, installing....")
status = device_install()
if status:
if FORCE == 0:
return status
else:
print(PROJECT_NAME.upper() + " devices detected....")
return
def do_uninstall():
print("Checking system....")
if not device_exist():
print(PROJECT_NAME.upper() + " has no device installed....")
else:
print("Removing device....")
status = device_uninstall()
if status:
if FORCE == 0:
return status
if driver_check()== False :
print(PROJECT_NAME.upper() + " has no driver installed....")
else:
print("Removing installed driver....")
status = driver_uninstall()
if status:
if FORCE == 0:
return status
return
def device_exist():
ret1, log = log_os_system("ls " + i2c_prefix + "*0070", 0)
ret2, log = log_os_system("ls " + i2c_prefix + "i2c-2", 0)
return not(ret1 or ret2)
if __name__ == "__main__":
main()