Added parsing PLOAM msg and generating sysfs:gpon/misc/laserChannel

Change-Id: Ie5a70fe7034be45cd398ce448790f64d03b76ec4
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/Makefile b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/Makefile
index 78c0d54..4cd22c4 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/Makefile
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/Makefile
@@ -28,6 +28,7 @@
 	core/gpon/gponOnuMngrStateMachine.o \
         core/gpon/gponOnuPm.o \
 	core/gpon/gponOnuSrvc.o \
+	core/gpon/gponOnuGoogle.o \
 	perf/gpon/gponOnuLnxKsUI.o \
 	perf/gpon/gponOnuLnxKsMI.o \
 	plat/gpon/gponOnuBoard.o \
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuDb.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuDb.c
index 0ac16db..ac63e63 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuDb.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuDb.c
@@ -3405,6 +3405,44 @@
 
 /*******************************************************************************
 **
+**  onuGponDbPONIdCountInc
+**  ____________________________________________________________________________
+**
+**  DESCRIPTION: The function increments a PLOAM pon ID msg counter
+**
+**  PARAMETERS:  None
+**
+**  OUTPUTS:     None
+**
+**  RETURNS:     None
+**
+*******************************************************************************/
+void onuGponDbPONIdCountInc(void)
+{
+  onuGponDb_s.onuGponOperParamsTbl_s.onuGponPonIdCount += 1;
+}
+
+/*******************************************************************************
+**
+**  onuGponDbPONIdGetCount
+**  ____________________________________________________________________________
+**
+**  DESCRIPTION: The function returns PLOAM pon ID msg counter
+**
+**  PARAMETERS:  None
+**
+**  OUTPUTS:     None
+**
+**  RETURNS:     None
+**
+*******************************************************************************/
+MV_U32 onuGponDbPONIdGetCount(void)
+{
+  return onuGponDb_s.onuGponOperParamsTbl_s.onuGponPonIdCount;
+}
+
+/*******************************************************************************
+**
 **  onuGponDbPONIdTypeABitGet
 **  ____________________________________________________________________________
 **
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuDb.h b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuDb.h
index 5c9ae9f..9144514 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuDb.h
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuDb.h
@@ -203,6 +203,7 @@
   MV_BOOL onuGponGemPortSave[GPON_ONU_MAX_GEM_PORTS];

   MV_U8   onuGponPassword[ONU_GPON_PASS_LEN];       /* ONU password */
   MV_U16  onuGponReiSeqNum;                         /* ONU REI sequence number */
+  MV_U32  onuGponPonIdCount;                        /* PON-ID msg count */
   MV_U8   onuGponPONIdTypeABit;                     /* PON-ID Type A-bit */
   MV_U8   onuGponPONIdClassType;                    /* PON-ID Class type */
   MV_U8   onuGponPONIdBytesInfo[ONU_GPON_PON_ID_BYTES_LEN];               /* PON-ID Bytes info*/
@@ -379,6 +380,8 @@
 MV_U32    onuGponDbTcontResetGet(void);
 MV_VOID   onuGponDbGemRestoreSet(MV_BOOL gem_restore);

 MV_BOOL   onuGponDbGemRestoreGet(MV_VOID);

+void      onuGponDbPONIdCountInc(void);
+MV_U32    onuGponDbPONIdGetCount(void);
 MV_U8     onuGponDbPONIdTypeABitGet(void);
 MV_STATUS onuGponDbPONIdTypeABitSet(MV_U8 ponIdTypeABit);
 MV_U8     onuGponDbPONIdClassTypeGet(void);
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuGoogle.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuGoogle.c
new file mode 100644
index 0000000..ed876cd
--- /dev/null
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuGoogle.c
@@ -0,0 +1,27 @@
+/*

+ * arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuGoogle.c

+ *

+ * This file is licensed under the terms of the GNU General Public

+ * License version 2. This program is licensed "as is" without any

+ * warranty of any kind, whether express or implied.

+ */

+#include "gponOnuHeader.h"

+

+

+int onuGponLaserChannelPrint(char* buf)

+{

+  int off, rc;

+  MV_32 msgCount;

+  MV_U8 ponIdBytes[ONU_GPON_PON_ID_BYTES_LEN];

+

+  msgCount = onuGponDbPONIdGetCount();

+  rc = -1;

+  if (msgCount > 0) {

+    onuGponDbPONIdBytesInfoGet(ponIdBytes);

+    rc = ponIdBytes[0] & 0x3f;

+  }

+

+  off = mvOsSPrintf(buf, "%d\n", rc);

+  return off;

+}

+

diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuGoogle.h b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuGoogle.h
new file mode 100644
index 0000000..e191c2f
--- /dev/null
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuGoogle.h
@@ -0,0 +1,11 @@
+/*

+ * arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuGoogle.h

+ *

+ * This file is licensed under the terms of the GNU General Public

+ * License version 2. This program is licensed "as is" without any

+ * warranty of any kind, whether express or implied.

+ */

+#ifndef CONFIG_GPON_GOOGLE

+#define CONFIG_GPON_GOOGLE

+int onuGponLaserChannelPrint(char* buf);

+#endif

diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuMngrStateMachine.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuMngrStateMachine.c
index fece1ec..97e8745 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuMngrStateMachine.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/core/gpon/gponOnuMngrStateMachine.c
@@ -2619,6 +2619,7 @@
   MV_U8		 ponIdClassType;
   MV_U8		 ponIdBytes[ONU_GPON_PON_ID_BYTES_LEN];
 
+  onuGponDbPONIdCountInc();
   ponIdTypeAbit = (msgData[0] & 0x80)  >> 7;
   onuGponDbPONIdTypeABitSet(ponIdTypeAbit);
 
@@ -2634,11 +2635,11 @@
 #ifdef MV_GPON_DEBUG_PRINT
   mvPonPrint(PON_PRINT_DEBUG, PON_SM_MODULE,
              "DEBUG: (%s:%d) PON-ID message rcv with ponIdTypeAbit: %d ponIdClassType: 0x%02x ponIdTxOpticalLevel: 0x%04x ponIdBytes[0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x]\n",
-			 __FILE_DESC__, __LINE__,
-			 ponIdTypeAbit, ponIdClassType, ponIdTxOpticalLevel,
-			 ponIdBytes[0], ponIdBytes[1], ponIdBytes[2], ponIdBytes[3],
-			 ponIdBytes[4], ponIdBytes[5], ponIdBytes[6]
-			 );
+             __FILE_DESC__, __LINE__,
+             ponIdTypeAbit, ponIdClassType, ponIdTxOpticalLevel,
+             ponIdBytes[0], ponIdBytes[1], ponIdBytes[2], ponIdBytes[3],
+             ponIdBytes[4], ponIdBytes[5], ponIdBytes[6]
+             );
 #endif /* MV_GPON_DEBUG_PRINT */
 }
 
diff --git a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/perf/gpon/gponOnuLnxKsUI.c b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/perf/gpon/gponOnuLnxKsUI.c
index 0587885..96bbfc1 100755
--- a/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/perf/gpon/gponOnuLnxKsUI.c
+++ b/arch/arm/plat-feroceon/mv_drivers_lsp/mv_pon/perf/gpon/gponOnuLnxKsUI.c
@@ -77,7 +77,7 @@
 /* Include Files
 ------------------------------------------------------------------------------*/
 #include "gponOnuHeader.h"
-
+#include "gponOnuGoogle.h"
 #ifndef PON_FPGA
 #include "mvSysPonConfig.h"
 #endif /* PON_FPGA */
@@ -3297,6 +3297,25 @@
 
 /*******************************************************************************
 **
+**  onuGponLaserChannelShow
+**  ____________________________________________________________________________
+**
+**  DESCRIPTION: The function shows the laser channel from the PON ID message
+**
+**  PARAMETERS:  char* buf
+**
+**  OUTPUTS:     char* buf
+**
+**  RETURNS:     message length
+**
+*******************************************************************************/
+int onuGponLaserChannelShow(char *buf)
+{
+	return onuGponLaserChannelPrint(buf);
+}
+
+/*******************************************************************************
+**
 **  onuGponUiMiscHelpShow
 **  ____________________________________________________________________________
 **
@@ -3409,15 +3428,16 @@
 
 	if (!strcmp(name, "printMask"))
 		return ponOnuPrintStatus(buf);
-  else if (!strcmp(name, "prbsUserPattern"))
-  	return onuGponUiCfgPrbsUserPattern(buf);
+	else if (!strcmp(name, "prbsUserPattern"))
+		return onuGponUiCfgPrbsUserPattern(buf);
 	else if (!strcmp(name, "helpMisc"))
 		return onuGponUiMiscHelpShow(buf);
 	else if (!strcmp(name, "syncLogEnable"))	/* sync log enable or disable */
 		onuGponUiSyncLogEnableShow();
-    else if (!strcmp(name, "syncLog"))	/* sync log stop */
+	else if (!strcmp(name, "syncLog"))	/* sync log stop */
 		onuGponUiSyncLogPrint();
-
+	else if (!strcmp(name, "laserChannel"))
+		return onuGponLaserChannelShow(buf);
 	return 0;
 }
 
@@ -3515,6 +3535,7 @@
 static DEVICE_ATTR(t02IntervalCfg,        S_IWUSR, misc_show, misc_store);
 static DEVICE_ATTR(syncLogEnable,         S_IRUSR | S_IWUSR, misc_show, misc_store);
 static DEVICE_ATTR(syncLog,               S_IRUSR, misc_show, misc_store);
+static DEVICE_ATTR(laserChannel,          S_IRUSR, misc_show, misc_store);
 
 static struct attribute *misc_attrs[] = {
 	&dev_attr_serialNumCfg.attr,
@@ -3541,6 +3562,7 @@
 	&dev_attr_t02IntervalCfg.attr,
 	&dev_attr_syncLogEnable.attr,
 	&dev_attr_syncLog.attr,
+	&dev_attr_laserChannel.attr,
 	NULL
 };