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/hwpf/fapi/fapiAttributeService.H | |
| 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/hwpf/fapi/fapiAttributeService.H')
| -rw-r--r-- | src/include/usr/hwpf/fapi/fapiAttributeService.H | 33 |
1 files changed, 31 insertions, 2 deletions
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_ |

