summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorMike Jones <mjjones@us.ibm.com>2011-08-12 11:03:30 -0500
committerNicholas E. Bofferding <bofferdn@us.ibm.com>2011-08-19 15:08:51 -0500
commit2935ed01dae82a91c1bb4c181fd36cc42b2efaf9 (patch)
treeedbde05a7cf666342b704b2eb069e6dfbcbd96c5 /src/include
parent02991f3ecb7356dc989148710e7ca40df0f7437c (diff)
downloadtalos-hostboot-2935ed01dae82a91c1bb4c181fd36cc42b2efaf9.tar.gz
talos-hostboot-2935ed01dae82a91c1bb4c181fd36cc42b2efaf9.zip
HWPF Error Info Support
Change-Id: Ib060599a4b64e768cbc75184a050e851c0a39c4e Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/250 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com> Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/usr/hbotcompid.H7
-rw-r--r--src/include/usr/hwpf/fapi/fapi.H12
-rw-r--r--src/include/usr/hwpf/fapi/fapiCollectFfdc.H50
-rw-r--r--src/include/usr/hwpf/fapi/fapiErrorInfo.H223
-rw-r--r--src/include/usr/hwpf/fapi/fapiErrorInfoMem.H87
-rw-r--r--src/include/usr/hwpf/fapi/fapiHwpExecutor.H26
-rw-r--r--src/include/usr/hwpf/fapi/fapiReturnCode.H117
-rw-r--r--src/include/usr/hwpf/fapi/fapiReturnCodeDataRef.H139
-rw-r--r--src/include/usr/hwpf/fapi/fapiReturnCodes.H2
-rw-r--r--src/include/usr/hwpf/hwp/fapiFfdcHwpData.H32
-rw-r--r--src/include/usr/hwpf/hwp/fapiTestHwp.H17
-rwxr-xr-xsrc/include/usr/hwpf/hwp/fapiTestHwpAttr.H4
-rw-r--r--src/include/usr/hwpf/hwp/fapiTestHwpError.H36
-rw-r--r--src/include/usr/hwpf/hwp/fapiTestHwpFfdc.H39
-rw-r--r--src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H16
-rw-r--r--src/include/usr/hwpf/plat/fapiPlatHwpInvoker.H11
-rw-r--r--src/include/usr/hwpf/plat/fapiPlatReasonCodes.H20
17 files changed, 755 insertions, 83 deletions
diff --git a/src/include/usr/hbotcompid.H b/src/include/usr/hbotcompid.H
index fb75595e3..f5dca7529 100644
--- a/src/include/usr/hbotcompid.H
+++ b/src/include/usr/hbotcompid.H
@@ -91,6 +91,13 @@ const char I2C_COMP_NAME[] = "i2c";
//@{
const compId_t VFS_COMP_ID = 0x0800;
const char VFS_COMP_NAME[] = "vfs";
+
+/** @name HWPF
+ * HW Procedure Framework component
+ */
+//@{
+const compId_t HWPF_COMP_ID = 0x0900;
+const char HWPF_COMP_NAME[] = "hwpf";
//@}
#endif
diff --git a/src/include/usr/hwpf/fapi/fapi.H b/src/include/usr/hwpf/fapi/fapi.H
index cc2066990..a801ba026 100644
--- a/src/include/usr/hwpf/fapi/fapi.H
+++ b/src/include/usr/hwpf/fapi/fapi.H
@@ -4,6 +4,16 @@
* @brief Includes all the header files necessary for the FAPI interface.
*/
+/*
+ * Change Log ******************************************************************
+ * Flag Defect/Feature User Date Description
+ * ------ -------------- ---------- ----------- ----------------------------
+ * mjjones 04/13/2011 Created.
+ * mjjones 06/07/2011 Added new includes.
+ * mjjones 08/08/2011 Updated Executor include
+ *
+ */
+
#ifndef FAPI_H_
#define FAPI_H_
@@ -13,7 +23,7 @@
#include <fapiHwAccess.H>
#include <fapiSystemConfig.H>
#include <fapiPlatTrace.H>
-#include <fapiPlatHwpExecutor.H>
+#include <fapiHwpExecutor.H>
#include <fapiAttributeService.H>
#include <fapiHwpReturnCodes.H> // Generated file
#include <fapiAttributeIds.H> // Generated file
diff --git a/src/include/usr/hwpf/fapi/fapiCollectFfdc.H b/src/include/usr/hwpf/fapi/fapiCollectFfdc.H
new file mode 100644
index 000000000..ccee96a93
--- /dev/null
+++ b/src/include/usr/hwpf/fapi/fapiCollectFfdc.H
@@ -0,0 +1,50 @@
+/**
+ * @file fapiCollectFfdc.H
+ *
+ * @brief Defines the fapiCollectFfdc function
+ */
+
+/*
+ * Change Log ******************************************************************
+ * Flag Defect/Feature User Date Description
+ * ------ -------------- ---------- ----------- ----------------------------
+ * mjjones 08/09/2011 Created.
+ */
+
+#ifndef FAPICOLLECTFFDC_H_
+#define FAPICOLLECTFFDC_H_
+
+#include <stdint.h>
+#include <fapiReturnCode.H>
+
+namespace fapi
+{
+
+/**
+ * @brief Collect FFDC
+ *
+ * Collect FFDC. This function should be called by PLAT when it is processing
+ * a ReturnCode generated by a HWP and the ErrorInfoRepository contains a record
+ * for the error indicating that FFDC should be collected. This function is
+ * implemented in the generated fapiCollectFfdc.C file (generated using data
+ * from the Error Information XML file)
+ *
+ * @param[in] i_token FFDC HWP token (retrieved from ErrorInfoRepository)
+ * @param[in] i_target Reference to Target to collect FFDC from
+ * @param[out] o_pFfdc Reference to uint8_t pointer. Set to point to a newly
+ * allocated array containing FFDC data
+ * @param[out] o_size Reference to uint32_t. Set to the size of the FFDC
+ * data
+ *
+ * @return ReturnCode
+ *
+ * @note Caller must delete the data with "delete [] o_pFfdc"
+ */
+ReturnCode fapiCollectFfdc(const FfdcHwpToken i_token,
+ const Target & i_target,
+ uint8_t * & o_pFfdc,
+ uint32_t & o_size);
+
+}
+
+#endif // FAPICOLLECTFFDC_H_
diff --git a/src/include/usr/hwpf/fapi/fapiErrorInfo.H b/src/include/usr/hwpf/fapi/fapiErrorInfo.H
new file mode 100644
index 000000000..808a0c0e3
--- /dev/null
+++ b/src/include/usr/hwpf/fapi/fapiErrorInfo.H
@@ -0,0 +1,223 @@
+/**
+ * @file fapiErrorInfo.H
+ *
+ * @brief Defines the ErrorInfoRepository, ErrorInfoRecord and associated
+ * classes.
+ */
+
+/*
+ * Change Log ******************************************************************
+ * Flag Defect/Feature User Date Description
+ * ------ -------------- ---------- ----------- ----------------------------
+ * mjjones 08/09/2011 Created.
+ */
+
+#ifndef FAPIERRORINFO_H_
+#define FAPIERRORINFO_H_
+
+#include <stdint.h>
+#include <fapiTarget.H>
+#include <fapiReturnCode.H>
+#include <fapiHwpReturnCodes.H>
+#include <vector>
+
+namespace fapi
+{
+
+/**
+ * @enum CalloutPriority
+ *
+ * This enumeration defines the possible callout priorities
+ */
+enum CalloutPriority
+{
+ HIGH = 1,
+ MEDIUM = 2,
+ LOW = 3,
+};
+
+/**
+ * @struct ErrorInfoCallout
+ *
+ * This struct defines a target callout. An ErrorInfoRecord can contain a number
+ * of these.
+ */
+struct ErrorInfoCallout
+{
+ /**
+ * @brief Constructor.
+ *
+ * @param[in] i_targetType The type of the target being called out. If the
+ * same as the target of the HWP that generated the
+ * error then that is the target
+ * @param[in] i_targetPos The position of the target being called out.
+ * Relative to the target of the HWP that generated
+ * the error
+ * @param[in] i_priority The priority of the callout
+ */
+ ErrorInfoCallout(const TargetType i_targetType,
+ const uint32_t i_targetPos,
+ const CalloutPriority i_priority);
+
+ // The type of the target being called out. See ctor for details
+ TargetType iv_targetType;
+
+ // The position of the target being called out. See ctor for details
+ uint32_t iv_targetPos;
+
+ // The priority of the callout
+ CalloutPriority iv_priority;
+};
+
+/**
+ * @struct ErrorInfoFfdc
+ *
+ * This struct defines FFDC collection information. An ErrorInfoRecord can
+ * contain a number of these.
+ */
+struct ErrorInfoFfdc
+{
+ /**
+ * @brief Constructor.
+ *
+ * @param[in] i_targetType The type of the target to collect FFDC from. If
+ * the same as the target of the HWP that
+ * generated the error then that is the target
+ * @param[in] i_targetPos The position of the target to collect FFDC
+ * from. Relative to the target of the HWP that
+ * generated the error
+ * @param[in] i_ffdcHwpToken The token used to identify the HWP to call to
+ * collect FFDC
+ */
+ ErrorInfoFfdc(const TargetType i_targetType,
+ const uint32_t i_targetPos,
+ const FfdcHwpToken i_ffdcHwpToken);
+
+ // The type of the target to collect FFDC from. See ctor for details
+ TargetType iv_targetType;
+
+ // The position of the target to collect FFDC from. See ctor for details
+ uint32_t iv_targetPos;
+
+ // The token used to identify the HWP to call to collect FFDC
+ FfdcHwpToken iv_ffdcHwpToken;
+};
+
+/**
+ * @struct ErrorInfoRecord
+ *
+ * This struct defines the error information record. This gives information
+ * about a specific HWP generated ReturnCode value.
+ */
+struct ErrorInfoRecord
+{
+ /**
+ * @brief Default constructor.
+ */
+ ErrorInfoRecord();
+
+ /**
+ * @brief Copy constructor.
+ *
+ * @param[in] i_right Reference to ErrorInfoRecord to copy
+ */
+ ErrorInfoRecord(const ErrorInfoRecord & i_right);
+
+ /**
+ * @brief Destructor
+ */
+ ~ErrorInfoRecord();
+
+ /**
+ * @brief Assignment operator
+ *
+ * @param[in] i_right Reference to ErrorInfoRecord to copy
+ *
+ * @return Reference to 'this' ErrorInfoRecord
+ */
+ ErrorInfoRecord & operator=(const ErrorInfoRecord & i_right);
+
+ /**
+ * @brief Set Description function
+ *
+ * @param[in] i_pDesc Pointer to C string that is copied
+ */
+ void setDescription(const char * i_pDescription);
+
+ /**
+ * @brief Get Description function
+ *
+ * @return pointer to description (NULL if no description set)
+ */
+ const char * getDescription();
+
+ // The Return Code value
+ uint32_t iv_rc;
+
+ // Vector of target callouts
+ std::vector<ErrorInfoCallout> iv_callouts;
+ typedef std::vector<ErrorInfoCallout>::iterator ErrorInfoCalloutItr_t;
+
+ // Vector of FFDC collection information
+ std::vector<ErrorInfoFfdc> iv_ffdcs;
+ typedef std::vector<ErrorInfoFfdc>::iterator ErrorInfoFfdcItr_t;
+
+private:
+ // C-String containing the description of the error
+ char * iv_pDescription;
+};
+
+/**
+ * @class ErrorInfoRepository
+ *
+ * This class defines the error information repository. It provides an
+ * ErrorInfoRecord given a ReturnCode value. This is an abstract class that a
+ * concrete class must derive from.
+ */
+class ErrorInfoRepository
+{
+public:
+
+ /**
+ * @brief Get the singleton instance.
+ *
+ * This function must be implemented by a concrete derived class
+ */
+ static ErrorInfoRepository& Instance();
+
+ /**
+ * @brief Default constructor.
+ */
+ ErrorInfoRepository();
+
+ /**
+ * @brief Destructor
+ */
+ virtual ~ErrorInfoRepository();
+
+ /**
+ * @brief Find Error Information Record for given ReturnCode value
+ *
+ * This is a pure virtual function that must be implemented by a concrete
+ * derived class
+ *
+ * @param[in] i_rc The ReturnCode value. User can pass in a ReturnCode
+ * object and it will be implicitly converted to a
+ * uint32_t using the ReturnCode conversion operator
+ * @param[out] o_record Reference to a ErrorInfoRecord. If the record is
+ * found then it is assigned to o_record, else it is
+ * not. User should pass an ErrorInfoRecord with a good
+ * ReturnCode value and then look to see if the value
+ * was changed to the ReturnCode value to figure out if
+ * the record was found.
+ *
+ * @return ReturnCode. Zero on success else error accessing the repository
+ */
+ virtual ReturnCode find(const uint32_t i_rc,
+ ErrorInfoRecord & o_record) = 0;
+
+};
+
+}
+
+#endif // FAPIERRORINFO_H_
diff --git a/src/include/usr/hwpf/fapi/fapiErrorInfoMem.H b/src/include/usr/hwpf/fapi/fapiErrorInfoMem.H
new file mode 100644
index 000000000..e30111687
--- /dev/null
+++ b/src/include/usr/hwpf/fapi/fapiErrorInfoMem.H
@@ -0,0 +1,87 @@
+/**
+ * @file fapiErrorInfoMem.H
+ *
+ * @brief Defines the ErrorInfoRepositoryMem class.
+ *
+ * ErrorInfoRepositoryMem is a concrete Error Info repository that stores
+ * ErrorInfoRecords in heap based memory. A particular platform may choose to
+ * implement a different repository (in which case it would not compile this
+ * file)
+ */
+
+/*
+ * Change Log ******************************************************************
+ * Flag Defect/Feature User Date Description
+ * ------ -------------- ---------- ----------- ----------------------------
+ * mjjones 08/08/2011 Created.
+ */
+
+#ifndef FAPIERRORINFOMEM_H_
+#define FAPIERRORINFOMEM_H_
+
+#include <stdint.h>
+#include <fapiReturnCode.H>
+#include <fapiErrorInfo.H>
+#include <vector>
+
+namespace fapi
+{
+
+/**
+ * @class ErrorInfoRepositoryMem
+ *
+ * This class defines a concrete error information repository. ErrorInfoRecords
+ * are stored in heap based memory.
+ */
+class ErrorInfoRepositoryMem : public ErrorInfoRepository
+{
+public:
+
+ /**
+ * @brief Default constructor.
+ */
+ ErrorInfoRepositoryMem();
+
+ /**
+ * @brief Destructor
+ */
+ virtual ~ErrorInfoRepositoryMem();
+
+ /**
+ * @brief Find Error Information Record for given ReturnCode value
+ *
+ * Implementation of pure virtual function in base ErrorInfoRepository class
+ *
+ * @param[in] i_rc The ReturnCode value. User can pass in a ReturnCode
+ * object and it will be implicitly converted to a
+ * uint32_t using the ReturnCode conversion operator
+ * @param[out] o_record Reference to a ErrorInfoRecord. If the record is
+ * found then it is assigned to o_record, else it is
+ * not. User should pass an ErrorInfoRecord with a good
+ * ReturnCode value and then look to see if the value
+ * was changed to the ReturnCode value to figure out if
+ * the record was found.
+ *
+ * @return ReturnCode. Always success.
+ */
+ virtual ReturnCode find(const uint32_t i_rc,
+ ErrorInfoRecord & o_record);
+
+private:
+
+ /**
+ * @brief Initialize the repository with ErrorInfoRecords
+ *
+ * This function is implemented in the generated fapiErrorInfoMemInit.C file
+ * (generated using data from the Error Information XML file)
+ */
+ void init();
+
+ // Vector of ErrorInfoRecords
+ std::vector<ErrorInfoRecord> iv_errorInfoRecords;
+ typedef std::vector<ErrorInfoRecord>::iterator ErrorInfoRecordItr_t;
+};
+
+}
+
+#endif // FAPIERRORINFOMEM_H_
diff --git a/src/include/usr/hwpf/fapi/fapiHwpExecutor.H b/src/include/usr/hwpf/fapi/fapiHwpExecutor.H
new file mode 100644
index 000000000..d10e8f4a3
--- /dev/null
+++ b/src/include/usr/hwpf/fapi/fapiHwpExecutor.H
@@ -0,0 +1,26 @@
+/**
+ * @file fapiHwpExecutor.H
+ *
+ * @brief Defines the FAPI HWP Executor Macro.
+ *
+ * The FAPI HWP Executor macro is called when a PLAT invoker function or a HWP
+ * wants to execute a HWP.
+ */
+
+#ifndef FAPIHWPEXECUTOR_H_
+#define FAPIHWPEXECUTOR_H_
+
+#include <fapiPlatHwpExecutor.H>
+
+/**
+ * @brief HWP Executor macro
+ *
+ * This macro calls a PLAT macro which will do any platform specific work to
+ * execute the HWP (e.g. dlopening a shared library) and then calls a function
+ * on the ReturnCode to store the error target if there is an error
+ */
+#define FAPI_EXEC_HWP(RC, FUNC, TARGET, _args_...) \
+ FAPI_PLAT_EXEC_HWP(RC, FUNC, TARGET, ##_args_); \
+ RC.setErrTarget(TARGET)
+
+#endif // FAPIHWPEXECUTOR_H_
diff --git a/src/include/usr/hwpf/fapi/fapiReturnCode.H b/src/include/usr/hwpf/fapi/fapiReturnCode.H
index d7e35b772..7d0511f77 100644
--- a/src/include/usr/hwpf/fapi/fapiReturnCode.H
+++ b/src/include/usr/hwpf/fapi/fapiReturnCode.H
@@ -9,7 +9,9 @@
* Flag Defect/Feature User Date Description
* ------ -------------- ---------- ----------- ----------------------------
* mjjones 04/13/2011 Created.
- * mjjones 07/05/2011. Removed const from data
+ * mjjones 07/05/2011 Removed const from data
+ * mjjones 07/25/2011 Added support for FFDC and
+ * Error Target
*/
#ifndef FAPIRETURNCODE_H_
@@ -17,13 +19,15 @@
#include <stdint.h>
#include <stddef.h>
+#include <fapiTarget.H>
#include <fapiReturnCodes.H>
namespace fapi
{
-// Forward declaration
-class ReturnCodeDataRef;
+// Forward declarations
+class ReturnCodePlatDataRef;
+class ReturnCodeHwpFfdcRef;
/**
* @class ReturnCode
@@ -32,17 +36,19 @@ class ReturnCodeDataRef;
* code value) which is of type uint32_t. A user can treat a ReturnCode just
* as if it were a uint32_t.
*
- * FAPI, PLAT and HWP code can all create a ReturnCode. PLAT can optionally add
- * platform specific ReturnCodeData to it.
+ * FAPI, PLAT and HWP code can all create a ReturnCode.
+ * PLAT can associate PlatData to it (use-case is an error log).
+ * HWP can add HwpFfdc to it.
+ * FAPI can add an error target to it (use-case is to record which target was
+ * the subject of a HWP that generated an error)
*
* A ReturnCode is copyable and assignable. Therefore, it cannot be subclassed.
*
- * When a ReturnCode is copied, any ReturnCodeData is not copied because it may
- * be heavyweight. Both ReturnCodes will refer to the same ReturnCodeData.
- * ReturnCodeData is only deleted when the last ReturnCode with a reference to
- * it is deleted. It is possible for PLAT to get a pointer to the ReturnCodeData
- * and to optionally release the data (ReturnCode no longer responsible for
- * deleting). This is done using the intermediate ReturnCodeDataRef class.
+ * When a ReturnCode is copied, any PlatData or HwpFfdc is not copied because it
+ * may be heavyweight. Both ReturnCodes will refer to the same data. Data is
+ * only deleted when the last ReturnCode with a reference to it is deleted. It
+ * is possible for PLAT to get a pointer to the PlatData and to optionally
+ * release the data (ReturnCode no longer responsible for deleting).
*
* A ReturnCode object is not thread safe, multiple threads must not use the
* same ReturnCode object concurrently.
@@ -126,35 +132,59 @@ public:
operator uint32_t() const;
/**
- * @brief Get a pointer to any ReturnCodeData. ReturnCode is still
- * responsible for deletion of the data. The caller must not delete
+ * @brief Get a pointer to any PlatData. ReturnCode is still responsible for
+ * deletion of the data. The caller must not delete
*
- * The data pointed to is only meaningful to platform code.
+ * The data pointed to is only meaningful to platform code. The data pointer
+ * should be used immediately in the same thread because it may be deleted
+ * in the future.
*
- * @return void *. Pointer to any ReturnCodeData. If NULL then no data
+ * @return void *. Pointer to any PlatData. If NULL then no data
*/
- void * getData() const;
+ void * getPlatData() const;
/**
- * @brief Get a pointer to any ReturnCodeData and release ownership from
+ * @brief Get a pointer to any PlatData and release ownership from
* ReturnCode. The caller is responsible for deletion.
*
* The data pointed to is only meaningful to platform code.
*
- * @return void *. Pointer to any ReturnCodeData. If NULL then no data
+ * @return void *. Pointer to any PlatData. If NULL then no data
*/
- void * releaseData();
+ void * releasePlatData();
/**
- * @brief Sets ReturnCodeData. The ReturnCode object takes responsibility
- * for deleting the data (platform code actually implements the
- * delete function and must know the type and how to delete it).
+ * @brief Associates heap based PlatData with the ReturnCode. The ReturnCode
+ * object takes responsibility for deleting the data (platform code
+ * actually implements the delete function and must know the type and
+ * how to delete it).
*
- * The data pointed to is only meaningful to platform code.
+ * The data pointed to is only meaningful to platform code. This is expected
+ * to be used to associate a platform error log with the ReturnCode.
*
- * param[in] i_pData Pointer to ReturnCodeData (on the heap)
+ * param[in] i_pData Pointer to PlatData (on the heap)
*/
- void setData(void * i_pData);
+ void setPlatData(void * i_pData);
+
+ /**
+ * @brief Get a pointer to any stored HwpFfdc.
+ *
+ * The data pointer should be used immediately in the same thread because it
+ * is a pointer to internal object data.
+ *
+ * param[out] o_size Size of the FFDC data in bytes.
+ *
+ * @return void *. Pointer to any HwpFfdc. If NULL then no data
+ */
+ const void * getHwpFfdc(uint32_t & o_size) const;
+
+ /**
+ * @brief Stores a copy of the provided HwpFfdc
+ *
+ * param[in] i_pFfdc Pointer to HwpFfdc
+ * param[in] i_size Size of the FFDC data in bytes
+ */
+ void setHwpFfdc(const void * i_pFfdc, const uint32_t i_size);
/**
* @brief Gets the creator of the return code
@@ -163,18 +193,47 @@ public:
*/
returnCodeCreator getCreator() const;
+ /**
+ * @brief Stores a copy of the provided Target if there is an error and no
+ * Target is already stored
+ *
+ * This is intended to be used by FAPI_EXEC_HWP to record which target was
+ * the subject of a HWP that generated an error.
+ *
+ * param[in] i_target Reference to Target
+ */
+ void setErrTarget(const Target & i_target);
+
+ /**
+ * @brief Gets the error target
+ *
+ * @return Target *. Pointer to Target. If NULL then no error Target
+ */
+ Target * getErrTarget() const;
+
private:
/**
- * @brief Removes interest in pointed to ReturnCodeDataRef
+ * @brief Removes interest in pointed to ReturnCodePlatDataRef
+ */
+ void removePlatData();
+
+ /**
+ * @brief Removes interest in pointed to ReturnCodeHwpFfdcRef
*/
- void removeData();
+ void removeHwpFfdc();
// The rcValue
uint32_t iv_rcValue;
- // Pointer to ReturnCodeDataRef
- ReturnCodeDataRef * iv_pDataRef;
+ // Pointer to ReturnCodePlatDataRef
+ ReturnCodePlatDataRef * iv_pPlatDataRef;
+
+ // Pointer to ReturnCodeHwpFfdcRef
+ ReturnCodeHwpFfdcRef * iv_pHwpFfdcRef;
+
+ // Pointer to error Target
+ Target * iv_pErrTarget;
};
}
diff --git a/src/include/usr/hwpf/fapi/fapiReturnCodeDataRef.H b/src/include/usr/hwpf/fapi/fapiReturnCodeDataRef.H
index 855191b95..65f2f5f50 100644
--- a/src/include/usr/hwpf/fapi/fapiReturnCodeDataRef.H
+++ b/src/include/usr/hwpf/fapi/fapiReturnCodeDataRef.H
@@ -11,6 +11,7 @@
* ------ -------------- ---------- ----------- ----------------------------
* mjjones 04/13/2011 Created.
* mjjones 07/05/2011. Removed const from data
+ * mjjones 07/25/2011 Added support for FFDC
*/
#ifndef FAPIRETURNCODEDATAREF_H_
@@ -25,15 +26,9 @@ namespace fapi
/**
* @class ReturnCodeDataRef
*
- * This class contains a pointer to platform specific ReturnCodeData and a
- * reference count recording how many ReturnCodes have a pointer to itself.
- *
- * It is used exclusively by the ReturnCode class. Multiple copies of a
- * ReturnCode will all point to the same ReturnCodeDataRef. The ReturnCodes
- * maintain the reference count, the last ReturnCode to remove its reference
- * will delete the ReturnCodeDataRef which in turn deletes the ReturnCodeData.
- * The ReturnCodeData pointer is maintained in this class so that releasing the
- * data releases it from all ReturnCode copies.
+ * This class is a simple reference counter. Derived classes are used by a
+ * ReturnCode object in order to maintain a count of how many ReturnCode objects
+ * have a reference to the object.
*
* A ReturnCodeDataRef object is not thread safe, multiple threads must not use
* the same ReturnCodeDataRef object concurrently.
@@ -44,15 +39,13 @@ public:
/**
* @brief Constructor
- *
- * @param[in] i_pData Pointer to platform specific ReturnCodeData
*/
- explicit ReturnCodeDataRef(void * i_pData);
+ ReturnCodeDataRef();
/**
* @brief Destructor
*/
- ~ReturnCodeDataRef();
+ virtual ~ReturnCodeDataRef();
/**
* @brief Increments the ref count
@@ -66,49 +59,143 @@ public:
*/
bool decRefCountCheckZero();
+private:
+
+ // Copy constructor and assignment operator disabled
+ ReturnCodeDataRef(const ReturnCodeDataRef & i_right);
+ ReturnCodeDataRef & operator=(const ReturnCodeDataRef & i_right);
+
+ // The reference count (how many ReturnCodes are pointing to this object)
+ uint32_t iv_refCount;
+};
+
+/**
+ * @class ReturnCodePlatDataRef
+ *
+ * This class contains a pointer to PlatData and inherits from ReturnCodeDataRef
+ * for a reference count recording how many ReturnCodes have a pointer to it.
+ *
+ * It is used exclusively by the ReturnCode class. Multiple copies of a
+ * ReturnCode will all point to the same ReturnCodePlatDataRef. The ReturnCodes
+ * maintain the reference count, the last ReturnCode to remove its reference
+ * will delete the ReturnCodePlatDataRef which in turn deletes the PlatData.
+ * The PlatData pointer is maintained in this class so that releasing the data
+ * releases it from all ReturnCode copies.
+ *
+ * A ReturnCodePlatDataRef object is not thread safe, multiple threads must not
+ * use the same ReturnCodePlatDataRef object concurrently.
+ */
+class ReturnCodePlatDataRef : public ReturnCodeDataRef
+{
+public:
+
/**
- * @brief Get a pointer to ReturnCodeData. ReturnCodeDataRef is still
+ * @brief Constructor
+ *
+ * @param[in] i_pData Pointer to PlatData to associate
+ */
+ explicit ReturnCodePlatDataRef(void * i_pData);
+
+ /**
+ * @brief Destructor
+ */
+ virtual ~ReturnCodePlatDataRef();
+
+ /**
+ * @brief Get a pointer to any PlatData. ReturnCodePlatDataRef is still
* responsible for deletion of the data. The caller must not delete
*
* The pointer is only meaningful to platform code.
*
- * @return void *. Pointer to ReturnCodeData. If NULL then no data (must
- * have been released)
+ * @return void *. Pointer to PlatData. If NULL then no data (must have been
+ * released)
*/
void * getData() const;
/**
- * @brief Get a pointer to any ReturnCodeData and release ownership from
+ * @brief Get a pointer to any PlatData and release ownership from
* ReturnCodeDataRef. The caller is responsible for deletion.
*
* The pointer is only meaningful to platform code.
*
- * @return void *. Pointer to ReturnCodeData. If NULL then no data (must
- * have been released)
+ * @return void *. Pointer to PlatData. If NULL then no data (must have been
+ * released)
*/
void * releaseData();
private:
// Copy constructor and assignment operator disabled
- ReturnCodeDataRef(const ReturnCodeDataRef & i_right);
- ReturnCodeDataRef & operator=(const ReturnCodeDataRef & i_right);
+ ReturnCodePlatDataRef(const ReturnCodePlatDataRef & i_right);
+ ReturnCodePlatDataRef & operator=(const ReturnCodePlatDataRef & i_right);
/**
- * @brief Deletes the ReturnCodeData
+ * @brief Deletes the PlatData
*
* @note Implemented by platform code because only platform code knows the
* type of the data and how to delete it.
*/
void deleteData();
- // The reference count (how many ReturnCodes are pointing to this object)
- uint32_t iv_refCount;
-
- // Pointer to platform specific ReturnCodeData
+ // Pointer to PlatData
void * iv_pData;
};
+/**
+ * @class ReturnCodeHwpFfdcRef
+ *
+ * This class contains HwpFfdc and inherits from ReturnCodeDataRef for a
+ * reference count recording how many ReturnCodes have a pointer to it.
+ *
+ * It is used exclusively by the ReturnCode class. Multiple copies of a
+ * ReturnCode will all point to the same ReturnCodeHwpFfdcRef. The ReturnCodes
+ * maintain the reference count, the last ReturnCode to remove its reference
+ * will delete the ReturnCodeHwpFfdcRef which in turn deletes the contained
+ * HwpFfdc.
+ *
+ * A ReturnCodeHwpFfdcRef object is not thread safe, multiple threads must not
+ * use the same ReturnCodeHwpFfdcRef object concurrently.
+ */
+class ReturnCodeHwpFfdcRef : public ReturnCodeDataRef
+{
+public:
+
+ /**
+ * @brief Constructor
+ *
+ * @param[in] i_pFfdc Pointer to the FFDC to copy
+ * @param[in] i_size Size of the FFDC to copy
+ */
+ ReturnCodeHwpFfdcRef(const void * i_pFfdc,
+ const uint32_t i_size);
+
+ /**
+ * @brief Destructor
+ */
+ virtual ~ReturnCodeHwpFfdcRef();
+
+ /**
+ * @brief Get a pointer to the HwpFfdc.
+ *
+ * @param[out] o_size Size of the FFDC data in bytes.
+ *
+ * @return void *. Pointer to HwpFfdc.
+ */
+ const void * getData(uint32_t & o_size) const;
+
+private:
+
+ // Copy constructor and assignment operator disabled
+ ReturnCodeHwpFfdcRef(const ReturnCodeHwpFfdcRef & i_right);
+ ReturnCodeHwpFfdcRef & operator=(const ReturnCodeHwpFfdcRef & i_right);
+
+ // Pointer to HwpFfdc
+ uint8_t * iv_pFfdc;
+
+ // Size of HwpFfdc
+ uint32_t iv_size;
+};
+
}
#endif // FAPIRETURNCODEDATAREF_H_
diff --git a/src/include/usr/hwpf/fapi/fapiReturnCodes.H b/src/include/usr/hwpf/fapi/fapiReturnCodes.H
index 2b761dbde..fd365347d 100644
--- a/src/include/usr/hwpf/fapi/fapiReturnCodes.H
+++ b/src/include/usr/hwpf/fapi/fapiReturnCodes.H
@@ -11,6 +11,7 @@
* mjjones 04/13/2011 Created.
* mjjones 06/07/2011 Add FAPI_RC_NOT_IMPLEMENTED
* mjjones 06/30/2011 Add FAPI_RC_ATTR_UNIT_TEST_FAIL
+ * mjjones 08/10/2011 Add FAPI_RC_FFDC_HWP_NOT_FOUND
*
*/
@@ -38,6 +39,7 @@ enum
// FAPI generated return codes
FAPI_RC_NOT_IMPLEMENTED = FAPI_RC_FAPI_MASK | 0x01,
FAPI_RC_ATTR_UNIT_TEST_FAIL = FAPI_RC_FAPI_MASK | 0x02,
+ FAPI_RC_FFDC_HWP_NOT_FOUND = FAPI_RC_FAPI_MASK | 0x03,
// PLAT generated return codes
FAPI_RC_PLAT_ERR_SEE_DATA = FAPI_RC_PLAT_MASK | 0x01,
diff --git a/src/include/usr/hwpf/hwp/fapiFfdcHwpData.H b/src/include/usr/hwpf/hwp/fapiFfdcHwpData.H
new file mode 100644
index 000000000..b7ed10788
--- /dev/null
+++ b/src/include/usr/hwpf/hwp/fapiFfdcHwpData.H
@@ -0,0 +1,32 @@
+/**
+ * @file fapiFfdcHwpData.H
+ *
+ * @brief Defines all FFDC data that can be returned by FFDC HWPs
+ */
+
+/*
+ * Change Log ******************************************************************
+ * Flag Defect/Feature User Date Description
+ * ------ -------------- ---------- ----------- ----------------------------
+ * mjjones 08/08/2011 Created.
+ *
+ */
+
+#ifndef FAPIFFDCHWPDATA_H_
+#define FAPIFFDCHWPDATA_H_
+
+namespace fapi
+{
+
+/**
+ * @brief An FFDC structure contining a single uint64_t of data
+ */
+struct TestFfdc1
+{
+ uint64_t iv_data;
+};
+
+}
+
+#endif // FAPIFFDCHWPDATA_H_
+
diff --git a/src/include/usr/hwpf/hwp/fapiTestHwp.H b/src/include/usr/hwpf/hwp/fapiTestHwp.H
index 4dc5a4dab..81f632361 100644
--- a/src/include/usr/hwpf/hwp/fapiTestHwp.H
+++ b/src/include/usr/hwpf/hwp/fapiTestHwp.H
@@ -10,6 +10,7 @@
* ------ -------------- ---------- ----------- ----------------------------
* mjjones 04/21/2011 Created.
* mjjones 06/28/2011 Updated comment
+ * mjjones 08/11/2011 Removed Clock HWP
*
*/
@@ -24,21 +25,9 @@ extern "C"
{
/**
- * @brief Finds if a P7 EM0 chiplet clock is on
+ * @brief A simple HWP. Can easily be modified by HW dev team for test
*
- * @param[in] i_chip Target chip
- * @param[out] o_clocksOn True if clocks are on, else false
- *
- * @return ReturnCode
- */
-fapi::ReturnCode hwpIsP7EM0ChipletClockOn(const fapi::Target & i_chip,
- bool & o_clocksOn);
-
-/**
- * @brief Run a sample test function that can be overloaded by the hw dev
- * team.
- *
- * @param[in] i_chip Target chip
+ * @param[in] i_chip Reference to target chip
*
* @return ReturnCode
*/
diff --git a/src/include/usr/hwpf/hwp/fapiTestHwpAttr.H b/src/include/usr/hwpf/hwp/fapiTestHwpAttr.H
index d24fe748e..78aca0949 100755
--- a/src/include/usr/hwpf/hwp/fapiTestHwpAttr.H
+++ b/src/include/usr/hwpf/hwp/fapiTestHwpAttr.H
@@ -24,9 +24,11 @@ extern "C"
/**
* @brief HWP that exercises attributes
*
+ * @param[in] i_target Reference to target (unused by HWP)
+ *
* @return ReturnCode
*/
-fapi::ReturnCode hwpTestAttributes();
+fapi::ReturnCode hwpTestAttributes(const fapi::Target & i_target);
} // extern "C"
diff --git a/src/include/usr/hwpf/hwp/fapiTestHwpError.H b/src/include/usr/hwpf/hwp/fapiTestHwpError.H
new file mode 100644
index 000000000..5d7954e35
--- /dev/null
+++ b/src/include/usr/hwpf/hwp/fapiTestHwpError.H
@@ -0,0 +1,36 @@
+/**
+ * @file fapiTestHwpError.H
+ *
+ * @brief Defines a simple test Hardware Procedure that returns an error
+ */
+
+/*
+ * Change Log ******************************************************************
+ * Flag Defect/Feature User Date Description
+ * ------ -------------- ---------- ----------- ----------------------------
+ * mjjones 08/08/2011 Created.
+ *
+ */
+
+#ifndef FAPITESTHWPERROR_H_
+#define FAPITESTHWPERROR_H_
+
+#include <fapi.H>
+
+// HWPs are defined as C functions because platforms may wish to package them
+// in linux shared libraries which are DL-Opened
+extern "C"
+{
+
+/**
+ * @brief Simple HWP that returns an error (RC_TEST_ERROR_A)
+ *
+ * @param[in] i_target Reference to target (unused by HWP)
+ *
+ * @return ReturnCode
+ */
+fapi::ReturnCode hwpTestError(const fapi::Target & i_target);
+
+} // extern "C"
+
+#endif // FAPITESTHWPERROR_H_
diff --git a/src/include/usr/hwpf/hwp/fapiTestHwpFfdc.H b/src/include/usr/hwpf/hwp/fapiTestHwpFfdc.H
new file mode 100644
index 000000000..e5eecc637
--- /dev/null
+++ b/src/include/usr/hwpf/hwp/fapiTestHwpFfdc.H
@@ -0,0 +1,39 @@
+/**
+ * @file fapiTestHwpFfdc.H
+ *
+ * @brief Defines a simple test Hardware Procedure that collects FFDC data
+ */
+
+/*
+ * Change Log ******************************************************************
+ * Flag Defect/Feature User Date Description
+ * ------ -------------- ---------- ----------- ----------------------------
+ * mjjones 08/08/2011 Created.
+ *
+ */
+
+#ifndef FAPITESTHWPFFDC_H_
+#define FAPITESTHWPFFDC_H_
+
+#include <fapi.H>
+#include <fapiFfdcHwpData.H>
+
+// HWPs are defined as C functions because platforms may wish to package them
+// in linux shared libraries which are DL-Opened
+extern "C"
+{
+
+/**
+ * @brief Simple FFDC HWP that collects TestFfdc1 data
+ *
+ * @param[in] i_target Reference to target (unused by HWP)
+ * @param[out] o_ffdc Reference to TestFfdc1 that is filled in with FFDC
+ *
+ * @return ReturnCode
+ */
+fapi::ReturnCode hwpTestFfdc1(const fapi::Target & i_target,
+ fapi::TestFfdc1 & o_ffdc);
+
+} // extern "C"
+
+#endif // FAPITESTHWPFFDC_H_
diff --git a/src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H b/src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H
index c2b7e5e10..2fa1ab4ee 100644
--- a/src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H
+++ b/src/include/usr/hwpf/plat/fapiPlatHwpExecutor.H
@@ -1,22 +1,28 @@
/**
* @file fapiPlatHwpExecutor.H
*
- * @brief Defines the FAPI HWP Executor Macro.
+ * @brief Defines the FAPI PLAT HWP Executor Macro.
*
- * The HWP Executor macro is called when a PLAT invoker function or a HWP wants
- * to execute a HWP. Each platform can modify the macro to do any platform
- * specific work to execute the HWP (e.g. dlopening a shared library)
+ * The PLAT HWP Executor macro is called by the FAPI HWP Executor macro when a
+ * PLAT invoker function or a HWP wants to execute a HWP. Each platform can
+ * modify the macro to do any platform specific work to execute the HWP (e.g.
+ * dlopening a shared library)
*/
#ifndef FAPIPLATHWPEXECUTOR_H_
#define FAPIPLATHWPEXECUTOR_H_
+#include <fapiTestHwp.H>
+#include <fapiTestHwpError.H>
+#include <fapiTestHwpFfdc.H>
+
/**
* @brief HWP Executor macro
*
* By default, this macro just calls the HWP directly. If this cannot be done
* then the platform needs to modify
*/
-#define FAPI_EXEC_HWP(RC, FUNC, _args_...) RC = FUNC(_args_)
+#define FAPI_PLAT_EXEC_HWP(RC, FUNC, TARGET, _args_...) \
+ RC = FUNC(TARGET, ##_args_)
#endif // FAPIPLATHWPEXECUTOR_H_
diff --git a/src/include/usr/hwpf/plat/fapiPlatHwpInvoker.H b/src/include/usr/hwpf/plat/fapiPlatHwpInvoker.H
index 287f97c11..41d088cf1 100644
--- a/src/include/usr/hwpf/plat/fapiPlatHwpInvoker.H
+++ b/src/include/usr/hwpf/plat/fapiPlatHwpInvoker.H
@@ -19,21 +19,18 @@ namespace fapi
{
/**
- * @brief Invokes hwpIsP7EM0ChipletClockOn procedure
+ * @brief Invokes hwpInitialTest procedure
*
* @param[in] i_target Pointer to Chip
- * @param[out] o_clocksOn True if EM0 clocks are on, else false
*/
-errlHndl_t invokeHwpIsP7EM0ChipletClockOn(TARGETING::Target* i_target,
- bool & o_clocksOn);
+errlHndl_t invokeHwpInitialTest(TARGETING::Target* i_target);
/**
- * @brief Invokes hwpInitialTest procedure
+ * @brief Invokes hwpTestError procedure
*
* @param[in] i_target Pointer to Chip
*/
-errlHndl_t invokeHwpInitialTest(TARGETING::Target* i_target);
-
+errlHndl_t invokeHwpTestError(TARGETING::Target* i_target);
}
diff --git a/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H b/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H
new file mode 100644
index 000000000..a2305f8f4
--- /dev/null
+++ b/src/include/usr/hwpf/plat/fapiPlatReasonCodes.H
@@ -0,0 +1,20 @@
+#ifndef FAPIPLATREASONCODES_H_
+#define FAPIPLATREASONCODES_H_
+
+#include <hbotcompid.H>
+
+namespace fapi
+{
+ enum hwpfModuleId
+ {
+ MOD_RC_TO_ERRL = 0x01,
+ };
+
+ enum hwpfReasonCode
+ {
+ RC_HWP_ERROR = HWPF_COMP_ID | 0x01,
+ RC_FAPI_ERROR = HWPF_COMP_ID | 0x02,
+ };
+};
+
+#endif
OpenPOWER on IntegriCloud