summaryrefslogtreecommitdiffstats
path: root/src/import/chips/p9/procedures/hwp
diff options
context:
space:
mode:
Diffstat (limited to 'src/import/chips/p9/procedures/hwp')
-rw-r--r--src/import/chips/p9/procedures/hwp/cache/p9_l2err_linedelete.C118
-rw-r--r--src/import/chips/p9/procedures/hwp/cache/p9_l2err_linedelete.H4
-rw-r--r--src/import/chips/p9/procedures/hwp/cache/p9_l2err_linedelete.mk3
-rwxr-xr-xsrc/import/chips/p9/procedures/hwp/nest/p9_l2_flush.C227
-rwxr-xr-xsrc/import/chips/p9/procedures/hwp/nest/p9_l2_flush.H49
5 files changed, 173 insertions, 228 deletions
diff --git a/src/import/chips/p9/procedures/hwp/cache/p9_l2err_linedelete.C b/src/import/chips/p9/procedures/hwp/cache/p9_l2err_linedelete.C
index cbed86c4b..8ef374e75 100644
--- a/src/import/chips/p9/procedures/hwp/cache/p9_l2err_linedelete.C
+++ b/src/import/chips/p9/procedures/hwp/cache/p9_l2err_linedelete.C
@@ -42,91 +42,26 @@
// Includes
//------------------------------------------------------------------------------
#include <p9_l2err_linedelete.H>
+#include <p9_l2_flush.H>
#include <p9_quad_scom_addresses.H>
#include <p9_quad_scom_addresses_fld.H>
//------------------------------------------------------------------------------
-// Constant definitions
-//------------------------------------------------------------------------------
-const uint32_t BUSY_POLL_DELAY_IN_NS = 10000000; // 10ms
-const uint32_t BUSY_POLL_DELAY_IN_CYCLES = 20000000; // 10ms, assumming 2GHz
-
-//------------------------------------------------------------------------------
// Function definitions
//------------------------------------------------------------------------------
-///
-/// @brief Utility function to check for a purge operation to be completed.
-/// This function polls the EX_PRD_PURGE_CMD_REG_BUSY bit of
-/// EX_PRD_PURGE_CMD_REG.
-/// - If this bit is clear before the input loop threshold is
-/// reached, it returns FAPi2_RC_SUCCESS.
-/// - Otherwise, it returns an error code.
-///
-/// @param[in] i_target => EX chiplet target
-/// @param[in] i_busyCount => Max busy count waiting for PURGE to complete.
-/// @param[out] o_prdPurgeCmdReg => EX_PRD_PURGE_CMD_REG value.
-///
-fapi2::ReturnCode purgeCompleteCheck(
- const fapi2::Target<fapi2::TARGET_TYPE_EX>& i_target,
- const uint64_t i_busyCount,
- fapi2::buffer<uint64_t>& o_prdPurgeCmdReg)
-{
- FAPI_DBG("Entering purgeCompleteCheck");
-
- // Wait EX_PRD_PURGE_CMD_REG_BUSY bit for a max input counter time
- uint64_t l_loopCount = 0;
-
- do
- {
- FAPI_TRY(fapi2::getScom(i_target, EX_PRD_PURGE_CMD_REG, o_prdPurgeCmdReg),
- "Error from getScom EX_PRD_PURGE_CMD_REG");
-
- // Check the EX_PRD_PURGE_CMD_REG_BUSY bit from scom register
- if ( !o_prdPurgeCmdReg.getBit(EX_PRD_PURGE_CMD_REG_BUSY) )
- {
- // PURGE is done, get out
- break;
- }
- else
- {
- l_loopCount++;
- // Delay for 10ms
- FAPI_TRY(fapi2::delay(BUSY_POLL_DELAY_IN_NS,
- BUSY_POLL_DELAY_IN_CYCLES),
- "Fapi Delay call failed.");
- }
- }
- while (l_loopCount < i_busyCount);
-
- // Error out if still busy
- FAPI_ASSERT(l_loopCount < i_busyCount,
- fapi2::P9_L2ERR_LINE_DELETE_REG_BUSY()
- .set_TARGET(i_target)
- .set_COUNT_THRESHOLD(i_busyCount)
- .set_PRD_PURGE_CMD_REG(o_prdPurgeCmdReg),
- "Error: PRD_PURGE_CMD_REG_BUSY exceeds limit count of %d.",
- i_busyCount);
-
-fapi_try_exit:
- FAPI_DBG("Exiting purgeCompleteCheck - Counter: %d; prdPurgeCmdReg: 0x%.16llX",
- l_loopCount, o_prdPurgeCmdReg);
- return fapi2::current_err;
-}
-
//------------------------------------------------------------------------------
// HWP entry point
//------------------------------------------------------------------------------
// See doxygen in header file
-// TODO: RTC 178071
-// See if with some small refactoring we could just call/share the p9_l2_flush
-// HWP code/errors to implement this routine?
fapi2::ReturnCode p9_l2err_linedelete(
const fapi2::Target<fapi2::TARGET_TYPE_EX>& i_target,
const p9_l2err_extract_err_data& i_err_data,
const uint64_t i_busyCount)
{
- fapi2::buffer<uint64_t> l_l2_l2cerrs_prd_purge_cmd_reg;
+ fapi2::ReturnCode l_rc;
+ fapi2::buffer<uint64_t> l_cmdReg;
+ p9core::purgeData_t l_purgeData;
// mark function entry
FAPI_DBG("Entering p9_l2err_linedelete. BusyCount %d", i_busyCount);
@@ -159,41 +94,22 @@ fapi2::ReturnCode p9_l2err_linedelete(
// bits 20:27 is the cgc address
// bit 28 is the bank
- // Make sure there's no current purge is in progress
- FAPI_TRY(purgeCompleteCheck(i_target, i_busyCount,
- l_l2_l2cerrs_prd_purge_cmd_reg),
- "Error returned from purgeCompleteCheck()");
- FAPI_DBG("l_l2_l2cerrs_prd_purge_cmd_reg_data: 0x%.16llX",
- l_l2_l2cerrs_prd_purge_cmd_reg);
-
- // write trigger, type, cgc address and bank into PRD Purge Engine Command Register
- l_l2_l2cerrs_prd_purge_cmd_reg.insertFromRight
- <EX_PRD_PURGE_CMD_REG_MEM, EX_PRD_PURGE_CMD_REG_MEM_LEN>
- (i_err_data.member);
- l_l2_l2cerrs_prd_purge_cmd_reg.insertFromRight
- <EX_PRD_PURGE_CMD_REG_CGC, EX_PRD_PURGE_CMD_REG_CGC_LEN>
- (i_err_data.address);
- l_l2_l2cerrs_prd_purge_cmd_reg.insertFromRight
- <EX_PRD_PURGE_CMD_REG_BANK, 1>(i_err_data.bank);
-
- l_l2_l2cerrs_prd_purge_cmd_reg.insertFromRight
- <EX_PRD_PURGE_CMD_REG_TRIGGER, 1>(1);
- l_l2_l2cerrs_prd_purge_cmd_reg.insertFromRight
- <EX_PRD_PURGE_CMD_REG_TYPE, EX_PRD_PURGE_CMD_REG_TYPE_LEN>(0x2);
+ // Ensure that purge engine is idle before starting line delete
+ FAPI_TRY(purgeCompleteCheck(i_target, i_busyCount, l_cmdReg),
+ "Error returned from purgeCompleteCheck call");
- FAPI_DBG("l_l2_l2cerrs_prd_purge_cmd_reg_data: %#lx",
- l_l2_l2cerrs_prd_purge_cmd_reg);
- FAPI_TRY(fapi2::putScom(i_target, EX_PRD_PURGE_CMD_REG,
- l_l2_l2cerrs_prd_purge_cmd_reg),
- "Error from putScom EX_PRD_PURGE_CMD_REG");
+ // Set PRD Purge Engine Command register values for line delete
+ l_purgeData.iv_cmdType = 0b0010; // L2 Dir Line_Delete
+ l_purgeData.iv_cmdMem = i_err_data.member;
+ l_purgeData.iv_cmdBank = i_err_data.bank;
+ l_purgeData.iv_cmdCGC = i_err_data.address;
+ FAPI_TRY(setupAndTriggerPrdPurge(i_target, l_purgeData, l_cmdReg),
+ "Error returned from setupAndTriggerPrdPurge");
- // Verify purge operation is complete
- FAPI_TRY(purgeCompleteCheck(i_target, i_busyCount,
- l_l2_l2cerrs_prd_purge_cmd_reg),
- "Error returned from purgeCompleteCheck()");
- FAPI_DBG("l_l2_l2cerrs_prd_purge_cmd_reg_data: 0x%.16llX",
- l_l2_l2cerrs_prd_purge_cmd_reg);
+ // Verify purge/line delete complete
+ FAPI_TRY(purgeCompleteCheck(i_target, i_busyCount, l_cmdReg),
+ "Error returned from purgeCompleteCheck call");
fapi_try_exit:
FAPI_INF("Exiting p9_l2err_linedelete...");
diff --git a/src/import/chips/p9/procedures/hwp/cache/p9_l2err_linedelete.H b/src/import/chips/p9/procedures/hwp/cache/p9_l2err_linedelete.H
index 64550e7c0..274428471 100644
--- a/src/import/chips/p9/procedures/hwp/cache/p9_l2err_linedelete.H
+++ b/src/import/chips/p9/procedures/hwp/cache/p9_l2err_linedelete.H
@@ -56,10 +56,6 @@
#include <fapi2.H>
#include <p9_l2err_extract.H>
-//------------------------------------------------------------------------------
-// Structure definitions
-//------------------------------------------------------------------------------
-
// function pointer typedef definition for HWP call support
typedef fapi2::ReturnCode (*p9_l2err_linedelete_FP_t)
(const fapi2::Target<fapi2::TARGET_TYPE_EX>&,
diff --git a/src/import/chips/p9/procedures/hwp/cache/p9_l2err_linedelete.mk b/src/import/chips/p9/procedures/hwp/cache/p9_l2err_linedelete.mk
index d53c9a751..734beae00 100644
--- a/src/import/chips/p9/procedures/hwp/cache/p9_l2err_linedelete.mk
+++ b/src/import/chips/p9/procedures/hwp/cache/p9_l2err_linedelete.mk
@@ -23,5 +23,6 @@
#
# IBM_PROLOG_END_TAG
PROCEDURE=p9_l2err_linedelete
+$(call ADD_MODULE_INCDIR,$(PROCEDURE),$(ROOTPATH)/chips/p9/procedures/hwp/nest)
+lib$(PROCEDURE)_DEPLIBS+=p9_l2_flush
$(call BUILD_PROCEDURE)
-
diff --git a/src/import/chips/p9/procedures/hwp/nest/p9_l2_flush.C b/src/import/chips/p9/procedures/hwp/nest/p9_l2_flush.C
index 91dd6f625..857e94beb 100755
--- a/src/import/chips/p9/procedures/hwp/nest/p9_l2_flush.C
+++ b/src/import/chips/p9/procedures/hwp/nest/p9_l2_flush.C
@@ -24,7 +24,7 @@
/* IBM_PROLOG_END_TAG */
///
-/// @file p9_l2_flush.H
+/// @file p9_l2_flush.C
/// @brief Flush the P9 L2 cache (FAPI)
///
/// *HWP HWP Owner : Benjamin Gass <bgass@us.ibm.com>
@@ -57,138 +57,133 @@ enum
// Function definitions
//------------------------------------------------------------------------------
-///-----------------------------------------------------------------------------
-/// @brief Utility subroutine to initiate L2 cache flush via purge engine.
-///
-/// @param[in] i_target EX target
-/// @param[in] i_regAddr The scom address to use
-/// @param[in] i_purgeData Structure having values for MEM, CGC, BANK
-/// passed by the user
-///
-/// @return FAPI2_RC_SUCCESS if purge operation was started,
-/// RC_P9_L2_FLUSH_PURGE_REQ_OUTSTANDING if a prior purge
-/// operation has not yet completed
-/// else FAPI getscom/putscom return code for failing operation
-///-----------------------------------------------------------------------------
-fapi2::ReturnCode l2_flush_start(
+/// See doxygen in header file
+fapi2::ReturnCode purgeCompleteCheck(
const fapi2::Target<fapi2::TARGET_TYPE_EX>& i_target,
- const uint32_t i_regAddr,
- const p9core::purgeData_t& i_purgeData)
+ const uint64_t i_busyCount,
+ fapi2::buffer<uint64_t>& o_prdPurgeCmdReg)
{
- fapi2::buffer<uint64_t> l_cmdReg;
- fapi2::buffer<uint64_t> l_purgeCmd;
+ FAPI_DBG("Entering purgeCompleteCheck");
+ uint64_t l_loopCount = 0;
- FAPI_DBG("l2_flush_start: Enter");
+ do
+ {
+ FAPI_TRY(fapi2::getScom(i_target, EX_PRD_PURGE_CMD_REG, o_prdPurgeCmdReg),
+ "Error from getScom EX_PRD_PURGE_CMD_REG");
- // ensure that purge engine is idle before starting flush
- // poll Purge Engine status
- FAPI_DBG("Reading L2 Purge Engine Command Register to check status");
- FAPI_TRY(fapi2::getScom(i_target, i_regAddr, l_cmdReg));
-
- // check to see if this reg is idle and ready to accept a new command
- FAPI_ASSERT(!l_cmdReg.getBit<EX_PRD_PURGE_CMD_REG_BUSY>(),
- fapi2::P9_L2_FLUSH_PURGE_REQ_OUTSTANDING()
- .set_TARGET(i_target)
- .set_CMD_REG(l_cmdReg)
- .set_CMD_REG_ADDR(i_regAddr),
- "Previous purge request has not completed for target");
-
- // write PURGE_CMD_TRIGGER bit in Purge Engine Command Register
- // ensure PURGE_CMD_TYPE/MEM/CGC/BANK are clear to specify flush
- // of entire cache
- FAPI_DBG("Write L2 Purge Engine Command Register to initiate cache flush");
- l_purgeCmd.insert<EX_PRD_PURGE_CMD_REG_TYPE,
- EX_PRD_PURGE_CMD_REG_TYPE_LEN>(i_purgeData.iv_cmdType);
+ // Check state of PURGE_CMD_ERR
+ FAPI_ASSERT(!o_prdPurgeCmdReg.getBit<EX_PRD_PURGE_CMD_REG_ERR>(),
+ fapi2::P9_PURGE_CMD_REG_ERR()
+ .set_TARGET(i_target)
+ .set_CMD_REG(o_prdPurgeCmdReg),
+ "Purge failed. EX_PRD_PURGE_CMD_REG_ERR set");
- l_purgeCmd.insert<EX_PRD_PURGE_CMD_REG_MEM,
- EX_PRD_PURGE_CMD_REG_MEM_LEN>(i_purgeData.iv_cmdMem);
+ // Check the EX_PRD_PURGE_CMD_REG_BUSY bit from scom register
+ if ( !o_prdPurgeCmdReg.getBit(EX_PRD_PURGE_CMD_REG_BUSY) )
+ {
+ // PURGE is done, get out
+ break;
+ }
+ else
+ {
+ l_loopCount++;
+
+ if (l_loopCount > i_busyCount)
+ {
+ // Time out, exit loop
+ break;
+ }
+
+ // Delay 10ns for each loop
+ FAPI_TRY(fapi2::delay(P9_L2_FLUSH_HW_NS_DELAY,
+ P9_L2_FLUSH_SIM_CYCLE_DELAY),
+ "Fapi Delay call failed.");
+ }
+ }
+ while (1);
- l_purgeCmd.insert<EX_PRD_PURGE_CMD_REG_BANK, 1>(i_purgeData.iv_cmdBank);
+ // Error out if still busy
+ if (l_loopCount > i_busyCount)
+ {
+ // engine busy, dump status
+ FAPI_DBG("Purge engine busy (reg_busy = %d, busy_on_this = %d,"
+ " sm_busy = %d)",
+ o_prdPurgeCmdReg.getBit<EX_PRD_PURGE_CMD_REG_BUSY>(),
+ o_prdPurgeCmdReg.getBit<EX_PRD_PURGE_CMD_REG_PRGSM_BUSY_ON_THIS>(),
+ o_prdPurgeCmdReg.getBit<EX_PRD_PURGE_CMD_REG_PRGSM_BUSY>());
- l_purgeCmd.insert<EX_PRD_PURGE_CMD_REG_CGC,
- EQ_PRD_PURGE_CMD_REG_CGC_LEN>(i_purgeData.iv_cmdCGC);
+ FAPI_ASSERT(false, fapi2::P9_PURGE_COMPLETE_TIMEOUT()
+ .set_TARGET(i_target)
+ .set_COUNT_THRESHOLD(i_busyCount)
+ .set_CMD_REG(o_prdPurgeCmdReg),
+ "Previous purge request has not completed for target");
+ }
- l_purgeCmd.setBit<EX_PRD_PURGE_CMD_REG_TRIGGER>();
+fapi_try_exit:
+ FAPI_DBG("Exiting purgeCompleteCheck - Counter: %d; prdPurgeCmdReg: 0x%.16llX",
+ l_loopCount, o_prdPurgeCmdReg);
+ return fapi2::current_err;
+}
+
+/// See doxygen in header file
+fapi2::ReturnCode setupAndTriggerPrdPurge(
+ const fapi2::Target<fapi2::TARGET_TYPE_EX>& i_target,
+ const p9core::purgeData_t& i_purgeData,
+ fapi2::buffer<uint64_t>& i_prdPurgeCmdReg)
+{
+ FAPI_DBG("setupAndTriggerPrdPurge: Enter");
- FAPI_TRY(fapi2::putScom(i_target, i_regAddr, l_purgeCmd));
+ // Start with current CMD reg value
+ fapi2::buffer<uint64_t> l_cmdReg = i_prdPurgeCmdReg;
+
+ // Write PURGE_CMD_TRIGGER bit in Purge Engine Command Register
+ // ensure PURGE_CMD_TYPE/MEM/CGC/BANK are clear to specify flush
+ // of entire cache
+ FAPI_DBG("Write L2 Purge Engine Command Register to initiate cache flush");
+ l_cmdReg.insert<EX_PRD_PURGE_CMD_REG_TYPE,
+ EX_PRD_PURGE_CMD_REG_TYPE_LEN>(i_purgeData.iv_cmdType);
+ l_cmdReg.insert<EX_PRD_PURGE_CMD_REG_MEM,
+ EX_PRD_PURGE_CMD_REG_MEM_LEN>(i_purgeData.iv_cmdMem);
+ l_cmdReg.insert<EX_PRD_PURGE_CMD_REG_BANK, 1>(i_purgeData.iv_cmdBank);
+ l_cmdReg.insert<EX_PRD_PURGE_CMD_REG_CGC,
+ EQ_PRD_PURGE_CMD_REG_CGC_LEN>(i_purgeData.iv_cmdCGC);
+ l_cmdReg.setBit<EX_PRD_PURGE_CMD_REG_TRIGGER>();
+
+ FAPI_TRY(fapi2::putScom(i_target, EX_PRD_PURGE_CMD_REG, l_cmdReg),
+ "Error from putScom EX_PRD_PURGE_CMD_REG");
fapi_try_exit:
- FAPI_DBG("l2_flush_start: Exit");
+ FAPI_DBG("setupAndTriggerPrdPurge: Exit");
return fapi2::current_err;
}
///-----------------------------------------------------------------------------
-/// @brief Utility subroutine to poll L2 purge engine status, looking for
-/// clean idle state.
+/// @brief Utility subroutine to initiate L2 cache flush via purge engine.
///
-/// @param[in] i_target EX chiplet target
-/// @param[in] i_regAddr Purge engine register SCOM address
+/// @param[in] i_target EX target
+/// @param[in] i_purgeData Structure having values for MEM, CGC, BANK
+/// passed by the user
///
-/// @return FAPI2_RC_SUCCESS if engine status returns as idle (with no errors)
-/// before maximum number of polls has been reached
-/// RC_P9_L2_FLUSH_CMD_ERROR
-/// if purge command error reported,
-/// RC_P9_L2_FLUSH_CMD_TIMEOUT
-/// if purge operation did not complete prior to polling limit,
-/// else FAPI getscom/putscom return code for failing operation
+/// @return FAPI2_RC_SUCCESS if purge operation was started,
+/// else error code.
///-----------------------------------------------------------------------------
-fapi2::ReturnCode l2_flush_check_status(
+fapi2::ReturnCode l2_flush_start(
const fapi2::Target<fapi2::TARGET_TYPE_EX>& i_target,
- const uint32_t i_regAddr)
+ const p9core::purgeData_t& i_purgeData)
{
+ FAPI_DBG("l2_flush_start: Enter");
fapi2::buffer<uint64_t> l_cmdReg;
- uint32_t l_polls = 1;
-
- FAPI_DBG("l2_flush_check_status: Enter");
-
- while(1)
- {
- // poll Purge Engine status
- FAPI_DBG("Reading L2 Purge Engine Command Register to check status");
- FAPI_TRY(fapi2::getScom(i_target, i_regAddr, l_cmdReg));
-
- // check state of PURGE_CMD_ERR
- FAPI_ASSERT(!l_cmdReg.getBit<EX_PRD_PURGE_CMD_REG_ERR>(),
- fapi2::P9_L2_FLUSH_CMD_ERROR()
- .set_TARGET(i_target)
- .set_CMD_REG(l_cmdReg)
- .set_CMD_REG_ADDR(i_regAddr),
- "Purge failed. EX_PRD_PURGE_CMD_REG_ERR set");
- // check to see if this reg is idle and ready to accept a new command
- if (!l_cmdReg.getBit<EX_PRD_PURGE_CMD_REG_BUSY>())
- {
- FAPI_DBG("Purge engine idle");
- break;
- }
-
- // engine busy, dump status
- FAPI_DBG("Purge engine busy (reg_busy = %d, busy_on_this = %d,"
- " sm_busy = %d)",
- l_cmdReg.getBit<EX_PRD_PURGE_CMD_REG_BUSY>(),
- l_cmdReg.getBit<EX_PRD_PURGE_CMD_REG_PRGSM_BUSY_ON_THIS>(),
- l_cmdReg.getBit<EX_PRD_PURGE_CMD_REG_PRGSM_BUSY>());
-
- // check if loop count has expired
- FAPI_ASSERT((l_polls < P9_L2_FLUSH_MAX_POLLS),
- fapi2::P9_L2_FLUSH_CMD_TIMEOUT()
- .set_TARGET(i_target)
- .set_CMD_REG(l_cmdReg)
- .set_CMD_REG_ADDR(i_regAddr)
- .set_NUMBER_OF_ATTEMPTS(l_polls),
- "Purge engine still busy after %d loops", l_polls);
-
- // l_polls left, delay prior to next poll
- FAPI_DBG("%d loops done, delaying before next poll", l_polls);
+ // Ensure that purge engine is idle before starting flush
+ // poll Purge Engine status
+ FAPI_TRY(purgeCompleteCheck(i_target, 0, l_cmdReg), // 0 = no wait
+ "Error returned from purgeCompleteCheck call");
- FAPI_TRY(fapi2::delay(P9_L2_FLUSH_HW_NS_DELAY,
- P9_L2_FLUSH_SIM_CYCLE_DELAY));
-
- l_polls++;
- }
+ FAPI_TRY(setupAndTriggerPrdPurge(i_target, i_purgeData, l_cmdReg),
+ "Error returned from setupAndTriggerPrdPurge");
fapi_try_exit:
- FAPI_DBG("l2_flush_check_status: Exit");
+ FAPI_DBG("l2_flush_start: Exit");
return fapi2::current_err;
}
@@ -200,22 +195,22 @@ fapi2::ReturnCode p9_l2_flush(
const fapi2::Target <fapi2::TARGET_TYPE_EX>& i_target,
const p9core::purgeData_t& i_purgeData)
{
+ fapi2::buffer<uint64_t> l_cmdReg;
+
FAPI_DBG("Entering p9_l2_flush: i_purgeData [iv_cmdType: 0x%x] "
"[iv_cmdMem : 0x%x] [iv_cmdBank: 0x%x] [iv_cmdCGC : 0x%x]",
i_purgeData.iv_cmdType, i_purgeData.iv_cmdMem,
i_purgeData.iv_cmdBank, i_purgeData.iv_cmdCGC);
- uint32_t l_regAddr = EX_PRD_PURGE_CMD_REG;
+ // Initiate flush
+ FAPI_TRY(l2_flush_start(i_target, i_purgeData),
+ "Error returned from l2_flush_start()");
- // initiate flush
- FAPI_TRY(l2_flush_start(i_target, l_regAddr, i_purgeData));
-
- // check that flush completes and the purge engine is idle
- // before exiting
- FAPI_TRY(l2_flush_check_status(i_target, l_regAddr));
+ // Check for purge complete
+ FAPI_TRY(purgeCompleteCheck(i_target, P9_L2_FLUSH_MAX_POLLS, l_cmdReg),
+ "Error returned from purgeCompleteCheck call");
fapi_try_exit:
FAPI_DBG("p9_l2_flush: Exit");
return fapi2::current_err;
}
-
diff --git a/src/import/chips/p9/procedures/hwp/nest/p9_l2_flush.H b/src/import/chips/p9/procedures/hwp/nest/p9_l2_flush.H
index 7aee84039..be964a445 100755
--- a/src/import/chips/p9/procedures/hwp/nest/p9_l2_flush.H
+++ b/src/import/chips/p9/procedures/hwp/nest/p9_l2_flush.H
@@ -94,21 +94,58 @@ extern "C"
{
///
+/// @brief Utility function to check for a purge operation to be completed.
+/// This function polls the EX_PRD_PURGE_CMD_REG_BUSY bit of
+/// EX_PRD_PURGE_CMD_REG.
+/// - If this bit is clear before the input loop threshold is
+/// reached, it returns FAPi2_RC_SUCCESS.
+/// - Otherwise, it returns an error code.
+///
+/// @param[in] i_target => EX chiplet target
+/// @param[in] i_busyCount => Max busy count waiting for PURGE to complete.
+/// @param[out] o_prdPurgeCmdReg => EX_PRD_PURGE_CMD_REG value.
+///
+/// @return FAPI2_RC_SUCCESS if engine status returns as idle (with no errors)
+/// before maximum number of polls has been reached
+/// else, return error.
+ fapi2::ReturnCode purgeCompleteCheck(
+ const fapi2::Target<fapi2::TARGET_TYPE_EX>& i_target,
+ const uint64_t i_busyCount,
+ fapi2::buffer<uint64_t>& o_prdPurgeCmdReg);
+
+///-----------------------------------------------------------------------------
+/// @brief Utility subroutine to setup and trigger a PRD PURGE based
+/// on input purge data specification.
+///
+/// @param[in] i_target EX target
+/// @param[in] i_purgeData Structure having values for MEM, CGC, BANK
+/// passed by the user
+/// @param[in] i_prdPurgeCmdReg EX_PRD_PURGE_CMD_REG value.
+///
+/// @return FAPI2_RC_SUCCESS if purge operation was started,
+/// else error code.
+///-----------------------------------------------------------------------------
+ fapi2::ReturnCode setupAndTriggerPrdPurge(
+ const fapi2::Target<fapi2::TARGET_TYPE_EX>& i_target,
+ const p9core::purgeData_t& i_purgeData,
+ fapi2::buffer<uint64_t>& i_prdPurgeCmdReg);
+
+///
/// @brief Flush entire content of L2 cache via purge engine
/// @param[in] i_target EX target
/// @param[in] i_purgeData Specifies a particular purge type
/// @return: FAPI2_RC_SUCCESS if purge operation completes successfully,
-/// RC_P9_L2_FLUSH_PURGE_REQ_OUTSTANDING
+/// P9_L2_FLUSH_PURGE_REQ_OUTSTANDING
/// if called when existing L2 purge is in progress,
-/// RC_P9_L2_FLUSH_CMD_TIMEOUT
+/// RC_P9_PURGE_COMPLETE_TIMEOUT
/// if purge operation does not complete in expected time,
-/// RC_P9_L2_FLUSH_CMD_ERROR
+/// RC_P9_PURGE_CMD_REG_ERR
/// if purge operation reports error,
/// else FAPI getscom/putscom return code for failing operation
///
- fapi2::ReturnCode p9_l2_flush(const fapi2::Target < fapi2::TARGET_TYPE_EX >
- & i_target,
- const p9core::purgeData_t& i_purgeData);
+ fapi2::ReturnCode p9_l2_flush(
+ const fapi2::Target < fapi2::TARGET_TYPE_EX >& i_target,
+ const p9core::purgeData_t& i_purgeData);
} // end of extern C
OpenPOWER on IntegriCloud