summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/import/chips/p9/procedures/hwp/perv/p9_core_checkstop_handler.C86
-rw-r--r--src/import/chips/p9/procedures/hwp/perv/p9_core_checkstop_handler.H50
-rw-r--r--src/import/chips/p9/procedures/hwp/perv/p9_core_checkstop_handler.mk26
3 files changed, 162 insertions, 0 deletions
diff --git a/src/import/chips/p9/procedures/hwp/perv/p9_core_checkstop_handler.C b/src/import/chips/p9/procedures/hwp/perv/p9_core_checkstop_handler.C
new file mode 100644
index 000000000..d8e9bd996
--- /dev/null
+++ b/src/import/chips/p9/procedures/hwp/perv/p9_core_checkstop_handler.C
@@ -0,0 +1,86 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/import/chips/p9/procedures/hwp/perv/p9_core_checkstop_handler.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 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 */
+
+#include "p9_core_checkstop_handler.H"
+
+#include "p9_const_common.H"
+#include <p9_quad_scom_addresses.H>
+fapi2::ReturnCode p9_core_checkstop_handler(
+ const fapi2::Target<fapi2::TARGET_TYPE_CORE>& i_target_core,
+ bool i_override_restore)
+{
+ FAPI_INF("Entering ...");
+
+ fapi2::buffer<uint64_t> l_action0;
+ fapi2::buffer<uint64_t> l_action1;
+ const fapi2::Target<fapi2::TARGET_TYPE_SYSTEM> FAPI_SYSTEM;
+
+ //if true, save off the original action, and turn local xstops into system xstops.
+ if(i_override_restore)
+ {
+ // Getting ACTION0
+ FAPI_TRY(fapi2::getScom(i_target_core, C_CORE_ACTION0, l_action0),
+ "Error from getScom (C_CORE_ACTION0)");
+
+ // Getting ACTION1
+ FAPI_TRY(fapi2::getScom(i_target_core, C_CORE_ACTION1, l_action1),
+ "Error from getScom (C_CORE_ACTION1");
+
+ // We want to save the original actions into an attribute for a save-restore
+ FAPI_TRY(FAPI_ATTR_SET(fapi2::ATTR_ORIG_FIR_SETTINGS_ACTION0, FAPI_SYSTEM, l_action0),
+ "Error from FAPI_ATTR_SET (ATTR_ORIG_FIR_SETTINGS_ACTION0)");
+
+ FAPI_TRY(FAPI_ATTR_SET(fapi2::ATTR_ORIG_FIR_SETTINGS_ACTION1, FAPI_SYSTEM, l_action1),
+ "Error from FAPI_ATTR_SET (ATTR_ORIG_FIR_SETTINGS_ACTION1)");
+
+ // For every bit, turn every local xstop (0b11) into system xstops (0b00)
+ uint64_t l_local_xstop = l_action0 & l_action1; //gets bits that are both set to 1
+ l_action0 &= ~l_local_xstop;
+ l_action1 &= ~l_local_xstop;
+ }
+ else
+ {
+ // We want to pull out the original actions, and restore them
+ FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_ORIG_FIR_SETTINGS_ACTION0, FAPI_SYSTEM, l_action0),
+ "Error from FAPI_ATTR_SET (ATTR_ORIG_FIR_SETTINGS_ACTION0)");
+
+ FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_ORIG_FIR_SETTINGS_ACTION1, FAPI_SYSTEM, l_action1),
+ "Error from FAPI_ATTR_SET (ATTR_ORIG_FIR_SETTINGS_ACTION1)");
+
+ }
+
+ // Save off the current values of actions into the register
+ FAPI_TRY(fapi2::putScom(i_target_core, C_CORE_ACTION0, l_action0),
+ "Error from putScom (C_CORE_ACTION0");
+
+ FAPI_TRY(fapi2::putScom(i_target_core, C_CORE_ACTION1, l_action1),
+ "Error from putScrom (C_CORE_ACTION1)");
+
+ FAPI_INF("Exiting ...");
+
+fapi_try_exit:
+ return fapi2::current_err;
+
+}
diff --git a/src/import/chips/p9/procedures/hwp/perv/p9_core_checkstop_handler.H b/src/import/chips/p9/procedures/hwp/perv/p9_core_checkstop_handler.H
new file mode 100644
index 000000000..4b9435c79
--- /dev/null
+++ b/src/import/chips/p9/procedures/hwp/perv/p9_core_checkstop_handler.H
@@ -0,0 +1,50 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/import/chips/p9/procedures/hwp/perv/p9_core_checkstop_handler.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 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 _P9_CORE_CHECKSTOP_HANDLER_H_
+#define _P9_CORE_CHECKSTOP_HANDLER_H_
+
+#include <fapi2.H>
+
+typedef fapi2::ReturnCode (*p9_core_checkstop_handler_FP_t)(
+ const fapi2::Target<fapi2::TARGET_TYPE_CORE>&, bool);
+
+// @brief Handles core checkstops for P9 when we want to switch between
+// unit and system checkstops.
+//
+// @param[in] i_target_core Reference to TARGET_TYPE_CORE target
+// @param[in] i_override_restore Boolean to switch between override and restore modes.
+// If true, we save off the original register and turn
+// local xstops into system xstops.
+// If false, we restore the original register.
+// @return FAPI2_RC_SUCCESS if success, else error code.
+//
+extern "C"
+{
+ fapi2::ReturnCode p9_core_checkstop_handler(
+ const fapi2::Target<fapi2::TARGET_TYPE_CORE>& i_target_core,
+ bool i_override_restore);
+}
+
+#endif
diff --git a/src/import/chips/p9/procedures/hwp/perv/p9_core_checkstop_handler.mk b/src/import/chips/p9/procedures/hwp/perv/p9_core_checkstop_handler.mk
new file mode 100644
index 000000000..4b1caf742
--- /dev/null
+++ b/src/import/chips/p9/procedures/hwp/perv/p9_core_checkstop_handler.mk
@@ -0,0 +1,26 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/import/chips/p9/procedures/hwp/perv/p9_core_checkstop_handler.mk $
+#
+# OpenPOWER HostBoot Project
+#
+# Contributors Listed Below - COPYRIGHT 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
+PROCEDURE=p9_core_checkstop_handler
+$(call BUILD_PROCEDURE)
OpenPOWER on IntegriCloud