diff options
author | Mike Jones <mjjones@us.ibm.com> | 2012-06-25 13:35:13 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-07-12 16:28:33 -0500 |
commit | 3b9899c9969d46d2faddca8f3d35fa5074e3097c (patch) | |
tree | 3d09c14357dbf175b79a3892fb88b592d86874b6 /src/include/usr | |
parent | d40d08c719c845213844323ead282a748486d466 (diff) | |
download | talos-hostboot-3b9899c9969d46d2faddca8f3d35fa5074e3097c.tar.gz talos-hostboot-3b9899c9969d46d2faddca8f3d35fa5074e3097c.zip |
Hostboot HWPF Attribute Overrides
This allows a user to override HWPF attributes on Hostboot from the
Simics or VBU console using a FAPI Attribute Override text file. See
the HWPF LLDD for details.
Change-Id: Ia6d38906d266b38db084844513b11b30e25b7f97
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1244
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Tested-by: Jenkins Server
Reviewed-by: Brian H. Horton <brianh@linux.ibm.com>
Diffstat (limited to 'src/include/usr')
-rw-r--r-- | src/include/usr/hwpf/fapi/fapiAttributeOverride.H | 207 | ||||
-rw-r--r-- | src/include/usr/hwpf/fapi/fapiAttributeService.H | 103 | ||||
-rwxr-xr-x | src/include/usr/hwpf/plat/fapiPlatAttributeService.H | 288 | ||||
-rw-r--r-- | src/include/usr/hwpf/plat/fapiPlatReasonCodes.H | 4 |
4 files changed, 564 insertions, 38 deletions
diff --git a/src/include/usr/hwpf/fapi/fapiAttributeOverride.H b/src/include/usr/hwpf/fapi/fapiAttributeOverride.H new file mode 100644 index 000000000..2a125a5ec --- /dev/null +++ b/src/include/usr/hwpf/fapi/fapiAttributeOverride.H @@ -0,0 +1,207 @@ +/* IBM_PROLOG_BEGIN_TAG + * This is an automatically generated prolog. + * + * $Source: src/include/usr/hwpf/fapi/fapiAttributeOverride.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 + */ +/** + * @file fapiAttributeOverride.H + * + * @brief Defines the AttributeOverrides and AttributeOverride classes. A + * platform can choose to use an AttributeOverrides object to store + * Attribute Overrides. + */ + +/* + * Change Log ****************************************************************** + * Flag Defect/Feature User Date Description + * ------ -------------- ---------- ----------- ---------------------------- + * mjjones 06/07/2012 Created + */ + +#ifndef FAPIATTROVERRIDE_H_ +#define FAPIATTROVERRIDE_H_ + +#include <stdint.h> +#include <list> +#include <fapiAttributeIds.H> +#include <fapiTarget.H> + +namespace fapi +{ + +/** + * @enum AttributeOverrideType + * + * Enumeration of the possible attribute override types + */ +enum AttributeOverrideType +{ + ATTR_OVERRIDE_CONST = 1, // Not cleared by a FAPI_ATTR_SET + ATTR_OVERRIDE_NON_CONST = 2, // Cleared by a FAPI_ATTR_SET + ATTR_OVERRIDE_CLEAR_ALL = 3, // Clear all overrides +}; + +// Constants for various fields in AttributeOverrides +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_arayX not applicable + +/** + * @struct AttributeOverride + * + * This structure defines a single attribute override. In the case of an array + * attribute, it is an override for a single element + */ +struct AttributeOverride +{ + uint64_t iv_overrideVal; // Large enough to hold the biggest attribute size + 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_overrideType; // fapi::AttributeOverrideType 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 +}; + +/** + * @class AttributeOverrides + * + * This class can be used to set and query attribute overrides + */ +class AttributeOverrides +{ +public: + /** + * @brief Default constructor + */ + AttributeOverrides(); + + /** + * @brief Destructor + */ + ~AttributeOverrides(); + + /** + * @brief Clear all overrides + */ + void clearOverrides(); + + /** + * @brief Clear any non-const override for a specified ID and Target + * + * @param[in] i_attrId Attribute ID + * @param[in] i_pTarget Pointer to Target (NULL if system) + */ + void clearNonConstOverride(const fapi::AttributeId i_attrId, + const fapi::Target * const i_pTarget); + + /** + * @brief Set an override + * + * Note that no checking is done for duplicate overrides (an override on an + * attribute that already has an override) for performance. If a duplicate + * override is done then getOverride will return the first one. + * + * @param[in] i_override Reference to override structure, this is copied + */ + void setOverride(const AttributeOverride & i_override); + + /** + * @brief Get an override + * + * Note that for array attributes, this must be called repeatedly, to query + * an override for each element of the array + * + * @param[in] i_attrId Attribute ID + * @param[in] i_pTarget Pointer to Target (NULL if system) + * @param[out] o_overrideVal Reference that is filled in with the override + * @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 override exists and was returned. + */ + bool getOverride(const fapi::AttributeId i_attrId, + const fapi::Target * const i_pTarget, + uint64_t & o_overrideVal, + 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 Returns if any overrides exist + * + * This is only expected to be called by unit test + * + * return true if any overrides exist + */ + bool overridesExist(); + +private: + // Copy constructor and assignment operator disabled + AttributeOverrides(const AttributeOverrides & i_right); + AttributeOverrides & operator=(const AttributeOverrides & i_right); + + /** + * @brief Returns if the specified override is for the specified + * attribute ID and Target + * + * @param[in] i_attrId Attribute ID + * @param[in] i_pTarget Pointer to Target (NULL if system) + * @param[in] i_candidate Reference to AttributeOverride + * + * @return true if the AttributeOverride matches + */ + static bool overrideMatch(const fapi::AttributeId i_attrId, + const fapi::Target * const i_pTarget, + const AttributeOverride & i_candidate); + + /** + * @brief Locks the AttributeOverrides object + * + * Implemented by the platform + */ + static void platLock(); + + /** + * @brief Unlocks the AttributeOverrides object + * + * Implemented by the platform + */ + static void platUnlock(); + + // The attribute overrides + bool iv_overridesExist; + std::list<AttributeOverride *> iv_overrides; + typedef std::list<AttributeOverride *>::iterator OverridesItr_t; + typedef std::list<AttributeOverride *>::const_iterator OverridesCItr_t; + +}; + +} + +#endif // FAPIATTROVERRIDE_H_ diff --git a/src/include/usr/hwpf/fapi/fapiAttributeService.H b/src/include/usr/hwpf/fapi/fapiAttributeService.H index 35f370c6d..1744d11a6 100644 --- a/src/include/usr/hwpf/fapi/fapiAttributeService.H +++ b/src/include/usr/hwpf/fapi/fapiAttributeService.H @@ -1,25 +1,26 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/include/usr/hwpf/fapi/fapiAttributeService.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/hwpf/fapi/fapiAttributeService.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 + */ /** * @file fapiAttributeService.H * @@ -40,6 +41,7 @@ * camvanng 10/20/2011 Changed i_pTarget to "const" * ptr * mjjones 04/10/2012 Support for privileged atts + * mjjones 06/07/2012 Add attr override support */ #ifndef FAPIATTRIBUTESERVICE_H_ @@ -65,33 +67,58 @@ * l_rc = FAPI_ATTR_GET(<ID>, l_pTarget, l_pVal); * l_rc = FAPI_ATTR_SET(<ID>, l_pTarget, l_pVal); * - * The first part of these macros is a call to fapiCheckIdType that will cause a - * compile failure if the ID or VAL parameters are incorrect. + * A priveleged attribute is one that a HWP should not generally access, + * examples include ATTR_NAME and ATTR_EC, where usage can lead to a non + * data-driven design. A privileged attribute can be accessed with + * FAPI_ATTR_GET_PRIVILEGED and FAPI_ATTR_SET_PRIVILEGED + * + * The non-PRIVILEGED macros first call a template function (compiler will + * optimize out) that will cause a compile failure if the attribute is + * privileged, they then call a PRIVILEGED macro to get/set the attribute * - * For the non-PRIVILEGED macros, the second part is a call to - * fapiFailIfPrivileged that will cause a compile failure if the attribute is - * privileged (in general, HWPs should not access privileged attributes. - * Examples include ATTR_NAME and ATTR_EC, where usage can lead to a non - * data-driven design). + * 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 final part of these macros calls a macro named <ID>_GET/SETMACRO. This - * macro is defined by PLAT and must do the work of getting/setting the - * attribute. + * The SET macro calls the <ID>_SETMACRO PLAT macro to set the attribute, + * platforms must define a _SETMACRO for each attribute. It then calls the + * FAPI_PLAT_CLEAR_NON_CONST_ATTR_OVERRIDE to clear any non-const attribute + * overrides (platforms can set this to NULL if they do not support + * attribute override or if they handle it in the standard <ID>_SETMACRO + * path). + * + * 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::fapiCheckIdType<fapi::ID##_Type>(fapi::ID, VAL), \ - fapi::fapiFailIfPrivileged<fapi::ID##_Privileged>(), \ - ID##_GETMACRO(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)) + #define FAPI_ATTR_SET(ID, PTARGET, VAL) \ - (fapi::fapiCheckIdType<fapi::ID##_Type>(fapi::ID, VAL), \ - fapi::fapiFailIfPrivileged<fapi::ID##_Privileged>(), \ + (fapi::fapiFailIfPrivileged<fapi::ID##_Privileged>(), \ + fapi::fapiCheckIdType<fapi::ID##_Type>(fapi::ID, VAL), \ + FAPI_PLAT_CLEAR_NON_CONST_ATTR_OVERRIDE(fapi::ID, PTARGET), \ ID##_SETMACRO(ID, PTARGET, VAL)) #define FAPI_ATTR_GET_PRIVILEGED(ID, PTARGET, VAL) \ (fapi::fapiCheckIdType<fapi::ID##_Type>(fapi::ID, VAL), \ - ID##_GETMACRO(ID, PTARGET, VAL)) + FAPI_PLAT_GET_ATTR_OVERRIDE(fapi::ID, PTARGET, VAL) ? \ + fapi::FAPI_RC_SUCCESS \ + : ID##_GETMACRO(ID, PTARGET, VAL)) + #define FAPI_ATTR_SET_PRIVILEGED(ID, PTARGET, VAL) \ (fapi::fapiCheckIdType<fapi::ID##_Type>(fapi::ID, VAL), \ + FAPI_PLAT_CLEAR_NON_CONST_ATTR_OVERRIDE(fapi::ID, PTARGET), \ ID##_SETMACRO(ID, PTARGET, VAL)) namespace fapi diff --git a/src/include/usr/hwpf/plat/fapiPlatAttributeService.H b/src/include/usr/hwpf/plat/fapiPlatAttributeService.H index 834f2facf..a60abcb38 100755 --- a/src/include/usr/hwpf/plat/fapiPlatAttributeService.H +++ b/src/include/usr/hwpf/plat/fapiPlatAttributeService.H @@ -52,8 +52,10 @@ #include <fapiplatattrmacros.H> #include <hwpf/fapi/fapiReturnCode.H> #include <hwpf/fapi/fapiTarget.H> +#include <hwpf/fapi/fapiAttributeOverride.H> #include <spd/spdenums.H> #include <dimmConsts.H> +#include <util/singleton.H> //****************************************************************************** // Interface @@ -163,10 +165,290 @@ fapi::ReturnCode fapiPlatGetTargetName(const fapi::Target * i_pTarget, fapi::ReturnCode fapiPlatGetFunctional(const fapi::Target * i_pTarget, uint8_t & o_functional); +/** + * @brief This function is called by the FAPI_ATTR_GET macro when getting + * ATTR_POS. It should not be called directly + * + * This is needed because the HWPF attribute is a uint32_t and the Hostboot + * attribute is a uint16_t so a direct map will not work + * + * @param[in] i_pFapiTarget Target pointer + * @param[out] o_pos Output Posititon + * @return ReturnCode. Zero on success, else platform specified error + */ +fapi::ReturnCode fapiPlatGetTargetPos(const fapi::Target * i_pFapiTarget, + uint32_t & o_pos); + +/** + * @brief This wrapper function is called by the getAttrOverride function + * templates (which are called by FAPI_PLAT_GET_ATTR_OVERRIDE) to get an + * attribute override value + * + * This wrapper just invokes getAttrOverride on the AttributeOverrides singleton + * in the local (plat) module, it is needed because Singletons cannot be + * accessed outside of a module (this results in a duplicate singleton) + * + * @param[in] i_attrId Attribute ID + * @param[in] i_pTarget Pointer to Target (NULL if system) + * @param[out] o_overrideVal Reference to value filled in with the override + * @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 bool True if override value was returned + */ +bool getOverrideWrap(const fapi::AttributeId i_attrId, + const fapi::Target * const i_pTarget, + uint64_t & o_overrideVal, + 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 This wrapper function is called by + * FAPI_PLAT_CLEAR_NON_CONST_ATTR_OVERRIDE to clear a non-const attribute + * override. + * + * This wrapper just invokes clearNonConstOverride on the AttributeOverrides + * singleton in the local (plat) module, it is needed because Singletons cannot + * be accessed outside of a module (this results in a duplicate singleton) + * + * @param[in] i_attrId Attribute ID + * @param[in] i_pTarget Pointer to Target (NULL if system) + */ +void clearNonConstOverrideWrap(const fapi::AttributeId i_attrId, + const fapi::Target * const i_pTarget); + +/** + * @brief This wrapper function is called by HWP unit test to set an attribute + * override. It is not called by production code (outside of unit test, + * attribute overrides are set by the FSP or by a debug tool) + * + * This wrapper just invokes setOverride on the AttributeOverrides singleton in + * the local (plat) module, it is needed because Singletons cannot be accessed + * outside of a module (this results in a duplicate singleton) + * + * @param[in] i_override Reference to override + */ +void setOverrideWrap(const AttributeOverride & i_override); + +/** + * @brief This wrapper function is called by HWP unit test to clear all + * attribute overrides. It is not called by production code (outside of + * unit test, attribute overrides are cleared by the FSP or by a debug + * tool) + * + * This wrapper just invokes clearOverrides on the AttributeOverrides singleton + * in the local (plat) module, it is needed because Singletons cannot be + * accessed outside of a module (this results in a duplicate singleton) + */ +void clearOverridesWrap(); + +/** + * @brief This wrapper function is called by HWP unit test to test if any + * attribute overrides exist. It is not called by production code. + * + * This wrapper just invokes overridesExist on the AttributeOverrides singleton + * in the local (plat) module, it is needed because Singletons cannot be + * accessed outside of a module (this results in a duplicate singleton) + */ +bool overridesExistWrap(); + +/** + * @brief This function template is called by the FAPI_PLAT_GET_ATTR_OVERRIDE + * macro to get any override for a 1D array attribute + * + * @param[in] i_attrId Attribute ID + * @param[in] i_pTarget Pointer to Target (NULL if system) + * @param[out] o_1dArray Reference to 1D array where override will be copied to + * @return bool True if override was returned + */ +template <typename T, uint8_t SZ1> +bool getOverrideT(const fapi::AttributeId i_attrId, + const fapi::Target * const i_pTarget, + T(&o_1dArray)[SZ1]) +{ + uint64_t l_overrideVal = 0; + + for (uint8_t d1 = 0; d1 < SZ1; d1++) + { + if (!(getOverrideWrap(i_attrId, i_pTarget, l_overrideVal, d1))) + { + // For array attributes, all elements must be overridden + return false; + } + else + { + // Standard conversion converts uint64_t to attribute type + o_1dArray[d1] = l_overrideVal; + } + } + + return true; +} + +/** + * @brief This function template is called by the FAPI_PLAT_GET_ATTR_OVERRIDE + * macro to get any override for a 2D array attribute + * + * @param[in] i_attrId Attribute ID + * @param[in] i_pTarget Pointer to Target (NULL if system) + * @param[out] o_2dArray Reference to 2D array where override will be copied to + * @return bool True if override was returned + */ +template <typename T, uint8_t SZ1, uint8_t SZ2> +bool getOverrideT(const fapi::AttributeId i_attrId, + const fapi::Target * const i_pTarget, + T(&o_2dArray)[SZ1][SZ2]) +{ + uint64_t l_overrideVal = 0; + + for (uint8_t d1 = 0; d1 < SZ1; d1++) + { + for (uint8_t d2 = 0; d2 < SZ2; d2++) + { + if (!(getOverrideWrap(i_attrId, i_pTarget, l_overrideVal, 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_overrideVal; + } + } + } + + return true; +} + +/** + * @brief This function template is called by the FAPI_PLAT_GET_ATTR_OVERRIDE + * macro to get any override for a 3D array attribute + * + * @param[in] i_attrId Attribute ID + * @param[in] i_pTarget Pointer to Target (NULL if system) + * @param[out] o_3dArray Reference to 3D array where override will be copied to + * @return bool True if override was returned + */ +template <typename T, uint8_t SZ1, uint8_t SZ2, uint8_t SZ3> +bool getOverrideT(const fapi::AttributeId i_attrId, + const fapi::Target * const i_pTarget, + T(&o_3dArray)[SZ1][SZ2][SZ3]) +{ + uint64_t l_overrideVal = 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 (!(getOverrideWrap(i_attrId, i_pTarget, l_overrideVal, 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_overrideVal; + } + } + } + } + + return true; +} + +/** + * @brief This function template is called by the FAPI_PLAT_GET_ATTR_OVERRIDE + * macro to get any override for a 4D array attribute + * + * @param[in] i_attrId Attribute ID + * @param[in] i_pTarget Pointer to Target (NULL if system) + * @param[out] o_4dArray Reference to 4D array where override 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 getOverrideT(const fapi::AttributeId i_attrId, + const fapi::Target * const i_pTarget, + T(&o_4dArray)[SZ1][SZ2][SZ3][SZ4]) +{ + uint64_t l_overrideVal = 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 (!(getOverrideWrap(i_attrId, i_pTarget, l_overrideVal, + 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_overrideVal; + } + } + } + } + } + + return true; } +/** + * @brief This function template is called by the FAPI_PLAT_GET_ATTR_OVERRIDE + * macro to get any override for a non-array attribute + * + * @param[in] i_attrId Attribute ID + * @param[in] i_pTarget Pointer to Target (NULL if system) + * @param[out] o_val Reference to variable where override will be copied to + * @return bool True if override was returned + */ +template <typename T> +bool getOverrideT(const fapi::AttributeId i_attrId, + const fapi::Target * const i_pTarget, + T & o_val) +{ + uint64_t l_overrideVal = 0; + + if (!(getOverrideWrap(i_attrId, i_pTarget, l_overrideVal))) + { + return false; + } + + o_val = static_cast<T>(l_overrideVal); + return true; } +} // namespace platAttrSvc + +} // namespace fapi + +/** + * @brief Macro that returns any attribute override + */ +#define FAPI_PLAT_GET_ATTR_OVERRIDE(ID, PTARGET, VAL) \ + fapi::platAttrSvc::getOverrideT(ID, PTARGET, VAL) + +/** + * @brief Macro that clears any non-const attribute override + */ +#define FAPI_PLAT_CLEAR_NON_CONST_ATTR_OVERRIDE(ID, PTARGET) \ + fapi::platAttrSvc::clearNonConstOverrideWrap(ID, PTARGET) + /** * @brief Macro which directly maps a FAPI request to get a platform * attribute to the equivalent host boot request @@ -315,4 +597,10 @@ fapi::ReturnCode fapiPlatGetFunctional(const fapi::Target * i_pTarget, #define ATTR_FUNCTIONAL_GETMACRO(ID, PTARGET, VAL) \ fapi::platAttrSvc::fapiPlatGetFunctional(PTARGET, VAL) +//------------------------------------------------------------------------------ +// MACRO to route ATTR_POS access to the correct Hostboot function +//------------------------------------------------------------------------------ +#define ATTR_POS_GETMACRO(ID, PTARGET, VAL) \ + fapi::platAttrSvc::fapiPlatGetTargetPos(PTARGET, VAL) + #endif // FAPIPLATATTRIBUTESERVICE_H_ diff --git a/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H b/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H index 883ed2783..d1c6b0b7a 100644 --- a/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H +++ b/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H @@ -53,6 +53,7 @@ namespace fapi MOD_EDI_EI_IO_RUN_TRAINING = 0x0D, MOD_THREAD_ACTIVATE = 0x0E, //@fixme RTC:42816 MOD_ATTR_GET_FUNCTIONAL = 0x0F, + MOD_ATTR_GET_HB_TARGET = 0x10, }; /** @@ -82,6 +83,9 @@ namespace fapi RC_NO_MASTER_CORE_TARGET = HWPF_COMP_ID | 0x1C, RC_THREAD_IN_WRONG_STATE = HWPF_COMP_ID | 0x1D, //@fixme RTC:42816 RC_THREAD_DID_NOT_START = HWPF_COMP_ID | 0x1E, //@fixme RTC:42816 + RC_NULL_FAPI_TARGET = HWPF_COMP_ID | 0x1F, + RC_UNEXPECTED_TARGET_TYPE = HWPF_COMP_ID | 0x20, + RC_ATTR_UNKNOWN_TARGET_NAME = HWPF_COMP_ID | 0x21, }; /** |