meta-bletchley: add switch diagnostics script

Add a switch diagnostics script to dump port register via mdio bus.

Tested:

root@bletchley:~# /usr/libexec/bletchley-switch-diag
========================================
Port 10 (BMC)
****************************************
[00]: 0E07 (Port Status)
[01]: 0003 (Physical Control)
[02]: 0000 (Flow Control)
[03]: 1920 (Switch Identifier)
[04]: 007F (Port Control 0)
[05]: 0000 (Port Control 1)
[06]: 07FE (Port Based VLAN Map)
[07]: 0001 (Default VLAN ID & Priority)
[08]: 2080 (Port Control 2)
[09]: 0001 (Egress Rate Control)
[0A]: 8000 (Egress Rate Control 2)
[0B]: 0001 (Port Association Vector)
[0C]: 0000 (Port ATU Control)
[0D]: 0000 (Override)
[0E]: 0000 (Policy & MGMT Control)
[10]: 0000 (Extended Port Control Operation)
[11]: 0000 (Extended Port Control Data)
[16]: 0000 (LED Control)
[17]: 0000 (IP Priority Mapping Table)
[18]: 0000 (IEEE Priority Mapping Table)
[19]: 0000 (Port Control 3)
[1B]: 8000 (Queue Counters)
[1C]: 0000 (Queue Control)
[1D]: 0000 (Queue Control 2)
[1E]: 0000 (Enable & Cut Through)
[1F]: 001B (Debug Counters)
========================================

========================================
Port 3 (SLED1)
****************************************
[00]: 100F (Port Status)
[01]: 0003 (Physical Control)
[02]: 0000 (Flow Control)
[03]: 1920 (Switch Identifier)
[04]: 007F (Port Control 0)
[05]: 0000 (Port Control 1)
[06]: 07FD (Port Based VLAN Map)
[07]: 0001 (Default VLAN ID & Priority)
[08]: 2080 (Port Control 2)
[09]: 0001 (Egress Rate Control)
[0A]: 8000 (Egress Rate Control 2)
[0B]: 0002 (Port Association Vector)
[0C]: 0000 (Port ATU Control)
[0D]: 0000 (Override)
[0E]: 0000 (Policy & MGMT Control)
[10]: 0000 (Extended Port Control Operation)
[11]: 0000 (Extended Port Control Data)
[16]: 0033 (LED Control)
[17]: 0000 (IP Priority Mapping Table)
[18]: 0000 (IEEE Priority Mapping Table)
[19]: 0000 (Port Control 3)
[1B]: 8000 (Queue Counters)
[1C]: 0000 (Queue Control)
[1D]: 0000 (Queue Control 2)
[1E]: 0000 (Enable & Cut Through)
[1F]: 0000 (Debug Counters)
========================================

========================================
Port 2 (SLED2)
****************************************
[00]: 100F (Port Status)
[01]: 0003 (Physical Control)
[02]: 0000 (Flow Control)
[03]: 1920 (Switch Identifier)
[04]: 007F (Port Control 0)
[05]: 0000 (Port Control 1)
[06]: 07FB (Port Based VLAN Map)
[07]: 0001 (Default VLAN ID & Priority)
[08]: 2080 (Port Control 2)
[09]: 0001 (Egress Rate Control)
[0A]: 8000 (Egress Rate Control 2)
[0B]: 0004 (Port Association Vector)
[0C]: 0000 (Port ATU Control)
[0D]: 0000 (Override)
[0E]: 0000 (Policy & MGMT Control)
[10]: 0000 (Extended Port Control Operation)
[11]: 0000 (Extended Port Control Data)
[16]: 0033 (LED Control)
[17]: 0000 (IP Priority Mapping Table)
[18]: 0000 (IEEE Priority Mapping Table)
[19]: 0000 (Port Control 3)
[1B]: 8000 (Queue Counters)
[1C]: 0000 (Queue Control)
[1D]: 0000 (Queue Control 2)
[1E]: 0000 (Enable & Cut Through)
[1F]: 0000 (Debug Counters)
========================================

========================================
Port 1 (SLED3)
****************************************
[00]: 100F (Port Status)
[01]: 0003 (Physical Control)
[02]: 0000 (Flow Control)
[03]: 1920 (Switch Identifier)
[04]: 007F (Port Control 0)
[05]: 0000 (Port Control 1)
[06]: 07F7 (Port Based VLAN Map)
[07]: 0001 (Default VLAN ID & Priority)
[08]: 2080 (Port Control 2)
[09]: 0001 (Egress Rate Control)
[0A]: 8000 (Egress Rate Control 2)
[0B]: 0008 (Port Association Vector)
[0C]: 0000 (Port ATU Control)
[0D]: 0000 (Override)
[0E]: 0000 (Policy & MGMT Control)
[10]: 0000 (Extended Port Control Operation)
[11]: 0000 (Extended Port Control Data)
[16]: 0033 (LED Control)
[17]: 0000 (IP Priority Mapping Table)
[18]: 0000 (IEEE Priority Mapping Table)
[19]: 0000 (Port Control 3)
[1B]: 8000 (Queue Counters)
[1C]: 0000 (Queue Control)
[1D]: 0000 (Queue Control 2)
[1E]: 0000 (Enable & Cut Through)
[1F]: 0000 (Debug Counters)
========================================

========================================
Port 7 (SLED4)
****************************************
[00]: 100F (Port Status)
[01]: 0003 (Physical Control)
[02]: 0000 (Flow Control)
[03]: 1920 (Switch Identifier)
[04]: 007F (Port Control 0)
[05]: 0000 (Port Control 1)
[06]: 07EF (Port Based VLAN Map)
[07]: 0001 (Default VLAN ID & Priority)
[08]: 2080 (Port Control 2)
[09]: 0001 (Egress Rate Control)
[0A]: 8000 (Egress Rate Control 2)
[0B]: 0010 (Port Association Vector)
[0C]: 0000 (Port ATU Control)
[0D]: 0000 (Override)
[0E]: 0000 (Policy & MGMT Control)
[10]: 0000 (Extended Port Control Operation)
[11]: 0000 (Extended Port Control Data)
[16]: 0033 (LED Control)
[17]: 0000 (IP Priority Mapping Table)
[18]: 0000 (IEEE Priority Mapping Table)
[19]: 0000 (Port Control 3)
[1B]: 8000 (Queue Counters)
[1C]: 0000 (Queue Control)
[1D]: 0000 (Queue Control 2)
[1E]: 0000 (Enable & Cut Through)
[1F]: 0000 (Debug Counters)
========================================

========================================
Port 6 (SLED5)
****************************************
[00]: 1D4F (Port Status)
[01]: 0003 (Physical Control)
[02]: 0000 (Flow Control)
[03]: 1920 (Switch Identifier)
[04]: 007F (Port Control 0)
[05]: 0000 (Port Control 1)
[06]: 07DF (Port Based VLAN Map)
[07]: 0001 (Default VLAN ID & Priority)
[08]: 2080 (Port Control 2)
[09]: 0001 (Egress Rate Control)
[0A]: 8000 (Egress Rate Control 2)
[0B]: 0020 (Port Association Vector)
[0C]: 0000 (Port ATU Control)
[0D]: 0000 (Override)
[0E]: 0000 (Policy & MGMT Control)
[10]: 0000 (Extended Port Control Operation)
[11]: 0000 (Extended Port Control Data)
[16]: 0033 (LED Control)
[17]: 0000 (IP Priority Mapping Table)
[18]: 0000 (IEEE Priority Mapping Table)
[19]: 0000 (Port Control 3)
[1B]: 8000 (Queue Counters)
[1C]: 0000 (Queue Control)
[1D]: 0000 (Queue Control 2)
[1E]: 0000 (Enable & Cut Through)
[1F]: 0075 (Debug Counters)
========================================

========================================
Port 5 (SLED6)
****************************************
[00]: 1D4F (Port Status)
[01]: 0003 (Physical Control)
[02]: 0000 (Flow Control)
[03]: 1920 (Switch Identifier)
[04]: 007F (Port Control 0)
[05]: 0000 (Port Control 1)
[06]: 07BF (Port Based VLAN Map)
[07]: 0001 (Default VLAN ID & Priority)
[08]: 2080 (Port Control 2)
[09]: 0001 (Egress Rate Control)
[0A]: 8000 (Egress Rate Control 2)
[0B]: 0040 (Port Association Vector)
[0C]: 0000 (Port ATU Control)
[0D]: 0000 (Override)
[0E]: 0000 (Policy & MGMT Control)
[10]: 0000 (Extended Port Control Operation)
[11]: 0000 (Extended Port Control Data)
[16]: 0033 (LED Control)
[17]: 0000 (IP Priority Mapping Table)
[18]: 0000 (IEEE Priority Mapping Table)
[19]: 0000 (Port Control 3)
[1B]: 8000 (Queue Counters)
[1C]: 0000 (Queue Control)
[1D]: 0000 (Queue Control 2)
[1E]: 0000 (Enable & Cut Through)
[1F]: 0058 (Debug Counters)
========================================

Signed-off-by: Potin Lai <potin.lai@quantatw.com>
Change-Id: I3915e0747beeb8f8a3d06d3409ac55ed0cd50b41
diff --git a/meta-facebook/meta-bletchley/recipes-bletchley/plat-tools/bletchley-common-tool_0.1.bb b/meta-facebook/meta-bletchley/recipes-bletchley/plat-tools/bletchley-common-tool_0.1.bb
index 170463f..081d740 100644
--- a/meta-facebook/meta-bletchley/recipes-bletchley/plat-tools/bletchley-common-tool_0.1.bb
+++ b/meta-facebook/meta-bletchley/recipes-bletchley/plat-tools/bletchley-common-tool_0.1.bb
@@ -4,15 +4,18 @@
 inherit obmc-phosphor-systemd
 
 RDEPENDS:${PN} += " bash motor-ctrl"
+RDEPENDS:${PN} += " mdio-tools"
 
 SRC_URI += " \
     file://bletchley-system-state-init \
     file://bletchley-system-state-init@.service \
+    file://bletchley-switch-diag \
     "
 
 do_install() {
     install -d ${D}${libexecdir}
     install -m 0755 ${WORKDIR}/bletchley-system-state-init ${D}${libexecdir}
+    install -m 0755 ${WORKDIR}/bletchley-switch-diag ${D}${libexecdir}
 }