From 3819989297207c85bd04f8633c8efac31b2c55f2 Mon Sep 17 00:00:00 2001 From: Sunil Kumar Date: Fri, 11 Jan 2019 03:11:57 -0600 Subject: Incorporate NVDIMM HWP into SBE. Change-Id: I7c0b338d31b419914c74c2aaee9d24625b7dc233 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/70360 Reviewed-by: Sachin Gupta Tested-by: Jenkins Server Tested-by: FSP CI Jenkins Reviewed-by: RAJA DAS --- src/sbefw/app/power/apppowerfiles.mk | 4 +- src/sbefw/app/power/chipop_table.C | 1 + src/sbefw/app/power/ipl_table.C | 10 ++- src/sbefw/app/power/sbecmdflushnvdimm.C | 118 ++++++++++++++++++++++++++++++++ src/sbefw/app/power/sbecmdflushnvdimm.H | 51 ++++++++++++++ src/sbefw/app/power/sbecmdiplcontrol.C | 54 --------------- src/sbefw/app/power/sbecmdiplcontrol.H | 11 +-- 7 files changed, 182 insertions(+), 67 deletions(-) create mode 100644 src/sbefw/app/power/sbecmdflushnvdimm.C create mode 100644 src/sbefw/app/power/sbecmdflushnvdimm.H (limited to 'src/sbefw') diff --git a/src/sbefw/app/power/apppowerfiles.mk b/src/sbefw/app/power/apppowerfiles.mk index 8d134aa9..e05ecefc 100644 --- a/src/sbefw/app/power/apppowerfiles.mk +++ b/src/sbefw/app/power/apppowerfiles.mk @@ -5,7 +5,7 @@ # # OpenPOWER sbe Project # -# Contributors Listed Below - COPYRIGHT 2015,2018 +# Contributors Listed Below - COPYRIGHT 2015,2019 # [+] International Business Machines Corp. # # @@ -32,6 +32,7 @@ APPPOWERPIBMEM-CPP-SOURCES += sbecmdcntrldmt.C APPPOWERPIBMEM-CPP-SOURCES += sbecmdsram.C APPPOWERPIBMEM-CPP-SOURCES += sbecmdgeneric.C APPPOWERPIBMEM-CPP-SOURCES += istep.C +APPPOWERPIBMEM-CPP-SOURCES += sbecmdflushnvdimm.C APPPOWERPIBMEM-C-SOURCES = APPPOWERPIBMEM-S-SOURCES = @@ -47,6 +48,7 @@ APPPOWERSEEPROM-CPP-SOURCES += sbecmdgeneric.C APPPOWERSEEPROM-CPP-SOURCES += sbecmdtracearray.C APPPOWERSEEPROM-CPP-SOURCES += sbearchregdump.C APPPOWERSEEPROM-CPP-SOURCES += sbecmdcntlinst.C +APPPOWERSEEPROM-CPP-SOURCES += sbecmdflushnvdimm.C APPPOWERSEEPROM-C-SOURCES = APPPOWERSEEPROM-S-SOURCES = diff --git a/src/sbefw/app/power/chipop_table.C b/src/sbefw/app/power/chipop_table.C index 1431b343..c0f28da5 100644 --- a/src/sbefw/app/power/chipop_table.C +++ b/src/sbefw/app/power/chipop_table.C @@ -24,6 +24,7 @@ /* IBM_PROLOG_END_TAG */ #include "sbecmdscomaccess.H" #include "sbecmdiplcontrol.H" +#include "sbecmdflushnvdimm.H" #include "sbecmdgeneric.H" #include "sbecmdmemaccess.H" #include "sbecmdregaccess.H" diff --git a/src/sbefw/app/power/ipl_table.C b/src/sbefw/app/power/ipl_table.C index 86b41f41..91379a67 100644 --- a/src/sbefw/app/power/ipl_table.C +++ b/src/sbefw/app/power/ipl_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. */ /* */ /* */ @@ -110,6 +110,7 @@ #include "sbeSecureMemRegionManager.H" #include "sbeConsole.H" +#include "sbecmdflushnvdimm.H" // Forward declaration using namespace fapi2; @@ -128,7 +129,6 @@ static const uint64_t N3_FIR_SYSTEM_CHECKSTOP_BIT = 30; // 63-33 = 30 // Externs extern p9_thread_control_FP_t threadCntlhwp; extern uint64_t G_ring_save[8]; - //Utility function to mask special attention extern ReturnCode maskSpecialAttn( const Target& i_target ); @@ -999,6 +999,12 @@ ReturnCode istepStartMpipl( voidfuncptr_t i_hwp) SBE_ERROR(SBE_FUNC "resetCrespErrLatch failed"); break; } + rc = flushNVDIMM(); + if( rc != FAPI2_RC_SUCCESS ) + { + SBE_ERROR(SBE_FUNC "flushNVDIMM failed"); + break; + } }while(0); diff --git a/src/sbefw/app/power/sbecmdflushnvdimm.C b/src/sbefw/app/power/sbecmdflushnvdimm.C new file mode 100644 index 00000000..c551cbca --- /dev/null +++ b/src/sbefw/app/power/sbecmdflushnvdimm.C @@ -0,0 +1,118 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/sbefw/app/power/sbecmdflushnvdimm.C $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015,2019 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* 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 */ +/* + * @file: ppe/sbe/sbefw/sbecmdiplcontrol.C + * + * @brief This file contains the SBE istep chipOps + * + */ +#include "sbefifo.H" +#include "sbetrace.H" +#include "sbe_sp_intf.H" +#include "sbeFifoMsgUtils.H" +#include "nvdimm_workarounds.H" +#include "sbecmdflushnvdimm.H" + +using namespace fapi2; + + +#ifdef __SBEFW_SEEPROM__ + +/////////////////////////////////////////////////////////////////////// +// @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; + + 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); + + fapiRc = flushNVDIMM(); + 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 +} +//---------------------------------------------------------------------------- + +fapi2::ReturnCode flushNVDIMM() +{ + #define SBE_FUNC "flushNVDIMM " + SBE_ENTER(SBE_FUNC); + ReturnCode fapiRc = FAPI2_RC_SUCCESS; + Target procTgt = plat_getChipTarget(); + do + { + SBE_EXEC_HWP(fapiRc, p9_flush_nvdimm_hwp, procTgt); + if( fapiRc != FAPI2_RC_SUCCESS ) + { + SBE_ERROR(SBE_FUNC "p9_flush_NVDIMM_hwp failed"); + break; + } + + }while(0); + SBE_EXIT(SBE_FUNC); + return fapiRc; + #undef SBE_FUNC +} + +/* end PIBMEM CODE ----------------------------- */ +#endif //#ifndef __SBEFW_SEEPROM__ diff --git a/src/sbefw/app/power/sbecmdflushnvdimm.H b/src/sbefw/app/power/sbecmdflushnvdimm.H new file mode 100644 index 00000000..789ac3d0 --- /dev/null +++ b/src/sbefw/app/power/sbecmdflushnvdimm.H @@ -0,0 +1,51 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/sbefw/app/power/sbecmdflushnvdimm.H $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015,2019 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* 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 */ +/* + * @file: ppe/sbe/sbefw/sbecmdiplcontrol.H + * + * @brief This file contains the SBE command details + * + */ + +#ifndef __SBEFW_SBECMDFLUSHNVDIMM_H +#define __SBEFW_SBECMDFLUSHNVDIMM_H + +#include +#include "sbecmdgeneric.H" +#include "fapi2.H" + +/** + * @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 call NVDIMM procedure. +fapi2::ReturnCode flushNVDIMM(); + +#endif // __SBEFW_SBECMDIPLCONTROL_H diff --git a/src/sbefw/app/power/sbecmdiplcontrol.C b/src/sbefw/app/power/sbecmdiplcontrol.C index 88eb9b8d..97872411 100644 --- a/src/sbefw/app/power/sbecmdiplcontrol.C +++ b/src/sbefw/app/power/sbecmdiplcontrol.C @@ -47,7 +47,6 @@ #include "p9n2_quad_scom_addresses.H" #include "p9_suspend_io.H" -//#include "nvdimm_workarounds.H" #include @@ -306,59 +305,6 @@ 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 9721b212..31bec1c9 100644 --- a/src/sbefw/app/power/sbecmdiplcontrol.H +++ b/src/sbefw/app/power/sbecmdiplcontrol.H @@ -37,7 +37,7 @@ #include "fapi2.H" /** - * @brief execute suspend IO chip-op (0xA102) + * @brief execute suspend IO chip-op (0xA103) * * @param[in] i_pArg Buffer to be passed to the function (not used as of now) * @@ -45,15 +45,6 @@ */ 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(); -- cgit v1.2.1