diff options
Diffstat (limited to 'src/include/usr/hwpf/fapi')
| -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 |
4 files changed, 105 insertions, 3 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, |

