summaryrefslogtreecommitdiffstats
path: root/src/include/usr/hwpf/fapi/fapiAttributeService.H
diff options
context:
space:
mode:
authorMike Jones <mjjones@us.ibm.com>2012-06-25 13:35:13 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-07-12 16:28:33 -0500
commit3b9899c9969d46d2faddca8f3d35fa5074e3097c (patch)
tree3d09c14357dbf175b79a3892fb88b592d86874b6 /src/include/usr/hwpf/fapi/fapiAttributeService.H
parentd40d08c719c845213844323ead282a748486d466 (diff)
downloadtalos-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/hwpf/fapi/fapiAttributeService.H')
-rw-r--r--src/include/usr/hwpf/fapi/fapiAttributeService.H103
1 files changed, 65 insertions, 38 deletions
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
OpenPOWER on IntegriCloud