From f32aff51f83dcbcaa3857100c6e4e36ee7a8b84a Mon Sep 17 00:00:00 2001 From: Christian Geddes Date: Mon, 15 Jul 2019 11:02:27 -0500 Subject: Make RT_TARG id generation code common between IPL time and runtime For axone we are writing the OMI mmio bars into hdat so the hypervisor know how to talk to the devices. IPL code needs to be able to lookup the hbrt-style ids so we can use them to make hdat entries that the hypervisor will be able to associate targets with. This commit also move rt_targeting.H to the correct include directory and updates everywhere that it is included. Change-Id: I31deaa1a9c5a7523622a8b3b12ad459e2b2feed3 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/80419 Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Daniel M Crowell --- .../usr/runtime/customize_attrs_for_payload.H | 6 +- src/include/usr/runtime/rt_targeting.H | 98 -------------------- src/include/usr/targeting/common/hbrt_target.H | 45 +++++++++ src/include/usr/targeting/runtime/rt_targeting.H | 89 ++++++++++++++++++ src/usr/diag/attn/runtime/attn_rt.C | 2 +- src/usr/diag/attn/runtime/test/attntestRtAttns.H | 10 +- src/usr/fsi/runtime/rt_fsi.C | 4 +- src/usr/htmgt/runtime/rt_occ.C | 4 +- src/usr/i2c/runtime/rt_eepromCache.C | 2 +- src/usr/i2c/runtime/rt_i2c.C | 8 +- src/usr/isteps/nvdimm/nvdimm.C | 6 +- src/usr/isteps/nvdimm/runtime/nvdimm_rt.C | 2 +- src/usr/isteps/pm/runtime/rt_pm.C | 8 +- src/usr/isteps/pm/runtime/test/pmtestRt.H | 4 +- src/usr/pnor/runtime/rt_pnor.C | 6 +- src/usr/runtime/customize_attrs_for_payload.C | 8 +- src/usr/sbeio/runtime/rt_sbeio.C | 2 +- .../sbeio/runtime/test/sbeioAttrOverrideTests.H | 8 +- src/usr/sbeio/runtime/test/sbeiotestRt.H | 26 +++--- src/usr/scom/handleSpecialWakeup.C | 8 +- src/usr/scom/runtime/rt_scom.C | 8 +- src/usr/secureboot/runtime/rt_secureboot.C | 2 +- .../secureboot/runtime/test/testsecureboot_rt.H | 2 +- src/usr/targeting/common/common.mk | 3 +- src/usr/targeting/common/hbrt_target.C | 101 +++++++++++++++++++++ src/usr/targeting/hostboot_common.mk | 5 +- src/usr/targeting/makefile | 2 +- src/usr/targeting/runtime/attrPlatOverride_rt.C | 2 +- src/usr/targeting/runtime/makefile | 2 +- src/usr/targeting/runtime/rt_startup.C | 4 +- src/usr/targeting/runtime/rt_targeting.C | 59 +----------- src/usr/targeting/runtime/test/testtargeting.H | 8 +- src/usr/util/runtime/rt_fwnotify.C | 2 +- src/usr/vpd/runtime/rt_vpd.C | 4 +- 34 files changed, 317 insertions(+), 233 deletions(-) delete mode 100644 src/include/usr/runtime/rt_targeting.H create mode 100644 src/include/usr/targeting/common/hbrt_target.H create mode 100644 src/include/usr/targeting/runtime/rt_targeting.H create mode 100644 src/usr/targeting/common/hbrt_target.C diff --git a/src/include/usr/runtime/customize_attrs_for_payload.H b/src/include/usr/runtime/customize_attrs_for_payload.H index a5158f996..6d6928bda 100644 --- a/src/include/usr/runtime/customize_attrs_for_payload.H +++ b/src/include/usr/runtime/customize_attrs_for_payload.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ +/* Contributors Listed Below - COPYRIGHT 2016,2020 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -33,7 +33,7 @@ */ #include -#include +#include #include namespace RUNTIME @@ -42,7 +42,7 @@ namespace RUNTIME static const TARGETING::ATTR_HBRT_HYP_ID_type HBRT_HYP_ID_UNKNOWN = 0xFFFFFFFFFFFFFFFFULL; -static const RT_TARG::rtChipId_t RT_TYPE_UNKNOWN +static const TARGETING::rtChipId_t RT_TYPE_UNKNOWN = 0xFFFFFFFFFFFFFFFFULL; /** diff --git a/src/include/usr/runtime/rt_targeting.H b/src/include/usr/runtime/rt_targeting.H deleted file mode 100644 index 9070dbc88..000000000 --- a/src/include/usr/runtime/rt_targeting.H +++ /dev/null @@ -1,98 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/include/usr/runtime/rt_targeting.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2014,2018 */ -/* [+] 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 */ -#ifndef __RT_TARGETING_H -#define __RT_TARGETING_H - -#include - -namespace TARGETING -{ - class Target; -} - -namespace RT_TARG -{ - typedef uint64_t rtChipId_t; - - enum - { - MEMBUF_ID_SHIFT = 4, //!< CHIPID for MEMBUF is 'MMMM'b - MEMBUF_ID_MASK = 0x0000000F, //!< valid position bits for MEMBUF - }; - - - /** - * @brief Convert a TARGETING::Target to an unit ID that can be used - * in calls to the runtime host - * @param[in] The HB TARGETING::Target - * @param[out] Sapphire target id - * @return an error handle on error - */ - errlHndl_t getRtTarget(const TARGETING::Target* i_target, - rtChipId_t &o_targetId); - - /** - * @brief Convert a runtime chip_id (target) into a TARGETING::Target - * @param[in] The rt chipId - * @param[out] The TARGETING::Target pointer - * @return error log handle on error else NULL - */ - errlHndl_t getHbTarget(rtChipId_t i_rt_chip_id, - TARGETING::Target *& o_target); - - /** - * @brief Save/Restore attribute values from current Reserved Memory data - * into new LID Structure data - * @param[in] Pointer to current Reserved Memory targeting binary data - * @param[in/out] Pointer to new LID Structure targeting binary data - * @param[in] Instance, ie, Node ID - * @return nullptr on success, else error log - */ - errlHndl_t saveRestoreAttrs(void *i_rsvdMemPtr, - void *io_lidStructPtr, - uint8_t i_instance); - - /** - * @brief Validate LID Structure against Reserved Memory. Check that the - * TargetingHeader eyecatchers are valid, that the TargetingHeader number of - * sections match, and that the types and sizes of each TargetingSection - * match. - * @param[in] Pointer to new LID Structure targeting binary data - * @param[in] Pointer to current Reserved Memory targeting binary data - * @param[out] Total size of all sections in the new lid - * @return nullptr on success, else error log - */ - errlHndl_t validateData(void *i_lidStructPtr, - void *i_rsvdMemPtr, - size_t& o_lidTotalSize); - - /** - * @brief Apply ATTR_TMP overrides to be available for run time - */ - void applyTempOverrides( ); - -}; - -#endif diff --git a/src/include/usr/targeting/common/hbrt_target.H b/src/include/usr/targeting/common/hbrt_target.H new file mode 100644 index 000000000..1a6989bf4 --- /dev/null +++ b/src/include/usr/targeting/common/hbrt_target.H @@ -0,0 +1,45 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/targeting/common/hbrt_target.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2019,2020 */ +/* [+] 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 */ +#ifndef __HBRT_TARGET_H +#define __HBRT_TARGET_H + +#include + +namespace TARGETING +{ + typedef uint64_t rtChipId_t; + /** + * @brief Convert a TARGETING::Target to an unit ID that can be used + * in calls to the runtime host + * @param[in] The HB TARGETING::Target + * @param[out] Sapphire target id + * @return an error handle on error + */ + errlHndl_t getRtTarget(const TARGETING::Target* i_target, + rtChipId_t &o_targetId); + +} + +#endif \ No newline at end of file diff --git a/src/include/usr/targeting/runtime/rt_targeting.H b/src/include/usr/targeting/runtime/rt_targeting.H new file mode 100644 index 000000000..c94b871a9 --- /dev/null +++ b/src/include/usr/targeting/runtime/rt_targeting.H @@ -0,0 +1,89 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/targeting/runtime/rt_targeting.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014,2020 */ +/* [+] 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 */ +#ifndef __RT_TARGETING_H +#define __RT_TARGETING_H + +#include +#include + +namespace TARGETING +{ + class Target; +} + +namespace RT_TARG +{ + + enum + { + MEMBUF_ID_SHIFT = 4, //!< CHIPID for MEMBUF is 'MMMM'b + MEMBUF_ID_MASK = 0x0000000F, //!< valid position bits for MEMBUF + }; + + + + /** + * @brief Convert a runtime chip_id (target) into a TARGETING::Target + * @param[in] The rt chipId + * @param[out] The TARGETING::Target pointer + * @return error log handle on error else NULL + */ + errlHndl_t getHbTarget(TARGETING::rtChipId_t i_rt_chip_id, + TARGETING::Target *& o_target); + + /** + * @brief Save/Restore attribute values from current Reserved Memory data + * into new LID Structure data + * @param[in] Pointer to current Reserved Memory targeting binary data + * @param[in/out] Pointer to new LID Structure targeting binary data + * @param[in] Instance, ie, Node ID + * @return nullptr on success, else error log + */ + errlHndl_t saveRestoreAttrs(void *i_rsvdMemPtr, + void *io_lidStructPtr, + uint8_t i_instance); + + /** + * @brief Validate LID Structure against Reserved Memory. Check that the + * TargetingHeader eyecatchers are valid, that the TargetingHeader number of + * sections match, and that the types and sizes of each TargetingSection + * match. + * @param[in] Pointer to new LID Structure targeting binary data + * @param[in] Pointer to current Reserved Memory targeting binary data + * @param[out] Total size of all sections in the new lid + * @return nullptr on success, else error log + */ + errlHndl_t validateData(void *i_lidStructPtr, + void *i_rsvdMemPtr, + size_t& o_lidTotalSize); + + /** + * @brief Apply ATTR_TMP overrides to be available for run time + */ + void applyTempOverrides( ); + +}; + +#endif diff --git a/src/usr/diag/attn/runtime/attn_rt.C b/src/usr/diag/attn/runtime/attn_rt.C index 810e79bbe..92b225c7d 100644 --- a/src/usr/diag/attn/runtime/attn_rt.C +++ b/src/usr/diag/attn/runtime/attn_rt.C @@ -28,7 +28,7 @@ #include "common/attnmem.H" #include "common/attnbits.H" #include -#include +#include #include #include #include diff --git a/src/usr/diag/attn/runtime/test/attntestRtAttns.H b/src/usr/diag/attn/runtime/test/attntestRtAttns.H index 6e22b094e..b2bd1fd8e 100644 --- a/src/usr/diag/attn/runtime/test/attntestRtAttns.H +++ b/src/usr/diag/attn/runtime/test/attntestRtAttns.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2016 */ +/* Contributors Listed Below - COPYRIGHT 2014,2020 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -38,7 +38,7 @@ #include "../../common/attntrace.H" #include "../../common/attntarget.H" #include -#include +#include #include using namespace ATTN; @@ -79,8 +79,8 @@ class AttnCheckForRtAttentionsTest : public CxxTest::TestSuite } proc = procList[0]; - RT_TARG::rtChipId_t chipId = 0; - errlHndl_t err = RT_TARG::getRtTarget( proc, chipId ); + TARGETING::rtChipId_t chipId = 0; + errlHndl_t err = TARGETING::getRtTarget( proc, chipId ); if( NULL != err ) { TS_FAIL("getRtTarget() failed for 0x%08X", @@ -153,7 +153,7 @@ class AttnCheckForRtAttentionsTest : public CxxTest::TestSuite break; } - RT_TARG::rtChipId_t chipId = 0; + TARGETING::rtChipId_t chipId = 0; errlHndl_t err = RT_TARG::getRtTarget( proc, chipId ); if( NULL != err ) { diff --git a/src/usr/fsi/runtime/rt_fsi.C b/src/usr/fsi/runtime/rt_fsi.C index 75103cc4b..551ef7b4e 100644 --- a/src/usr/fsi/runtime/rt_fsi.C +++ b/src/usr/fsi/runtime/rt_fsi.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016,2017 */ +/* Contributors Listed Below - COPYRIGHT 2016,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -24,7 +24,7 @@ /* IBM_PROLOG_END_TAG */ #include -#include +#include #include #include diff --git a/src/usr/htmgt/runtime/rt_occ.C b/src/usr/htmgt/runtime/rt_occ.C index 652e767ed..d25d12f96 100644 --- a/src/usr/htmgt/runtime/rt_occ.C +++ b/src/usr/htmgt/runtime/rt_occ.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2018 */ +/* Contributors Listed Below - COPYRIGHT 2014,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -27,7 +27,7 @@ #include #include "../htmgt_utility.H" #include -#include +#include using namespace TARGETING; diff --git a/src/usr/i2c/runtime/rt_eepromCache.C b/src/usr/i2c/runtime/rt_eepromCache.C index e3b757b03..2b775ddb5 100644 --- a/src/usr/i2c/runtime/rt_eepromCache.C +++ b/src/usr/i2c/runtime/rt_eepromCache.C @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/usr/i2c/runtime/rt_i2c.C b/src/usr/i2c/runtime/rt_i2c.C index 16f62c76e..d3f5537c6 100755 --- a/src/usr/i2c/runtime/rt_i2c.C +++ b/src/usr/i2c/runtime/rt_i2c.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2019 */ +/* Contributors Listed Below - COPYRIGHT 2015,2020 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include "../errlud_i2c.H" // ---------------------------------------------- @@ -146,10 +146,10 @@ errlHndl_t i2cPerformOp( DeviceFW::OperationType i_opType, int rc = 0; bool l_host_if_enabled = true; - RT_TARG::rtChipId_t proc_id = 0; + TARGETING::rtChipId_t proc_id = 0; // Convert target to proc id - err = RT_TARG::getRtTarget( i_target, + err = TARGETING::getRtTarget( i_target, proc_id); if(err) { diff --git a/src/usr/isteps/nvdimm/nvdimm.C b/src/usr/isteps/nvdimm/nvdimm.C index a7e263cf3..e93271e5e 100644 --- a/src/usr/isteps/nvdimm/nvdimm.C +++ b/src/usr/isteps/nvdimm/nvdimm.C @@ -50,7 +50,7 @@ #include #ifdef __HOSTBOOT_RUNTIME #include -#include +#include #else #include #endif @@ -3802,9 +3802,9 @@ errlHndl_t notifyNvdimmProtectionChange(Target* i_target, // Send combined status notification // Get the Proc Chip Id - RT_TARG::rtChipId_t l_chipId = 0; + TARGETING::rtChipId_t l_chipId = 0; - l_err = RT_TARG::getRtTarget(l_proc, l_chipId); + l_err = TARGETING::getRtTarget(l_proc, l_chipId); if(l_err) { TRACFCOMP( g_trac_nvdimm, diff --git a/src/usr/isteps/nvdimm/runtime/nvdimm_rt.C b/src/usr/isteps/nvdimm/runtime/nvdimm_rt.C index f22c7d33a..e8ad1d9e9 100644 --- a/src/usr/isteps/nvdimm/runtime/nvdimm_rt.C +++ b/src/usr/isteps/nvdimm/runtime/nvdimm_rt.C @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/usr/isteps/pm/runtime/rt_pm.C b/src/usr/isteps/pm/runtime/rt_pm.C index 7ee9e0924..58930bc67 100644 --- a/src/usr/isteps/pm/runtime/rt_pm.C +++ b/src/usr/isteps/pm/runtime/rt_pm.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016,2019 */ +/* Contributors Listed Below - COPYRIGHT 2016,2020 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -37,7 +37,6 @@ #include // g_hostInterfaces #include // firmware_request_helper -#include #include #include @@ -46,6 +45,7 @@ #include #include #include +#include #include #include @@ -400,9 +400,9 @@ namespace RTPM } // Get the Proc Chip Id - RT_TARG::rtChipId_t l_chipId = 0; + TARGETING::rtChipId_t l_chipId = 0; - l_err = RT_TARG::getRtTarget(l_pChipTarget, l_chipId); + l_err = TARGETING::getRtTarget(l_pChipTarget, l_chipId); if(l_err) { TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, diff --git a/src/usr/isteps/pm/runtime/test/pmtestRt.H b/src/usr/isteps/pm/runtime/test/pmtestRt.H index 1c29f7ab8..235cb8cec 100644 --- a/src/usr/isteps/pm/runtime/test/pmtestRt.H +++ b/src/usr/isteps/pm/runtime/test/pmtestRt.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2017,2018 */ +/* Contributors Listed Below - COPYRIGHT 2017,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/usr/pnor/runtime/rt_pnor.C b/src/usr/pnor/runtime/rt_pnor.C index c8fb34599..0d40a60c3 100644 --- a/src/usr/pnor/runtime/rt_pnor.C +++ b/src/usr/pnor/runtime/rt_pnor.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2019 */ +/* Contributors Listed Below - COPYRIGHT 2014,2020 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -29,7 +29,7 @@ #include #include -#include +#include #include // g_hostInterfaces, postInitCalls_t #include @@ -923,7 +923,7 @@ errlHndl_t RtPnor::getMasterProcId() TRACFCOMP(g_trac_pnor, "RtPnor::getMasterProcId: queryMasterProcChipTargetHandle failed"); break; } - l_err = RT_TARG::getRtTarget(l_masterProc, iv_masterProcId); + l_err = TARGETING::getRtTarget(l_masterProc, iv_masterProcId); if (l_err) { TRACFCOMP(g_trac_pnor, "RtPnor::getMasterProcId: getRtTarget failed for master proc"); diff --git a/src/usr/runtime/customize_attrs_for_payload.C b/src/usr/runtime/customize_attrs_for_payload.C index 69dfc3dfb..273596b12 100644 --- a/src/usr/runtime/customize_attrs_for_payload.C +++ b/src/usr/runtime/customize_attrs_for_payload.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2019 */ +/* Contributors Listed Below - COPYRIGHT 2012,2020 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -36,10 +36,10 @@ #include #include #include +#include #include #include #include -#include #include #include #include @@ -110,7 +110,7 @@ errlHndl_t createProcNotFoundError( */ errlHndl_t computeNonPhypRtTarget( const TARGETING::Target* i_pTarget, - RT_TARG::rtChipId_t& o_rtTargetId) + TARGETING::rtChipId_t& o_rtTargetId) { assert(i_pTarget != NULL); @@ -354,7 +354,7 @@ errlHndl_t computeNonPhypRtTarget( */ errlHndl_t getRtTypeForTarget( const TARGETING::Target* i_pTarget, - RT_TARG::rtChipId_t& o_rtType) + TARGETING::rtChipId_t& o_rtType) { assert(i_pTarget != NULL); diff --git a/src/usr/sbeio/runtime/rt_sbeio.C b/src/usr/sbeio/runtime/rt_sbeio.C index 360a144cd..1c95596a5 100644 --- a/src/usr/sbeio/runtime/rt_sbeio.C +++ b/src/usr/sbeio/runtime/rt_sbeio.C @@ -41,7 +41,7 @@ #include #include #include -#include +#include using namespace TARGETING; diff --git a/src/usr/sbeio/runtime/test/sbeioAttrOverrideTests.H b/src/usr/sbeio/runtime/test/sbeioAttrOverrideTests.H index d99acfe8b..5c58078c5 100644 --- a/src/usr/sbeio/runtime/test/sbeioAttrOverrideTests.H +++ b/src/usr/sbeio/runtime/test/sbeioAttrOverrideTests.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2017 */ +/* Contributors Listed Below - COPYRIGHT 2017,2020 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -27,7 +27,6 @@ #include #include -#include #include #include #include @@ -35,6 +34,7 @@ #include #include #include +#include #include #include @@ -173,8 +173,8 @@ public: } l_proc = procList[0]; - RT_TARG::rtChipId_t l_chipId = 0; - errlHndl_t l_err = RT_TARG::getRtTarget(l_proc, l_chipId); + TARGETING::rtChipId_t l_chipId = 0; + errlHndl_t l_err = TARGETING::getRtTarget(l_proc, l_chipId); if(nullptr != l_err) { diff --git a/src/usr/sbeio/runtime/test/sbeiotestRt.H b/src/usr/sbeio/runtime/test/sbeiotestRt.H index a2a4b1996..c91a663bb 100644 --- a/src/usr/sbeio/runtime/test/sbeiotestRt.H +++ b/src/usr/sbeio/runtime/test/sbeiotestRt.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2017,2018 */ +/* Contributors Listed Below - COPYRIGHT 2017,2020 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include @@ -88,7 +88,7 @@ class SbeMessagePassingRtTest : public CxxTest::TestSuite */ int initSbeMessagePassing(sbeMessage_t& o_request, sbeMessage_t& o_expected_response, - RT_TARG::rtChipId_t& o_chipId, + TARGETING::rtChipId_t& o_chipId, uint64_t& o_sbeCommAddr, runtimeInterfaces_t **o_rt_intf) { @@ -142,8 +142,8 @@ class SbeMessagePassingRtTest : public CxxTest::TestSuite TargetHandle_t proc = procList[0]; // Get the chip ID for the proc - RT_TARG::rtChipId_t o_chipId = 0; - errlHndl_t err = RT_TARG::getRtTarget(proc, o_chipId); + TARGETING::rtChipId_t o_chipId = 0; + errlHndl_t err = TARGETING::getRtTarget(proc, o_chipId); if(nullptr != err) { rc = -1; @@ -311,7 +311,7 @@ class SbeMessagePassingRtTest : public CxxTest::TestSuite * * @return Return Code O if Successful, otherwise not 0. */ - int checkResetSbeMessagePassingCFAM(RT_TARG::rtChipId_t i_procChipId, + int checkResetSbeMessagePassingCFAM(TARGETING::rtChipId_t i_procChipId, uint32_t i_checkMask = SBE_MSG_MASK) { // Test check / reset CFAM entry @@ -402,7 +402,7 @@ class SbeMessagePassingRtTest : public CxxTest::TestSuite "testSbeMessagePassingVersions"); sbeMessage_t l_request; sbeMessage_t l_expected_response; - RT_TARG::rtChipId_t chipId = 0; + TARGETING::rtChipId_t chipId = 0; uint64_t l_sbeCommAddr = 0; runtimeInterfaces_t *rt_intf = nullptr; @@ -501,7 +501,7 @@ class SbeMessagePassingRtTest : public CxxTest::TestSuite sbeMessage_t l_request; sbeMessage_t l_expected_response; - RT_TARG::rtChipId_t chipId = 0; + TARGETING::rtChipId_t chipId = 0; uint64_t l_sbeCommAddr = 0; runtimeInterfaces_t *rt_intf = nullptr; @@ -567,7 +567,7 @@ class SbeMessagePassingRtTest : public CxxTest::TestSuite sbeMessage_t l_request; sbeMessage_t l_expected_response; - RT_TARG::rtChipId_t chipId = 0; + TARGETING::rtChipId_t chipId = 0; uint64_t l_sbeCommAddr = 0; runtimeInterfaces_t *rt_intf = nullptr; @@ -741,7 +741,7 @@ class SbeMessagePassingRtTest : public CxxTest::TestSuite sbeMessage_t l_request; sbeMessage_t l_expected_response; - RT_TARG::rtChipId_t chipId = 0; + TARGETING::rtChipId_t chipId = 0; uint64_t l_sbeCommAddr = 0; runtimeInterfaces_t *rt_intf = nullptr; @@ -832,7 +832,7 @@ class SbeMessagePassingRtTest : public CxxTest::TestSuite sbeMessage_t l_request; sbeMessage_t l_expected_response; - RT_TARG::rtChipId_t chipId = 0; + TARGETING::rtChipId_t chipId = 0; uint64_t l_sbeCommAddr = 0; runtimeInterfaces_t *rt_intf = nullptr; @@ -984,7 +984,7 @@ class SbeMessagePassingRtTest : public CxxTest::TestSuite sbeMessage_t l_request; sbeMessage_t l_expected_response; - RT_TARG::rtChipId_t chipId = 0; + TARGETING::rtChipId_t chipId = 0; uint64_t l_sbeCommAddr = 0; runtimeInterfaces_t *rt_intf = nullptr; @@ -1142,7 +1142,7 @@ class SbeMessagePassingRtTest : public CxxTest::TestSuite sbeMessage_t l_request; sbeMessage_t l_expected_response; uint32_t l_hdrsSize = sizeof(sbeHeader_t) + sizeof(cmdHeader_t); - RT_TARG::rtChipId_t chipId = 0; + TARGETING::rtChipId_t chipId = 0; uint64_t l_sbeCommAddr = 0; runtimeInterfaces_t *rt_intf = nullptr; diff --git a/src/usr/scom/handleSpecialWakeup.C b/src/usr/scom/handleSpecialWakeup.C index 07bab3a1b..e202e9bdb 100644 --- a/src/usr/scom/handleSpecialWakeup.C +++ b/src/usr/scom/handleSpecialWakeup.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2018 */ +/* Contributors Listed Below - COPYRIGHT 2015,2020 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -37,7 +37,7 @@ #include #ifdef __HOSTBOOT_RUNTIME -#include +#include #include #endif // __HOSTBOOT_RUNTIME @@ -156,8 +156,8 @@ errlHndl_t callWakeupHyp(TARGETING::Target* i_target, ++pCore_it ) { // Runtime target id - RT_TARG::rtChipId_t rtTargetId = 0; - l_errl = RT_TARG::getRtTarget(*pCore_it, rtTargetId); + TARGETING::rtChipId_t rtTargetId = 0; + l_errl = TARGETING::getRtTarget(*pCore_it, rtTargetId); if(l_errl) { break; diff --git a/src/usr/scom/runtime/rt_scom.C b/src/usr/scom/runtime/rt_scom.C index eafc14790..4507b435f 100644 --- a/src/usr/scom/runtime/rt_scom.C +++ b/src/usr/scom/runtime/rt_scom.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2019 */ +/* Contributors Listed Below - COPYRIGHT 2013,2020 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include @@ -169,8 +169,8 @@ errlHndl_t sendScomToHyp(DeviceFW::OperationType i_opType, do { // Convert target to something Sapphire understands - RT_TARG::rtChipId_t target_id = 0; - l_err = RT_TARG::getRtTarget(i_target, + TARGETING::rtChipId_t target_id = 0; + l_err = TARGETING::getRtTarget(i_target, target_id); if(l_err) { diff --git a/src/usr/secureboot/runtime/rt_secureboot.C b/src/usr/secureboot/runtime/rt_secureboot.C index b1da0f878..c1608fa73 100644 --- a/src/usr/secureboot/runtime/rt_secureboot.C +++ b/src/usr/secureboot/runtime/rt_secureboot.C @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/usr/secureboot/runtime/test/testsecureboot_rt.H b/src/usr/secureboot/runtime/test/testsecureboot_rt.H index c15214759..5a690d3fa 100644 --- a/src/usr/secureboot/runtime/test/testsecureboot_rt.H +++ b/src/usr/secureboot/runtime/test/testsecureboot_rt.H @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include diff --git a/src/usr/targeting/common/common.mk b/src/usr/targeting/common/common.mk index 5c357f111..951aa8663 100644 --- a/src/usr/targeting/common/common.mk +++ b/src/usr/targeting/common/common.mk @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2011,2018 +# Contributors Listed Below - COPYRIGHT 2011,2020 # [+] International Business Machines Corp. # # @@ -64,4 +64,3 @@ COMMON_TARGETING_OBJS += ${TARGET_OBJS} COMMON_TARGETING_OBJS += ${PREDICATES_OBJS} COMMON_TARGETING_OBJS += ${ITERATORS_OBJS} COMMON_TARGETING_OBJS += ${OTHER_OBJS} - diff --git a/src/usr/targeting/common/hbrt_target.C b/src/usr/targeting/common/hbrt_target.C new file mode 100644 index 000000000..b91979922 --- /dev/null +++ b/src/usr/targeting/common/hbrt_target.C @@ -0,0 +1,101 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/targeting/common/hbrt_target.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2019,2020 */ +/* [+] 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 */ +#include +#include +#include +#include +#include +#ifdef __HOSTBOOT_MODULE +#include +#endif + +extern trace_desc_t* g_trac_hbrt; +using namespace TARGETING; + +namespace TARGETING +{ + +errlHndl_t getRtTarget( + const TARGETING::Target* i_pTarget, + rtChipId_t& o_rtTargetId) +{ + errlHndl_t pError = NULL; + + do + { + if(i_pTarget == TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL) + { + TARGETING::Target* masterProcChip = NULL; + TARGETING::targetService(). + masterProcChipTargetHandle(masterProcChip); + i_pTarget = masterProcChip; + } + + auto hbrtHypId = RUNTIME::HBRT_HYP_ID_UNKNOWN; + if( (!i_pTarget->tryGetAttr(hbrtHypId)) + || (hbrtHypId == RUNTIME::HBRT_HYP_ID_UNKNOWN)) + { + auto huid = get_huid(i_pTarget); + auto targetingTargetType = + i_pTarget->getAttr(); + TRACFCOMP(g_trac_targeting, ERR_MRK + "Targeting target type of 0x%08X not supported. " + "HUID: 0x%08X", + targetingTargetType, + huid); + /*@ + * @errortype + * @moduleid TARG_RT_GET_RT_TARGET + * @reasoncode TARG_RT_TARGET_TYPE_NOT_SUPPORTED + * @userdata1 Target's HUID + * @userdata2 target's targeting type + * @devdesc Targeting target's type not supported by runtime + * code + */ + pError = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_INFORMATIONAL, + TARGETING::TARG_RT_GET_RT_TARGET, + TARGETING::TARG_RT_TARGET_TYPE_NOT_SUPPORTED, + huid, + targetingTargetType +#ifdef __HOSTBOOT_MODULE + ,true); + + ERRORLOG::ErrlUserDetailsTarget(i_pTarget,"Targeting Target"). + addToLog(pError); +#else + ); // if not in hostboot code then skip last param of error log + // and do not create a user details section +#endif + } + + o_rtTargetId = hbrtHypId; + + } while(0); + + return pError; +} + +} \ No newline at end of file diff --git a/src/usr/targeting/hostboot_common.mk b/src/usr/targeting/hostboot_common.mk index 7be1449d7..4d10df929 100644 --- a/src/usr/targeting/hostboot_common.mk +++ b/src/usr/targeting/hostboot_common.mk @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2013,2016 +# Contributors Listed Below - COPYRIGHT 2013,2020 # [+] International Business Machines Corp. # # @@ -30,6 +30,9 @@ COMMON_TARGETING_MAKEFILE = ${COMMON_TARGETING_REL_PATH}/common.mk include ${COMMON_TARGETING_MAKEFILE} +# TODO: 248022 move this to common.mk when CMVC files are updated for fips +TARGET_OBJS += hbrt_target.o + VPATH += ${TARGETING_REL_PATH}/adapters VPATH += ${COMMON_TARGETING_REL_PATH} VPATH += ${addprefix ${COMMON_TARGETING_REL_PATH}/, ${COMMON_TARGETING_SUBDIRS}} diff --git a/src/usr/targeting/makefile b/src/usr/targeting/makefile index 56f29e51d..af1978f64 100644 --- a/src/usr/targeting/makefile +++ b/src/usr/targeting/makefile @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2011,2019 +# Contributors Listed Below - COPYRIGHT 2011,2020 # [+] International Business Machines Corp. # # diff --git a/src/usr/targeting/runtime/attrPlatOverride_rt.C b/src/usr/targeting/runtime/attrPlatOverride_rt.C index 752fa740a..3c805381c 100644 --- a/src/usr/targeting/runtime/attrPlatOverride_rt.C +++ b/src/usr/targeting/runtime/attrPlatOverride_rt.C @@ -24,7 +24,7 @@ /* IBM_PROLOG_END_TAG */ #include -#include +#include #include #include #include diff --git a/src/usr/targeting/runtime/makefile b/src/usr/targeting/runtime/makefile index 9d872cef7..eb1dd366e 100644 --- a/src/usr/targeting/runtime/makefile +++ b/src/usr/targeting/runtime/makefile @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2013,2019 +# Contributors Listed Below - COPYRIGHT 2013,2020 # [+] International Business Machines Corp. # # diff --git a/src/usr/targeting/runtime/rt_startup.C b/src/usr/targeting/runtime/rt_startup.C index 578750006..ed190f196 100644 --- a/src/usr/targeting/runtime/rt_startup.C +++ b/src/usr/targeting/runtime/rt_startup.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2018 */ +/* Contributors Listed Below - COPYRIGHT 2018,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -22,7 +22,7 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ -#include +#include #include #include #include diff --git a/src/usr/targeting/runtime/rt_targeting.C b/src/usr/targeting/runtime/rt_targeting.C index 581386985..28c1fdf7d 100644 --- a/src/usr/targeting/runtime/rt_targeting.C +++ b/src/usr/targeting/runtime/rt_targeting.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2018 */ +/* Contributors Listed Below - COPYRIGHT 2014,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include @@ -54,61 +54,6 @@ using namespace TARGETING; namespace RT_TARG { -errlHndl_t getRtTarget( - const TARGETING::Target* i_pTarget, - rtChipId_t& o_rtTargetId) -{ - errlHndl_t pError = NULL; - - do - { - if(i_pTarget == TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL) - { - TARGETING::Target* masterProcChip = NULL; - TARGETING::targetService(). - masterProcChipTargetHandle(masterProcChip); - i_pTarget = masterProcChip; - } - - auto hbrtHypId = RUNTIME::HBRT_HYP_ID_UNKNOWN; - if( (!i_pTarget->tryGetAttr(hbrtHypId)) - || (hbrtHypId == RUNTIME::HBRT_HYP_ID_UNKNOWN)) - { - auto huid = get_huid(i_pTarget); - auto targetingTargetType = - i_pTarget->getAttr(); - TRACFCOMP(g_trac_targeting, ERR_MRK - "Targeting target type of 0x%08X not supported. " - "HUID: 0x%08X", - targetingTargetType, - huid); - /*@ - * @errortype - * @moduleid TARG_RT_GET_RT_TARGET - * @reasoncode TARG_RT_TARGET_TYPE_NOT_SUPPORTED - * @userdata1 Target's HUID - * @userdata2 target's targeting type - * @devdesc Targeting target's type not supported by runtime - * code - */ - pError = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_INFORMATIONAL, - TARGETING::TARG_RT_GET_RT_TARGET, - TARGETING::TARG_RT_TARGET_TYPE_NOT_SUPPORTED, - huid, - targetingTargetType, - true); - - ERRORLOG::ErrlUserDetailsTarget(i_pTarget,"Targeting Target"). - addToLog(pError); - } - - o_rtTargetId = hbrtHypId; - - } while(0); - - return pError; -} /** * @brief API documentation same as for getHbTarget; this just implements the diff --git a/src/usr/targeting/runtime/test/testtargeting.H b/src/usr/targeting/runtime/test/testtargeting.H index 5dbd3f15e..c6c7c0d60 100644 --- a/src/usr/targeting/runtime/test/testtargeting.H +++ b/src/usr/targeting/runtime/test/testtargeting.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2019 */ +/* Contributors Listed Below - COPYRIGHT 2013,2020 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -62,7 +62,7 @@ class TargetingTestSuite : public CxxTest::TestSuite { using namespace TARGETING; errlHndl_t err = NULL; - RT_TARG::rtChipId_t rt_chipid; + TARGETING::rtChipId_t rt_chipid; TARGETING::TargetHandleList allTargets; TARGETING::TargetHandleList targetList; @@ -91,7 +91,7 @@ class TargetingTestSuite : public CxxTest::TestSuite for(TargetHandleList::iterator pTarg = allTargets.begin(); pTarg != allTargets.end(); ++pTarg) { - err = RT_TARG::getRtTarget(*pTarg, rt_chipid); + err = TARGETING::getRtTarget(*pTarg, rt_chipid); if( err ) { TS_FAIL("getRtTarget returned error log"); diff --git a/src/usr/util/runtime/rt_fwnotify.C b/src/usr/util/runtime/rt_fwnotify.C index 148d3bbeb..556a1c31f 100644 --- a/src/usr/util/runtime/rt_fwnotify.C +++ b/src/usr/util/runtime/rt_fwnotify.C @@ -31,7 +31,7 @@ #include // errlCommit #include // TWO_UINT32_TO_UINT64 #include // TargetHandle_t, getTargetFromHuid -#include // RT_TARG::getHbTarget +#include // RT_TARG::getHbTarget #include // ATTRIBUTE_ID #ifdef CONFIG_NVDIMM diff --git a/src/usr/vpd/runtime/rt_vpd.C b/src/usr/vpd/runtime/rt_vpd.C index ba0335484..ee7fa9f7b 100644 --- a/src/usr/vpd/runtime/rt_vpd.C +++ b/src/usr/vpd/runtime/rt_vpd.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2018 */ +/* Contributors Listed Below - COPYRIGHT 2013,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -34,7 +34,7 @@ #include // firmware_request_helper #include #include -#include +#include #include #include -- cgit v1.2.1