summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSachin Gupta <sgupta2m@in.ibm.com>2016-03-01 08:00:45 -0600
committerAMIT J. TENDOLKAR <amit.tendolkar@in.ibm.com>2016-03-11 00:46:59 -0500
commit989f43bd6cbf72f33a34c92ece051f32e8f4f05f (patch)
tree50bd481a3961a029a635a59fb00a7d871566d54e
parent8c2dd959c882662c96ca681872a1bc9a6c8f0e24 (diff)
downloadtalos-sbe-989f43bd6cbf72f33a34c92ece051f32e8f4f05f.tar.gz
talos-sbe-989f43bd6cbf72f33a34c92ece051f32e8f4f05f.zip
Do not send EOT when downstream queue is full
SBE code will wait for space in downstream queue before sending EOT. Change-Id: I2332b212829d09bfb7a25d7b07cbee079fe946a8 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/21517 Tested-by: Jenkins Server Reviewed-by: Santosh S. Puranik <santosh.puranik@in.ibm.com> Reviewed-by: AMIT J. TENDOLKAR <amit.tendolkar@in.ibm.com>
-rw-r--r--sbe/sbefw/sbeFifoMsgUtils.C51
-rw-r--r--sbe/sbefw/sbeFifoMsgUtils.H10
-rw-r--r--sbe/sbefw/sbefifo.H13
3 files changed, 59 insertions, 15 deletions
diff --git a/sbe/sbefw/sbeFifoMsgUtils.C b/sbe/sbefw/sbeFifoMsgUtils.C
index 9771a420..f926bfdd 100644
--- a/sbe/sbefw/sbeFifoMsgUtils.C
+++ b/sbe/sbefw/sbeFifoMsgUtils.C
@@ -12,6 +12,15 @@
#include "sbeerrorcodes.H"
#include "assert.h"
+// If we can not perform FIFO operation ( FIFO FULL while writing
+// or EMPTY while reading ) we will sleep for FIFO_WAIT_SLEEP_TIME
+// ms so that FIFO can be ready.
+static const uint32_t FIFO_WAIT_SLEEP_TIME = 1;
+// Write this data to send EOT to DS FIFO. The register to send EOT
+// is 32 bit only. But our scom operations are 64 bit. So set a bit
+// in higher word to trigger EOT.
+static const uint64_t DOWNSTREAM_EOT_DATA = 0x100000000ull;
+
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
uint32_t sbeUpFifoDeq_mult (uint32_t &io_len,
@@ -114,7 +123,7 @@ uint32_t sbeUpFifoDeq_mult (uint32_t &io_len,
if (l_data.statusOrReserved.fifo_empty)
{
//SBE_DEBUG(SBE_FUNC"Downstream FIFO is empty. Sleeping for 1 ms");
- pk_sleep(PK_MILLISECONDS(1));
+ pk_sleep(PK_MILLISECONDS(FIFO_WAIT_SLEEP_TIME));
continue;
}
@@ -174,7 +183,7 @@ uint32_t sbeDownFifoEnq_mult (uint32_t &io_len,
{
// Downstream FIFO is full
//SBE_DEBUG(SBE_FUNC"Downstream FIFO is full. Sleeping for 1 ms");
- pk_sleep(PK_MILLISECONDS(1));
+ pk_sleep(PK_MILLISECONDS(FIFO_WAIT_SLEEP_TIME));
continue;
}
@@ -247,3 +256,41 @@ void sbeBuildMinRespHdr ( uint32_t *io_pBuf,
} while(false);
}
+
+////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////
+uint32_t sbeDownFifoSignalEot (void)
+{
+ uint32_t l_rc = 0;
+ #define SBE_FUNC "sbeDownFifoSignalEot "
+ SBE_ENTER(SBE_FUNC);
+ sbeDownFifoStatusReg_t l_status = {0};
+ do
+ {
+ // Read the down stream FIFO status
+ l_rc = sbeDownFifoGetStatus (reinterpret_cast<uint64_t *>(&l_status));
+ if (l_rc)
+ {
+ // Error while reading downstream FIFO status
+ SBE_ERROR(SBE_FUNC"sbeDownFifoGetStatus failed, "
+ "l_rc=[0x%08X]", l_rc);
+ l_rc = SBE_SEC_FIFO_ACCESS_FAILURE;
+ break;
+ }
+
+ // Check if downstream FIFO is full
+ if (l_status.downfifo_status.fifo_full)
+ {
+ pk_sleep(PK_MILLISECONDS(FIFO_WAIT_SLEEP_TIME));
+ continue;
+ }
+ l_rc = putscom_abs(SBE_DOWNSTREAM_FIFO_SIGNAL_EOT, DOWNSTREAM_EOT_DATA);
+ break;
+ } while(1);
+
+
+ SBE_EXIT(SBE_FUNC);
+ return l_rc;
+ #undef SBE_FUNC
+}
+
diff --git a/sbe/sbefw/sbeFifoMsgUtils.H b/sbe/sbefw/sbeFifoMsgUtils.H
index 472e9cd1..83d033c4 100644
--- a/sbe/sbefw/sbeFifoMsgUtils.H
+++ b/sbe/sbefw/sbeFifoMsgUtils.H
@@ -144,5 +144,15 @@ void sbeBuildMinRespHdr ( uint32_t *io_pBuf,
const uint32_t i_pcbpibStatus,
const uint32_t i_startIndex = 0 );
+/**
+ * @brief sbeDownFifoSignalEot : Signal EOT in Downstream FIFO
+ *
+ * @return Rc from the underlying scom utility
+ *
+ * @note This is a blocking call. If FIFO is full, it will wait
+ * in loop ( sleep ) till the time there is some space in
+ * FIFO.
+ */
+uint32_t sbeDownFifoSignalEot (void);
#endif // __SBEFW_SBEFIFOMSGUTILS_H
diff --git a/sbe/sbefw/sbefifo.H b/sbe/sbefw/sbefifo.H
index 9991f57e..702ded36 100644
--- a/sbe/sbefw/sbefifo.H
+++ b/sbe/sbefw/sbefifo.H
@@ -212,17 +212,4 @@ extern inline uint32_t sbeDownFifoGetStatus (uint64_t *o_data)
return getscom_abs(SBE_DOWNSTREAM_FIFO_STATUS, o_data);
}
-/**
- * @brief sbeDownFifoSignalEot : Signal EOT in Downstream FIFO
- *
- * @return Rc from the underlying scom utility
- *
- */
-extern inline uint32_t sbeDownFifoSignalEot (void)
-{
- SBE_DEBUG(">sbeDownFifoSignalEot");
- return putscom_abs(SBE_DOWNSTREAM_FIFO_SIGNAL_EOT, ((uint64_t)0x1)<<32);
-}
-
-
#endif // __SBEFW_SBEFIFO_H
OpenPOWER on IntegriCloud