summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/usr/mbox/mbox_queues.H2
-rw-r--r--src/include/usr/mbox/mboxif.H54
-rw-r--r--src/include/usr/targeting/attrrp.H84
-rw-r--r--src/include/usr/targeting/attrsync.H209
-rw-r--r--src/include/usr/targeting/common/attrsyncdefs.H99
-rw-r--r--src/include/usr/targeting/common/targetservice.H121
-rw-r--r--src/include/usr/targeting/common/targreasoncodes.H2
-rw-r--r--src/usr/hwpf/hwp/core_activate/core_activate.C27
-rw-r--r--src/usr/hwpf/hwp/core_activate/core_activate.H47
-rw-r--r--src/usr/mbox/mailboxsp.C19
-rw-r--r--src/usr/targeting/attrrp.C62
-rw-r--r--src/usr/targeting/attrsync.C270
-rw-r--r--src/usr/targeting/common/targetservice.C41
-rw-r--r--src/usr/targeting/makefile3
-rw-r--r--src/usr/targeting/test/makefile9
-rw-r--r--src/usr/targeting/test/testattrsync.H119
16 files changed, 1060 insertions, 108 deletions
diff --git a/src/include/usr/mbox/mbox_queues.H b/src/include/usr/mbox/mbox_queues.H
index 6c7134061..a940c1098 100644
--- a/src/include/usr/mbox/mbox_queues.H
+++ b/src/include/usr/mbox/mbox_queues.H
@@ -42,6 +42,7 @@ namespace MBOX
NOT_FOUND = 0,
HB_MAILBOX_MSGQ,
HB_ISTEP_MSGQ,
+ HB_ATTR_SYNC_MSGQ,
// Add HB services here:
HB_TEST_MSGQ = 0x7FFFFFFF,
@@ -53,6 +54,7 @@ namespace MBOX
FSP_TRACE_MSGQ,
FSP_ERRL_MSGQ,
IPL_SERVICE_QUEUE = 0x80000008, // Defined by Fsp team
+ FSP_ATTR_SYNC_MSGQ = 0x80000009,
// Add FSP services here:
FSP_ECHO_MSGQ = 0xFFFFFFFF, // Fake FSP for test
};
diff --git a/src/include/usr/mbox/mboxif.H b/src/include/usr/mbox/mboxif.H
index fc321f757..d427e5e28 100644
--- a/src/include/usr/mbox/mboxif.H
+++ b/src/include/usr/mbox/mboxif.H
@@ -1,25 +1,26 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/include/usr/mbox/mboxif.H $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 2012
-//
-// p1
-//
-// Object Code Only (OCO) source materials
-// Licensed Internal Code Source Materials
-// IBM HostBoot Licensed Internal Code
-//
-// The source code for this program is not published or other-
-// wise divested of its trade secrets, irrespective of what has
-// been deposited with the U.S. Copyright Office.
-//
-// Origin: 30
-//
-// IBM_PROLOG_END
+/* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/include/usr/mbox/mboxif.H $
+ *
+ * IBM CONFIDENTIAL
+ *
+ * COPYRIGHT International Business Machines Corp. 2012
+ *
+ * p1
+ *
+ * Object Code Only (OCO) source materials
+ * Licensed Internal Code Source Materials
+ * IBM HostBoot Licensed Internal Code
+ *
+ * The source code for this program is not published or other-
+ * wise divested of its trade secrets, irrespective of what has
+ * been deposited with the U.S. Copyright Office.
+ *
+ * Origin: 30
+ *
+ * IBM_PROLOG_END_TAG
+ */
#ifndef __MBOX_MBOXIF_H
#define __MBOX_MBOXIF_H
@@ -85,6 +86,15 @@ namespace MBOX
*/
errlHndl_t sendrecv(queue_id_t i_q_id, msg_t * io_msg);
+ /**
+ * Determine if the mailbox is enabled
+ *
+ * @return bool
+ * true -> mailbox is enabled
+ * flalse -> mailbox is disabled (spless system)
+ */
+ bool mailbox_enabled();
+
}; // end namespace MBOX
#endif
diff --git a/src/include/usr/targeting/attrrp.H b/src/include/usr/targeting/attrrp.H
index d5a4775a0..ffa615580 100644
--- a/src/include/usr/targeting/attrrp.H
+++ b/src/include/usr/targeting/attrrp.H
@@ -1,26 +1,26 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/usr/targeting/attrrp.H $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 2011
-//
-// p1
-//
-// Object Code Only (OCO) source materials
-// Licensed Internal Code Source Materials
-// IBM HostBoot Licensed Internal Code
-//
-// The source code for this program is not published or other-
-// wise divested of its trade secrets, irrespective of what has
-// been deposited with the U.S. Copyright Office.
-//
-// Origin: 30
-//
-// IBM_PROLOG_END
-
+/* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/include/usr/targeting/attrrp.H $
+ *
+ * IBM CONFIDENTIAL
+ *
+ * COPYRIGHT International Business Machines Corp. 2011-2012
+ *
+ * p1
+ *
+ * Object Code Only (OCO) source materials
+ * Licensed Internal Code Source Materials
+ * IBM HostBoot Licensed Internal Code
+ *
+ * The source code for this program is not published or other-
+ * wise divested of its trade secrets, irrespective of what has
+ * been deposited with the U.S. Copyright Office.
+ *
+ * Origin: 30
+ *
+ * IBM_PROLOG_END_TAG
+ */
#ifndef __TARGETING_ATTRRP_H
#define __TARGETING_ATTRRP_H
@@ -38,6 +38,9 @@
#include <initservice/taskargs.H>
#include <sys/msg.h>
#include <targeting/adapters/types.H>
+#include <targeting/common/targetservice.H>
+#include <targeting/attrsync.H>
+
namespace TARGETING
{
@@ -59,6 +62,15 @@ struct AttrRP_Section;
*/
class AttrRP
{
+
+ // add some friends for the attribute sync features
+ friend bool TargetService::writeSectionData(
+ const std::vector<sectionRefData>& i_pages );
+
+ friend void TargetService::readSectionData(
+ std::vector<sectionRefData>& o_pages,
+ const SECTION_TYPE i_sectionId);
+
public:
/**
@@ -129,6 +141,32 @@ class AttrRP
*/
~AttrRP();
+ /**
+ * @brief Copies the section data buffer from the vector to the
+ * appropriate section offset with respect to the node target ptr
+ * and section id.
+ *
+ * @param[in] i_pages, vector of sectionRefData struct
+ *
+ * @return void
+ */
+
+ void writeSectionData(
+ const std::vector <sectionRefData>& i_pages);
+
+ /**
+ * @brief Populates the output vector with the correct information
+ * for the data pages specified by the selected section
+ *
+ * @param[out] o_pages, vector of sectionRefData struct
+ *
+ * @return void
+ */
+ void readSectionData(
+ std::vector <sectionRefData>& o_pages,
+ const SECTION_TYPE i_sectionType);
+
+
private:
/**
diff --git a/src/include/usr/targeting/attrsync.H b/src/include/usr/targeting/attrsync.H
new file mode 100644
index 000000000..274674382
--- /dev/null
+++ b/src/include/usr/targeting/attrsync.H
@@ -0,0 +1,209 @@
+/* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/include/usr/targeting/attrsync.H $
+ *
+ * IBM CONFIDENTIAL
+ *
+ * COPYRIGHT International Business Machines Corp. 2012
+ *
+ * p1
+ *
+ * Object Code Only (OCO) source materials
+ * Licensed Internal Code Source Materials
+ * IBM HostBoot Licensed Internal Code
+ *
+ * The source code for this program is not published or other-
+ * wise divested of its trade secrets, irrespective of what has
+ * been deposited with the U.S. Copyright Office.
+ *
+ * Origin: 30
+ *
+ * IBM_PROLOG_END_TAG
+ */
+#ifndef __ATTRSYNC_H_
+#define __ATTRSYNC_H_
+/**
+ * @file targeting/attsync.H
+ *
+ * @brief Interface to support syncing the targeting attributes between the
+ * FSP and Hostboot. Sync operations can be either direction, HB->FSP
+ * or FSP->HB however for sprint 7.12 only HB->FSP support will be
+ * added.
+ */
+//******************************************************************************
+// Includes
+//******************************************************************************
+#include <mbox/mbox_queues.H>
+#include <mbox/mboxif.H>
+#include <errl/errlentry.H>
+#include <sys/msg.h>
+#include <pnortargeting.H>
+#include <stddef.h>
+#include <targeting/common/targetservice.H>
+#include <targeting/common/attrsyncdefs.H>
+
+
+namespace TARGETING
+{
+
+ /**
+ * @class AttributeSync
+ *
+ * @brief Targeting attribute sync class
+ *
+ * @par Detailed Description:
+ * Provides all the functionality to synchronize the targetting
+ * attributes from the Hostboot area down to the FSP
+ */
+ class AttributeSync
+ {
+
+ public:
+
+ /**
+ * @brief Initialize the attribute synchronization object
+ *
+ * @par Detailed Description
+ * Ensures member variables are initialized to sane values.
+ */
+ AttributeSync();
+
+ /**
+ * @brief Destroy the attribute sync object resources
+ *
+ * @par Detailed Description:
+ * Frees any memory allocated by the attribute sync object
+ *
+ */
+ ~AttributeSync();
+
+ /**
+ * @brief Setup the internal variables to point to the correct
+ * attribute section.
+ *
+ * @par Detailed Description:
+ * This funciton will call into the AttRP:: to have the
+ * correct attribute section paged into accessable memory.
+ * this function may be called multiple times with different
+ * section names.
+ *
+ * @pre None:
+ *
+ * @post The entire section from the HB attribute section
+ * passed in has been synchronized to the FSP memory area.
+ *
+ * @param[in] i_section_to_sync
+ * TARGETING::SECTION_TYPE is passed in to
+ * identify the section to be synced to the
+ * FSP.
+ *
+ * @return errlHndl_t
+ * return errl == NULL -> success
+ * return errl != NULL -> failure
+ *
+ */
+ errlHndl_t syncSectionToFsp(
+ TARGETING::SECTION_TYPE i_section_to_sync );
+
+ private:
+
+ /**
+ * @enum TARGETING::MBOX_MSG_TYPE
+ *
+ * @brief Message enum to determine if msg should be sent
+ * asynchronously or if the call should be synchronous
+ *
+ */
+ enum MBOX_MSG_TYPE
+ {
+ ASYNCHRONOUS,
+ SYNCHRONOUS
+ };
+
+ /**
+ * @brief Setup the internal variables to point to the correct
+ * attribute section.
+ *
+ * @par Detailed Description:
+ * This funciton will call into the AttRP:: to have the
+ * correct attribute section paged into accessable memory
+ *
+ */
+ void getSectionData();
+
+ /**
+ * @brief Uses the internal mailbox to send a message to the FSP
+ *
+ *
+ * @par Detailed Description:
+ * This funciton will call into mailboxsp code using the
+ * FSP_ATTR_SYNC_MSGQ as a target message queue..
+ *
+ * @param[in] i_type
+ * TARGETING::MBOX_MSG_TYPE passed in to define the
+ * message sending policy.
+ *
+ * @param[in/out] i_msg
+ * This parameter is used as both input and an
+ * output parameter. If the message is sent
+ * synchronusly the response will be populated
+ * in an object pointed to by this pointer. If
+ * the message is asynchronus the object
+ * pointed to by this paramter will be sent to
+ * the fsp.
+ *
+ * @return errlHndl_t
+ * return errl == NULL -> success
+ * return errl != NULL -> failure
+ */
+ errlHndl_t sendMboxMessage( MBOX_MSG_TYPE i_type, msg_t * i_msg );
+
+ /**
+ * @brief Sends the sync complete message to the FSP indicating
+ * the operation has completed.
+ *
+ * @return errlHndl_t
+ * return errl == NULL -> success
+ * return errl != NULL -> failure
+ */
+ errlHndl_t sendSyncCompleteMessage();
+
+ private:
+
+ // id of the section being updated
+ TARGETING::SECTION_TYPE iv_section_to_sync;
+
+
+ // count of total pages, calculated from data supplied by the
+ // attribute resource provider code;
+ uint16_t iv_total_pages;
+
+ // maintiains the current page number being sync'ed.
+ uint16_t iv_current_page;
+
+ // vector of structures to hold the location info for each section
+ // we would like to sync. Data is filled in by the attrrp code
+ // when we call AttRP::readSectionData(...
+ std::vector <TARGETING::sectionRefData>iv_pages;
+
+ };
+
+ /**
+ * @brief Handles synchronization of all RW targeting attributes from
+ * hostboot to the fsp; the following section are are
+ * synchronized.
+ *
+ * 1). SECTION_TYPE_PNOR_RW
+ * 2). SECTION_TYPE_HEAP_PNOR_INIT
+ * 3). SECTION_TYPE_HEAP_PNOR_ZERO_INIT
+ *
+ *
+ * @return errlHndl_t
+ * return errl == NULL -> success
+ * return errl != NULL -> failure
+ */
+ errlHndl_t syncAllAttributesToFsp();
+
+} // namespace
+#endif
diff --git a/src/include/usr/targeting/common/attrsyncdefs.H b/src/include/usr/targeting/common/attrsyncdefs.H
new file mode 100644
index 000000000..74103a268
--- /dev/null
+++ b/src/include/usr/targeting/common/attrsyncdefs.H
@@ -0,0 +1,99 @@
+/* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/include/usr/targeting/common/attrsyncdefs.H $
+ *
+ * IBM CONFIDENTIAL
+ *
+ * COPYRIGHT International Business Machines Corp. 2012
+ *
+ * p1
+ *
+ * Object Code Only (OCO) source materials
+ * Licensed Internal Code Source Materials
+ * IBM HostBoot Licensed Internal Code
+ *
+ * The source code for this program is not published or other-
+ * wise divested of its trade secrets, irrespective of what has
+ * been deposited with the U.S. Copyright Office.
+ *
+ * Origin: 30
+ *
+ * IBM_PROLOG_END_TAG
+ */
+#ifndef __ATTRSYNC_DEFS_H__
+#define __ATTRSYNC_DEFS_H__
+
+//******************************************************************************
+// Macros
+//******************************************************************************
+// constants for use in masking off corresponding bytes in message data words
+// used for attribute synchronization mbox messages, sectoin ID and page
+// number are used in the sync messages
+const uint64_t SECTIONID_MASK = 0xFFFF000000000000;
+const uint64_t PAGE_NUMBER_MASK = 0x0000FFFF00000000;
+
+// page count mask, used in attribute sync commit message
+const uint64_t PAGE_COUNT_MASK = 0xFFFF000000000000;
+
+// mask to manipulate the return code field in the data returned in the
+// response to an attribute sync commit message
+const uint64_t RETURN_CODE_MASK = 0xFFFF000000000000;
+
+
+// used to add the section into the first data word of an attribute sync
+// message - only modifies the first two bytes of the uint64_t
+#define ATTR_SYNC_ADD_SECTION_ID( sectionId, data0 ) \
+ ( data0 = ( data0 & ~SECTIONID_MASK) | \
+ ( static_cast<uint64_t>(sectionId) << 48 ) )
+
+// used to add the number of the current page to by sync'd. used in the
+// attribute sync message code. Only modifies the second two bytes
+// of the uint64_t
+#define ATTR_SYNC_ADD_PAGE_NUMBER( pageNumber, data0 ) \
+ ( data0 = ( data0 & ~PAGE_NUMBER_MASK) | \
+ ( static_cast<uint64_t>(pageNumber) << 32 ) )
+
+// Used in the commit message sent after all the pages of the current section
+// oare sent, the macro will add the total page count to the first two bytes
+// of the data[0] uint64_t in the mailbox message.
+#define ATTR_SYNC_ADD_PAGE_COUNT( pageCount, data0 ) \
+ ( data0 = ( data0 & ~PAGE_COUNT_MASK) | \
+ ( static_cast<uint64_t>(pageCount) << 48 ) )
+
+// grabs the return code from the uint64_t returned by the mailbox message
+#define ATTR_SYNC_GET_RC( data0 ) ( static_cast<ATTR_SYNC_RC>( \
+ ( data0 & RETURN_CODE_MASK ) >> 48 ))
+
+namespace TARGETING
+{
+ /**
+ * @enum TARGETING::ATTR_SYNC_MSG_TYPE
+ *
+ * @brief Targeting attribute sync service message types for use in the
+ * attribute sync messges between FSP and Hostboot
+ */
+ enum ATTR_SYNC_MSG_TYPE
+ {
+ ATTR_SYNC_NO_MSG = 0,
+ ATTR_SYNC_SECTION = 0x000000A1,
+ ATTR_SYNC_COMPLETE = 0x000000A2,
+ };
+
+
+ /**
+ * @enum TARGETING::ATTR_SYNC_RC
+ *
+ * @brief Return code values for the sync complete message used by HB
+ * and the FSP when the sync has been completed.
+ *
+ */
+ enum ATTR_SYNC_RC
+ {
+ ATTR_SYNC_SUCCESS = 0,
+ ATTR_SYNC_FAILURE = 1
+ };
+
+}; // end namespace
+
+#endif
diff --git a/src/include/usr/targeting/common/targetservice.H b/src/include/usr/targeting/common/targetservice.H
index 444dbc472..d9610e84a 100644
--- a/src/include/usr/targeting/common/targetservice.H
+++ b/src/include/usr/targeting/common/targetservice.H
@@ -1,26 +1,26 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/include/usr/targeting/targetservice.H $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 2011
-//
-// p1
-//
-// Object Code Only (OCO) source materials
-// Licensed Internal Code Source Materials
-// IBM HostBoot Licensed Internal Code
-//
-// The source code for this program is not published or other-
-// wise divested of its trade secrets, irrespective of what has
-// been deposited with the U.S. Copyright Office.
-//
-// Origin: 30
-//
-// IBM_PROLOG_END
-
+/* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/include/usr/targeting/common/targetservice.H $
+ *
+ * IBM CONFIDENTIAL
+ *
+ * COPYRIGHT International Business Machines Corp. 2011-2012
+ *
+ * p1
+ *
+ * Object Code Only (OCO) source materials
+ * Licensed Internal Code Source Materials
+ * IBM HostBoot Licensed Internal Code
+ *
+ * The source code for this program is not published or other-
+ * wise divested of its trade secrets, irrespective of what has
+ * been deposited with the U.S. Copyright Office.
+ *
+ * Origin: 30
+ *
+ * IBM_PROLOG_END_TAG
+ */
#ifndef __TARGETING_COMMON_TARGETSERVICE_H
#define __TARGETING_COMMON_TARGETSERVICE_H
@@ -48,6 +48,7 @@
#include <targeting/common/iterators/iterators.H>
#include <targeting/common/predicates/predicates.H>
#include <targeting/adapters/types.H>
+#include <pnortargeting.H>
//******************************************************************************
// Interface Definitions
@@ -62,6 +63,33 @@ namespace TARGETING
class TargetService;
/**
+ * @brief Struct specifying different parameters required for section data
+ * update on the sectionId/NodePtr.
+ *
+ * Given a struct with the following elements required to point to a
+ * specific section in a given node and the dataPtr to be updated.
+ * Size of the data is always the Page size i.e. 4K
+ *
+ * Struct element details -
+ * sectionId - Section Id
+ * pageNumber - PageNumber for the section.
+ * padBytes - PadBytes to fill in 2 extra bytes
+ * dataPtr - Data Ptr
+ * pNodeTarget - Node Targeting Ptr
+ *
+ */
+
+ struct sectionRefData
+ {
+ uint8_t sectionId;
+ uint8_t pageNumber;
+ uint8_t padBytes[2];
+ uint8_t* dataPtr;
+ Target* pNodeTarget;
+ };
+
+
+ /**
* @brief Returns a reference to the targeting service singleton
*
* @return Reference to the targeting service
@@ -386,6 +414,53 @@ class TargetService
*/
void dump() const;
+ /**
+ * @brief Updates the targeting/attribute section data with the
+ * specified vector parameters.
+ *
+ * This is the top level interface, would basically call the lower
+ * level attribute resource provider interface. The lower level
+ * interface would fetch each vector element and update each section
+ * with corresponding data from the offset specified.
+ *
+ * @param[in] i_pages, vector of sectionRefData struct
+ *
+ * @pre N/A
+ *
+ * @post See "return"
+ *
+ * @return bool indicates whether the write to section data is
+ * successful or not.
+ *
+ * @retval true Section Data update successful
+ * @retval false Section Data update failed.
+ */
+ bool writeSectionData(const std::vector<sectionRefData>& i_pages);
+
+ /**
+ * @brief Fill up the vector with the targeting/attribute section
+ * data specified in the sectionId parameter.
+ *
+ * This is the top level interface, would basically call the lower
+ * level attribute resource provider interface. The lower level
+ * interface would fetch section data as per the sectionId specified
+ * and push to vector reference.
+ *
+ * @param[out] o_pages, vector of sectionRefData struct
+ * @param[in] i_sectionId, section type
+ *
+ * @pre N/A
+ *
+ * @post See "return"
+ *
+ * @return void would fill up the vectore refernce with complete
+ * section data in pages.
+ *
+ */
+
+ void readSectionData(std::vector<sectionRefData>& o_pages,
+ const SECTION_TYPE i_sectionId);
+
private:
/**
diff --git a/src/include/usr/targeting/common/targreasoncodes.H b/src/include/usr/targeting/common/targreasoncodes.H
index 16be43e01..0e60da298 100644
--- a/src/include/usr/targeting/common/targreasoncodes.H
+++ b/src/include/usr/targeting/common/targreasoncodes.H
@@ -39,6 +39,7 @@ enum TargetingModuleId
{
TARG_MOD_TEST = 0x01,
TARG_MOD_ATTRRP = 0x02,
+ TARG_MOD_ATTR_SYNC = 0x03,
};
enum TargetingReasonCode
@@ -49,6 +50,7 @@ enum TargetingReasonCode
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_FAIL = TARG_COMP_ID | 0x07,
};
}; // End TARGETING namespace
diff --git a/src/usr/hwpf/hwp/core_activate/core_activate.C b/src/usr/hwpf/hwp/core_activate/core_activate.C
index 7e50c93e3..0cecf46d3 100644
--- a/src/usr/hwpf/hwp/core_activate/core_activate.C
+++ b/src/usr/hwpf/hwp/core_activate/core_activate.C
@@ -49,6 +49,7 @@
#include <targeting/common/commontargeting.H>
#include <targeting/common/utilFilter.H>
#include <targeting/namedtarget.H>
+#include <targeting/attrsync.H>
// fapi support
#include <fapi.H>
@@ -107,9 +108,10 @@ using namespace ISTEP;
// cast OUR type of target to a FAPI type of target.
const fapi::Target l_fapi_cpu_target(
- TARGET_TYPE_PROC_CHIP,
- reinterpret_cast<void *>
- (const_cast<TARGETING::Target*>(l_cpu_target)) );
+ TARGET_TYPE_PROC_CHIP,
+ reinterpret_cast<void *>
+ (const_cast<TARGETING::Target*>(l_cpu_target))
+ );
#if 1
@@ -343,18 +345,25 @@ void call_host_ipl_complete( void *io_pArgs )
// @@@@@ END CUSTOM BLOCK: @@@@@
#endif
- // Send Sync Point to Fsp
- TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
- INFO_MRK"Send SYNC_POINT_REACHED msg to Fsp" );
- l_errl = INITSERVICE::sendSyncPoint();
+ // Sync attributes to Fsp
+ l_errl = syncAllAttributesToFsp();
+
if( l_errl )
{
break;
}
+
+ // Send Sync Point to Fsp
+ TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
+ INFO_MRK"Send SYNC_POINT_REACHED msg to Fsp" );
+ l_errl = INITSERVICE::sendSyncPoint();
+
+
} while( 0 );
- TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
- "call_host_ipl_complete exit" );
+ TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
+ "call_host_ipl_complete exit elog ptr = %p", l_errl );
+
// end task, returning any errorlogs to IStepDisp
task_end2( l_errl );
diff --git a/src/usr/hwpf/hwp/core_activate/core_activate.H b/src/usr/hwpf/hwp/core_activate/core_activate.H
index 412b9f0cb..e886e3e3f 100644
--- a/src/usr/hwpf/hwp/core_activate/core_activate.H
+++ b/src/usr/hwpf/hwp/core_activate/core_activate.H
@@ -1,26 +1,26 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/usr/hwpf/hwp/core_activate/core_activate.H $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 2012
-//
-// p1
-//
-// Object Code Only (OCO) source materials
-// Licensed Internal Code Source Materials
-// IBM HostBoot Licensed Internal Code
-//
-// The source code for this program is not published or other-
-// wise divested of its trade secrets, irrespective of what has
-// been deposited with the U.S. Copyright Office.
-//
-// Origin: 30
-//
-// IBM_PROLOG_END
-
+/* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/usr/hwpf/hwp/core_activate/core_activate.H $
+ *
+ * IBM CONFIDENTIAL
+ *
+ * COPYRIGHT International Business Machines Corp. 2012
+ *
+ * p1
+ *
+ * Object Code Only (OCO) source materials
+ * Licensed Internal Code Source Materials
+ * IBM HostBoot Licensed Internal Code
+ *
+ * The source code for this program is not published or other-
+ * wise divested of its trade secrets, irrespective of what has
+ * been deposited with the U.S. Copyright Office.
+ *
+ * Origin: 30
+ *
+ * IBM_PROLOG_END_TAG
+ */
#ifndef __CORE_ACTIVATE_CORE_ACTIVATE_H
#define __CORE_ACTIVATE_CORE_ACTIVATE_H
@@ -115,7 +115,6 @@ void call_host_activate_slave_cores( void *io_pArgs );
*/
void call_host_ipl_complete( void *io_pArgs );
-
}; // end namespace
#endif
diff --git a/src/usr/mbox/mailboxsp.C b/src/usr/mbox/mailboxsp.C
index 5312e6c16..414c68173 100644
--- a/src/usr/mbox/mailboxsp.C
+++ b/src/usr/mbox/mailboxsp.C
@@ -1441,5 +1441,24 @@ msg_q_t MBOX::msgq_unregister(queue_id_t i_queue_id)
return msgQ;
}
+bool MBOX::mailbox_enabled()
+{
+ bool enabled = false;
+
+ TARGETING::Target * sys = NULL;
+
+ TARGETING::targetService().getTopLevelTarget( sys );
+
+ TARGETING::SpFunctions spfuncs;
+
+ if( sys &&
+ sys->tryGetAttr<TARGETING::ATTR_SP_FUNCTIONS>(spfuncs) &&
+ spfuncs.mailboxEnabled)
+ {
+ enabled = true;
+ }
+
+ return enabled;
+}
diff --git a/src/usr/targeting/attrrp.C b/src/usr/targeting/attrrp.C
index 4e54d4f8a..1c5bbab7b 100644
--- a/src/usr/targeting/attrrp.C
+++ b/src/usr/targeting/attrrp.C
@@ -43,6 +43,7 @@
#include <targeting/attrrp.H>
#include <targeting/common/trace.H>
#include <initservice/initserviceif.H>
+#include <util/align.H>
using namespace INITSERVICE;
using namespace ERRORLOG;
@@ -495,4 +496,65 @@ namespace TARGETING
return l_errl;
}
+ void AttrRP::writeSectionData(
+ const std::vector<TARGETING::sectionRefData>& i_pages)
+ {
+ // $TODO RTC Story 46672
+ assert(0);
+ }
+
+ void AttrRP::readSectionData(
+ std::vector<TARGETING::sectionRefData>& o_pages,
+ const TARGETING::SECTION_TYPE i_sectionId)
+ {
+ sectionRefData sectionData = {0};
+ uint16_t count = 0;
+ uint16_t pages = 0;
+
+ // search for the section we need
+ for (size_t i = 0; i < iv_sectionCount; i++ )
+ {
+ if ( iv_sections[i].type == i_sectionId )
+ {
+ // found it..
+ // now figure out how many pages - rounding up to the
+ // the next full page and dividing by the page size
+ pages = ALIGN_PAGE( iv_sections[i].size )/PAGESIZE;
+
+ TRACFCOMP(g_trac_targeting,
+ "Reading Attribute Section: ID: %d, \
+ address: 0x%lx size: 0x%lx pages: %d",
+ iv_sections[i].type,
+ iv_sections[i].vmmAddress,
+ iv_sections[i].size,
+ pages);
+
+ // populate and push the structure for each page
+ while( count != pages )
+ {
+ // duplicate the same section id in each structure
+ sectionData.sectionId = i_sectionId;
+
+ // update the current page number
+ sectionData.pageNumber = count;
+
+ // addjust the pointer out by page size * count each
+ // iteration
+ sectionData.dataPtr =
+ reinterpret_cast<uint8_t *>
+ (iv_sections[i].vmmAddress) + (count * PAGESIZE );
+
+ count++;
+
+ // pushing the actual structure to the vector
+ o_pages.push_back( sectionData );
+
+ }
+
+ break;
+ }
+ }
+ // $TODO what if we dont find it??
+ }
+
};
diff --git a/src/usr/targeting/attrsync.C b/src/usr/targeting/attrsync.C
new file mode 100644
index 000000000..ca5da0140
--- /dev/null
+++ b/src/usr/targeting/attrsync.C
@@ -0,0 +1,270 @@
+/* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/usr/targeting/attrsync.C $
+ *
+ * IBM CONFIDENTIAL
+ *
+ * COPYRIGHT International Business Machines Corp. 2012
+ *
+ * p1
+ *
+ * Object Code Only (OCO) source materials
+ * Licensed Internal Code Source Materials
+ * IBM HostBoot Licensed Internal Code
+ *
+ * The source code for this program is not published or other-
+ * wise divested of its trade secrets, irrespective of what has
+ * been deposited with the U.S. Copyright Office.
+ *
+ * Origin: 30
+ *
+ * IBM_PROLOG_END_TAG
+ */
+#include <targeting/attrsync.H>
+#include <targeting/common/targreasoncodes.H>
+#include <targeting/common/trace.H>
+
+using namespace ERRORLOG;
+
+namespace TARGETING
+{
+
+ AttributeSync::AttributeSync()
+ :iv_section_to_sync(SECTION_TYPE_PNOR_RW),iv_total_pages(0),iv_current_page(0)
+ {};
+
+ AttributeSync::~AttributeSync()
+ {};
+
+ void AttributeSync::getSectionData()
+ {
+ // make sure we have a clean slate
+ iv_total_pages = 0;
+ iv_current_page = 0;
+ iv_pages.clear();
+
+ // call the targeting function here to get context.
+ TargetService& l_targetService = targetService();
+
+ // read the section data info into the iv_pages structure
+ l_targetService.readSectionData( iv_pages, iv_section_to_sync );
+
+ iv_total_pages = iv_pages.size();
+
+ TRACDCOMP(g_trac_targeting, "total pages %d", iv_total_pages );
+ }
+
+ errlHndl_t AttributeSync::syncSectionToFsp(
+ TARGETING::SECTION_TYPE i_section_to_sync )
+ {
+ errlHndl_t l_errl = NULL;
+ msg_t * msg = NULL;
+
+ iv_section_to_sync = i_section_to_sync;
+
+
+ do{
+
+ // set up the pointers to the data area
+ getSectionData();
+
+ for( iv_current_page = 0;
+ iv_current_page < iv_total_pages; iv_current_page++ )
+ {
+ msg = msg_allocate();
+
+ msg->type = ATTR_SYNC_SECTION;
+
+ msg->data[0] = 0;
+
+ ATTR_SYNC_ADD_SECTION_ID( iv_section_to_sync, msg->data[0] );
+
+ ATTR_SYNC_ADD_PAGE_NUMBER( iv_current_page, msg->data[0] );
+
+ // set the 2nd data word to the buffer size
+ msg->data[1] = PAGESIZE;
+
+ // allocated storage will always be 4k
+ msg->extra_data = malloc( PAGESIZE );
+
+ // copy the attributes from mem to our buffer.
+ memcpy( msg->extra_data,
+ iv_pages[iv_current_page].dataPtr, PAGESIZE );
+
+ TRACFCOMP(g_trac_targeting,
+ "syncSectionToFsp() - copy %d bytes from %p to %p",
+ PAGESIZE, iv_pages[iv_current_page].dataPtr,
+ msg->extra_data);
+
+ // mailbox code will free both the msg and the extra data
+ // we allocated above for an async message.
+ l_errl = sendMboxMessage( ASYNCHRONOUS, msg );
+
+ if( l_errl )
+ {
+ TRACFCOMP(g_trac_targeting, "failed sending sync message");
+ break;
+ }
+
+ }
+
+ if( l_errl == NULL )
+ {
+ // tell fsp to commit the last section of data we sent
+ l_errl = sendSyncCompleteMessage();
+
+ if( l_errl )
+ {
+ TRACFCOMP(g_trac_targeting,
+ "failed sending sync complete message");
+ }
+ }
+
+ }while(0);
+
+ return l_errl;
+
+ }
+
+ // send the sync complete message
+ errlHndl_t AttributeSync::sendSyncCompleteMessage( )
+ {
+ TRACFCOMP(g_trac_targeting, "sending sync complete message");
+
+ errlHndl_t l_err = NULL;
+
+ msg_t * msg = msg_allocate();
+
+ // initilaize msg buffer
+ memset( msg, 0, sizeof(msg_t) );
+
+ msg->type = ATTR_SYNC_COMPLETE;
+
+ ATTR_SYNC_ADD_PAGE_COUNT( iv_total_pages, msg->data[0] );
+
+ l_err = sendMboxMessage( SYNCHRONOUS, msg );
+
+ if( l_err == NULL )
+ {
+ // see if there was an error on the other end
+ ATTR_SYNC_RC return_code = ATTR_SYNC_GET_RC( msg->data[0] );
+
+ if ( return_code )
+ {
+ TRACFCOMP(g_trac_targeting, "return code: 0x%x", return_code );
+
+ /*@
+ * @errortype
+ * @moduleid TARG_MOD_ATTR_SYNC
+ * @reasoncode TARG_RC_ATTR_SYNC_FAIL
+ * @userdata1 return code from FSP attribute sync
+ * @userdata2 section ID of for section being sync'd
+ *
+ * @devdesc The Attribute synchronization code on the
+ * FSP side was unable to complete the sync
+ * operation successfully.
+ */
+ l_err = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
+ TARG_MOD_ATTR_SYNC,
+ TARG_RC_ATTR_SYNC_FAIL,
+ return_code,
+ (uint64_t)iv_section_to_sync);
+ }
+ }
+
+ // for a syncronous message we need to free the message
+ msg_free( msg );
+
+ return l_err;
+ }
+
+ errlHndl_t AttributeSync::sendMboxMessage( MBOX_MSG_TYPE type,
+ msg_t * i_msg )
+ {
+ errlHndl_t l_errl = NULL;
+
+ TRACDCOMP(g_trac_targeting, "type: 0x%04x", i_msg->type );
+ TRACDCOMP(g_trac_targeting, "data0: 0x%016llx",i_msg->data[0] );
+ TRACDCOMP(g_trac_targeting, "data1: 0x%016llx",i_msg->data[1] );
+ TRACDCOMP(g_trac_targeting, "extra_data: %p",i_msg->extra_data );
+
+ // determine if its an async message or if we should wait
+ // for a response
+ if( type == ASYNCHRONOUS )
+ {
+ TRACDCOMP(g_trac_targeting,
+ "sendMboxMessage() - sending async mbox msg" );
+ l_errl = MBOX::send( MBOX::FSP_ATTR_SYNC_MSGQ, i_msg );
+ }
+ else
+ {
+ TRACDCOMP(g_trac_targeting,
+ "sendMboxMessage() - sending sync mbox msg" );
+ l_errl = MBOX::sendrecv( MBOX::FSP_ATTR_SYNC_MSGQ, i_msg );
+
+ }
+
+ if( l_errl )
+ {
+ TRACFCOMP(g_trac_targeting,
+ "sendMboxMessage() - failed sending mbox msg" );
+
+ // if the send failed and the message is still valid, check
+ // and free the extra data if it exists.
+ if( i_msg != NULL && i_msg->extra_data != NULL )
+ {
+ free( i_msg->extra_data );
+ }
+ }
+
+ return l_errl;
+ }
+
+
+ errlHndl_t syncAllAttributesToFsp()
+ {
+ errlHndl_t l_errl = NULL;
+
+ do{
+ // if the mailbox is not enabled then skip attribute sync
+ // let the test case force message creation/sending
+ if( !(MBOX::mailbox_enabled()) )
+ {
+ break;
+ }
+
+ SECTION_TYPE section_type[] ={SECTION_TYPE_PNOR_RW,
+ SECTION_TYPE_HEAP_PNOR_INIT,
+ SECTION_TYPE_HEAP_ZERO_INIT};
+
+ size_t section_count = sizeof(section_type)/sizeof(section_type[0]);
+
+ TRACFCOMP(g_trac_targeting,"section count = %d", section_count );
+
+ // push down all attributes to FSP
+ AttributeSync l_Sync;
+
+ uint8_t i = 0;
+
+ for(; i < section_count; i++)
+ {
+ l_errl = l_Sync.syncSectionToFsp( section_type[i] );
+
+ if( l_errl )
+ {
+ TRACFCOMP(g_trac_targeting,
+ "Error returned when syncing section type %d",
+ section_type[i]);
+ break;
+ }
+ }
+
+ } while (0);
+
+ return l_errl;
+ }
+
+}; // end namespace
+
+
diff --git a/src/usr/targeting/common/targetservice.C b/src/usr/targeting/common/targetservice.C
index c38bb5cbf..d920ae07d 100644
--- a/src/usr/targeting/common/targetservice.C
+++ b/src/usr/targeting/common/targetservice.C
@@ -531,13 +531,52 @@ void TargetService::dump() const
#undef TARG_FN
}
+
+//******************************************************************************
+// TargetService::writeSectionData
+//******************************************************************************
+bool TargetService::writeSectionData(
+ const std::vector<sectionRefData>& i_pages)
+{
+ #define TARG_FN "writeSectionData(...)"
+ TARG_ENTER();
+ bool l_response = false;
+ if(i_pages.size() != 0)
+ {
+ TARG_GET_SINGLETON(TARGETING::theAttrRP).writeSectionData(i_pages);
+ l_response = true;
+ }
+ TARG_EXIT();
+
+ return l_response;
+ #undef TARG_FN
+}
+
+//******************************************************************************
+// TargetService::readSectionData
+//******************************************************************************
+void TargetService::readSectionData(
+ std::vector <sectionRefData>& o_pages,
+ const SECTION_TYPE i_sectionId)
+{
+ #define TARG_FN "readSectionData(...)"
+ TARG_ENTER();
+
+ TARG_GET_SINGLETON(TARGETING::theAttrRP).readSectionData(
+ o_pages, i_sectionId);
+
+ TARG_EXIT();
+
+ #undef TARG_FN
+}
+
//******************************************************************************
// TargetService::_configureTargetPool
//******************************************************************************
void TargetService::_configureTargetPool()
{
- #define TARG_FN "_configureTargetPool(...)"
+#define TARG_FN "_configureTargetPool(...)"
TARG_ENTER();
diff --git a/src/usr/targeting/makefile b/src/usr/targeting/makefile
index 09d170818..150d48185 100644
--- a/src/usr/targeting/makefile
+++ b/src/usr/targeting/makefile
@@ -42,7 +42,8 @@ VPATH = \
${addprefix ${COMMON_TARGETING_REL_PATH}/, ${COMMON_TARGETING_SUBDIRS}}
ATTR_RP_OBJS = \
- attrrp.o
+ attrrp.o \
+ attrsync.o
ENTRY_POINT_OBJS = \
targetservicestart.o
diff --git a/src/usr/targeting/test/makefile b/src/usr/targeting/test/makefile
index dc33093bc..018effea2 100644
--- a/src/usr/targeting/test/makefile
+++ b/src/usr/targeting/test/makefile
@@ -1,11 +1,11 @@
-# IBM_PROLOG_BEGIN_TAG
+# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/usr/targeting/test/makefile $
#
# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011
+# COPYRIGHT International Business Machines Corp. 2011-2012
#
# p1
#
@@ -19,8 +19,7 @@
#
# Origin: 30
#
-# IBM_PROLOG_END
-
+# IBM_PROLOG_END_TAG
################################################################################
#
# @file src/usr/targeting/test/makefile
@@ -63,7 +62,7 @@ MODULE = testtargeting
COMMON_TESTCASE_REL_PATHS = \
$(addprefix ${COMMON_TARGETING_REL_PATH}/test/,${COMMON_TESTCASES})
-TESTS = testtargeting.H ${COMMON_TESTCASE_REL_PATHS}
+TESTS = testtargeting.H testattrsync.H ${COMMON_TESTCASE_REL_PATHS}
OBJS = attributestrings.o
diff --git a/src/usr/targeting/test/testattrsync.H b/src/usr/targeting/test/testattrsync.H
new file mode 100644
index 000000000..69e90004b
--- /dev/null
+++ b/src/usr/targeting/test/testattrsync.H
@@ -0,0 +1,119 @@
+/* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/usr/targeting/test/testattrsync.H $
+ *
+ * IBM CONFIDENTIAL
+ *
+ * COPYRIGHT International Business Machines Corp. 2012
+ *
+ * p1
+ *
+ * Object Code Only (OCO) source materials
+ * Licensed Internal Code Source Materials
+ * IBM HostBoot Licensed Internal Code
+ *
+ * The source code for this program is not published or other-
+ * wise divested of its trade secrets, irrespective of what has
+ * been deposited with the U.S. Copyright Office.
+ *
+ * Origin: 30
+ *
+ * IBM_PROLOG_END_TAG
+ */
+#ifndef __TARGETING_TESTATTRSYNC_H
+#define __TARGETING_TESTATTRSYNC_H
+
+/**
+ * @file targeting/test/testattrsync.H
+ *
+ * @brief All unit tests which test attribute sync
+ */
+
+//******************************************************************************
+// Includes
+//******************************************************************************
+
+// STD
+#include <stdio.h>
+#include <sys/time.h>
+
+// CXXTEST
+#include <cxxtest/TestSuite.H>
+#include <errl/errlmanager.H>
+
+// This component
+#include <targeting/common/attributes.H>
+#include <targeting/common/entitypath.H>
+#include <targeting/common/target.H>
+#include <targeting/common/targetservice.H>
+#include <targeting/common/iterators/rangefilter.H>
+#include <targeting/common/predicates/predicatectm.H>
+#include <targeting/common/predicates/predicatepostfixexpr.H>
+#include <targeting/attrsync.H>
+#include <errl/errludtarget.H>
+#include <targeting/common/trace.H>
+#include <kernel/console.H>
+
+class AttrSyncTestSuite : public CxxTest::TestSuite
+{
+ public:
+
+ /**
+ * @brief Test sync of targeting attributes to FSP
+ */
+ void testAttributeSync()
+ {
+ TS_TRACE(ENTER_MRK "testAttributeSync" );
+
+ using namespace TARGETING;
+
+ AttributeSync l_attrSync;
+
+ TS_TRACE( "Sync PNOR RW" );
+
+ errlHndl_t err = l_attrSync.syncSectionToFsp(
+ TARGETING::SECTION_TYPE_PNOR_RW );
+
+ if( err )
+ {
+ if( MBOX::mailbox_enabled() )
+ {
+ TS_FAIL(" Error returned when syncing SECTION_TYPE_PNOR_RW");
+ }
+ err = NULL;
+ }
+
+ TS_TRACE("Sync PNOR INIT " );
+
+ err = l_attrSync.syncSectionToFsp(
+ TARGETING::SECTION_TYPE_HEAP_PNOR_INIT );
+
+ if( err )
+ {
+ if( MBOX::mailbox_enabled() )
+ {
+ TS_FAIL(" Error returned when syncing SECTION_TYPE_HEAP_PNOR_INIT");
+ }
+ err = NULL;
+ }
+
+ TS_TRACE( "Sync PNOR ZERO INIT" );
+
+ err = l_attrSync.syncSectionToFsp(
+ TARGETING::SECTION_TYPE_HEAP_ZERO_INIT );
+
+ if( err )
+ {
+ if( MBOX::mailbox_enabled() )
+ {
+ TS_FAIL(" Error returned when syncing SECTION_TYPE_HEAP_ZERO_INIT");
+ }
+ err = NULL;
+ }
+
+ }
+
+};
+
+#endif // End __TARGETING_TESTTARGETING_H
OpenPOWER on IntegriCloud