summaryrefslogtreecommitdiffstats
path: root/src/usr/sbe/sbe_resolve_sides.H
diff options
context:
space:
mode:
authorMike Baiocchi <baiocchi@us.ibm.com>2015-02-17 13:07:13 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2015-03-01 16:22:19 -0600
commit19b0400e8e2123bdfe1231616bfdaf2fc0d1f3e2 (patch)
tree52b29b9d9cf4e40ef379fff36a47a5af6531d6a6 /src/usr/sbe/sbe_resolve_sides.H
parentf8ff70afe17963e03abdbc113cf8c1f6198857c3 (diff)
downloadtalos-hostboot-19b0400e8e2123bdfe1231616bfdaf2fc0d1f3e2.tar.gz
talos-hostboot-19b0400e8e2123bdfe1231616bfdaf2fc0d1f3e2.zip
GOLDEN SBE Update Support - Reconcile SBE images and PNOR sides
This code adds a new function at istep 6 to reconcile the two SBE Seeproms with the PNOR side and mode (ie, 2-sided, golden, etc). It also updates what happens in istep 9 in SBE_UPDATE_INDEPENDENT mode. Change-Id: If71ca52338a179b8cf38cfa336d9790737844715 RTC: 120734 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/15790 Tested-by: Jenkins Server Reviewed-by: PRACHI GUPTA <pragupta@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: Richard J. Knight <rjknight@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/sbe/sbe_resolve_sides.H')
-rw-r--r--src/usr/sbe/sbe_resolve_sides.H259
1 files changed, 259 insertions, 0 deletions
diff --git a/src/usr/sbe/sbe_resolve_sides.H b/src/usr/sbe/sbe_resolve_sides.H
new file mode 100644
index 000000000..42f727ae6
--- /dev/null
+++ b/src/usr/sbe/sbe_resolve_sides.H
@@ -0,0 +1,259 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/sbe/sbe_resolve_sides.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2015 */
+/* [+] 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 __SBE_SBE_RESOLVE_SIDES_H
+#define __SBE_SBE_RESOLVE_SIDES_H
+
+
+#include <stdint.h>
+#include <builtins.h>
+#include <errl/errlentry.H>
+#include <pnor/pnorif.H>
+#include <util/align.H>
+#include <vmmconst.h>
+#include <targeting/common/targetservice.H>
+#include <i2c/eepromif.H>
+#include "sbe_update.H"
+
+namespace SBE
+{
+ /******************************************/
+ /* Constants */
+ /******************************************/
+
+ // This seeprom is a candidate to be READ_ONLY (ie, not updated)
+ const PNOR::sbeSeepromSide_t READ_ONLY_SEEPROM = PNOR::SBE_SEEPROM1;
+
+ // Used to keep SBE Seeproms in sync with EEPROM::eeprom_chip_types_t
+ const EEPROM::eeprom_chip_types_t sbe_side_sync[2] =
+ { EEPROM::SBE_PRIMARY,
+ EEPROM::SBE_BACKUP };
+
+ /******************************************/
+ /* Enums */
+ /******************************************/
+
+ // Actions can be combined
+ enum
+ {
+ NO_ACTIONS = 0x00000000,
+ REIPL = 0x00000001,
+
+ // Use PNOR::ALTERNATE SideId for HBB Address info
+ USE_PNOR_ALT_SIDE = 0x00000002,
+
+ // NOTE: These next 2 values are mutually exclusive
+ CHECK_WORKING_HBB = 0x00000010,
+ COPY_READ_ONLY_TO_WORKING = 0x00000020,
+ };
+
+ /******************************************/
+ /* Structs */
+ /******************************************/
+ struct sbeResolveState_t
+ {
+
+ // Target Information
+ TARGETING::Target* tgt;
+
+ PNOR::sbeSeepromSide_t cur_side; // aka 'booted' side
+ PNOR::sbeSeepromSide_t alt_side; // non-booted/non-cur side
+ PNOR::sbeSeepromSide_t update_side; // side to be updated
+
+ // Info from PNOR
+ PNOR::SideId pnor_sideId;
+ char pnor_side; /**< name of the side either A or B */
+ bool pnor_isGolden; /**< True if side is golden */
+ bool pnor_hasOtherSide; /**< True if a valid alternate side exists*/
+
+ uint32_t actions;
+
+ // Constructor to default certain values
+ sbeResolveState_t() :
+ tgt(NULL), cur_side(PNOR::SBE_SEEPROM_INVALID),
+ alt_side(PNOR::SBE_SEEPROM_INVALID),
+ update_side(PNOR::SBE_SEEPROM_INVALID),
+ pnor_sideId(PNOR::WORKING),
+ pnor_side(NULL),
+ pnor_isGolden(false), pnor_hasOtherSide(false),
+ actions(NO_ACTIONS)
+ {}
+
+ };
+
+
+ /******************************************/
+ /* Functions -- High Level Functions */
+ /******************************************/
+
+ /**
+ * @brief Collects SBE Side Information for a specifc target
+ *
+ * @param[io/out] io_sideState Struct containing SBE State of the target
+ *
+ * @return errlHndl_t Error log handle on failure.
+ */
+ errlHndl_t getSideState(sbeResolveState_t& io_sideState);
+
+ /**
+ * @brief Analyze and Determine Update Actions for a specific target
+ *
+ * @param[io/out] io_sideState Struct containing SBE State of the target
+ *
+ * @return errlHndl_t Error log handle on failure.
+ */
+ errlHndl_t getSideActions(sbeResolveState_t& io_sideState);
+
+ /**
+ * @brief Performs the Update Actions for a specific target
+ *
+ * @param[io/out] io_sideState Struct containing SBE State of the target
+ *
+ * @return errlHndl_t Error log handle on failure.
+ */
+ errlHndl_t performSideActions(sbeResolveState_t& io_sideState);
+
+
+
+ /******************************************/
+ /* Functions -- System Access */
+ /******************************************/
+
+
+ /**
+ * @brief Read SBE Image from SBE Seeprom
+ *
+ * @param[in] i_target Target processor
+ *
+ * @param[out] o_imgPtr Pointer to SBE image in memory
+ * Memory for this pointer is expected to be
+ * pre-alloacted
+ * NOTE: ECC is handled internally in this
+ * function. io_imgPtr points to non-ECC image
+ *
+ * @param[in] i_side Seeprom Side to access
+ *
+ * @param[in] o_image_size The size of the image (non-ECC)
+ *
+ * @param[in] o_version SBE Version struct from seeprom (non-ECC)
+ *
+ * @return errlHndl_t Error log handle on failure.
+ */
+ errlHndl_t readSbeImage(TARGETING::Target* i_target,
+ void* o_imgPtr,
+ PNOR::sbeSeepromSide_t i_side,
+ size_t& o_image_size,
+ sbeSeepromVersionInfo_t& o_version);
+
+ /**
+ * @brief Write SBE Image from SBE Seeprom
+ *
+ * @param[in] i_target Target processor
+ *
+ * @param[in] i_imgPtr Pointer to SBE image in memory
+ * Memory for this pointer is expected to be
+ * pre-alloacted
+ * NOTE: ECC is handled internally in this function
+ * i_imgPtr points to non-ECC image
+ *
+ * @param[in] i_side Seeprom Side to access
+ *
+ * @param[in] i_image_size Size of image to write (non-ECC)
+ *
+ * @param[in] io_version SBE Version struct to write (non-ECC)
+ * NOTE: data_crc updated in this function
+ *
+ * @return errlHndl_t Error log handle on failure.
+ */
+ errlHndl_t writeSbeImage(TARGETING::Target* i_target,
+ void* i_imgPtr,
+ PNOR::sbeSeepromSide_t i_side,
+ size_t i_image_size,
+ sbeSeepromVersionInfo_t& io_version);
+
+
+ /**
+ * @brief Read SBE Image Header from SBE Seeprom and gets the
+ * Image size from the heaser
+ *
+ * @param[in] i_target Target processor
+ *
+ * @param[out] i_imgPtr Pointer to pre-allocated memory to be used
+ * for different operations
+ *
+ * @param[in] i_side Seeprom Side to access
+ *
+ * @param[in] o_image_size The size of the image (non-ECC)
+ *
+ * @return errlHndl_t Error log handle on failure.
+ */
+ errlHndl_t getSbeImageSize(TARGETING::Target* i_target,
+ void* i_imgPtr,
+ PNOR::sbeSeepromSide_t i_side,
+ size_t& o_image_size);
+
+
+
+
+ /******************************************/
+ /* Functions -- Helper Functions */
+ /******************************************/
+
+ /**
+ * @brief Check and Update (if necessary) the HBB Address MMIO offset
+ * in a customized SBE Image for the current Processor
+ *
+ * @param[in] i_target Target processor to customize
+ *
+ * @param[in/out] io_imgPtr Pointer to SBE image in memory
+ * Memory for this pointer is expected to be
+ * pre-alloacted
+ *
+ * @param[in] i_side Seeprom Side to access
+ *
+ * @param[in] i_pnorSideId PNOR side to get information for
+ *
+ * @param[out] o_imageWasUpdated Set to true if Image was updated;
+ * otherwise false
+ *
+ * @return errlHndl_t Error log handle on failure.
+ */
+ errlHndl_t resolveImageHBBaddr(TARGETING::Target* i_target,
+ void* io_imgPtr,
+ PNOR::sbeSeepromSide_t i_side,
+ PNOR::SideId i_pnorSideId,
+ bool& o_imageWasUpdated);
+
+#ifdef CONFIG_BMC_IPMI
+ /**
+ * @brief Performs any necessary IPMI calls before shutting down the system
+ *
+ * @return void Any generated Error Logs will be commited before the
+ * function returns
+ */
+ void sbePreShutdownIpmiCalls( void );
+#endif
+
+} //end namespace SBE
+#endif
OpenPOWER on IntegriCloud