diff options
| author | Mike Jones <mjjones@us.ibm.com> | 2012-04-16 13:02:30 -0500 |
|---|---|---|
| committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-04-30 11:15:14 -0500 |
| commit | 9e236383304e7cf633bda1cfdafc02a5a6f90823 (patch) | |
| tree | 729a02e9d5d46792b94c583532f85f5fd24a642e /src/include/usr | |
| parent | 572584e356e561da5fab17af1bceec60d72bd58e (diff) | |
| download | blackbird-hostboot-9e236383304e7cf633bda1cfdafc02a5a6f90823.tar.gz blackbird-hostboot-9e236383304e7cf633bda1cfdafc02a5a6f90823.zip | |
HWPF: Add Chip EC Feature support
Allows Chip EC features to be specified in Attribute XML files and queried
using the standard FAPI_ATTR_GET attribute query macro. This removes the
direct querying of chip name and EC within HWPs which leads to a more data
driven approach because when a new chip EC level is released you just have
to change the XML data file to specify which features (which can be bugs)
have changed, the HWP code does not change
Change-Id: Ie464a1b58246c21ac59f0d42fe265657a3576c31
RTC: 39684
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/901
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include/usr')
| -rw-r--r-- | src/include/usr/hwpf/fapi/fapi.H | 2 | ||||
| -rw-r--r-- | src/include/usr/hwpf/fapi/fapiAttributeService.H | 33 | ||||
| -rw-r--r-- | src/include/usr/hwpf/fapi/fapiChipEcFeature.H | 69 | ||||
| -rw-r--r-- | src/include/usr/hwpf/fapi/fapiReturnCodes.H | 4 | ||||
| -rwxr-xr-x | src/include/usr/hwpf/plat/fapiPlatAttributeService.H | 132 | ||||
| -rw-r--r-- | src/include/usr/hwpf/plat/fapiPlatReasonCodes.H | 4 |
6 files changed, 182 insertions, 62 deletions
diff --git a/src/include/usr/hwpf/fapi/fapi.H b/src/include/usr/hwpf/fapi/fapi.H index a329472c8..5984c05b7 100644 --- a/src/include/usr/hwpf/fapi/fapi.H +++ b/src/include/usr/hwpf/fapi/fapi.H @@ -35,6 +35,7 @@ * mjjones 08/08/2011 Updated Executor include * mjjones 09/23/2011 Added fapiHwpErrorInfo.H * mjjones 11/10/2011 Use ecmdDataBufferBase + * mjjones 04/16/2012 Added fapiChipEcFeature.H */ #ifndef FAPI_H_ @@ -48,6 +49,7 @@ #include <fapiPlatTrace.H> #include <fapiHwpExecutor.H> #include <fapiAttributeService.H> +#include <fapiChipEcFeature.H> #include <fapiHwpReturnCodes.H> // Generated file #include <fapiHwpErrorInfo.H> // Generated file #include <fapiAttributeIds.H> // Generated file diff --git a/src/include/usr/hwpf/fapi/fapiAttributeService.H b/src/include/usr/hwpf/fapi/fapiAttributeService.H index bffe0341b..35f370c6d 100644 --- a/src/include/usr/hwpf/fapi/fapiAttributeService.H +++ b/src/include/usr/hwpf/fapi/fapiAttributeService.H @@ -39,6 +39,7 @@ * mjjones 10/13/2011 Added fapiGetInitFileAttr * camvanng 10/20/2011 Changed i_pTarget to "const" * ptr + * mjjones 04/10/2012 Support for privileged atts */ #ifndef FAPIATTRIBUTESERVICE_H_ @@ -64,18 +65,33 @@ * 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 checkIdType that will cause a + * 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. * - * The second part of these macros calls a macro named <ID>_GET/SETMACRO. This + * 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 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. */ #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)) #define FAPI_ATTR_SET(ID, PTARGET, VAL) \ (fapi::fapiCheckIdType<fapi::ID##_Type>(fapi::ID, VAL), \ + fapi::fapiFailIfPrivileged<fapi::ID##_Privileged>(), \ + 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)) +#define FAPI_ATTR_SET_PRIVILEGED(ID, PTARGET, VAL) \ + (fapi::fapiCheckIdType<fapi::ID##_Type>(fapi::ID, VAL), \ ID##_SETMACRO(ID, PTARGET, VAL)) namespace fapi @@ -119,6 +135,19 @@ ReturnCode fapiGetInitFileAttr(const AttributeId i_id, */ template<typename T> void fapiCheckIdType(AttributeId, T &) {} +/** + * @brief Fail if attribute privileged + * + * This is called by FAPI code to check at compile time that a standard FAPI + * attribute access (FAPI_ATTR_GET) is not accessing a privileged attribute + */ +class ErrorAccessingPrivilegedAttribute; +template<const bool PRIVILEGED> void fapiFailIfPrivileged() +{ + ErrorAccessingPrivilegedAttribute(); +} +template <> inline void fapiFailIfPrivileged<false>() {} + } #endif // FAPIATTRIBUTESERVICE_H_ diff --git a/src/include/usr/hwpf/fapi/fapiChipEcFeature.H b/src/include/usr/hwpf/fapi/fapiChipEcFeature.H new file mode 100644 index 000000000..66b611e1a --- /dev/null +++ b/src/include/usr/hwpf/fapi/fapiChipEcFeature.H @@ -0,0 +1,69 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/usr/hwpf/fapi/fapiChipEcFeature.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 +/** + * @file fapiChipEcFeature.H + * + * @brief Defines the fapiQueryChipEcFeature function that allows HWPs to + * query if a particular chip has a feature determined by its EC level. + * Chip EC features are specified in attribute XML files and the + * fapiQueryChipEcFeature function implementation is auto-generated. + * HWPs should not call this function directly, but should access the + * corresponding HWPF attribute using FAPI_ATTR_GET + */ + +/* + * Change Log ****************************************************************** + * Flag Defect/Feature User Date Description + * ------ -------------- ---------- ----------- ---------------------------- + * mjjones 03/26/2012 Created. + */ + +#ifndef FAPICHIPECFEATURE_H_ +#define FAPICHIPECFEATURE_H_ + +#include <stdint.h> +#include <fapiAttributeIds.H> +#include <fapiReturnCode.H> + +namespace fapi +{ + +class Target; + +/** + * @brief Queries if a Chip has a particular feature + * + * This should only be called by FAPI during the processing of a FAPI_ATTR_GET + * for a Chip EC Feature attribute + * + * @param[in] i_id Attribute ID of the Chip EC Feature + * @param[in] i_pTarget Pointer to chip target + * @param[out] o_hasFeature Set to 1 if chip has feature else 0 + * @return ReturnCode. Zero on success, else platform specified error + */ +fapi::ReturnCode fapiQueryChipEcFeature(fapi::AttributeId i_id, + fapi::Target * i_pTarget, + uint8_t & o_hasFeature); +} + +#endif diff --git a/src/include/usr/hwpf/fapi/fapiReturnCodes.H b/src/include/usr/hwpf/fapi/fapiReturnCodes.H index 011b8e814..4c18346f5 100644 --- a/src/include/usr/hwpf/fapi/fapiReturnCodes.H +++ b/src/include/usr/hwpf/fapi/fapiReturnCodes.H @@ -39,6 +39,7 @@ * mjjones 10/28/2011 Trim FAPI/PLAT errors * mjjones 11/10/2011 Use ecmdDataBufferBase * mjjones 01/13/2012 Name enumeration + * mjjones 04/16/2012 Add FAPI_RC_INVALID_CHIP_EC_FEATURE_GET */ #ifndef FAPIRETURNCODES_H_ @@ -66,7 +67,8 @@ enum ReturnCodes FAPI_RC_ECMD_MASK = ECMD_ERR_ECMD, // ECMD generated error (0x01000000) // FAPI generated return codes - FAPI_RC_INVALID_ATTR_GET = FAPI_RC_FAPI_MASK | 0x01, + FAPI_RC_INVALID_ATTR_GET = FAPI_RC_FAPI_MASK | 0x01, + FAPI_RC_INVALID_CHIP_EC_FEATURE_GET = FAPI_RC_FAPI_MASK | 0x02, // PLAT generated return codes FAPI_RC_PLAT_ERR_SEE_DATA = FAPI_RC_PLAT_MASK | 0x01, diff --git a/src/include/usr/hwpf/plat/fapiPlatAttributeService.H b/src/include/usr/hwpf/plat/fapiPlatAttributeService.H index 254dfd36e..7b35d919f 100755 --- a/src/include/usr/hwpf/plat/fapiPlatAttributeService.H +++ b/src/include/usr/hwpf/plat/fapiPlatAttributeService.H @@ -63,65 +63,41 @@ namespace fapi namespace platAttrSvc { - /** - * @brief Returns the system target - * - * @par Detailed Description: - * Returns the system target. If the target service has not been - * initialized -or- there is any failure to acquire it, the function - * will assert - * - * @return Target handle to the system target - * - * @retval !NULL An actual target handle - * @retval NULL Not possible - */ - TARGETING::Target* getSystemTarget(); - /** - * @brief Returns a fapiReturn code containing information on an attribute - * access error - * - * @param[in] i_targAttrId Platform attribute ID - * @param[in] i_fapiAttrId FAPI attribute ID which maps to the platform - * attribute ID - * @param[in] i_pFapiTarget Pointer to the FAPI target holding the - * requested attribute - * - * @return fapiReturn code containing a platform generated error log - * - * @retval FAPI_RC_PLAT_ERR_SEE_DATA (return code value) which informs - * caller there is a host boot error log attached - */ - fapi::ReturnCode createAttrAccessError( - const TARGETING::ATTRIBUTE_ID i_targAttrId, - const fapi::AttributeId i_fapiAttrId, - const fapi::Target* i_pFapiTarget); +/** + * @brief Returns the system target + * + * @par Detailed Description: + * Returns the system target. If the target service has not been + * initialized -or- there is any failure to acquire it, the function + * will assert + * + * @return Target handle to the system target + * + * @retval !NULL An actual target handle + * @retval NULL Not possible + */ +TARGETING::Target* getSystemTarget(); - /** - * @brief Macro which directly maps a FAPI request to get a platform - * attribute to the equivalent host boot request - */ - #define FAPI_PLAT_ATTR_SVC_GETMACRO_DIRECT(ID, PTARGET, VAL) \ - ( ((PTARGET > 0) ? \ - static_cast<TARGETING::Target*>( \ - static_cast<const fapi::Target*>(PTARGET)->get()) \ - : fapi::platAttrSvc::getSystemTarget())->tryGetAttr< \ - FAPI_PLAT_ATTR_SVC_MACRO_DIRECT_FAPI_##ID>(VAL)) \ - ? fapi::FAPI_RC_SUCCESS : fapi::platAttrSvc::createAttrAccessError( \ - FAPI_PLAT_ATTR_SVC_MACRO_DIRECT_FAPI_##ID,fapi::ID,PTARGET) - /** - * @brief Macro which directly maps a FAPI request to set a platform - * attribute to the equivalent host boot request - */ - #define FAPI_PLAT_ATTR_SVC_SETMACRO_DIRECT(ID, PTARGET, VAL) \ - ( ((PTARGET > 0) ? \ - static_cast<TARGETING::Target*>( \ - static_cast<const fapi::Target*>(PTARGET)->get()) \ - : fapi::platAttrSvc::getSystemTarget())->trySetAttr< \ - FAPI_PLAT_ATTR_SVC_MACRO_DIRECT_FAPI_##ID>(VAL)) \ - ? fapi::FAPI_RC_SUCCESS : fapi::platAttrSvc::createAttrAccessError( \ - FAPI_PLAT_ATTR_SVC_MACRO_DIRECT_FAPI_##ID,fapi::ID,PTARGET) +/** + * @brief Returns a fapiReturn code containing information on an attribute + * access error + * + * @param[in] i_targAttrId Platform attribute ID + * @param[in] i_fapiAttrId FAPI attribute ID which maps to the platform + * attribute ID + * @param[in] i_pFapiTarget Pointer to the FAPI target holding the + * requested attribute + * + * @return fapiReturn code containing a platform generated error log + * + * @retval FAPI_RC_PLAT_ERR_SEE_DATA (return code value) which informs + * caller there is a host boot error log attached + */ +fapi::ReturnCode createAttrAccessError( + const TARGETING::ATTRIBUTE_ID i_targAttrId, + const fapi::AttributeId i_fapiAttrId, + const fapi::Target* i_pFapiTarget); /** * @brief This function is called by the FAPI_ATTR_GET macro when accessing @@ -186,10 +162,46 @@ fapi::ReturnCode fapiPlatGetMirrorBaseAddr(const fapi::Target * i_pMcsTarget, fapi::ReturnCode fapiPlatGetDqMapping(const fapi::Target * i_pDimmTarget, uint8_t (&o_data)[DIMM_DQ_NUM_DQS]); +/** + * @brief This function is called by the FAPI_ATTR_GET macro when getting + * ATTR_NAME. It should not be called directly + * + * @param[in] i_pTarget Target pointer + * @param[out] o_name Output Name (from enum ATTR_NAME_Enum) + * @return ReturnCode. Zero on success, else platform specified error + */ +fapi::ReturnCode fapiPlatGetTargetName(const fapi::Target * i_pTarget, + uint8_t & o_name); + } } +/** + * @brief Macro which directly maps a FAPI request to get a platform + * attribute to the equivalent host boot request + */ +#define FAPI_PLAT_ATTR_SVC_GETMACRO_DIRECT(ID, PTARGET, VAL) \ + ( ((PTARGET > 0) ? \ + static_cast<TARGETING::Target*>( \ + static_cast<const fapi::Target*>(PTARGET)->get()) \ + : fapi::platAttrSvc::getSystemTarget())->tryGetAttr< \ + FAPI_PLAT_ATTR_SVC_MACRO_DIRECT_FAPI_##ID>(VAL)) \ + ? fapi::FAPI_RC_SUCCESS : fapi::platAttrSvc::createAttrAccessError( \ + FAPI_PLAT_ATTR_SVC_MACRO_DIRECT_FAPI_##ID,fapi::ID,PTARGET) +/** + * @brief Macro which directly maps a FAPI request to set a platform + * attribute to the equivalent host boot request + */ +#define FAPI_PLAT_ATTR_SVC_SETMACRO_DIRECT(ID, PTARGET, VAL) \ + ( ((PTARGET > 0) ? \ + static_cast<TARGETING::Target*>( \ + static_cast<const fapi::Target*>(PTARGET)->get()) \ + : fapi::platAttrSvc::getSystemTarget())->trySetAttr< \ + FAPI_PLAT_ATTR_SVC_MACRO_DIRECT_FAPI_##ID>(VAL)) \ + ? fapi::FAPI_RC_SUCCESS : fapi::platAttrSvc::createAttrAccessError( \ + FAPI_PLAT_ATTR_SVC_MACRO_DIRECT_FAPI_##ID,fapi::ID,PTARGET) + //------------------------------------------------------------------------------ // MACROs to route each ATTR_SPD access to the Hostboot SPD function //------------------------------------------------------------------------------ @@ -301,4 +313,10 @@ fapi::ReturnCode fapiPlatGetDqMapping(const fapi::Target * i_pDimmTarget, #define ATTR_CEN_DQ_TO_DIMM_CONN_DQ_GETMACRO(ID, PTARGET, VAL) \ fapi::platAttrSvc::fapiPlatGetDqMapping(PTARGET, VAL) +//------------------------------------------------------------------------------ +// MACRO to route ATTR_NAME access to the correct Hostboot function +//------------------------------------------------------------------------------ +#define ATTR_NAME_GETMACRO(ID, PTARGET, VAL) \ + fapi::platAttrSvc::fapiPlatGetTargetName(PTARGET, VAL) + #endif // FAPIPLATATTRIBUTESERVICE_H_ diff --git a/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H b/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H index b48d43623..f4050a4f1 100644 --- a/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H +++ b/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H @@ -47,7 +47,7 @@ namespace fapi MOD_ATTR_BASE_ADDR_GET = 0x08, MOD_ATTR_DQ_MAP_GET = 0x09, MOD_GET_CFAM_CHIP_TARGET = 0x0A, - + MOD_ATTR_GET_TARGET_NAME = 0x0B, }; /** @@ -68,7 +68,7 @@ namespace fapi RC_FAILED_TO_ACCESS_ATTRIBUTE = HWPF_COMP_ID | 0x13, RC_ECMD_OPERATION_FAILURE = HWPF_COMP_ID | 0x14, RC_CFAM_ACCESS_ON_PROC_ERR = HWPF_COMP_ID | 0x15, - RC_ATTR_BASE_BAD_PARAM = HWPF_COMP_ID | 0x16, + RC_ATTR_BAD_TARGET_PARAM = HWPF_COMP_ID | 0x16, RC_INVALID_NUM_PARENT_CHIP = HWPF_COMP_ID | 0x17, }; |

