diff --git a/build_debian.sh b/build_debian.sh index ba31368ce915..8f929d63fbb8 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -213,9 +213,11 @@ sudo LANG=C chroot $FILESYSTEM_ROOT useradd -G sudo,docker $USERNAME -c "$DEFAUL ## Create password for the default user echo "$USERNAME:$PASSWORD" | sudo LANG=C chroot $FILESYSTEM_ROOT chpasswd -## Pre-install hardware drivers -sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install \ - firmware-linux-nonfree +if [[ $CONFIGURED_ARCH == amd64 ]]; then + ## Pre-install hardware drivers + sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install \ + firmware-linux-nonfree +fi ## Pre-install the fundamental packages ## Note: gdisk is needed for sgdisk in install.sh @@ -267,9 +269,14 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in tcptraceroute \ mtr-tiny \ locales \ + cgroup-tools + +if [[ $CONFIGURED_ARCH == amd64 ]]; then +## Pre-install the fundamental packages for amd64 (x86) +sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \ flashrom \ - cgroup-tools \ mcelog +fi #Adds a locale to a debian system in non-interactive mode sudo sed -i '/^#.* en_US.* /s/^#//' $FILESYSTEM_ROOT/etc/locale.gen && \ @@ -402,8 +409,10 @@ set /files/etc/sysctl.conf/net.core.rmem_max 2097152 set /files/etc/sysctl.conf/net.core.wmem_max 2097152 " -r $FILESYSTEM_ROOT -# Configure mcelog to log machine checks to syslog -sudo sed -i 's/^#syslog = yes/syslog = yes/' $FILESYSTEM_ROOT/etc/mcelog/mcelog.conf +if [[ $CONFIGURED_ARCH == amd64 ]]; then + # Configure mcelog to log machine checks to syslog + sudo sed -i 's/^#syslog = yes/syslog = yes/' $FILESYSTEM_ROOT/etc/mcelog/mcelog.conf +fi ## docker-py is needed by Ansible docker module sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT easy_install pip diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers_defaults_t0.j2 b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers_defaults_t0.j2 index 7e7c32676eb7..300fecdb3555 100644 --- a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers_defaults_t0.j2 +++ b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers_defaults_t0.j2 @@ -19,7 +19,7 @@ "ingress_lossless_pool": { "size": "{{ ingress_lossless_pool_size }}", "type": "ingress", - "mode": "dynamic" + "mode": "static" }, "ingress_lossy_pool": { "size": "{{ ingress_lossy_pool_size }}", @@ -29,7 +29,7 @@ "egress_lossless_pool": { "size": "{{ egress_lossless_pool_size }}", "type": "egress", - "mode": "dynamic" + "mode": "static" }, "egress_lossy_pool": { "size": "{{ egress_lossy_pool_size }}", diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers_defaults_t1.j2 b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers_defaults_t1.j2 index 7e7c32676eb7..300fecdb3555 100644 --- a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers_defaults_t1.j2 +++ b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/buffers_defaults_t1.j2 @@ -19,7 +19,7 @@ "ingress_lossless_pool": { "size": "{{ ingress_lossless_pool_size }}", "type": "ingress", - "mode": "dynamic" + "mode": "static" }, "ingress_lossy_pool": { "size": "{{ ingress_lossy_pool_size }}", @@ -29,7 +29,7 @@ "egress_lossless_pool": { "size": "{{ egress_lossless_pool_size }}", "type": "egress", - "mode": "dynamic" + "mode": "static" }, "egress_lossy_pool": { "size": "{{ egress_lossy_pool_size }}", diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/nephos_dac.dsh b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/nephos_dac.dsh new file mode 100644 index 000000000000..10a7b7a9df0e --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/nephos_dac.dsh @@ -0,0 +1,404 @@ +init start stage low-level +init set port-map port=0 eth-macro=2 lane=0 max-speed=25g active=true +init set port-map port=1 eth-macro=2 lane=1 max-speed=25g active=true +init set port-map port=2 eth-macro=2 lane=2 max-speed=25g active=true +init set port-map port=3 eth-macro=2 lane=3 max-speed=25g active=true +init set port-map port=4 eth-macro=3 lane=0 max-speed=25g active=true +init set port-map port=5 eth-macro=3 lane=1 max-speed=25g active=true +init set port-map port=6 eth-macro=3 lane=2 max-speed=25g active=true +init set port-map port=7 eth-macro=3 lane=3 max-speed=25g active=true +init set port-map port=8 eth-macro=4 lane=0 max-speed=25g active=true +init set port-map port=9 eth-macro=4 lane=1 max-speed=25g active=true +init set port-map port=10 eth-macro=4 lane=2 max-speed=25g active=true +init set port-map port=11 eth-macro=4 lane=3 max-speed=25g active=true +init set port-map port=12 eth-macro=5 lane=0 max-speed=25g active=true +init set port-map port=13 eth-macro=5 lane=1 max-speed=25g active=true +init set port-map port=14 eth-macro=5 lane=2 max-speed=25g active=true +init set port-map port=15 eth-macro=5 lane=3 max-speed=25g active=true +init set port-map port=16 eth-macro=8 lane=0 max-speed=25g active=true +init set port-map port=17 eth-macro=8 lane=1 max-speed=25g active=true +init set port-map port=18 eth-macro=8 lane=2 max-speed=25g active=true +init set port-map port=19 eth-macro=8 lane=3 max-speed=25g active=true +init set port-map port=20 eth-macro=10 lane=0 max-speed=25g active=true +init set port-map port=21 eth-macro=10 lane=1 max-speed=25g active=true +init set port-map port=22 eth-macro=10 lane=2 max-speed=25g active=true +init set port-map port=23 eth-macro=10 lane=3 max-speed=25g active=true +init set port-map port=24 eth-macro=12 lane=0 max-speed=25g active=true +init set port-map port=25 eth-macro=12 lane=1 max-speed=25g active=true +init set port-map port=26 eth-macro=12 lane=2 max-speed=25g active=true +init set port-map port=27 eth-macro=12 lane=3 max-speed=25g active=true +init set port-map port=28 eth-macro=14 lane=0 max-speed=25g active=true +init set port-map port=29 eth-macro=14 lane=1 max-speed=25g active=true +init set port-map port=30 eth-macro=14 lane=2 max-speed=25g active=true +init set port-map port=31 eth-macro=14 lane=3 max-speed=25g active=true +init set port-map port=32 eth-macro=16 lane=0 max-speed=25g active=true +init set port-map port=33 eth-macro=16 lane=1 max-speed=25g active=true +init set port-map port=34 eth-macro=16 lane=2 max-speed=25g active=true +init set port-map port=35 eth-macro=16 lane=3 max-speed=25g active=true +init set port-map port=36 eth-macro=17 lane=0 max-speed=25g active=true +init set port-map port=37 eth-macro=17 lane=1 max-speed=25g active=true +init set port-map port=38 eth-macro=17 lane=2 max-speed=25g active=true +init set port-map port=39 eth-macro=17 lane=3 max-speed=25g active=true +init set port-map port=40 eth-macro=18 lane=0 max-speed=25g active=true +init set port-map port=41 eth-macro=18 lane=1 max-speed=25g active=true +init set port-map port=42 eth-macro=18 lane=2 max-speed=25g active=true +init set port-map port=43 eth-macro=18 lane=3 max-speed=25g active=true +init set port-map port=44 eth-macro=19 lane=0 max-speed=25g active=true +init set port-map port=45 eth-macro=19 lane=1 max-speed=25g active=true +init set port-map port=46 eth-macro=19 lane=2 max-speed=25g active=true +init set port-map port=47 eth-macro=19 lane=3 max-speed=25g active=true +init set port-map port=48 eth-macro=20 lane=0 max-speed=100g active=true +init set port-map port=49 eth-macro=21 lane=0 max-speed=100g active=true +init set port-map port=50 eth-macro=26 lane=0 max-speed=100g active=true +init set port-map port=51 eth-macro=27 lane=0 max-speed=100g active=true +init set port-map port=52 eth-macro=28 lane=0 max-speed=100g active=true +init set port-map port=53 eth-macro=29 lane=0 max-speed=100g active=true +init set port-map port=129 eth-macro=0 lane=1 max-speed=10g active=true guarantee=true cpi=true +init set port-map port=130 eth-macro=0 lane=0 max-speed=10g active=true guarantee=true cpi=true init-done=true +init start stage task-rsrc +init start stage module +init start stage task +phy set lane-swap portlist=0 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=1 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=2 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=3 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=4 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=5 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=6 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=7 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=8 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=9 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=10 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=11 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=12 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=13 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=14 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=15 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=16 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=17 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=18 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=19 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=20 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=21 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=22 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=23 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=24 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=25 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=26 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=27 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=28 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=29 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=30 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=31 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=32 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=33 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=34 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=35 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=36 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=37 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=38 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=39 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=40 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=41 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=42 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=43 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=44 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=45 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=46 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=47 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=48-53 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=0 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=1 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=2 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=3 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=4 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=5 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=6 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=7 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=8 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=9 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=10 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=11 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=12 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=13 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=14 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=15 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=16 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=17 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=18 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=19 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=20 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=21 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=22 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=23 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=24 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=25 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=26 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=27 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=28 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=29 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=30 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=31 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=32 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=33 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=34 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=35 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=36 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=37 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=38 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=39 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=40 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=41 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=42 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=43 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=44 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=45 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=46 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=47 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=48-53 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set polarity-rev portlist=0 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=1 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=2 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=3 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=4 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=5 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=6 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=7 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=8 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=9 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=10 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=11 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=12 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=13 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=14 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=15 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=16 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=17 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=18 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=19 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=20 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=21 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=22 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=23 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=24 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=25 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=26 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=27 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=28 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=29 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=30 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=31 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=32 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=33 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=34 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=35 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=36 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=37 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=38 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=39 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=40 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=41 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=42 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=43 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=44 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=45 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=46 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=47 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=48 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=49 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=50 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=51 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=52 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=53 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=0 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=1 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=2 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=3 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=4 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=5 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=6 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=7 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=8 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=9 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=10 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=11 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=12 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=13 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=14 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=15 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=16 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=17 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=18 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=19 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=20 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=21 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=22 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=23 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=24 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=25 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=26 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=27 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=28 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=29 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=30 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=31 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=32 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=33 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=34 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=35 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=36 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=37 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=38 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=39 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=40 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=41 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=42 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=43 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=44 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=45 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=46 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=47 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=48 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=49 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=50 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=51 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=52 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=53 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set pre-emphasis portlist=0 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis portlist=0 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis portlist=0 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis portlist=0 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis portlist=4 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis portlist=4 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis portlist=4 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis portlist=4 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis portlist=8 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis portlist=8 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis portlist=8 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis portlist=8 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis portlist=12 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis portlist=12 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis portlist=12 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis portlist=12 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis portlist=16 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis portlist=16 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis portlist=16 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis portlist=16 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis portlist=20 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis portlist=20 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis portlist=20 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis portlist=20 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis portlist=24 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis portlist=24 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis portlist=24 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis portlist=24 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis portlist=28 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis portlist=28 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis portlist=28 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis portlist=28 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis portlist=32 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis portlist=32 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis portlist=32 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis portlist=32 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis portlist=36 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis portlist=36 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis portlist=36 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis portlist=36 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis portlist=40 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis portlist=40 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis portlist=40 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis portlist=40 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis portlist=44 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis portlist=44 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis portlist=44 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis portlist=44 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis portlist=48 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis portlist=48 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis portlist=48 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis portlist=48 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis portlist=49 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis portlist=49 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis portlist=49 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis portlist=49 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis portlist=50 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis portlist=50 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis portlist=50 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis portlist=50 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis portlist=51 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis portlist=51 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis portlist=51 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis portlist=51 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis portlist=52 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis portlist=52 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis portlist=52 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis portlist=52 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set pre-emphasis portlist=53 lane-cnt=4 property=c2 data=0x0.0.0.0 +phy set pre-emphasis portlist=53 lane-cnt=4 property=cn1 data=0x4.4.4.4 +phy set pre-emphasis portlist=53 lane-cnt=4 property=c0 data=0x1E.1E.1E.1E +phy set pre-emphasis portlist=53 lane-cnt=4 property=c1 data=0x2.2.2.2 +phy set mdio portlist=0 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=1 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=2 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=3 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=4 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=5 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=6 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=7 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=8 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=9 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=10 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=11 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=12 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=13 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=14 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=15 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=16 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=17 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=18 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=19 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=20 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=21 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=22 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=23 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=24 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=25 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=26 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=27 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=28 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=29 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=30 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=31 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=32 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=33 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=34 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=35 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=36 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=37 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=38 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=39 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=40 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=41 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=42 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=43 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=44 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=45 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=46 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=47 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=48 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=49 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=50 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=51 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=52 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=53 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=129 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=130 devad=0x1E addr=0x2 data=0x0000 +port set property portlist=0-47 speed=25g +port set property portlist=48-53 speed=100g +port set property portlist=129-130 speed=10g +port set property portlist=0-47 medium-type=cr +port set property portlist=48-53 medium-type=cr4 +port set property portlist=129-130 medium-type=kr +port set adver portlist=129-130 speed-10g-kr +port set property portlist=129-130 an=enable +port set property portlist=129-130 admin=enable +port set property portlist=0-53 admin=disable diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/nephos_opt.dsh b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/nephos_opt.dsh new file mode 100644 index 000000000000..06bda1dc76a4 --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/nephos_opt.dsh @@ -0,0 +1,404 @@ +init start stage low-level +init set port-map port=0 eth-macro=2 lane=0 max-speed=25g active=true +init set port-map port=1 eth-macro=2 lane=1 max-speed=25g active=true +init set port-map port=2 eth-macro=2 lane=2 max-speed=25g active=true +init set port-map port=3 eth-macro=2 lane=3 max-speed=25g active=true +init set port-map port=4 eth-macro=3 lane=0 max-speed=25g active=true +init set port-map port=5 eth-macro=3 lane=1 max-speed=25g active=true +init set port-map port=6 eth-macro=3 lane=2 max-speed=25g active=true +init set port-map port=7 eth-macro=3 lane=3 max-speed=25g active=true +init set port-map port=8 eth-macro=4 lane=0 max-speed=25g active=true +init set port-map port=9 eth-macro=4 lane=1 max-speed=25g active=true +init set port-map port=10 eth-macro=4 lane=2 max-speed=25g active=true +init set port-map port=11 eth-macro=4 lane=3 max-speed=25g active=true +init set port-map port=12 eth-macro=5 lane=0 max-speed=25g active=true +init set port-map port=13 eth-macro=5 lane=1 max-speed=25g active=true +init set port-map port=14 eth-macro=5 lane=2 max-speed=25g active=true +init set port-map port=15 eth-macro=5 lane=3 max-speed=25g active=true +init set port-map port=16 eth-macro=8 lane=0 max-speed=25g active=true +init set port-map port=17 eth-macro=8 lane=1 max-speed=25g active=true +init set port-map port=18 eth-macro=8 lane=2 max-speed=25g active=true +init set port-map port=19 eth-macro=8 lane=3 max-speed=25g active=true +init set port-map port=20 eth-macro=10 lane=0 max-speed=25g active=true +init set port-map port=21 eth-macro=10 lane=1 max-speed=25g active=true +init set port-map port=22 eth-macro=10 lane=2 max-speed=25g active=true +init set port-map port=23 eth-macro=10 lane=3 max-speed=25g active=true +init set port-map port=24 eth-macro=12 lane=0 max-speed=25g active=true +init set port-map port=25 eth-macro=12 lane=1 max-speed=25g active=true +init set port-map port=26 eth-macro=12 lane=2 max-speed=25g active=true +init set port-map port=27 eth-macro=12 lane=3 max-speed=25g active=true +init set port-map port=28 eth-macro=14 lane=0 max-speed=25g active=true +init set port-map port=29 eth-macro=14 lane=1 max-speed=25g active=true +init set port-map port=30 eth-macro=14 lane=2 max-speed=25g active=true +init set port-map port=31 eth-macro=14 lane=3 max-speed=25g active=true +init set port-map port=32 eth-macro=16 lane=0 max-speed=25g active=true +init set port-map port=33 eth-macro=16 lane=1 max-speed=25g active=true +init set port-map port=34 eth-macro=16 lane=2 max-speed=25g active=true +init set port-map port=35 eth-macro=16 lane=3 max-speed=25g active=true +init set port-map port=36 eth-macro=17 lane=0 max-speed=25g active=true +init set port-map port=37 eth-macro=17 lane=1 max-speed=25g active=true +init set port-map port=38 eth-macro=17 lane=2 max-speed=25g active=true +init set port-map port=39 eth-macro=17 lane=3 max-speed=25g active=true +init set port-map port=40 eth-macro=18 lane=0 max-speed=25g active=true +init set port-map port=41 eth-macro=18 lane=1 max-speed=25g active=true +init set port-map port=42 eth-macro=18 lane=2 max-speed=25g active=true +init set port-map port=43 eth-macro=18 lane=3 max-speed=25g active=true +init set port-map port=44 eth-macro=19 lane=0 max-speed=25g active=true +init set port-map port=45 eth-macro=19 lane=1 max-speed=25g active=true +init set port-map port=46 eth-macro=19 lane=2 max-speed=25g active=true +init set port-map port=47 eth-macro=19 lane=3 max-speed=25g active=true +init set port-map port=48 eth-macro=20 lane=0 max-speed=100g active=true +init set port-map port=49 eth-macro=21 lane=0 max-speed=100g active=true +init set port-map port=50 eth-macro=26 lane=0 max-speed=100g active=true +init set port-map port=51 eth-macro=27 lane=0 max-speed=100g active=true +init set port-map port=52 eth-macro=28 lane=0 max-speed=100g active=true +init set port-map port=53 eth-macro=29 lane=0 max-speed=100g active=true +init set port-map port=129 eth-macro=0 lane=1 max-speed=10g active=true guarantee=true cpi=true +init set port-map port=130 eth-macro=0 lane=0 max-speed=10g active=true guarantee=true cpi=true init-done=true +init start stage task-rsrc +init start stage module +init start stage task +phy set lane-swap portlist=0 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=1 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=2 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=3 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=4 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=5 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=6 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=7 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=8 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=9 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=10 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=11 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=12 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=13 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=14 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=15 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=16 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=17 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=18 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=19 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=20 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=21 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=22 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=23 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=24 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=25 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=26 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=27 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=28 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=29 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=30 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=31 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=32 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=33 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=34 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=35 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=36 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=37 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=38 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=39 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=40 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=41 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=42 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=43 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=44 lane-cnt=1 property=tx data=0x0 +phy set lane-swap portlist=45 lane-cnt=1 property=tx data=0x1 +phy set lane-swap portlist=46 lane-cnt=1 property=tx data=0x2 +phy set lane-swap portlist=47 lane-cnt=1 property=tx data=0x3 +phy set lane-swap portlist=48-53 lane-cnt=4 property=tx data=0x03.02.01.00 +phy set lane-swap portlist=0 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=1 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=2 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=3 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=4 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=5 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=6 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=7 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=8 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=9 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=10 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=11 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=12 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=13 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=14 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=15 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=16 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=17 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=18 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=19 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=20 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=21 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=22 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=23 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=24 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=25 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=26 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=27 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=28 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=29 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=30 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=31 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=32 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=33 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=34 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=35 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=36 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=37 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=38 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=39 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=40 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=41 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=42 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=43 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=44 lane-cnt=1 property=rx data=0x1 +phy set lane-swap portlist=45 lane-cnt=1 property=rx data=0x2 +phy set lane-swap portlist=46 lane-cnt=1 property=rx data=0x3 +phy set lane-swap portlist=47 lane-cnt=1 property=rx data=0x0 +phy set lane-swap portlist=48-53 lane-cnt=4 property=rx data=0x03.02.01.00 +phy set polarity-rev portlist=0 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=1 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=2 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=3 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=4 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=5 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=6 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=7 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=8 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=9 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=10 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=11 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=12 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=13 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=14 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=15 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=16 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=17 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=18 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=19 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=20 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=21 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=22 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=23 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=24 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=25 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=26 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=27 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=28 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=29 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=30 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=31 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=32 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=33 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=34 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=35 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=36 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=37 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=38 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=39 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=40 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=41 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=42 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=43 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=44 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=45 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=46 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=47 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev portlist=48 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=49 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=50 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=51 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=52 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=53 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev portlist=0 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=1 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=2 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=3 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=4 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=5 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=6 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=7 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=8 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=9 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=10 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=11 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=12 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=13 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=14 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=15 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=16 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=17 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=18 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=19 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=20 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=21 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=22 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=23 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=24 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=25 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=26 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=27 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=28 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=29 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=30 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=31 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=32 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=33 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=34 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=35 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=36 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=37 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=38 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=39 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=40 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=41 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=42 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=43 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=44 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=45 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=46 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=47 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev portlist=48 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=49 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=50 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=51 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=52 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev portlist=53 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set pre-emphasis portlist=0 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=0 lane-cnt=4 property=cn1 data=0x1.1.1.1 +phy set pre-emphasis portlist=0 lane-cnt=4 property=c0 data=0x1A.1A.1A.1A +phy set pre-emphasis portlist=0 lane-cnt=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis portlist=4 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=4 lane-cnt=4 property=cn1 data=0x1.1.1.1 +phy set pre-emphasis portlist=4 lane-cnt=4 property=c0 data=0x1A.1A.1A.1A +phy set pre-emphasis portlist=4 lane-cnt=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis portlist=8 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=8 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=8 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=8 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=12 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=12 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=12 lane-cnt=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis portlist=12 lane-cnt=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis portlist=16 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=16 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=16 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=16 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=20 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=20 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=20 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=20 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=24 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=24 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=24 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=24 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=28 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=28 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=28 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=28 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=32 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=32 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=32 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=32 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=36 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=36 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=36 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=36 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=40 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=40 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=40 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=40 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=44 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=44 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=44 lane-cnt=4 property=c0 data=0x1C.1C.1C.1C +phy set pre-emphasis portlist=44 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=48 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=48 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=48 lane-cnt=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis portlist=48 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=49 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=49 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=49 lane-cnt=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis portlist=49 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis portlist=50 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=50 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=50 lane-cnt=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis portlist=50 lane-cnt=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis portlist=51 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=51 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=51 lane-cnt=4 property=c0 data=0x1B.1B.1B.1B +phy set pre-emphasis portlist=51 lane-cnt=4 property=c1 data=0x7.7.7.7 +phy set pre-emphasis portlist=52 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=52 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis portlist=52 lane-cnt=4 property=c0 data=0x1A.1A.1A.1A +phy set pre-emphasis portlist=52 lane-cnt=4 property=c1 data=0x8.8.8.8 +phy set pre-emphasis portlist=53 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis portlist=53 lane-cnt=4 property=cn1 data=0x1.1.1.1 +phy set pre-emphasis portlist=53 lane-cnt=4 property=c0 data=0x1A.1A.1A.1A +phy set pre-emphasis portlist=53 lane-cnt=4 property=c1 data=0x7.7.7.7 +phy set mdio portlist=0 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=1 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=2 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=3 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=4 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=5 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=6 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=7 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=8 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=9 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=10 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=11 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=12 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=13 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=14 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=15 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=16 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=17 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=18 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=19 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=20 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=21 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=22 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=23 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=24 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=25 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=26 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=27 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=28 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=29 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=30 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=31 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=32 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=33 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=34 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=35 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=36 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=37 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=38 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=39 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=40 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=41 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=42 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=43 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=44 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=45 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=46 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=47 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=48 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=49 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=50 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=51 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=52 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=53 devad=0x1E addr=0x2 data=0x8000 +phy set mdio portlist=129 devad=0x1E addr=0x2 data=0x0000 +phy set mdio portlist=130 devad=0x1E addr=0x2 data=0x0000 +port set property portlist=0-47 speed=25g +port set property portlist=48-53 speed=100g +port set property portlist=129-130 speed=10g +port set property portlist=0-47 medium-type=sr +port set property portlist=48-53 medium-type=sr4 +port set property portlist=129-130 medium-type=kr +port set adver portlist=129-130 speed-10g-kr +port set property portlist=129-130 an=enable +port set property portlist=129-130 admin=enable +port set property portlist=0-53 admin=disable diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.ini b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.ini index 52c59bc9d297..9b05ff8e63fb 100644 --- a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.ini +++ b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.ini @@ -1,55 +1,55 @@ -# name lanes alias index -Ethernet0 8 Ethernet1/1 0 -Ethernet1 9 Ethernet2/1 1 -Ethernet2 10 Ethernet3/1 2 -Ethernet3 11 Ethernet4/1 3 -Ethernet4 12 Ethernet5/1 4 -Ethernet5 13 Ethernet6/1 5 -Ethernet6 14 Ethernet7/1 6 -Ethernet7 15 Ethernet8/1 7 -Ethernet8 16 Ethernet9/1 8 -Ethernet9 17 Ethernet10/1 9 -Ethernet10 18 Ethernet11/1 10 -Ethernet11 19 Ethernet12/1 11 -Ethernet12 20 Ethernet13/1 12 -Ethernet13 21 Ethernet14/1 13 -Ethernet14 22 Ethernet15/1 14 -Ethernet15 23 Ethernet16/1 15 -Ethernet16 32 Ethernet17/1 16 -Ethernet17 33 Ethernet18/1 17 -Ethernet18 34 Ethernet19/1 18 -Ethernet19 35 Ethernet20/1 19 -Ethernet20 40 Ethernet21/1 20 -Ethernet21 41 Ethernet22/1 21 -Ethernet22 42 Ethernet23/1 22 -Ethernet23 43 Ethernet24/1 23 -Ethernet24 48 Ethernet25/1 24 -Ethernet25 49 Ethernet26/1 25 -Ethernet26 50 Ethernet27/1 26 -Ethernet27 51 Ethernet28/1 27 -Ethernet28 56 Ethernet29/1 28 -Ethernet29 57 Ethernet30/1 29 -Ethernet30 58 Ethernet31/1 30 -Ethernet31 59 Ethernet32/1 31 -Ethernet32 64 Ethernet33/1 32 -Ethernet33 65 Ethernet34/1 33 -Ethernet34 66 Ethernet35/1 34 -Ethernet35 67 Ethernet36/1 35 -Ethernet36 68 Ethernet37/1 36 -Ethernet37 69 Ethernet38/1 37 -Ethernet38 70 Ethernet39/1 38 -Ethernet39 71 Ethernet40/1 39 -Ethernet40 72 Ethernet41/1 40 -Ethernet41 73 Ethernet42/1 41 -Ethernet42 74 Ethernet43/1 42 -Ethernet43 75 Ethernet44/1 43 -Ethernet44 76 Ethernet45/1 44 -Ethernet45 77 Ethernet46/1 45 -Ethernet46 78 Ethernet47/1 46 -Ethernet47 79 Ethernet48/1 47 -Ethernet48 84,85,86,87 Ethernet49/1 48 -Ethernet49 80,81,82,83 Ethernet50/1 49 -Ethernet50 104,105,106,107 Ethernet51/1 50 -Ethernet51 108,109,110,111 Ethernet52/1 51 -Ethernet52 112,113,114,115 Ethernet53/1 52 -Ethernet53 116,117,118,119 Ethernet54/1 53 \ No newline at end of file +# name lanes alias index speed +Ethernet0 8 Ethernet1/1 0 25000 +Ethernet1 9 Ethernet2/1 1 25000 +Ethernet2 10 Ethernet3/1 2 25000 +Ethernet3 11 Ethernet4/1 3 25000 +Ethernet4 12 Ethernet5/1 4 25000 +Ethernet5 13 Ethernet6/1 5 25000 +Ethernet6 14 Ethernet7/1 6 25000 +Ethernet7 15 Ethernet8/1 7 25000 +Ethernet8 16 Ethernet9/1 8 25000 +Ethernet9 17 Ethernet10/1 9 25000 +Ethernet10 18 Ethernet11/1 10 25000 +Ethernet11 19 Ethernet12/1 11 25000 +Ethernet12 20 Ethernet13/1 12 25000 +Ethernet13 21 Ethernet14/1 13 25000 +Ethernet14 22 Ethernet15/1 14 25000 +Ethernet15 23 Ethernet16/1 15 25000 +Ethernet16 32 Ethernet17/1 16 25000 +Ethernet17 33 Ethernet18/1 17 25000 +Ethernet18 34 Ethernet19/1 18 25000 +Ethernet19 35 Ethernet20/1 19 25000 +Ethernet20 40 Ethernet21/1 20 25000 +Ethernet21 41 Ethernet22/1 21 25000 +Ethernet22 42 Ethernet23/1 22 25000 +Ethernet23 43 Ethernet24/1 23 25000 +Ethernet24 48 Ethernet25/1 24 25000 +Ethernet25 49 Ethernet26/1 25 25000 +Ethernet26 50 Ethernet27/1 26 25000 +Ethernet27 51 Ethernet28/1 27 25000 +Ethernet28 56 Ethernet29/1 28 25000 +Ethernet29 57 Ethernet30/1 29 25000 +Ethernet30 58 Ethernet31/1 30 25000 +Ethernet31 59 Ethernet32/1 31 25000 +Ethernet32 64 Ethernet33/1 32 25000 +Ethernet33 65 Ethernet34/1 33 25000 +Ethernet34 66 Ethernet35/1 34 25000 +Ethernet35 67 Ethernet36/1 35 25000 +Ethernet36 68 Ethernet37/1 36 25000 +Ethernet37 69 Ethernet38/1 37 25000 +Ethernet38 70 Ethernet39/1 38 25000 +Ethernet39 71 Ethernet40/1 39 25000 +Ethernet40 72 Ethernet41/1 40 25000 +Ethernet41 73 Ethernet42/1 41 25000 +Ethernet42 74 Ethernet43/1 42 25000 +Ethernet43 75 Ethernet44/1 43 25000 +Ethernet44 76 Ethernet45/1 44 25000 +Ethernet45 77 Ethernet46/1 45 25000 +Ethernet46 78 Ethernet47/1 46 25000 +Ethernet47 79 Ethernet48/1 47 25000 +Ethernet48 84,85,86,87 Ethernet49/1 48 100000 +Ethernet49 80,81,82,83 Ethernet50/1 49 100000 +Ethernet50 104,105,106,107 Ethernet51/1 50 100000 +Ethernet51 108,109,110,111 Ethernet52/1 51 100000 +Ethernet52 112,113,114,115 Ethernet53/1 52 100000 +Ethernet53 116,117,118,119 Ethernet54/1 53 100000 diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.nps b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.nps index e639b4572feb..a4270503f34b 100644 --- a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.nps +++ b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/port_config.nps @@ -410,5 +410,5 @@ port set property portlist=48-53 medium-type=sr4 port set property portlist=129-130 medium-type=kr port set adver portlist=129-130 speed-10g-kr port set property portlist=129-130 an=enable -port set property portlist=0-53,129-130 admin=enable - +port set property unit=0 portlist=129-130 admin=enable +port set property unit=0 portlist=0-53 admin=disable diff --git a/device/accton/x86_64-accton_as7116_54x-r0/led_proc_init.nps b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/proc_init.nps similarity index 100% rename from device/accton/x86_64-accton_as7116_54x-r0/led_proc_init.nps rename to device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/proc_init.nps diff --git a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/sai.profile b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/sai.profile index 880f47910ac1..02d31ffb2d54 100644 --- a/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/sai.profile +++ b/device/accton/x86_64-accton_as7116_54x-r0/Accton-AS7116-54X/sai.profile @@ -1,2 +1,2 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sonic/platform/led_proc_init.nps -SAI_DSH_CONFIG_FILE=/usr/share/sonic/hwsku/port_config.nps +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/proc_init.nps +SAI_DSH_CONFIG_FILE=/usr/share/sonic/hwsku/port_config.nps \ No newline at end of file diff --git a/device/accton/x86_64-accton_as7116_54x-r0/default_sku b/device/accton/x86_64-accton_as7116_54x-r0/default_sku index 829dce6b5748..623c20034d36 100644 --- a/device/accton/x86_64-accton_as7116_54x-r0/default_sku +++ b/device/accton/x86_64-accton_as7116_54x-r0/default_sku @@ -1 +1 @@ -Accton-AS7116-54X t1 +Accton-AS7116-54X t1 \ No newline at end of file diff --git a/device/accton/x86_64-accton_as7116_54x-r0/fancontrol b/device/accton/x86_64-accton_as7116_54x-r0/fancontrol new file mode 100644 index 000000000000..8b1798edcc00 --- /dev/null +++ b/device/accton/x86_64-accton_as7116_54x-r0/fancontrol @@ -0,0 +1,10 @@ +INTERVAL=10 +FCTEMPS=/sys/bus/i2c/devices/1-0063/fan_duty_cycle_percentage=/sys/bus/i2c/devices/20-004a/hwmon/hwmon*/temp1_input /sys/bus/i2c/devices/1-0063/fan_duty_cycle_percentage=/sys/bus/i2c/devices/19-0049/hwmon/hwmon*/temp1_input /sys/bus/i2c/devices/1-0063/fan_duty_cycle_percentage=/sys/bus/i2c/devices/17-004b/hwmon/hwmon*/temp1_input +FCFANS=/sys/bus/i2c/devices/1-0063/fan_duty_cycle_percentage=/sys/bus/i2c/devices/1-0063/fan1_input /sys/bus/i2c/devices/1-0063/fan_duty_cycle_percentage=/sys/bus/i2c/devices/1-0063/fan2_input +/sys/bus/i2c/devices/1-0063/fan_duty_cycle_percentage=/sys/bus/i2c/devices/1-0063/fan3_input /sys/bus/i2c/devices/1-0063/fan_duty_cycle_percentage=/sys/bus/i2c/devices/1-0063/fan4_input /sys/bus/i2c/devices/1-0063/fan_duty_cycle_percentage=/sys/bus/i2c/devices/1-0063/fan5_input +MINTEMP=/sys/bus/i2c/devices/1-0063/fan_duty_cycle_percentage=49 +MAXTEMP=/sys/bus/i2c/devices/1-0063/fan_duty_cycle_percentage=58 +MINSTART=/sys/bus/i2c/devices/1-0063/fan_duty_cycle_percentage=100 +MINSTOP=/sys/bus/i2c/devices/1-0063/fan_duty_cycle_percentage=40 +MINPWM=/sys/bus/i2c/devices/1-0063/fan_duty_cycle_percentage=40 +MAXPWM=/sys/bus/i2c/devices/1-0063/fan_duty_cycle_percentage=100 \ No newline at end of file diff --git a/device/accton/x86_64-accton_as7116_54x-r0/plugins/eeprom.py b/device/accton/x86_64-accton_as7116_54x-r0/plugins/eeprom.py index 1e7d1046d93d..f5637458720e 100644 --- a/device/accton/x86_64-accton_as7116_54x-r0/plugins/eeprom.py +++ b/device/accton/x86_64-accton_as7116_54x-r0/plugins/eeprom.py @@ -18,4 +18,4 @@ class board(eeprom_tlvinfo.TlvInfoDecoder): _TLV_INFO_MAX_LEN = 256 def __init__(self, name, path, cpld_root, ro): self.eeprom_path = "/sys/bus/i2c/devices/0-0056/eeprom" - super(board, self).__init__(self.eeprom_path, 0, '', True) + super(board, self).__init__(self.eeprom_path, 0, '', True) \ No newline at end of file diff --git a/device/accton/x86_64-accton_as7116_54x-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7116_54x-r0/plugins/sfputil.py index 1a6c1103891e..2faf4d5dfacf 100644 --- a/device/accton/x86_64-accton_as7116_54x-r0/plugins/sfputil.py +++ b/device/accton/x86_64-accton_as7116_54x-r0/plugins/sfputil.py @@ -6,6 +6,8 @@ except ImportError, e: raise ImportError (str(e) + "- required module not found") +SFP_STATUS_INSERTED = '1' +SFP_STATUS_REMOVED = '0' class SfpUtil(SfpUtilBase): """Platform specific SfpUtill class""" @@ -75,17 +77,21 @@ class SfpUtil(SfpUtilBase): _qsfp_ports = range(_qsfp_port_start, _ports_in_block + 1) + _present_status = dict() + def __init__(self): eeprom_path = '/sys/bus/i2c/devices/{0}-0050/sfp_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) - + self._port_to_eeprom_mapping[x] = port_eeprom_path + self._present_status[x] = SFP_STATUS_REMOVED + + SfpUtilBase.__init__(self) + def reset(self, port_num): # Check for invalid port_num - if port_num < self._port_start or port_num > self._port_end: + if port_num < self._qsfp_port_start or port_num > self._port_end: + print "Error: port %d is not qsfp port" % port_num return False path = "/sys/bus/i2c/devices/{0}-0050/sfp_port_reset" @@ -111,7 +117,7 @@ def set_low_power_mode(self, port_nuM, lpmode): def get_low_power_mode(self, port_num): raise NotImplementedError - + def get_presence(self, port_num): # Check for invalid port_num if port_num < self._port_start or port_num > self._port_end: @@ -151,3 +157,15 @@ def qsfp_ports(self): @property def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping + + def get_transceiver_change_event(self, timeout=0): + ret_present = dict() + for phy_port in range(self._port_start, self._port_end + 1): + last_present_status = SFP_STATUS_INSERTED if self.get_presence(phy_port) else SFP_STATUS_REMOVED + if self._present_status[phy_port] != last_present_status: + ret_present[phy_port] = last_present_status + self._present_status[phy_port] = last_present_status + + time.sleep(2) + + return True, ret_present \ No newline at end of file diff --git a/device/accton/x86_64-accton_as7116_54x-r0/sensors.conf b/device/accton/x86_64-accton_as7116_54x-r0/sensors.conf index 9edb51a9e72d..ba976ef14536 100644 --- a/device/accton/x86_64-accton_as7116_54x-r0/sensors.conf +++ b/device/accton/x86_64-accton_as7116_54x-r0/sensors.conf @@ -10,4 +10,4 @@ chip "as7116_54x_fan-*" label fan7 "rear fan 2" label fan8 "rear fan 3" label fan9 "rear fan 4" - label fan10 "rear fan 5" + label fan10 "rear fan 5" \ No newline at end of file diff --git a/device/accton/x86_64-accton_as7315_27xb-r0/Accton-AS7315-27XB/port_config.ini b/device/accton/x86_64-accton_as7315_27xb-r0/Accton-AS7315-27XB/port_config.ini new file mode 100644 index 000000000000..26d49cdde58c --- /dev/null +++ b/device/accton/x86_64-accton_as7315_27xb-r0/Accton-AS7315-27XB/port_config.ini @@ -0,0 +1,28 @@ +# name lanes alias index speed +Ethernet0 28 twentyfiveGigE1 1 25000 +Ethernet1 29 twentyfiveGigE2 2 25000 +Ethernet2 30 twentyfiveGigE3 3 25000 +Ethernet3 31 twentyfiveGigE4 4 25000 +Ethernet4 24 twentyfiveGigE5 5 10000 +Ethernet5 25 twentyfiveGigE6 6 10000 +Ethernet6 26 twentyfiveGigE7 7 10000 +Ethernet7 27 twentyfiveGigE8 8 10000 +Ethernet8 20 twentyfiveGigE9 9 10000 +Ethernet9 21 twentyfiveGigE10 10 10000 +Ethernet10 22 twentyfiveGigE11 11 10000 +Ethernet11 23 twentyfiveGigE12 12 10000 +Ethernet12 16 twentyfiveGigE13 13 10000 +Ethernet13 17 twentyfiveGigE14 14 10000 +Ethernet14 18 twentyfiveGigE15 15 10000 +Ethernet15 19 twentyfiveGigE16 16 10000 +Ethernet16 4 twentyfiveGigE17 17 10000 +Ethernet17 5 twentyfiveGigE18 18 10000 +Ethernet18 6 twentyfiveGigE19 19 10000 +Ethernet19 7 twentyfiveGigE20 20 10000 +Ethernet20 0 twentyfiveGigE21 21 10000 +Ethernet21 1 twentyfiveGigE22 22 10000 +Ethernet22 2 twentyfiveGigE23 23 10000 +Ethernet23 3 twentyfiveGigE24 24 10000 +Ethernet24 67,68,69,70 twentyfiveGigE25 25 100000 +Ethernet25 71,72,73,74 twentyfiveGigE26 26 100000 +Ethernet26 75,76,77,78 twentyfiveGigE27 27 100000 diff --git a/device/accton/x86_64-accton_as7315_27xb-r0/Accton-AS7315-27XB/qax-as7315-20x10G+4x25G+3x100G.config.bcm b/device/accton/x86_64-accton_as7315_27xb-r0/Accton-AS7315-27XB/qax-as7315-20x10G+4x25G+3x100G.config.bcm new file mode 100644 index 000000000000..eef4d987e8ed --- /dev/null +++ b/device/accton/x86_64-accton_as7315_27xb-r0/Accton-AS7315-27XB/qax-as7315-20x10G+4x25G+3x100G.config.bcm @@ -0,0 +1,519 @@ +# accton_as7312_54x 48x25G+6x100G SDK config +os=unix +schan_intr_enable=0 + +l2_mem_entries=40960 +l2xmsg_mode=1 +l3_mem_entries=40960 +mem_cache_enable=0 +parity_correction=0 +parity_enable=0 +mmu_lossless=1 + +pbmp_oversubscribe=0x0407ffc00ff00ff003fc3ffc00200222 +pbmp_xport_xe=0x0407ffd00ff00ff403fc3ffc00200222 + +## FC10 ## +dport_map_port_42=1 +dport_map_port_43=2 +dport_map_port_44=3 +dport_map_port_45=4 + +## FC12 ## +dport_map_port_50=5 +dport_map_port_51=6 +dport_map_port_52=7 +dport_map_port_53=8 + +## FC13 ## +dport_map_port_54=9 +dport_map_port_55=10 +dport_map_port_56=11 +dport_map_port_57=12 + +## FC16 ## +dport_map_port_68=13 +dport_map_port_69=14 +dport_map_port_70=15 +dport_map_port_71=16 + +## FC8 ## +dport_map_port_34=17 +dport_map_port_35=18 +dport_map_port_36=19 +dport_map_port_37=20 + +## FC9 ## +dport_map_port_38=21 +dport_map_port_39=22 +dport_map_port_40=23 +dport_map_port_41=24 + +## FC17 ## +dport_map_port_72=25 +dport_map_port_73=26 +dport_map_port_74=27 +dport_map_port_75=28 + +## FC20 ## +dport_map_port_84=29 +dport_map_port_85=30 +dport_map_port_86=31 +dport_map_port_87=32 + +## FC21 ## +dport_map_port_88=33 +dport_map_port_89=34 +dport_map_port_90=35 +dport_map_port_91=36 + +## FC24 ## +dport_map_port_102=37 +dport_map_port_103=38 +dport_map_port_104=39 +dport_map_port_105=40 + +## FC25 ## +dport_map_port_106=41 +dport_map_port_107=42 +dport_map_port_108=43 +dport_map_port_109=44 + +## FC26 ## +dport_map_port_110=45 +dport_map_port_111=46 +dport_map_port_112=47 +dport_map_port_113=48 + +## FC1 ## +dport_map_port_5=49 + +## FC0 ## +dport_map_port_1=50 + +## FC27 ## +dport_map_port_114=51 + +## FC5 ## +dport_map_port_21=52 + +## FC2 ## +dport_map_port_9=53 + +## FC29 ## +dport_map_port_122=54 + +#for KR +#dport_map_port_66=55 +#dport_map_port_100=56 + +/* Port Map */ +## FC10 ## +portmap_42=41:25 +portmap_43=42:25 +portmap_44=43:25 +portmap_45=44:25 + +## FC12 ## +portmap_50=49:25 +portmap_51=50:25 +portmap_52=51:25 +portmap_53=52:25 + + +## FC13 ## +portmap_54=53:25 +portmap_55=54:25 +portmap_56=55:25 +portmap_57=56:25 + +## FC16 ## +portmap_68=65:25 +portmap_69=66:25 +portmap_70=67:25 +portmap_71=68:25 + + +## FC8 ## +portmap_34=33:25 +portmap_35=34:25 +portmap_36=35:25 +portmap_37=36:25 + +## FC9 ## +portmap_38=37:25 +portmap_39=38:25 +portmap_40=39:25 +portmap_41=40:25 + +## FC17 ## +portmap_72=69:25 +portmap_73=70:25 +portmap_74=71:25 +portmap_75=72:25 + +## FC20 ## +portmap_84=81:25 +portmap_85=82:25 +portmap_86=83:25 +portmap_87=84:25 + + +## FC21 ## +portmap_88=85:25 +portmap_89=86:25 +portmap_90=87:25 +portmap_91=88:25 + +## FC24 ## +portmap_102=97:25 +portmap_103=98:25 +portmap_104=99:25 +portmap_105=100:25 + +## FC25 ## +portmap_106=101:25 +portmap_107=102:25 +portmap_108=103:25 +portmap_109=104:25 + +## FC26 ## +portmap_110=105:25 +portmap_111=106:25 +portmap_112=107:25 +portmap_113=108:25 + +## FC1 ## +portmap_5=5:100 + +## FC0 ## +portmap_1=1:100 + +## FC27 ## +portmap_114=109:100 + +## FC5 ## +portmap_21=21:100 + +## FC2 ## +portmap_9=9:100 + +## FC29 ## +portmap_122=117:100 + +# CPU to MAC +# TSC-E management port 1 +#portmap_66=129:10 +# TSC-E management port 2 +#portmap_100=131:10 + +xgxs_rx_lane_map_42=0x2310 +xgxs_rx_lane_map_43=0x2310 +xgxs_rx_lane_map_44=0x2310 +xgxs_rx_lane_map_45=0x2310 +xgxs_rx_lane_map_50=0x3210 +xgxs_rx_lane_map_51=0x3210 +xgxs_rx_lane_map_52=0x3210 +xgxs_rx_lane_map_53=0x3210 +xgxs_rx_lane_map_54=0x3210 +xgxs_rx_lane_map_55=0x3210 +xgxs_rx_lane_map_56=0x3210 +xgxs_rx_lane_map_57=0x3210 +xgxs_rx_lane_map_68=0x0123 +xgxs_rx_lane_map_69=0x0123 +xgxs_rx_lane_map_70=0x0123 +xgxs_rx_lane_map_71=0x0123 +xgxs_rx_lane_map_34=0x0123 +xgxs_rx_lane_map_35=0x0123 +xgxs_rx_lane_map_36=0x0123 +xgxs_rx_lane_map_37=0x0123 +xgxs_rx_lane_map_38=0x0123 +xgxs_rx_lane_map_39=0x0123 +xgxs_rx_lane_map_40=0x0123 +xgxs_rx_lane_map_41=0x0123 +xgxs_rx_lane_map_72=0x3210 +xgxs_rx_lane_map_73=0x3210 +xgxs_rx_lane_map_74=0x3210 +xgxs_rx_lane_map_75=0x3210 +xgxs_rx_lane_map_84=0x1032 +xgxs_rx_lane_map_85=0x1032 +xgxs_rx_lane_map_86=0x1032 +xgxs_rx_lane_map_87=0x1032 +xgxs_rx_lane_map_88=0x2301 +xgxs_rx_lane_map_89=0x2301 +xgxs_rx_lane_map_90=0x2301 +xgxs_rx_lane_map_91=0x2301 +xgxs_rx_lane_map_102=0x0123 +xgxs_rx_lane_map_103=0x0123 +xgxs_rx_lane_map_104=0x0123 +xgxs_rx_lane_map_105=0x0123 +xgxs_rx_lane_map_106=0x3210 +xgxs_rx_lane_map_107=0x3210 +xgxs_rx_lane_map_108=0x3210 +xgxs_rx_lane_map_109=0x3210 +xgxs_rx_lane_map_110=0x1032 +xgxs_rx_lane_map_111=0x1032 +xgxs_rx_lane_map_112=0x1032 +xgxs_rx_lane_map_113=0x1032 +xgxs_rx_lane_map_5=0x3210 +xgxs_rx_lane_map_1=0x3210 +xgxs_rx_lane_map_114=0x0123 +xgxs_rx_lane_map_21=0x0213 +xgxs_rx_lane_map_9=0x3210 +xgxs_rx_lane_map_122=0x1230 + +xgxs_tx_lane_map_42=0x0132 +xgxs_tx_lane_map_43=0x0132 +xgxs_tx_lane_map_44=0x0132 +xgxs_tx_lane_map_45=0x0132 +xgxs_tx_lane_map_50=0x3210 +xgxs_tx_lane_map_51=0x3210 +xgxs_tx_lane_map_52=0x3210 +xgxs_tx_lane_map_53=0x3210 +xgxs_tx_lane_map_54=0x3210 +xgxs_tx_lane_map_55=0x3210 +xgxs_tx_lane_map_56=0x3210 +xgxs_tx_lane_map_57=0x3210 +xgxs_tx_lane_map_68=0x0123 +xgxs_tx_lane_map_69=0x0123 +xgxs_tx_lane_map_70=0x0123 +xgxs_tx_lane_map_71=0x0123 +xgxs_tx_lane_map_34=0x0123 +xgxs_tx_lane_map_35=0x0123 +xgxs_tx_lane_map_36=0x0123 +xgxs_tx_lane_map_37=0x0123 +xgxs_tx_lane_map_38=0x0123 +xgxs_tx_lane_map_39=0x0123 +xgxs_tx_lane_map_40=0x0123 +xgxs_tx_lane_map_41=0x0123 +xgxs_tx_lane_map_72=0x0123 +xgxs_tx_lane_map_73=0x0123 +xgxs_tx_lane_map_74=0x0123 +xgxs_tx_lane_map_75=0x0123 +xgxs_tx_lane_map_84=0x0123 +xgxs_tx_lane_map_85=0x0123 +xgxs_tx_lane_map_86=0x0123 +xgxs_tx_lane_map_87=0x0123 +xgxs_tx_lane_map_88=0x2301 +xgxs_tx_lane_map_89=0x2301 +xgxs_tx_lane_map_90=0x2301 +xgxs_tx_lane_map_91=0x2301 +xgxs_tx_lane_map_102=0x0123 +xgxs_tx_lane_map_103=0x0123 +xgxs_tx_lane_map_104=0x0123 +xgxs_tx_lane_map_105=0x0123 +xgxs_tx_lane_map_106=0x3210 +xgxs_tx_lane_map_107=0x3210 +xgxs_tx_lane_map_108=0x3210 +xgxs_tx_lane_map_109=0x3210 +xgxs_tx_lane_map_110=0x1032 +xgxs_tx_lane_map_111=0x1032 +xgxs_tx_lane_map_112=0x1032 +xgxs_tx_lane_map_113=0x1032 +xgxs_tx_lane_map_5=0x3210 +xgxs_tx_lane_map_1=0x3210 +xgxs_tx_lane_map_114=0x0123 +xgxs_tx_lane_map_21=0x3210 +xgxs_tx_lane_map_9=0x3210 +xgxs_tx_lane_map_122=0x3210 + +#Polarity RX +phy_xaui_rx_polarity_flip_34=0x1 +phy_xaui_rx_polarity_flip_35=0x1 +phy_xaui_rx_polarity_flip_36=0x1 +phy_xaui_rx_polarity_flip_37=0x1 +phy_xaui_rx_polarity_flip_38=0x1 +phy_xaui_rx_polarity_flip_39=0x1 +phy_xaui_rx_polarity_flip_40=0x1 +phy_xaui_rx_polarity_flip_41=0x1 +phy_xaui_rx_polarity_flip_84=0x1 +phy_xaui_rx_polarity_flip_85=0x0 +phy_xaui_rx_polarity_flip_86=0x1 +phy_xaui_rx_polarity_flip_87=0x0 +phy_xaui_rx_polarity_flip_88=0x1 +phy_xaui_rx_polarity_flip_89=0x0 +phy_xaui_rx_polarity_flip_90=0x1 +phy_xaui_rx_polarity_flip_91=0x1 +phy_xaui_rx_polarity_flip_102=0x0 +phy_xaui_rx_polarity_flip_103=0x0 +phy_xaui_rx_polarity_flip_104=0x1 +phy_xaui_rx_polarity_flip_105=0x0 +phy_xaui_rx_polarity_flip_122=0xf +#Polarity TX +phy_xaui_tx_polarity_flip_42=0x1 +phy_xaui_tx_polarity_flip_43=0x1 +phy_xaui_tx_polarity_flip_44=0x1 +phy_xaui_tx_polarity_flip_45=0x1 +phy_xaui_tx_polarity_flip_34=0x1 +phy_xaui_tx_polarity_flip_35=0x1 +phy_xaui_tx_polarity_flip_36=0x1 +phy_xaui_tx_polarity_flip_37=0x1 +phy_xaui_tx_polarity_flip_38=0x0 +phy_xaui_tx_polarity_flip_39=0x1 +phy_xaui_tx_polarity_flip_40=0x0 +phy_xaui_tx_polarity_flip_41=0x1 +phy_xaui_tx_polarity_flip_72=0x1 +phy_xaui_tx_polarity_flip_73=0x1 +phy_xaui_tx_polarity_flip_74=0x1 +phy_xaui_tx_polarity_flip_75=0x1 +phy_xaui_tx_polarity_flip_84=0x1 +phy_xaui_tx_polarity_flip_85=0x1 +phy_xaui_tx_polarity_flip_86=0x1 +phy_xaui_tx_polarity_flip_87=0x1 +phy_xaui_tx_polarity_flip_88=0x1 +phy_xaui_tx_polarity_flip_89=0x1 +phy_xaui_tx_polarity_flip_90=0x1 +phy_xaui_tx_polarity_flip_91=0x1 +phy_xaui_tx_polarity_flip_102=0x1 +phy_xaui_tx_polarity_flip_103=0x1 +phy_xaui_tx_polarity_flip_104=0x1 +phy_xaui_tx_polarity_flip_105=0x1 +phy_xaui_tx_polarity_flip_122=0xb + +#Driver Current +serdes_driver_current_42=0x8 +serdes_driver_current_43=0x8 +serdes_driver_current_44=0x8 +serdes_driver_current_45=0x8 +serdes_driver_current_50=0x8 +serdes_driver_current_51=0x8 +serdes_driver_current_52=0x8 +serdes_driver_current_53=0x8 +serdes_driver_current_54=0x8 +serdes_driver_current_55=0x8 +serdes_driver_current_56=0x8 +serdes_driver_current_57=0x8 +serdes_driver_current_68=0x8 +serdes_driver_current_69=0x8 +serdes_driver_current_70=0x8 +serdes_driver_current_71=0x8 +serdes_driver_current_34=0x8 +serdes_driver_current_35=0x8 +serdes_driver_current_36=0x8 +serdes_driver_current_37=0x8 +serdes_driver_current_38=0x8 +serdes_driver_current_39=0x8 +serdes_driver_current_40=0x8 +serdes_driver_current_41=0x8 +serdes_driver_current_72=0x8 +serdes_driver_current_73=0x8 +serdes_driver_current_74=0x8 +serdes_driver_current_75=0x8 +serdes_driver_current_84=0x8 +serdes_driver_current_85=0x8 +serdes_driver_current_86=0x8 +serdes_driver_current_87=0x8 +serdes_driver_current_88=0x8 +serdes_driver_current_89=0x8 +serdes_driver_current_90=0x8 +serdes_driver_current_91=0x8 +serdes_driver_current_102=0x8 +serdes_driver_current_103=0x8 +serdes_driver_current_104=0x8 +serdes_driver_current_105=0x8 +serdes_driver_current_106=0x8 +serdes_driver_current_107=0x8 +serdes_driver_current_108=0x8 +serdes_driver_current_109=0x8 +serdes_driver_current_110=0x8 +serdes_driver_current_111=0x8 +serdes_driver_current_112=0x8 +serdes_driver_current_113=0x8 +serdes_driver_current_lane0_5=0x8 +serdes_driver_current_lane1_5=0x8 +serdes_driver_current_lane2_5=0x8 +serdes_driver_current_lane3_5=0x8 +serdes_driver_current_lane0_1=0x8 +serdes_driver_current_lane1_1=0x8 +serdes_driver_current_lane2_1=0x8 +serdes_driver_current_lane3_1=0x8 +serdes_driver_current_lane0_114=0x8 +serdes_driver_current_lane1_114=0x8 +serdes_driver_current_lane2_114=0x8 +serdes_driver_current_lane3_114=0x8 +serdes_driver_current_lane0_21=0x8 +serdes_driver_current_lane1_21=0x8 +serdes_driver_current_lane2_21=0x8 +serdes_driver_current_lane3_21=0x8 +serdes_driver_current_lane0_9=0x8 +serdes_driver_current_lane1_9=0x8 +serdes_driver_current_lane2_9=0x8 +serdes_driver_current_lane3_9=0x8 +serdes_driver_current_lane0_122=0x8 +serdes_driver_current_lane1_122=0x8 +serdes_driver_current_lane2_122=0x8 +serdes_driver_current_lane3_122=0x8 + +#Preemphasis +serdes_preemphasis_42=0x264006 +serdes_preemphasis_43=0x264006 +serdes_preemphasis_44=0x254106 +serdes_preemphasis_45=0x254106 +serdes_preemphasis_50=0x254106 +serdes_preemphasis_51=0x254106 +serdes_preemphasis_52=0x254106 +serdes_preemphasis_53=0x254106 +serdes_preemphasis_54=0x254106 +serdes_preemphasis_55=0x254106 +serdes_preemphasis_56=0x254106 +serdes_preemphasis_57=0x234306 +serdes_preemphasis_68=0x234306 +serdes_preemphasis_69=0x204606 +serdes_preemphasis_70=0x204606 +serdes_preemphasis_71=0x204606 +serdes_preemphasis_34=0x234306 +serdes_preemphasis_35=0x234306 +serdes_preemphasis_36=0x234306 +serdes_preemphasis_37=0x234306 +serdes_preemphasis_38=0x234306 +serdes_preemphasis_39=0x234306 +serdes_preemphasis_40=0x234306 +serdes_preemphasis_41=0x234306 +serdes_preemphasis_72=0x1e4806 +serdes_preemphasis_73=0x1e4806 +serdes_preemphasis_74=0x1e4806 +serdes_preemphasis_75=0x1e4806 +serdes_preemphasis_84=0x1e4806 +serdes_preemphasis_85=0x1a4c06 +serdes_preemphasis_86=0x1a4c06 +serdes_preemphasis_87=0x1b4b06 +serdes_preemphasis_88=0x1b4b06 +serdes_preemphasis_89=0x1e4806 +serdes_preemphasis_90=0x1e4806 +serdes_preemphasis_91=0x1e4806 +serdes_preemphasis_102=0x1e4806 +serdes_preemphasis_103=0x1e4806 +serdes_preemphasis_104=0x1e4806 +serdes_preemphasis_105=0x1e4806 +serdes_preemphasis_106=0x1e4806 +serdes_preemphasis_107=0x1e4806 +serdes_preemphasis_108=0x1e4806 +serdes_preemphasis_109=0x1e4806 +serdes_preemphasis_110=0x1e4806 +serdes_preemphasis_111=0x1d4906 +serdes_preemphasis_112=0x234306 +serdes_preemphasis_113=0x1f4706 +serdes_preemphasis_lane0_5=0x294106 +serdes_preemphasis_lane1_5=0x294106 +serdes_preemphasis_lane2_5=0x294106 +serdes_preemphasis_lane3_5=0x294106 +serdes_preemphasis_lane0_1=0x294106 +serdes_preemphasis_lane1_1=0x294106 +serdes_preemphasis_lane2_1=0x294106 +serdes_preemphasis_lane3_1=0x294106 +serdes_preemphasis_lane0_114=0x2a4006 +serdes_preemphasis_lane1_114=0x2a4006 +serdes_preemphasis_lane2_114=0x2a4006 +serdes_preemphasis_lane3_114=0x2a4006 +serdes_preemphasis_lane0_21=0x2c3c08 +serdes_preemphasis_lane1_21=0x2a4006 +serdes_preemphasis_lane2_21=0x2a4006 +serdes_preemphasis_lane3_21=0x2a4006 +serdes_preemphasis_lane0_9=0x284206 +serdes_preemphasis_lane1_9=0x284206 +serdes_preemphasis_lane2_9=0x284206 +serdes_preemphasis_lane3_9=0x284206 +serdes_preemphasis_lane0_122=0x283e06 +serdes_preemphasis_lane1_122=0x283e06 +serdes_preemphasis_lane2_122=0x283e06 +serdes_preemphasis_lane3_122=0x294601 diff --git a/device/accton/x86_64-accton_as7315_27xb-r0/Accton-AS7315-27XB/sai.profile b/device/accton/x86_64-accton_as7315_27xb-r0/Accton-AS7315-27XB/sai.profile new file mode 100644 index 000000000000..191b27dac2f8 --- /dev/null +++ b/device/accton/x86_64-accton_as7315_27xb-r0/Accton-AS7315-27XB/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/qax-as7315-20x10G+4x25G+3x100G.config.bcm diff --git a/device/accton/x86_64-accton_as7315_27xb-r0/default_sku b/device/accton/x86_64-accton_as7315_27xb-r0/default_sku new file mode 100644 index 000000000000..5c1bb0b4a47a --- /dev/null +++ b/device/accton/x86_64-accton_as7315_27xb-r0/default_sku @@ -0,0 +1 @@ +Accton-AS7315-27XB t1 diff --git a/device/accton/x86_64-accton_as7315_27xb-r0/installer.conf b/device/accton/x86_64-accton_as7315_27xb-r0/installer.conf new file mode 100644 index 000000000000..9fa12f888545 --- /dev/null +++ b/device/accton/x86_64-accton_as7315_27xb-r0/installer.conf @@ -0,0 +1,2 @@ +CONSOLE_SPEED=115200 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="tg3.short_preamble=1 tg3.bcm5718s_reset=1" diff --git a/device/accton/x86_64-accton_as7315_27xb-r0/led_proc_init.soc b/device/accton/x86_64-accton_as7315_27xb-r0/led_proc_init.soc new file mode 100755 index 000000000000..790ab9cfc931 --- /dev/null +++ b/device/accton/x86_64-accton_as7315_27xb-r0/led_proc_init.soc @@ -0,0 +1,24 @@ +# accton_as7315_27xb LED macro init SOC +######################################### +## LED program for BCM88470 Qumran-AX +######################################### +led 0 stop +led 0 prog \ + 02 FC 42 03 02 F9 42 00 02 00 67 26 67 2D 86 F9 \ + 67 2D 86 F9 67 2D 86 F9 67 2D 86 F9 06 F9 D2 24 \ + 74 0A 86 FB 3A 7E 67 59 67 41 67 69 57 67 59 67 \ + 41 67 72 1A 00 75 7B 1A 01 75 3D 77 50 67 59 77 \ + 46 12 A0 F8 15 57 80 28 32 00 32 01 B7 97 75 7F \ + 16 FB 06 FC C8 70 7F 77 7B 06 F9 C2 FC 98 98 12 \ + E0 F8 05 16 F9 CA 03 F1 57 1A 07 27 87 1A 06 27 \ + 87 57 1A 05 27 87 1A 04 27 87 57 32 0E 87 57 32 \ + 0F 87 57 00 00 00 00 00 00 00 00 00 00 00 00 00 \ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +led 0 start +led auto on diff --git a/device/accton/x86_64-accton_as7315_27xb-r0/plugins/eeprom.py b/device/accton/x86_64-accton_as7315_27xb-r0/plugins/eeprom.py new file mode 100644 index 000000000000..171593068ae5 --- /dev/null +++ b/device/accton/x86_64-accton_as7315_27xb-r0/plugins/eeprom.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/4-0057/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/accton/x86_64-accton_as7315_27xb-r0/plugins/psuutil.py b/device/accton/x86_64-accton_as7315_27xb-r0/plugins/psuutil.py new file mode 100644 index 000000000000..7ec16640e5a8 --- /dev/null +++ b/device/accton/x86_64-accton_as7315_27xb-r0/plugins/psuutil.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +############################################################################# +# Accton +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# +############################################################################# + +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""" + + def __init__(self): + PsuBase.__init__(self) + + self.psu_path = "/sys/bus/i2c/devices/" + self.psu_presence = "/psu_present" + self.psu_oper_status = "/psu_power_good" + self.psu_mapping = { + 1: "13-0053", + 2: "12-0050", + } + + def get_num_psus(self): + return len(self.psu_mapping) + + def get_psu_status(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index]+self.psu_oper_status + try: + with open(node, 'r') as power_status: + status = int(power_status.read()) + except IOError: + return False + + return status == 1 + + def get_psu_presence(self, index): + if index is None: + return False + + status = 0 + node = self.psu_path + self.psu_mapping[index] + self.psu_presence + try: + with open(node, 'r') as presence_status: + status = int(presence_status.read()) + except IOError: + return False + + return status == 1 diff --git a/device/accton/x86_64-accton_as7315_27xb-r0/plugins/sfputil.py b/device/accton/x86_64-accton_as7315_27xb-r0/plugins/sfputil.py new file mode 100644 index 000000000000..1d777d25aee7 --- /dev/null +++ b/device/accton/x86_64-accton_as7315_27xb-r0/plugins/sfputil.py @@ -0,0 +1,254 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +try: + import time + import string + import pprint + from ctypes import create_string_buffer + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + +#from xcvrd +SFP_STATUS_REMOVED = '0' +SFP_STATUS_INSERTED = '1' + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + PORT_START = 1 + PORT_END = 27 + PORTS_IN_BLOCK = 27 + QSFP_PORT_START = 25 + QSFP_PORT_END = 27 + + BASE_VAL_PATH = "/sys/class/i2c-adapter/i2c-{0}/{1}-0050/" + + _port_to_is_present = {} + _port_to_lp_mode = {} + + _port_to_eeprom_mapping = {} + _cpld_mapping = [ "8-0063", "7-0064"] + + _port_to_i2c_mapping = { + 1: 26, + 2: 27, + 3: 28, + 4: 29, + 5: 30, + 6: 31, + 7: 32, + 8: 33, + 9: 34, + 10: 35, + 11: 36, + 12: 37, + 13: 38, + 14: 39, + 15: 40, + 16: 41, + 17: 42, + 18: 43, + 19: 44, + 20: 45, + 21: 46, + 22: 47, + 23: 48, + 24: 49, + 25: 21, #QSFP + 26: 22, + 27: 23, + } + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_port_start(self): + return self.QSFP_PORT_START + + @property + def qsfp_port_end(self): + return self.QSFP_PORT_END + + @property + def qsfp_ports(self): + return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom' + for x in range(self.port_start, self.port_end+1): + self.port_to_eeprom_mapping[x] = eeprom_path.format( + self._port_to_i2c_mapping[x]) + + self.get_transceiver_change_event() + SfpUtilBase.__init__(self) + + def get_cpld_num(self, port_num): + cpld_i = 0 + if (port_num >= self.qsfp_port_start): + cpld_i = 1 + + return cpld_i + + 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 + + cpld_i = self.get_cpld_num(port_num) + cpld_ps = self._cpld_mapping[cpld_i] + path = "/sys/bus/i2c/devices/{0}/present_{1}" + index = ((port_num-1)%24) +1 + port_ps = path.format(cpld_ps, index) + + try: + val_file = open(port_ps) + 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.qsfp_port_start or port_num > self.qsfp_port_end: + return False + + try: + eeprom = None + + if not self.get_presence(port_num): + return False + + eeprom = open(self.port_to_eeprom_mapping[port_num], "rb") + eeprom.seek(93) + lpmode = ord(eeprom.read(1)) + + if ((lpmode & 0x3) == 0x3): + return True # Low Power Mode if "Power override" bit is 1 and "Power set" bit is 1 + else: + return False # High Power Mode if one of the following conditions is matched: + # 1. "Power override" bit is 0 + # 2. "Power override" bit is 1 and "Power set" bit is 0 + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + finally: + if eeprom is not None: + eeprom.close() + time.sleep(0.01) + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end: + return False + + try: + eeprom = None + + if not self.get_presence(port_num): + return False # Port is not present, unable to set the eeprom + + # Fill in write buffer + regval = 0x3 if lpmode else 0x1 # 0x3:Low Power Mode, 0x1:High Power Mode + buffer = create_string_buffer(1) + buffer[0] = chr(regval) + + # Write to eeprom + eeprom = open(self.port_to_eeprom_mapping[port_num], "r+b") + eeprom.seek(93) + eeprom.write(buffer[0]) + return True + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + finally: + if eeprom is not None: + eeprom.close() + time.sleep(0.01) + + def reset(self, port_num): + raise NotImplementedError + + @property + def _get_present_bitmap(self): + nodes = [] + port_num = [24,3] + + path = "/sys/bus/i2c/devices/{0}/" + cpld_path = path.format(self._cpld_mapping[0]) + nodes.append((cpld_path + "module_present_all", port_num[0])) + cpld_path = path.format(self._cpld_mapping[1]) + nodes.append((cpld_path + "module_present_all", port_num[1])) + + bitmap = [] + for node in nodes: + try: + reg_file = open(node[0]) + + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + cpld_bm = reg_file.readline().rstrip().zfill(node[1]/4) + bitmap.append(cpld_bm) + reg_file.close() + + rev = "".join(bitmap[::-1]) + return int(rev,16) + + data = {'valid':0, 'last':0, 'present':0} + def get_transceiver_change_event(self, timeout=2000): + now = time.time() + port_dict = {} + port = 0 + + if timeout < 1000: + timeout = 1000 + timeout = (timeout) / float(1000) # Convert to secs + + if now < (self.data['last'] + timeout) and self.data['valid']: + return True, {} + + reg_value = self._get_present_bitmap + changed_ports = self.data['present'] ^ reg_value + if changed_ports: + for port in range (self.port_start, self.port_end+1): + # Mask off the bit corresponding to our port + mask = (1 << (port - 1)) + if changed_ports & mask: + if (reg_value & mask) == 0: + port_dict[port] = SFP_STATUS_REMOVED + else: + port_dict[port] = SFP_STATUS_INSERTED + + # Update cache + self.data['present'] = reg_value + self.data['last'] = now + self.data['valid'] = 1 + pprint.pprint(port_dict) + return True, port_dict + else: + return True, {} + return False, {} + + diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/port_config.ini b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/port_config.ini index 37ed4b68986e..d98c55a4e882 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/port_config.ini +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/montara/port_config.ini @@ -1,33 +1,33 @@ -# name lanes alias speed autoneg fec -Ethernet0 0,1,2,3 Ethernet0 100000 0 rs -Ethernet4 4,5,6,7 Ethernet4 100000 0 rs -Ethernet8 8,9,10,11 Ethernet8 100000 0 rs -Ethernet12 12,13,14,15 Ethernet12 100000 0 rs -Ethernet16 16,17,18,19 Ethernet16 100000 0 rs -Ethernet20 20,21,22,23 Ethernet20 100000 0 rs -Ethernet24 24,25,26,27 Ethernet24 100000 0 rs -Ethernet28 28,29,30,31 Ethernet28 100000 0 rs -Ethernet32 32,33,34,35 Ethernet32 100000 0 rs -Ethernet36 36,37,38,39 Ethernet36 100000 0 rs -Ethernet40 40,41,42,43 Ethernet40 100000 0 rs -Ethernet44 44,45,46,47 Ethernet44 100000 0 rs -Ethernet48 48,49,50,51 Ethernet48 100000 0 rs -Ethernet52 52,53,54,55 Ethernet52 100000 0 rs -Ethernet56 56,57,58,59 Ethernet56 100000 0 rs -Ethernet60 60,61,62,63 Ethernet60 100000 0 rs -Ethernet64 64,65,66,67 Ethernet64 100000 0 rs -Ethernet68 68,69,70,71 Ethernet68 100000 0 rs -Ethernet72 72,73,74,75 Ethernet72 100000 0 rs -Ethernet76 76,77,78,79 Ethernet76 100000 0 rs -Ethernet80 80,81,82,83 Ethernet80 100000 0 rs -Ethernet84 84,85,86,87 Ethernet84 100000 0 rs -Ethernet88 88,89,90,91 Ethernet88 100000 0 rs -Ethernet92 92,93,94,95 Ethernet92 100000 0 rs -Ethernet96 96,97,98,99 Ethernet96 100000 0 rs -Ethernet100 100,101,102,103 Ethernet100 100000 0 rs -Ethernet104 104,105,106,107 Ethernet104 100000 0 rs -Ethernet108 108,109,110,111 Ethernet108 100000 0 rs -Ethernet112 112,113,114,115 Ethernet112 100000 0 rs -Ethernet116 116,117,118,119 Ethernet116 100000 0 rs -Ethernet120 120,121,122,123 Ethernet120 100000 0 rs -Ethernet124 124,125,126,127 Ethernet124 100000 0 rs +# name lanes alias index speed autoneg fec +Ethernet0 0,1,2,3 Ethernet0 1 100000 0 rs +Ethernet4 4,5,6,7 Ethernet4 2 100000 0 rs +Ethernet8 8,9,10,11 Ethernet8 3 100000 0 rs +Ethernet12 12,13,14,15 Ethernet12 4 100000 0 rs +Ethernet16 16,17,18,19 Ethernet16 5 100000 0 rs +Ethernet20 20,21,22,23 Ethernet20 6 100000 0 rs +Ethernet24 24,25,26,27 Ethernet24 7 100000 0 rs +Ethernet28 28,29,30,31 Ethernet28 8 100000 0 rs +Ethernet32 32,33,34,35 Ethernet32 9 100000 0 rs +Ethernet36 36,37,38,39 Ethernet36 10 100000 0 rs +Ethernet40 40,41,42,43 Ethernet40 11 100000 0 rs +Ethernet44 44,45,46,47 Ethernet44 12 100000 0 rs +Ethernet48 48,49,50,51 Ethernet48 13 100000 0 rs +Ethernet52 52,53,54,55 Ethernet52 14 100000 0 rs +Ethernet56 56,57,58,59 Ethernet56 15 100000 0 rs +Ethernet60 60,61,62,63 Ethernet60 16 100000 0 rs +Ethernet64 64,65,66,67 Ethernet64 17 100000 0 rs +Ethernet68 68,69,70,71 Ethernet68 18 100000 0 rs +Ethernet72 72,73,74,75 Ethernet72 19 100000 0 rs +Ethernet76 76,77,78,79 Ethernet76 20 100000 0 rs +Ethernet80 80,81,82,83 Ethernet80 21 100000 0 rs +Ethernet84 84,85,86,87 Ethernet84 22 100000 0 rs +Ethernet88 88,89,90,91 Ethernet88 23 100000 0 rs +Ethernet92 92,93,94,95 Ethernet92 24 100000 0 rs +Ethernet96 96,97,98,99 Ethernet96 25 100000 0 rs +Ethernet100 100,101,102,103 Ethernet100 26 100000 0 rs +Ethernet104 104,105,106,107 Ethernet104 27 100000 0 rs +Ethernet108 108,109,110,111 Ethernet108 28 100000 0 rs +Ethernet112 112,113,114,115 Ethernet112 29 100000 0 rs +Ethernet116 116,117,118,119 Ethernet116 30 100000 0 rs +Ethernet120 120,121,122,123 Ethernet120 31 100000 0 rs +Ethernet124 124,125,126,127 Ethernet124 32 100000 0 rs diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/plugins/sfputil.py b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/plugins/sfputil.py new file mode 100644 index 000000000000..c92bc4212123 --- /dev/null +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/plugins/sfputil.py @@ -0,0 +1,167 @@ +#!/usr/bin/env python + +try: + import os + import sys + import importlib + import time + + sys.path.append(os.path.dirname(__file__)) + import pltfm_mgr_rpc + from pltfm_mgr_rpc.ttypes import * + + from thrift.transport import TSocket + from thrift.transport import TTransport + from thrift.protocol import TBinaryProtocol + from thrift.protocol import TMultiplexedProtocol + + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +thrift_server = 'localhost' +transport = None +pltfm_mgr = None + +SFP_EEPROM_CACHE = "/var/run/platform/sfp/cache" + +class SfpUtil(SfpUtilBase): + """Platform-specific SfpUtil class""" + + PORT_START = 1 + PORT_END = 0 + PORTS_IN_BLOCK = 0 + QSFP_PORT_START = 1 + QSFP_PORT_END = 0 + EEPROM_OFFSET = 0 + + @property + def port_start(self): + self.update_port_info() + return self.PORT_START + + @property + def port_end(self): + self.update_port_info() + return self.PORT_END + + @property + def qsfp_ports(self): + self.update_port_info() + return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + print "dependency on sysfs has been removed" + raise Exception() + + def __init__(self): + if not os.path.exists(os.path.dirname(SFP_EEPROM_CACHE)): + try: + os.makedirs(os.path.dirname(SFP_EEPROM_CACHE)) + except OSError as e: + if e.errno != errno.EEXIST: + raise + + open(SFP_EEPROM_CACHE, 'ab').close() + + SfpUtilBase.__init__(self) + + def update_port_info(self): + global pltfm_mgr + + if self.QSFP_PORT_END == 0: + self.thrift_setup() + self.QSFP_PORT_END = pltfm_mgr.pltfm_mgr_qsfp_get_max_port(); + self.PORT_END = self.QSFP_PORT_END + self.PORTS_IN_BLOCK = self.QSFP_PORT_END + self.thrift_teardown() + + def thrift_setup(self): + global thrift_server, transport, pltfm_mgr + transport = TSocket.TSocket(thrift_server, 9090) + + transport = TTransport.TBufferedTransport(transport) + bprotocol = TBinaryProtocol.TBinaryProtocol(transport) + + pltfm_mgr_client_module = importlib.import_module(".".join(["pltfm_mgr_rpc", "pltfm_mgr_rpc"])) + pltfm_mgr_protocol = TMultiplexedProtocol.TMultiplexedProtocol(bprotocol, "pltfm_mgr_rpc") + pltfm_mgr = pltfm_mgr_client_module.Client(pltfm_mgr_protocol) + + transport.open() + + def thrift_teardown(self): + global transport + transport.close() + + 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 + + presence = False + + try: + self.thrift_setup() + presence = pltfm_mgr.pltfm_mgr_qsfp_presence_get(port_num) + self.thrift_teardown() + except Exception as e: + print e.__doc__ + print e.message + + return presence + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + self.thrift_setup() + lpmode = pltfm_mgr.pltfm_mgr_qsfp_lpmode_get(port_num) + self.thrift_teardown() + return lpmode + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + self.thrift_setup() + status = pltfm_mgr.pltfm_mgr_qsfp_lpmode_set(port_num, lpmode) + self.thrift_teardown() + return status + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + self.thrift_setup() + status = pltfm_mgr.pltfm_mgr_qsfp_reset(port_num, True) + status = pltfm_mgr.pltfm_mgr_qsfp_reset(port_num, False) + self.thrift_teardown() + return status + + def get_transceiver_change_event(self, timeout=0): + phy_port_dict = {} + status = True + # TODO: Process transceiver plug-in/out event + time.sleep(1) + return status, phy_port_dict + + def _get_port_eeprom_path(self, port_num, devid): + eeprom_path = None + + self.thrift_setup() + presence = pltfm_mgr.pltfm_mgr_qsfp_presence_get(port_num) + if presence == True: + eeprom_cache = open(SFP_EEPROM_CACHE, 'wb') + eeprom_hex = pltfm_mgr.pltfm_mgr_qsfp_info_get(port_num) + eeprom_raw = bytearray.fromhex(eeprom_hex) + eeprom_cache.write(eeprom_raw) + eeprom_cache.close() + eeprom_path = SFP_EEPROM_CACHE + self.thrift_teardown() + + return eeprom_path + diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/port_config.ini b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/port_config.ini index f81066d53bfe..7a3b600fe8de 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/port_config.ini +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/mavericks/port_config.ini @@ -1,65 +1,65 @@ -# name lanes alias speed autoneg fec -Ethernet0 0,1,2,3 Ethernet0 100000 0 rs -Ethernet4 4,5,6,7 Ethernet4 100000 0 rs -Ethernet8 8,9,10,11 Ethernet8 100000 0 rs -Ethernet12 12,13,14,15 Ethernet12 100000 0 rs -Ethernet16 16,17,18,19 Ethernet16 100000 0 rs -Ethernet20 20,21,22,23 Ethernet20 100000 0 rs -Ethernet24 24,25,26,27 Ethernet24 100000 0 rs -Ethernet28 28,29,30,31 Ethernet28 100000 0 rs -Ethernet32 32,33,34,35 Ethernet32 100000 0 rs -Ethernet36 36,37,38,39 Ethernet36 100000 0 rs -Ethernet40 40,41,42,43 Ethernet40 100000 0 rs -Ethernet44 44,45,46,47 Ethernet44 100000 0 rs -Ethernet48 48,49,50,51 Ethernet48 100000 0 rs -Ethernet52 52,53,54,55 Ethernet52 100000 0 rs -Ethernet56 56,57,58,59 Ethernet56 100000 0 rs -Ethernet60 60,61,62,63 Ethernet60 100000 0 rs -Ethernet64 64,65,66,67 Ethernet64 100000 0 rs -Ethernet68 68,69,70,71 Ethernet68 100000 0 rs -Ethernet72 72,73,74,75 Ethernet72 100000 0 rs -Ethernet76 76,77,78,79 Ethernet76 100000 0 rs -Ethernet80 80,81,82,83 Ethernet80 100000 0 rs -Ethernet84 84,85,86,87 Ethernet84 100000 0 rs -Ethernet88 88,89,90,91 Ethernet88 100000 0 rs -Ethernet92 92,93,94,95 Ethernet92 100000 0 rs -Ethernet96 96,97,98,99 Ethernet96 100000 0 rs -Ethernet100 100,101,102,103 Ethernet100 100000 0 rs -Ethernet104 104,105,106,107 Ethernet104 100000 0 rs -Ethernet108 108,109,110,111 Ethernet108 100000 0 rs -Ethernet112 112,113,114,115 Ethernet112 100000 0 rs -Ethernet116 116,117,118,119 Ethernet116 100000 0 rs -Ethernet120 120,121,122,123 Ethernet120 100000 0 rs -Ethernet124 124,125,126,127 Ethernet124 100000 0 rs -Ethernet128 128,129,130,131 Ethernet128 100000 0 rs -Ethernet132 132,133,134,135 Ethernet132 100000 0 rs -Ethernet136 136,137,138,139 Ethernet136 100000 0 rs -Ethernet140 140,141,142,143 Ethernet140 100000 0 rs -Ethernet144 144,145,146,147 Ethernet144 100000 0 rs -Ethernet148 148,149,150,151 Ethernet148 100000 0 rs -Ethernet152 152,153,154,155 Ethernet152 100000 0 rs -Ethernet156 156,157,158,159 Ethernet156 100000 0 rs -Ethernet160 160,161,162,163 Ethernet169 100000 0 rs -Ethernet164 164,165,166,167 Ethernet164 100000 0 rs -Ethernet168 168,169,170,171 Ethernet168 100000 0 rs -Ethernet172 172,173,174,175 Ethernet172 100000 0 rs -Ethernet176 176,177,178,179 Ethernet176 100000 0 rs -Ethernet180 180,181,182,183 Ethernet180 100000 0 rs -Ethernet184 184,185,186,187 Ethernet184 100000 0 rs -Ethernet188 188,189,190,191 Ethernet188 100000 0 rs -Ethernet192 192,193,194,195 Ethernet192 100000 0 rs -Ethernet196 196,197,198,199 Ethernet196 100000 0 rs -Ethernet200 200,201,202,203 Ethernet200 100000 0 rs -Ethernet204 204,205,206,207 Ethernet204 100000 0 rs -Ethernet208 208,209,210,211 Ethernet208 100000 0 rs -Ethernet212 212,213,214,215 Ethernet212 100000 0 rs -Ethernet216 216,217,218,219 Ethernet216 100000 0 rs -Ethernet220 220,221,222,223 Ethernet220 100000 0 rs -Ethernet224 224,225,226,227 Ethernet224 100000 0 rs -Ethernet228 228,229,230,231 Ethernet228 100000 0 rs -Ethernet232 232,233,234,235 Ethernet232 100000 0 rs -Ethernet236 236,237,238,239 Ethernet236 100000 0 rs -Ethernet240 240,241,242,243 Ethernet240 100000 0 rs -Ethernet244 244,245,246,247 Ethernet244 100000 0 rs -Ethernet248 248,249,250,251 Ethernet248 100000 0 rs -Ethernet252 252,253,254,255 Etherner252 100000 0 rs +# name lanes alias index speed autoneg fec +Ethernet0 0,1,2,3 Ethernet0 1 100000 0 rs +Ethernet4 4,5,6,7 Ethernet4 2 100000 0 rs +Ethernet8 8,9,10,11 Ethernet8 3 100000 0 rs +Ethernet12 12,13,14,15 Ethernet12 4 100000 0 rs +Ethernet16 16,17,18,19 Ethernet16 5 100000 0 rs +Ethernet20 20,21,22,23 Ethernet20 6 100000 0 rs +Ethernet24 24,25,26,27 Ethernet24 7 100000 0 rs +Ethernet28 28,29,30,31 Ethernet28 8 100000 0 rs +Ethernet32 32,33,34,35 Ethernet32 9 100000 0 rs +Ethernet36 36,37,38,39 Ethernet36 10 100000 0 rs +Ethernet40 40,41,42,43 Ethernet40 11 100000 0 rs +Ethernet44 44,45,46,47 Ethernet44 12 100000 0 rs +Ethernet48 48,49,50,51 Ethernet48 13 100000 0 rs +Ethernet52 52,53,54,55 Ethernet52 14 100000 0 rs +Ethernet56 56,57,58,59 Ethernet56 15 100000 0 rs +Ethernet60 60,61,62,63 Ethernet60 16 100000 0 rs +Ethernet64 64,65,66,67 Ethernet64 17 100000 0 rs +Ethernet68 68,69,70,71 Ethernet68 18 100000 0 rs +Ethernet72 72,73,74,75 Ethernet72 19 100000 0 rs +Ethernet76 76,77,78,79 Ethernet76 20 100000 0 rs +Ethernet80 80,81,82,83 Ethernet80 21 100000 0 rs +Ethernet84 84,85,86,87 Ethernet84 22 100000 0 rs +Ethernet88 88,89,90,91 Ethernet88 23 100000 0 rs +Ethernet92 92,93,94,95 Ethernet92 24 100000 0 rs +Ethernet96 96,97,98,99 Ethernet96 25 100000 0 rs +Ethernet100 100,101,102,103 Ethernet100 26 100000 0 rs +Ethernet104 104,105,106,107 Ethernet104 27 100000 0 rs +Ethernet108 108,109,110,111 Ethernet108 28 100000 0 rs +Ethernet112 112,113,114,115 Ethernet112 29 100000 0 rs +Ethernet116 116,117,118,119 Ethernet116 30 100000 0 rs +Ethernet120 120,121,122,123 Ethernet120 31 100000 0 rs +Ethernet124 124,125,126,127 Ethernet124 32 100000 0 rs +Ethernet128 128,129,130,131 Ethernet128 33 100000 0 rs +Ethernet132 132,133,134,135 Ethernet132 34 100000 0 rs +Ethernet136 136,137,138,139 Ethernet136 35 100000 0 rs +Ethernet140 140,141,142,143 Ethernet140 36 100000 0 rs +Ethernet144 144,145,146,147 Ethernet144 37 100000 0 rs +Ethernet148 148,149,150,151 Ethernet148 38 100000 0 rs +Ethernet152 152,153,154,155 Ethernet152 39 100000 0 rs +Ethernet156 156,157,158,159 Ethernet156 40 100000 0 rs +Ethernet160 160,161,162,163 Ethernet169 41 100000 0 rs +Ethernet164 164,165,166,167 Ethernet164 42 100000 0 rs +Ethernet168 168,169,170,171 Ethernet168 43 100000 0 rs +Ethernet172 172,173,174,175 Ethernet172 44 100000 0 rs +Ethernet176 176,177,178,179 Ethernet176 45 100000 0 rs +Ethernet180 180,181,182,183 Ethernet180 46 100000 0 rs +Ethernet184 184,185,186,187 Ethernet184 47 100000 0 rs +Ethernet188 188,189,190,191 Ethernet188 48 100000 0 rs +Ethernet192 192,193,194,195 Ethernet192 49 100000 0 rs +Ethernet196 196,197,198,199 Ethernet196 50 100000 0 rs +Ethernet200 200,201,202,203 Ethernet200 51 100000 0 rs +Ethernet204 204,205,206,207 Ethernet204 52 100000 0 rs +Ethernet208 208,209,210,211 Ethernet208 53 100000 0 rs +Ethernet212 212,213,214,215 Ethernet212 54 100000 0 rs +Ethernet216 216,217,218,219 Ethernet216 55 100000 0 rs +Ethernet220 220,221,222,223 Ethernet220 56 100000 0 rs +Ethernet224 224,225,226,227 Ethernet224 57 100000 0 rs +Ethernet228 228,229,230,231 Ethernet228 58 100000 0 rs +Ethernet232 232,233,234,235 Ethernet232 59 100000 0 rs +Ethernet236 236,237,238,239 Ethernet236 60 100000 0 rs +Ethernet240 240,241,242,243 Ethernet240 61 100000 0 rs +Ethernet244 244,245,246,247 Ethernet244 62 100000 0 rs +Ethernet248 248,249,250,251 Ethernet248 63 100000 0 rs +Ethernet252 252,253,254,255 Etherner252 64 100000 0 rs diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/sai.profile b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/sai.profile index 4618972dbba9..7342ae8002e8 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/sai.profile +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-seastone-dx010-96x10G-16x50G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/platform/th-seastone-dx010-config-flex-all.bcm diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/th-seastone-dx010-96x10G-16x50G.config.bcm b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/th-seastone-dx010-96x10G-16x50G.config.bcm deleted file mode 100644 index b62320f7c50b..000000000000 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/th-seastone-dx010-96x10G-16x50G.config.bcm +++ /dev/null @@ -1,927 +0,0 @@ -# Define default OS / SAL -os=unix - -# all XPORTs to XE ports -#pbmp_xport_xe=0x1fffffffe -pbmp_xport_xe=0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe -pbmp_oversubscribe=0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe - -# Mode control to select L2 Table DMA mode aka L2MODE_POLL (0) or -# L2MOD_FIFO mechanism aka L2MODE_FIFO (1) for L2 table change notification. -l2xmsg_mode=1 - -# Memory table size configs -l2_mem_entries=8192 -l3_mem_entries=8192 -l3_alpm_enable=2 -ipv6_lpm_128b_enable=1 -mmu_lossless=0 - -################################################################################### -# Celestica Customize for SeaStone -################################################################################### - -#ext mdio frequency to 495/0x80/2(1.933Mhz) or 415/0x80/2(1.62MHz) -# default is 40 -# Set external MDIO freq to 6.19MHz (495MHz) or 5.19MHz (415MHz) -#* target_freq is core_clock_freq * DIVIDEND / DIVISOR / 2 -# -rate_ext_mdio_divisor=0x80 - -# use internal rom boot -phy_ext_rom_boot=0 - -#fpem_mem_entries=32768 -oversubscribe_mode=1 -#pbmp_xport_xe=0x3fd000000ff4000003fc000001fe - -dport_map_enable=1 - -dport_map_port_68=1 -dport_map_port_69=2 -dport_map_port_70=3 -dport_map_port_71=4 - -dport_map_port_72=5 -dport_map_port_73=6 -dport_map_port_74=7 -dport_map_port_75=8 - -dport_map_port_76=9 -dport_map_port_77=10 -dport_map_port_78=11 -dport_map_port_79=12 - -dport_map_port_80=13 -dport_map_port_81=14 -dport_map_port_82=15 -dport_map_port_83=16 - -dport_map_port_34=17 -dport_map_port_35=18 -dport_map_port_36=19 -dport_map_port_37=20 - -dport_map_port_38=21 -dport_map_port_39=22 -dport_map_port_40=23 -dport_map_port_41=24 - -dport_map_port_42=25 -dport_map_port_43=26 -dport_map_port_44=27 -dport_map_port_45=28 - -dport_map_port_46=29 -dport_map_port_47=30 -dport_map_port_48=31 -dport_map_port_49=32 - -dport_map_port_50=33 -dport_map_port_51=34 -dport_map_port_52=35 -dport_map_port_53=36 - -dport_map_port_54=37 -dport_map_port_55=38 -dport_map_port_56=39 -dport_map_port_57=40 - -dport_map_port_58=41 -dport_map_port_59=42 -dport_map_port_60=43 -dport_map_port_61=44 - -dport_map_port_62=45 -dport_map_port_63=46 -dport_map_port_64=47 -dport_map_port_65=48 - -dport_map_port_84=49 -dport_map_port_85=50 -dport_map_port_86=51 -dport_map_port_87=52 - -dport_map_port_88=53 -dport_map_port_89=54 -dport_map_port_90=55 -dport_map_port_91=56 - -dport_map_port_92=57 -dport_map_port_93=58 -dport_map_port_94=59 -dport_map_port_95=60 - -dport_map_port_96=61 -dport_map_port_97=62 -dport_map_port_98=63 -dport_map_port_99=64 - -dport_map_port_102=65 -dport_map_port_103=66 -dport_map_port_104=67 -dport_map_port_105=68 - -dport_map_port_106=69 -dport_map_port_107=70 -dport_map_port_108=71 -dport_map_port_109=72 - -dport_map_port_110=73 -dport_map_port_111=74 -dport_map_port_112=75 -dport_map_port_113=76 - -dport_map_port_114=77 -dport_map_port_115=78 -dport_map_port_116=79 -dport_map_port_117=80 - -dport_map_port_1=81 -dport_map_port_2=82 -dport_map_port_3=83 -dport_map_port_4=84 - -dport_map_port_5=85 -dport_map_port_6=86 -dport_map_port_7=87 -dport_map_port_8=88 - -dport_map_port_9=89 -dport_map_port_10=90 -dport_map_port_11=91 -dport_map_port_12=92 - -dport_map_port_13=93 -dport_map_port_14=94 -dport_map_port_15=95 -dport_map_port_16=96 - - -dport_map_port_17=97 -dport_map_port_18=98 - -dport_map_port_21=101 -dport_map_port_22=102 - -dport_map_port_25=105 -dport_map_port_26=106 - -dport_map_port_29=109 -dport_map_port_30=110 - -dport_map_port_118=113 -dport_map_port_119=114 - -dport_map_port_122=117 -dport_map_port_123=118 - -dport_map_port_126=121 -dport_map_port_127=122 - -dport_map_port_130=125 -dport_map_port_131=126 - - -# port mapping -portmap_68=65:10 -portmap_69=66:10 -portmap_70=67:10 -portmap_71=68:10 - -portmap_72=69:10 -portmap_73=70:10 -portmap_74=71:10 -portmap_75=72:10 - -portmap_76=73:10 -portmap_77=74:10 -portmap_78=75:10 -portmap_79=76:10 - -portmap_80=77:10 -portmap_81=78:10 -portmap_82=79:10 -portmap_83=80:10 - -portmap_34=33:10 -portmap_35=34:10 -portmap_36=35:10 -portmap_37=36:10 - -portmap_38=37:10 -portmap_39=38:10 -portmap_40=39:10 -portmap_41=40:10 - -portmap_42=41:10 -portmap_43=42:10 -portmap_44=43:10 -portmap_45=44:10 - -portmap_46=45:10 -portmap_47=46:10 -portmap_48=47:10 -portmap_49=48:10 - -portmap_50=49:10 -portmap_51=50:10 -portmap_52=51:10 -portmap_53=52:10 - -portmap_54=53:10 -portmap_55=54:10 -portmap_56=55:10 -portmap_57=56:10 - -portmap_58=57:10 -portmap_59=58:10 -portmap_60=59:10 -portmap_61=60:10 - -portmap_62=61:10 -portmap_63=62:10 -portmap_64=63:10 -portmap_65=64:10 - -portmap_84=81:10 -portmap_85=82:10 -portmap_86=83:10 -portmap_87=84:10 - -portmap_88=85:10 -portmap_89=86:10 -portmap_90=87:10 -portmap_91=88:10 - -portmap_92=89:10 -portmap_93=90:10 -portmap_94=91:10 -portmap_95=92:10 - -portmap_96=93:10 -portmap_97=94:10 -portmap_98=95:10 -portmap_99=96:10 - -portmap_102=97:10 -portmap_103=98:10 -portmap_104=99:10 -portmap_105=100:10 - -portmap_106=101:10 -portmap_107=102:10 -portmap_108=103:10 -portmap_109=104:10 - -portmap_110=105:10 -portmap_111=106:10 -portmap_112=107:10 -portmap_113=108:10 - -portmap_114=109:10 -portmap_115=110:10 -portmap_116=111:10 -portmap_117=112:10 - -portmap_1=1:10 -portmap_2=2:10 -portmap_3=3:10 -portmap_4=4:10 - -portmap_5=5:10 -portmap_6=6:10 -portmap_7=7:10 -portmap_8=8:10 - -portmap_9=9:10 -portmap_10=10:10 -portmap_11=11:10 -portmap_12=12:10 - -portmap_13=13:10 -portmap_14=14:10 -portmap_15=15:10 -portmap_16=16:10 - - -portmap_17=17:50:2 -portmap_18=19:50:2 - -portmap_21=21:50:2 -portmap_22=23:50:2 - -portmap_25=25:50:2 -portmap_26=27:50:2 - -portmap_29=29:50:2 -portmap_30=31:50:2 - -portmap_118=113:50:2 -portmap_119=115:50:2 - -portmap_122=117:50:2 -portmap_123=119:50:2 - -portmap_126=121:50:2 -portmap_127=123:50:2 - -portmap_130=125:50:2 -portmap_131=127:50:2 - -#portmap_66=129:10 -#portmap_100=131:10 - -#WC16 -xgxs_tx_lane_map_68=0x3201 -xgxs_rx_lane_map_68=0x2310 -xgxs_tx_lane_map_69=0x3201 -xgxs_rx_lane_map_69=0x2310 -xgxs_tx_lane_map_70=0x3201 -xgxs_rx_lane_map_70=0x2310 -xgxs_tx_lane_map_71=0x3201 -xgxs_rx_lane_map_71=0x2310 - - -#WC17 -xgxs_tx_lane_map_72=0x3201 -xgxs_rx_lane_map_72=0x2301 -xgxs_tx_lane_map_73=0x3201 -xgxs_rx_lane_map_73=0x2301 -xgxs_tx_lane_map_74=0x3201 -xgxs_rx_lane_map_74=0x2301 -xgxs_tx_lane_map_75=0x3201 -xgxs_rx_lane_map_75=0x2301 - -#WC18 -xgxs_tx_lane_map_76=0x0132 -xgxs_rx_lane_map_76=0x0123 -xgxs_tx_lane_map_77=0x0132 -xgxs_rx_lane_map_77=0x0123 -xgxs_tx_lane_map_78=0x0132 -xgxs_rx_lane_map_78=0x0123 -xgxs_tx_lane_map_79=0x0132 -xgxs_rx_lane_map_79=0x0123 - -#WC19 -xgxs_tx_lane_map_80=0x2031 -xgxs_rx_lane_map_80=0x1320 -xgxs_tx_lane_map_81=0x2031 -xgxs_rx_lane_map_81=0x1320 -xgxs_tx_lane_map_82=0x2031 -xgxs_rx_lane_map_82=0x1320 -xgxs_tx_lane_map_83=0x2031 -xgxs_rx_lane_map_83=0x1320 - -#WC8 -#xgxs_tx_lane_map_34=0x3021 -#xgxs_rx_lane_map_34=0x0213 -#xgxs_tx_lane_map_35=0x3021 -#xgxs_rx_lane_map_35=0x0213 -#xgxs_tx_lane_map_36=0x3021 -#xgxs_rx_lane_map_36=0x0213 -#xgxs_tx_lane_map_37=0x3021 -#xgxs_rx_lane_map_37=0x0213 - -xgxs_tx_lane_map_34=0x3021 -xgxs_rx_lane_map_34=0x0213 -xgxs_tx_lane_map_35=0x3021 -xgxs_rx_lane_map_35=0x0213 -xgxs_tx_lane_map_36=0x3021 -xgxs_rx_lane_map_36=0x0213 -xgxs_tx_lane_map_37=0x3021 -xgxs_rx_lane_map_37=0x0213 - -#WC9 -xgxs_tx_lane_map_38=0x3210 -xgxs_rx_lane_map_38=0x1023 -xgxs_tx_lane_map_39=0x3210 -xgxs_rx_lane_map_39=0x1023 -xgxs_tx_lane_map_40=0x3210 -xgxs_rx_lane_map_40=0x1023 -xgxs_tx_lane_map_41=0x3210 -xgxs_rx_lane_map_41=0x1023 - -#WC10 -xgxs_tx_lane_map_42=0x2310 -xgxs_rx_lane_map_42=0x3210 -xgxs_tx_lane_map_43=0x2310 -xgxs_rx_lane_map_43=0x3210 -xgxs_tx_lane_map_44=0x2310 -xgxs_rx_lane_map_44=0x3210 -xgxs_tx_lane_map_45=0x2310 -xgxs_rx_lane_map_45=0x3210 - -#WC11 -xgxs_tx_lane_map_46=0x1032 -xgxs_rx_lane_map_46=0x1302 -xgxs_tx_lane_map_47=0x1032 -xgxs_rx_lane_map_47=0x1302 -xgxs_tx_lane_map_48=0x1032 -xgxs_rx_lane_map_48=0x1302 -xgxs_tx_lane_map_49=0x1032 -xgxs_rx_lane_map_49=0x1302 - -#WC12 -xgxs_tx_lane_map_50=0x3201 -xgxs_rx_lane_map_50=0x0213 -xgxs_tx_lane_map_51=0x3201 -xgxs_rx_lane_map_51=0x0213 -xgxs_tx_lane_map_52=0x3201 -xgxs_rx_lane_map_52=0x0213 -xgxs_tx_lane_map_53=0x3201 -xgxs_rx_lane_map_53=0x0213 - - -#WC13 -xgxs_tx_lane_map_54=0x2301 -xgxs_rx_lane_map_54=0x2310 -xgxs_tx_lane_map_55=0x2301 -xgxs_rx_lane_map_55=0x2310 -xgxs_tx_lane_map_56=0x2301 -xgxs_rx_lane_map_56=0x2310 -xgxs_tx_lane_map_57=0x2301 -xgxs_rx_lane_map_57=0x2310 - -#WC14 -xgxs_tx_lane_map_58=0x3201 -xgxs_rx_lane_map_58=0x0213 -xgxs_tx_lane_map_59=0x3201 -xgxs_rx_lane_map_59=0x0213 -xgxs_tx_lane_map_60=0x3201 -xgxs_rx_lane_map_60=0x0213 -xgxs_tx_lane_map_61=0x3201 -xgxs_rx_lane_map_61=0x0213 - -#WC15 -xgxs_tx_lane_map_62=0x1302 -xgxs_rx_lane_map_62=0x2310 -xgxs_tx_lane_map_63=0x1302 -xgxs_rx_lane_map_63=0x2310 -xgxs_tx_lane_map_64=0x1302 -xgxs_rx_lane_map_64=0x2310 -xgxs_tx_lane_map_65=0x1302 -xgxs_rx_lane_map_65=0x2310 - -#WC20 -xgxs_tx_lane_map_84=0x0213 -xgxs_rx_lane_map_84=0x2301 -xgxs_tx_lane_map_85=0x0213 -xgxs_rx_lane_map_85=0x2301 -xgxs_tx_lane_map_86=0x0213 -xgxs_rx_lane_map_86=0x2301 -xgxs_tx_lane_map_87=0x0213 -xgxs_rx_lane_map_87=0x2301 - -#WC21 -xgxs_tx_lane_map_88=0x0132 -xgxs_rx_lane_map_88=0x3210 -xgxs_tx_lane_map_89=0x0132 -xgxs_rx_lane_map_89=0x3210 -xgxs_tx_lane_map_90=0x0132 -xgxs_rx_lane_map_90=0x3210 -xgxs_tx_lane_map_91=0x0132 -xgxs_rx_lane_map_91=0x3210 - -#WC22 -xgxs_tx_lane_map_92=0x0132 -xgxs_rx_lane_map_92=0x2031 -xgxs_tx_lane_map_93=0x0132 -xgxs_rx_lane_map_93=0x2031 -xgxs_tx_lane_map_94=0x0132 -xgxs_rx_lane_map_94=0x2031 -xgxs_tx_lane_map_95=0x0132 -xgxs_rx_lane_map_95=0x2031 - -#WC23 -xgxs_tx_lane_map_96=0x2031 -xgxs_rx_lane_map_96=0x3201 -xgxs_tx_lane_map_97=0x2031 -xgxs_rx_lane_map_97=0x3201 -xgxs_tx_lane_map_98=0x2031 -xgxs_rx_lane_map_98=0x3201 -xgxs_tx_lane_map_99=0x2031 -xgxs_rx_lane_map_99=0x3201 - -#WC24 -xgxs_tx_lane_map_102=0x0132 -xgxs_rx_lane_map_102=0x2301 -xgxs_tx_lane_map_103=0x0132 -xgxs_rx_lane_map_103=0x2301 -xgxs_tx_lane_map_104=0x0132 -xgxs_rx_lane_map_104=0x2301 -xgxs_tx_lane_map_105=0x0132 -xgxs_rx_lane_map_105=0x2301 - -#WC25 -xgxs_tx_lane_map_106=0x0132 -xgxs_rx_lane_map_106=0x3201 -xgxs_tx_lane_map_107=0x0132 -xgxs_rx_lane_map_107=0x3201 -xgxs_tx_lane_map_108=0x0132 -xgxs_rx_lane_map_108=0x3201 -xgxs_tx_lane_map_109=0x0132 -xgxs_rx_lane_map_109=0x3201 - -#WC26 -xgxs_tx_lane_map_110=0x0132 -xgxs_rx_lane_map_110=0x2031 -xgxs_tx_lane_map_111=0x0132 -xgxs_rx_lane_map_111=0x2031 -xgxs_tx_lane_map_112=0x0132 -xgxs_rx_lane_map_112=0x2031 -xgxs_tx_lane_map_113=0x0132 -xgxs_rx_lane_map_113=0x2031 - -#WC27 -xgxs_tx_lane_map_114=0x2031 -xgxs_rx_lane_map_114=0x2301 -xgxs_tx_lane_map_115=0x2031 -xgxs_rx_lane_map_115=0x2301 -xgxs_tx_lane_map_116=0x2031 -xgxs_rx_lane_map_116=0x2301 -xgxs_tx_lane_map_117=0x2031 -xgxs_rx_lane_map_117=0x2301 - - -#WC0 -xgxs_tx_lane_map_1=0x3210 -xgxs_rx_lane_map_1=0x3120 -xgxs_tx_lane_map_2=0x3210 -xgxs_rx_lane_map_2=0x3120 -xgxs_tx_lane_map_3=0x3210 -xgxs_rx_lane_map_3=0x3120 -xgxs_tx_lane_map_4=0x3210 -xgxs_rx_lane_map_4=0x3120 - -#WC1 -xgxs_tx_lane_map_5=0x0132 -xgxs_rx_lane_map_5=0x1023 -xgxs_tx_lane_map_6=0x0132 -xgxs_rx_lane_map_6=0x1023 -xgxs_tx_lane_map_7=0x0132 -xgxs_rx_lane_map_7=0x1023 -xgxs_tx_lane_map_8=0x0132 -xgxs_rx_lane_map_8=0x1023 - -#WC2 -xgxs_tx_lane_map_9=0x3201 -xgxs_rx_lane_map_9=0x3120 -xgxs_tx_lane_map_10=0x3201 -xgxs_rx_lane_map_10=0x3120 -xgxs_tx_lane_map_11=0x3201 -xgxs_rx_lane_map_11=0x3120 -xgxs_tx_lane_map_12=0x3201 -xgxs_rx_lane_map_12=0x3120 - -#WC3 -xgxs_tx_lane_map_13=0x2031 -xgxs_rx_lane_map_13=0x1032 -xgxs_tx_lane_map_14=0x2031 -xgxs_rx_lane_map_14=0x1032 -xgxs_tx_lane_map_15=0x2031 -xgxs_rx_lane_map_15=0x1032 -xgxs_tx_lane_map_16=0x2031 -xgxs_rx_lane_map_16=0x1032 - -#WC4 -xgxs_tx_lane_map_17=0x2310 -xgxs_rx_lane_map_17=0x3210 -xgxs_tx_lane_map_18=0x2310 -xgxs_rx_lane_map_18=0x3210 - -#WC5 -xgxs_tx_lane_map_21=0x2301 -xgxs_rx_lane_map_21=0x3120 -xgxs_tx_lane_map_22=0x2301 -xgxs_rx_lane_map_22=0x3120 - -#WC6 -xgxs_tx_lane_map_25=0x3201 -xgxs_rx_lane_map_25=0x0213 -xgxs_tx_lane_map_26=0x3201 -xgxs_rx_lane_map_26=0x0213 - -#WC7 -xgxs_tx_lane_map_29=0x1302 -xgxs_rx_lane_map_29=0x1023 -xgxs_tx_lane_map_30=0x1302 -xgxs_rx_lane_map_30=0x1023 - -#WC28 -xgxs_tx_lane_map_118=0x1320 -xgxs_rx_lane_map_118=0x1302 -xgxs_tx_lane_map_119=0x1320 -xgxs_rx_lane_map_119=0x1302 - -#WC29 -xgxs_tx_lane_map_122=0x1032 -xgxs_rx_lane_map_122=0x1023 -xgxs_tx_lane_map_123=0x1032 -xgxs_rx_lane_map_123=0x1023 - -#WC30 -xgxs_tx_lane_map_126=0x3120 -xgxs_rx_lane_map_126=0x3120 -xgxs_tx_lane_map_127=0x3120 -xgxs_rx_lane_map_127=0x3120 - -#WC31 -xgxs_tx_lane_map_130=0x1302 -xgxs_rx_lane_map_130=0x2310 -xgxs_tx_lane_map_131=0x1302 -xgxs_rx_lane_map_131=0x2310 - - - - -#PN - -#WC16 -phy_xaui_tx_polarity_flip_68=0x0000 -phy_xaui_rx_polarity_flip_68=0x0000 -phy_xaui_tx_polarity_flip_69=0x0000 -phy_xaui_rx_polarity_flip_69=0x0000 -phy_xaui_tx_polarity_flip_70=0x0000 -phy_xaui_rx_polarity_flip_70=0x0000 -phy_xaui_tx_polarity_flip_71=0x0000 -phy_xaui_rx_polarity_flip_71=0x0000 - -#WC17 -phy_xaui_tx_polarity_flip_72=0x0001 -phy_xaui_rx_polarity_flip_72=0x0000 -phy_xaui_tx_polarity_flip_73=0x0000 -phy_xaui_rx_polarity_flip_73=0x0001 -phy_xaui_tx_polarity_flip_74=0x0001 -phy_xaui_rx_polarity_flip_74=0x0000 -phy_xaui_tx_polarity_flip_75=0x0001 -phy_xaui_rx_polarity_flip_75=0x0000 - -#WC18 -phy_xaui_tx_polarity_flip_76=0x0001 -phy_xaui_rx_polarity_flip_76=0x0000 -phy_xaui_tx_polarity_flip_77=0x0001 -phy_xaui_rx_polarity_flip_77=0x0000 -phy_xaui_tx_polarity_flip_78=0x0001 -phy_xaui_rx_polarity_flip_78=0x0000 -phy_xaui_tx_polarity_flip_79=0x0001 -phy_xaui_rx_polarity_flip_79=0x0000 - -#WC19 -phy_xaui_tx_polarity_flip_80=0x0001 -phy_xaui_rx_polarity_flip_80=0x0001 -phy_xaui_tx_polarity_flip_81=0x0001 -phy_xaui_rx_polarity_flip_81=0x0001 -phy_xaui_tx_polarity_flip_82=0x0001 -phy_xaui_rx_polarity_flip_82=0x0001 -phy_xaui_tx_polarity_flip_83=0x0001 -phy_xaui_rx_polarity_flip_83=0x0001 - -#WC8 -phy_xaui_tx_polarity_flip_34=0x0000 -phy_xaui_rx_polarity_flip_34=0x0000 -phy_xaui_tx_polarity_flip_35=0x0001 -phy_xaui_rx_polarity_flip_35=0x0000 -phy_xaui_tx_polarity_flip_36=0x0001 -phy_xaui_rx_polarity_flip_36=0x0000 -phy_xaui_tx_polarity_flip_37=0x0001 -phy_xaui_rx_polarity_flip_37=0x0000 - -#WC9 -phy_xaui_tx_polarity_flip_38=0x0000 -phy_xaui_rx_polarity_flip_38=0x0000 -phy_xaui_tx_polarity_flip_39=0x0000 -phy_xaui_rx_polarity_flip_39=0x0000 -phy_xaui_tx_polarity_flip_40=0x0000 -phy_xaui_rx_polarity_flip_40=0x0000 -phy_xaui_tx_polarity_flip_41=0x0001 -phy_xaui_rx_polarity_flip_41=0x0000 - -#WC10 -phy_xaui_tx_polarity_flip_42=0x0001 -phy_xaui_rx_polarity_flip_42=0x0000 -phy_xaui_tx_polarity_flip_43=0x0000 -phy_xaui_rx_polarity_flip_43=0x0000 -phy_xaui_tx_polarity_flip_44=0x0001 -phy_xaui_rx_polarity_flip_44=0x0000 -phy_xaui_tx_polarity_flip_45=0x0001 -phy_xaui_rx_polarity_flip_45=0x0000 - -#WC11 -phy_xaui_tx_polarity_flip_46=0x0000 -phy_xaui_rx_polarity_flip_46=0x0000 -phy_xaui_tx_polarity_flip_47=0x0000 -phy_xaui_rx_polarity_flip_47=0x0000 -phy_xaui_tx_polarity_flip_48=0x0000 -phy_xaui_rx_polarity_flip_48=0x0000 -phy_xaui_tx_polarity_flip_49=0x0000 -phy_xaui_rx_polarity_flip_49=0x0000 - -#WC12 -phy_xaui_tx_polarity_flip_50=0x0000 -phy_xaui_rx_polarity_flip_50=0x0000 -phy_xaui_tx_polarity_flip_51=0x0001 -phy_xaui_rx_polarity_flip_51=0x0000 -phy_xaui_tx_polarity_flip_52=0x0000 -phy_xaui_rx_polarity_flip_52=0x0000 -phy_xaui_tx_polarity_flip_53=0x0000 -phy_xaui_rx_polarity_flip_53=0x0000 - -#WC13 -phy_xaui_tx_polarity_flip_54=0x0000 -phy_xaui_rx_polarity_flip_54=0x0000 -phy_xaui_tx_polarity_flip_55=0x0001 -phy_xaui_rx_polarity_flip_55=0x0000 -phy_xaui_tx_polarity_flip_56=0x0000 -phy_xaui_rx_polarity_flip_56=0x0000 -phy_xaui_tx_polarity_flip_57=0x0000 -phy_xaui_rx_polarity_flip_57=0x0000 - -#WC14 -phy_xaui_tx_polarity_flip_58=0x0000 -phy_xaui_rx_polarity_flip_58=0x0000 -phy_xaui_tx_polarity_flip_59=0x0000 -phy_xaui_rx_polarity_flip_59=0x0000 -phy_xaui_tx_polarity_flip_60=0x0000 -phy_xaui_rx_polarity_flip_60=0x0000 -phy_xaui_tx_polarity_flip_61=0x0000 -phy_xaui_rx_polarity_flip_61=0x0000 - -#WC15 -phy_xaui_tx_polarity_flip_62=0x0000 -phy_xaui_rx_polarity_flip_62=0x0001 -phy_xaui_tx_polarity_flip_63=0x0001 -phy_xaui_rx_polarity_flip_63=0x0001 -phy_xaui_tx_polarity_flip_64=0x0000 -phy_xaui_rx_polarity_flip_64=0x0001 -phy_xaui_tx_polarity_flip_65=0x0001 -phy_xaui_rx_polarity_flip_65=0x0001 - -#WC20 -phy_xaui_tx_polarity_flip_84=0x0001 -phy_xaui_rx_polarity_flip_84=0x0000 -phy_xaui_tx_polarity_flip_85=0x0001 -phy_xaui_rx_polarity_flip_85=0x0001 -phy_xaui_tx_polarity_flip_86=0x0001 -phy_xaui_rx_polarity_flip_86=0x0001 -phy_xaui_tx_polarity_flip_87=0x0000 -phy_xaui_rx_polarity_flip_87=0x0001 - -#WC21 -phy_xaui_tx_polarity_flip_88=0x0001 -phy_xaui_rx_polarity_flip_88=0x0001 -phy_xaui_tx_polarity_flip_89=0x0000 -phy_xaui_rx_polarity_flip_89=0x0000 -phy_xaui_tx_polarity_flip_90=0x0001 -phy_xaui_rx_polarity_flip_90=0x0001 -phy_xaui_tx_polarity_flip_91=0x0001 -phy_xaui_rx_polarity_flip_91=0x0001 - -#WC22 -phy_xaui_tx_polarity_flip_92=0x0001 -phy_xaui_rx_polarity_flip_92=0x0000 -phy_xaui_tx_polarity_flip_93=0x0001 -phy_xaui_rx_polarity_flip_93=0x0000 -phy_xaui_tx_polarity_flip_94=0x0001 -phy_xaui_rx_polarity_flip_94=0x0000 -phy_xaui_tx_polarity_flip_95=0x0001 -phy_xaui_rx_polarity_flip_95=0x0001 - -#WC23 -phy_xaui_tx_polarity_flip_96=0x0001 -phy_xaui_rx_polarity_flip_96=0x0000 -phy_xaui_tx_polarity_flip_97=0x0000 -phy_xaui_rx_polarity_flip_97=0x0000 -phy_xaui_tx_polarity_flip_98=0x0001 -phy_xaui_rx_polarity_flip_98=0x0000 -phy_xaui_tx_polarity_flip_99=0x0000 -phy_xaui_rx_polarity_flip_99=0x0000 - -#WC24 -phy_xaui_tx_polarity_flip_102=0x0000 -phy_xaui_rx_polarity_flip_102=0x0001 -phy_xaui_tx_polarity_flip_103=0x0000 -phy_xaui_rx_polarity_flip_103=0x0001 -phy_xaui_tx_polarity_flip_104=0x0000 -phy_xaui_rx_polarity_flip_104=0x0001 -phy_xaui_tx_polarity_flip_105=0x0000 -phy_xaui_rx_polarity_flip_105=0x0001 - -#WC25 -phy_xaui_tx_polarity_flip_106=0x0001 -phy_xaui_rx_polarity_flip_106=0x0000 -phy_xaui_tx_polarity_flip_107=0x0001 -phy_xaui_rx_polarity_flip_107=0x0000 -phy_xaui_tx_polarity_flip_108=0x0001 -phy_xaui_rx_polarity_flip_108=0x0000 -phy_xaui_tx_polarity_flip_109=0x0001 -phy_xaui_rx_polarity_flip_109=0x0000 - -#WC26 -phy_xaui_tx_polarity_flip_110=0x0001 -phy_xaui_rx_polarity_flip_110=0x0001 -phy_xaui_tx_polarity_flip_111=0x0001 -phy_xaui_rx_polarity_flip_111=0x0001 -phy_xaui_tx_polarity_flip_112=0x0001 -phy_xaui_rx_polarity_flip_112=0x0001 -phy_xaui_tx_polarity_flip_113=0x0001 -phy_xaui_rx_polarity_flip_113=0x0001 - -#WC27 -phy_xaui_tx_polarity_flip_114=0x0001 -phy_xaui_rx_polarity_flip_114=0x0001 -phy_xaui_tx_polarity_flip_115=0x0001 -phy_xaui_rx_polarity_flip_115=0x0001 -phy_xaui_tx_polarity_flip_116=0x0001 -phy_xaui_rx_polarity_flip_116=0x0001 -phy_xaui_tx_polarity_flip_117=0x0001 -phy_xaui_rx_polarity_flip_117=0x0000 - -#WC0 -phy_xaui_tx_polarity_flip_1=0x0001 -phy_xaui_rx_polarity_flip_1=0x0001 -phy_xaui_tx_polarity_flip_2=0x0001 -phy_xaui_rx_polarity_flip_2=0x0001 -phy_xaui_tx_polarity_flip_3=0x0000 -phy_xaui_rx_polarity_flip_3=0x0001 -phy_xaui_tx_polarity_flip_4=0x0000 -phy_xaui_rx_polarity_flip_4=0x0001 - -#WC1 -phy_xaui_tx_polarity_flip_5=0x0001 -phy_xaui_rx_polarity_flip_5=0x0000 -phy_xaui_tx_polarity_flip_6=0x0001 -phy_xaui_rx_polarity_flip_6=0x0000 -phy_xaui_tx_polarity_flip_7=0x0001 -phy_xaui_rx_polarity_flip_7=0x0000 -phy_xaui_tx_polarity_flip_8=0x0000 -phy_xaui_rx_polarity_flip_8=0x0000 - -#WC2 -phy_xaui_tx_polarity_flip_9=0x0000 -phy_xaui_rx_polarity_flip_9=0x0000 -phy_xaui_tx_polarity_flip_10=0x0001 -phy_xaui_rx_polarity_flip_10=0x0000 -phy_xaui_tx_polarity_flip_11=0x0000 -phy_xaui_rx_polarity_flip_11=0x0000 -phy_xaui_tx_polarity_flip_12=0x0000 -phy_xaui_rx_polarity_flip_12=0x0001 - -#WC3 -phy_xaui_tx_polarity_flip_13=0x0001 -phy_xaui_rx_polarity_flip_13=0x0000 -phy_xaui_tx_polarity_flip_14=0x0001 -phy_xaui_rx_polarity_flip_14=0x0000 -phy_xaui_tx_polarity_flip_15=0x0001 -phy_xaui_rx_polarity_flip_15=0x0000 -phy_xaui_tx_polarity_flip_16=0x0001 -phy_xaui_rx_polarity_flip_16=0x0000 - -#WC4 -phy_xaui_tx_polarity_flip_17=0x0003 -phy_xaui_rx_polarity_flip_17=0x0000 -phy_xaui_tx_polarity_flip_18=0x0001 -phy_xaui_rx_polarity_flip_18=0x0000 - -#WC5 -phy_xaui_tx_polarity_flip_21=0x0000 -phy_xaui_rx_polarity_flip_21=0x0000 -phy_xaui_tx_polarity_flip_22=0x0000 -phy_xaui_rx_polarity_flip_22=0x0000 - -#WC6 -phy_xaui_tx_polarity_flip_25=0x0002 -phy_xaui_rx_polarity_flip_25=0x0001 -phy_xaui_tx_polarity_flip_26=0x0000 -phy_xaui_rx_polarity_flip_26=0x0001 - -#WC7 -phy_xaui_tx_polarity_flip_29=0x0002 -phy_xaui_rx_polarity_flip_29=0x0000 -phy_xaui_tx_polarity_flip_30=0x0000 -phy_xaui_rx_polarity_flip_30=0x0000 - -#WC28 -phy_xaui_tx_polarity_flip_118=0x0003 -phy_xaui_rx_polarity_flip_118=0x0003 -phy_xaui_tx_polarity_flip_119=0x0003 -phy_xaui_rx_polarity_flip_119=0x0003 - -#WC29 -phy_xaui_tx_polarity_flip_122=0x0000 -phy_xaui_rx_polarity_flip_122=0x0000 -phy_xaui_tx_polarity_flip_123=0x0001 -phy_xaui_rx_polarity_flip_123=0x0000 - -#WC30 -phy_xaui_tx_polarity_flip_126=0x0003 -phy_xaui_rx_polarity_flip_126=0x0000 -phy_xaui_tx_polarity_flip_127=0x0003 -phy_xaui_rx_polarity_flip_127=0x0000 - -#WC31 -phy_xaui_tx_polarity_flip_130=0x0002 -phy_xaui_rx_polarity_flip_130=0x0000 -phy_xaui_tx_polarity_flip_131=0x0001 -phy_xaui_rx_polarity_flip_131=0x0000 - diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/port_config.ini b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/port_config.ini index e1af29b0262f..bcf1388e7c5b 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/port_config.ini +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/port_config.ini @@ -1,113 +1,113 @@ # name lanes alias index speed -Ethernet0 65 Eth1/1 0 25000 -Ethernet1 66 Eth1/2 0 25000 -Ethernet2 67 Eth1/3 0 25000 -Ethernet3 68 Eth1/4 0 25000 -Ethernet4 69 Eth2/1 1 25000 -Ethernet5 70 Eth2/2 1 25000 -Ethernet6 71 Eth2/3 1 25000 -Ethernet7 72 Eth2/4 1 25000 -Ethernet8 73 Eth3/1 2 25000 -Ethernet9 74 Eth3/2 2 25000 -Ethernet10 75 Eth3/3 2 25000 -Ethernet11 76 Eth3/4 2 25000 -Ethernet12 77 Eth4/1 3 25000 -Ethernet13 78 Eth4/2 3 25000 -Ethernet14 79 Eth4/3 3 25000 -Ethernet15 80 Eth4/4 3 25000 -Ethernet16 33 Eth5/1 4 25000 -Ethernet17 34 Eth5/2 4 25000 -Ethernet18 35 Eth5/3 4 25000 -Ethernet19 36 Eth5/4 4 25000 -Ethernet20 37 Eth6/1 5 25000 -Ethernet21 38 Eth6/2 5 25000 -Ethernet22 39 Eth6/3 5 25000 -Ethernet23 40 Eth6/4 5 25000 -Ethernet24 41 Eth7/1 6 25000 -Ethernet25 42 Eth7/2 6 25000 -Ethernet26 43 Eth7/3 6 25000 -Ethernet27 44 Eth7/4 6 25000 -Ethernet28 45 Eth8/1 7 25000 -Ethernet29 46 Eth8/2 7 25000 -Ethernet30 47 Eth8/3 7 25000 -Ethernet31 48 Eth8/4 7 25000 -Ethernet32 49 Eth9/1 8 25000 -Ethernet33 50 Eth9/2 8 25000 -Ethernet34 51 Eth9/3 8 25000 -Ethernet35 52 Eth9/4 8 25000 -Ethernet36 53 Eth10/1 9 25000 -Ethernet37 54 Eth10/2 9 25000 -Ethernet38 55 Eth10/3 9 25000 -Ethernet39 56 Eth10/4 9 25000 -Ethernet40 57 Eth11/1 10 25000 -Ethernet41 58 Eth11/2 10 25000 -Ethernet42 59 Eth11/3 10 25000 -Ethernet43 60 Eth11/4 10 25000 -Ethernet44 61 Eth12/1 11 25000 -Ethernet45 62 Eth12/2 11 25000 -Ethernet46 63 Eth12/3 11 25000 -Ethernet47 64 Eth12/4 11 25000 -Ethernet48 81 Eth13/1 12 25000 -Ethernet49 82 Eth13/2 12 25000 -Ethernet50 83 Eth13/3 12 25000 -Ethernet51 84 Eth13/4 12 25000 -Ethernet52 85 Eth14/1 13 25000 -Ethernet53 86 Eth14/2 13 25000 -Ethernet54 87 Eth14/3 13 25000 -Ethernet55 88 Eth14/4 13 25000 -Ethernet56 89 Eth15/1 14 25000 -Ethernet57 90 Eth15/2 14 25000 -Ethernet58 91 Eth15/3 14 25000 -Ethernet59 92 Eth15/4 14 25000 -Ethernet60 93 Eth16/1 15 25000 -Ethernet61 94 Eth16/2 15 25000 -Ethernet62 95 Eth16/3 15 25000 -Ethernet63 96 Eth16/4 15 25000 -Ethernet64 97 Eth17/1 16 25000 -Ethernet65 98 Eth17/2 16 25000 -Ethernet66 99 Eth17/3 16 25000 -Ethernet67 100 Eth17/4 16 25000 -Ethernet68 101 Eth18/1 17 25000 -Ethernet69 102 Eth18/2 17 25000 -Ethernet70 103 Eth18/3 17 25000 -Ethernet71 104 Eth18/4 17 25000 -Ethernet72 105 Eth19/1 18 25000 -Ethernet73 106 Eth19/2 18 25000 -Ethernet74 107 Eth19/3 18 25000 -Ethernet75 108 Eth19/4 18 25000 -Ethernet76 109 Eth20/1 19 25000 -Ethernet77 110 Eth20/2 19 25000 -Ethernet78 111 Eth20/3 19 25000 -Ethernet79 112 Eth20/4 19 25000 -Ethernet80 1 Eth21/1 20 25000 -Ethernet81 2 Eth21/2 20 25000 -Ethernet82 3 Eth21/3 20 25000 -Ethernet83 4 Eth21/4 20 25000 -Ethernet84 5 Eth22/1 21 25000 -Ethernet85 6 Eth22/2 21 25000 -Ethernet86 7 Eth22/3 21 25000 -Ethernet87 8 Eth22/4 21 25000 -Ethernet88 9 Eth23/1 22 25000 -Ethernet89 10 Eth23/2 22 25000 -Ethernet90 11 Eth23/3 22 25000 -Ethernet91 12 Eth23/4 22 25000 -Ethernet92 13 Eth24/1 23 25000 -Ethernet93 14 Eth24/2 23 25000 -Ethernet94 15 Eth24/3 23 25000 -Ethernet95 16 Eth24/4 23 25000 -Ethernet96 17,18 Eth25/1 24 50000 -Ethernet98 19,20 Eth25/2 24 50000 -Ethernet100 21,22 Eth26/1 25 50000 -Ethernet102 23,24 Eth26/2 25 50000 -Ethernet104 25,26 Eth27/1 26 50000 -Ethernet106 27,28 Eth27/2 26 50000 -Ethernet108 29,30 Eth28/1 27 50000 -Ethernet110 31,32 Eth28/2 27 50000 -Ethernet112 113,114 Eth29/1 28 50000 -Ethernet114 115,116 Eth29/2 28 50000 -Ethernet116 117,118 Eth30/1 29 50000 -Ethernet118 119,120 Eth30/2 29 50000 -Ethernet120 121,122 Eth31/1 30 50000 -Ethernet122 123,124 Eth31/2 30 50000 -Ethernet124 125,126 Eth32/1 31 50000 -Ethernet126 127,128 Eth32/2 31 50000 +Ethernet0 65 Eth1/1 1 25000 +Ethernet1 66 Eth1/2 1 25000 +Ethernet2 67 Eth1/3 1 25000 +Ethernet3 68 Eth1/4 1 25000 +Ethernet4 69 Eth2/1 2 25000 +Ethernet5 70 Eth2/2 2 25000 +Ethernet6 71 Eth2/3 2 25000 +Ethernet7 72 Eth2/4 2 25000 +Ethernet8 73 Eth3/1 3 25000 +Ethernet9 74 Eth3/2 3 25000 +Ethernet10 75 Eth3/3 3 25000 +Ethernet11 76 Eth3/4 3 25000 +Ethernet12 77 Eth4/1 4 25000 +Ethernet13 78 Eth4/2 4 25000 +Ethernet14 79 Eth4/3 4 25000 +Ethernet15 80 Eth4/4 4 25000 +Ethernet16 33 Eth5/1 5 25000 +Ethernet17 34 Eth5/2 5 25000 +Ethernet18 35 Eth5/3 5 25000 +Ethernet19 36 Eth5/4 5 25000 +Ethernet20 37 Eth6/1 6 25000 +Ethernet21 38 Eth6/2 6 25000 +Ethernet22 39 Eth6/3 6 25000 +Ethernet23 40 Eth6/4 6 25000 +Ethernet24 41 Eth7/1 7 25000 +Ethernet25 42 Eth7/2 7 25000 +Ethernet26 43 Eth7/3 7 25000 +Ethernet27 44 Eth7/4 7 25000 +Ethernet28 45 Eth8/1 8 25000 +Ethernet29 46 Eth8/2 8 25000 +Ethernet30 47 Eth8/3 8 25000 +Ethernet31 48 Eth8/4 8 25000 +Ethernet32 49 Eth9/1 9 25000 +Ethernet33 50 Eth9/2 9 25000 +Ethernet34 51 Eth9/3 9 25000 +Ethernet35 52 Eth9/4 9 25000 +Ethernet36 53 Eth10/1 10 25000 +Ethernet37 54 Eth10/2 10 25000 +Ethernet38 55 Eth10/3 10 25000 +Ethernet39 56 Eth10/4 10 25000 +Ethernet40 57 Eth11/1 11 25000 +Ethernet41 58 Eth11/2 11 25000 +Ethernet42 59 Eth11/3 11 25000 +Ethernet43 60 Eth11/4 11 25000 +Ethernet44 61 Eth12/1 12 25000 +Ethernet45 62 Eth12/2 12 25000 +Ethernet46 63 Eth12/3 12 25000 +Ethernet47 64 Eth12/4 12 25000 +Ethernet48 81 Eth13/1 13 25000 +Ethernet49 82 Eth13/2 13 25000 +Ethernet50 83 Eth13/3 13 25000 +Ethernet51 84 Eth13/4 13 25000 +Ethernet52 85 Eth14/1 14 25000 +Ethernet53 86 Eth14/2 14 25000 +Ethernet54 87 Eth14/3 14 25000 +Ethernet55 88 Eth14/4 14 25000 +Ethernet56 89 Eth15/1 15 25000 +Ethernet57 90 Eth15/2 15 25000 +Ethernet58 91 Eth15/3 15 25000 +Ethernet59 92 Eth15/4 15 25000 +Ethernet60 93 Eth16/1 16 25000 +Ethernet61 94 Eth16/2 16 25000 +Ethernet62 95 Eth16/3 16 25000 +Ethernet63 96 Eth16/4 16 25000 +Ethernet64 97 Eth17/1 17 25000 +Ethernet65 98 Eth17/2 17 25000 +Ethernet66 99 Eth17/3 17 25000 +Ethernet67 100 Eth17/4 17 25000 +Ethernet68 101 Eth18/1 18 25000 +Ethernet69 102 Eth18/2 18 25000 +Ethernet70 103 Eth18/3 18 25000 +Ethernet71 104 Eth18/4 18 25000 +Ethernet72 105 Eth19/1 19 25000 +Ethernet73 106 Eth19/2 19 25000 +Ethernet74 107 Eth19/3 19 25000 +Ethernet75 108 Eth19/4 19 25000 +Ethernet76 109 Eth20/1 20 25000 +Ethernet77 110 Eth20/2 20 25000 +Ethernet78 111 Eth20/3 20 25000 +Ethernet79 112 Eth20/4 20 25000 +Ethernet80 1 Eth21/1 21 25000 +Ethernet81 2 Eth21/2 21 25000 +Ethernet82 3 Eth21/3 21 25000 +Ethernet83 4 Eth21/4 21 25000 +Ethernet84 5 Eth22/1 22 25000 +Ethernet85 6 Eth22/2 22 25000 +Ethernet86 7 Eth22/3 22 25000 +Ethernet87 8 Eth22/4 22 25000 +Ethernet88 9 Eth23/1 23 25000 +Ethernet89 10 Eth23/2 23 25000 +Ethernet90 11 Eth23/3 23 25000 +Ethernet91 12 Eth23/4 23 25000 +Ethernet92 13 Eth24/1 24 25000 +Ethernet93 14 Eth24/2 24 25000 +Ethernet94 15 Eth24/3 24 25000 +Ethernet95 16 Eth24/4 24 25000 +Ethernet96 17,18 Eth25/1 25 50000 +Ethernet98 19,20 Eth25/2 25 50000 +Ethernet100 21,22 Eth26/1 26 50000 +Ethernet102 23,24 Eth26/2 26 50000 +Ethernet104 25,26 Eth27/1 27 50000 +Ethernet106 27,28 Eth27/2 27 50000 +Ethernet108 29,30 Eth28/1 28 50000 +Ethernet110 31,32 Eth28/2 28 50000 +Ethernet112 113,114 Eth29/1 29 50000 +Ethernet114 115,116 Eth29/2 29 50000 +Ethernet116 117,118 Eth30/1 30 50000 +Ethernet118 119,120 Eth30/2 30 50000 +Ethernet120 121,122 Eth31/1 31 50000 +Ethernet122 123,124 Eth31/2 31 50000 +Ethernet124 125,126 Eth32/1 32 50000 +Ethernet126 127,128 Eth32/2 32 50000 diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/sai.profile b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/sai.profile index 053313a6574f..7342ae8002e8 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/sai.profile +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-seastone-dx010-96x25G-16x50G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/platform/th-seastone-dx010-config-flex-all.bcm diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50-40/port_config.ini b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50-40/port_config.ini index 9a2b38e6da79..0fc9d317176b 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50-40/port_config.ini +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50-40/port_config.ini @@ -1,49 +1,49 @@ # name lanes alias index speed -Ethernet0 65,66 Eth1/1 0 50000 -Ethernet2 67,68 Eth1/2 0 50000 -Ethernet4 69,70 Eth2/1 1 50000 -Ethernet6 71,72 Eth2/2 1 50000 -Ethernet8 73,74 Eth3/1 2 50000 -Ethernet10 75,76 Eth3/2 2 50000 -Ethernet12 77,78 Eth4/1 3 50000 -Ethernet14 79,80 Eth4/2 3 50000 -Ethernet16 33,34 Eth5/1 4 50000 -Ethernet18 35,36 Eth5/2 4 50000 -Ethernet20 37,38 Eth6/1 5 50000 -Ethernet22 39,40 Eth6/2 5 50000 -Ethernet24 41,42 Eth7/1 6 50000 -Ethernet26 43,44 Eth7/2 6 50000 -Ethernet28 45,46 Eth8/1 7 50000 -Ethernet30 47,48 Eth8/2 7 50000 -Ethernet32 49,50 Eth9/1 8 50000 -Ethernet34 51,52 Eth9/2 8 50000 -Ethernet36 53,54 Eth10/1 9 50000 -Ethernet38 55,56 Eth10/2 9 50000 -Ethernet40 57,58 Eth11/1 10 50000 -Ethernet42 59,60 Eth11/2 10 50000 -Ethernet44 61,62 Eth12/1 11 50000 -Ethernet46 63,64 Eth12/2 11 50000 -Ethernet48 81,82 Eth13/1 12 50000 -Ethernet50 83,84 Eth13/2 12 50000 -Ethernet52 85,86 Eth14/1 13 50000 -Ethernet54 87,88 Eth14/2 13 50000 -Ethernet56 89,90 Eth15/1 14 50000 -Ethernet58 91,92 Eth15/2 14 50000 -Ethernet60 93,94 Eth16/1 15 50000 -Ethernet62 95,96 Eth16/2 15 50000 -Ethernet64 97,98,99,100 Eth17 16 40000 -Ethernet68 101,102,103,104 Eth18 17 40000 -Ethernet72 105,106,107,108 Eth19 18 40000 -Ethernet76 109,110,111,112 Eth20 19 40000 -Ethernet80 1,2,3,4 Eth21 20 40000 -Ethernet84 5,6,7,8 Eth22 21 40000 -Ethernet88 9,10,11,12 Eth23 22 40000 -Ethernet92 13,14,15,16 Eth24 23 40000 -Ethernet96 17,18,19,20 Eth25 24 40000 -Ethernet100 21,22,23,24 Eth26 25 40000 -Ethernet104 25,26,27,28 Eth27 26 40000 -Ethernet108 29,30,31,32 Eth28 27 40000 -Ethernet112 113,114,115,116 Eth29 28 40000 -Ethernet116 117,118,119,120 Eth30 29 40000 -Ethernet120 121,122,123,124 Eth31 30 40000 -Ethernet124 125,126,127,128 Eth32 31 40000 +Ethernet0 65,66 Eth1/1 1 50000 +Ethernet2 67,68 Eth1/2 1 50000 +Ethernet4 69,70 Eth2/1 2 50000 +Ethernet6 71,72 Eth2/2 2 50000 +Ethernet8 73,74 Eth3/1 3 50000 +Ethernet10 75,76 Eth3/2 3 50000 +Ethernet12 77,78 Eth4/1 4 50000 +Ethernet14 79,80 Eth4/2 4 50000 +Ethernet16 33,34 Eth5/1 5 50000 +Ethernet18 35,36 Eth5/2 5 50000 +Ethernet20 37,38 Eth6/1 6 50000 +Ethernet22 39,40 Eth6/2 6 50000 +Ethernet24 41,42 Eth7/1 7 50000 +Ethernet26 43,44 Eth7/2 7 50000 +Ethernet28 45,46 Eth8/1 8 50000 +Ethernet30 47,48 Eth8/2 8 50000 +Ethernet32 49,50 Eth9/1 9 50000 +Ethernet34 51,52 Eth9/2 9 50000 +Ethernet36 53,54 Eth10/1 10 50000 +Ethernet38 55,56 Eth10/2 10 50000 +Ethernet40 57,58 Eth11/1 11 50000 +Ethernet42 59,60 Eth11/2 11 50000 +Ethernet44 61,62 Eth12/1 12 50000 +Ethernet46 63,64 Eth12/2 12 50000 +Ethernet48 81,82 Eth13/1 13 50000 +Ethernet50 83,84 Eth13/2 13 50000 +Ethernet52 85,86 Eth14/1 14 50000 +Ethernet54 87,88 Eth14/2 14 50000 +Ethernet56 89,90 Eth15/1 15 50000 +Ethernet58 91,92 Eth15/2 15 50000 +Ethernet60 93,94 Eth16/1 16 50000 +Ethernet62 95,96 Eth16/2 16 50000 +Ethernet64 97,98,99,100 Eth17 17 40000 +Ethernet68 101,102,103,104 Eth18 18 40000 +Ethernet72 105,106,107,108 Eth19 19 40000 +Ethernet76 109,110,111,112 Eth20 20 40000 +Ethernet80 1,2,3,4 Eth21 21 40000 +Ethernet84 5,6,7,8 Eth22 22 40000 +Ethernet88 9,10,11,12 Eth23 23 40000 +Ethernet92 13,14,15,16 Eth24 24 40000 +Ethernet96 17,18,19,20 Eth25 25 40000 +Ethernet100 21,22,23,24 Eth26 26 40000 +Ethernet104 25,26,27,28 Eth27 27 40000 +Ethernet108 29,30,31,32 Eth28 28 40000 +Ethernet112 113,114,115,116 Eth29 29 40000 +Ethernet116 117,118,119,120 Eth30 30 40000 +Ethernet120 121,122,123,124 Eth31 31 40000 +Ethernet124 125,126,127,128 Eth32 32 40000 diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50-40/sai.profile b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50-40/sai.profile index 3ae50f718493..7342ae8002e8 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50-40/sai.profile +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50-40/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-seastone-dx010-32x50G-16x100G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/platform/th-seastone-dx010-config-flex-all.bcm diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50-40/th-seastone-dx010-32x50G-16x100G.config.bcm b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50-40/th-seastone-dx010-32x50G-16x100G.config.bcm deleted file mode 100644 index ee9e283efe52..000000000000 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50-40/th-seastone-dx010-32x50G-16x100G.config.bcm +++ /dev/null @@ -1,499 +0,0 @@ -# Define default OS / SAL -os=unix - -# all XPORTs to XE ports -#pbmp_xport_xe=0x1fffffffe -pbmp_xport_xe=0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe -pbmp_oversubscribe=0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe - -# Mode control to select L2 Table DMA mode aka L2MODE_POLL (0) or -# L2MOD_FIFO mechanism aka L2MODE_FIFO (1) for L2 table change notification. -l2xmsg_mode=1 - -# Memory table size configs, enable ALPM -l2_mem_entries=8192 -l3_mem_entries=8192 -l3_alpm_enable=2 -ipv6_lpm_128b_enable=1 - -#Use MMU lossy configuration -mmu_lossless=0 - -################################################################################### -# SeaStone customized configuration -################################################################################### - -#ext mdio frequency to 495/0x80/2(1.933Mhz) or 415/0x80/2(1.62MHz) -# default is 40 -# Set external MDIO freq to 6.19MHz (495MHz) or 5.19MHz (415MHz) -#* target_freq is core_clock_freq * DIVIDEND / DIVISOR / 2 -# -rate_ext_mdio_divisor=0x80 - -# use internal rom boot -phy_ext_rom_boot=0 - -oversubscribe_mode=1 - -# Map the physical ports to logical ports -dport_map_enable=1 - -dport_map_port_68=1 -dport_map_port_69=2 - -dport_map_port_72=5 -dport_map_port_73=6 - -dport_map_port_76=9 -dport_map_port_77=10 - -dport_map_port_80=13 -dport_map_port_81=14 - -dport_map_port_34=17 -dport_map_port_35=18 - -dport_map_port_38=21 -dport_map_port_39=22 - -dport_map_port_42=25 -dport_map_port_43=26 - -dport_map_port_46=29 -dport_map_port_47=30 - -dport_map_port_50=33 -dport_map_port_51=34 - -dport_map_port_54=37 -dport_map_port_55=38 - -dport_map_port_58=41 -dport_map_port_59=42 - -dport_map_port_62=45 -dport_map_port_63=46 - -dport_map_port_84=49 -dport_map_port_85=50 - -dport_map_port_88=53 -dport_map_port_89=54 - -dport_map_port_92=57 -dport_map_port_93=58 - -dport_map_port_96=61 -dport_map_port_97=62 - -# 100G/40G ports -dport_map_port_102=65 -dport_map_port_106=69 -dport_map_port_110=73 -dport_map_port_114=77 -dport_map_port_1=81 -dport_map_port_5=85 -dport_map_port_9=89 -dport_map_port_13=93 -dport_map_port_17=97 -dport_map_port_21=101 -dport_map_port_25=105 -dport_map_port_29=109 -dport_map_port_118=113 -dport_map_port_122=117 -dport_map_port_126=121 -dport_map_port_130=125 - - -# port/lane mapping, 32x50G + 16x100G -portmap_68=65:50:2 -portmap_69=67:50:2 - -portmap_72=69:50:2 -portmap_73=71:50:2 - -portmap_76=73:50:2 -portmap_77=75:50:2 - -portmap_80=77:50:2 -portmap_81=79:50:2 - -portmap_34=33:50:2 -portmap_35=35:50:2 - -portmap_38=37:50:2 -portmap_39=39:50:2 - -portmap_42=41:50:2 -portmap_43=43:50:2 - -portmap_46=45:50:2 -portmap_47=47:50:2 - -portmap_50=49:50:2 -portmap_51=51:50:2 - -portmap_54=53:50:2 -portmap_55=55:50:2 - -portmap_58=57:50:2 -portmap_59=59:50:2 - -portmap_62=61:50:2 -portmap_63=63:50:2 - -portmap_84=81:50:2 -portmap_85=83:50:2 - -portmap_88=85:50:2 -portmap_89=87:50:2 - -portmap_92=89:50:2 -portmap_93=91:50:2 - -portmap_96=93:50:2 -portmap_97=95:50:2 - -portmap_102=97:100:4 -portmap_106=101:100:4 -portmap_110=105:100:4 -portmap_114=109:100:4 -portmap_1=1:100:4 -portmap_5=5:100:4 -portmap_9=9:100:4 -portmap_13=13:100:4 -portmap_17=17:100:4 -portmap_21=21:100:4 -portmap_25=25:100:4 -portmap_29=29:100:4 -portmap_118=113:100:4 -portmap_122=117:100:4 -portmap_126=121:100:4 -portmap_130=125:100:4 - - -#WC16 -xgxs_tx_lane_map_68=0x3201 -xgxs_rx_lane_map_68=0x2310 -xgxs_tx_lane_map_69=0x3201 -xgxs_rx_lane_map_69=0x2310 - - -#WC17 -xgxs_tx_lane_map_72=0x3201 -xgxs_rx_lane_map_72=0x2301 -xgxs_tx_lane_map_73=0x3201 -xgxs_rx_lane_map_73=0x2301 - -#WC18 -xgxs_tx_lane_map_76=0x0132 -xgxs_rx_lane_map_76=0x0123 -xgxs_tx_lane_map_77=0x0132 -xgxs_rx_lane_map_77=0x0123 - -#WC19 -xgxs_tx_lane_map_80=0x2031 -xgxs_rx_lane_map_80=0x1320 -xgxs_tx_lane_map_81=0x2031 -xgxs_rx_lane_map_81=0x1320 - -#WC8 -xgxs_tx_lane_map_34=0x3021 -xgxs_rx_lane_map_34=0x0213 -xgxs_tx_lane_map_35=0x3021 -xgxs_rx_lane_map_35=0x0213 - -#WC9 -xgxs_tx_lane_map_38=0x3210 -xgxs_rx_lane_map_38=0x1023 -xgxs_tx_lane_map_39=0x3210 -xgxs_rx_lane_map_39=0x1023 - -#WC10 -xgxs_tx_lane_map_42=0x2310 -xgxs_rx_lane_map_42=0x3210 -xgxs_tx_lane_map_43=0x2310 -xgxs_rx_lane_map_43=0x3210 - -#WC11 -xgxs_tx_lane_map_46=0x1032 -xgxs_rx_lane_map_46=0x1302 -xgxs_tx_lane_map_47=0x1032 -xgxs_rx_lane_map_47=0x1302 - -#WC12 -xgxs_tx_lane_map_50=0x3201 -xgxs_rx_lane_map_50=0x0213 -xgxs_tx_lane_map_51=0x3201 -xgxs_rx_lane_map_51=0x0213 - - -#WC13 -xgxs_tx_lane_map_54=0x2301 -xgxs_rx_lane_map_54=0x2310 -xgxs_tx_lane_map_55=0x2301 -xgxs_rx_lane_map_55=0x2310 - -#WC14 -xgxs_tx_lane_map_58=0x3201 -xgxs_rx_lane_map_58=0x0213 -xgxs_tx_lane_map_59=0x3201 -xgxs_rx_lane_map_59=0x0213 - -#WC15 -xgxs_tx_lane_map_62=0x1302 -xgxs_rx_lane_map_62=0x2310 -xgxs_tx_lane_map_63=0x1302 -xgxs_rx_lane_map_63=0x2310 - -#WC20 -xgxs_tx_lane_map_84=0x0213 -xgxs_rx_lane_map_84=0x2301 -xgxs_tx_lane_map_85=0x0213 -xgxs_rx_lane_map_85=0x2301 - -#WC21 -xgxs_tx_lane_map_88=0x0132 -xgxs_rx_lane_map_88=0x3210 -xgxs_tx_lane_map_89=0x0132 -xgxs_rx_lane_map_89=0x3210 - -#WC22 -xgxs_tx_lane_map_92=0x0132 -xgxs_rx_lane_map_92=0x2031 -xgxs_tx_lane_map_93=0x0132 -xgxs_rx_lane_map_93=0x2031 - -#WC23 -xgxs_tx_lane_map_96=0x2031 -xgxs_rx_lane_map_96=0x3201 -xgxs_tx_lane_map_97=0x2031 -xgxs_rx_lane_map_97=0x3201 - - -#WC24 -xgxs_tx_lane_map_102=0x0132 -xgxs_rx_lane_map_102=0x2301 - -#WC25 -xgxs_tx_lane_map_106=0x0132 -xgxs_rx_lane_map_106=0x3201 - -#WC26 -xgxs_tx_lane_map_110=0x0132 -xgxs_rx_lane_map_110=0x2031 - -#WC27 -xgxs_tx_lane_map_114=0x2031 -xgxs_rx_lane_map_114=0x2301 - -#WC0 -xgxs_tx_lane_map_1=0x3210 -xgxs_rx_lane_map_1=0x3120 - -#WC1 -xgxs_tx_lane_map_5=0x0132 -xgxs_rx_lane_map_5=0x1023 - -#WC2 -xgxs_tx_lane_map_9=0x3201 -xgxs_rx_lane_map_9=0x3120 - -#WC3 -xgxs_tx_lane_map_13=0x2031 -xgxs_rx_lane_map_13=0x1032 - -#WC4 -xgxs_tx_lane_map_17=0x2310 -xgxs_rx_lane_map_17=0x3210 - -#WC5 -xgxs_tx_lane_map_21=0x2301 -xgxs_rx_lane_map_21=0x3120 - -#WC6 -xgxs_tx_lane_map_25=0x3201 -xgxs_rx_lane_map_25=0x0213 - -#WC7 -xgxs_tx_lane_map_29=0x1302 -xgxs_rx_lane_map_29=0x1023 - -#WC28 -xgxs_tx_lane_map_118=0x1320 -xgxs_rx_lane_map_118=0x1302 - -#WC29 -xgxs_tx_lane_map_122=0x1032 -xgxs_rx_lane_map_122=0x1023 - -#WC30 -xgxs_tx_lane_map_126=0x3120 -xgxs_rx_lane_map_126=0x3120 - -#WC31 -xgxs_tx_lane_map_130=0x1302 -xgxs_rx_lane_map_130=0x2310 - - -#Polarity flip settings -#WC16 -phy_xaui_tx_polarity_flip_68=0x0000 -phy_xaui_rx_polarity_flip_68=0x0000 -phy_xaui_tx_polarity_flip_69=0x0000 -phy_xaui_rx_polarity_flip_69=0x0000 - -#WC17 -phy_xaui_tx_polarity_flip_72=0x0001 -phy_xaui_rx_polarity_flip_72=0x0002 -phy_xaui_tx_polarity_flip_73=0x0003 -phy_xaui_rx_polarity_flip_73=0x0000 - -#WC18 -phy_xaui_tx_polarity_flip_76=0x0003 -phy_xaui_rx_polarity_flip_76=0x0000 -phy_xaui_tx_polarity_flip_77=0x0003 -phy_xaui_rx_polarity_flip_77=0x0000 - -#WC19 -phy_xaui_tx_polarity_flip_80=0x0003 -phy_xaui_rx_polarity_flip_80=0x0003 -phy_xaui_tx_polarity_flip_81=0x0003 -phy_xaui_rx_polarity_flip_81=0x0003 - -#WC8 -phy_xaui_tx_polarity_flip_34=0x0002 -phy_xaui_rx_polarity_flip_34=0x0000 -phy_xaui_tx_polarity_flip_35=0x0003 -phy_xaui_rx_polarity_flip_35=0x0000 - -#WC9 -phy_xaui_tx_polarity_flip_38=0x0000 -phy_xaui_rx_polarity_flip_38=0x0000 -phy_xaui_tx_polarity_flip_39=0x0002 -phy_xaui_rx_polarity_flip_39=0x0000 - -#WC10 -phy_xaui_tx_polarity_flip_42=0x0001 -phy_xaui_rx_polarity_flip_42=0x0000 -phy_xaui_tx_polarity_flip_43=0x0003 -phy_xaui_rx_polarity_flip_43=0x0000 - -#WC11 -phy_xaui_tx_polarity_flip_46=0x0000 -phy_xaui_rx_polarity_flip_46=0x0000 -phy_xaui_tx_polarity_flip_47=0x0000 -phy_xaui_rx_polarity_flip_47=0x0000 - -#WC12 -phy_xaui_tx_polarity_flip_50=0x0002 -phy_xaui_rx_polarity_flip_50=0x0000 -phy_xaui_tx_polarity_flip_51=0x0000 -phy_xaui_rx_polarity_flip_51=0x0000 - -#WC13 -phy_xaui_tx_polarity_flip_54=0x0002 -phy_xaui_rx_polarity_flip_54=0x0000 -phy_xaui_tx_polarity_flip_55=0x0000 -phy_xaui_rx_polarity_flip_55=0x0000 - -#WC14 -phy_xaui_tx_polarity_flip_58=0x0000 -phy_xaui_rx_polarity_flip_58=0x0000 -phy_xaui_tx_polarity_flip_59=0x0000 -phy_xaui_rx_polarity_flip_59=0x0000 - -#WC15 -phy_xaui_tx_polarity_flip_62=0x0002 -phy_xaui_rx_polarity_flip_62=0x0003 -phy_xaui_tx_polarity_flip_63=0x0002 -phy_xaui_rx_polarity_flip_63=0x0003 - -#WC20 -phy_xaui_tx_polarity_flip_84=0x0003 -phy_xaui_rx_polarity_flip_84=0x0002 -phy_xaui_tx_polarity_flip_85=0x0001 -phy_xaui_rx_polarity_flip_85=0x0003 - -#WC21 -phy_xaui_tx_polarity_flip_88=0x0001 -phy_xaui_rx_polarity_flip_88=0x0001 -phy_xaui_tx_polarity_flip_89=0x0003 -phy_xaui_rx_polarity_flip_89=0x0003 - -#WC22 -phy_xaui_tx_polarity_flip_92=0x0003 -phy_xaui_rx_polarity_flip_92=0x0000 -phy_xaui_tx_polarity_flip_93=0x0003 -phy_xaui_rx_polarity_flip_93=0x0002 - -#WC23 -phy_xaui_tx_polarity_flip_96=0x0001 -phy_xaui_rx_polarity_flip_96=0x0000 -phy_xaui_tx_polarity_flip_97=0x0001 -phy_xaui_rx_polarity_flip_97=0x0000 - -#WC24 -phy_xaui_tx_polarity_flip_102=0x0000 -phy_xaui_rx_polarity_flip_102=0x000F - -#WC25 -phy_xaui_tx_polarity_flip_106=0x000F -phy_xaui_rx_polarity_flip_106=0x0000 - -#WC26 -phy_xaui_tx_polarity_flip_110=0x000F -phy_xaui_rx_polarity_flip_110=0x000F - -#WC27 -phy_xaui_tx_polarity_flip_114=0x000F -phy_xaui_rx_polarity_flip_114=0x0007 - -#WC0 -phy_xaui_tx_polarity_flip_1=0x0003 -phy_xaui_rx_polarity_flip_1=0x000F - -#WC1 -phy_xaui_tx_polarity_flip_5=0x0007 -phy_xaui_rx_polarity_flip_5=0x0000 - -#WC2 -phy_xaui_tx_polarity_flip_9=0x0002 -phy_xaui_rx_polarity_flip_9=0x0008 - -#WC3 -phy_xaui_tx_polarity_flip_13=0x000F -phy_xaui_rx_polarity_flip_13=0x0000 - -#WC4 -phy_xaui_tx_polarity_flip_17=0x0007 -phy_xaui_rx_polarity_flip_17=0x0000 - -#WC5 -phy_xaui_tx_polarity_flip_21=0x0000 -phy_xaui_rx_polarity_flip_21=0x0000 - -#WC6 -phy_xaui_tx_polarity_flip_25=0x0002 -phy_xaui_rx_polarity_flip_25=0x0005 - -#WC7 -phy_xaui_tx_polarity_flip_29=0x0002 -phy_xaui_rx_polarity_flip_29=0x0000 - -#WC28 -phy_xaui_tx_polarity_flip_118=0x000F -phy_xaui_rx_polarity_flip_118=0x000F - -#WC29 -phy_xaui_tx_polarity_flip_122=0x0004 -phy_xaui_rx_polarity_flip_122=0x0000 - -#WC30 -phy_xaui_tx_polarity_flip_126=0x000F -phy_xaui_rx_polarity_flip_126=0x0000 - -#WC31 -phy_xaui_tx_polarity_flip_130=0x0006 -phy_xaui_rx_polarity_flip_130=0x0000 - diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/sai.profile b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/sai.profile index 075fdfde2229..7342ae8002e8 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/sai.profile +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-seastone-dx010-64x50G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/platform/th-seastone-dx010-config-flex-all.bcm diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/th-seastone-dx010-64x50G.config.bcm b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/th-seastone-dx010-64x50G.config.bcm deleted file mode 100644 index 07814e52ac4a..000000000000 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50/th-seastone-dx010-64x50G.config.bcm +++ /dev/null @@ -1,621 +0,0 @@ -# Define default OS / SAL -os=unix - -# all XPORTs to XE ports -#pbmp_xport_xe=0x1fffffffe -pbmp_xport_xe=0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe -pbmp_oversubscribe=0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe - -# Mode control to select L2 Table DMA mode aka L2MODE_POLL (0) or -# L2MOD_FIFO mechanism aka L2MODE_FIFO (1) for L2 table change notification. -l2xmsg_mode=1 - -# Memory table size configs -l2_mem_entries=8192 -l3_mem_entries=8192 -l3_alpm_enable=2 -ipv6_lpm_128b_enable=1 -mmu_lossless=0 - -################################################################################### -# Celestica Customize for SeaStone -################################################################################### - -#ext mdio frequency to 495/0x80/2(1.933Mhz) or 415/0x80/2(1.62MHz) -# default is 40 -# Set external MDIO freq to 6.19MHz (495MHz) or 5.19MHz (415MHz) -#* target_freq is core_clock_freq * DIVIDEND / DIVISOR / 2 -# -rate_ext_mdio_divisor=0x80 - -# use internal rom boot -phy_ext_rom_boot=0 - -#fpem_mem_entries=32768 -oversubscribe_mode=1 -#pbmp_xport_xe=0x3fd000000ff4000003fc000001fe - -dport_map_enable=1 -dport_map_port_68=1 -dport_map_port_69=2 - -dport_map_port_72=5 -dport_map_port_73=6 - -dport_map_port_76=9 -dport_map_port_77=10 - -dport_map_port_80=13 -dport_map_port_81=14 - -dport_map_port_34=17 -dport_map_port_35=18 - -dport_map_port_38=21 -dport_map_port_39=22 - -dport_map_port_42=25 -dport_map_port_43=26 - -dport_map_port_46=29 -dport_map_port_47=30 - -dport_map_port_50=33 -dport_map_port_51=34 - -dport_map_port_54=37 -dport_map_port_55=38 - -dport_map_port_58=41 -dport_map_port_59=42 - -dport_map_port_62=45 -dport_map_port_63=46 - -dport_map_port_84=49 -dport_map_port_85=50 - -dport_map_port_88=53 -dport_map_port_89=54 - -dport_map_port_92=57 -dport_map_port_93=58 - -dport_map_port_96=61 -dport_map_port_97=62 - -dport_map_port_102=65 -dport_map_port_103=66 - -dport_map_port_106=69 -dport_map_port_107=70 - -dport_map_port_110=73 -dport_map_port_111=74 - -dport_map_port_114=77 -dport_map_port_115=78 - -dport_map_port_1=81 -dport_map_port_2=82 - -dport_map_port_5=85 -dport_map_port_6=86 - -dport_map_port_9=89 -dport_map_port_10=90 - -dport_map_port_13=93 -dport_map_port_14=94 - -dport_map_port_17=97 -dport_map_port_18=98 - -dport_map_port_21=101 -dport_map_port_22=102 - -dport_map_port_25=105 -dport_map_port_26=106 - -dport_map_port_29=109 -dport_map_port_30=110 - -dport_map_port_118=113 -dport_map_port_119=114 - -dport_map_port_122=117 -dport_map_port_123=118 - -dport_map_port_126=121 -dport_map_port_127=122 - -dport_map_port_130=125 -dport_map_port_131=126 - - -# port mapping -portmap_68=65:50:2 -portmap_69=67:50:2 - -portmap_72=69:50:2 -portmap_73=71:50:2 - -portmap_76=73:50:2 -portmap_77=75:50:2 - -portmap_80=77:50:2 -portmap_81=79:50:2 - -portmap_34=33:50:2 -portmap_35=35:50:2 - -portmap_38=37:50:2 -portmap_39=39:50:2 - -portmap_42=41:50:2 -portmap_43=43:50:2 - -portmap_46=45:50:2 -portmap_47=47:50:2 - -portmap_50=49:50:2 -portmap_51=51:50:2 - -portmap_54=53:50:2 -portmap_55=55:50:2 - -portmap_58=57:50:2 -portmap_59=59:50:2 - -portmap_62=61:50:2 -portmap_63=63:50:2 - -portmap_84=81:50:2 -portmap_85=83:50:2 - -portmap_88=85:50:2 -portmap_89=87:50:2 - -portmap_92=89:50:2 -portmap_93=91:50:2 - -portmap_96=93:50:2 -portmap_97=95:50:2 - -portmap_102=97:50:2 -portmap_103=99:50:2 - -portmap_106=101:50:2 -portmap_107=103:50:2 - -portmap_110=105:50:2 -portmap_111=107:50:2 - -portmap_114=109:50:2 -portmap_115=111:50:2 - -portmap_1=1:50:2 -portmap_2=3:50:2 - -portmap_5=5:50:2 -portmap_6=7:50:2 - -portmap_9=9:50:2 -portmap_10=11:50:2 - -portmap_13=13:50:2 -portmap_14=15:50:2 - -portmap_17=17:50:2 -portmap_18=19:50:2 - -portmap_21=21:50:2 -portmap_22=23:50:2 - -portmap_25=25:50:2 -portmap_26=27:50:2 - -portmap_29=29:50:2 -portmap_30=31:50:2 - -portmap_118=113:50:2 -portmap_119=115:50:2 - -portmap_122=117:50:2 -portmap_123=119:50:2 - -portmap_126=121:50:2 -portmap_127=123:50:2 - -portmap_130=125:50:2 -portmap_131=127:50:2 - - -#WC16 -xgxs_tx_lane_map_68=0x3201 -xgxs_rx_lane_map_68=0x2310 -xgxs_tx_lane_map_69=0x3201 -xgxs_rx_lane_map_69=0x2310 - - -#WC17 -xgxs_tx_lane_map_72=0x3201 -xgxs_rx_lane_map_72=0x2301 -xgxs_tx_lane_map_73=0x3201 -xgxs_rx_lane_map_73=0x2301 - -#WC18 -xgxs_tx_lane_map_76=0x0132 -xgxs_rx_lane_map_76=0x0123 -xgxs_tx_lane_map_77=0x0132 -xgxs_rx_lane_map_77=0x0123 - -#WC19 -xgxs_tx_lane_map_80=0x2031 -xgxs_rx_lane_map_80=0x1320 -xgxs_tx_lane_map_81=0x2031 -xgxs_rx_lane_map_81=0x1320 - -#WC8 -xgxs_tx_lane_map_34=0x3021 -xgxs_rx_lane_map_34=0x0213 -xgxs_tx_lane_map_35=0x3021 -xgxs_rx_lane_map_35=0x0213 - -#WC9 -xgxs_tx_lane_map_38=0x3210 -xgxs_rx_lane_map_38=0x1023 -xgxs_tx_lane_map_39=0x3210 -xgxs_rx_lane_map_39=0x1023 - -#WC10 -xgxs_tx_lane_map_42=0x2310 -xgxs_rx_lane_map_42=0x3210 -xgxs_tx_lane_map_43=0x2310 -xgxs_rx_lane_map_43=0x3210 - -#WC11 -xgxs_tx_lane_map_46=0x1032 -xgxs_rx_lane_map_46=0x1302 -xgxs_tx_lane_map_47=0x1032 -xgxs_rx_lane_map_47=0x1302 - -#WC12 -xgxs_tx_lane_map_50=0x3201 -xgxs_rx_lane_map_50=0x0213 -xgxs_tx_lane_map_51=0x3201 -xgxs_rx_lane_map_51=0x0213 - - -#WC13 -xgxs_tx_lane_map_54=0x2301 -xgxs_rx_lane_map_54=0x2310 -xgxs_tx_lane_map_55=0x2301 -xgxs_rx_lane_map_55=0x2310 - -#WC14 -xgxs_tx_lane_map_58=0x3201 -xgxs_rx_lane_map_58=0x0213 -xgxs_tx_lane_map_59=0x3201 -xgxs_rx_lane_map_59=0x0213 - -#WC15 -xgxs_tx_lane_map_62=0x1302 -xgxs_rx_lane_map_62=0x2310 -xgxs_tx_lane_map_63=0x1302 -xgxs_rx_lane_map_63=0x2310 - -#WC20 -xgxs_tx_lane_map_84=0x0213 -xgxs_rx_lane_map_84=0x2301 -xgxs_tx_lane_map_85=0x0213 -xgxs_rx_lane_map_85=0x2301 - -#WC21 -xgxs_tx_lane_map_88=0x0132 -xgxs_rx_lane_map_88=0x3210 -xgxs_tx_lane_map_89=0x0132 -xgxs_rx_lane_map_89=0x3210 - -#WC22 -xgxs_tx_lane_map_92=0x0132 -xgxs_rx_lane_map_92=0x2031 -xgxs_tx_lane_map_93=0x0132 -xgxs_rx_lane_map_93=0x2031 - -#WC23 -xgxs_tx_lane_map_96=0x2031 -xgxs_rx_lane_map_96=0x3201 -xgxs_tx_lane_map_97=0x2031 -xgxs_rx_lane_map_97=0x3201 - -#WC24 -xgxs_tx_lane_map_102=0x0132 -xgxs_rx_lane_map_102=0x2301 -xgxs_tx_lane_map_103=0x0132 -xgxs_rx_lane_map_103=0x2301 - -#WC25 -xgxs_tx_lane_map_106=0x0132 -xgxs_rx_lane_map_106=0x3201 -xgxs_tx_lane_map_107=0x0132 -xgxs_rx_lane_map_107=0x3201 - -#WC26 -xgxs_tx_lane_map_110=0x0132 -xgxs_rx_lane_map_110=0x2031 -xgxs_tx_lane_map_111=0x0132 -xgxs_rx_lane_map_111=0x2031 - -#WC27 -xgxs_tx_lane_map_114=0x2031 -xgxs_rx_lane_map_114=0x2301 -xgxs_tx_lane_map_115=0x2031 -xgxs_rx_lane_map_115=0x2301 - - -#WC0 -xgxs_tx_lane_map_1=0x3210 -xgxs_rx_lane_map_1=0x3120 -xgxs_tx_lane_map_2=0x3210 -xgxs_rx_lane_map_2=0x3120 - -#WC1 -xgxs_tx_lane_map_5=0x0132 -xgxs_rx_lane_map_5=0x1023 -xgxs_tx_lane_map_6=0x0132 -xgxs_rx_lane_map_6=0x1023 - -#WC2 -xgxs_tx_lane_map_9=0x3201 -xgxs_rx_lane_map_9=0x3120 -xgxs_tx_lane_map_10=0x3201 -xgxs_rx_lane_map_10=0x3120 - -#WC3 -xgxs_tx_lane_map_13=0x2031 -xgxs_rx_lane_map_13=0x1032 -xgxs_tx_lane_map_14=0x2031 -xgxs_rx_lane_map_14=0x1032 - -#WC4 -xgxs_tx_lane_map_17=0x2310 -xgxs_rx_lane_map_17=0x3210 -xgxs_tx_lane_map_18=0x2310 -xgxs_rx_lane_map_18=0x3210 - -#WC5 -xgxs_tx_lane_map_21=0x2301 -xgxs_rx_lane_map_21=0x3120 -xgxs_tx_lane_map_22=0x2301 -xgxs_rx_lane_map_22=0x3120 - -#WC6 -xgxs_tx_lane_map_25=0x3201 -xgxs_rx_lane_map_25=0x0213 -xgxs_tx_lane_map_26=0x3201 -xgxs_rx_lane_map_26=0x0213 - -#WC7 -xgxs_tx_lane_map_29=0x1302 -xgxs_rx_lane_map_29=0x1023 -xgxs_tx_lane_map_30=0x1302 -xgxs_rx_lane_map_30=0x1023 - -#WC28 -xgxs_tx_lane_map_118=0x1320 -xgxs_rx_lane_map_118=0x1302 -xgxs_tx_lane_map_119=0x1320 -xgxs_rx_lane_map_119=0x1302 - -#WC29 -xgxs_tx_lane_map_122=0x1032 -xgxs_rx_lane_map_122=0x1023 -xgxs_tx_lane_map_123=0x1032 -xgxs_rx_lane_map_123=0x1023 - -#WC30 -xgxs_tx_lane_map_126=0x3120 -xgxs_rx_lane_map_126=0x3120 -xgxs_tx_lane_map_127=0x3120 -xgxs_rx_lane_map_127=0x3120 - -#WC31 -xgxs_tx_lane_map_130=0x1302 -xgxs_rx_lane_map_130=0x2310 -xgxs_tx_lane_map_131=0x1302 -xgxs_rx_lane_map_131=0x2310 - -#PN - -#WC16 -phy_xaui_tx_polarity_flip_68=0x0000 -phy_xaui_rx_polarity_flip_68=0x0000 -phy_xaui_tx_polarity_flip_69=0x0000 -phy_xaui_rx_polarity_flip_69=0x0000 - -#WC17 -phy_xaui_tx_polarity_flip_72=0x0001 -phy_xaui_rx_polarity_flip_72=0x0002 -phy_xaui_tx_polarity_flip_73=0x0003 -phy_xaui_rx_polarity_flip_73=0x0000 - -#WC18 -phy_xaui_tx_polarity_flip_76=0x0003 -phy_xaui_rx_polarity_flip_76=0x0000 -phy_xaui_tx_polarity_flip_77=0x0003 -phy_xaui_rx_polarity_flip_77=0x0000 - -#WC19 -phy_xaui_tx_polarity_flip_80=0x0003 -phy_xaui_rx_polarity_flip_80=0x0003 -phy_xaui_tx_polarity_flip_81=0x0003 -phy_xaui_rx_polarity_flip_81=0x0003 - -#WC8 -phy_xaui_tx_polarity_flip_34=0x0002 -phy_xaui_rx_polarity_flip_34=0x0000 -phy_xaui_tx_polarity_flip_35=0x0003 -phy_xaui_rx_polarity_flip_35=0x0000 - -#WC9 -phy_xaui_tx_polarity_flip_38=0x0000 -phy_xaui_rx_polarity_flip_38=0x0000 -phy_xaui_tx_polarity_flip_39=0x0002 -phy_xaui_rx_polarity_flip_39=0x0000 - -#WC10 -phy_xaui_tx_polarity_flip_42=0x0001 -phy_xaui_rx_polarity_flip_42=0x0000 -phy_xaui_tx_polarity_flip_43=0x0003 -phy_xaui_rx_polarity_flip_43=0x0000 - -#WC11 -phy_xaui_tx_polarity_flip_46=0x0000 -phy_xaui_rx_polarity_flip_46=0x0000 -phy_xaui_tx_polarity_flip_47=0x0000 -phy_xaui_rx_polarity_flip_47=0x0000 - -#WC12 -phy_xaui_tx_polarity_flip_50=0x0002 -phy_xaui_rx_polarity_flip_50=0x0000 -phy_xaui_tx_polarity_flip_51=0x0000 -phy_xaui_rx_polarity_flip_51=0x0000 - -#WC13 -phy_xaui_tx_polarity_flip_54=0x0002 -phy_xaui_rx_polarity_flip_54=0x0000 -phy_xaui_tx_polarity_flip_55=0x0000 -phy_xaui_rx_polarity_flip_55=0x0000 - -#WC14 -phy_xaui_tx_polarity_flip_58=0x0000 -phy_xaui_rx_polarity_flip_58=0x0000 -phy_xaui_tx_polarity_flip_59=0x0000 -phy_xaui_rx_polarity_flip_59=0x0000 - -#WC15 -phy_xaui_tx_polarity_flip_62=0x0002 -phy_xaui_rx_polarity_flip_62=0x0003 -phy_xaui_tx_polarity_flip_63=0x0002 -phy_xaui_rx_polarity_flip_63=0x0003 - -#WC20 -phy_xaui_tx_polarity_flip_84=0x0003 -phy_xaui_rx_polarity_flip_84=0x0002 -phy_xaui_tx_polarity_flip_85=0x0001 -phy_xaui_rx_polarity_flip_85=0x0003 - -#WC21 -phy_xaui_tx_polarity_flip_88=0x0001 -phy_xaui_rx_polarity_flip_88=0x0001 -phy_xaui_tx_polarity_flip_89=0x0003 -phy_xaui_rx_polarity_flip_89=0x0003 - -#WC22 -phy_xaui_tx_polarity_flip_92=0x0003 -phy_xaui_rx_polarity_flip_92=0x0000 -phy_xaui_tx_polarity_flip_93=0x0003 -phy_xaui_rx_polarity_flip_93=0x0002 - -#WC23 -phy_xaui_tx_polarity_flip_96=0x0001 -phy_xaui_rx_polarity_flip_96=0x0000 -phy_xaui_tx_polarity_flip_97=0x0001 -phy_xaui_rx_polarity_flip_97=0x0000 - -#WC24 -phy_xaui_tx_polarity_flip_102=0x0000 -phy_xaui_rx_polarity_flip_102=0x0003 -phy_xaui_tx_polarity_flip_103=0x0000 -phy_xaui_rx_polarity_flip_103=0x0003 - -#WC25 -phy_xaui_tx_polarity_flip_106=0x0003 -phy_xaui_rx_polarity_flip_106=0x0000 -phy_xaui_tx_polarity_flip_107=0x0003 -phy_xaui_rx_polarity_flip_107=0x0000 - -#WC26 -phy_xaui_tx_polarity_flip_110=0x0003 -phy_xaui_rx_polarity_flip_110=0x0003 -phy_xaui_tx_polarity_flip_111=0x0003 -phy_xaui_rx_polarity_flip_111=0x0003 - -#WC27 -phy_xaui_tx_polarity_flip_114=0x0003 -phy_xaui_rx_polarity_flip_114=0x0003 -phy_xaui_tx_polarity_flip_115=0x0003 -phy_xaui_rx_polarity_flip_115=0x0001 - -#WC0 -phy_xaui_tx_polarity_flip_1=0x0003 -phy_xaui_rx_polarity_flip_1=0x0003 -phy_xaui_tx_polarity_flip_2=0x0000 -phy_xaui_rx_polarity_flip_2=0x0003 - -#WC1 -phy_xaui_tx_polarity_flip_5=0x0003 -phy_xaui_rx_polarity_flip_5=0x0000 -phy_xaui_tx_polarity_flip_6=0x0001 -phy_xaui_rx_polarity_flip_6=0x0000 - -#WC2 -phy_xaui_tx_polarity_flip_9=0x0002 -phy_xaui_rx_polarity_flip_9=0x0000 -phy_xaui_tx_polarity_flip_10=0x0000 -phy_xaui_rx_polarity_flip_10=0x0002 - -#WC3 -phy_xaui_tx_polarity_flip_13=0x0003 -phy_xaui_rx_polarity_flip_13=0x0000 -phy_xaui_tx_polarity_flip_14=0x0003 -phy_xaui_rx_polarity_flip_14=0x0000 - -#WC4 -phy_xaui_tx_polarity_flip_17=0x0003 -phy_xaui_rx_polarity_flip_17=0x0000 -phy_xaui_tx_polarity_flip_18=0x0001 -phy_xaui_rx_polarity_flip_18=0x0000 - -#WC5 -phy_xaui_tx_polarity_flip_21=0x0000 -phy_xaui_rx_polarity_flip_21=0x0000 -phy_xaui_tx_polarity_flip_22=0x0000 -phy_xaui_rx_polarity_flip_22=0x0000 - -#WC6 -phy_xaui_tx_polarity_flip_25=0x0002 -phy_xaui_rx_polarity_flip_25=0x0001 -phy_xaui_tx_polarity_flip_26=0x0000 -phy_xaui_rx_polarity_flip_26=0x0001 - -#WC7 -phy_xaui_tx_polarity_flip_29=0x0002 -phy_xaui_rx_polarity_flip_29=0x0000 -phy_xaui_tx_polarity_flip_30=0x0000 -phy_xaui_rx_polarity_flip_30=0x0000 - -#WC28 -phy_xaui_tx_polarity_flip_118=0x0003 -phy_xaui_rx_polarity_flip_118=0x0003 -phy_xaui_tx_polarity_flip_119=0x0003 -phy_xaui_rx_polarity_flip_119=0x0003 - -#WC29 -phy_xaui_tx_polarity_flip_122=0x0000 -phy_xaui_rx_polarity_flip_122=0x0000 -phy_xaui_tx_polarity_flip_123=0x0001 -phy_xaui_rx_polarity_flip_123=0x0000 - -#WC30 -phy_xaui_tx_polarity_flip_126=0x0003 -phy_xaui_rx_polarity_flip_126=0x0000 -phy_xaui_tx_polarity_flip_127=0x0003 -phy_xaui_rx_polarity_flip_127=0x0000 - -#WC31 -phy_xaui_tx_polarity_flip_130=0x0002 -phy_xaui_rx_polarity_flip_130=0x0000 -phy_xaui_tx_polarity_flip_131=0x0001 -phy_xaui_rx_polarity_flip_131=0x0000 diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/sai.profile b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/sai.profile index 072467af3e9a..7342ae8002e8 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/sai.profile +++ b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th-seastone-dx010-32x100G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/platform/th-seastone-dx010-config-flex-all.bcm diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/th-seastone-dx010-32x100G.config.bcm b/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/th-seastone-dx010-32x100G.config.bcm deleted file mode 100644 index c8f3523189e3..000000000000 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/th-seastone-dx010-32x100G.config.bcm +++ /dev/null @@ -1,374 +0,0 @@ -# Define default OS / SAL -os=unix - -# all XPORTs to XE ports -#pbmp_xport_xe=0x1fffffffe -pbmp_xport_xe=0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe -pbmp_oversubscribe=0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe - -# Mode control to select L2 Table DMA mode aka L2MODE_POLL (0) or -# L2MOD_FIFO mechanism aka L2MODE_FIFO (1) for L2 table change notification. -l2xmsg_mode=1 - -# Memory table size configs -l2_mem_entries=8192 -l3_mem_entries=8192 -l3_alpm_enable=2 -ipv6_lpm_128b_enable=1 -mmu_lossless=0 - -################################################################################### -# Celestica Customize for SeaStone -################################################################################### - -#ext mdio frequency to 495/0x80/2(1.933Mhz) or 415/0x80/2(1.62MHz) -# default is 40 -# Set external MDIO freq to 6.19MHz (495MHz) or 5.19MHz (415MHz) -#* target_freq is core_clock_freq * DIVIDEND / DIVISOR / 2 -# -rate_ext_mdio_divisor=0x80 - -# use internal rom boot -phy_ext_rom_boot=0 - -#fpem_mem_entries=32768 -oversubscribe_mode=1 -#pbmp_xport_xe=0x3fd000000ff4000003fc000001fe - - -dport_map_enable=1 - -dport_map_port_68=1 -dport_map_port_72=5 -dport_map_port_76=9 -dport_map_port_80=13 -dport_map_port_34=17 -dport_map_port_38=21 -dport_map_port_42=25 -dport_map_port_46=29 -dport_map_port_50=33 -dport_map_port_54=37 -dport_map_port_58=41 -dport_map_port_62=45 -dport_map_port_84=49 -dport_map_port_88=53 -dport_map_port_92=57 -dport_map_port_96=61 -dport_map_port_102=65 -dport_map_port_106=69 -dport_map_port_110=73 -dport_map_port_114=77 -dport_map_port_1=81 -dport_map_port_5=85 -dport_map_port_9=89 -dport_map_port_13=93 -dport_map_port_17=97 -dport_map_port_21=101 -dport_map_port_25=105 -dport_map_port_29=109 -dport_map_port_118=113 -dport_map_port_122=117 -dport_map_port_126=121 -dport_map_port_130=125 - - -# port mapping -portmap_68=65:100:4 -portmap_72=69:100:4 -portmap_76=73:100:4 -portmap_80=77:100:4 -portmap_34=33:100:4 -portmap_38=37:100:4 -portmap_42=41:100:4 -portmap_46=45:100:4 -portmap_50=49:100:4 -portmap_54=53:100:4 -portmap_58=57:100:4 -portmap_62=61:100:4 -portmap_84=81:100:4 -portmap_88=85:100:4 -portmap_92=89:100:4 -portmap_96=93:100:4 -portmap_102=97:100:4 -portmap_106=101:100:4 -portmap_110=105:100:4 -portmap_114=109:100:4 -portmap_1=1:100:4 -portmap_5=5:100:4 -portmap_9=9:100:4 -portmap_13=13:100:4 -portmap_17=17:100:4 -portmap_21=21:100:4 -portmap_25=25:100:4 -portmap_29=29:100:4 -portmap_118=113:100:4 -portmap_122=117:100:4 -portmap_126=121:100:4 -portmap_130=125:100:4 -#portmap_66=129:10 -#portmap_100=131:10 - -#WC16 -xgxs_tx_lane_map_68=0x3201 -xgxs_rx_lane_map_68=0x2310 - - -#WC17 -xgxs_tx_lane_map_72=0x3201 -xgxs_rx_lane_map_72=0x2301 - -#WC18 -xgxs_tx_lane_map_76=0x0132 -xgxs_rx_lane_map_76=0x0123 - -#WC19 -xgxs_tx_lane_map_80=0x2031 -xgxs_rx_lane_map_80=0x1320 - -#WC8 -xgxs_tx_lane_map_34=0x3021 -xgxs_rx_lane_map_34=0x0213 - -#WC9 -xgxs_tx_lane_map_38=0x3210 -xgxs_rx_lane_map_38=0x1023 - -#WC10 -xgxs_tx_lane_map_42=0x2310 -xgxs_rx_lane_map_42=0x3210 - -#WC11 -xgxs_tx_lane_map_46=0x1032 -xgxs_rx_lane_map_46=0x1302 - -#WC12 -xgxs_tx_lane_map_50=0x3201 -xgxs_rx_lane_map_50=0x0213 - - -#WC13 -xgxs_tx_lane_map_54=0x2301 -xgxs_rx_lane_map_54=0x2310 - -#WC14 -xgxs_tx_lane_map_58=0x3201 -xgxs_rx_lane_map_58=0x0213 - -#WC15 -xgxs_tx_lane_map_62=0x1302 -xgxs_rx_lane_map_62=0x2310 - -#WC20 -xgxs_tx_lane_map_84=0x0213 -xgxs_rx_lane_map_84=0x2301 - -#WC21 -xgxs_tx_lane_map_88=0x0132 -xgxs_rx_lane_map_88=0x3210 - -#WC22 -xgxs_tx_lane_map_92=0x0132 -xgxs_rx_lane_map_92=0x2031 - -#WC23 -xgxs_tx_lane_map_96=0x2031 -xgxs_rx_lane_map_96=0x3201 - -#WC24 -xgxs_tx_lane_map_102=0x0132 -xgxs_rx_lane_map_102=0x2301 - -#WC25 -xgxs_tx_lane_map_106=0x0132 -xgxs_rx_lane_map_106=0x3201 - -#WC26 -xgxs_tx_lane_map_110=0x0132 -xgxs_rx_lane_map_110=0x2031 - -#WC27 -xgxs_tx_lane_map_114=0x2031 -xgxs_rx_lane_map_114=0x2301 - - -#WC0 -xgxs_tx_lane_map_1=0x3210 -xgxs_rx_lane_map_1=0x3120 - -#WC1 -xgxs_tx_lane_map_5=0x0132 -xgxs_rx_lane_map_5=0x1023 - -#WC2 -xgxs_tx_lane_map_9=0x3201 -xgxs_rx_lane_map_9=0x3120 - -#WC3 -xgxs_tx_lane_map_13=0x2031 -xgxs_rx_lane_map_13=0x1032 - -#WC4 -xgxs_tx_lane_map_17=0x2310 -xgxs_rx_lane_map_17=0x3210 - -#WC5 -xgxs_tx_lane_map_21=0x2301 -xgxs_rx_lane_map_21=0x3120 - -#WC6 -xgxs_tx_lane_map_25=0x3201 -xgxs_rx_lane_map_25=0x0213 - -#WC7 -xgxs_tx_lane_map_29=0x1302 -xgxs_rx_lane_map_29=0x1023 - -#WC28 -xgxs_tx_lane_map_118=0x1320 -xgxs_rx_lane_map_118=0x1302 - -#WC29 -xgxs_tx_lane_map_122=0x1032 -xgxs_rx_lane_map_122=0x1023 - -#WC30 -xgxs_tx_lane_map_126=0x3120 -xgxs_rx_lane_map_126=0x3120 - -#WC31 -xgxs_tx_lane_map_130=0x1302 -xgxs_rx_lane_map_130=0x2310 - -#PN - -#WC16 -phy_xaui_tx_polarity_flip_68=0x0000 -phy_xaui_rx_polarity_flip_68=0x0000 - -#WC17 -phy_xaui_tx_polarity_flip_72=0x000D -phy_xaui_rx_polarity_flip_72=0x0002 - - -#WC18 -phy_xaui_tx_polarity_flip_76=0x000F -phy_xaui_rx_polarity_flip_76=0x0000 - -#WC19 -phy_xaui_tx_polarity_flip_80=0x000F -phy_xaui_rx_polarity_flip_80=0x000F - - -#WC8 -phy_xaui_tx_polarity_flip_34=0x000E -phy_xaui_rx_polarity_flip_34=0x0000 - -#WC9 -phy_xaui_tx_polarity_flip_38=0x0008 -phy_xaui_rx_polarity_flip_38=0x0000 - -#WC10 -phy_xaui_tx_polarity_flip_42=0x000D -phy_xaui_rx_polarity_flip_42=0x0000 - -#WC11 -phy_xaui_tx_polarity_flip_46=0x0000 -phy_xaui_rx_polarity_flip_46=0x0000 - - -#WC12 -phy_xaui_tx_polarity_flip_50=0x0002 -phy_xaui_rx_polarity_flip_50=0x0000 - -#WC13 -phy_xaui_tx_polarity_flip_54=0x0002 -phy_xaui_rx_polarity_flip_54=0x0000 - -#WC14 -phy_xaui_tx_polarity_flip_58=0x0000 -phy_xaui_rx_polarity_flip_58=0x0000 - -#WC15 -phy_xaui_tx_polarity_flip_62=0x000A -phy_xaui_rx_polarity_flip_62=0x000F - - -#WC20 - phy_xaui_tx_polarity_flip_84=0x0007 - phy_xaui_rx_polarity_flip_84=0x000E - -#WC21 -phy_xaui_tx_polarity_flip_88=0x000D -phy_xaui_rx_polarity_flip_88=0x000D - -#WC22 -phy_xaui_tx_polarity_flip_92=0x000F -phy_xaui_rx_polarity_flip_92=0x0008 - -#WC23 -phy_xaui_tx_polarity_flip_96=0x0005 -phy_xaui_rx_polarity_flip_96=0x0000 - -#WC24 -phy_xaui_tx_polarity_flip_102=0x0000 -phy_xaui_rx_polarity_flip_102=0x000F - -#WC25 -phy_xaui_tx_polarity_flip_106=0x000F -phy_xaui_rx_polarity_flip_106=0x0000 - -#WC26 -phy_xaui_tx_polarity_flip_110=0x000F -phy_xaui_rx_polarity_flip_110=0x000F - -#WC27 -phy_xaui_tx_polarity_flip_114=0x000F -phy_xaui_rx_polarity_flip_114=0x0007 - -#WC0 -phy_xaui_tx_polarity_flip_1=0x0003 -phy_xaui_rx_polarity_flip_1=0x000F - -#WC1 -phy_xaui_tx_polarity_flip_5=0x0007 -phy_xaui_rx_polarity_flip_5=0x0000 - -#WC2 -phy_xaui_tx_polarity_flip_9=0x0002 -phy_xaui_rx_polarity_flip_9=0x0008 - -#WC3 -phy_xaui_tx_polarity_flip_13=0x000F -phy_xaui_rx_polarity_flip_13=0x0000 - -#WC4 -phy_xaui_tx_polarity_flip_17=0x0007 -phy_xaui_rx_polarity_flip_17=0x0000 - -#WC5 -phy_xaui_tx_polarity_flip_21=0x0000 -phy_xaui_rx_polarity_flip_21=0x0000 - -#WC6 -phy_xaui_tx_polarity_flip_25=0x0002 -phy_xaui_rx_polarity_flip_25=0x0005 - -#WC7 -phy_xaui_tx_polarity_flip_29=0x0002 -phy_xaui_rx_polarity_flip_29=0x0000 - -#WC28 -phy_xaui_tx_polarity_flip_118=0x000F -phy_xaui_rx_polarity_flip_118=0x000F - -#WC29 -phy_xaui_tx_polarity_flip_122=0x0004 -phy_xaui_rx_polarity_flip_122=0x0000 - -#WC30 -phy_xaui_tx_polarity_flip_126=0x000F -phy_xaui_rx_polarity_flip_126=0x0000 - -#WC31 -phy_xaui_tx_polarity_flip_130=0x0006 -phy_xaui_rx_polarity_flip_130=0x0000 diff --git a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/th-seastone-dx010-96x25G-16x50G.config.bcm b/device/celestica/x86_64-cel_seastone-r0/th-seastone-dx010-config-flex-all.bcm similarity index 67% rename from device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/th-seastone-dx010-96x25G-16x50G.config.bcm rename to device/celestica/x86_64-cel_seastone-r0/th-seastone-dx010-config-flex-all.bcm index 4e772d4eab4d..dc2cdf1c200d 100644 --- a/device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/th-seastone-dx010-96x25G-16x50G.config.bcm +++ b/device/celestica/x86_64-cel_seastone-r0/th-seastone-dx010-config-flex-all.bcm @@ -33,7 +33,9 @@ rate_ext_mdio_divisor=0x80 # use internal rom boot phy_ext_rom_boot=0 +# oversubscribe mode enabled, also allow 25G+50G in the same port macro oversubscribe_mode=1 +oversubscribe_mixed_sister_25_50_enable = 1 # Map the physical ports to logical ports dport_map_enable=1 @@ -160,174 +162,206 @@ dport_map_port_16=96 dport_map_port_17=97 dport_map_port_18=98 +dport_map_port_19=99 +dport_map_port_20=100 dport_map_port_21=101 dport_map_port_22=102 +dport_map_port_23=103 +dport_map_port_24=104 dport_map_port_25=105 dport_map_port_26=106 +dport_map_port_27=107 +dport_map_port_28=108 dport_map_port_29=109 dport_map_port_30=110 +dport_map_port_31=111 +dport_map_port_32=112 dport_map_port_118=113 dport_map_port_119=114 +dport_map_port_120=115 +dport_map_port_121=116 dport_map_port_122=117 dport_map_port_123=118 +dport_map_port_124=119 +dport_map_port_125=120 dport_map_port_126=121 dport_map_port_127=122 +dport_map_port_128=123 +dport_map_port_129=124 dport_map_port_130=125 dport_map_port_131=126 +dport_map_port_132=127 +dport_map_port_133=128 # port/lane mapping, 96x25G + 16x50G -portmap_68=65:25 -portmap_69=66:25 -portmap_70=67:25 -portmap_71=68:25 - -portmap_72=69:25 -portmap_73=70:25 -portmap_74=71:25 -portmap_75=72:25 - -portmap_76=73:25 -portmap_77=74:25 -portmap_78=75:25 -portmap_79=76:25 - -portmap_80=77:25 -portmap_81=78:25 -portmap_82=79:25 -portmap_83=80:25 - -portmap_34=33:25 -portmap_35=34:25 -portmap_36=35:25 -portmap_37=36:25 - -portmap_38=37:25 -portmap_39=38:25 -portmap_40=39:25 -portmap_41=40:25 - -portmap_42=41:25 -portmap_43=42:25 -portmap_44=43:25 -portmap_45=44:25 - -portmap_46=45:25 -portmap_47=46:25 -portmap_48=47:25 -portmap_49=48:25 - -portmap_50=49:25 -portmap_51=50:25 -portmap_52=51:25 -portmap_53=52:25 - -portmap_54=53:25 -portmap_55=54:25 -portmap_56=55:25 -portmap_57=56:25 - -portmap_58=57:25 -portmap_59=58:25 -portmap_60=59:25 -portmap_61=60:25 - -portmap_62=61:25 -portmap_63=62:25 -portmap_64=63:25 -portmap_65=64:25 - -portmap_84=81:25 -portmap_85=82:25 -portmap_86=83:25 -portmap_87=84:25 - -portmap_88=85:25 -portmap_89=86:25 -portmap_90=87:25 -portmap_91=88:25 - -portmap_92=89:25 -portmap_93=90:25 -portmap_94=91:25 -portmap_95=92:25 - -portmap_96=93:25 -portmap_97=94:25 -portmap_98=95:25 -portmap_99=96:25 - -portmap_102=97:25 -portmap_103=98:25 -portmap_104=99:25 -portmap_105=100:25 - -portmap_106=101:25 -portmap_107=102:25 -portmap_108=103:25 -portmap_109=104:25 - -portmap_110=105:25 -portmap_111=106:25 -portmap_112=107:25 -portmap_113=108:25 - -portmap_114=109:25 -portmap_115=110:25 -portmap_116=111:25 -portmap_117=112:25 - -portmap_1=1:25 -portmap_2=2:25 -portmap_3=3:25 -portmap_4=4:25 - -portmap_5=5:25 -portmap_6=6:25 -portmap_7=7:25 -portmap_8=8:25 - -portmap_9=9:25 -portmap_10=10:25 -portmap_11=11:25 -portmap_12=12:25 - -portmap_13=13:25 -portmap_14=14:25 -portmap_15=15:25 -portmap_16=16:25 - - -portmap_17=17:50:2 -portmap_18=19:50:2 - -portmap_21=21:50:2 -portmap_22=23:50:2 - -portmap_25=25:50:2 -portmap_26=27:50:2 - -portmap_29=29:50:2 -portmap_30=31:50:2 - -portmap_118=113:50:2 -portmap_119=115:50:2 - -portmap_122=117:50:2 -portmap_123=119:50:2 - -portmap_126=121:50:2 -portmap_127=123:50:2 - -portmap_130=125:50:2 -portmap_131=127:50:2 +portmap_68=65:100 +portmap_69=66:25:i +portmap_70=67:25:50:i +portmap_71=68:25:i + +portmap_72=69:100 +portmap_73=70:25:i +portmap_74=71:25:50:i +portmap_75=72:25:i + +portmap_76=73:100 +portmap_77=74:25:i +portmap_78=75:25:50:i +portmap_79=76:25:i + +portmap_80=77:100 +portmap_81=78:25:i +portmap_82=79:25:50:i +portmap_83=80:25:i + +portmap_34=33:100 +portmap_35=34:25:i +portmap_36=35:25:50:i +portmap_37=36:25:i + +portmap_38=37:100 +portmap_39=38:25:i +portmap_40=39:25:50:i +portmap_41=40:25:i + +portmap_42=41:100 +portmap_43=42:25:i +portmap_44=43:25:50:i +portmap_45=44:25:i + +portmap_46=45:100 +portmap_47=46:25:i +portmap_48=47:25:50:i +portmap_49=48:25:i + +portmap_50=49:100 +portmap_51=50:25:i +portmap_52=51:25:50:i +portmap_53=52:25:i + +portmap_54=53:100 +portmap_55=54:25:i +portmap_56=55:25:50:i +portmap_57=56:25:i + +portmap_58=57:100 +portmap_59=58:25:i +portmap_60=59:25:50:i +portmap_61=60:25:i + +portmap_62=61:100 +portmap_63=62:25:i +portmap_64=63:25:50:i +portmap_65=64:25:i + +portmap_84=81:100 +portmap_85=82:25:i +portmap_86=83:25:50:i +portmap_87=84:25:i + +portmap_88=85:100 +portmap_89=86:25:i +portmap_90=87:25:50:i +portmap_91=88:25:i + +portmap_92=89:100 +portmap_93=90:25:i +portmap_94=91:25:50:i +portmap_95=92:25:i + +portmap_96=93:100 +portmap_97=94:25:i +portmap_98=95:25:50:i +portmap_99=96:25:i + +portmap_102=97:100 +portmap_103=98:25:i +portmap_104=99:25:50:i +portmap_105=100:25:i + +portmap_106=101:100 +portmap_107=102:25:i +portmap_108=103:25:50:i +portmap_109=104:25:i + +portmap_110=105:100 +portmap_111=106:25:i +portmap_112=107:25:50:i +portmap_113=108:25:i + +portmap_114=109:100 +portmap_115=110:25:i +portmap_116=111:25:50:i +portmap_117=112:25:i + +portmap_1=1:100 +portmap_2=2:25:i +portmap_3=3:25:50:i +portmap_4=4:25:i + +portmap_5=5:100 +portmap_6=6:25:i +portmap_7=7:25:50:i +portmap_8=8:25:i + +portmap_9=9:100 +portmap_10=10:25:i +portmap_11=11:25:50:i +portmap_12=12:25:i + +portmap_13=13:100 +portmap_14=14:25:i +portmap_15=15:25:50:i +portmap_16=16:25:i + + +portmap_17=17:100 +portmap_18=18:25:i +portmap_19=19:25:50:i +portmap_20=20:25:i + +portmap_21=21:100 +portmap_22=22:25:i +portmap_23=23:25:50:i +portmap_24=24:25:i + +portmap_25=25:100 +portmap_26=26:25:i +portmap_27=27:25:50:i +portmap_28=28:25:i + +portmap_29=29:100 +portmap_30=30:25:i +portmap_31=31:25:50:i +portmap_32=32:25:i + +portmap_118=113:100 +portmap_119=114:25:i +portmap_120=115:25:50:i +portmap_121=116:25:i + +portmap_122=117:100 +portmap_123=118:25:i +portmap_124=119:25:50:i +portmap_125=120:25:i + +portmap_126=121:100 +portmap_127=122:25:i +portmap_128=123:25:50:i +portmap_129=124:25:i + +portmap_130=125:100 +portmap_131=126:25:i +portmap_132=127:25:50:i +portmap_133=128:25:i #portmap_66=129:10 #portmap_100=131:10 @@ -580,337 +614,450 @@ xgxs_tx_lane_map_17=0x2310 xgxs_rx_lane_map_17=0x3210 xgxs_tx_lane_map_18=0x2310 xgxs_rx_lane_map_18=0x3210 +xgxs_tx_lane_map_19=0x2310 +xgxs_rx_lane_map_19=0x3210 +xgxs_tx_lane_map_20=0x2310 +xgxs_rx_lane_map_20=0x3210 #WC5 xgxs_tx_lane_map_21=0x2301 xgxs_rx_lane_map_21=0x3120 xgxs_tx_lane_map_22=0x2301 xgxs_rx_lane_map_22=0x3120 +xgxs_tx_lane_map_23=0x2301 +xgxs_rx_lane_map_23=0x3120 +xgxs_tx_lane_map_24=0x2301 +xgxs_rx_lane_map_25=0x3120 #WC6 xgxs_tx_lane_map_25=0x3201 xgxs_rx_lane_map_25=0x0213 xgxs_tx_lane_map_26=0x3201 xgxs_rx_lane_map_26=0x0213 +xgxs_tx_lane_map_27=0x3201 +xgxs_rx_lane_map_27=0x0213 +xgxs_tx_lane_map_28=0x3201 +xgxs_rx_lane_map_28=0x0213 #WC7 xgxs_tx_lane_map_29=0x1302 xgxs_rx_lane_map_29=0x1023 xgxs_tx_lane_map_30=0x1302 xgxs_rx_lane_map_30=0x1023 +xgxs_tx_lane_map_31=0x1302 +xgxs_rx_lane_map_31=0x1023 +xgxs_tx_lane_map_32=0x1302 +xgxs_rx_lane_map_32=0x1023 #WC28 xgxs_tx_lane_map_118=0x1320 xgxs_rx_lane_map_118=0x1302 xgxs_tx_lane_map_119=0x1320 xgxs_rx_lane_map_119=0x1302 +xgxs_tx_lane_map_120=0x1320 +xgxs_rx_lane_map_120=0x1302 +xgxs_tx_lane_map_121=0x1320 +xgxs_rx_lane_map_121=0x1302 #WC29 xgxs_tx_lane_map_122=0x1032 xgxs_rx_lane_map_122=0x1023 xgxs_tx_lane_map_123=0x1032 xgxs_rx_lane_map_123=0x1023 +xgxs_tx_lane_map_124=0x1032 +xgxs_rx_lane_map_124=0x1023 +xgxs_tx_lane_map_125=0x1032 +xgxs_rx_lane_map_125=0x1023 #WC30 xgxs_tx_lane_map_126=0x3120 xgxs_rx_lane_map_126=0x3120 xgxs_tx_lane_map_127=0x3120 xgxs_rx_lane_map_127=0x3120 +xgxs_tx_lane_map_128=0x3120 +xgxs_rx_lane_map_128=0x3120 +xgxs_tx_lane_map_129=0x3120 +xgxs_rx_lane_map_129=0x3120 #WC31 xgxs_tx_lane_map_130=0x1302 xgxs_rx_lane_map_130=0x2310 xgxs_tx_lane_map_131=0x1302 xgxs_rx_lane_map_131=0x2310 +xgxs_tx_lane_map_132=0x1302 +xgxs_rx_lane_map_132=0x2310 +xgxs_tx_lane_map_133=0x1302 +xgxs_rx_lane_map_133=0x2310 #Polarity flip settings #WC16 phy_xaui_tx_polarity_flip_68=0x0000 -phy_xaui_rx_polarity_flip_68=0x0000 phy_xaui_tx_polarity_flip_69=0x0000 -phy_xaui_rx_polarity_flip_69=0x0000 phy_xaui_tx_polarity_flip_70=0x0000 -phy_xaui_rx_polarity_flip_70=0x0000 phy_xaui_tx_polarity_flip_71=0x0000 + +phy_xaui_rx_polarity_flip_68=0x0000 +phy_xaui_rx_polarity_flip_69=0x0000 +phy_xaui_rx_polarity_flip_70=0x0000 phy_xaui_rx_polarity_flip_71=0x0000 #WC17 -phy_xaui_tx_polarity_flip_72=0x0001 -phy_xaui_rx_polarity_flip_72=0x0000 +phy_xaui_tx_polarity_flip_72=0x000D phy_xaui_tx_polarity_flip_73=0x0000 +phy_xaui_tx_polarity_flip_74=0x0003 +phy_xaui_tx_polarity_flip_75=0x0001 + +phy_xaui_rx_polarity_flip_72=0x0002 phy_xaui_rx_polarity_flip_73=0x0001 -phy_xaui_tx_polarity_flip_74=0x0001 phy_xaui_rx_polarity_flip_74=0x0000 -phy_xaui_tx_polarity_flip_75=0x0001 phy_xaui_rx_polarity_flip_75=0x0000 #WC18 -phy_xaui_tx_polarity_flip_76=0x0001 -phy_xaui_rx_polarity_flip_76=0x0000 +phy_xaui_tx_polarity_flip_76=0x000F phy_xaui_tx_polarity_flip_77=0x0001 +phy_xaui_tx_polarity_flip_78=0x0003 +phy_xaui_tx_polarity_flip_79=0x0001 + +phy_xaui_rx_polarity_flip_76=0x0000 phy_xaui_rx_polarity_flip_77=0x0000 -phy_xaui_tx_polarity_flip_78=0x0001 phy_xaui_rx_polarity_flip_78=0x0000 -phy_xaui_tx_polarity_flip_79=0x0001 phy_xaui_rx_polarity_flip_79=0x0000 #WC19 -phy_xaui_tx_polarity_flip_80=0x0001 -phy_xaui_rx_polarity_flip_80=0x0001 +phy_xaui_tx_polarity_flip_80=0x000F phy_xaui_tx_polarity_flip_81=0x0001 -phy_xaui_rx_polarity_flip_81=0x0001 -phy_xaui_tx_polarity_flip_82=0x0001 -phy_xaui_rx_polarity_flip_82=0x0001 +phy_xaui_tx_polarity_flip_82=0x0003 phy_xaui_tx_polarity_flip_83=0x0001 + +phy_xaui_rx_polarity_flip_80=0x000F +phy_xaui_rx_polarity_flip_81=0x0001 +phy_xaui_rx_polarity_flip_82=0x0003 phy_xaui_rx_polarity_flip_83=0x0001 #WC8 -phy_xaui_tx_polarity_flip_34=0x0000 -phy_xaui_rx_polarity_flip_34=0x0000 +phy_xaui_tx_polarity_flip_34=0x000E phy_xaui_tx_polarity_flip_35=0x0001 +phy_xaui_tx_polarity_flip_36=0x0003 +phy_xaui_tx_polarity_flip_37=0x0001 + +phy_xaui_rx_polarity_flip_34=0x0000 phy_xaui_rx_polarity_flip_35=0x0000 -phy_xaui_tx_polarity_flip_36=0x0001 phy_xaui_rx_polarity_flip_36=0x0000 -phy_xaui_tx_polarity_flip_37=0x0001 phy_xaui_rx_polarity_flip_37=0x0000 #WC9 -phy_xaui_tx_polarity_flip_38=0x0000 -phy_xaui_rx_polarity_flip_38=0x0000 +phy_xaui_tx_polarity_flip_38=0x0008 phy_xaui_tx_polarity_flip_39=0x0000 +phy_xaui_tx_polarity_flip_40=0x0002 +phy_xaui_tx_polarity_flip_41=0x0001 + +phy_xaui_rx_polarity_flip_38=0x0000 phy_xaui_rx_polarity_flip_39=0x0000 -phy_xaui_tx_polarity_flip_40=0x0000 phy_xaui_rx_polarity_flip_40=0x0000 -phy_xaui_tx_polarity_flip_41=0x0001 phy_xaui_rx_polarity_flip_41=0x0000 #WC10 -phy_xaui_tx_polarity_flip_42=0x0001 -phy_xaui_rx_polarity_flip_42=0x0000 +phy_xaui_tx_polarity_flip_42=0x000D phy_xaui_tx_polarity_flip_43=0x0000 +phy_xaui_tx_polarity_flip_44=0x0003 +phy_xaui_tx_polarity_flip_45=0x0001 + +phy_xaui_rx_polarity_flip_42=0x0000 phy_xaui_rx_polarity_flip_43=0x0000 -phy_xaui_tx_polarity_flip_44=0x0001 phy_xaui_rx_polarity_flip_44=0x0000 -phy_xaui_tx_polarity_flip_45=0x0001 phy_xaui_rx_polarity_flip_45=0x0000 #WC11 phy_xaui_tx_polarity_flip_46=0x0000 -phy_xaui_rx_polarity_flip_46=0x0000 phy_xaui_tx_polarity_flip_47=0x0000 -phy_xaui_rx_polarity_flip_47=0x0000 phy_xaui_tx_polarity_flip_48=0x0000 -phy_xaui_rx_polarity_flip_48=0x0000 phy_xaui_tx_polarity_flip_49=0x0000 + +phy_xaui_rx_polarity_flip_46=0x0000 +phy_xaui_rx_polarity_flip_47=0x0000 +phy_xaui_rx_polarity_flip_48=0x0000 phy_xaui_rx_polarity_flip_49=0x0000 #WC12 -phy_xaui_tx_polarity_flip_50=0x0000 -phy_xaui_rx_polarity_flip_50=0x0000 +phy_xaui_tx_polarity_flip_50=0x0002 phy_xaui_tx_polarity_flip_51=0x0001 -phy_xaui_rx_polarity_flip_51=0x0000 phy_xaui_tx_polarity_flip_52=0x0000 -phy_xaui_rx_polarity_flip_52=0x0000 phy_xaui_tx_polarity_flip_53=0x0000 + +phy_xaui_rx_polarity_flip_50=0x0000 +phy_xaui_rx_polarity_flip_51=0x0000 +phy_xaui_rx_polarity_flip_52=0x0000 phy_xaui_rx_polarity_flip_53=0x0000 #WC13 -phy_xaui_tx_polarity_flip_54=0x0000 -phy_xaui_rx_polarity_flip_54=0x0000 +phy_xaui_tx_polarity_flip_54=0x0002 phy_xaui_tx_polarity_flip_55=0x0001 -phy_xaui_rx_polarity_flip_55=0x0000 phy_xaui_tx_polarity_flip_56=0x0000 -phy_xaui_rx_polarity_flip_56=0x0000 phy_xaui_tx_polarity_flip_57=0x0000 + +phy_xaui_rx_polarity_flip_54=0x0000 +phy_xaui_rx_polarity_flip_55=0x0000 +phy_xaui_rx_polarity_flip_56=0x0000 phy_xaui_rx_polarity_flip_57=0x0000 #WC14 phy_xaui_tx_polarity_flip_58=0x0000 -phy_xaui_rx_polarity_flip_58=0x0000 phy_xaui_tx_polarity_flip_59=0x0000 -phy_xaui_rx_polarity_flip_59=0x0000 phy_xaui_tx_polarity_flip_60=0x0000 -phy_xaui_rx_polarity_flip_60=0x0000 phy_xaui_tx_polarity_flip_61=0x0000 + +phy_xaui_rx_polarity_flip_58=0x0000 +phy_xaui_rx_polarity_flip_59=0x0000 +phy_xaui_rx_polarity_flip_60=0x0000 phy_xaui_rx_polarity_flip_61=0x0000 #WC15 -phy_xaui_tx_polarity_flip_62=0x0000 -phy_xaui_rx_polarity_flip_62=0x0001 +phy_xaui_tx_polarity_flip_62=0x000A phy_xaui_tx_polarity_flip_63=0x0001 -phy_xaui_rx_polarity_flip_63=0x0001 -phy_xaui_tx_polarity_flip_64=0x0000 -phy_xaui_rx_polarity_flip_64=0x0001 +phy_xaui_tx_polarity_flip_64=0x0002 phy_xaui_tx_polarity_flip_65=0x0001 + +phy_xaui_rx_polarity_flip_62=0x000F +phy_xaui_rx_polarity_flip_63=0x0001 +phy_xaui_rx_polarity_flip_64=0x0003 phy_xaui_rx_polarity_flip_65=0x0001 #WC20 -phy_xaui_tx_polarity_flip_84=0x0001 -phy_xaui_rx_polarity_flip_84=0x0000 +phy_xaui_tx_polarity_flip_84=0x0007 phy_xaui_tx_polarity_flip_85=0x0001 -phy_xaui_rx_polarity_flip_85=0x0001 phy_xaui_tx_polarity_flip_86=0x0001 -phy_xaui_rx_polarity_flip_86=0x0001 phy_xaui_tx_polarity_flip_87=0x0000 + +phy_xaui_rx_polarity_flip_84=0x000E +phy_xaui_rx_polarity_flip_85=0x0001 +phy_xaui_rx_polarity_flip_86=0x0003 phy_xaui_rx_polarity_flip_87=0x0001 #WC21 -phy_xaui_tx_polarity_flip_88=0x0001 -phy_xaui_rx_polarity_flip_88=0x0001 +phy_xaui_tx_polarity_flip_88=0x000D phy_xaui_tx_polarity_flip_89=0x0000 -phy_xaui_rx_polarity_flip_89=0x0000 -phy_xaui_tx_polarity_flip_90=0x0001 -phy_xaui_rx_polarity_flip_90=0x0001 +phy_xaui_tx_polarity_flip_90=0x0003 phy_xaui_tx_polarity_flip_91=0x0001 + +phy_xaui_rx_polarity_flip_88=0x000D +phy_xaui_rx_polarity_flip_89=0x0000 +phy_xaui_rx_polarity_flip_90=0x0003 phy_xaui_rx_polarity_flip_91=0x0001 #WC22 -phy_xaui_tx_polarity_flip_92=0x0001 -phy_xaui_rx_polarity_flip_92=0x0000 +phy_xaui_tx_polarity_flip_92=0x000F phy_xaui_tx_polarity_flip_93=0x0001 -phy_xaui_rx_polarity_flip_93=0x0000 -phy_xaui_tx_polarity_flip_94=0x0001 -phy_xaui_rx_polarity_flip_94=0x0000 +phy_xaui_tx_polarity_flip_94=0x0003 phy_xaui_tx_polarity_flip_95=0x0001 + +phy_xaui_rx_polarity_flip_92=0x0008 +phy_xaui_rx_polarity_flip_93=0x0000 +phy_xaui_rx_polarity_flip_94=0x0002 phy_xaui_rx_polarity_flip_95=0x0001 #WC23 -phy_xaui_tx_polarity_flip_96=0x0001 -phy_xaui_rx_polarity_flip_96=0x0000 +phy_xaui_tx_polarity_flip_96=0x0005 phy_xaui_tx_polarity_flip_97=0x0000 -phy_xaui_rx_polarity_flip_97=0x0000 phy_xaui_tx_polarity_flip_98=0x0001 -phy_xaui_rx_polarity_flip_98=0x0000 phy_xaui_tx_polarity_flip_99=0x0000 + +phy_xaui_rx_polarity_flip_96=0x0000 +phy_xaui_rx_polarity_flip_97=0x0000 +phy_xaui_rx_polarity_flip_98=0x0000 phy_xaui_rx_polarity_flip_99=0x0000 #WC24 phy_xaui_tx_polarity_flip_102=0x0000 -phy_xaui_rx_polarity_flip_102=0x0001 phy_xaui_tx_polarity_flip_103=0x0000 -phy_xaui_rx_polarity_flip_103=0x0001 phy_xaui_tx_polarity_flip_104=0x0000 -phy_xaui_rx_polarity_flip_104=0x0001 phy_xaui_tx_polarity_flip_105=0x0000 + +phy_xaui_rx_polarity_flip_102=0x000F +phy_xaui_rx_polarity_flip_103=0x0001 +phy_xaui_rx_polarity_flip_104=0x0003 phy_xaui_rx_polarity_flip_105=0x0001 #WC25 -phy_xaui_tx_polarity_flip_106=0x0001 -phy_xaui_rx_polarity_flip_106=0x0000 +phy_xaui_tx_polarity_flip_106=0x000F phy_xaui_tx_polarity_flip_107=0x0001 +phy_xaui_tx_polarity_flip_108=0x0003 +phy_xaui_tx_polarity_flip_109=0x0001 + +phy_xaui_rx_polarity_flip_106=0x0000 phy_xaui_rx_polarity_flip_107=0x0000 -phy_xaui_tx_polarity_flip_108=0x0001 phy_xaui_rx_polarity_flip_108=0x0000 -phy_xaui_tx_polarity_flip_109=0x0001 phy_xaui_rx_polarity_flip_109=0x0000 #WC26 -phy_xaui_tx_polarity_flip_110=0x0001 -phy_xaui_rx_polarity_flip_110=0x0001 +phy_xaui_tx_polarity_flip_110=0x000F phy_xaui_tx_polarity_flip_111=0x0001 -phy_xaui_rx_polarity_flip_111=0x0001 -phy_xaui_tx_polarity_flip_112=0x0001 -phy_xaui_rx_polarity_flip_112=0x0001 +phy_xaui_tx_polarity_flip_112=0x0003 phy_xaui_tx_polarity_flip_113=0x0001 + +phy_xaui_rx_polarity_flip_110=0x000F +phy_xaui_rx_polarity_flip_111=0x0001 +phy_xaui_rx_polarity_flip_112=0x0003 phy_xaui_rx_polarity_flip_113=0x0001 #WC27 -phy_xaui_tx_polarity_flip_114=0x0001 -phy_xaui_rx_polarity_flip_114=0x0001 +phy_xaui_tx_polarity_flip_114=0x000F phy_xaui_tx_polarity_flip_115=0x0001 -phy_xaui_rx_polarity_flip_115=0x0001 +phy_xaui_tx_polarity_flip_117=0x0003 phy_xaui_tx_polarity_flip_116=0x0001 + +phy_xaui_rx_polarity_flip_114=0x0007 +phy_xaui_rx_polarity_flip_115=0x0001 phy_xaui_rx_polarity_flip_116=0x0001 -phy_xaui_tx_polarity_flip_117=0x0001 phy_xaui_rx_polarity_flip_117=0x0000 #WC0 -phy_xaui_tx_polarity_flip_1=0x0001 -phy_xaui_rx_polarity_flip_1=0x0001 +phy_xaui_tx_polarity_flip_1=0x0003 phy_xaui_tx_polarity_flip_2=0x0001 -phy_xaui_rx_polarity_flip_2=0x0001 phy_xaui_tx_polarity_flip_3=0x0000 -phy_xaui_rx_polarity_flip_3=0x0001 phy_xaui_tx_polarity_flip_4=0x0000 + +phy_xaui_rx_polarity_flip_1=0x000F +phy_xaui_rx_polarity_flip_2=0x0001 +phy_xaui_rx_polarity_flip_3=0x0003 phy_xaui_rx_polarity_flip_4=0x0001 #WC1 -phy_xaui_tx_polarity_flip_5=0x0001 -phy_xaui_rx_polarity_flip_5=0x0000 +phy_xaui_tx_polarity_flip_5=0x0007 phy_xaui_tx_polarity_flip_6=0x0001 -phy_xaui_rx_polarity_flip_6=0x0000 phy_xaui_tx_polarity_flip_7=0x0001 -phy_xaui_rx_polarity_flip_7=0x0000 phy_xaui_tx_polarity_flip_8=0x0000 + +phy_xaui_rx_polarity_flip_5=0x0000 +phy_xaui_rx_polarity_flip_6=0x0000 +phy_xaui_rx_polarity_flip_7=0x0000 phy_xaui_rx_polarity_flip_8=0x0000 #WC2 -phy_xaui_tx_polarity_flip_9=0x0000 -phy_xaui_rx_polarity_flip_9=0x0000 +phy_xaui_tx_polarity_flip_9=0x0002 phy_xaui_tx_polarity_flip_10=0x0001 -phy_xaui_rx_polarity_flip_10=0x0000 phy_xaui_tx_polarity_flip_11=0x0000 -phy_xaui_rx_polarity_flip_11=0x0000 phy_xaui_tx_polarity_flip_12=0x0000 + +phy_xaui_rx_polarity_flip_9=0x0008 +phy_xaui_rx_polarity_flip_10=0x0000 +phy_xaui_rx_polarity_flip_11=0x0002 phy_xaui_rx_polarity_flip_12=0x0001 #WC3 -phy_xaui_tx_polarity_flip_13=0x0001 -phy_xaui_rx_polarity_flip_13=0x0000 +phy_xaui_tx_polarity_flip_13=0x000F phy_xaui_tx_polarity_flip_14=0x0001 +phy_xaui_tx_polarity_flip_15=0x0003 +phy_xaui_tx_polarity_flip_16=0x0001 + +phy_xaui_rx_polarity_flip_13=0x0000 phy_xaui_rx_polarity_flip_14=0x0000 -phy_xaui_tx_polarity_flip_15=0x0001 phy_xaui_rx_polarity_flip_15=0x0000 -phy_xaui_tx_polarity_flip_16=0x0001 phy_xaui_rx_polarity_flip_16=0x0000 #WC4 -phy_xaui_tx_polarity_flip_17=0x0003 -phy_xaui_rx_polarity_flip_17=0x0000 +phy_xaui_tx_polarity_flip_17=0x0007 phy_xaui_tx_polarity_flip_18=0x0001 +phy_xaui_tx_polarity_flip_19=0x0001 +phy_xaui_tx_polarity_flip_20=0x0000 + + +phy_xaui_rx_polarity_flip_17=0x0000 phy_xaui_rx_polarity_flip_18=0x0000 +phy_xaui_rx_polarity_flip_19=0x0000 +phy_xaui_rx_polarity_flip_20=0x0000 + + #WC5 phy_xaui_tx_polarity_flip_21=0x0000 -phy_xaui_rx_polarity_flip_21=0x0000 phy_xaui_tx_polarity_flip_22=0x0000 +phy_xaui_tx_polarity_flip_23=0x0000 +phy_xaui_tx_polarity_flip_24=0x0000 + +phy_xaui_rx_polarity_flip_21=0x0000 phy_xaui_rx_polarity_flip_22=0x0000 +phy_xaui_rx_polarity_flip_23=0x0000 +phy_xaui_rx_polarity_flip_24=0x0000 + + #WC6 phy_xaui_tx_polarity_flip_25=0x0002 -phy_xaui_rx_polarity_flip_25=0x0001 -phy_xaui_tx_polarity_flip_26=0x0000 -phy_xaui_rx_polarity_flip_26=0x0001 +phy_xaui_tx_polarity_flip_26=0x0001 +phy_xaui_tx_polarity_flip_27=0x0000 +phy_xaui_tx_polarity_flip_28=0x0000 + +phy_xaui_rx_polarity_flip_25=0x0005 +phy_xaui_rx_polarity_flip_26=0x0000 +phy_xaui_rx_polarity_flip_27=0x0001 +phy_xaui_rx_polarity_flip_28=0x0000 + + #WC7 phy_xaui_tx_polarity_flip_29=0x0002 +phy_xaui_tx_polarity_flip_30=0x0001 +phy_xaui_tx_polarity_flip_31=0x0000 +phy_xaui_tx_polarity_flip_32=0x0000 + phy_xaui_rx_polarity_flip_29=0x0000 -phy_xaui_tx_polarity_flip_30=0x0000 phy_xaui_rx_polarity_flip_30=0x0000 +phy_xaui_rx_polarity_flip_31=0x0000 +phy_xaui_rx_polarity_flip_32=0x0000 + + #WC28 -phy_xaui_tx_polarity_flip_118=0x0003 -phy_xaui_rx_polarity_flip_118=0x0003 -phy_xaui_tx_polarity_flip_119=0x0003 -phy_xaui_rx_polarity_flip_119=0x0003 +phy_xaui_tx_polarity_flip_118=0x000F +phy_xaui_tx_polarity_flip_119=0x0001 +phy_xaui_tx_polarity_flip_120=0x0003 +phy_xaui_tx_polarity_flip_121=0x0001 + +phy_xaui_rx_polarity_flip_118=0x000F +phy_xaui_rx_polarity_flip_119=0x0001 +phy_xaui_rx_polarity_flip_120=0x0003 +phy_xaui_rx_polarity_flip_121=0x0001 + + #WC29 -phy_xaui_tx_polarity_flip_122=0x0000 +phy_xaui_tx_polarity_flip_122=0x0004 +phy_xaui_tx_polarity_flip_123=0x0000 +phy_xaui_tx_polarity_flip_124=0x0001 +phy_xaui_tx_polarity_flip_125=0x0000 + phy_xaui_rx_polarity_flip_122=0x0000 -phy_xaui_tx_polarity_flip_123=0x0001 phy_xaui_rx_polarity_flip_123=0x0000 +phy_xaui_rx_polarity_flip_124=0x0000 +phy_xaui_rx_polarity_flip_125=0x0000 + + #WC30 -phy_xaui_tx_polarity_flip_126=0x0003 +phy_xaui_tx_polarity_flip_126=0x000F +phy_xaui_tx_polarity_flip_127=0x0001 +phy_xaui_tx_polarity_flip_128=0x0003 +phy_xaui_tx_polarity_flip_129=0x0001 + phy_xaui_rx_polarity_flip_126=0x0000 -phy_xaui_tx_polarity_flip_127=0x0003 phy_xaui_rx_polarity_flip_127=0x0000 +phy_xaui_rx_polarity_flip_128=0x0000 +phy_xaui_rx_polarity_flip_129=0x0000 + + #WC31 -phy_xaui_tx_polarity_flip_130=0x0002 -phy_xaui_rx_polarity_flip_130=0x0000 +phy_xaui_tx_polarity_flip_130=0x0006 phy_xaui_tx_polarity_flip_131=0x0001 +phy_xaui_tx_polarity_flip_132=0x0001 +phy_xaui_tx_polarity_flip_133=0x0000 + +phy_xaui_rx_polarity_flip_130=0x0000 phy_xaui_rx_polarity_flip_131=0x0000 +phy_xaui_rx_polarity_flip_132=0x0000 +phy_xaui_rx_polarity_flip_133=0x0000 + + diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-C32/buffers_defaults_t0.j2 b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-C32/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..98ec91a9b694 --- /dev/null +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-C32/buffers_defaults_t0.j2 @@ -0,0 +1,37 @@ + +{%- set default_cable = '40m' %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "28550336", + "type": "ingress", + "mode": "dynamic", + "xoff": "4194112" + }, + "egress_pool": { + "size": "28550336", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"[BUFFER_POOL|egress_pool]", + "size":"0", + "mode": "static", + "static_th":"32744448" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_pool]", + "size":"0", + "mode": "dynamic", + "dynamic_th":"3" + } + }, +{%- endmacro %} diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-C32/buffers_defaults_t1.j2 b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-C32/buffers_defaults_t1.j2 index 181ca345c36d..98ec91a9b694 100644 --- a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-C32/buffers_defaults_t1.j2 +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-C32/buffers_defaults_t1.j2 @@ -1,28 +1,16 @@ {%- set default_cable = '40m' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx*4)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "27678784", + "size": "28550336", "type": "ingress", "mode": "dynamic", "xoff": "4194112" }, - "egress_lossy_pool": { - "size": "26045524", - "type": "egress", - "mode": "dynamic" - }, - "egress_lossless_pool": { - "size": "32786432", + "egress_pool": { + "size": "28550336", "type": "egress", "mode": "static" } @@ -34,13 +22,15 @@ "dynamic_th":"3" }, "egress_lossless_profile": { - "pool":"[BUFFER_POOL|egress_lossless_pool]", - "size":"1518", - "static_th":"3995680" + "pool":"[BUFFER_POOL|egress_pool]", + "size":"0", + "mode": "static", + "static_th":"32744448" }, "egress_lossy_profile": { - "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"1518", + "pool":"[BUFFER_POOL|egress_pool]", + "size":"0", + "mode": "dynamic", "dynamic_th":"3" } }, diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-C32/td3-s5232f-32x100G.config.bcm b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-C32/td3-s5232f-32x100G.config.bcm index 964046c808af..e5b61b7f1b58 100644 --- a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-C32/td3-s5232f-32x100G.config.bcm +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-C32/td3-s5232f-32x100G.config.bcm @@ -37,7 +37,6 @@ l3_max_ecmp_mode=1 bcm_tunnel_term_compatible_mode=1 ifp_inports_support_enable=1 -mmu_init_config="MSFT-TD3-Tier1" stable_size=0x5500000 @@ -542,4 +541,4 @@ dport_map_port_129=126 dport_map_port_66=127 dport_map_port_130=128 - +mmu_init_config="TD3-DEFAULT-LOSSLESS-P3P4" diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-100G/buffers_defaults_t0.j2 b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-100G/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..c31728e46543 --- /dev/null +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-100G/buffers_defaults_t0.j2 @@ -0,0 +1,46 @@ + +{%- set default_cable = '40m' %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "32744448", + "type": "ingress", + "mode": "static" + }, + "egress_lossy_pool": { + "size": "32744448", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"32744448" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_pg_profils(port_names_active) %} + "BUFFER_PG": { + "{{ port_names_active }}|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, +{%- endmacro %} + +{% macro generate_queue_buffers(port_names_active) %} + "BUFFER_QUEUE": { + "{{ port_names_active }}|0-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +{% endmacro %} + diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-100G/buffers_defaults_t1.j2 b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-100G/buffers_defaults_t1.j2 index b054c50d48b6..c31728e46543 100644 --- a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-100G/buffers_defaults_t1.j2 +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-100G/buffers_defaults_t1.j2 @@ -1,22 +1,15 @@ {%- set default_cable = '40m' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx*4)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "33554432", + "size": "32744448", "type": "ingress", - "mode": "dynamic" + "mode": "static" }, "egress_lossy_pool": { - "size": "32786432", + "size": "32744448", "type": "egress", "mode": "dynamic" } @@ -25,11 +18,11 @@ "ingress_lossy_profile": { "pool":"[BUFFER_POOL|ingress_lossless_pool]", "size":"0", - "dynamic_th":"3" + "static_th":"32744448" }, "egress_lossy_profile": { "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"1518", + "size":"0", "dynamic_th":"3" } }, @@ -45,7 +38,7 @@ {% macro generate_queue_buffers(port_names_active) %} "BUFFER_QUEUE": { - "{{ port_names_active }}|0-7": { + "{{ port_names_active }}|0-6": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" } } diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-100G/pg_profile_lookup.ini b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-100G/pg_profile_lookup.ini deleted file mode 100644 index aedda37a8878..000000000000 --- a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-100G/pg_profile_lookup.ini +++ /dev/null @@ -1,17 +0,0 @@ -# PG lossless profiles. -# speed cable size xon xoff threshold xon_offset - 10000 5m 1248 2288 35776 -3 2288 - 25000 5m 1248 2288 53248 -3 2288 - 40000 5m 1248 2288 66560 -3 2288 - 50000 5m 1248 2288 90272 -3 2288 - 100000 5m 1248 2288 165568 -3 2288 - 10000 40m 1248 2288 37024 -3 2288 - 25000 40m 1248 2288 53248 -3 2288 - 40000 40m 1248 2288 71552 -3 2288 - 50000 40m 1248 2288 96096 -3 2288 - 100000 40m 1248 2288 177632 -3 2288 - 10000 300m 1248 2288 46176 -3 2288 - 25000 300m 1248 2288 79040 -3 2288 - 40000 300m 1248 2288 108160 -3 2288 - 50000 300m 1248 2288 141856 -3 2288 - 100000 300m 1248 2288 268736 -3 2288 diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-100G/qos.json.j2 b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-100G/qos.json.j2 index ca6f5e739c0c..d2b3d2b0131c 100644 --- a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-100G/qos.json.j2 +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-100G/qos.json.j2 @@ -36,7 +36,7 @@ {{- generate_tc_to_pg_map() }} {% else %} "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { + "DEFAULT": { "0": "0", "1": "0", "2": "0", @@ -44,12 +44,12 @@ "4": "0", "5": "0", "6": "0", - "7": "0" + "7": "7" } }, {% endif %} "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { + "DEFAULT": { "0": "0", "1": "1", "2": "2", @@ -61,7 +61,7 @@ } }, "TC_TO_QUEUE_MAP": { - "AZURE": { + "DEFAULT": { "0": "0", "1": "1", "2": "2", @@ -73,7 +73,7 @@ } }, "DSCP_TO_TC_MAP": { - "AZURE": { + "DEFAULT": { "0" : "0", "1" : "0", "2" : "0", @@ -174,19 +174,11 @@ "weight": "50" } }, -{% if asic_type in pfc_to_pg_map_supported_asics %} - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "3": "3", - "4": "4" - } - }, -{% endif %} "PORT_QOS_MAP": { "{{ port_names_active }}": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]" + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|DEFAULT]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|DEFAULT]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|DEFAULT]" } }, "QUEUE": { diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-100G/td3-s5232f-32x100G.config.bcm b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-100G/td3-s5232f-32x100G.config.bcm index 964046c808af..533e19aca1c2 100644 --- a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-100G/td3-s5232f-32x100G.config.bcm +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-100G/td3-s5232f-32x100G.config.bcm @@ -37,7 +37,6 @@ l3_max_ecmp_mode=1 bcm_tunnel_term_compatible_mode=1 ifp_inports_support_enable=1 -mmu_init_config="MSFT-TD3-Tier1" stable_size=0x5500000 @@ -542,4 +541,4 @@ dport_map_port_129=126 dport_map_port_66=127 dport_map_port_130=128 - +mmu_init_config="TD3-DEFAULT" diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/buffers_defaults_t0.j2 b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..c31728e46543 --- /dev/null +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/buffers_defaults_t0.j2 @@ -0,0 +1,46 @@ + +{%- set default_cable = '40m' %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "32744448", + "type": "ingress", + "mode": "static" + }, + "egress_lossy_pool": { + "size": "32744448", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"32744448" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_pg_profils(port_names_active) %} + "BUFFER_PG": { + "{{ port_names_active }}|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, +{%- endmacro %} + +{% macro generate_queue_buffers(port_names_active) %} + "BUFFER_QUEUE": { + "{{ port_names_active }}|0-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +{% endmacro %} + diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/buffers_defaults_t1.j2 b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/buffers_defaults_t1.j2 index b054c50d48b6..c31728e46543 100644 --- a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/buffers_defaults_t1.j2 +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/buffers_defaults_t1.j2 @@ -1,22 +1,15 @@ {%- set default_cable = '40m' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx*4)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "33554432", + "size": "32744448", "type": "ingress", - "mode": "dynamic" + "mode": "static" }, "egress_lossy_pool": { - "size": "32786432", + "size": "32744448", "type": "egress", "mode": "dynamic" } @@ -25,11 +18,11 @@ "ingress_lossy_profile": { "pool":"[BUFFER_POOL|ingress_lossless_pool]", "size":"0", - "dynamic_th":"3" + "static_th":"32744448" }, "egress_lossy_profile": { "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"1518", + "size":"0", "dynamic_th":"3" } }, @@ -45,7 +38,7 @@ {% macro generate_queue_buffers(port_names_active) %} "BUFFER_QUEUE": { - "{{ port_names_active }}|0-7": { + "{{ port_names_active }}|0-6": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" } } diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/qos.json.j2 b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/qos.json.j2 index ca6f5e739c0c..d2b3d2b0131c 100644 --- a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/qos.json.j2 +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/qos.json.j2 @@ -36,7 +36,7 @@ {{- generate_tc_to_pg_map() }} {% else %} "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { + "DEFAULT": { "0": "0", "1": "0", "2": "0", @@ -44,12 +44,12 @@ "4": "0", "5": "0", "6": "0", - "7": "0" + "7": "7" } }, {% endif %} "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { + "DEFAULT": { "0": "0", "1": "1", "2": "2", @@ -61,7 +61,7 @@ } }, "TC_TO_QUEUE_MAP": { - "AZURE": { + "DEFAULT": { "0": "0", "1": "1", "2": "2", @@ -73,7 +73,7 @@ } }, "DSCP_TO_TC_MAP": { - "AZURE": { + "DEFAULT": { "0" : "0", "1" : "0", "2" : "0", @@ -174,19 +174,11 @@ "weight": "50" } }, -{% if asic_type in pfc_to_pg_map_supported_asics %} - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "3": "3", - "4": "4" - } - }, -{% endif %} "PORT_QOS_MAP": { "{{ port_names_active }}": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]" + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|DEFAULT]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|DEFAULT]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|DEFAULT]" } }, "QUEUE": { diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/sai.profile b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/sai.profile index 9315096e8729..947af7ebacc3 100644 --- a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/sai.profile +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td3-s5232f-8x100G-96x10G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td3-s5232f-96x10G+8x100G.config.bcm diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/td3-s5232f-96x10G+8x100G.config.bcm b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/td3-s5232f-96x10G+8x100G.config.bcm index cd7dfd2fea5f..0da20afc2203 100644 --- a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/td3-s5232f-96x10G+8x100G.config.bcm +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-10G/td3-s5232f-96x10G+8x100G.config.bcm @@ -37,7 +37,6 @@ l3_max_ecmp_mode=1 bcm_tunnel_term_compatible_mode=1 ifp_inports_support_enable=1 -mmu_init_config="MSFT-TD3-Tier1" stable_size=0x5500000 @@ -615,4 +614,4 @@ dport_map_port_129=126 dport_map_port_66=127 dport_map_port_130=128 - +mmu_init_config="TD3-DEFAULT" diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/buffers_defaults_t0.j2 b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..c31728e46543 --- /dev/null +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/buffers_defaults_t0.j2 @@ -0,0 +1,46 @@ + +{%- set default_cable = '40m' %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "32744448", + "type": "ingress", + "mode": "static" + }, + "egress_lossy_pool": { + "size": "32744448", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "size":"0", + "static_th":"32744448" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"0", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_pg_profils(port_names_active) %} + "BUFFER_PG": { + "{{ port_names_active }}|0": { + "profile" : "[BUFFER_PROFILE|ingress_lossy_profile]" + } + }, +{%- endmacro %} + +{% macro generate_queue_buffers(port_names_active) %} + "BUFFER_QUEUE": { + "{{ port_names_active }}|0-6": { + "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" + } + } +{% endmacro %} + diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/buffers_defaults_t1.j2 b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/buffers_defaults_t1.j2 index b054c50d48b6..c31728e46543 100644 --- a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/buffers_defaults_t1.j2 +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/buffers_defaults_t1.j2 @@ -1,22 +1,15 @@ {%- set default_cable = '40m' %} -{%- macro generate_port_lists(PORT_ALL) %} - {# Generate list of ports #} - {%- for port_idx in range(0,32) %} - {%- if PORT_ALL.append("Ethernet%d" % (port_idx*4)) %}{%- endif %} - {%- endfor %} -{%- endmacro %} - {%- macro generate_buffer_pool_and_profiles() %} "BUFFER_POOL": { "ingress_lossless_pool": { - "size": "33554432", + "size": "32744448", "type": "ingress", - "mode": "dynamic" + "mode": "static" }, "egress_lossy_pool": { - "size": "32786432", + "size": "32744448", "type": "egress", "mode": "dynamic" } @@ -25,11 +18,11 @@ "ingress_lossy_profile": { "pool":"[BUFFER_POOL|ingress_lossless_pool]", "size":"0", - "dynamic_th":"3" + "static_th":"32744448" }, "egress_lossy_profile": { "pool":"[BUFFER_POOL|egress_lossy_pool]", - "size":"1518", + "size":"0", "dynamic_th":"3" } }, @@ -45,7 +38,7 @@ {% macro generate_queue_buffers(port_names_active) %} "BUFFER_QUEUE": { - "{{ port_names_active }}|0-7": { + "{{ port_names_active }}|0-6": { "profile" : "[BUFFER_PROFILE|egress_lossy_profile]" } } diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/qos.json.j2 b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/qos.json.j2 index ca6f5e739c0c..d2b3d2b0131c 100644 --- a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/qos.json.j2 +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/qos.json.j2 @@ -36,7 +36,7 @@ {{- generate_tc_to_pg_map() }} {% else %} "TC_TO_PRIORITY_GROUP_MAP": { - "AZURE": { + "DEFAULT": { "0": "0", "1": "0", "2": "0", @@ -44,12 +44,12 @@ "4": "0", "5": "0", "6": "0", - "7": "0" + "7": "7" } }, {% endif %} "MAP_PFC_PRIORITY_TO_QUEUE": { - "AZURE": { + "DEFAULT": { "0": "0", "1": "1", "2": "2", @@ -61,7 +61,7 @@ } }, "TC_TO_QUEUE_MAP": { - "AZURE": { + "DEFAULT": { "0": "0", "1": "1", "2": "2", @@ -73,7 +73,7 @@ } }, "DSCP_TO_TC_MAP": { - "AZURE": { + "DEFAULT": { "0" : "0", "1" : "0", "2" : "0", @@ -174,19 +174,11 @@ "weight": "50" } }, -{% if asic_type in pfc_to_pg_map_supported_asics %} - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { - "AZURE": { - "3": "3", - "4": "4" - } - }, -{% endif %} "PORT_QOS_MAP": { "{{ port_names_active }}": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]" + "dscp_to_tc_map" : "[DSCP_TO_TC_MAP|DEFAULT]", + "tc_to_queue_map" : "[TC_TO_QUEUE_MAP|DEFAULT]", + "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|DEFAULT]" } }, "QUEUE": { diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/sai.profile b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/sai.profile index a597925a8205..ae09492f0e76 100644 --- a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/sai.profile +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/sai.profile @@ -1 +1 @@ -SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td3-s5232f-8x100G-96x25G.config.bcm +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td3-s5232f-96x25G+8x100G.config.bcm diff --git a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/td3-s5232f-96x25G+8x100G.config.bcm b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/td3-s5232f-96x25G+8x100G.config.bcm index f76764e2756d..47cbb41f4073 100644 --- a/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/td3-s5232f-96x25G+8x100G.config.bcm +++ b/device/dell/x86_64-dellemc_s5232f_c3538-r0/DellEMC-S5232f-P-25G/td3-s5232f-96x25G+8x100G.config.bcm @@ -37,7 +37,6 @@ l3_max_ecmp_mode=1 bcm_tunnel_term_compatible_mode=1 ifp_inports_support_enable=1 -mmu_init_config="MSFT-TD3-Tier1" stable_size=0x5500000 @@ -615,4 +614,4 @@ dport_map_port_129=126 dport_map_port_66=127 dport_map_port_130=128 - +mmu_init_config="TD3-DEFAULT" diff --git a/device/dell/x86_64-dellemc_z9264f_c3538-r0/media_settings.json b/device/dell/x86_64-dellemc_z9264f_c3538-r0/media_settings.json index 40f71d43e0bb..e0d81f8146c0 100644 --- a/device/dell/x86_64-dellemc_z9264f_c3538-r0/media_settings.json +++ b/device/dell/x86_64-dellemc_z9264f_c3538-r0/media_settings.json @@ -225,16 +225,16 @@ "preemphasis": { "lane0": "0xE4511", "lane1": "0xE4511", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { "lane0": "0xE4511", "lane1": "0xE4511", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -517,18 +517,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -615,18 +615,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -713,18 +713,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -985,7 +985,7 @@ "preemphasis": { "lane0": "0x13440d", "lane1": "0x13460b", - "lane2": "0x16470a", + "lane2": "0x13470a", "lane3": "0x12480a" } }, @@ -1008,7 +1008,7 @@ "QSFP28-40GBASE-CR4-3M": { "preemphasis": { "lane0": "0xE4511", - "lane1": "0xA480F", + "lane1": "0xA4B0F", "lane2": "0xE4511", "lane3": "0xE4511" } @@ -1016,7 +1016,7 @@ "QSFP28-40GBASE-CR4-5M": { "preemphasis": { "lane0": "0xE4511", - "lane1": "0xA480F", + "lane1": "0xA4B0F", "lane2": "0xE4511", "lane3": "0xE4511" } @@ -1105,18 +1105,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -1203,18 +1203,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", + "lane0": "0xA4B0F", "lane1": "0xE4610", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", + "lane0": "0xA4B0F", "lane1": "0xE4610", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -1301,18 +1301,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -1399,18 +1399,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -1497,18 +1497,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -1595,18 +1595,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -1693,18 +1693,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -1791,18 +1791,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -1889,18 +1889,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -1987,18 +1987,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -2085,18 +2085,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -2257,7 +2257,7 @@ "24": { "Default": { "preemphasis": { - "lane0": "0x13490a", + "lane0": "0x13470a", "lane1": "0x13460b", "lane2": "0x13460b", "lane3": "0x14450b" @@ -2477,18 +2477,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -2575,18 +2575,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", + "lane0": "0xA4B0F", "lane1": "0xE4610", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", + "lane0": "0xA4B0F", "lane1": "0xE4610", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -2673,18 +2673,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -2771,17 +2771,17 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", + "lane0": "0xA4B0F", "lane1": "0xE4610", - "lane2": "0xA480F", + "lane2": "0xA4B0F", "lane3": "0xE4511" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", + "lane0": "0xA4B0F", "lane1": "0xE4610", - "lane2": "0xA480F", + "lane2": "0xA4B0F", "lane3": "0xE4511" } }, @@ -2869,17 +2869,17 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", + "lane0": "0xA4B0F", "lane1": "0xE4511", - "lane2": "0xA480F", + "lane2": "0xA4B0F", "lane3": "0xE4511" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", + "lane0": "0xA4B0F", "lane1": "0xE4511", - "lane2": "0xA480F", + "lane2": "0xA4B0F", "lane3": "0xE4511" } }, @@ -3359,7 +3359,7 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", + "lane0": "0xA4B0F", "lane1": "0xE4511", "lane2": "0xE4511", "lane3": "0xE4511" @@ -3367,7 +3367,7 @@ }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", + "lane0": "0xA4B0F", "lane1": "0xE4511", "lane2": "0xE4511", "lane3": "0xE4511" @@ -3457,17 +3457,17 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", + "lane0": "0xA4B0F", "lane1": "0xE4511", - "lane2": "0xA480F", + "lane2": "0xA4B0F", "lane3": "0xE4511" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", + "lane0": "0xA4B0F", "lane1": "0xE4511", - "lane2": "0xA480F", + "lane2": "0xA4B0F", "lane3": "0xE4511" } }, @@ -3555,18 +3555,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -3653,18 +3653,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -3751,18 +3751,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -3849,18 +3849,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -4143,18 +4143,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -4241,18 +4241,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -4339,18 +4339,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -4437,18 +4437,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -4535,18 +4535,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -4633,18 +4633,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -4731,18 +4731,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -4829,18 +4829,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -4927,18 +4927,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -5025,18 +5025,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -5123,18 +5123,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -5221,18 +5221,18 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", - "lane1": "0xA480F", - "lane2": "0xA480F", - "lane3": "0xA480F" + "lane0": "0xA4B0F", + "lane1": "0xA4B0F", + "lane2": "0xA4B0F", + "lane3": "0xA4B0F" } }, "QSFP+-40GBASE-SR4": { @@ -5515,17 +5515,17 @@ }, "QSFP28-40GBASE-CR4-3M": { "preemphasis": { - "lane0": "0xA480F", + "lane0": "0xA4B0F", "lane1": "0xE4610", - "lane2": "0xA480F", + "lane2": "0xA4B0F", "lane3": "0xC490F" } }, "QSFP28-40GBASE-CR4-5M": { "preemphasis": { - "lane0": "0xA480F", + "lane0": "0xA4B0F", "lane1": "0xE4610", - "lane2": "0xA480F", + "lane2": "0xA4B0F", "lane3": "0xC490F" } }, diff --git a/device/delta/x86_64-delta_ag9064-r0/plugins/psuutil.py b/device/delta/x86_64-delta_ag9064-r0/plugins/psuutil.py new file mode 100644 index 000000000000..2a2bd1eea6a2 --- /dev/null +++ b/device/delta/x86_64-delta_ag9064-r0/plugins/psuutil.py @@ -0,0 +1,78 @@ +# +# Module contains an implementation of SONiC PSU Base API and +# provides the PSUs status which are available in the platform +# + +import os.path +import subprocess + +try: + from sonic_psu.psu_base import PsuBase +except ImportError as e: + raise ImportError (str(e) + "- required module not found") + +class PsuUtil(PsuBase): + """Platform-specific PSUutil class""" + + def __init__(self): + PsuBase.__init__(self) + self.psu_presence = "cat /sys/devices/platform/delta-ag9064-cpld.0/psu{}_scan" + self.psu_status = "cat /sys/devices/platform/delta-ag9064-swpld1.0/psu{}_pwr_ok" + + 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 + """ + return 2 + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is faulty + """ + if index is None: + return False + + status = 0 + try: + p = os.popen(self.psu_status.format(index)) + content = p.readline().rstrip() + reg_value = int(content) + if reg_value != 0: + return False + status = 1 + p.close() + except IOError: + return False + return status == 1 + + + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by 1-based index + + :param index: An integer, 1-based index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + if index is None: + return False + status = 0 + try: + p = os.popen(self.psu_presence.format(index)) + content = p.readline().rstrip() + reg_value = int(content, 16) + if reg_value != 0: + return False + status = 1 + p.close() + except IOError: + return False + return status == 1 + diff --git a/device/delta/x86_64-delta_ag9064-r0/plugins/sfputil.py b/device/delta/x86_64-delta_ag9064-r0/plugins/sfputil.py index 4b33dd8b090f..8b1b1aea1d82 100644 --- a/device/delta/x86_64-delta_ag9064-r0/plugins/sfputil.py +++ b/device/delta/x86_64-delta_ag9064-r0/plugins/sfputil.py @@ -17,7 +17,7 @@ class SfpUtil(SfpUtilBase): PORT_END = 63 PORTS_IN_BLOCK = 64 - EEPROM_OFFSET = 20 + EEPROM_OFFSET = 1 _port_to_eeprom_mapping = {} @@ -38,7 +38,7 @@ def port_to_eeprom_mapping(self): return self._port_to_eeprom_mapping def __init__(self): - eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + eeprom_path = "/sys/kernel/sfp/eeprom_sfp_{0}" for x in range(0, self.port_end + 1): self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET) diff --git a/device/marvell/armhf-marvell_et6448m_52x-r0/default_sku b/device/marvell/armhf-marvell_et6448m_52x-r0/default_sku new file mode 100644 index 000000000000..4f0da7a26939 --- /dev/null +++ b/device/marvell/armhf-marvell_et6448m_52x-r0/default_sku @@ -0,0 +1 @@ +et6448m t1 diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py index 4b065f77cdb1..e41ac2924da2 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py @@ -7,6 +7,7 @@ import time import subprocess from sonic_sfp.sfputilbase import * + import syslog except ImportError as e: raise ImportError("%s - required module not found" % str(e)) @@ -28,6 +29,12 @@ # parameters for SFP presence SFP_STATUS_INSERTED = '1' +# system level event/error +EVENT_ON_ALL_SFP = '-1' +SYSTEM_NOT_READY = 'system_not_ready' +SYSTEM_READY = 'system_become_ready' +SYSTEM_FAIL = 'system_fail' + GET_HWSKU_CMD = "sonic-cfggen -d -v DEVICE_METADATA.localhost.hwsku" # Ethernet <=> sfp @@ -39,6 +46,16 @@ hwsku_dict = {'ACS-MSN2700': 0, 'Mellanox-SN2700': 0, 'Mellanox-SN2700-D48C8': 0, "LS-SN2700":0, 'ACS-MSN2740': 0, 'ACS-MSN2100': 1, 'ACS-MSN2410': 2, 'ACS-MSN2010': 3, 'ACS-MSN3700': 0, 'ACS-MSN3700C': 0, 'ACS-MSN3800': 4} port_position_tuple_list = [(0, 0, 31, 32, 1), (0, 0, 15, 16, 1), (0, 48, 55, 56, 1), (0, 18, 21, 22, 1), (0, 0, 63, 64, 1)] +def log_info(msg, also_print_to_console=False): + syslog.openlog("sfputil") + syslog.syslog(syslog.LOG_INFO, msg) + syslog.closelog() + +def log_err(msg, also_print_to_console=False): + syslog.openlog("sfputil") + syslog.syslog(syslog.LOG_ERR, msg) + syslog.closelog() + class SfpUtil(SfpUtilBase): """Platform-specific SfpUtil class""" PORT_START = 0 @@ -84,6 +101,7 @@ def __init__(self): self.PORT_END = port_position_tuple[2] self.PORTS_IN_BLOCK = port_position_tuple[3] self.EEPROM_OFFSET = port_position_tuple[4] + self.mlnx_sfpd_started = False SfpUtilBase.__init__(self) @@ -185,10 +203,24 @@ def get_transceiver_change_event(self, timeout=0): self.db_sel_object = swsscommon.Select.OBJECT self.sfpd_status_tbl = swsscommon.Table(self.state_db, 'MLNX_SFPD_TASK') - # Check the liveness of mlnx-sfpd, if it failed, return false + # Check the liveness of mlnx-sfpd, if it failed, return system_fail event + # If mlnx-sfpd not started, return system_not_ready event keys = self.sfpd_status_tbl.getKeys() if 'LIVENESS' not in keys: - return False, phy_port_dict + if self.mlnx_sfpd_started: + log_err("mlnx-sfpd exited, return false to notify xcvrd.") + phy_port_dict[EVENT_ON_ALL_SFP] = SYSTEM_FAIL + return False, phy_port_dict + else: + log_info("mlnx-sfpd not ready, return false to notify xcvrd.") + phy_port_dict[EVENT_ON_ALL_SFP] = SYSTEM_NOT_READY + return False, phy_port_dict + else: + if not self.mlnx_sfpd_started: + self.mlnx_sfpd_started = True + log_info("mlnx-sfpd is running") + phy_port_dict[EVENT_ON_ALL_SFP] = SYSTEM_READY + return False, phy_port_dict if timeout: (state, c) = self.db_sel.select(timeout) diff --git a/device/quanta/x86_64-quanta_ix7_rglbmc-r0/Quanta-IX7-32X/port_config.ini b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/Quanta-IX7-32X/port_config.ini new file mode 100644 index 000000000000..42b75f2175b3 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/Quanta-IX7-32X/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias index speed +Ethernet0 29,30,31,32 hundredGigE1 0 100000 +Ethernet4 33,34,35,36 hundredGigE2 1 100000 +Ethernet8 41,42,43,44 hundredGigE3 2 100000 +Ethernet12 45,46,47,48 hundredGigE4 3 100000 +Ethernet16 1,2,3,4 hundredGigE5 4 100000 +Ethernet20 5,6,7,8 hundredGigE6 5 100000 +Ethernet24 9,10,11,12 hundredGigE7 6 100000 +Ethernet28 13,14,15,16 hundredGigE8 7 100000 +Ethernet32 17,18,19,20 hundredGigE9 8 100000 +Ethernet36 21,22,23,24 hundredGigE10 9 100000 +Ethernet40 25,26,27,28 hundredGigE11 10 100000 +Ethernet44 37,38,39,40 hundredGigE12 11 100000 +Ethernet48 49,50,51,52 hundredGigE13 12 100000 +Ethernet52 53,54,55,56 hundredGigE14 13 100000 +Ethernet56 57,58,59,60 hundredGigE15 14 100000 +Ethernet60 61,62,63,64 hundredGigE16 15 100000 +Ethernet64 65,66,67,68 hundredGigE17 16 100000 +Ethernet68 69,70,71,72 hundredGigE18 17 100000 +Ethernet72 73,74,75,76 hundredGigE19 18 100000 +Ethernet76 77,78,79,80 hundredGigE20 19 100000 +Ethernet80 93,94,95,96 hundredGigE21 20 100000 +Ethernet84 101,102,103,104 hundredGigE22 21 100000 +Ethernet88 105,106,107,108 hundredGigE23 22 100000 +Ethernet92 109,110,111,112 hundredGigE24 23 100000 +Ethernet96 113,114,115,116 hundredGigE25 24 100000 +Ethernet100 117,118,119,120 hundredGigE26 25 100000 +Ethernet104 121,122,123,124 hundredGigE27 26 100000 +Ethernet108 125,126,127,128 hundredGigE28 27 100000 +Ethernet112 81,82,83,84 hundredGigE29 28 100000 +Ethernet116 85,86,87,88 hundredGigE30 29 100000 +Ethernet120 89,90,91,92 hundredGigE31 30 100000 +Ethernet124 97,98,99,100 hundredGigE32 31 100000 diff --git a/device/quanta/x86_64-quanta_ix7_rglbmc-r0/Quanta-IX7-32X/sai.profile b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/Quanta-IX7-32X/sai.profile new file mode 100644 index 000000000000..8088d09edc12 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/Quanta-IX7-32X/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td3-ix7-32x100G.config.bcm diff --git a/device/quanta/x86_64-quanta_ix7_rglbmc-r0/Quanta-IX7-32X/td3-ix7-32x100G.config.bcm b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/Quanta-IX7-32X/td3-ix7-32x100G.config.bcm new file mode 100644 index 000000000000..54abc9ddae7b --- /dev/null +++ b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/Quanta-IX7-32X/td3-ix7-32x100G.config.bcm @@ -0,0 +1,534 @@ +bcm_tunnel_term_compatible_mode=1 +core_clock_frequency=1525 +dpp_clock_ratio=2:3 +parity_enable=0 +mem_cache_enable=0 +l2_mem_entries=40960 +l3_mem_entries=40960 +fpem_mem_entries=16384 +l2xmsg_mode=1 + +bcm_num_cos=8 +bcm_stat_interval=2000000 +cdma_timeout_usec=3000000 + +ifp_inports_support_enable=1 +ipv6_lpm_128b_enable=0x1 +l3_max_ecmp_mode=1 +l3_alpm_enable=2 +lpm_scaling_enable=0 + +miim_intr_enable=0 +module_64ports=1 + +schan_intr_enable=0 +skip_L2_USER_ENTRY=0 +stable_size=0x5500000 +tdma_timeout_usec=3000000 + +# portmap settings +oversubscribe_mode=1 +pbmp_xport_xe=0x4888888888888888c2222222222222222 + +port_flex_enable=1 + +portmap_1=1:100 +portmap_5=5:100 +portmap_9=9:100 +portmap_13=13:100 +portmap_17=17:100 +portmap_21=21:100 +portmap_25=25:100 +portmap_29=29:100 + +portmap_33=33:100 +portmap_37=37:100 +portmap_41=41:100 +portmap_45=45:100 +portmap_49=49:100 +portmap_53=53:100 +portmap_57=57:100 +portmap_61=61:100 + +portmap_67=65:100 +portmap_71=69:100 +portmap_75=73:100 +portmap_79=77:100 +portmap_83=81:100 +portmap_87=85:100 +portmap_91=89:100 +portmap_95=93:100 + +portmap_99=97:100 +portmap_103=101:100 +portmap_107=105:100 +portmap_111=109:100 +portmap_115=113:100 +portmap_119=117:100 +portmap_123=121:100 +portmap_127=125:100 + +# datapath port -- merlin core +portmap_66=129:10:m +portmap_130=128:10:m + +# loopback port +portmap_65=130:10 +portmap_131=131:10 + +# port order remap +dport_map_port_29=1 +dport_map_port_33=2 +dport_map_port_41=3 +dport_map_port_45=4 +dport_map_port_1=5 +dport_map_port_5=6 +dport_map_port_9=7 +dport_map_port_13=8 +dport_map_port_17=9 +dport_map_port_21=10 +dport_map_port_25=11 +dport_map_port_37=12 +dport_map_port_49=13 +dport_map_port_53=14 +dport_map_port_57=15 +dport_map_port_61=16 + +dport_map_port_67=17 +dport_map_port_71=18 +dport_map_port_75=19 +dport_map_port_79=20 +dport_map_port_95=21 +dport_map_port_103=22 +dport_map_port_107=23 +dport_map_port_111=24 +dport_map_port_115=25 +dport_map_port_119=26 +dport_map_port_123=27 +dport_map_port_127=28 +dport_map_port_83=29 +dport_map_port_87=30 +dport_map_port_91=31 +dport_map_port_99=32 + +dport_map_port_66=33 +dport_map_port_130=34 + +### interface setting +# TSCF / TSCE interface definition +# NULL 1 +# GMII 3 +# SGMII 4 +# XGMII 6 +# SFI 9 +# XFI 10 +# KR 11 +# KR4 12 +# CR 13 +# CR4 14 +# XLAUI 15 +# SR 16 +# ILKN 21 +# CAUI 25 +# LR 26 +# LR4 27 +# SR4 28 +# SR2 38 +# KR2 39 +# CR2 40 +# XLAUI2 42 +# LR2 55 +# CAUI4 62 +### + + +serdes_if_type_29=14 +serdes_if_type_33=14 +serdes_if_type_41=14 +serdes_if_type_45=14 +serdes_if_type_1=14 +serdes_if_type_5=14 +serdes_if_type_9=14 +serdes_if_type_13=14 +serdes_if_type_17=14 +serdes_if_type_21=14 +serdes_if_type_25=14 +serdes_if_type_37=14 +serdes_if_type_49=14 +serdes_if_type_53=14 +serdes_if_type_57=14 +serdes_if_type_61=14 + +serdes_if_type_67=14 +serdes_if_type_71=14 +serdes_if_type_75=14 +serdes_if_type_79=14 +serdes_if_type_95=14 +serdes_if_type_103=14 +serdes_if_type_107=14 +serdes_if_type_111=14 +serdes_if_type_115=14 +serdes_if_type_119=14 +serdes_if_type_123=14 +serdes_if_type_127=14 +serdes_if_type_83=14 +serdes_if_type_87=14 +serdes_if_type_91=14 +serdes_if_type_99=14 + +serdes_if_type_66=11 +serdes_if_type_130=11 + +### lane swap and polarity follow physical port +phy_chain_tx_lane_map_physical{29.0}=0x1230 +phy_chain_tx_polarity_flip_physical{29.0}=0x1 +phy_chain_tx_polarity_flip_physical{30.0}=0x0 +phy_chain_tx_polarity_flip_physical{31.0}=0x1 +phy_chain_tx_polarity_flip_physical{32.0}=0x1 +phy_chain_rx_lane_map_physical{29.0}=0x1302 +phy_chain_rx_polarity_flip_physical{29.0}=0x0 +phy_chain_rx_polarity_flip_physical{30.0}=0x0 +phy_chain_rx_polarity_flip_physical{31.0}=0x1 +phy_chain_rx_polarity_flip_physical{32.0}=0x1 + +phy_chain_tx_lane_map_physical{33.0}=0x3210 +phy_chain_tx_polarity_flip_physical{33.0}=0x1 +phy_chain_tx_polarity_flip_physical{34.0}=0x1 +phy_chain_tx_polarity_flip_physical{35.0}=0x1 +phy_chain_tx_polarity_flip_physical{36.0}=0x1 +phy_chain_rx_lane_map_physical{33.0}=0x0123 +phy_chain_rx_polarity_flip_physical{33.0}=0x0 +phy_chain_rx_polarity_flip_physical{34.0}=0x1 +phy_chain_rx_polarity_flip_physical{35.0}=0x0 +phy_chain_rx_polarity_flip_physical{36.0}=0x1 + +phy_chain_tx_lane_map_physical{41.0}=0x0213 +phy_chain_tx_polarity_flip_physical{41.0}=0x0 +phy_chain_tx_polarity_flip_physical{42.0}=0x1 +phy_chain_tx_polarity_flip_physical{43.0}=0x1 +phy_chain_tx_polarity_flip_physical{44.0}=0x0 +phy_chain_rx_lane_map_physical{41.0}=0x1302 +phy_chain_rx_polarity_flip_physical{41.0}=0x1 +phy_chain_rx_polarity_flip_physical{42.0}=0x1 +phy_chain_rx_polarity_flip_physical{43.0}=0x0 +phy_chain_rx_polarity_flip_physical{44.0}=0x0 + +phy_chain_tx_lane_map_physical{45.0}=0x3210 +phy_chain_tx_polarity_flip_physical{45.0}=0x1 +phy_chain_tx_polarity_flip_physical{46.0}=0x1 +phy_chain_tx_polarity_flip_physical{47.0}=0x1 +phy_chain_tx_polarity_flip_physical{48.0}=0x1 +phy_chain_rx_lane_map_physical{45.0}=0x2103 +phy_chain_rx_polarity_flip_physical{45.0}=0x0 +phy_chain_rx_polarity_flip_physical{46.0}=0x0 +phy_chain_rx_polarity_flip_physical{47.0}=0x1 +phy_chain_rx_polarity_flip_physical{48.0}=0x0 + +phy_chain_tx_lane_map_physical{1.0}=0x0213 +phy_chain_tx_polarity_flip_physical{1.0}=0x0 +phy_chain_tx_polarity_flip_physical{2.0}=0x1 +phy_chain_tx_polarity_flip_physical{3.0}=0x1 +phy_chain_tx_polarity_flip_physical{4.0}=0x0 +phy_chain_rx_lane_map_physical{1.0}=0x1302 +phy_chain_rx_polarity_flip_physical{1.0}=0x0 +phy_chain_rx_polarity_flip_physical{2.0}=0x0 +phy_chain_rx_polarity_flip_physical{3.0}=0x1 +phy_chain_rx_polarity_flip_physical{4.0}=0x1 + +phy_chain_tx_lane_map_physical{5.0}=0x3210 +phy_chain_tx_polarity_flip_physical{5.0}=0x1 +phy_chain_tx_polarity_flip_physical{6.0}=0x1 +phy_chain_tx_polarity_flip_physical{7.0}=0x1 +phy_chain_tx_polarity_flip_physical{8.0}=0x1 +phy_chain_rx_lane_map_physical{5.0}=0x2103 +phy_chain_rx_polarity_flip_physical{5.0}=0x1 +phy_chain_rx_polarity_flip_physical{6.0}=0x1 +phy_chain_rx_polarity_flip_physical{7.0}=0x0 +phy_chain_rx_polarity_flip_physical{8.0}=0x1 + +phy_chain_tx_lane_map_physical{9.0}=0x0213 +phy_chain_tx_polarity_flip_physical{9.0}=0x0 +phy_chain_tx_polarity_flip_physical{10.0}=0x1 +phy_chain_tx_polarity_flip_physical{11.0}=0x1 +phy_chain_tx_polarity_flip_physical{12.0}=0x0 +phy_chain_rx_lane_map_physical{9.0}=0x1302 +phy_chain_rx_polarity_flip_physical{9.0}=0x0 +phy_chain_rx_polarity_flip_physical{10.0}=0x1 +phy_chain_rx_polarity_flip_physical{11.0}=0x1 +phy_chain_rx_polarity_flip_physical{12.0}=0x1 + +phy_chain_tx_lane_map_physical{13.0}=0x3210 +phy_chain_tx_polarity_flip_physical{13.0}=0x1 +phy_chain_tx_polarity_flip_physical{14.0}=0x1 +phy_chain_tx_polarity_flip_physical{15.0}=0x1 +phy_chain_tx_polarity_flip_physical{16.0}=0x1 +phy_chain_rx_lane_map_physical{13.0}=0x2031 +phy_chain_rx_polarity_flip_physical{13.0}=0x1 +phy_chain_rx_polarity_flip_physical{14.0}=0x0 +phy_chain_rx_polarity_flip_physical{15.0}=0x1 +phy_chain_rx_polarity_flip_physical{16.0}=0x1 + +phy_chain_tx_lane_map_physical{17.0}=0x0123 +phy_chain_tx_polarity_flip_physical{17.0}=0x0 +phy_chain_tx_polarity_flip_physical{18.0}=0x0 +phy_chain_tx_polarity_flip_physical{19.0}=0x1 +phy_chain_tx_polarity_flip_physical{20.0}=0x1 +phy_chain_rx_lane_map_physical{17.0}=0x1302 +phy_chain_rx_polarity_flip_physical{17.0}=0x0 +phy_chain_rx_polarity_flip_physical{18.0}=0x0 +phy_chain_rx_polarity_flip_physical{19.0}=0x1 +phy_chain_rx_polarity_flip_physical{20.0}=0x1 + +phy_chain_tx_lane_map_physical{21.0}=0x3210 +phy_chain_tx_polarity_flip_physical{21.0}=0x1 +phy_chain_tx_polarity_flip_physical{22.0}=0x1 +phy_chain_tx_polarity_flip_physical{23.0}=0x1 +phy_chain_tx_polarity_flip_physical{24.0}=0x1 +phy_chain_rx_lane_map_physical{21.0}=0x1032 +phy_chain_rx_polarity_flip_physical{21.0}=0x0 +phy_chain_rx_polarity_flip_physical{22.0}=0x1 +phy_chain_rx_polarity_flip_physical{23.0}=0x1 +phy_chain_rx_polarity_flip_physical{24.0}=0x0 + +phy_chain_tx_lane_map_physical{25.0}=0x0213 +phy_chain_tx_polarity_flip_physical{25.0}=0x1 +phy_chain_tx_polarity_flip_physical{26.0}=0x0 +phy_chain_tx_polarity_flip_physical{27.0}=0x0 +phy_chain_tx_polarity_flip_physical{28.0}=0x1 +phy_chain_rx_lane_map_physical{25.0}=0x1302 +phy_chain_rx_polarity_flip_physical{25.0}=0x1 +phy_chain_rx_polarity_flip_physical{26.0}=0x1 +phy_chain_rx_polarity_flip_physical{27.0}=0x0 +phy_chain_rx_polarity_flip_physical{28.0}=0x0 + +phy_chain_tx_lane_map_physical{37.0}=0x3210 +phy_chain_tx_polarity_flip_physical{37.0}=0x1 +phy_chain_tx_polarity_flip_physical{38.0}=0x1 +phy_chain_tx_polarity_flip_physical{39.0}=0x1 +phy_chain_tx_polarity_flip_physical{40.0}=0x1 +phy_chain_rx_lane_map_physical{37.0}=0x2103 +phy_chain_rx_polarity_flip_physical{37.0}=0x0 +phy_chain_rx_polarity_flip_physical{38.0}=0x0 +phy_chain_rx_polarity_flip_physical{39.0}=0x1 +phy_chain_rx_polarity_flip_physical{40.0}=0x0 + +phy_chain_tx_lane_map_physical{49.0}=0x0213 +phy_chain_tx_polarity_flip_physical{49.0}=0x1 +phy_chain_tx_polarity_flip_physical{50.0}=0x0 +phy_chain_tx_polarity_flip_physical{51.0}=0x0 +phy_chain_tx_polarity_flip_physical{52.0}=0x1 +phy_chain_rx_lane_map_physical{49.0}=0x1302 +phy_chain_rx_polarity_flip_physical{49.0}=0x1 +phy_chain_rx_polarity_flip_physical{50.0}=0x1 +phy_chain_rx_polarity_flip_physical{51.0}=0x0 +phy_chain_rx_polarity_flip_physical{52.0}=0x0 + +phy_chain_tx_lane_map_physical{53.0}=0x3210 +phy_chain_tx_polarity_flip_physical{53.0}=0x0 +phy_chain_tx_polarity_flip_physical{54.0}=0x0 +phy_chain_tx_polarity_flip_physical{55.0}=0x0 +phy_chain_tx_polarity_flip_physical{56.0}=0x0 +phy_chain_rx_lane_map_physical{53.0}=0x2103 +phy_chain_rx_polarity_flip_physical{53.0}=0x0 +phy_chain_rx_polarity_flip_physical{54.0}=0x0 +phy_chain_rx_polarity_flip_physical{55.0}=0x1 +phy_chain_rx_polarity_flip_physical{56.0}=0x0 + +phy_chain_tx_lane_map_physical{57.0}=0x0213 +phy_chain_tx_polarity_flip_physical{57.0}=0x0 +phy_chain_tx_polarity_flip_physical{58.0}=0x1 +phy_chain_tx_polarity_flip_physical{59.0}=0x1 +phy_chain_tx_polarity_flip_physical{60.0}=0x0 +phy_chain_rx_lane_map_physical{57.0}=0x1302 +phy_chain_rx_polarity_flip_physical{57.0}=0x1 +phy_chain_rx_polarity_flip_physical{58.0}=0x1 +phy_chain_rx_polarity_flip_physical{59.0}=0x0 +phy_chain_rx_polarity_flip_physical{60.0}=0x0 + +phy_chain_tx_lane_map_physical{61.0}=0x3210 +phy_chain_tx_polarity_flip_physical{61.0}=0x1 +phy_chain_tx_polarity_flip_physical{62.0}=0x1 +phy_chain_tx_polarity_flip_physical{63.0}=0x1 +phy_chain_tx_polarity_flip_physical{64.0}=0x1 +phy_chain_rx_lane_map_physical{61.0}=0x2103 +phy_chain_rx_polarity_flip_physical{61.0}=0x0 +phy_chain_rx_polarity_flip_physical{62.0}=0x0 +phy_chain_rx_polarity_flip_physical{63.0}=0x1 +phy_chain_rx_polarity_flip_physical{64.0}=0x0 + +phy_chain_tx_lane_map_physical{65.0}=0x3210 +phy_chain_tx_polarity_flip_physical{65.0}=0x0 +phy_chain_tx_polarity_flip_physical{66.0}=0x0 +phy_chain_tx_polarity_flip_physical{67.0}=0x1 +phy_chain_tx_polarity_flip_physical{68.0}=0x1 +phy_chain_rx_lane_map_physical{65.0}=0x3120 +phy_chain_rx_polarity_flip_physical{65.0}=0x0 +phy_chain_rx_polarity_flip_physical{66.0}=0x0 +phy_chain_rx_polarity_flip_physical{67.0}=0x1 +phy_chain_rx_polarity_flip_physical{68.0}=0x1 + +phy_chain_tx_lane_map_physical{69.0}=0x0123 +phy_chain_tx_polarity_flip_physical{69.0}=0x0 +phy_chain_tx_polarity_flip_physical{70.0}=0x0 +phy_chain_tx_polarity_flip_physical{71.0}=0x0 +phy_chain_tx_polarity_flip_physical{72.0}=0x0 +phy_chain_rx_lane_map_physical{69.0}=0x2301 +phy_chain_rx_polarity_flip_physical{69.0}=0x1 +phy_chain_rx_polarity_flip_physical{70.0}=0x0 +phy_chain_rx_polarity_flip_physical{71.0}=0x0 +phy_chain_rx_polarity_flip_physical{72.0}=0x0 + +phy_chain_tx_lane_map_physical{73.0}=0x3120 +phy_chain_tx_polarity_flip_physical{73.0}=0x1 +phy_chain_tx_polarity_flip_physical{74.0}=0x0 +phy_chain_tx_polarity_flip_physical{75.0}=0x0 +phy_chain_tx_polarity_flip_physical{76.0}=0x1 +phy_chain_rx_lane_map_physical{73.0}=0x3120 +phy_chain_rx_polarity_flip_physical{73.0}=0x0 +phy_chain_rx_polarity_flip_physical{74.0}=0x0 +phy_chain_rx_polarity_flip_physical{75.0}=0x1 +phy_chain_rx_polarity_flip_physical{76.0}=0x1 + +phy_chain_tx_lane_map_physical{77.0}=0x0213 +phy_chain_tx_polarity_flip_physical{77.0}=0x1 +phy_chain_tx_polarity_flip_physical{78.0}=0x0 +phy_chain_tx_polarity_flip_physical{79.0}=0x0 +phy_chain_tx_polarity_flip_physical{80.0}=0x1 +phy_chain_rx_lane_map_physical{77.0}=0x0321 +phy_chain_rx_polarity_flip_physical{77.0}=0x1 +phy_chain_rx_polarity_flip_physical{78.0}=0x1 +phy_chain_rx_polarity_flip_physical{79.0}=0x0 +phy_chain_rx_polarity_flip_physical{80.0}=0x1 + +phy_chain_tx_lane_map_physical{93.0}=0x3120 +phy_chain_tx_polarity_flip_physical{93.0}=0x1 +phy_chain_tx_polarity_flip_physical{94.0}=0x0 +phy_chain_tx_polarity_flip_physical{95.0}=0x0 +phy_chain_tx_polarity_flip_physical{96.0}=0x1 +phy_chain_rx_lane_map_physical{93.0}=0x3120 +phy_chain_rx_polarity_flip_physical{93.0}=0x1 +phy_chain_rx_polarity_flip_physical{94.0}=0x1 +phy_chain_rx_polarity_flip_physical{95.0}=0x0 +phy_chain_rx_polarity_flip_physical{96.0}=0x0 + +phy_chain_tx_lane_map_physical{101.0}=0x0321 +phy_chain_tx_polarity_flip_physical{101.0}=0x0 +phy_chain_tx_polarity_flip_physical{102.0}=0x1 +phy_chain_tx_polarity_flip_physical{103.0}=0x1 +phy_chain_tx_polarity_flip_physical{104.0}=0x1 +phy_chain_rx_lane_map_physical{101.0}=0x0321 +phy_chain_rx_polarity_flip_physical{101.0}=0x1 +phy_chain_rx_polarity_flip_physical{102.0}=0x1 +phy_chain_rx_polarity_flip_physical{103.0}=0x0 +phy_chain_rx_polarity_flip_physical{104.0}=0x1 + +phy_chain_tx_lane_map_physical{105.0}=0x3120 +phy_chain_tx_polarity_flip_physical{105.0}=0x1 +phy_chain_tx_polarity_flip_physical{106.0}=0x0 +phy_chain_tx_polarity_flip_physical{107.0}=0x0 +phy_chain_tx_polarity_flip_physical{108.0}=0x1 +phy_chain_rx_lane_map_physical{105.0}=0x3120 +phy_chain_rx_polarity_flip_physical{105.0}=0x1 +phy_chain_rx_polarity_flip_physical{106.0}=0x1 +phy_chain_rx_polarity_flip_physical{107.0}=0x0 +phy_chain_rx_polarity_flip_physical{108.0}=0x0 + +phy_chain_tx_lane_map_physical{109.0}=0x0123 +phy_chain_tx_polarity_flip_physical{109.0}=0x1 +phy_chain_tx_polarity_flip_physical{110.0}=0x1 +phy_chain_tx_polarity_flip_physical{111.0}=0x1 +phy_chain_tx_polarity_flip_physical{112.0}=0x1 +phy_chain_rx_lane_map_physical{109.0}=0x0321 +phy_chain_rx_polarity_flip_physical{109.0}=0x0 +phy_chain_rx_polarity_flip_physical{110.0}=0x0 +phy_chain_rx_polarity_flip_physical{111.0}=0x1 +phy_chain_rx_polarity_flip_physical{112.0}=0x0 + +phy_chain_tx_lane_map_physical{113.0}=0x0312 +phy_chain_tx_polarity_flip_physical{113.0}=0x0 +phy_chain_tx_polarity_flip_physical{114.0}=0x0 +phy_chain_tx_polarity_flip_physical{115.0}=0x1 +phy_chain_tx_polarity_flip_physical{116.0}=0x0 +phy_chain_rx_lane_map_physical{113.0}=0x3120 +phy_chain_rx_polarity_flip_physical{113.0}=0x1 +phy_chain_rx_polarity_flip_physical{114.0}=0x1 +phy_chain_rx_polarity_flip_physical{115.0}=0x0 +phy_chain_rx_polarity_flip_physical{116.0}=0x1 + +phy_chain_tx_lane_map_physical{117.0}=0x0123 +phy_chain_tx_polarity_flip_physical{117.0}=0x1 +phy_chain_tx_polarity_flip_physical{118.0}=0x1 +phy_chain_tx_polarity_flip_physical{119.0}=0x1 +phy_chain_tx_polarity_flip_physical{120.0}=0x1 +phy_chain_rx_lane_map_physical{117.0}=0x1320 +phy_chain_rx_polarity_flip_physical{117.0}=0x1 +phy_chain_rx_polarity_flip_physical{118.0}=0x1 +phy_chain_rx_polarity_flip_physical{119.0}=0x1 +phy_chain_rx_polarity_flip_physical{120.0}=0x0 + +phy_chain_tx_lane_map_physical{121.0}=0x3120 +phy_chain_tx_polarity_flip_physical{121.0}=0x1 +phy_chain_tx_polarity_flip_physical{122.0}=0x0 +phy_chain_tx_polarity_flip_physical{123.0}=0x0 +phy_chain_tx_polarity_flip_physical{124.0}=0x1 +phy_chain_rx_lane_map_physical{121.0}=0x0123 +phy_chain_rx_polarity_flip_physical{121.0}=0x0 +phy_chain_rx_polarity_flip_physical{122.0}=0x1 +phy_chain_rx_polarity_flip_physical{123.0}=0x0 +phy_chain_rx_polarity_flip_physical{124.0}=0x1 + +phy_chain_tx_lane_map_physical{125.0}=0x0123 +phy_chain_tx_polarity_flip_physical{125.0}=0x0 +phy_chain_tx_polarity_flip_physical{126.0}=0x0 +phy_chain_tx_polarity_flip_physical{127.0}=0x0 +phy_chain_tx_polarity_flip_physical{128.0}=0x0 +phy_chain_rx_lane_map_physical{125.0}=0x0321 +phy_chain_rx_polarity_flip_physical{125.0}=0x0 +phy_chain_rx_polarity_flip_physical{126.0}=0x0 +phy_chain_rx_polarity_flip_physical{127.0}=0x1 +phy_chain_rx_polarity_flip_physical{128.0}=0x0 + +phy_chain_tx_lane_map_physical{81.0}=0x3201 +phy_chain_tx_polarity_flip_physical{81.0}=0x0 +phy_chain_tx_polarity_flip_physical{82.0}=0x1 +phy_chain_tx_polarity_flip_physical{83.0}=0x1 +phy_chain_tx_polarity_flip_physical{84.0}=0x1 +phy_chain_rx_lane_map_physical{81.0}=0x3120 +phy_chain_rx_polarity_flip_physical{81.0}=0x0 +phy_chain_rx_polarity_flip_physical{82.0}=0x0 +phy_chain_rx_polarity_flip_physical{83.0}=0x1 +phy_chain_rx_polarity_flip_physical{84.0}=0x0 + +phy_chain_tx_lane_map_physical{85.0}=0x0123 +phy_chain_tx_polarity_flip_physical{85.0}=0x1 +phy_chain_tx_polarity_flip_physical{86.0}=0x1 +phy_chain_tx_polarity_flip_physical{87.0}=0x1 +phy_chain_tx_polarity_flip_physical{88.0}=0x1 +phy_chain_rx_lane_map_physical{85.0}=0x0321 +phy_chain_rx_polarity_flip_physical{85.0}=0x1 +phy_chain_rx_polarity_flip_physical{86.0}=0x1 +phy_chain_rx_polarity_flip_physical{87.0}=0x0 +phy_chain_rx_polarity_flip_physical{88.0}=0x1 + +phy_chain_tx_lane_map_physical{89.0}=0x3210 +phy_chain_tx_polarity_flip_physical{89.0}=0x1 +phy_chain_tx_polarity_flip_physical{90.0}=0x1 +phy_chain_tx_polarity_flip_physical{91.0}=0x1 +phy_chain_tx_polarity_flip_physical{92.0}=0x1 +phy_chain_rx_lane_map_physical{89.0}=0x0123 +phy_chain_rx_polarity_flip_physical{89.0}=0x1 +phy_chain_rx_polarity_flip_physical{90.0}=0x0 +phy_chain_rx_polarity_flip_physical{91.0}=0x1 +phy_chain_rx_polarity_flip_physical{92.0}=0x0 + +phy_chain_tx_lane_map_physical{97.0}=0x0312 +phy_chain_tx_polarity_flip_physical{97.0}=0x0 +phy_chain_tx_polarity_flip_physical{98.0}=0x0 +phy_chain_tx_polarity_flip_physical{99.0}=0x1 +phy_chain_tx_polarity_flip_physical{100.0}=0x1 +phy_chain_rx_lane_map_physical{97.0}=0x0321 +phy_chain_rx_polarity_flip_physical{97.0}=0x1 +phy_chain_rx_polarity_flip_physical{98.0}=0x0 +phy_chain_rx_polarity_flip_physical{99.0}=0x1 +phy_chain_rx_polarity_flip_physical{100.0}=0x0 + diff --git a/device/quanta/x86_64-quanta_ix7_rglbmc-r0/default_sku b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/default_sku new file mode 100644 index 000000000000..e9066fe7299b --- /dev/null +++ b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/default_sku @@ -0,0 +1 @@ +Quanta-IX7-32X t1 diff --git a/device/quanta/x86_64-quanta_ix7_rglbmc-r0/installer.conf b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/installer.conf new file mode 100644 index 000000000000..14404194ef53 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x2f8 +CONSOLE_DEV=1 +CONSOLE_SPEED=115200 diff --git a/device/quanta/x86_64-quanta_ix7_rglbmc-r0/led_proc_init.soc b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/led_proc_init.soc new file mode 100755 index 000000000000..0861486660c3 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/led_proc_init.soc @@ -0,0 +1,6 @@ +sleep 10 +led stop +sleep 3 +led start +sleep 3 +led auto on \ No newline at end of file diff --git a/device/quanta/x86_64-quanta_ix7_rglbmc-r0/plugins/eeprom.py b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/plugins/eeprom.py new file mode 100644 index 000000000000..2a35f3a22a17 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/plugins/eeprom.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/18-0054/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/quanta/x86_64-quanta_ix7_rglbmc-r0/plugins/psuutil.py b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/plugins/psuutil.py new file mode 100644 index 000000000000..885842bbda5a --- /dev/null +++ b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/plugins/psuutil.py @@ -0,0 +1,49 @@ +# +# 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""" + + def __init__(self): + PsuBase.__init__(self) + + 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 + :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 = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by 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 = 1 + + return status diff --git a/device/quanta/x86_64-quanta_ix7_rglbmc-r0/plugins/sfputil.py b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/plugins/sfputil.py new file mode 100644 index 000000000000..09ce8928b8e9 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix7_rglbmc-r0/plugins/sfputil.py @@ -0,0 +1,171 @@ +#!/usr/bin/env python + +try: + import time + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class SfpUtil(SfpUtilBase): + """Platform specific SfpUtill class""" + + PORT_START = 0 + PORT_END = 31 + PORTS_IN_BLOCK = 32 + + _port_to_eeprom_mapping = {} + _port_to_i2c_mapping = { + 0 : 32, + 1 : 33, + 2 : 34, + 3 : 35, + 4 : 36, + 5 : 37, + 6 : 38, + 7 : 39, + 8 : 40, + 9 : 41, + 10 : 42, + 11 : 43, + 12 : 44, + 13 : 45, + 14 : 46, + 15 : 47, + 16 : 48, + 17 : 49, + 18 : 50, + 19 : 51, + 20 : 52, + 21 : 53, + 22 : 54, + 23 : 55, + 24 : 56, + 25 : 57, + 26 : 58, + 27 : 59, + 28 : 60, + 29 : 61, + 30 : 62, + 31 : 63, + } + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(self.PORT_START, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom' + for x in range(0, self.port_end+1): + self.port_to_eeprom_mapping[x] = eeprom_path.format(self._port_to_i2c_mapping[x]) + 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: + reg_file = open("/sys/class/cpld-qsfp28/port-"+str(port_num+1)+"/module_present") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_file.readline().rstrip() + if reg_value == '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.port_end: + return False + + try: + reg_file = open("/sys/class/cpld-qsfp28/port-"+str(port_num+1)+"/lpmode") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = int(reg_file.readline().rstrip()) + + if reg_value == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/class/cpld-qsfp28/port-"+str(port_num+1)+"/lpmode", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = int(reg_file.readline().rstrip()) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = 1 + else: + reg_value = 0 + + reg_file.write(hex(reg_value)) + reg_file.close() + + return True + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/class/cpld-qsfp28/port-"+str(port_num+1)+"/reset", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = 0 + reg_file.write(hex(reg_value)) + reg_file.close() + + # Sleep 2 second to allow it to settle + time.sleep(2) + + # Flip the value back write back to the register to take port out of reset + try: + reg_file = open("/sys/class/cpld-qsfp28/port-"+str(port_num+1)+"/reset", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = 1 + reg_file.write(hex(reg_value)) + reg_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 diff --git a/device/quanta/x86_64-quanta_ix8_rglbmc-r0/Quanta-IX8-56X/port_config.ini b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/Quanta-IX8-56X/port_config.ini new file mode 100644 index 000000000000..1b33f50c92dd --- /dev/null +++ b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/Quanta-IX8-56X/port_config.ini @@ -0,0 +1,57 @@ +# name lanes alias index speed +Ethernet0 60 twentyfiveGigE1 0 25000 +Ethernet1 59 twentyfiveGigE2 1 25000 +Ethernet2 58 twentyfiveGigE3 2 25000 +Ethernet3 57 twentyfiveGigE4 3 25000 +Ethernet4 64 twentyfiveGigE5 4 25000 +Ethernet5 63 twentyfiveGigE6 5 25000 +Ethernet6 62 twentyfiveGigE7 6 25000 +Ethernet7 61 twentyfiveGigE8 7 25000 +Ethernet8 49 twentyfiveGigE9 8 25000 +Ethernet9 50 twentyfiveGigE10 9 25000 +Ethernet10 51 twentyfiveGigE11 10 25000 +Ethernet11 52 twentyfiveGigE12 11 25000 +Ethernet12 4 twentyfiveGigE13 12 25000 +Ethernet13 3 twentyfiveGigE14 13 25000 +Ethernet14 2 twentyfiveGigE15 14 25000 +Ethernet15 1 twentyfiveGigE16 15 25000 +Ethernet16 8 twentyfiveGigE17 16 25000 +Ethernet17 7 twentyfiveGigE18 17 25000 +Ethernet18 6 twentyfiveGigE19 18 25000 +Ethernet19 5 twentyfiveGigE20 19 25000 +Ethernet20 16 twentyfiveGigE21 20 25000 +Ethernet21 15 twentyfiveGigE22 21 25000 +Ethernet22 14 twentyfiveGigE23 22 25000 +Ethernet23 13 twentyfiveGigE24 23 25000 +Ethernet24 24 twentyfiveGigE25 24 25000 +Ethernet25 23 twentyfiveGigE26 25 25000 +Ethernet26 22 twentyfiveGigE27 26 25000 +Ethernet27 21 twentyfiveGigE28 27 25000 +Ethernet28 32 twentyfiveGigE29 28 25000 +Ethernet29 31 twentyfiveGigE30 29 25000 +Ethernet30 30 twentyfiveGigE31 30 25000 +Ethernet31 29 twentyfiveGigE32 31 25000 +Ethernet32 36 twentyfiveGigE33 32 25000 +Ethernet33 35 twentyfiveGigE34 33 25000 +Ethernet34 34 twentyfiveGigE35 34 25000 +Ethernet35 33 twentyfiveGigE36 35 25000 +Ethernet36 44 twentyfiveGigE37 36 25000 +Ethernet37 43 twentyfiveGigE38 37 25000 +Ethernet38 42 twentyfiveGigE39 38 25000 +Ethernet39 41 twentyfiveGigE40 39 25000 +Ethernet40 86 twentyfiveGigE41 40 25000 +Ethernet41 85 twentyfiveGigE42 41 25000 +Ethernet42 88 twentyfiveGigE43 42 25000 +Ethernet43 87 twentyfiveGigE44 43 25000 +Ethernet44 94 twentyfiveGigE45 44 25000 +Ethernet45 93 twentyfiveGigE46 45 25000 +Ethernet46 96 twentyfiveGigE47 46 25000 +Ethernet47 95 twentyfiveGigE48 47 25000 +Ethernet48 97,98,99,100 hundredGigE49 48 100000 +Ethernet52 105,106,107,108 hundredGigE50 49 100000 +Ethernet56 113,114,115,116 hundredGigE51 50 100000 +Ethernet60 121,122,123,124 hundredGigE52 51 100000 +Ethernet64 77,78,79,80 hundredGigE53 52 100000 +Ethernet68 65,66,67,68 hundredGigE54 53 100000 +Ethernet72 69,70,71,72 hundredGigE55 54 100000 +Ethernet76 125,126,127,128 hundredGigE56 55 100000 diff --git a/device/quanta/x86_64-quanta_ix8_rglbmc-r0/Quanta-IX8-56X/sai.profile b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/Quanta-IX8-56X/sai.profile new file mode 100644 index 000000000000..faf28ace4c10 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/Quanta-IX8-56X/sai.profile @@ -0,0 +1 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td3-ix8-48x25G+8x100G.config.bcm diff --git a/device/quanta/x86_64-quanta_ix8_rglbmc-r0/Quanta-IX8-56X/td3-ix8-48x25G+8x100G.config.bcm b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/Quanta-IX8-56X/td3-ix8-48x25G+8x100G.config.bcm new file mode 100644 index 000000000000..e4c8f8b656e1 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/Quanta-IX8-56X/td3-ix8-48x25G+8x100G.config.bcm @@ -0,0 +1,480 @@ +bcm_tunnel_term_compatible_mode=1 +core_clock_frequency=1525 +dpp_clock_ratio=2:3 +parity_enable=0 +mem_cache_enable=0 +l2_mem_entries=40960 +l3_mem_entries=40960 +fpem_mem_entries=16384 +l2xmsg_mode=1 + +bcm_num_cos=8 +bcm_stat_interval=2000000 +cdma_timeout_usec=3000000 + +ifp_inports_support_enable=1 +ipv6_lpm_128b_enable=0x1 +l3_max_ecmp_mode=1 +l3_alpm_enable=2 +lpm_scaling_enable=0 + +miim_intr_enable=0 +module_64ports=1 + +schan_intr_enable=0 +skip_L2_USER_ENTRY=0 +stable_size=0x5500000 +tdma_timeout_usec=3000000 + +# portmap settings +oversubscribe_mode=1 +pbmp_xport_xe=0x48808080f8780808dfe1e1e1fe1e1e1fe + +port_flex_enable=1 + +portmap_1=1:25 +portmap_2=2:25 +portmap_3=3:25 +portmap_4=4:25 +portmap_5=5:25 +portmap_6=6:25 +portmap_7=7:25 +portmap_8=8:25 +portmap_13=13:25 +portmap_14=14:25 +portmap_15=15:25 +portmap_16=16:25 +portmap_21=21:25 +portmap_22=22:25 +portmap_23=23:25 +portmap_24=24:25 +portmap_29=29:25 +portmap_30=30:25 +portmap_31=31:25 +portmap_32=32:25 +portmap_33=33:25 +portmap_34=34:25 +portmap_35=35:25 +portmap_36=36:25 +portmap_41=41:25 +portmap_42=42:25 +portmap_43=43:25 +portmap_44=44:25 +portmap_49=49:25 +portmap_50=50:25 +portmap_51=51:25 +portmap_52=52:25 +portmap_57=57:25 +portmap_58=58:25 +portmap_59=59:25 +portmap_60=60:25 +portmap_61=61:25 +portmap_62=62:25 +portmap_63=63:25 +portmap_64=64:25 +portmap_67=65:100 +portmap_71=69:100 +portmap_79=77:100 +portmap_87=85:25 +portmap_88=86:25 +portmap_89=87:25 +portmap_90=88:25 +portmap_95=93:25 +portmap_96=94:25 +portmap_97=95:25 +portmap_98=96:25 +portmap_99=97:100 +portmap_107=105:100 +portmap_115=113:100 +portmap_123=121:100 +portmap_127=125:100 + +# datapath port -- MerlinCore +portmap_66=129:10:m +portmap_130=128:10:m + +# loopback port +portmap_65=130:10 +portmap_131=131:10 + + +### interface setting +# TSCF / TSCE interface definition +# NULL 1 +# GMII 3 +# SGMII 4 +# XGMII 6 +# SFI 9 +# XFI 10 +# KR 11 +# KR4 12 +# CR 13 +# CR4 14 +# XLAUI 15 +# SR 16 +# ILKN 21 +# CAUI 25 +# LR 26 +# LR4 27 +# SR4 28 +# SR2 38 +# KR2 39 +# CR2 40 +# XLAUI2 42 +# LR2 55 +# CAUI4 62 +### + +serdes_if_type_1=13 +serdes_if_type_2=13 +serdes_if_type_3=13 +serdes_if_type_4=13 +serdes_if_type_5=13 +serdes_if_type_6=13 +serdes_if_type_7=13 +serdes_if_type_8=13 +serdes_if_type_13=13 +serdes_if_type_14=13 +serdes_if_type_15=13 +serdes_if_type_16=13 +serdes_if_type_21=13 +serdes_if_type_22=13 +serdes_if_type_23=13 +serdes_if_type_24=13 +serdes_if_type_29=13 +serdes_if_type_30=13 +serdes_if_type_31=13 +serdes_if_type_32=13 +serdes_if_type_33=13 +serdes_if_type_34=13 +serdes_if_type_35=13 +serdes_if_type_36=13 +serdes_if_type_41=13 +serdes_if_type_42=13 +serdes_if_type_43=13 +serdes_if_type_44=13 +serdes_if_type_49=13 +serdes_if_type_50=13 +serdes_if_type_51=13 +serdes_if_type_52=13 +serdes_if_type_57=13 +serdes_if_type_58=13 +serdes_if_type_59=13 +serdes_if_type_60=13 +serdes_if_type_61=13 +serdes_if_type_62=13 +serdes_if_type_63=13 +serdes_if_type_64=13 +serdes_if_type_67=14 +serdes_if_type_71=14 +serdes_if_type_79=14 +serdes_if_type_87=13 +serdes_if_type_88=13 +serdes_if_type_89=13 +serdes_if_type_90=13 +serdes_if_type_95=13 +serdes_if_type_96=13 +serdes_if_type_97=13 +serdes_if_type_98=13 +serdes_if_type_99=14 +serdes_if_type_107=14 +serdes_if_type_115=14 +serdes_if_type_123=14 +serdes_if_type_127=14 +serdes_if_type_66=11 +serdes_if_type_130=11 + + +dport_map_port_60=1 +dport_map_port_59=2 +dport_map_port_58=3 +dport_map_port_57=4 +dport_map_port_64=5 +dport_map_port_63=6 +dport_map_port_62=7 +dport_map_port_61=8 +dport_map_port_49=9 +dport_map_port_50=10 +dport_map_port_51=11 +dport_map_port_52=12 +dport_map_port_4=13 +dport_map_port_3=14 +dport_map_port_2=15 +dport_map_port_1=16 +dport_map_port_8=17 +dport_map_port_7=18 +dport_map_port_6=19 +dport_map_port_5=20 +dport_map_port_16=21 +dport_map_port_15=22 +dport_map_port_14=23 +dport_map_port_13=24 +dport_map_port_24=25 +dport_map_port_23=26 +dport_map_port_22=27 +dport_map_port_21=28 +dport_map_port_32=29 +dport_map_port_31=30 +dport_map_port_30=31 +dport_map_port_29=32 +dport_map_port_36=33 +dport_map_port_35=34 +dport_map_port_34=35 +dport_map_port_33=36 +dport_map_port_44=37 +dport_map_port_43=38 +dport_map_port_42=39 +dport_map_port_41=40 +dport_map_port_88=41 +dport_map_port_87=42 +dport_map_port_90=43 +dport_map_port_89=44 +dport_map_port_96=45 +dport_map_port_95=46 +dport_map_port_98=47 +dport_map_port_97=48 +dport_map_port_99=49 +dport_map_port_107=50 +dport_map_port_115=51 +dport_map_port_123=52 +dport_map_port_79=53 +dport_map_port_67=54 +dport_map_port_71=55 +dport_map_port_127=56 + +dport_map_port_66=57 +dport_map_port_130=58 + + +phy_chain_tx_lane_map_physical{1.0}=0x3210 +phy_chain_tx_polarity_flip_physical{1.0}=0x1 +phy_chain_tx_polarity_flip_physical{2.0}=0x1 +phy_chain_tx_polarity_flip_physical{3.0}=0x1 +phy_chain_tx_polarity_flip_physical{4.0}=0x1 +phy_chain_rx_lane_map_physical{1.0}=0x3210 +phy_chain_rx_polarity_flip_physical{1.0}=0x1 +phy_chain_rx_polarity_flip_physical{2.0}=0x0 +phy_chain_rx_polarity_flip_physical{3.0}=0x1 +phy_chain_rx_polarity_flip_physical{4.0}=0x0 + +phy_chain_tx_lane_map_physical{5.0}=0x3210 +phy_chain_tx_polarity_flip_physical{5.0}=0x0 +phy_chain_tx_polarity_flip_physical{6.0}=0x0 +phy_chain_tx_polarity_flip_physical{7.0}=0x0 +phy_chain_tx_polarity_flip_physical{8.0}=0x1 +phy_chain_rx_lane_map_physical{5.0}=0x3210 +phy_chain_rx_polarity_flip_physical{5.0}=0x0 +phy_chain_rx_polarity_flip_physical{6.0}=0x1 +phy_chain_rx_polarity_flip_physical{7.0}=0x0 +phy_chain_rx_polarity_flip_physical{8.0}=0x1 + +phy_chain_tx_lane_map_physical{13.0}=0x3210 +phy_chain_tx_polarity_flip_physical{13.0}=0x0 +phy_chain_tx_polarity_flip_physical{14.0}=0x0 +phy_chain_tx_polarity_flip_physical{15.0}=0x0 +phy_chain_tx_polarity_flip_physical{16.0}=0x0 +phy_chain_rx_lane_map_physical{13.0}=0x3210 +phy_chain_rx_polarity_flip_physical{13.0}=0x0 +phy_chain_rx_polarity_flip_physical{14.0}=0x1 +phy_chain_rx_polarity_flip_physical{15.0}=0x0 +phy_chain_rx_polarity_flip_physical{16.0}=0x1 + +phy_chain_tx_lane_map_physical{21.0}=0x3210 +phy_chain_tx_polarity_flip_physical{21.0}=0x0 +phy_chain_tx_polarity_flip_physical{22.0}=0x0 +phy_chain_tx_polarity_flip_physical{23.0}=0x0 +phy_chain_tx_polarity_flip_physical{24.0}=0x0 +phy_chain_rx_lane_map_physical{21.0}=0x3210 +phy_chain_rx_polarity_flip_physical{21.0}=0x0 +phy_chain_rx_polarity_flip_physical{22.0}=0x1 +phy_chain_rx_polarity_flip_physical{23.0}=0x0 +phy_chain_rx_polarity_flip_physical{24.0}=0x1 + +phy_chain_tx_lane_map_physical{29.0}=0x3210 +phy_chain_tx_polarity_flip_physical{29.0}=0x0 +phy_chain_tx_polarity_flip_physical{30.0}=0x0 +phy_chain_tx_polarity_flip_physical{31.0}=0x0 +phy_chain_tx_polarity_flip_physical{32.0}=0x0 +phy_chain_rx_lane_map_physical{29.0}=0x3210 +phy_chain_rx_polarity_flip_physical{29.0}=0x1 +phy_chain_rx_polarity_flip_physical{30.0}=0x0 +phy_chain_rx_polarity_flip_physical{31.0}=0x1 +phy_chain_rx_polarity_flip_physical{32.0}=0x0 + +phy_chain_tx_lane_map_physical{33.0}=0x3210 +phy_chain_tx_polarity_flip_physical{33.0}=0x0 +phy_chain_tx_polarity_flip_physical{34.0}=0x0 +phy_chain_tx_polarity_flip_physical{35.0}=0x0 +phy_chain_tx_polarity_flip_physical{36.0}=0x0 +phy_chain_rx_lane_map_physical{33.0}=0x3210 +phy_chain_rx_polarity_flip_physical{33.0}=0x0 +phy_chain_rx_polarity_flip_physical{34.0}=0x1 +phy_chain_rx_polarity_flip_physical{35.0}=0x0 +phy_chain_rx_polarity_flip_physical{36.0}=0x1 + +phy_chain_tx_lane_map_physical{41.0}=0x3210 +phy_chain_tx_polarity_flip_physical{41.0}=0x0 +phy_chain_tx_polarity_flip_physical{42.0}=0x0 +phy_chain_tx_polarity_flip_physical{43.0}=0x0 +phy_chain_tx_polarity_flip_physical{44.0}=0x0 +phy_chain_rx_lane_map_physical{41.0}=0x3210 +phy_chain_rx_polarity_flip_physical{41.0}=0x0 +phy_chain_rx_polarity_flip_physical{42.0}=0x1 +phy_chain_rx_polarity_flip_physical{43.0}=0x0 +phy_chain_rx_polarity_flip_physical{44.0}=0x1 + +phy_chain_tx_lane_map_physical{49.0}=0x3210 +phy_chain_tx_polarity_flip_physical{49.0}=0x1 +phy_chain_tx_polarity_flip_physical{50.0}=0x1 +phy_chain_tx_polarity_flip_physical{51.0}=0x1 +phy_chain_tx_polarity_flip_physical{52.0}=0x1 +phy_chain_rx_lane_map_physical{49.0}=0x3210 +phy_chain_rx_polarity_flip_physical{49.0}=0x0 +phy_chain_rx_polarity_flip_physical{50.0}=0x0 +phy_chain_rx_polarity_flip_physical{51.0}=0x1 +phy_chain_rx_polarity_flip_physical{52.0}=0x0 + +phy_chain_tx_lane_map_physical{57.0}=0x3210 +phy_chain_tx_polarity_flip_physical{57.0}=0x1 +phy_chain_tx_polarity_flip_physical{58.0}=0x1 +phy_chain_tx_polarity_flip_physical{59.0}=0x1 +phy_chain_tx_polarity_flip_physical{60.0}=0x1 +phy_chain_rx_lane_map_physical{57.0}=0x3210 +phy_chain_rx_polarity_flip_physical{57.0}=0x0 +phy_chain_rx_polarity_flip_physical{58.0}=0x1 +phy_chain_rx_polarity_flip_physical{59.0}=0x1 +phy_chain_rx_polarity_flip_physical{60.0}=0x1 + +phy_chain_tx_lane_map_physical{61.0}=0x3210 +phy_chain_tx_polarity_flip_physical{61.0}=0x1 +phy_chain_tx_polarity_flip_physical{62.0}=0x1 +phy_chain_tx_polarity_flip_physical{63.0}=0x1 +phy_chain_tx_polarity_flip_physical{64.0}=0x1 +phy_chain_rx_lane_map_physical{61.0}=0x3210 +phy_chain_rx_polarity_flip_physical{61.0}=0x1 +phy_chain_rx_polarity_flip_physical{62.0}=0x0 +phy_chain_rx_polarity_flip_physical{63.0}=0x1 +phy_chain_rx_polarity_flip_physical{64.0}=0x0 + +phy_chain_tx_lane_map_physical{65.0}=0x0123 +phy_chain_tx_polarity_flip_physical{65.0}=0x1 +phy_chain_tx_polarity_flip_physical{66.0}=0x1 +phy_chain_tx_polarity_flip_physical{67.0}=0x1 +phy_chain_tx_polarity_flip_physical{68.0}=0x1 +phy_chain_rx_lane_map_physical{65.0}=0x0321 +phy_chain_rx_polarity_flip_physical{65.0}=0x0 +phy_chain_rx_polarity_flip_physical{66.0}=0x0 +phy_chain_rx_polarity_flip_physical{67.0}=0x1 +phy_chain_rx_polarity_flip_physical{68.0}=0x0 + +phy_chain_tx_lane_map_physical{69.0}=0x3120 +phy_chain_tx_polarity_flip_physical{69.0}=0x0 +phy_chain_tx_polarity_flip_physical{70.0}=0x1 +phy_chain_tx_polarity_flip_physical{71.0}=0x1 +phy_chain_tx_polarity_flip_physical{72.0}=0x1 +phy_chain_rx_lane_map_physical{69.0}=0x0123 +phy_chain_rx_polarity_flip_physical{69.0}=0x0 +phy_chain_rx_polarity_flip_physical{70.0}=0x1 +phy_chain_rx_polarity_flip_physical{71.0}=0x0 +phy_chain_rx_polarity_flip_physical{72.0}=0x0 + +phy_chain_tx_lane_map_physical{77.0}=0x2130 +phy_chain_tx_polarity_flip_physical{77.0}=0x1 +phy_chain_tx_polarity_flip_physical{78.0}=0x1 +phy_chain_tx_polarity_flip_physical{79.0}=0x0 +phy_chain_tx_polarity_flip_physical{80.0}=0x0 +phy_chain_rx_lane_map_physical{77.0}=0x3102 +phy_chain_rx_polarity_flip_physical{77.0}=0x1 +phy_chain_rx_polarity_flip_physical{78.0}=0x1 +phy_chain_rx_polarity_flip_physical{79.0}=0x0 +phy_chain_rx_polarity_flip_physical{80.0}=0x0 + +phy_chain_tx_lane_map_physical{85.0}=0x3210 +phy_chain_tx_polarity_flip_physical{85.0}=0x1 +phy_chain_tx_polarity_flip_physical{86.0}=0x1 +phy_chain_tx_polarity_flip_physical{87.0}=0x0 +phy_chain_tx_polarity_flip_physical{88.0}=0x1 +phy_chain_rx_lane_map_physical{85.0}=0x3210 +phy_chain_rx_polarity_flip_physical{85.0}=0x0 +phy_chain_rx_polarity_flip_physical{86.0}=0x0 +phy_chain_rx_polarity_flip_physical{87.0}=0x1 +phy_chain_rx_polarity_flip_physical{88.0}=0x1 + +phy_chain_tx_lane_map_physical{93.0}=0x3210 +phy_chain_tx_polarity_flip_physical{93.0}=0x0 +phy_chain_tx_polarity_flip_physical{94.0}=0x1 +phy_chain_tx_polarity_flip_physical{95.0}=0x0 +phy_chain_tx_polarity_flip_physical{96.0}=0x1 +phy_chain_rx_lane_map_physical{93.0}=0x3210 +phy_chain_rx_polarity_flip_physical{93.0}=0x1 +phy_chain_rx_polarity_flip_physical{94.0}=0x1 +phy_chain_rx_polarity_flip_physical{95.0}=0x1 +phy_chain_rx_polarity_flip_physical{96.0}=0x1 + +phy_chain_tx_lane_map_physical{97.0}=0x0312 +phy_chain_tx_polarity_flip_physical{97.0}=0x0 +phy_chain_tx_polarity_flip_physical{98.0}=0x0 +phy_chain_tx_polarity_flip_physical{99.0}=0x1 +phy_chain_tx_polarity_flip_physical{100.0}=0x1 +phy_chain_rx_lane_map_physical{97.0}=0x1023 +phy_chain_rx_polarity_flip_physical{97.0}=0x0 +phy_chain_rx_polarity_flip_physical{98.0}=0x0 +phy_chain_rx_polarity_flip_physical{99.0}=0x0 +phy_chain_rx_polarity_flip_physical{100.0}=0x0 + +phy_chain_tx_lane_map_physical{105.0}=0x0123 +phy_chain_tx_polarity_flip_physical{105.0}=0x0 +phy_chain_tx_polarity_flip_physical{106.0}=0x0 +phy_chain_tx_polarity_flip_physical{107.0}=0x0 +phy_chain_tx_polarity_flip_physical{108.0}=0x0 +phy_chain_rx_lane_map_physical{105.0}=0x0321 +phy_chain_rx_polarity_flip_physical{105.0}=0x0 +phy_chain_rx_polarity_flip_physical{106.0}=0x1 +phy_chain_rx_polarity_flip_physical{107.0}=0x0 +phy_chain_rx_polarity_flip_physical{108.0}=0x1 + +phy_chain_tx_lane_map_physical{113.0}=0x3120 +phy_chain_tx_polarity_flip_physical{113.0}=0x1 +phy_chain_tx_polarity_flip_physical{114.0}=0x0 +phy_chain_tx_polarity_flip_physical{115.0}=0x0 +phy_chain_tx_polarity_flip_physical{116.0}=0x0 +phy_chain_rx_lane_map_physical{113.0}=0x1023 +phy_chain_rx_polarity_flip_physical{113.0}=0x1 +phy_chain_rx_polarity_flip_physical{114.0}=0x1 +phy_chain_rx_polarity_flip_physical{115.0}=0x1 +phy_chain_rx_polarity_flip_physical{116.0}=0x0 + +phy_chain_tx_lane_map_physical{121.0}=0x0132 +phy_chain_tx_polarity_flip_physical{121.0}=0x1 +phy_chain_tx_polarity_flip_physical{122.0}=0x1 +phy_chain_tx_polarity_flip_physical{123.0}=0x0 +phy_chain_tx_polarity_flip_physical{124.0}=0x0 +phy_chain_rx_lane_map_physical{121.0}=0x0321 +phy_chain_rx_polarity_flip_physical{121.0}=0x0 +phy_chain_rx_polarity_flip_physical{122.0}=0x1 +phy_chain_rx_polarity_flip_physical{123.0}=0x0 +phy_chain_rx_polarity_flip_physical{124.0}=0x1 + +phy_chain_tx_lane_map_physical{125.0}=0x0213 +phy_chain_tx_polarity_flip_physical{125.0}=0x0 +phy_chain_tx_polarity_flip_physical{126.0}=0x0 +phy_chain_tx_polarity_flip_physical{127.0}=0x0 +phy_chain_tx_polarity_flip_physical{128.0}=0x1 +phy_chain_rx_lane_map_physical{125.0}=0x0321 +phy_chain_rx_polarity_flip_physical{125.0}=0x1 +phy_chain_rx_polarity_flip_physical{126.0}=0x1 +phy_chain_rx_polarity_flip_physical{127.0}=0x0 +phy_chain_rx_polarity_flip_physical{128.0}=0x0 + +### MerlinCore +phy_chain_tx_lane_map_physical{129.0}=0x3210 +phy_chain_tx_polarity_flip_physical{129.0}=0x0 +phy_chain_tx_polarity_flip_physical{130.0}=0x1 +phy_chain_tx_polarity_flip_physical{131.0}=0x1 +phy_chain_tx_polarity_flip_physical{132.0}=0x1 +phy_chain_rx_lane_map_physical{129.0}=0x3210 +phy_chain_rx_polarity_flip_physical{129.0}=0x0 +phy_chain_rx_polarity_flip_physical{130.0}=0x0 +phy_chain_rx_polarity_flip_physical{131.0}=0x0 +phy_chain_rx_polarity_flip_physical{132.0}=0x0 + diff --git a/device/quanta/x86_64-quanta_ix8_rglbmc-r0/default_sku b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/default_sku new file mode 100644 index 000000000000..b775ae4d3e67 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/default_sku @@ -0,0 +1 @@ +Quanta-IX8-56X t1 diff --git a/device/quanta/x86_64-quanta_ix8_rglbmc-r0/installer.conf b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/installer.conf new file mode 100644 index 000000000000..14404194ef53 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x2f8 +CONSOLE_DEV=1 +CONSOLE_SPEED=115200 diff --git a/device/quanta/x86_64-quanta_ix8_rglbmc-r0/led_proc_init.soc b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/led_proc_init.soc new file mode 100755 index 000000000000..0861486660c3 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/led_proc_init.soc @@ -0,0 +1,6 @@ +sleep 10 +led stop +sleep 3 +led start +sleep 3 +led auto on \ No newline at end of file diff --git a/device/quanta/x86_64-quanta_ix8_rglbmc-r0/plugins/eeprom.py b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/plugins/eeprom.py new file mode 100644 index 000000000000..2a35f3a22a17 --- /dev/null +++ b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/plugins/eeprom.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/18-0054/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/quanta/x86_64-quanta_ix8_rglbmc-r0/plugins/psuutil.py b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/plugins/psuutil.py new file mode 100644 index 000000000000..885842bbda5a --- /dev/null +++ b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/plugins/psuutil.py @@ -0,0 +1,49 @@ +# +# 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""" + + def __init__(self): + PsuBase.__init__(self) + + 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 + :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 = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by 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 = 1 + + return status diff --git a/device/quanta/x86_64-quanta_ix8_rglbmc-r0/plugins/sfputil.py b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/plugins/sfputil.py new file mode 100644 index 000000000000..205ed3c82d0d --- /dev/null +++ b/device/quanta/x86_64-quanta_ix8_rglbmc-r0/plugins/sfputil.py @@ -0,0 +1,207 @@ +#!/usr/bin/env python + +try: + import time + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class SfpUtil(SfpUtilBase): + """Platform specific SfpUtill class""" + + PORT_START = 0 + PORT_END = 55 + QSFP_PORT_START = 48 + PORTS_IN_BLOCK = 56 + + _port_to_eeprom_mapping = {} + _port_to_i2c_mapping = { + 0 : 32, + 1 : 33, + 2 : 34, + 3 : 35, + 4 : 36, + 5 : 37, + 6 : 38, + 7 : 39, + 8 : 40, + 9 : 41, + 10 : 42, + 11 : 43, + 12 : 44, + 13 : 45, + 14 : 46, + 15 : 47, + 16 : 48, + 17 : 49, + 18 : 50, + 19 : 51, + 20 : 52, + 21 : 53, + 22 : 54, + 23 : 55, + 24 : 56, + 25 : 57, + 26 : 58, + 27 : 59, + 28 : 60, + 29 : 61, + 30 : 62, + 31 : 63, + 32 : 64, + 33 : 65, + 34 : 66, + 35 : 67, + 36 : 68, + 37 : 69, + 38 : 70, + 39 : 71, + 40 : 72, + 41 : 73, + 42 : 74, + 43 : 75, + 44 : 76, + 45 : 77, + 46 : 78, + 47 : 79, + 48 : 80,#QSFP49 + 49 : 81,#QSFP50 + 50 : 82,#QSFP51 + 51 : 83,#QSFP52 + 52 : 84,#QSFP53 + 53 : 85,#QSFP54 + 54 : 86,#QSFP55 + 55 : 87,#QSFP56 + } + + @property + def port_start(self): + return self.PORT_START + + @property + def qsfp_port_start(self): + return self.QSFP_PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + + def __init__(self): + eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom' + for x in range(0, self.port_end+1): + self.port_to_eeprom_mapping[x] = eeprom_path.format(self._port_to_i2c_mapping[x]) + 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: + if port_num < 48: + reg_file = open("/sys/class/cpld-sfp28/port-"+str(port_num+1)+"/pre_n") + else: + reg_file = open("/sys/class/gpio/gpio"+str((port_num-48)*4+34)+"/value") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_file.readline().rstrip() + if port_num < 48: + if reg_value == '1': + return True + else: + if reg_value == '0': + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.qsfp_port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/class/gpio/gpio"+str((port_num-48)*4+35)+"/value") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = int(reg_file.readline().rstrip()) + + if reg_value == 0: + return False + + return True + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.qsfp_port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/class/gpio/gpio"+str((port_num-48)*4+35)+"/value", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = int(reg_file.readline().rstrip()) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = 1 + else: + reg_value = 0 + + reg_file.write(hex(reg_value)) + reg_file.close() + + return True + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self.qsfp_port_start or port_num > self.port_end: + return False + + try: + reg_file = open("/sys/class/gpio/gpio"+str((port_num-48)*4+32)+"/value", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = 0 + reg_file.write(hex(reg_value)) + reg_file.close() + + # Sleep 2 second to allow it to settle + time.sleep(2) + + # Flip the value back write back to the register to take port out of reset + try: + reg_file = open("/sys/class/gpio/gpio"+str((port_num-48)*4+32)+"/value", "r+") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = 1 + reg_file.write(hex(reg_value)) + reg_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 diff --git a/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 b/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 index bf50abe4f053..fd7c3ff95bc0 100644 --- a/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 +++ b/dockers/docker-dhcp-relay/wait_for_intf.sh.j2 @@ -29,12 +29,19 @@ function wait_until_iface_ready # Wait for all interfaces to be up and ready -{% for (name, prefix) in INTERFACE|pfx_filter %} +{% for name in PORT %} +{% if name in INTERFACE %} wait_until_iface_ready ${PORT_TABLE_PREFIX} {{ name }} +{% endif %} {% endfor %} -{% for (name, prefix) in VLAN_INTERFACE|pfx_filter %} +{% for name in VLAN %} +{% if name in VLAN_INTERFACE %} wait_until_iface_ready ${VLAN_TABLE_PREFIX} {{ name }} +{% endif %} {% endfor %} -{% for (name, prefix) in PORTCHANNEL_INTERFACE|pfx_filter %} +{% for name in PORTCHANNEL %} +{% if name in PORTCHANNEL_INTERFACE %} wait_until_iface_ready ${LAG_TABLE_PREFIX} {{ name }} +{% endif %} {% endfor %} + diff --git a/files/Aboot/boot0.j2 b/files/Aboot/boot0.j2 index 64b1414fc187..1d8d3547d7ab 100644 --- a/files/Aboot/boot0.j2 +++ b/files/Aboot/boot0.j2 @@ -164,8 +164,10 @@ extract_image() { rootfs_type=`grep " $target_path " /proc/mounts | cut -d' ' -f3` info "Extracting $dockerfs from swi" - ## vfat does not support symbol link - if [ "$rootfs_type" != "vfat" ]; then + ## Unpacking dockerfs delayed + ## 1. when disk is vfat as it does not support symbolic link + ## 2. when disk is small, expand it into ramfs during initrd + if [ "$rootfs_type" != "vfat" -a x"$docker_inram" != x"on" ]; then mkdir -p "$image_path/{{ DOCKERFS_DIR }}" if [ -n "$install" ]; then @@ -177,7 +179,7 @@ extract_image() { else ## save dockerfs archive in the image directory unzip -oq "$swipath" "$dockerfs" -d "$image_path" - info "Unpacking $dockerfs delayed to initrd because $target_path is $rootfs_type" + info "Unpacking $dockerfs delayed to initrd because $target_path is $rootfs_type or docker_inram is on" fi ## remove installer since it's not needed anymore @@ -225,7 +227,8 @@ platform_specific() { if [ "$platform" = "raven" ]; then aboot_machine=arista_7050_qx32 flash_size=2000 - echo "modprobe.blacklist=radeon,sp5100_tco acpi=off" >>/tmp/append + docker_inram=on + echo "modprobe.blacklist=radeon,sp5100_tco acpi=off docker_inram=on" >>/tmp/append fi if [ "$platform" = "crow" ]; then aboot_machine=arista_7050_qx32s @@ -343,6 +346,7 @@ write_boot_configs() { fi fi + mkdir -p "$image_path" cat /tmp/append > $cmdline_image [ -e ${target_path}/machine.conf ] || write_machine_config } @@ -441,12 +445,12 @@ if $do_install; then clean_flash fi - info "Installing image under $image_path" - extract_image - info "Generating boot-config, machine.conf and cmdline" write_boot_configs + info "Installing image under $image_path" + extract_image + run_hooks post-install else info "Using previously installed image" diff --git a/files/build_templates/teamd.service.j2 b/files/build_templates/teamd.service.j2 index 58c858effb36..8034698ecc07 100644 --- a/files/build_templates/teamd.service.j2 +++ b/files/build_templates/teamd.service.j2 @@ -1,6 +1,6 @@ [Unit] Description=TEAMD container -Requires=updategraph.service swss.service +Requires=updategraph.service After=updategraph.service swss.service Before=ntp-config.service @@ -11,4 +11,4 @@ ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStop=/usr/bin/{{docker_container_name}}.sh stop [Install] -WantedBy=multi-user.target swss.service +WantedBy=multi-user.target diff --git a/files/image_config/hostcfgd/hostcfgd b/files/image_config/hostcfgd/hostcfgd index 739c0baa4d66..b1ec2644e122 100755 --- a/files/image_config/hostcfgd/hostcfgd +++ b/files/image_config/hostcfgd/hostcfgd @@ -114,7 +114,7 @@ class AaaCfg(object): server['ip'] = addr server.update(self.tacplus_servers[addr]) servers_conf.append(server) - sorted(servers_conf, key=lambda t: t['priority'], reverse=True) + servers_conf = sorted(servers_conf, key=lambda t: int(t['priority']), reverse=True) template_file = os.path.abspath(PAM_AUTH_CONF_TEMPLATE) env = jinja2.Environment(loader=jinja2.FileSystemLoader('/'), trim_blocks=True) diff --git a/files/initramfs-tools/arista-convertfs.j2 b/files/initramfs-tools/arista-convertfs.j2 index 2ed51c02203f..535bb441f117 100644 --- a/files/initramfs-tools/arista-convertfs.j2 +++ b/files/initramfs-tools/arista-convertfs.j2 @@ -130,6 +130,9 @@ for x in "$@"; do x1="${x#loop=}" image_dir="${x1%/*}" ;; + docker_inram=*) + docker_inram="${x#docker_inram=}" + ;; SONIC_BOOT_TYPE=warm*|SONIC_BOOT_TYPE=fast*) # Skip this script for warm-reboot and fast-reboot exit 0 @@ -221,9 +224,11 @@ err_msg="Error: mounting $root_dev to $root_mnt failed" cmd="mount -t ext4 $root_dev $root_mnt" run_cmd "$cmd" "$err_msg" -err_msg="Error: extract docker directory" -cmd="[ -f $tmp_mnt/$image_dir/{{ FILESYSTEM_DOCKERFS }} ] && rm -rf $root_mnt/$image_dir/{{ DOCKERFS_DIR }} && mkdir -p $root_mnt/$image_dir/{{ DOCKERFS_DIR }} && tar xzf $tmp_mnt/$image_dir/{{ FILESYSTEM_DOCKERFS }} -C $root_mnt/$image_dir/{{ DOCKERFS_DIR }} && rm -f $tmp_mnt/$image_dir/{{ FILESYSTEM_DOCKERFS }}" -run_cmd "$cmd" "$err_msg" +if [ x"$docker_inram" != x"on" ]; then + err_msg="Error: extract docker directory" + cmd="[ -f $tmp_mnt/$image_dir/{{ FILESYSTEM_DOCKERFS }} ] && rm -rf $root_mnt/$image_dir/{{ DOCKERFS_DIR }} && mkdir -p $root_mnt/$image_dir/{{ DOCKERFS_DIR }} && tar xzf $tmp_mnt/$image_dir/{{ FILESYSTEM_DOCKERFS }} -C $root_mnt/$image_dir/{{ DOCKERFS_DIR }} && rm -f $tmp_mnt/$image_dir/{{ FILESYSTEM_DOCKERFS }}" + run_cmd "$cmd" "$err_msg" +fi err_msg="Error: copying files form $tmp_mnt to $root_mnt failed" cmd="cp -a $tmp_mnt/. $root_mnt/" diff --git a/files/initramfs-tools/union-mount.j2 b/files/initramfs-tools/union-mount.j2 index 4a0863c42a6d..f6f1deff4220 100644 --- a/files/initramfs-tools/union-mount.j2 +++ b/files/initramfs-tools/union-mount.j2 @@ -47,9 +47,17 @@ mount -n -o lowerdir=${rootmnt},upperdir=${rootmnt}/host/$image_dir/rw,workdir=$ [ -b ${ROOT} ] || mdev -s ## Mount the raw partition again mount ${ROOT} ${rootmnt}/host -## Mount the working directory of docker engine in the raw partition, bypass the overlay + mkdir -p ${rootmnt}/var/lib/docker -mount --bind ${rootmnt}/host/$image_dir/{{ DOCKERFS_DIR }} ${rootmnt}/var/lib/docker +if [ -f ${rootmnt}/host/$image_dir/{{ FILESYSTEM_DOCKERFS }} ]; then + ## mount tmpfs and extract docker into it + mount -t tmpfs -o rw,nodev,size={{ DOCKER_RAMFS_SIZE }} tmpfs ${rootmnt}/var/lib/docker + tar xz --numeric-owner -f ${rootmnt}/host/$image_dir/{{ FILESYSTEM_DOCKERFS }} -C ${rootmnt}/var/lib/docker +else + ## Mount the working directory of docker engine in the raw partition, bypass the overlay + mount --bind ${rootmnt}/host/$image_dir/{{ DOCKERFS_DIR }} ${rootmnt}/var/lib/docker +fi + ## Mount the boot directory in the raw partition, bypass the overlay mkdir -p ${rootmnt}/boot mount --bind ${rootmnt}/host/$image_dir/boot ${rootmnt}/boot diff --git a/files/scripts/swss.sh b/files/scripts/swss.sh index 88bce037b9c4..7b6ae6b5dbfe 100755 --- a/files/scripts/swss.sh +++ b/files/scripts/swss.sh @@ -2,6 +2,7 @@ SERVICE="swss" PEER="syncd" +DEPENDENT="teamd" DEBUGLOG="/tmp/swss-syncd-debug.log" LOCKFILE="/tmp/swss-syncd-lock" @@ -78,11 +79,24 @@ function clean_up_tables() end" 0 } -startPeerService() { +start_peer_and_dependent_services() { check_warm_boot if [[ x"$WARM_BOOT" != x"true" ]]; then /bin/systemctl start ${PEER} + for dep in ${DEPENDENT}; do + /bin/systemctl start ${dep} + done + fi +} + +stop_peer_and_dependent_services() { + # if warm start enabled or peer lock exists, don't stop peer service docker + if [[ x"$WARM_BOOT" != x"true" ]]; then + /bin/systemctl stop ${PEER} + for dep in ${DEPENDENT}; do + /bin/systemctl stop ${dep} + done fi } @@ -116,7 +130,7 @@ start() { } wait() { - startPeerService + start_peer_and_dependent_services /usr/bin/${SERVICE}.sh wait } @@ -135,10 +149,7 @@ stop() { # Unlock has to happen before reaching out to peer service unlock_service_state_change - # if warm start enabled or peer lock exists, don't stop peer service docker - if [[ x"$WARM_BOOT" != x"true" ]]; then - /bin/systemctl stop ${PEER} - fi + stop_peer_and_dependent_services } case "$1" in diff --git a/installer/armhf/install.sh b/installer/armhf/install.sh old mode 100644 new mode 100755 index ef5779b06e52..6398436ebb6e --- a/installer/armhf/install.sh +++ b/installer/armhf/install.sh @@ -90,8 +90,7 @@ umount $demo_mount echo "Updating U-Boot environment variables" #global uboot enviroment settings -#FW_ENV='/dev/mtd0 \t\t 0x00500000 \t 0x80000 \t 0x100000 \t 8' -FW_ENV='/dev/mtd0 \t\t 0x00500000 \t 0x80000 \t 0x100000 \t 2' +FW_ENV='/dev/mtd0 \t\t 0x00500000 \t 0x80000 \t 0x100000 \t 8' kernel_addr=0x1100000 fdt_addr=0x1000000 diff --git a/installer/x86_64/install.sh b/installer/x86_64/install.sh index 680e5c5f3297..2cd579e28b29 100755 --- a/installer/x86_64/install.sh +++ b/installer/x86_64/install.sh @@ -479,15 +479,20 @@ else fi # Decompress the file for the file system directly to the partition -unzip -o $ONIE_INSTALLER_PAYLOAD -x "$FILESYSTEM_DOCKERFS" -d $demo_mnt/$image_dir - -if [ "$install_env" = "onie" ]; then - TAR_EXTRA_OPTION="--numeric-owner" +if [ x"$docker_inram" = x"on" ]; then + # when disk is small, keep dockerfs.tar.gz in disk, expand it into ramfs during initrd + unzip -o $ONIE_INSTALLER_PAYLOAD -d $demo_mnt/$image_dir else - TAR_EXTRA_OPTION="--numeric-owner --warning=no-timestamp" + unzip -o $ONIE_INSTALLER_PAYLOAD -x "$FILESYSTEM_DOCKERFS" -d $demo_mnt/$image_dir + + if [ "$install_env" = "onie" ]; then + TAR_EXTRA_OPTION="--numeric-owner" + else + TAR_EXTRA_OPTION="--numeric-owner --warning=no-timestamp" + fi + mkdir -p $demo_mnt/$image_dir/$DOCKERFS_DIR + unzip -op $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/$DOCKERFS_DIR fi -mkdir -p $demo_mnt/$image_dir/$DOCKERFS_DIR -unzip -op $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/$DOCKERFS_DIR if [ "$install_env" = "onie" ]; then # Store machine description in target file system diff --git a/onie-image.conf b/onie-image.conf index 868a2aa52331..db99c867de04 100644 --- a/onie-image.conf +++ b/onie-image.conf @@ -24,6 +24,9 @@ FILESYSTEM_DOCKERFS=dockerfs.tar.gz ## docker directory on the root filesystem DOCKERFS_DIR=docker +## docker ramfs disk space +DOCKER_RAMFS_SIZE=800M + ## Output file name for onie installer OUTPUT_ONIE_IMAGE=target/sonic-$TARGET_MACHINE.bin diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/sfputil b/platform/barefoot/sonic-platform-modules-bfn-montara/scripts/bf-sfputil similarity index 100% rename from platform/barefoot/sonic-platform-modules-bfn-montara/scripts/sfputil rename to platform/barefoot/sonic-platform-modules-bfn-montara/scripts/bf-sfputil diff --git a/platform/barefoot/sonic-platform-modules-bfn/scripts/sfputil b/platform/barefoot/sonic-platform-modules-bfn/scripts/bf-sfputil similarity index 100% rename from platform/barefoot/sonic-platform-modules-bfn/scripts/sfputil rename to platform/barefoot/sonic-platform-modules-bfn/scripts/bf-sfputil diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 3a739d281a2c..0edb6ebc4f9a 100644 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -31,6 +31,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(ACCTON_AS9716_32D_PLATFORM_MODULE) \ $(ACCTON_AS5835_54T_PLATFORM_MODULE) \ $(ACCTON_AS7312_54XS_PLATFORM_MODULE) \ + $(ACCTON_AS7315_27XB_PLATFORM_MODULE) \ $(INVENTEC_D7032Q28B_PLATFORM_MODULE) \ $(INVENTEC_D7054Q28B_PLATFORM_MODULE) \ $(INVENTEC_D7264Q28B_PLATFORM_MODULE) \ @@ -41,6 +42,8 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \ $(DELTA_AG5648_PLATFORM_MODULE) \ $(DELTA_ET6248BRB_PLATFORM_MODULE) \ $(QUANTA_IX1B_32X_PLATFORM_MODULE) \ + $(QUANTA_IX7_32X_PLATFORM_MODULE) \ + $(QUANTA_IX8_56X_PLATFORM_MODULE) \ $(QUANTA_IX8C_56X_PLATFORM_MODULE) \ $(MITAC_LY1200_32X_PLATFORM_MODULE) \ $(ALPHANETWORKS_SNH60A0_320FV2_PLATFORM_MODULE) \ diff --git a/platform/broadcom/platform-modules-accton.mk b/platform/broadcom/platform-modules-accton.mk index 6745bb592360..37ef2669fbb4 100755 --- a/platform/broadcom/platform-modules-accton.mk +++ b/platform/broadcom/platform-modules-accton.mk @@ -16,6 +16,7 @@ ACCTON_AS5835_54X_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS9716_32D_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS5835_54T_PLATFORM_MODULE_VERSION = 1.1 ACCTON_AS7312_54XS_PLATFORM_MODULE_VERSION = 1.1 +ACCTON_AS7315_27XB_PLATFORM_MODULE_VERSION = 1.1 export ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION export ACCTON_AS5712_54X_PLATFORM_MODULE_VERSION @@ -33,6 +34,7 @@ export ACCTON_AS5835_54X_PLATFORM_MODULE_VERSION export ACCTON_AS9716_32D_PLATFORM_MODULE_VERSION export ACCTON_AS5835_54T_PLATFORM_MODULE_VERSION export ACCTON_AS7312_54XS_PLATFORM_MODULE_VERSION +export ACCTON_AS7315_27XB_PLATFORM_MODULE_VERSION ACCTON_AS7712_32X_PLATFORM_MODULE = sonic-platform-accton-as7712-32x_$(ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION)_amd64.deb $(ACCTON_AS7712_32X_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-accton @@ -100,4 +102,8 @@ ACCTON_AS5835_54T_PLATFORM_MODULE = sonic-platform-accton-as5835-54t_$(ACCTON_AS $(ACCTON_AS5835_54T_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as5835_54t-r0 $(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS5835_54T_PLATFORM_MODULE))) +ACCTON_AS7315_27XB_PLATFORM_MODULE = sonic-platform-accton-as7315-27xb_$(ACCTON_AS7315_27XB_PLATFORM_MODULE_VERSION)_amd64.deb +$(ACCTON_AS7315_27XB_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7315_27xb-r0 +$(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS7315_27XB_PLATFORM_MODULE))) + SONIC_STRETCH_DEBS += $(ACCTON_AS7712_32X_PLATFORM_MODULE) diff --git a/platform/broadcom/platform-modules-quanta.mk b/platform/broadcom/platform-modules-quanta.mk index 6d995f4d9149..93cf7b4d9d7f 100644 --- a/platform/broadcom/platform-modules-quanta.mk +++ b/platform/broadcom/platform-modules-quanta.mk @@ -1,9 +1,13 @@ # Quanta Platform modules QUANTA_IX1B_32X_PLATFORM_MODULE_VERSION = 1.0 +QUANTA_IX7_32X_PLATFORM_MODULE_VERSION = 1.0 +QUANTA_IX8_56X_PLATFORM_MODULE_VERSION = 1.0 QUANTA_IX8C_56X_PLATFORM_MODULE_VERSION = 1.0 export QUANTA_IX1B_32X_PLATFORM_MODULE_VERSION +export QUANTA_IX7_32X_PLATFORM_MODULE_VERSION +export QUANTA_IX8_56X_PLATFORM_MODULE_VERSION export QUANTA_IX8C_56X_PLATFORM_MODULE_VERSION QUANTA_IX1B_32X_PLATFORM_MODULE = sonic-platform-quanta-ix1b-32x_$(QUANTA_IX1B_32X_PLATFORM_MODULE_VERSION)_amd64.deb @@ -12,6 +16,14 @@ $(QUANTA_IX1B_32X_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_C $(QUANTA_IX1B_32X_PLATFORM_MODULE)_PLATFORM = x86_64-quanta_ix1b_rglbmc-r0 SONIC_DPKG_DEBS += $(QUANTA_IX1B_32X_PLATFORM_MODULE) +QUANTA_IX7_32X_PLATFORM_MODULE = sonic-platform-quanta-ix7-32x_$(QUANTA_IX7_32X_PLATFORM_MODULE_VERSION)_amd64.deb +$(QUANTA_IX7_32X_PLATFORM_MODULE)_PLATFORM = x86_64-quanta_ix7_rglbmc-r0 +$(eval $(call add_extra_package,$(QUANTA_IX1B_32X_PLATFORM_MODULE),$(QUANTA_IX7_32X_PLATFORM_MODULE))) + +QUANTA_IX8_56X_PLATFORM_MODULE = sonic-platform-quanta-ix8-56x_$(QUANTA_IX8_56X_PLATFORM_MODULE_VERSION)_amd64.deb +$(QUANTA_IX8_56X_PLATFORM_MODULE)_PLATFORM = x86_64-quanta_ix8_rglbmc-r0 +$(eval $(call add_extra_package,$(QUANTA_IX1B_32X_PLATFORM_MODULE),$(QUANTA_IX8_56X_PLATFORM_MODULE))) + QUANTA_IX8C_56X_PLATFORM_MODULE = sonic-platform-quanta-ix8c-56x_$(QUANTA_IX8C_56X_PLATFORM_MODULE_VERSION)_amd64.deb $(QUANTA_IX8C_56X_PLATFORM_MODULE)_PLATFORM = x86_64-quanta_ix8c_bwde-r0 $(eval $(call add_extra_package,$(QUANTA_IX1B_32X_PLATFORM_MODULE),$(QUANTA_IX8C_56X_PLATFORM_MODULE))) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/classes/__init__.py b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/classes/__init__.py new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/classes/fanutil.py b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/classes/fanutil.py new file mode 100644 index 000000000000..0e7b06bbd287 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/classes/fanutil.py @@ -0,0 +1,214 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 11/13/2017: Polly Hsu, Create +# 1/10/2018: Jostar modify for as7716_32 +# 5/02/2019: Roy Lee modify for as7816_64x +# ------------------------------------------------------------------ + +try: + import time + import logging + from collections import namedtuple +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + + +class FanUtil(object): + """Platform-specific FanUtil class""" + + FAN_TOTAL_NUM = 5 + FAN_NUM_1_IDX = 1 + + FAN_NODE_NUM = 2 + FAN_FAULT_IDX = 1 + #FAN_SPEED_IDX = 2 + FAN_DIR_IDX = 2 + #FAN_NODE_DUTY_IDX_OF_MAP = 4 + #FANR_NODE_FAULT_IDX_OF_MAP = 5 + + BASE_VAL_PATH = '/sys/bus/i2c/devices/50-0066/{0}' + FAN_DUTY_PATH = '/sys/bus/i2c/devices/50-0066/fan{0}_pwm' + + #logfile = '' + #loglevel = self.logger.INFO + + """ Dictionary where + key1 = fan id index (integer) starting from 1 + key2 = fan node index (interger) starting from 1 + value = path to fan device file (string) """ + dev_paths = {} + + node_postfix = ["fault", "direction"] + def _get_fan_to_device_node(self, fan_num, node_num): + return "fan{0}_{1}".format(fan_num, self.node_postfix[node_num-1]) + + def _get_fan_node_val(self, fan_num, node_num): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_TOTAL_NUM: + self.logger.debug('GET. Parameter error. fan_num:%d', fan_num) + return None + + if node_num < self.FAN_FAULT_IDX or node_num > self.FAN_NODE_NUM: + self.logger.debug('GET. Parameter error. node_num:%d', node_num) + return None + + device_path = self.get_fan_to_device_path(fan_num, node_num) + + try: + val_file = open(device_path, 'r') + except IOError as e: + self.logger.error('GET. unable to open file: %s', str(e)) + return None + + content = val_file.readline().rstrip() + + if content == '': + self.logger.debug('GET. content is NULL. device_path:%s', device_path) + return None + + try: + val_file.close() + except: + self.logger.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return int(content) + + def _set_fan_node_val(self, fan_num, node_num, val): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_TOTAL_NUM: + self.logger.debug('GET. Parameter error. fan_num:%d', fan_num) + return None + + if node_num < self.FAN_FAULT_IDX or node_num > self.FAN_NODE_NUM: + self.logger.debug('GET. Parameter error. node_num:%d', node_num) + return None + + content = str(val) + if content == '': + self.logger.debug('GET. content is NULL. device_path:%s', device_path) + return None + + device_path = self.get_fan_to_device_path(fan_num, node_num) + try: + val_file = open(device_path, 'w') + except IOError as e: + self.logger.error('GET. unable to open file: %s', str(e)) + return None + + val_file.write(content) + + try: + val_file.close() + except: + self.logger.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return True + + logger = logging.getLogger(__name__) + def __init__(self, log_level=logging.DEBUG): + ch = logging.StreamHandler() + ch.setLevel(log_level) + self.logger.addHandler(ch) + + fan_path = self.BASE_VAL_PATH + for fan_num in range(self.FAN_NUM_1_IDX, self.FAN_TOTAL_NUM+1): + for node_num in range(1, self.FAN_NODE_NUM+1): + node = self._get_fan_to_device_node(fan_num, node_num) + self.dev_paths[(fan_num, node_num)] = fan_path.format(node) + + def get_num_fans(self): + return self.FAN_TOTAL_NUM + + def get_idx_fan_start(self): + return self.FAN_NUM_1_IDX + + def get_num_nodes(self): + return self.FAN_NODE_NUM + + def get_idx_node_start(self): + return self.FAN_FAULT_IDX + + def get_size_node_map(self): + return len(self.dev_paths) + + def get_size_path_map(self): + return len(self.dev_paths) + + def get_fan_to_device_path(self, fan_num, node_num): + return self.dev_paths[(fan_num, node_num)] + + def get_fan_fault(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_FAULT_IDX) + + #def get_fan_speed(self, fan_num): + # return self._get_fan_node_val(fan_num, self.FAN_SPEED_IDX) + + def get_fan_dir(self, fan_num): + return self._get_fan_node_val(fan_num, self.FAN_DIR_IDX) + + def get_fan_duty_cycle(self): + try: + val_file = open(self.FAN_DUTY_PATH.format(1)) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + return int(content) + + def set_fan_duty_cycle(self, val): + for fan_num in range(1, self.FAN_TOTAL_NUM+1): + try: + fan_file = open(self.FAN_DUTY_PATH.format(fan_num), 'r+') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + fan_file.write(str(val)) + fan_file.close() + return True + + def get_fan_status(self, fan_num): + if fan_num < self.FAN_NUM_1_IDX or fan_num > self.FAN_TOTAL_NUM: + self.logger.debug('GET. Parameter error. fan_num, %d', fan_num) + return None + + if self.get_fan_fault(fan_num) is not None and self.get_fan_fault(fan_num) > 0: + self.logger.debug('GET. FAN fault. fan_num, %d', fan_num) + return False + + #if self.get_fanr_fault(fan_num) is not None and self.get_fanr_fault(fan_num) > 0: + # self.logger.debug('GET. FANR fault. fan_num, %d', fan_num) + # return False + + return True + +#def main(): +# fan = FanUtil() +# +# print 'get_size_node_map : %d' % fan.get_size_node_map() +# print 'get_size_path_map : %d' % fan.get_size_path_map() +# for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1): +# for y in range(fan.get_idx_node_start(), fan.get_num_nodes()+1): +# print fan.get_fan_to_device_path(x, y) +# +#if __name__ == '__main__': +# main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/classes/thermalutil.py new file mode 100644 index 000000000000..47dba67f2c1f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/classes/thermalutil.py @@ -0,0 +1,128 @@ +#!/usr/bin/env python +# +# Copyright (C) 2017 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 11/13/2017: Polly Hsu, Create +# 1/10/2018:Jostar modify for as7716_32x +# 5/02/2019: Roy Lee modify for as7816_64x +# ------------------------------------------------------------------ + +try: + import time + import logging + import glob + from collections import namedtuple +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + + +class ThermalUtil(object): + """Platform-specific ThermalUtil class""" + + THERMAL_NUM_ON_MAIN_BROAD = 3 + THERMAL_NUM_1_IDX = 1 + BASE_VAL_PATH = '/sys/bus/i2c/devices/{0}-00{1}/hwmon/hwmon*/temp1_input' + + """ Dictionary where + key1 = thermal id index (integer) starting from 1 + value = path to fan device file (string) """ + _thermal_to_device_path_mapping = {} + + _thermal_to_device_node_mapping = [ + ['51', '49'], + ['52', '4a'], + ['53', '4c'], + ] + logger = logging.getLogger(__name__) + def __init__(self, log_level=logging.DEBUG): + ch = logging.StreamHandler() + ch.setLevel(log_level) + self.logger.addHandler(ch) + + thermal_path = self.BASE_VAL_PATH + for x in range(self.THERMAL_NUM_ON_MAIN_BROAD): + self._thermal_to_device_path_mapping[x+1] = thermal_path.format( + self._thermal_to_device_node_mapping[x][0], + self._thermal_to_device_node_mapping[x][1]) + + def _get_thermal_node_val(self, thermal_num): + if thermal_num < self.THERMAL_NUM_1_IDX or thermal_num > self.THERMAL_NUM_ON_MAIN_BROAD: + self.logger.debug('GET. Parameter error. thermal_num, %d', thermal_num) + return None + + device_path = self.get_thermal_to_device_path(thermal_num) + for filename in glob.glob(device_path): + try: + val_file = open(filename, 'r') + except IOError as e: + self.logger.error('GET. unable to open file: %s', str(e)) + return None + + content = val_file.readline().rstrip() + + if content == '': + self.logger.debug('GET. content is NULL. device_path:%s', device_path) + return None + + try: + val_file.close() + except: + self.logger.debug('GET. unable to close file. device_path:%s', device_path) + return None + + return int(content) + + + def get_num_thermals(self): + return self.THERMAL_NUM_ON_MAIN_BROAD + + def get_idx_thermal_start(self): + return self.THERMAL_NUM_1_IDX + + def get_size_node_map(self): + return len(self._thermal_to_device_node_mapping) + + def get_size_path_map(self): + return len(self._thermal_to_device_path_mapping) + + def get_thermal_to_device_path(self, thermal_num): + return self._thermal_to_device_path_mapping[thermal_num] + + def get_thermal_2_val(self): + return self._get_thermal_node_val(self.THERMAL_NUM_2_IDX) + + def get_thermal_temp(self): + sum = 0 + o = [] + for x in range(self.THERMAL_NUM_ON_MAIN_BROAD): + sum += self._get_thermal_node_val(x+1) + avg = sum/self.THERMAL_NUM_ON_MAIN_BROAD + avg = (avg/1000)*1000 #round down for hysteresis. + return avg + +#def main(): +# thermal = ThermalUtil() +# +# print 'get_size_node_map : %d' % thermal.get_size_node_map() +# print 'get_size_path_map : %d' % thermal.get_size_path_map() +# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1): +# print thermal.get_thermal_to_device_path(x) +# +#if __name__ == '__main__': +# main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/Makefile b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/Makefile new file mode 100644 index 000000000000..a1bf8335378c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/Makefile @@ -0,0 +1,2 @@ +obj-m:= accton_as7315_27xb_fan.o x86-64-accton-as7315-27xb-cpld.o x86-64-accton-as7315-27xb-psu.o \ + at24_as7315_27xb.o x86-64-accton-as7315-27xb-led.o ym2651y.o diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/accton_as7315_27xb_fan.c b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/accton_as7315_27xb_fan.c new file mode 100644 index 000000000000..adf8fc69ea35 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/accton_as7315_27xb_fan.c @@ -0,0 +1,673 @@ +/* + * A hwmon driver for the Accton as5710 54x fan contrl + * + * Copyright (C) 2013 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define DRV_NAME "as5812_54x_fan" + +#define FAN_MAX_NUMBER 5 +#define FAN_SPEED_TACH_TO_RPM_STEP 175 +#define FAN_SPEED_PWM_STEPS 31 +#define FAN_DUTY_CYCLE_MIN 0 /* 10% ??*/ +#define FAN_DUTY_CYCLE_MAX 100 /* 100% */ + + +#define I2C_RW_RETRY_COUNT 10 +#define I2C_RW_RETRY_INTERVAL 60 /* ms */ +#define ATTR_ALLOC_SIZE 1 /*For last attribute which is NUll.*/ +#define NAME_SIZE 24 + +typedef ssize_t (*show_func)( struct device *dev, + struct device_attribute *attr, + char *buf); +typedef ssize_t (*store_func)(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count); + + +struct fan_sensor { + struct fan_sensor *next; + char name[NAME_SIZE+1]; /* sysfs sensor name */ + struct device_attribute attribute; + bool update; /* runtime sensor update needed */ + int data; /* Sensor data. Negative if there was a read error */ + + u8 reg; /* register */ + u8 mask; /* bit mask */ + bool invert; /* inverted value*/ + +}; + +#define to_fan_sensor(_attr) \ + container_of(_attr, struct fan_sensor, attribute) + + +struct model_attrs { + struct attrs **cmn; + struct attrs **indiv; +}; + + +struct fan_data_t { + struct device *dev; + struct device *hwmon_dev; + + int num_attributes; + struct attribute_group group; + struct fan_sensor *sensors; + int attr_index; + struct model_attrs *attrs; + + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + + u8 fan_num; + + u8 status[FAN_MAX_NUMBER]; /* inner first fan status */ + u32 speed[FAN_MAX_NUMBER]; /* inner first fan speed */ + u8 direction[FAN_MAX_NUMBER]; /* reconrd the direction of inner first and second fans */ + u32 duty_cycle[FAN_MAX_NUMBER]; /* control the speed of inner first and second fans */ + u8 r_status[FAN_MAX_NUMBER]; /* inner second fan status */ + u32 r_speed[FAN_MAX_NUMBER]; /* inner second fan speed */ +}; + +static ssize_t show_bit(struct device *dev, + struct device_attribute *devattr, char *buf); +static ssize_t show_byte(struct device *dev, + struct device_attribute *devattr, char *buf); +static ssize_t set_1bit(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t set_pwm(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t show_pwm(struct device *dev, + struct device_attribute *devattr, char *buf); +static ssize_t show_rpm(struct device *dev, + struct device_attribute *devattr, char *buf); + +struct base_attrs { + const char *name; + umode_t mode; + show_func get; + store_func set; +}; + +struct attrs { + int reg; + int mask; + bool invert; + struct base_attrs *base; +}; + +enum common_attrs { + BRD_VERSION, + PLD_VERSION, + PLD_SVERSION, + NUM_COMMON_ATTR +}; + +struct base_attrs common_base_attrs[NUM_COMMON_ATTR] = +{ + [BRD_VERSION] = {"borad_ver", S_IRUGO, show_byte, NULL}, + [PLD_VERSION] = {"cpld_ver", S_IRUGO, show_byte, NULL}, + [PLD_SVERSION] = {"cpld_subver", S_IRUGO, show_byte, NULL}, +}; + +struct attrs common_attrs[] = { + [BRD_VERSION] = {0x00, -1, false, &common_base_attrs[BRD_VERSION]}, + [PLD_VERSION] = {0x01, -1, false, &common_base_attrs[PLD_VERSION]}, + [PLD_SVERSION] = {0x02, -1, false, &common_base_attrs[PLD_SVERSION]}, +}; + +struct attrs *as7315_cmn_list[] = { + &common_attrs[BRD_VERSION], + &common_attrs[PLD_VERSION], + &common_attrs[PLD_SVERSION], + NULL +}; + +enum fan_attrs { + _ENABLE, + _PRESENT, + _FAULT, + _SPEED_RPM, + _PWM, + _DIRECTION, + NUM_FAN_ATTRS +}; + +struct base_attrs tray_base_attrs[NUM_FAN_ATTRS] = +{ + {"enable", S_IRUGO|S_IWUSR, show_bit, set_1bit}, + {"present", S_IRUGO, show_bit, NULL}, + {"fault", S_IRUGO, show_bit, NULL}, + {"input", S_IRUGO, show_rpm, NULL}, + {"pwm", S_IRUGO|S_IWUSR, show_pwm, set_pwm}, + {"dir", S_IRUGO, show_bit, NULL}, +}; + +struct attrs as7315_module[NUM_FAN_ATTRS] = { + {0x10, -1, false, &tray_base_attrs[_ENABLE]}, + {0x22, 0, true, &tray_base_attrs[_PRESENT]}, + {0x22, 1, false, &tray_base_attrs[_FAULT]}, + {0x20, 0, false, &tray_base_attrs[_SPEED_RPM]}, + {0x21, 0, false, &tray_base_attrs[_PWM]}, + {-1, -1, false, &tray_base_attrs[_DIRECTION]}, +}; + +struct attrs *as7315_mod_list[] = { + &as7315_module[_ENABLE], + &as7315_module[_PRESENT], + &as7315_module[_FAULT], + &as7315_module[_SPEED_RPM], + &as7315_module[_PWM], + NULL +}; + +struct model_attrs models_attr = { + .cmn = as7315_cmn_list, + .indiv = as7315_mod_list, +}; + + +static const struct i2c_device_id as7315_fan_id[] = { + { "as7315_fan", 0}, + { }, +}; +MODULE_DEVICE_TABLE(i2c, as7315_fan_id); + + +static int cpld_write_internal( + struct i2c_client *client, u8 reg, u8 value) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_write_byte_data(client, reg, value); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + break; + } + return status; +} + +static int cpld_read_internal(struct i2c_client *client, u8 reg) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_read_byte_data(client, reg); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + break; + } + return status; +} + +static ssize_t show_bit(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + int value; + struct i2c_client *client = to_i2c_client(dev); + struct fan_data_t *data = i2c_get_clientdata(client); + struct fan_sensor *sensor = to_fan_sensor(devattr); + + mutex_lock(&data->update_lock); + value = cpld_read_internal(client, sensor->reg); + if (unlikely(value < 0)) { + mutex_unlock(&data->update_lock); + return value; + } + value = value & sensor->mask; + if (sensor->invert) + value = !value; + mutex_unlock(&data->update_lock); + + return snprintf(buf, PAGE_SIZE, "%x\n", !!value); +} + +static ssize_t _read_1byte(struct device *dev, + struct device_attribute *devattr, u8 *data) +{ + int rv; + struct i2c_client *client = to_i2c_client(dev); + struct fan_data_t *fdata = i2c_get_clientdata(client); + struct fan_sensor *sensor = to_fan_sensor(devattr); + + mutex_lock(&fdata->update_lock); + rv = cpld_read_internal(client, sensor->reg); + if (unlikely(rv < 0)) { + mutex_unlock(&fdata->update_lock); + return rv; + } + mutex_unlock(&fdata->update_lock); + *data = rv; + return 0; +} + +static ssize_t show_byte(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + u8 data; + int rv; + + rv =_read_1byte(dev, devattr, &data); + if (unlikely(rv < 0)) { + return rv; + } + return snprintf(buf, PAGE_SIZE, "0x%x\n", data); +} + + +static u32 reg_val_to_duty_cycle(u8 reg_val) +{ + return ((u32)(reg_val+1) * 156 + 88) / 100; +} +static u8 duty_cycle_to_reg_val(u8 duty_cycle) +{ + return ((u32)duty_cycle * 100 / 155) - 1; +} + +static ssize_t show_pwm(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + u8 data; + int rv; + + rv =_read_1byte(dev, devattr, &data); + if (unlikely(rv < 0)) { + return rv; + } + data = reg_val_to_duty_cycle(data); + data = (data > FAN_DUTY_CYCLE_MAX)? FAN_DUTY_CYCLE_MAX: data; + return snprintf(buf, PAGE_SIZE, "%d\n", data); +} + +static ssize_t show_rpm(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + u8 data; + int rv; + + rv =_read_1byte(dev, devattr, &data); + if (unlikely(rv < 0)) { + return rv; + } + rv = data * FAN_SPEED_TACH_TO_RPM_STEP; + return snprintf(buf, PAGE_SIZE, "%d\n", rv); +} +static ssize_t set_1bit(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + long is_reset; + int value, status; + struct i2c_client *client = to_i2c_client(dev); + struct fan_data_t *data = i2c_get_clientdata(client); + struct fan_sensor *sensor = to_fan_sensor(devattr); + u8 cpld_bit, reg; + + status = kstrtol(buf, 10, &is_reset); + if (status) { + return status; + } + reg = sensor->reg; + cpld_bit = sensor->mask; + mutex_lock(&data->update_lock); + value = cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + + if (sensor->invert) + is_reset = !is_reset; + + if (is_reset) { + value |= cpld_bit; + } + else { + value &= ~cpld_bit; + } + + status = cpld_write_internal(client, reg, value); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + + +static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + long value; + int status; + struct i2c_client *client = to_i2c_client(dev); + struct fan_data_t *data = i2c_get_clientdata(client); + struct fan_sensor *sensor = to_fan_sensor(devattr); + u8 reg; + + status = kstrtol(buf, 10, &value); + if (status) { + return status; + } + + value = (value > FAN_DUTY_CYCLE_MAX )? FAN_DUTY_CYCLE_MAX: value; + value = duty_cycle_to_reg_val(value); + reg = sensor->reg; + + mutex_lock(&data->update_lock); + status = cpld_write_internal(client, reg, value); + if (unlikely(status < 0)) { + mutex_unlock(&data->update_lock); + return status; + } + mutex_unlock(&data->update_lock); + return count; +} + + + +static int _add_attribute(struct fan_data_t *data, struct attribute *attr) +{ + int new_max_attrs = ++data->num_attributes + ATTR_ALLOC_SIZE; + void *new_attrs = krealloc(data->group.attrs, + new_max_attrs * sizeof(void *), + GFP_KERNEL); + + if (!new_attrs) + return -ENOMEM; + + data->group.attrs = new_attrs; + data->group.attrs[data->num_attributes-1] = attr; + data->group.attrs[data->num_attributes] = NULL; + + return 0; +} + +static void cpld_dev_attr_init(struct device_attribute *dev_attr, + const char *name, umode_t mode, + show_func show, store_func store) +{ + sysfs_attr_init(&dev_attr->attr); + dev_attr->attr.name = name; + dev_attr->attr.mode = mode; + dev_attr->show = show; + dev_attr->store = store; +} + +static struct fan_sensor * _add_sensor(struct fan_data_t *data, + const char *name, + u8 reg, u8 mask, bool invert, + bool update, umode_t mode, + show_func get, store_func set) +{ + struct fan_sensor *sensor; + struct device_attribute *a; + + sensor = devm_kzalloc(data->dev, sizeof(*sensor), GFP_KERNEL); + if (!sensor) + return NULL; + a = &sensor->attribute; + + snprintf(sensor->name, sizeof(sensor->name), name); + sensor->reg = reg; + sensor->mask = mask; + sensor->update = update; + sensor->invert = invert; + cpld_dev_attr_init(a, sensor->name, + mode, + get, set); + + if (_add_attribute(data, &a->attr)) + return NULL; + + sensor->next = data->sensors; + data->sensors = sensor; + + return sensor; +} + +static int _add_attributes_cmn(struct fan_data_t *data, struct attrs **cmn) +{ + u8 reg, i ; + bool invert; + struct attrs *a; + struct base_attrs *b; + + if (NULL == cmn) + return -1; + + for (i = 0; cmn[i]; i++) + { + a = cmn[i]; + reg = a->reg; + invert = a->invert; + + + + b = a->base; + if (NULL == b) + break; + + + if (_add_sensor(data, b->name, + reg, 0xff, invert, + true, b->mode, + b->get, b->set) == NULL) + { + return -ENOMEM; + } + } + return 0; +} + +static int _add_attributes_indiv(struct fan_data_t *data, struct attrs **pa) +{ + char name[NAME_SIZE+1]; + int i, j, mask; + u8 reg, invert, reg_start, jump; + struct attrs *a; + struct base_attrs *b; + + if (NULL == pa) + return -EFAULT; + + jump = 0x10; + for (i = 0; pa[i]; i++) { + a = pa[i]; + reg_start = a->reg; + + if (reg < 0) + break; + + b = a->base; + if (b == NULL) + break; + invert = a->invert; + for (j = 0; j < data->fan_num; j++) + { + + snprintf(name, NAME_SIZE, "fan%d_%s", j+1, b->name); + /*If mask < 0, mask is as index*/ + if (a->mask < 0) { + mask = 1 << (j%8); + reg = reg_start; + } else { /*If mask >= 0, means to get full byte and reg need to shift*/ + mask = 1 << (a->mask); + reg = reg_start + ((j%8)*jump); + } + if (_add_sensor(data, name, reg, mask, invert, + true, b->mode, b->get, b->set) == NULL) + { + return -ENOMEM; + } + } + } + + + return 0; +} + +static int _add_attributes(struct i2c_client *client, + struct fan_data_t *data) +{ + struct model_attrs *m = data->attrs; + + if (m == NULL) + return -EINVAL; + + /* Common attributes.*/ + _add_attributes_cmn(data, m->cmn); + + /* Port-wise attributes.*/ + _add_attributes_indiv(data, m->indiv); + + return 0; +} + +static int fan_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + int status; + struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); + struct fan_data_t *data = NULL; + struct device *dev = &client->dev; + + + if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE_DATA)) + return -ENODEV; + + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) { + return -ENOMEM; + } + + data->attrs = &models_attr; + data->fan_num = FAN_MAX_NUMBER; + mutex_init(&data->update_lock); + data->dev = dev; + dev_info(dev, "chip found\n"); + + + status = _add_attributes(client, data); + if (status) { + return status; + } + + if (!data->num_attributes) { + dev_err(&client->dev, "No attributes found\n"); + return -ENODEV; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &data->group); + if (status) { + goto out_kfree; + } + + data->hwmon_dev = hwmon_device_register_with_info(&client->dev, + client->name, NULL, NULL, NULL); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_rm_sys; + } + + i2c_set_clientdata(client, data); + dev_info(dev, "%s: cpld '%s'\n", + dev_name(data->dev), client->name); + + return 0; + +exit_rm_sys: + sysfs_remove_group(&client->dev.kobj, &data->group); +out_kfree: + kfree(data->group.attrs); + return status; +} + + +static int fan_remove(struct i2c_client *client) +{ + struct fan_data_t *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &data->group); + kfree(data->group.attrs); + return 0; +} + + +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +static struct i2c_driver as7315_i2c_fan_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = DRV_NAME, + }, + .probe = fan_probe, + .remove = fan_remove, + .id_table = as7315_fan_id, + .address_list = normal_i2c, +}; + +static int __init accton_as7315_27xb_fan_init(void) +{ + return i2c_add_driver(&as7315_i2c_fan_driver); +} + +static void __exit accton_as7315_27xb_fan_exit(void) +{ + i2c_del_driver(&as7315_i2c_fan_driver); +} + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton_as7315_27xb_fan driver"); +MODULE_LICENSE("GPL"); + +module_init(accton_as7315_27xb_fan_init); +module_exit(accton_as7315_27xb_fan_exit); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/at24_as7315_27xb.c b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/at24_as7315_27xb.c new file mode 100755 index 000000000000..8d8c7601a71d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/at24_as7315_27xb.c @@ -0,0 +1,695 @@ +/* + * at24_as7315_27xb.c - handle most I2C EEPROMs for ethernet switch, as7315_27xb. + * + * Copyright (C) 2005-2007 David Brownell + * Copyright (C) 2008 Wolfram Sang, Pengutronix + * Copyright (C) 2019 Roy Lee, EdgeCore network. + * Revised to support specially I2C transactions, pure READ and WRITE. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +/* + * I2C EEPROMs from most vendors are inexpensive and mostly interchangeable. + * Differences between different vendor product lines (like Atmel AT24C or + * MicroChip 24LC, etc) won't much matter for typical read/write access. + * There are also I2C RAM chips, likewise interchangeable. One example + * would be the PCF8570, which acts like a 24c02 EEPROM (256 bytes). + * + * However, misconfiguration can lose data. "Set 16-bit memory address" + * to a part with 8-bit addressing will overwrite data. Writing with too + * big a page size also loses data. And it's not safe to assume that the + * conventional addresses 0x50..0x57 only hold eeproms; a PCF8563 RTC + * uses 0x51, for just one example. + * + * Accordingly, explicit board-specific configuration data should be used + * in almost all cases. (One partial exception is an SMBus used to access + * "SPD" data for DRAM sticks. Those only use 24c02 EEPROMs.) + * + * So this driver uses "new style" I2C driver binding, expecting to be + * told what devices exist. That may be in arch/X/mach-Y/board-Z.c or + * similar kernel-resident tables; or, configuration data coming from + * a bootloader. + * + * Other than binding model, current differences from "eeprom" driver are + * that this one handles write access and isn't restricted to 24c02 devices. + * It also handles larger devices (32 kbit and up) with two-byte addresses, + * which won't work on pure SMBus systems. + */ + +struct at24_data { + struct at24_platform_data chip; + int use_smbus; + int use_smbus_write; + + ssize_t (*read_func)(struct at24_data *, char *, unsigned int, size_t); + ssize_t (*write_func)(struct at24_data *, + const char *, unsigned int, size_t); + + /* + * Lock protects against activities from other Linux tasks, + * but not from changes by other I2C masters. + */ + struct mutex lock; + + u8 *writebuf; + unsigned write_max; + unsigned num_addresses; + + struct nvmem_config nvmem_config; + struct nvmem_device *nvmem; + + /* + * Some chips tie up multiple I2C addresses; dummy devices reserve + * them for us, and we'll use them with SMBus calls. + */ + struct i2c_client *client[]; +}; + +/* + * This parameter is to help this driver avoid blocking other drivers out + * of I2C for potentially troublesome amounts of time. With a 100 kHz I2C + * clock, one 256 byte read takes about 1/43 second which is excessive; + * but the 1/170 second it takes at 400 kHz may be quite reasonable; and + * at 1 MHz (Fm+) a 1/430 second delay could easily be invisible. + * + * This value is forced to be a power of two so that writes align on pages. + */ +static unsigned io_limit = 128; +module_param(io_limit, uint, 0); +MODULE_PARM_DESC(io_limit, "Maximum bytes per I/O (default 128)"); + +/* + * Specs often allow 5 msec for a page write, sometimes 20 msec; + * it's important to recover from write timeouts. + */ +static unsigned write_timeout = 25; +module_param(write_timeout, uint, 0); +MODULE_PARM_DESC(write_timeout, "Time (in ms) to try writes (default 25)"); + +#define AT24_SIZE_BYTELEN 5 +#define AT24_SIZE_FLAGS 8 + +#define AT24_BITMASK(x) (BIT(x) - 1) + +/* create non-zero magic value for given eeprom parameters */ +#define AT24_DEVICE_MAGIC(_len, _flags) \ + ((1 << AT24_SIZE_FLAGS | (_flags)) \ + << AT24_SIZE_BYTELEN | ilog2(_len)) + +/* + * Both reads and writes fail if the previous write didn't complete yet. This + * macro loops a few times waiting at least long enough for one entire page + * write to work while making sure that at least one iteration is run before + * checking the break condition. + * + * It takes two parameters: a variable in which the future timeout in jiffies + * will be stored and a temporary variable holding the time of the last + * iteration of processing the request. Both should be unsigned integers + * holding at least 32 bits. + */ +#define loop_until_timeout(tout, op_time) \ + for (tout = jiffies + msecs_to_jiffies(write_timeout), op_time = 0; \ + op_time ? time_before(op_time, tout) : true; \ + usleep_range(1000, 1500), op_time = jiffies) + +static const struct i2c_device_id at24_ids[] = { + { "24cxb04", AT24_DEVICE_MAGIC(4096 / 8, AT24_FLAG_ADDR16) }, + { "24cxb08", AT24_DEVICE_MAGIC(8192 / 8, AT24_FLAG_ADDR16) }, + { "24cxb16", AT24_DEVICE_MAGIC(16384 / 8, AT24_FLAG_ADDR16) }, + { "24cxb32", AT24_DEVICE_MAGIC(32768 / 8, AT24_FLAG_ADDR16) }, + { "24cxb64", AT24_DEVICE_MAGIC(65536 / 8, AT24_FLAG_ADDR16) }, + { "at24", 0 }, + { /* END OF LIST */ } +}; +MODULE_DEVICE_TABLE(i2c, at24_ids); + +static const struct acpi_device_id at24_acpi_ids[] = { + { "INT3499", AT24_DEVICE_MAGIC(8192 / 8, 0) }, + { } +}; +MODULE_DEVICE_TABLE(acpi, at24_acpi_ids); + +/*-------------------------------------------------------------------------*/ + +/* + * This routine supports chips which consume multiple I2C addresses. It + * computes the addressing information to be used for a given r/w request. + * Assumes that sanity checks for offset happened at sysfs-layer. + * + * Slave address and byte offset derive from the offset. Always + * set the byte address; on a multi-master board, another master + * may have changed the chip's "current" address pointer. + * + * REVISIT some multi-address chips don't rollover page reads to + * the next slave address, so we may need to truncate the count. + * Those chips might need another quirk flag. + * + * If the real hardware used four adjacent 24c02 chips and that + * were misconfigured as one 24c08, that would be a similar effect: + * one "eeprom" file not four, but larger reads would fail when + * they crossed certain pages. + */ +static struct i2c_client *at24_translate_offset(struct at24_data *at24, + unsigned int *offset) +{ + unsigned i; + + /*Always AT24_FLAG_ADDR16*/ + i = *offset >> 16; + *offset &= 0xffff; + + return at24->client[i]; +} + +static ssize_t at24_eeprom_read_smbus(struct at24_data *at24, char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, read_time; + struct i2c_client *client; + int status; + client = at24_translate_offset(at24, &offset); + + if (count > io_limit) + count = io_limit; + + loop_until_timeout(timeout, read_time) { +/* + status = i2c_smbus_read_i2c_block_data_or_emulated(client, + offset, + count, buf); + + dev_dbg(&client->dev, "read %zu@%d --> %d (%ld)\n", + count, offset, status, jiffies); +*/ + int i=0; + + /*Write 2-byte offset*/ + unsigned char bb = offset&0xff; + status = i2c_smbus_write_i2c_block_data(client, offset>>8, 1, &bb); + if (status < 0) { + return status; + } + + while (i < count) { + status = i2c_smbus_read_byte(client); + if (status < 0) { + return status; + } + buf[i] = status; + i++; + } + + + if (i == count) + return count; + } + + return -ETIMEDOUT; +} + +/* + * Note that if the hardware write-protect pin is pulled high, the whole + * chip is normally write protected. But there are plenty of product + * variants here, including OTP fuses and partial chip protect. + * + * We only use page mode writes; the alternative is sloooow. These routines + * write at most one page. + */ + +static size_t at24_adjust_write_count(struct at24_data *at24, + unsigned int offset, size_t count) +{ + unsigned next_page; + + /* write_max is at most a page */ + if (count > at24->write_max) + count = at24->write_max; + + /* Never roll over backwards, to the start of this page */ + next_page = roundup(offset + 1, at24->chip.page_size); + if (offset + count > next_page) + count = next_page - offset; + + return count; +} + +static ssize_t at24_eeprom_write_smbus_block(struct at24_data *at24, + const char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, write_time; + struct i2c_client *client; + ssize_t status = 0; + + client = at24_translate_offset(at24, &offset); + count = at24_adjust_write_count(at24, offset, count); + + loop_until_timeout(timeout, write_time) { + status = i2c_smbus_write_i2c_block_data(client, + offset, count, buf); + if (status == 0) + status = count; + + dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + + return -ETIMEDOUT; +} + +static ssize_t at24_eeprom_write_smbus_byte(struct at24_data *at24, + const char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, write_time; + struct i2c_client *client; + ssize_t status = 0; + + client = at24_translate_offset(at24, &offset); + + loop_until_timeout(timeout, write_time) { + status = i2c_smbus_write_byte_data(client, offset, buf[0]); + if (status == 0) + status = count; + + dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + + return -ETIMEDOUT; +} + +static ssize_t at24_eeprom_write_i2c(struct at24_data *at24, const char *buf, + unsigned int offset, size_t count) +{ + unsigned long timeout, write_time; + struct i2c_client *client; + struct i2c_msg msg; + ssize_t status = 0; + int i = 0; + + client = at24_translate_offset(at24, &offset); + count = at24_adjust_write_count(at24, offset, count); + + msg.addr = client->addr; + msg.flags = 0; + + /* msg.buf is u8 and casts will mask the values */ + msg.buf = at24->writebuf; + if (at24->chip.flags & AT24_FLAG_ADDR16) + msg.buf[i++] = offset >> 8; + + msg.buf[i++] = offset; + memcpy(&msg.buf[i], buf, count); + msg.len = i + count; + + loop_until_timeout(timeout, write_time) { + status = i2c_transfer(client->adapter, &msg, 1); + if (status == 1) + status = count; + + dev_dbg(&client->dev, "write %zu@%d --> %zd (%ld)\n", + count, offset, status, jiffies); + + if (status == count) + return count; + } + + return -ETIMEDOUT; +} + +static int at24_read(void *priv, unsigned int off, void *val, size_t count) +{ + struct at24_data *at24 = priv; + char *buf = val; + + + + if (unlikely(!count)) + return count; + + if (off + count > at24->chip.byte_len) + return -EINVAL; + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&at24->lock); + + while (count) { + int status; + + status = at24->read_func(at24, buf, off, count); + if (status < 0) { + mutex_unlock(&at24->lock); + return status; + } + buf += status; + off += status; + count -= status; + } + + mutex_unlock(&at24->lock); + + return 0; +} + +static int at24_write(void *priv, unsigned int off, void *val, size_t count) +{ + struct at24_data *at24 = priv; + char *buf = val; + + if (unlikely(!count)) + return -EINVAL; + + if (off + count > at24->chip.byte_len) + return -EINVAL; + + /* + * Write data to chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&at24->lock); + + while (count) { + int status; + + status = at24->write_func(at24, buf, off, count); + if (status < 0) { + mutex_unlock(&at24->lock); + return status; + } + buf += status; + off += status; + count -= status; + } + + mutex_unlock(&at24->lock); + + return 0; +} + +#ifdef CONFIG_OF +static void at24_get_ofdata(struct i2c_client *client, + struct at24_platform_data *chip) +{ + const __be32 *val; + struct device_node *node = client->dev.of_node; + + if (node) { + if (of_get_property(node, "read-only", NULL)) + chip->flags |= AT24_FLAG_READONLY; + val = of_get_property(node, "pagesize", NULL); + if (val) + chip->page_size = be32_to_cpup(val); + } +} +#else +static void at24_get_ofdata(struct i2c_client *client, + struct at24_platform_data *chip) +{ } +#endif /* CONFIG_OF */ + +static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id) +{ + struct at24_platform_data chip; + kernel_ulong_t magic = 0; + bool writable; + int use_smbus = 0; + int use_smbus_write = 0; + struct at24_data *at24; + int err; + unsigned i, num_addresses; + + if (client->dev.platform_data) { + chip = *(struct at24_platform_data *)client->dev.platform_data; + } else { + if (id) { + magic = id->driver_data; + } else { + const struct acpi_device_id *aid; + + aid = acpi_match_device(at24_acpi_ids, &client->dev); + if (aid) + magic = aid->driver_data; + } + if (!magic) + return -ENODEV; + + chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN)); + magic >>= AT24_SIZE_BYTELEN; + chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS); + /* + * This is slow, but we can't know all eeproms, so we better + * play safe. Specifying custom eeprom-types via platform_data + * is recommended anyhow. + */ + chip.page_size = 1; + + /* update chipdata if OF is present */ + at24_get_ofdata(client, &chip); + + chip.setup = NULL; + chip.context = NULL; + } + + if (!is_power_of_2(chip.byte_len)) + dev_warn(&client->dev, + "byte_len looks suspicious (no power of 2)!\n"); + if (!chip.page_size) { + dev_err(&client->dev, "page_size must not be 0!\n"); + return -EINVAL; + } + if (!is_power_of_2(chip.page_size)) + dev_warn(&client->dev, + "page_size looks suspicious (no power of 2)!\n"); + + /* + * REVISIT: the size of the EUI-48 byte array is 6 in at24mac402, while + * the call to ilog2() in AT24_DEVICE_MAGIC() rounds it down to 4. + * + * Eventually we'll get rid of the magic values altoghether in favor of + * real structs, but for now just manually set the right size. + */ + if (chip.flags & AT24_FLAG_MAC && chip.byte_len == 4) + chip.byte_len = 6; + + /* Use I2C operations unless we're stuck with SMBus extensions. */ + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { + /*if (chip.flags & AT24_FLAG_ADDR16){ + return -EPFNOSUPPORT; + }*/ + if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { + use_smbus = I2C_SMBUS_I2C_BLOCK_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_WORD_DATA)) { + use_smbus = I2C_SMBUS_WORD_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_READ_BYTE_DATA)) { + use_smbus = I2C_SMBUS_BYTE_DATA; + } else { + return -EPFNOSUPPORT; + } + + if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)) { + use_smbus_write = I2C_SMBUS_I2C_BLOCK_DATA; + } else if (i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) { + use_smbus_write = I2C_SMBUS_BYTE_DATA; + chip.page_size = 1; + } + } + + if (chip.flags & AT24_FLAG_TAKE8ADDR) + num_addresses = 8; + else + num_addresses = DIV_ROUND_UP(chip.byte_len, + (chip.flags & AT24_FLAG_ADDR16) ? 65536 : 256); + + at24 = devm_kzalloc(&client->dev, sizeof(struct at24_data) + + num_addresses * sizeof(struct i2c_client *), GFP_KERNEL); + if (!at24) + return -ENOMEM; + + mutex_init(&at24->lock); + at24->use_smbus = use_smbus; + at24->use_smbus_write = use_smbus_write; + at24->chip = chip; + at24->num_addresses = num_addresses; + + if ((chip.flags & AT24_FLAG_SERIAL) && (chip.flags & AT24_FLAG_MAC)) { + dev_err(&client->dev, + "invalid device data - cannot have both AT24_FLAG_SERIAL & AT24_FLAG_MAC."); + return -EINVAL; + } + at24->read_func = at24_eeprom_read_smbus; + + if (at24->use_smbus) { + if (at24->use_smbus_write == I2C_SMBUS_I2C_BLOCK_DATA) + at24->write_func = at24_eeprom_write_smbus_block; + else + at24->write_func = at24_eeprom_write_smbus_byte; + } else { + at24->write_func = at24_eeprom_write_i2c; + } + + writable = !(chip.flags & AT24_FLAG_READONLY); + if (writable) { + if (!use_smbus || use_smbus_write) { + + unsigned write_max = chip.page_size; + + if (write_max > io_limit) + write_max = io_limit; + if (use_smbus && write_max > I2C_SMBUS_BLOCK_MAX) + write_max = I2C_SMBUS_BLOCK_MAX; + at24->write_max = write_max; + + /* buffer (data + address at the beginning) */ + at24->writebuf = devm_kzalloc(&client->dev, + write_max + 2, GFP_KERNEL); + if (!at24->writebuf) + return -ENOMEM; + } else { + dev_warn(&client->dev, + "cannot write due to controller restrictions."); + } + } + + at24->client[0] = client; + + /* use dummy devices for multiple-address chips */ + for (i = 1; i < num_addresses; i++) { + at24->client[i] = i2c_new_dummy(client->adapter, + client->addr + i); + if (!at24->client[i]) { + dev_err(&client->dev, "address 0x%02x unavailable\n", + client->addr + i); + err = -EADDRINUSE; + goto err_clients; + } + } + + i2c_set_clientdata(client, at24); + at24->nvmem_config.name = dev_name(&client->dev); + at24->nvmem_config.dev = &client->dev; + at24->nvmem_config.read_only = !writable; + at24->nvmem_config.root_only = true; + at24->nvmem_config.owner = THIS_MODULE; + at24->nvmem_config.compat = true; + at24->nvmem_config.base_dev = &client->dev; + at24->nvmem_config.reg_read = at24_read; + at24->nvmem_config.reg_write = at24_write; + at24->nvmem_config.priv = at24; + at24->nvmem_config.stride = 1; + at24->nvmem_config.word_size = 1; + at24->nvmem_config.size = chip.byte_len; + + at24->nvmem = nvmem_register(&at24->nvmem_config); + + if (IS_ERR(at24->nvmem)) { + err = PTR_ERR(at24->nvmem); + goto err_clients; + } + + dev_info(&client->dev, "%u byte %s EEPROM, %s, %u bytes/write\n", + chip.byte_len, client->name, + writable ? "writable" : "read-only", at24->write_max); + if (use_smbus == I2C_SMBUS_WORD_DATA || + use_smbus == I2C_SMBUS_BYTE_DATA) { + dev_notice(&client->dev, "Falling back to %s reads, " + "performance will suffer\n", use_smbus == + I2C_SMBUS_WORD_DATA ? "word" : "byte"); + } + + /* export data to kernel code */ + if (chip.setup) + chip.setup(at24->nvmem, chip.context); + + return 0; + +err_clients: + for (i = 1; i < num_addresses; i++) + if (at24->client[i]) + i2c_unregister_device(at24->client[i]); + + return err; +} + +static int at24_remove(struct i2c_client *client) +{ + struct at24_data *at24; + int i; + + at24 = i2c_get_clientdata(client); + + nvmem_unregister(at24->nvmem); + + for (i = 1; i < at24->num_addresses; i++) + i2c_unregister_device(at24->client[i]); + + return 0; +} + +/*-------------------------------------------------------------------------*/ + +static struct i2c_driver at24_as7315_27xb_driver = { + .driver = { + .name = "at24_as7315_27xb", + .acpi_match_table = ACPI_PTR(at24_acpi_ids), + }, + .probe = at24_probe, + .remove = at24_remove, + .id_table = at24_ids, +}; + +static int __init at24_as7315_27xb_init(void) +{ + if (!io_limit) { + pr_err("at24_as7315_27xb: io_limit must not be 0!\n"); + return -EINVAL; + } + + io_limit = rounddown_pow_of_two(io_limit); + return i2c_add_driver(&at24_as7315_27xb_driver); +} +module_init(at24_as7315_27xb_init); + +static void __exit at24_as7315_27xb_exit(void) +{ + i2c_del_driver(&at24_as7315_27xb_driver); +} +module_exit(at24_as7315_27xb_exit); + +MODULE_DESCRIPTION("Driver for I2C EEPROMs on accton switch, as7315_27xb"); +MODULE_AUTHOR("Roy Lee"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/x86-64-accton-as7315-27xb-cpld.c b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/x86-64-accton-as7315-27xb-cpld.c new file mode 100755 index 000000000000..dcd604f1f61b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/x86-64-accton-as7315-27xb-cpld.c @@ -0,0 +1,1008 @@ +/* + * A hwmon driver for the as7315_i2c_cpld + * + * Copyright (C) 2019 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define DRV_NAME "as7315_i2c_cpld" +#define NUM_SFP 24 +#define NUM_QSFP 3 +#define NUM_ALL_PORTS 27 + +#define SFP_1ST_PRST_REG 0x10 +#define QSFP_1ST_PRST_REG 0x18 + +#define SFP_1ST_RXLOS_REG 0x13 +#define MUX_CHANNEL_SELECT_REG 0x80 + + +enum models { + MDL_CPLD_SFP, + MDL_CPLD_QSFP, + PLAIN_CPLD, /*No attribute but add i2c addr to the list.*/ + NUM_MODEL +}; + + +#define MAX_PORT_NUM 64 +#define I2C_RW_RETRY_COUNT 10 +#define I2C_RW_RETRY_INTERVAL 60 /* ms */ + +/* + * Number of additional attribute pointers to allocate + * with each call to krealloc + */ +#define ATTR_ALLOC_SIZE 1 /*For last attribute which is NUll.*/ + +#define NAME_SIZE 24 + +typedef ssize_t (*show_func)( struct device *dev, + struct device_attribute *attr, + char *buf); +typedef ssize_t (*store_func)(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count); + +enum port_type { + PT_SFP, + PT_QSFP, +}; + +enum common_attrs { + CMN_VERSION, + CMN_ACCESS, + CMN_PRESENT_ALL, + CMN_RXLOS_ALL, + NUM_COMMON_ATTR +}; + +enum sfp_sb_attrs { + SFP_PRESENT, + SFP_RESET, + SFP_TX_DIS, + SFP_TX_FAULT, + SFP_RX_LOS, + QSFP_PRESENT, + QSFP_LP_MODE, + NUM_SFP_SB_ATTR +}; + +struct cpld_sensor { + struct cpld_sensor *next; + char name[NAME_SIZE+1]; /* sysfs sensor name */ + struct device_attribute attribute; + bool update; /* runtime sensor update needed */ + int data; /* Sensor data. Negative if there was a read error */ + + u8 reg; /* register */ + u8 mask; /* bit mask */ + bool invert; /* inverted value*/ + +}; + +#define to_cpld_sensor(_attr) \ + container_of(_attr, struct cpld_sensor, attribute) + +struct cpld_data { + struct device *dev; + struct device *hwmon_dev; + + int num_attributes; + struct attribute_group group; + + enum models model; + struct cpld_sensor *sensors; + struct mutex update_lock; + bool valid; + unsigned long last_updated; /* in jiffies */ + + int attr_index; + u16 sfp_num; + u8 sfp_types; + struct model_attrs *attrs; + + /*For mux function*/ + struct i2c_mux_core *muxc; +}; + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; + + +struct base_attrs { + const char *name; + umode_t mode; + show_func get; + store_func set; +}; + +struct attrs { + int reg; + bool invert; + struct base_attrs *base; +}; + +struct model_attrs { + struct attrs **cmn; + struct attrs **portly; +}; + + +static ssize_t show_bit(struct device *dev, + struct device_attribute *devattr, char *buf); +static ssize_t show_rxlos_all(struct device *dev, + struct device_attribute *devattr, char *buf); +static ssize_t show_presnet_all(struct device *dev, + struct device_attribute *devattr, char *buf); +static ssize_t set_1bit(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t set_byte(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); +static ssize_t access(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); + +int accton_i2c_cpld_read(u8 cpld_addr, u8 reg); +int accton_i2c_cpld_write(u8 cpld_addr, u8 reg, u8 value); + + +struct base_attrs common_base_attrs[NUM_COMMON_ATTR] = +{ + [CMN_VERSION] = {"version", S_IRUGO, show_bit, NULL}, + [CMN_ACCESS] = {"access", S_IWUSR, NULL, set_byte}, + [CMN_PRESENT_ALL] = {"module_present_all", S_IRUGO, show_presnet_all, NULL}, + [CMN_RXLOS_ALL] = {"rx_los_all", S_IRUGO, show_rxlos_all, NULL}, +}; + +struct attrs common_attrs[] = { + [CMN_VERSION] = {0x01, false, &common_base_attrs[CMN_VERSION]}, + [CMN_ACCESS] = {-1, false, &common_base_attrs[CMN_ACCESS]}, + [CMN_PRESENT_ALL] = {-1, false, &common_base_attrs[CMN_PRESENT_ALL]}, + [CMN_RXLOS_ALL] = {-1, false, &common_base_attrs[CMN_RXLOS_ALL]}, +}; +struct attrs plain_common[] = { + [CMN_VERSION] = {0x01, false, &common_base_attrs[CMN_VERSION]}, +}; + +struct base_attrs portly_attrs[] = +{ + [SFP_PRESENT] = {"present", S_IRUGO, show_bit, NULL}, + [SFP_RESET] = {0}, + [SFP_TX_DIS] = {"tx_disable", S_IRUGO|S_IWUSR, show_bit, set_1bit}, + [SFP_TX_FAULT] = {"tx_fault", S_IRUGO|S_IWUSR, show_bit, set_1bit}, + [SFP_RX_LOS] = {"rx_los", S_IRUGO|S_IWUSR, show_bit, set_1bit}, + [QSFP_PRESENT] = {"present", S_IRUGO, show_bit, NULL}, + [QSFP_LP_MODE] = {"low_power_mode", S_IRUGO|S_IWUSR, show_bit, set_1bit}, +}; + +struct attrs as7315_port[NUM_SFP_SB_ATTR] = { + {SFP_1ST_PRST_REG, true, &portly_attrs[SFP_PRESENT]}, + {0}, + {0x12, false, &portly_attrs[SFP_TX_DIS]}, + {0x11, false, &portly_attrs[SFP_TX_FAULT]}, + {SFP_1ST_RXLOS_REG, false, &portly_attrs[SFP_RX_LOS]}, + {QSFP_1ST_PRST_REG, true, &portly_attrs[QSFP_PRESENT]}, + {0x19, false, &portly_attrs[QSFP_LP_MODE]}, +}; + +struct attrs *as7315_cmn_list[] = { + &common_attrs[CMN_VERSION], + &common_attrs[CMN_ACCESS], + &common_attrs[CMN_PRESENT_ALL], + &common_attrs[CMN_RXLOS_ALL], + NULL +}; + +struct attrs *plain_cmn_list[] = { + &plain_common[CMN_VERSION], + NULL +}; + +struct attrs *as7315_qsfp_list[] = { + &as7315_port[QSFP_PRESENT], + &as7315_port[QSFP_LP_MODE], + NULL +}; + +struct attrs *as7315_sfp_list[] = { + &as7315_port[SFP_PRESENT], + &as7315_port[SFP_TX_DIS], + &as7315_port[SFP_TX_FAULT], + &as7315_port[SFP_RX_LOS], + NULL +}; + +struct model_attrs models_attr[NUM_MODEL] = { + {.cmn = as7315_cmn_list, .portly=as7315_sfp_list}, + {.cmn = as7315_cmn_list, .portly=as7315_qsfp_list}, + {.cmn = plain_cmn_list, .portly=NULL}, +}; + +static LIST_HEAD(cpld_client_list); +static struct mutex list_lock; +/* Addresses scanned for as7315_i2c_cpld + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +struct chip_desc { + u8 nchans; + u8 deselectChan; +}; + +/* Provide specs for the PCA954x types we know about */ +static const struct chip_desc chips[] = { + [MDL_CPLD_SFP] = {0}, + [MDL_CPLD_QSFP] = { + .nchans = 4, /*Fan + 3*LM75*/ + .deselectChan = 0, + }, +}; + +static const struct i2c_device_id as7315_cpld_id[] = { + { "as7315_cpld1", MDL_CPLD_SFP}, + { "as7315_cpld2", MDL_CPLD_QSFP}, + { }, +}; +MODULE_DEVICE_TABLE(i2c, as7315_cpld_id); + + + + +static int get_sfp_spec(int model, u16 *num, u8 *types) +{ + switch (model) { + case MDL_CPLD_SFP: + *num = NUM_SFP; + *types = PT_SFP; + break; + case MDL_CPLD_QSFP: + *num = NUM_QSFP; + *types = PT_QSFP; + break; + default: + *types = 0; + *num = 0; + break; + } + + return 0; +} + +/*num: how many bits can be applied for this read.*/ +static int get_present_reg(int model, u8 port, u8 *reg, u8 *num) +{ + + switch (model) { + case MDL_CPLD_SFP: + if (port < NUM_SFP) { + *reg = SFP_1ST_PRST_REG + (port/8)*4; + *num = (NUM_SFP > 8)? 8 : NUM_SFP; + return 0; + } + break; + case MDL_CPLD_QSFP: + if (port < NUM_QSFP) { + *reg = QSFP_1ST_PRST_REG + (port/8); + *num = (NUM_QSFP > 8)? 8 : NUM_QSFP; + return 0; + } + break; + default: + return -EINVAL; + } + return -EINVAL; +} + +static int get_rxlos_reg(int model, u8 port, u8 *reg, u8 *num) +{ + + switch (model) { + case MDL_CPLD_SFP: + if (port < NUM_SFP) { + *reg = SFP_1ST_RXLOS_REG + (port/8)*4; + *num = (NUM_SFP > 8)? 8 : NUM_SFP; + return 0; + } + break; + default: + return -EINVAL; + } + return -EINVAL; +} + +static int cpld_write_internal( + struct i2c_client *client, u8 reg, u8 value) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_write_byte_data(client, reg, value); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + break; + } + return status; +} + +static int cpld_read_internal(struct i2c_client *client, u8 reg) +{ + int status = 0, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_read_byte_data(client, reg); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + break; + } + return status; +} + +static ssize_t show_rxlos_all(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 i, value, reg, num; + u64 values; + + i = num = reg =0; + values = 0; + mutex_lock(&data->update_lock); + while (i < data->sfp_num) + { + /*No rxlos for QSFP*/ + if (data->model == MDL_CPLD_QSFP) { + values = 0; + break; + } + get_rxlos_reg(data->model, i, ®, &num); + if (!(num > 0)) + { + value = -EINVAL; + goto exit; + } + value = cpld_read_internal(client, reg); + if (unlikely(value < 0)) { + goto exit; + } + values |= (value &((1<<(num))-1)) << i; + i += num; + } + mutex_unlock(&data->update_lock); + values = cpu_to_le64(values); + return snprintf(buf, sizeof(values)+1, "%llx\n", values); +exit: + mutex_unlock(&data->update_lock); + return value; +} + + +static ssize_t show_presnet_all(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + u8 i, value, reg, num; + u64 values; + + i = num = reg =0; + values = 0; + mutex_lock(&data->update_lock); + while (i < data->sfp_num) + { + get_present_reg(data->model, i, ®, &num); + if (!(num > 0)) + { + value = -EINVAL; + goto exit; + } + value = cpld_read_internal(client, reg); + if (unlikely(value < 0)) { + goto exit; + } + values |= (~value&((1<<(num))-1)) << i; + i += num; + } + mutex_unlock(&data->update_lock); + values = cpu_to_le64(values); + return snprintf(buf, sizeof(values)+1, "%llx\n", values); +exit: + mutex_unlock(&data->update_lock); + return value; +} + +static ssize_t show_bit(struct device *dev, + struct device_attribute *devattr, char *buf) +{ + int value; + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + struct cpld_sensor *sensor = to_cpld_sensor(devattr); + + mutex_lock(&data->update_lock); + value = cpld_read_internal(client, sensor->reg); + value = value & sensor->mask; + if (sensor->invert) + value = !value; + mutex_unlock(&data->update_lock); + + return snprintf(buf, PAGE_SIZE, "%x\n", !!value); +} + +static ssize_t set_1bit(struct device *dev, struct device_attribute *devattr, + const char *buf, size_t count) +{ + long is_reset; + int value, status; + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + struct cpld_sensor *sensor = to_cpld_sensor(devattr); + u8 cpld_bit, reg; + + status = kstrtol(buf, 10, &is_reset); + if (status) { + return status; + } + reg = sensor->reg; + cpld_bit = sensor->mask; + mutex_lock(&data->update_lock); + value = cpld_read_internal(client, reg); + if (unlikely(status < 0)) { + goto exit; + } + + if (sensor->invert) + is_reset = !is_reset; + + if (is_reset) { + value |= cpld_bit; + } + else { + value &= ~cpld_bit; + } + + status = cpld_write_internal(client, reg, value); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static ssize_t set_byte(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + return access(dev, da, buf, count); +} + +static ssize_t access(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int status; + u32 addr, val; + struct i2c_client *client = to_i2c_client(dev); + struct cpld_data *data = i2c_get_clientdata(client); + + if (sscanf(buf, "0x%x 0x%x", &addr, &val) != 2) { + return -EINVAL; + } + + if (addr > 0xFF || val > 0xFF) { + return -EINVAL; + } + + mutex_lock(&data->update_lock); + status = cpld_write_internal(client, addr, val); + if (unlikely(status < 0)) { + goto exit; + } + mutex_unlock(&data->update_lock); + return count; + +exit: + mutex_unlock(&data->update_lock); + return status; +} + +static void accton_i2c_cpld_add_client(struct i2c_client *client) +{ + struct cpld_client_node *node = + kzalloc(sizeof(struct cpld_client_node), GFP_KERNEL); + + if (!node) { + dev_dbg(&client->dev, "Can't allocate cpld_client_node (0x%x)\n", + client->addr); + return; + } + node->client = client; + + mutex_lock(&list_lock); + list_add(&node->list, &cpld_client_list); + mutex_unlock(&list_lock); +} + +static void accton_i2c_cpld_remove_client(struct i2c_client *client) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int found = 0; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client == client) { + found = 1; + break; + } + } + + if (found) { + list_del(list_node); + kfree(cpld_node); + } + + mutex_unlock(&list_lock); +} + +static int cpld_add_attribute(struct cpld_data *data, struct attribute *attr) +{ + int new_max_attrs = ++data->num_attributes + ATTR_ALLOC_SIZE; + void *new_attrs = krealloc(data->group.attrs, + new_max_attrs * sizeof(void *), + GFP_KERNEL); + if (!new_attrs) + return -ENOMEM; + data->group.attrs = new_attrs; + data->group.attrs[data->num_attributes-1] = attr; + data->group.attrs[data->num_attributes] = NULL; + + return 0; +} + +static void cpld_dev_attr_init(struct device_attribute *dev_attr, + const char *name, umode_t mode, + show_func show, store_func store) +{ + sysfs_attr_init(&dev_attr->attr); + dev_attr->attr.name = name; + dev_attr->attr.mode = mode; + dev_attr->show = show; + dev_attr->store = store; +} + +static struct cpld_sensor * add_sensor(struct cpld_data *data, + const char *name, + u8 reg, u8 mask, bool invert, + bool update, umode_t mode, + show_func get, store_func set) +{ + struct cpld_sensor *sensor; + struct device_attribute *a; + + sensor = devm_kzalloc(data->dev, sizeof(*sensor), GFP_KERNEL); + if (!sensor) + return NULL; + a = &sensor->attribute; + + snprintf(sensor->name, sizeof(sensor->name), name); + sensor->reg = reg; + sensor->mask = mask; + sensor->update = update; + sensor->invert = invert; + cpld_dev_attr_init(a, sensor->name, + mode, + get, set); + + if (cpld_add_attribute(data, &a->attr)) + return NULL; + + sensor->next = data->sensors; + data->sensors = sensor; + + return sensor; +} + +static int add_attributes_cmn(struct cpld_data *data, struct attrs **cmn) +{ + u8 reg, i ; + bool invert; + struct attrs *a; + struct base_attrs *b; + + if (NULL == cmn) + return -1; + + for (i = 0; cmn[i]; i++) + { + a = cmn[i]; + + reg = a->reg; + invert = a->invert; + + b = a->base; + if (NULL == b) + break; + + if (add_sensor(data, b->name, + reg, 0xff, invert, + true, b->mode, + b->get, b->set) == NULL) + { + return -ENOMEM; + } + } + return 0; +} + +static int add_attributes_portly(struct cpld_data *data, struct attrs **pa) +{ + char name[NAME_SIZE+1]; + int i, j; + u8 reg, mask, invert, reg_start, jump; + struct attrs *a; + struct base_attrs *b; + + if (NULL == pa) + return -EFAULT; + + jump = 0; + if (data->sfp_types == PT_SFP) { + jump = 4; /*SFP sideband registers in set of 4 bytes.*/ + } else if (data->sfp_types == PT_QSFP) { + jump = 1; + } + + for (i = 0; pa[i]; i++) { + a = pa[i]; + reg_start = a->reg; + invert = a->invert; + b = a->base; + if (b == NULL) + break; + + for (j = 0; j < data->sfp_num; j++) + { + snprintf(name, NAME_SIZE, "%s_%d", b->name, j+1); + reg = reg_start + ((j/8)*jump); + mask = 1 << ((j)%8); + if (add_sensor(data, name, reg, mask, invert, + true, b->mode, b->get, b->set) == NULL) + { + return -ENOMEM; + } + } + } + + + return 0; +} + +static int add_attributes(struct i2c_client *client, + struct cpld_data *data) +{ + struct model_attrs *m = data->attrs; + + if (m == NULL) + return -EINVAL; + + /* Common attributes.*/ + add_attributes_cmn(data, m->cmn); + + /* Port-wise attributes.*/ + add_attributes_portly(data, m->portly); + + return 0; +} + +/* Write to mux register. Don't use i2c_transfer()/i2c_smbus_xfer() + for this as they will try to lock adapter a second time */ +static int _cpld_mux_reg_write(struct i2c_adapter *adap, + struct i2c_client *client, u8 val) +{ + unsigned long orig_jiffies; + unsigned short flags; + union i2c_smbus_data data; + int try; + s32 res = -EIO; + + data.byte = val; + flags = client->flags; + flags &= ~(I2C_M_TEN | I2C_CLIENT_PEC); + + if (adap->algo->smbus_xfer) { + /* Retry automatically on arbitration loss */ + orig_jiffies = jiffies; + for (res = 0, try = 0; try <= adap->retries; try++) { + res = adap->algo->smbus_xfer(adap, client->addr, flags, + I2C_SMBUS_WRITE, MUX_CHANNEL_SELECT_REG, + I2C_SMBUS_BYTE_DATA, &data); + if (res != -EAGAIN) + break; + if (time_after(jiffies, + orig_jiffies + adap->timeout)) + break; + } + } + + return res; +} + + +static int _mux_select_chan(struct i2c_mux_core *muxc, + u32 chan) +{ + u8 regval; + struct i2c_client *client = i2c_mux_priv(muxc); + int ret = 0; + + regval = (chan+1) << 5; + ret = _cpld_mux_reg_write(muxc->parent, client, regval); + if (unlikely(ret < 0)) { + return ret; + } + return ret; +} + + +static int _prealloc_attrs(struct cpld_data *data) +{ + void *new_attrs = krealloc(data->group.attrs, + ATTR_ALLOC_SIZE * sizeof(void *), + GFP_KERNEL); + if (!new_attrs) + return -ENOMEM; + data->group.attrs = new_attrs; + + return 0; +} + +static int _add_sysfs_attributes(struct i2c_client *client, + struct cpld_data *data) +{ + int status; + + status = add_attributes(client, data); + if (status) { + return status; + } + + /*If there are no attributes, something is wrong. + * Bail out instead of trying to register nothing. + */ + if (!data->num_attributes) { + dev_err(&client->dev, "No attributes found\n"); + return -ENODEV; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &data->group); + if (status) { + return status; + } + + return 0; +} + + +static int _add_mux_channels(struct i2c_client *client, + const struct i2c_device_id *id, struct cpld_data *data) +{ + int num, force, class; + int status; + struct i2c_mux_core *muxc; + struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); + int model = id->driver_data; + + data->muxc = i2c_mux_alloc(adap, &client->dev, + chips[model].nchans, + sizeof(client), 0, + _mux_select_chan, NULL); + + if (!data->muxc) { + return ENOMEM; + } + muxc = data->muxc; + muxc->priv = client; + for (num = 0; num < chips[model].nchans; num++) { + force = 0; /* dynamic adap number */ + class = 0; /* no class by default */ + status = i2c_mux_add_adapter(muxc, force, num, class); + if (status) + return status ; + } + dev_info(&client->dev, + "registered %d multiplexed busses for I2C %s\n", + num, client->name); + + return 0; +} + +static int as7315_i2c_cpld_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); + int status; + struct cpld_data *data = NULL; + struct device *dev = &client->dev; + + if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE_DATA)) + return -ENODEV; + + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) { + return -ENOMEM; + } + data->model = dev_id->driver_data; + data->attrs = &models_attr[data->model]; + get_sfp_spec(data->model, &data->sfp_num, &data->sfp_types); + mutex_init(&data->update_lock); + data->dev = dev; + dev_info(dev, "chip found\n"); + + + status = _prealloc_attrs(data); + if (status) + return -ENOMEM; + + status = _add_sysfs_attributes(client, data); + if (status) + goto out_kfree; + + status = _add_mux_channels(client, dev_id, data); + if (status) + goto exit_rm_sys; + + i2c_set_clientdata(client, data); + accton_i2c_cpld_add_client(client); + dev_info(dev, "%s: cpld '%s'\n", + dev_name(data->dev), client->name); + + return 0; + +exit_rm_sys: + sysfs_remove_group(&client->dev.kobj, &data->group); +out_kfree: + kfree(data->group.attrs); + return status; +} + + +static int as7315_i2c_cpld_remove(struct i2c_client *client) +{ + struct cpld_data *data = i2c_get_clientdata(client); + struct i2c_mux_core *muxc = data->muxc; + + sysfs_remove_group(&client->dev.kobj, &data->group); + kfree(data->group.attrs); + if(muxc) { + i2c_mux_del_adapters(muxc); + } + accton_i2c_cpld_remove_client(client); + return 0; +} + +int accton_i2c_cpld_read(u8 cpld_addr, u8 reg) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EPERM; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_read_byte_data(cpld_node->client, reg); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(accton_i2c_cpld_read); + +int accton_i2c_cpld_write(u8 cpld_addr, u8 reg, u8 value) +{ + struct list_head *list_node = NULL; + struct cpld_client_node *cpld_node = NULL; + int ret = -EIO; + + mutex_lock(&list_lock); + + list_for_each(list_node, &cpld_client_list) + { + cpld_node = list_entry(list_node, struct cpld_client_node, list); + + if (cpld_node->client->addr == cpld_addr) { + ret = i2c_smbus_write_byte_data(cpld_node->client, reg, value); + break; + } + } + + mutex_unlock(&list_lock); + + return ret; +} +EXPORT_SYMBOL(accton_i2c_cpld_write); + + +static struct i2c_driver as7315_i2c_cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = DRV_NAME, + }, + .probe = as7315_i2c_cpld_probe, + .remove = as7315_i2c_cpld_remove, + .id_table = as7315_cpld_id, + .address_list = normal_i2c, +}; + + +static int __init as7315_i2c_cpld_init(void) +{ + mutex_init(&list_lock); + return i2c_add_driver(&as7315_i2c_cpld_driver); +} + +static void __exit as7315_i2c_cpld_exit(void) +{ + i2c_del_driver(&as7315_i2c_cpld_driver); +} + +module_init(as7315_i2c_cpld_init); +module_exit(as7315_i2c_cpld_exit); + +MODULE_AUTHOR("Roy Lee "); +MODULE_DESCRIPTION("as7315_i2c_cpld driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/x86-64-accton-as7315-27xb-led.c b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/x86-64-accton-as7315-27xb-led.c new file mode 100755 index 000000000000..fefb44fad33f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/x86-64-accton-as7315-27xb-led.c @@ -0,0 +1,408 @@ +/* + * A LED driver for the accton_as7315_27xb_led + * + * Copyright (C) 2019 Accton Technology Corporation. + * Brandon Chuang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*#define DEBUG*/ + +#include +#include +#include +#include +#include +#include +#include + +#define DRVNAME "as7315_27xb_led" +#define CPLD_I2C_ADDR 0x64 + +enum led_type { + TYPE_DIAG, + TYPE_LOC, + TYPE_MAX +}; + +struct led_list_s { + enum led_type type; + char name[64]; + u8 reg_addr; + u8 slave_addr; +} led_list[TYPE_MAX] = { + {TYPE_DIAG, "as7315_27xb_diag", 0x41, CPLD_I2C_ADDR}, + {TYPE_LOC, "as7315_27xb_loc", 0x40, CPLD_I2C_ADDR} +}; + +struct accton_as7315_27xb_led_data { + struct platform_device *pdev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 slave_addr[TYPE_MAX]; /* For LOC and DIAG.*/ + u8 reg_addr[TYPE_MAX]; /* For LOC and DIAG.*/ + u8 reg_val[TYPE_MAX]; /* Register value, 0 = LOC + 1 = DIAG */ +}; +static struct accton_as7315_27xb_led_data *ledctl = NULL; + +/* LED related data + */ +#define TYPE_DIAG_REG_MASK 0x30 +#define MODE_DIAG_GREEN_MASK 0x10 +#define MODE_DIAG_AMBER_MASK 0x20 +#define MODE_DIAG_GBLINK_MASK 0x00 +#define MODE_DIAG_OFF_MASK 0x30 + +#define TYPE_LOC_REG_MASK 0x40 +#define MODE_LOC_OFF_MASK 0x40 +#define MODE_LOC_BLINK_MASK 0x00 + + +typedef enum onlp_led_mode_e { + ONLP_LED_MODE_OFF, + ONLP_LED_MODE_ON, + ONLP_LED_MODE_BLINKING, + ONLP_LED_MODE_RED = 10, + ONLP_LED_MODE_RED_BLINKING = 11, + ONLP_LED_MODE_ORANGE = 12, + ONLP_LED_MODE_ORANGE_BLINKING = 13, + ONLP_LED_MODE_YELLOW = 14, + ONLP_LED_MODE_YELLOW_BLINKING = 15, + ONLP_LED_MODE_GREEN = 16, + ONLP_LED_MODE_GREEN_BLINKING = 17, + ONLP_LED_MODE_BLUE = 18, + ONLP_LED_MODE_BLUE_BLINKING = 19, + ONLP_LED_MODE_PURPLE = 20, + ONLP_LED_MODE_PURPLE_BLINKING = 21, + ONLP_LED_MODE_AUTO = 22, + ONLP_LED_MODE_AUTO_BLINKING = 23, +} onlp_led_mode_t; + + +struct led_type_mode { + enum led_type type; + int type_mask; + enum onlp_led_mode_e mode; + int mode_mask; +}; + +static struct led_type_mode led_type_mode_data[] = { + {TYPE_DIAG, TYPE_DIAG_REG_MASK, ONLP_LED_MODE_GREEN_BLINKING, MODE_DIAG_GBLINK_MASK}, + {TYPE_DIAG, TYPE_DIAG_REG_MASK, ONLP_LED_MODE_GREEN, MODE_DIAG_GREEN_MASK}, + {TYPE_DIAG, TYPE_DIAG_REG_MASK, ONLP_LED_MODE_ORANGE, MODE_DIAG_AMBER_MASK}, + {TYPE_DIAG, TYPE_DIAG_REG_MASK, ONLP_LED_MODE_OFF, MODE_DIAG_OFF_MASK}, + {TYPE_LOC, TYPE_LOC_REG_MASK, ONLP_LED_MODE_BLUE_BLINKING, MODE_LOC_BLINK_MASK}, + {TYPE_LOC, TYPE_LOC_REG_MASK, ONLP_LED_MODE_OFF, MODE_LOC_OFF_MASK}, +}; + +extern int accton_i2c_cpld_read (u8 cpld_addr, u8 reg); +extern int accton_i2c_cpld_write(u8 cpld_addr, u8 reg, u8 value); + + +static int pdata_init(struct accton_as7315_27xb_led_data *data) { + int i; + + for (i=0; ireg_addr[i] = led_list[i].reg_addr; + data->slave_addr[i] = led_list[i].slave_addr; + } + + return 0; +} + +static int led_reg_val_to_light_mode(enum led_type type, u8 reg_val) { + int i; + + for (i = 0; i < ARRAY_SIZE(led_type_mode_data); i++) { + + if (type != led_type_mode_data[i].type) + continue; + + if ((led_type_mode_data[i].type_mask & reg_val) == + led_type_mode_data[i].mode_mask) + { + return led_type_mode_data[i].mode; + } + } + + return 0; +} + +static u8 led_light_mode_to_reg_val(enum led_type type, + enum onlp_led_mode_e mode, u8 reg_val) { + int i; + + for (i = 0; i < ARRAY_SIZE(led_type_mode_data); i++) { + if (type != led_type_mode_data[i].type) + continue; + + if (mode != led_type_mode_data[i].mode) + continue; + + reg_val = led_type_mode_data[i].mode_mask | + (reg_val & (~led_type_mode_data[i].type_mask)); + } + + return reg_val; +} + +static int accton_as7315_27xb_led_read_value(u8 slave, u8 reg) +{ + return accton_i2c_cpld_read(slave, reg); +} + +static int accton_as7315_27xb_led_write_value(u8 slave, u8 reg, u8 value) +{ + return accton_i2c_cpld_write(slave, reg, value); +} + +static void accton_as7315_27xb_led_update(void) +{ + mutex_lock(&ledctl->update_lock); + + if (time_after(jiffies, ledctl->last_updated + HZ + HZ / 2) + || !ledctl->valid) { + int i; + + dev_dbg(&ledctl->pdev->dev, "Starting accton_as7315_27xb_led update\n"); + + /* Update LED data + */ + for (i = 0; i < ARRAY_SIZE(ledctl->reg_val); i++) { + int status; + u8 addr, offset; + addr = ledctl->slave_addr[i]; + offset = ledctl->reg_addr[i]; + status = accton_as7315_27xb_led_read_value(addr, offset); + if (status < 0) { + ledctl->valid = 0; + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", ledctl->reg_addr[i], status); + goto exit; + } + else + { + ledctl->reg_val[i] = status; + } + } + + ledctl->last_updated = jiffies; + ledctl->valid = 1; + } + +exit: + mutex_unlock(&ledctl->update_lock); +} + +static void accton_as7315_27xb_led_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode, + enum led_type type) +{ + int reg_val; + u8 addr, offset; + + if (type >= ARRAY_SIZE(led_list)) { + dev_dbg(&ledctl->pdev->dev, "Illegal type:%d\n", type); + return; + } + mutex_lock(&ledctl->update_lock); + addr = ledctl->slave_addr[type], + offset = ledctl->reg_addr[type], + reg_val = accton_as7315_27xb_led_read_value(addr, offset); + if (reg_val < 0) { + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", offset, reg_val); + goto exit; + } + + reg_val = led_light_mode_to_reg_val(type, led_light_mode, reg_val); + accton_as7315_27xb_led_write_value(addr, offset, reg_val); + + /* to prevent the slow-update issue */ + ledctl->valid = 0; + +exit: + mutex_unlock(&ledctl->update_lock); +} + +static enum led_type get_led_type(struct led_classdev *cdev) +{ + int i; + + for (i=0; iname)) + return i; + } + return -EINVAL; +} + +static void led_mode_set(struct led_classdev *cdev, + enum led_brightness led_light_mode) +{ + enum led_type type; + + type = get_led_type(cdev); + if (type < 0) { + dev_dbg(&ledctl->pdev->dev, "Found no corresponding type:%d\n", type); + return ; + } + accton_as7315_27xb_led_set(cdev, led_light_mode, type); +} + +static enum led_brightness led_mode_get(struct led_classdev *cdev) +{ + enum led_type type; + + type = get_led_type(cdev); + if (type < 0) + return type; + + accton_as7315_27xb_led_update(); + return led_reg_val_to_light_mode(type, ledctl->reg_val[type]); +} + +static struct led_classdev accton_as7315_27xb_leds[TYPE_MAX] = { + [TYPE_DIAG] = { + .name = led_list[TYPE_DIAG].name, + .default_trigger = "unused", + .brightness_set = led_mode_set, + .brightness_get = led_mode_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = ONLP_LED_MODE_AUTO, + }, + [TYPE_LOC] = { + .name = led_list[TYPE_LOC].name, + .default_trigger = "unused", + .brightness_set = led_mode_set, + .brightness_get = led_mode_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = ONLP_LED_MODE_AUTO, + }, +}; + +static int accton_as7315_27xb_led_suspend(struct platform_device *dev, + pm_message_t state) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(accton_as7315_27xb_leds); i++) { + led_classdev_suspend(&accton_as7315_27xb_leds[i]); + } + + return 0; +} + +static int accton_as7315_27xb_led_resume(struct platform_device *dev) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(accton_as7315_27xb_leds); i++) { + led_classdev_resume(&accton_as7315_27xb_leds[i]); + } + + return 0; +} + +static int accton_as7315_27xb_led_probe(struct platform_device *pdev) +{ + int ret, i; + + for (i = 0; i < ARRAY_SIZE(accton_as7315_27xb_leds); i++) { + ret = led_classdev_register(&pdev->dev, &accton_as7315_27xb_leds[i]); + + if (ret < 0) + break; + } + + /* Check if all LEDs were successfully registered */ + if (i != ARRAY_SIZE(accton_as7315_27xb_leds)) { + int j; + + /* only unregister the LEDs that were successfully registered */ + for (j = 0; j < i; j++) { + led_classdev_unregister(&accton_as7315_27xb_leds[i]); + } + } + + return ret; +} + +static int accton_as7315_27xb_led_remove(struct platform_device *pdev) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(accton_as7315_27xb_leds); i++) { + led_classdev_unregister(&accton_as7315_27xb_leds[i]); + } + + return 0; +} + +static struct platform_driver accton_as7315_27xb_led_driver = { + .probe = accton_as7315_27xb_led_probe, + .remove = accton_as7315_27xb_led_remove, + .suspend = accton_as7315_27xb_led_suspend, + .resume = accton_as7315_27xb_led_resume, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + +static int __init accton_as7315_27xb_led_init(void) +{ + int ret; + + ret = platform_driver_register(&accton_as7315_27xb_led_driver); + if (ret < 0) { + goto exit; + } + + ledctl = kzalloc(sizeof(struct accton_as7315_27xb_led_data), GFP_KERNEL); + if (!ledctl) { + ret = -ENOMEM; + platform_driver_unregister(&accton_as7315_27xb_led_driver); + goto exit; + } + + pdata_init(ledctl); + mutex_init(&ledctl->update_lock); + + ledctl->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(ledctl->pdev)) { + ret = PTR_ERR(ledctl->pdev); + platform_driver_unregister(&accton_as7315_27xb_led_driver); + kfree(ledctl); + goto exit; + } + +exit: + return ret; +} + +static void __exit accton_as7315_27xb_led_exit(void) +{ + platform_device_unregister(ledctl->pdev); + platform_driver_unregister(&accton_as7315_27xb_led_driver); + kfree(ledctl); +} + +module_init(accton_as7315_27xb_led_init); +module_exit(accton_as7315_27xb_led_exit); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton_as7315_27xb_led driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/x86-64-accton-as7315-27xb-psu.c b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/x86-64-accton-as7315-27xb-psu.c new file mode 100644 index 000000000000..1cf6313eab09 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/x86-64-accton-as7315-27xb-psu.c @@ -0,0 +1,454 @@ +/* + * An hwmon driver for accton as7315_27xb Power Module + * + * Copyright (C) 2019 Accton Technology Corporation. + * Brandon Chuang + * + * Based on ad7414.c + * Copyright 2006 Stefan Roese , DENX Software Engineering + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRV_NAME "as7315_27xb_psu" +#define PSU_STATUS_I2C_ADDR 0x64 +#define PSU_STATUS_I2C_REG_OFFSET 0x2 +#define USE_BYTE_ACCESS 0 /*Somehow i2c block access is failed on this platform.*/ +#define UPDATE_PERIOD (HZ*2) +#define MAX_OUTPUT_LENGTH 32 +#define BASIC_EEPROM_SIZE 32 + +#define IS_POWER_GOOD(id, value) (!!(value & BIT(id + 2))) +#define IS_PRESENT(id, value) (!(value & BIT(id))) + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +/* Each client has this additional data + */ +struct as7315_27xb_psu_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 index; /* PSU index */ + u8 status; /* Status(present/power_good) register read from CPLD */ + char eeprom[BASIC_EEPROM_SIZE*2]; /* EEPROM*/ +}; + + +enum as7315_27xb_psu_sysfs_attributes { + PSU_INDEX, + PSU_PRESENT, + PSU_MODEL_NAME, + PSU_POWER_GOOD, + PSU_SERIAL_NUMBER +}; + +enum psu_type { + PSU_YM_1401_A, /* AC110V - B2F */ + PSU_YM_2401_JCR, /* AC110V - F2B */ + PSU_YM_2401_JDR, /* AC110V - B2F */ + PSU_YM_2401_TCR, /* AC110V - B2F */ + PSU_CPR_4011_4M11, /* AC110V - F2B */ + PSU_CPR_4011_4M21, /* AC110V - B2F */ + PSU_CPR_6011_2M11, /* AC110V - F2B */ + PSU_CPR_6011_2M21, /* AC110V - B2F */ + PSU_UM400D_01G, /* DC48V - F2B */ + PSU_UM400D01_01G, /* DC48V - B2F */ + PSU_BEL_TOT120, /* DC48V - N/A */ + PSU_TYPE_MAX +}; + +struct model_info { + enum psu_type type; + u8 offset; + char* model_name; + u8 serial_offset; +}; + +struct model_info models[] = { + {PSU_YM_1401_A, 0x20, "YM-1401ACR",0x35}, + {PSU_YM_2401_JCR, 0x20, "YM-2401JCR",0x35}, + {PSU_YM_2401_JDR, 0x20, "YM-2401JDR",0x35}, + {PSU_YM_2401_TCR, 0x20, "YM-2401TCR",0x35}, + {PSU_CPR_4011_4M11, 0x26, "CPR-4011-4M11",0x47}, + {PSU_CPR_4011_4M21, 0x26, "CPR-4011-4M21",0x47}, + {PSU_CPR_6011_2M11, 0x26, "CPR-6011-2M11",0x46}, + {PSU_CPR_6011_2M21, 0x26, "CPR-6011-2M21",0x46}, + {PSU_UM400D_01G, 0x50, "um400d01G",0x50}, + {PSU_UM400D01_01G, 0x50, "um400d01-01G",0x50}, + {PSU_BEL_TOT120, 0x0A, "CRXT-T0T120",0x18}, +}; + +static ssize_t show_index(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_model_name(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_serial_number(struct device *dev, struct device_attribute *da,char *buf); +static int as7315_27xb_psu_block_read(struct i2c_client *client, u8 command, u8 *data,int data_len); +static int as7315_27xb_psu_model_name_get( + struct device *dev, char *buf); +static int as7315_27xb_psu_serial_number_get( + struct device *dev, enum psu_type type, char *out); +static struct as7315_27xb_psu_data *as7315_27xb_psu_update_device(struct device *dev); +extern int accton_i2c_cpld_read(u8 cpld_addr, u8 reg); + +/* sysfs attributes for hwmon + */ +static SENSOR_DEVICE_ATTR(psu_index, S_IRUGO, show_index, NULL, PSU_INDEX); +static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, show_status, NULL, PSU_PRESENT); +static SENSOR_DEVICE_ATTR(psu_model_name, S_IRUGO, show_model_name,NULL, PSU_MODEL_NAME); +static SENSOR_DEVICE_ATTR(psu_serial, S_IRUGO, show_serial_number, NULL, PSU_SERIAL_NUMBER); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, show_status, NULL, PSU_POWER_GOOD); + +static struct attribute *as7315_27xb_psu_attributes[] = { + &sensor_dev_attr_psu_index.dev_attr.attr, + &sensor_dev_attr_psu_present.dev_attr.attr, + &sensor_dev_attr_psu_model_name.dev_attr.attr, + &sensor_dev_attr_psu_serial.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + NULL +}; + +static ssize_t show_index(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7315_27xb_psu_data *data = i2c_get_clientdata(client); + + return sprintf(buf, "%d\n", data->index); +} + +static ssize_t show_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct as7315_27xb_psu_data *data = as7315_27xb_psu_update_device(dev); + u8 status = 0; + + if (!data->valid) { + return sprintf(buf, "0\n"); + } + + if (attr->index == PSU_PRESENT) { + status = IS_PRESENT(data->index, data->status); + } + else { /* PSU_POWER_GOOD */ + status = IS_POWER_GOOD(data->index, data->status); + } + + return sprintf(buf, "%d\n", status); +} + +static ssize_t show_serial_number(struct device *dev, struct device_attribute *da, + char *buf) +{ + int i; + struct as7315_27xb_psu_data *data = as7315_27xb_psu_update_device(dev); + + if (!data->valid) { + return 0; + } + + if (!IS_PRESENT(data->index, data->status)) { + return 0; + } + + i = as7315_27xb_psu_model_name_get(dev, buf); + if ( i < 0) { + return -ENXIO; + } + + if (as7315_27xb_psu_serial_number_get(dev, i, buf) < 0) { + return -ENXIO; + } + return sprintf(buf, "%s\n", buf); +} + +static ssize_t show_model_name(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct as7315_27xb_psu_data *data = as7315_27xb_psu_update_device(dev); + + if (!data->valid) { + return 0; + } + + if (!IS_PRESENT(data->index, data->status)) { + return 0; + } + + if (as7315_27xb_psu_model_name_get(dev, buf) < 0) { + return -ENXIO; + } + + return sprintf(buf, "%s\n", buf); +} + +static const struct attribute_group as7315_27xb_psu_group = { + .attrs = as7315_27xb_psu_attributes, +}; + +static int as7315_27xb_psu_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct as7315_27xb_psu_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(struct as7315_27xb_psu_data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + data->index = dev_id->driver_data; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &as7315_27xb_psu_group); + if (status) { + goto exit_free; + } + data->hwmon_dev = hwmon_device_register_with_info(&client->dev, + client->name, NULL, NULL, NULL); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_remove; + } + + dev_info(&client->dev, "%s: psu '%s'\n", + dev_name(data->hwmon_dev), client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &as7315_27xb_psu_group); +exit_free: + kfree(data); +exit: + + return status; +} + +static int as7315_27xb_psu_remove(struct i2c_client *client) +{ + struct as7315_27xb_psu_data *data = i2c_get_clientdata(client); + + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &as7315_27xb_psu_group); + kfree(data); + + return 0; +} + +enum psu_index +{ + as7315_27xb_psu1, + as7315_27xb_psu2 +}; + +static const struct i2c_device_id as7315_27xb_psu_id[] = { + { "as7315_27xb_psu1", as7315_27xb_psu1 }, + { "as7315_27xb_psu2", as7315_27xb_psu2 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, as7315_27xb_psu_id); + +static struct i2c_driver as7315_27xb_psu_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = DRV_NAME, + }, + .probe = as7315_27xb_psu_probe, + .remove = as7315_27xb_psu_remove, + .id_table = as7315_27xb_psu_id, + .address_list = normal_i2c, +}; + +static int as7315_27xb_psu_block_read(struct i2c_client *client, + u8 command, u8 *data, int max_len) +{ + int result; + + u8 i, offset; + + if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_I2C_BLOCK)) { + for (i = 0; i < max_len; i += 32) { + offset = i + command ; + result = i2c_smbus_read_i2c_block_data(client, offset, + 32, data + i); + + if (result != 32) { + result = -EIO; + goto abort; + } + } + + } else { + for (i = 0; i < max_len; i += 2) { + int word; + offset = i + command ; + word = i2c_smbus_read_word_data(client, offset); + if (word < 0) { + result = -EIO; + goto abort; + } + data[i] = word & 0xff; + data[i + 1] = word >> 8; + } + } + result = 0; +abort: + return result; +} + +static int as7315_27xb_psu_serial_number_get( + struct device *dev, enum psu_type type, char *out) +{ + char *serial; + struct as7315_27xb_psu_data *data = as7315_27xb_psu_update_device(dev); + + if (type >= PSU_TYPE_MAX) { + return -EINVAL; + } + + if (!data->valid) { + out[0] = '\0'; + return 0; + } + + serial = data->eeprom + models[type].serial_offset; + strncpy(out, serial, MAX_OUTPUT_LENGTH); + return 0; +} + +static int find_model_name_from_eeprom( char *eeprom) +{ + int i; + char *name; + + for (i = 0; i < ARRAY_SIZE(models); i++) { + name = eeprom + models[i].offset; + if (strncmp(name, models[i].model_name, + strlen(models[i].model_name)) == 0) { + break; + } + } + + return (i == ARRAY_SIZE(models))? -EINVAL: i; +} +static int as7315_27xb_psu_model_name_get( + struct device *dev, char *buf) +{ + int i; + struct as7315_27xb_psu_data *data = as7315_27xb_psu_update_device(dev); + + if (!data->valid) { + return sprintf(buf, "0\n"); + } + + /* Determine if the model name is known, if not, read next index + */ + i = find_model_name_from_eeprom(data->eeprom); + if (i < 0) { + return -ENODATA; + } + + mutex_lock(&data->update_lock); + strncpy(buf, models[i].model_name, MAX_OUTPUT_LENGTH); + /*Work-around for some special models*/ + if (i == PSU_YM_2401_JCR || i == PSU_YM_2401_JDR || + i == PSU_YM_1401_A || i == PSU_YM_2401_TCR) { + /* Skip the meaningless data byte 8*/ + buf[8] = buf[9]; + buf[9] = buf[10]; + buf = '\0'; + } + + mutex_unlock(&data->update_lock); + return i; +} + +static struct as7315_27xb_psu_data *as7315_27xb_psu_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct as7315_27xb_psu_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + if (time_after(jiffies, data->last_updated + UPDATE_PERIOD) + || !data->valid) { + int status = -1; + + dev_dbg(&client->dev, "Starting as7315_27xb update\n"); + data->valid = 0; + + /* Read psu status */ + status = accton_i2c_cpld_read(PSU_STATUS_I2C_ADDR, PSU_STATUS_I2C_REG_OFFSET); + if (status < 0) { + dev_dbg(&client->dev, + "cpld reg (0x%x) err %d\n", PSU_STATUS_I2C_ADDR, status); + goto exit; + } + else { + data->status = status; + } + + + /*Read the eeprom of psu*/ + memset(data->eeprom, 0, sizeof(data->eeprom)); + status = as7315_27xb_psu_block_read(client, 0, + data->eeprom, sizeof(data->eeprom)); + + if (status < 0) { + dev_dbg(&client->dev, "unable to read eeprom from (0x%x)\n", + client->addr); + goto exit; + } + data->last_updated = jiffies; + data->valid = 1; + } + +exit: + mutex_unlock(&data->update_lock); + return data; +} + +module_i2c_driver(as7315_27xb_psu_driver); + +MODULE_AUTHOR("Brandon Chuang "); +MODULE_DESCRIPTION("accton as7315_27xb_psu driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/ym2651y.c b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/ym2651y.c new file mode 120000 index 000000000000..f4d67640ccc3 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/modules/ym2651y.c @@ -0,0 +1 @@ +../../common/modules/ym2651y.c \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/service/as7315-platform-init.service b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/service/as7315-platform-init.service new file mode 100755 index 000000000000..cdaf437166bd --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/service/as7315-platform-init.service @@ -0,0 +1,13 @@ +[Unit] +Description=Accton AS7315-27XB Platform initialization service +Before=pmon.service +After=sysinit.target +DefaultDependencies=no + +[Service] +ExecStartPre=/usr/local/bin/accton_as7315_util.py install +ExecStart=/usr/local/bin/accton_as7315_monitor.py +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/setup.py b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/setup.py new file mode 100755 index 000000000000..09187900c7ee --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/setup.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +import os +import sys +from setuptools import setup +os.listdir + +setup( + name='as7315_27xb', + version='1.0', + description='Module to initialize Accton AS7315-27XB platforms', + + packages=['as7315_27xb'], + package_dir={'as7315_27xb': 'as7315-27xb/classes'}, +) + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/README b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/README new file mode 100755 index 000000000000..0561fe7a2775 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/README @@ -0,0 +1,60 @@ +Copyright (C) 2019 Accton Networks, Inc. + +This program is free software: you can redistribute it and/or modify +It under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +To initialize the system, run "accton_as7315_util.py install". +To clean up the drivers & devices, run "accton_as7315_util.py clean". +To dump information of sensors, run "accton_as7315_util.py show". +To dump SFP EEPROM, run "accton_as7315_util.py sff". +To set fan speed, run "accton_as7315_util.py set fan". +To enable/disable SFP emission, run "accton_as7315_util.py set sfp". +To set system LEDs' color, run "accton_as7315_util.py set led" +For more information, run "accton_as7315_util.py --help". + +==================================================================== +Besides applying accton_as7315_util.py to access peripherals, you can +access peripherals by sysfs nodes directly after the installation is run. + +LED controls can be found under /sys/class/leds. The sysfs interface +color mappings are as follows: +Brightness: + 0 => off + 1 => green + 2 => amber + 3 => red + 4 => blue + +There are 5 system LEDs, loc, diag, fan, ps1, and ps2. +They are lit automatically by CPLD, but the loc and diag. +The loc led has only 1 color, blue. +The diag one has 3 colors: red, amber, and green. + +Fan controls can be found in /sys/bus/i2c/devices/2-0066. +There are 10 fans inside 5 fan modules. +All fans share 1 duty setting, ranged from 0~100. + +Three temperature sensors are controlled by the lm75 kernel modules. +They should already be visible under /sys/bus/i2c/drivers/lm75/. + +Two power supplies are controlled by the CPLD. +Here provide their status under +/sys/bus/i2c/devices/10-0050 and /sys/bus/i2c/devices/11-0053. + +There are QSFP/SFP modules are equipped. +Apply "accton_as7315_util.py show" to get their status. +Apply "accton_as7315_util.py set sfp" to turn on/off light transmission. +Apply "accton_as7315_util.py sff" to dump EEPROM information. +Before operating on that QSFP+, please make sure it is well plugged. +Otherwise, operation is going to fail. + diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/accton_as7315_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/accton_as7315_monitor.py new file mode 100755 index 000000000000..5d821350ac81 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/accton_as7315_monitor.py @@ -0,0 +1,168 @@ +#!/usr/bin/env python +# +# Copyright (C) 2019 Accton Technology Corporation +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ------------------------------------------------------------------ +# HISTORY: +# mm/dd/yyyy (A.D.) +# 11/13/2017: Polly Hsu, Create +# 1/10/2018: Jostar modify for as7716_32 +# 8/02/2019: Roy Lee modify for as7315_27x +# ------------------------------------------------------------------ + +try: + import os + import sys, getopt + import subprocess + import click + import imp + import logging + import logging.config + import types + import time # this is only being used as part of the example + import traceback + import signal + from tabulate import tabulate + from as7315_27xb.fanutil import FanUtil + from as7315_27xb.thermalutil import ThermalUtil +except ImportError as e: + raise ImportError('%s - required module not found' % str(e)) + +# Deafults +VERSION = '1.0' +FUNCTION_NAME = 'accton_as7315_monitor' +DUTY_MAX = 100 +DUTY_DEF = 40 + +global log_file +global log_console + + +# Make a class we can use to capture stdout and sterr in the log +class accton_as7315_monitor(object): + # static temp var + _ori_temp = 0 + _new_perc = 0 + _ori_perc = 0 + + llog = logging.getLogger("["+FUNCTION_NAME+"]") + def __init__(self, log_console, log_file): + """Needs a logger and a logger level.""" + formatter = logging.Formatter('%(name)s %(message)s') + sys_handler = logging.handlers.SysLogHandler(address = '/dev/log') + sys_handler.setFormatter(formatter) + sys_handler.ident = 'common' + sys_handler.setLevel(logging.WARNING) #only fatal for syslog + self.llog.addHandler(sys_handler) + self.llog.setLevel(logging.DEBUG) + + if log_file: + fh = logging.FileHandler(log_file) + fh.setLevel(logging.INFO) + formatter = logging.Formatter('%(asctime)-15s %(name)s %(message)s') + fh.setFormatter(formatter) + self.llog.addHandler(fh) + + # set up logging to console + if log_console: + console = logging.StreamHandler() + console.setLevel(logging.DEBUG) #For debugging + formatter = logging.Formatter('%(asctime)-15s %(name)s %(message)s') + console.setFormatter(formatter) + self.llog.addHandler(console) + + def manage_fans(self): + max_duty = DUTY_MAX + fan_policy = { + 0: [52, 0, 43000], + 1: [63, 43000, 46000], + 2: [75, 46000, 52000], + 3: [88, 52000, 57000], + 4: [max_duty, 57000, sys.maxsize], + } + + thermal = ThermalUtil() + fan = FanUtil() + for x in range(fan.get_idx_fan_start(), fan.get_num_fans()+1): + fan_status = fan.get_fan_status(x) + if fan_status is None: + self.llog.debug('SET new_perc to %d (FAN stauts is None. fan_num:%d)', max_duty, x) + return False + if fan_status is False: + self.llog.debug('SET new_perc to %d (FAN fault. fan_num:%d)', max_duty, x) + fan.set_fan_duty_cycle(max_duty) + return True + + #Find if current duty matched any of define duty. + #If not, set it to highest one. + cur_duty_cycle = fan.get_fan_duty_cycle() + new_duty_cycle = DUTY_DEF + for x in range(0, len(fan_policy)): + if cur_duty_cycle == fan_policy[x][0]: + break + if x == len(fan_policy) : + fan.set_fan_duty_cycle(fan_policy[0][0]) + cur_duty_cycle = max_duty + + #Decide fan duty by if sum of sensors falls into any of fan_policy{} + get_temp = thermal.get_thermal_temp() + for x in range(0, len(fan_policy)): + y = len(fan_policy) - x -1 #checked from highest + if get_temp > fan_policy[y][1] and get_temp < fan_policy[y][2] : + new_duty_cycle = fan_policy[y][0] + self.llog.debug('Sum of temp %d > %d , new_duty_cycle=%d', get_temp, fan_policy[y][1], new_duty_cycle) + + self.llog.debug('Final duty_cycle=%d', new_duty_cycle) + if(new_duty_cycle != cur_duty_cycle): + fan.set_fan_duty_cycle(new_duty_cycle) + return True + +def sig_handler(signum, frame): + fan = FanUtil() + logging.critical('Cause signal %d, set fan speed max.', signum) + fan.set_fan_duty_cycle(DUTY_MAX) + sys.exit(0) + +def main(argv): + log_file = '%s.log' % FUNCTION_NAME + log_console = 0 + log_file = "" + if len(sys.argv) != 1: + try: + opts, args = getopt.getopt(argv,'hdl') + except getopt.GetoptError: + print 'Usage: %s [-d] [-l]' % sys.argv[0] + return 0 + for opt, arg in opts: + if opt == '-h': + print 'Usage: %s [-d] [-l]' % sys.argv[0] + return 0 + elif opt in ('-d'): + log_console = 1 + elif opt in ('-l'): + log_file = '%s.log' % sys.argv[0] + + signal.signal(signal.SIGINT, sig_handler) + signal.signal(signal.SIGTERM, sig_handler) + monitor = accton_as7315_monitor(log_console, log_file) + + # Loop forever, doing something useful hopefully: + while True: + monitor.manage_fans() + time.sleep(10) + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/accton_as7315_util.py b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/accton_as7315_util.py new file mode 100755 index 000000000000..ea856e4ff56b --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/accton_as7315_util.py @@ -0,0 +1,535 @@ +#!/usr/bin/env python +# +# Copyright (C) 2016 Accton Networks, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes + show : show all systen status + sff : dump SFP eeprom + set : change board setting with fan|led|sfp +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + + + + +PROJECT_NAME = 'as7315_27xb' +version = '0.1.0' +verbose = False +DEBUG = False +args = [] +ALL_DEVICE = {} +DEVICE_NO = {'led':2, 'fan':5,'thermal':3, 'psu':2, 'sfp':27} +FORCE = 0 +#logging.basicConfig(filename= PROJECT_NAME+'.log', filemode='w',level=logging.DEBUG) +#logging.basicConfig(level=logging.INFO) + +qsfp_start_index = 24 + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + elif arg == 'show': + device_traversal() + elif arg == 'sff': + if len(args)!=2: + show_eeprom_help() + elif int(args[1]) ==0 or int(args[1]) > DEVICE_NO['sfp']: + show_eeprom_help() + else: + show_eeprom(args[1]) + return + elif arg == 'set': + if len(args)<3: + show_set_help() + else: + set_device(args[1:]) + return + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_set_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print cmd +" [led|sfp|fan]" + print " use \""+ cmd + " led 0-1 \" to set led color" + print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" + print " use \""+ cmd + " sfp 1-27 {0|1}\" to set sfp# tx_disable" + sys.exit(0) + +def show_eeprom_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print " use \""+ cmd + " 1-27 \" to dump sfp# eeprom" + sys.exit(0) + +def my_log(txt): + if DEBUG == True: + print "[ROY]"+txt + return + +def log_os_system(cmd, show): + logging.info('Run :'+cmd) + status, output = commands.getstatusoutput(cmd) + my_log (cmd +"with result:" + str(status)) + my_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +def driver_check(): + ret, lsmod = log_os_system("lsmod| grep accton", 0) + logging.info('mods:'+lsmod) + if len(lsmod) ==0: + return False + return True + + + +kos = [ +'modprobe i2c_dev', +'modprobe i2c_mux_pca954x force_deselect_on_exit=1', +'modprobe optoe', +'modprobe ym2651y', +'modprobe accton_as7315_27xb_fan', +'modprobe at24_as7315_27xb', +'modprobe x86-64-accton-as7315_27xb-cpld', +'modprobe x86-64-accton-as7315_27xb-led', +'modprobe x86-64-accton-as7315_27xb-psu' ] + +def driver_install(): + global FORCE + status, output = log_os_system("depmod", 1) + for i in range(0,len(kos)): + status, output = log_os_system(kos[i], 1) + if status: + if FORCE == 0: + return status + return 0 + +def driver_uninstall(): + global FORCE + for i in range(0,len(kos)): + #remove parameter if any + rm = kos[-(i+1)] + lst = rm.split(" ") + if len(lst) > 2: + del(lst[2:]) + rm = " ".join(lst) + + #Change to removing commands + rm = rm.replace("modprobe", "modprobe -rq") + rm = rm.replace("insmod", "rmmod") + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + +led_prefix ='/sys/class/leds/'+PROJECT_NAME+'_' +hwmon_types = {'led': ['diag','loc']} +hwmon_nodes = {'led': ['brightness'] } +hwmon_prefix ={'led': led_prefix} + +i2c_prefix = '/sys/bus/i2c/devices/' +i2c_bus = {'fan': ['50-0066'] , + 'thermal': ['51-0049','52-004a', '53-004c'] , + 'psu': ['13-0053','12-0050'], + 'sfp': ['-0050']} +i2c_nodes = {'fan': ['present', 'input'] , + 'thermal': ['hwmon/hwmon*/temp1_input'] , + 'psu': ['psu_present', 'psu_power_good'] , + 'sfp': ['present']} + +sfp_map = [26,27,28,29,30,31,32,33, + 34,35,36,37,38,39,40,41, + 42,43,44,45,46,47,48,49, + 21, 22, 23] + +mknod =[ +'echo pca9548 0x76 > /sys/bus/i2c/devices/i2c-0/new_device', +'echo pca9548 0x74 > /sys/bus/i2c/devices/i2c-3/new_device', +'echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-1/new_device', +'echo pca9548 0x70 > /sys/bus/i2c/devices/i2c-18/new_device', +'echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-19/new_device', +'echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-20/new_device', + +'echo as7315_cpld1 0x63 > /sys/bus/i2c/devices/i2c-8/new_device', +'echo as7315_cpld2 0x64 > /sys/bus/i2c/devices/i2c-7/new_device', + +'echo 24cxb04 0x57 > /sys/bus/i2c/devices/i2c-4/new_device', +'echo as7315_27xb_psu2 0x50 > /sys/bus/i2c/devices/i2c-12/new_device', +'echo ym2401 0x58 > /sys/bus/i2c/devices/i2c-12/new_device', +'echo as7315_27xb_psu1 0x53 > /sys/bus/i2c/devices/i2c-13/new_device', +'echo ym2401 0x5b > /sys/bus/i2c/devices/i2c-13/new_device', +'echo as7315_fan 0x66 > /sys/bus/i2c/devices/i2c-50/new_device', +'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-51/new_device', +'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-52/new_device', +'echo lm75 0x4c > /sys/bus/i2c/devices/i2c-53/new_device', +] + +def i2c_order_check(): + return 0 + +def device_install(): + global FORCE + + for i in range(0,len(mknod)): + #for pca954x need times to built new i2c buses + if mknod[i].find('pca954') != -1: + time.sleep(1) + + status, output = log_os_system(mknod[i], 1) + if status: + print output + if FORCE == 0: + return status + + for i in range(0,len(sfp_map)): + path = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device" + if 1 >= qsfp_start_index: + status, output =log_os_system("echo optoe1 0x50 > " + path, 1) + else: + status, output =log_os_system("echo optoe2 0x50 > " + path, 1) + if status: + print output + if FORCE == 0: + return status + return + +def device_uninstall(): + global FORCE + + status, output =log_os_system("ls /sys/bus/i2c/devices/1-0076", 0) + + for i in range(0,len(sfp_map)): + target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" + status, output =log_os_system("echo 0x50 > "+ target, 1) + if status: + print output + if FORCE == 0: + return status + + nodelist = mknod + + for i in range(len(nodelist)): + target = nodelist[-(i+1)] + temp = target.split() + del temp[1] + temp[-1] = temp[-1].replace('new_device', 'delete_device') + status, output = log_os_system(" ".join(temp), 1) + if status: + print output + if FORCE == 0: + return status + + return + +def system_ready(): + if driver_check() == False: + return False + if not device_exist(): + return False + return True + +def do_install(): + print "Checking system...." + if driver_check() == False: + print "No driver, installing...." + status = driver_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" drivers detected...." + + if not device_exist(): + print "No device, installing...." + status = device_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" devices detected...." + return + +def do_uninstall(): + print "Checking system...." + if not device_exist(): + print PROJECT_NAME.upper() +" has no device installed...." + else: + print "Removing device...." + status = device_uninstall() + if status: + if FORCE == 0: + return status + + if driver_check()== False : + print PROJECT_NAME.upper() +" has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + return + +def devices_info(): + global DEVICE_NO + global ALL_DEVICE + global i2c_bus, hwmon_types + for key in DEVICE_NO: + ALL_DEVICE[key]= {} + for i in range(0,DEVICE_NO[key]): + ALL_DEVICE[key][key+str(i+1)] = [] + + for key in i2c_bus: + buses = i2c_bus[key] + nodes = i2c_nodes[key] + for i in range(0,len(buses)): + for j in range(0,len(nodes)): + if 'fan' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + path = i2c_prefix+ buses[i]+"/fan"+str(k+1)+"_"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + elif 'sfp' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + if k > qsfp_start_index: + fmt = i2c_prefix+"7-0064/{0}_{1}" + else: + fmt = i2c_prefix+"8-0063/{0}_{1}" + path = fmt.format(nodes[j], (k%qsfp_start_index)+1) + + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + else: + node = key+str(i+1) + path = i2c_prefix+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + + for key in hwmon_types: + itypes = hwmon_types[key] + nodes = hwmon_nodes[key] + for i in range(0,len(itypes)): + for j in range(0,len(nodes)): + node = key+"_"+itypes[i] + path = hwmon_prefix[key]+ itypes[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][ key+str(i+1)].append(path) + + #show dict all in the order + if DEBUG == True: + for i in sorted(ALL_DEVICE.keys()): + print(i+": ") + for j in sorted(ALL_DEVICE[i].keys()): + print(" "+j) + for k in (ALL_DEVICE[i][j]): + print(" "+" "+k) + return + +def show_eeprom(index): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + i = int(index)-1 + node = i2c_prefix+ str(sfp_map[i])+ i2c_bus['sfp'][0]+"/"+ 'eeprom' + # check if got hexdump command in current environment + ret, log = log_os_system("which hexdump", 0) + ret, log2 = log_os_system("which busybox hexdump", 0) + if len(log): + hex_cmd = 'hexdump' + elif len(log2): + hex_cmd = ' busybox hexdump' + else: + log = 'Failed : no hexdump cmd!!' + logging.info(log) + print log + return 1 + + print node + ":" + ret, log = log_os_system(hex_cmd +" -C "+node, 1) + if ret==0: + print log + else: + print "**********device no found**********" + return + +def set_device(args): + global DEVICE_NO + global ALL_DEVICE + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + + if args[0]=='led': + if int(args[1])>4: + show_set_help() + return + #print ALL_DEVICE['led'] + for i in range(0,len(ALL_DEVICE['led'])): + for k in (ALL_DEVICE['led']['led'+str(i+1)]): + ret, log = log_os_system("echo "+args[1]+" >"+k, 1) + if ret: + return ret + elif args[0]=='fan': + if int(args[1])>100: + show_set_help() + return + #print ALL_DEVICE['fan'] + #fan1~6 is all fine, all fan share same setting + node = ALL_DEVICE['fan'] ['fan1'][0] + node = node.replace(node.split("/")[-1], 'fan_duty_cycle_percentage') + ret, log = log_os_system("cat "+ node, 1) + if ret==0: + print ("Previous fan duty: " + log.strip() +"%") + ret, log = log_os_system("echo "+args[1]+" >"+node, 1) + if ret==0: + print ("Current fan duty: " + args[1] +"%") + return ret + elif args[0]=='sfp': + if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: + show_set_help() + return + if len(args)<2: + show_set_help() + return + + if int(args[2])>1: + show_set_help() + return + + #print ALL_DEVICE[args[0]] + for i in range(0,len(ALL_DEVICE[args[0]])): + for j in ALL_DEVICE[args[0]][args[0]+str(args[1])]: + if j.find('tx_disable')!= -1: + ret, log = log_os_system("echo "+args[2]+" >"+ j, 1) + if ret: + return ret + + return + +#get digits inside a string. +#Ex: 31 for "sfp31" +def get_value(input): + digit = re.findall('\d+', input) + return int(digit[0]) + +def device_traversal(): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + for i in sorted(ALL_DEVICE.keys()): + print("============================================") + print(i.upper()+": ") + print("============================================") + + for j in sorted(ALL_DEVICE[i].keys(), key=get_value): + print " "+j+":", + for k in (ALL_DEVICE[i][j]): + ret, log = log_os_system("cat "+k, 0) + func = k.split("/")[-1].strip() + func = re.sub(j+'_','',func,1) + func = re.sub(i.lower()+'_','',func,1) + if ret==0: + print func+"="+log+" ", + else: + print func+"="+"X"+" ", + print + print("----------------------------------------------------------------") + + + print + return + +def device_exist(): + ret1, log = log_os_system("ls "+i2c_prefix+"*0076", 0) + ret2, log = log_os_system("ls "+i2c_prefix+"i2c-2", 0) + return not(ret1 or ret2) + +if __name__ == "__main__": + main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/thermalutil.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/thermalutil.py index 2060bc19d943..9087ff1c38f4 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/thermalutil.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/classes/thermalutil.py @@ -74,10 +74,10 @@ class ThermalUtil(object): THERMAL_NUM_4_IDX: ['15', '4b'], } thermal_sysfspath ={ - THERMAL_NUM_1_IDX: ["/sys/bus/i2c/drivers/lm75/15-0048/hwmon/hwmon2/temp1_input"], - THERMAL_NUM_2_IDX: ["/sys/bus/i2c/drivers/lm75/15-0049/hwmon/hwmon3/temp1_input"], - THERMAL_NUM_3_IDX: ["/sys/bus/i2c/drivers/lm75/15-004a/hwmon/hwmon4/temp1_input"], - THERMAL_NUM_4_IDX: ["/sys/bus/i2c/drivers/lm75/15-004b/hwmon/hwmon5/temp1_input"], + THERMAL_NUM_1_IDX: ["/sys/bus/i2c/drivers/lm75/15-0048/hwmon/hwmon*/temp1_input"], + THERMAL_NUM_2_IDX: ["/sys/bus/i2c/drivers/lm75/15-0049/hwmon/hwmon*/temp1_input"], + THERMAL_NUM_3_IDX: ["/sys/bus/i2c/drivers/lm75/15-004a/hwmon/hwmon*/temp1_input"], + THERMAL_NUM_4_IDX: ["/sys/bus/i2c/drivers/lm75/15-004b/hwmon/hwmon*/temp1_input"], THERMAL_NUM_5_IDX: ["/sys/class/hwmon/hwmon0/temp1_input"], } @@ -89,28 +89,25 @@ def _get_thermal_val(self, thermal_num): return None if thermal_num < self.THERMAL_NUM_6_IDX: - device_path = self.get_thermal_to_device_path(thermal_num) - if(os.path.isfile(device_path)): - for filename in glob.glob(device_path): - try: - val_file = open(filename, 'r') - except IOError as e: - logging.error('GET. unable to open file: %s', str(e)) - return None - content = val_file.readline().rstrip() - if content == '': - logging.debug('GET. content is NULL. device_path:%s', device_path) - return None - try: - val_file.close() - except: - logging.debug('GET. unable to close file. device_path:%s', device_path) - return None + device_path = self.get_thermal_to_device_path(thermal_num) + + for filename in glob.glob(device_path): + try: + val_file = open(filename, 'r') + except IOError as e: + logging.error('GET. unable to open file: %s', str(e)) + return None + + content = val_file.readline().rstrip() + if content == '': + logging.debug('GET. content is NULL. device_path:%s', device_path) + return None + try: + val_file.close() + except: + logging.debug('GET. unable to close file. device_path:%s', device_path) + return None return int(content) - - else: - print "No such device_path=%s"%device_path - return 0 else: log_os_system(self.BCM_thermal_cmd,0) @@ -123,23 +120,13 @@ def _get_thermal_val(self, thermal_num): return 0 file_str = check_file.read() search_str="average current temperature is" - print "file_str.find=%s"%file_str.find(search_str) str_len = len(search_str) idx=file_str.find(search_str) if idx==-1: - print "bcm sdk is not ready ,retrun 0" + logging.debug('bcm sdk is not ready ,retrun 0') return 0 - else: - #print "file_str[idx]=%c"%file_str[idx+str_len+1] - #print "file_str[idx]=%c"%file_str[idx+str_len+2] - #print "file_str[idx]=%c"%file_str[idx+str_len+2+1] - #print "file_str[idx]=%c"%file_str[idx+str_len+2+2] - #print "file_str[idx]=%c"%file_str[idx+str_len+2+3] - #print "file_str[idx]=%c"%file_str[idx+str_len+2+4] - #print "file_str[idx]=%c"%file_str[idx+str_len+2+5] - #print "file_str[idx]=%c"%file_str[idx+str_len+2+6] + else: temp_str=file_str[idx+str_len+1] + file_str[idx+str_len+2] + file_str[idx+str_len+3]+file_str[idx+str_len+4] +file_str[idx+str_len+5] - print "bcm temp_str=%s"%temp_str check_file.close() return float(temp_str)*1000 @@ -168,17 +155,12 @@ def get_thermal_temp(self): def main(): thermal = ThermalUtil() - print "termal1=%d" %thermal._get_thermal_val(1) - print "termal2=%d" %thermal._get_thermal_val(2) - print "termal3=%d" %thermal._get_thermal_val(3) - print "termal4=%d" %thermal._get_thermal_val(4) - print "termal5=%d" %thermal._get_thermal_val(5) - print "termal6=%d" %thermal._get_thermal_val(6) -# -# print 'get_size_node_map : %d' % thermal.get_size_node_map() -# print 'get_size_path_map : %d' % thermal.get_size_path_map() -# for x in range(thermal.get_idx_thermal_start(), thermal.get_num_thermals()+1): -# print thermal.get_thermal_to_device_path(x) -# + logging.debug('thermal1=%d' ,thermal._get_thermal_val(1)) + logging.debug('thermal2=%d' ,thermal._get_thermal_val(2)) + logging.debug('thermal3=%d' ,thermal._get_thermal_val(3)) + logging.debug('thermal4=%d' ,thermal._get_thermal_val(4)) + logging.debug('thermal5=%d' ,thermal._get_thermal_val(5)) + logging.debug('thermal6=%d' ,thermal._get_thermal_val(6)) + if __name__ == '__main__': main() diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py index 1cbcf5b4cf7c..b775d97edda9 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py @@ -126,10 +126,6 @@ def __init__(self, log_file, log_level): def get_state_from_fan_policy(self, temp, policy): state=0 - - #if temp >= 75000: - # state=LEVEL_TEMP_CRITICAL - # return state logging.debug('temp=%d', temp) for i in range(0, len(policy)): #logging.debug('policy[%d][0]=%d, policy[%d][1]=%d', i,policy[i][0],i, policy[i][1]) @@ -190,7 +186,6 @@ def manage_fans(self): temp3 = thermal._get_thermal_val(3) temp4 = thermal._get_thermal_val(4) temp5 = thermal._get_thermal_val(5) - #temp6 = thermal._get_thermal_val(6) temp6=0 else: temp1 = test_temp_list[0] @@ -198,7 +193,6 @@ def manage_fans(self): temp3 = test_temp_list[2] temp4 = test_temp_list[3] temp5 = test_temp_list[4] - #temp6 = test_temp_list[5] temp6=0 fan_fail=0 @@ -211,22 +205,17 @@ def manage_fans(self): else: temp_get= (temp2 + temp4)/2 # Use (sensor_LM75_49 + Thermal sensor_LM75_CPU_4B) /2 ori_state=fan_policy_state - fan_policy_state=self.get_state_from_fan_policy(temp_get, fan_policy) - print "temp2=%d"%temp2 - print "temp4=%d"%temp4 - print "temp_get=%d"%temp_get - #print "temp4=%d"%temp4 - #print "temp6=%d"%temp6 + fan_policy_state=self.get_state_from_fan_policy(temp_get, fan_policy) logging.debug('lm75_48=%d, lm75_49=%d, lm75_4a=%d, lm_4b=%d, cpu=%d, bcm=%d', temp1,temp2,temp3,temp4,temp5,temp6) logging.debug('ori_state=%d, fan_policy_state=%d', ori_state, fan_policy_state) new_pwm = fan_policy_state_pwm_tlb[fan_policy_state][0] if fan_fail==0: - logging.debug('new_pwm=%d', new_pwm) + logging.debug('new_pwm=%d', new_pwm) if fan_fail==0: - if new_pwm!=ori_pwm: - fan.set_fan_duty_cycle(new_pwm) - logging.info('Set fan speed from %d to %d', ori_pwm, new_pwm) + if new_pwm!=ori_pwm: + fan.set_fan_duty_cycle(new_pwm) + logging.info('Set fan speed from %d to %d', ori_pwm, new_pwm) for i in range (fan.FAN_NUM_1_IDX, fan.FAN_NUM_ON_MAIN_BROAD+1): if fan.get_fan_status(i)==0: @@ -237,14 +226,10 @@ def manage_fans(self): fan.set_fan_duty_cycle(new_pwm) break else: - fan_fail=0 - - #if fan_policy_state == ori_state: - # return True - #else: - new_state = fan_policy_state + fan_fail=0 + + new_state = fan_policy_state - #logging.warning('Temperature high alarm testing') if ori_state==LEVEL_FAN_DEF: if new_state==LEVEL_TEMP_HIGH: if alarm_state==0: @@ -337,4 +322,4 @@ def main(argv): if __name__ == '__main__': main(sys.argv[1:]) - \ No newline at end of file + diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/control b/platform/broadcom/sonic-platform-modules-accton/debian/control index cb78e152fffc..e8bedd9081ad 100755 --- a/platform/broadcom/sonic-platform-modules-accton/debian/control +++ b/platform/broadcom/sonic-platform-modules-accton/debian/control @@ -68,3 +68,7 @@ Description: kernel modules for platform devices such as fan, led, sfp Package: sonic-platform-accton-as7312-54xs Architecture: amd64 Description: kernel modules for platform devices such as fan, led, sfp + +Package: sonic-platform-accton-as7315-27xb +Architecture: amd64 +Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-accton/debian/rules b/platform/broadcom/sonic-platform-modules-accton/debian/rules index e2c6a4df8f31..11e5b10ae425 100755 --- a/platform/broadcom/sonic-platform-modules-accton/debian/rules +++ b/platform/broadcom/sonic-platform-modules-accton/debian/rules @@ -21,7 +21,7 @@ KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) MODULE_DIRS := as7712-32x as5712-54x as7816-64x as7716-32x as7716-32xb as7312-54x MODULE_DIRS += as7326-56x as6712-32x as7726-32x as4630-54pe minipack as5812-54x -MODULE_DIRS += as5835-54x as9716-32d as5835-54t as7312-54xs +MODULE_DIRS += as5835-54x as9716-32d as5835-54t as7312-54xs as7315-27xb MODULE_DIR := modules UTILS_DIR := utils SERVICE_DIR := service diff --git a/platform/broadcom/sonic-platform-modules-dell/common/dell_pmc.c b/platform/broadcom/sonic-platform-modules-dell/common/dell_pmc.c index 7e725a35a8ad..963c2c725f74 100644 --- a/platform/broadcom/sonic-platform-modules-dell/common/dell_pmc.c +++ b/platform/broadcom/sonic-platform-modules-dell/common/dell_pmc.c @@ -70,7 +70,7 @@ #define FAN_TRAY_AIRFLOW 0x0116 -/* FAN Z9100 */ +/* FAN */ #define SMF_FAN_SPEED_ADDR 0x00F3 #define FAN_TRAY_1_SPEED 0x00F3 #define FAN_TRAY_1_FAN_2_SPEED 0x00F5 @@ -83,6 +83,11 @@ #define FAN_TRAY_5_FAN_1_SPEED 0x0103 #define FAN_TRAY_5_FAN_2_SPEED 0x0105 #define FAN_TRAY_5 4 +#define FAN_1_SERIAL_CODE 0x0117 +#define FAN_2_SERIAL_CODE 0x013A +#define FAN_3_SERIAL_CODE 0x015D +#define FAN_4_SERIAL_CODE 0x0180 +#define FAN_5_SERIAL_CODE 0x01A3 #define FAN_601_FAULT (2 + 1) #define IN28_INPUT (27 + 1) #define IN404_INPUT (43 + 1) @@ -1738,12 +1743,12 @@ static ssize_t show_psu(struct device *dev, /* FAN and PSU EEPROM PPID format is: COUNTRY_CODE-PART_NO-MFG_ID-MFG_DATE_CODE-SERIAL_NO-LABEL_REV */ -static ssize_t show_psu_ppid(struct device *dev, +static ssize_t show_ppid(struct device *dev, struct device_attribute *devattr, char *buf) { int index = to_sensor_dev_attr(devattr)->index; struct smf_data *data = dev_get_drvdata(dev); - char psu_ppid[EEPROM_PPID_SIZE + 1] = {0}; + char ppid[EEPROM_PPID_SIZE + 1] = {0}; char psu_mfg_date[EEPROM_MFG_DATE_SIZE + 1] = {0}; char psu_mfg_date_code[EEPROM_DATE_CODE_SIZE + 1] = {0}; char temp; @@ -1751,102 +1756,128 @@ static ssize_t show_psu_ppid(struct device *dev, switch(index) { - case 1: - // PPID starts from Country Code - reg = PSU_1_COUNTRY_CODE; - break; - case 2: - reg = PSU_2_COUNTRY_CODE; - break; - default: - return ret; - } + /* PPID starts from Country Code*/ + case 0: + reg = FAN_1_SERIAL_CODE; + break; + case 1: + reg = FAN_2_SERIAL_CODE; + break; + case 2: + reg = FAN_3_SERIAL_CODE; + break; + case 3: + reg = FAN_4_SERIAL_CODE; + break; + case 4: + reg = FAN_5_SERIAL_CODE; + break; + case 10: + reg = PSU_1_COUNTRY_CODE; + break; + case 11: + reg = PSU_2_COUNTRY_CODE; + break; + default: + return ret; +} // Get Country Code for( i = 0; i < EEPROM_COUNTRY_CODE_SIZE; i++) { - psu_ppid[ppid_pos++] = (char)smf_read_reg(data,reg++); + ppid[ppid_pos++] = (char)smf_read_reg(data,reg++); } - psu_ppid[ppid_pos++] = '-'; + ppid[ppid_pos++] = '-'; // Get Part Number for( i = 0; i < EEPROM_PART_NO_SIZE; i++) { - psu_ppid[ppid_pos++] = (char)smf_read_reg(data,reg++); + ppid[ppid_pos++] = (char)smf_read_reg(data,reg++); } - psu_ppid[ppid_pos++] = '-'; + ppid[ppid_pos++] = '-'; // Get Manufacture ID for( i = 0; i < EEPROM_MFG_ID_SIZE; i++) { - psu_ppid[ppid_pos++] = (char)smf_read_reg(data,reg++); - } - psu_ppid[ppid_pos++] = '-'; - - // Get Manufacture date - for( i = 0; i < EEPROM_MFG_DATE_SIZE; i++) { - psu_mfg_date[i] = (char)smf_read_reg(data,reg++); - } - - /* Converting 6 digit date code [yymmdd] to 3 digit[ymd] - Year Starting from 2010 [0-9] , Day : 1-9 and A-V , Month : 1-9 and A-C */ - // Year Validation and Conversion - if( ( psu_mfg_date[0] == '1' ) && ( psu_mfg_date[1] >= '0' ) && ( psu_mfg_date[1] <= '9') ) - { - psu_mfg_date_code[0] = psu_mfg_date[1]; - } - else - { - psu_mfg_date_code[0] = ' '; + ppid[ppid_pos++] = (char)smf_read_reg(data,reg++); } + ppid[ppid_pos++] = '-'; + if(index > 9){ //Applicable only for PSU + // Get Manufacture date + for( i = 0; i < EEPROM_MFG_DATE_SIZE; i++) { + psu_mfg_date[i] = (char)smf_read_reg(data,reg++); + } - // Month Validation and Conversion - temp = ( ( psu_mfg_date[2] - 0x30 ) * 10 ) + ( psu_mfg_date[3] - 0x30 ); - if( ( temp >= 1) && ( temp < 10) ) - { - psu_mfg_date_code[1] = temp + 0x30; // 0- 9 - } - else if ( ( temp >= 10) && ( temp <= 12) ) - { - psu_mfg_date_code[1] = temp + 0x37; // A-C - } - else - { - psu_mfg_date_code[1]= ' '; - } + /* Converting 6 digit date code [yymmdd] to 3 digit[ymd] + Year Starting from 2010 [0-9] , Day : 1-9 and A-V , Month : 1-9 and A-C */ + // Year Validation and Conversion + if( ( psu_mfg_date[0] == '1' ) && ( psu_mfg_date[1] >= '0' ) && ( psu_mfg_date[1] <= '9') ) + { + psu_mfg_date_code[0] = psu_mfg_date[1]; + } + else + { + psu_mfg_date_code[0] = ' '; + } + + // Month Validation and Conversion + temp = ( ( psu_mfg_date[2] - 0x30 ) * 10 ) + ( psu_mfg_date[3] - 0x30 ); + if( ( temp >= 1) && ( temp < 10) ) + { + psu_mfg_date_code[1] = temp + 0x30; // 0- 9 + } + else if ( ( temp >= 10) && ( temp <= 12) ) + { + psu_mfg_date_code[1] = temp + 0x37; // A-C + } + else + { + psu_mfg_date_code[1]= ' '; + } - // Date Validation and Conversion - temp = ( ( psu_mfg_date[4] - 0x30 ) * 10 ) + ( psu_mfg_date[5] - 0x30 ); - if( ( temp >= 1) && ( temp < 10) ) - { - psu_mfg_date_code[2] = temp + 0x30; // 0- 9 - } - else if( ( temp >= 10) && ( temp <= 31) ) - { - psu_mfg_date_code[2] = temp + 0x37; // A-V - } - else - { - psu_mfg_date_code[2] = ' '; + // Date Validation and Conversion + temp = ( ( psu_mfg_date[4] - 0x30 ) * 10 ) + ( psu_mfg_date[5] - 0x30 ); + if( ( temp >= 1) && ( temp < 10) ) + { + psu_mfg_date_code[2] = temp + 0x30; // 0- 9 + } + else if( ( temp >= 10) && ( temp <= 31) ) + { + psu_mfg_date_code[2] = temp + 0x37; // A-V + } + else + { + psu_mfg_date_code[2] = ' '; + } + for( i = 0; i < EEPROM_DATE_CODE_SIZE; i++) { + ppid[ppid_pos++] = psu_mfg_date_code[i]; + } + }else{ + for( i = 0; i < EEPROM_DATE_CODE_SIZE; i++) { + ppid[ppid_pos++] = (char)smf_read_reg(data,reg++); + } } - for( i = 0; i < EEPROM_DATE_CODE_SIZE; i++) { - psu_ppid[ppid_pos++] = psu_mfg_date_code[i]; - } - psu_ppid[ppid_pos++] = '-'; + ppid[ppid_pos++] = '-'; // Get Serial Number for( i = 0; i < EEPROM_SERIAL_NO_SIZE; i++) { - psu_ppid[ppid_pos++] = (char)smf_read_reg(data,reg++); + ppid[ppid_pos++] = (char)smf_read_reg(data,reg++); } - psu_ppid[ppid_pos++] = '-'; + ppid[ppid_pos++] = '-'; - // Skipping service tag in PPID - reg += EEPROM_SERVICE_TAG_SIZE; + if(index > 9){ + // Skipping PSU service tag in PPID + reg += EEPROM_SERVICE_TAG_SIZE; + } + else{ + // Skipping FAN partno tag in PPID + reg += EEPROM_PART_NO_SIZE; + } // Get Label Revision for( i = 0; i < EEPROM_LABEL_REV_SIZE; i++) { - psu_ppid[ppid_pos++] = (char)smf_read_reg(data,reg++); + ppid[ppid_pos++] = (char)smf_read_reg(data,reg++); } - return sprintf(buf, "%s\n",psu_ppid); + return sprintf(buf, "%s\n",ppid); } static umode_t smf_psu_is_visible(struct kobject *kobj, @@ -1924,14 +1955,19 @@ static SENSOR_DEVICE_ATTR(fan7_airflow, S_IRUGO, show_fan_airflow, NULL, 3); static SENSOR_DEVICE_ATTR(fan9_airflow, S_IRUGO, show_fan_airflow, NULL, 4); static SENSOR_DEVICE_ATTR(fan11_airflow, S_IRUGO, show_psu_fan, NULL, 0); static SENSOR_DEVICE_ATTR(fan12_airflow, S_IRUGO, show_psu_fan, NULL, 3); +static SENSOR_DEVICE_ATTR(fan1_serialno, S_IRUGO, show_ppid, NULL, 0); +static SENSOR_DEVICE_ATTR(fan3_serialno, S_IRUGO, show_ppid, NULL, 1); +static SENSOR_DEVICE_ATTR(fan5_serialno, S_IRUGO, show_ppid, NULL, 2); +static SENSOR_DEVICE_ATTR(fan7_serialno, S_IRUGO, show_ppid, NULL, 3); +static SENSOR_DEVICE_ATTR(fan9_serialno, S_IRUGO, show_ppid, NULL, 4); /* IOM status */ static SENSOR_DEVICE_ATTR(iom_status, S_IRUGO, show_voltage, NULL, 44); static SENSOR_DEVICE_ATTR(iom_presence, S_IRUGO, show_voltage, NULL, 45); static SENSOR_DEVICE_ATTR(psu1_presence, S_IRUGO, show_psu, NULL, 1); static SENSOR_DEVICE_ATTR(psu2_presence, S_IRUGO, show_psu, NULL, 6); -static SENSOR_DEVICE_ATTR(psu1_serialno, S_IRUGO, show_psu_ppid, NULL, 1); -static SENSOR_DEVICE_ATTR(psu2_serialno, S_IRUGO, show_psu_ppid, NULL, 2); +static SENSOR_DEVICE_ATTR(psu1_serialno, S_IRUGO, show_ppid, NULL, 10); +static SENSOR_DEVICE_ATTR(psu2_serialno, S_IRUGO, show_ppid, NULL, 11); static SENSOR_DEVICE_ATTR(current_total_power, S_IRUGO, show_psu, NULL, 10); /* SMF Version */ @@ -1964,6 +2000,11 @@ static struct attribute *smf_dell_attrs[] = { &sensor_dev_attr_psu2_presence.dev_attr.attr, &sensor_dev_attr_psu1_serialno.dev_attr.attr, &sensor_dev_attr_psu2_serialno.dev_attr.attr, + &sensor_dev_attr_fan1_serialno.dev_attr.attr, + &sensor_dev_attr_fan3_serialno.dev_attr.attr, + &sensor_dev_attr_fan5_serialno.dev_attr.attr, + &sensor_dev_attr_fan7_serialno.dev_attr.attr, + &sensor_dev_attr_fan9_serialno.dev_attr.attr, &sensor_dev_attr_current_total_power.dev_attr.attr, NULL }; @@ -1980,7 +2021,7 @@ static const struct attribute_group *smf_groups[] = { &smf_vsen_group, &smf_curr_group, &smf_tcpu_group, - &smf_dell_group, + &smf_dell_group, NULL }; diff --git a/platform/broadcom/sonic-platform-modules-dell/s5232f/modules/dell_s5232f_fpga_ocores.c b/platform/broadcom/sonic-platform-modules-dell/s5232f/modules/dell_s5232f_fpga_ocores.c index f66f5f18a708..5aa441a3d574 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s5232f/modules/dell_s5232f_fpga_ocores.c +++ b/platform/broadcom/sonic-platform-modules-dell/s5232f/modules/dell_s5232f_fpga_ocores.c @@ -653,15 +653,20 @@ static void fpgai2c_process(struct fpgalogic_i2c *i2c) } } - if (i2c->state == STATE_READ) { + switch (i2c->state) { + case STATE_READ: PRINT("fpgai2c_poll STATE_READ i2c->pos=%d msg->len-1 = 0x%x set FPGAI2C_REG_CMD = 0x%x\n",i2c->pos, msg->len-1, i2c->pos == (msg->len-1) ? FPGAI2C_REG_CMD_READ_NACK : FPGAI2C_REG_CMD_READ_ACK); fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, i2c->pos == (msg->len-1) ? FPGAI2C_REG_CMD_READ_NACK : FPGAI2C_REG_CMD_READ_ACK); - } else { + break; + case STATE_WRITE: PRINT("fpgai2c_process set FPGAI2C_REG_DATA(0x%x)\n",FPGAI2C_REG_DATA); fpgai2c_reg_set(i2c, FPGAI2C_REG_DATA, msg->buf[i2c->pos++]); fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_WRITE); + break; + default: + printk("Unexpected state, %s:%u state=%d\n", __FILE__, __LINE__, i2c->state); } } diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/__init__.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/__init__.py index d82f3749319c..1e26181263a5 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/__init__.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/__init__.py @@ -1,2 +1,2 @@ -__all__ = ["platform", "chassis"] +__all__ = ["platform", "chassis", "sfp"] from sonic_platform import * diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/chassis.py index b1046d9310f8..a625a796ef53 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/chassis.py @@ -10,6 +10,7 @@ try: import os from sonic_platform_base.chassis_base import ChassisBase + from sonic_platform.sfp import Sfp except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -26,7 +27,23 @@ class Chassis(ChassisBase): reset_reason_dict[0x6] = ChassisBase.REBOOT_CAUSE_NON_HARDWARE def __init__(self): - ChassisBase.__init__(self) + # Initialize SFP list + PORT_START = 0 + PORT_END = 31 + EEPROM_OFFSET = 20 + PORTS_IN_BLOCK = (PORT_END + 1) + + # sfp.py will read eeprom contents and retrive the eeprom data. + # It will also provide support sfp controls like reset and setting + # low power mode. + # We pass the eeprom path and sfp control path from chassis.py + # So that sfp.py implementation can be generic to all platforms + eeprom_base = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + sfp_control = "/sys/devices/platform/dell-s6000-cpld.0/" + for index in range(0, PORTS_IN_BLOCK): + eeprom_path = eeprom_base.format(index + EEPROM_OFFSET) + sfp_node = Sfp(index, 'QSFP', eeprom_path, sfp_control, index) + self._sfp_list.append(sfp_node) def get_register(self, reg_name): rv = 'ERR' diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/eeprom.py new file mode 100644 index 000000000000..b39b140c7254 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/eeprom.py @@ -0,0 +1,201 @@ +#!/usr/bin/env python + +######################################################################## +# DellEMC S6000 +# +# Module contains platform specific implementation of SONiC Platform +# Base API and provides the EEPROMs' information. +# +# The different EEPROMs available are as follows: +# - System EEPROM : Contains Serial number, Service tag, Base MA +# address, etc. in ONIE TlvInfo EEPROM format. +# - PSU EEPROM : Contains Serial number, Part number, Service Tag, +# PSU type, Revision. +# - Fan EEPROM : Contains Serial number, Part number, Service Tag, +# Fan type, Number of Fans in Fantray, Revision. +######################################################################## + + +try: + import os + from sonic_platform_base.sonic_eeprom.eeprom_base import EepromDecoder + from sonic_platform_base.sonic_eeprom.eeprom_tlvinfo import TlvInfoDecoder +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +# PSU eeprom fields in format required by EepromDecoder +psu_eeprom_format = [ + ('PPID', 's', 20), ('DPN Rev', 's', 3), ('Service Tag', 's', 7), + ('Part Number', 's', 10), ('Part Num Revision', 's', 3), + ('Mfg Test', 's', 2), ('PSU Type', 's', 1), ('Fab Rev', 's', 2) + ] + +# Fan eeprom fields in format required by EepromDecoder +fan_eeprom_format = [ + ('PPID', 's', 20), ('DPN Rev', 's', 3), ('Service Tag', 's', 7), + ('Part Number', 's', 10), ('Part Num Revision', 's', 3), + ('Mfg Test', 's', 2), ('Number of Fans', 's', 2), ('Fan Type', 's', 1), + ('Fab Rev', 's', 2) + ] + + +class Eeprom(TlvInfoDecoder): + """DellEMC Platform-specific EEPROM class""" + + I2C_DIR = "/sys/class/i2c-adapter/" + + def __init__(self, is_psu=False, psu_index=0, is_fan=False, fan_index=0): + self.is_psu_eeprom = is_psu + self.is_fan_eeprom = is_fan + self.is_sys_eeprom = not (is_psu | is_fan) + + if self.is_sys_eeprom: + self.start_offset = 0 + self.eeprom_path = self.I2C_DIR + "i2c-10/10-0053/eeprom" + # System EEPROM is in ONIE TlvInfo EEPROM format + super(Eeprom, self).__init__(self.eeprom_path, + self.start_offset, '', True) + self._load_system_eeprom() + else: + self.start_offset = 6 + if self.is_psu_eeprom: + self.index = psu_index + self.eeprom_path = self.I2C_DIR \ + + "i2c-1/1-005{}/eeprom".format(2 - self.index) + self.format = psu_eeprom_format + else: + self.index = fan_index + self.eeprom_path = self.I2C_DIR \ + + "i2c-11/11-005{}/eeprom".format(4 - self.index) + self.format = fan_eeprom_format + EepromDecoder.__init__(self, self.eeprom_path, self.format, + self.start_offset, '', True) + self._load_device_eeprom() + + def _load_system_eeprom(self): + """ + Reads the system EEPROM and retrieves the values corresponding + to the codes defined as per ONIE TlvInfo EEPROM format and fills + them in a dictionary. + """ + try: + # Read System EEPROM as per ONIE TlvInfo EEPROM format. + self.eeprom_data = self.read_eeprom() + except: + self.base_mac = 'NA' + self.serial_number = 'NA' + self.part_number = 'NA' + self.eeprom_tlv_dict = dict() + else: + eeprom = self.eeprom_data + self.eeprom_tlv_dict = dict() + + if not self.is_valid_tlvinfo_header(eeprom): + self.base_mac = 'NA' + self.serial_number = 'NA' + self.part_number = 'NA' + return + + total_length = (ord(eeprom[9]) << 8) | ord(eeprom[10]) + tlv_index = self._TLV_INFO_HDR_LEN + tlv_end = self._TLV_INFO_HDR_LEN + total_length + + while (tlv_index + 2) < len(eeprom) and tlv_index < tlv_end: + if not self.is_valid_tlv(eeprom[tlv_index:]): + break + + tlv = eeprom[tlv_index:tlv_index + 2 + + ord(eeprom[tlv_index + 1])] + code = "0x%02X" % (ord(tlv[0])) + + if ord(tlv[0]) == self._TLV_CODE_VENDOR_EXT: + value = str((ord(tlv[2]) << 24) | (ord(tlv[3]) << 16) | + (ord(tlv[4]) << 8) | ord(tlv[5])) + value += str(tlv[6:6 + ord(tlv[1])]) + else: + name, value = self.decoder(None, tlv) + + self.eeprom_tlv_dict[code] = value + if ord(eeprom[tlv_index]) == self._TLV_CODE_CRC_32: + break + + tlv_index += ord(eeprom[tlv_index+1]) + 2 + + self.base_mac = self.eeprom_tlv_dict.get( + hex(self._TLV_CODE_MAC_BASE), 'NA') + self.serial_number = self.eeprom_tlv_dict.get( + hex(self._TLV_CODE_SERIAL_NUMBER), 'NA') + self.part_number = self.eeprom_tlv_dict.get( + hex(self._TLV_CODE_PART_NUMBER), 'NA') + + def _load_device_eeprom(self): + """ + Reads the Fan/PSU EEPROM and retrieves the serial number and + model number of the device. + """ + try: + # Read Fan/PSU EEPROM as per the specified format. + self.eeprom_data = EepromDecoder.read_eeprom(self) + except: + self.serial_number = 'NA' + self.part_number = 'NA' + else: + (valid, data) = self._get_eeprom_field("PPID") + if valid: + ppid = data + self.serial_number = (ppid[:2] + "-" + ppid[2:8] + "-" + + ppid[8:13] + "-" + ppid[13:16] + + "-" + ppid[16:]) + (valid, data) = self._get_eeprom_field("DPN Rev") + if valid: + self.serial_number += "-" + data + else: + seld.serial_number = 'NA' + + (valid, data) = self._get_eeprom_field("Part Number") + if valid: + self.part_number = data + else: + self.part_number = 'NA' + + def _get_eeprom_field(self, field_name): + """ + For a field name specified in the EEPROM format, returns the + presence of the field and the value for the same. + """ + field_start = 0 + for field in self.format: + field_end = field_start + field[2] + if field[0] == field_name: + return (True, self.eeprom_data[field_start:field_end]) + field_start = field_end + + return (False, None) + + def serial_number_str(self): + """ + Returns the serial number. + """ + return self.serial_number + + def part_number_str(self): + """ + Returns the part number. + """ + return self.part_number + + # System EEPROM specific methods + def base_mac_addr(self): + """ + Returns the base MAC address found in the system EEPROM. + """ + return self.base_mac + + def system_eeprom_info(self): + """ + Returns a dictionary, where keys are the type code defined in + ONIE EEPROM format and values are their corresponding values + found in the system EEPROM. + """ + return self.eeprom_tlv_dict diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/sfp.py new file mode 120000 index 000000000000..84af7963bb3d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/sfp.py @@ -0,0 +1 @@ +../../s6100/sonic_platform/sfp.py \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/__init__.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/__init__.py index 497c1429ad89..61b486d775b7 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/__init__.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/__init__.py @@ -1,3 +1,3 @@ -__all__ = ["platform", "chassis", "fan", "psu"] +__all__ = ["platform", "chassis", "fan", "psu", "sfp"] from sonic_platform import * diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py index ef229bd791e2..53d4eadaec0a 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# -# DELLEMC +# DELLEMC S6100 # # Module contains an implementation of SONiC Platform Base API and # provides the platform information @@ -11,8 +11,10 @@ try: import os from sonic_platform_base.chassis_base import ChassisBase + from sonic_platform.sfp import Sfp from sonic_platform.psu import Psu from sonic_platform.fan import Fan + from eeprom import Eeprom except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -29,6 +31,39 @@ class Chassis(ChassisBase): HWMON_NODE = os.listdir(HWMON_DIR)[0] MAILBOX_DIR = HWMON_DIR + HWMON_NODE + PORT_START = 0 + PORT_END = 63 + PORTS_IN_BLOCK = (PORT_END + 1) + IOM1_PORT_START = 0 + IOM2_PORT_START = 16 + IOM3_PORT_START = 32 + IOM4_PORT_START = 48 + + PORT_I2C_MAPPING = {} + # 0th Index = i2cLine, 1st Index = EepromIdx in i2cLine + EEPROM_I2C_MAPPING = { + # IOM 1 + 0: [6, 66], 1: [6, 67], 2: [6, 68], 3: [6, 69], + 4: [6, 70], 5: [6, 71], 6: [6, 72], 7: [6, 73], + 8: [6, 74], 9: [6, 75], 10: [6, 76], 11: [6, 77], + 12: [6, 78], 13: [6, 79], 14: [6, 80], 15: [6, 81], + # IOM 2 + 16: [8, 50], 17: [8, 51], 18: [8, 52], 19: [8, 53], + 20: [8, 54], 21: [8, 55], 22: [8, 56], 23: [8, 57], + 24: [8, 58], 25: [8, 59], 26: [8, 60], 27: [8, 61], + 28: [8, 62], 29: [8, 63], 30: [8, 64], 31: [8, 65], + # IOM 3 + 32: [7, 34], 33: [7, 35], 34: [7, 36], 35: [7, 37], + 36: [7, 38], 37: [7, 39], 38: [7, 40], 39: [7, 41], + 40: [7, 42], 41: [7, 43], 42: [7, 44], 43: [7, 45], + 44: [7, 46], 45: [7, 47], 46: [7, 48], 47: [7, 49], + # IOM 4 + 48: [9, 18], 49: [9, 19], 50: [9, 20], 51: [9, 21], + 52: [9, 22], 53: [9, 23], 54: [9, 24], 55: [9, 25], + 56: [9, 26], 57: [9, 27], 58: [9, 28], 59: [9, 29], + 60: [9, 30], 61: [9, 31], 62: [9, 32], 63: [9, 33] + } + reset_reason_dict = {} reset_reason_dict[11] = ChassisBase.REBOOT_CAUSE_POWER_LOSS reset_reason_dict[33] = ChassisBase.REBOOT_CAUSE_WATCHDOG @@ -42,8 +77,10 @@ class Chassis(ChassisBase): power_reason_dict[44] = ChassisBase.REBOOT_CAUSE_INSUFFICIENT_FAN_SPEED def __init__(self): - ChassisBase.__init__(self) + ChassisBase.__init__(self) + # Initialize EEPROM + self.sys_eeprom = Eeprom() for i in range(MAX_S6100_FAN): fan = Fan(i) self._fan_list.append(fan) @@ -52,7 +89,40 @@ def __init__(self): psu = Psu(i) self._psu_list.append(psu) - def get_pmc_register(self, reg_name): + self._populate_port_i2c_mapping() + + # sfp.py will read eeprom contents and retrive the eeprom data. + # It will also provide support sfp controls like reset and setting + # low power mode. + # We pass the eeprom path and sfp control path from chassis.py + # So that sfp.py implementation can be generic to all platforms + eeprom_base = "/sys/class/i2c-adapter/i2c-{0}/i2c-{1}/{1}-0050/eeprom" + sfp_ctrl_base = "/sys/class/i2c-adapter/i2c-{0}/{0}-003e/" + for index in range(0, self.PORTS_IN_BLOCK): + eeprom_path = eeprom_base.format(self.EEPROM_I2C_MAPPING[index][0], + self.EEPROM_I2C_MAPPING[index][1]) + sfp_control = sfp_ctrl_base.format(self.PORT_I2C_MAPPING[index]) + sfp_node = Sfp(index, 'QSFP', eeprom_path, sfp_control, index) + self._sfp_list.append(sfp_node) + + def _populate_port_i2c_mapping(self): + # port_num and i2c match + for port_num in range(0, self.PORTS_IN_BLOCK): + if((port_num >= self.IOM1_PORT_START) and + (port_num < self.IOM2_PORT_START)): + i2c_line = 14 + elif((port_num >= self.IOM2_PORT_START) and + (port_num < self.IOM3_PORT_START)): + i2c_line = 16 + elif((port_num >= self.IOM3_PORT_START) and + (port_num = self.IOM4_PORT_START) and + (port_num < self.PORTS_IN_BLOCK)): + i2c_line = 17 + self.PORT_I2C_MAPPING[port_num] = i2c_line + + def _get_pmc_register(self, reg_name): # On successful read, returns the value read from given # reg_name and on failure returns 'ERR' rv = 'ERR' @@ -71,12 +141,79 @@ def get_pmc_register(self, reg_name): rv = rv.lstrip(" ") return rv + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + return self.sys_eeprom.modelstr() + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self.sys_eeprom.part_number_str() + + def get_serial(self): + """ + Retrieves the serial number of the device (Service tag) + Returns: + string: Serial number of device + """ + return self.sys_eeprom.serial_str() + + 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.sys_eeprom.base_mac_addr() + + 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.sys_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. + """ + 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. """ - reset_reason = int(self.get_pmc_register('smf_reset_reason')) - power_reason = int(self.get_pmc_register('smf_poweron_reason')) + + reset_reason = int(self._get_pmc_register('smf_reset_reason')) + power_reason = int(self._get_pmc_register('smf_poweron_reason')) # Reset_Reason = 11 ==> PowerLoss # So return the reboot reason from Last Power_Reason Dictionary @@ -93,4 +230,3 @@ def get_reboot_cause(self): return (self.reset_reason_dict[reset_reason], None) return (ChassisBase.REBOOT_CAUSE_HARDWARE_OTHER, "Invalid Reason") - diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/eeprom.py new file mode 100644 index 000000000000..86c314f3ef22 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/eeprom.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python + +############################################################################# +# DellEmc S6100 +# +# 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 + import binascii +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class Eeprom(eeprom_tlvinfo.TlvInfoDecoder): + + def __init__(self): + self.eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0050/eeprom" + super(Eeprom, self).__init__(self.eeprom_path, 0, '', True) + try: + self.eeprom_data = self.read_eeprom() + except: + self.eeprom_data = "N/A" + raise RuntimeError("Eeprom is not Programmed") + + + def serial_number_str(self): + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_SERIAL_NUMBER) + if not is_valid: + return "N/A" + + return results[2] + + def base_mac_addr(self): + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_MAC_BASE) + if not is_valid or results[1] != 6: + return super(TlvInfoDecoder, self).switchaddrstr(e) + + return ":".join([binascii.b2a_hex(T) for T in results[2]]) + + def modelstr(self): + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_PRODUCT_NAME) + if not is_valid: + return "N/A" + + return results[2] + + def part_number_str(self): + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_PART_NUMBER) + if not is_valid: + return "N/A" + + return results[2] + + def serial_str(self): + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_SERVICE_TAG) + if not is_valid: + return "N/A" + + return results[2] + + def revision_str(self): + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_DEVICE_VERSION) + if not is_valid: + return "N/A" + + return results[2] + diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/fan.py index 696a9c0dd70b..c822ccdae2b9 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/fan.py @@ -1,42 +1,221 @@ #!/usr/bin/env python ######################################################################## -# DellEMC +# DellEMC S6100 # # Module contains an implementation of SONiC Platform Base API and -# provides the Fans' information which are available in the platform +# provides the Fans' information which are available in the platform. # ######################################################################## +import os.path try: - import os from sonic_platform_base.fan_base import FanBase except ImportError as e: raise ImportError(str(e) + "- required module not found") - MAX_S6100_PSU_FAN_SPEED = 18000 MAX_S6100_FAN_SPEED = 16000 class Fan(FanBase): - """DellEMC Platform-specific FAN class""" + """DellEMC Platform-specific Fan class""" HWMON_DIR = "/sys/devices/platform/SMF.512/hwmon/" HWMON_NODE = os.listdir(HWMON_DIR)[0] MAILBOX_DIR = HWMON_DIR + HWMON_NODE - def __init__(self, fan_index, psu_fan=False): + def __init__(self, fantray_index, fan_index=1, psu_fan=False): self.is_psu_fan = psu_fan if not self.is_psu_fan: - # Fan is 1-based in DellEMC platforms - self.index = fan_index + 1 - self.get_fan_speed_reg = "fan{}_input".format(2*self.index - 1) + # API index is starting from 0, DellEMC platform index is starting + # from 1 + self.fantrayindex = fantray_index + 1 + self.fanindex = fan_index + 1 + self.get_fan_speed_reg = "fan{}_input".format( + 2 * self.fantrayindex - 1) + self.get_fan_dir_reg = "fan{}_airflow".format( + 2 * self.fantrayindex - 1) + self.fan_serialno_reg = "fan{}_serialno".format( + 2 * self.fantrayindex - 1) self.max_fan_speed = MAX_S6100_FAN_SPEED else: # PSU Fan index starts from 11 - self.index = fan_index + 10 - self.get_fan_speed_reg = "fan{}_input".format(self.index) + self.fanindex = fan_index + 10 + self.get_fan_speed_reg = "fan{}_input".format(self.fanindex) self.max_fan_speed = MAX_S6100_PSU_FAN_SPEED + def _get_pmc_register(self, reg_name): + # On successful read, returns the value read from given + # reg_name and on failure returns 'ERR' + rv = 'ERR' + mb_reg_file = self.MAILBOX_DIR+'/'+reg_name + + if (not os.path.isfile(mb_reg_file)): + return rv + try: + with open(mb_reg_file, 'r') as fd: + rv = fd.read() + except Exception as error: + rv = 'ERR' + + rv = rv.rstrip('\r\n') + rv = rv.lstrip(" ") + return rv + + def get_name(self): + """ + Retrieves the fan name + Returns: + string: The name of the device + """ + if not self.is_psu_fan: + return "FanTray{}-Fan{}".format( + self.fantrayindex, self.fanindex - 1) + else: + return "PSU{} Fan".format(self.index - 10) + + def get_model(self): + """ + Retrieves the part number of the FAN + Returns: + string: Part number of FAN + """ + # For Serial number "US-01234D-54321-25A-0123-A00", the part + # number is "01234D" + fan_serialno = self._get_pmc_register(self.fan_serialno_reg) + if (fan_serialno != 'ERR') and self.get_presence(): + if (len(fan_serialno.split('-')) > 1): + fan_partno = fan_serialno.split('-')[1] + else: + fan_partno = 'NA' + else: + fan_partno = 'NA' + + return fan_partno + + def get_serial(self): + """ + Retrieves the serial number of the FAN + Returns: + string: Serial number of FAN + """ + # Sample Serial number format "US-01234D-54321-25A-0123-A00" + fan_serialno = self._get_pmc_register(self.fan_serialno_reg) + if (fan_serialno == 'ERR') or not self.get_presence(): + fan_serialno = 'NA' + + return fan_serialno + + def get_presence(self): + """ + Retrieves the presence of the FAN + Returns: + bool: True if fan is present, False if not + """ + status = False + fantray_presence = self._get_pmc_register(self.get_fan_speed_reg) + if (fantray_presence != 'ERR'): + fantray_presence = int(fantray_presence, 10) + if (fantray_presence > 0): + status = True + + return status + + def get_status(self): + """ + Retrieves the operational status of the FAN + Returns: + bool: True if FAN is operating properly, False if not + """ + status = False + fantray_status = self._get_pmc_register(self.get_fan_speed_reg) + if (fantray_status != 'ERR'): + fantray_status = int(fantray_status, 10) + if (fantray_status > 5000): + status = True + + return status + + def get_direction(self): + """ + Retrieves the fan airflow direction + Returns: + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + """ + direction = ['FAN_DIRECTION_INTAKE', 'FAN_DIRECTION_EXHAUST'] + fan_direction = self._get_pmc_register(self.get_fan_dir_reg) + if (fan_direction != 'ERR') and self.get_presence(): + fan_direction = int(fan_direction, 10) + else: + return 'N/A' + return direction[fan_direction] + + def get_speed(self): + """ + Retrieves the speed of fan + Returns: + int: percentage of the max fan speed + """ + fan_speed = self._get_pmc_register(self.get_fan_speed_reg) + if (fan_speed != 'ERR') and self.get_presence(): + speed_in_rpm = int(fan_speed, 10) + speed = (100 * speed_in_rpm)/self.max_fan_speed + else: + speed = 0 + + return 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 + """ + if self.get_presence(): + # The tolerance value is fixed as 20% for all the DellEmc platform + tolerance = 20 + else: + tolerance = 0 + + return tolerance + + def set_speed(self, speed): + """ + Set fan speed to expected value + Args: + speed: An integer, the percentage of full fan speed to set fan to, + in the range 0 (off) to 100 (full speed) + Returns: + bool: True if set success, False if fail. + """ + + # Fan speeds are controlled by Smart-fussion FPGA. + return False + + def set_status_led(self, color): + """ + Set led to expected color + Args: + color: A string representing the color with which to set the + fan module status LED + Returns: + bool: True if set success, False if fail. + """ + # Leds are controlled by Smart-fussion FPGA. + status = False + return status + + 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 0 + + diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/sfp.py new file mode 100755 index 000000000000..b312a52c7b42 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/sfp.py @@ -0,0 +1,851 @@ +#!/usr/bin/env python + +############################################################################# +# DELLEMC +# +# Module contains an implementation of SONiC Platform Base API and +# provides the platform information +# +############################################################################# + +try: + import os + import time + from sonic_platform_base.chassis_base import ChassisBase + from sonic_platform_base.sfp_base import SfpBase + from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId + from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +PAGE_OFFSET = 0 +KEY_OFFSET = 1 +KEY_WIDTH = 2 +FUNC_NAME = 3 + +INFO_OFFSET = 128 +DOM_OFFSET = 0 +DOM_OFFSET1 = 384 + +cable_length_tup = ('Length(km)', 'Length OM3(2m)', 'Length OM2(m)', + 'Length OM1(m)', 'Length Cable Assembly(m)') + +compliance_code_tup = ( + '10/40G Ethernet Compliance Code', + 'SONET Compliance codes', + 'SAS/SATA compliance codes', + 'Gigabit Ethernet Compliant codes', + 'Fibre Channel link length/Transmitter Technology', + 'Fibre Channel transmission media', + 'Fibre Channel Speed') + +info_dict_keys = ['type', 'hardwarerev', 'serialnum', + 'manufacturename', 'modelname', 'Connector', + 'encoding', 'ext_identifier', 'ext_rateselect_compliance', + 'cable_type', 'cable_length', 'nominal_bit_rate', + 'specification_compliance', 'vendor_date', 'vendor_oui'] + +dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', + 'power_lpmode', 'tx_disable', 'tx_disable_channel', + 'temperature', 'voltage', 'rx1power', + 'rx2power', 'rx3power', 'rx4power', + 'tx1bias', 'tx2bias', 'tx3bias', + 'tx4bias', 'tx1power', 'tx2power', + 'tx3power', 'tx4power'] + +threshold_dict_keys = ['temphighalarm', 'temphighwarning', + 'templowalarm', 'templowwarning', + 'vcchighalarm', 'vcchighwarning', + 'vcclowalarm', 'vcclowwarning', + 'rxpowerhighalarm', 'rxpowerhighwarning', + 'rxpowerlowalarm', 'rxpowerlowwarning', + 'txpowerhighalarm', 'txpowerhighwarning', + 'txpowerlowalarm', 'txpowerlowwarning', + 'txbiashighalarm', 'txbiashighwarning', + 'txbiaslowalarm', 'txbiaslowwarning'] + +sff8436_parser = { + 'reset_status': [DOM_OFFSET, 2, 1, 'parse_dom_status_indicator'], + 'rx_los': [DOM_OFFSET, 3, 1, 'parse_dom_tx_rx_los'], + 'tx_fault': [DOM_OFFSET, 4, 1, 'parse_dom_tx_fault'], + 'tx_disable': [DOM_OFFSET, 86, 1, 'parse_dom_tx_disable'], + 'power_lpmode': [DOM_OFFSET, 93, 1, 'parse_dom_power_control'], + 'power_override': [DOM_OFFSET, 93, 1, 'parse_dom_power_control'], + 'Temperature': [DOM_OFFSET, 22, 2, 'parse_temperature'], + 'Voltage': [DOM_OFFSET, 26, 2, 'parse_voltage'], + 'ChannelMonitor': [DOM_OFFSET, 34, 16, 'parse_channel_monitor_params'], + + 'cable_type': [INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], + 'cable_length': [INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], + 'Connector': [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], + 'type': [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], + 'encoding': [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], + 'ext_identifier': [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], + 'ext_rateselect_compliance': + [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], + 'nominal_bit_rate': [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], + 'specification_compliance': + [INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], + 'manufacturename': [INFO_OFFSET, 20, 16, 'parse_vendor_name'], + 'vendor_oui': [INFO_OFFSET, 37, 3, 'parse_vendor_oui'], + 'modelname': [INFO_OFFSET, 40, 16, 'parse_vendor_pn'], + 'hardwarerev': [INFO_OFFSET, 56, 2, 'parse_vendor_rev'], + 'serialnum': [INFO_OFFSET, 68, 16, 'parse_vendor_sn'], + 'vendor_date': [INFO_OFFSET, 84, 8, 'parse_vendor_date'], + 'ModuleThreshold': [DOM_OFFSET1, 128, 24, 'parse_module_threshold_values'], + 'ChannelThreshold': [DOM_OFFSET1, 176, 16, 'parse_channel_threshold_values'], +} + + +class Sfp(SfpBase): + """ + DELLEMC Platform-specific Sfp class + """ + + def __init__(self, index, sfp_type, eeprom_path, + sfp_control, sfp_ctrl_idx): + SfpBase.__init__(self) + self.sfp_type = sfp_type + self.index = index + self.eeprom_path = eeprom_path + self.sfp_control = sfp_control + self.sfp_ctrl_idx = sfp_ctrl_idx + self.sfpInfo = sff8436InterfaceId() + self.sfpDomInfo = sff8436Dom() + + def _read_eeprom_bytes(self, eeprom_path, offset, num_bytes): + eeprom_raw = [] + try: + eeprom = open(eeprom_path, mode="rb", buffering=0) + except IOError: + return None + + for i in range(0, num_bytes): + eeprom_raw.append("0x00") + + try: + eeprom.seek(offset) + raw = eeprom.read(num_bytes) + except IOError: + eeprom.close() + return None + + try: + for n in range(0, num_bytes): + eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2) + except BaseException: + eeprom.close() + return None + + eeprom.close() + return eeprom_raw + + def _get_eeprom_data(self, eeprom_key): + eeprom_data = None + page_offset = None + + if (self.sfpInfo is None): + return None + + page_offset = sff8436_parser[eeprom_key][PAGE_OFFSET] + eeprom_data_raw = self._read_eeprom_bytes( + self.eeprom_path, + (sff8436_parser[eeprom_key][PAGE_OFFSET] + + sff8436_parser[eeprom_key][KEY_OFFSET]), + sff8436_parser[eeprom_key][KEY_WIDTH]) + if (eeprom_data_raw is not None): + # Offset 128 is used to retrieve sff8436InterfaceId Info + # Offset 0 is used to retrieve sff8436Dom Info + if (page_offset == 128): + eeprom_data = getattr( + self.sfpInfo, sff8436_parser[eeprom_key][FUNC_NAME])( + eeprom_data_raw, 0) + else: + eeprom_data = getattr( + self.sfpDomInfo, sff8436_parser[eeprom_key][FUNC_NAME])( + eeprom_data_raw, 0) + + return eeprom_data + + def get_transceiver_info(self): + """ + Retrieves transceiver info of this SFP + """ + transceiver_info_dict = {} + compliance_code_dict = {} + transceiver_info_dict = dict.fromkeys(info_dict_keys, 'N/A') + + # BaseInformation + iface_data = self._get_eeprom_data('type') + if (iface_data is not None): + connector = iface_data['data']['Connector']['value'] + encoding = iface_data['data']['EncodingCodes']['value'] + ext_id = iface_data['data']['Extended Identifier']['value'] + rate_identifier = iface_data['data']['RateIdentifier']['value'] + identifier = iface_data['data']['type']['value'] + bit_rate = str( + iface_data['data']['Nominal Bit Rate(100Mbs)']['value']) + + for key in compliance_code_tup: + if key in iface_data['data']['Specification compliance']['value']: + compliance_code_dict[key] = iface_data['data']['Specification compliance']['value'][key]['value'] + for key in cable_length_tup: + if key in iface_data['data']: + cable_type = key + cable_length = str(iface_data['data'][key]['value']) + else: + return None + + # Vendor Date + vendor_date_data = self._get_eeprom_data('vendor_date') + if (vendor_date_data is not None): + vendor_date = vendor_date_data['data']['VendorDataCode(YYYY-MM-DD Lot)']['value'] + else: + return None + + # Vendor Name + vendor_name_data = self._get_eeprom_data('manufacturename') + if (vendor_name_data is not None): + vendor_name = vendor_name_data['data']['Vendor Name']['value'] + else: + return None + + # Vendor OUI + vendor_oui_data = self._get_eeprom_data('vendor_oui') + if (vendor_oui_data is not None): + vendor_oui = vendor_oui_data['data']['Vendor OUI']['value'] + else: + return None + + # Vendor PN + vendor_pn_data = self._get_eeprom_data('modelname') + if (vendor_pn_data is not None): + vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] + else: + return None + + # Vendor Revision + vendor_rev_data = self._get_eeprom_data('hardwarerev') + if (vendor_rev_data is not None): + vendor_rev = vendor_rev_data['data']['Vendor Rev']['value'] + else: + return None + + # Vendor Serial Number + vendor_sn_data = self._get_eeprom_data('serialnum') + if (vendor_sn_data is not None): + vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] + else: + return None + + # Fill The Dictionary and return + transceiver_info_dict['type'] = identifier + transceiver_info_dict['hardwarerev'] = vendor_rev + transceiver_info_dict['serialnum'] = vendor_sn + transceiver_info_dict['manufacturename'] = vendor_name + transceiver_info_dict['modelname'] = vendor_pn + transceiver_info_dict['Connector'] = connector + transceiver_info_dict['encoding'] = encoding + transceiver_info_dict['ext_identifier'] = ext_id + transceiver_info_dict['ext_rateselect_compliance'] = rate_identifier + transceiver_info_dict['cable_type'] = cable_type + transceiver_info_dict['cable_length'] = cable_length + transceiver_info_dict['nominal_bit_rate'] = bit_rate + transceiver_info_dict['specification_compliance'] = str( + compliance_code_dict) + transceiver_info_dict['vendor_date'] = vendor_date + transceiver_info_dict['vendor_oui'] = vendor_oui + + return transceiver_info_dict + + def get_transceiver_threshold_info(self): + """ + Retrieves transceiver threshold info of this SFP + """ + transceiver_dom_threshold_dict = {} + transceiver_dom_threshold_dict = dict.fromkeys( + threshold_dict_keys, 'N/A') + + # Module Threshold + module_threshold_data = self._get_eeprom_data('ModuleThreshold') + if (module_threshold_data is not None): + tempHighAlarm = module_threshold_data['data']['TempHighAlarm']['value'] + tempLowAlarm = module_threshold_data['data']['TempLowAlarm']['value'] + tempHighWarn = module_threshold_data['data']['TempHighWarning']['value'] + tempLowWarn = module_threshold_data['data']['TempLowWarning']['value'] + vccHighAlarm = module_threshold_data['data']['VccHighAlarm']['value'] + vccLowAlarm = module_threshold_data['data']['VccLowAlarm']['value'] + vccHighWarn = module_threshold_data['data']['VccHighWarning']['value'] + vccLowWarn = module_threshold_data['data']['VccLowWarning']['value'] + else: + return None + + # Channel Threshold + channel_threshold_data = self._get_eeprom_data('ChannelThreshold') + if (channel_threshold_data is not None): + rxPowerHighAlarm = channel_threshold_data['data']['RxPowerHighAlarm']['value'] + rxPowerLowAlarm = channel_threshold_data['data']['RxPowerLowAlarm']['value'] + rxPowerHighWarn = channel_threshold_data['data']['RxPowerHighWarning']['value'] + rxPowerLowWarn = channel_threshold_data['data']['RxPowerLowWarning']['value'] + txBiasHighAlarm = channel_threshold_data['data']['TxBiasHighAlarm']['value'] + txBiasLowAlarm = channel_threshold_data['data']['TxBiasLowAlarm']['value'] + txBiasHighWarn = channel_threshold_data['data']['TxBiasHighWarning']['value'] + txBiasLowWarn = channel_threshold_data['data']['TxBiasLowWarning']['value'] + else: + return None + + transceiver_dom_threshold_dict['temphighalarm'] = tempHighAlarm + transceiver_dom_threshold_dict['templowalarm'] = tempLowAlarm + transceiver_dom_threshold_dict['temphighwarning'] = tempHighWarn + transceiver_dom_threshold_dict['templowwarning'] = tempLowWarn + transceiver_dom_threshold_dict['vcchighalarm'] = vccHighAlarm + transceiver_dom_threshold_dict['vcclowalarm'] = vccLowAlarm + transceiver_dom_threshold_dict['vcchighwarning'] = vccHighWarn + transceiver_dom_threshold_dict['vcclowwarning'] = vccLowWarn + transceiver_dom_threshold_dict['rxpowerhighalarm'] = rxPowerHighAlarm + transceiver_dom_threshold_dict['rxpowerlowalarm'] = rxPowerLowAlarm + transceiver_dom_threshold_dict['rxpowerhighwarning'] = rxPowerHighWarn + transceiver_dom_threshold_dict['rxpowerlowwarning'] = rxPowerLowWarn + transceiver_dom_threshold_dict['txbiashighalarm'] = txBiasHighAlarm + transceiver_dom_threshold_dict['txbiaslowalarm'] = txBiasLowAlarm + transceiver_dom_threshold_dict['txbiashighwarning'] = txBiasHighWarn + transceiver_dom_threshold_dict['txbiaslowwarning'] = txBiasLowWarn + + return transceiver_dom_threshold_dict + + def get_transceiver_bulk_status(self): + """ + Retrieves transceiver bulk status of this SFP + """ + tx_bias_list = [] + rx_power_list = [] + transceiver_dom_dict = {} + transceiver_dom_dict = dict.fromkeys(dom_dict_keys, 'N/A') + + # RxLos + rx_los = self.get_rx_los() + + # TxFault + tx_fault = self.get_tx_fault() + + # ResetStatus + reset_state = self.get_reset_status() + + # LowPower Mode + lp_mode = self.get_lpmode() + + # TxDisable + tx_disable = self.get_tx_disable() + + # TxDisable Channel + tx_disable_channel = self.get_tx_disable_channel() + + # Temperature + temperature = self.get_temperature() + + # Voltage + voltage = self.get_voltage() + + # Channel Monitor + channel_monitor_data = self._get_eeprom_data('ChannelMonitor') + if (channel_monitor_data is not None): + tx_bias = channel_monitor_data['data']['TX1Bias']['value'] + tx_bias_list.append(tx_bias) + tx_bias = channel_monitor_data['data']['TX2Bias']['value'] + tx_bias_list.append(tx_bias) + tx_bias = channel_monitor_data['data']['TX3Bias']['value'] + tx_bias_list.append(tx_bias) + tx_bias = channel_monitor_data['data']['TX4Bias']['value'] + tx_bias_list.append(tx_bias) + rx_power = channel_monitor_data['data']['RX1Power']['value'] + rx_power_list.append(rx_power) + rx_power = channel_monitor_data['data']['RX2Power']['value'] + rx_power_list.append(rx_power) + rx_power = channel_monitor_data['data']['RX3Power']['value'] + rx_power_list.append(rx_power) + rx_power = channel_monitor_data['data']['RX4Power']['value'] + rx_power_list.append(rx_power) + else: + return None + + transceiver_dom_dict['rx_los'] = rx_los + transceiver_dom_dict['tx_fault'] = tx_fault + transceiver_dom_dict['reset_status'] = reset_state + transceiver_dom_dict['power_lpmode'] = lp_mode + transceiver_dom_dict['tx_disable'] = tx_disable + transceiver_dom_dict['tx_disable_channel'] = tx_disable_channel + transceiver_dom_dict['temperature'] = temperature + transceiver_dom_dict['voltage'] = voltage + transceiver_dom_dict['tx1bias'] = tx_bias_list[0] + transceiver_dom_dict['tx2bias'] = tx_bias_list[1] + transceiver_dom_dict['tx3bias'] = tx_bias_list[2] + transceiver_dom_dict['tx4bias'] = tx_bias_list[3] + transceiver_dom_dict['rx1power'] = rx_power_list[0] + transceiver_dom_dict['rx2power'] = rx_power_list[1] + transceiver_dom_dict['rx3power'] = rx_power_list[2] + transceiver_dom_dict['rx4power'] = rx_power_list[3] + + return transceiver_dom_dict + + def get_name(self): + """ + Retrieves the name of the sfp + Returns : QSFP or QSFP+ or QSFP28 + """ + iface_data = self._get_eeprom_data('type') + if (iface_data is not None): + identifier = iface_data['data']['type']['value'] + else: + return None + + return identifier + + def get_presence(self): + """ + Retrieves the presence of the sfp + """ + presence_ctrl = self.sfp_control + 'qsfp_modprs' + try: + reg_file = open(presence_ctrl) + except IOError as e: + return False + + reg_hex = reg_file.readline().rstrip() + + # content is a string containing the hex + # representation of the register + reg_value = int(reg_hex, 16) + + # Mask off the bit corresponding to our port + mask = (1 << self.sfp_ctrl_idx) + + # ModPrsL is active low + if ((reg_value & mask) == 0): + return True + + return False + + def get_model(self): + """ + Retrieves the model number (or part number) of the sfp + """ + vendor_pn_data = self._get_eeprom_data('modelname') + if (vendor_pn_data is not None): + vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] + else: + return None + + return vendor_pn + + def get_serial(self): + """ + Retrieves the serial number of the sfp + """ + vendor_sn_data = self._get_eeprom_data('serialnum') + if (vendor_sn_data is not None): + vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] + else: + return None + + return vendor_sn + + def get_reset_status(self): + """ + Retrieves the reset status of SFP + """ + reset_status = None + reset_ctrl = self.sfp_control + 'qsfp_reset' + try: + reg_file = open(reset_ctrl, "r+") + except IOError as e: + return False + + reg_hex = reg_file.readline().rstrip() + + # content is a string containing the hex + # representation of the register + reg_value = int(reg_hex, 16) + + # Mask off the bit corresponding to our port + if (self.sfp_ctrl_idx > 15): + index = self.sfp_ctrl_idx % 16 + else: + index = self.sfp_ctrl_idx + + mask = (1 << index) + + if ((reg_value & mask) == 0): + reset_status = True + else: + reset_status = False + + return reset_status + + def get_rx_los(self): + """ + Retrieves the RX LOS (lost-of-signal) status of SFP + """ + rx_los = None + rx_los_list = [] + + rx_los_data = self._get_eeprom_data('rx_los') + if (rx_los_data is not None): + rx_los = rx_los_data['data']['Rx1LOS']['value'] + if (rx_los is 'On'): + rx_los_list.append(True) + else: + rx_los_list.append(False) + rx_los = rx_los_data['data']['Rx2LOS']['value'] + if (rx_los is 'On'): + rx_los_list.append(True) + else: + rx_los_list.append(False) + rx_los = rx_los_data['data']['Rx3LOS']['value'] + if (rx_los is 'On'): + rx_los_list.append(True) + else: + rx_los_list.append(False) + rx_los = rx_los_data['data']['Rx4LOS']['value'] + if (rx_los is 'On'): + rx_los_list.append(True) + else: + rx_los_list.append(False) + + if (rx_los_list[0] and rx_los_list[1] + and rx_los_list[2] and rx_los_list[3]): + rx_los = True + else: + rx_los = False + + return rx_los + + def get_tx_fault(self): + """ + Retrieves the TX fault status of SFP + """ + tx_fault = None + tx_fault_list = [] + + tx_fault_data = self._get_eeprom_data('tx_fault') + if (tx_fault_data is not None): + tx_fault = tx_fault_data['data']['Tx1Fault']['value'] + if (tx_fault is 'On'): + tx_fault_list.append(True) + else: + tx_fault_list.append(False) + tx_fault = tx_fault_data['data']['Tx2Fault']['value'] + if (tx_fault is 'On'): + tx_fault_list.append(True) + else: + tx_fault_list.append(False) + tx_fault = tx_fault_data['data']['Tx3Fault']['value'] + if (tx_fault is 'On'): + tx_fault_list.append(True) + else: + tx_fault_list.append(False) + tx_fault = tx_fault_data['data']['Tx4Fault']['value'] + if (tx_fault is 'On'): + tx_fault_list.append(True) + else: + tx_fault_list.append(False) + + if (tx_fault_list[0] and tx_fault_list[1] + and tx_fault_list[2] and tx_fault_list[3]): + tx_fault = True + else: + tx_fault = False + + return tx_fault + + def get_tx_disable(self): + """ + Retrieves the tx_disable status of this SFP + """ + tx_disable = None + tx_disable_list = [] + + tx_disable_data = self._get_eeprom_data('tx_disable') + if (tx_disable_data is not None): + tx_disable = tx_disable_data['data']['Tx1Disable']['value'] + if (tx_disable is 'On'): + tx_disable_list.append(True) + else: + tx_disable_list.append(False) + tx_disable = tx_disable_data['data']['Tx2Disable']['value'] + if (tx_disable is 'On'): + tx_disable_list.append(True) + else: + tx_disable_list.append(False) + tx_disable = tx_disable_data['data']['Tx3Disable']['value'] + if (tx_disable is 'On'): + tx_disable_list.append(True) + else: + tx_disable_list.append(False) + tx_disable = tx_disable_data['data']['Tx4Disable']['value'] + if (tx_disable is 'On'): + tx_disable_list.append(True) + else: + tx_disable_list.append(False) + + if (tx_disable_list[0] and tx_disable_list[1] + and tx_disable_list[2] and tx_disable_list[3]): + tx_disable = True + else: + tx_disable = False + + return tx_disable + + def get_tx_disable_channel(self): + """ + Retrieves the TX disabled channels in this SFP + """ + tx_disable = None + tx_disable_list = [] + + tx_disable_data = self._get_eeprom_data('tx_disable') + if (tx_disable_data is not None): + tx_disable = tx_disable_data['data']['Tx1Disable']['value'] + if (tx_disable is 'On'): + tx_disable_list.append(1) + else: + tx_disable_list.append(0) + tx_disable = tx_disable_data['data']['Tx2Disable']['value'] + if (tx_disable is 'On'): + tx_disable_list.append(1) + else: + tx_disable_list.append(0) + tx_disable = tx_disable_data['data']['Tx3Disable']['value'] + if (tx_disable is 'On'): + tx_disable_list.append(1) + else: + tx_disable_list.append(0) + tx_disable = tx_disable_data['data']['Tx4Disable']['value'] + if (tx_disable is 'On'): + tx_disable_list.append(1) + else: + tx_disable_list.append(0) + + bit4 = int(tx_disable_list[3]) * 8 + bit3 = int(tx_disable_list[2]) * 4 + bit2 = int(tx_disable_list[1]) * 2 + bit1 = int(tx_disable_list[0]) * 1 + + tx_disable_channel = hex(bit4 + bit3 + bit2 + bit1) + + return tx_disable_channel + + def get_lpmode(self): + """ + Retrieves the lpmode (low power mode) status of this SFP + """ + lpmode_ctrl = self.sfp_control + 'qsfp_lpmode' + try: + reg_file = open(lpmode_ctrl, "r+") + except IOError as e: + return False + + reg_hex = reg_file.readline().rstrip() + + # content is a string containing the hex + # representation of the register + reg_value = int(reg_hex, 16) + + # Mask off the bit corresponding to our port + if (self.sfp_ctrl_idx > 15): + index = self.sfp_ctrl_idx % 16 + else: + index = self.sfp_ctrl_idx + + mask = (1 << index) + + if ((reg_value & mask) == 0): + lpmode_state = False + else: + lpmode_state = True + + return lpmode_state + + def get_power_override(self): + """ + Retrieves the power-override status of this SFP + """ + power_override_state = None + + # Reset Status + power_override_data = self._get_eeprom_data('power_override') + if (power_override_data is not None): + power_override = power_override_data['data']['PowerOverRide']['value'] + if (power_override is 'On'): + power_override_state = True + else: + power_override_state = False + + return power_override_state + + def get_temperature(self): + """ + Retrieves the temperature of this SFP + """ + temperature = None + + temperature_data = self._get_eeprom_data('Temperature') + if (temperature_data is not None): + temperature = temperature_data['data']['Temperature']['value'] + + return temperature + + def get_voltage(self): + """ + Retrieves the supply voltage of this SFP + """ + voltage = None + + voltage_data = self._get_eeprom_data('Voltage') + if (voltage_data is not None): + voltage = voltage_data['data']['Vcc']['value'] + + return voltage + + def get_tx_bias(self): + """ + Retrieves the TX bias current of this SFP + """ + tx_bias = None + tx_bias_list = [] + + tx_bias_data = self._get_eeprom_data('ChannelMonitor') + if (tx_bias_data is not None): + tx_bias = tx_bias_data['data']['TX1Bias']['value'] + tx_bias_list.append(tx_bias) + tx_bias = tx_bias_data['data']['TX2Bias']['value'] + tx_bias_list.append(tx_bias) + tx_bias = tx_bias_data['data']['TX3Bias']['value'] + tx_bias_list.append(tx_bias) + tx_bias = tx_bias_data['data']['TX4Bias']['value'] + tx_bias_list.append(tx_bias) + + return tx_bias_list + + def get_rx_power(self): + """ + Retrieves the received optical power for this SFP + """ + rx_power = None + rx_power_list = [] + + rx_power_data = self._get_eeprom_data('ChannelMonitor') + if (rx_power_data is not None): + rx_power = rx_power_data['data']['RX1Power']['value'] + rx_power_list.append(rx_power) + rx_power = rx_power_data['data']['RX2Power']['value'] + rx_power_list.append(rx_power) + rx_power = rx_power_data['data']['RX3Power']['value'] + rx_power_list.append(rx_power) + rx_power = rx_power_data['data']['RX4Power']['value'] + rx_power_list.append(rx_power) + + return rx_power_list + + + def get_tx_power(self): + """ + Retrieves the TX power of this SFP + """ + tx_power = None + tx_power_list = [] + + tx_power_list.append('-infdBm') + tx_power_list.append('-infdBm') + tx_power_list.append('-infdBm') + tx_power_list.append('-infdBm') + + return tx_power_list + + def reset(self): + """ + Reset SFP and return all user module settings to their default srate. + """ + reset_ctrl = self.sfp_control + 'qsfp_reset' + try: + # Open reset_ctrl in both read & write mode + reg_file = open(reset_ctrl, "r+") + except IOError as e: + return False + + reg_hex = reg_file.readline().rstrip() + reg_value = int(reg_hex, 16) + + # Mask off the bit corresponding to our port + if (self.sfp_ctrl_idx > 15): + index = self.sfp_ctrl_idx % 16 + else: + index = self.sfp_ctrl_idx + + # Mask off the bit corresponding to our port + mask = (1 << index) + + # ResetL is active low + reg_value = (reg_value & ~mask) + + # Convert our register value back to a + # hex string and write back + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + # Sleep 1 second to allow it to settle + time.sleep(1) + + # Flip the bit back high and write back to the + # register to take port out of reset + try: + reg_file = open(reset_ctrl, "w") + except IOError as e: + return False + + reg_value = reg_value | mask + reg_file.seek(0) + reg_file.write(hex(reg_value)) + reg_file.close() + + return True + + def set_lpmode(self, lpmode): + """ + Sets the lpmode (low power mode) of SFP + """ + lpmode_ctrl = self.sfp_control + 'qsfp_lpmode' + try: + reg_file = open(lpmode_ctrl, "r+") + except IOError as e: + return False + + reg_hex = reg_file.readline().rstrip() + + # content is a string containing the hex + # representation of the register + reg_value = int(reg_hex, 16) + + # Mask off the bit corresponding to our port + if (self.sfp_ctrl_idx > 15): + index = self.sfp_ctrl_idx % 16 + else: + index = self.sfp_ctrl_idx + + mask = (1 << index) + + # LPMode is active high; set or clear the bit accordingly + if lpmode is True: + reg_value = (reg_value | mask) + else: + reg_value = (reg_value & ~mask) + + # Convert our register value back to a hex string and write back + content = hex(reg_value) + + reg_file.seek(0) + reg_file.write(content) + reg_file.close() + + return True diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/__init__.py b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/__init__.py index 497c1429ad89..2be1c8f2588b 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/__init__.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/__init__.py @@ -1,3 +1,3 @@ -__all__ = ["platform", "chassis", "fan", "psu"] +__all__ = ["platform", "chassis", "sfp"] from sonic_platform import * diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/chassis.py index 8e53ec81559b..f912b806d081 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/chassis.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# -# DELLEMC +# DELLEMC Z9100 # # Module contains an implementation of SONiC Platform Base API and # provides the platform information @@ -11,9 +11,16 @@ try: import os from sonic_platform_base.chassis_base import ChassisBase + from sonic_platform.sfp import Sfp + from sonic_platform.fan import Fan + from eeprom import Eeprom except ImportError as e: raise ImportError(str(e) + "- required module not found") +MAX_Z9100_FANTRAY = 5 +MAX_Z9100_FAN = 2 +MAX_Z9100_PSU = 2 + class Chassis(ChassisBase): """ @@ -23,6 +30,27 @@ class Chassis(ChassisBase): HWMON_DIR = "/sys/devices/platform/SMF.512/hwmon/" HWMON_NODE = os.listdir(HWMON_DIR)[0] MAILBOX_DIR = HWMON_DIR + HWMON_NODE + EEPROM_I2C_MAPPING = { + 0: [9, 18], 1: [9, 19], 2: [9, 20], 3: [9, 21], + 4: [9, 22], 5: [9, 23], 6: [9, 24], 7: [9, 25], + 8: [8, 26], 9: [8, 27], 10: [8, 28], 11: [8, 29], + 12: [8, 31], 13: [8, 30], 14: [8, 33], 15: [8, 32], # Remapped 4 entries + 16: [7, 34], 17: [7, 35], 18: [7, 36], 19: [7, 37], + 20: [7, 38], 21: [7, 39], 22: [7, 40], 23: [7, 41], + 24: [6, 42], 25: [6, 43], 26: [6, 44], 27: [6, 45], + 28: [6, 46], 29: [6, 47], 30: [6, 48], 31: [6, 49] + } + PORT_I2C_MAPPING = { + # 0th Index = i2cLine, 1st Index = portIdx in i2cLine + 0: [14, 0], 1: [14, 1], 2: [14, 2], 3: [14, 3], + 4: [14, 4], 5: [14, 5], 6: [14, 6], 7: [14, 7], + 8: [14, 8], 9: [14, 9], 10: [14, 10], 11: [14, 11], + 12: [15, 0], 13: [15, 1], 14: [15, 2], 15: [15, 3], + 16: [15, 4], 17: [15, 5], 18: [15, 6], 19: [15, 7], + 20: [15, 8], 21: [15, 9], 22: [16, 0], 23: [16, 1], + 24: [16, 2], 25: [16, 3], 26: [16, 4], 27: [16, 5], + 28: [16, 6], 29: [16, 7], 30: [16, 8], 31: [16, 9] + } reset_reason_dict = {} reset_reason_dict[11] = ChassisBase.REBOOT_CAUSE_POWER_LOSS @@ -37,9 +65,34 @@ class Chassis(ChassisBase): power_reason_dict[44] = ChassisBase.REBOOT_CAUSE_INSUFFICIENT_FAN_SPEED def __init__(self): - ChassisBase.__init__(self) + PORT_START = 0 + PORT_END = 31 + PORTS_IN_BLOCK = (PORT_END + 1) + + # sfp.py will read eeprom contents and retrive the eeprom data. + # It will also provide support sfp controls like reset and setting + # low power mode. + # We pass the eeprom path and sfp control path from chassis.py + # So that sfp.py implementation can be generic to all platforms + eeprom_base = "/sys/class/i2c-adapter/i2c-{0}/i2c-{1}/{1}-0050/eeprom" + sfp_ctrl_base = "/sys/class/i2c-adapter/i2c-{0}/{0}-003e/" + for index in range(0, PORTS_IN_BLOCK): + eeprom_path = eeprom_base.format(self.EEPROM_I2C_MAPPING[index][0], + self.EEPROM_I2C_MAPPING[index][1]) + sfp_control = sfp_ctrl_base.format(self.PORT_I2C_MAPPING[index][0]) + sfp_node = Sfp(index, 'QSFP', eeprom_path, sfp_control, + self.PORT_I2C_MAPPING[index][1]) + self._sfp_list.append(sfp_node) - def get_pmc_register(self, reg_name): + ChassisBase.__init__(self) + # Initialize EEPROM + self.sys_eeprom = Eeprom() + for i in range(MAX_Z9100_FANTRAY): + for j in range(MAX_Z9100_FAN): + fan = Fan(i, j) + self._fan_list.append(fan) + + def _get_pmc_register(self, reg_name): # On successful read, returns the value read from given # reg_name and on failure returns 'ERR' rv = 'ERR' @@ -58,12 +111,70 @@ def get_pmc_register(self, reg_name): rv = rv.lstrip(" ") return rv + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + return self.sys_eeprom.modelstr() + + def get_presence(self): + """ + Retrieves the presence of the device + Returns: + bool: True if device is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + Returns: + string: Model/part number of device + """ + return self.sys_eeprom.part_number_str() + + def get_serial(self): + """ + Retrieves the serial number of the device (Service tag) + Returns: + string: Serial number of device + """ + return self.sys_eeprom.serial_str() + + 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.sys_eeprom.base_mac_addr() + + 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.sys_eeprom.serial_number_str() + 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. """ - reset_reason = int(self.get_pmc_register('smf_reset_reason')) - power_reason = int(self.get_pmc_register('smf_poweron_reason')) + + reset_reason = int(self._get_pmc_register('smf_reset_reason')) + power_reason = int(self._get_pmc_register('smf_poweron_reason')) # Reset_Reason = 11 ==> PowerLoss # So return the reboot reason from Last Power_Reason Dictionary diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/eeprom.py new file mode 100644 index 000000000000..8be488b791ab --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/eeprom.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python + +############################################################################# +# DellEmc Z9100 +# +# 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 + import binascii +except ImportError, e: + raise ImportError(str(e) + "- required module not found") + + +class Eeprom(eeprom_tlvinfo.TlvInfoDecoder): + + def __init__(self): + self.eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0050/eeprom" + super(Eeprom, self).__init__(self.eeprom_path, 0, '', True) + try: + self.eeprom_data = self.read_eeprom() + except: + self.eeprom_data = "N/A" + raise RuntimeError("Eeprom is not Programmed") + + def serial_number_str(self): + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_SERIAL_NUMBER) + if not is_valid: + return "N/A" + return results[2] + + def base_mac_addr(self): + (is_valid, t) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_MAC_BASE) + if not is_valid or t[1] != 6: + return super(TlvInfoDecoder, self).switchaddrstr(e) + + return ":".join([binascii.b2a_hex(T) for T in t[2]]) + + def modelstr(self): + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_PRODUCT_NAME) + if not is_valid: + return "N/A" + + return results[2] + + def part_number_str(self): + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_PART_NUMBER) + if not is_valid: + return "N/A" + + return results[2] + + def serial_str(self): + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_SERVICE_TAG) + if not is_valid: + return "N/A" + + return results[2] + + def revision_str(self): + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_DEVICE_VERSION) + if not is_valid: + return "N/A" + + return results[2] + diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/fan.py new file mode 100755 index 000000000000..2327e24a2f6d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/fan.py @@ -0,0 +1,222 @@ +#!/usr/bin/env python + +######################################################################## +# DellEMC Z9100 +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Fans' information which are available in the platform. +# +######################################################################## + +import os.path + +try: + from sonic_platform_base.fan_base import FanBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +MAX_Z9100_PSU_FAN_SPEED = 18000 +MAX_Z9100_FAN_SPEED = 16000 + + +class Fan(FanBase): + """DellEMC Platform-specific Fan class""" + + HWMON_DIR = "/sys/devices/platform/SMF.512/hwmon/" + HWMON_NODE = os.listdir(HWMON_DIR)[0] + MAILBOX_DIR = HWMON_DIR + HWMON_NODE + + def __init__(self, fantray_index, fan_index=1, psu_fan=False): + self.is_psu_fan = psu_fan + if not self.is_psu_fan: + # API index is starting from 0, DellEMC platform index is starting + # from 1 + self.fantrayindex = fantray_index + 1 + self.fanindex = fan_index + 1 + self.get_fan_speed_reg = "fan{}_input".format( + 2 * (self.fantrayindex - 1) + (self.fanindex - 1) + 1 ) + self.get_fan_dir_reg = "fan{}_airflow".format( + 2 * self.fantrayindex - 1) + self.fan_serialno_reg = "fan{}_serialno".format( + 2 * self.fantrayindex - 1) + self.max_fan_speed = MAX_Z9100_FAN_SPEED + else: + # PSU Fan index starts from 11 + self.fanindex = fan_index + 10 + self.get_fan_speed_reg = "fan{}_input".format(self.fanindex) + self.max_fan_speed = MAX_Z9100_PSU_FAN_SPEED + + def _get_pmc_register(self, reg_name): + # On successful read, returns the value read from given + # reg_name and on failure returns 'ERR' + rv = 'ERR' + mb_reg_file = self.MAILBOX_DIR+'/'+reg_name + + if (not os.path.isfile(mb_reg_file)): + return rv + try: + with open(mb_reg_file, 'r') as fd: + rv = fd.read() + except Exception as error: + rv = 'ERR' + + rv = rv.rstrip('\r\n') + rv = rv.lstrip(" ") + return rv + + def get_name(self): + """ + Retrieves the fan name + Returns: + string: The name of the device + """ + if not self.is_psu_fan: + return "FanTray{}-Fan{}".format(self.fantrayindex, self.fanindex) + else: + return "PSU{} Fan".format(self.index - 10) + + def get_model(self): + """ + Retrieves the part number of the FAN + Returns: + string: Part number of FAN + """ + # For Serial number "US-01234D-54321-25A-0123-A00", the part + # number is "01234D" + fan_serialno = self._get_pmc_register(self.fan_serialno_reg) + if (fan_serialno != 'ERR') and self.get_presence(): + if (len(fan_serialno.split('-')) > 1): + fan_partno = fan_serialno.split('-')[1] + else: + fan_partno = 'NA' + else: + fan_partno = 'NA' + + return fan_partno + + def get_serial(self): + """ + Retrieves the serial number of the FAN + Returns: + string: Serial number of FAN + """ + # Sample Serial number format "US-01234D-54321-25A-0123-A00" + fan_serialno = self._get_pmc_register(self.fan_serialno_reg) + if (fan_serialno == 'ERR') or not self.get_presence(): + fan_serialno = 'NA' + + return fan_serialno + + def get_presence(self): + """ + Retrieves the presence of the FAN + Returns: + bool: True if fan is present, False if not + """ + status = False + fantray_presence = self._get_pmc_register(self.get_fan_speed_reg) + if (fantray_presence != 'ERR'): + fantray_presence = int(fantray_presence, 10) + if (fantray_presence > 0): + status = True + + return status + + def get_status(self): + """ + Retrieves the operational status of the FAN + Returns: + bool: True if FAN is operating properly, False if not + """ + status = False + fantray_status = self._get_pmc_register(self.get_fan_speed_reg) + if (fantray_status != 'ERR'): + fantray_status = int(fantray_status, 10) + if (fantray_status > 5000): + status = True + + return status + + def get_direction(self): + """ + Retrieves the fan airflow direction + Returns: + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + """ + direction = ['FAN_DIRECTION_INTAKE', 'FAN_DIRECTION_EXHAUST'] + fan_direction = self._get_pmc_register(self.get_fan_dir_reg) + if (fan_direction != 'ERR') and self.get_presence(): + fan_direction = int(fan_direction, 10) + else: + return 'N/A' + return direction[fan_direction] + + def get_speed(self): + """ + Retrieves the speed of fan + Returns: + int: percentage of the max fan speed + """ + fan_speed = self._get_pmc_register(self.get_fan_speed_reg) + if (fan_speed != 'ERR') and self.get_presence(): + speed_in_rpm = int(fan_speed, 10) + speed = (100 * speed_in_rpm)/self.max_fan_speed + else: + speed = 0 + + return 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 + """ + if self.get_presence(): + # The tolerance value is fixed as 20% for all the DellEmc platform + tolerance = 20 + else: + tolerance = 0 + + return tolerance + + def set_speed(self, speed): + """ + Set fan speed to expected value + Args: + speed: An integer, the percentage of full fan speed to set fan to, + in the range 0 (off) to 100 (full speed) + Returns: + bool: True if set success, False if fail. + """ + + # Fan speeds are controlled by Smart-fussion FPGA. + return False + + def set_status_led(self, color): + """ + Set led to expected color + Args: + color: A string representing the color with which to set the + fan module status LED + Returns: + bool: True if set success, False if fail. + """ + # Leds are controlled by Smart-fussion FPGA. + status = False + return status + + 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 0 + + + + diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/sfp.py new file mode 120000 index 000000000000..84af7963bb3d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/sfp.py @@ -0,0 +1 @@ +../../s6100/sonic_platform/sfp.py \ No newline at end of file diff --git a/platform/broadcom/sonic-platform-modules-dell/z9264f/modules/dell_z9264f_fpga_ocores.c b/platform/broadcom/sonic-platform-modules-dell/z9264f/modules/dell_z9264f_fpga_ocores.c index d3a4a51ead72..05877ec3c96d 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9264f/modules/dell_z9264f_fpga_ocores.c +++ b/platform/broadcom/sonic-platform-modules-dell/z9264f/modules/dell_z9264f_fpga_ocores.c @@ -654,15 +654,20 @@ static void fpgai2c_process(struct fpgalogic_i2c *i2c) } } - if (i2c->state == STATE_READ) { + switch (i2c->state) { + case STATE_READ: PRINT("fpgai2c_poll STATE_READ i2c->pos=%d msg->len-1 = 0x%x set FPGAI2C_REG_CMD = 0x%x\n",i2c->pos, msg->len-1, i2c->pos == (msg->len-1) ? FPGAI2C_REG_CMD_READ_NACK : FPGAI2C_REG_CMD_READ_ACK); fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, i2c->pos == (msg->len-1) ? FPGAI2C_REG_CMD_READ_NACK : FPGAI2C_REG_CMD_READ_ACK); - } else { + break; + case STATE_WRITE: PRINT("fpgai2c_process set FPGAI2C_REG_DATA(0x%x)\n",FPGAI2C_REG_DATA); fpgai2c_reg_set(i2c, FPGAI2C_REG_DATA, msg->buf[i2c->pos++]); fpgai2c_reg_set(i2c, FPGAI2C_REG_CMD, FPGAI2C_REG_CMD_WRITE); + break; + default: + printk("Unexpected state, %s:%u state=%d\n", __FILE__, __LINE__, i2c->state); } } diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_common.h b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_common.h index 5be2eb91fedf..da9175088786 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_common.h +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_common.h @@ -14,8 +14,10 @@ #define IPMI_MAX_INTF (4) #define DELTA_NETFN 0x38 #define BMC_BUS_5 0x04 +#define BMC_BUS_1 0x00 #define CMD_SETDATA 0x03 #define CMD_GETDATA 0x02 +#define CMD_DEVICE_SCAN 0x01 #define CPUPLD_ADDR 0x31 #define SWPLD1_ADDR 0x35 @@ -23,19 +25,27 @@ #define SWPLD3_ADDR 0x33 #define SWPLD4_ADDR 0x32 #define QSFP_PORT_MUX_REG 0x13 +#define PSU1_EEPROM_ADDR 0x50 +#define PSU2_EEPROM_ADDR 0x51 #define DEFAULT_NUM 1 #define BUS9_DEV_NUM 64 #define BUS9_BASE_NUM 20 +#define EEPROM_SIZE 640 +#define EEPROM_ARCH_SIZE 256 +#define EEPROM_MASK 20 +#define ATTR_R 1 +#define ATTR_W 2 extern int dni_bmc_cmd(char set_cmd, char *cmd_data, int cmd_data_len); extern int dni_create_user(void); extern unsigned char dni_log2 (unsigned char num); - extern void device_release(struct device *dev); extern void msg_handler(struct ipmi_recv_msg *recv_msg,void* handler_data); extern void dummy_smi_free(struct ipmi_smi_msg *msg); extern void dummy_recv_free(struct ipmi_recv_msg *msg); +extern void dni_klock(void); +extern void dni_kunlock(void); static ipmi_user_t ipmi_mh_user = NULL; static struct ipmi_user_hndl ipmi_hndlrs = { .ipmi_recv_hndl = msg_handler,}; @@ -129,6 +139,8 @@ enum cpld_attributes { SWPLD3_REG_VALUE, SWPLD4_REG_ADDR, SWPLD4_REG_VALUE, + PSU1_SCAN, + PSU2_SCAN, //CPLD CPLD_VER, CPU_BOARD_VER, @@ -203,6 +215,73 @@ enum cpld_attributes { FAN_EEPROM_WP, }; +enum sfp_attributes{ + EEPROM_SFP_1, + EEPROM_SFP_2, + EEPROM_SFP_3, + EEPROM_SFP_4, + EEPROM_SFP_5, + EEPROM_SFP_6, + EEPROM_SFP_7, + EEPROM_SFP_8, + EEPROM_SFP_9, + EEPROM_SFP_10, + EEPROM_SFP_11, + EEPROM_SFP_12, + EEPROM_SFP_13, + EEPROM_SFP_14, + EEPROM_SFP_15, + EEPROM_SFP_16, + EEPROM_SFP_17, + EEPROM_SFP_18, + EEPROM_SFP_19, + EEPROM_SFP_20, + EEPROM_SFP_21, + EEPROM_SFP_22, + EEPROM_SFP_23, + EEPROM_SFP_24, + EEPROM_SFP_25, + EEPROM_SFP_26, + EEPROM_SFP_27, + EEPROM_SFP_28, + EEPROM_SFP_29, + EEPROM_SFP_30, + EEPROM_SFP_31, + EEPROM_SFP_32, + EEPROM_SFP_33, + EEPROM_SFP_34, + EEPROM_SFP_35, + EEPROM_SFP_36, + EEPROM_SFP_37, + EEPROM_SFP_38, + EEPROM_SFP_39, + EEPROM_SFP_40, + EEPROM_SFP_41, + EEPROM_SFP_42, + EEPROM_SFP_43, + EEPROM_SFP_44, + EEPROM_SFP_45, + EEPROM_SFP_46, + EEPROM_SFP_47, + EEPROM_SFP_48, + EEPROM_SFP_49, + EEPROM_SFP_50, + EEPROM_SFP_51, + EEPROM_SFP_52, + EEPROM_SFP_53, + EEPROM_SFP_54, + EEPROM_SFP_55, + EEPROM_SFP_56, + EEPROM_SFP_57, + EEPROM_SFP_58, + EEPROM_SFP_59, + EEPROM_SFP_60, + EEPROM_SFP_61, + EEPROM_SFP_62, + EEPROM_SFP_63, + EEPROM_SFP_64, +}; + static struct cpld_attribute_data attribute_data[] = { [CPLD_REG_ADDR] = { }, @@ -564,4 +643,4 @@ static struct cpld_attribute_data attribute_data[] = { .reg = 0x15, .mask = 1 << 2, .note = "“1” = enables the lock-down mechanism.\n“0” = overrides the lock-down function enabling blocks to be erased or programmed using software commands." }, -}; \ No newline at end of file +}; diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_cpld.c b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_cpld.c index 97e1b640010b..75bab55d7e2c 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_cpld.c +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_cpld.c @@ -65,9 +65,10 @@ static ssize_t get_present(struct device *dev, struct device_attribute \ uint8_t cmd_data[4]={0}; uint8_t set_cmd; int cmd_data_len; - set_cmd = CMD_GETDATA; + dni_klock(); + /*QSFP1~8*/ cmd_data[0] = BMC_BUS_5; cmd_data[1] = SWPLD1_ADDR; @@ -119,6 +120,7 @@ static ssize_t get_present(struct device *dev, struct device_attribute \ ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); data |= (u64)(ret & 0xff) << 56; + dni_kunlock(); return sprintf(buf, "0x%016llx\n", data); } @@ -130,9 +132,10 @@ static ssize_t get_lpmode(struct device *dev, struct device_attribute \ uint8_t cmd_data[4]={0}; uint8_t set_cmd; int cmd_data_len; - set_cmd = CMD_GETDATA; + dni_klock(); + /*QSFP1~8*/ cmd_data[0] = BMC_BUS_5; cmd_data[1] = SWPLD1_ADDR; @@ -184,6 +187,8 @@ static ssize_t get_lpmode(struct device *dev, struct device_attribute \ ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); data |= (u64)(ret & 0xff) << 56; + dni_kunlock(); + return sprintf(buf, "0x%016llx\n", data); } @@ -195,9 +200,10 @@ static ssize_t get_reset(struct device *dev, struct device_attribute \ uint8_t cmd_data[4]={0}; uint8_t set_cmd; int cmd_data_len; - set_cmd = CMD_GETDATA; + dni_klock(); + /*QSFP1~8*/ cmd_data[0] = BMC_BUS_5; cmd_data[1] = SWPLD1_ADDR; @@ -249,6 +255,8 @@ static ssize_t get_reset(struct device *dev, struct device_attribute \ ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); data |= (u64)(ret & 0xff) << 56; + dni_kunlock(); + return sprintf(buf, "0x%016llx\n", data); } @@ -260,9 +268,10 @@ static ssize_t get_response(struct device *dev, struct device_attribute \ uint8_t cmd_data[4]={0}; uint8_t set_cmd; int cmd_data_len; - set_cmd = CMD_GETDATA; + dni_klock(); + /*QSFP1~8*/ cmd_data[0] = BMC_BUS_5; cmd_data[1] = SWPLD1_ADDR; @@ -314,6 +323,8 @@ static ssize_t get_response(struct device *dev, struct device_attribute \ ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); data |= (u64)(ret & 0xff) << 56; + dni_kunlock(); + return sprintf(buf, "0x%016llx\n", data); } @@ -325,9 +336,10 @@ static ssize_t get_interrupt(struct device *dev, struct device_attribute \ uint8_t cmd_data[4]={0}; uint8_t set_cmd; int cmd_data_len; - set_cmd = CMD_GETDATA; + dni_klock(); + /*QSFP1~8*/ cmd_data[0] = BMC_BUS_5; cmd_data[1] = SWPLD1_ADDR; @@ -379,6 +391,8 @@ static ssize_t get_interrupt(struct device *dev, struct device_attribute \ ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); data |= (u64)(ret & 0xff) << 56; + dni_kunlock(); + return sprintf(buf, "0x%016llx\n", data); } @@ -386,16 +400,19 @@ static ssize_t set_lpmode(struct device *dev, struct device_attribute *devattr, { unsigned long long set_data; int err; - + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + set_cmd = CMD_SETDATA; + + dni_klock(); + err = kstrtoull(buf, 16, &set_data); if (err){ + dni_kunlock(); return err; } - uint8_t cmd_data[4]={0}; - uint8_t set_cmd; - int cmd_data_len; - set_cmd = CMD_SETDATA; /*QSFP1~8*/ cmd_data[0] = BMC_BUS_5; cmd_data[1] = SWPLD1_ADDR; @@ -446,6 +463,8 @@ static ssize_t set_lpmode(struct device *dev, struct device_attribute *devattr, cmd_data[3] = ((set_data >> 56 ) & 0xff); dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + dni_kunlock(); + return count; } @@ -453,16 +472,18 @@ static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, c { unsigned long long set_data; int err; + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + set_cmd = CMD_SETDATA; + + dni_klock(); err = kstrtoull(buf, 16, &set_data); if (err){ + dni_kunlock(); return err; } - uint8_t cmd_data[4]={0}; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_SETDATA; /*QSFP1~8*/ cmd_data[0] = BMC_BUS_5; @@ -514,6 +535,8 @@ static ssize_t set_reset(struct device *dev, struct device_attribute *devattr, c cmd_data[3] = ((set_data >> 56 ) & 0xff); dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + dni_kunlock(); + return count; } @@ -521,16 +544,18 @@ static ssize_t set_response(struct device *dev, struct device_attribute *devattr { unsigned long long set_data; int err; + uint8_t cmd_data[4]={0}; + uint8_t set_cmd; + int cmd_data_len; + set_cmd = CMD_SETDATA; + + dni_klock(); err = kstrtoull(buf, 16, &set_data); if (err){ + dni_kunlock(); return err; } - uint8_t cmd_data[4]={0}; - uint8_t set_cmd; - int cmd_data_len; - - set_cmd = CMD_SETDATA; /*QSFP1~8*/ cmd_data[0] = BMC_BUS_5; @@ -581,10 +606,38 @@ static ssize_t set_response(struct device *dev, struct device_attribute *devattr cmd_data[2] = QSFP_RESPONSE_8; cmd_data[3] = ((set_data >> 56 ) & 0xff); dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + + dni_kunlock(); return count; } +static ssize_t psu_scan(struct device *dev, struct device_attribute *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + int ret; + uint8_t cmd_data[2]={0}; + uint8_t set_cmd; + int cmd_data_len; + set_cmd = CMD_DEVICE_SCAN; + + dni_klock(); + cmd_data[0] = BMC_BUS_1; + switch (attr->index) + { + case PSU1_SCAN: + cmd_data[1] = PSU1_EEPROM_ADDR; + break; + case PSU2_SCAN: + cmd_data[1] = PSU2_EEPROM_ADDR; + break; + } + cmd_data_len = sizeof(cmd_data); + ret = dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + dni_kunlock(); + return sprintf(buf, "0x%x\n", ret); +} + static ssize_t get_cpld_reg(struct device *dev, struct device_attribute *dev_attr, char *buf) { int ret; @@ -594,12 +647,16 @@ static ssize_t get_cpld_reg(struct device *dev, struct device_attribute *dev_att unsigned char reg; struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); struct cpld_platform_data *pdata = dev->platform_data; + + dni_klock(); switch (attr->index) { case CPLD_REG_ADDR: + dni_kunlock(); return sprintf(buf, "0x%02x\n", cpupld_reg_addr); case CPLD_REG_VALUE: ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, cpupld_reg_addr); + dni_kunlock(); return sprintf(buf, "0x%02x\n", ret); case CPLD_VER ... OP_MODULE_INT: reg = attribute_data[attr->index].reg; @@ -609,21 +666,28 @@ static ssize_t get_cpld_reg(struct device *dev, struct device_attribute *dev_att value = (value & mask); break; default: + dni_kunlock(); return sprintf(buf, "%d not found", attr->index); } switch (mask) { case 0xFF: + dni_kunlock(); return sprintf(buf, "0x%02x%s", value, note); case 0x0F: + dni_kunlock(); return sprintf(buf, "0x%01x%s", value, note); case 0xF0: value = value >> 4; + dni_kunlock(); return sprintf(buf, "0x%01x%s", value, note); default : value = value >> dni_log2(mask); + dni_kunlock(); return sprintf(buf, "%d%s", value, note); } + dni_kunlock(); + return sprintf(buf, "%d not found", attr->index); } static ssize_t set_cpld_reg(struct device *dev, struct device_attribute *dev_attr, @@ -636,27 +700,32 @@ static ssize_t set_cpld_reg(struct device *dev, struct device_attribute *dev_att unsigned char reg; unsigned char mask; unsigned char mask_out; - struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); struct cpld_platform_data *pdata = dev->platform_data; + dni_klock(); + err = kstrtoul(buf, 0, &set_data_ul); if (err){ + dni_kunlock(); return err; } set_data = (int)set_data_ul; if (set_data > 0xff){ printk(KERN_ALERT "address out of range (0x00-0xFF)\n"); + dni_kunlock(); return count; } switch (attr->index) { case CPLD_REG_ADDR: cpupld_reg_addr = set_data; + dni_kunlock(); return count; case CPLD_REG_VALUE: i2c_smbus_write_byte_data(pdata[system_cpld].client, cpupld_reg_addr, set_data); + dni_kunlock(); return count; case CPLD_VER ... OP_MODULE_INT: reg = attribute_data[attr->index].reg; @@ -665,6 +734,7 @@ static ssize_t set_cpld_reg(struct device *dev, struct device_attribute *dev_att mask_out = value & ~(mask); break; default: + dni_kunlock(); return sprintf(buf, "%d not found", attr->index); } @@ -684,6 +754,7 @@ static ssize_t set_cpld_reg(struct device *dev, struct device_attribute *dev_att } i2c_smbus_write_byte_data(pdata[system_cpld].client, reg, set_data); + dni_kunlock(); return count; } @@ -712,6 +783,8 @@ static SENSOR_DEVICE_ATTR(mb_pwr, S_IRUGO, get_cpld_reg, NU static SENSOR_DEVICE_ATTR(mb_rst, S_IRUGO | S_IWUSR, get_cpld_reg, set_cpld_reg, MB_RST); static SENSOR_DEVICE_ATTR(psu_fan_int, S_IRUGO, get_cpld_reg, NULL, PSU_FAN_INT); static SENSOR_DEVICE_ATTR(op_module_int, S_IRUGO, get_cpld_reg, NULL, OP_MODULE_INT); +static SENSOR_DEVICE_ATTR(psu1_scan, S_IRUGO, psu_scan, NULL, PSU1_SCAN); +static SENSOR_DEVICE_ATTR(psu2_scan, S_IRUGO, psu_scan, NULL, PSU2_SCAN); static struct attribute *ag9064_cpld_attrs[] = { &dev_attr_qsfp_present.attr, @@ -738,6 +811,8 @@ static struct attribute *ag9064_cpld_attrs[] = { &sensor_dev_attr_mb_rst.dev_attr.attr, &sensor_dev_attr_psu_fan_int.dev_attr.attr, &sensor_dev_attr_op_module_int.dev_attr.attr, + &sensor_dev_attr_psu1_scan.dev_attr.attr, + &sensor_dev_attr_psu2_scan.dev_attr.attr, NULL, }; @@ -823,11 +898,6 @@ static int __init delta_ag9064_cpupld_init(void) int ret; printk(KERN_WARNING "ag9064_platform_cpupld module initialization\n"); - ret = dni_create_user(); - if (ret != 0){ - printk(KERN_WARNING "Fail to create IPMI user\n"); - } - // set the CPUPLD prob and remove ret = platform_driver_register(&cpld_driver); if (ret) { diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_platform.c b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_platform.c index 099d7ea987da..4de9799d4601 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_platform.c +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_platform.c @@ -7,15 +7,13 @@ #include #include #include +#include +#include +#include +#include #include "delta_ag9064_common.h" -#define SFF8436_INFO(data) \ - .type = "sff8436", .addr = 0x50, .platform_data = (data) - -#define SFF_8346_PORT(eedata) \ - .byte_len = 256, .page_size = 1, .flags = SFF_8436_FLAG_READONLY - #define ag9064_i2c_device_num(NUM){ \ .name = "delta-ag9064-i2c-device", \ .id = NUM, \ @@ -26,7 +24,19 @@ } struct i2c_client * i2c_client_9548; +static struct kobject *kobj_sfp; +struct mutex dni_lock;; +void dni_klock(void) +{ + mutex_lock(&dni_lock); +} +EXPORT_SYMBOL(dni_klock); +void dni_kunlock(void) +{ + mutex_unlock(&dni_lock); +} +EXPORT_SYMBOL(dni_kunlock); /* pca9548 - add 8 bus */ static struct pca954x_platform_mode pca954x_mode[] = @@ -79,73 +89,6 @@ static struct i2c_board_info __initdata i2c_info_pca9548[] = }, }; -static struct sff_8436_platform_data sff_8436_port[] = { - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, - { SFF_8346_PORT() }, -}; - void device_release(struct device *dev) { return; @@ -245,6 +188,17 @@ int dni_bmc_cmd(char set_cmd, char *cmd_data, int cmd_data_len) printk(KERN_ERR "IPMI set error!\n"); return -6; } + case CMD_DEVICE_SCAN: + if( rv == 0) + { + return halt_recv_msg.msg.data[1]; + } + else + { + printk(KERN_ERR "IPMI scan error!\n"); + return -6; + } + break; } ipmi_free_recv_msg(&halt_recv_msg); @@ -278,385 +232,385 @@ static struct i2c_device_platform_data ag9064_i2c_device_platform_data[] = { { /* qsfp 1 (0x50) */ .parent = 20, - .info = { SFF8436_INFO(&sff_8436_port[0]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 2 (0x50) */ .parent = 21, - .info = { SFF8436_INFO(&sff_8436_port[1]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 3 (0x50) */ .parent = 22, - .info = { SFF8436_INFO(&sff_8436_port[2]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 4 (0x50) */ .parent = 23, - .info = { SFF8436_INFO(&sff_8436_port[3]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 5 (0x50) */ .parent = 24, - .info = { SFF8436_INFO(&sff_8436_port[4]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 6 (0x50) */ .parent = 25, - .info = { SFF8436_INFO(&sff_8436_port[5]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 7 (0x50) */ .parent = 26, - .info = { SFF8436_INFO(&sff_8436_port[6]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 8 (0x50) */ .parent = 27, - .info = { SFF8436_INFO(&sff_8436_port[7]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 9 (0x50) */ .parent = 28, - .info = { SFF8436_INFO(&sff_8436_port[8]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 10 (0x50) */ .parent = 29, - .info = { SFF8436_INFO(&sff_8436_port[9]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 11 (0x50) */ .parent = 30, - .info = { SFF8436_INFO(&sff_8436_port[10]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 12 (0x50) */ .parent = 31, - .info = { SFF8436_INFO(&sff_8436_port[11]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 13 (0x50) */ .parent = 32, - .info = { SFF8436_INFO(&sff_8436_port[12]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 14 (0x50) */ .parent = 33, - .info = { SFF8436_INFO(&sff_8436_port[13]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 15 (0x50) */ .parent = 34, - .info = { SFF8436_INFO(&sff_8436_port[14]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 16 (0x50) */ .parent = 35, - .info = { SFF8436_INFO(&sff_8436_port[15]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 17 (0x50) */ .parent = 36, - .info = { SFF8436_INFO(&sff_8436_port[16]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 18 (0x50) */ .parent = 37, - .info = { SFF8436_INFO(&sff_8436_port[17]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 19 (0x50) */ .parent = 38, - .info = { SFF8436_INFO(&sff_8436_port[18]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 20 (0x50) */ .parent = 39, - .info = { SFF8436_INFO(&sff_8436_port[19]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 21 (0x50) */ .parent = 40, - .info = { SFF8436_INFO(&sff_8436_port[20]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 22 (0x50) */ .parent = 41, - .info = { SFF8436_INFO(&sff_8436_port[21]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 23 (0x50) */ .parent = 42, - .info = { SFF8436_INFO(&sff_8436_port[22]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 24 (0x50) */ .parent = 43, - .info = { SFF8436_INFO(&sff_8436_port[23]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 25 (0x50) */ .parent = 44, - .info = { SFF8436_INFO(&sff_8436_port[24]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 26 (0x50) */ .parent = 45, - .info = { SFF8436_INFO(&sff_8436_port[25]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 27 (0x50) */ .parent = 46, - .info = { SFF8436_INFO(&sff_8436_port[26]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 28 (0x50) */ .parent = 47, - .info = { SFF8436_INFO(&sff_8436_port[27]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 29 (0x50) */ .parent = 48, - .info = { SFF8436_INFO(&sff_8436_port[28]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 30 (0x50) */ .parent = 49, - .info = { SFF8436_INFO(&sff_8436_port[29]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 31 (0x50) */ .parent = 50, - .info = { SFF8436_INFO(&sff_8436_port[30]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 32 (0x50) */ .parent = 51, - .info = { SFF8436_INFO(&sff_8436_port[31]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 33 (0x50) */ .parent = 52, - .info = { SFF8436_INFO(&sff_8436_port[32]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 34 (0x50) */ .parent = 53, - .info = { SFF8436_INFO(&sff_8436_port[33]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 35 (0x50) */ .parent = 54, - .info = { SFF8436_INFO(&sff_8436_port[34]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 36 (0x50) */ .parent = 55, - .info = { SFF8436_INFO(&sff_8436_port[35]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 37 (0x50) */ .parent = 56, - .info = { SFF8436_INFO(&sff_8436_port[36]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 38 (0x50) */ .parent = 57, - .info = { SFF8436_INFO(&sff_8436_port[37]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 39 (0x50) */ .parent = 58, - .info = { SFF8436_INFO(&sff_8436_port[38]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 40 (0x50) */ .parent = 59, - .info = { SFF8436_INFO(&sff_8436_port[39]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 41 (0x50) */ .parent = 60, - .info = { SFF8436_INFO(&sff_8436_port[40]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 42 (0x50) */ .parent = 61, - .info = { SFF8436_INFO(&sff_8436_port[41]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 43 (0x50) */ .parent = 62, - .info = { SFF8436_INFO(&sff_8436_port[42]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 44 (0x50) */ .parent = 63, - .info = { SFF8436_INFO(&sff_8436_port[43]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 45 (0x50) */ .parent = 64, - .info = { SFF8436_INFO(&sff_8436_port[44]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 46 (0x50) */ .parent = 65, - .info = { SFF8436_INFO(&sff_8436_port[45]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 47 (0x50) */ .parent = 66, - .info = { SFF8436_INFO(&sff_8436_port[46]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 48 (0x50) */ .parent = 67, - .info = { SFF8436_INFO(&sff_8436_port[47]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 49 (0x50) */ .parent = 68, - .info = { SFF8436_INFO(&sff_8436_port[48]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 50 (0x50) */ .parent = 69, - .info = { SFF8436_INFO(&sff_8436_port[49]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 51 (0x50) */ .parent = 70, - .info = { SFF8436_INFO(&sff_8436_port[50]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 52 (0x50) */ .parent = 71, - .info = { SFF8436_INFO(&sff_8436_port[51]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 53 (0x50) */ .parent = 72, - .info = { SFF8436_INFO(&sff_8436_port[52]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 54 (0x50) */ .parent = 73, - .info = { SFF8436_INFO(&sff_8436_port[53]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 55 (0x50) */ .parent = 74, - .info = { SFF8436_INFO(&sff_8436_port[54]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 56 (0x50) */ .parent = 75, - .info = { SFF8436_INFO(&sff_8436_port[55]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 57 (0x50) */ .parent = 76, - .info = { SFF8436_INFO(&sff_8436_port[56]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 58 (0x50) */ .parent = 77, - .info = { SFF8436_INFO(&sff_8436_port[57]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 59 (0x50) */ .parent = 78, - .info = { SFF8436_INFO(&sff_8436_port[58]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 60 (0x50) */ .parent = 79, - .info = { SFF8436_INFO(&sff_8436_port[59]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 61 (0x50) */ .parent = 80, - .info = { SFF8436_INFO(&sff_8436_port[60]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 62 (0x50) */ .parent = 81, - .info = { SFF8436_INFO(&sff_8436_port[61]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 63 (0x50) */ .parent = 82, - .info = { SFF8436_INFO(&sff_8436_port[62]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, { /* qsfp 64 (0x50) */ .parent = 83, - .info = { SFF8436_INFO(&sff_8436_port[63]) }, + .info = { I2C_BOARD_INFO("optoe1", 0x50) }, .client = NULL, }, }; @@ -798,7 +752,6 @@ static struct platform_driver i2c_device_driver = { struct swpld_mux_platform_data { int parent; int base_nr; -// struct i2c_client *cpld; }; struct swpld_mux { @@ -811,7 +764,6 @@ static struct swpld_mux_platform_data ag9064_swpld_mux_platform_data[] = { { .parent = BUS9, .base_nr = BUS9_BASE_NUM, -// .cpld = NULL, }, }; @@ -826,31 +778,7 @@ static struct platform_device ag9064_swpld_mux[] = }, }, }; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) -static int swpld_mux_select(struct i2c_adapter *adap, void *data, u8 chan) -{ - uint8_t cmd_data[4]={0}; - struct swpld_mux *mux = data; - uint8_t set_cmd; - int cmd_data_len; - if ( mux->data.base_nr == BUS9_BASE_NUM ) - { - set_cmd = CMD_SETDATA; - cmd_data[0] = BMC_BUS_5; - cmd_data[1] = SWPLD2_ADDR; - cmd_data[2] = QSFP_PORT_MUX_REG; - cmd_data[3] = chan + 1; - cmd_data_len = sizeof(cmd_data); - return dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); - } - else - { - printk(KERN_ERR "Swpld mux QSFP select port error\n"); - return 0; - } -} -#else static int swpld_mux_select(struct i2c_mux_core *muxc, u32 chan) { uint8_t cmd_data[4]={0}; @@ -875,84 +803,7 @@ static int swpld_mux_select(struct i2c_mux_core *muxc, u32 chan) } } -#endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) -static int __init swpld_mux_probe(struct platform_device *pdev) -{ - struct swpld_mux *mux; - struct swpld_mux_platform_data *pdata; - struct i2c_adapter *parent; - int i, ret, dev_num; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "SWPLD platform data not found\n"); - return -ENODEV; - } - - parent = i2c_get_adapter(pdata->parent); - if (!parent) { - dev_err(&pdev->dev, "Parent adapter (%d) not found\n", pdata->parent); - return -ENODEV; - } - /* Judge bus number to decide how many devices*/ - switch (pdata->parent) { - case BUS9: - dev_num = BUS9_DEV_NUM; - break; - default : - dev_num = DEFAULT_NUM; - break; - } - - mux = kzalloc(sizeof(*mux), GFP_KERNEL); - if (!mux) { - ret = -ENOMEM; - printk(KERN_ERR "Failed to allocate memory for mux\n"); - goto alloc_failed; - } - - mux->parent = parent; - mux->data = *pdata; - mux->child = kzalloc(sizeof(struct i2c_adapter *) * dev_num, GFP_KERNEL); - if (!mux->child) { - ret = -ENOMEM; - printk(KERN_ERR "Failed to allocate memory for device on mux\n"); - goto alloc_failed2; - } - - for (i = 0; i < dev_num; i++) - { - int nr = pdata->base_nr + i; - unsigned int class = 0; - - mux->child[i] = i2c_add_mux_adapter(parent, &pdev->dev, mux, - nr, i, class, - swpld_mux_select, NULL); - if (!mux->child[i]) - { - ret = -ENODEV; - dev_err(&pdev->dev, "Failed to add adapter %d\n", i); - goto add_adapter_failed; - } - } - - platform_set_drvdata(pdev, mux); - return 0; - -add_adapter_failed: - for (; i > 0; i--) - i2c_del_mux_adapter(mux->child[i - 1]); - kfree(mux->child); -alloc_failed2: - kfree(mux); -alloc_failed: - i2c_put_adapter(parent); - - return ret; -} -#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) static int __init swpld_mux_probe(struct platform_device *pdev) { struct i2c_mux_core *muxc; @@ -1012,56 +863,13 @@ static int __init swpld_mux_probe(struct platform_device *pdev) add_adapter_failed: i2c_mux_del_adapters(muxc); -alloc_failed2: - kfree(mux); alloc_failed: i2c_put_adapter(parent); + kfree(mux); return ret; } -#endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0) -static int __exit swpld_mux_remove(struct platform_device *pdev) -{ - int i; - struct swpld_mux *mux = platform_get_drvdata(pdev); - struct swpld_mux_platform_data *pdata; - struct i2c_adapter *parent; - int dev_num; - - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "SWPLD platform data not found\n"); - return -ENODEV; - } - - parent = i2c_get_adapter(pdata->parent); - if (!parent) { - dev_err(&pdev->dev, "Parent adapter (%d) not found\n", - pdata->parent); - return -ENODEV; - } - switch (pdata->parent) { - case BUS9: - dev_num = BUS9_DEV_NUM; - break; - default : - dev_num = DEFAULT_NUM; - break; - } - - for (i = 0; i < dev_num; i++) - i2c_del_mux_adapter(mux->child[i]); - - platform_set_drvdata(pdev, NULL); - i2c_put_adapter(mux->parent); - kfree(mux->child); - kfree(mux); - - return 0; -} -#else // #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0) static int __exit swpld_mux_remove(struct platform_device *pdev) { struct i2c_mux_core *muxc = platform_get_drvdata(pdev); @@ -1072,7 +880,6 @@ static int __exit swpld_mux_remove(struct platform_device *pdev) return 0; } -#endif static struct platform_driver swpld_mux_driver = { .probe = swpld_mux_probe, @@ -1085,18 +892,401 @@ static struct platform_driver swpld_mux_driver = { /*---------------- MUX - end ------------- */ +/*---------------- SFP - start ------------- */ + +struct delta_bin_attribute { + struct bin_attribute attr; + int index; +}; + +#define to_delta_attr(x) container_of(x, struct delta_bin_attribute, attr) + +#define BIN_ATTR(_name, _mode, _read, _write, _size, _index) { \ + .attr = { \ + .attr = {.name = __stringify(_name), .mode = _mode }, \ + .read = _read, \ + .write = _write, \ + .size = _size, \ + }, \ + .index = _index, \ +} + +#define DELTA_BIN_ATTR(_name, _mode, _read, _write, _size, _index) \ +struct delta_bin_attribute delta_attr_##_name \ + = BIN_ATTR(_name, _mode, _read, _write, _size, _index) + +static char eeprom_data[EEPROM_SIZE]; + +static ssize_t access_user_space(const char *name, char *buf, size_t len, loff_t offset, int mode) +{ + struct file *fp; + mm_segment_t fs; + loff_t pos = offset; + ssize_t vfs_ret = 0; + int i = 0; + + fs = get_fs(); + set_fs(get_ds()); + + switch(mode) + { + case ATTR_W: + fp = filp_open(name, O_WRONLY, S_IWUGO); + if (IS_ERR(fp)){ + return -ENOENT; + } + for(i = 0; i < ((len / EEPROM_ARCH_SIZE) + 1); i++) + { + len = len - pos; + vfs_ret = vfs_write(fp, buf + pos, len, &pos); + } + break; + case ATTR_R: + fp = filp_open(name, O_RDONLY, S_IRUGO); + if (IS_ERR(fp)){ + return -ENOENT; + } + vfs_ret = vfs_read(fp, buf, len, &pos); + break; + } + + set_fs(fs); + filp_close(fp, NULL); + return vfs_ret; +} + +static ssize_t delta_bin_attr_read(struct file *filp, struct kobject *kobj, struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct delta_bin_attribute *delta_attr = to_delta_attr(attr); + char attr_path[100]; + + dni_klock(); + + memset(buf, 0, count); + switch(delta_attr->index) { + case EEPROM_SFP_1: + case EEPROM_SFP_2: + case EEPROM_SFP_3: + case EEPROM_SFP_4: + case EEPROM_SFP_5: + case EEPROM_SFP_6: + case EEPROM_SFP_7: + case EEPROM_SFP_8: + case EEPROM_SFP_9: + case EEPROM_SFP_10: + case EEPROM_SFP_11: + case EEPROM_SFP_12: + case EEPROM_SFP_13: + case EEPROM_SFP_14: + case EEPROM_SFP_15: + case EEPROM_SFP_16: + case EEPROM_SFP_17: + case EEPROM_SFP_18: + case EEPROM_SFP_19: + case EEPROM_SFP_20: + case EEPROM_SFP_21: + case EEPROM_SFP_22: + case EEPROM_SFP_23: + case EEPROM_SFP_24: + case EEPROM_SFP_25: + case EEPROM_SFP_26: + case EEPROM_SFP_27: + case EEPROM_SFP_28: + case EEPROM_SFP_29: + case EEPROM_SFP_30: + case EEPROM_SFP_31: + case EEPROM_SFP_32: + case EEPROM_SFP_33: + case EEPROM_SFP_34: + case EEPROM_SFP_35: + case EEPROM_SFP_36: + case EEPROM_SFP_37: + case EEPROM_SFP_38: + case EEPROM_SFP_39: + case EEPROM_SFP_40: + case EEPROM_SFP_41: + case EEPROM_SFP_42: + case EEPROM_SFP_43: + case EEPROM_SFP_44: + case EEPROM_SFP_45: + case EEPROM_SFP_46: + case EEPROM_SFP_47: + case EEPROM_SFP_48: + case EEPROM_SFP_49: + case EEPROM_SFP_50: + case EEPROM_SFP_51: + case EEPROM_SFP_52: + case EEPROM_SFP_53: + case EEPROM_SFP_54: + case EEPROM_SFP_55: + case EEPROM_SFP_56: + case EEPROM_SFP_57: + case EEPROM_SFP_58: + case EEPROM_SFP_59: + case EEPROM_SFP_60: + case EEPROM_SFP_61: + case EEPROM_SFP_62: + case EEPROM_SFP_63: + case EEPROM_SFP_64: + sprintf(attr_path, "/sys/bus/i2c/devices/%d-0050/eeprom", delta_attr->index + EEPROM_MASK); + if (access_user_space(attr_path, eeprom_data, EEPROM_SIZE, off, ATTR_R) < 0) { + goto ACCESS_ERROR; + } + count = (count <= EEPROM_SIZE) ? count : EEPROM_SIZE; + memcpy(buf, eeprom_data + off, count); + break; + default: + goto ACCESS_ERROR; + } + dni_kunlock(); + return count; + +ACCESS_ERROR: + dni_kunlock(); + return -ETIMEDOUT; +} + +static ssize_t delta_bin_attr_write(struct file *filp, struct kobject *kobj, struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + struct delta_bin_attribute *delta_attr = to_delta_attr(attr); + char attr_path[100]; + + dni_klock(); + + switch(delta_attr->index){ + case EEPROM_SFP_1: + case EEPROM_SFP_2: + case EEPROM_SFP_3: + case EEPROM_SFP_4: + case EEPROM_SFP_5: + case EEPROM_SFP_6: + case EEPROM_SFP_7: + case EEPROM_SFP_8: + case EEPROM_SFP_9: + case EEPROM_SFP_10: + case EEPROM_SFP_11: + case EEPROM_SFP_12: + case EEPROM_SFP_13: + case EEPROM_SFP_14: + case EEPROM_SFP_15: + case EEPROM_SFP_16: + case EEPROM_SFP_17: + case EEPROM_SFP_18: + case EEPROM_SFP_19: + case EEPROM_SFP_20: + case EEPROM_SFP_21: + case EEPROM_SFP_22: + case EEPROM_SFP_23: + case EEPROM_SFP_24: + case EEPROM_SFP_25: + case EEPROM_SFP_26: + case EEPROM_SFP_27: + case EEPROM_SFP_28: + case EEPROM_SFP_29: + case EEPROM_SFP_30: + case EEPROM_SFP_31: + case EEPROM_SFP_32: + case EEPROM_SFP_33: + case EEPROM_SFP_34: + case EEPROM_SFP_35: + case EEPROM_SFP_36: + case EEPROM_SFP_37: + case EEPROM_SFP_38: + case EEPROM_SFP_39: + case EEPROM_SFP_40: + case EEPROM_SFP_41: + case EEPROM_SFP_42: + case EEPROM_SFP_43: + case EEPROM_SFP_44: + case EEPROM_SFP_45: + case EEPROM_SFP_46: + case EEPROM_SFP_47: + case EEPROM_SFP_48: + case EEPROM_SFP_49: + case EEPROM_SFP_50: + case EEPROM_SFP_51: + case EEPROM_SFP_52: + case EEPROM_SFP_53: + case EEPROM_SFP_54: + case EEPROM_SFP_55: + case EEPROM_SFP_56: + case EEPROM_SFP_57: + case EEPROM_SFP_58: + case EEPROM_SFP_59: + case EEPROM_SFP_60: + case EEPROM_SFP_61: + case EEPROM_SFP_62: + case EEPROM_SFP_63: + case EEPROM_SFP_64: + sprintf(attr_path, "/sys/bus/i2c/devices/%d-0050/eeprom", delta_attr->index + EEPROM_MASK); + if (access_user_space(attr_path, buf, count, off, ATTR_W) < 0) { + goto ACCESS_ERROR; + } + break; + default: + goto ACCESS_ERROR; + } + + dni_kunlock(); + return count; +ACCESS_ERROR: + dni_kunlock(); + return -ETIMEDOUT; +} + +DELTA_BIN_ATTR(eeprom_sfp_1, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_1); +DELTA_BIN_ATTR(eeprom_sfp_2, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_2); +DELTA_BIN_ATTR(eeprom_sfp_3, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_3); +DELTA_BIN_ATTR(eeprom_sfp_4, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_4); +DELTA_BIN_ATTR(eeprom_sfp_5, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_5); +DELTA_BIN_ATTR(eeprom_sfp_6, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_6); +DELTA_BIN_ATTR(eeprom_sfp_7, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_7); +DELTA_BIN_ATTR(eeprom_sfp_8, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_8); +DELTA_BIN_ATTR(eeprom_sfp_9, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_9); +DELTA_BIN_ATTR(eeprom_sfp_10, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_10); +DELTA_BIN_ATTR(eeprom_sfp_11, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_11); +DELTA_BIN_ATTR(eeprom_sfp_12, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_12); +DELTA_BIN_ATTR(eeprom_sfp_13, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_13); +DELTA_BIN_ATTR(eeprom_sfp_14, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_14); +DELTA_BIN_ATTR(eeprom_sfp_15, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_15); +DELTA_BIN_ATTR(eeprom_sfp_16, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_16); +DELTA_BIN_ATTR(eeprom_sfp_17, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_17); +DELTA_BIN_ATTR(eeprom_sfp_18, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_18); +DELTA_BIN_ATTR(eeprom_sfp_19, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_19); +DELTA_BIN_ATTR(eeprom_sfp_20, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_20); +DELTA_BIN_ATTR(eeprom_sfp_21, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_21); +DELTA_BIN_ATTR(eeprom_sfp_22, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_22); +DELTA_BIN_ATTR(eeprom_sfp_23, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_23); +DELTA_BIN_ATTR(eeprom_sfp_24, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_24); +DELTA_BIN_ATTR(eeprom_sfp_25, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_25); +DELTA_BIN_ATTR(eeprom_sfp_26, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_26); +DELTA_BIN_ATTR(eeprom_sfp_27, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_27); +DELTA_BIN_ATTR(eeprom_sfp_28, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_28); +DELTA_BIN_ATTR(eeprom_sfp_29, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_29); +DELTA_BIN_ATTR(eeprom_sfp_30, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_30); +DELTA_BIN_ATTR(eeprom_sfp_31, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_31); +DELTA_BIN_ATTR(eeprom_sfp_32, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_32); +DELTA_BIN_ATTR(eeprom_sfp_33, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_33); +DELTA_BIN_ATTR(eeprom_sfp_34, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_34); +DELTA_BIN_ATTR(eeprom_sfp_35, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_35); +DELTA_BIN_ATTR(eeprom_sfp_36, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_36); +DELTA_BIN_ATTR(eeprom_sfp_37, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_37); +DELTA_BIN_ATTR(eeprom_sfp_38, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_38); +DELTA_BIN_ATTR(eeprom_sfp_39, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_39); +DELTA_BIN_ATTR(eeprom_sfp_40, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_40); +DELTA_BIN_ATTR(eeprom_sfp_41, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_41); +DELTA_BIN_ATTR(eeprom_sfp_42, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_42); +DELTA_BIN_ATTR(eeprom_sfp_43, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_43); +DELTA_BIN_ATTR(eeprom_sfp_44, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_44); +DELTA_BIN_ATTR(eeprom_sfp_45, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_45); +DELTA_BIN_ATTR(eeprom_sfp_46, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_46); +DELTA_BIN_ATTR(eeprom_sfp_47, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_47); +DELTA_BIN_ATTR(eeprom_sfp_48, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_48); +DELTA_BIN_ATTR(eeprom_sfp_49, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_49); +DELTA_BIN_ATTR(eeprom_sfp_50, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_50); +DELTA_BIN_ATTR(eeprom_sfp_51, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_51); +DELTA_BIN_ATTR(eeprom_sfp_52, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_52); +DELTA_BIN_ATTR(eeprom_sfp_53, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_53); +DELTA_BIN_ATTR(eeprom_sfp_54, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_54); +DELTA_BIN_ATTR(eeprom_sfp_55, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_55); +DELTA_BIN_ATTR(eeprom_sfp_56, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_56); +DELTA_BIN_ATTR(eeprom_sfp_57, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_57); +DELTA_BIN_ATTR(eeprom_sfp_58, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_58); +DELTA_BIN_ATTR(eeprom_sfp_59, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_59); +DELTA_BIN_ATTR(eeprom_sfp_60, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_60); +DELTA_BIN_ATTR(eeprom_sfp_61, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_61); +DELTA_BIN_ATTR(eeprom_sfp_62, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_62); +DELTA_BIN_ATTR(eeprom_sfp_63, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_63); +DELTA_BIN_ATTR(eeprom_sfp_64, 0664, delta_bin_attr_read, delta_bin_attr_write, EEPROM_SIZE, EEPROM_SFP_64); + +static struct bin_attribute *sfp_attrs[] = { + &delta_attr_eeprom_sfp_1.attr, + &delta_attr_eeprom_sfp_2.attr, + &delta_attr_eeprom_sfp_3.attr, + &delta_attr_eeprom_sfp_4.attr, + &delta_attr_eeprom_sfp_5.attr, + &delta_attr_eeprom_sfp_6.attr, + &delta_attr_eeprom_sfp_7.attr, + &delta_attr_eeprom_sfp_8.attr, + &delta_attr_eeprom_sfp_9.attr, + &delta_attr_eeprom_sfp_10.attr, + &delta_attr_eeprom_sfp_11.attr, + &delta_attr_eeprom_sfp_12.attr, + &delta_attr_eeprom_sfp_13.attr, + &delta_attr_eeprom_sfp_14.attr, + &delta_attr_eeprom_sfp_15.attr, + &delta_attr_eeprom_sfp_16.attr, + &delta_attr_eeprom_sfp_17.attr, + &delta_attr_eeprom_sfp_18.attr, + &delta_attr_eeprom_sfp_19.attr, + &delta_attr_eeprom_sfp_20.attr, + &delta_attr_eeprom_sfp_21.attr, + &delta_attr_eeprom_sfp_22.attr, + &delta_attr_eeprom_sfp_23.attr, + &delta_attr_eeprom_sfp_24.attr, + &delta_attr_eeprom_sfp_25.attr, + &delta_attr_eeprom_sfp_26.attr, + &delta_attr_eeprom_sfp_27.attr, + &delta_attr_eeprom_sfp_28.attr, + &delta_attr_eeprom_sfp_29.attr, + &delta_attr_eeprom_sfp_30.attr, + &delta_attr_eeprom_sfp_31.attr, + &delta_attr_eeprom_sfp_32.attr, + &delta_attr_eeprom_sfp_33.attr, + &delta_attr_eeprom_sfp_34.attr, + &delta_attr_eeprom_sfp_35.attr, + &delta_attr_eeprom_sfp_36.attr, + &delta_attr_eeprom_sfp_37.attr, + &delta_attr_eeprom_sfp_38.attr, + &delta_attr_eeprom_sfp_39.attr, + &delta_attr_eeprom_sfp_40.attr, + &delta_attr_eeprom_sfp_41.attr, + &delta_attr_eeprom_sfp_42.attr, + &delta_attr_eeprom_sfp_43.attr, + &delta_attr_eeprom_sfp_44.attr, + &delta_attr_eeprom_sfp_45.attr, + &delta_attr_eeprom_sfp_46.attr, + &delta_attr_eeprom_sfp_47.attr, + &delta_attr_eeprom_sfp_48.attr, + &delta_attr_eeprom_sfp_49.attr, + &delta_attr_eeprom_sfp_50.attr, + &delta_attr_eeprom_sfp_51.attr, + &delta_attr_eeprom_sfp_52.attr, + &delta_attr_eeprom_sfp_53.attr, + &delta_attr_eeprom_sfp_54.attr, + &delta_attr_eeprom_sfp_55.attr, + &delta_attr_eeprom_sfp_56.attr, + &delta_attr_eeprom_sfp_57.attr, + &delta_attr_eeprom_sfp_58.attr, + &delta_attr_eeprom_sfp_59.attr, + &delta_attr_eeprom_sfp_60.attr, + &delta_attr_eeprom_sfp_61.attr, + &delta_attr_eeprom_sfp_62.attr, + &delta_attr_eeprom_sfp_63.attr, + &delta_attr_eeprom_sfp_64.attr, + NULL, /* need to NULL terminate the list of attributes */ +}; + +static struct attribute_group sfp_attr_grp = { + .bin_attrs = sfp_attrs, +}; +/*---------------- SFP - end ------------- */ + + /*---------------- module initialization ------------- */ static int __init delta_ag9064_platform_init(void) { -// struct i2c_client *client; struct i2c_adapter *adapter; struct swpld_mux_platform_data *swpld_pdata; -// struct cpld_platform_data * cpld_pdata; int ret,i = 0; printk("ag9064_platform module initialization\n"); + mutex_init(&dni_lock); + adapter = i2c_get_adapter(BUS2); i2c_client_9548 = i2c_new_device(adapter, &i2c_info_pca9548[0]); i2c_put_adapter(adapter); @@ -1136,11 +1326,26 @@ static int __init delta_ag9064_platform_init(void) goto error_ag9064_i2c_device; } } + + kobj_sfp = kobject_create_and_add("sfp", kernel_kobj); + if(!kobj_sfp) + { + return -ENOMEM; + } + ret = sysfs_create_group(kobj_sfp, &sfp_attr_grp); if (ret) - goto error_ag9064_swpld_mux; + { + printk(KERN_WARNING "Fail to create sysfs of sfp group\n"); + goto error_create_sfp_group; + } + + if (ret) + goto error_create_sfp_group; return 0; +error_create_sfp_group: + kobject_put(kobj_sfp); error_ag9064_i2c_device: i--; for (; i >= 0; i--) { @@ -1160,6 +1365,7 @@ static void __exit delta_ag9064_platform_exit(void) { int i = 0; + kobject_put(kobj_sfp); for ( i = 0; i < ARRAY_SIZE(ag9064_i2c_device); i++ ) { platform_device_unregister(&ag9064_i2c_device[i]); } diff --git a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_swpld.c b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_swpld.c index cab54a43bb07..084f0c74f245 100644 --- a/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_swpld.c +++ b/platform/broadcom/sonic-platform-modules-delta/ag9064/modules/delta_ag9064_swpld.c @@ -52,6 +52,7 @@ static ssize_t get_swpld_reg(struct device *dev, struct device_attribute *dev_at uint8_t get_cmd; struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + dni_klock(); cmd_data_len = sizeof(cmd_data); get_cmd = CMD_GETDATA; cmd_data[0] = BMC_BUS_5; @@ -62,12 +63,16 @@ static ssize_t get_swpld_reg(struct device *dev, struct device_attribute *dev_at if (attr->index <= SWPLD4_REG_VALUE){ switch (attr->index) { case SWPLD1_REG_ADDR: + dni_kunlock(); return sprintf(buf, "0x%02x\n", swpld1_reg_addr); case SWPLD2_REG_ADDR: + dni_kunlock(); return sprintf(buf, "0x%02x\n", swpld2_reg_addr); case SWPLD3_REG_ADDR: + dni_kunlock(); return sprintf(buf, "0x%02x\n", swpld3_reg_addr); case SWPLD4_REG_ADDR: + dni_kunlock(); return sprintf(buf, "0x%02x\n", swpld4_reg_addr); case SWPLD1_REG_VALUE: cmd_data[1] = SWPLD1_ADDR; @@ -86,10 +91,12 @@ static ssize_t get_swpld_reg(struct device *dev, struct device_attribute *dev_at cmd_data[2] = swpld4_reg_addr; break; default: + dni_kunlock(); return sprintf(buf, "%d not found", attr->index); } ret = dni_bmc_cmd(get_cmd, cmd_data, cmd_data_len); ret = ret & 0xff; + dni_kunlock(); return sprintf(buf, "0x%02x\n", ret); }else{ @@ -107,6 +114,7 @@ static ssize_t get_swpld_reg(struct device *dev, struct device_attribute *dev_at cmd_data[1] = SWPLD4_ADDR; break; default: + dni_kunlock(); return sprintf(buf, "%d not found", attr->index); } cmd_data[2] = attribute_data[attr->index].reg; @@ -114,23 +122,31 @@ static ssize_t get_swpld_reg(struct device *dev, struct device_attribute *dev_at value = value & mask; switch (mask) { case 0xFF: + dni_kunlock(); return sprintf(buf, "0x%02x%s", value, note); case 0x0F: + dni_kunlock(); return sprintf(buf, "0x%01x%s", value, note); case 0xF0: value = value >> 4; + dni_kunlock(); return sprintf(buf, "0x%01x%s", value, note); case 0xC0: value = value >> 6; + dni_kunlock(); return sprintf(buf, "0x%01x%s", value, note); case 0x30: value = value >> 4; + dni_kunlock(); return sprintf(buf, "0x%01x%s", value, note); default : value = value >> dni_log2(mask); + dni_kunlock(); return sprintf(buf, "%d%s", value, note); } - } + } + dni_kunlock(); + return sprintf(buf, "%d not found", attr->index); } static ssize_t set_swpld_reg(struct device *dev, struct device_attribute *dev_attr, @@ -152,13 +168,17 @@ static ssize_t set_swpld_reg(struct device *dev, struct device_attribute *dev_at set_cmd = CMD_SETDATA; get_cmd = CMD_GETDATA; + dni_klock(); + err = kstrtoul(buf, 0, &set_data_ul); if (err){ + dni_kunlock(); return err; } if (set_data > 0xff){ printk(KERN_ALERT "address out of range (0x00-0xFF)\n"); + dni_kunlock(); return count; } @@ -170,15 +190,19 @@ static ssize_t set_swpld_reg(struct device *dev, struct device_attribute *dev_at //reg_addr case SWPLD1_REG_ADDR: swpld1_reg_addr = set_data; + dni_kunlock(); return count; case SWPLD2_REG_ADDR: swpld2_reg_addr = set_data; + dni_kunlock(); return count; case SWPLD3_REG_ADDR: swpld3_reg_addr = set_data; + dni_kunlock(); return count; case SWPLD4_REG_ADDR: swpld4_reg_addr = set_data; + dni_kunlock(); return count; //reg_value case SWPLD1_REG_VALUE: @@ -198,9 +222,11 @@ static ssize_t set_swpld_reg(struct device *dev, struct device_attribute *dev_at cmd_data[2] = swpld4_reg_addr; break; default : + dni_kunlock(); return sprintf(buf, "%d not found", attr->index); } dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + dni_kunlock(); return count; } else{ @@ -222,6 +248,7 @@ static ssize_t set_swpld_reg(struct device *dev, struct device_attribute *dev_at cmd_data[1] = SWPLD4_ADDR; break; default: + dni_kunlock(); return sprintf(buf, "%d not found", attr->index); } @@ -252,8 +279,11 @@ static ssize_t set_swpld_reg(struct device *dev, struct device_attribute *dev_at set_data = mask_out | (set_data << dni_log2(mask) ); } dni_bmc_cmd(set_cmd, cmd_data, cmd_data_len); + dni_kunlock(); return count; } + dni_kunlock(); + return count; } //SWPLD @@ -524,11 +554,6 @@ static int __init delta_ag9064_swpld_init(void) int ret; printk(KERN_WARNING "ag9064_platform_swpld module initialization\n"); - ret = dni_create_user(); - if (ret != 0){ - printk(KERN_WARNING "Fail to create IPMI user\n"); - } - // set the SWPLD prob and remove ret = platform_driver_register(&swpld1_driver); if (ret) { diff --git a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.init b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.init index 57665353e3c7..74137b8b2dc3 100755 --- a/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.init +++ b/platform/broadcom/sonic-platform-modules-delta/debian/platform-modules-ag9064.init @@ -14,6 +14,18 @@ case "$1" in start) echo -n "Setting up board... " + if [ `grep -c usemsi /etc/init.d/opennsl-modules` = "0" ]; then + sed -i "s/debug=4 dma_debug=1/debug=4 dma_debug=1 usemsi=1/g" /etc/init.d/opennsl-modules + rmmod linux_knet_cb + rmmod linux_bcm_knet + rmmod linux_user_bde + rmmod linux_kernel_bde + /etc/init.d/opennsl-modules start + modprobe linux_kernel_bde + modprobe linux_user_bde + modprobe linux_bcm_knet + modprobe linux_knet_cb + fi depmod -a rmmod i2c-i801 rmmod i2c-ismt diff --git a/platform/broadcom/sonic-platform-modules-quanta/debian/changelog b/platform/broadcom/sonic-platform-modules-quanta/debian/changelog index eb6a0762234c..4bed63edf9cd 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/debian/changelog +++ b/platform/broadcom/sonic-platform-modules-quanta/debian/changelog @@ -5,6 +5,20 @@ sonic-quanta-platform-modules (1.0) unstable; urgency=low -- Chih-Pei Chang Jonathan Tsai Wed, 20 Dec 2017 09:26:01 +0800 +sonic-quanta-platform-modules (1.0) unstable; urgency=low + + * Add support for Quanta IX7-32X + * Initial release + + -- Chih-Pei Chang Jonathan Tsai Tue, 17 Apr 2018 14:40:01 +0800 + +sonic-quanta-platform-modules (1.0) unstable; urgency=low + + * Add support for Quanta IX8-56X + * Initial release + + -- Chih-Pei Chang Jonathan Tsai Thu, 3 May 2018 16:40:01 +0800 + sonic-quanta-platform-modules (1.0) unstable; urgency=low * Add support for Quanta IX8C-56X diff --git a/platform/broadcom/sonic-platform-modules-quanta/debian/control b/platform/broadcom/sonic-platform-modules-quanta/debian/control index 071a43663b4e..aea2a39d6ff3 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/debian/control +++ b/platform/broadcom/sonic-platform-modules-quanta/debian/control @@ -9,6 +9,14 @@ Package: sonic-platform-quanta-ix1b-32x Architecture: amd64 Description: kernel modules for platform devices such as psu, led, sfp +Package: sonic-platform-quanta-ix7-32x +Architecture: amd64 +Description: kernel modules for platform devices such as psu, led, sfp + +Package: sonic-platform-quanta-ix8-56x +Architecture: amd64 +Description: kernel modules for platform devices such as psu, led, sfp + Package: sonic-platform-quanta-ix8c-56x Architecture: amd64 Description: kernel modules for platform devices such as psu, led, sfp diff --git a/platform/broadcom/sonic-platform-modules-quanta/debian/rules b/platform/broadcom/sonic-platform-modules-quanta/debian/rules index a2b8f4e41725..8ceede79196b 100644 --- a/platform/broadcom/sonic-platform-modules-quanta/debian/rules +++ b/platform/broadcom/sonic-platform-modules-quanta/debian/rules @@ -19,7 +19,7 @@ PACKAGE_PRE_NAME := sonic-platform-quanta KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= ix1b-32x ix8c-56x +MODULE_DIRS:= ix1b-32x ix7-32x ix8-56x ix8c-56x MODULE_DIR := modules UTILS_DIR := utils SERVICE_DIR := service diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/classes/__init__.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/classes/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/Makefile b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/Makefile new file mode 100644 index 000000000000..405c9153c091 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/Makefile @@ -0,0 +1,3 @@ +obj-m:=qci_cpld.o qci_cpld_led.o quanta_platform_ix7.o + + diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/qci_cpld.c b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/qci_cpld.c new file mode 100644 index 000000000000..e8556bc72d46 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/qci_cpld.c @@ -0,0 +1,451 @@ +/* + * A CPLD driver for monitor QSFP28 module I/O + * + * The CPLD is customize by Quanta for controlling QSFP28 module signals, + * they are RESET , INTERREPT , Module_Present, LPMODE + * Each CPLD control 16 modules, each module use 4 bits in register. + * + * Copyright (C) 2015 Quanta Inc. + * + * Author: Luffy Cheng + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static DEFINE_IDA(cpld_ida); + +enum platform_type { + SFP = 0, + QSFP, + QSFP28, + NONE +}; + +static struct class *cpld_class = NULL; + +struct sfp_data { + struct i2c_client *cpld_client; + char name[8]; + char type[8]; + u8 port_id; + u8 cpld_port; +}; + +struct cpld_data { + struct mutex lock; + struct device *port_dev[16]; + struct sfp_data *port_data[16]; +}; + +static int cpld_probe(struct i2c_client *client, + const struct i2c_device_id *id); +static int cpld_remove(struct i2c_client *client); + +static const struct i2c_device_id cpld_id[] = { + { "CPLD-SFP", SFP }, + { "CPLD-QSFP", QSFP }, + { "CPLD-QSFP28", QSFP28 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, cpld_id); + +static struct i2c_driver cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "qci_cpld", + }, + .probe = cpld_probe, + .remove = cpld_remove, + .id_table = cpld_id, +// .address_list = normal_i2c, +}; + +#define CPLD_ID_PREFIX "port-" +#define CPLD_ID_FORMAT CPLD_ID_PREFIX "%d" + +#define RESET_MASK 0x08 +#define INTERRUPT_MASK 0x04 +#define MODULE_PRESENT_MASK 0x02 +#define LPMODE_MASK 0x01 +//#define I2C_MONITOR_MASK 0x01 + +static inline u8 get_group_cmd(u8 group) +{ + //FIXME: if group cmd change + return (group + 1); +} + +static inline u8 port_remapping(u8 phy_port) +{ + /* FIXME: implement by hardware design */ + /* The CPLD register port mapping is weird : + * MSB -------- LSB (word data) + * P3 P4 P1 P2 (per port 4 bits) + * For easy coding bit shift, we treat it as hw port swap + */ + return (phy_port % 2) ? (phy_port - 1) : (phy_port + 1); +} + +static ssize_t get_reset(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + struct sfp_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + u8 group = (u8)(data->cpld_port / 4); + u8 group_port = data->cpld_port % 4; + s32 value; + + dev_dbg(&client->dev, "port_id %d => cpld_port %d, group %d(%d)\n", data->port_id, + data->cpld_port + 1, group + 1, group_port + 1); + + value = i2c_smbus_read_word_data(client, get_group_cmd(group)); + if (value < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read group%d value= %x\n", group + 1, value); + + value >>= (group_port * 4); + value &= RESET_MASK; + + return sprintf(buf, "%d\n", value ? 1 : 0); +} + +static ssize_t get_interrupt(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + struct sfp_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + u8 group = (u8)(data->cpld_port / 4); + u8 group_port = data->cpld_port % 4; + s32 value; + + dev_dbg(&client->dev, "port_id %d => cpld_port %d, group %d(%d)\n", data->port_id, + data->cpld_port + 1, group + 1, group_port + 1); + + value = i2c_smbus_read_word_data(client, get_group_cmd(group)); + if (value < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read group%d value= %x\n", group + 1, value); + + value >>= (group_port * 4); + value &= INTERRUPT_MASK; + + return sprintf(buf, "%d\n", value ? 1 : 0); +} + +static ssize_t get_module_present(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + struct sfp_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + u8 group = (u8)(data->cpld_port / 4); + u8 group_port = data->cpld_port % 4; + s32 value; + + dev_dbg(&client->dev, "port_id %d => cpld_port %d, group %d(%d)\n", data->port_id, + data->cpld_port + 1, group + 1, group_port + 1); + + value = i2c_smbus_read_word_data(client, get_group_cmd(group)); + if (value < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read group%d value= %x\n", group + 1, value); + + value >>= (group_port * 4); + value &= MODULE_PRESENT_MASK; + + //FIXME: if present is not low active + return sprintf(buf, "%d\n", value ? 0 : 1); +} + +static ssize_t get_lpmode(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + struct sfp_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + u8 group = (u8)(data->cpld_port / 4); + u8 group_port = data->cpld_port % 4; + s32 value; + + dev_dbg(&client->dev, "port_id %d => cpld_port %d, group %d(%d)\n", data->port_id, + data->cpld_port + 1, group + 1, group_port + 1); + + value = i2c_smbus_read_word_data(client, get_group_cmd(group)); + if (value < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read group%d value= %x\n", group + 1, value); + + value >>= (group_port * 4); + value &= LPMODE_MASK; + + return sprintf(buf, "%d\n", value ? 1 : 0); +} + +static ssize_t set_reset(struct device *dev, + struct device_attribute *devattr, + const char *buf, + size_t count) +{ + struct sfp_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + u8 group = (u8)(data->cpld_port / 4); + u8 group_port = data->cpld_port % 4; + s32 value; + long disable; + + dev_dbg(&client->dev, "port_id %d => cpld_port %d, group %d(%d)\n", data->port_id, + data->cpld_port + 1, group + 1, group_port + 1); + + if (kstrtol(buf, 0, &disable)) + return -EINVAL; + + if ((disable != 1) && (disable != 0)) + return -EINVAL; + +// mutex_lock(&data->lock); + value = i2c_smbus_read_word_data(client, get_group_cmd(group)); + if (value < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read group%d value= %x\n", group + 1, value); + + value &= ~(RESET_MASK << (group_port * 4)); + if (disable) + value |= (RESET_MASK << (group_port * 4)); + + dev_dbg(&client->dev, "write group%d value= %x\n", group + 1, value); + + i2c_smbus_write_word_data(client, get_group_cmd(group), (u16)value); +// mutex_unlock(&data->lock); + + return count; +} + +static ssize_t set_lpmode(struct device *dev, + struct device_attribute *devattr, + const char *buf, + size_t count) +{ + struct sfp_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + u8 group = (u8)(data->cpld_port / 4); + u8 group_port = data->cpld_port % 4; + s32 value; + long disable; + + dev_dbg(&client->dev, "port_id %d => cpld_port %d, group %d(%d)\n", data->port_id, + data->cpld_port + 1, group + 1, group_port + 1); + + if (kstrtol(buf, 0, &disable)) + return -EINVAL; + + if ((disable != 1) && (disable != 0)) + return -EINVAL; + +// mutex_lock(&data->lock); + value = i2c_smbus_read_word_data(client, get_group_cmd(group)); + if (value < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read group%d value= %x\n", group + 1, value); + + value &= ~(LPMODE_MASK << (group_port * 4)); + if (disable) + value |= (LPMODE_MASK << (group_port * 4)); + + dev_dbg(&client->dev, "write group%d value= %x\n", group + 1, value); + + i2c_smbus_write_word_data(client, get_group_cmd(group), (u16)value); +// mutex_unlock(&data->lock); + + return count; +} + +static DEVICE_ATTR(reset, S_IWUSR | S_IRUGO, get_reset, set_reset); +static DEVICE_ATTR(lpmode, S_IWUSR | S_IRUGO, get_lpmode, set_lpmode); +static DEVICE_ATTR(module_present, S_IRUGO, get_module_present, NULL); +static DEVICE_ATTR(interrupt, S_IRUGO, get_interrupt, NULL); +//static DEVICE_ATTR(led_enable, S_IWUSR | S_IRUGO, get_led_enable, set_led_enable); +//static DEVICE_ATTR(monitor_enable, S_IWUSR | S_IRUGO, get_monitor_enable, set_monitor_enable); + +static const struct attribute *sfp_attrs[] = { + &dev_attr_reset.attr, + &dev_attr_lpmode.attr, + &dev_attr_module_present.attr, + &dev_attr_interrupt.attr, +// &dev_attr_led_enable.attr, + NULL, +}; + +static const struct attribute_group sfp_attr_group = { + .attrs = (struct attribute **) sfp_attrs, +}; + +static int cpld_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct cpld_data *data; + struct sfp_data *port_data; +// struct i2c_monitor_data *monitor_data; + struct device *port_dev; +// struct device *i2c_dev; + int port_nr, i=0, err, max_port_num; + char name[I2C_NAME_SIZE], type[I2C_NAME_SIZE]; + + printk("cpld cpld_probe\n"); + + while(id->name[i]) + { + name[i]=tolower(id->name[i]); + i++; + } + name[i]='\0'; + strncpy(type,name+5,strlen(name)-5); + type[strlen(name)-5]='\0'; + + if (!cpld_class) + { + cpld_class = class_create(THIS_MODULE, name); + if (IS_ERR(cpld_class)) { + pr_err("couldn't create sysfs class\n"); + return PTR_ERR(cpld_class); + } + } + + data = devm_kzalloc(&client->dev, sizeof(struct cpld_data), + GFP_KERNEL); + if (!data) + return -ENOMEM; + + if(!strcmp(client->name, "CPLD-QSFP28")){ + max_port_num = 16; + } + else{ + max_port_num = 4; + } + + /* register sfp port data to sysfs */ + for (i = 0; i < max_port_num; i++) + { + port_nr = ida_simple_get(&cpld_ida, 1, 99, GFP_KERNEL); + if (port_nr < 0) + goto err_out; + + port_data = kzalloc(sizeof(struct sfp_data), GFP_KERNEL); + + port_dev = device_create(cpld_class, &client->dev, MKDEV(0,0), port_data, CPLD_ID_FORMAT, port_nr); + if (IS_ERR(port_dev)) { + err = PTR_ERR(port_dev); + printk("err_status\n"); + } + + data->port_dev[i] = port_dev; + data->port_data[i] = port_data; + + strcpy(port_data->type, type); + + dev_info(&client->dev, "Register %s port-%d\n", port_data->type , port_nr); + + /* FIXME: implement Logical/Physical port remapping */ + //port_data->cpld_port = i; + port_data->cpld_port = port_remapping(i); + sprintf(port_data->name, "port-%d", port_nr); + port_data->port_id = port_nr; + dev_set_drvdata(port_dev, port_data); + port_dev->init_name = port_data->name; + port_data->cpld_client = client; + + err = sysfs_create_group(&port_dev->kobj, &sfp_attr_group); + // if (status) printk("err status\n"); + } + + i2c_set_clientdata(client, data); + mutex_init(&data->lock); + + dev_info(&client->dev, "%s device found\n", client->name); + + + return 0; + +err_out: + return port_nr; +} + +/* FIXME: for older kernel doesn't with idr_is_empty function, implement here */ +#if 1 +static int idr_has_entry(int id, void *p, void *data) +{ + return 1; +} + +static bool cpld_idr_is_empty(struct idr *idp) +{ + return !idr_for_each(idp, idr_has_entry, NULL); +} +#endif + +static int cpld_remove(struct i2c_client *client) +{ + struct cpld_data *data = i2c_get_clientdata(client); + int i, max_port_num; +// int id; + + if(!strcmp(client->name, "CPLD-QSFP28")){ + max_port_num = 16; + } + else{ + max_port_num = 4; + } + + for (i = (max_port_num - 1); i >= 0; i--) + { + dev_info(data->port_dev[i], "Remove %s port-%d\n", data->port_data[i]->type , data->port_data[i]->port_id); + device_unregister(data->port_dev[i]); + ida_simple_remove(&cpld_ida, data->port_data[i]->port_id); + kfree(data->port_data[i]); + } + + if (cpld_idr_is_empty(&cpld_ida.idr)) + class_destroy(cpld_class); + + return 0; +} + +module_i2c_driver(cpld_driver); + +MODULE_AUTHOR("Luffy Cheng "); +MODULE_DESCRIPTION("Quanta Switch QSFP28 CPLD driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/qci_cpld_led.c b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/qci_cpld_led.c new file mode 100644 index 000000000000..37fc2e07246e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/qci_cpld_led.c @@ -0,0 +1,275 @@ +/* + * A LED CPLD driver for Quanta Switch Platform + * + * The CPLD is customize by Quanta for decode led bit stream, + * This driver modify from Quanta CPLD I/O driver. + * + * Copyright (C) 2015 Quanta Inc. + * + * Author: Luffy Cheng + * Author: Roger Chang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static DEFINE_IDA(cpld_led_ida); + +enum platform_type { + IX7 = 0, + IX8, + NONE +}; + +static struct class *cpld_class = NULL; + +struct cpld_data { + struct i2c_client *cpld_client; + char name[8]; + u8 cpld_id; +}; + +struct cpld_led_data { + struct mutex lock; + struct device *port_dev; + struct cpld_data *cpld_data; +}; + +static int cpld_led_probe(struct i2c_client *client, + const struct i2c_device_id *id); +static int cpld_led_remove(struct i2c_client *client); + +static const struct i2c_device_id cpld_led_id[] = { + { "CPLDLED_IX7", IX7 }, + { "CPLDLED_IX8", IX8 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, cpld_led_id); + +static struct i2c_driver cpld_led_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "qci_cpld_led", + }, + .probe = cpld_led_probe, + .remove = cpld_led_remove, + .id_table = cpld_led_id, +// .address_list = normal_i2c, +}; + +#define CPLD_LED_ID_PREFIX "CPLDLED-" +#define CPLD_LED_ID_FORMAT CPLD_LED_ID_PREFIX "%d" + +#define CPLD_DECODER_OFFSET 0x4 +#define CPLD_DECODER_MASK 0x1 +#define CPLD_USERCODE_START_OFFSET 0x0 + +static ssize_t get_led_decode(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + struct cpld_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + u8 offset = (u8)(CPLD_DECODER_OFFSET); + s32 value; + + value = i2c_smbus_read_byte_data(client, offset); + if (value < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read led decode value= %x\n", value); + + value &= CPLD_DECODER_MASK; + + return sprintf(buf, "%d\n", (value == 0) ? 1 : 0); +} + +static ssize_t get_usercode(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + struct cpld_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + u8 i = 0; + s32 value = 0, reading = 0; + + for (i = 0; i < 4; i++) + { + reading = i2c_smbus_read_byte_data(client, CPLD_USERCODE_START_OFFSET + i); + if (reading < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read led usercode reg %d value= %x\n", i, reading); + + value |= reading << (24 - 8 * i); + } + + return sprintf(buf, "%X\n", value); +} + +static ssize_t set_led_decode(struct device *dev, + struct device_attribute *devattr, + const char *buf, + size_t count) +{ + struct cpld_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + s32 value; + long enable; + + if (kstrtol(buf, 0, &enable)) + return -EINVAL; + + if ((enable != 1) && (enable != 0)) + return -EINVAL; + +// mutex_lock(&data->lock); + value = i2c_smbus_read_byte_data(client, CPLD_DECODER_OFFSET); + if (value < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read led decode value= %x\n", value); + + value |= CPLD_DECODER_MASK; + if (enable) + value &= ~CPLD_DECODER_MASK; + + dev_dbg(&client->dev, "write led decode value= %x\n", value); + + i2c_smbus_write_byte_data(client, CPLD_DECODER_OFFSET, (u8)value); +// mutex_unlock(&data->lock); + + return count; +} + +static DEVICE_ATTR(led_decode, S_IWUSR | S_IRUGO, get_led_decode, set_led_decode); +static DEVICE_ATTR(usercode, S_IRUGO, get_usercode, NULL); + +static const struct attribute *led_attrs[] = { + &dev_attr_usercode.attr, + &dev_attr_led_decode.attr, + NULL, +}; + +static const struct attribute_group led_attr_group = { + .attrs = (struct attribute **) led_attrs, +}; + +static int cpld_led_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct cpld_led_data *data; + struct cpld_data *led_data; + struct device *port_dev; + int nr, err; + + if (!cpld_class) + { + cpld_class = class_create(THIS_MODULE, "cpld-led"); + if (IS_ERR(cpld_class)) { + pr_err("couldn't create sysfs class\n"); + return PTR_ERR(cpld_class); + } + } + + data = devm_kzalloc(&client->dev, sizeof(struct cpld_led_data), + GFP_KERNEL); + if (!data) + return -ENOMEM; + + /* Test */ + nr = ida_simple_get(&cpld_led_ida, 1, 99, GFP_KERNEL); + if (nr < 0) + goto err_out; + + led_data = kzalloc(sizeof(struct cpld_led_data), GFP_KERNEL); + + port_dev = device_create(cpld_class, &client->dev, MKDEV(0,0), led_data, CPLD_LED_ID_FORMAT, nr); + if (IS_ERR(port_dev)) { + err = PTR_ERR(port_dev); + // printk("err_status\n"); + } + + data->port_dev = port_dev; + data->cpld_data = led_data; + + dev_info(&client->dev, "Register CPLDLED %d\n", nr); + + sprintf(led_data->name, "LED%d-data", nr); + led_data->cpld_id = nr; + dev_set_drvdata(port_dev, led_data); + port_dev->init_name = led_data->name; + led_data->cpld_client = client; + + err = sysfs_create_group(&port_dev->kobj, &led_attr_group); + // if (status) printk("err status\n"); + /* end */ + + i2c_set_clientdata(client, data); + mutex_init(&data->lock); + + dev_info(&client->dev, "%s device found\n", client->name); + + + return 0; + +err_out: + return nr; +} + +/* FIXME: for older kernel doesn't with idr_is_empty function, implement here */ +static int idr_has_entry(int id, void *p, void *data) +{ + return 1; +} + +static bool cpld_idr_is_empty(struct idr *idp) +{ + return !idr_for_each(idp, idr_has_entry, NULL); +} + +static int cpld_led_remove(struct i2c_client *client) +{ + struct cpld_led_data *data = i2c_get_clientdata(client); + + dev_info(data->port_dev, "Remove CPLDLED-%d\n", data->cpld_data->cpld_id); + device_unregister(data->port_dev); + ida_simple_remove(&cpld_led_ida, data->cpld_data->cpld_id); + kfree(data->cpld_data); + + if (cpld_idr_is_empty(&cpld_led_ida.idr)) + class_destroy(cpld_class); + + return 0; +} + +module_i2c_driver(cpld_led_driver); + +MODULE_AUTHOR("Luffy Cheng "); +MODULE_AUTHOR("Roger Chang "); +MODULE_DESCRIPTION("Quanta Switch LED CPLD driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/quanta_platform_ix7.c b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/quanta_platform_ix7.c new file mode 100644 index 000000000000..a2a0af63af7d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/modules/quanta_platform_ix7.c @@ -0,0 +1,323 @@ +/* + * Quanta IX7 platform driver + * + * + * Copyright (C) 2014 Quanta Computer 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 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)) +#include +#else +#include +#endif + +#define MUX_INFO(bus, deselect) \ + {.adap_id = bus, .deselect_on_exit = deselect} + +static struct pca954x_platform_mode pca9548sfp1_modes[] = { + MUX_INFO(0x20, 1), + MUX_INFO(0x21, 1), + MUX_INFO(0x22, 1), + MUX_INFO(0x23, 1), + MUX_INFO(0x24, 1), + MUX_INFO(0x25, 1), + MUX_INFO(0x26, 1), + MUX_INFO(0x27, 1), +}; + +static struct pca954x_platform_data pca9548sfp1_data = { + .modes = pca9548sfp1_modes, + .num_modes = 8, +}; + +static struct pca954x_platform_mode pca9548sfp2_modes[] = { + MUX_INFO(0x28, 1), + MUX_INFO(0x29, 1), + MUX_INFO(0x2a, 1), + MUX_INFO(0x2b, 1), + MUX_INFO(0x2c, 1), + MUX_INFO(0x2d, 1), + MUX_INFO(0x2e, 1), + MUX_INFO(0x2f, 1), +}; + +static struct pca954x_platform_data pca9548sfp2_data = { + .modes = pca9548sfp2_modes, + .num_modes = 8, +}; +static struct pca954x_platform_mode pca9548sfp3_modes[] = { + MUX_INFO(0x30, 1), + MUX_INFO(0x31, 1), + MUX_INFO(0x32, 1), + MUX_INFO(0x33, 1), + MUX_INFO(0x34, 1), + MUX_INFO(0x35, 1), + MUX_INFO(0x36, 1), + MUX_INFO(0x37, 1), +}; + +static struct pca954x_platform_data pca9548sfp3_data = { + .modes = pca9548sfp3_modes, + .num_modes = 8, +}; + +static struct pca954x_platform_mode pca9548sfp4_modes[] = { + MUX_INFO(0x38, 1), + MUX_INFO(0x39, 1), + MUX_INFO(0x3a, 1), + MUX_INFO(0x3b, 1), + MUX_INFO(0x3c, 1), + MUX_INFO(0x3d, 1), + MUX_INFO(0x3e, 1), + MUX_INFO(0x3f, 1), +}; + +static struct pca954x_platform_data pca9548sfp4_data = { + .modes = pca9548sfp4_modes, + .num_modes = 8, +}; + +static struct pca954x_platform_mode pca9546_modes[] = { + MUX_INFO(0x10, 1), + MUX_INFO(0x11, 1), + MUX_INFO(0x12, 1), + MUX_INFO(0x13, 1), +}; + +static struct pca954x_platform_data pca9546_data = { + .modes = pca9546_modes, + .num_modes = 4, +}; + +static struct pca954x_platform_mode pca9548_modes[] = { + MUX_INFO(0x14, 1), + MUX_INFO(0x15, 1), + MUX_INFO(0x16, 1), + MUX_INFO(0x17, 1), + MUX_INFO(0x18, 1), + MUX_INFO(0x19, 1), + MUX_INFO(0x1a, 1), + MUX_INFO(0x1b, 1), +}; + +static struct pca954x_platform_data pca9548_data = { + .modes = pca9548_modes, + .num_modes = 8, +}; + +/* CPU Board i2c device */ +static struct pca954x_platform_mode pca9546_cpu_modes[] = { + MUX_INFO(0x02, 1), + MUX_INFO(0x03, 1), + MUX_INFO(0x04, 1), + MUX_INFO(0x05, 1), +}; + +static struct pca954x_platform_data pca9546_cpu_data = { + .modes = pca9546_cpu_modes, + .num_modes = 4, +}; +//MB Board Data +static struct pca953x_platform_data pca9555_1_data = { + .gpio_base = 0x10, +}; +//CPU Board pca9555 +static struct pca953x_platform_data pca9555_CPU_data = { + .gpio_base = 0x20, +}; + +static struct i2c_board_info ix7_i2c_devices[] = { + { + I2C_BOARD_INFO("pca9546", 0x72), // 0 + .platform_data = &pca9546_data, + }, + { + I2C_BOARD_INFO("pca9548", 0x77), // 1 + .platform_data = &pca9548_data, + }, + { + I2C_BOARD_INFO("24c02", 0x54), // 2 0x72 ch2 eeprom + }, + { + I2C_BOARD_INFO("pca9548", 0x73), // 3 0x77 ch0 + .platform_data = &pca9548sfp1_data, + }, + { + I2C_BOARD_INFO("pca9548", 0x73), // 4 0x77 ch1 + .platform_data = &pca9548sfp2_data, + }, + { + I2C_BOARD_INFO("pca9548", 0x73), // 5 0x77 ch2 + .platform_data = &pca9548sfp3_data, + }, + { + I2C_BOARD_INFO("pca9548", 0x73), // 6 0x77 ch3 + .platform_data = &pca9548sfp4_data, + }, + { + I2C_BOARD_INFO("pca9555", 0x23), // 7 0x72 ch3 pca9555 MB Board Data + .platform_data = &pca9555_1_data, + }, + { + I2C_BOARD_INFO("CPLD-QSFP28", 0x38), // 8 0x72 ch0 + }, + { + I2C_BOARD_INFO("CPLD-QSFP28", 0x38), // 9 0x72 ch1 + }, + { + I2C_BOARD_INFO("pca9546", 0x71), // 10 CPU Board i2c device + .platform_data = &pca9546_cpu_data, + }, + { + I2C_BOARD_INFO("pca9555", 0x20), // 11 0x71 ch0 CPU Board Data + .platform_data = &pca9555_CPU_data, + }, + { + I2C_BOARD_INFO("optoe1", 0x50), // 12 0x50 QSFP EEPROM + }, + { + I2C_BOARD_INFO("CPLDLED_IX7", 0x39), // 13 0x72 ch0 CPLD_led_1 + }, + { + I2C_BOARD_INFO("CPLDLED_IX7", 0x39), // 14 0x72 ch1 CPLD_led_1 + }, +}; + +static struct platform_driver ix7_platform_driver = { + .driver = { + .name = "qci-ix7", + .owner = THIS_MODULE, + }, +}; + +static struct platform_device *ix7_device; + +static int __init ix7_platform_init(void) +{ + struct i2c_client *client; + struct i2c_adapter *adapter; + int ret, i; + + ret = platform_driver_register(&ix7_platform_driver); + if (ret < 0) + return ret; + + /* Register platform stuff */ + ix7_device = platform_device_alloc("qci-ix7", -1); + if (!ix7_device) { + ret = -ENOMEM; + goto fail_platform_driver; + } + + ret = platform_device_add(ix7_device); + if (ret) + goto fail_platform_device; + + adapter = i2c_get_adapter(0); + client = i2c_new_device(adapter, &ix7_i2c_devices[0]); // pca9546 + client = i2c_new_device(adapter, &ix7_i2c_devices[1]); // pca9548 + client = i2c_new_device(adapter, &ix7_i2c_devices[10]); // pca9546 in CPU board + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x02); + client = i2c_new_device(adapter, &ix7_i2c_devices[11]); // CPU Board Data + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x10); + client = i2c_new_device(adapter, &ix7_i2c_devices[8]); // CPLD2 + client = i2c_new_device(adapter, &ix7_i2c_devices[13]); // CPLD_led_1 + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x11); + client = i2c_new_device(adapter, &ix7_i2c_devices[9]); // CPLD3 + client = i2c_new_device(adapter, &ix7_i2c_devices[14]); // CPLD_led_2 + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x12); + client = i2c_new_device(adapter, &ix7_i2c_devices[2]); // MB_BOARDINFO_EEPROM + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x13); + client = i2c_new_device(adapter, &ix7_i2c_devices[7]); // pca9555 MB Board Data + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x14); + client = i2c_new_device(adapter, &ix7_i2c_devices[3]); // pca9548_1 SFP + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x15); + client = i2c_new_device(adapter, &ix7_i2c_devices[4]); // pca9548_2 SFP + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x16); + client = i2c_new_device(adapter, &ix7_i2c_devices[5]); // pca9548_3 SFP + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x17); + client = i2c_new_device(adapter, &ix7_i2c_devices[6]); // pca9548_4 SFP + i2c_put_adapter(adapter); + for(i = 32; i < 64; i ++){ // QSFP 1~32 EEPROM + adapter = i2c_get_adapter(i); + client = i2c_new_device(adapter, &ix7_i2c_devices[12]); + i2c_put_adapter(adapter); + } + + return 0; + +fail_platform_device: + platform_device_put(ix7_device); + +fail_platform_driver: + platform_driver_unregister(&ix7_platform_driver); + return ret; +} + +static void __exit ix7_platform_exit(void) +{ + platform_device_unregister(ix7_device); + platform_driver_unregister(&ix7_platform_driver); +} + +module_init(ix7_platform_init); +module_exit(ix7_platform_exit); + + +MODULE_AUTHOR("Jonathan Tsai "); +MODULE_VERSION("1.0"); +MODULE_DESCRIPTION("Quanta IX7 Platform Driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/service/ix7-platform-init.service b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/service/ix7-platform-init.service new file mode 100755 index 000000000000..fa46136d17ff --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/service/ix7-platform-init.service @@ -0,0 +1,13 @@ +[Unit] +Description=Quanta IX7-32X Platform initialization service +Before=pmon.service +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/quanta_ix7_util.py install +ExecStop=/usr/local/bin/quanta_ix7_util.py clean +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/setup.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/setup.py new file mode 100644 index 000000000000..a2f84b31a56a --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/setup.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +import os +import sys +from setuptools import setup +os.listdir + +setup( + name='ix7_32x', + version='1.0', + description='Module to initialize Quanta IX7-32X platforms', + + packages=['ix7_32x'], + package_dir={'ix7_32x': 'ix7-32x/classes'}, +) + diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/utils/quanta_ix7_util.py b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/utils/quanta_ix7_util.py new file mode 100644 index 000000000000..e583d2374a99 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix7-32x/utils/quanta_ix7_util.py @@ -0,0 +1,210 @@ +#!/usr/bin/env python +# +# Copyright (C) 2018 Quanta Computer Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + +DEBUG = False +args = [] +FORCE = 0 +i2c_prefix = '/sys/bus/i2c/devices/' + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + install() + elif arg == 'clean': + uninstall() + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_log(txt): + if DEBUG == True: + print "[IX7-32X]"+txt + return + +def exec_cmd(cmd, show): + logging.info('Run :'+cmd) + status, output = commands.getstatusoutput(cmd) + show_log (cmd +"with result:" + str(status)) + show_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +instantiate =[ +#turn on module power +'echo 21 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio21/direction', +'echo 1 >/sys/class/gpio/gpio21/value', +#Reset fron-ports LED CPLD +'echo 73 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio73/direction', +'echo 0 >/sys/class/gpio/gpio73/value', +'echo 1 >/sys/class/gpio/gpio73/value', +#Enable front-ports LED decoding +'echo 1 > /sys/class/cpld-led/CPLDLED-1/led_decode', +'echo 1 > /sys/class/cpld-led/CPLDLED-2/led_decode', +#Update System LED +'echo 42 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio42/direction', +'echo 0 > /sys/class/gpio/gpio42/value', +'echo 43 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio43/direction', +'echo 1 > /sys/class/gpio/gpio43/value', +] + +drivers =[ +'lpc_ich', +'i2c-i801', +'i2c-dev', +'i2c-mux-pca954x', +'gpio-pca953x', +'optoe', +'qci_cpld', +'qci_cpld_led', +'quanta_platform_ix7', +'ipmi_devintf' +] + + + +def system_install(): + global FORCE + + #remove default drivers to avoid modprobe order conflicts + status, output = exec_cmd("echo 'blacklist i2c-ismt' > /etc/modprobe.d/blacklist.conf", 1) + time.sleep(1) + status, output = exec_cmd("modprobe -r i2c-ismt ", 1) + status, output = exec_cmd("modprobe -r i2c-i801 ", 1) + #setup driver dependency + status, output = exec_cmd("depmod -a ", 1) + #install drivers + for i in range(0,len(drivers)): + status, output = exec_cmd("modprobe "+drivers[i], 1) + if status: + print output + if FORCE == 0: + return status + + #instantiate devices + for i in range(0,len(instantiate)): + status, output = exec_cmd(instantiate[i], 1) + if status: + print output + if FORCE == 0: + return status + + #QSFP for 1~32 port + for port_number in range(1,33): + bus_number = port_number + 31 + os.system("echo %d >/sys/bus/i2c/devices/%d-0050/port_name" % (port_number, bus_number)) + return + + +def system_ready(): + if not device_found(): + return False + return True + +def install(): + if not device_found(): + print "No device, installing...." + status = system_install() + if status: + if FORCE == 0: + return status + else: + print " ix7 driver already installed...." + return + +def uninstall(): + global FORCE + #uninstall drivers + for i in range(len(drivers)-1,-1,-1): + status, output = exec_cmd("rmmod "+drivers[i], 1) + if status: + print output + if FORCE == 0: + return status + return + +def device_found(): + ret1, log = exec_cmd("ls "+i2c_prefix+"i2c-0", 0) + return ret1 + +if __name__ == "__main__": + main() + diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/classes/__init__.py b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/classes/__init__.py new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/Makefile b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/Makefile new file mode 100755 index 000000000000..011cd52d673d --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/Makefile @@ -0,0 +1,3 @@ +obj-m:=qci_cpld_sfp28.o qci_cpld_led.o qci_platform_ix8.o + + diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/qci_cpld_led.c b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/qci_cpld_led.c new file mode 100755 index 000000000000..37fc2e07246e --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/qci_cpld_led.c @@ -0,0 +1,275 @@ +/* + * A LED CPLD driver for Quanta Switch Platform + * + * The CPLD is customize by Quanta for decode led bit stream, + * This driver modify from Quanta CPLD I/O driver. + * + * Copyright (C) 2015 Quanta Inc. + * + * Author: Luffy Cheng + * Author: Roger Chang + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static DEFINE_IDA(cpld_led_ida); + +enum platform_type { + IX7 = 0, + IX8, + NONE +}; + +static struct class *cpld_class = NULL; + +struct cpld_data { + struct i2c_client *cpld_client; + char name[8]; + u8 cpld_id; +}; + +struct cpld_led_data { + struct mutex lock; + struct device *port_dev; + struct cpld_data *cpld_data; +}; + +static int cpld_led_probe(struct i2c_client *client, + const struct i2c_device_id *id); +static int cpld_led_remove(struct i2c_client *client); + +static const struct i2c_device_id cpld_led_id[] = { + { "CPLDLED_IX7", IX7 }, + { "CPLDLED_IX8", IX8 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, cpld_led_id); + +static struct i2c_driver cpld_led_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "qci_cpld_led", + }, + .probe = cpld_led_probe, + .remove = cpld_led_remove, + .id_table = cpld_led_id, +// .address_list = normal_i2c, +}; + +#define CPLD_LED_ID_PREFIX "CPLDLED-" +#define CPLD_LED_ID_FORMAT CPLD_LED_ID_PREFIX "%d" + +#define CPLD_DECODER_OFFSET 0x4 +#define CPLD_DECODER_MASK 0x1 +#define CPLD_USERCODE_START_OFFSET 0x0 + +static ssize_t get_led_decode(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + struct cpld_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + u8 offset = (u8)(CPLD_DECODER_OFFSET); + s32 value; + + value = i2c_smbus_read_byte_data(client, offset); + if (value < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read led decode value= %x\n", value); + + value &= CPLD_DECODER_MASK; + + return sprintf(buf, "%d\n", (value == 0) ? 1 : 0); +} + +static ssize_t get_usercode(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + struct cpld_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + u8 i = 0; + s32 value = 0, reading = 0; + + for (i = 0; i < 4; i++) + { + reading = i2c_smbus_read_byte_data(client, CPLD_USERCODE_START_OFFSET + i); + if (reading < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read led usercode reg %d value= %x\n", i, reading); + + value |= reading << (24 - 8 * i); + } + + return sprintf(buf, "%X\n", value); +} + +static ssize_t set_led_decode(struct device *dev, + struct device_attribute *devattr, + const char *buf, + size_t count) +{ + struct cpld_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + s32 value; + long enable; + + if (kstrtol(buf, 0, &enable)) + return -EINVAL; + + if ((enable != 1) && (enable != 0)) + return -EINVAL; + +// mutex_lock(&data->lock); + value = i2c_smbus_read_byte_data(client, CPLD_DECODER_OFFSET); + if (value < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read led decode value= %x\n", value); + + value |= CPLD_DECODER_MASK; + if (enable) + value &= ~CPLD_DECODER_MASK; + + dev_dbg(&client->dev, "write led decode value= %x\n", value); + + i2c_smbus_write_byte_data(client, CPLD_DECODER_OFFSET, (u8)value); +// mutex_unlock(&data->lock); + + return count; +} + +static DEVICE_ATTR(led_decode, S_IWUSR | S_IRUGO, get_led_decode, set_led_decode); +static DEVICE_ATTR(usercode, S_IRUGO, get_usercode, NULL); + +static const struct attribute *led_attrs[] = { + &dev_attr_usercode.attr, + &dev_attr_led_decode.attr, + NULL, +}; + +static const struct attribute_group led_attr_group = { + .attrs = (struct attribute **) led_attrs, +}; + +static int cpld_led_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct cpld_led_data *data; + struct cpld_data *led_data; + struct device *port_dev; + int nr, err; + + if (!cpld_class) + { + cpld_class = class_create(THIS_MODULE, "cpld-led"); + if (IS_ERR(cpld_class)) { + pr_err("couldn't create sysfs class\n"); + return PTR_ERR(cpld_class); + } + } + + data = devm_kzalloc(&client->dev, sizeof(struct cpld_led_data), + GFP_KERNEL); + if (!data) + return -ENOMEM; + + /* Test */ + nr = ida_simple_get(&cpld_led_ida, 1, 99, GFP_KERNEL); + if (nr < 0) + goto err_out; + + led_data = kzalloc(sizeof(struct cpld_led_data), GFP_KERNEL); + + port_dev = device_create(cpld_class, &client->dev, MKDEV(0,0), led_data, CPLD_LED_ID_FORMAT, nr); + if (IS_ERR(port_dev)) { + err = PTR_ERR(port_dev); + // printk("err_status\n"); + } + + data->port_dev = port_dev; + data->cpld_data = led_data; + + dev_info(&client->dev, "Register CPLDLED %d\n", nr); + + sprintf(led_data->name, "LED%d-data", nr); + led_data->cpld_id = nr; + dev_set_drvdata(port_dev, led_data); + port_dev->init_name = led_data->name; + led_data->cpld_client = client; + + err = sysfs_create_group(&port_dev->kobj, &led_attr_group); + // if (status) printk("err status\n"); + /* end */ + + i2c_set_clientdata(client, data); + mutex_init(&data->lock); + + dev_info(&client->dev, "%s device found\n", client->name); + + + return 0; + +err_out: + return nr; +} + +/* FIXME: for older kernel doesn't with idr_is_empty function, implement here */ +static int idr_has_entry(int id, void *p, void *data) +{ + return 1; +} + +static bool cpld_idr_is_empty(struct idr *idp) +{ + return !idr_for_each(idp, idr_has_entry, NULL); +} + +static int cpld_led_remove(struct i2c_client *client) +{ + struct cpld_led_data *data = i2c_get_clientdata(client); + + dev_info(data->port_dev, "Remove CPLDLED-%d\n", data->cpld_data->cpld_id); + device_unregister(data->port_dev); + ida_simple_remove(&cpld_led_ida, data->cpld_data->cpld_id); + kfree(data->cpld_data); + + if (cpld_idr_is_empty(&cpld_led_ida.idr)) + class_destroy(cpld_class); + + return 0; +} + +module_i2c_driver(cpld_led_driver); + +MODULE_AUTHOR("Luffy Cheng "); +MODULE_AUTHOR("Roger Chang "); +MODULE_DESCRIPTION("Quanta Switch LED CPLD driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/qci_cpld_sfp28.c b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/qci_cpld_sfp28.c new file mode 100755 index 000000000000..dac76667c6ca --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/qci_cpld_sfp28.c @@ -0,0 +1,398 @@ +/* + * A CPLD driver for monitor SFP28 module I/O + * + * The CPLD is customize by Quanta for controlling SFP28 module signals, + * they are TX_FAULT , TX_DIS , PRE_N , RX_LOS + * Each CPLD control 16 modules, each module use 4 bits in register. + * + * Copyright (C) 2015 Quanta Inc. + * + * Author: Luffy Cheng + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static DEFINE_IDA(cpld_ida); + +enum platform_type { + SFP = 0, + SFP28, + NONE +}; + +static struct class *cpld_class = NULL; + +struct sfp_data { + struct i2c_client *cpld_client; + char name[8]; + char type[8]; + u8 port_id; + u8 cpld_port; +}; + +struct cpld_data { + struct mutex lock; + struct device *port_dev[16]; + struct sfp_data *port_data[16]; +}; + +static int cpld_probe(struct i2c_client *client, + const struct i2c_device_id *id); +static int cpld_remove(struct i2c_client *client); + +static const struct i2c_device_id cpld_id[] = { + { "CPLD-SFP", SFP }, + { "CPLD-SFP28", SFP28 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, cpld_id); + +static struct i2c_driver cpld_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "qci_cpld_sfp28", + }, + .probe = cpld_probe, + .remove = cpld_remove, + .id_table = cpld_id, +// .address_list = normal_i2c, +}; + +#define CPLD_ID_PREFIX "port-" +#define CPLD_ID_FORMAT CPLD_ID_PREFIX "%d" + +//SFP28 +#define TX_FAULT_MASK 0x08 +#define TX_DIS_MASK 0x04 +#define PRE_N_MASK 0x02 +#define RX_LOS_MASK 0x01 + +static inline u8 get_group_cmd(u8 group) +{ + //FIXME: if group cmd change + return (group + 1); +} + +static inline u8 port_remapping(u8 phy_port) +{ + /* FIXME: implement by hardware design */ + /* The CPLD register port mapping is weird : + * MSB -------- LSB (word data) + * P3 P4 P1 P2 (per port 4 bits) + * For easy coding bit shift, we treat it as hw port swap + */ + return (phy_port % 2) ? (phy_port - 1) : (phy_port + 1); +} + +//SFP +static ssize_t get_tx_fault(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + struct sfp_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + u8 group = (u8)(data->cpld_port / 4); + u8 group_port = data->cpld_port % 4; + s32 value; + + dev_dbg(&client->dev, "port_id %d => cpld_port %d, group %d(%d)\n", data->port_id, + data->cpld_port + 1, group + 1, group_port + 1); + + value = i2c_smbus_read_word_data(client, get_group_cmd(group)); + if (value < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read group%d value= %x\n", group + 1, value); + + value >>= (group_port * 4); + value &= TX_FAULT_MASK; + + return sprintf(buf, "%d\n", value ? 1 : 0); +} + +static ssize_t get_tx_dis(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + struct sfp_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + u8 group = (u8)(data->cpld_port / 4); + u8 group_port = data->cpld_port % 4; + s32 value; + + dev_dbg(&client->dev, "port_id %d => cpld_port %d, group %d(%d)\n", data->port_id, + data->cpld_port + 1, group + 1, group_port + 1); + + value = i2c_smbus_read_word_data(client, get_group_cmd(group)); + if (value < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read group%d value= %x\n", group + 1, value); + + value >>= (group_port * 4); + value &= TX_DIS_MASK; + + return sprintf(buf, "%d\n", value ? 1 : 0); +} + +static ssize_t get_pre_n(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + struct sfp_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + u8 group = (u8)(data->cpld_port / 4); + u8 group_port = data->cpld_port % 4; + s32 value; + + dev_dbg(&client->dev, "port_id %d => cpld_port %d, group %d(%d)\n", data->port_id, + data->cpld_port + 1, group + 1, group_port + 1); + + value = i2c_smbus_read_word_data(client, get_group_cmd(group)); + if (value < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read group%d value= %x\n", group + 1, value); + + value >>= (group_port * 4); + value &= PRE_N_MASK; + + //FIXME: if present is not low active + return sprintf(buf, "%d\n", value ? 0 : 1); +} + +static ssize_t get_rx_los(struct device *dev, + struct device_attribute *devattr, + char *buf) +{ + struct sfp_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + u8 group = (u8)(data->cpld_port / 4); + u8 group_port = data->cpld_port % 4; + s32 value; + + dev_dbg(&client->dev, "port_id %d => cpld_port %d, group %d(%d)\n", data->port_id, + data->cpld_port + 1, group + 1, group_port + 1); + + value = i2c_smbus_read_word_data(client, get_group_cmd(group)); + if (value < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read group%d value= %x\n", group + 1, value); + + value >>= (group_port * 4); + value &= RX_LOS_MASK; + + return sprintf(buf, "%d\n", value ? 1 : 0); +} +static ssize_t set_tx_dis(struct device *dev, + struct device_attribute *devattr, + const char *buf, + size_t count) +{ + struct sfp_data *data = dev_get_drvdata(dev); + struct i2c_client *client = data->cpld_client; + u8 group = (u8)(data->cpld_port / 4); + u8 group_port = data->cpld_port % 4; + s32 value; + long disable; + + dev_dbg(&client->dev, "port_id %d => cpld_port %d, group %d(%d)\n", data->port_id, + data->cpld_port + 1, group + 1, group_port + 1); + + if (kstrtol(buf, 0, &disable)) + return -EINVAL; + + if ((disable != 1) && (disable != 0)) + return -EINVAL; + +// mutex_lock(&data->lock); + value = i2c_smbus_read_word_data(client, get_group_cmd(group)); + if (value < 0) + return -ENODEV; + + dev_dbg(&client->dev, "read group%d value= %x\n", group + 1, value); + + value &= ~(TX_DIS_MASK << (group_port * 4)); + if (disable) + value |= (TX_DIS_MASK << (group_port * 4)); + + dev_dbg(&client->dev, "write group%d value= %x\n", group + 1, value); + + i2c_smbus_write_word_data(client, get_group_cmd(group), (u16)value); +// mutex_unlock(&data->lock); + + return count; +} +//SFP + +//static DEVICE_ATTR(led_enable, S_IWUSR | S_IRUGO, get_led_enable, set_led_enable); +//static DEVICE_ATTR(monitor_enable, S_IWUSR | S_IRUGO, get_monitor_enable, set_monitor_enable); +//SFP +static DEVICE_ATTR(tx_fault, S_IRUGO, get_tx_fault, NULL); +static DEVICE_ATTR(tx_dis, S_IWUSR | S_IRUGO, get_tx_dis, set_tx_dis); +static DEVICE_ATTR(pre_n, S_IRUGO, get_pre_n, NULL); +static DEVICE_ATTR(rx_los, S_IRUGO, get_rx_los, NULL); + +static const struct attribute *sfp_attrs[] = { +// &dev_attr_led_enable.attr, + &dev_attr_tx_fault.attr, + &dev_attr_tx_dis.attr, + &dev_attr_pre_n.attr, + &dev_attr_rx_los.attr, + NULL, +}; + +static const struct attribute_group sfp_attr_group = { + .attrs = (struct attribute **) sfp_attrs, +}; + +static int cpld_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct cpld_data *data; + struct sfp_data *port_data; +// struct i2c_monitor_data *monitor_data; + struct device *port_dev; +// struct device *i2c_dev; + int port_nr, i=0, err; + char name[I2C_NAME_SIZE], type[I2C_NAME_SIZE]; + + printk("cpld cpld_probe\n"); + + while(id->name[i]) + { + name[i]=tolower(id->name[i]); + i++; + } + name[i]='\0'; + strncpy(type,name+5,strlen(name)-5); + type[strlen(name)-5]='\0'; + + if (!cpld_class) + { + cpld_class = class_create(THIS_MODULE, name); + if (IS_ERR(cpld_class)) { + pr_err("couldn't create sysfs class\n"); + return PTR_ERR(cpld_class); + } + } + + data = devm_kzalloc(&client->dev, sizeof(struct cpld_data), + GFP_KERNEL); + if (!data) + return -ENOMEM; + + /* register sfp port data to sysfs */ + for (i = 0; i < 16; i++) + { + port_nr = ida_simple_get(&cpld_ida, 1, 99, GFP_KERNEL); + if (port_nr < 0) + goto err_out; + + port_data = kzalloc(sizeof(struct sfp_data), GFP_KERNEL); + + port_dev = device_create(cpld_class, &client->dev, MKDEV(0,0), port_data, CPLD_ID_FORMAT, port_nr); + if (IS_ERR(port_dev)) { + err = PTR_ERR(port_dev); + printk("err_status\n"); + } + + data->port_dev[i] = port_dev; + data->port_data[i] = port_data; + + strcpy(port_data->type, type); + + dev_info(&client->dev, "Register %s port-%d\n", port_data->type , port_nr); + + /* FIXME: implement Logical/Physical port remapping */ + //port_data->cpld_port = i; + port_data->cpld_port = port_remapping(i); + sprintf(port_data->name, "port-%d", port_nr); + port_data->port_id = port_nr; + dev_set_drvdata(port_dev, port_data); + port_dev->init_name = port_data->name; + port_data->cpld_client = client; + + err = sysfs_create_group(&port_dev->kobj, &sfp_attr_group); + // if (status) printk("err status\n"); + } + + i2c_set_clientdata(client, data); + mutex_init(&data->lock); + + dev_info(&client->dev, "%s device found\n", client->name); + + + return 0; + +err_out: + return port_nr; +} + +/* FIXME: for older kernel doesn't with idr_is_empty function, implement here */ +#if 1 +static int idr_has_entry(int id, void *p, void *data) +{ + return 1; +} + +static bool cpld_idr_is_empty(struct idr *idp) +{ + return !idr_for_each(idp, idr_has_entry, NULL); +} +#endif + +static int cpld_remove(struct i2c_client *client) +{ + struct cpld_data *data = i2c_get_clientdata(client); + int i; +// int id; + + for (i = 15; i >= 0; i--) + { + dev_info(data->port_dev[i], "Remove %s port-%d\n", data->port_data[i]->type , data->port_data[i]->port_id); + device_unregister(data->port_dev[i]); + ida_simple_remove(&cpld_ida, data->port_data[i]->port_id); + kfree(data->port_data[i]); + } + + if (cpld_idr_is_empty(&cpld_ida.idr)) + class_destroy(cpld_class); + + return 0; +} + +module_i2c_driver(cpld_driver); + +MODULE_AUTHOR("Jonathan Tsai "); +MODULE_VERSION("1.0"); +MODULE_DESCRIPTION("Quanta Switch SFP28 CPLD driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/qci_platform_ix8.c b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/qci_platform_ix8.c new file mode 100755 index 000000000000..26151b0ab24f --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/modules/qci_platform_ix8.c @@ -0,0 +1,420 @@ +/* + * Quanta IX8 platform driver + * + * + * Copyright (C) 2017 Quanta Computer 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 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)) +#include +#else +#include +#endif + +#define MUX_INFO(bus, deselect) \ + {.adap_id = bus, .deselect_on_exit = deselect} + +static struct pca954x_platform_mode pca9548sfp1_modes[] = { + MUX_INFO(0x20, 1), + MUX_INFO(0x21, 1), + MUX_INFO(0x22, 1), + MUX_INFO(0x23, 1), + MUX_INFO(0x24, 1), + MUX_INFO(0x25, 1), + MUX_INFO(0x26, 1), + MUX_INFO(0x27, 1), +}; + +static struct pca954x_platform_data pca9548sfp1_data = { + .modes = pca9548sfp1_modes, + .num_modes = 8, +}; + +static struct pca954x_platform_mode pca9548sfp2_modes[] = { + MUX_INFO(0x28, 1), + MUX_INFO(0x29, 1), + MUX_INFO(0x2a, 1), + MUX_INFO(0x2b, 1), + MUX_INFO(0x2c, 1), + MUX_INFO(0x2d, 1), + MUX_INFO(0x2e, 1), + MUX_INFO(0x2f, 1), +}; + +static struct pca954x_platform_data pca9548sfp2_data = { + .modes = pca9548sfp2_modes, + .num_modes = 8, +}; +static struct pca954x_platform_mode pca9548sfp3_modes[] = { + MUX_INFO(0x30, 1), + MUX_INFO(0x31, 1), + MUX_INFO(0x32, 1), + MUX_INFO(0x33, 1), + MUX_INFO(0x34, 1), + MUX_INFO(0x35, 1), + MUX_INFO(0x36, 1), + MUX_INFO(0x37, 1), +}; + +static struct pca954x_platform_data pca9548sfp3_data = { + .modes = pca9548sfp3_modes, + .num_modes = 8, +}; + +static struct pca954x_platform_mode pca9548sfp4_modes[] = { + MUX_INFO(0x38, 1), + MUX_INFO(0x39, 1), + MUX_INFO(0x3a, 1), + MUX_INFO(0x3b, 1), + MUX_INFO(0x3c, 1), + MUX_INFO(0x3d, 1), + MUX_INFO(0x3e, 1), + MUX_INFO(0x3f, 1), +}; + +static struct pca954x_platform_data pca9548sfp4_data = { + .modes = pca9548sfp4_modes, + .num_modes = 8, +}; + +static struct pca954x_platform_mode pca9548sfp5_modes[] = { + MUX_INFO(0x40, 1), + MUX_INFO(0x41, 1), + MUX_INFO(0x42, 1), + MUX_INFO(0x43, 1), + MUX_INFO(0x44, 1), + MUX_INFO(0x45, 1), + MUX_INFO(0x46, 1), + MUX_INFO(0x47, 1), +}; + +static struct pca954x_platform_data pca9548sfp5_data = { + .modes = pca9548sfp5_modes, + .num_modes = 8, +}; + +static struct pca954x_platform_mode pca9548sfp6_modes[] = { + MUX_INFO(0x48, 1), + MUX_INFO(0x49, 1), + MUX_INFO(0x4a, 1), + MUX_INFO(0x4b, 1), + MUX_INFO(0x4c, 1), + MUX_INFO(0x4d, 1), + MUX_INFO(0x4e, 1), + MUX_INFO(0x4f, 1), +}; + +static struct pca954x_platform_data pca9548sfp6_data = { + .modes = pca9548sfp6_modes, + .num_modes = 8, +}; + +//ZQSFP +static struct pca954x_platform_mode pca9548sfp7_modes[] = { + MUX_INFO(0x50, 1), + MUX_INFO(0x51, 1), + MUX_INFO(0x52, 1), + MUX_INFO(0x53, 1), + MUX_INFO(0x54, 1), + MUX_INFO(0x55, 1), + MUX_INFO(0x56, 1), + MUX_INFO(0x57, 1), +}; + +static struct pca954x_platform_data pca9548sfp7_data = { + .modes = pca9548sfp7_modes, + .num_modes = 8, +}; + +// end port + +static struct pca954x_platform_mode pca9546_modes[] = { + MUX_INFO(0x10, 1), + MUX_INFO(0x11, 1), + MUX_INFO(0x12, 1), + MUX_INFO(0x13, 1), +}; + +static struct pca954x_platform_data pca9546_data = { + .modes = pca9546_modes, + .num_modes = 4, +}; + +static struct pca954x_platform_mode pca9548_modes[] = { + MUX_INFO(0x14, 1), + MUX_INFO(0x15, 1), + MUX_INFO(0x16, 1), + MUX_INFO(0x17, 1), + MUX_INFO(0x18, 1), + MUX_INFO(0x19, 1), + MUX_INFO(0x1a, 1), + MUX_INFO(0x1b, 1), +}; + +static struct pca954x_platform_data pca9548_data = { + .modes = pca9548_modes, + .num_modes = 8, +}; + +/* CPU Board i2c device */ +static struct pca954x_platform_mode pca9546_cpu_modes[] = { + MUX_INFO(0x02, 1), + MUX_INFO(0x03, 1), + MUX_INFO(0x04, 1), + MUX_INFO(0x05, 1), +}; + +static struct pca954x_platform_data pca9546_cpu_data = { + .modes = pca9546_cpu_modes, + .num_modes = 4, +}; +//MB Board Data +static struct pca953x_platform_data pca9555_1_data = { + .gpio_base = 0x10, +}; +//QSFP28 49-56 IO Expander +static struct pca953x_platform_data pca9698_2_data = { + .gpio_base = 0x20, +}; +//CPU Board pca9555 +static struct pca953x_platform_data pca9555_CPU_data = { + .gpio_base = 0x48, +}; +static struct i2c_board_info ix8_i2c_devices[] = { + { + I2C_BOARD_INFO("pca9546", 0x72), // 0 + .platform_data = &pca9546_data, + }, + { + I2C_BOARD_INFO("pca9548", 0x77), // 1 + .platform_data = &pca9548_data, + }, + { + I2C_BOARD_INFO("24c02", 0x54), // 2 eeprom + }, + { + I2C_BOARD_INFO("pca9548", 0x73), // 3 0x77 ch0 + .platform_data = &pca9548sfp1_data, + }, + { + I2C_BOARD_INFO("pca9548", 0x73), // 4 0x77 ch1 + .platform_data = &pca9548sfp2_data, + }, + { + I2C_BOARD_INFO("pca9548", 0x73), // 5 0x77 ch2 + .platform_data = &pca9548sfp3_data, + }, + { + I2C_BOARD_INFO("pca9548", 0x73), // 6 0x77 ch3 + .platform_data = &pca9548sfp4_data, + }, + { + I2C_BOARD_INFO("pca9548", 0x73), // 7 0x77 ch4 + .platform_data = &pca9548sfp5_data, + }, + { + I2C_BOARD_INFO("pca9548", 0x73), // 8 0x77 ch5 + .platform_data = &pca9548sfp6_data, + }, + { + I2C_BOARD_INFO("pca9548", 0x73), // 9 0x77 ch6 + .platform_data = &pca9548sfp7_data, + }, + { + I2C_BOARD_INFO("CPLD-SFP28", 0x38), // 10 0x72 ch0 CPLD1_:SFP28 1~16 + }, + { + I2C_BOARD_INFO("CPLD-SFP28", 0x38), // 11 0x72 ch1 CPLD2_:SFP28 17~32 + }, + { + I2C_BOARD_INFO("CPLD-SFP28", 0x38), // 12 0x72 ch2 CPLD_3:SFP28 33~48 + }, + { + I2C_BOARD_INFO("pca9555", 0x23), // 13 0x72 ch3 MB Board Data + .platform_data = &pca9555_1_data, + }, + { + I2C_BOARD_INFO("pca9698", 0x21), // 14 0x72 ch3 QSFP:49~52 + .platform_data = &pca9698_2_data, + }, + { + I2C_BOARD_INFO("optoe1", 0x50), // 15 0x50 QSFP EEPROM + }, + { + I2C_BOARD_INFO("pca9546", 0x71), // 16 + .platform_data = &pca9546_cpu_data, + }, + { + I2C_BOARD_INFO("pca9555", 0x20), // 17 0x71 ch0 CPU Board Data + .platform_data = &pca9555_CPU_data, + }, + { + I2C_BOARD_INFO("CPLDLED_IX8", 0x3a), // 18 0x72 ch0 CPLD4 LED function of SFP28 & QSFP28 (Port27~56) + }, + { + I2C_BOARD_INFO("CPLDLED_IX8", 0x39), // 19 0x72 ch0 CPLD6 LED function of SFP28 & QSFP28 (Port1~26) + }, + { + I2C_BOARD_INFO("optoe2", 0x50), // 20 0x50 SFP28 EEPROM + }, +}; + +static struct platform_driver ix8_platform_driver = { + .driver = { + .name = "qci-ix8", + .owner = THIS_MODULE, + }, +}; + +static struct platform_device *ix8_device; + +static int __init ix8_platform_init(void) +{ + struct i2c_client *client; + struct i2c_adapter *adapter; + int ret, i; + + ret = platform_driver_register(&ix8_platform_driver); + if (ret < 0) + return ret; + + /* Register platform stuff */ + ix8_device = platform_device_alloc("qci-ix8", -1); + if (!ix8_device) { + ret = -ENOMEM; + goto fail_platform_driver; + } + + ret = platform_device_add(ix8_device); + if (ret) + goto fail_platform_device; + + adapter = i2c_get_adapter(0); + client = i2c_new_device(adapter, &ix8_i2c_devices[0]); // pca9546 + client = i2c_new_device(adapter, &ix8_i2c_devices[1]); // pca9548 + client = i2c_new_device(adapter, &ix8_i2c_devices[16]); // pca9546cpu + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x02); + client = i2c_new_device(adapter, &ix8_i2c_devices[17]); // CPU Board Data + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x10); + client = i2c_new_device(adapter, &ix8_i2c_devices[10]); // CPLD_1 + client = i2c_new_device(adapter, &ix8_i2c_devices[18]); // CPLD_4 + client = i2c_new_device(adapter, &ix8_i2c_devices[19]); // CPLD_6 + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x11); + client = i2c_new_device(adapter, &ix8_i2c_devices[11]); // CPLD_2 + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x12); + client = i2c_new_device(adapter, &ix8_i2c_devices[12]); // CPLD_3 + client = i2c_new_device(adapter, &ix8_i2c_devices[2]); // MB_BOARDINFO_EEPROM + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x13); + client = i2c_new_device(adapter, &ix8_i2c_devices[13]); // MB Board Data + client = i2c_new_device(adapter, &ix8_i2c_devices[14]); // QSFP:49~52 + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x14); + client = i2c_new_device(adapter, &ix8_i2c_devices[3]); // pca9548_1 SFP + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x15); + client = i2c_new_device(adapter, &ix8_i2c_devices[4]); // pca9548_2 SFP + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x16); + client = i2c_new_device(adapter, &ix8_i2c_devices[5]); // pca9548_3 SFP + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x17); + client = i2c_new_device(adapter, &ix8_i2c_devices[6]); // pca9548_4 SFP + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x18); + client = i2c_new_device(adapter, &ix8_i2c_devices[7]); // pca9548_5 SFP + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x19); + client = i2c_new_device(adapter, &ix8_i2c_devices[8]); // pca9548_6 SFP + i2c_put_adapter(adapter); + + adapter = i2c_get_adapter(0x1a); + client = i2c_new_device(adapter, &ix8_i2c_devices[9]); // pca9548_7 QSFP + i2c_put_adapter(adapter); + + for(i = 80; i < 88; i ++){ // QSFP 49~56 EEPROM + adapter = i2c_get_adapter(i); + client = i2c_new_device(adapter, &ix8_i2c_devices[15]); + i2c_put_adapter(adapter); + } + + for(i = 32; i < 80; i ++){ // SFP28 1~48 EEPROM + adapter = i2c_get_adapter(i); + client = i2c_new_device(adapter, &ix8_i2c_devices[20]); + i2c_put_adapter(adapter); + } + + return 0; + +fail_platform_device: + platform_device_put(ix8_device); + +fail_platform_driver: + platform_driver_unregister(&ix8_platform_driver); + return ret; +} + +static void __exit ix8_platform_exit(void) +{ + platform_device_unregister(ix8_device); + platform_driver_unregister(&ix8_platform_driver); +} + +module_init(ix8_platform_init); +module_exit(ix8_platform_exit); + + +MODULE_AUTHOR("Jonathan Tsai "); +MODULE_VERSION("1.0"); +MODULE_DESCRIPTION("Quanta IX8 Platform Driver"); +MODULE_LICENSE("GPL"); diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/service/ix8-platform-init.service b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/service/ix8-platform-init.service new file mode 100755 index 000000000000..d4eb6bfcc3e1 --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/service/ix8-platform-init.service @@ -0,0 +1,13 @@ +[Unit] +Description=Quanta IX8-56X Platform initialization service +Before=pmon.service +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/quanta_ix8_util.py install +ExecStop=/usr/local/bin/quanta_ix8_util.py clean +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/setup.py b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/setup.py new file mode 100755 index 000000000000..76c5eacbee4c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/setup.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +import os +import sys +from setuptools import setup +os.listdir + +setup( + name='ix8_56x', + version='1.0', + description='Module to initialize Quanta IX8-56X platforms', + + packages=['ix8_56x'], + package_dir={'ix8_56x': 'ix8-56x/classes'}, +) + diff --git a/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/utils/quanta_ix8_util.py b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/utils/quanta_ix8_util.py new file mode 100755 index 000000000000..fe93611b114c --- /dev/null +++ b/platform/broadcom/sonic-platform-modules-quanta/ix8-56x/utils/quanta_ix8_util.py @@ -0,0 +1,329 @@ +#!/usr/bin/env python +# +# Copyright (C) 2018 Quanta Computer Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + +DEBUG = False +args = [] +FORCE = 0 +i2c_prefix = '/sys/bus/i2c/devices/' + + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + install() + elif arg == 'clean': + uninstall() + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_log(txt): + if DEBUG == True: + print "[IX8-56X]"+txt + return + +def exec_cmd(cmd, show): + logging.info('Run :'+cmd) + status, output = commands.getstatusoutput(cmd) + show_log (cmd +"with result:" + str(status)) + show_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +instantiate =[ +#turn on module power +'echo 21 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio21/direction', +'echo 1 >/sys/class/gpio/gpio21/value', +#export pca9698 for qsfp present +'echo 34 > /sys/class/gpio/export', +'echo in > /sys/class/gpio/gpio34/direction', +'echo 38 > /sys/class/gpio/export', +'echo in > /sys/class/gpio/gpio38/direction', +'echo 42 > /sys/class/gpio/export', +'echo in > /sys/class/gpio/gpio42/direction', +'echo 46 > /sys/class/gpio/export', +'echo in > /sys/class/gpio/gpio46/direction', +'echo 50 > /sys/class/gpio/export', +'echo in > /sys/class/gpio/gpio50/direction', +'echo 54 > /sys/class/gpio/export', +'echo in > /sys/class/gpio/gpio54/direction', +'echo 58 > /sys/class/gpio/export', +'echo in > /sys/class/gpio/gpio58/direction', +'echo 62 > /sys/class/gpio/export', +'echo in > /sys/class/gpio/gpio62/direction', +#export pca9698 for qsfp reset +'echo 32 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio32/direction', +'echo 1 >/sys/class/gpio/gpio32/value', +'echo 36 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio36/direction', +'echo 1 >/sys/class/gpio/gpio36/value', +'echo 40 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio40/direction', +'echo 1 >/sys/class/gpio/gpio40/value', +'echo 44 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio44/direction', +'echo 1 >/sys/class/gpio/gpio44/value', +'echo 48 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio48/direction', +'echo 1 >/sys/class/gpio/gpio48/value', +'echo 52 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio52/direction', +'echo 1 >/sys/class/gpio/gpio52/value', +'echo 56 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio56/direction', +'echo 1 >/sys/class/gpio/gpio56/value', +'echo 60 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio60/direction', +'echo 1 >/sys/class/gpio/gpio60/value', +#export pca9698 for qsfp lpmode +'echo 35 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio35/direction', +'echo 0 >/sys/class/gpio/gpio35/value', +'echo 39 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio39/direction', +'echo 0 >/sys/class/gpio/gpio39/value', +'echo 43 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio43/direction', +'echo 0 >/sys/class/gpio/gpio43/value', +'echo 47 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio47/direction', +'echo 0 >/sys/class/gpio/gpio47/value', +'echo 51 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio51/direction', +'echo 0 >/sys/class/gpio/gpio51/value', +'echo 55 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio55/direction', +'echo 0 >/sys/class/gpio/gpio55/value', +'echo 59 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio59/direction', +'echo 0 >/sys/class/gpio/gpio59/value', +'echo 63 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio63/direction', +'echo 0 >/sys/class/gpio/gpio63/value', +#Reset fron-ports LED CPLD +'echo 73 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio73/direction', +'echo 0 >/sys/class/gpio/gpio73/value', +'echo 1 >/sys/class/gpio/gpio73/value', +#Enable front-ports LED decoding +'echo 1 > /sys/class/cpld-led/CPLDLED-1/led_decode', +'echo 1 > /sys/class/cpld-led/CPLDLED-2/led_decode', +#SFP28 Module TxEnable +'echo 0 > /sys/class/cpld-sfp28/port-1/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-2/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-3/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-4/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-5/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-6/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-7/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-8/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-9/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-10/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-11/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-12/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-13/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-14/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-15/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-16/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-17/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-18/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-19/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-20/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-21/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-22/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-23/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-24/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-25/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-26/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-27/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-28/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-29/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-30/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-31/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-32/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-33/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-34/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-35/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-36/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-37/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-38/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-39/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-40/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-41/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-42/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-43/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-44/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-45/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-46/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-47/tx_dis', +'echo 0 > /sys/class/cpld-sfp28/port-48/tx_dis', +#Update System LED +'echo 82 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio82/direction', +'echo 0 > /sys/class/gpio/gpio82/value', +'echo 83 > /sys/class/gpio/export', +'echo out > /sys/class/gpio/gpio83/direction', +'echo 1 > /sys/class/gpio/gpio83/value', +] + +drivers =[ +'lpc_ich', +'i2c-i801', +'i2c-dev', +'i2c-mux-pca954x', +'gpio-pca953x', +'optoe', +'qci_cpld_sfp28', +'qci_cpld_led', +'qci_platform_ix8', +'ipmi_devintf' +] + + + +def system_install(): + global FORCE + + #remove default drivers to avoid modprobe order conflicts + status, output = exec_cmd("echo 'blacklist i2c-ismt' > /etc/modprobe.d/blacklist.conf", 1) + time.sleep(1) + status, output = exec_cmd("modprobe -r i2c-ismt ", 1) + status, output = exec_cmd("modprobe -r i2c-i801 ", 1) + #setup driver dependency + status, output = exec_cmd("depmod -a ", 1) + #install drivers + for i in range(0,len(drivers)): + status, output = exec_cmd("modprobe "+drivers[i], 1) + if status: + print output + if FORCE == 0: + return status + + #instantiate devices + for i in range(0,len(instantiate)): + status, output = exec_cmd(instantiate[i], 1) + if status: + print output + if FORCE == 0: + return status + + #QSFP for 1~56 port + for port_number in range(1,57): + bus_number = port_number + 31 + os.system("echo %d >/sys/bus/i2c/devices/%d-0050/port_name" % (port_number, bus_number)) + + return + + +def system_ready(): + if not device_found(): + return False + return True + +def install(): + if not device_found(): + print "No device, installing...." + status = system_install() + if status: + if FORCE == 0: + return status + else: + print " ix8 driver already installed...." + return + +def uninstall(): + global FORCE + #uninstall drivers + for i in range(len(drivers)-1,-1,-1): + status, output = exec_cmd("rmmod "+drivers[i], 1) + if status: + print output + if FORCE == 0: + return status + return + +def device_found(): + ret1, log = exec_cmd("ls "+i2c_prefix+"i2c-0", 0) + return ret1 + +if __name__ == "__main__": + main() + + + diff --git a/platform/marvell-arm64/one-image.mk b/platform/marvell-arm64/one-image.mk index ad8cd522f998..fcac03854348 100644 --- a/platform/marvell-arm64/one-image.mk +++ b/platform/marvell-arm64/one-image.mk @@ -3,5 +3,11 @@ SONIC_ONE_IMAGE = sonic-marvell.bin $(SONIC_ONE_IMAGE)_MACHINE = marvell $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) +$(SONIC_ONE_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR) +ifeq ($(INSTALL_DEBUG_TOOLS),y) +$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_DBG_IMAGES) +$(SONIC_ONE_IMAGE)_DOCKERS += $(filter-out $(patsubst %-$(DBG_IMAGE_MARK).gz,%.gz, $(SONIC_INSTALL_DOCKER_DBG_IMAGES)), $(SONIC_INSTALL_DOCKER_IMAGES)) +else +$(SONIC_ONE_IMAGE)_DOCKERS = $(SONIC_INSTALL_DOCKER_IMAGES) +endif SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 index b3942414c027..201d52284361 100755 --- a/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 @@ -26,7 +26,7 @@ RUN dpkg -i \ debs/{{ deb }}{{' '}} {%- endfor %} -COPY ["start.sh", "syncd.sh", "/usr/bin/"] +COPY ["start.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] ## Clean up diff --git a/platform/marvell-armhf/linux/Makefile b/platform/marvell-armhf/linux/Makefile index 4cd26d8ab3ec..0a616fa758d9 100644 --- a/platform/marvell-armhf/linux/Makefile +++ b/platform/marvell-armhf/linux/Makefile @@ -2,7 +2,7 @@ SHELL = /bin/bash .SHELLFLAGS += -e -LINUX_KERNEL_MRVL_URL = https://github.com/antony-rheneus/sonic-marvell-binaries/raw/master/armhf/kernel/$(LINUX_KERNEL) +LINUX_KERNEL_MRVL_URL = https://github.com/Marvell-switching/sonic-marvell-binaries/raw/master/armhf/kernel/$(LINUX_KERNEL) $(addprefix $(DEST)/, $(LINUX_KERNEL)): $(DEST)/% : # get deb package diff --git a/platform/marvell-armhf/one-image.mk b/platform/marvell-armhf/one-image.mk index ad8cd522f998..fcac03854348 100644 --- a/platform/marvell-armhf/one-image.mk +++ b/platform/marvell-armhf/one-image.mk @@ -3,5 +3,11 @@ SONIC_ONE_IMAGE = sonic-marvell.bin $(SONIC_ONE_IMAGE)_MACHINE = marvell $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie -$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) +$(SONIC_ONE_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR) +ifeq ($(INSTALL_DEBUG_TOOLS),y) +$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_DBG_IMAGES) +$(SONIC_ONE_IMAGE)_DOCKERS += $(filter-out $(patsubst %-$(DBG_IMAGE_MARK).gz,%.gz, $(SONIC_INSTALL_DOCKER_DBG_IMAGES)), $(SONIC_INSTALL_DOCKER_IMAGES)) +else +$(SONIC_ONE_IMAGE)_DOCKERS = $(SONIC_INSTALL_DOCKER_IMAGES) +endif SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/marvell-armhf/sai/Makefile b/platform/marvell-armhf/sai/Makefile index 5421a1b463a4..cf78504388c6 100644 --- a/platform/marvell-armhf/sai/Makefile +++ b/platform/marvell-armhf/sai/Makefile @@ -2,7 +2,7 @@ SHELL = /bin/bash .SHELLFLAGS += -e -MRVL_SAI_URL = https://github.com/antony-rheneus/sonic-marvell-binaries/raw/master/armhf/sai-plugin/$(MRVL_SAI) +MRVL_SAI_URL = https://github.com/Marvell-switching/sonic-marvell-binaries/raw/master/armhf/sai-plugin/$(MRVL_SAI) $(addprefix $(DEST)/, $(MRVL_SAI)): $(DEST)/% : # get deb package diff --git a/platform/mellanox/docker-syncd-mlnx.mk b/platform/mellanox/docker-syncd-mlnx.mk index b24958e7722b..b46c6478cf0e 100644 --- a/platform/mellanox/docker-syncd-mlnx.mk +++ b/platform/mellanox/docker-syncd-mlnx.mk @@ -11,5 +11,9 @@ $(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \ $(LIBSAIMETADATA_DBG) \ $(LIBSAIREDIS_DBG) +ifeq ($(SDK_FROM_SRC), y) +$(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(MLNX_SDK_DBG_DEBS) $(MLNX_SAI_DBGSYM) +endif + $(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot diff --git a/platform/mellanox/mlnx-sai.mk b/platform/mellanox/mlnx-sai.mk index 93a781e389f6..fd023ab9c2ed 100644 --- a/platform/mellanox/mlnx-sai.mk +++ b/platform/mellanox/mlnx-sai.mk @@ -8,4 +8,6 @@ MLNX_SAI = mlnx-sai_1.mlnx.$(MLNX_SAI_VERSION)_amd64.deb $(MLNX_SAI)_SRC_PATH = $(PLATFORM_PATH)/mlnx-sai $(MLNX_SAI)_DEPENDS += $(MLNX_SDK_DEBS) $(MLNX_SAI)_RDEPENDS += $(MLNX_SDK_RDEBS) $(MLNX_SDK_DEBS) +MLNX_SAI_DBGSYM = mlnx-sai-dbgsym_1.mlnx.$(MLNX_SAI_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(MLNX_SAI),$(MLNX_SAI_DBGSYM))) SONIC_MAKE_DEBS += $(MLNX_SAI) diff --git a/platform/mellanox/mlnx-sai/Makefile b/platform/mellanox/mlnx-sai/Makefile index 28706316634b..de6a7152d601 100644 --- a/platform/mellanox/mlnx-sai/Makefile +++ b/platform/mellanox/mlnx-sai/Makefile @@ -3,6 +3,7 @@ SHELL = /bin/bash .SHELLFLAGS += -e MAIN_TARGET = mlnx-sai_1.mlnx.$(MLNX_SAI_VERSION)_amd64.deb +DERIVED_TARGETS = mlnx-sai-dbgsym_1.mlnx.$(MLNX_SAI_VERSION)_amd64.deb $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : pushd SAI-Implementation @@ -12,5 +13,5 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : debuild -e 'make_extra_flags="DEFS=-DACS_OS"' -us -uc -d -b popd - mv $* $(DEST)/ + mv $(DERIVED_TARGETS) $* $(DEST)/ popd diff --git a/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd b/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd index 20bd14ffb4c1..b11403b31514 100644 --- a/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd +++ b/platform/mellanox/mlnx-sfpd/scripts/mlnx-sfpd @@ -30,6 +30,8 @@ STATUS_UNKNOWN = '2' SFPD_LIVENESS_EXPIRE_SECS = 30 +SDK_DAEMON_READY_FILE = '/tmp/sdk_ready' + sfp_value_status_dict = { SDK_SFP_STATE_IN: STATUS_PLUGIN, SDK_SFP_STATE_OUT: STATUS_PLUGOUT, @@ -64,7 +66,8 @@ def log_error(msg, also_print_to_console=False): class MlnxSfpd: ''' Listen to plugin/plugout cable events ''' - SX_OPEN_RETRIES = 20 + SX_OPEN_RETRIES = 30 + SX_OPEN_TIMEOUT = 5 SELECT_TIMEOUT = 1 def __init__(self): @@ -75,7 +78,6 @@ class MlnxSfpd: # Allocate SDK fd and user channel structures self.rx_fd_p = new_sx_fd_t_p() self.user_channel_p = new_sx_user_channel_t_p() - self.state_db = SonicV2Connector(host=REDIS_HOSTIP) # Register our signal handlers @@ -98,37 +100,78 @@ class MlnxSfpd: def initialize(self): self.state_db.connect("STATE_DB") - # open SDK API handle - # retry at most SX_OPEN_RETRIES times to wait - # until SDK is started during system startup - retry = 1 - while True: - rc, self.handle = sx_api_open(None) - if rc == SX_STATUS_SUCCESS: - break - - log_warning("failed to open SDK API handle... retrying {}".format(retry)) + swid_cnt_p = None - time.sleep(2 ** retry) - retry += 1 - - if retry > self.SX_OPEN_RETRIES: - raise RuntimeError("failed to open SDK API handle after {} retries".format(retry)) - - rc = sx_api_host_ifc_open(self.handle, self.rx_fd_p) - if rc != SX_STATUS_SUCCESS: - raise RuntimeError("sx_api_host_ifc_open exited with error, rc {}".format(rc)) + try: + # Wait for SDK daemon to be started with detect the sdk_ready file + retry = 0 + while not os.path.exists(SDK_DAEMON_READY_FILE): + if retry >= self.SX_OPEN_RETRIES: + raise RuntimeError("SDK daemon failed to start after {} retries and {} seconds waiting, exiting..." + .format(retry, self.SX_OPEN_TIMEOUT * self.SX_OPEN_RETRIES)) + else: + log_info("SDK daemon not started yet, retry {} times".format(retry)) + retry = retry + 1 + time.sleep(self.SX_OPEN_TIMEOUT) - self.user_channel_p.type = SX_USER_CHANNEL_TYPE_FD - self.user_channel_p.channel.fd = self.rx_fd_p + # to make sure SDK daemon has started + time.sleep(self.SX_OPEN_TIMEOUT) - rc = sx_api_host_ifc_trap_id_register_set(self.handle, - SX_ACCESS_CMD_REGISTER, - self.swid, - SX_TRAP_ID_PMPE, - self.user_channel_p) - if rc != SX_STATUS_SUCCESS: - raise RuntimeError("sx_api_host_ifc_trap_id_register_set exited with error, rc {}".format(c)) + # After SDK daemon started, sx_api_open and sx_api_host_ifc_open is ready for call + rc, self.handle = sx_api_open(None) + if rc != SX_STATUS_SUCCESS: + raise RuntimeError("failed to call sx_api_open with rc {}, exiting...".format(rc)) + + rc = sx_api_host_ifc_open(self.handle, self.rx_fd_p) + if rc != SX_STATUS_SUCCESS: + raise RuntimeError("failed to call sx_api_host_ifc_open with rc {}, exiting...".format(rc)) + + self.user_channel_p.type = SX_USER_CHANNEL_TYPE_FD + self.user_channel_p.channel.fd = self.rx_fd_p + + # Wait for switch to be created and initialized inside SDK + retry = 0 + swid_cnt_p = new_uint32_t_p() + uint32_t_p_assign(swid_cnt_p, 0) + swid_cnt = 0 + while True: + if retry >= self.SX_OPEN_RETRIES: + raise RuntimeError("switch not created after {} retries and {} seconds waiting, exiting..." + .format(retry, self.SX_OPEN_RETRIES * self.SX_OPEN_TIMEOUT)) + else: + rc = sx_api_port_swid_list_get(self.handle, None, swid_cnt_p) + if rc == SX_STATUS_SUCCESS: + swid_cnt = uint32_t_p_value(swid_cnt_p) + if swid_cnt > 0: + delete_uint32_t_p(swid_cnt_p) + swid_cnt_p = None + break + else: + log_info("switch not created yet, swid_cnt {}, retry {} times and wait for {} seconds" + .format(swid_cnt, retry, self.SX_OPEN_TIMEOUT * retry)) + else: + raise RuntimeError("sx_api_port_swid_list_get fail with rc {}, retry {} times and wait for {} seconds". + format(rc, retry, self.SX_OPEN_TIMEOUT * retry)) + + retry = retry + 1 + time.sleep(self.SX_OPEN_TIMEOUT) + + # After switch was created inside SDK, sx_api_host_ifc_trap_id_register_set is ready to call + rc = sx_api_host_ifc_trap_id_register_set(self.handle, + SX_ACCESS_CMD_REGISTER, + self.swid, + SX_TRAP_ID_PMPE, + self.user_channel_p) + + if rc != SX_STATUS_SUCCESS: + raise RuntimeError("sx_api_host_ifc_trap_id_register_set failed with rc {}, exiting...".format(rc)) + + self.running = True + except Exception as e: + log_error("mlnx-sfpd initialization failed due to {}, exiting...".format(repr(e))) + if swid_cnt_p is not None: + delete_uint32_t_p(swid_cnt_p) + self.deinitialize() def deinitialize(self): # remove mlnx-sfpd liveness key in DB if not expired yet @@ -156,7 +199,6 @@ class MlnxSfpd: log_error("sx_api_close exited with error, rc {}".format(rc)) def run(self): - self.running = True while self.running: try: diff --git a/platform/mellanox/sdk-src/applibs/Makefile b/platform/mellanox/sdk-src/applibs/Makefile index 767012410f9a..1068da0c5c16 100644 --- a/platform/mellanox/sdk-src/applibs/Makefile +++ b/platform/mellanox/sdk-src/applibs/Makefile @@ -2,7 +2,7 @@ SHELL = /bin/bash MAIN_TARGET = applibs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb -DERIVED_TARGETS = applibs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +DERIVED_TARGETS = applibs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb applibs-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb PACKAGE_NAME = applibs $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : diff --git a/platform/mellanox/sdk-src/iproute2/Makefile b/platform/mellanox/sdk-src/iproute2/Makefile index fad46e625336..0e32fe1426c4 100644 --- a/platform/mellanox/sdk-src/iproute2/Makefile +++ b/platform/mellanox/sdk-src/iproute2/Makefile @@ -2,7 +2,7 @@ SHELL = /bin/bash MAIN_TARGET = iproute2_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb -DERIVED_TARGETS = iproute2-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +DERIVED_TARGETS = iproute2-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb iproute2-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb PACKAGE_NAME = iproute2-3.19.0 $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : diff --git a/platform/mellanox/sdk-src/python-sdk-api/Makefile b/platform/mellanox/sdk-src/python-sdk-api/Makefile index 2ea14cd9d625..9c41be75725b 100644 --- a/platform/mellanox/sdk-src/python-sdk-api/Makefile +++ b/platform/mellanox/sdk-src/python-sdk-api/Makefile @@ -2,7 +2,7 @@ SHELL = /bin/bash MAIN_TARGET = python-sdk-api_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb -DERIVED_TARGETS = +DERIVED_TARGETS = python-sdk-api-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb PACKAGE_NAME = python_sdk_api $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : diff --git a/platform/mellanox/sdk-src/sx-complib/Makefile b/platform/mellanox/sdk-src/sx-complib/Makefile index aae38a6439ed..6e51b779ef23 100644 --- a/platform/mellanox/sdk-src/sx-complib/Makefile +++ b/platform/mellanox/sdk-src/sx-complib/Makefile @@ -3,7 +3,8 @@ SHELL = /bin/bash MAIN_TARGET = sx-complib_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb DERIVED_TARGETS = sx-complib-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb \ - sx-complib-dev-static_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb + sx-complib-dev-static_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb \ + sx-complib-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb PACKAGE_NAME = sx_complib $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : diff --git a/platform/mellanox/sdk-src/sx-examples/Makefile b/platform/mellanox/sdk-src/sx-examples/Makefile index 4368a43f68d6..06de0f475062 100644 --- a/platform/mellanox/sdk-src/sx-examples/Makefile +++ b/platform/mellanox/sdk-src/sx-examples/Makefile @@ -2,7 +2,7 @@ SHELL = /bin/bash MAIN_TARGET = sx-examples_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb -DERIVED_TARGETS = sx-examples-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +DERIVED_TARGETS = sx-examples-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb sx-examples-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb PACKAGE_NAME = sx_examples $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : diff --git a/platform/mellanox/sdk-src/sx-gen-utils/Makefile b/platform/mellanox/sdk-src/sx-gen-utils/Makefile index b5814b5bc6d9..1f6f31d9acd4 100644 --- a/platform/mellanox/sdk-src/sx-gen-utils/Makefile +++ b/platform/mellanox/sdk-src/sx-gen-utils/Makefile @@ -2,7 +2,7 @@ SHELL = /bin/bash MAIN_TARGET = sx-gen-utils_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb -DERIVED_TARGETS = sx-gen-utils-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +DERIVED_TARGETS = sx-gen-utils-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb sx-gen-utils-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb PACKAGE_NAME = sx_gen_utils $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : diff --git a/platform/mellanox/sdk-src/sx-scew/Makefile b/platform/mellanox/sdk-src/sx-scew/Makefile index b0679fa9c8bc..9b8c5bd56c39 100644 --- a/platform/mellanox/sdk-src/sx-scew/Makefile +++ b/platform/mellanox/sdk-src/sx-scew/Makefile @@ -3,7 +3,8 @@ SHELL = /bin/bash MAIN_TARGET = sx-scew_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb DERIVED_TARGETS = sx-scew-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb \ - sx-scew-dev-static_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb + sx-scew-dev-static_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb \ + sx-scew-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb PACKAGE_NAME = sx_scew $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : diff --git a/platform/mellanox/sdk-src/sxd-libs/Makefile b/platform/mellanox/sdk-src/sxd-libs/Makefile index 82cedb3bd131..0b142c920828 100644 --- a/platform/mellanox/sdk-src/sxd-libs/Makefile +++ b/platform/mellanox/sdk-src/sxd-libs/Makefile @@ -3,7 +3,8 @@ SHELL = /bin/bash MAIN_TARGET = sxd-libs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb DERIVED_TARGETS = sxd-libs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb \ - sxd-libs-dev-static_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb + sxd-libs-dev-static_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb \ + sxd-libs-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb PACKAGE_NAME = sxd_libs $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : diff --git a/platform/mellanox/sdk-src/wjh-libs/Makefile b/platform/mellanox/sdk-src/wjh-libs/Makefile index fd1e53168ea2..ecc437258ec2 100644 --- a/platform/mellanox/sdk-src/wjh-libs/Makefile +++ b/platform/mellanox/sdk-src/wjh-libs/Makefile @@ -3,7 +3,8 @@ SHELL = /bin/bash MAIN_TARGET = wjh-libs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb DERIVED_TARGETS = wjh-libs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb \ - wjh-libs-dev-static_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb + wjh-libs-dev-static_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb \ + wjh-libs-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb PACKAGE_NAME = wjh_libs $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : diff --git a/platform/mellanox/sdk.mk b/platform/mellanox/sdk.mk index 3aff8523182a..1401b5f6289f 100644 --- a/platform/mellanox/sdk.mk +++ b/platform/mellanox/sdk.mk @@ -7,32 +7,54 @@ MLNX_SDK_DEB_VERSION = $(subst _,.,$(MLNX_SDK_VERSION)) # Place here URL where SDK sources exist MLNX_SDK_SOURCE_BASE_URL = +ifneq ($(MLNX_SDK_SOURCE_BASE_URL), ) +SDK_FROM_SRC = y +else +SDK_FROM_SRC = n +endif + export MLNX_SDK_SOURCE_BASE_URL MLNX_SDK_VERSION MLNX_SDK_ISSU_VERSION MLNX_SDK_DEB_VERSION -MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_ACL_RM) $(SX_COMPLIB) \ +MLNX_SDK_RDEBS += $(APPLIBS) $(IPROUTE2_MLNX) $(SX_COMPLIB) \ $(SX_EXAMPLES) $(SX_GEN_UTILS) $(SX_SCEW) $(SXD_LIBS) $(WJH_LIBS) -MLNX_SDK_DEBS += $(APPLIBS_DEV) $(IPROUTE2_MLNX_DEV) $(SX_ACL_RM_DEV) \ +MLNX_SDK_DEBS += $(APPLIBS_DEV) $(IPROUTE2_MLNX_DEV) \ $(SX_COMPLIB_DEV) $(SX_COMPLIB_DEV_STATIC) $(SX_EXAMPLES_DEV) \ $(SX_GEN_UTILS_DEV) $(SX_SCEW_DEV) $(SX_SCEW_DEV_STATIC) \ $(SXD_LIBS_DEV) $(SXD_LIBS_DEV_STATIC) $(WJH_LIBS_DEV) +MLNX_SDK_DBG_DEBS += $(APPLIBS_DBGSYM) $(IPROUTE2_MLNX_DBGSYM) $(SX_COMPLIB_DBGSYM) \ + $(SX_EXAMPLES_DBGSYM) $(SX_GEN_UTILS_DBGSYM) $(SX_SCEW_DBGSYM) \ + $(SXD_LIBS_DBGSYM) $(WJH_LIBS_DBGSYM) + APPLIBS = applibs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb $(APPLIBS)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/applibs $(APPLIBS)_DEPENDS += $(SX_COMPLIB_DEV) $(SX_GEN_UTILS_DEV) $(SXD_LIBS_DEV) $(LIBNL3_DEV) $(LIBNL_GENL3_DEV) $(APPLIBS)_RDEPENDS += $(SX_COMPLIB) $(SX_GEN_UTILS) $(SXD_LIBS) $(LIBNL3) $(LIBNL_GENL3) APPLIBS_DEV = applibs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb $(eval $(call add_derived_package,$(APPLIBS),$(APPLIBS_DEV))) +APPLIBS_DBGSYM = applibs-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +ifeq ($(SDK_FROM_SRC),y) +$(eval $(call add_derived_package,$(APPLIBS),$(APPLIBS_DBGSYM))) +endif IPROUTE2_MLNX = iproute2_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb $(IPROUTE2_MLNX)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/iproute2 IPROUTE2_MLNX_DEV = iproute2-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb $(eval $(call add_derived_package,$(IPROUTE2_MLNX),$(IPROUTE2_MLNX_DEV))) +IPROUTE2_MLNX_DBGSYM = iproute2-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +ifeq ($(SDK_FROM_SRC),y) +$(eval $(call add_derived_package,$(IPROUTE2_MLNX),$(IPROUTE2_MLNX_DBGSYM))) +endif SX_COMPLIB = sx-complib_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb $(SX_COMPLIB)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/sx-complib SX_COMPLIB_DEV = sx-complib-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb $(eval $(call add_derived_package,$(SX_COMPLIB),$(SX_COMPLIB_DEV))) +SX_COMPLIB_DBGSYM = sx-complib-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +ifeq ($(SDK_FROM_SRC),y) +$(eval $(call add_derived_package,$(SX_COMPLIB),$(SX_COMPLIB_DBGSYM))) +endif SX_EXAMPLES = sx-examples_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb $(SX_EXAMPLES)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/sx-examples @@ -40,6 +62,10 @@ $(SX_EXAMPLES)_DEPENDS += $(APPLIBS_DEV) $(SX_SCEW_DEV) $(SXD_LIBS_DEV) $(SX_EXAMPLES)_RDEPENDS += $(APPLIBS) $(SX_SCEW) $(SXD_LIBS) SX_EXAMPLES_DEV = sx-examples-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb $(eval $(call add_derived_package,$(SX_EXAMPLES),$(SX_EXAMPLES_DEV))) +SX_EXAMPLES_DBGSYM = sx-examples-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +ifeq ($(SDK_FROM_SRC),y) +$(eval $(call add_derived_package,$(SX_EXAMPLES),$(SX_EXAMPLES_DBGSYM))) +endif SX_GEN_UTILS = sx-gen-utils_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb $(SX_GEN_UTILS)_SRC_PATH += $(PLATFORM_PATH)/sdk-src/sx-gen-utils @@ -47,29 +73,39 @@ $(SX_GEN_UTILS)_DEPENDS += $(SX_COMPLIB_DEV) $(SXD_LIBS_DEV) $(SX_GEN_UTILS)_RDEPENDS += $(SX_COMPLIB) SX_GEN_UTILS_DEV = sx-gen-utils-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb $(eval $(call add_derived_package,$(SX_GEN_UTILS),$(SX_GEN_UTILS_DEV))) +SX_GEN_UTILS_DBGSYM = sx-gen-utils-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +ifeq ($(SDK_FROM_SRC),y) +$(eval $(call add_derived_package,$(SX_GEN_UTILS),$(SX_GEN_UTILS_DBGSYM))) +endif SX_SCEW = sx-scew_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb $(SX_SCEW)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/sx-scew SX_SCEW_DEV = sx-scew-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb $(eval $(call add_derived_package,$(SX_SCEW),$(SX_SCEW_DEV))) +SX_SCEW_DBGSYM = sx-scew-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +ifeq ($(SDK_FROM_SRC),y) +$(eval $(call add_derived_package,$(SX_SCEW),$(SX_SCEW_DBGSYM))) +endif SXD_LIBS = sxd-libs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb $(SXD_LIBS)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/sxd-libs $(SXD_LIBS)_DEPENDS += $(SX_COMPLIB_DEV) SXD_LIBS_DEV = sxd-libs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb $(eval $(call add_derived_package,$(SXD_LIBS),$(SXD_LIBS_DEV))) +SXD_LIBS_DBGSYM = sxd-libs-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +ifeq ($(SDK_FROM_SRC),y) +$(eval $(call add_derived_package,$(SXD_LIBS),$(SXD_LIBS_DBGSYM))) +endif #packages that are required for runtime only PYTHON_SDK_API = python-sdk-api_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb $(PYTHON_SDK_API)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/python-sdk-api $(PYTHON_SDK_API)_DEPENDS += $(APPLIBS_DEV) $(SXD_LIBS_DEV) $(SWIG) $(PYTHON_SDK_API)_RDEPENDS += $(APPLIBS) $(SXD_LIBS) - -SX_KERNEL = sx-kernel_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb -$(SX_KERNEL)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) -$(SX_KERNEL)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/sx-kernel -SX_KERNEL_DEV = sx-kernel-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb -$(eval $(call add_derived_package,$(SX_KERNEL),$(SX_KERNEL_DEV))) +PYTHON_SDK_API_DBGSYM = python-sdk-api-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +ifeq ($(SDK_FROM_SRC),y) +$(eval $(call add_derived_package,$(PYTHON_SDK_API),$(PYTHON_SDK_API_DBGSYM))) +endif WJH_LIBS = wjh-libs_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb $(WJH_LIBS)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/wjh-libs @@ -77,6 +113,16 @@ $(WJH_LIBS)_DEPENDS += $(SX_COMPLIB_DEV) $(SXD_LIBS_DEV) $(APPLIBS_DEV) $(WJH_LIBS)_RDEPENDS += $(SX_COMPLIB) $(PYTHON_SDK_API) WJH_LIBS_DEV = wjh-libs-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb $(eval $(call add_derived_package,$(WJH_LIBS),$(WJH_LIBS_DEV))) +WJH_LIBS_DBGSYM = wjh-libs-dbgsym_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +ifeq ($(SDK_FROM_SRC),y) +$(eval $(call add_derived_package,$(WJH_LIBS),$(WJH_LIBS_DBGSYM))) +endif + +SX_KERNEL = sx-kernel_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +$(SX_KERNEL)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(SX_KERNEL)_SRC_PATH = $(PLATFORM_PATH)/sdk-src/sx-kernel +SX_KERNEL_DEV = sx-kernel-dev_1.mlnx.$(MLNX_SDK_DEB_VERSION)_amd64.deb +$(eval $(call add_derived_package,$(SX_KERNEL),$(SX_KERNEL_DEV))) define make_url $(1)_URL = $(MLNX_SDK_BASE_URL)/$(1) @@ -87,7 +133,7 @@ $(eval $(foreach deb,$(MLNX_SDK_DEBS),$(call make_url,$(deb)))) $(eval $(foreach deb,$(MLNX_SDK_RDEBS),$(call make_url,$(deb)))) $(eval $(foreach deb,$(PYTHON_SDK_API) $(SX_KERNEL) $(SX_KERNEL_DEV),$(call make_url,$(deb)))) -ifneq ($(MLNX_SDK_SOURCE_BASE_URL), ) +ifeq ($(SDK_FROM_SRC), y) SONIC_MAKE_DEBS += $(MLNX_SDK_RDEBS) $(PYTHON_SDK_API) $(SX_KERNEL) else SONIC_ONLINE_DEBS += $(MLNX_SDK_RDEBS) $(PYTHON_SDK_API) $(SX_KERNEL) diff --git a/platform/nephos/platform-modules-accton.mk b/platform/nephos/platform-modules-accton.mk index 1d4788bc9a27..ebfd77f30fc8 100644 --- a/platform/nephos/platform-modules-accton.mk +++ b/platform/nephos/platform-modules-accton.mk @@ -1,6 +1,6 @@ # Accton AS7116 54X Platform modules -ACCTON_AS7116_54X_PLATFORM_MODULE_VERSION = 1.0.0 +ACCTON_AS7116_54X_PLATFORM_MODULE_VERSION = 1.0.1 export ACCTON_AS7116_54X_PLATFORM_MODULE_VERSION diff --git a/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/Makefile b/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/Makefile index 19c7029f14a2..2d838864a27a 100644 --- a/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/Makefile +++ b/platform/nephos/sonic-platform-modules-accton/as7116-54x/modules/Makefile @@ -1,2 +1,2 @@ obj-m := x86-64-accton-as7116-54x-cpld.o x86-64-accton-as7116-54x-fan.o \ - x86-64-accton-as7116-54x-led.o x86-64-accton-as7116-54x-psu.o x86-64-accton-as7116-54x-sfp.o + x86-64-accton-as7116-54x-led.o x86-64-accton-as7116-54x-psu.o x86-64-accton-as7116-54x-sfp.o \ No newline at end of file diff --git a/platform/nephos/sonic-platform-modules-accton/as7116-54x/service/as7116-platform-init.service b/platform/nephos/sonic-platform-modules-accton/as7116-54x/service/as7116-platform-init.service index be8688d2c2d2..4331c8828eea 100755 --- a/platform/nephos/sonic-platform-modules-accton/as7116-54x/service/as7116-platform-init.service +++ b/platform/nephos/sonic-platform-modules-accton/as7116-54x/service/as7116-platform-init.service @@ -10,4 +10,4 @@ ExecStop=/usr/local/bin/accton_as7116_util.py clean RemainAfterExit=yes [Install] -WantedBy=multi-user.target +WantedBy=multi-user.target \ No newline at end of file diff --git a/platform/nephos/sonic-platform-modules-accton/debian/changelog b/platform/nephos/sonic-platform-modules-accton/debian/changelog index 49f8f44bca48..595fe0985c06 100755 --- a/platform/nephos/sonic-platform-modules-accton/debian/changelog +++ b/platform/nephos/sonic-platform-modules-accton/debian/changelog @@ -1,6 +1,5 @@ -sonic-accton-platform-modules (1.0.0) unstable; urgency=low +sonic-accton-platform-modules (1.0.1) unstable; urgency=low * Add support for AS7116-54X series - -- developer Wed, 29 Mar 2017 11:00:00 +0800 - + -- developer Wed, 29 Mar 2017 11:00:00 +0800 \ No newline at end of file diff --git a/platform/nephos/sonic-platform-modules-accton/debian/control b/platform/nephos/sonic-platform-modules-accton/debian/control index 1d5c3a8201a7..8f7258ebdd6a 100755 --- a/platform/nephos/sonic-platform-modules-accton/debian/control +++ b/platform/nephos/sonic-platform-modules-accton/debian/control @@ -8,4 +8,4 @@ Standards-Version: 3.9.3 Package: sonic-platform-accton-as7116-54x Architecture: amd64 Depends: linux-image-4.9.0-9-2-amd64 -Description: kernel modules for platform devices such as fan, led, sfp +Description: kernel modules for platform devices such as fan, led, sfp \ No newline at end of file diff --git a/platform/nephos/sonic-platform-modules-accton/debian/rules b/platform/nephos/sonic-platform-modules-accton/debian/rules index cb232bd42425..44caba25cfa2 100755 --- a/platform/nephos/sonic-platform-modules-accton/debian/rules +++ b/platform/nephos/sonic-platform-modules-accton/debian/rules @@ -59,9 +59,9 @@ binary-indep: # Custom package commands (for mod in $(MODULE_DIRS); do \ - dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ - dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin; \ - dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system; \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} /$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} /usr/local/bin; \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} /lib/systemd/system; \ cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \ cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \ @@ -83,4 +83,4 @@ binary-indep: dh_gencontrol dh_md5sums dh_builddeb -.PHONY: build binary binary-arch binary-indep clean +.PHONY: build binary binary-arch binary-indep clean \ No newline at end of file diff --git a/slave.mk b/slave.mk index f2c7e437caa9..162c167ebf82 100644 --- a/slave.mk +++ b/slave.mk @@ -612,7 +612,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \ $(LIBNSS_TACPLUS)) \ $$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) \ $$(addprefix $(FILES_PATH)/,$$($$*_FILES)) \ - $(addprefix $(STRETCH_FILES_PATH)/,$(IXGBE_DRIVER)) \ + $(addprefix $(STRETCH_FILES_PATH)/, $(if $(filter $(CONFIGURED_ARCH),amd64), $(IXGBE_DRIVER))) \ $(addprefix $(PYTHON_DEBS_PATH)/,$(SONIC_UTILS)) \ $(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_CONFIG_ENGINE)) \ $(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_COMMON_PY2)) \ diff --git a/sonic-slave-stretch/Dockerfile.j2 b/sonic-slave-stretch/Dockerfile.j2 index fc7066361e13..5c1739c49d50 100644 --- a/sonic-slave-stretch/Dockerfile.j2 +++ b/sonic-slave-stretch/Dockerfile.j2 @@ -249,6 +249,17 @@ RUN apt-get update && apt-get install -y \ cmake \ # For pam_tacplus build autoconf-archive \ +# For iproute2 + cm-super-minimal \ + libatm1-dev \ + libelf-dev \ + libmnl-dev \ + libselinux1-dev \ + linuxdoc-tools \ + lynx \ + texlive-latex-extra \ + texlive-latex-recommended \ + iproute2 \ # For python-click build python-sphinx \ python-docutils \ diff --git a/src/snmpd/patch-5.7.3+dfsg/0006-Release-all-requests-that-use-this-session.patch b/src/snmpd/patch-5.7.3+dfsg/0006-Release-all-requests-that-use-this-session.patch new file mode 100644 index 000000000000..66a18eb17245 --- /dev/null +++ b/src/snmpd/patch-5.7.3+dfsg/0006-Release-all-requests-that-use-this-session.patch @@ -0,0 +1,26 @@ +From 84846206c7ee230bd7b6274af98513952c4a7a7f Mon Sep 17 00:00:00 2001 +From: Renuka Manavalan +Date: Wed, 7 Aug 2019 21:48:33 +0000 +Subject: [PATCH] Release all requests that use this session. + +--- + agent/snmp_agent.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/agent/snmp_agent.c b/agent/snmp_agent.c +index b96d650..ee3b0da 100644 +--- a/agent/snmp_agent.c ++++ b/agent/snmp_agent.c +@@ -1542,7 +1542,8 @@ netsnmp_remove_delegated_requests_for_session(netsnmp_session *sess) + * check each request + */ + netsnmp_request_info *request; +- for(request = asp->requests; request; request = request->next) { ++ int i; ++ for(i = 0, request = asp->requests; i < asp->vbcount; ++i, ++request) { + /* + * check session + */ +-- +2.17.1 + diff --git a/src/snmpd/patch-5.7.3+dfsg/series b/src/snmpd/patch-5.7.3+dfsg/series index e3764c3aac59..04ee079ffe90 100644 --- a/src/snmpd/patch-5.7.3+dfsg/series +++ b/src/snmpd/patch-5.7.3+dfsg/series @@ -3,3 +3,4 @@ 0003-CHANGES-BUG-2743-snmpd-crashes-when-receiving-a-GetN.patch 0004-Disable-SNMPv1.patch 0005-Port-OpenSSL-1.1.0-with-support-for-1.0.2.patch +0006-Release-all-requests-that-use-this-session.patch diff --git a/src/sonic-config-engine/sonic_device_util.py b/src/sonic-config-engine/sonic_device_util.py index f9c200eebd93..c7b2528194fc 100644 --- a/src/sonic-config-engine/sonic_device_util.py +++ b/src/sonic-config-engine/sonic_device_util.py @@ -65,16 +65,24 @@ def get_system_mac(): if valid_mac_address(mac): return mac - get_mac_cmd = "sudo decode-syseeprom -m" + hw_mac_entry_cmds = [ "sudo decode-syseeprom -m" ] + elif (version_info['asic_type'] == 'marvell'): + # Try valid mac in eeprom, else fetch it from eth0 + platform = get_platform_info(get_machine_info()) + hwsku = get_machine_info()['onie_machine'] + profile_cmd = 'cat /usr/share/sonic/device/' + platform +'/'+ hwsku +'/profile.ini | cut -f2 -d=' + hw_mac_entry_cmds = [ profile_cmd, "sudo decode-syseeprom -m", "ip link show eth0 | grep ether | awk '{print $2}'" ] else: - get_mac_cmd = "ip link show eth0 | grep ether | awk '{print $2}'" - - proc = subprocess.Popen(get_mac_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - (mac, err) = proc.communicate() - if err: - return None - - mac = mac.strip() + hw_mac_entry_cmds = [ "ip link show eth0 | grep ether | awk '{print $2}'" ] + + for get_mac_cmd in hw_mac_entry_cmds: + proc = subprocess.Popen(get_mac_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + (mac, err) = proc.communicate() + if err: + continue + mac = mac.strip() + if valid_mac_address(mac): + break if not valid_mac_address(mac): return None diff --git a/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh b/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh index 383f7cb389e9..5f50106ff556 100644 --- a/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh +++ b/src/sonic-config-engine/tests/sample_output/wait_for_intf.sh @@ -31,11 +31,7 @@ function wait_until_iface_ready # Wait for all interfaces to be up and ready wait_until_iface_ready ${VLAN_TABLE_PREFIX} Vlan1000 wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel01 -wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel01 -wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel02 wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel02 wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel03 -wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel03 -wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel04 wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel04 diff --git a/src/sonic-frr/Makefile b/src/sonic-frr/Makefile index 0d68706a8977..1e1e198e42d7 100644 --- a/src/sonic-frr/Makefile +++ b/src/sonic-frr/Makefile @@ -12,6 +12,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : patch -p1 < ../patch/0002-Reduce-severity-of-Vty-connected-from-message.patch patch -p1 < ../patch/0003-ignore-nexthop-attribute-when-NLRI-is-present.patch patch -p1 < ../patch/0004-Allow-BGP-attr-NEXT_HOP-to-be-0.0.0.0-due-to-allevia.patch + patch -p1 < ../patch/0005-Support-VRF.patch tools/tarsource.sh -V -e '-sonic' dpkg-buildpackage -rfakeroot -b -us -uc -Ppkg.frr.nortrlib -j$(SONIC_CONFIG_MAKE_JOBS) popd diff --git a/src/sonic-frr/patch/0005-Support-VRF.patch b/src/sonic-frr/patch/0005-Support-VRF.patch new file mode 100644 index 000000000000..c6de0e5ecf0e --- /dev/null +++ b/src/sonic-frr/patch/0005-Support-VRF.patch @@ -0,0 +1,30 @@ +From 81990d9aafdfd459c0caa6cf07501fa628ada454 Mon Sep 17 00:00:00 2001 +From: Tyler Li +Date: Mon, 3 Jun 2019 01:48:11 -0700 +Subject: [PATCH] Support VRF + +--- + zebra/zebra_fpm_netlink.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c +index 207cbc099..b98c6886b 100644 +--- a/zebra/zebra_fpm_netlink.c ++++ b/zebra/zebra_fpm_netlink.c +@@ -327,7 +327,12 @@ static int netlink_route_info_encode(netlink_route_info_t *ri, char *in_buf, + req->n.nlmsg_flags = NLM_F_CREATE | NLM_F_REQUEST; + req->n.nlmsg_type = ri->nlmsg_type; + req->r.rtm_family = ri->af; +- req->r.rtm_table = ri->rtm_table; ++ if (ri->rtm_table < 256) ++ req->r.rtm_table = ri->rtm_table; ++ else { ++ req->r.rtm_table = RT_TABLE_COMPAT; ++ addattr32(&req->n, in_buf_len, RTA_TABLE, ri->rtm_table); ++ } + req->r.rtm_dst_len = ri->prefix->prefixlen; + req->r.rtm_protocol = ri->rtm_protocol; + req->r.rtm_scope = RT_SCOPE_UNIVERSE; +-- +2.11.0 + diff --git a/src/sonic-frr/patch/series b/src/sonic-frr/patch/series index 05df330b9bae..4033e555fe7f 100644 --- a/src/sonic-frr/patch/series +++ b/src/sonic-frr/patch/series @@ -2,3 +2,4 @@ 0002-Reduce-severity-of-Vty-connected-from-message.patch 0003-ignore-nexthop-attribute-when-NLRI-is-present.patch 0004-Allow-BGP-attr-NEXT_HOP-to-be-0.0.0.0-due-to-allevia.patch +0005-Support-VRF.patch diff --git a/src/sonic-swss b/src/sonic-swss index 63afbd5f0c89..5be3963793d5 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit 63afbd5f0c89de8ce00cf717a266381f0822ce86 +Subproject commit 5be3963793d5d04807931f016faf1fcca87f6286 diff --git a/src/sonic-swss-common b/src/sonic-swss-common index af073bf51214..036a5d36ad30 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit af073bf5121442e9ce10dfe5b2cb1d306722e27a +Subproject commit 036a5d36ad307303fdd9315bb06f2240842e5999