diff options
author | Mike Jones <mjjones@us.ibm.com> | 2013-08-26 14:36:36 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2013-09-12 13:28:54 -0500 |
commit | 7e14a67f70a873c3d6d3fe2640ce7cc84e6065c5 (patch) | |
tree | 5072771d23e14cde97cd1eee8f374c449d29fe6c /src | |
parent | 8c8662a2daf4a57ad704a6642f2f33d560fb8d01 (diff) | |
download | talos-hostboot-7e14a67f70a873c3d6d3fe2640ce7cc84e6065c5.tar.gz talos-hostboot-7e14a67f70a873c3d6d3fe2640ce7cc84e6065c5.zip |
HWPF: Calling out HW without a fapi::Target
Change-Id: Ic4601fac85fa465b91a1c9c67bf09c1344b11146
RTC: 69766
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/5919
Tested-by: Jenkins Server
Reviewed-by: Brian H. Horton <brianh@linux.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/include/usr/hwpf/fapi/fapiErrorInfo.H | 117 | ||||
-rw-r--r-- | src/include/usr/hwpf/fapi/fapiReturnCode.H | 33 | ||||
-rw-r--r-- | src/usr/hwpf/fapi/fapiErrorInfo.C | 105 | ||||
-rwxr-xr-x | src/usr/hwpf/fapi/fapiParseErrorInfo.pl | 41 | ||||
-rw-r--r-- | src/usr/hwpf/fapi/fapiReturnCode.C | 43 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/fapiHwpErrorInfo.xml | 10 | ||||
-rw-r--r-- | src/usr/hwpf/plat/fapiPlatHwpInvoker.C | 93 | ||||
-rw-r--r-- | src/usr/hwpf/test/fapiRcTest.C | 33 |
8 files changed, 456 insertions, 19 deletions
diff --git a/src/include/usr/hwpf/fapi/fapiErrorInfo.H b/src/include/usr/hwpf/fapi/fapiErrorInfo.H index 60c0b29f0..8467e22f1 100644 --- a/src/include/usr/hwpf/fapi/fapiErrorInfo.H +++ b/src/include/usr/hwpf/fapi/fapiErrorInfo.H @@ -41,6 +41,7 @@ * mjjones 03/22/2013 Support Procedure Callouts * mjjones 05/20/2013 Support Bus Callouts * mjjones 06/24/2013 Support Children CDGs + * mjjones 08/26/2013 Support HW Callouts */ #ifndef FAPIERRORINFO_H_ @@ -54,6 +55,30 @@ namespace fapi { /** + * @enum HwCallout + * + * This enumeration defines the possible Hardware Callouts that are not + * represented by fapi::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) +}; +} + +/** * @enum ProcedureCallout * * This enumeration defines the possible Procedure Callouts @@ -151,7 +176,6 @@ public: static void operator delete(void * i_ptr); #endif - private: // FFDC Identifier @@ -169,6 +193,54 @@ private: }; /** + * @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 & 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 iv_refTarget; +}; + +/** * @struct ErrorInfoProcedureCallout * * This struct contains a procedure to callout @@ -229,6 +301,24 @@ struct ErrorInfoBusCallout const Target & 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 iv_target1; Target iv_target2; @@ -315,6 +405,24 @@ struct ErrorInfoChildrenCDG 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 parent chip Target iv_parentChip; @@ -368,6 +476,13 @@ struct ErrorInfo typedef std::vector<ErrorInfoFfdc *>::iterator ErrorInfoFfdcItr_t; typedef std::vector<ErrorInfoFfdc *>::const_iterator ErrorInfoFfdcCItr_t; + // Vector of Hardware to callout + std::vector<ErrorInfoHwCallout *> iv_hwCallouts; + typedef std::vector<ErrorInfoHwCallout *>::iterator + ErrorInfoHwCalloutItr_t; + typedef std::vector<ErrorInfoHwCallout *>::const_iterator + ErrorInfoHwCalloutCItr_t; + // Vector of procedures to callout std::vector<ErrorInfoProcedureCallout *> iv_procedureCallouts; typedef std::vector<ErrorInfoProcedureCallout *>::iterator diff --git a/src/include/usr/hwpf/fapi/fapiReturnCode.H b/src/include/usr/hwpf/fapi/fapiReturnCode.H index 08756293d..edd86397b 100644 --- a/src/include/usr/hwpf/fapi/fapiReturnCode.H +++ b/src/include/usr/hwpf/fapi/fapiReturnCode.H @@ -49,6 +49,7 @@ * mjjones 05/20/2013 Support Bus Callouts * mjjones 06/06/2013 Check FFDC size at compile time * mjjones 06/24/2013 Support Children CDGs + * mjjones 08/26/2013 Support Hw Callout */ #ifndef FAPIRETURNCODE_H_ @@ -282,10 +283,11 @@ public: enum ErrorInfoType { EI_TYPE_FFDC = 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_HW_CALLOUT = 2, + EI_TYPE_PROCEDURE_CALLOUT = 3, + EI_TYPE_BUS_CALLOUT = 4, + EI_TYPE_CDG = 5, // Target Callout/Deconfig/GARD + EI_TYPE_CHILDREN_CDG = 6, // Children Callout/Deconfig/GARD }; /** @@ -308,6 +310,13 @@ public: struct { + uint8_t iv_hw; + uint8_t iv_calloutPriority; + uint8_t iv_refObjIndex; + } hw_callout; + + struct + { uint8_t iv_procedure; uint8_t iv_calloutPriority; } proc_callout; @@ -417,6 +426,20 @@ private: void forgetData(); /** + * @brief Add a HW callout to the ErrorInfo + * + * This is called by addErrorInfo + * + * @param[in] i_hw The hardware to callout + * @param[in] i_priority The priority of the callout + * @param[in] i_refTarget Reference to reference Target + */ + void addEIHwCallout( + const HwCallouts::HwCallout i_hw, + const CalloutPriorities::CalloutPriority i_priority, + const Target & i_refTarget); + + /** * @brief Add a procedure callout to the ErrorInfo * * This is called by addErrorInfo @@ -435,7 +458,7 @@ private: * * @param[in] i_target1 Reference to endpoint1 Target * @param[in] i_target2 Reference to endpoint2 Target - * @param[in] i_priority The priority of the callout + * @param[in] i_priority The priority of the callout */ void addEIBusCallout( const Target & i_target1, diff --git a/src/usr/hwpf/fapi/fapiErrorInfo.C b/src/usr/hwpf/fapi/fapiErrorInfo.C index ce2107dfb..27f505383 100644 --- a/src/usr/hwpf/fapi/fapiErrorInfo.C +++ b/src/usr/hwpf/fapi/fapiErrorInfo.C @@ -41,6 +41,7 @@ * mjjones 03/22/2013 Support Procedure Callouts * mjjones 05/20/2013 Support Bus Callouts * mjjones 06/24/2013 Support Children CDGs + * mjjones 08/26/2013 Support HW Callouts */ #include <fapiErrorInfo.H> @@ -109,6 +110,38 @@ void ErrorInfoFfdc::operator delete(void * i_ptr) #endif //****************************************************************************** +// ErrorInfoHwCallout Constructor +//****************************************************************************** +ErrorInfoHwCallout::ErrorInfoHwCallout( + const HwCallouts::HwCallout i_hw, + const CalloutPriorities::CalloutPriority i_calloutPriority, + const Target & i_refTarget) +: iv_hw(i_hw), iv_calloutPriority(i_calloutPriority), iv_refTarget(i_refTarget) +{ + +} + +//****************************************************************************** +// ErrorInfoHwCallout new Operator Overload +//****************************************************************************** +#ifdef FAPI_CUSTOM_MALLOC +void * ErrorInfoHwCallout::operator new(size_t i_sz) +{ + return fapiMalloc(i_sz); +} +#endif + +//****************************************************************************** +// ErrorInfoProcedureCallout delete Operator Overload +//****************************************************************************** +#ifdef FAPI_CUSTOM_MALLOC +void ErrorInfoHwCallout::operator delete(void * i_ptr) +{ + fapiFree(i_ptr); +} +#endif + +//****************************************************************************** // ErrorInfoProcedureCallout Constructor //****************************************************************************** ErrorInfoProcedureCallout::ErrorInfoProcedureCallout( @@ -120,7 +153,27 @@ ErrorInfoProcedureCallout::ErrorInfoProcedureCallout( } //****************************************************************************** -// ErrorInfoProcedureCallout Constructor +// ErrorInfoProcedureCallout new Operator Overload +//****************************************************************************** +#ifdef FAPI_CUSTOM_MALLOC +void * ErrorInfoProcedureCallout::operator new(size_t i_sz) +{ + return fapiMalloc(i_sz); +} +#endif + +//****************************************************************************** +// ErrorInfoProcedureCallout delete Operator Overload +//****************************************************************************** +#ifdef FAPI_CUSTOM_MALLOC +void ErrorInfoProcedureCallout::operator delete(void * i_ptr) +{ + fapiFree(i_ptr); +} +#endif + +//****************************************************************************** +// ErrorInfoBusCallout Constructor //****************************************************************************** ErrorInfoBusCallout::ErrorInfoBusCallout( const Target & i_target1, @@ -132,20 +185,20 @@ ErrorInfoBusCallout::ErrorInfoBusCallout( } //****************************************************************************** -// ErrorInfoProcedureCallout new Operator Overload +// ErrorInfoBusCallout new Operator Overload //****************************************************************************** #ifdef FAPI_CUSTOM_MALLOC -void * ErrorInfoProcedureCallout::operator new(size_t i_sz) +void * ErrorInfoBusCallout::operator new(size_t i_sz) { return fapiMalloc(i_sz); } #endif //****************************************************************************** -// ErrorInfoProcedureCallout delete Operator Overload +// ErrorInfoBusCallout delete Operator Overload //****************************************************************************** #ifdef FAPI_CUSTOM_MALLOC -void ErrorInfoProcedureCallout::operator delete(void * i_ptr) +void ErrorInfoBusCallout::operator delete(void * i_ptr) { fapiFree(i_ptr); } @@ -202,6 +255,26 @@ ErrorInfoChildrenCDG::ErrorInfoChildrenCDG( } //****************************************************************************** +// ErrorInfoChildrenCDG new Operator Overload +//****************************************************************************** +#ifdef FAPI_CUSTOM_MALLOC +void * ErrorInfoChildrenCDG::operator new(size_t i_sz) +{ + return fapiMalloc(i_sz); +} +#endif + +//****************************************************************************** +// ErrorInfoCDG delete Operator Overload +//****************************************************************************** +#ifdef FAPI_CUSTOM_MALLOC +void ErrorInfoChildrenCDG::operator delete(void * i_ptr) +{ + fapiFree(i_ptr); +} +#endif + +//****************************************************************************** // ErrorInfo Destructor //****************************************************************************** ErrorInfo::~ErrorInfo() @@ -213,6 +286,13 @@ ErrorInfo::~ErrorInfo() (*l_itr) = NULL; } + for (ErrorInfoHwCalloutItr_t l_itr = iv_hwCallouts.begin(); + l_itr != iv_hwCallouts.end(); ++l_itr) + { + delete (*l_itr); + (*l_itr) = NULL; + } + for (ErrorInfo::ErrorInfoProcedureCalloutItr_t l_itr = iv_procedureCallouts.begin(); l_itr != iv_procedureCallouts.end(); ++l_itr) @@ -221,12 +301,27 @@ ErrorInfo::~ErrorInfo() (*l_itr) = NULL; } + for (ErrorInfo::ErrorInfoBusCalloutItr_t l_itr = + iv_busCallouts.begin(); + l_itr != iv_busCallouts.end(); ++l_itr) + { + delete (*l_itr); + (*l_itr) = NULL; + } + for (ErrorInfo::ErrorInfoCDGItr_t l_itr = iv_CDGs.begin(); l_itr != iv_CDGs.end(); ++l_itr) { delete (*l_itr); (*l_itr) = NULL; } + + for (ErrorInfo::ErrorInfoChildrenCDGItr_t l_itr = iv_childrenCDGs.begin(); + l_itr != iv_childrenCDGs.end(); ++l_itr) + { + delete (*l_itr); + (*l_itr) = NULL; + } } //****************************************************************************** diff --git a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl index 395d50318..bcfb40a57 100755 --- a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl +++ b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl @@ -57,6 +57,7 @@ # mjjones 05/20/13 Support Bus Callouts # mjjones 06/24/13 Support Children CDGs # mjjones 08/20/13 Use constants for Reg FFDC collection +# mjjones 08/26/13 Support HW Callouts # # End Change Log ****************************************************** @@ -482,7 +483,45 @@ foreach my $argnum (1 .. $#ARGV) exit(1); } - if (exists $callout->{procedure}) + if (exists $callout->{hw}) + { + # HW Callout + if (! exists $callout->{hw}->{hwid}) + { + print ("fapiParseErrorInfo.pl ERROR. HW Callout hwid missing\n"); + exit(1); + } + + # Check that those HW callouts that need reference targets have them + if (($callout->{hw}->{hwid} eq "TOD_CLOCK") || + ($callout->{hw}->{hwid} eq "MEM_REF_CLOCK") || + ($callout->{hw}->{hwid} eq "PROC_REF_CLOCK") || + ($callout->{hw}->{hwid} eq "PCI_REF_CLOCK")) + { + if (! exists $callout->{hw}->{refTarget}) + { + print ("fapiParseErrorInfo.pl ERROR. Callout missing refTarget\n"); + exit(1); + } + } + + # Add an EI entry to eiEntryStr + $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi::ReturnCode::EI_TYPE_HW_CALLOUT; \\\n"; + $eiEntryStr .= " l_entries[$eiEntryCount].hw_callout.iv_hw = fapi::HwCallouts::$callout->{hw}->{hwid}; \\\n"; + $eiEntryStr .= " l_entries[$eiEntryCount].hw_callout.iv_calloutPriority = fapi::CalloutPriorities::$callout->{priority}; \\\n"; + if (exists $callout->{hw}->{refTarget}) + { + # Add the Targets to the objectlist if they don't already exist + my $objNum = addEntryToArray(\@eiObjects, $callout->{hw}->{refTarget}); + $eiEntryStr .= " l_entries[$eiEntryCount].hw_callout.iv_refObjIndex = $objNum; \\\n"; + } + else + { + $eiEntryStr .= " l_entries[$eiEntryCount].hw_callout.iv_refObjIndex = 0xff; \\\n"; + } + $eiEntryCount++; + } + elsif (exists $callout->{procedure}) { # Procedure Callout # Add an EI entry to eiEntryStr diff --git a/src/usr/hwpf/fapi/fapiReturnCode.C b/src/usr/hwpf/fapi/fapiReturnCode.C index 6d42b44f5..587020bee 100644 --- a/src/usr/hwpf/fapi/fapiReturnCode.C +++ b/src/usr/hwpf/fapi/fapiReturnCode.C @@ -51,6 +51,7 @@ * mjjones 03/22/2013 Support Procedure Callouts * mjjones 05/20/2013 Support Bus Callouts * mjjones 06/24/2013 Support Children CDGs + * mjjones 08/26/2013 Support HW Callouts */ #include <fapiReturnCode.H> @@ -282,6 +283,33 @@ void ReturnCode::addErrorInfo(const void * const * i_pObjects, addEIFfdc(l_ffdcId, l_pObject, l_size); } } + else if (l_type == EI_TYPE_HW_CALLOUT) + { + HwCallouts::HwCallout l_hw = static_cast<HwCallouts::HwCallout>( + i_pEntries[i].hw_callout.iv_hw); + CalloutPriorities::CalloutPriority l_pri = + static_cast<CalloutPriorities::CalloutPriority>( + i_pEntries[i].hw_callout.iv_calloutPriority); + + // A refIndex of 0xff indicates that there is no reference target + uint8_t l_refIndex = i_pEntries[i].hw_callout.iv_refObjIndex; + + if (l_refIndex != 0xff) + { + const Target * l_pRefTarget = static_cast<const Target *>( + i_pObjects[l_refIndex]); + FAPI_ERR("addErrorInfo: Adding hw callout with ref, hw: %d, pri: %d", + l_hw, l_pri); + addEIHwCallout(l_hw, l_pri, *l_pRefTarget); + } + else + { + Target l_emptyTarget; + FAPI_ERR("addErrorInfo: Adding hw callout with no ref, hw: %d, pri: %d", + l_hw, l_pri); + addEIHwCallout(l_hw, l_pri, l_emptyTarget); + } + } else if (l_type == EI_TYPE_PROCEDURE_CALLOUT) { ProcedureCallouts::ProcedureCallout l_proc = @@ -445,6 +473,21 @@ void ReturnCode::forgetData() } //****************************************************************************** +// addEIHwCallout function +//****************************************************************************** +void ReturnCode::addEIHwCallout( + const HwCallouts::HwCallout i_hw, + const CalloutPriorities::CalloutPriority i_priority, + const Target & i_refTarget) +{ + // Create an ErrorInfoHwCallout object and add it to the Error Information + ErrorInfoHwCallout * l_pCallout = new ErrorInfoHwCallout( + i_hw, i_priority, i_refTarget); + getCreateReturnCodeDataRef().getCreateErrorInfo(). + iv_hwCallouts.push_back(l_pCallout); +} + +//****************************************************************************** // addEIProcedureCallout function //****************************************************************************** void ReturnCode::addEIProcedureCallout( diff --git a/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml b/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml index 1b1c570b7..e64415dd0 100644 --- a/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml +++ b/src/usr/hwpf/hwp/fapiHwpErrorInfo.xml @@ -97,6 +97,16 @@ </childTargets> </deconfigure> --> + <!-- Callout the PCI ref-clock --> + <!-- Commented out to avoid actually calling out the ref-clock in UT + <callout> + <hw> + <hwid>PCI_REF_CLOCK</hwid> + <refTarget>UNIT_TEST_FFDC_MASTER_CHIP_TARGET</refTarget> + </hw> + <priority>MEDIUM</priority> + </callout> + --> </hwpError> <!-- *********************************************************************** --> <hwpError> diff --git a/src/usr/hwpf/plat/fapiPlatHwpInvoker.C b/src/usr/hwpf/plat/fapiPlatHwpInvoker.C index 7592215eb..a8c0f6122 100644 --- a/src/usr/hwpf/plat/fapiPlatHwpInvoker.C +++ b/src/usr/hwpf/plat/fapiPlatHwpInvoker.C @@ -57,7 +57,7 @@ HWAS::callOutPriority xlateCalloutPriority( if (l_index < (sizeof(HWAS_PRI)/sizeof(HWAS::callOutPriority))) { - l_priority = HWAS_PRI[i_fapiPri]; + l_priority = HWAS_PRI[l_index]; } else { @@ -69,6 +69,41 @@ HWAS::callOutPriority xlateCalloutPriority( } /** + * @brief Translates a FAPI Clock HW callout to an HWAS clock callout + * + * @param[i] i_fapiClock FAPI Clock HW callout + * + * @return HWAS Clock HW callout + */ +/* TODO Enable in RTC 82509 when ERRL interfaces are in place +HWAS::clockTypeEnum xlateClockHwCallout( + const fapi::HwCallouts::Hw Callout i_fapiClock) +{ + // Use the HwCallout enum value as an index + HWAS::clockTypeEnum l_clock = HWAS::TODCLK_TYPE; + size_t l_index = i_fapiClock; + + const HWAS::clockTypeEnum HWAS_CLOCK[] = { + HWAS::TODCLK_TYPE, + HWAS::MEMCLK_TYPE, + HWAS::OSCREFCLK_TYPE, + HWAS::OSCPCICLK_TYPE}; + + if (l_index < (sizeof(HWAS_CLOCK)/sizeof(HWAS::clockTypeEnum))) + { + l_clock = HWAS_CLOCK[l_index]; + } + else + { + FAPI_ERR("fapi::xlateClockCallout: Unknown clock 0x%x, assuming TOD", + i_fapiClock); + } + + return l_clock; +} +*/ + +/** * @brief Translates a FAPI procedure callout to an HWAS procedure callout * * @param[i] i_fapiProc FAPI procedure callout @@ -89,7 +124,7 @@ HWAS::epubProcedureID xlateProcedureCallout( if (l_index < (sizeof(HWAS_PROC)/sizeof(HWAS::epubProcedureID))) { - l_proc = HWAS_PROC[i_fapiProc]; + l_proc = HWAS_PROC[l_index]; } else { @@ -103,9 +138,9 @@ HWAS::epubProcedureID xlateProcedureCallout( /** * @brief Translates a FAPI target type to a Targeting target type * - * @param[i] i_fapiProc FAPI procedure callout + * @param[i] i_targetType FAPI target type * - * @return HWAS procedure callout + * @return TARGETING type */ TARGETING::TYPE xlateTargetType( const fapi::TargetType i_targetType) @@ -185,6 +220,53 @@ void processEIFfdcs(const ErrorInfo & i_errInfo, } /** + * @brief Processes any HW callouts requests in the ReturnCode Error + * Information and adds them to the error log + * + * @param[i] i_errInfo Reference to ReturnCode Error Information + * @param[io] io_pError Errorlog Handle + */ +void processEIHwCallouts(const ErrorInfo & i_errInfo, + errlHndl_t io_pError) +{ + // Iterate through the HW callout requests, adding each to the error log + for (ErrorInfo::ErrorInfoHwCalloutCItr_t l_itr = + i_errInfo.iv_hwCallouts.begin(); + l_itr != i_errInfo.iv_hwCallouts.end(); ++l_itr) + { + HWAS::callOutPriority l_priority = + xlateCalloutPriority((*l_itr)->iv_calloutPriority); + + HwCallouts::HwCallout l_hw = ((*l_itr)->iv_hw); + + TARGETING::Target * l_pRefTarget = + reinterpret_cast<TARGETING::Target*>((*l_itr)->iv_refTarget.get()); + + if ( ((l_hw == HwCallouts::TOD_CLOCK) || + (l_hw == HwCallouts::MEM_REF_CLOCK) || + (l_hw == HwCallouts::PROC_REF_CLOCK) || + (l_hw == HwCallouts::PCI_REF_CLOCK)) && + l_pRefTarget != NULL) + { + /* TODO Enable in RTC 82509 when ERRL interfaces are in place + HWAS::clockTypeEnum l_clock = + xlateClockHwCallout((*l_itr)->iv_hw); + + FAPI_ERR("processEIHwCallouts: Adding clock-callout (clock:%d, pri:%d)", + l_clock, l_priority); + io_pError->addClockCallout(l_pRefTarget, l_clock, l_priority); + */ + FAPI_ERR("processEIHwCallouts: Adding clock-callout TBD (hw:%d, pri:%d)", + l_hw, l_priority); + } + else + { + FAPI_ERR("processEIHwCallouts: Unsupported HW callout (%d)", l_hw); + } + } +} + +/** * @brief Processes any Procedure callouts requests in the ReturnCode Error * Information and adds them to the error log * @@ -430,6 +512,7 @@ errlHndl_t fapiRcToErrl(ReturnCode & io_rc) processEIBusCallouts(*l_pErrorInfo, l_pError); processEICDGs(*l_pErrorInfo, l_pError); processEIChildrenCDGs(*l_pErrorInfo, l_pError); + processEIHwCallouts(*l_pErrorInfo, l_pError); } else { @@ -464,6 +547,7 @@ errlHndl_t fapiRcToErrl(ReturnCode & io_rc) processEIBusCallouts(*l_pErrorInfo, l_pError); processEICDGs(*l_pErrorInfo, l_pError); processEIChildrenCDGs(*l_pErrorInfo, l_pError); + processEIHwCallouts(*l_pErrorInfo, l_pError); } } @@ -475,7 +559,6 @@ errlHndl_t fapiRcToErrl(ReturnCode & io_rc) l_pError->collectTrace(FAPI_TRACE_NAME, 256 ); l_pError->collectTrace(FAPI_IMP_TRACE_NAME, 256 ); l_pError->collectTrace(FAPI_SCAN_TRACE_NAME, 256 ); - } return l_pError; diff --git a/src/usr/hwpf/test/fapiRcTest.C b/src/usr/hwpf/test/fapiRcTest.C index 2a4b8e439..1de3728a1 100644 --- a/src/usr/hwpf/test/fapiRcTest.C +++ b/src/usr/hwpf/test/fapiRcTest.C @@ -619,7 +619,7 @@ uint32_t rcTest12() // Add error information to the ReturnCode, the data is the same as that // produced by the fapiParseErrorInfo.pl script in fapiHwpErrorInfo.H const void * l_objects[] = {&l_ffdc, &l_target, &l_target2}; - fapi::ReturnCode::ErrorInfoEntry l_entries[5]; + fapi::ReturnCode::ErrorInfoEntry l_entries[6]; l_entries[0].iv_type = fapi::ReturnCode::EI_TYPE_FFDC; l_entries[0].ffdc.iv_ffdcObjIndex = 0; l_entries[0].ffdc.iv_ffdcId = 0x22334455; @@ -647,8 +647,11 @@ uint32_t rcTest12() l_entries[4].children_cdg.iv_gard = 0; l_entries[4].children_cdg.iv_calloutPriority = fapi::CalloutPriorities::HIGH; + l_entries[5].iv_type = fapi::ReturnCode::EI_TYPE_HW_CALLOUT; + l_entries[5].hw_callout.iv_hw = fapi::HwCallouts::MEM_REF_CLOCK; + l_entries[5].hw_callout.iv_calloutPriority = fapi::CalloutPriorities::LOW; - l_rc.addErrorInfo(l_objects, l_entries, 5); + l_rc.addErrorInfo(l_objects, l_entries, 6); do { @@ -847,6 +850,32 @@ uint32_t rcTest12() break; } + if (l_pErrInfo->iv_hwCallouts.size() != 1) + { + FAPI_ERR("rcTest12. %d hw-callouts", + l_pErrInfo->iv_hwCallouts.size()); + l_result = 25; + break; + } + + if (l_pErrInfo->iv_hwCallouts[0]->iv_hw != + HwCallouts::MEM_REF_CLOCK) + { + FAPI_ERR("rcTest12. hw callout mismatch (%d)", + l_pErrInfo->iv_hwCallouts[0]->iv_hw); + l_result = 26; + break; + } + + if (l_pErrInfo->iv_hwCallouts[0]->iv_calloutPriority != + CalloutPriorities::LOW) + { + FAPI_ERR("rcTest12. hw callout priority mismatch (%d)", + l_pErrInfo->iv_hwCallouts[0]->iv_calloutPriority); + l_result = 27; + break; + } + FAPI_INF("rcTest12. Success!"); } while(0); |