diff options
Diffstat (limited to 'src/usr/util')
-rw-r--r-- | src/usr/util/runtime/rt_cmds.C | 69 | ||||
-rw-r--r-- | src/usr/util/runtime/rt_fwreq_helper.C | 60 |
2 files changed, 125 insertions, 4 deletions
diff --git a/src/usr/util/runtime/rt_cmds.C b/src/usr/util/runtime/rt_cmds.C index bab3a85d4..c015215b5 100644 --- a/src/usr/util/runtime/rt_cmds.C +++ b/src/usr/util/runtime/rt_cmds.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2018 */ +/* Contributors Listed Below - COPYRIGHT 2015,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -46,6 +46,9 @@ #include <scom/runtime/rt_scomif.H> // sendScomOpToFsp, // sendMultiScomReadToFsp, // switchToFspScomAccess +#ifdef CONFIG_NVDIMM +#include <isteps/nvdimm/nvdimm.H> // notify NVDIMM protection change +#endif extern char hbi_ImageId; @@ -1153,6 +1156,49 @@ void cmd_sendMultiScomReadToFSP( char* &o_output, } } +#ifdef CONFIG_NVDIMM +void cmd_nvdimm_protection_msg( char* &o_output, uint32_t i_huid, + uint32_t protection ) +{ + errlHndl_t l_err = nullptr; + o_output = new char[500]; + uint8_t l_notifyType = NVDIMM::NOT_PROTECTED; + + TARGETING::Target* l_targ{}; + l_targ = getTargetFromHUID(i_huid); + if (l_targ != NULL) + { + if (protection == 1) + { + l_notifyType = NVDIMM::PROTECTED; + l_err = notifyNvdimmProtectionChange(l_targ, NVDIMM::PROTECTED); + } + else if (protection == 2) + { + l_notifyType = NVDIMM::UNPROTECTED_BECAUSE_ERROR; + l_err = notifyNvdimmProtectionChange(l_targ, NVDIMM::UNPROTECTED_BECAUSE_ERROR); + } + else + { + l_err = notifyNvdimmProtectionChange(l_targ, NVDIMM::NOT_PROTECTED); + } + if (l_err) + { + sprintf( o_output, "Error on call to notifyNvdimmProtectionChange" + "(0x%.8X, %d), rc=0x%.8X, plid=0x%.8X", + i_huid, l_notifyType, ERRL_GETRC_SAFE(l_err), l_err->plid() ); + errlCommit(l_err, UTIL_COMP_ID); + return; + } + } + else + { + sprintf( o_output, "cmd_nvdimm_protection_msg: HUID 0x%.8X not found", + i_huid ); + return; + } +} +#endif /** * @brief Execute an arbitrary command inside Hostboot Runtime @@ -1473,6 +1519,22 @@ int hbrtCommand( int argc, "ERROR: multiScomReadToFsp <huid> <scomAddrs>"); } } +#ifdef CONFIG_NVDIMM + else if( !strcmp( argv[0], "nvdimm_protection" ) ) + { + if (argc >= 3) + { + uint32_t huid = strtou64(argv[1], NULL, 16); + uint32_t protection = strtou64( argv[2], NULL, 16); + cmd_nvdimm_protection_msg( *l_output, huid, protection ); + } + else + { + *l_output = new char[100]; + sprintf(*l_output, "ERROR: nvdimm_protection <huid> <0 or 1>"); + } + } +#endif else { *l_output = new char[50+100*12]; @@ -1509,6 +1571,11 @@ int hbrtCommand( int argc, strcat( *l_output, l_tmpstr ); sprintf( l_tmpstr, "multiScomReadToFsp <huid> <scomAddrs>\n"); strcat( *l_output, l_tmpstr ); +#ifdef CONFIG_NVDIMM + sprintf( l_tmpstr, "nvdimm_protection <huid> <0 or 1>\n"); + strcat( *l_output, l_tmpstr ); +#endif + } if( l_traceOut && (*l_output != NULL) ) diff --git a/src/usr/util/runtime/rt_fwreq_helper.C b/src/usr/util/runtime/rt_fwreq_helper.C index 40a8373e5..f94dab238 100644 --- a/src/usr/util/runtime/rt_fwreq_helper.C +++ b/src/usr/util/runtime/rt_fwreq_helper.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2018 */ +/* Contributors Listed Below - COPYRIGHT 2013,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -250,6 +250,34 @@ errlHndl_t firmware_request_helper(uint64_t i_reqLen, void *i_req, } break; // END case hostInterfaces::HBRT_FW_MSG_TYPE_SBE_STATE: + case hostInterfaces::HBRT_FW_MSG_TYPE_NVDIMM_PROTECTION: + { + TRACFCOMP(g_trac_runtime, + ERR_MRK"FSP is doing a reset/reload, " + "Send NVDIMM state to PHYP failed. " + "retry:%d/%d, rc:%d, procId:0x%.8X, " + "state:%d - %s", + i, + HBRT_FW_REQUEST_RETRIES, + rc, + l_req_fw_msg->sbe_state.i_procId, + l_req_fw_msg->sbe_state.i_state, + l_req_fw_msg->sbe_state.i_state? + "protected":"not protected"); + + // Pack user data 1 with Hypervisor return code and + // firmware request message type + l_userData1 = TWO_UINT32_TO_UINT64(rc, + l_req_fw_msg->io_type); + + // Pack user data 2 with processor ID of NVDIMM + // and state of the NVDIMM + l_userData2 = TWO_UINT32_TO_UINT64( + l_req_fw_msg->nvdimm_protection_state.i_procId, + l_req_fw_msg->nvdimm_protection_state.i_state); + } + break; // END case hostInterfaces::HBRT_FW_MSG_TYPE_NVDIMM_PROTECTION: + default: break; } // END switch (l_req_fw_msg->io_type) @@ -270,7 +298,8 @@ errlHndl_t firmware_request_helper(uint64_t i_reqLen, void *i_req, chipID * @userdata2[32:63] SCOM data (HCODE Update) || Message Type (FSP MSG) || - SBE state + SBE state || + NVDIMM protection * @devdesc The Firmware Request call failed */ l_err = new ErrlEntry(ERRL_SEV_INFORMATIONAL, @@ -439,6 +468,30 @@ errlHndl_t firmware_request_helper(uint64_t i_reqLen, void *i_req, } break; // END case hostInterfaces::HBRT_FW_MSG_TYPE_SBE_STATE: + case hostInterfaces::HBRT_FW_MSG_TYPE_NVDIMM_PROTECTION: + { + TRACFCOMP(g_trac_runtime, + ERR_MRK"Failed sending NVDIMM protection state to PHYP." + " rc:0x%X, procId:0x%.8X, state:%d - %s", + rc, + l_req_fw_msg->sbe_state.i_procId, + l_req_fw_msg->sbe_state.i_state, + l_req_fw_msg->sbe_state.i_state? + "protected":"not protected"); + + // Pack user data 1 with Hypervisor return code and + // firmware request message type + l_userData1 = TWO_UINT32_TO_UINT64(rc, + l_req_fw_msg->io_type); + + // Pack user data 2 with processor ID of NVDIMM + // and state of the NVDIMM + l_userData2 = TWO_UINT32_TO_UINT64( + l_req_fw_msg->nvdimm_protection_state.i_procId, + l_req_fw_msg->nvdimm_protection_state.i_state); + } + break; // END case hostInterfaces::HBRT_FW_MSG_TYPE_NVDIMM_PROTECTION: + default: break; } // END switch (l_req_fw_msg->io_type) @@ -459,7 +512,8 @@ errlHndl_t firmware_request_helper(uint64_t i_reqLen, void *i_req, chipId * @userdata2[32:63] SCOM data (HCODE Update) || Message Type (FSP MSG) || - SBE state + SBE state || + NVDIMM protection state * @devdesc The Firmware Request call failed */ l_err = new ErrlEntry(ERRL_SEV_PREDICTIVE, |