[Netberg][Barefoot] Added support for Aurora 750 (#16342)
Why I did it Support Intel Tofino based platforms Netberg Aurora 750 ASIC: Intel Tofino BFN-T10-064Q Pors: 64x 100G How I did it Added specification to device/netberg directory Added platform/barefoot/sonic-platform-modules-netberg contains kernel modules, scripts and sonic_platform packages. Modified the platform/barefoot/platform-modules-netberg.mk to include Aurora 750 related ID. Signed-off-by: Andrew Sapronov <andrew.sapronov@gmail.com>
This commit is contained in:
parent
3bdfdd95ea
commit
0405b369af
@ -0,0 +1,2 @@
|
||||
{%- set default_topo = 't0' %}
|
||||
{%- include 'buffers_config.j2' %}
|
@ -0,0 +1,83 @@
|
||||
{% set default_cable = '5m' %}
|
||||
{% set ingress_lossless_pool_size = '4194304' %}
|
||||
{% set ingress_lossy_pool_size = '7340032' %}
|
||||
{% set egress_lossless_pool_size = '16777152' %}
|
||||
{% set egress_lossy_pool_size = '7340032' %}
|
||||
|
||||
{%- macro generate_port_lists(PORT_ALL) %}
|
||||
{# Generate list of ports #}
|
||||
{%- for port_idx in range(0,64) %}
|
||||
{%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endmacro %}
|
||||
|
||||
{%- macro generate_buffer_pool_and_profiles() %}
|
||||
"BUFFER_POOL": {
|
||||
"ingress_lossless_pool": {
|
||||
"size": "{{ ingress_lossless_pool_size }}",
|
||||
"type": "ingress",
|
||||
"mode": "dynamic"
|
||||
},
|
||||
"ingress_lossy_pool": {
|
||||
"size": "{{ ingress_lossy_pool_size }}",
|
||||
"type": "ingress",
|
||||
"mode": "dynamic"
|
||||
},
|
||||
"egress_lossless_pool": {
|
||||
"size": "{{ egress_lossless_pool_size }}",
|
||||
"type": "egress",
|
||||
"mode": "dynamic"
|
||||
},
|
||||
"egress_lossy_pool": {
|
||||
"size": "{{ egress_lossy_pool_size }}",
|
||||
"type": "egress",
|
||||
"mode": "dynamic"
|
||||
}
|
||||
},
|
||||
"BUFFER_PROFILE": {
|
||||
"ingress_lossless_profile": {
|
||||
"pool":"ingress_lossless_pool",
|
||||
"size":"4096",
|
||||
"dynamic_th":"0"
|
||||
},
|
||||
"ingress_lossy_profile": {
|
||||
"pool":"ingress_lossy_pool",
|
||||
"size":"4096",
|
||||
"dynamic_th":"3"
|
||||
},
|
||||
"egress_lossless_profile": {
|
||||
"pool":"egress_lossless_pool",
|
||||
"size":"4096",
|
||||
"dynamic_th":"7"
|
||||
},
|
||||
"egress_lossy_profile": {
|
||||
"pool":"egress_lossy_pool",
|
||||
"size":"4096",
|
||||
"dynamic_th":"3"
|
||||
},
|
||||
"q_lossy_profile": {
|
||||
"pool":"egress_lossy_pool",
|
||||
"size":"4096",
|
||||
"dynamic_th":"3"
|
||||
}
|
||||
},
|
||||
{%- endmacro %}
|
||||
|
||||
{%- macro generate_pg_profils(port_names) %}
|
||||
"BUFFER_PG": {
|
||||
"{{ port_names }}|3-4": {
|
||||
"profile" : "ingress_lossless_profile"
|
||||
}
|
||||
},
|
||||
{%- endmacro %}
|
||||
|
||||
{%- macro generate_queue_buffers(port_names) %}
|
||||
"BUFFER_QUEUE": {
|
||||
"{{ port_names }}|3-4": {
|
||||
"profile" : "egress_lossless_profile"
|
||||
},
|
||||
"{{ port_names }}|0-1": {
|
||||
"profile" : "q_lossy_profile"
|
||||
}
|
||||
}
|
||||
{%- endmacro %}
|
@ -0,0 +1,83 @@
|
||||
{% set default_cable = '5m' %}
|
||||
{% set ingress_lossless_pool_size = '2097152' %}
|
||||
{% set ingress_lossy_pool_size = '5242880' %}
|
||||
{% set egress_lossless_pool_size = '16777152' %}
|
||||
{% set egress_lossy_pool_size = '5242880' %}
|
||||
|
||||
{%- macro generate_port_lists(PORT_ALL) %}
|
||||
{# Generate list of ports #}
|
||||
{%- for port_idx in range(0,64) %}
|
||||
{%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endmacro %}
|
||||
|
||||
{%- macro generate_buffer_pool_and_profiles() %}
|
||||
"BUFFER_POOL": {
|
||||
"ingress_lossless_pool": {
|
||||
"size": "{{ ingress_lossless_pool_size }}",
|
||||
"type": "ingress",
|
||||
"mode": "dynamic"
|
||||
},
|
||||
"ingress_lossy_pool": {
|
||||
"size": "{{ ingress_lossy_pool_size }}",
|
||||
"type": "ingress",
|
||||
"mode": "dynamic"
|
||||
},
|
||||
"egress_lossless_pool": {
|
||||
"size": "{{ egress_lossless_pool_size }}",
|
||||
"type": "egress",
|
||||
"mode": "dynamic"
|
||||
},
|
||||
"egress_lossy_pool": {
|
||||
"size": "{{ egress_lossy_pool_size }}",
|
||||
"type": "egress",
|
||||
"mode": "dynamic"
|
||||
}
|
||||
},
|
||||
"BUFFER_PROFILE": {
|
||||
"ingress_lossless_profile": {
|
||||
"pool":"ingress_lossless_pool",
|
||||
"size":"4096",
|
||||
"dynamic_th":"0"
|
||||
},
|
||||
"ingress_lossy_profile": {
|
||||
"pool":"ingress_lossy_pool",
|
||||
"size":"4096",
|
||||
"dynamic_th":"3"
|
||||
},
|
||||
"egress_lossless_profile": {
|
||||
"pool":"egress_lossless_pool",
|
||||
"size":"4096",
|
||||
"dynamic_th":"7"
|
||||
},
|
||||
"egress_lossy_profile": {
|
||||
"pool":"egress_lossy_pool",
|
||||
"size":"4096",
|
||||
"dynamic_th":"3"
|
||||
},
|
||||
"q_lossy_profile": {
|
||||
"pool":"egress_lossy_pool",
|
||||
"size":"4096",
|
||||
"dynamic_th":"3"
|
||||
}
|
||||
},
|
||||
{%- endmacro %}
|
||||
|
||||
{%- macro generate_pg_profils(port_names) %}
|
||||
"BUFFER_PG": {
|
||||
"{{ port_names }}|3-4": {
|
||||
"profile" : "ingress_lossless_profile"
|
||||
}
|
||||
},
|
||||
{%- endmacro %}
|
||||
|
||||
{%- macro generate_queue_buffers(port_names) %}
|
||||
"BUFFER_QUEUE": {
|
||||
"{{ port_names }}|3-4": {
|
||||
"profile" : "egress_lossless_profile"
|
||||
},
|
||||
"{{ port_names }}|0-1": {
|
||||
"profile" : "q_lossy_profile"
|
||||
}
|
||||
}
|
||||
{%- endmacro %}
|
@ -0,0 +1,329 @@
|
||||
{
|
||||
"interfaces": {
|
||||
"Ethernet0": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet4": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet8": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet12": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet16": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet20": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet24": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet28": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet32": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet36": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet40": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet44": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet48": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet52": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet56": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet60": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet64": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet68": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet72": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet76": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet80": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet84": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet88": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet92": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet96": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet100": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet104": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet108": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet112": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet116": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet120": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet124": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet128": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet132": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet136": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet140": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet144": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet148": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet152": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet156": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet160": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet164": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet168": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet172": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet176": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet180": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet184": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet188": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet192": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet196": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet200": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet204": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet208": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet212": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet216": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet220": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet224": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet228": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet232": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet236": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet240": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet244": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet248": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet252": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "rs"
|
||||
},
|
||||
"Ethernet256": {
|
||||
"default_brkout_mode": "1x100G[40G]",
|
||||
"autoneg": "off",
|
||||
"fec": "none"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
# PG lossless profiles.
|
||||
# speed cable size xon xoff threshold
|
||||
10000 5m 34816 18432 16384 0
|
||||
25000 5m 34816 18432 16384 0
|
||||
40000 5m 34816 18432 16384 0
|
||||
50000 5m 34816 18432 16384 0
|
||||
100000 5m 36864 18432 18432 0
|
||||
10000 40m 36864 18432 18432 0
|
||||
25000 40m 39936 18432 21504 0
|
||||
40000 40m 41984 18432 23552 0
|
||||
50000 40m 41984 18432 23552 0
|
||||
100000 40m 54272 18432 35840 0
|
||||
10000 300m 49152 18432 30720 0
|
||||
25000 300m 71680 18432 53248 0
|
||||
40000 300m 94208 18432 75776 0
|
||||
50000 300m 94208 18432 75776 0
|
||||
100000 300m 184320 18432 165888 0
|
@ -0,0 +1,65 @@
|
||||
# name lanes alias speed autoneg fec index
|
||||
Ethernet0 0,1,2,3 Ethernet0 100000 0 rs 0
|
||||
Ethernet4 4,5,6,7 Ethernet4 100000 0 rs 1
|
||||
Ethernet8 8,9,10,11 Ethernet8 100000 0 rs 2
|
||||
Ethernet12 12,13,14,15 Ethernet12 100000 0 rs 3
|
||||
Ethernet16 16,17,18,19 Ethernet16 100000 0 rs 4
|
||||
Ethernet20 20,21,22,23 Ethernet20 100000 0 rs 5
|
||||
Ethernet24 24,25,26,27 Ethernet24 100000 0 rs 6
|
||||
Ethernet28 28,29,30,31 Ethernet28 100000 0 rs 7
|
||||
Ethernet32 32,33,34,35 Ethernet32 100000 0 rs 8
|
||||
Ethernet36 36,37,38,39 Ethernet36 100000 0 rs 9
|
||||
Ethernet40 40,41,42,43 Ethernet40 100000 0 rs 10
|
||||
Ethernet44 44,45,46,47 Ethernet44 100000 0 rs 11
|
||||
Ethernet48 48,49,50,51 Ethernet48 100000 0 rs 12
|
||||
Ethernet52 52,53,54,55 Ethernet52 100000 0 rs 13
|
||||
Ethernet56 56,57,58,59 Ethernet56 100000 0 rs 14
|
||||
Ethernet60 60,61,62,63 Ethernet60 100000 0 rs 15
|
||||
Ethernet64 64,65,66,67 Ethernet64 100000 0 rs 16
|
||||
Ethernet68 68,69,70,71 Ethernet68 100000 0 rs 17
|
||||
Ethernet72 72,73,74,75 Ethernet72 100000 0 rs 18
|
||||
Ethernet76 76,77,78,79 Ethernet76 100000 0 rs 19
|
||||
Ethernet80 80,81,82,83 Ethernet80 100000 0 rs 20
|
||||
Ethernet84 84,85,86,87 Ethernet84 100000 0 rs 21
|
||||
Ethernet88 88,89,90,91 Ethernet88 100000 0 rs 22
|
||||
Ethernet92 92,93,94,95 Ethernet92 100000 0 rs 23
|
||||
Ethernet96 96,97,98,99 Ethernet96 100000 0 rs 24
|
||||
Ethernet100 100,101,102,103 Ethernet100 100000 0 rs 25
|
||||
Ethernet104 104,105,106,107 Ethernet104 100000 0 rs 26
|
||||
Ethernet108 108,109,110,111 Ethernet108 100000 0 rs 27
|
||||
Ethernet112 112,113,114,115 Ethernet112 100000 0 rs 28
|
||||
Ethernet116 116,117,118,119 Ethernet116 100000 0 rs 29
|
||||
Ethernet120 120,121,122,123 Ethernet120 100000 0 rs 30
|
||||
Ethernet124 124,125,126,127 Ethernet124 100000 0 rs 31
|
||||
Ethernet128 128,129,130,131 Ethernet128 100000 0 rs 32
|
||||
Ethernet132 132,133,134,135 Ethernet132 100000 0 rs 33
|
||||
Ethernet136 136,137,138,139 Ethernet136 100000 0 rs 34
|
||||
Ethernet140 140,141,142,143 Ethernet140 100000 0 rs 35
|
||||
Ethernet144 144,145,146,147 Ethernet144 100000 0 rs 36
|
||||
Ethernet148 148,149,150,151 Ethernet148 100000 0 rs 37
|
||||
Ethernet152 152,153,154,155 Ethernet152 100000 0 rs 38
|
||||
Ethernet156 156,157,158,159 Ethernet156 100000 0 rs 39
|
||||
Ethernet160 160,161,162,163 Ethernet160 100000 0 rs 40
|
||||
Ethernet164 164,165,166,167 Ethernet164 100000 0 rs 41
|
||||
Ethernet168 168,169,170,171 Ethernet168 100000 0 rs 42
|
||||
Ethernet172 172,173,174,175 Ethernet172 100000 0 rs 43
|
||||
Ethernet176 176,177,178,179 Ethernet176 100000 0 rs 44
|
||||
Ethernet180 180,181,182,183 Ethernet180 100000 0 rs 45
|
||||
Ethernet184 184,185,186,187 Ethernet184 100000 0 rs 46
|
||||
Ethernet188 188,189,190,191 Ethernet188 100000 0 rs 47
|
||||
Ethernet192 192,193,194,195 Ethernet192 100000 0 rs 48
|
||||
Ethernet196 196,197,198,199 Ethernet196 100000 0 rs 49
|
||||
Ethernet200 200,201,202,203 Ethernet200 100000 0 rs 50
|
||||
Ethernet204 204,205,206,207 Ethernet204 100000 0 rs 51
|
||||
Ethernet208 208,209,210,211 Ethernet208 100000 0 rs 52
|
||||
Ethernet212 212,213,214,215 Ethernet212 100000 0 rs 53
|
||||
Ethernet216 216,217,218,219 Ethernet216 100000 0 rs 54
|
||||
Ethernet220 220,221,222,223 Ethernet220 100000 0 rs 55
|
||||
Ethernet224 224,225,226,227 Ethernet224 100000 0 rs 56
|
||||
Ethernet228 228,229,230,231 Ethernet228 100000 0 rs 57
|
||||
Ethernet232 232,233,234,235 Ethernet232 100000 0 rs 58
|
||||
Ethernet236 236,237,238,239 Ethernet236 100000 0 rs 59
|
||||
Ethernet240 240,241,242,243 Ethernet240 100000 0 rs 60
|
||||
Ethernet244 244,245,246,247 Ethernet244 100000 0 rs 61
|
||||
Ethernet248 248,249,250,251 Ethernet248 100000 0 rs 62
|
||||
Ethernet252 252,253,254,255 Ethernet252 100000 0 rs 63
|
@ -0,0 +1,10 @@
|
||||
{%- macro generate_tc_to_pg_map() %}
|
||||
"TC_TO_PRIORITY_GROUP_MAP": {
|
||||
"AZURE": {
|
||||
"3": "3",
|
||||
"4": "4"
|
||||
}
|
||||
},
|
||||
{%- endmacro %}
|
||||
|
||||
{%- include 'qos_config.j2' %}
|
@ -0,0 +1,2 @@
|
||||
SAI_KEY_WARM_BOOT_WRITE_FILE=/var/warmboot/sai-warmboot.bin
|
||||
SAI_KEY_WARM_BOOT_READ_FILE=/var/warmboot/sai-warmboot.bin
|
@ -0,0 +1,40 @@
|
||||
{
|
||||
"instance": 0,
|
||||
"chip_list": [
|
||||
{
|
||||
"id": "asic-0",
|
||||
"chip_family": "Tofino",
|
||||
"instance": 0,
|
||||
"pcie_sysfs_prefix": "/sys/devices/pci0000:00/0000:00:03.0/0000:05:00.0",
|
||||
"pcie_domain": 0,
|
||||
"pcie_bus": 5,
|
||||
"pcie_fn": 0,
|
||||
"pcie_dev": 0,
|
||||
"pcie_int_mode": 1,
|
||||
"sds_fw_path": "share/tofino_sds_fw/avago/firmware"
|
||||
}
|
||||
],
|
||||
"p4_devices": [
|
||||
{
|
||||
"device-id": 0,
|
||||
"agent0": "lib/platform/x86_64-netberg_aurora_750-r0/libpltfm_mgr.so",
|
||||
"p4_programs": [
|
||||
{
|
||||
"p4_pipelines": [
|
||||
{
|
||||
"p4_pipeline_name": "pipe",
|
||||
"config": "share/switch/pipe/tofino.bin",
|
||||
"context": "share/switch/pipe/context.json"
|
||||
}
|
||||
],
|
||||
"program-name": "switch",
|
||||
"sai": "lib/libsai.so",
|
||||
"bfrt-config": "share/switch/bf-rt.json",
|
||||
"model_json_path" : "share/switch/aug_model.json",
|
||||
"switchapi_port_add": false,
|
||||
"non_default_port_ppgs": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
1
device/netberg/x86_64-netberg_aurora_750-r0/default_sku
Normal file
1
device/netberg/x86_64-netberg_aurora_750-r0/default_sku
Normal file
@ -0,0 +1 @@
|
||||
aurora-750 t1
|
9
device/netberg/x86_64-netberg_aurora_750-r0/fancontrol
Normal file
9
device/netberg/x86_64-netberg_aurora_750-r0/fancontrol
Normal file
@ -0,0 +1,9 @@
|
||||
INTERVAL=10
|
||||
DEVPATH=hwmon1=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-16/16-002f hwmon3=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-6/6-004c
|
||||
DEVNAME=hwmon1=w83795adg
|
||||
FCTEMPS=hwmon1/device/pwm2=hwmon3/temp1_input
|
||||
FCFANS=hwmon1/device/pwm2=hwmon1/device/fan7_input hwmon1/device/pwm2=hwmon1/device/fan5_input hwmon1/device/pwm2=hwmon1/device/fan3_input hwmon1/device/pwm2=hwmon1/device/fan1_input
|
||||
MINTEMP=hwmon1/device/pwm2=20
|
||||
MAXTEMP=hwmon1/device/pwm2=60
|
||||
MINSTART=hwmon1/device/pwm2=75
|
||||
MINSTOP=hwmon1/device/pwm2=22
|
@ -0,0 +1,3 @@
|
||||
CONSOLE_PORT=0x3f8
|
||||
CONSOLE_DEV=0
|
||||
CONSOLE_SPEED=115200
|
417
device/netberg/x86_64-netberg_aurora_750-r0/pcie.yaml
Normal file
417
device/netberg/x86_64-netberg_aurora_750-r0/pcie.yaml
Normal file
@ -0,0 +1,417 @@
|
||||
- bus: '00'
|
||||
dev: '00'
|
||||
fn: '0'
|
||||
id: 6f00
|
||||
name: 'Host bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D DMI2
|
||||
(rev 03)'
|
||||
- bus: '00'
|
||||
dev: '02'
|
||||
fn: '0'
|
||||
id: 6f04
|
||||
name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI
|
||||
Express Root Port 2 (rev 03)'
|
||||
- bus: '00'
|
||||
dev: '02'
|
||||
fn: '2'
|
||||
id: 6f06
|
||||
name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI
|
||||
Express Root Port 2 (rev 03)'
|
||||
- bus: '00'
|
||||
dev: '03'
|
||||
fn: '0'
|
||||
id: 6f08
|
||||
name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI
|
||||
Express Root Port 3 (rev 03)'
|
||||
- bus: '00'
|
||||
dev: '03'
|
||||
fn: '1'
|
||||
id: 6f09
|
||||
name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI
|
||||
Express Root Port 3 (rev 03)'
|
||||
- bus: '00'
|
||||
dev: '03'
|
||||
fn: '2'
|
||||
id: 6f0a
|
||||
name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI
|
||||
Express Root Port 3 (rev 03)'
|
||||
- bus: '00'
|
||||
dev: '03'
|
||||
fn: '3'
|
||||
id: 6f0b
|
||||
name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI
|
||||
Express Root Port 3 (rev 03)'
|
||||
- bus: '00'
|
||||
dev: '05'
|
||||
fn: '0'
|
||||
id: 6f28
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Map/VTd_Misc/System Management (rev 03)'
|
||||
- bus: '00'
|
||||
dev: '05'
|
||||
fn: '1'
|
||||
id: 6f29
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D IIO Hot Plug (rev 03)'
|
||||
- bus: '00'
|
||||
dev: '05'
|
||||
fn: '2'
|
||||
id: 6f2a
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D IIO RAS/Control Status/Global Errors (rev 03)'
|
||||
- bus: '00'
|
||||
dev: '05'
|
||||
fn: '4'
|
||||
id: 6f2c
|
||||
name: 'PIC: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D I/O APIC (rev
|
||||
03)'
|
||||
- bus: '00'
|
||||
dev: '14'
|
||||
fn: '0'
|
||||
id: 8c31
|
||||
name: 'USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB
|
||||
xHCI (rev 05)'
|
||||
- bus: '00'
|
||||
dev: 1c
|
||||
fn: '0'
|
||||
id: 8c10
|
||||
name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express
|
||||
Root Port #1 (rev d5)'
|
||||
- bus: '00'
|
||||
dev: 1f
|
||||
fn: '0'
|
||||
id: 8c54
|
||||
name: 'ISA bridge: Intel Corporation C224 Series Chipset Family Server Standard
|
||||
SKU LPC Controller (rev 05)'
|
||||
- bus: '00'
|
||||
dev: 1f
|
||||
fn: '2'
|
||||
id: 8c02
|
||||
name: 'SATA controller: Intel Corporation 8 Series/C220 Series Chipset Family 6-port
|
||||
SATA Controller 1 [AHCI mode] (rev 05)'
|
||||
- bus: '00'
|
||||
dev: 1f
|
||||
fn: '3'
|
||||
id: 8c22
|
||||
name: 'SMBus: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller
|
||||
(rev 05)'
|
||||
- bus: '01'
|
||||
dev: '00'
|
||||
fn: '0'
|
||||
id: 6f50
|
||||
name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology
|
||||
Register DMA Channel 0'
|
||||
- bus: '01'
|
||||
dev: '00'
|
||||
fn: '1'
|
||||
id: 6f51
|
||||
name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology
|
||||
Register DMA Channel 1'
|
||||
- bus: '01'
|
||||
dev: '00'
|
||||
fn: '2'
|
||||
id: 6f52
|
||||
name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology
|
||||
Register DMA Channel 2'
|
||||
- bus: '01'
|
||||
dev: '00'
|
||||
fn: '3'
|
||||
id: 6f53
|
||||
name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology
|
||||
Register DMA Channel 3'
|
||||
- bus: '02'
|
||||
dev: '00'
|
||||
fn: '0'
|
||||
id: 15ab
|
||||
name: 'Ethernet controller: Intel Corporation Ethernet Connection X552 10 GbE Backplane'
|
||||
- bus: '02'
|
||||
dev: '00'
|
||||
fn: '1'
|
||||
id: 15ab
|
||||
name: 'Ethernet controller: Intel Corporation Ethernet Connection X552 10 GbE Backplane'
|
||||
- bus: '04'
|
||||
dev: '00'
|
||||
fn: '0'
|
||||
id: '0010'
|
||||
name: 'Unassigned class [ff00]: Device 1d1c:0010 (rev 10)'
|
||||
- bus: 08
|
||||
dev: '00'
|
||||
fn: '0'
|
||||
id: '1533'
|
||||
name: 'Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev
|
||||
03)'
|
||||
- bus: ff
|
||||
dev: 0b
|
||||
fn: '0'
|
||||
id: 6f81
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D R3 QPI Link 0/1 (rev 03)'
|
||||
- bus: ff
|
||||
dev: 0b
|
||||
fn: '1'
|
||||
id: 6f36
|
||||
name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D R3 QPI Link 0/1 (rev 03)'
|
||||
- bus: ff
|
||||
dev: 0b
|
||||
fn: '2'
|
||||
id: 6f37
|
||||
name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D R3 QPI Link 0/1 (rev 03)'
|
||||
- bus: ff
|
||||
dev: 0b
|
||||
fn: '3'
|
||||
id: 6f76
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D R3 QPI Link Debug (rev 03)'
|
||||
- bus: ff
|
||||
dev: 0c
|
||||
fn: '0'
|
||||
id: 6fe0
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Caching Agent (rev 03)'
|
||||
- bus: ff
|
||||
dev: 0c
|
||||
fn: '1'
|
||||
id: 6fe1
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Caching Agent (rev 03)'
|
||||
- bus: ff
|
||||
dev: 0c
|
||||
fn: '2'
|
||||
id: 6fe2
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Caching Agent (rev 03)'
|
||||
- bus: ff
|
||||
dev: 0c
|
||||
fn: '3'
|
||||
id: 6fe3
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Caching Agent (rev 03)'
|
||||
- bus: ff
|
||||
dev: 0f
|
||||
fn: '0'
|
||||
id: 6ff8
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Caching Agent (rev 03)'
|
||||
- bus: ff
|
||||
dev: 0f
|
||||
fn: '4'
|
||||
id: 6ffc
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Caching Agent (rev 03)'
|
||||
- bus: ff
|
||||
dev: 0f
|
||||
fn: '5'
|
||||
id: 6ffd
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Caching Agent (rev 03)'
|
||||
- bus: ff
|
||||
dev: 0f
|
||||
fn: '6'
|
||||
id: 6ffe
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Caching Agent (rev 03)'
|
||||
- bus: ff
|
||||
dev: '10'
|
||||
fn: '0'
|
||||
id: 6f1d
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D R2PCIe Agent (rev 03)'
|
||||
- bus: ff
|
||||
dev: '10'
|
||||
fn: '1'
|
||||
id: 6f34
|
||||
name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D R2PCIe Agent (rev 03)'
|
||||
- bus: ff
|
||||
dev: '10'
|
||||
fn: '5'
|
||||
id: 6f1e
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Ubox (rev 03)'
|
||||
- bus: ff
|
||||
dev: '10'
|
||||
fn: '6'
|
||||
id: 6f7d
|
||||
name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Ubox (rev 03)'
|
||||
- bus: ff
|
||||
dev: '10'
|
||||
fn: '7'
|
||||
id: 6f1f
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Ubox (rev 03)'
|
||||
- bus: ff
|
||||
dev: '12'
|
||||
fn: '0'
|
||||
id: 6fa0
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Home Agent 0 (rev 03)'
|
||||
- bus: ff
|
||||
dev: '12'
|
||||
fn: '1'
|
||||
id: 6f30
|
||||
name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Home Agent 0 (rev 03)'
|
||||
- bus: ff
|
||||
dev: '13'
|
||||
fn: '0'
|
||||
id: 6fa8
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Memory Controller 0 - Target Address/Thermal/RAS (rev 03)'
|
||||
- bus: ff
|
||||
dev: '13'
|
||||
fn: '1'
|
||||
id: 6f71
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Memory Controller 0 - Target Address/Thermal/RAS (rev 03)'
|
||||
- bus: ff
|
||||
dev: '13'
|
||||
fn: '2'
|
||||
id: 6faa
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Memory Controller 0 - Channel Target Address Decoder (rev 03)'
|
||||
- bus: ff
|
||||
dev: '13'
|
||||
fn: '3'
|
||||
id: 6fab
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Memory Controller 0 - Channel Target Address Decoder (rev 03)'
|
||||
- bus: ff
|
||||
dev: '13'
|
||||
fn: '4'
|
||||
id: 6fac
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Memory Controller 0 - Channel Target Address Decoder (rev 03)'
|
||||
- bus: ff
|
||||
dev: '13'
|
||||
fn: '5'
|
||||
id: 6fad
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Memory Controller 0 - Channel Target Address Decoder (rev 03)'
|
||||
- bus: ff
|
||||
dev: '13'
|
||||
fn: '6'
|
||||
id: 6fae
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D DDRIO Channel 0/1 Broadcast (rev 03)'
|
||||
- bus: ff
|
||||
dev: '13'
|
||||
fn: '7'
|
||||
id: 6faf
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D DDRIO Global Broadcast (rev 03)'
|
||||
- bus: ff
|
||||
dev: '14'
|
||||
fn: '0'
|
||||
id: 6fb0
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Memory Controller 0 - Channel 0 Thermal Control (rev 03)'
|
||||
- bus: ff
|
||||
dev: '14'
|
||||
fn: '1'
|
||||
id: 6fb1
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Memory Controller 0 - Channel 1 Thermal Control (rev 03)'
|
||||
- bus: ff
|
||||
dev: '14'
|
||||
fn: '2'
|
||||
id: 6fb2
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Memory Controller 0 - Channel 0 Error (rev 03)'
|
||||
- bus: ff
|
||||
dev: '14'
|
||||
fn: '3'
|
||||
id: 6fb3
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Memory Controller 0 - Channel 1 Error (rev 03)'
|
||||
- bus: ff
|
||||
dev: '14'
|
||||
fn: '4'
|
||||
id: 6fbc
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D DDRIO Channel 0/1 Interface (rev 03)'
|
||||
- bus: ff
|
||||
dev: '14'
|
||||
fn: '5'
|
||||
id: 6fbd
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D DDRIO Channel 0/1 Interface (rev 03)'
|
||||
- bus: ff
|
||||
dev: '14'
|
||||
fn: '6'
|
||||
id: 6fbe
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D DDRIO Channel 0/1 Interface (rev 03)'
|
||||
- bus: ff
|
||||
dev: '14'
|
||||
fn: '7'
|
||||
id: 6fbf
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D DDRIO Channel 0/1 Interface (rev 03)'
|
||||
- bus: ff
|
||||
dev: '15'
|
||||
fn: '0'
|
||||
id: 6fb4
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Memory Controller 0 - Channel 2 Thermal Control (rev 03)'
|
||||
- bus: ff
|
||||
dev: '15'
|
||||
fn: '1'
|
||||
id: 6fb5
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Memory Controller 0 - Channel 3 Thermal Control (rev 03)'
|
||||
- bus: ff
|
||||
dev: '15'
|
||||
fn: '2'
|
||||
id: 6fb6
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Memory Controller 0 - Channel 2 Error (rev 03)'
|
||||
- bus: ff
|
||||
dev: '15'
|
||||
fn: '3'
|
||||
id: 6fb7
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Memory Controller 0 - Channel 3 Error (rev 03)'
|
||||
- bus: ff
|
||||
dev: 1e
|
||||
fn: '0'
|
||||
id: 6f98
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Power Control Unit (rev 03)'
|
||||
- bus: ff
|
||||
dev: 1e
|
||||
fn: '1'
|
||||
id: 6f99
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Power Control Unit (rev 03)'
|
||||
- bus: ff
|
||||
dev: 1e
|
||||
fn: '2'
|
||||
id: 6f9a
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Power Control Unit (rev 03)'
|
||||
- bus: ff
|
||||
dev: 1e
|
||||
fn: '3'
|
||||
id: 6fc0
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Power Control Unit (rev 03)'
|
||||
- bus: ff
|
||||
dev: 1e
|
||||
fn: '4'
|
||||
id: 6f9c
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Power Control Unit (rev 03)'
|
||||
- bus: ff
|
||||
dev: 1f
|
||||
fn: '0'
|
||||
id: 6f88
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Power Control Unit (rev 03)'
|
||||
- bus: ff
|
||||
dev: 1f
|
||||
fn: '2'
|
||||
id: 6f8a
|
||||
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
|
||||
D Power Control Unit (rev 03)'
|
@ -0,0 +1 @@
|
||||
barefoot
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"skip_pcied": false,
|
||||
"skip_fancontrol": false,
|
||||
"skip_thermalctld": false,
|
||||
"skip_ledd": true,
|
||||
"skip_xcvrd": false,
|
||||
"skip_psud": false,
|
||||
"skip_syseepromd": false
|
||||
}
|
94
device/netberg/x86_64-netberg_aurora_750-r0/sensors.conf
Normal file
94
device/netberg/x86_64-netberg_aurora_750-r0/sensors.conf
Normal file
@ -0,0 +1,94 @@
|
||||
# libsensors configuration file
|
||||
chip "i350bb-*"
|
||||
ignore loc1
|
||||
|
||||
chip "jc42-*"
|
||||
|
||||
bus "i2c-16" "i2c-mux-1 (chan_id 7)"
|
||||
chip "w83795adg-*"
|
||||
ignore in0
|
||||
label in1 "VDD_CORE"
|
||||
set in1_min 0.717
|
||||
set in1_max 0.962
|
||||
ignore in2
|
||||
ignore in3
|
||||
label in4 "3.3V"
|
||||
compute in4 @/(0.3052), (0.3052)*@
|
||||
set in4_min 3.3 * 0.95
|
||||
set in4_max 3.3 * 1.05
|
||||
label in5 "0.9V"
|
||||
set in5_min 0.90 * 0.98
|
||||
set in5_max 0.90 * 1.02
|
||||
ignore in6
|
||||
ignore in7
|
||||
ignore in8
|
||||
ignore in9
|
||||
ignore in10
|
||||
ignore in11
|
||||
ignore in12
|
||||
ignore in13
|
||||
ignore in14
|
||||
ignore in15
|
||||
ignore in16
|
||||
ignore in17
|
||||
ignore in18
|
||||
ignore in19
|
||||
label fan1 "FANTRAY 1"
|
||||
ignore fan2
|
||||
label fan3 "FANTRAY 2"
|
||||
ignore fan4
|
||||
label fan5 "FANTRAY 3"
|
||||
ignore fan6
|
||||
label fan7 "FANTRAY 4"
|
||||
ignore fan8
|
||||
ignore temp1
|
||||
ignore temp2
|
||||
ignore temp3
|
||||
ignore temp4
|
||||
ignore temp5
|
||||
ignore temp6
|
||||
ignore intrusion0
|
||||
|
||||
chip "tmp75-i2c-*-4A"
|
||||
label temp1 "BMC Board Temp"
|
||||
set temp1_max 50
|
||||
set temp1_max_hyst 45
|
||||
|
||||
bus "i2c-0" "SMBus I801 adapter at f000"
|
||||
chip "tmp75-i2c-*-4F"
|
||||
label temp1 "x86 CPU Board Temp"
|
||||
set temp1_max 50
|
||||
set temp1_max_hyst 45
|
||||
|
||||
bus "i2c-6" "i2c-0-mux (chan_id 5)"
|
||||
chip "lm75-i2c-6-4D"
|
||||
label temp1 "Rear Panel Temp"
|
||||
set temp1_max 50
|
||||
set temp1_max_hyst 45
|
||||
chip "lm75-i2c-6-4E"
|
||||
label temp1 "Rear MAC"
|
||||
set temp1_max 50
|
||||
set temp1_max_hyst 45
|
||||
chip "lm86-i2c-6-4C"
|
||||
label temp1 "lm86"
|
||||
set temp1_max 50
|
||||
label temp2 "Front MAC Temp"
|
||||
set temp2_max 70
|
||||
bus "i2c-7" "i2c-0-mux (chan_id 6)"
|
||||
chip "lm75-i2c-7-4D"
|
||||
label temp1 "Front Panel"
|
||||
set temp1_max 50
|
||||
set temp1_max_hyst 45
|
||||
chip "lm75-i2c-7-4E"
|
||||
label temp1 "Front MAC"
|
||||
set temp1_max 50
|
||||
set temp1_max_hyst 45
|
||||
chip "lm75-i2c-16-4A"
|
||||
label temp1 "BMC board thermal"
|
||||
set temp1_max 50
|
||||
set temp1_max_hyst 45
|
||||
chip "lm75-i2c-0-4F"
|
||||
label temp1 "CPU board thermal,"
|
||||
set temp1_max 50
|
||||
set temp1_max_hyst 45
|
||||
|
@ -15,6 +15,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(INGRASYS_S9280_64X_PLATFORM_MODULE)
|
||||
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(BFN_MONTARA_QS_PLATFORM_MODULE)
|
||||
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(NETBERG_AURORA_610_PLATFORM_MODULE)
|
||||
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(NETBERG_AURORA_710_PLATFORM_MODULE)
|
||||
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(NETBERG_AURORA_750_PLATFORM_MODULE)
|
||||
ifeq ($(INSTALL_DEBUG_TOOLS),y)
|
||||
$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_DBG_IMAGES)
|
||||
$(SONIC_ONE_IMAGE)_DOCKERS += $(filter-out $(patsubst %-$(DBG_IMAGE_MARK).gz,%.gz, $(SONIC_INSTALL_DOCKER_DBG_IMAGES)), $(SONIC_INSTALL_DOCKER_IMAGES))
|
||||
|
@ -2,9 +2,11 @@
|
||||
|
||||
NETBERG_AURORA_610_PLATFORM_MODULE_VERSION = 1.1.1
|
||||
NETBERG_AURORA_710_PLATFORM_MODULE_VERSION = 1.1.1
|
||||
NETBERG_AURORA_750_PLATFORM_MODULE_VERSION = 1.1.1
|
||||
|
||||
export NETBERG_AURORA_610_PLATFORM_MODULE_VERSION
|
||||
export NETBERG_AURORA_710_PLATFORM_MODULE_VERSION
|
||||
export NETBERG_AURORA_750_PLATFORM_MODULE_VERSION
|
||||
|
||||
NETBERG_AURORA_610_PLATFORM_MODULE = sonic-platform-netberg-aurora-610_$(NETBERG_AURORA_610_PLATFORM_MODULE_VERSION)_amd64.deb
|
||||
$(NETBERG_AURORA_610_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-netberg
|
||||
@ -17,3 +19,8 @@ NETBERG_AURORA_710_PLATFORM_MODULE = sonic-platform-netberg-aurora-710_$(NETBERG
|
||||
$(NETBERG_AURORA_710_PLATFORM_MODULE)_PLATFORM = x86_64-netberg_aurora_710-r0
|
||||
|
||||
$(eval $(call add_extra_package,$(NETBERG_AURORA_610_PLATFORM_MODULE),$(NETBERG_AURORA_710_PLATFORM_MODULE)))
|
||||
|
||||
NETBERG_AURORA_750_PLATFORM_MODULE = sonic-platform-netberg-aurora-750_$(NETBERG_AURORA_750_PLATFORM_MODULE_VERSION)_amd64.deb
|
||||
$(NETBERG_AURORA_750_PLATFORM_MODULE)_PLATFORM = x86_64-netberg_aurora_750-r0
|
||||
|
||||
$(eval $(call add_extra_package,$(NETBERG_AURORA_610_PLATFORM_MODULE),$(NETBERG_AURORA_750_PLATFORM_MODULE)))
|
||||
|
23
platform/barefoot/sonic-platform-modules-netberg/aurora-750/.gitignore
vendored
Normal file
23
platform/barefoot/sonic-platform-modules-netberg/aurora-750/.gitignore
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
# kernel module build
|
||||
*.o
|
||||
*.ko
|
||||
*.mod.c
|
||||
*.mod.o
|
||||
*.cmd
|
||||
Module.symvers
|
||||
modules.order
|
||||
|
||||
# debian packaging
|
||||
*.debhelper
|
||||
*.log
|
||||
DEBIAN
|
||||
.tmp_versions
|
||||
.finished.build
|
||||
*.substvars
|
||||
|
||||
# python
|
||||
*.pyc
|
||||
/build
|
||||
/*.egg-info
|
||||
/venv
|
||||
/.pybuild
|
@ -0,0 +1 @@
|
||||
obj-m := netberg_nba750_64x_i2c_cpld.o
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,322 @@
|
||||
/* header file for i2c cpld driver of NETBERG_NBA750_64X
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NETBERG_NBA750_64X_I2C_CPLD_H
|
||||
#define NETBERG_NBA750_64X_I2C_CPLD_H
|
||||
|
||||
/* CPLD device index value */
|
||||
enum cpld_id {
|
||||
cpld1,
|
||||
cpld2,
|
||||
cpld3,
|
||||
cpld4,
|
||||
cpld5
|
||||
};
|
||||
|
||||
enum LED_BLINK {
|
||||
BLINK,
|
||||
NOBLINK,
|
||||
};
|
||||
|
||||
enum LED_YELLOW {
|
||||
YELLOW_OFF,
|
||||
YELLOW_ON,
|
||||
};
|
||||
|
||||
enum LED_GREEN {
|
||||
GREEN_OFF,
|
||||
GREEN_ON,
|
||||
};
|
||||
|
||||
/* port number on CPLD */
|
||||
#define CPLD_1_PORT_NUM 12
|
||||
#define CPLD_2_PORT_NUM 13
|
||||
|
||||
/* QSFP port number */
|
||||
#define QSFP_MAX_PORT_NUM 64
|
||||
#define QSFP_MIN_PORT_NUM 1
|
||||
|
||||
/* SFP+ port number */
|
||||
#define SFP_MAX_PORT_NUM 2
|
||||
#define SFP_MIN_PORT_NUM 1
|
||||
|
||||
|
||||
/* CPLD registers */
|
||||
#define CPLD_BOARD_TYPE_REG 0x0
|
||||
#define CPLD_EXT_BOARD_TYPE_REG 0x7
|
||||
#define CPLD_VERSION_REG 0x1
|
||||
#define CPLD_ID_REG 0x2
|
||||
#define CPLD_QSFP_PORT_STATUS_BASE_REG 0x20
|
||||
#define CPLD_QSFP_PORT_CONFIG_BASE_REG 0x30
|
||||
#define CPLD_QSFP_PORT_INTERRUPT_REG 0x40
|
||||
#define CPLD_SFP_PORT_STATUS_REG 0x2F
|
||||
#define CPLD_SFP_PORT_CONFIG_REG 0x3F
|
||||
#define CPLD_QSFP_PORT_INTERRUPT_REG 0x40
|
||||
#define CPLD_10GMUX_CONFIG_REG 0x41
|
||||
#define CPLD_BMC_STATUS_REG 0x42
|
||||
#define CPLD_BMC_WATCHDOG_REG 0x43
|
||||
#define CPLD_USB_STATUS_REG 0x44
|
||||
#define CPLD_RESET_CONTROL_REG 0x4A
|
||||
#define CPLD_SFP_LED_REG 0x80
|
||||
#define CPLD_SFP_LED_BLINK_REG 0x90
|
||||
#define CPLD_QSFP_LED_BASE_REG 0x80
|
||||
#define CPLD_QSFP_LED_BLINK_BASE_REG 0x90
|
||||
#define CPLD_RTMR_RESET_REG 0x4B
|
||||
#define CPLD_ROV_STATUS_REG 0x4C
|
||||
|
||||
/* bit definition for register value */
|
||||
enum CPLD_QSFP_PORT_STATUS_BITS {
|
||||
CPLD_QSFP_PORT_STATUS_INT_BIT,
|
||||
CPLD_QSFP_PORT_STATUS_ABS_BIT,
|
||||
};
|
||||
enum CPLD_QSFP_PORT_CONFIG_BITS {
|
||||
CPLD_QSFP_PORT_CONFIG_RESET_BIT,
|
||||
CPLD_QSFP_PORT_CONFIG_RESERVE_BIT,
|
||||
CPLD_QSFP_PORT_CONFIG_LPMODE_BIT,
|
||||
};
|
||||
enum CPLD_SFP_PORT_STATUS_BITS {
|
||||
CPLD_SFP0_PORT_STATUS_PRESENT_BIT,
|
||||
CPLD_SFP0_PORT_STATUS_TXFAULT_BIT,
|
||||
CPLD_SFP0_PORT_STATUS_RXLOS_BIT,
|
||||
CPLD_SFP_PORT_STATUS_DUMMY,
|
||||
CPLD_SFP1_PORT_STATUS_PRESENT_BIT,
|
||||
CPLD_SFP1_PORT_STATUS_TXFAULT_BIT,
|
||||
CPLD_SFP1_PORT_STATUS_RXLOS_BIT,
|
||||
};
|
||||
enum CPLD_SFP_PORT_CONFIG_BITS {
|
||||
CPLD_SFP0_PORT_CONFIG_TXDIS_BIT,
|
||||
CPLD_SFP0_PORT_CONFIG_RS_BIT,
|
||||
CPLD_SFP0_PORT_CONFIG_TS_BIT,
|
||||
CPLD_SFP_PORT_CONFIG_DUMMY,
|
||||
CPLD_SFP1_PORT_CONFIG_TXDIS_BIT,
|
||||
CPLD_SFP1_PORT_CONFIG_RS_BIT,
|
||||
CPLD_SFP1_PORT_CONFIG_TS_BIT,
|
||||
|
||||
};
|
||||
enum CPLD_10GMUX_CONFIG_BITS {
|
||||
CPLD_10GMUX_CONFIG_ENSMB_BIT,
|
||||
CPLD_10GMUX_CONFIG_ENINPUT_BIT,
|
||||
CPLD_10GMUX_CONFIG_SEL1_BIT,
|
||||
CPLD_10GMUX_CONFIG_SEL0_BIT,
|
||||
};
|
||||
enum CPLD_BMC_WATCHDOG_BITS {
|
||||
CPLD_10GMUX_CONFIG_ENTIMER_BIT,
|
||||
CPLD_10GMUX_CONFIG_TIMEOUT_BIT,
|
||||
};
|
||||
enum CPLD_RESET_CONTROL_BITS {
|
||||
CPLD_RESET_CONTROL_SWRST_BIT,
|
||||
CPLD_RESET_CONTROL_CP2104RST_BIT,
|
||||
CPLD_RESET_CONTROL_82P33814RST_BIT,
|
||||
CPLD_RESET_CONTROL_BMCRST_BIT,
|
||||
};
|
||||
enum CPLD_SFP_LED_BITS {
|
||||
CPLD_SFP_LED_SFP0_GREEN_BIT,
|
||||
CPLD_SFP_LED_SFP0_YELLOW_BIT,
|
||||
CPLD_SFP_LED_SFP1_GREEN_BIT,
|
||||
CPLD_SFP_LED_SFP1_YELLOW_BIT,
|
||||
};
|
||||
enum CPLD_SFP_LED_BLINK_BITS {
|
||||
CPLD_SFP_LED_BLINK_SFP0_BIT,
|
||||
CPLD_SFP_LED_BLINK_SFP1_BIT,
|
||||
};
|
||||
enum CPLD_QSFP_LED_BITS {
|
||||
CPLD_QSFP_LED_CHAN_0_GREEN_BIT,
|
||||
CPLD_QSFP_LED_CHAN_0_YELLOW_BIT,
|
||||
CPLD_QSFP_LED_CHAN_1_GREEN_BIT,
|
||||
CPLD_QSFP_LED_CHAN_1_YELLOW_BIT,
|
||||
CPLD_QSFP_LED_CHAN_2_GREEN_BIT,
|
||||
CPLD_QSFP_LED_CHAN_2_YELLOW_BIT,
|
||||
CPLD_QSFP_LED_CHAN_3_GREEN_BIT,
|
||||
CPLD_QSFP_LED_CHAN_3_YELLOW_BIT,
|
||||
|
||||
};
|
||||
enum CPLD_QSFP_LED_BLINK_BITS {
|
||||
CPLD_QSFP_LED_BLINK_X_CHAN0_BIT,
|
||||
CPLD_QSFP_LED_BLINK_X_CHAN1_BIT,
|
||||
CPLD_QSFP_LED_BLINK_X_CHAN2_BIT,
|
||||
CPLD_QSFP_LED_BLINK_X_CHAN3_BIT,
|
||||
CPLD_QSFP_LED_BLINK_XPLUS_CHAN0_BIT,
|
||||
CPLD_QSFP_LED_BLINK_XPLUS_CHAN1_BIT,
|
||||
CPLD_QSFP_LED_BLINK_XPLUS_CHAN2_BIT,
|
||||
CPLD_QSFP_LED_BLINK_XPLUS_CHAN3_BIT,
|
||||
};
|
||||
|
||||
/* bit field structure for register value */
|
||||
struct cpld_reg_board_type_t {
|
||||
u8 build_rev:2;
|
||||
u8 hw_rev:2;
|
||||
u8 board_id:4;
|
||||
};
|
||||
|
||||
struct cpld_reg_version_t {
|
||||
u8 revision:6;
|
||||
u8 release:1;
|
||||
u8 reserve:1;
|
||||
};
|
||||
|
||||
struct cpld_reg_id_t {
|
||||
u8 id:3;
|
||||
u8 release:5;
|
||||
};
|
||||
|
||||
/* common manipulation */
|
||||
#define INVALID(i, min, max) ((i < min) || (i > max) ? 1u : 0u)
|
||||
#define READ_BIT(val, bit) ((0u == (val & (1<<bit))) ? 0u : 1u)
|
||||
#define SET_BIT(val, bit) (val |= (1 << bit))
|
||||
#define CLEAR_BIT(val, bit) (val &= ~(1 << bit))
|
||||
#define TOGGLE_BIT(val, bit) (val ^= (1 << bit))
|
||||
#define _BIT(n) (1<<(n))
|
||||
#define _BIT_MASK(len) (BIT(len)-1)
|
||||
|
||||
/* bitfield of register manipulation */
|
||||
#define READ_BF(bf_struct, val, bf_name, bf_value) \
|
||||
(bf_value = ((struct bf_struct *)&val)->bf_name)
|
||||
#define READ_BF_1(bf_struct, val, bf_name, bf_value) \
|
||||
bf_struct bf; \
|
||||
bf.data = val; \
|
||||
bf_value = bf.bf_name
|
||||
#define BOARD_TYPE_BUILD_REV_GET(val, res) \
|
||||
READ_BF(cpld_reg_board_type_t, val, build_rev, res)
|
||||
#define BOARD_TYPE_HW_REV_GET(val, res) \
|
||||
READ_BF(cpld_reg_board_type_t, val, hw_rev, res)
|
||||
#define BOARD_TYPE_BOARD_ID_GET(val, res) \
|
||||
READ_BF(cpld_reg_board_type_t, val, board_id, res)
|
||||
#define CPLD_VERSION_REV_GET(val, res) \
|
||||
READ_BF(cpld_reg_version_t, val, revision, res)
|
||||
#define CPLD_VERSION_REL_GET(val, res) \
|
||||
READ_BF(cpld_reg_version_t, val, release, res)
|
||||
#define CPLD_ID_ID_GET(val, res) \
|
||||
READ_BF(cpld_reg_id_t, val, id, res)
|
||||
#define CPLD_ID_REL_GET(val, res) \
|
||||
READ_BF(cpld_reg_id_t, val, release, res)
|
||||
/* SFP/QSFP port led registers manipulation */
|
||||
#define SFP_LED_TO_CPLD_IDX(sfp_port) cpld1
|
||||
#define SFP_LED_REG(sfp_port) CPLD_SFP_LED_REG
|
||||
#define SFP_LED_BLINK_REG(sfp_port) CPLD_SFP_LED_BLINK_REG
|
||||
#define QSFP_LED_TO_CPLD_IDX(qsfp_port) \
|
||||
((qsfp_port - 1) / 16 + 2)
|
||||
#define QSFP_LED_REG(qsfp_port) \
|
||||
((qsfp_port - 1) % 16 + CPLD_QSFP_LED_BASE_REG)
|
||||
#define QSFP_LED_BLINK_REG(qsfp_port) \
|
||||
(((qsfp_port - 1) % 16) / 2 + CPLD_QSFP_LED_BLINK_BASE_REG)
|
||||
/* QSFP/SFP port status registers manipulation */
|
||||
#define QSFP_TO_CPLD_IDX(qsfp_port, cpld_index, cpld_port) \
|
||||
{ \
|
||||
if (QSFP_MIN_PORT_NUM <= qsfp_port && qsfp_port <= CPLD_1_PORT_NUM) { \
|
||||
cpld_index = cpld1; \
|
||||
cpld_port = qsfp_port - 1; \
|
||||
} else if (CPLD_1_PORT_NUM < qsfp_port \
|
||||
&& qsfp_port <= QSFP_MAX_PORT_NUM) { \
|
||||
cpld_index = cpld2 + (qsfp_port - 1 - CPLD_1_PORT_NUM) \
|
||||
/ CPLD_2_PORT_NUM; \
|
||||
cpld_port = (qsfp_port - 1 - CPLD_1_PORT_NUM) % \
|
||||
CPLD_2_PORT_NUM; \
|
||||
} else { \
|
||||
cpld_index = 0; \
|
||||
cpld_port = 0; \
|
||||
} \
|
||||
}
|
||||
#define QSFP_PORT_STATUS_REG(cpld_port) \
|
||||
(CPLD_QSFP_PORT_STATUS_BASE_REG + cpld_port)
|
||||
#define QSFP_PORT_CONFIG_REG(cpld_port) \
|
||||
(CPLD_QSFP_PORT_CONFIG_BASE_REG + cpld_port)
|
||||
#define QSFP_PORT_INT_BIT_GET(port_status_value) \
|
||||
READ_BIT(port_status_value, CPLD_QSFP_PORT_STATUS_INT_BIT)
|
||||
#define QSFP_PORT_ABS_BIT_GET(port_status_value) \
|
||||
READ_BIT(port_status_value, CPLD_QSFP_PORT_STATUS_ABS_BIT)
|
||||
#define QSFP_PORT_RESET_BIT_GET(port_config_value) \
|
||||
READ_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_RESET_BIT)
|
||||
#define QSFP_PORT_LPMODE_BIT_GET(port_config_value) \
|
||||
READ_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_LPMODE_BIT)
|
||||
#define QSFP_PORT_RESET_BIT_SET(port_config_value) \
|
||||
SET_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_RESET_BIT)
|
||||
#define QSFP_PORT_RESET_BIT_CLEAR(port_config_value) \
|
||||
CLEAR_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_RESET_BIT)
|
||||
#define QSFP_PORT_LPMODE_BIT_SET(port_config_value) \
|
||||
SET_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_LPMODE_BIT)
|
||||
#define QSFP_PORT_LPMODE_BIT_CLEAR(port_config_value) \
|
||||
CLEAR_BIT(port_config_value, CPLD_QSFP_PORT_CONFIG_LPMODE_BIT)
|
||||
#define SFP_PORT_PRESENT_BIT_GET(sfp_port, port_status_value) \
|
||||
if (sfp_port == SFP_MIN_PORT_NUM) { \
|
||||
READ_BIT(port_status_value, CPLD_SFP0_PORT_STATUS_PRESENT_BIT); \
|
||||
} else { \
|
||||
READ_BIT(port_status_value, CPLD_SFP1_PORT_STATUS_PRESENT_BIT); \
|
||||
}
|
||||
#define SFP_PORT_TXFAULT_BIT_GET(sfp_port, port_status_value) \
|
||||
if (sfp_port == SFP_MIN_PORT_NUM) { \
|
||||
READ_BIT(port_status_value, CPLD_SFP0_PORT_STATUS_TXFAULT_BIT); \
|
||||
} else { \
|
||||
READ_BIT(port_status_value, CPLD_SFP1_PORT_STATUS_TXFAULT_BIT); \
|
||||
}
|
||||
#define SFP_PORT_RXLOS_BIT_GET(sfp_port, port_status_value) \
|
||||
if (sfp_port == SFP_MIN_PORT_NUM) { \
|
||||
READ_BIT(port_status_value, CPLD_SFP0_PORT_STATUS_RXLOS_BIT); \
|
||||
} else { \
|
||||
READ_BIT(port_status_value, CPLD_SFP1_PORT_STATUS_RXLOS_BIT); \
|
||||
}
|
||||
#define SFP_PORT_TXDIS_BIT_GET(sfp_port, port_config_value) \
|
||||
if (sfp_port == SFP_MIN_PORT_NUM) { \
|
||||
READ_BIT(port_config_value, CPLD_SFP0_PORT_CONFIG_TXDIS_BIT); \
|
||||
} else { \
|
||||
READ_BIT(port_config_value, CPLD_SFP1_PORT_STATUS_RXLOS_BIT); \
|
||||
}
|
||||
#define SFP_PORT_RS_BIT_GET(sfp_port, port_config_value) \
|
||||
if (sfp_port == SFP_MIN_PORT_NUM) { \
|
||||
READ_BIT(port_config_value, CPLD_SFP0_PORT_CONFIG_RS_BIT); \
|
||||
} else { \
|
||||
READ_BIT(port_config_value, CPLD_SFP1_PORT_CONFIG_RS_BIT); \
|
||||
}
|
||||
#define SFP_PORT_TS_BIT_GET(sfp_port, port_config_value) \
|
||||
if (sfp_port == SFP_MIN_PORT_NUM) { \
|
||||
READ_BIT(port_config_value, CPLD_SFP0_PORT_CONFIG_TS_BIT); \
|
||||
} else { \
|
||||
READ_BIT(port_config_value, CPLD_SFP0_PORT_CONFIG_TS_BIT); \
|
||||
}
|
||||
#define SFP_PORT_TXDIS_BIT_SET(sfp_port, port_config_value) \
|
||||
if (sfp_port == SFP_MIN_PORT_NUM) { \
|
||||
SET_BIT(port_config_value, CPLD_SFP0_PORT_CONFIG_TXDIS_BIT); \
|
||||
} else { \
|
||||
SET_BIT(port_config_value, CPLD_SFP1_PORT_CONFIG_TXDIS_BIT); \
|
||||
}
|
||||
#define SFP_PORT_TXDIS_BIT_CLEAR(sfp_port, port_config_value) \
|
||||
if (sfp_port == SFP_MIN_PORT_NUM) { \
|
||||
CLEAR_BIT(port_config_value, CPLD_SFP0_PORT_CONFIG_TXDIS_BIT); \
|
||||
} else { \
|
||||
CLEAR_BIT(port_config_value, CPLD_SFP1_PORT_CONFIG_TXDIS_BIT); \
|
||||
}
|
||||
#define SFP_PORT_RS_BIT_SET(sfp_port, port_config_value) \
|
||||
if (sfp_port == SFP_MIN_PORT_NUM) { \
|
||||
SET_BIT(port_config_value, CPLD_SFP0_PORT_CONFIG_RS_BIT); \
|
||||
} else { \
|
||||
SET_BIT(port_config_value, CPLD_SFP1_PORT_CONFIG_RS_BIT); \
|
||||
}
|
||||
#define SFP_PORT_RS_BIT_CLEAR(sfp_port, port_config_value) \
|
||||
if (sfp_port == SFP_MIN_PORT_NUM) { \
|
||||
CLEAR_BIT(port_config_value, CPLD_SFP0_PORT_CONFIG_RS_BIT); \
|
||||
} else { \
|
||||
CLEAR_BIT(port_config_value, CPLD_SFP1_PORT_CONFIG_RS_BIT); \
|
||||
}
|
||||
#define SFP_PORT_TS_BIT_SET(sfp_port, port_config_value) \
|
||||
if (sfp_port == SFP_MIN_PORT_NUM) { \
|
||||
SET_BIT(port_config_value, CPLD_SFP0_PORT_CONFIG_TS_BIT); \
|
||||
} else { \
|
||||
SET_BIT(port_config_value, CPLD_SFP1_PORT_CONFIG_TS_BIT); \
|
||||
}
|
||||
#define SFP_PORT_TS_BIT_CLEAR(sfp_port, port_config_value) \
|
||||
if (sfp_port == SFP_MIN_PORT_NUM) { \
|
||||
CLEAR_BIT(port_config_value, CPLD_SFP0_PORT_CONFIG_TS_BIT); \
|
||||
} else { \
|
||||
CLEAR_BIT(port_config_value, CPLD_SFP1_PORT_CONFIG_TS_BIT); \
|
||||
}
|
||||
|
||||
/* CPLD access functions */
|
||||
extern int netberg_i2c_cpld_get_qsfp_port_status_val(u8 port_num);
|
||||
extern int netberg_i2c_cpld_get_qsfp_port_config_val(u8 port_num);
|
||||
extern int netberg_i2c_cpld_set_qsfp_port_config_val(u8 port_num, u8 reg_val);
|
||||
extern int netberg_i2c_cpld_get_sfp_port_status_val(void);
|
||||
extern int netberg_i2c_cpld_get_sfp_port_config_val(void);
|
||||
extern int netberg_i2c_cpld_set_sfp_port_config_val(u8 reg_val);
|
||||
extern u8 fp_port_to_phy_port(u8 fp_port);
|
||||
#endif
|
||||
|
@ -0,0 +1,158 @@
|
||||
#ifndef _NBA750_64X_PLATFORM_H
|
||||
#define _NBA750_64X_PLATFORM_H
|
||||
|
||||
#include <linux/i2c.h>
|
||||
|
||||
// remove debug before release
|
||||
#define DEBUG
|
||||
|
||||
enum bus_order {
|
||||
I2C_BUS_MAIN,
|
||||
MUX_9548_0_CH0,
|
||||
MUX_9548_0_CH1,
|
||||
MUX_9548_0_CH2,
|
||||
MUX_9548_0_CH3,
|
||||
MUX_9548_0_CH4,
|
||||
MUX_9548_0_CH5,
|
||||
MUX_9548_0_CH6,
|
||||
MUX_9548_0_CH7,
|
||||
MUX_9548_1_CH0,
|
||||
MUX_9548_1_CH1,
|
||||
MUX_9548_1_CH2,
|
||||
MUX_9548_1_CH3,
|
||||
MUX_9548_1_CH4,
|
||||
MUX_9548_1_CH5,
|
||||
MUX_9548_1_CH6,
|
||||
MUX_9548_1_CH7,
|
||||
MUX_9548_2_CH0,
|
||||
MUX_9548_2_CH1,
|
||||
MUX_9548_2_CH2,
|
||||
MUX_9548_2_CH3,
|
||||
MUX_9548_2_CH4,
|
||||
MUX_9548_2_CH5,
|
||||
MUX_9548_2_CH6,
|
||||
MUX_9548_2_CH7,
|
||||
MUX_9546_0_CH0,
|
||||
MUX_9546_0_CH1,
|
||||
MUX_9546_0_CH2,
|
||||
MUX_9546_0_CH3,
|
||||
MUX_9546_1_CH0,
|
||||
MUX_9546_1_CH1,
|
||||
MUX_9546_1_CH2,
|
||||
MUX_9546_1_CH3,
|
||||
MUX_9548_11_CH0,
|
||||
MUX_9548_11_CH1,
|
||||
MUX_9548_11_CH2,
|
||||
MUX_9548_11_CH3,
|
||||
MUX_9548_11_CH4,
|
||||
MUX_9548_11_CH5,
|
||||
MUX_9548_11_CH6,
|
||||
MUX_9548_11_CH7,
|
||||
MUX_9548_3_CH0,
|
||||
MUX_9548_3_CH1,
|
||||
MUX_9548_3_CH2,
|
||||
MUX_9548_3_CH3,
|
||||
MUX_9548_3_CH4,
|
||||
MUX_9548_3_CH5,
|
||||
MUX_9548_3_CH6,
|
||||
MUX_9548_3_CH7,
|
||||
MUX_9548_4_CH0,
|
||||
MUX_9548_4_CH1,
|
||||
MUX_9548_4_CH2,
|
||||
MUX_9548_4_CH3,
|
||||
MUX_9548_4_CH4,
|
||||
MUX_9548_4_CH5,
|
||||
MUX_9548_4_CH6,
|
||||
MUX_9548_4_CH7,
|
||||
MUX_9548_5_CH0,
|
||||
MUX_9548_5_CH1,
|
||||
MUX_9548_5_CH2,
|
||||
MUX_9548_5_CH3,
|
||||
MUX_9548_5_CH4,
|
||||
MUX_9548_5_CH5,
|
||||
MUX_9548_5_CH6,
|
||||
MUX_9548_5_CH7,
|
||||
MUX_9548_6_CH0,
|
||||
MUX_9548_6_CH1,
|
||||
MUX_9548_6_CH2,
|
||||
MUX_9548_6_CH3,
|
||||
MUX_9548_6_CH4,
|
||||
MUX_9548_6_CH5,
|
||||
MUX_9548_6_CH6,
|
||||
MUX_9548_6_CH7,
|
||||
MUX_9548_7_CH0,
|
||||
MUX_9548_7_CH1,
|
||||
MUX_9548_7_CH2,
|
||||
MUX_9548_7_CH3,
|
||||
MUX_9548_7_CH4,
|
||||
MUX_9548_7_CH5,
|
||||
MUX_9548_7_CH6,
|
||||
MUX_9548_7_CH7,
|
||||
MUX_9548_8_CH0,
|
||||
MUX_9548_8_CH1,
|
||||
MUX_9548_8_CH2,
|
||||
MUX_9548_8_CH3,
|
||||
MUX_9548_8_CH4,
|
||||
MUX_9548_8_CH5,
|
||||
MUX_9548_8_CH6,
|
||||
MUX_9548_8_CH7,
|
||||
MUX_9548_9_CH0,
|
||||
MUX_9548_9_CH1,
|
||||
MUX_9548_9_CH2,
|
||||
MUX_9548_9_CH3,
|
||||
MUX_9548_9_CH4,
|
||||
MUX_9548_9_CH5,
|
||||
MUX_9548_9_CH6,
|
||||
MUX_9548_9_CH7,
|
||||
MUX_9548_10_CH0,
|
||||
MUX_9548_10_CH1,
|
||||
MUX_9548_10_CH2,
|
||||
MUX_9548_10_CH3,
|
||||
MUX_9548_10_CH4,
|
||||
MUX_9548_10_CH5,
|
||||
MUX_9548_10_CH6,
|
||||
MUX_9548_10_CH7,
|
||||
};
|
||||
|
||||
#define I2C_ADDR_MUX_9555_0 (0x20)
|
||||
#define I2C_ADDR_MUX_9555_1 (0x24)
|
||||
#define I2C_ADDR_MUX_9555_2 (0x25)
|
||||
#define I2C_ADDR_MUX_9555_3 (0x26)
|
||||
#define I2C_ADDR_MUX_9539_0 (0x76)
|
||||
#define I2C_ADDR_MUX_9539_1 (0x76)
|
||||
#define I2C_BUS_FAN_STATUS (I2C_BUS_MAIN)
|
||||
#define I2C_BUS_SYS_LED (MUX_9548_1_CH1)
|
||||
#define I2C_BUS_PSU_STATUS (I2C_BUS_MAIN)
|
||||
#define I2C_ADDR_PSU_STATUS (I2C_ADDR_MUX_9555_2)
|
||||
|
||||
#define NUM_OF_I2C_MUX (11)
|
||||
#define NUM_OF_CPLD (5)
|
||||
#define NUM_OF_QSFP_PORT (64)
|
||||
#define NUM_OF_SFP_PORT (2)
|
||||
#define QSFP_EEPROM_I2C_ADDR (0x50)
|
||||
|
||||
enum gpio_reg {
|
||||
REG_PORT0_IN,
|
||||
REG_PORT1_IN,
|
||||
REG_PORT0_OUT,
|
||||
REG_PORT1_OUT,
|
||||
REG_PORT0_POL,
|
||||
REG_PORT1_POL,
|
||||
REG_PORT0_DIR,
|
||||
REG_PORT1_DIR,
|
||||
};
|
||||
|
||||
struct ing_i2c_board_info {
|
||||
int ch;
|
||||
int size;
|
||||
struct i2c_board_info *board_info;
|
||||
};
|
||||
|
||||
struct i2c_init_data {
|
||||
__u16 ch;
|
||||
__u16 addr;
|
||||
__u8 reg;
|
||||
__u8 value;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,18 @@
|
||||
[Unit]
|
||||
Description= This Platform Monitor service is to initialize platform and monitor platform.
|
||||
Before=platform-monitor.service
|
||||
After=sysinit.target
|
||||
Wants=fancontrol.service
|
||||
Wants=qsfp-monitor.service
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/i2c_init.sh
|
||||
KillSignal=SIGKILL
|
||||
SuccessExitStatus=SIGKILL
|
||||
|
||||
# Resource Limitations
|
||||
LimitCORE=infinity
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
from setuptools import setup
|
||||
os.listdir
|
||||
|
||||
setup(
|
||||
name='sonic_platform',
|
||||
version='1.0',
|
||||
description='Netberg Aurora 750 sonic platform API',
|
||||
|
||||
packages=['sonic_platform'],
|
||||
package_dir={'sonic_platform': 'sonic_platform'},
|
||||
|
||||
classifiers=[
|
||||
'Development Status :: 3 - Beta',
|
||||
'Environment :: Plugins',
|
||||
'Intended Audience :: Developers',
|
||||
'Intended Audience :: Information Technology',
|
||||
'Intended Audience :: System Administrators',
|
||||
'License :: OSI Approved :: Apache Software License',
|
||||
'Natural Language :: English',
|
||||
'Operating System :: POSIX :: Linux',
|
||||
'Programming Language :: Python :: 3.7',
|
||||
'Topic :: Utilities',
|
||||
],
|
||||
)
|
@ -0,0 +1,2 @@
|
||||
__all__ = ['chassis', 'eeprom', 'platform', 'psu', 'sfp']
|
||||
from . import platform
|
@ -0,0 +1,237 @@
|
||||
try:
|
||||
import re
|
||||
from sonic_platform_base.chassis_base import ChassisBase
|
||||
from sonic_platform.eeprom import Eeprom
|
||||
from sonic_platform.fan_drawer import FanDrawer
|
||||
from sonic_platform.psu import Psu
|
||||
from sonic_platform.sfp import Sfp
|
||||
from sonic_platform.thermal import Thermal
|
||||
from sonic_platform.component import Component
|
||||
from sonic_platform.watchdog import Watchdog
|
||||
from sonic_platform.event_monitor import EventMonitor
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/reboot-cause/"
|
||||
REBOOT_CAUSE_FILE = "reboot-cause.txt"
|
||||
PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt"
|
||||
monitor = None
|
||||
|
||||
|
||||
class Chassis(ChassisBase):
|
||||
|
||||
__num_of_fantrays = 4
|
||||
__num_of_psus = 2
|
||||
__num_of_sfps = 64
|
||||
__num_of_thermals = 11
|
||||
__num_of_components = 1
|
||||
|
||||
def __init__(self):
|
||||
ChassisBase.__init__(self)
|
||||
|
||||
# Initialize EEPROM
|
||||
self._eeprom = Eeprom()
|
||||
self._eeprom_data = self._eeprom.get_eeprom_data()
|
||||
|
||||
# Initialize FAN
|
||||
for index in range(self.__num_of_fantrays):
|
||||
fandrawer = FanDrawer(index)
|
||||
self._fan_drawer_list.append(fandrawer)
|
||||
self._fan_list.extend(fandrawer._fan_list)
|
||||
|
||||
# Initialize PSU
|
||||
for index in range(self.__num_of_psus):
|
||||
psu = Psu(index)
|
||||
self._psu_list.append(psu)
|
||||
self._fan_list.extend(psu._fan_list)
|
||||
|
||||
# Initialize SFP
|
||||
for index in range(self.__num_of_sfps):
|
||||
sfp = Sfp(index)
|
||||
self._sfp_list.append(sfp)
|
||||
|
||||
# Initialize THERMAL
|
||||
for index in range(self.__num_of_thermals):
|
||||
thermal = Thermal(index)
|
||||
self._thermal_list.append(thermal)
|
||||
|
||||
# Initialize COMPONENT
|
||||
for index in range(self.__num_of_components):
|
||||
component = Component(index)
|
||||
self._component_list.append(component)
|
||||
|
||||
# Initialize WATCHDOG
|
||||
self._watchdog = Watchdog()
|
||||
|
||||
def __read_txt_file(self, file_path):
|
||||
try:
|
||||
with open(file_path, 'r') as fd:
|
||||
data = fd.read()
|
||||
return data.strip()
|
||||
except IOError:
|
||||
pass
|
||||
return None
|
||||
|
||||
|
||||
##############################################
|
||||
# Device methods
|
||||
##############################################
|
||||
|
||||
|
||||
def get_name(self):
|
||||
"""
|
||||
Retrieves the name of the chassis
|
||||
Returns:
|
||||
string: The name of the chassis
|
||||
"""
|
||||
return self._eeprom.modelstr()
|
||||
|
||||
def get_presence(self):
|
||||
"""
|
||||
Retrieves the presence of the chassis
|
||||
Returns:
|
||||
bool: True if chassis is present, False if not
|
||||
"""
|
||||
return True
|
||||
|
||||
def get_model(self):
|
||||
"""
|
||||
Retrieves the model number (or part number) of the chassis
|
||||
Returns:
|
||||
string: Model/part number of chassis
|
||||
"""
|
||||
return self._eeprom.part_number_str()
|
||||
|
||||
def get_serial(self):
|
||||
"""
|
||||
Retrieves the serial number of the chassis
|
||||
Returns:
|
||||
string: Serial number of chassis
|
||||
"""
|
||||
return self._eeprom.serial_number_str()
|
||||
|
||||
def get_status(self):
|
||||
"""
|
||||
Retrieves the operational status of the chassis
|
||||
Returns:
|
||||
bool: A boolean value, True if chassis is operating properly
|
||||
False if not
|
||||
"""
|
||||
return True
|
||||
|
||||
##############################################
|
||||
# Chassis methods
|
||||
##############################################
|
||||
|
||||
def get_base_mac(self):
|
||||
"""
|
||||
Retrieves the base MAC address for the chassis
|
||||
|
||||
Returns:
|
||||
A string containing the MAC address in the format
|
||||
'XX:XX:XX:XX:XX:XX'
|
||||
"""
|
||||
return self._eeprom.base_mac_addr(self._eeprom_data)
|
||||
|
||||
def get_serial_number(self):
|
||||
"""
|
||||
Retrieves the hardware serial number for the chassis
|
||||
|
||||
Returns:
|
||||
A string containing the hardware serial number for this chassis.
|
||||
"""
|
||||
return self._eeprom.serial_number_str()
|
||||
|
||||
def get_system_eeprom_info(self):
|
||||
"""
|
||||
Retrieves the full content of system EEPROM information for the chassis
|
||||
|
||||
Returns:
|
||||
A dictionary where keys are the type code defined in
|
||||
OCP ONIE TlvInfo EEPROM format and values are their corresponding
|
||||
values.
|
||||
Ex. { '0x21':'AG9064', '0x22':'V1.0', '0x23':'AG9064-0109867821',
|
||||
'0x24':'001c0f000fcd0a', '0x25':'02/03/2018 16:22:00',
|
||||
'0x26':'01', '0x27':'REV01', '0x28':'AG9064-C2358-16G'}
|
||||
"""
|
||||
return self._eeprom.system_eeprom_info()
|
||||
|
||||
def get_reboot_cause(self):
|
||||
"""
|
||||
Retrieves the cause of the previous reboot
|
||||
Returns:
|
||||
A tuple (string, string) where the first element is a string
|
||||
containing the cause of the previous reboot. This string must be
|
||||
one of the predefined strings in this class. If the first string
|
||||
is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used
|
||||
to pass a description of the reboot cause.
|
||||
"""
|
||||
description = 'None'
|
||||
reboot_cause = self.REBOOT_CAUSE_HARDWARE_OTHER
|
||||
|
||||
reboot_cause_path = PMON_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE
|
||||
prev_reboot_cause_path = PMON_REBOOT_CAUSE_PATH + PREV_REBOOT_CAUSE_FILE
|
||||
|
||||
sw_reboot_cause = self.__read_txt_file(reboot_cause_path) or "Unknown"
|
||||
prev_sw_reboot_cause = self.__read_txt_file(
|
||||
prev_reboot_cause_path) or "Unknown"
|
||||
|
||||
if sw_reboot_cause == "Unknown" and prev_sw_reboot_cause in ("Unknown", self.REBOOT_CAUSE_POWER_LOSS):
|
||||
reboot_cause = self.REBOOT_CAUSE_POWER_LOSS
|
||||
description = prev_sw_reboot_cause
|
||||
elif sw_reboot_cause != "Unknown":
|
||||
reboot_cause = self.REBOOT_CAUSE_NON_HARDWARE
|
||||
description = sw_reboot_cause
|
||||
elif prev_reboot_cause_path != "Unknown":
|
||||
reboot_cause = self.REBOOT_CAUSE_NON_HARDWARE
|
||||
description = prev_sw_reboot_cause
|
||||
|
||||
return (reboot_cause, description)
|
||||
|
||||
def get_change_event(self, timeout=0):
|
||||
"""
|
||||
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.
|
||||
"""
|
||||
global monitor
|
||||
port_dict = {}
|
||||
while True:
|
||||
with EventMonitor(timeout) as monitor:
|
||||
while True:
|
||||
event = monitor.get_events()
|
||||
|
||||
if not bool(event):
|
||||
return True, {'sfp': port_dict}
|
||||
else:
|
||||
if event['SUBSYSTEM'] == 'swps':
|
||||
portname = event['DEVPATH'].split("/")[-1]
|
||||
rc = re.match(r"port(?P<num>\d+)", portname)
|
||||
if rc is not None:
|
||||
if event['ACTION'] == "remove":
|
||||
remove_num = int(rc.group("num"))
|
||||
port_dict[remove_num] = "0"
|
||||
elif event['ACTION'] == "add":
|
||||
add_num = int(rc.group("num"))
|
||||
port_dict[add_num] = "1"
|
||||
return True, {'sfp': port_dict}
|
||||
return False, {'sfp': port_dict}
|
||||
else:
|
||||
pass
|
@ -0,0 +1,106 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
try:
|
||||
import os
|
||||
import subprocess
|
||||
import logging
|
||||
from sonic_platform_base.component_base import ComponentBase
|
||||
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
|
||||
OS_SYSTEM_SUCCESS = 0
|
||||
|
||||
MAIN_BIOS_INDEX = 0
|
||||
|
||||
COMPONENT_NAME_LIST = [
|
||||
"Main BIOS",
|
||||
]
|
||||
|
||||
COMPONENT_DESC_LIST = [
|
||||
"Main BIOS",
|
||||
]
|
||||
|
||||
|
||||
class Component(ComponentBase):
|
||||
|
||||
def __get_attr_value(self, attr_path):
|
||||
|
||||
retval = 'ERR'
|
||||
if not os.path.isfile(attr_path):
|
||||
return retval
|
||||
|
||||
try:
|
||||
with open(attr_path, 'r') as fd:
|
||||
retval = fd.read()
|
||||
except Exception as error:
|
||||
logging.error("Unable to open file: %s", attr_path)
|
||||
|
||||
retval = retval.rstrip(' \t\n\r')
|
||||
return retval
|
||||
|
||||
def __set_attr_value(self, attr_path, value):
|
||||
try:
|
||||
with open(attr_path, 'r+') as reg_file:
|
||||
reg_file.write(value)
|
||||
except IOError as e:
|
||||
logging.error("Error: unable to open file: %s", str(e))
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def __get_bios_version(self):
|
||||
"""
|
||||
Retrieves the firmware version of the BIOS
|
||||
Returns:
|
||||
A string containing the firmware version of the BIOS
|
||||
"""
|
||||
try:
|
||||
cmd = ['dmidecode', '-s', 'bios-version']
|
||||
if os.geteuid() != 0:
|
||||
cmd.insert(0, 'sudo')
|
||||
return subprocess.check_output(cmd).strip().decode()
|
||||
except subprocess.CalledProcessError as e:
|
||||
raise RuntimeError("Failed to get BIOS version")
|
||||
|
||||
__get_version_callback_list = {
|
||||
MAIN_BIOS_INDEX: __get_bios_version,
|
||||
}
|
||||
|
||||
def __init__(self, component_index):
|
||||
self.index = component_index
|
||||
|
||||
def get_name(self):
|
||||
"""
|
||||
Retrieves the name of the component
|
||||
Returns:
|
||||
A string containing the name of the component
|
||||
"""
|
||||
return COMPONENT_NAME_LIST[self.index]
|
||||
|
||||
def get_description(self):
|
||||
"""
|
||||
Retrieves the description of the component
|
||||
Returns:
|
||||
A string containing the description of the component
|
||||
"""
|
||||
return COMPONENT_DESC_LIST[self.index]
|
||||
|
||||
def get_firmware_version(self):
|
||||
"""
|
||||
Retrieves the firmware version of the component
|
||||
Returns:
|
||||
A string containing the firmware version of the component
|
||||
"""
|
||||
return self.__get_version_callback_list[self.index](self)
|
||||
|
||||
def install_firmware(self, image_path):
|
||||
"""
|
||||
Installs firmware to the component
|
||||
Args:
|
||||
image_path: A string, path to firmware image
|
||||
Returns:
|
||||
A boolean, True if install was successful, False if not
|
||||
"""
|
||||
return self.__install_firmware_callback_list[self.index](self, image_path)
|
@ -0,0 +1,114 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
try:
|
||||
import sys
|
||||
import re
|
||||
if sys.version_info.major == 3:
|
||||
from io import StringIO
|
||||
else:
|
||||
from cStringIO import StringIO
|
||||
# from sonic_platform_base.sonic_eeprom import eeprom_dts
|
||||
from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
|
||||
class Eeprom(eeprom_tlvinfo.TlvInfoDecoder):
|
||||
|
||||
EEPROM_DECODE_HEADLINES = 6
|
||||
|
||||
def __init__(self):
|
||||
self._eeprom_path = "/sys/bus/i2c/devices/0-0055/eeprom"
|
||||
super(Eeprom, self).__init__(self._eeprom_path, 0, '', True)
|
||||
self._eeprom = self._load_eeprom()
|
||||
|
||||
def __parse_output(self, decode_output):
|
||||
decode_output.replace('\0', '')
|
||||
lines = decode_output.split('\n')
|
||||
lines = lines[self.EEPROM_DECODE_HEADLINES:]
|
||||
_eeprom_info_dict = dict()
|
||||
|
||||
for line in lines:
|
||||
match = re.search(
|
||||
r'(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)([\S]+)', line)
|
||||
if match is not None:
|
||||
idx = match.group(1)
|
||||
value = match.group(3).rstrip('\0')
|
||||
_eeprom_info_dict[idx] = value
|
||||
return _eeprom_info_dict
|
||||
|
||||
def _load_eeprom(self):
|
||||
original_stdout = sys.stdout
|
||||
sys.stdout = StringIO()
|
||||
err = self.read_eeprom_db()
|
||||
if err:
|
||||
pass
|
||||
else:
|
||||
decode_output = sys.stdout.getvalue()
|
||||
sys.stdout = original_stdout
|
||||
return self.__parse_output(decode_output)
|
||||
|
||||
status = self.check_status()
|
||||
if status < 'ok':
|
||||
return {}
|
||||
|
||||
data = self.read_eeprom()
|
||||
if data is None:
|
||||
return 0
|
||||
|
||||
self.decode_eeprom(data)
|
||||
decode_output = sys.stdout.getvalue()
|
||||
sys.stdout = original_stdout
|
||||
|
||||
is_valid = self.is_checksum_valid(data)
|
||||
if not is_valid:
|
||||
return {}
|
||||
|
||||
return self.__parse_output(decode_output)
|
||||
|
||||
def get_eeprom(self):
|
||||
return self._eeprom
|
||||
|
||||
def serial_number_str(self):
|
||||
"""
|
||||
Returns the serial number
|
||||
"""
|
||||
return self._eeprom.get('0x23', "Undefined.")
|
||||
|
||||
def base_mac_addr(self, ee):
|
||||
"""
|
||||
Returns the base mac address found in the system EEPROM
|
||||
"""
|
||||
return self._eeprom.get('0x24', "Undefined.")
|
||||
|
||||
def modelstr(self):
|
||||
"""
|
||||
Returns the Model name
|
||||
"""
|
||||
return self._eeprom.get('0x28', "Undefined.")
|
||||
|
||||
def part_number_str(self):
|
||||
"""
|
||||
Returns the part number
|
||||
"""
|
||||
return self._eeprom.get('0x22', "Undefined.")
|
||||
|
||||
def revision_str(self):
|
||||
"""
|
||||
Returns the device revision
|
||||
"""
|
||||
return self._eeprom.get('0x26', "Undefined.")
|
||||
|
||||
def serial_str(self):
|
||||
return self._eeprom.get('0x2F', "Undefined.")
|
||||
|
||||
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
|
||||
|
||||
def get_eeprom_data(self):
|
||||
return self._eeprom
|
@ -0,0 +1,95 @@
|
||||
#
|
||||
# event_monitor.py
|
||||
# Description: module to minitor events
|
||||
#
|
||||
|
||||
try:
|
||||
import socket
|
||||
from collections import OrderedDict
|
||||
import os
|
||||
except ImportError as e:
|
||||
raise ImportError("%s - required module not found" % str(e))
|
||||
|
||||
|
||||
NETLINK_KOBJECT_UEVENT = 15
|
||||
|
||||
|
||||
class EventMonitor:
|
||||
|
||||
def __init__(self, timeout):
|
||||
self.recieved_events = OrderedDict()
|
||||
self.socket = socket.socket(
|
||||
socket.AF_NETLINK, socket.SOCK_DGRAM, NETLINK_KOBJECT_UEVENT)
|
||||
self.timeout = timeout
|
||||
|
||||
def start(self):
|
||||
self.socket.bind((os.getpid(), -1))
|
||||
|
||||
if self.timeout == 0:
|
||||
self.socket.settimeout(None)
|
||||
else:
|
||||
self.socket.settimeout(self.timeout/1000.0)
|
||||
|
||||
def stop(self):
|
||||
self.socket.close()
|
||||
|
||||
def __enter__(self):
|
||||
self.start()
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
self.stop()
|
||||
|
||||
def __iter__(self):
|
||||
while True:
|
||||
for item in self.next_events():
|
||||
yield item
|
||||
|
||||
def next_events(self):
|
||||
try:
|
||||
data = self.socket.recv(16384)
|
||||
event = {}
|
||||
for item in data.split(b'\x00'):
|
||||
if not item:
|
||||
# check if we have an event and if we already received it
|
||||
if event and event['SEQNUM'] not in self.recieved_events:
|
||||
self.recieved_events[event['SEQNUM']] = None
|
||||
if len(self.recieved_events) > 100:
|
||||
self.recieved_events.popitem(last=False)
|
||||
yield event
|
||||
event = {}
|
||||
else:
|
||||
try:
|
||||
k, v = item.split(b'=', 1)
|
||||
event[k.decode('ascii')] = v.decode('ascii')
|
||||
except ValueError:
|
||||
pass
|
||||
except socket.timeout:
|
||||
yield event
|
||||
|
||||
def get_events(self):
|
||||
event = {}
|
||||
while True:
|
||||
try:
|
||||
data = self.socket.recv(16384)
|
||||
|
||||
for item in data.split(b'\x00'):
|
||||
if not item:
|
||||
# check if we have an event and if we already received it
|
||||
# if no item and event empty, means received garbled
|
||||
if bool(event):
|
||||
if event['SEQNUM'] not in self.recieved_events:
|
||||
self.recieved_events[event['SEQNUM']] = None
|
||||
if len(self.recieved_events) > 100:
|
||||
self.recieved_events.popitem(last=False)
|
||||
return event
|
||||
else:
|
||||
event = {}
|
||||
else:
|
||||
try:
|
||||
k, v = item.split(b'=', 1)
|
||||
event[k] = v
|
||||
except ValueError:
|
||||
pass
|
||||
except socket.timeout:
|
||||
return event
|
@ -0,0 +1,216 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Name: fan.py, version: 1.0
|
||||
#
|
||||
# Description: Module contains the definitions of SONiC platform APIs
|
||||
#
|
||||
|
||||
try:
|
||||
import logging
|
||||
import os
|
||||
from sonic_platform_base.fan_base import FanBase
|
||||
from sonic_py_common.logger import Logger
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
MAX_FAN_RPM = 22000
|
||||
MAX_PSU_FAN_RPM = 18000
|
||||
|
||||
MAX_PWM_OF_FAN = 255
|
||||
|
||||
|
||||
FAN_SYS_FS = "/sys/bus/i2c/devices/16-002f/fan{}_input"
|
||||
FAN_ALARM_SYS_FS = "/sys/bus/i2c/devices/16-002f/fan{}_alarm"
|
||||
|
||||
PSU_FAN_SYS_FS = "/sys/class/hwmon/hwmon{}/fan1_input"
|
||||
PSU_FAN_ALARM_SYS_FS = "/sys/class/hwmon/hwmon{}/fan1_alarm"
|
||||
|
||||
|
||||
logger = Logger('sonic-platform-fan')
|
||||
|
||||
|
||||
class Fan(FanBase):
|
||||
|
||||
def __init__(self, index, psu_fan=False):
|
||||
self.__psu_fan = psu_fan
|
||||
|
||||
if psu_fan:
|
||||
self.__index = index
|
||||
self.__rpm = PSU_FAN_SYS_FS.format(9 + self.__index)
|
||||
self.__alarm = PSU_FAN_ALARM_SYS_FS.format(9 + self.__index)
|
||||
else:
|
||||
self.__index = 1 + 2*index
|
||||
self.__rpm = FAN_SYS_FS.format(self.__index)
|
||||
self.__alarm = FAN_ALARM_SYS_FS.format(self.__index)
|
||||
|
||||
def __get_attr_value(self, attr_path):
|
||||
|
||||
retval = 'ERR'
|
||||
if not os.path.isfile(attr_path):
|
||||
return retval
|
||||
|
||||
try:
|
||||
with open(attr_path, 'r') as fd:
|
||||
retval = fd.read()
|
||||
except Exception as error:
|
||||
logging.error("Unable to open file: %s", attr_path)
|
||||
|
||||
retval = retval.rstrip(' \t\n\r')
|
||||
return retval
|
||||
|
||||
|
||||
##############################################
|
||||
# Device methods
|
||||
##############################################
|
||||
|
||||
def get_name(self):
|
||||
"""
|
||||
Retrieves the name of the device
|
||||
|
||||
Returns:
|
||||
string: The name of the device
|
||||
"""
|
||||
return "FAN{}".format(self.__index) if not self.__psu_fan else "PSU{}_FAN".format(self.__index+1)
|
||||
|
||||
def get_presence(self):
|
||||
"""
|
||||
Retrieves the presence of the device
|
||||
|
||||
Returns:
|
||||
bool: True if device is present, False if not
|
||||
"""
|
||||
return self.get_status()
|
||||
|
||||
def get_model(self):
|
||||
"""
|
||||
Retrieves the model number (or part number) of the device
|
||||
|
||||
Returns:
|
||||
string: Model/part number of device
|
||||
"""
|
||||
return 'N/A'
|
||||
|
||||
def get_serial(self):
|
||||
"""
|
||||
Retrieves the serial number of the device
|
||||
|
||||
Returns:
|
||||
string: Serial number of device
|
||||
"""
|
||||
return 'N/A'
|
||||
|
||||
def get_status(self):
|
||||
"""
|
||||
Retrieves the operational status of the device
|
||||
|
||||
Returns:
|
||||
A boolean value, True if device is operating properly, False if not
|
||||
"""
|
||||
status = False
|
||||
|
||||
rv = self.__get_attr_value(self.__alarm)
|
||||
if rv != 'ERR':
|
||||
if rv == '0':
|
||||
status = True
|
||||
else:
|
||||
raise SyntaxError
|
||||
|
||||
return status
|
||||
|
||||
def is_replaceable(self):
|
||||
"""
|
||||
Indicate whether Fan is replaceable.
|
||||
Returns:
|
||||
bool: True if it is replaceable.
|
||||
"""
|
||||
return False
|
||||
|
||||
def get_position_in_parent(self):
|
||||
return self.__index
|
||||
|
||||
|
||||
##############################################
|
||||
# FAN methods
|
||||
##############################################
|
||||
|
||||
def get_direction(self):
|
||||
"""
|
||||
Retrieves the direction of fan
|
||||
|
||||
Returns:
|
||||
A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST
|
||||
depending on fan direction
|
||||
"""
|
||||
return 'N/A'
|
||||
|
||||
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 = 44
|
||||
rv = self.__get_attr_value(self.__rpm)
|
||||
|
||||
if rv != 'ERR':
|
||||
speed = int(
|
||||
rv) * 100 // (MAX_PSU_FAN_RPM if self.__psu_fan else MAX_FAN_RPM)
|
||||
|
||||
return speed
|
||||
|
||||
def get_target_speed(self):
|
||||
"""
|
||||
Retrieves the target (expected) speed of the fan
|
||||
|
||||
Returns:
|
||||
An integer, the percentage of full fan speed, in the range 0 (off)
|
||||
to 100 (full speed)
|
||||
"""
|
||||
return self.get_speed()
|
||||
|
||||
def get_speed_tolerance(self):
|
||||
"""
|
||||
Retrieves the speed tolerance of the fan
|
||||
|
||||
Returns:
|
||||
An integer, the percentage of variance from target speed which is
|
||||
considered tolerable
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
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
|
||||
"""
|
||||
return False
|
||||
|
||||
def set_status_led(self, color):
|
||||
"""
|
||||
Sets the state of the fan module status LED
|
||||
|
||||
Args:
|
||||
color: A string representing the color with which to set the
|
||||
fan module status LED
|
||||
|
||||
Returns:
|
||||
bool: True if status LED state is set successfully, False if not
|
||||
"""
|
||||
return False
|
||||
|
||||
def get_status_led(self):
|
||||
"""
|
||||
Gets the state of the fan status LED
|
||||
|
||||
Returns:
|
||||
A string, one of the predefined STATUS_LED_COLOR_* strings above
|
||||
"""
|
||||
return None
|
@ -0,0 +1,22 @@
|
||||
try:
|
||||
from sonic_platform_base.fan_drawer_base import FanDrawerBase
|
||||
from sonic_platform.fan import Fan
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
|
||||
class FanDrawer(FanDrawerBase):
|
||||
""" Platform-specific Fan class"""
|
||||
|
||||
def __init__(self, fantray_index):
|
||||
FanDrawerBase.__init__(self)
|
||||
self.fantray_index = fantray_index
|
||||
self._fan_list.append(Fan(fantray_index))
|
||||
|
||||
def get_name(self):
|
||||
"""
|
||||
Retrieves the fan drawer name
|
||||
Returns:
|
||||
string: The name of the device
|
||||
"""
|
||||
return "FanTray{}".format(self.fantray_index+1)
|
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Name: platform.py, version: 1.0
|
||||
#
|
||||
# Description: Module contains the definitions of SONiC platform APIs
|
||||
#
|
||||
|
||||
|
||||
try:
|
||||
from sonic_platform_base.platform_base import PlatformBase
|
||||
from sonic_platform.chassis import Chassis
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
|
||||
class Platform(PlatformBase):
|
||||
|
||||
def __init__(self):
|
||||
PlatformBase.__init__(self)
|
||||
self._chassis = Chassis()
|
@ -0,0 +1,314 @@
|
||||
try:
|
||||
from sonic_platform_base.psu_base import PsuBase
|
||||
from sonic_py_common.logger import Logger
|
||||
from sonic_platform.fan import Fan
|
||||
import subprocess
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
VOLTAGE_HIGH_THRESHOLD = 13.4
|
||||
VOLTAGE_LOW_THRESHOLD = 10.2
|
||||
TEMPERATURE_HIGH_THRESHOLD = 70.0
|
||||
MAX_SUPPLIED_POWER = 550.0
|
||||
|
||||
GPIO_OFFSET = 512 + 256
|
||||
|
||||
PSU_SYS_FS = "/sys/class/hwmon/hwmon{}/"
|
||||
|
||||
PSU_EEPROM = "/sys/bus/i2c/devices/{}-0050/eeprom"
|
||||
|
||||
logger = Logger('sonic-platform-psu')
|
||||
|
||||
|
||||
class Psu(PsuBase):
|
||||
|
||||
__name_of_psus = ['PSU1', 'PSU2']
|
||||
|
||||
def __init__(self, index):
|
||||
PsuBase.__init__(self)
|
||||
|
||||
self.__index = index
|
||||
|
||||
psun_sys_fs = PSU_SYS_FS.format(9 + self.__index)
|
||||
|
||||
# /sys/bus/i2c/devices/i2c-57/57-0058/hwmon/hwmon8/in2_input
|
||||
self.__psu_voltage_out_attr = psun_sys_fs + "in2_input"
|
||||
|
||||
# /sys/bus/i2c/devices/i2c-57/57-0058/hwmon/hwmon8/curr2_input
|
||||
self.__psu_current_out_attr = psun_sys_fs + "curr2_input"
|
||||
|
||||
# /sys/bus/i2c/devices/i2c-57/57-0058/hwmon/hwmon8/power2_input
|
||||
self.__psu_power_out_attr = psun_sys_fs + "power2_input"
|
||||
|
||||
# /sys/bus/i2c/devices/i2c-57/57-0058/hwmon/hwmon8/temp2_input
|
||||
self.__psu_temperature_attr = psun_sys_fs + "temp2_input"
|
||||
|
||||
self.__psu_eeprom_attr = PSU_EEPROM.format(17 + index)
|
||||
|
||||
self._fan_list.append(Fan(index=self.__index, psu_fan=True))
|
||||
|
||||
def __eeprom_read_bytes(self, start, end):
|
||||
try:
|
||||
val = open(self.__psu_eeprom_attr, "rb").read()[start:end]
|
||||
except Exception:
|
||||
val = None
|
||||
return val.decode('ascii')
|
||||
|
||||
def __get_attr_value(self, filepath):
|
||||
|
||||
# logger.log_error("openning: {}".format(filepath))
|
||||
try:
|
||||
with open(filepath, 'r') as fd:
|
||||
# text
|
||||
data = fd.readlines()
|
||||
return data[0].rstrip('\r\n')
|
||||
except FileNotFoundError:
|
||||
logger.log_error(f"File {filepath} not found. Aborting")
|
||||
except (OSError, IOError) as ex:
|
||||
logger.log_error("Cannot open - {}: {}".format(filepath, repr(ex)))
|
||||
|
||||
return 'ERR'
|
||||
##############################################
|
||||
# Device methods
|
||||
##############################################
|
||||
|
||||
def get_name(self):
|
||||
"""
|
||||
Retrieves the name of the device
|
||||
|
||||
Returns:
|
||||
string: The name of the device
|
||||
"""
|
||||
return self.__name_of_psus[self.__index]
|
||||
|
||||
def get_presence(self):
|
||||
"""
|
||||
Retrieves the presence of the device
|
||||
|
||||
Returns:
|
||||
bool: True if device is present, False if not
|
||||
"""
|
||||
presence = False
|
||||
|
||||
if self.get_model is not None:
|
||||
presence = True
|
||||
|
||||
return presence
|
||||
|
||||
def get_model(self):
|
||||
"""
|
||||
Retrieves the model number (or part number) of the device
|
||||
|
||||
Returns:
|
||||
string: Model/part number of device
|
||||
"""
|
||||
return self.__eeprom_read_bytes(20, 40)
|
||||
|
||||
def get_serial(self):
|
||||
"""
|
||||
Retrieves the serial number of the device
|
||||
|
||||
Returns:
|
||||
string: Serial number of device
|
||||
"""
|
||||
return self.__eeprom_read_bytes(61, 80)
|
||||
|
||||
def get_revision(self):
|
||||
"""
|
||||
Retrieves the hardware revision of the device
|
||||
|
||||
Returns:
|
||||
string: Revision value of device
|
||||
"""
|
||||
return self.__eeprom_read_bytes(57, 59)
|
||||
|
||||
def get_status(self):
|
||||
"""
|
||||
Retrieves the operational status of the device
|
||||
|
||||
Returns:
|
||||
A boolean value, True if device is operating properly, False if not
|
||||
"""
|
||||
return self.get_presence()
|
||||
|
||||
def is_replaceable(self):
|
||||
"""
|
||||
Indicate whether this device is replaceable.
|
||||
Returns:
|
||||
bool: True if it is replaceable.
|
||||
"""
|
||||
return True
|
||||
|
||||
##############################################
|
||||
# PSU methods
|
||||
##############################################
|
||||
|
||||
def get_voltage(self):
|
||||
"""
|
||||
Retrieves current PSU voltage output
|
||||
|
||||
Returns:
|
||||
A float number, the output voltage in volts,
|
||||
e.g. 12.1
|
||||
"""
|
||||
attr_path = self.__psu_voltage_out_attr
|
||||
|
||||
attr_rv = self.__get_attr_value(attr_path)
|
||||
if attr_rv != 'ERR':
|
||||
voltage_out = float(attr_rv) / 1000
|
||||
else:
|
||||
raise SyntaxError
|
||||
|
||||
return voltage_out
|
||||
|
||||
def get_input_voltage(self):
|
||||
return self.get_voltage()
|
||||
|
||||
def get_current(self):
|
||||
"""
|
||||
Retrieves present electric current supplied by PSU
|
||||
|
||||
Returns:
|
||||
A float number, the electric current in amperes, e.g 15.4
|
||||
"""
|
||||
attr_path = self.__psu_current_out_attr
|
||||
|
||||
attr_rv = self.__get_attr_value(attr_path)
|
||||
if attr_rv != 'ERR':
|
||||
current_out = float(attr_rv) / 1000
|
||||
else:
|
||||
raise SyntaxError
|
||||
|
||||
return current_out
|
||||
|
||||
def get_input_current(self):
|
||||
return self.get_current()
|
||||
|
||||
def get_power(self):
|
||||
"""
|
||||
Retrieves current energy supplied by PSU
|
||||
|
||||
Returns:
|
||||
A float number, the power in watts, e.g. 302.6
|
||||
"""
|
||||
attr_path = self.__psu_power_out_attr
|
||||
|
||||
attr_rv = self.__get_attr_value(attr_path)
|
||||
if attr_rv != 'ERR':
|
||||
power_out = float(attr_rv) / 1000000
|
||||
else:
|
||||
raise SyntaxError
|
||||
|
||||
return power_out
|
||||
|
||||
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
|
||||
"""
|
||||
attr_rv = self.__get_attr_value(self.__psu_temperature_attr)
|
||||
if attr_rv != 'ERR':
|
||||
temperature = float(attr_rv) / 1000
|
||||
else:
|
||||
raise SyntaxError
|
||||
|
||||
return temperature
|
||||
|
||||
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.
|
||||
"""
|
||||
powergood_status = False
|
||||
voltage_out = self.get_voltage()
|
||||
|
||||
# Check the voltage out with 12V, plus or minus 20 percentage.
|
||||
if self.get_voltage_low_threshold() <= voltage_out <= self.get_voltage_high_threshold():
|
||||
powergood_status = True
|
||||
|
||||
return powergood_status
|
||||
|
||||
def get_voltage_high_threshold(self):
|
||||
"""
|
||||
Retrieves the high threshold PSU voltage output
|
||||
Returns:
|
||||
A float number, the high threshold output voltage in volts,
|
||||
e.g. 12.1
|
||||
"""
|
||||
return VOLTAGE_HIGH_THRESHOLD
|
||||
|
||||
def get_voltage_low_threshold(self):
|
||||
"""
|
||||
Retrieves the low threshold PSU voltage output
|
||||
Returns:
|
||||
A float number, the low threshold output voltage in volts,
|
||||
e.g. 12.1
|
||||
"""
|
||||
return VOLTAGE_LOW_THRESHOLD
|
||||
|
||||
def get_temperature_high_threshold(self):
|
||||
"""
|
||||
Retrieves the high threshold temperature of PSU
|
||||
Returns:
|
||||
A float number, the high threshold temperature of PSU in Celsius
|
||||
up to nearest thousandth of one degree Celsius, e.g. 30.125
|
||||
"""
|
||||
return TEMPERATURE_HIGH_THRESHOLD
|
||||
|
||||
def get_maximum_supplied_power(self):
|
||||
"""
|
||||
Retrieves the maximum supplied power by PSU
|
||||
Returns:
|
||||
A float number, the maximum power output in Watts.
|
||||
e.g. 1200.1
|
||||
"""
|
||||
return MAX_SUPPLIED_POWER
|
||||
|
||||
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
|
||||
"""
|
||||
value = 0
|
||||
# PSU1: mask = 8
|
||||
# PSU2: mask = 16
|
||||
mask = 8 + 8 * self.__index
|
||||
|
||||
if color == self.STATUS_LED_COLOR_GREEN:
|
||||
value = 0x00
|
||||
elif color == self.STATUS_LED_COLOR_AMBER:
|
||||
value = 0xFF
|
||||
else:
|
||||
logger.log_error(
|
||||
"Invalid Parameters. LED Color {} doesn't support".format(color))
|
||||
return False
|
||||
|
||||
ret_val, log = subprocess.getstatusoutput(
|
||||
"i2cset -m {} -y -r 50 0x75 2 {}".format(mask, value))
|
||||
|
||||
if ret_val != 0:
|
||||
logger.log_error("Unable set PSU{} color with following i2cset output {} ".format(
|
||||
self.__index + 1, log))
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
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
|
||||
"""
|
||||
raise NotImplementedError
|
@ -0,0 +1,215 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
try:
|
||||
from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase
|
||||
from sonic_py_common.logger import Logger
|
||||
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
SFP_TYPE = "SFP"
|
||||
QSFP_TYPE = "QSFP"
|
||||
QSFP_DD_TYPE = "QSFP_DD"
|
||||
|
||||
CPLD_QSFP_STATUS_ABS_BIT=1
|
||||
CPLD_QSFP_PORT_CONFIG_RESET_BIT=0
|
||||
CPLD_QSFP_PORT_CONFIG_LPMODE_BIT=2
|
||||
|
||||
fp2phy_array=( 0, 1, 4, 5, 8, 9, 12, 13, 16, 17, 20, 21, 24, 25, 28, 29,
|
||||
32, 33, 36, 37, 40, 41, 44, 45, 48, 49, 52, 53, 56, 57, 60, 61,
|
||||
2, 3, 6, 7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27, 30, 31,
|
||||
34, 35, 38, 39, 42, 43, 46, 47, 50, 51, 54, 55, 58, 59, 62, 63)
|
||||
|
||||
EEPROM_PATH = "/sys/bus/i2c/devices/{}-0050/eeprom"
|
||||
|
||||
logger = Logger('sonic-platform-sfp')
|
||||
|
||||
class Sfp(SfpOptoeBase):
|
||||
"""
|
||||
BFN Platform-specific SFP class
|
||||
"""
|
||||
|
||||
def __init__(self, port_num):
|
||||
SfpOptoeBase.__init__(self)
|
||||
self.index = port_num
|
||||
self.port_num = port_num
|
||||
self.sfp_type = QSFP_TYPE
|
||||
|
||||
self.eeprom_path = self.__get_eeprom_path()
|
||||
self.cpld_status_path = self.__get_cpld_path("status")
|
||||
self.cpld_config_path = self.__get_cpld_path("config")
|
||||
logger.log_error(self.cpld_status_path)
|
||||
|
||||
def __get_cpld_path(self, sc):
|
||||
phy = fp2phy_array[self.index]+1
|
||||
cpld_index = phy // 13 + 1
|
||||
reg_port_base = 0 if cpld_index == 1 else 13 * (cpld_index - 1) - 1
|
||||
cpld_port_index = phy - reg_port_base
|
||||
return "/sys/bus/i2c/drivers/netberg_i2c_cpld/{}-0033/cpld_qsfp_port_{}_{}".format(cpld_index, sc, cpld_port_index)
|
||||
|
||||
def __get_eeprom_path(self):
|
||||
phy = fp2phy_array[self.index] + 1
|
||||
port_group = int(phy/8)
|
||||
eeprom_busbase = 41 + (port_group * 8)
|
||||
eeprom_busshift = phy%8
|
||||
eeprom_bus = eeprom_busbase + eeprom_busshift -1
|
||||
return EEPROM_PATH.format(eeprom_bus)
|
||||
|
||||
def __get_attr_value(self, filepath):
|
||||
try:
|
||||
with open(filepath, 'r') as fd:
|
||||
# text
|
||||
data = fd.readlines()
|
||||
return data[0].rstrip('\r\n')
|
||||
except FileNotFoundError:
|
||||
logger.log_error(f"File {filepath} not found. Aborting")
|
||||
except (OSError, IOError) as ex:
|
||||
logger.log_error("Cannot open - {}: {}".format(filepath, repr(ex)))
|
||||
|
||||
return 'ERR'
|
||||
|
||||
def get_presence(self):
|
||||
"""
|
||||
Retrieves the presence of the sfp
|
||||
"""
|
||||
presence = False
|
||||
|
||||
attr_rv = self.__get_attr_value(self.cpld_status_path)
|
||||
if attr_rv != 'ERR':
|
||||
if int(attr_rv, 16) & (1 << CPLD_QSFP_STATUS_ABS_BIT) == 0:
|
||||
presence = True
|
||||
else:
|
||||
raise SyntaxError
|
||||
|
||||
return presence
|
||||
|
||||
def get_lpmode(self):
|
||||
"""
|
||||
Retrieves the lpmode (low power mode) status of this SFP
|
||||
"""
|
||||
lpmode = False
|
||||
attr_rv = self.__get_attr_value(self.cpld_config_path)
|
||||
if attr_rv != 'ERR':
|
||||
if int(attr_rv, 16) & (1 << CPLD_QSFP_PORT_CONFIG_LPMODE_BIT) == 0:
|
||||
lpmode = True
|
||||
else:
|
||||
raise SyntaxError
|
||||
|
||||
return lpmode
|
||||
|
||||
def set_lpmode(self, lpmode):
|
||||
"""
|
||||
Sets the lpmode (low power mode) of SFP
|
||||
"""
|
||||
return False
|
||||
|
||||
def get_eeprom_path(self):
|
||||
return self.eeprom_path
|
||||
|
||||
def write_eeprom(self, offset, num_bytes, write_buffer):
|
||||
# Not supported at the moment
|
||||
return False
|
||||
|
||||
def get_name(self):
|
||||
"""
|
||||
Retrieves the name of the device
|
||||
Returns:
|
||||
string: The name of the device
|
||||
"""
|
||||
return "sfp{}".format(self.index)
|
||||
|
||||
def get_reset_status(self):
|
||||
"""
|
||||
Retrieves the reset status of SFP
|
||||
"""
|
||||
status = False
|
||||
attr_rv = self.__get_attr_value(self.cpld_config_path)
|
||||
if attr_rv != 'ERR':
|
||||
if int(attr_rv, 16) & (1 << CPLD_QSFP_PORT_CONFIG_RESET_BIT) == 0:
|
||||
status = True
|
||||
else:
|
||||
raise SyntaxError
|
||||
|
||||
return status
|
||||
|
||||
def reset(self):
|
||||
"""
|
||||
Reset SFP and return all user module settings to their default srate.
|
||||
"""
|
||||
return False
|
||||
|
||||
def get_status(self):
|
||||
"""
|
||||
Retrieves the operational status of the device
|
||||
"""
|
||||
reset = self.get_reset_status()
|
||||
|
||||
if reset:
|
||||
status = False
|
||||
else:
|
||||
status = True
|
||||
|
||||
return status
|
||||
|
||||
def get_position_in_parent(self):
|
||||
"""
|
||||
Retrieves 1-based relative physical position in parent device.
|
||||
Returns:
|
||||
integer: The 1-based relative physical position in parent
|
||||
device or -1 if cannot determine the position
|
||||
"""
|
||||
return self.index
|
||||
|
||||
def is_replaceable(self):
|
||||
"""
|
||||
Indicate whether this device is replaceable.
|
||||
Returns:
|
||||
bool: True if it is replaceable.
|
||||
"""
|
||||
return True
|
||||
|
||||
def get_error_description(self):
|
||||
"""
|
||||
Retrives the error descriptions of the SFP module
|
||||
Returns:
|
||||
String that represents the current error descriptions of vendor specific errors
|
||||
In case there are multiple errors, they should be joined by '|',
|
||||
like: "Bad EEPROM|Unsupported cable"
|
||||
"""
|
||||
if not self.get_presence():
|
||||
return self.SFP_STATUS_UNPLUGGED
|
||||
return self.SFP_STATUS_OK
|
||||
|
||||
def tx_disable(self, tx_disable):
|
||||
"""
|
||||
Disable SFP TX for all channels
|
||||
Args:
|
||||
tx_disable : A Boolean, True to enable tx_disable mode, False to disable
|
||||
tx_disable mode.
|
||||
Returns:
|
||||
A boolean, True if tx_disable is set successfully, False if not
|
||||
"""
|
||||
if self.sfp_type == QSFP_TYPE:
|
||||
return self.tx_disable_channel(0xF, tx_disable)
|
||||
return False
|
||||
|
||||
def tx_disable_channel(self, channel, disable):
|
||||
"""
|
||||
Sets the tx_disable for specified SFP channels
|
||||
|
||||
Args:
|
||||
channel : A hex of 4 bits (bit 0 to bit 3) which represent channel 0 to 3,
|
||||
e.g. 0x5 for channel 0 and channel 2.
|
||||
disable : A boolean, True to disable TX channels specified in channel,
|
||||
False to enable
|
||||
|
||||
Returns:
|
||||
A boolean, True if successful, False if not
|
||||
"""
|
||||
return False
|
||||
|
||||
def get_power_override(self):
|
||||
return False
|
||||
|
||||
def set_power_override(self, power_override, power_set):
|
||||
return False
|
@ -0,0 +1,216 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Name: thermal.py, version: 1.0
|
||||
#
|
||||
# Description: Module contains the definitions of SONiC platform APIs
|
||||
#
|
||||
|
||||
try:
|
||||
import os
|
||||
import logging
|
||||
from sonic_platform_base.thermal_base import ThermalBase
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
|
||||
class Thermal(ThermalBase):
|
||||
|
||||
__core_temp_path = "/sys/devices/platform/coretemp.0/hwmon/hwmon0/temp{}_{}"
|
||||
__switch_thermal_path = "/sys/class/hwmon/hwmon{}/temp{}_{}"
|
||||
__name_of_thermal = [
|
||||
"Core 0",
|
||||
"Core 1",
|
||||
"Core 2",
|
||||
"Core 3",
|
||||
"Core 4",
|
||||
"Rear Panel",
|
||||
"Rear MAC",
|
||||
"Front Panel",
|
||||
"Front MAC",
|
||||
"BMC board",
|
||||
"CPU board"
|
||||
]
|
||||
__thermal_path_list = [
|
||||
__core_temp_path.format(1, "input"),
|
||||
__core_temp_path.format(2, "input"),
|
||||
__core_temp_path.format(3, "input"),
|
||||
__core_temp_path.format(4, "input"),
|
||||
__core_temp_path.format(5, "input"),
|
||||
__switch_thermal_path.format(1, 1, "input"),
|
||||
__switch_thermal_path.format(2, 1, "input"),
|
||||
__switch_thermal_path.format(3, 1, "input"),
|
||||
__switch_thermal_path.format(5, 1, "input"),
|
||||
__switch_thermal_path.format(6, 1, "input"),
|
||||
__switch_thermal_path.format(7, 1, "input")
|
||||
]
|
||||
__max_temp_path_list = [
|
||||
__core_temp_path.format(1, "max"),
|
||||
__core_temp_path.format(2, "max"),
|
||||
__core_temp_path.format(3, "max"),
|
||||
__core_temp_path.format(4, "max"),
|
||||
__core_temp_path.format(5, "max"),
|
||||
__switch_thermal_path.format(1, 1, "max"),
|
||||
__switch_thermal_path.format(2, 1, "max"),
|
||||
__switch_thermal_path.format(3, 1, "max"),
|
||||
__switch_thermal_path.format(5, 1, "max"),
|
||||
__switch_thermal_path.format(6, 1, "max"),
|
||||
__switch_thermal_path.format(7, 1, "max")
|
||||
]
|
||||
|
||||
def __init__(self, index):
|
||||
self.__index = index
|
||||
|
||||
self.__thermal_temp_attr = self.__thermal_path_list[self.__index]
|
||||
self.__max_temp_attr = self.__max_temp_path_list[self.__index]
|
||||
|
||||
def __get_attr_value(self, attr_path):
|
||||
|
||||
retval = 'ERR'
|
||||
if not os.path.isfile(attr_path):
|
||||
return retval
|
||||
|
||||
try:
|
||||
with open(attr_path, 'r') as fd:
|
||||
retval = fd.read()
|
||||
except FileNotFoundError:
|
||||
logging.error("File %s not found. Aborting", attr_path)
|
||||
except (OSError, IOError) as ex:
|
||||
logging.error("Cannot open - %s: %s", attr_path, repr(ex))
|
||||
|
||||
retval = retval.rstrip(' \t\n\r')
|
||||
return retval
|
||||
|
||||
|
||||
##############################################
|
||||
# Device methods
|
||||
##############################################
|
||||
|
||||
|
||||
def get_name(self):
|
||||
"""
|
||||
Retrieves the name of the device
|
||||
|
||||
Returns:
|
||||
string: The name of the device
|
||||
"""
|
||||
return self.__name_of_thermal[self.__index]
|
||||
|
||||
def get_presence(self):
|
||||
"""
|
||||
Retrieves the presence of the device
|
||||
|
||||
Returns:
|
||||
bool: True if device is present, False if not
|
||||
"""
|
||||
attr_path = self.__thermal_temp_attr
|
||||
return os.path.isfile(attr_path)
|
||||
|
||||
def get_model(self):
|
||||
"""
|
||||
Retrieves the model number (or part number) of the device
|
||||
|
||||
Returns:
|
||||
string: Model/part number of device
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def get_serial(self):
|
||||
"""
|
||||
Retrieves the serial number of the device
|
||||
|
||||
Returns:
|
||||
string: Serial number of device
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
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 = False
|
||||
if self.get_presence():
|
||||
status = True
|
||||
|
||||
return status
|
||||
|
||||
##############################################
|
||||
# THERMAL methods
|
||||
##############################################
|
||||
|
||||
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
|
||||
"""
|
||||
attr_path = self.__thermal_temp_attr
|
||||
|
||||
attr_rv = self.__get_attr_value(attr_path)
|
||||
if attr_rv != 'ERR':
|
||||
temperature = float(attr_rv) / 1000
|
||||
else:
|
||||
raise SyntaxError
|
||||
|
||||
return temperature
|
||||
|
||||
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
|
||||
"""
|
||||
attr_path = self.__max_temp_attr
|
||||
|
||||
if attr_path == '':
|
||||
raise NotImplementedError
|
||||
else:
|
||||
attr_rv = self.__get_attr_value(attr_path)
|
||||
if attr_rv != 'ERR':
|
||||
high_threshold = float(attr_rv) / 1000
|
||||
else:
|
||||
raise SyntaxError
|
||||
|
||||
return high_threshold
|
||||
|
||||
def get_low_threshold(self):
|
||||
"""
|
||||
Retrieves the low threshold temperature of thermal
|
||||
|
||||
Returns:
|
||||
A float number, the low threshold temperature of thermal in Celsius
|
||||
up to nearest thousandth of one degree Celsius, e.g. 30.125
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def set_high_threshold(self, temperature):
|
||||
"""
|
||||
Sets the high threshold temperature of thermal
|
||||
|
||||
Args :
|
||||
temperature: A float number up to nearest thousandth of one degree Celsius,
|
||||
e.g. 30.125
|
||||
|
||||
Returns:
|
||||
A boolean, True if threshold is set successfully, False if not
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def set_low_threshold(self, temperature):
|
||||
"""
|
||||
Sets the low 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
|
||||
"""
|
||||
raise NotImplementedError
|
@ -0,0 +1,251 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
#############################################################################
|
||||
#
|
||||
# Module contains an implementation of SONiC Platform Base API and
|
||||
# provides the Watchdog information
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
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/"
|
||||
|
||||
|
||||
class Watchdog(WatchdogBase):
|
||||
|
||||
def __init__(self):
|
||||
|
||||
self.watchdog = None
|
||||
self.armed = False
|
||||
|
||||
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
|
||||
"""
|
||||
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
|
||||
wdt_main_dev_name = wdt_main_dev_list[0]
|
||||
watchdog_device_path = "/dev/{}".format(wdt_main_dev_name)
|
||||
try:
|
||||
watchdog = os.open(watchdog_device_path, os.O_RDWR)
|
||||
except (FileNotFoundError, IOError, OSError):
|
||||
watchdog = None
|
||||
except SystemExit:
|
||||
pass
|
||||
|
||||
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
|
||||
"""
|
||||
if self.watchdog is None:
|
||||
return WDT_COMMON_ERROR
|
||||
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
|
||||
"""
|
||||
if self.watchdog is None:
|
||||
return WDT_COMMON_ERROR
|
||||
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 _set_arm(self):
|
||||
self.watchdog, self.wdt_main_dev_name = self._get_wdt()
|
||||
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.timeout = self._gettimeout(self.timeout_path)
|
||||
|
||||
#################################################################
|
||||
|
||||
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.
|
||||
"""
|
||||
if self.watchdog is None:
|
||||
self._set_arm()
|
||||
|
||||
ret = WDT_COMMON_ERROR
|
||||
if seconds < 0 or self.watchdog is None:
|
||||
return ret
|
||||
|
||||
try:
|
||||
if self.timeout != seconds:
|
||||
self.timeout = self._settimeout(seconds)
|
||||
if self.armed:
|
||||
self._keepalive()
|
||||
else:
|
||||
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.watchdog is None:
|
||||
return disarmed
|
||||
|
||||
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.watchdog is None:
|
||||
return 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)
|
197
platform/barefoot/sonic-platform-modules-netberg/aurora-750/utils/i2c_init.sh
Executable file
197
platform/barefoot/sonic-platform-modules-netberg/aurora-750/utils/i2c_init.sh
Executable file
@ -0,0 +1,197 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
# vdd value for mac
|
||||
rov_val_array=( 0.85 0.82 0.77 0.87 0.74 0.84 0.79 0.89 )
|
||||
rov_reg_array=( 0x24 0x73 0x69 0x7D 0x63 0x77 0x6D 0x81 )
|
||||
|
||||
#GPIO Offset
|
||||
GPIO_OFFSET=768
|
||||
|
||||
# fp port to phy port mapping
|
||||
fp2phy_array=( 0 1 4 5 8 9 12 13 16 17 20 21 24 25 28 29
|
||||
32 33 36 37 40 41 44 45 48 49 52 53 56 57 60 61
|
||||
2 3 6 7 10 11 14 15 18 19 22 23 26 27 30 31
|
||||
34 35 38 39 42 43 46 47 50 51 54 55 58 59 62 63)
|
||||
|
||||
#IO Expander Init
|
||||
function _i2c_io_exp_init {
|
||||
# _i2c_hwm_init
|
||||
i2cset -y -r 16 0x2f 0x00 0x80
|
||||
i2cset -y -r 16 0x2f 0x01 0x9C
|
||||
i2cset -y -r 16 0x2f 0x04 0x00
|
||||
i2cset -y -r 16 0x2f 0x06 0xFF
|
||||
i2cset -y -r 16 0x2f 0x07 0x00
|
||||
i2cset -y -r 16 0x2f 0x01 0x1C
|
||||
i2cset -y -r 16 0x2f 0x00 0x82
|
||||
i2cset -y -r 16 0x2f 0x0F 0x00
|
||||
i2cset -y -r 16 0x2f 0x18 0x84
|
||||
i2cset -y -r 16 0x2f 0x19 0x84
|
||||
|
||||
# _i2c_io_exp_init
|
||||
# need to init BMC io expander first due to some io expander are reset default
|
||||
# Init BMC INT & HW ID IO Expander
|
||||
i2cset -y -r 0 0x24 6 0xFF
|
||||
i2cset -y -r 0 0x24 7 0xFF
|
||||
i2cset -y -r 0 0x24 4 0x00
|
||||
i2cset -y -r 0 0x24 5 0x00
|
||||
|
||||
# Init BMC PSU status IO Expander
|
||||
i2cset -y -r 0 0x25 6 0xFF
|
||||
i2cset -y -r 0 0x25 7 0xFF
|
||||
i2cset -y -r 0 0x25 4 0x00
|
||||
i2cset -y -r 0 0x25 5 0x00
|
||||
|
||||
# Init BMC RST and SEL IO Expander
|
||||
i2cset -y -r 0 0x26 2 0x3F
|
||||
i2cset -y -r 0 0x26 3 0x1F
|
||||
i2cset -y -r 0 0x26 6 0xD0
|
||||
i2cset -y -r 0 0x26 7 0x00
|
||||
i2cset -y -r 0 0x26 4 0x00
|
||||
i2cset -y -r 0 0x26 5 0x00
|
||||
|
||||
# Init System LED & HW ID IO Expander
|
||||
i2cset -y -r 10 0x76 2 0x00
|
||||
i2cset -y -r 10 0x76 6 0x00
|
||||
i2cset -y -r 10 0x76 7 0xFF
|
||||
i2cset -y -r 10 0x76 4 0x00
|
||||
i2cset -y -r 10 0x76 5 0x00
|
||||
|
||||
# Init FAN Board Status IO Expander
|
||||
i2cset -y -r 0 0x20 2 0x11
|
||||
i2cset -y -r 0 0x20 3 0x11
|
||||
i2cset -y -r 0 0x20 6 0xCC
|
||||
i2cset -y -r 0 0x20 7 0xCC
|
||||
i2cset -y -r 0 0x20 4 0x00
|
||||
i2cset -y -r 0 0x20 5 0x00
|
||||
|
||||
# Init System SEL and RST IO Expander
|
||||
i2cset -y -r 32 0x76 2 0x04
|
||||
i2cset -y -r 32 0x76 3 0xDF
|
||||
i2cset -y -r 32 0x76 6 0x09
|
||||
i2cset -y -r 32 0x76 7 0x3F
|
||||
i2cset -y -r 32 0x76 4 0x00
|
||||
i2cset -y -r 32 0x76 5 0x00
|
||||
}
|
||||
|
||||
function mac_vdd_init {
|
||||
# read mac vid register value from CPLD
|
||||
val=`cat /sys/bus/i2c/devices/1-0033/cpld_rov_status`
|
||||
|
||||
# get vid form register value [0:2]
|
||||
vid=$(($val & 0x7))
|
||||
|
||||
# get rov val and reg according to vid
|
||||
rov_val=${rov_val_array[$vid]}
|
||||
rov_reg=${rov_reg_array[$vid]}
|
||||
echo "vid=${vid}, rov_val=${rov_val}, rov_reg=${rov_reg}"
|
||||
|
||||
# write the rov reg to rov
|
||||
i2cset -y -r 15 0x76 0x21 ${rov_reg} w
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "set ROV for mac vdd done"
|
||||
else
|
||||
echo "set ROV for mac vdd fail"
|
||||
fi
|
||||
}
|
||||
|
||||
rmmod i2c_i801
|
||||
modprobe i2c_i801
|
||||
modprobe i2c_dev
|
||||
modprobe i2c_mux_pca954x
|
||||
echo 'pca9548 0x70' > /sys/bus/i2c/devices/i2c-0/new_device
|
||||
echo 'pca9548 0x73' > /sys/bus/i2c/devices/i2c-0/new_device
|
||||
echo 'pca9546 0x72' > /sys/bus/i2c/devices/i2c-0/new_device
|
||||
sleep 1
|
||||
#todo: switch to channels
|
||||
echo 'pca9548 0x71' > /sys/bus/i2c/devices/i2c-19/new_device
|
||||
echo 'pca9546 0x71' > /sys/bus/i2c/devices/i2c-20/new_device
|
||||
|
||||
echo 'pca9548 0x75' > /sys/bus/i2c/devices/i2c-0/new_device
|
||||
sleep 1
|
||||
for I in {21..28}
|
||||
do
|
||||
echo 'pca9548 0x74' > /sys/bus/i2c/devices/i2c-$I/new_device
|
||||
done
|
||||
|
||||
echo '-2' > /sys/bus/i2c/devices/0-0070/idle_state
|
||||
echo '-2' > /sys/bus/i2c/devices/0-0073/idle_state
|
||||
echo '-2' > /sys/bus/i2c/devices/0-0072/idle_state
|
||||
echo '-2' > /sys/bus/i2c/devices/19-0071/idle_state
|
||||
echo '-2' > /sys/bus/i2c/devices/20-0071/idle_state
|
||||
echo '-2' > /sys/bus/i2c/devices/0-0075/idle_state
|
||||
|
||||
for I in {21..28}
|
||||
do
|
||||
echo '-2' > /sys/bus/i2c/devices/$I-0074/idle_state
|
||||
done
|
||||
|
||||
_i2c_io_exp_init
|
||||
|
||||
# i2cget -y 44 0x74 2
|
||||
|
||||
echo 'w83795adg 0x2F' > /sys/bus/i2c/devices/i2c-16/new_device
|
||||
|
||||
#TMP75 Init
|
||||
echo "lm75 0x4D" > /sys/bus/i2c/devices/i2c-6/new_device # lm75_1 Rear Panel, hwmon2
|
||||
echo "lm75 0x4E" > /sys/bus/i2c/devices/i2c-6/new_device # lm75_2 Rear MAC, hwmon3
|
||||
echo "lm86 0x4C" > /sys/bus/i2c/devices/i2c-6/new_device # lm86 , hwmon4
|
||||
echo "lm75 0x4D" > /sys/bus/i2c/devices/i2c-7/new_device # lm75_3 Front Panel, hwmon5
|
||||
echo "lm75 0x4E" > /sys/bus/i2c/devices/i2c-7/new_device # lm75_4 Front MAC, hwmon6
|
||||
echo "lm75 0x4A" > /sys/bus/i2c/devices/i2c-16/new_device # tmp75 BMC board thermal, hwmon7
|
||||
echo "lm75 0x4F" > /sys/bus/i2c/devices/i2c-0/new_device # tmp75 CPU board thermal, hwmon8
|
||||
|
||||
|
||||
modprobe netberg_nba750_64x_i2c_cpld
|
||||
|
||||
for I in {1..5}
|
||||
do
|
||||
echo "netberg_cpld$I 0x33"> /sys/bus/i2c/devices/i2c-$I/new_device
|
||||
done
|
||||
|
||||
modprobe at24
|
||||
#Init MB EEPROM
|
||||
echo "24c32 0x55" > /sys/bus/i2c/devices/i2c-0/new_device
|
||||
|
||||
# modprobe eeprom
|
||||
# PS EEPROM
|
||||
echo "spd 0x50" > /sys/bus/i2c/devices/i2c-18/new_device #PS0
|
||||
echo "spd 0x50" > /sys/bus/i2c/devices/i2c-17/new_device #PS1
|
||||
|
||||
#modprobe pmbus
|
||||
|
||||
# PS PMBUS
|
||||
echo "pmbus 0x58" > /sys/bus/i2c/devices/i2c-18/new_device #PS0
|
||||
echo "pmbus 0x58" > /sys/bus/i2c/devices/i2c-17/new_device #PS1
|
||||
|
||||
modprobe optoe
|
||||
|
||||
#QSFP EEPROM
|
||||
for I in {1..64}
|
||||
do
|
||||
declare -i phy_port=${fp2phy_array[$I-1]}+1
|
||||
declare -i port_group=$phy_port/8
|
||||
declare -i eeprom_busbase=41+$port_group*8
|
||||
declare -i eeprom_busshift=$phy_port%8
|
||||
declare -i eeprom_bus=$eeprom_busbase+$eeprom_busshift-1
|
||||
echo "optoe1 0x50" > /sys/bus/i2c/devices/i2c-$eeprom_bus/new_device
|
||||
done
|
||||
|
||||
# init SFP0/1 EEPROM
|
||||
echo "sff8436 0x50" > /sys/bus/i2c/devices/i2c-29/new_device
|
||||
echo "sff8436 0x50" > /sys/bus/i2c/devices/i2c-30/new_device
|
||||
|
||||
sleep 1
|
||||
mac_vdd_init
|
||||
|
||||
# Set fan init speed
|
||||
echo 120 > /sys/bus/i2c/devices/i2c-16/16-002f/pwm1
|
||||
|
||||
# _util_port_led_clear
|
||||
i2cset -m 0x04 -y -r 32 0x76 2 0x0
|
||||
sleep 1
|
||||
i2cset -m 0x04 -y -r 32 0x76 2 0xFF
|
||||
|
||||
# turn on sys led
|
||||
i2cset -m 0x80 -y -r 10 0x76 2 0x80
|
@ -5,6 +5,10 @@ Maintainer: Netberg <support@netbergtw.com>
|
||||
Build-Depends: debhelper (>= 9)
|
||||
Standards-Version: 1.0.0
|
||||
|
||||
Package: sonic-platform-netberg-aurora-750
|
||||
Architecture: amd64
|
||||
Description: This package contains Aurora 750 platform driver utility for SONiC project.
|
||||
|
||||
Package: sonic-platform-netberg-aurora-710
|
||||
Architecture: amd64
|
||||
Description: This package contains Aurora 710 platform driver utility for SONiC project.
|
||||
|
@ -8,7 +8,7 @@ PACKAGE_PRE_NAME := sonic-platform-netberg
|
||||
KVERSION ?= $(shell uname -r)
|
||||
KERNEL_SRC := /lib/modules/$(KVERSION)
|
||||
MOD_SRC_DIR:= $(shell pwd)
|
||||
MODULE_DIRS:= aurora-610 aurora-710
|
||||
MODULE_DIRS:= aurora-610 aurora-710 aurora-750
|
||||
MODULE_DIR := modules
|
||||
UTILS_DIR := utils
|
||||
SERVICE_DIR := service
|
||||
|
@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: setup-board
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Should-Start:
|
||||
# Should-Stop:
|
||||
# Default-Start: S
|
||||
# Default-Stop: 0 6
|
||||
# Short-Description: Setup Aurora-750 board.
|
||||
### END INIT INFO
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Setting up board... "
|
||||
|
||||
depmod -a
|
||||
/usr/sbin/i2c_init.sh
|
||||
|
||||
echo "done."
|
||||
;;
|
||||
|
||||
stop)
|
||||
|
||||
echo "done."
|
||||
|
||||
;;
|
||||
|
||||
force-reload|restart)
|
||||
echo "Not supported"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: /etc/init.d/sonic-platform-netberg-aurora-750.init {start|stop}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
@ -0,0 +1 @@
|
||||
aurora-750/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-netberg_aurora_750-r0
|
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
PLATFORM_NAME=x86_64-netberg_aurora_750-r0
|
||||
SONIC_PLATFORM_WHEEL_PY3="/usr/share/sonic/device/${PLATFORM_NAME}/sonic_platform-1.0-py3-none-any.whl"
|
||||
python3 -m pip install ${SONIC_PLATFORM_WHEEL_PY3}
|
||||
|
||||
#DEBHELPER#
|
||||
|
Loading…
Reference in New Issue
Block a user