diff options
| author | Roland Veloz <rveloz@us.ibm.com> | 2017-10-10 10:55:09 -0500 |
|---|---|---|
| committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2017-12-20 17:47:47 -0500 |
| commit | a69cb64611f39c3320e71a025cc612690305926d (patch) | |
| tree | debcc9b99e0c0f0fc5fafa47c9f0efbb20c38765 /src | |
| parent | f0db3bed83349756e9182077b02c1c73e473a569 (diff) | |
| download | blackbird-hostboot-a69cb64611f39c3320e71a025cc612690305926d.tar.gz blackbird-hostboot-a69cb64611f39c3320e71a025cc612690305926d.zip | |
Adding support for TOD RAS on FSP systems
Moved the TOD files from directory /hostboot/src/usr/isteps/istep18
into a new TOD directory - /hostboot/src/usr/isteps/tod. Created a tod
library from the files within the new TOD directory. Added a runtime
directory underneath the tod directory. Created the rt_todintf.C file
which contains the two newly added interfaces -
readTodProcDataFromFile and resetBackupTopology.
Change-Id: I68c9edcd8f59adf9a2cf1f1f3fff07fea2d94e99
RTC:171490
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/48188
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/include/runtime/interface.h | 1 | ||||
| -rw-r--r-- | src/include/usr/isteps/istep18list.H | 3 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/include/usr/isteps/tod/TodTypes.H (renamed from src/usr/isteps/istep18/TodTypes.H) | 14 | ||||
| -rw-r--r-- | src/include/usr/isteps/tod/runtime/rt_todintf.H | 77 | ||||
| -rw-r--r-- | src/include/usr/isteps/tod_init_reasoncodes.H | 5 | ||||
| -rw-r--r-- | src/include/usr/mbox/mbox_queues.H | 10 | ||||
| -rw-r--r-- | src/makefile | 2 | ||||
| -rw-r--r-- | src/usr/isteps/istep18/call_tod_init.C | 4 | ||||
| -rw-r--r-- | src/usr/isteps/istep18/call_tod_setup.C | 4 | ||||
| -rw-r--r-- | src/usr/isteps/istep18/makefile | 9 | ||||
| -rw-r--r-- | src/usr/isteps/makefile | 1 | ||||
| -rw-r--r-- | src/usr/isteps/pm/runtime/test/firmwareRequestTest.H | 1 | ||||
| -rw-r--r-- | src/usr/isteps/tod/TodAssert.H (renamed from src/usr/isteps/istep18/TodAssert.H) | 2 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/usr/isteps/tod/TodControls.C (renamed from src/usr/isteps/istep18/TodControls.C) | 17 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/usr/isteps/tod/TodControls.H (renamed from src/usr/isteps/istep18/TodControls.H) | 25 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/usr/isteps/tod/TodDrawer.C (renamed from src/usr/isteps/istep18/TodDrawer.C) | 2 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/usr/isteps/tod/TodDrawer.H (renamed from src/usr/isteps/istep18/TodDrawer.H) | 2 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/usr/isteps/tod/TodHwpIntf.C (renamed from src/usr/isteps/istep18/TodHwpIntf.C) | 2 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/usr/isteps/tod/TodHwpIntf.H (renamed from src/usr/isteps/istep18/TodHwpIntf.H) | 2 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/usr/isteps/tod/TodProc.C (renamed from src/usr/isteps/istep18/TodProc.C) | 4 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/usr/isteps/tod/TodProc.H (renamed from src/usr/isteps/istep18/TodProc.H) | 10 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/usr/isteps/tod/TodSvc.C (renamed from src/usr/isteps/istep18/TodSvc.C) | 6 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/usr/isteps/tod/TodSvc.H (renamed from src/usr/isteps/istep18/TodSvc.H) | 2 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/usr/isteps/tod/TodSvcUtil.C (renamed from src/usr/isteps/istep18/TodSvcUtil.C) | 8 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/usr/isteps/tod/TodSvcUtil.H (renamed from src/usr/isteps/istep18/TodSvcUtil.H) | 2 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/usr/isteps/tod/TodTopologyManager.C (renamed from src/usr/isteps/istep18/TodTopologyManager.C) | 12 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/usr/isteps/tod/TodTopologyManager.H (renamed from src/usr/isteps/istep18/TodTopologyManager.H) | 2 | ||||
| -rw-r--r-- | src/usr/isteps/tod/TodTrace.H (renamed from src/usr/isteps/istep18/TodTrace.H) | 2 | ||||
| -rw-r--r-- | src/usr/isteps/tod/TodUtils.C (renamed from src/usr/isteps/istep18/TodUtils.C) | 11 | ||||
| -rw-r--r-- | src/usr/isteps/tod/TodUtils.H (renamed from src/usr/isteps/istep18/TodUtils.H) | 2 | ||||
| -rw-r--r-- | src/usr/isteps/tod/makefile | 39 | ||||
| -rw-r--r-- | src/usr/isteps/tod/runtime/makefile | 37 | ||||
| -rw-r--r-- | src/usr/isteps/tod/runtime/rt_todintf.C | 753 | ||||
| -rw-r--r-- | src/usr/isteps/tod/tod.mk | 43 | ||||
| -rw-r--r-- | src/usr/targeting/runtime/makefile | 1 |
35 files changed, 1048 insertions, 69 deletions
diff --git a/src/include/runtime/interface.h b/src/include/runtime/interface.h index 8aad5d5fb..96eb62c2c 100644 --- a/src/include/runtime/interface.h +++ b/src/include/runtime/interface.h @@ -554,6 +554,7 @@ typedef struct hostInterfaces // HBRT_FW_MSG_HBRT_FSP_RESP // This struct sends/receives an MBox message to the FSP struct GenericFspMboxMessage_t generic_msg; + }; // end union }; // end struct hbrt_fw_msg diff --git a/src/include/usr/isteps/istep18list.H b/src/include/usr/isteps/istep18list.H index 5d31c9048..81cd3b171 100644 --- a/src/include/usr/isteps/istep18list.H +++ b/src/include/usr/isteps/istep18list.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2016 */ +/* Contributors Listed Below - COPYRIGHT 2012,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -142,6 +142,7 @@ namespace INITSERVICE const DepModInfo g_istep18Dependancies = { { #ifndef CONFIG_VPO_COMPILE + DEP_LIB(libtod.so), DEP_LIB(libistep18.so), #endif NULL diff --git a/src/usr/isteps/istep18/TodTypes.H b/src/include/usr/isteps/tod/TodTypes.H index b4750ce22..66e3e3c33 100755..100644 --- a/src/usr/isteps/istep18/TodTypes.H +++ b/src/include/usr/isteps/tod/TodTypes.H @@ -1,11 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/usr/isteps/istep18/TodTypes.H $ */ +/* $Source: src/include/usr/isteps/tod/TodTypes.H $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ +/* Contributors Listed Below - COPYRIGHT 2016,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -40,6 +40,16 @@ namespace TOD { +//------------------------------------------------------------------------------ +//Forward declarations +//------------------------------------------------------------------------------ +struct TodChipData; + +//------------------------------------------------------------------------------ +//Typedefs +//------------------------------------------------------------------------------ +typedef std::vector<TodChipData> TodChipDataContainer; + /** * Enums for the TodChipHeader->flags, These values are defined as per * details provided by HDAT data structure details provided by HDAT diff --git a/src/include/usr/isteps/tod/runtime/rt_todintf.H b/src/include/usr/isteps/tod/runtime/rt_todintf.H new file mode 100644 index 000000000..b79e24c1c --- /dev/null +++ b/src/include/usr/isteps/tod/runtime/rt_todintf.H @@ -0,0 +1,77 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/isteps/tod/runtime/rt_todintf.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014,2017 */ +/* [+] 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 __RUNTIME__TOD_INTERFACE_H +#define __RUNTIME__TOD_INTERFACE_H + +#include <errl/errlentry.H> // errlHndl_t +#include <targeting/common/target.H> // TARGETING::TargetHandleList +#include <isteps/tod/TodTypes.H> // TodChipDataContainer + +/** + * @file rt_todintf.H + * + * @brief TOD FSP interfaces + * + * + */ + +namespace TOD +{ + +/** + * @brief This interface creates a new backup TOD topology. This request + * is sent to the FSP for resetting the backup topology. + * + * @param[in] i_oscPos the ordinal ID of the failing OSC. Value of + * 0xFFFFFFFF means no OSC to avoid. + * @param[in] i_procOscTgt target of the processor with which the failing OSC + * is associated with. If ordinal ID is 0xFFFFFFFF then this should + * be NULL, otherwise provide a valid target. If ordinal ID is + * 0xFFFFFFFF, i_procOscTgt is ignored regardless of it's validity. + * @param[in] i_badChipList input list of targets. + * @param[in] i_informPhyp flag to inform the PHYP that it won't have a + * backup available for fail over while we are re-configuring it. + * + * @return Error log handle indicating the status of the request + */ +errlHndl_t resetBackupTopology( + uint32_t i_oscPos, + const TARGETING::TargetHandle_t& i_procOscTgt, + const TARGETING::TargetHandleList& i_badChipList, + bool i_informPhyp); + +/** + * @brief This interface returns the TOD topology data for analysis + * + * @param[out] o_todChipData container that holds the processor data + * + * @return Error log handle indicating the status of the request + */ +errlHndl_t readTodProcDataFromFile(TodChipDataContainer& o_todChipData); + +} // end namespace TOD + +#endif // end __RUNTIME__TOD_INTERFACE_H + diff --git a/src/include/usr/isteps/tod_init_reasoncodes.H b/src/include/usr/isteps/tod_init_reasoncodes.H index 9dc996a51..9580e890b 100644 --- a/src/include/usr/isteps/tod_init_reasoncodes.H +++ b/src/include/usr/isteps/tod_init_reasoncodes.H @@ -63,6 +63,8 @@ namespace TOD TOD_UTIL_MOD_GET_PARENT = 0x1C, TOD_MOD_LOG_UNSUPPORTED_BUSTYPE = 0x1D, TOD_IS_MPIPL = 0x1E, + TOD_RT_TOPOLOGY_RESET_BACKUP = 0x1F, + TOD_RT_TOPOLOGY_DATA = 0x20, }; enum TODReasonCode @@ -91,6 +93,9 @@ namespace TOD TOD_PARENT_NOT_FOUND = TOD_COMP_ID | 0x17, TOD_DRAWER_SET_MDMT = TOD_COMP_ID | 0x18, TOD_TOP_LEVEL_TARGET_NOT_FOUND = TOD_COMP_ID | 0x19, + TOD_RT_NULL_FIRMWARE_REQUEST_PTR = TOD_COMP_ID | 0x1A, + TOD_RT_TOPOLOGY_RESET_BACKUP_ERR = TOD_COMP_ID | 0x1B, + TOD_RT_TOPOLOGY_DATA_ERR = TOD_COMP_ID | 0x1C, }; enum TODUserDetailDataSubSection diff --git a/src/include/usr/mbox/mbox_queues.H b/src/include/usr/mbox/mbox_queues.H index 91600e964..1f211eaf8 100644 --- a/src/include/usr/mbox/mbox_queues.H +++ b/src/include/usr/mbox/mbox_queues.H @@ -73,6 +73,7 @@ namespace MBOX FSP_HWPF_ATTR_MSGQ = 0x8000000B, // HWPF Attribute override/sync FSP_VPD_MSGQ = 0x8000000C, FSP_PRD_SYNC_MSGQ_ID = 0x8000000D, + FSP_TOD_MSGQ = 0x8000000E, FSP_SBE_SYNC_MSGQ_ID = 0x8000000F, FSP_LID_MSGQ = FSP_ATTR_SYNC_MSGQ, @@ -80,8 +81,9 @@ namespace MBOX FSP_ECHO_MSGQ = 0xFFFFFFFF, // Fake FSP for test }; - // Message types are only unique with in each message queue. Each message queue can - // use the entire range limited only by the restrictions listed below. + // Message types are only unique with in each message queue. Each message + // queue can use the entire range limited only by the restrictions listed + // below. // // Each HB and FSP service will need it's own list of message types // Not sure where they belong. @@ -89,8 +91,8 @@ namespace MBOX // types 0x00000000 - 0x3FFFFFFF are considered secure messages // and are disabled when under SecureBoot environment // types 0x40000000 - 0x7FFFFFFF can be done at anytime - // types 0x80000000 - 0xFFFFFFFF are reserved on hostboot for kernel services - // This means hostboot services can't use them, but this is not a restriction + // types 0x80000000 - 0xFFFFFFFF are reserved on HB for kernel services + // This means HB services can't use them, but this is not a restriction // on FSP services enum { diff --git a/src/makefile b/src/makefile index 337bbd630..d8498bd1e 100644 --- a/src/makefile +++ b/src/makefile @@ -202,6 +202,7 @@ EXTENDED_MODULES += p9_cpuWkup EXTENDED_MODULES += p9_phbPerst EXTENDED_MODULES += $(if $(CONFIG_ENABLE_HDAT_IN_HOSTBOOT),hdat) EXTENDED_MODULES += $(if $(CONFIG_SECUREBOOT),secureboot_ext) +EXTENDED_MODULES += tod #*************************************** # Working test modules @@ -285,6 +286,7 @@ RUNTIME_MODULES += secureboot_rt RUNTIME_MODULES += p9_cpuWkup RUNTIME_MODULES += fsi_rt RUNTIME_MODULES += sbeio_rt +RUNTIME_MODULES += tod_rt RUNTIME_DATA_MODULES += RUNTIME_TESTCASE_MODULES += cxxtest_rt diff --git a/src/usr/isteps/istep18/call_tod_init.C b/src/usr/isteps/istep18/call_tod_init.C index 7b8391a92..e2e004a84 100644 --- a/src/usr/isteps/istep18/call_tod_init.C +++ b/src/usr/isteps/istep18/call_tod_init.C @@ -41,8 +41,8 @@ #include <initservice/initserviceif.H> #include <isteps/hwpisteperror.H> -#include "TodTrace.H" -#include "TodSvc.H" +#include <tod/TodTrace.H> +#include <tod/TodSvc.H> using namespace ISTEP_ERROR; diff --git a/src/usr/isteps/istep18/call_tod_setup.C b/src/usr/isteps/istep18/call_tod_setup.C index 4624d14c5..37264a9fa 100644 --- a/src/usr/isteps/istep18/call_tod_setup.C +++ b/src/usr/isteps/istep18/call_tod_setup.C @@ -41,8 +41,8 @@ #include <initservice/initserviceif.H> #include <isteps/hwpisteperror.H> -#include "TodTrace.H" -#include "TodSvc.H" +#include <tod/TodTrace.H> +#include <tod/TodSvc.H> using namespace ISTEP_ERROR; diff --git a/src/usr/isteps/istep18/makefile b/src/usr/isteps/istep18/makefile index ea260c4cc..d1add9dfe 100644 --- a/src/usr/isteps/istep18/makefile +++ b/src/usr/isteps/istep18/makefile @@ -33,19 +33,12 @@ EXTRAINCDIR += ${ROOTPATH}/src/import/hwpf/fapi2/include EXTRAINCDIR += ${ROOTPATH}/src/include/usr/fapi2 EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/utils/imageProcs EXTRAINCDIR += ${ROOTPATH}/src/import/chips/common/utils/imageProcs +EXTRAINCDIR += ${ROOTPATH}/src/usr/isteps ## pointer to common HWP files OBJS += call_tod_init.o OBJS += call_tod_setup.o -OBJS += TodControls.o -OBJS += TodDrawer.o -OBJS += TodProc.o -OBJS += TodSvc.o -OBJS += TodUtils.o -OBJS += TodSvcUtil.o -OBJS += TodHwpIntf.o -OBJS += TodTopologyManager.o include ${ROOTPATH}/procedure.rules.mk include ${PROCEDURES_PATH}/p9_tod_init.mk diff --git a/src/usr/isteps/makefile b/src/usr/isteps/makefile index f9141226c..1d5e61874 100644 --- a/src/usr/isteps/makefile +++ b/src/usr/isteps/makefile @@ -45,6 +45,7 @@ SUBDIRS+=mss.d SUBDIRS+=cen.d SUBDIRS+=cpuWkup.d SUBDIRS+=p9_phbPerst.d +SUBDIRS+=tod.d OBJS += hwpisteperror.o OBJS += hwpistepud.o diff --git a/src/usr/isteps/pm/runtime/test/firmwareRequestTest.H b/src/usr/isteps/pm/runtime/test/firmwareRequestTest.H index ef76df655..01085dbae 100644 --- a/src/usr/isteps/pm/runtime/test/firmwareRequestTest.H +++ b/src/usr/isteps/pm/runtime/test/firmwareRequestTest.H @@ -348,5 +348,4 @@ class FirmwareRequestTest : public CxxTest::TestSuite "FirmwareRequestTest::testFirmwareRequestHbrtToFsp"); } // end testFirmwareRequestHbrtToFsp - }; // end class FirmwareRequestTest diff --git a/src/usr/isteps/istep18/TodAssert.H b/src/usr/isteps/tod/TodAssert.H index 36f0ce744..1fa1b7f20 100644 --- a/src/usr/isteps/istep18/TodAssert.H +++ b/src/usr/isteps/tod/TodAssert.H @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/usr/isteps/istep18/TodAssert.H $ */ +/* $Source: src/usr/isteps/tod/TodAssert.H $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ diff --git a/src/usr/isteps/istep18/TodControls.C b/src/usr/isteps/tod/TodControls.C index e30844966..51121dd0d 100755..100644 --- a/src/usr/isteps/istep18/TodControls.C +++ b/src/usr/isteps/tod/TodControls.C @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/usr/isteps/istep18/TodControls.C $ */ +/* $Source: src/usr/isteps/tod/TodControls.C $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ @@ -38,7 +38,6 @@ #include "TodDrawer.H" #include "TodSvcUtil.H" #include "TodControls.H" -#include "TodTypes.H" #include "TodTrace.H" #include "TodUtils.H" #include <devicefw/userif.H> @@ -436,8 +435,8 @@ errlHndl_t TodControls::buildTodDrawers( } // end node list loop - //Validate that we had at least one TOD drawer at the end of this process - //else generate an error + //Validate that we had at least one TOD drawer at the end of this + // process else generate an error if (iv_todConfig[i_config].iv_todDrawerList.empty()) { TOD_ERR("No TOD drawer could be built for the configuration " @@ -975,6 +974,7 @@ errlHndl_t TodControls :: writeTodProcData( } } + //See if the current proc chip is MDMT of the secondary //network //Note: The chip can be theoretically both primary and @@ -1770,7 +1770,8 @@ errlHndl_t buildGardedTargetsList() void setConfigStatus(const p9_tod_setup_tod_sel i_config, const bool i_isConfigured ) { - Singleton<TodControls>::instance().setConfigStatus(i_config, i_isConfigured); + Singleton<TodControls>::instance().setConfigStatus(i_config, + i_isConfigured); } // Wrapper function for TodControls::getConfiguredMdmt instance @@ -1811,4 +1812,10 @@ void setMdmtOfActiveConfig(const p9_tod_setup_tod_sel i_config, i_proc, i_drawer); } +// Wrapper function for TodControls::getConfigStatus instance +bool getConfigStatus(const p9_tod_setup_tod_sel i_config) +{ + return Singleton<TodControls>::instance().getConfigStatus(i_config); +} + }//end of namespace diff --git a/src/usr/isteps/istep18/TodControls.H b/src/usr/isteps/tod/TodControls.H index c17526667..7caf21ac8 100755..100644 --- a/src/usr/isteps/istep18/TodControls.H +++ b/src/usr/isteps/tod/TodControls.H @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/usr/isteps/istep18/TodControls.H $ */ +/* $Source: src/usr/isteps/tod/TodControls.H $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ @@ -44,6 +44,7 @@ #include "TodSvcUtil.H" #include "TodAssert.H" #include "TodTrace.H" +#include <isteps/tod/TodTypes.H> namespace TOD { @@ -54,14 +55,12 @@ namespace TOD class TodDrawer; class TodProc; class TodControls; -struct TodChipData; //------------------------------------------------------------------------------ //Typedefs //------------------------------------------------------------------------------ //Use "thesTodControls_t::Instance()" to access the singleton via reference typedef Singleton<TodControls> theTodControls_t; -typedef std::vector<TodChipData> TodChipDataContainer; typedef std::vector<TARGETING::ConstTargetHandle_t> BlacListedProcContainer; typedef std::vector<TARGETING::ConstTargetHandle_t> @@ -732,7 +731,6 @@ private: //Black listed processors that should not be considered as MDMT BlacListedProcContainer iv_BlackListedProcs; - //List of garded targets on the system GardedTargetsContainer iv_gardedTargets; @@ -762,14 +760,14 @@ private: * */ struct GardedUnit_t{ - TARGETING::ATTR_HUID_type iv_huid; //HUID of garded unit - TARGETING::ATTR_HUID_type iv_nodeHuid; //Node containing the unit - uint32_t iv_errlogId; //Garded Error log - HWAS::GARD_ErrorType iv_errType; //Type of gard error - TARGETING::CDM_DOMAIN iv_domain; //CDM Domain of the unit - TARGETING::ATTR_TYPE_type iv_type; //Type of the unit - TARGETING::ATTR_CLASS_type iv_class; //Class of the unit - uint32_t iv_rid; //RID of the unit + TARGETING::ATTR_HUID_type iv_huid; //HUID of garded unit + TARGETING::ATTR_HUID_type iv_nodeHuid; //Node containing the unit + uint32_t iv_errlogId; //Garded Error log + HWAS::GARD_ErrorType iv_errType; //Type of gard error + TARGETING::CDM_DOMAIN iv_domain; //CDM Domain of the unit + TARGETING::ATTR_TYPE_type iv_type; //Type of the unit + TARGETING::ATTR_CLASS_type iv_class; //Class of the unit + uint32_t iv_rid; //RID of the unit NagUpdateAction iv_nagDisabled; // Default to NAG enable GardedUnit_t() : iv_huid(TOD_HUID_INVALID), iv_nodeHuid(TOD_HUID_INVALID), @@ -930,6 +928,9 @@ void setMdmtOfActiveConfig(const p9_tod_setup_tod_sel i_config, TodProc* i_proc, TodDrawer* i_drawer); +// Wrapper function for TodControls::getConfigStatus instance +bool getConfigStatus(const p9_tod_setup_tod_sel i_config); + } //end of namespace #endif //TODCONTROLS_H diff --git a/src/usr/isteps/istep18/TodDrawer.C b/src/usr/isteps/tod/TodDrawer.C index 4c6335bf4..567e30b5e 100755..100644 --- a/src/usr/isteps/istep18/TodDrawer.C +++ b/src/usr/isteps/tod/TodDrawer.C @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/usr/isteps/istep18/TodDrawer.C $ */ +/* $Source: src/usr/isteps/tod/TodDrawer.C $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ diff --git a/src/usr/isteps/istep18/TodDrawer.H b/src/usr/isteps/tod/TodDrawer.H index 2fbef6487..c574e6593 100755..100644 --- a/src/usr/isteps/istep18/TodDrawer.H +++ b/src/usr/isteps/tod/TodDrawer.H @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/usr/isteps/istep18/TodDrawer.H $ */ +/* $Source: src/usr/isteps/tod/TodDrawer.H $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ diff --git a/src/usr/isteps/istep18/TodHwpIntf.C b/src/usr/isteps/tod/TodHwpIntf.C index 6fede2578..b20e42d7c 100755..100644 --- a/src/usr/isteps/istep18/TodHwpIntf.C +++ b/src/usr/isteps/tod/TodHwpIntf.C @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/usr/isteps/istep18/TodHwpIntf.C $ */ +/* $Source: src/usr/isteps/tod/TodHwpIntf.C $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ diff --git a/src/usr/isteps/istep18/TodHwpIntf.H b/src/usr/isteps/tod/TodHwpIntf.H index 88dbbe4da..b4f574257 100755..100644 --- a/src/usr/isteps/istep18/TodHwpIntf.H +++ b/src/usr/isteps/tod/TodHwpIntf.H @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/usr/isteps/istep18/TodHwpIntf.H $ */ +/* $Source: src/usr/isteps/tod/TodHwpIntf.H $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ diff --git a/src/usr/isteps/istep18/TodProc.C b/src/usr/isteps/tod/TodProc.C index 93246762f..51860b441 100755..100644 --- a/src/usr/isteps/istep18/TodProc.C +++ b/src/usr/isteps/tod/TodProc.C @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/usr/isteps/istep18/TodProc.C $ */ +/* $Source: src/usr/isteps/tod/TodProc.C $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ @@ -42,7 +42,7 @@ #include <isteps/tod_init_reasoncodes.H> #include "TodDrawer.H" #include "TodProc.H" -#include "TodTypes.H" +#include <isteps/tod/TodTypes.H> #include "TodControls.H" #include <hwas/common/deconfigGard.H> #include "TodAssert.H" diff --git a/src/usr/isteps/istep18/TodProc.H b/src/usr/isteps/tod/TodProc.H index 39af8601b..a89d445cb 100755..100644 --- a/src/usr/isteps/istep18/TodProc.H +++ b/src/usr/isteps/tod/TodProc.H @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/usr/isteps/istep18/TodProc.H $ */ +/* $Source: src/usr/isteps/tod/TodProc.H $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ @@ -38,7 +38,6 @@ //------------------------------------------------------------------------------ //HWPF - For TOD constants #include <p9_tod_utils.H> -#include "TodTypes.H" #include "TodSvcUtil.H" #include "TodAssert.H" @@ -125,13 +124,14 @@ class TodProc * @param[in] i_destination, Pointer to destination TodProc object * that has to be connected. * - * @param[in] i_busChipUnitType, Type of the bus (A/X) for which connection - * has to be determined + * @param[in] i_busChipUnitType, Type of the bus (A/X) for which + * connection has to be determined * * @param[out] o_isConnected, this parameter will be set to true if * source and destination connect over the specified bus type. Before * looking for o_isConnected the caller should check for returned error - * log handle and only if it is NULL o_isConnected should be considered. + * log handle and only if it is NULL o_isConnected should be + * considered. * * @return Error log handle, indicates status of request * @retval NULL indicates that connect method's algorithm executed diff --git a/src/usr/isteps/istep18/TodSvc.C b/src/usr/isteps/tod/TodSvc.C index 85e89a911..543eb93d1 100755..100644 --- a/src/usr/isteps/istep18/TodSvc.C +++ b/src/usr/isteps/tod/TodSvc.C @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/usr/isteps/istep18/TodSvc.C $ */ +/* $Source: src/usr/isteps/tod/TodSvc.C $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ @@ -521,8 +521,8 @@ errlHndl_t TodSvc::setActiveMdmtForResetBackup( * @errortype * @moduleid TOD_FIND_MASTER_PROC * @reasoncode TOD_MASTER_TARGET_NOT_FOUND - * @userdata1[32:64] 1 = Master proc was not found , zero otherwise - * @userdata1[32:63] 1 = Master drawer was not found, zero otherwise + * @userdata1[32:64] 1 = Master proc was not found , zero otherwise + * @userdata1[32:63] 1 = Master drawer was not found, zero otherwise * @userdata2[0:31] EMOD_TOD_SET_ACTIVE_MDMT * @userdata2[32:64] Active topology * @devdesc Either processor or drawer object was not found for diff --git a/src/usr/isteps/istep18/TodSvc.H b/src/usr/isteps/tod/TodSvc.H index 26366ba15..c935eac06 100755..100644 --- a/src/usr/isteps/istep18/TodSvc.H +++ b/src/usr/isteps/tod/TodSvc.H @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/usr/isteps/istep18/TodSvc.H $ */ +/* $Source: src/usr/isteps/tod/TodSvc.H $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ diff --git a/src/usr/isteps/istep18/TodSvcUtil.C b/src/usr/isteps/tod/TodSvcUtil.C index 522962925..84061181e 100755..100644 --- a/src/usr/isteps/istep18/TodSvcUtil.C +++ b/src/usr/isteps/tod/TodSvcUtil.C @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/usr/isteps/istep18/TodSvcUtil.C $ */ +/* $Source: src/usr/isteps/tod/TodSvcUtil.C $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ @@ -193,10 +193,8 @@ uint32_t getMaxProcsOnSystem() uint32_t l_maxProcCount = 0; if (!l_errHdl ) { - //FIX_ME: need to find out how to populate this variable - //l_maxProcCount = l_maxCfgParams.max_compute_nodes_per_sys * - l_maxProcCount = - l_maxCfgParams.max_procchips_per_node; + l_maxProcCount = l_maxCfgParams.max_compute_nodes_per_sys * + l_maxCfgParams.max_procchips_per_node; TOD_INF("Maximum procs on system = 0x%08X", l_maxProcCount); } else diff --git a/src/usr/isteps/istep18/TodSvcUtil.H b/src/usr/isteps/tod/TodSvcUtil.H index 302d62d8c..32a09a0da 100755..100644 --- a/src/usr/isteps/istep18/TodSvcUtil.H +++ b/src/usr/isteps/tod/TodSvcUtil.H @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/usr/isteps/istep18/TodSvcUtil.H $ */ +/* $Source: src/usr/isteps/tod/TodSvcUtil.H $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ diff --git a/src/usr/isteps/istep18/TodTopologyManager.C b/src/usr/isteps/tod/TodTopologyManager.C index 63e2e290a..dd53a39f1 100755..100644 --- a/src/usr/isteps/istep18/TodTopologyManager.C +++ b/src/usr/isteps/tod/TodTopologyManager.C @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/usr/isteps/istep18/TodTopologyManager.C $ */ +/* $Source: src/usr/isteps/tod/TodTopologyManager.C $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ @@ -555,11 +555,11 @@ void TodTopologyManager::dumpTopology() const while(l_childList.end() != l_childItr) { TOD_INF("TOPOLOGY DUMP> 0x%08X---%s---%s---0x%08X", - (*l_procItr)->getTarget()->getAttr<TARGETING::ATTR_HUID>(), - busnames[(*l_childItr)->getBusIn()], - busnames[(*l_childItr)->getBusOut()], - (*l_childItr)->getTarget()->getAttr<TARGETING::ATTR_HUID>()); - ++l_childItr; + (*l_procItr)->getTarget()->getAttr<TARGETING::ATTR_HUID>(), + busnames[(*l_childItr)->getBusIn()], + busnames[(*l_childItr)->getBusOut()], + (*l_childItr)->getTarget()->getAttr<TARGETING::ATTR_HUID>()); + ++l_childItr; } ++l_procItr; } diff --git a/src/usr/isteps/istep18/TodTopologyManager.H b/src/usr/isteps/tod/TodTopologyManager.H index 7c992775a..dfd653c92 100755..100644 --- a/src/usr/isteps/istep18/TodTopologyManager.H +++ b/src/usr/isteps/tod/TodTopologyManager.H @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/usr/isteps/istep18/TodTopologyManager.H $ */ +/* $Source: src/usr/isteps/tod/TodTopologyManager.H $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ diff --git a/src/usr/isteps/istep18/TodTrace.H b/src/usr/isteps/tod/TodTrace.H index 7aaa85ed9..b3ce42260 100644 --- a/src/usr/isteps/istep18/TodTrace.H +++ b/src/usr/isteps/tod/TodTrace.H @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/usr/isteps/istep18/TodTrace.H $ */ +/* $Source: src/usr/isteps/tod/TodTrace.H $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ diff --git a/src/usr/isteps/istep18/TodUtils.C b/src/usr/isteps/tod/TodUtils.C index df1709f7d..a1a1ede63 100644 --- a/src/usr/isteps/istep18/TodUtils.C +++ b/src/usr/isteps/tod/TodUtils.C @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/usr/isteps/istep18/TodUtils.C $ */ +/* $Source: src/usr/isteps/tod/TodUtils.C $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ @@ -161,6 +161,15 @@ errlHndl_t getMaxConfigParams( o_maxConfigParams.max_mcs_per_sys = l_pTopLevel->getAttr < TARGETING::ATTR_MAX_MCS_PER_SYSTEM > (); + // TODO RTC 181481: attribute ATTR_MAX_COMPUTE_NODES_PER_SYSTEM is + // currently not implemented as needed to do this assignment. I was + // assured (10/2017) that HB only supports one node, so I am defaulting + // this to 1. In the future HB will need to be multi-node aware and + // TARGETING::ATTR_MAX_COMPUTE_NODES_PER_SYSTEM implemented. + o_maxConfigParams.max_compute_nodes_per_sys = 1; +// o_maxConfigParams.max_compute_nodes_per_sys = l_pTopLevel->getAttr +// < TARGETING::ATTR_MAX_COMPUTE_NODES_PER_SYSTEM > (); + } while(0); TOD_EXIT(); diff --git a/src/usr/isteps/istep18/TodUtils.H b/src/usr/isteps/tod/TodUtils.H index 83d942617..3ddd6998c 100644 --- a/src/usr/isteps/istep18/TodUtils.H +++ b/src/usr/isteps/tod/TodUtils.H @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: src/usr/isteps/istep18/TodUtils.H $ */ +/* $Source: src/usr/isteps/tod/TodUtils.H $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ diff --git a/src/usr/isteps/tod/makefile b/src/usr/isteps/tod/makefile new file mode 100644 index 000000000..aaad0b413 --- /dev/null +++ b/src/usr/isteps/tod/makefile @@ -0,0 +1,39 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/isteps/tod/makefile $ +# +# OpenPOWER HostBoot Project +# +# Contributors Listed Below - COPYRIGHT 2016,2017 +# [+] 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 + +ROOTPATH = ../../../.. + +MODULE = tod + +OBJS += TodControls.o +OBJS += TodDrawer.o +OBJS += TodProc.o +OBJS += TodSvc.o +OBJS += TodHwpIntf.o +OBJS += TodTopologyManager.o + +SUBDIRS += runtime.d + +include tod.mk diff --git a/src/usr/isteps/tod/runtime/makefile b/src/usr/isteps/tod/runtime/makefile new file mode 100644 index 000000000..5c65fd3ff --- /dev/null +++ b/src/usr/isteps/tod/runtime/makefile @@ -0,0 +1,37 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/isteps/tod/runtime/makefile $ +# +# OpenPOWER HostBoot Project +# +# Contributors Listed Below - COPYRIGHT 2016,2017 +# [+] 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 + +HOSTBOOT_RUNTIME = 1 + +ROOTPATH = ../../../../.. + +MODULE = tod_rt + +EXTRAINCDIR += ${ROOTPATH}/src/usr/isteps/tod +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/isteps/ + +OBJS += rt_todintf.o + +include ../tod.mk diff --git a/src/usr/isteps/tod/runtime/rt_todintf.C b/src/usr/isteps/tod/runtime/rt_todintf.C new file mode 100644 index 000000000..c79419604 --- /dev/null +++ b/src/usr/isteps/tod/runtime/rt_todintf.C @@ -0,0 +1,753 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/tod/runtime/rt_todintf.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014,2017 */ +/* [+] 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 <isteps/tod/runtime/rt_todintf.H> +#include <TodTrace.H> // TOD_ENTER, TOD_EXIT +#include <TodUtils.H> // GETHUID +#include <TodSvcUtil.H> // getMaxProcsOnSystem + +#include <runtime/interface.h> // g_hostInterfaces +#include <tod_init_reasoncodes.H> // TOD_RT_TOPOLOGY_RESET_BACKUP, etc + +namespace TOD +{ + +const size_t MSG_OSC_ORDINAL_ID_LOC = 0; +const size_t MSG_OSC_ORDINAL_NODE_HUID_LOC = 1; +const size_t MSG_OSC_HUIDS_LOC = 2; +const size_t MSG_OSC_SIZE_OF_DETAILS = 2; + +//***************************************************************************** +// resetBackupTopology +//***************************************************************************** +errlHndl_t resetBackupTopology( + uint32_t i_oscPos, + const TARGETING::TargetHandle_t& i_procOscTgt, + const TARGETING::TargetHandleList& i_badChipList, + bool i_informPhyp) +{ + TOD_ENTER("resetBackupTopology"); + errlHndl_t l_err = nullptr; + + // Put the handle to the firmware request out here + // so it is easier to free later + hostInterfaces::hbrt_fw_msg *l_req_fw_msg = nullptr; + + do + { + if ((nullptr == g_hostInterfaces) || + (nullptr == g_hostInterfaces->firmware_request)) + { + /*@ + * @errortype + * @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE + * @moduleid TOD::TOD_RT_TOPOLOGY_RESET_BACKUP + * @reasoncode TOD::TOD_RT_NULL_FIRMWARE_REQUEST_PTR + * @devdesc Host interfaces are not initialized + * @custdesc An internal error occurred. This will force the + * Time of Day function to run with complete + * redundancy. + */ + l_err = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_UNRECOVERABLE, + TOD::TOD_RT_TOPOLOGY_RESET_BACKUP, + TOD::TOD_RT_NULL_FIRMWARE_REQUEST_PTR, + 0, 0, true); + + break; + } + + // First, I'll present the format of the data + // to help with the understanding of the code that follows + // The format of the data to be sent, according to the document + // "Handle PRD Request for resetting backup TOD topology" is as follows + // Ordinal ID - 0xFFFFFFFF means no OSC to be avoided + // HUID of the node - This field should be considered only if Ordinal + // ID is NOT set to 0xFFFFFFFF otherwise it is set + // to 0 + // HUID of the first processor + // HUID of the second processor, etc + + // Flag to determine if the OSC data will be added to the data + bool l_addOscData = (0xFFFFFFFF != i_oscPos) && + (nullptr != i_procOscTgt); + + // Calculate the size of the data that is being added to the + // generic struct + size_t l_data_size = 0; + + // Add to the size iff there is data needing to be passed + if (i_badChipList.size() > 0) + { + // if the bad chip list has any items then increase size to + // accommodate for an ordinal ID and a HUID, regardless if + // they have relevant data or not, because they are expected + // before the HUID list. + l_data_size += (MSG_OSC_SIZE_OF_DETAILS * sizeof(uint32_t)) + + (i_badChipList.size() * sizeof(uint32_t)); + } + else if (l_addOscData) + { + // if there is a valid OSC then accommodate for an ordinal ID + // and HUID of node, but don't need space for HUID list because, + // if we are here, the list is empty + l_data_size += (MSG_OSC_SIZE_OF_DETAILS * sizeof(uint32_t)); + } + + // Update the data size with the size of the generic msg struct + if (l_data_size < sizeof(hostInterfaces::hbrt_fw_msg::generic_msg.data)) + { + // If the current size of the data is less than the size of the + // data within the generic message (GenericFspMboxMessage_t.data), + // then default the data size to just the generic message because + // the size of the data to be passed in + // GenericFspMboxMessage_t.dataSize has be at the minimum - the + // size of the generic message (sizeof(GenericFspMboxMessage_t)). + l_data_size = sizeof(hostInterfaces::hbrt_fw_msg::generic_msg); + } + else + { + // If the current size of the data is greater than the size of the + // data within the generic message (GenericFspMboxMessage_t.data), + // then add the size of the generic message minus the size of + // generic message's data. + l_data_size += sizeof(hostInterfaces::hbrt_fw_msg::generic_msg) - + sizeof(hostInterfaces::hbrt_fw_msg::generic_msg.data); + } + + // At last. Calculate the TOTAL size of hostInterfaces::hbrt_fw_msg + // which means only adding hostInterfaces::HBRT_FW_MSG_BASE_SIZE to + // the previous calculated data size + size_t l_req_fw_msg_size = hostInterfaces::HBRT_FW_MSG_BASE_SIZE + + l_data_size; + + // Create the firmware request structure to carry the TOD data + l_req_fw_msg =(hostInterfaces::hbrt_fw_msg *)malloc(l_req_fw_msg_size); + + // Set the data for the request + l_req_fw_msg->io_type = hostInterfaces::HBRT_FW_MSG_HBRT_FSP_REQ; + l_req_fw_msg->generic_msg.initialize(); + l_req_fw_msg->generic_msg.dataSize = l_data_size; + l_req_fw_msg->generic_msg.msgq = MBOX::FSP_TOD_MSGQ; + l_req_fw_msg->generic_msg.msgType = (false == i_informPhyp ? + GFMM_MSG_TOD_BACKUP_RESET: + GFMM_MSG_TOD_BACKUP_RESET_INFORM_PHYP); + l_req_fw_msg->generic_msg.__req = GFMM_REQUEST; + l_req_fw_msg->generic_msg.__onlyError = GFMM_NOT_ERROR_ONLY; + + // A convenient way to populate the data + uint32_t* l_dataPtr = (uint32_t*)&(l_req_fw_msg->generic_msg.data); + + if (i_badChipList.size() > 0) + { + // set the ordinal ID + l_dataPtr[MSG_OSC_ORDINAL_ID_LOC] = i_oscPos; + + // attach the HUIDs from bad chip list to end of structure + size_t i = MSG_OSC_HUIDS_LOC; + for (auto l_target : i_badChipList) + { + l_dataPtr[i++] = GETHUID(l_target); + } + } + + // Set the HUID of the ordinal node if need be + if (l_addOscData) + { + // set the ordinal ID + l_dataPtr[MSG_OSC_ORDINAL_ID_LOC] = i_oscPos; + + // Get the parent node target + TARGETING::TargetHandleList l_list; + TARGETING::targetService().getAssociated(l_list, + i_procOscTgt, + TARGETING::TargetService::PARENT, + TARGETING::TargetService::IMMEDIATE); + + if (l_list.size() == 1) + { + l_dataPtr[MSG_OSC_ORDINAL_NODE_HUID_LOC] = GETHUID(l_list[0]); + } + else + { + /*@ + * @errortype + * @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE + * @moduleid TOD::TOD_RT_TOPOLOGY_RESET_BACKUP + * @reasoncode TOD::TOD_INVALID_TARGET + * @devdesc No parent for processor osc target + * @custdesc An internal error occurred. This will force + * the Time of Day function to run with complete + * redundancy. + */ + l_err = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_UNRECOVERABLE, + TOD::TOD_RT_TOPOLOGY_RESET_BACKUP, + TOD::TOD_INVALID_TARGET, + 0, 0, true); + + break; + } + } + + // No data is returning from the call, just capture any errors + hostInterfaces::hbrt_fw_msg l_resp_fw_msg; + size_t l_resp_fw_msg_size = sizeof(l_resp_fw_msg); + + // Clear the response structure + memset(&l_resp_fw_msg, 0, l_resp_fw_msg_size); + + // Send the data via a firmware request + size_t rc = g_hostInterfaces->firmware_request( + l_req_fw_msg_size, l_req_fw_msg, + &l_resp_fw_msg_size, &l_resp_fw_msg); + + // Error log id + uint32_t l_errPlid(0); + + // Create a useful structure to get to the PLID + // The PLID is expected to be in the first 4 bytes of the data + // if it exists + struct hbrtFspRespData_t + { + uint32_t plid; + uint32_t otherData; + } PACKED ; + + hbrtFspRespData_t *l_hbrtFspRespData = + (hbrtFspRespData_t*)&(l_resp_fw_msg.generic_msg.data); + + // Capture the error log ID if any + // The return code (rc) may return OK, but there still may be an issue + // with the HWSV code on the FSP. + if ((hostInterfaces::HBRT_FW_MSG_HBRT_FSP_RESP + == l_resp_fw_msg.io_type) && + (GFMM_ERROR_ONLY == l_resp_fw_msg.generic_msg.__onlyError) && + (0 != l_hbrtFspRespData->plid) ) + { + l_errPlid = l_hbrtFspRespData->plid; + } + + // Gather up the error data and create an error log out of it + if (rc || l_errPlid) + { + /*@ + * @errortype + * @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE + * @moduleid TOD::TOD_RT_TOPOLOGY_RESET_BACKUP + * @reasoncode TOD::TOD_RT_TOPOLOGY_RESET_BACKUP_ERR + * @userdata1[0..31] Hypervisor return code + * @userdata1[32:63] HWSV error log id (if any) + * @userdata2[0:31] MBOX message type + * @userdata2[32:63] TOD message type + * @devdesc TOD reset backup topology failed + * @custdesc An internal error occurred. This will force + * the Time of Day function to run with complete + * redundancy. + */ + l_err = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_UNRECOVERABLE, + TOD::TOD_RT_TOPOLOGY_RESET_BACKUP, + TOD::TOD_RT_TOPOLOGY_RESET_BACKUP_ERR, + TWO_UINT32_TO_UINT64(rc, l_errPlid), + TWO_UINT32_TO_UINT64( + l_req_fw_msg->generic_msg.msgq, + l_req_fw_msg->generic_msg.msgType), + true); + + l_err->addFFDC( ISTEP_COMP_ID, + &l_resp_fw_msg, + l_resp_fw_msg_size, + 0, 0, false ); + + if (sizeof(l_req_fw_msg) > 0) + { + l_err->addFFDC( ISTEP_COMP_ID, + l_req_fw_msg, + sizeof(l_req_fw_msg), + 0, 0, false ); + } + + l_err->collectTrace( "TOD", 256); + + if (l_errPlid) + { + l_err->plid(l_errPlid); + } + + break; + } + } + while (0); + + // The firmware request message is no longer needed - free the data + free(l_req_fw_msg); + + TOD_EXIT("resetBackupTopology"); + return l_err; + +} // end resetBackupTopology + + +//***************************************************************************** +// readTodProcDataFromFile +//***************************************************************************** +errlHndl_t readTodProcDataFromFile(TodChipDataContainer& o_todChipData) +{ + TOD_ENTER("readTodProcDataFromFile"); + errlHndl_t l_err = nullptr; + + // Put the handle to the firmware response out here + // so it is easier to free later + hostInterfaces::hbrt_fw_msg *l_resp_fw_msg = nullptr; + + do + { + // clear the out data, regardless of the code to follow + o_todChipData.clear(); + + if ((nullptr == g_hostInterfaces) || + (nullptr == g_hostInterfaces->firmware_request)) + { + /*@ + * @errortype + * @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE + * @moduleid TOD::TOD_RT_TOPOLOGY_DATA + * @reasoncode TOD::TOD_RT_NULL_FIRMWARE_REQUEST_PTR + * @devdesc Host interfaces are not initialized + * @custdesc An internal error occurred. This will force the + * Time of Day function to run with complete + * redundancy. + */ + l_err = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_UNRECOVERABLE, + TOD::TOD_RT_TOPOLOGY_DATA, + TOD::TOD_RT_NULL_FIRMWARE_REQUEST_PTR, + 0, 0, true); + + break; + } + + // Create the firmware request structure. No data is being + // passed via this structure so this step may be moot. + // Maybe just passing size of 0 and a null pointer would be better? + hostInterfaces::hbrt_fw_msg l_req_fw_msg; + size_t l_req_fw_msg_size = sizeof(l_req_fw_msg); + + // Set the data for the request + l_req_fw_msg.io_type = hostInterfaces::HBRT_FW_MSG_HBRT_FSP_REQ; + l_req_fw_msg.generic_msg.initialize(); + l_req_fw_msg.generic_msg.msgq = MBOX::FSP_TOD_MSGQ; + l_req_fw_msg.generic_msg.msgType = GFMM_MSG_TOD_TOPOLOGY_DATA; + l_req_fw_msg.generic_msg.__req = GFMM_REQUEST; + l_req_fw_msg.generic_msg.__onlyError = GFMM_NOT_ERROR_ONLY; + + // Calculate the size of the response - the number + // of TodChipData items that will be returned. + uint32_t l_nTodChips = TodSvcUtil::getMaxProcsOnSystem(); + + // Calculate the size of the data that is being added to the + // generic struct + size_t l_data_size = (l_nTodChips * sizeof(TodChipData)); + + // Update the data size with the size of the generic msg struct + if (l_data_size < sizeof(hostInterfaces::hbrt_fw_msg::generic_msg.data)) + { + // If the current size of the data is less than the size of the + // data within the generic message (GenericFspMboxMessage_t.data), + // then default the data size to just the generic message because + // the size of the data to be passed in + // GenericFspMboxMessage_t.dataSize has be at the minimum - the + // size of the generic message (sizeof(GenericFspMboxMessage_t)). + l_data_size = sizeof(hostInterfaces::hbrt_fw_msg::generic_msg); + } + else + { + // If the current size of the data is greater than the size of the + // data within the generic message (GenericFspMboxMessage_t.data), + // then add the size of the generic message minus the size of + // generic message's data. + l_data_size += sizeof(hostInterfaces::hbrt_fw_msg::generic_msg) - + sizeof(hostInterfaces::hbrt_fw_msg::generic_msg.data); + } + + // At last. Calculate the TOTAL size of hostInterfaces::hbrt_fw_msg + // which means only adding hostInterfaces::HBRT_FW_MSG_BASE_SIZE to + // the previous calculated data size + size_t l_resp_fw_msg_size = hostInterfaces::HBRT_FW_MSG_BASE_SIZE + + l_data_size; + + // Create the firmware response structure to return the data + l_resp_fw_msg = + (hostInterfaces::hbrt_fw_msg *)malloc(l_resp_fw_msg_size); + + // Clear the response structure + memset(l_resp_fw_msg, 0, l_resp_fw_msg_size); + + // Send the data via a firmware request + size_t rc = g_hostInterfaces->firmware_request( + l_req_fw_msg_size, &l_req_fw_msg, + &l_resp_fw_msg_size, l_resp_fw_msg); + + // Error log id + uint32_t l_errPlid(0); + + // Create a useful structure to get to the PLID + // The PLID is expected to be in the first 4 bytes of the data + struct hbrtFspRespData_t + { + uint32_t plid; + uint32_t otherData; + } PACKED ; + + hbrtFspRespData_t *l_hbrtFspRespData = + (hbrtFspRespData_t*)&(l_resp_fw_msg->generic_msg.data); + + // Capture the error log ID if any + // The return code (rc) may return OK, but there still may be an issue + // with the HWSV code on the FSP. + if ((hostInterfaces::HBRT_FW_MSG_HBRT_FSP_RESP + == l_resp_fw_msg->io_type) && + (GFMM_ERROR_ONLY == l_resp_fw_msg->generic_msg.__onlyError) && + (0 != l_hbrtFspRespData->plid) ) + { + l_errPlid = l_hbrtFspRespData->plid; + } + + // Gather up the error data and create an error log out of it + if (rc || l_errPlid) + { + /*@ + * @errortype + * @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE + * @moduleid TOD::TOD_RT_TOPOLOGY_DATA + * @reasoncode TOD::TOD_RT_TOPOLOGY_DATA_ERR + * @userdata1[0..31] Hypervisor return code + * @userdata1[32:63] HWSV error log id (if any) + * @userdata2[0:31] MBOX message type + * @userdata2[32:63] TOD message type + * @devdesc TOD read proc data failed + * @custdesc An internal error occurred. This will force + * the Time of Day function to run with complete + * redundancy. + */ + l_err = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_UNRECOVERABLE, + TOD::TOD_RT_TOPOLOGY_DATA, + TOD::TOD_RT_TOPOLOGY_DATA_ERR, + TWO_UINT32_TO_UINT64(rc, l_errPlid), + TWO_UINT32_TO_UINT64( + l_req_fw_msg.generic_msg.msgq, + l_req_fw_msg.generic_msg.msgType), + true); + + if (l_resp_fw_msg_size > 0) + { + l_err->addFFDC( ISTEP_COMP_ID, + l_resp_fw_msg, + l_resp_fw_msg_size, + 0, 0, false ); + } + + l_err->addFFDC( ISTEP_COMP_ID, + &l_req_fw_msg, + sizeof(l_req_fw_msg), + 0, 0, false ); + + l_err->collectTrace( "TOD", 256); + + if (l_errPlid) + { + l_err->plid(l_errPlid); + } + + break; + } + + // If we are here, then this was no error retrieving the data. Now, + // just get the data from the returned struct and pass back to caller + // Get a pointer to the data + TodChipData* l_todChipData = + (TodChipData*)(&(l_resp_fw_msg->generic_msg.data)); + + // Gather the data into the container provided + for (size_t i = 0; i < l_nTodChips; ++i) + { + o_todChipData.push_back(l_todChipData[i]); + } + } + while (0); + + // Free the memory associated with the response + free(l_resp_fw_msg); + + TOD_EXIT("readTodProcDataFromFile"); + return l_err; +} // end readTodProcDataFromFile + +// This code was ported over from the FIPS code - +// /esw/fips910/Builds/b1005a_1742.910/ +// src/hwsv/server/services/todservice/hwsvTodSvc.C +// It was decided that a port of the code is not needed but to hold onto +// the code since the majority of it has been ported. +// There are few places below that do not have a direct port from the FIPS code +// that need to be resolved. I did not resolve them, because the port was +// abandoned and I did not want to waste any more time on it. +// In particular the call to mboxControlTodTopology() and the use of +// util::ScopeLock + +#if 0 +errlHndl_t resetBackupTopologyPortedCoded( + const TARGETING::TargetHandleList& i_badChipList, + bool i_informPhyp) +{ + TOD_ENTER("resetBackupTopology"); + + errlHndl_t l_err = nullptr; + bool l_deleteOnFailure = false; + + // l_backupConfig will be set again after determining the non-active + // topology from register values + p9_tod_setup_tod_sel l_backupConfig = TOD_SECONDARY; + +// NOTE: Not sure if this is needed - no direct port +// util::ScopeLock l_lock(iv_mutexTodAccess); + do + { + p9_tod_setup_tod_sel l_activeConfig = TOD_PRIMARY; + bool l_isTodRunning = false; + TARGETING::Target* l_mdmtOnActiveTopology = NULL; + bool l_getTodRunningStatus = true; + + // Get the currently active TOD configuration + l_err = TOD::queryActiveConfig(l_activeConfig, + l_isTodRunning, + l_mdmtOnActiveTopology, + l_getTodRunningStatus); + + if ( l_err ) + { + TOD_ERR("Call to queryActiveConfig failed "); + break; + } + + if ( !l_isTodRunning ) + { + TOD_ERR("TOD HW logic is not running,only use case of " + " resetBackup is when TOD is already running "); + /*@ + * @errortype + * @moduleid TOD::TOD_RESET_BACKUP + * @reasoncode TOD::TOD_INVALID_ACTION + * @userdata1 ChipTOD logic HW state, 1 means running, zero + * otherwise + * @devdesc Error: TOD HW logic is not running, only use case + * of resetBackup is when TOD is already running + * @custdesc Host failed to boot because there was a problem + * configuring Time Of Day on the Host processors + */ + l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_INFORMATIONAL, + TOD_RESET_BACKUP, + TOD_INVALID_ACTION, + l_isTodRunning); + break; + } + + l_backupConfig = (( l_activeConfig == TOD_PRIMARY) ? + TOD_SECONDARY : TOD_PRIMARY ); + + TOD_INF("Currently active topology ==> %s, and inactive ==> %s", + TodSvcUtil::topologyTypeToString(l_activeConfig), + TodSvcUtil::topologyTypeToString(l_backupConfig) ); + + // PHYP needs to be informed that it won't have a + // backup available for failover while we are reconfiguring it. + // Not all the cases will require HWSV to inform PHYP because in some + // of the case PHYP would have already initiated a failover before + // PRD asks HWSV to reconfigure backup. + // This indication is sent by PRD after the analysis of TOD error + // If this method is initiated by PHYP's message to MBOX to reset the + // backup topology this parameter will be always false. + if ( i_informPhyp ) + { + TOD_INF("Sending request to PHYP to disable the %s", + TodSvcUtil::topologyTypeToString(l_backupConfig)); + +// NOTE: Not sure if this is needed - no direct port +// l_err = mboxControlTodTopology(MBOX_DISABLE_TOPOLOGY, +// (( l_backupConfig == TOD_PRIMARY)? +// MBOX_PRIMARY_TOPOLOGY : MBOX_SECONDARY_TOPOLOGY)); + + if ( l_err ) + { + TOD_ERR("Request to PHYP for disabling the %s,that is " + "currently inactive failed", + TodSvcUtil::topologyTypeToString(l_backupConfig)); + break; + } + + TOD_INF("Got response from PHYP, for the request to disable" + "inactive topology "); + } + + + // Mark configured state to false + TOD::setConfigStatus(l_backupConfig,false); + + // Destroy the backup topology in case it exists, this is copy of + // topology in volatile memory so it won't matter even if we fail + // somewhere + TOD::destroy(l_backupConfig); + + // Build blacklist information + l_err = TOD::buildBlackList(i_badChipList); + if ( l_err ) + { + TOD_ERR("Call to buildBlackList failed "); + break; + } + + //Build the list of garded TOD targets + l_err = TOD::buildGardedTargetsList(); + if ( l_err ) + { + TOD_ERR("Call to buildGardedTargetsList failed"); + break; + } + + // Build a set of datastructures to setup creation of the TOD topology + l_err = TOD::buildTodDrawers(l_backupConfig); + if ( l_err ) + { + TOD_ERR("TOD setup failure: failed to build TOD drawers " + "for %s", + TodSvcUtil::topologyTypeToString(l_backupConfig)); + break; + } + + // From here on if resetBackup failed, we will do the cleanup at the end + l_deleteOnFailure = true; + + //Before we ask HwsvTodTopologyManager to create a new backup + //topology let us make sure that we have MDMT set in TOD Controls for + //the active topology, if there was RR then the copy of + //topology in main memory would have got erased + //MDMT of the active topology should be avoided while choosing MDMT for + //backup + if ( !(TOD::getConfigStatus(l_activeConfig)) && + TOD::getMDMT(l_activeConfig) ) + { + l_err = Singleton<TodSvc>::instance(). + setActiveMdmtForResetBackup(l_activeConfig); + + if ( l_err ) + { + TOD_ERR("setActiveMdmtForResetBackup failed for " + " %s", + TodSvcUtil::topologyTypeToString(l_activeConfig)); + break; + } + } + + + // Ask the topology manager to setup the backup topology + TodTopologyManager l_backupTopology(l_backupConfig); + l_err = l_backupTopology.create(); + + if ( l_err ) + { + TOD_ERR("TOD setup failure: failed to create %s", + TodSvcUtil::topologyTypeToString(l_backupConfig)); + break; + } + + l_backupTopology.dumpTopology(); + + //Call hardware procedures to configure the TOD hardware logic for + //the backup topology and to fill up the TOD regs. + l_err = TOD::todSetupHwp(l_backupConfig); + if ( l_err ) + { + TOD_ERR("TOD setup failure: secondary topology setup HWP."); + break; + } + + // Save the TOD registers into the local data structures + l_err = todSaveRegsHwp(l_backupConfig); + if ( l_err ) + { + TOD_ERR("todSaveRegsHwp failed for the %s", + TodSvcUtil::topologyTypeToString(l_backupConfig)); + break; + } + l_backupTopology.dumpTodRegs(); + + // Sending request to PHYP to enable the inactive + TOD_INF("Sending request to PHYP to enable the inactive %s", + TodSvcUtil::topologyTypeToString(l_backupConfig)); + + // Inform PHYP about the availability of backup topology +// NOTE: Not sure if this is needed - no direct port +// l_err = mboxControlTodTopology(MBOX_ENABLE_TOPOLOGY, +// ( l_backupConfig == TOD_PRIMARY)? MBOX_PRIMARY_TOPOLOGY +// : MBOX_SECONDARY_TOPOLOGY ); + if ( l_err ) + { + TOD_ERR("Request to PHYP for disabling the %s,that is curently" + "backup, failed ", + TodSvcUtil::topologyTypeToString(l_backupConfig)); + break; + + } + TOD_INF("Got response from PHYP, for the request to enable" + "inactive topology "); + + // Write this information to the persistant file + l_err = TOD::writeTodProcData(l_backupConfig); + if( l_err ) + { + TOD_ERR("TOD setup failure:Failed to write topology register data" + " to the file."); + break; + } + + // Backup successfully configured + TOD::setConfigStatus(l_backupConfig, true); + } + while (0); + + if ( l_err && l_deleteOnFailure ) + { + TOD::destroy(l_backupConfig); + } + TOD::clearGardedTargetsList(); + + TOD_EXIT("resetBackupTopology"); + + return l_err; +} // end resetBackupTopologyPortedCoded +#endif + +} // end namespace TOD diff --git a/src/usr/isteps/tod/tod.mk b/src/usr/isteps/tod/tod.mk new file mode 100644 index 000000000..15ee98a28 --- /dev/null +++ b/src/usr/isteps/tod/tod.mk @@ -0,0 +1,43 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/isteps/tod/tod.mk $ +# +# OpenPOWER HostBoot Project +# +# Contributors Listed Below - COPYRIGHT 2016,2017 +# [+] 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 + +# Define common TOD objects +OBJS += TodSvcUtil.o +OBJS += TodUtils.o + +# Define common include paths +PROCEDURES_PATH = ${ROOTPATH}/src/import/chips/p9/procedures/hwp/nest +## support for Targeting and fapi +EXTRAINCDIR += ${PROCEDURES_PATH} +EXTRAINCDIR += ${ROOTPATH}/src/import/hwpf/fapi2/include +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/fapi2 +EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/utils/imageProcs +EXTRAINCDIR += ${ROOTPATH}/src/import/chips/common/utils/imageProcs + +VPATH += ../ + +# include common mk files +include ${ROOTPATH}/procedure.rules.mk +include $(ROOTPATH)/config.mk diff --git a/src/usr/targeting/runtime/makefile b/src/usr/targeting/runtime/makefile index 05a60a5e2..b453a1f99 100644 --- a/src/usr/targeting/runtime/makefile +++ b/src/usr/targeting/runtime/makefile @@ -39,6 +39,7 @@ HOSTBOOT_RUNTIME_SPECIFIC_OBJS += targplatutil.o HOSTBOOT_RUNTIME_SPECIFIC_OBJS += rt_targeting.o HOSTBOOT_RUNTIME_SPECIFIC_OBJS += attrPlatOverride_rt.o HOSTBOOT_RUNTIME_SPECIFIC_OBJS += errludattribute.o +HOSTBOOT_RUNTIME_SPECIFIC_OBJS += attributestrings.o OBJS += ${COMMON_TARGETING_OBJS} OBJS += ${HOSTBOOT_RT_IPL_COMMON_OBJS} |

