diff options
author | Santosh Puranik <santosh.puranik@in.ibm.com> | 2016-06-09 07:52:34 -0500 |
---|---|---|
committer | Sachin Gupta <sgupta2m@in.ibm.com> | 2016-07-31 23:29:07 -0400 |
commit | 590dc5424c21b50b70d1095133e885a0f860cdda (patch) | |
tree | c483bff571c246ca5e919876bf5d49c038dfbf2b /hwpf | |
parent | bc8b0c5daeb285c95749ddb31203a8ed2994a7d3 (diff) | |
download | talos-sbe-590dc5424c21b50b70d1095133e885a0f860cdda.tar.gz talos-sbe-590dc5424c21b50b70d1095133e885a0f860cdda.zip |
Changes for local-only SBE ffdc collection
-Update parseErrorInfo.pl to only pick up
<ffdc> taged items
-Reduce class footprint to size acceptable
to sbe environment
Change-Id: Ia969ce649e9c0891d7a01de12438a626dfecb163
RTC:154307
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/25463
Reviewed-by: Santosh S. Puranik <santosh.puranik@in.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Diffstat (limited to 'hwpf')
-rw-r--r-- | hwpf/include/error_info.H | 935 | ||||
-rw-r--r-- | hwpf/include/error_info_defs.H | 472 | ||||
-rw-r--r-- | hwpf/include/ffdc.H | 165 | ||||
-rw-r--r-- | hwpf/include/return_code.H | 12 |
4 files changed, 770 insertions, 814 deletions
diff --git a/hwpf/include/error_info.H b/hwpf/include/error_info.H index b9be3f42..433eab75 100644 --- a/hwpf/include/error_info.H +++ b/hwpf/include/error_info.H @@ -1,11 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: $ */ +/* $Source: hwpf/include/error_info.H $ */ /* */ -/* OpenPOWER HostBoot Project */ +/* OpenPOWER sbe Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* Contributors Listed Below - COPYRIGHT 2015,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -32,24 +32,46 @@ #define FAPI2_ERRORINFO_H_ #include <stdint.h> -//#include <memory> +#ifndef __PPE__ +#include <memory> +#endif #include <vector> #include <target.H> #include <error_info_defs.H> namespace fapi2 { - // forward fapi2::Assert() - extern void Assert(bool); +#if defined(MINIMUM_FFDC) -#ifndef FAPI2_NO_FFDC - /// - /// @class ErrorInfoFfdc - /// - /// This class contains a copy of some FFDC data - /// - class ErrorInfoFfdc - { +// convert generic type to uint64_t +template<typename T> +inline uint64_t convertType( T& i_value ) +{ + // for simplicity sake, all FFDC chunks from the SBE + // are going to be sent as a uint64_t + return static_cast<uint64_t>(i_value); +}; + +// convert platform target handle to a uint64_t +template<fapi2::TargetType T> +inline uint64_t convertType( const fapi2::Target<T>& i_value) +{ + // get the SBE platform target handle + return static_cast<uint64_t>(i_value.get().value); +}; +#endif + +#if !defined(FAPI2_NO_FFDC) && !defined(MINIMUM_FFDC) +// forward fapi2::Assert() +extern void Assert(bool); + +/// +/// @class ErrorInfoFfdc +/// +/// This class contains a copy of some FFDC data +/// +class ErrorInfoFfdc +{ public: /// /// @brief Constructor @@ -70,18 +92,20 @@ namespace fapi2 /// /// @return void *. Pointer to the FFDC /// - inline const void* getData(uint32_t & o_size) const - { - o_size = iv_size; - return iv_pFfdc.get(); - } + 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(); } + { + return iv_pFfdc.get(); + } /// /// @brief Get the FFDC Identifier @@ -89,7 +113,9 @@ namespace fapi2 /// @return uint32_t The FFDC Identifier /// inline uint32_t getFfdcId(void) - { return iv_ffdcId; } + { + return iv_ffdcId; + } #ifdef FAPI_CUSTOM_MALLOC /// @@ -121,534 +147,539 @@ namespace fapi2 uint32_t iv_size; // Disabled - ErrorInfoFfdc(const ErrorInfoFfdc &) = delete; - ErrorInfoFfdc & operator=(const ErrorInfoFfdc &) = delete; - }; + ErrorInfoFfdc(const ErrorInfoFfdc&) = delete; + ErrorInfoFfdc& operator=(const ErrorInfoFfdc&) = delete; +}; +/// +/// @struct ErrorInfoHwCallout +/// +/// This struct contains hardware to callout +/// +struct ErrorInfoHwCallout +{ /// - /// @struct ErrorInfoHwCallout + /// @brief Constructor. /// - /// This struct contains hardware to callout + /// @param[in] i_hw Hardware to callout + /// @param[in] i_calloutPriority Priority of callout + /// @param[in] i_refTarget Reference to reference target /// - 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); + 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 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); + /// + /// @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 hw to callout + HwCallouts::HwCallout iv_hw; - // The callout priority - CalloutPriorities::CalloutPriority iv_calloutPriority; + // 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; - }; + // 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 +{ /// - /// @struct ErrorInfoProcedureCallout + /// @brief Constructor. /// - /// This struct contains a procedure to callout + /// @param[in] i_procedure Procedure to callout + /// @param[in] i_calloutPriority Priority of 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); + 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 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); + /// + /// @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 procedure to callout + ProcedureCallouts::ProcedureCallout iv_procedure; - // The callout priority - CalloutPriorities::CalloutPriority iv_calloutPriority; - }; + // The callout priority + CalloutPriorities::CalloutPriority iv_calloutPriority; +}; +/// +/// @struct ErrorInfoBusCallout +/// +/// This struct contains a bus to callout +/// +struct ErrorInfoBusCallout +{ /// - /// @struct ErrorInfoBusCallout + /// @brief Constructor. /// - /// This struct contains a bus to callout + /// @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 /// - 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); + 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 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); + /// + /// @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 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; - }; + // The callout priority + CalloutPriorities::CalloutPriority iv_calloutPriority; +}; +/// +/// @struct ErrorInfoCDG +/// +/// This struct contains a target to callout/deconfigure/GARD +/// +struct ErrorInfoCDG +{ /// - /// @struct ErrorInfoCDG + /// @brief Constructor. /// - /// This struct contains a target to callout/deconfigure/GARD + /// @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 /// - 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); + 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 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); + /// + /// @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; + // The target to callout/deconfigure/GARD + Target<TARGET_TYPE_ALL> iv_target; - // Callout Information - bool iv_callout; - CalloutPriorities::CalloutPriority iv_calloutPriority; + // Callout Information + bool iv_callout; + CalloutPriorities::CalloutPriority iv_calloutPriority; - // Deconfigure Information - bool iv_deconfigure; + // Deconfigure Information + bool iv_deconfigure; - // GARD Information - bool iv_gard; - }; + // 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_parentChip Reference to the parent target + /// @param[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 /// - /// @struct ErrorInfoChildrenCDG + /// @brief Overload new operator to use platform-specific allocator /// - /// This struct contains children targets to callout/deconfigure/GARD + /// @param[in] i_sz Size of memory to allocate in bytes /// - /// 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 + /// @return Pointer to allocated memory /// - 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); + 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); + /// + /// @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 parent chip + Target<TARGET_TYPE_ALL> iv_parent; - // The child target types to c/d/g - TargetType iv_childType; + // The child target types to c/d/g + TargetType iv_childType; - // Callout Information - bool iv_callout; - CalloutPriorities::CalloutPriority iv_calloutPriority; + // Callout Information + bool iv_callout; + CalloutPriorities::CalloutPriority iv_calloutPriority; - // Deconfigure Information - bool iv_deconfigure; + // Deconfigure Information + bool iv_deconfigure; - // GARD Information - bool iv_gard; + // GARD Information + bool iv_gard; - // Child Port - static const uint8_t ALL_CHILD_PORTS = 0xff; - uint8_t iv_childPort; + // 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; - }; + // 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 +{ /// - /// @struct ErrorInfoCollectTrace + /// @brief Constructor. /// - /// This struct contains trace ID to add to the error log + /// @param[in] i_traceId /// - struct ErrorInfoCollectTrace - { - /// - /// @brief Constructor. - /// - /// @param[in] i_trace - /// - ErrorInfoCollectTrace(CollectTraces::CollectTrace i_traceId); + 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 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); + /// + /// @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; - }; + // 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 - { +/// +/// @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 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); + /// + /// @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 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 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 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 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 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 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; - }; + // 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 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 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; - /// - /// @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(uint8_t i_procedure, uint8_t i_calloutPriority): - iv_procedure(i_procedure), - iv_calloutPriority(i_calloutPriority) - {} + ErrorInfoEntryProcCallout(void) = default; +}; - 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 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 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 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 Structure representing collected trace information - /// - struct ErrorInfoEntryCollectTrace +/// +/// @brief Union of all the error info types +/// +struct ErrorInfoEntry +{ + uint8_t iv_type; // Value from ErrorInfoType + union { - uint32_t iv_eieTraceId; - void addErrorInfo(std::shared_ptr<ErrorInfo> i_info, - const void* const* i_object) const; + ErrorInfoEntryFfdc ffdc; + ErrorInfoEntryHwCallout hw_callout; + ErrorInfoEntryProcCallout proc_callout; + ErrorInfoEntryBusCallout bus_callout; + ErrorInfoEntryTargetCDG target_cdg; + ErrorInfoEntryChildrenCDG children_cdg; + ErrorInfoEntryCollectTrace collect_trace; }; /// - /// @brief Union of all the error info types + /// @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 /// - struct ErrorInfoEntry + void addErrorInfo(std::shared_ptr<ErrorInfo> i_info, + const void* const* i_object) const { - uint8_t iv_type; // Value from ErrorInfoType - union + // "unhandled error info type"); + fapi2::Assert(iv_type < EI_LAST_TYPE); + + switch(iv_type) { - ErrorInfoEntryFfdc ffdc; - ErrorInfoEntryHwCallout hw_callout; - ErrorInfoEntryProcCallout proc_callout; - ErrorInfoEntryBusCallout bus_callout; - ErrorInfoEntryTargetCDG target_cdg; - ErrorInfoEntryChildrenCDG children_cdg; - ErrorInfoEntryCollectTrace collect_trace; + 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; }; - /// - /// @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; - } - }; + return; + } +}; #endif } - #endif // FAPI2_ERRORINFO_H_ diff --git a/hwpf/include/error_info_defs.H b/hwpf/include/error_info_defs.H index ebeaf02f..141dd6e6 100644 --- a/hwpf/include/error_info_defs.H +++ b/hwpf/include/error_info_defs.H @@ -1,11 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: $ */ +/* $Source: hwpf/include/error_info_defs.H $ */ /* */ -/* OpenPOWER HostBoot Project */ +/* OpenPOWER sbe Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* Contributors Listed Below - COPYRIGHT 2015,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -33,222 +33,302 @@ #include <stdint.h> #include <target.H> - -#ifndef __PPE__ +#if !defined(MINIMUM_FFDC) && !defined(FAPI2_NO_FFDC) #include <variable_buffer.H> -#include <iostream> -#endif // __PPE__ - +#include <utility> +#endif 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 - /// macro is called. - /// - class ffdc_t - { - public: - ffdc_t(void) - {} - operator const void*() const { return iv_value.first; } - operator uint8_t() const - { return *(reinterpret_cast<const uint8_t*>(iv_value.first)); } +/// +/// @brief Type to hold the ffdc data to be returned to caller +/// when error occurs in sbe environment. +/// +/// Note: Typical data sent seems to be register/addresss info +/// rather than use extra space converting stuff just +/// send a uint64 always +/// +struct sbeFfdc_t +{ + uint32_t size; + uint64_t data; +}; - int16_t size(void) const { return iv_value.second; } - int16_t& size(void) { return iv_value.second; } +// Data type for SBE ffdc buffer sent through fifo +typedef struct +{ + uint32_t fapiRc; // Return code from failure + uint32_t ffdcLength; // length of Fapi FFDC data (in bytes) + struct sbeFfdc_t ffdcData[10]; // fapi FFDC data +} SbeFfdcData_t; // 128 bytes - const void* ptr(void) const { return iv_value.first; } - const void*& ptr(void) { return iv_value.first; } +/// +/// @brief Type to hold the ffdc element in the ffdc class +/// Needed so that the size can be squirled away before the +/// macro is called. +/// +struct ffdc_struct +{ + const void* ptr; + int16_t size; +}; - private: - std::pair<const void*, int16_t> iv_value; - }; -#endif - /// - /// @brief Enumeration of ErrorInfo FFDC sizes that are used to indicate a - /// special type that cannot simply be memcopied - enum ErrorInfoFfdcSize - { - EI_FFDC_SIZE_BUF = 0xffff, // fapi2::buffer<T> - EI_FFDC_SIZE_TARGET = 0xfffe, // fapi2::Target - EI_FFDC_SIZE_VBUF = 0xfffd, // fapi2::variable_buffer - EI_FFDC_MAX_SIZE = 0x1000, // Limit regular FFDC capture to 4kb - }; - - /// - /// @brief Enumeration of error log severity. - /// - enum errlSeverity_t - { - FAPI2_ERRL_SEV_UNDEFINED = 0x00, /// Used internally by ffdc mechanism - FAPI2_ERRL_SEV_RECOVERED = 0x10, /// Not seen by customer - FAPI2_ERRL_SEV_PREDICTIVE = 0x20, /// Error recovered but customer will see - FAPI2_ERRL_SEV_UNRECOVERABLE = 0x40 /// Unrecoverable, general - }; - - /// - /// @brief Enumeration of ErrorInfo types - /// - enum ErrorInfoType - { - EI_TYPE_FFDC = 0, - EI_TYPE_HW_CALLOUT = 1, - EI_TYPE_PROCEDURE_CALLOUT = 2, - EI_TYPE_BUS_CALLOUT = 3, - EI_TYPE_CDG = 4, // Target Callout/Deconfig/GARD - EI_TYPE_CHILDREN_CDG = 5, // Children Callout/Deconfig/GARD - EI_TYPE_COLLECT_TRACE = 6, - EI_LAST_TYPE = EI_TYPE_COLLECT_TRACE + 1, - }; - - /// - /// @enum HwCallout - /// - /// This enumeration defines the possible Hardware Callouts that are not - /// represented by fapi2::Targets - /// - /// Note that platform code may depend on the enum values starting at 0 and - /// incrementing in order to efficiently convert to a platform callout value - /// so do not reorder without consulting all platforms - /// - namespace HwCallouts - { - enum HwCallout +class ffdc_t +{ + public: + ffdc_t(void) + {} + + void operator=(const ffdc_t& i ) { - // Where indicated, a HW Callout in FAPI Error XML must include a - // reference target that is used to identify the HW. e.g. for - // TOD_CLOCK, the proc chip that the clock is attached to must be - // specified - TOD_CLOCK = 0, // Include proc-chip ref (or child chiplet) - MEM_REF_CLOCK = 1, // Include membuf-chip ref (or child chiplet) - PROC_REF_CLOCK = 2, // Include proc-chip ref (or child chiplet) - PCI_REF_CLOCK = 3, // Include proc-chip ref (or child chiplet) - FLASH_CONTROLLER_PART = 4, - PNOR_PART = 5, - SBE_SEEPROM_PART = 6, - VPD_PART = 7, - LPC_SLAVE_PART = 8, - GPIO_EXPANDER_PART = 9, - SPIVID_SLAVE_PART = 10, - }; - } + iv_value.ptr = i.ptr(); + iv_value.size = i.size(); + } - /// - /// @enum ProcedureCallout - /// - /// This enumeration defines the possible Procedure Callouts - /// These instruct the customer/customer-engineer what to do - /// - /// Note that platform code may depend on the enum values starting at 0 and - /// incrementing in order to efficiently convert to a platform callout value - /// so do not reorder without consulting all platforms - /// - namespace ProcedureCallouts - { - enum ProcedureCallout + operator const void* () const { - CODE = 0, // Code problem - LVL_SUPPORT = 1, // Call next level of support - MEMORY_PLUGGING_ERROR = 2, // DIMM Plugging error - BUS_CALLOUT = 3, // Bus Called Out - }; - } + return iv_value.ptr; + } + operator uint8_t() const + { + return *(reinterpret_cast<const uint8_t*>(iv_value.ptr)); + } - /// - /// @enum CalloutPriority - /// - /// This enumeration defines the possible Procedure and Target callout priorities - /// - /// Note that platform code may depend on the enum values starting at 0 and - /// incrementing in order to efficiently convert to a platform priority value - /// so do not reorder without consulting all platforms - /// - namespace CalloutPriorities - { - enum CalloutPriority + int16_t size(void) const { - LOW = 0, - MEDIUM = 1, - HIGH = 2, - }; - } + return iv_value.size; + } + int16_t& size(void) + { + return iv_value.size; + } - /// - /// @enum Collect Trace - /// - /// This enumeration defines the possible firmware traces to collect - /// - namespace CollectTraces - { - const uint32_t TRACE_SIZE = 256; // limit collected trace size - enum CollectTrace + const void* ptr(void) const { - FSI = 1, - SCOM = 2, - SCAN = 3, - MBOX = 4, - }; - } + return iv_value.ptr; + } + const void*& ptr(void) + { + return iv_value.ptr; + } - /// - /// @brief Get FFDC Size - /// - /// This is called by the FAPI_SET_HWP_ERROR macro to find out the size of - /// FFDC data. If the data is of a special type that is handled differently - /// than types that are simply memcopied then it is handled by a template - /// specialization. - /// If this function template is instantiated with a pointer, the compile - /// will fail. - /// - /// @return uint16_t. Size of the FFDC data - /// - template<typename T> - inline uint16_t getErrorInfoFfdcSize(const T &) - { - static_assert(sizeof(T) <= EI_FFDC_MAX_SIZE, - "FFDC too large to capture"); - return sizeof(T); - } + private: + struct ffdc_struct iv_value; +}; - /// - /// @brief Compile error if caller tries to get the FFDC size of a pointer - /// - template<typename T> - inline uint16_t getErrorInfoFfdcSize(const T*) - { - static_assert(std::is_pointer<T>::value, - "pointer passed to getErrorInfoFfdcSize"); - return 0; - } +/// +/// @brief Enumeration of ErrorInfo FFDC sizes that are used to indicate a +/// special type that cannot simply be memcopied +enum ErrorInfoFfdcSize +{ + EI_FFDC_SIZE_BUF = 0xffff, // fapi2::buffer<T> + EI_FFDC_SIZE_TARGET = 0xfffe, // fapi2::Target + EI_FFDC_SIZE_VBUF = 0xfffd, // fapi2::variable_buffer + EI_FFDC_MAX_SIZE = 0x1000, // Limit regular FFDC capture to 4kb +}; + +/// +/// @brief Enumeration of error log severity. +/// +enum errlSeverity_t +{ + FAPI2_ERRL_SEV_UNDEFINED = 0x00, /// Used internally by ffdc mechanism + FAPI2_ERRL_SEV_RECOVERED = 0x10, /// Not seen by customer + FAPI2_ERRL_SEV_PREDICTIVE = 0x20, /// Error recovered but customer will see + FAPI2_ERRL_SEV_UNRECOVERABLE = 0x40 /// Unrecoverable, general +}; - /// - /// @brief Get FFDC Size specialization for fapi2::Target - /// - template<fapi2::TargetType T> - inline uint16_t getErrorInfoFfdcSize(const fapi2::Target<T>&) +/// +/// @brief Enumeration of ErrorInfo types +/// +enum ErrorInfoType +{ + EI_TYPE_FFDC = 0, + EI_TYPE_HW_CALLOUT = 1, + EI_TYPE_PROCEDURE_CALLOUT = 2, + EI_TYPE_BUS_CALLOUT = 3, + EI_TYPE_CDG = 4, // Target Callout/Deconfig/GARD + EI_TYPE_CHILDREN_CDG = 5, // Children Callout/Deconfig/GARD + EI_TYPE_COLLECT_TRACE = 6, + EI_LAST_TYPE = EI_TYPE_COLLECT_TRACE + 1, +}; + +#if !defined(MINIMUM_FFDC) && !defined(FAPI2_NO_FFDC) +/// +/// @enum HwCallout +/// +/// This enumeration defines the possible Hardware Callouts that are not +/// represented by fapi2::Targets +/// +/// Note that platform code may depend on the enum values starting at 0 and +/// incrementing in order to efficiently convert to a platform callout value +/// so do not reorder without consulting all platforms +/// +namespace HwCallouts +{ +enum HwCallout +{ + // Where indicated, a HW Callout in FAPI Error XML must include a + // reference target that is used to identify the HW. e.g. for + // TOD_CLOCK, the proc chip that the clock is attached to must be + // specified + TOD_CLOCK = 0, // Include proc-chip ref (or child chiplet) + MEM_REF_CLOCK = 1, // Include membuf-chip ref (or child chiplet) + PROC_REF_CLOCK = 2, // Include proc-chip ref (or child chiplet) + PCI_REF_CLOCK = 3, // Include proc-chip ref (or child chiplet) + FLASH_CONTROLLER_PART = 4, + PNOR_PART = 5, + SBE_SEEPROM_PART = 6, + VPD_PART = 7, + LPC_SLAVE_PART = 8, + GPIO_EXPANDER_PART = 9, + SPIVID_SLAVE_PART = 10, +}; +} + +/// +/// @enum ProcedureCallout +/// +/// This enumeration defines the possible Procedure Callouts +/// These instruct the customer/customer-engineer what to do +/// +/// Note that platform code may depend on the enum values starting at 0 and +/// incrementing in order to efficiently convert to a platform callout value +/// so do not reorder without consulting all platforms +/// +namespace ProcedureCallouts +{ +enum ProcedureCallout +{ + CODE = 0, // Code problem + LVL_SUPPORT = 1, // Call next level of support + MEMORY_PLUGGING_ERROR = 2, // DIMM Plugging error + BUS_CALLOUT = 3, // Bus Called Out +}; +} + +/// +/// @enum CalloutPriority +/// +/// This enumeration defines the possible Procedure and Target callout priorities +/// +/// Note that platform code may depend on the enum values starting at 0 and +/// incrementing in order to efficiently convert to a platform priority value +/// so do not reorder without consulting all platforms +/// +namespace CalloutPriorities +{ +enum CalloutPriority +{ + LOW = 0, + MEDIUM = 1, + HIGH = 2, +}; +} + +/// +/// @enum CollectTrace +/// +/// This enumeration defines the possible firmware traces to collect +/// +namespace CollectTraces +{ +const uint32_t TRACE_SIZE = 256; // limit collected trace size +enum CollectTrace +{ + FSI = 1, + SCOM = 2, + SCAN = 3, + MBOX = 4, +}; +} + +/// +/// @brief Get FFDC Data from FIFO buffer +/// +/// This is called by hwsv/hb ffdc code when an error is returned in the +/// sbe fifo area. It will translate the data based on type and convert +/// the local data size to the correct length based on the known data size. +/// +/// NOTE - this assumes no buffers are passed - mistake? maybe +inline fapi2::ffdc_t getFfdcData( sbeFfdc_t& i_sbeFfdc ) +{ + fapi2::ffdc_t temp; + + // passed in size is a uint32_t but, needs to be uint16_t + temp.size() = static_cast<uint16_t>(i_sbeFfdc.size); + + if(i_sbeFfdc.size == EI_FFDC_SIZE_TARGET ) { - return EI_FFDC_SIZE_TARGET; + fapi2::TargetType type = TARGET_TYPE_EX; + uint8_t instance = 0; + // 1 convert from SBE targetPointer to TYPE/INSTANCE + // convertSbePlatPtr( i_sbeFfdcPtr->data, type, instance ); + // call hostboot to get the fapi2 target + temp.ptr() = static_cast<void*>(getTarget(type, instance)); } - -#ifndef __PPE__ - /// - /// @brief Get FFDC Size specialization for variable buffers - /// - template<> - inline uint16_t getErrorInfoFfdcSize(const fapi2::variable_buffer& i_thing) + else { - // Limit a variable buffer to 4kb bytes, and we can memcpy the storage. - return std::min(static_cast<uint32_t>(EI_FFDC_MAX_SIZE), - i_thing.getLength<uint8_t>()); + // adjust the pointer based on the data size. + temp.ptr() = reinterpret_cast<uint8_t*>(&i_sbeFfdc.data) + (sizeof(uint64_t) - i_sbeFfdc.size); } -#endif // __PPE__ - -}; + return temp; +} +#endif +/// +/// @brief Get FFDC Size +/// +/// This is called by the FAPI_SET_HWP_ERROR macro to find out the size of +/// FFDC data. If the data is of a special type that is handled differently +/// than types that are simply memcopied then it is handled by a template +/// specialization. +/// If this function template is instantiated with a pointer, the compile +/// will fail. +/// +/// @return uint16_t. Size of the FFDC data +/// +template<typename T> +inline uint16_t getErrorInfoFfdcSize(const T&) +{ + static_assert(sizeof(T) <= EI_FFDC_MAX_SIZE, + "FFDC too large to capture"); + return sizeof(T); +} +#if !defined(MINIMUM_FFDC) && !defined(FAPI2_NO_FFDC) +/// +/// @brief Compile error if caller tries to get the FFDC size of a pointer +/// +template<typename T> +inline uint16_t getErrorInfoFfdcSize(const T*) +{ + static_assert(std::is_pointer<T>::value, + "pointer passed to getErrorInfoFfdcSize"); + return 0; +} +#endif +/// +/// @brief Get FFDC Size specialization for fapi2::Target +/// +template<fapi2::TargetType T> +inline uint16_t getErrorInfoFfdcSize(const fapi2::Target<T>&) +{ + return EI_FFDC_SIZE_TARGET; +} +#if !defined(MINIMUM_FFDC) && !defined(FAPI2_NO_FFDC) +/// +/// @brief Get FFDC Size specialization for variable buffers +/// +template<> +inline uint16_t getErrorInfoFfdcSize(const fapi2::variable_buffer& i_thing) +{ + // Limit a variable buffer to 4kb bytes, and we can memcpy the storage. + return std::min(static_cast<uint32_t>(EI_FFDC_MAX_SIZE), + i_thing.getLength<uint8_t>()); +} +#endif +}; #endif // FAPI2_ERRORINFO_DEFS_H_ diff --git a/hwpf/include/ffdc.H b/hwpf/include/ffdc.H index aa43fc0a..138e44aa 100644 --- a/hwpf/include/ffdc.H +++ b/hwpf/include/ffdc.H @@ -1,11 +1,13 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: $ */ +/* $Source: hwpf/include/ffdc.H $ */ /* */ -/* OpenPOWER HostBoot Project */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* [+] International Business Machines Corp. */ /* */ -/* 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. */ @@ -28,164 +30,7 @@ #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/return_code.H b/hwpf/include/return_code.H index 325cb915..a64772a6 100644 --- a/hwpf/include/return_code.H +++ b/hwpf/include/return_code.H @@ -1,11 +1,11 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: $ */ +/* $Source: hwpf/include/return_code.H $ */ /* */ -/* OpenPOWER HostBoot Project */ +/* OpenPOWER sbe Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -34,7 +34,7 @@ #include <return_code_defs.H> #ifndef FAPI2_NO_FFDC - #include <ffdc.H> +#include <ffdc.H> #endif namespace fapi2 @@ -44,7 +44,7 @@ namespace fapi2 /// // Remove the inheritance relationship with FirstFailureData if // the platform doesn't support FFDC. -#ifdef FAPI2_NO_FFDC +#if defined(FAPI2_NO_FFDC) || defined (MINIMUM_FFDC) class ReturnCode #else class ReturnCode : public FirstFailureData<ReturnCode> @@ -104,5 +104,5 @@ namespace fapi2 extern thread_local uint64_t pib_error_mask; /// the pib mask extern thread_local uint64_t operational_state; /// the operational mode } - #endif + |