summaryrefslogtreecommitdiffstats
path: root/hwpf/include
diff options
context:
space:
mode:
authorSantosh Puranik <santosh.puranik@in.ibm.com>2015-11-24 05:57:48 -0600
committerGregory S. Still <stillgs@us.ibm.com>2015-12-07 07:30:04 -0600
commit6c83004785b99fa088369ee7835e913fe9403ccb (patch)
tree777f35fe0d49046859bd1a833f6e037edad7680d /hwpf/include
parent96658ed12b4187865f353248916101e1aaf814f8 (diff)
downloadtalos-sbe-6c83004785b99fa088369ee7835e913fe9403ccb.tar.gz
talos-sbe-6c83004785b99fa088369ee7835e913fe9403ccb.zip
Some changes for the new compiler
-- Compile out FFDC code that relies on std::shared_ptr and std::pair -- Define some type traits used in FAPI2 -- Remove stdio.h inclusion from plat code Change-Id: I5a9e156f654c87c54d26f2e4c99b924285cf981a Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/22297 Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com> Tested-by: Jenkins Server Reviewed-by: Gregory S. Still <stillgs@us.ibm.com>
Diffstat (limited to 'hwpf/include')
-rw-r--r--hwpf/include/error_info.H654
-rw-r--r--hwpf/include/error_info_defs.H2
-rw-r--r--hwpf/include/ffdc.H191
-rw-r--r--hwpf/include/plat/hwp_executor.H35
-rw-r--r--hwpf/include/plat/plat_trace.H5
-rw-r--r--hwpf/include/plat/target.H1
6 files changed, 866 insertions, 22 deletions
diff --git a/hwpf/include/error_info.H b/hwpf/include/error_info.H
new file mode 100644
index 00000000..b9be3f42
--- /dev/null
+++ b/hwpf/include/error_info.H
@@ -0,0 +1,654 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2011,2015 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+///
+/// @file error_info.H
+/// @brief Defines the Error Information structures and classes
+///
+
+#ifndef FAPI2_ERRORINFO_H_
+#define FAPI2_ERRORINFO_H_
+
+#include <stdint.h>
+//#include <memory>
+#include <vector>
+#include <target.H>
+#include <error_info_defs.H>
+
+namespace fapi2
+{
+ // forward fapi2::Assert()
+ extern void Assert(bool);
+
+#ifndef FAPI2_NO_FFDC
+ ///
+ /// @class ErrorInfoFfdc
+ ///
+ /// This class contains a copy of some FFDC data
+ ///
+ class ErrorInfoFfdc
+ {
+ public:
+ ///
+ /// @brief Constructor
+ ///
+ /// @param[in] i_ffdcId FFDC Identifier (used to decode FFDC)
+ /// @param[in] i_pFfdc Pointer to the FFDC to copy
+ /// @param[in] i_size Size of the FFDC to copy
+ ///
+ ErrorInfoFfdc(const uint32_t i_ffdcId,
+ const void* i_pFfdc,
+ const uint32_t i_size);
+
+ ///
+ /// @brief Get a pointer to the FfdcData
+ ///
+ /// @param[out] o_size Reference to uint32_t that is filled in with
+ /// the FFDC size
+ ///
+ /// @return void *. Pointer to the FFDC
+ ///
+ inline const void* getData(uint32_t & o_size) const
+ {
+ o_size = iv_size;
+ return iv_pFfdc.get();
+ }
+
+ ///
+ /// @brief Get a pointer to the FfdcData
+ /// @return void *. Pointer to the FFDC
+ ///
+ inline void* getData(void) const
+ { return iv_pFfdc.get(); }
+
+ ///
+ /// @brief Get the FFDC Identifier
+ ///
+ /// @return uint32_t The FFDC Identifier
+ ///
+ inline uint32_t getFfdcId(void)
+ { return iv_ffdcId; }
+
+#ifdef FAPI_CUSTOM_MALLOC
+ ///
+ /// @brief Overload new operator to use platform-specific allocator
+ ///
+ /// @param[in] i_sz Size of memory to allocate in bytes
+ ///
+ /// @return Pointer to allocated memory
+ ///
+ static void* operator new(size_t i_sz);
+
+ ///
+ /// @brief Overload delete operator to use platform-specific deallocator
+ ///
+ /// @param[in] i_ptr Pointer to memory previously allocated with new
+ ///
+ static void operator delete(void* i_ptr);
+#endif
+
+ private:
+
+ // FFDC Identifier
+ uint32_t iv_ffdcId;
+
+ // Pointer to the FFDC
+ std::shared_ptr<uint8_t> iv_pFfdc;
+
+ // Size of the FFDC
+ uint32_t iv_size;
+
+ // Disabled
+ ErrorInfoFfdc(const ErrorInfoFfdc &) = delete;
+ ErrorInfoFfdc & operator=(const ErrorInfoFfdc &) = delete;
+ };
+
+ ///
+ /// @struct ErrorInfoHwCallout
+ ///
+ /// This struct contains hardware to callout
+ ///
+ struct ErrorInfoHwCallout
+ {
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_hw Hardware to callout
+ /// @param[in] i_calloutPriority Priority of callout
+ /// @param[in] i_refTarget Reference to reference target
+ ///
+ ErrorInfoHwCallout(
+ const HwCallouts::HwCallout i_hw,
+ const CalloutPriorities::CalloutPriority i_calloutPriority,
+ const Target<TARGET_TYPE_ALL> & i_refTarget);
+
+#ifdef FAPI_CUSTOM_MALLOC
+ ///
+ /// @brief Overload new operator to use platform-specific allocator
+ ///
+ /// @param[in] i_sz Size of memory to allocate in bytes
+ ///
+ /// @return Pointer to allocated memory
+ ///
+ static void* operator new(size_t i_sz);
+
+ ///
+ /// @brief Overload delete operator to use platform-specific deallocator
+ ///
+ /// @param[in] i_ptr Pointer to memory previously allocated with new
+ ///
+ static void operator delete(void* i_ptr);
+#endif
+
+ // The hw to callout
+ HwCallouts::HwCallout iv_hw;
+
+ // The callout priority
+ CalloutPriorities::CalloutPriority iv_calloutPriority;
+
+ // The reference target (needed for some HW callouts to identify what to
+ // callout). The target handle is NULL if there is no reference target.
+ Target<TARGET_TYPE_ALL> iv_refTarget;
+ };
+
+ ///
+ /// @struct ErrorInfoProcedureCallout
+ ///
+ /// This struct contains a procedure to callout
+ ///
+ struct ErrorInfoProcedureCallout
+ {
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_procedure Procedure to callout
+ /// @param[in] i_calloutPriority Priority of callout
+ ///
+ ErrorInfoProcedureCallout(
+ const ProcedureCallouts::ProcedureCallout i_procedure,
+ const CalloutPriorities::CalloutPriority i_calloutPriority);
+
+#ifdef FAPI_CUSTOM_MALLOC
+ ///
+ /// @brief Overload new operator to use platform-specific allocator
+ ///
+ /// @param[in] i_sz Size of memory to allocate in bytes
+ ///
+ /// @return Pointer to allocated memory
+ ///
+ static void* operator new(size_t i_sz);
+
+ ///
+ /// @brief Overload delete operator to use platform-specific deallocator
+ ///
+ /// @param[in] i_ptr Pointer to memory previously allocated with new
+ ///
+ static void operator delete(void* i_ptr);
+#endif
+
+ // The procedure to callout
+ ProcedureCallouts::ProcedureCallout iv_procedure;
+
+ // The callout priority
+ CalloutPriorities::CalloutPriority iv_calloutPriority;
+ };
+
+ ///
+ /// @struct ErrorInfoBusCallout
+ ///
+ /// This struct contains a bus to callout
+ ///
+ struct ErrorInfoBusCallout
+ {
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_target1 Reference to target on one end of the bus
+ /// @param[in] i_target2 Reference to target on other end of the bus
+ /// @param[in] i_calloutPriority Priority of callout
+ ///
+ ErrorInfoBusCallout(
+ const Target<TARGET_TYPE_ALL> & i_target1,
+ const Target<TARGET_TYPE_ALL> & i_target2,
+ const CalloutPriorities::CalloutPriority i_calloutPriority);
+
+#ifdef FAPI_CUSTOM_MALLOC
+ ///
+ /// @brief Overload new operator to use platform-specific allocator
+ ///
+ /// @param[in] i_sz Size of memory to allocate in bytes
+ ///
+ /// @return Pointer to allocated memory
+ ///
+ static void* operator new(size_t i_sz);
+
+ ///
+ /// @brief Overload delete operator to use platform-specific deallocator
+ ///
+ /// @param[in] i_ptr Pointer to memory previously allocated with new
+ ///
+ static void operator delete(void* i_ptr);
+#endif
+
+ // The targets on each end of the bus to callout
+ Target<TARGET_TYPE_ALL> iv_target1;
+ Target<TARGET_TYPE_ALL> iv_target2;
+
+ // The callout priority
+ CalloutPriorities::CalloutPriority iv_calloutPriority;
+ };
+
+ ///
+ /// @struct ErrorInfoCDG
+ ///
+ /// This struct contains a target to callout/deconfigure/GARD
+ ///
+ struct ErrorInfoCDG
+ {
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_target Reference to the target to c/d/g
+ /// @param[in] i_callout True if Target should be called out
+ /// @param[in] i_deconfigure True if Target should be deconfigured
+ /// @param[in] i_gard True if Target should be GARDed
+ /// @param[in] i_priority The priority of any callout
+ ///
+ ErrorInfoCDG(const Target<TARGET_TYPE_ALL> & i_target,
+ const bool i_callout,
+ const bool i_deconfigure,
+ const bool i_gard,
+ const CalloutPriorities::CalloutPriority i_priority);
+
+#ifdef FAPI_CUSTOM_MALLOC
+ ///
+ /// @brief Overload new operator to use platform-specific allocator
+ ///
+ /// @param[in] i_sz Size of memory to allocate in bytes
+ ///
+ /// @return Pointer to allocated memory
+ ///
+ static void* operator new(size_t i_sz);
+
+ ///
+ /// @brief Overload delete operator to use platform-specific deallocator
+ ///
+ /// @param[in] i_ptr Pointer to memory previously allocated with new
+ ///
+ static void operator delete(void* i_ptr);
+#endif
+
+ // The target to callout/deconfigure/GARD
+ Target<TARGET_TYPE_ALL> iv_target;
+
+ // Callout Information
+ bool iv_callout;
+ CalloutPriorities::CalloutPriority iv_calloutPriority;
+
+ // Deconfigure Information
+ bool iv_deconfigure;
+
+ // GARD Information
+ bool iv_gard;
+ };
+
+ ///
+ /// @struct ErrorInfoChildrenCDG
+ ///
+ /// This struct contains children targets to callout/deconfigure/GARD
+ ///
+ /// Children by containment can be CDG (chiplets belonging to a parent chip)
+ /// e.g.
+ /// - PROC_CHIP -> EX_CHIPLET
+ /// - MEMBUF_CHIP -> MBA_CHIPLET
+ /// Children by affinity can be CDG.
+ /// Any from PROC_CHIP->MCS_CHIPLET->MEMBUF_CHIP->MBA_CHIPLET->DIMM e.g.
+ /// - PROC_CHIP->MEMBUF_CHIP
+ /// - MEMBUF_CHIP->DIMM
+ /// - MBA_CHIPLET->DIMM
+ /// Port and Number criteria can be applied to the child target as
+ /// detailed in the constructor
+ ///
+ struct ErrorInfoChildrenCDG
+ {
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_parent Reference to the parent target
+ /// @oaram[in] i_childType Child target type to c/d/g
+ /// @param[in] i_callout True if Target should be called out
+ /// @param[in] i_deconfigure True if Target should be deconfigured
+ /// @param[in] i_gard True if Target should be GARDed
+ /// @param[in] i_priority The priority of any callout
+ /// @param[in] i_childPort Child Port
+ /// For DIMM children, the MBA port number
+ /// @param[in] i_childNum Child Number
+ /// For DIMM children, the dimm socket number
+ /// For Chip children, the chip position
+ /// For Chiplet children, the chiplet unit pos
+ ///
+ ErrorInfoChildrenCDG(const Target<TARGET_TYPE_ALL> & i_parentChip,
+ const TargetType i_childType,
+ const bool i_callout,
+ const bool i_deconfigure,
+ const bool i_gard,
+ const CalloutPriorities::CalloutPriority i_priority,
+ const uint8_t i_childPort, const uint8_t i_childNum);
+
+#ifdef FAPI_CUSTOM_MALLOC
+ ///
+ /// @brief Overload new operator to use platform-specific allocator
+ ///
+ /// @param[in] i_sz Size of memory to allocate in bytes
+ ///
+ /// @return Pointer to allocated memory
+ ///
+ static void* operator new(size_t i_sz);
+
+ ///
+ /// @brief Overload delete operator to use platform-specific deallocator
+ ///
+ /// @param[in] i_ptr Pointer to memory previously allocated with new
+ ///
+ static void operator delete(void* i_ptr);
+#endif
+
+ // The parent chip
+ Target<TARGET_TYPE_ALL> iv_parent;
+
+ // The child target types to c/d/g
+ TargetType iv_childType;
+
+ // Callout Information
+ bool iv_callout;
+ CalloutPriorities::CalloutPriority iv_calloutPriority;
+
+ // Deconfigure Information
+ bool iv_deconfigure;
+
+ // GARD Information
+ bool iv_gard;
+
+ // Child Port
+ static const uint8_t ALL_CHILD_PORTS = 0xff;
+ uint8_t iv_childPort;
+
+ // Child Number
+ static const uint8_t ALL_CHILD_NUMBERS = 0xff;
+ uint8_t iv_childNumber;
+ };
+
+ ///
+ /// @struct ErrorInfoCollectTrace
+ ///
+ /// This struct contains trace ID to add to the error log
+ ///
+ struct ErrorInfoCollectTrace
+ {
+ ///
+ /// @brief Constructor.
+ ///
+ /// @param[in] i_trace
+ ///
+ ErrorInfoCollectTrace(CollectTraces::CollectTrace i_traceId);
+
+
+#ifdef FAPI_CUSTOM_MALLOC
+ ///
+ /// @brief Overload new operator to use platform-specific allocator
+ ///
+ /// @param[in] i_sz Size of memory to allocate in bytes
+ ///
+ /// @return Pointer to allocated memory
+ ///
+ static void* operator new(size_t i_sz);
+
+ ///
+ /// @brief Overload delete operator to use platform-specific deallocator
+ ///
+ /// @param[in] i_ptr Pointer to memory previously allocated with new
+ ///
+ static void operator delete(void* i_ptr);
+#endif
+
+ // trace
+ CollectTraces::CollectTrace iv_eiTraceId;
+ };
+
+ ///
+ /// @struct ErrorInfo
+ ///
+ /// This struct defines the error information associated with a fapi2::ffdc
+ /// Users are allowed to access the data directly
+ ///
+ struct ErrorInfo
+ {
+
+#ifdef FAPI_CUSTOM_MALLOC
+ ///
+ /// @brief Overload new operator to use platform-specific allocator
+ ///
+ /// @param[in] i_sz Size of memory to allocate in bytes
+ ///
+ /// @return Pointer to allocated memory
+ ///
+ static void* operator new(size_t i_sz);
+
+ ///
+ /// @brief Overload delete operator to use platform-specific deallocator
+ ///
+ /// @param[in] i_ptr Pointer to memory previously allocated with new
+ ///
+ static void operator delete(void* i_ptr);
+#endif
+
+ // Vector of FFDC Data
+ std::vector<std::shared_ptr<ErrorInfoFfdc> > iv_ffdcs;
+
+ // Vector of Hardware to callout
+ std::vector<std::shared_ptr<ErrorInfoHwCallout> > iv_hwCallouts;
+
+ // Vector of procedures to callout
+ std::vector<std::shared_ptr<ErrorInfoProcedureCallout> >
+ iv_procedureCallouts;
+
+ // Vector of buses to callout
+ std::vector<std::shared_ptr<ErrorInfoBusCallout> > iv_busCallouts;
+
+ // Vector of targets to callout/deconfigure/GARD
+ std::vector<std::shared_ptr<ErrorInfoCDG> > iv_CDGs;
+
+ // Vector of children targets to callout/deconfigure/GARD
+ std::vector<std::shared_ptr<ErrorInfoChildrenCDG> > iv_childrenCDGs;
+
+ // Vector of traces to collect
+ std::vector<std::shared_ptr<ErrorInfoCollectTrace> > iv_traces;
+ };
+
+ ///
+ /// @brief Structure representing a single ErrorInfo entry.
+ ///
+ /// An array of these is passed to the addErrorInfo function when a HWP
+ /// generates an error by calling the FAPI_SET_HWP_ERROR macro
+ // Why aren't these inherited classes? Saves on allocation overhead.
+ // We create an array of ErrorInfoEntries as automatics when we start
+ // FFDC collection. If we did this as inherited classes it would either
+ // be allocating and deallocating or we'd need to allocate an array of
+ // the largest and map each struct in to it. That's messy to do without
+ // unions (that's what they're for) so we do it like this. The inherited
+ // model would result in a jump table anyway, so we're basically doing
+ // all of that by hand to avoid the mess.
+ //
+ struct ErrorInfoEntryFfdc
+ {
+ uint8_t iv_ffdcObjIndex;
+ uint16_t iv_ffdcSize;
+ uint32_t iv_ffdcId;
+ void addErrorInfo(std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const;
+ };
+
+ ///
+ /// @brief Structure representing a hardware callout
+ ///
+ struct ErrorInfoEntryHwCallout
+ {
+ uint8_t iv_hw;
+ uint8_t iv_calloutPriority;
+ uint8_t iv_refObjIndex;
+ void addErrorInfo(std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const;
+ };
+
+ ///
+ /// @brief Structure representing a procedure callout
+ ///
+ struct ErrorInfoEntryProcCallout
+ {
+ uint8_t iv_procedure;
+ uint8_t iv_calloutPriority;
+ void addErrorInfo(std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const;
+
+ ErrorInfoEntryProcCallout(uint8_t i_procedure, uint8_t i_calloutPriority):
+ iv_procedure(i_procedure),
+ iv_calloutPriority(i_calloutPriority)
+ {}
+
+ ErrorInfoEntryProcCallout(void) = default;
+ };
+
+ ///
+ /// @brief Structure representing a bus callout
+ ///
+ struct ErrorInfoEntryBusCallout
+ {
+ uint8_t iv_endpoint1ObjIndex;
+ uint8_t iv_endpoint2ObjIndex;
+ uint8_t iv_calloutPriority;
+ void addErrorInfo(std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const;
+ };
+
+ ///
+ /// @brief Structure representing a target callout
+ ///
+ struct ErrorInfoEntryTargetCDG
+ {
+ uint8_t iv_targetObjIndex;
+ uint8_t iv_callout;
+ uint8_t iv_deconfigure;
+ uint8_t iv_gard;
+ uint8_t iv_calloutPriority;
+ void addErrorInfo(std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const;
+ };
+
+ ///
+ /// @brief Structure representing a child callout
+ ///
+ struct ErrorInfoEntryChildrenCDG
+ {
+ uint8_t iv_parentObjIndex;
+ uint8_t iv_callout;
+ uint8_t iv_deconfigure;
+ uint32_t iv_childType;
+ uint8_t iv_childPort;
+ uint8_t iv_childNumber;
+ uint8_t iv_gard;
+ uint8_t iv_calloutPriority;
+ void addErrorInfo(std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const;
+ };
+
+ ///
+ /// @brief Structure representing collected trace information
+ ///
+ struct ErrorInfoEntryCollectTrace
+ {
+ uint32_t iv_eieTraceId;
+ void addErrorInfo(std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const;
+ };
+
+ ///
+ /// @brief Union of all the error info types
+ ///
+ struct ErrorInfoEntry
+ {
+ uint8_t iv_type; // Value from ErrorInfoType
+ union
+ {
+ ErrorInfoEntryFfdc ffdc;
+ ErrorInfoEntryHwCallout hw_callout;
+ ErrorInfoEntryProcCallout proc_callout;
+ ErrorInfoEntryBusCallout bus_callout;
+ ErrorInfoEntryTargetCDG target_cdg;
+ ErrorInfoEntryChildrenCDG children_cdg;
+ ErrorInfoEntryCollectTrace collect_trace;
+ };
+
+ ///
+ /// @brief Add error information to the FFDC object
+ /// @param[in] i_info a shared pointer to the error info
+ /// @param[in] i_object the list of ffdc objects being collected
+ ///
+ void addErrorInfo(std::shared_ptr<ErrorInfo> i_info,
+ const void* const* i_object) const
+ {
+ // "unhandled error info type");
+ fapi2::Assert(iv_type < EI_LAST_TYPE);
+
+ switch(iv_type)
+ {
+ case EI_TYPE_FFDC:
+ ffdc.addErrorInfo(i_info, i_object);
+ break;
+ case EI_TYPE_HW_CALLOUT:
+ hw_callout.addErrorInfo(i_info, i_object);
+ break;
+ case EI_TYPE_PROCEDURE_CALLOUT:
+ proc_callout.addErrorInfo(i_info, i_object);
+ break;
+ case EI_TYPE_BUS_CALLOUT:
+ bus_callout.addErrorInfo(i_info, i_object);
+ break;
+ case EI_TYPE_CDG:
+ target_cdg.addErrorInfo(i_info, i_object);
+ break;
+ case EI_TYPE_CHILDREN_CDG:
+ children_cdg.addErrorInfo(i_info, i_object);
+ break;
+ case EI_TYPE_COLLECT_TRACE:
+ collect_trace.addErrorInfo(i_info, i_object);
+ break;
+ };
+ return;
+ }
+ };
+#endif
+}
+
+#endif // FAPI2_ERRORINFO_H_
diff --git a/hwpf/include/error_info_defs.H b/hwpf/include/error_info_defs.H
index d7f418a2..ebeaf02f 100644
--- a/hwpf/include/error_info_defs.H
+++ b/hwpf/include/error_info_defs.H
@@ -41,6 +41,7 @@
namespace fapi2
{
+#ifndef FAPI2_NO_FFDC
///
/// @brief Type to hold the ffdc element in the ffdc class
/// Needed so that the size can be squirled away before the
@@ -65,6 +66,7 @@ namespace fapi2
private:
std::pair<const void*, int16_t> iv_value;
};
+#endif
///
/// @brief Enumeration of ErrorInfo FFDC sizes that are used to indicate a
diff --git a/hwpf/include/ffdc.H b/hwpf/include/ffdc.H
new file mode 100644
index 00000000..aa43fc0a
--- /dev/null
+++ b/hwpf/include/ffdc.H
@@ -0,0 +1,191 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2011,2014 */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+/**
+ * @file ffdc.H
+ * @brief Defines the FirstFailureData class
+ */
+
+#ifndef FAPI2_FFDC_H_
+#define FAPI2_FFDC_H_
+
+//#include <memory>
+#include <hwp_return_codes.H>
+#include <plat_trace.H>
+#include <error_info.H>
+#include <target.H>
+
+using fapi2::TARGET_TYPE_ALL;
+
+namespace fapi2
+{
+ ///
+ /// @brief Check the type of a variable
+ ///
+ /// This function can be called to check that a variable type is as expected
+ /// @note This mechanism will allow for cast ctor's which other static type
+ /// checking might not.
+ ///
+ template<typename T>
+ inline
+ void checkType(const T &) {}
+
+ class ReturnCode;
+#ifndef FAPI2_NO_FFDC
+
+ ///
+ /// @class FirstFailureData
+ ///
+ /// This class provides storage and methods for creating and manipulating
+ /// FFDC.
+ /// It is not needed on all platforms - platforms which need this class have
+ /// specified this by forcing their fapi2::ReturnCode to be a subclass of
+ /// this class.
+ ///
+ template< class R = fapi2::ReturnCode >
+ class FirstFailureData
+ {
+ public:
+
+ ///
+ /// @brief Default constructor.
+ /// @note We don't create our error info be default. It will be created
+ /// when its needed in the setHwpError() method. Note that dereferencing
+ /// the error info without will create a problem.
+ ///
+ FirstFailureData(void):
+ iv_info( nullptr )
+ {}
+
+ ///
+ /// @brief Copy Constructor
+ ///
+ /// @param[in] i_right Reference to FirstFailureData to copy
+ /// @note Generates default copy constructor - no deep pointer
+ /// copies necessary.
+ ///
+ FirstFailureData(const FirstFailureData & i_right) = default;
+
+ ///
+ /// @brief Destructor
+ ///
+ ~FirstFailureData(void) = default;
+
+ ///
+ /// @brief Assignment Operator.
+ ///
+ /// @param[in] i_right Reference to FirstFailureData to assign from.
+ /// @return Reference to 'this' FirstFailureData
+ ///
+ FirstFailureData & operator=(const FirstFailureData & i_right) = default;
+
+ ///
+ /// @brief Sets a HWP error. Sets the rcValue to the supplied value (from
+ /// the HwpFirstFailureData enumeration) and deletes any
+ /// associated data.
+ ///
+ /// HWP code must call the FAPI_SET_HWP_ERROR macro rather than this
+ /// function
+ /// directly to generate an error so that any error information is
+ /// automatically added to the FirstFailureData
+ ///
+ /// @param[in] i_rcValue Error value to set
+ ///
+ inline void _setHwpError(const fapi2::HwpReturnCode i_rcValue)
+ {
+ FAPI_ERR("_setHwpError: Creating HWP error 0x%x", i_rcValue);
+ static_cast<R*>(this)->operator=(i_rcValue);
+
+ // Forget about any associated data (this is a new error)
+ iv_info.reset(new ErrorInfo());
+ }
+
+ ///
+ /// @brief Get a pointer to any PlatData. FirstFailureData is still
+ /// responsible for deletion of the data. The caller must not
+ /// delete
+ ///
+ /// This is called by PLAT. The expected use-case is to get a pointer to
+ /// a platform error log. The data pointer should be used immediately in
+ /// the same thread.
+ ///
+ /// @return void *. Pointer to any PlatData. If NULL then no data
+ ///
+ void* getData(void) const;
+
+ ///
+ /// @brief Get a pointer to any PlatData and release ownership from
+ /// FirstFailureData. The caller is responsible for deletion.
+ ///
+ /// This is called by PLAT. The expected use-case is to retrieve a
+ /// platform error log.
+ ///
+ /// @return void*. Pointer to any PlatData. If NULL then no data
+ ///
+ void* releaseData(void);
+
+ ///
+ /// @brief Add ErrorInfo
+ ///
+ /// This is called by the FAPI_SET_HWP_ERROR and macro to add ErrorInfo
+ /// to the FirstFailureData when a HWP generates an error. The function
+ /// is designed to add all the ErrorInfo at once rather than the
+ /// FAPI_SET_HWP_ERROR macro making multiple function calls to add each
+ /// piece of ErrorInfo individually in order to minimize code size
+ ///
+ /// @param[in] i_pObjects Pointer to array of const pointers to const
+ /// objects that are referred to by ErrorInfoEntry objects
+ /// @param[in] i_pEntries Pointer to array of ErrorInfoEntry objects
+ /// defining the ErrorInfo that needs to be added
+ /// @param[in] i_count Number of ErrorInfoEntry entries
+ ///
+ void addErrorInfo(const void* const * i_pObjects,
+ const ErrorInfoEntry* i_pEntries,
+ const uint8_t i_count);
+
+ ///
+ /// @brief Get a pointer to any ErrorInfo
+ ///
+ /// This is called by PLAT to find information about an error
+ ///
+ /// @return ErrorInfo *. Pointer to any ErrorInfo. If NULL then no info
+ ///
+ inline const fapi2::ErrorInfo* getErrorInfo(void) const
+ { return iv_info.get(); }
+
+ ///
+ /// @brief Forgets about any associated data (PlatData and ErrorInfo)
+ ///
+ /// If this is the only FirstFailureData pointing to the data then the
+ /// data is deleted
+ ///
+ inline void forgetData(void)
+ { iv_info = nullptr; }
+
+ private:
+
+ // Pointer to the data
+ std::shared_ptr<ErrorInfo> iv_info;
+ };
+#endif
+}
+#endif // FAPI2_FFDC_H_
diff --git a/hwpf/include/plat/hwp_executor.H b/hwpf/include/plat/hwp_executor.H
index 5a451081..519e7de1 100644
--- a/hwpf/include/plat/hwp_executor.H
+++ b/hwpf/include/plat/hwp_executor.H
@@ -1,20 +1,20 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// fipsrefactordoc src/hwpf/plat/fapi2PlatHwpExecutor.H 1.1
-//
-// IBM CONFIDENTIAL
-//
-// OBJECT CODE ONLY SOURCE MATERIALS
-//
-// COPYRIGHT International Business Machines Corp. 2011
-// All Rights Reserved
-//
-// The source code for this program is not published or otherwise
-// divested of its trade secrets, irrespective of what has been
-// deposited with the U.S. Copyright Office.
-//
-// IBM_PROLOG_END_TAG
+// IBM_PROLOG_BEGIN_TAG
+// This is an automatically generated prolog.
+//
+// fipsrefactordoc src/hwpf/plat/fapi2PlatHwpExecutor.H 1.1
+//
+// IBM CONFIDENTIAL
+//
+// OBJECT CODE ONLY SOURCE MATERIALS
+//
+// COPYRIGHT International Business Machines Corp. 2011
+// All Rights Reserved
+//
+// The source code for this program is not published or otherwise
+// divested of its trade secrets, irrespective of what has been
+// deposited with the U.S. Copyright Office.
+//
+// IBM_PROLOG_END_TAG
/**
* @file fapi2PlatHwpExecutor.H
*
@@ -37,7 +37,6 @@
#include <return_code.H>
#include <target.H>
-#include <string>
diff --git a/hwpf/include/plat/plat_trace.H b/hwpf/include/plat/plat_trace.H
index 423ef6ea..d3d553ee 100644
--- a/hwpf/include/plat/plat_trace.H
+++ b/hwpf/include/plat/plat_trace.H
@@ -35,12 +35,11 @@
#ifndef FAPI2_PLATTRACE_H_
#define FAPI2_PLATTRACE_H_
-#include <stdio.h>
#include <stdint.h>
// @todo update these headers with extern "C" in a future commit
// or not and leave this just as it is.
-extern "C"
+extern "C"
{
#include "pk.h"
#include <pk_trace.h>
@@ -61,7 +60,7 @@ namespace fapi2
/* The following is a desirous trace entry but the second line has a
compilation issue that is unresolved
-
+
#define FAPI_TRACE(_id_, _fmt_, _args_...) \
PK_TRACE("%s: %s:%d ", _id_, __FUNCTION__, __LINE__); \
PK_TRACE(_fmt_, ##_args_);
diff --git a/hwpf/include/plat/target.H b/hwpf/include/plat/target.H
index 644a2511..12b6b566 100644
--- a/hwpf/include/plat/target.H
+++ b/hwpf/include/plat/target.H
@@ -35,7 +35,6 @@
#include <fapi2_target.H>
#include <plat_trace.H>
#include <utils.H>
-#include <stdio.h>
#include <stdint.h>
#include <vector>
OpenPOWER on IntegriCloud