summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorMike Jones <mjjones@us.ibm.com>2013-03-13 20:39:31 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-04-15 15:42:50 -0500
commit54a7754855469231b10e644abaa5b3f367fcf00e (patch)
treeb3439b41b90e9b6d315ad43cf3d463e64fc97612 /src/include
parent6e42444a52f2910a0a6f9a898c2ba4a9e8201a17 (diff)
downloadtalos-hostboot-54a7754855469231b10e644abaa5b3f367fcf00e.tar.gz
talos-hostboot-54a7754855469231b10e644abaa5b3f367fcf00e.zip
Extend Attribute Override/Sync to work on Targeting attributes
Change-Id: Icf8d84e741212f31c1065146ac1ea96c4c7d75c5 RTC: 51707 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/3548 Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com> Tested-by: Jenkins Server
Diffstat (limited to 'src/include')
-rw-r--r--src/include/usr/hwpf/fapi/fapiAttributeService.H30
-rw-r--r--src/include/usr/hwpf/fapi/fapiAttributeTank.H723
-rwxr-xr-xsrc/include/usr/hwpf/plat/fapiPlatAttrOverrideSync.H235
-rw-r--r--src/include/usr/hwpf/plat/fapiPlatAttributeService.H81
-rw-r--r--src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H3
-rw-r--r--[-rwxr-xr-x]src/include/usr/targeting/adapters/mutexadapter.H (renamed from src/include/usr/hwpf/hwp/fapiTestHwpAttr.H)51
-rw-r--r--src/include/usr/targeting/common/attributeTank.H342
-rw-r--r--src/include/usr/targeting/common/target.H60
8 files changed, 697 insertions, 828 deletions
diff --git a/src/include/usr/hwpf/fapi/fapiAttributeService.H b/src/include/usr/hwpf/fapi/fapiAttributeService.H
index 186a43222..3c6b0dff4 100644
--- a/src/include/usr/hwpf/fapi/fapiAttributeService.H
+++ b/src/include/usr/hwpf/fapi/fapiAttributeService.H
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2012 */
+/* COPYRIGHT International Business Machines Corp. 2011,2013 */
/* */
/* p1 */
/* */
@@ -41,6 +41,7 @@
* ptr
* mjjones 04/10/2012 Support for privileged atts
* mjjones 06/07/2012 Add attr override support
+ * mjjones 03/13/2013 Move attr override code to plat
*/
#ifndef FAPIATTRIBUTESERVICE_H_
@@ -78,46 +79,23 @@
* The PRIVILEGED macros call a template function (compiler will optimize out)
* that will cause a compile failure if the ID is not valid or VAL is not the
* correct type.
- * The GET macro calls the FAPI_PLAT_GET_ATTR_OVERRIDE PLAT macro to find if
- * there is an attribute override value to return (platforms can set this to
- * false if they do not support attribute override or if they handle it in
- * the standard <ID>_GETMACRO path), if this returns false then the
- * <ID>_GETMACRO PLAT macro is called to get the attribute, platforms must
- * define a _GETMACRO for each attribute.
- *
- * The SET macro calls the FAPI_PLAT_ATTR_SET_ACTIONS PLAT macro to perform
- * any necessary platform actions on an attribute set, this includes
- * clearing any non-const attribute override and storing the attribute for
- * synchronization (platforms can set this to NULL if they do not need to
- * take any actions). It then calls the <ID>_SETMACRO PLAT macro to set the
- * attribute, platforms must define a _SETMACRO for each attribute
- *
- * Note that a const attribute override is one that is always returned on a
- * FAPI_ATTR_GET even if a subsequent FAPI_ATTR_SET is done. A non-const
- * attribute override is one that is cleared when a FAPI_ATTR_SET is done
*/
#define FAPI_ATTR_GET(ID, PTARGET, VAL) \
(fapi::fapiFailIfPrivileged<fapi::ID##_Privileged>(), \
fapi::fapiCheckIdType<fapi::ID##_Type>(fapi::ID, VAL), \
- FAPI_PLAT_GET_ATTR_OVERRIDE(fapi::ID, PTARGET, VAL) ? \
- fapi::FAPI_RC_SUCCESS \
- : ID##_GETMACRO(ID, PTARGET, VAL))
+ ID##_GETMACRO(ID, PTARGET, VAL))
#define FAPI_ATTR_SET(ID, PTARGET, VAL) \
(fapi::fapiFailIfPrivileged<fapi::ID##_Privileged>(), \
fapi::fapiCheckIdType<fapi::ID##_Type>(fapi::ID, VAL), \
- FAPI_PLAT_ATTR_SET_ACTIONS(fapi::ID, PTARGET, VAL), \
ID##_SETMACRO(ID, PTARGET, VAL))
#define FAPI_ATTR_GET_PRIVILEGED(ID, PTARGET, VAL) \
(fapi::fapiCheckIdType<fapi::ID##_Type>(fapi::ID, VAL), \
- FAPI_PLAT_GET_ATTR_OVERRIDE(fapi::ID, PTARGET, VAL) ? \
- fapi::FAPI_RC_SUCCESS \
- : ID##_GETMACRO(ID, PTARGET, VAL))
+ ID##_GETMACRO(ID, PTARGET, VAL))
#define FAPI_ATTR_SET_PRIVILEGED(ID, PTARGET, VAL) \
(fapi::fapiCheckIdType<fapi::ID##_Type>(fapi::ID, VAL), \
- FAPI_PLAT_ATTR_SET_ACTIONS(fapi::ID, PTARGET, VAL), \
ID##_SETMACRO(ID, PTARGET, VAL))
namespace fapi
diff --git a/src/include/usr/hwpf/fapi/fapiAttributeTank.H b/src/include/usr/hwpf/fapi/fapiAttributeTank.H
deleted file mode 100644
index a353c5e3f..000000000
--- a/src/include/usr/hwpf/fapi/fapiAttributeTank.H
+++ /dev/null
@@ -1,723 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/include/usr/hwpf/fapi/fapiAttributeTank.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 otherwise */
-/* divested of its trade secrets, irrespective of what has been */
-/* deposited with the U.S. Copyright Office. */
-/* */
-/* Origin: 30 */
-/* */
-/* IBM_PROLOG_END_TAG */
-/**
- * @file fapiAttributeTank.H
- *
- * @brief Defines the AttributeTank and Attribute classes. A platform can
- * choose to use these classes to store attributes for Attribute
- * Overriding and Synchronization
- */
-
-/*
- * Change Log ******************************************************************
- * Flag Defect/Feature User Date Description
- * ------ -------------- ---------- ----------- ----------------------------
- * mjjones 06/07/2012 Created
- * mjjones 10/15/2012 Moved to general AttributeTank.
- */
-
-#ifndef FAPIATTRTANK_H_
-#define FAPIATTRTANK_H_
-
-#include <stdint.h>
-#include <list>
-#include <vector>
-#include <fapiAttributeIds.H>
-
-namespace fapi
-{
-
-class Target; // Forward Reference
-
-/**
- * @enum AttributeFlags
- *
- * Enumeration of the possible attribute flags. This is a bitmap
- */
-enum AttributeFlags
-{
- ATTR_FLAG_CONST = 1, // Not cleared by clearNonConstAttribute
- // Use-case is a constant Attribute Override
-};
-
-// Constants for various fields in Attribute
-const uint16_t ATTR_POS_NA = 0xffff; // iv_pos not applicable
-const uint8_t ATTR_UNIT_POS_NA = 0xff; // iv_unitPos not applicable
-const uint8_t ATTR_ARRAYD_NA = 0xff; // iv_arrayDX not applicable
-
-/**
- * @struct Attribute
- *
- * This structure defines a single attribute value. In the case of an array
- * attribute, it is the value of one specific element
- */
-struct Attribute
-{
- /**
- * @brief Constructor initializes default values
- */
- Attribute();
-
- uint64_t iv_val; // Value of attribute.
- uint32_t iv_attrId; // fapi::AttributeId enum value
- uint32_t iv_targetType; // fapi::TargetType enum value
- uint16_t iv_pos; // For chips/dimms the position
- // For chiplets the parent chip position
- uint8_t iv_unitPos; // For chiplets the position
- uint8_t iv_flags; // fapi::AttributeFlags enum value
- uint8_t iv_arrayD1; // Applies to element D1 in 1D or more array atts
- uint8_t iv_arrayD2; // Applies to element D2 in 2D or more array atts
- uint8_t iv_arrayD3; // Applies to element D3 in 3D or more array atts
- uint8_t iv_arrayD4; // Applies to element D4 in 4D array atts
-};
-
-/**
- * @struct AttributeChunk
- *
- * This structure defines a chunk of memory containing Attributes. The max chunk
- * size is chosen to be reasonable to send over a mailbox type interface
- * between subsystems
- */
-struct AttributeChunk
-{
- static const size_t MAX_CHUNK_SIZE_BYTES = 4096;
- static const size_t MAX_ATTRS_PER_CHUNK =
- MAX_CHUNK_SIZE_BYTES / sizeof(Attribute);
-
- /**
- * @brief Constructor initializes default values
- */
- AttributeChunk();
- size_t iv_numAttributes; // Number of Attributes in chunk
- uint8_t * iv_pAttributes; // Pointer to chunk of memory
-};
-
-/**
- * @class AttributeTank
- *
- * This class can be used to store Attributes
- */
-class AttributeTank
-{
-public:
- /**
- * @brief Allocation types
- */
- enum AllocType
- {
- ALLOC_TYPE_MALLOC = 1,
- ALLOC_TYPE_NEW = 2,
- };
-
- /**
- * @brief Default constructor
- */
- AttributeTank();
-
- /**
- * @brief Destructor
- */
- virtual ~AttributeTank();
-
- /**
- * @brief Clear all attributes
- */
- virtual void clearAllAttributes();
-
- /**
- * @brief Clear any non-const attribute for a specified ID and Target
- *
- * Note that for array attributes, this clears all values of the array
- *
- * This is called on an OverrideAttributeTank to clear a non-const
- * Attribute Override during FAPI_ATTR_SET
- *
- * @param[in] i_attrId Attribute ID
- * @param[in] i_pTarget Pointer to Target (NULL if system)
- */
- virtual void clearNonConstAttribute(const fapi::AttributeId i_attrId,
- const fapi::Target * const i_pTarget);
-
- /**
- * @brief Set an Attribute
- *
- * Note that for array attributes, this must be called repeatedly, to set
- * the attribute value for each element of the array
- *
- * If the attribute already exists then it is replaced with the new one
- *
- * This is called on a SyncAttributeTank to save an Attribute for syncing
- * during FAPI_ATTR_SET
- *
- * @param[in] i_attrId Attribute ID
- * @param[in] i_pTarget Pointer to Target (NULL if system)
- * @param[in] i_val Value
- * @param[in] i_arrayD1 Array dimension 1 if applicable
- * @param[in] i_arrayD2 Array dimension 2 if applicable
- * @param[in] i_arrayD3 Array dimension 3 if applicable
- * @param[in] i_arrayD4 Array dimension 4 if applicable
- */
- virtual void setAttribute(const fapi::AttributeId i_attrId,
- const fapi::Target * const i_pTarget,
- const uint64_t i_val,
- const uint8_t i_arrayD1 = ATTR_ARRAYD_NA,
- const uint8_t i_arrayD2 = ATTR_ARRAYD_NA,
- const uint8_t i_arrayD3 = ATTR_ARRAYD_NA,
- const uint8_t i_arrayD4 = ATTR_ARRAYD_NA);
-
- /**
- * @brief Set an attribute
- *
- * Note that for array attributes, this must be called repeatedly, to set
- * the attribute value for each element of the array
- *
- * If the attribute already exists then it is replaced with the new one
- *
- * @param[in] i_attribute Reference to Attribute structure, this is copied
- */
- virtual void setAttribute(const Attribute & i_attribute);
-
- /**
- * @brief Get a copy of an Attribute
- *
- * Note that for array attributes, this must be called repeatedly, to query
- * the attribute value for each element of the array
- *
- * This is called on an OverrideAttributeTank to query/get an Attribute
- * Override during FAPI_ATTR_GET
- *
- * @param[in] i_attrId Attribute ID
- * @param[in] i_pTarget Pointer to Target (NULL if system)
- * @param[out] o_val Reference that is filled in with the attr value
- * @param[in] i_arrayD1 Array dimension 1 if applicable
- * @param[in] i_arrayD2 Array dimension 2 if applicable
- * @param[in] i_arrayD3 Array dimension 3 if applicable
- * @param[in] i_arrayD4 Array dimension 4 if applicable
- *
- * return true if attribute exists and a copy was returned.
- */
- virtual bool getAttribute(const fapi::AttributeId i_attrId,
- const fapi::Target * const i_pTarget,
- uint64_t & o_val,
- const uint8_t i_arrayD1 = ATTR_ARRAYD_NA,
- const uint8_t i_arrayD2 = ATTR_ARRAYD_NA,
- const uint8_t i_arrayD3 = ATTR_ARRAYD_NA,
- const uint8_t i_arrayD4 = ATTR_ARRAYD_NA) const;
-
- /**
- * @brief Get a copy of all Attributes into newly allocated memory chunks
- *
- * The use case is for getting the attributes to send across the FSP/
- * Hostboot mailbox. Mailbox frees the data memory using free on Hostboot
- * and delete[] on FSP.
- *
- * @param[in] i_allocType Which allocation is used to allocated memory
- * @param[out] o_attributes Reference to vector that AttributeChunk structs
- * are added to. The caller must free (if MALLOC)
- * or delete[] (if NEW) each chunk's memory
- */
- virtual void getAllAttributes(
- const AllocType i_allocType,
- std::vector<AttributeChunk> & o_attributes) const;
-
- /**
- * @brief Returns if any attributes exist in the tank
- *
- * This is only expected to be called by unit test
- *
- * return true if any attributes exist
- */
- virtual bool attributesExist();
-
-protected:
- // The name of the Tank used in traces, a derived class can set
- const char * iv_pName;
-
-private:
- // Copy constructor and assignment operator disabled
- AttributeTank(const AttributeTank & i_right);
- AttributeTank & operator=(const AttributeTank & i_right);
-
- /**
- * @brief Returns the Attribute::iv_targetType of the specified Target
- *
- * @param[in] i_pTarget Pointer to Target
- *
- * @return uint32_t target-type
- */
- static uint32_t getTargetType(const fapi::Target * const i_pTarget);
-
- /**
- * @brief Returns the Attribute::iv_pos of the specified Target
- *
- * @param[in] i_pTarget Pointer to Target
- *
- * @return uint16_t position
- */
- static uint16_t getTargetPos(const fapi::Target * const i_pTarget);
-
- /**
- * @brief Returns the Attribute::iv_unitPos of the specified Target
- *
- * @param[in] i_pTarget Pointer to Target
- *
- * @return uint8_t unit-position
- */
- static uint8_t getTargetUnitPos(const fapi::Target * const i_pTarget);
-
- /**
- * @brief Locks the AttributeTank object
- *
- * Pure virtual function that must be overridden by a concrete derived class
- * and implemented by the platform
- */
- virtual void platLock() const = 0 ;
-
- /**
- * @brief Unlocks the AttributeTank object
- *
- * Pure virtual function that must be overridden by a concrete derived class
- * and implemented by the platform
- */
- virtual void platUnlock() const = 0;
-
- // The attributes
- // Note: A possible performance boost could be to store the elements in a
- // map, the key could be a sub-structure.
- bool iv_attributesExist;
- std::list<Attribute> iv_attributes;
- typedef std::list<Attribute>::iterator AttributesItr_t;
- typedef std::list<Attribute>::const_iterator AttributesCItr_t;
-
-};
-
-/**
- * @class OverrideAttributeTank
- *
- * This class can be used to store a set of attribute overrides. It is provided
- * to allow a platform to create a singleton Tank for holding overrides
- */
-class OverrideAttributeTank : public AttributeTank
-{
-public:
- OverrideAttributeTank();
-
-private:
- // Copy constructor and assignment operator disabled
- OverrideAttributeTank(const OverrideAttributeTank & i_right);
- OverrideAttributeTank & operator=(const OverrideAttributeTank & i_right);
-
- /**
- * @brief Locks the OverrideAttributeTank object
- *
- * Must be implemented by the platform
- */
- virtual void platLock() const;
-
- /**
- * @brief Unlocks the AttributeTank object
- *
- * Must be implemented by the platform
- */
- virtual void platUnlock() const;
-};
-
-/**
- * @class SyncAttributeTank
- *
- * This class can be used to store a set of attributes to sync. It is provided
- * to allow a platform to create a singleton Tank for holding attributes to sync
- */
-class SyncAttributeTank : public AttributeTank
-{
-public:
- SyncAttributeTank();
-
- /**
- * @brief Set an Attribute
- *
- * This overrides the AttributeTank function, it checks if the platform
- * has enabled synchronization before saving the attribute in the tank
- *
- * @param[in] i_attrId Attribute ID
- * @param[in] i_pTarget Pointer to Target (NULL if system)
- * @param[in] i_val Value
- * @param[in] i_arrayD1 Array dimension 1 if applicable
- * @param[in] i_arrayD2 Array dimension 2 if applicable
- * @param[in] i_arrayD3 Array dimension 3 if applicable
- * @param[in] i_arrayD4 Array dimension 4 if applicable
- */
- virtual void setAttribute(const fapi::AttributeId i_attrId,
- const fapi::Target * const i_pTarget,
- const uint64_t i_val,
- const uint8_t i_arrayD1 = ATTR_ARRAYD_NA,
- const uint8_t i_arrayD2 = ATTR_ARRAYD_NA,
- const uint8_t i_arrayD3 = ATTR_ARRAYD_NA,
- const uint8_t i_arrayD4 = ATTR_ARRAYD_NA);
-
- /**
- * @brief Set an attribute
- *
- * This overrides the AttributeTank function, it simply calls the base class
- * function (needed because the other version of setAttribute was
- * overridden)
- *
- * @param[in] i_attribute Reference to Attribute structure, this is copied
- */
- virtual void setAttribute(const Attribute & i_attribute)
- {
- AttributeTank::setAttribute(i_attribute);
- }
-
-private:
- // Copy constructor and assignment operator disabled
- SyncAttributeTank(const SyncAttributeTank & i_right);
- SyncAttributeTank & operator=(const SyncAttributeTank & i_right);
-
- /**
- * @brief Checks if the platform has enabled synchronization
- *
- * Must be implemented by the platform
- */
- static bool platSyncEnabled();
-
- /**
- * @brief Locks the OverrideAttributeTank object
- *
- * Must be implemented by the platform
- */
- virtual void platLock() const;
-
- /**
- * @brief Unlocks the AttributeTank object
- *
- * Must be implemented by the platform
- */
- virtual void platUnlock() const;
-};
-
-/**
- * @brief This template function gets a 1D array attribute from an AttributeTank
- *
- * @param[in] i_attrId Attribute ID
- * @param[in] i_pTarget Pointer to Target the attribute is for (NULL if system)
- * @param[in] i_tank Reference to AttributeTank
- * @param[out] o_1dArray Reference to 1D array where attribute will be copied to
- * @return bool True if override was returned
- */
-template <typename T, uint8_t SZ1>
-bool getAttributeT(const fapi::AttributeId i_attrId,
- const fapi::Target * const i_pTarget,
- fapi::AttributeTank & i_tank,
- T(&o_1dArray)[SZ1])
-{
- uint64_t l_val = 0;
-
- for (uint8_t d1 = 0; d1 < SZ1; d1++)
- {
- if (!(i_tank.getAttribute(i_attrId, i_pTarget, l_val, d1)))
- {
- // For array attributes, all elements must be overridden
- return false;
- }
- else
- {
- // Standard conversion converts uint64_t to attribute type
- o_1dArray[d1] = l_val;
- }
- }
-
- return true;
-}
-
-/**
- * @brief This template function gets a 2D array attribute from an AttributeTank
- *
- * @param[in] i_attrId Attribute ID
- * @param[in] i_pTarget Pointer to Target the attribute is for (NULL if system)
- * @param[in] i_tank Reference to AttributeTank
- * @param[out] o_2dArray Reference to 2D array where attribute will be copied to
- * @return bool True if override was returned
- */
-template <typename T, uint8_t SZ1, uint8_t SZ2>
-bool getAttributeT(const fapi::AttributeId i_attrId,
- const fapi::Target * const i_pTarget,
- fapi::AttributeTank & i_tank,
- T(&o_2dArray)[SZ1][SZ2])
-{
- uint64_t l_val = 0;
-
- for (uint8_t d1 = 0; d1 < SZ1; d1++)
- {
- for (uint8_t d2 = 0; d2 < SZ2; d2++)
- {
- if (!(i_tank.getAttribute(i_attrId, i_pTarget, l_val, d1, d2)))
- {
- // For array attributes, all elements must be overridden
- return false;
- }
- else
- {
- // Standard conversion converts uint64_t to attribute type
- o_2dArray[d1][d2] = l_val;
- }
- }
- }
-
- return true;
-}
-
-/**
- * @brief This template function gets a 3D array attribute from an AttributeTank
- *
- * @param[in] i_attrId Attribute ID
- * @param[in] i_pTarget Pointer to Target the attribute is for (NULL if system)
- * @param[in] i_tank Reference to AttributeTank
- * @param[out] o_3dArray Reference to 3D array where attribute will be copied to
- * @return bool True if override was returned
- */
-template <typename T, uint8_t SZ1, uint8_t SZ2, uint8_t SZ3>
-bool getAttributeT(const fapi::AttributeId i_attrId,
- const fapi::Target * const i_pTarget,
- fapi::AttributeTank & i_tank,
- T(&o_3dArray)[SZ1][SZ2][SZ3])
-{
- uint64_t l_val = 0;
-
- for (uint8_t d1 = 0; d1 < SZ1; d1++)
- {
- for (uint8_t d2 = 0; d2 < SZ2; d2++)
- {
- for (uint8_t d3 = 0; d3 < SZ3; d3++)
- {
- if (!(i_tank.getAttribute(i_attrId, i_pTarget, l_val, d1, d2,
- d3)))
- {
- // For array attributes, all elements must be overridden
- return false;
- }
- else
- {
- // Standard conversion converts uint64_t to attribute type
- o_3dArray[d1][d2][d3] = l_val;
- }
- }
- }
- }
-
- return true;
-}
-
-/**
- * @brief This template function gets a 4D array attribute from an AttributeTank
- *
- * @param[in] i_attrId Attribute ID
- * @param[in] i_pTarget Pointer to Target the attribute is for (NULL if system)
- * @param[in] i_tank Reference to AttributeTank
- * @param[out] o_4dArray Reference to 4D array where attribute will be copied to
- * @return bool True if override was returned
- */
-template <typename T, uint8_t SZ1, uint8_t SZ2, uint8_t SZ3, uint8_t SZ4>
-bool getAttributeT(const fapi::AttributeId i_attrId,
- const fapi::Target * const i_pTarget,
- fapi::AttributeTank & i_tank,
- T(&o_4dArray)[SZ1][SZ2][SZ3][SZ4])
-{
- uint64_t l_val = 0;
-
- for (uint8_t d1 = 0; d1 < SZ1; d1++)
- {
- for (uint8_t d2 = 0; d2 < SZ2; d2++)
- {
- for (uint8_t d3 = 0; d3 < SZ3; d3++)
- {
- for (uint8_t d4 = 0; d4 < SZ4; d4++)
- {
- if (!(i_tank.getAttribute(i_attrId, i_pTarget, l_val, d1, d2,
- d3, d4)))
- {
- // For array attributes, all elements must be overridden
- return false;
- }
- else
- {
- // Standard conversion converts uint64_t to attribute
- // type
- o_4dArray[d1][d2][d3][d4] = l_val;
- }
- }
- }
- }
- }
-
- return true;
-}
-
-/**
- * @brief This template function gets a non-array attribute from an
- * AttributeTank
- *
- * @param[in] i_attrId Attribute ID
- * @param[in] i_pTarget Pointer to Target the attribute is for (NULL if system)
- * @param[in] i_tank Reference to AttributeTank
- * @param[out] o_val Reference to variable where attribute will be copied to
- * @return bool True if override was returned
- */
-template <typename T>
-bool getAttributeT(const fapi::AttributeId i_attrId,
- const fapi::Target * const i_pTarget,
- fapi::AttributeTank & i_tank,
- T & o_val)
-{
- uint64_t l_val = 0;
-
- if (!(i_tank.getAttribute(i_attrId, i_pTarget, l_val)))
- {
- return false;
- }
-
- o_val = static_cast<T>(l_val);
- return true;
-}
-
-/**
- * @brief This template function sets a 1D array attribute into an AttributeTank
- *
- * @param[in] i_attrId Attribute ID
- * @param[in] i_pTarget Pointer to Target the attribute is for (NULL if system)
- * @param[in] i_tank Reference to AttributeTank
- * @param[in] i_1dArray Reference to 1D array containing attribute
- */
-template <typename T, uint8_t SZ1>
-void setAttributeT(const fapi::AttributeId i_attrId,
- const fapi::Target * const i_pTarget,
- fapi::AttributeTank & i_tank,
- const T(&i_1dArray)[SZ1])
-{
- for (uint8_t d1 = 0; d1 < SZ1; d1++)
- {
- i_tank.setAttribute(i_attrId, i_pTarget, i_1dArray[d1], d1);
- }
-}
-
-/**
- * @brief This template function sets a 2D array attribute into an AttributeTank
- *
- * @param[in] i_attrId Attribute ID
- * @param[in] i_pTarget Pointer to Target the attribute is for (NULL if system)
- * @param[in] i_tank Reference to AttributeTank
- * @param[in] i_2dArray Reference to 2D array containing attribute
- */
-template <typename T, uint8_t SZ1, uint8_t SZ2>
-void setAttributeT(const fapi::AttributeId i_attrId,
- const fapi::Target * const i_pTarget,
- fapi::AttributeTank & i_tank,
- const T(&i_2dArray)[SZ1][SZ2])
-{
- for (uint8_t d1 = 0; d1 < SZ1; d1++)
- {
- for (uint8_t d2 = 0; d2 < SZ2; d2++)
- {
- i_tank.setAttribute(i_attrId, i_pTarget, i_2dArray[d1][d2], d1, d2);
- }
- }
-}
-
-/**
- * @brief This template function sets a 3D array attribute into an AttributeTank
- *
- * @param[in] i_attrId Attribute ID
- * @param[in] i_pTarget Pointer to Target the attribute is for (NULL if system)
- * @param[in] i_tank Reference to AttributeTank
- * @param[in] i_3dArray Reference to 3D array containing attribute
- */
-template <typename T, uint8_t SZ1, uint8_t SZ2, uint8_t SZ3>
-void setAttributeT(const fapi::AttributeId i_attrId,
- const fapi::Target * const i_pTarget,
- fapi::AttributeTank & i_tank,
- const T(&i_3dArray)[SZ1][SZ2][SZ3])
-{
- for (uint8_t d1 = 0; d1 < SZ1; d1++)
- {
- for (uint8_t d2 = 0; d2 < SZ2; d2++)
- {
- for (uint8_t d3 = 0; d3 < SZ3; d3++)
- {
- i_tank.setAttribute(i_attrId, i_pTarget, i_3dArray[d1][d2][d3],
- d1, d2, d3);
- }
- }
- }
-}
-
-/**
- * @brief This template function sets a 4D array attribute into an AttributeTank
- *
- * @param[in] i_attrId Attribute ID
- * @param[in] i_pTarget Pointer to Target the attribute is for (NULL if system)
- * @param[in] i_tank Reference to AttributeTank
- * @param[in] i_4dArray Reference to 4D array containing attribute
- */
-template <typename T, uint8_t SZ1, uint8_t SZ2, uint8_t SZ3, uint8_t SZ4>
-void setAttributeT(const fapi::AttributeId i_attrId,
- const fapi::Target * const i_pTarget,
- fapi::AttributeTank & i_tank,
- const T(&i_4dArray)[SZ1][SZ2][SZ3][SZ4])
-{
- for (uint8_t d1 = 0; d1 < SZ1; d1++)
- {
- for (uint8_t d2 = 0; d2 < SZ2; d2++)
- {
- for (uint8_t d3 = 0; d3 < SZ3; d3++)
- {
- for (uint8_t d4 = 0; d4 < SZ4; d4++)
- {
- i_tank.setAttribute(i_attrId, i_pTarget,
- i_4dArray[d1][d2][d3][d4], d1, d2, d3, d4);
- }
- }
- }
- }
-}
-
-/**
- * @brief This template function sets a non-array attribute into an
- * AttributeTank
- *
- * @param[in] i_attrId Attribute ID
- * @param[in] i_pTarget Pointer to Target the attribute is for (NULL if system)
- * @param[in] i_tank Reference to AttributeTank
- * @param[in] i_val Reference to variable containing attribute
- */
-template <typename T>
-void setAttributeT(const fapi::AttributeId i_attrId,
- const fapi::Target * const i_pTarget,
- fapi::AttributeTank & i_tank,
- const T & i_val)
-{
- i_tank.setAttribute(i_attrId, i_pTarget, i_val);
-}
-
-} // namespace fapi
-
-#endif // FAPIATTRTANK_H_
diff --git a/src/include/usr/hwpf/plat/fapiPlatAttrOverrideSync.H b/src/include/usr/hwpf/plat/fapiPlatAttrOverrideSync.H
index ab2a5ee3d..13b1ed96e 100755
--- a/src/include/usr/hwpf/plat/fapiPlatAttrOverrideSync.H
+++ b/src/include/usr/hwpf/plat/fapiPlatAttrOverrideSync.H
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2012 */
+/* COPYRIGHT International Business Machines Corp. 2012,2013 */
/* */
/* p1 */
/* */
@@ -21,9 +21,10 @@
/* */
/* IBM_PROLOG_END_TAG */
/**
- * @file fapiPlatAttrOverrdieSync.H
+ * @file fapiPlatAttrOverrideSync.H
*
- * @brief Defines the functions for Attribute Override and Sync
+ * @brief Defines the AttrOverrideSync class that contains functions for
+ * Attribute Override and Sync
*/
#ifndef FAPIPLATATTROVERRIDESYNC_H_
@@ -33,7 +34,10 @@
// Includes
//******************************************************************************
#include <stdint.h>
-#include <hwpf/fapi/fapiAttributeTank.H>
+#include <errl/errlentry.H>
+#include <mbox/mboxif.H>
+#include <fapiAttributeIds.H>
+#include <targeting/common/attributeTank.H>
//******************************************************************************
// Interface
@@ -41,54 +45,203 @@
namespace fapi
{
-namespace attrOverrideSync
-{
+// Forward references
+class AttrOverrideSync;
+class Target;
/**
- * @brief Monitors for incoming messages from the FSP. This must be called
- * by a task specifically started to monitor for these messages
+ * @brief Return the AttrOverrideSync Singleton. Other modules must call this
+ * rather than using Singleton<>
+ *
+ * @return Reference to the AttrOverrideSync Singleton
*/
-void monitorForFspMessages();
+AttrOverrideSync & theAttrOverrideSync();
/**
- * @brief Sends Attribute Overrides and Syncs to the FSP
+ * @class AttrOverrideSync
*
- * This is called at the end of an IStep. It:
- * - Clears the FSP Attribute Overrides
- * - Sends the Hostboot Attribute Overrides to the FSP
- * - Sends the Hostboot Attribute Syncs to the FSP
- */
-void sendAttrOverridesAndSyncsToFsp();
-
-/**
- * @brief This function returns the OverrideAttributeTank singleton. Other
- * modules must call this rather than using Singleton<>
+ * This class contains the FAPI Attribute Override and Sync tanks. It provides
+ * functions to:
+ * - Monitor for incoming attribute override/sync messages from the FSP
+ * - Send attribute override/syncs to the FSP
+ * - Return any attribute override on an attribute get
+ * - Cancel any non-const attribute override and save the attribute in the sync
+ * tank on an attribute set
*/
-AttributeTank & theOverrideAttrTank();
+class AttrOverrideSync
+{
+public:
+ /**
+ * @brief Allow a debug tool to directly access the override tank
+ */
+ friend void directOverride();
-/**
- * @brief This function returns the SyncAttributeTank singleton. Other
- * modules must call this rather than using Singleton<>
- */
-AttributeTank & theSyncAttrTank();
+ /**
+ * @brief Maximum size of a direct attribute override
+ */
+ static const size_t MAX_DIRECT_OVERRIDE_ATTR_SIZE_BYTES = 64;
-} // namespace attrOverrideSync
+ /**
+ * @brief Attribute Override/Sync Mailbox Message Type Constants
+ * These must be kept in sync with FSP firmware
+ */
+ enum MAILBOX_MSG_TYPE
+ {
+ MSG_SET_OVERRIDES = MBOX::FIRST_UNSECURE_MSG + 0x10, // FSP<->Hb
+ MSG_CLEAR_ALL_OVERRIDES = MBOX::FIRST_UNSECURE_MSG + 0x11, // FSP<->Hb
+ MSG_SET_SYNC_ATTS = MBOX::FIRST_UNSECURE_MSG + 0x12, // FSP<--Hb
+ };
-} // namespace fapi
+ /**
+ * @brief Default constructor
+ */
+ AttrOverrideSync();
-/**
- * @brief Macro that is called on a FAPI_ATTR_GET that returns any Attribute
- * Override
- */
-#define FAPI_PLAT_GET_ATTR_OVERRIDE(ID, PTARGET, VAL) \
- fapi::getAttributeT(ID, PTARGET, fapi::attrOverrideSync::theOverrideAttrTank(), VAL)
+ /**
+ * @brief Destructor
+ */
+ ~AttrOverrideSync();
-/**
- * @brief Macro that is called on a FAPI_ATTR_SET that clears any non-const
- * Attribute Override and saves the Attribute to Sync
- */
-#define FAPI_PLAT_ATTR_SET_ACTIONS(ID, PTARGET, VAL) \
- fapi::attrOverrideSync::theOverrideAttrTank().clearNonConstAttribute(ID, PTARGET), \
- fapi::setAttributeT(ID, PTARGET, fapi::attrOverrideSync::theSyncAttrTank(), VAL)
+ /**
+ * @brief Monitors for incoming attribute override messages from the FSP.
+ * This function never returns and must be called by a task
+ * specifically started to monitor for these messages
+ */
+ void monitorForFspMessages();
+
+ /**
+ * @brief Sends Attribute Overrides and Syncs to the FSP
+ *
+ * This is called at the end of an IStep. For both FAPI/TARG tanks it:
+ * - Clears the FSP Attribute Overrides
+ * - Sends the Hostboot Attribute Overrides to the FSP
+ * - Sends the Hostboot Attribute Syncs to the FSP
+ */
+ void sendAttrOverridesAndSyncsToFsp();
+
+ /**
+ * @brief This function gets any Attribute Override on an attribute get
+ *
+ * This is called for those FAPI Attributes that do not map to Targeting
+ * attributes - their overrides live in the FAPI Attribute tanks.
+ *
+ * @param[in] i_attrId FAPI Attribute ID
+ * @param[in] i_pTarget Pointer to FAPI Target
+ * @param[in] o_pVal Pointer to attribute value
+ *
+ * @return true if an override exists and was written to o_pVal
+ */
+ bool getAttrOverride(const fapi::AttributeId i_attrId,
+ const fapi::Target * const i_pTarget,
+ void * o_pVal) const;
+
+ /**
+ * @brief This function gets any Attribute Override on an attribute get
+ *
+ * This is a wrapper that calls getAttrOverride on the AttrOverrideSync
+ * singleton, it should be called by external modules to avoid the
+ * performance penalty of calling theAttrOverrideSync() then getAttrOverride
+ *
+ * @param[in] i_attrId FAPI Attribute ID
+ * @param[in] i_pTarget Pointer to FAPI Target
+ * @param[in] o_pVal Pointer to attribute value
+ *
+ * @return true if an override exists and was written to o_pVal
+ */
+ static bool getAttrOverrideFunc(const fapi::AttributeId i_attrId,
+ const fapi::Target * const i_pTarget,
+ void * o_pVal);
+
+ /**
+ * @brief This function performs the actions required on an attribute set
+ *
+ * This is called for those FAPI Attributes that do not map to Targeting
+ * attributes - their overrides/syncs live in the FAPI Attribute tanks.
+ *
+ * - Any non-const attribute override is cleared
+ * - The attribute is saved to be synced to Cronus (if Cronus Sync enabled)
+ *
+ * @param[in] i_attrId FAPI Attribute ID
+ * @param[in] i_pTarget Pointer to FAPI Target
+ * @param[in] i_size Size of attribute value
+ * @param[in] i_pVal Pointer to attribute value
+ */
+ void setAttrActions(const fapi::AttributeId i_attrId,
+ const fapi::Target * const i_pTarget,
+ const uint32_t i_size,
+ const void * i_pVal);
+
+ /**
+ * @brief This function performs the actions required on an attribute set
+ *
+ * This is a wrapper that calls setAttrActions on the AttrOverrideSync
+ * singleton, it should be called by external modules to avoid the
+ * performance penalty of calling theAttrOverrideSync() then setAttrActions
+ *
+ * @param[in] i_attrId FAPI Attribute ID
+ * @param[in] i_pTarget Pointer to FAPI Target
+ * @param[in] i_size Size of attribute value
+ * @param[in] i_pVal Pointer to attribute value
+ */
+ static void setAttrActionsFunc(const fapi::AttributeId i_attrId,
+ const fapi::Target * const i_pTarget,
+ const uint32_t i_size,
+ const void * i_pVal);
+private:
+
+ /**
+ * @brief Utility function that sends attributes to the FSP
+ *
+ * This function frees the allocated memory in the input vector of chunks
+ * and empties the vector
+ *
+ * @param[in] i_msgType Message type (ID) to send
+ * @param[in] i_tankLayer Tank Layer to send attribute to
+ * @param[io] io_attributes Attributes to send.
+ *
+ * @return error log handle
+ */
+ static errlHndl_t sendAttrsToFsp(
+ const MAILBOX_MSG_TYPE i_msgType,
+ const TARGETING::AttributeTank::TankLayer i_tankLayer,
+ std::vector<TARGETING::AttributeTank::AttributeSerializedChunk> &
+ io_attributes);
+
+ /**
+ * @brief Utility function that gets the target type of a FAPI Target as
+ * used in an attribute tank
+ *
+ * @param[in] i_pTarget Pointer to FAPI Target (NULL = system)
+ *
+ * @return Target Type
+ */
+ static uint32_t getTargetType(const fapi::Target * const i_pTarget);
+
+ /**
+ * @brief Utility function that gets the target position of a FAPI Target
+ * as used in an attribute tank
+ *
+ * @param[in] i_pTarget Pointer to FAPI Target (NULL = system)
+ *
+ * @return Target Position
+ */
+ static uint16_t getTargetPos(const fapi::Target * const i_pTarget);
+
+ /**
+ * @brief Utility function that gets the target unit position of a FAPI
+ * Target as used in an attribute tank
+ *
+ * @param[in] i_pTarget Pointer to FAPI Target (NULL = system)
+ *
+ * @return Target Unit Position
+ */
+ static uint8_t getTargetUnitPos(const fapi::Target * const i_pTarget);
+
+ // The FAPI Attribute Tanks
+ TARGETING::AttributeTank iv_overrideTank;
+ TARGETING::AttributeTank iv_syncTank;
+};
+
+} // namespace fapi
#endif // FAPIPLATATTROVERRIDESYNC_H_
diff --git a/src/include/usr/hwpf/plat/fapiPlatAttributeService.H b/src/include/usr/hwpf/plat/fapiPlatAttributeService.H
index a0f8723a7..f9834bddd 100644
--- a/src/include/usr/hwpf/plat/fapiPlatAttributeService.H
+++ b/src/include/usr/hwpf/plat/fapiPlatAttributeService.H
@@ -52,7 +52,6 @@
#include <fapiplatattrmacros.H>
#include <hwpf/fapi/fapiReturnCode.H>
#include <hwpf/fapi/fapiTarget.H>
-#include <hwpf/fapi/fapiAttributeTank.H>
#include <hwpf/plat/fapiPlatAttrOverrideSync.H>
#include <vpd/spdenums.H>
#include <dimmConsts.H>
@@ -446,114 +445,167 @@ fapi::ReturnCode fapiPlatGetProcPcieBarSize (
// MACROs to route each ATTR_SPD access to the Hostboot SPD function
//------------------------------------------------------------------------------
#define ATTR_SPD_DRAM_DEVICE_TYPE_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::BASIC_MEMORY_TYPE, &(VAL), sizeof(VAL) )
#define ATTR_SPD_MODULE_TYPE_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::MODULE_TYPE, &(VAL), sizeof(VAL) )
#define ATTR_SPD_SDRAM_BANKS_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::BANK_ADDRESS_BITS, &(VAL), sizeof(VAL) )
#define ATTR_SPD_SDRAM_DENSITY_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::DENSITY, &(VAL), sizeof(VAL) )
#define ATTR_SPD_SDRAM_ROWS_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::ROW_ADDRESS, &(VAL), sizeof(VAL) )
#define ATTR_SPD_SDRAM_COLUMNS_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::COL_ADDRESS, &(VAL), sizeof(VAL) )
#define ATTR_SPD_MODULE_NOMINAL_VOLTAGE_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::MODULE_NOMINAL_VOLTAGE, &(VAL), sizeof(VAL) )
#define ATTR_SPD_NUM_RANKS_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::MODULE_RANKS, &(VAL), sizeof(VAL) )
#define ATTR_SPD_DRAM_WIDTH_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::MODULE_DRAM_WIDTH, &(VAL), sizeof(VAL) )
#define ATTR_SPD_MODULE_MEMORY_BUS_WIDTH_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::MODULE_MEMORY_BUS_WIDTH, &(VAL), sizeof(VAL) )
#define ATTR_SPD_FTB_DIVIDEND_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::FTB_DIVIDEND, &(VAL), sizeof(VAL) )
#define ATTR_SPD_FTB_DIVISOR_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::FTB_DIVISOR, &(VAL), sizeof(VAL) )
#define ATTR_SPD_MTB_DIVIDEND_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::MTB_DIVIDEND, &(VAL), sizeof(VAL) )
#define ATTR_SPD_MTB_DIVISOR_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::MTB_DIVISOR, &(VAL), sizeof(VAL) )
#define ATTR_SPD_TCKMIN_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::TCK_MIN, &(VAL), sizeof(VAL) )
#define ATTR_SPD_CAS_LATENCIES_SUPPORTED_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::CAS_LATENCIES_SUPPORTED, &(VAL), sizeof(VAL) )
#define ATTR_SPD_TAAMIN_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::MIN_CAS_LATENCY, &(VAL), sizeof(VAL) )
#define ATTR_SPD_TWRMIN_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::TWR_MIN, &(VAL), sizeof(VAL) )
#define ATTR_SPD_TRCDMIN_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::TRCD_MIN, &(VAL), sizeof(VAL) )
#define ATTR_SPD_TRRDMIN_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::TRRD_MIN, &(VAL), sizeof(VAL) )
#define ATTR_SPD_TRPMIN_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::TRP_MIN, &(VAL), sizeof(VAL) )
#define ATTR_SPD_TRASMIN_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::TRAS_MIN, &(VAL), sizeof(VAL) )
#define ATTR_SPD_TRCMIN_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::TRC_MIN, &(VAL), sizeof(VAL) )
#define ATTR_SPD_TRFCMIN_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::TRFC_MIN, &(VAL), sizeof(VAL) )
#define ATTR_SPD_TWTRMIN_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::TWTR_MIN, &(VAL), sizeof(VAL) )
#define ATTR_SPD_TRTPMIN_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::TRTP_MIN, &(VAL), sizeof(VAL) )
#define ATTR_SPD_TFAWMIN_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::TFAW_MIN, &(VAL), sizeof(VAL) )
#define ATTR_SPD_SDRAM_OPTIONAL_FEATURES_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::SPD_SDRAM_OPTIONAL_FEATURES, &(VAL), sizeof(VAL) )
#define ATTR_SPD_SDRAM_THERMAL_AND_REFRESH_OPTIONS_GETMACRO(ID, PTARGET, VAL ) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::SPD_SDRAM_THERMAL_REFRESH_OPTIONS, &(VAL), sizeof(VAL) )
#define ATTR_SPD_MODULE_THERMAL_SENSOR_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::SPD_MODULE_THERMAL_SENSOR, &(VAL), sizeof(VAL) )
#define ATTR_SPD_SDRAM_DEVICE_TYPE_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::SDRAM_DEVICE_TYPE, &(VAL), sizeof(VAL) )
#define ATTR_SPD_SDRAM_DEVICE_TYPE_SIGNAL_LOADING_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::SDRAM_DEVICE_TYPE_SIGNAL_LOADING, &(VAL), sizeof(VAL) )
#define ATTR_SPD_CUSTOM_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::CUSTOM, &(VAL), sizeof(VAL) )
#define ATTR_SPD_SDRAM_DIE_COUNT_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::SDRAM_DIE_COUNT, &(VAL), sizeof(VAL) )
#define ATTR_SPD_FINE_OFFSET_TCKMIN_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::TCKMIN_FINE_OFFSET, &(VAL), sizeof(VAL) )
#define ATTR_SPD_FINE_OFFSET_TAAMIN_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::TAAMIN_FINE_OFFSET, &(VAL), sizeof(VAL) )
#define ATTR_SPD_FINE_OFFSET_TRCDMIN_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::TRCDMIN_FINE_OFFSET, &(VAL), sizeof(VAL) )
#define ATTR_SPD_FINE_OFFSET_TRPMIN_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::TRPMIN_FINE_OFFSET, &(VAL), sizeof(VAL) )
#define ATTR_SPD_FINE_OFFSET_TRCMIN_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::TRCMIN_FINE_OFFSET, &(VAL), sizeof(VAL) )
#define ATTR_SPD_NUM_OF_REGISTERS_USED_ON_RDIMM_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::RMM_REGS_RDIMM, &(VAL), sizeof(VAL) )
#define ATTR_SPD_MODULE_SPECIFIC_SECTION_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::MODULE_TYPE_SPECIFIC_SECTION, &(VAL), sizeof(VAL) )
#define ATTR_SPD_MODULE_ID_MODULE_MANUFACTURERS_JEDEC_ID_CODE_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::MODULE_MANUFACTURER_ID, &(VAL), sizeof(VAL) )
#define ATTR_SPD_MODULE_ID_MODULE_MANUFACTURING_LOCATION_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::MODULE_MANUFACTURING_LOCATION, &(VAL), sizeof(VAL) )
#define ATTR_SPD_MODULE_ID_MODULE_MANUFACTURING_DATE_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::MODULE_MANUFACTURING_DATE, &(VAL), sizeof(VAL) )
#define ATTR_SPD_MODULE_ID_MODULE_SERIAL_NUMBER_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::MODULE_SERIAL_NUMBER, &(VAL), sizeof(VAL) )
#define ATTR_SPD_CYCLICAL_REDUNDANCY_CODE_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::MODULE_CRC, &(VAL), sizeof(VAL) )
#define ATTR_SPD_MODULE_PART_NUMBER_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::MODULE_PART_NUMBER, &(VAL), sizeof(VAL) )
#define ATTR_SPD_MODULE_REVISION_CODE_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::MODULE_REVISION_CODE, &(VAL), sizeof(VAL) )
#define ATTR_SPD_DRAM_MANUFACTURER_JEDEC_ID_CODE_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::DRAM_MANUFACTURER_ID, &(VAL), sizeof(VAL) )
#define ATTR_SPD_BAD_DQ_DATA_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetSpdAttr( PTARGET, SPD::DIMM_BAD_DQ_DATA, &(VAL), sizeof(VAL) )
#define ATTR_SPD_BAD_DQ_DATA_SETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::setAttrActionsFunc(fapi::ID, PTARGET, sizeof(VAL), &(VAL)), \
fapi::platAttrSvc::fapiPlatSetSpdAttr( PTARGET, SPD::DIMM_BAD_DQ_DATA, &(VAL), sizeof(VAL) )
//------------------------------------------------------------------------------
// MACROs to route ATTR Base Address accesses to the correct Hostboot function
//------------------------------------------------------------------------------
#define ATTR_MSS_MEMORY_BASE_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetMemoryBaseAddr(PTARGET, VAL)
#define ATTR_MSS_MIRROR_BASE_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetMirrorBaseAddr(PTARGET, VAL)
//------------------------------------------------------------------------------
@@ -561,78 +613,97 @@ fapi::ReturnCode fapiPlatGetProcPcieBarSize (
// function
//------------------------------------------------------------------------------
#define ATTR_CEN_DQ_TO_DIMM_CONN_DQ_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetDqMapping(PTARGET, VAL)
//------------------------------------------------------------------------------
// MACRO to route ATTR_NAME access to the correct Hostboot function
//------------------------------------------------------------------------------
#define ATTR_NAME_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetTargetName(PTARGET, VAL)
//------------------------------------------------------------------------------
// MACRO to route ATTR_FUNCTIONAL access to the correct Hostboot function
//------------------------------------------------------------------------------
#define ATTR_FUNCTIONAL_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetFunctional(PTARGET, VAL)
//------------------------------------------------------------------------------
// MACRO to route ATTR_POS access to the correct Hostboot function
//------------------------------------------------------------------------------
#define ATTR_POS_GETMACRO(ID, PTARGET, VAL) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetTargetPos(PTARGET, VAL)
//------------------------------------------------------------------------------
// MACROS to support proc_setup_bars_memory_attributes.xml
//------------------------------------------------------------------------------
#define ATTR_PROC_FOREIGN_NEAR_BASE_GETMACRO( ID, PTARGET, VAL ) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetProcForeignNearBase (PTARGET, VAL )
#define ATTR_PROC_FOREIGN_NEAR_SIZE_GETMACRO( ID, PTARGET, VAL ) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetProcForeignNearSize (PTARGET, VAL )
#define ATTR_PROC_FOREIGN_FAR_BASE_GETMACRO( ID, PTARGET, VAL ) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetProcForeignFarBase (PTARGET, VAL )
#define ATTR_PROC_FOREIGN_FAR_SIZE_GETMACRO( ID, PTARGET, VAL ) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetProcForeignFarSize (PTARGET, VAL )
#define ATTR_PROC_HA_BASE_GETMACRO( ID, PTARGET, VAL ) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetProcHaBase (PTARGET, VAL )
#define ATTR_PROC_HA_SIZE_GETMACRO( ID, PTARGET, VAL ) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetProcHaSize (PTARGET, VAL )
//------------------------------------------------------------------------------
// MACROS to support proc_setup_bars_mmio_attributes.xml
//------------------------------------------------------------------------------
#define ATTR_PROC_PSI_BRIDGE_BAR_ENABLE_GETMACRO( ID, PTARGET, VAL ) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetProcPsiBridgeBarEnable (PTARGET, VAL )
#define ATTR_PROC_FSP_BAR_ENABLE_GETMACRO( ID, PTARGET, VAL ) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetProcFspBarEnable (PTARGET, VAL )
#define ATTR_PROC_INTP_BAR_ENABLE_GETMACRO( ID, PTARGET, VAL ) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetProcIntpBarEnable (PTARGET, VAL )
#define ATTR_PROC_NX_MMIO_BAR_ENABLE_GETMACRO( ID, PTARGET, VAL ) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetProcNxMmioBarEnable(PTARGET, VAL )
#define ATTR_PROC_NX_MMIO_BAR_SIZE_GETMACRO( ID, PTARGET, VAL ) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetProcNxMmioBarSize (PTARGET, VAL )
#define ATTR_PROC_PCIE_BAR_ENABLE_GETMACRO( ID, PTARGET, VAL ) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetProcPcieBarEnable (PTARGET, VAL )
#define ATTR_PROC_PCIE_BAR_BASE_ADDR_GETMACRO( ID, PTARGET, VAL ) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetProcPcieBarBaseAddr (PTARGET, VAL )
#define ATTR_PROC_PCIE_BAR_SIZE_GETMACRO( ID, PTARGET, VAL ) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetProcPcieBarSize (PTARGET, VAL )
//------------------------------------------------------------------------------
-// MACROS to support proc_fab_smp_fabric_attributes.xml
-//------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
// MACROS to support enable attributes in p8_xip_customize_attributes.xml
//------------------------------------------------------------------------------
#define ATTR_PROC_NX_ENABLE_GETMACRO( ID, PTARGET, VAL ) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetEnableAttr ( fapi::ID, PTARGET, VAL )
#define ATTR_PROC_PCIE_ENABLE_GETMACRO( ID, PTARGET, VAL ) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetEnableAttr ( fapi::ID, PTARGET, VAL )
#define ATTR_PROC_L3_ENABLE_GETMACRO( ID, PTARGET, VAL ) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetEnableAttr ( fapi::ID, PTARGET, VAL )
#define ATTR_PROC_A_ENABLE_GETMACRO( ID, PTARGET, VAL ) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetEnableAttr ( fapi::ID, PTARGET, VAL )
#define ATTR_PROC_X_ENABLE_GETMACRO( ID, PTARGET, VAL ) \
+ fapi::AttrOverrideSync::getAttrOverrideFunc(fapi::ID, PTARGET, &VAL) ? fapi::FAPI_RC_SUCCESS : \
fapi::platAttrSvc::fapiPlatGetEnableAttr ( fapi::ID, PTARGET, VAL )
#endif // FAPIPLATATTRIBUTESERVICE_H_
diff --git a/src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H b/src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H
index bbc0f827b..ee9f0ed88 100644
--- a/src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H
+++ b/src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2012 */
+/* COPYRIGHT International Business Machines Corp. 2011,2013 */
/* */
/* p1 */
/* */
@@ -38,7 +38,6 @@
#include <fapiTestHwpError.H>
#include <fapiTestHwpFfdc.H>
#include <fapiTestHwpConfig.H>
-#include <fapiTestHwpAttr.H>
#include <fapiTestHwpDq.H>
#include <dimmBadDqBitmapAccessHwp.H>
#include <erepairGetFailedLanesHwp.H>
diff --git a/src/include/usr/hwpf/hwp/fapiTestHwpAttr.H b/src/include/usr/targeting/adapters/mutexadapter.H
index ba28e440e..c0fda2408 100755..100644
--- a/src/include/usr/hwpf/hwp/fapiTestHwpAttr.H
+++ b/src/include/usr/targeting/adapters/mutexadapter.H
@@ -1,11 +1,11 @@
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
-/* $Source: src/include/usr/hwpf/hwp/fapiTestHwpAttr.H $ */
+/* $Source: src/include/usr/targeting/adapters/mutexadapter.H $ */
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2012 */
+/* COPYRIGHT International Business Machines Corp. 2013 */
/* */
/* p1 */
/* */
@@ -20,41 +20,30 @@
/* Origin: 30 */
/* */
/* IBM_PROLOG_END_TAG */
+#ifndef __TARGETING_MUTEXADAPTER_H
+#define __TARGETING_MUTEXADAPTER_H
+
/**
- * @file fapiTestHwpAttr.H
- *
- * @brief Defines a test Hardware Procedure that exercises the test attributes
- */
+* @file mutexAdapter.H
+*
+* @brief Provides Hostboot specific TARGETING Mutex
+*/
-/*
- * Change Log ******************************************************************
- * Flag Defect/Feature User Date Description
- * ------ -------------- ---------- ----------- ----------------------------
- * mjjones 06/30/2011 Created.
- * mjjones 10/07/2011 Removed target param
- * mjjones 10/17/2011 Added func pointer
- */
+#include <sys/sync.h>
-#ifndef FAPITESTHWPATTR_H_
-#define FAPITESTHWPATTR_H_
+#define TARG_MUTEX_TYPE \
+ mutex_t
-#include <fapi.H>
+#define TARG_MUTEX_INIT(_t) \
+ mutex_init(&(_t))
-typedef fapi::ReturnCode (*hwpTestAttributes_FP_t)();
+#define TARG_MUTEX_DESTROY(_t) \
+ mutex_destroy(&(_t))
-extern "C"
-{
+#define TARG_MUTEX_LOCK(_t) \
+ mutex_lock(&(_t))
-/**
- * @brief HWP that exercises attributes
- *
- * @param[in] i_mbaTarget Reference to MBA chiplet target
- * @param[in] i_procTarget Reference to processor chip target
- * @return ReturnCode
- */
-fapi::ReturnCode hwpTestAttributes(fapi::Target & i_mbaTarget,
- fapi::Target & i_procTarget);
-
-}
+#define TARG_MUTEX_UNLOCK(_t) \
+ mutex_unlock(&(_t))
#endif
diff --git a/src/include/usr/targeting/common/attributeTank.H b/src/include/usr/targeting/common/attributeTank.H
new file mode 100644
index 000000000..3fea178c7
--- /dev/null
+++ b/src/include/usr/targeting/common/attributeTank.H
@@ -0,0 +1,342 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/usr/targeting/common/attributeTank.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2013 */
+/* */
+/* 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 otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+/**
+ * @file attributeTank.H
+ *
+ * @brief Defines the AttributeTank and its associated classes. These are used
+ * to store attributes for Attribute Overriding and Synchronization
+ */
+
+/*
+ * Change Log ******************************************************************
+ * Flag Defect/Feature User Date Description
+ * ------ -------------- ---------- ----------- ----------------------------
+ * mjjones 06/07/2012 Created
+ * mjjones 10/15/2012 Moved to general AttributeTank.
+ * mjjones 02/13/2013 Moved to Targeting and major
+ * design changes
+ */
+
+#ifndef __TARGETING_COMMON_ATTRTANK_H
+#define __TARGETING_COMMON_ATTRTANK_H
+
+#include <stdint.h>
+#include <list>
+#include <vector>
+#include <targeting/adapters/mutexadapter.H>
+
+namespace TARGETING
+{
+
+/**
+ * @class AttributeTank
+ *
+ * This class is used to store Attributes
+ */
+class AttributeTank
+{
+public:
+ /**
+ * @brief Allocation types
+ *
+ * This is passed to serializeAttributes
+ */
+ enum AllocType
+ {
+ ALLOC_TYPE_MALLOC = 1,
+ ALLOC_TYPE_NEW = 2,
+ };
+
+ /**
+ * @enum AttributeFlags
+ *
+ * Enumeration of the possible attribute flags. This is a bitmap
+ *
+ * This is passed to setAttribute
+ */
+ enum AttributeFlags
+ {
+ ATTR_FLAG_CONST = 0x01, // Use-case is a constant Attribute Override
+ // NEXT = 0x02,
+ // NEXT = 0x04,
+ // NEXT = 0x08,
+ };
+
+ /**
+ * @enum TankLayer
+ *
+ * Enumeration of the software layers that contain AttributeTanks
+ */
+ enum TankLayer
+ {
+ TANK_LAYER_NONE,
+ TANK_LAYER_FAPI,
+ TANK_LAYER_TARG,
+ };
+
+ // Constants for various fields in AttributeHeader
+ static const uint16_t ATTR_POS_NA = 0xffff; // iv_pos N/A
+ static const uint8_t ATTR_UNIT_POS_NA = 0xff; // iv_unitPos N/A
+
+ /**
+ * @struct AttributeHeader
+ *
+ * This structure defines all the data for an attribute without the actual
+ * attribute value.
+ *
+ * This is used in an AttributeSerializedChunk and used to store attributes
+ * in an AttributeTank
+ */
+ struct AttributeHeader
+ {
+ /**
+ * @brief Constructor
+ */
+ AttributeHeader();
+
+ // Public data
+ uint32_t iv_attrId; // Attribute ID
+ uint32_t iv_targetType; // Target Type attribute is for
+ uint16_t iv_pos; // For chips/dimms the position
+ // For chiplets the parent chip position
+ uint8_t iv_unitPos; // For chiplets the position
+ uint8_t iv_flags; // AttributeFlags enum value(s)
+ uint32_t iv_valSize; // Size of the attribute value in bytes
+ };
+
+ /**
+ * @struct AttributeSerializedChunk
+ *
+ * This structure defines a chunk of memory for containing serialized
+ * attributes. The memory chunk contains a set of attributes, each is an
+ * AttributeHeader followed by a buffer containing the attribute value.
+ *
+ * A vector of AttributeSerializedChunks is returned by serializeAttributes
+ * and a single AttributeSerializedChunk is passed to deserializeAttributes
+ *
+ * The user must free the memory pointed to by iv_pAttributes before
+ * deleting this structure, the reason is that the allocType (malloc/new)
+ * and therefore the free type (free/delete[]) was specified in
+ * serializeAttributes and the use case is to pass attributes over a
+ * mailbox interface which may free memory automatically.
+ */
+ struct AttributeSerializedChunk
+ {
+ /**
+ * @brief Constructor
+ */
+ AttributeSerializedChunk();
+
+ uint32_t iv_size; // Chunk size in bytes
+ uint8_t * iv_pAttributes; // Pointer to chunk of memory
+ };
+
+ /**
+ * @brief Default constructor
+ */
+ AttributeTank();
+
+ /**
+ * @brief Destructor. Deletes all Attributes
+ */
+ virtual ~AttributeTank();
+
+ /**
+ * @brief Checks if the platform has enabled synchronization
+ *
+ * Can be called before storing attributes in a tank for the purposes of
+ * synchronization.
+ */
+ static bool syncEnabled();
+
+ /**
+ * @brief Clear all attributes
+ */
+ virtual void clearAllAttributes();
+
+ /**
+ * @brief Clear any non-const attribute for a specified ID and Target
+ *
+ * This is called on an OverrideAttributeTank to clear any non-const
+ * Attribute Override when an attribute is set
+ *
+ * @param[in] i_attrId Attribute ID
+ * @param[in] i_targetType Target Type attribute is for
+ * @param[in] i_pos Target Position
+ * @param[in] i_unitPos Target Unit Position
+ */
+ virtual void clearNonConstAttribute(const uint32_t i_attrId,
+ const uint32_t i_targetType,
+ const uint16_t i_pos,
+ const uint8_t i_unitPos);
+
+ /**
+ * @brief Set an Attribute
+ *
+ * The attribute value is copied from i_pVal. If the attribute already
+ * exists then it is replaced with the new one
+ *
+ * This is called on an OverrideAttributeTank to setup an override.
+ *
+ * This is called on a SyncAttributeTank to save an Attribute for syncing
+ * when an attribute is set
+ *
+ * @param[in] i_attrId Attribute ID
+ * @param[in] i_targetType Target Type attribute is for
+ * @param[in] i_pos Target Position
+ * @param[in] i_unitPos Target Unit Position
+ * @param[in] i_flags Flags (ORed set of AttributeFlags)
+ * @param[in] i_valSize Size of attribute value in bytes
+ * @param[in] i_pVal Pointer to attribute value
+ */
+ virtual void setAttribute(const uint32_t i_attrId,
+ const uint32_t i_targetType,
+ const uint16_t i_pos,
+ const uint8_t i_unitPos,
+ const uint8_t i_flags,
+ const uint32_t i_valSize,
+ const void * i_pVal);
+
+ /**
+ * @brief Get a copy of an Attribute
+ *
+ * This is called on an OverrideAttributeTank to query/get an Attribute
+ * Override when an attribute is got
+ *
+ * @param[in] i_attrId Attribute ID
+ * @param[in] i_targetType Target Type attribute is for
+ * @param[in] i_pos Target Position
+ * @param[in] i_unitPos Target Unit Position
+ * @param[out] o_pVal Pointer to attribute value
+ *
+ * return true if attribute exists and a copy was written to o_pVal
+ */
+ virtual bool getAttribute(const uint32_t i_attrId,
+ const uint32_t i_targetType,
+ const uint16_t i_pos,
+ const uint8_t i_unitPos,
+ void * o_pVal) const;
+
+ /**
+ * @brief Serialize all Attributes into newly allocated memory chunks
+ *
+ * The use case is for getting the attributes to send across an interface
+ * to another AttributeTank on a another subsystem. The alloc type can be
+ * specified to support interface code that automatically frees buffers
+ * after sending (Hostboot mailbox uses malloc/free, FSP mailbox uses
+ * new[]/delete[]).
+ *
+ * @param[in] i_allocType Which allocation is used to allocated memory
+ * @param[in] i_chunkSize Max chunk size to use
+ * @param[out] o_attributes Ref to vector that AttributeSerializedChunk
+ * structs are added to.
+ * The caller must free (if MALLOC)
+ * or delete[] (if NEW) each chunk's memory
+ */
+ virtual void serializeAttributes(
+ const AllocType i_allocType,
+ const uint32_t i_chunkSize,
+ std::vector<AttributeSerializedChunk> & o_attributes) const;
+
+ /**
+ * @brief Deserialize a chunk of Attributes into the tank
+ *
+ * The use case is for receiving a chunk of serialized attributes from
+ * another AttributeTank on a another subsystem. The caller is responsible
+ * for freeing/deleting the memory in the chunk after calling this function.
+ *
+ * @param[in] i_attributes Reference to AttributeSerializedChunk containing
+ * attributes.
+ */
+ virtual void deserializeAttributes(
+ const AttributeSerializedChunk & i_attributes);
+
+ /**
+ * @brief Fast inline check if any attributes exist in the tank
+ *
+ * The use case is for performing a very fast check to see if attributes
+ * exist in the tank before calling attributeExists to check that an
+ * attribute with the specified ID exists in the tank. This is done without
+ * a lock for maximum performance.
+ *
+ * return true if any attributes exist
+ */
+ virtual bool attributesExist() const { return iv_attributesExist; }
+
+ /**
+ * @brief Check if an attribute exists in the tank
+ *
+ * The use case is for performing a check to see if the specified attribute
+ * exists in the tank before doing the work to figure out a Target's type/
+ * position and calling a function to clear or get attributes. The user is
+ * expected to call attributesExist() to check if any attributes exist in
+ * the tank before calling this function.
+ *
+ * @param[in] i_attrId Attribute ID
+ *
+ * return true if any attributes exist
+ */
+ virtual bool attributeExists(const uint32_t i_attrId) const;
+
+private:
+ // Copy constructor and assignment operator disabled
+ AttributeTank(const AttributeTank & i_right);
+ AttributeTank & operator=(const AttributeTank & i_right);
+
+ /**
+ * @struct Attribute
+ *
+ * This structure defines a single attribute.
+ */
+ struct Attribute
+ {
+ /**
+ * @brief Constructor
+ */
+ Attribute();
+
+ /**
+ * @brief Destructor. Frees memory
+ */
+ ~Attribute();
+
+ // Public data
+ AttributeHeader iv_hdr;
+ uint8_t * iv_pVal; // Pointer to attribute value
+ };
+
+ // The attributes
+ // Note: A possible performance boost could be to store the elements in a
+ // map, the key could be a sub-structure.
+ bool iv_attributesExist;
+ std::list<Attribute *> iv_attributes;
+ typedef std::list<Attribute *>::iterator AttributesItr_t;
+ typedef std::list<Attribute *>::const_iterator AttributesCItr_t;
+
+ // Lock for thread safety (class provided by platform)
+ mutable TARG_MUTEX_TYPE iv_mutex;
+};
+
+} // namespace TARGETING
+
+#endif
diff --git a/src/include/usr/targeting/common/target.H b/src/include/usr/targeting/common/target.H
index a3dbc8041..16b2a8c51 100644
--- a/src/include/usr/targeting/common/target.H
+++ b/src/include/usr/targeting/common/target.H
@@ -48,6 +48,7 @@
// This component
#include <targeting/common/attributes.H>
+#include <targeting/common/attributeTank.H>
namespace TARGETING
{
@@ -269,6 +270,26 @@ class Target
*/
Target* getTargetFromHuid(const ATTR_HUID_type i_huid) const;
+ /**
+ * @brief Return the Targeting Override Attribute Tank
+ *
+ * @return Reference to the Attribute Tank
+ */
+ static AttributeTank & theTargOverrideAttrTank()
+ {
+ return cv_overrideTank;
+ }
+
+ /**
+ * @brief Return the Targeting Sync Attribute Tank
+ *
+ * @return Reference to the Attribute Tank
+ */
+ static AttributeTank & theTargSyncAttrTank()
+ {
+ return cv_syncTank;
+ }
+
private: // Private helper interfaces
/**
@@ -378,6 +399,39 @@ class Target
const ATTRIBUTE_ID i_attribute,
mutex_t*& o_pMutex) const;
+ /**
+ * @brief Returns the target's type as used in an attribute tank.
+ *
+ * This target type is associated with an attribute in an attribute
+ * tank and helps identify which target(s) the attribute belongs to
+ *
+ * @return uint32_t The target type
+ */
+ uint32_t getAttrTankTargetType() const;
+
+ /**
+ * @brief Returns the target's position as used in an attribute tank.
+ *
+ * This target position is associated with an attribute in an attribute
+ * tank and helps identify which target(s) the attribute belongs to.
+ * For a unit, this is the parent chip's position
+ *
+ * @return uint16_t The target position
+ */
+ uint16_t getAttrTankTargetPos() const;
+
+ /**
+ * @brief Returns the target's unit position as used in an attribute
+ * tank.
+ *
+ * This target unit position is associated with an attribute in an
+ * attribute tank and helps identify which target(s) the attribute
+ * belongs to. This is only a valid value for units
+ *
+ * @return uint8_t The target unit position
+ */
+ uint8_t getAttrTankTargetUnitPos() const;
+
private: // Private instance variables
uint32_t iv_attrs; ///< Total attributes allowed for this
@@ -407,6 +461,12 @@ class Target
Target& operator=(
const Target& i_right);
+ private: // Private class variables
+
+ // Attribute Tanks
+ static AttributeTank cv_overrideTank;
+ static AttributeTank cv_syncTank;
+
friend class PnorBuilderService;
} PACKED;
OpenPOWER on IntegriCloud