diff options
author | Mike Jones <mjjones@us.ibm.com> | 2013-05-24 19:35:47 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2013-06-06 10:16:08 -0500 |
commit | 3d8ff73f2435dda59135776a751d692779b045bb (patch) | |
tree | 2dbce7fa769f58b1317edeab7229c945f62ee794 /src/usr/hwpf/fapi | |
parent | 960225b404132d567d096f75374ae13e74dfcea3 (diff) | |
download | talos-hostboot-3d8ff73f2435dda59135776a751d692779b045bb.tar.gz talos-hostboot-3d8ff73f2435dda59135776a751d692779b045bb.zip |
Allow HWPs to callout a bus
Change-Id: I587cfebfb6cb894f29ca38d0e4a068a016c333bf
RTC: 47147
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/4702
Tested-by: Jenkins Server
Reviewed-by: Van H. Lee <vanlee@us.ibm.com>
Reviewed-by: Brian H. Horton <brianh@linux.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/fapi')
-rw-r--r-- | src/usr/hwpf/fapi/fapiErrorInfo.C | 51 | ||||
-rwxr-xr-x | src/usr/hwpf/fapi/fapiParseErrorInfo.pl | 165 | ||||
-rw-r--r-- | src/usr/hwpf/fapi/fapiReturnCode.C | 139 |
3 files changed, 189 insertions, 166 deletions
diff --git a/src/usr/hwpf/fapi/fapiErrorInfo.C b/src/usr/hwpf/fapi/fapiErrorInfo.C index 1879fefd2..2d700ad7a 100644 --- a/src/usr/hwpf/fapi/fapiErrorInfo.C +++ b/src/usr/hwpf/fapi/fapiErrorInfo.C @@ -39,6 +39,7 @@ * structures into one * mjjones 09/19/2012 Replace FFDC type with ID * mjjones 03/22/2013 Support Procedure Callouts + * mjjones 05/20/2013 Support Bus Callouts */ #include <fapiErrorInfo.H> @@ -89,12 +90,28 @@ ErrorInfoProcedureCallout::ErrorInfoProcedureCallout( } //****************************************************************************** +// ErrorInfoProcedureCallout Constructor +//****************************************************************************** +ErrorInfoBusCallout::ErrorInfoBusCallout( + const Target & i_target1, + const Target & i_target2, + const CalloutPriorities::CalloutPriority i_calloutPriority) +: iv_target1(i_target1), iv_target2(i_target2), + iv_calloutPriority(i_calloutPriority) +{ + +} + +//****************************************************************************** // ErrorInfoCDG Constructor //****************************************************************************** -ErrorInfoCDG::ErrorInfoCDG(const Target & i_target) -: iv_target(i_target), iv_callout(false), - iv_calloutPriority(CalloutPriorities::LOW), iv_deconfigure(false), - iv_gard(false) +ErrorInfoCDG::ErrorInfoCDG(const Target & i_target, + const bool i_callout, + const bool i_deconfigure, + const bool i_gard, + const CalloutPriorities::CalloutPriority i_priority) +: iv_target(i_target), iv_callout(i_callout), iv_calloutPriority(i_priority), + iv_deconfigure(i_deconfigure), iv_gard(i_gard) { } @@ -127,30 +144,4 @@ ErrorInfo::~ErrorInfo() } } -//****************************************************************************** -// ErrorInfo getCreateErrorInfoCDG -//****************************************************************************** -ErrorInfoCDG & ErrorInfo::getCreateErrorInfoCDG(const Target & i_target) -{ - ErrorInfoCDG * l_pInfo = NULL; - - for (ErrorInfo::ErrorInfoCDGCItr_t l_itr = iv_CDGs.begin(); - l_itr != iv_CDGs.end(); ++l_itr) - { - if ((*l_itr)->iv_target == i_target) - { - l_pInfo = (*l_itr); - break; - } - } - - if (l_pInfo == NULL) - { - l_pInfo = new ErrorInfoCDG(i_target); - iv_CDGs.push_back(l_pInfo); - } - - return *l_pInfo; -} - } diff --git a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl index 4076ff5b0..8ca5884c6 100755 --- a/src/usr/hwpf/fapi/fapiParseErrorInfo.pl +++ b/src/usr/hwpf/fapi/fapiParseErrorInfo.pl @@ -54,6 +54,7 @@ # mjjones 03/22/13 Support Procedure Callouts # mjjones 04/25/13 Allow multiple register ffdc ids in a # collectRegisterFfdc element +# mjjones 05/20/13 Support Bus Callouts # # End Change Log ****************************************************** @@ -189,10 +190,10 @@ sub setErrorEnumValue } #------------------------------------------------------------------------------ -# Subroutine that figures out an FFDC enum value from an FFDC name and stores -# it in global hashes +# Subroutine that figures out an FFDC ID value from an FFDC name and stores it +# in global hashes for use when creating the enumeration of FFDC IDs #------------------------------------------------------------------------------ -sub setFfdcEnumValue +sub setFfdcIdValue { my $name = $_[0]; @@ -445,72 +446,86 @@ foreach my $argnum (1 .. $#ARGV) my @eiObjects; my $eiObjectStr = "const void * l_objects[] = {"; - my $eiEntryStr = "fapi::ReturnCode::ErrorInfoEntry l_entries[] = {"; + my $eiEntryStr = ""; my $eiEntryCount = 0; + my %cdgHash; # Records the callout/deconfigure/gards for each Target # Local FFDC foreach my $ffdc (@{$err->{ffdc}}) { - # Set the FFDC enum value in a global hash. The name is <rc>_<ffdc> + # Set the FFDC ID value in a global hash. The name is <rc>_<ffdc> my $ffdcName = $err->{rc} . "_"; $ffdcName = $ffdcName . $ffdc; - setFfdcEnumValue($ffdcName); + setFfdcIdValue($ffdcName); # Add the FFDC data to the EI Object array if it doesn't already exist my $objNum = addEntryToArray(\@eiObjects, $ffdc); - # Add an EI entry to eiEntryStr. - if ($eiEntryCount > 0) - { - $eiEntryStr .= ", "; - } - $eiEntryStr .= "{fapi::ReturnCode::EI_TYPE_FFDC, $objNum, fapi::ReturnCodeFfdc::getErrorInfoFfdcSize($ffdc), fapi::$ffdcName}"; + # Add an EI entry to eiEntryStr + $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi::ReturnCode::EI_TYPE_FFDC; \\\n"; + $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcObjIndex = $objNum; \\\n"; + $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcId = fapi::$ffdcName; \\\n"; + $eiEntryStr .= " l_entries[$eiEntryCount].ffdc.iv_ffdcSize = fapi::ReturnCodeFfdc::getErrorInfoFfdcSize($ffdc); \\\n"; $eiEntryCount++; } - # Procedure/Target callouts + # Procedure/Target/Bus callouts foreach my $callout (@{$err->{callout}}) { - if ((! exists $callout->{target}) && (! exists $callout->{procedure})) - { - print ("fapiParseErrorInfo.pl ERROR. Callout procedure/target missing\n"); - exit(1); - } - if (! exists $callout->{priority}) { print ("fapiParseErrorInfo.pl ERROR. Callout priority missing\n"); exit(1); } - my $objNum = 0; - if (exists $callout->{target}) + if (exists $callout->{procedure}) { - # Check the type - print EIFILE - "fapi::fapiCheckType<const fapi::Target *>(&$callout->{target}); "; - - # Add the Target to the objectlist if it doesn't already exist - $objNum = addEntryToArray(\@eiObjects, $callout->{target}); + # Procedure Callout + # Add an EI entry to eiEntryStr + $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi::ReturnCode::EI_TYPE_PROCEDURE_CALLOUT; \\\n"; + $eiEntryStr .= " l_entries[$eiEntryCount].proc_callout.iv_procedure = fapi::ProcedureCallouts::$callout->{procedure}; \\\n"; + $eiEntryStr .= " l_entries[$eiEntryCount].proc_callout.iv_calloutPriority = fapi::CalloutPriorities::$callout->{priority}; \\\n"; + $eiEntryCount++; } - - # Add an EI entry to eiEntryStr - if ($eiEntryCount > 0) + elsif (exists $callout->{bus}) { - $eiEntryStr .= ", "; + # A Bus Callout consists of two targets separated by + # commas/spaces + my @targets = split(/\s*,\s*|\s+/, $callout->{bus}); + + if (scalar @targets != 2) + { + print ("fapiParseErrorInfo.pl ERROR. did not find two targets in bus callout\n"); + exit(1); + } + + # Check the type of the Targets + print EIFILE "fapi::fapiCheckType<const fapi::Target *>(&$targets[0]); \\\n"; + print EIFILE "fapi::fapiCheckType<const fapi::Target *>(&$targets[1]); \\\n"; + + # Add the Targets to the objectlist if they don't already exist + my $objNum1 = addEntryToArray(\@eiObjects, $targets[0]); + my $objNum2 = addEntryToArray(\@eiObjects, $targets[1]); + + # Add an EI entry to eiEntryStr + $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi::ReturnCode::EI_TYPE_BUS_CALLOUT; \\\n"; + $eiEntryStr .= " l_entries[$eiEntryCount].bus_callout.iv_endpoint1ObjIndex = $objNum1; \\\n"; + $eiEntryStr .= " l_entries[$eiEntryCount].bus_callout.iv_endpoint2ObjIndex = $objNum2; \\\n"; + $eiEntryStr .= " l_entries[$eiEntryCount].bus_callout.iv_calloutPriority = fapi::CalloutPriorities::$callout->{priority}; \\\n"; + $eiEntryCount++; } - - if (exists $callout->{target}) + elsif (exists $callout->{target}) { - $eiEntryStr .= - "{fapi::ReturnCode::EI_TYPE_CALLOUT, $objNum, fapi::CalloutPriorities::$callout->{priority}, 0}"; + # Add the Target to cdgHash to be processed with any + # deconfigure and GARD requests + $cdgHash{$callout->{target}}{callout} = 1; + $cdgHash{$callout->{target}}{priority} = $callout->{priority}; } else { - $eiEntryStr .= - "{fapi::ReturnCode::EI_TYPE_PROCEDURE_CALLOUT, 0, fapi::CalloutPriorities::$callout->{priority}, fapi::ProcedureCallouts::$callout->{procedure}}"; + print ("fapiParseErrorInfo.pl ERROR. Callout procedure/target/bus missing\n"); + exit(1); } - $eiEntryCount++; } # Target deconfigures @@ -522,19 +537,9 @@ foreach my $argnum (1 .. $#ARGV) exit(1); } - # Check the type - print EIFILE "fapi::fapiCheckType<const fapi::Target *>(&$deconfigure->{target}); "; - - # Add the Target to the objectlist if it doesn't already exist - my $objNum = addEntryToArray(\@eiObjects, $deconfigure->{target}); - - # Add an EI entry to eiEntryStr - if ($eiEntryCount > 0) - { - $eiEntryStr .= ", "; - } - $eiEntryStr .= "{fapi::ReturnCode::EI_TYPE_DECONF, $objNum, 0, 0}"; - $eiEntryCount++; + # Add the Target to cdgHash to be processed with any + # callout and gard requests + $cdgHash{$deconfigure->{target}}{deconf} = 1; } # Target Gards @@ -546,24 +551,52 @@ foreach my $argnum (1 .. $#ARGV) exit(1); } + # Add the Target to cdgHash (this target may also have + # callout and deconfigure requests + $cdgHash{$gard->{target}}{gard} = 1; + } + + # Process the callout, deconfigures and GARDs for each Target + foreach my $cdg (keys %cdgHash) + { # Check the type - print EIFILE "fapi::fapiCheckType<const fapi::Target *>(&$gard->{target}); "; + print EIFILE "fapi::fapiCheckType<const fapi::Target *>(&$cdg); \\\n"; - # Add the Target to the objectlist if it doesn't already exist - my $objNum = addEntryToArray(\@eiObjects, $gard->{target}); + my $callout = 0; + my $priority = 'LOW'; + my $deconf = 0; + my $gard = 0; - # Add an EI entry to eiEntryStr - if ($eiEntryCount > 0) + if (exists $cdgHash{$cdg}->{callout}) + { + $callout = 1; + } + if (exists $cdgHash{$cdg}->{priority}) { - $eiEntryStr .= ", "; + $priority = $cdgHash{$cdg}->{priority}; } - $eiEntryStr .= "{fapi::ReturnCode::EI_TYPE_GARD, $objNum, 0, 0}"; + if (exists $cdgHash{$cdg}->{deconf}) + { + $deconf = 1; + } + if (exists $cdgHash{$cdg}->{gard}) + { + $gard = 1; + } + + # Add the Target to the objectlist if it doesn't already exist + my $objNum = addEntryToArray(\@eiObjects, $cdg); + + # Add an EI entry to eiEntryStr + $eiEntryStr .= " l_entries[$eiEntryCount].iv_type = fapi::ReturnCode::EI_TYPE_CDG; \\\n"; + $eiEntryStr .= " l_entries[$eiEntryCount].target_cdg.iv_targetObjIndex = $objNum; \\\n"; + $eiEntryStr .= " l_entries[$eiEntryCount].target_cdg.iv_callout = $callout; \\\n"; + $eiEntryStr .= " l_entries[$eiEntryCount].target_cdg.iv_deconfigure = $deconf; \\\n"; + $eiEntryStr .= " l_entries[$eiEntryCount].target_cdg.iv_gard = $gard; \\\n"; + $eiEntryStr .= " l_entries[$eiEntryCount].target_cdg.iv_calloutPriority = fapi::CalloutPriorities::$priority; \\\n"; $eiEntryCount++; } - # Complete $eiEntryStr - $eiEntryStr .= "};"; - # Add all objects to $eiObjectStr my $objCount = 0; @@ -581,8 +614,10 @@ foreach my $argnum (1 .. $#ARGV) # Print info to file if ($eiEntryCount > 0) { - print EIFILE "{$eiObjectStr $eiEntryStr "; - print EIFILE "RC.addErrorInfo(l_objects, l_entries, $eiEntryCount);}"; + print EIFILE "\\\n{ \\\n $eiObjectStr \\\n"; + print EIFILE " fapi::ReturnCode::ErrorInfoEntry l_entries[$eiEntryCount]; \\\n"; + print EIFILE "$eiEntryStr"; + print EIFILE " RC.addErrorInfo(l_objects, l_entries, $eiEntryCount); \\\n}"; } print EIFILE "\n\n"; } @@ -608,9 +643,9 @@ foreach my $argnum (1 .. $#ARGV) } #---------------------------------------------------------------------- - # Set the FFDC enum value in a global hash + # Set the FFDC ID value in a global hash #---------------------------------------------------------------------- - setFfdcEnumValue($registerFfdc->{id}[0]); + setFfdcIdValue($registerFfdc->{id}[0]); #---------------------------------------------------------------------- # Generate code to capture the registers in fapiCollectRegFfdc.C diff --git a/src/usr/hwpf/fapi/fapiReturnCode.C b/src/usr/hwpf/fapi/fapiReturnCode.C index 0de6126cb..621b649e1 100644 --- a/src/usr/hwpf/fapi/fapiReturnCode.C +++ b/src/usr/hwpf/fapi/fapiReturnCode.C @@ -49,6 +49,7 @@ * mjjones 08/14/2012 Use new ErrorInfo structure * mjjones 09/19/2012 Add FFDC ID to error info * mjjones 03/22/2013 Support Procedure Callouts + * mjjones 05/20/2013 Support Bus Callouts */ #include <fapiReturnCode.H> @@ -231,22 +232,19 @@ void ReturnCode::addErrorInfo(const void * const * i_pObjects, { for (uint32_t i = 0; i < i_count; i++) { - // Figure out the object that this ErrorInfo refers to - const void * l_pObject = i_pObjects[i_pEntries[i].iv_object]; + ErrorInfoType l_type = static_cast<ErrorInfoType>( + i_pEntries[i].iv_type); - if (i_pEntries[i].iv_type == EI_TYPE_FFDC) + if (l_type == EI_TYPE_FFDC) { - // Get the size of the object to add as FFDC - int8_t l_size = i_pEntries[i].iv_data1; - uint32_t l_ffdcId = i_pEntries[i].iv_data2; + uint8_t l_objIndex = i_pEntries[i].ffdc.iv_ffdcObjIndex; + uint16_t l_size = i_pEntries[i].ffdc.iv_ffdcSize; + uint32_t l_ffdcId = i_pEntries[i].ffdc.iv_ffdcId; - if (l_size > 0) - { - // This is a regular FFDC data object that can be directly - // memcopied - addEIFfdc(l_ffdcId, l_pObject, l_size); - } - else if (l_size == ReturnCodeFfdc::EI_FFDC_SIZE_ECMDDB) + // Get the object to add as FFDC + const void * l_pObject = i_pObjects[l_objIndex]; + + if (l_size == ReturnCodeFfdc::EI_FFDC_SIZE_ECMDDB) { // The FFDC is a ecmdDataBufferBase const ecmdDataBufferBase * l_pDb = @@ -275,57 +273,65 @@ void ReturnCode::addErrorInfo(const void * const * i_pObjects, } else { - FAPI_ERR("addErrorInfo: Unrecognized FFDC data: %d", l_size); + // This is a regular FFDC data object that can be directly + // memcopied + addEIFfdc(l_ffdcId, l_pObject, l_size); } } - else if (i_pEntries[i].iv_type == EI_TYPE_PROCEDURE_CALLOUT) + else if (l_type == EI_TYPE_PROCEDURE_CALLOUT) { ProcedureCallouts::ProcedureCallout l_proc = - static_cast<ProcedureCallouts::ProcedureCallout> - (i_pEntries[i].iv_data2); + static_cast<ProcedureCallouts::ProcedureCallout>( + i_pEntries[i].proc_callout.iv_procedure); CalloutPriorities::CalloutPriority l_pri = - static_cast<CalloutPriorities::CalloutPriority> - (i_pEntries[i].iv_data1); + static_cast<CalloutPriorities::CalloutPriority>( + i_pEntries[i].proc_callout.iv_calloutPriority); // Add the ErrorInfo FAPI_ERR("addErrorInfo: Adding proc callout, proc: %d, pri: %d", l_proc, l_pri); addEIProcedureCallout(l_proc, l_pri); } - else if (i_pEntries[i].iv_type == EI_TYPE_CALLOUT) + else if (l_type == EI_TYPE_BUS_CALLOUT) { - // Get a pointer to the Target to callout and the priority - const Target * l_pTarget = static_cast<const Target *>(l_pObject); + uint8_t l_ep1Index = i_pEntries[i].bus_callout.iv_endpoint1ObjIndex; + uint8_t l_ep2Index = i_pEntries[i].bus_callout.iv_endpoint2ObjIndex; CalloutPriorities::CalloutPriority l_pri = - static_cast<CalloutPriorities::CalloutPriority> - (i_pEntries[i].iv_data1); + static_cast<CalloutPriorities::CalloutPriority>( + i_pEntries[i].bus_callout.iv_calloutPriority); - // Add the ErrorInfo - FAPI_ERR("addErrorInfo: Adding target callout, pri: %d", l_pri); - addEICallout(*l_pTarget, l_pri); - } - else if (i_pEntries[i].iv_type == EI_TYPE_DECONF) - { - // Get a pointer to the Target to deconfigure - const Target * l_pTarget = static_cast<const Target *>(l_pObject); + // Get the endpoint Targets for the bus to callout + const Target * l_pTarget1 = static_cast<const Target *>( + i_pObjects[l_ep1Index]); + const Target * l_pTarget2 = static_cast<const Target *>( + i_pObjects[l_ep2Index]); // Add the ErrorInfo - FAPI_ERR("addErrorInfo: Adding deconfigure"); - addEIDeconfigure(*l_pTarget); + FAPI_ERR("addErrorInfo: Adding bus callout, pri: %d", l_pri); + addEIBusCallout(*l_pTarget1, *l_pTarget2, l_pri); } - else if (i_pEntries[i].iv_type == EI_TYPE_GARD) + else if (l_type == EI_TYPE_CDG) { - // Get a pointer to the Target to create a GARD record for - const Target * l_pTarget = static_cast<const Target *>(l_pObject); + uint8_t l_targIndex = i_pEntries[i].target_cdg.iv_targetObjIndex; + uint8_t l_callout = i_pEntries[i].target_cdg.iv_callout; + uint8_t l_deconf = i_pEntries[i].target_cdg.iv_deconfigure; + uint8_t l_gard = i_pEntries[i].target_cdg.iv_gard; + CalloutPriorities::CalloutPriority l_pri = + static_cast<CalloutPriorities::CalloutPriority>( + i_pEntries[i].target_cdg.iv_calloutPriority); + + // Get the Target to cdg + const Target * l_pTarget = static_cast<const Target *>( + i_pObjects[l_targIndex]); // Add the ErrorInfo - FAPI_ERR("addErrorInfo: Adding GARD"); - addEIGard(*l_pTarget); + FAPI_ERR("addErrorInfo: Adding target cdg (%d%d%d), pri: %d", + l_callout, l_deconf, l_gard, l_pri); + addEICdg(*l_pTarget, l_callout, l_deconf, l_gard, l_pri); } else { - FAPI_ERR("addErrorInfo: Unrecognized EI type: %d", - i_pEntries[i].iv_type); + FAPI_ERR("addErrorInfo: Unrecognized EI type: %d", l_type); } } } @@ -425,44 +431,35 @@ void ReturnCode::addEIProcedureCallout( } //****************************************************************************** -// addEICallout function +// addEIBusCallout function //****************************************************************************** -void ReturnCode::addEICallout( - const Target & i_target, +void ReturnCode::addEIBusCallout( + const Target & i_target1, + const Target & i_target2, const CalloutPriorities::CalloutPriority i_priority) { - // Get/Create a ErrorInfoCDG object for the target and update the callout - ErrorInfoCDG & l_errorInfoCdg = getCreateReturnCodeDataRef(). - getCreateErrorInfo().getCreateErrorInfoCDG(i_target); - l_errorInfoCdg.iv_callout = true; - - // If the same target is called out multiple times, use the highest priority - if (i_priority > l_errorInfoCdg.iv_calloutPriority) - { - l_errorInfoCdg.iv_calloutPriority = i_priority; - } -} - -//****************************************************************************** -// addEIDeconfigure function -//****************************************************************************** -void ReturnCode::addEIDeconfigure(const Target & i_target) -{ - // Get/Create a ErrorInfoCDG object for the target and update the deconfig - ErrorInfoCDG & l_errorInfoCdg = getCreateReturnCodeDataRef(). - getCreateErrorInfo().getCreateErrorInfoCDG(i_target); - l_errorInfoCdg.iv_deconfigure = true; + // Create an ErrorInfoBusCallout object and add it to the Error Information + ErrorInfoBusCallout * l_pCallout = new ErrorInfoBusCallout( + i_target1, i_target2, i_priority); + getCreateReturnCodeDataRef().getCreateErrorInfo(). + iv_busCallouts.push_back(l_pCallout); } //****************************************************************************** -// addEIGard function +// addEICdg function //****************************************************************************** -void ReturnCode::addEIGard(const Target & i_target) +void ReturnCode::addEICdg( + const Target & i_target, + const bool i_callout, + const bool i_deconfigure, + const bool i_gard, + const CalloutPriorities::CalloutPriority i_priority) { - // Get/Create a ErrorInfoCDG object for the target and update the GARD - ErrorInfoCDG & l_errorInfoCdg = getCreateReturnCodeDataRef(). - getCreateErrorInfo().getCreateErrorInfoCDG(i_target); - l_errorInfoCdg.iv_gard = true; + // Create an ErrorInfoCDG object and add it to the Error Information + ErrorInfoCDG * l_pCdg = new ErrorInfoCDG(i_target, i_callout, i_deconfigure, + i_gard, i_priority); + getCreateReturnCodeDataRef().getCreateErrorInfo(). + iv_CDGs.push_back(l_pCdg); } } |