summaryrefslogtreecommitdiffstats
path: root/src/usr/isteps/tod/TodUtils.C
diff options
context:
space:
mode:
authorRoland Veloz <rveloz@us.ibm.com>2017-10-10 10:55:09 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-12-20 17:47:47 -0500
commita69cb64611f39c3320e71a025cc612690305926d (patch)
treedebcc9b99e0c0f0fc5fafa47c9f0efbb20c38765 /src/usr/isteps/tod/TodUtils.C
parentf0db3bed83349756e9182077b02c1c73e473a569 (diff)
downloadtalos-hostboot-a69cb64611f39c3320e71a025cc612690305926d.tar.gz
talos-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/usr/isteps/tod/TodUtils.C')
-rw-r--r--src/usr/isteps/tod/TodUtils.C181
1 files changed, 181 insertions, 0 deletions
diff --git a/src/usr/isteps/tod/TodUtils.C b/src/usr/isteps/tod/TodUtils.C
new file mode 100644
index 000000000..a1a1ede63
--- /dev/null
+++ b/src/usr/isteps/tod/TodUtils.C
@@ -0,0 +1,181 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/isteps/tod/TodUtils.C $ */
+/* */
+/* 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 */
+
+// Includes
+// /***********************************************************************/
+
+#include "TodAssert.H"
+#include "TodUtils.H"
+#include <devicefw/userif.H>
+#include <isteps/tod_init_reasoncodes.H>
+#include <errl/errlentry.H>
+#include <errl/errlmanager.H>
+
+namespace TOD
+
+{
+
+//******************************************************************************
+// isFunctional
+//******************************************************************************
+
+bool isFunctional(const TARGETING::Target* i_pTarget)
+{
+ //--------------------------------------------------------------------------
+ // Local Variables
+ //--------------------------------------------------------------------------
+
+ errlHndl_t l_errl = NULL;
+ bool l_isFunctional = false;
+
+ //--------------------------------------------------------------------------
+ // Code
+ //--------------------------------------------------------------------------
+
+ if(i_pTarget)
+ {
+ // For now return true if state is FUNCTIONAL else false.
+ // There are total 4 HWAS functional states can exist:
+ // NON FUNCTIONAL,FUNCTIONAL,CM FUNCTIONAL and DUMP FUNCTIONAL.
+ // In-order to consider CM & DUMP FUNCTIONAL states we need to check
+ // whether system is in CM/DUMP mode. Since the CM/DUMP mode support
+ // is not available, we'll continue using FUNCTIONAL state only.
+ // Later we need to check for appropriate mode and state.
+ // @TODO via RTC: 69925
+ l_isFunctional =
+ i_pTarget->getAttr<TARGETING::ATTR_HWAS_STATE>().functional;
+ }
+ else
+ {
+ // If i_pTarget is NULL then create an error log
+ TOD_ERR("Input Target handle is null");
+
+ //Create error
+ /*@
+ * @errortype
+ * @moduleid TOD_FUNCTIONAL_TARGET
+ * @reasoncode TOD_INVALID_TARGET
+ * @devdesc NULL Target is supplied as an input
+ * @custdesc Service Processor Firmware encountered an internal
+ * error
+ */
+ l_errl = new ERRORLOG::ErrlEntry(
+ ERRORLOG::ERRL_SEV_INFORMATIONAL,
+ TOD_FUNCTIONAL_TARGET,
+ TOD_INVALID_TARGET);
+
+ errlCommit(l_errl, TOD_COMP_ID);
+ }
+
+ return l_isFunctional;
+}
+
+
+
+//******************************************************************************
+//todGetScom()
+//******************************************************************************
+errlHndl_t todGetScom(const TARGETING::Target * i_target,
+ const uint64_t i_address,
+ fapi2::variable_buffer & o_data)
+{
+ errlHndl_t l_err = NULL;
+
+ // Perform SCOM read
+ uint64_t l_data = 0;
+ size_t l_size = sizeof(uint64_t);
+
+ l_err = deviceRead((TARGETING::Target *)i_target,
+ &l_data,
+ l_size,
+ DEVICE_SCOM_ADDRESS(i_address));
+
+ return l_err;
+}
+
+
+/*****************************************************************************/
+// getMaxConfigParams
+/*****************************************************************************/
+errlHndl_t getMaxConfigParams(
+ maxConfigParamsContainer& o_maxConfigParams)
+{
+ TOD_ENTER("getMaxConfigParams");
+ errlHndl_t l_err = NULL;
+
+ do
+ {
+ //Get the top level (system) target handle
+ TARGETING::Target* l_pTopLevel = NULL;
+ (void)TARGETING::targetService().getTopLevelTarget(l_pTopLevel);
+
+ // Assert on failure getting system target
+ if(NULL == l_pTopLevel)
+ {
+ TOD_ERR_ASSERT("NULL top level target found");
+ break;
+
+ }
+ // Top level target successfully retrieved. Now get attributes
+
+ o_maxConfigParams.max_procchips_per_node = l_pTopLevel->getAttr
+ < TARGETING::ATTR_MAX_PROC_CHIPS_PER_NODE > ();
+
+ o_maxConfigParams.max_exs_per_procchip = l_pTopLevel->getAttr
+ < TARGETING::ATTR_MAX_EXS_PER_PROC_CHIP > ();
+
+ o_maxConfigParams.max_dimms_per_mbaport = l_pTopLevel->getAttr
+ < TARGETING::ATTR_MAX_DIMMS_PER_MBA_PORT > ();
+
+ o_maxConfigParams.max_mbaports_per_mba = l_pTopLevel->getAttr
+ < TARGETING::ATTR_MAX_MBA_PORTS_PER_MBA > ();
+
+ o_maxConfigParams.max_mbas_per_membuf = l_pTopLevel->getAttr
+ < TARGETING::ATTR_MAX_MBAS_PER_MEMBUF_CHIP > ();
+
+ o_maxConfigParams.max_chiplets_per_proc = l_pTopLevel->getAttr
+ < TARGETING::ATTR_MAX_CHIPLETS_PER_PROC > ();
+
+ 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();
+
+ return l_err;
+}
+
+}//end of TOD namespace
+
OpenPOWER on IntegriCloud