[Netberg][Barefoot] Added support for Aurora 710 (#15298)

* [202012][platform/barefoot] (#8543)

Why I did it
Pcied running by python 2.

How I did it
dropped python2 support and add python3 support for pcied in file docker-pmon.supervisord.conf.j2

How to verify it
docker exec pmon supervisorctl status

* [Netberg][nba710] Added initial support for Aurora 710

Signed-off-by: Andrew Sapronov <andrew.sapronov@gmail.com>

---------

Signed-off-by: Andrew Sapronov <andrew.sapronov@gmail.com>
Co-authored-by: Kostiantyn Yarovyi <kostiantynx.yarovyi@intel.com>
This commit is contained in:
Andrew Sapronov 2023-07-01 03:30:07 +03:00 committed by GitHub
parent b4a3711a95
commit c190a8f795
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
45 changed files with 3951 additions and 9 deletions

View File

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

View File

@ -0,0 +1,86 @@
{% 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,47) %}
{%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %}
{%- endfor %}
{% for port_idx in range(48,55) %}
{% if PORT.append("Ethernet%d" % (48 + ( port_idx - 48 )*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",
"xon":"18432",
"xoff":"18432"
},
"ingress_lossy_profile": {
"pool":"ingress_lossy_pool",
"size":"4096",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"egress_lossless_pool",
"size":"4096",
"dynamic_th":"7",
"xon":"18432",
"xoff":"18432"
},
"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_queue_buffers(port_names) %}
"BUFFER_QUEUE": {
{% for port in port_names.split(',') %}
"{{ port }}|0-2": {
"profile" : "q_lossy_profile"
},
{% endfor %}
{% for port in port_names.split(',') %}
"{{ port }}|3-4": {
"profile" : "egress_lossless_profile"
}{% if not loop.last %},{% endif %}
{% endfor %}
}
{%- endmacro %}

View File

@ -0,0 +1,86 @@
{% 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,47) %}
{%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %}
{%- endfor %}
{% for port_idx in range(48,55) %}
{% if PORT.append("Ethernet%d" % (48+(port_idx-48)*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",
"xon":"18432",
"xoff":"18432"
},
"ingress_lossy_profile": {
"pool":"ingress_lossy_pool",
"size":"4096",
"dynamic_th":"3"
},
"egress_lossless_profile": {
"pool":"egress_lossless_pool",
"size":"4096",
"dynamic_th":"7",
"xon":"18432",
"xoff":"18432"
},
"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_queue_buffers(port_names) %}
"BUFFER_QUEUE": {
{% for port in port_names.split(',') %}
"{{ port }}|0-2": {
"profile" : "q_lossy_profile"
},
{% endfor %}
{% for port in port_names.split(',') %}
"{{ port }}|3-4": {
"profile" : "egress_lossless_profile"
}{% if not loop.last %},{% endif %}
{% endfor %}
}
{%- endmacro %}

View File

@ -0,0 +1,164 @@
{
"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"
}
}
}

View File

@ -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

View File

@ -0,0 +1,33 @@
# 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

View File

@ -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' %}

View File

@ -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

View File

@ -0,0 +1,39 @@
{
"chip_list": [
{
"chip_family": "Tofino",
"sds_fw_path": "share/tofino_sds_fw/avago/firmware",
"instance": 0
}
],
"p4_devices": [
{
"device-id": 0,
"agent0": "lib/platform/x86_64-netberg_aurora_710-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",
"bfrt-config": "share/switch/bf-rt.json",
"model_json_path" : "share/switch/aug_model.json",
"switchapi_port_add": false,
"non_default_port_ppgs": 5
}
]
}
],
"switch_options": [
{
"device-id": 0,
"model_json_path": "share/switch/aug_model.json",
"non_default_port_ppgs": 5,
"switchapi_port_add": false
}
]
}

View File

@ -0,0 +1 @@
aurora-710 t1

View File

@ -0,0 +1,12 @@
# Configuration file generated by pwmconfig, changes will be lost
INTERVAL=10
DEVPATH=hwmon1=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-56/56-002f
DEVNAME=hwmon1=w83795adg
FCTEMPS=hwmon1/device/pwm2=hwmon2/temp2_input hwmon1/device/pwm1=hwmon2/temp2_input
FCFANS=hwmon1/device/pwm2=hwmon1/device/fan8_input hwmon1/device/pwm2=hwmon1/device/fan7_input hwmon1/device/pwm2=hwmon1/device/fan6_input hwmon1/device/pwm2=hwmon1/device/fan5_input hwmon1/device/pwm1=hwmon1/device/fan4_input hwmon1/device/pwm1=hwmon1/device/fan3_input hwmon1/device/pwm1=hwmon1/device/fan2_input hwmon1/device/pwm1=hwmon1/device/fan1_input
# TODO: check the temp value with HW after board ready
MINTEMP=hwmon1/device/pwm2=20 hwmon1/device/pwm1=20
MAXTEMP=hwmon1/device/pwm2=60 hwmon1/device/pwm1=60
MINSTART=hwmon1/device/pwm2=75 hwmon1/device/pwm1=75
MINSTOP=hwmon1/device/pwm2=22 hwmon1/device/pwm1=22

View File

@ -0,0 +1,3 @@
CONSOLE_PORT=0x3f8
CONSOLE_DEV=0
CONSOLE_SPEED=115200

View 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)'

View File

@ -0,0 +1 @@
barefoot

View File

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

View File

@ -0,0 +1,107 @@
#
# psuutil.py
# Platform-specific PSU status interface for SONiC
#
import os.path
try:
from sonic_psu.psu_base import PsuBase
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""
GPIO_OFFSET = 0
SYS_GPIO_DIR = "/sys/class/gpio/"
def set_gpio_offset(self):
sys_gpio_dir = "/sys/class/gpio"
self.GPIO_OFFSET = 0
gpiochip_no = 0
for d in os.listdir(sys_gpio_dir):
if "gpiochip" in d:
try:
gpiochip_no = int(d[8:],10)
except ValueError as e:
print "Error: %s" % str(e)
if gpiochip_no > 255:
self.GPIO_OFFSET=256
return True
return True
def __init__(self):
self.set_gpio_offset()
PsuBase.__init__(self)
# Get sysfs attribute
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 ", attr_path, " file !")
retval = retval.rstrip('\r\n')
return retval
def get_num_psus(self):
"""
Retrieves the number of PSUs available on the device
:return: An integer, the number of PSUs available on the device
"""
MAX_PSUS = 2
return MAX_PSUS
def get_psu_status(self, index):
"""
Retrieves the oprational status of power supply unit (PSU) defined
by index <index>
:param index: An integer, index of the PSU of which to query status
:return: Boolean, True if PSU is operating properly, False if PSU is\
faulty
"""
status = 0
gpio_path = [ 'gpio'+str(99+self.GPIO_OFFSET)+'/value', 'gpio'+str(96+self.GPIO_OFFSET)+'/value' ]
attr_path = self.SYS_GPIO_DIR + gpio_path[index-1]
attr_value = self.get_attr_value(attr_path)
if (attr_value != 'ERR'):
attr_value = int(attr_value, 10)
# Check for PSU status
if (attr_value == 1):
status = 1
return status
def get_psu_presence(self, index):
"""
Retrieves the presence status of power supply unit (PSU) defined
by index <index>
:param index: An integer, index of the PSU of which to query status
:return: Boolean, True if PSU is plugged, False if not
"""
status = 0
gpio_path = [ 'gpio'+str(100+self.GPIO_OFFSET)+'/value', 'gpio'+str(97+self.GPIO_OFFSET)+'/value' ]
attr_path = self.SYS_GPIO_DIR + gpio_path[index-1]
attr_value = self.get_attr_value(attr_path)
if (attr_value != 'ERR'):
attr_value = int(attr_value, 10)
# Check for PSU status
if (attr_value == 1):
status = 1
return status

View File

@ -0,0 +1,332 @@
# sfputil.py
#
# Platform-specific SFP transceiver interface for SONiC
#
import os
try:
import time
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError as e:
raise ImportError("%s - required module not found" % str(e))
class SfpUtil(SfpUtilBase):
"""Platform-specific SfpUtil class"""
PORT_START = 0
PORT_END = 33
SFP_PORT_START = 32
PORTS_IN_BLOCK = 34
GPIO_OFFSET = 0
BASE_DIR_PATH = "/sys/class/gpio/gpio{0}/direction"
BASE_VAL_PATH = "/sys/class/gpio/gpio{0}/value"
_port_to_eeprom_mapping = {}
port_to_i2c_mapping = {
0: 10,
1: 9,
2: 12,
3: 11,
4: 14,
5: 13,
6: 16,
7: 15,
8: 18,
9: 17,
10: 20,
11: 19,
12: 22,
13: 21,
14: 24,
15: 23,
16: 26,
17: 25,
18: 28,
19: 27,
20: 30,
21: 29,
22: 32,
23: 31,
24: 34,
25: 33,
26: 36,
27: 35,
28: 38,
29: 37,
30: 40,
31: 39,
32: 45,
33: 46
}
abs_to_gpio_mapping = {}
lpmode_to_gpio_mapping = {}
reset_to_gpio_mapping = {}
@property
def port_start(self):
return self.PORT_START
@property
def port_end(self):
return self.PORT_END
@property
def qsfp_ports(self):
return range(0, self.PORTS_IN_BLOCK + 1)
@property
def port_to_eeprom_mapping(self):
return self._port_to_eeprom_mapping
@property
def sfp_port_start(self):
return self.SFP_PORT_START
def set_gpio_offset(self):
sys_gpio_dir = "/sys/class/gpio"
self.GPIO_OFFSET = 0
gpiochip_no = 0
for d in os.listdir(sys_gpio_dir):
if "gpiochip" in d:
try:
gpiochip_no = int(d[8:],10)
except ValueError as e:
print "Error: %s" % str(e)
if gpiochip_no > 255:
self.GPIO_OFFSET=256
return True
return True
def init_abs_to_gpio_mapping(self):
self.abs_to_gpio_mapping = {
0: 241+self.GPIO_OFFSET,
1: 240+self.GPIO_OFFSET,
2: 243+self.GPIO_OFFSET,
3: 242+self.GPIO_OFFSET,
4: 245+self.GPIO_OFFSET,
5: 244+self.GPIO_OFFSET,
6: 247+self.GPIO_OFFSET,
7: 246+self.GPIO_OFFSET,
8: 249+self.GPIO_OFFSET,
9: 248+self.GPIO_OFFSET,
10: 251+self.GPIO_OFFSET,
11: 250+self.GPIO_OFFSET,
12: 253+self.GPIO_OFFSET,
13: 252+self.GPIO_OFFSET,
14: 255+self.GPIO_OFFSET,
15: 254+self.GPIO_OFFSET,
16: 225+self.GPIO_OFFSET,
17: 224+self.GPIO_OFFSET,
18: 227+self.GPIO_OFFSET,
19: 226+self.GPIO_OFFSET,
20: 229+self.GPIO_OFFSET,
21: 228+self.GPIO_OFFSET,
22: 231+self.GPIO_OFFSET,
23: 230+self.GPIO_OFFSET,
24: 233+self.GPIO_OFFSET,
25: 232+self.GPIO_OFFSET,
26: 235+self.GPIO_OFFSET,
27: 234+self.GPIO_OFFSET,
28: 237+self.GPIO_OFFSET,
29: 236+self.GPIO_OFFSET,
30: 239+self.GPIO_OFFSET,
31: 238+self.GPIO_OFFSET,
32: 177+self.GPIO_OFFSET,
33: 176+self.GPIO_OFFSET
}
return True
def init_lpmode_to_gpio_mapping(self):
self.lpmode_to_gpio_mapping = {
0: 161+self.GPIO_OFFSET,
1: 160+self.GPIO_OFFSET,
2: 163+self.GPIO_OFFSET,
3: 162+self.GPIO_OFFSET,
4: 165+self.GPIO_OFFSET,
5: 164+self.GPIO_OFFSET,
6: 167+self.GPIO_OFFSET,
7: 166+self.GPIO_OFFSET,
8: 169+self.GPIO_OFFSET,
9: 168+self.GPIO_OFFSET,
10: 171+self.GPIO_OFFSET,
11: 170+self.GPIO_OFFSET,
12: 173+self.GPIO_OFFSET,
13: 172+self.GPIO_OFFSET,
14: 175+self.GPIO_OFFSET,
15: 174+self.GPIO_OFFSET,
16: 145+self.GPIO_OFFSET,
17: 144+self.GPIO_OFFSET,
18: 147+self.GPIO_OFFSET,
19: 146+self.GPIO_OFFSET,
20: 149+self.GPIO_OFFSET,
21: 148+self.GPIO_OFFSET,
22: 151+self.GPIO_OFFSET,
23: 150+self.GPIO_OFFSET,
24: 153+self.GPIO_OFFSET,
25: 152+self.GPIO_OFFSET,
26: 155+self.GPIO_OFFSET,
27: 154+self.GPIO_OFFSET,
28: 157+self.GPIO_OFFSET,
29: 156+self.GPIO_OFFSET,
30: 159+self.GPIO_OFFSET,
31: 158+self.GPIO_OFFSET
}
return True
def init_reset_to_gpio_mapping(self):
self.reset_to_gpio_mapping = {
0: 129+self.GPIO_OFFSET,
1: 128+self.GPIO_OFFSET,
2: 131+self.GPIO_OFFSET,
3: 130+self.GPIO_OFFSET,
4: 133+self.GPIO_OFFSET,
5: 132+self.GPIO_OFFSET,
6: 135+self.GPIO_OFFSET,
7: 134+self.GPIO_OFFSET,
8: 137+self.GPIO_OFFSET,
9: 136+self.GPIO_OFFSET,
10: 139+self.GPIO_OFFSET,
11: 138+self.GPIO_OFFSET,
12: 141+self.GPIO_OFFSET,
13: 140+self.GPIO_OFFSET,
14: 143+self.GPIO_OFFSET,
15: 142+self.GPIO_OFFSET,
16: 113+self.GPIO_OFFSET,
17: 112+self.GPIO_OFFSET,
18: 115+self.GPIO_OFFSET,
19: 114+self.GPIO_OFFSET,
20: 117+self.GPIO_OFFSET,
21: 116+self.GPIO_OFFSET,
22: 119+self.GPIO_OFFSET,
23: 118+self.GPIO_OFFSET,
24: 121+self.GPIO_OFFSET,
25: 120+self.GPIO_OFFSET,
26: 123+self.GPIO_OFFSET,
27: 122+self.GPIO_OFFSET,
28: 125+self.GPIO_OFFSET,
29: 124+self.GPIO_OFFSET,
30: 127+self.GPIO_OFFSET,
31: 126+self.GPIO_OFFSET
}
return True
def __init__(self):
# Init abs, lpmode, and reset to gpio mapping
self.set_gpio_offset()
self.init_abs_to_gpio_mapping()
self.init_lpmode_to_gpio_mapping()
self.init_reset_to_gpio_mapping()
# Override port_to_eeprom_mapping for class initialization
eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom"
for x in range(self.port_start, self.port_end + 1):
port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x])
self.port_to_eeprom_mapping[x] = port_eeprom_path
SfpUtilBase.__init__(self)
def get_presence(self, port_num):
# Check for invalid port_num
if port_num < self.port_start or port_num > self.port_end:
return False
try:
abs_device_file = self.BASE_VAL_PATH.format(
self.abs_to_gpio_mapping[port_num])
val_file = open(abs_device_file)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
content = val_file.readline().rstrip()
val_file.close()
# content is a string, either "0" or "1"
if content == "1":
return True
return False
def get_low_power_mode(self, port_num):
# Check for invalid port_num
if port_num < self.port_start or port_num > self.sfp_port_start: # TBD
return False
try:
lpmode_val_device_file = self.BASE_VAL_PATH.format(
self.lpmode_to_gpio_mapping[port_num])
val_file = open(lpmode_val_device_file)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
content = val_file.readline().rstrip()
val_file.close()
# content is a string, either "0" or "1"
if content == "1":
return True
return False
def set_low_power_mode(self, port_num, lpmode):
# Check for invalid port_num
if port_num < self.port_start or port_num > self.sfp_port_start: # TBD
return False
try:
lpmode_val_device_file = self.BASE_VAL_PATH.format(
self.lpmode_to_gpio_mapping[port_num])
val_file = open(lpmode_val_device_file, "w")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
val_file.write("1" if lpmode is True else "0")
val_file.close()
return True
def reset(self, port_num):
# Check for invalid port_num
if port_num < self.port_start or port_num > self.sfp_port_start: # TBD
return False
try:
reset_val_device_file = self.BASE_VAL_PATH.format(
self.reset_to_gpio_mapping[port_num])
val_file = open(reset_val_device_file, "w")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
val_file.write("1")
val_file.close()
# Sleep 1 second to allow it to settle
time.sleep(1)
try:
reset_val_device_file = self.BASE_VAL_PATH.format(
self.reset_to_gpio_mapping[port_num])
val_file = open(reset_val_device_file, "w")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
val_file.write("0")
val_file.close()
return True
def get_transceiver_change_event(self):
"""
TODO: This function need to be implemented
when decide to support monitoring SFP(Xcvrd)
on this platform.
"""
raise NotImplementedError

View File

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

View File

@ -0,0 +1,76 @@
# libsensors configuration file
chip "i350bb-*"
ignore loc1
chip "jc42-*"
label temp1 "DIMM Temp"
set temp1_max 50
set temp1_crit 85
bus "i2c-0" "I2C I801"
chip "tmp75-i2c-*-4f"
label temp1 "CPU Board Temp"
set temp1_max 50
bus "i2c-41" "i2c-7-switch (chan_id 0)"
chip "tmp75-i2c-*-48"
label temp1 "Near PSU1"
set temp1_max 50
chip "tmp75-i2c-*-4a"
label temp1 "Rear MAC"
set temp1_max 50
chip "tmp75-i2c-*-4b"
label temp1 "Near Port 32"
set temp1_max 50
chip "tmp75-i2c-*-4d"
label temp1 "Near PSU2"
set temp1_max 50
chip "lm86-i2c-*-4c"
label temp1 "Front MAC"
label temp2 "ASIC Core Temp"
set temp1_min 20
set temp1_max 65
set temp1_crit 70
set temp2_min 20
set temp2_max 70
set temp2_crit 80
bus "i2c-56" "i2c-0-mux (chan_id 7)"
chip "w83795adg-*"
label in0 "0.9V"
set in0_max 0.927
set in0_min 0.873
label in1 "VDD"
set in1_max 0.962
set in1_min 0.717
ignore in2
ignore in3
ignore in4
ignore in5
ignore in6
ignore in7
label in12 "2.5V"
#compute in12 (2*4*@)/10, @-(2*4*@/10)
compute in12 @/(1+(3/10)), @*(1+(3/10))
set in12_max 2.625
set in12_min 2.375
# in12 and in13 are the same source
ignore in13
ignore in14
ignore in15
ignore in16
label fan1 "FANTRAY 1-A"
label fan2 "FANTRAY 1-B"
label fan3 "FANTRAY 2-A"
label fan4 "FANTRAY 2-B"
label fan5 "FANTRAY 3-A"
label fan6 "FANTRAY 3-B"
label fan7 "FANTRAY 4-A"
label fan8 "FANTRAY 4-B"
ignore temp1
ignore temp2
ignore temp3
ignore temp4
ignore temp5
ignore temp6
ignore intrusion0

View File

@ -14,6 +14,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(INGRASYS_S9180_32X_PLATFORM_MODULE)
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(INGRASYS_S9280_64X_PLATFORM_MODULE) $(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 += $(BFN_MONTARA_QS_PLATFORM_MODULE)
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(NETBERG_AURORA_610_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(NETBERG_AURORA_610_PLATFORM_MODULE)
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(NETBERG_AURORA_710_PLATFORM_MODULE)
ifeq ($(INSTALL_DEBUG_TOOLS),y) ifeq ($(INSTALL_DEBUG_TOOLS),y)
$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_DBG_IMAGES) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_DBG_IMAGES)
$(SONIC_ONE_IMAGE)_DOCKERS += $(filter-out $(patsubst %-$(DBG_IMAGE_MARK).gz,%.gz, $(SONIC_INSTALL_DOCKER_DBG_IMAGES)), $(SONIC_INSTALL_DOCKER_IMAGES)) $(SONIC_ONE_IMAGE)_DOCKERS += $(filter-out $(patsubst %-$(DBG_IMAGE_MARK).gz,%.gz, $(SONIC_INSTALL_DOCKER_DBG_IMAGES)), $(SONIC_INSTALL_DOCKER_IMAGES))

View File

@ -1,16 +1,19 @@
# Netberg Aurora 610 Platform modules # Netberg tofino-based platforms modules
NETBERG_AURORA_610_PLATFORM_MODULE_VERSION = 1.1.0 NETBERG_AURORA_610_PLATFORM_MODULE_VERSION = 1.1.1
NETBERG_AURORA_710_PLATFORM_MODULE_VERSION = 1.1.1
export NETBERG_AURORA_610_PLATFORM_MODULE_VERSION export NETBERG_AURORA_610_PLATFORM_MODULE_VERSION
export NETBERG_AURORA_710_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 = 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 $(NETBERG_AURORA_610_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-netberg
$(NETBERG_AURORA_610_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(NETBERG_AURORA_610_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
$(NETBERG_AURORA_610_PLATFORM_MODULE)_PLATFORM = x86_64-netberg_aurora_610-r0 $(NETBERG_AURORA_610_PLATFORM_MODULE)_PLATFORM = x86_64-netberg_aurora_610-r0
SONIC_DPKG_DEBS += $(NETBERG_AURORA_610_PLATFORM_MODULE) SONIC_DPKG_DEBS += $(NETBERG_AURORA_610_PLATFORM_MODULE)
export NETBERG_AURORA_610_PLATFORM_MODULE NETBERG_AURORA_710_PLATFORM_MODULE = sonic-platform-netberg-aurora-710_$(NETBERG_AURORA_710_PLATFORM_MODULE_VERSION)_amd64.deb
$(NETBERG_AURORA_710_PLATFORM_MODULE)_PLATFORM = x86_64-netberg_aurora_710-r0
#$(eval $(call add_extra_package,$(NETBERG_AURORA_610_PLATFORM_MODULE)))
$(eval $(call add_extra_package,$(NETBERG_AURORA_610_PLATFORM_MODULE),$(NETBERG_AURORA_710_PLATFORM_MODULE)))

View 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

View File

@ -0,0 +1,185 @@
# Netberg Aurora 710 Platform Driver for SONiC
Copyright (C) 2019 Netberg, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
## Licensing terms
The Licensing terms of the files within this project is split 2 parts.
The Linux kernel is released under the GNU General Public License version 2.
All other code is released under the GNU General Public License version 3.
Please see the LICENSE file for copies of both licenses.
## Contents of this package
- service/
> Service config files for platform initialization and monitoring
- utils/
> Scripts useful during platform bringup and sysfs function
- conf/
> Platform configure files.
## Kernel modules and drivers
The driver for interacting with Netberg Aurora 710 is contained in the I2C
kernel module and initialization script. The initialization script loads
the modules in the correct order. It has been built and tested against
the Linux 3.16 kernel.
The initialization script will modprobe the needed modules, navigate to the
module's device directory in sysfs, and write configuration data to
the kernel module.
### IGB
This is OOB Ports on front panel for management plane.
The IGB module must be loaded first on Netberg Aurora 710 platform.
### I2C i801
The I2C i801 on Netberg Aurora 710 can be found in
`/sys/bus/i2c/devices/i2c-0/`
This is I2C bus for Clock Gen, DIMM channel and digital potentiometers.
The i801 module must be loaded second on Netberg Aurora 710.
### I2C iSMT
The I2C iSMT module on Aurora 710 can be found in
`/sys/bus/i2c/devices/i2c-1/`
This is I2C bus for CPLD, HWM, power controller and I2C Switches.
The i801 module must be loaded third on Netberg Aurora 710.
### I2C PCA9548
The PCA9548 module on Aurora 710 can be found in
`/sys/bus/i2c/devices/i2c-2/` , `/sys/bus/i2c/devices/i2c-3/`,
`/sys/bus/i2c/devices/i2c-4/`, `/sys/bus/i2c/devices/i2c-5/`,
`/sys/bus/i2c/devices/i2c-6/`, `/sys/bus/i2c/devices/i2c-7/`,
`/sys/bus/i2c/devices/i2c-8/`, `/sys/bus/i2c/devices/i2c-9/`.
The pca9548 module for zQSFP module get/set functions, PSU information,
fan status and EEPROM.
## Hardware components
The hardware components are initialized in the init script on Aurora 710.
The following describes manual initialization as well as interaction.
The examples below are just for Netberg Aurora 710 platform.
### Hardware initialization
When the sonic-platform-netberg-aurora-710 package is installed on the Aurora 710,
it is automatically initialized. If you want to manual initialization, the
utility command usage as follows:
```
i2c_utils.sh i2c_init
```
### EEPROM
The EEPROM is including the board SKU, model name, vendor name, serial number,
and other information can be accessed with the specific eeprom kernel module.
After using `modprobe eeprom_mb` to detect the eeprom, it will show up in sysfs.
The hexdump utility can be used to decode the raw output of the EEPROM.
For example,
```
bash# echo "mb_eeprom 0x54" > /sys/bus/i2c/devices/i2c-9/new_device
bash# cat /sys/bus/i2c/drivers/mb_eeprom/9-0054/eeprom | hexdump -C
```
### Front panel LEDs
LEDs can be setup on/off by using i2c utility `/usr/sbin/i2c_utils.sh`.
Utility function command usage as follows:
```
Status LED:
i2c_utils.sh i2c_sys_led green|amber on|off
Fan status LED:
i2c_utils.sh i2c_fan_led green|amber on|off
PSU1 status LED:
i2c_utils.sh i2c_psu1_led green|amber on|off
PSU2 status LED:
i2c_utils.sh i2c_psu2_led green|amber on|off
```
QSFP Module Port LEDs control by ASIC library.
### Fan speed
Fan speed are controlled by the w83795 kernel module.
It can be found in `/sys/class/hwmon/hwmon3/device/`.
If they were compiled as modules, you will need to modprobe w83795 for
their sysfs entries to show up. Each fan has an `fan<N>_input` file
for reading the fan speed. And `pwm1` setting fan1 to fan4,
`pwm2` setting fan5 to fan8.
There is docker-platform-monitor container installed fancontrol package that can
automatic control platform fan speed.
### Temperature sensors
Temperature sensors are controlled by the w83795 kernel
module. It can be found in `/sys/class/hwmon/hwmon3/device/`.
If they were compiled as modules, then you will need to modprobe w83795 for
their sysfs entries to show up.
`temp1_input` is front MAC temperature sensor. `temp2_input` is rear MAC
temperature sensor.
There is docker-platform-monitor container installed lm-sensors package that can
monitor platform temperature. And `sensors` command can show each
temperature sensors status.
### Power supplies
Power supplies status and its EEPROM info can be used i2c utility
`/usr/sbin/i2c_utils.sh` to get.
The usage as follows:
```
PSU EEPROM:
i2c_utils.sh i2c_psu_eeprom_get
hexdump -C psu0.rom
hexdump -C psu1.rom
PSU Status:
i2c_utils.sh i2c_psu_status
```
### QSFPs
QSFP modules are managed by the pca9548 kernel driver.
The i2c utility `/usr/sbin/i2c_utils.sh` can be used to get status and
module EEPROM informations.
The usage as follows:
```
QSFP EEPROM:
i2c_utils.sh i2c_qsfp_eeprom_get [1-32]
QSFP Insert Event:
i2c_utils.sh i2c_qsfp_eeprom_get [1-32]
0 => not insert
1 => inserted
```

View File

@ -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

View File

@ -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 710 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',
],
)

View File

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

View File

@ -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 = 32
__num_of_thermals = 12
__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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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/class/hwmon/hwmon1/device/fan{}_input"
FAN_ALARM_SYS_FS = "/sys/class/hwmon/hwmon1/device/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(8 + self.__index)
self.__alarm = PSU_FAN_ALARM_SYS_FS.format(8 + self.__index)
else:
self.__index = 8 - 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

View File

@ -0,0 +1,23 @@
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(2 * fantray_index))
self._fan_list.append(Fan(2 * fantray_index + 1))
def get_name(self):
"""
Retrieves the fan drawer name
Returns:
string: The name of the device
"""
return "FanTray{}".format(self.fantray_index+1)

View File

@ -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()

View File

@ -0,0 +1,327 @@
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 = 9984
PSU_SYS_FS = "/sys/class/hwmon/hwmon{}/"
PSU_EXIST_INPOWER = "/sys/class/gpio/gpio{}/value"
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
# Presence: PSU1: GPIO_OFFSET+100; PSU2: GPIO_OFFSET+97
self.__psu_presence_attr = PSU_EXIST_INPOWER.format(
GPIO_OFFSET + 100 - 3 * self.__index)
# Powerstatus: PSU1: GPIO_OFFSET+99; PSU2: GPIO_OFFSET+96
self.__psu_inpower_status_attr = PSU_EXIST_INPOWER.format(
GPIO_OFFSET + 99 - 3 * self.__index)
psun_sys_fs = PSU_SYS_FS.format(8 + 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(57 + 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):
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
attr_path = self.__psu_presence_attr
attr_rv = self.__get_attr_value(attr_path)
if attr_rv != 'ERR':
if attr_rv == "1":
presence = True
else:
raise SyntaxError
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(22, 34)
def get_serial(self):
"""
Retrieves the serial number of the device
Returns:
string: Serial number of device
"""
return self.__eeprom_read_bytes(50, 61)
def get_revision(self):
"""
Retrieves the hardware revision of the device
Returns:
string: Revision value of device
"""
return self.__eeprom_read_bytes(46, 48)
def get_status(self):
"""
Retrieves the operational status of the device
Returns:
A boolean value, True if device is operating properly, False if not
"""
inpower = False
attr_rv = self.__get_attr_value(self.__psu_inpower_status_attr)
if attr_rv != 'ERR':
if attr_rv == "1":
inpower = True
return self.get_presence() and inpower
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_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_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

View File

@ -0,0 +1,197 @@
#!/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"
GPIO_OFFSET = 9984
GPIO_VALUE = "/sys/class/gpio/gpio{}/value"
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 = EEPROM_PATH.format(9 + (port_num ^ 1))
# print(self.eeprom_path)
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
gpio = GPIO_OFFSET + 224 + (16 if self.index < 16 else - 16)
attr_rv = self.__get_attr_value(
GPIO_VALUE.format(gpio + (self.index) ^ 1))
if attr_rv != 'ERR':
if attr_rv == "1":
presence = True
else:
raise SyntaxError
return presence
def get_lpmode(self):
"""
Retrieves the lpmode (low power mode) status of this SFP
"""
lpmode = False
gpio = GPIO_OFFSET + 160 + (16 if self.index < 16 else - 16)
attr_rv = self.__get_attr_value(
GPIO_VALUE.format(gpio + (self.index) ^ 1))
if attr_rv != 'ERR':
if attr_rv == "1":
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
gpio = GPIO_OFFSET + 128 + (16 if self.index < 16 else - 16)
attr_rv = self.__get_attr_value(
GPIO_VALUE.format(gpio + (self.index) ^ 1))
if attr_rv != 'ERR':
if attr_rv == "1":
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

View File

@ -0,0 +1,219 @@
#!/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",
"Front MAC",
"ASIC Core",
"CPU Board",
"Near PSU1",
"Rear MAC",
"Near Port 32",
"Near PSU2"
]
__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(2, 1, "input"),
__switch_thermal_path.format(2, 2, "input"),
__switch_thermal_path.format(3, 1, "input"),
__switch_thermal_path.format(4, 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(2, 1, "max"),
__switch_thermal_path.format(2, 2, "max"),
__switch_thermal_path.format(3, 1, "max"),
__switch_thermal_path.format(4, 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

View File

@ -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)

View File

@ -0,0 +1,404 @@
#!/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 0x21 0x1c 0x26 0x19 0x23 0x1e 0x28 )
#GPIO Offset
GPIO_OFFSET=0
function _set_gpio_offset {
GPIO_OFFSET=0
gpio_base_max=`cat /sys/class/gpio/gpiochip*/base | sort -n | tail -1`
GPIO_OFFSET=$(($gpio_base_max - 240))
echo "set GPIO_OFFSET=${GPIO_OFFSET}"
}
#GPIO Init
function i2c_gpio_init {
local i=0
#ABS Port 0-15
echo "pca9535 0x20" > /sys/bus/i2c/devices/i2c-5/new_device
_set_gpio_offset
#for i in {240..255};
for((i=${GPIO_OFFSET}+240;i<=${GPIO_OFFSET}+255;i++));
do
echo $i > /sys/class/gpio/export
echo 1 > /sys/class/gpio/gpio${i}/active_low
done
#ABS Port 16-31
echo "pca9535 0x21" > /sys/bus/i2c/devices/i2c-5/new_device
#for i in {224..239};
for((i=${GPIO_OFFSET}+224;i<=${GPIO_OFFSET}+239;i++));
do
echo $i > /sys/class/gpio/export
echo 1 > /sys/class/gpio/gpio${i}/active_low
done
#INT Port 0-15
echo "pca9535 0x22" > /sys/bus/i2c/devices/i2c-5/new_device
#for i in {208..223};
for((i=${GPIO_OFFSET}+208;i<=${GPIO_OFFSET}+223;i++));
do
echo $i > /sys/class/gpio/export
echo 1 > /sys/class/gpio/gpio${i}/active_low
done
#INT Port 16-31
echo "pca9535 0x23" > /sys/bus/i2c/devices/i2c-5/new_device
#for i in {192..207};
for((i=${GPIO_OFFSET}+192;i<=${GPIO_OFFSET}+207;i++));
do
echo $i > /sys/class/gpio/export
echo 1 > /sys/class/gpio/gpio${i}/active_low
done
#SFP+
echo "pca9535 0x27" > /sys/bus/i2c/devices/i2c-5/new_device
#for i in {176..191};
for((i=${GPIO_OFFSET}+176;i<=${GPIO_OFFSET}+191;i++));
do
echo $i > /sys/class/gpio/export
case ${i} in
#176|177|178|179|182|183|188|189|190|191)
$((${GPIO_OFFSET}+176)) | \
$((${GPIO_OFFSET}+177)) | \
$((${GPIO_OFFSET}+178)) | \
$((${GPIO_OFFSET}+179)) | \
$((${GPIO_OFFSET}+182)) | \
$((${GPIO_OFFSET}+183)) | \
$((${GPIO_OFFSET}+188)) | \
$((${GPIO_OFFSET}+189)) | \
$((${GPIO_OFFSET}+190)) | \
$((${GPIO_OFFSET}+191)) )
echo 1 > /sys/class/gpio/gpio${i}/active_low
;;
#180|181|184|185|186|187)
$((${GPIO_OFFSET}+180)) | \
$((${GPIO_OFFSET}+181)) | \
$((${GPIO_OFFSET}+184)) | \
$((${GPIO_OFFSET}+185)) | \
$((${GPIO_OFFSET}+186)) | \
$((${GPIO_OFFSET}+187)) )
echo out > /sys/class/gpio/gpio${i}/direction
;;
esac
done
#LP Mode Port 0-15
echo "pca9535 0x20" > /sys/bus/i2c/devices/i2c-6/new_device
#for i in {160..175};
for((i=${GPIO_OFFSET}+160;i<=${GPIO_OFFSET}+175;i++));
do
echo $i > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio${i}/direction
done
#LP Mode Port 16-31
echo "pca9535 0x21" > /sys/bus/i2c/devices/i2c-6/new_device
#for i in {144..159};
for((i=${GPIO_OFFSET}+144;i<=${GPIO_OFFSET}+159;i++));
do
echo $i > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio${i}/direction
done
#RST Port 0-15
echo "pca9535 0x22" > /sys/bus/i2c/devices/i2c-6/new_device
#for i in {128..143};
for((i=${GPIO_OFFSET}+128;i<=${GPIO_OFFSET}+143;i++));
do
echo $i > /sys/class/gpio/export
echo 1 > /sys/class/gpio/gpio${i}/active_low
echo low > /sys/class/gpio/gpio${i}/direction
done
#RST Port 16-31
echo "pca9535 0x23" > /sys/bus/i2c/devices/i2c-6/new_device
#for i in {112..127};
for((i=${GPIO_OFFSET}+112;i<=${GPIO_OFFSET}+127;i++));
do
echo $i > /sys/class/gpio/export
echo 1 > /sys/class/gpio/gpio${i}/active_low
echo low > /sys/class/gpio/gpio${i}/direction
#echo out > /sys/class/gpio/gpio${i}/direction
#echo 0 > /sys/class/gpio/gpio${i}/value
done
#PSU I/O on Dummy Board 0x25
echo "pca9535 0x25" > /sys/bus/i2c/devices/i2c-0/new_device
#for i in {96..111};
for((i=${GPIO_OFFSET}+96;i<=${GPIO_OFFSET}+111;i++));
do
echo $i > /sys/class/gpio/export
case ${i} in
#97|98|100|101|102|105|106|108)
$((${GPIO_OFFSET}+97)) | \
$((${GPIO_OFFSET}+98)) | \
$((${GPIO_OFFSET}+100)) | \
$((${GPIO_OFFSET}+101)) | \
$((${GPIO_OFFSET}+102)) | \
$((${GPIO_OFFSET}+105)) | \
$((${GPIO_OFFSET}+106)) | \
$((${GPIO_OFFSET}+108)) )
echo 1 > /sys/class/gpio/gpio${i}/active_low
;;
#98|101|106|107|108)
$((${GPIO_OFFSET}+98)) | \
$((${GPIO_OFFSET}+101)) | \
$((${GPIO_OFFSET}+106)) | \
$((${GPIO_OFFSET}+107)) | \
$((${GPIO_OFFSET}+108)) )
echo out > /sys/class/gpio/gpio${i}/direction
;;
esac
done
}
#IO Expander Init
function _i2c_io_exp_init {
# Reset BMC Dummy Board
i2cset -y -r 0 0x26 4 0x00
i2cset -y -r 0 0x26 5 0x00
i2cset -y -r 0 0x26 2 0x3F
i2cset -y -r 0 0x26 3 0x1F
i2cset -y -r 0 0x26 6 0xC0
i2cset -y -r 0 0x26 7 0x00
# CPU Board
i2cset -y -r 0 0x77 6 0xFF
i2cset -y -r 0 0x77 7 0xFF
# init SMBUS1 ABS
i2cset -y -r 5 0x20 4 0x00
i2cset -y -r 5 0x20 5 0x00
i2cset -y -r 5 0x20 6 0xFF
i2cset -y -r 5 0x20 7 0xFF
i2cset -y -r 5 0x21 4 0x00
i2cset -y -r 5 0x21 5 0x00
i2cset -y -r 5 0x21 6 0xFF
i2cset -y -r 5 0x21 7 0xFF
i2cset -y -r 5 0x22 4 0x00
i2cset -y -r 5 0x22 5 0x00
i2cset -y -r 5 0x22 6 0xFF
i2cset -y -r 5 0x22 7 0xFF
i2cset -y -r 5 0x23 4 0x00
i2cset -y -r 5 0x23 5 0x00
i2cset -y -r 5 0x23 2 0xCF
i2cset -y -r 5 0x23 3 0xF0
i2cset -y -r 5 0x23 6 0xCF
i2cset -y -r 5 0x23 7 0xF0
# init SFP
i2cset -y -r 5 0x27 4 0x00
i2cset -y -r 5 0x27 5 0x00
i2cset -y -r 5 0x27 2 0x00
i2cset -y -r 5 0x27 3 0x00
i2cset -y -r 5 0x27 6 0xCF
i2cset -y -r 5 0x27 7 0xF0
# set ZQSFP LP_MODE = 0
i2cset -y -r 6 0x20 4 0x00
i2cset -y -r 6 0x20 5 0x00
i2cset -y -r 6 0x20 2 0x00
i2cset -y -r 6 0x20 3 0x00
i2cset -y -r 6 0x20 6 0x00
i2cset -y -r 6 0x20 7 0x00
i2cset -y -r 6 0x21 4 0x00
i2cset -y -r 6 0x21 5 0x00
i2cset -y -r 6 0x21 2 0x00
i2cset -y -r 6 0x21 3 0x00
i2cset -y -r 6 0x21 6 0x00
i2cset -y -r 6 0x21 7 0x00
# set ZQSFP RST = 1
i2cset -y -r 6 0x22 4 0x00
i2cset -y -r 6 0x22 5 0x00
i2cset -y -r 6 0x22 2 0xFF
i2cset -y -r 6 0x22 3 0xFF
i2cset -y -r 6 0x22 6 0x00
i2cset -y -r 6 0x22 7 0x00
i2cset -y -r 6 0x23 4 0x00
i2cset -y -r 6 0x23 5 0x00
i2cset -y -r 6 0x23 2 0xFF
i2cset -y -r 6 0x23 3 0xFF
i2cset -y -r 6 0x23 6 0x00
i2cset -y -r 6 0x23 7 0x00
# init Host GPIO
i2cset -y -r 0 0x74 4 0x00
i2cset -y -r 0 0x74 5 0x00
i2cset -y -r 0 0x74 2 0x0F
i2cset -y -r 0 0x74 3 0xDF
i2cset -y -r 0 0x74 6 0x08
i2cset -y -r 0 0x74 7 0x1F
# init Board ID
i2cset -y -r 51 0x27 4 0x00
i2cset -y -r 51 0x27 5 0x00
i2cset -y -r 51 0x27 6 0xFF
i2cset -y -r 51 0x27 7 0xFF
# init Board ID of Dummy BMC Board
i2cset -y -r 0 0x24 4 0x00
i2cset -y -r 0 0x24 5 0x00
i2cset -y -r 0 0x24 6 0xFF
i2cset -y -r 0 0x24 7 0xFF
# init PSU I/O (BAREFOOT_IO_EXP_PSU_ID)
i2cset -y -r 0 0x25 4 0x00
i2cset -y -r 0 0x25 5 0x00
i2cset -y -r 0 0x25 2 0x00
i2cset -y -r 0 0x25 3 0x1D
i2cset -y -r 0 0x25 6 0xDB
i2cset -y -r 0 0x25 7 0x03
# init FAN I/O (BAREFOOT_IO_EXP_FAN_ID)
i2cset -y -r 59 0x20 4 0x00
i2cset -y -r 59 0x20 5 0x00
i2cset -y -r 59 0x20 2 0x11
i2cset -y -r 59 0x20 3 0x11
i2cset -y -r 59 0x20 6 0xCC
i2cset -y -r 59 0x20 7 0xCC
# init Fan
# select bank 0
i2cset -y -r 56 0x2F 0x00 0x80
# enable FANIN 1-8
i2cset -y -r 56 0x2F 0x06 0xFF
# disable FANIN 9-14
i2cset -y -r 56 0x2F 0x07 0x00
# select bank 2
i2cset -y -r 56 0x2F 0x00 0x82
# set PWM mode in FOMC
i2cset -y -r 56 0x2F 0x0F 0x00
# init VOLMON
i2cset -y -r 56 0x2F 0x00 0x80
i2cset -y -r 56 0x2F 0x01 0x1C
i2cset -y -r 56 0x2F 0x00 0x80
i2cset -y -r 56 0x2F 0x02 0xFF
i2cset -y -r 56 0x2F 0x03 0x50
i2cset -y -r 56 0x2F 0x04 0x0A
i2cset -y -r 56 0x2F 0x00 0x80
i2cset -y -r 56 0x2F 0x01 0x1D
}
function mac_vdd_init {
# read mac vid register value from CPLD
val=`i2cget -y 44 0x33 0x42 2>/dev/null`
# 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 8 0x22 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
#todo: switch to channels
echo 'pca9548 0x71' > /sys/bus/i2c/devices/i2c-1/new_device
echo 'pca9548 0x71' > /sys/bus/i2c/devices/i2c-2/new_device
echo 'pca9548 0x71' > /sys/bus/i2c/devices/i2c-3/new_device
echo 'pca9548 0x71' > /sys/bus/i2c/devices/i2c-4/new_device
echo 'pca9548 0x71' > /sys/bus/i2c/devices/i2c-7/new_device
echo 'pca9548 0x76' > /sys/bus/i2c/devices/i2c-0/new_device
echo 'pca9545 0x72' > /sys/bus/i2c/devices/i2c-0/new_device
echo '-2' > /sys/bus/i2c/devices/0-0070/idle_state
echo '-2' > /sys/bus/i2c/devices/1-0071/idle_state
echo '-2' > /sys/bus/i2c/devices/2-0071/idle_state
echo '-2' > /sys/bus/i2c/devices/3-0071/idle_state
echo '-2' > /sys/bus/i2c/devices/4-0071/idle_state
echo '-2' > /sys/bus/i2c/devices/7-0071/idle_state
echo '-2' > /sys/bus/i2c/devices/0-0076/idle_state
echo '-2' > /sys/bus/i2c/devices/0-0072/idle_state
# i2cget -y 44 0x74 2
_i2c_io_exp_init
echo 'w83795adg 0x2F' > /sys/bus/i2c/devices/i2c-56/new_device
sleep 1
echo 120 > /sys/class/hwmon/hwmon1/device/pwm1
echo 120 > /sys/class/hwmon/hwmon1/device/pwm2
#TMP75 Init
echo "lm86 0x4c" > /sys/bus/i2c/devices/i2c-53/new_device # ASIC Coretemp and Front MAC
echo "tmp75 0x4f" > /sys/bus/i2c/devices/i2c-0/new_device #CPU Board
echo "tmp75 0x48" > /sys/bus/i2c/devices/i2c-53/new_device # Near PSU1
echo "tmp75 0x4a" > /sys/bus/i2c/devices/i2c-53/new_device # Rear MAC
echo "tmp75 0x4b" > /sys/bus/i2c/devices/i2c-53/new_device # Near Port 32
echo "tmp75 0x4d" > /sys/bus/i2c/devices/i2c-53/new_device # Near PSU2
rmmod gpio-pca953x
rmmod gpio_ich
modprobe gpio-pca953x
sleep 1
i2c_gpio_init
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-58/new_device #PS0
echo "spd 0x50" > /sys/bus/i2c/devices/i2c-57/new_device #PS1
#modprobe pmbus
# PS PMBUS
echo "pmbus 0x58" > /sys/bus/i2c/devices/i2c-58/new_device #PS0
echo "pmbus 0x58" > /sys/bus/i2c/devices/i2c-57/new_device #PS1
#QSFP EEPROM
modprobe optoe
for i in {9..40};
do
echo "optoe1 0x50" > /sys/bus/i2c/devices/i2c-$i/new_device
done
# init SFP0/1 EEPROM
echo "optoe2 0x50" > /sys/bus/i2c/devices/i2c-45/new_device
echo "optoe2 0x50" > /sys/bus/i2c/devices/i2c-46/new_device
mac_vdd_init

View File

@ -1,12 +1,17 @@
platform-driver (1.1.1) unstable; urgency=low
* Add support for Aurora 710
-- developer <support@netbergtw.com> Fri, 26 Aug 2022 11:00:00 +0800
platform-driver (1.1.0) unstable; urgency=low platform-driver (1.1.0) unstable; urgency=low
* Add support for Aurora 610 * Add support for Aurora 610
-- developer <support@netbergtw.com> Fri, 26 May 2017 11:00:00 +0800 -- developer <support@netbergtw.com> Fri, 26 May 2022 11:00:00 +0800
platform-driver (1.0.0) unstable; urgency=low platform-driver (1.0.0) unstable; urgency=low
* Initial commit * Initial commit
-- developer <support@netbergtw.com> Wed, 05 Oct 2016 16:30:45 +0800 -- developer <support@netbergtw.com> Wed, 05 Oct 2016 16:30:45 +0800

View File

@ -5,7 +5,10 @@ Maintainer: Netberg <support@netbergtw.com>
Build-Depends: debhelper (>= 9) Build-Depends: debhelper (>= 9)
Standards-Version: 1.0.0 Standards-Version: 1.0.0
Package: sonic-platform-netberg-aurora-710
Architecture: amd64
Description: This package contains Aurora 710 platform driver utility for SONiC project.
Package: sonic-platform-netberg-aurora-610 Package: sonic-platform-netberg-aurora-610
Architecture: amd64 Architecture: amd64
Description: This package contains Aurora 610 platform driver utility for SONiC project. Description: This package contains Aurora 610 platform driver utility for SONiC project.

View File

@ -8,7 +8,7 @@ PACKAGE_PRE_NAME := sonic-platform-netberg
KVERSION ?= $(shell uname -r) KVERSION ?= $(shell uname -r)
KERNEL_SRC := /lib/modules/$(KVERSION) KERNEL_SRC := /lib/modules/$(KVERSION)
MOD_SRC_DIR:= $(shell pwd) MOD_SRC_DIR:= $(shell pwd)
MODULE_DIRS:= aurora-610 MODULE_DIRS:= aurora-610 aurora-710
MODULE_DIR := modules MODULE_DIR := modules
UTILS_DIR := utils UTILS_DIR := utils
SERVICE_DIR := service SERVICE_DIR := service
@ -31,6 +31,9 @@ override_dh_auto_install:
$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko \ cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko \
debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} usr/sbin; \
cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/*.sh \
debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/sbin; \
dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} lib/systemd/system; \ dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} lib/systemd/system; \
cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service \ cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service \
debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system; \ debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system; \

View File

@ -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-710 board.
### END INIT INFO
case "$1" in
start)
echo -n "Setting up board... "
depmod -a
i2c_init.sh
echo "done."
;;
stop)
echo "done."
;;
force-reload|restart)
echo "Not supported"
;;
*)
echo "Usage: /etc/init.d/sonic-platform-netberg-aurora-710.init {start|stop}"
exit 1
;;
esac
exit 0

View File

@ -0,0 +1 @@
aurora-710/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-netberg_aurora_710-r0

View File

@ -0,0 +1,9 @@
#!/bin/sh
set -e
PLATFORM_NAME=x86_64-netberg_aurora_710-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#