diff options
Diffstat (limited to 'src/usr/diag/prdf/common/framework/service')
15 files changed, 7383 insertions, 0 deletions
diff --git a/src/usr/diag/prdf/common/framework/service/iipServiceDataCollector.h b/src/usr/diag/prdf/common/framework/service/iipServiceDataCollector.h new file mode 100755 index 000000000..fd9083c3b --- /dev/null +++ b/src/usr/diag/prdf/common/framework/service/iipServiceDataCollector.h @@ -0,0 +1,1042 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/service/iipServiceDataCollector.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1998,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef iipServiceDataCollector_h +#define iipServiceDataCollector_h +// Class Description ************************************************* +// +// Name: ServiceDataCollector +// Base class: None +// +// Description: +// Usage: +// +// End Class Description ********************************************* + +#ifndef PRDF_SDC_FLAGS_MAP_ONLY + #define PRDF_SDC_FLAGS_MAP \ + enum Flag { + #define PRDF_SDC_FLAG(name, value) \ + name = value, + #define PRDF_SDC_FLAGS_MAP_END \ + }; +#endif + +#ifndef PRDF_SDC_FLAGS_MAP_ONLY + +#if !defined(ErrorSignature_h) +#include <prdfErrorSignature.H> +#endif + +#if !defined(iipCaptureData_h) +#include <iipCaptureData.h> +#endif + +#include <vector> +#include <time.h> + +#include <prdfCallouts.H> +#include <prdfMain.H> + +#if !defined(PRDFTIMER_H) // dg08 +#include <prdfTimer.H> // dg08 +#endif // dg08 + +#if !defined(xspprdGardResolution_h) +#include <xspprdGardResolution.h> // for ErrorType +#endif + +#include <prdfAssert.h> +#if( !defined(CONTEXT_x86_nfp) && !defined(_NFP) ) //only for ppc context (@54) +#include <prdfPlatServices.H> +#include <iipsdbug.h> +#endif + +#ifndef __HOSTBOOT_MODULE + +#include <hdctContent.H> + +#if( !defined(CONTEXT_x86_nfp) && !defined(_NFP) ) //only for ppc context (@54) +#include <hcdbEntryStates.H> +#include <hcdbCompSubType.H> +#include <fips_comp_id.H> +#endif + +#endif + +// dg07 start +struct SdcCallout { + PRDF::PRDcallout callout; + PRDF::PRDpriority priority; + //bool gard; + SdcCallout() : callout(NULL), priority(PRDF::MRU_LOW) {} + SdcCallout(PRDF::PRDcallout & mru, PRDF::PRDpriority p) + : callout(mru), priority(p) + {} + SdcCallout(TARGETING::TargetHandle_t i_pcalloutHandle , PRDF::PRDpriority p) + : callout(i_pcalloutHandle), priority(p) + {} +}; + +typedef std::vector<SdcCallout> SDC_MRU_LIST; + +#ifndef __HOSTBOOT_MODULE + +struct PrdfHcdbChangeItem { + TARGETING::TargetHandle_t iv_phcdbtargetHandle ; + hcdb::comp_subtype_t iv_compSubType; + comp_id_t iv_compType; + PrdfHcdbChangeItem() : iv_phcdbtargetHandle(NULL), iv_compSubType(hcdb::LBST_ABIST) {} + PrdfHcdbChangeItem(TARGETING::TargetHandle_t i_pTargetHandle, hcdb::comp_subtype_t i_compSubType, comp_id_t i_compType) + : iv_phcdbtargetHandle(i_pTargetHandle), iv_compSubType(i_compSubType), iv_compType(i_compType){} +}; + +typedef std::vector<PrdfHcdbChangeItem> HCDB_CHANGE_LIST; + +#endif + +struct PrdfSignatureList { + TARGETING::TargetHandle_t iv_pSignatureHandle; + uint32_t iv_signature; + PrdfSignatureList() : iv_pSignatureHandle(NULL), iv_signature(0) {} + PrdfSignatureList(TARGETING::TargetHandle_t i_pTargetHandle , uint32_t i_signature) + : iv_pSignatureHandle(i_pTargetHandle), iv_signature(i_signature){} +}; + +typedef std::vector<PrdfSignatureList> PRDF_SIGNATURES; + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +/** + Collecter of service data + @version fips1 + @author Douglas R. Gilbert + */ +class ServiceDataCollector +{ +public: + +#endif // PRDF_SDC_FLAGS_MAP_ONLY + + + //mk03c + PRDF_SDC_FLAGS_MAP // flag positions + PRDF_SDC_FLAG(FORCE_LATENT_CS, 0x80000) // mp07 + PRDF_SDC_FLAG(USING_SAVED_SDC, 0x40000) // mp05 + PRDF_SDC_FLAG(PROC_CORE_CS, 0x20000) // mp03 + PRDF_SDC_FLAG(UNIT_CS, 0x20000) // mp06 a (Note this is intentionally the same value as PROC_CORE_CS) + PRDF_SDC_FLAG(THERMAL_EVENT, 0x10000) // pw01 + PRDF_SDC_FLAG(MP_DUMP_REQ, 0x08000) // rc09 + PRDF_SDC_FLAG(MP_RESET_REQ, 0x04000) // dg08 + PRDF_SDC_FLAG(MP_FATAL, 0x02000) // dg08 + PRDF_SDC_FLAG(DONT_COMMIT_ERRL, 0x01000) // mp02 + PRDF_SDC_FLAG(DUMP, 0x00800) // dg04 + PRDF_SDC_FLAG(UERE, 0x00400) // dg02 + PRDF_SDC_FLAG(SUE, 0x00200) // dg02 + PRDF_SDC_FLAG(CRUMB, 0x00100) + PRDF_SDC_FLAG(AT_THRESHOLD, 0x00080) + PRDF_SDC_FLAG(DEGRADED, 0x00040) + PRDF_SDC_FLAG(SERVICE_CALL, 0x00020) + PRDF_SDC_FLAG(TRACKIT, 0x00010) + PRDF_SDC_FLAG(TERMINATE, 0x00008) + PRDF_SDC_FLAG(LOGIT, 0x00004) + PRDF_SDC_FLAG(MEMORY_STEERED, 0x00002) + PRDF_SDC_FLAG(FLOODING, 0x00001) + PRDF_SDC_FLAGS_MAP_END + +#ifndef PRDF_SDC_FLAGS_MAP_ONLY + + + /** + CTOR + <ul> + <br><b>Parameters: </b> none + <br><b>Returns: </b> none + <br><b>Requirements:</b> none + <br><b>Promises: </b> Object created + <ul><li> IsServiceCall() == false + <li> IsAtThreshold() == false + <li> terminate() == false + <li> IsDegraded() == false + <li> IsServiceCall() == false + <li> IsMemorySteered == false + <li> IsMfgTracking() == true + <li> IsLogging() == true + </ul> + <br><b>Exceptions: </b> None. + </ul><br> + */ + ServiceDataCollector(); + + // Function Specification ******************************************** + // + // Purpose: Destruction + // Parameters: None. + // Returns: No value returned + // Requirements: None. + // Promises: None. + // Exceptions: None. + // Concurrency: Reentrant + // Notes: Default destructor is sufficient (for now) + // + // End Function Specification **************************************** + //~ServiceDataCollector(); + + /** + Get access to the error signature object + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> ErrorSignature * + <br><b>Requirements:</b> none + <br><b>Promises: </b> none + <br><b>Exceptions: </b> None. + </ul><br> + */ + ErrorSignature * GetErrorSignature() {return(&error_signature);} + + /** + * @brief Sets a new signature in the error signature object. + * @param i_signature The new signature. + */ + void SetErrorSig( uint32_t i_signature ) + { error_signature.setSigId( i_signature ); } + + /** + Get access to the captureData object + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> Capture Data * + <br><b>Requirements:</b> none + <br><b>Promises: </b> none + <br><b>Exceptions: </b> None. + </ul><br> + */ + CaptureData & GetCaptureData() {return(captureData);} + + /** + Add a mru to the Callout list + <ul> + <br><b>Parameters: </b> a valid PRDcallout & PRDpriority + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None + <br><b>Promises: </b> GetMruList().GetCount()++ + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> No implementation for Apache or Northstar + </ul><br> + */ + void SetCallout( PRDF::PRDcallout mru, + PRDF::PRDpriority priority = PRDF::MRU_MED ); + + /** + Add a change to the prd signature List + */ + void AddSignatureList(TARGETING::TargetHandle_t i_ptargetHandle =NULL, + uint32_t i_signature = 0x00000000); + + /** + Access the list of Mrus + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> SDC_MRU_LIST + @see MruListClass + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> No implementation for Apache or Northstar + </ul><br> + */ + SDC_MRU_LIST & GetMruList(void); // dg07 + + PRDF_SIGNATURES & GetSignatureList(void); // jl00 + + /** + Clear the list of MruCallouts + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> None. + <br><b>Requirements:</b> + <br><b>Promises: </b> GetCallouts().size() == 0 + <br><b>Exceptions: </b> None. + </ul><br> + */ + void ClearCallouts(void); + + void ClearSignatureList(void); + /** + Query for threshold + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> [true | false] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + bool IsAtThreshold(void) const { return (flags & AT_THRESHOLD)!=0 ? true:false; } + + /** + Query for need to terminate is machine + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> [true | false] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + bool Terminate(void) const { return (flags & TERMINATE) != 0 ? true:false; } + + /** + Set the global attention type + <ul> + <br><b>Parameters: </b> attention type. + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> GetAttentionType() == attention, + If(attention == MACHINE_CHECK) IsServiceCall() == true + <br><b>Exceptions: </b> None. + </ul><br> + */ + void SetAttentionType(ATTENTION_TYPE attention); + + /** + Set the cause attention type + <ul> + <br><b>Parameters: </b> attention type. + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> GetCauseAttentionType() == attention + <br><b>Exceptions: </b> None. + </ul><br> + */ + void SetCauseAttentionType(ATTENTION_TYPE attention); // rc09a + + /** + Get the global attention type + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> Attention type [MACHINE_CHECK | RECOVERABLE | SPECIAL] + <br><b>Requirements:</b> SetAttentionType() + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + ATTENTION_TYPE GetAttentionType(void) const { return attentionType; } + + /** + Get the cause attention type + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> Attention type [MACHINE_CHECK | RECOVERABLE | SPECIAL] + <br><b>Requirements:</b> SetCauseAttentionType() + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + ATTENTION_TYPE GetCauseAttentionType(void) const { return causeAttentionType; } // rc09a + + /** + Set the mask id of the error to mask at threshold + <ul> + <br><b>Parameters: </b> Mask id + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None + <br><b>Promises: </b> GetThresholdMaskId() == mask_id, + IsDegraded() == true, + IsAtThreshold() == true, + IsServiceCall() == true + <br><b>Exceptions: </b> None. + </ul><br> + */ + void SetThresholdMaskId(uint32_t mask_id); + + /** + Query for Hardware running deraded + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> [true | false] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + bool IsDegraded(void) const { return (flags & DEGRADED)!=0 ? true:false; } + + /** + Get the mask ID to mask off the error when thresholding + <ul> + <br><b>Parameters: </b> none + <br><b>Returns: </b> Mask id + <br><b>Requirements:</b> SetThresholdMaskId(...) + <br><b>Promises: </b> none. + <br><b>Exceptions: </b> None. + </ul><br> + */ + uint32_t GetThresholdMaskId(void) const; + + /** + Indicate that no tracking is needed in the manufacturing log + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> IsMfgTracking() == false + <br><b>Exceptions: </b> None. + </ul><br> + */ + void NoMfgTracking(void) { flags &= ~TRACKIT; } + + /** + Query for need to track in manufacturing log + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> [true | false] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + bool IsMfgTracking(void) const { return (flags & TRACKIT)!=0 ? true:false; } + + /** + Indicate that no system log should be generated + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> none. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> IsLogging() == false + <br><b>Exceptions: </b> None. + </ul><br> + */ + void Nologging(void) { flags &= ~LOGIT; } + + /** + Query for need to make a system error log + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> [true | false] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + bool IsLogging(void) const { return (flags & LOGIT)!=0 ? true:false; } + + /** + * @brief Sets flag to indicate not to commit the error log. + */ + void DontCommitErrorLog() { flags |= DONT_COMMIT_ERRL; } + + /** + * @brief Queries if the 'Don't Commit Error Log' flag is on. + * @return TRUE if DONT_COMMIT_ERRL flag is set, FALSE otherwise. + */ + bool IsDontCommitErrl() const + { + #ifndef ESW_SIM_COMPILE + return ( 0 != (flags & DONT_COMMIT_ERRL) ); + #else + return false; + #endif + } + + /** + Indicate that a service is needed + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> none. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> IsServiceCall() == true + <br><b>Exceptions: </b> None. + </ul><br> + */ + void SetServiceCall(void) { flags |= SERVICE_CALL; } + + /** + Query for need of a Service Call + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> [true | false] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + bool IsServiceCall(void) const { return (flags & SERVICE_CALL)!=0 ? true:false; } + +// dg12d - start + /* + Indicate that mainstore has had redundent memory steered in + <ul> + <br><b>Parameter: </b> offset: offset in card vpd to write bitPos + <br><b>Parameter: </b> bitPos: bit position steered in this extent + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> IsMemorySteered() == true, this object contains + VPD data that needs to be transferred to VPD + <br><b>Exceptions: </b> None. + </ul><br> + */ +// void SetMemorySteered(uint32_t offset, uint32_t bitPos); + + /** + Query for mainstore redundent steering + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> [true | false] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> GetRbsVpdData() returns new data to be + transfered to VPD + <br><b>Notes: </b> Depreciated - always returns false + </ul><br> + */ + bool IsMemorySteered(void) const { return (flags & MEMORY_STEERED)!=0 ? true:false; } + + /* + Get the latest RBS vpd data + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> Bitstring + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> if SetMemorySteered() has not been called or + IsMemorySteered() == false then this + returns data that indicates that nothing has + been steered + </ul><br> + */ +// const BIT_STRING_CLASS & GetRbsVpdData(void) const { return rbsVpd; } +// dg12d - end + + /** + Indicate the chip where analysis begain + <ul> + <br><b>Parameters: </b> i_pchipHandle + <br><b>Returns: </b> none. + <br><b>Requirements:</b> none. + <br><b>Promises: </b> GetStartingChip() == chid + <br><b>Exceptions: </b> None. + </ul><br> + */ + void SetStartingChip(TARGETING::TargetHandle_t i_pchipHandle) + { + startingPoint = i_pchipHandle; + } + + /** + Get the chip id of the chip PRD picked as a starting point + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> chip id + <br><b>Requirements:</b> SetStartingChip() + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + TARGETING::TargetHandle_t GetStartingChip(void) const {return startingPoint;} + + /** + Set the number of times this error has been seen since IPL + <ul> + <br><b>Parameters: </b> hit count + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> GetHits() == inhits + <br><b>Exceptions: </b> None. + </ul><br> + */ + void SetHits(uint8_t inhits) { hitCount = inhits; } + + /** + Get the number of times this error has been seen since IPL + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> hit count + <br><b>Requirements:</b> SetHits() + <br><b>Promises: </b> None + <br><b>Exceptions: </b> None. + </ul><br> + */ + uint8_t GetHits(void) const { return hitCount; } + + /** + Indicate the threshold for this error + <ul> + <br><b>Parameters: </b> threshold + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> GetThreshold() == inthold + <br><b>Exceptions: </b> None. + </ul><br> + */ + void SetThreshold(uint8_t inthold) { threshold = inthold; } + + /** + Get the threshold value for this error + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> threshold value + <br><b>Requirements:</b> SetThreshold() + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> optional + </ul><br> + */ + uint8_t GetThreshold(void) const { return threshold; } + + //mp04 a Start + /** + Indicate the Reason Code (for the SRC) for this error + <ul> + <br><b>Parameters: </b> reasonCode + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> GetReasonCode() == i_reasonCode + <br><b>Exceptions: </b> None. + </ul><br> + */ + void SetReasonCode(uint16_t i_reasonCode) { reasonCode = i_reasonCode; } + + /** + Get the Reason Code value for this error + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> reasonCode value + <br><b>Requirements:</b> SetReasonCode() + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> optional + </ul><br> + */ + uint16_t GetReasonCode(void) const { return reasonCode; } + //mp04 a Stop + + /** + Indicate that PRD is being called faster than SP can send error logs + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> IsFlooding() == true + <br><b>Exceptions: </b> None. + </ul><br> + */ + void SetFlooding(void) { flags |= FLOODING; } + + /** + Query for flooding + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> [true | false] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + bool IsFlooding(void) const { return (flags & FLOODING)!=0 ? true:false; } + + /** + Set ErrorType for Gard + <ul> + <br><b>Parameter </b> GardResolution::ErrorType + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None + <br><b>Promises </b> QueryRepeatGard() == et + <br><b>Notes: </b> + </ul><br> + */ + void Gard(GardResolution::ErrorType et) { errorType = et; } + + /** + Query for RepeatGard ErrorType + <ul> + <br><b>Paramters </b> None. + <br><b>Returns: </b> GardResolution::ErrorType + <br><b>Requirements:</b> SetAttentionType() + <br><b>Promises </b> ErrorType set by Gard or NoGard + <br><b>Notes: </b> + </ul><br> + */ + GardResolution::ErrorType QueryGard(void); + + /** + Indicate that there may be a valid "Cookie Crumb" from I/O initialization + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> None + <br><b>Requirements:</b> None + <br><b>Promises: </b> MaybeCrumb() == true + <br><b>Exceptions: </b> None. + </ul><br> + */ + void SeekCrumb(void) { flags |= CRUMB; } + + /** + Indicates wether service should look for a "cookie crumb" from I/O init + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> [true(1)|false(0)] + <br><b>Requirements:</b> None + <br><b>Promises: </b> None + <br><b>Exceptions: </b> None. + </ul><br> + */ + bool MaybeCrumb(void) const { return (flags & CRUMB)!=0 ? true:false;} + + // dg02 - start + /** + Set Error type as Special Uncorrectable Error SUE + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> Nothing. + <br><b>Requirements:</b> None + <br><b>Promises: </b> IsSUE() == true + <br><b>Exceptions: </b> None. + </ul><br> + */ + void SetSUE(void) { flags |= SUE; } + + /** + Query for Special Uncorrectable Error (SUE) + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> Nothing. + <br><b>Requirements:</b> None + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + bool IsSUE(void) const { return (flags & SUE)!=0 ? true:false; } + + /** + Set Error type as Uncorrectable Recoverable Error + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> Nothing. + <br><b>Requirements:</b> None + <br><b>Promises: </b> IsUERE() == true + <br><b>Exceptions: </b> None. + </ul><br> + */ + void SetUERE(void) { flags |= UERE; } + + /** + Query for Uncorrectable Recoverable Error (UERE) + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> Nothing. + <br><b>Requirements:</b> None + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + bool IsUERE(void) const { return (flags & UERE)!=0 ? true:false;} + + // dg02 - end + + /** + Set a flag + <ul> + <br><b>Parameters: </b> ServiceDataCollector::Flag + <br><b>Returns: </b> Nothing. + <br><b>Requirements:</b> None + <br><b>Promises: </b> ServiceDataCollector::Flag is true + <br><b>Exceptions: </b> None. + </ul><br> + */ + void SetFlag(Flag flag) { flags |= flag ;} //mk03a + + /** + Get a flag + <ul> + <br><b>Parameters: </b> ServiceDataCollector::Flag + <br><b>Returns: </b> boolean. + <br><b>Requirements:</b> None + <br><b>Exceptions: </b> None. + </ul><br> + */ + bool GetFlag(Flag flag) { return ((flags & flag)!=0);} + + + /** + Clear a flag + <ul> + <br><b>Parameters: </b> ServiceDataCollector::Flag + <br><b>Returns: </b> Nothing. + <br><b>Requirements:</b> None + <br><b>Promises: </b> ServiceDataCollector::Flag is false + <br><b>Exceptions: </b> None. + </ul><br> + */ + void ClearFlag(Flag flag) { flags &= ~flag ;} // rc09a + + // dg08 - start + /** + Get a PRD timer value based on the time of this error + <ul> + <br><b>Paramter: </b> None + <br><b>Returns: </b> PrdTimer + <br><b>Requirments: </b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + PrdTimer GetTOE(void) { return ivCurrentEventTime; } + + /** + Set Time of Error + @parm set PRD timer value + @returns nothing + */ + void SetTOE(PrdTimer& theTime) { ivCurrentEventTime = theTime; } + + /** + Is this an MP Fatal error + <ul> + <br><b>Paramter: </b> None + <br><b>Returns: </b> [true | false] + <br><b>Requirments: </b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + bool IsMpFatal(void) const { return (flags & MP_FATAL)!=0 ? true:false; } + + /** + Is an MP Reset requested? + <ul> + <br><b>Paramter: </b> None + <br><b>Returns: </b> [true | false] + <br><b>Requirments: </b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + bool IsMpResetReq(void) const { return (flags & MP_RESET_REQ)!=0 ? true:false; } + // dg08 end + + /** + Is an MP Dump requested? + */ + bool IsMpDumpReq(void) const { return (flags & MP_DUMP_REQ) != 0 ? true:false; } // rc09a + + /** Is an Thermal Event Flag on? */ + bool IsThermalEvent(void) const { return (flags & THERMAL_EVENT) != 0 ? true:false; } + + /** Is a Proc Core CS flag on? */ + bool IsProcCoreCS (void) const { return (flags & PROC_CORE_CS) != 0 ? true:false; } + + /** Is a Unit CS flag on? */ + bool IsUnitCS (void) const { return (flags & UNIT_CS) != 0 ? true:false; } + + /** Is a Using Saved SDC on? */ + bool IsUsingSavedSdc (void) const { return (flags & USING_SAVED_SDC) != 0 ? true:false; } + + /** Is a Force Lantent Check Stop flag on? */ + bool IsForceLatentCS (void) const { return (flags & FORCE_LATENT_CS) != 0 ? true:false; } + +#ifndef __HOSTBOOT_MODULE + + /** + Flatten the service data collector + <ul> + <br><b>Paramter: </b> i_buffer ptr to buffer + <br><b>Paramter: </b> io_size = buffer size + <br><b>Returns: </b> [SUCCESS(0) | returncode]; io_size = # bytes written to buffer + <br><b>Requirments: </b> None. + <br><b>Promises: </b> None. + <br><b>Notes: </b> + return != SUCCESS means buffer size was insufficient to save enough data for reconstruction. + return == SUCCESS means enough data is available for reconstruction, but some data could + have been truncated if there was not enough space. + Flattened data is network byte ordered + </ul><br> + */ + uint32_t Flatten(uint8_t * i_buffer, uint32_t & io_size) const; + + ServiceDataCollector & operator=(const uint8_t * i_flatdata); + // ServiceDataCollector & operator=(const ServiceDataCollector &scd)-compiler default is sufficent + +#endif + + /** + * Get the Handle of the chip/core that detected the thermal event. + */ + TARGETING::TargetHandle_t GetThermalChipId() { return ivpThermalChipHandle; }; //pw01 + + /** + * Set the Handle of the chip/core that detected the thermal event. + * @note As a side effect, the THERMAL_EVENT flag is set. + */ + void SetThermalChipId(TARGETING::TargetHandle_t i_pchipHandle) // pw01 + { + ivpThermalChipHandle = i_pchipHandle; + SetFlag(THERMAL_EVENT); + }; + +private: // functions + friend class TerminateResolution; + + /** + Indicate that the machine should be taken down for this error + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Terminate() == true, IsServiceCall() == true + <br><b>Exceptions: </b> None. + </ul><br> + */ + void SetTerminate(void); + int32_t getxMRUListSizeinMem(void)const ; + +private: // Data + + #ifndef __HOSTBOOT_MODULE + HCDB_CHANGE_LIST iv_HcdbChangeList; + hwTableContent ivDumpRequestContent; + #endif + + ErrorSignature error_signature; + CaptureData captureData; + SDC_MRU_LIST xMruList; // dg07 + PRDF_SIGNATURES iv_SignatureList; // jl00 + uint32_t maskId; + ATTENTION_TYPE attentionType; // MCK,REC,SPCL + + uint32_t flags; //mp01 c from uint16_t + uint8_t hitCount; + uint8_t threshold; + uint16_t reasonCode; //mp04 + TARGETING::TargetHandle_t startingPoint; +// dg12d BIT_STRING_BUFFER_CLASS rbsVpd; + GardResolution::ErrorType errorType; + PrdTimer ivCurrentEventTime; + TARGETING::TargetHandle_t ivpDumpRequestChipHandle; + ATTENTION_TYPE causeAttentionType; // MCK,REC,SPCL + + TARGETING::TargetHandle_t ivpThermalChipHandle; + +public: + +// -------------------------------------- +// FSP only functions begin +// -------------------------------------- +#ifndef __HOSTBOOT_MODULE + + /** + * @brief Add a change to the Hcdb Change List + */ + void AddChangeForHcdb(TARGETING::TargetHandle_t i_ptargetHandle = NULL,//Need top level target + hcdb::comp_subtype_t i_testType = hcdb::SUBTYPE_NONE, + comp_id_t i_compType = MDIA_COMP_ID); + + HCDB_CHANGE_LIST & GetHcdbList(void); + + void ClearHcdbList(void); +#endif + + /** + SetDump - Specifiy dump of a callout + <ul> + <br><b>Paramter: </b> dumpRequestContent + <br><b>Returns: </b> Nothing + <br><b>Requirments: </b> None. + <br><b>Promises: </b> IsDump() == true + <br><b>Exceptions: </b> None. + </ul><br> + */ +#ifdef __HOSTBOOT_MODULE + void SetDump(/*FIXME: hwTableContent iDumpRequestContent,*/ + TARGETING::TargetHandle_t iDumpRequestChipHandle =NULL) + { + SetFlag(DUMP); + /* FIXME: ivDumpRequestContent = iDumpRequestContent;*/ + ivpDumpRequestChipHandle = iDumpRequestChipHandle; + } +#else + void SetDump(hwTableContent iDumpRequestContent, + TARGETING::TargetHandle_t iDumpRequestChipHandle =NULL) + { + SetFlag(DUMP); + ivDumpRequestContent = iDumpRequestContent; + ivpDumpRequestChipHandle = iDumpRequestChipHandle; + } +#endif + + /** + Has a Dump been requested + <ul> + <br><b>Paramter: </b> None + <br><b>Returns: </b> [true | false] + <br><b>Requirments: </b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + bool IsDump(void) const { return (flags & DUMP)!=0 ? true:false; } + + /** + Get the dump Id + <ul> + <br><b>Paramter: </b> None + <br><b>Return: </b> dumpRequestType [DUMP_HARDWARE_ONLY | DUMP_HARDWARE_MAINSTORE | DUMP_NO_DUMP] + <br><b>Return: </b> dumpRequestContent [DUMP_HW_ABBR | DUMP_SW_ABBR] + <br><b>Return: </b> oDumpRequestChipId [Handle] + <br><b>Requirments: </b> none + <br><b>Promises: </b> None. + <br><b>Notes: </b> If IsDump()==false than dumpRequestType returned is DUMP_NO_DUMP + </ul><br> + */ +#ifdef __HOSTBOOT_MODULE + void GetDumpRequest( /*FIXME: hwTableContent & oDumpRequestContent,*/ + TARGETING::TargetHandle_t& + opDumpRequestChipHandle) const + { + /*FIXME: oDumpRequestContent = ivDumpRequestContent;*/ + opDumpRequestChipHandle = ivpDumpRequestChipHandle; + } +#else + void GetDumpRequest( hwTableContent & oDumpRequestContent, + TARGETING::TargetHandle_t& + opDumpRequestChipHandle) const + { + oDumpRequestContent = ivDumpRequestContent; + opDumpRequestChipHandle = ivpDumpRequestChipHandle; + } + +#endif + +// -------------------------------------- +// FSP only functions end +// -------------------------------------- + +}; + +#include "iipServiceDataCollector.inl" + +#endif // PRDF_SDC_FLAGS_MAP_ONLY + +#endif /* iipServiceDataCollector_h */ diff --git a/src/usr/diag/prdf/common/framework/service/iipServiceDataCollector.inl b/src/usr/diag/prdf/common/framework/service/iipServiceDataCollector.inl new file mode 100755 index 000000000..3ea5f4989 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/service/iipServiceDataCollector.inl @@ -0,0 +1,150 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/service/iipServiceDataCollector.inl $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1998,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +inline +ServiceDataCollector::ServiceDataCollector() : +#ifndef __HOSTBOOT_MODULE + ivDumpRequestContent(CONTENT_HW), +#endif + error_signature(), + captureData(), + xMruList(), + maskId(0), + attentionType(PRDF::INVALID_ATTENTION_TYPE), + flags(TRACKIT | LOGIT), + hitCount(0), + threshold(0), + reasonCode(0), + startingPoint(NULL), + errorType(GardResolution::NoGard), + ivpDumpRequestChipHandle(NULL), + causeAttentionType(PRDF::INVALID_ATTENTION_TYPE), + ivpThermalChipHandle(NULL) +{ + PRDF::PlatServices::getCurrentTime(ivCurrentEventTime); +} + +// --------------------------------------------------------------- + +inline +void ServiceDataCollector::SetAttentionType( ATTENTION_TYPE attention ) +{ + attentionType = attention; + if(attention == PRDF::MACHINE_CHECK) + { + flags |= SERVICE_CALL; + errorType = GardResolution::Fatal; + } else + { + errorType = GardResolution::Predictive; + } +} + +// --------------------------------------------------------------- + +inline +void ServiceDataCollector::SetCauseAttentionType(ATTENTION_TYPE attention) +{ + causeAttentionType = attention; +} + +// --------------------------------------------------------------- + +inline +void ServiceDataCollector::SetThresholdMaskId(uint32_t mask_id) +{ + flags |= AT_THRESHOLD | DEGRADED | SERVICE_CALL; + maskId = mask_id; // Set MaskId +} + +// --------------------------------------------------------------- + +inline +uint32_t ServiceDataCollector::GetThresholdMaskId(void) const +{ return maskId; } + +// --------------------------------------------------------------- + +inline void ServiceDataCollector::SetTerminate(void) +{ flags |= TERMINATE | SERVICE_CALL; } + +// --------------------------------------------------------------- + +// dg12d removed previously commented-out memory steer stuff + +// --------------------------------------------------------------- + +inline +GardResolution::ErrorType ServiceDataCollector::QueryGard(void) +{ + if (IsServiceCall()) + { + return errorType; + } + return GardResolution::NoGard; +} + +// dg12a -moved here from *.C -------------------------------------- + +inline +void ServiceDataCollector::ClearCallouts(void) +{ + xMruList.erase(xMruList.begin(),xMruList.end()); // dg04 +} +// dg12a -moved here from *.C -------------------------------------- + + +inline +void ServiceDataCollector::ClearSignatureList(void) +{ + iv_SignatureList.erase(iv_SignatureList.begin(),iv_SignatureList.end()); // jl00 +} + + +inline +SDC_MRU_LIST & ServiceDataCollector::GetMruList(void) +{ + return xMruList; +} + +inline +PRDF_SIGNATURES & ServiceDataCollector::GetSignatureList(void) +{ + return iv_SignatureList; +} + +#ifndef __HOSTBOOT_MODULE + +inline +HCDB_CHANGE_LIST & ServiceDataCollector::GetHcdbList(void) +{ + return iv_HcdbChangeList; +} + +inline +void ServiceDataCollector::ClearHcdbList(void) +{ + iv_HcdbChangeList.erase(iv_HcdbChangeList.begin(),iv_HcdbChangeList.end()); // jl00 +} + +#endif diff --git a/src/usr/diag/prdf/common/framework/service/iipsdbug.h b/src/usr/diag/prdf/common/framework/service/iipsdbug.h new file mode 100755 index 000000000..4d83ecaf3 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/service/iipsdbug.h @@ -0,0 +1,298 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/service/iipsdbug.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2002,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef IIPSDBUG_H +#define IIPSDBUG_H + +/*! + @file iipsdbug.h + @brief PRD wrapper to the system debug data +*/ + +/* Module Description *************************************************/ +/* */ +/* Name: iipsdbug.h */ +/* */ +/* Description: This module contains the Processor Runtime + Diagnostics System Debug area class declaration. */ +/* */ +/* End Module Description *********************************************/ + +/*--------------------------------------------------------------------*/ +/* Reference the virtual function tables and inline function + defintions in another translation unit. */ +/*--------------------------------------------------------------------*/ +#ifdef __GNUC__ + #pragma interface +#endif + +/*--------------------------------------------------------------------*/ +/* Includes */ +/*--------------------------------------------------------------------*/ + +#include <stdint.h> +#include <prdfMain.H> +#include <targeting/common/target.H> + +/*--------------------------------------------------------------------*/ +/* Forward References */ +/*--------------------------------------------------------------------*/ + +//class CHIP_CLASS; +struct PRD_SRC_TYPE; +struct STEP_CODE_DATA_STRUCT; + +/*--------------------------------------------------------------------*/ +/* User Types */ +/*--------------------------------------------------------------------*/ + +typedef uint8_t ATTENTION_TYPE; + + +/*--------------------------------------------------------------------*/ +/* Constants */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Macros */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Global Variables */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Function Prototypes */ +/*--------------------------------------------------------------------*/ + +/* Class Specification ************************************************/ +/* */ +/* Title: System Debug */ +/* */ +/* Purpose: SYSTEM_DEBUG_CLASS is an interface to the Service + Processor Communcation Area (SPCA) System Debug common + memory area. */ +/* */ +/* Usage: Concrete class */ +/* */ +/* Notes: This System Debug specifies an interface for accessing + data in the SPCA sysdbug structure. */ +/* */ +/* Cardinality: N */ +/* */ +/* Space Complexity: Constant */ +/* */ +/* End Class Specification ********************************************/ +/** + Provide services associated with the service processor system debug area + @author Douglas R. Gilbert + @version V4R5 +*/ +class SYSTEM_DEBUG_CLASS +{ +public: + + /** + Constructor + <ul> + <br><b>Parameters: </b> None. + <br><b>Requirements:</b> sp virtuals established + <br><b>Promises: </b> Object instantiated + <br><b>Exceptions: </b> None. + </ul><br> + */ + SYSTEM_DEBUG_CLASS(void); + + + /** + Re-read attention data + <ul> + <br><b>Parameters: </b> i_attnList list of chips at attention + <br><b>Returns: </b> None. + <br><b>Requirements:</b> sp virtuals established + <br><b>Promises: </b> object resurrected + <br><b>Exceptions: </b> None. + </ul><br> + */ + uint32_t Reinitialize(const PRDF::AttnList & i_attnList); + + /** + Indicates if an attention is active for a particular chip + <ul> + <br><b>Parameters: </b> i_pTargetHandle + <br><b>Returns: </b> [true | false] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + bool IsAttentionActive(TARGETING::TargetHandle_t i_ptargetHandle ) const; + + /** + Indicates if an attention is active for a particular chip + <ul> + <br><b>Parameters: </b> ChipClass + <br><b>Returns: </b> [true | false] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ +// bool IsAttentionActive(const CHIP_CLASS & chip) const; + + /** + Get the attention type for the attention that is active on this chip + <ul> + <br><b>Parameters: </b> i_pTargetHandle + <br><b>Returns: </b> ATTENTION_TYPE + <br><b>Requirements:</b> IsAttentionActive() == true + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + uint8_t GetAttentionType(TARGETING::TargetHandle_t i_ptargetHandle ) const; + + /** + Get the attention type for the attention that is active on this chip + <ul> + <br><b>Parameters: </b> ChipClass + <br><b>Returns: </b> ATTENTION_TYPE + <br><b>Requirements:</b> IsAttentionActive() == true + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ +// uint8_t GetAttentionType(const CHIP_CLASS & chip) const; + + /** + Get the global(overall) attention type + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> ATTENTION_TYPE + <br><b>Requirements:</b> None, + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + uint32_t GetGlobalAttentionType(void) const; + + + /** + Set the sysdebug SRC pointer to the PRD generated SRC + <ul> + <br><b>Parameters: </b> ptr to SRC + <br><b>Returns: </b> None + <br><b>Requirements:</b> src_ptr is valid + <br><b>Promises: </b> sysdebug modified + <br><b>Exceptions: </b> None. + </ul><br> + */ + void SetPrdSrcPointer(uint32_t*); + void SetPrdSrcPointer(); // called by main - can we remove it? + + + /** + Create an SRC in the SOT (obsolete) + <ul> + <br><b>Parameters: </b> reference code, step code, analysis return code + <br><b>Returns: </b> return code + <br><b>Requirements:</b> none. + <br><b>Promises: </b> SRC written to SOT + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> No implementation after V3R7 + </ul><br> + */ +// int32_t SrcFill(uint16_t ref_code, uint16_t step_code, uint16_t mop_rc) const; + + /** + Callout all chips at attention + <ul> + <br><b>Parameters: </b> ServiceData + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + </ul><br> + */ + void CalloutThoseAtAttention(STEP_CODE_DATA_STRUCT & serviceData) const; + + enum { MAX_ERROR_ENTRY_INDEX = 80 }; + + /** + Clear the attentions + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Nothing is at attention + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> + </ul><br> + */ + void Clear(void); + + // Functions used by the simulator only + /** + Get the pointer to the PRD SRC in sysdebug (Simulator only) + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> ptr to SRC + <br><b>Requirements:</b> SetPrdSrcPointer() + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Available in PRD simulator only + </ul><br> + */ + const uint32_t *GetPrdSrcPointer(void) const; + + /** + Set the attention type for the specified chip (Simulator only) + <ul> + <br><b>Parameters: </b> i_pTargetHandle, ATTENTION_TYPE + <br><b>Returns: </b> None. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> GetAttentionType() == at + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Available in PRD simulator only + </ul><br> + */ + void SetAttentionType(TARGETING::TargetHandle_t i_pTargetHandle ,PRDF::ATTENTION_VALUE_TYPE i_eAttentionType); + + // SetGlobalAttentionType(uint8_t ga); // FIXME : remove this function when merge, no longer used + +private: + + enum + { + SRCFILL_FORMAT = 1, + SRCFILL_GROUP = 7 + }; +}; +#endif //IIPSDBUG_H + +// Change Log ************************************************************************************* +// +// Flag Reason Vers Date Coder Description +// ---- ------- ----- -------- -------- ---------------------------------------------------------- +// jl02 605874 fips330 07/31/07 lukas Add functions to PRD framework/Galaxy 2 code for unit CS +// End Change Log ********************************************************************************* diff --git a/src/usr/diag/prdf/common/framework/service/iipstep.h b/src/usr/diag/prdf/common/framework/service/iipstep.h new file mode 100755 index 000000000..3a0ff6d60 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/service/iipstep.h @@ -0,0 +1,114 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/service/iipstep.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1996,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef IIPSTEP_H +#define IIPSTEP_H + +/*! + Processor Runtime Diagnostics Step Code class declaration + @file iipstep.h +*/ + +/* Change Log *********************************************************/ +/* */ +/* Flag Reason Vers Date Coder Description */ +/* ---- -------- ---- -------- ----- ------------------------------- */ +/* V300 07/16/93 JST Initial Creation */ +/* V300 12/20/93 JST Modifying Step Code Data */ +/* V300 02/15/94 JST Removed Step Code Class */ +/* V300 03/11/94 JST Modified Step Code Data */ +/* d24737.? V4R1 10/25/95 DRG Added ServiceDataCollector */ +/* 357551 fips1 02/01/02 dgilbert FSP - removed ERROR_OBJECT */ +/* */ +/* End Change Log *****************************************************/ + +/*--------------------------------------------------------------------*/ +/* Reference the virtual function tables and inline function + defintions in another translation unit. */ +/*--------------------------------------------------------------------*/ +#ifdef __GNUC__ +#endif +/*--------------------------------------------------------------------*/ +/* Includes */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Forward References */ +/*--------------------------------------------------------------------*/ + +//class ERROR_OBJECT_CLASS; +class ServiceDataCollector; + +/*--------------------------------------------------------------------*/ +/* User Types */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Constants */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Macros */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Global Variables */ +/*--------------------------------------------------------------------*/ + +/*--------------------------------------------------------------------*/ +/* Function Prototypes */ +/*--------------------------------------------------------------------*/ + +/* Structure Specification ********************************************/ +/* */ +/* Title: Step Code Data */ +/* */ +/* Purpose: STEP_CODE_DATA_STRUCT represents the static information + required for a unique errror condition. */ +/* */ +/* Usage: Concrete structure */ +/* */ +/* Side-effects: None. */ +/* */ +/* Dependencies: None. */ +/* */ +/* Cardinality: N */ +/* */ +/* Space Complexity: Constant */ +/* */ +/* End Structure Specification ****************************************/ + +struct STEP_CODE_DATA_STRUCT +{ + // Used to identify a unique error condition. (Muskie/Cobra) + // ERROR_OBJECT_CLASS * error_ptr; // obsolete + + //! Used to identify a unique error condition and collect related information + ServiceDataCollector * service_data; + +}; + + + + +#endif diff --git a/src/usr/diag/prdf/common/framework/service/prdfPfa5Data.h b/src/usr/diag/prdf/common/framework/service/prdfPfa5Data.h new file mode 100755 index 000000000..ebeb22254 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/service/prdfPfa5Data.h @@ -0,0 +1,433 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/service/prdfPfa5Data.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2003,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#if !defined(prdfPfa5Data_h) +#define prdfPfa5Data_h +/** + @file prdfPfa4Data.h + @brief Version 5 format of the Pfa Data +*/ + +#include <prdf_types.h> +#include <utilstream.H> + +const uint32_t PFA5_Format = 0x50464135; +const uint32_t prdfMruListLIMIT = 8; +const uint32_t prdfHcdbListLIMIT = 8; +const uint32_t prdfSignatureListLIMIT = 8; + +// Size of PRD Capture Data +#ifdef __HOSTBOOT_MODULE +// Total error log size for Hostboot error logs is 4K. +const uint32_t CaptureDataSize = 2048; +#else +const uint32_t CaptureDataSize = 4096*2; +#endif + +enum prdfErrlVersion +{ + prdfErrlVer1 = 1, + prdfErrlVer2 = 2, +}; + +enum prdfErrlSubsect +{ + prdfErrlSectPFA5_1 = 51, + prdfErrlSectPFA5_2 = 52, + prdfErrlCapData_1 = 1, + prdfErrlCapData_2 = 2, + prdfErrlAVPData_1 = 41, + prdfErrlAVPData_2 = 42, + prdfErrlString = 10, +}; + +struct prdfMsDumpStruct +{ + int32_t DumpContent; + PRDF::HUID DumpId; + + friend UtilStream& operator<<(UtilStream& i_left, prdfMsDumpStruct& i_right) + { + i_left << i_right.DumpContent << i_right.DumpId; + + return i_left; + }; + + friend UtilStream& operator>>(UtilStream& i_left, prdfMsDumpStruct& i_right) + { + i_left >> i_right.DumpContent >>i_right.DumpId; + + return i_left; + }; +}; + +struct prdfPfaCalloutListStruct +{ + uint32_t Callout; + uint8_t MRUtype; // See enum PRDcallout::MruType + uint8_t MRUpriority; // in srci/fsp/srci.H + // SRCI_PRIORITY_LOW = 1 + // SRCI_PRIORITY_MEDC = 2 + // SRCI_PRIORITY_MEDB = 3 + // SRCI_PRIORITY_MEDA = 4 + // SRCI_PRIORITY_MED = 5 + // SRCI_PRIORITY_HIGH = 6 + uint8_t Reserved_3; + uint8_t Reserved_4; + + friend UtilStream& operator<<(UtilStream& i_left, + prdfPfaCalloutListStruct& i_right) + { + i_left << i_right.Callout << i_right.MRUtype << i_right.MRUpriority + << i_right.Reserved_3 << i_right.Reserved_4; + + return i_left; + }; + + friend UtilStream& operator>>(UtilStream& i_left, + prdfPfaCalloutListStruct& i_right) + { + i_left >> i_right.Callout >> i_right.MRUtype >> i_right.MRUpriority + >> i_right.Reserved_3 >> i_right.Reserved_4; + return i_left; + }; + +}; + +//NOTE: The addition of the hcdb data requires additonal PFA data and +// error log parsing. This is triggered / indicated by a new +// PFA data bit,HCDB_SUPPORT. Support is for fips720 and beyond. +struct prdfPfaHcdbListStruct +{ + PRDF::HUID hcdbId ; + uint32_t compSubType; + uint32_t compType; + uint32_t hcdbReserved1; + uint32_t hcdbReserved2; + + friend UtilStream& operator<<(UtilStream& i_left, + prdfPfaHcdbListStruct& i_right) + { + i_left << i_right.hcdbId << i_right.compSubType << i_right.compType + << i_right.hcdbReserved1 << i_right.hcdbReserved2; + return i_left; + }; + + friend UtilStream& operator>>(UtilStream& i_left, + prdfPfaHcdbListStruct& i_right) + { + i_left >> i_right.hcdbId >> i_right.compSubType >> i_right.compType + >> i_right.hcdbReserved1 >> i_right.hcdbReserved2; + return i_left; + }; +}; + +struct prdfPfaSignatureListStruct +{ + PRDF::HUID chipId ; + uint32_t signature; + + friend UtilStream& operator<<(UtilStream& i_left, + prdfPfaSignatureListStruct& i_right) + { + i_left << i_right.chipId << i_right.signature; + return i_left; + }; + + friend UtilStream& operator>>(UtilStream& i_left, + prdfPfaSignatureListStruct& i_right) + { + i_left >> i_right.chipId >> i_right.signature; + return i_left; + }; +}; + +/********************************************************************* + * NOTE: the MsDumpLabel and its information must be first in this + * structure. Attn handling is dependent on this ordering. + **********************************************************************/ +struct prdfPfaData +{ + //0x0000 + uint32_t MsDumpLabel[2]; + prdfMsDumpStruct MsDumpInfo; + + uint32_t PFA_errlActions :16,// Error Log Actions Parm + // ERRL_ACTION_NONE = 0x0000 + // ERRL_ACTION_SA = 0x8000 + // ERRL_ACTION_HIDDEN = 0x4000 + // ERRL_ACTION_REPORT = 0x2000 + // ERRL_ACTION_REPORT_HMC_ONLY = 0x1000 + // ERRL_ACTION_CALL_HOME = 0x0800 + // ERRL_ACTION_FNM_REQ = 0x0400 + // ERRL_ACTION_HYP_GARD = 0x0200 + // ERRL_ACTION_OS_RECONFIG = 0x0100 + PFA_errlSeverity :8,// Error Log Severity Parm + // See errlSeverity in errltypes.H + // ERRL_SEV_INFORMATIONAL = 0, + // ERRL_SEV_RECOVERED = 0x10 + // ERRL_SEV_PREDICTIVE = 0x20 + // ERRL_SEV_PREDICTIVE_DEGRADED = 0x21 + // ERRL_SEV_PREDICTIVE_CORRECTABLE = 0x22 + // ERRL_SEV_PREDICTIVE_CORRECTABLE2 = 0x23 + // ERRL_SEV_PREDICTIVE_REDUNDANCY_LOST = 0x24 + // ERRL_SEV_UNRECOVERABLE1 = 0x41 + // ERRL_SEV_UNRECOVERABLE2 = 0x44 + // ERRL_SEV_UNRECOVERABLE3 = 0x45 + // ERRL_SEV_UNRECOVERABLE4 = 0x48 + // ERRL_SEV_DIAGNOSTIC_ERROR1 = 0x60 + // ERRL_SEV_DIAGNOSTIC_ERROR2 = 0x61 + // ERRL_SEV_UNRECOVERABLE = 0x70 + // ERRL_SEV_UNRECOVERABLE_REIPL = 0x71 + // ERRL_SEV_RESERVED = 0xFF + + + Reserved_2 :8; + + // PRD Service Data Collector Flags + uint32_t MP_DUMP_REQ :1, + MP_RESET_REQ :1, + MP_FATAL :1, + REBOOT_MSG :1, + DUMP :1, + UERE :1, + SUE :1, + CRUMB :1, + AT_THRESHOLD :1, + DEGRADED :1, + SERVICE_CALL :1, + TRACKIT :1, + TERMINATE :1, + LOGIT :1, + MEMORY_STEERED :1, + FLOODING :1, + THERMAL_EVENT :1, + UNIT_CHECKSTOP :1, + USING_SAVED_SDC :1, + LAST_CORE_TERMINATE :1, + FORCE_LATENT_CS :1, + DEFER_DECONFIG_MASTER :1, + DEFER_DECONFIG :1, + CM_MODE :1, + TERMINATE_ON_CS :1, + HCDB_SUPPORT :1, + SIGNATURE_SUPPORT :1, + Reserved :5; + // 1 TRUE + // 0 FALSE + // + //0x00xx + //uint32_t ComponentDataLabel[2];// Label to show start of Component data. + uint32_t ErrorCount :16, + // PRD Hits on this Error since IPL. + Threshold :16; + // PRD Threshold for this error (MAKMAK how represent interval?) + + uint32_t PRDServiceActionCounter :8, + // PRD Service Action Counter + ErrorType :8, + // Error type gard was called with (see xspprdGardResolution.h) + homGardState :8, + // homGardEnum in src/hwsv/server/hwsvTypes.H + // HOM_NO_GARD = 0 + // HOM_DECONFIG_GARD =1 + // HOM_BYPASS_GARD = 2 + Reserved_5 :8; //MP01 c - SystemType not needed + + uint32_t PRD_AttnTypes :8, + // 0x00 NULL + // 0x01 CheckStop Attn + // 0x02 Recoverable Attn + // 0x03 Special Attn + PRD_SecondAttnTypes :8, + // 0x00 NULL + // 0x01 CheckStop Attn + // 0x02 Recoverable Attn + // 0x03 Special Attn + + reasonCode :16; //MP06 a + + uint32_t PfaCalloutCount; // The number of MRUs below. + prdfPfaCalloutListStruct PfaCalloutList[prdfMruListLIMIT]; //full list of MRUs and flags. + uint32_t hcdbListCount; //mp15 a + prdfPfaHcdbListStruct PfaHcdbList[prdfHcdbListLIMIT]; //mp15 a + uint32_t signatureCount; + prdfPfaSignatureListStruct PfaSignatureList[prdfSignatureListLIMIT]; + //pw01 + friend UtilStream& operator<<(UtilStream& i_left, prdfPfaData& i_right) + { + i_left << i_right.MsDumpLabel[0] << i_right.MsDumpLabel[1] + << i_right.MsDumpInfo + << + ( (i_right.PFA_errlActions << 16) | + (i_right.PFA_errlSeverity << 8) | + (i_right.Reserved_2) + ) + << + ( (i_right.MP_DUMP_REQ << 31) | + (i_right.MP_RESET_REQ << 30) | + (i_right.MP_FATAL << 29) | + (i_right.REBOOT_MSG << 28) | + (i_right.DUMP << 27) | + (i_right.UERE << 26) | + (i_right.SUE << 25) | + (i_right.CRUMB << 24) | + (i_right.AT_THRESHOLD << 23) | + (i_right.DEGRADED << 22) | + (i_right.SERVICE_CALL << 21) | + (i_right.TRACKIT << 20) | + (i_right.TERMINATE << 19) | + (i_right.LOGIT << 18) | + (i_right.MEMORY_STEERED << 17) | + (i_right.FLOODING << 16) | + (i_right.THERMAL_EVENT << 15) | + (i_right.UNIT_CHECKSTOP << 14) | //MP09c + (i_right.USING_SAVED_SDC << 13) | //MP08 + (i_right.LAST_CORE_TERMINATE << 12) | //MP10 + (i_right.FORCE_LATENT_CS << 11) | //MP11 + (i_right.DEFER_DECONFIG_MASTER << 10) | //MP12 + (i_right.DEFER_DECONFIG << 9) | //MP12 + (i_right.CM_MODE << 8) | //MP12 + (i_right.TERMINATE_ON_CS << 7) | //mp78 + (i_right.HCDB_SUPPORT << 6) | //mp15 + (i_right.SIGNATURE_SUPPORT << 5) | + (i_right.Reserved) + ) + //<< i_right.ComponentDataLabel[0] << i_right.ComponentDataLabel[1] + << + ( (i_right.ErrorCount << 16) | + (i_right.Threshold) + ) + << + ( (i_right.PRDServiceActionCounter << 24) | + (i_right.ErrorType << 16) | + (i_right.homGardState << 8) | + (i_right.Reserved_5) + ) + << + ( (i_right.PRD_AttnTypes << 24) | + (i_right.PRD_SecondAttnTypes << 16) | + (i_right.reasonCode) + ) + << i_right.PfaCalloutCount; + for (uint32_t i = 0; i < i_right.PfaCalloutCount; i++) + i_left << i_right.PfaCalloutList[i]; + + if ( 0 != i_right.HCDB_SUPPORT ) //mp16 a + { + i_left << i_right.hcdbListCount; //mp15 a + for (uint32_t i = 0; i < i_right.hcdbListCount; i++) //mp15 a + i_left << i_right.PfaHcdbList[i]; //mp15 a + } + + if ( 0 != i_right.SIGNATURE_SUPPORT ) //mp16 a + { + i_left << i_right.signatureCount; + for (uint32_t i = 0; i < i_right.signatureCount; i++) + i_left << i_right.PfaSignatureList[i]; + } + + return i_left; + }; + + friend UtilStream& operator>>(UtilStream& i_left, prdfPfaData& i_right) + { + uint32_t l_tmp[6]; + i_left >> i_right.MsDumpLabel[0] >> i_right.MsDumpLabel[1] + >> i_right.MsDumpInfo + >> l_tmp[1] + >> l_tmp[2] + >> l_tmp[3] + >> l_tmp[4] + >> l_tmp[5]; + + i_right.PFA_errlActions = (l_tmp[1] >> 16) & 0xFFFF; + i_right.PFA_errlSeverity = (l_tmp[1] >> 8) & 0xFF; + i_right.MP_DUMP_REQ = (l_tmp[2] >> 31) & 0x01; + i_right.MP_RESET_REQ = (l_tmp[2] >> 30) & 0x01; + i_right.MP_FATAL = (l_tmp[2] >> 29) & 0x01; + i_right.REBOOT_MSG = (l_tmp[2] >> 28) & 0x01; + i_right.DUMP = (l_tmp[2] >> 27) & 0x01; + i_right.UERE = (l_tmp[2] >> 26) & 0x01; + i_right.SUE = (l_tmp[2] >> 25) & 0x01; + i_right.CRUMB = (l_tmp[2] >> 24) & 0x01; + i_right.AT_THRESHOLD = (l_tmp[2] >> 23) & 0x01; + i_right.DEGRADED = (l_tmp[2] >> 22) & 0x01; + i_right.SERVICE_CALL = (l_tmp[2] >> 21) & 0x01; + i_right.TRACKIT = (l_tmp[2] >> 20) & 0x01; + i_right.TERMINATE = (l_tmp[2] >> 19) & 0x01; + i_right.LOGIT = (l_tmp[2] >> 18) & 0x01; + i_right.MEMORY_STEERED = (l_tmp[2] >> 17) & 0x01; + i_right.FLOODING = (l_tmp[2] >> 16) & 0x01; + i_right.THERMAL_EVENT = (l_tmp[2] >> 15) & 0x01; //pw02 + i_right.UNIT_CHECKSTOP = (l_tmp[2] >> 14) & 0x01; //pw02 //MP09c + i_right.USING_SAVED_SDC = (l_tmp[2] >> 13) & 0x01; //MP08 + i_right.LAST_CORE_TERMINATE = (l_tmp[2] >> 12) & 0x01; //MP10 + i_right.FORCE_LATENT_CS = (l_tmp[2] >> 11) & 0x01; //MP11 + i_right.DEFER_DECONFIG_MASTER = (l_tmp[2] >> 10) & 0x01; //MP12 + i_right.DEFER_DECONFIG = (l_tmp[2] >> 9) & 0x01; //MP12 + i_right.CM_MODE = (l_tmp[2] >> 8) & 0x01; //MP12 + i_right.TERMINATE_ON_CS = (l_tmp[2] >> 7) & 0x01; //mp78 + i_right.HCDB_SUPPORT = (l_tmp[2] >> 6) & 0x01; //mp15 + i_right.SIGNATURE_SUPPORT = (l_tmp[2] >> 5) & 0x01; + i_right.ErrorCount = (l_tmp[3] >> 16) & 0xFFFF; + i_right.Threshold = (l_tmp[3]) & 0xFFFF; + i_right.PRDServiceActionCounter = (l_tmp[4] >> 24) & 0xFF; + i_right.ErrorType = (l_tmp[4] >> 16) & 0xFF; + i_right.homGardState = (l_tmp[4] >> 8) & 0xFF; + i_right.PRD_AttnTypes = (l_tmp[5] >> 24) & 0xFF; + i_right.PRD_SecondAttnTypes = (l_tmp[5] >> 16) & 0xFF; + i_right.reasonCode = (l_tmp[5]) & 0xFFFF; //MP06 a + + i_left >> i_right.PfaCalloutCount; //mp16 m + for (uint32_t i = 0; i < i_right.PfaCalloutCount; i++) + i_left >> i_right.PfaCalloutList[i]; + + if ( 0 != i_right.HCDB_SUPPORT ) //mp16 a + { + i_left >> i_right.hcdbListCount; //mp15 a + for (uint32_t i = 0; i < i_right.hcdbListCount; i++) //mp15 a + i_left >> i_right.PfaHcdbList[i]; //mp15 a + } + + if ( 0 != i_right.SIGNATURE_SUPPORT ) //mp16 a + { + i_left >> i_right.signatureCount; + for (uint32_t i = 0; i < i_right.signatureCount; i++) + i_left >> i_right.PfaSignatureList[i]; + } + + return i_left; + }; + //--pw01 +}; + +struct prdfCaptureData +{ + uint32_t CaptureData_Label; // Label to show start of Capture data. + uint32_t PfaCaptureDataSize; + uint8_t CaptureData[CaptureDataSize]; // MAKMAK Can this be variable size? + uint32_t EndLabel[2];// Label to show End of Capture Data +}; + +#endif //end prdfPfa5Data.h diff --git a/src/usr/diag/prdf/common/framework/service/prdfPlatServices.C b/src/usr/diag/prdf/common/framework/service/prdfPlatServices.C new file mode 100755 index 000000000..9c6173c51 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/service/prdfPlatServices.C @@ -0,0 +1,527 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/service/prdfPlatServices.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +/** + * @file prdfPlatServices.C + * @brief PRD wrapper of external componnets ( other then targetting) + */ + +//------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------ + +#include <prdfPlatServices.H> + +#include <iipbits.h> +#include <iipsdbug.h> +#include <iipglobl.h> +#include <prdfTrace.H> + +#include <fapi.H> + +#ifdef __HOSTBOOT_MODULE + #include <time.h> + #include <errno.h> + #include <sys/time.h> + #include <diag/mdia/mdia.H> + #include <diag/mdia/mdiamevent.H> + #include <fapiPlatHwpInvoker.H> + #include <dimmBadDqBitmapFuncs.H> +#else + #include <iplp_registry.H> + #include <mboxclientlib.H> + #include <mnfgPolicyFlags.H> + #include <smgr_ipltypes.H> + #include <smgr_registry.H> + #include <svpd_externals.H> + #include <svpdextstructs.H> + #include <GardExtInt.H> + #include <dscvReg.H> + #include <dadaProcMsViaProc.H> + #include <utillib.H> + #include <rmgrBaseClientLib.H> + #include <services/hwas/hwsvHwAvailSvc.H> // For deconfigureTargetAtRuntime() +#endif + +//------------------------------------------------------------------------------ + +namespace PRDF +{ + +namespace PlatServices +{ + +//############################################################################## +//## +//## Hostboot and FSP functions +//## +//############################################################################## + +//############################################################################## +//## System Level Utility Functions +//############################################################################## + +bool isMasterFSP() +{ + bool l_isMaster = true; + #ifdef __HOSTBOOT_MODULE + // Always true in hostboot + l_isMaster = true; + #else + // We're going to assume master because it's better to have scom + // errors by writing on the slave then to not do something on the + // master. + + errlHndl_t l_errl = NULL; + uint8_t l_roleRegValue; + size_t l_roleRegSize = sizeof(l_roleRegValue); + + l_errl = UtilReg::read(FSP_ROLE_STR,&l_roleRegValue, + l_roleRegSize); + + if (NULL != l_errl) + { + PRDF_COMMIT_ERRL(l_errl, ERRL_ACTION_REPORT); + } + else + { + l_isMaster = (DSCV_FSP_MASTER == l_roleRegValue); + } + #endif + + return l_isMaster; +} + +//------------------------------------------------------------------------------ + +bool isMemoryPreservingIpl() +{ + bool l_isMemPreservingIpl = false; + #ifdef __HOSTBOOT_MODULE + //TODO + #else + //if (inCMMode()) + // return false; + + // Check the fsp ipl type so we know if this needs to be initialized + uint32_t l_iplType = 0x00000000; + size_t l_size = sizeof( l_iplType ); + + // Terry Opie Comments: First thing I see... You're gonna want to + // read:SMGR_REG_CECIPL_TYPE_KEY instead of the fsp ipl type. + // The one(SMGR_REG_FSPIPL_TYPE_KEY) you're reading is strictly fsp + // related ipl types. resets/reset reloads, etc. + + errlHndl_t l_errl = UtilReg::read( SMGR_REG_CECIPL_TYPE_KEY, + &l_iplType, + l_size ); + if (NULL != l_errl) + { + PRDF_ERR( "[isMemoryPreservingIpl] Failed to read registry" ); + PRDF_COMMIT_ERRL(l_errl, ERRL_ACTION_REPORT); + } + else + { + // Terry Opie Comments: Also for checking the mask..You can do + // it the way you have it,or use a macro that are in + // smgr_ipltypes.H. Returns true if the Main Store preserved + // attribute bit is set #define + // SMGR_IPLTYPE_IS_MS_PRESVD(_i_ipltype_)(((_i_ipltype_)& + // SMGR_ATTR_MS_PRESVD_MASK) != 0)Call that + // passing in the ipl type, and it'll return true if its Mem presv. + if(SMGR_IPLTYPE_IS_MS_PRESVD(l_iplType)) + { + l_isMemPreservingIpl = true; + } + } + #endif + + return l_isMemPreservingIpl; +} + +//------------------------------------------------------------------------------ + +void getECIDString(TARGETING::TargetHandle_t i_pGivenTarget, const char *o_ecidStr ) +{ + o_ecidStr =""; + PRDF_ERR( "[getECIDString] Function not implemented yet" ); + +} + +//------------------------------------------------------------------------------ + +void getCurrentTime( PrdTimer & o_timer ) +{ +#ifdef __HOSTBOOT_MODULE + + timespec_t curTime; + PRDF_ASSERT(0 == clock_gettime(CLOCK_MONOTONIC, &curTime)) + + // Hostboot uptime in secs + o_timer = curTime.tv_sec; + + //Since Hostboot doesn't have any System checkstop + //We don't have to worry about the detailed time struct + //for System checkstop timestamp + +#else + + time_t thetime = time(NULL); + struct tm * l_curEventTime = localtime(&thetime); + + // record the detailed time struct + PrdTimer::prdftm_t l_tm(l_curEventTime->tm_sec, + l_curEventTime->tm_min, + l_curEventTime->tm_hour, + l_curEventTime->tm_wday, + l_curEventTime->tm_mday, + l_curEventTime->tm_yday, + l_curEventTime->tm_mon, + l_curEventTime->tm_year); + o_timer.settm(l_tm); + +#endif +} + +//------------------------------------------------------------------------------ + +errlHndl_t syncFile( const char* i_fileName ) +{ +#ifdef __HOSTBOOT_MODULE + return NULL; +#else + return rmgrSyncFile(PRDF_COMP_ID, i_fileName); +#endif +} + +//############################################################################## +//## MNFG Policy Flag Functions +//############################################################################## + +#ifdef __HOSTBOOT_MODULE + +// TODO: This is a hack until we are able to get these flags supported in +// Hostboot. +enum +{ + MNFG_THRESHOLDS = 0, + MNFG_HDAT_AVP_ENABLE, + MNFG_SRC_TERM, + MNFG_NO_RBS, +}; + +#endif + +// Helper function to access the state of manufacturing policy flags. +// TODO: Need hostboot support for the following flags: +// MNFG_AVP_ENABLE +// MNFG_SRC_TERM +// MNFG_NO_RBS +// MNFG_FAST_BACKGROUND_SCRUB +// MNFG_TEST_RBS +// MNFG_IPL_MEMORY_CE_CHECKING +bool isMnfgFlagSet( uint32_t i_flag ) +{ + bool o_rc = false; + + #ifdef __HOSTBOOT_MODULE + + // TODO - mnfgIsPolicyFlagSet() may not be supported in hostboot. Need to + // verify how this will be done. + PRDF_ERR( "[isMnfgFlagSet] Hostboot Function not implemented yet" ); + + #else + + errlHndl_t errl = mnfgIsPolicyFlagSet( i_flag, o_rc ); + if ( NULL != errl ) + { + PRDF_ERR( "[isMnfgFlagSet] mnfgIsPolicyFlagSet(0x%08x)", i_flag ); + PRDF_COMMIT_ERRL(errl, ERRL_ACTION_REPORT); + o_rc = false; + } + + #endif + + return o_rc; +} + +//------------------------------------------------------------------------------ + +bool mfgMode() { return isMnfgFlagSet( MNFG_THRESHOLDS ); } +bool hdatAvpMode() { return isMnfgFlagSet( MNFG_HDAT_AVP_ENABLE ); } +bool mnfgTerminate() { return isMnfgFlagSet( MNFG_SRC_TERM ); } +bool areDramRepairsDisabled() { return isMnfgFlagSet( MNFG_NO_RBS ); } + +//############################################################################## +//## Memory specific functions +//############################################################################## + +/* TODO - Get the memory buffer raw card type (i.e. R/C A). This is needed for + the DRAM site locations for buffered DIMMs. Should be able to get this + from an attribute but doesn't look like this is available yet. +getMembufRawCardType() +{ +} +*/ + +//------------------------------------------------------------------------------ + +/* TODO - Get the type of the card a DIMM is plugged into. This is needed for + the DRAM site locations for IS DIMMs. Should be able to get this from + an attribute but doesn't look like this is available yet. +getDimmPlugCardType() +{ +} +*/ + +//------------------------------------------------------------------------------ + +/* TODO +//------------------------------------------------------------------------------ + +int32_t setBadDqBitmap( TARGETING::TargetHandle_t i_mbaTarget + const uint8_t i_portSlct, + const uint8_t i_dimmSlct, + const uint8_t i_rankSlct, + const uint8_t (&i_data)[DIMM_DQ_RANK_BITMAP_SIZE] ) +{ + int32_t o_rc = SUCCESS; + + // TODO: Call dimmSetBadDqBitmap() in dimmBadDqBitmapFuncs.H. + // NOTE: DIMM_DQ_RANK_BITMAP_SIZE is in dimmConsts.H + // NOTE: Will need to convert TARGETING::TargetHandle_t to fapi::Target. + + return o_rc; +} +*/ + +//############################################################################## +//## +//## Hostboot only functions +//## +//############################################################################## + +#ifdef __HOSTBOOT_MODULE + +bool isInMdiaMode() +{ + bool o_isInMdiaMode = false; + + MDIA::waitingForMaintCmdEvents(o_isInMdiaMode); + + return o_isInMdiaMode; +} + +//------------------------------------------------------------------------------ + +int32_t mdiaSendCmdComplete( TARGETING::TargetHandle_t i_mbaTarget ) +{ + using namespace TARGETING; + + int32_t o_rc = SUCCESS; + + do + { + // Verify type. + TYPE l_type = getTargetType(i_mbaTarget); + if ( TYPE_MBA != l_type ) + { + PRDF_ERR( "[PlatServices::mdiaSendCmdComplete] unsupported target " + "type %d", l_type ); + o_rc = FAIL; + break; + } + + // Send command complete to MDIA. + MDIA::MaintCommandEvent l_mdiaEvent; + l_mdiaEvent.type = MDIA::COMMAND_COMPLETE; + l_mdiaEvent.target = i_mbaTarget; + + errlHndl_t errl = MDIA::processEvent( l_mdiaEvent ); + if ( NULL != errl ) + { + PRDF_ERR( "[PlatServices::mdiaSendCmdComplete] MDIA::processEvent " + "failed" ); + PRDF_COMMIT_ERRL( errl, ERRL_ACTION_REPORT ); + o_rc = FAIL; + break; + } + + } while (0); + + if ( SUCCESS != o_rc ) + { + PRDF_ERR( "[PlatServices::mdiaSendCmdComplete] Failed: i_target=0x%08x", + getHuid(i_mbaTarget) ); + } + + return o_rc; +} + +int32_t mssGetMarkStore( + TARGETING::TargetHandle_t i_mbaTarget, + uint8_t i_rank, + uint8_t & o_chipMark, + uint8_t & o_symbolMark) +{ + int32_t o_rc = SUCCESS; + + errlHndl_t err = NULL; + + FAPI_INVOKE_HWP( + err, + mss_get_mark_store, + fapi::Target(fapi::TARGET_TYPE_MBA_CHIPLET, i_mbaTarget), + i_rank, + o_chipMark, + o_symbolMark); + + if(NULL != err) + { + PRDF_ERR( "[PlatServices::mssGetMarkStore] mss_get_mark_store" + "failed" ); + PRDF_COMMIT_ERRL( err, ERRL_ACTION_REPORT ); + o_rc = FAIL; + } + + return o_rc; +} + +int32_t mssGetSteerMux( + TARGETING::TargetHandle_t i_mbaTarget, + uint8_t i_rank, + mss_SteerMux::muxType i_muxType, + uint8_t & o_portZeroSpare, + uint8_t & o_portOneSpare, + uint8_t & o_eccSpare) +{ + int32_t o_rc = SUCCESS; + + errlHndl_t err = NULL; + + FAPI_INVOKE_HWP( + err, + mss_get_steer_mux, + fapi::Target(fapi::TARGET_TYPE_MBA_CHIPLET, i_mbaTarget), + i_rank, + i_muxType, + o_portZeroSpare, + o_portOneSpare, + o_eccSpare); + + if(NULL != err) + { + PRDF_ERR( "[PlatServices::mssGetSteerMux] mss_get_steer_mux" + "failed" ); + PRDF_COMMIT_ERRL( err, ERRL_ACTION_REPORT ); + o_rc = FAIL; + } + + return o_rc; + +} + +int32_t mssRestoreDramRepairs( + TARGETING::TargetHandle_t i_mbaTarget, + uint8_t & o_repairedRankMask, + uint8_t & o_badDimmMask) +{ + int32_t o_rc = SUCCESS; + + errlHndl_t err = NULL; + + // FIXME uncomment when this function exists ... RTC 51507 + +#if 0 + + FAPI_INVOKE_HWP( + err, + mss_restore_dram_repairs, + fapi::Target(fapi::TARGET_TYPE_MBA_CHIPLET, i_mbaTarget), + o_repairedRankMask, + o_badDimmMask); +#endif + + if(NULL != err) + { + PRDF_ERR( "[PlatServices::mssRestoreDramRepairs] " + "mss_restore_dram_repairs failed" ); + PRDF_COMMIT_ERRL( err, ERRL_ACTION_REPORT ); + o_rc = FAIL; + } + + return o_rc; +} + +int32_t getBadDqBitmap( TARGETING::TargetHandle_t i_mbaTarget, + const uint8_t i_portSlct, + const uint8_t i_dimmSlct, + const uint8_t i_rankSlct, + uint8_t (&o_data)[DIMM_DQ_RANK_BITMAP_SIZE] ) +{ + int32_t o_rc = SUCCESS; + + errlHndl_t err = NULL; + + FAPI_INVOKE_HWP( + err, + dimmGetBadDqBitmap, + fapi::Target(fapi::TARGET_TYPE_MBA_CHIPLET, i_mbaTarget), + i_portSlct, + i_dimmSlct, + i_rankSlct, + o_data); + + if(NULL != err) + { + PRDF_ERR( "[PlatServices::getBadDqBitmap] dimmGetBadDqBitmap" + "failed" ); + PRDF_COMMIT_ERRL( err, ERRL_ACTION_REPORT ); + o_rc = FAIL; + } + + return o_rc; +} + +#endif // __HOSTBOOT_MODULE + +//############################################################################## +//## +//## FSP only functions +//## +//############################################################################## + +#ifndef __HOSTBOOT_MODULE + +errlHndl_t runtimeDeconfig( TARGETING::TargetHandle_t i_target ) +{ + using namespace HWAS; + return deconfigureTargetAtRuntime( i_target, DECONFIG_FOR_DUMP ); +} + +#endif // not __HOSTBOOT_MODULE + +} // end namespace PlatServices + +} // end namespace PRDF + diff --git a/src/usr/diag/prdf/common/framework/service/prdfPlatServices.H b/src/usr/diag/prdf/common/framework/service/prdfPlatServices.H new file mode 100755 index 000000000..50f21c9aa --- /dev/null +++ b/src/usr/diag/prdf/common/framework/service/prdfPlatServices.H @@ -0,0 +1,290 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/service/prdfPlatServices.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef PRDFPLATSERVICES_H +#define PRDFPLATSERVICES_H + +/** + * @file prdfPlatServices.H + * @brief Wrapper code for things PRD needs from external components ( other then targetting ). + */ + +//------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------ + +#include <algorithm> + +#include <iipconst.h> +#include <prdfTargetServices.H> +#include <prdfTimer.H> + +#include <errlentry.H> +#include <dimmConsts.H> + +#ifdef __HOSTBOOT_MODULE + #include <dram_initialization/mss_memdiag/mss_maint_cmds.H> +#endif + +//------------------------------------------------------------------------------ + +namespace PRDF +{ + +namespace PlatServices +{ + +//############################################################################## +//## +//## Hostboot and FSP functions +//## +//############################################################################## + +//############################################################################## +//## System Level Utility Functions +//############################################################################## + +//FIXME functions defintion not found.Should we remove it? +//void enterCCMMode(); +//bool inCMMode(); +//bool isCM_FUNCTIONAL(TARGETING::TargetHandle_t); + +/** + * @brief Returns if role is mater fsp. + * @param None. + * @return TRUE if master fsp. FALSE if not master fsp. + * @pre None. + * @post None. + */ +bool isMasterFSP(); + +/** + * @brief Checks if we are currently doing a memory preserving IPL. + * @param None. + * @return TRUE if this is a memory preserving IPL, FALSE otherwise. + * @pre None. + * @post None. + */ +bool isMemoryPreservingIpl(); + +/** + * @brief Return ecidString for a given target + * @param i_pGivenTarget handle to target + * @param o_ecidStr buffer for ecidstring + * @return Returns ecidString for given target Handle + * @pre none + * @post none + */ +void getECIDString( TARGETING::TargetHandle_t i_pGivenHandle, const char *o_ecidStr ); + +/** + * @brief Get a PRD timer value based on the current time. + * @param o_timer The returned PrdTimer + */ +void getCurrentTime( PrdTimer & o_timer ); + +/** + * @brief synch the file with rmgr + * @param i_fileName file name + * @return NULL if synch is unsuccessfull, error handle otherwise + */ +errlHndl_t syncFile( const char* i_fileName ); + +//############################################################################## +//## MNFG Policy Flag Functions +//############################################################################## + +/** + * @brief Returns the state of the MNFG_THRESHOLDS policy flag. + * @return TRUE if MNFG_THRESHOLDS is set, FALSE otherwise. + */ +bool mfgMode(); + +/** + * @brief Returns the state of the MNFG_HDAT_AVP_ENABLE policy flag. + * @return TRUE if MNFG_HDAT_AVP_ENABLE is set, FALSE otherwise. + */ +bool hdatAvpMode(); + +/** + * @brief Returns status of MNFG_SRC_TERM manufacturing policy flag. + * @param None. + * @return TRUE if MNFG_SRC_TERM policy flag is set, FALSE + * otherwise. + * @pre None. + * @post None. + */ +bool mnfgTerminate(); + +/** + * @brief Returns the state of the MNFG_NO_RBS policy flag. + * @return TRUE if MNFG_NO_RBS is set, FALSE otherwise. + */ +bool areDramRepairsDisabled(); + +//############################################################################## +//## Memory specific functions +//############################################################################## + +/** + * @brief Returns the memory buffer raw card type (i.e. R/C A). + * @param i_memTarget A memory buffer, MBA, or DIMM. + * @return + */ +/* TODO - See .C +getMembufRawCardType( TARGETING::TargetHandle_t i_memTarget ); +*/ + +/** + * @brief Returns the type of the card the DIMM is plugged into. + * @param i_dimmTarget A DIMM target. + * @return + */ + +/* TODO - See .C +getDimmPlugCardType( TARGETING::TargetHandle_t i_dimmTarget ); +*/ + +/** + * @brief Writes the bad DQ bitmap attribute. + * @param i_mbaTarget A MBA target. + * @param i_portSlct Port select (0-1). + * @param i_dimmSlct DIMM select (0-1). + * @param i_rankSlct Rank select (0-3). + * @param i_data The input data array. + * @return Non-SUCCESS if an internal function fails, SUCCESS otherwise. + */ +/* TODO - See .C +int32_t setBadDqBitmap( TARGETING::TargetHandle_t i_mbaTarget + const uint8_t i_portSlct, + const uint8_t i_dimmSlct, + const uint8_t i_rankSlct, + const uint8_t (&i_data)[DIMM_DQ_RANK_BITMAP_SIZE] ); +*/ + +//############################################################################## +//## +//## Hostboot only functions +//## +//############################################################################## + +#ifdef __HOSTBOOT_MODULE + +/** + * @brief Checks if we are running in MDIA mode. + * @return TRUE if in MDIA mode, FALSE otherwise. + */ +bool isInMdiaMode(); + +/** + * @brief Sends a command complete message to MDIA. + * @param i_mbaTarget An MBA target. + * @return Non-SUCCESS in internal function fails, SUCCESS otherwise. + */ +int32_t mdiaSendCmdComplete( TARGETING::TargetHandle_t i_mbaTarget ); + +/** + * @brief Invokes the get mark store hardware procedure. + * @param i_mbaTarget + * @param i_rank + * @param o_chipMark + * @param o_symbolMark + * @return Non-SUCCESS in internal function fails, SUCCESS otherwise. + */ +int32_t mssGetMarkStore( + TARGETING::TargetHandle_t i_mbaTarget, + uint8_t i_rank, + uint8_t & o_chipMark, + uint8_t & o_symbolMark); + +/** + * @brief Invokes the get steer mux hardware procedure. + * @param i_mbaTarget + * @param i_rank + * @param i_muxType Read/Write Mux select + * @param o_portZeroSpare + * @param o_portOneSpare + * @param o_eccSpare + * @return Non-SUCCESS in internal function fails, SUCCESS otherwise. + */ +int32_t mssGetSteerMux( + TARGETING::TargetHandle_t i_mbaTarget, + uint8_t i_rank, + mss_SteerMux::muxType i_muxType, + uint8_t & o_portZeroSpare, + uint8_t & o_portOneSpare, + uint8_t & o_eccSpare); + +/** + * @brief Invokes the restore DRAM repairs hardware procedure. + * @param i_mbaTarget + * @param o_repairedRankMask An encoded bitmask of repaired ranks. + * @param o_badDimm An encoded bitmask of bad DIMMs. + * @return Non-SUCCESS in internal function fails, SUCCESS otherwise. + */ +int32_t mssRestoreDramRepairs( + TARGETING::TargetHandle_t i_mbaTarget, + uint8_t & o_repairedRankMask, + uint8_t & o_badDimmMask); + +/** + * @brief Reads the bad DQ bitmap attribute. + * @param i_mbaTarget A MBA target. + * @param i_portSlct Port select (0-1). + * @param i_dimmSlct DIMM select (0-1). + * @param i_rankSlct Rank select (0-3). + * @param o_data The return data array. + * @return Non-SUCCESS if an internal function fails, SUCCESS otherwise. + */ +// FIXME: Eventually needs to be supported in FSP code as well. +int32_t getBadDqBitmap( TARGETING::TargetHandle_t i_mbaTarget, + const uint8_t i_portSlct, + const uint8_t i_dimmSlct, + const uint8_t i_rankSlct, + uint8_t (&o_data)[DIMM_DQ_RANK_BITMAP_SIZE] ); + +#endif // __HOSTBOOT_MODULE + +//############################################################################## +//## +//## FSP only functions +//## +//############################################################################## + +#ifndef __HOSTBOOT_MODULE + +/** + * @brief Do a runtime deconfiguration of the given target. + * @param i_target The target to deconfigure. + * @return NULL if deconfig is successful, non-NULL otherwise. + */ +errlHndl_t runtimeDeconfig( TARGETING::TargetHandle_t i_target ); + +#endif // not __HOSTBOOT_MODULE + +} // end namespace PlatServices + +} // end namespace PRDF + +#endif // PRDFPLATSERVICES_H + diff --git a/src/usr/diag/prdf/common/framework/service/prdfServiceDataCollector.C b/src/usr/diag/prdf/common/framework/service/prdfServiceDataCollector.C new file mode 100755 index 000000000..6aa984cf6 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/service/prdfServiceDataCollector.C @@ -0,0 +1,385 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/service/prdfServiceDataCollector.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2004,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +/** + @file prdfServiceDataCollector.C + @brief ServiceDataCollector definition +*/ +//------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------ +#include <string.h> // for memcpy +#define prdfServiceDataCollector_C + +#ifdef __HOSTBOOT_MODULE + // these are no-ops in HB + #define htonl(foo) (foo) + #define htons(foo) (foo) + #define ntohl(foo) (foo) + #define ntohs(foo) (foo) +#else + #include <netinet/in.h> +#endif + +#include <iipServiceDataCollector.h> +#include <prdfPlatServices.H> +#include <prdfTrace.H> +#undef prdfServiceDataCollector_C + +using namespace PRDF; + +//------------------------------------------------------------------------------ +// User Types, Constants, macros, prototypes, globals +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +// Member Function Specifications +//------------------------------------------------------------------------------ +#ifndef __HOSTBOOT_MODULE + +inline void buffer_append(uint8_t *&ptr, uint32_t value) +{ + uint32_t l_tmp32 = htonl(value); + memcpy(ptr, &l_tmp32, sizeof(uint32_t)); + ptr += sizeof(uint32_t); +} + +inline void buffer_append(uint8_t *&ptr, uint16_t value) +{ + uint16_t l_tmp16 = htons(value); + memcpy(ptr, &l_tmp16, sizeof(uint16_t)); + ptr += sizeof(uint16_t); +} + +inline void buffer_append(uint8_t *&ptr, uint8_t value) +{ + memcpy(ptr, &value, sizeof(value)); + ptr += sizeof(uint8_t); +} + +inline uint32_t buffer_get32(const uint8_t * &ptr) +{ + uint32_t l_tmp32 = 0; + memcpy(&l_tmp32, ptr, sizeof(uint32_t)); + ptr += sizeof(uint32_t); + return ntohl(l_tmp32); +} + +inline uint16_t buffer_get16(const uint8_t * &ptr) +{ + uint16_t l_tmp16 = 0; + memcpy(&l_tmp16, ptr, sizeof(uint16_t)); + ptr += sizeof(uint16_t); + return ntohs(l_tmp16); +} + +inline uint8_t buffer_get8(const uint8_t * &ptr) +{ + uint8_t l_tmp8 = 0; + memcpy(&l_tmp8, ptr, sizeof(uint8_t)); + ptr += sizeof(uint8_t); + return l_tmp8; +} + +inline void buffer_append( uint8_t *&ptr, const TARGETING::TargetHandle_t i_pGivenHandle ) +{ + HUID l_targetHuid = PlatServices::getHuid( i_pGivenHandle ); + l_targetHuid = htonl( l_targetHuid ); + uint32_t l_size = sizeof( l_targetHuid ); + memcpy( ptr, &l_targetHuid, l_size ); + ptr += l_size; +} + +inline TARGETING::TargetHandle_t buffer_getTarget( const uint8_t *&ptr ) +{ + HUID l_chipHuid = INVALID_HUID; + uint32_t l_size = sizeof( l_chipHuid ); + memcpy( &l_chipHuid, ptr, l_size ); + l_chipHuid = ntohl( l_chipHuid ); + TARGETING::TargetHandle_t l_tempChipHandle = PlatServices::getTarget( l_chipHuid ); + ptr += l_size; + + return l_tempChipHandle; +} + +#endif + +//------------------------------------------------------------------------------ + +void ServiceDataCollector::SetCallout( PRDcallout mru, + PRDpriority priority ) +{ + bool found = false; + + if ( PRDcallout::TYPE_TARGET == mru.getType() ) + { + // Ensuring target is not NULL + if ( NULL == mru.getTarget() ) + { + PRDF_ERR( "[ServiceDataCollector::SetCallout] " + "skipping NULL callout" ); + return; + } + } + + for ( SDC_MRU_LIST::iterator i = xMruList.begin(); + i != xMruList.end() && found == false; ++i ) + { + if ( i->callout == mru ) + { + found = true; + if ( priority < i->priority ) + { + i->priority = priority; + } + } + } + + if ( found == false ) + { + xMruList.push_back( SdcCallout(mru, priority) ); + } +} + +//------------------------------------------------------------------------------ + +void ServiceDataCollector::AddSignatureList(TARGETING::TargetHandle_t i_pTargetHandle, + uint32_t i_signature) +{ + bool found = false; + if(NULL == i_pTargetHandle) + { + PRDF_ERR(" ServiceDataCollector::AddSignatureList could not add invalid target "); + return; + } + for(PRDF_SIGNATURES::iterator i = iv_SignatureList.begin(); + i != iv_SignatureList.end(); i++) + { + if((i->iv_pSignatureHandle == i_pTargetHandle) && + (i->iv_signature == i_signature)) + { + found = true; + break; + } + } + if(found == false) + { + iv_SignatureList.push_back(PrdfSignatureList(i_pTargetHandle, i_signature)); + } +} + +//------------------------------------------------------------------------------ + +#ifndef __HOSTBOOT_MODULE + +uint32_t ServiceDataCollector::Flatten(uint8_t * i_buffer, uint32_t & io_size) const +{ + uint32_t max_size = io_size; + uint32_t rc = SUCCESS; + //getting the actual size of prdfHcdbChangeItem and PrdfSignatureList that gets saved in memory. since + //instead of handle we save the entity path + uint32_t l_sizeHcdbChange = iv_HcdbChangeList.size() * sizeof(PrdfHcdbChangeItem); + uint32_t l_sizeSignList = iv_SignatureList.size() * sizeof(PrdfSignatureList); + uint32_t l_sizeMruList = xMruList.size() * sizeof(SdcCallout); + // approximate space needed for essentials. This estimate is slightly higher than actual + const uint32_t MIN_FLAT_SIZE = sizeof(ServiceDataCollector) + sizeof(struct PrdTimer::prdftm_t) + + l_sizeMruList + l_sizeHcdbChange + l_sizeSignList; + + uint8_t * current_ptr = i_buffer; + + if(max_size > MIN_FLAT_SIZE) + { + // must have this + uint32_t l_huid = error_signature.getChipId(); + buffer_append(current_ptr,l_huid); + buffer_append(current_ptr,error_signature.getSigId()); + // callouts + buffer_append(current_ptr,xMruList.size()); + for ( SDC_MRU_LIST::const_iterator i = xMruList.begin(); + i != xMruList.end(); ++i ) + { + buffer_append( current_ptr, (uint32_t)i->callout.getType() ); + buffer_append( current_ptr, i->callout.flatten() ); + buffer_append( current_ptr, (uint32_t)i->priority ); + } + buffer_append(current_ptr, iv_HcdbChangeList.size()); + for(HCDB_CHANGE_LIST::const_iterator i = iv_HcdbChangeList.begin(); + i != iv_HcdbChangeList.end(); ++i) + { + buffer_append(current_ptr,(TARGETING::TargetHandle_t)i->iv_phcdbtargetHandle); + buffer_append(current_ptr,(uint32_t)i->iv_compSubType); + buffer_append(current_ptr,(uint32_t)i->iv_compType); + } + buffer_append(current_ptr, iv_SignatureList.size()); + for(PRDF_SIGNATURES::const_iterator i = iv_SignatureList.begin(); + i != iv_SignatureList.end(); ++i) + { + buffer_append(current_ptr,(TARGETING::TargetHandle_t)i->iv_pSignatureHandle); + buffer_append(current_ptr,(uint32_t)i->iv_signature); + } + buffer_append(current_ptr,maskId); + buffer_append(current_ptr,(uint32_t)attentionType); + buffer_append(current_ptr,flags); + buffer_append(current_ptr,hitCount); + buffer_append(current_ptr,threshold); + buffer_append(current_ptr,reasonCode); + buffer_append(current_ptr,startingPoint); + buffer_append(current_ptr,(uint32_t)errorType); + //@ecdf - Removed ivDumpRequestType. + buffer_append(current_ptr,ivDumpRequestContent); + buffer_append(current_ptr,ivpDumpRequestChipHandle); + PrdTimer::prdftm_t l_tm = ivCurrentEventTime.gettm(); + const uint32_t PRDFTM_SIZE = sizeof(struct PrdTimer::prdftm_t); + memcpy(current_ptr,&l_tm,PRDFTM_SIZE); + current_ptr += PRDFTM_SIZE; + buffer_append(current_ptr,(uint32_t)causeAttentionType); + buffer_append(current_ptr,ivpThermalChipHandle); + + // Add as much capture data as we have room. + uint8_t * cap_size_ptr = current_ptr; // Place for Capture data size + current_ptr += sizeof(uint32_t); + + uint32_t cap_size = captureData.Copy(current_ptr,max_size - (current_ptr - i_buffer)); + current_ptr += cap_size; + buffer_append(cap_size_ptr,cap_size); + + } + else // buffer is not big enough to capture the essentials + { + rc = 2; + } + + io_size = current_ptr - i_buffer; + + return rc; +} + +//------------------------------------------------------------------------------ + +ServiceDataCollector & ServiceDataCollector::operator=( + const uint8_t * i_flatdata ) +{ + error_signature.setChipId( buffer_get32(i_flatdata) ); + error_signature.setSigId( buffer_get32(i_flatdata) ); + + ClearCallouts(); + uint32_t value = buffer_get32(i_flatdata); // number of callouts + for ( uint32_t i = 0; i < value; ++i ) + { + PRDcallout::MruType mt = (PRDcallout::MruType) buffer_get32(i_flatdata); + uint32_t mru = buffer_get32(i_flatdata); + PRDpriority priority = (PRDpriority) buffer_get32(i_flatdata); + + PRDcallout callout( mru, mt ); + xMruList.push_back( SdcCallout(callout, priority) ); + } + + ClearHcdbList(); + value = buffer_get32(i_flatdata); // number of HcdbEntries. + for(uint32_t i = 0; i < value; ++i) + { + TARGETING::TargetHandle_t l_pChipHandle = buffer_getTarget(i_flatdata); + hcdb::comp_subtype_t l_compSubType = (hcdb::comp_subtype_t)buffer_get32(i_flatdata); + comp_id_t l_compType = (comp_id_t)buffer_get32(i_flatdata); + if(NULL !=l_pChipHandle) + { + PrdfHcdbChangeItem l_item(l_pChipHandle, l_compSubType, l_compType); + iv_HcdbChangeList.push_back(l_item); + + } + } + ClearSignatureList(); + value = buffer_get32(i_flatdata); // number of HcdbEntries. + for(uint32_t i = 0; i < value; ++i) + { + TARGETING::TargetHandle_t l_pChipHandle = buffer_getTarget(i_flatdata); + uint32_t l_signature = (uint32_t) buffer_get32(i_flatdata); + if(NULL !=l_pChipHandle) + { + PrdfSignatureList l_item(l_pChipHandle, l_signature); + iv_SignatureList.push_back(l_item); + } + } + + maskId = buffer_get32(i_flatdata); + attentionType = (ATTENTION_TYPE)buffer_get32(i_flatdata); + flags = buffer_get32(i_flatdata); //mp02 c from buffer_get16 + hitCount = buffer_get8(i_flatdata); + threshold = buffer_get8(i_flatdata); + reasonCode = buffer_get16(i_flatdata); //mp04 a + startingPoint = buffer_getTarget(i_flatdata); + errorType = (GardResolution::ErrorType)buffer_get32(i_flatdata); + ivDumpRequestContent = (hwTableContent) buffer_get32(i_flatdata); //@ecdf + ivpDumpRequestChipHandle = buffer_getTarget(i_flatdata); + + PrdTimer::prdftm_t l_tm; + const uint32_t PRDFTM_SIZE = sizeof(struct PrdTimer::prdftm_t); + memcpy(&l_tm,i_flatdata,PRDFTM_SIZE); + i_flatdata += PRDFTM_SIZE; + ivCurrentEventTime.settm(l_tm); + + causeAttentionType = (ATTENTION_TYPE) buffer_get32(i_flatdata); + ivpThermalChipHandle = buffer_getTarget(i_flatdata); + + // Capture data - oh joy + // do we re-expand the data or change capture date to hang onto the already flattened data? + // lets give it back to the capture data object and let it decide. + + captureData = i_flatdata; + + return *this; +} + +//------------------------------------------------------------------------------ + +void ServiceDataCollector::AddChangeForHcdb(TARGETING::TargetHandle_t i_pTargetHandle , + hcdb::comp_subtype_t i_testType, + comp_id_t i_compType) +{ + bool found = false; + //Ensuring the handles are valid before pushing to the list + if(NULL == i_pTargetHandle) + { + PRDF_ERR(" ServiceDataCollector::AddChangeForHcdb could not add invalid target "); + return; + } + + for(HCDB_CHANGE_LIST::iterator i = iv_HcdbChangeList.begin(); + i != iv_HcdbChangeList.end(); i++) + { + if((i->iv_phcdbtargetHandle ==i_pTargetHandle) && + (i->iv_compSubType == i_testType) && + (i->iv_compType == i_compType)) + { + found = true; + break; + } + } + if(found == false) + { + iv_HcdbChangeList.push_back( PrdfHcdbChangeItem(i_pTargetHandle, i_testType, i_compType)); + } +} + +#endif + diff --git a/src/usr/diag/prdf/common/framework/service/prdfTargetServices.C b/src/usr/diag/prdf/common/framework/service/prdfTargetServices.C new file mode 100755 index 000000000..e4bc77500 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/service/prdfTargetServices.C @@ -0,0 +1,1098 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/service/prdfTargetServices.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +/** + * @file prdfTargetServices.C + * @brief PRD wrapper of targetting code + */ + +//------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------ + +#include <prdfTargetServices.H> + +#include <algorithm> + +#include <iipbits.h> +#include <iipsdbug.h> +#include <iipglobl.h> +#include <prdfTrace.H> + +#include <errlentry.H> +#include <fapi.H> +#include <targeting/common/targetservice.H> + +using namespace TARGETING; + +//------------------------------------------------------------------------------ + +namespace PRDF +{ + +namespace PlatServices +{ + +//############################################################################## +//## +//## Target Manipulation Utility Functions +//## +//############################################################################## + +// FIXME: This function is using type PRDF::HUID. I think it should now be using +// TARGETING::HUID_ATTR. Also, will need equivalent to +// PRDF::INVALID_HUID. I think HWSV has HWSV_INVALID_HUID, but I don't +// think that exists in Hostboot. Need a common interface before making +// changes. +TARGETING::TargetHandle_t getTarget( HUID i_huid ) +{ + TargetHandle_t o_target = NULL; + + // FIXME: This is an incredibly inefficient linear search. It is recommended + // that the common targeting code provide an interface for us so that + // all users can call the potentially optimized function. There is a + // function available in HWSV (hwsvTargetUtil.H) but not in Hostboot. + // Sadly, the HWSV code does this exact linear search. + TargetService & l_targetService = targetService(); + for ( TargetIterator l_targetPtr = l_targetService.begin(); + l_targetPtr != l_targetService.end(); ++l_targetPtr ) + { + if ( i_huid == (l_targetPtr->getAttr<ATTR_HUID>()) ) + { + o_target = (*l_targetPtr); + break; + } + } + + if ( NULL == o_target ) + { + PRDF_ERR( "[getTarget] i_huid: 0x%08x failed", i_huid ); + } + + return o_target; +} + +//------------------------------------------------------------------------------ + +TARGETING::TargetHandle_t getTarget( const TARGETING::EntityPath & i_path ) +{ + TargetHandle_t o_target = targetService().toTarget( i_path ); + if ( NULL == o_target ) + { + PRDF_ERR( "[getTarget] Failed: i_path=" ); i_path.dump(); + } + + return o_target; +} + +//------------------------------------------------------------------------------ + +int32_t getEntityPath( TARGETING::TargetHandle_t i_target, + TARGETING::EntityPath & o_path, + TARGETING::EntityPath::PATH_TYPE i_pathType ) +{ + int32_t o_rc = FAIL; + + do + { + if ( NULL == i_target ) break; + + if ( EntityPath::PATH_NA != i_pathType ) + o_path.setType( i_pathType ); + + ATTRIBUTE_ID attr = ATTR_NA; + switch ( o_path.type() ) + { + case EntityPath::PATH_AFFINITY: attr = ATTR_AFFINITY_PATH; break; + case EntityPath::PATH_PHYSICAL: attr = ATTR_PHYS_PATH; break; + case EntityPath::PATH_POWER: attr = ATTR_POWER_PATH; break; + default: ; + } + if ( ATTR_NA == attr ) + { + PRDF_ERR( "[getEntityPath] Unsupported EntityPath type %d", + o_path.type() ); + break; + } + + if ( !targetService().tryGetPath(attr, i_target, o_path) ) + { + PRDF_ERR( "[getEntityPath] Failed to get path %d", attr ); + break; + } + + o_rc = SUCCESS; + + } while (0); + + if ( SUCCESS != o_rc ) + { + PRDF_ERR( "[getEntityPath] Failed: i_target=0x%08x", + getHuid(i_target) ); + } + + return o_rc; +} + +//------------------------------------------------------------------------------ + +HUID getHuid( TARGETING::TargetHandle_t i_target ) +{ + HUID o_huid = INVALID_HUID; + + do + { + if ( NULL == i_target ) break; // return INVALID_HUID + + // TODO: get_huid() (src/include/usr/targeting/common/util.H) can be + // called to fetch HUID however this feature is not yet available + // in FSP yet. + if ( !i_target->tryGetAttr<ATTR_HUID>(o_huid) ) + { + PRDF_ERR( "[getHuid] Failed to get ATTR_HUID" ); + o_huid = INVALID_HUID; // Just in case. + } + + } while (0); + + return o_huid; +} + +//------------------------------------------------------------------------------ + +bool isFunctional( TARGETING::TargetHandle_t i_target ) +{ + bool o_funcState = false; + + do + { + if ( NULL == i_target ) + { + PRDF_ERR( "[isFunctional] i_target is NULL" ); + break; + } + + HwasState l_funcState; + if ( !i_target->tryGetAttr<ATTR_HWAS_STATE>(l_funcState) ) + { + PRDF_ERR( "[isFunctional] Failed to get ATTR_HWAS_STATE" ); + break; + } + + if ( l_funcState.functional ) o_funcState =true; + } while (0); + + return o_funcState; +} + +//------------------------------------------------------------------------------ + +TARGETING::TYPE getTargetType( TARGETING::TargetHandle_t i_target ) +{ + TYPE o_type = TYPE_LAST_IN_RANGE; + + if ( NULL != i_target ) + { + if ( !i_target->tryGetAttr<ATTR_TYPE>(o_type) ) + { + PRDF_ERR( "[getTargetType] Failed to get ATTR_TYPE" ); + o_type = TYPE_LAST_IN_RANGE; // Just in case + } + } + + if ( TYPE_LAST_IN_RANGE == o_type ) + { + PRDF_ERR( "[getTargetType] Failed: i_target=0x%08x", + getHuid(i_target) ); + } + + return o_type; +} + +//------------------------------------------------------------------------------ + +TARGETING::CLASS getTargetClass( TARGETING::TargetHandle_t i_target ) +{ + CLASS o_class = CLASS_NA; + + if ( NULL != i_target ) + { + if ( !i_target->tryGetAttr<ATTR_CLASS>(o_class) ) + { + PRDF_ERR( "[getTargetClass] Failed to get ATTR_CLASS" ); + o_class = CLASS_NA; // Just in case + } + } + + if ( CLASS_NA == o_class ) + { + PRDF_ERR( "[getTargetClass] Failed: i_target=0x%08x", + getHuid(i_target) ); + } + + return o_class; +} + +//------------------------------------------------------------------------------ + +void printTargetInfo( TARGETING::TargetHandle_t i_target ) +{ + EntityPath l_path ( EntityPath::PATH_PHYSICAL ); + int32_t l_rc = getEntityPath( i_target, l_path ); + if ( SUCCESS == l_rc ) + { + PRDF_DTRAC( "PRDCONFIG: HUID=0x%08x path=", getHuid(i_target) ); + l_path.dump(); + } + else + { + PRDF_ERR( "[printTargetInfo] Failed: i_target=0x%08x", + getHuid(i_target) ); + } +} + +//------------------------------------------------------------------------------ + +uint8_t getChipLevel( TARGETING::TargetHandle_t i_target ) +{ + uint8_t o_chipLvl = 0; + + do + { + if ( NULL == i_target ) break; + + TargetHandle_t l_parentTarget = getParentChip( i_target ); + if ( NULL == l_parentTarget ) break; + + if ( !l_parentTarget->tryGetAttr<ATTR_EC>(o_chipLvl) ) + { + PRDF_ERR( "[getChipLevel] Failed to get ATTR_EC" ); + o_chipLvl = 0xff; // Just in case + } + + } while (0); + + if ( 0 == o_chipLvl ) + { + PRDF_ERR( "[getChipLevel] Failed: i_target=0x%08x", getHuid(i_target) ); + } + + return o_chipLvl; +} + +//------------------------------------------------------------------------------ + +/* TODO: getChipId() may be available in an attribute, but this design has not + * been solidified. Instead, we may need to query for 'reason' attributes + * to determine the reason we need to do the checks. Since we don't have + * any immediate need for these functions (no workarounds as of yet), we + * will leave them commented out in the code. +uint8_t getChipId( TARGETING::TargetHandle_t i_target ) +{ + // Returns chip ID enum (i.e. P7, P7+, etc.) + return 0; +} +*/ + +//############################################################################## +//## +//## getConnected() support functions +//## +//############################################################################## + +// This is a helper function for getConnected(). It will return the association +// type (CHILD_BY_AFFINITY or PARENT_BY_AFFINITY) between a target and +// destination target type. The function only characterizes parent or child +// relationships. It does not do any peer-to-peer relationships. The function +// will return non-SUCCESS if a relationship is not supported. + +struct conn_t +{ + TYPE from : 8; + TYPE to : 8; + TargetService::ASSOCIATION_TYPE type : 8; + + bool operator<( const conn_t & r ) + { + if ( this->from == r.from ) + return ( this->to < r.to ); + else + return ( this->from < r.from ); + } + +} PACKED; + +int32_t getAssociationType( TARGETING::TargetHandle_t i_target, + TARGETING::TYPE i_connType, + TARGETING::TargetService::ASSOCIATION_TYPE & o_type) +{ + int32_t o_rc = SUCCESS; + + static conn_t lookups[] = + { + // This table must be sorted based on the < operator of struct conn_t. + // FIXME: Create a Cxx test case that will catch if the values of the + // TYPE enum changes. + { TYPE_NODE, TYPE_DIMM, TargetService::CHILD_BY_AFFINITY }, + { TYPE_NODE, TYPE_MEMBUF, TargetService::CHILD_BY_AFFINITY }, + { TYPE_NODE, TYPE_PROC, TargetService::CHILD_BY_AFFINITY }, + { TYPE_NODE, TYPE_EX, TargetService::CHILD_BY_AFFINITY }, + { TYPE_NODE, TYPE_CORE, TargetService::CHILD_BY_AFFINITY }, + { TYPE_NODE, TYPE_L2, TargetService::CHILD_BY_AFFINITY }, + { TYPE_NODE, TYPE_L3, TargetService::CHILD_BY_AFFINITY }, + { TYPE_NODE, TYPE_L4, TargetService::CHILD_BY_AFFINITY }, + { TYPE_NODE, TYPE_MCS, TargetService::CHILD_BY_AFFINITY }, + { TYPE_NODE, TYPE_MBS, TargetService::CHILD_BY_AFFINITY }, + { TYPE_NODE, TYPE_MBA, TargetService::CHILD_BY_AFFINITY }, + { TYPE_NODE, TYPE_XBUS, TargetService::CHILD_BY_AFFINITY }, + { TYPE_NODE, TYPE_ABUS, TargetService::CHILD_BY_AFFINITY }, + { TYPE_NODE, TYPE_PCI, TargetService::CHILD_BY_AFFINITY }, + + { TYPE_DIMM, TYPE_NODE, TargetService::PARENT_BY_AFFINITY }, + { TYPE_DIMM, TYPE_MEMBUF, TargetService::PARENT_BY_AFFINITY }, + { TYPE_DIMM, TYPE_PROC, TargetService::PARENT_BY_AFFINITY }, + { TYPE_DIMM, TYPE_MCS, TargetService::PARENT_BY_AFFINITY }, + { TYPE_DIMM, TYPE_MBA, TargetService::PARENT_BY_AFFINITY }, + + { TYPE_MEMBUF, TYPE_NODE, TargetService::PARENT_BY_AFFINITY }, + { TYPE_MEMBUF, TYPE_DIMM, TargetService::CHILD_BY_AFFINITY }, + { TYPE_MEMBUF, TYPE_PROC, TargetService::PARENT_BY_AFFINITY }, + { TYPE_MEMBUF, TYPE_L4, TargetService::CHILD_BY_AFFINITY }, + { TYPE_MEMBUF, TYPE_MCS, TargetService::PARENT_BY_AFFINITY }, + { TYPE_MEMBUF, TYPE_MBS, TargetService::CHILD_BY_AFFINITY }, + { TYPE_MEMBUF, TYPE_MBA, TargetService::CHILD_BY_AFFINITY }, + + { TYPE_PROC, TYPE_NODE, TargetService::PARENT_BY_AFFINITY }, + { TYPE_PROC, TYPE_DIMM, TargetService::CHILD_BY_AFFINITY }, + { TYPE_PROC, TYPE_MEMBUF, TargetService::CHILD_BY_AFFINITY }, + { TYPE_PROC, TYPE_EX, TargetService::CHILD_BY_AFFINITY }, + { TYPE_PROC, TYPE_CORE, TargetService::CHILD_BY_AFFINITY }, + { TYPE_PROC, TYPE_L2, TargetService::CHILD_BY_AFFINITY }, + { TYPE_PROC, TYPE_L3, TargetService::CHILD_BY_AFFINITY }, + { TYPE_PROC, TYPE_L4, TargetService::CHILD_BY_AFFINITY }, + { TYPE_PROC, TYPE_MCS, TargetService::CHILD_BY_AFFINITY }, + { TYPE_PROC, TYPE_MBS, TargetService::CHILD_BY_AFFINITY }, + { TYPE_PROC, TYPE_MBA, TargetService::CHILD_BY_AFFINITY }, + { TYPE_PROC, TYPE_XBUS, TargetService::CHILD_BY_AFFINITY }, + { TYPE_PROC, TYPE_ABUS, TargetService::CHILD_BY_AFFINITY }, + { TYPE_PROC, TYPE_PCI, TargetService::CHILD_BY_AFFINITY }, + + { TYPE_EX, TYPE_NODE, TargetService::PARENT_BY_AFFINITY }, + { TYPE_EX, TYPE_PROC, TargetService::PARENT_BY_AFFINITY }, + { TYPE_EX, TYPE_CORE, TargetService::CHILD_BY_AFFINITY }, + { TYPE_EX, TYPE_L2, TargetService::CHILD_BY_AFFINITY }, + { TYPE_EX, TYPE_L3, TargetService::CHILD_BY_AFFINITY }, + + { TYPE_CORE, TYPE_NODE, TargetService::PARENT_BY_AFFINITY }, + { TYPE_CORE, TYPE_PROC, TargetService::PARENT_BY_AFFINITY }, + { TYPE_CORE, TYPE_EX, TargetService::PARENT_BY_AFFINITY }, + + { TYPE_L2, TYPE_NODE, TargetService::PARENT_BY_AFFINITY }, + { TYPE_L2, TYPE_PROC, TargetService::PARENT_BY_AFFINITY }, + { TYPE_L2, TYPE_EX, TargetService::PARENT_BY_AFFINITY }, + + { TYPE_L3, TYPE_NODE, TargetService::PARENT_BY_AFFINITY }, + { TYPE_L3, TYPE_PROC, TargetService::PARENT_BY_AFFINITY }, + { TYPE_L3, TYPE_EX, TargetService::PARENT_BY_AFFINITY }, + + { TYPE_MBS, TYPE_NODE, TargetService::PARENT_BY_AFFINITY }, + { TYPE_MBS, TYPE_MEMBUF, TargetService::PARENT_BY_AFFINITY }, + { TYPE_MBS, TYPE_PROC, TargetService::PARENT_BY_AFFINITY }, + { TYPE_MBS, TYPE_MCS, TargetService::PARENT_BY_AFFINITY }, + + { TYPE_MCS, TYPE_NODE, TargetService::PARENT_BY_AFFINITY }, + { TYPE_MCS, TYPE_DIMM, TargetService::CHILD_BY_AFFINITY }, + { TYPE_MCS, TYPE_MEMBUF, TargetService::CHILD_BY_AFFINITY }, + { TYPE_MCS, TYPE_PROC, TargetService::PARENT_BY_AFFINITY }, + { TYPE_MCS, TYPE_L4, TargetService::CHILD_BY_AFFINITY }, + { TYPE_MCS, TYPE_MBS, TargetService::CHILD_BY_AFFINITY }, + { TYPE_MCS, TYPE_MBA, TargetService::CHILD_BY_AFFINITY }, + + { TYPE_MBS, TYPE_NODE, TargetService::PARENT_BY_AFFINITY }, + { TYPE_MBS, TYPE_MEMBUF, TargetService::PARENT_BY_AFFINITY }, + { TYPE_MBS, TYPE_PROC, TargetService::PARENT_BY_AFFINITY }, + { TYPE_MBS, TYPE_MCS, TargetService::PARENT_BY_AFFINITY }, + + { TYPE_MBA, TYPE_NODE, TargetService::PARENT_BY_AFFINITY }, + { TYPE_MBA, TYPE_DIMM, TargetService::CHILD_BY_AFFINITY }, + { TYPE_MBA, TYPE_MEMBUF, TargetService::PARENT_BY_AFFINITY }, + { TYPE_MBA, TYPE_PROC, TargetService::PARENT_BY_AFFINITY }, + { TYPE_MBA, TYPE_MCS, TargetService::PARENT_BY_AFFINITY }, + + { TYPE_XBUS, TYPE_NODE, TargetService::PARENT_BY_AFFINITY }, + { TYPE_XBUS, TYPE_PROC, TargetService::PARENT_BY_AFFINITY }, + + { TYPE_ABUS, TYPE_NODE, TargetService::PARENT_BY_AFFINITY }, + { TYPE_ABUS, TYPE_PROC, TargetService::PARENT_BY_AFFINITY }, + + { TYPE_PCI, TYPE_NODE, TargetService::PARENT_BY_AFFINITY }, + { TYPE_PCI, TYPE_PROC, TargetService::PARENT_BY_AFFINITY }, + }; + + const size_t sz_lookups = sizeof(lookups) / sizeof(conn_t); + + conn_t match = { getTargetType(i_target), i_connType, + TargetService::CHILD_BY_AFFINITY }; + + conn_t * it = std::lower_bound( lookups, lookups + sz_lookups, match ); + + if ( it != lookups + sz_lookups ) + o_type = it->type; + else + { + PRDF_ERR( "[getAssociationType] Failed: i_target=0x%08x i_connType=%d", + getHuid(i_target), i_connType ); + o_rc = FAIL; + } + + return o_rc; +} + +//------------------------------------------------------------------------------ + +// Helper function to return a parent or container target of a specified type. +// For example, get EX target from CORE or PROC target from MEMBUF. Note, that +// the input target could be the parent. Will return NULL if the parent is not +// found. For example, a DIMM could not be a parent of a PROC. +TARGETING::TargetHandle_t getParent( TARGETING::TargetHandle_t i_target, + TARGETING::TYPE i_connType ) +{ + TARGETING::TargetHandle_t o_target = i_target; // Assume it is the parent. + + if ( i_connType != getTargetType(i_target) ) + { + TargetHandleList list = getConnected( i_target, i_connType ); + o_target = ( 1 == list.size() ) ? list[0] : NULL; + } + + if ( NULL == o_target ) + { + PRDF_ERR( "[getParent] Failed: i_target=0x%08x i_connType=%d", + getHuid(i_target), i_connType ); + } + + return o_target; +} + +//------------------------------------------------------------------------------ + +TARGETING::TargetHandleList getConnected( TARGETING::TargetHandle_t i_target, + TARGETING::TYPE i_connType ) +{ + TargetHandleList o_list; // Default empty list + + do + { + // Parameter checks. Error trace output is in NULL check below. + if ( NULL == i_target ) break; + + TargetService::ASSOCIATION_TYPE l_assocType; + int32_t l_rc = getAssociationType( i_target, i_connType, l_assocType ); + if ( SUCCESS != l_rc ) break; + + // Match any class, specified type, and functional. + PredicateCTM predType( CLASS_NA, i_connType ); + PredicateIsFunctional predFunc; + PredicatePostfixExpr predAnd; + predAnd.push(&predType).push(&predFunc).And(); + + targetService().getAssociated( o_list, i_target, l_assocType, + TargetService::ALL, &predAnd ); + + } while(0); + + if ( 0 == o_list.size() ) + { + PRDF_ERR( "[getConnected] Failed: i_target=0x%08x i_connType=%d", + getHuid(i_target), i_connType ); + } + + return o_list; +} + +//------------------------------------------------------------------------------ + +TARGETING::TargetHandle_t getConnectedPeerProc( + TARGETING::TargetHandle_t i_procTarget, + TARGETING::TYPE i_busType, + uint32_t i_busPos ) +{ + #define FUNC "[getConnectedPeerProc] " + + TargetHandle_t o_target = NULL; + + do + { + // Parameter checks. Error trace output is in NULL check below. + if ( NULL == i_procTarget ) break; + + if ( TYPE_PROC != getTargetType(i_procTarget) ) + { + PRDF_ERR( FUNC"Given target is not of TYPE_PROC" ); break; + } + + if ( !( ((TYPE_XBUS == i_busType) && (MAX_XBUS_PER_PROC > i_busPos)) || + ((TYPE_ABUS == i_busType) && (MAX_ABUS_PER_PROC > i_busPos)) ) ) + break; + + // Starting PROC -> starting XBUS/ABUS. + TargetHandleList list = getConnected( i_procTarget, i_busType ); + TargetHandle_t busTarget = NULL; + for (TargetHandleList::iterator i = list.begin(); i != list.end(); ++i) + { + if ( i_busPos == getTargetPosition(*i) ) + { + busTarget = *i; + break; // for loop + } + } + if ( NULL == busTarget ) + { + PRDF_ERR( FUNC"Couldn't find connected bus" ); break; + } + + // Starting XBUS/ABUS -> ATTR_PEER_TARGET -> destination XBUS/ABUS. + TargetHandle_t destTarget = NULL; +// FIXME - ATTR_PEER_TARGET support has not been ported to FSP yet. +// if ( !busTarget->tryGetAttr<ATTR_PEER_TARGET>(destTarget) ) + if ( true ) + { + PRDF_ERR( FUNC"Couldn't find destination bus" ); break; + } + + // Destination XBUS/ABUS <-> destination PROC. + list = getConnected( destTarget, TYPE_PROC ); + if ( 1 != list.size() ) + { + PRDF_ERR( FUNC"Couldn't find destination PROC" ); break; + } + o_target = list[0]; + + } while(0); + + if ( NULL == o_target ) + { + PRDF_ERR( FUNC"Failed: i_procTarget=0x%08x i_busType=%d i_busPos=%d", + getHuid(i_procTarget), i_busType, i_busPos ); + } + + #undef FUNC + + return o_target; +} + +//------------------------------------------------------------------------------ + +TARGETING::TargetHandle_t getSystemTarget() +{ + TargetHandle_t sysTarget = NULL; + targetService().getTopLevelTarget( sysTarget ); + + if ( NULL == sysTarget ) + { + PRDF_ERR( "[getSystemTarget] Failed" ); + } + + return sysTarget; +} + +//------------------------------------------------------------------------------ + +TARGETING::TargetHandle_t getParentChip( TARGETING::TargetHandle_t i_target ) +{ + TargetHandle_t o_chipTarget = NULL; + + CLASS l_class = getTargetClass( i_target ); + switch ( l_class ) + { + case CLASS_CHIP: + o_chipTarget = i_target; + break; + + case CLASS_UNIT: + { + TargetHandleList l_list; + PredicateCTM l_predClass( CLASS_CHIP ); + targetService().getAssociated( l_list, i_target, + TargetService::PARENT, + TargetService::IMMEDIATE, + &l_predClass ); + if ( 1 == l_list.size() ) + { + o_chipTarget = l_list[0]; + } + else + { + PRDF_ERR( "[getParentChip] Could not find parent chip" ); + } + break; + } + + default: + PRDF_ERR( "[getParentChip] Unsupported class: %d", l_class ); + } + + if ( NULL == o_chipTarget ) + { + PRDF_ERR( "[getParentChip] Failed: i_target=0x%08x", + getHuid(i_target) ); + } + + return o_chipTarget; +} + +//------------------------------------------------------------------------------ + +TARGETING::TargetHandleList getFunctionalTargetList( TARGETING::TYPE i_type ) +{ + TargetHandleList o_list; // Default empty list. + + TargetService & l_targetService = targetService(); + + // Match any class, specified type, and functional. + PredicateCTM l_predType( CLASS_NA, i_type ); + PredicateIsFunctional l_predFunc; + PredicatePostfixExpr l_predAnd; + l_predAnd.push(&l_predType).push(&l_predFunc).And(); + + // Defining a filter to get a list of all targets of i_type. + TargetRangeFilter l_filter( l_targetService.begin(), l_targetService.end(), + &l_predAnd ); + for( ; l_filter; ++l_filter ) + { + // Adding functional target to the vector. + o_list.push_back( *l_filter ); + } + + if ( 0 == o_list.size() ) + { + PRDF_ERR( "[getFunctionalTargetList] Failed: i_type=%d", i_type ); + } + + return o_list; +} + +//------------------------------------------------------------------------------ + +// FIXME: In the past, this was a wrapper for a GARD interface. Need to make +// sure that we have the equivelant functionality. +bool checkLastFuncCore( TARGETING::TargetHandle_t i_coreTarget ) +{ + bool o_lastCore = false; + + // TODO: Possibly support TYPE_EX, TYPE_L2, and TYPE_L3 as target input. + + TargetHandleList l_list = getFunctionalTargetList( TYPE_CORE ); + if ( 1 == l_list.size() && l_list[0] == i_coreTarget ) + o_lastCore = true; + + return o_lastCore; +} + +//############################################################################## +//## +//## Target position support code +//## +//############################################################################## + +uint32_t getTargetPosition( TARGETING::TargetHandle_t i_target ) +{ + #define FUNC "[getTargetPosition] " + + uint32_t o_pos = INVALID_POSITION_BOUND; + + CLASS l_class = getTargetClass( i_target ); + switch ( l_class ) + { + case CLASS_CHIP: + { + TYPE l_type = getTargetType( i_target ); + switch ( l_type ) + { + case TYPE_PROC: + { + uint16_t tmpPos = 0; + if ( !i_target->tryGetAttr<ATTR_POSITION>(tmpPos) ) + PRDF_ERR( FUNC"Failed to get ATTR_POSITION" ); + else + o_pos = (uint32_t)tmpPos; + break; + } + + case TYPE_MEMBUF: + o_pos = getMemChnl( i_target ); + break; + + default: + PRDF_ERR( FUNC"Unsupported type: %d", l_type ); + } + break; + } + + case CLASS_UNIT: + { + uint8_t tmpPos = 0; + if ( !i_target->tryGetAttr<ATTR_CHIP_UNIT>(tmpPos) ) + PRDF_ERR( FUNC"Failed to get ATTR_CHIP_UNIT" ); + else + o_pos = (uint32_t)tmpPos; + break; + } + + case CLASS_ENC: + o_pos = getNodePosition( i_target ); + break; + + default: + PRDF_ERR( FUNC"Unsupported class: %d", l_class ); + } + + if ( INVALID_POSITION_BOUND == o_pos ) + { + PRDF_ERR( FUNC"Failed: target=0x%08x", getHuid(i_target) ); + } + + #undef FUNC + + return o_pos; +} + +//------------------------------------------------------------------------------ + +uint32_t getNodePosition( TARGETING::TargetHandle_t i_target ) +{ + uint32_t o_pos = INVALID_POSITION_BOUND; + + do + { + // Get the node handle. + TargetHandle_t l_node = NULL; + TargetHandleList l_list = getConnected( i_target, TYPE_NODE ); + if ( 1 == l_list.size() ) + l_node = l_list[0]; + else + { + PRDF_ERR( "[getNodePosition] Failed to get node target" ); + break; + } + + // FIXME: While this code works, it is preferred to use the POSITION + // attribute of the node. Currently, this attribute does not + // exist but it will, eventually. (RTC WI expected from Nick + // Bofferding) + EntityPath l_path ( EntityPath::PATH_PHYSICAL ); + int32_t l_rc = getEntityPath( l_node, l_path ); + if ( SUCCESS != l_rc ) break; + + o_pos = l_path[l_path.size()-1].instance; + + } while (0); + + if ( INVALID_POSITION_BOUND == o_pos ) + { + PRDF_ERR( "[getNodePosition] Failed: target=0x%08x", + getHuid(i_target) ); + } + + return o_pos; +} + +//############################################################################## +//## +//## DUMP and Runtime Deconfig support code +//## +//############################################################################## + +//------------------------------------------------------------------------------ + +errlHndl_t dumpHWURequest(errlHndl_t i_errl, HUID i_huid ) +{ + // FIXME : need to implement this once P8 DUMP support is in + PRDF_ERR( "[dumpHWURequest] i_huid=0x%08x - Function not implemented yet", i_huid ); + + return NULL; +} + +//------------------------------------------------------------------------------ + +errlHndl_t runtimeDeconfig( HUID i_huid ) +{ + // FIXME : need to implement this once Story 42422 + // in CEC HW Enablement is done + PRDF_ERR( "[runtimeDeconfig] i_huid=0x%08x - Function not implemented yet", i_huid ); + + return NULL; +} + +//############################################################################## +//## +//## Memory specific functions +//## +//############################################################################## + +int32_t getMasterRanks( TARGETING::TargetHandle_t i_memTarget, + uint32_t i_portSlct, uint32_t i_dimmSlct, + std::vector<uint32_t> & o_ranks ) +{ + int32_t o_rc = FAIL; + + do + { + if ( NULL == i_memTarget ) break; + + if ( (MAX_PORT_PER_MBA <= i_portSlct) || + (MAX_DIMM_PER_PORT <= i_dimmSlct) ) + break; + + TARGETING::TargetHandle_t mbaTarget = getParent(i_memTarget, TYPE_MBA); + if ( NULL == mbaTarget ) break; + + uint8_t rankInfo[MAX_PORT_PER_MBA][MAX_DIMM_PER_PORT]; + if( !mbaTarget->tryGetAttr<ATTR_EFF_DIMM_RANKS_CONFIGED>(rankInfo) ) + { + PRDF_ERR( "[getMasterRanks] Failed to get attribute" ); + break; + } + + uint8_t rankMask = rankInfo[i_portSlct][i_dimmSlct]; + if ( 0 == (rankMask & 0xf0) ) + { + PRDF_ERR( "[getMasterRanks] Attribute value invalid: 0x%02x", + rankMask ); + break; + } + + for ( uint32_t rank = 0; rank < 4; rank++ ) + { + if ( 0 != (rankMask & (0x80 >> rank)) ) + { + o_ranks.push_back(rank); + } + } + + o_rc = SUCCESS; + + } while (0); + + if ( SUCCESS != o_rc ) + { + PRDF_ERR( "[getMasterRanks] Failed: i_memTarget=0x%08x i_portSlct=%d " + "i_dimmSlct=%d", + getHuid(i_memTarget), i_portSlct, i_dimmSlct ); + } + + return o_rc; +} + +//------------------------------------------------------------------------------ + +uint32_t getMemChnl( TARGETING::TargetHandle_t i_memTarget ) +{ + uint32_t o_chnl = INVALID_POSITION_BOUND; // Intentially set to + // INVALID_POSITION_BOUND for call + // from getTargetPosition(). + + do + { + if ( NULL == i_memTarget ) break; + + TARGETING::TargetHandle_t mcsTarget = getParent(i_memTarget, TYPE_MCS); + if ( NULL == mcsTarget ) break; + + o_chnl = getTargetPosition( mcsTarget ); + + } while (0); + + if ( MAX_MCS_PER_PROC <= o_chnl ) // Real MCS position check. + { + PRDF_ERR( "[getMemChnl] Failed: i_memTarget=0x%08x", + getHuid(i_memTarget) ); + } + + return o_chnl; +} + +//------------------------------------------------------------------------------ + +int32_t isMembufOnDimm( TARGETING::TargetHandle_t i_memTarget, + bool & o_isBuffered ) +{ + int32_t o_rc = FAIL; + + o_isBuffered = false; + + do + { + // The DIMMs in an node should either all be buffered or all not. So we + // can check the attribute from ANY MBA. + TargetHandleList list = getConnected( i_memTarget, TYPE_MBA ); + if ( 0 == list.size() ) + { + PRDF_ERR( "[isMembufOnDimm] Couldn't find an MBA target" ); + break; + } + + // FIXME - Currently TARGETING::ATTR_EFF_DIMM_TYPE is mapped to + // fapi::ATTR_EFF_DIMM_TYPE, but there is no guarantee it will + // stay mapped. The values of this attribute is mapped in a fapi + // enum, but we are encouraged to use the TARGETING attribute. + // Either we need to use fapi::ATTR_EFF_DIMM_TYPE (no preferred) + // or get a TARGETING enum (preferred). + // FIXME - dimmtype should be of an enum type. + uint8_t dimmtype; + if ( !list[0]->tryGetAttr<ATTR_EFF_DIMM_TYPE>(dimmtype) ) + { + PRDF_ERR( "[isMembufOnDimm] Failed to get DIMM type" ); + break; + } + + // FIXME - See note above. + if ( fapi::ENUM_ATTR_EFF_DIMM_TYPE_CDIMM == dimmtype ) + o_isBuffered = true; + + o_rc = SUCCESS; + + } while (0); + + if ( SUCCESS != o_rc ) + { + PRDF_ERR( "[isMembufOnDimm] Failed: i_memTarget=0x%08x", + getHuid(i_memTarget) ); + } + + return o_rc; +} + +int32_t getMbaPort( TARGETING::TargetHandle_t i_dimmTarget, uint8_t & o_port ) +{ + using namespace TARGETING; + return i_dimmTarget->tryGetAttr<ATTR_MBA_PORT>(o_port) ? SUCCESS : FAIL; +} + +int32_t getMbaDimm( TARGETING::TargetHandle_t i_dimmTarget, uint8_t & o_dimm ) +{ + using namespace TARGETING; + return i_dimmTarget->tryGetAttr<ATTR_MBA_DIMM>(o_dimm) ? SUCCESS : FAIL; +} + +//############################################################################## +//## +//## Clock specific functions +//## +//############################################################################## + +// FIXME: RTC: 51628 will address clock target issue +bool areClocksOn(TARGETING::TargetHandle_t i_pGivenTarget) +{ + bool o_clocksOn = false; + + #ifdef __HOSTBOOT_MODULE + + o_clocksOn = true; + + #else + + if ( NULL != i_pGivenTarget ) + { + errlHndl_t errl = NULL; + //errl =HWSV::hwsvClockQueryOn(i_pGivenTarget, + // HWSV::NO_MODE, o_clocksOn); + if ( NULL != errl ) + { + PRDF_ERR( "[areClocksOn] In areClocksOn failed" ); + PRDF_COMMIT_ERRL(errl, ERRL_ACTION_REPORT); + } + } + else + { + PRDF_ERR( "[areClocksOn] given target is null" ); + } + + #endif + + return o_clocksOn; +} + +//------------------------------------------------------------------------------ + +// FIXME: RTC: 51628 will address clock target issue +TARGETING::TargetHandle_t getClockId(TARGETING::TargetHandle_t + i_pGivenTarget, + TARGETING ::TYPE targetype) +{ + TargetHandleList l_clockCardlist; + TargetHandle_t o_pClockCardHandle = NULL; + + return o_pClockCardHandle; +} + +//------------------------------------------------------------------------------ + +// FIXME: RTC: 51628 will address clock target issue +TARGETING::TargetHandle_t getClockMux(TARGETING::TargetHandle_t + i_pGivenTarget) +{ + //Modeling info of card and Clock mux is required + // PredicateCTM l_ClockMux(CLASS_UNIT,TYPE_CLOCK_MUX); + //defined for compilation + PredicateCTM l_ClockMux(CLASS_UNIT); + TargetHandle_t o_ptargetClockMux = NULL; + #if 0 + do + { + if(NULL != i_pGivenTarget) + { + TargetHandleList l_list; + if(TYPE_PROC==(i_pGivenTarget->getAttr<ATTR_TYPE>())) + { + targetService().getAssociated(l_list, + i_pGivenTarget, + TargetService::CHILD_BY_AFFINITY, + TargetService::ALL, + &l_ClockMux); + } + else + { + //TODO: If given target is not a proc how to query all mux units + // which relation to be used + } + + if (l_list.size() > 0) + { + // Pick out first item + o_ptargetClockMux = l_list[0]; + } + } + else + { + PRDF_ERR("[getClockMux] given target is NULL"); + } + }while(0); + #endif + return o_ptargetClockMux; +} + +} // end namespace PlatServices + +} // end namespace PRDF + diff --git a/src/usr/diag/prdf/common/framework/service/prdfTargetServices.H b/src/usr/diag/prdf/common/framework/service/prdfTargetServices.H new file mode 100755 index 000000000..5513e69cc --- /dev/null +++ b/src/usr/diag/prdf/common/framework/service/prdfTargetServices.H @@ -0,0 +1,365 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/service/prdfTargetServices.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef PRDFTARGETSERVICES_H +#define PRDFTARGETSERVICES_H + +/** + * @file prdfTargetServices.H + * @brief Wrapper code for things PRD needs from target services. + */ + +//------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------ + +#include <iipconst.h> +#include <prdfTimer.H> +#include <algorithm> +#include <targeting/common/target.H> +#include <targeting/common/entitypath.H> +#include <errlentry.H> + +#ifdef __HOSTBOOT_MODULE + +#else + +#endif + +//------------------------------------------------------------------------------ + +namespace PRDF +{ + +enum PositionBounds +{ + MAX_NODE_PER_SYS = 8, + + MAX_PROC_PER_NODE = 8, + + MAX_EX_PER_PROC = 16, + MAX_CORE_PER_PROC = MAX_EX_PER_PROC, + MAX_L2_PER_PROC = MAX_EX_PER_PROC, + MAX_L3_PER_PROC = MAX_EX_PER_PROC, + + MAX_XBUS_PER_PROC = 4, + MAX_ABUS_PER_PROC = 3, + + MAX_MCS_PER_PROC = 8, + MAX_MEMBUF_PER_PROC = MAX_MCS_PER_PROC, + + MAX_MBA_PER_MEMBUF = 2, + MAX_PORT_PER_MBA = 2, + MAX_DIMM_PER_PORT = 2, + + INVALID_POSITION_BOUND = 0xffffffff, +}; + +namespace PlatServices +{ + +//############################################################################## +//## +//## Target Manipulation Utility Functions +//## +//############################################################################## + +/** + * @brief Returns the target for a given HUID. + * @param i_huid The HUID of a target. + * @return The target for the given HUID. + * @post Must check that the returned target is not NULL. + */ +TARGETING::TargetHandle_t getTarget( HUID i_huid ); + +/** + * @brief Returns the target for a given entity path. + * @param i_path The entity path of a target. + * @return The target for the given entity path. + * @post Must check that the returned target is not NULL. + */ +TARGETING::TargetHandle_t getTarget( const TARGETING::EntityPath & i_path ); + +/** + * @brief Returns the entity path for a given target. + * @param i_target A target. + * @param o_path The returned path. + * @param i_pathType The desired path type, optional. + * @return Non-SUCCESS if internal functions fail, SUCCESS otherwise. + * @note Will use the path type specified the EntityPath contructor unless + * a supported PATH_TYPE is given. + */ +int32_t getEntityPath( TARGETING::TargetHandle_t i_target, + TARGETING::EntityPath & o_path, + TARGETING::EntityPath::PATH_TYPE i_pathType + = TARGETING::EntityPath::PATH_NA ); + +/** + * @brief Returns the HUID for a given target. + * @param i_target A target. + * @return The HUID for the given target. + * @post Must check that the returned target is not INVALID_HUID. + */ +HUID getHuid( TARGETING::TargetHandle_t i_target ); + +/** + * @brief Query functional state of a target. + * @param i_target Any target. + * @return TRUE if target is functional, FALSE otherwise. + */ +bool isFunctional( TARGETING::TargetHandle_t i_target ); + +/** + * @brief Returns the type of the given target. + * @param i_target Any target. + * @return The type for the given target. + */ +TARGETING::TYPE getTargetType( TARGETING::TargetHandle_t i_target ); + +/** + * @brief Returns the class of the given target. + * @param i_target Any target. + * @return The class for the given target. + */ +TARGETING::CLASS getTargetClass( TARGETING::TargetHandle_t i_target ); + +/** + * @brief Prints the HUID and dumps the entity path of the given target. + * @param i_target Any target. + */ +void printTargetInfo( TARGETING::TargetHandle_t i_target ); + +/** + * @brief Get the chip level (DD level) of this target. + * @param i_target Any chip or unit target. + * @return The chip level or 0 function failed. + */ +uint8_t getChipLevel( TARGETING::TargetHandle_t i_target ); + +/** + * @brief Get the chip ID (P7, P7+, etc.) of this target. + * @param i_target Any chip or unit target. + * @return The chip ID or 0 function failed. + */ +//TODO: See .C +//uint32_t getChipId( TARGETING::TargetHandle_t i_target ); + +//############################################################################## +//## +//## getConnected() support functions +//## +//############################################################################## + +/** + * @brief Returns a list of functional targets of a given type that is + * associated with the given target. + * @param i_target The given target. + * @param i_connType Type of target(s) return in list + * @return The connected list of targets. On error, the list will be empty. + * @note This function does not support peer-to-peer connections. + */ +TARGETING::TargetHandleList getConnected( TARGETING::TargetHandle_t i_target, + TARGETING::TYPE i_connType ); + +/** + * @brief Returns the target of a PROC that is connected via the given + * target's XBUS or ABUS. + * @param i_procTarget Target of TYPE_PROC. + * @param i_busType Bus type of TYPE_XBUS or TYPE_ABUS. + * @param i_busPos Position of bus (XBUS: 0-3, ABUS: 0-2). + * @return The connected PROC target. On error, the target will be NULL. + */ +TARGETING::TargetHandle_t getConnectedPeerProc( + TARGETING::TargetHandle_t i_procTarget, + TARGETING::TYPE i_busType, + uint32_t i_busPos ); + +/** + * @brief Returns the system target. + * @return The system target. + */ +TARGETING::TargetHandle_t getSystemTarget(); + +/** + * @brief Get container chip target for the given target. + * @param i_target Any chip or unit target. + * @return The container chip target. + * @post Must check that the returned target is not NULL. + */ +TARGETING::TargetHandle_t getParentChip( TARGETING::TargetHandle_t i_target ); + +/** + * @brief Returns the list of functional targets of a given type. + * @param i_type Type of target requested. + * @return The list of functional targets. + */ +TARGETING::TargetHandleList getFunctionalTargetList( TARGETING::TYPE i_type ); + +/** + * @brief Determines if the given target is the last functional core. + * @param i_coreTarget A core target. + * @return TRUE if target is last functional core, FALSE otherwise. + */ +bool checkLastFuncCore( TARGETING::TargetHandle_t i_coreTarget ); + +//############################################################################## +//## +//## Target position support code +//## +//############################################################################## + +/** + * @brief Returns the position of the given target. + * @param i_target Any target. + * @return The position or index of the given target relative to its container. + * Can compare against enums in PRDF::PositionBounds for validity. + */ +uint32_t getTargetPosition( TARGETING::TargetHandle_t i_target ); + +/** + * @brief Returns the position of a node in which the given target is + * contained. + * @param i_target Any target. + * @return The position of the connected node. + */ +uint32_t getNodePosition( TARGETING::TargetHandle_t i_target ); + +//############################################################################## +//## +//## DUMP and Runtime Deconfig support code +//## +//############################################################################## + +/** + * Interface to request a Hardware Unit dump collection. + * + * @param[in] i_errl input error log handle + * @param[in] i_huid The HUID of Failing target to dump + * + * @return NULL on success, else error log + */ +errlHndl_t dumpHWURequest(errlHndl_t i_errl, HUID i_huid ); + +/** +* Change the state of the given HUID at runtime. +* +* @param i_huid The HUID of a target +* +* @return NULL on success, else error log +*/ +errlHndl_t runtimeDeconfig( HUID i_huid ); + + +//############################################################################## +//## +//## Memory specific functions +//## +//############################################################################## + +/** + * @brief Returns the list of master ranks for a logical DIMM. + * @param i_memTarget MBA target or child of MBA. + * @param i_portSlct Port select (0-1). + * @param i_dimmSlct DIMM select (0-1). + * @param o_ranks List of master ranks for a logical DIMM. + * @return Non-SUCCESS if internal functions fail, SUCCESS otherwise. + */ +int32_t getMasterRanks( TARGETING::TargetHandle_t i_memTarget, + uint32_t i_portSlct, uint32_t i_dimmSlct, + std::vector<uint32_t> & o_ranks ); + +/** + * @brief Returns the DMI bus channel for the given memory target. + * @param i_memTarget MCS target or child of MCS. + * @return The DMI bus channel. + * @note Can check against MAX_MCS_PER_PROC for validity. + */ +uint32_t getMemChnl( TARGETING::TargetHandle_t i_memTarget ); + +/** + * @brief Determines if a given target is associated with a memory buffer that + * is located on the DIMM card. + * @param i_target Any memory target or parent. + * @return TRUE if target is associated with buffered DIMMs, FALSE otherwise. + */ +bool isMembufOnDimm( TARGETING::TargetHandle_t i_memTarget ); + +/** + * @brief Obtain the MBA port select for the given Dimm. + * @param i_dimmTarget Dimm. + * @param o_port MBA port select. + * @return Non-SUCCESS if internal functions fail, SUCCESS otherwise. + */ +int32_t getMbaPort( TARGETING::TargetHandle_t i_dimmTarget, uint8_t & o_port ); + + +/** + * @brief Obtain the MBA Dimm select for the given Dimm. + * @param i_dimmTarget Dimm. + * @param o_dimm MBA Dimm select. + * @return Non-SUCCESS if internal functions fail, SUCCESS otherwise. + */ +int32_t getMbaDimm( TARGETING::TargetHandle_t i_dimmTarget, uint8_t & o_dimm ); + +//############################################################################## +//## +//## Clock specific functions +//## +//############################################################################## + +/** + * @brief Queries if this chip's clocks are on. + * @param i_pTargetHandle Handle of a chip or any logical entity. + * @return TRUE if this chip's clocks are on, FALSE otherwise. + * @pre None. + * @post None. + */ +bool areClocksOn( TARGETING::TargetHandle_t i_pTargetHandle ); + +/** + * @brief Gets handle of the clock card for the given target. + * @param i_pTargetHandle Handle of a functional unit. + * @param i_targetType Type of clock source desired. + * @return Handle_t of clock source. + * @pre None. + * @post None. + */ +TARGETING::TargetHandle_t getClockId(TARGETING::TargetHandle_t + i_pTargetHandle,TARGETING::TYPE i_targetType); + +/** + * @brief Get TargetHandle_t of clock mux. + * @param i_pFabricHandle Handle of a fabric. + * @return Handle of clock mux. + * @pre Fabric must be a handle of a functioning fabric. + * @post None. + */ +TARGETING::TargetHandle_t getClockMux(TARGETING::TargetHandle_t + i_pFabricHandle); + +} // end namespace PlatServices + +} // end namespace PRDF + +#endif // PRDFTARGETSERVICES_H + diff --git a/src/usr/diag/prdf/common/framework/service/prdfWorkarounds.H b/src/usr/diag/prdf/common/framework/service/prdfWorkarounds.H new file mode 100755 index 000000000..bcea1a744 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/service/prdfWorkarounds.H @@ -0,0 +1,44 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/service/prdfWorkarounds.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2007,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +/** + * @file prdfWorkarounds.H + * @brief Prototypes for Workaround functions. + * + * These functions allow workarounds to be applied at different points in the + * analysis. It is expected that the code for these workarounds are + * implemented in each system subdirectory. + */ + +#ifndef __PRDFWORKAROUNDS_H +#define __PRDFWORKAROUNDS_H + +#include <iipstep.h> + +/** + * @fn prdfPostAnalysisWorkarounds + * @brief Apply workarounds after "system" analysis, but prior to RAS Services. + */ +void prdfPostAnalysisWorkarounds(STEP_CODE_DATA_STRUCT & i_sdc); + +#endif diff --git a/src/usr/diag/prdf/common/framework/service/prdf_ras_services.C b/src/usr/diag/prdf/common/framework/service/prdf_ras_services.C new file mode 100755 index 000000000..7831575e1 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/service/prdf_ras_services.C @@ -0,0 +1,1914 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/service/prdf_ras_services.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2002,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +/** @file prdf_ras_services.C + * @brief Definition of external RAS services needed by PRD + */ + +#define prdf_ras_services_C + +#include <prdf_ras_services.H> +#include <prdfPfa5Data.h> +#include <time.h> +#include <iipServiceDataCollector.h> +#include <prdf_service_codes.H> +#include <iipglobl.h> +#include <prdfCallouts.H> +#include <prdfPlatServices.H> + +// For compression routines +#define PRDF_COMPRESSBUFFER_COMPRESS_FUNCTIONS +#include <prdfCompressBuffer.H> + +#include <utilmem.H> //For UtilMem stream class (outputting PfaData). +#include <utilfile.H> +#include <vector> +#include <algorithm> +#include <iipSystem.h> //For RemoveStoppedChips + +#ifdef __HOSTBOOT_MODULE + #define htonl(foo) (foo) // no-op for HB + #include <stdio.h> + //FIXME: CPTR_Identifier used to be defined in hutlCecSvrErrl.H + // it seems to me that we can delete this but leave it here for now + #define CPTR_Identifier 0x43505452 + //FIXME: move these typedefs to somewhere + typedef uint32_t homHCDBUpdate; + typedef uint32_t homTermEnum; + typedef uint32_t homHCDBUpdate; + typedef uint32_t homGardEnum; + typedef uint32_t homDeconfigEnum; + typedef uint32_t homDeconfigSchedule; +#else + #include <srcisrc.H> + #include <GardExtInt.H> //for GARD_ErrorType + #include <utilreg.H> //For registry functions + #include <evenmgt.H> + #include <rmgrBaseClientLib.H> //for rmgrSyncFile + #include <prdfSdcFileControl.H> + // FIXME: move dump include to iipglobl.h when Adriana's fix is in + #include <dumpHWURequest_applet.H> +#endif + +#undef prdf_ras_services_C + +using namespace TARGETING; + +namespace PRDF +{ + +// ---------------------------------------------------------------------------- +// Local macros and types +// ---------------------------------------------------------------------------- +#ifndef BIN_TO_BCD +#define BIN_TO_BCD(val) ((val) = (((val)/1000)<<12) + (((val%1000)/100)<<8) + (((val%100)/10)<<4) + (val)%10) +#endif + +// ---------------------------------------------------------------------------- +// Local Globals +// ---------------------------------------------------------------------------- +#ifndef __HOSTBOOT_MODULE + +const char * ThermalFileKeys[] = {"fstp/P1_Root","prdf/ThermalSdcPath"}; +char * ThermalFilename = NULL; + +#endif + +prdfPfaData PfaData; +bool ErrDataService::terminateOnCheckstop = true; +bool previousWasRecovered = false; +PrdTimer previousEventTime; +const double LATENT_MCK_WINDOW = 2; // two seconds to determin latency +RasServices thisServiceGenerator; + +// ---------------------------------------------------------------------------- +// Member Functions +// ---------------------------------------------------------------------------- + +ServiceGeneratorClass & ServiceGeneratorClass::ThisServiceGenerator(void) +{ + return thisServiceGenerator; +} + +// ---------------------------------------------------------------------------- + +RasServices::RasServices() : + iv_ErrDataService(NULL) +{ + //PRDF_DTRAC("RasServices() initializing default iv_ErrDataService"); + iv_ErrDataService = new ErrDataService(); +} + +// ---------------------------------------------------------------------------- +RasServices::~RasServices() +{ + if(NULL != iv_ErrDataService) + { + PRDF_DTRAC("~RasServices() deleting iv_ErrDataService"); + delete iv_ErrDataService; + iv_ErrDataService = NULL; + } +} + +// ---------------------------------------------------------------------------- + +void ErrDataService::Initialize() +{ + savedLatentSdc = false; + serviceActionCounter = 0; +} + +void RasServices::Initialize() +{ + iv_ErrDataService->Initialize(); +} + +// ---------------------------------------------------------------------------- + +void RasServices::setErrDataService(ErrDataService & i_ErrDataService) +{ + PRDF_TRAC("RasServices::setErrDataService() setting new ErrDataService"); + + if(NULL != iv_ErrDataService) + { + PRDF_DTRAC("RasServices::setErrDataService() deleting old iv_ErrDataService"); + delete iv_ErrDataService; + iv_ErrDataService = NULL; + } + + iv_ErrDataService = &i_ErrDataService; +} + +// ---------------------------------------------------------------------------- + +void ErrDataService::SetErrorTod(ATTENTION_TYPE the_attention, + bool *is_latent, + ServiceDataCollector & sdc) +{ + *is_latent = false; + latentMachineCheck = false; + + PrdTimer l_curEventTime; + PlatServices::getCurrentTime(l_curEventTime); + + if(previousWasRecovered && (MACHINE_CHECK == the_attention)) + { + // check for latent machine check + if ( LATENT_MCK_WINDOW > (l_curEventTime - previousEventTime)) + { + *is_latent = true; + latentMachineCheck = true; + } + previousWasRecovered = false; // in case of multiple calls for same cstop + } + else if (RECOVERABLE == the_attention) + { + previousWasRecovered = true; + } + else + { + previousWasRecovered = false; + } + + previousEventTime = l_curEventTime; + sdc.SetTOE(l_curEventTime); +} + +void RasServices::SetErrorTod(ATTENTION_TYPE the_attention, + bool *is_latent, + ServiceDataCollector & sdc) +{ + iv_ErrDataService->SetErrorTod(the_attention, + is_latent, + sdc); +} + +// ---------------------------------------------------------------------------- + +bool ErrDataService::QueryLoggingBufferFull(void) const +{ + return (loggingBufferFull); +} + +bool RasServices::QueryLoggingBufferFull(void) const +{ + return iv_ErrDataService->QueryLoggingBufferFull(); +} + +// ---------------------------------------------------------------------------- + +void ErrDataService ::SaveRcForSrc(int32_t the_rc) +{ + savedPrdReturnCode = the_rc; +} + +void RasServices::SaveRcForSrc(int32_t the_rc) +{ + iv_ErrDataService->SaveRcForSrc(the_rc); +} + +// ---------------------------------------------------------------------------- + +errlHndl_t RasServices::GenerateSrcPfa(ATTENTION_TYPE attn_type, + ServiceDataCollector & i_sdc) + +{ + PRDF_DENTER("RasServices::GenerateSrcPfa()"); + + errlHndl_t errLog = NULL; + errLog = iv_ErrDataService->GenerateSrcPfa(attn_type, i_sdc); + + PRDF_DEXIT("RasServices::GenerateSrcPfa()"); + return errLog; + +} + +// ---------------------------------------------------------------------------- + +errlHndl_t ErrDataService::GenerateSrcPfa(ATTENTION_TYPE attn_type, + ServiceDataCollector & i_sdc) +{ + #define PRDF_FUNC "GenerateSrcPfa() " + PRDF_DENTER( PRDF_FUNC ); + errlHndl_t errLog = NULL; + +#ifdef __HOSTBOOT_MODULE + using namespace ERRORLOG; + using namespace HWAS; + errlSeverity_t severityParm = ERRL_SEV_RECOVERED; +#else + bool writeVPD = false; // Make the default to not Write VPD Capture data + bool causeAttnPreviouslyReported = false; + bool pldCheck = false; // Default to not do the PLD check. Set it to true for Machine Check + uint8_t sdcSaveFlags = SDC_NO_SAVE_FLAGS; + size_t sz_uint8 = sizeof(uint8_t); + homTermEnum termFlag = HOM_SYS_NO_TERMINATE; + homDeconfigSchedule deconfigSched = HOM_DECONFIG_IMMEDIATE; //See src/hwsv/server/hwsvTypes.H + uint8_t sdcBuffer[sdcBufferSize]; //buffer to use for sdc flatten + errlSeverity severityParm = ERRL_SEV_RECOVERED; +#endif + + SDC_MRU_LIST fspmrulist; + PRDcallout thiscallout; + PRDpriority thispriority; + epubProcedureID thisProcedureID; + + // Init Action Parm to most common usage, Service Action Required and + // Report Externally. Note this is like the old Signal + // Event: OS Viewable (Parable) or OS Hidden. + // Also set the Call Home Flag. This should be set when IBM Service is required. + // For PRD this is for UnRecoverable and Predictive errors. Setting it here will + // take care of this. The Hidden and Informational cases will reassign the actionFlag. + uint32_t actionFlag = (ERRL_ACTION_SA | ERRL_ACTION_REPORT | ERRL_ACTION_CALL_HOME); + + + + homHCDBUpdate hcdbUpdate = HOM_HCDB_DO_UPDATE; + + //Use this SDC unless determined in Check Stop processing to use a Latent, UE, or SUE saved SDC + sdc = i_sdc; + + GardResolution::ErrorType prdGardErrType; + homGardEnum gardState; // homGardEnum in src/hwsv/server/hwsvTypes.H + GARD_ErrorType gardErrType = GARD_NULL; + homDeconfigEnum deconfigState = HOM_NO_DECONFIG; + + bool ReturnELog = false; + bool ForceTerminate = false; + bool iplDiagMode = false; + bool deferDeconfig = false; + + ++serviceActionCounter; + + uint16_t PRD_Reason_Code = 0; + uint32_t dumpPlid = 0; + + //************************************************************** + // Initial set up by Attention Type + //************************************************************** + + //////////////////////////////////////////////////////////////// + // Machine Check ATTN (CHECKSTOP) + //////////////////////////////////////////////////////////////// + if (attn_type == MACHINE_CHECK) + { +#ifdef __HOSTBOOT_MODULE + + // FIXME: do we want to commit any log here? + PRDF_ERR( PRDF_FUNC"Hostboot should NOT have any system checkstop!" ); + +#else + writeVPD = true; // Change the default so as to Write Capture Data + pldCheck = true; // Do the PLD check + + if (terminateOnCheckstop) + { + termFlag = HOM_SYS_TERMINATE_HW_CHECKSTOP; //Also need to return error log for machine check condition + } + + ReturnELog = true; + + severityParm = ERRL_SEV_UNRECOVERABLE; + + if // No special UE-SUE flags. + ((!sdc.IsUERE() ) && + (!sdc.IsSUE() ) ) + { + if //if LtntMck and last recoverable Stored use it. + ((latentMachineCheck || sdc.IsForceLatentCS() ) && + (savedLatentSdc ) ) + { + gardErrType = GARD_Func; + sdc = latentSdc; + causeAttnPreviouslyReported = true; + } + //else set no flags, use this sdc + } + else //This is a SUE-CS condition check flags. + if ((!sdc.IsUERE() ) && + ( sdc.IsSUE() ) ) + { + //Read current sdc state flags from registry + errlHndl_t errorLog = UtilReg::read ("prdf/RasServices", &sdcSaveFlags, sz_uint8); + if (errorLog) + { + PRDF_ERR( PRDF_FUNC"Failure in SDC flag Registry read" ); + PRDF_COMMIT_ERRL(errorLog, ERRL_ACTION_REPORT); + } + else if (sdcSaveFlags & SDC_SAVE_UE_FLAG) //check if UE log stored then use it. + { + bool l_rc = SdcRetrieve(SDC_SAVE_UE_FLAG, sdcBuffer); + if (l_rc) + { + PRDF_ERR( PRDF_FUNC"Failure in UE SDC Retrieve Function" ); + } + else + { + //set the sdc to the Saved SDC for UE + sdc = sdcBuffer; + gardErrType = GARD_Func; + causeAttnPreviouslyReported = true; + } + } + else if (sdcSaveFlags & SDC_SAVE_SUE_FLAG ) //else check if SUE log stored then use it. + { + bool l_rc = SdcRetrieve(SDC_SAVE_SUE_FLAG, sdcBuffer); + if (l_rc) + { + PRDF_ERR( PRDF_FUNC"Failure in SUE SDC Retrieve Function" ); + } + else + { + //set the sdc to the Saved SDC for SUE + sdc = sdcBuffer; + gardErrType = GARD_Func; + causeAttnPreviouslyReported = true; + } + } + //else, set no flags, use this sdc + } + //else Normal Mck, set no flags, use this sdc +#endif // if not __HOSTBOOT_MODULE + } + //////////////////////////////////////////////////////////////// + // Recoverable ATTN or Unit CheckStop + //////////////////////////////////////////////////////////////// + else if (attn_type == RECOVERABLE || attn_type == UNIT_CS ) + { +#ifndef __HOSTBOOT_MODULE + // FIXME: I don't think Hostboot needs latent SDC and UE/SUE support + if (!sdc.IsUsingSavedSdc() ) // Don't save File if we are Re-Syncing an sdc + { + savedLatentSdc = true; //Save this SDC as Latent SDC + latentSdc = i_sdc; + } + + if //Ue-Re RECOVERABLE condition. + ((sdc.IsUERE() ) && + (!sdc.IsSUE() ) && + (!sdc.IsUsingSavedSdc() ) ) // Don't save File if we are Re-Syncing an sdc + { + bool l_rc = SdcSave(SDC_SAVE_UE_FLAG, i_sdc); + if (l_rc) + { + PRDF_ERR( PRDF_FUNC"Failure in UE SDC Save Function" ); + } + } + else if //Sue-Re RECOVERABLE condition. + ((!sdc.IsUERE() ) && + (sdc.IsSUE() ) && + (!sdc.IsUsingSavedSdc() ) ) // Don't save File if we are Re-Syncing an sdc + + { + bool l_rc = SdcSave(SDC_SAVE_SUE_FLAG, i_sdc); + if (l_rc) + { + PRDF_ERR( PRDF_FUNC"Failure in SUE SDC Save Function" ); + } + } +#endif // if not __HOSTBOOT_MODULE + + // For a Recoverable Attn with MPFatal and Cause_attn_type not + // equal Special, make this a Predictive, Parable error. + if (!sdc.IsLogging() ) + { + // This is a Hidden Log + severityParm = ERRL_SEV_INFORMATIONAL; + actionFlag = (actionFlag | ERRL_ACTION_HIDDEN); + } + else if (sdc.IsServiceCall() || //At Thresold + (sdc.IsMpFatal() && sdc.GetCauseAttentionType() != SPECIAL) ) + { + severityParm = ERRL_SEV_PREDICTIVE; + } + else //Recovered + { + severityParm = ERRL_SEV_RECOVERED; + // Recovered error should be Hidden, and No Service Action + actionFlag = ERRL_ACTION_HIDDEN; + } + + if (sdc.IsThermalEvent()) + { //Make the Thermal Event Hidden + severityParm = ERRL_SEV_RECOVERED; + actionFlag = ERRL_ACTION_HIDDEN; + } + } + //////////////////////////////////////////////////////////////// + // Special ATTN + //////////////////////////////////////////////////////////////// + else if (attn_type == SPECIAL) + { + //SMA path on Special attn + if (sdc.IsMpFatal() && (sdc.IsLogging() || sdc.IsServiceCall() ) ) + { + severityParm = ERRL_SEV_UNRECOVERABLE; + savedLatentSdc = true; //Save this SDC as Latent SDC + latentSdc = i_sdc; + } + else if (sdc.IsServiceCall()) + //Bit Steered already, or Bit Steer Not supported + { + severityParm = ERRL_SEV_PREDICTIVE; + } + else if ( (!sdc.IsServiceCall()) && (!sdc.IsLogging()) ) // Special Attn Clean Up + { + severityParm = ERRL_SEV_INFORMATIONAL; + //Hidden, No Service Action for Infomational + actionFlag = ERRL_ACTION_HIDDEN; + } + else if ( (!sdc.IsServiceCall()) && (sdc.IsLogging()) ) // Special Attn Bit Steer Normal Condition + { + severityParm = ERRL_SEV_RECOVERED; + //Hidden, No Service Action for Recovered + actionFlag = ERRL_ACTION_HIDDEN; + } + } + + //************************************************************** + // Set Gard Error Type and state + //************************************************************** + + gardState = HOM_DECONFIG_GARD; + + // If gardErrType was determined during latent/UE/SUE processing for Check Stop, + // use that and not determine gardErrType from the sdc values. + if (gardErrType != GARD_Func) + { + prdGardErrType = sdc.QueryGard(); + switch (prdGardErrType) + { + case GardResolution::NoGard: + gardState = HOM_NO_GARD; + gardErrType = GARD_NULL; + break; + case GardResolution::Predictive: + gardErrType = GARD_Predictive; + break; + case GardResolution::Uncorrectable: + gardErrType = GARD_Unrecoverable; + break; + case GardResolution::Fatal: + gardErrType = GARD_Func; + break; + case GardResolution::Pending: + gardErrType = GARD_Pending; + // Do not set Call Home for Array Gard (Pending) + actionFlag &= ~ERRL_ACTION_CALL_HOME; + break; + case GardResolution::CheckStopOnlyGard: + if (MACHINE_CHECK == attn_type) + { + gardErrType = GARD_Func; + } + else + { + gardState = HOM_NO_GARD; + gardErrType = GARD_NULL; + } + break; + case GardResolution::DeconfigNoGard: + gardState = HOM_NO_GARD; + gardErrType = GARD_NULL; + break; + default: + gardState = HOM_NO_GARD; + gardErrType = GARD_NULL; + PRDF_DTRAC( PRDF_FUNC"Unknown prdGardErrType" ); + break; + } + } + else + { + // gardErrType is GARD_Func, set in latent/UE/SUE processing for Check Stop. + // If NoGard was specified in this switched sdc, then keep the NoGard + if ( sdc.QueryGard() == GardResolution::NoGard ) + { + gardState = HOM_NO_GARD; + gardErrType = GARD_NULL; + prdGardErrType = GardResolution::NoGard; + } + else + { + prdGardErrType = GardResolution::Fatal; + } + } + + if (sdc.IsThermalEvent() && (MACHINE_CHECK != attn_type) ) + { //Force No Gard + gardState = HOM_NO_GARD; + gardErrType = GARD_NULL; + } + + //************************************************************** + // Callout loop to set up Reason code and SRC word 9 + //************************************************************** + + //FIXME relevant PlatServices function defintions are not available yet + //bool myCM_FUNCTIONAL = true; + + // Must go thru callout list to look for RIOPORT procedure callouts, + // since they require the port info to be in SRC Word 9 + bool HW = false; + bool SW = false; + bool SW_High = false; + bool SecondLevel = false; + bool l_memBuffInCallouts = false; + uint32_t SrcWord7 = 0; + uint32_t SrcWord9 = 0; + fspmrulist = sdc.GetMruList(); + int32_t calloutsPlusDimms = fspmrulist.size(); + for (SDC_MRU_LIST::iterator i = fspmrulist.begin(); i < fspmrulist.end(); ++i) + { + thiscallout = i->callout; + if ( PRDcallout::TYPE_SYMFRU == thiscallout.getType() ) + { + if ( (EPUB_PRC_SP_CODE == thiscallout.flatten()) || + (EPUB_PRC_PHYP_CODE == thiscallout.flatten()) ) + { + SW = true; + if ( MRU_MED == i->priority ) + { + SW_High = true; + } + } + else if ( EPUB_PRC_LVL_SUPP == thiscallout.flatten()) + { + SecondLevel = true; + } + } + else if ( PRDcallout::TYPE_MEMMRU == thiscallout.getType() ) + { + PrdfMemoryMru memMru = thiscallout.getMemMru(); + SrcWord9 = memMru.toUint32(); // Get MemMru value + +/* FIXME: Add support after refactoring PrdfMemoryMru + + TargetHandleList partList = memMru.getCalloutList(); + uint32_t partCount = partList.size(); + + calloutsPlusDimms = calloutsPlusDimms + partCount -1; + HW = true; //hardware callout + + // If we are in Concurrent Maintenance Mode, we will need to disable + // the Deferred Deconfig, if the callouts are not HOM_CM_FUNCTIONAL. + + // FIXME PlatServices::inCMMode() not available yet + if (PlatServices::inCMMode()) + { + if (partCount < 1) + { + // Something wrong with memmru + myCM_FUNCTIONAL = false; + PRDF_TRAC( "PRDTRACE: RasServices MemMru has no callouts" ); + } + else + { + for ( TargetHandleList::iterator it = partList.begin(); + it != partList.end(); it++ ) + { + if ( !PlatServices::isCM_FUNCTIONAL(*it) ) + { + myCM_FUNCTIONAL = false; + PRDF_TRAC( PRDF_FUNC"isCM_FUNCTIONAL is false for ID: 0x%08x", + PlatServices::getHuid(*it) ); + break; + } + } + } + } +*/ + } + else // PRDcallout::TYPE_TARGET + { + HW = true; // Hardware callout + + TargetHandle_t target = thiscallout.getTarget(); + if ( TYPE_MEMBUF == PlatServices::getTargetType(target) ) + l_memBuffInCallouts = true; + + // If we are in Concurrent Maintenance Mode, we will need to disable the + // Deferred Deconfig, if the callouts are not HOM_CM_FUNCTIONAL. + // FIXME PlatServices::inCMMode() not avaialble yet + #if 0 + if (PlatServices::inCMMode()) + { + // FIXME PlatServices::isCM_FUNCTIONAL not avaialble yet + if ( !PlatServices::isCM_FUNCTIONAL(l_thisChipHandle) ) + { + myCM_FUNCTIONAL = false; + PRDF_TRAC( "PRDTRACE: RasServices CM not functional for ID: %x", + PlatServices::getHuid(l_thisChipHandle) ); + } + } + #endif + } + + } + + //////////////////////////////////////////////////////////////// + //Set the PRD Reason Code based on the flags set in the above callout loop. + //////////////////////////////////////////////////////////////// + uint16_t SDC_Reason_Code = sdc.GetReasonCode(); + if (SDC_Reason_Code == 0) //If the analysis code has not set its own Reason Code. + { + if (HW == true && SW == true) + { + if (SW_High == true) + PRD_Reason_Code = PRDF_DETECTED_FAIL_SOFTWARE_PROBABLE; + else + PRD_Reason_Code = PRDF_DETECTED_FAIL_HARDWARE_PROBABLE; + } + else if (HW == true && SW == false && SecondLevel == true) + PRD_Reason_Code = PRDF_DETECTED_FAIL_HARDWARE_PROBABLE; + else if (HW == true && SW == false && SecondLevel == false) + PRD_Reason_Code = PRDF_DETECTED_FAIL_HARDWARE; + else if (HW == false && SW == true) + PRD_Reason_Code = PRDF_DETECTED_FAIL_SOFTWARE; + else + { + //If we get here both HW and SW flags were false. Callout may be Second Level + //Support only, or a procedure not checked in the SW flag code. + PRD_Reason_Code = PRDF_DETECTED_FAIL_HARDWARE_PROBABLE; + } + } + else + { //Set to Reason Code in SDC, set by the chip analysis code. + PRD_Reason_Code = SDC_Reason_Code; + } + + SrcWord7 = i_sdc.GetAttentionType() << 8; + SrcWord7 |= i_sdc.GetCauseAttentionType(); + + //************************************************************** + // Check for IPL Diag Mode and set up for Deferred Deconfig + //************************************************************** + + //TODO TargetHandle conversion -defferredDeconfigMasterNot avaialable yet +#if 0 + hutlIplStepManager* stepManager = PlatServices::getDeferredDeconfigMaster(); + if ( NULL != stepManager ) + { + iplDiagMode = true; + if ( (MACHINE_CHECK != attn_type || !terminateOnCheckstop) && + myCM_FUNCTIONAL && + (HOM_NO_GARD != gardState || + GardResolution::DeconfigNoGard == prdGardErrType ) ) //Allow Deferred Deconfig for IPL Diag when No Gard action is needed + { + deferDeconfig = true; + deconfigState = HOM_DECONFIG; + deconfigSched = HOM_DECONFIG_DEFER; + } + + } + +#endif + + + //************************************************************** + // Create Error Log with SRC + //************************************************************** + ErrorSignature * esig = sdc.GetErrorSignature(); + + PRDF_HW_CREATE_ERRL(errLog, + ERRL_SEV_PREDICTIVE, + ERRL_ETYPE_NOT_APPLICABLE, + SRCI_MACH_CHECK, + SRCI_NO_ATTR, + PRDF_RAS_SERVICES, + FSP_DEFAULT_REFCODE, + PRD_Reason_Code, + esig->getChipId(), //SRC Word 6 + SrcWord7, //code location - SRC Word 7 + esig->getSigId(), //signature - SRC Word 8 + SrcWord9, //user data - SRC Word 9 + termFlag, + pldCheck); //pldCheck + + //************************************************************** + // Add SDC Capture data to Error Log User Data here only if + // there are 4 or more callouts, + // (including Dimm callouts in the MemoryMru). + //************************************************************** + bool capDataAdded = false; + if (calloutsPlusDimms > 3) + { + AddCapData(sdc,errLog); + capDataAdded = true; + } + + // make sure serviceAction doesn't override errl severity + errLog->setSev(severityParm); + + if (ERRL_ACTION_HIDDEN == actionFlag) + { //Change HCDB Update to not do the update for non-visible logs + hcdbUpdate = HOM_HCDB_OVERRIDE; + } + + //************************************************************** + // Add each mru/callout to the error log. + //************************************************************** + fspmrulist = sdc.GetMruList(); + uint32_t calloutcount = fspmrulist.size(); + for (SDC_MRU_LIST::iterator i = fspmrulist.begin(); i < fspmrulist.end(); ++i) + { + thispriority = (*i).priority; + thiscallout = (*i).callout; + if ( PRDcallout::TYPE_TARGET == thiscallout.getType() ) + { + TargetHandle_t target = thiscallout.getTarget(); + // Don't deconfig a Memory Controller for Bus Errors (Mc and SuperNova + // both in Callouts) for Mem Diag. Note still deconfg the SuperNova. + homDeconfigEnum thisDeconfigState = deconfigState; + TYPE l_targetType = PlatServices::getTargetType(target); + if ( HOM_DECONFIG == deconfigState && + l_memBuffInCallouts && + (l_targetType == TYPE_MCS)) //InP8 only 1:1 connection between Mem Buf and Mem ctrl + { + thisDeconfigState = HOM_NO_DECONFIG; + } + + #ifdef __HOSTBOOT_MODULE + // FIXME: this will change once mdia mode support is in + if(true == iplDiagMode) + { + thisDeconfigState = HOM_DEFER_DECONFIG; // DELAYED_DECONFIG; + } + #endif + + PRDF_HW_ADD_CALLOUT(ForceTerminate, + target, + thispriority, + thisDeconfigState, + gardState, + errLog, + writeVPD, + gardErrType, + severityParm, + hcdbUpdate); + + } + else if ( PRDcallout::TYPE_MEMMRU == thiscallout.getType() ) + { + // FIXME: PrdfMemoryMru will need refactor later + PrdfMemoryMru memMru = thiscallout.getMemMru(); + + PRDF_HW_ADD_MEMMRU_CALLOUT(ForceTerminate, + memMru, + thispriority, + deconfigState, + gardState, + errLog, + writeVPD, + gardErrType, + severityParm, + hcdbUpdate); + } + else if ( PRDcallout::TYPE_SYMFRU == thiscallout.getType() ) + { + thisProcedureID = epubProcedureID(thiscallout.flatten()); + + PRDF_DTRAC( PRDF_FUNC"thisProcedureID: %x, thispriority: %x, severityParm: %x", + thisProcedureID, thispriority,severityParm ); + + PRDF_HW_ADD_PROC_CALLOUT(thisProcedureID, + thispriority, + errLog, + severityParm); + + // Use the flags set earlier to determine if the callout is just Software (SP code or Phyp Code). + // Add a Second Level Support procedure callout Low, for this case. + if (HW == false && SW == true && SecondLevel == false) + { + PRDF_DTRAC( PRDF_FUNC"thisProcedureID= %x, thispriority=%x, severityParm=%x", + EPUB_PRC_LVL_SUPP, MRU_LOW, severityParm ); + + PRDF_HW_ADD_PROC_CALLOUT(EPUB_PRC_LVL_SUPP, + MRU_LOW, + errLog, + severityParm); + + SecondLevel = true; + } + + } + } + +#ifndef __HOSTBOOT_MODULE + // FIXME: need to investigate whether or not to add HCDB to Hostboot + + //************************************************************** + // setChangeState for HomIds in the HCDB change list + //************************************************************** + HCDB_CHANGE_LIST hcdbList = sdc.GetHcdbList(); + for (HCDB_CHANGE_LIST::iterator i = hcdbList.begin(); i < hcdbList.end(); ++i) + { + //FIXME comp_id_t, l_pchipHandle commented to avoid warning + //TargetHandle_t l_pchipHandle = (*i).iv_phcdbtargetHandle; + // comp_id_t thisCompId = (*i).iv_compType; + hcdb::comp_subtype_t thisCompSubType = (*i).iv_compSubType; + if (hcdb::SUBTYPE_ANY == thisCompSubType) + { + //PlatServices::setHcdbChangeState(l_pchipHandle);//FIXME functions commneted for now in wrapper + // false means don't set the HOM objects derived from this ohject. + } + else + { + //PlatServices::setHcdbChangeState(l_pchipHandle , thisCompId, thisCompSubType); + //TODO TargetHandle Conversion may shall change for P8 + // false means don't set the HOM objects derived from this ohject. + } + } + + //************************************************************** + // setChangeState for System if needed + //************************************************************** + // If Second Level callout with no hardware called out, setChangeState for System + if ( (HW == false) && (SecondLevel == true)) + { + //PlatServices::setHcdbChangeStateSystem();FIXME functions commneted for now in wrapper + PRDF_INF( PRDF_FUNC"initiating a HCDB setChangeState for System." ); + } +#endif // if not __HOSTBOOT_MODULE + + //************************************************************** + // Build Dump Flags and PFA5 data + //************************************************************** + //MP01 a Start + PfaData.MsDumpLabel[0] = 0x4D532020; //start of MS Dump flags + PfaData.MsDumpLabel[1] = 0x44554D50; // 'MS DUMP' + + TargetHandle_t l_dumpHandle = NULL; +#ifdef __HOSTBOOT_MODULE + sdc.GetDumpRequest( l_dumpHandle ); +#else + hwTableContent l_dumpRequestContent; //not used but needed to call GetDumpRequest + sdc.GetDumpRequest( l_dumpRequestContent, l_dumpHandle ); +#endif + + PfaData.MsDumpInfo.DumpId = PlatServices::getHuid(l_dumpHandle); + TYPE l_targetType = PlatServices::getTargetType(l_dumpHandle); + + if (i_sdc.IsMpDumpReq()) + { + PfaData.MP_DUMP_REQ = 1; + } + else + { + PfaData.MP_DUMP_REQ = 0; + } + if (i_sdc.IsMpResetReq()) + { + PfaData.MP_RESET_REQ = 1; + } + else + { + PfaData.MP_RESET_REQ = 0; + } + //Pass Error Log Action Flag to attn handling, so it know what actions to commit + + PfaData.MP_FATAL = (i_sdc.IsMpFatal()==true)? 1:0; + + PfaData.PFA_errlActions = actionFlag; + PfaData.PFA_errlSeverity = severityParm; + + PfaData.REBOOT_MSG = 0; // Not supported?? + PfaData.DUMP = (sdc.IsDump()==true)? 1:0; + PfaData.UERE = (sdc.IsUERE()==true)? 1:0; + PfaData.SUE = (sdc.IsSUE()==true)? 1:0; + PfaData.CRUMB = (sdc.MaybeCrumb()==true)? 1:0; + PfaData.AT_THRESHOLD = (sdc.IsAtThreshold()==true)? 1:0; + PfaData.DEGRADED = (sdc.IsDegraded()==true)? 1:0; + PfaData.SERVICE_CALL = (sdc.IsServiceCall()==true)? 1:0; + PfaData.TRACKIT = (sdc.IsMfgTracking()==true)? 1:0; + PfaData.TERMINATE = (sdc.Terminate()==true)? 1:0; + PfaData.LOGIT = (sdc.IsLogging()==true)? 1:0; + PfaData.MEMORY_STEERED = (sdc.IsMemorySteered()==true)? 1:0; + PfaData.FLOODING = (sdc.IsFlooding()==true)? 1:0; + + PfaData.ErrorCount = sdc.GetHits(); + PfaData.PRDServiceActionCounter = serviceActionCounter; + PfaData.Threshold = sdc.GetThreshold(); + PfaData.ErrorType = prdGardErrType; + PfaData.homGardState = gardState; + PfaData.PRD_AttnTypes = attn_type; + PfaData.PRD_SecondAttnTypes = i_sdc.GetCauseAttentionType(); + PfaData.THERMAL_EVENT = (sdc.IsThermalEvent()==true)? 1:0; + PfaData.UNIT_CHECKSTOP = (sdc.IsUnitCS()==true)? 1:0; + PfaData.USING_SAVED_SDC = (sdc.IsUsingSavedSdc()==true)? 1:0; + PfaData.FORCE_LATENT_CS = (i_sdc.IsForceLatentCS()==true)? 1:0; + PfaData.DEFER_DECONFIG_MASTER = (iplDiagMode==true)? 1:0; + PfaData.DEFER_DECONFIG = (deferDeconfig==true)? 1:0; + PfaData.CM_MODE = 0; //FIXME Need to change this initialization + PfaData.TERMINATE_ON_CS = (terminateOnCheckstop==true)? 1:0; + PfaData.reasonCode = sdc.GetReasonCode(); + PfaData.PfaCalloutCount = calloutcount; + + // First clear out the PFA Callout list from previous SRC + for (uint32_t j = 0; j < prdfMruListLIMIT; ++j) + { + PfaData.PfaCalloutList[j].Callout = 0; + PfaData.PfaCalloutList[j].MRUtype = 0; + PfaData.PfaCalloutList[j].MRUpriority = 0; + } + + // Build the mru list into PFA data Callout list + uint32_t n = 0; + fspmrulist = sdc.GetMruList(); + for ( SDC_MRU_LIST::iterator i = fspmrulist.begin(); + i < fspmrulist.end(); ++i ) + { + if ( n < prdfMruListLIMIT ) + { + PfaData.PfaCalloutList[n].MRUpriority = (uint8_t)(*i).priority; + PfaData.PfaCalloutList[n].Callout = i->callout.flatten(); + PfaData.PfaCalloutList[n].MRUtype = i->callout.getType(); + + ++n; + } + } + +#ifndef __HOSTBOOT_MODULE + // FIXME: need to investigate whether or not we need to add HCDB support in Hostboot + // First clear out the HCDB from previous SRC + for (uint32_t j = 0; j < prdfHcdbListLIMIT; ++j) + { + PfaData.PfaHcdbList[j].hcdbId = 0;//Resetting entity path + PfaData.PfaHcdbList[j].compSubType = 0; + PfaData.PfaHcdbList[j].compType = 0; + PfaData.PfaHcdbList[j].hcdbReserved1 = 0; + PfaData.PfaHcdbList[j].hcdbReserved2 = 0; + } + + // Build the HCDB list into PFA data + n = 0; + hcdbList = sdc.GetHcdbList(); + PfaData.hcdbListCount = hcdbList.size(); + for (HCDB_CHANGE_LIST::iterator i = hcdbList.begin(); i < hcdbList.end(); ++i) + { + if (n < prdfHcdbListLIMIT) + { + PfaData.PfaHcdbList[n].hcdbId = PlatServices::getHuid((*i).iv_phcdbtargetHandle); + PfaData.PfaHcdbList[n].compSubType = (*i).iv_compSubType; + PfaData.PfaHcdbList[n].compType = (*i).iv_compType; + ++n; + } + else + break; + } + // Set flag so we know to parse the hcdb data + PfaData.HCDB_SUPPORT = 1; +#endif // if not __HOSTBOOT_MODULE + + PRDF_SIGNATURES signatureList = sdc.GetSignatureList(); + // First clear out the HCDB from previous SRC + for (uint32_t j = 0; j < prdfSignatureListLIMIT; ++j) + { + PfaData.PfaSignatureList[j].chipId = 0;//Resetting the chipPath + PfaData.PfaSignatureList[j].signature = 0; + } + + // Build the signature list into PFA data + n = 0; + signatureList = sdc.GetSignatureList(); + PfaData.signatureCount = signatureList.size(); + for (PRDF_SIGNATURES::iterator i = signatureList.begin(); i < signatureList.end(); ++i) + { + if (n < prdfSignatureListLIMIT) + { + PfaData.PfaSignatureList[n].chipId = PlatServices::getHuid((*i).iv_pSignatureHandle); + PfaData.PfaSignatureList[n].signature = (*i).iv_signature; + ++n; + } + else + break; + } + // Set flag so we know to parse the hcdb data + PfaData.SIGNATURE_SUPPORT = 1; + + //************************************************************** + // Check for Unit CheckStop. + // Check for Last Functional Core. + // PFA data updates for these item. + //************************************************************** + PfaData.LAST_CORE_TERMINATE = false; + // Now the check is for Unit Check Stop and Dump ID for Processor + // Skip the termination on Last Core if this is a Saved SDC + if (sdc.IsUnitCS() && (!sdc.IsUsingSavedSdc() ) ) + { + PRDF_TRAC( PRDF_FUNC"Unit CS, Func HUID: %x, TargetType: %x", + PfaData.MsDumpInfo.DumpId, l_targetType ); + if (TYPE_CORE ==l_targetType) + { + //Check if this is last functional core + if ( PlatServices::checkLastFuncCore(l_dumpHandle) ) + { + PRDF_TRAC( PRDF_FUNC"Last Func Core from Gard was true." ); + ForceTerminate = true; + PfaData.LAST_CORE_TERMINATE = true; + errLog->setSev(ERRL_SEV_UNRECOVERABLE); //Update Errl Severity + PfaData.PFA_errlSeverity = ERRL_SEV_UNRECOVERABLE; //Update PFA data + } + } + } + + // Check the errl for the terminate state + // Note: will also be true for CheckStop attn. + bool l_termSRC = false; + PRDF_GET_TERM_SRC(errLog, l_termSRC); + if(l_termSRC) + { + ForceTerminate = true; + uint32_t l_plid = 0; + PRDF_GET_PLID(errLog, l_plid); + PRDF_INF(PRDF_FUNC"check for isTerminateSRC is true. PLID=%.8X", l_plid); + } + + //************************************************************* + // Must check for Manufacturing Mode terminate here and then do + // the needed overrides on ForceTerminate flag. + //************************************************************* + if ( PlatServices::mnfgTerminate() && !ForceTerminate ) + { + ForceTerminate = true; + if ( !((severityParm == ERRL_SEV_RECOVERED) || + (severityParm == ERRL_SEV_INFORMATIONAL)) && + iplDiagMode && + !HW ) + { + //Terminate in Manufacturing Mode, in IPL mode, for visible log, with no HW callouts. + PRDF_SRC_WRITE_TERM_STATE_ON(errLog, SRCI_TERM_STATE_MNFG); + } + //Do not Terminate in Manufacturing Mode if not at threshold. + //Allow Manufacturing Mode Terminate for Thermal Event. It's severityParm will be + //ERRL_SEV_RECOVERED in the current error log. + //MPB1 c Do not Terminate in Manufacturing Mode in Ipl Diag Mode with Deferred Deconfig + else if ( ( ((severityParm == ERRL_SEV_RECOVERED) || (severityParm == ERRL_SEV_INFORMATIONAL)) && + !sdc.IsThermalEvent() ) || + deferDeconfig ) + { + ForceTerminate = false; + actionFlag = (actionFlag | ERRL_ACTION_DONT_TERMINATE); + } + else + { + PRDF_SRC_WRITE_TERM_STATE_ON(errLog, SRCI_TERM_STATE_MNFG); + } + + if (sdc.IsThermalEvent() ) + { //For Manufacturing Mode terminate, change the action flags for Thermal Event. + actionFlag = (ERRL_ACTION_SA | ERRL_ACTION_REPORT | ERRL_ACTION_CALL_HOME); + } + PfaData.PFA_errlActions = actionFlag; + } + + + // Needed to move the errl add user data sections here because of some updates + // of the data required in the Aysnc section for the SMA dual reporting fix. + + //************************************************************** + // Add the PFA data to Error Log User Data + //************************************************************** + UtilMem l_membuf; + l_membuf << PfaData; + PRDF_ADD_FFDC( errLog, (const char*)l_membuf.base(), l_membuf.size(), + prdfErrlVer1, prdfErrlSectPFA5_1 ); + + //************************************************************** + // Check for Manufacturing AVP mode + // If needed: Add the AVP mode data to Error Log User Data + //************************************************************** + + /* FIXME - The MDIA component is being removed from FSP code. This means this MDIA registry variable +will also be removed. Need to confirm if this code is required anymore. + if ( PlatServices::avpMode() ) + { + //Get the AVP Test Case Number from the AVP Test Case Data Registry. The Test Case Number is the first four bytes. + uint32_t avpTCNumber = 0; + size_t sz_uint32 = sizeof(uint32_t); + errlHndl_t errorLog = UtilReg::read ("mdia/AvpTestCaseData", &avpTCNumber, sz_uint32); + // printf("AVP Test Case Number from registry: %.8x \n", avpTCNumber); + if (errorLog) + { + errorLog->commit(PRDF_COMP_ID,ERRL_ACTION_REPORT); + PRDF_ERR( "PRDTRACE: RasServices Failure in AVP Test Case Registry read" ); + delete errorLog; + errorLog = NULL; + } + else + { + //Add Test Case Number to Error Log User Data + UtilMem l_membuf; + l_membuf << avpTCNumber; + errLog->addUsrDtls(l_membuf.base(),l_membuf.size(),PRDF_COMP_ID,prdfErrlVer1,prdfErrlAVPData_1); + } + } +*/ + +#ifndef __HOSTBOOT_MODULE + // FIXME: do we need support for AVP in Hostboot? probably not + if ( PlatServices::hdatAvpMode() ) + { + //Get the AVP Test Case Data from the AVP Test Case Data Registry. + uint8_t avpTCData[64]; + size_t sz_avpTCData = sizeof(avpTCData); + errlHndl_t errorLog = UtilReg::read ("hdat/AvpTestCaseData", avpTCData, sz_avpTCData); + + if (errorLog) + { + PRDF_ERR( PRDF_FUNC"Failure in hdat AVP Test Case Registry read" ); + PRDF_COMMIT_ERRL(errorLog, ERRL_ACTION_REPORT); + } + else + { + //Add Test Case Data to Error Log User Data + const size_t sz_usrDtlsTCData = 29; + uint8_t usrDtlsTCData[sz_usrDtlsTCData]; + memcpy(usrDtlsTCData, avpTCData, 4); + memcpy(&usrDtlsTCData[4], &avpTCData[40], 4); + memcpy(&usrDtlsTCData[8], &avpTCData[37], 1); + memcpy(&usrDtlsTCData[9], &avpTCData[44], 20); + PRDF_ADD_FFDC( errLog, (const char*)usrDtlsTCData, sz_usrDtlsTCData, + prdfErrlVer1, prdfErrlAVPData_2 ); + } + } +#endif // if not __HOSTBOOT_MODULE + + //************************************************************** + // Add SDC Capture data to Error Log User Data + //************************************************************** + // Pulled some code out to incorporate into AddCapData + // Check to make sure Capture Data wasn't added earlier. + if (!capDataAdded) + { + AddCapData(sdc,errLog); + } + + // Note moved the code from here, that was associated with checking for the last + // functional core to be before the PFA data is placed in error log. + + // Collect PRD trace + // NOTE: Each line of trace is on average 36 bytes so 768 bytes should get + // us around 21 lines of trace output. + PRDF_COLLECT_TRACE(errLog, 768); + + //************************************************************** + // Commit the eror log. + // This will also perform Gard and Deconfig actions. + // Do the Unit Dumps if needed. + //************************************************************** + if (sdc.IsDontCommitErrl() && !sdc.IsUnitCS() && (MACHINE_CHECK != attn_type) ) + { + delete errLog; + errLog = NULL; + } + else if (!ReturnELog && !ForceTerminate && !i_sdc.IsMpFatal() && !i_sdc.Terminate()) + { + //Check to see if we need to do a Proc Core dump + if (sdc.IsUnitCS() && (!sdc.IsUsingSavedSdc() ) ) + { + if (l_targetType == TYPE_PROC) + { + // NX Unit Checktop - runtime deconfig each accelerator + errlHndl_t dumpErrl = NULL; + SDC_MRU_LIST mrulist = sdc.GetMruList(); + for (SDC_MRU_LIST::iterator i = mrulist.begin(); + i < mrulist.end(); ++i) + { + //FIXME: need to add accelerators runtime deconfig +/* + TargetHandle_t l_acceleratorHandle = (*i).callout.getMruValues(); + if (TYPE_CORE == PlatServices::getTargetType(l_acceleratorHandle)) + { + dumpErrl = PlatServices::runtimeDeconfig(PlatServices::getHuid(l_acceleratorHandle)); + if (dumpErrl != NULL) + break; + } +*/ + } + + if (dumpErrl != NULL) + { + PRDF_COMMIT_ERRL(dumpErrl, ERRL_ACTION_REPORT); + } + else + { + PRDF_HWUDUMP(dumpErrl, errLog, CONTENT_HWNXLCL, + PfaData.MsDumpInfo.DumpId); + if (dumpErrl != NULL) + { + PRDF_COMMIT_ERRL(dumpErrl, ERRL_ACTION_REPORT); + } + } + } + else + { + errlHndl_t dumpErrl =NULL; + PRDF_RUNTIME_DECONFIG(dumpErrl, l_dumpHandle); + if (dumpErrl != NULL) + { + PRDF_COMMIT_ERRL(dumpErrl, ERRL_ACTION_REPORT); + } + else + { //Call Dump for Proc Core CS + if (TYPE_CORE == l_targetType) + { + PRDF_HWUDUMP(dumpErrl, errLog, CONTENT_SINGLE_CORE_CHECKSTOP, + PfaData.MsDumpInfo.DumpId); + } + // remove dump CONTENT_HWGAL2LCL since no IOHUB dump + // is supported in P8 + // FIXME : will need to add Centaur DMI channel checkstop support later + else + { //This is not Proc ..ie. it is Galaxy 2 + PRDF_ERR( PRDF_FUNC"Unsupported dump for DumpId: %x, TargetType: %x", + PfaData.MsDumpInfo.DumpId, l_targetType ); + } + } + if (dumpErrl != NULL) + { + PRDF_COMMIT_ERRL(dumpErrl, ERRL_ACTION_REPORT); + } + } + } + + // Commit the Error log + // Need to move below here since we'll need + // to pass errLog to PRDF_HWUDUMP + // for FSP specific SRC handling in the future +#ifndef __HOSTBOOT_MODULE + /* FIXME: not sure if we still need this in fips810? + MnfgTrace(esig); */ +#endif + + PRDF_GET_PLID(errLog, dumpPlid); + + bool l_sysTerm = false; + PRDF_HW_COMMIT_ERRL(l_sysTerm, + errLog, + deconfigSched, + actionFlag, + HOM_CONTINUE); + if(true == l_sysTerm) // if sysTerm then we have to commit and delete the log + { + //Just commit the log + uint32_t l_rc = 0; + PRDF_GET_RC(errLog, l_rc); + + uint16_t l_reasonCode = 0; + PRDF_GET_REASONCODE(errLog, l_reasonCode); + + PRDF_INF( PRDF_FUNC"committing error log: PLID=%.8X, ReasonCode=%.8X, RC=%.8X, actions=%.4X", + dumpPlid, + l_reasonCode, + l_rc, actionFlag ); + PRDF_COMMIT_ERRL(errLog, actionFlag); + } + else + { + // Error log has been committed, return NULL Error Log to PrdMain + errLog = NULL; + } + + } + // If the Error Log is not committed (as due to a Terminate condtion), + // the Error Log will be returned to PRDMain + else + { + +#ifndef __HOSTBOOT_MODULE + /* FIXME: not sure if we still need this in fips810? + MnfgTrace(esig); */ +#endif + + PRDF_DTRAC( PRDF_FUNC"generating a terminating, or MP Fatal SRC" ); + if (ForceTerminate && sdc.IsThermalEvent() ) //MP42 a Start + { //For Manufacturing Mode terminate, change the severity in + //the error log to be Predictive for Thermal Event. + errLog->setSev(ERRL_SEV_PREDICTIVE); + } + } + +#ifndef __HOSTBOOT_MODULE + errlHndl_t reg_errl = UtilReg::read ("prdf/RasServices", &sdcSaveFlags, sz_uint8); + if (reg_errl) + { + PRDF_ERR( PRDF_FUNC"Failure in SDC Sync flag Registry read" ); + PRDF_COMMIT_ERRL(reg_errl, ERRL_ACTION_REPORT); + } + else + { + //Turn off indicator that there is saved Sdc Analysis info + sdcSaveFlags &= ( ~SDC_ANALYSIS_SAVE_FLAG ); + reg_errl = UtilReg::write ("prdf/RasServices", &sdcSaveFlags, sz_uint8); + if (reg_errl) + { + PRDF_ERR( PRDF_FUNC"Failure in SDC Sync flag Registry write" ); + PRDF_COMMIT_ERRL(reg_errl, ERRL_ACTION_REPORT); + } + } +#endif + + PRDF_INF( PRDF_FUNC"PRD called to analyze an error: 0x%08x 0x%08x", + esig->getChipId(), esig->getSigId() ); + + //########################################################################## + // Start debug trace output + //########################################################################## + + switch ( sdc.GetAttentionType() ) + { + case MACHINE_CHECK: + PRDF_DTRAC( "PRDTRACE: Attention Type = CHECKSTOP" ); break; + case RECOVERABLE: + PRDF_DTRAC( "PRDTRACE: Attention Type = RECOVERABLE" ); break; + case SPECIAL: + PRDF_DTRAC( "PRDTRACE: Attention Type = SPECIAL" ); break; + default: + PRDF_DTRAC( "PRDTRACE: Attention Type = Unknown" ); + } + + if ( RECOVERABLE == sdc.GetAttentionType() ) + { + PRDF_DTRAC( "PRDTRACE: Hit Count: 0x%x", sdc.GetHits() ); + PRDF_DTRAC( "PRDTRACE: Threshold at: 0x%x", sdc.GetThreshold() ); + PRDF_DTRAC( "PRDTRACE: Mask id: 0x%x", sdc.GetThresholdMaskId() ); + } + + fspmrulist = sdc.GetMruList(); + for ( SDC_MRU_LIST::iterator i = fspmrulist.begin(); + i < fspmrulist.end(); ++i ) + { + PRDF_DTRAC( "PRDTRACE: Callout: %x", i->callout.flatten() ); + + switch ( i->priority ) + { + case MRU_LOW: PRDF_DTRAC( "PRDTRACE: LOW" ); break; + case MRU_MEDC: PRDF_DTRAC( "PRDTRACE: MED_C" ); break; + case MRU_MEDB: PRDF_DTRAC( "PRDTRACE: MED_B" ); break; + case MRU_MEDA: PRDF_DTRAC( "PRDTRACE: MED_A" ); break; + case MRU_MED: PRDF_DTRAC( "PRDTRACE: MED" ); break; + case MRU_HIGH: PRDF_DTRAC( "PRDTRACE: HIGH" ); break; + default: + PRDF_DTRAC( "PRDTRACE: Unknown Priority Value" ); + } + + GardResolution::ErrorType et = sdc.QueryGard(); + switch ( et ) + { + case GardResolution::NoGard: + PRDF_DTRAC( "PRDTRACE: NoGard" ); break; + case GardResolution::Predictive: + PRDF_DTRAC( "PRDTRACE: Predictive" ); break; + case GardResolution::Uncorrectable: + PRDF_DTRAC( "PRDTRACE: Uncorrectable" ); break; + case GardResolution::Fatal: + PRDF_DTRAC( "PRDTRACE: Fatal" ); break; + case GardResolution::Pending: + PRDF_DTRAC( "PRDTRACE: Pending" ); break; + case GardResolution::CheckStopOnlyGard: + PRDF_DTRAC( "PRDTRACE: CheckStopOnlyGard" ); break; + case GardResolution::DeconfigNoGard: + PRDF_DTRAC( "PRDTRACE: DeconfigNoGard" ); + } + } + + PRDF_DTRAC( "PRDTRACE: Flag Values" ); + if ( sdc.IsSUE() ) PRDF_DTRAC( "PRDTRACE: SUE Flag Set" ); + if ( sdc.IsUERE() ) PRDF_DTRAC( "PRDTRACE: UERE Flag Set" ); + if ( sdc.MaybeCrumb() ) PRDF_DTRAC( "PRDTRACE: Check for PCI Crumb" ); + if ( sdc.IsAtThreshold() ) PRDF_DTRAC( "PRDTRACE: AT_THRESHOLD" ); + if ( sdc.IsDegraded() ) PRDF_DTRAC( "PRDTRACE: Performance is degraded" ); + + if ( sdc.IsServiceCall() ) + PRDF_DTRAC( "PRDTRACE: SERVICE REQUIRED" ); + else + PRDF_DTRAC( "PRDTRACE: SERVICE NOT REQUIRED" ); + + if ( sdc.IsMfgTracking() ) PRDF_DTRAC( "PRDTRACE: Track this error" ); + if ( sdc.Terminate() ) PRDF_DTRAC( "PRDTRACE: BRING DOWN MACHINE" ); + if ( sdc.IsLogging() ) PRDF_DTRAC( "PRDTRACE: Create history log entry" ); + if ( sdc.IsFlooding() ) PRDF_DTRAC( "PRDTRACE: Flooding detected" ); + if ( sdc.IsMemorySteered() ) PRDF_DTRAC( "PRDTRACE: Memory steered" ); + + PRDF_DEXIT( PRDF_FUNC ); + + return errLog; + + #undef PRDF_FUNC +} + +void prdfGetTargetString(TargetHandle_t i_pTargetHandle, + char * o_chipName, uint32_t i_sizeOfChipName ) +{ + //FIXME waiting on alternate implementation of toString function in targeting + //FIXME Commenting out current usage of getEntityPathString + //char * l_entityPathString =NULL; + //uint32_t l_tempSize =0; + do + { + if(NULL==i_pTargetHandle ) + { +#ifdef __HOSTBOOT_MODULE + sprintf( o_chipName, "????, " ); +#else + snprintf( o_chipName, i_sizeOfChipName, "????, " ); +#endif + + } + else + { +/* + l_entityPathString =PlatServices::getEntityPathString(i_pTargetHandle); + l_tempSize = strlen(l_entityPathString ); + if(l_tempSize < i_sizeOfChipName) + i_sizeOfChipName = l_tempSize; + memcpy(o_chipName ,l_entityPathString ,i_sizeOfChipName); + free(l_entityPathString); +*/ + } + + } while (0); +} + + +// ---------------------------------------------------------------------------- + +#ifndef __HOSTBOOT_MODULE +void RasServices::MnfgTrace(ErrorSignature * l_esig ) +{ + char * MnfgFilename = NULL; + uint32_t l_size = 0; + const char * MnfgKey[] = {"fstp/P0_Root"}; + + if ( PlatServices::mfgMode() ) + { + errlHndl_t errorLog = UtilReg::path(MnfgKey,1,"prdfMfgErrors",MnfgFilename,l_size); + if (errorLog == NULL) + { + UtilFile l_mfgFile; + l_mfgFile.Open(MnfgFilename,"a+"); + + char l_array[62]; + char l_array2[42]; + uint32_t signature = l_esig->getSigId(); + HUID sigChip = l_esig->getChipId(); + + // Get Entity Path String + TargetHandle_t l_ptempHandle = PlatServices::getTarget(sigChip); + prdfGetTargetString(l_ptempHandle , l_array, 62); + l_mfgFile.write(l_array, strlen(l_array)); + + // Write Signature + snprintf(l_array, 62, "0x%08x,", signature); + l_mfgFile.write(l_array, 24); + + // Write chip ECID data + char ecidString[1024]; + l_ptempHandle = PlatServices::getTarget(PfaData.PfaCalloutList[0].Callout); + //TODO TargetHandle conversion - not sure we need it now + PlatServices::getECIDString(l_ptempHandle , ecidString); + l_mfgFile.write(ecidString, strlen(ecidString)); + + // Write MRU list + uint32_t n = 0; + while ( (n < prdfMruListLIMIT ) && (n < PfaData.PfaCalloutCount) ) + { + snprintf(l_array2, 16, ", %08x", PfaData.PfaCalloutList[n].Callout); + l_mfgFile.write(l_array2, 9); + ++n; + } + snprintf(l_array2, 42, "\n"); + l_mfgFile.write(l_array2, 1); + + l_mfgFile.Close(); + } + else + { + PRDF_ERR( "PRDTRACE: MnfgTrace Failure in getting file path" ); + PRDF_COMMIT_ERRL(errorLog, ERRL_ACTION_REPORT); + } + } + + if (MnfgFilename != NULL) + { //need to free the pathname + free(MnfgFilename); + MnfgFilename = NULL; + } + + return; + +} +#endif // if not __HOSTBOOT_MODULE + +// ---------------------------------------------------------------------------- + +void ErrDataService::AddCapData(ServiceDataCollector & i_sdc, errlHndl_t i_errHdl) +{ + // NOTE: Labels on this structure are not being verified in the + // plugins. If that behavior changes, we must use htonl() + // to fix the endianness on them. + + prdfCaptureData * l_CapDataBuf = new prdfCaptureData; + + for(uint32_t ii = 0; ii < CaptureDataSize; ++ii) + { + l_CapDataBuf->CaptureData[ii] = 0xFF; + } + + l_CapDataBuf->CaptureData_Label = CPTR_Identifier; //Start of Capture Data 'CPTR' + l_CapDataBuf->EndLabel[0] = 0x454E4420; // End of Capture data + l_CapDataBuf->EndLabel[1] = 0x44415441; // 'END DATA' + + uint32_t thisCapDataSize = i_sdc.GetCaptureData().Copy(l_CapDataBuf->CaptureData,CaptureDataSize); + + thisCapDataSize = thisCapDataSize + 32; // include the eye catcher labels + + l_CapDataBuf->PfaCaptureDataSize = thisCapDataSize; + l_CapDataBuf->PfaCaptureDataSize = htonl(l_CapDataBuf->PfaCaptureDataSize); + + //Compress the Capture data + size_t l_compressBufSize = + PrdfCompressBuffer::compressedBufferMax(thisCapDataSize); + const size_t sz_compressCapBuf = l_compressBufSize + 4; + uint8_t * l_compressCapBuf = new uint8_t[sz_compressCapBuf]; + + memcpy(l_compressCapBuf, l_CapDataBuf, 4); // grab CPTR string + PrdfCompressBuffer::compressBuffer( &((uint8_t *) l_CapDataBuf)[4], + (size_t) thisCapDataSize - 4, + &l_compressCapBuf[4], + l_compressBufSize); + + //Add the Compressed Capture data to Error Log User Data + PRDF_ADD_FFDC( i_errHdl, (const char*)l_compressCapBuf, + sz_compressCapBuf, prdfErrlVer2, prdfErrlCapData_1 ); + delete [] l_compressCapBuf; + delete l_CapDataBuf; +} + +// ---------------------------------------------------------------------------- +#ifndef __HOSTBOOT_MODULE + +bool ErrDataService::SdcSave(sdcSaveFlagsEnum i_saveFlag, ServiceDataCollector & i_saveSdc) +{ + #define PRDF_FUNC "SdcRetrieve() " + errlHndl_t errorLog = NULL; + bool rc = false; + uint8_t sdcSaveFlags = SDC_NO_SAVE_FLAGS; + size_t sz_uint8 = sizeof(uint8_t); + const char * UeSdcKeys[] = {"fstp/P1_Root","prdf/UeSdcDataPath"}; + const char * SueSdcKeys[] = {"fstp/P1_Root","prdf/SueSdcDataPath"}; + char * SdcFilename = NULL; + uint32_t l_size = 0; + + do + { + //Need path to the File + if (i_saveFlag == SDC_SAVE_UE_FLAG) + errorLog = UtilReg::path(UeSdcKeys,2,NULL,SdcFilename,l_size); + else if (i_saveFlag == SDC_SAVE_SUE_FLAG) + errorLog = UtilReg::path(SueSdcKeys,2,NULL,SdcFilename,l_size); + else + { + //Should not get here - code error + PRDF_ERR( PRDF_FUNC"Failure - incorrect SDC save flag" ); + rc = true; + break; + } + if (errorLog) + { + PRDF_ERR( PRDF_FUNC"Failure in getting SDC file path" ); + PRDF_COMMIT_ERRL(errorLog, ERRL_ACTION_REPORT); + rc = true; + break; + } + + rc = SdcWrite(SdcFilename, i_saveSdc); + if (rc) + { + break; + } + + //Read current sdc state flags from registry + errorLog = UtilReg::read ("prdf/RasServices", &sdcSaveFlags, sz_uint8); + if (errorLog) + { + PRDF_ERR( PRDF_FUNC"Failure in SDC flag Registry read" ); + PRDF_COMMIT_ERRL(errorLog, ERRL_ACTION_REPORT); + rc = true; + break; + } + + //Update Sdc registry flag + sdcSaveFlags = (sdcSaveFlags | i_saveFlag); + errorLog = UtilReg::write ("prdf/RasServices", &sdcSaveFlags, sz_uint8); + if (errorLog) + { + PRDF_ERR( PRDF_FUNC"Failure in SDC flag Registry write" ); + PRDF_COMMIT_ERRL(errorLog, ERRL_ACTION_REPORT); + rc = true; + break; + } + + + } + while(0); + + if (SdcFilename != NULL) + { //need to free the pathname + free(SdcFilename); + SdcFilename = NULL; + } + + return rc; + + #undef PRDF_FUNC +} + +bool ErrDataService::SdcRetrieve(sdcSaveFlagsEnum i_saveFlag, void * o_buffer) +{ + #define PRDF_FUNC "SdcRetrieve() " + errlHndl_t errorLog = NULL; + bool rc = false; + const char * UeSdcKeys[] = {"fstp/P1_Root","prdf/UeSdcDataPath"}; + const char * SueSdcKeys[] = {"fstp/P1_Root","prdf/SueSdcDataPath"}; + char * SdcFilename = NULL; + uint32_t l_size = 0; + + do + { + //Need path to the File + if (i_saveFlag == SDC_SAVE_UE_FLAG) + errorLog = UtilReg::path(UeSdcKeys,2,NULL,SdcFilename,l_size); + else if (i_saveFlag == SDC_SAVE_SUE_FLAG) + errorLog = UtilReg::path(SueSdcKeys,2,NULL,SdcFilename,l_size); + else + { + //Should not get here - code error + PRDF_ERR(PRDF_FUNC"Failure - incorrect SDC save flag" ); + rc = true; + break; + } + if (errorLog) + { + PRDF_ERR( PRDF_FUNC"Failure in getting SDC file path" ); + PRDF_COMMIT_ERRL(errorLog, ERRL_ACTION_REPORT); + rc = true; + break; + } + + rc = SdcRead (SdcFilename, o_buffer); + + + } + while(0); + + if (SdcFilename != NULL) + { //need to free the pathname + free(SdcFilename); + SdcFilename = NULL; + } + + return rc; + + #undef PRDF_FUNC +} + +#endif // if not __HOSTBOOT_MODULE + +} // End namespace PRDF + +/******************************************************************************/ +// Servicability tags for PRDF Ras Services. +// They are located here because their position in the code is not relevant. +/******************************************************************************/ + + /*@ + * @errortype + * @reasoncode PRDF_HARDWARE_FAIL + * @subsys EPUB_PROCESSOR_SUBSYS + * @subsys EPUB_PROCESSOR_FRU + * @subsys EPUB_PROCESSOR_CHIP_CACHE + * @subsys EPUB_PROCESSOR_UNIT + * @subsys EPUB_PROCESSOR_BUS_CTL + * @subsys EPUB_MEMORY_SUBSYS + * @subsys EPUB_MEMORY_CONTROLLER + * @subsys EPUB_MEMORY_DIMM + * @subsys EPUB_MEMORY_FRU + * @subsys EPUB_EXTERNAL_CACHE + * @subsys EPUB_CEC_HDW_SUBSYS + * @subsys EPUB_CEC_HDW_CLK_CTL + * @subsys EPUB_CEC_HDW_TOD_HDW + * @subsys EPUB_CEC_HDW_SP_PHYP_INTF + * @subsys EPUB_MISC_SUBSYS + * @subsys EPUB_MISC_UNKNOWN + * @subsys EPUB_MISC_INFORMATIONAL + * @subsys EPUB_FIRMWARE_SUBSYS + * @subsys EPUB_FIRMWARE_SP + * @subsys EPUB_FIRMWARE_PHYP + * @subsys EPUB_FIRMWARE_HMC + * @subsys EPUB_EXT_ENVIRO_USER + * @moduleid PRDF_MAIN + * @userdata1 PRD Chip Signature + * @userdata2 PRD Attention Type and Cause Attention Type + * @userdata3 PRD Signature + * @devdesc CEC hardware failure detected + * @procedure EPUB_PRC_SP_CODE + * @procedure EPUB_PRC_PHYP_CODE + * @procedure EPUB_PRC_LVL_SUPP + * @procedure EPUB_PRC_ALL_PROCS + * @procedure EPUB_PRC_REBOOT + */ + + /*@ + * @errortype + * @reasoncode PRDF_DETECTED_FAIL_HARDWARE + * @subsys EPUB_PROCESSOR_SUBSYS + * @subsys EPUB_PROCESSOR_FRU + * @subsys EPUB_PROCESSOR_CHIP_CACHE + * @subsys EPUB_PROCESSOR_UNIT + * @subsys EPUB_PROCESSOR_BUS_CTL + * @subsys EPUB_MEMORY_SUBSYS + * @subsys EPUB_MEMORY_CONTROLLER + * @subsys EPUB_MEMORY_DIMM + * @subsys EPUB_MEMORY_FRU + * @subsys EPUB_EXTERNAL_CACHE + * @subsys EPUB_CEC_HDW_SUBSYS + * @subsys EPUB_CEC_HDW_CLK_CTL + * @subsys EPUB_CEC_HDW_TOD_HDW + * @subsys EPUB_CEC_HDW_SP_PHYP_INTF + * @subsys EPUB_MISC_SUBSYS + * @subsys EPUB_MISC_UNKNOWN + * @subsys EPUB_MISC_INFORMATIONAL + * @subsys EPUB_FIRMWARE_SUBSYS + * @subsys EPUB_FIRMWARE_SP + * @subsys EPUB_FIRMWARE_PHYP + * @subsys EPUB_FIRMWARE_HMC + * @subsys EPUB_EXT_ENVIRO_USER + * @moduleid PRDF_MAIN + * @userdata1 PRD Chip Signature + * @userdata2 PRD Attention Type and Cause Attention Type + * @userdata3 PRD Signature + * @devdesc CEC hardware failure detected. + * @procedure EPUB_PRC_ALL_PROCS + * @procedure EPUB_PRC_REBOOT + */ + + /*@ + * @errortype + * @reasoncode PRDF_DETECTED_FAIL_HARDWARE_PROBABLE + * @subsys EPUB_PROCESSOR_SUBSYS + * @subsys EPUB_PROCESSOR_FRU + * @subsys EPUB_PROCESSOR_CHIP_CACHE + * @subsys EPUB_PROCESSOR_UNIT + * @subsys EPUB_PROCESSOR_BUS_CTL + * @subsys EPUB_MEMORY_SUBSYS + * @subsys EPUB_MEMORY_CONTROLLER + * @subsys EPUB_MEMORY_DIMM + * @subsys EPUB_MEMORY_FRU + * @subsys EPUB_EXTERNAL_CACHE + * @subsys EPUB_CEC_HDW_SUBSYS + * @subsys EPUB_CEC_HDW_CLK_CTL + * @subsys EPUB_CEC_HDW_TOD_HDW + * @subsys EPUB_CEC_HDW_SP_PHYP_INTF + * @subsys EPUB_MISC_SUBSYS + * @subsys EPUB_MISC_UNKNOWN + * @subsys EPUB_MISC_INFORMATIONAL + * @subsys EPUB_FIRMWARE_SUBSYS + * @subsys EPUB_FIRMWARE_SP + * @subsys EPUB_FIRMWARE_PHYP + * @subsys EPUB_FIRMWARE_HMC + * @subsys EPUB_EXT_ENVIRO_USER + * @moduleid PRDF_MAIN + * @userdata1 PRD Chip Signature + * @userdata2 PRD Attention Type and Cause Attention Type + * @userdata3 PRD Signature + * @devdesc CEC hardware failure detected. Cause is most likely hardware, + * but there are other callouts including Software or Next Level + * Support. + * @procedure EPUB_PRC_SP_CODE + * @procedure EPUB_PRC_PHYP_CODE + * @procedure EPUB_PRC_LVL_SUPP + * @procedure EPUB_PRC_ALL_PROCS + * @procedure EPUB_PRC_REBOOT + */ + + /*@ + * @errortype + * @reasoncode PRDF_DETECTED_FAIL_SOFTWARE_PROBABLE + * @subsys EPUB_PROCESSOR_SUBSYS + * @subsys EPUB_PROCESSOR_FRU + * @subsys EPUB_PROCESSOR_CHIP_CACHE + * @subsys EPUB_PROCESSOR_UNIT + * @subsys EPUB_PROCESSOR_BUS_CTL + * @subsys EPUB_MEMORY_SUBSYS + * @subsys EPUB_MEMORY_CONTROLLER + * @subsys EPUB_MEMORY_DIMM + * @subsys EPUB_MEMORY_FRU + * @subsys EPUB_EXTERNAL_CACHE + * @subsys EPUB_CEC_HDW_SUBSYS + * @subsys EPUB_CEC_HDW_CLK_CTL + * @subsys EPUB_CEC_HDW_TOD_HDW + * @subsys EPUB_CEC_HDW_SP_PHYP_INTF + * @subsys EPUB_MISC_SUBSYS + * @subsys EPUB_MISC_UNKNOWN + * @subsys EPUB_MISC_INFORMATIONAL + * @subsys EPUB_FIRMWARE_SUBSYS + * @subsys EPUB_FIRMWARE_SP + * @subsys EPUB_FIRMWARE_PHYP + * @subsys EPUB_FIRMWARE_HMC + * @subsys EPUB_EXT_ENVIRO_USER + * @moduleid PRDF_MAIN + * @userdata1 PRD Chip Signature + * @userdata2 PRD Attention Type and Cause Attention Type + * @userdata3 PRD Signature + * @devdesc CEC hardware failure detected. Cause is most likley Software, + * but there are also Hardware callouts. + * @procedure EPUB_PRC_SP_CODE + * @procedure EPUB_PRC_PHYP_CODE + * @procedure EPUB_PRC_LVL_SUPP + * @procedure EPUB_PRC_ALL_PROCS + * @procedure EPUB_PRC_REBOOT + */ + + /*@ + * @errortype + * @reasoncode PRDF_DETECTED_FAIL_SOFTWARE + * @subsys EPUB_MISC_SUBSYS + * @subsys EPUB_MISC_UNKNOWN + * @subsys EPUB_FIRMWARE_SUBSYS + * @subsys EPUB_FIRMWARE_SP + * @subsys EPUB_FIRMWARE_PHYP + * @subsys EPUB_FIRMWARE_HMC + * @moduleid PRDF_MAIN + * @userdata1 PRD Chip Signature + * @userdata2 PRD Attention Type and Cause Attention Type + * @userdata3 PRD Signature + * @devdesc CEC hardware failure detected. Cause is most likely Software. + * @procedure EPUB_PRC_SP_CODE + * @procedure EPUB_PRC_PHYP_CODE + * @procedure EPUB_PRC_LVL_SUPP + * @procedure EPUB_PRC_ALL_PROCS + * @procedure EPUB_PRC_REBOOT + */ + diff --git a/src/usr/diag/prdf/common/framework/service/prdf_ras_services.H b/src/usr/diag/prdf/common/framework/service/prdf_ras_services.H new file mode 100755 index 000000000..50d8c8f12 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/service/prdf_ras_services.H @@ -0,0 +1,292 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/service/prdf_ras_services.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2002,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +#ifndef PRDF_RAS_SERVICES_H +#define PRDF_RAS_SERVICES_H +/** + @file prdf_ras_services.H + @brief Description +*/ + +#include <xspprdService.h> +#include <errlentry.H> +#include <iipServiceDataCollector.h> + +#ifndef __HOSTBOOT_MODULE + #include <tmgt.H> + #include <prdfPfa5Data.h> //for prdfPfaCalloutListStruct +#endif + +namespace PRDF +{ + +#ifndef __HOSTBOOT_MODULE + const uint32_t thermalCalloutMax = 4; + const uint32_t sdcBufferSize = CaptureDataSize + 200; +#endif + +enum sdcSaveFlagsEnum +{ + SDC_NO_SAVE_FLAGS = 0x00, + SDC_ANALYSIS_SAVE_FLAG = 0x08, + SDC_THERMAL_SAVE_FLAG = 0x04, + SDC_SAVE_UE_FLAG = 0x02, + SDC_SAVE_SUE_FLAG = 0x01 +}; + +class ErrDataService +{ + public: + + /** + * @brief ctor + */ + inline ErrDataService() : + loggingBufferFull(false), + savedLatentSdc(false), + serviceActionCounter(0), + savedPrdReturnCode(0) + {} + + /** + * @brief dtor + */ + inline virtual ~ErrDataService() {} + + /** + * @brief initializer + */ + virtual void Initialize(); + + /** + @brief Create an SRC, PFA data, and Error log for the ServiceData provided + @param[in] attn_type (see iipsdbug.h) + @param[in,out] sdc (see iipServiceData.h) + @return Error Log - Null if successfully committed + @pre SetErrorTod()? + @post Error log(s) build and logged, SRC built, etc. + @exception None. + @note + */ + virtual errlHndl_t GenerateSrcPfa(ATTENTION_TYPE attn_type, ServiceDataCollector & sdc); + + /** + @brief Set the TOD of the current error and check for latent Machine check + @param[in] the_attention (see iipsdbug.h) + @param[in,out] is_latent [true | false] + @param[in,out] sdc + @pre None. + @post Error timestamped with TOD, latency state modifed + @note Uses the SPC interface to get the TOD + */ + virtual void SetErrorTod(ATTENTION_TYPE the_attention,bool *is_latent,ServiceDataCollector & sdc); + + /** + @brief Query if logging buffer full - indicates attention flooding + @return [true | false] + @pre None. + @post None. + */ + virtual bool QueryLoggingBufferFull(void) const; + + /** + @brief Save a return code for inclusion in the SRC (something failed) + @param[in] a return code + @return none. + @pre None. + @post Rc stored + */ + virtual void SaveRcForSrc(int32_t the_rc); + + /** + @brief Add the Service Data Collector Capture Data to the User Data of the Error Log. + @param[in] Service Data Collector + @param[in,out] Error Log + @return None. + @pre None. + @post None. + @exception None. + */ + void AddCapData(ServiceDataCollector & i_sdc, errlHndl_t i_errHdl); + + static void SetTerminateOnCheckstop(bool setting) + { + terminateOnCheckstop = setting; + } + + private: + + /** + * @brief disable copy + */ + ErrDataService(const ErrDataService &); + + /** + * @brief disable assignment + */ + ErrDataService & operator=(const ErrDataService &); + + #ifndef __HOSTBOOT_MODULE + + /** + @brief Write the Flattened SDC to a File to save for later use. Will also + immediate sync the File to the Redundant FSP. Update Registry + value with UE or SUE save status. Note, the Registry is immediately + synced to the Redundand FSP automatically. + @param[in] sdcSaveFlagsEnum + @param[in,out] sdc (see iipServiceData.h) + @return return FALSE if success and TRUE if failure + @pre None. + @post None. + @exception None. + @note + */ + bool SdcSave(sdcSaveFlagsEnum i_saveFlag, ServiceDataCollector & i_saveSdc); + + /** + @brief Read the Flattened SDC File based on the sdc Save Flag input. + @param[in] sdcSaveFlagsEnum + @param[in,out] buffer data is output to + @return return FALSE if success and TRUE if failure + @pre None. + @post None. + @exception None. + @note + */ + bool SdcRetrieve(sdcSaveFlagsEnum i_saveFlag, void * o_buffer); + + #endif // end if not __HOSTBOOT_MODULE + + private: + + bool loggingBufferFull; + bool latentMachineCheck; + bool savedLatentSdc; + + uint32_t serviceActionCounter; + + int32_t savedPrdReturnCode; + + ServiceDataCollector sdc; + ServiceDataCollector latentSdc; + + static bool terminateOnCheckstop; + +}; + +/** + Interface to RAS services provided to PRD +*/ +class RasServices: public ServiceGeneratorClass +{ +public: + + /** + @brief Default ctor + */ + RasServices(void); + + /** + @brief Default dtor + */ + ~RasServices(); + + // Compiler generated dtor is sufficient + + virtual void Initialize(); + + /** + * @brief set the err data service to be used + * + * @param[in] i_ErrDataService new err data service + */ + virtual void setErrDataService(ErrDataService & i_ErrDataService); + + /** + @brief Set the TOD of the current error and check for latent Machine check + @param[in] the_attention (see iipsdbug.h) + @param[in,out] is_latent [true | false] + @param[in,out] sdc + @pre None. + @post Error timestamped with TOD, latency state modifed + @note Uses the SPC interface to get the TOD + */ + virtual void SetErrorTod(ATTENTION_TYPE the_attention,bool *is_latent,ServiceDataCollector & sdc); + + /** + @brief Query if logging buffer full - indicates attention flooding + @param none. + @return [true | false] + @pre None. + @post None. + */ + virtual bool QueryLoggingBufferFull(void) const; + + /** + @brief Save a return code for inclusion in the SRC (something failed) + @param[in] a return code + @return none. + @pre None. + @post Rc stored + */ + virtual void SaveRcForSrc(int32_t the_rc); + + /** + @brief Create an SRC, PFA data, and Error log for the ServiceData provided + @param[in] attn_type (see iipsdbug.h) + @param[in,out] sdc (see iipServiceData.h) + @return Error Log - Null if successfully committed + @pre SetErrorTod()? + @post Error log(s) build and logged, SRC built, etc. + @exception None. + */ + virtual errlHndl_t GenerateSrcPfa(ATTENTION_TYPE attn_type, ServiceDataCollector & sdc); //mp01 c + +#ifndef __HOSTBOOT_MODULE + /** + @brief Add Trace Data to File for Manufacturing. + @param[in] ErrorSignature + @return None. + @pre None. + @post None. + @exception None. + */ + void MnfgTrace(ErrorSignature * l_esig); +#endif + + static void SetTerminateOnCheckstop(bool setting) + { + ErrDataService::SetTerminateOnCheckstop(setting); + } + + +private: // Data + + // actual or sim err data service + ErrDataService * iv_ErrDataService; + +}; + +} // End namespace PRDF + +#endif // PRDF_RAS_SERVICES_H diff --git a/src/usr/diag/prdf/common/framework/service/xspprdService.h b/src/usr/diag/prdf/common/framework/service/xspprdService.h new file mode 100755 index 000000000..4c985ca39 --- /dev/null +++ b/src/usr/diag/prdf/common/framework/service/xspprdService.h @@ -0,0 +1,193 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/service/xspprdService.h $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 1999,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +// Class Description ************************************************* +// +// Name: ServiceGeneratorClass +// Base class: None +// +// Description: Service interface for PRD +// Usage: +// ServiceGenerator serv_generator +// bool latent_machine_check_flag = false; +// ATTENTION_TYPE attentionType = MACHINE_CHECK; (see iipsdbug.h) +// +// ///// Set time + see if latent machine check +// serv_generator.SetErrorTod(attentionType, &latent_machine_check_flag); +// +// ///// Query for flooding condition +// if(serv_generator.QueryLoggingBufferFull()) +// { WE ARE FLOODING.... mask errors } +// +// ///// Save a bad return code to be in th SRC +// serv_generator.SaveRcForSrc((int32_t)analyzeRc); +// +// ServiceDataCollector serviceData; +// // serviceData = results from PRD Analysis; +// ///// Make an SRC for PRD +// rc = serv_generator.GenerateSrcPfa(attentionType, serviceData); +// +// +// End Class Description ********************************************* + + +#if !(defined (xspprdService_h) || defined(IIPSERVICEGENERATOR_H)) +#define xspprdService_h +#define IIPSERVICEGENERATOR_H + + +#if !defined(IIPSDBUG_H) + #include <iipsdbug.h> // for ATTENTION_TYPE +#endif + +#include <errlentry.H> //for errlHndl_t //mp01 a + + +//-------------------------------------------------------------------- +// Forward References +//-------------------------------------------------------------------- +class ServiceDataCollector; + +namespace PRDF +{ + +class ErrDataService; + + +/** + Provide error loging and SRC generation services for PRD + <b>Owner:</b> S. Bailey + <b>CSP Only</b> + */ +class ServiceGeneratorClass +{ +public: + + // dg00 start + /** + Access the current concrete service generator + <ul> + <br><b>Paramters: </b> None + <br><b>Returns: </b> Reference to active ServiceGenerator + <br><b>Requirements:</b> None + <br><b>Promises: </b> ServiceGenerator + <br><b>Notes: </b> The definition of this function should exist + in the *.C of the derived class + </ul><br> + */ + static ServiceGeneratorClass & ThisServiceGenerator(void); + // dg00 end + + /** + Constructor + <ul> + <br><b>Parameters: </b> None + <br><b>Returns: </b> Nothing + <br><b>Requirements:</b> None + <br><b>Promises: </b> Object created + <br><b>Exceptions: </b> None + </ul><br> + */ + ServiceGeneratorClass(void){} + + /* + Destructor + <ul> + <br><b>Parameters: </b> None. + <br><b>Returns: </b> No value returned + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> Compiler default is sufficient + </ul><br> + */ + virtual ~ServiceGeneratorClass(void) {}; + + + virtual void Initialize()=0; + + /** + * @brief set the err data service to be used + * + * @param[in] i_errDataService new err data service + */ + virtual void setErrDataService(ErrDataService & i_errDataService)=0; + + /** + Set the TOD of the current error and check for latent Machine check + <ul> + <br><b>Parameter: </b> the_attention (see iipsdbug.h) + <br><b>Returns: </b> is_latent [true | false] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Error timestamped with TOD, latency state modifed + <br><b>Notes: </b> Uses the SPC interface to get the TOD + </ul><br> + */ + virtual void SetErrorTod(ATTENTION_TYPE the_attention,bool *is_latent,ServiceDataCollector & sdc)=0; + + /** + Query if logging buffer full - indicates attention flooding + <ul> + <br><b>Parameters: </b> none. + <br><b>Returns: </b> [true | false] + <br><b>Requirements:</b> None. + <br><b>Promises: </b> None. + </ul><br> + */ + virtual bool QueryLoggingBufferFull(void) const=0; + + /** + Save a return code for inclusion in the SRC (something failed) + <ul> + <br><b>Parameters: </b> a return code + <br><b>Returns: </b> none. + <br><b>Requirements:</b> None. + <br><b>Promises: </b> Rc stored + </ul><br> + */ + virtual void SaveRcForSrc(int32_t the_rc)=0; + + /** + Create an SRC, PFA data, and Error log for the ServiceData provided + <ul> + <br><b>Parameter: </b> attn_type (see iipsdbug.h) + <br><b>Parameter: </b> sdc (see iipServiceData.h) + <br><b>Returns: </b> Error Log - Null if successfully committed + <br><b>Requirements:</b> SetErrorTod()? + <br><b>Promises: </b> Error log(s) build and logged, SRC built, etc. + <br><b>Exceptions: </b> None. + <br><b>Notes: </b> + </ul><br> + */ + + virtual errlHndl_t GenerateSrcPfa(ATTENTION_TYPE attn_type, ServiceDataCollector & sdc)=0; // mp01 c + +private: + + +}; + +} // End namespace PRDF + +#endif /* xspprdService_h */ + diff --git a/src/usr/diag/prdf/common/framework/service/xspprdsdbug.C b/src/usr/diag/prdf/common/framework/service/xspprdsdbug.C new file mode 100755 index 000000000..8b52aecca --- /dev/null +++ b/src/usr/diag/prdf/common/framework/service/xspprdsdbug.C @@ -0,0 +1,238 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/diag/prdf/common/framework/service/xspprdsdbug.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2000,2012 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ + +// Module Description ************************************************** +// +// Description: definition of iipsdbug.h (SYSTEM_DEBUG_CLASS) for regatta +// PRD wrapper of sysdebug +// +// End Module Description ********************************************** + +//---------------------------------------------------------------------- +// Includes +//---------------------------------------------------------------------- +#define xspprdsdbug_C + +#ifndef __HOSTBOOT_MODULE + +#include <fcntl.h> // for O_RDONLY O_WRONLY etc.. +#include <unistd.h> // for ::read() ::write() +#include <utilreg.H> + +#endif + +#include <string.h> // for memcpy + +#include <errlentry.H> + +#include <prdfMain.H> +#include <iipstep.h> +#include <iipServiceDataCollector.h> +#include <iipsdbug.h> +#include <iipglobl.h> +#include <prdf_service_codes.H> +#include <prdfBitString.H> +#include <prdfPlatServices.H> + +#undef xspprdsdbug_C + +using namespace PRDF; + +//---------------------------------------------------------------------- +// User Types +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Macros +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Internal Function Prototypes +//---------------------------------------------------------------------- + +//---------------------------------------------------------------------- +// Global Variables +//---------------------------------------------------------------------- + +AttnList g_AttnDataList; +bool g_init_done = false; +uint32_t * g_src = NULL; + +//--------------------------------------------------------------------- +// Member Function Specifications +//--------------------------------------------------------------------- + +SYSTEM_DEBUG_CLASS::SYSTEM_DEBUG_CLASS(void) +{ +} + +uint32_t SYSTEM_DEBUG_CLASS::Reinitialize(const PRDF::AttnList & i_attnList) +{ + uint32_t l_rc = 0; + + do + { + if( i_attnList.empty() ) + { + PRDF_ERR( "SYSTEM_DEBUG_CLASS::Reinitialize() input AttnList is empty" ); + /*@ + * @errortype + * @subsys EPUB_FIRMWARE_SP + * @reasoncode PRDF_CODE_FAIL + * @moduleid PRDF_SDBUG_INIT + * @userdata1 0 + * @userdata2 0 + * @userdata3 0 + * @userdata4 0 + * @devdesc input AttnList is empty. + * @procedure EPUB_PRC_SP_CODE + */ + PRDF_CREATE_ERRL(g_prd_errlHndl, + ERRL_SEV_DIAGNOSTIC_ERROR1, // error on diagnostic + ERRL_ETYPE_NOT_APPLICABLE, + SRCI_MACH_CHECK, + SRCI_NO_ATTR, + PRDF_SDBUG_INIT, // module id + FSP_DEFAULT_REFCODE, + PRDF_CODE_FAIL, // Reason code + 0, // user data word 1 + 0, // user data word 2 + 0, // user data word 3 + 0 // user data word 4 + ); + + PRDF_ADD_PROCEDURE_CALLOUT(g_prd_errlHndl, SRCI_PRIORITY_MED, EPUB_PRC_SP_CODE); + l_rc = PRD_ATTN_DATA_ACCESS_FAILED; + + break; + } + + g_AttnDataList = i_attnList; + + g_init_done = true; + + } while(0); + + return l_rc; +} + +// -------------------------------------------------------------------- + +bool SYSTEM_DEBUG_CLASS::IsAttentionActive( TARGETING::TargetHandle_t i_pChipHandle ) const +{ + bool rc = false; + + for(AttnList::const_iterator i = g_AttnDataList.begin(); i != g_AttnDataList.end(); ++i) + { + if((*i).targetHndl == i_pChipHandle) + { + rc = true; + break; + } + } + return rc; +} + +void SYSTEM_DEBUG_CLASS::Clear(void) +{ + g_AttnDataList.clear(); +} + +// ------------------------------------------------------------------- + +uint8_t SYSTEM_DEBUG_CLASS::GetAttentionType(TARGETING::TargetHandle_t i_pChipHandle) const +{ + uint8_t type = INVALID_ATTENTION_TYPE; + + for(AttnList::const_iterator i = g_AttnDataList.begin(); i != g_AttnDataList.end(); ++i) + { + if((*i).targetHndl == i_pChipHandle) + { + type = (uint8_t) (*i).attnType; + break; + } + } + + return (uint8_t) type; +} + + +// ------------------------------------------------------------------- + +void SYSTEM_DEBUG_CLASS::SetPrdSrcPointer() +{ + g_src = NULL; +} + +void SYSTEM_DEBUG_CLASS::SetPrdSrcPointer(uint32_t* src_ptr) +{ + g_src = src_ptr; +} + +// ------------------------------------------------------------------- + +void SYSTEM_DEBUG_CLASS::CalloutThoseAtAttention(STEP_CODE_DATA_STRUCT & serviceData) const +{ + ServiceDataCollector * sdc = serviceData.service_data; + + CaptureData & capture = sdc->GetCaptureData(); + + for(AttnList::const_iterator i = g_AttnDataList.begin(); i != g_AttnDataList.end(); ++i) + { + sdc->SetCallout((*i).targetHndl); + AttnData ad(*i); + prdfBitString cbs(sizeof(AttnData)*8,(CPU_WORD *)&ad); + + capture.Add(PlatServices::getSystemTarget(),0,cbs); + } + + sdc->SetCallout(NextLevelSupport_ENUM); + +} + +// -------------------------------------------------------------------- +// SIMULATION SUPPORT for setting up sysdbug +// -------------------------------------------------------------------- +const uint32_t *SYSTEM_DEBUG_CLASS::GetPrdSrcPointer(void) const +{ + return g_src; +} + +void SYSTEM_DEBUG_CLASS::SetAttentionType(TARGETING::TargetHandle_t i_pTargetHandle, + ATTENTION_VALUE_TYPE i_eAttnType) +{ + if(i_eAttnType > INVALID_ATTENTION_TYPE) + { + if(!IsAttentionActive(i_pTargetHandle)) + { + AttnData attnData; + attnData.targetHndl = i_pTargetHandle; + attnData.attnType = i_eAttnType; + g_AttnDataList.push_back(attnData); + } + } +} |