summaryrefslogtreecommitdiffstats
path: root/src/usr/util
diff options
context:
space:
mode:
authorDean Sanner <dsanner@us.ibm.com>2017-04-27 09:32:02 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-05-25 09:45:36 -0400
commite0a1b4a4f6d9bd7927fddcc508d24f9218dfbb13 (patch)
tree2a88a7b68a8ed3b3dc7f3a54a8bf3bec9b411b45 /src/usr/util
parentc578a6cdfbbc2b77c988548b81df6e1d9f202582 (diff)
downloadblackbird-hostboot-e0a1b4a4f6d9bd7927fddcc508d24f9218dfbb13.tar.gz
blackbird-hostboot-e0a1b4a4f6d9bd7927fddcc508d24f9218dfbb13.zip
Add support for remembering deconfigs without GUARD
Currently on reconfig reboots only parts that are GUARDed are remembered and reapplied. - Add suport for a semi persisent PNOR partition, HB_VOLATILE which Hostboot uses to keep track of the reconfig reboots vs power off - Add a new GUARD type specifically for reconfig loops - Add RECALL_DECONFIG_ON_RECONFIG config flag to control what gets added to GUARD partition - During boot will add/clear guard records on deconfig based on config flags and semi persisent state. Change-Id: Iec636058cde8095c0c4216d1f95ae4fda554395e Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/39780 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Stephen M. Cprek <smcprek@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/util')
-rw-r--r--src/usr/util/makefile1
-rw-r--r--src/usr/util/utilsemipersist.C136
2 files changed, 137 insertions, 0 deletions
diff --git a/src/usr/util/makefile b/src/usr/util/makefile
index 0c3e100cb..3c8e04183 100644
--- a/src/usr/util/makefile
+++ b/src/usr/util/makefile
@@ -34,6 +34,7 @@ OBJS += utillidmgr.o
OBJS += utillidpnor.o
OBJS += utilmbox_scratch.o
OBJS += utiltcemgr.o
+OBJS += utilsemipersist.o
SUBDIRS += test.d
SUBDIRS += runtime.d
diff --git a/src/usr/util/utilsemipersist.C b/src/usr/util/utilsemipersist.C
new file mode 100644
index 000000000..28ce93936
--- /dev/null
+++ b/src/usr/util/utilsemipersist.C
@@ -0,0 +1,136 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/util/utilsemipersist.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 */
+/**
+ * @file utilsemipersist.C
+ *
+ * @brief Abstraction of semi volatile pnor partition
+ *
+ * Used for creating and manipulating streams
+ */
+
+/*****************************************************************************/
+// I n c l u d e s
+/*****************************************************************************/
+#include <trace/interface.H>
+#include <limits.h>
+#include <util/util_reasoncodes.H>
+#include <errl/errlentry.H>
+#include <errl/errlmanager.H>
+#include <pnor/pnorif.H>
+#include <sys/mm.h>
+#include <util/utilsemipersist.H>
+#include "utilbase.H"
+trace_desc_t* g_trac_persist = nullptr;
+TRAC_INIT(&g_trac_persist, "UTIL_PERSIST", KILOBYTE);
+
+using namespace ERRORLOG;
+
+namespace Util
+{
+
+ // ----------------------------------------------
+ // Globals
+ // ----------------------------------------------
+ mutex_t g_PersistMutex = MUTEX_INITIALIZER;
+
+ semiPersistData_t * getHbVolatile()
+ {
+ errlHndl_t l_err = nullptr;
+ uint64_t l_vaddr = 0x0;
+ static uint64_t g_HbVolatileAddr = 0x0;
+
+ do
+ {
+ if(g_HbVolatileAddr)
+ {
+ l_vaddr = g_HbVolatileAddr;
+ break;
+ }
+
+ PNOR::SectionInfo_t l_pnorHbVolatile;
+ l_err = PNOR::getSectionInfo(PNOR::HB_VOLATILE, l_pnorHbVolatile);
+ if(l_err)
+ {
+ delete l_err;
+ l_err = nullptr;
+ TRACFCOMP( g_trac_persist,
+ INFO_MRK"getHbVolatile(): HB_VOLATILE section not"
+ " found, it is optional");
+ break;
+ }
+ if(l_pnorHbVolatile.size == 0)
+ {
+ TRACFCOMP( g_trac_persist,
+ INFO_MRK"getHbVolatile(): HB_VOLATILE section is"
+ " empty in PNOR");
+ break;
+ }
+
+ g_HbVolatileAddr = l_pnorHbVolatile.vaddr;
+ l_vaddr = g_HbVolatileAddr;
+
+ }while(0);
+
+ return reinterpret_cast<semiPersistData_t*>(l_vaddr);
+ }
+
+ void readSemiPersistData(semiPersistData_t & o_data)
+ {
+ memset(&o_data, 0x0, sizeof(semiPersistData_t));
+
+ //Lock to prevent concurrent access
+ mutex_lock(&g_PersistMutex);
+
+ auto l_data = getHbVolatile();
+ if(l_data)
+ {
+ o_data = *l_data;
+ }
+
+ mutex_unlock(&g_PersistMutex);
+ }
+
+ void writeSemiPersistData(const semiPersistData_t i_data)
+ {
+ //Lock to prevent concurrent access
+ mutex_lock(&g_PersistMutex);
+
+ auto l_data = getHbVolatile();
+ if(l_data)
+ {
+ *l_data = i_data;
+ int l_rc = mm_remove_pages(FLUSH, l_data,
+ sizeof(semiPersistData_t));
+ if (l_rc)
+ {
+ TRACFCOMP(g_trac_persist,
+ ERR_MRK"writeSemiPersistData(): mm_remove_pages"
+ "(FLUSH,%p,%d) returned %d",l_data,
+ sizeof(semiPersistData_t),l_rc);
+ }
+ }
+ mutex_unlock(&g_PersistMutex);
+ }
+};
OpenPOWER on IntegriCloud