summaryrefslogtreecommitdiffstats
path: root/src/usr/htmgt/runtime
diff options
context:
space:
mode:
authorCorey Swenson <cswenson@us.ibm.com>2017-04-26 16:59:11 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-05-10 12:19:05 -0400
commit1f4dfe8eb4042b590d9e948591a6c285823fa548 (patch)
tree86acbe6efa9ed6ccfb4917a7b21aeb6b8fa78d18 /src/usr/htmgt/runtime
parent93a1479c96c011e6c98b47f6bc0ce5b267a9b28c (diff)
downloadtalos-hostboot-1f4dfe8eb4042b590d9e948591a6c285823fa548.tar.gz
talos-hostboot-1f4dfe8eb4042b590d9e948591a6c285823fa548.zip
Clean up OCC and enable HTMGT
Change-Id: I0903f4bd504589d4d5931b4b3b6206664f39b119 RTC:171441 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/39736 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Reviewed-by: Martin Gloff <mgloff@us.ibm.com> Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Sheldon R. Bailey <baileysh@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/htmgt/runtime')
-rw-r--r--src/usr/htmgt/runtime/makefile4
-rw-r--r--src/usr/htmgt/runtime/rt_occ.C163
2 files changed, 165 insertions, 2 deletions
diff --git a/src/usr/htmgt/runtime/makefile b/src/usr/htmgt/runtime/makefile
index 0a512ec6f..a23fda28e 100644
--- a/src/usr/htmgt/runtime/makefile
+++ b/src/usr/htmgt/runtime/makefile
@@ -5,7 +5,7 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2014,2015
+# Contributors Listed Below - COPYRIGHT 2014,2017
# [+] International Business Machines Corp.
#
#
@@ -32,7 +32,7 @@ MODULE = htmgt_rt
include ../htmgt_common.mk
#include unique object modules
-#OBJS +=
+OBJS += rt_occ.o
#SUBDIRS += test.d
diff --git a/src/usr/htmgt/runtime/rt_occ.C b/src/usr/htmgt/runtime/rt_occ.C
new file mode 100644
index 000000000..9c430545c
--- /dev/null
+++ b/src/usr/htmgt/runtime/rt_occ.C
@@ -0,0 +1,163 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/htmgt/runtime/rt_occ.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 <runtime/interface.h>
+#include <util/utillidmgr.H>
+#include <htmgt/htmgt.H>
+#include "../htmgt_utility.H"
+#include <targeting/common/commontargeting.H>
+#include <runtime/rt_targeting.H>
+
+
+using namespace TARGETING;
+
+
+namespace HTMGT
+{
+
+ //------------------------------------------------------------------------
+
+ void process_occ_error (uint64_t i_chipId)
+ {
+#ifdef CONFIG_HTMGT
+ TARGETING::Target* l_reportingOccTarget = NULL;
+ errlHndl_t err = RT_TARG::getHbTarget(i_chipId,l_reportingOccTarget);
+ if (err)
+ {
+ TMGT_ERR ("process_occ_error: getHbTarget"
+ " failed at %d chipId", i_chipId);
+ errlCommit (err, HWPF_COMP_ID);
+ }
+ else
+ {
+ HTMGT::processOccError(l_reportingOccTarget);
+ }
+#else
+ TMGT_ERR("Unexpected call to process_occ_error(%d)"
+ " when HTMGT is not enabled", i_chipId);
+#endif
+ }
+
+ //------------------------------------------------------------------------
+
+ void process_occ_reset (uint64_t i_chipId)
+ {
+#ifdef CONFIG_HTMGT
+ TARGETING::Target* l_failedOccTarget = NULL;
+ errlHndl_t err = RT_TARG::getHbTarget(i_chipId,l_failedOccTarget);
+ if (err)
+ {
+ TMGT_ERR ("process_occ_reset: getHbTarget"
+ " failed at %d chipId", i_chipId);
+ errlCommit (err, HWPF_COMP_ID);
+ }
+ else
+ {
+ HTMGT::processOccReset(l_failedOccTarget);
+ }
+#else
+ TMGT_ERR("Unexpected call to process_occ_reset(%d)"
+ " when HTMGT is not enabled", i_chipId);
+#endif
+ }
+
+ //------------------------------------------------------------------------
+
+ int enable_occ_actuation (int i_occ_activation)
+ {
+ int rc = 0;
+#ifdef CONFIG_HTMGT
+ errlHndl_t err = HTMGT::enableOccActuation(0 != i_occ_activation);
+ if (err)
+ {
+ rc = err->reasonCode();
+ if (0 == rc)
+ {
+ // If there was a failure, be sure to return non-zero status
+ rc = -1;
+ }
+ TMGT_ERR ("enable_occ_actuation: OCC state change"
+ " failed with rc=0x%04X (actuate=%d)",
+ err->reasonCode(), i_occ_activation);
+ errlCommit (err, HWPF_COMP_ID);
+ }
+#else
+ rc = -1;
+ TMGT_ERR("Unexpected call to enable_occ_actuation(%d)"
+ " when HTMGT is not enabled", i_occ_activation);
+#endif
+ return rc;
+ }
+
+ //------------------------------------------------------------------------
+
+ int htmgt_pass_thru (uint16_t i_cmdLength,
+ uint8_t * i_cmdData,
+ uint16_t * o_rspLength,
+ uint8_t * o_rspData)
+ {
+ int rc = 0;
+#ifdef CONFIG_HTMGT
+ errlHndl_t err = HTMGT::passThruCommand(i_cmdLength, i_cmdData,
+ *o_rspLength, o_rspData);
+ if (err)
+ {
+ rc = err->reasonCode();
+ if (0 == rc)
+ {
+ // If there was a failure, be sure to return non-zero status
+ rc = -1;
+ }
+ if ((i_cmdLength > 0) && (NULL != i_cmdData))
+ {
+ TMGT_ERR ("htmgt_pass_thru: command 0x%02X"
+ " (%d bytes) failed with rc=0x%04X",
+ i_cmdData[0], i_cmdLength, err->reasonCode());
+ }
+ errlCommit (err, HWPF_COMP_ID);
+ }
+#else
+ o_rspLength = 0;
+#endif
+ return rc;
+ }
+
+ //------------------------------------------------------------------------
+
+ struct registerOcc
+ {
+ registerOcc()
+ {
+ runtimeInterfaces_t * rt_intf = getRuntimeInterfaces();
+ rt_intf->get_lid_list = &UtilLidMgr::getLidList;
+ rt_intf->process_occ_error = &process_occ_error;
+ rt_intf->process_occ_reset = &process_occ_reset;
+ rt_intf->enable_occ_actuation = &enable_occ_actuation;
+ rt_intf->mfg_htmgt_pass_thru = &htmgt_pass_thru;
+ }
+ };
+
+ registerOcc g_registerOcc;
+}
+
OpenPOWER on IntegriCloud