summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/usr/makefile3
-rw-r--r--src/usr/sbe/makefile20
-rw-r--r--src/usr/sbe/sbe_resolve_sides.C245
-rw-r--r--src/usr/sbe/sbe_resolve_sides.H27
-rw-r--r--src/usr/sbe/sbe_update.C519
-rw-r--r--src/usr/sbe/sbe_update.H99
-rw-r--r--src/usr/sbe/test/sbeupdatetest.H63
7 files changed, 177 insertions, 799 deletions
diff --git a/src/usr/makefile b/src/usr/makefile
index 7fe766a0c..d00e11fe1 100644
--- a/src/usr/makefile
+++ b/src/usr/makefile
@@ -57,8 +57,7 @@ SUBDIRS += ibscom.d
SUBDIRS += dump.d
SUBDIRS += secureboot.d
SUBDIRS += devtree.d
-#@TODO RTC:142091
-#SUBDIRS += sbe.d
+SUBDIRS += sbe.d
SUBDIRS += sbeio.d
SUBDIRS += gpio.d
SUBDIRS += lpc.d
diff --git a/src/usr/sbe/makefile b/src/usr/sbe/makefile
index c45206e1e..878d46d94 100644
--- a/src/usr/sbe/makefile
+++ b/src/usr/sbe/makefile
@@ -5,7 +5,7 @@
#
# OpenPOWER HostBoot Project
#
-# Contributors Listed Below - COPYRIGHT 2013,2015
+# Contributors Listed Below - COPYRIGHT 2013,2016
# [+] International Business Machines Corp.
#
#
@@ -25,17 +25,17 @@
ROOTPATH = ../../..
MODULE = sbe
-## support for Targeting and fapi
-EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer
-EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi
-EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat
-EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp
+## support for fapi2
+EXTRAINCDIR += ${ROOTPATH}/src/import/hwpf/fapi2/include/
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/fapi2/
## pointer to common HWP files
-EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/include
-
-## pointer to already consumed procedures.
-EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/common/include/
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/utils/imageProcs/
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/lib/
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/utils/stopreg/
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/customize
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/xip
OBJS += sbe_update.o
OBJS += sbe_resolve_sides.o
diff --git a/src/usr/sbe/sbe_resolve_sides.C b/src/usr/sbe/sbe_resolve_sides.C
index b27372ee6..02dd1b3f7 100644
--- a/src/usr/sbe/sbe_resolve_sides.C
+++ b/src/usr/sbe/sbe_resolve_sides.C
@@ -32,6 +32,7 @@
#include <targeting/common/predicates/predicatectm.H>
#include <targeting/common/utilFilter.H>
#include <targeting/common/targetservice.H>
+#include <util/crc32.H>
#include <util/misc.H>
#include <pnor/pnorif.H>
#include <pnor/ecc.H>
@@ -51,15 +52,11 @@
#include "sbe_update.H"
// fapi support
-#include <fapi.H>
-#include <fapiHwpExecutor.H>
-#include <hwpf/plat/fapiPlatHwpInvoker.H>
-#include <hwpf/plat/fapiPlatTrace.H>
+#include <fapi2.H>
+#include <fapi2/plat_hwp_invoker.H>
//Procedures
-#include <p8_xip_customize.H>
-#include <sbe_xip_image.h>
-#include <p8_image_help_base.H>
+#include <p9_xip_image.h>
// ----------------------------------------------
// Trace definitions
@@ -71,23 +68,11 @@ extern trace_desc_t* g_trac_sbe;
//#define TRACUCOMP(args...) TRACFCOMP(args)
#define TRACUCOMP(args...)
-
using namespace ERRORLOG;
using namespace TARGETING;
namespace SBE
{
- enum {
- SBE_IMG_VADDR = VMM_VADDR_SBE_UPDATE,
- RING_BUF1_VADDR = FIXED_SEEPROM_WORK_SPACE + SBE_IMG_VADDR,
- RING_BUF2_VADDR = RING_BUF1_VADDR + FIXED_RING_BUF_SIZE,
- //NOTE: recycling the same memory space for different
- //steps in the process.
- SBE_ECC_IMG_VADDR = RING_BUF1_VADDR,
- SBE_ECC_IMG_MAX_SIZE = VMM_VADDR_SBE_UPDATE_END - SBE_ECC_IMG_VADDR,
- };
-
-/////////////////////////////////////////////////////////////////////
errlHndl_t resolveProcessorSbeSeeproms()
{
errlHndl_t err = NULL;
@@ -127,7 +112,7 @@ errlHndl_t resolveProcessorSbeSeeproms()
TRACFCOMP( g_trac_sbe, INFO_MRK"resolveProcessorSbeSeeproms() - "
"Do Nothing in SBE_UPDATE_SEQUENTIAL mode with FSP-"
"services enabled or running in simics");
- break;
+ break;
}
#endif
@@ -137,7 +122,7 @@ errlHndl_t resolveProcessorSbeSeeproms()
{
TRACFCOMP( g_trac_sbe, INFO_MRK"resolveProcessorSbeSeeproms() - "
"Do Nothing in SBE_UPDATE_INDEPENDENT mode in simics");
- break;
+ break;
}
// Get Target Service, and the system target.
@@ -437,7 +422,6 @@ errlHndl_t getSideActions(sbeResolveState_t& io_sideState)
ENTER_MRK"getSideActions()" );
do{
-
// Check if PNOR is running from its GOLDEN side
if ( io_sideState.pnor_isGolden == true )
{
@@ -517,7 +501,6 @@ errlHndl_t performSideActions(sbeResolveState_t& io_sideState)
TRACUCOMP( g_trac_sbe,
ENTER_MRK"performSideActions()" );
- bool updateForHBB = false;
size_t image_size = 0;
sbeSeepromVersionInfo_t image_version;
@@ -541,6 +524,19 @@ errlHndl_t performSideActions(sbeResolveState_t& io_sideState)
io_sideState.actions, image_size);
break;
}
+
+ // The host has booted from the golden side because the action
+ // COPY_READ_ONLY_TO_WORKING implies io_sideState.pnor_isGolden.
+ // We need the version info written to indicate that the SBE
+ // Seeprom Image originates from the golden side Seeprom.
+
+ // indicate that the version struct is the latest version
+ image_version.struct_version = STRUCT_VERSION_LATEST;
+
+ // indicate that the SBE image we are copying originates from
+ // the golden side seeprom. This value will be read and printed
+ // in the traces each time getSeepromSideVersion is called.
+ image_version.origin = GOLDEN_SIDE;
}
if ( io_sideState.actions & CHECK_WORKING_HBB )
@@ -565,60 +561,9 @@ errlHndl_t performSideActions(sbeResolveState_t& io_sideState)
io_sideState.actions, image_size);
break;
}
-
}
-
- if ( ( io_sideState.actions & COPY_READ_ONLY_TO_WORKING ) ||
- ( io_sideState.actions & CHECK_WORKING_HBB ) )
- {
- // verify HBB
- PNOR::SideId pnor_side = PNOR::WORKING;
-
-#ifdef CONFIG_PNOR_TWO_SIDE_SUPPORT
- // In certain situations need info from Alternate PNOR
- if ( io_sideState.actions & USE_PNOR_ALT_SIDE)
- {
- pnor_side = PNOR::ALTERNATE;
- }
-#endif
-
-
-
- err = resolveImageHBBaddr(io_sideState.tgt,
- reinterpret_cast<void*>(SBE_IMG_VADDR),
- io_sideState.update_side,
- pnor_side,
- updateForHBB);
- if ( err )
- {
- TRACFCOMP( g_trac_sbe, ERR_MRK
- "performSideActions: Error returned from "
- "resolveImageHBBaddr() rc=0x%.4X, Target UID=0x%X, "
- "actions = 0x%X",
- err->reasonCode(),
- TARGETING::get_huid(io_sideState.tgt),
- io_sideState.actions);
- break;
- }
-
- // Since HBB was updated, we need to re-IPL if not booting on
- // READ_ONLY seeprom
- if ( ( updateForHBB == true ) &&
- ( io_sideState.cur_side != READ_ONLY_SEEPROM ) )
- {
- io_sideState.actions |= REIPL;
-
- TRACUCOMP( g_trac_sbe, ERR_MRK
- "performSideActions: resolveImageHBBaddr returned "
- "updateForHBB=%d, and not on READ_ONLY_SEEPROM so "
- "REIPL (actions=0x%X)",
- updateForHBB, io_sideState.actions);
- }
- }
-
- if ( ( io_sideState.actions & COPY_READ_ONLY_TO_WORKING ) ||
- ( updateForHBB == true ) )
+ if ( io_sideState.actions & COPY_READ_ONLY_TO_WORKING )
{
// Write Seeprom Image from memory to Seeprom
err = writeSbeImage(io_sideState.tgt,
@@ -1024,8 +969,6 @@ errlHndl_t writeSbeImage(TARGETING::Target* i_target,
}
-
-
/////////////////////////////////////////////////////////////////////
errlHndl_t getSbeImageSize(TARGETING::Target* i_target,
void* i_imgPtr,
@@ -1049,13 +992,13 @@ errlHndl_t getSbeImageSize(TARGETING::Target* i_target,
"getSbeImageSize() - i_imgPtr is not at SBE_IMG_VADDR");
do{
- // Need to read the SbeXipHeader of the image to determine size
+ // Need to read the P9XipHeader of the image to determine size
// of the image to read out.
// Using io_imgPtr space. First read our header+ECC from SBE
// Seeprom and then use space after that to put header without ECC
- size_t hdr_size = ALIGN_8(sizeof(SbeXipHeader));
+ size_t hdr_size = ALIGN_8(sizeof(P9XipHeader));
size_t hdr_size_ECC = (hdr_size * 9)/8;
uint8_t* hdr_ptr = reinterpret_cast<uint8_t*>(i_imgPtr) + hdr_size_ECC;
@@ -1063,7 +1006,7 @@ errlHndl_t getSbeImageSize(TARGETING::Target* i_target,
memset( i_imgPtr, 0, hdr_size_ECC + hdr_size );
TRACUCOMP( g_trac_sbe, INFO_MRK"getSetSbeImage() Reading "
- "SbeXipHeader for Target 0x%X, Seeprom %d "
+ "P9XipHeader for Target 0x%X, Seeprom %d "
"(side=%d), size_ECC=0x%X (size=0x%X)",
TARGETING::get_huid(i_target),
l_seeprom, i_side, hdr_size_ECC, hdr_size );
@@ -1079,10 +1022,10 @@ errlHndl_t getSbeImageSize(TARGETING::Target* i_target,
if(err)
{
TRACFCOMP( g_trac_sbe, ERR_MRK"getSbeImageSize: - Error "
- "Reading SbeXipHeader: rc=0x%.4X, seeprom=%d (side=%d). "
+ "Reading P9XipHeader: rc=0x%.4X, seeprom=%d (side=%d). "
"HUID=0x%.8X. size=0x%.8X, EEPROM offset=0x%X",
err->reasonCode(), l_seeprom, i_side,
- TARGETING::get_huid(i_target), sizeof(SbeXipHeader),
+ TARGETING::get_huid(i_target), sizeof(P9XipHeader),
SBE_IMAGE_SEEPROM_ADDRESS);
break;
}
@@ -1146,7 +1089,7 @@ errlHndl_t getSbeImageSize(TARGETING::Target* i_target,
hdr_ptr,
hdr_size );
- o_image_size = (((SbeXipHeader*)hdr_ptr)->iv_imageSize);
+ o_image_size = (((P9XipHeader*)hdr_ptr)->iv_imageSize);
}while(0);
@@ -1157,142 +1100,6 @@ errlHndl_t getSbeImageSize(TARGETING::Target* i_target,
}
-
-/////////////////////////////////////////////////////////////////////
-errlHndl_t resolveImageHBBaddr(TARGETING::Target* i_target,
- void* io_imgPtr,
- sbeSeepromSide_t i_side,
- PNOR::SideId i_pnorSideId,
- bool& o_imageWasUpdated )
-{
- errlHndl_t err = NULL;
- uint64_t data = 0;
- int rc = 0;
- bool rc_fail_on_get = false; // 1=get failed, 0=set failed
-
- o_imageWasUpdated = false;
-
- TRACUCOMP( g_trac_sbe,
- ENTER_MRK"resolveImageHBBaddr() - tgt=0x%X, i_side=%d, "
- "i_pnorSideId=%d",
- TARGETING::get_huid(i_target), i_side, i_pnorSideId);
-
- do{
-
- // Get info from PNOR
- PNOR::SideInfo_t pnor_side_info;
- err = PNOR::getSideInfo (i_pnorSideId, pnor_side_info);
- if ( err )
- {
- TRACFCOMP( g_trac_sbe, ERR_MRK
- "resolveImageHBBaddr() - Error returned "
- "from PNOR::getSideInfo() rc=0x%.4X, Target UID=0x%X "
- "i_pnorSideId",
- err->reasonCode(),
- TARGETING::get_huid(i_target), i_pnorSideId);
- break;
- }
-
- // Only Need to Check/Update if PNOR has Other Side
- if ( pnor_side_info.hasOtherSide == true )
- {
- // Read the MMIO offset associated with the HBB address
- // from the image
- rc = sbe_xip_get_scalar( io_imgPtr,
- "standalone_mbox2_value",
- &data);
- if ( rc != 0 )
- {
- rc_fail_on_get = true; // get failed
-
- TRACFCOMP( g_trac_sbe, ERR_MRK"resolveImageHBBaddr() - "
- "sbe_xip_get_scalar() failed rc = 0x%X (%d)",
- rc, rc_fail_on_get);
- break;
- }
-
- if ( pnor_side_info.hbbMmioOffset == data )
- {
- TRACUCOMP( g_trac_sbe, "resolveImageHBBaddr: Image has MMIO "
- "offset = 0x%X that matches PNOR MMIO="
- "0x%X for HBB Address=0x%X",
- data, pnor_side_info.hbbMmioOffset,
- pnor_side_info.hbbAddress);
- }
- else
- {
- TRACFCOMP( g_trac_sbe, "resolveImageHBBaddr: Image has MMIO "
- "offset = 0x%X does NOT match PNOR MMIO="
- "0x%X for HBB Address=0x%X. Updating Image",
- data, pnor_side_info.hbbMmioOffset,
- pnor_side_info.hbbAddress);
-
- TRACDBIN (g_trac_sbe, "resolveImageHBBaddr: data", &data, 8 );
-
- TRACDBIN (g_trac_sbe, "resolveImageHBBaddr: hbbMmioOffset",
- &pnor_side_info.hbbMmioOffset, 8 );
- TRACDBIN (g_trac_sbe, "resolveImageHBBaddr: hbbAddress",
- &pnor_side_info.hbbAddress, 8);
-
- rc = sbe_xip_set_scalar( io_imgPtr, "standalone_mbox2_value",
- pnor_side_info.hbbMmioOffset);
-
- if ( rc != 0 )
- {
- rc_fail_on_get = false; // set failed
-
- TRACFCOMP( g_trac_sbe, ERR_MRK"resolveImageHBBaddr() - "
- "sbe_xip_set_scalar() failed rc = 0x%X (%d)",
- rc, rc_fail_on_get);
- break;
- }
- o_imageWasUpdated = true;
- }
-
- }
- else
- {
- // pnor_side_info.hasOtherSide is false
- TRACUCOMP( g_trac_sbe, "resolveImageHBBaddr: PNOR only has "
- "1 side - No Update Required");
- }
-
- }while(0);
-
-
- if ( ( err == NULL ) && ( rc != 0) )
- {
- // We failed on get/set cmd above (already traced)
-
- /*@
- * @errortype
- * @moduleid SBE_RESOLVE_HBB_ADDR
- * @reasoncode SBE_IMAGE_GET_SET_SCALAR_FAIL
- * @userdata1 Return Code of failed operation
- * @userdata2 True/False if Get (true) or Set (false) Op failed
- * @devdesc sbe_xip_get/set_scalar() failed when accessing the
- HBB Address MMIO offset in 'standalone_mbox2_value'
- * @custdesc A problem occurred while updating processor
- * boot code.
- */
- err = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
- SBE_RESOLVE_HBB_ADDR,
- SBE_IMAGE_GET_SET_SCALAR_FAIL,
- TO_UINT64(rc),
- TO_UINT64(rc_fail_on_get),
- true /*Add HB SW Callout*/ );
-
- err->collectTrace(SBE_COMP_NAME);
- }
-
-
- TRACUCOMP( g_trac_sbe,
- EXIT_MRK"resolveImageHBBaddr() - o_imageWasUpdated = %d",
- o_imageWasUpdated);
-
- return err;
-}
-
#ifdef CONFIG_BMC_IPMI
/////////////////////////////////////////////////////////////////////
errlHndl_t sbePreRebootIpmiCalls( void )
diff --git a/src/usr/sbe/sbe_resolve_sides.H b/src/usr/sbe/sbe_resolve_sides.H
index 66797a92f..3400b6a1a 100644
--- a/src/usr/sbe/sbe_resolve_sides.H
+++ b/src/usr/sbe/sbe_resolve_sides.H
@@ -204,7 +204,7 @@ namespace SBE
*
* @param[in] i_target Target processor
*
- * @param[out] i_imgPtr Pointer to pre-allocated memory to be used
+ * @param[in] i_imgPtr Pointer to pre-allocated memory to be used
* for different operations
*
* @param[in] i_side Seeprom Side to access
@@ -225,31 +225,6 @@ namespace SBE
/* 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,
- sbeSeepromSide_t i_side,
- PNOR::SideId i_pnorSideId,
- bool& o_imageWasUpdated);
-
#ifdef CONFIG_BMC_IPMI
/**
* @brief Performs any necessary IPMI calls before reboot the system
diff --git a/src/usr/sbe/sbe_update.C b/src/usr/sbe/sbe_update.C
index 627c87013..46ecc8a03 100644
--- a/src/usr/sbe/sbe_update.C
+++ b/src/usr/sbe/sbe_update.C
@@ -55,15 +55,11 @@
#include "sbe_resolve_sides.H"
// fapi support
-#include <fapi.H>
-#include <fapiHwpExecutor.H>
-#include <hwpf/plat/fapiPlatHwpInvoker.H>
-#include <hwpf/plat/fapiPlatTrace.H>
+#include <fapi2.H>
+#include <fapi2/plat_hwp_invoker.H>
//Procedures
-#include <p8_xip_customize.H>
-#include <sbe_xip_image.h>
-#include <p8_image_help_base.H>
+#include <p9_xip_customize.H>
// ----------------------------------------------
// Trace definitions
@@ -76,7 +72,6 @@ TRAC_INIT( & g_trac_sbe, SBE_COMP_NAME, KILOBYTE );
//#define TRACUCOMP(args...) TRACFCOMP(args)
#define TRACUCOMP(args...)
-
// ----------------------------------------
// Global Variables for MBOX Ipl Query
static bool g_mbox_query_done = false;
@@ -90,17 +85,6 @@ using namespace TARGETING;
namespace SBE
{
- enum {
- SBE_IMG_VADDR = VMM_VADDR_SBE_UPDATE,
- RING_BUF1_VADDR = FIXED_SEEPROM_WORK_SPACE + SBE_IMG_VADDR,
- RING_BUF2_VADDR = RING_BUF1_VADDR + FIXED_RING_BUF_SIZE,
- //NOTE: recycling the same memory space for different
- //steps in the process.
- SBE_ECC_IMG_VADDR = RING_BUF1_VADDR,
- SBE_ECC_IMG_MAX_SIZE = VMM_VADDR_SBE_UPDATE_END - SBE_ECC_IMG_VADDR,
- };
-
-/////////////////////////////////////////////////////////////////////
errlHndl_t updateProcessorSbeSeeproms(sbeUpdateCheckType i_check_type)
{
errlHndl_t err = NULL;
@@ -209,7 +193,7 @@ namespace SBE
g_mbox_query_done = false;
g_mbox_query_result = false;
- // Create VMM space for p8_xip_customize() procedure
+ // Create VMM space for p9_xip_customize() procedure
err = createSbeImageVmmSpace();
if (err)
{
@@ -272,7 +256,7 @@ namespace SBE
TRACUCOMP( g_trac_sbe, "updateProcessorSbeSeeproms(): "
"Main Loop: tgt=0x%X, i=%d",
- TARGETING::get_huid(sbeState.target), i)
+ TARGETING::get_huid(sbeState.target), i);
// Check to see if current target is master processor
if ( sbeState.target == masterProcChipTargetHandle)
@@ -713,7 +697,8 @@ namespace SBE
// it includes a SBE Header
if (pnorInfo.sha512perEC)
{
- TRACFCOMP(g_trac_sbe,INFO_MRK"findSBEInPnor: sha512perEC Found in %s", pnorInfo.name);
+ TRACFCOMP(g_trac_sbe,INFO_MRK"findSBEInPnor: sha512perEC "
+ "Found in %s", pnorInfo.name);
// Advance PNOR pointer 4k to move it past header page to the
// start of the non-customized SBE image
o_imgPtr = reinterpret_cast<void*>
@@ -751,14 +736,10 @@ namespace SBE
void* io_imgPtr,
size_t& o_actImgSize)
{
+ // @TODO RTC:158044 Code removed after earlier review comment may still
+ // be needed. Use Story 158044 to replace.
errlHndl_t err = NULL;
- fapi::ReturnCode rc_fapi = fapi::FAPI_RC_SUCCESS;
- uint32_t coreMask = 0x0000FFFF;
- size_t maxCores = P8_MAX_EX_PER_PROC;
- int coreCount = 0;
- uint32_t procIOMask = 0;
uint32_t tmpImgSize = static_cast<uint32_t>(i_maxImgSize);
- bool procedure_success = false;
TRACUCOMP( g_trac_sbe,
ENTER_MRK"procCustomizeSbeImg(): uid=0x%X, i_sbePnorPtr= "
@@ -769,360 +750,46 @@ namespace SBE
do{
// cast OUR type of target to a FAPI type of target.
- const fapi::Target
- l_fapiTarg(fapi::TARGET_TYPE_PROC_CHIP,
- (const_cast<TARGETING::Target*>(i_target)));
-
- // NOTE: The p8_xip_customize_procedure uses SBE_IMAGE_OFFSET
- // attribute for HBB address value. Purpsely leaving this
- // attribute as-is for now and will do the check for HBB address
- // later.
-
- // The p8_xip_customize() procedure tries to include as much core
- // information as possible, but is limited by SBE Image size
- // constraints.
- // First, maximize core mask for the target
- // Then loop on the procedure call, where the loop is designed to
- // remove the number of cores passed into p8_xip_customize() until
- // an image can be created successfully.
-
- // Maximize Core mask for this target
- err = selectBestCores(i_target,
- maxCores,
- coreMask);
- if(err)
- {
- TRACFCOMP( g_trac_sbe, ERR_MRK"procCustomizeSbeImg() - "
- "selectBestCores() failed rc=0x%X. "
- "MaxCores=0x%.8X. HUID=0x%X. Aborting "
- "Customization of SBE Image",
- err->reasonCode(), maxCores,
- TARGETING::get_huid(i_target));
- break;
- }
-
- // setup loop parameters
- coreCount = __builtin_popcount(coreMask);
- procIOMask = coreMask;
-
- while( coreCount >= 0 )
+ const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>
+ l_fapiTarg(i_target);
+
+ FAPI_INVOKE_HWP( err,
+ p9_xip_customize,
+ l_fapiTarg,
+ i_sbePnorPtr, //image in
+ tmpImgSize,
+ 0, //IPL
+ (void*)RING_BUF1_VADDR,
+ (uint32_t)FIXED_RING_BUF_SIZE,
+ (void*)RING_BUF2_VADDR,
+ (uint32_t)FIXED_RING_BUF_SIZE );
+
+ if ( err )
{
+ TRACFCOMP(g_trac_sbe,
+ ERR_MRK"procCustomizeSbeImg() - "
+ "p9_xip_customize HWP failed rc=0x%X. "
+ "HUID=0x%X. Aborting Customization of SBE Image",
+ err->reasonCode(),
+ TARGETING::get_huid(i_target));
- FAPI_EXEC_HWP( rc_fapi,
- p8_xip_customize,
- l_fapiTarg,
- i_sbePnorPtr, //image in
- io_imgPtr, //image out
- tmpImgSize,
- 0, //IPL
- 0, //HB/IPL
- (void*)RING_BUF1_VADDR,
- (uint32_t)FIXED_RING_BUF_SIZE,
- (void*)RING_BUF2_VADDR,
- (uint32_t)FIXED_RING_BUF_SIZE,
- procIOMask);
-
- // Check the return code
- if ( !rc_fapi )
- {
- // Procedure was successful
- procedure_success = true;
-
- o_actImgSize = static_cast<size_t>(tmpImgSize);
-
- TRACUCOMP( g_trac_sbe, "procCustomizeSbeImg(): "
- "p8_xip_customize success=%d, procIOMask=0x%X "
- "o_actImgSize=0x%X, rc_fapi=0x%X",
- procedure_success, procIOMask, o_actImgSize,
- uint32_t(rc_fapi));
-
- // exit loop
- break;
- }
- else
- {
- // Look for a specific return code
- if ( static_cast<uint32_t>(rc_fapi) ==
- fapi::RC_PROC_XIPC_OVERFLOW_BEFORE_REACHING_MINIMUM_EXS
- )
- {
- // This is a specific return code from p8_xip_customize
- // where the cores sent in couldn't fit, but possibly
- // a different procIOMask would work
-
- TRACFCOMP( g_trac_sbe,
- ERR_MRK"procCustomizeSbeImg(): FAPI_EXEC_HWP("
- "p8_xip_customize) returned rc=0x%X, "
- "XIPC_OVERFLOW_BEFORE_REACHING_MINIMUM_EXS-Retry "
- "MaxCores=0x%.8X. HUID=0x%X. coreMask=0x%.8X, "
- "procIOMask=0x%.8X. coreCount=%d",
- uint32_t(rc_fapi), maxCores,
- TARGETING::get_huid(i_target),
- coreMask, procIOMask, coreCount);
-
- // Setup for next loop - update coreMask
- err = selectBestCores(i_target,
- --coreCount,
- procIOMask);
-
- if ( err )
- {
- TRACFCOMP(g_trac_sbe,
- ERR_MRK"procCustomizeSbeImg() - "
- "selectBestCores() failed rc=0x%X. "
- "coreCount=0x%.8X. HUID=0x%X. Aborting "
- "Customization of SBE Image",
- err->reasonCode(), coreCount,
- TARGETING::get_huid(i_target));
-
- // break from while loop
- break;
- }
-
- TRACFCOMP( g_trac_sbe, "procCustomizeSbeImg(): for "
- "next loop: procIOMask=0x%.8X, coreMask="
- "0x%.8X, coreCount=%d",
- procIOMask, coreMask, coreCount);
-
- // No break - keep looping
- }
- else
- {
- // Unexpected return code - create err and fail
- TRACFCOMP( g_trac_sbe,
- ERR_MRK"procCustomizeSbeImg(): FAPI_EXEC_HWP("
- "p8_xip_customize) failed with rc=0x%X, "
- "MaxCores=0x%X. HUID=0x%X. coreMask=0x%.8X, "
- "procIOMask=0x%.8X. coreCount=%d. Create "
- "err and break loop",
- uint32_t(rc_fapi), maxCores,
- TARGETING::get_huid(i_target),
- coreMask, procIOMask, coreCount);
-
- err = fapiRcToErrl(rc_fapi);
-
- ERRORLOG::ErrlUserDetailsTarget(i_target,
- "Proc Target")
- .addToLog(err);
- err->collectTrace(SBE_COMP_NAME, 256);
-
- // break from while loop
- break;
- }
- }
- } // end of while loop
-
-
- if(err)
- {
- // There was a previous error, so break here
+ // There was an error, so break here
break;
}
- if ( procedure_success == false )
- {
- // No err, but exit from while loop before successful
- TRACFCOMP( g_trac_sbe, ERR_MRK"procCustomizeSbeImg() - "
- "Failure to successfully complete p8_xip_customize()"
- ". HUID=0x%X, rc=0x%X, coreCount=%d, coreMask=0x%.8X"
- " procIOMask=0x%.8X, maxCores=0x%X",
- TARGETING::get_huid(i_target), uint32_t(rc_fapi),
- coreCount, coreMask, procIOMask, maxCores);
- /*@
- * @errortype
- * @moduleid SBE_CUSTOMIZE_IMG
- * @reasoncode SBE_P8_XIP_CUSTOMIZE_UNSUCCESSFUL
- * @userdata1[0:31] procIOMask in/out parameter
- * @userdata1[32:63] rc of procedure
- * @userdata2[0:31] coreMask of target
- * @userdata2[32:63] coreCount - updated on the loops
- * @devdesc Unsuccessful in creating Customized SBE Image
- * @custdesc A problem occurred while updating processor
- * boot code.
- */
- err = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
- SBE_CUSTOMIZE_IMG,
- SBE_P8_XIP_CUSTOMIZE_UNSUCCESSFUL,
- TWO_UINT32_TO_UINT64(procIOMask,
- uint32_t(rc_fapi)),
- TWO_UINT32_TO_UINT64(coreMask,
- coreCount));
-
- ErrlUserDetailsTarget(i_target
- ).addToLog(err);
- err->collectTrace("FAPI", 256);
- err->collectTrace(SBE_COMP_NAME, 256);
- err->addProcedureCallout( HWAS::EPUB_PRC_HB_CODE,
- HWAS::SRCI_PRIORITY_HIGH );
- }
+ o_actImgSize = static_cast<size_t>(tmpImgSize);
}while(0);
TRACUCOMP( g_trac_sbe,
EXIT_MRK"procCustomizeSbeImg(): io_imgPtr=%p, "
- "o_actImgSize=0x%X, rc_fapi=0x%X, procedure_success=%d",
- io_imgPtr, o_actImgSize, uint32_t(rc_fapi),
- procedure_success );
+ "o_actImgSize=0x%X, RC=0x%X",
+ io_imgPtr, o_actImgSize, ERRL_GETRC_SAFE(err) );
return err;
}
/////////////////////////////////////////////////////////////////////
- errlHndl_t selectBestCores(TARGETING::Target* i_target,
- size_t i_maxExs,
- uint32_t& o_exMask)
- {
- TRACUCOMP( g_trac_sbe,
- ENTER_MRK"selectBestCores(i_maxCores=0x%.8X)",
- i_maxExs);
-
- errlHndl_t err = NULL;
- uint32_t manGuardExs = 0x00000000;
- uint32_t remainingExs = 0x00000000;
- uint32_t exCount = 0;
- uint32_t deconfigByEid = 0;
-
- o_exMask = 0x00000000;
-
- do{
-
- // Special case: if i_maxExs == 0 don't loop through EXs
- if (unlikely(i_maxExs == 0 ))
- {
- break;
- }
-
- // find all EX chiplets of the proc
- TARGETING::TargetHandleList l_exTargetList;
- TARGETING::getChildChiplets( l_exTargetList,
- i_target,
- TARGETING::TYPE_EX,
- false); // return all
-
- //Sort through cores
- for ( TargetHandleList::const_iterator
- l_iterEX = l_exTargetList.begin();
- l_iterEX != l_exTargetList.end();
- ++l_iterEX )
- {
- // make a local copy of the EX target
- const TARGETING::Target* l_ex_target = *l_iterEX;
-
- if( !(l_ex_target->
- getAttr<TARGETING::ATTR_HWAS_STATE>().present) )
- {
- // not present, so skip and continue
- continue;
- }
-
-
- uint8_t chipUnit = l_ex_target->
- getAttr<TARGETING::ATTR_CHIP_UNIT>();
-
- if(l_ex_target->
- getAttr<TARGETING::ATTR_HWAS_STATE>().functional)
- {
- o_exMask |= (0x00008000 >> chipUnit);
- exCount++;
- }
- else
- {
- //If non-functional due to FCO or Manual gard,
- //add it to list of exs to include if
- //more are needed
-
- deconfigByEid = l_ex_target->
- getAttr<TARGETING::ATTR_HWAS_STATE>().
- deconfiguredByEid;
- if(
- // FCO
- (deconfigByEid ==
- HWAS::DeconfigGard::DECONFIGURED_BY_FIELD_CORE_OVERRIDE)
- || // Manual GARD
- (deconfigByEid ==
- HWAS::DeconfigGard::DECONFIGURED_BY_MANUAL_GARD)
- )
- {
- manGuardExs |= (0x00008000 >> chipUnit);
- }
- // Add it to the 'remaining' list in case
- // more are needed
- else
- {
- remainingExs |= (0x00008000 >> chipUnit);
- }
-
- }
- } // end ex target loop
-
- if(exCount == i_maxExs)
- {
- //We've found the exact amount, break out of function
- break;
- }
-
- else if(exCount > i_maxExs)
- {
- //We have too many, so need to trim
- o_exMask = trimBitMask(o_exMask,
- i_maxExs);
- break;
- }
-
- else
- {
- // We need to add 'other' cores
- TRACUCOMP( g_trac_sbe,INFO_MRK"selectBestCores: non-functional "
- "cores needed for bit mask: exCount=%d, i_maxExs=%d,"
- " o_exMask=0x%.8X, manGuardExs=0x%.8X, "
- "remainingExs=0x%.8X",
- exCount, i_maxExs, o_exMask, manGuardExs,
- remainingExs );
- }
-
- // Add more 'good' exs.
- manGuardExs = trimBitMask(manGuardExs,
- i_maxExs-exCount);
- o_exMask |= manGuardExs;
- exCount = __builtin_popcount(o_exMask);
- TRACUCOMP( g_trac_sbe,INFO_MRK"selectBestCores: trimBitMask "
- "manGuardExs=0x%.8X", manGuardExs);
-
- if(exCount >= i_maxExs)
- {
- //We've found enough, break out of function
- break;
- }
-
- // If we still need more, add 'remaining' exs
- // Get Target Service
- // System target check done earlier, so no assert check necessary
- TargetService& tS = targetService();
- TARGETING::Target* sys = NULL;
- (void) tS.getTopLevelTarget( sys );
-
- uint32_t min_exs = sys->getAttr<ATTR_SBE_IMAGE_MINIMUM_VALID_EXS>();
- if ( exCount < min_exs )
- {
- remainingExs = trimBitMask(remainingExs,
- min_exs-exCount);
- o_exMask |= remainingExs;
- TRACUCOMP( g_trac_sbe,INFO_MRK"selectBestCores: trimBitMask "
- "remainingExs=0x%.8X, min_exs=%d",
- remainingExs, min_exs);
- }
-
- }while(0);
-
- TRACUCOMP( g_trac_sbe,
- EXIT_MRK"selectBestCores(o_exMask=0x%.8X)",
- o_exMask);
-
- return err;
- }
-
-
-/////////////////////////////////////////////////////////////////////
errlHndl_t getSetMVPDVersion(TARGETING::Target* i_target,
opType_t i_op,
mvpdSbKeyword_t& io_sb_keyword)
@@ -1621,7 +1288,6 @@ namespace SBE
uint8_t * tmp_data_ECC = static_cast<uint8_t*>(
malloc(sbeInfoSize_ECC));
-
do{
/***********************************************/
@@ -1670,8 +1336,7 @@ namespace SBE
eccStatus, o_info.struct_version, o_info.data_crc);
- if ( ( o_info.struct_version == 1 ) ||
- o_info.struct_version == 2 )
+ if ( STRUCT_VERSION_CHECK(o_info.struct_version) )
{
// Supported Versions - set size variable to remove ECC
sbeInfoSize = SBE_SEEPROM_STRUCT_SIZES[o_info.struct_version];
@@ -1695,16 +1360,15 @@ namespace SBE
reinterpret_cast<uint8_t*>(&o_info),
sbeInfoSize);
- TRACUCOMP( g_trac_sbe, "getSeepromSideVersion(): eccStatus=%d, "
- "sizeof o_info/sI=%d, sI_ECC=%d",
- eccStatus, sbeInfoSize, sbeInfoSize_ECC);
+ TRACFCOMP( g_trac_sbe, "getSeepromSideVersion(): eccStatus=%d, "
+ "sizeof o_info/sI=%d, sI_ECC=%d, origin golden=%i",
+ eccStatus, sbeInfoSize, sbeInfoSize_ECC, o_info.origin);
// Handle Uncorrectable ECC - no error log:
// clear data and set o_seeprom_ver_ECC_fail=true
if ( eccStatus == PNOR::ECC::UNCORRECTABLE )
{
-
- TRACFCOMP( g_trac_sbe,ERR_MRK"getSeepromSideVersion() - ECC "
+ TRACFCOMP( g_trac_sbe, ERR_MRK"getSeepromSideVersion() - ECC "
"ERROR: Handled. eccStatus=%d, side=%d, sizeof "
"o_info/sI=%d, sI_ECC=%d",
eccStatus, i_seepromSide, sbeInfoSize,
@@ -1780,11 +1444,12 @@ namespace SBE
/*************************************************************/
// Create Invalid Version struct (which is always 8-byte aligned)
- for ( uint8_t i = 0; i < (sbeInfoSize)/8; i++ )
+ uint8_t* sbeInfoEnd = sbeInfo_data + sbeInfoSize;
+ for (uint64_t* p = reinterpret_cast<uint64_t*>(sbeInfo_data);
+ p < reinterpret_cast<uint64_t*>(sbeInfoEnd);
+ p++)
{
- memcpy(&sbeInfo_data[i*8],
- &SBE_SEEPROM_STRUCT_INVALID,
- sizeof(uint64_t));
+ *p = SBE_SEEPROM_STRUCT_INVALID;
}
// Inject ECC to Data
@@ -2170,7 +1835,7 @@ namespace SBE
// Check if in simics
if ( ( io_sbeState.seeprom_0_ver.struct_version ==
- SBE_SEEPROM_STRUCT_SIMICS_VERSION )
+ STRUCT_VERSION_SIMICS )
&& ( Util::isSimicsRunning() )
)
{
@@ -2220,7 +1885,7 @@ namespace SBE
// Check if in simics
if ( ( io_sbeState.seeprom_1_ver.struct_version ==
- SBE_SEEPROM_STRUCT_SIMICS_VERSION )
+ STRUCT_VERSION_SIMICS )
&& ( Util::isSimicsRunning() )
)
{
@@ -2334,10 +1999,11 @@ namespace SBE
memset(&(io_sbeState.new_seeprom_ver),
0x0,
sizeof(sbeSeepromVersionInfo_t));
-
+ // the above memset also has the side effect of setting the
+ // origin field to WORKING_SIDE which is the default
io_sbeState.new_seeprom_ver.struct_version =
- SBE_SEEPROM_STRUCT_VERSION;
+ STRUCT_VERSION_LATEST;
memcpy( &(io_sbeState.new_seeprom_ver.image_version),
&(io_sbeState.pnorVersion),
@@ -2538,7 +2204,7 @@ namespace SBE
"NOT Booting READ_ONLY SEEPROM. Check for update"
" on cur side=%d ",
TARGETING::get_huid(io_sbeState.target),
- io_sbeState.cur_seeprom_side)
+ io_sbeState.cur_seeprom_side);
// Check for clean vs. dirty only on cur side
if ( i_system_situation & SITUATION_CUR_IS_DIRTY )
@@ -2995,6 +2661,24 @@ namespace SBE
}
/////////////////////////////////////////////////////////////////////
+ void setNestFreqAttributes(uint32_t i_nestFreq)
+ {
+ // @TODO RTC:138226 need interface, but content may change
+
+ // Call targeting function to update NEST_FREQ
+ TargetService& tS = targetService();
+ TARGETING::Target* sys = NULL;
+ (void) tS.getTopLevelTarget( sys );
+ assert(sys, "setNestFreqAttributes() system target is NULL");
+
+ TRACFCOMP(g_trac_sbe, "setNestFreqAttributes(): "
+ "UPDATE_NEST_FREQ to %d ",
+ i_nestFreq);
+
+ TARGETING::setFrequencyAttributes(sys, i_nestFreq);
+ }
+
+/////////////////////////////////////////////////////////////////////
errlHndl_t performUpdateActions(sbeTargetState_t& io_sbeState)
{
TRACUCOMP( g_trac_sbe,
@@ -3016,19 +2700,8 @@ namespace SBE
// This can only be set with Golden/READ-ONLY Seeprom situation
if (l_actions & UPDATE_NEST_FREQ)
{
- // Call targeting function to update NEST_FREQ
- TargetService& tS = targetService();
- TARGETING::Target* sys = NULL;
- (void) tS.getTopLevelTarget( sys );
- assert(sys, "performUpdateActions() system target is NULL");
-
- TRACFCOMP( g_trac_sbe, "performUpdateActions(): "
- "UPDATE_NEST_FREQ to %d ",
- io_sbeState.mproc_nest_freq_mhz);
-
- TARGETING::setFrequencyAttributes(
- sys,
- io_sbeState.mproc_nest_freq_mhz);
+ // update nest frequency attributes
+ setNestFreqAttributes(io_sbeState.mproc_nest_freq_mhz);
// This opeation only done by itself and does not need
// an informational error log
@@ -3164,29 +2837,6 @@ namespace SBE
/////////////////////////////////////////////////////////////////////
- uint32_t trimBitMask(uint32_t i_mask,
- size_t i_maxBits)
- {
- TRACDCOMP( g_trac_sbe,
- ENTER_MRK"trimBitMask(i_mask=0x%.8X, i_maxBits=0x%.8X)",
- i_mask, i_maxBits);
- uint32_t retMask = i_mask;
-
- while(__builtin_popcount(retMask) > static_cast<int32_t>(i_maxBits))
- {
- retMask ^= (0x80000000 >>
- static_cast<uint32_t>(__builtin_clz(retMask)));
- }
-
- TRACDCOMP( g_trac_sbe,
- EXIT_MRK"trimBitMask(): retMask=0x%.8X",
- retMask);
-
- return retMask;
- }
-
-
-/////////////////////////////////////////////////////////////////////
errlHndl_t createSbeImageVmmSpace(void)
{
@@ -4089,7 +3739,8 @@ namespace SBE
o_mismatch = false;
// Check Seeprom
- if ( i_struct_version == 2 )
+ if ( STRUCT_VERSION_CHECK(i_struct_version) &&
+ i_seeprom_nest_freq != 0 )
{
// Only version that tracks the nest freq when the image was
// customized
@@ -4117,7 +3768,7 @@ namespace SBE
else
{
- // Either old version (like 1), unitialized, simics, corrupted, etc
+ // Either uninitialized, simics, corrupted, etc
// Assume SBE image created with the module's default frequency
if ( g_current_nest_freq == i_default_nest_freq )
{
@@ -4155,10 +3806,10 @@ namespace SBE
errlHndl_t checkNestFreqSettings(sbeTargetState_t& io_sbeState)
{
TRACDCOMP( g_trac_sbe,
- ENTER_MRK"checkNestFreqSettings");
+ ENTER_MRK"checkNestFreqSettings(): HUID:0x%08X",
+ TARGETING::get_huid(io_sbeState.target));
errlHndl_t err = NULL;
-
uint32_t default_nest_freq = 0;
do{
@@ -4167,13 +3818,21 @@ namespace SBE
io_sbeState.seeprom_0_ver_Nest_Freq_Mismatch = false;
io_sbeState.seeprom_1_ver_Nest_Freq_Mismatch = false;
- // Get DEFAULT_PROC_MODULE_NEST_FREQ_MHZ attribute
+ // Get MRW DEFAULT_PROC_MODULE_NEST_FREQ_MHZ attribute
+ // @TODO RTC:138226 "We need to investigate if we can avoid needing
+ // this hack in P9"
default_nest_freq = io_sbeState.target->getAttr<
TARGETING::ATTR_DEFAULT_PROC_MODULE_NEST_FREQ_MHZ>();
- TRACUCOMP( g_trac_sbe,"checkNestFreqSettings(): ATTR_NEST_FREQ_MHZ "
+ TRACUCOMP( g_trac_sbe,"checkNestFreqSettings(): ATTR_NEST_FREQ_MHZ"
"=%d, ATTR_DEFAULT_PROC_MODULE_NEST_FREQ_MHZ=%d",
g_current_nest_freq, default_nest_freq);
+ TRACUCOMP( g_trac_sbe,"checkNestFreqSettings(): "
+ "seeprom0 ver=%d freq=%d seeprom1 ver=%d freq=%d",
+ io_sbeState.seeprom_0_ver.struct_version,
+ io_sbeState.seeprom_0_ver.nest_freq_mhz,
+ io_sbeState.seeprom_1_ver.struct_version,
+ io_sbeState.seeprom_1_ver.nest_freq_mhz);
// Check Seeprom 0
checkSeepromNestFreq(io_sbeState.target,
@@ -4210,7 +3869,9 @@ namespace SBE
if (tmp_cur_side == SBE_SEEPROM0)
{
- if ( io_sbeState.seeprom_0_ver.struct_version == 2 )
+ if ( STRUCT_VERSION_CHECK(
+ io_sbeState.seeprom_0_ver.struct_version) &&
+ io_sbeState.seeprom_0_ver.nest_freq_mhz != 0 )
{
io_sbeState.mproc_nest_freq_mhz =
io_sbeState.seeprom_0_ver.nest_freq_mhz;
@@ -4223,7 +3884,9 @@ namespace SBE
}
else if ( tmp_cur_side == SBE_SEEPROM1 )
{
- if ( io_sbeState.seeprom_1_ver.struct_version == 2 )
+ if ( STRUCT_VERSION_CHECK(
+ io_sbeState.seeprom_1_ver.struct_version) &&
+ io_sbeState.seeprom_1_ver.nest_freq_mhz != 0 )
{
io_sbeState.mproc_nest_freq_mhz =
io_sbeState.seeprom_1_ver.nest_freq_mhz;
diff --git a/src/usr/sbe/sbe_update.H b/src/usr/sbe/sbe_update.H
index f13e9b1c2..ae9b6e6e1 100644
--- a/src/usr/sbe/sbe_update.H
+++ b/src/usr/sbe/sbe_update.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2013,2015 */
+/* Contributors Listed Below - COPYRIGHT 2013,2016 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -43,21 +43,30 @@ namespace SBE
// Using only first 20 bytes of 64-byte sbe_image_version
const size_t SBE_MVPD_SHORT_IMAGE_VERSION_SIZE = 20;
- // Version of Struct stored in SEEPROM
- const uint32_t SBE_SEEPROM_STRUCT_VERSION = 0x00000002;
- const uint32_t SBE_SEEPROM_STRUCT_SIMICS_VERSION = 0x5A5A5A5A;
-
// Number of versions supported
- const uint8_t SBE_SEEPROM_STRUCT_MAX_VERSIONS = 0x03;
+ const uint8_t SBE_SEEPROM_STRUCT_MAX_VERSIONS = 0x02;
// Size of supported versions - must be 8-byte aligned
const size_t SBE_SEEPROM_STRUCT_SIZES[SBE_SEEPROM_STRUCT_MAX_VERSIONS] =
{
- 0, // ver0: uninitialized - no size
- 72, // ver1: size of struct is 72 bytes
- 80, // ver2: size of struct is 80 bytes
+ 0, // ver0: uninitialized - no size
+ 80, // ver1: size of struct is 80 bytes
};
+ // This enum provides the struct versions for sbeSeepromVersionInfo_t
+ // Each numeric version is named after the key feature it introduces.
+ enum sbeSeepromStructVersionInfo_t {
+ STRUCT_VERSION_FIRST = 0x1,
+ STRUCT_VERSION_LATEST = 0x1,
+ STRUCT_VERSION_SIMICS = 0x5A5A5A5A,
+ };
+
+ #define STRUCT_VERSION_CHECK(version) (((version) >= STRUCT_VERSION_FIRST) \
+ && ((version) <= STRUCT_VERSION_LATEST))
+
+ // Nest frequencies
+ const uint32_t NEST_FREQ_2000 = 2000;
+ const uint32_t NEST_FREQ_2400 = 2400;
// Constant written to SBE SEEPROM version struct to invalidate the
// struct and the image - 'INVALID\0'
@@ -112,6 +121,19 @@ namespace SBE
/******************************************/
/* Enums */
/******************************************/
+ enum {
+ FIXED_SEEPROM_WORK_SPACE = 128 * 1024,
+ FIXED_RING_BUF_SIZE = 60000,
+ MAX_SEEPROM_IMAGE_SIZE = 56 * 1024,
+ SBE_IMG_VADDR = VMM_VADDR_SBE_UPDATE,
+ RING_BUF1_VADDR = FIXED_SEEPROM_WORK_SPACE + SBE_IMG_VADDR,
+ RING_BUF2_VADDR = RING_BUF1_VADDR + FIXED_RING_BUF_SIZE,
+ //NOTE: recycling the same memory space for different
+ //steps in the process.
+ SBE_ECC_IMG_VADDR = RING_BUF1_VADDR,
+ SBE_ECC_IMG_MAX_SIZE = VMM_VADDR_SBE_UPDATE_END - SBE_ECC_IMG_VADDR,
+ };
+
// Used for MVPD function
enum opType_t
{
@@ -142,6 +164,14 @@ namespace SBE
UNSUPPORTED_SITUATION = 0x80000000,
};
+ // Values used to indicate whether an SBE Seeprom image originates from the
+ // golden side SBE Seeprom or not
+ enum sbeOrigin_t
+ {
+ WORKING_SIDE = 0,
+ GOLDEN_SIDE = 1,
+ };
+
/******************************************/
/* Structs */
/******************************************/
@@ -151,8 +181,7 @@ namespace SBE
*
* NOTE: For ECC purposes, this must be 8-byte aligned,
* so pad data if necessary
- * struct_version 1: size = 4+4+64 = 72 (aligned)
- * struct_version 2: size = 4+4+64+4+4 = 80 (aligned)
+ * struct_version 1: size = 4+4+64+4+1+3 = 80 (aligned)
*/
struct sbeSeepromVersionInfo_t
{
@@ -160,14 +189,14 @@ namespace SBE
uint32_t struct_version;
uint32_t data_crc;
uint8_t image_version[SBE_IMAGE_VERSION_SIZE];
-
- // New parameters for version 2: nest_freq_mhz and uin32_t/reserved
uint32_t nest_freq_mhz;
- uint32_t reserved; // reserved; added for alignment
+ uint8_t origin; // set if SBE came from golden side
+ uint8_t unused[3]; // unused space; added for alignment
} PACKED;
- // This line forces a compile fail if struct is NOT 8-byte-alaigned
- CPPASSERT(0 == (sizeof(sbeSeepromVersionInfo_t) % 8));
+ // This line forces a compile fail if struct is NOT 8-byte-aligned
+ static_assert(0 == (sizeof(sbeSeepromVersionInfo_t) % 8),
+ "sbeSeepromVersionInfo_t is not 8-byte-aligned");
/**
@@ -495,44 +524,6 @@ namespace SBE
*/
errlHndl_t cleanupSbeImageVmmSpace(void);
- /**
- * @brief Select best cores to include in SBE Image.
- * The output is used to indicate to p8_xip_customize which cores
- * should be included in the SBE image.
- *
- * @param[in] i_target Target processor to use for core selection
- *
- * @param[in] i_maxCores Maximum number of cores to select for inclusion
- * in the SBE Image
- *
- * @param[out] o_coreMask Core Mask for the target that does not exceed
- * the maximum number of cores
- * NOTE: bits 16:31 = EX0:EX15
- * This value is used as input into
- * p8_xip_customize.C
- *
- * @return errlHndl_t Error log handle on failure.
- */
- errlHndl_t selectBestCores(TARGETING::Target* i_target,
- size_t i_maxCores,
- uint32_t& o_coreMask);
-
-
- /**
- * @brief Reduces bits set in a bit mask until there is a
- * a maximum number of bits set.
- * NOTE: bits removed left-to-right
- *
- * @param[in] i_mask Starting mask to be reduced
- *
- * @param[in] i_maxBits Maximum number of bits that the
- * returned Bit Mask can contain
- *
- * @return uint32_t Bit Mask
- */
- uint32_t trimBitMask(uint32_t i_mask,
- size_t i_maxBits);
-
/**
* @brief Checks the Nest Frequency value stored in the the version struct
diff --git a/src/usr/sbe/test/sbeupdatetest.H b/src/usr/sbe/test/sbeupdatetest.H
index bbdeb1e43..8160fc3b6 100644
--- a/src/usr/sbe/test/sbeupdatetest.H
+++ b/src/usr/sbe/test/sbeupdatetest.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2013,2015 */
+/* Contributors Listed Below - COPYRIGHT 2013,2016 */
/* [+] Google Inc. */
/* [+] International Business Machines Corp. */
/* */
@@ -182,65 +182,8 @@ class SBEUpdateTest: public CxxTest::TestSuite
{
public:
- /**
- * @brief This function will test __trimCoreMask
- */
- void testTrimBitMask( void )
- {
-
- uint64_t fails = 0x0;
- uint64_t total = 0x0;
-
- do{
-
- TRACFCOMP( g_trac_sbe,
- ENTER_MRK"testTrimBitMask()" );
-
- struct
- {
- uint32_t inMask;
- uint32_t maxBits;
- uint32_t outMask;
- } testData[] =
- {
- {0xFFFFFFFF, 10, 0x000003FF},
- {0xFFFFFFFF, 32, 0xFFFFFFFF},
- {0x0000FF00, 4, 0x00000F00},
- {0x0000FA30, 3, 0x00000230},
- {0x0000FF00, 8, 0x0000FF00},
- {0x0000FF50, 16, 0x0000FF50},
- {0x0000EC50, 4, 0x00000C50},
- {0x000000FF, 5, 0x0000001F},
- {0x000000FF, 8, 0x000000FF},
- {0x11111111, 5, 0x00011111},
- {0x55555555, 11, 0x00155555},
- };
- const uint32_t NUM_TESTS = sizeof(testData)/sizeof(testData[0]);
-
- uint32_t retMask = 0;
-
- for(uint32_t i=0; i < NUM_TESTS; i++)
- {
- retMask = trimBitMask(testData[i].inMask,
- testData[i].maxBits);
- total++;
- if(retMask != testData[i].outMask)
- {
- fails++;
- TRACFCOMP( g_trac_sbe, ERR_MRK"testTrimBitMask() - i=%d, "
- "retMask=0x%.8X, expMask=0x%.8X",
- i, retMask, testData[i].outMask);
- TS_FAIL("testTrimBitMask() - Return data did not match "
- "expected data.");
- }
- }
-
- }while(0);
-
- TRACFCOMP( g_trac_sbe,
- EXIT_MRK"testTrimBitMask - %d/%d fails",
- fails, total );
- }
+ // @TODO RTC:158044 testTrimBitMask removed after earlier review comment
+ // may still be needed. Use Story 158044 to replace.
/**
* @brief This function will test SBE Update's ability
OpenPOWER on IntegriCloud