From 64cbaffb38a087fb92ce093d1127e5269e7faae0 Mon Sep 17 00:00:00 2001 From: Sunil Kumar Date: Thu, 3 Jan 2019 05:23:44 -0600 Subject: Flush NVDIMM Chipop Change-Id: Ibf249b59fd20f883a8b01e640f3e9be5f4a68500 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/70070 Tested-by: Jenkins Server Tested-by: FSP CI Jenkins Reviewed-by: RAJA DAS --- src/sbefw/app/power/chipop_table.C | 6 +++- src/sbefw/app/power/sbecmdgeneric.C | 5 +-- src/sbefw/app/power/sbecmdiplcontrol.C | 56 +++++++++++++++++++++++++++++++- src/sbefw/app/power/sbecmdiplcontrol.H | 12 ++++++- src/sbefw/core/sbe_sp_intf.H | 5 ++- src/test/testcases/test.xml | 3 +- src/test/testcases/testFlushNVDIMM.py | 58 ++++++++++++++++++++++++++++++++++ src/test/testcases/testFlushNVDIMM.xml | 30 ++++++++++++++++++ 8 files changed, 168 insertions(+), 7 deletions(-) create mode 100755 src/test/testcases/testFlushNVDIMM.py create mode 100755 src/test/testcases/testFlushNVDIMM.xml (limited to 'src') diff --git a/src/sbefw/app/power/chipop_table.C b/src/sbefw/app/power/chipop_table.C index fb0f6ea1..1431b343 100644 --- a/src/sbefw/app/power/chipop_table.C +++ b/src/sbefw/app/power/chipop_table.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER sbe Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2017,2018 */ +/* Contributors Listed Below - COPYRIGHT 2017,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -93,6 +93,10 @@ CMD_ARR( {sbeHandleSuspendIO, SBE_CMD_SUSPEND_IO, SBE_FENCE_AT_DUMPING, + }, + {sbeHandleFlushNVDIMM, + SBE_CMD_FLUSH_NVDIMM, + HARDWARE_FENCED_STATE|SBE_FENCE_AT_DUMPING, } ) diff --git a/src/sbefw/app/power/sbecmdgeneric.C b/src/sbefw/app/power/sbecmdgeneric.C index 4064da29..0879ba29 100644 --- a/src/sbefw/app/power/sbecmdgeneric.C +++ b/src/sbefw/app/power/sbecmdgeneric.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER sbe Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2018 */ +/* Contributors Listed Below - COPYRIGHT 2015,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -99,7 +99,8 @@ void updateFifoCapabilities(uint32_t * capability) // Update Capability flags based on lastes spec. capability[IPL_CAPABILITY_START_IDX] = EXECUTE_ISTEP_SUPPPORTED | - SUSPEND_IO_SUPPPORTED; + SUSPEND_IO_SUPPPORTED | + FLUSH_NVDIMM_SUPPPORTED; capability[IPL_CAPABILITY_START_IDX+1] = RESERVED_A1_CAPABILITIES; diff --git a/src/sbefw/app/power/sbecmdiplcontrol.C b/src/sbefw/app/power/sbecmdiplcontrol.C index f18d41be..88eb9b8d 100644 --- a/src/sbefw/app/power/sbecmdiplcontrol.C +++ b/src/sbefw/app/power/sbecmdiplcontrol.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER sbe Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2018 */ +/* Contributors Listed Below - COPYRIGHT 2015,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -47,6 +47,7 @@ #include "p9n2_quad_scom_addresses.H" #include "p9_suspend_io.H" +//#include "nvdimm_workarounds.H" #include @@ -305,6 +306,59 @@ uint32_t sbeHandleSuspendIO(uint8_t *i_pArg) } //---------------------------------------------------------------------------- +/////////////////////////////////////////////////////////////////////// +// @brief sbeHandleFlushNVDIMM Sbe flush NVDIMM function +// +// @return RC from the underlying FIFO utility +/////////////////////////////////////////////////////////////////////// + +//mss::workarounds::nvdimm::p9_flush_nvdimm_FP_t p9_flush_nvdimm_hwp = &mss::workarounds::nvdimm::trigger_csave; + +uint32_t sbeHandleFlushNVDIMM(uint8_t *i_pArg) +{ + + #define SBE_FUNC " sbeHandleFlushNVDIMM " + SBE_ENTER(SBE_FUNC); + uint32_t rc = SBE_SEC_OPERATION_SUCCESSFUL; + ReturnCode fapiRc = FAPI2_RC_SUCCESS; + uint32_t len = 0; + sbeRespGenHdr_t respHdr; + respHdr.init(); + sbeResponseFfdc_t ffdc; + //Target procTgt = plat_getChipTarget(); + + do + { + // Dequeue the EOT entry as no more data is expected. + rc = sbeUpFifoDeq_mult (len, NULL); + CHECK_SBE_RC_AND_BREAK_IF_NOT_SUCCESS(rc); + + //SBE_EXEC_HWP(fapiRc, p9_flush_nvdimm_hwp, procTgt); + if( fapiRc != FAPI2_RC_SUCCESS ) + { + SBE_ERROR(SBE_FUNC "p9_flush_NVDIMM_hwp failed"); + respHdr.setStatus( SBE_PRI_GENERIC_EXECUTION_FAILURE, + SBE_SEC_HWP_FAILURE); + ffdc.setRc(fapiRc); + break; + } + }while(0); + + // Create the Response to caller + do + { + // If there was a FIFO error, will skip sending the response, + // instead give the control back to the command processor thread + CHECK_SBE_RC_AND_BREAK_IF_NOT_SUCCESS(rc); + rc = sbeDsSendRespHdr( respHdr, &ffdc); + }while(0); + + SBE_EXIT(SBE_FUNC); + return rc; + #undef SBE_FUNC +} +//---------------------------------------------------------------------------- + ReturnCode performAttrSetup( ) { #define SBE_FUNC "performAttrSetup " diff --git a/src/sbefw/app/power/sbecmdiplcontrol.H b/src/sbefw/app/power/sbecmdiplcontrol.H index 6e0993f0..9721b212 100644 --- a/src/sbefw/app/power/sbecmdiplcontrol.H +++ b/src/sbefw/app/power/sbecmdiplcontrol.H @@ -5,7 +5,8 @@ /* */ /* OpenPOWER sbe Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2018 */ +/* Contributors Listed Below - COPYRIGHT 2015,2019 */ +/* [+] International Business Machines Corp. */ /* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ @@ -44,6 +45,15 @@ */ uint32_t sbeHandleSuspendIO(uint8_t *i_pArg); +/** + * @brief execute flush NVDIMM chip-op (0xA103) + * + * @param[in] i_pArg Buffer to be passed to the function (not used as of now) + * + * @return Rc from the FIFO access utility + */ +uint32_t sbeHandleFlushNVDIMM(uint8_t *i_pArg); + // Utility function to do TPM reset fapi2::ReturnCode performTpmReset(); diff --git a/src/sbefw/core/sbe_sp_intf.H b/src/sbefw/core/sbe_sp_intf.H index 678ab626..3542823c 100644 --- a/src/sbefw/core/sbe_sp_intf.H +++ b/src/sbefw/core/sbe_sp_intf.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER sbe Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2018 */ +/* Contributors Listed Below - COPYRIGHT 2015,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -73,6 +73,7 @@ enum sbeIplControlCommands { SBE_CMD_EXECUTE_ISTEP = 0x01, /* Execute istep */ SBE_CMD_SUSPEND_IO = 0x02, /* Suspend IO */ + SBE_CMD_FLUSH_NVDIMM = 0x03, /* Flush NVDIMM */ }; /** @@ -230,6 +231,7 @@ enum sbeSecondaryResponse SBE_SEC_SPECIAL_WAKEUP_SCOM_FAILURE = 0x29, SBE_SEC_S0_ARCH_REG_DUMP_FAILED = 0x2A, SBE_SEC_LPC_ACCESS_FAILED = 0x2B, + SBE_SEC_HWP_FAILURE = 0x2C, }; /** @@ -280,6 +282,7 @@ enum EXECUTE_ISTEP_SUPPPORTED = 0xA1000001, SUSPEND_IO_SUPPPORTED = 0xA1000002, + FLUSH_NVDIMM_SUPPPORTED = 0xA1000003, RESERVED_A1_CAPABILITIES = 0xA1800000, GET_SCOM_SUPPPORTED = 0xA2000001, diff --git a/src/test/testcases/test.xml b/src/test/testcases/test.xml index ead04b00..c71e459b 100755 --- a/src/test/testcases/test.xml +++ b/src/test/testcases/test.xml @@ -5,7 +5,7 @@ - + @@ -36,6 +36,7 @@ ../simics/targets/p9_nimbus/sbeTest/testPSUSetStashPair.xml ../simics/targets/p9_nimbus/sbeTest/testIstep.xml ../simics/targets/p9_nimbus/sbeTest/testSuspendIO.xml + ../simics/targets/p9_nimbus/sbeTest/testFlushNVDIMM.xml ../simics/targets/p9_nimbus/sbeTest/testGeneric.xml ../simics/targets/p9_nimbus/sbeTest/testUnsecureMemRegions.xml diff --git a/src/test/testcases/testFlushNVDIMM.py b/src/test/testcases/testFlushNVDIMM.py new file mode 100755 index 00000000..3350bd77 --- /dev/null +++ b/src/test/testcases/testFlushNVDIMM.py @@ -0,0 +1,58 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/test/testcases/testFlushNVDIMM.py $ +# +# OpenPOWER sbe Project +# +# Contributors Listed Below - COPYRIGHT 2017,2019 +# +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. See the License for the specific language governing +# permissions and limitations under the License. +# +# IBM_PROLOG_END_TAG + +import sys +sys.path.append("targets/p9_nimbus/sbeTest" ) +import testUtil +err = False + +TESTDATA = [0,0,0,2, + 0,0,0xA1,0x03 ] + +EXPDATA = [0xc0,0xde,0xa1,0x03, + 0x0,0x0,0x0,0x0, + 0x00,0x0,0x0,0x3]; + + +# MAIN Test Run Starts Here... +#------------------------------------------------- +def main( ): + testUtil.runCycles( 10000000 ) + testUtil.writeUsFifo( TESTDATA ) + testUtil.writeEot( ) + testUtil.readDsFifo( EXPDATA ) + testUtil.readEot( ) + +#------------------------------------------------- +# Calling all test code +#------------------------------------------------- +main() + +if err: + print ("\nTest Suite completed with error(s)") + #sys.exit(1) +else: + print ("\nTest Suite completed with no errors") + #sys.exit(0); + diff --git a/src/test/testcases/testFlushNVDIMM.xml b/src/test/testcases/testFlushNVDIMM.xml new file mode 100755 index 00000000..9effcbaa --- /dev/null +++ b/src/test/testcases/testFlushNVDIMM.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + run-python-file targets/p9_nimbus/sbeTest/testFlushNVDIMM.py + yes + + -- cgit v1.2.1