summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStephen Cprek <smcprek@us.ibm.com>2014-07-07 10:24:06 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2014-09-15 17:14:29 -0500
commitaf6b57dcb79e522d6a4e140f7952f58b3419cee1 (patch)
tree26664810494f02ff76f4ac6955d1a017f4ddc14e /src
parent574d17e95e5f640054c0e11a6fb9206e61e4bc81 (diff)
downloadblackbird-hostboot-af6b57dcb79e522d6a4e140f7952f58b3419cee1.tar.gz
blackbird-hostboot-af6b57dcb79e522d6a4e140f7952f58b3419cee1.zip
Add BMC Attr override support
Change-Id: I1a42fec21189c55c75e9073527867e4e95528794 RTC: 108376 CMVC-Corec: 931324 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/11995 Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com> Tested-by: Jenkins Server
Diffstat (limited to 'src')
-rw-r--r--src/build/citest/etc/patches/attrPredicate.patch15
-rwxr-xr-xsrc/build/citest/etc/workarounds.presimsetup21
-rwxr-xr-xsrc/build/mkrules/hbfw/img/makefile6
-rw-r--r--src/include/usr/errl/errlmanager.H5
-rwxr-xr-xsrc/include/usr/hwpf/plat/fapiPlatAttrOverrideSync.H20
-rw-r--r--src/include/usr/pnor/pnorif.H13
-rw-r--r--src/include/usr/targeting/attrPlatOverride.H71
-rw-r--r--src/include/usr/targeting/common/attributeTank.H19
-rw-r--r--src/include/usr/targeting/common/predicates/predicateattrtanktargetpos.H149
-rw-r--r--src/include/usr/targeting/common/target.H8
-rw-r--r--src/include/usr/targeting/common/targreasoncodes.H45
-rw-r--r--src/usr/initservice/istepdispatcher/istepdispatcher.C24
-rw-r--r--src/usr/pnor/pnorrp.C36
-rw-r--r--src/usr/pnor/test/pnorddtest.H12
-rw-r--r--src/usr/targeting/attrPlatOverride.C171
-rw-r--r--src/usr/targeting/common/attributeTank.C124
-rw-r--r--src/usr/targeting/common/target.C5
-rw-r--r--src/usr/targeting/makefile6
-rw-r--r--src/usr/targeting/test/testattrtank.H224
19 files changed, 912 insertions, 62 deletions
diff --git a/src/build/citest/etc/patches/attrPredicate.patch b/src/build/citest/etc/patches/attrPredicate.patch
new file mode 100644
index 000000000..70c66d7d5
--- /dev/null
+++ b/src/build/citest/etc/patches/attrPredicate.patch
@@ -0,0 +1,15 @@
+49a50,51
+> # F 931324 smcprek Sep 04, 2014 Add new predicateattrtanktargetpos.H
+> # and support for targreasoncodes.H
+171,172c173,175
+< predicateisnonfunctional.H
+<
+---
+> predicateisnonfunctional.H \
+> predicateattrtanktargetpos.H
+>
+187c190,191
+< attributeTank.H
+---
+> attributeTank.H \
+> targreasoncodes.H
diff --git a/src/build/citest/etc/workarounds.presimsetup b/src/build/citest/etc/workarounds.presimsetup
index 49296dc77..f251c0b32 100755
--- a/src/build/citest/etc/workarounds.presimsetup
+++ b/src/build/citest/etc/workarounds.presimsetup
@@ -34,3 +34,24 @@
#egrep -v "WSALIAS DEFAULT FIPSLEVEL|WSALIAS DEFAULT SIMICSLEVEL" $BACKING_BUILD/src/simu/data/simicsInfo > $sb/simu/data/simicsInfo
#echo "WSALIAS DEFAULT FIPSLEVEL env/gfwb/simics-4.2.0/simics-4.2.83/fips/fld36/fi120201a700.42" >> $sb/simu/data/simicsInfo
#echo "WSALIAS DEFAULT SIMICSLEVEL env/vtechb/simics-4.2.0/simics-4.2.83/bin" >> $sb/simu/data/simicsInfo
+
+echo "+++ Patching P8_MURANO.config for mailbox move."
+mkdir -p $sb/simu/configs
+grep -v "GFW_P8_HB_UNSECURE_OFFSET" \
+ $BACKING_BUILD/src/simu/configs/P8_MURANO.config > \
+ $sb/simu/configs/P8_MURANO.config
+echo "SETENV GFW_P8_HB_UNSECURE_OFFSET 58720256" >> \
+ $sb/simu/configs/P8_MURANO.config
+
+echo "+++ Patching P8_VENICE.config for mailbox move."
+grep -v "GFW_P8_HB_UNSECURE_OFFSET" \
+ $BACKING_BUILD/src/simu/configs/P8_VENICE.config > \
+ $sb/simu/configs/P8_VENICE.config
+echo "SETENV GFW_P8_HB_UNSECURE_OFFSET 58720256" >> \
+ $sb/simu/configs/P8_VENICE.config
+
+echo "+++ Patching attrPredicate.patch for BMC Attr Override."
+mkdir -p $sb/hbfw/fsp/targeting
+cp $BACKING_BUILD/src/hbfw/fsp/targeting/makefile $sb/hbfw/fsp/targeting
+patch $sb/hbfw/fsp/targeting/makefile \
+ ${HOSTBOOTROOT}/src/build/citest/etc/patches/attrPredicate.patch
diff --git a/src/build/mkrules/hbfw/img/makefile b/src/build/mkrules/hbfw/img/makefile
index 91868fe56..a04979eb8 100755
--- a/src/build/mkrules/hbfw/img/makefile
+++ b/src/build/mkrules/hbfw/img/makefile
@@ -5,7 +5,9 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2012,2014
+# Contributors Listed Below - COPYRIGHT 2012,2014
+# [+] 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.
@@ -124,7 +126,7 @@ cp_hbfiles: .SPECTARG
dd if=${TEMP_IMAGE} of=${EXT_HEADER_IMAGE} ibs=5120k conv=sync
ecc --inject ${EXT_HEADER_IMAGE} --output ${EXT_ECC_HEADER_IMAGE} --p8
# create data for a test partition in pnor
- dd if=/dev/urandom of=${TESTDATA} count=1 bs=28K
+ dd if=/dev/urandom of=${TESTDATA} count=1 bs=32K
ecc --inject ${TESTDATA} --output ${TESTDATA_ECC} --p8
# Fill the following partitions with FF's and then ECC them
dd if=/dev/zero bs=128K count=1 | tr "\000" "\377" > ${TEMP_IMAGE}
diff --git a/src/include/usr/errl/errlmanager.H b/src/include/usr/errl/errlmanager.H
index 309145af4..1063c6bff 100644
--- a/src/include/usr/errl/errlmanager.H
+++ b/src/include/usr/errl/errlmanager.H
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2014 */
+/* Contributors Listed Below - COPYRIGHT 2011,2014 */
+/* [+] 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. */
@@ -40,6 +42,7 @@
#include <hwas/common/hwasCallout.H>
#include <mbox/mbox_queues.H>
#include <mbox/mboxif.H>
+#include <list>
namespace ERRORLOG
diff --git a/src/include/usr/hwpf/plat/fapiPlatAttrOverrideSync.H b/src/include/usr/hwpf/plat/fapiPlatAttrOverrideSync.H
index 899a90d1f..fdcee3db8 100755
--- a/src/include/usr/hwpf/plat/fapiPlatAttrOverrideSync.H
+++ b/src/include/usr/hwpf/plat/fapiPlatAttrOverrideSync.H
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2012,2014 */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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. */
@@ -38,10 +40,18 @@
#include <mbox/mboxif.H>
#include <fapiAttributeIds.H>
#include <targeting/common/attributeTank.H>
+#include <pnor/pnorif.H>
//******************************************************************************
// Interface
//******************************************************************************
+namespace TARGETING
+{
+ errlHndl_t getAttrOverrides(PNOR::SectionId section,
+ AttributeTank* io_tanks[AttributeTank::TANK_LAYER_LAST],
+ uint32_t i_pnorSecOffset);
+}
+
namespace fapi
{
@@ -77,6 +87,13 @@ public:
friend void directOverride();
/**
+ * @brief Allow a attribute override to directly access the override tank
+ */
+ friend errlHndl_t TARGETING::getAttrOverrides(PNOR::SectionId section,
+ TARGETING::AttributeTank* io_tanks[TARGETING::AttributeTank::TANK_LAYER_LAST],
+ uint32_t i_pnorSecOffset);
+
+ /**
* @brief Maximum size of a direct attribute override
*/
static const size_t MAX_DIRECT_OVERRIDE_ATTR_SIZE_BYTES = 64;
@@ -196,6 +213,7 @@ public:
const fapi::Target * const i_pTarget,
const uint32_t i_size,
const void * i_pVal);
+
private:
/**
diff --git a/src/include/usr/pnor/pnorif.H b/src/include/usr/pnor/pnorif.H
index 7db87e56c..37c17d424 100644
--- a/src/include/usr/pnor/pnorif.H
+++ b/src/include/usr/pnor/pnorif.H
@@ -53,7 +53,8 @@ enum SectionId
HB_ERRLOGS, /**< Hostboot Error log Repository */
DIMM_JEDEC_VPD, /**< DIMM JEDEC VPD */
MODULE_VPD, /**< Module VPD */
- CENTAUR_VPD, /**< Centaur VPD */
+ CENTAUR_VPD, /**< Centaur VPD */
+ ATTR_OVER, /**< Attribute Override */
TEST, /**< Scratch space for PNOR test cases */
NUM_SECTIONS, /**< Number of defined sections */
@@ -77,9 +78,6 @@ struct SectionInfo_t
bool sha512perEC; /**< Version Checking perEC */
};
-
-
-
/**
* @brief Return the size and address of a given section of PNOR data
*
@@ -109,6 +107,13 @@ bool usingL3Cache();
*/
errlHndl_t validateAltMaster( void );
+/** @brief PNOR::TEST section offsets for test cases to prevent
+ * concurrency problems
+ */
+const uint32_t pnorTestSec_readwrite_offset = 0x100;
+const uint32_t pnorTestSec_smartwrite_offset = 0x120;
+const uint32_t pnorTestSec_BMCAttrOverride_offset = 0x200;
+
}
diff --git a/src/include/usr/targeting/attrPlatOverride.H b/src/include/usr/targeting/attrPlatOverride.H
new file mode 100644
index 000000000..61eccd8b5
--- /dev/null
+++ b/src/include/usr/targeting/attrPlatOverride.H
@@ -0,0 +1,71 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/usr/targeting/attrPlatOverride.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2014 */
+/* [+] 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 __ATTR_PLAT_OVERRIDE_H
+#define __ATTR_PLAT_OVERRIDE_H
+
+#include <targeting/common/attributeTank.H>
+#include <pnor/pnorif.H>
+
+namespace TARGETING
+{
+
+/**
+ * @struct AttrOverrideSection
+ *
+ * This structure defines the layout of the PNOR attribute override section
+ *
+ */
+struct AttrOverrideSection
+{
+ AttributeTank::TankLayer iv_layer;
+ size_t iv_size;
+ uint8_t iv_chunk[0];
+};
+
+/**
+ * @brief This function gets any Attribute Overrides in PNOR
+ *
+ * This function reads attribute overrides in from PNOR and places them in
+ * the appropriate attribute tank. It also calls writePermAttributes() to write
+ * permanent attribute overrides. Currently there are 3 attribute tanks,
+ * FAPI, Targeting, and Permanent.
+ *
+ * @param[in] i_section PNOR::SectionId to look for overrides default
+ * ATTR_OVER
+ * @param[in] io_tanks Array of pointers to Attribute tanks, used for
+ * test cases, default set to NULL
+ * @param[in] i_pnorSecOffset Offset within section to read, used for test cases
+ * default set to 0
+ *
+ * @return errlHndl_t Error log handle.
+ */
+errlHndl_t getAttrOverrides(PNOR::SectionId i_section = PNOR::ATTR_OVER,
+ AttributeTank* io_tanks[AttributeTank::TANK_LAYER_LAST] = NULL,
+ uint32_t i_pnorSecOffset = 0);
+//errlCommit( err, TARG_COMP_ID);
+
+} // end of namespace
+
+#endif \ No newline at end of file
diff --git a/src/include/usr/targeting/common/attributeTank.H b/src/include/usr/targeting/common/attributeTank.H
index ff89ab5fc..94cb69716 100644
--- a/src/include/usr/targeting/common/attributeTank.H
+++ b/src/include/usr/targeting/common/attributeTank.H
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013,2014 */
+/* Contributors Listed Below - COPYRIGHT 2013,2014 */
+/* [+] 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. */
@@ -33,6 +35,7 @@
#include <list>
#include <vector>
#include <targeting/adapters/mutexadapter.H>
+#include <targeting/common/error.H>
namespace TARGETING
{
@@ -81,6 +84,8 @@ public:
TANK_LAYER_NONE,
TANK_LAYER_FAPI,
TANK_LAYER_TARG,
+ TANK_LAYER_PERM,
+ TANK_LAYER_LAST = TANK_LAYER_PERM,
};
/**
@@ -155,6 +160,9 @@ public:
uint8_t * iv_pAttributes; // Pointer to chunk of memory
};
+
+ typedef std::vector<AttributeTank::AttributeSerializedChunk>
+ AttributeSerializedChunks_t;
/**
* @brief Default constructor
*/
@@ -337,6 +345,15 @@ public:
*/
virtual bool attributeExists(const uint32_t i_attrId) const;
+ /**
+ * @brief This function writes attributes in an AttributeTank to targeting
+ *
+ * This is called for the permanent AttributeTank in getAttrOverrides()
+ *
+ * @return errlHndl_t Error log handle.
+ */
+ errlHndl_t writePermAttributes();
+
private:
// Copy constructor and assignment operator disabled
AttributeTank(const AttributeTank & i_right);
diff --git a/src/include/usr/targeting/common/predicates/predicateattrtanktargetpos.H b/src/include/usr/targeting/common/predicates/predicateattrtanktargetpos.H
new file mode 100644
index 000000000..f9f3d3ecc
--- /dev/null
+++ b/src/include/usr/targeting/common/predicates/predicateattrtanktargetpos.H
@@ -0,0 +1,149 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/usr/targeting/common/predicates/predicateattrtanktargetpos.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2014 */
+/* [+] 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 targeting/common/predicates/predicateattrtanktargetpos.H
+ *
+ * @brief Interface and implementation for a predicate which filters a target
+ * based on whether it matches a given node, pos, and unit pos
+ */
+
+#ifndef __TARGETING_COMMON_PREDICATEATTRTANKTARGETPOS_H
+#define __TARGETING_COMMON_PREDICATEATTRTANKTARGETPOS_H
+
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+// STD
+
+// Other Host Boot Components
+
+// Targeting Component
+#include <targeting/common/target.H>
+#include <targeting/common/attributes.H>
+#include <targeting/common/predicates/predicatebase.H>
+#include <targeting/common/trace.H>
+
+//******************************************************************************
+// Interface and implementation
+//******************************************************************************
+
+namespace TARGETING
+{
+
+#define TARG_NAMESPACE "TARGETING::"
+#define TARG_CLASS "PredicateAttrTankTargetPos::"
+
+class Target;
+
+/**
+ * @brief Templated predicate class which filters a target based on whether
+ * it matches a given node, pos, and unit pos
+ *
+ * ** It is important to know what this predicate is being applied to.
+ * The getAttrTankTargetPosData() call in the operator() overloader will
+ * assert if the target is compatible.
+ */
+
+class PredicateAttrTankTargetPos : public PredicateBase
+{
+ public:
+
+ /**
+ * @brief Constructor which configures the predicate to filter targets
+ * on whether it matches the input node, pos, and unit pos
+ *
+ * @param[in] i_pos Attribute tank position
+ * @param[in] i_unitPos Attribute tank unit position
+ * @param[in] i_node Attribute tank node position
+ *
+ */
+ PredicateAttrTankTargetPos(
+ const uint16_t i_pos,
+ const uint8_t i_unitPos,
+ const uint8_t i_node
+ )
+ : iv_pos(i_pos), iv_unitPos(i_unitPos), iv_node(i_node) {}
+
+ /**
+ * @brief Destroys the attribute tank target pos predicate
+ */
+ virtual ~PredicateAttrTankTargetPos(){}
+
+ /**
+ * @brief Returns whether target mathces the specified node, pos, and
+ * unitPos.
+ *
+ * @par Detailed Description: if a wild card was specified in the
+ * constructor (i.e. ATTR_NODE_NA) then the target matches the
+ * corresponding position.
+ *
+ * @param[in] i_pTarget
+ * Target handle pointing to the target to compare to. Must
+ * not be NULL.
+ *
+ * @return bool indicating whether the target matches or not
+ */
+ virtual bool operator()(const Target* i_pTarget) const
+ {
+ uint16_t l_pos;
+ uint8_t l_unitPos;
+ uint8_t l_node;
+ i_pTarget->getAttrTankTargetPosData(l_pos, l_unitPos, l_node);
+
+ // Check if target position matches that
+ if ( (iv_pos != AttributeTank::ATTR_POS_NA) && (iv_pos != l_pos) )
+ {
+ return false;
+ }
+ if ( (iv_unitPos != AttributeTank::ATTR_UNIT_POS_NA) &&
+ (iv_unitPos != l_unitPos) )
+ {
+ return false;
+ }
+ if ( (iv_node != AttributeTank::ATTR_NODE_NA) &&
+ (iv_node != l_node) )
+ {
+ return false;
+ }
+ return true;
+ }
+
+ private:
+
+ // Postion info to compare with that of a target
+ uint16_t iv_pos;
+ uint8_t iv_unitPos;
+ uint8_t iv_node;
+
+ TARG_DISABLE_COPY_AND_ASSIGNMENT_OPERATORS(PredicateAttrTankTargetPos);
+};
+
+#undef TARG_CLASS
+#undef TARG_NAMESPACE
+
+} // End namespace TARGETING
+
+#endif // __TARGETING_COMMON_PREDICATEATTRTANKTARGETPOS_H
diff --git a/src/include/usr/targeting/common/target.H b/src/include/usr/targeting/common/target.H
index e0f6dee4f..04599859f 100644
--- a/src/include/usr/targeting/common/target.H
+++ b/src/include/usr/targeting/common/target.H
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2014 */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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. */
@@ -48,7 +50,6 @@
// This component
#include <targeting/common/attributes.H>
-#include <targeting/common/attributeTank.H>
//******************************************************************************
// Forward declarations to allow friend functions to work
@@ -78,7 +79,7 @@ namespace TARGETING
//******************************************************************************
// Type Aliases
//******************************************************************************
-
+class AttributeTank;
class Target;
typedef const Target* ConstTargetHandle_t;
typedef Target* TargetHandle_t;
@@ -570,6 +571,7 @@ class Target
friend class TargetCloner;
friend class TargetService;
friend class AssociationManager;
+ friend class AttributeTank;
// Friend functions to allow FAPI Attribute code to directly call
// _tryGetAttr and _trySetAttr for code size optimization
diff --git a/src/include/usr/targeting/common/targreasoncodes.H b/src/include/usr/targeting/common/targreasoncodes.H
index 0a68693c9..63da83bf3 100644
--- a/src/include/usr/targeting/common/targreasoncodes.H
+++ b/src/include/usr/targeting/common/targreasoncodes.H
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2014 */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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. */
@@ -36,27 +38,34 @@ namespace TARGETING
enum TargetingModuleId
{
- TARG_MOD_TEST = 0x01,
- TARG_MOD_ATTRRP = 0x02,
- TARG_MOD_ATTR_SYNC = 0x03,
- TARG_RT_GET_RT_TARGET = 0x04,
- TARG_RT_GET_HB_TARGET = 0x05,
+ TARG_MOD_TEST = 0x01,
+ TARG_MOD_ATTRRP = 0x02,
+ TARG_MOD_ATTR_SYNC = 0x03,
+ TARG_RT_GET_RT_TARGET = 0x04,
+ TARG_RT_GET_HB_TARGET = 0x05,
+ TARG_GET_ATTR_OVER = 0x06,
+ TARG_WRITE_PERM_ATTR = 0x07,
+
};
enum TargetingReasonCode
{
- TARG_RC_TEST_TARGET_FFDC = TARG_COMP_ID | 0x01,
- TARG_RC_BAD_EYECATCH = TARG_COMP_ID | 0x02,
- TARG_RC_MM_BLOCK_FAIL = TARG_COMP_ID | 0x03,
- TARG_RC_MM_PERM_FAIL = TARG_COMP_ID | 0x04,
- TARG_RC_ATTR_MSG_FAIL = TARG_COMP_ID | 0x05,
- TARG_RC_UNHANDLED_ATTR_SEC_TYPE = TARG_COMP_ID | 0x06,
- TARG_RC_ATTR_SYNC_TO_FSP_FAIL = TARG_COMP_ID | 0x07,
- TARG_RC_ATTR_SYNC_REQUEST_TO_HB_FAIL = TARG_COMP_ID | 0x08,
- TARG_RC_ATTR_SYNC_TO_HB_FAIL = TARG_COMP_ID | 0x09,
- TARG_RT_UNIT_TARGET_NOT_FOUND = TARG_COMP_ID | 0x0a,
- TARG_RT_NO_PROC_TARGET = TARG_COMP_ID | 0x0b,
- TARG_RT_TARGET_TYPE_NOT_SUPPORTED = TARG_COMP_ID | 0x0c,
+ TARG_RC_TEST_TARGET_FFDC = TARG_COMP_ID | 0x01,
+ TARG_RC_BAD_EYECATCH = TARG_COMP_ID | 0x02,
+ TARG_RC_MM_BLOCK_FAIL = TARG_COMP_ID | 0x03,
+ TARG_RC_MM_PERM_FAIL = TARG_COMP_ID | 0x04,
+ TARG_RC_ATTR_MSG_FAIL = TARG_COMP_ID | 0x05,
+ TARG_RC_UNHANDLED_ATTR_SEC_TYPE = TARG_COMP_ID | 0x06,
+ TARG_RC_ATTR_SYNC_TO_FSP_FAIL = TARG_COMP_ID | 0x07,
+ TARG_RC_ATTR_SYNC_REQUEST_TO_HB_FAIL = TARG_COMP_ID | 0x08,
+ TARG_RC_ATTR_SYNC_TO_HB_FAIL = TARG_COMP_ID | 0x09,
+ TARG_RT_UNIT_TARGET_NOT_FOUND = TARG_COMP_ID | 0x0a,
+ TARG_RT_NO_PROC_TARGET = TARG_COMP_ID | 0x0b,
+ TARG_RT_TARGET_TYPE_NOT_SUPPORTED = TARG_COMP_ID | 0x0c,
+ TARG_RC_ATTR_OVER_PNOR_SEC_SPACE_FAIL = TARG_COMP_ID | 0x0d,
+ TARG_RC_ATTR_OVER_ATTR_DATA_SIZE_FAIL = TARG_COMP_ID | 0x0e,
+ TARG_RC_WRITE_PERM_ATTR_FAIL = TARG_COMP_ID | 0x0f,
+ TARG_RC_WRITE_PERM_ATTR_TARGET_FAIL = TARG_COMP_ID | 0x10,
};
}; // End TARGETING namespace
diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.C b/src/usr/initservice/istepdispatcher/istepdispatcher.C
index 9e648c98f..c2d3853f9 100644
--- a/src/usr/initservice/istepdispatcher/istepdispatcher.C
+++ b/src/usr/initservice/istepdispatcher/istepdispatcher.C
@@ -61,6 +61,7 @@
#include <hwas/common/deconfigGard.H>
#include <hwas/common/hwas.H>
#include <hwas/hwasPlat.H>
+#include <targeting/attrPlatOverride.H>
namespace ISTEPS_TRACE
{
@@ -240,6 +241,20 @@ void IStepDispatcher::init(errlHndl_t &io_rtaskRetErrl)
tid_t msgHndlrTaskTid = task_create(startMsgHndlrThread, this);
assert(msgHndlrTaskTid > 0);
}
+ // Get Attribute overrides from PNOR
+ else
+ {
+ err = TARGETING::getAttrOverrides();
+ if (err)
+ {
+ TRACFCOMP(g_trac_initsvc,"Failed getAttrOverrides");
+ break;
+ }
+ else
+ {
+ TRACFCOMP(g_trac_initsvc,"Success getAttrOverrides");
+ }
+ }
err = executeAllISteps();
@@ -252,7 +267,10 @@ void IStepDispatcher::init(errlHndl_t &io_rtaskRetErrl)
// Send the potentially modified set of Attribute overrides and any
// Attributes to sync to the FSP
- fapi::theAttrOverrideSync().sendAttrOverridesAndSyncsToFsp();
+ if(iv_spBaseServicesEnabled)
+ {
+ fapi::theAttrOverrideSync().sendAttrOverridesAndSyncsToFsp();
+ }
}
} while(0);
@@ -1058,13 +1076,13 @@ void IStepDispatcher::handleShutdownMsg(msg_t * & io_pMsg)
mutex_lock(&iv_mutex);
if (iv_futureShutdown)
{
- //Multiple shutdown messages have been received use the one that
+ //Multiple shutdown messages have been received use the one that
// will happen first
if ((istep < iv_istepToCompleteBeforeShutdown) ||
(istep == iv_istepToCompleteBeforeShutdown
&& substep < iv_substepToCompleteBeforeShutdown) )
{
- TRACFCOMP(g_trac_initsvc, INFO_MRK"handleShutdownMsg: Future "
+ TRACFCOMP(g_trac_initsvc, INFO_MRK"handleShutdownMsg: Future "
"shutdown msg rcvd, updating future poweroff to istep"
" [%d], substep [%d]", istep, substep);
iv_istepToCompleteBeforeShutdown = istep;
diff --git a/src/usr/pnor/pnorrp.C b/src/usr/pnor/pnorrp.C
index f0507aa83..3b6790d88 100644
--- a/src/usr/pnor/pnorrp.C
+++ b/src/usr/pnor/pnorrp.C
@@ -56,22 +56,23 @@ TRAC_INIT(&g_trac_pnor, PNOR_COMP_NAME, 2*KILOBYTE, TRACE::BUFFER_SLOW); //2K
* Eyecatcher strings for PNOR TOC entries
*/
const char* cv_EYECATCHER[] = {
- "part", /**< PNOR::TOC : Table of Contents */
- "HBI", /**< PNOR::HB_EXT_CODE : Hostboot Extended Image */
- "GLOBAL", /**< PNOR::GLOBAL_DATA : Global Data */
- "HBB", /**< PNOR::HB_BASE_CODE : Hostboot Base Image */
- "SBEC", /**< PNOR::CENTAUR_SBE : Centaur Self-Boot Engine image */
- "SBE", /**< PNOR::SBE_IPL : Self-Boot Enginer IPL image */
- "WINK", /**< PNOR::WINK : Sleep Winkle Reference image */
- "PAYLOAD",/**< PNOR::PAYLOAD : HAL/OPAL */
- "HBRT", /**< PNOR::HB_RUNTIME : Hostboot Runtime (for Sapphire) */
- "HBD", /**< PNOR::HB_DATA : Hostboot Data */
- "GUARD", /**< PNOR::GUARD_DATA : Hostboot Data */
- "HBEL", /**< PNOR::HB_ERRLOGS : Hostboot Error log Repository */
- "DJVPD", /**< PNOR::DIMM_JEDEC_VPD: Dimm JEDEC VPD */
- "MVPD", /**< PNOR::MODULE_VPD : Module VPD */
- "CVPD", /**< PNOR::CENTAUR_VPD : Centaur VPD */
- "TEST", /**< PNOR::TEST : Test space for PNOR*/
+ "part", /**< PNOR::TOC : Table of Contents */
+ "HBI", /**< PNOR::HB_EXT_CODE : Hostboot Extended Image */
+ "GLOBAL", /**< PNOR::GLOBAL_DATA : Global Data */
+ "HBB", /**< PNOR::HB_BASE_CODE : Hostboot Base Image */
+ "SBEC", /**< PNOR::CENTAUR_SBE : Centaur Self-Boot Engine image */
+ "SBE", /**< PNOR::SBE_IPL : Self-Boot Enginer IPL image */
+ "WINK", /**< PNOR::WINK : Sleep Winkle Reference image */
+ "PAYLOAD", /**< PNOR::PAYLOAD : HAL/OPAL */
+ "HBRT", /**< PNOR::HB_RUNTIME : Hostboot Runtime (for Sapphire) */
+ "HBD", /**< PNOR::HB_DATA : Hostboot Data */
+ "GUARD", /**< PNOR::GUARD_DATA : Hostboot Data */
+ "HBEL", /**< PNOR::HB_ERRLOGS : Hostboot Error log Repository */
+ "DJVPD", /**< PNOR::DIMM_JEDEC_VPD : Dimm JEDEC VPD */
+ "MVPD", /**< PNOR::MODULE_VPD : Module VPD */
+ "CVPD", /**< PNOR::CENTAUR_VPD : Centaur VPD */
+ "ATTROVER", /**< PNOR::ATTR_OVER : Attribute Override */
+ "TEST", /**< PNOR::TEST : Test space for PNOR*/
//Not currently used
// "XXX", /**< NUM_SECTIONS : Used as invalid entry */
@@ -810,7 +811,6 @@ errlHndl_t PnorRP::readFromDevice( uint64_t i_offset,
data_to_read,
read_size,
DEVICE_PNOR_ADDRESS(i_chip,i_offset) );
-
if( l_errhdl )
{
TRACFCOMP(g_trac_pnor, "PnorRP::readFromDevice> Error from device : RC=%X", l_errhdl->reasonCode() );
@@ -829,7 +829,7 @@ errlHndl_t PnorRP::readFromDevice( uint64_t i_offset,
// create an error if we couldn't correct things
if( ecc_stat == PNOR::ECC::UNCORRECTABLE )
{
- TRACFCOMP( g_trac_pnor, "PnorRP::readFromDevice> Uncorrectable ECC error : chip=%d, offset=0x%.X", i_chip, i_offset );
+ TRACFCOMP( g_trac_pnor, "PnorRP::readFromDevice> Uncorrectable ECC error : chip=%d,offset=0x%.X", i_chip, i_offset );
// Need to shutdown here instead of creating an error log
// because the bad page could be critical to the regular
diff --git a/src/usr/pnor/test/pnorddtest.H b/src/usr/pnor/test/pnorddtest.H
index d762875b0..97273cc34 100644
--- a/src/usr/pnor/test/pnorddtest.H
+++ b/src/usr/pnor/test/pnorddtest.H
@@ -130,7 +130,8 @@ class PnorDdTest : public CxxTest::TestSuite
// Perform PnorDD Write 1
- uint64_t l_address = base_address+0x100;
+ uint64_t l_address = base_address +
+ PNOR::pnorTestSec_readwrite_offset;
uint64_t l_writeData = 0x12345678FEEDB0B0;
l_size = sizeof(uint64_t);
l_err = deviceWrite(l_testTarget,
@@ -153,7 +154,7 @@ class PnorDdTest : public CxxTest::TestSuite
}
// Perform PnorDD Write 2
- l_address = base_address+0x108;
+ l_address = base_address + PNOR::pnorTestSec_readwrite_offset + 0x8;
l_writeData = 0xFEEDBEEF000ABCDE;
l_size = sizeof(uint64_t);
l_err = deviceWrite(l_testTarget,
@@ -176,7 +177,7 @@ class PnorDdTest : public CxxTest::TestSuite
}
// Perform PnorDD read 1
- l_address = base_address+0x100;
+ l_address = base_address + PNOR::pnorTestSec_readwrite_offset;
uint64_t l_readData = 0;
l_size = sizeof(uint64_t);
l_err = deviceRead(l_testTarget,
@@ -206,7 +207,7 @@ class PnorDdTest : public CxxTest::TestSuite
}
// Perform PnorDD read 2
- l_address = base_address+0x108;
+ l_address = base_address + PNOR::pnorTestSec_readwrite_offset + 0x8;
l_size = sizeof(uint64_t);
l_err = deviceRead(l_testTarget,
&l_readData,
@@ -265,7 +266,8 @@ class PnorDdTest : public CxxTest::TestSuite
break;
}
- uint64_t l_address = base_address+0x120;
+ uint64_t l_address = base_address +
+ PNOR::pnorTestSec_smartwrite_offset;
uint64_t l_writeData = 0xAAAAAAAA55555555;
l_size = sizeof(uint64_t);
l_err = deviceWrite(l_testTarget,
diff --git a/src/usr/targeting/attrPlatOverride.C b/src/usr/targeting/attrPlatOverride.C
new file mode 100644
index 000000000..7f67ab221
--- /dev/null
+++ b/src/usr/targeting/attrPlatOverride.C
@@ -0,0 +1,171 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/targeting/attrPlatOverride.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2014 */
+/* [+] 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 <targeting/attrPlatOverride.H>
+#include <hwpf/plat/fapiPlatAttrOverrideSync.H>
+#include <targeting/common/trace.H>
+#include <targeting/common/targreasoncodes.H>
+
+namespace TARGETING
+{
+
+errlHndl_t getAttrOverrides(PNOR::SectionId i_section,
+ AttributeTank* io_tanks[AttributeTank::TANK_LAYER_LAST],
+ uint32_t pnorSecOffset)
+{
+ TRACFCOMP(g_trac_targeting,"attrPlatOverride::getAttrOverrides ENTER");
+
+ // Create local permanent override tank and array of tanks
+ AttributeTank l_PermTank;
+ AttributeTank* l_overTanks[AttributeTank::TANK_LAYER_LAST];
+ errlHndl_t l_err = NULL;
+
+ // Local pointer to array containing each tank layer or io_tanks
+ AttributeTank* *l_pOverTanks;
+
+ // If no attribute tanks specified grab all TankLayers to create attribute
+ // tanks with in enum order
+ if (io_tanks == NULL)
+ {
+ // All indexes are -1 due to the first enum being TANK_LAYER_NONE,
+ l_overTanks[AttributeTank::TANK_LAYER_FAPI-1] =
+ &fapi::theAttrOverrideSync().iv_overrideTank;
+ l_overTanks[AttributeTank::TANK_LAYER_TARG-1] =
+ &Target::theTargOverrideAttrTank();
+ l_overTanks[AttributeTank::TANK_LAYER_PERM-1] = &l_PermTank;
+ l_pOverTanks = l_overTanks;
+ }
+ else
+ {
+ l_pOverTanks = io_tanks;
+ }
+
+ do
+ {
+ // Read PNOR section
+ PNOR::SectionInfo_t sectionInfo;
+ l_err = PNOR::getSectionInfo( i_section, sectionInfo );
+ // Attr override sections are optional so just delete error and break
+ if (l_err)
+ {
+ delete l_err;
+ l_err = NULL;
+ break;
+ }
+
+ uint32_t l_index = pnorSecOffset;
+ // Deserialize each section
+ while (l_index < sectionInfo.size)
+ {
+ AttrOverrideSection * l_pAttrOverSec =
+ reinterpret_cast<AttrOverrideSection *>
+ (sectionInfo.vaddr + l_index);
+
+ // Reached termination chunck
+ if (l_pAttrOverSec->iv_layer == AttributeTank::TANK_LAYER_NONE)
+ {
+ TRACFCOMP(g_trac_targeting,"attrPlatOverride::getAttrOverrides Reached termination section at chunk (0x%x)",
+ (sectionInfo.size - l_index));
+ break;
+ }
+
+ // Remaining chunk smaller than AttrOverrideSection, quit
+ if (sizeof(AttrOverrideSection) > (sectionInfo.size - l_index))
+ {
+ TRACFCOMP(g_trac_targeting,"attrPlatOverride::getAttrOverrides AttrOverrideSection too big for chunk (0x%x)",
+ (sectionInfo.size - l_index));
+ /*@
+ * @errortype
+ * @moduleid TARG_GET_ATTR_OVER
+ * @reasoncode TARG_RC_ATTR_OVER_PNOR_SEC_SPACE_FAIL
+ * @userdata1 PNOR Section specified
+ * @userdata2 Size of AttrOverrideSection
+ * @devdesc AttrOverrideSection too big to fit in remaining
+ * chunck of pnor section
+ */
+ l_err =
+ new ERRORLOG::ErrlEntry
+ (ERRORLOG::ERRL_SEV_PREDICTIVE,
+ TARG_GET_ATTR_OVER,
+ TARG_RC_ATTR_OVER_PNOR_SEC_SPACE_FAIL,
+ i_section,
+ sizeof(AttrOverrideSection),
+ true /*SW callout*/);
+ break;
+ }
+
+ l_index += sizeof(AttrOverrideSection);
+
+ // Remaining chunk smaller than serialized chunk size, quit
+ if (l_pAttrOverSec->iv_size > (sectionInfo.size - l_index))
+ {
+ TRACFCOMP(g_trac_targeting,"attrPlatOverride::getAttrOverrides serialized chunk too big for chunk (0x%x)",
+ (sectionInfo.size - l_index));
+ /*@
+ * @errortype
+ * @moduleid TARG_GET_ATTR_OVER
+ * @reasoncode TARG_RC_ATTR_OVER_ATTR_DATA_SIZE_FAIL
+ * @userdata1 PNOR Section specified
+ * @userdata2 Size of Serialized attribute override
+ * @devdesc Serialized attribute override chunk too big to
+ * fit in remaining chunck of pnor section
+ */
+ l_err =
+ new ERRORLOG::ErrlEntry
+ (ERRORLOG::ERRL_SEV_PREDICTIVE,
+ TARG_GET_ATTR_OVER,
+ TARG_RC_ATTR_OVER_ATTR_DATA_SIZE_FAIL,
+ i_section,
+ l_pAttrOverSec->iv_size,
+ true /*SW callout*/);
+ break;
+ }
+
+ // Get the AttributeTank that corresponds to the TankLayer in the
+ // AttrOverrideSection. Enum starts with TANK_LAYER_NONE so need to
+ // substract 1
+ AttributeTank* l_ptank = l_pOverTanks[l_pAttrOverSec->iv_layer - 1];
+
+ // Create serialized chunck with AttrOverrideSection data
+ AttributeTank::AttributeSerializedChunk l_chunk;
+ l_chunk.iv_size = l_pAttrOverSec->iv_size;
+ l_chunk.iv_pAttributes = &l_pAttrOverSec->iv_chunk[0];
+
+ // Deserialize the data with the approriate AttributeTank
+ l_ptank->deserializeAttributes(l_chunk);
+ l_index += l_pAttrOverSec->iv_size;
+ }
+
+ // Write permanent attribute overrides
+ l_err = l_PermTank.writePermAttributes();
+
+ } while(0);
+
+ TRACFCOMP(g_trac_targeting,"attrPlatOverride::getAttrOverrides EXIT");
+ return l_err;
+}
+
+} // end of namespace
+
+
diff --git a/src/usr/targeting/common/attributeTank.C b/src/usr/targeting/common/attributeTank.C
index 76e330e69..0ec8fd761 100644
--- a/src/usr/targeting/common/attributeTank.C
+++ b/src/usr/targeting/common/attributeTank.C
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013,2014 */
+/* Contributors Listed Below - COPYRIGHT 2013,2014 */
+/* [+] 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. */
@@ -29,6 +31,15 @@
#include <string.h>
#include <targeting/common/attributeTank.H>
#include <targeting/common/trace.H>
+#include <targeting/common/predicates/predicatepostfixexpr.H>
+#include <targeting/common/predicates/predicatectm.H>
+#include <targeting/common/predicates/predicateattrtanktargetpos.H>
+#include <targeting/common/iterators/rangefilter.H>
+#include <targeting/common/targetservice.H>
+#include <targeting/targplatutil.H>
+#include <targeting/common/targreasoncodes.H>
+
+
namespace TARGETING
{
@@ -277,7 +288,6 @@ void AttributeTank::serializeAttributes(
uint32_t l_index = 0;
AttributesCItr_t l_itr = iv_attributes.begin();
-
while (l_itr != iv_attributes.end())
{
// Fill up the buffer with as many attributes as possible
@@ -467,4 +477,114 @@ AttributeTank::Attribute::~Attribute()
iv_pVal = NULL;
}
+//******************************************************************************
+errlHndl_t AttributeTank::writePermAttributes()
+{
+ errlHndl_t l_err = NULL;
+
+ for(AttributesCItr_t l_attrIter = iv_attributes.begin();
+ l_attrIter != iv_attributes.end(); ++l_attrIter)
+ {
+ Attribute* l_attr = *l_attrIter;
+ AttributeHeader l_attrHdr = l_attr->iv_hdr;
+ PredicatePostfixExpr l_permAttrOverrides;
+
+ // Predicate to match target type
+ PredicateCTM l_targetTypeFilter
+ (CLASS_NA, static_cast<TYPE>(l_attrHdr.iv_targetType));
+
+ // Predicate to match attribute tank target position
+ PredicateAttrTankTargetPos l_targetPosFilter(l_attrHdr.iv_pos,
+ l_attrHdr.iv_unitPos,
+ l_attrHdr.iv_node);
+
+ l_permAttrOverrides.push(&l_targetTypeFilter)
+ .push(&l_targetPosFilter).And();
+
+ // Apply the filter through all targets
+ TargetRangeFilter l_permTargetList( targetService().begin(),
+ targetService().end(),
+ &l_permAttrOverrides);
+
+ // Write permanent attributes to target
+ for ( ; l_permTargetList; ++l_permTargetList)
+ {
+ bool l_success = (*l_permTargetList)->_trySetAttr(
+ static_cast<ATTRIBUTE_ID>(l_attrHdr.iv_attrId),
+ l_attrHdr.iv_valSize,
+ l_attr->iv_pVal );
+
+ if (l_success)
+ {
+ TRACFCOMP(g_trac_targeting, "writePermAttributes: Successful permanent override of Attr ID:0x%X Value:0x%lX applied to target 0x%X",
+ l_attrHdr.iv_attrId,
+ *reinterpret_cast<uint64_t *>(l_attr->iv_pVal),
+ (*l_permTargetList)->getAttr<ATTR_HUID>() );
+ }
+ else
+ {
+ uint8_t * io_pAttrData = NULL;
+ bool l_found = (*l_permTargetList)->_tryGetAttr(
+ static_cast<ATTRIBUTE_ID>(l_attrHdr.iv_attrId),
+ l_attrHdr.iv_valSize,
+ io_pAttrData);
+
+ if (l_found)
+ {
+ TRACFCOMP(g_trac_targeting, "writePermAttributes: Value NOT applied to target, override failed for Attr ID:0x%X Value:0x%lX on target 0x%X - current value 0x%lX",
+ l_attrHdr.iv_attrId,
+ *reinterpret_cast<uint64_t *>(l_attr->iv_pVal),
+ (*l_permTargetList)->getAttr<ATTR_HUID>(),
+ *reinterpret_cast<uint64_t *>(io_pAttrData) );
+ /*@
+ * @errortype
+ * @moduleid TARG_WRITE_PERM_ATTR
+ * @reasoncode TARG_RC_WRITE_PERM_ATTR_FAIL
+ * @userdata1 Target specified
+ * @userdata2 Attribute specified
+ * @devdesc Failure applying given attribute override
+ * on given target
+ */
+ UTIL::createTracingError(
+ TARG_WRITE_PERM_ATTR,
+ TARG_RC_WRITE_PERM_ATTR_FAIL,
+ (*l_permTargetList)->getAttr<ATTR_HUID>(),
+ l_attrHdr.iv_attrId,
+ 0,0,
+ l_err);
+ break;
+ }
+ else
+ {
+ TRACFCOMP(g_trac_targeting, "writePermAttributes: Target does not have attribute, override NOT applied for Attr ID:0x%X on target 0x%X",
+ l_attrHdr.iv_attrId,
+ (*l_permTargetList)->getAttr<ATTR_HUID>() );
+ /*@
+ * @errortype
+ * @moduleid TARG_WRITE_PERM_ATTR
+ * @reasoncode TARG_RC_WRITE_PERM_ATTR_TARGET_FAIL
+ * @userdata1 Target specified
+ * @userdata2 Attribute specified
+ * @devdesc Given target does not have given attribute
+ * to apply override
+ */
+ UTIL::createTracingError(
+ TARG_WRITE_PERM_ATTR,
+ TARG_RC_WRITE_PERM_ATTR_TARGET_FAIL,
+ (*l_permTargetList)->getAttr<ATTR_HUID>(),
+ l_attrHdr.iv_attrId,
+ 0,0,
+ l_err);
+ break;
+ }
+ }
+ }
+ if (l_err)
+ {
+ break;
+ }
+ }
+ return l_err;
+}
+
}
diff --git a/src/usr/targeting/common/target.C b/src/usr/targeting/common/target.C
index 9b011e988..ea79a22a3 100644
--- a/src/usr/targeting/common/target.C
+++ b/src/usr/targeting/common/target.C
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2014 */
+/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* [+] 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. */
@@ -44,6 +46,7 @@
#include <targeting/common/trace.H>
#include <targeting/common/predicates/predicateattrval.H>
#include <targeting/common/utilFilter.H>
+#include <targeting/common/attributeTank.H>
namespace TARGETING
{
diff --git a/src/usr/targeting/makefile b/src/usr/targeting/makefile
index e0180bc35..36b1d98a1 100644
--- a/src/usr/targeting/makefile
+++ b/src/usr/targeting/makefile
@@ -5,7 +5,9 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2011,2014
+# Contributors Listed Below - COPYRIGHT 2011,2014
+# [+] 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.
@@ -37,6 +39,8 @@ include ${TARGETING_REL_PATH}/hostboot_common.mk
ATTR_RP_OBJS += attrrp.o
ATTR_RP_OBJS += attrsync.o
ATTR_RP_OBJS += targplatutil.o
+ATTR_RP_OBJS += attrPlatOverride.o
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi
ENTRY_POINT_OBJS += targetservicestart.o
diff --git a/src/usr/targeting/test/testattrtank.H b/src/usr/targeting/test/testattrtank.H
index fc84fab28..5a7cb8cc7 100644
--- a/src/usr/targeting/test/testattrtank.H
+++ b/src/usr/targeting/test/testattrtank.H
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013,2014 */
+/* Contributors Listed Below - COPYRIGHT 2013,2014 */
+/* [+] 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. */
@@ -32,6 +34,8 @@
#include <cxxtest/TestSuite.H>
#include <targeting/common/attributeTank.H>
+#include <targeting/attrPlatOverride.H>
+#include <pnor/pnorif.H>
using namespace TARGETING;
@@ -132,7 +136,7 @@ public:
TS_FAIL("tankTest2: Error. Attribute not in tank (2)");
break;
}
-
+
if (l_tank.attributeExists(1))
{
TS_FAIL("tankTest2: Error. Wrong attribute in tank (3)");
@@ -1142,6 +1146,222 @@ public:
TS_TRACE("tankTest7 complete" );
}
+
+ /**
+ * @brief Test BMC Attr Override function
+ * Set attributes into 3 different tanks for attribute override and
+ * serialize the data of each tank. Then call getAttrOverrides to
+ * deserialize each sections data and check that the data is correct
+ *
+ */
+ void testBMCAttrOverride(void)
+ {
+ do
+ {
+ errlHndl_t errhdl = NULL;
+ // Use the TEST partition as scratch space
+ PNOR::SectionInfo_t info;
+ errhdl = PNOR::getSectionInfo( PNOR::TEST, info );
+ if (errhdl)
+ {
+ TS_FAIL("testattrtank::testBMCAttrOverride could not get PNOR test section info");
+ break;
+ }
+
+ // Create local AttributeTanks
+ AttributeTank l_FapiTank;
+ AttributeTank l_TargetTank;
+ AttributeTank l_PermTank;
+
+ // Add ATTR_SCRATCH_UINT64_1 to the Fapi tank
+ uint64_t l_val = 4;
+ l_FapiTank.setAttribute(ATTR_SCRATCH_UINT64_1,
+ TYPE_PROC,
+ AttributeTank::ATTR_POS_NA,
+ AttributeTank::ATTR_UNIT_POS_NA,
+ AttributeTank::ATTR_NODE_NA,
+ 0, sizeof(l_val), &l_val);
+
+ // Add ATTR_SCRATCH_UINT64_1 to the Target tank
+ l_TargetTank.setAttribute(ATTR_SCRATCH_UINT64_1,
+ TYPE_PROC,
+ 1,
+ AttributeTank::ATTR_UNIT_POS_NA,
+ AttributeTank::ATTR_NODE_NA,
+ 0, sizeof(l_val), &l_val);
+ // Add ATTR_SCRATCH_UINT64_1 to the Perm tank
+ l_PermTank.setAttribute(ATTR_SCRATCH_UINT64_1,
+ TYPE_PROC,
+ 1,
+ AttributeTank::ATTR_UNIT_POS_NA,
+ AttributeTank::ATTR_NODE_NA,
+ 0, sizeof(l_val), &l_val);
+
+ ////////////////////////////////////////////////////////////////////
+ // Fapi
+
+ // Serialize all attributes from each tank
+ AttributeTank::AttributeSerializedChunks_t l_attributes;
+ l_FapiTank.serializeAttributes(AttributeTank::ALLOC_TYPE_NEW,
+ 4096, l_attributes);
+
+ // Copy Fapi Override chunk to PNOR
+ uint32_t l_index = PNOR::pnorTestSec_BMCAttrOverride_offset;
+ for (AttributeTank::AttributeSerializedChunks_t::iterator
+ chunkIter = l_attributes.begin();
+ chunkIter != l_attributes.end();
+ ++chunkIter)
+ {
+ AttrOverrideSection * l_pAttrOverSec =
+ reinterpret_cast<AttrOverrideSection *>
+ (info.vaddr + l_index);
+ AttributeTank::AttributeSerializedChunk l_chunk = *chunkIter;
+ l_pAttrOverSec->iv_layer = AttributeTank::TANK_LAYER_FAPI;
+ l_pAttrOverSec->iv_size = l_chunk.iv_size;
+ memcpy(&l_pAttrOverSec->iv_chunk, l_chunk.iv_pAttributes,
+ l_chunk.iv_size);
+ l_index += sizeof(AttrOverrideSection)+l_pAttrOverSec->iv_size;
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ // Targeting
+
+ // Serialize all attributes from each tank
+ l_attributes.clear();
+ l_TargetTank.serializeAttributes(AttributeTank::ALLOC_TYPE_NEW,
+ 4096, l_attributes);
+
+ // Copy Target Override chunk to PNOR
+ for (AttributeTank::AttributeSerializedChunks_t::iterator
+ chunkIter = l_attributes.begin();
+ chunkIter != l_attributes.end();
+ ++chunkIter)
+ {
+ AttrOverrideSection * l_pAttrOverSec =
+ reinterpret_cast<AttrOverrideSection *>
+ (info.vaddr + l_index);
+ AttributeTank::AttributeSerializedChunk l_chunk = *chunkIter;
+ l_pAttrOverSec->iv_layer = AttributeTank::TANK_LAYER_TARG;
+ l_pAttrOverSec->iv_size = l_chunk.iv_size;
+ memcpy(&l_pAttrOverSec->iv_chunk, l_chunk.iv_pAttributes,
+ l_chunk.iv_size);
+ l_index += sizeof(AttrOverrideSection)+l_pAttrOverSec->iv_size;
+
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ // Permanent
+
+ // Serialize all attributes from each tank
+ l_attributes.clear();
+ l_PermTank.serializeAttributes(AttributeTank::ALLOC_TYPE_NEW,
+ 4096, l_attributes);
+
+ // Copy Target Override chunk to PNOR
+ for (AttributeTank::AttributeSerializedChunks_t::iterator
+ chunkIter = l_attributes.begin();
+ chunkIter != l_attributes.end();
+ ++chunkIter)
+ {
+ AttrOverrideSection * l_pAttrOverSec =
+ reinterpret_cast<AttrOverrideSection *>
+ (info.vaddr + l_index);
+ AttributeTank::AttributeSerializedChunk l_chunk = *chunkIter;
+ l_pAttrOverSec->iv_layer = AttributeTank::TANK_LAYER_PERM;
+ l_pAttrOverSec->iv_size = l_chunk.iv_size;
+ memcpy(&l_pAttrOverSec->iv_chunk, l_chunk.iv_pAttributes,
+ l_chunk.iv_size);
+ l_index += sizeof(AttrOverrideSection)+l_pAttrOverSec->iv_size;
+
+ }
+
+ // Add termination section
+ AttrOverrideSection * l_pAttrOverSecTerm =
+ reinterpret_cast<AttrOverrideSection *>
+ (info.vaddr + l_index);
+ l_pAttrOverSecTerm->iv_layer = AttributeTank::TANK_LAYER_NONE;
+ l_pAttrOverSecTerm->iv_size = 0;
+
+ // Clear tanks
+ l_FapiTank.clearAllAttributes();
+ l_TargetTank.clearAllAttributes();
+ l_PermTank.clearAllAttributes();
+
+ // Call function that actually reads in attribute overrides
+ AttributeTank* l_tanks[AttributeTank::TANK_LAYER_LAST];
+ l_tanks[AttributeTank::TANK_LAYER_FAPI-1] = &l_FapiTank;
+ l_tanks[AttributeTank::TANK_LAYER_TARG-1] = &l_TargetTank;
+ l_tanks[AttributeTank::TANK_LAYER_PERM-1] = &l_PermTank;
+ errhdl = getAttrOverrides(PNOR::TEST,
+ l_tanks,
+ PNOR::pnorTestSec_BMCAttrOverride_offset);
+ if (errhdl)
+ {
+ errlCommit(errhdl, TARG_COMP_ID);
+ TS_FAIL("testattrtank::testBMCAttrOverride getAttrOverrides() failed");
+ break;
+ }
+
+ ////////////////////////////////////////////////////////////////////
+ // Check the first attribute made it back into the Fapi tank
+ l_val = 0;
+ if (!(l_FapiTank.getAttribute(ATTR_SCRATCH_UINT64_1,
+ TYPE_PROC,
+ AttributeTank::ATTR_POS_NA,
+ AttributeTank::ATTR_UNIT_POS_NA,
+ AttributeTank::ATTR_NODE_NA,
+ &l_val)))
+ {
+ TS_FAIL("testattrtank::testBMCAttrOverride: Error. Did not get attr from Fapi Tank");
+ break;
+ }
+ if (l_val != 4)
+ {
+ TS_FAIL("testattrtank::testBMCAttrOverride: Error. Got bad value (0x%X) from Fapi Tank",
+ l_val);
+ break;
+ }
+
+ // Check the first attribute made it back into the Target tank
+ l_val = 0;
+ if (!(l_TargetTank.getAttribute(ATTR_SCRATCH_UINT64_1,
+ TYPE_PROC,
+ 1,
+ AttributeTank::ATTR_UNIT_POS_NA,
+ AttributeTank::ATTR_NODE_NA,
+ &l_val)))
+ {
+ TS_FAIL("testattrtank::testBMCAttrOverride: Error. Did not get attr from Target Tank");
+ break;
+ }
+ if (l_val != 4)
+ {
+ TS_FAIL("testattrtank::testBMCAttrOverride: Error. Got bad value (0x%X) from Target Tank",
+ l_val);
+ break;
+ }
+
+ // Check the first attribute made it back into the Perm tank
+ l_val = 0;
+ if (!(l_PermTank.getAttribute(ATTR_SCRATCH_UINT64_1,
+ TYPE_PROC,
+ 1,
+ AttributeTank::ATTR_UNIT_POS_NA,
+ AttributeTank::ATTR_NODE_NA,
+ &l_val)))
+ {
+ TS_FAIL("testattrtank::testBMCAttrOverride: Error. Did not get attr from Perm Tank");
+ break;
+ }
+ if (l_val != 4)
+ {
+ TS_FAIL("testattrtank::testBMCAttrOverride: Error. Got bad value (0x%X) from Perm Tank",
+ l_val);
+ break;
+ }
+ } while(0);
+ TRACFCOMP(g_trac_targeting, "testattrtank::testBMCAttrOverride: Success steve");
+ }
};
#endif
OpenPOWER on IntegriCloud