diff options
author | Roland Veloz <rveloz@us.ibm.com> | 2017-12-20 12:08:19 -0600 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-01-17 16:08:40 -0500 |
commit | 6f4abd1ea46f9b8f4fa1d0632276df8ad77d47d4 (patch) | |
tree | 807639c207bb98d8ba56d2c757d2e2f81f6ab887 /src/usr/hwas | |
parent | 4e84db479b0ca31d6f54cf8276e339cf566ae51e (diff) | |
download | talos-hostboot-6f4abd1ea46f9b8f4fa1d0632276df8ad77d47d4.tar.gz talos-hostboot-6f4abd1ea46f9b8f4fa1d0632276df8ad77d47d4.zip |
Support for any target deconfig at runtime; Utility to create a generic message
I added code to inform FSP whenever a target has been deconfiged.
I also added a handy utility to facilitate in the construction of
a Generic FSP message.
Change-Id: Iad755d4de1bf200ab00ad3f99451512ba8cdabb4
RTC: 183950
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/51201
Reviewed-by: Martin Gloff <mgloff@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/hwas')
-rw-r--r-- | src/usr/hwas/common/deconfigGard.C | 39 | ||||
-rw-r--r-- | src/usr/hwas/common/hwasCallout.C | 2 | ||||
-rw-r--r-- | src/usr/hwas/hwasPlat.C | 13 | ||||
-rw-r--r-- | src/usr/hwas/hwasPlatDeconfigGard.C | 170 | ||||
-rw-r--r-- | src/usr/hwas/hwasPlatError.C | 18 |
5 files changed, 193 insertions, 49 deletions
diff --git a/src/usr/hwas/common/deconfigGard.C b/src/usr/hwas/common/deconfigGard.C index ab87aba12..ed16a805b 100644 --- a/src/usr/hwas/common/deconfigGard.C +++ b/src/usr/hwas/common/deconfigGard.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2017 */ +/* Contributors Listed Below - COPYRIGHT 2012,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -114,7 +114,7 @@ errlHndl_t clearGardByType(const GARD_ErrorType i_type) return theDeconfigGard().clearGardRecordsByType(i_type); } -#endif +#endif //__HOSTBOOT_RUNTIME //****************************************************************************** DeconfigGard & theDeconfigGard() @@ -911,6 +911,7 @@ errlHndl_t DeconfigGard::getGardRecords( errlHndl_t l_pErr = platGetGardRecords(i_pTarget, o_records); return l_pErr; } +#endif //__HOSTBOOT_RUNTIME //****************************************************************************** errlHndl_t DeconfigGard::deconfigureTarget( @@ -1004,6 +1005,7 @@ errlHndl_t DeconfigGard::deconfigureTarget( return l_pErr; } // deconfigureTarget +#ifndef __HOSTBOOT_RUNTIME //****************************************************************************** void DeconfigGard::registerDeferredDeconfigure( const Target & i_target, @@ -1066,7 +1068,7 @@ errlHndl_t DeconfigGard::_getDeconfigureRecords( HWAS_MUTEX_UNLOCK(iv_mutex); return NULL; } - +#endif //__HOSTBOOT_RUNTIME //****************************************************************************** /** @@ -2041,10 +2043,18 @@ void DeconfigGard::_deconfigureTarget( // Set flag indicating x/a/o bus endpoint deconfiguration iv_XAOBusEndpointDeconfigured = true; } + + // The target has been successfully de-configured, + // perform any other post-deconfig operations, + // e.g. syncing state with other subsystems + // TODO RTC:184521: Allow function platPostDeconfigureTarget + // to run once FSP supports it + // Remove the #ifdef ... #endif, once FSP is ready for code + #ifdef __HOSTBOOT_MODULE + platPostDeconfigureTarget(&i_target); + #endif } } - - //HWAS_DBG("Deconfiguring Target %.8X exiting", get_huid(&i_target)); } // _deconfigureTarget //****************************************************************************** @@ -2052,16 +2062,6 @@ void DeconfigGard::_doDeconfigureActions(Target & i_target) { // Placeholder for any necessary deconfigure actions -#ifdef CONFIG_TPMDD - if( i_target.getAttr<TARGETING::ATTR_TYPE>() - == TARGETING::TYPE_TPM) - { - HWAS_INF("_doDeconfigureActions: Deconfiguring TPM 0x%08X", - get_huid(&i_target)); - (void)TRUSTEDBOOT::tpmMarkFailed(&i_target); - } -#endif - #ifdef CONFIG_BMC_IPMI // set the BMC status for this target SENSOR::StatusSensor l_sensor( &i_target ); @@ -2081,6 +2081,7 @@ void DeconfigGard::_doDeconfigureActions(Target & i_target) } +#ifndef __HOSTBOOT_RUNTIME //****************************************************************************** void DeconfigGard::_createDeconfigureRecord( const Target & i_target, @@ -2178,6 +2179,8 @@ void DeconfigGard::processDeferredDeconfig() HWAS_DBG("<processDeferredDeconfig"); } // processDeferredDeconfig +#endif // __HOSTBOOT_RUNTIME + //****************************************************************************** errlHndl_t DeconfigGard::_deconfigureAssocProc(ProcInfoVector &io_procInfo) @@ -2718,6 +2721,7 @@ errlHndl_t DeconfigGard::_symmetryValidation(ProcInfoVector &io_procInfo) return l_errlHdl; } +#ifndef __HOSTBOOT_RUNTIME //****************************************************************************** void DeconfigGard::setXAOBusEndpointDeconfigured(bool deconfig) @@ -2755,6 +2759,7 @@ void DeconfigGard::_clearFCODeconfigure(ConstTargetHandle_t i_nodeTarget) } } //****************************************************************************** +#endif // __HOSTBOOT_RUNTIME //Note this will not find child DIMMs because they are //affinity children, not physical @@ -2788,7 +2793,5 @@ bool DeconfigGard::anyChildFunctional(Target & i_parent) return retVal; } //anyChildFunctional - -#endif -} // namespce HWAS +} // namespace HWAS diff --git a/src/usr/hwas/common/hwasCallout.C b/src/usr/hwas/common/hwasCallout.C index bdaaea2f5..588833572 100644 --- a/src/usr/hwas/common/hwasCallout.C +++ b/src/usr/hwas/common/hwasCallout.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2016 */ +/* Contributors Listed Below - COPYRIGHT 2012,2018 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ diff --git a/src/usr/hwas/hwasPlat.C b/src/usr/hwas/hwasPlat.C index 91d1ee8f6..b617b827b 100644 --- a/src/usr/hwas/hwasPlat.C +++ b/src/usr/hwas/hwasPlat.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2017 */ +/* Contributors Listed Below - COPYRIGHT 2012,2018 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ @@ -182,17 +182,6 @@ errlHndl_t platReadIDEC(const TargetHandle_t &i_target) } // platReadIDEC //****************************************************************************** -// platSystemIsAtRuntime function -// Description: This function will return false always because when Hostboot -// is running then System cannot be at runtime -//****************************************************************************** -bool platSystemIsAtRuntime() -{ - HWAS_INF("HostBoot is running so system is not at runtime."); - return false; -} - -//****************************************************************************** // platIsMinHwCheckingAllowed function // Description: This function will return false always because when Hostboot // is running then System cannot be at runtime diff --git a/src/usr/hwas/hwasPlatDeconfigGard.C b/src/usr/hwas/hwasPlatDeconfigGard.C index 6c8aa27d5..a8aa334c5 100644 --- a/src/usr/hwas/hwasPlatDeconfigGard.C +++ b/src/usr/hwas/hwasPlatDeconfigGard.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2017 */ +/* Contributors Listed Below - COPYRIGHT 2013,2018 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ @@ -46,6 +46,16 @@ #include <pnor/pnorif.H> +#ifdef __HOSTBOOT_RUNTIME +#include <runtime/interface.h> // g_hostInterfaces +#include <runtime/hbrt_utilities.H> // createGenericFspMsg +#include <util/runtime/rt_fwreq_helper.H> // firmware_request_helper +#endif + +#ifdef CONFIG_TPMDD +#include <../usr/secureboot/trusted/trustedbootUtils.H> +#endif + namespace HWAS { @@ -543,4 +553,162 @@ errlHndl_t getGardSectionInfo(PNOR::SectionInfo_t& o_sectionInfo) return l_errl; } +/** + * @brief This will perform any post-deconfig operations, + * such as syncing state with other subsystems + */ +void DeconfigGard::platPostDeconfigureTarget( + TARGETING::Target * i_pTarget) +{ +#ifndef __HOSTBOOT_RUNTIME +#ifdef CONFIG_TPMDD + if( i_pTarget->getAttr<TARGETING::ATTR_TYPE>() + == TARGETING::TYPE_TPM) + { + HWAS_INF("platPostDeconfigureTarget: Deconfiguring TPM 0x%08X", + get_huid(i_pTarget)); + (void)TRUSTEDBOOT::tpmMarkFailed(i_pTarget); + } +#endif // CONFIG_TPMDD +#endif // #ifndef __HOSTBOOT_RUNTIME + +#ifdef __HOSTBOOT_RUNTIME + // As part of keeping things in sync when a target is + // deconfiged, HBRT will send a message down to FSP to + // inform FSP that a target has been deconfiged + errlHndl_t l_err = nullptr; + + // Handles to the firmware messages + hostInterfaces::hbrt_fw_msg *l_req_fw_msg = nullptr; + hostInterfaces::hbrt_fw_msg *l_resp_fw_msg = nullptr; + + do + { + if ((nullptr == g_hostInterfaces) || + (nullptr == g_hostInterfaces->firmware_request)) + { + HWAS_ERR("Hypervisor firmware_request interface not linked"); + + /*@ + * @errortype + * @severity ERRL_SEV_INFORMATIONAL + * @moduleid HWAS::MOD_PLAT_DECONFIG_GARD + * @reasoncode HWAS::RC_RT_NULL_FIRMWARE_REQUEST_PTR + * @userdata1 HUID of target + * @userdata2 none + * @devdesc Post de-configuration of target failed + */ + l_err= new ErrlEntry(ERRL_SEV_INFORMATIONAL, + HWAS::MOD_PLAT_DECONFIG_GARD, + HWAS::RC_RT_NULL_FIRMWARE_REQUEST_PTR, + get_huid(i_pTarget), + 0, + true); + break; + } + + // Create and initialize to zero a few needed variables + uint32_t l_fsp_data_size(0); + uint64_t l_req_fw_msg_size(0), l_resp_fw_msg_size(0); + + // Create the dynamic firmware messages + createGenericFspMsg(sizeof(TargetDeconfigHbrtFspData_t), + l_fsp_data_size, + l_req_fw_msg_size, + l_req_fw_msg, + l_resp_fw_msg_size, + l_resp_fw_msg); + + // If there was an issue with creating the messages, + // Create an Error Log entry and exit + if (!l_req_fw_msg || !l_resp_fw_msg) + { + HWAS_ERR("Unable to allocate firmware request messages"); + + /*@ + * @errortype + * @severity ERRL_SEV_INFORMATIONAL + * @moduleid HWAS::MOD_PLAT_DECONFIG_GARD + * @reasoncode HWAS::RC_RT_NULL_FIRMWARE_MSG_PTR + * @userdata1 HUID of target + * @userdata2 none + * @devdesc Post de-configuration of target failed + */ + l_err= new ErrlEntry(ERRL_SEV_INFORMATIONAL, + HWAS::MOD_PLAT_DECONFIG_GARD, + HWAS::RC_RT_NULL_FIRMWARE_MSG_PTR, + get_huid(i_pTarget), + 0, + true); + break; + } + + // Populate the request message with given data + l_req_fw_msg->generic_msg.msgq = MBOX::FSP_TARG_DECONFIG_MSGQ; + l_req_fw_msg->generic_msg.msgType = + GenericFspMboxMessage_t::MSG_DECONFIG_TARGET; + + // Create a useful struct to populate the generic_msg::data field + // Setting the HUID in the 1st 4 bytes (32bits) followed by the + // HWAS state. + TargetDeconfigHbrtFspData_t* l_fspData = + reinterpret_cast<TargetDeconfigHbrtFspData_t*> + (&(l_req_fw_msg->generic_msg.data)); + l_fspData->huid = get_huid(i_pTarget); + l_fspData->hwasState = i_pTarget->getAttr<ATTR_HWAS_STATE>(); + + // Binary trace the request message + HWAS_INF_BIN("Sending firmware_request", + l_req_fw_msg, + l_req_fw_msg_size); + + // Make the firmware_request call + // Inform the FSP that this target has been deconfiged + l_err = firmware_request_helper(l_req_fw_msg_size, + l_req_fw_msg, + &l_resp_fw_msg_size, + l_resp_fw_msg); + } while(0); + + if (l_err) + { + errlCommit(l_err, HWAS_COMP_ID); + } + + // Release the firmware messages and set to NULL + delete []l_req_fw_msg; + delete []l_resp_fw_msg; + l_req_fw_msg = l_resp_fw_msg = nullptr; +#endif // __HOSTBOOT_RUNTIME +} + +//***************************************************************************** +bool platSystemIsAtRuntime() +{ +#ifndef __HOSTBOOT_RUNTIME + HWAS_INF("HostBoot is running so system is NOT at runtime."); + return false; +#else + HWAS_INF("HostBoot is NOT running so system is at runtime."); + return true; +#endif +} + +//***************************************************************************** +errlHndl_t hwasError(const uint8_t i_sev, + const uint8_t i_modId, + const uint16_t i_reasonCode, + const uint64_t i_user1, + const uint64_t i_user2) +{ + errlHndl_t l_pErr; + + l_pErr = new ERRORLOG::ErrlEntry( + (ERRORLOG::errlSeverity_t)i_sev, i_modId, + i_reasonCode, + i_user1, i_user2); + l_pErr->collectTrace("HWAS_I"); + return l_pErr; +} + } // namespace HWAS diff --git a/src/usr/hwas/hwasPlatError.C b/src/usr/hwas/hwasPlatError.C index 8c53ccdb6..2ec510e66 100644 --- a/src/usr/hwas/hwasPlatError.C +++ b/src/usr/hwas/hwasPlatError.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2017 */ +/* Contributors Listed Below - COPYRIGHT 2012,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -35,22 +35,6 @@ namespace HWAS { -errlHndl_t hwasError(const uint8_t i_sev, - const uint8_t i_modId, - const uint16_t i_reasonCode, - const uint64_t i_user1, - const uint64_t i_user2) -{ - errlHndl_t l_pErr; - - l_pErr = new ERRORLOG::ErrlEntry( - (ERRORLOG::errlSeverity_t)i_sev, i_modId, - i_reasonCode, - i_user1, i_user2); - l_pErr->collectTrace("HWAS_I"); - return l_pErr; -} - void hwasErrorAddProcedureCallout(errlHndl_t & io_errl, const HWAS::epubProcedureID i_procedure, const HWAS::callOutPriority i_priority) |