summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Schwartz <whs@us.ibm.com>2015-05-15 07:09:27 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2015-07-21 16:08:13 -0500
commitb7f5e1563415cf786ca80c83351d792a70c18899 (patch)
treee08a903bfbf0a2c86cf9d5f118847f6ade315701
parent547e3794064bc372e8d10a371bb9e305c89b8f8f (diff)
downloadtalos-hostboot-b7f5e1563415cf786ca80c83351d792a70c18899.tar.gz
talos-hostboot-b7f5e1563415cf786ca80c83351d792a70c18899.zip
New HBRT interfaces for attribute overrides
Add interface to apply attribute overrides Change-Id: I2eb9f32e0236d7296ff3f3f133af4ef349d70376 RTC: 127328 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/17818 Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: MATTHEW A. PLOETZ <maploetz@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
-rw-r--r--src/include/runtime/interface.h11
-rwxr-xr-xsrc/include/usr/hwpf/plat/fapiPlatAttrOverrideSync.H9
-rw-r--r--src/include/usr/runtime/rt_targeting.H4
-rw-r--r--src/include/usr/targeting/attrPlatOverride.H7
-rw-r--r--src/usr/targeting/hostboot_common.mk5
-rw-r--r--src/usr/targeting/makefile2
-rw-r--r--src/usr/targeting/runtime/attrPlatOverride_rt.C104
-rw-r--r--src/usr/targeting/runtime/makefile7
-rw-r--r--src/usr/targeting/runtime/test/makefile5
-rw-r--r--src/usr/targeting/runtime/test/testtargeting.H111
10 files changed, 256 insertions, 9 deletions
diff --git a/src/include/runtime/interface.h b/src/include/runtime/interface.h
index ca62f2ea1..19c673c16 100644
--- a/src/include/runtime/interface.h
+++ b/src/include/runtime/interface.h
@@ -454,6 +454,17 @@ typedef struct runtimeInterfaces
*/
int (*enable_occ_actuation)(int i_occ_activation);
+
+ /**
+ * @brief Apply a set of attribute overrides
+ * @param[in] pointer to binary override data
+ * @param[in] length of override data (bytes)
+ * @returns 0 on success, or return code if the command failed
+ * @platform OpenPower
+ */
+ int (*apply_attr_override)(uint8_t* i_data,
+ size_t i_size );
+
// Reserve some space for future growth.
void (*reserved[32])(void);
diff --git a/src/include/usr/hwpf/plat/fapiPlatAttrOverrideSync.H b/src/include/usr/hwpf/plat/fapiPlatAttrOverrideSync.H
index fbc036eda..88c7d47ef 100755
--- a/src/include/usr/hwpf/plat/fapiPlatAttrOverrideSync.H
+++ b/src/include/usr/hwpf/plat/fapiPlatAttrOverrideSync.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2012,2014 */
+/* Contributors Listed Below - COPYRIGHT 2012,2015 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -50,6 +50,11 @@ namespace TARGETING
errlHndl_t getAttrOverrides(PNOR::SectionInfo_t &i_sectionInfo,
AttributeTank* io_tanks[AttributeTank::TANK_LAYER_LAST]);
}
+namespace RT_TARG
+{
+ int apply_attr_override(uint8_t* i_data,
+ size_t i_size );
+}
namespace fapi
{
@@ -92,6 +97,8 @@ public:
PNOR::SectionInfo_t &i_sectionInfo,
TARGETING::AttributeTank*
io_tanks[TARGETING::AttributeTank::TANK_LAYER_LAST]);
+ friend int RT_TARG::apply_attr_override(uint8_t* i_data,
+ size_t i_size );
/**
* @brief Maximum size of a direct attribute override
diff --git a/src/include/usr/runtime/rt_targeting.H b/src/include/usr/runtime/rt_targeting.H
index a95d599dd..6b7ee4075 100644
--- a/src/include/usr/runtime/rt_targeting.H
+++ b/src/include/usr/runtime/rt_targeting.H
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2014 */
+/* Contributors Listed Below - COPYRIGHT 2014,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. */
diff --git a/src/include/usr/targeting/attrPlatOverride.H b/src/include/usr/targeting/attrPlatOverride.H
index 6461228ab..266f1976e 100644
--- a/src/include/usr/targeting/attrPlatOverride.H
+++ b/src/include/usr/targeting/attrPlatOverride.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2014 */
+/* Contributors Listed Below - COPYRIGHT 2014,2015 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -68,6 +68,9 @@ const std::pair<AttributeTank::TankLayer, PNOR::SectionId>
* permanent attribute overrides. Currently there are 3 attribute tanks,
* FAPI, Targeting, and Permanent.
*
+ * For runtime attribute updates, a PNOR::SectionInfo is set up to point to the
+ * passed attribute update binary blob instead of being a 'real' pnor section.
+ *
* @param[in] i_sectionInfo PNOR::SectionInfo_t to look for overrides
* @param[in] io_tanks Array of pointers to Attribute tanks, used for
* test cases, default set to NULL
@@ -79,4 +82,4 @@ errlHndl_t getAttrOverrides(PNOR::SectionInfo_t &i_sectionInfo,
} // end of namespace
-#endif \ No newline at end of file
+#endif
diff --git a/src/usr/targeting/hostboot_common.mk b/src/usr/targeting/hostboot_common.mk
index 8d69d436b..36f1342c5 100644
--- a/src/usr/targeting/hostboot_common.mk
+++ b/src/usr/targeting/hostboot_common.mk
@@ -5,7 +5,9 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2013,2014
+# Contributors Listed Below - COPYRIGHT 2013,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.
@@ -30,3 +32,4 @@ VPATH += ${TARGETING_REL_PATH}/adapters
VPATH += ${COMMON_TARGETING_REL_PATH}
VPATH += ${addprefix ${COMMON_TARGETING_REL_PATH}/, ${COMMON_TARGETING_SUBDIRS}}
+HOSTBOOT_RT_IPL_COMMON_OBJS += attrPlatOverride.o
diff --git a/src/usr/targeting/makefile b/src/usr/targeting/makefile
index 2fd5a204d..eaa6dbb8d 100644
--- a/src/usr/targeting/makefile
+++ b/src/usr/targeting/makefile
@@ -39,7 +39,6 @@ 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
@@ -49,6 +48,7 @@ DEBUG_OBJS += attributestrings.o
HOSTBOOT_SPECIFIC_OBJS += ${ENTRY_POINT_OBJS}
HOSTBOOT_SPECIFIC_OBJS += ${ATTR_RP_OBJS}
HOSTBOOT_SPECIFIC_OBJS += ${DEBUG_OBJS}
+HOSTBOOT_SPECIFIC_OBJS += ${HOSTBOOT_RT_IPL_COMMON_OBJS}
HOSTBOOT_SPECIFIC_OBJS += namedtarget.o
diff --git a/src/usr/targeting/runtime/attrPlatOverride_rt.C b/src/usr/targeting/runtime/attrPlatOverride_rt.C
new file mode 100644
index 000000000..be39e65cf
--- /dev/null
+++ b/src/usr/targeting/runtime/attrPlatOverride_rt.C
@@ -0,0 +1,104 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/targeting/attrPlatOverride.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2014,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 */
+
+#include <runtime/interface.h>
+#include <runtime/rt_targeting.H>
+#include <targeting/common/commontargeting.H>
+#include <targeting/attrPlatOverride.H>
+#include <hwpf/plat/fapiPlatAttrOverrideSync.H>
+#include <targeting/common/trace.H>
+#include <errl/errlmanager.H>
+
+using namespace TARGETING;
+
+namespace RT_TARG
+{
+
+int apply_attr_override(uint8_t* i_data,
+ size_t i_size )
+{
+ int rc = 0;
+ errlHndl_t l_errl = NULL;
+
+ TRACFCOMP(g_trac_targeting, "enter apply_attr_override");
+
+ // Clear fapi and targeting attribute override tanks. The tanks are
+ // expected to be empty. The passed overrides are added, not updated
+ // in place.
+ AttributeTank * l_pAttributeTank =
+ &fapi::theAttrOverrideSync().iv_overrideTank;
+ if ((*l_pAttributeTank).attributesExist())
+ {
+ TRACFCOMP(g_trac_targeting, "apply_attr_override:"
+ " clear FAPI attribute overrides");
+ (*l_pAttributeTank).clearAllAttributes();
+ }
+ l_pAttributeTank = &Target::theTargOverrideAttrTank();
+ if ((*l_pAttributeTank).attributesExist())
+ {
+ TRACFCOMP(g_trac_targeting, "apply_attr_override:"
+ " clear targeting attribute overrides");
+ (*l_pAttributeTank).clearAllAttributes();
+ }
+
+ // Pass attribute override blob as a pnor section
+ PNOR::SectionInfo_t l_sectionInfo;
+ l_sectionInfo.vaddr = (uint64_t)i_data;
+ l_sectionInfo.size = i_size;
+ l_sectionInfo.id = PNOR::ATTR_TMP;
+ l_sectionInfo.name = "Runtime TMP";
+
+ // Process attribute overrides
+ l_errl = TARGETING::getAttrOverrides(l_sectionInfo);
+ if (l_errl)
+ {
+ TRACFCOMP(g_trac_targeting, "apply_attr_override:"
+ " getAttrOverrides failed");
+ errlCommit(l_errl, TARG_COMP_ID);
+ rc = -1;
+ }
+ else
+ {
+ TRACFCOMP(g_trac_targeting, "apply_attr_override succeed");
+ }
+ return rc;
+}
+
+//------------------------------------------------------------------------
+
+struct registerTargRT
+{
+ registerTargRT()
+ {
+ runtimeInterfaces_t * rt_intf = getRuntimeInterfaces();
+ rt_intf->apply_attr_override = &apply_attr_override;
+ }
+};
+
+registerTargRT g_registerTargRT;
+
+} // end of namespace
+
+
diff --git a/src/usr/targeting/runtime/makefile b/src/usr/targeting/runtime/makefile
index 74fbd6a33..1c78cbd98 100644
--- a/src/usr/targeting/runtime/makefile
+++ b/src/usr/targeting/runtime/makefile
@@ -5,7 +5,9 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2013,2014
+# Contributors Listed Below - COPYRIGHT 2013,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.
@@ -34,8 +36,11 @@ HOSTBOOT_RUNTIME_SPECIFIC_OBJS += attrrp_rt.o
HOSTBOOT_RUNTIME_SPECIFIC_OBJS += start_rt.o
HOSTBOOT_RUNTIME_SPECIFIC_OBJS += targplatutil.o
HOSTBOOT_RUNTIME_SPECIFIC_OBJS += rt_targeting.o
+HOSTBOOT_RUNTIME_SPECIFIC_OBJS += attrPlatOverride_rt.o
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi
OBJS += ${COMMON_TARGETING_OBJS}
+OBJS += ${HOSTBOOT_RT_IPL_COMMON_OBJS}
OBJS += ${HOSTBOOT_RUNTIME_SPECIFIC_OBJS}
include $(ROOTPATH)/config.mk
diff --git a/src/usr/targeting/runtime/test/makefile b/src/usr/targeting/runtime/test/makefile
index 29b8d417e..2e0ba3552 100644
--- a/src/usr/targeting/runtime/test/makefile
+++ b/src/usr/targeting/runtime/test/makefile
@@ -5,7 +5,9 @@
#
# OpenPOWER HostBoot Project
#
-# COPYRIGHT International Business Machines Corp. 2013,2014
+# Contributors Listed Below - COPYRIGHT 2013,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.
@@ -23,6 +25,7 @@
HOSTBOOT_RUNTIME = 1
ROOTPATH = ../../../../..
+EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi
MODULE = testtargeting_rt
TESTS = *.H
diff --git a/src/usr/targeting/runtime/test/testtargeting.H b/src/usr/targeting/runtime/test/testtargeting.H
index f23cee587..d5dae303a 100644
--- a/src/usr/targeting/runtime/test/testtargeting.H
+++ b/src/usr/targeting/runtime/test/testtargeting.H
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013,2014 */
+/* Contributors Listed Below - COPYRIGHT 2013,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. */
@@ -22,11 +24,14 @@
/* IBM_PROLOG_END_TAG */
#include <cxxtest/TestSuite.H>
#include <targeting/common/commontargeting.H>
+#include <runtime/interface.h>
#include <runtime/rt_targeting.H>
#include <errl/errlentry.H>
#include <errl/errlmanager.H>
#include <targeting/common/trace.H>
#include <targeting/common/utilFilter.H>
+#include <targeting/attrPlatOverride.H>
+#include <hwpf/plat/fapiPlatAttrOverrideSync.H>
class TargetingTestSuite : public CxxTest::TestSuite
{
@@ -112,4 +117,108 @@ class TargetingTestSuite : public CxxTest::TestSuite
}
}
}
+
+ void testApplyAttrOverrides()
+ {
+ using namespace TARGETING;
+ TRACFCOMP(g_trac_targeting,"testApplyAttrOverrides");
+ do
+ {
+
+ // Get the address of the runtime apply overrides function
+ runtimeInterfaces_t* rt_intf = getRuntimeInterfaces();
+ if(rt_intf == NULL)
+ {
+ TS_FAIL("runtimeIntfaces not set");
+ break;
+ }
+ if( rt_intf->apply_attr_override == NULL )
+ {
+ TS_FAIL("runtimeInterfaces->apply_attr_override not set");
+ break;
+ }
+
+ // Get the initial value of the test attribute
+ TargetService& l_targetService = targetService();
+ TARGETING::Target* l_pTarget = NULL;
+ (void) l_targetService.getTopLevelTarget(l_pTarget);
+ if (l_pTarget == NULL)
+ {
+ TS_FAIL("Top level target handle is NULL");
+ break;
+ }
+ uint8_t l_attrVal =
+ l_pTarget->getAttr<TARGETING::ATTR_SCRATCH_UINT8_1>();
+ uint8_t l_attrOverrideVal = l_attrVal + 1;
+ TRACFCOMP(g_trac_targeting,
+ "apply_attr_override attribute value = 0x%02x",
+ l_attrVal);
+
+ // Set up attribute override binary blob
+ const uint64_t l_attrBlobSizeMax = 4096;
+ uint8_t l_pAttrOverrideBlob[l_attrBlobSizeMax] = {0xff};
+ AttributeTank l_TargetTank;
+ l_TargetTank.setAttribute(ATTR_SCRATCH_UINT8_1,
+ TYPE_SYS,
+ AttributeTank::ATTR_POS_NA,
+ AttributeTank::ATTR_UNIT_POS_NA,
+ AttributeTank::ATTR_NODE_NA,
+ 0,
+ sizeof(l_attrOverrideVal),
+ &l_attrOverrideVal);
+ AttributeTank::AttributeSerializedChunks_t l_attributes;
+ l_TargetTank.serializeAttributes(
+ AttributeTank::ALLOC_TYPE_NEW,
+ l_attrBlobSizeMax,
+ l_attributes);
+ // Copy override chunk to form attribute override section
+ AttributeTank::AttributeSerializedChunk l_chunk;
+ AttrOverrideSection * l_pAttrOverSec = NULL;
+ uint32_t l_tmpIndex = 0;
+ for (AttributeTank::AttributeSerializedChunks_t::iterator
+ chunkIter = l_attributes.begin();
+ chunkIter != l_attributes.end();
+ ++chunkIter)
+ {
+ l_chunk = *chunkIter;
+ l_pAttrOverSec = reinterpret_cast<AttrOverrideSection *>
+ (l_pAttrOverrideBlob + l_tmpIndex);
+ 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_tmpIndex += sizeof(AttrOverrideSection)+
+ l_pAttrOverSec->iv_size;
+ }
+ // Add termination section
+ l_pAttrOverSec = reinterpret_cast<AttrOverrideSection *>
+ (l_pAttrOverrideBlob + l_tmpIndex);
+ l_pAttrOverSec->iv_layer = AttributeTank::TANK_LAYER_TERM;
+ l_pAttrOverSec->iv_size = 0;
+ l_tmpIndex += sizeof(AttrOverrideSection);
+ // call runtime override attributes
+ int rc = rt_intf->apply_attr_override(
+ l_pAttrOverrideBlob,
+ l_tmpIndex);
+ if (rc)
+ {
+ TS_FAIL("apply_attr_override empty list failed rc=%x",rc);
+ break;
+ }
+ // verify the overriden value
+ uint8_t l_attrNewVal =
+ l_pTarget->getAttr<TARGETING::ATTR_SCRATCH_UINT8_1>();
+ TRACFCOMP(g_trac_targeting,
+ "apply_attr_override overriden attribute value = 0x%02x",
+ l_attrNewVal);
+ if (l_attrNewVal != l_attrOverrideVal)
+ {
+ TS_FAIL("apply_attr_override value=0x%02x expected=0x%02x",
+ l_attrNewVal,l_attrOverrideVal);
+ break;
+ }
+ TRACFCOMP(g_trac_targeting,"testApplyAttrOverrides SUCCESS");
+
+ } while (0);
+ }
};
OpenPOWER on IntegriCloud