diff options
-rw-r--r-- | src/include/usr/fapi2/attribute_service.H | 28 | ||||
-rw-r--r-- | src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H | 1 | ||||
-rw-r--r-- | src/usr/fapi2/attribute_service.C | 43 | ||||
-rwxr-xr-x | src/usr/targeting/common/xmltohb/attribute_types_hb.xml | 23 | ||||
-rw-r--r-- | src/usr/targeting/common/xmltohb/target_types_hb.xml | 6 |
5 files changed, 96 insertions, 5 deletions
diff --git a/src/include/usr/fapi2/attribute_service.H b/src/include/usr/fapi2/attribute_service.H index 6144524c5..2e20eec45 100644 --- a/src/include/usr/fapi2/attribute_service.H +++ b/src/include/usr/fapi2/attribute_service.H @@ -49,6 +49,7 @@ #include <devicefw/driverif.H> #include <plat_attr_override_sync.H> #include <vpd/spdenums.H> +#include <config.h> //****************************************************************************** // Interface @@ -115,7 +116,7 @@ ReturnCode getTargetingAttr(const Target<TARGET_TYPE_ALL, /// @param[in] o_pAttr Pointer to attribute where value is copied to /// @return boolean describing if it was successful /// -bool setTargetingAttrHelper(TARGETING::Target * l_pTargTarget, +bool setTargetingAttrHelper(TARGETING::Target * i_pTargTarget, const TARGETING::ATTRIBUTE_ID i_targAttrId, const uint32_t i_attrSize, void * o_pAttr); @@ -191,6 +192,19 @@ ReturnCode platGetTargetPos(const Target<TARGET_TYPE_ALL>& i_pFapiTarget, /// +/// @brief This function is called by the FAPI_ATTR_SET macro when accessing +/// an attribute that should never be set. This is used to handle config- +/// dependent cases where the attribute may need to be writable in general +/// but not in some specific cases. +/// +/// @param[in] i_pTargTarget Pointer to TARGETING Target +/// @param[in] i_fapiAttrId FAPI attribute id +/// @return fapi2::ReturnCode. FAPI2_RC_SUCCESS if success, else error code. +/// +ReturnCode platErrorOnSet( TARGETING::Target * i_pTargTarget, + const fapi2::AttributeId i_fapiAttrId ); + +/// /// @brief This function is called by the FAPI_ATTR_GET macro when getting /// ATTR_FUSED_CORE_MODE. It should not be called directly /// @@ -1666,11 +1680,23 @@ fapiToTargeting::ID, sizeof(VAL), &(VAL)) //---------------------------------------------------------------------------- // MACRO to route ATTR_FREQ_MCA_MHZ access to the correct HB function //---------------------------------------------------------------------------- + +// For Axone ATTR_FREQ_MCA_MHZ is a regular writable attribute +// For Nimbus/Cumulus ATTR_FREQ_MCA_MHZ is readonly and based on NEST +#ifndef CONFIG_AXONE + +#undef ATTR_FREQ_MCA_MHZ_GETMACRO #define ATTR_FREQ_MCA_MHZ_GETMACRO(ID, TARGET, VAL) \ AttrOverrideSync::getAttrOverrideFunc(ID, TARGET, &VAL)\ ? fapi2::ReturnCode() : \ fapi2::platAttrSvc::\ platGetFreqMcaMhz(TARGET, VAL) +#undef ATTR_FREQ_MCA_MHZ_SETMACRO +#define ATTR_FREQ_MCA_MHZ_SETMACRO(ID, TARGET, VAL) \ + AttrOverrideSync::getAttrOverrideFunc(ID, TARGET, &VAL)\ + ? fapi2::ReturnCode() : \ + fapi2::platAttrSvc::platErrorOnSet(TARGET, VAL) +#endif #endif // ATTRIBUTESERVICE_H_ diff --git a/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H b/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H index f0ae90b3a..3e1429b63 100644 --- a/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H +++ b/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H @@ -68,6 +68,7 @@ namespace fapi2 MOD_FAPI2_PLAT_GET_PROC_TEST = 0x19, MOD_FAPI2_MONITOR_FOR_FSP_MSGS = 0x1A, MOD_FAPI2_PLAT_GET_VPD_OCMB = 0x1B, + MOD_FAPI2_PLAT_ERROR_ON_SET = 0x1C, }; /** diff --git a/src/usr/fapi2/attribute_service.C b/src/usr/fapi2/attribute_service.C index 0c7442fd9..a6e998143 100644 --- a/src/usr/fapi2/attribute_service.C +++ b/src/usr/fapi2/attribute_service.C @@ -37,6 +37,7 @@ // supported HWPF attributes lists attributes handled by Hostboot #include <stdint.h> +#include <config.h> #include <return_code.H> #include <attribute_ids.H> #include <attributeenums.H> @@ -178,11 +179,11 @@ errlHndl_t getTargetingTarget(const Target<TARGET_TYPE_ALL>& i_pFapiTarget, return l_errl; } -bool getTargetingAttrHelper(TARGETING::Target * l_pTargTarget, +bool getTargetingAttrHelper(TARGETING::Target * i_pTargTarget, const TARGETING::ATTRIBUTE_ID i_targAttrId, const uint32_t i_attrSize, void * o_pAttr) { - return l_pTargTarget->_tryGetAttr(i_targAttrId, i_attrSize, o_pAttr); + return i_pTargTarget->_tryGetAttr(i_targAttrId, i_attrSize, o_pAttr); } /// @@ -466,6 +467,40 @@ ReturnCode platGetTargetPos(const Target<TARGET_TYPE_ALL>& i_pFapiTarget, } //****************************************************************************** +// fapi::platAttrSvc::platErrorOnSet function +//****************************************************************************** +ReturnCode platErrorOnSet( TARGETING::Target * i_pTargTarget, + const fapi2::AttributeId i_fapiAttrId ) +{ + // Just create an error to return back + FAPI_ERR("platErrorOnSet: Set not valid for Attribute %X on Target %.8X", + i_fapiAttrId, TARGETING::get_huid(i_pTargTarget) ); + /*@ + * @errortype + * @moduleid fapi2::MOD_FAPI2_PLAT_ERROR_ON_SET + * @reasoncode fapi2::RC_SET_ATTR_NOT_VALID + * @userdata1 Target HUID + * @userdata2 FAPI Attribute Id + * @devdesc platErrorOnSet> Set operation not valid + * @custdesc Firmware error + */ + errlHndl_t l_errl = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_UNRECOVERABLE, + fapi2::MOD_FAPI2_PLAT_ERROR_ON_SET, + fapi2::RC_SET_ATTR_NOT_VALID, + TARGETING::get_huid(i_pTargTarget), + i_fapiAttrId, + ERRORLOG::ErrlEntry::ADD_SW_CALLOUT); + l_errl->collectTrace(FAPI_TRACE_NAME); + l_errl->collectTrace(FAPI_IMP_TRACE_NAME); + + // attach our log to the fapi RC and return it + ReturnCode l_rc; + l_rc.setPlatDataPtr(reinterpret_cast<void *> (l_errl)); + return l_rc; +} + +//****************************************************************************** // fapi::platAttrSvc::platGetFusedCoreMode function //****************************************************************************** ReturnCode platGetFusedCoreMode(uint8_t & o_isFused) @@ -2652,11 +2687,12 @@ ReturnCode platGetMBvpdSlopeInterceptData( return rc; } +#ifndef CONFIG_AXONE //****************************************************************************** // fapi::platAttrSvc::platGetFreqMcaMhz function //****************************************************************************** ReturnCode platGetFreqMcaMhz(const Target<TARGET_TYPE_ALL>& i_fapiTarget, - uint32_t & o_val) + ATTR_FREQ_MCA_MHZ_Type & o_val) { // The POR config for Cumulus is to run the MC/DMI clocks directly // off of the NEST PLL in 'sync' mode. To support 'sync' mode FW @@ -2678,6 +2714,7 @@ ReturnCode platGetFreqMcaMhz(const Target<TARGET_TYPE_ALL>& i_fapiTarget, } return l_rc; } +#endif } // End platAttrSvc namespace diff --git a/src/usr/targeting/common/xmltohb/attribute_types_hb.xml b/src/usr/targeting/common/xmltohb/attribute_types_hb.xml index d5dbb659c..476eb6a9f 100755 --- a/src/usr/targeting/common/xmltohb/attribute_types_hb.xml +++ b/src/usr/targeting/common/xmltohb/attribute_types_hb.xml @@ -231,6 +231,29 @@ </attribute> <attribute> + <!-- Need to add this explicitly to handle the Axone case --> + <id>FREQ_MCA_MHZ</id> + <description> + The frequency of the memory controller channel. In synchronous mode, + this is equivalent to ATTR_FREQ_PB_MHZ. This may be independently set + per pair of memory channels if operating in asynchronous mode, + but this configuration is not anticipated. This clock drives the MCU queues, + and all the associated logic that drives the inputs to the DMI and reads + its outputs + </description> + <simpleType> + <uint32_t/> + </simpleType> + <persistency>non-volatile</persistency> + <readable/> + <writeable/> + <hwpfToHbAttrMap> + <id>ATTR_FREQ_MCA_MHZ</id> + <macro>DIRECT</macro> + </hwpfToHbAttrMap> + </attribute> + + <attribute> <id>FSI_MASTER_MUTEX</id> <description>Mutex for FSI Master Operations</description> <simpleType> diff --git a/src/usr/targeting/common/xmltohb/target_types_hb.xml b/src/usr/targeting/common/xmltohb/target_types_hb.xml index ff955cf28..bd9c7d165 100644 --- a/src/usr/targeting/common/xmltohb/target_types_hb.xml +++ b/src/usr/targeting/common/xmltohb/target_types_hb.xml @@ -273,6 +273,10 @@ <attribute> <id>FORCE_PRE_PAYLOAD_DRTM</id> </attribute> + <!-- Need to add this explicitly to handle the Axone case --> + <attribute> + <id>FREQ_MCA_MHZ</id> + </attribute> <attribute> <id>HB_EXISTING_IMAGE</id> </attribute> @@ -311,7 +315,7 @@ </attribute> <attribute> <id>OVERRIDES_ATTEMPTED_FLAG</id> - </attribute> + </attribute> <attribute> <id>PDA_CAPTURED_THREAD_REG_ARRAY_ADDR</id> </attribute> |